@openclaw/ai 2026.9.1-beta.1 → 2026.9.2
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-DI4PZKKB.mjs → anthropic-BDdqdVLK.mjs} +222 -216
- package/dist/{anthropic-compaction-replay-nhKaCXu6.mjs → anthropic-compaction-replay-DB2FGLQc.mjs} +160 -68
- package/dist/{anthropic-payload-policy-B_0n0enE.d.mts → anthropic-payload-policy-d46X2pR0.d.mts} +28 -4
- package/dist/{api-registry-CTd8NzcD.d.mts → api-registry-DWtPjzyn.d.mts} +2 -2
- package/dist/{azure-openai-responses-D8dI0ekg.mjs → azure-openai-responses-C5bZRfAP.mjs} +12 -9
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/{diagnostics-COpOtRwq.mjs → diagnostics-CPeq9F7y.mjs} +5 -1
- package/dist/diagnostics-DfFyKeX_.mjs +136 -0
- package/dist/{diagnostics-BaTA9eVl.d.mts → diagnostics-DnPnOui6.d.mts} +5 -1
- package/dist/diagnostics.d.mts +8 -3
- package/dist/diagnostics.mjs +4 -3
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/{event-stream-uSMZJ3FA.mjs → event-stream-BgDvQeum.mjs} +3 -9
- package/dist/{event-stream-LiXePESD.d.mts → event-stream-BhT5T1Ay.d.mts} +1 -1
- package/dist/event-stream-zctLx0yr.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-Od-LLdVK.mjs → google-4qeuE8iX.mjs} +9 -7
- package/dist/{google-shared-Bgr9lFPw.mjs → google-shared-CWeG8RIl.mjs} +27 -23
- package/dist/{google-vertex-aerRSXc4.mjs → google-vertex-O9BcnB6X.mjs} +8 -6
- package/dist/{host-D51fmkH6.mjs → host-CEvLw30U.mjs} +54 -9
- package/dist/{host-DsbPMFU6.d.mts → host-DjzGmdZ2.d.mts} +3 -3
- package/dist/index-FnHM2FcI.d.mts +117 -0
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +6 -6
- package/dist/internal/anthropic.d.mts +59 -55
- 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 +66 -64
- package/dist/internal/openai.mjs +10 -10
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +43 -43
- package/dist/internal/runtime.mjs +10 -8
- package/dist/internal/shared.d.mts +25 -25
- package/dist/internal/shared.mjs +95 -4
- package/dist/{mistral-EiHdymeb.mjs → mistral-Tb6oalqH.mjs} +30 -23
- package/dist/{openai-chatgpt-responses-DHpF9o1e.mjs → openai-chatgpt-responses-yUXjPNfu.mjs} +76 -137
- package/dist/{openai-completions-EFPiUGfS.mjs → openai-completions-BIUV3RDT.mjs} +26 -22
- package/dist/{openai-completions-compat-BefmHT26.d.mts → openai-completions-compat-CpjYUArk.d.mts} +5 -5
- package/dist/{openai-completions-stream-DUlGwRMz.mjs → openai-completions-stream-BsrBe3Gg.mjs} +103 -96
- package/dist/openai-prompt-cache-CGnVB74a.mjs +21 -0
- package/dist/openai-prompt-cache-CNoIfHYC.d.mts +16 -0
- package/dist/{openai-responses-BogP8OjX.mjs → openai-responses-CCL41ALM.mjs} +15 -14
- package/dist/openai-responses-compaction-window-BMVHFOtq.mjs +697 -0
- package/dist/{openai-responses-contracts-Dvj_UtPy.d.mts → openai-responses-contracts-rF5DDRNS.d.mts} +23 -6
- 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-Cd4hJG-S.mjs → openai-responses-prompt-observer-internal-D0bhBfgL.mjs} +4 -18
- package/dist/{openai-responses-shared-DJThc6jW.mjs → openai-responses-shared-Bmma_3Qc.mjs} +438 -309
- package/dist/{openai-tool-schema-ho-hIkQf.mjs → openai-tool-schema-_pTAJqKF.mjs} +30 -40
- package/dist/{provider-error-DDOs_Bz0.mjs → provider-error-9TraxGvt.mjs} +20 -92
- package/dist/{provider-options-MdMBLzlU.d.mts → provider-options-Bcc_p-TU.d.mts} +26 -6
- package/dist/provider-replay-context-BuSUaAk5.mjs +21 -0
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-BaMbI1hr.mjs} +1 -1
- package/dist/provider-types.d.mts +19 -20
- package/dist/providers.d.mts +6 -6
- package/dist/providers.mjs +11 -11
- package/dist/{reasoning-tag-text-partitioner-5ygO2rZc.mjs → reasoning-tag-text-partitioner-DLCNXki6.mjs} +158 -94
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-D6xUvZaS.mjs} +2 -8
- package/dist/{simple-options-CFj7x3J4.mjs → simple-options-BjHCCh4v.mjs} +42 -6
- package/dist/{src-Bu3FiFAG.mjs → src-2qBGKg8O.mjs} +83 -2
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-mJhXDcyz.mjs} +21 -31
- package/dist/{transport-stream-shared-ljShVIZB.mjs → transport-stream-shared-CZqMhfIw.mjs} +19 -6
- package/dist/{transport-stream-shared-rvaCyFYt.d.mts → transport-stream-shared-xnaqxmbP.d.mts} +5 -5
- package/dist/{transport-utils-LJ1_rbi-.mjs → transport-utils-7il795_9.mjs} +5 -8
- package/dist/transports.d.mts +121 -85
- package/dist/transports.mjs +747 -464
- package/dist/types-3Lnm-QSJ.d.mts +1 -0
- package/dist/{types-DhLoJbFm.d.mts → types-CJ1-Ht7A.d.mts} +55 -19
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +5 -5
- package/dist/{validation-Dk7q7NMN.d.mts → validation-AKZBDGQd.d.mts} +1 -1
- package/dist/{validation-B61OhAio.mjs → validation-CJZtym2g.mjs} +7 -5
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/anthropic-BECQCNdF.d.mts +0 -98
- package/dist/event-stream-BKp4fOt_.d.mts +0 -1
- package/dist/index-Qbej8io0.d.mts +0 -3
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/openai-responses-contracts-QUY12X0B.mjs +0 -233
- package/dist/openai-responses-payload-policy-D8EdimYe.mjs +0 -204
- package/dist/provider-options-AvldWZt8.mjs +0 -21
- package/dist/tls-certificate-errors-DXSpluKI.mjs +0 -93
- package/dist/types-GiAjXatj.d.mts +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as normalizeLowercaseStringOrEmpty, o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
-
import { n as applyProviderReportedUsageCost, r as calculateCost } from "./sanitize-unicode-
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
2
|
+
import { n as applyProviderReportedUsageCost, r as calculateCost } from "./sanitize-unicode-D6xUvZaS.mjs";
|
|
3
|
+
import { n as getAiTransportHost } from "./host-CEvLw30U.mjs";
|
|
4
4
|
import { r as uniqueValues, t as normalizeStringEntries } from "./string-normalization--fwJ4S2q.mjs";
|
|
5
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
6
|
-
import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
7
|
-
import { C as headersToRecord, _ as transportAbortError, f as notifyProviderHttpResponse } from "./transport-stream-shared-
|
|
5
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-CGnVB74a.mjs";
|
|
6
|
+
import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-mJhXDcyz.mjs";
|
|
7
|
+
import { C as headersToRecord, _ as transportAbortError, f as notifyProviderHttpResponse } from "./transport-stream-shared-CZqMhfIw.mjs";
|
|
8
8
|
//#region packages/ai/src/transports/openai-transport-shared.ts
|
|
9
9
|
/** Shared options, usage shape, cache identity, ordering, and stream scheduling for OpenAI APIs. */
|
|
10
10
|
const MODEL_STREAM_COOPERATIVE_YIELD_INTERVAL_MS = 12;
|
|
@@ -112,7 +112,7 @@ function readOpenAICompletionsReasoningBatch(delta, visibleReasoningDetailTypes)
|
|
|
112
112
|
}
|
|
113
113
|
function parseOpenAICompletionsUsage(rawUsage, model, options) {
|
|
114
114
|
const cacheRead = rawUsage.prompt_tokens_details?.cached_tokens ?? rawUsage.prompt_cache_hit_tokens ?? 0;
|
|
115
|
-
const cacheWrite = rawUsage.prompt_tokens_details?.cache_write_tokens
|
|
115
|
+
const cacheWrite = rawUsage.prompt_tokens_details?.cache_write_tokens ?? rawUsage.prompt_tokens_details?.cache_creation_input_tokens ?? 0;
|
|
116
116
|
const input = Math.max(0, (rawUsage.prompt_tokens || 0) - cacheRead - cacheWrite);
|
|
117
117
|
const output = rawUsage.completion_tokens || 0;
|
|
118
118
|
const reasoningTokens = rawUsage.completion_tokens_details?.reasoning_tokens;
|
|
@@ -647,12 +647,14 @@ function cleanSchemaForGeminiWithDefs(schema, defs, refStack) {
|
|
|
647
647
|
cleaned.type = types.length === 1 ? types[0] : types;
|
|
648
648
|
continue;
|
|
649
649
|
}
|
|
650
|
-
if (key === "properties")
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
else if (
|
|
654
|
-
|
|
655
|
-
|
|
650
|
+
if (key === "properties") {
|
|
651
|
+
if (value && typeof value === "object" && !Array.isArray(value)) cleaned[key] = Object.fromEntries(Object.entries(value).map(([k, v]) => [k, cleanSchemaForGeminiWithDefs(v, nextDefs, refStack)]));
|
|
652
|
+
else cleaned[key] = {};
|
|
653
|
+
} else if (key === "items" && value) {
|
|
654
|
+
if (Array.isArray(value)) cleaned[key] = value.map((entry) => cleanSchemaForGeminiWithDefs(entry, nextDefs, refStack));
|
|
655
|
+
else if (typeof value === "object") cleaned[key] = cleanSchemaForGeminiWithDefs(value, nextDefs, refStack);
|
|
656
|
+
else cleaned[key] = value;
|
|
657
|
+
} else if (key === "anyOf" && Array.isArray(value)) cleaned[key] = cleanedAnyOf ?? value.map((variant) => cleanSchemaForGeminiWithDefs(variant, nextDefs, refStack));
|
|
656
658
|
else if (key === "oneOf" && Array.isArray(value)) cleaned[key] = cleanedOneOf ?? value.map((variant) => cleanSchemaForGeminiWithDefs(variant, nextDefs, refStack));
|
|
657
659
|
else if (key === "allOf" && Array.isArray(value)) cleaned[key] = value.map((variant) => cleanSchemaForGeminiWithDefs(variant, nextDefs, refStack));
|
|
658
660
|
else cleaned[key] = value;
|
|
@@ -1326,7 +1328,7 @@ function normalizeOpenApiSchemaKeywords(schema) {
|
|
|
1326
1328
|
changed ||= next.some((entry, index) => entry !== value[index]);
|
|
1327
1329
|
continue;
|
|
1328
1330
|
}
|
|
1329
|
-
normalized
|
|
1331
|
+
setOwnSchemaProperty(normalized, key, value);
|
|
1330
1332
|
}
|
|
1331
1333
|
if (nullable) {
|
|
1332
1334
|
if (hasOpenApiComposition(normalized)) return wrapNullableComposedSchema(normalized);
|
|
@@ -1382,7 +1384,7 @@ function normalizeToolParameterSchemaUncached(schema, options) {
|
|
|
1382
1384
|
return applyProviderCleaning(inlinedSchema);
|
|
1383
1385
|
}
|
|
1384
1386
|
const variants = schemaRecord[flattenableVariantKey];
|
|
1385
|
-
const mergedProperties = {};
|
|
1387
|
+
const mergedProperties = isRecord(schemaRecord.properties) ? { ...schemaRecord.properties } : {};
|
|
1386
1388
|
const requiredCounts = /* @__PURE__ */ new Map();
|
|
1387
1389
|
let objectVariants = 0;
|
|
1388
1390
|
for (const entry of variants) {
|
|
@@ -1390,13 +1392,7 @@ function normalizeToolParameterSchemaUncached(schema, options) {
|
|
|
1390
1392
|
const props = entry.properties;
|
|
1391
1393
|
if (!props || typeof props !== "object") continue;
|
|
1392
1394
|
objectVariants += 1;
|
|
1393
|
-
for (const [key, value] of Object.entries(props))
|
|
1394
|
-
if (!(key in mergedProperties)) {
|
|
1395
|
-
mergedProperties[key] = value;
|
|
1396
|
-
continue;
|
|
1397
|
-
}
|
|
1398
|
-
mergedProperties[key] = mergePropertySchemas(mergedProperties[key], value);
|
|
1399
|
-
}
|
|
1395
|
+
for (const [key, value] of Object.entries(props)) setOwnSchemaProperty(mergedProperties, key, mergePropertySchemas(Object.hasOwn(mergedProperties, key) ? mergedProperties[key] : void 0, value));
|
|
1400
1396
|
const required = Array.isArray(entry.required) ? entry.required : [];
|
|
1401
1397
|
for (const key of required) {
|
|
1402
1398
|
if (typeof key !== "string") continue;
|
|
@@ -1461,12 +1457,11 @@ const OPENAI_STRICT_COMPAT_SCHEMA_NESTED_KEYS = /* @__PURE__ */ new Set([
|
|
|
1461
1457
|
function normalizeOpenAIStrictCompatSchemaMap(schema) {
|
|
1462
1458
|
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return schema;
|
|
1463
1459
|
let changed = false;
|
|
1464
|
-
const normalized = {
|
|
1465
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
1460
|
+
const normalized = Object.fromEntries(Object.entries(schema).map(([key, value]) => {
|
|
1466
1461
|
const next = normalizeOpenAIStrictCompatSchemaRecursive(value, { promoteEmptyObject: false });
|
|
1467
|
-
normalized[key] = next;
|
|
1468
1462
|
changed ||= next !== value;
|
|
1469
|
-
|
|
1463
|
+
return [key, next];
|
|
1464
|
+
}));
|
|
1470
1465
|
return changed ? normalized : schema;
|
|
1471
1466
|
}
|
|
1472
1467
|
function normalizeOpenAIStrictCompatSchemaRecursive(schema, options) {
|
|
@@ -1483,21 +1478,17 @@ function normalizeOpenAIStrictCompatSchemaRecursive(schema, options) {
|
|
|
1483
1478
|
const record = schema;
|
|
1484
1479
|
let changed = false;
|
|
1485
1480
|
let hadNullType = false;
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
|
|
1481
|
+
const entries = Object.entries(record).flatMap(([key, value]) => {
|
|
1482
|
+
if (value === null && (OPENAI_NULLABLE_ANNOTATION_KEYS.has(key) || key === "type")) {
|
|
1483
|
+
hadNullType ||= key === "type";
|
|
1489
1484
|
changed = true;
|
|
1490
|
-
|
|
1491
|
-
}
|
|
1492
|
-
if (value === null && key === "type") {
|
|
1493
|
-
hadNullType = true;
|
|
1494
|
-
changed = true;
|
|
1495
|
-
continue;
|
|
1485
|
+
return [];
|
|
1496
1486
|
}
|
|
1497
1487
|
const next = OPENAI_STRICT_COMPAT_SCHEMA_MAP_KEYS.has(key) ? normalizeOpenAIStrictCompatSchemaMap(value) : OPENAI_STRICT_COMPAT_SCHEMA_NESTED_KEYS.has(key) ? normalizeOpenAIStrictCompatSchemaRecursive(value, { promoteEmptyObject: false }) : value;
|
|
1498
|
-
normalized[key] = next;
|
|
1499
1488
|
changed ||= next !== value;
|
|
1500
|
-
|
|
1489
|
+
return [[key, next]];
|
|
1490
|
+
});
|
|
1491
|
+
const normalized = Object.fromEntries(entries);
|
|
1501
1492
|
if (Object.keys(normalized).length === 0) {
|
|
1502
1493
|
if (!options.promoteEmptyObject) return schema;
|
|
1503
1494
|
return {
|
|
@@ -1623,12 +1614,11 @@ function normalizeStrictOpenAIJsonSchemaRecursive(schema, depth) {
|
|
|
1623
1614
|
if (!schema || typeof schema !== "object") return schema;
|
|
1624
1615
|
const record = schema;
|
|
1625
1616
|
let changed = false;
|
|
1626
|
-
const normalized = {
|
|
1627
|
-
for (const [key, value] of Object.entries(record)) {
|
|
1617
|
+
const normalized = Object.fromEntries(Object.entries(record).map(([key, value]) => {
|
|
1628
1618
|
const next = normalizeStrictOpenAIJsonSchemaRecursive(value, key === "properties" ? depth : depth + 1);
|
|
1629
|
-
normalized[key] = next;
|
|
1630
1619
|
changed ||= next !== value;
|
|
1631
|
-
|
|
1620
|
+
return [key, next];
|
|
1621
|
+
}));
|
|
1632
1622
|
if (normalized.type === "object") {
|
|
1633
1623
|
const properties = normalized.properties && typeof normalized.properties === "object" && !Array.isArray(normalized.properties) ? normalized.properties : void 0;
|
|
1634
1624
|
if (properties && Object.keys(properties).length === 0 && !Array.isArray(normalized.required)) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { a as asOptionalRecord, f as normalizeStringifiedOptionalString, t as truncateUtf16Safe } from "./utf16-slice-qz3nsy87.mjs";
|
|
2
|
-
import "./
|
|
2
|
+
import { n as estimateBase64DecodedBytes } from "./base64-CEFBpSkN.mjs";
|
|
3
3
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
4
4
|
function isJsonOpeningDelimiter(char, openers) {
|
|
5
5
|
return (char === "{" || char === "[") && openers.includes(char);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
function extractBalancedJsonPrefix(raw, opts = {}) {
|
|
7
|
+
function extractBalancedJsonAt(raw, opts, offset) {
|
|
9
8
|
const openers = opts.openers ?? ["{", "["];
|
|
10
|
-
let start =
|
|
9
|
+
let start = offset;
|
|
11
10
|
while (start < raw.length && !isJsonOpeningDelimiter(raw[start], openers)) start += 1;
|
|
12
11
|
const stack = [];
|
|
13
12
|
let inString = false;
|
|
@@ -35,14 +34,10 @@ function extractBalancedJsonPrefix(raw, opts = {}) {
|
|
|
35
34
|
function extractBalancedJsonFragments(raw, opts = {}) {
|
|
36
35
|
const fragments = [];
|
|
37
36
|
for (let offset = 0; offset < raw.length;) {
|
|
38
|
-
const fragment =
|
|
37
|
+
const fragment = extractBalancedJsonAt(raw, opts, offset);
|
|
39
38
|
if (!fragment) break;
|
|
40
|
-
fragments.push(
|
|
41
|
-
|
|
42
|
-
startIndex: offset + fragment.startIndex,
|
|
43
|
-
endIndex: offset + fragment.endIndex
|
|
44
|
-
});
|
|
45
|
-
offset += fragment.endIndex + 1;
|
|
39
|
+
fragments.push(fragment);
|
|
40
|
+
offset = fragment.endIndex + 1;
|
|
46
41
|
}
|
|
47
42
|
return fragments;
|
|
48
43
|
}
|
|
@@ -83,6 +78,11 @@ function stringifyObjectValue(value, stack, normalizeString) {
|
|
|
83
78
|
return `[${serializedEntries.join(",")}]`;
|
|
84
79
|
}
|
|
85
80
|
const record = value;
|
|
81
|
+
if (normalizeString === preserveString) {
|
|
82
|
+
const fields = [];
|
|
83
|
+
for (const key of Object.keys(record).toSorted()) fields.push(`${JSON.stringify(key)}:${stringifyStableValue(record[key], stack, normalizeString)}`);
|
|
84
|
+
return `{${fields.join(",")}}`;
|
|
85
|
+
}
|
|
86
86
|
const entries = Object.keys(record).map((key) => ({
|
|
87
87
|
key,
|
|
88
88
|
normalizedKey: normalizeString(key)
|
|
@@ -102,78 +102,6 @@ function compareStableStrings(left, right) {
|
|
|
102
102
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
103
103
|
}
|
|
104
104
|
//#endregion
|
|
105
|
-
//#region packages/media-core/src/base64.ts
|
|
106
|
-
/** Estimates decoded bytes without allocating a cleaned copy of the base64 payload. */
|
|
107
|
-
function estimateBase64DecodedBytes(base64) {
|
|
108
|
-
let effectiveLen = 0;
|
|
109
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
110
|
-
if (base64.charCodeAt(i) <= 32) continue;
|
|
111
|
-
effectiveLen += 1;
|
|
112
|
-
}
|
|
113
|
-
if (effectiveLen === 0) return 0;
|
|
114
|
-
let padding = 0;
|
|
115
|
-
let end = base64.length - 1;
|
|
116
|
-
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
117
|
-
if (end >= 0 && base64[end] === "=") {
|
|
118
|
-
padding = 1;
|
|
119
|
-
end -= 1;
|
|
120
|
-
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
121
|
-
if (end >= 0 && base64[end] === "=") padding = 2;
|
|
122
|
-
}
|
|
123
|
-
const estimated = Math.floor(effectiveLen * 3 / 4) - padding;
|
|
124
|
-
return Math.max(0, estimated);
|
|
125
|
-
}
|
|
126
|
-
function isBase64DataChar(code) {
|
|
127
|
-
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
128
|
-
}
|
|
129
|
-
function base64DataValue(code) {
|
|
130
|
-
if (code >= 65 && code <= 90) return code - 65;
|
|
131
|
-
if (code >= 97 && code <= 122) return code - 97 + 26;
|
|
132
|
-
if (code >= 48 && code <= 57) return code - 48 + 52;
|
|
133
|
-
return code === 43 ? 62 : 63;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Normalizes and validates a base64 string, returning canonical no-whitespace
|
|
137
|
-
* base64 only when the input has valid alphabet, padding, and length.
|
|
138
|
-
*/
|
|
139
|
-
function canonicalizeBase64(base64) {
|
|
140
|
-
let out;
|
|
141
|
-
let outLen = 0;
|
|
142
|
-
let padding = 0;
|
|
143
|
-
let sawPadding = false;
|
|
144
|
-
let lastDataCode = 0;
|
|
145
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
146
|
-
const code = base64.charCodeAt(i);
|
|
147
|
-
if (code <= 32) {
|
|
148
|
-
if (out === void 0) {
|
|
149
|
-
out = Buffer.allocUnsafe(base64.length - 1);
|
|
150
|
-
for (let j = 0; j < i; j += 1) out[j] = base64.charCodeAt(j);
|
|
151
|
-
outLen = i;
|
|
152
|
-
}
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
if (code === 61) {
|
|
156
|
-
padding += 1;
|
|
157
|
-
if (padding > 2) return;
|
|
158
|
-
sawPadding = true;
|
|
159
|
-
} else if (sawPadding || !isBase64DataChar(code)) return;
|
|
160
|
-
else lastDataCode = code;
|
|
161
|
-
if (out !== void 0) {
|
|
162
|
-
out[outLen] = code;
|
|
163
|
-
outLen += 1;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const cleanedLength = out === void 0 ? base64.length : outLen;
|
|
167
|
-
if (cleanedLength === 0) return;
|
|
168
|
-
const remainder = cleanedLength % 4;
|
|
169
|
-
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
170
|
-
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
171
|
-
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
172
|
-
if (padBitMask !== 0 && (base64DataValue(lastDataCode) & padBitMask) !== 0) return;
|
|
173
|
-
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
174
|
-
return remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder);
|
|
175
|
-
}
|
|
176
|
-
//#endregion
|
|
177
105
|
//#region packages/ai/src/utils/credential-redaction.ts
|
|
178
106
|
const NON_CREDENTIAL_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
179
107
|
"passwordfile",
|
|
@@ -196,7 +124,7 @@ const CREDENTIAL_HEADER_RE = /\b((?:[A-Za-z][A-Za-z0-9_.-]*[_.-])?(?:api[_.-]?ke
|
|
|
196
124
|
const LOOSE_QUOTED_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|provider|status|type)=)[A-Za-z][A-Za-z0-9_.-]{0,64})=(["'])([A-Za-z0-9+/._~%=-]{16,})\2/giu;
|
|
197
125
|
const LOOSE_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|provider|status|type)=)[A-Za-z][A-Za-z0-9_.-]{0,64})=([A-Za-z0-9+/._~%=-]{16,})(?=[;&#'"\s]|$)/giu;
|
|
198
126
|
const MEDIA_DATA_URL_RE = /data:(?:audio|image|video)\/[a-z0-9.+-]+(?:;[^,;\s]+)*;base64,[ \t]*(?:\r?\n[ \t]*)?[a-z0-9+/_=-]+(?:[ \t]*\r?\n[ \t]*[a-z0-9+/_=-]+)*/giu;
|
|
199
|
-
const MAX_DIAGNOSTIC_JSON_LENGTH =
|
|
127
|
+
const MAX_DIAGNOSTIC_JSON_LENGTH = 16384;
|
|
200
128
|
const PLAIN_BRACKET_TAG_RE = /^\[[A-Za-z0-9][A-Za-z0-9 _.-]*\]$/u;
|
|
201
129
|
const JSON_ARRAY_START_RE = /\[\s*(?:[{"\d\]-]|true\b|false\b|null\b)/u;
|
|
202
130
|
const MALFORMED_JSON_RE = /\{|(?:"[^"]+"|\b(?:b64_json|data|(?:input|output)?(?:audio|image|video)[\w-]*))\s*:/iu;
|
|
@@ -206,8 +134,7 @@ function looksLikeDiagnosticJson(value) {
|
|
|
206
134
|
function normalizeDiagnosticFieldName(value) {
|
|
207
135
|
return value.toLowerCase().replaceAll(/[^a-z0-9]/g, "");
|
|
208
136
|
}
|
|
209
|
-
function isCredentialFieldName(
|
|
210
|
-
const normalized = normalizeDiagnosticFieldName(key);
|
|
137
|
+
function isCredentialFieldName(normalized) {
|
|
211
138
|
if (!normalized || NON_CREDENTIAL_FIELD_NAMES.has(normalized)) return false;
|
|
212
139
|
return normalized === "authorization" || normalized === "proxyauthorization" || CREDENTIAL_FIELD_SUFFIX_RE.test(normalized);
|
|
213
140
|
}
|
|
@@ -231,8 +158,7 @@ function isDiagnosticMediaPayload(descriptors) {
|
|
|
231
158
|
return typeof mime === "string" && /^(?:audio|image|video)\//iu.test(mime);
|
|
232
159
|
});
|
|
233
160
|
}
|
|
234
|
-
function extractDiagnosticMediaField(key, value, parentMedia) {
|
|
235
|
-
const normalized = normalizeDiagnosticFieldName(key);
|
|
161
|
+
function extractDiagnosticMediaField(key, normalized, value, parentMedia) {
|
|
236
162
|
const privateField = normalized === "b64json";
|
|
237
163
|
const mediaField = MEDIA_FIELD_NAME_RE.test(normalized) || MEDIA_WRAPPER_NAME_RE.test(key);
|
|
238
164
|
const contextualPayload = parentMedia && MEDIA_PAYLOAD_SUFFIX_RE.test(normalized);
|
|
@@ -282,17 +208,19 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
282
208
|
seen.add(value);
|
|
283
209
|
const out = Array.isArray(value) ? [] : {};
|
|
284
210
|
const rawName = typeof descriptors.name?.value === "string" ? descriptors.name.value : descriptors.key?.value;
|
|
285
|
-
const redactValueField = keys.length > 64 || typeof rawName === "string" && isCredentialFieldName(rawName);
|
|
211
|
+
const redactValueField = keys.length > 64 || typeof rawName === "string" && isCredentialFieldName(normalizeDiagnosticFieldName(rawName));
|
|
286
212
|
const redactMedia = mediaPayload || keys.length > 64 || isDiagnosticMediaPayload(descriptors);
|
|
287
213
|
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
288
214
|
if (!("value" in descriptor) || !descriptor.enumerable && (policy.propertyScope === "enumerable" || ![
|
|
289
215
|
"cause",
|
|
216
|
+
"errors",
|
|
290
217
|
"message",
|
|
291
218
|
"name",
|
|
292
219
|
"stack"
|
|
293
220
|
].includes(key)) || key === "length") continue;
|
|
294
221
|
const child = descriptor.value;
|
|
295
|
-
|
|
222
|
+
const normalized = policy.omitField?.(key) ? void 0 : normalizeDiagnosticFieldName(key);
|
|
223
|
+
if (normalized === void 0 || isCredentialFieldName(normalized)) {
|
|
296
224
|
state.changed = true;
|
|
297
225
|
continue;
|
|
298
226
|
}
|
|
@@ -301,7 +229,7 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
301
229
|
state.changed = true;
|
|
302
230
|
continue;
|
|
303
231
|
}
|
|
304
|
-
const media = extractDiagnosticMediaField(key, child, redactMedia);
|
|
232
|
+
const media = extractDiagnosticMediaField(key, normalized, child, redactMedia);
|
|
305
233
|
if (media?.kind === "redacted") {
|
|
306
234
|
const redacted = media.bytes === void 0 ? "<redacted>" : {
|
|
307
235
|
redacted: "<redacted>",
|
|
@@ -419,4 +347,4 @@ function projectProviderError(error, signal) {
|
|
|
419
347
|
}
|
|
420
348
|
}
|
|
421
349
|
//#endregion
|
|
422
|
-
export {
|
|
350
|
+
export { stableStringify as i, projectProviderError as n, projectDiagnosticValue as r, configureProviderErrorRedactor as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types-
|
|
1
|
+
import { J as StreamOptions } from "./types-CJ1-Ht7A.mjs";
|
|
2
|
+
import "./types-3Lnm-QSJ.mjs";
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
import Anthropic from "@anthropic-ai/sdk";
|
|
5
5
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
@@ -24,9 +24,11 @@ declare function isOpenAIGpt56Model(model: OpenAIReasoningModel): boolean;
|
|
|
24
24
|
declare function normalizeOpenAIReasoningEffort(effort: string): string;
|
|
25
25
|
/** Resolve the reasoning efforts accepted by a specific OpenAI-compatible model. */
|
|
26
26
|
declare function resolveOpenAISupportedReasoningEfforts(model: OpenAIReasoningModel): readonly OpenAIApiReasoningEffort[];
|
|
27
|
+
/** Read a declared or known model contract, leaving unknown compatible models unspecified. */
|
|
28
|
+
declare function resolveOpenAIModelReasoningEfforts(model: OpenAIReasoningModel): readonly OpenAIApiReasoningEffort[] | undefined;
|
|
27
29
|
/**
|
|
28
|
-
* Return whether a model accepts
|
|
29
|
-
*
|
|
30
|
+
* Return whether a model accepts temperature. GPT-5.6 and GPT-6 Astra
|
|
31
|
+
* reject it with a 400; catalog compat can override per model.
|
|
30
32
|
*/
|
|
31
33
|
declare function supportsOpenAITemperature(model: OpenAIReasoningModel): boolean;
|
|
32
34
|
/** Return whether a model accepts a requested reasoning effort. */
|
|
@@ -82,15 +84,33 @@ type CodeModeToolSurfaceObservation = {
|
|
|
82
84
|
afterToolIdentities: readonly string[];
|
|
83
85
|
};
|
|
84
86
|
type CodeModeToolSurfaceObserver = (observation: CodeModeToolSurfaceObservation) => void;
|
|
87
|
+
declare function markStrictReasoningTagText(options: object): void;
|
|
88
|
+
declare function isStrictReasoningTagText(options: object | undefined): boolean;
|
|
85
89
|
declare const codeModeToolSurfaceObserver: {
|
|
86
90
|
set(options: object, observer: CodeModeToolSurfaceObserver, collector?: CodeModeToolSurfaceObserver): void;
|
|
87
91
|
get(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
88
92
|
getCollector(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
89
93
|
};
|
|
94
|
+
/** Internal output policy for callers that must not recover ambiguous reasoning as visible text. */
|
|
95
|
+
declare const reasoningTagTextPolicy: {
|
|
96
|
+
markStrict: typeof markStrictReasoningTagText;
|
|
97
|
+
isStrict: typeof isStrictReasoningTagText;
|
|
98
|
+
copy(source: object | undefined, target: object): void;
|
|
99
|
+
};
|
|
90
100
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
91
101
|
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
102
|
+
type AnthropicContextManagementOptions = {
|
|
103
|
+
anthropicServerCompaction?: boolean;
|
|
104
|
+
anthropicCompactThreshold?: number;
|
|
105
|
+
cacheTtlPruning?: {
|
|
106
|
+
tools?: {
|
|
107
|
+
allow?: string[];
|
|
108
|
+
deny?: string[];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
92
112
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
93
|
-
interface AnthropicOptions extends StreamOptions {
|
|
113
|
+
interface AnthropicOptions extends StreamOptions, AnthropicContextManagementOptions {
|
|
94
114
|
/**
|
|
95
115
|
* Enable extended thinking.
|
|
96
116
|
* For Opus 4.6+ and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
|
|
@@ -158,4 +178,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
158
178
|
reasoningEffort?: OpenAIReasoningEffort;
|
|
159
179
|
};
|
|
160
180
|
//#endregion
|
|
161
|
-
export {
|
|
181
|
+
export { resolveOpenAIReasoningEffortForModel as C, supportsOpenAITemperature as E, resolveOpenAIModelReasoningEfforts as S, supportsOpenAIReasoningEffort as T, OpenAIReasoningEffort as _, BaseOpenAIStreamOptions as a, isOpenAIGpt56Model as b, OpenAIResponsesCompactionRejection as c, OpenAICompletionsToolChoice as d, OpenAIToolProjection as f, OpenAIApiReasoningEffort as g, reconcileOpenAIResponsesToolChoice as h, AnthropicThinkingDisplay as i, codeModeToolSurfaceObserver as l, reconcileOpenAICompletionsToolChoice as m, AnthropicEffort as n, CodeModeToolSurfaceObservation as o, projectOpenAITools as p, AnthropicOptions as r, OpenAICompletionsOptions as s, AnthropicContextManagementOptions as t, reasoningTagTextPolicy as u, isOpenAIGpt54MiniModel as v, resolveOpenAISupportedReasoningEfforts as w, normalizeOpenAIReasoningEffort as x, isOpenAIGpt55Model as y };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
2
|
+
//#region packages/ai/src/transports/provider-replay-context.ts
|
|
3
|
+
function hashReplayContextValue(value) {
|
|
4
|
+
const normalized = value?.trim();
|
|
5
|
+
return normalized ? shortHash(normalized) : void 0;
|
|
6
|
+
}
|
|
7
|
+
function buildProviderReplayContext(model, options) {
|
|
8
|
+
return {
|
|
9
|
+
provider: model.provider,
|
|
10
|
+
api: model.api,
|
|
11
|
+
model: model.id,
|
|
12
|
+
baseUrlHash: hashReplayContextValue(model.baseUrl),
|
|
13
|
+
sessionHash: hashReplayContextValue(options?.sessionId),
|
|
14
|
+
authProfileHash: hashReplayContextValue(options?.authProfileId)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function providerReplayContextMatches(state, context) {
|
|
18
|
+
return state.provider === context.provider && state.api === context.api && state.model === context.model && state.baseUrlHash === context.baseUrlHash && state.sessionHash === context.sessionHash && state.authProfileHash === context.authProfileHash;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { providerReplayContextMatches as n, buildProviderReplayContext as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-CEvLw30U.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,33 +1,32 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-
|
|
3
|
-
import { $ as
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import "./
|
|
7
|
-
import "./types-GiAjXatj.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, t as index_d_exports, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-FnHM2FcI.mjs";
|
|
2
|
+
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, s as isProviderRefusalAssistantError, t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
|
|
3
|
+
import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-CJ1-Ht7A.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BhT5T1Ay.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-AKZBDGQd.mjs";
|
|
6
|
+
import "./types-3Lnm-QSJ.mjs";
|
|
8
7
|
//#region packages/ai/src/provider-types.d.ts
|
|
9
|
-
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
10
|
-
type VideoContent = Omit<ImageContent, "type"> & {
|
|
8
|
+
export declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
9
|
+
export type VideoContent = Omit<ImageContent, "type"> & {
|
|
11
10
|
type: "video";
|
|
12
11
|
};
|
|
13
|
-
type MediaContent = ImageContent | VideoContent;
|
|
14
|
-
type ModelInputContent = TextContent | MediaContent;
|
|
15
|
-
type ProviderUserMessage = Omit<UserMessage, "content"> & {
|
|
12
|
+
export type MediaContent = ImageContent | VideoContent;
|
|
13
|
+
export type ModelInputContent = TextContent | MediaContent;
|
|
14
|
+
export type ProviderUserMessage = Omit<UserMessage, "content"> & {
|
|
16
15
|
content: string | ModelInputContent[];
|
|
17
16
|
};
|
|
18
|
-
type ProviderMessage = ProviderUserMessage | AssistantMessage | ToolResultMessage;
|
|
19
|
-
type ProviderContext = Omit<Context, "messages"> & {
|
|
17
|
+
export type ProviderMessage = ProviderUserMessage | AssistantMessage | ToolResultMessage;
|
|
18
|
+
export type ProviderContext = Omit<Context, "messages"> & {
|
|
20
19
|
messages: ProviderMessage[];
|
|
21
20
|
};
|
|
22
|
-
type ProviderModel<TApi extends Api = Api> = Omit<Model<TApi>, "input"> & {
|
|
21
|
+
export type ProviderModel<TApi extends Api = Api> = Omit<Model<TApi>, "input"> & {
|
|
23
22
|
input: ModelInputContent["type"][];
|
|
24
23
|
};
|
|
25
|
-
type ProviderContextHandoff = () => Promise<ProviderContext>;
|
|
26
|
-
type ProviderStreamOptions = StreamOptions & {
|
|
24
|
+
export type ProviderContextHandoff = () => Promise<ProviderContext>;
|
|
25
|
+
export type ProviderStreamOptions = StreamOptions & {
|
|
27
26
|
[PROVIDER_CONTEXT_HANDOFF]?: ProviderContextHandoff;
|
|
28
27
|
};
|
|
29
|
-
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;
|
|
30
29
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
31
|
-
declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
30
|
+
export declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
32
31
|
//#endregion
|
|
33
|
-
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, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamFunction as StreamFunction, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-DWtPjzyn.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CNoIfHYC.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
5
|
-
declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
5
|
+
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
6
6
|
/** Registers every built-in API provider in one runtime registry. */
|
|
7
|
-
declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
|
|
7
|
+
export declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
|
|
8
8
|
/** Restores the built-in provider registry state for tests. */
|
|
9
|
-
declare function resetApiProviders(registry: ApiRegistry): void;
|
|
9
|
+
export declare function resetApiProviders(registry: ApiRegistry): void;
|
|
10
10
|
//#endregion
|
|
11
|
-
export {
|
|
11
|
+
export { OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey };
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
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-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-BgDvQeum.mjs";
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-9TraxGvt.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CGnVB74a.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-BDdqdVLK.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-BIUV3RDT.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-Tb6oalqH.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-CCL41ALM.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-C5bZRfAP.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-yUXjPNfu.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-4qeuE8iX.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-O9BcnB6X.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|