commandcode 0.1.18: Jev (typesafe/jev), Command Code's decision model, can be picked in magpie
joeliu96872540 on X: magpie couldn't get Command Code's typesafe/jev.
Command Code's /provider/v1/models (94 models) doesn't list it; the CLI
(command-code 1.88.2, read from its bundle, not run) knows it as
SYSTEM_ONE_MODELS ["typesafe/jev"], asked at POST /provider/v1/systemone
with {model, state, questions} and buildCommandAuthHeaders, answered with
{model, answers, usage}. That is magpie's System One shape.
- config sets decide: true on the provider and adds Jev to its models,
marked decides (magpie's plugin decision API, yetone/magpie#1514).
- provider.models adds Jev, marked, to every plan's list (Go's, the live
one, the default standing in); Command Code decides which plans may ask.
- fetch sends a /systemone question as the CLI does: its headers
(User-Agent cli, x-command-code-version 1.88.2, project slug, session,
Bearer key, x-cmd-zdr when ZDR is on), not the chat's x-api-key, with
Jev's other names (jev, jev-latest, typesafe-ai/jev) sent as
typesafe/jev. The answer goes back as it came; a refusal through
failure(), the account kept; a Go plan's "no API access" keeps the key
as Go's.
- The plan-list tests that count chat models leave Jev out (talking()).
Run: bun test in packages/commandcode on mote: 72 pass, 1 skip (as
before), 0 fail; bun scripts/check.mjs all green. Broken by hand (the
/systemone branch, decide and withJev turned off): 6 of jev.test.mjs's 8
go red; the ZDR and Go-refusal cases pass either way, as the generic
Provider API path does the same for them.
Not tried: a real Command Code account (none in a sandbox HOME), so no
real /systemone answer has been seen, nor which plans Command Code lets
ask Jev.
This commit is contained in:
@@ -125,6 +125,19 @@ as taking them when it is a Claude model, or when the default list or the
|
||||
CLI's table says so. For any other model the plugin says nothing either
|
||||
way, and magpie answers from models.dev, as its built-in did.
|
||||
|
||||
## Jev, a decision model
|
||||
|
||||
Command Code serves TypeSafe's Jev (`typesafe/jev`), a decision model: it
|
||||
answers typed questions (`{"state", "questions"}`) with probabilities, and
|
||||
holds no conversation. Its `/models` list doesn't name it, so the plugin
|
||||
adds it to every plan's list, marked `decides`, and sets `decide` on the
|
||||
provider. magpie then offers it as a routing group's classifier and at its
|
||||
`/v1/systemone` (as `commandcode-plan/typesafe/jev`), never to an agent to
|
||||
chat with. A question goes to `POST /provider/v1/systemone` as the CLI
|
||||
(1.88.2) sends it, with the CLI's headers, and Zero Data Retention when the
|
||||
switch is on. Command Code decides which plans may use it; a refusal reaches
|
||||
magpie with its status, as a chat's does.
|
||||
|
||||
## Not included
|
||||
|
||||
- Usage and quota (`/alpha/billing/credits`, the 5-hour and weekly windows).
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
import { afterEach, expect, test } from "bun:test"
|
||||
import { CommandCodePlugin, _internal } from "./index.mjs"
|
||||
|
||||
// talking leaves out the decision model (Jev, jev.test.mjs), which every
|
||||
// plan's list has beside the models it talks to
|
||||
const talking = (ms) => {
|
||||
delete ms[_internal.JEV]
|
||||
return ms
|
||||
}
|
||||
|
||||
const real = globalThis.fetch
|
||||
const subWait = _internal.waits.subWait
|
||||
afterEach(() => {
|
||||
@@ -77,7 +84,7 @@ test("the key's models are Go's after the refusal", async () => {
|
||||
const auth = { type: "api", key: "go-key" }
|
||||
const { hooks, opts } = await plugin(auth)
|
||||
await chat(opts)
|
||||
const ms = await hooks.provider.models({ models: {} }, { auth })
|
||||
const ms = talking(await hooks.provider.models({ models: {} }, { auth }))
|
||||
expect(Object.keys(ms)).toEqual(_internal.GO_MODELS.filter((m) => !_internal.GO_REFUSED.has(m.id)).map((m) => m.id))
|
||||
})
|
||||
|
||||
|
||||
@@ -36,6 +36,18 @@ const MAX_TOKENS = 64000 // the CLI's max_tokens when none is asked
|
||||
// expected number to be <=200000 at params.max_tokens") — magpie's
|
||||
// CommandCodeMaxOutput
|
||||
const MAX_OUTPUT = 200_000
|
||||
// TypeSafe's System One, as the CLI asks it (command-code 1.88.2:
|
||||
// SYSTEM_ONE_ROUTE "/provider/v1/systemone", SYSTEM_ONE_MODELS
|
||||
// ["typesafe/jev"]): a decision model, which answers typed questions
|
||||
// ({state, questions}) with probabilities and holds no conversation. Its
|
||||
// list (/provider/v1/models) doesn't name it. SYSTEM_ONE_CLI is the CLI
|
||||
// whose request this is, sent as its x-command-code-version.
|
||||
const JEV = "typesafe/jev"
|
||||
const SYSTEM_ONE = BASE + "/systemone"
|
||||
const SYSTEM_ONE_CLI = "1.88.2"
|
||||
// the CLI's resolveSystemOneModel table
|
||||
const JEV_NAMES = { jev: JEV, "jev-latest": JEV, [JEV]: JEV, "typesafe-ai/jev": JEV }
|
||||
const JEV_MODEL = { id: JEV, name: "Jev", context: 0, decides: true }
|
||||
const ORIGINS = ["https://commandcode.ai", "https://staging.commandcode.ai"]
|
||||
const SIGN_IN_TIMEOUT = 10 * 60 * 1000
|
||||
|
||||
@@ -226,7 +238,9 @@ function configModel(m) {
|
||||
...(m.efforts?.length
|
||||
? { reasoning: true, variants: Object.fromEntries(m.efforts.map((e) => [e, { reasoningEffort: e }])) }
|
||||
: {}),
|
||||
tool_call: true,
|
||||
tool_call: !m.decides,
|
||||
// magpie's own field: a decision model, asked at /systemone
|
||||
...(m.decides ? { decides: true } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,9 +276,19 @@ function runtimeModel(m) {
|
||||
variants: Object.fromEntries((m.efforts ?? []).map((e) => [e, { reasoningEffort: e }])),
|
||||
// magpie's plugin host reads it; the CLI calls the model free
|
||||
...(FREE.has(m.id) ? { free: true } : {}),
|
||||
// magpie's plugin host reads it: a decision model, asked at /systemone
|
||||
...(m.decides ? { decides: true } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
// withJev is a plan's list with Jev, which Command Code's list doesn't
|
||||
// name: the CLI offers it to every plan, and Command Code answers for the
|
||||
// plan when it is asked.
|
||||
function withJev(out) {
|
||||
if (!out[JEV]) out[JEV] = runtimeModel(JEV_MODEL)
|
||||
return out
|
||||
}
|
||||
|
||||
// liveModels is the Provider API's list, with the APIs each model is
|
||||
// served on (its Claude models on /messages alone, the open ones on
|
||||
// /chat/completions and /responses, some on /responses alone); the default list's names and
|
||||
@@ -1267,9 +1291,34 @@ function providerBody(chat) {
|
||||
return e === out.reasoning_effort ? undefined : JSON.stringify(out)
|
||||
}
|
||||
|
||||
// systemOne asks Command Code's System One as the CLI asks it: the
|
||||
// question magpie sent ({model, state, questions}), its model as the CLI
|
||||
// names it, with the CLI's headers. Its answer ({model, answers, usage})
|
||||
// goes back as it came; a refusal as the built-in's are.
|
||||
async function systemOne(key, init, input, place, zdr) {
|
||||
let ask
|
||||
try {
|
||||
const b = init.body ?? (input instanceof Request ? await input.clone().text() : undefined)
|
||||
ask = JSON.parse(typeof b === "string" ? b : new TextDecoder().decode(b))
|
||||
if (ask === null || typeof ask !== "object" || Array.isArray(ask)) throw 0
|
||||
} catch {
|
||||
return { res: errorResponse({ status: 400, message: "a decision model takes a JSON request, not a prompt" }) }
|
||||
}
|
||||
const model = JEV_NAMES[String(ask.model ?? "").toLowerCase()] ?? ask.model ?? JEV
|
||||
const res = await fetch(SYSTEM_ONE, {
|
||||
method: "POST",
|
||||
headers: { ...generateHeaders(key, zdr, place), "x-command-code-version": SYSTEM_ONE_CLI },
|
||||
body: JSON.stringify({ ...ask, model }),
|
||||
signal: init.signal,
|
||||
})
|
||||
if (res.ok) return { res: kept(res) }
|
||||
const text = (await res.text()).slice(0, 1 << 20)
|
||||
return { res: errorResponse(failure(res.status, text)), go: GO_NO_API.test(text) }
|
||||
}
|
||||
|
||||
// ---- the plugin ---------------------------------------------------------------
|
||||
|
||||
export const _internal = { projectSlug, subsSeen, extraSeen, waits, liveKey, failure, goModels, refuses, GO_MODELS, GO_REFUSED, zdrOn }
|
||||
export const _internal = { JEV, projectSlug, subsSeen, extraSeen, waits, liveKey, failure, goModels, refuses, GO_MODELS, GO_REFUSED, zdrOn }
|
||||
|
||||
export async function CommandCodePlugin({ client, magpie } = {}) {
|
||||
// isGo keeps a key as Go's, for its models and endpoint: in the
|
||||
@@ -1309,7 +1358,15 @@ export async function CommandCodePlugin({ client, magpie } = {}) {
|
||||
// the model) goes on to the agent as it came
|
||||
const zdr = zdrOn(magpie)
|
||||
if (zdr) headers.set(ZDR, "1")
|
||||
const chatting = /\/chat\/completions$/.test(new URL(url).pathname)
|
||||
const path = new URL(url).pathname
|
||||
// a decision model's question (magpie's System One), as the
|
||||
// CLI sends it: with the CLI's headers, not the chat's
|
||||
if (/\/systemone\/?$/.test(path)) {
|
||||
const { res, go } = await systemOne(key, init, input, place, zdr)
|
||||
if (go) await isGo(key, (await getAuth()) ?? auth)
|
||||
return res
|
||||
}
|
||||
const chatting = /\/chat\/completions$/.test(path)
|
||||
let chat
|
||||
if (chatting) {
|
||||
try {
|
||||
@@ -1381,8 +1438,11 @@ export async function CommandCodePlugin({ client, magpie } = {}) {
|
||||
name: "Command Code Plan",
|
||||
npm: CHAT,
|
||||
api: BASE,
|
||||
// magpie's own field: the provider answers System One (Jev) at
|
||||
// its base's /systemone, through the fetch
|
||||
decide: true,
|
||||
...was,
|
||||
models: { ...Object.fromEntries(MODELS.map((m) => [m.id, configModel(m)])), ...(was.models ?? {}) },
|
||||
models: { ...Object.fromEntries([...MODELS, JEV_MODEL].map((m) => [m.id, configModel(m)])), ...(was.models ?? {}) },
|
||||
}
|
||||
},
|
||||
// the plan's list: the Provider API's, with what each model is served
|
||||
@@ -1410,15 +1470,15 @@ export async function CommandCodePlugin({ client, magpie } = {}) {
|
||||
// the CLI's table stands in: magpie keeps the list it was told
|
||||
// last, as the built-in keeps the one it fetched last
|
||||
if (fell) out[FELL_BACK] = true
|
||||
return out
|
||||
return withJev(out)
|
||||
}
|
||||
try {
|
||||
const out = Object.fromEntries((await liveModels(key)).filter((m) => keep(m.id)).map((m) => [m.id, runtimeModel(m)]))
|
||||
if (Object.keys(out).length) return out
|
||||
if (Object.keys(out).length) return withJev(out)
|
||||
} catch {}
|
||||
// the default list stands in, less what the plan refuses
|
||||
const out = Object.fromEntries(Object.entries(provider.models ?? {}).filter(([id]) => keep(id)))
|
||||
return Object.assign(out, { [FELL_BACK]: true })
|
||||
return Object.assign(withJev(out), { [FELL_BACK]: true })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
// Command Code's Jev (typesafe/jev), TypeSafe's System One: a decision
|
||||
// model, which the CLI (command-code 1.88.2) asks at POST
|
||||
// /provider/v1/systemone with {model, state, questions} and its usual
|
||||
// headers, and which /provider/v1/models doesn't list (joeliu96872540 on
|
||||
// X: magpie couldn't get it). The plugin says the provider decides, lists
|
||||
// Jev marked as a decision model for every plan, and sends magpie's
|
||||
// System One questions on as the CLI sends them.
|
||||
import { afterEach, expect, test } from "bun:test"
|
||||
import { CommandCodePlugin, _internal } from "./index.mjs"
|
||||
|
||||
const real = globalThis.fetch
|
||||
let zdr
|
||||
afterEach(() => {
|
||||
globalThis.fetch = real
|
||||
_internal.subsSeen.clear()
|
||||
_internal.extraSeen.clear()
|
||||
if (zdr === undefined) delete process.env.CMD_ZDR
|
||||
else process.env.CMD_ZDR = zdr
|
||||
})
|
||||
zdr = process.env.CMD_ZDR
|
||||
|
||||
// ANSWER is System One's answer as the CLI's schema has it (wR: model,
|
||||
// answers by question, usage)
|
||||
const ANSWER = { model: "typesafe/jev", answers: { ok: { type: "noul", noul: 0.93 } }, usage: { input_tokens: 41, output_tokens: 3 } }
|
||||
const QUESTION = {
|
||||
model: "typesafe/jev",
|
||||
state: { text: "ping" },
|
||||
questions: { ok: { type: "noul", instructions: "Is this a test?" } },
|
||||
}
|
||||
|
||||
function record(reply = () => Response.json(ANSWER)) {
|
||||
const sent = []
|
||||
globalThis.fetch = async (input, init = {}) => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url
|
||||
const path = new URL(url).pathname
|
||||
const headers = new Headers(init.headers ?? (input instanceof Request ? input.headers : undefined))
|
||||
const body = init.body == null ? "" : typeof init.body === "string" ? init.body : new TextDecoder().decode(init.body)
|
||||
sent.push({ url, path, method: init.method, headers, body })
|
||||
if (path === "/provider/v1/systemone") return reply()
|
||||
if (path === "/provider/v1/models") return Response.json({ data: [{ id: "deepseek/deepseek-v4-pro", name: "DeepSeek V4 Pro" }] })
|
||||
if (path === "/alpha/billing/credits") return Response.json({ credits: {} })
|
||||
return new Response("", { status: 404 })
|
||||
}
|
||||
return sent
|
||||
}
|
||||
|
||||
async function loader(plan = "Pro", magpie, client) {
|
||||
const hooks = await CommandCodePlugin({ magpie, client })
|
||||
return hooks.auth.loader(async () => ({ type: "api", key: "user-key", metadata: { plan } }))
|
||||
}
|
||||
|
||||
// ask posts a System One question as magpie's AskSystemOne and gateway do:
|
||||
// to the loader's fetch at its base's /systemone
|
||||
const ask = (opts, q = QUESTION, headers = { "Content-Type": "application/json" }) =>
|
||||
opts.fetch("https://api.commandcode.ai/provider/v1/systemone", { method: "POST", headers, body: JSON.stringify(q) })
|
||||
|
||||
test("the provider says it decides, and its config lists Jev as a decision model", async () => {
|
||||
const hooks = await CommandCodePlugin()
|
||||
const config = {}
|
||||
await hooks.config(config)
|
||||
const p = config.provider["commandcode-plan"]
|
||||
expect(p.decide).toBe(true)
|
||||
expect(p.models["typesafe/jev"]).toMatchObject({ name: "Jev", decides: true, tool_call: false })
|
||||
// the chat models aren't marked
|
||||
expect(p.models["claude-sonnet-5"].decides).toBeUndefined()
|
||||
})
|
||||
|
||||
test("every plan's list has Jev, marked, though Command Code's list doesn't name it", async () => {
|
||||
record()
|
||||
const hooks = await CommandCodePlugin()
|
||||
const config = {}
|
||||
await hooks.config(config)
|
||||
const provider = { models: config.provider["commandcode-plan"].models }
|
||||
for (const plan of ["Pro", "GOAT", "Max", "Go"]) {
|
||||
_internal.subsSeen.clear()
|
||||
const out = await hooks.provider.models(provider, { auth: { type: "api", key: "k-" + plan, metadata: { plan } } })
|
||||
expect(out["typesafe/jev"]?.decides).toBe(true)
|
||||
expect(out["typesafe/jev"].name).toBe("Jev")
|
||||
// nothing else is marked
|
||||
expect(Object.values(out).filter((m) => m.decides).map((m) => m.id)).toEqual(["typesafe/jev"])
|
||||
}
|
||||
// the list can't be had: the default list stands in, Jev with it
|
||||
globalThis.fetch = async () => new Response("", { status: 503 })
|
||||
const out = await hooks.provider.models(provider, { auth: { type: "api", key: "k", metadata: { plan: "Pro" } } })
|
||||
expect(out["typesafe/jev"]).toBeDefined()
|
||||
})
|
||||
|
||||
test("a question goes to /provider/v1/systemone as the CLI asks it, and its answer comes back as it came", async () => {
|
||||
const sent = record()
|
||||
const opts = await loader()
|
||||
const res = await ask(opts, QUESTION, {
|
||||
"Content-Type": "application/json",
|
||||
"x-magpie-work-dir": encodeURIComponent("/Users/me/shop"),
|
||||
"x-magpie-work-git": "yes",
|
||||
})
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual(ANSWER)
|
||||
expect(sent).toHaveLength(1)
|
||||
const s = sent[0]
|
||||
expect(s.url).toBe("https://api.commandcode.ai/provider/v1/systemone")
|
||||
expect(s.method).toBe("POST")
|
||||
expect(JSON.parse(s.body)).toEqual(QUESTION)
|
||||
// the CLI's buildCommandAuthHeaders, and nothing else
|
||||
expect(Object.fromEntries(s.headers)).toEqual({
|
||||
"content-type": "application/json",
|
||||
"user-agent": "cli",
|
||||
"x-command-code-version": "1.88.2",
|
||||
"x-cli-environment": "production",
|
||||
"x-project-slug": "shop",
|
||||
"x-taste-learning": "false",
|
||||
"x-session-id": s.headers.get("x-session-id"),
|
||||
authorization: "Bearer user-key",
|
||||
})
|
||||
expect(s.headers.get("x-session-id")).toMatch(/^[0-9a-f-]{36}$/)
|
||||
expect([s.url, ...[...s.headers].flat(), s.body].join("\n")).not.toMatch(/magpie/i)
|
||||
})
|
||||
|
||||
test("Jev's other names go as the CLI names it", async () => {
|
||||
for (const name of ["jev", "jev-latest", "typesafe-ai/jev", "typesafe/jev"]) {
|
||||
const sent = record()
|
||||
await ask(await loader(), { ...QUESTION, model: name })
|
||||
expect(JSON.parse(sent[0].body).model).toBe("typesafe/jev")
|
||||
}
|
||||
})
|
||||
|
||||
test("Zero Data Retention asks System One for it too", async () => {
|
||||
const sent = record()
|
||||
const magpie = { option: (p, k) => p === "commandcode-plan" && k === "zdr" }
|
||||
await ask(await loader("Pro", magpie))
|
||||
expect(sent[0].headers.get("x-cmd-zdr")).toBe("1")
|
||||
delete process.env.CMD_ZDR
|
||||
const plain = record()
|
||||
await ask(await loader())
|
||||
expect(plain[0].headers.get("x-cmd-zdr")).toBeNull()
|
||||
})
|
||||
|
||||
test("a refusal is said as the chat's are, the account kept", async () => {
|
||||
record(() => new Response('{"error":{"message":"MODEL_NOT_IN_PLAN: Jev available in Provider and above plans"}}', { status: 400 }))
|
||||
const res = await ask(await loader())
|
||||
expect(res.status).toBe(403)
|
||||
expect(res.headers.get("X-Magpie-Sign-In")).toBe("kept")
|
||||
expect((await res.json()).error.message).toBe("Model not in plan: Jev available in Provider and above plans")
|
||||
})
|
||||
|
||||
test("a Go key refused the Provider API is kept as Go's", async () => {
|
||||
record(() => new Response('{"error":{"message":"Your Go plan doesn\'t include API access. Upgrade to Provider or higher."}}', { status: 403 }))
|
||||
const saved = []
|
||||
const res = await ask(await loader("", undefined, { auth: { set: async (x) => saved.push(x) } }))
|
||||
expect(res.status).toBe(403)
|
||||
expect(_internal.subsSeen.get("user-key")?.sub?.plan).toBe("Go")
|
||||
expect(saved[0]?.body?.metadata?.plan).toBe("Go")
|
||||
})
|
||||
|
||||
test("a question that isn't JSON is refused here, nothing sent", async () => {
|
||||
const sent = record()
|
||||
const opts = await loader()
|
||||
const res = await opts.fetch("https://api.commandcode.ai/provider/v1/systemone", { method: "POST", body: "is this a test?" })
|
||||
expect(res.status).toBe(400)
|
||||
expect(sent).toHaveLength(0)
|
||||
})
|
||||
@@ -10,6 +10,13 @@ import { readFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
import { CommandCodePlugin, _internal } from "./index.mjs"
|
||||
|
||||
// talking leaves out the decision model (Jev, jev.test.mjs), which every
|
||||
// plan's list has beside the models it talks to
|
||||
const talking = (ms) => {
|
||||
delete ms[_internal.JEV]
|
||||
return ms
|
||||
}
|
||||
|
||||
const real = globalThis.fetch
|
||||
afterEach(() => {
|
||||
globalThis.fetch = real
|
||||
@@ -34,7 +41,7 @@ async function models(reply) {
|
||||
return new Response("", { status: 404 })
|
||||
}
|
||||
const hooks = await CommandCodePlugin()
|
||||
const ms = await hooks.provider.models({ models: {} }, { auth: go })
|
||||
const ms = talking(await hooks.provider.models({ models: {} }, { auth: go }))
|
||||
return { ms, asked }
|
||||
}
|
||||
|
||||
@@ -98,7 +105,7 @@ test("a model says it takes pictures when known, and nothing when not", async ()
|
||||
return new Response("", { status: 404 })
|
||||
}
|
||||
const hooks = await CommandCodePlugin()
|
||||
const ms = await hooks.provider.models({ models: {} }, { auth: pro })
|
||||
const ms = talking(await hooks.provider.models({ models: {} }, { auth: pro }))
|
||||
expect(Object.keys(ms).length).toBe(86)
|
||||
const said = (id) => ms[id].capabilities.input.image
|
||||
// Claude, the default list's and the CLI's table's
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-commandcode-auth",
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.18",
|
||||
"description": "Command Code plans (Pro, GOAT, Max, Ultra, Go, Teams) in OpenCode and magpie",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
@@ -17,6 +17,13 @@ import { readFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
import { CommandCodePlugin, _internal } from "./index.mjs"
|
||||
|
||||
// talking leaves out the decision model (Jev, jev.test.mjs), which every
|
||||
// plan's list has beside the models it talks to
|
||||
const talking = (ms) => {
|
||||
delete ms[_internal.JEV]
|
||||
return ms
|
||||
}
|
||||
|
||||
const real = globalThis.fetch
|
||||
const saved = { ..._internal.waits }
|
||||
afterEach(() => {
|
||||
@@ -59,7 +66,7 @@ async function listed({ sub, credits = CREDITS, list = LIST, metadata } = {}) {
|
||||
const hooks = await CommandCodePlugin()
|
||||
const config = { provider: {} }
|
||||
await hooks.config(config)
|
||||
return hooks.provider.models({ models: config.provider["commandcode-plan"].models }, { auth: { type: "api", key: "k", ...(metadata ? { metadata } : {}) } })
|
||||
return talking(await hooks.provider.models({ models: config.provider["commandcode-plan"].models }, { auth: { type: "api", key: "k", ...(metadata ? { metadata } : {}) } }))
|
||||
}
|
||||
|
||||
// the CLI 1.79.2's models GOAT may use and Go may not: a Go account was
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
import { afterEach, expect, test } from "bun:test"
|
||||
import { CommandCodePlugin, _internal } from "./index.mjs"
|
||||
|
||||
// talking leaves out the decision model (Jev, jev.test.mjs), which every
|
||||
// plan's list has beside the models it talks to
|
||||
const talking = (ms) => {
|
||||
delete ms[_internal.JEV]
|
||||
return ms
|
||||
}
|
||||
|
||||
const real = globalThis.fetch
|
||||
afterEach(() => {
|
||||
globalThis.fetch = real
|
||||
@@ -183,7 +190,7 @@ test("a model served on Responses and not chat completions is asked on Responses
|
||||
}
|
||||
const a = { ...api, metadata: { plan: "Max" } }
|
||||
const hooks = await CommandCodePlugin()
|
||||
const ms = await hooks.provider.models({ models: {} }, { auth: a })
|
||||
const ms = talking(await hooks.provider.models({ models: {} }, { auth: a }))
|
||||
expect(Object.fromEntries(Object.entries(ms).map(([k, m]) => [k, m.api.npm]))).toEqual({
|
||||
"gpt-6-sol": "@ai-sdk/openai",
|
||||
"moonshotai/Kimi-K3": "@ai-sdk/openai-compatible",
|
||||
|
||||
Reference in New Issue
Block a user