@openclaw/ai 2026.10.5-beta.4 → 2026.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{anthropic-BalhAzs-.mjs → anthropic-DusktpKG.mjs} +6 -6
  2. package/dist/{anthropic-payload-policy-DGblkHL5.d.mts → anthropic-payload-policy-DVv20UCL.d.mts} +1 -1
  3. package/dist/{anthropic-stream-reducer-DkKeXXx4.mjs → anthropic-stream-reducer-BY-gN9EE.mjs} +12 -7
  4. package/dist/{assistant-output-BuhRpLeD.mjs → assistant-output-DDZq4a3j.mjs} +2 -2
  5. package/dist/{assistant-text-phase-Bn1hbvK9.mjs → assistant-text-phase-CgpXhaLS.mjs} +1 -1
  6. package/dist/{azure-openai-responses-DfT9Ndd8.mjs → azure-openai-responses-yuBKi0s4.mjs} +4 -4
  7. package/dist/{google-sYI2wnY6.mjs → google-NMkwYgCy.mjs} +2 -2
  8. package/dist/{google-interactions-9SSqsJg9.mjs → google-interactions-BEV3C85P.mjs} +19 -16
  9. package/dist/{google-messages-DsB7fmoQ.mjs → google-messages-BhdxpH4K.mjs} +6 -4
  10. package/dist/{google-provider-stream-CcEI2-MC.mjs → google-provider-stream-B0GeAuTB.mjs} +6 -6
  11. package/dist/{google-shared-zGR0QUyS.mjs → google-shared-Cpz8bSTL.mjs} +13 -18
  12. package/dist/{google-vertex-Dw_abY1w.mjs → google-vertex-DJvQwNgr.mjs} +2 -2
  13. package/dist/{host-Bf3NjYNj.mjs → host-CIzdzpBn.mjs} +1 -1
  14. package/dist/{host-policy-BzZluO6_.mjs → host-policy-C0y3BC9R.mjs} +1 -1
  15. package/dist/index.mjs +2 -2
  16. package/dist/internal/anthropic.d.mts +2 -2
  17. package/dist/internal/anthropic.mjs +3 -3
  18. package/dist/internal/google-model-family.d.mts +2 -0
  19. package/dist/internal/google-model-family.mjs +6 -2
  20. package/dist/internal/openai-completions-compat.d.mts +1 -1
  21. package/dist/internal/openai-completions-compat.mjs +1 -1
  22. package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
  23. package/dist/internal/openai-responses-payload-policy.mjs +2 -2
  24. package/dist/internal/openai.d.mts +5 -5
  25. package/dist/internal/openai.mjs +9 -9
  26. package/dist/internal/runtime.mjs +4 -4
  27. package/dist/internal/shared.mjs +3 -3
  28. package/dist/{mistral-dCDCR5ur.mjs → mistral-CDK7WGwC.mjs} +4 -4
  29. package/dist/{openai-chatgpt-responses-BHI3uCcA.mjs → openai-chatgpt-responses-BjfLWIK6.mjs} +11 -11
  30. package/dist/{openai-completions-CrVgnFrV.mjs → openai-completions-BkRt2Iy4.mjs} +3 -3
  31. package/dist/{openai-completions-compat-i-nLZxFy.d.mts → openai-completions-compat-B86jN9ii.d.mts} +2 -0
  32. package/dist/{openai-completions-compat-CYX18uDk.mjs → openai-completions-compat-CpeOT7jH.mjs} +3 -1
  33. package/dist/{openai-completions-transport-Dy4CZo9Q.mjs → openai-completions-transport-BRjxCG1C.mjs} +28 -27
  34. package/dist/{openai-prompt-cache-r93BJhjm.mjs → openai-prompt-cache-CvftfMfD.mjs} +1 -1
  35. package/dist/{openai-responses-D5oiAUOG.mjs → openai-responses-BUDpkW8I.mjs} +6 -6
  36. package/dist/{openai-responses-compaction-replay-B2FE4Nw8.d.mts → openai-responses-compaction-replay-DtEbZJbU.d.mts} +2 -2
  37. package/dist/{openai-responses-contracts-DKqMJ1Ct.d.mts → openai-responses-contracts-Cm1QilsO.d.mts} +1 -1
  38. package/dist/{openai-responses-contracts-DlKMMTxK.mjs → openai-responses-contracts-DbD7sGP-.mjs} +7 -1
  39. package/dist/{openai-responses-endpoint-CinGh4VZ.mjs → openai-responses-endpoint-COHJK1MR.mjs} +1 -1
  40. package/dist/{openai-responses-request-lifecycle-NSIJo9jY.mjs → openai-responses-request-lifecycle-Cx2nKN1G.mjs} +3 -3
  41. package/dist/{openai-responses-shared-D-aDYAkJ.mjs → openai-responses-shared-C1GHTB0q.mjs} +26 -13
  42. package/dist/{provider-options-CVrXZBtA.d.mts → provider-options-DTuD2UNR.d.mts} +6 -1
  43. package/dist/{provider-transport-turn-state-BOpxgm-J.mjs → provider-transport-turn-state-O5JWdUL4.mjs} +2 -2
  44. package/dist/providers.mjs +10 -10
  45. package/dist/{simple-options-BAu4B54D.mjs → simple-options-CmtE6whA.mjs} +3 -3
  46. package/dist/{stream-Dd8DwRFL.mjs → stream-BBjz-Jw2.mjs} +1 -1
  47. package/dist/text-signature-an0fgbDz.mjs +34 -0
  48. package/dist/{transport-stream-shared-CWGOuLcA.mjs → transport-stream-shared-Dr_GBa9K.mjs} +1 -1
  49. package/dist/{text-signature-Drb4Erb8.mjs → transport-utils-DmYqQcG7.mjs} +3 -35
  50. package/dist/transports.d.mts +8 -6
  51. package/dist/transports.mjs +14 -14
  52. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
2
  import { w as supportsClaudeAdaptiveThinking } from "./src-C44MKrW5.mjs";
3
3
  import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
4
- import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
5
- import { d as streamFragmentError } from "./text-signature-Drb4Erb8.mjs";
6
- import { D as suppressAnthropicCompaction, J as isAnthropicOAuthApiKey, P as isDirectAnthropicModel, T as isAnthropicReplayRejection, V as supportsAnthropicServerSideFallback, X as usesFoundryBearerAuth, Y as omitFoundryBearerCredentialHeaders, d as applyAnthropicThinkingOptions, l as buildAnthropicRequest, t as consumeAnthropicStream, u as prepareAnthropicRequest } from "./anthropic-stream-reducer-DkKeXXx4.mjs";
4
+ import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
5
+ import { s as streamFragmentError } from "./transport-utils-DmYqQcG7.mjs";
6
+ import { D as suppressAnthropicCompaction, J as isAnthropicOAuthApiKey, P as isDirectAnthropicModel, T as isAnthropicReplayRejection, V as supportsAnthropicServerSideFallback, X as usesFoundryBearerAuth, Y as omitFoundryBearerCredentialHeaders, d as applyAnthropicThinkingOptions, l as buildAnthropicRequest, t as consumeAnthropicStream, u as prepareAnthropicRequest } from "./anthropic-stream-reducer-BY-gN9EE.mjs";
7
7
  import { i as resolveCacheRetention, n as resolveCloudflareBaseUrl, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
8
- import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-CWGOuLcA.mjs";
9
- import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-BAu4B54D.mjs";
8
+ import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-Dr_GBa9K.mjs";
9
+ import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-CmtE6whA.mjs";
10
10
  import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
11
11
  import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
12
- import { t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
12
+ import { t as createAssistantOutput } from "./assistant-output-DDZq4a3j.mjs";
13
13
  import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
14
14
  import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
15
15
  import { t as requireApiKey } from "./required-api-key-CFJvcFy_.mjs";
@@ -1,6 +1,6 @@
1
1
  import "./index-BYDvopUB.mjs";
2
2
  import { k as Model } from "./types-Bd2T86VJ.mjs";
3
- import { t as AnthropicContextManagementOptions } from "./provider-options-CVrXZBtA.mjs";
3
+ import { t as AnthropicContextManagementOptions } from "./provider-options-DTuD2UNR.mjs";
4
4
  import { TextBlockParam } from "@anthropic-ai/sdk/resources/messages.js";
5
5
  //#region packages/ai/src/transports/anthropic-payload-policy.d.ts
6
6
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
@@ -4,17 +4,18 @@ import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
4
4
  import { a as asRecord, o as isRecord, r as asOptionalObjectRecord, s as readStringField } from "./record-coerce-CNDovvft.mjs";
5
5
  import { i as normalizeOptionalLowercaseString, r as normalizeNullableString } from "./string-coerce-CtgOVOSv.mjs";
6
6
  import { n as asNonNegativeFiniteNumber } from "./number-coercion-C3hztWoY.mjs";
7
- import { N as isImageWithMediaPayload, O as calculateCost, S as resolveAnthropicThinkingEffort, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, r as getAiTransportHost, u as STREAM_ERROR_FALLBACK_TEXT, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "./host-Bf3NjYNj.mjs";
8
- import { i as providerReplayContextMatches, n as buildProviderReplayContext, r as isProviderReplayContext } from "./text-signature-Drb4Erb8.mjs";
7
+ import { N as isImageWithMediaPayload, O as calculateCost, S as resolveAnthropicThinkingEffort, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, r as getAiTransportHost, u as STREAM_ERROR_FALLBACK_TEXT, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "./host-CIzdzpBn.mjs";
8
+ import "./transport-utils-DmYqQcG7.mjs";
9
9
  import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
10
- import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-BzZluO6_.mjs";
10
+ import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-C0y3BC9R.mjs";
11
11
  import { i as resolveCacheRetention } from "./cloudflare-5qSGvIUH.mjs";
12
- import { C as parseJsonObjectPreservingUnsafeIntegers, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, b as transportAbortError, d as iterateModelStream, i as copyProviderAcceptanceObserver, l as finalizeTerminalToolCallArguments, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-CWGOuLcA.mjs";
13
- import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText, p as extractToolResultBlockText, t as adjustMaxTokensForThinking, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-BAu4B54D.mjs";
12
+ import { C as parseJsonObjectPreservingUnsafeIntegers, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, b as transportAbortError, d as iterateModelStream, i as copyProviderAcceptanceObserver, l as finalizeTerminalToolCallArguments, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-Dr_GBa9K.mjs";
13
+ import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText, p as extractToolResultBlockText, t as adjustMaxTokensForThinking, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-CmtE6whA.mjs";
14
14
  import { t as parsePositiveInteger } from "./positive-integer-CqWjqSi9.mjs";
15
- import { n as transformProviderMessages } from "./assistant-output-BuhRpLeD.mjs";
15
+ import { i as providerReplayContextMatches, n as buildProviderReplayContext, r as isProviderReplayContext } from "./text-signature-an0fgbDz.mjs";
16
+ import { n as transformProviderMessages } from "./assistant-output-DDZq4a3j.mjs";
16
17
  import { i as SCHEMA_MAP_KEYS, n as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-B8sG1I9v.mjs";
17
- import { i as tagPendingCommentaryText } from "./assistant-text-phase-Bn1hbvK9.mjs";
18
+ import { i as tagPendingCommentaryText } from "./assistant-text-phase-CgpXhaLS.mjs";
18
19
  import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
19
20
  //#region packages/ai/src/providers/anthropic-auth-headers.ts
20
21
  /** Inspect resolved credential shape for auth routing without exposing its value. */
@@ -925,6 +926,10 @@ async function convertContentBlocks(content, model, imageBudget, profile, isErro
925
926
  async function convertAnthropicMessages(transformedMessages, model, isOAuthToken, options) {
926
927
  const params = [];
927
928
  const appendMessage = (message) => {
929
+ if (message.role === "system" && (!params.length || params.at(-1)?.role === "assistant")) params.push({
930
+ role: "user",
931
+ content: "."
932
+ });
928
933
  if (message.role === "user" && params.at(-1)?.role === "system") params.push({
929
934
  role: "assistant",
930
935
  content: [{
@@ -1,5 +1,5 @@
1
- import { c as transformMessages } from "./host-Bf3NjYNj.mjs";
2
- import { a as createEmptyTransportUsage } from "./transport-stream-shared-CWGOuLcA.mjs";
1
+ import { c as transformMessages } from "./host-CIzdzpBn.mjs";
2
+ import { a as createEmptyTransportUsage } from "./transport-stream-shared-Dr_GBa9K.mjs";
3
3
  //#region packages/ai/src/provider-transcript-transform.ts
4
4
  const IMAGE_OMISSION = "(image omitted: model does not support images)";
5
5
  const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
@@ -1,4 +1,4 @@
1
- import { t as encodeTextSignatureV1 } from "./text-signature-Drb4Erb8.mjs";
1
+ import { t as encodeTextSignatureV1 } from "./text-signature-an0fgbDz.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  //#region packages/ai/src/utils/assistant-text-phase.ts
4
4
  const EMPTY_ASSISTANT_TEXT_BLOCK_SET = /* @__PURE__ */ new Set();
@@ -1,9 +1,9 @@
1
1
  import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
2
- import { r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
3
- import { n as buildBaseOptions } from "./simple-options-BAu4B54D.mjs";
4
- import { F as convertProviderResponsesMessages, Ft as resolvePromptCacheKey, _t as resolveOpenAISimpleReasoningEffort, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-D-aDYAkJ.mjs";
2
+ import { r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
3
+ import { n as buildBaseOptions } from "./simple-options-CmtE6whA.mjs";
4
+ import { F as convertProviderResponsesMessages, It as resolvePromptCacheKey, _t as resolveOpenAISimpleReasoningEffort, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-C1GHTB0q.mjs";
5
5
  import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
6
- import { t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
6
+ import { t as createAssistantOutput } from "./assistant-output-DDZq4a3j.mjs";
7
7
  import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-D0dvJMbZ.mjs";
8
8
  import { t as requireApiKey } from "./required-api-key-CFJvcFy_.mjs";
9
9
  import OpenAI, { AzureOpenAI } from "openai";
@@ -1,8 +1,8 @@
1
- import { r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
1
+ import { r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
2
2
  import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
3
3
  import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
4
4
  import { t as requireApiKey } from "./required-api-key-CFJvcFy_.mjs";
5
- import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-CcEI2-MC.mjs";
5
+ import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-B0GeAuTB.mjs";
6
6
  import { GoogleGenAI } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google.ts
8
8
  const { stream: streamGoogle, streamSimple: streamSimpleGoogle } = createGoogleGenerateContentStreams("google-generative-ai", (model, options) => {
@@ -1,12 +1,13 @@
1
1
  import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
2
2
  import { a as asRecord, i as asOptionalRecord, s as readStringField } from "./record-coerce-CNDovvft.mjs";
3
- import { O as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
4
- import { t as buildGuardedModelFetch } from "./host-policy-BzZluO6_.mjs";
5
- import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-CWGOuLcA.mjs";
6
- import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-BAu4B54D.mjs";
3
+ import { O as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
4
+ import { s as streamFragmentError } from "./transport-utils-DmYqQcG7.mjs";
5
+ import { t as buildGuardedModelFetch } from "./host-policy-C0y3BC9R.mjs";
6
+ import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-Dr_GBa9K.mjs";
7
+ import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-CmtE6whA.mjs";
7
8
  import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
8
- import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
9
- import { n as buildGoogleInteractionsSimpleThinking } from "./google-shared-zGR0QUyS.mjs";
9
+ import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-DDZq4a3j.mjs";
10
+ import { n as buildGoogleInteractionsSimpleThinking } from "./google-shared-Cpz8bSTL.mjs";
10
11
  import { createRequire } from "node:module";
11
12
  //#region packages/ai/src/providers/google-interactions-request.ts
12
13
  const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com";
@@ -359,14 +360,16 @@ async function runGoogleInteractionsLifecycle(params) {
359
360
  let sawCompletion = false;
360
361
  while (!streamDone) {
361
362
  const { done, value } = await reader.read();
362
- if (done) break;
363
- buffer += decoder.decode(value, { stream: true });
364
- const lines = buffer.split("\n");
365
- buffer = lines.pop() ?? "";
366
- for (const line of lines) {
367
- const trimmed = line.trim();
368
- if (!trimmed || !trimmed.startsWith("data:")) continue;
369
- const dataStr = trimmed.slice(5).trim();
363
+ buffer += decoder.decode(value, { stream: !done });
364
+ const frames = buffer.split(/(?:\r\n|\r(?!\n)|\n)(?:\r\n|\r(?!\n)|\n)/);
365
+ buffer = frames.pop() ?? "";
366
+ if (done) {
367
+ if (/[\r\n]$/.test(buffer)) frames.push(buffer);
368
+ streamDone = true;
369
+ }
370
+ for (const frame of frames) {
371
+ const dataStr = frame.split(/\r\n|\r|\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5)).join("\n").trim();
372
+ if (!dataStr) continue;
370
373
  if (dataStr === "[DONE]") {
371
374
  streamDone = true;
372
375
  break;
@@ -374,8 +377,8 @@ async function runGoogleInteractionsLifecycle(params) {
374
377
  let event;
375
378
  try {
376
379
  event = asRecord(parseJsonPreservingUnsafeIntegers(dataStr));
377
- } catch {
378
- continue;
380
+ } catch (error) {
381
+ throw streamFragmentError(error);
379
382
  }
380
383
  const eventType = event.event_type || event.type;
381
384
  logGoogleInteractionsDebug("stream event", { eventType: typeof eventType === "string" ? eventType : "unknown" });
@@ -1,11 +1,13 @@
1
1
  import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
2
- import { N as isImageWithMediaPayload, O as calculateCost } from "./host-Bf3NjYNj.mjs";
3
- import { P as sanitizeSurrogates, a as createEmptyTransportUsage, b as transportAbortError, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-CWGOuLcA.mjs";
4
- import { D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText } from "./simple-options-BAu4B54D.mjs";
2
+ import { N as isImageWithMediaPayload, O as calculateCost } from "./host-CIzdzpBn.mjs";
3
+ import { P as sanitizeSurrogates, a as createEmptyTransportUsage, b as transportAbortError, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-Dr_GBa9K.mjs";
4
+ import { D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText } from "./simple-options-CmtE6whA.mjs";
5
5
  import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
6
+ import { isGoogleGemini4Model } from "./internal/google-model-family.mjs";
6
7
  //#region packages/ai/src/transports/google-thinking-level.ts
7
- /** Returns whether a Gemini Flash model accepts the MINIMAL thinking level. */
8
+ /** Reports MINIMAL support for Gemini Flash and Gemini 4 models. */
8
9
  function googleFlashSupportsMinimalThinking(modelId) {
10
+ if (isGoogleGemini4Model(modelId)) return false;
9
11
  const match = modelId.toLowerCase().match(/(?:^|\/)gemini-3\.(\d+)-flash(?:-|$)/);
10
12
  if (!match) return true;
11
13
  return Number.parseInt(match[1] ?? "0", 10) < 7;
@@ -1,10 +1,10 @@
1
1
  import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
2
- import { a as resolveAiTransportHeaderSentinels } from "./host-Bf3NjYNj.mjs";
3
- import { n as buildManagedModelFetch } from "./host-policy-BzZluO6_.mjs";
4
- import { f as mergeTransportHeaders } from "./transport-stream-shared-CWGOuLcA.mjs";
5
- import { n as buildBaseOptions } from "./simple-options-BAu4B54D.mjs";
6
- import { t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
7
- import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-zGR0QUyS.mjs";
2
+ import { a as resolveAiTransportHeaderSentinels } from "./host-CIzdzpBn.mjs";
3
+ import { n as buildManagedModelFetch } from "./host-policy-C0y3BC9R.mjs";
4
+ import { f as mergeTransportHeaders } from "./transport-stream-shared-Dr_GBa9K.mjs";
5
+ import { n as buildBaseOptions } from "./simple-options-CmtE6whA.mjs";
6
+ import { t as createAssistantOutput } from "./assistant-output-DDZq4a3j.mjs";
7
+ import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-Cpz8bSTL.mjs";
8
8
  import { ResourceScope } from "@google/genai";
9
9
  //#region packages/ai/src/providers/google-http-options.ts
10
10
  function buildGoogleHttpOptions(model, optionsHeaders, profile) {
@@ -1,8 +1,9 @@
1
- import { k as clampThinkingLevel } from "./host-Bf3NjYNj.mjs";
2
- import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-CWGOuLcA.mjs";
3
- import { C as stripSystemPromptCacheBoundary } from "./simple-options-BAu4B54D.mjs";
4
- import { n as transformProviderMessages } from "./assistant-output-BuhRpLeD.mjs";
5
- import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-DsB7fmoQ.mjs";
1
+ import { k as clampThinkingLevel } from "./host-CIzdzpBn.mjs";
2
+ import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-Dr_GBa9K.mjs";
3
+ import { C as stripSystemPromptCacheBoundary } from "./simple-options-CmtE6whA.mjs";
4
+ import { n as transformProviderMessages } from "./assistant-output-DDZq4a3j.mjs";
5
+ import { isGoogleGemini3ProModel, isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
6
+ import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-BhdxpH4K.mjs";
6
7
  import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
7
8
  //#region packages/ai/src/providers/google-shared.ts
8
9
  function convertMessages(model, context) {
@@ -10,7 +11,7 @@ function convertMessages(model, context) {
10
11
  model,
11
12
  messages: transformProviderMessages(context.messages, model, (id) => requiresGoogleToolCallId(model.id) ? id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64) : id),
12
13
  replay: "signed-parts",
13
- requiresToolCallSignature: model.provider !== "google-gemini-cli" && (isGemini3ProModel(model) || isGemini3FlashModel(model))
14
+ requiresToolCallSignature: model.provider !== "google-gemini-cli" && isGoogleGemini3ThinkingLevelModel(model.id)
14
15
  });
15
16
  }
16
17
  function mapToolChoice(choice) {
@@ -89,7 +90,7 @@ function buildGoogleSimpleThinking(model, options) {
89
90
  enabled: true,
90
91
  level: ThinkingLevel.HIGH
91
92
  };
92
- return isGemini3ProModel(model) || isGemini3FlashModel(model) ? { enabled: true } : {
93
+ return isGoogleGemini3ThinkingLevelModel(model.id) ? { enabled: true } : {
93
94
  enabled: true,
94
95
  budgetTokens: -1
95
96
  };
@@ -97,7 +98,7 @@ function buildGoogleSimpleThinking(model, options) {
97
98
  const clampedReasoning = clampThinkingLevel(model, options.reasoning);
98
99
  if (clampedReasoning === "off") return { enabled: false };
99
100
  const effort = clampedReasoning === "max" ? "high" : clampedReasoning;
100
- if (isGemini3ProModel(model) || isGemini3FlashModel(model) || isGemma4Model(model)) return {
101
+ if (isGoogleGemini3ThinkingLevelModel(model.id) || isGemma4Model(model)) return {
101
102
  enabled: true,
102
103
  level: getGoogleThinkingLevel(effort, model)
103
104
  };
@@ -129,8 +130,8 @@ function buildGoogleInteractionsSimpleThinking(model, options) {
129
130
  };
130
131
  }
131
132
  function getDisabledGoogleThinkingConfig(model) {
132
- if (isGemini3ProModel(model)) return { thinkingLevel: ThinkingLevel.LOW };
133
- if (isGemini3FlashModel(model)) return { thinkingLevel: googleFlashSupportsMinimalThinking(model.id) ? ThinkingLevel.MINIMAL : ThinkingLevel.LOW };
133
+ if (isGoogleGemini3ProModel(model.id)) return { thinkingLevel: ThinkingLevel.LOW };
134
+ if (isGoogleGemini3ThinkingLevelModel(model.id)) return { thinkingLevel: googleFlashSupportsMinimalThinking(model.id) ? ThinkingLevel.MINIMAL : ThinkingLevel.LOW };
134
135
  if (isGemma4Model(model) || model.id.toLowerCase().includes("gemini-2.5-pro")) return {};
135
136
  return { thinkingBudget: 0 };
136
137
  }
@@ -138,18 +139,12 @@ function getDisabledGoogleThinkingConfig(model) {
138
139
  function isGemma4Model(model) {
139
140
  return /gemma-?4/.test(model.id.toLowerCase());
140
141
  }
141
- function isGemini3ProModel(model) {
142
- return /gemini-(?:3(?:\.\d+)?-pro|pro-latest)/.test(model.id.toLowerCase());
143
- }
144
- function isGemini3FlashModel(model) {
145
- return /gemini-(?:3(?:\.\d+)?-flash|flash(?:-lite)?-latest)/.test(model.id.toLowerCase());
146
- }
147
142
  function getGoogleThinkingLevel(effort, model) {
148
143
  const lowEffort = effort === "minimal" || effort === "low";
149
- if (isGemini3ProModel(model)) return lowEffort ? ThinkingLevel.LOW : ThinkingLevel.HIGH;
144
+ if (isGoogleGemini3ProModel(model.id)) return lowEffort ? ThinkingLevel.LOW : ThinkingLevel.HIGH;
150
145
  if (isGemma4Model(model)) return lowEffort ? ThinkingLevel.MINIMAL : ThinkingLevel.HIGH;
151
146
  switch (effort) {
152
- case "minimal": return isGemini3FlashModel(model) && !googleFlashSupportsMinimalThinking(model.id) ? ThinkingLevel.LOW : ThinkingLevel.MINIMAL;
147
+ case "minimal": return googleFlashSupportsMinimalThinking(model.id) ? ThinkingLevel.MINIMAL : ThinkingLevel.LOW;
153
148
  case "low": return ThinkingLevel.LOW;
154
149
  case "medium": return ThinkingLevel.MEDIUM;
155
150
  case "high": return ThinkingLevel.HIGH;
@@ -1,6 +1,6 @@
1
1
  import { a as normalizeOptionalString } from "./string-coerce-CtgOVOSv.mjs";
2
- import { r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
3
- import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-CcEI2-MC.mjs";
2
+ import { r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
3
+ import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-B0GeAuTB.mjs";
4
4
  import { GoogleGenAI } from "@google/genai";
5
5
  //#region packages/ai/src/providers/google-vertex.ts
6
6
  const API_VERSION = "v1";
@@ -2,7 +2,7 @@ import { D as supportsClaudeNativeMaxEffort, O as supportsClaudeNativeXhighEffor
2
2
  import { t as DEFAULT_MISSING_TOOL_RESULT_TEXT } from "./types-CQc6JNG4.mjs";
3
3
  import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
4
4
  import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
5
- import { A as MODEL_CATALOG_THINKING_LEVELS, M as resolveOpenAIThinkingApi, i as OPENAI_RESPONSES_APIS, j as listMappedModelThinkingLevels, w as resolveOpenAIModelReasoningEfforts } from "./openai-responses-contracts-DlKMMTxK.mjs";
5
+ import { M as listMappedModelThinkingLevels, N as resolveOpenAIThinkingApi, T as resolveOpenAIModelReasoningEfforts, i as OPENAI_RESPONSES_APIS, j as MODEL_CATALOG_THINKING_LEVELS } from "./openai-responses-contracts-DbD7sGP-.mjs";
6
6
  //#region packages/ai/src/media-payload.ts
7
7
  /** Media metadata alone is not an attachment; provider emitters need inline bytes. */
8
8
  function hasMediaPayload(block) {
@@ -1,4 +1,4 @@
1
- import { r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
1
+ import { r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
2
2
  //#region packages/ai/src/transports/host-policy.ts
3
3
  function buildGuardedModelFetch(model, timeoutMs, options) {
4
4
  const host = getAiTransportHost();
package/dist/index.mjs CHANGED
@@ -4,6 +4,6 @@ import { t as appendTextDeltaToAssistantMessage } from "./assistant-message-even
4
4
  import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
5
5
  import { a as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
6
6
  import { n as validateToolCall, t as validateToolArguments } from "./validation-ZX_sPVV0.mjs";
7
- import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-Dd8DwRFL.mjs";
8
- import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-Bf3NjYNj.mjs";
7
+ import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-BBjz-Jw2.mjs";
8
+ import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-CIzdzpBn.mjs";
9
9
  export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, DEFAULT_MISSING_TOOL_RESULT_TEXT, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, createNodeLlmRuntime, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
@@ -1,8 +1,8 @@
1
1
  import { C as resolveClaudeOpus55ModelIdentity, E as resolveClaudeSonnet5ModelIdentity, M as supportsClaudeNativeXhighEffort, O as supportsClaudeAdaptiveThinking, S as resolveClaudeNativeThinkingLevelMap, T as resolveClaudeSonnet55ModelIdentity, _ as requiresClaudeMandatoryAdaptiveThinking, b as resolveClaudeModelIdentity, g as requiresClaudeDefaultSampling, h as requiresClaudeBetweenToolsThinking, j as supportsClaudeNativeMaxEffort, m as bindsClaudeThinkingPrefix, v as resolveClaudeFable5ModelIdentity, w as resolveClaudeOpus5ModelIdentity, x as resolveClaudeMythos5ModelIdentity, y as resolveClaudeHaiku55ModelIdentity } from "../index-BYDvopUB.mjs";
2
2
  import { $ as StopReason, Et as AssistantMessageDiagnostic, Q as SimpleStreamOptions, d as Context, k as Model, pt as Usage, tt as StreamFunction } from "../types-Bd2T86VJ.mjs";
3
- import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-CVrXZBtA.mjs";
3
+ import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-DTuD2UNR.mjs";
4
4
  import "../types-Kdfw_04V.mjs";
5
- import { p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-DGblkHL5.mjs";
5
+ import { p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-DVv20UCL.mjs";
6
6
  import { Tool } from "@anthropic-ai/sdk/resources/messages.js";
7
7
  //#region packages/ai/src/providers/anthropic.d.ts
8
8
  type AnthropicCompactionOptions = AnthropicOptions & {
@@ -1,5 +1,5 @@
1
1
  import { D as supportsClaudeNativeMaxEffort, O as supportsClaudeNativeXhighEffort, S as resolveClaudeSonnet5ModelIdentity, _ as resolveClaudeMythos5ModelIdentity, b as resolveClaudeOpus5ModelIdentity, d as requiresClaudeBetweenToolsThinking, f as requiresClaudeDefaultSampling, g as resolveClaudeModelIdentity, h as resolveClaudeHaiku55ModelIdentity, m as resolveClaudeFable5ModelIdentity, p as requiresClaudeMandatoryAdaptiveThinking, u as bindsClaudeThinkingPrefix, v as resolveClaudeNativeThinkingLevelMap, w as supportsClaudeAdaptiveThinking, x as resolveClaudeSonnet55ModelIdentity, y as resolveClaudeOpus55ModelIdentity } from "../src-C44MKrW5.mjs";
2
- import { C as resolveModelBoundThinkingReplayMode, S as resolveAnthropicThinkingEffort, T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, b as prepareClaudeNoPrefillRequestContext, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "../host-Bf3NjYNj.mjs";
3
- import { B as resolveAnthropicServerCompactionPlan, C as logAnthropicThinkingDrops, G as applyAnthropicFallbackBoundary, H as ANTHROPIC_SERVER_SIDE_FALLBACKS, J as isAnthropicOAuthApiKey, K as readAnthropicFallbackBoundary, P as isDirectAnthropicModel, S as findActiveAnthropicToolTurnAssistantIndex, U as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, W as CLAUDE_OPUS_FALLBACK_MODEL_COST, X as usesFoundryBearerAuth, Y as omitFoundryBearerCredentialHeaders, _ as reconcileAnthropicToolChoice, a as readAnthropicPromptUsageSnapshot, b as ANTHROPIC_OMITTED_REASONING_TEXT, c as applyAnthropicRefusal, g as projectAnthropicTools, h as normalizeAnthropicToolChoice, i as readAnthropicCacheWriteUsage, m as normalizeAnthropicToolCallId, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, q as resolveAnthropicFallbackServingModelCost, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as resolveOriginalAnthropicToolName, w as readAnthropicInputTransformations, x as applyAnthropicThinkingBindingControls, y as toClaudeCodeToolName } from "../anthropic-stream-reducer-DkKeXXx4.mjs";
4
- import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-BalhAzs-.mjs";
2
+ import { C as resolveModelBoundThinkingReplayMode, S as resolveAnthropicThinkingEffort, T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, b as prepareClaudeNoPrefillRequestContext, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "../host-CIzdzpBn.mjs";
3
+ import { B as resolveAnthropicServerCompactionPlan, C as logAnthropicThinkingDrops, G as applyAnthropicFallbackBoundary, H as ANTHROPIC_SERVER_SIDE_FALLBACKS, J as isAnthropicOAuthApiKey, K as readAnthropicFallbackBoundary, P as isDirectAnthropicModel, S as findActiveAnthropicToolTurnAssistantIndex, U as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, W as CLAUDE_OPUS_FALLBACK_MODEL_COST, X as usesFoundryBearerAuth, Y as omitFoundryBearerCredentialHeaders, _ as reconcileAnthropicToolChoice, a as readAnthropicPromptUsageSnapshot, b as ANTHROPIC_OMITTED_REASONING_TEXT, c as applyAnthropicRefusal, g as projectAnthropicTools, h as normalizeAnthropicToolChoice, i as readAnthropicCacheWriteUsage, m as normalizeAnthropicToolCallId, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, q as resolveAnthropicFallbackServingModelCost, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as resolveOriginalAnthropicToolName, w as readAnthropicInputTransformations, x as applyAnthropicThinkingBindingControls, y as toClaudeCodeToolName } from "../anthropic-stream-reducer-BY-gN9EE.mjs";
4
+ import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-DusktpKG.mjs";
5
5
  export { ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, buildAnthropicClaudeCodeIdentity, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, isDirectAnthropicModel, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
@@ -1,5 +1,7 @@
1
1
  //#region packages/ai/src/internal/google-model-family.d.ts
2
2
  export declare function isGoogleGemini3ProModel(modelId: string): boolean;
3
3
  export declare function isGoogleGemini3FlashModel(modelId: string): boolean;
4
+ export declare function isGoogleGemini4Model(modelId: string): boolean;
5
+ /** Identifies thinkingLevel-family Gemini models (3.x and 4). */
4
6
  export declare function isGoogleGemini3ThinkingLevelModel(modelId: string): boolean;
5
7
  //#endregion
@@ -8,8 +8,12 @@ function isGoogleGemini3FlashModel(modelId) {
8
8
  const normalized = normalizeLowercaseStringOrEmpty(modelId);
9
9
  return /(?:^|\/)gemini-(?:3(?:\.\d+)?-flash|flash(?:-lite)?-latest)(?:-|$)/.test(normalized);
10
10
  }
11
+ function isGoogleGemini4Model(modelId) {
12
+ return /(?:^|\/)gemini-4(?:[-.]|$)/.test(normalizeLowercaseStringOrEmpty(modelId));
13
+ }
14
+ /** Identifies thinkingLevel-family Gemini models (3.x and 4). */
11
15
  function isGoogleGemini3ThinkingLevelModel(modelId) {
12
- return isGoogleGemini3ProModel(modelId) || isGoogleGemini3FlashModel(modelId);
16
+ return isGoogleGemini3ProModel(modelId) || isGoogleGemini3FlashModel(modelId) || isGoogleGemini4Model(modelId);
13
17
  }
14
18
  //#endregion
15
- export { isGoogleGemini3FlashModel, isGoogleGemini3ProModel, isGoogleGemini3ThinkingLevelModel };
19
+ export { isGoogleGemini3FlashModel, isGoogleGemini3ProModel, isGoogleGemini3ThinkingLevelModel, isGoogleGemini4Model };
@@ -1,2 +1,2 @@
1
- import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-i-nLZxFy.mjs";
1
+ import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-B86jN9ii.mjs";
2
2
  export { resolveOpenAICompletionsCompat };
@@ -1,2 +1,2 @@
1
- import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-CYX18uDk.mjs";
1
+ import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-CpeOT7jH.mjs";
2
2
  export { resolveOpenAICompletionsCompat };
@@ -1,4 +1,4 @@
1
- import { l as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS, u as readOpenAIResponsesCompactionWindow } from "../openai-responses-contracts-DKqMJ1Ct.mjs";
1
+ import { l as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS, u as readOpenAIResponsesCompactionWindow } from "../openai-responses-contracts-Cm1QilsO.mjs";
2
2
  import { i as resolveOpenAIResponsesServerCompactionPlan, r as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-payload-policy-C7GsA1y0.mjs";
3
3
  //#region packages/ai/src/transports/openai-responses-endpoint.d.ts
4
4
  export declare function supportsNativeOpenAIResponsesEndpoint(params: {
@@ -1,3 +1,3 @@
1
- import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-DlKMMTxK.mjs";
2
- import { a as readOpenAIResponsesCompactionWindow, l as resolveOpenAIResponsesPayloadPolicy, n as supportsNativeOpenAIResponsesEndpoint, u as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-CinGh4VZ.mjs";
1
+ import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-DbD7sGP-.mjs";
2
+ import { a as readOpenAIResponsesCompactionWindow, l as resolveOpenAIResponsesPayloadPolicy, n as supportsNativeOpenAIResponsesEndpoint, u as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-COHJK1MR.mjs";
3
3
  export { OPENAI_RESPONSES_APIS, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesServerCompactionPlan, supportsNativeOpenAIResponsesEndpoint };
@@ -1,13 +1,13 @@
1
1
  import "../index-BYDvopUB.mjs";
2
2
  import { $ as StopReason, Q as SimpleStreamOptions, d as Context, k as Model, tt as StreamFunction } from "../types-Bd2T86VJ.mjs";
3
- import { C as supportsOpenAITemperature, S as supportsOpenAIReasoningEffort, _ as normalizeOpenAIReasoningEffort, a as BaseOpenAIStreamOptions, b as resolveOpenAIReasoningEffortMapping, d as OpenAIApiReasoningEffort, f as OpenAIReasoningEffort, g as isOpenAIGpt6Model, h as isOpenAIGpt56Model, l as codeModeToolSurfaceObserver, m as isOpenAIGpt55Model, o as CodeModeToolSurfaceObservation, p as isOpenAIGpt54MiniModel, s as OpenAICompletionsOptions, u as reasoningTagTextPolicy, v as resolveOpenAIModelReasoningEfforts, x as resolveOpenAISupportedReasoningEfforts, y as resolveOpenAIReasoningEffortForModel } from "../provider-options-CVrXZBtA.mjs";
3
+ import { C as supportsOpenAIReasoningEffort, S as resolveOpenAISupportedReasoningEfforts, _ as isOpenAIGpt6Model, a as BaseOpenAIStreamOptions, b as resolveOpenAIReasoningEffortForModel, d as OpenAIApiReasoningEffort, f as OpenAIReasoningEffort, g as isOpenAIGpt56Model, h as isOpenAIGpt55Model, l as codeModeToolSurfaceObserver, m as isOpenAIGpt54MiniModel, o as CodeModeToolSurfaceObservation, p as applyOpenAICompletionsToolReasoning, s as OpenAICompletionsOptions, u as reasoningTagTextPolicy, v as normalizeOpenAIReasoningEffort, w as supportsOpenAITemperature, x as resolveOpenAIReasoningEffortMapping, y as resolveOpenAIModelReasoningEfforts } from "../provider-options-DTuD2UNR.mjs";
4
4
  import { a as reconcileOpenAIResponsesToolChoice, i as reconcileOpenAICompletionsToolChoice, n as OpenAIToolProjection, r as projectOpenAITools, t as OpenAICompletionsToolChoice } from "../openai-tool-projection-793cE3QX.mjs";
5
5
  import "../types-Kdfw_04V.mjs";
6
- import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-i-nLZxFy.mjs";
7
- import { a as ResponsesPromptObservation, c as responsesServiceTierObserver, d as OpenAIRequestReasoningEffort, o as ResponsesServiceTierObservation, s as responsesPromptObserver } from "../openai-responses-contracts-DKqMJ1Ct.mjs";
6
+ import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-B86jN9ii.mjs";
7
+ import { a as ResponsesPromptObservation, c as responsesServiceTierObserver, d as OpenAIRequestReasoningEffort, o as ResponsesServiceTierObservation, s as responsesPromptObserver } from "../openai-responses-contracts-Cm1QilsO.mjs";
8
8
  import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-DIPMrMFy.mjs";
9
9
  import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-BygjiAdi.mjs";
10
- import "../openai-responses-compaction-replay-B2FE4Nw8.mjs";
10
+ import "../openai-responses-compaction-replay-DtEbZJbU.mjs";
11
11
  import { ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
12
12
  import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
13
13
  //#region packages/ai/src/providers/azure-deployment-map.d.ts
@@ -162,4 +162,4 @@ export declare function modelRequestBodyState(options: object, inheritFrom?: obj
162
162
  export declare function serializeModelRequestBody(payload: unknown): EncodedModelRequestBody;
163
163
  export declare function encodedModelRequestBodyStream(body: unknown): boolean | undefined;
164
164
  //#endregion
165
- export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, type OpenAICompletionsToolChoice, OpenAIReasoningEffort, type OpenAIToolProjection, type ResponsesPromptObservation, type ResponsesServiceTierObservation, ResponsesTerminalUsagePayload, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, projectOpenAITools, readResponsesReasoningTokens, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesServiceTierObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
165
+ export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, type OpenAICompletionsToolChoice, OpenAIReasoningEffort, type OpenAIToolProjection, type ResponsesPromptObservation, type ResponsesServiceTierObservation, ResponsesTerminalUsagePayload, applyOpenAICompletionsToolReasoning, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, projectOpenAITools, readResponsesReasoningTokens, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesServiceTierObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
@@ -1,12 +1,12 @@
1
- import { C as normalizeOpenAIReasoningEffort, D as resolveOpenAISupportedReasoningEfforts, E as resolveOpenAIReasoningEffortMapping, O as supportsOpenAIReasoningEffort, S as isOpenAIGpt6Model, T as resolveOpenAIReasoningEffortForModel, b as isOpenAIGpt55Model, g as responsesServiceTierObserver, h as responsesPromptObserver, k as supportsOpenAITemperature, w as resolveOpenAIModelReasoningEfforts, x as isOpenAIGpt56Model, y as isOpenAIGpt54MiniModel } from "../openai-responses-contracts-DlKMMTxK.mjs";
2
- import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-r93BJhjm.mjs";
1
+ import { A as supportsOpenAITemperature, C as isOpenAIGpt6Model, D as resolveOpenAIReasoningEffortMapping, E as resolveOpenAIReasoningEffortForModel, O as resolveOpenAISupportedReasoningEfforts, S as isOpenAIGpt56Model, T as resolveOpenAIModelReasoningEfforts, b as isOpenAIGpt54MiniModel, g as responsesServiceTierObserver, h as responsesPromptObserver, k as supportsOpenAIReasoningEffort, w as normalizeOpenAIReasoningEffort, x as isOpenAIGpt55Model, y as applyOpenAICompletionsToolReasoning } from "../openai-responses-contracts-DbD7sGP-.mjs";
2
+ import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-CvftfMfD.mjs";
3
3
  import { _ as resolveResponsesTerminalStopReason, g as readResponsesReasoningTokens, h as mapResponsesTerminalUsage, m as isResponsesOutputLimitToolCallError } from "../diagnostics-tQasYct1.mjs";
4
- import { a as encodedModelRequestBodyStream, c as serializeModelRequestBody, l as codeModeToolSurfaceObserver, o as modelRequestBodyState, u as reasoningTagTextPolicy } from "../simple-options-BAu4B54D.mjs";
5
- import { N as bindResponsesInputMessage, St as reconcileOpenAIResponsesToolChoice, _ as isResponsesTextContentPartType, bt as projectOpenAITools, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as reconcileOpenAICompletionsToolChoice, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-D-aDYAkJ.mjs";
6
- import { c as convertMessages, o as hasResponsesWebSearchTool } from "../openai-completions-transport-Dy4CZo9Q.mjs";
4
+ import { a as encodedModelRequestBodyStream, c as serializeModelRequestBody, l as codeModeToolSurfaceObserver, o as modelRequestBodyState, u as reasoningTagTextPolicy } from "../simple-options-CmtE6whA.mjs";
5
+ import { N as bindResponsesInputMessage, St as reconcileOpenAIResponsesToolChoice, _ as isResponsesTextContentPartType, bt as projectOpenAITools, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as reconcileOpenAICompletionsToolChoice, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-C1GHTB0q.mjs";
6
+ import { c as convertMessages, o as hasResponsesWebSearchTool } from "../openai-completions-transport-BRjxCG1C.mjs";
7
7
  import { t as mapOpenAIStopReason } from "../openai-stop-reason-8s70vDXj.mjs";
8
8
  import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-D0dvJMbZ.mjs";
9
- import { t as responsesRequestLifecycle } from "../openai-responses-request-lifecycle-NSIJo9jY.mjs";
10
- import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-CrVgnFrV.mjs";
11
- import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-D5oiAUOG.mjs";
12
- export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, bindResponsesInputMessage, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, encodedModelRequestBodyStream, hasResponsesWebSearchTool, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, modelRequestBodyState, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesRequestLifecycle, responsesServiceTierObserver, serializeModelRequestBody, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
9
+ import { t as responsesRequestLifecycle } from "../openai-responses-request-lifecycle-Cx2nKN1G.mjs";
10
+ import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-BkRt2Iy4.mjs";
11
+ import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-BUDpkW8I.mjs";
12
+ export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, applyOpenAICompletionsToolReasoning, bindResponsesInputMessage, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, encodedModelRequestBodyStream, hasResponsesWebSearchTool, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, modelRequestBodyState, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesRequestLifecycle, responsesServiceTierObserver, serializeModelRequestBody, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
@@ -1,9 +1,9 @@
1
1
  import { a as isProviderRefusalAssistantError } from "../diagnostics-DzrF1h4J.mjs";
2
2
  import { o as getEventStreamCompletion } from "../event-stream-X2gmsUWv.mjs";
3
- import { r as createApiRegistry, t as createLlmRuntime } from "../stream-Dd8DwRFL.mjs";
4
- import { A as getSupportedThinkingLevels, D as applyProviderReportedUsageCost, E as headersToRecord, O as calculateCost, j as modelsAreEqual, k as clampThinkingLevel } from "../host-Bf3NjYNj.mjs";
3
+ import { r as createApiRegistry, t as createLlmRuntime } from "../stream-BBjz-Jw2.mjs";
4
+ import { A as getSupportedThinkingLevels, D as applyProviderReportedUsageCost, E as headersToRecord, O as calculateCost, j as modelsAreEqual, k as clampThinkingLevel } from "../host-CIzdzpBn.mjs";
5
5
  import { i as registerSessionResourceCleanupObserver, n as getSessionResourceOwnerId, r as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-D1wgDQ8C.mjs";
6
- import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-CWGOuLcA.mjs";
6
+ import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-Dr_GBa9K.mjs";
7
7
  import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-CrxwdylR.mjs";
8
8
  import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
9
9
  import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-CfMuh5cC.mjs";
@@ -48,7 +48,7 @@ const CONTEXT_OVERFLOW_PATTERN_SCOPES = {
48
48
  /input \(\d+ tokens\) is longer than the model'?s context length \(\d+ tokens\)/i,
49
49
  /exceeds the limit of \d+/i,
50
50
  /(?:exceeds the available context size|context size has been exceeded)/i,
51
- /greater than the context length/i,
51
+ /greater than the context length|model is loaded with context length of only \d[\d,]* tokens, which is not enough/i,
52
52
  /context window exceeds limit/i,
53
53
  /exceeded model token limit/i,
54
54
  /tokens? in request more than max tokens? allowed/i,
@@ -1,8 +1,8 @@
1
1
  import { s as readAssistantThinkingAppend } from "../event-stream-X2gmsUWv.mjs";
2
- import { M as hasMediaPayload, N as isImageWithMediaPayload, c as transformMessages, d as hasOnlyAssistantReasoningContent, f as isReasoningOnlyLengthAssistantTurn, l as FAILED_ASSISTANT_REPLAY_TEXT, m as resolveFailedAssistantReplay, p as isStreamErrorFallbackContent, u as STREAM_ERROR_FALLBACK_TEXT } from "../host-Bf3NjYNj.mjs";
2
+ import { M as hasMediaPayload, N as isImageWithMediaPayload, c as transformMessages, d as hasOnlyAssistantReasoningContent, f as isReasoningOnlyLengthAssistantTurn, l as FAILED_ASSISTANT_REPLAY_TEXT, m as resolveFailedAssistantReplay, p as isStreamErrorFallbackContent, u as STREAM_ERROR_FALLBACK_TEXT } from "../host-CIzdzpBn.mjs";
3
3
  import { i as isCredentialFieldName, n as projectProviderError, r as createDiagnosticRecord } from "../provider-error-CF9GWCs2.mjs";
4
- import { P as sanitizeSurrogates } from "../transport-stream-shared-CWGOuLcA.mjs";
5
- import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, E as normalizeStructuredPromptSection, S as splitSystemPromptRelocatableBoundary, T as normalizePromptCapabilityIds, _ as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, b as prependSystemPromptAdditionAfterCacheBoundary, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as SYSTEM_PROMPT_CACHE_BOUNDARY, h as formatToolResultText, i as clampReasoning, m as extractToolResultText, n as buildBaseOptions, p as extractToolResultBlockText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary, y as ensureSystemPromptCacheBoundary } from "../simple-options-BAu4B54D.mjs";
4
+ import { P as sanitizeSurrogates } from "../transport-stream-shared-Dr_GBa9K.mjs";
5
+ import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, E as normalizeStructuredPromptSection, S as splitSystemPromptRelocatableBoundary, T as normalizePromptCapabilityIds, _ as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, b as prependSystemPromptAdditionAfterCacheBoundary, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as SYSTEM_PROMPT_CACHE_BOUNDARY, h as formatToolResultText, i as clampReasoning, m as extractToolResultText, n as buildBaseOptions, p as extractToolResultBlockText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary, y as ensureSystemPromptCacheBoundary } from "../simple-options-CmtE6whA.mjs";
6
6
  import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-DEE6gcB9.mjs";
7
7
  //#region packages/ai/src/utils/tls-certificate-errors.ts
8
8
  const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
@@ -1,8 +1,8 @@
1
1
  import { r as appendAssistantThinking, t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
2
- import { N as isImageWithMediaPayload, O as calculateCost, k as clampThinkingLevel, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
3
- import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-CWGOuLcA.mjs";
4
- import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, h as formatToolResultText, m as extractToolResultText, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-BAu4B54D.mjs";
5
- import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
2
+ import { N as isImageWithMediaPayload, O as calculateCost, k as clampThinkingLevel, r as getAiTransportHost } from "./host-CIzdzpBn.mjs";
3
+ import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-Dr_GBa9K.mjs";
4
+ import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, h as formatToolResultText, m as extractToolResultText, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-CmtE6whA.mjs";
5
+ import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-DDZq4a3j.mjs";
6
6
  import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
7
7
  import { t as boundResponseBody } from "./streaming-byte-guard-DBXr1XYn.mjs";
8
8
  import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";