opencode-anthropic-multi-account 0.2.40 → 0.2.41

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.
package/README.md CHANGED
@@ -51,7 +51,9 @@ This is an internal compatibility policy, not a third user-facing mode.
51
51
 
52
52
  For non-Haiku Claude Code requests, the plugin forwards a client-provided effort
53
53
  from `output_config.effort`, `reasoning.effort`, `reasoning_effort`, or
54
- `reasoningEffort`. If the client does not provide one, it falls back to `high`.
54
+ `reasoningEffort`. It also maps OpenCode/Anthropic `thinking.budgetTokens`
55
+ or Anthropic wire `thinking.budget_tokens` into an output effort. If the client
56
+ does not provide one, it falls back to `high`.
55
57
 
56
58
  Operators can pin the outbound effort with `CLAUDE_MULTI_ACCOUNT_EFFORT` or
57
59
  `ANTHROPIC_MULTI_ACCOUNT_EFFORT`. Supported values are `low`, `medium`, `high`,
package/dist/index.js CHANGED
@@ -3442,6 +3442,17 @@ function readOutputEffortValue(value) {
3442
3442
  function normalizeEffortForWire(effort) {
3443
3443
  return effort === "ultracode" ? "xhigh" : effort;
3444
3444
  }
3445
+ function readPositiveNumber(value) {
3446
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
3447
+ }
3448
+ function effortFromThinkingBudget(thinking) {
3449
+ const budgetTokens = readPositiveNumber(thinking?.budget_tokens) ?? readPositiveNumber(thinking?.budgetTokens);
3450
+ if (budgetTokens === void 0) return void 0;
3451
+ if (budgetTokens >= 32e3) return "max";
3452
+ if (budgetTokens >= 16e3) return "high";
3453
+ if (budgetTokens >= 8e3) return "medium";
3454
+ return "low";
3455
+ }
3445
3456
  function getConfiguredOutputEffort() {
3446
3457
  return upstreamRequestTestOverrides.outputEffort ?? readOutputEffortValue(process.env.CLAUDE_MULTI_ACCOUNT_EFFORT) ?? readOutputEffortValue(process.env.ANTHROPIC_MULTI_ACCOUNT_EFFORT);
3447
3458
  }
@@ -3449,7 +3460,7 @@ function getClientOutputEffort(inputBody) {
3449
3460
  const outputConfig = isRecord3(inputBody.output_config) ? inputBody.output_config : void 0;
3450
3461
  const reasoning = isRecord3(inputBody.reasoning) ? inputBody.reasoning : void 0;
3451
3462
  const thinking = isRecord3(inputBody.thinking) ? inputBody.thinking : void 0;
3452
- return readOutputEffortValue(outputConfig?.effort) ?? readOutputEffortValue(reasoning?.effort) ?? readOutputEffortValue(inputBody.reasoning_effort) ?? readOutputEffortValue(inputBody.reasoningEffort) ?? readOutputEffortValue(thinking?.effort);
3463
+ return readOutputEffortValue(outputConfig?.effort) ?? readOutputEffortValue(reasoning?.effort) ?? readOutputEffortValue(inputBody.reasoning_effort) ?? readOutputEffortValue(inputBody.reasoningEffort) ?? readOutputEffortValue(thinking?.effort) ?? effortFromThinkingBudget(thinking);
3453
3464
  }
3454
3465
  function resolveOutputEffort(inputBody, configuredEffort = getConfiguredOutputEffort()) {
3455
3466
  if (configuredEffort && configuredEffort !== "client") {