@openclaw/ai 2026.8.1-beta.3 → 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-B8KwTtlb.mjs → anthropic-Djj7L1rx.mjs} +21 -21
- package/dist/{anthropic-compaction-replay-4Zx7-aCr.mjs → anthropic-compaction-replay-CY4tkD4V.mjs} +33 -34
- package/dist/{anthropic-payload-policy-CSx7MoKH.d.mts → anthropic-payload-policy-i_5_inWe.d.mts} +3 -2
- package/dist/{api-registry-DFxSnFqG.d.mts → api-registry-C9-wZd_W.d.mts} +2 -1
- package/dist/{azure-openai-responses-Aa4mVcYG.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-D91-ohD_.d.mts → event-stream-UhnxHuqt.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-yDRnipeq.mjs → google-0Ca6TYbw.mjs} +4 -4
- package/dist/{google-shared-M1dl64nz.mjs → google-shared-DVfL9COU.mjs} +14 -7
- package/dist/{google-vertex-DCJHM_a5.mjs → google-vertex-5dAMxprN.mjs} +4 -4
- package/dist/{host-DF_yxOsA.mjs → host-D51fmkH6.mjs} +4 -8
- package/dist/{host-DJq_FGcz.d.mts → host-DoPJJ1KD.d.mts} +3 -3
- 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 +51 -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 -9
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +51 -40
- package/dist/internal/runtime.mjs +9 -9
- package/dist/internal/shared.d.mts +25 -25
- package/dist/internal/shared.mjs +3 -3
- package/dist/{json-parse-CDnesDM_.mjs → json-parse-BuAJEbdW.mjs} +18 -2
- package/dist/{mistral-D6hRXI7A.mjs → mistral-BCnrI-kV.mjs} +22 -25
- package/dist/{openai-chatgpt-responses-C339VIfT.mjs → openai-chatgpt-responses-CGBGWSqr.mjs} +31 -14
- package/dist/openai-completions-BaTuwID7.mjs +401 -0
- package/dist/{openai-completions-compat-B0KTleXp.d.mts → openai-completions-compat-DB7FFq7k.d.mts} +3 -3
- package/dist/openai-completions-stream-Bpns6uNc.mjs +1622 -0
- package/dist/{openai-responses-BXEcr-Tp.mjs → openai-responses-1GBcQujk.mjs} +8 -6
- package/dist/openai-responses-compaction-window-DwydGZI8.mjs +686 -0
- package/dist/{openai-responses-contracts-CD75pQ0m.d.mts → openai-responses-contracts-DgaR3t5T.d.mts} +14 -5
- package/dist/{openai-responses-payload-policy-CNGFT9zr.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +1 -0
- package/dist/{openai-responses-prompt-observer-internal-BG-1AsBI.mjs → openai-responses-prompt-observer-internal-_nhGTn2b.mjs} +3 -2
- package/dist/{openai-responses-shared-Cvt5MgEm.mjs → openai-responses-shared-zPmKnhF5.mjs} +315 -1468
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-Dgl4H2MU.mjs +1695 -0
- package/dist/{provider-error-C8mBRJDl.mjs → provider-error-jZP5NMTZ.mjs} +3 -77
- package/dist/{provider-options-Cc5ZQ6Aa.d.mts → provider-options-HvA_slFa.d.mts} +13 -4
- package/dist/{provider-transcript-transform--gtf0ZbR.mjs → provider-transcript-transform-C01bQ5a3.mjs} +1 -1
- 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-5ygO2rZc.mjs → reasoning-tag-text-partitioner-CwzKb0bA.mjs} +1 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-BP7HLLZn.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/simple-options-DKx86yX9.mjs +155 -0
- package/dist/{anthropic-BQXQudmA.mjs → src-Bu3FiFAG.mjs} +1 -0
- 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-FEr-jOoZ.mjs → tool-schema-json-projection-qvTEs5Am.mjs} +2 -2
- package/dist/{simple-options-oqsXB6U3.mjs → transport-stream-shared-CT5ycdzn.mjs} +10 -118
- package/dist/transport-stream-shared-NjwWNaRY.d.mts +138 -0
- package/dist/{transport-utils-Bv0FHkd0.mjs → transport-utils-BHx9z8Cl.mjs} +9 -9
- package/dist/transports.d.mts +127 -189
- package/dist/transports.mjs +181 -1214
- package/dist/types-DtGu2d3C.d.mts +1 -0
- package/dist/{types-DTAP49HF.d.mts → types-h38Azne1.d.mts} +38 -17
- package/dist/types.d.mts +5 -4
- package/dist/types.mjs +1 -2
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DYNNrU9u.d.mts → validation-C68lP2uy.d.mts} +1 -2
- package/dist/validation.d.mts +1 -1
- package/package.json +6 -6
- package/dist/anthropic-BECQCNdF.d.mts +0 -98
- package/dist/event-stream-BVVgDSdq.d.mts +0 -1
- package/dist/headers-B_e4-1J0.mjs +0 -9
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/openai-completions-D88orSJ9.mjs +0 -632
- package/dist/openai-responses-contracts-DvILoqBk.mjs +0 -247
- package/dist/openai-responses-payload-policy-BDo8CQsx.mjs +0 -208
- package/dist/openai-stop-reason-9OONKyAm.mjs +0 -579
- package/dist/openai-tool-projection-CHGLt03m.mjs +0 -426
- package/dist/provider-options-AvldWZt8.mjs +0 -21
- 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,78 +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
|
-
function isBase64DataChar(code) {
|
|
129
|
-
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
130
|
-
}
|
|
131
|
-
function base64DataValue(code) {
|
|
132
|
-
if (code >= 65 && code <= 90) return code - 65;
|
|
133
|
-
if (code >= 97 && code <= 122) return code - 97 + 26;
|
|
134
|
-
if (code >= 48 && code <= 57) return code - 48 + 52;
|
|
135
|
-
return code === 43 ? 62 : 63;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Normalizes and validates a base64 string, returning canonical no-whitespace
|
|
139
|
-
* base64 only when the input has valid alphabet, padding, and length.
|
|
140
|
-
*/
|
|
141
|
-
function canonicalizeBase64(base64) {
|
|
142
|
-
let out;
|
|
143
|
-
let outLen = 0;
|
|
144
|
-
let padding = 0;
|
|
145
|
-
let sawPadding = false;
|
|
146
|
-
let lastDataCode = 0;
|
|
147
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
148
|
-
const code = base64.charCodeAt(i);
|
|
149
|
-
if (code <= 32) {
|
|
150
|
-
if (out === void 0) {
|
|
151
|
-
out = Buffer.allocUnsafe(base64.length - 1);
|
|
152
|
-
for (let j = 0; j < i; j += 1) out[j] = base64.charCodeAt(j);
|
|
153
|
-
outLen = i;
|
|
154
|
-
}
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (code === 61) {
|
|
158
|
-
padding += 1;
|
|
159
|
-
if (padding > 2) return;
|
|
160
|
-
sawPadding = true;
|
|
161
|
-
} else if (sawPadding || !isBase64DataChar(code)) return;
|
|
162
|
-
else lastDataCode = code;
|
|
163
|
-
if (out !== void 0) {
|
|
164
|
-
out[outLen] = code;
|
|
165
|
-
outLen += 1;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const cleanedLength = out === void 0 ? base64.length : outLen;
|
|
169
|
-
if (cleanedLength === 0) return;
|
|
170
|
-
const remainder = cleanedLength % 4;
|
|
171
|
-
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
172
|
-
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
173
|
-
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
174
|
-
if (padBitMask !== 0 && (base64DataValue(lastDataCode) & padBitMask) !== 0) return;
|
|
175
|
-
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
176
|
-
return remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder);
|
|
177
|
-
}
|
|
178
|
-
//#endregion
|
|
179
105
|
//#region packages/ai/src/utils/credential-redaction.ts
|
|
180
106
|
const NON_CREDENTIAL_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
181
107
|
"passwordfile",
|
|
@@ -421,4 +347,4 @@ function projectProviderError(error, signal) {
|
|
|
421
347
|
}
|
|
422
348
|
}
|
|
423
349
|
//#endregion
|
|
424
|
-
export {
|
|
350
|
+
export { stableStringify as i, projectProviderError as n, projectDiagnosticValue as r, configureProviderErrorRedactor as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { U as StreamOptions } from "./types-
|
|
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 & {});
|
|
@@ -82,11 +82,19 @@ type CodeModeToolSurfaceObservation = {
|
|
|
82
82
|
afterToolIdentities: readonly string[];
|
|
83
83
|
};
|
|
84
84
|
type CodeModeToolSurfaceObserver = (observation: CodeModeToolSurfaceObservation) => void;
|
|
85
|
+
declare function markStrictReasoningTagText(options: object): void;
|
|
86
|
+
declare function isStrictReasoningTagText(options: object | undefined): boolean;
|
|
85
87
|
declare const codeModeToolSurfaceObserver: {
|
|
86
88
|
set(options: object, observer: CodeModeToolSurfaceObserver, collector?: CodeModeToolSurfaceObserver): void;
|
|
87
89
|
get(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
88
90
|
getCollector(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
89
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
|
+
};
|
|
90
98
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
91
99
|
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
92
100
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
@@ -142,7 +150,8 @@ type BaseOpenAIStreamOptions = StreamOptions & {
|
|
|
142
150
|
topP?: number;
|
|
143
151
|
authProfileId?: string;
|
|
144
152
|
firstEventTimeoutMs?: number;
|
|
145
|
-
onFirstEventTimeout?: (reason: Error) => void;
|
|
153
|
+
onFirstEventTimeout?: (reason: Error) => void;
|
|
154
|
+
/** Internal owner notification after a server rejects a persisted compaction checkpoint. */
|
|
146
155
|
onCompactionRejected?: (checkpoint: OpenAIResponsesCompactionRejection) => void;
|
|
147
156
|
openclawCodeModeToolSurface?: boolean;
|
|
148
157
|
openclawCodeModeAllowedHostedToolTypes?: Set<string>;
|
|
@@ -157,4 +166,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
157
166
|
reasoningEffort?: OpenAIReasoningEffort;
|
|
158
167
|
};
|
|
159
168
|
//#endregion
|
|
160
|
-
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-D51fmkH6.mjs";
|
|
2
2
|
//#region packages/ai/src/provider-transcript-transform.ts
|
|
3
3
|
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
4
|
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
@@ -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 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-
|
|
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
|
}))
|
|
@@ -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) {
|
|
@@ -0,0 +1,155 @@
|
|
|
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";
|
|
4
|
+
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
5
|
+
/**
|
|
6
|
+
* Prompt-cache normalization helpers. They keep generated prompt sections
|
|
7
|
+
* deterministic across platform newlines, trailing whitespace, and input
|
|
8
|
+
* ordering.
|
|
9
|
+
*/
|
|
10
|
+
/** Canonicalizes provider tool order without relying on host locale settings. */
|
|
11
|
+
function sortPromptCacheToolsByName(tools) {
|
|
12
|
+
const compareText = (left, right) => {
|
|
13
|
+
const leftText = left ?? "";
|
|
14
|
+
const rightText = right ?? "";
|
|
15
|
+
return leftText < rightText ? -1 : leftText > rightText ? 1 : 0;
|
|
16
|
+
};
|
|
17
|
+
return tools.toSorted((left, right) => compareText(left.wireName ?? left.name, right.wireName ?? right.name) || compareText(left.description, right.description));
|
|
18
|
+
}
|
|
19
|
+
/** Normalize structured prompt text before hashing or snapshot comparison. */
|
|
20
|
+
function normalizeStructuredPromptSection(text) {
|
|
21
|
+
return sanitizeSurrogates(text).replace(/\r\n?/g, "\n").replace(/[ \t]+$/gm, "").trim();
|
|
22
|
+
}
|
|
23
|
+
/** Normalize, de-dupe, and sort capability ids for stable prompt payloads. */
|
|
24
|
+
function normalizePromptCapabilityIds(capabilities) {
|
|
25
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26
|
+
const normalized = [];
|
|
27
|
+
for (const capability of capabilities) {
|
|
28
|
+
const value = normalizeLowercaseStringOrEmpty(normalizeStructuredPromptSection(capability));
|
|
29
|
+
if (!value || seen.has(value)) continue;
|
|
30
|
+
seen.add(value);
|
|
31
|
+
normalized.push(value);
|
|
32
|
+
}
|
|
33
|
+
return normalized.toSorted((left, right) => left.localeCompare(right));
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region packages/ai/src/utils/system-prompt-cache-boundary.ts
|
|
37
|
+
/**
|
|
38
|
+
* System prompt cache-boundary helpers.
|
|
39
|
+
*
|
|
40
|
+
* Keeps stable prompt prefixes separate from dynamic runtime additions for provider prompt caching.
|
|
41
|
+
*/
|
|
42
|
+
const SYSTEM_PROMPT_CACHE_BOUNDARY = "\n<!-- OPENCLAW_CACHE_BOUNDARY -->\n";
|
|
43
|
+
function stripSystemPromptCacheBoundary(text) {
|
|
44
|
+
return text.replaceAll(SYSTEM_PROMPT_CACHE_BOUNDARY, "\n");
|
|
45
|
+
}
|
|
46
|
+
function ensureSystemPromptCacheBoundary(systemPrompt) {
|
|
47
|
+
if (systemPrompt.trim().length === 0) return systemPrompt;
|
|
48
|
+
return systemPrompt.includes("\n<!-- OPENCLAW_CACHE_BOUNDARY -->\n") ? systemPrompt : `${systemPrompt}${SYSTEM_PROMPT_CACHE_BOUNDARY}`;
|
|
49
|
+
}
|
|
50
|
+
function splitSystemPromptCacheBoundary(text) {
|
|
51
|
+
const boundaryIndex = text.indexOf(SYSTEM_PROMPT_CACHE_BOUNDARY);
|
|
52
|
+
if (boundaryIndex === -1) return;
|
|
53
|
+
return {
|
|
54
|
+
stablePrefix: text.slice(0, boundaryIndex).trimEnd(),
|
|
55
|
+
dynamicSuffix: text.slice(boundaryIndex + 34).trimStart()
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function prependSystemPromptAdditionAfterCacheBoundary(params) {
|
|
59
|
+
const systemPromptAddition = typeof params.systemPromptAddition === "string" ? normalizeStructuredPromptSection(params.systemPromptAddition) : "";
|
|
60
|
+
if (!systemPromptAddition) return params.systemPrompt;
|
|
61
|
+
if (params.systemPrompt.trim().length === 0) return systemPromptAddition;
|
|
62
|
+
const split = splitSystemPromptCacheBoundary(params.systemPrompt);
|
|
63
|
+
if (!split) return `${systemPromptAddition}\n\n${params.systemPrompt}`;
|
|
64
|
+
const dynamicSuffix = split.dynamicSuffix ? normalizeStructuredPromptSection(split.dynamicSuffix) : "";
|
|
65
|
+
if (!dynamicSuffix) return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}`;
|
|
66
|
+
return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}\n\n${dynamicSuffix}`;
|
|
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
|
|
104
|
+
//#region packages/ai/src/providers/simple-options.ts
|
|
105
|
+
function buildBaseOptions(model, options, apiKey) {
|
|
106
|
+
const firstEventOptions = options;
|
|
107
|
+
const baseOptions = {
|
|
108
|
+
temperature: options?.temperature,
|
|
109
|
+
maxTokens: options?.maxTokens,
|
|
110
|
+
stop: options?.stop,
|
|
111
|
+
signal: options?.signal,
|
|
112
|
+
apiKey: apiKey || options?.apiKey,
|
|
113
|
+
transport: options?.transport,
|
|
114
|
+
cacheRetention: options?.cacheRetention,
|
|
115
|
+
sessionId: options?.sessionId,
|
|
116
|
+
promptCacheKey: options?.promptCacheKey,
|
|
117
|
+
headers: options?.headers,
|
|
118
|
+
onPayload: options?.onPayload,
|
|
119
|
+
onResponse: options?.onResponse,
|
|
120
|
+
timeoutMs: options?.timeoutMs,
|
|
121
|
+
firstEventTimeoutMs: firstEventOptions?.firstEventTimeoutMs,
|
|
122
|
+
onFirstEventTimeout: firstEventOptions?.onFirstEventTimeout,
|
|
123
|
+
maxRetries: options?.maxRetries,
|
|
124
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
125
|
+
metadata: options?.metadata
|
|
126
|
+
};
|
|
127
|
+
reasoningTagTextPolicy.copy(options, baseOptions);
|
|
128
|
+
return copyProviderAcceptanceObserver(options, baseOptions);
|
|
129
|
+
}
|
|
130
|
+
function clampMaxTokensToModel(model, requestedMaxTokens) {
|
|
131
|
+
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens));
|
|
132
|
+
}
|
|
133
|
+
function clampReasoning(effort) {
|
|
134
|
+
return effort === "xhigh" ? "high" : effort;
|
|
135
|
+
}
|
|
136
|
+
function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
|
|
137
|
+
const budgets = {
|
|
138
|
+
minimal: 1024,
|
|
139
|
+
low: 2048,
|
|
140
|
+
medium: 8192,
|
|
141
|
+
high: 16384,
|
|
142
|
+
max: 32768,
|
|
143
|
+
...customBudgets
|
|
144
|
+
};
|
|
145
|
+
const minOutputTokens = 1024;
|
|
146
|
+
let thinkingBudget = budgets[clampReasoning(reasoningLevel)];
|
|
147
|
+
const maxTokens = baseMaxTokens === void 0 ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);
|
|
148
|
+
if (maxTokens <= thinkingBudget) thinkingBudget = Math.max(0, maxTokens - minOutputTokens);
|
|
149
|
+
return {
|
|
150
|
+
maxTokens,
|
|
151
|
+
thinkingBudget
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
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 };
|
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-FEr-jOoZ.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) {
|