@openclaw/ai 2026.7.2-beta.5 → 2026.7.2-beta.7

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.
Files changed (47) hide show
  1. package/dist/{anthropic-CQVj3le6.mjs → anthropic-CH4UUnZr.mjs} +14 -463
  2. package/dist/anthropic-usage-DWU-x8MI.mjs +459 -0
  3. package/dist/{azure-openai-responses-DIYgsqFM.mjs → azure-openai-responses-CImcwB83.mjs} +4 -3
  4. package/dist/azure-openai-responses-client-compat-C7K7QfUE.mjs +62 -0
  5. package/dist/cache-retention-0x979a5V.mjs +12 -0
  6. package/dist/deferred-event-buffer-DAvyP7qA.mjs +19 -0
  7. package/dist/github-copilot-headers-NCJtz9i0.mjs +37 -0
  8. package/dist/{google-f-A8xrae.mjs → google-CtSg0iTS.mjs} +3 -3
  9. package/dist/{google-shared-J6qvYINH.mjs → google-shared-DNBz5rcD.mjs} +5 -3
  10. package/dist/{google-vertex-D3yMVXIY.mjs → google-vertex-31f1uS9L.mjs} +3 -3
  11. package/dist/host-Dog2WQiR.mjs +369 -0
  12. package/dist/index.mjs +1 -1
  13. package/dist/internal/anthropic.d.mts +3 -53
  14. package/dist/internal/anthropic.mjs +3 -2
  15. package/dist/internal/openai.d.mts +259 -2
  16. package/dist/internal/openai.mjs +8 -4
  17. package/dist/internal/runtime.mjs +6 -4
  18. package/dist/internal/shared.d.mts +1 -1
  19. package/dist/internal/shared.mjs +5 -1
  20. package/dist/{llm-request-activity-CehVkZP-.mjs → llm-request-activity-BjtkplhG.mjs} +1 -19
  21. package/dist/{mistral-CKV-TOQj.mjs → mistral-CWmpvWYh.mjs} +5 -3
  22. package/dist/{openai-chatgpt-responses-CedIj0hk.mjs → openai-chatgpt-responses-B84Ibtrd.mjs} +18 -13
  23. package/dist/openai-completions-DsOxhOD1.mjs +630 -0
  24. package/dist/openai-completions-compat-DBWjXoMZ.d.mts +43 -0
  25. package/dist/openai-reasoning-compat-YgeLncHw.mjs +396 -0
  26. package/dist/openai-responses-BT7A3sLu.mjs +138 -0
  27. package/dist/openai-responses-shared-pXl6Wd8S.mjs +392 -0
  28. package/dist/{openai-D3PD6PE-.mjs → openai-responses-stream-internal-Cw5txaGW.mjs} +1409 -1863
  29. package/dist/openai-tool-projection-OhX64DoP.mjs +215 -0
  30. package/dist/{provider-error-apVOZI6G.mjs → provider-error-CAEvRjry.mjs} +1 -1
  31. package/dist/provider-options-D8bB3z9b.d.mts +144 -0
  32. package/dist/providers.mjs +8 -8
  33. package/dist/{stream-first-event-timeout-C3OgBjIk.mjs → reasoning-tag-text-partitioner-CGDyLWUR.mjs} +1 -86
  34. package/dist/simple-options-9lhRrN73.mjs +50 -0
  35. package/dist/stream-first-event-timeout-BBys9hSb.mjs +86 -0
  36. package/dist/tls-certificate-errors-DXSpluKI.mjs +93 -0
  37. package/dist/tool-result-text-CTpIRbYd.mjs +225 -0
  38. package/dist/{github-copilot-headers-BCoBNmL7.mjs → tool-schema-json-projection-BwNu3nDi.mjs} +1 -48
  39. package/dist/transform-messages-C8mBqZxF.mjs +2 -0
  40. package/dist/{transport-stream-shared-BbMELSI4.mjs → transport-stream-shared-D81p90xq.mjs} +4 -4
  41. package/dist/transports.d.mts +13 -33
  42. package/dist/transports.mjs +75 -34
  43. package/package.json +4 -4
  44. package/dist/host-XYGZcgO8.mjs +0 -98
  45. package/dist/openai-BPor_3WI.d.mts +0 -358
  46. package/dist/openai-completions-CiSutyu0.mjs +0 -1223
  47. package/dist/shared-CdjNZd35.mjs +0 -634
