@openclaw/ai 2026.9.8 → 2026.10.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/{anthropic-CTXJlfnS.mjs → anthropic-CZv6XFER.mjs} +52 -147
- package/dist/{anthropic-payload-policy-NIPVYXPq.d.mts → anthropic-payload-policy-BhCcgNdm.d.mts} +7 -4
- package/dist/{anthropic-stream-reducer-DrsBCsFY.mjs → anthropic-stream-reducer-BQ1tjd7x.mjs} +369 -233
- package/dist/{api-registry-D-nbmSqr.d.mts → api-registry-DpU0Rj-I.d.mts} +4 -4
- package/dist/{provider-transcript-transform-DjA5Fk2P.mjs → assistant-output-OLm-Oln0.mjs} +17 -17
- package/dist/{assistant-text-phase-C20rxWwP.mjs → assistant-text-phase-Bl1aDCB7.mjs} +2 -8
- package/dist/{azure-openai-responses-BBxv4QVI.mjs → azure-openai-responses-DH7bd3QT.mjs} +12 -17
- package/dist/{azure-openai-responses-client-compat-C7K7QfUE.mjs → azure-openai-responses-client-compat-D0dvJMbZ.mjs} +3 -10
- package/dist/{base64-C1PsYcRQ.mjs → base64-C8CdcsjU.mjs} +3 -45
- package/dist/cloudflare-5qSGvIUH.mjs +39 -0
- package/dist/{diagnostics-CJaB6g8J.mjs → diagnostics-Caj-4RBA.mjs} +19 -37
- package/dist/diagnostics.d.mts +4 -4
- package/dist/diagnostics.mjs +2 -2
- package/dist/{event-stream-vd9UnCAU.mjs → event-stream-C5AbCAaZ.mjs} +29 -1
- package/dist/event-stream-DqDQWqiy.d.mts +1 -0
- package/dist/{event-stream-DOPFYVqs.d.mts → event-stream-DrRM_90c.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{github-copilot-request-facts-BTEBMeOv.mjs → github-copilot-request-facts-DEE6gcB9.mjs} +3 -1
- package/dist/{google-B3HEK0Ag.mjs → google-1WLOtb8w.mjs} +12 -9
- package/dist/{google-interactions-vMlEfPAA.mjs → google-interactions-wrnE6MLw.mjs} +39 -49
- package/dist/{google-messages-Dz2dAnGo.mjs → google-messages-BwPPycw6.mjs} +11 -17
- package/dist/{google-shared-B58i3c8H.mjs → google-shared-Eql1OMPU.mjs} +5 -6
- package/dist/{google-vertex-DYFXzEbh.mjs → google-vertex-0LrlRoO3.mjs} +11 -11
- package/dist/{host-rxlNaBwm.d.mts → host-BinBeGcQ.d.mts} +12 -4
- package/dist/{host-DwBmNMCC.mjs → host-DCW52iHe.mjs} +57 -9
- package/dist/{host-policy-wK-ay_RK.mjs → host-policy-B3jc4Rpn.mjs} +9 -2
- package/dist/{index-D6KsSE74.d.mts → index-a8e_oKnu.d.mts} +7 -5
- package/dist/index.d.mts +23 -7
- package/dist/index.mjs +7 -7
- package/dist/internal/anthropic.d.mts +6 -6
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/google-model-family.mjs +1 -1
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +14 -10
- package/dist/internal/openai.mjs +12 -12
- package/dist/internal/runtime.d.mts +18 -9
- package/dist/internal/runtime.mjs +9 -9
- package/dist/internal/shared.d.mts +6 -4
- package/dist/internal/shared.mjs +6 -6
- package/dist/internal/tool-schema.mjs +1 -1
- package/dist/json-schema-Bp07Qui3.mjs +22 -0
- package/dist/{llm-request-activity-BjtkplhG.mjs → llm-request-activity-D8f_oxHj.mjs} +1 -2
- package/dist/{mistral-7wDWcjfF.mjs → mistral-DSt4vQAO.mjs} +18 -29
- package/dist/number-coercion-V8-BhME4.mjs +47 -0
- package/dist/{openai-chatgpt-responses-Bc7NZrQR.mjs → openai-chatgpt-responses-BC2x0Oqx.mjs} +215 -164
- package/dist/openai-completions-DNyHnXKg.mjs +25 -0
- package/dist/{openai-completions-compat-qJjmqQ71.d.mts → openai-completions-compat-BYdYpXhU.d.mts} +3 -3
- package/dist/{openai-completions-compat-BJf57ZxN.mjs → openai-completions-compat-BdmlhD4u.mjs} +30 -23
- package/dist/{openai-completions-stream-dju_5F3P.mjs → openai-completions-transport-DWM2mQDB.mjs} +389 -76
- package/dist/{openai-prompt-cache-CouErLh7.d.mts → openai-prompt-cache-45-AH_xv.d.mts} +2 -2
- package/dist/{openai-prompt-cache-BTMs80_O.mjs → openai-prompt-cache-I8YQTzf8.mjs} +1 -1
- package/dist/{openai-responses-compaction-replay-DiYn-gFM.d.mts → openai-responses-compaction-replay-BClApUIf.d.mts} +4 -4
- package/dist/{openai-responses-compaction-window-CYGCjAQz.mjs → openai-responses-compaction-window-m878aVpU.mjs} +25 -83
- package/dist/{openai-reasoning-effort-C_0p3psG.mjs → openai-responses-contracts-BKu8O7l4.mjs} +103 -4
- package/dist/{openai-responses-contracts-D1iZ0njF.d.mts → openai-responses-contracts-Br5IIw_h.d.mts} +16 -5
- package/dist/openai-responses-prompt-observer-internal-CCg7B6l4.mjs +32 -0
- package/dist/{openai-responses-shared-CIEHiKx7.mjs → openai-responses-shared-C7oVyjED.mjs} +297 -312
- package/dist/{openai-responses-terminal-usage-BE7lf7nW.d.mts → openai-responses-terminal-usage-DgImcyJu.d.mts} +2 -2
- package/dist/{openai-responses-DbPe3-Py.mjs → openai-responses-uZ5oWSp7.mjs} +12 -21
- package/dist/{openai-tool-schema-vsl-cE-n.mjs → openai-tool-schema-DYNePiF8.mjs} +66 -36
- package/dist/{openai-transport-params-DyFJ4cgR.mjs → openai-transport-params-JFsnIyto.mjs} +25 -30
- package/dist/openai-web-search-tools-Cfu0uLyN.mjs +14 -0
- package/dist/{positive-integer-CjN5OJbH.mjs → positive-integer-CwLi8LUL.mjs} +1 -1
- package/dist/{provider-error-CwT_j2v0.mjs → provider-error-DQBE1bUQ.mjs} +17 -28
- package/dist/{provider-options-Df7ov0K1.d.mts → provider-options-D5ABCV_l.d.mts} +2 -2
- package/dist/{provider-replay-context-Bs5aWE1d.mjs → provider-replay-context-C7Bmi84a.mjs} +6 -2
- package/dist/{provider-transport-turn-state-Dw7OtYUs.mjs → provider-transport-turn-state-_M2kLdUE.mjs} +25 -3
- package/dist/{provider-types-d4XnoZMd.d.mts → provider-types-F8Mqc9Ma.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +14 -26
- package/dist/{reasoning-tag-text-partitioner-B6FIIBt6.mjs → reasoning-tag-text-partitioner-Ju9VpUGl.mjs} +23 -37
- package/dist/required-api-key-D4kn3252.mjs +9 -0
- package/dist/sanitize-unicode-CjDG6jJx.d.mts +5 -0
- package/dist/{session-affinity-Bcunsn4I.mjs → session-affinity-DA4WHv1h.mjs} +2 -6
- package/dist/session-resources-D1wgDQ8C.mjs +40 -0
- package/dist/{simple-options-BkDPMuxw.mjs → simple-options-BkKTXxhp.mjs} +7 -11
- package/dist/{src-H4aXcFuX.mjs → src-B0NIt2UK.mjs} +7 -4
- package/dist/stream-DSdzKsDK.mjs +275 -0
- package/dist/{stream-first-event-timeout-B9o0S4SZ.mjs → stream-first-event-timeout-D9ZmL_s9.mjs} +3 -3
- package/dist/{string-coerce-fsri9iCu.mjs → string-coerce-CtgOVOSv.mjs} +5 -1
- package/dist/{string-normalization-J9ZiLfGO.mjs → string-normalization-PN10hf6d.mjs} +1 -1
- package/dist/{transport-utils-CqXzku3R.mjs → text-signature-MLwfi6fq.mjs} +18 -18
- package/dist/{transport-stream-shared-yYhXa4kX.d.mts → transport-stream-shared-BcAKh2XH.d.mts} +6 -19
- package/dist/{transport-stream-shared-BU5pwY6W.mjs → transport-stream-shared-CxXXz_Dd.mjs} +171 -56
- package/dist/transports.d.mts +22 -23
- package/dist/transports.mjs +251 -495
- package/dist/types-BuiEBM3u.d.mts +1 -0
- package/dist/types-CQc6JNG4.mjs +69 -0
- package/dist/{types-CLLR3eB4.d.mts → types-DvzmWW8J.d.mts} +58 -6
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +5 -5
- package/dist/usage-CJH5D6Ea.mjs +19 -0
- package/dist/{validation-Cat2wQsc.d.mts → validation-B3lQt_VE.d.mts} +1 -1
- package/dist/{validation-BFZc40Ig.mjs → validation-DbqlIfDn.mjs} +15 -30
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +4 -4
- package/dist/cache-retention-0x979a5V.mjs +0 -12
- package/dist/event-stream-CMQfX_yr.d.mts +0 -1
- package/dist/github-copilot-headers-B37TB3rB.mjs +0 -30
- package/dist/openai-completions-CHnwIV-W.mjs +0 -188
- package/dist/openai-provider-client-G8Otsq2Q.mjs +0 -24
- package/dist/openai-responses-contracts-CLxnqS9p.mjs +0 -81
- package/dist/openai-responses-prompt-observer-internal-BX3QTNSv.mjs +0 -198
- package/dist/sanitize-unicode-BZiVbGwK.d.mts +0 -24
- package/dist/session-resources-CkR4WWy1.mjs +0 -21
- package/dist/stream-DDsCBgd-.mjs +0 -68
- package/dist/types-CB-_vNyI.d.mts +0 -1
- package/dist/types-LFWwv0cF.mjs +0 -8
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
2
2
|
import { a as asRecord, i as asOptionalRecord, s as readStringField } from "./record-coerce-CNDovvft.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { t as buildGuardedModelFetch } from "./host-policy-
|
|
5
|
-
import { b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened,
|
|
6
|
-
import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-
|
|
3
|
+
import { O as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-DCW52iHe.mjs";
|
|
4
|
+
import { t as buildGuardedModelFetch } from "./host-policy-B3jc4Rpn.mjs";
|
|
5
|
+
import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-CxXXz_Dd.mjs";
|
|
6
|
+
import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-BkKTXxhp.mjs";
|
|
7
7
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as buildGoogleInteractionsSimpleThinking } from "./google-shared-
|
|
8
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-OLm-Oln0.mjs";
|
|
9
|
+
import { n as buildGoogleInteractionsSimpleThinking } from "./google-shared-Eql1OMPU.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
//#region packages/ai/src/providers/google-interactions-request.ts
|
|
12
12
|
const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com";
|
|
@@ -70,17 +70,11 @@ function convertMessages(model, context) {
|
|
|
70
70
|
const messages = transformProviderMessages(context.messages, model);
|
|
71
71
|
for (const message of messages) {
|
|
72
72
|
if (message.role === "user") {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
text: sanitizeSurrogates(message.content) || " "
|
|
79
|
-
}]
|
|
80
|
-
});
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const content = message.content.map((item) => item.type === "text" ? {
|
|
73
|
+
const sourceContent = message.content;
|
|
74
|
+
const content = (typeof sourceContent === "string" ? [{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: sourceContent
|
|
77
|
+
}] : sourceContent).map((item) => item.type === "text" ? {
|
|
84
78
|
type: "text",
|
|
85
79
|
text: sanitizeSurrogates(item.text) || " "
|
|
86
80
|
} : {
|
|
@@ -199,6 +193,9 @@ function logGoogleInteractionsDebug(message, data) {
|
|
|
199
193
|
data
|
|
200
194
|
}));
|
|
201
195
|
}
|
|
196
|
+
function joinTextParts(value) {
|
|
197
|
+
return Array.isArray(value) ? value.map((content) => readStringField(asOptionalRecord(content), "text") ?? "").join("") : "";
|
|
198
|
+
}
|
|
202
199
|
function isGoogleInteractionsRequestBody(value) {
|
|
203
200
|
const record = asOptionalRecord(value);
|
|
204
201
|
if (!record) return false;
|
|
@@ -343,6 +340,24 @@ async function runGoogleInteractionsLifecycle(params) {
|
|
|
343
340
|
});
|
|
344
341
|
return type;
|
|
345
342
|
};
|
|
343
|
+
const appendTextDelta = (type, text) => {
|
|
344
|
+
if (!text) return;
|
|
345
|
+
if (currentBlockType !== type) currentBlockType = startTextBlock(type);
|
|
346
|
+
const block = output.content[currentBlockIndex];
|
|
347
|
+
if (type === "text") {
|
|
348
|
+
if (block?.type !== "text") throw new Error("Google Interactions text delta has no active text block");
|
|
349
|
+
block.text += text;
|
|
350
|
+
} else {
|
|
351
|
+
if (block?.type !== "thinking") throw new Error("Google Interactions thought delta has no active thought block");
|
|
352
|
+
block.thinking += text;
|
|
353
|
+
}
|
|
354
|
+
stream.push({
|
|
355
|
+
type: type === "text" ? "text_delta" : "thinking_delta",
|
|
356
|
+
contentIndex: currentBlockIndex,
|
|
357
|
+
delta: text,
|
|
358
|
+
partial: output
|
|
359
|
+
});
|
|
360
|
+
};
|
|
346
361
|
const startToolCallBlock = (source, args = {}) => {
|
|
347
362
|
endCurrentBlock();
|
|
348
363
|
currentBlockIndex = output.content.length;
|
|
@@ -396,38 +411,14 @@ async function runGoogleInteractionsLifecycle(params) {
|
|
|
396
411
|
} else if (eventType === "step.delta") {
|
|
397
412
|
const delta = asOptionalRecord(event.delta);
|
|
398
413
|
const deltaType = delta?.type;
|
|
399
|
-
if (deltaType === "text")
|
|
400
|
-
|
|
401
|
-
if (text) {
|
|
402
|
-
if (currentBlockType !== "text") currentBlockType = startTextBlock("text");
|
|
403
|
-
const block = output.content[currentBlockIndex];
|
|
404
|
-
if (!block || block.type !== "text") throw new Error("Google Interactions text delta has no active text block");
|
|
405
|
-
block.text += text;
|
|
406
|
-
stream.push({
|
|
407
|
-
type: "text_delta",
|
|
408
|
-
contentIndex: currentBlockIndex,
|
|
409
|
-
delta: text,
|
|
410
|
-
partial: output
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
} else if (deltaType === "thought" || deltaType === "thought_summary" || deltaType === "raw_thought") {
|
|
414
|
+
if (deltaType === "text") appendTextDelta("text", readStringField(delta, "text") ?? "");
|
|
415
|
+
else if (deltaType === "thought" || deltaType === "thought_summary" || deltaType === "raw_thought") {
|
|
414
416
|
let thinkingText = "";
|
|
415
417
|
if (typeof delta?.text === "string") thinkingText = delta.text;
|
|
416
418
|
else if (typeof delta?.content === "string") thinkingText = delta.content;
|
|
417
|
-
else if (Array.isArray(delta?.content)) thinkingText = delta.content
|
|
419
|
+
else if (Array.isArray(delta?.content)) thinkingText = joinTextParts(delta.content);
|
|
418
420
|
else thinkingText = readStringField(asOptionalRecord(delta?.content), "text") ?? "";
|
|
419
|
-
|
|
420
|
-
if (currentBlockType !== "thinking") currentBlockType = startTextBlock("thinking");
|
|
421
|
-
const block = output.content[currentBlockIndex];
|
|
422
|
-
if (!block || block.type !== "thinking") throw new Error("Google Interactions thought delta has no active thought block");
|
|
423
|
-
block.thinking += thinkingText;
|
|
424
|
-
stream.push({
|
|
425
|
-
type: "thinking_delta",
|
|
426
|
-
contentIndex: currentBlockIndex,
|
|
427
|
-
delta: thinkingText,
|
|
428
|
-
partial: output
|
|
429
|
-
});
|
|
430
|
-
}
|
|
421
|
+
appendTextDelta("thinking", thinkingText);
|
|
431
422
|
} else if (deltaType === "thought_signature" || delta && typeof delta.signature === "string" && !delta.text) {
|
|
432
423
|
const signature = readStringField(delta, "signature") ?? "";
|
|
433
424
|
if (signature) {
|
|
@@ -468,10 +459,9 @@ async function runGoogleInteractionsLifecycle(params) {
|
|
|
468
459
|
if (step?.type === "thought") {
|
|
469
460
|
const stepSignature = readStringField(step, "signature");
|
|
470
461
|
if (stepSignature) latestThoughtSignature = stepSignature;
|
|
471
|
-
|
|
472
|
-
if (Array.isArray(step.summary)) initialThinking = step.summary.map((content) => readStringField(asOptionalRecord(content), "text") ?? "").join("");
|
|
462
|
+
const initialThinking = joinTextParts(step.summary);
|
|
473
463
|
if (currentBlockType !== "thinking") currentBlockType = startTextBlock("thinking", initialThinking);
|
|
474
|
-
} else if (step?.type === "model_output") currentBlockType = startTextBlock("text",
|
|
464
|
+
} else if (step?.type === "model_output") currentBlockType = startTextBlock("text", joinTextParts(step.content));
|
|
475
465
|
else if (step?.type === "function_call") {
|
|
476
466
|
currentToolCall = startToolCallBlock(step, asRecord(step.arguments));
|
|
477
467
|
currentBlockType = "toolCall";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as appendAssistantThinking } from "./event-stream-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText } from "./simple-options-
|
|
5
|
-
import { t as notifyLlmRequestActivity } from "./llm-request-activity-
|
|
1
|
+
import { r as appendAssistantThinking } from "./event-stream-C5AbCAaZ.mjs";
|
|
2
|
+
import { N as isImageWithMediaPayload, O as calculateCost } from "./host-DCW52iHe.mjs";
|
|
3
|
+
import { P as sanitizeSurrogates, a as createEmptyTransportUsage, b as transportAbortError, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-CxXXz_Dd.mjs";
|
|
4
|
+
import { D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText } from "./simple-options-BkKTXxhp.mjs";
|
|
5
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-D8f_oxHj.mjs";
|
|
6
6
|
//#region packages/ai/src/transports/google-thinking-level.ts
|
|
7
7
|
/** Returns whether a Gemini Flash model accepts the MINIMAL thinking level. */
|
|
8
8
|
function googleFlashSupportsMinimalThinking(modelId) {
|
|
@@ -268,16 +268,9 @@ function toolCallThoughtSignatureReplayKey(id, name, args) {
|
|
|
268
268
|
function requiresGoogleToolCallId(modelId) {
|
|
269
269
|
return modelId.startsWith("claude-") || modelId.startsWith("gpt-oss-");
|
|
270
270
|
}
|
|
271
|
-
function getGeminiMajorVersion(modelId) {
|
|
272
|
-
const match = modelId.toLowerCase().match(/(?:^|\/)gemini(?:-live)?-(\d+)/);
|
|
273
|
-
if (!match) return;
|
|
274
|
-
const majorVersion = match.at(1);
|
|
275
|
-
return majorVersion === void 0 ? void 0 : Number.parseInt(majorVersion, 10);
|
|
276
|
-
}
|
|
277
271
|
function supportsMultimodalFunctionResponse(modelId) {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
return true;
|
|
272
|
+
const majorVersion = modelId.toLowerCase().match(/(?:^|\/)gemini(?:-live)?-(\d+)/)?.at(1);
|
|
273
|
+
return majorVersion === void 0 || Number.parseInt(majorVersion, 10) >= 3;
|
|
281
274
|
}
|
|
282
275
|
/** Project a prepared transcript; route repair and trusted video admission remain caller-owned. */
|
|
283
276
|
function projectGoogleMessages(params) {
|
|
@@ -298,12 +291,13 @@ function projectGoogleMessages(params) {
|
|
|
298
291
|
for (const msg of transformedMessages) {
|
|
299
292
|
if (msg.role !== "toolResult") flushToolResultRun();
|
|
300
293
|
if (msg.role === "user") {
|
|
301
|
-
|
|
294
|
+
const sourceContent = msg.content;
|
|
295
|
+
if (typeof sourceContent === "string") contents.push({
|
|
302
296
|
role: "user",
|
|
303
|
-
parts: [{ text: sanitizeText(
|
|
297
|
+
parts: [{ text: sanitizeText(sourceContent) || " " }]
|
|
304
298
|
});
|
|
305
299
|
else {
|
|
306
|
-
const parts =
|
|
300
|
+
const parts = sourceContent.map((item) => {
|
|
307
301
|
if (item.type === "text") return { text: sanitizeText(item.text) || " " };
|
|
308
302
|
if (managed && item.type === "video") return params.videoPart?.(item) ?? { text: "(video omitted: native video slot unavailable)" };
|
|
309
303
|
return { inlineData: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened
|
|
3
|
-
import { C as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
4
|
-
import {
|
|
5
|
-
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-
|
|
1
|
+
import { k as clampThinkingLevel } from "./host-DCW52iHe.mjs";
|
|
2
|
+
import { P as sanitizeSurrogates, b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-CxXXz_Dd.mjs";
|
|
3
|
+
import { C as stripSystemPromptCacheBoundary } from "./simple-options-BkKTXxhp.mjs";
|
|
4
|
+
import { n as transformProviderMessages } from "./assistant-output-OLm-Oln0.mjs";
|
|
5
|
+
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-BwPPycw6.mjs";
|
|
6
6
|
import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google-shared.ts
|
|
8
8
|
function convertMessages(model, context) {
|
|
@@ -48,7 +48,6 @@ async function runGoogleGenerateContentLifecycle(params) {
|
|
|
48
48
|
nextToolCallId: params.nextToolCallId
|
|
49
49
|
});
|
|
50
50
|
} catch (error) {
|
|
51
|
-
for (const block of output.content) if ("index" in block) delete block.index;
|
|
52
51
|
const failure = options?.signal?.aborted ? transportAbortError(options.signal) : error;
|
|
53
52
|
failTransportStream({
|
|
54
53
|
stream,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
2
|
+
import { a as normalizeOptionalString } from "./string-coerce-CtgOVOSv.mjs";
|
|
3
|
+
import { a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-DCW52iHe.mjs";
|
|
4
|
+
import { n as buildManagedModelFetch } from "./host-policy-B3jc4Rpn.mjs";
|
|
5
|
+
import { n as buildBaseOptions } from "./simple-options-BkKTXxhp.mjs";
|
|
6
|
+
import { t as createAssistantOutput } from "./assistant-output-OLm-Oln0.mjs";
|
|
7
|
+
import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-Eql1OMPU.mjs";
|
|
7
8
|
import { GoogleGenAI, ResourceScope } from "@google/genai";
|
|
8
9
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
9
10
|
const API_VERSION = "v1";
|
|
@@ -45,6 +46,8 @@ function createClient(model, options) {
|
|
|
45
46
|
}
|
|
46
47
|
function buildHttpOptions(model, optionsHeaders) {
|
|
47
48
|
const httpOptions = {};
|
|
49
|
+
const fetcher = buildManagedModelFetch(model);
|
|
50
|
+
if (fetcher) httpOptions.fetch = fetcher;
|
|
48
51
|
const baseUrl = resolveCustomBaseUrl(model.baseUrl);
|
|
49
52
|
if (baseUrl) {
|
|
50
53
|
httpOptions.baseUrl = baseUrl;
|
|
@@ -63,11 +66,8 @@ function resolveCustomBaseUrl(baseUrl) {
|
|
|
63
66
|
return trimmed;
|
|
64
67
|
}
|
|
65
68
|
function baseUrlIncludesApiVersion(baseUrl) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} catch {
|
|
69
|
-
return /(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(baseUrl);
|
|
70
|
-
}
|
|
69
|
+
const url = URL.parse(baseUrl);
|
|
70
|
+
return url ? url.pathname.split("/").some((part) => /^v\d+(?:beta\d*)?$/.test(part)) : /(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(baseUrl);
|
|
71
71
|
}
|
|
72
72
|
function resolveApiKey(options) {
|
|
73
73
|
const apiKey = options?.apiKey?.trim() || process.env.GOOGLE_CLOUD_API_KEY?.trim();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import {
|
|
3
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import "./index-a8e_oKnu.mjs";
|
|
2
|
+
import { d as Context, et as StreamFn, k as Model, n as Api } from "./types-DvzmWW8J.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-DpU0Rj-I.mjs";
|
|
4
4
|
//#region packages/ai/src/host.d.ts
|
|
5
5
|
/** Provider capability facts needed by the package-owned transports. */
|
|
6
6
|
interface AiProviderRequestCapabilities {
|
|
@@ -178,6 +178,14 @@ interface AiTransportHost {
|
|
|
178
178
|
type ActiveAiTransportHost = Omit<AiTransportHost, "normalizeAnthropicInlineContentBlocks"> & {
|
|
179
179
|
normalizeAnthropicInlineContentBlocks: AnthropicInlineContentNormalizer;
|
|
180
180
|
};
|
|
181
|
+
/** Reports whether distinct host policy can survive asynchronous work. */
|
|
182
|
+
declare function supportsScopedAiTransportHosts(): boolean;
|
|
183
|
+
/** Resolves an explicit embedding policy without replacing the process default. */
|
|
184
|
+
declare function createAiTransportHost(host?: Partial<AiTransportHost>): ActiveAiTransportHost;
|
|
185
|
+
/** Provider operations retain their policy across lazy loads and asynchronous I/O. */
|
|
186
|
+
declare function runWithAiTransportHost<T>(host: ActiveAiTransportHost, run: () => T): T;
|
|
187
|
+
/** Installers must read the process default, never an unrelated operation's scoped policy. */
|
|
188
|
+
declare function getDefaultAiTransportHost(): ActiveAiTransportHost;
|
|
181
189
|
/** Installs host implementations for the transport policy ports. */
|
|
182
190
|
declare function configureAiTransportHost(host: Partial<AiTransportHost>): void;
|
|
183
191
|
/** Returns the active transport host (inert defaults unless configured). */
|
|
@@ -185,4 +193,4 @@ declare function getAiTransportHost(): ActiveAiTransportHost;
|
|
|
185
193
|
/** Resolves sentinel substrings in custom headers at a no-fetch adapter boundary. */
|
|
186
194
|
declare function resolveAiTransportHeaderSentinels(headers: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
187
195
|
//#endregion
|
|
188
|
-
export { AiProviderRequestPolicyInput as a, AiTransportHost as c, configureAiTransportHost as d,
|
|
196
|
+
export { supportsScopedAiTransportHosts as _, AiProviderRequestPolicyInput as a, AiTransportHost as c, configureAiTransportHost as d, createAiTransportHost as f, runWithAiTransportHost as g, resolveAiTransportHeaderSentinels as h, AiProviderRequestCapabilities as i, AiTransportPluginHost as l, getDefaultAiTransportHost as m, AiInlineImageBlock as n, AiProviderStreamHookContext as o, getAiTransportHost as p, AiInlineTextBlock as r, AiTransformTransportMessages as s, AiInlineContentBlock as t, OpenAIStrictToolSettingOptions as u };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as supportsClaudeNativeXhighEffort, T as supportsClaudeNativeMaxEffort, _ as resolveClaudeOpus55ModelIdentity, a as CLAUDE_OPUS_55_THINKING_PROFILE, b as resolveClaudeSonnet5ModelIdentity, d as requiresClaudeDefaultSampling, f as requiresClaudeMandatoryAdaptiveThinking, g as resolveClaudeNativeThinkingLevelMap, h as resolveClaudeMythos5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, p as resolveClaudeFable5ModelIdentity, s as CLAUDE_SONNET_55_THINKING_PROFILE, t as calculateUsageCost, v as resolveClaudeOpus5ModelIdentity, y as resolveClaudeSonnet55ModelIdentity } from "./src-B0NIt2UK.mjs";
|
|
2
|
+
import { t as DEFAULT_MISSING_TOOL_RESULT_TEXT } from "./types-CQc6JNG4.mjs";
|
|
2
3
|
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
3
|
-
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-
|
|
4
|
-
import {
|
|
4
|
+
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
|
|
5
|
+
import { A as resolveOpenAIThinkingApi, O as MODEL_CATALOG_THINKING_LEVELS, S as resolveOpenAIModelReasoningEfforts, i as OPENAI_RESPONSES_APIS, k as listMappedModelThinkingLevels } from "./openai-responses-contracts-BKu8O7l4.mjs";
|
|
5
6
|
//#region packages/ai/src/media-payload.ts
|
|
6
7
|
/** Media metadata alone is not an attachment; provider emitters need inline bytes. */
|
|
7
8
|
function hasMediaPayload(block) {
|
|
@@ -362,6 +363,7 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
362
363
|
}
|
|
363
364
|
const source = movedResults.size > 0 ? messages.flatMap((message) => movedResults.has(message) ? [] : [message, ...message.role === "assistant" ? relocated.get(message) ?? [] : []]) : messages;
|
|
364
365
|
const supportsImages = model.input.includes("image");
|
|
366
|
+
const missingResultText = OPENAI_RESPONSES_APIS.has(model.api) ? "aborted" : DEFAULT_MISSING_TOOL_RESULT_TEXT;
|
|
365
367
|
const result = [];
|
|
366
368
|
const pendingAsyncCalls = /* @__PURE__ */ new Map();
|
|
367
369
|
let pendingToolCalls = [];
|
|
@@ -373,8 +375,9 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
373
375
|
toolName: call.name,
|
|
374
376
|
content: [{
|
|
375
377
|
type: "text",
|
|
376
|
-
text:
|
|
378
|
+
text: missingResultText
|
|
377
379
|
}],
|
|
380
|
+
details: { openclawSyntheticMissingToolResult: true },
|
|
378
381
|
isError: true,
|
|
379
382
|
timestamp: Date.now()
|
|
380
383
|
});
|
|
@@ -487,9 +490,34 @@ const inertAiTransportHost = {
|
|
|
487
490
|
logWarn: () => {}
|
|
488
491
|
};
|
|
489
492
|
let activeAiTransportHost = inertAiTransportHost;
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
+
function createAiTransportHostScope() {
|
|
494
|
+
if (typeof process === "undefined") return;
|
|
495
|
+
const asyncHooks = process.getBuiltinModule?.("node:async_hooks");
|
|
496
|
+
return asyncHooks ? new asyncHooks.AsyncLocalStorage() : void 0;
|
|
497
|
+
}
|
|
498
|
+
const scopedAiTransportHost = createAiTransportHostScope();
|
|
499
|
+
let pendingUnscopedHost;
|
|
500
|
+
let pendingUnscopedOperations = 0;
|
|
501
|
+
function isPromiseLike(value) {
|
|
502
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof Reflect.get(value, "then") === "function";
|
|
503
|
+
}
|
|
504
|
+
function trackUnscopedOperation(host, result) {
|
|
505
|
+
if (!isPromiseLike(result)) return;
|
|
506
|
+
pendingUnscopedHost = host;
|
|
507
|
+
pendingUnscopedOperations += 1;
|
|
508
|
+
const release = () => {
|
|
509
|
+
pendingUnscopedOperations -= 1;
|
|
510
|
+
if (pendingUnscopedOperations === 0) pendingUnscopedHost = void 0;
|
|
511
|
+
};
|
|
512
|
+
Promise.resolve(result).then(release, release);
|
|
513
|
+
}
|
|
514
|
+
/** Reports whether distinct host policy can survive asynchronous work. */
|
|
515
|
+
function supportsScopedAiTransportHosts() {
|
|
516
|
+
return scopedAiTransportHost !== void 0;
|
|
517
|
+
}
|
|
518
|
+
/** Resolves an explicit embedding policy without replacing the process default. */
|
|
519
|
+
function createAiTransportHost(host = {}) {
|
|
520
|
+
return {
|
|
493
521
|
...inertAiTransportHost,
|
|
494
522
|
...host,
|
|
495
523
|
normalizeAnthropicInlineContentBlocks: host.normalizeAnthropicInlineContentBlocks ?? inertAiTransportHost.normalizeAnthropicInlineContentBlocks,
|
|
@@ -498,6 +526,26 @@ function configureAiTransportHost(host) {
|
|
|
498
526
|
...host.plugin
|
|
499
527
|
}
|
|
500
528
|
};
|
|
529
|
+
}
|
|
530
|
+
/** Provider operations retain their policy across lazy loads and asynchronous I/O. */
|
|
531
|
+
function runWithAiTransportHost(host, run) {
|
|
532
|
+
if (!scopedAiTransportHost) {
|
|
533
|
+
if (host !== activeAiTransportHost) throw new Error("Scoped AI transport hosts require Node.js async context support");
|
|
534
|
+
if (pendingUnscopedHost && pendingUnscopedHost !== host) throw new Error("AI transport host changed while browser provider work was still pending");
|
|
535
|
+
const result = run();
|
|
536
|
+
trackUnscopedOperation(host, result);
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
return scopedAiTransportHost.run(host, run);
|
|
540
|
+
}
|
|
541
|
+
/** Installers must read the process default, never an unrelated operation's scoped policy. */
|
|
542
|
+
function getDefaultAiTransportHost() {
|
|
543
|
+
return activeAiTransportHost;
|
|
544
|
+
}
|
|
545
|
+
/** Installs host implementations for the transport policy ports. */
|
|
546
|
+
function configureAiTransportHost(host) {
|
|
547
|
+
if (!scopedAiTransportHost && pendingUnscopedOperations > 0) throw new Error("Cannot replace the AI transport host while browser provider work is pending");
|
|
548
|
+
activeAiTransportHost = createAiTransportHost(host);
|
|
501
549
|
const transportHost = activeAiTransportHost;
|
|
502
550
|
if (transportHost.registerCustomApi === inertAiTransportHost.registerCustomApi || pendingCustomApiRegistrations.length === 0) return;
|
|
503
551
|
const pending = pendingCustomApiRegistrations.splice(0);
|
|
@@ -510,7 +558,7 @@ function configureAiTransportHost(host) {
|
|
|
510
558
|
}
|
|
511
559
|
/** Returns the active transport host (inert defaults unless configured). */
|
|
512
560
|
function getAiTransportHost() {
|
|
513
|
-
return activeAiTransportHost;
|
|
561
|
+
return scopedAiTransportHost?.getStore() ?? activeAiTransportHost;
|
|
514
562
|
}
|
|
515
563
|
/** Resolves sentinel substrings in custom headers at a no-fetch adapter boundary. */
|
|
516
564
|
function resolveAiTransportHeaderSentinels(headers) {
|
|
@@ -528,4 +576,4 @@ function resolveAiTransportHeaderSentinels(headers) {
|
|
|
528
576
|
return resolvedHeaders ?? headers;
|
|
529
577
|
}
|
|
530
578
|
//#endregion
|
|
531
|
-
export {
|
|
579
|
+
export { getSupportedThinkingLevels as A, resolveModelBoundThinkingReplayMode as C, applyProviderReportedUsageCost as D, headersToRecord as E, hasMediaPayload as M, isImageWithMediaPayload as N, calculateCost as O, resolveAnthropicThinkingEffort as S, usesClaudeStreamingRefusalContract as T, buildAnthropicClaudeCodeIdentity as _, resolveAiTransportHeaderSentinels as a, prepareClaudeNoPrefillRequestContext as b, transformMessages as c, hasOnlyAssistantReasoningContent as d, isReasoningOnlyLengthAssistantTurn as f, applyClaudeRequestContract as g, ANTHROPIC_CLAUDE_CODE_VERSION as h, getDefaultAiTransportHost as i, modelsAreEqual as j, clampThinkingLevel as k, FAILED_ASSISTANT_REPLAY_TEXT as l, resolveFailedAssistantReplay as m, createAiTransportHost as n, runWithAiTransportHost as o, isStreamErrorFallbackContent as p, getAiTransportHost as r, supportsScopedAiTransportHosts as s, configureAiTransportHost as t, STREAM_ERROR_FALLBACK_TEXT as u, defaultsClaudeAdaptiveThinking as v, usesClaudeFable5MessagesContract as w, requiresClaudeAdaptiveThinking as x, mapAnthropicStopReason as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as getAiTransportHost } from "./host-DCW52iHe.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/host-policy.ts
|
|
3
3
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
4
4
|
const host = getAiTransportHost();
|
|
@@ -6,6 +6,13 @@ function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
|
6
6
|
if (timeoutMs !== void 0) return host.buildModelFetch(model, timeoutMs) ?? globalThis.fetch;
|
|
7
7
|
return host.buildModelFetch(model) ?? globalThis.fetch;
|
|
8
8
|
}
|
|
9
|
+
/** SDKs keep their default transport unless their embedding owner requires an explicit one. */
|
|
10
|
+
function buildManagedModelFetch(model, host = getAiTransportHost()) {
|
|
11
|
+
if (!host.requiresManagedTransport(model)) return;
|
|
12
|
+
const fetcher = host.buildModelFetch(model);
|
|
13
|
+
if (!fetcher) throw new Error("The embedding host requires a managed provider transport");
|
|
14
|
+
return fetcher;
|
|
15
|
+
}
|
|
9
16
|
function resolveProviderEndpoint(model) {
|
|
10
17
|
return { endpointClass: getAiTransportHost().resolveProviderRequestCapabilities({
|
|
11
18
|
baseUrl: model.baseUrl,
|
|
@@ -22,4 +29,4 @@ function resolveModelRequestTimeoutMs(model, timeoutMs) {
|
|
|
22
29
|
return timeoutMs ?? getAiTransportHost().resolveModelRequestTimeoutMs(model);
|
|
23
30
|
}
|
|
24
31
|
//#endregion
|
|
25
|
-
export { resolveProviderRequestCapabilities as i,
|
|
32
|
+
export { resolveProviderRequestCapabilities as a, resolveProviderEndpoint as i, buildManagedModelFetch as n, resolveModelRequestTimeoutMs as r, buildGuardedModelFetch as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
3
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
1
|
+
import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, O as Message, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, U as ProviderStreamOptions, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, d as Context, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, k as Model, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, tt as StreamFunction, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-DvzmWW8J.mjs";
|
|
2
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DrRM_90c.mjs";
|
|
3
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-B3lQt_VE.mjs";
|
|
4
4
|
//#region packages/llm-core/src/model-contracts/anthropic.d.ts
|
|
5
5
|
type ClaudeModelRef = {
|
|
6
6
|
id?: string;
|
|
@@ -106,6 +106,8 @@ declare function resolveClaudeMythos5ModelIdentity(ref: ClaudeModelRef): string
|
|
|
106
106
|
* Extend only with live replay proof (Mythos 5.1 remains unproven).
|
|
107
107
|
*/
|
|
108
108
|
declare function bindsClaudeThinkingPrefix(ref: ClaudeModelRef): boolean;
|
|
109
|
+
/** Return whether Claude accepts operator instructions within conversation history. */
|
|
110
|
+
declare function supportsClaudeInHistorySystemMessages(ref: ClaudeModelRef): boolean;
|
|
109
111
|
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
110
112
|
declare function requiresClaudeMandatoryAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
111
113
|
/** Resolve Claude Sonnet 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
@@ -154,7 +156,7 @@ declare function normalizeResolvedPricing(cost: Partial<RawModelCostConfig>): Mo
|
|
|
154
156
|
/** Price one model call, selecting its tier before billing the separate token buckets. */
|
|
155
157
|
declare function calculateUsageCost(usage: Partial<Pick<Usage, "input" | "output" | "cacheRead" | "cacheWrite" | "cacheWrite1h">>, pricing: RawModelCostConfig): Usage["cost"];
|
|
156
158
|
declare namespace index_d_exports {
|
|
157
|
-
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
159
|
+
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
158
160
|
}
|
|
159
161
|
//#endregion
|
|
160
|
-
export { resolveClaudeSonnet5ModelIdentity as C,
|
|
162
|
+
export { resolveClaudeSonnet5ModelIdentity as C, supportsClaudeInHistorySystemMessages as D, supportsClaudeFastMode as E, supportsClaudeNativeMaxEffort as O, resolveClaudeSonnet55ModelIdentity as S, supportsClaudeAdaptiveThinking as T, resolveClaudeModelIdentity as _, ProviderRefusalReview as a, resolveClaudeOpus55ModelIdentity as b, CLAUDE_OPUS_55_THINKING_PROFILE as c, CLAUDE_SONNET_5_THINKING_PROFILE as d, bindsClaudeThinkingPrefix as f, resolveClaudeFable5ModelIdentity as g, requiresClaudeMandatoryAdaptiveThinking as h, normalizeResolvedPricing as i, supportsClaudeNativeXhighEffort as k, CLAUDE_OPUS_5_THINKING_PROFILE as l, requiresClaudeDefaultSampling as m, calculateUsageCost as n, readProviderRefusalReview as o, requiresClaudeBetweenToolsThinking as p, normalizeModelCostConfig as r, CLAUDE_FABLE_5_THINKING_PROFILE as s, index_d_exports as t, CLAUDE_SONNET_55_THINKING_PROFILE as u, resolveClaudeMythos5ModelIdentity as v, supportsClaude1MContext as w, resolveClaudeOpus5ModelIdentity as x, resolveClaudeNativeThinkingLevelMap as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as resolveClaudeSonnet5ModelIdentity, D as
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
5
|
-
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-
|
|
6
|
-
import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as
|
|
1
|
+
import { C as resolveClaudeSonnet5ModelIdentity, D as supportsClaudeInHistorySystemMessages, E as supportsClaudeFastMode, O as supportsClaudeNativeMaxEffort, S as resolveClaudeSonnet55ModelIdentity, T as supportsClaudeAdaptiveThinking, _ as resolveClaudeModelIdentity, a as ProviderRefusalReview, b as resolveClaudeOpus55ModelIdentity, c as CLAUDE_OPUS_55_THINKING_PROFILE, d as CLAUDE_SONNET_5_THINKING_PROFILE, f as bindsClaudeThinkingPrefix, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as normalizeResolvedPricing, k as supportsClaudeNativeXhighEffort, l as CLAUDE_OPUS_5_THINKING_PROFILE, m as requiresClaudeDefaultSampling, n as calculateUsageCost, o as readProviderRefusalReview, p as requiresClaudeBetweenToolsThinking, r as normalizeModelCostConfig, s as CLAUDE_FABLE_5_THINKING_PROFILE, u as CLAUDE_SONNET_55_THINKING_PROFILE, v as resolveClaudeMythos5ModelIdentity, w as supportsClaude1MContext, x as resolveClaudeOpus5ModelIdentity, y as resolveClaudeNativeThinkingLevelMap } from "./index-a8e_oKnu.mjs";
|
|
2
|
+
import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, O as Message, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, U as ProviderStreamOptions, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, d as Context, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, k as Model, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, tt as StreamFunction, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-DvzmWW8J.mjs";
|
|
3
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DrRM_90c.mjs";
|
|
4
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-B3lQt_VE.mjs";
|
|
5
|
+
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-DpU0Rj-I.mjs";
|
|
6
|
+
import { _ as supportsScopedAiTransportHosts, a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as createAiTransportHost, g as runWithAiTransportHost, h as resolveAiTransportHeaderSentinels, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, m as getDefaultAiTransportHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as getAiTransportHost, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-BinBeGcQ.mjs";
|
|
7
7
|
//#region packages/ai/src/stream.d.ts
|
|
8
8
|
/** Creates an isolated LLM runtime backed by the supplied provider registry. */
|
|
9
9
|
export declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
@@ -18,7 +18,23 @@ export declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
|
18
18
|
complete: <TApi extends Api>(model: Model<TApi>, context: Context, options?: ProviderStreamOptions) => Promise<AssistantMessage>;
|
|
19
19
|
streamSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStreamContract;
|
|
20
20
|
completeSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
21
|
+
cleanupSessionResources: (sessionId?: string) => void;
|
|
22
|
+
};
|
|
23
|
+
/** Creates a Node runtime whose provider work retains an explicit transport host. */
|
|
24
|
+
export declare function createNodeLlmRuntime(registry?: ApiRegistry, transportHost?: Partial<AiTransportHost>): {
|
|
25
|
+
registry: {
|
|
26
|
+
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
27
|
+
getApiProvider: (api: Api) => RegisteredApiProvider | undefined;
|
|
28
|
+
getApiProviders: () => RegisteredApiProvider[];
|
|
29
|
+
unregisterApiProviders: (sourceId: string) => void;
|
|
30
|
+
clearApiProviders: () => void;
|
|
31
|
+
};
|
|
32
|
+
stream: <TApi extends Api>(model: Model<TApi>, context: Context, options?: ProviderStreamOptions) => AssistantMessageEventStreamContract;
|
|
33
|
+
complete: <TApi extends Api>(model: Model<TApi>, context: Context, options?: ProviderStreamOptions) => Promise<AssistantMessage>;
|
|
34
|
+
streamSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStreamContract;
|
|
35
|
+
completeSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
36
|
+
cleanupSessionResources: (sessionId?: string) => void;
|
|
21
37
|
};
|
|
22
38
|
export type LlmRuntime = ReturnType<typeof createLlmRuntime>;
|
|
23
39
|
//#endregion
|
|
24
|
-
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, type ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, RegisteredApiProvider, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, getAiTransportHost, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
40
|
+
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, type ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RegisteredApiProvider, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as supportsClaudeFastMode, S as supportsClaudeAdaptiveThinking, T as
|
|
2
|
-
import { n as
|
|
1
|
+
import { C as supportsClaudeFastMode, E as supportsClaudeNativeXhighEffort, S as supportsClaudeAdaptiveThinking, T as supportsClaudeNativeMaxEffort, _ as resolveClaudeOpus55ModelIdentity, a as CLAUDE_OPUS_55_THINKING_PROFILE, b as resolveClaudeSonnet5ModelIdentity, c as CLAUDE_SONNET_5_THINKING_PROFILE, d as requiresClaudeDefaultSampling, f as requiresClaudeMandatoryAdaptiveThinking, g as resolveClaudeNativeThinkingLevelMap, h as resolveClaudeMythos5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as bindsClaudeThinkingPrefix, m as resolveClaudeModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeFable5ModelIdentity, r as normalizeResolvedPricing, s as CLAUDE_SONNET_55_THINKING_PROFILE, t as calculateUsageCost, u as requiresClaudeBetweenToolsThinking, v as resolveClaudeOpus5ModelIdentity, w as supportsClaudeInHistorySystemMessages, x as supportsClaude1MContext, y as resolveClaudeSonnet55ModelIdentity } from "./src-B0NIt2UK.mjs";
|
|
2
|
+
import { _ as runtimeContextContentToText, a as RUNTIME_CONTEXT_BEGIN_MARKER, c as RUNTIME_CONTEXT_FOOTER, d as hasLegacyRuntimeContextEnvelope, f as hasRuntimeContextMarker, g as readRuntimeContextMetadata, h as labelRuntimeContextText, i as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, l as RUNTIME_CONTEXT_HEADER, m as labelRuntimeContextContent, n as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, o as RUNTIME_CONTEXT_CUSTOM_TYPE, p as isRuntimeContextMessage, r as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, s as RUNTIME_CONTEXT_END_MARKER, t as DEFAULT_MISSING_TOOL_RESULT_TEXT, u as escapeRuntimeContextFooter, v as setRuntimeContextRetention } from "./types-CQc6JNG4.mjs";
|
|
3
3
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import { n as createApiRegistry, t as createLlmRuntime } from "./stream-
|
|
7
|
-
import { n as
|
|
8
|
-
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
4
|
+
import { a as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-DbqlIfDn.mjs";
|
|
6
|
+
import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-DSdzKsDK.mjs";
|
|
7
|
+
import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-DCW52iHe.mjs";
|
|
8
|
+
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, DEFAULT_MISSING_TOOL_RESULT_TEXT, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, createNodeLlmRuntime, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as resolveClaudeSonnet5ModelIdentity,
|
|
2
|
-
import {
|
|
3
|
-
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
5
|
-
import { p as resolveAnthropicServerCompactionPlan } from "../anthropic-payload-policy-
|
|
1
|
+
import { C as resolveClaudeSonnet5ModelIdentity, O as supportsClaudeNativeMaxEffort, S as resolveClaudeSonnet55ModelIdentity, T as supportsClaudeAdaptiveThinking, _ as resolveClaudeModelIdentity, b as resolveClaudeOpus55ModelIdentity, f as bindsClaudeThinkingPrefix, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, k as supportsClaudeNativeXhighEffort, m as requiresClaudeDefaultSampling, p as requiresClaudeBetweenToolsThinking, v as resolveClaudeMythos5ModelIdentity, x as resolveClaudeOpus5ModelIdentity, y as resolveClaudeNativeThinkingLevelMap } from "../index-a8e_oKnu.mjs";
|
|
2
|
+
import { $ as StopReason, Et as AssistantMessageDiagnostic, Q as SimpleStreamOptions, d as Context, k as Model, pt as Usage, tt as StreamFunction } from "../types-DvzmWW8J.mjs";
|
|
3
|
+
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-D5ABCV_l.mjs";
|
|
4
|
+
import "../types-BuiEBM3u.mjs";
|
|
5
|
+
import { p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-BhCcgNdm.mjs";
|
|
6
6
|
import { Tool } from "@anthropic-ai/sdk/resources/messages.js";
|
|
7
7
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
8
8
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
@@ -230,4 +230,4 @@ export declare function applyAnthropicMessageStartUsage(target: Usage, payload:
|
|
|
230
230
|
/** Keep billing and context distinct; omitted usage preserves the last snapshot. */
|
|
231
231
|
export declare function applyAnthropicMessageDeltaUsage(target: Usage, usage: AnthropicUsagePayload | undefined, messageStartPromptUsage: AnthropicPromptUsageSnapshot | undefined): void;
|
|
232
232
|
//#endregion
|
|
233
|
-
export { type AnthropicEffort, type AnthropicOptions, type AnthropicThinkingDisplay, bindsClaudeThinkingPrefix, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicServerCompactionPlan, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort };
|
|
233
|
+
export { type AnthropicEffort, type AnthropicOptions, type AnthropicThinkingDisplay, bindsClaudeThinkingPrefix, isDirectAnthropicModel, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicServerCompactionPlan, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort };
|