@openclaw/ai 2026.11.3 → 2026.11.5-beta.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/README.md +11 -8
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +1 -0
- package/dist/anthropic-DEKgalVg.mjs +182 -0
- package/dist/{anthropic-payload-policy-C0ki72BT.d.mts → anthropic-payload-policy-CXCJ5Pmj.d.mts} +21 -4
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-lifecycle-DF2qVvg1.mjs} +845 -649
- package/dist/{anthropic-tool-projection-C2-d1eZ3.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts} +6 -7
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-dGRfr4iT.mjs} +22 -32
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-DY2MLUyg.d.mts} +2 -2
- package/dist/assistant-output-CD4kY9gu.mjs +16 -0
- package/dist/{azure-openai-responses-BvvXzZbi.mjs → azure-openai-responses-DbQV5RTx.mjs} +47 -53
- package/dist/{cloudflare-Dttf8jKq.mjs → cloudflare-BJ2_Xabx.mjs} +1 -1
- package/dist/{credential-redaction-XvsPf7Yi.d.mts → credential-redaction-DrgndwTJ.d.mts} +5 -3
- package/dist/{deferred-event-buffer-DAvyP7qA.mjs → deferred-event-buffer-tIGkTkTm.mjs} +1 -2
- package/dist/{diagnostics-v7oVEW59.mjs → diagnostics-CloVGQiK.mjs} +27 -20
- package/dist/{diagnostics-DzrF1h4J.mjs → diagnostics-o1PrVNQb.mjs} +11 -4
- package/dist/diagnostics.d.mts +6 -7
- package/dist/diagnostics.mjs +4 -4
- package/dist/{env-api-keys-Xd8dm_aV.mjs → env-api-keys-BuHc86ya.mjs} +1 -26
- package/dist/event-stream-B4ZcSvsu.d.mts +1 -0
- package/dist/{event-stream-CzpE1g_o.d.mts → event-stream-BYmtRe8-.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{github-copilot-request-facts-F-EmvkpW.mjs → github-copilot-request-facts-BZ_EMo7X.mjs} +1 -1
- package/dist/{google-Cpi_cLKZ.mjs → google-B1g82bn4.mjs} +7 -8
- package/dist/{google-interactions-CGINbsjO.mjs → google-interactions-Ckr0Z99Z.mjs} +243 -269
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-A-9d3y5V.mjs} +52 -18
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-CNVh4gpm.mjs} +19 -11
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-WNM86ZcW.mjs} +72 -42
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-CXjleC6g.mjs} +3 -3
- package/dist/{google-video-slots-D8tPH8wX.mjs → google-video-slots-Bxt-OXO8.mjs} +1 -1
- package/dist/{host-CWt55nnF.mjs → host-DX7ORpeH.mjs} +46 -39
- package/dist/{host-jJOffdlW.d.mts → host-ccbwPC3A.d.mts} +17 -9
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-jCZebuXx.mjs} +2 -2
- package/dist/index-Bczt0MnO.d.mts +17 -0
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +9 -7
- package/dist/internal/anthropic.d.mts +21 -26
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.mjs +1 -1
- package/dist/internal/google.d.mts +15 -0
- package/dist/internal/google.mjs +1 -0
- package/dist/internal/model-request-body.d.mts +37 -0
- package/dist/internal/model-request-body.mjs +106 -0
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- 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 +14 -12
- package/dist/internal/openai.mjs +11 -10
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +26 -0
- package/dist/{reasoning-tag-text-partitioner-CU9A4Lg8.mjs → internal/reasoning-tag-text-partitioner.mjs} +313 -111
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +96 -32
- package/dist/internal/runtime.d.mts +15 -41
- package/dist/internal/runtime.mjs +9 -10
- package/dist/internal/shared.d.mts +21 -25
- package/dist/internal/shared.mjs +9 -98
- package/dist/internal/tool-schema.d.mts +10 -10
- package/dist/internal/tool-schema.mjs +4 -4
- package/dist/{llm-request-activity-CfMuh5cC.mjs → llm-request-activity-DzaHoRAU.mjs} +2 -2
- package/dist/mistral-CjHkvsqR.mjs +3741 -0
- package/dist/{openai.LICENSE → mistral.LICENSE} +1 -1
- package/dist/{model-transport-url-BrsjjdjR.d.mts → model-transport-url-BdksnBqu.d.mts} +6 -8
- package/dist/{number-coercion-37gmNkuA.mjs → number-coercion-C7HsBgUL.mjs} +7 -2
- package/dist/observe-async-iterator-AlARO5wS.d.mts +178 -0
- package/dist/observe-async-iterator-DgmegcZR.mjs +181 -0
- package/dist/{openai-chatgpt-responses-BZa3SySh.mjs → openai-chatgpt-responses-CwS5JP7A.mjs} +61 -80
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-CJ-NsDzg.d.mts} +12 -6
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-CstlTQuF.mjs} +74 -50
- package/dist/{openai-completions-CCZ_UHCk.mjs → openai-completions-sj4S-RXQ.mjs} +5 -5
- package/dist/openai-completions-transport-BDAIA0_P.mjs +3406 -0
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-BZGaIWYh.d.mts} +4 -4
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CgDoFhO0.mjs} +5 -4
- package/dist/{openai-responses-compaction-replay-_sUXtcwU.d.mts → openai-responses-compaction-replay-CNHk6k53.d.mts} +4 -4
- package/dist/{openai-responses-contracts-B1nkeLL6.d.mts → openai-responses-contracts-BXMcvO7F.d.mts} +4 -10
- package/dist/{openai-responses-contracts-B5mGAbR6.mjs → openai-responses-contracts-xU-n9AJJ.mjs} +36 -37
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DCkURKS0.mjs} +55 -8
- package/dist/openai-responses-ev_c6oTy.mjs +89 -0
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-DyE30gdD.d.mts} +7 -7
- package/dist/{openai-responses-request-lifecycle-CTqHc02t.mjs → openai-responses-request-lifecycle-BuOs0mwI.mjs} +12 -26
- package/dist/{openai-responses-shared-wx9v1MCn.mjs → openai-responses-shared-BmRQnUPP.mjs} +633 -1493
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-D7IhRA6i.d.mts} +9 -3
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-CsoYgnWy.mjs} +97 -122
- package/dist/otel-Buswj0Mf.mjs +766 -0
- package/dist/{overflow-OF3PgPbw.mjs → overflow-CpApyjG2.mjs} +1 -1
- package/dist/{positive-integer-Bb4Evc7L.mjs → positive-integer-DiqE5vNi.mjs} +2 -3
- package/dist/{prompt-cache-stability-D_MeCQFI.mjs → prompt-cache-stability-w-ICeyOI.mjs} +1 -1
- package/dist/{provider-error-qtZD2inE.mjs → provider-error-DD-fo4Rz.mjs} +71 -234
- package/dist/{provider-options-DAzsyi49.d.mts → provider-options-Mo8NM5d1.d.mts} +16 -5
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-xyU7-CiT.mjs} +2 -2
- package/dist/provider-transcript-transform-DtaxNcC1.mjs +32 -0
- package/dist/{provider-transport-turn-state-D_GjPJHe.mjs → provider-transport-turn-state-BIS8maBK.mjs} +4 -4
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-B1e98js5.d.mts} +3 -3
- package/dist/provider-types.d.mts +7 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +26 -29
- package/dist/{record-coerce-CNDovvft.mjs → record-coerce-BQaoiN3r.mjs} +4 -1
- package/dist/request-headers-DO4Mqhw1.mjs +10 -0
- package/dist/{required-api-key-D088S4Cd.mjs → required-api-key-2zZTkmsi.mjs} +1 -1
- package/dist/{retry-after-BrmTv0jL.d.mts → retry-after-DnHBlFS2.d.mts} +21 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-BISmUlUv.d.mts} +2 -2
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-tLSeECry.mjs} +108 -82
- package/dist/src-BUsVkrNt.mjs +105 -0
- package/dist/{src-CyA0zJnt.mjs → src-CQ7nH2mL.mjs} +4 -7
- package/dist/stable-stringify-CchQEmeA.mjs +84 -0
- package/dist/{stream-C4YDqhFj.mjs → stream-DrtAWu7c.mjs} +2 -6
- package/dist/{stream-first-event-timeout-D_TfJHRJ.mjs → stream-first-event-timeout-B7RcufAV.mjs} +16 -13
- package/dist/{string-coerce-Cj8sqWHx.mjs → string-coerce-BCuWMIrk.mjs} +1 -1
- package/dist/string-normalization-B8TDDBX_.mjs +32 -0
- package/dist/telemetry-CvK1yQg7.mjs +582 -0
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-BQpiJlXJ.mjs} +53 -69
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-D2uFMhMc.mjs} +177 -93
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-D3IAU4jn.d.mts} +29 -15
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-Da_39MYi.mjs} +23 -38
- package/dist/transports.d.mts +42 -39
- package/dist/transports.mjs +215 -296
- package/dist/{types-CVYzKrMl.d.mts → types-BVdTf0YV.d.mts} +38 -3
- package/dist/types-Cb3-5WM9.d.mts +1 -0
- package/dist/{types-BXd0kI8-.mjs → types-OVEWUaDh.mjs} +3 -1
- package/dist/types.d.mts +7 -6
- package/dist/types.mjs +7 -5
- package/dist/{validation-9FSkE8T-.mjs → validation-DGXqfvkj.mjs} +45 -27
- package/dist/{validation-BQ5u20Ru.d.mts → validation-QmyD0E5A.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -2
- package/package.json +40 -6
- package/dist/anthropic-lueA8LUg.mjs +0 -221
- package/dist/assistant-output-BnQm3fov.mjs +0 -47
- package/dist/event-stream-CDpFza-M.d.mts +0 -1
- package/dist/index-DSprYWaz.d.mts +0 -185
- package/dist/mistral-CQ7aoWg2.mjs +0 -512
- package/dist/model-request-body-BD5vy4rP.d.mts +0 -17
- package/dist/openai-CiRi-nVE.mjs +0 -20077
- package/dist/openai-completions-transport-DFvSBbUT.mjs +0 -10881
- package/dist/openai-responses-DQsZKUoI.mjs +0 -87
- package/dist/rolldown-runtime-B4iAMlE-.mjs +0 -35
- package/dist/types-CBJthzJX.d.mts +0 -1
- package/dist/ws.LICENSE +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError } from "./diagnostics-
|
|
1
|
+
import { a as isProviderRefusalAssistantError } from "./diagnostics-o1PrVNQb.mjs";
|
|
2
2
|
//#region packages/ai/src/utils/overflow.ts
|
|
3
3
|
const CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE = /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i;
|
|
4
4
|
const REQUEST_BUDGET_OVERFLOW_RE = /context window exceeded: estimated input \d+ leaves only \d+ output tokens within the \d+-token context\./i;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as parseStrictPositiveInteger, o as floorPositiveFiniteNumber } from "./number-coercion-C7HsBgUL.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/positive-integer.ts
|
|
3
3
|
function parsePositiveInteger(value) {
|
|
4
|
-
|
|
5
|
-
return typeof value === "string" ? parseStrictPositiveInteger(value) : void 0;
|
|
4
|
+
return typeof value === "string" ? parseStrictPositiveInteger(value) : floorPositiveFiniteNumber(value);
|
|
6
5
|
}
|
|
7
6
|
//#endregion
|
|
8
7
|
export { parsePositiveInteger as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-
|
|
1
|
+
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-BCuWMIrk.mjs";
|
|
2
2
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
3
3
|
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { i as asOptionalRecord } from "./record-coerce-
|
|
2
|
-
import { s as normalizeStringifiedOptionalString } from "./string-coerce-
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
1
|
+
import { i as asOptionalRecord } from "./record-coerce-BQaoiN3r.mjs";
|
|
2
|
+
import { s as normalizeStringifiedOptionalString } from "./string-coerce-BCuWMIrk.mjs";
|
|
3
|
+
import "./src-BUsVkrNt.mjs";
|
|
4
|
+
import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
|
|
5
|
+
import { t as stableStringify } from "./stable-stringify-CchQEmeA.mjs";
|
|
6
|
+
import { parseRetryAfterHeadersSeconds, resolveProviderErrorRetrySeconds } from "./internal/retry-after.mjs";
|
|
5
7
|
import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
|
|
6
8
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
7
9
|
function isJsonOpeningDelimiter(char, openers) {
|
|
@@ -46,197 +48,6 @@ function extractBalancedJsonFragments(raw, opts = {}) {
|
|
|
46
48
|
}
|
|
47
49
|
return fragments;
|
|
48
50
|
}
|
|
49
|
-
const DEFAULT_BUDGET_OPTIONS = {};
|
|
50
|
-
const ASCII_RUN_OR_NON_ASCII_CODE_POINT_RE = /[\p{ASCII}]+|[^\p{ASCII}]/gu;
|
|
51
|
-
const WEIGHTED_CJK_RANGES = [
|
|
52
|
-
[
|
|
53
|
-
[183, 183],
|
|
54
|
-
[12288, 12703],
|
|
55
|
-
[19968, 40869],
|
|
56
|
-
[44032, 55215],
|
|
57
|
-
[65281, 65376]
|
|
58
|
-
],
|
|
59
|
-
[
|
|
60
|
-
[4352, 4607],
|
|
61
|
-
[11904, 12287],
|
|
62
|
-
[12704, 19967],
|
|
63
|
-
[40870, 40959],
|
|
64
|
-
[40960, 42239],
|
|
65
|
-
[42752, 42759],
|
|
66
|
-
[43360, 43391],
|
|
67
|
-
[55216, 55295],
|
|
68
|
-
[63744, 64255]
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
[711, 711],
|
|
72
|
-
[713, 715],
|
|
73
|
-
[729, 729],
|
|
74
|
-
[746, 747],
|
|
75
|
-
[773, 773],
|
|
76
|
-
[803, 803],
|
|
77
|
-
[65040, 65103],
|
|
78
|
-
[65377, 65500],
|
|
79
|
-
[65504, 65510]
|
|
80
|
-
],
|
|
81
|
-
[[119648, 119665]],
|
|
82
|
-
[
|
|
83
|
-
[94176, 94207],
|
|
84
|
-
[110576, 110591],
|
|
85
|
-
[110592, 110959],
|
|
86
|
-
[127488, 127743],
|
|
87
|
-
[131072, 195103],
|
|
88
|
-
[196608, 210047]
|
|
89
|
-
]
|
|
90
|
-
];
|
|
91
|
-
const WEIGHTED_CJK_RE = new RegExp(`[${WEIGHTED_CJK_RANGES.flatMap((ranges) => ranges.map(([start, end]) => `\\u{${start.toString(16)}}-\\u{${end.toString(16)}}`)).join("")}]`, "u");
|
|
92
|
-
const CJK_CATEGORY = (() => {
|
|
93
|
-
const maxCodePoint = Math.max(...WEIGHTED_CJK_RANGES.flatMap((ranges) => ranges.map(([, end]) => end)));
|
|
94
|
-
const categories = new Uint8Array(maxCodePoint + 1);
|
|
95
|
-
for (const [bucket, ranges] of WEIGHTED_CJK_RANGES.entries()) for (const [start, end] of ranges) categories.fill(bucket + 1, start, end + 1);
|
|
96
|
-
return categories;
|
|
97
|
-
})();
|
|
98
|
-
function estimateStringChars(text) {
|
|
99
|
-
return estimateStringCharsWithMinimumRawWeight(text);
|
|
100
|
-
}
|
|
101
|
-
/** Apply a raw-text safety floor without multiplying CJK adjustments twice. */
|
|
102
|
-
function estimateStringCharsWithMinimumRawWeight(text, options = DEFAULT_BUDGET_OPTIONS) {
|
|
103
|
-
const minimumRawWeight = Math.max(1, options.minimumRawWeight ?? 1);
|
|
104
|
-
if (minimumRawWeight !== 1 && minimumRawWeight !== 2) {
|
|
105
|
-
let chars = 0;
|
|
106
|
-
for (const match of text.matchAll(ASCII_RUN_OR_NON_ASCII_CODE_POINT_RE)) {
|
|
107
|
-
const segment = match[0];
|
|
108
|
-
const minimumChars = Math.ceil(segment.length * minimumRawWeight);
|
|
109
|
-
chars += segment.charCodeAt(0) <= 127 ? minimumChars : Math.max(estimateStringChars(segment), minimumChars);
|
|
110
|
-
}
|
|
111
|
-
return chars;
|
|
112
|
-
}
|
|
113
|
-
const firstWeighted = text.search(WEIGHTED_CJK_RE);
|
|
114
|
-
if (firstWeighted < 0) return text.length * minimumRawWeight;
|
|
115
|
-
let common = 0;
|
|
116
|
-
let rareBmp = 0;
|
|
117
|
-
let twoToken = 0;
|
|
118
|
-
let threeTokenSupplementary = 0;
|
|
119
|
-
let supplementary = 0;
|
|
120
|
-
for (let index = firstWeighted; index < text.length; index += 1) {
|
|
121
|
-
let codePoint = text.charCodeAt(index);
|
|
122
|
-
if (codePoint < 128) continue;
|
|
123
|
-
if (codePoint >= 55296 && codePoint <= 56319) {
|
|
124
|
-
const low = text.charCodeAt(index + 1);
|
|
125
|
-
if (low >= 56320 && low <= 57343) {
|
|
126
|
-
codePoint = 65536 + (codePoint - 55296) * 1024 + low - 56320;
|
|
127
|
-
index += 1;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
switch (CJK_CATEGORY[codePoint]) {
|
|
131
|
-
case 1:
|
|
132
|
-
common += 1;
|
|
133
|
-
break;
|
|
134
|
-
case 2:
|
|
135
|
-
rareBmp += 1;
|
|
136
|
-
break;
|
|
137
|
-
case 3:
|
|
138
|
-
twoToken += 1;
|
|
139
|
-
break;
|
|
140
|
-
case 4:
|
|
141
|
-
threeTokenSupplementary += 1;
|
|
142
|
-
break;
|
|
143
|
-
case 5: supplementary += 1;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return text.length * minimumRawWeight + common * (4 - minimumRawWeight) + rareBmp * (12 - minimumRawWeight) + twoToken * (8 - minimumRawWeight) + threeTokenSupplementary * (12 - 2 * minimumRawWeight) + supplementary * (16 - 2 * minimumRawWeight);
|
|
147
|
-
}
|
|
148
|
-
function estimateTokensFromChars(chars) {
|
|
149
|
-
return Math.ceil(Math.max(0, chars) / 4);
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region packages/normalization-core/src/expect.ts
|
|
153
|
-
/** Returns the value or throws with the named context; use for genuine invariants only. */
|
|
154
|
-
function expectDefined(value, context) {
|
|
155
|
-
if (value === null || value === void 0) throw new Error("expected " + context + " to be defined");
|
|
156
|
-
return value;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region packages/normalization-core/src/stable-stringify.ts
|
|
160
|
-
const preserveString = (value) => value;
|
|
161
|
-
/** Deterministically stringifies values, optionally normalizing strings before key ordering. */
|
|
162
|
-
function stableStringify(value, normalizeString = preserveString) {
|
|
163
|
-
return stringifyStableValue(value, /* @__PURE__ */ new WeakSet(), normalizeString);
|
|
164
|
-
}
|
|
165
|
-
function stringifyStableValue(value, stack, normalizeString, write) {
|
|
166
|
-
if (value === null || value === void 0) return String(value);
|
|
167
|
-
if (typeof value === "number" && !Number.isFinite(value)) return JSON.stringify(String(value));
|
|
168
|
-
if (typeof value === "bigint") return JSON.stringify(value.toString());
|
|
169
|
-
if (typeof value === "string") return JSON.stringify(normalizeString(value));
|
|
170
|
-
if (typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
171
|
-
if (stack.has(value)) return JSON.stringify("[Circular]");
|
|
172
|
-
stack.add(value);
|
|
173
|
-
try {
|
|
174
|
-
return stringifyObjectValue(value, stack, normalizeString, write);
|
|
175
|
-
} finally {
|
|
176
|
-
stack.delete(value);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function stringifyObjectValue(value, stack, normalizeString, write) {
|
|
180
|
-
if (value instanceof Error) return stringifyStableValue({
|
|
181
|
-
name: value.name,
|
|
182
|
-
message: value.message,
|
|
183
|
-
stack: value.stack
|
|
184
|
-
}, stack, normalizeString, write);
|
|
185
|
-
if (value instanceof Uint8Array) return stringifyStableValue({
|
|
186
|
-
type: "Uint8Array",
|
|
187
|
-
data: encodeBase64(value)
|
|
188
|
-
}, stack, normalizeString, write);
|
|
189
|
-
if (Array.isArray(value)) {
|
|
190
|
-
if (write) {
|
|
191
|
-
write("[");
|
|
192
|
-
let separator = "";
|
|
193
|
-
for (const entry of value) {
|
|
194
|
-
write(separator);
|
|
195
|
-
write(stringifyStableValue(entry, stack, normalizeString, write));
|
|
196
|
-
separator = ",";
|
|
197
|
-
}
|
|
198
|
-
write("]");
|
|
199
|
-
return "";
|
|
200
|
-
}
|
|
201
|
-
const serializedEntries = [];
|
|
202
|
-
for (const entry of value) serializedEntries.push(stringifyStableValue(entry, stack, normalizeString));
|
|
203
|
-
return `[${serializedEntries.join(",")}]`;
|
|
204
|
-
}
|
|
205
|
-
const record = value;
|
|
206
|
-
const keys = Object.keys(record);
|
|
207
|
-
const fields = normalizeString === preserveString ? keys.sort() : keys.map((key) => ({
|
|
208
|
-
key,
|
|
209
|
-
normalizedKey: normalizeString(key)
|
|
210
|
-
})).sort((left, right) => {
|
|
211
|
-
return compareStableStrings(left.normalizedKey, right.normalizedKey) || compareStableStrings(left.key, right.key);
|
|
212
|
-
});
|
|
213
|
-
write?.("{");
|
|
214
|
-
const serializedFields = normalizeString === preserveString ? keys : [];
|
|
215
|
-
let separator = "";
|
|
216
|
-
let fieldIndex = 0;
|
|
217
|
-
for (const field of fields) {
|
|
218
|
-
const key = typeof field === "string" ? field : field.key;
|
|
219
|
-
const prefix = `${JSON.stringify(typeof field === "string" ? field : field.normalizedKey)}:`;
|
|
220
|
-
if (write) {
|
|
221
|
-
write(`${separator}${prefix}`);
|
|
222
|
-
write(stringifyStableValue(record[key], stack, normalizeString, write));
|
|
223
|
-
separator = ",";
|
|
224
|
-
} else serializedFields[fieldIndex++] = `${prefix}${stringifyStableValue(record[key], stack, normalizeString)}`;
|
|
225
|
-
}
|
|
226
|
-
if (write) {
|
|
227
|
-
write("}");
|
|
228
|
-
return "";
|
|
229
|
-
}
|
|
230
|
-
return `{${serializedFields.join(",")}}`;
|
|
231
|
-
}
|
|
232
|
-
function encodeBase64(value) {
|
|
233
|
-
let binary = "";
|
|
234
|
-
for (const byte of value) binary += String.fromCharCode(byte);
|
|
235
|
-
return btoa(binary);
|
|
236
|
-
}
|
|
237
|
-
function compareStableStrings(left, right) {
|
|
238
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
239
|
-
}
|
|
240
51
|
//#endregion
|
|
241
52
|
//#region packages/normalization-core/src/utf16-slice.ts
|
|
242
53
|
function isHighSurrogate(codeUnit) {
|
|
@@ -331,14 +142,22 @@ function hasSensitiveProseContent(value) {
|
|
|
331
142
|
const key = expectDefined(match[1], "diagnostic assignment field");
|
|
332
143
|
const normalized = normalizeDiagnosticFieldName(key);
|
|
333
144
|
if (isCredentialFieldName(normalized) || extractDiagnosticMediaField(key, normalized, void 0, false)) return true;
|
|
334
|
-
mediaContext ||= isDiagnosticMediaPayload(
|
|
145
|
+
mediaContext ||= isDiagnosticMediaPayload((field) => field === key ? assigned : void 0);
|
|
335
146
|
contextualPayload ||= Boolean(extractDiagnosticMediaField(key, normalized, void 0, true));
|
|
336
147
|
if (mediaContext && contextualPayload) return true;
|
|
337
148
|
}
|
|
338
149
|
return false;
|
|
339
150
|
}
|
|
151
|
+
const normalizedDiagnosticFieldNames = /* @__PURE__ */ new Map();
|
|
152
|
+
const NORMALIZED_DIAGNOSTIC_FIELD_NAMES_MAX_ENTRIES = 4096;
|
|
340
153
|
function normalizeDiagnosticFieldName(value) {
|
|
341
|
-
|
|
154
|
+
let normalized = normalizedDiagnosticFieldNames.get(value);
|
|
155
|
+
if (normalized === void 0) {
|
|
156
|
+
normalized = value.toLowerCase().replaceAll(DIAGNOSTIC_FIELD_SEPARATOR_RE, "");
|
|
157
|
+
if (normalizedDiagnosticFieldNames.size >= NORMALIZED_DIAGNOSTIC_FIELD_NAMES_MAX_ENTRIES) normalizedDiagnosticFieldNames.clear();
|
|
158
|
+
normalizedDiagnosticFieldNames.set(value, normalized);
|
|
159
|
+
}
|
|
160
|
+
return normalized;
|
|
342
161
|
}
|
|
343
162
|
/** Classifies credential-bearing fields, including case-insensitive HTTP header names. */
|
|
344
163
|
function isCredentialFieldName(name) {
|
|
@@ -352,11 +171,11 @@ function redactCredentialText(value) {
|
|
|
352
171
|
function diagnosticBytes(value, numericArrays = false) {
|
|
353
172
|
return value instanceof ArrayBuffer ? new Uint8Array(value) : ArrayBuffer.isView(value) ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength) : numericArrays && Array.isArray(value) && value.every((byte) => Number.isInteger(byte) && byte >= 0 && byte <= 255) ? Uint8Array.from(value) : void 0;
|
|
354
173
|
}
|
|
355
|
-
function isDiagnosticMediaPayload(
|
|
356
|
-
const type =
|
|
174
|
+
function isDiagnosticMediaPayload(field) {
|
|
175
|
+
const type = field("type");
|
|
357
176
|
if (typeof type === "string" && MEDIA_TYPE_RE.test(normalizeDiagnosticFieldName(type))) return true;
|
|
358
177
|
for (const key of MEDIA_MIME_FIELDS) {
|
|
359
|
-
const mime =
|
|
178
|
+
const mime = field(key);
|
|
360
179
|
if (typeof mime === "string" && MEDIA_MIME_RE.test(mime)) return true;
|
|
361
180
|
}
|
|
362
181
|
return false;
|
|
@@ -375,16 +194,16 @@ function extractDiagnosticMediaField(key, normalized, value, parentMedia) {
|
|
|
375
194
|
source: encoded
|
|
376
195
|
};
|
|
377
196
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
function createDiagnosticRecord() {
|
|
381
|
-
const record = {};
|
|
382
|
-
diagnosticRecords.add(record);
|
|
383
|
-
return record;
|
|
197
|
+
function projectDiagnosticValue(value, policy = {}, seen, mediaPayload, state) {
|
|
198
|
+
return projectValue(false, value, policy, seen, mediaPayload, state);
|
|
384
199
|
}
|
|
385
|
-
|
|
200
|
+
/** Internal producers transfer fresh ordinary records and dense arrays; arrays may be reused. */
|
|
201
|
+
function projectPreparedDiagnosticValue(value, policy) {
|
|
202
|
+
return projectValue(true, value, policy);
|
|
203
|
+
}
|
|
204
|
+
function projectValue(producerOwned, value, policy = {}, seen = /* @__PURE__ */ new WeakSet(), mediaPayload = false, state = {
|
|
386
205
|
changed: false,
|
|
387
|
-
nodesRemaining: 64
|
|
206
|
+
nodesRemaining: policy.maxNodes ?? 64
|
|
388
207
|
}) {
|
|
389
208
|
try {
|
|
390
209
|
if (typeof value === "string") {
|
|
@@ -406,36 +225,49 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
406
225
|
state.changed = true;
|
|
407
226
|
return "[Truncated]";
|
|
408
227
|
}
|
|
409
|
-
|
|
228
|
+
const array = Array.isArray(value);
|
|
229
|
+
if (!array && (!producerOwned || Object.getPrototypeOf(value) !== Object.prototype)) try {
|
|
410
230
|
Headers.prototype.has.call(value, "retry-after");
|
|
411
231
|
const seconds = parseRetryAfterHeadersSeconds(value);
|
|
412
232
|
state.changed = true;
|
|
413
233
|
return seconds === void 0 ? {} : { "retry-after-ms": seconds * 1e3 };
|
|
414
234
|
} catch {}
|
|
415
235
|
const keys = Reflect.ownKeys(value);
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const
|
|
421
|
-
|
|
236
|
+
const maxKeys = policy.maxKeys ?? 64;
|
|
237
|
+
const trusted = keys.length <= maxKeys && producerOwned && Object.getPrototypeOf(value) === (array ? Array.prototype : Object.prototype);
|
|
238
|
+
let descriptors;
|
|
239
|
+
if (!trusted) {
|
|
240
|
+
const snapshot = Object.create(null);
|
|
241
|
+
for (let index = 0; index < Math.min(keys.length, maxKeys); index += 1) {
|
|
242
|
+
const key = keys[index];
|
|
243
|
+
if (typeof key !== "string") continue;
|
|
244
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
245
|
+
if (descriptor) snapshot[key] = descriptor;
|
|
246
|
+
}
|
|
247
|
+
descriptors = snapshot;
|
|
422
248
|
}
|
|
423
|
-
|
|
249
|
+
const field = (key) => descriptors ? descriptors[key]?.value : Object.hasOwn(value, key) ? Reflect.get(value, key) : void 0;
|
|
250
|
+
state.changed ||= keys.length > maxKeys;
|
|
424
251
|
seen.add(value);
|
|
425
|
-
const out = Array.isArray(value) ? [] : {};
|
|
426
|
-
const
|
|
427
|
-
const
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
if (
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
"
|
|
435
|
-
"
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
252
|
+
const out = Array.isArray(value) ? trusted && !policy.omitField ? value : [] : {};
|
|
253
|
+
const name = field("name");
|
|
254
|
+
const rawName = typeof name === "string" ? name : field("key");
|
|
255
|
+
const redactValueField = policy.redactCredentials !== false && (keys.length > maxKeys || typeof rawName === "string" && isCredentialFieldName(normalizeDiagnosticFieldName(rawName)));
|
|
256
|
+
const redactMedia = mediaPayload || keys.length > maxKeys || isDiagnosticMediaPayload(field);
|
|
257
|
+
for (const key of descriptors ? Object.keys(descriptors) : keys) {
|
|
258
|
+
if (typeof key !== "string" || key === "length") continue;
|
|
259
|
+
let child;
|
|
260
|
+
if (descriptors) {
|
|
261
|
+
const descriptor = expectDefined(descriptors[key], "diagnostic descriptor");
|
|
262
|
+
if (!("value" in descriptor) || !descriptor.enumerable && (policy.propertyScope === "enumerable" || ![
|
|
263
|
+
"cause",
|
|
264
|
+
"errors",
|
|
265
|
+
"message",
|
|
266
|
+
"name",
|
|
267
|
+
"stack"
|
|
268
|
+
].includes(key))) continue;
|
|
269
|
+
child = descriptor.value;
|
|
270
|
+
} else child = Reflect.get(value, key);
|
|
439
271
|
const normalized = policy.omitField?.(key) ? void 0 : normalizeDiagnosticFieldName(key);
|
|
440
272
|
if (normalized === void 0 || policy.redactCredentials !== false && isCredentialFieldName(normalized)) {
|
|
441
273
|
state.changed = true;
|
|
@@ -456,7 +288,7 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
456
288
|
state.changed = true;
|
|
457
289
|
continue;
|
|
458
290
|
}
|
|
459
|
-
out[key] =
|
|
291
|
+
out[key] = projectValue(producerOwned, child, policy, seen, media?.kind === "context", state);
|
|
460
292
|
}
|
|
461
293
|
return out;
|
|
462
294
|
} catch {
|
|
@@ -500,7 +332,7 @@ function projectDiagnosticText(value) {
|
|
|
500
332
|
changed: false,
|
|
501
333
|
nodesRemaining: 64
|
|
502
334
|
};
|
|
503
|
-
const projected =
|
|
335
|
+
const projected = projectValue(true, JSON.parse(fragment.json), {}, /* @__PURE__ */ new WeakSet(), false, state);
|
|
504
336
|
redacted += state.changed ? stableStringify(projected) : fragment.json;
|
|
505
337
|
} catch {
|
|
506
338
|
return "[Malformed diagnostic JSON redacted]";
|
|
@@ -513,6 +345,11 @@ function projectDiagnosticText(value) {
|
|
|
513
345
|
//#endregion
|
|
514
346
|
//#region packages/ai/src/utils/provider-error.ts
|
|
515
347
|
const MAX_ERROR_BODY_LENGTH = 4e3;
|
|
348
|
+
/** Diagnostics accept provider classification labels, not arbitrary error prose or objects. */
|
|
349
|
+
function readTransportDiagnosticLabel(value) {
|
|
350
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
|
|
351
|
+
return typeof value === "string" && /^[a-zA-Z0-9_.:-]{1,128}$/.test(value) ? value : void 0;
|
|
352
|
+
}
|
|
516
353
|
let providerErrorRedactor;
|
|
517
354
|
function configureProviderErrorRedactor(redactor) {
|
|
518
355
|
const previous = providerErrorRedactor;
|
|
@@ -570,7 +407,7 @@ function buildProjection(snapshot, signal) {
|
|
|
570
407
|
/** Projects one hostile provider throw into final, bounded assistant terminal fields. */
|
|
571
408
|
function projectProviderError(error, signal) {
|
|
572
409
|
try {
|
|
573
|
-
const retryAfterSeconds =
|
|
410
|
+
const retryAfterSeconds = resolveProviderErrorRetrySeconds(error);
|
|
574
411
|
const localSnapshot = projectDiagnosticValue(error);
|
|
575
412
|
let snapshot = localSnapshot;
|
|
576
413
|
try {
|
|
@@ -593,4 +430,4 @@ function projectProviderError(error, signal) {
|
|
|
593
430
|
}
|
|
594
431
|
}
|
|
595
432
|
//#endregion
|
|
596
|
-
export { projectDiagnosticValue as a,
|
|
433
|
+
export { projectDiagnosticValue as a, truncateUtf16Safe as c, isCredentialFieldName as i, projectProviderError as n, projectPreparedDiagnosticValue as o, readTransportDiagnosticLabel as r, redactDiagnosticText as s, configureProviderErrorRedactor as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types-
|
|
3
|
-
import
|
|
1
|
+
import { at as StreamOptions } from "./types-BVdTf0YV.mjs";
|
|
2
|
+
import "./types-Cb3-5WM9.mjs";
|
|
3
|
+
import { a as ProviderContext, c as ProviderModel, u as ProviderStreamOptions } from "./provider-types-B1e98js5.mjs";
|
|
4
4
|
import OpenAI from "openai";
|
|
5
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
5
6
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
6
7
|
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
7
8
|
declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -14,6 +15,7 @@ type OpenAIReasoningModel = {
|
|
|
14
15
|
api?: unknown;
|
|
15
16
|
baseUrl?: unknown;
|
|
16
17
|
compat?: unknown;
|
|
18
|
+
thinkingLevelMap?: unknown;
|
|
17
19
|
};
|
|
18
20
|
/** Return whether a model is the GPT-5.4 mini family. */
|
|
19
21
|
declare function isOpenAIGpt54MiniModel(model: OpenAIReasoningModel): boolean;
|
|
@@ -96,6 +98,14 @@ type CodeModeToolSurfaceObservation = {
|
|
|
96
98
|
beforeToolIdentities: readonly string[];
|
|
97
99
|
afterToolIdentities: readonly string[];
|
|
98
100
|
};
|
|
101
|
+
type RequestModelIdentity = Pick<ProviderModel, "provider" | "id" | "api"> & {
|
|
102
|
+
baseUrl?: string;
|
|
103
|
+
};
|
|
104
|
+
/** Request-local pressure admitted by the host's matched provider-usage owner. */
|
|
105
|
+
declare const measuredRequestPressure: {
|
|
106
|
+
set(model: RequestModelIdentity, context: ProviderContext, tokens: number | undefined): void;
|
|
107
|
+
get(model: RequestModelIdentity, context: ProviderContext): number | undefined;
|
|
108
|
+
};
|
|
99
109
|
type CodeModeToolSurfaceObserver = (observation: CodeModeToolSurfaceObservation) => void;
|
|
100
110
|
declare function markStrictReasoningTagText(options: object): void;
|
|
101
111
|
declare function isStrictReasoningTagText(options: object | undefined): boolean;
|
|
@@ -114,6 +124,7 @@ declare const reasoningTagTextPolicy: {
|
|
|
114
124
|
declare const preparedRequestSuffix: {
|
|
115
125
|
mark(context: object, toolCallIds: ReadonlySet<string>): void;
|
|
116
126
|
has(context: object): boolean;
|
|
127
|
+
hasToolCall(context: object, id: string): boolean;
|
|
117
128
|
toolCallId(context: object, id: string, normalized: string): string;
|
|
118
129
|
};
|
|
119
130
|
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
@@ -179,7 +190,7 @@ interface AnthropicOptions extends StreamOptions, AnthropicContextManagementOpti
|
|
|
179
190
|
client?: Anthropic;
|
|
180
191
|
}
|
|
181
192
|
/** Options shared by the OpenAI Responses and Completions transports. */
|
|
182
|
-
type BaseOpenAIStreamOptions =
|
|
193
|
+
type BaseOpenAIStreamOptions = ProviderStreamOptions & {
|
|
183
194
|
topP?: number;
|
|
184
195
|
authProfileId?: string;
|
|
185
196
|
firstEventTimeoutMs?: number;
|
|
@@ -200,4 +211,4 @@ type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
|
200
211
|
reasoningEffort?: OpenAIReasoningEffort | "off";
|
|
201
212
|
};
|
|
202
213
|
//#endregion
|
|
203
|
-
export {
|
|
214
|
+
export { resolveOpenAISupportedReasoningEfforts as A, isOpenAIGpt55Model as C, resolveOpenAIModelReasoningEfforts as D, normalizeOpenAIReasoningEffort as E, supportsOpenAITemperature as M, resolveOpenAIReasoningEffortForModel as O, isOpenAIGpt54MiniModel as S, isOpenAIGpt6Model as T, reconcileOpenAICompletionsToolChoice as _, BaseOpenAIStreamOptions as a, OpenAIReasoningEffort as b, OpenAICompletionsOptions as c, measuredRequestPressure as d, preparedRequestSuffix as f, projectOpenAITools as g, OpenAIToolProjection as h, AnthropicThinkingDisplay as i, supportsOpenAIReasoningEffort as j, resolveOpenAIReasoningEffortMapping as k, OpenAIResponsesCompactionRejection as l, OpenAICompletionsToolChoice as m, AnthropicEffort as n, CodeModeToolSurfaceObservation as o, reasoningTagTextPolicy as p, AnthropicOptions as r, CompactionReplayRejection as s, AnthropicContextManagementOptions as t, codeModeToolSurfaceObserver as u, reconcileOpenAIResponsesToolChoice as v, isOpenAIGpt56Model as w, applyOpenAICompletionsToolReasoning as x, OpenAIApiReasoningEffort as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as isRecord } from "./record-coerce-
|
|
2
|
-
import {
|
|
1
|
+
import { o as isRecord } from "./record-coerce-BQaoiN3r.mjs";
|
|
2
|
+
import { D as shortHash } from "./transport-stream-shared-D2uFMhMc.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/provider-replay-context.ts
|
|
4
4
|
function isProviderReplayContext(value) {
|
|
5
5
|
return isRecord(value) && typeof value.provider === "string" && typeof value.api === "string" && typeof value.model === "string" && (value.baseUrlHash === void 0 || typeof value.baseUrlHash === "string") && (value.sessionHash === void 0 || typeof value.sessionHash === "string") && (value.authProfileHash === void 0 || typeof value.authProfileHash === "string");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as transformMessages } from "./host-DX7ORpeH.mjs";
|
|
2
|
+
//#region packages/ai/src/provider-transcript-transform.ts
|
|
3
|
+
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
|
+
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
5
|
+
function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
6
|
+
const target = {
|
|
7
|
+
...model,
|
|
8
|
+
input: model.input.filter((type) => type !== "video")
|
|
9
|
+
};
|
|
10
|
+
return transformMessages(messages.map((message) => {
|
|
11
|
+
if (message.role !== "user" || !Array.isArray(message.content)) return message;
|
|
12
|
+
const content = message.content;
|
|
13
|
+
const supportsImages = model.input.includes("image");
|
|
14
|
+
const supportsVideo = (model.api === "openai-completions" || model.api === "google-interactions") && model.input.includes("video");
|
|
15
|
+
const result = [];
|
|
16
|
+
for (const block of content) {
|
|
17
|
+
if (block.type === "text" || block.type === "image" && supportsImages || block.type === "video" && supportsVideo) {
|
|
18
|
+
result.push(block);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const text = block.type === "video" ? VIDEO_OMISSION : IMAGE_OMISSION;
|
|
22
|
+
const previous = result.at(-1);
|
|
23
|
+
if (block.data.trim() && !(previous?.type === "text" && previous.text === text)) result.push({
|
|
24
|
+
type: "text",
|
|
25
|
+
text
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return Object.isFrozen(message) && Object.isFrozen(content) && result.length === content.length && result.every((block, index) => block === content[index]) ? message : Object.assign({}, message, { content: result });
|
|
29
|
+
}), target, normalizeToolCallId);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { transformProviderMessages as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
2
|
-
import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-DX7ORpeH.mjs";
|
|
2
|
+
import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-BJ2_Xabx.mjs";
|
|
3
3
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { n as OpenAI } from "./openai-CiRi-nVE.mjs";
|
|
4
|
+
import { Ft as resolveOpenAIClientBaseUrl, Lt as withOpenAIErrorResponseHook } from "./openai-responses-shared-BmRQnUPP.mjs";
|
|
6
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
+
import OpenAI from "openai";
|
|
7
7
|
//#region packages/ai/src/providers/openai-provider-client.ts
|
|
8
8
|
function createOpenAIProviderClient(model, apiKey, headers, optionsHeaders, onResponse) {
|
|
9
9
|
if (optionsHeaders) Object.assign(headers, optionsHeaders);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./types-
|
|
1
|
+
import { _t as UserMessage, a as AssistantMessage, at as StreamOptions, d as Context, k as Model, mt as ToolResultMessage, n as Api, ot as TextContent, p as ImageContent, s as AssistantMessageEventStreamContract } from "./types-BVdTf0YV.mjs";
|
|
2
|
+
import "./index-Bczt0MnO.mjs";
|
|
3
|
+
import "./types-Cb3-5WM9.mjs";
|
|
4
4
|
//#region packages/ai/src/provider-types.d.ts
|
|
5
5
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
6
|
declare const PROVIDER_MODEL_INPUT: unique symbol;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { C as supportsClaudeFastMode, D as supportsClaudeServerCompaction, E as supportsClaudeNativeXhighEffort, S as supportsClaudeAdaptiveThinking, T as supportsClaudeNativeMaxEffort, _ as resolveClaudeOpus55ModelIdentity, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as resolveClaudeSonnet5ModelIdentity, c as bindsClaudeThinkingPrefix, d as requiresClaudeMandatoryAdaptiveThinking, f as resolveClaudeFable5ModelIdentity, g as resolveClaudeNativeThinkingLevelMap, h as resolveClaudeMythos5ModelIdentity, i as CLAUDE_OPUS_55_THINKING_PROFILE, l as requiresClaudeBetweenToolsThinking, m as resolveClaudeModelIdentity, n as CLAUDE_FABLE_5_THINKING_PROFILE, o as CLAUDE_SONNET_55_THINKING_PROFILE, p as resolveClaudeHaiku55ModelIdentity, r as CLAUDE_HAIKU_55_THINKING_PROFILE, s as CLAUDE_SONNET_5_THINKING_PROFILE, t as observeAsyncIterator, u as requiresClaudeDefaultSampling, v as resolveClaudeOpus5ModelIdentity, w as supportsClaudeInHistorySystemMessages, x as supportsClaude1MContext, y as resolveClaudeSonnet55ModelIdentity } from "./observe-async-iterator-AlARO5wS.mjs";
|
|
2
|
+
import { $ as RawPricingTier, A as ModelCostConfig, At as DiagnosticErrorInfo, B as PricingTier, C as KnownApi, Ct as isRuntimeContextMessage, D as MaybePromise, Dt as runtimeContextContentToText, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as readRuntimeContextMetadata, F as OpenAIResponsesCompat, Ft as formatThrownValue, H as ProviderImagesOptions, I as OpenRouterRouting, It as isProviderRefusalAssistantError, J as RUNTIME_CONTEXT_CUSTOM_TYPE, K as REPETITIVE_OUTPUT_ERROR_CODE, L as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Lt as readProviderRefusalReview, M as ModelRequestHeaders, Mt as appendAssistantMessageDiagnostic, N as ModelThinkingLevel, Nt as createAssistantMessageDiagnostic, Ot as setRuntimeContextRetention, P as OpenAICompletionsCompat, Pt as extractDiagnosticError, Q as RawModelCostConfig, R as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Rt as recordSuppressedReasoning, S as ImagesStopReason, St as hasRuntimeContextMarker, T as KnownImagesProvider, Tt as labelRuntimeContextText, U as ProviderReplayState, V as Provider, W as ProviderResponse, X as RUNTIME_CONTEXT_FOOTER, Y as RUNTIME_CONTEXT_END_MARKER, Z as RUNTIME_CONTEXT_HEADER, _ as ImagesInputContent, _t as UserMessage, a as AssistantMessage, at as StreamOptions, b as ImagesOutputContent, bt as escapeRuntimeContextFooter, c as AssistantMessageEventStreamLike, ct as ThinkingBudgets, dt as ThinkingLevelMap, et as RuntimeContextMessage, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Tool, g as ImagesFunction, gt as Usage, h as ImagesContext, ht as Transport, i as AssistantImages, j as ModelCostRates, jt as ProviderRefusalReview, kt as AssistantMessageDiagnostic, l as CacheRetention, lt as ThinkingContent, m as ImagesApi, mt as ToolResultMessage, n as Api, nt as StopReason, o as AssistantMessageEvent, ot as TextContent, p as ImageContent, pt as ToolCall, q as RUNTIME_CONTEXT_BEGIN_MARKER, r as AssistantDeliveryTtsFacts, rt as StreamFn, s as AssistantMessageEventStreamContract, st as TextSignatureV1, t as AnthropicMessagesCompat, tt as SimpleStreamOptions, u as CompleteSimpleFn, ut as ThinkingLevel, v as ImagesModel, vt as ValidateToolArgumentsFn, w as KnownImagesApi, wt as labelRuntimeContextContent, x as ImagesProvider, xt as hasLegacyRuntimeContextEnvelope, y as ImagesOptions, yt as VercelGatewayRouting, z as PreparedSystemPrompt } from "./types-BVdTf0YV.mjs";
|
|
3
|
+
import { a as normalizeResolvedPricing, i as normalizeModelCostConfig, n as appendTextDeltaToAssistantMessage, r as calculateUsageCost, t as omitNullRequestHeaders } from "./index-Bczt0MnO.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BYmtRe8-.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-QmyD0E5A.mjs";
|
|
6
|
+
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-B1e98js5.mjs";
|
|
7
|
+
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_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, 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 ModelRequestHeaders, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PreparedSystemPrompt, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type REPETITIVE_OUTPUT_ERROR_CODE, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, 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 appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type observeAsyncIterator, type omitNullRequestHeaders, type readProviderRefusalReview, type readRuntimeContextMetadata, type recordSuppressedReasoning, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, 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-DY2MLUyg.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-BZGaIWYh.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";
|