@openclaw/ai 2026.9.2 → 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 (108) hide show
  1. package/README.md +3 -2
  2. package/dist/anthropic-CZy5U0NY.mjs +376 -0
  3. package/dist/{anthropic-payload-policy-d46X2pR0.d.mts → anthropic-payload-policy-wuRCb6MH.d.mts} +16 -6
  4. package/dist/{anthropic-compaction-replay-DB2FGLQc.mjs → anthropic-stream-reducer-B_yo_7pf.mjs} +923 -181
  5. package/dist/{api-registry-DWtPjzyn.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-C5bZRfAP.mjs → azure-openai-responses-Crpa40QR.mjs} +5 -5
  9. package/dist/{base64-CEFBpSkN.mjs → base64-D-su8YVo.mjs} +1 -27
  10. package/dist/{diagnostics-DfFyKeX_.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-BhT5T1Ay.d.mts → event-stream-C1Z2piyk.d.mts} +11 -3
  14. package/dist/{event-stream-BgDvQeum.mjs → event-stream-D8PARQfL.mjs} +45 -1
  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-4qeuE8iX.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-O9BcnB6X.mjs → google-vertex-DMz8XQCn.mjs} +7 -6
  24. package/dist/{host-CEvLw30U.mjs → host-CWuF-sS3.mjs} +44 -39
  25. package/dist/{host-DjzGmdZ2.d.mts → host-DK3wmS3e.d.mts} +3 -3
  26. package/dist/host-policy-CAopLRKA.mjs +37 -0
  27. package/dist/{index-FnHM2FcI.d.mts → index-CQ6LTHw8.d.mts} +3 -3
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +4 -4
  30. package/dist/internal/anthropic.d.mts +7 -7
  31. package/dist/internal/anthropic.mjs +4 -4
  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-Tb6oalqH.mjs → mistral--m-Jm6VZ.mjs} +13 -37
  48. package/dist/model-transport-url-DKocrEsb.d.mts +28 -0
  49. package/dist/{openai-chatgpt-responses-yUXjPNfu.mjs → openai-chatgpt-responses-nDZccFW-.mjs} +48 -38
  50. package/dist/openai-completions-KuoZyx0d.mjs +187 -0
  51. package/dist/{openai-completions-compat-CpjYUArk.d.mts → openai-completions-compat-CXn3T1we.d.mts} +26 -4
  52. package/dist/{openai-completions-stream-BsrBe3Gg.mjs → openai-completions-stream-BQk3SkLD.mjs} +622 -452
  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-CCL41ALM.mjs → openai-responses-D99dOzKI.mjs} +14 -29
  58. package/dist/{openai-responses-compaction-window-BMVHFOtq.mjs → openai-responses-compaction-window-D5jbzCi3.mjs} +7 -170
  59. package/dist/{openai-responses-contracts-rF5DDRNS.d.mts → openai-responses-contracts-B55afwRo.d.mts} +3 -3
  60. package/dist/{openai-responses-prompt-observer-internal-D0bhBfgL.mjs → openai-responses-prompt-observer-internal-tApyTLVu.mjs} +3 -3
  61. package/dist/{openai-responses-shared-Bmma_3Qc.mjs → openai-responses-shared-ZyQEzS5i.mjs} +44 -115
  62. package/dist/openai-tool-projection-793cE3QX.d.mts +37 -0
  63. package/dist/{openai-tool-schema-_pTAJqKF.mjs → openai-tool-schema-CzjyYXun.mjs} +38 -556
  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-9TraxGvt.mjs → provider-error-C6TbKiey.mjs} +23 -6
  67. package/dist/{provider-options-Bcc_p-TU.d.mts → provider-options-BXr9Ec83.d.mts} +4 -39
  68. package/dist/{provider-transcript-transform-BaMbI1hr.mjs → provider-transcript-transform-pPmUIwKt.mjs} +1 -1
  69. package/dist/provider-types-CAV0Og3m.d.mts +29 -0
  70. package/dist/provider-types.d.mts +6 -31
  71. package/dist/providers.d.mts +2 -2
  72. package/dist/providers.mjs +11 -11
  73. package/dist/{reasoning-tag-text-partitioner-DLCNXki6.mjs → reasoning-tag-text-partitioner-BQBi4B9d.mjs} +19 -12
  74. package/dist/record-coerce-DwRYMj3t.mjs +32 -0
  75. package/dist/retry-after-CdCURCVg.d.mts +15 -0
  76. package/dist/{sanitize-unicode-D6xUvZaS.mjs → sanitize-unicode-Bb-v9meu.mjs} +1 -1
  77. package/dist/session-affinity-CCH7eYdB.mjs +20 -0
  78. package/dist/{simple-options-BjHCCh4v.mjs → simple-options-tcKOqnpF.mjs} +3 -3
  79. package/dist/{src-2qBGKg8O.mjs → src-B2Q_6G8V.mjs} +1 -1
  80. package/dist/{stream-first-event-timeout-DcNjoFQE.mjs → stream-first-event-timeout-2hfrquuz.mjs} +1 -1
  81. package/dist/string-coerce-fsri9iCu.mjs +34 -0
  82. package/dist/{string-normalization--fwJ4S2q.mjs → string-normalization-CmLIasuf.mjs} +1 -1
  83. package/dist/{tool-schema-json-projection-mJhXDcyz.mjs → tool-schema-json-projection-ClptDdAO.mjs} +2 -38
  84. package/dist/{transport-stream-shared-CZqMhfIw.mjs → transport-stream-shared-Cu3ZPhNW.mjs} +5 -5
  85. package/dist/{transport-stream-shared-xnaqxmbP.d.mts → transport-stream-shared-DOxpGJ-H.d.mts} +4 -4
  86. package/dist/transport-utils-CCooe-cr.mjs +121 -0
  87. package/dist/transports.d.mts +113 -41
  88. package/dist/transports.mjs +162 -1276
  89. package/dist/types-BADKjDBI.d.mts +1 -0
  90. package/dist/{types-CJ1-Ht7A.d.mts → types-Dy1q0CSu.d.mts} +72 -57
  91. package/dist/types.d.mts +5 -5
  92. package/dist/types.mjs +3 -3
  93. package/dist/utf16-slice-CvGodqok.mjs +29 -0
  94. package/dist/{validation-CJZtym2g.mjs → validation-BDzVDnTs.mjs} +9 -1
  95. package/dist/{validation-AKZBDGQd.d.mts → validation-CaFUZN9B.d.mts} +1 -1
  96. package/dist/validation.d.mts +1 -1
  97. package/dist/validation.mjs +1 -1
  98. package/package.json +13 -3
  99. package/dist/anthropic-BDdqdVLK.mjs +0 -886
  100. package/dist/event-stream-zctLx0yr.d.mts +0 -1
  101. package/dist/google-shared-CWeG8RIl.mjs +0 -636
  102. package/dist/google-thinking-level-C-V3tecN.mjs +0 -9
  103. package/dist/openai-completions-BIUV3RDT.mjs +0 -403
  104. package/dist/openai-prompt-cache-CGnVB74a.mjs +0 -21
  105. package/dist/openai-prompt-cache-CNoIfHYC.d.mts +0 -16
  106. package/dist/transport-utils-7il795_9.mjs +0 -138
  107. package/dist/types-3Lnm-QSJ.d.mts +0 -1
  108. 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;
