@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,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
4
|
-
import "./number-coercion-H9qHik3g.mjs";
|
|
1
|
+
import { a as asOptionalRecord, f as normalizeStringifiedOptionalString, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
+
import { n as estimateBase64DecodedBytes } from "./base64-CEFBpSkN.mjs";
|
|
5
3
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
6
4
|
function isJsonOpeningDelimiter(char, openers) {
|
|
7
5
|
return (char === "{" || char === "[") && openers.includes(char);
|
|
@@ -104,83 +102,6 @@ function compareStableStrings(left, right) {
|
|
|
104
102
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
105
103
|
}
|
|
106
104
|
//#endregion
|
|
107
|
-
//#region packages/media-core/src/base64.ts
|
|
108
|
-
/** Estimates decoded bytes without allocating a cleaned copy of the base64 payload. */
|
|
109
|
-
function estimateBase64DecodedBytes(base64) {
|
|
110
|
-
let effectiveLen = 0;
|
|
111
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
112
|
-
if (base64.charCodeAt(i) <= 32) continue;
|
|
113
|
-
effectiveLen += 1;
|
|
114
|
-
}
|
|
115
|
-
if (effectiveLen === 0) return 0;
|
|
116
|
-
let padding = 0;
|
|
117
|
-
let end = base64.length - 1;
|
|
118
|
-
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
119
|
-
if (end >= 0 && base64[end] === "=") {
|
|
120
|
-
padding = 1;
|
|
121
|
-
end -= 1;
|
|
122
|
-
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
123
|
-
if (end >= 0 && base64[end] === "=") padding = 2;
|
|
124
|
-
}
|
|
125
|
-
const estimated = Math.floor(effectiveLen * 3 / 4) - padding;
|
|
126
|
-
return Math.max(0, estimated);
|
|
127
|
-
}
|
|
128
|
-
const CANONICALIZE_BASE64_CHUNK_SIZE = 8192;
|
|
129
|
-
function isBase64DataChar(code) {
|
|
130
|
-
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
131
|
-
}
|
|
132
|
-
function base64DataValue(code) {
|
|
133
|
-
if (code >= 65 && code <= 90) return code - 65;
|
|
134
|
-
if (code >= 97 && code <= 122) return code - 97 + 26;
|
|
135
|
-
if (code >= 48 && code <= 57) return code - 48 + 52;
|
|
136
|
-
return code === 43 ? 62 : 63;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Normalizes and validates a base64 string, returning canonical no-whitespace
|
|
140
|
-
* base64 only when the input has valid alphabet, padding, and length.
|
|
141
|
-
*/
|
|
142
|
-
function canonicalizeBase64(base64) {
|
|
143
|
-
const chunks = [];
|
|
144
|
-
let current = "";
|
|
145
|
-
let cleanedLength = 0;
|
|
146
|
-
let padding = 0;
|
|
147
|
-
let sawPadding = false;
|
|
148
|
-
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
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
158
|
-
const code = base64.charCodeAt(i);
|
|
159
|
-
if (code <= 32) continue;
|
|
160
|
-
if (code === 61) {
|
|
161
|
-
padding += 1;
|
|
162
|
-
if (padding > 2) return;
|
|
163
|
-
sawPadding = true;
|
|
164
|
-
append("=");
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
if (sawPadding || !isBase64DataChar(code)) return;
|
|
168
|
-
lastDataCode = code;
|
|
169
|
-
append(base64[i] ?? "");
|
|
170
|
-
}
|
|
171
|
-
if (cleanedLength === 0) return;
|
|
172
|
-
const remainder = cleanedLength % 4;
|
|
173
|
-
if (remainder !== 0) {
|
|
174
|
-
if (sawPadding || remainder === 1) return;
|
|
175
|
-
current += "=".repeat(4 - remainder);
|
|
176
|
-
}
|
|
177
|
-
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
178
|
-
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
179
|
-
if (padBitMask !== 0 && (base64DataValue(lastDataCode) & padBitMask) !== 0) return;
|
|
180
|
-
if (current) chunks.push(current);
|
|
181
|
-
return chunks.join("");
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
105
|
//#region packages/ai/src/utils/credential-redaction.ts
|
|
185
106
|
const NON_CREDENTIAL_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
186
107
|
"passwordfile",
|
|
@@ -426,4 +347,4 @@ function projectProviderError(error, signal) {
|
|
|
426
347
|
}
|
|
427
348
|
}
|
|
428
349
|
//#endregion
|
|
429
|
-
export {
|
|
350
|
+
export { stableStringify as i, projectProviderError as n, projectDiagnosticValue as r, configureProviderErrorRedactor as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as StreamOptions } from "./types-h38Azne1.mjs";
|
|
2
|
+
import "./types-DtGu2d3C.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,24 @@ 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 function markStrictReasoningTagText(options: object): void;
|
|
86
|
+
declare function isStrictReasoningTagText(options: object | undefined): boolean;
|
|
87
|
+
declare const codeModeToolSurfaceObserver: {
|
|
88
|
+
set(options: object, observer: CodeModeToolSurfaceObserver, collector?: CodeModeToolSurfaceObserver): void;
|
|
89
|
+
get(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
90
|
+
getCollector(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
91
|
+
};
|
|
92
|
+
/** Internal output policy for callers that must not recover ambiguous reasoning as visible text. */
|
|
93
|
+
declare const reasoningTagTextPolicy: {
|
|
94
|
+
markStrict: typeof markStrictReasoningTagText;
|
|
95
|
+
isStrict: typeof isStrictReasoningTagText;
|
|
96
|
+
copy(source: object | undefined, target: object): void;
|
|
97
|
+
};
|
|
80
98
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
81
99
|
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
82
100
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
@@ -132,7 +150,8 @@ type BaseOpenAIStreamOptions = StreamOptions & {
|
|
|
132
150
|
topP?: number;
|
|
133
151
|
authProfileId?: string;
|
|
134
152
|
firstEventTimeoutMs?: number;
|
|
135
|
-
onFirstEventTimeout?: (reason: Error) => void;
|
|
153
|
+
onFirstEventTimeout?: (reason: Error) => void;
|
|
154
|
+
/** Internal owner notification after a server rejects a persisted compaction checkpoint. */
|
|
136
155
|
onCompactionRejected?: (checkpoint: OpenAIResponsesCompactionRejection) => void;
|
|
137
156
|
openclawCodeModeToolSurface?: boolean;
|
|
138
157
|
openclawCodeModeAllowedHostedToolTypes?: Set<string>;
|
|
@@ -147,4 +166,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
147
166
|
reasoningEffort?: OpenAIReasoningEffort;
|
|
148
167
|
};
|
|
149
168
|
//#endregion
|
|
150
|
-
export {
|
|
169
|
+
export { supportsOpenAIReasoningEffort as C, resolveOpenAISupportedReasoningEfforts as S, isOpenAIGpt54MiniModel as _, CodeModeToolSurfaceObservation as a, normalizeOpenAIReasoningEffort as b, codeModeToolSurfaceObserver as c, OpenAIToolProjection as d, projectOpenAITools as f, OpenAIReasoningEffort as g, OpenAIApiReasoningEffort as h, BaseOpenAIStreamOptions as i, reasoningTagTextPolicy as l, reconcileOpenAIResponsesToolChoice as m, AnthropicOptions as n, OpenAICompletionsOptions as o, reconcileOpenAICompletionsToolChoice as p, AnthropicThinkingDisplay as r, OpenAIResponsesCompactionRejection as s, AnthropicEffort as t, OpenAICompletionsToolChoice as u, isOpenAIGpt55Model as v, supportsOpenAITemperature as w, resolveOpenAIReasoningEffortForModel as x, isOpenAIGpt56Model 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,31 +1,32 @@
|
|
|
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, t as index_d_exports, 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-
|
|
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-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 "./types-DtGu2d3C.mjs";
|
|
6
7
|
//#region packages/ai/src/provider-types.d.ts
|
|
7
|
-
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
8
|
-
type VideoContent = Omit<ImageContent, "type"> & {
|
|
8
|
+
export declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
9
|
+
export type VideoContent = Omit<ImageContent, "type"> & {
|
|
9
10
|
type: "video";
|
|
10
11
|
};
|
|
11
|
-
type MediaContent = ImageContent | VideoContent;
|
|
12
|
-
type ModelInputContent = TextContent | MediaContent;
|
|
13
|
-
type ProviderUserMessage = Omit<UserMessage, "content"> & {
|
|
12
|
+
export type MediaContent = ImageContent | VideoContent;
|
|
13
|
+
export type ModelInputContent = TextContent | MediaContent;
|
|
14
|
+
export type ProviderUserMessage = Omit<UserMessage, "content"> & {
|
|
14
15
|
content: string | ModelInputContent[];
|
|
15
16
|
};
|
|
16
|
-
type ProviderMessage = ProviderUserMessage | AssistantMessage | ToolResultMessage;
|
|
17
|
-
type ProviderContext = Omit<Context, "messages"> & {
|
|
17
|
+
export type ProviderMessage = ProviderUserMessage | AssistantMessage | ToolResultMessage;
|
|
18
|
+
export type ProviderContext = Omit<Context, "messages"> & {
|
|
18
19
|
messages: ProviderMessage[];
|
|
19
20
|
};
|
|
20
|
-
type ProviderModel<TApi extends Api = Api> = Omit<Model<TApi>, "input"> & {
|
|
21
|
+
export type ProviderModel<TApi extends Api = Api> = Omit<Model<TApi>, "input"> & {
|
|
21
22
|
input: ModelInputContent["type"][];
|
|
22
23
|
};
|
|
23
|
-
type ProviderContextHandoff = () => Promise<ProviderContext>;
|
|
24
|
-
type ProviderStreamOptions = StreamOptions & {
|
|
24
|
+
export type ProviderContextHandoff = () => Promise<ProviderContext>;
|
|
25
|
+
export type ProviderStreamOptions = StreamOptions & {
|
|
25
26
|
[PROVIDER_CONTEXT_HANDOFF]?: ProviderContextHandoff;
|
|
26
27
|
};
|
|
27
|
-
type ProviderStreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = ProviderStreamOptions> = (model: ProviderModel<TApi>, context: ProviderContext, options?: TOptions) => AssistantMessageEventStreamContract;
|
|
28
|
+
export type ProviderStreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = ProviderStreamOptions> = (model: ProviderModel<TApi>, context: ProviderContext, options?: TOptions) => AssistantMessageEventStreamContract;
|
|
28
29
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
29
|
-
declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
30
|
+
export declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
30
31
|
//#endregion
|
|
31
|
-
export {
|
|
32
|
+
export type { 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, ProviderContext as Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, ProviderMessage as Message, ProviderModel as Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamFunction as StreamFunction, SimpleStreamOptions, StopReason, StreamFn, 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 };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-C9-wZd_W.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
|
-
declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
5
|
+
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
7
6
|
/** Registers every built-in API provider in one runtime registry. */
|
|
8
|
-
declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
|
|
7
|
+
export declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
|
|
9
8
|
/** Restores the built-in provider registry state for tests. */
|
|
10
|
-
declare function resetApiProviders(registry: ApiRegistry): void;
|
|
9
|
+
export declare function resetApiProviders(registry: ApiRegistry): void;
|
|
11
10
|
//#endregion
|
|
12
|
-
export {
|
|
11
|
+
export { OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey };
|
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-jZP5NMTZ.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-Djj7L1rx.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-BaTuwID7.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-BCnrI-kV.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-1GBcQujk.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-Bj3czHNa.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-CGBGWSqr.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-0Ca6TYbw.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-5dAMxprN.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
//#region node_modules/mdast-util-to-string/lib/index.js
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {import('mdast').Nodes} Nodes
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __exportAll = (all, no_symbols) => {
|
|
5
|
+
let target = {};
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
return target;
|
|
12
|
+
};
|
|
13
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
14
|
+
//#endregion
|
|
15
|
+
export { __require as n, __exportAll as t };
|
|
@@ -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-CT5ycdzn.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
|
|
@@ -65,10 +66,45 @@ function prependSystemPromptAdditionAfterCacheBoundary(params) {
|
|
|
65
66
|
return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}\n\n${dynamicSuffix}`;
|
|
66
67
|
}
|
|
67
68
|
//#endregion
|
|
69
|
+
//#region packages/ai/src/provider-options.ts
|
|
70
|
+
const CODE_MODE_TOOL_SURFACE_OBSERVER = Symbol("openaiCodeModeToolSurfaceObserver");
|
|
71
|
+
const CODE_MODE_TOOL_SURFACE_COLLECTOR = Symbol("openaiCodeModeToolSurfaceCollector");
|
|
72
|
+
const STRICT_REASONING_TAG_TEXT = Symbol("openaiStrictReasoningTagText");
|
|
73
|
+
function markStrictReasoningTagText(options) {
|
|
74
|
+
Reflect.set(options, STRICT_REASONING_TAG_TEXT, true);
|
|
75
|
+
}
|
|
76
|
+
function isStrictReasoningTagText(options) {
|
|
77
|
+
return options ? Reflect.get(options, STRICT_REASONING_TAG_TEXT) === true : false;
|
|
78
|
+
}
|
|
79
|
+
const codeModeToolSurfaceObserver = {
|
|
80
|
+
set(options, observer, collector) {
|
|
81
|
+
Reflect.set(options, CODE_MODE_TOOL_SURFACE_OBSERVER, observer);
|
|
82
|
+
if (collector) Reflect.set(options, CODE_MODE_TOOL_SURFACE_COLLECTOR, collector);
|
|
83
|
+
},
|
|
84
|
+
get(options) {
|
|
85
|
+
if (!options) return;
|
|
86
|
+
const observer = Reflect.get(options, CODE_MODE_TOOL_SURFACE_OBSERVER);
|
|
87
|
+
return typeof observer === "function" ? (observation) => observer(observation) : void 0;
|
|
88
|
+
},
|
|
89
|
+
getCollector(options) {
|
|
90
|
+
if (!options) return;
|
|
91
|
+
const collector = Reflect.get(options, CODE_MODE_TOOL_SURFACE_COLLECTOR);
|
|
92
|
+
return typeof collector === "function" ? (observation) => collector(observation) : void 0;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/** Internal output policy for callers that must not recover ambiguous reasoning as visible text. */
|
|
96
|
+
const reasoningTagTextPolicy = {
|
|
97
|
+
markStrict: markStrictReasoningTagText,
|
|
98
|
+
isStrict: isStrictReasoningTagText,
|
|
99
|
+
copy(source, target) {
|
|
100
|
+
if (isStrictReasoningTagText(source)) markStrictReasoningTagText(target);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
68
104
|
//#region packages/ai/src/providers/simple-options.ts
|
|
69
105
|
function buildBaseOptions(model, options, apiKey) {
|
|
70
106
|
const firstEventOptions = options;
|
|
71
|
-
|
|
107
|
+
const baseOptions = {
|
|
72
108
|
temperature: options?.temperature,
|
|
73
109
|
maxTokens: options?.maxTokens,
|
|
74
110
|
stop: options?.stop,
|
|
@@ -88,6 +124,8 @@ function buildBaseOptions(model, options, apiKey) {
|
|
|
88
124
|
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
89
125
|
metadata: options?.metadata
|
|
90
126
|
};
|
|
127
|
+
reasoningTagTextPolicy.copy(options, baseOptions);
|
|
128
|
+
return copyProviderAcceptanceObserver(options, baseOptions);
|
|
91
129
|
}
|
|
92
130
|
function clampMaxTokensToModel(model, requestedMaxTokens) {
|
|
93
131
|
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens));
|
|
@@ -114,4 +152,4 @@ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLeve
|
|
|
114
152
|
};
|
|
115
153
|
}
|
|
116
154
|
//#endregion
|
|
117
|
-
export {
|
|
155
|
+
export { codeModeToolSurfaceObserver as a, ensureSystemPromptCacheBoundary as c, stripSystemPromptCacheBoundary as d, normalizePromptCapabilityIds as f, clampReasoning as i, prependSystemPromptAdditionAfterCacheBoundary as l, sortPromptCacheToolsByName as m, buildBaseOptions as n, reasoningTagTextPolicy as o, normalizeStructuredPromptSection as p, clampMaxTokensToModel as r, SYSTEM_PROMPT_CACHE_BOUNDARY as s, adjustMaxTokensForThinking as t, splitSystemPromptCacheBoundary as u };
|
|
@@ -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" },
|
package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as clampTimerTimeoutMs } from "./base64-CEFBpSkN.mjs";
|
|
2
2
|
//#region packages/ai/src/utils/stream-first-event-timeout.ts
|
|
3
3
|
function getFirstStreamEventTimeoutMs(options) {
|
|
4
4
|
return options?.firstEventTimeoutMs;
|
|
@@ -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);
|