@openclaw/ai 2026.8.1-beta.2 → 2026.9.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/dist/{anthropic-SrGtwsJu.d.mts → anthropic-BECQCNdF.d.mts} +0 -2
- package/dist/{anthropic-B6dLpq5L.mjs → anthropic-DI4PZKKB.mjs} +46 -34
- package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-nhKaCXu6.mjs} +17 -22
- package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-B_0n0enE.d.mts} +3 -1
- package/dist/{api-registry-k3zTz0cV.d.mts → api-registry-CTd8NzcD.d.mts} +2 -1
- package/dist/{azure-openai-responses-mxIOtUnn.mjs → azure-openai-responses-D8dI0ekg.mjs} +3 -3
- package/dist/diagnostics.d.mts +0 -1
- package/dist/diagnostics.mjs +1 -1
- package/dist/event-stream-BKp4fOt_.d.mts +1 -0
- package/dist/{event-stream-BP6AWT8j.d.mts → event-stream-LiXePESD.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-C7h2QzDX.mjs → google-Od-LLdVK.mjs} +3 -3
- package/dist/{google-shared-B0Qr9OR7.mjs → google-shared-Bgr9lFPw.mjs} +22 -8
- package/dist/{google-vertex-Bhc3TjDl.mjs → google-vertex-aerRSXc4.mjs} +4 -4
- package/dist/{host-DTqNc7ad.mjs → host-D51fmkH6.mjs} +40 -33
- package/dist/{host-vWgMMhiJ.d.mts → host-DsbPMFU6.d.mts} +7 -7
- package/dist/index-Qbej8io0.d.mts +3 -0
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +2 -3
- package/dist/internal/anthropic.d.mts +13 -6
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +6 -6
- package/dist/internal/openai.mjs +10 -8
- package/dist/internal/runtime.d.mts +18 -5
- package/dist/internal/runtime.mjs +8 -7
- package/dist/internal/shared.d.mts +18 -4
- 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-EiHdymeb.mjs} +59 -49
- package/dist/{openai-chatgpt-responses-CrPmqERt.mjs → openai-chatgpt-responses-DHpF9o1e.mjs} +42 -17
- package/dist/{openai-completions-BPnt4Sml.mjs → openai-completions-EFPiUGfS.mjs} +60 -257
- package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-BefmHT26.d.mts} +3 -3
- package/dist/openai-completions-stream-DUlGwRMz.mjs +1621 -0
- package/dist/{openai-responses-DhIKtOup.mjs → openai-responses-BogP8OjX.mjs} +6 -5
- package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-Dvj_UtPy.d.mts} +3 -3
- package/dist/{openai-responses-contracts-CyfIkQi5.mjs → openai-responses-contracts-QUY12X0B.mjs} +6 -26
- package/dist/{openai-responses-payload-policy-BSs371VM.d.mts → openai-responses-payload-policy-CNGFT9zr.d.mts} +1 -0
- package/dist/{openai-responses-payload-policy-BDxV-W0c.mjs → openai-responses-payload-policy-D8EdimYe.mjs} +6 -8
- package/dist/{openai-responses-prompt-observer-internal-DgNTYnRY.mjs → openai-responses-prompt-observer-internal-Cd4hJG-S.mjs} +3 -3
- package/dist/{openai-responses-shared-DXIt3iY5.mjs → openai-responses-shared-DJThc6jW.mjs} +205 -1472
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-ho-hIkQf.mjs +1695 -0
- package/dist/{provider-error-BUwEnjXq.mjs → provider-error-DDOs_Bz0.mjs} +20 -27
- package/dist/provider-options-AvldWZt8.mjs +21 -0
- package/dist/{provider-options-B96RdNpH.d.mts → provider-options-MdMBLzlU.d.mts} +15 -4
- package/dist/provider-transcript-transform-C01bQ5a3.mjs +32 -0
- package/dist/provider-types.d.mts +7 -5
- package/dist/providers.d.mts +1 -2
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-rnPwX2pg.mjs → reasoning-tag-text-partitioner-5ygO2rZc.mjs} +3 -0
- package/dist/{sanitize-unicode-BYqrYtC_.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/{simple-options-D58D5Kvw.mjs → simple-options-CFj7x3J4.mjs} +5 -4
- package/dist/{anthropic-JsNA5KCu.mjs → src-Bu3FiFAG.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-ljShVIZB.mjs +342 -0
- package/dist/transport-stream-shared-rvaCyFYt.d.mts +138 -0
- package/dist/{transport-utils-DJqkxbhC.mjs → transport-utils-LJ1_rbi-.mjs} +8 -5
- package/dist/transports.d.mts +45 -106
- package/dist/transports.mjs +134 -1089
- package/dist/{types-BHNrPS1l.d.mts → types-DhLoJbFm.d.mts} +49 -17
- package/dist/types-GiAjXatj.d.mts +1 -0
- 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-Dk7q7NMN.d.mts} +1 -2
- package/dist/validation.d.mts +1 -1
- package/package.json +5 -5
- package/dist/index-BVVgDSdq.d.mts +0 -1
- 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,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as asOptionalRecord } from "./record-coerce-DdXsgUd_.mjs";
|
|
3
|
-
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
1
|
+
import { a as asOptionalRecord, f as normalizeStringifiedOptionalString, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
4
2
|
import "./number-coercion-H9qHik3g.mjs";
|
|
5
3
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
6
4
|
function isJsonOpeningDelimiter(char, openers) {
|
|
@@ -125,7 +123,6 @@ function estimateBase64DecodedBytes(base64) {
|
|
|
125
123
|
const estimated = Math.floor(effectiveLen * 3 / 4) - padding;
|
|
126
124
|
return Math.max(0, estimated);
|
|
127
125
|
}
|
|
128
|
-
const CANONICALIZE_BASE64_CHUNK_SIZE = 8192;
|
|
129
126
|
function isBase64DataChar(code) {
|
|
130
127
|
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
131
128
|
}
|
|
@@ -140,45 +137,41 @@ function base64DataValue(code) {
|
|
|
140
137
|
* base64 only when the input has valid alphabet, padding, and length.
|
|
141
138
|
*/
|
|
142
139
|
function canonicalizeBase64(base64) {
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
let cleanedLength = 0;
|
|
140
|
+
let out;
|
|
141
|
+
let outLen = 0;
|
|
146
142
|
let padding = 0;
|
|
147
143
|
let sawPadding = false;
|
|
148
144
|
let lastDataCode = 0;
|
|
149
|
-
const append = (char) => {
|
|
150
|
-
current += char;
|
|
151
|
-
cleanedLength += 1;
|
|
152
|
-
if (current.length >= CANONICALIZE_BASE64_CHUNK_SIZE) {
|
|
153
|
-
chunks.push(current);
|
|
154
|
-
current = "";
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
145
|
for (let i = 0; i < base64.length; i += 1) {
|
|
158
146
|
const code = base64.charCodeAt(i);
|
|
159
|
-
if (code <= 32)
|
|
147
|
+
if (code <= 32) {
|
|
148
|
+
if (out === void 0) {
|
|
149
|
+
out = Buffer.allocUnsafe(base64.length - 1);
|
|
150
|
+
for (let j = 0; j < i; j += 1) out[j] = base64.charCodeAt(j);
|
|
151
|
+
outLen = i;
|
|
152
|
+
}
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
160
155
|
if (code === 61) {
|
|
161
156
|
padding += 1;
|
|
162
157
|
if (padding > 2) return;
|
|
163
158
|
sawPadding = true;
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
} else if (sawPadding || !isBase64DataChar(code)) return;
|
|
160
|
+
else lastDataCode = code;
|
|
161
|
+
if (out !== void 0) {
|
|
162
|
+
out[outLen] = code;
|
|
163
|
+
outLen += 1;
|
|
166
164
|
}
|
|
167
|
-
if (sawPadding || !isBase64DataChar(code)) return;
|
|
168
|
-
lastDataCode = code;
|
|
169
|
-
append(base64[i] ?? "");
|
|
170
165
|
}
|
|
166
|
+
const cleanedLength = out === void 0 ? base64.length : outLen;
|
|
171
167
|
if (cleanedLength === 0) return;
|
|
172
168
|
const remainder = cleanedLength % 4;
|
|
173
|
-
if (remainder !== 0)
|
|
174
|
-
if (sawPadding || remainder === 1) return;
|
|
175
|
-
current += "=".repeat(4 - remainder);
|
|
176
|
-
}
|
|
169
|
+
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
177
170
|
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
178
171
|
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
179
172
|
if (padBitMask !== 0 && (base64DataValue(lastDataCode) & padBitMask) !== 0) return;
|
|
180
|
-
|
|
181
|
-
return
|
|
173
|
+
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
174
|
+
return remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder);
|
|
182
175
|
}
|
|
183
176
|
//#endregion
|
|
184
177
|
//#region packages/ai/src/utils/credential-redaction.ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region packages/ai/src/provider-options.ts
|
|
2
|
+
const CODE_MODE_TOOL_SURFACE_OBSERVER = Symbol("openaiCodeModeToolSurfaceObserver");
|
|
3
|
+
const CODE_MODE_TOOL_SURFACE_COLLECTOR = Symbol("openaiCodeModeToolSurfaceCollector");
|
|
4
|
+
const codeModeToolSurfaceObserver = {
|
|
5
|
+
set(options, observer, collector) {
|
|
6
|
+
Reflect.set(options, CODE_MODE_TOOL_SURFACE_OBSERVER, observer);
|
|
7
|
+
if (collector) Reflect.set(options, CODE_MODE_TOOL_SURFACE_COLLECTOR, collector);
|
|
8
|
+
},
|
|
9
|
+
get(options) {
|
|
10
|
+
if (!options) return;
|
|
11
|
+
const observer = Reflect.get(options, CODE_MODE_TOOL_SURFACE_OBSERVER);
|
|
12
|
+
return typeof observer === "function" ? (observation) => observer(observation) : void 0;
|
|
13
|
+
},
|
|
14
|
+
getCollector(options) {
|
|
15
|
+
if (!options) return;
|
|
16
|
+
const collector = Reflect.get(options, CODE_MODE_TOOL_SURFACE_COLLECTOR);
|
|
17
|
+
return typeof collector === "function" ? (observation) => collector(observation) : void 0;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { codeModeToolSurfaceObserver as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as StreamOptions } from "./types-DhLoJbFm.mjs";
|
|
2
|
+
import "./types-GiAjXatj.mjs";
|
|
2
3
|
import OpenAI from "openai";
|
|
3
4
|
import Anthropic from "@anthropic-ai/sdk";
|
|
4
5
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
5
|
-
|
|
6
6
|
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
7
7
|
type OpenAIReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
8
8
|
type OpenAIApiReasoningEffort = OpenAIReasoningEffort | (string & {});
|
|
@@ -77,6 +77,16 @@ type OpenAIResponsesCompactionRejection = {
|
|
|
77
77
|
data: string;
|
|
78
78
|
id?: string;
|
|
79
79
|
};
|
|
80
|
+
type CodeModeToolSurfaceObservation = {
|
|
81
|
+
beforeToolIdentities: readonly string[];
|
|
82
|
+
afterToolIdentities: readonly string[];
|
|
83
|
+
};
|
|
84
|
+
type CodeModeToolSurfaceObserver = (observation: CodeModeToolSurfaceObservation) => void;
|
|
85
|
+
declare const codeModeToolSurfaceObserver: {
|
|
86
|
+
set(options: object, observer: CodeModeToolSurfaceObserver, collector?: CodeModeToolSurfaceObserver): void;
|
|
87
|
+
get(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
88
|
+
getCollector(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
89
|
+
};
|
|
80
90
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
81
91
|
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
82
92
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
@@ -132,7 +142,8 @@ type BaseOpenAIStreamOptions = StreamOptions & {
|
|
|
132
142
|
topP?: number;
|
|
133
143
|
authProfileId?: string;
|
|
134
144
|
firstEventTimeoutMs?: number;
|
|
135
|
-
onFirstEventTimeout?: (reason: Error) => void;
|
|
145
|
+
onFirstEventTimeout?: (reason: Error) => void;
|
|
146
|
+
/** Internal owner notification after a server rejects a persisted compaction checkpoint. */
|
|
136
147
|
onCompactionRejected?: (checkpoint: OpenAIResponsesCompactionRejection) => void;
|
|
137
148
|
openclawCodeModeToolSurface?: boolean;
|
|
138
149
|
openclawCodeModeAllowedHostedToolTypes?: Set<string>;
|
|
@@ -147,4 +158,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
147
158
|
reasoningEffort?: OpenAIReasoningEffort;
|
|
148
159
|
};
|
|
149
160
|
//#endregion
|
|
150
|
-
export {
|
|
161
|
+
export { supportsOpenAITemperature as C, supportsOpenAIReasoningEffort as S, isOpenAIGpt55Model as _, CodeModeToolSurfaceObservation as a, resolveOpenAIReasoningEffortForModel as b, codeModeToolSurfaceObserver as c, projectOpenAITools as d, reconcileOpenAICompletionsToolChoice as f, isOpenAIGpt54MiniModel as g, OpenAIReasoningEffort as h, BaseOpenAIStreamOptions as i, OpenAICompletionsToolChoice as l, OpenAIApiReasoningEffort as m, AnthropicOptions as n, OpenAICompletionsOptions as o, reconcileOpenAIResponsesToolChoice as p, AnthropicThinkingDisplay as r, OpenAIResponsesCompactionRejection as s, AnthropicEffort as t, OpenAIToolProjection as u, isOpenAIGpt56Model as v, resolveOpenAISupportedReasoningEfforts as x, normalizeOpenAIReasoningEffort as y };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { i as transformMessages } from "./host-D51fmkH6.mjs";
|
|
2
|
+
//#region packages/ai/src/provider-transcript-transform.ts
|
|
3
|
+
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
|
+
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
5
|
+
function projectUserMediaForTransport(content, supportsImages, supportsVideo) {
|
|
6
|
+
const result = [];
|
|
7
|
+
for (const block of content) {
|
|
8
|
+
if (block.type === "text" || block.type === "image" && supportsImages || block.type === "video" && supportsVideo) {
|
|
9
|
+
result.push(block);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const text = block.type === "video" ? VIDEO_OMISSION : IMAGE_OMISSION;
|
|
13
|
+
const previous = result.at(-1);
|
|
14
|
+
if (block.data.trim() && !(previous?.type === "text" && previous.text === text)) result.push({
|
|
15
|
+
type: "text",
|
|
16
|
+
text
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
22
|
+
const target = {
|
|
23
|
+
...model,
|
|
24
|
+
input: model.input.filter((type) => type !== "video")
|
|
25
|
+
};
|
|
26
|
+
return transformMessages(messages.map((message) => {
|
|
27
|
+
if (message.role !== "user" || !Array.isArray(message.content)) return message;
|
|
28
|
+
return Object.assign({}, message, { content: projectUserMediaForTransport(message.content, model.input.includes("image"), model.api === "openai-completions" && model.input.includes("video")) });
|
|
29
|
+
}), target, normalizeToolCallId);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { transformProviderMessages as t };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./anthropic-BECQCNdF.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-
|
|
3
|
+
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, F as ProviderImagesOptions, G as TextSignatureV1, 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, 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-DhLoJbFm.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-LiXePESD.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Dk7q7NMN.mjs";
|
|
6
|
+
import "./index-Qbej8io0.mjs";
|
|
7
|
+
import "./types-GiAjXatj.mjs";
|
|
6
8
|
//#region packages/ai/src/provider-types.d.ts
|
|
7
9
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
8
10
|
type VideoContent = Omit<ImageContent, "type"> & {
|
|
@@ -28,4 +30,4 @@ type ProviderStreamFunction<TApi extends Api = Api, TOptions extends StreamOptio
|
|
|
28
30
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
29
31
|
declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
30
32
|
//#endregion
|
|
31
|
-
export { type AnthropicMessagesCompat, type Api, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
|
|
33
|
+
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-CTd8NzcD.mjs";
|
|
2
2
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-2uo_1OR1.mjs";
|
|
3
|
-
|
|
4
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
5
4
|
/** Source id used for built-in API provider registrations. */
|
|
6
5
|
declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import { n as projectProviderError } from "./provider-error-
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-DDOs_Bz0.mjs";
|
|
3
3
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
5
5
|
/** Source id used for built-in API provider registrations. */
|
|
@@ -62,35 +62,35 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const registerBuiltIns = [
|
|
65
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
65
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-DI4PZKKB.mjs").then((n) => n.t), (module) => ({
|
|
66
66
|
stream: module.streamAnthropic,
|
|
67
67
|
streamSimple: module.streamSimpleAnthropic
|
|
68
68
|
})),
|
|
69
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
69
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-EFPiUGfS.mjs").then((n) => n.t), (module) => ({
|
|
70
70
|
stream: module.streamOpenAICompletions,
|
|
71
71
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
72
72
|
})),
|
|
73
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
73
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-EiHdymeb.mjs"), (module) => ({
|
|
74
74
|
stream: module.streamMistral,
|
|
75
75
|
streamSimple: module.streamSimpleMistral
|
|
76
76
|
})),
|
|
77
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
77
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-BogP8OjX.mjs").then((n) => n.t), (module) => ({
|
|
78
78
|
stream: module.streamOpenAIResponses,
|
|
79
79
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
80
80
|
})),
|
|
81
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
81
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-D8dI0ekg.mjs"), (module) => ({
|
|
82
82
|
stream: module.streamAzureOpenAIResponses,
|
|
83
83
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
84
84
|
})),
|
|
85
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
85
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-DHpF9o1e.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamOpenAICodexResponses,
|
|
87
87
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
88
88
|
})),
|
|
89
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
89
|
+
createLazyRegistration("google-generative-ai", () => import("./google-Od-LLdVK.mjs"), (module) => ({
|
|
90
90
|
stream: module.streamGoogle,
|
|
91
91
|
streamSimple: module.streamSimpleGoogle
|
|
92
92
|
})),
|
|
93
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex-
|
|
93
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-aerRSXc4.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|
|
@@ -12206,6 +12206,9 @@ function createReasoningTagTextPartitioner() {
|
|
|
12206
12206
|
hasPending() {
|
|
12207
12207
|
return holdStart !== void 0 && holdStart < source.length || reduction.depth > 0 || emitted < source.length;
|
|
12208
12208
|
},
|
|
12209
|
+
hasPendingSyntax() {
|
|
12210
|
+
return pendingTagProbe !== void 0 || heldBacktickStart !== void 0 || reduction.depth > 0;
|
|
12211
|
+
},
|
|
12209
12212
|
isInsideReasoning() {
|
|
12210
12213
|
return reduction.depth > 0;
|
|
12211
12214
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeNativeThinkingLevelMap } from "./
|
|
2
|
-
import "./src-D2H6yKkH.mjs";
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, l as resolveClaudeNativeThinkingLevelMap } from "./src-Bu3FiFAG.mjs";
|
|
3
2
|
//#region packages/ai/src/model-utils.ts
|
|
4
3
|
/** Calculates and stores model cost fields from token usage and per-million pricing. */
|
|
5
4
|
function calculateCost(model, usage) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
1
|
+
import { c as normalizeLowercaseStringOrEmpty } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.mjs";
|
|
3
|
+
import { r as copyProviderAcceptanceObserver } from "./transport-stream-shared-ljShVIZB.mjs";
|
|
3
4
|
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
4
5
|
/**
|
|
5
6
|
* Prompt-cache normalization helpers. They keep generated prompt sections
|
|
@@ -68,7 +69,7 @@ function prependSystemPromptAdditionAfterCacheBoundary(params) {
|
|
|
68
69
|
//#region packages/ai/src/providers/simple-options.ts
|
|
69
70
|
function buildBaseOptions(model, options, apiKey) {
|
|
70
71
|
const firstEventOptions = options;
|
|
71
|
-
return {
|
|
72
|
+
return copyProviderAcceptanceObserver(options, {
|
|
72
73
|
temperature: options?.temperature,
|
|
73
74
|
maxTokens: options?.maxTokens,
|
|
74
75
|
stop: options?.stop,
|
|
@@ -87,7 +88,7 @@ function buildBaseOptions(model, options, apiKey) {
|
|
|
87
88
|
maxRetries: options?.maxRetries,
|
|
88
89
|
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
89
90
|
metadata: options?.metadata
|
|
90
|
-
};
|
|
91
|
+
});
|
|
91
92
|
}
|
|
92
93
|
function clampMaxTokensToModel(model, requestedMaxTokens) {
|
|
93
94
|
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./validation-B61OhAio.mjs";
|
|
1
2
|
//#region packages/llm-core/src/model-contracts/anthropic.ts
|
|
2
3
|
function normalizeClaudeModelId(modelId) {
|
|
3
4
|
const normalized = modelId?.trim().toLowerCase() ?? "";
|
|
@@ -5,7 +6,6 @@ function normalizeClaudeModelId(modelId) {
|
|
|
5
6
|
}
|
|
6
7
|
const CLAUDE_FABLE_5_THINKING_PROFILE = {
|
|
7
8
|
levels: [
|
|
8
|
-
{ id: "off" },
|
|
9
9
|
{ id: "minimal" },
|
|
10
10
|
{ id: "low" },
|
|
11
11
|
{ id: "medium" },
|
|
@@ -5,6 +5,9 @@ function createSseByteGuard(reader, opts) {
|
|
|
5
5
|
let total = 0;
|
|
6
6
|
let overflowedFlag = false;
|
|
7
7
|
let cancelledFlag = false;
|
|
8
|
+
const cancelReaderBestEffort = (reason) => {
|
|
9
|
+
reader.cancel(reason).catch(() => void 0);
|
|
10
|
+
};
|
|
8
11
|
return {
|
|
9
12
|
read: async () => {
|
|
10
13
|
if (overflowedFlag || cancelledFlag) return {
|
|
@@ -22,9 +25,7 @@ function createSseByteGuard(reader, opts) {
|
|
|
22
25
|
size: next,
|
|
23
26
|
maxBytes: opts.maxBytes
|
|
24
27
|
});
|
|
25
|
-
|
|
26
|
-
await reader.cancel(err);
|
|
27
|
-
} catch {}
|
|
28
|
+
cancelReaderBestEffort(err);
|
|
28
29
|
throw err;
|
|
29
30
|
}
|
|
30
31
|
total = next;
|
|
@@ -33,9 +34,7 @@ function createSseByteGuard(reader, opts) {
|
|
|
33
34
|
cancel: async (reason) => {
|
|
34
35
|
if (overflowedFlag) return;
|
|
35
36
|
cancelledFlag = true;
|
|
36
|
-
|
|
37
|
-
await reader.cancel(reason);
|
|
38
|
-
} catch {}
|
|
37
|
+
cancelReaderBestEffort(reason);
|
|
39
38
|
},
|
|
40
39
|
totalBytes: () => total,
|
|
41
40
|
overflowed: () => overflowedFlag,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { d as normalizeOptionalString } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
+
//#region packages/normalization-core/src/string-normalization.ts
|
|
3
|
+
/** Coerces entries to strings, trims them, and drops empty results. */
|
|
4
|
+
function normalizeStringEntries(list) {
|
|
5
|
+
return (list ?? []).map((entry) => normalizeOptionalString(String(entry)) ?? "").filter(Boolean);
|
|
6
|
+
}
|
|
7
|
+
/** Returns first-seen unique values while preserving insertion order. */
|
|
8
|
+
function uniqueValues(values) {
|
|
9
|
+
return [...new Set(values)];
|
|
10
|
+
}
|
|
11
|
+
/** Returns first-seen unique strings while preserving insertion order. */
|
|
12
|
+
function uniqueStrings(values) {
|
|
13
|
+
return uniqueValues(values);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { uniqueStrings as n, uniqueValues as r, normalizeStringEntries as t };
|
package/dist/{tool-schema-json-projection-q5d7QX5c.mjs → tool-schema-json-projection-qvTEs5Am.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
+
import { n as getAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
3
3
|
import { types } from "node:util";
|
|
4
4
|
//#region packages/ai/src/transports/host-policy.ts
|
|
5
5
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
@@ -8,14 +8,23 @@ function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
|
8
8
|
if (timeoutMs !== void 0) return host.buildModelFetch(model, timeoutMs) ?? globalThis.fetch;
|
|
9
9
|
return host.buildModelFetch(model) ?? globalThis.fetch;
|
|
10
10
|
}
|
|
11
|
-
function resolveProviderEndpoint(
|
|
12
|
-
return { endpointClass: getAiTransportHost().
|
|
11
|
+
function resolveProviderEndpoint(model) {
|
|
12
|
+
return { endpointClass: getAiTransportHost().resolveProviderRequestCapabilities({
|
|
13
|
+
baseUrl: model.baseUrl,
|
|
14
|
+
model
|
|
15
|
+
}).endpointClass };
|
|
13
16
|
}
|
|
14
|
-
function resolveProviderRequestCapabilities(input) {
|
|
15
|
-
return getAiTransportHost().resolveProviderRequestCapabilities(
|
|
17
|
+
function resolveProviderRequestCapabilities(input, model) {
|
|
18
|
+
return getAiTransportHost().resolveProviderRequestCapabilities({
|
|
19
|
+
...input,
|
|
20
|
+
model
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
|
-
function resolveProviderRequestPolicyConfig(input) {
|
|
18
|
-
return { headers: getAiTransportHost().resolveProviderRequestHeaders(
|
|
23
|
+
function resolveProviderRequestPolicyConfig(model, input) {
|
|
24
|
+
return { headers: getAiTransportHost().resolveProviderRequestHeaders({
|
|
25
|
+
...input,
|
|
26
|
+
model
|
|
27
|
+
}) };
|
|
19
28
|
}
|
|
20
29
|
function resolveModelRequestTimeoutMs(model, timeoutMs) {
|
|
21
30
|
return timeoutMs ?? getAiTransportHost().resolveModelRequestTimeoutMs(model);
|