@openclaw/ai 2026.9.4 → 2026.9.6

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 (101) hide show
  1. package/README.md +1 -1
  2. package/dist/{anthropic-C4Qu4H0Z.mjs → anthropic-DZQ_7gD1.mjs} +37 -38
  3. package/dist/{anthropic-payload-policy-BZ8umAbk.d.mts → anthropic-payload-policy-DyfwikYJ.d.mts} +4 -4
  4. package/dist/{anthropic-stream-reducer-CILWF7JD.mjs → anthropic-stream-reducer-D6ZI1wwj.mjs} +70 -50
  5. package/dist/{api-registry-ByUwIR0e.d.mts → api-registry-C2T3lTV7.d.mts} +2 -2
  6. package/dist/{assistant-output-tLt4H-iQ.mjs → assistant-output-DM1JBNs1.mjs} +1 -1
  7. package/dist/{azure-openai-responses-BAlqlKKc.mjs → azure-openai-responses-DS86GYzq.mjs} +6 -9
  8. package/dist/{base64-D-su8YVo.mjs → base64-CPmadnUf.mjs} +12 -12
  9. package/dist/credential-redaction-BKv49aiv.d.mts +24 -0
  10. package/dist/{diagnostics-QuErwCIl.mjs → diagnostics-CH8j2wIG.mjs} +139 -7
  11. package/dist/{diagnostics-CPeq9F7y.mjs → diagnostics-DzrF1h4J.mjs} +18 -1
  12. package/dist/diagnostics.d.mts +11 -24
  13. package/dist/diagnostics.mjs +4 -4
  14. package/dist/event-stream-C0nsgbj2.d.mts +1 -0
  15. package/dist/{event-stream-Bt5Y4Pav.d.mts → event-stream-CjnIZZst.d.mts} +1 -1
  16. package/dist/event-stream.d.mts +2 -2
  17. package/dist/expect-lbe3Hgrh.mjs +8 -0
  18. package/dist/{google-DPBAOaOW.mjs → google-BZJFjhuC.mjs} +6 -9
  19. package/dist/{google-messages-6JkpHrhJ.mjs → google-messages-DB7GKkDk.mjs} +3 -3
  20. package/dist/{google-shared-BvBeW9aq.mjs → google-shared-Bok4I6zB.mjs} +13 -13
  21. package/dist/{google-vertex-k-TMCAYD.mjs → google-vertex-3eVNR2qW.mjs} +5 -8
  22. package/dist/{host-4atIX-2V.d.mts → host-DH-Z-LDb.d.mts} +5 -3
  23. package/dist/{host-policy-Zcg_cNz8.mjs → host-policy-DZO3oPPk.mjs} +1 -1
  24. package/dist/{host-B8YfDGd4.mjs → host-yTvBrYM2.mjs} +63 -31
  25. package/dist/{index-DdD3qerf.d.mts → index-C25RT6bP.d.mts} +37 -14
  26. package/dist/index.d.mts +7 -8
  27. package/dist/index.mjs +5 -6
  28. package/dist/internal/anthropic.d.mts +13 -10
  29. package/dist/internal/anthropic.mjs +5 -5
  30. package/dist/internal/openai-completions-compat.d.mts +2 -0
  31. package/dist/internal/openai-completions-compat.mjs +2 -0
  32. package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
  33. package/dist/internal/openai-responses-payload-policy.mjs +2 -2
  34. package/dist/internal/openai.d.mts +24 -53
  35. package/dist/internal/openai.mjs +12 -9
  36. package/dist/internal/runtime.d.mts +6 -8
  37. package/dist/internal/runtime.mjs +6 -10
  38. package/dist/internal/shared.d.mts +7 -5
  39. package/dist/internal/shared.mjs +4 -3
  40. package/dist/internal/tool-schema.d.mts +4 -4
  41. package/dist/internal/tool-schema.mjs +2 -2
  42. package/dist/{mistral-CxUZ1jUb.mjs → mistral-C_13dVBn.mjs} +9 -13
  43. package/dist/{model-transport-url-DKocrEsb.d.mts → model-transport-url-C5f59L3Y.d.mts} +1 -1
  44. package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-sTxPl4zM.mjs} +150 -83
  45. package/dist/{openai-completions-yJuk7eis.mjs → openai-completions-BO6D_hrB.mjs} +11 -12
  46. package/dist/{openai-prompt-cache-Bds-n_9Q.mjs → openai-completions-compat-CUollwl6.mjs} +5 -50
  47. package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-DfJG1wSO.d.mts} +4 -4
  48. package/dist/{openai-completions-stream-Da2vvl-S.mjs → openai-completions-stream-BpuJ0ZOA.mjs} +117 -106
  49. package/dist/{openai-prompt-cache-B4eYo2-I.d.mts → openai-prompt-cache-C4RHdN4n.d.mts} +2 -2
  50. package/dist/openai-prompt-cache-CjV_2IRI.mjs +46 -0
  51. package/dist/{openai-provider-client-S2gCrM2Z.mjs → openai-provider-client-BP8J1aeg.mjs} +2 -2
  52. package/dist/openai-reasoning-effort-ash8dPrd.mjs +243 -0
  53. package/dist/{openai-responses-DaYwH05E.mjs → openai-responses-BJ_IEoMU.mjs} +8 -12
  54. package/dist/{openai-responses-compaction-window-CIhBAkkq.mjs → openai-responses-compaction-window-BiNCT0bS.mjs} +20 -62
  55. package/dist/{openai-responses-contracts-BjBAqAg_.d.mts → openai-responses-contracts-B1ENJFpI.d.mts} +9 -5
  56. package/dist/openai-responses-contracts-DWrfMODE.mjs +81 -0
  57. package/dist/{openai-responses-payload-policy-rLRPsSmB.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +5 -3
  58. package/dist/openai-responses-prompt-observer-internal-DPHWgbBH.mjs +198 -0
  59. package/dist/openai-responses-request-lifecycle-DFuyO1pQ.mjs +36 -0
  60. package/dist/{openai-responses-shared-B8RdBPCv.mjs → openai-responses-shared-DvSqtJ6_.mjs} +859 -581
  61. package/dist/openai-responses-terminal-usage-BNFbvY9f.d.mts +47 -0
  62. package/dist/{openai-tool-schema-CzjyYXun.mjs → openai-tool-schema-D4BMcj2D.mjs} +262 -162
  63. package/dist/{openai-transport-params-9aPuV5YY.mjs → openai-transport-params-DZKOTSfH.mjs} +157 -47
  64. package/dist/{positive-integer-41zhOdcV.mjs → positive-integer-BiUxrd71.mjs} +1 -1
  65. package/dist/{provider-error-BA-v_tKd.mjs → provider-error-CRhW7lkJ.mjs} +139 -44
  66. package/dist/{provider-error-CzNw4BWX.d.mts → provider-error-xumb1V3F.d.mts} +3 -1
  67. package/dist/{provider-options-Ceqv1OKk.d.mts → provider-options-DZYq53lj.d.mts} +12 -7
  68. package/dist/{provider-replay-context-CJ_YvcEW.mjs → provider-replay-context-DPr3w20a.mjs} +1 -1
  69. package/dist/{provider-transcript-transform-V5YzU9zh.mjs → provider-transcript-transform-BTocjCRs.mjs} +1 -1
  70. package/dist/{provider-transport-turn-state-D5EXOFL2.mjs → provider-transport-turn-state-lrXEFkYr.mjs} +1 -1
  71. package/dist/{provider-types-CVjKjsuq.d.mts → provider-types-w1rEqrGP.d.mts} +3 -3
  72. package/dist/provider-types.d.mts +6 -7
  73. package/dist/providers.d.mts +2 -2
  74. package/dist/providers.mjs +10 -10
  75. package/dist/{reasoning-tag-text-partitioner-BcR5pztD.mjs → reasoning-tag-text-partitioner-Di38crhI.mjs} +167 -40
  76. package/dist/{simple-options-BQbb4yQL.mjs → simple-options-np1XPuhm.mjs} +5 -3
  77. package/dist/{usage-cost-BNWbbXav.mjs → src-DwGYYyZp.mjs} +18 -11
  78. package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-BeptfRL6.mjs} +1 -1
  79. package/dist/{string-normalization-CmLIasuf.mjs → string-normalization-J9ZiLfGO.mjs} +13 -1
  80. package/dist/tool-schema-json-projection-CD9c_fK8.mjs +134 -0
  81. package/dist/{transport-stream-shared-zHll9BxO.mjs → transport-stream-shared-B5RioB_Q.mjs} +16 -24
  82. package/dist/{transport-stream-shared-DNvmoWnv.d.mts → transport-stream-shared-B7Z9oCYg.d.mts} +5 -5
  83. package/dist/{transport-utils-zrYjICLZ.mjs → transport-utils-03Qi0CN2.mjs} +3 -3
  84. package/dist/transports.d.mts +27 -13
  85. package/dist/transports.mjs +168 -462
  86. package/dist/types-DTvddOfm.d.mts +1 -0
  87. package/dist/{types-Ntv5z2g2.d.mts → types-qZFbaDbK.d.mts} +49 -3
  88. package/dist/types.d.mts +6 -7
  89. package/dist/types.mjs +4 -5
  90. package/dist/{validation-B0t_G2H6.d.mts → validation-DhQhmt6t.d.mts} +1 -1
  91. package/dist/{validation-BDzVDnTs.mjs → validation-Dw7cb6BV.mjs} +1 -0
  92. package/dist/validation.d.mts +1 -1
  93. package/dist/validation.mjs +1 -1
  94. package/package.json +11 -6
  95. package/dist/diagnostics-DnPnOui6.d.mts +0 -29
  96. package/dist/event-stream-C3WGFsum.d.mts +0 -1
  97. package/dist/openai-responses-contracts-DDOHA62Y.mjs +0 -245
  98. package/dist/openai-responses-prompt-observer-internal-f8J7wpsk.mjs +0 -32
  99. package/dist/src-DDmEryvj.mjs +0 -2
  100. package/dist/tool-schema-json-projection-ClptDdAO.mjs +0 -82
  101. package/dist/types-DlfwzH3T.d.mts +0 -1
