diff --git a/packages/inkstone/api.test.mjs b/packages/inkstone/api.test.mjs index a03482b..af49201 100644 --- a/packages/inkstone/api.test.mjs +++ b/packages/inkstone/api.test.mjs @@ -48,6 +48,7 @@ test("the listing is the key's live set intersected with the public metadata", a expect(models["glm-5.3"].reasoning).toBe(true) expect(models["Agents-A1"].capabilities.input.image).toBe(true) expect(models["glm-5.3"].variants).toBeUndefined() + expect(models[Symbol.for("magpie.fellBack")]).toBeUndefined() // the magpie-only price markers reach provider.models too expect(models["glm-5.3"].rate).toBe(8) expect(models["glm-5.3"].free).toBeUndefined() @@ -91,6 +92,9 @@ test("a catalogue read that fails keeps the declared models", async () => { const given = { "glm-5.3": {} } const got = await p.provider.models({ id: "intern-inkstone", models: given }, { auth }) expect(got).toEqual(given) + // and says they aren't the account's list, so magpie keeps the one it + // had and the models picked from it (Archivemylife on X, agy-cli's sibling) + expect(got[Symbol.for("magpie.fellBack")]).toBe(true) }) test("an account with no auth yet still sees the bootstrap list", async () => { diff --git a/packages/inkstone/index.mjs b/packages/inkstone/index.mjs index 9eb23d6..4b42c85 100644 --- a/packages/inkstone/index.mjs +++ b/packages/inkstone/index.mjs @@ -469,7 +469,9 @@ export async function InkStoneAuthPlugin({ client, magpie } = {}, options = {}) // A refused key calls nothing; a failed read keeps the known set. if (e?.refused || e?.status === 401 || e?.status === 403) return {} log("warn", `inkstone: keeping the declared models (${e?.message ?? e})`) - return declared + // not the account's list: magpie keeps the one it had, and the + // models picked from it, over these (Symbol.for("magpie.fellBack")) + return Object.defineProperty({ ...declared }, Symbol.for("magpie.fellBack"), { value: true }) } }, }, diff --git a/packages/inkstone/package.json b/packages/inkstone/package.json index 4fdea70..c2385da 100644 --- a/packages/inkstone/package.json +++ b/packages/inkstone/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-inkstone-auth", - "version": "0.1.5", + "version": "0.1.6", "description": "Intern InkStone (书生·端砚) TokenPlan in OpenCode and magpie: one console sign-in gives the ink-credit balance, the 5-hour and 7-day windows and the credit packs, and (with an API key) the plan's models for chat", "type": "module", "main": "./opencode.mjs",