@@ -0,0 +1,369 @@
1
+ import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, i as requiresClaudeDefaultSampling, o as resolveClaudeFable5ModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-QkygScBs.mjs";
2
+ //#region packages/normalization-core/src/record-coerce.ts
3
+ /** Type guard for non-array object records at browser-safe boundaries. */
4
+ function isRecord(value) {
5
+ return value !== null && typeof value === "object" && !Array.isArray(value);
6
+ }
7
+ //#endregion
8
+ //#region packages/normalization-core/src/string-coerce.ts
9
+ /** Reads a value only when it is already a string, preserving whitespace. */
10
+ function readStringValue(value) {
11
+ return typeof value === "string" ? value : void 0;
12
+ }
13
+ /** Trims string input and returns null for non-strings or empty strings. */
14
+ function normalizeNullableString(value) {
15
+ if (typeof value !== "string") return null;
16
+ const trimmed = value.trim();
17
+ return trimmed ? trimmed : null;
18
+ }
19
+ /** Trims string input and returns undefined for non-strings or empty strings. */
20
+ function normalizeOptionalString(value) {
21
+ return normalizeNullableString(value) ?? void 0;
22
+ }
23
+ /** Lowercases a normalized optional string. */
24
+ function normalizeOptionalLowercaseString(value) {
25
+ return normalizeOptionalString(value)?.toLowerCase();
26
+ }
27
+ /** Lowercases a normalized string or returns an empty string when absent. */
28
+ function normalizeLowercaseStringOrEmpty(value) {
29
+ return normalizeOptionalLowercaseString(value) ?? "";
30
+ }
31
+ /** Type guard for strings that remain non-empty after trimming. */
32
+ function hasNonEmptyString(value) {
33
+ return normalizeOptionalString(value) !== void 0;
34
+ }
35
+ //#endregion
36
+ //#region packages/ai/src/providers/anthropic-model-contract.ts
37
+ function normalizeModelId(modelId) {
38
+ const normalized = normalizeLowercaseStringOrEmpty(modelId);
39
+ return (normalized.startsWith("anthropic/") ? normalized.slice(10) : normalized).replace(/[._\s]+/g, "-");
40
+ }
41
+ function normalizeApi(api) {
42
+ const normalized = normalizeLowercaseStringOrEmpty(api);
43
+ return normalized === "openclaw-anthropic-messages-transport" ? "anthropic-messages" : normalized;
44
+ }
45
+ function hasConcreteResponseModel(ref) {
46
+ const responseModelId = normalizeModelId(ref.responseModelId);
47
+ return responseModelId.length > 0 && responseModelId !== normalizeModelId(ref.modelId);
48
+ }
49
+ function usesClaudeFable5MessagesContract(model) {
50
+ return normalizeApi(model.api) === "anthropic-messages" && resolveClaudeFable5ModelIdentity(model) !== void 0;
51
+ }
52
+ /** Return whether streamed output must wait for the terminal refusal decision. */
53
+ function usesClaudeStreamingRefusalContract(model) {
54
+ if (normalizeApi(model.api) !== "anthropic-messages") return false;
55
+ return resolveClaudeFable5ModelIdentity(model) !== void 0 || resolveClaudeMythos5ModelIdentity(model) !== void 0 || resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0;
56
+ }
57
+ function requiresClaudeAdaptiveThinking(model) {
58
+ if (normalizeApi(model.api) !== "anthropic-messages") return false;
59
+ return requiresClaudeMandatoryAdaptiveThinking(model);
60
+ }
61
+ /** Return whether omitted thinking should default to adaptive/high. */
62
+ function defaultsClaudeAdaptiveThinking(model) {
63
+ return requiresClaudeAdaptiveThinking(model) || normalizeApi(model.api) === "anthropic-messages" && (resolveClaudeOpus5ModelIdentity(model) !== void 0 || resolveClaudeSonnet5ModelIdentity(model) !== void 0);
64
+ }
65
+ /** Remove unsupported assistant prefills while preserving completed tool-use turns. */
66
+ function prepareClaudeNoPrefillRequestContext(model, context) {
67
+ if (!resolveClaudeOpus5ModelIdentity(model) && !resolveClaudeSonnet5ModelIdentity(model)) return context;
68
+ let end = context.messages.length;
69
+ while (end > 0) {
70
+ const message = context.messages[end - 1];
71
+ if (message?.role !== "assistant" || Array.isArray(message.content) && message.content.some((block) => block.type === "toolCall")) break;
72
+ end -= 1;
73
+ }
74
+ return end === context.messages.length ? context : {
75
+ ...context,
76
+ messages: context.messages.slice(0, end)
77
+ };
78
+ }
79
+ function applyClaudeRequestContract(params, model) {
80
+ if (normalizeApi(model.api) !== "anthropic-messages") return;
81
+ const opus5 = resolveClaudeOpus5ModelIdentity(model) !== void 0;
82
+ const sonnet5 = resolveClaudeSonnet5ModelIdentity(model) !== void 0;
83
+ if (!requiresClaudeDefaultSampling(model) && !opus5 && !sonnet5) return;
84
+ delete params.temperature;
85
+ delete params.top_p;
86
+ delete params.top_k;
87
+ if (opus5 || sonnet5) delete params.service_tier;
88
+ }
89
+ function resolveReplayModelBoundIdentity(ref) {
90
+ if (normalizeApi(ref.api) !== "anthropic-messages") return;
91
+ const modelRef = hasConcreteResponseModel(ref) ? { id: ref.responseModelId } : {
92
+ id: ref.modelId,
93
+ params: ref.modelParams
94
+ };
95
+ const fableIdentity = resolveClaudeFable5ModelIdentity(modelRef);
96
+ if (fableIdentity) return `fable:${fableIdentity}`;
97
+ const mythosIdentity = resolveClaudeMythos5ModelIdentity(modelRef);
98
+ if (mythosIdentity) return `mythos:${mythosIdentity}`;
99
+ const opusIdentity = resolveClaudeOpus5ModelIdentity(modelRef);
100
+ if (opusIdentity) return `opus:${opusIdentity}`;
101
+ const sonnetIdentity = resolveClaudeSonnet5ModelIdentity(modelRef);
102
+ return sonnetIdentity ? `sonnet:${sonnetIdentity}` : void 0;
103
+ }
104
+ function resolveModelBoundThinkingReplayMode(params) {
105
+ const sourceApi = normalizeApi(params.source.api);
106
+ const targetApi = normalizeApi(params.target.api);
107
+ const sourceIdentity = resolveReplayModelBoundIdentity(params.source);
108
+ const targetIdentity = resolveReplayModelBoundIdentity(params.target);
109
+ const sameRoute = normalizeLowercaseStringOrEmpty(params.source.provider) === normalizeLowercaseStringOrEmpty(params.target.provider) && sourceApi === targetApi && normalizeModelId(params.source.modelId) === normalizeModelId(params.target.modelId);
110
+ if (!sourceIdentity && !targetIdentity) return "default";
111
+ if (!sourceIdentity && !hasConcreteResponseModel(params.source) && targetIdentity && sameRoute) return "preserve";
112
+ return sourceApi === targetApi && sourceIdentity === targetIdentity ? "preserve" : "drop";
113
+ }
114
+ //#endregion
115
+ //#region packages/ai/src/transcript-transform.ts
116
+ const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
117
+ const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
118
+ function isImageWithMediaPayload(block) {
119
+ return isRecord(block) && block.type === "image" && typeof block.data === "string" && block.data.trim().length > 0;
120
+ }
121
+ function replaceImagesWithPlaceholder(content, placeholder) {
122
+ const result = [];
123
+ let previousWasPlaceholder = false;
124
+ for (const block of content) {
125
+ if (block.type === "image") {
126
+ if (!isImageWithMediaPayload(block)) continue;
127
+ if (!previousWasPlaceholder) result.push({
128
+ type: "text",
129
+ text: placeholder
130
+ });
131
+ previousWasPlaceholder = true;
132
+ continue;
133
+ }
134
+ result.push(block);
135
+ previousWasPlaceholder = block.text === placeholder;
136
+ }
137
+ return result;
138
+ }
139
+ function downgradeUnsupportedImages(messages, model) {
140
+ if (model.input.includes("image")) return messages;
141
+ return messages.map((msg) => {
142
+ if (msg.role === "user" && Array.isArray(msg.content)) return {
143
+ ...msg,
144
+ content: replaceImagesWithPlaceholder(msg.content, NON_VISION_USER_IMAGE_PLACEHOLDER)
145
+ };
146
+ if (msg.role === "toolResult") return {
147
+ ...msg,
148
+ content: replaceImagesWithPlaceholder(msg.content, NON_VISION_TOOL_IMAGE_PLACEHOLDER)
149
+ };
150
+ return msg;
151
+ });
152
+ }
153
+ /**
154
+ * Normalize tool call ID for cross-provider compatibility.
155
+ * OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.
156
+ * Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars).
157
+ */
158
+ function transformMessages(messages, model, normalizeToolCallId) {
159
+ const toolCallIdMap = /* @__PURE__ */ new Map();
160
+ const transformed = downgradeUnsupportedImages(messages.map((msg) => msg.content == null ? {
161
+ ...msg,
162
+ content: []
163
+ } : msg), model).map((msg) => {
164
+ if (msg.role === "user") return msg;
165
+ if (msg.role === "toolResult") {
166
+ const normalizedId = toolCallIdMap.get(msg.toolCallId);
167
+ if (normalizedId && normalizedId !== msg.toolCallId) return Object.assign({}, msg, { toolCallId: normalizedId });
168
+ return msg;
169
+ }
170
+ if (msg.role === "assistant") {
171
+ const assistantMsg = msg;
172
+ const modelBoundThinkingReplayMode = resolveModelBoundThinkingReplayMode({
173
+ source: {
174
+ provider: assistantMsg.provider,
175
+ api: assistantMsg.api,
176
+ modelId: assistantMsg.model,
177
+ responseModelId: assistantMsg.responseModel
178
+ },
179
+ target: {
180
+ provider: model.provider,
181
+ api: model.api,
182
+ modelId: model.id,
183
+ modelParams: model.params
184
+ }
185
+ });
186
+ const isSameModel = modelBoundThinkingReplayMode === "preserve" || assistantMsg.provider === model.provider && assistantMsg.api === model.api && assistantMsg.model === model.id;
187
+ const transformedContent = (typeof assistantMsg.content === "string" ? [{
188
+ type: "text",
189
+ text: assistantMsg.content
190
+ }] : assistantMsg.content).flatMap((block) => {
191
+ if (block.type === "thinking") {
192
+ if (modelBoundThinkingReplayMode === "drop") return [];
193
+ if (block.redacted) return isSameModel ? block : [];
194
+ if (isSameModel && block.thinkingSignature) return block;
195
+ if (!block.thinking || block.thinking.trim() === "") return [];
196
+ if (isSameModel) return block;
197
+ return {
198
+ type: "text",
199
+ text: block.thinking
200
+ };
201
+ }
202
+ if (block.type === "text") {
203
+ if (isSameModel) return block;
204
+ return {
205
+ type: "text",
206
+ text: block.text
207
+ };
208
+ }
209
+ if (block.type === "toolCall") {
210
+ const toolCall = block;
211
+ let normalizedToolCall = toolCall;
212
+ if (!isSameModel && toolCall.thoughtSignature) {
213
+ normalizedToolCall = Object.assign({}, toolCall);
214
+ delete normalizedToolCall.thoughtSignature;
215
+ }
216
+ if (!isSameModel && normalizeToolCallId) {
217
+ const normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);
218
+ if (normalizedId !== toolCall.id) {
219
+ toolCallIdMap.set(toolCall.id, normalizedId);
220
+ normalizedToolCall = Object.assign({}, normalizedToolCall, { id: normalizedId });
221
+ }
222
+ }
223
+ return normalizedToolCall;
224
+ }
225
+ return block;
226
+ });
227
+ return Object.assign({}, assistantMsg, { content: transformedContent });
228
+ }
229
+ return msg;
230
+ });
231
+ const result = [];
232
+ let pendingToolCalls = [];
233
+ let existingToolResultIds = /* @__PURE__ */ new Set();
234
+ const insertSyntheticToolResults = () => {
235
+ if (pendingToolCalls.length > 0) {
236
+ for (const tc of pendingToolCalls) if (!existingToolResultIds.has(tc.id)) result.push({
237
+ role: "toolResult",
238
+ toolCallId: tc.id,
239
+ toolName: tc.name,
240
+ content: [{
241
+ type: "text",
242
+ text: "No result provided"
243
+ }],
244
+ isError: true,
245
+ timestamp: Date.now()
246
+ });
247
+ pendingToolCalls = [];
248
+ existingToolResultIds = /* @__PURE__ */ new Set();
249
+ }
250
+ };
251
+ for (const msg of transformed) if (msg.role === "assistant") {
252
+ insertSyntheticToolResults();
253
+ const assistantMsg = msg;
254
+ if (assistantMsg.stopReason === "error" || assistantMsg.stopReason === "aborted") continue;
255
+ const toolCalls = assistantMsg.content.filter((b) => b.type === "toolCall");
256
+ if (toolCalls.length > 0) {
257
+ pendingToolCalls = toolCalls;
258
+ existingToolResultIds = /* @__PURE__ */ new Set();
259
+ }
260
+ result.push(msg);
261
+ } else if (msg.role === "toolResult") {
262
+ existingToolResultIds.add(msg.toolCallId);
263
+ result.push(msg);
264
+ } else if (msg.role === "user") {
265
+ insertSyntheticToolResults();
266
+ result.push(msg);
267
+ } else result.push(msg);
268
+ insertSyntheticToolResults();
269
+ return result;
270
+ }
271
+ //#endregion
272
+ //#region packages/ai/src/host.ts
273
+ const MAX_PENDING_CUSTOM_API_REGISTRATIONS = 32;
274
+ const pendingCustomApiRegistrations = [];
275
+ function queueCustomApiRegistration(registry, api, streamFn) {
276
+ const existing = pendingCustomApiRegistrations.find((registration) => registration.registry === registry && registration.api === api);
277
+ if (existing) {
278
+ existing.streamFn = streamFn;
279
+ return false;
280
+ }
281
+ if (pendingCustomApiRegistrations.length >= MAX_PENDING_CUSTOM_API_REGISTRATIONS) throw new Error("Too many custom transport APIs were registered before host configuration");
282
+ pendingCustomApiRegistrations.push({
283
+ registry,
284
+ api,
285
+ streamFn
286
+ });
287
+ return false;
288
+ }
289
+ const inertAiTransportHost = {
290
+ buildModelFetch: () => void 0,
291
+ resolveSecretSentinel: (value) => value,
292
+ redactSecrets: (value) => value,
293
+ redactToolPayloadText: (text) => text,
294
+ normalizeAnthropicInlineContentBlocks: async (content) => [...content],
295
+ resolveOpenAIStrictToolSetting: (_model, options) => options?.supportsStrictMode ? false : void 0,
296
+ plugin: {
297
+ resolveProviderStream: () => void 0,
298
+ resolveTransportTurnState: () => void 0,
299
+ wrapSimpleCompletionStream: () => void 0,
300
+ createAnthropicVertexStream: () => {
301
+ throw new Error("Anthropic Vertex transport is not configured by the embedding host");
302
+ }
303
+ },
304
+ buildCopilotDynamicHeaders: () => ({}),
305
+ resolveProviderEndpointClass: () => "default",
306
+ resolveProviderRequestCapabilities: () => ({
307
+ endpointClass: "default",
308
+ knownProviderFamily: "",
309
+ supportsNativeStreamingUsageCompat: false,
310
+ supportsOpenAICompletionsStreamingUsageCompat: false,
311
+ usesExplicitProxyLikeEndpoint: false,
312
+ allowsAnthropicServiceTier: false
313
+ }),
314
+ resolveProviderRequestHeaders: ({ providerHeaders, callerHeaders, precedence }) => ({
315
+ ...precedence === "caller-wins" ? providerHeaders : callerHeaders,
316
+ ...precedence === "caller-wins" ? callerHeaders : providerHeaders
317
+ }),
318
+ resolveModelRequestTimeoutMs: () => void 0,
319
+ requiresManagedTransport: () => false,
320
+ inheritManagedTransport: (_source, target) => target,
321
+ transformTransportMessages: (messages, model, normalizeToolCallId) => transformMessages(messages, model, normalizeToolCallId),
322
+ registerCustomApi: queueCustomApiRegistration,
323
+ prepareGoogleSimpleCompletionModel: (_registry, model) => model,
324
+ logDebug: () => {},
325
+ logInfo: () => {},
326
+ logWarn: () => {}
327
+ };
328
+ let activeAiTransportHost = inertAiTransportHost;
329
+ /** Installs host implementations for the transport policy ports. */
330
+ function configureAiTransportHost(host) {
331
+ activeAiTransportHost = {
332
+ ...inertAiTransportHost,
333
+ ...host,
334
+ normalizeAnthropicInlineContentBlocks: host.normalizeAnthropicInlineContentBlocks ?? inertAiTransportHost.normalizeAnthropicInlineContentBlocks,
335
+ plugin: {
336
+ ...inertAiTransportHost.plugin,
337
+ ...host.plugin
338
+ }
339
+ };
340
+ const transportHost = activeAiTransportHost;
341
+ if (transportHost.registerCustomApi === inertAiTransportHost.registerCustomApi || pendingCustomApiRegistrations.length === 0) return;
342
+ const pending = pendingCustomApiRegistrations.splice(0);
343
+ for (const [index, registration] of pending.entries()) try {
344
+ transportHost.registerCustomApi(registration.registry, registration.api, registration.streamFn);
345
+ } catch (error) {
346
+ pendingCustomApiRegistrations.unshift(...pending.slice(index));
347
+ throw error;
348
+ }
349
+ }
350
+ /** Returns the active transport host (inert defaults unless configured). */
351
+ function getAiTransportHost() {
352
+ return activeAiTransportHost;
353
+ }
354
+ /** Resolves sentinel substrings in custom headers at a no-fetch adapter boundary. */
355
+ function resolveAiTransportHeaderSentinels(headers) {
356
+ if (!headers) return;
357
+ const host = getAiTransportHost();
358
+ let resolvedHeaders;
359
+ for (const [name, value] of Object.entries(headers)) {
360
+ const resolved = host.resolveSecretSentinel(value);
361
+ if (resolved !== value) {
362
+ resolvedHeaders ??= { ...headers };
363
+ resolvedHeaders[name] = resolved;
364
+ }
365
+ }
366
+ return resolvedHeaders ?? headers;
367
+ }
368
+ //#endregion
369
+ export { applyClaudeRequestContract as a, requiresClaudeAdaptiveThinking as c, usesClaudeStreamingRefusalContract as d, hasNonEmptyString as f, isRecord as g, readStringValue as h, transformMessages as i, resolveModelBoundThinkingReplayMode as l, normalizeOptionalString as m, getAiTransportHost as n, defaultsClaudeAdaptiveThinking as o, normalizeLowercaseStringOrEmpty as p, resolveAiTransportHeaderSentinels as r, prepareClaudeNoPrefillRequestContext as s, configureAiTransportHost as t, usesClaudeFable5MessagesContract as u };
package/dist/index.mjs CHANGED
@@ -3,5 +3,5 @@ import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as ext
3
3
  import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-D8n2uFee.mjs";
