@openclaw/ai 2026.9.8 → 2026.10.1-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 (115) hide show
  1. package/README.md +4 -1
  2. package/dist/{anthropic-CTXJlfnS.mjs → anthropic-CZv6XFER.mjs} +52 -147
  3. package/dist/{anthropic-payload-policy-NIPVYXPq.d.mts → anthropic-payload-policy-BhCcgNdm.d.mts} +7 -4
  4. package/dist/{anthropic-stream-reducer-DrsBCsFY.mjs → anthropic-stream-reducer-BQ1tjd7x.mjs} +369 -233
  5. package/dist/{api-registry-D-nbmSqr.d.mts → api-registry-DpU0Rj-I.d.mts} +4 -4
  6. package/dist/{provider-transcript-transform-DjA5Fk2P.mjs → assistant-output-OLm-Oln0.mjs} +17 -17
  7. package/dist/{assistant-text-phase-C20rxWwP.mjs → assistant-text-phase-Bl1aDCB7.mjs} +2 -8
  8. package/dist/{azure-openai-responses-BBxv4QVI.mjs → azure-openai-responses-DH7bd3QT.mjs} +12 -17
  9. package/dist/{azure-openai-responses-client-compat-C7K7QfUE.mjs → azure-openai-responses-client-compat-D0dvJMbZ.mjs} +3 -10
  10. package/dist/{base64-C1PsYcRQ.mjs → base64-C8CdcsjU.mjs} +3 -45
  11. package/dist/cloudflare-5qSGvIUH.mjs +39 -0
  12. package/dist/{diagnostics-CJaB6g8J.mjs → diagnostics-Caj-4RBA.mjs} +19 -37
  13. package/dist/diagnostics.d.mts +4 -4
  14. package/dist/diagnostics.mjs +2 -2
  15. package/dist/{event-stream-vd9UnCAU.mjs → event-stream-C5AbCAaZ.mjs} +29 -1
  16. package/dist/event-stream-DqDQWqiy.d.mts +1 -0
  17. package/dist/{event-stream-DOPFYVqs.d.mts → event-stream-DrRM_90c.d.mts} +1 -1
  18. package/dist/event-stream.d.mts +2 -2
  19. package/dist/event-stream.mjs +1 -1
  20. package/dist/{github-copilot-request-facts-BTEBMeOv.mjs → github-copilot-request-facts-DEE6gcB9.mjs} +3 -1
  21. package/dist/{google-B3HEK0Ag.mjs → google-1WLOtb8w.mjs} +12 -9
  22. package/dist/{google-interactions-vMlEfPAA.mjs → google-interactions-wrnE6MLw.mjs} +39 -49
  23. package/dist/{google-messages-Dz2dAnGo.mjs → google-messages-BwPPycw6.mjs} +11 -17
  24. package/dist/{google-shared-B58i3c8H.mjs → google-shared-Eql1OMPU.mjs} +5 -6
  25. package/dist/{google-vertex-DYFXzEbh.mjs → google-vertex-0LrlRoO3.mjs} +11 -11
  26. package/dist/{host-rxlNaBwm.d.mts → host-BinBeGcQ.d.mts} +12 -4
  27. package/dist/{host-DwBmNMCC.mjs → host-DCW52iHe.mjs} +57 -9
  28. package/dist/{host-policy-wK-ay_RK.mjs → host-policy-B3jc4Rpn.mjs} +9 -2
  29. package/dist/{index-D6KsSE74.d.mts → index-a8e_oKnu.d.mts} +7 -5
  30. package/dist/index.d.mts +23 -7
  31. package/dist/index.mjs +7 -7
  32. package/dist/internal/anthropic.d.mts +6 -6
  33. package/dist/internal/anthropic.mjs +5 -5
  34. package/dist/internal/google-model-family.mjs +1 -1
  35. package/dist/internal/openai-completions-compat.d.mts +1 -1
  36. package/dist/internal/openai-completions-compat.mjs +1 -1
  37. package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
  38. package/dist/internal/openai-responses-payload-policy.mjs +2 -2
  39. package/dist/internal/openai.d.mts +14 -10
  40. package/dist/internal/openai.mjs +12 -12
  41. package/dist/internal/runtime.d.mts +18 -9
  42. package/dist/internal/runtime.mjs +9 -9
  43. package/dist/internal/shared.d.mts +6 -4
  44. package/dist/internal/shared.mjs +6 -6
  45. package/dist/internal/tool-schema.mjs +1 -1
  46. package/dist/json-schema-Bp07Qui3.mjs +22 -0
  47. package/dist/{llm-request-activity-BjtkplhG.mjs → llm-request-activity-D8f_oxHj.mjs} +1 -2
  48. package/dist/{mistral-7wDWcjfF.mjs → mistral-DSt4vQAO.mjs} +18 -29
  49. package/dist/number-coercion-V8-BhME4.mjs +47 -0
  50. package/dist/{openai-chatgpt-responses-Bc7NZrQR.mjs → openai-chatgpt-responses-BC2x0Oqx.mjs} +215 -164
  51. package/dist/openai-completions-DNyHnXKg.mjs +25 -0
  52. package/dist/{openai-completions-compat-qJjmqQ71.d.mts → openai-completions-compat-BYdYpXhU.d.mts} +3 -3
  53. package/dist/{openai-completions-compat-BJf57ZxN.mjs → openai-completions-compat-BdmlhD4u.mjs} +30 -23
  54. package/dist/{openai-completions-stream-dju_5F3P.mjs → openai-completions-transport-DWM2mQDB.mjs} +389 -76
  55. package/dist/{openai-prompt-cache-CouErLh7.d.mts → openai-prompt-cache-45-AH_xv.d.mts} +2 -2
  56. package/dist/{openai-prompt-cache-BTMs80_O.mjs → openai-prompt-cache-I8YQTzf8.mjs} +1 -1
  57. package/dist/{openai-responses-compaction-replay-DiYn-gFM.d.mts → openai-responses-compaction-replay-BClApUIf.d.mts} +4 -4
  58. package/dist/{openai-responses-compaction-window-CYGCjAQz.mjs → openai-responses-compaction-window-m878aVpU.mjs} +25 -83
  59. package/dist/{openai-reasoning-effort-C_0p3psG.mjs → openai-responses-contracts-BKu8O7l4.mjs} +103 -4
  60. package/dist/{openai-responses-contracts-D1iZ0njF.d.mts → openai-responses-contracts-Br5IIw_h.d.mts} +16 -5
  61. package/dist/openai-responses-prompt-observer-internal-CCg7B6l4.mjs +32 -0
  62. package/dist/{openai-responses-shared-CIEHiKx7.mjs → openai-responses-shared-C7oVyjED.mjs} +297 -312
  63. package/dist/{openai-responses-terminal-usage-BE7lf7nW.d.mts → openai-responses-terminal-usage-DgImcyJu.d.mts} +2 -2
  64. package/dist/{openai-responses-DbPe3-Py.mjs → openai-responses-uZ5oWSp7.mjs} +12 -21
  65. package/dist/{openai-tool-schema-vsl-cE-n.mjs → openai-tool-schema-DYNePiF8.mjs} +66 -36
  66. package/dist/{openai-transport-params-DyFJ4cgR.mjs → openai-transport-params-JFsnIyto.mjs} +25 -30
  67. package/dist/openai-web-search-tools-Cfu0uLyN.mjs +14 -0
  68. package/dist/{positive-integer-CjN5OJbH.mjs → positive-integer-CwLi8LUL.mjs} +1 -1
  69. package/dist/{provider-error-CwT_j2v0.mjs → provider-error-DQBE1bUQ.mjs} +17 -28
  70. package/dist/{provider-options-Df7ov0K1.d.mts → provider-options-D5ABCV_l.d.mts} +2 -2
  71. package/dist/{provider-replay-context-Bs5aWE1d.mjs → provider-replay-context-C7Bmi84a.mjs} +6 -2
  72. package/dist/{provider-transport-turn-state-Dw7OtYUs.mjs → provider-transport-turn-state-_M2kLdUE.mjs} +25 -3
  73. package/dist/{provider-types-d4XnoZMd.d.mts → provider-types-F8Mqc9Ma.d.mts} +3 -3
  74. package/dist/provider-types.d.mts +6 -6
  75. package/dist/providers.d.mts +2 -2
  76. package/dist/providers.mjs +14 -26
  77. package/dist/{reasoning-tag-text-partitioner-B6FIIBt6.mjs → reasoning-tag-text-partitioner-Ju9VpUGl.mjs} +23 -37
  78. package/dist/required-api-key-D4kn3252.mjs +9 -0
  79. package/dist/sanitize-unicode-CjDG6jJx.d.mts +5 -0
  80. package/dist/{session-affinity-Bcunsn4I.mjs → session-affinity-DA4WHv1h.mjs} +2 -6
  81. package/dist/session-resources-D1wgDQ8C.mjs +40 -0
  82. package/dist/{simple-options-BkDPMuxw.mjs → simple-options-BkKTXxhp.mjs} +7 -11
  83. package/dist/{src-H4aXcFuX.mjs → src-B0NIt2UK.mjs} +7 -4
  84. package/dist/stream-DSdzKsDK.mjs +275 -0
  85. package/dist/{stream-first-event-timeout-B9o0S4SZ.mjs → stream-first-event-timeout-D9ZmL_s9.mjs} +3 -3
  86. package/dist/{string-coerce-fsri9iCu.mjs → string-coerce-CtgOVOSv.mjs} +5 -1
  87. package/dist/{string-normalization-J9ZiLfGO.mjs → string-normalization-PN10hf6d.mjs} +1 -1
  88. package/dist/{transport-utils-CqXzku3R.mjs → text-signature-MLwfi6fq.mjs} +18 -18
  89. package/dist/{transport-stream-shared-yYhXa4kX.d.mts → transport-stream-shared-BcAKh2XH.d.mts} +6 -19
  90. package/dist/{transport-stream-shared-BU5pwY6W.mjs → transport-stream-shared-CxXXz_Dd.mjs} +171 -56
  91. package/dist/transports.d.mts +22 -23
  92. package/dist/transports.mjs +251 -495
  93. package/dist/types-BuiEBM3u.d.mts +1 -0
  94. package/dist/types-CQc6JNG4.mjs +69 -0
  95. package/dist/{types-CLLR3eB4.d.mts → types-DvzmWW8J.d.mts} +58 -6
  96. package/dist/types.d.mts +6 -6
  97. package/dist/types.mjs +5 -5
  98. package/dist/usage-CJH5D6Ea.mjs +19 -0
  99. package/dist/{validation-Cat2wQsc.d.mts → validation-B3lQt_VE.d.mts} +1 -1
  100. package/dist/{validation-BFZc40Ig.mjs → validation-DbqlIfDn.mjs} +15 -30
  101. package/dist/validation.d.mts +1 -1
  102. package/dist/validation.mjs +1 -1
  103. package/package.json +4 -4
  104. package/dist/cache-retention-0x979a5V.mjs +0 -12
  105. package/dist/event-stream-CMQfX_yr.d.mts +0 -1
  106. package/dist/github-copilot-headers-B37TB3rB.mjs +0 -30
  107. package/dist/openai-completions-CHnwIV-W.mjs +0 -188
  108. package/dist/openai-provider-client-G8Otsq2Q.mjs +0 -24
  109. package/dist/openai-responses-contracts-CLxnqS9p.mjs +0 -81
  110. package/dist/openai-responses-prompt-observer-internal-BX3QTNSv.mjs +0 -198
  111. package/dist/sanitize-unicode-BZiVbGwK.d.mts +0 -24
  112. package/dist/session-resources-CkR4WWy1.mjs +0 -21
  113. package/dist/stream-DDsCBgd-.mjs +0 -68
  114. package/dist/types-CB-_vNyI.d.mts +0 -1
  115. package/dist/types-LFWwv0cF.mjs +0 -8
