@openclaw/ai 2026.9.3 → 2026.9.4

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 (80) hide show
  1. package/dist/{anthropic-CZy5U0NY.mjs → anthropic-C4Qu4H0Z.mjs} +14 -13
  2. package/dist/{anthropic-payload-policy-wuRCb6MH.d.mts → anthropic-payload-policy-BZ8umAbk.d.mts} +3 -3
  3. package/dist/{anthropic-stream-reducer-B_yo_7pf.mjs → anthropic-stream-reducer-CILWF7JD.mjs} +17 -12
  4. package/dist/{api-registry-CB1-1oQ2.d.mts → api-registry-ByUwIR0e.d.mts} +2 -2
  5. package/dist/{assistant-output-iqnlJCV2.mjs → assistant-output-tLt4H-iQ.mjs} +1 -1
  6. package/dist/{azure-openai-responses-Crpa40QR.mjs → azure-openai-responses-BAlqlKKc.mjs} +4 -4
  7. package/dist/{diagnostics-dV98PqIy.mjs → diagnostics-QuErwCIl.mjs} +1 -1
  8. package/dist/diagnostics.mjs +2 -2
  9. package/dist/{event-stream-C1Z2piyk.d.mts → event-stream-Bt5Y4Pav.d.mts} +1 -1
  10. package/dist/event-stream-C3WGFsum.d.mts +1 -0
  11. package/dist/event-stream.d.mts +2 -2
  12. package/dist/{google-BDPriaVe.mjs → google-DPBAOaOW.mjs} +6 -6
  13. package/dist/{google-messages-CVn9eFpF.mjs → google-messages-6JkpHrhJ.mjs} +3 -4
  14. package/dist/{google-shared-BedY23XS.mjs → google-shared-BvBeW9aq.mjs} +5 -5
  15. package/dist/{google-vertex-DMz8XQCn.mjs → google-vertex-k-TMCAYD.mjs} +4 -4
  16. package/dist/{host-DK3wmS3e.d.mts → host-4atIX-2V.d.mts} +5 -3
  17. package/dist/{host-CWuF-sS3.mjs → host-B8YfDGd4.mjs} +140 -5
  18. package/dist/{host-policy-CAopLRKA.mjs → host-policy-Zcg_cNz8.mjs} +1 -1
  19. package/dist/{index-CQ6LTHw8.d.mts → index-DdD3qerf.d.mts} +4 -4
  20. package/dist/index.d.mts +7 -7
  21. package/dist/index.mjs +5 -4
  22. package/dist/internal/anthropic.d.mts +5 -5
  23. package/dist/internal/anthropic.mjs +4 -4
  24. package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
  25. package/dist/internal/openai-responses-payload-policy.mjs +3 -2
  26. package/dist/internal/openai.d.mts +6 -6
  27. package/dist/internal/openai.mjs +8 -9
  28. package/dist/internal/runtime.d.mts +43 -8
  29. package/dist/internal/runtime.mjs +3 -5
  30. package/dist/internal/shared.d.mts +32 -3
  31. package/dist/internal/shared.mjs +3 -4
  32. package/dist/{mistral--m-Jm6VZ.mjs → mistral-CxUZ1jUb.mjs} +5 -8
  33. package/dist/{openai-chatgpt-responses-nDZccFW-.mjs → openai-chatgpt-responses-CgO6kZfo.mjs} +13 -14
  34. package/dist/{openai-completions-compat-CXn3T1we.d.mts → openai-completions-compat-eHgh5UPE.d.mts} +3 -3
  35. package/dist/{openai-completions-stream-BQk3SkLD.mjs → openai-completions-stream-Da2vvl-S.mjs} +45 -14
  36. package/dist/{openai-completions-KuoZyx0d.mjs → openai-completions-yJuk7eis.mjs} +10 -10
  37. package/dist/{openai-prompt-cache-rrutvqxq.d.mts → openai-prompt-cache-B4eYo2-I.d.mts} +2 -2
  38. package/dist/{openai-prompt-cache-BI0rkM-5.mjs → openai-prompt-cache-Bds-n_9Q.mjs} +1 -1
  39. package/dist/{openai-provider-client-ha_WxTyj.mjs → openai-provider-client-S2gCrM2Z.mjs} +2 -2
  40. package/dist/{openai-responses-D99dOzKI.mjs → openai-responses-DaYwH05E.mjs} +7 -7
  41. package/dist/{openai-responses-compaction-window-D5jbzCi3.mjs → openai-responses-compaction-window-CIhBAkkq.mjs} +3 -80
  42. package/dist/{openai-responses-contracts-B55afwRo.d.mts → openai-responses-contracts-BjBAqAg_.d.mts} +5 -38
  43. package/dist/{openai-reasoning-effort-BK7FbcLT.mjs → openai-responses-contracts-DDOHA62Y.mjs} +79 -1
  44. package/dist/{openai-responses-prompt-observer-internal-tApyTLVu.mjs → openai-responses-prompt-observer-internal-f8J7wpsk.mjs} +3 -3
  45. package/dist/{openai-responses-shared-ZyQEzS5i.mjs → openai-responses-shared-B8RdBPCv.mjs} +18 -18
  46. package/dist/{openai-transport-params-DNasp2fU.mjs → openai-transport-params-9aPuV5YY.mjs} +11 -10
  47. package/dist/positive-integer-41zhOdcV.mjs +8 -0
  48. package/dist/{provider-error-C6TbKiey.mjs → provider-error-BA-v_tKd.mjs} +47 -5
  49. package/dist/{provider-options-BXr9Ec83.d.mts → provider-options-Ceqv1OKk.d.mts} +2 -2
  50. package/dist/{provider-replay-context-BuSUaAk5.mjs → provider-replay-context-CJ_YvcEW.mjs} +1 -1
  51. package/dist/{provider-transcript-transform-pPmUIwKt.mjs → provider-transcript-transform-V5YzU9zh.mjs} +1 -1
  52. package/dist/provider-transport-turn-state-D5EXOFL2.mjs +42 -0
  53. package/dist/{provider-types-CAV0Og3m.d.mts → provider-types-CVjKjsuq.d.mts} +3 -3
  54. package/dist/provider-types.d.mts +6 -6
  55. package/dist/providers.d.mts +2 -2
  56. package/dist/providers.mjs +10 -10
  57. package/dist/{reasoning-tag-text-partitioner-BQBi4B9d.mjs → reasoning-tag-text-partitioner-BcR5pztD.mjs} +1 -8
  58. package/dist/{session-affinity-CCH7eYdB.mjs → session-affinity-Bcunsn4I.mjs} +5 -2
  59. package/dist/{simple-options-tcKOqnpF.mjs → simple-options-BQbb4yQL.mjs} +23 -4
  60. package/dist/src-DDmEryvj.mjs +2 -0
  61. package/dist/{transport-stream-shared-DOxpGJ-H.d.mts → transport-stream-shared-DNvmoWnv.d.mts} +20 -36
  62. package/dist/{transport-stream-shared-Cu3ZPhNW.mjs → transport-stream-shared-zHll9BxO.mjs} +223 -11
  63. package/dist/{transport-utils-CCooe-cr.mjs → transport-utils-zrYjICLZ.mjs} +4 -7
  64. package/dist/transports.d.mts +35 -163
  65. package/dist/transports.mjs +66 -82
  66. package/dist/types-DlfwzH3T.d.mts +1 -0
  67. package/dist/types-LFWwv0cF.mjs +8 -0
  68. package/dist/{types-Dy1q0CSu.d.mts → types-Ntv5z2g2.d.mts} +3 -1
  69. package/dist/types.d.mts +6 -6
  70. package/dist/types.mjs +4 -3
  71. package/dist/{src-B2Q_6G8V.mjs → usage-cost-BNWbbXav.mjs} +0 -1
  72. package/dist/{validation-CaFUZN9B.d.mts → validation-B0t_G2H6.d.mts} +1 -1
  73. package/dist/validation.d.mts +1 -1
  74. package/package.json +1 -1
  75. package/dist/event-stream-I_GlBsuZ.d.mts +0 -1
  76. package/dist/hash-CHgqbJmD.mjs +0 -16
  77. package/dist/json-parse-Dw_hnxsA.mjs +0 -146
  78. package/dist/sanitize-unicode-Bb-v9meu.mjs +0 -83
  79. package/dist/types-BADKjDBI.d.mts +0 -1
  80. package/dist/types-BDdaOVi2.mjs +0 -6
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-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";
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-DdD3qerf.mjs";
2
+ import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, D as Message, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, H as ProviderStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, J as StreamFunction, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, O as Model, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, d as Context, et as ThinkingLevel, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-Ntv5z2g2.mjs";
3
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";
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 };
4
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-Bt5Y4Pav.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-B0t_G2H6.mjs";
6
+ import "./types-DlfwzH3T.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, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, 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,7 @@
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
- import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.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 "./usage-cost-BNWbbXav.mjs";
2
+ import { n as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, r as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE } from "./types-LFWwv0cF.mjs";
3
3
  import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
