mohdel 0.105.0 → 0.105.2

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.
@@ -216,13 +216,27 @@ export async function * anthropic (envelope, deps = {}) {
216
216
  // output_tokens and what actually streamed as visible output (text +
217
217
  // tool input JSON) — catches redacted_thinking blocks (opus 4.7 default)
218
218
  // that consume output tokens but emit no streaming deltas.
219
+ //
220
+ // When the caller explicitly disabled thinking via `outputEffort: 'none'`,
221
+ // we did NOT send `request.thinking` (see buildRequest) — Anthropic
222
+ // won't emit thinking content, redacted or otherwise — so the fallback
223
+ // heuristic would only attribute the natural chars/4 estimation gap
224
+ // (Anthropic packs denser than 4 chars/token on most content) to a
225
+ // non-existent thinking budget. Trust the explicit opt-out and report
226
+ // zero.
219
227
  const streamedOutput = currentOutput()
220
228
  const streamedOutputChars = streamedOutput.length +
221
229
  [...toolBlocks.values()].reduce((s, b) => s + b.inputJson.length, 0)
222
230
  const streamedOutputTokens = Math.ceil(streamedOutputChars / ANTHROPIC_THINKING_CHARS_PER_TOKEN)
223
- const estimatedThinkingTokens = thinkingChars > 0
224
- ? Math.min(Math.ceil(thinkingChars / ANTHROPIC_THINKING_CHARS_PER_TOKEN), outputTokens)
225
- : Math.max(0, outputTokens - streamedOutputTokens)
231
+ const thinkingDisabled = envelope.outputEffort === 'none'
232
+ let estimatedThinkingTokens
233
+ if (thinkingDisabled) {
234
+ estimatedThinkingTokens = 0
235
+ } else if (thinkingChars > 0) {
236
+ estimatedThinkingTokens = Math.min(Math.ceil(thinkingChars / ANTHROPIC_THINKING_CHARS_PER_TOKEN), outputTokens)
237
+ } else {
238
+ estimatedThinkingTokens = Math.max(0, outputTokens - streamedOutputTokens)
239
+ }
226
240
  const messageOutputTokens = Math.max(0, outputTokens - estimatedThinkingTokens)
227
241
 
228
242
  /** @type {import('#core/events.js').DoneEvent} */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mohdel",
3
- "version": "0.105.0",
3
+ "version": "0.105.2",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Christophe Le Bars",
@@ -83,19 +83,19 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@clack/prompts": "^1.3.0",
87
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.217.0",
88
- "@opentelemetry/sdk-node": "^0.217.0",
86
+ "@clack/prompts": "^1.4.0",
87
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.218.0",
88
+ "@opentelemetry/sdk-node": "^0.218.0",
89
89
  "chalk": "^5.4.0",
90
- "mohdel-thin-gate-linux-x64-gnu": "0.105.0"
90
+ "mohdel-thin-gate-linux-x64-gnu": "0.105.2"
91
91
  },
92
92
  "dependencies": {
93
- "@anthropic-ai/sdk": "^0.95.1",
93
+ "@anthropic-ai/sdk": "^0.95.2",
94
94
  "@cerebras/cerebras_cloud_sdk": "^1.61.1",
95
- "@google/genai": "^2.0.1",
95
+ "@google/genai": "^2.2.0",
96
96
  "@opentelemetry/api": "^1.9.1",
97
97
  "env-paths": "^4.0.0",
98
- "groq-sdk": "^1.1.2",
98
+ "groq-sdk": "^1.2.0",
99
99
  "openai": "^6.37.0",
100
100
  "undici": "^7.24.5"
101
101
  },
@@ -104,9 +104,9 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "gpt-tokenizer": "^3.4.0",
107
- "lint-staged": "^17.0.3",
107
+ "lint-staged": "^17.0.4",
108
108
  "release-it": "^20.0.1",
109
109
  "standard": "^17.1.2",
110
- "vitest": "^4.1.5"
110
+ "vitest": "^4.1.6"
111
111
  }
112
112
  }