@molecule/api-ai-anthropic 1.3.7 → 1.3.9

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
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T23:28:07.527Z
6
+ Generated: 2026-11-13T19:22:11.520Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-anthropic
@@ -134,7 +134,7 @@ export function setupAiAnthropic(): void {
134
134
 
135
135
  Peer dependencies:
136
136
 
137
- - `@molecule/api-ai` ^1.0.1
137
+ - `@molecule/api-ai` ^1.6.0
138
138
  - `@molecule/api-bond` ^1.0.1
139
139
  - `@molecule/api-i18n` ^1.0.1
140
140
  - `@molecule/api-secrets` ^1.0.1
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,UAAU,EASX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA09BjD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,UAAU,CAEnE"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,UAAU,EASX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAw+BjD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,UAAU,CAEnE"}
package/dist/provider.js CHANGED
@@ -28,6 +28,9 @@ function snapshotUsage(state) {
28
28
  return {
29
29
  inputTokens: state.inputTokens,
30
30
  outputTokens: state.outputTokens,
31
+ ...(state.reasoningOutputTokens !== undefined
32
+ ? { reasoningOutputTokens: state.reasoningOutputTokens }
33
+ : {}),
31
34
  ...(state.cacheCreationInputTokens
32
35
  ? { cacheCreationInputTokens: state.cacheCreationInputTokens }
33
36
  : {}),
@@ -644,11 +647,13 @@ class AnthropicAIProvider {
644
647
  }
645
648
  const usage = data.usage;
646
649
  const servedSpeed = parseSpeed(usage);
650
+ const reasoning = usage?.output_tokens_details?.thinking_tokens;
647
651
  yield {
648
652
  type: 'done',
649
653
  usage: {
650
654
  inputTokens: usage?.input_tokens ?? 0,
651
655
  outputTokens: usage?.output_tokens ?? 0,
656
+ ...(typeof reasoning === 'number' ? { reasoningOutputTokens: reasoning } : {}),
652
657
  ...(usage?.cache_creation_input_tokens
653
658
  ? { cacheCreationInputTokens: usage.cache_creation_input_tokens }
654
659
  : {}),
@@ -885,11 +890,15 @@ class AnthropicAIProvider {
885
890
  }
886
891
  else if (eventType === 'message_delta') {
887
892
  const usage = event.usage;
893
+ const reasoning = usage?.output_tokens_details?.thinking_tokens;
894
+ if (typeof reasoning === 'number')
895
+ state.reasoningOutputTokens = reasoning;
888
896
  const reportedSearches = usage?.server_tool_use?.web_search_requests;
889
897
  if (typeof reportedSearches === 'number')
890
898
  state.webSearchRequests = reportedSearches;
891
- if (usage?.output_tokens) {
899
+ if (typeof usage?.output_tokens === 'number')
892
900
  state.outputTokens = usage.output_tokens;
901
+ if (usage?.output_tokens || typeof reasoning === 'number') {
893
902
  // Metering snapshot (latest wins): if the stream is cut after this
894
903
  // point, the consumer books these provider-reported counts instead
895
904
  // of dropping the turn (see the ChatEvent 'usage' contract).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-anthropic",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "Anthropic Claude AI provider for molecule.dev",
5
5
  "homepage": "https://www.molecule.dev/packages/api-ai-anthropic",
6
6
  "type": "module",
@@ -33,14 +33,14 @@
33
33
  "directory": "packages/api/bonds/ai/anthropic"
34
34
  },
35
35
  "devDependencies": {
36
- "@molecule/api-ai": "1.5.0",
36
+ "@molecule/api-ai": "1.6.1",
37
37
  "@molecule/api-bond": "1.0.4",
38
38
  "@types/node": "26.6.5",
39
39
  "typescript": "6.0.3",
40
40
  "vitest": "4.1.12"
41
41
  },
42
42
  "peerDependencies": {
43
- "@molecule/api-ai": "^1.0.1",
43
+ "@molecule/api-ai": "^1.6.0",
44
44
  "@molecule/api-bond": "^1.0.1",
45
45
  "@molecule/api-i18n": "^1.0.1",
46
46
  "@molecule/api-secrets": "^1.0.1"