@openclaw/ai 2026.11.5 → 2026.11.10-beta.1

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 (157) hide show
  1. package/README.md +15 -3
  2. package/dist/{anthropic-CNEzO12C.mjs → anthropic-CBz5v2U3.mjs} +16 -15
  3. package/dist/{anthropic-payload-policy-DVk38bnY.d.mts → anthropic-payload-policy-BTrHSS_v.d.mts} +4 -8
  4. package/dist/{anthropic-stream-lifecycle-DJUtasDB.mjs → anthropic-stream-lifecycle-96vq-4V9.mjs} +154 -88
  5. package/dist/{anthropic-tool-projection-DcvsDiyX.mjs → anthropic-tool-projection-A9GceDnD.mjs} +4 -5
  6. package/dist/{anthropic-tool-projection-DKAlondV.d.mts → anthropic-tool-projection-DCOX8qai.d.mts} +1 -3
  7. package/dist/{api-registry-DY2MLUyg.d.mts → api-registry-DUEK-a3o.d.mts} +2 -4
  8. package/dist/{assistant-message-events-CHMJgbhs.mjs → assistant-message-events-DtSjIQmB.mjs} +1 -2
  9. package/dist/{assistant-output-C3czmoN4.mjs → assistant-output-kYOaiso5.mjs} +2 -3
  10. package/dist/{azure-openai-responses-client-compat-D0dvJMbZ.mjs → azure-deployment-map-hwDQc3uL.mjs} +2 -16
  11. package/dist/{azure-openai-responses-DRkduRmW.mjs → azure-openai-responses-CZheDTt_.mjs} +12 -12
  12. package/dist/azure-openai-responses-client-compat-DLsS6V6z.mjs +13 -0
  13. package/dist/{base64-C8CdcsjU.mjs → base64-FdymvxN9.mjs} +1 -2
  14. package/dist/cloudflare-BCLfDuew.mjs +15 -0
  15. package/dist/{credential-redaction-DrgndwTJ.d.mts → credential-redaction-BNv5SWQz.d.mts} +0 -2
  16. package/dist/{deferred-event-buffer-tIGkTkTm.mjs → deferred-event-buffer-BgT1IIfq.mjs} +1 -2
  17. package/dist/{diagnostics-CloVGQiK.mjs → diagnostics-BNlb1zlT.mjs} +12 -19
  18. package/dist/{diagnostics-o1PrVNQb.mjs → diagnostics-DP1SXgAW.mjs} +1 -2
  19. package/dist/diagnostics.d.mts +6 -10
  20. package/dist/diagnostics.mjs +3 -3
  21. package/dist/{env-api-keys-BuHc86ya.mjs → env-api-keys-DlUbTgKq.mjs} +1 -2
  22. package/dist/{event-stream-BYmtRe8-.d.mts → event-stream-BJS9Q8G_.d.mts} +1 -3
  23. package/dist/{event-stream-X2gmsUWv.mjs → event-stream-Bf6cK7-d.mjs} +1 -2
  24. package/dist/event-stream-CPiqa8PI.d.mts +1 -0
  25. package/dist/event-stream.d.mts +2 -2
  26. package/dist/event-stream.mjs +1 -1
  27. package/dist/{expect-lbe3Hgrh.mjs → expect-DqyhV9d8.mjs} +1 -2
  28. package/dist/github-copilot-headers-CqLRrd-i.mjs +22 -0
  29. package/dist/{github-copilot-request-facts-BZ_EMo7X.mjs → github-copilot-request-facts-BxuLEdNF.mjs} +2 -3
  30. package/dist/{google-DqG05iBa.mjs → google-BUgkXPYL.mjs} +6 -7
  31. package/dist/{google-interactions-BE7cxFPc.mjs → google-interactions-84f0xFly.mjs} +36 -25
  32. package/dist/{google-messages-p2iBzsAp.mjs → google-messages-Dip5zphv.mjs} +16 -20
  33. package/dist/{google-provider-stream-DZ6tqteU.mjs → google-provider-stream-COaKMdQv.mjs} +14 -15
  34. package/dist/{google-shared-BMYt1xSI.mjs → google-shared-Dooy5JJL.mjs} +11 -14
  35. package/dist/{google-vertex-CAq2q1Ln.mjs → google-vertex--S8AlXUD.mjs} +4 -5
  36. package/dist/{google-video-slots-Bxt-OXO8.mjs → google-video-slots-CzdrKzrO.mjs} +2 -3
  37. package/dist/{host-DqX-64Pb.mjs → host-Cf7zb-48.mjs} +73 -89
  38. package/dist/{host-ccbwPC3A.d.mts → host-Dgpzj407.d.mts} +3 -5
  39. package/dist/{host-policy-Bk85E9ue.mjs → host-policy-B1qzS7Xe.mjs} +2 -3
  40. package/dist/{index-Bczt0MnO.d.mts → index-BDF5kurq.d.mts} +10 -10
  41. package/dist/index.d.mts +8 -10
  42. package/dist/index.mjs +11 -11
  43. package/dist/internal/anthropic.d.mts +10 -21
  44. package/dist/internal/anthropic.mjs +6 -6
  45. package/dist/internal/google-model-family.d.mts +1 -3
  46. package/dist/internal/google-model-family.mjs +2 -3
  47. package/dist/internal/google.d.mts +3 -5
  48. package/dist/internal/google.mjs +1 -1
  49. package/dist/internal/model-request-body.d.mts +5 -5
  50. package/dist/internal/model-request-body.mjs +19 -6
  51. package/dist/internal/openai-completions-compat.d.mts +1 -3
  52. package/dist/internal/openai-completions-compat.mjs +2 -2
  53. package/dist/internal/openai-responses-payload-policy.d.mts +2 -4
  54. package/dist/internal/openai-responses-payload-policy.mjs +2 -2
  55. package/dist/internal/openai.d.mts +10 -32
  56. package/dist/internal/openai.mjs +12 -11
  57. package/dist/internal/reasoning-tag-text-partitioner.d.mts +0 -4
  58. package/dist/internal/reasoning-tag-text-partitioner.mjs +64 -125
  59. package/dist/internal/retry-after.d.mts +1 -1
  60. package/dist/internal/retry-after.mjs +1 -2
  61. package/dist/internal/runtime.d.mts +9 -43
  62. package/dist/internal/runtime.mjs +14 -15
  63. package/dist/internal/session-resources.d.mts +11 -0
  64. package/dist/{session-resources-vKvGIE3J.mjs → internal/session-resources.mjs} +2 -3
  65. package/dist/internal/shared.d.mts +17 -26
  66. package/dist/internal/shared.mjs +10 -10
  67. package/dist/internal/tool-schema.d.mts +2 -22
  68. package/dist/internal/tool-schema.mjs +3 -3
  69. package/dist/{llm-request-activity-DzaHoRAU.mjs → llm-request-activity-v1liRqNt.mjs} +1 -2
  70. package/dist/{mistral-DIGInqJI.mjs → mistral-BAps5cN2.mjs} +713 -299
  71. package/dist/{model-transport-url-BdksnBqu.d.mts → model-transport-url-Dad-sfx2.d.mts} +0 -4
  72. package/dist/{number-coercion-C7HsBgUL.mjs → number-coercion-BO6bhGm6.mjs} +2 -3
  73. package/dist/{observe-async-iterator-DgmegcZR.mjs → observe-async-iterator-DdOlbgrr.mjs} +1 -2
  74. package/dist/{observe-async-iterator-AlARO5wS.d.mts → observe-async-iterator-DeB_Vxes.d.mts} +14 -7
  75. package/dist/openai-BtJTmLWF.mjs +21460 -0
  76. package/dist/{openai-chatgpt-jwt-KWcgd0d_.mjs → openai-chatgpt-jwt-v5F5jJmX.mjs} +1 -2
  77. package/dist/{openai-chatgpt-responses-C6rEZcsZ.mjs → openai-chatgpt-responses-CYXMKG89.mjs} +53 -49
  78. package/dist/{openai-completions-B93R3N3b.mjs → openai-completions-Bi4Ghg3V.mjs} +6 -7
  79. package/dist/{openai-completions-compat-CJ-NsDzg.d.mts → openai-completions-compat-BJBQ682M.d.mts} +10 -5
  80. package/dist/{openai-completions-compat-CS3dlDBR.mjs → openai-completions-compat-DZLGotNt.mjs} +19 -16
  81. package/dist/{openai-completions-reasoning-replay-BwT1xwRI.mjs → openai-completions-reasoning-replay-DyH5XzNo.mjs} +1 -2
  82. package/dist/{openai-completions-transport-DHTFq-BM.mjs → openai-completions-transport-otONaRhv.mjs} +160 -527
  83. package/dist/{openai-prompt-cache-BZGaIWYh.d.mts → openai-prompt-cache-C5rwtmA_.d.mts} +2 -4
  84. package/dist/{openai-prompt-cache-3H_Fz0ya.mjs → openai-prompt-cache-CJv1bvw0.mjs} +3 -5
  85. package/dist/openai-provider-client-apBsWo9b.mjs +51 -0
  86. package/dist/{openai-responses-DSxPKV0U.mjs → openai-responses-CiIAm8fJ.mjs} +14 -14
  87. package/dist/{openai-responses-compaction-replay-DXF5BjD2.d.mts → openai-responses-compaction-replay-CUw4owu9.d.mts} +6 -7
  88. package/dist/{openai-responses-contracts-Cb1IIRRG.d.mts → openai-responses-contracts-bYtvXSvv.d.mts} +7 -12
  89. package/dist/{openai-responses-contracts-xU-n9AJJ.mjs → openai-responses-contracts-eppTI5DQ.mjs} +11 -18
  90. package/dist/{openai-responses-endpoint-CqO3ejTe.mjs → openai-responses-endpoint-AeVu3HmP.mjs} +80 -34
  91. package/dist/{openai-responses-payload-policy-BsQaD-gD.d.mts → openai-responses-payload-policy-Cihgy9fC.d.mts} +0 -2
  92. package/dist/{openai-responses-request-lifecycle-C_3FKkl7.mjs → openai-responses-request-lifecycle-DfE4xNHj.mjs} +120 -20
  93. package/dist/{openai-responses-shared-En3Jf0Vg.mjs → openai-responses-shared-BAJzOqwt.mjs} +1649 -312
  94. package/dist/{openai-responses-terminal-usage-D7IhRA6i.d.mts → openai-responses-terminal-usage-BYXQTt9u.d.mts} +2 -4
  95. package/dist/openai-responses-websocket-DywDiO81.mjs +8143 -0
  96. package/dist/{openai-stop-reason-8s70vDXj.mjs → openai-stop-reason-cA0GUHlU.mjs} +4 -3
  97. package/dist/{openai-tool-schema-CvxySRyf.mjs → openai-tool-schema-Ca74_fkR.mjs} +17 -26
  98. package/dist/openai.LICENSE +201 -0
  99. package/dist/{otel-B2u5HGvm.mjs → otel-C5Cn7IFQ.mjs} +8 -8
  100. package/dist/{overflow-CpApyjG2.mjs → overflow-CM0yZomw.mjs} +2 -3
  101. package/dist/{positive-integer-DiqE5vNi.mjs → positive-integer-AM4ltyhP.mjs} +2 -3
  102. package/dist/{prompt-cache-stability-w-ICeyOI.mjs → prompt-cache-stability-oTx0nIsh.mjs} +3 -4
  103. package/dist/{prompt-cache-stability-Cwcjv_fx.d.mts → prompt-cache-stability-xNfkD-3g.d.mts} +0 -2
  104. package/dist/{provider-error-DD-fo4Rz.mjs → provider-error-B7aKA_dg.mjs} +24 -23
  105. package/dist/{provider-error-CnaWYTRY.d.mts → provider-error-DZMru0Jv.d.mts} +0 -2
  106. package/dist/{provider-options-BQ2Msop2.d.mts → provider-options-CR_UfgUE.d.mts} +15 -11
  107. package/dist/{provider-replay-context--QGWotXx.mjs → provider-replay-context-CHJQzB0n.mjs} +3 -4
  108. package/dist/{provider-transcript-transform-Hr1kCoMX.mjs → provider-transcript-transform-C-WfgiLJ.mjs} +2 -3
  109. package/dist/{provider-transport-turn-state-DyaOKAYm.mjs → provider-transport-turn-state-BdMA1v46.mjs} +4 -27
  110. package/dist/{provider-types-B1e98js5.d.mts → provider-types-CfiTmXyw.d.mts} +3 -5
  111. package/dist/provider-types.d.mts +7 -7
  112. package/dist/provider-types.mjs +1 -2
  113. package/dist/providers.d.mts +2 -4
  114. package/dist/providers.mjs +14 -15
  115. package/dist/{record-coerce-BQaoiN3r.mjs → record-coerce-BgUo6bj4.mjs} +1 -2
  116. package/dist/{request-headers-DO4Mqhw1.mjs → request-headers-DJ4QrMC_.mjs} +1 -2
  117. package/dist/{required-api-key-2zZTkmsi.mjs → required-api-key-BniLGxy4.mjs} +2 -3
  118. package/dist/{retry-after-DnHBlFS2.d.mts → retry-after-f3ZIm8TA.d.mts} +0 -2
  119. package/dist/rolldown-runtime-DYf_mQCB.mjs +34 -0
  120. package/dist/{sanitize-unicode-CRGuMONI.mjs → sanitize-unicode-B3kUqQ-q.mjs} +1 -2
  121. package/dist/{sanitize-unicode-BISmUlUv.d.mts → sanitize-unicode-DlVtgmsw.d.mts} +2 -6
  122. package/dist/{session-affinity-DA4WHv1h.mjs → session-affinity-Czm9tjAm.mjs} +1 -2
  123. package/dist/{simple-options-CQNPKCEb.mjs → simple-options-D8CTqHvk.mjs} +40 -16
  124. package/dist/src-CNWvILd1.mjs +2 -0
  125. package/dist/{src-CQ7nH2mL.mjs → src-CmBmaGOV.mjs} +87 -20
  126. package/dist/{stable-stringify-CchQEmeA.mjs → stable-stringify-CGB-o900.mjs} +10 -8
  127. package/dist/{stream-DM-q0y5H.mjs → stream-BEE5qy7Z.mjs} +5 -7
  128. package/dist/{stream-first-event-timeout-B7RcufAV.mjs → stream-first-event-timeout-CWiv_y--.mjs} +2 -3
  129. package/dist/{streaming-byte-guard-DBXr1XYn.mjs → streaming-byte-guard-gOcUrHJF.mjs} +1 -2
  130. package/dist/{string-coerce-BCuWMIrk.mjs → string-coerce-CpcyRbc6.mjs} +1 -2
  131. package/dist/{string-normalization-B8TDDBX_.mjs → string-normalization-CS77PHD3.mjs} +2 -3
  132. package/dist/{telemetry-DJibfNKZ.mjs → telemetry-Cd4i-clM.mjs} +6 -8
  133. package/dist/{tool-schema-json-projection-BSHb4gaJ.mjs → tool-schema-json-projection-C13fPskA.mjs} +11 -16
  134. package/dist/{transport-stream-shared-CBVh6QEc.mjs → transport-stream-shared-DEpLe9fG.mjs} +24 -30
  135. package/dist/{transport-stream-shared-D3IAU4jn.d.mts → transport-stream-shared-DW4DoJLv.d.mts} +7 -8
  136. package/dist/{transport-utils-rxOHnq9y.mjs → transport-utils-Cx9L80PZ.mjs} +6 -8
  137. package/dist/transports.d.mts +29 -82
  138. package/dist/transports.mjs +39 -38
  139. package/dist/{types-BVdTf0YV.d.mts → types-BNp71XKW.d.mts} +11 -6
  140. package/dist/types-CwcLeW-7.d.mts +1 -0
  141. package/dist/{types-OVEWUaDh.mjs → types-DIBUKaTM.mjs} +1 -2
  142. package/dist/types.d.mts +7 -7
  143. package/dist/types.mjs +9 -9
  144. package/dist/{usage-CJH5D6Ea.mjs → usage-B8ggJtuG.mjs} +1 -2
  145. package/dist/{validation-QmyD0E5A.d.mts → validation-BFNWNeUl.d.mts} +1 -3
  146. package/dist/{validation-DGXqfvkj.mjs → validation-BO7nCOKO.mjs} +5 -8
  147. package/dist/validation.d.mts +1 -1
  148. package/dist/validation.mjs +1 -1
  149. package/dist/ws.LICENSE +20 -0
  150. package/dist/x509-transport-state-D4gFbgWG.mjs +40 -0
  151. package/package.json +13 -7
  152. package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +0 -1
  153. package/dist/cloudflare-BJ2_Xabx.mjs +0 -39
  154. package/dist/event-stream-B4ZcSvsu.d.mts +0 -1
  155. package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
  156. package/dist/src-BUsVkrNt.mjs +0 -105
  157. package/dist/types-Cb3-5WM9.d.mts +0 -1
