@openclaw/ai 2026.7.2-beta.7 → 2026.8.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{anthropic-CH4UUnZr.mjs → anthropic-CE-7SkF6.mjs} +28 -191
  2. package/dist/{anthropic-usage-DWU-x8MI.mjs → anthropic-usage-Ma4iX6uG.mjs} +262 -4
  3. package/dist/{api-registry-DlMgPR39.d.mts → api-registry-EpJoVwM1.d.mts} +1 -1
  4. package/dist/{azure-openai-responses-CImcwB83.mjs → azure-openai-responses-Cc_kasye.mjs} +4 -4
  5. package/dist/{event-stream-D8n2uFee.mjs → event-stream-CEV9t6da.mjs} +10 -2
  6. package/dist/{event-stream-YjaPW20U.d.mts → event-stream-DRmDMRHH.d.mts} +2 -1
  7. package/dist/event-stream.d.mts +1 -1
  8. package/dist/event-stream.mjs +1 -1
  9. package/dist/{google-CtSg0iTS.mjs → google-CGQu21aw.mjs} +5 -5
  10. package/dist/{google-shared-DNBz5rcD.mjs → google-shared-Cq2UKx1l.mjs} +151 -85
  11. package/dist/{google-vertex-31f1uS9L.mjs → google-vertex-CusxWzvE.mjs} +10 -7
  12. package/dist/{host-Dog2WQiR.mjs → host-Bl7Kgddo.mjs} +40 -2
  13. package/dist/{host-B9GUmcra.d.mts → host-Dn4_SZI2.d.mts} +2 -2
  14. package/dist/index.d.mts +5 -5
  15. package/dist/index.mjs +2 -2
  16. package/dist/internal/anthropic.d.mts +19 -3
  17. package/dist/internal/anthropic.mjs +4 -4
  18. package/dist/internal/openai.d.mts +4 -4
  19. package/dist/internal/openai.mjs +7 -7
  20. package/dist/internal/runtime.d.mts +2 -2
  21. package/dist/internal/runtime.mjs +3 -3
  22. package/dist/internal/shared.d.mts +1 -1
  23. package/dist/internal/shared.mjs +3 -4
  24. package/dist/{mistral-CWmpvWYh.mjs → mistral-Dx6VzNjf.mjs} +25 -9
  25. package/dist/model-utils-Dau5dlgm.mjs +64 -0
  26. package/dist/number-coercion-1Miyb5MO.mjs +66 -0
  27. package/dist/{openai-chatgpt-responses-B84Ibtrd.mjs → openai-chatgpt-responses-SC9m0FSf.mjs} +94 -131
  28. package/dist/{openai-completions-DsOxhOD1.mjs → openai-completions-BaIpl93j.mjs} +47 -66
  29. package/dist/{openai-reasoning-compat-YgeLncHw.mjs → openai-reasoning-compat-DKebnIBL.mjs} +147 -6
  30. package/dist/{openai-responses-BT7A3sLu.mjs → openai-responses-Bdx3V_Yu.mjs} +6 -22
  31. package/dist/openai-responses-contracts-BBKBfAqR.d.mts +116 -0
  32. package/dist/openai-responses-prompt-observer-internal-DDZPxRfr.mjs +46 -0
  33. package/dist/{openai-responses-shared-pXl6Wd8S.mjs → openai-responses-shared-CCyMvg7M.mjs} +21 -10
  34. package/dist/{openai-responses-stream-internal-Cw5txaGW.mjs → openai-responses-stream-internal-Bl8YyVtF.mjs} +244 -81
  35. package/dist/{openai-tool-projection-OhX64DoP.mjs → openai-transport-shared-Cipt7egQ.mjs} +129 -29
  36. package/dist/{provider-error-CAEvRjry.mjs → provider-error-DI0Ts28U.mjs} +1 -1
  37. package/dist/{provider-options-D8bB3z9b.d.mts → provider-options-C5kYML7i.d.mts} +1 -1
  38. package/dist/providers.d.mts +1 -1
  39. package/dist/providers.mjs +9 -9
  40. package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-BIBomOGq.mjs} +1 -1
  41. package/dist/{tool-result-text-CTpIRbYd.mjs → tool-result-text-Dvkp2Dus.mjs} +51 -2
  42. package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → tool-schema-json-projection-B1b-XCn5.mjs} +28 -1
  43. package/dist/transform-messages-DfjpNXNQ.mjs +2 -0
  44. package/dist/{transport-stream-shared-D81p90xq.mjs → transport-stream-shared-CPNv7A3r.mjs} +4 -4
  45. package/dist/transports.d.mts +41 -73
  46. package/dist/transports.mjs +317 -601
  47. package/dist/{types-bzp5k29J.d.mts → types-CH7ReIcU.d.mts} +4 -0
  48. package/dist/types.d.mts +3 -3
  49. package/dist/types.mjs +1 -1
  50. package/dist/{validation-B-j7cOYp.d.mts → validation-CcPcuEbR.d.mts} +1 -1
  51. package/dist/validation.d.mts +1 -1
  52. package/package.json +1 -1
  53. package/dist/error-coercion-DgxlWC0n.mjs +0 -15
  54. package/dist/number-coercion-DvG7SNMg.mjs +0 -129
  55. package/dist/openai-completions-compat-DBWjXoMZ.d.mts +0 -43
  56. package/dist/simple-options-9lhRrN73.mjs +0 -50
  57. package/dist/transform-messages-C8mBqZxF.mjs +0 -2
