diff --git a/packages/workbuddy/README.md b/packages/workbuddy/README.md index 81b0522..51a189c 100644 --- a/packages/workbuddy/README.md +++ b/packages/workbuddy/README.md @@ -304,6 +304,12 @@ on it, so 0.2.8 lifted the cap (#561). A prompt WorkBuddy does find too long ("prompt is too long: … > … maximum") is answered with its own 400, passed on as it came, which magpie takes as the context overflowing. +A model's reply limit is the config's `maxOutputTokens`. The list used +before the config is read gives it too since 0.2.26, for the models a +config read from each site named (Deepseek-V4.1-Flash: 128000 on both). +Before, that list gave none, and magpie filled in models.dev's: 384000 +for Deepseek-V4.1-Flash. A model it gives none for still gets models.dev's. + A chat goes gzipped (`Content-Encoding: gzip`), as WorkBuddy's own client sends its model requests (`RequestBodyGzip` in both builds' product.json). Claude's Messages route goes as it came, and so does anything that isn't a diff --git a/packages/workbuddy/deepseek-flash.test.mjs b/packages/workbuddy/deepseek-flash.test.mjs index db559e9..f2dc7c7 100644 --- a/packages/workbuddy/deepseek-flash.test.mjs +++ b/packages/workbuddy/deepseek-flash.test.mjs @@ -104,3 +104,27 @@ test("glm-5.3-flash, which can't turn thinking off, still lists no none", async expect(ai["glm-5.3-flash"].efforts).toEqual(["low", "high", "max"]) expect(cn["deepseek-v4-pro"].efforts).toEqual(["none", "high", "xhigh"]) }) + +// sayagoodbyeplz on Discord: WorkBuddy's deepseek-v4.1-flash read as a +// 384000-token reply. That is models.dev's, which magpie fills in for a +// model its list gives no output for: the list declared before an +// account's own is read (a key, a config that can't be read) said 0. It +// says the config's maxOutputTokens now, for every model the configs read +// give one. +test("the declared list's reply limits are the configs' maxOutputTokens", async () => { + const efforts = JSON.parse(readFileSync(new URL("./testdata/config-efforts.json", import.meta.url), "utf8")) + const said = { workbuddy: [configs.workbuddy], "workbuddy-ai": [configs["workbuddy-ai"], efforts] } + let checked = 0 + for (const [site, cfgs] of Object.entries(said)) { + const declared = _internal.configModels(_internal.SITES[site]) + for (const cfg of cfgs) { + for (const d of cfg.data.models) { + if (!declared[d.id]) continue + expect([site, d.id, declared[d.id].limit.output]).toEqual([site, d.id, d.maxOutputTokens]) + checked++ + } + } + } + expect(_internal.configModels(_internal.SITES.workbuddy)["deepseek-v4.1-flash"].limit.output).toBe(128000) + expect(checked).toBeGreaterThan(5) +}) diff --git a/packages/workbuddy/index.mjs b/packages/workbuddy/index.mjs index f1d7197..926c438 100644 --- a/packages/workbuddy/index.mjs +++ b/packages/workbuddy/index.mjs @@ -21,15 +21,21 @@ const EARLY_MS = 60 * 1000 // a token this close to its end is refreshed before const LEAD_MS = 5 * 60 * 1000 // and this close, magpie renews it ahead of time (auth.refresh) const KEEP_RENEWED_MS = 60 * 1000 // how long a refresh's result answers for the old refresh token -// [id, name, context, efforts] +// [id, name, context, efforts, output] +// +// output is the config's maxOutputTokens, where a config read from the site +// gave it (testdata/config-561.json, config-efforts.json); without it magpie +// fills in models.dev's, which for deepseek-v4.1-flash is 384000 where +// WorkBuddy's own config says 128000 (sayagoodbyeplz on Discord). A model +// with none here is left to models.dev, as before. const CN_MODELS = [ ["auto", "Auto", 168000], ["hy4-preview-f", "Hy4 preview", 1000000, ["high"]], ["hy3", "Hy3", 192000, ["low", "high"]], ["hy3-x", "Hy3-X", 192000, ["low", "high"]], - ["deepseek-v4.1-flash", "Deepseek-V4.1-Flash", 1000000, ["none", "low", "high", "max"]], + ["deepseek-v4.1-flash", "Deepseek-V4.1-Flash", 1000000, ["none", "low", "high", "max"], 128000], ["glm-5.3", "GLM-5.3", 1000000, ["low", "high", "max"]], - ["glm-5.3-flash", "GLM-5.3-Flash", 1000000, ["low", "high", "max"]], + ["glm-5.3-flash", "GLM-5.3-Flash", 1000000, ["low", "high", "max"], 131072], ["glm-5.2", "GLM-5.2", 1000000, ["high", "xhigh"]], ["glm-5.1", "GLM-5.1", 200000], ["glm-5v-turbo", "GLM-5v-Turbo", 200000], @@ -37,24 +43,24 @@ const CN_MODELS = [ ["kimi-k3-1", "Kimi-K3", 1000000, ["low", "high", "xhigh"]], ["kimi-k2.7", "Kimi-K2.7-Code", 256000], ["kimi-k2.6", "Kimi-K2.6", 256000], - ["deepseek-v4-pro", "Deepseek-V4-Pro", 1000000, ["none", "high", "xhigh"]], + ["deepseek-v4-pro", "Deepseek-V4-Pro", 1000000, ["none", "high", "xhigh"], 128000], ] const AI_MODELS = [ - ["default-model", "Default", 176000], - ["fast-model", "Fast", 200000], + ["default-model", "Default", 176000, undefined, 24000], + ["fast-model", "Fast", 200000, undefined, 32000], ["balanced-model", "Balanced", 256000], - ["primary-model", "Primary", 272000], + ["primary-model", "Primary", 272000, undefined, 72000], ["deep-model", "Deep", 176000], ["gpt-5.5", "GPT-5.5", 1000000], ["gpt-5.4", "GPT-5.4", 272000], ["gpt-5.3-codex", "GPT-5.3-Codex", 272000], ["gemini-3.1-pro", "Gemini-3.1-Pro", 400000], - ["gemini-3.5-flash", "Gemini-3.5-Flash", 1000000], + ["gemini-3.5-flash", "Gemini-3.5-Flash", 1000000, undefined, 65536], ["glm-5.3", "GLM-5.3", 1000000, ["low", "high", "max"]], - ["glm-5.2", "GLM-5.2", 1000000, ["high", "xhigh"]], - ["hy3", "Hy3", 192000, ["low", "high"]], - ["kimi-k3", "Kimi-K3", 1000000], + ["glm-5.2", "GLM-5.2", 1000000, ["high", "xhigh"], 48000], + ["hy3", "Hy3", 192000, ["low", "high"], 64000], + ["kimi-k3", "Kimi-K3", 1000000, undefined, 32000], ["kimi-k2.6", "Kimi-K2.6", 256000], ["minimax-m3", "MiniMax-M3", 512000], ] @@ -3204,9 +3210,9 @@ function variants(efforts) { // kimi-k3 with a two-colour PNG named both colours (plugins#572). Declared // text-only, as before, every model read as one that can't see. function configModels(site) { - return Object.fromEntries(site.models.map(([id, name, context, efforts]) => [id, { + return Object.fromEntries(site.models.map(([id, name, context, efforts, output]) => [id, { name, - limit: { context, output: 0 }, + limit: { context, output: output ?? 0 }, tool_call: true, attachment: !textOnly(site, id), modalities: { input: textOnly(site, id) ? ["text"] : ["text", "image"], output: ["text"] }, diff --git a/packages/workbuddy/package.json b/packages/workbuddy/package.json index da2e423..0a11161 100644 --- a/packages/workbuddy/package.json +++ b/packages/workbuddy/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-workbuddy-auth", - "version": "0.2.25", + "version": "0.2.26", "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)", "type": "module", "main": "./opencode.mjs",