@magpie-community/opencode-workbuddy-auth 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +11 -0
  2. package/index.mjs +36 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -286,6 +286,17 @@ client sends it: WorkBuddy doesn't think when a chat names none, so
286
286
  OpenCode's default variant got answers without thinking. An effort the
287
287
  client names, `none` too, goes as it came.
288
288
 
289
+ Two values differ from the config, each measured with real requests:
290
+
291
+ - DeepSeek-V4.1-Flash (and its paid `-sg` id) lists `none`, though the
292
+ config says it only reasons: WorkBuddy answers `reasoning_effort: "none"`
293
+ on it with no thinking at all (since 0.2.7, #563).
294
+ - On `workbuddy` (copilot.tencent.com), DeepSeek-V4.1-Flash's context is
295
+ 100000, not the config's 1000000: a longer prompt is refused with
296
+ "prompt is too long: … > 100000 maximum", while GLM-5.3-Flash on the same
297
+ endpoint takes the million. `workbuddy-ai` takes the million on it
298
+ (since 0.2.7, #561).
299
+
289
300
  A chat goes gzipped (`Content-Encoding: gzip`), as WorkBuddy's own client
290
301
  sends its model requests (`RequestBodyGzip` in both builds' product.json).
291
302
  Claude's Messages route goes as it came, and so does anything that isn't a
package/index.mjs CHANGED
@@ -28,7 +28,7 @@ const CN_MODELS = [
28
28
  ["hy4-preview-f", "Hy4 preview", 1000000, ["high"]],
29
29
  ["hy3", "Hy3", 192000, ["low", "high"]],
30
30
  ["hy3-x", "Hy3-X", 192000, ["low", "high"]],
31
- ["deepseek-v4.1-flash", "Deepseek-V4.1-Flash", 1000000],
31
+ ["deepseek-v4.1-flash", "Deepseek-V4.1-Flash", 1000000, ["none", "low", "high", "max"]],
32
32
  ["glm-5.3", "GLM-5.3", 1000000, ["low", "high", "max"]],
33
33
  ["glm-5.3-flash", "GLM-5.3-Flash", 1000000, ["low", "high", "max"]],
34
34
  ["glm-5.2", "GLM-5.2", 1000000, ["high", "xhigh"]],
@@ -81,6 +81,9 @@ const SITES = {
81
81
  // where this build's API keys are made (see keyAccount)
82
82
  keys: "https://www.workbuddy.cn/profile/keys",
83
83
  models: CN_MODELS,
84
+ // the prompt a model takes here, where it is less than the config's
85
+ // maxInputTokens (see contextOf)
86
+ contextCap: { "deepseek-v4.1-flash": 100000 },
84
87
  // it serves the Claude models on Anthropic's Messages API too (see
85
88
  // nativeOf)
86
89
  messages: true,
@@ -109,6 +112,33 @@ const SITES = {
109
112
  },
110
113
  }
111
114
 
115
+ // contextOf is the prompt site takes for model: the config's
116
+ // maxInputTokens, or less where the site turns a longer prompt away.
117
+ // copilot.tencent.com's /v3/config gives deepseek-v4.1-flash 1000000, but
118
+ // its chat answers a prompt over 100000 tokens with 400 "prompt is too long:
119
+ // 100001 tokens > 100000 maximum" (plugins#561: 11 times on two accounts;
120
+ // the largest prompt it took was 76,065), while glm-5.3-flash on the same
121
+ // endpoint took 954,019. A client planning against 1M grows its thread
122
+ // past 100k and then can't compact it either, as the compaction resends it
123
+ // whole. WorkBuddy AI is not capped so: www.workbuddy.ai's
124
+ // deepseek-v4.1-flash took a 181,887-token prompt (measured 2026-10-31),
125
+ // so only the China build has the cap.
126
+ function contextOf(site, model, said) {
127
+ const cap = site.contextCap?.[model]
128
+ if (!cap) return said
129
+ return typeof said === "number" && said > 0 ? Math.min(said, cap) : cap
130
+ }
131
+
132
+ // OFF_TAKEN are models that turn thinking off for reasoning_effort "none"
133
+ // though the config says onlyReasoning (so WorkBuddy's own client offers no
134
+ // off switch): deepseek-v4.1-flash, and the same model under its paid id.
135
+ // Measured 2026-10-31 on www.workbuddy.ai: "none" answered 200 with 0
136
+ // reasoning tokens on both, where "low" thought 1221 and 1127; and on the
137
+ // China build by the reporter of plugins#563 (0 reasoning tokens, a 30-item
138
+ // prompt in 14s instead of 50s). Without the level magpie sends "low" for
139
+ // a client's "none".
140
+ const OFF_TAKEN = new Set(["deepseek-v4.1-flash", "deepseek-v4.1-flash-sg"])
141
+
112
142
  // textOnly says whether site drops the images sent to model, whatever its
113
143
  // config says. On 2026-10-13, with a real WorkBuddy AI account (Yirasumi on
114
144
  // Discord), www.workbuddy.ai's /v3/config marked every model
@@ -2930,7 +2960,7 @@ function variants(efforts) {
2930
2960
  function configModels(site) {
2931
2961
  return Object.fromEntries(site.models.map(([id, name, context, efforts]) => [id, {
2932
2962
  name,
2933
- limit: { context, output: 0 },
2963
+ limit: { context: contextOf(site, id, context), output: 0 },
2934
2964
  tool_call: true,
2935
2965
  // OpenCode (and magpie's host) read a config model's package and URL
2936
2966
  // from provider: { npm, api }, not api
@@ -3125,14 +3155,15 @@ async function liveModels(site, a) {
3125
3155
  const d = (cfg.models ?? []).find((x) => x.id === id)
3126
3156
  const m = { id, name: d?.name || id }
3127
3157
  if (d) {
3128
- m.context = d.maxInputTokens
3158
+ m.context = contextOf(site, id, d.maxInputTokens)
3129
3159
  m.output = d.maxOutputTokens
3130
3160
  m.images = d.supportsImages === true && !textOnly(site, id)
3131
3161
  Object.assign(m, priceOf(d, cfg.modelPromotions))
3132
3162
  const es = effortsOf(d, site, id)
3133
3163
  if (es.length) {
3134
3164
  const canOff = d.reasoning?.canDisableThinking
3135
- m.efforts = [...(!d.onlyReasoning && (canOff == null || canOff) ? ["none"] : []), ...es]
3165
+ const off = (!d.onlyReasoning && (canOff == null || canOff)) || OFF_TAKEN.has(id)
3166
+ m.efforts = [...(off ? ["none"] : []), ...es]
3136
3167
  const def = defaultEffortOf(d, es)
3137
3168
  if (def) m.effort = def
3138
3169
  }
@@ -3759,4 +3790,4 @@ export const WorkBuddyAuthPlugin = makePlugin(SITES.workbuddy)
3759
3790
  export const WorkBuddyAIAuthPlugin = makePlugin(SITES["workbuddy-ai"])
3760
3791
 
3761
3792
  // for tests
3762
- export const _internal = { idFor, replyAfterToolsOn, withDefaultEffort, defaultEffortOf, gzipped, FREE_ONLY, PRICE_TTL, keyAccount, remoteConfig, cycleOf, typeUnions, systemAsUser, systemKey, DEFAULT_SYSTEM, EDGE_READS, fitShape, replyAfterTools, AFTER_TOOLS_REFUSED, enterpriseUsageOf, accountName, notDesktop, textOnly, runsOutOf, packagesOf, endOf, enterpriseHeaders, enterpriseOf, liveModels, browserSignIn, withSystem, asReasoning, normalizeToolChoice, fitTools, fitted, renamed, unsaid, FILTER_SAYS, unflagged, usageOf, desktopHeld, explained, REFUSED_HINT, RESTRICTED_HINT, EXHAUSTED_HINT, REFUSED_DOC, commaPaused, commaPausedOn, opened, freeCredits, creditsOf, priceOf, fresh, SITES, renewing, renewed, SESSION, attend, scopeOf, turnKey, conversationKey, signatureOf, isMessages, withoutUnsigned, withoutSignedThinking, prepared, answeredBefore, nativeOf, modelOf, configModels, freeWindowOf, tokensShort, freeWindowRows, freeWindowLedger, readLedgerTail, pinned, rowTime, rowAccount, ofAccount, windowOffset, windowReset, FREE_WINDOW_MODELS, FREE_WINDOW_SPAN, FREE_WINDOW_GAP, FREE_WINDOW_LEAD, checkinOf, API_MESSAGES: NPM_MESSAGES, API_CHAT: NPM }
3793
+ export const _internal = { idFor, contextOf, OFF_TAKEN, replyAfterToolsOn, withDefaultEffort, defaultEffortOf, gzipped, FREE_ONLY, PRICE_TTL, keyAccount, remoteConfig, cycleOf, typeUnions, systemAsUser, systemKey, DEFAULT_SYSTEM, EDGE_READS, fitShape, replyAfterTools, AFTER_TOOLS_REFUSED, enterpriseUsageOf, accountName, notDesktop, textOnly, runsOutOf, packagesOf, endOf, enterpriseHeaders, enterpriseOf, liveModels, browserSignIn, withSystem, asReasoning, normalizeToolChoice, fitTools, fitted, renamed, unsaid, FILTER_SAYS, unflagged, usageOf, desktopHeld, explained, REFUSED_HINT, RESTRICTED_HINT, EXHAUSTED_HINT, REFUSED_DOC, commaPaused, commaPausedOn, opened, freeCredits, creditsOf, priceOf, fresh, SITES, renewing, renewed, SESSION, attend, scopeOf, turnKey, conversationKey, signatureOf, isMessages, withoutUnsigned, withoutSignedThinking, prepared, answeredBefore, nativeOf, modelOf, configModels, freeWindowOf, tokensShort, freeWindowRows, freeWindowLedger, readLedgerTail, pinned, rowTime, rowAccount, ofAccount, windowOffset, windowReset, FREE_WINDOW_MODELS, FREE_WINDOW_SPAN, FREE_WINDOW_GAP, FREE_WINDOW_LEAD, checkinOf, API_MESSAGES: NPM_MESSAGES, API_CHAT: NPM }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-workbuddy-auth",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",