@@ -1,10 +1,12 @@
1
- //#region packages/ai/src/providers/openai-stop-reason.ts
1
+ // packages/ai/src/providers/openai-stop-reason.ts
2
2
  function mapOpenAIStopReason(reason, options) {
3
3
  switch (reason) {
4
4
  case null:
5
5
  case "stop":
6
+ case "STOP":
6
7
  case "end": return { stopReason: "stop" };
7
- case "length": return { stopReason: "length" };
8
+ case "length":
9
+ case "MAX_TOKENS": return { stopReason: "length" };
8
10
  case "function_call":
9
11
  case "tool_calls": return { stopReason: "toolUse" };
10
12
  case "tool_call": if (options?.allowSingularToolCall) return { stopReason: "toolUse" };
@@ -14,5 +16,4 @@ function mapOpenAIStopReason(reason, options) {
14
16
  errorMessage: `Provider finish_reason: ${reason}`
15
17
  };
16
18
  }
17
- //#endregion
18
19
  export { mapOpenAIStopReason as t };
@@ -1,9 +1,9 @@
1
- import { o as isRecord, s as isStringArray } from "./record-coerce-BQaoiN3r.mjs";
2
- import { r as parseLocalSchemaRefPointer } from "./validation-DGXqfvkj.mjs";
3
- import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-BCuWMIrk.mjs";
4
- import { i as uniqueValues, n as normalizeStringEntries, t as filterStringEntries } from "./string-normalization-B8TDDBX_.mjs";
5
- import { _ as SCHEMA_ARRAY_KEYS, a as SCHEMA_LITERAL_KEYS, b as SCHEMA_OBJECT_KEYS, c as extendSchemaDefs, f as inheritToolSchemaTruncation, g as wasToolSchemaTruncated, h as truncateToolSchemaDepth, i as publishRuntimeToolInputSchema, l as inlineLocalToolSchemaRefs, o as canPreserveRootSchemaRefs, p as reportToolSchemaTruncation, s as copySchemaMeta$1, t as getPublishedRuntimeToolInputSchema, u as setOwnSchemaProperty, v as SCHEMA_MAP_KEYS, x as walkSchemaValue, y as SCHEMA_NESTED_KEYS } from "./tool-schema-json-projection-BSHb4gaJ.mjs";
6
- //#region packages/ai/src/providers/openai-function-tool.ts
1
+ import { o as isRecord, s as isStringArray } from "./record-coerce-BgUo6bj4.mjs";
2
+ import { r as parseLocalSchemaRefPointer } from "./validation-BO7nCOKO.mjs";
3
+ import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-CpcyRbc6.mjs";
4
+ import { i as uniqueValues, n as normalizeStringEntries, t as filterStringEntries } from "./string-normalization-CS77PHD3.mjs";
5
+ import { _ as SCHEMA_ARRAY_KEYS, a as SCHEMA_LITERAL_KEYS, b as SCHEMA_OBJECT_KEYS, c as extendSchemaDefs, f as inheritToolSchemaTruncation, g as wasToolSchemaTruncated, h as truncateToolSchemaDepth, i as publishRuntimeToolInputSchema, l as inlineLocalToolSchemaRefs, o as canPreserveRootSchemaRefs, p as reportToolSchemaTruncation, s as copySchemaMeta$1, t as getPublishedRuntimeToolInputSchema, u as setOwnSchemaProperty, v as SCHEMA_MAP_KEYS, x as walkSchemaValue, y as SCHEMA_NESTED_KEYS } from "./tool-schema-json-projection-C13fPskA.mjs";
6
+ // packages/ai/src/providers/openai-function-tool.ts
7
7
  function prepareOpenAIFunctionTool(name, description, parameters, strict, mutableParameters = false) {
8
8
  const descriptor = {
9
9
  name,
@@ -22,8 +22,7 @@ function prepareOpenAIFunctionTool(name, description, parameters, strict, mutabl
22
22
  }
23
23
  };
24
24
  }
25
- //#endregion
26
- //#region packages/ai/src/providers/clean-for-gemini.ts
25
+ // packages/ai/src/providers/clean-for-gemini.ts
27
26
  const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
28
27
  "~optional",
29
28
  "patternProperties",
@@ -203,8 +202,7 @@ function cleanSchemaForGemini(schema, toolName) {
203
202
  if (budget.truncated) reportToolSchemaTruncation(schema, toolName);
204
203
  return inheritToolSchemaTruncation(boundedSchema, normalized, budget.truncated);
205
204
  }
206
- //#endregion
207
- //#region packages/ai/src/providers/clean-for-llamacpp-gbnf.ts
205
+ // packages/ai/src/providers/clean-for-llamacpp-gbnf.ts
208
206
  /** llama.cpp rejects grammar repetitions whose expanded rule count reaches 2000. */
209
207
  const LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD = 2e3;
210
208
  /** Removes JSON Schema constraints that llama.cpp cannot compile into GBNF. */
@@ -266,8 +264,7 @@ function findLlamacppGbnfSchemaViolations(schema, path) {
266
264
  collectSchemaViolations(truncateToolSchemaDepth(schema), path, violations);
267
265
  return violations;
268
266
  }
269
- //#endregion
270
- //#region packages/ai/src/providers/schema-keyword-strip.ts
267
+ // packages/ai/src/providers/schema-keyword-strip.ts
271
268
  function stripSchemaKeywords(schema, unsupportedKeywords) {
272
269
  const visit = (value) => stripSchemaKeywords(value, unsupportedKeywords);
273
270
  return walkSchemaValue(schema, (obj) => {
@@ -290,8 +287,7 @@ function stripUnsupportedSchemaKeywords(schema, unsupportedKeywords) {
290
287
  const bounded = truncateToolSchemaDepth(schema);
291
288
  return inheritToolSchemaTruncation(bounded, stripSchemaKeywords(bounded, unsupportedKeywords));
292
289
  }
293
- //#endregion
294
- //#region packages/ai/src/providers/tool-schema-normalization-cache.ts
290
+ // packages/ai/src/providers/tool-schema-normalization-cache.ts
295
291
  let preparedSchemas;
296
292
  /** Request preparation already detached and depth-bounded these schemas. */
297
293
  function isPreparedToolSchemaNormalization(schema) {
@@ -353,8 +349,7 @@ function createToolSchemaNormalizationCache() {
353
349
  }
354
350
  };
355
351
  }
356
- //#endregion
357
- //#region packages/ai/src/providers/tool-schema-normalization.ts
352
+ // packages/ai/src/providers/tool-schema-normalization.ts
358
353
  const OPENAPI_SCHEMA_ANNOTATION_KEYS = /* @__PURE__ */ new Set([
359
354
  "discriminator",
360
355
  "externalDocs",
@@ -531,8 +526,7 @@ function normalizeToolSchema(schema, profile, toolName) {
531
526
  const normalized = inheritToolSchemaTruncation(bounded, normalizeToolSchemaRecursive(bounded, profile));
532
527
  return source ? publishedNormalizations.remember(source, profile, normalized) : normalized;
533
528
  }
534
- //#endregion
535
- //#region packages/ai/src/providers/agent-tools-parameter-schema.ts
529
+ // packages/ai/src/providers/agent-tools-parameter-schema.ts
536
530
  /**
537
531
  * Normalizes model-facing tool parameter schemas across provider quirks.
538
532
  * Handles local JSON Schema refs, OpenAPI nullable syntax, top-level unions,
@@ -660,9 +654,6 @@ function normalizeArraySchemaItems(schema, mode) {
660
654
  }
661
655
  /** Return a provider-compatible JSON schema for a model-facing tool. */
662
656
  function normalizeToolParameterSchema(schema, options) {
663
- const prepared = getPublishedRuntimeToolInputSchema(schema) || isPreparedToolSchemaNormalization(schema);
664
- const boundedSchema = prepared ? schema : truncateToolSchemaDepth(schema, options?.toolName);
665
- if (prepared && wasToolSchemaTruncated(schema)) reportToolSchemaTruncation(schema, options?.toolName);
666
657
  const normalizedProvider = normalizeLowercaseStringOrEmpty(options?.modelProvider);
667
658
  const normalizedModelId = normalizeLowercaseStringOrEmpty(options?.modelId);
668
659
  const normalizedToolSchemaProfile = normalizeLowercaseStringOrEmpty(options?.modelCompat?.toolSchemaProfile);
@@ -683,6 +674,9 @@ function normalizeToolParameterSchema(schema, options) {
683
674
  return cached;
684
675
  }
685
676
  }
677
+ const prepared = getPublishedRuntimeToolInputSchema(schema) || isPreparedToolSchemaNormalization(schema);
678
+ const boundedSchema = prepared ? schema : truncateToolSchemaDepth(schema, options?.toolName);
679
+ if (prepared && wasToolSchemaTruncated(schema)) reportToolSchemaTruncation(schema, options?.toolName);
686
680
  const isGeminiProvider = normalizedProvider.includes("google") || normalizedProvider.includes("gemini") || /(?:^|[/:])gemini(?:$|[-/:.])/.test(normalizedModelId) || normalizedToolSchemaProfile === "gemini";
687
681
  const isAnthropicProvider = normalizedProvider.includes("anthropic");
688
682
  const isLlamacppGbnfProfile = normalizedToolSchemaProfile === "llamacpp";
@@ -760,8 +754,7 @@ function normalizeToolParameterSchema(schema, options) {
760
754
  additionalProperties: "additionalProperties" in schemaRecord ? schemaRecord.additionalProperties : true
761
755
  });
762
756
  }
763
- //#endregion
764
- //#region packages/ai/src/providers/openai-tool-schema-compat.ts
757
+ // packages/ai/src/providers/openai-tool-schema-compat.ts
765
758
  /** Repairs recoverable OpenAI tool-schema shapes before canonical normalization. */
766
759
  function normalizeOpenAIStrictCompatSchema(schema, toolName) {
767
760
  return normalizeToolSchema(schema, "compat", toolName);
@@ -837,8 +830,7 @@ function collectStrictSchemaViolations(schema, path, options) {
837
830
  }
838
831
  return violations;
839
832
  }
840
- //#endregion
841
- //#region packages/ai/src/providers/openai-tool-schema.ts
833
+ // packages/ai/src/providers/openai-tool-schema.ts
842
834
  const strictOpenAISchemaCache = createToolSchemaNormalizationCache();
843
835
  const publishedStrictCompatibility = /* @__PURE__ */ new WeakMap();
844
836
  function resolveToolSchemaModelCompat(compat) {
@@ -899,5 +891,4 @@ function resolveOpenAIProjectedToolsStrictToolFlag(projection, strict) {
899
891
  if (strict !== true) return strict === false ? false : void 0;
900
892
  return projection.tools.every((tool) => isStrictOpenAIJsonSchemaCompatible(tool.parameters));
901
893
  }
902
- //#endregion
903
894
  export { cleanSchemaForLlamacppGbnf as _, resolveOpenAIProjectedToolsStrictToolFlag as a, cleanSchemaForGemini as b, normalizeOpenAIStrictCompatSchema as c, resolveUnsupportedToolSchemaKeywords as d, shouldOmitEmptyArrayItems as f, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD as g, stripUnsupportedSchemaKeywords as h, normalizeStrictOpenAIJsonSchema as i, extractToolSchemaModelCompat as l, withPreparedToolSchemaNormalization as m, isStrictOpenAIJsonSchemaCompatible as n, findCompatClosedObjectPaths as o, normalizeToolSchema as p, normalizeOpenAIStrictToolParameters as r, findOpenAIStrictSchemaViolations as s, findOpenAIStrictToolProjectionDiagnostics as t, normalizeToolParameterSchema as u, findLlamacppGbnfSchemaViolations as v, prepareOpenAIFunctionTool as x, GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS as y };
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 OpenAI
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,7 +1,7 @@
1
- import { a as registerTracerProvider, i as getRegisteredTracerProvider, n as completionChunkFromJSON, r as UsageInfo$outboundSchema } from "./mistral-DIGInqJI.mjs";
1
+ import { a as registerTracerProvider, i as getRegisteredTracerProvider, n as completionChunkFromJSON, r as UsageInfo$outboundSchema } from "./mistral-BAps5cN2.mjs";
2
2
  import { SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
3
- import { ATTR_ERROR_TYPE, ATTR_GEN_AI_AGENT_DESCRIPTION, ATTR_GEN_AI_AGENT_ID, ATTR_GEN_AI_AGENT_NAME, ATTR_GEN_AI_CONVERSATION_ID, ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_PROVIDER_NAME, ATTR_GEN_AI_REQUEST_CHOICE_COUNT, ATTR_GEN_AI_REQUEST_ENCODING_FORMATS, ATTR_GEN_AI_REQUEST_FREQUENCY_PENALTY, ATTR_GEN_AI_REQUEST_MAX_TOKENS, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_REQUEST_PRESENCE_PENALTY, ATTR_GEN_AI_REQUEST_SEED, ATTR_GEN_AI_REQUEST_STOP_SEQUENCES, ATTR_GEN_AI_REQUEST_TEMPERATURE, ATTR_GEN_AI_REQUEST_TOP_K, ATTR_GEN_AI_REQUEST_TOP_P, ATTR_GEN_AI_RESPONSE_FINISH_REASONS, ATTR_GEN_AI_RESPONSE_ID, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_TOOL_DEFINITIONS, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_TOOL_TYPE, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, GEN_AI_OPERATION_NAME_VALUE_CHAT, GEN_AI_OPERATION_NAME_VALUE_CREATE_AGENT, GEN_AI_OPERATION_NAME_VALUE_EMBEDDINGS, GEN_AI_OPERATION_NAME_VALUE_EXECUTE_TOOL, GEN_AI_OPERATION_NAME_VALUE_GENERATE_CONTENT, GEN_AI_OPERATION_NAME_VALUE_INVOKE_AGENT, GEN_AI_OPERATION_NAME_VALUE_TEXT_COMPLETION, GEN_AI_PROVIDER_NAME_VALUE_MISTRAL_AI } from "@opentelemetry/semantic-conventions/incubating";
4
- //#region node_modules/.pnpm/@mistralai+mistralai@2.7.0_@opentelemetry+api@1.9.1_@opentelemetry+exporter-trace-otlp-_ef8dce160c897b96339bfd78f5c612fa/node_modules/@mistralai/mistralai/esm/extra/observability/formatting.js
3
+ import { ATTR_ERROR_TYPE, ATTR_GEN_AI_AGENT_DESCRIPTION, ATTR_GEN_AI_AGENT_ID, ATTR_GEN_AI_AGENT_NAME, ATTR_GEN_AI_CONVERSATION_ID, ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_PROVIDER_NAME, ATTR_GEN_AI_REQUEST_CHOICE_COUNT, ATTR_GEN_AI_REQUEST_ENCODING_FORMATS, ATTR_GEN_AI_REQUEST_FREQUENCY_PENALTY, ATTR_GEN_AI_REQUEST_MAX_TOKENS, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_REQUEST_PRESENCE_PENALTY, ATTR_GEN_AI_REQUEST_SEED, ATTR_GEN_AI_REQUEST_STOP_SEQUENCES, ATTR_GEN_AI_REQUEST_TEMPERATURE, ATTR_GEN_AI_REQUEST_TOP_K, ATTR_GEN_AI_REQUEST_TOP_P, ATTR_GEN_AI_RESPONSE_FINISH_REASONS, ATTR_GEN_AI_RESPONSE_ID, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_TOOL_DEFINITIONS, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_TOOL_TYPE, ATTR_GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, GEN_AI_OPERATION_NAME_VALUE_CHAT, GEN_AI_OPERATION_NAME_VALUE_CREATE_AGENT, GEN_AI_OPERATION_NAME_VALUE_EMBEDDINGS, GEN_AI_OPERATION_NAME_VALUE_EXECUTE_TOOL, GEN_AI_OPERATION_NAME_VALUE_GENERATE_CONTENT, GEN_AI_OPERATION_NAME_VALUE_INVOKE_AGENT, GEN_AI_OPERATION_NAME_VALUE_TEXT_COMPLETION, GEN_AI_PROVIDER_NAME_VALUE_MISTRAL_AI } from "@opentelemetry/semantic-conventions/incubating";
4
+ // node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/formatting.js
5
5
  /**
6
6
  * Formatting helpers for converting Mistral API payloads to OTEL GenAI convention formats.
7
7
  *
@@ -164,8 +164,7 @@ function formatToolDefinition(tool) {
164
164
  if (parameters != null) formatted["parameters"] = parameters;
165
165
  return formatted;
166
166
  }
167
- //#endregion
168
- //#region node_modules/.pnpm/@mistralai+mistralai@2.7.0_@opentelemetry+api@1.9.1_@opentelemetry+exporter-trace-otlp-_ef8dce160c897b96339bfd78f5c612fa/node_modules/@mistralai/mistralai/esm/extra/observability/streaming.js
167
+ // node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/streaming.js
169
168
  /**
170
169
  * Streaming response helpers for OTEL tracing.
171
170
  *
@@ -282,8 +281,7 @@ function extractOutputText(content) {
282
281
  if (!Array.isArray(content)) return "";
283
282
  return content.filter((block) => block.type === "text").map((block) => block.text).join("");
284
283
  }
285
- //#endregion
286
- //#region node_modules/.pnpm/@mistralai+mistralai@2.7.0_@opentelemetry+api@1.9.1_@opentelemetry+exporter-trace-otlp-_ef8dce160c897b96339bfd78f5c612fa/node_modules/@mistralai/mistralai/esm/extra/observability/otel.js
284
+ // node_modules/.pnpm/@mistralai+mistralai@3.4.0_@aws-sdk+client-s3@3.1161.0_@azure+identity@4.14.1_supports-_16bd8ad5369b63d330551c8b3f594697/node_modules/@mistralai/mistralai/esm/extra/observability/otel.js
287
285
  /**
288
286
  * OTEL conventions for gen AI may be found at:
289
287
  *
@@ -321,6 +319,7 @@ const semConvAttributes = {
321
319
  ATTR_GEN_AI_TOOL_DEFINITIONS,
322
320
  ATTR_GEN_AI_TOOL_NAME,
323
321
  ATTR_GEN_AI_TOOL_TYPE,
322
+ ATTR_GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS,
324
323
  ATTR_GEN_AI_USAGE_INPUT_TOKENS,
325
324
  ATTR_GEN_AI_USAGE_OUTPUT_TOKENS,
326
325
  ATTR_HTTP_REQUEST_METHOD,
@@ -463,6 +462,8 @@ function enrichResponseGenaiAttrs(span, genAiOp, responseData) {
463
462
  if (usage) {
464
463
  attributes[ATTR_GEN_AI_USAGE_INPUT_TOKENS] = usage["prompt_tokens"] || 0;
465
464
  attributes[ATTR_GEN_AI_USAGE_OUTPUT_TOKENS] = usage["completion_tokens"] || 0;
465
+ const cachedTokens = usage["prompt_tokens_details"]?.["cached_tokens"];
466
+ if (typeof cachedTokens === "number" && cachedTokens > 0) attributes[ATTR_GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS] = cachedTokens;
466
467
  }
467
468
  setAvailableAttributes(span, attributes);
468
469
  }
@@ -762,5 +763,4 @@ async function traceAsync(name, fn) {
762
763
  span.end();
763
764
  }
764
765
  }
765
- //#endregion
766
766
  export { MISTRAL_SDK_OTEL_TRACER_NAME, MistralAIAttributes, OTEL_SERVICE_NAME, TracingErrors, enrichSpanFromRequest, enrichSpanFromResponse, getOrCreateOtelTracer, getRegisteredTracerProvider, getResponseAndError, getSpanContext, getTracedRequestAndSpan, getTracedResponse, recordRequestError, registerTracerProvider, runWithContext, semConvAttributes, traceAsync };
@@ -1,5 +1,5 @@
1
- import { a as isProviderRefusalAssistantError } from "./diagnostics-o1PrVNQb.mjs";
2
- //#region packages/ai/src/utils/overflow.ts
1
+ import { a as isProviderRefusalAssistantError } from "./diagnostics-DP1SXgAW.mjs";
2
+ // packages/ai/src/utils/overflow.ts
3
3
  const CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE = /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i;
4
4
  const REQUEST_BUDGET_OVERFLOW_RE = /context window exceeded: estimated input \d+ leaves only \d+ output tokens within the \d+-token context\./i;
5
5
  const CONTEXT_OVERFLOW_PATTERN_SCOPES = {
@@ -116,5 +116,4 @@ function isContextOverflow(message, contextWindow) {
116
116
  }
117
117
  return false;
118
118
  }
119
- //#endregion
120
119
  export { matchesContextOverflowMessage as n, isContextOverflow as t };
@@ -1,7 +1,6 @@
1
- import { c as parseStrictPositiveInteger, o as floorPositiveFiniteNumber } from "./number-coercion-C7HsBgUL.mjs";
2
- //#region packages/ai/src/transports/positive-integer.ts
1
+ import { c as parseStrictPositiveInteger, o as floorPositiveFiniteNumber } from "./number-coercion-BO6bhGm6.mjs";
2
+ // packages/ai/src/transports/positive-integer.ts
3
3
  function parsePositiveInteger(value) {
4
4
  return typeof value === "string" ? parseStrictPositiveInteger(value) : floorPositiveFiniteNumber(value);
5
5
  }
6
- //#endregion
7
6
  export { parsePositiveInteger as t };
@@ -1,6 +1,6 @@
1
- import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-BCuWMIrk.mjs";
2
- import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
3
- //#region packages/ai/src/utils/prompt-cache-stability.ts
1
+ import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-CpcyRbc6.mjs";
2
+ import { t as sanitizeSurrogates } from "./sanitize-unicode-B3kUqQ-q.mjs";
3
+ // packages/ai/src/utils/prompt-cache-stability.ts
4
4
  /**
5
5
  * Prompt-cache normalization helpers. They keep generated prompt sections
6
6
  * deterministic across platform newlines, trailing whitespace, and input
@@ -28,5 +28,4 @@ function normalizePromptCapabilityIds(capabilities) {
28
28
  }
29
29
  return [...seen].toSorted((left, right) => left.localeCompare(right));
30
30
  }
31
- //#endregion
32
31
  export { normalizeStructuredPromptSection as n, sortPromptCacheToolsByName as r, normalizePromptCapabilityIds as t };
@@ -1,4 +1,3 @@
1
- //#region packages/ai/src/utils/prompt-cache-stability.d.ts
2
1
  /** Canonicalizes provider tool order without relying on host locale settings. */
3
2
  declare function sortPromptCacheToolsByName<T extends {
4
3
  readonly name?: string;
@@ -9,5 +8,4 @@ declare function sortPromptCacheToolsByName<T extends {
9
8
  declare function normalizeStructuredPromptSection(text: string): string;
10
9
  /** Normalize, de-dupe, and sort capability ids for stable prompt payloads. */
11
10
  declare function normalizePromptCapabilityIds(capabilities: ReadonlyArray<string>): string[];
12
- //#endregion
13
11
  export { normalizeStructuredPromptSection as n, sortPromptCacheToolsByName as r, normalizePromptCapabilityIds as t };
@@ -1,11 +1,11 @@
1
- import { i as asOptionalRecord } from "./record-coerce-BQaoiN3r.mjs";
2
- import { s as normalizeStringifiedOptionalString } from "./string-coerce-BCuWMIrk.mjs";
3
- import "./src-BUsVkrNt.mjs";
4
- import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
5
- import { t as stableStringify } from "./stable-stringify-CchQEmeA.mjs";
1
+ import { i as asOptionalRecord } from "./record-coerce-BgUo6bj4.mjs";
2
+ import { s as normalizeStringifiedOptionalString } from "./string-coerce-CpcyRbc6.mjs";
3
+ import { t as expectDefined } from "./expect-DqyhV9d8.mjs";
4
+ import { t as stableStringify } from "./stable-stringify-CGB-o900.mjs";
5
+ import "./src-CNWvILd1.mjs";
6
6
  import { parseRetryAfterHeadersSeconds, resolveProviderErrorRetrySeconds } from "./internal/retry-after.mjs";
7
- import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
8
- //#region packages/normalization-core/src/balanced-json.ts
7
+ import { n as estimateBase64DecodedBytes } from "./base64-FdymvxN9.mjs";
8
+ // packages/normalization-core/src/balanced-json.ts
9
9
  function isJsonOpeningDelimiter(char, openers) {
10
10
  return (char === "{" || char === "[") && openers.includes(char);
11
11
  }
@@ -48,8 +48,7 @@ function extractBalancedJsonFragments(raw, opts = {}) {
48
48
  }
49
49
  return fragments;
50
50
  }
51
- //#endregion
52
- //#region packages/normalization-core/src/utf16-slice.ts
51
+ // packages/normalization-core/src/utf16-slice.ts
53
52
  function isHighSurrogate(codeUnit) {
54
53
  return codeUnit >= 55296 && codeUnit <= 56319;
55
54
  }
@@ -76,8 +75,7 @@ function truncateUtf16Safe(input, maxLen) {
76
75
  if (input.length <= limit) return input;
77
76
  return sliceUtf16Safe(input, 0, limit);
78
77
  }
79
- //#endregion
80
- //#region packages/ai/src/utils/credential-redaction.ts
78
+ // packages/ai/src/utils/credential-redaction.ts
81
79
  const NON_CREDENTIAL_FIELD_NAMES = /* @__PURE__ */ new Set([
82
80
  "passwordfile",
83
81
  "tokenbudget",
@@ -142,7 +140,7 @@ function hasSensitiveProseContent(value) {
142
140
  const key = expectDefined(match[1], "diagnostic assignment field");
143
141
  const normalized = normalizeDiagnosticFieldName(key);
144
142
  if (isCredentialFieldName(normalized) || extractDiagnosticMediaField(key, normalized, void 0, false)) return true;
145
- mediaContext ||= isDiagnosticMediaPayload((field) => field === key ? assigned : void 0);
143
+ mediaContext ||= isDiagnosticMediaPayload({ [key]: assigned });
146
144
  contextualPayload ||= Boolean(extractDiagnosticMediaField(key, normalized, void 0, true));
147
145
  if (mediaContext && contextualPayload) return true;
148
146
  }
@@ -171,11 +169,14 @@ function redactCredentialText(value) {
171
169
  function diagnosticBytes(value, numericArrays = false) {
172
170
  return value instanceof ArrayBuffer ? new Uint8Array(value) : ArrayBuffer.isView(value) ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength) : numericArrays && Array.isArray(value) && value.every((byte) => Number.isInteger(byte) && byte >= 0 && byte <= 255) ? Uint8Array.from(value) : void 0;
173
171
  }
174
- function isDiagnosticMediaPayload(field) {
175
- const type = field("type");
172
+ function readDiagnosticField(value, descriptors, key) {
173
+ return descriptors ? descriptors[key]?.value : Object.hasOwn(value, key) ? Reflect.get(value, key) : void 0;
174
+ }
175
+ function isDiagnosticMediaPayload(value, descriptors) {
176
+ const type = readDiagnosticField(value, descriptors, "type");
176
177
  if (typeof type === "string" && MEDIA_TYPE_RE.test(normalizeDiagnosticFieldName(type))) return true;
177
178
  for (const key of MEDIA_MIME_FIELDS) {
178
- const mime = field(key);
179
+ const mime = readDiagnosticField(value, descriptors, key);
179
180
  if (typeof mime === "string" && MEDIA_MIME_RE.test(mime)) return true;
180
181
  }
181
182
  return false;
@@ -246,14 +247,16 @@ function projectValue(producerOwned, value, policy = {}, seen = /* @__PURE__ */
246
247
  }
247
248
  descriptors = snapshot;
248
249
  }
249
- const field = (key) => descriptors ? descriptors[key]?.value : Object.hasOwn(value, key) ? Reflect.get(value, key) : void 0;
250
250
  state.changed ||= keys.length > maxKeys;
251
251
  seen.add(value);
252
252
  const out = Array.isArray(value) ? trusted && !policy.omitField ? value : [] : {};
253
- const name = field("name");
254
- const rawName = typeof name === "string" ? name : field("key");
255
- const redactValueField = policy.redactCredentials !== false && (keys.length > maxKeys || typeof rawName === "string" && isCredentialFieldName(normalizeDiagnosticFieldName(rawName)));
256
- const redactMedia = mediaPayload || keys.length > maxKeys || isDiagnosticMediaPayload(field);
253
+ let redactValueField = false;
254
+ if (policy.redactCredentials !== false) {
255
+ const name = readDiagnosticField(value, descriptors, "name");
256
+ const rawName = typeof name === "string" ? name : readDiagnosticField(value, descriptors, "key");
257
+ redactValueField = keys.length > maxKeys || typeof rawName === "string" && isCredentialFieldName(normalizeDiagnosticFieldName(rawName));
258
+ }
259
+ const redactMedia = mediaPayload || keys.length > maxKeys || isDiagnosticMediaPayload(value, descriptors);
257
260
  for (const key of descriptors ? Object.keys(descriptors) : keys) {
258
261
  if (typeof key !== "string" || key === "length") continue;
259
262
  let child;
@@ -342,8 +345,7 @@ function projectDiagnosticText(value) {
342
345
  const remainder = text.slice(cursor);
343
346
  return looksLikeDiagnosticJson(unstructured + remainder) ? "[Malformed diagnostic JSON redacted]" : redacted + remainder;
344
347
  }
345
- //#endregion
346
- //#region packages/ai/src/utils/provider-error.ts
348
+ // packages/ai/src/utils/provider-error.ts
347
349
  const MAX_ERROR_BODY_LENGTH = 4e3;
348
350
  /** Diagnostics accept provider classification labels, not arbitrary error prose or objects. */
349
351
  function readTransportDiagnosticLabel(value) {
@@ -429,5 +431,4 @@ function projectProviderError(error, signal) {
429
431
  };
430
432
  }
431
433
  }
432
- //#endregion
433
434
  export { projectDiagnosticValue as a, truncateUtf16Safe as c, isCredentialFieldName as i, projectProviderError as n, projectPreparedDiagnosticValue as o, readTransportDiagnosticLabel as r, redactDiagnosticText as s, configureProviderErrorRedactor as t };
@@ -1,4 +1,3 @@
1
- //#region packages/ai/src/utils/provider-error.d.ts
2
1
  type ProviderErrorProjection = {
3
2
  stopReason: "aborted" | "error";
4
3
  errorMessage: string;
@@ -11,5 +10,4 @@ type ProviderErrorRedactor = (value: unknown) => unknown;
11
10
  declare function configureProviderErrorRedactor(redactor: ProviderErrorRedactor | undefined): ProviderErrorRedactor | undefined;
12
11
  /** Projects one hostile provider throw into final, bounded assistant terminal fields. */
13
12
  declare function projectProviderError(error: unknown, signal?: AbortSignal): ProviderErrorProjection;
14
- //#endregion
15
13
  export { projectProviderError as i, ProviderErrorRedactor as n, configureProviderErrorRedactor as r, ProviderErrorProjection as t };
@@ -1,10 +1,9 @@
1
- import { at as StreamOptions } from "./types-BVdTf0YV.mjs";
2
- import "./types-Cb3-5WM9.mjs";
3
- import { a as ProviderContext, c as ProviderModel, u as ProviderStreamOptions } from "./provider-types-B1e98js5.mjs";
4
- import OpenAI from "openai";
1
+ import { at as StreamOptions } from "./types-BNp71XKW.mjs";
2
+ import "./types-CwcLeW-7.mjs";
3
+ import { a as ProviderContext, c as ProviderModel, u as ProviderStreamOptions } from "./provider-types-CfiTmXyw.mjs";
5
4
  import Anthropic from "@anthropic-ai/sdk";
5
+ import OpenAI from "openai";
6
6
  import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
7
- //#region packages/ai/src/providers/openai-reasoning-effort.d.ts
8
7
  declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
9
8
  type OpenAIReasoningEffort = "none" | (typeof ENABLED_REASONING_EFFORTS)[number];
10
9
  type OpenAIApiReasoningEffort = OpenAIReasoningEffort | (string & {});
@@ -51,8 +50,6 @@ declare function resolveOpenAIReasoningEffortForModel(params: {
51
50
  effort: string;
52
51
  fallbackMap?: Record<string, string>;
53
52
  }): OpenAIApiReasoningEffort | undefined;
54
- //#endregion
55
- //#region packages/ai/src/providers/openai-tool-projection.d.ts
56
53
  type OpenAIToolDescriptor = {
57
54
  readonly name?: unknown;
58
55
  readonly description?: unknown;
@@ -85,8 +82,6 @@ declare function projectOpenAITools(tools: readonly OpenAIToolDescriptor[]): Ope
85
82
  declare function reconcileOpenAIResponsesToolChoice(choice: OpenAIResponsesToolChoice, projection: OpenAIToolProjection): OpenAIResponsesToolChoice | undefined;
86
83
  /** Keeps Chat Completions tool choices aligned with surviving function schemas. */
87
84
  declare function reconcileOpenAICompletionsToolChoice(choice: OpenAICompletionsSdkToolChoice, projection: OpenAIToolProjection): OpenAICompletionsSdkToolChoice | undefined;
88
- //#endregion
89
- //#region packages/ai/src/provider-options.d.ts
90
85
  /** Identity of a provider compaction checkpoint the server rejected on replay. */
91
86
  type CompactionReplayRejection = {
92
87
  data: string;
@@ -127,6 +122,11 @@ declare const preparedRequestSuffix: {
127
122
  hasToolCall(context: object, id: string): boolean;
128
123
  toolCallId(context: object, id: string, normalized: string): string;
129
124
  };
125
+ /** A side request's own suffix: transports place no prompt-cache checkpoint on or after it. */
126
+ declare const uncachedSuffixMessage: {
127
+ mark<T extends object>(message: T): T;
128
+ has(message: object): boolean;
129
+ };
130
130
  type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
131
131
  type AnthropicThinkingDisplay = "summarized" | "omitted";
132
132
  type AnthropicContextManagementOptions = {
@@ -149,6 +149,11 @@ interface AnthropicOptions extends StreamOptions, AnthropicContextManagementOpti
149
149
  * process starts at that version instead of being rejected again.
150
150
  */
151
151
  onClaudeCodeVersionRequired?: (version: string) => void;
152
+ /**
153
+ * Called when Anthropic rejected `speed: "fast"` for this model; the transport
154
+ * already resent the request at standard speed. Owners stop offering fast mode.
155
+ */
156
+ onFastModeUnsupported?: (modelId: string) => void;
152
157
  /**
153
158
  * Enable extended thinking.
154
159
  * For Opus 4.6+ and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
@@ -216,5 +221,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
216
221
  reasoning?: OpenAIReasoningEffort | "off";
217
222
  reasoningEffort?: OpenAIReasoningEffort | "off";
218
223
  };
219
- //#endregion
220
- export { resolveOpenAISupportedReasoningEfforts as A, isOpenAIGpt55Model as C, resolveOpenAIModelReasoningEfforts as D, normalizeOpenAIReasoningEffort as E, supportsOpenAITemperature as M, resolveOpenAIReasoningEffortForModel as O, isOpenAIGpt54MiniModel as S, isOpenAIGpt6Model as T, reconcileOpenAICompletionsToolChoice as _, BaseOpenAIStreamOptions as a, OpenAIReasoningEffort as b, OpenAICompletionsOptions as c, measuredRequestPressure as d, preparedRequestSuffix as f, projectOpenAITools as g, OpenAIToolProjection as h, AnthropicThinkingDisplay as i, supportsOpenAIReasoningEffort as j, resolveOpenAIReasoningEffortMapping as k, OpenAIResponsesCompactionRejection as l, OpenAICompletionsToolChoice as m, AnthropicEffort as n, CodeModeToolSurfaceObservation as o, reasoningTagTextPolicy as p, AnthropicOptions as r, CompactionReplayRejection as s, AnthropicContextManagementOptions as t, codeModeToolSurfaceObserver as u, reconcileOpenAIResponsesToolChoice as v, isOpenAIGpt56Model as w, applyOpenAICompletionsToolReasoning as x, OpenAIApiReasoningEffort as y };
224
+ export { resolveOpenAIReasoningEffortMapping as A, isOpenAIGpt54MiniModel as C, normalizeOpenAIReasoningEffort as D, isOpenAIGpt6Model as E, supportsOpenAIReasoningEffort as M, supportsOpenAITemperature as N, resolveOpenAIModelReasoningEfforts as O, applyOpenAICompletionsToolReasoning as S, isOpenAIGpt56Model as T, projectOpenAITools as _, BaseOpenAIStreamOptions as a, OpenAIApiReasoningEffort as b, OpenAICompletionsOptions as c, measuredRequestPressure as d, preparedRequestSuffix as f, OpenAIToolProjection as g, OpenAICompletionsToolChoice as h, AnthropicThinkingDisplay as i, resolveOpenAISupportedReasoningEfforts as j, resolveOpenAIReasoningEffortForModel as k, OpenAIResponsesCompactionRejection as l, uncachedSuffixMessage as m, AnthropicEffort as n, CodeModeToolSurfaceObservation as o, reasoningTagTextPolicy as p, AnthropicOptions as r, CompactionReplayRejection as s, AnthropicContextManagementOptions as t, codeModeToolSurfaceObserver as u, reconcileOpenAICompletionsToolChoice as v, isOpenAIGpt55Model as w, OpenAIReasoningEffort as x, reconcileOpenAIResponsesToolChoice as y };