@@ -1,5 +1,5 @@
1
- import { K as StopReason, a as AssistantMessage, ot as Usage } from "./types-CLLR3eB4.mjs";
2
- import "./types-CB-_vNyI.mjs";
1
+ import { $ as StopReason, a as AssistantMessage, pt as Usage } from "./types-DvzmWW8J.mjs";
2
+ import "./types-BuiEBM3u.mjs";
3
3
  import OpenAI from "openai";
4
4
  //#region packages/ai/src/providers/openai-responses-terminal-usage.d.ts
5
5
  /** A known output ceiling can resume sampling after admitted tools have settled. */
@@ -1,16 +1,15 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
3
- import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BTMs80_O.mjs";
4
- import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-BJf57ZxN.mjs";
5
- import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
6
- import { n as buildBaseOptions } from "./simple-options-BkDPMuxw.mjs";
7
- import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-DyFJ4cgR.mjs";
2
+ import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
3
+ import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-I8YQTzf8.mjs";
4
+ import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-BdmlhD4u.mjs";
5
+ import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
6
+ import { n as buildBaseOptions } from "./simple-options-BkKTXxhp.mjs";
7
+ import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-JFsnIyto.mjs";
8
8
  import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
9
- import { n as createAssistantOutput } from "./provider-transcript-transform-DjA5Fk2P.mjs";
10
- import { n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-Dw7OtYUs.mjs";
11
- import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-CIEHiKx7.mjs";
12
- import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-B37TB3rB.mjs";
13
- import { t as createOpenAIProviderClient } from "./openai-provider-client-G8Otsq2Q.mjs";
9
+ import { t as createAssistantOutput } from "./assistant-output-OLm-Oln0.mjs";
10
+ import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-_M2kLdUE.mjs";
11
+ import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-C7oVyjED.mjs";
12
+ import { t as requireApiKey } from "./required-api-key-D4kn3252.mjs";
14
13
  //#region packages/ai/src/providers/openai-responses.ts
15
14
  var openai_responses_exports = /* @__PURE__ */ __exportAll({
16
15
  streamOpenAIResponses: () => streamOpenAIResponses,
@@ -45,8 +44,7 @@ const streamOpenAIResponses = (model, context, options) => {
45
44
  return stream;
46
45
  };
47
46
  const streamSimpleOpenAIResponses = (model, context, options) => {
48
- const apiKey = options?.apiKey || getEnvApiKey(model.provider);
49
- if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
47
+ const apiKey = requireApiKey(model.provider, options?.apiKey);
50
48
  const base = buildBaseOptions(model, options, apiKey);
51
49
  const replayOptions = options;
52
50
  return streamOpenAIResponses(model, context, {
@@ -60,14 +58,7 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId) {
60
58
  if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
61
59
  const compat = getCompat(model);
62
60
  const headers = { ...model.headers };
63
- if (model.provider === "github-copilot") {
64
- const hasImages = hasCopilotVisionInput(context.messages);
65
- const copilotHeaders = buildCopilotDynamicHeaders({
66
- messages: context.messages,
67
- hasImages
68
- });
69
- Object.assign(headers, copilotHeaders);
70
- }
61
+ if (model.provider === "github-copilot") Object.assign(headers, buildCopilotDynamicHeaders(context.messages));
71
62
  if (sessionId) {
72
63
  if (compat.sendSessionIdHeader) headers.session_id = sessionId;
73
64
  headers["x-client-request-id"] = sessionId;
@@ -1,6 +1,7 @@
1
1
  import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
2
- import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
3
- import { i as uniqueValues, t as normalizeStringEntries } from "./string-normalization-J9ZiLfGO.mjs";
2
+ import { t as parseLocalSchemaRefPointer } from "./json-schema-Bp07Qui3.mjs";
3
+ import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
4
+ import { i as uniqueValues, t as normalizeStringEntries } from "./string-normalization-PN10hf6d.mjs";
4
5
  import { a as SCHEMA_OBJECT_KEYS$1, i as SCHEMA_MAP_KEYS$1, o as evaluateSchemaWalk, r as SCHEMA_ARRAY_KEYS$1 } from "./tool-schema-json-projection-Ct8SeBeJ.mjs";
5
6
  //#region packages/ai/src/providers/clean-for-gemini.ts
6
7
  const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
@@ -91,15 +92,11 @@ function extendSchemaDefs$1(defs, schema) {
91
92
  if (legacyDefsEntry) for (const [key, value] of Object.entries(legacyDefsEntry)) next.set(key, value);
92
93
  return next;
93
94
  }
94
- function decodeJsonPointerSegment$1(segment) {
95
- return segment.replaceAll("~1", "/").replaceAll("~0", "~");
96
- }
97
95
  function tryResolveLocalRef$1(ref, defs) {
98
96
  if (!defs) return;
99
- const match = ref.match(/^#\/(?:\$defs|definitions)\/(.+)$/);
100
- if (!match) return;
101
- const name = decodeJsonPointerSegment$1(match[1] ?? "");
102
- if (!name) return;
97
+ const tokens = parseLocalSchemaRefPointer(ref);
98
+ const [table, name] = tokens ?? [];
99
+ if (tokens?.length !== 2 || table !== "$defs" && table !== "definitions" || !name) return;
103
100
  return defs.get(name);
104
101
  }
105
102
  function simplifyUnionVariants(params) {
@@ -309,14 +306,10 @@ function extendSchemaDefs(defs, schema) {
309
306
  if (legacyDefsEntry) for (const [key, value] of Object.entries(legacyDefsEntry)) next.definitions.set(key, value);
310
307
  return next;
311
308
  }
312
- function decodeJsonPointerSegment(segment) {
313
- return segment.replaceAll("~1", "/").replaceAll("~0", "~");
314
- }
315
- function resolveJsonPointerPath(value, segments) {
309
+ function resolveJsonPointerPath(value, tokens) {
316
310
  let current = value;
317
- for (const segment of segments) {
311
+ for (const key of tokens) {
318
312
  if (!current || typeof current !== "object") return;
319
- const key = decodeJsonPointerSegment(segment);
320
313
  if (Array.isArray(current)) {
321
314
  const index = /^(?:0|[1-9]\d*)$/.test(key) ? Number(key) : -1;
322
315
  if (index < 0 || index >= current.length) return;
@@ -329,8 +322,8 @@ function resolveJsonPointerPath(value, segments) {
329
322
  return current;
330
323
  }
331
324
  function resolveLocalJsonPointer(rootDocument, ref) {
332
- if (!ref.startsWith("#/")) return;
333
- return resolveJsonPointerPath(rootDocument, ref.slice(2).split("/"));
325
+ const tokens = parseLocalSchemaRefPointer(ref);
326
+ return tokens ? resolveJsonPointerPath(rootDocument, tokens) : void 0;
334
327
  }
335
328
  const SCHEMA_MAP_KEYS = /* @__PURE__ */ new Set([
336
329
  "$defs",
@@ -363,14 +356,14 @@ const SCHEMA_LITERAL_KEYS = /* @__PURE__ */ new Set([
363
356
  "examples"
364
357
  ]);
365
358
  function tryResolveLocalRef(ref, defs, rootDocument) {
366
- const match = ref.match(/^#\/(\$defs|definitions)\/([^/]+)(?:\/(.*))?$/);
367
- if (match && defs) {
368
- const namespace = match[1] === "$defs" ? defs.$defs : defs.definitions;
369
- const name = decodeJsonPointerSegment(match[2] ?? "");
370
- const resolved = name ? namespace.get(name) : void 0;
371
- if (resolved !== void 0) return resolveJsonPointerPath(resolved, match[3] ? match[3].split("/") : []);
359
+ const tokens = parseLocalSchemaRefPointer(ref);
360
+ if (!tokens) return;
361
+ const [table, name, ...remainingPath] = tokens;
362
+ if (defs && name && (table === "$defs" || table === "definitions")) {
363
+ const resolved = (table === "$defs" ? defs.$defs : defs.definitions).get(name);
364
+ if (resolved !== void 0) return resolveJsonPointerPath(resolved, remainingPath);
372
365
  }
373
- return resolveLocalJsonPointer(rootDocument, ref);
366
+ return resolveJsonPointerPath(rootDocument, tokens);
374
367
  }
375
368
  function inlineLocalSchemaRefsWithDefs(schema, defs, refStack, state, rootDocument) {
376
369
  if (Array.isArray(schema)) return schema.map((entry) => inlineLocalSchemaRefsWithDefs(entry, defs, refStack, state, rootDocument));
@@ -382,7 +375,7 @@ function inlineLocalSchemaRefsWithDefs(schema, defs, refStack, state, rootDocume
382
375
  if (refStack?.has(refValue)) return {};
383
376
  const resolved = tryResolveLocalRef(refValue, nextDefs, rootDocument);
384
377
  if (resolved === void 0) {
385
- if (refValue.startsWith("#/")) state.unresolvedLocalRefs = true;
378
+ if (refValue.startsWith("#/") || parseLocalSchemaRefPointer(refValue)) state.unresolvedLocalRefs = true;
386
379
  return { ...obj };
387
380
  }
388
381
  const nextRefStack = refStack ? new Set(refStack) : /* @__PURE__ */ new Set();
@@ -656,20 +649,32 @@ function resolveToolParameterSchemaCacheKey(options) {
656
649
  function isGeminiModelId(modelId) {
657
650
  return /(?:^|[/:])gemini(?:$|[-/:.])/.test(modelId);
658
651
  }
659
- function extractEnumValues(schema) {
652
+ function extractEnumValues(schema, requireAllVariants = false) {
660
653
  if (!schema || typeof schema !== "object") return;
661
654
  const record = schema;
662
655
  if (Array.isArray(record.enum)) return record.enum;
663
656
  if ("const" in record) return [record.const];
664
657
  const variants = Array.isArray(record.anyOf) ? record.anyOf : Array.isArray(record.oneOf) ? record.oneOf : null;
665
658
  if (variants) {
659
+ let complete = true;
666
660
  const values = variants.flatMap((variant) => {
667
- return extractEnumValues(variant) ?? [];
661
+ const extracted = extractEnumValues(variant, requireAllVariants);
662
+ complete &&= extracted !== void 0;
663
+ return extracted ?? [];
668
664
  });
669
- return values.length > 0 ? values : void 0;
665
+ return (!requireAllVariants || complete) && values.length > 0 ? values : void 0;
670
666
  }
671
667
  }
672
- function mergePropertySchemas(existing, incoming) {
668
+ function isUnconstrainedStringSchema(schema) {
669
+ return isRecord(schema) && schema.type === "string" && Object.keys(schema).every((key) => [
670
+ "type",
671
+ "title",
672
+ "description",
673
+ "default",
674
+ "examples"
675
+ ].includes(key));
676
+ }
677
+ function mergePropertySchemas(existing, incoming, allowUnconstrainedString) {
673
678
  if (!existing) return incoming;
674
679
  if (!incoming) return existing;
675
680
  const existingEnum = extractEnumValues(existing);
@@ -686,6 +691,16 @@ function mergePropertySchemas(existing, incoming) {
686
691
  "default"
687
692
  ]) if (!(key in merged) && key in record) merged[key] = record[key];
688
693
  }
694
+ if (allowUnconstrainedString) {
695
+ if (existingEnum?.every((value) => typeof value === "string") && isUnconstrainedStringSchema(incoming)) return {
696
+ ...incoming,
697
+ ...merged
698
+ };
699
+ if (incomingEnum?.every((value) => typeof value === "string") && isUnconstrainedStringSchema(existing)) return {
700
+ ...existing,
701
+ ...merged
702
+ };
703
+ }
689
704
  const types = new Set(values.map((value) => typeof value));
690
705
  if (types.size === 1) merged.type = Array.from(types)[0];
691
706
  merged.enum = values;
@@ -869,7 +884,9 @@ function normalizeToolParameterSchemaUncached(schema, options) {
869
884
  properties: {}
870
885
  } : inlinedSchema);
871
886
  const variants = schemaRecord[flattenableVariantKey];
872
- const mergedProperties = isRecord(schemaRecord.properties) ? { ...schemaRecord.properties } : {};
887
+ const rootProperties = isRecord(schemaRecord.properties) ? schemaRecord.properties : {};
888
+ const mergedProperties = { ...rootProperties };
889
+ const propertyAlternatives = /* @__PURE__ */ new Map();
873
890
  const requiredCounts = /* @__PURE__ */ new Map();
874
891
  let objectVariants = 0;
875
892
  for (const entry of variants) {
@@ -877,13 +894,23 @@ function normalizeToolParameterSchemaUncached(schema, options) {
877
894
  const props = entry.properties;
878
895
  if (!props || typeof props !== "object") continue;
879
896
  objectVariants += 1;
880
- for (const [key, value] of Object.entries(props)) setOwnSchemaProperty(mergedProperties, key, mergePropertySchemas(Object.hasOwn(mergedProperties, key) ? mergedProperties[key] : void 0, value));
897
+ for (const [key, value] of Object.entries(props)) {
898
+ const alternatives = propertyAlternatives.get(key);
899
+ if (alternatives) alternatives.push(value);
900
+ else propertyAlternatives.set(key, [value]);
901
+ }
881
902
  const required = Array.isArray(entry.required) ? entry.required : [];
882
903
  for (const key of required) {
883
904
  if (typeof key !== "string") continue;
884
905
  requiredCounts.set(key, (requiredCounts.get(key) ?? 0) + 1);
885
906
  }
886
907
  }
908
+ for (const [key, alternatives] of propertyAlternatives) {
909
+ const allowUnconstrainedString = !Object.hasOwn(rootProperties, key) && alternatives.every((alternative) => isUnconstrainedStringSchema(alternative) || extractEnumValues(alternative, true)?.every((value) => typeof value === "string") === true);
910
+ let merged = Object.hasOwn(mergedProperties, key) ? mergedProperties[key] : void 0;
911
+ for (const alternative of alternatives) merged = mergePropertySchemas(merged, alternative, allowUnconstrainedString);
912
+ setOwnSchemaProperty(mergedProperties, key, merged);
913
+ }
887
914
  const baseRequired = Array.isArray(schemaRecord.required) ? schemaRecord.required.filter((key) => typeof key === "string") : void 0;
888
915
  const mergedRequired = baseRequired && baseRequired.length > 0 ? baseRequired : objectVariants > 0 ? Array.from(requiredCounts.entries()).filter(([, count]) => count === objectVariants).map(([key]) => key) : void 0;
889
916
  return applyProviderCleaning({
@@ -1037,11 +1064,14 @@ function resolveStrictOpenAISchemaCacheKey(modelCompat) {
1037
1064
  /** Normalizes a tool parameter schema into the OpenAI strict JSON-schema subset. */
1038
1065
  function normalizeStrictOpenAIJsonSchema(schema, modelCompat) {
1039
1066
  const schemaInput = schema ?? {};
1040
- if (!schemaInput || typeof schemaInput !== "object") return normalizeStrictOpenAIJsonSchemaRecursive(normalizeToolParameterSchema(schemaInput, { modelCompat: resolveToolSchemaModelCompat(modelCompat) }), 0);
1041
- const cacheKey = resolveStrictOpenAISchemaCacheKey(modelCompat);
1042
- const cached = strictOpenAISchemaCache.get(schemaInput, cacheKey);
1043
- if (cached !== void 0) return cached;
1044
- return strictOpenAISchemaCache.remember(schemaInput, cacheKey, normalizeStrictOpenAIJsonSchemaRecursive(normalizeToolParameterSchema(schemaInput, { modelCompat: resolveToolSchemaModelCompat(modelCompat) }), 0));
1067
+ const cacheable = typeof schemaInput === "object";
1068
+ const cacheKey = cacheable ? resolveStrictOpenAISchemaCacheKey(modelCompat) : "";
1069
+ if (cacheable) {
1070
+ const cached = strictOpenAISchemaCache.get(schemaInput, cacheKey);
1071
+ if (cached !== void 0) return cached;
1072
+ }
1073
+ const normalized = normalizeStrictOpenAIJsonSchemaRecursive(normalizeToolParameterSchema(schemaInput, { modelCompat: resolveToolSchemaModelCompat(modelCompat) }), 0);
1074
+ return cacheable ? strictOpenAISchemaCache.remember(schemaInput, cacheKey, normalized) : normalized;
1045
1075
  }
1046
1076
  function normalizeStrictOpenAIJsonSchemaRecursive(schema, depth) {
1047
1077
  if (Array.isArray(schema)) {
@@ -1,16 +1,15 @@
1
1
  import { o as isRecord, r as asOptionalObjectRecord } from "./record-coerce-CNDovvft.mjs";
2
- import { C as applyProviderReportedUsageCost, S as headersToRecord, T as clampThinkingLevel, n as getAiTransportHost, w as calculateCost } from "./host-DwBmNMCC.mjs";
3
- import { a as normalizeOptionalString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
4
- import { a as normalizeOpenAIReasoningEffort, c as resolveOpenAIReasoningEffortMapping, f as MODEL_CATALOG_THINKING_LEVELS, m as resolveOpenAIThinkingApi, o as resolveOpenAIModelReasoningEfforts, s as resolveOpenAIReasoningEffortForModel, u as supportsOpenAIReasoningEffort } from "./openai-reasoning-effort-C_0p3psG.mjs";
5
- import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-BTMs80_O.mjs";
6
- import { i as isCodeModeModelVisibleToolName } from "./transport-utils-CqXzku3R.mjs";
7
- import { i as resolveOpenAICompletionsCompat, o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-BJf57ZxN.mjs";
8
- import { n as resolveModelRequestTimeoutMs } from "./host-policy-wK-ay_RK.mjs";
9
- import { m as notifyProviderHttpResponse } from "./transport-stream-shared-BU5pwY6W.mjs";
2
+ import { a as normalizeOptionalString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
3
+ import { D as applyProviderReportedUsageCost, E as headersToRecord, O as calculateCost, k as clampThinkingLevel, r as getAiTransportHost } from "./host-DCW52iHe.mjs";
4
+ import { A as resolveOpenAIThinkingApi, C as resolveOpenAIReasoningEffortForModel, E as supportsOpenAIReasoningEffort, O as MODEL_CATALOG_THINKING_LEVELS, S as resolveOpenAIModelReasoningEfforts, i as OPENAI_RESPONSES_APIS, w as resolveOpenAIReasoningEffortMapping, x as normalizeOpenAIReasoningEffort } from "./openai-responses-contracts-BKu8O7l4.mjs";
5
+ import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-I8YQTzf8.mjs";
6
+ import { i as isCodeModeModelVisibleToolName } from "./text-signature-MLwfi6fq.mjs";
7
+ import { i as resolveOpenAICompletionsCompat, o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-BdmlhD4u.mjs";
8
+ import { r as resolveModelRequestTimeoutMs } from "./host-policy-B3jc4Rpn.mjs";
9
+ import { m as notifyProviderHttpResponse } from "./transport-stream-shared-CxXXz_Dd.mjs";
10
10
  import { n as projectRuntimeToolInputSchema, t as prepareRuntimeToolInputSchema } from "./tool-schema-json-projection-Ct8SeBeJ.mjs";
11
- import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Bcunsn4I.mjs";
12
- import { a as resolveOpenAIProjectedToolsStrictToolFlag, t as findOpenAIStrictToolProjectionDiagnostics } from "./openai-tool-schema-vsl-cE-n.mjs";
13
- import { i as OPENAI_RESPONSES_APIS } from "./openai-responses-contracts-CLxnqS9p.mjs";
11
+ import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
12
+ import { a as resolveOpenAIProjectedToolsStrictToolFlag, t as findOpenAIStrictToolProjectionDiagnostics } from "./openai-tool-schema-DYNePiF8.mjs";
14
13
  import { hash } from "node:crypto";
15
14
  //#region packages/normalization-core/src/node-crypto.ts
16
15
  function sha256Hex(input) {
@@ -28,7 +27,6 @@ function redactIdentifier(value, opts) {
28
27
  }
29
28
  //#endregion
30
29
  //#region packages/ai/src/transports/openai-transport-shared.ts
31
- /** Shared options, usage shape, cache identity, and ordering for OpenAI APIs. */
32
30
  const OPENAI_RESPONSE_MODEL_HEADER_NAMES = /* @__PURE__ */ new Set(["openai-model", "x-openai-model"]);
33
31
  const OPENAI_RESPONSE_MODEL_EVENT_TYPES = /* @__PURE__ */ new Set([
34
32
  "response.created",
@@ -122,12 +120,7 @@ function resolveOpenAIClientBaseUrl(model, baseUrl = model.baseUrl) {
122
120
  if (model.provider.trim().toLowerCase() === "openai") return;
123
121
  throw new Error(`Provider "${model.provider}" requires an explicit base URL before using an OpenAI-compatible API. Reload provider metadata or configure an endpoint.`);
124
122
  }
125
- const EMPTY_OPENAI_COMPLETIONS_REASONING_BATCH = {
126
- deltas: [],
127
- mirroredThinking: [],
128
- hasThinking: false,
129
- hasVisibleText: false
130
- };
123
+ const EMPTY_OPENAI_COMPLETIONS_REASONING_BATCH = createOpenAICompletionsReasoningBatch();
131
124
  const OPENAI_COMPLETIONS_REASONING_FIELDS = [
132
125
  "reasoning_content",
133
126
  "reasoning",
@@ -137,22 +130,13 @@ function appendOpenAICompletionsReasoningDelta(batch, next) {
137
130
  if (next.kind === "thinking") batch.hasThinking = true;
138
131
  else batch.hasVisibleText = true;
139
132
  const previous = batch.deltas[batch.deltas.length - 1];
140
- if (!previous || previous.kind !== next.kind) {
133
+ if (!previous || previous.kind !== next.kind || next.kind === "thinking" && previous.kind === "thinking" && previous.signature !== next.signature) {
141
134
  batch.deltas.push(next);
142
135
  if (next.kind === "thinking") batch.mirroredThinking.push(next.text);
143
136
  return;
144
137
  }
145
- if (next.kind === "thinking" && previous.kind === "thinking") {
146
- if (previous.signature !== next.signature) {
147
- batch.deltas.push(next);
148
- batch.mirroredThinking.push(next.text);
149
- return;
150
- }
151
- previous.text += next.text;
152
- batch.mirroredThinking[batch.mirroredThinking.length - 1] += next.text;
153
- return;
154
- }
155
138
  previous.text += next.text;
139
+ if (next.kind === "thinking") batch.mirroredThinking[batch.mirroredThinking.length - 1] += next.text;
156
140
  }
157
141
  function createOpenAICompletionsReasoningBatch() {
158
142
  return {
@@ -209,12 +193,24 @@ function parseOpenAICompletionsUsage(rawUsage, model, options) {
209
193
  const input = Math.max(0, (rawUsage.prompt_tokens || 0) - cacheRead - cacheWrite);
210
194
  const output = rawUsage.completion_tokens || 0;
211
195
  const reasoningTokens = rawUsage.completion_tokens_details?.reasoning_tokens;
196
+ const hasCoherentContext = [
197
+ rawUsage.prompt_tokens,
198
+ rawUsage.completion_tokens,
199
+ rawUsage.total_tokens,
200
+ cacheRead,
201
+ cacheWrite
202
+ ].every((value) => typeof value === "number" && Number.isFinite(value) && value >= 0) && rawUsage.prompt_tokens >= cacheRead + cacheWrite && rawUsage.total_tokens >= rawUsage.prompt_tokens + rawUsage.completion_tokens;
212
203
  const usage = {
213
204
  input,
214
205
  output,
215
206
  cacheRead,
216
207
  cacheWrite,
217
208
  ...options?.includeReasoningTokens !== false && typeof reasoningTokens === "number" && Number.isFinite(reasoningTokens) ? { reasoningTokens } : {},
209
+ contextUsage: hasCoherentContext ? {
210
+ state: "available",
211
+ promptTokens: rawUsage.prompt_tokens,
212
+ totalTokens: Math.max(input + output + cacheRead + cacheWrite, rawUsage.total_tokens)
213
+ } : { state: "unavailable" },
218
214
  totalTokens: input + output + cacheRead + cacheWrite,
219
215
  cost: {
220
216
  input: 0,
@@ -728,7 +724,6 @@ function getCompat(model) {
728
724
  const compat = model.compat ?? {};
729
725
  return {
730
726
  ...resolved,
731
- cacheControlFormat: resolved.cacheControlFormat,
732
727
  reasoningEffortMap: resolveOpenAIReasoningEffortMap(model, {}),
733
728
  openRouterRouting: resolved.openRouterRouting ?? {},
734
729
  vercelGatewayRouting: resolved.vercelGatewayRouting,
@@ -0,0 +1,14 @@
1
+ import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
2
+ //#region packages/ai/src/providers/openai-web-search-tools.ts
3
+ function hasResponsesWebSearchTool(tools) {
4
+ if (!Array.isArray(tools)) return false;
5
+ return tools.some((tool) => {
6
+ if (!isRecord(tool)) return false;
7
+ if (tool.type === "web_search") return true;
8
+ if (tool.type === "function" && tool.name === "web_search") return true;
9
+ const fn = tool.function;
10
+ return isRecord(fn) && fn.name === "web_search";
11
+ });
12
+ }
13
+ //#endregion
14
+ export { hasResponsesWebSearchTool as t };
@@ -1,4 +1,4 @@
1
- import { o as parseStrictPositiveInteger } from "./base64-C1PsYcRQ.mjs";
1
+ import { o as parseStrictPositiveInteger } from "./number-coercion-V8-BhME4.mjs";
2
2
  //#region packages/ai/src/transports/positive-integer.ts
3
3
  function parsePositiveInteger(value) {
4
4
  if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
@@ -1,8 +1,9 @@
1
1
  import { i as asOptionalRecord } from "./record-coerce-CNDovvft.mjs";
2
- import { o as normalizeStringifiedOptionalString } from "./string-coerce-fsri9iCu.mjs";
2
+ import { o as normalizeStringifiedOptionalString } from "./string-coerce-CtgOVOSv.mjs";
3
+ import "./number-coercion-V8-BhME4.mjs";
3
4
  import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
4
- import { n as estimateBase64DecodedBytes } from "./base64-C1PsYcRQ.mjs";
5
5
  import { parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
6
+ import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
6
7
  //#region packages/normalization-core/src/balanced-json.ts
7
8
  function isJsonOpeningDelimiter(char, openers) {
8
9
  return (char === "{" || char === "[") && openers.includes(char);
@@ -143,42 +144,30 @@ function stringifyObjectValue(value, stack, normalizeString, write) {
143
144
  return `[${serializedEntries.join(",")}]`;
144
145
  }
145
146
  const record = value;
146
- if (normalizeString === preserveString) {
147
- const fields = Object.keys(record).sort();
148
- if (write) {
149
- write("{");
150
- let separator = "";
151
- for (const key of fields) {
152
- write(`${separator}${JSON.stringify(key)}:`);
153
- write(stringifyStableValue(record[key], stack, normalizeString, write));
154
- separator = ",";
155
- }
156
- write("}");
157
- return "";
158
- }
159
- let fieldIndex = 0;
160
- for (const key of fields) fields[fieldIndex++] = `${JSON.stringify(key)}:${stringifyStableValue(record[key], stack, normalizeString)}`;
161
- return `{${fields.join(",")}}`;
162
- }
163
- const entries = Object.keys(record).map((key) => ({
147
+ const keys = Object.keys(record);
148
+ const fields = normalizeString === preserveString ? keys.sort() : keys.map((key) => ({
164
149
  key,
165
150
  normalizedKey: normalizeString(key)
166
151
  })).sort((left, right) => {
167
152
  return compareStableStrings(left.normalizedKey, right.normalizedKey) || compareStableStrings(left.key, right.key);
168
153
  });
169
- const serializedFields = [];
170
- if (write) {
171
- write("{");
172
- let separator = "";
173
- for (const { key, normalizedKey } of entries) {
174
- write(`${separator}${JSON.stringify(normalizedKey)}:`);
154
+ write?.("{");
155
+ const serializedFields = normalizeString === preserveString ? keys : [];
156
+ let separator = "";
157
+ let fieldIndex = 0;
158
+ for (const field of fields) {
159
+ const key = typeof field === "string" ? field : field.key;
160
+ const prefix = `${JSON.stringify(typeof field === "string" ? field : field.normalizedKey)}:`;
161
+ if (write) {
162
+ write(`${separator}${prefix}`);
175
163
  write(stringifyStableValue(record[key], stack, normalizeString, write));
176
164
  separator = ",";
177
- }
165
+ } else serializedFields[fieldIndex++] = `${prefix}${stringifyStableValue(record[key], stack, normalizeString)}`;
166
+ }
167
+ if (write) {
178
168
  write("}");
179
169
  return "";
180
170
  }
181
- for (const { key, normalizedKey } of entries) serializedFields.push(`${JSON.stringify(normalizedKey)}:${stringifyStableValue(record[key], stack, normalizeString)}`);
182
171
  return `{${serializedFields.join(",")}}`;
183
172
  }
184
173
  function encodeBase64(value) {
@@ -1,6 +1,6 @@
1
- import { Y as StreamOptions } from "./types-CLLR3eB4.mjs";
1
+ import { nt as StreamOptions } from "./types-DvzmWW8J.mjs";
2
2
  import { t as OpenAICompletionsToolChoice } from "./openai-tool-projection-793cE3QX.mjs";
3
- import "./types-CB-_vNyI.mjs";
3
+ import "./types-BuiEBM3u.mjs";
4
4
  import Anthropic from "@anthropic-ai/sdk";
5
5
  //#region packages/ai/src/providers/openai-reasoning-effort.d.ts
6
6
  declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
@@ -1,5 +1,9 @@
1
- import { A as shortHash } from "./transport-stream-shared-BU5pwY6W.mjs";
1
+ import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
2
+ import { A as shortHash } from "./transport-stream-shared-CxXXz_Dd.mjs";
2
3
  //#region packages/ai/src/transports/provider-replay-context.ts
4
+ function isProviderReplayContext(value) {
5
+ return isRecord(value) && typeof value.provider === "string" && typeof value.api === "string" && typeof value.model === "string" && (value.baseUrlHash === void 0 || typeof value.baseUrlHash === "string") && (value.sessionHash === void 0 || typeof value.sessionHash === "string") && (value.authProfileHash === void 0 || typeof value.authProfileHash === "string");
6
+ }
3
7
  function hashReplayContextValue(value) {
4
8
  const normalized = value?.trim();
5
9
  return normalized ? shortHash(normalized) : void 0;
@@ -18,4 +22,4 @@ function providerReplayContextMatches(state, context) {
18
22
  return state.provider === context.provider && state.api === context.api && state.model === context.model && state.baseUrlHash === context.baseUrlHash && state.sessionHash === context.sessionHash && state.authProfileHash === context.authProfileHash;
19
23
  }
20
24
  //#endregion
21
- export { providerReplayContextMatches as n, buildProviderReplayContext as t };
25
+ export { isProviderReplayContext as n, providerReplayContextMatches as r, buildProviderReplayContext as t };
@@ -1,6 +1,28 @@
1
- import { n as getAiTransportHost } from "./host-DwBmNMCC.mjs";
2
- import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-Bcunsn4I.mjs";
1
+ import { r as getAiTransportHost } from "./host-DCW52iHe.mjs";
2
+ import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-5qSGvIUH.mjs";
3
+ import { O as resolveOpenAIClientBaseUrl } from "./openai-transport-params-JFsnIyto.mjs";
4
+ import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
3
5
  import { randomUUID } from "node:crypto";
6
+ import OpenAI from "openai";
7
+ //#region packages/ai/src/providers/openai-provider-client.ts
8
+ function createOpenAIProviderClient(model, apiKey, headers, optionsHeaders) {
9
+ if (optionsHeaders) Object.assign(headers, optionsHeaders);
10
+ const defaultHeaders = model.provider === "cloudflare-ai-gateway" ? {
11
+ ...headers,
12
+ Authorization: headers.Authorization ?? null,
13
+ "cf-aig-authorization": `Bearer ${apiKey}`
14
+ } : headers;
15
+ const baseUrl = isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model) : model.baseUrl;
16
+ return new OpenAI({
17
+ apiKey,
18
+ baseURL: resolveOpenAIClientBaseUrl(model, baseUrl),
19
+ dangerouslyAllowBrowser: true,
20
+ defaultHeaders,
21
+ maxRetries: 0,
22
+ fetch: getAiTransportHost().buildModelFetch(model)
23
+ });
24
+ }
25
+ //#endregion
4
26
  //#region packages/ai/src/transports/provider-transport-turn-state.ts
5
27
  function resolveProviderTransportTurnState(model, params) {
6
28
  const normalizedProvider = model.provider.trim().toLowerCase();
@@ -39,4 +61,4 @@ function resolveProviderSimpleCompletionHeaders(model, options) {
39
61
  };
40
62
  }
41
63
  //#endregion
42
- export { resolveProviderSimpleCompletionHeaders as n, resolveProviderTransportTurnState as r, filterProviderTurnHeadersForExplicitOpencodeSession as t };
64
+ export { createOpenAIProviderClient as i, resolveProviderSimpleCompletionHeaders as n, resolveProviderTransportTurnState as r, filterProviderTurnHeadersForExplicitOpencodeSession as t };
@@ -1,6 +1,6 @@
1
- import { t as index_d_exports } from "./index-D6KsSE74.mjs";
2
- import { O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, f as ImageContent, it as ToolResultMessage, n as Api, s as AssistantMessageEventStreamContract, st as UserMessage } from "./types-CLLR3eB4.mjs";
3
- import "./types-CB-_vNyI.mjs";
1
+ import { t as index_d_exports } from "./index-a8e_oKnu.mjs";
2
+ import { a as AssistantMessage, d as Context, dt as ToolResultMessage, k as Model, mt as UserMessage, n as Api, nt as StreamOptions, p as ImageContent, rt as TextContent, s as AssistantMessageEventStreamContract } from "./types-DvzmWW8J.mjs";
3
+ import "./types-BuiEBM3u.mjs";
4
4
  //#region packages/ai/src/provider-types.d.ts
5
5
  declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
6
6
  type VideoContent = Omit<ImageContent, "type"> & {
@@ -1,6 +1,6 @@
1
- import { C as resolveClaudeSonnet5ModelIdentity, D as supportsClaudeNativeMaxEffort, E as supportsClaudeFastMode, O as supportsClaudeNativeXhighEffort, S as resolveClaudeSonnet55ModelIdentity, T as supportsClaudeAdaptiveThinking, _ as resolveClaudeModelIdentity, a as ProviderRefusalReview, b as resolveClaudeOpus55ModelIdentity, c as CLAUDE_OPUS_55_THINKING_PROFILE, d as CLAUDE_SONNET_5_THINKING_PROFILE, f as bindsClaudeThinkingPrefix, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as normalizeResolvedPricing, l as CLAUDE_OPUS_5_THINKING_PROFILE, m as requiresClaudeDefaultSampling, n as calculateUsageCost, o as readProviderRefusalReview, p as requiresClaudeBetweenToolsThinking, r as normalizeModelCostConfig, s as CLAUDE_FABLE_5_THINKING_PROFILE, u as CLAUDE_SONNET_55_THINKING_PROFILE, v as resolveClaudeMythos5ModelIdentity, w as supportsClaude1MContext, x as resolveClaudeOpus5ModelIdentity, y as resolveClaudeNativeThinkingLevelMap } from "./index-D6KsSE74.mjs";
2
- import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-CLLR3eB4.mjs";
3
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DOPFYVqs.mjs";
4
- import { n as validateToolCall, t as validateToolArguments } from "./validation-Cat2wQsc.mjs";
5
- import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-d4XnoZMd.mjs";
6
- export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RawModelCostConfig, type RawPricingTier, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type isProviderRefusalAssistantError, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
1
+ import { C as resolveClaudeSonnet5ModelIdentity, D as supportsClaudeInHistorySystemMessages, E as supportsClaudeFastMode, O as supportsClaudeNativeMaxEffort, S as resolveClaudeSonnet55ModelIdentity, T as supportsClaudeAdaptiveThinking, _ as resolveClaudeModelIdentity, a as ProviderRefusalReview, b as resolveClaudeOpus55ModelIdentity, c as CLAUDE_OPUS_55_THINKING_PROFILE, d as CLAUDE_SONNET_5_THINKING_PROFILE, f as bindsClaudeThinkingPrefix, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as normalizeResolvedPricing, k as supportsClaudeNativeXhighEffort, l as CLAUDE_OPUS_5_THINKING_PROFILE, m as requiresClaudeDefaultSampling, n as calculateUsageCost, o as readProviderRefusalReview, p as requiresClaudeBetweenToolsThinking, r as normalizeModelCostConfig, s as CLAUDE_FABLE_5_THINKING_PROFILE, u as CLAUDE_SONNET_55_THINKING_PROFILE, v as resolveClaudeMythos5ModelIdentity, w as supportsClaude1MContext, x as resolveClaudeOpus5ModelIdentity, y as resolveClaudeNativeThinkingLevelMap } from "./index-a8e_oKnu.mjs";
2
+ import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-DvzmWW8J.mjs";
3
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DrRM_90c.mjs";
4
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-B3lQt_VE.mjs";
5
+ import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-F8Mqc9Ma.mjs";
6
+ export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
@@ -1,5 +1,5 @@
1
- import { n as ApiRegistry } from "./api-registry-D-nbmSqr.mjs";
2
- import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CouErLh7.mjs";
1
+ import { n as ApiRegistry } from "./api-registry-DpU0Rj-I.mjs";
2
+ import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-45-AH_xv.mjs";
3
3
  //#region packages/ai/src/providers/register-builtins.d.ts
4
4
  /** Source id used for built-in API provider registrations. */
5
5
  export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";