@@ -1,10 +1,10 @@
1
1
  import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
2
- import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
3
- import { n as getAiTransportHost } from "./host-Dog2WQiR.mjs";
2
+ import { t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
3
+ import { n as getAiTransportHost } from "./host-Bl7Kgddo.mjs";
4
4
  import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
5
+ import { c as buildBaseOptions } from "./tool-result-text-Dvkp2Dus.mjs";
5
6
  import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
6
- import { n as buildBaseOptions } from "./simple-options-9lhRrN73.mjs";
7
- import { a as runResponsesStreamLifecycle, i as resolveResponsesReasoningEffort, n as convertResponsesMessages, r as createResponsesAssistantOutput, t as applyCommonResponsesParams } from "./openai-responses-shared-pXl6Wd8S.mjs";
7
+ import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-CCyMvg7M.mjs";
8
8
  import OpenAI, { AzureOpenAI } from "openai";
9
9
  //#region packages/ai/src/providers/azure-openai-responses.ts
10
10
  const DEFAULT_AZURE_API_VERSION = "v1";
@@ -3,6 +3,7 @@
3
3
  var EventStream = class {
4
4
  constructor(isComplete, extractResult) {
5
5
  this.queue = [];
6
+ this.queueHead = 0;
6
7
  this.waiting = [];
7
8
  this.done = false;
8
9
  this.isComplete = isComplete;
@@ -41,8 +42,15 @@ var EventStream = class {
41
42
  }
42
43
  }
43
44
  async *[Symbol.asyncIterator]() {
44
- while (true) if (this.queue.length > 0) for (const event of this.queue.splice(0, 1)) yield event;
45
- else if (this.done) return;
45
+ while (true) if (this.queueHead < this.queue.length) {
46
+ const event = this.queue[this.queueHead];
47
+ this.queueHead += 1;
48
+ if (this.queueHead >= 1024 && this.queueHead * 2 >= this.queue.length) {
49
+ this.queue = this.queue.slice(this.queueHead);
50
+ this.queueHead = 0;
51
+ }
52
+ yield event;
53
+ } else if (this.done) return;
46
54
  else {
47
55
  const result = await new Promise((resolve) => {
48
56
  this.waiting.push(resolve);
@@ -1,9 +1,10 @@
1
- import { a as AssistantMessageEvent, i as AssistantMessage, o as AssistantMessageEventStreamContract } from "./types-bzp5k29J.mjs";
1
+ import { a as AssistantMessageEvent, i as AssistantMessage, o as AssistantMessageEventStreamContract } from "./types-CH7ReIcU.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. */
5
5
  declare class EventStream<T, R = T> implements AsyncIterable<T> {
6
6
  private queue;
7
+ private queueHead;
7
8
  private waiting;
8
9
  private done;
9
10
  private finalResultPromise;
@@ -1,2 +1,2 @@
1
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-YjaPW20U.mjs";
1
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DRmDMRHH.mjs";
2
2
  export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
@@ -1,2 +1,2 @@
1
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
1
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
2
2
  export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
@@ -1,8 +1,8 @@
1
1
  import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
2
- import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
3
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-Dog2WQiR.mjs";
4
- import { n as buildBaseOptions } from "./simple-options-9lhRrN73.mjs";
5
- import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-DNBz5rcD.mjs";
2
+ import { t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
3
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-Bl7Kgddo.mjs";
4
+ import { c as buildBaseOptions } from "./tool-result-text-Dvkp2Dus.mjs";
5
+ import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Cq2UKx1l.mjs";
6
6
  import { GoogleGenAI } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google.ts
8
8
  let toolCallCounter = 0;
@@ -49,7 +49,7 @@ function createClient(model, apiKey, optionsHeaders) {
49
49
  });
50
50
  }
51
51
  function buildParams(model, context, options = {}) {
52
- return buildGoogleGenerateContentParams(model, context, options, { getDisabledThinkingConfig: (modelLocal) => getDisabledGoogleThinkingConfig(modelLocal, { includeGemma4: true }) });
52
+ return buildGoogleGenerateContentParams(model, context, options);
53
53
  }
54
54
  //#endregion
55
55
  export { streamGoogle, streamSimpleGoogle };
@@ -1,10 +1,10 @@
1
- import { i as transformMessages } from "./host-Dog2WQiR.mjs";
1
+ import { i as transformMessages } from "./host-Bl7Kgddo.mjs";
2
+ import { n as calculateCost, r as clampThinkingLevel } from "./model-utils-Dau5dlgm.mjs";
2
3
  import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
3
- import { a as isImageWithMediaPayload, d as stripSystemPromptCacheBoundary, r as extractToolResultText, t as describeToolResultMediaPlaceholder } from "./tool-result-text-CTpIRbYd.mjs";
4
- import { c as calculateCost, l as clampThinkingLevel } from "./number-coercion-DvG7SNMg.mjs";
5
- import { d as transportAbortError } from "./transport-stream-shared-D81p90xq.mjs";
6
- import { t as formatProviderError } from "./provider-error-CAEvRjry.mjs";
7
- import "./transform-messages-C8mBqZxF.mjs";
4
+ import { a as isImageWithMediaPayload, h as stripSystemPromptCacheBoundary, r as extractToolResultText, t as describeToolResultMediaPlaceholder, v as sortPromptCacheToolsByName } from "./tool-result-text-Dvkp2Dus.mjs";
5
+ import { d as transportAbortError, n as coerceTransportToolCallArguments, t as assignTransportErrorDetails } from "./transport-stream-shared-CPNv7A3r.mjs";
6
+ import { t as formatProviderError } from "./provider-error-DI0Ts28U.mjs";
7
+ import "./transform-messages-DfjpNXNQ.mjs";
8
8
  import { FinishReason, FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
9
9
  //#region packages/ai/src/providers/google-shared.ts
10
10
  /**
@@ -83,6 +83,7 @@ function convertMessages(model, context) {
83
83
  return id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64);
84
84
  };
85
85
  const transformedMessages = transformMessages(context.messages, model, normalizeToolCallId);
86
+ const requiresToolCallThoughtSignature = model.provider !== "google-gemini-cli" && (isGemini3ProModel(model) || isGemini3FlashModel(model));
86
87
  const pendingToolResultImageTurns = [];
87
88
  let activeToolResultParts;
88
89
  const flushToolResultRun = () => {
@@ -94,17 +95,17 @@ function convertMessages(model, context) {
94
95
  if (msg.role !== "toolResult") flushToolResultRun();
95
96
  if (msg.role === "user") if (typeof msg.content === "string") contents.push({
96
97
  role: "user",
97
- parts: [{ text: sanitizeSurrogates(msg.content) }]
98
+ parts: [{ text: sanitizeSurrogates(msg.content) || " " }]
98
99
  });
99
100
  else {
100
101
  const parts = msg.content.map((item) => {
101
- if (item.type === "text") return { text: sanitizeSurrogates(item.text) };
102
+ if (item.type === "text") return { text: sanitizeSurrogates(item.text) || " " };
102
103
  return { inlineData: {
103
104
  mimeType: item.mimeType,
104
105
  data: item.data
105
106
  } };
106
107
  });
107
- if (parts.length === 0) continue;
108
+ if (parts.length === 0) parts.push({ text: " " });
108
109
  contents.push({
109
110
  role: "user",
110
111
  parts
@@ -112,30 +113,32 @@ function convertMessages(model, context) {
112
113
  }
113
114
  else if (msg.role === "assistant") {
114
115
  const parts = [];
115
- const isSameProviderAndModel = msg.provider === model.provider && msg.model === model.id;
116
+ let sawFunctionCall = false;
117
+ const isSameProviderAndModel = msg.provider === model.provider && msg.api === model.api && msg.model === model.id;
116
118
  for (const block of msg.content) if (block.type === "text") {
117
- if (!block.text || block.text.trim() === "") continue;
118
119
  const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.textSignature);
120
+ if ((!block.text || block.text.trim() === "") && !thoughtSignature) continue;
119
121
  parts.push({
120
122
  text: sanitizeSurrogates(block.text),
121
123
  ...thoughtSignature && { thoughtSignature }
122
124
  });
123
125
  } else if (block.type === "thinking") {
124
- if (!block.thinking || block.thinking.trim() === "") continue;
125
- if (isSameProviderAndModel) {
126
- const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thinkingSignature);
127
- parts.push({
128
- thought: true,
129
- text: sanitizeSurrogates(block.thinking),
130
- ...thoughtSignature && { thoughtSignature }
131
- });
132
- } else parts.push({ text: sanitizeSurrogates(block.thinking) });
126
+ const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thinkingSignature);
127
+ if ((!block.thinking || block.thinking.trim() === "") && !thoughtSignature) continue;
128
+ if (isSameProviderAndModel) parts.push({
129
+ thought: true,
130
+ text: sanitizeSurrogates(block.thinking),
131
+ ...thoughtSignature && { thoughtSignature }
132
+ });
133
+ else parts.push({ text: sanitizeSurrogates(block.thinking) });
133
134
  } else if (block.type === "toolCall") {
134
- const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thoughtSignature);
135
+ const args = coerceTransportToolCallArguments(block.arguments);
136
+ const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thoughtSignature) ?? (!sawFunctionCall && requiresToolCallThoughtSignature ? "skip_thought_signature_validator" : void 0);
137
+ sawFunctionCall = true;
135
138
  const part = {
136
139
  functionCall: {
137
140
  name: block.name,
138
- args: block.arguments ?? {},
141
+ args,
139
142
  ...requiresToolCallId(model.id) ? { id: block.id } : {}
140
143
  },
141
144
  ...thoughtSignature && { thoughtSignature }
@@ -181,45 +184,22 @@ function convertMessages(model, context) {
181
184
  }
182
185
  }
183
186
  flushToolResultRun();
187
+ if (contents.length === 0) contents.push({
188
+ role: "user",
189
+ parts: [{ text: " " }]
190
+ });
184
191
  return contents;
185
192
  }
186
- const JSON_SCHEMA_META_DECLARATIONS = /* @__PURE__ */ new Set([
187
- "$schema",
188
- "$id",
189
- "$anchor",
190
- "$dynamicAnchor",
191
- "$vocabulary",
192
- "$comment",
193
- "$defs",
194
- "definitions"
195
- ]);
196
- /**
197
- * Strip meta-declarations from a schema obj
198
- */
199
- function sanitizeForOpenApi(schema) {
200
- if (typeof schema !== "object" || schema === null || Array.isArray(schema)) return schema;
201
- const result = {};
202
- for (const [key, value] of Object.entries(schema)) {
203
- if (JSON_SCHEMA_META_DECLARATIONS.has(key)) continue;
204
- result[key] = sanitizeForOpenApi(value);
205
- }
206
- return result;
207
- }
208
193
  /**
209
194
  * Convert tools to Gemini function declarations format.
210
- *
211
- * By default uses `parametersJsonSchema` which supports full JSON Schema (including
212
- * anyOf, oneOf, const, etc.). Set `useParameters` to true to use the legacy `parameters`
213
- * field instead (OpenAPI 3.03 Schema). This is needed for Cloud Code Assist with Claude
214
- * models, where the API translates `parameters` into Anthropic's `input_schema`.
215
195
  * @internal Directly tested provider implementation detail.
216
196
  */
217
- function convertTools(tools, useParameters = false) {
197
+ function convertTools(tools) {
218
198
  if (tools.length === 0) return;
219
- return [{ functionDeclarations: tools.map((tool) => ({
199
+ return [{ functionDeclarations: sortPromptCacheToolsByName(tools).map((tool) => ({
220
200
  name: tool.name,
221
201
  description: tool.description,
222
- ...useParameters ? { parameters: sanitizeForOpenApi(tool.parameters) } : { parametersJsonSchema: tool.parameters }
202
+ parametersJsonSchema: tool.parameters
223
203
  })) }];
224
204
  }
225
205
  /**
@@ -276,17 +256,23 @@ async function runGoogleGenerateContentLifecycle(params) {
276
256
  });
277
257
  } catch (error) {
278
258
  for (const block of output.content) if ("index" in block) delete block.index;
279
- output.stopReason = options?.signal?.aborted ? "aborted" : "error";
280
- output.errorMessage = formatProviderError(error);
259
+ const failure = options?.signal?.aborted ? transportAbortError(options.signal) : error;
260
+ assignTransportErrorDetails(output, failure, options?.signal);
261
+ const formattedError = formatProviderError(failure);
262
+ const status = failure instanceof Error && "status" in failure ? failure.status : void 0;
263
+ if (typeof status === "number" && Number.isFinite(status)) {
264
+ output.errorCode ||= String(status);
265
+ output.errorMessage = formattedError.startsWith(`${status}:`) ? formattedError : `${status}: ${formattedError}`;
266
+ } else output.errorMessage = formattedError;
281
267
  stream.push({
282
268
  type: "error",
283
- reason: output.stopReason,
269
+ reason: output.stopReason === "aborted" ? "aborted" : "error",
284
270
  error: output
285
271
  });
286
272
  stream.end();
287
273
  }
288
274
  }
289
- function buildGoogleGenerateContentParams(model, context, options = {}, configHooks) {
275
+ function buildGoogleGenerateContentParams(model, context, options = {}) {
290
276
  const contents = convertMessages(model, context);
291
277
  const generationConfig = {};
292
278
  if (options.temperature !== void 0) generationConfig.temperature = options.temperature;
@@ -304,7 +290,10 @@ function buildGoogleGenerateContentParams(model, context, options = {}, configHo
304
290
  if (options.thinking.level !== void 0) thinkingConfig.thinkingLevel = ThinkingLevel[options.thinking.level];
305
291
  else if (options.thinking.budgetTokens !== void 0) thinkingConfig.thinkingBudget = options.thinking.budgetTokens;
306
292
  config.thinkingConfig = thinkingConfig;
307
- } else if (model.reasoning && options.thinking && !options.thinking.enabled) config.thinkingConfig = configHooks?.getDisabledThinkingConfig ? configHooks.getDisabledThinkingConfig(model) : getDisabledGoogleThinkingConfig(model);
293
+ } else if (model.reasoning && options.thinking && !options.thinking.enabled) {
294
+ const disabledThinkingConfig = getDisabledGoogleThinkingConfig(model);
295
+ if (Object.keys(disabledThinkingConfig).length > 0) config.thinkingConfig = disabledThinkingConfig;
296
+ }
308
297
  if (options.signal) {
309
298
  if (options.signal.aborted) throw new Error("Request aborted");
310
299
  config.abortSignal = options.signal;
@@ -315,8 +304,22 @@ function buildGoogleGenerateContentParams(model, context, options = {}, configHo
315
304
  config
316
305
  };
317
306
  }
307
+ function isAdaptiveGoogleReasoningLevel(value) {
308
+ return value === "adaptive";
309
+ }
318
310
  function buildGoogleSimpleThinking(model, options, config) {
319
311
  if (!options?.reasoning || options.reasoning === "off") return { enabled: false };
312
+ if (isAdaptiveGoogleReasoningLevel(options.reasoning)) {
313
+ if (!model.reasoning) return { enabled: false };
314
+ if (isGemma4Model(model)) return {
315
+ enabled: true,
316
+ level: ThinkingLevel.HIGH
317
+ };
318
+ return isGemini3ProModel(model) || isGemini3FlashModel(model) ? { enabled: true } : {
319
+ enabled: true,
320
+ budgetTokens: -1
321
+ };
322
+ }
320
323
  const clampedReasoning = clampThinkingLevel(model, options.reasoning);
321
324
  if (clampedReasoning === "off") return { enabled: false };
322
325
  const effort = clampedReasoning === "max" ? "high" : clampedReasoning;
@@ -329,10 +332,10 @@ function buildGoogleSimpleThinking(model, options, config) {
329
332
  budgetTokens: getGoogleBudget(model, effort, options.thinkingBudgets, { useFlashLiteBudgets: config?.useFlashLiteBudgets })
330
333
  };
331
334
  }
332
- function getDisabledGoogleThinkingConfig(model, config) {
335
+ function getDisabledGoogleThinkingConfig(model) {
333
336
  if (isGemini3ProModel(model)) return { thinkingLevel: ThinkingLevel.LOW };
334
337
  if (isGemini3FlashModel(model)) return { thinkingLevel: ThinkingLevel.MINIMAL };
335
- if (config?.includeGemma4 && isGemma4Model(model)) return { thinkingLevel: ThinkingLevel.MINIMAL };
338
+ if (isGemma4Model(model) || model.id.toLowerCase().includes("gemini-2.5-pro")) return {};
336
339
  return { thinkingBudget: 0 };
337
340
  }
338
341
  /** @internal Directly tested provider implementation detail. */
@@ -340,10 +343,10 @@ function isGemma4Model(model) {
340
343
  return /gemma-?4/.test(model.id.toLowerCase());
341
344
  }
342
345
  function isGemini3ProModel(model) {
343
- return /gemini-3(?:\.\d+)?-pro/.test(model.id.toLowerCase());
346
+ return /gemini-(?:3(?:\.\d+)?-pro|pro-latest)/.test(model.id.toLowerCase());
344
347
  }
345
348
  function isGemini3FlashModel(model) {
346
- return /gemini-3(?:\.\d+)?-flash/.test(model.id.toLowerCase());
349
+ return /gemini-(?:3(?:\.\d+)?-flash|flash(?:-lite)?-latest)/.test(model.id.toLowerCase());
347
350
  }
348
351
  function getGoogleThinkingLevel(effort, model, config) {
349
352
  if (isGemini3ProModel(model)) switch (effort) {
@@ -422,6 +425,15 @@ async function consumeGoogleGenerateContentStream(params) {
422
425
  });
423
426
  let currentBlock = null;
424
427
  const blocks = params.output.content;
428
+ let sawTerminalReason = false;
429
+ let terminalGenerationError;
430
+ const knownUsage = {
431
+ promptTokenCount: 0,
432
+ cachedContentTokenCount: 0,
433
+ toolUsePromptTokenCount: 0,
434
+ candidatesTokenCount: 0,
435
+ thoughtsTokenCount: 0
436
+ };
425
437
  const toolCallIds = /* @__PURE__ */ new Set();
426
438
  for (const block of blocks) if (block.type === "toolCall") toolCallIds.add(block.id);
427
439
  const blockIndex = () => blocks.length - 1;
@@ -443,9 +455,60 @@ async function consumeGoogleGenerateContentStream(params) {
443
455
  };
444
456
  for await (const chunk of params.chunks) {
445
457
  params.output.responseId ||= chunk.responseId;
458
+ if (chunk.usageMetadata) {
459
+ for (const field of Object.keys(knownUsage)) {
460
+ const value = chunk.usageMetadata[field];
461
+ if (typeof value === "number") knownUsage[field] = value;
462
+ }
463
+ const promptTokens = knownUsage.promptTokenCount;
464
+ const cacheRead = knownUsage.cachedContentTokenCount;
465
+ const toolUsePromptTokens = knownUsage.toolUsePromptTokenCount;
466
+ const outputTokens = knownUsage.candidatesTokenCount + knownUsage.thoughtsTokenCount;
467
+ params.output.usage = {
468
+ input: Math.max(0, promptTokens - cacheRead) + toolUsePromptTokens,
469
+ output: outputTokens,
470
+ cacheRead,
471
+ cacheWrite: 0,
472
+ totalTokens: chunk.usageMetadata.totalTokenCount ?? promptTokens + outputTokens + toolUsePromptTokens,
473
+ cost: {
474
+ input: 0,
475
+ output: 0,
476
+ cacheRead: 0,
477
+ cacheWrite: 0,
478
+ total: 0
479
+ }
480
+ };
481
+ calculateCost(params.model, params.output.usage);
482
+ }
446
483
  const candidate = chunk.candidates?.[0];
447
- if (candidate?.content?.parts) for (const part of candidate.content.parts) {
448
- if (part.text !== void 0) {
484
+ const promptFeedback = chunk.promptFeedback;
485
+ if (!candidate && promptFeedback) {
486
+ const blockReason = promptFeedback.blockReason ?? "PROMPT_BLOCKED";
487
+ const blockMessage = promptFeedback.blockReasonMessage?.trim();
488
+ params.output.errorCode = blockReason;
489
+ params.output.errorType = "google_prompt_blocked";
490
+ throw new Error(`Google prompt blocked (${blockReason})${blockMessage ? `: ${blockMessage}` : ""}`);
491
+ }
492
+ if (candidate?.content?.parts) for (const [partIndex, part] of candidate.content.parts.entries()) {
493
+ const text = part.text;
494
+ const hasText = typeof text === "string";
495
+ const hasThoughtSignature = typeof part.thoughtSignature === "string" && part.thoughtSignature.length > 0;
496
+ const signatureOnly = hasThoughtSignature && (!hasText || text.length === 0) && Object.keys(part).every((key) => key === "thought" || key === "thoughtSignature" || key === "text");
497
+ if (signatureOnly) {
498
+ if (!hasText && part.thought !== true) {
499
+ const latestBlock = blocks.at(-1);
500
+ if (partIndex === 0 && latestBlock?.type === "toolCall" && !latestBlock.thoughtSignature) {
501
+ latestBlock.thoughtSignature = retainThoughtSignature(latestBlock.thoughtSignature, part.thoughtSignature);
502
+ continue;
503
+ }
504
+ }
505
+ endCurrentBlock();
506
+ }
507
+ if (hasText || signatureOnly) {
508
+ if (currentBlock && (hasThoughtSignature || partIndex > 0)) {
509
+ const currentSignature = currentBlock.type === "thinking" ? currentBlock.thinkingSignature : currentBlock.textSignature;
510
+ if ((currentBlock.type === "thinking" ? currentBlock.thinking : currentBlock.text).length > 0 && (currentSignature !== part.thoughtSignature || partIndex > 0 && (currentSignature || hasThoughtSignature))) endCurrentBlock();
511
+ }
449
512
  const isThinking = isThinkingPart(part);
450
513
  if (!currentBlock || isThinking && currentBlock.type !== "thinking" || !isThinking && currentBlock.type !== "text") {
451
514
  endCurrentBlock();
@@ -474,25 +537,27 @@ async function consumeGoogleGenerateContentStream(params) {
474
537
  });
475
538
  }
476
539
  }
540
+ const delta = hasText ? text : "";
477
541
  if (currentBlock.type === "thinking") {
478
- currentBlock.thinking += part.text;
542
+ currentBlock.thinking += delta;
479
543
  currentBlock.thinkingSignature = retainThoughtSignature(currentBlock.thinkingSignature, part.thoughtSignature);
480
544
  params.stream.push({
481
545
  type: "thinking_delta",
482
546
  contentIndex: blockIndex(),
483
- delta: part.text,
547
+ delta,
484
548
  partial: params.output
485
549
  });
486
550
  } else {
487
- currentBlock.text += part.text;
551
+ currentBlock.text += delta;
488
552
  currentBlock.textSignature = retainThoughtSignature(currentBlock.textSignature, part.thoughtSignature);
489
553
  params.stream.push({
490
554
  type: "text_delta",
491
555
  contentIndex: blockIndex(),
492
- delta: part.text,
556
+ delta,
493
557
  partial: params.output
494
558
  });
495
559
  }
560
+ if (signatureOnly) endCurrentBlock();
496
561
  }
497
562
  if (part.functionCall) {
498
563
  endCurrentBlock();
@@ -526,29 +591,30 @@ async function consumeGoogleGenerateContentStream(params) {
526
591
  }
527
592
  }
528
593
  if (candidate?.finishReason) {
594
+ sawTerminalReason = true;
529
595
  params.output.stopReason = mapStopReason(candidate.finishReason);
596
+ if (params.output.stopReason === "error") {
597
+ const finishMessage = candidate.finishMessage?.trim();
598
+ terminalGenerationError = Object.assign(/* @__PURE__ */ new Error(`Google generation stopped (${candidate.finishReason})${finishMessage ? `: ${finishMessage}` : ""}`), {
599
+ code: candidate.finishReason,
600
+ type: "google_generation_failed"
601
+ });
602
+ }
530
603
  if (params.output.stopReason === "stop" && params.output.content.some((block) => block.type === "toolCall")) params.output.stopReason = "toolUse";
531
604
  }
532
- if (chunk.usageMetadata) {
533
- params.output.usage = {
534
- input: (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),
535
- output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),
536
- cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,
537
- cacheWrite: 0,
538
- totalTokens: chunk.usageMetadata.totalTokenCount || 0,
539
- cost: {
540
- input: 0,
541
- output: 0,
542
- cacheRead: 0,
543
- cacheWrite: 0,
544
- total: 0
545
- }
546
- };
547
- calculateCost(params.model, params.output.usage);
548
- }
549
605
  }
550
606
  endCurrentBlock();
551
607
  if (params.signal?.aborted) throw transportAbortError(params.signal);
608
+ if (terminalGenerationError) {
609
+ params.output.errorCode = terminalGenerationError.code;
610
+ params.output.errorType = terminalGenerationError.type;
611
+ throw terminalGenerationError;
612
+ }
613
+ if (!sawTerminalReason) {
614
+ params.output.errorCode = "STREAM_INCOMPLETE";
615
+ params.output.errorType = "google_incomplete_stream";
616
+ throw new Error("Google stream ended before a terminal finish reason");
617
+ }
552
618
  if (params.output.stopReason === "aborted" || params.output.stopReason === "error") throw new Error("An unknown error occurred");
553
619
  params.stream.push({
554
620
  type: "done",
@@ -558,4 +624,4 @@ async function consumeGoogleGenerateContentStream(params) {
558
624
  params.stream.end();
559
625
  }
560
626
  //#endregion
561
- export { runGoogleGenerateContentLifecycle as a, getDisabledGoogleThinkingConfig as i, buildGoogleSimpleThinking as n, createGoogleAssistantOutput as r, buildGoogleGenerateContentParams as t };
627
+ export { runGoogleGenerateContentLifecycle as i, buildGoogleSimpleThinking as n, createGoogleAssistantOutput as r, buildGoogleGenerateContentParams as t };
@@ -1,7 +1,7 @@
1
- import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
2
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-Dog2WQiR.mjs";
3
- import { n as buildBaseOptions } from "./simple-options-9lhRrN73.mjs";
4
- import { a as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-DNBz5rcD.mjs";
1
+ import { t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
2
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, v as normalizeOptionalString } from "./host-Bl7Kgddo.mjs";
3
+ import { c as buildBaseOptions } from "./tool-result-text-Dvkp2Dus.mjs";
4
+ import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Cq2UKx1l.mjs";
5
5
  import { GoogleGenAI, ResourceScope } from "@google/genai";
6
6
  //#region packages/ai/src/providers/google-vertex.ts
7
7
  const API_VERSION = "v1";
@@ -27,7 +27,10 @@ const streamSimpleGoogleVertex = (model, context, options) => {
27
27
  const base = buildBaseOptions(model, options, void 0);
28
28
  return streamGoogleVertex(model, context, {
29
29
  ...base,
30
- thinking: buildGoogleSimpleThinking(model, options)
30
+ thinking: buildGoogleSimpleThinking(model, options, {
31
+ includeGemma4ThinkingLevel: true,
32
+ useFlashLiteBudgets: true
33
+ })
31
34
  });
32
35
  };
33
36
  function createClient(model, project, location, optionsHeaders) {
@@ -82,12 +85,12 @@ function isPlaceholderApiKey(apiKey) {
82
85
  return /^<[^>]+>$/.test(apiKey);
83
86
  }
84
87
  function resolveProject(options) {
85
- const project = options?.project || process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT;
88
+ const project = normalizeOptionalString(options?.project) || normalizeOptionalString(process.env.GOOGLE_CLOUD_PROJECT) || normalizeOptionalString(process.env.GCLOUD_PROJECT);
86
89
  if (!project) throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");
87
90
  return project;
88
91
  }
89
92
  function resolveLocation(options) {
90
- const location = options?.location || process.env.GOOGLE_CLOUD_LOCATION;
93
+ const location = normalizeOptionalString(options?.location) || normalizeOptionalString(process.env.GOOGLE_CLOUD_LOCATION);
91
94
  if (!location) throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");
92
95
  return location;
93
96
  }
@@ -1,4 +1,5 @@
1
- import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, i as requiresClaudeDefaultSampling, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-QkygScBs.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 "./src-QkygScBs.mjs";
2
+ import { r as clampThinkingLevel } from "./model-utils-Dau5dlgm.mjs";
2
3
  //#region packages/normalization-core/src/record-coerce.ts
3
4
  /** Type guard for non-array object records at browser-safe boundaries. */
4
5
  function isRecord(value) {
@@ -34,6 +35,8 @@ function hasNonEmptyString(value) {
34
35
  }
35
36
  //#endregion
36
37
  //#region packages/ai/src/providers/anthropic-model-contract.ts
38
+ const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.75";
39
+ const ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK = `x-anthropic-billing-header: cc_version=${ANTHROPIC_CLAUDE_CODE_VERSION}; cc_entrypoint=sdk-cli;`;
37
40
  function normalizeModelId(modelId) {
38
41
  const normalized = normalizeLowercaseStringOrEmpty(modelId);
39
42
  return (normalized.startsWith("anthropic/") ? normalized.slice(10) : normalized).replace(/[._\s]+/g, "-");
@@ -62,6 +65,41 @@ function requiresClaudeAdaptiveThinking(model) {
62
65
  function defaultsClaudeAdaptiveThinking(model) {
63
66
  return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && (resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0);
64
67
  }
68
+ /** Resolve provider-native effort once for direct and managed Claude requests. */
69
+ function resolveAnthropicThinkingEffort(model, level) {
70
+ const requestedLevel = level;
71
+ const thinkingLevelMap = resolveClaudeNativeThinkingLevelMap(model);
72
+ const clampModel = {
73
+ ...model,
74
+ ...typeof model.params?.canonicalModelId === "string" ? { reasoning: true } : {},
75
+ ...thinkingLevelMap ? { thinkingLevelMap } : {}
76
+ };
77
+ const resolvedLevel = requestedLevel ? clampThinkingLevel(clampModel, requestedLevel) : void 0;
78
+ const mapped = resolvedLevel ? thinkingLevelMap?.[resolvedLevel] : void 0;
79
+ if (typeof mapped === "string") return mapped;
80
+ switch (resolvedLevel) {
81
+ case "off":
82
+ case "minimal":
83
+ case "low": return "low";
84
+ case "medium": return "medium";
85
+ case "xhigh": return supportsClaudeNativeXhighEffort(model) ? "xhigh" : "high";
86
+ case "max": return supportsClaudeNativeMaxEffort(model) ? "max" : "high";
87
+ default: return "high";
88
+ }
89
+ }
90
+ /** Normalize Anthropic and Anthropic-compatible terminal reasons identically. */
91
+ function mapAnthropicStopReason(reason) {
92
+ switch (reason) {
93
+ case "end_turn":
94
+ case "pause_turn":
95
+ case "stop_sequence": return "stop";
96
+ case "max_tokens": return "length";
97
+ case "tool_use": return "toolUse";
98
+ case "refusal":
99
+ case "sensitive": return "error";
100
+ default: throw new Error(`Unhandled stop reason: ${String(reason)}`);
101
+ }
102
+ }
65
103
  /** Remove unsupported assistant prefills while preserving completed tool-use turns. */
66
104
  function prepareClaudeNoPrefillRequestContext(model, context) {
67
105
  if (!resolveClaudeOpus5ModelIdentity(model) && !resolveClaudeSonnet5ModelIdentity(model)) return context;
@@ -366,4 +404,4 @@ function resolveAiTransportHeaderSentinels(headers) {
366
404
  return resolvedHeaders ?? headers;
367
405
  }
368
406
  //#endregion
369
- export { applyClaudeRequestContract as a, requiresClaudeAdaptiveThinking as c, usesClaudeStreamingRefusalContract as d, hasNonEmptyString as f, isRecord as g, readStringValue as h, transformMessages as i, resolveModelBoundThinkingReplayMode as l, normalizeOptionalString as m, getAiTransportHost as n, defaultsClaudeAdaptiveThinking as o, normalizeLowercaseStringOrEmpty as p, resolveAiTransportHeaderSentinels as r, prepareClaudeNoPrefillRequestContext as s, configureAiTransportHost as t, usesClaudeFable5MessagesContract as u };
407
+ export { normalizeLowercaseStringOrEmpty as _, ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK as a, isRecord as b, defaultsClaudeAdaptiveThinking as c, requiresClaudeAdaptiveThinking as d, resolveAnthropicThinkingEffort as f, hasNonEmptyString as g, usesClaudeStreamingRefusalContract as h, transformMessages as i, mapAnthropicStopReason as l, usesClaudeFable5MessagesContract as m, getAiTransportHost as n, ANTHROPIC_CLAUDE_CODE_VERSION as o, resolveModelBoundThinkingReplayMode as p, resolveAiTransportHeaderSentinels as r, applyClaudeRequestContract as s, configureAiTransportHost as t, prepareClaudeNoPrefillRequestContext as u, normalizeOptionalString as v, readStringValue as y };
@@ -1,5 +1,5 @@
1
- import { E as Model, L as StreamFn, n as Api, u as Context } from "./types-bzp5k29J.mjs";
2
- import { n as ApiRegistry } from "./api-registry-DlMgPR39.mjs";
1
+ import { E as Model, L as StreamFn, n as Api, u as Context } from "./types-CH7ReIcU.mjs";
2
+ import { n as ApiRegistry } from "./api-registry-EpJoVwM1.mjs";
3
3
 
4
4
  //#region packages/ai/src/host.d.ts
5
5
  /** Provider capability facts needed by the package-owned transports. */
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
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";
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 VercelGatewayRouting, A as OpenRouterRouting, B as TextContent, C as KnownImagesProvider, D as ModelThinkingLevel, E as Model, F as SimpleStreamOptions, G as ThinkingLevelMap, H as ThinkingBudgets, I as StopReason, J as ToolResultMessage, K as Tool, L as StreamFn, M as ProviderImagesOptions, N as ProviderResponse, O as OpenAICompletionsCompat, P as ProviderStreamOptions, Q as ValidateToolArgumentsFn, R as StreamFunction, S as KnownImagesApi, T as Message, U as ThinkingContent, V as TextSignatureV1, W as ThinkingLevel, X as Usage, Y as Transport, Z as UserMessage, _ as ImagesOptions, a as AssistantMessageEvent, b as ImagesStopReason, c as CacheRetention, d as ImageContent, f as ImagesApi, g as ImagesModel, h as ImagesInputContent, i as AssistantMessage, j as Provider, k as OpenAIResponsesCompat, l as CompleteSimpleFn, m as ImagesFunction, n as Api, o as AssistantMessageEventStreamContract, p as ImagesContext, q as ToolCall, r as AssistantImages, s as AssistantMessageEventStreamLike, t as AnthropicMessagesCompat, u as Context, v as ImagesOutputContent, w as MaybePromise, x as KnownApi, y as ImagesProvider, z as StreamOptions } from "./types-bzp5k29J.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-YjaPW20U.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-B-j7cOYp.mjs";
6
- import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-DlMgPR39.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-B9GUmcra.mjs";
3
+ import { $ as VercelGatewayRouting, A as OpenRouterRouting, B as TextContent, C as KnownImagesProvider, D as ModelThinkingLevel, E as Model, F as SimpleStreamOptions, G as ThinkingLevelMap, H as ThinkingBudgets, I as StopReason, J as ToolResultMessage, K as Tool, L as StreamFn, M as ProviderImagesOptions, N as ProviderResponse, O as OpenAICompletionsCompat, P as ProviderStreamOptions, Q as ValidateToolArgumentsFn, R as StreamFunction, S as KnownImagesApi, T as Message, U as ThinkingContent, V as TextSignatureV1, W as ThinkingLevel, X as Usage, Y as Transport, Z as UserMessage, _ as ImagesOptions, a as AssistantMessageEvent, b as ImagesStopReason, c as CacheRetention, d as ImageContent, f as ImagesApi, g as ImagesModel, h as ImagesInputContent, i as AssistantMessage, j as Provider, k as OpenAIResponsesCompat, l as CompleteSimpleFn, m as ImagesFunction, n as Api, o as AssistantMessageEventStreamContract, p as ImagesContext, q as ToolCall, r as AssistantImages, s as AssistantMessageEventStreamLike, t as AnthropicMessagesCompat, u as Context, v as ImagesOutputContent, w as MaybePromise, x as KnownApi, y as ImagesProvider, z as StreamOptions } from "./types-CH7ReIcU.mjs";
4
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DRmDMRHH.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-CcPcuEbR.mjs";
6
+ import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-EpJoVwM1.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-Dn4_SZI2.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. */
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
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 "./src-QkygScBs.mjs";
2
2
  import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
3
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
3
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
4
4
  import { n as validateToolCall, t as validateToolArguments } from "./validation-DAa_yFOM.mjs";
5
5
  import { n as createApiRegistry, t as createLlmRuntime } from "./stream-CREqxHgU.mjs";
6
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-Dog2WQiR.mjs";
6
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-Bl7Kgddo.mjs";
7
7
  export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, 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 };