4
4
  import { i as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
5
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 };
6
+ import "./src-DDmEryvj.mjs";
7
+ export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, 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 };
@@ -1,4 +1,3 @@
1
- import "./validation-BDzVDnTs.mjs";
2
1
  //#region packages/llm-core/src/model-contracts/anthropic.ts
3
2
  function normalizeClaudeModelId(modelId) {
4
3
  const normalized = modelId?.trim().toLowerCase() ?? "";
@@ -1,4 +1,4 @@
1
- import { nt as ToolCall, tt as Tool } from "./types-Dy1q0CSu.mjs";
1
+ import { nt as Tool, rt as ToolCall } from "./types-Ntv5z2g2.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-CaFUZN9B.mjs";
1
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-B0t_G2H6.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.3",
3
+ "version": "2026.9.4",
4
4
  "description": "Reusable model provider adapters and streaming runtime from OpenClaw",
5
5
  "keywords": [
6
6
  "ai",
@@ -1 +0,0 @@
1
- import "./event-stream-C1Z2piyk.mjs";
@@ -1,16 +0,0 @@
1
- //#region packages/ai/src/utils/hash.ts
2
- /** Fast deterministic hash to shorten long strings */
3
- function shortHash(str) {
4
- let h1 = 3735928559;
5
- let h2 = 1103547991;
6
- for (let i = 0; i < str.length; i++) {
7
- const ch = str.charCodeAt(i);
8
- h1 = Math.imul(h1 ^ ch, 2654435761);
9
- h2 = Math.imul(h2 ^ ch, 1597334677);
10
- }
11
- h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
12
- h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
13
- return (h2 >>> 0).toString(36) + (h1 >>> 0).toString(36);
14
- }
15
- //#endregion
16
- export { shortHash as t };
@@ -1,146 +0,0 @@
1
- import { t as asNonArrayRecord } from "./record-coerce-DwRYMj3t.mjs";
2
- import { parse } from "partial-json";
3
- //#region packages/ai/src/utils/json-parse.ts
4
- const VALID_JSON_ESCAPES = /* @__PURE__ */ new Set([
5
- "\"",
6
- "\\",
7
- "/",
8
- "b",
9
- "f",
10
- "n",
11
- "r",
12
- "t",
13
- "u"
14
- ]);
15
- const JSON_CONTROL_ESCAPES = /* @__PURE__ */ new Set([
16
- "b",
17
- "f",
18
- "n",
19
- "r",
20
- "t"
21
- ]);
22
- function isControlCharacter(char) {
23
- const codePoint = char.codePointAt(0);
24
- return codePoint !== void 0 && codePoint >= 0 && codePoint <= 31;
25
- }
26
- function escapeControlCharacter(char) {
27
- switch (char) {
28
- case "\b": return "\\b";
29
- case "\f": return "\\f";
30
- case "\n": return "\\n";
31
- case "\r": return "\\r";
32
- case " ": return "\\t";
33
- default: return `\\u${char.codePointAt(0)?.toString(16).padStart(4, "0") ?? "0000"}`;
34
- }
35
- }
36
- /**
37
- * Repairs malformed JSON string literals by:
38
- * - escaping raw control characters inside strings
39
- * - doubling backslashes before invalid escape characters
40
- */
41
- function repairJson(json) {
42
- let repaired = "";
43
- let inString = false;
44
- let stringValuePrefix = "";
45
- for (let index = 0; index < json.length; index++) {
46
- const char = json.charAt(index);
47
- if (!inString) {
48
- repaired += char;
49
- if (char === "\"") {
50
- inString = true;
51
- stringValuePrefix = "";
52
- }
53
- continue;
54
- }
55
- if (char === "\"") {
56
- repaired += char;
57
- inString = false;
58
- stringValuePrefix = "";
59
- continue;
60
- }
61
- if (char === "\\") {
62
- const nextChar = json.charAt(index + 1);
63
- if (!nextChar) {
64
- repaired += "\\\\";
65
- continue;
66
- }
67
- if (nextChar === "u") {
68
- const unicodeDigits = json.slice(index + 2, index + 6);
69
- if (/^[0-9a-fA-F]{4}$/.test(unicodeDigits)) {
70
- repaired += `\\u${unicodeDigits}`;
71
- stringValuePrefix += `\\u${unicodeDigits}`;
72
- index += 5;
73
- continue;
74
- }
75
- repaired += "\\\\";
76
- stringValuePrefix += "\\";
77
- continue;
78
- }
79
- if (JSON_CONTROL_ESCAPES.has(nextChar) && looksLikeWindowsPathPrefix(stringValuePrefix)) {
80
- repaired += "\\\\";
81
- stringValuePrefix += "\\";
82
- continue;
83
- }
84
- if (VALID_JSON_ESCAPES.has(nextChar)) {
85
- repaired += `\\${nextChar}`;
86
- stringValuePrefix += nextChar === "\\" ? "\\" : `\\${nextChar}`;
87
- index += 1;
88
- continue;
89
- }
90
- repaired += "\\\\";
91
- stringValuePrefix += "\\";
92
- continue;
93
- }
94
- repaired += isControlCharacter(char) ? escapeControlCharacter(char) : char;
95
- stringValuePrefix += char;
96
- }
97
- return repaired;
98
- }
99
- function parseJsonWithRepair(json) {
100
- return JSON.parse(repairJson(json));
101
- }
102
- function looksLikeWindowsPathPrefix(prefix) {
103
- const tail = prefix.slice(-160);
104
- return /(?:^|[^A-Za-z0-9])[A-Za-z]:(?:[\\/][^"\\/:*?<>|\r\n]*)*$/.test(tail);
105
- }
106
- /**
107
- * Attempts to parse potentially incomplete JSON during streaming.
108
- * Always returns a valid object, even if the JSON is incomplete.
109
- *
110
- * @param partialJson The partial JSON string from streaming
111
- * @returns Parsed object or empty object if parsing fails
112
- */
113
- function parseStreamingJson(partialJson) {
114
- if (!partialJson || partialJson.trim() === "") return {};
115
- try {
116
- return asNonArrayRecord(parseJsonWithRepair(partialJson));
117
- } catch {
118
- try {
119
- return asNonArrayRecord(parse(partialJson));
120
- } catch {
121
- try {
122
- return asNonArrayRecord(parse(repairJson(partialJson)));
123
- } catch {
124
- return {};
125
- }
126
- }
127
- }
128
- }
129
- const TOOL_ARGUMENT_PREVIEW_FIRST_CHECKPOINT_CHARS = 512;
130
- /**
131
- * Streamed tool-call arguments are preview-only; the terminal parse re-reads
132
- * the full buffer authoritatively at content_block_stop. Reparsing every delta
133
- * scans an ever-growing buffer and makes assembly quadratic in the argument
134
- * size, so refresh previews on a geometric length schedule instead — bounded
135
- * staleness, linear total parse work.
136
- */
137
- function createToolArgumentPreviewSchedule() {
138
- let nextCheckpointChars = TOOL_ARGUMENT_PREVIEW_FIRST_CHECKPOINT_CHARS;
139
- return (accumulatedChars) => {
140
- if (accumulatedChars < nextCheckpointChars) return false;
141
- nextCheckpointChars = accumulatedChars * 2;
142
- return true;
143
- };
144
- }
145
- //#endregion
146
- export { repairJson as i, parseJsonWithRepair as n, parseStreamingJson as r, createToolArgumentPreviewSchedule as t };
@@ -1,83 +0,0 @@
1
- import { l as requiresClaudeMandatoryAdaptiveThinking, p as resolveClaudeNativeThinkingLevelMap, t as calculateUsageCost } from "./src-B2Q_6G8V.mjs";
2
- //#region packages/ai/src/model-utils.ts
3
- /** Calculates and stores model cost fields from token usage and per-million pricing. */
4
- function calculateCost(model, usage) {
5
- Object.assign(usage.cost, calculateUsageCost(usage, model.cost));
6
- return usage.cost;
7
- }
8
- /** Replaces the catalog estimate when the provider reports an authoritative billed total. */
9
- function applyProviderReportedUsageCost(usage, reportedCost) {
10
- if (typeof reportedCost !== "number" || !Number.isFinite(reportedCost) || reportedCost < 0) return;
11
- usage.cost.total = reportedCost;
12
- usage.cost.totalOrigin = "provider-billed";
13
- }
14
- const EXTENDED_THINKING_LEVELS = [
15
- "off",
16
- "minimal",
17
- "low",
18
- "medium",
19
- "high",
20
- "xhigh",
21
- "max"
22
- ];
23
- function resolveThinkingLevelMap(model) {
24
- return model.api === "anthropic-messages" ? resolveClaudeNativeThinkingLevelMap(model) ?? model.thinkingLevelMap : model.thinkingLevelMap;
25
- }
26
- /** Returns thinking levels exposed by a reasoning-capable model. */
27
- function getSupportedThinkingLevels(model) {
28
- const mandatoryAdaptiveContract = model.api === "anthropic-messages" && requiresClaudeMandatoryAdaptiveThinking(model);
29
- if (!model.reasoning && !mandatoryAdaptiveContract) return ["off"];
30
- const thinkingLevelMap = resolveThinkingLevelMap(model);
31
- return EXTENDED_THINKING_LEVELS.filter((level) => {
32
- const mapped = thinkingLevelMap?.[level];
33
- if (mapped === null) return false;
34
- if (level === "xhigh" || level === "max") return mapped !== void 0;
35
- return true;
36
- });
37
- }
38
- /** Clamps a requested thinking level to the closest supported level for a model. */
39
- function clampThinkingLevel(model, level) {
40
- const availableLevels = getSupportedThinkingLevels(model);
41
- if (availableLevels.includes(level)) return level;
42
- const requestedIndex = EXTENDED_THINKING_LEVELS.indexOf(level);
43
- if (requestedIndex === -1) return availableLevels[0] ?? "off";
44
- const thinkingLevelMap = resolveThinkingLevelMap(model);
45
- if ((level === "xhigh" || level === "max") && thinkingLevelMap?.[level] === null) {
46
- for (const candidate of EXTENDED_THINKING_LEVELS.slice(0, requestedIndex).toReversed()) if (availableLevels.includes(candidate)) return candidate;
47
- }
48
- for (const candidate of EXTENDED_THINKING_LEVELS.slice(requestedIndex)) if (availableLevels.includes(candidate)) return candidate;
49
- for (const candidate of EXTENDED_THINKING_LEVELS.slice(0, requestedIndex).toReversed()) if (availableLevels.includes(candidate)) return candidate;
50
- return availableLevels[0] ?? "off";
51
- }
52
- /** Compares model identity by provider and id. */
53
- function modelsAreEqual(a, b) {
54
- if (!a || !b) return false;
55
- return a.id === b.id && a.provider === b.provider;
56
- }
57
- //#endregion
58
- //#region packages/ai/src/utils/sanitize-unicode.ts
59
- /**
60
- * Removes unpaired Unicode surrogate characters from a string.
61
- *
62
- * Unpaired surrogates (high surrogates 0xD800-0xDBFF without matching low surrogates 0xDC00-0xDFFF,
63
- * or vice versa) cause JSON serialization errors in many API providers.
64
- *
65
- * Valid emoji and other characters outside the Basic Multilingual Plane use properly paired
66
- * surrogates and will NOT be affected by this function.
67
- *
68
- * @param text - The text to sanitize
69
- * @returns The sanitized text with unpaired surrogates removed
70
- *
71
- * @example
72
- * // Valid emoji (properly paired surrogates) are preserved
73
- * sanitizeSurrogates("Hello 🙈 World") // => "Hello 🙈 World"
74
- *
75
- * // Unpaired high surrogate is removed
76
- * const unpaired = String.fromCharCode(0xD83D); // high surrogate without low
77
- * sanitizeSurrogates(`Text ${unpaired} here`) // => "Text here"
78
- */
79
- function sanitizeSurrogates(text) {
80
- return text.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
81
- }
82
- //#endregion
83
- export { getSupportedThinkingLevels as a, clampThinkingLevel as i, applyProviderReportedUsageCost as n, modelsAreEqual as o, calculateCost as r, sanitizeSurrogates as t };
@@ -1 +0,0 @@
1
- import "./index-CQ6LTHw8.mjs";
@@ -1,6 +0,0 @@
1
- //#region packages/llm-core/src/types.ts
2
- /** Stable error codes for provider outcomes that cannot be replayed safely. */
3
- const PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE = "PROVIDER_POST_DISPATCH_AMBIGUITY";
4
- const PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE = "PROVIDER_FAILURE_WITH_OUTPUT";
5
- //#endregion
6
- export { PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as n, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as t };