@magpie-community/opencode-workbuddy-auth 0.2.14 → 0.2.15

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 +5 -1
  2. package/index.mjs +18 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -286,7 +286,11 @@ that names no level goes at the model's own default from the config
286
286
  (`reasoning.defaultEffort`, "high" for DeepSeek-V4.1-Flash), as WorkBuddy's
287
287
  client sends it: WorkBuddy doesn't think when a chat names none, so
288
288
  OpenCode's default variant got answers without thinking. An effort the
289
- client names, `none` too, goes as it came.
289
+ client names, `none` too, goes as it came. A chat whose `max_tokens` is
290
+ 1024 or less gets no default (since 0.2.15, #643): a title or a
291
+ classification asked at 64 tokens spent all 64 on reasoning and answered
292
+ nothing. Anthropic's API takes no thinking under a 1024-token budget, so
293
+ no client means to think in one that small.
290
294
 
291
295
  One value differs from the config, measured with real requests:
292
296
  DeepSeek-V4.1-Flash (and its paid `-sg` id) lists `none`, though the
package/index.mjs CHANGED
@@ -3259,11 +3259,27 @@ function defaultEffortOf(d, efforts) {
3259
3259
  return typeof own === "string" && efforts.includes(own) ? own : undefined
3260
3260
  }
3261
3261
 
3262
+ // SMALL_BUDGET is the largest output budget a chat can name and still be
3263
+ // one no client meant to think in: Anthropic's API takes thinking only with
3264
+ // a budget of at least 1024 tokens and a max_tokens above it, so a request
3265
+ // of 1024 or less can't have asked for thinking there, and a client's own
3266
+ // short asks (a session title, a classification) name such budgets. A
3267
+ // default effort spends them on reasoning: itspig (#643) saw 230+ title
3268
+ // requests at max_tokens 64 on deepseek-v4-pro end out=64, reasoning=64,
3269
+ // no text. Measured 2026-11-03 on www.workbuddy.ai, deepseek-v4.1-flash-sg
3270
+ // at its default high: max_tokens 64 ended "length" with 64 reasoning
3271
+ // tokens and no text; without an effort it answered the title.
3272
+ const SMALL_BUDGET = 1024
3273
+
3262
3274
  // withDefaultEffort gives a chat that names no effort the model's default
3263
3275
  // (defaultEffortOf), as WorkBuddy's client sends it; true when it did. An
3264
- // effort the client named, "none" too, goes as it came.
3276
+ // effort the client named, "none" too, goes as it came. A chat whose
3277
+ // max_tokens is SMALL_BUDGET or less is given none: WorkBuddy doesn't
3278
+ // think without one, so its budget goes to the answer.
3265
3279
  function withDefaultEffort(chat, list) {
3266
3280
  if (!chat || typeof chat !== "object" || namesEffort(chat)) return false
3281
+ const limit = chat.max_tokens ?? chat.max_completion_tokens
3282
+ if (typeof limit === "number" && limit > 0 && limit <= SMALL_BUDGET) return false
3267
3283
  const m = list?.find((x) => x.id === chat.model)
3268
3284
  if (!m?.effort) return false
3269
3285
  chat.reasoning_effort = m.effort
@@ -3952,4 +3968,4 @@ export const WorkBuddyAuthPlugin = makePlugin(SITES.workbuddy)
3952
3968
  export const WorkBuddyAIAuthPlugin = makePlugin(SITES["workbuddy-ai"])
3953
3969
 
3954
3970
  // for tests
3955
- export const _internal = { planCodes, idFor, 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, pinning, rowTime, rowAccount, ofAccount, windowOffset, windowReset, FREE_WINDOW_MODELS, FREE_WINDOW_CN, FREE_WINDOW_AI, FREE_WINDOW_SPAN, FREE_WINDOW_GAP, FREE_WINDOW_LEAD, checkinOf, API_MESSAGES: NPM_MESSAGES, API_CHAT: NPM }
3971
+ export const _internal = { planCodes, idFor, OFF_TAKEN, replyAfterToolsOn, withDefaultEffort, SMALL_BUDGET, 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, pinning, rowTime, rowAccount, ofAccount, windowOffset, windowReset, FREE_WINDOW_MODELS, FREE_WINDOW_CN, FREE_WINDOW_AI, 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.14",
3
+ "version": "0.2.15",
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",