4
4
  import { n as validateToolCall, t as validateToolArguments } from "./validation-DAa_yFOM.mjs";
5
5
  import { n as createApiRegistry, t as createLlmRuntime } from "./stream-CREqxHgU.mjs";
6
- import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-XYGZcgO8.mjs";
6
+ import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, t as configureAiTransportHost } from "./host-Dog2WQiR.mjs";
7
7
  export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, appendAssistantMessageDiagnostic, configureAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, extractDiagnosticError, formatThrownValue, getAiTransportHost, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
@@ -1,58 +1,8 @@
1
1
  import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "../anthropic-SrGtwsJu.mjs";
2
2
  import { t as AssistantMessageDiagnostic } from "../diagnostics-BaTA9eVl.mjs";
3
- import { E as Model, F as SimpleStreamOptions, R as StreamFunction, u as Context, z as StreamOptions } from "../types-bzp5k29J.mjs";
4
- import Anthropic from "@anthropic-ai/sdk";
5
-
3
+ import { E as Model, F as SimpleStreamOptions, R as StreamFunction, u as Context } from "../types-bzp5k29J.mjs";
4
+ import { n as AnthropicOptions, r as AnthropicThinkingDisplay, t as AnthropicEffort } from "../provider-options-D8bB3z9b.mjs";
6
5
  //#region packages/ai/src/providers/anthropic.d.ts
