@openclaw/ai 2026.7.1 → 2026.7.2-beta.2
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.
- package/dist/{anthropic-B5gZQM5X.mjs → anthropic-BIRSg5x9.mjs} +23 -101
- package/dist/{api-registry-BXYnCOIR.d.mts → api-registry-Byvoz8Ha.d.mts} +1 -1
- package/dist/{azure-openai-responses-DNoSk8Uy.mjs → azure-openai-responses-CHi7Wo4A.mjs} +6 -6
- package/dist/{azure-openai-responses-client-compat-a_O_GVQV.mjs → azure-openai-responses-client-compat-C7K7QfUE.mjs} +23 -2
- package/dist/{env-api-keys-CtMlqaQ4.mjs → env-api-keys-DnhYpc27.mjs} +4 -3
- package/dist/{event-stream-ReMmOTzX.mjs → event-stream-D8n2uFee.mjs} +14 -6
- package/dist/{event-stream-0nZeBKl2.d.mts → event-stream-uQspnL8S.d.mts} +1 -1
- package/dist/event-stream.d.mts +1 -1
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-D6sIQ1bL.mjs → google-BmsqsNwR.mjs} +4 -4
- package/dist/{google-shared-ZPSl2qTi.mjs → google-shared-Dx2aba47.mjs} +30 -21
- package/dist/{google-vertex-rDGwkoZK.mjs → google-vertex-HZ_0rTwS.mjs} +5 -18
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/internal/anthropic.d.mts +1 -1
- package/dist/internal/anthropic.mjs +3 -3
- package/dist/internal/openai.d.mts +38 -3
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/retry-after.d.mts +5 -0
- package/dist/internal/retry-after.mjs +101 -0
- package/dist/internal/runtime.d.mts +2 -2
- package/dist/internal/runtime.mjs +6 -5
- package/dist/internal/shared.d.mts +12 -2
- package/dist/internal/shared.mjs +2 -2
- package/dist/{json-parse-DzNSIQBq.mjs → json-parse-BvXNt1-7.mjs} +4 -6
- package/dist/{mistral-CePVNdws.mjs → mistral-DxMPt9q9.mjs} +116 -33
- package/dist/{model-utils-DgmOla96.mjs → model-utils-Q1LSRIdo.mjs} +5 -12
- package/dist/{openai-chatgpt-responses-DVC4Bk_A.mjs → openai-chatgpt-responses-BuH2NvsR.mjs} +40 -96
- package/dist/{openai-completions-B9QLIq2U.mjs → openai-completions-DPR_O2RW.mjs} +28 -28
- package/dist/{openai-responses-B6LylGxM.mjs → openai-responses-Cov-Vdc2.mjs} +6 -6
- package/dist/{openai-responses-shared-sj2YUPYc.mjs → openai-responses-shared-Befb4D6R.mjs} +240 -51
- package/dist/{openai-tool-projection-BknoV11q.mjs → openai-tool-projection-CFqm42J2.mjs} +8 -3
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-axhAdUwg.mjs → reasoning-tag-text-partitioner-BlVe67g6.mjs} +14 -8
- package/dist/{src-CZ503MYJ.mjs → src-CXno1H5g.mjs} +1 -1
- package/dist/{tool-schema-json-projection-BXtBc_mD.mjs → tool-schema-json-projection-BwNu3nDi.mjs} +22 -2
- package/dist/{transform-messages-BhGF_fF4.mjs → transform-messages-BmS70CP5.mjs} +12 -3
- package/dist/{types-DRgdPqaZ.d.mts → types-Cx2zJtyz.d.mts} +5 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +3 -3
- package/dist/{validation-BDMWOr8d.d.mts → validation-Cej7htKc.d.mts} +1 -1
- package/dist/{validation-FrchoOlv.mjs → validation-DAa_yFOM.mjs} +2 -7
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-
|
|
2
|
-
import { c as resolveClaudeNativeThinkingLevelMap, d as supportsClaudeNativeMaxEffort, f as supportsClaudeNativeXhighEffort, l as resolveClaudeSonnet5ModelIdentity, u as supportsClaudeAdaptiveThinking } from "./src-
|
|
3
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
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-
|
|
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-
|
|
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 {
|
|
11
|
-
import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
10
|
+
import { C as stripSystemPromptCacheBoundary, S as splitSystemPromptCacheBoundary, _ as usesClaudeFable5MessagesContract, c as adjustMaxTokensForThinking, d as isRecord, f as applyClaudeRequestContract, h as requiresClaudeAdaptiveThinking, i as extractToolResultText, l as buildBaseOptions, m as prepareClaudeSonnet5RequestContext, n as describeToolResultMediaPlaceholder, o as isImageWithMediaPayload, r as extractToolResultBlockText, t as transformMessages, v as usesClaudeStreamingRefusalContract } from "./transform-messages-BmS70CP5.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));
|
|
@@ -373,13 +374,13 @@ const toClaudeCodeName = (name) => ccToolLookup.get(name.toLowerCase()) ?? name;
|
|
|
373
374
|
function convertContentBlocks(content, isError) {
|
|
374
375
|
const text = extractToolResultText(content);
|
|
375
376
|
const mediaPlaceholder = describeToolResultMediaPlaceholder(content);
|
|
376
|
-
if (!
|
|
377
|
+
if (!content.some(isImageWithMediaPayload)) {
|
|
377
378
|
const sanitized = sanitizeSurrogates(text);
|
|
378
379
|
return sanitized.trim().length > 0 ? sanitized : mediaPlaceholder ?? (isError ? EMPTY_ERROR_TOOL_RESULT_TEXT : "");
|
|
379
380
|
}
|
|
380
381
|
const blocks = [];
|
|
381
382
|
let hasTextBlock = false;
|
|
382
|
-
for (const block of
|
|
383
|
+
for (const block of content) {
|
|
383
384
|
if (!block || typeof block !== "object") continue;
|
|
384
385
|
const record = block;
|
|
385
386
|
const blockText = extractToolResultBlockText(block);
|
|
@@ -390,13 +391,13 @@ function convertContentBlocks(content, isError) {
|
|
|
390
391
|
});
|
|
391
392
|
hasTextBlock = true;
|
|
392
393
|
}
|
|
393
|
-
if (record
|
|
394
|
+
if (!isImageWithMediaPayload(record)) continue;
|
|
394
395
|
blocks.push({
|
|
395
396
|
type: "image",
|
|
396
397
|
source: {
|
|
397
398
|
type: "base64",
|
|
398
399
|
media_type: typeof record.mimeType === "string" ? record.mimeType : "image/jpeg",
|
|
399
|
-
data:
|
|
400
|
+
data: record.data
|
|
400
401
|
}
|
|
401
402
|
});
|
|
402
403
|
}
|
|
@@ -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
|
|
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
|
|
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,
|
|
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 (
|
|
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
|
|
1243
|
-
const nextMsg = transformedMessages
|
|
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-
|
|
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-
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
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 {
|
|
5
|
-
import { a as resolveResponsesReasoningEffort, n as convertResponsesMessages, o as runResponsesStreamLifecycle, r as createResponsesAssistantOutput, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
6
|
-
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-
|
|
7
|
-
import { a as clampOpenAIPromptCacheKey } from "./openai-tool-projection-
|
|
4
|
+
import { l as buildBaseOptions } from "./transform-messages-BmS70CP5.mjs";
|
|
5
|
+
import { a as resolveResponsesReasoningEffort, n as convertResponsesMessages, o as runResponsesStreamLifecycle, r as createResponsesAssistantOutput, t as applyCommonResponsesParams } from "./openai-responses-shared-Befb4D6R.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-CFqm42J2.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
|
-
|
|
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
|
-
|
|
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
|
|
74
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
31
|
-
|
|
32
|
-
|
|
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)
|
|
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-
|
|
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. */
|
package/dist/event-stream.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uQspnL8S.mjs";
|
|
2
2
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
package/dist/event-stream.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
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-
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
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 {
|
|
5
|
-
import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
4
|
+
import { l as buildBaseOptions } from "./transform-messages-BmS70CP5.mjs";
|
|
5
|
+
import { a as runGoogleGenerateContentLifecycle, i as getDisabledGoogleThinkingConfig, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Dx2aba47.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-
|
|
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 {
|
|
4
|
-
import { FinishReason, FunctionCallingConfigMode } from "@google/genai";
|
|
3
|
+
import { C as stripSystemPromptCacheBoundary, i as extractToolResultText, n as describeToolResultMediaPlaceholder, o as isImageWithMediaPayload, t as transformMessages } from "./transform-messages-BmS70CP5.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(
|
|
61
|
+
const match = modelId.toLowerCase().match(/(?:^|\/)gemini(?:-live)?-(\d+)/);
|
|
60
62
|
if (!match) return;
|
|
61
|
-
|
|
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 = [];
|
|
@@ -141,7 +145,7 @@ function convertMessages(model, context) {
|
|
|
141
145
|
});
|
|
142
146
|
} else if (msg.role === "toolResult") {
|
|
143
147
|
const textResult = extractToolResultText(msg.content);
|
|
144
|
-
const imageContent = model.input.includes("image") ? msg.content.filter(
|
|
148
|
+
const imageContent = model.input.includes("image") ? msg.content.filter(isImageWithMediaPayload) : [];
|
|
145
149
|
const hasText = textResult.length > 0;
|
|
146
150
|
const hasImages = imageContent.length > 0;
|
|
147
151
|
const mediaPlaceholder = describeToolResultMediaPlaceholder(msg.content);
|
|
@@ -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 =
|
|
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
|
-
|
|
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
|
-
|
|
323
|
-
if (
|
|
324
|
-
if (
|
|
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
|
|
347
|
+
case "low": return ThinkingLevel.LOW;
|
|
341
348
|
case "medium":
|
|
342
|
-
case "high": return
|
|
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
|
|
353
|
+
case "low": return ThinkingLevel.MINIMAL;
|
|
347
354
|
case "medium":
|
|
348
|
-
case "high": return
|
|
355
|
+
case "high": return ThinkingLevel.HIGH;
|
|
349
356
|
}
|
|
350
357
|
switch (effort) {
|
|
351
|
-
case "minimal": return
|
|
352
|
-
case "low": return
|
|
353
|
-
case "medium": return
|
|
354
|
-
case "high": return
|
|
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
|
|
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-
|
|
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 {
|
|
4
|
-
import { a as runGoogleGenerateContentLifecycle,
|
|
5
|
-
import { GoogleGenAI, ResourceScope
|
|
3
|
+
import { l as buildBaseOptions } from "./transform-messages-BmS70CP5.mjs";
|
|
4
|
+
import { a as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-Dx2aba47.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-
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-
|
|
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-
|
|
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-
|
|
4
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
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-
|
|
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-
|
|
2
|
-
import {
|
|
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-
|
|
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 { _ as usesClaudeFable5MessagesContract, f as applyClaudeRequestContract, g as resolveModelBoundThinkingReplayMode, h as requiresClaudeAdaptiveThinking, m as prepareClaudeSonnet5RequestContext, p as defaultsClaudeAdaptiveThinking, v as usesClaudeStreamingRefusalContract } from "../transform-messages-BmS70CP5.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-BIRSg5x9.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 };
|