From 6c6677d0f3dc34f27a7c0677c46f91e552a67071 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 15 Nov 2026 14:03:42 +0800 Subject: [PATCH] devin 0.1.42: the snapshot list, served when Devin can't be asked, is marked fell back MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When neither GetCliModelConfigs nor the devin CLI named the account's models, the models hook served the snapshot list (with images) unmarked. Archivemylife on X (agy-cli): "配置后报存提示成功,再打开还是全部都启用". The same class as agy-cli 0.1.61: a list that isn't the account's own, handed back as if it were, makes magpie relist on it and drop the models the user picked that aren't in it. Marked with Symbol.for("magpie.fellBack"), magpie's plugin host keeps the last good list (keepListed) and the picks. Run (mote-run, HOME=mktemp -d): images.test.mjs 5 pass on this change: all pass. Red on the old code with the new test: "when Devin can't be asked" fails (fellBack undefined). Not tried: a real account. --- packages/devin/images.test.mjs | 4 ++++ packages/devin/index.mjs | 11 ++++++++++- packages/devin/package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/devin/images.test.mjs b/packages/devin/images.test.mjs index cd5f1c1..17f2a84 100644 --- a/packages/devin/images.test.mjs +++ b/packages/devin/images.test.mjs @@ -102,6 +102,7 @@ test("an account's list without the CLI takes what Devin says of images now", as // Devin's word now over the snapshot's expect(got["deepseek-v4-flash"].capabilities.input.image).toBe(true) expect(got["glm-5.2"].capabilities.input.image).toBe(false) + expect(got[Symbol.for("magpie.fellBack")]).toBeUndefined() }) test("when Devin can't be asked, the list takes the snapshot's word", async () => { @@ -111,4 +112,7 @@ test("when Devin can't be asked, the list takes the snapshot's word", async () = const got = await (await DevinAuthPlugin()).provider.models({ models: given }, { auth: { type: "api", key: "devin-key" } }) expect(got["swe-2"].capabilities).toEqual({ attachment: true, input: { text: true, image: true } }) expect(withImages(given, [{ id: "swe-2" }])).toEqual(given) + // the snapshot isn't the account's list: 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) }) diff --git a/packages/devin/index.mjs b/packages/devin/index.mjs index b490a5b..731d3b5 100644 --- a/packages/devin/index.mjs +++ b/packages/devin/index.mjs @@ -605,6 +605,12 @@ function runtimeModel(m) { // withImages is a list of models with what entries (listed's) say of their // images on them; a model they say nothing of is left as it was. +// fellBack marks a list that isn't the account's own (magpie's plugin +// host reads Symbol.for("magpie.fellBack")) +function fellBack(models) { + return Object.assign(models, { [Symbol.for("magpie.fellBack")]: true }) +} + function withImages(models, entries) { const by = new Map(entries.map((m) => [m.id, m.image])) return Object.fromEntries( @@ -3292,7 +3298,10 @@ export async function DevinAuthPlugin({ client, magpie } = {}, options = {}) { const images = await imagesFor(key, server) const { free, prices } = await configsFor(key, server) const families = await ownFamilies(key, server) - if (!families) return withImages(provider.models, listed(familiesOf(SNAPSHOT), Object.keys(provider?.models ?? {}), images)) + // neither Devin nor the CLI named the account's models: the list + // is the snapshot's, so magpie keeps the account's last good list + // (and the models the user picked from it) over this one + if (!families) return fellBack(withImages(provider.models, listed(familiesOf(SNAPSHOT), Object.keys(provider?.models ?? {}), images))) return Object.fromEntries(listed(families, Object.keys(provider?.models ?? {}), images, free, prices).map((m) => [m.id, runtimeModel(m)])) }, }, diff --git a/packages/devin/package.json b/packages/devin/package.json index 6bf80da..d70cfff 100644 --- a/packages/devin/package.json +++ b/packages/devin/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-devin-auth", - "version": "0.1.41", + "version": "0.1.42", "description": "Devin subscriptions (the devin CLI's account) in OpenCode and magpie", "type": "module", "main": "./index.mjs",