@openclaw/ai 2026.7.1-beta.6 → 2026.7.2-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 (47) hide show
  1. package/dist/{anthropic-B5gZQM5X.mjs → anthropic-Cvm71xlk.mjs} +19 -97
  2. package/dist/{api-registry-BXYnCOIR.d.mts → api-registry-Byvoz8Ha.d.mts} +1 -1
  3. package/dist/{azure-openai-responses-DNoSk8Uy.mjs → azure-openai-responses-b4lfJxYS.mjs} +6 -6
  4. package/dist/{azure-openai-responses-client-compat-a_O_GVQV.mjs → azure-openai-responses-client-compat-C7K7QfUE.mjs} +23 -2
  5. package/dist/{env-api-keys-CtMlqaQ4.mjs → env-api-keys-DnhYpc27.mjs} +4 -3
  6. package/dist/{event-stream-ReMmOTzX.mjs → event-stream-D8n2uFee.mjs} +14 -6
  7. package/dist/{event-stream-0nZeBKl2.d.mts → event-stream-uQspnL8S.d.mts} +1 -1
  8. package/dist/event-stream.d.mts +1 -1
  9. package/dist/event-stream.mjs +1 -1
  10. package/dist/{google-D6sIQ1bL.mjs → google-C7PoDjpW.mjs} +4 -4
  11. package/dist/{google-shared-ZPSl2qTi.mjs → google-shared-C7ohrmOI.mjs} +29 -20
  12. package/dist/{google-vertex-rDGwkoZK.mjs → google-vertex-L_ABazIA.mjs} +5 -18
  13. package/dist/index.d.mts +4 -4
  14. package/dist/index.mjs +3 -3
  15. package/dist/internal/anthropic.d.mts +1 -1
  16. package/dist/internal/anthropic.mjs +3 -3
  17. package/dist/internal/openai.d.mts +14 -3
  18. package/dist/internal/openai.mjs +7 -7
  19. package/dist/internal/retry-after.d.mts +5 -0
  20. package/dist/internal/retry-after.mjs +101 -0
  21. package/dist/internal/runtime.d.mts +2 -2
  22. package/dist/internal/runtime.mjs +6 -5
  23. package/dist/internal/shared.d.mts +2 -1
  24. package/dist/internal/shared.mjs +1 -1
  25. package/dist/{json-parse-DzNSIQBq.mjs → json-parse-BvXNt1-7.mjs} +4 -6
  26. package/dist/{mistral-CePVNdws.mjs → mistral-D-39Trax.mjs} +114 -31
  27. package/dist/{model-utils-DgmOla96.mjs → model-utils-Q1LSRIdo.mjs} +5 -12
  28. package/dist/{openai-chatgpt-responses-DVC4Bk_A.mjs → openai-chatgpt-responses-DCA0K85L.mjs} +40 -96
  29. package/dist/{openai-completions-B9QLIq2U.mjs → openai-completions-B2jr3vtJ.mjs} +24 -21
  30. package/dist/{openai-responses-B6LylGxM.mjs → openai-responses-DTpD8YVy.mjs} +6 -6
  31. package/dist/{openai-responses-shared-sj2YUPYc.mjs → openai-responses-shared-B9mtGvXq.mjs} +207 -46
  32. package/dist/{openai-tool-projection-BknoV11q.mjs → openai-tool-projection-cTLC4F65.mjs} +8 -3
  33. package/dist/providers.d.mts +1 -1
  34. package/dist/providers.mjs +9 -9
  35. package/dist/{reasoning-tag-text-partitioner-axhAdUwg.mjs → reasoning-tag-text-partitioner-BlVe67g6.mjs} +14 -8
  36. package/dist/{src-CZ503MYJ.mjs → src-CXno1H5g.mjs} +1 -1
  37. package/dist/{tool-schema-json-projection-BXtBc_mD.mjs → tool-schema-json-projection-BwNu3nDi.mjs} +22 -2
  38. package/dist/{transform-messages-BhGF_fF4.mjs → transform-messages-DNWpwvXA.mjs} +2 -2
  39. package/dist/{types-DRgdPqaZ.d.mts → types-Cx2zJtyz.d.mts} +5 -0
  40. package/dist/types.d.mts +3 -3
  41. package/dist/types.mjs +3 -3
  42. package/dist/{validation-BDMWOr8d.d.mts → validation-Cej7htKc.d.mts} +1 -1
  43. package/dist/{validation-FrchoOlv.mjs → validation-DAa_yFOM.mjs} +2 -7
  44. package/dist/validation.d.mts +1 -1
  45. package/dist/validation.mjs +1 -1
  46. package/npm-shrinkwrap.json +2 -2
  47. package/package.json +1 -1