7
- type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
8
- type AnthropicThinkingDisplay = "summarized" | "omitted";
9
- interface AnthropicOptions extends StreamOptions {
10
- /**
11
- * Enable extended thinking.
12
- * For Opus 4.6+ and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
13
- * For older models: uses budget-based thinking with thinkingBudgetTokens.
14
- */
15
- thinkingEnabled?: boolean;
16
- /**
17
- * Token budget for extended thinking (older models only).
18
- * Ignored for Opus 4.6+ and Sonnet 4.6, which use adaptive thinking.
19
- */
20
- thinkingBudgetTokens?: number;
21
- /**
22
- * Effort level for adaptive thinking (Opus 4.6+ and Sonnet 4.6).
23
- * Controls how much thinking Claude allocates:
24
- * - "max": Always thinks with no constraints (Opus 4.6 only)
25
- * - "xhigh": Highest reasoning level (Opus 4.7+)
26
- * - "high": Always thinks, deep reasoning (default)
27
- * - "medium": Moderate thinking, may skip for simple queries
28
- * - "low": Minimal thinking, skips for simple tasks
29
- * Ignored for older models.
30
- */
31
- effort?: AnthropicEffort;
32
- /**
33
- * Controls how thinking content is returned in API responses.
34
- * - "summarized": Thinking blocks contain summarized thinking text (default here).
35
- * - "omitted": Thinking blocks return an empty thinking field; the encrypted
36
- * signature still travels back for multi-turn continuity. Use for faster
37
- * time-to-first-text-token when your UI does not surface thinking.
38
- *
39
- * Note: Anthropic's API default for Claude Opus 4.7+ and Claude Mythos Preview
40
- * is "omitted". We default to "summarized" here to keep behavior consistent
41
- * with older Claude 4 models. Set this explicitly to "omitted" to opt in.
42
- */
43
- thinkingDisplay?: AnthropicThinkingDisplay;
44
- interleavedThinking?: boolean;
45
- toolChoice?: "auto" | "any" | "none" | {
46
- type: "tool";
47
- name: string;
48
- };
49
- /**
50
- * Pre-built Anthropic client instance. When provided, skips internal client
51
- * construction entirely. Use this to inject alternative SDK clients such as
52
- * `AnthropicVertex` that shares the same messaging API.
53
- */
54
- client?: Anthropic;
55
- }
56
6
  declare const streamAnthropic: StreamFunction<"anthropic-messages", AnthropicOptions>;
