@openclaw/ai 2026.9.4 → 2026.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{anthropic-C4Qu4H0Z.mjs → anthropic-COtDvgtt.mjs} +10 -11
- package/dist/{anthropic-payload-policy-BZ8umAbk.d.mts → anthropic-payload-policy-5Erq1Nzy.d.mts} +3 -3
- package/dist/{anthropic-stream-reducer-CILWF7JD.mjs → anthropic-stream-reducer-BvdYYWL8.mjs} +47 -43
- package/dist/{api-registry-ByUwIR0e.d.mts → api-registry-Ba2Cv-ut.d.mts} +2 -2
- package/dist/{assistant-output-tLt4H-iQ.mjs → assistant-output-BsEkB-vU.mjs} +1 -1
- package/dist/{azure-openai-responses-BAlqlKKc.mjs → azure-openai-responses-YrgnD583.mjs} +6 -9
- package/dist/{base64-D-su8YVo.mjs → base64-BQOzsvUH.mjs} +4 -4
- package/dist/credential-redaction-BKv49aiv.d.mts +24 -0
- package/dist/{diagnostics-QuErwCIl.mjs → diagnostics-Dm4bisWG.mjs} +89 -2
- package/dist/diagnostics.d.mts +4 -23
- package/dist/diagnostics.mjs +3 -3
- package/dist/{event-stream-Bt5Y4Pav.d.mts → event-stream-CCoa-qSI.d.mts} +1 -1
- package/dist/event-stream-DmSCpi1T.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{google-DPBAOaOW.mjs → google-BuhpRO9r.mjs} +6 -9
- package/dist/{google-messages-6JkpHrhJ.mjs → google-messages-CyWnYlh0.mjs} +3 -3
- package/dist/{google-shared-BvBeW9aq.mjs → google-shared-BT5ZeNer.mjs} +13 -13
- package/dist/{google-vertex-k-TMCAYD.mjs → google-vertex-C7EplRvt.mjs} +5 -8
- package/dist/{host-B8YfDGd4.mjs → host-B4MeUNBc.mjs} +25 -27
- package/dist/{host-4atIX-2V.d.mts → host-FZ1RA_qD.d.mts} +5 -3
- package/dist/{host-policy-Zcg_cNz8.mjs → host-policy-DUnXSx0I.mjs} +1 -1
- package/dist/{index-DdD3qerf.d.mts → index-DaF2QbwS.d.mts} +4 -9
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +3 -4
- package/dist/internal/anthropic.d.mts +6 -7
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-completions-compat.d.mts +2 -0
- package/dist/internal/openai-completions-compat.mjs +2 -0
- 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 +10 -53
- package/dist/internal/openai.mjs +11 -9
- package/dist/internal/runtime.d.mts +6 -8
- package/dist/internal/runtime.mjs +5 -9
- package/dist/internal/shared.d.mts +6 -5
- package/dist/internal/shared.mjs +4 -3
- package/dist/internal/tool-schema.d.mts +3 -3
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-CxUZ1jUb.mjs → mistral-moA-mbwl.mjs} +9 -13
- package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-DWID3EFO.mjs} +73 -29
- package/dist/{openai-completions-yJuk7eis.mjs → openai-completions-DJ1Vm-CD.mjs} +11 -12
- package/dist/{openai-prompt-cache-Bds-n_9Q.mjs → openai-completions-compat-CkwdxTZx.mjs} +5 -50
- package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-JE7gqxb9.d.mts} +4 -4
- package/dist/{openai-completions-stream-Da2vvl-S.mjs → openai-completions-stream-Bu98b0Hv.mjs} +94 -96
- package/dist/openai-prompt-cache-1wfaIszn.mjs +46 -0
- package/dist/{openai-prompt-cache-B4eYo2-I.d.mts → openai-prompt-cache-CJ_xEevu.d.mts} +2 -2
- package/dist/{openai-provider-client-S2gCrM2Z.mjs → openai-provider-client-DPo0Hmak.mjs} +2 -2
- package/dist/openai-reasoning-effort-NlFZmfEu.mjs +235 -0
- package/dist/{openai-responses-DaYwH05E.mjs → openai-responses-BejZzQCP.mjs} +8 -12
- package/dist/{openai-responses-compaction-window-CIhBAkkq.mjs → openai-responses-compaction-window-D6P5oZP5.mjs} +20 -62
- package/dist/openai-responses-contracts-DWrfMODE.mjs +81 -0
- package/dist/{openai-responses-contracts-BjBAqAg_.d.mts → openai-responses-contracts-Dflvrfa8.d.mts} +9 -5
- package/dist/{openai-responses-payload-policy-rLRPsSmB.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +5 -3
- package/dist/openai-responses-prompt-observer-internal-C15_-OwV.mjs +195 -0
- package/dist/{openai-responses-shared-B8RdBPCv.mjs → openai-responses-shared-CwsziD_m.mjs} +385 -178
- package/dist/openai-responses-terminal-usage-Dl3J6zrf.d.mts +47 -0
- package/dist/{openai-tool-schema-CzjyYXun.mjs → openai-tool-schema-BO8rwyAD.mjs} +92 -68
- package/dist/{openai-transport-params-9aPuV5YY.mjs → openai-transport-params-DQeuAvBl.mjs} +157 -47
- package/dist/{positive-integer-41zhOdcV.mjs → positive-integer-DtjCkbue.mjs} +1 -1
- package/dist/{provider-error-BA-v_tKd.mjs → provider-error-DDqw9Qda.mjs} +100 -38
- package/dist/{provider-options-Ceqv1OKk.d.mts → provider-options-DprLsWh9.d.mts} +9 -6
- package/dist/{provider-replay-context-CJ_YvcEW.mjs → provider-replay-context-CnUSOwhr.mjs} +1 -1
- package/dist/{provider-transcript-transform-V5YzU9zh.mjs → provider-transcript-transform-BsRAhuWJ.mjs} +1 -1
- package/dist/{provider-transport-turn-state-D5EXOFL2.mjs → provider-transport-turn-state-CkGToCD2.mjs} +1 -1
- package/dist/{provider-types-CVjKjsuq.d.mts → provider-types-CAKRC7N5.d.mts} +3 -3
- package/dist/provider-types.d.mts +5 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-BcR5pztD.mjs → reasoning-tag-text-partitioner-Dy9IO8Dc.mjs} +15 -7
- package/dist/{simple-options-BQbb4yQL.mjs → simple-options-C6cFWj_f.mjs} +5 -3
- package/dist/{usage-cost-BNWbbXav.mjs → src-DeKjbE8I.mjs} +3 -5
- package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-C9ZadkJW.mjs} +1 -1
- package/dist/{string-normalization-CmLIasuf.mjs → string-normalization-J9ZiLfGO.mjs} +13 -1
- package/dist/tool-schema-json-projection-CD9c_fK8.mjs +134 -0
- package/dist/{transport-stream-shared-DNvmoWnv.d.mts → transport-stream-shared-BbUkFaHi.d.mts} +4 -4
- package/dist/{transport-stream-shared-zHll9BxO.mjs → transport-stream-shared-D-6FQSHm.mjs} +14 -14
- package/dist/{transport-utils-zrYjICLZ.mjs → transport-utils-1cyq5Y7x.mjs} +3 -3
- package/dist/transports.d.mts +26 -12
- package/dist/transports.mjs +130 -449
- package/dist/{types-Ntv5z2g2.d.mts → types-4_uVs5WH.d.mts} +47 -3
- package/dist/types-DkJfb4W3.d.mts +1 -0
- package/dist/types.d.mts +5 -6
- package/dist/types.mjs +2 -3
- package/dist/{validation-B0t_G2H6.d.mts → validation-Ctzu2DhF.d.mts} +1 -1
- package/dist/{validation-BDzVDnTs.mjs → validation-Dw7cb6BV.mjs} +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +10 -5
- package/dist/diagnostics-DnPnOui6.d.mts +0 -29
- package/dist/event-stream-C3WGFsum.d.mts +0 -1
- package/dist/openai-responses-contracts-DDOHA62Y.mjs +0 -245
- package/dist/openai-responses-prompt-observer-internal-f8J7wpsk.mjs +0 -32
- package/dist/src-DDmEryvj.mjs +0 -2
- package/dist/tool-schema-json-projection-ClptDdAO.mjs +0 -82
- package/dist/types-DlfwzH3T.d.mts +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { o as normalizeStringifiedOptionalString } from "./string-coerce-fsri9iCu.mjs";
|
|
2
2
|
import { i as asOptionalRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
3
3
|
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
|
|
5
|
+
import { n as estimateBase64DecodedBytes } from "./base64-BQOzsvUH.mjs";
|
|
5
6
|
import { parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
|
|
6
7
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
7
8
|
function isJsonOpeningDelimiter(char, openers) {
|
|
@@ -47,12 +48,54 @@ function extractBalancedJsonFragments(raw, opts = {}) {
|
|
|
47
48
|
return fragments;
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
|
-
//#region packages/normalization-core/src/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
//#region packages/normalization-core/src/cjk-chars.ts
|
|
52
|
+
const WEIGHTED_CJK_RANGES = [
|
|
53
|
+
[
|
|
54
|
+
[183, 183],
|
|
55
|
+
[12288, 12703],
|
|
56
|
+
[19968, 40869],
|
|
57
|
+
[44032, 55215],
|
|
58
|
+
[65281, 65376]
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
[4352, 4607],
|
|
62
|
+
[11904, 12287],
|
|
63
|
+
[12704, 19967],
|
|
64
|
+
[40870, 40959],
|
|
65
|
+
[40960, 42239],
|
|
66
|
+
[42752, 42759],
|
|
67
|
+
[43360, 43391],
|
|
68
|
+
[55216, 55295],
|
|
69
|
+
[63744, 64255]
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
[711, 711],
|
|
73
|
+
[713, 715],
|
|
74
|
+
[729, 729],
|
|
75
|
+
[746, 747],
|
|
76
|
+
[773, 773],
|
|
77
|
+
[803, 803],
|
|
78
|
+
[65040, 65103],
|
|
79
|
+
[65377, 65500],
|
|
80
|
+
[65504, 65510]
|
|
81
|
+
],
|
|
82
|
+
[[119648, 119665]],
|
|
83
|
+
[
|
|
84
|
+
[94176, 94207],
|
|
85
|
+
[110576, 110591],
|
|
86
|
+
[110592, 110959],
|
|
87
|
+
[127488, 127743],
|
|
88
|
+
[131072, 195103],
|
|
89
|
+
[196608, 210047]
|
|
90
|
+
]
|
|
91
|
+
];
|
|
92
|
+
new RegExp(`[${WEIGHTED_CJK_RANGES.flatMap((ranges) => ranges.map(([start, end]) => `\\u{${start.toString(16)}}-\\u{${end.toString(16)}}`)).join("")}]`, "u");
|
|
93
|
+
(() => {
|
|
94
|
+
const maxCodePoint = Math.max(...WEIGHTED_CJK_RANGES.flatMap((ranges) => ranges.map(([, end]) => end)));
|
|
95
|
+
const categories = new Uint8Array(maxCodePoint + 1);
|
|
96
|
+
for (const [bucket, ranges] of WEIGHTED_CJK_RANGES.entries()) for (const [start, end] of ranges) categories.fill(bucket + 1, start, end + 1);
|
|
97
|
+
return categories;
|
|
98
|
+
})();
|
|
56
99
|
//#endregion
|
|
57
100
|
//#region packages/normalization-core/src/stable-stringify.ts
|
|
58
101
|
const preserveString = (value) => value;
|
|
@@ -91,14 +134,15 @@ function stringifyObjectValue(value, stack, normalizeString) {
|
|
|
91
134
|
}
|
|
92
135
|
const record = value;
|
|
93
136
|
if (normalizeString === preserveString) {
|
|
94
|
-
const fields =
|
|
95
|
-
|
|
137
|
+
const fields = Object.keys(record).sort();
|
|
138
|
+
let fieldIndex = 0;
|
|
139
|
+
for (const key of fields) fields[fieldIndex++] = `${JSON.stringify(key)}:${stringifyStableValue(record[key], stack, normalizeString)}`;
|
|
96
140
|
return `{${fields.join(",")}}`;
|
|
97
141
|
}
|
|
98
142
|
const entries = Object.keys(record).map((key) => ({
|
|
99
143
|
key,
|
|
100
144
|
normalizedKey: normalizeString(key)
|
|
101
|
-
})).
|
|
145
|
+
})).sort((left, right) => {
|
|
102
146
|
return compareStableStrings(left.normalizedKey, right.normalizedKey) || compareStableStrings(left.key, right.key);
|
|
103
147
|
});
|
|
104
148
|
const serializedFields = [];
|
|
@@ -128,6 +172,19 @@ const MEDIA_PAYLOAD_SUFFIXES = "base64|blob|buffer|bytes|data|delta|frames?|outp
|
|
|
128
172
|
const MEDIA_FIELD_NAME_RE = new RegExp(`^(?:input|output)?(?:audio|image|video)s?(?:${MEDIA_PAYLOAD_SUFFIXES})*$`, "u");
|
|
129
173
|
const MEDIA_PAYLOAD_SUFFIX_RE = new RegExp(`^(?:${MEDIA_PAYLOAD_SUFFIXES})$`, "u");
|
|
130
174
|
const MEDIA_WRAPPER_NAME_RE = /^(?:input_|output_)?(?:audio|image|video)s?(?:_|$)/iu;
|
|
175
|
+
const DIAGNOSTIC_FIELD_SEPARATOR_RE = /[^a-z0-9]/g;
|
|
176
|
+
const MEDIA_TYPE_RE = /^(?:input|output)?(?:audio|image|video)/u;
|
|
177
|
+
const MEDIA_MIME_RE = /^(?:audio|image|video)\//iu;
|
|
178
|
+
const MEDIA_ARRAY_INDEX_RE = /^(?:0|[1-9]\d*)$/u;
|
|
179
|
+
const MEDIA_URL_SUFFIX_RE = /(?:uri|url)$/u;
|
|
180
|
+
const MEDIA_MIME_FIELDS = [
|
|
181
|
+
"mimeType",
|
|
182
|
+
"mime_type",
|
|
183
|
+
"mediaType",
|
|
184
|
+
"media_type",
|
|
185
|
+
"contentType",
|
|
186
|
+
"content_type"
|
|
187
|
+
];
|
|
131
188
|
const AUTHORIZATION_VALUE_RE = /\b(Bearer|Basic)\s+[A-Za-z0-9+/._~=-]{8,}/giu;
|
|
132
189
|
const JWT_VALUE_RE = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/gu;
|
|
133
190
|
const COOKIE_HEADER_RE = /\b((?:set-)?cookie\s*:\s*)([^\r\n]+)/giu;
|
|
@@ -170,7 +227,7 @@ function hasSensitiveProseContent(value) {
|
|
|
170
227
|
return false;
|
|
171
228
|
}
|
|
172
229
|
function normalizeDiagnosticFieldName(value) {
|
|
173
|
-
return value.toLowerCase().replaceAll(
|
|
230
|
+
return value.toLowerCase().replaceAll(DIAGNOSTIC_FIELD_SEPARATOR_RE, "");
|
|
174
231
|
}
|
|
175
232
|
function isCredentialFieldName(normalized) {
|
|
176
233
|
if (!normalized || NON_CREDENTIAL_FIELD_NAMES.has(normalized)) return false;
|
|
@@ -184,27 +241,19 @@ function diagnosticBytes(value, numericArrays = false) {
|
|
|
184
241
|
}
|
|
185
242
|
function isDiagnosticMediaPayload(descriptors) {
|
|
186
243
|
const type = descriptors.type?.value;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
"mime_type",
|
|
190
|
-
"mediaType",
|
|
191
|
-
"media_type",
|
|
192
|
-
"contentType",
|
|
193
|
-
"content_type"
|
|
194
|
-
].some((key) => {
|
|
244
|
+
if (typeof type === "string" && MEDIA_TYPE_RE.test(normalizeDiagnosticFieldName(type))) return true;
|
|
245
|
+
for (const key of MEDIA_MIME_FIELDS) {
|
|
195
246
|
const mime = descriptors[key]?.value;
|
|
196
|
-
|
|
197
|
-
}
|
|
247
|
+
if (typeof mime === "string" && MEDIA_MIME_RE.test(mime)) return true;
|
|
248
|
+
}
|
|
249
|
+
return false;
|
|
198
250
|
}
|
|
199
251
|
function extractDiagnosticMediaField(key, normalized, value, parentMedia) {
|
|
200
252
|
const privateField = normalized === "b64json";
|
|
201
253
|
const mediaField = MEDIA_FIELD_NAME_RE.test(normalized) || MEDIA_WRAPPER_NAME_RE.test(key);
|
|
202
254
|
const contextualPayload = parentMedia && MEDIA_PAYLOAD_SUFFIX_RE.test(normalized);
|
|
203
|
-
if (!privateField && !mediaField && !contextualPayload) {
|
|
204
|
-
|
|
205
|
-
return parentMedia && nestedMedia ? { kind: "context" } : void 0;
|
|
206
|
-
}
|
|
207
|
-
if (/(?:uri|url)$/u.test(normalized)) return { kind: "redacted" };
|
|
255
|
+
if (!privateField && !mediaField && !contextualPayload) return parentMedia && value !== null && (typeof value === "object" || MEDIA_ARRAY_INDEX_RE.test(key)) ? { kind: "context" } : void 0;
|
|
256
|
+
if (MEDIA_URL_SUFFIX_RE.test(normalized)) return { kind: "redacted" };
|
|
208
257
|
const encoded = diagnosticBytes(value, true) ?? (typeof value === "string" ? value : void 0);
|
|
209
258
|
if (encoded === void 0) return { kind: privateField || Array.isArray(value) ? "redacted" : "context" };
|
|
210
259
|
return {
|
|
@@ -213,6 +262,13 @@ function extractDiagnosticMediaField(key, normalized, value, parentMedia) {
|
|
|
213
262
|
source: encoded
|
|
214
263
|
};
|
|
215
264
|
}
|
|
265
|
+
const diagnosticRecords = /* @__PURE__ */ new WeakSet();
|
|
266
|
+
/** Fresh records need no native-object probe while their prototype stays ordinary. */
|
|
267
|
+
function createDiagnosticRecord() {
|
|
268
|
+
const record = {};
|
|
269
|
+
diagnosticRecords.add(record);
|
|
270
|
+
return record;
|
|
271
|
+
}
|
|
216
272
|
function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new WeakSet(), mediaPayload = false, state = {
|
|
217
273
|
changed: false,
|
|
218
274
|
nodesRemaining: 64
|
|
@@ -237,24 +293,28 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
237
293
|
state.changed = true;
|
|
238
294
|
return "[Truncated]";
|
|
239
295
|
}
|
|
240
|
-
try {
|
|
296
|
+
if (!diagnosticRecords.has(value) || Object.getPrototypeOf(value) !== Object.prototype) try {
|
|
241
297
|
Headers.prototype.has.call(value, "retry-after");
|
|
242
298
|
const seconds = parseRetryAfterHeadersSeconds(value);
|
|
243
299
|
state.changed = true;
|
|
244
300
|
return seconds === void 0 ? {} : { "retry-after-ms": seconds * 1e3 };
|
|
245
301
|
} catch {}
|
|
246
|
-
const keys = Reflect.ownKeys(value)
|
|
247
|
-
const descriptors = Object.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
302
|
+
const keys = Reflect.ownKeys(value);
|
|
303
|
+
const descriptors = Object.create(null);
|
|
304
|
+
for (let index = 0; index < Math.min(keys.length, 64); index += 1) {
|
|
305
|
+
const key = keys[index];
|
|
306
|
+
if (typeof key !== "string") continue;
|
|
307
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
308
|
+
if (descriptor) descriptors[key] = descriptor;
|
|
309
|
+
}
|
|
251
310
|
state.changed ||= keys.length > 64;
|
|
252
311
|
seen.add(value);
|
|
253
312
|
const out = Array.isArray(value) ? [] : {};
|
|
254
313
|
const rawName = typeof descriptors.name?.value === "string" ? descriptors.name.value : descriptors.key?.value;
|
|
255
314
|
const redactValueField = keys.length > 64 || typeof rawName === "string" && isCredentialFieldName(normalizeDiagnosticFieldName(rawName));
|
|
256
315
|
const redactMedia = mediaPayload || keys.length > 64 || isDiagnosticMediaPayload(descriptors);
|
|
257
|
-
for (const
|
|
316
|
+
for (const key in descriptors) {
|
|
317
|
+
const descriptor = expectDefined(descriptors[key], "diagnostic descriptor");
|
|
258
318
|
if (!("value" in descriptor) || !descriptor.enumerable && (policy.propertyScope === "enumerable" || ![
|
|
259
319
|
"cause",
|
|
260
320
|
"errors",
|
|
@@ -349,11 +409,14 @@ function readCauseCode(error) {
|
|
|
349
409
|
if (code) return code;
|
|
350
410
|
}
|
|
351
411
|
}
|
|
412
|
+
function truncateField(text, maxLength) {
|
|
413
|
+
return text.length <= maxLength ? text : `${truncateUtf16Safe(text, maxLength)}... [truncated]`;
|
|
414
|
+
}
|
|
352
415
|
function stringifyField(value, maxLength) {
|
|
353
416
|
if (value === void 0 || value === null) return;
|
|
354
417
|
const text = redactDiagnosticText((typeof value === "string" ? value : stableStringify(value)).trim());
|
|
355
418
|
if (!text) return;
|
|
356
|
-
return
|
|
419
|
+
return maxLength === void 0 ? text : truncateField(text, maxLength);
|
|
357
420
|
}
|
|
358
421
|
function buildProjection(snapshot, signal) {
|
|
359
422
|
const error = asOptionalRecord(snapshot);
|
|
@@ -365,8 +428,7 @@ function buildProjection(snapshot, signal) {
|
|
|
365
428
|
response?.status,
|
|
366
429
|
response?.statusCode
|
|
367
430
|
].find((value) => typeof value === "number" && Number.isFinite(value));
|
|
368
|
-
const
|
|
369
|
-
const body = stringifyField(bodyValue, MAX_ERROR_BODY_LENGTH);
|
|
431
|
+
const body = stringifyField(error?.errorBody ?? error?.body ?? response?.body ?? response?.data ?? nestedError);
|
|
370
432
|
const originalMessage = (typeof snapshot === "string" ? snapshot : void 0) ?? readProviderErrorField(error, "message") ?? readProviderErrorField(nestedError, "message");
|
|
371
433
|
const genericMessage = originalMessage === `${status} status code (no body)`;
|
|
372
434
|
let errorMessage = status !== void 0 && body && (!originalMessage || genericMessage) ? `${status}: ${body}` : originalMessage ?? body ?? stringifyField(snapshot, MAX_ERROR_BODY_LENGTH) ?? "Unknown provider error";
|
|
@@ -380,7 +442,7 @@ function buildProjection(snapshot, signal) {
|
|
|
380
442
|
errorMessage: stringifyField(errorMessage, 4096) ?? "Unknown provider error",
|
|
381
443
|
...errorCode ? { errorCode: truncateUtf16Safe(errorCode, 256) } : {},
|
|
382
444
|
...errorType ? { errorType: truncateUtf16Safe(errorType, 256) } : {},
|
|
383
|
-
...body ? { errorBody:
|
|
445
|
+
...body ? { errorBody: truncateField(body, 500) } : {}
|
|
384
446
|
};
|
|
385
447
|
}
|
|
386
448
|
/** Projects one hostile provider throw into final, bounded assistant terminal fields. */
|
|
@@ -406,4 +468,4 @@ function projectProviderError(error, signal) {
|
|
|
406
468
|
}
|
|
407
469
|
}
|
|
408
470
|
//#endregion
|
|
409
|
-
export {
|
|
471
|
+
export { redactDiagnosticText as a, projectDiagnosticValue as i, projectProviderError as n, stableStringify as o, createDiagnosticRecord as r, configureProviderErrorRedactor as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Y as StreamOptions } from "./types-
|
|
1
|
+
import { Y as StreamOptions } from "./types-4_uVs5WH.mjs";
|
|
2
2
|
import { t as OpenAICompletionsToolChoice } from "./openai-tool-projection-793cE3QX.mjs";
|
|
3
|
-
import "./types-
|
|
3
|
+
import "./types-DkJfb4W3.mjs";
|
|
4
4
|
import Anthropic from "@anthropic-ai/sdk";
|
|
5
5
|
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
6
|
-
|
|
6
|
+
declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
7
|
+
type OpenAIReasoningEffort = "none" | (typeof ENABLED_REASONING_EFFORTS)[number];
|
|
7
8
|
type OpenAIApiReasoningEffort = OpenAIReasoningEffort | (string & {});
|
|
8
9
|
type OpenAIReasoningModel = {
|
|
9
10
|
provider?: unknown;
|
|
@@ -32,6 +33,8 @@ declare function resolveOpenAIModelReasoningEfforts(model: OpenAIReasoningModel)
|
|
|
32
33
|
declare function supportsOpenAITemperature(model: OpenAIReasoningModel): boolean;
|
|
33
34
|
/** Return whether a model accepts a requested reasoning effort. */
|
|
34
35
|
declare function supportsOpenAIReasoningEffort(model: OpenAIReasoningModel, effort: string): boolean;
|
|
36
|
+
/** Read provider mappings without folding provider-native labels. */
|
|
37
|
+
declare function resolveOpenAIReasoningEffortMapping(effort: string, mapping: Record<string, string> | undefined): string | undefined;
|
|
35
38
|
/** Resolve a requested reasoning effort to the closest value supported by the model. */
|
|
36
39
|
declare function resolveOpenAIReasoningEffortForModel(params: {
|
|
37
40
|
model: OpenAIReasoningModel;
|
|
@@ -139,8 +142,8 @@ type BaseOpenAIStreamOptions = StreamOptions & {
|
|
|
139
142
|
/** Superset retained under the provider's published compatibility type name. */
|
|
140
143
|
type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
141
144
|
toolChoice?: OpenAICompletionsToolChoice;
|
|
142
|
-
reasoning?: OpenAIReasoningEffort;
|
|
143
|
-
reasoningEffort?: OpenAIReasoningEffort;
|
|
145
|
+
reasoning?: OpenAIReasoningEffort | "off";
|
|
146
|
+
reasoningEffort?: OpenAIReasoningEffort | "off";
|
|
144
147
|
};
|
|
145
148
|
//#endregion
|
|
146
|
-
export { resolveOpenAIModelReasoningEfforts as _, BaseOpenAIStreamOptions as a,
|
|
149
|
+
export { supportsOpenAITemperature as S, resolveOpenAIModelReasoningEfforts as _, BaseOpenAIStreamOptions as a, resolveOpenAISupportedReasoningEfforts as b, OpenAIResponsesCompactionRejection as c, OpenAIApiReasoningEffort as d, OpenAIReasoningEffort as f, normalizeOpenAIReasoningEffort as g, isOpenAIGpt56Model as h, AnthropicThinkingDisplay as i, codeModeToolSurfaceObserver as l, isOpenAIGpt55Model as m, AnthropicEffort as n, CodeModeToolSurfaceObservation as o, isOpenAIGpt54MiniModel as p, AnthropicOptions as r, OpenAICompletionsOptions as s, AnthropicContextManagementOptions as t, reasoningTagTextPolicy as u, resolveOpenAIReasoningEffortForModel as v, supportsOpenAIReasoningEffort as x, resolveOpenAIReasoningEffortMapping as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as shortHash } from "./transport-stream-shared-
|
|
1
|
+
import { k as shortHash } from "./transport-stream-shared-D-6FQSHm.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/provider-replay-context.ts
|
|
3
3
|
function hashReplayContextValue(value) {
|
|
4
4
|
const normalized = value?.trim();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-B4MeUNBc.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,4 +1,4 @@
|
|
|
1
|
-
import { n as getAiTransportHost } from "./host-
|
|
1
|
+
import { n as getAiTransportHost } from "./host-B4MeUNBc.mjs";
|
|
2
2
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-Bcunsn4I.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region packages/ai/src/transports/provider-transport-turn-state.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as index_d_exports } from "./index-
|
|
2
|
-
import { O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, f as ImageContent, it as ToolResultMessage, n as Api, s as AssistantMessageEventStreamContract, st as UserMessage } from "./types-
|
|
3
|
-
import "./types-
|
|
1
|
+
import { t as index_d_exports } from "./index-DaF2QbwS.mjs";
|
|
2
|
+
import { O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, f as ImageContent, it as ToolResultMessage, n as Api, s as AssistantMessageEventStreamContract, st as UserMessage } from "./types-4_uVs5WH.mjs";
|
|
3
|
+
import "./types-DkJfb4W3.mjs";
|
|
4
4
|
//#region packages/ai/src/provider-types.d.ts
|
|
5
5
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
6
|
type VideoContent = Omit<ImageContent, "type"> & {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-
|
|
2
|
-
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, et as ThinkingLevel, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as
|
|
6
|
-
import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-CVjKjsuq.mjs";
|
|
1
|
+
import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-DaF2QbwS.mjs";
|
|
2
|
+
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-4_uVs5WH.mjs";
|
|
3
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CCoa-qSI.mjs";
|
|
4
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Ctzu2DhF.mjs";
|
|
5
|
+
import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-CAKRC7N5.mjs";
|
|
7
6
|
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 MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, 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 PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RawModelCostConfig, type RawPricingTier, 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 bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type isProviderRefusalAssistantError, type normalizeModelCostConfig, type normalizeResolvedPricing, 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,5 +1,5 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-Ba2Cv-ut.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CJ_xEevu.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
5
5
|
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
2
|
-
import { n as projectProviderError } from "./provider-error-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-DDqw9Qda.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-1wfaIszn.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
5
5
|
/** Source id used for built-in API provider registrations. */
|
|
6
6
|
const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
@@ -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-COtDvgtt.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-DJ1Vm-CD.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-moA-mbwl.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-BejZzQCP.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-YrgnD583.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-DWID3EFO.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-BuhpRO9r.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-C7EplRvt.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import
|
|
2
|
+
import "./provider-error-DDqw9Qda.mjs";
|
|
3
|
+
import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
|
|
3
4
|
//#region node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
|
|
4
5
|
/**
|
|
5
6
|
* @typedef {import('mdast').Nodes} Nodes
|
|
@@ -11732,6 +11733,7 @@ function parseMarkdownOwnership(text, options) {
|
|
|
11732
11733
|
if (!text) return {
|
|
11733
11734
|
regions: [],
|
|
11734
11735
|
codeSpans: [],
|
|
11736
|
+
textSpans: [],
|
|
11735
11737
|
retainStart: 0
|
|
11736
11738
|
};
|
|
11737
11739
|
const sources = /* @__PURE__ */ new Map();
|
|
@@ -11741,11 +11743,13 @@ function parseMarkdownOwnership(text, options) {
|
|
|
11741
11743
|
mdastExtensions: [...tables ? [gfmTableFromMarkdown()] : [], ...options?.includeSource ? [captureInlineSources(text, sources)] : []]
|
|
11742
11744
|
});
|
|
11743
11745
|
const regions = [];
|
|
11746
|
+
const textSpans = [];
|
|
11744
11747
|
const pending = [tree];
|
|
11745
11748
|
while (pending.length > 0) {
|
|
11746
11749
|
const node = expectDefined(pending.pop(), "Markdown ownership node");
|
|
11747
11750
|
const start = node.position?.start?.offset;
|
|
11748
11751
|
const end = node.position?.end?.offset;
|
|
11752
|
+
if (options?.includeText && node.type === "text" && start !== void 0 && end !== void 0) textSpans.push([start, end]);
|
|
11749
11753
|
if ((node.type === "code" || node.type === "inlineCode") && start !== void 0 && end !== void 0) {
|
|
11750
11754
|
const source = sources.get(start);
|
|
11751
11755
|
if (source) while (source.offsets.length <= end - start) source.offsets.push(source.value.length);
|
|
@@ -11762,6 +11766,7 @@ function parseMarkdownOwnership(text, options) {
|
|
|
11762
11766
|
return {
|
|
11763
11767
|
regions,
|
|
11764
11768
|
codeSpans: regions.map(({ start, end }) => [start, end]),
|
|
11769
|
+
textSpans,
|
|
11765
11770
|
retainStart: tree.children?.at(-1)?.position?.start?.offset ?? text.length
|
|
11766
11771
|
};
|
|
11767
11772
|
}
|
|
@@ -11967,7 +11972,7 @@ function createReasoningTagTextPartitioner() {
|
|
|
11967
11972
|
else target.push({ ...addition });
|
|
11968
11973
|
}
|
|
11969
11974
|
};
|
|
11970
|
-
const emitSafePrefix = (limit, output) => {
|
|
11975
|
+
const emitSafePrefix = (limit, output, appended) => {
|
|
11971
11976
|
if (strictMode) {
|
|
11972
11977
|
holdStart ??= emitted;
|
|
11973
11978
|
return;
|
|
@@ -11998,10 +12003,14 @@ function createReasoningTagTextPartitioner() {
|
|
|
11998
12003
|
return;
|
|
11999
12004
|
}
|
|
12000
12005
|
if (holdStart !== void 0 || emitted >= limit) return;
|
|
12006
|
+
const appendedStart = source.length - (appended?.length ?? 0);
|
|
12007
|
+
const useAppended = appended !== void 0 && emitted >= appendedStart;
|
|
12008
|
+
const scanSource = useAppended ? appended : source;
|
|
12009
|
+
const scanOffset = useAppended ? appendedStart : 0;
|
|
12001
12010
|
while (emitted < limit && holdStart === void 0) {
|
|
12002
12011
|
let special = -1;
|
|
12003
12012
|
for (let index = emitted; index < limit; index += 1) {
|
|
12004
|
-
const char =
|
|
12013
|
+
const char = scanSource.charAt(index - scanOffset);
|
|
12005
12014
|
if (char === "<" || char === "`") {
|
|
12006
12015
|
special = index;
|
|
12007
12016
|
break;
|
|
@@ -12013,7 +12022,7 @@ function createReasoningTagTextPartitioner() {
|
|
|
12013
12022
|
holdStart = emitted;
|
|
12014
12023
|
return;
|
|
12015
12024
|
}
|
|
12016
|
-
const text =
|
|
12025
|
+
const text = scanSource.slice(emitted - scanOffset, end - scanOffset);
|
|
12017
12026
|
if (text) {
|
|
12018
12027
|
merge(output, [{
|
|
12019
12028
|
kind: "text",
|
|
@@ -12186,14 +12195,13 @@ function createReasoningTagTextPartitioner() {
|
|
|
12186
12195
|
const output = [];
|
|
12187
12196
|
if (final) processBlock(source.length, true, output);
|
|
12188
12197
|
else {
|
|
12189
|
-
emitSafePrefix(source.length, output);
|
|
12198
|
+
emitSafePrefix(source.length, output, appended);
|
|
12190
12199
|
if (!strictMode && holdStart !== void 0 && holdStart < source.length) {
|
|
12191
12200
|
const ownershipStart = heldBacktickStart ?? holdStart;
|
|
12192
12201
|
const heldLineStart = Math.max(source.lastIndexOf("\n", Math.max(0, ownershipStart - 1)), source.lastIndexOf("\r", Math.max(0, ownershipStart - 1))) + 1;
|
|
12193
12202
|
const heldLineEnd = findNextLineEnding(source, ownershipStart);
|
|
12194
12203
|
const tableLookaheadPending = source.slice(heldLineStart, heldLineEnd === -1 ? source.length : heldLineEnd).includes("|") && (heldLineEnd === -1 || findNextLineEnding(source, heldLineEnd + (source.charAt(heldLineEnd) === "\r" && source.charAt(heldLineEnd + 1) === "\n" ? 2 : 1)) === -1);
|
|
12195
12204
|
const completedBlankBlock = endedBlankBlock;
|
|
12196
|
-
const retainedContainerContext = MARKDOWN_CONTAINER_LINE_RE.test(source.slice(nonFinalRetainStart));
|
|
12197
12205
|
const heldBacktick = heldBacktickStart !== void 0;
|
|
12198
12206
|
let openingRunEnd = ownershipStart;
|
|
12199
12207
|
while (source.charAt(openingRunEnd) === "`") openingRunEnd += 1;
|
|
@@ -12202,7 +12210,7 @@ function createReasoningTagTextPartitioner() {
|
|
|
12202
12210
|
const shouldTryParser = pendingTagProbe ? pendingTagProbe.resolved : reduction.depth > 0 ? appended.includes("<") : !heldBacktick || hasLaterBacktick && terminatedBacktickTail || completedBlankBlock;
|
|
12203
12211
|
const mayResolveHeldReasoning = reduction.depth > 0 && !nonFinalCloseReparseUsed && (appended.includes("<") || appended.includes(">")) && scanReasoningTags(source.slice(holdStart), false).tags.some((tag) => tag.isClose);
|
|
12204
12212
|
const reusableCodeSpans = nonFinalCodeSpansEnd === source.length ? nonFinalCodeSpans : void 0;
|
|
12205
|
-
const mayCloseTopLevelBlock = completedBlankBlock &&
|
|
12213
|
+
const mayCloseTopLevelBlock = completedBlankBlock && !nonFinalOpenEndedCode && (appendedStartsTopLevelBlock || !MARKDOWN_CONTAINER_LINE_RE.test(source.slice(nonFinalRetainStart)));
|
|
12206
12214
|
if ((shouldTryParser || mayResolveHeldReasoning) && !tableLookaheadPending && (reusableCodeSpans !== void 0 || nonFinalFullParses < 1 || mayCloseTopLevelBlock || mayResolveHeldReasoning)) {
|
|
12207
12215
|
if (!reusableCodeSpans) nonFinalFullParses += 1;
|
|
12208
12216
|
const ownership = reusableCodeSpans ? void 0 : parseMarkdownOwnership(source);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
2
|
-
import { v as sanitizeSurrogates } from "./host-
|
|
3
|
-
import { i as copyProviderAcceptanceObserver } from "./transport-stream-shared-
|
|
2
|
+
import { v as sanitizeSurrogates } from "./host-B4MeUNBc.mjs";
|
|
3
|
+
import { i as copyProviderAcceptanceObserver } from "./transport-stream-shared-D-6FQSHm.mjs";
|
|
4
4
|
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
5
5
|
/**
|
|
6
6
|
* Prompt-cache normalization helpers. They keep generated prompt sections
|
|
@@ -125,7 +125,9 @@ function buildBaseOptions(model, options, apiKey) {
|
|
|
125
125
|
const firstEventOptions = options;
|
|
126
126
|
const baseOptions = {
|
|
127
127
|
temperature: options?.temperature,
|
|
128
|
+
...options?.serviceTier ? { serviceTier: options.serviceTier } : {},
|
|
128
129
|
maxTokens: options?.maxTokens,
|
|
130
|
+
responseFormat: options?.responseFormat,
|
|
129
131
|
stop: options?.stop,
|
|
130
132
|
signal: options?.signal,
|
|
131
133
|
apiKey: apiKey || options?.apiKey,
|
|
@@ -146,7 +148,7 @@ function buildBaseOptions(model, options, apiKey) {
|
|
|
146
148
|
return copyProviderAcceptanceObserver(options, baseOptions);
|
|
147
149
|
}
|
|
148
150
|
function clampMaxTokensToModel(model, requestedMaxTokens) {
|
|
149
|
-
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens));
|
|
151
|
+
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens ?? requestedMaxTokens));
|
|
150
152
|
}
|
|
151
153
|
function clampReasoning(effort) {
|
|
152
154
|
return effort === "xhigh" ? "high" : effort;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./validation-Dw7cb6BV.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,15 +6,13 @@ function normalizeClaudeModelId(modelId) {
|
|
|
5
6
|
}
|
|
6
7
|
const CLAUDE_FABLE_5_THINKING_PROFILE = {
|
|
7
8
|
levels: [
|
|
8
|
-
{ id: "minimal" },
|
|
9
9
|
{ id: "low" },
|
|
10
10
|
{ id: "medium" },
|
|
11
11
|
{ id: "high" },
|
|
12
12
|
{ id: "xhigh" },
|
|
13
|
-
{ id: "adaptive" },
|
|
14
13
|
{ id: "max" }
|
|
15
14
|
],
|
|
16
|
-
defaultLevel: "
|
|
15
|
+
defaultLevel: "medium",
|
|
17
16
|
preserveWhenCatalogReasoningFalse: true
|
|
18
17
|
};
|
|
19
18
|
const CLAUDE_SONNET_5_THINKING_PROFILE = {
|
|
@@ -33,8 +32,7 @@ const CLAUDE_OPUS_5_THINKING_PROFILE = CLAUDE_SONNET_5_THINKING_PROFILE;
|
|
|
33
32
|
/** Resolve the canonical normalized Claude model id for one runtime model ref. */
|
|
34
33
|
function resolveClaudeModelIdentity(ref) {
|
|
35
34
|
const normalized = normalizeClaudeModelId((typeof ref.params?.canonicalModelId === "string" ? ref.params.canonicalModelId : void 0) ?? ref.id);
|
|
36
|
-
|
|
37
|
-
return match ? normalized.slice((match.index ?? 0) + (match[0].startsWith("claude-") ? 0 : 1)) : normalized;
|
|
35
|
+
return /(?:^|[-/])(claude-[^/]+)$/.exec(normalized)?.[1] ?? normalized;
|
|
38
36
|
}
|
|
39
37
|
/** Resolve Claude Fable 5 through direct ids, cloud ids, or deployment metadata. */
|
|
40
38
|
function resolveClaudeFable5ModelIdentity(ref) {
|
package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-C9ZadkJW.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as clampTimerTimeoutMs } from "./base64-
|
|
1
|
+
import { a as clampTimerTimeoutMs } from "./base64-BQOzsvUH.mjs";
|
|
2
2
|
//#region packages/ai/src/utils/stream-first-event-timeout.ts
|
|
3
3
|
function getFirstStreamEventTimeoutMs(options) {
|
|
4
4
|
return options?.firstEventTimeoutMs;
|
|
@@ -12,5 +12,17 @@ function uniqueValues(values) {
|
|
|
12
12
|
function uniqueStrings(values) {
|
|
13
13
|
return uniqueValues(values);
|
|
14
14
|
}
|
|
15
|
+
/** Normalizes array-backed string lists and rejects non-array input as empty. */
|
|
16
|
+
function normalizeTrimmedStringList(value) {
|
|
17
|
+
if (!Array.isArray(value)) return [];
|
|
18
|
+
return value.flatMap((entry) => {
|
|
19
|
+
const normalized = normalizeOptionalString(entry);
|
|
20
|
+
return normalized ? [normalized] : [];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Normalizes an array-backed string list and removes duplicates. */
|
|
24
|
+
function normalizeUniqueTrimmedStringList(value) {
|
|
25
|
+
return uniqueStrings(normalizeTrimmedStringList(value));
|
|
26
|
+
}
|
|
15
27
|
//#endregion
|
|
16
|
-
export {
|
|
28
|
+
export { uniqueValues as i, normalizeUniqueTrimmedStringList as n, uniqueStrings as r, normalizeStringEntries as t };
|