@@ -272,16 +331,13 @@ interface Usage {
272
331
  };
273
332
  }
274
333
  /** Per-million-token rates for separately billed token buckets. */
275
- type ModelCostRates = Pick<Usage["cost"], "input" | "output" | "cacheRead" | "cacheWrite">;
334
+ type ModelCostRates = ModelDataCostRates;
276
335
  /** One whole-request tier on the cache-inclusive prompt-token axis. */
277
336
  type PricingTier = ModelCostRates & {
278
337
  /** Half-open prompt-token interval `[start, end)`. */
279
338
  range: [number, number];
280
339
  };
281
- type RawPricingTier = ModelCostRates & {
282
- /** `[start]` is an open-ended upper tier. */
283
- range: [number, number] | [number];
284
- };
340
+ type RawPricingTier = ModelDataRawPricingTier;
285
341
  /** Normalized pricing used by token accounting and usage summaries. */
286
342
  type ModelCostConfig = ModelCostRates & {
287
343
  tieredPricing?: PricingTier[];
@@ -497,7 +553,7 @@ interface OpenAICompletionsCompat {
497
553
  /** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */
498
554
  requiresReasoningContentOnAssistantMessages?: boolean;
499
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". */
500
- thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "zai" | "qwen" | "qwen-chat-template";
556
+ thinkingFormat?: ModelDataThinkingFormat;
501
557
  /** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */
502
558
  openRouterRouting?: OpenRouterRouting;
503
559
  /** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */
@@ -569,6 +625,7 @@ interface AnthropicMessagesCompat {
569
625
  * OpenRouter provider routing preferences.
570
626
  * Controls which upstream providers OpenRouter routes requests to.
571
627
  * Sent as the `provider` field in the OpenRouter API request body.
628
+ * Own member declarations preserve existing module-augmentation semantics.
572
629
  * @see https://openrouter.ai/docs/guides/routing/provider-selection
573
630
  */
574
631
  interface OpenRouterRouting {
@@ -591,47 +648,13 @@ interface OpenRouterRouting {
591
648
  /** A list of quantization levels to filter providers by (e.g., ["fp16", "bf16", "fp8", "fp6", "int8", "int4", "fp4", "fp32"]). */
592
649
  quantizations?: string[];
593
650
  /** Sorting strategy. Can be a string (e.g., "price", "throughput", "latency") or an object with `by` and `partition`. */
594
- sort?: string | {
595
- /** The sorting metric: "price", "throughput", "latency". */
596
- by?: string;
597
- /** Partitioning strategy: "model" (default) or "none". */
598
- partition?: string | null;
599
- };
651
+ sort?: string | ModelRoutingSortConfig;
600
652
  /** Maximum price per million tokens (USD). */
601
- max_price?: {
602
- /** Price per million prompt tokens. */
603
- prompt?: number | string;
604
- /** Price per million completion tokens. */
605
- completion?: number | string;
606
- /** Price per image. */
607
- image?: number | string;
608
- /** Price per audio unit. */
609
- audio?: number | string;
610
- /** Price per request. */
611
- request?: number | string;
612
- };
653
+ max_price?: ModelRoutingMaxPrice;
613
654
  /** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
614
- preferred_min_throughput?: number | {
615
- /** Minimum tokens/second at the 50th percentile. */
616
- p50?: number;
617
- /** Minimum tokens/second at the 75th percentile. */
618
- p75?: number;
619
- /** Minimum tokens/second at the 90th percentile. */
620
- p90?: number;
621
- /** Minimum tokens/second at the 99th percentile. */
622
- p99?: number;
623
- };
655
+ preferred_min_throughput?: number | ModelRoutingPercentiles;
624
656
  /** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
625
- preferred_max_latency?: number | {
626
- /** Maximum latency in seconds at the 50th percentile. */
627
- p50?: number;
628
- /** Maximum latency in seconds at the 75th percentile. */
629
- p75?: number;
630
- /** Maximum latency in seconds at the 90th percentile. */
631
- p90?: number;
632
- /** Maximum latency in seconds at the 99th percentile. */
633
- p99?: number;
634
- };
657
+ preferred_max_latency?: number | ModelRoutingPercentiles;
635
658
  }
636
659
  /**
637
660
  * Vercel AI Gateway routing preferences.
@@ -674,15 +697,7 @@ interface Model<TApi extends Api = Api> {
674
697
  /** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */
675
698
  compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "azure-openai-responses" | "openai-codex-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : never;
676
699
  /** Provider-documented media input limits used by attachment preprocessing. */
677
- mediaInput?: {
678
- image?: {
679
- maxBytes?: number;
680
- maxPixels?: number;
681
- maxSidePx?: number;
682
- preferredSidePx?: number;
683
- tokenMode?: "tile" | "detail" | "provider";
684
- };
685
- };
700
+ mediaInput?: ModelDataMediaInputConfig;
686
701
  }
687
702
  interface ImagesModel<TApi extends ImagesApi = ImagesApi> extends Omit<Model, "api" | "provider" | "reasoning" | "contextWindow" | "maxTokens" | "compat"> {
688
703
  api: TApi;
@@ -693,4 +708,4 @@ type StreamFn = (model: Model, context: Context, options?: SimpleStreamOptions)
693
708
  type CompleteSimpleFn = (model: Model, context: Pick<Context, "systemPrompt" | "messages">, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
694
709
  type ValidateToolArgumentsFn = (tool: Tool, toolCall: ToolCall) => unknown;
695
710
  //#endregion
696
- 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 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-FnHM2FcI.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-CJ1-Ht7A.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BhT5T1Ay.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-AKZBDGQd.mjs";
6
- import "./types-3Lnm-QSJ.mjs";
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
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 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-2qBGKg8O.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-BgDvQeum.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
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
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-CJ1-Ht7A.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-AKZBDGQd.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.2",
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,13 +105,18 @@
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
121
  "typebox": "1.3.18"
112
122
  },