@openclaw/ai 2026.11.2 → 2026.11.4
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 +9 -1
- package/dist/{anthropic-CUVqVXTe.mjs → anthropic-C8cQsW5d.mjs} +46 -26
- package/dist/{anthropic-payload-policy-rqCq9sT_.d.mts → anthropic-payload-policy-BCp4dUJR.d.mts} +2 -2
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-reducer-BgAICq34.mjs} +11 -10
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-CrsCkF4k.mjs} +1 -1
- package/dist/{anthropic-tool-projection-JTvMo4KG.d.mts → anthropic-tool-projection-CzSSQzZL.d.mts} +1 -1
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-CkmxPPac.d.mts} +1 -1
- package/dist/{assistant-output-BnQm3fov.mjs → assistant-output-Hl3b-ViJ.mjs} +2 -2
- package/dist/{azure-openai-responses-I97-HnAv.mjs → azure-openai-responses-CZKrN3aq.mjs} +5 -5
- package/dist/diagnostics.d.mts +3 -3
- package/dist/{google-Cpi_cLKZ.mjs → google-DuI8TLy0.mjs} +2 -2
- package/dist/{google-interactions-BYRQ49MR.mjs → google-interactions-jbqgn8zL.mjs} +8 -8
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-BWhsZ167.mjs} +3 -3
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-DL0bXgX5.mjs} +6 -6
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-DXizMtnG.mjs} +5 -5
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-DnjRWo-M.mjs} +2 -2
- package/dist/{host-jJOffdlW.d.mts → host-B03VqZdH.d.mts} +2 -2
- package/dist/{host-CWt55nnF.mjs → host-CyGba3M8.mjs} +99 -80
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-CNQztzZm.mjs} +1 -1
- package/dist/{index-DSprYWaz.d.mts → index-B8ODIVmA.d.mts} +15 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +15 -5
- package/dist/internal/anthropic.mjs +6 -6
- 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 +1 -1
- package/dist/internal/openai.d.mts +8 -8
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/runtime.d.mts +6 -6
- package/dist/internal/runtime.mjs +4 -4
- package/dist/internal/shared.d.mts +3 -3
- package/dist/internal/shared.mjs +2 -2
- package/dist/internal/tool-schema.d.mts +2 -2
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{mistral-CQ7aoWg2.mjs → mistral-BgamhpFG.mjs} +4 -4
- package/dist/openai-DAGvHDxa.mjs +20077 -0
- package/dist/{openai-chatgpt-responses-DgDVhpUI.mjs → openai-chatgpt-responses-CWIwGLDZ.mjs} +10 -10
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-D9KEUevM.mjs} +1 -1
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-DTe2EXPi.d.mts} +2 -2
- package/dist/{openai-completions-BdfBhFjx.mjs → openai-completions-kAWkz3bl.mjs} +4 -4
- package/dist/openai-completions-transport-bgZfY_xa.mjs +10881 -0
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CAo-Mah6.mjs} +1 -1
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-k7EPMLa0.d.mts} +1 -1
- package/dist/{openai-responses-compaction-replay-DUBbsfku.d.mts → openai-responses-compaction-replay-DOJaDCUl.d.mts} +3 -3
- package/dist/{openai-responses-contracts-gnl6ZRs1.d.mts → openai-responses-contracts-DHtim7d_.d.mts} +3 -3
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DJwbSy3n.mjs} +3 -1
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-cIaYG5ZQ.d.mts} +1 -0
- package/dist/{openai-responses-request-lifecycle-WKXjj_th.mjs → openai-responses-request-lifecycle-CQBkk3bx.mjs} +6 -6
- package/dist/{openai-responses-shared-iWBHb0Sq.mjs → openai-responses-shared-C8C1myRt.mjs} +1092 -15
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-BDGDBGuA.d.mts} +1 -1
- package/dist/{openai-responses-5KI4v8DN.mjs → openai-responses-wWDdPeKC.mjs} +7 -7
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-D913am3I.mjs} +3 -2
- package/dist/openai.LICENSE +201 -0
- package/dist/{provider-options-Bo8GzTGX.d.mts → provider-options-DFjnfImJ.d.mts} +8 -2
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-BWgW0iTm.mjs} +1 -1
- package/dist/{provider-transport-turn-state-BbaD56A1.mjs → provider-transport-turn-state-CxXS1_Cv.mjs} +3 -3
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-C-67EZr8.d.mts} +2 -2
- package/dist/provider-types.d.mts +3 -3
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-DzlRubwU.mjs → reasoning-tag-text-partitioner-CU9A4Lg8.mjs} +2 -13
- package/dist/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-CkejzD2f.d.mts} +1 -1
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-Bd0STwu7.mjs} +2 -2
- package/dist/{src-CyA0zJnt.mjs → src--qsViR3j.mjs} +60 -12
- package/dist/{stream-C4YDqhFj.mjs → stream-BRecd0FZ.mjs} +1 -1
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-DU-FFSa7.mjs} +1 -1
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-C1AtJhZA.mjs} +1 -1
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-Dhx_37f1.d.mts} +1 -1
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-4xPfuKp2.mjs} +2 -2
- package/dist/transports.d.mts +13 -13
- package/dist/transports.mjs +61 -41
- package/dist/types-BFfXm_Jr.d.mts +1 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +2 -2
- package/dist/ws.LICENSE +20 -0
- package/package.json +1 -1
- package/dist/openai-completions-transport-CnFaKYO-.mjs +0 -3425
- package/dist/types-CBJthzJX.d.mts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as supportsClaudeNativeXhighEffort, C as resolveClaudeSonnet55ModelIdentity, M as usesClaude5RequestContract, S as resolveClaudeOpus5ModelIdentity, _ as resolveClaudeHaiku55ModelIdentity, a as CLAUDE_HAIKU_55_THINKING_PROFILE, b as resolveClaudeNativeThinkingLevelMap, c as CLAUDE_SONNET_55_THINKING_PROFILE, f as rejectsClaudeAssistantPrefill, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as CLAUDE_FABLE_5_THINKING_PROFILE, k as supportsClaudeNativeMaxEffort, m as requiresClaudeDefaultSampling, o as CLAUDE_OPUS_55_THINKING_PROFILE, t as calculateUsageCost, u as bindsClaudeThinkingPrefix, v as resolveClaudeModelIdentity, w as resolveClaudeSonnet5ModelIdentity, x as resolveClaudeOpus55ModelIdentity } from "./src--qsViR3j.mjs";
|
|
2
2
|
import { t as DEFAULT_MISSING_TOOL_RESULT_TEXT } from "./types-BXd0kI8-.mjs";
|
|
3
3
|
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-Cj8sqWHx.mjs";
|
|
@@ -70,6 +70,48 @@ function headersToRecord(headers) {
|
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region packages/ai/src/providers/anthropic-model-contract.ts
|
|
72
72
|
const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.280";
|
|
73
|
+
let learnedClaudeCodeVersion;
|
|
74
|
+
function parseClaudeCodeVersion(value) {
|
|
75
|
+
const parts = (value?.match(/^(\d+)\.(\d+)\.(\d+)$/))?.slice(1).map(Number);
|
|
76
|
+
return parts?.every(Number.isSafeInteger) ? parts : void 0;
|
|
77
|
+
}
|
|
78
|
+
function isNewerClaudeCodeVersion(candidate, current) {
|
|
79
|
+
const next = parseClaudeCodeVersion(candidate);
|
|
80
|
+
const base = parseClaudeCodeVersion(current);
|
|
81
|
+
if (!next || !base) return false;
|
|
82
|
+
for (const [index, part] of next.entries()) {
|
|
83
|
+
const other = base[index] ?? 0;
|
|
84
|
+
if (part !== other) return part > other;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function currentClaudeCodeVersionFloor() {
|
|
89
|
+
return learnedClaudeCodeVersion ?? "2.1.280";
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Read the Claude Code version Anthropic requires from a
|
|
93
|
+
* claude_code_version_too_old rejection (SDK APIError or transport error body).
|
|
94
|
+
*/
|
|
95
|
+
function readRequiredClaudeCodeVersion(error) {
|
|
96
|
+
if (!isRecord(error) || error.status !== 400) return;
|
|
97
|
+
const body = error.errorBody ?? error.error;
|
|
98
|
+
const payload = isRecord(body) && isRecord(body.error) ? body.error : body;
|
|
99
|
+
if (!isRecord(payload) || typeof payload.message !== "string") return;
|
|
100
|
+
const details = payload.details;
|
|
101
|
+
if (!isRecord(details) || details.error_code !== "claude_code_version_too_old") return;
|
|
102
|
+
const required = payload.message.match(/version (\d+\.\d+\.\d+) or newer is required/)?.[1];
|
|
103
|
+
return parseClaudeCodeVersion(required) ? required : void 0;
|
|
104
|
+
}
|
|
105
|
+
/** Adopt a version Anthropic required; true when it raised the floor and a retry can help. */
|
|
106
|
+
function raiseClaudeCodeVersionFloor(required) {
|
|
107
|
+
if (!isNewerClaudeCodeVersion(required, currentClaudeCodeVersionFloor())) return false;
|
|
108
|
+
learnedClaudeCodeVersion = required;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
/** Test seam: forget the learned requirement. */
|
|
112
|
+
function resetLearnedClaudeCodeVersionForTest() {
|
|
113
|
+
learnedClaudeCodeVersion = void 0;
|
|
114
|
+
}
|
|
73
115
|
/** Build OAuth headers and the matching billing identity from one request snapshot. */
|
|
74
116
|
function buildAnthropicClaudeCodeIdentity(betaHeader, ...headerSources) {
|
|
75
117
|
const headers = new Headers({
|
|
@@ -79,16 +121,9 @@ function buildAnthropicClaudeCodeIdentity(betaHeader, ...headerSources) {
|
|
|
79
121
|
"x-app": "cli"
|
|
80
122
|
});
|
|
81
123
|
for (const source of headerSources) for (const [name, value] of Object.entries(source ?? {})) headers.set(name, value);
|
|
82
|
-
|
|
124
|
+
const floor = currentClaudeCodeVersionFloor();
|
|
83
125
|
const candidate = headers.get("user-agent")?.match(/^claude-cli\/(\d+\.\d+\.\d+)$/)?.[1];
|
|
84
|
-
|
|
85
|
-
const components = candidate.split(".").map(Number);
|
|
86
|
-
const minimum = version.split(".").map(Number);
|
|
87
|
-
const differing = components.findIndex((component, index) => component !== minimum[index]);
|
|
88
|
-
const component = components[differing];
|
|
89
|
-
const minimumComponent = minimum[differing];
|
|
90
|
-
if (components.every(Number.isSafeInteger) && component !== void 0 && minimumComponent !== void 0 && component > minimumComponent) version = candidate;
|
|
91
|
-
}
|
|
126
|
+
const version = candidate && isNewerClaudeCodeVersion(candidate, floor) ? candidate : floor;
|
|
92
127
|
headers.set("user-agent", `claude-cli/${version}`);
|
|
93
128
|
return {
|
|
94
129
|
headers: headersToRecord(headers),
|
|
@@ -112,8 +147,7 @@ function usesClaudeFable5MessagesContract(model) {
|
|
|
112
147
|
}
|
|
113
148
|
/** Return whether streamed output must wait for the terminal refusal decision. */
|
|
114
149
|
function usesClaudeStreamingRefusalContract(model) {
|
|
115
|
-
|
|
116
|
-
return resolveClaudeHaiku55ModelIdentity(model) !== void 0 || resolveClaudeFable5ModelIdentity(model) !== void 0 || resolveClaudeMythos5ModelIdentity(model) !== void 0 || resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0;
|
|
150
|
+
return normalizeApi(model.api) === "anthropic-messages" && usesClaude5RequestContract(model);
|
|
117
151
|
}
|
|
118
152
|
function requiresClaudeAdaptiveThinking(model) {
|
|
119
153
|
if (normalizeApi(model.api) !== "anthropic-messages") return false;
|
|
@@ -121,7 +155,7 @@ function requiresClaudeAdaptiveThinking(model) {
|
|
|
121
155
|
}
|
|
122
156
|
/** Return whether omitted thinking should default to adaptive mode. */
|
|
123
157
|
function defaultsClaudeAdaptiveThinking(model) {
|
|
124
|
-
return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && (
|
|
158
|
+
return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && usesClaude5RequestContract(model);
|
|
125
159
|
}
|
|
126
160
|
/** Resolve provider-native effort once for direct and managed Claude requests. */
|
|
127
161
|
function resolveAnthropicThinkingEffort(model, level) {
|
|
@@ -162,7 +196,7 @@ function mapAnthropicStopReason(reason) {
|
|
|
162
196
|
}
|
|
163
197
|
/** Remove unsupported assistant prefills while preserving completed tool-use turns. */
|
|
164
198
|
function prepareClaudeNoPrefillRequestContext(model, context) {
|
|
165
|
-
if (!
|
|
199
|
+
if (!rejectsClaudeAssistantPrefill(model)) return context;
|
|
166
200
|
let end = context.messages.length;
|
|
167
201
|
while (end > 0) {
|
|
168
202
|
const message = context.messages[end - 1];
|
|
@@ -176,59 +210,33 @@ function prepareClaudeNoPrefillRequestContext(model, context) {
|
|
|
176
210
|
}
|
|
177
211
|
function applyClaudeRequestContract(params, model) {
|
|
178
212
|
if (normalizeApi(model.api) !== "anthropic-messages") return;
|
|
179
|
-
|
|
180
|
-
const sonnet5 = resolveClaudeSonnet5ModelIdentity(model) !== void 0;
|
|
181
|
-
const haiku55 = resolveClaudeHaiku55ModelIdentity(model) !== void 0;
|
|
182
|
-
if (!requiresClaudeDefaultSampling(model) && !opus5 && !sonnet5) return;
|
|
213
|
+
if (!requiresClaudeDefaultSampling(model)) return;
|
|
183
214
|
delete params.temperature;
|
|
184
215
|
delete params.top_p;
|
|
185
216
|
delete params.top_k;
|
|
186
|
-
if (
|
|
217
|
+
if (resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0 || resolveClaudeHaiku55ModelIdentity(model) !== void 0) delete params.service_tier;
|
|
187
218
|
}
|
|
188
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Claude identity of a transcript or target model on the Messages API. The
|
|
221
|
+
* response model wins when it differs, so server-side fallbacks keep their own identity.
|
|
222
|
+
*/
|
|
223
|
+
function resolveReplayClaudeIdentity(ref) {
|
|
189
224
|
if (normalizeApi(ref.api) !== "anthropic-messages") return;
|
|
190
225
|
const modelRef = hasConcreteResponseModel(ref) ? { id: ref.responseModelId } : {
|
|
191
226
|
id: ref.modelId,
|
|
192
227
|
params: ref.modelParams
|
|
193
228
|
};
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
if (haikuIdentity) return `haiku:${haikuIdentity}`;
|
|
197
|
-
if (fableIdentity) return `fable:${fableIdentity}`;
|
|
198
|
-
const mythosIdentity = resolveClaudeMythos5ModelIdentity(modelRef);
|
|
199
|
-
if (mythosIdentity) return `mythos:${mythosIdentity}`;
|
|
200
|
-
const opusIdentity = resolveClaudeOpus5ModelIdentity(modelRef);
|
|
201
|
-
if (opusIdentity) return `opus:${opusIdentity}`;
|
|
202
|
-
const sonnetIdentity = resolveClaudeSonnet5ModelIdentity(modelRef);
|
|
203
|
-
return sonnetIdentity ? `sonnet:${sonnetIdentity}` : void 0;
|
|
204
|
-
}
|
|
205
|
-
const FABLE_51_REPLAY_IDENTITY = /^fable:claude-fable-5-1(?=$|[^a-z0-9])/;
|
|
206
|
-
const SONNET_55_REPLAY_IDENTITY = /^sonnet:claude-sonnet-5-5(?=$|[^a-z0-9])/;
|
|
207
|
-
/**
|
|
208
|
-
* Verified live (2026-09-28): Fable 5.1 reads every earlier Claude generation
|
|
209
|
-
* except Sonnet 5.5; Sonnet 5.5 reads Sonnet 5 and pre-Claude-5 thinking but
|
|
210
|
-
* not Opus 5, Fable, or Mythos; no other model reads Sonnet 5.5 thinking. The
|
|
211
|
-
* API drops what a target cannot read, and every other cross-identity move
|
|
212
|
-
* stays dropped here until its replay contract is proven separately.
|
|
213
|
-
*/
|
|
214
|
-
function readsPriorClaudeThinking(targetIdentity, sourceIdentity) {
|
|
215
|
-
if (targetIdentity === void 0) return false;
|
|
216
|
-
if (FABLE_51_REPLAY_IDENTITY.test(targetIdentity)) return sourceIdentity === void 0 || !SONNET_55_REPLAY_IDENTITY.test(sourceIdentity) && !sourceIdentity.startsWith("haiku:");
|
|
217
|
-
if (SONNET_55_REPLAY_IDENTITY.test(targetIdentity)) return sourceIdentity === void 0 || sourceIdentity.startsWith("sonnet:");
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
function isClaudeReplaySource(ref) {
|
|
221
|
-
const modelId = hasConcreteResponseModel(ref) ? ref.responseModelId : ref.modelId;
|
|
222
|
-
return /(?:^|[-/])claude-/.test(normalizeModelId(modelId));
|
|
229
|
+
const identity = resolveClaudeModelIdentity(modelRef);
|
|
230
|
+
return identity.startsWith("claude-") ? identity : void 0;
|
|
223
231
|
}
|
|
224
232
|
function resolveModelBoundThinkingReplayMode(params) {
|
|
225
233
|
const sourceApi = normalizeApi(params.source.api);
|
|
226
234
|
const targetApi = normalizeApi(params.target.api);
|
|
227
|
-
const sourceIdentity =
|
|
228
|
-
const targetIdentity =
|
|
235
|
+
const sourceIdentity = resolveReplayClaudeIdentity(params.source);
|
|
236
|
+
const targetIdentity = resolveReplayClaudeIdentity(params.target);
|
|
229
237
|
const sameRoute = normalizeLowercaseStringOrEmpty(params.source.provider) === normalizeLowercaseStringOrEmpty(params.target.provider) && sourceApi === targetApi && normalizeModelId(params.source.modelId) === normalizeModelId(params.target.modelId);
|
|
230
238
|
if (!sourceIdentity && !targetIdentity) return "default";
|
|
231
|
-
if (sourceApi === targetApi
|
|
239
|
+
if (sourceIdentity && targetIdentity && sourceApi === targetApi) return sourceIdentity === targetIdentity || !bindsClaudeThinkingPrefix({ id: sourceIdentity }) ? "preserve" : "drop";
|
|
232
240
|
if (!sourceIdentity && !hasConcreteResponseModel(params.source) && targetIdentity && sameRoute) return "preserve";
|
|
233
241
|
return sourceApi === targetApi && sourceIdentity === targetIdentity ? "preserve" : "drop";
|
|
234
242
|
}
|
|
@@ -444,15 +452,14 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
444
452
|
//#endregion
|
|
445
453
|
//#region packages/ai/src/host.ts
|
|
446
454
|
const MAX_PENDING_CUSTOM_API_REGISTRATIONS = 32;
|
|
447
|
-
const pendingCustomApiRegistrations = [];
|
|
448
455
|
function queueCustomApiRegistration(registry, api, streamFn) {
|
|
449
|
-
const existing =
|
|
456
|
+
const existing = hostState.pendingRegistrations.find((registration) => registration.registry === registry && registration.api === api);
|
|
450
457
|
if (existing) {
|
|
451
458
|
existing.streamFn = streamFn;
|
|
452
459
|
return false;
|
|
453
460
|
}
|
|
454
|
-
if (
|
|
455
|
-
|
|
461
|
+
if (hostState.pendingRegistrations.length >= MAX_PENDING_CUSTOM_API_REGISTRATIONS) throw new Error("Too many custom transport APIs were registered before host configuration");
|
|
462
|
+
hostState.pendingRegistrations.push({
|
|
456
463
|
registry,
|
|
457
464
|
api,
|
|
458
465
|
streamFn
|
|
@@ -496,71 +503,83 @@ const inertAiTransportHost = {
|
|
|
496
503
|
logInfo: () => {},
|
|
497
504
|
logWarn: () => {}
|
|
498
505
|
};
|
|
499
|
-
let activeAiTransportHost = inertAiTransportHost;
|
|
500
506
|
function createAiTransportHostScope() {
|
|
501
507
|
if (typeof process === "undefined") return;
|
|
502
508
|
const asyncHooks = process.getBuiltinModule?.("node:async_hooks");
|
|
503
509
|
return asyncHooks ? new asyncHooks.AsyncLocalStorage() : void 0;
|
|
504
510
|
}
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
511
|
+
const HOST_STATE_KEY = Symbol.for("openclaw.ai.transportHost");
|
|
512
|
+
function resolveAiTransportHostState() {
|
|
513
|
+
const globalStore = globalThis;
|
|
514
|
+
if (Object.hasOwn(globalStore, HOST_STATE_KEY)) return globalStore[HOST_STATE_KEY];
|
|
515
|
+
const state = {
|
|
516
|
+
inert: inertAiTransportHost,
|
|
517
|
+
active: inertAiTransportHost,
|
|
518
|
+
scope: createAiTransportHostScope(),
|
|
519
|
+
pendingHost: void 0,
|
|
520
|
+
pendingOperations: 0,
|
|
521
|
+
pendingRegistrations: []
|
|
522
|
+
};
|
|
523
|
+
globalStore[HOST_STATE_KEY] = state;
|
|
524
|
+
return state;
|
|
525
|
+
}
|
|
526
|
+
const hostState = resolveAiTransportHostState();
|
|
508
527
|
function isPromiseLike(value) {
|
|
509
528
|
return value !== null && (typeof value === "object" || typeof value === "function") && typeof Reflect.get(value, "then") === "function";
|
|
510
529
|
}
|
|
511
530
|
function trackUnscopedOperation(host, result) {
|
|
512
531
|
if (!isPromiseLike(result)) return;
|
|
513
|
-
|
|
514
|
-
|
|
532
|
+
hostState.pendingHost = host;
|
|
533
|
+
hostState.pendingOperations += 1;
|
|
515
534
|
const release = () => {
|
|
516
|
-
|
|
517
|
-
if (
|
|
535
|
+
hostState.pendingOperations -= 1;
|
|
536
|
+
if (hostState.pendingOperations === 0) hostState.pendingHost = void 0;
|
|
518
537
|
};
|
|
519
538
|
Promise.resolve(result).then(release, release);
|
|
520
539
|
}
|
|
521
540
|
/** Reports whether distinct host policy can survive asynchronous work. */
|
|
522
541
|
function supportsScopedAiTransportHosts() {
|
|
523
|
-
return
|
|
542
|
+
return hostState.scope !== void 0;
|
|
524
543
|
}
|
|
525
544
|
/** Resolves an explicit embedding policy without replacing the process default. */
|
|
526
545
|
function createAiTransportHost(host = {}) {
|
|
527
546
|
return {
|
|
528
|
-
...
|
|
547
|
+
...hostState.inert,
|
|
529
548
|
...host,
|
|
530
|
-
normalizeAnthropicInlineContentBlocks: host.normalizeAnthropicInlineContentBlocks ??
|
|
549
|
+
normalizeAnthropicInlineContentBlocks: host.normalizeAnthropicInlineContentBlocks ?? hostState.inert.normalizeAnthropicInlineContentBlocks,
|
|
531
550
|
plugin: {
|
|
532
|
-
...
|
|
551
|
+
...hostState.inert.plugin,
|
|
533
552
|
...host.plugin
|
|
534
553
|
}
|
|
535
554
|
};
|
|
536
555
|
}
|
|
537
556
|
/** Provider operations retain their policy across lazy loads and asynchronous I/O. */
|
|
538
557
|
function runWithAiTransportHost(host, run) {
|
|
539
|
-
if (!
|
|
540
|
-
if (host !==
|
|
541
|
-
if (
|
|
558
|
+
if (!hostState.scope) {
|
|
559
|
+
if (host !== hostState.active) throw new Error("Scoped AI transport hosts require Node.js async context support");
|
|
560
|
+
if (hostState.pendingHost && hostState.pendingHost !== host) throw new Error("AI transport host changed while browser provider work was still pending");
|
|
542
561
|
const result = run();
|
|
543
562
|
trackUnscopedOperation(host, result);
|
|
544
563
|
return result;
|
|
545
564
|
}
|
|
546
|
-
return
|
|
565
|
+
return hostState.scope.run(host, run);
|
|
547
566
|
}
|
|
548
567
|
/** Installers must read the process default, never an unrelated operation's scoped policy. */
|
|
549
568
|
function getDefaultAiTransportHost() {
|
|
550
|
-
return
|
|
569
|
+
return hostState.active;
|
|
551
570
|
}
|
|
552
571
|
/** Installs host implementations for the transport policy ports. */
|
|
553
572
|
function configureAiTransportHost(host) {
|
|
554
|
-
if (!
|
|
555
|
-
|
|
556
|
-
const transportHost =
|
|
557
|
-
if (transportHost.registerCustomApi ===
|
|
558
|
-
const pending =
|
|
573
|
+
if (!hostState.scope && hostState.pendingOperations > 0) throw new Error("Cannot replace the AI transport host while browser provider work is pending");
|
|
574
|
+
hostState.active = createAiTransportHost(host);
|
|
575
|
+
const transportHost = hostState.active;
|
|
576
|
+
if (transportHost.registerCustomApi === hostState.inert.registerCustomApi || hostState.pendingRegistrations.length === 0) return;
|
|
577
|
+
const pending = hostState.pendingRegistrations.splice(0);
|
|
559
578
|
for (const registration of pending) transportHost.registerCustomApi(registration.registry, registration.api, registration.streamFn);
|
|
560
579
|
}
|
|
561
580
|
/** Returns the active transport host (inert defaults unless configured). */
|
|
562
581
|
function getAiTransportHost() {
|
|
563
|
-
return
|
|
582
|
+
return hostState.scope?.getStore() ?? hostState.active;
|
|
564
583
|
}
|
|
565
584
|
/** Resolves sentinel substrings in custom headers at a no-fetch adapter boundary. */
|
|
566
585
|
function resolveAiTransportHeaderSentinels(headers) {
|
|
@@ -578,4 +597,4 @@ function resolveAiTransportHeaderSentinels(headers) {
|
|
|
578
597
|
return resolvedHeaders ?? headers;
|
|
579
598
|
}
|
|
580
599
|
//#endregion
|
|
581
|
-
export {
|
|
600
|
+
export { applyProviderReportedUsageCost as A, requiresClaudeAdaptiveThinking as C, usesClaudeFable5MessagesContract as D, resolveModelBoundThinkingReplayMode as E, hasMediaPayload as F, isImageWithMediaPayload as I, clampThinkingLevel as M, getSupportedThinkingLevels as N, usesClaudeStreamingRefusalContract as O, modelsAreEqual as P, readRequiredClaudeCodeVersion as S, resolveAnthropicThinkingEffort as T, buildAnthropicClaudeCodeIdentity as _, resolveAiTransportHeaderSentinels as a, prepareClaudeNoPrefillRequestContext as b, transformMessages as c, hasOnlyAssistantReasoningContent as d, isReasoningOnlyLengthAssistantTurn as f, applyClaudeRequestContract as g, ANTHROPIC_CLAUDE_CODE_VERSION as h, getDefaultAiTransportHost as i, calculateCost as j, headersToRecord as k, FAILED_ASSISTANT_REPLAY_TEXT as l, resolveFailedAssistantReplay as m, createAiTransportHost as n, runWithAiTransportHost as o, isStreamErrorFallbackContent as p, getAiTransportHost as r, supportsScopedAiTransportHosts as s, configureAiTransportHost as t, STREAM_ERROR_FALLBACK_TEXT as u, defaultsClaudeAdaptiveThinking as v, resetLearnedClaudeCodeVersionForTest as w, raiseClaudeCodeVersionFloor as x, mapAnthropicStopReason as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-CyGba3M8.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/host-policy.ts
|
|
3
3
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
4
4
|
const host = getAiTransportHost();
|
|
@@ -120,10 +120,15 @@ declare function resolveClaudeFable5ModelIdentity(ref: ClaudeModelRef): string |
|
|
|
120
120
|
/** Resolve Claude Mythos 5 through direct ids, cloud ids, or deployment metadata. */
|
|
121
121
|
declare function resolveClaudeMythos5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* Whether thinking blocks are valid only after the exact request prefix that
|
|
124
|
+
* produced them, so runtime context must be appended instead of re-rendered.
|
|
125
|
+
* Every Claude model is prefix-bound except the closed list of older generations.
|
|
125
126
|
*/
|
|
126
127
|
declare function bindsClaudeThinkingPrefix(ref: ClaudeModelRef): boolean;
|
|
128
|
+
/** Whether a Claude model follows the Claude 5 request contract (streamed refusals, adaptive by default). */
|
|
129
|
+
declare function usesClaude5RequestContract(ref: ClaudeModelRef): boolean;
|
|
130
|
+
/** Whether a Claude model rejects a trailing assistant prefill. */
|
|
131
|
+
declare function rejectsClaudeAssistantPrefill(ref: ClaudeModelRef): boolean;
|
|
127
132
|
/** Return whether Claude accepts operator instructions within conversation history. */
|
|
128
133
|
declare function supportsClaudeInHistorySystemMessages(ref: ClaudeModelRef): boolean;
|
|
129
134
|
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
@@ -138,6 +143,12 @@ declare function requiresClaudeBetweenToolsThinking(ref: ClaudeModelRef): boolea
|
|
|
138
143
|
declare function resolveClaudeOpus5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
139
144
|
/** Resolve the Opus 5.5 contract without matching other Opus 5 generations. */
|
|
140
145
|
declare function resolveClaudeOpus55ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the id names a released Claude generation with adaptive thinking.
|
|
148
|
+
* Unlike {@link supportsClaudeAdaptiveThinking}, unknown Claude ids answer false,
|
|
149
|
+
* so providers can tell a released model from one they must map onto a template.
|
|
150
|
+
*/
|
|
151
|
+
declare function isReleasedAdaptiveClaudeGeneration(ref: ClaudeModelRef): boolean;
|
|
141
152
|
/** Return whether a Claude model supports adaptive thinking. */
|
|
142
153
|
declare function supportsClaudeAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
143
154
|
/** Return whether a Claude model has a native 1M-token context window. */
|
|
@@ -179,7 +190,7 @@ declare function calculateUsageCost(usage: Partial<Pick<Usage, "input" | "output
|
|
|
179
190
|
//#region packages/llm-core/src/utils/assistant-message-events.d.ts
|
|
180
191
|
declare function appendTextDeltaToAssistantMessage(message: AssistantMessage, contentIndex: number, delta: string): AssistantMessage;
|
|
181
192
|
declare namespace index_d_exports {
|
|
182
|
-
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, validateToolArguments, validateToolCall };
|
|
193
|
+
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isReleasedAdaptiveClaudeGeneration, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, rejectsClaudeAssistantPrefill, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, usesClaude5RequestContract, validateToolArguments, validateToolCall };
|
|
183
194
|
}
|
|
184
195
|
//#endregion
|
|
185
|
-
export {
|
|
196
|
+
export { supportsClaudeAdaptiveThinking as A, resolveClaudeMythos5ModelIdentity as C, resolveClaudeSonnet55ModelIdentity as D, resolveClaudeOpus5ModelIdentity as E, supportsClaudeServerCompaction as F, usesClaude5RequestContract as I, supportsClaudeInHistorySystemMessages as M, supportsClaudeNativeMaxEffort as N, resolveClaudeSonnet5ModelIdentity as O, supportsClaudeNativeXhighEffort as P, resolveClaudeModelIdentity as S, resolveClaudeOpus55ModelIdentity as T, requiresClaudeBetweenToolsThinking as _, normalizeResolvedPricing as a, resolveClaudeFable5ModelIdentity as b, CLAUDE_FABLE_5_THINKING_PROFILE as c, CLAUDE_OPUS_5_THINKING_PROFILE as d, CLAUDE_SONNET_55_THINKING_PROFILE as f, rejectsClaudeAssistantPrefill as g, isReleasedAdaptiveClaudeGeneration as h, normalizeModelCostConfig as i, supportsClaudeFastMode as j, supportsClaude1MContext as k, CLAUDE_HAIKU_55_THINKING_PROFILE as l, bindsClaudeThinkingPrefix as m, appendTextDeltaToAssistantMessage as n, ProviderRefusalReview as o, CLAUDE_SONNET_5_THINKING_PROFILE as p, calculateUsageCost as r, readProviderRefusalReview as s, index_d_exports as t, CLAUDE_OPUS_55_THINKING_PROFILE as u, requiresClaudeDefaultSampling as v, resolveClaudeNativeThinkingLevelMap as w, resolveClaudeHaiku55ModelIdentity as x, requiresClaudeMandatoryAdaptiveThinking as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as supportsClaudeAdaptiveThinking, C as resolveClaudeMythos5ModelIdentity, D as resolveClaudeSonnet55ModelIdentity, E as resolveClaudeOpus5ModelIdentity, F as supportsClaudeServerCompaction, I as usesClaude5RequestContract, M as supportsClaudeInHistorySystemMessages, N as supportsClaudeNativeMaxEffort, O as resolveClaudeSonnet5ModelIdentity, P as supportsClaudeNativeXhighEffort, S as resolveClaudeModelIdentity, T as resolveClaudeOpus55ModelIdentity, _ as requiresClaudeBetweenToolsThinking, a as normalizeResolvedPricing, b as resolveClaudeFable5ModelIdentity, c as CLAUDE_FABLE_5_THINKING_PROFILE, d as CLAUDE_OPUS_5_THINKING_PROFILE, f as CLAUDE_SONNET_55_THINKING_PROFILE, g as rejectsClaudeAssistantPrefill, h as isReleasedAdaptiveClaudeGeneration, i as normalizeModelCostConfig, j as supportsClaudeFastMode, k as supportsClaude1MContext, l as CLAUDE_HAIKU_55_THINKING_PROFILE, m as bindsClaudeThinkingPrefix, n as appendTextDeltaToAssistantMessage, o as ProviderRefusalReview, p as CLAUDE_SONNET_5_THINKING_PROFILE, r as calculateUsageCost, s as readProviderRefusalReview, u as CLAUDE_OPUS_55_THINKING_PROFILE, v as requiresClaudeDefaultSampling, w as resolveClaudeNativeThinkingLevelMap, x as resolveClaudeHaiku55ModelIdentity, y as requiresClaudeMandatoryAdaptiveThinking } from "./index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, O as Message, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, U as ProviderStreamOptions, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, d as Context, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, k as Model, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, tt as StreamFunction, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-CVYzKrMl.mjs";
|
|
3
3
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CzpE1g_o.mjs";
|
|
4
4
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-BQ5u20Ru.mjs";
|
|
5
|
-
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-
|
|
6
|
-
import { _ as supportsScopedAiTransportHosts, a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as createAiTransportHost, g as runWithAiTransportHost, h as resolveAiTransportHeaderSentinels, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, m as getDefaultAiTransportHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as getAiTransportHost, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-
|
|
5
|
+
import { a as RegisteredApiProvider, i as ApiStreamSimpleFunction, n as ApiRegistry, o as createApiRegistry, r as ApiStreamFunction, t as ApiProvider } from "./api-registry-CkmxPPac.mjs";
|
|
6
|
+
import { _ as supportsScopedAiTransportHosts, a as AiProviderRequestPolicyInput, c as AiTransportHost, d as configureAiTransportHost, f as createAiTransportHost, g as runWithAiTransportHost, h as resolveAiTransportHeaderSentinels, i as AiProviderRequestCapabilities, l as AiTransportPluginHost, m as getDefaultAiTransportHost, n as AiInlineImageBlock, o as AiProviderStreamHookContext, p as getAiTransportHost, r as AiInlineTextBlock, s as AiTransformTransportMessages, t as AiInlineContentBlock, u as OpenAIStrictToolSettingOptions } from "./host-B03VqZdH.mjs";
|
|
7
7
|
//#region packages/ai/src/stream.d.ts
|
|
8
8
|
/** Creates an isolated LLM runtime backed by the supplied provider registry. */
|
|
9
9
|
export declare function createLlmRuntime(registry?: ApiRegistry): {
|
|
@@ -37,4 +37,4 @@ export declare function createNodeLlmRuntime(registry?: ApiRegistry, transportHo
|
|
|
37
37
|
};
|
|
38
38
|
export type LlmRuntime = ReturnType<typeof createLlmRuntime>;
|
|
39
39
|
//#endregion
|
|
40
|
-
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, type ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RegisteredApiProvider, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
|
|
40
|
+
export { AiInlineContentBlock, AiInlineImageBlock, AiInlineTextBlock, AiProviderRequestCapabilities, AiProviderRequestPolicyInput, AiProviderStreamHookContext, AiTransformTransportMessages, AiTransportHost, AiTransportPluginHost, AnthropicMessagesCompat, Api, ApiProvider, ApiRegistry, ApiStreamFunction, ApiStreamSimpleFunction, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DEFAULT_MISSING_TOOL_RESULT_TEXT, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenAIStrictToolSettingOptions, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, type ProviderRefusalReview, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, RawModelCostConfig, RawPricingTier, RegisteredApiProvider, RuntimeContextMessage, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isReleasedAdaptiveClaudeGeneration, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, rejectsClaudeAssistantPrefill, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, supportsScopedAiTransportHosts, usesClaude5RequestContract, validateToolArguments, validateToolCall };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { A as supportsClaudeNativeXhighEffort, C as resolveClaudeSonnet55ModelIdentity, D as supportsClaudeFastMode, E as supportsClaudeAdaptiveThinking, M as usesClaude5RequestContract, O as supportsClaudeInHistorySystemMessages, S as resolveClaudeOpus5ModelIdentity, T as supportsClaude1MContext, _ as resolveClaudeHaiku55ModelIdentity, a as CLAUDE_HAIKU_55_THINKING_PROFILE, b as resolveClaudeNativeThinkingLevelMap, c as CLAUDE_SONNET_55_THINKING_PROFILE, d as isReleasedAdaptiveClaudeGeneration, f as rejectsClaudeAssistantPrefill, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as CLAUDE_FABLE_5_THINKING_PROFILE, j as supportsClaudeServerCompaction, k as supportsClaudeNativeMaxEffort, l as CLAUDE_SONNET_5_THINKING_PROFILE, m as requiresClaudeDefaultSampling, n as normalizeModelCostConfig, o as CLAUDE_OPUS_55_THINKING_PROFILE, p as requiresClaudeBetweenToolsThinking, r as normalizeResolvedPricing, s as CLAUDE_OPUS_5_THINKING_PROFILE, t as calculateUsageCost, u as bindsClaudeThinkingPrefix, v as resolveClaudeModelIdentity, w as resolveClaudeSonnet5ModelIdentity, x as resolveClaudeOpus55ModelIdentity, y as resolveClaudeMythos5ModelIdentity } from "./src--qsViR3j.mjs";
|
|
2
2
|
import { _ as runtimeContextContentToText, a as RUNTIME_CONTEXT_BEGIN_MARKER, c as RUNTIME_CONTEXT_FOOTER, d as hasLegacyRuntimeContextEnvelope, f as hasRuntimeContextMarker, g as readRuntimeContextMetadata, h as labelRuntimeContextText, i as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, l as RUNTIME_CONTEXT_HEADER, m as labelRuntimeContextContent, n as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, o as RUNTIME_CONTEXT_CUSTOM_TYPE, p as isRuntimeContextMessage, r as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, s as RUNTIME_CONTEXT_END_MARKER, t as DEFAULT_MISSING_TOOL_RESULT_TEXT, u as escapeRuntimeContextFooter, v as setRuntimeContextRetention } from "./types-BXd0kI8-.mjs";
|
|
3
3
|
import { t as appendTextDeltaToAssistantMessage } from "./assistant-message-events-CHMJgbhs.mjs";
|
|
4
4
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
5
5
|
import { a as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
6
6
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-9FSkE8T-.mjs";
|
|
7
|
-
import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-
|
|
8
|
-
import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-
|
|
9
|
-
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, DEFAULT_MISSING_TOOL_RESULT_TEXT, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, createNodeLlmRuntime, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
|
|
7
|
+
import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-BRecd0FZ.mjs";
|
|
8
|
+
import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-CyGba3M8.mjs";
|
|
9
|
+
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, DEFAULT_MISSING_TOOL_RESULT_TEXT, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, createNodeLlmRuntime, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isReleasedAdaptiveClaudeGeneration, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, rejectsClaudeAssistantPrefill, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, supportsScopedAiTransportHosts, usesClaude5RequestContract, validateToolArguments, validateToolCall };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as supportsClaudeAdaptiveThinking, C as resolveClaudeMythos5ModelIdentity, D as resolveClaudeSonnet55ModelIdentity, E as resolveClaudeOpus5ModelIdentity, N as supportsClaudeNativeMaxEffort, O as resolveClaudeSonnet5ModelIdentity, P as supportsClaudeNativeXhighEffort, S as resolveClaudeModelIdentity, T as resolveClaudeOpus55ModelIdentity, _ as requiresClaudeBetweenToolsThinking, b as resolveClaudeFable5ModelIdentity, m as bindsClaudeThinkingPrefix, v as requiresClaudeDefaultSampling, w as resolveClaudeNativeThinkingLevelMap, x as resolveClaudeHaiku55ModelIdentity, y as requiresClaudeMandatoryAdaptiveThinking } from "../index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, Et as AssistantMessageDiagnostic, Q as SimpleStreamOptions, d as Context, k as Model, pt as Usage, tt as StreamFunction } from "../types-CVYzKrMl.mjs";
|
|
3
|
-
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
5
|
-
import { a as prepareAnthropicInputSchema, c as resolveOriginalAnthropicToolName, i as normalizeAnthropicToolChoice, l as toClaudeCodeToolName, n as AnthropicToolProjection, o as projectAnthropicTools, r as normalizeAnthropicToolCallId, s as reconcileAnthropicToolChoice, t as AnthropicProjectedToolChoice } from "../anthropic-tool-projection-
|
|
6
|
-
import { a as buildAnthropicSystemBlocks, p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-
|
|
3
|
+
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-DFjnfImJ.mjs";
|
|
4
|
+
import "../types-BFfXm_Jr.mjs";
|
|
5
|
+
import { a as prepareAnthropicInputSchema, c as resolveOriginalAnthropicToolName, i as normalizeAnthropicToolChoice, l as toClaudeCodeToolName, n as AnthropicToolProjection, o as projectAnthropicTools, r as normalizeAnthropicToolCallId, s as reconcileAnthropicToolChoice, t as AnthropicProjectedToolChoice } from "../anthropic-tool-projection-CzSSQzZL.mjs";
|
|
6
|
+
import { a as buildAnthropicSystemBlocks, p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-BCp4dUJR.mjs";
|
|
7
7
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
8
8
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
9
9
|
authProfileId?: string;
|
|
@@ -13,6 +13,7 @@ type AnthropicSimpleStreamOptions = SimpleStreamOptions & AnthropicContextManage
|
|
|
13
13
|
authProfileId?: string;
|
|
14
14
|
toolChoice?: AnthropicCompactionOptions["toolChoice"];
|
|
15
15
|
thinkingDisplay?: AnthropicOptions["thinkingDisplay"];
|
|
16
|
+
onClaudeCodeVersionRequired?: AnthropicOptions["onClaudeCodeVersionRequired"];
|
|
16
17
|
};
|
|
17
18
|
export declare const streamSimpleAnthropic: StreamFunction<"anthropic-messages", AnthropicSimpleStreamOptions>;
|
|
18
19
|
//#endregion
|
|
@@ -29,6 +30,15 @@ export declare function omitFoundryBearerCredentialHeaders(headers?: Record<stri
|
|
|
29
30
|
//#endregion
|
|
30
31
|
//#region packages/ai/src/providers/anthropic-model-contract.d.ts
|
|
31
32
|
export declare const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.280";
|
|
33
|
+
/**
|
|
34
|
+
* Read the Claude Code version Anthropic requires from a
|
|
35
|
+
* claude_code_version_too_old rejection (SDK APIError or transport error body).
|
|
36
|
+
*/
|
|
37
|
+
export declare function readRequiredClaudeCodeVersion(error: unknown): string | undefined;
|
|
38
|
+
/** Adopt a version Anthropic required; true when it raised the floor and a retry can help. */
|
|
39
|
+
export declare function raiseClaudeCodeVersionFloor(required: string): boolean;
|
|
40
|
+
/** Test seam: forget the learned requirement. */
|
|
41
|
+
export declare function resetLearnedClaudeCodeVersionForTest(): void;
|
|
32
42
|
/** Build OAuth headers and the matching billing identity from one request snapshot. */
|
|
33
43
|
export declare function buildAnthropicClaudeCodeIdentity(betaHeader: string | undefined, ...headerSources: (Record<string, string> | undefined)[]): {
|
|
34
44
|
headers: Record<string, string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as resolveModelBoundThinkingReplayMode, S as
|
|
3
|
-
import { B as readAnthropicFallbackBoundary, E as buildAnthropicSystemBlocks, H as isAnthropicOAuthApiKey, I as ANTHROPIC_SERVER_SIDE_FALLBACKS, L as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, R as CLAUDE_OPUS_FALLBACK_MODEL_COST, U as omitFoundryBearerCredentialHeaders, V as resolveAnthropicFallbackServingModelCost, W as usesFoundryBearerAuth, _ as logAnthropicThinkingDrops, a as readAnthropicPromptUsageSnapshot, c as applyAnthropicRefusal, g as findActiveAnthropicToolTurnAssistantIndex, h as applyAnthropicThinkingBindingControls, i as readAnthropicCacheWriteUsage, m as ANTHROPIC_OMITTED_REASONING_TEXT, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as readAnthropicInputTransformations, z as applyAnthropicFallbackBoundary } from "../anthropic-stream-reducer-
|
|
4
|
-
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, r as prepareAnthropicInputSchema, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "../anthropic-tool-projection-
|
|
5
|
-
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-
|
|
6
|
-
export { ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, buildAnthropicClaudeCodeIdentity, buildAnthropicSystemBlocks, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, isDirectAnthropicModel, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareAnthropicInputSchema, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
1
|
+
import { A as supportsClaudeNativeXhighEffort, C as resolveClaudeSonnet55ModelIdentity, E as supportsClaudeAdaptiveThinking, S as resolveClaudeOpus5ModelIdentity, _ as resolveClaudeHaiku55ModelIdentity, b as resolveClaudeNativeThinkingLevelMap, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, k as supportsClaudeNativeMaxEffort, m as requiresClaudeDefaultSampling, p as requiresClaudeBetweenToolsThinking, u as bindsClaudeThinkingPrefix, v as resolveClaudeModelIdentity, w as resolveClaudeSonnet5ModelIdentity, x as resolveClaudeOpus55ModelIdentity, y as resolveClaudeMythos5ModelIdentity } from "../src--qsViR3j.mjs";
|
|
2
|
+
import { C as requiresClaudeAdaptiveThinking, D as usesClaudeFable5MessagesContract, E as resolveModelBoundThinkingReplayMode, O as usesClaudeStreamingRefusalContract, S as readRequiredClaudeCodeVersion, T as resolveAnthropicThinkingEffort, _ as buildAnthropicClaudeCodeIdentity, b as prepareClaudeNoPrefillRequestContext, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, v as defaultsClaudeAdaptiveThinking, w as resetLearnedClaudeCodeVersionForTest, x as raiseClaudeCodeVersionFloor, y as mapAnthropicStopReason } from "../host-CyGba3M8.mjs";
|
|
3
|
+
import { B as readAnthropicFallbackBoundary, E as buildAnthropicSystemBlocks, H as isAnthropicOAuthApiKey, I as ANTHROPIC_SERVER_SIDE_FALLBACKS, L as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, R as CLAUDE_OPUS_FALLBACK_MODEL_COST, U as omitFoundryBearerCredentialHeaders, V as resolveAnthropicFallbackServingModelCost, W as usesFoundryBearerAuth, _ as logAnthropicThinkingDrops, a as readAnthropicPromptUsageSnapshot, c as applyAnthropicRefusal, g as findActiveAnthropicToolTurnAssistantIndex, h as applyAnthropicThinkingBindingControls, i as readAnthropicCacheWriteUsage, m as ANTHROPIC_OMITTED_REASONING_TEXT, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as readAnthropicInputTransformations, z as applyAnthropicFallbackBoundary } from "../anthropic-stream-reducer-BgAICq34.mjs";
|
|
4
|
+
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, r as prepareAnthropicInputSchema, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "../anthropic-tool-projection-CrsCkF4k.mjs";
|
|
5
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-C8cQsW5d.mjs";
|
|
6
|
+
export { ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, buildAnthropicClaudeCodeIdentity, buildAnthropicSystemBlocks, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, isDirectAnthropicModel, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareAnthropicInputSchema, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, raiseClaudeCodeVersionFloor, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, readRequiredClaudeCodeVersion, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resetLearnedClaudeCodeVersionForTest, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
1
|
+
import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-DTe2EXPi.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/openai-completions-reasoning-replay.d.ts
|
|
3
3
|
/** Shared by history sanitization and wire replay, including stale model metadata. */
|
|
4
4
|
export declare function requiresReasoningContentReplay(modelId: unknown): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
1
|
+
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-D9KEUevM.mjs";
|
|
2
2
|
import { t as requiresReasoningContentReplay } from "../openai-completions-reasoning-replay-BwT1xwRI.mjs";
|
|
3
3
|
export { requiresReasoningContentReplay, resolveOpenAICompletionsCompat };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-
|
|
2
|
-
import { a as resolveOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "../openai-responses-payload-policy-
|
|
1
|
+
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-DHtim7d_.mjs";
|
|
2
|
+
import { a as resolveOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "../openai-responses-payload-policy-cIaYG5ZQ.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/openai-responses-endpoint.d.ts
|
|
4
4
|
export declare function supportsNativeOpenAIResponsesEndpoint(params: {
|
|
5
5
|
provider: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-B5mGAbR6.mjs";
|
|
2
|
-
import { d as resolveOpenAIResponsesPayloadPolicy, f as resolveOpenAIResponsesRequestContextTokens, l as normalizeOpenAIServiceTier, n as supportsNativeOpenAIResponsesEndpoint, o as readOpenAIResponsesCompactionWindow, p as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-
|
|
2
|
+
import { d as resolveOpenAIResponsesPayloadPolicy, f as resolveOpenAIResponsesRequestContextTokens, l as normalizeOpenAIServiceTier, n as supportsNativeOpenAIResponsesEndpoint, o as readOpenAIResponsesCompactionWindow, p as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-DJwbSy3n.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, normalizeOpenAIServiceTier, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesRequestContextTokens, resolveOpenAIResponsesServerCompactionPlan, supportsNativeOpenAIResponsesEndpoint };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, Q as SimpleStreamOptions, d as Context, k as Model, tt as StreamFunction } from "../types-CVYzKrMl.mjs";
|
|
3
|
-
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as reconcileOpenAIResponsesToolChoice, a as BaseOpenAIStreamOptions, b as applyOpenAICompletionsToolReasoning, c as OpenAICompletionsOptions, f as reasoningTagTextPolicy, g as reconcileOpenAICompletionsToolChoice, h as projectOpenAITools, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, m as OpenAIToolProjection, o as CodeModeToolSurfaceObservation, p as OpenAICompletionsToolChoice, u as codeModeToolSurfaceObserver, v as OpenAIApiReasoningEffort, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel, y as OpenAIReasoningEffort } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
5
|
-
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
6
|
-
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-
|
|
7
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
8
|
-
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-
|
|
9
|
-
import "../openai-responses-compaction-replay-
|
|
3
|
+
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as reconcileOpenAIResponsesToolChoice, a as BaseOpenAIStreamOptions, b as applyOpenAICompletionsToolReasoning, c as OpenAICompletionsOptions, f as reasoningTagTextPolicy, g as reconcileOpenAICompletionsToolChoice, h as projectOpenAITools, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, m as OpenAIToolProjection, o as CodeModeToolSurfaceObservation, p as OpenAICompletionsToolChoice, u as codeModeToolSurfaceObserver, v as OpenAIApiReasoningEffort, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel, y as OpenAIReasoningEffort } from "../provider-options-DFjnfImJ.mjs";
|
|
4
|
+
import "../types-BFfXm_Jr.mjs";
|
|
5
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-DTe2EXPi.mjs";
|
|
6
|
+
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-DHtim7d_.mjs";
|
|
7
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-k7EPMLa0.mjs";
|
|
8
|
+
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-BDGDBGuA.mjs";
|
|
9
|
+
import "../openai-responses-compaction-replay-DOJaDCUl.mjs";
|
|
10
10
|
import { n as modelRequestBodyState, t as encodedModelRequestBodyStream } from "../model-request-body-BD5vy4rP.mjs";
|
|
11
11
|
import { ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
12
12
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|