57
7
  type AnthropicSimpleStreamOptions = SimpleStreamOptions & {
58
8
  toolChoice?: AnthropicOptions["toolChoice"];
@@ -241,4 +191,4 @@ declare function readAnthropicCacheWriteUsage(usage: AnthropicUsagePayload): Ant
241
191
  declare function readAnthropicPromptUsageSnapshot(usage: AnthropicUsagePayload): AnthropicPromptUsageSnapshot | undefined;
242
192
  declare function readLastAnthropicIterationUsage(usage: AnthropicUsagePayload): AnthropicIterationUsageResult;
243
193
  //#endregion
244
- export { ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, AnthropicCacheWriteUsage, AnthropicEffort, AnthropicFallbackBoundary, AnthropicIterationUsageResult, AnthropicIterationUsageSnapshot, AnthropicOptions, AnthropicProjectedToolChoice, AnthropicPromptUsageSnapshot, AnthropicThinkingDisplay, AnthropicToolProjection, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicRefusal, applyClaudeRequestContract, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
194
+ export { ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, AnthropicCacheWriteUsage, type AnthropicEffort, AnthropicFallbackBoundary, AnthropicIterationUsageResult, AnthropicIterationUsageSnapshot, type AnthropicOptions, AnthropicProjectedToolChoice, AnthropicPromptUsageSnapshot, type AnthropicThinkingDisplay, AnthropicToolProjection, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicRefusal, applyClaudeRequestContract, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
@@ -1,4 +1,5 @@
1
1
  import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "../src-QkygScBs.mjs";
2
- import { _ as usesClaudeStreamingRefusalContract, d as applyClaudeRequestContract, f as defaultsClaudeAdaptiveThinking, g as usesClaudeFable5MessagesContract, h as resolveModelBoundThinkingReplayMode, m as requiresClaudeAdaptiveThinking, p as prepareClaudeNoPrefillRequestContext } from "../shared-CdjNZd35.mjs";
3
- import { _ as readAnthropicFallbackBoundary, a as readAnthropicPromptUsageSnapshot, b as omitFoundryBearerCredentialHeaders, c as projectAnthropicTools, d as ANTHROPIC_OMITTED_REASONING_TEXT, f as findActiveAnthropicToolTurnAssistantIndex, g as applyAnthropicFallbackBoundary, h as CLAUDE_OPUS_FALLBACK_MODEL_COST, i as readAnthropicCacheWriteUsage, l as reconcileAnthropicToolChoice, m as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, n as streamAnthropic, o as readAnthropicUsageTokenCount, p as ANTHROPIC_SERVER_SIDE_FALLBACKS, r as streamSimpleAnthropic, s as readLastAnthropicIterationUsage, u as resolveOriginalAnthropicToolName, v as resolveAnthropicFallbackServingModelCost, x as usesFoundryBearerAuth, y as applyAnthropicRefusal } from "../anthropic-CQVj3le6.mjs";
2
+ import { a as applyClaudeRequestContract, c as requiresClaudeAdaptiveThinking, d as usesClaudeStreamingRefusalContract, l as resolveModelBoundThinkingReplayMode, o as defaultsClaudeAdaptiveThinking, s as prepareClaudeNoPrefillRequestContext, u as usesClaudeFable5MessagesContract } from "../host-Dog2WQiR.mjs";
3
+ import { _ as omitFoundryBearerCredentialHeaders, a as projectAnthropicTools, c as ANTHROPIC_OMITTED_REASONING_TEXT, d as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, f as CLAUDE_OPUS_FALLBACK_MODEL_COST, g as applyAnthropicRefusal, h as resolveAnthropicFallbackServingModelCost, i as readLastAnthropicIterationUsage, l as findActiveAnthropicToolTurnAssistantIndex, m as readAnthropicFallbackBoundary, n as readAnthropicPromptUsageSnapshot, o as reconcileAnthropicToolChoice, p as applyAnthropicFallbackBoundary, r as readAnthropicUsageTokenCount, s as resolveOriginalAnthropicToolName, t as readAnthropicCacheWriteUsage, u as ANTHROPIC_SERVER_SIDE_FALLBACKS, v as usesFoundryBearerAuth } from "../anthropic-usage-DWU-x8MI.mjs";
4
+ import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-CH4UUnZr.mjs";
4
5
  export { ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicRefusal, applyClaudeRequestContract, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, omitFoundryBearerCredentialHeaders, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };