commandcode 0.1.7: a list that can't be had says so — the Go table, or the defaults, handed back when Command Code's list fails is marked Symbol.for("magpie.fellBack"), and magpie keeps the list it was told last, as the built-in keeps the one it fetched last. models.test.mjs checks the mark on each failure and its absence on a list read.

This commit is contained in:
yetone
2026-10-01 17:06:07 +08:00
parent ce298d8ad9
commit ea1ab932ef
3 changed files with 17 additions and 4 deletions
+2
View File
@@ -54,6 +54,7 @@ test("Go lists Command Code's models less those Go is refused, asked without the
expect(Object.keys(k3.variants)).toEqual(["low", "high", "max"])
expect(k3.capabilities.attachment).toBe(true)
expect(k3.limit.context).toBe(1_000_000)
expect(ms[Symbol.for("magpie.fellBack")]).toBeUndefined()
// every Go model on chat completions, which the fetch sends to /alpha/generate
expect(new Set(Object.values(ms).map((m) => m.api.npm))).toEqual(new Set(["@ai-sdk/openai-compatible"]))
})
@@ -64,6 +65,7 @@ test("the CLI's table stands in when the list can't be had, and offers nothing G
for (const reply of [500, "not json", JSON.stringify({ data: [] }), JSON.stringify({ data: [{ id: "claude-opus-5-5" }, { id: "gpt-6-sol" }] })]) {
const { ms } = await models(reply)
expect(Object.keys(ms)).toEqual(_internal.GO_MODELS.map((m) => m.id))
expect(ms[Symbol.for("magpie.fellBack")]).toBe(true)
}
})