@openclaw/ai 2026.9.1-beta.1 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-compaction-replay-nhKaCXu6.mjs → anthropic-compaction-replay-OMJZ0uyo.mjs} +37 -34
- package/dist/{anthropic-DI4PZKKB.mjs → anthropic-hk7F7ptG.mjs} +28 -25
- package/dist/{anthropic-payload-policy-B_0n0enE.d.mts → anthropic-payload-policy-DBT1itQ-.d.mts} +3 -3
- package/dist/{api-registry-CTd8NzcD.d.mts → api-registry-Cs6HGNqY.d.mts} +2 -2
- package/dist/{azure-openai-responses-D8dI0ekg.mjs → azure-openai-responses-CN4Fy5zV.mjs} +10 -7
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/{diagnostics-COpOtRwq.mjs → diagnostics-CPeq9F7y.mjs} +5 -1
- package/dist/{diagnostics-BaTA9eVl.d.mts → diagnostics-DnPnOui6.d.mts} +5 -1
- package/dist/diagnostics-KhXK-QJI.mjs +136 -0
- 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-DeDhbCc5.d.mts +1 -0
- package/dist/{event-stream-LiXePESD.d.mts → event-stream-vK_7r3bj.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-Od-LLdVK.mjs → google-CC-nrwXg.mjs} +8 -6
- package/dist/{google-shared-Bgr9lFPw.mjs → google-shared-CjPY0hZM.mjs} +25 -23
- package/dist/{google-vertex-aerRSXc4.mjs → google-vertex-DCr0pyzQ.mjs} +7 -5
- package/dist/{host-D51fmkH6.mjs → host-BIaiBURL.mjs} +2 -2
- package/dist/{host-DsbPMFU6.d.mts → host-BztR4tQj.d.mts} +3 -3
- package/dist/index-AfaxKT8w.d.mts +111 -0
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +5 -5
- package/dist/internal/anthropic.d.mts +53 -52
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +65 -63
- package/dist/internal/openai.mjs +9 -9
- 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-B7etBd_H.mjs} +25 -20
- package/dist/{openai-chatgpt-responses-DHpF9o1e.mjs → openai-chatgpt-responses-BAJ4gq3i.mjs} +63 -122
- package/dist/{openai-completions-EFPiUGfS.mjs → openai-completions-D0QZ0AyB.mjs} +24 -20
- package/dist/{openai-completions-compat-BefmHT26.d.mts → openai-completions-compat-4IjSBpr6.d.mts} +5 -5
- package/dist/{openai-completions-stream-DUlGwRMz.mjs → openai-completions-stream-DZjwK8vp.mjs} +97 -90
- package/dist/{openai-responses-BogP8OjX.mjs → openai-responses-BEUlxfDu.mjs} +12 -8
- package/dist/openai-responses-compaction-window-DO7yV7az.mjs +686 -0
- package/dist/{openai-responses-contracts-Dvj_UtPy.d.mts → openai-responses-contracts-bPzSN_Ba.d.mts} +14 -5
- package/dist/{openai-responses-payload-policy-CNGFT9zr.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +1 -0
- package/dist/{openai-responses-prompt-observer-internal-Cd4hJG-S.mjs → openai-responses-prompt-observer-internal-C7x4IK7r.mjs} +4 -18
- package/dist/{openai-responses-shared-DJThc6jW.mjs → openai-responses-shared-DiAdpNAM.mjs} +274 -221
- package/dist/{openai-tool-schema-ho-hIkQf.mjs → openai-tool-schema-BMiHFH36.mjs} +14 -12
- package/dist/{provider-error-DDOs_Bz0.mjs → provider-error-B6EGq6gg.mjs} +14 -85
- package/dist/{provider-options-MdMBLzlU.d.mts → provider-options-CxFPtvh7.d.mts} +11 -3
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-WvJmFUAf.mjs} +1 -1
- package/dist/provider-types.d.mts +19 -20
- package/dist/providers.d.mts +5 -5
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-5ygO2rZc.mjs → reasoning-tag-text-partitioner-C-4uedDb.mjs} +93 -77
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-S6binQG-.mjs} +2 -8
- package/dist/{simple-options-CFj7x3J4.mjs → simple-options-0PLDyJ-d.mjs} +42 -6
- package/dist/{src-Bu3FiFAG.mjs → src-C8U7lkoa.mjs} +75 -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-BtZiml7r.mjs} +21 -31
- package/dist/{transport-stream-shared-rvaCyFYt.d.mts → transport-stream-shared-BrvFTkoO.d.mts} +5 -5
- package/dist/{transport-stream-shared-ljShVIZB.mjs → transport-stream-shared-CytPVLIg.mjs} +18 -5
- package/dist/{transport-utils-LJ1_rbi-.mjs → transport-utils-CtuS1Upe.mjs} +5 -8
- package/dist/transports.d.mts +120 -85
- package/dist/transports.mjs +218 -249
- package/dist/types-B5EFUmXs.d.mts +1 -0
- package/dist/{types-DhLoJbFm.d.mts → types-DbrhszyQ.d.mts} +27 -13
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +4 -4
- package/dist/{validation-Dk7q7NMN.d.mts → validation-BOwtcl9X.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-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-S6binQG-.mjs";
|
|
3
|
+
import { n as getAiTransportHost } from "./host-BIaiBURL.mjs";
|
|
4
4
|
import { r as uniqueValues, t as normalizeStringEntries } from "./string-normalization--fwJ4S2q.mjs";
|
|
5
5
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
6
|
-
import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
7
|
-
import { C as headersToRecord, _ as transportAbortError, f as notifyProviderHttpResponse } from "./transport-stream-shared-
|
|
6
|
+
import { t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-BtZiml7r.mjs";
|
|
7
|
+
import { C as headersToRecord, _ as transportAbortError, f as notifyProviderHttpResponse } from "./transport-stream-shared-CytPVLIg.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;
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -287,6 +215,7 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
287
215
|
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
288
216
|
if (!("value" in descriptor) || !descriptor.enumerable && (policy.propertyScope === "enumerable" || ![
|
|
289
217
|
"cause",
|
|
218
|
+
"errors",
|
|
290
219
|
"message",
|
|
291
220
|
"name",
|
|
292
221
|
"stack"
|
|
@@ -419,4 +348,4 @@ function projectProviderError(error, signal) {
|
|
|
419
348
|
}
|
|
420
349
|
}
|
|
421
350
|
//#endregion
|
|
422
|
-
export {
|
|
351
|
+
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-DbrhszyQ.mjs";
|
|
2
|
+
import "./types-B5EFUmXs.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";
|
|
@@ -82,11 +82,19 @@ type CodeModeToolSurfaceObservation = {
|
|
|
82
82
|
afterToolIdentities: readonly string[];
|
|
83
83
|
};
|
|
84
84
|
type CodeModeToolSurfaceObserver = (observation: CodeModeToolSurfaceObservation) => void;
|
|
85
|
+
declare function markStrictReasoningTagText(options: object): void;
|
|
86
|
+
declare function isStrictReasoningTagText(options: object | undefined): boolean;
|
|
85
87
|
declare const codeModeToolSurfaceObserver: {
|
|
86
88
|
set(options: object, observer: CodeModeToolSurfaceObserver, collector?: CodeModeToolSurfaceObserver): void;
|
|
87
89
|
get(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
88
90
|
getCollector(options: object | undefined): CodeModeToolSurfaceObserver | undefined;
|
|
89
91
|
};
|
|
92
|
+
/** Internal output policy for callers that must not recover ambiguous reasoning as visible text. */
|
|
93
|
+
declare const reasoningTagTextPolicy: {
|
|
94
|
+
markStrict: typeof markStrictReasoningTagText;
|
|
95
|
+
isStrict: typeof isStrictReasoningTagText;
|
|
96
|
+
copy(source: object | undefined, target: object): void;
|
|
97
|
+
};
|
|
90
98
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
91
99
|
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
92
100
|
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
@@ -158,4 +166,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
158
166
|
reasoningEffort?: OpenAIReasoningEffort;
|
|
159
167
|
};
|
|
160
168
|
//#endregion
|
|
161
|
-
export {
|
|
169
|
+
export { supportsOpenAIReasoningEffort as C, resolveOpenAISupportedReasoningEfforts as S, isOpenAIGpt54MiniModel as _, CodeModeToolSurfaceObservation as a, normalizeOpenAIReasoningEffort as b, codeModeToolSurfaceObserver as c, OpenAIToolProjection as d, projectOpenAITools as f, OpenAIReasoningEffort as g, OpenAIApiReasoningEffort as h, BaseOpenAIStreamOptions as i, reasoningTagTextPolicy as l, reconcileOpenAIResponsesToolChoice as m, AnthropicOptions as n, OpenAICompletionsOptions as o, reconcileOpenAICompletionsToolChoice as p, AnthropicThinkingDisplay as r, OpenAIResponsesCompactionRejection as s, AnthropicEffort as t, OpenAICompletionsToolChoice as u, isOpenAIGpt55Model as v, supportsOpenAITemperature as w, resolveOpenAIReasoningEffortForModel as x, isOpenAIGpt56Model as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-BIaiBURL.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 supportsClaudeAdaptiveThinking, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, t as index_d_exports, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./index-AfaxKT8w.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-DbrhszyQ.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-vK_7r3bj.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-BOwtcl9X.mjs";
|
|
6
|
+
import "./types-B5EFUmXs.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, 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-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-Cs6HGNqY.mjs";
|
|
2
2
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-2uo_1OR1.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,5 +1,5 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import { n as projectProviderError } from "./provider-error-
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-B6EGq6gg.mjs";
|
|
3
3
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
5
5
|
/** Source id used for built-in API provider registrations. */
|
|
@@ -62,35 +62,35 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const registerBuiltIns = [
|
|
65
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
65
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-hk7F7ptG.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-D0QZ0AyB.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-B7etBd_H.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-BEUlxfDu.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-CN4Fy5zV.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-BAJ4gq3i.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-CC-nrwXg.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-DCr0pyzQ.mjs"), (module) => ({
|
|
94
94
|
stream: module.streamGoogleVertex,
|
|
95
95
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
96
|
}))
|