@openclaw/ai 2026.8.1-beta.2 → 2026.8.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{anthropic-B6dLpq5L.mjs → anthropic-B8KwTtlb.mjs} +37 -27
  2. package/dist/{anthropic-SrGtwsJu.d.mts → anthropic-BECQCNdF.d.mts} +0 -2
  3. package/dist/{anthropic-JsNA5KCu.mjs → anthropic-BQXQudmA.mjs} +0 -1
  4. package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-4Zx7-aCr.mjs} +14 -15
  5. package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-CSx7MoKH.d.mts} +2 -1
  6. package/dist/{api-registry-k3zTz0cV.d.mts → api-registry-DFxSnFqG.d.mts} +1 -1
  7. package/dist/{azure-openai-responses-mxIOtUnn.mjs → azure-openai-responses-Aa4mVcYG.mjs} +3 -3
  8. package/dist/diagnostics.mjs +1 -1
  9. package/dist/event-stream-BVVgDSdq.d.mts +1 -0
  10. package/dist/{event-stream-BP6AWT8j.d.mts → event-stream-D91-ohD_.d.mts} +1 -1
  11. package/dist/event-stream.d.mts +1 -1
  12. package/dist/{google-shared-B0Qr9OR7.mjs → google-shared-M1dl64nz.mjs} +12 -5
  13. package/dist/{google-vertex-Bhc3TjDl.mjs → google-vertex-DCJHM_a5.mjs} +3 -3
  14. package/dist/{google-C7h2QzDX.mjs → google-yDRnipeq.mjs} +3 -3
  15. package/dist/headers-B_e4-1J0.mjs +9 -0
  16. package/dist/{host-DTqNc7ad.mjs → host-DF_yxOsA.mjs} +40 -29
  17. package/dist/{host-vWgMMhiJ.d.mts → host-DJq_FGcz.d.mts} +6 -6
  18. package/dist/index.d.mts +7 -7
  19. package/dist/index.mjs +2 -2
  20. package/dist/internal/anthropic.d.mts +11 -5
  21. package/dist/internal/anthropic.mjs +4 -4
  22. package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
  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 -8
  26. package/dist/internal/runtime.d.mts +4 -2
  27. package/dist/internal/runtime.mjs +4 -3
  28. package/dist/internal/shared.d.mts +17 -3
  29. package/dist/internal/shared.mjs +4 -4
  30. package/dist/{headers-DdOQtGuU.mjs → llm-request-activity-BjtkplhG.mjs} +1 -9
  31. package/dist/{mistral-CEWoQI_g.mjs → mistral-D6hRXI7A.mjs} +47 -33
  32. package/dist/{openai-chatgpt-responses-CrPmqERt.mjs → openai-chatgpt-responses-C339VIfT.mjs} +23 -15
  33. package/dist/{openai-completions-BPnt4Sml.mjs → openai-completions-D88orSJ9.mjs} +71 -35
  34. package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-B0KTleXp.d.mts} +2 -2
  35. package/dist/{openai-responses-DhIKtOup.mjs → openai-responses-BXEcr-Tp.mjs} +4 -4
  36. package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-CD75pQ0m.d.mts} +2 -2
  37. package/dist/{openai-responses-contracts-CyfIkQi5.mjs → openai-responses-contracts-DvILoqBk.mjs} +3 -9
  38. package/dist/{openai-responses-payload-policy-BDxV-W0c.mjs → openai-responses-payload-policy-BDo8CQsx.mjs} +4 -2
  39. package/dist/{openai-responses-payload-policy-BSs371VM.d.mts → openai-responses-payload-policy-CNGFT9zr.d.mts} +1 -0
  40. package/dist/{openai-responses-prompt-observer-internal-DgNTYnRY.mjs → openai-responses-prompt-observer-internal-BG-1AsBI.mjs} +2 -3
  41. package/dist/{openai-responses-shared-DXIt3iY5.mjs → openai-responses-shared-Cvt5MgEm.mjs} +81 -136
  42. package/dist/{openai-stop-reason-BkFkqqK0.mjs → openai-stop-reason-9OONKyAm.mjs} +47 -31
  43. package/dist/{openai-tool-projection-CY04OcvQ.mjs → openai-tool-projection-CHGLt03m.mjs} +94 -6
  44. package/dist/{provider-error-BUwEnjXq.mjs → provider-error-C8mBRJDl.mjs} +19 -24
  45. package/dist/provider-options-AvldWZt8.mjs +21 -0
  46. package/dist/{provider-options-B96RdNpH.d.mts → provider-options-Cc5ZQ6Aa.d.mts} +12 -2
  47. package/dist/provider-transcript-transform--gtf0ZbR.mjs +32 -0
  48. package/dist/provider-types.d.mts +5 -5
  49. package/dist/providers.d.mts +1 -1
  50. package/dist/providers.mjs +9 -9
  51. package/dist/{reasoning-tag-text-partitioner-rnPwX2pg.mjs → reasoning-tag-text-partitioner-5ygO2rZc.mjs} +3 -0
  52. package/dist/{sanitize-unicode-BYqrYtC_.mjs → sanitize-unicode-BP7HLLZn.mjs} +1 -1
  53. package/dist/simple-options-oqsXB6U3.mjs +450 -0
  54. package/dist/{tool-schema-json-projection-q5d7QX5c.mjs → tool-schema-json-projection-FEr-jOoZ.mjs} +16 -7
  55. package/dist/{transport-utils-DJqkxbhC.mjs → transport-utils-Bv0FHkd0.mjs} +1 -1
  56. package/dist/transports.d.mts +77 -44
  57. package/dist/transports.mjs +207 -167
  58. package/dist/{types-BHNrPS1l.d.mts → types-DTAP49HF.d.mts} +17 -2
  59. package/dist/types.d.mts +5 -5
  60. package/dist/types.mjs +1 -1
  61. package/dist/{validation-DT9SrFn3.d.mts → validation-DYNNrU9u.d.mts} +1 -1
  62. package/dist/validation.d.mts +1 -1
  63. package/package.json +1 -1
  64. package/dist/provider-transcript-transform-ePx-Bbfr.mjs +0 -155
  65. package/dist/simple-options-D58D5Kvw.mjs +0 -117
