From 68170b3ebe747127c96f03339fb55ebf6a15d151 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 20 Oct 2026 18:15:22 +0800 Subject: [PATCH] workbuddy 0.1.26: a model that says only supportsReasoning and a default effort lists low, high, max and that default (#255) kylesean (#255): fast-model, balanced-model, primary-model, deepseek-v4.1-flash(-sg), gemini-3.5-flash, kimi-k3 and kimi-k2.6 carry supportsReasoning: true and reasoning.effort in /v3/config, but no reasoning.supportedEfforts, so they were listed with no levels and as not reasoning. effortsOf gives such a model low, high and max plus its own default, in order. All eight are onlyReasoning, so none gets "none". Models that list their efforts are unchanged. The fixture is WorkBuddy AI's own /v3/config read today (descriptions left out). Under a real WorkBuddy AI account, low, high and max were answered 200 with reasoning on fast-model, deepseek-v4.1-flash-sg, kimi-k3 and gemini-3.5-flash; the other four weren't tried. Run (sandbox HOME): - HOME=$(mktemp -d) bun test packages/workbuddy: 101 pass, 0 fail - bun scripts/check.mjs workbuddy: ok; git diff --check clean - Broken by hand (effortsOf back to supportedEfforts only): efforts.test goes red. --- packages/workbuddy/efforts.test.mjs | 36 +++ packages/workbuddy/index.mjs | 17 +- packages/workbuddy/package.json | 2 +- .../workbuddy/testdata/config-efforts.json | 233 ++++++++++++++++++ 4 files changed, 286 insertions(+), 2 deletions(-) create mode 100644 packages/workbuddy/efforts.test.mjs create mode 100644 packages/workbuddy/testdata/config-efforts.json diff --git a/packages/workbuddy/efforts.test.mjs b/packages/workbuddy/efforts.test.mjs new file mode 100644 index 0000000..c8d1723 --- /dev/null +++ b/packages/workbuddy/efforts.test.mjs @@ -0,0 +1,36 @@ +// plugins#255 (kylesean): eight models in WorkBuddy's /v3/config say +// supportsReasoning and a default reasoning.effort but no +// reasoning.supportedEfforts, so the plugin listed them as not reasoning. +// testdata/config-efforts.json is WorkBuddy AI's own config (2026-10-20, +// descriptions left out), cut to those models and a few beside them. +import { afterEach, expect, test } from "bun:test" +import { readFileSync } from "node:fs" +import { _internal } from "./index.mjs" + +const real = globalThis.fetch +afterEach(() => (globalThis.fetch = real)) + +const config = readFileSync(new URL("./testdata/config-efforts.json", import.meta.url), "utf8") + +async function listed() { + globalThis.fetch = async () => new Response(config) + const out = await _internal.liveModels(_internal.SITES["workbuddy-ai"], { access: "a", uid: "u" }) + return Object.fromEntries(out.map((m) => [m.id, m.efforts])) +} + +test("a model that says only supportsReasoning and a default takes low, high, max and its default", async () => { + const e = await listed() + expect(e["fast-model"]).toEqual(["low", "medium", "high", "max"]) + expect(e["kimi-k3"]).toEqual(["low", "medium", "high", "max"]) + expect(e["gemini-3.5-flash"]).toEqual(["low", "medium", "high", "max"]) + expect(e["primary-model"]).toEqual(["low", "high", "max"]) + expect(e["deepseek-v4.1-flash-sg"]).toEqual(["low", "high", "max"]) +}) + +test("listed efforts are kept as they are, and a model that doesn't reason gets none", async () => { + const e = await listed() + expect(e["hy3"]).toEqual(["low", "high"]) + expect(e["gpt-5.6-sol"]).toEqual(["none", "low", "medium", "high", "xhigh", "max"]) + expect(e["glm-5.2"]).toEqual(["none", "high", "xhigh"]) + expect(e["default-model"]).toBeUndefined() +}) diff --git a/packages/workbuddy/index.mjs b/packages/workbuddy/index.mjs index 58700c3..2e0f48c 100644 --- a/packages/workbuddy/index.mjs +++ b/packages/workbuddy/index.mjs @@ -1461,6 +1461,21 @@ function priceOf(d, promotions, now = Date.now()) { return { free: base === 0, rate: base } } +// effortsOf are the levels a config model takes. Most list them in +// reasoning.supportedEfforts; some (fast-model, deepseek-v4.1-flash, kimi-k3, +// gemini-3.5-flash … on both sites, plugins#255) say only supportsReasoning +// and a default reasoning.effort. Those take low, high and max (each +// reasoned under a real account, on four of them) and their own default. +const EFFORT_ORDER = ["low", "medium", "high", "xhigh", "max"] +function effortsOf(d) { + const said = d.reasoning?.supportedEfforts + if (Array.isArray(said) && said.length) return said + if (d.supportsReasoning !== true) return [] + const own = d.reasoning?.effort + const set = new Set(["low", "high", "max", ...(typeof own === "string" && EFFORT_ORDER.includes(own) ? [own] : [])]) + return EFFORT_ORDER.filter((e) => set.has(e)) +} + async function liveModels(site, a) { const headers = new Headers() sign(site, a, headers) @@ -1483,7 +1498,7 @@ async function liveModels(site, a) { m.output = d.maxOutputTokens m.images = d.supportsImages === true && !textOnly(site, id) Object.assign(m, priceOf(d, cfg.modelPromotions)) - const es = d.reasoning?.supportedEfforts ?? [] + const es = effortsOf(d) if (es.length) { const canOff = d.reasoning?.canDisableThinking m.efforts = [...(!d.onlyReasoning && (canOff == null || canOff) ? ["none"] : []), ...es] diff --git a/packages/workbuddy/package.json b/packages/workbuddy/package.json index f090a93..5b3698c 100644 --- a/packages/workbuddy/package.json +++ b/packages/workbuddy/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-workbuddy-auth", - "version": "0.1.25", + "version": "0.1.26", "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)", "type": "module", "main": "./index.mjs", diff --git a/packages/workbuddy/testdata/config-efforts.json b/packages/workbuddy/testdata/config-efforts.json new file mode 100644 index 0000000..c849a64 --- /dev/null +++ b/packages/workbuddy/testdata/config-efforts.json @@ -0,0 +1,233 @@ +{ + "code": 0, + "data": { + "models": [ + { + "credits": "", + "id": "default-model", + "isDefault": true, + "maxAllowedSize": 200000, + "maxInputTokens": 176000, + "maxOutputTokens": 24000, + "name": "Auto", + "supportsImages": true, + "supportsToolCall": true, + "temperature": 1, + "vendor": "e" + }, + { + "credits": "x0.34 credits", + "id": "fast-model", + "maxAllowedSize": 200000, + "maxInputTokens": 200000, + "maxOutputTokens": 32000, + "name": "Fast", + "onlyReasoning": true, + "reasoning": { + "effort": "medium", + "summary": "auto" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "temperature": 1, + "vendor": "i" + }, + { + "credits": "x3.31 credits", + "id": "primary-model", + "maxAllowedSize": 272000, + "maxInputTokens": 272000, + "maxOutputTokens": 72000, + "name": "Primary", + "onlyReasoning": true, + "reasoning": { + "effort": "high", + "summary": "auto" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "vendor": "e" + }, + { + "contextWindow": { + "defaultLength": 300000, + "supportedLengths": [ + 300000, + 1000000 + ] + }, + "credits": "x0.03", + "id": "deepseek-v4.1-flash-sg", + "maxAllowedSize": 1000000, + "maxInputTokens": 1000000, + "maxOutputTokens": 128000, + "name": "Deepseek-V4.1-Flash", + "onlyReasoning": true, + "reasoning": { + "effort": "high", + "summary": "auto" + }, + "relatedModels": { + "lite": "deepseek-v4.1-flash-sg", + "reasoning": "deepseek-v4.1-flash-sg" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "temperature": 1, + "vendor": "f" + }, + { + "credits": "x0.00", + "disabledMultimodal": false, + "id": "hy3", + "maxAllowedSize": 192000, + "maxInputTokens": 192000, + "maxOutputTokens": 64000, + "name": "Hy3", + "onlyReasoning": true, + "reasoning": { + "canDisableThinking": false, + "defaultEffort": "high", + "summary": "auto", + "supportedEfforts": [ + "low", + "high" + ] + }, + "relatedModels": { + "lite": "hy3", + "reasoning": "hy3" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "tags": [ + "craft" + ], + "temperature": 0.9, + "top_p": 1, + "vendor": "j" + }, + { + "credits": "x3.47", + "id": "gpt-5.6-sol", + "maxAllowedSize": 1000000, + "maxInputTokens": 1000000, + "maxOutputTokens": 128000, + "name": "GPT-5.6-Sol", + "onlyReasoning": false, + "reasoning": { + "canDisableThinking": true, + "defaultEffort": "high", + "summary": "auto", + "supportedEfforts": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + }, + "relatedModels": { + "lite": "gpt-5.6-sol", + "reasoning": "gpt-5.6-sol" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "tags": [], + "vendor": "e" + }, + { + "credits": "x0.99", + "id": "gemini-3.5-flash", + "maxAllowedSize": 1000000, + "maxInputTokens": 1000000, + "maxOutputTokens": 65536, + "name": "Gemini-3.5-Flash", + "onlyReasoning": true, + "reasoning": { + "effort": "medium", + "summary": "auto" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "tags": [], + "temperature": 1, + "vendor": "e" + }, + { + "credits": "x0.79", + "id": "glm-5.2", + "maxAllowedSize": 1000000, + "maxInputTokens": 1000000, + "maxOutputTokens": 48000, + "name": "GLM-5.2", + "onlyReasoning": false, + "reasoning": { + "canDisableThinking": true, + "defaultEffort": "high", + "summary": "auto", + "supportedEfforts": [ + "high", + "xhigh" + ] + }, + "relatedModels": { + "lite": "glm-5.2", + "reasoning": "glm-5.2" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "tags": [ + "craft" + ], + "temperature": 1, + "vendor": "e" + }, + { + "credits": "x1.62", + "id": "kimi-k3", + "maxAllowedSize": 1000000, + "maxInputTokens": 1000000, + "maxOutputTokens": 32000, + "name": "Kimi-K3", + "onlyReasoning": true, + "reasoning": { + "effort": "medium", + "summary": "auto" + }, + "relatedModels": { + "lite": "kimi-k3-1", + "reasoning": "kimi-k3-1" + }, + "supportsImages": true, + "supportsReasoning": true, + "supportsToolCall": true, + "temperature": 1, + "vendor": "f" + } + ], + "agents": [ + { + "name": "cli", + "models": [ + "default-model", + "fast-model", + "primary-model", + "hy3", + "deepseek-v4.1-flash-sg", + "gpt-5.6-sol", + "gemini-3.5-flash", + "glm-5.2", + "kimi-k3" + ] + } + ] + } +}