@openclaw/ai 2026.8.1-beta.2 → 2026.8.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/dist/{anthropic-B6dLpq5L.mjs → anthropic-Djj7L1rx.mjs} +49 -39
- package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-CY4tkD4V.mjs} +42 -44
- package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-i_5_inWe.d.mts} +4 -2
- package/dist/{api-registry-k3zTz0cV.d.mts → api-registry-C9-wZd_W.d.mts} +2 -1
- package/dist/{azure-openai-responses-mxIOtUnn.mjs → azure-openai-responses-Bj3czHNa.mjs} +4 -4
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/diagnostics.d.mts +2 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/event-stream-C988TSLe.d.mts +1 -0
- package/dist/{event-stream-BP6AWT8j.d.mts → event-stream-UhnxHuqt.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-C7h2QzDX.mjs → google-0Ca6TYbw.mjs} +4 -4
- package/dist/{google-shared-B0Qr9OR7.mjs → google-shared-DVfL9COU.mjs} +22 -8
- package/dist/{google-vertex-Bhc3TjDl.mjs → google-vertex-5dAMxprN.mjs} +4 -4
- package/dist/{host-DTqNc7ad.mjs → host-D51fmkH6.mjs} +40 -33
- package/dist/{host-vWgMMhiJ.d.mts → host-DoPJJ1KD.d.mts} +7 -7
- package/dist/index-N3zr6__t.d.mts +105 -0
- package/dist/index.d.mts +9 -10
- package/dist/index.mjs +2 -3
- package/dist/internal/anthropic.d.mts +57 -49
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +65 -63
- package/dist/internal/openai.mjs +10 -8
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +53 -40
- package/dist/internal/runtime.mjs +10 -9
- package/dist/internal/shared.d.mts +37 -23
- package/dist/internal/shared.mjs +4 -4
- package/dist/{json-parse-CDnesDM_.mjs → json-parse-BuAJEbdW.mjs} +18 -2
- package/dist/{headers-DdOQtGuU.mjs → llm-request-activity-BjtkplhG.mjs} +1 -9
- package/dist/{mistral-CEWoQI_g.mjs → mistral-BCnrI-kV.mjs} +64 -53
- package/dist/{openai-chatgpt-responses-CrPmqERt.mjs → openai-chatgpt-responses-CGBGWSqr.mjs} +45 -20
- package/dist/{openai-completions-BPnt4Sml.mjs → openai-completions-BaTuwID7.mjs} +63 -258
- package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-DB7FFq7k.d.mts} +3 -3
- package/dist/openai-completions-stream-Bpns6uNc.mjs +1622 -0
- package/dist/{openai-responses-DhIKtOup.mjs → openai-responses-1GBcQujk.mjs} +8 -6
- package/dist/openai-responses-compaction-window-DwydGZI8.mjs +686 -0
- package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-DgaR3t5T.d.mts} +14 -5
- package/dist/{openai-responses-payload-policy-BSs371VM.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +2 -0
- package/dist/{openai-responses-prompt-observer-internal-DgNTYnRY.mjs → openai-responses-prompt-observer-internal-_nhGTn2b.mjs} +3 -3
- package/dist/{openai-responses-shared-DXIt3iY5.mjs → openai-responses-shared-zPmKnhF5.mjs} +345 -1553
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-Dgl4H2MU.mjs +1695 -0
- package/dist/{provider-error-BUwEnjXq.mjs → provider-error-jZP5NMTZ.mjs} +3 -82
- package/dist/{provider-options-B96RdNpH.d.mts → provider-options-HvA_slFa.d.mts} +23 -4
- package/dist/provider-transcript-transform-C01bQ5a3.mjs +32 -0
- package/dist/provider-types.d.mts +18 -17
- package/dist/providers.d.mts +5 -6
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-rnPwX2pg.mjs → reasoning-tag-text-partitioner-CwzKb0bA.mjs} +4 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-BYqrYtC_.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/{simple-options-D58D5Kvw.mjs → simple-options-DKx86yX9.mjs} +42 -4
- package/dist/{anthropic-JsNA5KCu.mjs → src-Bu3FiFAG.mjs} +1 -1
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{streaming-byte-guard-BrbkbwUu.mjs → streaming-byte-guard-CC-HMn_u.mjs} +5 -6
- package/dist/string-normalization--fwJ4S2q.mjs +16 -0
- package/dist/{tool-schema-json-projection-q5d7QX5c.mjs → tool-schema-json-projection-qvTEs5Am.mjs} +17 -8
- package/dist/transport-stream-shared-CT5ycdzn.mjs +342 -0
- package/dist/transport-stream-shared-NjwWNaRY.d.mts +138 -0
- package/dist/{transport-utils-DJqkxbhC.mjs → transport-utils-BHx9z8Cl.mjs} +9 -9
- package/dist/transports.d.mts +140 -169
- package/dist/transports.mjs +269 -1262
- package/dist/types-DtGu2d3C.d.mts +1 -0
- package/dist/{types-BHNrPS1l.d.mts → types-h38Azne1.d.mts} +53 -17
- package/dist/types.d.mts +6 -5
- package/dist/types.mjs +1 -2
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DT9SrFn3.d.mts → validation-C68lP2uy.d.mts} +1 -2
- package/dist/validation.d.mts +1 -1
- package/package.json +6 -6
- package/dist/anthropic-SrGtwsJu.d.mts +0 -100
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/openai-responses-contracts-CyfIkQi5.mjs +0 -253
- package/dist/openai-responses-payload-policy-BDxV-W0c.mjs +0 -206
- package/dist/openai-stop-reason-BkFkqqK0.mjs +0 -563
- package/dist/openai-tool-projection-CY04OcvQ.mjs +0 -338
- package/dist/provider-transcript-transform-ePx-Bbfr.mjs +0 -155
- package/dist/record-coerce-DdXsgUd_.mjs +0 -23
- package/dist/src-D2H6yKkH.mjs +0 -2
- package/dist/stream-first-event-timeout-DvDeSucC.d.mts +0 -29
- package/dist/string-coerce-fsri9iCu.mjs +0 -34
- package/dist/types-BVVgDSdq.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
2
|
-
import { a as describeToolResultMediaPlaceholder,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
2
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload } from "./host-D51fmkH6.mjs";
|
|
3
|
+
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName } from "./simple-options-DKx86yX9.mjs";
|
|
4
|
+
import { _ as transportAbortError, n as coerceTransportToolCallArguments, p as notifyProviderStreamOpened, t as assignTransportErrorDetails } from "./transport-stream-shared-CT5ycdzn.mjs";
|
|
5
5
|
import { t as googleFlashSupportsMinimalThinking } from "./google-thinking-level-C-V3tecN.mjs";
|
|
6
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-C01bQ5a3.mjs";
|
|
6
7
|
import { FinishReason, FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
7
8
|
//#region packages/ai/src/providers/google-shared.ts
|
|
8
9
|
/**
|
|
9
10
|
* Shared utilities for Google Generative AI and Google Vertex providers.
|
|
10
11
|
*/
|
|
12
|
+
const GOOGLE_MODEL_RESOURCE_PREFIX = /^(?:(?:projects\/[^/]+\/locations\/[^/]+\/)?publishers\/google\/models\/|google\/|models\/)/u;
|
|
11
13
|
/**
|
|
12
14
|
* Determines whether a streamed Gemini `Part` should be treated as "thinking".
|
|
13
15
|
*
|
|
@@ -83,6 +85,7 @@ function convertMessages(model, context) {
|
|
|
83
85
|
const transformedMessages = transformProviderMessages(context.messages, model, normalizeToolCallId);
|
|
84
86
|
const requiresToolCallThoughtSignature = model.provider !== "google-gemini-cli" && (isGemini3ProModel(model) || isGemini3FlashModel(model));
|
|
85
87
|
const pendingToolResultImageTurns = [];
|
|
88
|
+
const sameRouteToolCallIds = /* @__PURE__ */ new Set();
|
|
86
89
|
let activeToolResultParts;
|
|
87
90
|
const flushToolResultRun = () => {
|
|
88
91
|
contents.push(...pendingToolResultImageTurns);
|
|
@@ -130,6 +133,7 @@ function convertMessages(model, context) {
|
|
|
130
133
|
});
|
|
131
134
|
else parts.push({ text: sanitizeSurrogates(block.thinking) });
|
|
132
135
|
} else if (block.type === "toolCall") {
|
|
136
|
+
if (isSameProviderAndModel && model.provider !== "google-gemini-cli") sameRouteToolCallIds.add(block.id);
|
|
133
137
|
const args = coerceTransportToolCallArguments(block.arguments);
|
|
134
138
|
const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thoughtSignature) ?? (!sawFunctionCall && requiresToolCallThoughtSignature ? "skip_thought_signature_validator" : void 0);
|
|
135
139
|
sawFunctionCall = true;
|
|
@@ -137,7 +141,7 @@ function convertMessages(model, context) {
|
|
|
137
141
|
functionCall: {
|
|
138
142
|
name: block.name,
|
|
139
143
|
args,
|
|
140
|
-
...requiresToolCallId(model.id) ? { id: block.id } : {}
|
|
144
|
+
...sameRouteToolCallIds.has(block.id) || requiresToolCallId(model.id) ? { id: block.id } : {}
|
|
141
145
|
},
|
|
142
146
|
...thoughtSignature && { thoughtSignature }
|
|
143
147
|
};
|
|
@@ -160,7 +164,7 @@ function convertMessages(model, context) {
|
|
|
160
164
|
mimeType: imageBlock.mimeType,
|
|
161
165
|
data: imageBlock.data
|
|
162
166
|
} }));
|
|
163
|
-
const includeId = requiresToolCallId(model.id);
|
|
167
|
+
const includeId = sameRouteToolCallIds.has(msg.toolCallId) || requiresToolCallId(model.id);
|
|
164
168
|
const functionResponsePart = { functionResponse: {
|
|
165
169
|
name: msg.toolName,
|
|
166
170
|
response: msg.isError ? { error: responseValue } : { output: responseValue },
|
|
@@ -244,8 +248,15 @@ async function runGoogleGenerateContentLifecycle(params) {
|
|
|
244
248
|
let requestParams = params.buildParams();
|
|
245
249
|
const nextParams = await options?.onPayload?.(requestParams, model);
|
|
246
250
|
if (nextParams !== void 0) requestParams = nextParams;
|
|
251
|
+
const googleIterator = (await client.models.generateContentStream(requestParams))[Symbol.asyncIterator]();
|
|
252
|
+
await notifyProviderStreamOpened({
|
|
253
|
+
options,
|
|
254
|
+
cancelStream: async () => {
|
|
255
|
+
await googleIterator.return?.();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
247
258
|
await consumeGoogleGenerateContentStream({
|
|
248
|
-
chunks:
|
|
259
|
+
chunks: { [Symbol.asyncIterator]: () => googleIterator },
|
|
249
260
|
model,
|
|
250
261
|
output,
|
|
251
262
|
stream,
|
|
@@ -403,6 +414,7 @@ function mapStopReason(reason) {
|
|
|
403
414
|
case FinishReason.OTHER:
|
|
404
415
|
case FinishReason.LANGUAGE:
|
|
405
416
|
case FinishReason.MALFORMED_FUNCTION_CALL:
|
|
417
|
+
case FinishReason.TOO_MANY_TOOL_CALLS:
|
|
406
418
|
case FinishReason.UNEXPECTED_TOOL_CALL:
|
|
407
419
|
case FinishReason.NO_IMAGE: return "error";
|
|
408
420
|
default: throw new Error(`Unhandled stop reason: ${String(reason)}`);
|
|
@@ -446,6 +458,8 @@ async function consumeGoogleGenerateContentStream(params) {
|
|
|
446
458
|
};
|
|
447
459
|
for await (const chunk of params.chunks) {
|
|
448
460
|
params.output.responseId ||= chunk.responseId;
|
|
461
|
+
const responseModel = chunk.modelVersion?.trim();
|
|
462
|
+
if (responseModel && params.model.id.replace(GOOGLE_MODEL_RESOURCE_PREFIX, "") !== responseModel.replace(GOOGLE_MODEL_RESOURCE_PREFIX, "")) params.output.responseModel ||= responseModel;
|
|
449
463
|
if (chunk.usageMetadata) {
|
|
450
464
|
for (const field of Object.keys(knownUsage)) {
|
|
451
465
|
const value = chunk.usageMetadata[field];
|
|
@@ -581,7 +595,7 @@ async function consumeGoogleGenerateContentStream(params) {
|
|
|
581
595
|
});
|
|
582
596
|
}
|
|
583
597
|
}
|
|
584
|
-
if (candidate?.finishReason) {
|
|
598
|
+
if (candidate?.finishReason && candidate.finishReason !== FinishReason.FINISH_REASON_UNSPECIFIED) {
|
|
585
599
|
sawTerminalReason = true;
|
|
586
600
|
params.output.stopReason = mapStopReason(candidate.finishReason);
|
|
587
601
|
if (params.output.stopReason === "error") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
2
|
+
import { d as normalizeOptionalString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-D51fmkH6.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-DKx86yX9.mjs";
|
|
5
|
+
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-DVfL9COU.mjs";
|
|
6
6
|
import { GoogleGenAI, ResourceScope } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
8
8
|
const API_VERSION = "v1";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-BYqrYtC_.mjs";
|
|
5
|
-
import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
|
|
6
|
-
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
|
+
import { c as normalizeLowercaseStringOrEmpty, o as isRecord, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { i as clampThinkingLevel, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
7
4
|
//#region packages/ai/src/providers/anthropic-model-contract.ts
|
|
8
5
|
const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.75";
|
|
9
6
|
const ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK = `x-anthropic-billing-header: cc_version=${ANTHROPIC_CLAUDE_CODE_VERSION}; cc_entrypoint=sdk-cli;`;
|
|
@@ -163,22 +160,11 @@ function describeOmittedValue(value, label) {
|
|
|
163
160
|
function redactInlineDataUris(value) {
|
|
164
161
|
return value.replace(INLINE_DATA_URI_PATTERN, (_match, prefix, uri) => `${prefix}[inline data URI: ${uri.length} chars]`);
|
|
165
162
|
}
|
|
166
|
-
function redactStructuredTextValue(value) {
|
|
167
|
-
const host = getAiTransportHost();
|
|
168
|
-
const redacted = host.redactToolPayloadText(value);
|
|
169
|
-
const trimmed = redacted.trim();
|
|
170
|
-
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return redacted;
|
|
171
|
-
try {
|
|
172
|
-
const redactedWrapper = host.redactSecrets({ structuredTextValue: JSON.parse(redacted) });
|
|
173
|
-
return JSON.stringify(redactedWrapper.structuredTextValue);
|
|
174
|
-
} catch {
|
|
175
|
-
return redacted;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
163
|
function stringifyStructuredBlock(block) {
|
|
179
164
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
180
165
|
try {
|
|
181
|
-
const
|
|
166
|
+
const host = getAiTransportHost();
|
|
167
|
+
const redactedBlock = host.redactModelVisibleSecrets({ structuredToolResult: block }).structuredToolResult;
|
|
182
168
|
const serialized = JSON.stringify(redactedBlock, function structuredToolResultReplacer(key, value) {
|
|
183
169
|
if (OPAQUE_OR_BINARY_FIELD_RE.test(key)) return `[omitted ${key}]`;
|
|
184
170
|
if (key === "data") {
|
|
@@ -186,7 +172,7 @@ function stringifyStructuredBlock(block) {
|
|
|
186
172
|
if (mimeType && isBinaryMimeType(mimeType)) return describeOmittedValue(value, "binary data");
|
|
187
173
|
}
|
|
188
174
|
if (typeof value === "bigint") return value.toString();
|
|
189
|
-
if (typeof value === "string") return redactInlineDataUris(
|
|
175
|
+
if (typeof value === "string") return redactInlineDataUris(host.redactModelVisibleSecrets(value));
|
|
190
176
|
if (typeof value === "function" || typeof value === "symbol" || value === void 0) return;
|
|
191
177
|
if (!value || typeof value !== "object") return value;
|
|
192
178
|
if (seen.has(value)) return "[Circular]";
|
|
@@ -211,20 +197,26 @@ function hasMediaPayload(block) {
|
|
|
211
197
|
function isImageWithMediaPayload(block) {
|
|
212
198
|
return isRecord(block) && block.type === "image" && hasMediaPayload(block);
|
|
213
199
|
}
|
|
214
|
-
function
|
|
200
|
+
function classifyToolResultMedia(blocks) {
|
|
215
201
|
let hasImage = false;
|
|
216
202
|
let hasAudio = false;
|
|
217
203
|
for (const block of blocks) {
|
|
218
|
-
if (!hasMediaPayload(block)) continue;
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (type && AUDIO_TOOL_RESULT_TYPES.has(type) || mimeType?.toLowerCase().startsWith("audio/")) hasAudio = true;
|
|
204
|
+
if (!hasMediaPayload(block) || block.type === "text") continue;
|
|
205
|
+
const type = typeof block.type === "string" ? block.type : void 0;
|
|
206
|
+
const mimeType = readMimeType(block)?.toLowerCase();
|
|
207
|
+
hasImage ||= Boolean(type && IMAGE_TOOL_RESULT_TYPES.has(type) || mimeType?.startsWith("image/"));
|
|
208
|
+
hasAudio ||= Boolean(type && AUDIO_TOOL_RESULT_TYPES.has(type) || mimeType?.startsWith("audio/"));
|
|
224
209
|
}
|
|
210
|
+
return {
|
|
211
|
+
hasImage,
|
|
212
|
+
hasAudio
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function describeToolResultMediaPlaceholder(blocks) {
|
|
216
|
+
const { hasImage, hasAudio } = classifyToolResultMedia(blocks);
|
|
225
217
|
if (hasImage && hasAudio) return "(see attached media)";
|
|
226
218
|
if (hasAudio) return "(see attached audio)";
|
|
227
|
-
|
|
219
|
+
return hasImage ? "(see attached image)" : void 0;
|
|
228
220
|
}
|
|
229
221
|
function extractToolResultBlockText(block) {
|
|
230
222
|
if (!block || typeof block !== "object") return;
|
|
@@ -237,7 +229,7 @@ function extractToolResultBlockText(block) {
|
|
|
237
229
|
const structured = stringifyStructuredBlock(record);
|
|
238
230
|
return structured ? sanitizeSurrogates(truncateProviderToolText(structured)) : void 0;
|
|
239
231
|
}
|
|
240
|
-
function extractToolResultText(blocks) {
|
|
232
|
+
function extractToolResultText(blocks, options) {
|
|
241
233
|
const explicitTexts = [];
|
|
242
234
|
const structuredTexts = [];
|
|
243
235
|
for (const block of blocks) {
|
|
@@ -246,9 +238,25 @@ function extractToolResultText(blocks) {
|
|
|
246
238
|
if (block.type === "text") explicitTexts.push(text);
|
|
247
239
|
else structuredTexts.push(text);
|
|
248
240
|
}
|
|
249
|
-
if (explicitTexts.length > 0)
|
|
241
|
+
if (explicitTexts.length > 0) {
|
|
242
|
+
const text = (options?.includeStructured ? [...explicitTexts, ...structuredTexts] : explicitTexts).join("\n");
|
|
243
|
+
return sanitizeSurrogates(options?.includeStructured ? truncateProviderToolText(text) : text);
|
|
244
|
+
}
|
|
250
245
|
return sanitizeSurrogates(truncateProviderToolText(structuredTexts.join("\n")));
|
|
251
246
|
}
|
|
247
|
+
/** Describe media that cannot be represented on the target provider wire. */
|
|
248
|
+
function describeUnsupportedToolResultMedia(blocks, support) {
|
|
249
|
+
const { hasImage, hasAudio } = classifyToolResultMedia(blocks);
|
|
250
|
+
const omittedImage = hasImage && !support.images;
|
|
251
|
+
const omittedAudio = hasAudio && !support.audio;
|
|
252
|
+
if (omittedImage && omittedAudio) return "[unsupported tool-result media omitted]";
|
|
253
|
+
if (omittedAudio) return "[unsupported tool-result audio omitted]";
|
|
254
|
+
return omittedImage ? "[unsupported tool-result image omitted]" : void 0;
|
|
255
|
+
}
|
|
256
|
+
function formatToolResultText(params) {
|
|
257
|
+
const body = params.text.trim() ? `${params.text}${params.omittedMediaPlaceholder ? `\n${params.omittedMediaPlaceholder}` : ""}` : params.omittedMediaPlaceholder ?? params.mediaPlaceholder ?? "(no tool output)";
|
|
258
|
+
return `${params.isError ? "[tool error] " : ""}${body}`;
|
|
259
|
+
}
|
|
252
260
|
//#endregion
|
|
253
261
|
//#region packages/ai/src/transcript-transform.ts
|
|
254
262
|
const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
@@ -386,7 +394,7 @@ function queueCustomApiRegistration(registry, api, streamFn) {
|
|
|
386
394
|
const inertAiTransportHost = {
|
|
387
395
|
buildModelFetch: () => void 0,
|
|
388
396
|
resolveSecretSentinel: (value) => value,
|
|
389
|
-
|
|
397
|
+
redactModelVisibleSecrets: (value) => value,
|
|
390
398
|
redactToolPayloadText: (text) => text,
|
|
391
399
|
normalizeAnthropicInlineContentBlocks: async (content) => [...content],
|
|
392
400
|
resolveOpenAIStrictToolSetting: (_model, options) => options?.supportsStrictMode ? false : void 0,
|
|
@@ -399,7 +407,6 @@ const inertAiTransportHost = {
|
|
|
399
407
|
}
|
|
400
408
|
},
|
|
401
409
|
buildCopilotDynamicHeaders: () => ({}),
|
|
402
|
-
resolveProviderEndpointClass: () => "default",
|
|
403
410
|
resolveProviderRequestCapabilities: () => ({
|
|
404
411
|
endpointClass: "default",
|
|
405
412
|
knownProviderFamily: "",
|
|
@@ -463,4 +470,4 @@ function resolveAiTransportHeaderSentinels(headers) {
|
|
|
463
470
|
return resolvedHeaders ?? headers;
|
|
464
471
|
}
|
|
465
472
|
//#endregion
|
|
466
|
-
export {
|
|
473
|
+
export { usesClaudeStreamingRefusalContract as S, prepareClaudeNoPrefillRequestContext as _, describeToolResultMediaPlaceholder as a, resolveModelBoundThinkingReplayMode as b, extractToolResultText as c, isImageWithMediaPayload as d, ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK as f, mapAnthropicStopReason as g, defaultsClaudeAdaptiveThinking as h, transformMessages as i, formatToolResultText as l, applyClaudeRequestContract as m, getAiTransportHost as n, describeUnsupportedToolResultMedia as o, ANTHROPIC_CLAUDE_CODE_VERSION as p, resolveAiTransportHeaderSentinels as r, extractToolResultBlockText as s, configureAiTransportHost as t, hasMediaPayload as u, requiresClaudeAdaptiveThinking as v, usesClaudeFable5MessagesContract as x, resolveAnthropicThinkingEffort as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { n as
|
|
3
|
-
|
|
1
|
+
import "./index-N3zr6__t.mjs";
|
|
2
|
+
import { D as Model, V as StreamFn, d as Context, n as Api } from "./types-h38Azne1.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-C9-wZd_W.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 {
|
|
@@ -20,6 +20,7 @@ interface AiProviderRequestPolicyInput {
|
|
|
20
20
|
transport?: "stream" | "websocket" | "http" | "media-understanding";
|
|
21
21
|
modelId?: string | null;
|
|
22
22
|
compat?: unknown;
|
|
23
|
+
model?: object;
|
|
23
24
|
}
|
|
24
25
|
/** Context shared by plugin-owned provider stream hooks. */
|
|
25
26
|
interface AiProviderStreamHookContext {
|
|
@@ -112,8 +113,8 @@ interface AiTransportHost {
|
|
|
112
113
|
}): typeof fetch | undefined;
|
|
113
114
|
/** Resolves host-owned process-local secret sentinel substrings immediately before egress. */
|
|
114
115
|
resolveSecretSentinel(value: string): string;
|
|
115
|
-
/** Redacts
|
|
116
|
-
|
|
116
|
+
/** Redacts model-visible tool results without treating ordinary source assignments as secrets. */
|
|
117
|
+
redactModelVisibleSecrets<T>(value: T): T;
|
|
117
118
|
/** Redacts secret-bearing text in tool payload strings. */
|
|
118
119
|
redactToolPayloadText(text: string): string;
|
|
119
120
|
/** Normalizes Anthropic inline image blocks before provider payload construction. */
|
|
@@ -129,8 +130,6 @@ interface AiTransportHost {
|
|
|
129
130
|
plugin: AiTransportPluginHost;
|
|
130
131
|
/** Builds provider-owned Copilot compatibility headers for one message turn. */
|
|
131
132
|
buildCopilotDynamicHeaders(messages: Context["messages"]): Record<string, string>;
|
|
132
|
-
/** Resolves endpoint classification without importing core provider registries. */
|
|
133
|
-
resolveProviderEndpointClass(baseUrl?: string): string;
|
|
134
133
|
/** Resolves provider capability flags used by payload compatibility policy. */
|
|
135
134
|
resolveProviderRequestCapabilities(input: AiProviderRequestPolicyInput): AiProviderRequestCapabilities;
|
|
136
135
|
/** Merges host-owned provider request headers and attribution policy. */
|
|
@@ -141,6 +140,7 @@ interface AiTransportHost {
|
|
|
141
140
|
providerHeaders?: Record<string, string>;
|
|
142
141
|
callerHeaders?: Record<string, string>;
|
|
143
142
|
precedence?: "caller-wins" | "defaults-win";
|
|
143
|
+
model?: object;
|
|
144
144
|
}): Record<string, string> | undefined;
|
|
145
145
|
/** Returns the host-configured request timeout attached to a model. */
|
|
146
146
|
resolveModelRequestTimeoutMs(model: Model): number | undefined;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
2
|
+
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-h38Azne1.mjs";
|
|
3
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-UhnxHuqt.mjs";
|
|
4
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-C68lP2uy.mjs";
|
|
5
|
+
//#region packages/llm-core/src/model-contracts/anthropic.d.ts
|
|
6
|
+
type ClaudeModelRef = {
|
|
7
|
+
id?: string;
|
|
8
|
+
params?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
type ClaudeEffortModelRef = ClaudeModelRef & {
|
|
11
|
+
thinkingLevelMap?: Record<string, string | null | undefined>;
|
|
12
|
+
};
|
|
13
|
+
declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
|
|
14
|
+
readonly levels: readonly [{
|
|
15
|
+
readonly id: "minimal";
|
|
16
|
+
}, {
|
|
17
|
+
readonly id: "low";
|
|
18
|
+
}, {
|
|
19
|
+
readonly id: "medium";
|
|
20
|
+
}, {
|
|
21
|
+
readonly id: "high";
|
|
22
|
+
}, {
|
|
23
|
+
readonly id: "xhigh";
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "adaptive";
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: "max";
|
|
28
|
+
}];
|
|
29
|
+
readonly defaultLevel: "high";
|
|
30
|
+
readonly preserveWhenCatalogReasoningFalse: true;
|
|
31
|
+
};
|
|
32
|
+
declare const CLAUDE_SONNET_5_THINKING_PROFILE: {
|
|
33
|
+
readonly levels: readonly [{
|
|
34
|
+
readonly id: "off";
|
|
35
|
+
}, {
|
|
36
|
+
readonly id: "minimal";
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: "low";
|
|
39
|
+
}, {
|
|
40
|
+
readonly id: "medium";
|
|
41
|
+
}, {
|
|
42
|
+
readonly id: "high";
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: "xhigh";
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "adaptive";
|
|
47
|
+
}, {
|
|
48
|
+
readonly id: "max";
|
|
49
|
+
}];
|
|
50
|
+
readonly defaultLevel: "high";
|
|
51
|
+
};
|
|
52
|
+
declare const CLAUDE_OPUS_5_THINKING_PROFILE: {
|
|
53
|
+
readonly levels: readonly [{
|
|
54
|
+
readonly id: "off";
|
|
55
|
+
}, {
|
|
56
|
+
readonly id: "minimal";
|
|
57
|
+
}, {
|
|
58
|
+
readonly id: "low";
|
|
59
|
+
}, {
|
|
60
|
+
readonly id: "medium";
|
|
61
|
+
}, {
|
|
62
|
+
readonly id: "high";
|
|
63
|
+
}, {
|
|
64
|
+
readonly id: "xhigh";
|
|
65
|
+
}, {
|
|
66
|
+
readonly id: "adaptive";
|
|
67
|
+
}, {
|
|
68
|
+
readonly id: "max";
|
|
69
|
+
}];
|
|
70
|
+
readonly defaultLevel: "high";
|
|
71
|
+
};
|
|
72
|
+
/** Resolve the canonical normalized Claude model id for one runtime model ref. */
|
|
73
|
+
declare function resolveClaudeModelIdentity(ref: ClaudeModelRef): string;
|
|
74
|
+
/** Resolve Claude Fable 5 through direct ids, cloud ids, or deployment metadata. */
|
|
75
|
+
declare function resolveClaudeFable5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
76
|
+
/** Resolve Claude Mythos 5 through direct ids, cloud ids, or deployment metadata. */
|
|
77
|
+
declare function resolveClaudeMythos5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
78
|
+
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
79
|
+
declare function requiresClaudeMandatoryAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
80
|
+
/** Resolve Claude Sonnet 5 through direct ids, cloud ids, or deployment metadata. */
|
|
81
|
+
declare function resolveClaudeSonnet5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
82
|
+
/** Resolve Claude Opus 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
83
|
+
declare function resolveClaudeOpus5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
84
|
+
/** Return whether a Claude model supports adaptive thinking. */
|
|
85
|
+
declare function supportsClaudeAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
86
|
+
/** Return whether a Claude model has a native 1M-token context window. */
|
|
87
|
+
declare function supportsClaude1MContext(ref: ClaudeModelRef): boolean;
|
|
88
|
+
/** Return whether a Claude model supports Anthropic's native fast mode. */
|
|
89
|
+
declare function supportsClaudeFastMode(ref: ClaudeModelRef): boolean;
|
|
90
|
+
/** Return whether a Claude model supports native max effort. */
|
|
91
|
+
declare function supportsClaudeNativeMaxEffort(ref: ClaudeModelRef): boolean;
|
|
92
|
+
/** Return whether a Claude model supports native xhigh effort. */
|
|
93
|
+
declare function supportsClaudeNativeXhighEffort(ref: ClaudeModelRef): boolean;
|
|
94
|
+
/** Return whether a Claude model rejects caller-selected sampling parameters. */
|
|
95
|
+
declare function requiresClaudeDefaultSampling(ref: ClaudeModelRef): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Fill native Claude effort mappings only when the provider did not publish a
|
|
98
|
+
* narrower route-specific contract.
|
|
99
|
+
*/
|
|
100
|
+
declare function resolveClaudeNativeThinkingLevelMap(ref: ClaudeEffortModelRef): Record<string, string | null | undefined> | undefined;
|
|
101
|
+
declare namespace index_d_exports {
|
|
102
|
+
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { supportsClaudeNativeXhighEffort as _, requiresClaudeDefaultSampling as a, resolveClaudeModelIdentity as c, resolveClaudeOpus5ModelIdentity as d, resolveClaudeSonnet5ModelIdentity as f, supportsClaudeNativeMaxEffort as g, supportsClaudeFastMode as h, CLAUDE_SONNET_5_THINKING_PROFILE as i, resolveClaudeMythos5ModelIdentity as l, supportsClaudeAdaptiveThinking as m, CLAUDE_FABLE_5_THINKING_PROFILE as n, requiresClaudeMandatoryAdaptiveThinking as o, supportsClaude1MContext as p, CLAUDE_OPUS_5_THINKING_PROFILE as r, resolveClaudeFable5ModelIdentity as s, index_d_exports as t, resolveClaudeNativeThinkingLevelMap as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as supportsClaudeNativeXhighEffort, a as requiresClaudeDefaultSampling, c as resolveClaudeModelIdentity, d as resolveClaudeOpus5ModelIdentity, f as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeMaxEffort, h as supportsClaudeFastMode, i as CLAUDE_SONNET_5_THINKING_PROFILE, l as resolveClaudeMythos5ModelIdentity, m as supportsClaudeAdaptiveThinking, n as CLAUDE_FABLE_5_THINKING_PROFILE, o as requiresClaudeMandatoryAdaptiveThinking, p as supportsClaude1MContext, r as CLAUDE_OPUS_5_THINKING_PROFILE, s as resolveClaudeFable5ModelIdentity, u as resolveClaudeNativeThinkingLevelMap } from "./index-N3zr6__t.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
|
|
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-
|
|
7
|
-
import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-
|
|
8
|
-
|
|
3
|
+
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-h38Azne1.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-UhnxHuqt.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-C68lP2uy.mjs";
|
|
6
|
+
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-C9-wZd_W.mjs";
|
|
7
|
+
import { a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as getAiTransportHost, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as resolveAiTransportHeaderSentinels, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-DoPJJ1KD.mjs";
|
|
9
8
|
//#region packages/ai/src/stream.d.ts
|
|
10
9
|
/** Creates an isolated LLM runtime backed by the supplied provider registry. */
|
|
11
|
-
declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
10
|
+
export declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
12
11
|
registry: {
|
|
13
12
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
14
13
|
getApiProvider: (api: Api) => RegisteredApiProvider | undefined;
|
|
@@ -21,6 +20,6 @@ declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
|
21
20
|
streamSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStreamContract;
|
|
22
21
|
completeSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
23
22
|
};
|
|
24
|
-
type LlmRuntime = ReturnType<typeof createLlmRuntime>;
|
|
23
|
+
export type LlmRuntime = ReturnType<typeof createLlmRuntime>;
|
|
25
24
|
//#endregion
|
|
26
|
-
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider,
|
|
25
|
+
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RegisteredApiProvider, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
2
|
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
3
3
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
4
4
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
5
5
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-B61OhAio.mjs";
|
|
6
|
-
import "./src-D2H6yKkH.mjs";
|
|
7
6
|
import { n as createApiRegistry, t as createLlmRuntime } from "./stream-CREqxHgU.mjs";
|
|
8
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-
|
|
7
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
9
8
|
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|