@@ -1,16 +1,17 @@
1
- import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-CtMlqaQ4.mjs";
2
- import { c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, l as resolveClaudeSonnet5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "./src-CZ503MYJ.mjs";
3
- import { t as AssistantMessageEventStream } from "./event-stream-ReMmOTzX.mjs";
1
+ import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DnhYpc27.mjs";
2
+ import { c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, l as resolveClaudeSonnet5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "./src-CXno1H5g.mjs";
3
+ import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
4
4
  import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-4t713IeR.mjs";
5
- import { n as calculateCost, r as clampThinkingLevel } from "./model-utils-DgmOla96.mjs";
5
+ import { n as calculateCost, r as clampThinkingLevel } from "./model-utils-Q1LSRIdo.mjs";
6
6
  import { r as createDeferredEventBuffer, t as notifyLlmRequestActivity } from "./llm-request-activity-CehVkZP-.mjs";
7
7
  import { t as headersToRecord } from "./headers-B_e4-1J0.mjs";
8
- import { n as parseStreamingJson, t as parseJsonWithRepair } from "./json-parse-DzNSIQBq.mjs";
8
+ import { n as parseStreamingJson, t as parseJsonWithRepair } from "./json-parse-BvXNt1-7.mjs";
9
9
  import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
10
- import { a as adjustMaxTokensForThinking, b as stripSystemPromptCacheBoundary, c as isRecord, d as prepareClaudeSonnet5RequestContext, f as requiresClaudeAdaptiveThinking, h as usesClaudeStreamingRefusalContract, i as extractToolResultText, l as applyClaudeRequestContract, m as usesClaudeFable5MessagesContract, n as describeToolResultMediaPlaceholder, o as buildBaseOptions, r as extractToolResultBlockText, t as transformMessages, y as splitSystemPromptCacheBoundary } from "./transform-messages-BhGF_fF4.mjs";
11
- import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-BXtBc_mD.mjs";
10
+ import { b as splitSystemPromptCacheBoundary, f as prepareClaudeSonnet5RequestContext, g as usesClaudeStreamingRefusalContract, h as usesClaudeFable5MessagesContract, i as extractToolResultText, l as isRecord, n as describeToolResultMediaPlaceholder, o as adjustMaxTokensForThinking, p as requiresClaudeAdaptiveThinking, r as extractToolResultBlockText, s as buildBaseOptions, t as transformMessages, u as applyClaudeRequestContract, x as stripSystemPromptCacheBoundary } from "./transform-messages-DNWpwvXA.mjs";
11
+ import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-BwNu3nDi.mjs";
12
12
  import { a as resolveCacheRetention, i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-BsH5cqGj.mjs";
13
13
  import Anthropic from "@anthropic-ai/sdk";
14
+ import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
14
15
  //#region packages/ai/src/providers/anthropic-auth-headers.ts
15
16
  function usesFoundryBearerAuth(model) {
16
17
  return model.provider === "microsoft-foundry" && (model.authHeader === true || hasBearerAuthorizationHeader(model.headers));
@@ -432,93 +433,11 @@ const ANTHROPIC_MESSAGE_EVENTS = /* @__PURE__ */ new Set([
432
433
  "content_block_delta",
433
434
  "content_block_stop"
434
435
  ]);
435
- function flushSseEvent(state) {
436
- if (!state.event && state.data.length === 0) return null;
437
- const event = {
438
- event: state.event,
439
- data: state.data.join("\n"),
440
- raw: [...state.raw]
441
- };
442
- state.event = null;
443
- state.data = [];
444
- state.raw = [];
445
- return event;
446
- }
447
- function decodeSseLine(line, state) {
448
- if (line === "") return flushSseEvent(state);
449
- state.raw.push(line);
450
- if (line.startsWith(":")) return null;
451
- const delimiterIndex = line.indexOf(":");
452
- const fieldName = delimiterIndex === -1 ? line : line.slice(0, delimiterIndex);
453
- let value = delimiterIndex === -1 ? "" : line.slice(delimiterIndex + 1);
454
- if (value.startsWith(" ")) value = value.slice(1);
455
- if (fieldName === "event") state.event = value;
456
- else if (fieldName === "data") state.data.push(value);
457
- return null;
458
- }
459
- function nextLineBreakIndex(text) {
460
- const carriageReturnIndex = text.indexOf("\r");
461
- const newlineIndex = text.indexOf("\n");
462
- if (carriageReturnIndex === -1) return newlineIndex;
463
- if (newlineIndex === -1) return carriageReturnIndex;
464
- return Math.min(carriageReturnIndex, newlineIndex);
465
- }
466
- function consumeLine(text) {
467
- const lineBreakIndex = nextLineBreakIndex(text);
468
- if (lineBreakIndex === -1) return null;
469
- let nextIndex = lineBreakIndex + 1;
470
- if (text[lineBreakIndex] === "\r" && text[nextIndex] === "\n") nextIndex += 1;
471
- return {
472
- line: text.slice(0, lineBreakIndex),
473
- rest: text.slice(nextIndex)
474
- };
475
- }
476
- async function* iterateSseMessages(body, signal) {
477
- const reader = body.getReader();
478
- const decoder = new TextDecoder();
479
- const state = {
480
- event: null,
481
- data: [],
482
- raw: []
483
- };
484
- let buffer = "";
485
- try {
486
- while (true) {
487
- if (signal?.aborted) throw new Error("Request was aborted");
488
- const { value, done } = await reader.read();
489
- if (done) break;
490
- buffer += decoder.decode(value, { stream: true });
491
- let consumed = consumeLine(buffer);
492
- while (consumed) {
493
- buffer = consumed.rest;
494
- const event = decodeSseLine(consumed.line, state);
495
- if (event) yield event;
496
- consumed = consumeLine(buffer);
497
- }
498
- }
499
- buffer += decoder.decode();
500
- let consumed = consumeLine(buffer);
501
- while (consumed) {
502
- buffer = consumed.rest;
503
- const event = decodeSseLine(consumed.line, state);
504
- if (event) yield event;
505
- consumed = consumeLine(buffer);
506
- }
507
- if (buffer.length > 0) {
508
- const event = decodeSseLine(buffer, state);
509
- if (event) yield event;
510
- }
511
- const trailingEvent = flushSseEvent(state);
512
- if (trailingEvent) yield trailingEvent;
513
- } finally {
514
- reader.releaseLock();
515
- }
516
- }
517
- async function* iterateAnthropicEvents(response, signal, requireMessageStop = false) {
436
+ async function* iterateAnthropicEvents(response, requireMessageStop = false) {
518
437
  if (!response.body) throw new Error("Attempted to iterate over an Anthropic response with no body");
519
438
  let sawMessageStart = false;
520
439
  let sawMessageEnd = false;
521
- for await (const sse of iterateSseMessages(response.body, signal)) {
440
+ for await (const sse of Stream.rawEvents(response)) {
522
441
  if (sse.event === "error") throw new Error(sse.data);
523
442
  if (!ANTHROPIC_MESSAGE_EVENTS.has(sse.event ?? "")) continue;
524
443
  try {
@@ -609,7 +528,7 @@ const streamAnthropic = (model, context, options) => {
609
528
  }, model);
610
529
  const blocks = output.content;
611
530
  const blockIndexes = /* @__PURE__ */ new Map();
612
- for await (const event of iterateAnthropicEvents(response, requestOptions?.signal, refusalBuffer !== void 0)) if (event.type === "message_start") {
531
+ for await (const event of iterateAnthropicEvents(response, refusalBuffer !== void 0)) if (event.type === "message_start") {
613
532
  output.responseId = event.message.id;
614
533
  output.responseModel = event.message.model;
615
534
  const promptUsage = readAnthropicPromptUsageSnapshot(event.message.usage);
@@ -653,8 +572,7 @@ const streamAnthropic = (model, context, options) => {
653
572
  type: "start",
654
573
  partial: output
655
574
  });
656
- for (let i = 0; i < blocks.length; i += 1) {
657
- const block = blocks[i];
575
+ for (const [i, block] of blocks.entries()) {
658
576
  if (block.type !== "text") continue;
659
577
  delete block.index;
660
578
  eventSink.push({
@@ -1144,6 +1062,7 @@ function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messa
1144
1062
  const activeToolTurnAssistantIndex = replayThinkingEnabled ? -1 : findActiveAnthropicToolTurnAssistantIndex(transformedMessages);
1145
1063
  for (let i = 0; i < transformedMessages.length; i++) {
1146
1064
  const msg = transformedMessages[i];
1065
+ if (!msg) continue;
1147
1066
  if (msg.role === "user") {
1148
1067
  const isRuntimeContextCarrier = msg.runtimeContextCarrier === true;
1149
1068
  if (typeof msg.content === "string") {
@@ -1194,6 +1113,7 @@ function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messa
1194
1113
  continue;
1195
1114
  }
1196
1115
  if (block.redacted) {
1116
+ if (!block.thinkingSignature) throw new Error("redacted thinking block is missing its opaque signature");
1197
1117
  blocks.push({
1198
1118
  type: "redacted_thinking",
1199
1119
  data: block.thinkingSignature
@@ -1239,8 +1159,9 @@ function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messa
1239
1159
  is_error: msg.isError
1240
1160
  });
1241
1161
  let j = i + 1;
1242
- while (j < transformedMessages.length && transformedMessages[j].role === "toolResult") {
1243
- const nextMsg = transformedMessages[j];
1162
+ while (j < transformedMessages.length) {
1163
+ const nextMsg = transformedMessages.at(j);
1164
+ if (nextMsg?.role !== "toolResult") break;
1244
1165
  toolResults.push({
1245
1166
  type: "tool_result",
1246
1167
  tool_use_id: nextMsg.toolCallId,
@@ -1260,10 +1181,11 @@ function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messa
1260
1181
  let fallbackToolResult;
1261
1182
  for (let i = params.length - 1; i >= 0; i--) {
1262
1183
  const message = params[i];
1263
- if (message.role !== "user" || cacheBreakpointOptOutParamIndexes.has(i)) continue;
1184
+ if (!message || message.role !== "user" || cacheBreakpointOptOutParamIndexes.has(i)) continue;
1264
1185
  if (Array.isArray(message.content)) {
1265
1186
  for (let j = message.content.length - 1; j >= 0; j--) {
1266
1187
  const block = message.content[j];
1188
+ if (!block) continue;
1267
1189
  if (block.type === "text" || block.type === "image") {
1268
1190
  if (fallbackToolResult && messageCacheControlLimit === 1) {
1269
1191
  applyContentBlockCacheControl(fallbackToolResult, cacheControl);
@@ -1,4 +1,4 @@
1
- import { E as Model, F as SimpleStreamOptions, R as StreamFunction, n as Api, o as AssistantMessageEventStreamContract, u as Context, z as StreamOptions } from "./types-DRgdPqaZ.mjs";
1
+ import { E as Model, F as SimpleStreamOptions, R as StreamFunction, n as Api, o as AssistantMessageEventStreamContract, u as Context, z as StreamOptions } from "./types-Cx2zJtyz.mjs";
2
2
 
3
3
  //#region packages/ai/src/api-registry.d.ts
4
4
  /** Runtime stream adapter signature stored in the API provider registry. */
@@ -1,10 +1,10 @@
1
- import { n as getEnvApiKey } from "./env-api-keys-CtMlqaQ4.mjs";
2
- import { t as AssistantMessageEventStream } from "./event-stream-ReMmOTzX.mjs";
1
+ import { n as getEnvApiKey } from "./env-api-keys-DnhYpc27.mjs";
2
+ import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
3
3
  import { n as getAiTransportHost } from "./host-4t713IeR.mjs";
4
- import { o as buildBaseOptions } from "./transform-messages-BhGF_fF4.mjs";
5
- import { a as resolveResponsesReasoningEffort, n as convertResponsesMessages, o as runResponsesStreamLifecycle, r as createResponsesAssistantOutput, t as applyCommonResponsesParams } from "./openai-responses-shared-sj2YUPYc.mjs";
6
- import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-a_O_GVQV.mjs";
7
- import { a as clampOpenAIPromptCacheKey } from "./openai-tool-projection-BknoV11q.mjs";
4
+ import { s as buildBaseOptions } from "./transform-messages-DNWpwvXA.mjs";
5
+ import { a as resolveResponsesReasoningEffort, n as convertResponsesMessages, o as runResponsesStreamLifecycle, r as createResponsesAssistantOutput, t as applyCommonResponsesParams } from "./openai-responses-shared-B9mtGvXq.mjs";
6
+ import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
7
+ import { a as clampOpenAIPromptCacheKey } from "./openai-tool-projection-cTLC4F65.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";
@@ -15,9 +15,30 @@ function parseAzureDeploymentNameMap(value) {
15
15
  }
16
16
  return map;
17
17
  }
18
- /** Resolves the Azure deployment name for a model id, falling back to the model id. */
18
+ let cachedDeploymentLookup;
19
+ function getDeploymentLookup(source) {
20
+ const cached = cachedDeploymentLookup;
21
+ if (cached && cached.source === source) return cached;
22
+ const exact = parseAzureDeploymentNameMap(source);
23
+ const folded = /* @__PURE__ */ new Map();
24
+ for (const [modelId, deploymentName] of exact) folded.set(modelId.toLowerCase(), deploymentName);
25
+ cachedDeploymentLookup = {
26
+ source,
27
+ exact,
28
+ folded
29
+ };
30
+ return cachedDeploymentLookup;
31
+ }
32
+ /**
33
+ * Resolves the Azure deployment name for a model id, falling back to the model id.
34
+ *
35
+ * An exact-case match always wins, so configs that intentionally distinguish keys by
36
+ * case keep their exact mappings; a case-insensitive match is only used as a fallback
37
+ * (e.g. `GPT-4o` against a `gpt-4o=...` map) to avoid 404s from casing differences.
38
+ */
19
39
  function resolveAzureDeploymentNameFromMap(params) {
20
- return parseAzureDeploymentNameMap(params.deploymentMap).get(params.modelId) || params.modelId;
40
+ const { exact, folded } = getDeploymentLookup(params.deploymentMap);
41
+ return exact.get(params.modelId) ?? folded.get(params.modelId.toLowerCase()) ?? params.modelId;
21
42
  }
22
43
  //#endregion
23
44
  //#region packages/ai/src/providers/azure-openai-responses-client-compat.ts
@@ -70,8 +70,9 @@ function getProcEnv(key) {
70
70
  if (procEnvCache === null) {
71
71
  procEnvCache = /* @__PURE__ */ new Map();
72
72
  try {
73
- const { readFileSync } = __require("node:fs");
74
- const data = readFileSync("/proc/self/environ", "utf-8");
73
+ const fsModule = loadNodeBuiltinModule(NODE_FS_SPECIFIER);
74
+ if (!fsModule) return;
75
+ const data = fsModule.readFileSync("/proc/self/environ", "utf-8");
75
76
  for (const entry of data.split("\0")) {
76
77
  const idx = entry.indexOf("=");
77
78
  if (idx > 0) procEnvCache.set(entry.slice(0, idx), entry.slice(idx + 1));
@@ -106,7 +107,7 @@ function getApiKeyEnvVars(provider) {
106
107
  if (provider === "kimi" || provider === "kimi-coding") return ["KIMI_API_KEY", "KIMICODE_API_KEY"];
107
108
  const envVar = {
108
109
  openai: "OPENAI_API_KEY",
109
- "meta": "MODEL_API_KEY",
110
+ meta: "MODEL_API_KEY",
110
111
  "azure-openai-responses": "AZURE_OPENAI_API_KEY",
111
112
  deepseek: "DEEPSEEK_API_KEY",
112
113
  google: "GEMINI_API_KEY",
@@ -7,9 +7,13 @@ var EventStream = class {
7
7
  this.done = false;
8
8
  this.isComplete = isComplete;
9
9
  this.extractResult = extractResult;
10
+ const resolvers = [];
10
11
  this.finalResultPromise = new Promise((resolve) => {
11
- this.resolveFinalResult = resolve;
12
+ resolvers.push(resolve);
12
13
  });
14
+ const resolveFinalResult = resolvers.at(0);
15
+ if (!resolveFinalResult) throw new Error("event stream result promise did not initialize its resolver");
16
+ this.resolveFinalResult = resolveFinalResult;
13
17
  }
14
18
  push(event) {
15
19
  if (this.done) return;
@@ -27,13 +31,17 @@ var EventStream = class {
27
31
  end(result) {
28
32
  this.done = true;
29
33
  if (result !== void 0) this.resolveFinalResult(result);
30
- while (this.waiting.length > 0) this.waiting.shift()({
31
- value: void 0,
32
- done: true
33
- });
34
+ while (this.waiting.length > 0) {
35
+ const waiter = this.waiting.shift();
36
+ if (!waiter) break;
37
+ waiter({
38
+ value: void 0,
39
+ done: true
40
+ });
41
+ }
34
42
  }
35
43
  async *[Symbol.asyncIterator]() {
36
- while (true) if (this.queue.length > 0) yield this.queue.shift();
44
+ while (true) if (this.queue.length > 0) for (const event of this.queue.splice(0, 1)) yield event;
37
45
  else if (this.done) return;
38
46
  else {
39
47
  const result = await new Promise((resolve) => {
@@ -1,4 +1,4 @@
1
- import { a as AssistantMessageEvent, i as AssistantMessage, o as AssistantMessageEventStreamContract } from "./types-DRgdPqaZ.mjs";
1
+ import { a as AssistantMessageEvent, i as AssistantMessage, o as AssistantMessageEventStreamContract } from "./types-Cx2zJtyz.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-0nZeBKl2.mjs";
1
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uQspnL8S.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-ReMmOTzX.mjs";
1
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
2
2
  export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
@@ -1,8 +1,8 @@
1
- import { n as getEnvApiKey } from "./env-api-keys-CtMlqaQ4.mjs";
2
- import { t as AssistantMessageEventStream } from "./event-stream-ReMmOTzX.mjs";
1
+ import { n as getEnvApiKey } from "./env-api-keys-DnhYpc27.mjs";
2
+ import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
3
3
  import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-4t713IeR.mjs";
4
- import { o as buildBaseOptions } from "./transform-messages-BhGF_fF4.mjs";
5
- import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-ZPSl2qTi.mjs";
4
+ import { s as buildBaseOptions } from "./transform-messages-DNWpwvXA.mjs";
5
+ import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-C7ohrmOI.mjs";
6
6
  import { GoogleGenAI } from "@google/genai";
7
7
  //#region packages/ai/src/providers/google.ts
8
8
  let toolCallCounter = 0;
@@ -1,7 +1,7 @@
1
- import { n as calculateCost, r as clampThinkingLevel } from "./model-utils-DgmOla96.mjs";
1
+ import { n as calculateCost, r as clampThinkingLevel } from "./model-utils-Q1LSRIdo.mjs";
2
2
  import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
3
- import { b as stripSystemPromptCacheBoundary, i as extractToolResultText, n as describeToolResultMediaPlaceholder, t as transformMessages } from "./transform-messages-BhGF_fF4.mjs";
4
- import { FinishReason, FunctionCallingConfigMode } from "@google/genai";
3
+ import { i as extractToolResultText, n as describeToolResultMediaPlaceholder, t as transformMessages, x as stripSystemPromptCacheBoundary } from "./transform-messages-DNWpwvXA.mjs";
4
+ import { FinishReason, FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
5
5
  //#region packages/ai/src/providers/google-shared.ts
6
6
  /**
7
7
  * Shared utilities for Google Generative AI and Google Vertex providers.
@@ -32,6 +32,7 @@ function isThinkingPart(part) {
32
32
  *
33
33
  * Note: this does NOT merge or move signatures across distinct response parts. It only prevents
34
34
  * a signature from being overwritten with `undefined` within the same streamed block.
35
+ * @internal Directly tested provider implementation detail.
35
36
  */
36
37
  function retainThoughtSignature(existing, incoming) {
37
38
  if (typeof incoming === "string" && incoming.length > 0) return incoming;
@@ -51,14 +52,16 @@ function resolveThoughtSignature(isSameProviderAndModel, signature) {
51
52
  }
52
53
  /**
53
54
  * Models via Google APIs that require explicit tool call IDs in function calls/responses.
55
+ * @internal Directly tested provider implementation detail.
54
56
  */
55
57
  function requiresToolCallId(modelId) {
56
58
  return modelId.startsWith("claude-") || modelId.startsWith("gpt-oss-");
57
59
  }
58
60
  function getGeminiMajorVersion(modelId) {
59
- const match = modelId.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);
61
+ const match = modelId.toLowerCase().match(/(?:^|\/)gemini(?:-live)?-(\d+)/);
60
62
  if (!match) return;
61
- return Number.parseInt(match[1], 10);
63
+ const majorVersion = match.at(1);
64
+ return majorVersion === void 0 ? void 0 : Number.parseInt(majorVersion, 10);
62
65
  }
63
66
  function supportsMultimodalFunctionResponse(modelId) {
64
67
  const geminiMajorVersion = getGeminiMajorVersion(modelId);
@@ -67,6 +70,7 @@ function supportsMultimodalFunctionResponse(modelId) {
67
70
  }
68
71
  /**
69
72
  * Convert internal messages to Gemini Content[] format.
73
+ * @internal Directly tested provider implementation detail.
70
74
  */
71
75
  function convertMessages(model, context) {
72
76
  const contents = [];
@@ -204,6 +208,7 @@ function sanitizeForOpenApi(schema) {
204
208
  * anyOf, oneOf, const, etc.). Set `useParameters` to true to use the legacy `parameters`
205
209
  * field instead (OpenAPI 3.03 Schema). This is needed for Cloud Code Assist with Claude
206
210
  * models, where the API translates `parameters` into Anthropic's `input_schema`.
211
+ * @internal Directly tested provider implementation detail.
207
212
  */
208
213
  function convertTools(tools, useParameters = false) {
209
214
  if (tools.length === 0) return;
@@ -215,6 +220,7 @@ function convertTools(tools, useParameters = false) {
215
220
  }
216
221
  /**
217
222
  * Map tool choice string to Gemini FunctionCallingConfigMode.
223
+ * @internal Directly tested provider implementation detail.
218
224
  */
219
225
  function mapToolChoice(choice) {
220
226
  switch (choice) {
@@ -291,7 +297,7 @@ function buildGoogleGenerateContentParams(model, context, options = {}, configHo
291
297
  else config.toolConfig = void 0;
292
298
  if (options.thinking?.enabled && model.reasoning) {
293
299
  const thinkingConfig = { includeThoughts: true };
294
- if (options.thinking.level !== void 0) thinkingConfig.thinkingLevel = configHooks?.mapThinkingLevel ? configHooks.mapThinkingLevel(options.thinking.level) : options.thinking.level;
300
+ if (options.thinking.level !== void 0) thinkingConfig.thinkingLevel = ThinkingLevel[options.thinking.level];
295
301
  else if (options.thinking.budgetTokens !== void 0) thinkingConfig.thinkingBudget = options.thinking.budgetTokens;
296
302
  config.thinkingConfig = thinkingConfig;
297
303
  } else if (model.reasoning && options.thinking && !options.thinking.enabled) config.thinkingConfig = configHooks?.getDisabledThinkingConfig ? configHooks.getDisabledThinkingConfig(model) : getDisabledGoogleThinkingConfig(model);
@@ -308,7 +314,8 @@ function buildGoogleGenerateContentParams(model, context, options = {}, configHo
308
314
  function buildGoogleSimpleThinking(model, options, config) {
309
315
  if (!options?.reasoning || options.reasoning === "off") return { enabled: false };
310
316
  const clampedReasoning = clampThinkingLevel(model, options.reasoning);
311
- const effort = clampedReasoning === "off" || clampedReasoning === "max" ? "high" : clampedReasoning;
317
+ if (clampedReasoning === "off") return { enabled: false };
318
+ const effort = clampedReasoning === "max" ? "high" : clampedReasoning;
312
319
  if (isGemini3ProModel(model) || isGemini3FlashModel(model) || config?.includeGemma4ThinkingLevel && isGemma4Model(model)) return {
313
320
  enabled: true,
314
321
  level: getGoogleThinkingLevel(effort, model, { includeGemma4: config?.includeGemma4ThinkingLevel })
@@ -319,12 +326,12 @@ function buildGoogleSimpleThinking(model, options, config) {
319
326
  };
320
327
  }
321
328
  function getDisabledGoogleThinkingConfig(model, config) {
322
- const mapThinkingLevel = (level) => config?.mapThinkingLevel ? config.mapThinkingLevel(level) : level;
323
- if (isGemini3ProModel(model)) return { thinkingLevel: mapThinkingLevel("LOW") };
324
- if (isGemini3FlashModel(model)) return { thinkingLevel: mapThinkingLevel("MINIMAL") };
325
- if (config?.includeGemma4 && isGemma4Model(model)) return { thinkingLevel: mapThinkingLevel("MINIMAL") };
329
+ if (isGemini3ProModel(model)) return { thinkingLevel: ThinkingLevel.LOW };
330
+ if (isGemini3FlashModel(model)) return { thinkingLevel: ThinkingLevel.MINIMAL };
331
+ if (config?.includeGemma4 && isGemma4Model(model)) return { thinkingLevel: ThinkingLevel.MINIMAL };
326
332
  return { thinkingBudget: 0 };
327
333
  }
334
+ /** @internal Directly tested provider implementation detail. */
328
335
  function isGemma4Model(model) {
329
336
  return /gemma-?4/.test(model.id.toLowerCase());
330
337
  }
@@ -337,23 +344,23 @@ function isGemini3FlashModel(model) {
337
344
  function getGoogleThinkingLevel(effort, model, config) {
338
345
  if (isGemini3ProModel(model)) switch (effort) {
339
346
  case "minimal":
340
- case "low": return "LOW";
347
+ case "low": return ThinkingLevel.LOW;
341
348
  case "medium":
342
- case "high": return "HIGH";
349
+ case "high": return ThinkingLevel.HIGH;
343
350
  }
344
351
  if (config?.includeGemma4 && isGemma4Model(model)) switch (effort) {
345
352
  case "minimal":
346
- case "low": return "MINIMAL";
353
+ case "low": return ThinkingLevel.MINIMAL;
347
354
  case "medium":
348
- case "high": return "HIGH";
355
+ case "high": return ThinkingLevel.HIGH;
349
356
  }
350
357
  switch (effort) {
351
- case "minimal": return "MINIMAL";
352
- case "low": return "LOW";
353
- case "medium": return "MEDIUM";
354
- case "high": return "HIGH";
358
+ case "minimal": return ThinkingLevel.MINIMAL;
359
+ case "low": return ThinkingLevel.LOW;
360
+ case "medium": return ThinkingLevel.MEDIUM;
361
+ case "high": return ThinkingLevel.HIGH;
355
362
  }
356
- return "HIGH";
363
+ return ThinkingLevel.HIGH;
357
364
  }
358
365
  function getGoogleBudget(model, effort, customBudgets, config) {
359
366
  if (customBudgets?.[effort] !== void 0) return customBudgets[effort];
@@ -379,6 +386,7 @@ function getGoogleBudget(model, effort, customBudgets, config) {
379
386
  }
380
387
  /**
381
388
  * Map Gemini FinishReason to our StopReason.
389
+ * @internal Directly tested provider implementation detail.
382
390
  */
383
391
  function mapStopReason(reason) {
384
392
  switch (reason) {
@@ -402,6 +410,7 @@ function mapStopReason(reason) {
402
410
  default: throw new Error(`Unhandled stop reason: ${String(reason)}`);
403
411
  }
404
412
  }
413
+ /** @internal Directly tested provider implementation detail. */
405
414
  async function consumeGoogleGenerateContentStream(params) {
406
415
  params.stream.push({
407
416
  type: "start",
@@ -1,18 +1,11 @@
1
- import { t as AssistantMessageEventStream } from "./event-stream-ReMmOTzX.mjs";
1
+ import { t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
2
2
  import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-4t713IeR.mjs";
3
- import { o as buildBaseOptions } from "./transform-messages-BhGF_fF4.mjs";
4
- import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-ZPSl2qTi.mjs";
5
- import { GoogleGenAI, ResourceScope, ThinkingLevel } from "@google/genai";
3
+ import { s as buildBaseOptions } from "./transform-messages-DNWpwvXA.mjs";
4
+ import { a as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-C7ohrmOI.mjs";
5
+ import { GoogleGenAI, ResourceScope } from "@google/genai";
6
6
  //#region packages/ai/src/providers/google-vertex.ts
7
7
  const API_VERSION = "v1";
8
8
  const GCP_VERTEX_CREDENTIALS_MARKER = "gcp-vertex-credentials";
9
- const THINKING_LEVEL_MAP = {
10
- THINKING_LEVEL_UNSPECIFIED: ThinkingLevel.THINKING_LEVEL_UNSPECIFIED,
11
- MINIMAL: ThinkingLevel.MINIMAL,
12
- LOW: ThinkingLevel.LOW,
13
- MEDIUM: ThinkingLevel.MEDIUM,
14
- HIGH: ThinkingLevel.HIGH
15
- };
16
9
  let toolCallCounter = 0;
17
10
  const streamGoogleVertex = (model, context, options) => {
18
11
  const stream = new AssistantMessageEventStream();
@@ -99,13 +92,7 @@ function resolveLocation(options) {
99
92
  return location;
100
93
  }
101
94
  function buildParams(model, context, options = {}) {
102
- return buildGoogleGenerateContentParams(model, context, options, {
103
- mapThinkingLevel: mapVertexThinkingLevel,
104
- getDisabledThinkingConfig: (modelLocal) => getDisabledGoogleThinkingConfig(modelLocal, { mapThinkingLevel: mapVertexThinkingLevel })
105
- });
106
- }
107
- function mapVertexThinkingLevel(level) {
108
- return THINKING_LEVEL_MAP[level];
95
+ return buildGoogleGenerateContentParams(model, context, options);
109
96
  }
110
97
  //#endregion
111
98
  export { streamGoogleVertex, streamSimpleGoogleVertex };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, n as CLAUDE_SONNET_5_THINKING_PROFILE, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as supportsClaudeAdaptiveThinking } from "./index-BoTnz8cv.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-DRgdPqaZ.mjs";
4
- import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-0nZeBKl2.mjs";
5
- import { n as validateToolCall, t as validateToolArguments } from "./validation-BDMWOr8d.mjs";
6
- import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-BXYnCOIR.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-Cx2zJtyz.mjs";
4
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uQspnL8S.mjs";
5
+ import { n as validateToolCall, t as validateToolArguments } from "./validation-Cej7htKc.mjs";
6
+ import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-Byvoz8Ha.mjs";
7
7
 
8
8
  //#region packages/ai/src/host.d.ts
9
9
  /** Strict-tool policy inputs for OpenAI-compatible routes. */
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, n as CLAUDE_SONNET_5_THINKING_PROFILE, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as supportsClaudeAdaptiveThinking } from "./src-CZ503MYJ.mjs";
1
+ import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, n as CLAUDE_SONNET_5_THINKING_PROFILE, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as supportsClaudeAdaptiveThinking } from "./src-CXno1H5g.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-ReMmOTzX.mjs";
4
- import { n as validateToolCall, t as validateToolArguments } from "./validation-FrchoOlv.mjs";
3
+ import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
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
6
  import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-4t713IeR.mjs";
7
7
  export { AssistantMessageEventStream, CLAUDE_FABLE_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, resolveClaudeSonnet5ModelIdentity, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
@@ -1,6 +1,6 @@
1
1
  import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "../index-BoTnz8cv.mjs";
2
2
  import { t as AssistantMessageDiagnostic } from "../diagnostics-BaTA9eVl.mjs";
3
- import { E as Model, F as SimpleStreamOptions, R as StreamFunction, u as Context, z as StreamOptions } from "../types-DRgdPqaZ.mjs";
3
+ import { E as Model, F as SimpleStreamOptions, R as StreamFunction, u as Context, z as StreamOptions } from "../types-Cx2zJtyz.mjs";
4
4
  import Anthropic from "@anthropic-ai/sdk";
5
5
 
6
6
  //#region packages/ai/src/providers/anthropic.d.ts
@@ -1,4 +1,4 @@
1
- import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "../src-CZ503MYJ.mjs";
2
- import { d as prepareClaudeSonnet5RequestContext, f as requiresClaudeAdaptiveThinking, h as usesClaudeStreamingRefusalContract, l as applyClaudeRequestContract, m as usesClaudeFable5MessagesContract, p as resolveModelBoundThinkingReplayMode, u as defaultsClaudeAdaptiveThinking } from "../transform-messages-BhGF_fF4.mjs";
3
- import { _ as readAnthropicFallbackBoundary, a as readAnthropicUsageTokenCount, b as usesFoundryBearerAuth, c as reconcileAnthropicToolChoice, d as findActiveAnthropicToolTurnAssistantIndex, f as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, g as buildAnthropicServerSideFallbacks, h as applyAnthropicFallbackBoundary, i as readAnthropicPromptUsageSnapshot, l as resolveOriginalAnthropicToolName, m as CLAUDE_FABLE_5_FALLBACK_MODEL_COST, n as streamAnthropic, o as readLastAnthropicIterationUsage, p as CLAUDE_FABLE_5_FALLBACK_MODEL, r as streamSimpleAnthropic, s as projectAnthropicTools, u as ANTHROPIC_OMITTED_REASONING_TEXT, v as applyAnthropicRefusal, y as omitFoundryBearerCredentialHeaders } from "../anthropic-B5gZQM5X.mjs";
1
+ import { a as resolveClaudeFable5ModelIdentity, c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, i as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeSonnet5ModelIdentity, o as resolveClaudeModelIdentity, r as requiresClaudeDefaultSampling, s as resolveClaudeMythos5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "../src-CXno1H5g.mjs";
2
+ import { d as defaultsClaudeAdaptiveThinking, f as prepareClaudeSonnet5RequestContext, g as usesClaudeStreamingRefusalContract, h as usesClaudeFable5MessagesContract, m as resolveModelBoundThinkingReplayMode, p as requiresClaudeAdaptiveThinking, u as applyClaudeRequestContract } from "../transform-messages-DNWpwvXA.mjs";
3
+ import { _ as readAnthropicFallbackBoundary, a as readAnthropicUsageTokenCount, b as usesFoundryBearerAuth, c as reconcileAnthropicToolChoice, d as findActiveAnthropicToolTurnAssistantIndex, f as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, g as buildAnthropicServerSideFallbacks, h as applyAnthropicFallbackBoundary, i as readAnthropicPromptUsageSnapshot, l as resolveOriginalAnthropicToolName, m as CLAUDE_FABLE_5_FALLBACK_MODEL_COST, n as streamAnthropic, o as readLastAnthropicIterationUsage, p as CLAUDE_FABLE_5_FALLBACK_MODEL, r as streamSimpleAnthropic, s as projectAnthropicTools, u as ANTHROPIC_OMITTED_REASONING_TEXT, v as applyAnthropicRefusal, y as omitFoundryBearerCredentialHeaders } from "../anthropic-Cvm71xlk.mjs";
4
4
  export { ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_FABLE_5_FALLBACK_MODEL, CLAUDE_FABLE_5_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicRefusal, applyClaudeRequestContract, buildAnthropicServerSideFallbacks, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, omitFoundryBearerCredentialHeaders, prepareClaudeSonnet5RequestContext, projectAnthropicTools, readAnthropicFallbackBoundary, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
@@ -1,4 +1,4 @@
1
- import { E as Model, F as SimpleStreamOptions, I as StopReason, O as OpenAICompletionsCompat, R as StreamFunction, u as Context, z as StreamOptions } from "../types-DRgdPqaZ.mjs";
1
+ import { E as Model, F as SimpleStreamOptions, I as StopReason, O as OpenAICompletionsCompat, R as StreamFunction, u as Context, z as StreamOptions } from "../types-Cx2zJtyz.mjs";
2
2
  import OpenAI from "openai";
3
3
  import { TSchema } from "typebox";
4
4
  import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
@@ -38,7 +38,13 @@ declare function normalizeToolParameterSchema(schema: unknown, options?: ToolPar
38
38
  //#region packages/ai/src/providers/azure-deployment-map.d.ts
39
39
  /** Parses AZURE_OPENAI_DEPLOYMENT_MAP-style model=deployment entries. */
40
40
  declare function parseAzureDeploymentNameMap(value: string | undefined): Map<string, string>;
41
- /** Resolves the Azure deployment name for a model id, falling back to the model id. */
41
+ /**
42
+ * Resolves the Azure deployment name for a model id, falling back to the model id.
43
+ *
44
+ * An exact-case match always wins, so configs that intentionally distinguish keys by
45
+ * case keep their exact mappings; a case-insensitive match is only used as a fallback
46
+ * (e.g. `GPT-4o` against a `gpt-4o=...` map) to avoid 404s from casing differences.
47
+ */
42
48
  declare function resolveAzureDeploymentNameFromMap(params: {
43
49
  modelId: string;
44
50
  deploymentMap?: string;
@@ -128,6 +134,11 @@ declare function isOpenAIGpt56Model(model: OpenAIReasoningModel): boolean;
128
134
  declare function normalizeOpenAIReasoningEffort(effort: string): string;
129
135
  /** Resolve the reasoning efforts accepted by a specific OpenAI-compatible model. */
130
136
  declare function resolveOpenAISupportedReasoningEfforts(model: OpenAIReasoningModel): readonly OpenAIApiReasoningEffort[];
137
+ /**
138
+ * Return whether a model accepts the temperature parameter. The GPT-5.6
139
+ * family rejects it with a 400; catalog compat can override per model.
140
+ */
141
+ declare function supportsOpenAITemperature(model: OpenAIReasoningModel): boolean;
131
142
  /** Return whether a model accepts a requested reasoning effort. */
132
143
  declare function supportsOpenAIReasoningEffort(model: OpenAIReasoningModel, effort: string): boolean;
133
144
  /** Resolve a requested reasoning effort to the closest value supported by the model. */
@@ -241,4 +252,4 @@ type RuntimeToolInputSchemaProjection = {
241
252
  /** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
242
253
  declare function projectRuntimeToolInputSchema(schema: unknown, path?: string): RuntimeToolInputSchemaProjection;
243
254
  //#endregion
244
- export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, AzureResponsesTextContentPart, AzureResponsesTextDeltaEvent, GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, OpenAIApiReasoningEffort, OpenAICompletionsOptions, OpenAICompletionsToolChoice, OpenAIReasoningEffort, OpenAIResponsesOptions, OpenAIStopReasonResult, OpenAIToolProjection, ResponsesMessageSnapshotCollapse, ResponsesTextContentPartType, ResponsesTextDeltaEventType, RuntimeToolInputSchemaJson, RuntimeToolInputSchemaProjection, ToolParameterSchemaOptions, ToolSchemaModelCompat, clampOpenAIPromptCacheKey, cleanSchemaForGemini, clearOpenAIToolSchemaCacheForTest, convertMessages, extractToolSchemaModelCompat, findOpenAIStrictToolProjectionDiagnostics, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isStrictOpenAIJsonSchemaCompatible, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, normalizeOpenAIReasoningEffort, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, parseAzureDeploymentNameMap, projectOpenAITools, projectRuntimeToolInputSchema, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIProjectedToolsStrictToolFlag, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, stripUnsupportedSchemaKeywords, supportsOpenAIReasoningEffort };
255
+ export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, AzureResponsesTextContentPart, AzureResponsesTextDeltaEvent, GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, OpenAIApiReasoningEffort, OpenAICompletionsOptions, OpenAICompletionsToolChoice, OpenAIReasoningEffort, OpenAIResponsesOptions, OpenAIStopReasonResult, OpenAIToolProjection, ResponsesMessageSnapshotCollapse, ResponsesTextContentPartType, ResponsesTextDeltaEventType, RuntimeToolInputSchemaJson, RuntimeToolInputSchemaProjection, ToolParameterSchemaOptions, ToolSchemaModelCompat, clampOpenAIPromptCacheKey, cleanSchemaForGemini, clearOpenAIToolSchemaCacheForTest, convertMessages, extractToolSchemaModelCompat, findOpenAIStrictToolProjectionDiagnostics, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isStrictOpenAIJsonSchemaCompatible, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, normalizeOpenAIReasoningEffort, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, parseAzureDeploymentNameMap, projectOpenAITools, projectRuntimeToolInputSchema, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIProjectedToolsStrictToolFlag, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, stripUnsupportedSchemaKeywords, supportsOpenAIReasoningEffort, supportsOpenAITemperature };