@@ -1,17 +1,18 @@
1
1
  import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
2
- import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-JsNA5KCu.mjs";
2
+ import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BQXQudmA.mjs";
3
3
  import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
4
- import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-BYqrYtC_.mjs";
5
- import { _ as resolveAnthropicThinkingEffort, a as describeToolResultMediaPlaceholder, b as usesClaudeStreamingRefusalContract, d as ANTHROPIC_CLAUDE_CODE_VERSION, f as applyClaudeRequestContract, g as requiresClaudeAdaptiveThinking, h as prepareClaudeNoPrefillRequestContext, l as isImageWithMediaPayload, m as mapAnthropicStopReason, n as getAiTransportHost, o as extractToolResultBlockText, r as resolveAiTransportHeaderSentinels, s as extractToolResultText, u as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, y as usesClaudeFable5MessagesContract } from "./host-DTqNc7ad.mjs";
6
- import { n as projectProviderError } from "./provider-error-BUwEnjXq.mjs";
4
+ import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-BP7HLLZn.mjs";
5
+ import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, m as applyClaudeRequestContract, n as getAiTransportHost, p as ANTHROPIC_CLAUDE_CODE_VERSION, r as resolveAiTransportHeaderSentinels, s as extractToolResultBlockText, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "./host-DF_yxOsA.mjs";
6
+ import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
7
+ import { n as projectProviderError } from "./provider-error-C8mBRJDl.mjs";
7
8
  import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
8
- import { c as splitSystemPromptCacheBoundary, l as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking } from "./simple-options-D58D5Kvw.mjs";
9
- import { A as resolveAnthropicImageMediaType, C as readAnthropicFallbackBoundary, D as usesFoundryBearerAuth, E as omitFoundryBearerCredentialHeaders, O as createAnthropicInlineImageBudget, S as applyAnthropicFallbackBoundary, T as applyAnthropicRefusal, _ as ANTHROPIC_OMITTED_REASONING_TEXT, a as applyAnthropicMessageDeltaUsage, b as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, d as normalizeAnthropicToolCallId, f as normalizeAnthropicToolChoice, g as toClaudeCodeToolName, h as resolveOriginalAnthropicToolName, i as suppressAnthropicCompaction, j as applyAnthropicCacheControlToMessages, k as normalizeAnthropicInlineContent, m as reconcileAnthropicToolChoice, n as createCompactionCapture, o as applyAnthropicMessageStartUsage, p as projectAnthropicTools, r as isAnthropicReplayRejection, t as buildAnthropicReplayPlan, v as findActiveAnthropicToolTurnAssistantIndex, w as resolveAnthropicFallbackServingModelCost, y as ANTHROPIC_SERVER_SIDE_FALLBACKS } from "./anthropic-compaction-replay-8lJNKXOE.mjs";
9
+ import { A as splitSystemPromptCacheBoundary, d as finalizeTerminalToolCallArguments, g as notifyProviderHttpResponse, j as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, x as transportAbortError } from "./simple-options-oqsXB6U3.mjs";
10
+ import { A as resolveAnthropicImageMediaType, C as readAnthropicFallbackBoundary, D as usesFoundryBearerAuth, E as omitFoundryBearerCredentialHeaders, O as createAnthropicInlineImageBudget, S as applyAnthropicFallbackBoundary, T as applyAnthropicRefusal, _ as ANTHROPIC_OMITTED_REASONING_TEXT, a as applyAnthropicMessageDeltaUsage, b as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, d as normalizeAnthropicToolCallId, f as normalizeAnthropicToolChoice, g as toClaudeCodeToolName, h as resolveOriginalAnthropicToolName, i as suppressAnthropicCompaction, j as applyAnthropicCacheControlToMessages, k as normalizeAnthropicInlineContent, m as reconcileAnthropicToolChoice, n as createCompactionCapture, o as applyAnthropicMessageStartUsage, p as projectAnthropicTools, r as isAnthropicReplayRejection, t as buildAnthropicReplayPlan, v as findActiveAnthropicToolTurnAssistantIndex, w as resolveAnthropicFallbackServingModelCost, y as ANTHROPIC_SERVER_SIDE_FALLBACKS } from "./anthropic-compaction-replay-4Zx7-aCr.mjs";
10
11
  import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
11
12
  import { n as parseStreamingJson, t as parseJsonWithRepair } from "./json-parse-CDnesDM_.mjs";
12
- import { n as notifyLlmRequestActivity, t as headersToRecord } from "./headers-DdOQtGuU.mjs";
13
- import { f as transportAbortError, t as transformProviderMessages } from "./provider-transcript-transform-ePx-Bbfr.mjs";
14
- import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-DJqkxbhC.mjs";
13
+ import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
14
+ import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-Bv0FHkd0.mjs";
15
+ import { t as transformProviderMessages } from "./provider-transcript-transform--gtf0ZbR.mjs";
15
16
  import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
16
17
  import Anthropic from "@anthropic-ai/sdk";
17
18
  import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
@@ -197,12 +198,14 @@ const streamAnthropic = (model, context, options) => {
197
198
  ...params,
198
199
  stream: true
199
200
  }, sdkRequestOptions).asResponse();
