@openclaw/ai 2026.10.1 → 2026.10.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +6 -0
  2. package/dist/{anthropic-BDfXKgF1.mjs → anthropic-BAHKgWam.mjs} +30 -59
  3. package/dist/{anthropic-payload-policy-BZUAchqb.d.mts → anthropic-payload-policy-DGblkHL5.d.mts} +19 -16
  4. package/dist/{anthropic-stream-reducer-DHt9uFWX.mjs → anthropic-stream-reducer-g6w1YVii.mjs} +195 -283
  5. package/dist/{api-registry-DcEP_o4h.d.mts → api-registry-BhXXYdRA.d.mts} +2 -2
  6. package/dist/assistant-message-events-CHMJgbhs.mjs +18 -0
  7. package/dist/{assistant-output-mJ9cL4Qg.mjs → assistant-output-CUEeSotf.mjs} +2 -2
  8. package/dist/{assistant-text-phase-DAv1BdTm.mjs → assistant-text-phase-BrV8KdFO.mjs} +7 -6
  9. package/dist/{azure-openai-responses-gn9hMf8x.mjs → azure-openai-responses-C7qBuR23.mjs} +8 -9
  10. package/dist/{credential-redaction-BKv49aiv.d.mts → credential-redaction-BHxruEH6.d.mts} +3 -1
  11. package/dist/{diagnostics-Caj-4RBA.mjs → diagnostics-tQasYct1.mjs} +10 -3
  12. package/dist/diagnostics.d.mts +7 -7
  13. package/dist/diagnostics.mjs +3 -3
  14. package/dist/{env-api-keys-CyX4VKGO.mjs → env-api-keys-CrxwdylR.mjs} +24 -35
  15. package/dist/event-stream-6UNs-AhN.d.mts +1 -0
  16. package/dist/{event-stream-DrRM_90c.d.mts → event-stream-BcqWLo_u.d.mts} +1 -1
  17. package/dist/{event-stream-C5AbCAaZ.mjs → event-stream-X2gmsUWv.mjs} +5 -8
  18. package/dist/event-stream.d.mts +2 -2
  19. package/dist/event-stream.mjs +1 -1
  20. package/dist/google-Boz2QcpK.mjs +20 -0
  21. package/dist/{google-interactions-DXu4IYGb.mjs → google-interactions-tjAb1mc5.mjs} +52 -84
  22. package/dist/{google-messages-Bmheetdg.mjs → google-messages-C-RZzloH.mjs} +25 -35
  23. package/dist/google-provider-stream-CMImyxbX.mjs +58 -0
  24. package/dist/{google-shared-DE_ddfsC.mjs → google-shared-OyAtMTZv.mjs} +6 -15
  25. package/dist/google-vertex-hCxTJea7.mjs +40 -0
  26. package/dist/{host-BjIYEjwT.d.mts → host-CTDz7LXD.d.mts} +6 -3
  27. package/dist/{host-JpNulOOs.mjs → host-JWXZWa-c.mjs} +3 -2
  28. package/dist/{host-policy-CC5H0iRZ.mjs → host-policy-q4Azym9F.mjs} +1 -1
  29. package/dist/{index-DJrNQnKw.d.mts → index-BYDvopUB.d.mts} +8 -5
  30. package/dist/index.d.mts +7 -7
  31. package/dist/index.mjs +7 -6
  32. package/dist/internal/anthropic.d.mts +5 -5
  33. package/dist/internal/anthropic.mjs +4 -4
  34. package/dist/internal/openai-completions-compat.d.mts +1 -1
  35. package/dist/internal/openai-completions-compat.mjs +1 -1
  36. package/dist/internal/openai-responses-payload-policy.d.mts +8 -1
  37. package/dist/internal/openai-responses-payload-policy.mjs +3 -3
  38. package/dist/internal/openai.d.mts +9 -9
  39. package/dist/internal/openai.mjs +9 -11
  40. package/dist/internal/runtime.d.mts +31 -13
  41. package/dist/internal/runtime.mjs +10 -13
  42. package/dist/internal/shared.d.mts +5 -5
  43. package/dist/internal/shared.mjs +6 -7
  44. package/dist/internal/tool-schema.mjs +2 -2
  45. package/dist/{llm-request-activity-D8f_oxHj.mjs → llm-request-activity-CfMuh5cC.mjs} +2 -2
  46. package/dist/{mistral-1Bnbneg1.mjs → mistral-DUveP4hF.mjs} +71 -146
  47. package/dist/{model-transport-url-C5f59L3Y.d.mts → model-transport-url-BrsjjdjR.d.mts} +5 -1
  48. package/dist/{number-coercion-V8-BhME4.mjs → number-coercion-C3hztWoY.mjs} +5 -4
  49. package/dist/{openai-chatgpt-responses-CB1JwNFF.mjs → openai-chatgpt-responses-OCwckGhY.mjs} +164 -234
  50. package/dist/{openai-completions-BPadHHKe.mjs → openai-completions-DOltBUe9.mjs} +7 -6
  51. package/dist/{openai-completions-compat-CJ0ktmGy.d.mts → openai-completions-compat-i-nLZxFy.d.mts} +10 -11
  52. package/dist/{openai-completions-compat-D7hWYB0G.mjs → openai-completions-compat-pg1q4uNG.mjs} +10 -6
  53. package/dist/{openai-completions-transport-DITBEALX.mjs → openai-completions-transport-OMrn7gnZ.mjs} +1429 -294
  54. package/dist/{openai-prompt-cache-Dj8qeOHT.mjs → openai-prompt-cache-Cr2xKVrS.mjs} +1 -1
  55. package/dist/{openai-prompt-cache-C-Q1Ksfs.d.mts → openai-prompt-cache-DIPMrMFy.d.mts} +2 -2
  56. package/dist/{openai-responses-1_TvcWI3.mjs → openai-responses-BSBJUA19.mjs} +9 -10
  57. package/dist/{openai-responses-compaction-replay-BB2SWdsx.d.mts → openai-responses-compaction-replay-B2FE4Nw8.d.mts} +4 -4
  58. package/dist/{openai-responses-contracts-sAvdqNjS.d.mts → openai-responses-contracts-DKqMJ1Ct.d.mts} +9 -4
  59. package/dist/{openai-responses-contracts-BKu8O7l4.mjs → openai-responses-contracts-DlKMMTxK.mjs} +26 -6
  60. package/dist/{openai-responses-compaction-window-m878aVpU.mjs → openai-responses-endpoint-CinGh4VZ.mjs} +14 -4
  61. package/dist/{openai-responses-prompt-observer-internal-CbH84xIS.mjs → openai-responses-request-lifecycle-D2IFiI0-.mjs} +39 -4
  62. package/dist/{openai-responses-shared-TCJRAoMW.mjs → openai-responses-shared-DVGhq5xF.mjs} +1036 -327
  63. package/dist/{openai-responses-terminal-usage-BVvyXZ8u.d.mts → openai-responses-terminal-usage-BygjiAdi.d.mts} +2 -2
  64. package/dist/{openai-tool-schema-DYNePiF8.mjs → openai-tool-schema-DDPXsvJP.mjs} +236 -399
  65. package/dist/{positive-integer-CwLi8LUL.mjs → positive-integer-CqWjqSi9.mjs} +1 -1
  66. package/dist/{provider-error-DQBE1bUQ.mjs → provider-error-CF9GWCs2.mjs} +5 -3
  67. package/dist/{provider-options-Dk4PeQV3.d.mts → provider-options-CVrXZBtA.d.mts} +3 -2
  68. package/dist/{provider-transport-turn-state-8c_Nj2NS.mjs → provider-transport-turn-state-LuCaTsSO.mjs} +2 -2
  69. package/dist/{provider-types-De8PRdR0.d.mts → provider-types-CHtRx0dI.d.mts} +3 -3
  70. package/dist/provider-types.d.mts +6 -6
  71. package/dist/providers.d.mts +2 -2
  72. package/dist/providers.mjs +12 -12
  73. package/dist/{reasoning-tag-text-partitioner-Ju9VpUGl.mjs → reasoning-tag-text-partitioner-0-Rsezog.mjs} +13 -12
  74. package/dist/{required-api-key-D4kn3252.mjs → required-api-key-CFJvcFy_.mjs} +1 -1
  75. package/dist/{simple-options-wW3117Fu.mjs → simple-options-BARFAzk9.mjs} +9 -11
  76. package/dist/{src-DWJq14pn.mjs → src-C_wfIUmV.mjs} +19 -4
  77. package/dist/{stream-CElngO8h.mjs → stream-DwrETW0_.mjs} +12 -21
  78. package/dist/{stream-first-event-timeout-D9ZmL_s9.mjs → stream-first-event-timeout-Dc42hKv6.mjs} +8 -21
  79. package/dist/{streaming-byte-guard-CC-HMn_u.mjs → streaming-byte-guard-DBXr1XYn.mjs} +16 -1
  80. package/dist/{string-normalization-PN10hf6d.mjs → string-normalization-I3ux50s9.mjs} +1 -1
  81. package/dist/{text-signature-rOn31nxc.mjs → text-signature-B_MB6U_9.mjs} +32 -5
  82. package/dist/{tool-schema-json-projection-Ct8SeBeJ.mjs → tool-schema-json-projection-B8sG1I9v.mjs} +29 -23
  83. package/dist/{transport-stream-shared-CAxkgOSj.d.mts → transport-stream-shared-BmpzDtdQ.d.mts} +4 -4
  84. package/dist/{transport-stream-shared-C5TAc3U_.mjs → transport-stream-shared-DH08b7Il.mjs} +8 -16
  85. package/dist/transports.d.mts +33 -22
  86. package/dist/transports.mjs +73 -1234
  87. package/dist/{types-DvzmWW8J.d.mts → types-Bd2T86VJ.d.mts} +5 -23
  88. package/dist/types-Kdfw_04V.d.mts +1 -0
  89. package/dist/types.d.mts +6 -6
  90. package/dist/types.mjs +5 -4
  91. package/dist/{validation-B3lQt_VE.d.mts → validation-DdGB1yy3.d.mts} +1 -1
  92. package/dist/{validation-DbqlIfDn.mjs → validation-opC2pjk9.mjs} +2 -3
  93. package/dist/validation.d.mts +1 -1
  94. package/dist/validation.mjs +1 -1
  95. package/package.json +4 -9
  96. package/dist/env-api-keys-BR0MUYYD.d.mts +0 -17
  97. package/dist/event-stream-DqDQWqiy.d.mts +0 -1
  98. package/dist/google-CyMz2jF_.mjs +0 -54
  99. package/dist/google-vertex-BEW0OQIA.mjs +0 -88
  100. package/dist/internal/env-api-keys.d.mts +0 -2
  101. package/dist/internal/env-api-keys.mjs +0 -2
  102. package/dist/openai-responses-request-lifecycle-Fsag-IGZ.mjs +0 -36
  103. package/dist/openai-transport-params-ildrm49s.mjs +0 -735
  104. package/dist/openai-web-search-tools-Cfu0uLyN.mjs +0 -14
  105. package/dist/provider-replay-context-ywPKKLjL.mjs +0 -25
  106. package/dist/types-Dlz-8qcy.d.mts +0 -1
@@ -1,4 +1,4 @@
1
- import { o as parseStrictPositiveInteger } from "./number-coercion-V8-BhME4.mjs";
1
+ import { s as parseStrictPositiveInteger } from "./number-coercion-C3hztWoY.mjs";
2
2
  //#region packages/ai/src/transports/positive-integer.ts
3
3
  function parsePositiveInteger(value) {
4
4
  if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
@@ -1,6 +1,6 @@
1
1
  import { i as asOptionalRecord } from "./record-coerce-CNDovvft.mjs";
2
2
  import { o as normalizeStringifiedOptionalString } from "./string-coerce-CtgOVOSv.mjs";
3
- import "./number-coercion-V8-BhME4.mjs";
3
+ import "./number-coercion-C3hztWoY.mjs";
4
4
  import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
5
5
  import { parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
6
6
  import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
@@ -281,7 +281,9 @@ function hasSensitiveProseContent(value) {
281
281
  function normalizeDiagnosticFieldName(value) {
282
282
  return value.toLowerCase().replaceAll(DIAGNOSTIC_FIELD_SEPARATOR_RE, "");
283
283
  }
284
- function isCredentialFieldName(normalized) {
284
+ /** Classifies credential-bearing fields, including case-insensitive HTTP header names. */
285
+ function isCredentialFieldName(name) {
286
+ const normalized = normalizeDiagnosticFieldName(name);
285
287
  if (!normalized || NON_CREDENTIAL_FIELD_NAMES.has(normalized)) return false;
286
288
  return normalized === "authorization" || normalized === "proxyauthorization" || CREDENTIAL_FIELD_SUFFIX_RE.test(normalized);
287
289
  }
@@ -529,4 +531,4 @@ function projectProviderError(error, signal) {
529
531
  }
530
532
  }
531
533
  //#endregion
532
- export { redactDiagnosticText as a, projectDiagnosticValue as i, projectProviderError as n, truncateUtf16Safe as o, createDiagnosticRecord as r, stableStringify as s, configureProviderErrorRedactor as t };
534
+ export { projectDiagnosticValue as a, stableStringify as c, isCredentialFieldName as i, projectProviderError as n, redactDiagnosticText as o, createDiagnosticRecord as r, truncateUtf16Safe as s, configureProviderErrorRedactor as t };
@@ -1,6 +1,6 @@
1
- import { nt as StreamOptions } from "./types-DvzmWW8J.mjs";
1
+ import { nt as StreamOptions } from "./types-Bd2T86VJ.mjs";
2
2
  import { t as OpenAICompletionsToolChoice } from "./openai-tool-projection-793cE3QX.mjs";
3
- import "./types-Dlz-8qcy.mjs";
3
+ import "./types-Kdfw_04V.mjs";
4
4
  import Anthropic from "@anthropic-ai/sdk";
5
5
  //#region packages/ai/src/providers/openai-reasoning-effort.d.ts
6
6
  declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
@@ -143,6 +143,7 @@ type BaseOpenAIStreamOptions = StreamOptions & {
143
143
  };
144
144
  /** Superset retained under the provider's published compatibility type name. */
145
145
  type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
146
+ streaming?: boolean;
146
147
  toolChoice?: OpenAICompletionsToolChoice;
147
148
  reasoning?: OpenAIReasoningEffort | "off";
148
149
  reasoningEffort?: OpenAIReasoningEffort | "off";
@@ -1,6 +1,6 @@
1
- import { r as getAiTransportHost } from "./host-JpNulOOs.mjs";
1
+ import { r as getAiTransportHost } from "./host-JWXZWa-c.mjs";
2
2
  import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-5qSGvIUH.mjs";
3
- import { O as resolveOpenAIClientBaseUrl } from "./openai-transport-params-ildrm49s.mjs";
3
+ import { Pt as resolveOpenAIClientBaseUrl } from "./openai-responses-shared-DVGhq5xF.mjs";
4
4
  import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
5
5
  import { randomUUID } from "node:crypto";
6
6
  import OpenAI from "openai";
@@ -1,6 +1,6 @@
1
- import { t as index_d_exports } from "./index-DJrNQnKw.mjs";
2
- import { a as AssistantMessage, d as Context, dt as ToolResultMessage, k as Model, mt as UserMessage, n as Api, nt as StreamOptions, p as ImageContent, rt as TextContent, s as AssistantMessageEventStreamContract } from "./types-DvzmWW8J.mjs";
3
- import "./types-Dlz-8qcy.mjs";
1
+ import { t as index_d_exports } from "./index-BYDvopUB.mjs";
2
+ import { a as AssistantMessage, d as Context, dt as ToolResultMessage, k as Model, mt as UserMessage, n as Api, nt as StreamOptions, p as ImageContent, rt as TextContent, s as AssistantMessageEventStreamContract } from "./types-Bd2T86VJ.mjs";
3
+ import "./types-Kdfw_04V.mjs";
4
4
  //#region packages/ai/src/provider-types.d.ts
5
5
  declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
6
6
  type VideoContent = Omit<ImageContent, "type"> & {
@@ -1,6 +1,6 @@
1
- import { A as supportsClaudeNativeMaxEffort, C as resolveClaudeOpus5ModelIdentity, D as supportsClaudeAdaptiveThinking, E as supportsClaude1MContext, O as supportsClaudeFastMode, S as resolveClaudeOpus55ModelIdentity, T as resolveClaudeSonnet5ModelIdentity, _ as resolveClaudeFable5ModelIdentity, a as ProviderRefusalReview, b as resolveClaudeMythos5ModelIdentity, c as CLAUDE_HAIKU_55_THINKING_PROFILE, d as CLAUDE_SONNET_55_THINKING_PROFILE, f as CLAUDE_SONNET_5_THINKING_PROFILE, g as requiresClaudeMandatoryAdaptiveThinking, h as requiresClaudeDefaultSampling, i as normalizeResolvedPricing, j as supportsClaudeNativeXhighEffort, k as supportsClaudeInHistorySystemMessages, l as CLAUDE_OPUS_55_THINKING_PROFILE, m as requiresClaudeBetweenToolsThinking, n as calculateUsageCost, o as readProviderRefusalReview, p as bindsClaudeThinkingPrefix, r as normalizeModelCostConfig, s as CLAUDE_FABLE_5_THINKING_PROFILE, u as CLAUDE_OPUS_5_THINKING_PROFILE, v as resolveClaudeHaiku55ModelIdentity, w as resolveClaudeSonnet55ModelIdentity, x as resolveClaudeNativeThinkingLevelMap, y as resolveClaudeModelIdentity } from "./index-DJrNQnKw.mjs";
2
- import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-DvzmWW8J.mjs";
3
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DrRM_90c.mjs";
4
- import { n as validateToolCall, t as validateToolArguments } from "./validation-B3lQt_VE.mjs";
5
- import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-De8PRdR0.mjs";
6
- export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
1
+ import { A as supportsClaudeInHistorySystemMessages, C as resolveClaudeOpus55ModelIdentity, D as supportsClaude1MContext, E as resolveClaudeSonnet5ModelIdentity, M as supportsClaudeNativeXhighEffort, O as supportsClaudeAdaptiveThinking, S as resolveClaudeNativeThinkingLevelMap, T as resolveClaudeSonnet55ModelIdentity, _ as requiresClaudeMandatoryAdaptiveThinking, a as normalizeResolvedPricing, b as resolveClaudeModelIdentity, c as CLAUDE_FABLE_5_THINKING_PROFILE, d as CLAUDE_OPUS_5_THINKING_PROFILE, f as CLAUDE_SONNET_55_THINKING_PROFILE, g as requiresClaudeDefaultSampling, h as requiresClaudeBetweenToolsThinking, i as normalizeModelCostConfig, j as supportsClaudeNativeMaxEffort, k as supportsClaudeFastMode, l as CLAUDE_HAIKU_55_THINKING_PROFILE, m as bindsClaudeThinkingPrefix, n as appendTextDeltaToAssistantMessage, o as ProviderRefusalReview, p as CLAUDE_SONNET_5_THINKING_PROFILE, r as calculateUsageCost, s as readProviderRefusalReview, u as CLAUDE_OPUS_55_THINKING_PROFILE, v as resolveClaudeFable5ModelIdentity, w as resolveClaudeOpus5ModelIdentity, x as resolveClaudeMythos5ModelIdentity, y as resolveClaudeHaiku55ModelIdentity } from "./index-BYDvopUB.mjs";
2
+ import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-Bd2T86VJ.mjs";
3
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BcqWLo_u.mjs";
4
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-DdGB1yy3.mjs";
5
+ import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-CHtRx0dI.mjs";
6
+ export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
@@ -1,5 +1,5 @@
1
- import { n as ApiRegistry } from "./api-registry-DcEP_o4h.mjs";
2
- import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-C-Q1Ksfs.mjs";
1
+ import { n as ApiRegistry } from "./api-registry-BhXXYdRA.mjs";
2
+ import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-DIPMrMFy.mjs";
3
3
  //#region packages/ai/src/providers/register-builtins.d.ts
4
4
  /** Source id used for built-in API provider registrations. */
5
5
  export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
@@ -1,6 +1,6 @@
1
- import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
2
- import { n as projectProviderError } from "./provider-error-DQBE1bUQ.mjs";
3
- import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-Dj8qeOHT.mjs";
1
+ import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
2
+ import { n as projectProviderError } from "./provider-error-CF9GWCs2.mjs";
3
+ import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-Cr2xKVrS.mjs";
4
4
  import { t as createZeroUsage } from "./usage-CJH5D6Ea.mjs";
5
5
  //#region packages/ai/src/providers/register-builtins.ts
6
6
  /** Source id used for built-in API provider registrations. */
@@ -50,39 +50,39 @@ function createLazyRegistration(api, importModule, select) {
50
50
  };
51
51
  }
52
52
  const registerBuiltIns = [
53
- createLazyRegistration("anthropic-messages", () => import("./anthropic-BDfXKgF1.mjs").then((n) => n.t), (module) => ({
53
+ createLazyRegistration("anthropic-messages", () => import("./anthropic-BAHKgWam.mjs").then((n) => n.t), (module) => ({
54
54
  stream: module.streamAnthropic,
55
55
  streamSimple: module.streamSimpleAnthropic
56
56
  })),
57
- createLazyRegistration("openai-completions", () => import("./openai-completions-BPadHHKe.mjs").then((n) => n.t), (module) => ({
57
+ createLazyRegistration("openai-completions", () => import("./openai-completions-DOltBUe9.mjs").then((n) => n.t), (module) => ({
58
58
  stream: module.streamOpenAICompletions,
59
59
  streamSimple: module.streamSimpleOpenAICompletions
60
60
  })),
61
- createLazyRegistration("mistral-conversations", () => import("./mistral-1Bnbneg1.mjs"), (module) => ({
61
+ createLazyRegistration("mistral-conversations", () => import("./mistral-DUveP4hF.mjs"), (module) => ({
62
62
  stream: module.streamMistral,
63
63
  streamSimple: module.streamSimpleMistral
64
64
  })),
65
- createLazyRegistration("openai-responses", () => import("./openai-responses-1_TvcWI3.mjs").then((n) => n.t), (module) => ({
65
+ createLazyRegistration("openai-responses", () => import("./openai-responses-BSBJUA19.mjs").then((n) => n.t), (module) => ({
66
66
  stream: module.streamOpenAIResponses,
67
67
  streamSimple: module.streamSimpleOpenAIResponses
68
68
  })),
69
- createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-gn9hMf8x.mjs"), (module) => ({
69
+ createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-C7qBuR23.mjs"), (module) => ({
70
70
  stream: module.streamAzureOpenAIResponses,
71
71
  streamSimple: module.streamSimpleAzureOpenAIResponses
72
72
  })),
73
- createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-CB1JwNFF.mjs"), (module) => ({
73
+ createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-OCwckGhY.mjs"), (module) => ({
74
74
  stream: module.streamOpenAICodexResponses,
75
75
  streamSimple: module.streamSimpleOpenAICodexResponses
76
76
  })),
77
- createLazyRegistration("google-generative-ai", () => import("./google-CyMz2jF_.mjs"), (module) => ({
77
+ createLazyRegistration("google-generative-ai", () => import("./google-Boz2QcpK.mjs"), (module) => ({
78
78
  stream: module.streamGoogle,
79
79
  streamSimple: module.streamSimpleGoogle
80
80
  })),
81
- createLazyRegistration("google-interactions", () => import("./google-interactions-DXu4IYGb.mjs"), (module) => ({
81
+ createLazyRegistration("google-interactions", () => import("./google-interactions-tjAb1mc5.mjs"), (module) => ({
82
82
  stream: module.streamGoogleInteractions,
83
83
  streamSimple: module.streamSimpleGoogleInteractions
84
84
  })),
85
- createLazyRegistration("google-vertex", () => import("./google-vertex-BEW0OQIA.mjs"), (module) => ({
85
+ createLazyRegistration("google-vertex", () => import("./google-vertex-hCxTJea7.mjs"), (module) => ({
86
86
  stream: module.streamGoogleVertex,
87
87
  streamSimple: module.streamSimpleGoogleVertex
88
88
  }))
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./provider-error-DQBE1bUQ.mjs";
2
+ import "./provider-error-CF9GWCs2.mjs";
3
3
  import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
4
4
  //#region node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
5
5
  /**
@@ -12002,7 +12002,7 @@ function reduceReasoningText(text, codeSpans, state, options) {
12002
12002
  if (options.final && state.depth > 0 && state.pending) {
12003
12003
  const pending = state.pending;
12004
12004
  if (!pending.containsPrivate) {
12005
- if (options.mode === "static-preserve" || options.mode === "static-strict" && !pending.visibleBefore && !pending.protectedClose || options.mode === "visible" && !pending.protectedClose) emit("text", options.mode === "visible" && pending.visibleBefore ? pending.openTag + pending.content : pending.content);
12005
+ if ((options.mode === "static-preserve" || options.mode === "static-strict" && !pending.visibleBefore && !pending.protectedClose || options.mode === "visible" && !pending.protectedClose) && options.recoverUnclosed !== false) emit("text", options.mode === "visible" && pending.visibleBefore ? pending.openTag + pending.content : pending.content);
12006
12006
  else emit("thinking", pending.content);
12007
12007
  }
12008
12008
  state.depth = 0;
@@ -12181,7 +12181,7 @@ function createReasoningTagTextPartitioner() {
12181
12181
  reduceSafePrefix(special, safeLimit, limit, output);
12182
12182
  }
12183
12183
  };
12184
- const processBlock = (end, final, output, parsedCodeSpans, parsedRetainStart) => {
12184
+ const processBlock = (end, final, output, parsedCodeSpans, parsedRetainStart, recoverUnclosed = true) => {
12185
12185
  const previousBlockStart = blockStart;
12186
12186
  let blockCodeSpans = parsedCodeSpans;
12187
12187
  let blockRetainStart = parsedRetainStart;
@@ -12189,30 +12189,31 @@ function createReasoningTagTextPartitioner() {
12189
12189
  if (!final || reduction.depth === 0) return;
12190
12190
  merge(output, reduceReasoningText("", [], reduction, {
12191
12191
  final: true,
12192
+ recoverUnclosed,
12192
12193
  mode: strictMode ? "hide" : "visible",
12193
12194
  scope: "all"
12194
12195
  }));
12195
12196
  };
12196
12197
  if (end <= blockStart) {
12197
12198
  finalizePending();
12198
- return true;
12199
+ return;
12199
12200
  }
12200
12201
  if (end <= emitted) {
12201
12202
  finalizePending();
12202
12203
  blockStart = end;
12203
12204
  fastPathCheckedThrough = Math.max(fastPathCheckedThrough, end);
12204
- return true;
12205
+ return;
12205
12206
  }
12206
12207
  emitSafePrefix(end, output);
12207
12208
  if (holdStart !== void 0 && holdStart < end) {
12208
12209
  const held = source.slice(holdStart, end);
12209
12210
  if (!final) {
12210
- if (pendingTagProbe && !pendingTagProbe.resolved) return false;
12211
+ if (pendingTagProbe && !pendingTagProbe.resolved) return;
12211
12212
  pendingTagProbe = void 0;
12212
12213
  const pendingStart = scanReasoningTags(held, false).pendingStart;
12213
12214
  if (pendingStart !== void 0) {
12214
12215
  startPendingTagProbe(holdStart + pendingStart, end);
12215
- return false;
12216
+ return;
12216
12217
  }
12217
12218
  }
12218
12219
  const block = source.slice(0, end);
@@ -12224,6 +12225,7 @@ function createReasoningTagTextPartitioner() {
12224
12225
  }
12225
12226
  merge(output, reduceReasoningText(block, blockCodeSpans, reduction, {
12226
12227
  final,
12228
+ recoverUnclosed,
12227
12229
  mode: strictMode ? "hide" : "visible",
12228
12230
  scope: "all",
12229
12231
  start
@@ -12250,9 +12252,8 @@ function createReasoningTagTextPartitioner() {
12250
12252
  fastPathCheckedThrough = end;
12251
12253
  fastPathCodeSafe = !final && !crossedLineBoundary && emitted === source.length && !blockCodeSpans?.some(([, spanEnd]) => spanEnd === source.length);
12252
12254
  if (!final && reduction.depth === 0 && emitted === source.length && endedBlankBlock && !MARKDOWN_CONTAINER_LINE_RE.test(source.slice(blockRetainStart ?? 0)) && !blockCodeSpans?.some(([, spanEnd]) => spanEnd === source.length)) compactCommittedSource(blockRetainStart ?? 0);
12253
- return true;
12254
12255
  };
12255
- const consume = (appended, strict, final) => {
12256
+ const consume = (appended, strict, final, recoverUnclosed = true) => {
12256
12257
  strictMode ||= strict;
12257
12258
  const previousEndedBlankBlock = endedBlankBlock;
12258
12259
  source += appended;
@@ -12274,7 +12275,7 @@ function createReasoningTagTextPartitioner() {
12274
12275
  heldBacktickStart = void 0;
12275
12276
  }
12276
12277
  const output = [];
12277
- if (final) processBlock(source.length, true, output);
12278
+ if (final) processBlock(source.length, true, output, void 0, void 0, recoverUnclosed);
12278
12279
  else {
12279
12280
  emitSafePrefix(source.length, output, appended);
12280
12281
  if (!strictMode && holdStart !== void 0 && holdStart < source.length) {
@@ -12353,8 +12354,8 @@ function createReasoningTagTextPartitioner() {
12353
12354
  pushVisible(chunk) {
12354
12355
  return consume(chunk, false, false);
12355
12356
  },
12356
- flush() {
12357
- return consume("", strictMode, true);
12357
+ flush(options) {
12358
+ return consume("", strictMode, true, options?.recoverUnclosed);
12358
12359
  },
12359
12360
  hasPending() {
12360
12361
  return holdStart !== void 0 && holdStart < source.length || reduction.depth > 0 || emitted < source.length;
@@ -1,4 +1,4 @@
1
- import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
1
+ import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
2
2
  //#region packages/ai/src/utils/required-api-key.ts
3
3
  function requireApiKey(provider, apiKey) {
4
4
  const resolved = apiKey || getEnvApiKey(provider);
@@ -1,9 +1,9 @@
1
1
  import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
2
2
  import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
3
- import { M as hasMediaPayload, r as getAiTransportHost } from "./host-JpNulOOs.mjs";
4
- import { g as responsesServiceTierObserver } from "./openai-responses-contracts-BKu8O7l4.mjs";
5
- import { o as truncateUtf16Safe } from "./provider-error-DQBE1bUQ.mjs";
6
- import { P as sanitizeSurrogates, i as copyProviderAcceptanceObserver } from "./transport-stream-shared-C5TAc3U_.mjs";
3
+ import { M as hasMediaPayload, r as getAiTransportHost } from "./host-JWXZWa-c.mjs";
4
+ import { g as responsesServiceTierObserver } from "./openai-responses-contracts-DlKMMTxK.mjs";
5
+ import { s as truncateUtf16Safe } from "./provider-error-CF9GWCs2.mjs";
6
+ import { P as sanitizeSurrogates, i as copyProviderAcceptanceObserver } from "./transport-stream-shared-DH08b7Il.mjs";
7
7
  //#region packages/ai/src/utils/prompt-cache-stability.ts
8
8
  /**
9
9
  * Prompt-cache normalization helpers. They keep generated prompt sections
@@ -114,10 +114,6 @@ function isBinaryMimeType(mimeType) {
114
114
  const normalized = mimeType.split(";", 1)[0]?.trim().toLowerCase();
115
115
  return normalized ? !TEXTUAL_MIME_PATTERN.test(normalized) : false;
116
116
  }
117
- function describeOmittedValue(value, label) {
118
- const length = typeof value === "string" ? value.length : JSON.stringify(value)?.length;
119
- return length ? `[${label} omitted: ${length} chars]` : `[${label} omitted]`;
120
- }
121
117
  function redactInlineDataUris(value) {
122
118
  return value.replace(INLINE_DATA_URI_PATTERN, (_match, prefix, uri) => `${prefix}[inline data URI: ${uri.length} chars]`);
123
119
  }
@@ -130,7 +126,10 @@ function stringifyStructuredBlock(block) {
130
126
  if (OPAQUE_OR_BINARY_FIELD_RE.test(key)) return `[omitted ${key}]`;
131
127
  if (key === "data") {
132
128
  const mimeType = readMimeType(this);
133
- if (mimeType && isBinaryMimeType(mimeType)) return describeOmittedValue(value, "binary data");
129
+ if (mimeType && isBinaryMimeType(mimeType)) {
130
+ const length = typeof value === "string" ? value.length : JSON.stringify(value)?.length;
131
+ return length ? `[binary data omitted: ${length} chars]` : "[binary data omitted]";
132
+ }
134
133
  }
135
134
  if (typeof value === "bigint") return value.toString();
136
135
  if (typeof value === "string") return redactInlineDataUris(host.redactModelVisibleSecrets(value));
@@ -257,8 +256,7 @@ const reasoningTagTextPolicy = {
257
256
  const REQUEST_BODY = Symbol("modelRequestBody");
258
257
  /** Call-local state survives option spreads; no payload is cached across requests. */
259
258
  function modelRequestBodyState(options, inheritFrom) {
260
- let state = Reflect.get(options, REQUEST_BODY) ?? (inheritFrom && Reflect.get(inheritFrom, REQUEST_BODY));
261
- if (!state) state = {};
259
+ const state = Reflect.get(options, REQUEST_BODY) ?? (inheritFrom && Reflect.get(inheritFrom, REQUEST_BODY)) ?? {};
262
260
  Reflect.set(options, REQUEST_BODY, state);
263
261
  return state;
264
262
  }
@@ -1,6 +1,12 @@
1
1
  import "./diagnostics-DzrF1h4J.mjs";
2
- import "./validation-DbqlIfDn.mjs";
2
+ import "./validation-opC2pjk9.mjs";
3
3
  //#region packages/llm-core/src/model-contracts/anthropic.ts
4
+ function readListedClaudeCapability(ref, capability) {
5
+ const listed = ref.params?.claudeCapabilities;
6
+ if (typeof listed !== "object" || listed === null) return;
7
+ const value = Reflect.get(listed, capability);
8
+ return typeof value === "boolean" ? value : void 0;
9
+ }
4
10
  function normalizeClaudeModelId(modelId) {
5
11
  const normalized = modelId?.trim().toLowerCase() ?? "";
6
12
  return (normalized.startsWith("anthropic/") ? normalized.slice(10) : normalized).replace(/[._\s]+/g, "-");
@@ -82,6 +88,8 @@ function supportsClaudeInHistorySystemMessages(ref) {
82
88
  }
83
89
  /** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
84
90
  function requiresClaudeMandatoryAdaptiveThinking(ref) {
91
+ const disabledThinking = readListedClaudeCapability(ref, "disabledThinking");
92
+ if (disabledThinking !== void 0) return !disabledThinking && !requiresClaudeBetweenToolsThinking(ref) && supportsClaudeAdaptiveThinking(ref);
85
93
  const modelId = resolveClaudeModelIdentity(ref);
86
94
  return resolveClaudeOpus55ModelIdentity(ref) !== void 0 || resolveClaudeFable5ModelIdentity(ref) !== void 0 || resolveClaudeMythos5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-mythos-preview(?=$|[^a-z0-9])/.test(modelId);
87
95
  }
@@ -117,14 +125,17 @@ function resolveClaudeOpus55ModelIdentity(ref) {
117
125
  if (normalized === "opus" || normalized === "opus-5-5") return "claude-opus-5-5";
118
126
  return /^claude-opus-5-5(?=$|[^a-z0-9])/.test(normalized) ? normalized : void 0;
119
127
  }
120
- /** Return whether a Claude model supports adaptive thinking. */
121
- function supportsClaudeAdaptiveThinking(ref) {
128
+ function supportsClaudeAdaptiveThinkingById(ref) {
122
129
  const modelId = resolveClaudeModelIdentity(ref);
123
130
  return resolveClaudeHaiku55ModelIdentity(ref) !== void 0 || resolveClaudeOpus5ModelIdentity(ref) !== void 0 || resolveClaudeSonnet5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-(?:5|preview)|opus-4-(?:6|7|8)|sonnet-4-6)(?=$|[^a-z0-9])/.test(modelId);
124
131
  }
132
+ /** Return whether a Claude model supports adaptive thinking. */
133
+ function supportsClaudeAdaptiveThinking(ref) {
134
+ return readListedClaudeCapability(ref, "adaptiveThinking") ?? supportsClaudeAdaptiveThinkingById(ref);
135
+ }
125
136
  /** Return whether a Claude model has a native 1M-token context window. */
126
137
  function supportsClaude1MContext(ref) {
127
- return supportsClaudeAdaptiveThinking(ref);
138
+ return supportsClaudeAdaptiveThinkingById(ref);
128
139
  }
129
140
  /** Return whether a Claude model supports Anthropic's native fast mode. */
130
141
  function supportsClaudeFastMode(ref) {
@@ -133,11 +144,15 @@ function supportsClaudeFastMode(ref) {
133
144
  }
134
145
  /** Return whether a Claude model supports native max effort. */
135
146
  function supportsClaudeNativeMaxEffort(ref) {
147
+ const listed = readListedClaudeCapability(ref, "maxEffort");
148
+ if (listed !== void 0) return listed;
136
149
  const modelId = resolveClaudeModelIdentity(ref);
137
150
  return resolveClaudeHaiku55ModelIdentity(ref) !== void 0 || resolveClaudeOpus5ModelIdentity(ref) !== void 0 || resolveClaudeSonnet5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:6|7|8)|sonnet-4-6)(?=$|[^a-z0-9])/.test(modelId);
138
151
  }
139
152
  /** Return whether a Claude model supports native xhigh effort. */
140
153
  function supportsClaudeNativeXhighEffort(ref) {
154
+ const listed = readListedClaudeCapability(ref, "xhighEffort");
155
+ if (listed !== void 0) return listed;
141
156
  const modelId = resolveClaudeModelIdentity(ref);
142
157
  return resolveClaudeHaiku55ModelIdentity(ref) !== void 0 || resolveClaudeOpus5ModelIdentity(ref) !== void 0 || resolveClaudeSonnet5ModelIdentity(ref) !== void 0 || /(?:^|-)claude-(?:fable-5|mythos-5|opus-4-(?:7|8))(?=$|[^a-z0-9])/.test(modelId);
143
158
  }
@@ -1,5 +1,5 @@
1
- import { i as bindAssistantMessageEventStream, o as getEventStreamCompletion } from "./event-stream-C5AbCAaZ.mjs";
2
- import { i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, s as supportsScopedAiTransportHosts } from "./host-JpNulOOs.mjs";
1
+ import { i as bindAssistantMessageEventStream, o as getEventStreamCompletion } from "./event-stream-X2gmsUWv.mjs";
2
+ import { i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, s as supportsScopedAiTransportHosts } from "./host-JWXZWa-c.mjs";
3
3
  import { i as registerSessionResourceCleanupObserver, t as cleanupSessionResources } from "./session-resources-D1wgDQ8C.mjs";
4
4
  //#region packages/ai/src/api-registry.ts
5
5
  function wrapStream(api, stream) {
@@ -47,6 +47,9 @@ function trackDefaultHostSessions(sessions) {
47
47
  defaultHostSessionReferences.add(reference);
48
48
  defaultHostSessionFinalizer.register(sessions, reference, reference);
49
49
  }
50
+ function selectDefaultHostSessions(sessions, sessionId) {
51
+ return sessionId ? [[sessionId, sessions.get(sessionId)]] : sessions;
52
+ }
50
53
  registerSessionResourceCleanupObserver((sessionId, owner) => {
51
54
  for (const reference of defaultHostSessionReferences) {
52
55
  const sessions = reference.deref();
@@ -59,12 +62,7 @@ registerSessionResourceCleanupObserver((sessionId, owner) => {
59
62
  else owners.clear();
60
63
  return owners.size === 0;
61
64
  };
62
- if (sessionId) {
63
- const owners = sessions.get(sessionId);
64
- if (owners && pruneOwners(owners)) sessions.delete(sessionId);
65
- continue;
66
- }
67
- for (const [ownedSessionId, owners] of sessions) if (pruneOwners(owners)) sessions.delete(ownedSessionId);
65
+ for (const [ownedSessionId, owners] of selectDefaultHostSessions(sessions, sessionId)) if (owners && pruneOwners(owners)) sessions.delete(ownedSessionId);
68
66
  }
69
67
  });
70
68
  function retainUnscopedStreamLifetime(stream, runWithHost) {
@@ -90,7 +88,6 @@ function retainUnscopedStreamLifetime(stream, runWithHost) {
90
88
  const bufferWaiters = /* @__PURE__ */ new Set();
91
89
  let bufferError;
92
90
  let resultPromise;
93
- const wrapIterationError = (error) => new Error("Stream iteration failed", { cause: error });
94
91
  const notifyBufferWaiters = () => {
95
92
  for (const resolve of bufferWaiters) resolve();
96
93
  bufferWaiters.clear();
@@ -103,13 +100,11 @@ function retainUnscopedStreamLifetime(stream, runWithHost) {
103
100
  } catch (error) {
104
101
  providerResult = Promise.reject(new Error("Stream result failed", { cause: error }));
105
102
  }
106
- providerResult.then(() => {
103
+ const settleResult = () => {
107
104
  resultSettled = true;
108
105
  releaseIfSettled();
109
- }, () => {
110
- resultSettled = true;
111
- releaseIfSettled();
112
- });
106
+ };
107
+ providerResult.then(settleResult, settleResult);
113
108
  resultPromise = providerResult;
114
109
  }
115
110
  return resultPromise;
@@ -124,7 +119,7 @@ function retainUnscopedStreamLifetime(stream, runWithHost) {
124
119
  notifyBufferWaiters();
125
120
  }
126
121
  } catch (error) {
127
- bufferError = wrapIterationError(error);
122
+ bufferError = new Error("Stream iteration failed", { cause: error });
128
123
  } finally {
129
124
  bufferSettled = true;
130
125
  notifyBufferWaiters();
@@ -202,11 +197,8 @@ function createRuntime(registry, transportHost) {
202
197
  if (completion) {
203
198
  if (!supportsScopedAiTransportHosts()) {
204
199
  let producerSettled = false;
205
- const observedCompletion = completion.then(() => {
206
- producerSettled = true;
207
- }, (error) => {
200
+ const observedCompletion = completion.finally(() => {
208
201
  producerSettled = true;
209
- throw error;
210
202
  });
211
203
  runWithStreamHost(() => observedCompletion);
212
204
  const result = runWithStreamHost(() => started.result());
@@ -240,8 +232,7 @@ function createRuntime(registry, transportHost) {
240
232
  }
241
233
  const usedHosts = /* @__PURE__ */ new Set();
242
234
  if (!explicitHost) {
243
- if (sessionId) for (const host of defaultHostsBySession.get(sessionId) ?? []) usedHosts.add(host);
244
- else for (const owners of defaultHostsBySession.values()) for (const host of owners) usedHosts.add(host);
235
+ for (const [, owners] of selectDefaultHostSessions(defaultHostsBySession, sessionId)) for (const host of owners ?? []) usedHosts.add(host);
245
236
  usedHosts.add(getDefaultAiTransportHost());
246
237
  }
247
238
  const hosts = explicitHost ? [explicitHost] : [...usedHosts];
@@ -1,4 +1,4 @@
1
- import { i as clampTimerTimeoutMs } from "./number-coercion-V8-BhME4.mjs";
1
+ import { a as clampTimerTimeoutMs } from "./number-coercion-C3hztWoY.mjs";
2
2
  //#region packages/ai/src/utils/stream-first-event-timeout.ts
3
3
  function getFirstStreamEventTimeoutMs(options) {
4
4
  return options?.firstEventTimeoutMs;
@@ -46,14 +46,8 @@ function withFirstStreamEventTimeout(stream, context) {
46
46
  const iterator = stream[Symbol.asyncIterator]();
47
47
  let timer;
48
48
  let completed = false;
49
- const clear = () => {
50
- if (timer) {
51
- clearTimeout(timer);
52
- timer = void 0;
53
- }
54
- };
55
49
  try {
56
- const first = await new Promise((resolve, reject) => {
50
+ let next = await new Promise((resolve, reject) => {
57
51
  timer = setTimeout(() => {
58
52
  const timeoutError = createFirstStreamEventTimeoutError(timeoutContext);
59
53
  timeoutContext.onTimeout?.(timeoutError);
@@ -62,22 +56,15 @@ function withFirstStreamEventTimeout(stream, context) {
62
56
  }, timeoutMs);
63
57
  timer.unref?.();
64
58
  iterator.next().then(resolve, reject);
65
- }).finally(clear);
66
- if (first.done) {
67
- completed = true;
68
- return;
69
- }
70
- yield first.value;
71
- for (;;) {
72
- const next = await iterator.next();
73
- if (next.done) {
74
- completed = true;
75
- return;
76
- }
59
+ }).finally(() => {
60
+ if (timer) clearTimeout(timer);
61
+ });
62
+ while (!next.done) {
77
63
  yield next.value;
64
+ next = await iterator.next();
78
65
  }
66
+ completed = true;
79
67
  } finally {
80
- clear();
81
68
  if (!completed) iterator.return?.().catch(() => void 0);
82
69
  }
83
70
  } };
@@ -41,5 +41,20 @@ function createSseByteGuard(reader, opts) {
41
41
  cancelled: () => cancelledFlag
42
42
  };
43
43
  }
44
+ /** Lazily bound an SDK response while preserving upstream cancellation. */
45
+ function boundResponseBody(response, options) {
46
+ if (!response.body || typeof response.body.getReader !== "function") return response;
47
+ const guard = createSseByteGuard(response.body.getReader(), options);
48
+ return new Response(new ReadableStream({
49
+ async pull(controller) {
50
+ const { done, value } = await guard.read();
51
+ if (done) controller.close();
52
+ else controller.enqueue(value);
53
+ },
54
+ async cancel(reason) {
55
+ await guard.cancel(reason);
56
+ }
57
+ }), response);
58
+ }
44
59
  //#endregion
45
- export { createSseByteGuard as t };
60
+ export { createSseByteGuard as n, boundResponseBody as t };
@@ -2,7 +2,7 @@ import { a as normalizeOptionalString } from "./string-coerce-CtgOVOSv.mjs";
2
2
  //#region packages/normalization-core/src/string-normalization.ts
3
3
  /** Coerces entries to strings, trims them, and drops empty results. */
4
4
  function normalizeStringEntries(list) {
5
- return (list ?? []).map((entry) => normalizeOptionalString(String(entry)) ?? "").filter(Boolean);
5
+ return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);
6
6
  }
7
7
  /** Returns first-seen unique values while preserving insertion order. */
8
8
  function uniqueValues(values) {
@@ -1,8 +1,9 @@
1
- import { r as getAiTransportHost } from "./host-JpNulOOs.mjs";
2
- import { o as truncateUtf16Safe } from "./provider-error-DQBE1bUQ.mjs";
1
+ import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
2
+ import { r as getAiTransportHost } from "./host-JWXZWa-c.mjs";
3
+ import { s as truncateUtf16Safe } from "./provider-error-CF9GWCs2.mjs";
3
4
  import "./internal/retry-after.mjs";
4
- import { N as raceWithTimeout } from "./transport-stream-shared-C5TAc3U_.mjs";
5
- import "./positive-integer-CwLi8LUL.mjs";
5
+ import { A as shortHash, N as raceWithTimeout } from "./transport-stream-shared-DH08b7Il.mjs";
6
+ import "./positive-integer-CqWjqSi9.mjs";
6
7
  //#region packages/normalization-core/src/response-bytes.ts
7
8
  async function consumeResponseBytes(options) {
8
9
  let size = 0;
@@ -31,6 +32,10 @@ async function consumeResponseBytes(options) {
31
32
  const MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE = "OpenClaw transport error: malformed_streaming_fragment";
32
33
  const NON_LATIN_RE = /[\u2E80-\u9FFF\uA000-\uA4FF\uAC00-\uD7AF\uF900-\uFAFF\uFF01-\uFF60\uFFE0-\uFFE6\u{20000}-\u{2FA1F}]/gu;
33
34
  const CJK_SURROGATE_HIGH_RE = /[\uD840-\uD87E][\uDC00-\uDFFF]/g;
35
+ /** Keep provider payloads out of parse errors without replacing unrelated failures. */
36
+ function streamFragmentError(cause, ErrorType = Error) {
37
+ return cause instanceof SyntaxError ? new ErrorType(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause }) : cause;
38
+ }
34
39
  function redactSensitiveText(text) {
35
40
  return getAiTransportHost().redactToolPayloadText(text);
36
41
  }
@@ -105,6 +110,28 @@ async function readResponseTextSnippet(response, options) {
105
110
  return truncated ? `${collapsed}…` : collapsed;
106
111
  }
107
112
  //#endregion
113
+ //#region packages/ai/src/transports/provider-replay-context.ts
114
+ function isProviderReplayContext(value) {
115
+ return isRecord(value) && typeof value.provider === "string" && typeof value.api === "string" && typeof value.model === "string" && (value.baseUrlHash === void 0 || typeof value.baseUrlHash === "string") && (value.sessionHash === void 0 || typeof value.sessionHash === "string") && (value.authProfileHash === void 0 || typeof value.authProfileHash === "string");
116
+ }
117
+ function hashReplayContextValue(value) {
118
+ const normalized = value?.trim();
119
+ return normalized ? shortHash(normalized) : void 0;
120
+ }
121
+ function buildProviderReplayContext(model, options) {
122
+ return {
123
+ provider: model.provider,
124
+ api: model.api,
125
+ model: model.id,
126
+ baseUrlHash: hashReplayContextValue(model.baseUrl),
127
+ sessionHash: hashReplayContextValue(options?.sessionId),
128
+ authProfileHash: hashReplayContextValue(options?.authProfileId)
129
+ };
130
+ }
131
+ function providerReplayContextMatches(state, context) {
132
+ return state.provider === context.provider && state.api === context.api && state.model === context.model && state.baseUrlHash === context.baseUrlHash && state.sessionHash === context.sessionHash && state.authProfileHash === context.authProfileHash;
133
+ }
134
+ //#endregion
108
135
  //#region packages/ai/src/utils/text-signature.ts
109
136
  function encodeTextSignatureV1(id, phase) {
110
137
  return JSON.stringify({
@@ -114,4 +141,4 @@ function encodeTextSignatureV1(id, phase) {
114
141
  });
115
142
  }
116
143
  //#endregion
117
- export { readResponseTextSnippet as a, supportsModelTools as c, isCodeModeModelVisibleToolName as i, MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE as n, redactSensitiveText as o, estimateStringChars as r, resolveModelHeaderSentinels as s, encodeTextSignatureV1 as t };
144
+ export { MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE as a, readResponseTextSnippet as c, streamFragmentError as d, supportsModelTools as f, providerReplayContextMatches as i, redactSensitiveText as l, buildProviderReplayContext as n, estimateStringChars as o, consumeResponseBytes as p, isProviderReplayContext as r, isCodeModeModelVisibleToolName as s, encodeTextSignatureV1 as t, resolveModelHeaderSentinels as u };