@@ -1,3 +1,5 @@
1
+ import "./diagnostics-DzrF1h4J.mjs";
2
+ import "./validation-Dw7cb6BV.mjs";
1
3
  //#region packages/llm-core/src/model-contracts/anthropic.ts
2
4
  function normalizeClaudeModelId(modelId) {
3
5
  const normalized = modelId?.trim().toLowerCase() ?? "";
@@ -5,15 +7,13 @@ function normalizeClaudeModelId(modelId) {
5
7
  }
6
8
  const CLAUDE_FABLE_5_THINKING_PROFILE = {
7
9
  levels: [
8
- { id: "minimal" },
9
10
  { id: "low" },
10
11
  { id: "medium" },
11
12
  { id: "high" },
12
13
  { id: "xhigh" },
13
- { id: "adaptive" },
14
14
  { id: "max" }
15
15
  ],
16
- defaultLevel: "high",
16
+ defaultLevel: "medium",
17
17
  preserveWhenCatalogReasoningFalse: true
18
18
  };
19
19
  const CLAUDE_SONNET_5_THINKING_PROFILE = {
@@ -30,11 +30,11 @@ const CLAUDE_SONNET_5_THINKING_PROFILE = {
30
30
  defaultLevel: "high"
31
31
  };
32
32
  const CLAUDE_OPUS_5_THINKING_PROFILE = CLAUDE_SONNET_5_THINKING_PROFILE;
33
+ const CLAUDE_OPUS_55_THINKING_PROFILE = CLAUDE_FABLE_5_THINKING_PROFILE;
33
34
  /** Resolve the canonical normalized Claude model id for one runtime model ref. */
34
35
  function resolveClaudeModelIdentity(ref) {
35
36
  const normalized = normalizeClaudeModelId((typeof ref.params?.canonicalModelId === "string" ? ref.params.canonicalModelId : void 0) ?? ref.id);
36
- const match = /(?:^|[-/])claude-/.exec(normalized);
37
- return match ? normalized.slice((match.index ?? 0) + (match[0].startsWith("claude-") ? 0 : 1)) : normalized;
37
+ return /(?:^|[-/])(claude-[^/]+)$/.exec(normalized)?.[1] ?? normalized;
38
38
  }
39
39
  /** Resolve Claude Fable 5 through direct ids, cloud ids, or deployment metadata. */
40
40
  function resolveClaudeFable5ModelIdentity(ref) {
@@ -51,17 +51,16 @@ function resolveClaudeMythos5ModelIdentity(ref) {
51
51
  return normalized.slice((match.index ?? 0) + (match[0].startsWith("-") ? 1 : 0));
52
52
  }
53
53
  /**
54
- * Anthropic binds thinking to the conversation prefix starting with Fable 5.1 and
55
- * plans to enforce it on later models. Extend only with live replay proof for the
56
- * new model (Mythos 5.1 is unregistered here and unproven).
54
+ * Prefix-bound thinking requires append-only runtime context. Extend this list
55
+ * only with live replay proof for the model (Mythos 5.1 remains unproven).
57
56
  */
58
57
  function bindsClaudeThinkingPrefix(ref) {
59
- return /^claude-fable-5-1(?=$|[^a-z0-9])/.test(resolveClaudeModelIdentity(ref));
58
+ return resolveClaudeOpus55ModelIdentity(ref) !== void 0 || /^claude-fable-5-1(?=$|[^a-z0-9])/.test(resolveClaudeModelIdentity(ref));
60
59
  }
61
60
  /** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
62
61
  function requiresClaudeMandatoryAdaptiveThinking(ref) {
63
62
  const modelId = resolveClaudeModelIdentity(ref);
64
- return resolveClaudeFable5ModelIdentity(ref) !== void 0 || resolveClaudeMythos5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-mythos-preview(?=$|[^a-z0-9])/.test(modelId);
63
+ return resolveClaudeOpus55ModelIdentity(ref) !== void 0 || resolveClaudeFable5ModelIdentity(ref) !== void 0 || resolveClaudeMythos5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-mythos-preview(?=$|[^a-z0-9])/.test(modelId);
65
64
  }
66
65
  /** Resolve Claude Sonnet 5 through direct ids, cloud ids, or deployment metadata. */
67
66
  function resolveClaudeSonnet5ModelIdentity(ref) {
@@ -73,11 +72,19 @@ function resolveClaudeSonnet5ModelIdentity(ref) {
73
72
  /** Resolve Claude Opus 5 through aliases, direct ids, cloud ids, or deployment metadata. */
74
73
  function resolveClaudeOpus5ModelIdentity(ref) {
75
74
  const normalized = resolveClaudeModelIdentity(ref);
75
+ const opus55Identity = resolveClaudeOpus55ModelIdentity(ref);
76
+ if (opus55Identity) return opus55Identity;
76
77
  if (normalized === "opus" || normalized === "opus-5") return "claude-opus-5";
77
78
  const match = /(?:^|-)claude-opus-5(?=$|[^a-z0-9])/.exec(normalized);
78
79
  if (!match) return;
79
80
  return normalized.slice((match.index ?? 0) + (match[0].startsWith("-") ? 1 : 0));
80
81
  }
82
+ /** Resolve the Opus 5.5 contract without matching other Opus 5 generations. */
83
+ function resolveClaudeOpus55ModelIdentity(ref) {
84
+ const normalized = resolveClaudeModelIdentity(ref);
85
+ if (normalized === "opus-5-5") return "claude-opus-5-5";
86
+ return /^claude-opus-5-5(?=$|[^a-z0-9])/.test(normalized) ? normalized : void 0;
87
+ }
81
88
  /** Return whether a Claude model supports adaptive thinking. */
82
89
  function supportsClaudeAdaptiveThinking(ref) {
83
90
  const modelId = resolveClaudeModelIdentity(ref);
@@ -194,4 +201,4 @@ function calculateUsageCost(usage, pricing) {
194
201
  return cost;
195
202
  }
196
203
  //#endregion
197
- export { supportsClaudeAdaptiveThinking as _, CLAUDE_OPUS_5_THINKING_PROFILE as a, supportsClaudeNativeXhighEffort as b, requiresClaudeDefaultSampling as c, resolveClaudeModelIdentity as d, resolveClaudeMythos5ModelIdentity as f, supportsClaude1MContext as g, resolveClaudeSonnet5ModelIdentity as h, CLAUDE_FABLE_5_THINKING_PROFILE as i, requiresClaudeMandatoryAdaptiveThinking as l, resolveClaudeOpus5ModelIdentity as m, normalizeModelCostConfig as n, CLAUDE_SONNET_5_THINKING_PROFILE as o, resolveClaudeNativeThinkingLevelMap as p, normalizeResolvedPricing as r, bindsClaudeThinkingPrefix as s, calculateUsageCost as t, resolveClaudeFable5ModelIdentity as u, supportsClaudeFastMode as v, supportsClaudeNativeMaxEffort as y };
204
+ export { supportsClaudeNativeXhighEffort as S, resolveClaudeSonnet5ModelIdentity as _, CLAUDE_OPUS_55_THINKING_PROFILE as a, supportsClaudeFastMode as b, bindsClaudeThinkingPrefix as c, resolveClaudeFable5ModelIdentity as d, resolveClaudeModelIdentity as f, resolveClaudeOpus5ModelIdentity as g, resolveClaudeOpus55ModelIdentity as h, CLAUDE_FABLE_5_THINKING_PROFILE as i, requiresClaudeDefaultSampling as l, resolveClaudeNativeThinkingLevelMap as m, normalizeModelCostConfig as n, CLAUDE_OPUS_5_THINKING_PROFILE as o, resolveClaudeMythos5ModelIdentity as p, normalizeResolvedPricing as r, CLAUDE_SONNET_5_THINKING_PROFILE as s, calculateUsageCost as t, requiresClaudeMandatoryAdaptiveThinking as u, supportsClaude1MContext as v, supportsClaudeNativeMaxEffort as x, supportsClaudeAdaptiveThinking as y };
@@ -1,4 +1,4 @@
1
- import { a as clampTimerTimeoutMs } from "./base64-D-su8YVo.mjs";
1
+ import { a as clampTimerTimeoutMs } from "./base64-CPmadnUf.mjs";
2
2
  //#region packages/ai/src/utils/stream-first-event-timeout.ts
3
3
  function getFirstStreamEventTimeoutMs(options) {
4
4
  return options?.firstEventTimeoutMs;
@@ -12,5 +12,17 @@ function uniqueValues(values) {
12
12
  function uniqueStrings(values) {
13
13
  return uniqueValues(values);
14
14
  }
15
+ /** Normalizes array-backed string lists and rejects non-array input as empty. */
16
+ function normalizeTrimmedStringList(value) {
17
+ if (!Array.isArray(value)) return [];
18
+ return value.flatMap((entry) => {
19
+ const normalized = normalizeOptionalString(entry);
20
+ return normalized ? [normalized] : [];
21
+ });
22
+ }
23
+ /** Normalizes an array-backed string list and removes duplicates. */
24
+ function normalizeUniqueTrimmedStringList(value) {
25
+ return uniqueStrings(normalizeTrimmedStringList(value));
26
+ }
15
27
  //#endregion
16
- export { uniqueStrings as n, uniqueValues as r, normalizeStringEntries as t };
28
+ export { uniqueValues as i, normalizeUniqueTrimmedStringList as n, uniqueStrings as r, normalizeStringEntries as t };
@@ -0,0 +1,134 @@
1
+ import { o as isRecord } from "./record-coerce-DwRYMj3t.mjs";
2
+ import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
3
+ import { types } from "node:util";
4
+ //#region packages/ai/src/providers/tool-schema-json-projection.ts
5
+ function isNonFiniteNumberValue(value) {
6
+ if (typeof value === "number") return !Number.isFinite(value);
7
+ if (value === null || typeof value !== "object" || !types.isNumberObject(value)) return false;
8
+ return !Number.isFinite(Number.prototype.valueOf.call(value));
9
+ }
10
+ function serializeToolInputSchema(value, path, captureJson) {
11
+ const nonFiniteNumber = { path: null };
12
+ const ancestors = [];
13
+ const pathLengths = [];
14
+ const segments = [path];
15
+ let isRoot = true;
16
+ let text;
17
+ try {
18
+ text = JSON.stringify(value, function(key, entry) {
19
+ const invalidNumber = nonFiniteNumber.path === null && isNonFiniteNumberValue(entry);
20
+ if (invalidNumber || entry && typeof entry === "object") {
21
+ while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
22
+ ancestors.pop();
23
+ segments.length = expectDefined(pathLengths.pop(), "schema ancestor path length");
24
+ }
25
+ const prefixLength = segments.length;
26
+ if (!isRoot) {
27
+ if (Array.isArray(this)) segments.push("[", key, "]");
28
+ else segments.push(".", key);
29
+ }
30
+ if (invalidNumber) {
31
+ nonFiniteNumber.path = segments.join("");
32
+ segments.length = prefixLength;
33
+ } else {
34
+ ancestors.push(entry);
35
+ pathLengths.push(prefixLength);
36
+ }
37
+ }
38
+ isRoot = false;
39
+ return entry;
40
+ });
41
+ } catch {
42
+ return {
43
+ schema: {},
44
+ violations: [`${path} is not JSON-serializable`]
45
+ };
46
+ }
47
+ if (!text) return {
48
+ schema: {},
49
+ violations: [`${path} is not JSON-serializable`]
50
+ };
51
+ if (nonFiniteNumber.path !== null) return {
52
+ schema: {},
53
+ violations: [`${nonFiniteNumber.path} is not JSON-serializable`]
54
+ };
55
+ const schema = JSON.parse(text);
56
+ captureJson?.(text);
57
+ return {
58
+ schema,
59
+ violations: []
60
+ };
61
+ }
62
+ const schemaMapKeywords = /* @__PURE__ */ new Set([
63
+ "$defs",
64
+ "definitions",
65
+ "dependencies",
66
+ "dependentSchemas",
67
+ "patternProperties",
68
+ "properties"
69
+ ]);
70
+ function inspectJsonSchema(schema, path, violations) {
71
+ if (Array.isArray(schema)) {
72
+ let index = 0;
73
+ for (const entry of schema) {
74
+ path.push("[", index++, "]");
75
+ const valid = inspectJsonSchema(entry, path, violations);
76
+ path.length -= 3;
77
+ if (!valid) return false;
78
+ }
79
+ return true;
80
+ }
81
+ if (!isRecord(schema)) return typeof schema !== "number" || Number.isFinite(schema);
82
+ for (const key of ["$dynamicRef", "$dynamicAnchor"]) if (key in schema) violations.push(`${path.join("")}.${key}`);
83
+ for (const key of Object.keys(schema)) {
84
+ const value = schema[key];
85
+ if (typeof value === "number" && !Number.isFinite(value)) return false;
86
+ if (!value || typeof value !== "object") continue;
87
+ path.push(".", key);
88
+ if (schemaMapKeywords.has(key) && isRecord(value)) for (const schemaName of Object.keys(value)) {
89
+ const childSchema = value[schemaName];
90
+ if (childSchema === void 0) return false;
91
+ path.push(".", schemaName);
92
+ const valid = inspectJsonSchema(childSchema, path, violations);
93
+ path.length -= 2;
94
+ if (!valid) return false;
95
+ }
96
+ else if (!inspectJsonSchema(value, path, violations)) return false;
97
+ path.length -= 2;
98
+ }
99
+ return true;
100
+ }
101
+ /** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
102
+ function projectRuntimeToolInputSchema(schema, path = "parameters") {
103
+ return projectToolInputSchema(schema, path);
104
+ }
105
+ /** Package-private preparation; public projections never carry normalization provenance. */
106
+ function prepareRuntimeToolInputSchema(schema, path) {
107
+ let inputJson;
108
+ const projection = projectToolInputSchema(schema, path, (text) => {
109
+ inputJson = text;
110
+ });
111
+ return {
112
+ projection,
113
+ ...schema && typeof schema === "object" && inputJson && projection.violations.length === 0 ? { normalization: {
114
+ source: schema,
115
+ inputJson
116
+ } } : {}
117
+ };
118
+ }
119
+ function projectToolInputSchema(schema, path, captureJson) {
120
+ const projection = serializeToolInputSchema(schema, path, captureJson);
121
+ const violations = [...projection.violations];
122
+ if (!isRecord(projection.schema)) violations.push(`${path} must be a JSON object schema`);
123
+ else if (projection.schema.type !== void 0 && projection.schema.type !== "object") violations.push(`${path}.type must be "object"`);
124
+ if (!inspectJsonSchema(projection.schema, [path], violations)) return {
125
+ schema: {},
126
+ violations: [`${path} is not a JSON value`]
127
+ };
128
+ return {
129
+ schema: projection.schema,
130
+ violations
131
+ };
132
+ }
133
+ //#endregion
134
+ export { projectRuntimeToolInputSchema as n, prepareRuntimeToolInputSchema as t };
@@ -1,9 +1,9 @@
1
- import { n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
1
+ import { n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
2
2
  import { i as createAssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
3
- import { n as getAiTransportHost, v as sanitizeSurrogates } from "./host-B8YfDGd4.mjs";
4
3
  import { i as asOptionalRecord, n as asNullableRecord, t as asNonArrayRecord } from "./record-coerce-DwRYMj3t.mjs";
5
- import { n as projectProviderError, r as projectDiagnosticValue } from "./provider-error-BA-v_tKd.mjs";
6
- import { c as isTransientNetworkError } from "./diagnostics-QuErwCIl.mjs";
4
+ import { A as headersToRecord, n as getAiTransportHost, v as sanitizeSurrogates } from "./host-yTvBrYM2.mjs";
5
+ import { i as projectDiagnosticValue, n as projectProviderError } from "./provider-error-CRhW7lkJ.mjs";
6
+ import { c as isTransientNetworkError } from "./diagnostics-CH8j2wIG.mjs";
7
7
  import { parse } from "partial-json";
8
8
  //#region packages/ai/src/utils/hash.ts
9
9
  /** Fast deterministic hash to shorten long strings */
@@ -20,14 +20,6 @@ function shortHash(str) {
20
20
  return (h2 >>> 0).toString(36) + (h1 >>> 0).toString(36);
21
21
  }
22
22
  //#endregion
23
- //#region packages/ai/src/utils/headers.ts
24
- /** Converts a Headers object to a plain record for provider request handling. */
25
- function headersToRecord(headers) {
26
- const result = {};
27
- for (const [key, value] of headers.entries()) result[key] = value;
28
- return result;
29
- }
30
- //#endregion
31
23
  //#region packages/ai/src/utils/json-parse.ts
32
24
  const VALID_JSON_ESCAPES = /* @__PURE__ */ new Set([
33
25
  "\"",
@@ -72,6 +64,7 @@ function escapeControlCharacter(char) {
72
64
  * tool-call argument buffer) and every valid escape must survive as written.
73
65
  */
74
66
  function repairJson(json, options) {
67
+ if (!/[\\\x00-\x1f]/.test(json)) return json;
75
68
  const preserveValidControlEscapes = options?.preserveValidControlEscapes === true;
76
69
  let repaired = "";
77
70
  let inString = false;
@@ -110,10 +103,13 @@ function repairJson(json, options) {
110
103
  stringValuePrefix += "\\";
111
104
  continue;
112
105
  }
113
- if (!preserveValidControlEscapes && JSON_CONTROL_ESCAPES.has(nextChar) && looksLikeWindowsPathPrefix(stringValuePrefix)) {
114
- repaired += "\\\\";
115
- stringValuePrefix += "\\";
116
- continue;
106
+ if (!preserveValidControlEscapes && JSON_CONTROL_ESCAPES.has(nextChar)) {
107
+ stringValuePrefix = stringValuePrefix.slice(-160);
108
+ if (looksLikeWindowsPathPrefix(stringValuePrefix)) {
109
+ repaired += "\\\\";
110
+ stringValuePrefix += "\\";
111
+ continue;
112
+ }
117
113
  }
118
114
  if (VALID_JSON_ESCAPES.has(nextChar)) {
119
115
  repaired += `\\${nextChar}`;
@@ -134,8 +130,7 @@ function parseJsonWithRepair(json) {
134
130
  return JSON.parse(repairJson(json));
135
131
  }
136
132
  function looksLikeWindowsPathPrefix(prefix) {
137
- const tail = prefix.slice(-160);
138
- return /(?:^|[^A-Za-z0-9])[A-Za-z]:(?:[\\/][^"\\/:*?<>|\r\n]*)*$/.test(tail);
133
+ return /(?:^|[^A-Za-z0-9])[A-Za-z]:(?:[\\/][^"\\/:*?<>|\r\n]*)*$/.test(prefix);
139
134
  }
140
135
  /**
141
136
  * Attempts to parse potentially incomplete JSON during streaming.
@@ -152,11 +147,7 @@ function parseStreamingJson(partialJson) {
152
147
  try {
153
148
  return asNonArrayRecord(parse(partialJson));
154
149
  } catch {
155
- try {
156
- return asNonArrayRecord(parse(repairJson(partialJson)));
157
- } catch {
158
- return {};
159
- }
150
+ return {};
160
151
  }
161
152
  }
162
153
  }
@@ -221,6 +212,7 @@ function isUnsafeIntegerLiteral(token) {
221
212
  }
222
213
  /** Quotes integer literals above Number.MAX_SAFE_INTEGER before JSON.parse. */
223
214
  function quoteUnsafeIntegerLiterals(input) {
215
+ if (!/(?:^|\D)\d{16}/.test(input)) return input;
224
216
  let out = "";
225
217
  let inString = false;
226
218
  let escaped = false;
@@ -564,4 +556,4 @@ function failTransportStream(params) {
564
556
  stream.end();
565
557
  }
566
558
  //#endregion
567
- export { quoteUnsafeIntegerLiterals as C, repairJson as D, parseStreamingJson as E, headersToRecord as O, parseJsonPreservingUnsafeIntegers as S, parseJsonWithRepair as T, sanitizeTransportPayloadText as _, createEmptyTransportUsage as a, withProviderResponseHook as b, finalizeTerminalToolCallArguments as c, mergeTransportMetadata as d, notifyProviderHttpMetadata as f, sanitizeNonEmptyTransportPayloadText as g, parseTerminalToolCallArguments as h, copyProviderAcceptanceObserver as i, shortHash as k, finalizeTransportStream as l, notifyProviderStreamOpened as m, assignTransportErrorDetails as n, createWritableTransportEventStream as o, notifyProviderHttpResponse as p, coerceTransportToolCallArguments as r, failTransportStream as s, IncompleteToolCallError as t, mergeTransportHeaders as u, transportAbortError as v, createToolArgumentPreviewSchedule as w, parseJsonObjectPreservingUnsafeIntegers as x, withProviderAcceptanceObserver as y };
559
+ export { quoteUnsafeIntegerLiterals as C, repairJson as D, parseStreamingJson as E, shortHash as O, parseJsonPreservingUnsafeIntegers as S, parseJsonWithRepair as T, sanitizeTransportPayloadText as _, createEmptyTransportUsage as a, withProviderResponseHook as b, finalizeTerminalToolCallArguments as c, mergeTransportMetadata as d, notifyProviderHttpMetadata as f, sanitizeNonEmptyTransportPayloadText as g, parseTerminalToolCallArguments as h, copyProviderAcceptanceObserver as i, finalizeTransportStream as l, notifyProviderStreamOpened as m, assignTransportErrorDetails as n, createWritableTransportEventStream as o, notifyProviderHttpResponse as p, coerceTransportToolCallArguments as r, failTransportStream as s, IncompleteToolCallError as t, mergeTransportHeaders as u, transportAbortError as v, createToolArgumentPreviewSchedule as w, parseJsonObjectPreservingUnsafeIntegers as x, withProviderAcceptanceObserver as y };
@@ -1,8 +1,8 @@
1
- import "./index-DdD3qerf.mjs";
2
- import { O as Model, V as ProviderResponse, Y as StreamOptions, a as AssistantMessage, ot as Usage } from "./types-Ntv5z2g2.mjs";
3
- import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-Bt5Y4Pav.mjs";
4
- import "./event-stream-C3WGFsum.mjs";
5
- import { t as ProviderErrorProjection } from "./provider-error-CzNw4BWX.mjs";
1
+ import "./index-C25RT6bP.mjs";
2
+ import { O as Model, V as ProviderResponse, Y as StreamOptions, a as AssistantMessage, ot as Usage } from "./types-qZFbaDbK.mjs";
3
+ import { r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CjnIZZst.mjs";
4
+ import "./event-stream-C0nsgbj2.mjs";
5
+ import { t as ProviderErrorProjection } from "./provider-error-xumb1V3F.mjs";
6
6
  //#region packages/ai/src/transports/transport-stream-shared.d.ts
7
7
  type ContextUsage = NonNullable<Usage["contextUsage"]>;
8
8
  type TransportUsage = {
@@ -1,8 +1,8 @@
1
- import { n as getAiTransportHost } from "./host-B8YfDGd4.mjs";
1
+ import { n as getAiTransportHost } from "./host-yTvBrYM2.mjs";
2
2
  import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
3
- import "./provider-error-BA-v_tKd.mjs";
3
+ import "./provider-error-CRhW7lkJ.mjs";
4
4
  import "./internal/retry-after.mjs";
5
- import "./positive-integer-41zhOdcV.mjs";
5
+ import "./positive-integer-BiUxrd71.mjs";
6
6
  //#region packages/normalization-core/src/response-bytes.ts
7
7
  async function consumeResponseBytes(options) {
8
8
  let size = 0;
@@ -1,18 +1,18 @@
1
- import "./index-DdD3qerf.mjs";
2
- import { $ as ThinkingContent, B as ProviderReplayState, K as StopReason, M as OpenAICompletionsCompat, O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, l as CacheRetention, n as Api, nt as Tool, ot as Usage, q as StreamFn, rt as ToolCall, ut as ModelDataThinkingFormat } from "./types-Ntv5z2g2.mjs";
3
- import { n as ApiRegistry } from "./api-registry-ByUwIR0e.mjs";
4
- import { a as BaseOpenAIStreamOptions, c as OpenAIResponsesCompactionRejection, o as CodeModeToolSurfaceObservation, s as OpenAICompletionsOptions } from "./provider-options-Ceqv1OKk.mjs";
1
+ import "./index-C25RT6bP.mjs";
2
+ import { $ as ThinkingContent, B as ProviderReplayState, K as StopReason, M as OpenAICompletionsCompat, O as Model, X as TextContent, Y as StreamOptions, _t as ModelDataThinkingFormat, a as AssistantMessage, d as Context, l as CacheRetention, n as Api, nt as Tool, ot as Usage, q as StreamFn, rt as ToolCall } from "./types-qZFbaDbK.mjs";
3
+ import { n as ApiRegistry } from "./api-registry-C2T3lTV7.mjs";
4
+ import { a as BaseOpenAIStreamOptions, c as OpenAIResponsesCompactionRejection, o as CodeModeToolSurfaceObservation, s as OpenAICompletionsOptions } from "./provider-options-DZYq53lj.mjs";
5
5
  import { n as OpenAIToolProjection } from "./openai-tool-projection-793cE3QX.mjs";
6
- import "./types-DlfwzH3T.mjs";
7
- import { a as buildAnthropicSystemBlocks, c as logAnthropicContextEdits, d as resolveAnthropicEphemeralCacheControl, f as resolveAnthropicPayloadPolicy, i as applyAnthropicRequestCacheControl, l as resolveAnthropicCacheOptions, n as applyAnthropicEphemeralCacheControlMarkers, o as isAnthropicServerToolClearingEnabled, p as resolveAnthropicServerCompactionPlan, r as applyAnthropicPayloadPolicyToParams, s as isDirectAnthropicModel, t as applyAnthropicContextManagementToRequest, u as resolveAnthropicContextManagementBetaHeader } from "./anthropic-payload-policy-BZ8umAbk.mjs";
8
- import { i as ReplayableResponseCompactionItem, n as OpenAIResponsesOptions, r as OpenAIResponsesReasoningReplayMetadata, s as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-BjBAqAg_.mjs";
9
- import { i as resolveOpenAIResponsesServerCompactionPlan, n as resolveOpenAIResponsesCompactEndpointPlan, r as resolveOpenAIResponsesPayloadPolicy, t as applyOpenAIResponsesPayloadPolicy } from "./openai-responses-payload-policy-rLRPsSmB.mjs";
10
- import { a as resolveOpenAICompletionsCompat, i as isOpenAICodexResponsesModel, n as detectOpenAICompletionsCompat, o as resolveOpenAIPromptCacheKeySupport, r as isNativeOpenAIEndpoint, s as usesNativeOpenAICodexResponsesBackend, t as ResolvedOpenAICompletionsCompat } from "./openai-completions-compat-eHgh5UPE.mjs";
11
- import { S as withProviderResponseHook, _ as parseTerminalToolCallArguments, a as coerceTransportToolCallArguments, b as transportAbortError, c as createWritableTransportEventStream, d as finalizeTransportStream, f as mergeTransportHeaders, g as notifyProviderStreamOpened, h as notifyProviderHttpResponse, i as assignTransportErrorDetails, l as failTransportStream, m as notifyProviderHttpMetadata, n as ProviderAcceptance, o as copyProviderAcceptanceObserver, p as mergeTransportMetadata, r as WritableTransportStream, s as createEmptyTransportUsage, t as IncompleteToolCallError, u as finalizeTerminalToolCallArguments, v as sanitizeNonEmptyTransportPayloadText, x as withProviderAcceptanceObserver, y as sanitizeTransportPayloadText } from "./transport-stream-shared-DNvmoWnv.mjs";
6
+ import "./types-DTvddOfm.mjs";
7
+ import { a as buildAnthropicSystemBlocks, c as logAnthropicContextEdits, d as resolveAnthropicEphemeralCacheControl, f as resolveAnthropicPayloadPolicy, i as applyAnthropicRequestCacheControl, l as resolveAnthropicCacheOptions, n as applyAnthropicEphemeralCacheControlMarkers, o as isAnthropicServerToolClearingEnabled, p as resolveAnthropicServerCompactionPlan, r as applyAnthropicPayloadPolicyToParams, s as isDirectAnthropicModel, t as applyAnthropicContextManagementToRequest, u as resolveAnthropicContextManagementBetaHeader } from "./anthropic-payload-policy-DyfwikYJ.mjs";
8
+ import { a as resolveOpenAICompletionsCompat, i as isOpenAICodexResponsesModel, n as detectOpenAICompletionsCompat, o as resolveOpenAIPromptCacheKeySupport, r as isNativeOpenAIEndpoint, s as usesNativeOpenAICodexResponsesBackend, t as ResolvedOpenAICompletionsCompat } from "./openai-completions-compat-DfJG1wSO.mjs";
9
+ import { i as ReplayableResponseCompactionItem, n as OpenAIResponsesOptions, r as OpenAIResponsesReasoningReplayMetadata, s as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-B1ENJFpI.mjs";
10
+ import { i as resolveOpenAIResponsesServerCompactionPlan, n as resolveOpenAIResponsesCompactEndpointPlan, r as resolveOpenAIResponsesPayloadPolicy, t as applyOpenAIResponsesPayloadPolicy } from "./openai-responses-payload-policy-C7GsA1y0.mjs";
11
+ import { S as withProviderResponseHook, _ as parseTerminalToolCallArguments, a as coerceTransportToolCallArguments, b as transportAbortError, c as createWritableTransportEventStream, d as finalizeTransportStream, f as mergeTransportHeaders, g as notifyProviderStreamOpened, h as notifyProviderHttpResponse, i as assignTransportErrorDetails, l as failTransportStream, m as notifyProviderHttpMetadata, n as ProviderAcceptance, o as copyProviderAcceptanceObserver, p as mergeTransportMetadata, r as WritableTransportStream, s as createEmptyTransportUsage, t as IncompleteToolCallError, u as finalizeTerminalToolCallArguments, v as sanitizeNonEmptyTransportPayloadText, x as withProviderAcceptanceObserver, y as sanitizeTransportPayloadText } from "./transport-stream-shared-B7Z9oCYg.mjs";
12
12
  import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-Cwcjv_fx.mjs";
13
13
  import { r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-ynZBgqW-.mjs";
14
- import { d as VideoContent, i as ProviderContext, s as ProviderModel } from "./provider-types-CVjKjsuq.mjs";
15
- import { a as resolveModelSseDebugMode, i as resolveModelPayloadDebugMode, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-DKocrEsb.mjs";
14
+ import { d as VideoContent, i as ProviderContext, s as ProviderModel } from "./provider-types-w1rEqrGP.mjs";
15
+ import { a as resolveModelSseDebugMode, i as resolveModelPayloadDebugMode, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-C5f59L3Y.mjs";
16
16
  import OpenAI from "openai";
17
17
  import { Part } from "@google/genai";
18
18
  import "openai/resources/responses/responses.js";
@@ -82,6 +82,17 @@ export declare const log: {
82
82
  info(message: string, data?: Record<string, unknown>): void;
83
83
  warn(message: string, data?: Record<string, unknown>): void;
84
84
  };
85
+ export declare function createResponseModelTracker(enabled?: boolean): {
86
+ begin: (headers?: Headers) => void;
87
+ observeEvent: (event: unknown) => string | undefined;
88
+ resolve: () => string | undefined;
89
+ track(response: Pick<Response, "headers"> | undefined, stream: AsyncIterable<unknown>): AsyncIterable<unknown>;
90
+ terminalOptions: {
91
+ resolveResponseModel: () => string | undefined;
92
+ } | {
93
+ resolveResponseModel?: undefined;
94
+ };
95
+ };
85
96
  export declare function resolveOpenAIClientBaseUrl(model: Pick<Model, "provider" | "baseUrl">, baseUrl?: string | undefined): string | undefined;
86
97
  export type OpenAICompletionsTextSource = "reasoning_detail" | "refusal";
87
98
  export type OpenAICompletionsContentDelta = {
@@ -265,6 +276,7 @@ export declare function getCompat(model: OpenAIModeModel): {
265
276
  supportsJsonSchemaResponseFormat: boolean;
266
277
  supportsPromptCacheKey: boolean;
267
278
  supportsLongCacheRetention: boolean;
279
+ supportedReasoningEfforts?: string[] | undefined;
268
280
  sessionAffinity: "openai" | "openrouter" | "none";
269
281
  visibleReasoningDetailTypes: string[];
270
282
  requiresNonEmptyUserOrAssistantMessage: boolean;
@@ -284,6 +296,7 @@ type ReplayPressureEstimator = {
284
296
  text(value: string): number;
285
297
  image(): number;
286
298
  json(value: unknown): number;
299
+ toolResult?(value: string): number;
287
300
  };
288
301
  /** Resolve from prepared transport facts; never retain or return credential material. */
289
302
  export declare function resolveCompactionReplayEligibility(model: Model, options: {
@@ -295,9 +308,10 @@ export declare function requiresCompactionReplayRefresh(messages: readonly Repla
295
308
  /** Carry a checkpoint immediately after reference-preserving history limiting, before repair. */
296
309
  export declare function preserveCompactionReplayWindow<T extends ReplayMessage>(source: readonly T[], windowed: T[], model: Model, identity: ReplayIdentity): T[];
297
310
  /** Estimate the canonical prefix and its tail once, independent of unbound usage snapshots. */
298
- export declare function resolveCompactionReplayPressure<T extends ReplayMessage>(messages: T[], model: Model, identity: ReplayIdentity, estimate: ReplayPressureEstimator): {
311
+ export declare function resolveCompactionReplayPressure<T extends ReplayMessage>(messages: T[], model: Model, identity: ReplayIdentity, estimate: ReplayPressureEstimator, systemPrompt?: string): {
299
312
  messages: T[];
300
313
  prefixTokens: number;
314
+ measuredTokens?: number;
301
315
  } | undefined;
302
316
  /** Whether provider replay state is a prefix-bound server compaction checkpoint. */
303
317
  export declare function isCompactionReplayCheckpoint(replay: unknown): replay is ProviderReplayState;