200
- await requestOptions?.onResponse?.({
201
- status: response.status,
202
- headers: headersToRecord(response.headers)
203
- }, model);
201
+ await notifyProviderHttpResponse({
202
+ options: requestOptions,
203
+ response,
204
+ model
205
+ });
204
206
  const blocks = output.content;
205
207
  const blockIndexes = /* @__PURE__ */ new Map();
208
+ const sealedToolCalls = [];
206
209
  const compactionCapture = createCompactionCapture(output, model, requestOptions);
207
210
  for await (const event of iterateAnthropicEvents(response, refusalBuffer !== void 0)) if (event.type === "message_start") {
208
211
  output.responseId = event.message.id;
@@ -214,11 +217,12 @@ const streamAnthropic = (model, context, options) => {
214
217
  partial: output
215
218
  });
216
219
  } else if (event.type === "content_block_start") {
217
- const rawContentBlock = event.content_block;
220
+ const rawContentBlock = isRecord(event.content_block) ? event.content_block : void 0;
218
221
  if (requestOptions?.anthropicServerCompaction === true && compactionCapture.begin(event.index, rawContentBlock, output.content.length)) continue;
219
222
  const fallbackBoundary = refusalBuffer ? readAnthropicFallbackBoundary(event.content_block) : null;
220
223
  if (fallbackBoundary) {
221
224
  refusalBuffer?.discard();
225
+ sealedToolCalls.length = 0;
222
226
  blockIndexes.clear();
223
227
  applyAnthropicFallbackBoundary({
224
228
  output,
@@ -319,7 +323,7 @@ const streamAnthropic = (model, context, options) => {
319
323
  });
320
324
  }
321
325
  } else if (event.type === "content_block_delta") {
322
- const rawDelta = event.delta;
326
+ const rawDelta = isRecord(event.delta) ? event.delta : void 0;
323
327
  if (compactionCapture.delta(event.index, rawDelta)) continue;
324
328
  else if (event.delta.type === "text_delta") {
325
329
  const index = blockIndexes.get(event.index);
@@ -349,7 +353,7 @@ const streamAnthropic = (model, context, options) => {
349
353
  const index = blockIndexes.get(event.index);
350
354
  const block = index === void 0 ? void 0 : blocks[index];
351
355
  if (index !== void 0 && block?.type === "toolCall") {
352
- block.partialJson += event.delta.partial_json;
356
+ block.partialJson = (block.partialJson ?? "") + event.delta.partial_json;
353
357
  block.arguments = parseStreamingJson(block.partialJson);
354
358
  eventSink.push({
355
359
  type: "toolcall_delta",
@@ -385,16 +389,10 @@ const streamAnthropic = (model, context, options) => {
385
389
  content: block.thinking,
386
390
  partial: output
387
391
  });
388
- else if (block.type === "toolCall") {
389
- block.arguments = parseStreamingJson(block.partialJson);
390
- delete block.partialJson;
391
- eventSink.push({
392
- type: "toolcall_end",
393
- contentIndex: index,
394
- toolCall: block,
395
- partial: output
396
- });
397
- }
392
+ else if (block.type === "toolCall") sealedToolCalls.push({
393
+ block,
394
+ contentIndex: index
395
+ });
398
396
  }
399
397
  } else if (event.type === "message_delta") {
400
398
  if (event.delta.stop_reason) if (event.delta.stop_reason === "refusal") applyAnthropicRefusal(output, event.delta.stop_details, model.provider);
@@ -404,6 +402,17 @@ const streamAnthropic = (model, context, options) => {
404
402
  }
405
403
  if (requestOptions?.signal?.aborted) throw transportAbortError(requestOptions.signal);
406
404
  if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
405
+ if ([...blockIndexes.values()].some((index) => blocks[index]?.type === "toolCall")) throw new Error("Provider completed stream with an incomplete tool call");
406
+ finalizeTerminalToolCallArguments(sealedToolCalls.map(({ block }) => block), (block) => block.partialJson && block.partialJson.length > 0 ? block.partialJson : block.arguments);
407
+ for (const sealed of sealedToolCalls) {
408
+ delete sealed.block.partialJson;
409
+ eventSink.push({
410
+ type: "toolcall_end",
411
+ contentIndex: sealed.contentIndex,
412
+ toolCall: sealed.block,
413
+ partial: output
414
+ });
415
+ }
407
416
  refusalBuffer?.flush();
408
417
  stream.push({
409
418
  type: "done",
@@ -412,6 +421,7 @@ const streamAnthropic = (model, context, options) => {
412
421
  });
413
422
  stream.end();
414
423
  } catch (error) {
424
+ output.content = output.content.filter((block) => block.type !== "toolCall");
415
425
  for (const block of output.content) {
416
426
  delete block.index;
417
427
  delete block.partialJson;
@@ -646,7 +656,7 @@ async function buildParams(model, context, isOAuthTokenResult, options, serverSi
646
656
  display
647
657
  };
648
658
  const effort = options?.effort ?? (mandatoryAdaptiveThinking ? "high" : void 0);
649
- if (effort) params.output_config = effort === "xhigh" ? { effort } : { effort };
659
+ if (effort) params.output_config = { effort };
650
660
  } else params.thinking = {
651
661
  type: "enabled",
652
662
  budget_tokens: options?.thinkingBudgetTokens ?? ANTHROPIC_MIN_THINKING_BUDGET_TOKENS,
@@ -8,8 +8,6 @@ type ClaudeEffortModelRef = ClaudeModelRef & {
8
8
  };
9
9
  declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
10
10
  readonly levels: readonly [{
11
- readonly id: "off";
12
- }, {
13
11
  readonly id: "minimal";
14
12
  }, {
15
13
  readonly id: "low";
@@ -5,7 +5,6 @@ function normalizeClaudeModelId(modelId) {
5
5
  }
6
6
  const CLAUDE_FABLE_5_THINKING_PROFILE = {
7
7
  levels: [
8
- { id: "off" },
9
8
  { id: "minimal" },
10
9
  { id: "low" },
11
10
  { id: "medium" },
@@ -1,12 +1,12 @@
1
- import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-JsNA5KCu.mjs";
1
+ import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BQXQudmA.mjs";
2
2
  import { i as normalizeOptionalLowercaseString, r as normalizeNullableString } from "./string-coerce-fsri9iCu.mjs";
3
- import { n as getAiTransportHost } from "./host-DTqNc7ad.mjs";
3
+ import { n as getAiTransportHost } from "./host-DF_yxOsA.mjs";
4
4
  import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
5
- import { a as estimateBase64DecodedBytes } from "./provider-error-BUwEnjXq.mjs";
5
+ import { a as estimateBase64DecodedBytes } from "./provider-error-C8mBRJDl.mjs";
6
6
  import { r as asNonNegativeFiniteNumber, s as parseStrictPositiveInteger } from "./number-coercion-H9qHik3g.mjs";
7
7
  import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
8
- import { c as splitSystemPromptCacheBoundary, f as sortPromptCacheToolsByName, l as stripSystemPromptCacheBoundary } from "./simple-options-D58D5Kvw.mjs";
9
- import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-q5d7QX5c.mjs";
8
+ import { A as splitSystemPromptCacheBoundary, P as sortPromptCacheToolsByName, j as stripSystemPromptCacheBoundary } from "./simple-options-oqsXB6U3.mjs";
9
+ import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-FEr-jOoZ.mjs";
10
10
  import { t as shortHash } from "./hash-CHgqbJmD.mjs";
11
11
  //#region packages/ai/src/transports/anthropic-payload-policy.ts
12
12
  /**
@@ -31,7 +31,7 @@ function resolveAnthropicCompactThreshold(contextWindow, configured) {
31
31
  function resolveAnthropicServerCompactionPlan(model, extraParams) {
32
32
  const provider = normalizeOptionalLowercaseString(model.provider);
33
33
  const api = normalizeOptionalLowercaseString(model.api);
34
- const endpointClass = resolveProviderEndpoint(model.baseUrl).endpointClass;
34
+ const endpointClass = resolveProviderEndpoint(model).endpointClass;
35
35
  const enabled = extraParams?.anthropicServerCompaction === true && provider === "anthropic" && api === "anthropic-messages" && (endpointClass === "default" || endpointClass === "anthropic-public");
36
36
  return {
37
37
  enabled,
@@ -150,14 +150,14 @@ function countAnthropicCacheControlMarkers(blocks) {
150
150
  return count;
151
151
  }
152
152
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
153
- function resolveAnthropicPayloadPolicy(input) {
153
+ function resolveAnthropicPayloadPolicy(input, model) {
154
154
  const capabilities = resolveProviderRequestCapabilities({
155
155
  provider: input.provider,
156
156
  api: input.api,
157
157
  baseUrl: input.baseUrl,
158
158
  capability: "llm",
159
159
  transport: "stream"
160
- });
160
+ }, model);
161
161
  const serverCompactionPlan = resolveAnthropicServerCompactionPlan(input, input.extraParams);
162
162
  return {
163
163
  allowsServiceTier: capabilities.allowsAnthropicServiceTier,
@@ -752,14 +752,13 @@ function buildAnthropicReplayContext(model, options) {
752
752
  authProfileHash: hashReplayValue(options?.authProfileId)
753
753
  };
754
754
  }
755
+ function isAnthropicCompactionState(state) {
756
+ if (state.v !== 1 || typeof state.data !== "string" || typeof state.provider !== "string" || typeof state.api !== "string" || typeof state.model !== "string" || typeof state.baseUrlHash !== "string" || state.sessionHash !== void 0 && typeof state.sessionHash !== "string" || state.authProfileHash !== void 0 && typeof state.authProfileHash !== "string") return false;
757
+ if (state.type === ANTHROPIC_COMPACTION_SUPPRESSION_TYPE) return state.data === ANTHROPIC_COMPACTION_SUPPRESSION_DATA;
758
+ return state.type === ANTHROPIC_COMPACTION_REPLAY_TYPE && state.data.length > 0 && (state.replayIndex === void 0 || typeof state.replayIndex === "number" && Number.isSafeInteger(state.replayIndex) && state.replayIndex >= 0);
759
+ }
755
760
  function readAnthropicCompactionState(value) {
756
- if (!value || typeof value !== "object" || Array.isArray(value)) return;
757
- const state = value;
758
- if (!(state.v === 1 && typeof state.data === "string" && typeof state.provider === "string" && typeof state.api === "string" && typeof state.model === "string" && typeof state.baseUrlHash === "string" && (state.sessionHash === void 0 || typeof state.sessionHash === "string") && (state.authProfileHash === void 0 || typeof state.authProfileHash === "string"))) return;
759
- const replayState = state;
760
- if (replayState.type === ANTHROPIC_COMPACTION_SUPPRESSION_TYPE) return replayState.data === ANTHROPIC_COMPACTION_SUPPRESSION_DATA ? replayState : void 0;
761
- if (replayState.type !== ANTHROPIC_COMPACTION_REPLAY_TYPE || replayState.data.length === 0 || replayState.replayIndex !== void 0 && (!Number.isSafeInteger(replayState.replayIndex) || replayState.replayIndex < 0)) return;
762
- return replayState;
761
+ return isRecord(value) && isAnthropicCompactionState(value) ? value : void 0;
763
762
  }
764
763
  function replayContextMatches(state, context) {
765
764
  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;
@@ -1,3 +1,4 @@
1
+ import { D as Model } from "./types-DTAP49HF.mjs";
1
2
  //#region packages/ai/src/transports/anthropic-payload-policy.d.ts
2
3
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
3
4
  type AnthropicServiceTier = "auto" | "standard_only";
@@ -40,7 +41,7 @@ declare function resolveAnthropicEphemeralCacheControl(baseUrl: string | undefin
40
41
  /** Apply one shared deepest-stable-message cache breakpoint policy. */
41
42
  declare function applyAnthropicCacheControlToMessages(messages: unknown, cacheControl: AnthropicEphemeralCacheControl, markerLimit: number, cacheBreakpointOptOutMessageIndexes: ReadonlySet<number>): void;
42
43
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
43
- declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput): AnthropicPayloadPolicy;
44
+ declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput, model?: Model): AnthropicPayloadPolicy;
44
45
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
45
46
  declare function applyAnthropicPayloadPolicyToParams(payloadObj: Record<string, unknown>, policy: AnthropicPayloadPolicy, cacheBreakpointOptOutMessageIndexes: ReadonlySet<number>): void;
46
47
  /** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
@@ -1,4 +1,4 @@
1
- import { E as Model, H as StreamOptions, R as SimpleStreamOptions, V as StreamFunction, n as Api, o as AssistantMessageEventStreamContract, u as Context } from "./types-BHNrPS1l.mjs";
1
+ import { D as Model, H as StreamFunction, U as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "./types-DTAP49HF.mjs";
2
2
  //#region packages/ai/src/api-registry.d.ts
3
3
  /** Runtime stream adapter signature stored in the API provider registry. */
4
4
  type ApiStreamFunction = (model: Model, context: Context, options?: StreamOptions) => AssistantMessageEventStreamContract;
@@ -1,9 +1,9 @@
1
1
  import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
2
2
  import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
3
- import { n as getAiTransportHost } from "./host-DTqNc7ad.mjs";
3
+ import { n as getAiTransportHost } from "./host-DF_yxOsA.mjs";
4
4
  import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
5
- import { n as buildBaseOptions } from "./simple-options-D58D5Kvw.mjs";
6
- import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-DXIt3iY5.mjs";
5
+ import { n as buildBaseOptions } from "./simple-options-oqsXB6U3.mjs";
6
+ import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-Cvt5MgEm.mjs";
7
7
  import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
8
8
  import OpenAI, { AzureOpenAI } from "openai";
9
9
  //#region packages/ai/src/providers/azure-openai-responses.ts
@@ -1,3 +1,3 @@
1
1
  import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
2
- import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-BUwEnjXq.mjs";
2
+ import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-C8mBRJDl.mjs";
3
3
  export { appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue, projectDiagnosticValue };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,4 +1,4 @@
1
- import { a as AssistantMessageEvent, i as AssistantMessage, o as AssistantMessageEventStreamContract } from "./types-BHNrPS1l.mjs";
1
+ import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-DTAP49HF.mjs";
2
2
 
3
3
  //#region packages/llm-core/src/utils/event-stream.d.ts
4
4
  /** Generic async-iterable event stream with a separately awaited final result. */
@@ -1,2 +1,2 @@
1
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BP6AWT8j.mjs";
1
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D91-ohD_.mjs";
2
2
  export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
@@ -1,8 +1,8 @@
1
- import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-BYqrYtC_.mjs";
2
- import { a as describeToolResultMediaPlaceholder, l as isImageWithMediaPayload, s as extractToolResultText } from "./host-DTqNc7ad.mjs";
3
- import { f as sortPromptCacheToolsByName, l as stripSystemPromptCacheBoundary } from "./simple-options-D58D5Kvw.mjs";
4
- import { f as transportAbortError, n as assignTransportErrorDetails, r as coerceTransportToolCallArguments, t as transformProviderMessages } from "./provider-transcript-transform-ePx-Bbfr.mjs";
1
+ import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-BP7HLLZn.mjs";
2
+ import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload } from "./host-DF_yxOsA.mjs";
3
+ import { P as sortPromptCacheToolsByName, _ as notifyProviderStreamOpened, a as assignTransportErrorDetails, j as stripSystemPromptCacheBoundary, o as coerceTransportToolCallArguments, x as transportAbortError } from "./simple-options-oqsXB6U3.mjs";
5
4
  import { t as googleFlashSupportsMinimalThinking } from "./google-thinking-level-C-V3tecN.mjs";
5
+ import { t as transformProviderMessages } from "./provider-transcript-transform--gtf0ZbR.mjs";
6
6
  import { FinishReason, FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google-shared.ts
8
8
  /**
@@ -244,8 +244,15 @@ async function runGoogleGenerateContentLifecycle(params) {
244
244
  let requestParams = params.buildParams();
245
245
  const nextParams = await options?.onPayload?.(requestParams, model);
246
246
  if (nextParams !== void 0) requestParams = nextParams;
247
+ const googleIterator = (await client.models.generateContentStream(requestParams))[Symbol.asyncIterator]();
248
+ await notifyProviderStreamOpened({
249
+ options,
250
+ cancelStream: async () => {
251
+ await googleIterator.return?.();
252
+ }
253
+ });
247
254
  await consumeGoogleGenerateContentStream({
248
- chunks: await client.models.generateContentStream(requestParams),
255
+ chunks: { [Symbol.asyncIterator]: () => googleIterator },
249
256
  model,
250
257
  output,
251
258
  stream,
@@ -1,8 +1,8 @@
1
1
  import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
2
2
  import { a as normalizeOptionalString } from "./string-coerce-fsri9iCu.mjs";
3
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DTqNc7ad.mjs";
4
- import { n as buildBaseOptions } from "./simple-options-D58D5Kvw.mjs";
5
- import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-B0Qr9OR7.mjs";
3
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DF_yxOsA.mjs";
4
+ import { n as buildBaseOptions } from "./simple-options-oqsXB6U3.mjs";
5
+ import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-M1dl64nz.mjs";
6
6
  import { GoogleGenAI, ResourceScope } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google-vertex.ts
8
8
  const API_VERSION = "v1";
@@ -1,8 +1,8 @@
1
1
  import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
2
2
  import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
3
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DTqNc7ad.mjs";
4
- import { n as buildBaseOptions } from "./simple-options-D58D5Kvw.mjs";
5
- import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-B0Qr9OR7.mjs";
3
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DF_yxOsA.mjs";
4
+ import { n as buildBaseOptions } from "./simple-options-oqsXB6U3.mjs";
5
+ import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-M1dl64nz.mjs";
6
6
  import { GoogleGenAI } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google.ts
8
8
  let toolCallCounter = 0;
@@ -0,0 +1,9 @@
1
+ //#region packages/ai/src/utils/headers.ts
2
+ /** Converts a Headers object to a plain record for provider request handling. */
3
+ function headersToRecord(headers) {
4
+ const result = {};
5
+ for (const [key, value] of headers.entries()) result[key] = value;
6
+ return result;
7
+ }
8
+ //#endregion
9
+ export { headersToRecord as t };
@@ -1,7 +1,7 @@
1
- import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-JsNA5KCu.mjs";
1
+ import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BQXQudmA.mjs";
2
2
  import "./src-D2H6yKkH.mjs";
3
3
  import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
4
- import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-BYqrYtC_.mjs";
4
+ import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-BP7HLLZn.mjs";
5
5
  import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
6
6
  import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
7
7
  //#region packages/ai/src/providers/anthropic-model-contract.ts
@@ -163,22 +163,11 @@ function describeOmittedValue(value, label) {
163
163
  function redactInlineDataUris(value) {
164
164
  return value.replace(INLINE_DATA_URI_PATTERN, (_match, prefix, uri) => `${prefix}[inline data URI: ${uri.length} chars]`);
165
165
  }
166
- function redactStructuredTextValue(value) {
167
- const host = getAiTransportHost();
168
- const redacted = host.redactToolPayloadText(value);
169
- const trimmed = redacted.trim();
170
- if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return redacted;
171
- try {
172
- const redactedWrapper = host.redactSecrets({ structuredTextValue: JSON.parse(redacted) });
173
- return JSON.stringify(redactedWrapper.structuredTextValue);
174
- } catch {
175
- return redacted;
176
- }
177
- }
178
166
  function stringifyStructuredBlock(block) {
179
167
  const seen = /* @__PURE__ */ new WeakSet();
180
168
  try {
181
- const redactedBlock = getAiTransportHost().redactSecrets({ structuredToolResult: block }).structuredToolResult;
169
+ const host = getAiTransportHost();
170
+ const redactedBlock = host.redactModelVisibleSecrets({ structuredToolResult: block }).structuredToolResult;
182
171
  const serialized = JSON.stringify(redactedBlock, function structuredToolResultReplacer(key, value) {
183
172
  if (OPAQUE_OR_BINARY_FIELD_RE.test(key)) return `[omitted ${key}]`;
184
173
  if (key === "data") {
@@ -186,7 +175,7 @@ function stringifyStructuredBlock(block) {
186
175
  if (mimeType && isBinaryMimeType(mimeType)) return describeOmittedValue(value, "binary data");
187
176
  }
188
177
  if (typeof value === "bigint") return value.toString();
189
- if (typeof value === "string") return redactInlineDataUris(redactStructuredTextValue(value));
178
+ if (typeof value === "string") return redactInlineDataUris(host.redactModelVisibleSecrets(value));
190
179
  if (typeof value === "function" || typeof value === "symbol" || value === void 0) return;
191
180
  if (!value || typeof value !== "object") return value;
192
181
  if (seen.has(value)) return "[Circular]";
@@ -211,20 +200,26 @@ function hasMediaPayload(block) {
211
200
  function isImageWithMediaPayload(block) {
212
201
  return isRecord(block) && block.type === "image" && hasMediaPayload(block);
213
202
  }
214
- function describeToolResultMediaPlaceholder(blocks) {
203
+ function classifyToolResultMedia(blocks) {
215
204
  let hasImage = false;
216
205
  let hasAudio = false;
217
206
  for (const block of blocks) {
218
- if (!hasMediaPayload(block)) continue;
219
- const record = block;
220
- const type = typeof record.type === "string" ? record.type : void 0;
221
- const mimeType = readMimeType(record);
222
- if (type && IMAGE_TOOL_RESULT_TYPES.has(type) || mimeType?.toLowerCase().startsWith("image/")) hasImage = true;
223
- if (type && AUDIO_TOOL_RESULT_TYPES.has(type) || mimeType?.toLowerCase().startsWith("audio/")) hasAudio = true;
207
+ if (!hasMediaPayload(block) || block.type === "text") continue;
208
+ const type = typeof block.type === "string" ? block.type : void 0;
209
+ const mimeType = readMimeType(block)?.toLowerCase();
210
+ hasImage ||= Boolean(type && IMAGE_TOOL_RESULT_TYPES.has(type) || mimeType?.startsWith("image/"));
211
+ hasAudio ||= Boolean(type && AUDIO_TOOL_RESULT_TYPES.has(type) || mimeType?.startsWith("audio/"));
224
212
  }
213
+ return {
214
+ hasImage,
215
+ hasAudio
216
+ };
217
+ }
218
+ function describeToolResultMediaPlaceholder(blocks) {
219
+ const { hasImage, hasAudio } = classifyToolResultMedia(blocks);
225
220
  if (hasImage && hasAudio) return "(see attached media)";
226
221
  if (hasAudio) return "(see attached audio)";
227
- if (hasImage) return "(see attached image)";
222
+ return hasImage ? "(see attached image)" : void 0;
228
223
  }
229
224
  function extractToolResultBlockText(block) {
230
225
  if (!block || typeof block !== "object") return;
@@ -237,7 +232,7 @@ function extractToolResultBlockText(block) {
237
232
  const structured = stringifyStructuredBlock(record);
238
233
  return structured ? sanitizeSurrogates(truncateProviderToolText(structured)) : void 0;
239
234
  }
240
- function extractToolResultText(blocks) {
235
+ function extractToolResultText(blocks, options) {
241
236
  const explicitTexts = [];
242
237
  const structuredTexts = [];
243
238
  for (const block of blocks) {
@@ -246,9 +241,26 @@ function extractToolResultText(blocks) {
246
241
  if (block.type === "text") explicitTexts.push(text);
247
242
  else structuredTexts.push(text);
248
243
  }
249
- if (explicitTexts.length > 0) return sanitizeSurrogates(explicitTexts.join("\n"));
244
+ if (explicitTexts.length > 0) {
245
+ const text = (options?.includeStructured ? [...explicitTexts, ...structuredTexts] : explicitTexts).join("\n");
246
+ return sanitizeSurrogates(options?.includeStructured ? truncateProviderToolText(text) : text);
247
+ }
250
248
  return sanitizeSurrogates(truncateProviderToolText(structuredTexts.join("\n")));
251
249
  }
250
+ /** Describe media that cannot be represented on the target provider wire. */
251
+ function describeUnsupportedToolResultMedia(blocks, support) {
252
+ const { hasImage, hasAudio } = classifyToolResultMedia(blocks);
253
+ const omittedImage = hasImage && !support.images;
254
+ const omittedAudio = hasAudio && !support.audio;
255
+ if (omittedImage && omittedAudio) return "[unsupported tool-result media omitted]";
256
+ if (omittedAudio) return "[unsupported tool-result audio omitted]";
257
+ return omittedImage ? "[unsupported tool-result image omitted]" : void 0;
258
+ }
259
+ function formatToolResultText(params) {
260
+ const trimmed = params.text.trim();
261
+ const body = trimmed ? `${trimmed}${params.omittedMediaPlaceholder ? `\n${params.omittedMediaPlaceholder}` : ""}` : params.omittedMediaPlaceholder ?? params.mediaPlaceholder ?? "(no tool output)";
262
+ return `${params.isError ? "[tool error] " : ""}${body}`;
263
+ }
252
264
  //#endregion
253
265
  //#region packages/ai/src/transcript-transform.ts
254
266
  const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
@@ -386,7 +398,7 @@ function queueCustomApiRegistration(registry, api, streamFn) {
386
398
  const inertAiTransportHost = {
387
399
  buildModelFetch: () => void 0,
388
400
  resolveSecretSentinel: (value) => value,
389
- redactSecrets: (value) => value,
401
+ redactModelVisibleSecrets: (value) => value,
390
402
  redactToolPayloadText: (text) => text,
391
403
  normalizeAnthropicInlineContentBlocks: async (content) => [...content],
392
404
  resolveOpenAIStrictToolSetting: (_model, options) => options?.supportsStrictMode ? false : void 0,
@@ -399,7 +411,6 @@ const inertAiTransportHost = {
399
411
  }
400
412
  },
401
413
  buildCopilotDynamicHeaders: () => ({}),
402
- resolveProviderEndpointClass: () => "default",
403
414
  resolveProviderRequestCapabilities: () => ({
404
415
  endpointClass: "default",
405
416
  knownProviderFamily: "",
@@ -463,4 +474,4 @@ function resolveAiTransportHeaderSentinels(headers) {
463
474
  return resolvedHeaders ?? headers;
464
475
  }
465
476
  //#endregion
466
- export { resolveAnthropicThinkingEffort as _, describeToolResultMediaPlaceholder as a, usesClaudeStreamingRefusalContract as b, hasMediaPayload as c, ANTHROPIC_CLAUDE_CODE_VERSION as d, applyClaudeRequestContract as f, requiresClaudeAdaptiveThinking as g, prepareClaudeNoPrefillRequestContext as h, transformMessages as i, isImageWithMediaPayload as l, mapAnthropicStopReason as m, getAiTransportHost as n, extractToolResultBlockText as o, defaultsClaudeAdaptiveThinking as p, resolveAiTransportHeaderSentinels as r, extractToolResultText as s, configureAiTransportHost as t, ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK as u, resolveModelBoundThinkingReplayMode as v, usesClaudeFable5MessagesContract as y };
477
+ export { usesClaudeStreamingRefusalContract as S, prepareClaudeNoPrefillRequestContext as _, describeToolResultMediaPlaceholder as a, resolveModelBoundThinkingReplayMode as b, extractToolResultText as c, isImageWithMediaPayload as d, ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK as f, mapAnthropicStopReason as g, defaultsClaudeAdaptiveThinking as h, transformMessages as i, formatToolResultText as l, applyClaudeRequestContract as m, getAiTransportHost as n, describeUnsupportedToolResultMedia as o, ANTHROPIC_CLAUDE_CODE_VERSION as p, resolveAiTransportHeaderSentinels as r, extractToolResultBlockText as s, configureAiTransportHost as t, hasMediaPayload as u, requiresClaudeAdaptiveThinking as v, usesClaudeFable5MessagesContract as x, resolveAnthropicThinkingEffort as y };
@@ -1,5 +1,5 @@
1
- import { B as StreamFn, E as Model, n as Api, u as Context } from "./types-BHNrPS1l.mjs";
2
- import { n as ApiRegistry } from "./api-registry-k3zTz0cV.mjs";
1
+ import { D as Model, V as StreamFn, d as Context, n as Api } from "./types-DTAP49HF.mjs";
2
+ import { n as ApiRegistry } from "./api-registry-DFxSnFqG.mjs";
3
3
 
4
4
  //#region packages/ai/src/host.d.ts
5
5
  /** Provider capability facts needed by the package-owned transports. */
@@ -20,6 +20,7 @@ interface AiProviderRequestPolicyInput {
20
20
  transport?: "stream" | "websocket" | "http" | "media-understanding";
21
21
  modelId?: string | null;
22
22
  compat?: unknown;
23
+ model?: object;
23
24
  }
24
25
  /** Context shared by plugin-owned provider stream hooks. */
25
26
  interface AiProviderStreamHookContext {
@@ -112,8 +113,8 @@ interface AiTransportHost {
112
113
  }): typeof fetch | undefined;
113
114
  /** Resolves host-owned process-local secret sentinel substrings immediately before egress. */
114
115
  resolveSecretSentinel(value: string): string;
115
- /** Redacts secrets inside structured tool-result payloads. */
116
- redactSecrets<T>(value: T): T;
116
+ /** Redacts model-visible tool results without treating ordinary source assignments as secrets. */
117
+ redactModelVisibleSecrets<T>(value: T): T;
117
118
  /** Redacts secret-bearing text in tool payload strings. */
118
119
  redactToolPayloadText(text: string): string;
119
120
  /** Normalizes Anthropic inline image blocks before provider payload construction. */
@@ -129,8 +130,6 @@ interface AiTransportHost {
129
130
  plugin: AiTransportPluginHost;
130
131
  /** Builds provider-owned Copilot compatibility headers for one message turn. */
131
132
  buildCopilotDynamicHeaders(messages: Context["messages"]): Record<string, string>;
132
- /** Resolves endpoint classification without importing core provider registries. */
133
- resolveProviderEndpointClass(baseUrl?: string): string;
134
133
  /** Resolves provider capability flags used by payload compatibility policy. */
135
134
  resolveProviderRequestCapabilities(input: AiProviderRequestPolicyInput): AiProviderRequestCapabilities;
136
135
  /** Merges host-owned provider request headers and attribution policy. */
@@ -141,6 +140,7 @@ interface AiTransportHost {
141
140
  providerHeaders?: Record<string, string>;
142
141
  callerHeaders?: Record<string, string>;
143
142
  precedence?: "caller-wins" | "defaults-win";
143
+ model?: object;
144
144
  }): Record<string, string> | undefined;
145
145
  /** Returns the host-configured request timeout attached to a model. */
146
146
  resolveModelRequestTimeoutMs(model: Model): number | undefined;
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-SrGtwsJu.mjs";
1
+ import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BECQCNdF.mjs";
2
2
  import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
3
- import { $ as Usage, A as OpenRouterRouting, B as StreamFn, C as KnownImagesProvider, D as ModelThinkingLevel, E as Model, F as ProviderReplayState, G as ThinkingBudgets, H as StreamOptions, I as ProviderResponse, J as ThinkingLevelMap, K as ThinkingContent, L as ProviderStreamOptions, M as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, N as Provider, O as OpenAICompletionsCompat, P as ProviderImagesOptions, Q as Transport, R as SimpleStreamOptions, S as KnownImagesApi, T as Message, U as TextContent, V as StreamFunction, W as TextSignatureV1, X as ToolCall, Y as Tool, Z as ToolResultMessage, _ as ImagesOptions, a as AssistantMessageEvent, b as ImagesStopReason, c as CacheRetention, d as ImageContent, et as UserMessage, f as ImagesApi, g as ImagesModel, h as ImagesInputContent, i as AssistantMessage, j as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, k as OpenAIResponsesCompat, l as CompleteSimpleFn, m as ImagesFunction, n as Api, nt as VercelGatewayRouting, o as AssistantMessageEventStreamContract, p as ImagesContext, q as ThinkingLevel, r as AssistantImages, s as AssistantMessageEventStreamLike, t as AnthropicMessagesCompat, tt as ValidateToolArgumentsFn, u as Context, v as ImagesOutputContent, w as MaybePromise, x as KnownApi, y as ImagesProvider, z as StopReason } from "./types-BHNrPS1l.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BP6AWT8j.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-DT9SrFn3.mjs";
6
- import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-k3zTz0cV.mjs";
7
- import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-vWgMMhiJ.mjs";
3
+ import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-DTAP49HF.mjs";
4
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D91-ohD_.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-DYNNrU9u.mjs";
6
+ import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-DFxSnFqG.mjs";
7
+ import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-DJq_FGcz.mjs";
8
8
 
9
9
  //#region packages/ai/src/stream.d.ts
10
10
  /** Creates an isolated LLM runtime backed by the supplied provider registry. */
@@ -23,4 +23,4 @@ declare function createLlmRuntime(registry?: ApiRegistry): {
23
23
  };
24
24
  type LlmRuntime = ReturnType<typeof createLlmRuntime>;
25
25
  //#endregion
26
- export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, LlmRuntime, MaybePromise, Message, Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RegisteredApiProvider, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
26
+ export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, LlmRuntime, MaybePromise, Message, Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RegisteredApiProvider, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-JsNA5KCu.mjs";
1
+ import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BQXQudmA.mjs";
2
2
  import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
3
3
  import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
4
4
  import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
5
5
  import { n as validateToolCall, t as validateToolArguments } from "./validation-B61OhAio.mjs";
6
6
  import "./src-D2H6yKkH.mjs";
7
7
  import { n as createApiRegistry, t as createLlmRuntime } from "./stream-CREqxHgU.mjs";
8
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-DTqNc7ad.mjs";
8
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-DF_yxOsA.mjs";
9
9
  export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };