@openclaw/ai 2026.9.1 → 2026.9.3

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 (111) hide show
  1. package/README.md +3 -2
  2. package/dist/anthropic-CZy5U0NY.mjs +376 -0
  3. package/dist/anthropic-payload-policy-wuRCb6MH.d.mts +85 -0
  4. package/dist/anthropic-stream-reducer-B_yo_7pf.mjs +1669 -0
  5. package/dist/{api-registry-Cs6HGNqY.d.mts → api-registry-CB1-1oQ2.d.mts} +2 -2
  6. package/dist/assistant-output-iqnlJCV2.mjs +16 -0
  7. package/dist/assistant-text-phase-C20rxWwP.mjs +55 -0
  8. package/dist/{azure-openai-responses-CN4Fy5zV.mjs → azure-openai-responses-Crpa40QR.mjs} +5 -5
  9. package/dist/{base64-CEFBpSkN.mjs → base64-D-su8YVo.mjs} +1 -27
  10. package/dist/{diagnostics-KhXK-QJI.mjs → diagnostics-dV98PqIy.mjs} +96 -21
  11. package/dist/diagnostics.d.mts +3 -1
  12. package/dist/diagnostics.mjs +3 -3
  13. package/dist/{event-stream-vK_7r3bj.d.mts → event-stream-C1Z2piyk.d.mts} +11 -3
  14. package/dist/{event-stream-uSMZJ3FA.mjs → event-stream-D8PARQfL.mjs} +48 -10
  15. package/dist/event-stream-I_GlBsuZ.d.mts +1 -0
  16. package/dist/event-stream.d.mts +2 -2
  17. package/dist/event-stream.mjs +1 -1
  18. package/dist/{github-copilot-headers-NCJtz9i0.mjs → github-copilot-headers-B37TB3rB.mjs} +3 -10
  19. package/dist/github-copilot-request-facts-BTEBMeOv.mjs +16 -0
  20. package/dist/{google-CC-nrwXg.mjs → google-BDPriaVe.mjs} +10 -10
  21. package/dist/google-messages-CVn9eFpF.mjs +449 -0
  22. package/dist/google-shared-BedY23XS.mjs +185 -0
  23. package/dist/{google-vertex-DCr0pyzQ.mjs → google-vertex-DMz8XQCn.mjs} +7 -6
  24. package/dist/{host-BIaiBURL.mjs → host-CWuF-sS3.mjs} +84 -34
  25. package/dist/{host-BztR4tQj.d.mts → host-DK3wmS3e.d.mts} +3 -3
  26. package/dist/host-policy-CAopLRKA.mjs +37 -0
  27. package/dist/{index-AfaxKT8w.d.mts → index-CQ6LTHw8.d.mts} +11 -5
  28. package/dist/index.d.mts +7 -7
  29. package/dist/index.mjs +5 -5
  30. package/dist/internal/anthropic.d.mts +14 -11
  31. package/dist/internal/anthropic.mjs +5 -5
  32. package/dist/internal/google-model-family.d.mts +5 -0
  33. package/dist/internal/google-model-family.mjs +15 -0
  34. package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
  35. package/dist/internal/openai-responses-payload-policy.mjs +1 -1
  36. package/dist/internal/openai.d.mts +8 -103
  37. package/dist/internal/openai.mjs +10 -10
  38. package/dist/internal/retry-after.d.mts +2 -4
  39. package/dist/internal/retry-after.mjs +57 -8
  40. package/dist/internal/runtime.d.mts +7 -6
  41. package/dist/internal/runtime.mjs +8 -7
  42. package/dist/internal/shared.d.mts +14 -3
  43. package/dist/internal/shared.mjs +6 -4
  44. package/dist/internal/tool-schema.d.mts +63 -0
  45. package/dist/internal/tool-schema.mjs +3 -0
  46. package/dist/{json-parse-BuAJEbdW.mjs → json-parse-Dw_hnxsA.mjs} +1 -1
  47. package/dist/{mistral-B7etBd_H.mjs → mistral--m-Jm6VZ.mjs} +16 -38
  48. package/dist/model-transport-url-DKocrEsb.d.mts +28 -0
  49. package/dist/{openai-chatgpt-responses-BAJ4gq3i.mjs → openai-chatgpt-responses-nDZccFW-.mjs} +62 -54
  50. package/dist/openai-completions-KuoZyx0d.mjs +187 -0
  51. package/dist/{openai-completions-compat-4IjSBpr6.d.mts → openai-completions-compat-CXn3T1we.d.mts} +26 -4
  52. package/dist/{openai-completions-stream-DZjwK8vp.mjs → openai-completions-stream-BQk3SkLD.mjs} +621 -451
  53. package/dist/openai-prompt-cache-BI0rkM-5.mjs +220 -0
  54. package/dist/openai-prompt-cache-rrutvqxq.d.mts +16 -0
  55. package/dist/openai-provider-client-ha_WxTyj.mjs +24 -0
  56. package/dist/openai-reasoning-effort-BK7FbcLT.mjs +167 -0
  57. package/dist/{openai-responses-BEUlxfDu.mjs → openai-responses-D99dOzKI.mjs} +14 -32
  58. package/dist/{openai-responses-compaction-window-DO7yV7az.mjs → openai-responses-compaction-window-D5jbzCi3.mjs} +7 -159
  59. package/dist/{openai-responses-contracts-bPzSN_Ba.d.mts → openai-responses-contracts-B55afwRo.d.mts} +12 -4
  60. package/dist/{openai-responses-prompt-observer-internal-C7x4IK7r.mjs → openai-responses-prompt-observer-internal-tApyTLVu.mjs} +3 -3
  61. package/dist/{openai-responses-shared-DiAdpNAM.mjs → openai-responses-shared-ZyQEzS5i.mjs} +217 -212
  62. package/dist/openai-tool-projection-793cE3QX.d.mts +37 -0
  63. package/dist/{openai-tool-schema-BMiHFH36.mjs → openai-tool-schema-CzjyYXun.mjs} +53 -583
  64. package/dist/openai-tool-schema-ynZBgqW-.d.mts +38 -0
  65. package/dist/openai-transport-params-DNasp2fU.mjs +674 -0
  66. package/dist/{provider-error-B6EGq6gg.mjs → provider-error-C6TbKiey.mjs} +29 -13
  67. package/dist/{provider-options-CxFPtvh7.d.mts → provider-options-BXr9Ec83.d.mts} +19 -42
  68. package/dist/provider-replay-context-BuSUaAk5.mjs +21 -0
  69. package/dist/{provider-transcript-transform-WvJmFUAf.mjs → provider-transcript-transform-pPmUIwKt.mjs} +1 -1
  70. package/dist/provider-types-CAV0Og3m.d.mts +29 -0
  71. package/dist/provider-types.d.mts +6 -31
  72. package/dist/providers.d.mts +2 -2
  73. package/dist/providers.mjs +11 -11
  74. package/dist/{reasoning-tag-text-partitioner-C-4uedDb.mjs → reasoning-tag-text-partitioner-BQBi4B9d.mjs} +90 -35
  75. package/dist/record-coerce-DwRYMj3t.mjs +32 -0
  76. package/dist/retry-after-CdCURCVg.d.mts +15 -0
  77. package/dist/{sanitize-unicode-S6binQG-.mjs → sanitize-unicode-Bb-v9meu.mjs} +1 -1
  78. package/dist/session-affinity-CCH7eYdB.mjs +20 -0
  79. package/dist/{simple-options-0PLDyJ-d.mjs → simple-options-tcKOqnpF.mjs} +3 -3
  80. package/dist/{src-C8U7lkoa.mjs → src-B2Q_6G8V.mjs} +10 -2
  81. package/dist/{stream-first-event-timeout-DcNjoFQE.mjs → stream-first-event-timeout-2hfrquuz.mjs} +1 -1
  82. package/dist/string-coerce-fsri9iCu.mjs +34 -0
  83. package/dist/{string-normalization--fwJ4S2q.mjs → string-normalization-CmLIasuf.mjs} +1 -1
  84. package/dist/{tool-schema-json-projection-BtZiml7r.mjs → tool-schema-json-projection-ClptDdAO.mjs} +2 -38
  85. package/dist/{transport-stream-shared-CytPVLIg.mjs → transport-stream-shared-Cu3ZPhNW.mjs} +5 -5
  86. package/dist/{transport-stream-shared-BrvFTkoO.d.mts → transport-stream-shared-DOxpGJ-H.d.mts} +4 -4
  87. package/dist/transport-utils-CCooe-cr.mjs +121 -0
  88. package/dist/transports.d.mts +114 -41
  89. package/dist/transports.mjs +796 -1596
  90. package/dist/types-BADKjDBI.d.mts +1 -0
  91. package/dist/{types-DbrhszyQ.d.mts → types-Dy1q0CSu.d.mts} +101 -64
  92. package/dist/types.d.mts +6 -6
  93. package/dist/types.mjs +4 -4
  94. package/dist/utf16-slice-CvGodqok.mjs +29 -0
  95. package/dist/{validation-CJZtym2g.mjs → validation-BDzVDnTs.mjs} +9 -1
  96. package/dist/{validation-BOwtcl9X.d.mts → validation-CaFUZN9B.d.mts} +1 -1
  97. package/dist/validation.d.mts +1 -1
  98. package/dist/validation.mjs +1 -1
  99. package/package.json +14 -4
  100. package/dist/anthropic-compaction-replay-OMJZ0uyo.mjs +0 -838
  101. package/dist/anthropic-hk7F7ptG.mjs +0 -883
  102. package/dist/anthropic-payload-policy-DBT1itQ-.d.mts +0 -51
  103. package/dist/event-stream-DeDhbCc5.d.mts +0 -1
  104. package/dist/google-shared-CjPY0hZM.mjs +0 -634
  105. package/dist/google-thinking-level-C-V3tecN.mjs +0 -9
  106. package/dist/openai-completions-D0QZ0AyB.mjs +0 -403
  107. package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
  108. package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
  109. package/dist/transport-utils-CtuS1Upe.mjs +0 -138
  110. package/dist/types-B5EFUmXs.d.mts +0 -1
  111. package/dist/utf16-slice-qz3nsy87.mjs +0 -84
@@ -0,0 +1 @@
1
+ import "./index-CQ6LTHw8.mjs";
@@ -1,5 +1,64 @@
1
1
  import { t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
2
2
  import { TSchema } from "typebox";
3
+ //#region packages/llm-core/src/model-data.d.ts
4
+ declare const MODEL_DATA_THINKING_FORMATS: readonly ["openai", "openrouter", "deepseek", "together", "qwen", "qwen-chat-template", "zai"];
5
+ type ModelDataThinkingFormat = (typeof MODEL_DATA_THINKING_FORMATS)[number];
6
+ declare const MODEL_DATA_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
7
+ type ModelDataThinkingLevel = (typeof MODEL_DATA_THINKING_LEVELS)[number];
8
+ type ModelDataThinkingLevelMap = Partial<Record<ModelDataThinkingLevel, string | null>>;
9
+ type ModelDataImageInputConfig = {
10
+ /** Provider-documented maximum encoded image payload size. */
11
+ maxBytes?: number;
12
+ /** Provider-documented maximum accepted input pixels. */
13
+ maxPixels?: number;
14
+ /** Provider-documented maximum accepted width/height in pixels. */
15
+ maxSidePx?: number;
16
+ /** Preferred resize side for the default balanced compression policy. */
17
+ preferredSidePx?: number;
18
+ /** Token accounting style, used as documentation for provider-owned policy. */
19
+ tokenMode?: "tile" | "detail" | "provider";
20
+ };
21
+ type ModelDataMediaInputConfig = {
22
+ /** Image input limits and accounting hints for this model. */
23
+ image?: ModelDataImageInputConfig;
24
+ };
25
+ /** Per-million-token rates for separately billed token buckets. */
26
+ type ModelDataCostRates = {
27
+ input: number;
28
+ output: number;
29
+ cacheRead: number;
30
+ cacheWrite: number;
31
+ };
32
+ type ModelDataRawPricingTier = ModelDataCostRates & {
33
+ /** Half-open prompt-token interval; `[start]` is an open-ended upper tier. */
34
+ range: [number, number] | [number];
35
+ };
36
+ type ModelRoutingSortConfig = {
37
+ /** The sorting metric: "price", "throughput", "latency". */
38
+ by?: string;
39
+ /** Partitioning strategy: "model" (default) or "none". */
40
+ partition?: string | null;
41
+ };
42
+ type ModelRoutingMaxPrice = {
43
+ /** Price per million prompt tokens. */
44
+ prompt?: number | string;
45
+ /** Price per million completion tokens. */
46
+ completion?: number | string;
47
+ /** Price per image. */
48
+ image?: number | string;
49
+ /** Price per audio unit. */
50
+ audio?: number | string;
51
+ /** Price per request. */
52
+ request?: number | string;
53
+ };
54
+ /** Percentile targets in the owning field's throughput or latency units. */
55
+ type ModelRoutingPercentiles = {
56
+ p50?: number;
57
+ p75?: number;
58
+ p90?: number;
59
+ p99?: number;
60
+ };
61
+ //#endregion
3
62
  //#region packages/llm-core/src/types.d.ts
4
63
  /** Provider API families with first-class request/stream adapters in OpenClaw. */
5
64
  type KnownApi = "openai-completions" | "mistral-conversations" | "openai-responses" | "azure-openai-responses" | "openai-chatgpt-responses" | "anthropic-messages" | "bedrock-converse-stream" | "google-generative-ai" | "google-vertex";
@@ -16,11 +75,11 @@ type KnownImagesProvider = "openrouter";
16
75
  /** Image provider id used for routing, diagnostics, and config lookups. */
17
76
  type ImagesProvider = string;
18
77
  /** Normalized reasoning-effort levels shared across provider-specific knobs. */
19
- type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
78
+ type ThinkingLevel = Exclude<ModelDataThinkingLevel, "off">;
20
79
  /** Model thinking setting including explicit disabled state. */
21
- type ModelThinkingLevel = "off" | ThinkingLevel;
80
+ type ModelThinkingLevel = ModelDataThinkingLevel;
22
81
  /** Provider-specific values for normalized thinking levels. */
23
- type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;
82
+ type ThinkingLevelMap = ModelDataThinkingLevelMap;
24
83
  /** Token budgets for each thinking level (token-based providers only) */
25
84
  interface ThinkingBudgets {
26
85
  minimal?: number;
@@ -93,6 +152,23 @@ interface StreamOptions {
93
152
  * its body stream is consumed.
94
153
  */
95
154
  onResponse?: (response: ProviderResponse, model: Model) => void | Promise<void>;
155
+ /**
156
+ * Observe a live response that accepts user input before generation finishes.
157
+ * `steer` resolves false only when the input was definitely not admitted;
158
+ * admitted input cannot be withdrawn. Providers settle pending submissions
159
+ * before closing the response and call the returned cleanup on closure.
160
+ */
161
+ onActiveResponse?: (control: {
162
+ steer(messages: readonly UserMessage[]): Promise<boolean>;
163
+ /** Read-only after closure: deferred input still needs an explicit continuation request. */
164
+ needsContinuation?: () => boolean;
165
+ }) => (() => void) | void;
166
+ /**
167
+ * The caller can execute completed async calls before generation finishes.
168
+ * Providers advertise async tools only with this host capability; this is
169
+ * independent of parallel execution of an ordinary completed tool batch.
170
+ */
171
+ asyncToolExecution?: boolean;
96
172
  /**
97
173
  * Optional custom HTTP headers to include in API requests.
98
174
  * Merged with provider defaults; can override default headers.
@@ -104,6 +180,8 @@ interface StreamOptions {
104
180
  * For example, OpenAI and Anthropic SDK clients default to 10 minutes.
105
181
  */
106
182
  timeoutMs?: number;
183
+ /** @deprecated Ignored by built-in text transports; retries are owned by the host runner. */
184
+ maxRetries?: number;
107
185
  /**
108
186
  * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
109
187
  * If the server's requested delay exceeds this value, the request fails immediately
@@ -212,6 +290,8 @@ interface ImageContent {
212
290
  }
213
291
  /** Normalized assistant tool call emitted by providers or repaired from text. */
214
292
  interface ToolCall {
293
+ /** The provider completed this call and permits generation to continue without its result. */
294
+ async?: true;
215
295
  type: "toolCall";
216
296
  id: string;
217
297
  name: string;
@@ -251,16 +331,13 @@ interface Usage {
251
331
  };
252
332
  }
253
333
  /** Per-million-token rates for separately billed token buckets. */
254
- type ModelCostRates = Pick<Usage["cost"], "input" | "output" | "cacheRead" | "cacheWrite">;
334
+ type ModelCostRates = ModelDataCostRates;
255
335
  /** One whole-request tier on the cache-inclusive prompt-token axis. */
256
336
  type PricingTier = ModelCostRates & {
257
337
  /** Half-open prompt-token interval `[start, end)`. */
258
338
  range: [number, number];
259
339
  };
260
- type RawPricingTier = ModelCostRates & {
261
- /** `[start]` is an open-ended upper tier. */
262
- range: [number, number] | [number];
263
- };
340
+ type RawPricingTier = ModelDataRawPricingTier;
264
341
  /** Normalized pricing used by token accounting and usage summaries. */
265
342
  type ModelCostConfig = ModelCostRates & {
266
343
  tieredPricing?: PricingTier[];
@@ -279,12 +356,9 @@ interface UserMessage {
279
356
  content: string | (TextContent | ImageContent)[];
280
357
  timestamp: number;
281
358
  /**
282
- * Marks a user message that carries transient current-turn runtime context
283
- * (e.g. an OpenClaw runtime-context carrier appended after the active user
284
- * turn). Such messages are volatile present only on the turn they belong to
285
- * and stripped on replay — so providers must NOT anchor a prompt-cache
286
- * breakpoint on them, or the breakpoint would land on bytes that change every
287
- * turn. Anchoring stays on the last stable (non-carrier) user message.
359
+ * Marks a user message carrying runtime context. Provider replay policy decides
360
+ * whether the carrier is transient or retained append-only; only retained
361
+ * carriers are stable prompt-cache anchors.
288
362
  */
289
363
  runtimeContextCarrier?: boolean;
290
364
  }
@@ -479,7 +553,7 @@ interface OpenAICompletionsCompat {
479
553
  /** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */
480
554
  requiresReasoningContentOnAssistantMessages?: boolean;
481
555
  /** Format for reasoning/thinking parameter. "openai" uses reasoning_effort, "openrouter" uses reasoning: { effort }, "deepseek" uses thinking: { type } plus reasoning_effort, "together" uses reasoning: { enabled } plus reasoning_effort when supported, "zai" uses top-level enable_thinking: boolean, "qwen" uses top-level enable_thinking: boolean, and "qwen-chat-template" uses chat_template_kwargs.enable_thinking. Default: "openai". */
482
- thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "zai" | "qwen" | "qwen-chat-template";
556
+ thinkingFormat?: ModelDataThinkingFormat;
483
557
  /** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */
484
558
  openRouterRouting?: OpenRouterRouting;
485
559
  /** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */
@@ -503,6 +577,10 @@ interface OpenAICompletionsCompat {
503
577
  interface OpenAIResponsesCompat {
504
578
  /** Whether the provider supports the `developer` role (vs `system`). Default: true. */
505
579
  supportsDeveloperRole?: boolean;
580
+ /** Whether to send reasoning effort settings. Defaults to the model's known capabilities. */
581
+ supportsReasoningEffort?: boolean;
582
+ /** Provider-native reasoning efforts accepted by the model. Overrides known model defaults. */
583
+ supportedReasoningEfforts?: string[];
506
584
  /** Whether the model accepts the `temperature` parameter. Default: true. */
507
585
  supportsTemperature?: boolean;
508
586
  /** Whether to send the OpenAI `session_id` cache-affinity header from `options.sessionId` when caching is enabled. Default: true. */
@@ -547,6 +625,7 @@ interface AnthropicMessagesCompat {
547
625
  * OpenRouter provider routing preferences.
548
626
  * Controls which upstream providers OpenRouter routes requests to.
549
627
  * Sent as the `provider` field in the OpenRouter API request body.
628
+ * Own member declarations preserve existing module-augmentation semantics.
550
629
  * @see https://openrouter.ai/docs/guides/routing/provider-selection
551
630
  */
552
631
  interface OpenRouterRouting {
@@ -569,47 +648,13 @@ interface OpenRouterRouting {
569
648
  /** A list of quantization levels to filter providers by (e.g., ["fp16", "bf16", "fp8", "fp6", "int8", "int4", "fp4", "fp32"]). */
570
649
  quantizations?: string[];
571
650
  /** Sorting strategy. Can be a string (e.g., "price", "throughput", "latency") or an object with `by` and `partition`. */
572
- sort?: string | {
573
- /** The sorting metric: "price", "throughput", "latency". */
574
- by?: string;
575
- /** Partitioning strategy: "model" (default) or "none". */
576
- partition?: string | null;
577
- };
651
+ sort?: string | ModelRoutingSortConfig;
578
652
  /** Maximum price per million tokens (USD). */
579
- max_price?: {
580
- /** Price per million prompt tokens. */
581
- prompt?: number | string;
582
- /** Price per million completion tokens. */
583
- completion?: number | string;
584
- /** Price per image. */
585
- image?: number | string;
586
- /** Price per audio unit. */
587
- audio?: number | string;
588
- /** Price per request. */
589
- request?: number | string;
590
- };
653
+ max_price?: ModelRoutingMaxPrice;
591
654
  /** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
592
- preferred_min_throughput?: number | {
593
- /** Minimum tokens/second at the 50th percentile. */
594
- p50?: number;
595
- /** Minimum tokens/second at the 75th percentile. */
596
- p75?: number;
597
- /** Minimum tokens/second at the 90th percentile. */
598
- p90?: number;
599
- /** Minimum tokens/second at the 99th percentile. */
600
- p99?: number;
601
- };
655
+ preferred_min_throughput?: number | ModelRoutingPercentiles;
602
656
  /** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
603
- preferred_max_latency?: number | {
604
- /** Maximum latency in seconds at the 50th percentile. */
605
- p50?: number;
606
- /** Maximum latency in seconds at the 75th percentile. */
607
- p75?: number;
608
- /** Maximum latency in seconds at the 90th percentile. */
609
- p90?: number;
610
- /** Maximum latency in seconds at the 99th percentile. */
611
- p99?: number;
612
- };
657
+ preferred_max_latency?: number | ModelRoutingPercentiles;
613
658
  }
614
659
  /**
615
660
  * Vercel AI Gateway routing preferences.
@@ -650,17 +695,9 @@ interface Model<TApi extends Api = Api> {
650
695
  /** Sends runtime credentials as Authorization: Bearer instead of provider-specific key headers. */
651
696
  authHeader?: boolean;
652
697
  /** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */
653
- compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : never;
698
+ compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "azure-openai-responses" | "openai-codex-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : never;
654
699
  /** Provider-documented media input limits used by attachment preprocessing. */
655
- mediaInput?: {
656
- image?: {
657
- maxBytes?: number;
658
- maxPixels?: number;
659
- maxSidePx?: number;
660
- preferredSidePx?: number;
661
- tokenMode?: "tile" | "detail" | "provider";
662
- };
663
- };
700
+ mediaInput?: ModelDataMediaInputConfig;
664
701
  }
665
702
  interface ImagesModel<TApi extends ImagesApi = ImagesApi> extends Omit<Model, "api" | "provider" | "reasoning" | "contextWindow" | "maxTokens" | "compat"> {
666
703
  api: TApi;
@@ -671,4 +708,4 @@ type StreamFn = (model: Model, context: Context, options?: SimpleStreamOptions)
671
708
  type CompleteSimpleFn = (model: Model, context: Pick<Context, "systemPrompt" | "messages">, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
672
709
  type ValidateToolArgumentsFn = (tool: Tool, toolCall: ToolCall) => unknown;
673
710
  //#endregion
674
- export { ThinkingLevel as $, ModelThinkingLevel as A, ProviderResponse as B, KnownImagesApi as C, Model as D, Message as E, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as F, StopReason as G, RawModelCostConfig as H, PricingTier as I, StreamOptions as J, StreamFn as K, Provider as L, OpenAIResponsesCompat as M, OpenRouterRouting as N, ModelCostConfig as O, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as P, ThinkingContent as Q, ProviderImagesOptions as R, KnownApi as S, MaybePromise as T, RawPricingTier as U, ProviderStreamOptions as V, SimpleStreamOptions as W, TextSignatureV1 as X, TextContent as Y, ThinkingBudgets as Z, ImagesModel as _, AssistantMessage as a, Usage as at, ImagesProvider as b, AssistantMessageEventStreamLike as c, VercelGatewayRouting as ct, Context as d, ThinkingLevelMap as et, ImageContent as f, ImagesInputContent as g, ImagesFunction as h, AssistantImages as i, Transport as it, OpenAICompletionsCompat as j, ModelCostRates as k, CacheRetention as l, ImagesContext as m, Api as n, ToolCall as nt, AssistantMessageEvent as o, UserMessage as ot, ImagesApi as p, StreamFunction as q, AssistantDeliveryTtsFacts as r, ToolResultMessage as rt, AssistantMessageEventStreamContract as s, ValidateToolArgumentsFn as st, AnthropicMessagesCompat as t, Tool as tt, CompleteSimpleFn as u, ImagesOptions as v, KnownImagesProvider as w, ImagesStopReason as x, ImagesOutputContent as y, ProviderReplayState as z };
711
+ export { ThinkingLevel as $, ModelThinkingLevel as A, ProviderResponse as B, KnownImagesApi as C, Model as D, Message as E, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as F, StopReason as G, RawModelCostConfig as H, PricingTier as I, StreamOptions as J, StreamFn as K, Provider as L, OpenAIResponsesCompat as M, OpenRouterRouting as N, ModelCostConfig as O, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as P, ThinkingContent as Q, ProviderImagesOptions as R, KnownApi as S, MaybePromise as T, RawPricingTier as U, ProviderStreamOptions as V, SimpleStreamOptions as W, TextSignatureV1 as X, TextContent as Y, ThinkingBudgets as Z, ImagesModel as _, AssistantMessage as a, Usage as at, ImagesProvider as b, AssistantMessageEventStreamLike as c, VercelGatewayRouting as ct, Context as d, ThinkingLevelMap as et, ImageContent as f, ImagesInputContent as g, ImagesFunction as h, AssistantImages as i, Transport as it, OpenAICompletionsCompat as j, ModelCostRates as k, CacheRetention as l, ModelDataThinkingFormat as lt, ImagesContext as m, Api as n, ToolCall as nt, AssistantMessageEvent as o, UserMessage as ot, ImagesApi as p, StreamFunction as q, AssistantDeliveryTtsFacts as r, ToolResultMessage as rt, AssistantMessageEventStreamContract as s, ValidateToolArgumentsFn as st, AnthropicMessagesCompat as t, Tool as tt, CompleteSimpleFn as u, ImagesOptions as v, KnownImagesProvider as w, ImagesStopReason as x, ImagesOutputContent as y, ProviderReplayState as z };
package/dist/types.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./index-AfaxKT8w.mjs";
1
+ import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-CQ6LTHw8.mjs";
2
+ import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, E as Message, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, V as ProviderStreamOptions, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, q as StreamFunction, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-Dy1q0CSu.mjs";
2
3
  import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, s as isProviderRefusalAssistantError, t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
3
- import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, E as Message, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, V as ProviderStreamOptions, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, q as StreamFunction, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-DbrhszyQ.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-vK_7r3bj.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-BOwtcl9X.mjs";
6
- import "./types-B5EFUmXs.mjs";
7
- export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
4
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-C1Z2piyk.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-CaFUZN9B.mjs";
6
+ import "./types-BADKjDBI.mjs";
7
+ export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
package/dist/types.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as supportsClaudeFastMode, a as CLAUDE_OPUS_5_THINKING_PROFILE, c as requiresClaudeMandatoryAdaptiveThinking, d as resolveClaudeMythos5ModelIdentity, f as resolveClaudeNativeThinkingLevelMap, g as supportsClaudeAdaptiveThinking, h as supportsClaude1MContext, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as resolveClaudeFable5ModelIdentity, m as resolveClaudeSonnet5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeOpus5ModelIdentity, r as normalizeResolvedPricing, s as requiresClaudeDefaultSampling, t as calculateUsageCost, u as resolveClaudeModelIdentity, v as supportsClaudeNativeMaxEffort, y as supportsClaudeNativeXhighEffort } from "./src-C8U7lkoa.mjs";
1
+ import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeResolvedPricing, s as bindsClaudeThinkingPrefix, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./src-B2Q_6G8V.mjs";
2
2
  import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
3
3
  import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
6
- export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
4
+ import { i as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-BDzVDnTs.mjs";
6
+ export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
@@ -0,0 +1,29 @@
1
+ //#region packages/normalization-core/src/utf16-slice.ts
2
+ function isHighSurrogate(codeUnit) {
3
+ return codeUnit >= 55296 && codeUnit <= 56319;
4
+ }
5
+ function isLowSurrogate(codeUnit) {
6
+ return codeUnit >= 56320 && codeUnit <= 57343;
7
+ }
8
+ /** Slices a UTF-16 string without returning dangling surrogate halves at either edge. */
9
+ function sliceUtf16Safe(input, start, end) {
10
+ const len = input.length;
11
+ let from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
12
+ let to = end === void 0 ? len : end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
13
+ if (to <= from) return "";
14
+ if (from > 0 && from < len) {
15
+ if (isLowSurrogate(input.charCodeAt(from)) && isHighSurrogate(input.charCodeAt(from - 1))) from += 1;
16
+ }
17
+ if (to > 0 && to < len) {
18
+ if (isHighSurrogate(input.charCodeAt(to - 1)) && isLowSurrogate(input.charCodeAt(to))) to -= 1;
19
+ }
20
+ return input.slice(from, to);
21
+ }
22
+ /** Truncates a UTF-16 string without cutting a surrogate pair in half. */
23
+ function truncateUtf16Safe(input, maxLen) {
24
+ const limit = Math.max(0, Math.floor(maxLen));
25
+ if (input.length <= limit) return input;
26
+ return sliceUtf16Safe(input, 0, limit);
27
+ }
28
+ //#endregion
29
+ export { truncateUtf16Safe as t };
@@ -127,6 +127,8 @@ function coerceWithUnionSchema(value, schemas) {
127
127
  }
128
128
  }
129
129
  for (const schema of schemas) {
130
+ const types = getSchemaTypes(schema);
131
+ if (value !== null && types.length === 1 && types[0] === "null") continue;
130
132
  const coerced = coerceWithJsonSchema(structuredClone(value), schema);
131
133
  if (getSubSchemaValidator(schema)?.Check(coerced)) return coerced;
132
134
  }
@@ -174,11 +176,15 @@ function validateToolCall(tools, toolCall) {
174
176
  if (!tool) throw new Error(`Tool "${toolCall.name}" not found`);
175
177
  return validateToolArguments(tool, toolCall);
176
178
  }
179
+ function introducesNullValue(previous, converted) {
180
+ if (converted === null) return previous !== null;
181
+ if (!isObjectBackedRecord(previous) || !isObjectBackedRecord(converted)) return false;
182
+ return Object.entries(converted).some(([key, value]) => introducesNullValue(previous[key], value));
183
+ }
177
184
  /** Validates tool arguments against TypeBox or plain JSON-schema parameters. */
178
185
  function validateToolArguments(tool, toolCall) {
179
186
  const args = structuredClone(toolCall.arguments);
180
187
  const validator = getValidator(tool.parameters);
181
- validator.Convert(args);
182
188
  if (isJsonSchemaObject(tool.parameters)) {
183
189
  const coerced = coerceWithJsonSchema(args, tool.parameters);
184
190
  if (coerced !== args) {
@@ -189,6 +195,8 @@ function validateToolArguments(tool, toolCall) {
189
195
  }
190
196
  }
191
197
  if (validator.Check(args)) return args;
198
+ const converted = validator.Convert(structuredClone(args));
199
+ if (!introducesNullValue(args, converted) && validator.Check(converted)) return converted;
192
200
  const errors = validator.Errors(args).map((error) => ` - ${formatValidationPath(error)}: ${error.message}`).join("\n") || "Unknown validation error";
193
201
  throw new Error(`Validation failed for tool "${toolCall.name}":\n${errors}\n\nReceived arguments:\n${JSON.stringify(toolCall.arguments, null, 2)}`);
194
202
  }
@@ -1,4 +1,4 @@
1
- import { nt as ToolCall, tt as Tool } from "./types-DbrhszyQ.mjs";
1
+ import { nt as ToolCall, tt as Tool } from "./types-Dy1q0CSu.mjs";
2
2
  //#region packages/llm-core/src/validation.d.ts
3
3
  /** Finds the target tool and validates/coerces a model-emitted tool call. */
4
4
  declare function validateToolCall(tools: Tool[], toolCall: ToolCall): unknown;
@@ -1,2 +1,2 @@
1
- import { n as validateToolCall, t as validateToolArguments } from "./validation-BOwtcl9X.mjs";
1
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-CaFUZN9B.mjs";
2
2
  export { validateToolArguments, validateToolCall };
@@ -1,2 +1,2 @@
1
- import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
1
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-BDzVDnTs.mjs";
2
2
  export { validateToolArguments, validateToolCall };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/ai",
3
- "version": "2026.9.1",
3
+ "version": "2026.9.3",
4
4
  "description": "Reusable model provider adapters and streaming runtime from OpenClaw",
5
5
  "keywords": [
6
6
  "ai",
@@ -76,6 +76,11 @@
76
76
  "import": "./dist/internal/anthropic.mjs",
77
77
  "default": "./dist/internal/anthropic.mjs"
78
78
  },
79
+ "./internal/google-model-family": {
80
+ "types": "./dist/internal/google-model-family.d.mts",
81
+ "import": "./dist/internal/google-model-family.mjs",
82
+ "default": "./dist/internal/google-model-family.mjs"
83
+ },
79
84
  "./internal/openai": {
80
85
  "types": "./dist/internal/openai.d.mts",
81
86
  "import": "./dist/internal/openai.mjs",
@@ -100,15 +105,20 @@
100
105
  "types": "./dist/internal/shared.d.mts",
101
106
  "import": "./dist/internal/shared.mjs",
102
107
  "default": "./dist/internal/shared.mjs"
108
+ },
109
+ "./internal/tool-schema": {
110
+ "types": "./dist/internal/tool-schema.d.mts",
111
+ "import": "./dist/internal/tool-schema.mjs",
112
+ "default": "./dist/internal/tool-schema.mjs"
103
113
  }
104
114
  },
105
115
  "dependencies": {
106
116
  "@anthropic-ai/sdk": "0.120.0",
107
- "@google/genai": "2.18.0",
117
+ "@google/genai": "2.19.0",
108
118
  "@mistralai/mistralai": "2.6.4",
109
- "openai": "7.5.0",
119
+ "openai": "7.8.0",
110
120
  "partial-json": "0.1.7",
111
- "typebox": "1.3.17"
121
+ "typebox": "1.3.18"
112
122
  },
113
123
  "devDependencies": {
114
124
  "@openclaw/model-catalog-core": "0.0.0-private",