zed 0.1.8: a free account's card says "No plan", as the built-in's did, and the README says what the plugin and magpie now do
What changed:
- usage: magpie's built-in zedLoginQuota showed a free account's card
(plan_v3 zed_free, or none) as "No plan", unless an overdue invoice was
its error, while the account row kept zed.PlanName's "Free". magpie's
card knows "No plan" (app.js noPlan) and translates it. The plugin's card
said "Free". It now says "No plan" in the same case; the sign-in still
saves planName "Free", and an overdue free card keeps "Free" with its
error, as the built-in's switch did.
- README: "Not included" listed the plan display, which the usage hook has
shown since 0.1.x, and several accounts and the web-search stand-in,
which magpie gives a plugin provider itself (plugin_accounts.go, the
gateway's generic searchReply path). It is now a "Usage" section and an
"In magpie, not the plugin" section.
What was run:
- usage.test.mjs: the free-account test (zed_free, "" and an overdue free
account) fails on 0.1.7's index.mjs ("Free" for "No plan"), passes now.
- packages/zed under a scratch HOME: 31 pass, 0 fail (4 files).
- bun scripts/check.mjs zed passes.
Not tried: a real free Zed account.
This commit is contained in:
+21
-5
@@ -72,9 +72,25 @@ GitHub login.
|
||||
(Claude Sonnet 5, Opus 5.5, Haiku 4.5, GPT-5.5, Gemini 3.5 Flash,
|
||||
Grok 4.7), which the account's list replaces.
|
||||
|
||||
## Not included
|
||||
## Usage
|
||||
|
||||
- magpie's plan display: plan name, billing period, overdue invoices. Zed
|
||||
doesn't report how much of the allowance is spent.
|
||||
- Several Zed accounts at once. OpenCode keeps one sign-in per provider.
|
||||
- magpie's web-search stand-in.
|
||||
magpie's `auth.usage` hook shows what Zed tells its editor of the plan,
|
||||
as magpie's built-in Zed account did. Zed doesn't report how much of the
|
||||
allowance is spent, so there are no windows:
|
||||
|
||||
- the plan's name (Pro, Pro Trial, Business, Student, VIP). A free
|
||||
account's card says "No plan"; its account row still names it Free;
|
||||
- when the billing period ends;
|
||||
- an overdue invoice, as the card's error ("its models are paused");
|
||||
- a sign-in Zed refuses (`/users/me` or the model list answering 401)
|
||||
marks the account as needing to sign in again. A plan that changed is
|
||||
saved with the sign-in.
|
||||
|
||||
## In magpie, not the plugin
|
||||
|
||||
These come from magpie itself, as they did for the built-in:
|
||||
|
||||
- Several Zed accounts at once. magpie keeps a sign-in per account and
|
||||
switches between them; plain OpenCode keeps one sign-in per provider.
|
||||
- Web search. A model that can't search is given magpie's web-search
|
||||
stand-in, when a search API is set up in magpie.
|
||||
|
||||
@@ -988,7 +988,12 @@ async function usage(auth, save) {
|
||||
}
|
||||
const end = me.plan?.subscription_period?.ended_at
|
||||
if (typeof end === "string" && RFC3339.test(end) && !isNaN(Date.parse(end))) out.until = end
|
||||
// the account's row keeps naming a free plan "Free" (planName, saved
|
||||
// above); its card says "No plan", which magpie's card knows and
|
||||
// translates, unless an overdue invoice is what it says, as the
|
||||
// built-in's zedLoginQuota did
|
||||
if (me.plan?.has_overdue_invoices) out.error = "Zed: this account has an overdue invoice, so its models are paused (see zed.dev/account)"
|
||||
else if (plan === "zed_free" || plan === "") out.plan = "No plan"
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-zed-auth",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"description": "Sign in to a Zed subscription (Zed Pro, trial, student, business) from OpenCode or magpie",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
@@ -43,11 +43,16 @@ test("a Pro account: its plan and its period's end, no windows", async () => {
|
||||
expect(saved).toEqual([])
|
||||
})
|
||||
|
||||
test("a free account reads Free, as the built-in's row names it, and the plan it moved to is kept", async () => {
|
||||
test("a free account's card says No plan, as the built-in's zedLoginQuota did; its row keeps Free, and the plan it moved to is kept", async () => {
|
||||
const { u, saved } = await run(auth(), () => new Response(me("zed_free")))
|
||||
expect(u).toEqual({ plan: "Free", until: "2026-10-01T00:00:00Z", signIn: "kept" })
|
||||
expect(u).toEqual({ plan: "No plan", until: "2026-10-01T00:00:00Z", signIn: "kept" })
|
||||
expect(saved.length).toBe(1)
|
||||
expect(JSON.parse(saved[0].body.refresh)).toMatchObject({ plan: "zed_free", planName: "Free" })
|
||||
// an account that names no plan at all is free too
|
||||
expect((await run(auth(), () => new Response(me("")))).u.plan).toBe("No plan")
|
||||
// an overdue invoice is what a free card says, its plan named as the row names it
|
||||
expect((await run(auth(), () => new Response(me("zed_free", true)))).u).toEqual({ plan: "Free", until: "2026-10-01T00:00:00Z",
|
||||
error: "Zed: this account has an overdue invoice, so its models are paused (see zed.dev/account)", signIn: "kept" })
|
||||
})
|
||||
|
||||
test("an overdue invoice is the error it is", async () => {
|
||||
|
||||
Reference in New Issue
Block a user