@openclaw/ai 2026.8.1 → 2026.8.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-Djj7L1rx.mjs → anthropic-BNeFhAh3.mjs} +197 -185
- package/dist/{anthropic-compaction-replay-CY4tkD4V.mjs → anthropic-compaction-replay-B6sEzXhr.mjs} +24 -7
- package/dist/{anthropic-payload-policy-i_5_inWe.d.mts → anthropic-payload-policy-kkq8L7tJ.d.mts} +2 -2
- package/dist/{api-registry-C9-wZd_W.d.mts → api-registry-CAK4bNkq.d.mts} +2 -2
- package/dist/{azure-openai-responses-Bj3czHNa.mjs → azure-openai-responses-CPvqFff1.mjs} +6 -5
- package/dist/diagnostics.mjs +1 -1
- package/dist/event-stream-CDHaMazK.d.mts +1 -0
- package/dist/{event-stream-UhnxHuqt.d.mts → event-stream-DcQzYRWO.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-0Ca6TYbw.mjs → google-B6pXyWB0.mjs} +7 -5
- package/dist/{google-shared-DVfL9COU.mjs → google-shared-C_3CT37v.mjs} +25 -23
- package/dist/{google-vertex-5dAMxprN.mjs → google-vertex-BA2c1toq.mjs} +7 -5
- package/dist/{host-DoPJJ1KD.d.mts → host-DL2Zd9ep.d.mts} +3 -3
- package/dist/{host-D51fmkH6.mjs → host-DhlhmyR6.mjs} +17 -2
- package/dist/index-DcGDVDnC.d.mts +118 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +11 -6
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +1 -1
- package/dist/internal/openai.d.mts +7 -7
- package/dist/internal/openai.mjs +10 -10
- package/dist/internal/runtime.d.mts +5 -5
- package/dist/internal/runtime.mjs +3 -3
- package/dist/internal/shared.d.mts +2 -2
- package/dist/internal/shared.mjs +3 -3
- package/dist/{mistral-BCnrI-kV.mjs → mistral-CTcM9TGz.mjs} +18 -13
- package/dist/{openai-chatgpt-responses-CGBGWSqr.mjs → openai-chatgpt-responses-QqHf1o9v.mjs} +17 -16
- package/dist/{openai-completions-BaTuwID7.mjs → openai-completions-BCmKwgsc.mjs} +17 -14
- package/dist/{openai-completions-compat-DB7FFq7k.d.mts → openai-completions-compat-BJE92duO.d.mts} +3 -3
- package/dist/{openai-completions-stream-Bpns6uNc.mjs → openai-completions-stream-0mm4YUag.mjs} +30 -27
- package/dist/openai-prompt-cache-BUJI5cW-.d.mts +16 -0
- package/dist/openai-prompt-cache-CGnVB74a.mjs +21 -0
- package/dist/{openai-responses-compaction-window-DwydGZI8.mjs → openai-responses-compaction-window-vuCaZYLS.mjs} +3 -3
- package/dist/{openai-responses-contracts-DgaR3t5T.d.mts → openai-responses-contracts-DFJOyjd1.d.mts} +6 -3
- package/dist/{openai-responses-1GBcQujk.mjs → openai-responses-pMJVxhHW.mjs} +11 -12
- package/dist/{openai-responses-prompt-observer-internal-_nhGTn2b.mjs → openai-responses-prompt-observer-internal-COaImuDp.mjs} +3 -3
- package/dist/{openai-responses-shared-zPmKnhF5.mjs → openai-responses-shared-CZTRmOFP.mjs} +27 -26
- package/dist/{openai-tool-schema-Dgl4H2MU.mjs → openai-tool-schema-DjS9-DHe.mjs} +14 -12
- package/dist/{provider-error-jZP5NMTZ.mjs → provider-error-BI8kIViN.mjs} +11 -11
- package/dist/{provider-options-HvA_slFa.d.mts → provider-options-CedgbINH.d.mts} +2 -2
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-BnsgCK8K.mjs} +1 -1
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-CwzKb0bA.mjs → reasoning-tag-text-partitioner-BsUX44Tq.mjs} +29 -19
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-Cfcaqa9V.mjs} +2 -8
- package/dist/{simple-options-DKx86yX9.mjs → simple-options-Bwi0x0bX.mjs} +2 -2
- package/dist/{src-Bu3FiFAG.mjs → src-BhgSqnbz.mjs} +88 -2
- package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-_gcOC21Y.mjs} +21 -31
- package/dist/{transport-stream-shared-NjwWNaRY.d.mts → transport-stream-shared-B38NWYTa.d.mts} +4 -4
- package/dist/{transport-stream-shared-CT5ycdzn.mjs → transport-stream-shared-y1YR1k5K.mjs} +2 -2
- package/dist/{transport-utils-BHx9z8Cl.mjs → transport-utils-DdLjoPMb.mjs} +2 -2
- package/dist/transports.d.mts +12 -9
- package/dist/transports.mjs +91 -73
- package/dist/types-DmdQ-xcq.d.mts +1 -0
- package/dist/{types-h38Azne1.d.mts → types-DmeScJQe.d.mts} +25 -13
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +3 -3
- package/dist/{validation-B61OhAio.mjs → validation-CJZtym2g.mjs} +7 -5
- package/dist/{validation-C68lP2uy.d.mts → validation-DPDgbaD3.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +2 -2
- package/dist/event-stream-C988TSLe.d.mts +0 -1
- package/dist/index-N3zr6__t.d.mts +0 -105
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/types-DtGu2d3C.d.mts +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort } from "./src-BhgSqnbz.mjs";
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
4
4
|
import { o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
5
|
-
import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
6
|
-
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, m as applyClaudeRequestContract, n as getAiTransportHost, p as ANTHROPIC_CLAUDE_CODE_VERSION, r as resolveAiTransportHeaderSentinels, s as extractToolResultBlockText, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "./host-
|
|
7
|
-
import { n as projectProviderError } from "./provider-error-
|
|
8
|
-
import { A as
|
|
5
|
+
import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-Cfcaqa9V.mjs";
|
|
6
|
+
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, m as applyClaudeRequestContract, n as getAiTransportHost, p as ANTHROPIC_CLAUDE_CODE_VERSION, r as resolveAiTransportHeaderSentinels, s as extractToolResultBlockText, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "./host-DhlhmyR6.mjs";
|
|
7
|
+
import { n as projectProviderError } from "./provider-error-BI8kIViN.mjs";
|
|
8
|
+
import { A as createAnthropicInlineImageBudget, B as omitFoundryBearerCredentialHeaders, C as ANTHROPIC_SERVER_SIDE_FALLBACKS, D as readAnthropicFallbackBoundary, E as applyAnthropicFallbackBoundary, M as resolveAnthropicImageMediaType, N as applyAnthropicCacheControlToMessages, O as resolveAnthropicFallbackServingModelCost, S as readAnthropicInputTransformations, V as usesFoundryBearerAuth, _ as toClaudeCodeToolName, a as suppressAnthropicCompaction, b as findActiveAnthropicToolTurnAssistantIndex, f as normalizeAnthropicToolCallId, g as resolveOriginalAnthropicToolName, h as reconcileAnthropicToolChoice, j as normalizeAnthropicInlineContent, k as applyAnthropicRefusal, m as projectAnthropicTools, n as createCompactionCapture, o as applyAnthropicMessageDeltaUsage, p as normalizeAnthropicToolChoice, r as isAnthropicReplayRejection, s as applyAnthropicMessageStartUsage, t as buildAnthropicReplayPlan, v as ANTHROPIC_OMITTED_REASONING_TEXT, w as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, x as logAnthropicThinkingDrops, y as applyAnthropicThinkingBindingControls, z as isAnthropicOAuthApiKey } from "./anthropic-compaction-replay-B6sEzXhr.mjs";
|
|
9
9
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
10
|
-
import { d as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, u as splitSystemPromptCacheBoundary } from "./simple-options-
|
|
11
|
-
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-
|
|
10
|
+
import { d as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, u as splitSystemPromptCacheBoundary } from "./simple-options-Bwi0x0bX.mjs";
|
|
11
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-DdLjoPMb.mjs";
|
|
12
12
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
13
|
-
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments } from "./transport-stream-shared-
|
|
13
|
+
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments } from "./transport-stream-shared-y1YR1k5K.mjs";
|
|
14
14
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
15
15
|
import { n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
16
16
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
17
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
17
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-BnsgCK8K.mjs";
|
|
18
18
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
19
19
|
import Anthropic from "@anthropic-ai/sdk";
|
|
20
20
|
import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
|
|
@@ -159,10 +159,12 @@ const streamAnthropic = (model, context, options) => {
|
|
|
159
159
|
let costModel = model;
|
|
160
160
|
let messageStartPromptUsage;
|
|
161
161
|
let usedCompactionReplay = false;
|
|
162
|
+
let inputTransformations;
|
|
162
163
|
try {
|
|
163
164
|
let client;
|
|
164
165
|
let isOAuth;
|
|
165
166
|
let serverSideFallback = false;
|
|
167
|
+
let directApiKeyBetaHeader;
|
|
166
168
|
if (requestOptions?.client) {
|
|
167
169
|
client = requestOptions.client;
|
|
168
170
|
isOAuth = false;
|
|
@@ -181,6 +183,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
181
183
|
client = created.client;
|
|
182
184
|
isOAuth = created.isOAuthToken;
|
|
183
185
|
serverSideFallback = created.serverSideFallback;
|
|
186
|
+
directApiKeyBetaHeader = created.directApiKeyBetaHeader;
|
|
184
187
|
}
|
|
185
188
|
const builtParams = await buildParams(model, requestContext, isOAuth, requestOptions, serverSideFallback);
|
|
186
189
|
usedCompactionReplay = builtParams.usedCompactionReplay;
|
|
@@ -192,7 +195,8 @@ const streamAnthropic = (model, context, options) => {
|
|
|
192
195
|
const sdkRequestOptions = {
|
|
193
196
|
...requestOptions?.signal ? { signal: requestOptions.signal } : {},
|
|
194
197
|
...requestOptions?.timeoutMs !== void 0 ? { timeout: requestOptions.timeoutMs } : {},
|
|
195
|
-
maxRetries: requestOptions?.maxRetries ?? 0
|
|
198
|
+
maxRetries: requestOptions?.maxRetries ?? 0,
|
|
199
|
+
headers: applyAnthropicThinkingBindingControls(params, directApiKeyBetaHeader)
|
|
196
200
|
};
|
|
197
201
|
const response = await client.messages.create({
|
|
198
202
|
...params,
|
|
@@ -209,199 +213,204 @@ const streamAnthropic = (model, context, options) => {
|
|
|
209
213
|
const sealedToolCalls = [];
|
|
210
214
|
const compactionCapture = createCompactionCapture(output, model, requestOptions);
|
|
211
215
|
const requireMessageStop = refusalBuffer !== void 0 || model.provider === "anthropic" && isAnthropicPublicEndpoint(model.baseUrl);
|
|
212
|
-
for await (const event of iterateAnthropicEvents(response, requireMessageStop))
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
type: "start",
|
|
219
|
-
partial: output
|
|
220
|
-
});
|
|
221
|
-
} else if (event.type === "content_block_start") {
|
|
222
|
-
const rawContentBlock = isRecord(event.content_block) ? event.content_block : void 0;
|
|
223
|
-
if (requestOptions?.anthropicServerCompaction === true && compactionCapture.begin(event.index, rawContentBlock, output.content.length)) continue;
|
|
224
|
-
const fallbackBoundary = refusalBuffer ? readAnthropicFallbackBoundary(event.content_block) : null;
|
|
225
|
-
if (fallbackBoundary) {
|
|
226
|
-
refusalBuffer?.discard();
|
|
227
|
-
sealedToolCalls.length = 0;
|
|
228
|
-
blockIndexes.clear();
|
|
229
|
-
applyAnthropicFallbackBoundary({
|
|
230
|
-
output,
|
|
231
|
-
boundary: fallbackBoundary,
|
|
232
|
-
provider: model.provider
|
|
233
|
-
});
|
|
234
|
-
costModel = {
|
|
235
|
-
...model,
|
|
236
|
-
cost: resolveAnthropicFallbackServingModelCost({
|
|
237
|
-
requestedModelId: model.id,
|
|
238
|
-
servingModelId: fallbackBoundary.toModel,
|
|
239
|
-
requestedCost: model.cost
|
|
240
|
-
})
|
|
241
|
-
};
|
|
216
|
+
for await (const event of iterateAnthropicEvents(response, requireMessageStop)) {
|
|
217
|
+
inputTransformations = readAnthropicInputTransformations(event) ?? inputTransformations;
|
|
218
|
+
if (event.type === "message_start") {
|
|
219
|
+
output.responseId = event.message.id;
|
|
220
|
+
output.responseModel = event.message.model;
|
|
221
|
+
messageStartPromptUsage = applyAnthropicMessageStartUsage(output.usage, event.message.usage);
|
|
242
222
|
calculateCost(costModel, output.usage);
|
|
243
223
|
eventSink.push({
|
|
244
224
|
type: "start",
|
|
245
225
|
partial: output
|
|
246
226
|
});
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
227
|
+
} else if (event.type === "content_block_start") {
|
|
228
|
+
const rawContentBlock = isRecord(event.content_block) ? event.content_block : void 0;
|
|
229
|
+
if (requestOptions?.anthropicServerCompaction === true && compactionCapture.begin(event.index, rawContentBlock, output.content.length)) continue;
|
|
230
|
+
const fallbackBoundary = refusalBuffer ? readAnthropicFallbackBoundary(event.content_block) : null;
|
|
231
|
+
if (fallbackBoundary) {
|
|
232
|
+
refusalBuffer?.discard();
|
|
233
|
+
sealedToolCalls.length = 0;
|
|
234
|
+
blockIndexes.clear();
|
|
235
|
+
applyAnthropicFallbackBoundary({
|
|
236
|
+
output,
|
|
237
|
+
boundary: fallbackBoundary,
|
|
238
|
+
provider: model.provider
|
|
239
|
+
});
|
|
240
|
+
costModel = {
|
|
241
|
+
...model,
|
|
242
|
+
cost: resolveAnthropicFallbackServingModelCost({
|
|
243
|
+
requestedModelId: model.id,
|
|
244
|
+
servingModelId: fallbackBoundary.toModel,
|
|
245
|
+
requestedCost: model.cost
|
|
246
|
+
})
|
|
247
|
+
};
|
|
248
|
+
calculateCost(costModel, output.usage);
|
|
249
|
+
eventSink.push({
|
|
250
|
+
type: "start",
|
|
251
|
+
partial: output
|
|
252
|
+
});
|
|
253
|
+
for (const [i, block] of blocks.entries()) {
|
|
254
|
+
if (block.type !== "text") continue;
|
|
255
|
+
delete block.index;
|
|
256
|
+
eventSink.push({
|
|
257
|
+
type: "text_start",
|
|
258
|
+
contentIndex: i,
|
|
259
|
+
partial: output
|
|
260
|
+
});
|
|
261
|
+
if (block.text) eventSink.push({
|
|
262
|
+
type: "text_delta",
|
|
263
|
+
contentIndex: i,
|
|
264
|
+
delta: block.text,
|
|
265
|
+
partial: output
|
|
266
|
+
});
|
|
267
|
+
eventSink.push({
|
|
268
|
+
type: "text_end",
|
|
269
|
+
contentIndex: i,
|
|
270
|
+
content: block.text,
|
|
271
|
+
partial: output
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
} else if (event.content_block.type === "text") {
|
|
275
|
+
const block = {
|
|
276
|
+
type: "text",
|
|
277
|
+
text: "",
|
|
278
|
+
index: event.index
|
|
279
|
+
};
|
|
280
|
+
output.content.push(block);
|
|
281
|
+
blockIndexes.set(event.index, output.content.length - 1);
|
|
250
282
|
eventSink.push({
|
|
251
283
|
type: "text_start",
|
|
252
|
-
contentIndex:
|
|
284
|
+
contentIndex: output.content.length - 1,
|
|
253
285
|
partial: output
|
|
254
286
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
287
|
+
} else if (event.content_block.type === "thinking") {
|
|
288
|
+
const block = {
|
|
289
|
+
type: "thinking",
|
|
290
|
+
thinking: "",
|
|
291
|
+
thinkingSignature: "",
|
|
292
|
+
index: event.index
|
|
293
|
+
};
|
|
294
|
+
output.content.push(block);
|
|
295
|
+
blockIndexes.set(event.index, output.content.length - 1);
|
|
296
|
+
eventSink.push({
|
|
297
|
+
type: "thinking_start",
|
|
298
|
+
contentIndex: output.content.length - 1,
|
|
259
299
|
partial: output
|
|
260
300
|
});
|
|
301
|
+
} else if (event.content_block.type === "redacted_thinking") {
|
|
302
|
+
const block = {
|
|
303
|
+
type: "thinking",
|
|
304
|
+
thinking: "[Reasoning redacted]",
|
|
305
|
+
thinkingSignature: event.content_block.data,
|
|
306
|
+
redacted: true,
|
|
307
|
+
index: event.index
|
|
308
|
+
};
|
|
309
|
+
output.content.push(block);
|
|
310
|
+
blockIndexes.set(event.index, output.content.length - 1);
|
|
261
311
|
eventSink.push({
|
|
262
|
-
type: "
|
|
263
|
-
contentIndex:
|
|
264
|
-
content: block.text,
|
|
312
|
+
type: "thinking_start",
|
|
313
|
+
contentIndex: output.content.length - 1,
|
|
265
314
|
partial: output
|
|
266
315
|
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
partial: output
|
|
280
|
-
});
|
|
281
|
-
} else if (event.content_block.type === "thinking") {
|
|
282
|
-
const block = {
|
|
283
|
-
type: "thinking",
|
|
284
|
-
thinking: "",
|
|
285
|
-
thinkingSignature: "",
|
|
286
|
-
index: event.index
|
|
287
|
-
};
|
|
288
|
-
output.content.push(block);
|
|
289
|
-
blockIndexes.set(event.index, output.content.length - 1);
|
|
290
|
-
eventSink.push({
|
|
291
|
-
type: "thinking_start",
|
|
292
|
-
contentIndex: output.content.length - 1,
|
|
293
|
-
partial: output
|
|
294
|
-
});
|
|
295
|
-
} else if (event.content_block.type === "redacted_thinking") {
|
|
296
|
-
const block = {
|
|
297
|
-
type: "thinking",
|
|
298
|
-
thinking: "[Reasoning redacted]",
|
|
299
|
-
thinkingSignature: event.content_block.data,
|
|
300
|
-
redacted: true,
|
|
301
|
-
index: event.index
|
|
302
|
-
};
|
|
303
|
-
output.content.push(block);
|
|
304
|
-
blockIndexes.set(event.index, output.content.length - 1);
|
|
305
|
-
eventSink.push({
|
|
306
|
-
type: "thinking_start",
|
|
307
|
-
contentIndex: output.content.length - 1,
|
|
308
|
-
partial: output
|
|
309
|
-
});
|
|
310
|
-
} else if (event.content_block.type === "tool_use") {
|
|
311
|
-
const block = {
|
|
312
|
-
type: "toolCall",
|
|
313
|
-
id: event.content_block.id,
|
|
314
|
-
name: isOAuth ? resolveOriginalAnthropicToolName(event.content_block.name, toolProjection) : event.content_block.name,
|
|
315
|
-
arguments: event.content_block.input ?? {},
|
|
316
|
-
partialJson: "",
|
|
317
|
-
index: event.index
|
|
318
|
-
};
|
|
319
|
-
output.content.push(block);
|
|
320
|
-
blockIndexes.set(event.index, output.content.length - 1);
|
|
321
|
-
toolArgumentPreviewSchedules.set(block, createToolArgumentPreviewSchedule());
|
|
322
|
-
eventSink.push({
|
|
323
|
-
type: "toolcall_start",
|
|
324
|
-
contentIndex: output.content.length - 1,
|
|
325
|
-
partial: output
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
} else if (event.type === "content_block_delta") {
|
|
329
|
-
const rawDelta = isRecord(event.delta) ? event.delta : void 0;
|
|
330
|
-
if (compactionCapture.delta(event.index, rawDelta)) continue;
|
|
331
|
-
else if (event.delta.type === "text_delta") {
|
|
332
|
-
const index = blockIndexes.get(event.index);
|
|
333
|
-
const block = index === void 0 ? void 0 : blocks[index];
|
|
334
|
-
if (index !== void 0 && block?.type === "text") {
|
|
335
|
-
block.text += event.delta.text;
|
|
316
|
+
} else if (event.content_block.type === "tool_use") {
|
|
317
|
+
const block = {
|
|
318
|
+
type: "toolCall",
|
|
319
|
+
id: event.content_block.id,
|
|
320
|
+
name: isOAuth ? resolveOriginalAnthropicToolName(event.content_block.name, toolProjection) : event.content_block.name,
|
|
321
|
+
arguments: event.content_block.input ?? {},
|
|
322
|
+
partialJson: "",
|
|
323
|
+
index: event.index
|
|
324
|
+
};
|
|
325
|
+
output.content.push(block);
|
|
326
|
+
blockIndexes.set(event.index, output.content.length - 1);
|
|
327
|
+
toolArgumentPreviewSchedules.set(block, createToolArgumentPreviewSchedule());
|
|
336
328
|
eventSink.push({
|
|
337
|
-
type: "
|
|
338
|
-
contentIndex:
|
|
339
|
-
delta: event.delta.text,
|
|
329
|
+
type: "toolcall_start",
|
|
330
|
+
contentIndex: output.content.length - 1,
|
|
340
331
|
partial: output
|
|
341
332
|
});
|
|
342
333
|
}
|
|
343
|
-
} else if (event.
|
|
334
|
+
} else if (event.type === "content_block_delta") {
|
|
335
|
+
const rawDelta = isRecord(event.delta) ? event.delta : void 0;
|
|
336
|
+
if (compactionCapture.delta(event.index, rawDelta)) continue;
|
|
337
|
+
else if (event.delta.type === "text_delta") {
|
|
338
|
+
const index = blockIndexes.get(event.index);
|
|
339
|
+
const block = index === void 0 ? void 0 : blocks[index];
|
|
340
|
+
if (index !== void 0 && block?.type === "text") {
|
|
341
|
+
block.text += event.delta.text;
|
|
342
|
+
eventSink.push({
|
|
343
|
+
type: "text_delta",
|
|
344
|
+
contentIndex: index,
|
|
345
|
+
delta: event.delta.text,
|
|
346
|
+
partial: output
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
} else if (event.delta.type === "thinking_delta") {
|
|
350
|
+
const index = blockIndexes.get(event.index);
|
|
351
|
+
const block = index === void 0 ? void 0 : blocks[index];
|
|
352
|
+
if (index !== void 0 && block?.type === "thinking") {
|
|
353
|
+
block.thinking += event.delta.thinking;
|
|
354
|
+
eventSink.push({
|
|
355
|
+
type: "thinking_delta",
|
|
356
|
+
contentIndex: index,
|
|
357
|
+
delta: event.delta.thinking,
|
|
358
|
+
partial: output
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
} else if (event.delta.type === "input_json_delta") {
|
|
362
|
+
const index = blockIndexes.get(event.index);
|
|
363
|
+
const block = index === void 0 ? void 0 : blocks[index];
|
|
364
|
+
if (index !== void 0 && block?.type === "toolCall") {
|
|
365
|
+
block.partialJson = (block.partialJson ?? "") + event.delta.partial_json;
|
|
366
|
+
if (toolArgumentPreviewSchedules.get(block)?.(block.partialJson.length)) block.arguments = parseStreamingJson(block.partialJson);
|
|
367
|
+
eventSink.push({
|
|
368
|
+
type: "toolcall_delta",
|
|
369
|
+
contentIndex: index,
|
|
370
|
+
delta: event.delta.partial_json,
|
|
371
|
+
partial: output
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
} else if (event.delta.type === "signature_delta") {
|
|
375
|
+
const index = blockIndexes.get(event.index);
|
|
376
|
+
const block = index === void 0 ? void 0 : blocks[index];
|
|
377
|
+
if (index !== void 0 && block?.type === "thinking") {
|
|
378
|
+
block.thinkingSignature = block.thinkingSignature || "";
|
|
379
|
+
block.thinkingSignature += event.delta.signature;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
} else if (event.type === "content_block_stop") {
|
|
383
|
+
if (compactionCapture.complete(event.index)) continue;
|
|
344
384
|
const index = blockIndexes.get(event.index);
|
|
345
385
|
const block = index === void 0 ? void 0 : blocks[index];
|
|
346
|
-
if (index !== void 0 && block
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
386
|
+
if (index !== void 0 && block) {
|
|
387
|
+
blockIndexes.delete(event.index);
|
|
388
|
+
delete block.index;
|
|
389
|
+
if (block.type === "text") eventSink.push({
|
|
390
|
+
type: "text_end",
|
|
350
391
|
contentIndex: index,
|
|
351
|
-
|
|
392
|
+
content: block.text,
|
|
352
393
|
partial: output
|
|
353
394
|
});
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const index = blockIndexes.get(event.index);
|
|
357
|
-
const block = index === void 0 ? void 0 : blocks[index];
|
|
358
|
-
if (index !== void 0 && block?.type === "toolCall") {
|
|
359
|
-
block.partialJson = (block.partialJson ?? "") + event.delta.partial_json;
|
|
360
|
-
if (toolArgumentPreviewSchedules.get(block)?.(block.partialJson.length)) block.arguments = parseStreamingJson(block.partialJson);
|
|
361
|
-
eventSink.push({
|
|
362
|
-
type: "toolcall_delta",
|
|
395
|
+
else if (block.type === "thinking") eventSink.push({
|
|
396
|
+
type: "thinking_end",
|
|
363
397
|
contentIndex: index,
|
|
364
|
-
|
|
398
|
+
content: block.thinking,
|
|
365
399
|
partial: output
|
|
366
400
|
});
|
|
401
|
+
else if (block.type === "toolCall") sealedToolCalls.push({
|
|
402
|
+
block,
|
|
403
|
+
contentIndex: index
|
|
404
|
+
});
|
|
367
405
|
}
|
|
368
|
-
} else if (event.
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
block.thinkingSignature = block.thinkingSignature || "";
|
|
373
|
-
block.thinkingSignature += event.delta.signature;
|
|
406
|
+
} else if (event.type === "message_delta") {
|
|
407
|
+
if (event.delta.stop_reason) {
|
|
408
|
+
if (event.delta.stop_reason === "refusal") applyAnthropicRefusal(output, event.delta.stop_details, model.provider);
|
|
409
|
+
else output.stopReason = mapAnthropicStopReason(event.delta.stop_reason);
|
|
374
410
|
}
|
|
411
|
+
if (event.usage) applyAnthropicMessageDeltaUsage(output.usage, event.usage, messageStartPromptUsage);
|
|
412
|
+
calculateCost(costModel, output.usage);
|
|
375
413
|
}
|
|
376
|
-
} else if (event.type === "content_block_stop") {
|
|
377
|
-
if (compactionCapture.complete(event.index)) continue;
|
|
378
|
-
const index = blockIndexes.get(event.index);
|
|
379
|
-
const block = index === void 0 ? void 0 : blocks[index];
|
|
380
|
-
if (index !== void 0 && block) {
|
|
381
|
-
blockIndexes.delete(event.index);
|
|
382
|
-
delete block.index;
|
|
383
|
-
if (block.type === "text") eventSink.push({
|
|
384
|
-
type: "text_end",
|
|
385
|
-
contentIndex: index,
|
|
386
|
-
content: block.text,
|
|
387
|
-
partial: output
|
|
388
|
-
});
|
|
389
|
-
else if (block.type === "thinking") eventSink.push({
|
|
390
|
-
type: "thinking_end",
|
|
391
|
-
contentIndex: index,
|
|
392
|
-
content: block.thinking,
|
|
393
|
-
partial: output
|
|
394
|
-
});
|
|
395
|
-
else if (block.type === "toolCall") sealedToolCalls.push({
|
|
396
|
-
block,
|
|
397
|
-
contentIndex: index
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
} else if (event.type === "message_delta") {
|
|
401
|
-
if (event.delta.stop_reason) if (event.delta.stop_reason === "refusal") applyAnthropicRefusal(output, event.delta.stop_details, model.provider);
|
|
402
|
-
else output.stopReason = mapAnthropicStopReason(event.delta.stop_reason);
|
|
403
|
-
if (event.usage) applyAnthropicMessageDeltaUsage(output.usage, event.usage, messageStartPromptUsage);
|
|
404
|
-
calculateCost(costModel, output.usage);
|
|
405
414
|
}
|
|
406
415
|
if (requestOptions?.signal?.aborted) throw transportAbortError(requestOptions.signal);
|
|
407
416
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
@@ -442,6 +451,8 @@ const streamAnthropic = (model, context, options) => {
|
|
|
442
451
|
error: output
|
|
443
452
|
});
|
|
444
453
|
stream.end();
|
|
454
|
+
} finally {
|
|
455
|
+
logAnthropicThinkingDrops(inputTransformations);
|
|
445
456
|
}
|
|
446
457
|
})();
|
|
447
458
|
return stream;
|
|
@@ -602,21 +613,23 @@ function createClient(model, apiKey, thinkingEnabled, interleavedThinking, useFi
|
|
|
602
613
|
const serverSideFallback = supportsAnthropicServerSideFallback(model);
|
|
603
614
|
if (serverSideFallback) betaFeatures.push(ANTHROPIC_SERVER_SIDE_FALLBACK_BETA);
|
|
604
615
|
const sessionAffinityHeaders = sessionId && getAnthropicCompat(model).sendSessionAffinityHeaders ? { "x-session-affinity": sessionId } : {};
|
|
616
|
+
const defaultHeaders = mergeHeaders({
|
|
617
|
+
accept: "application/json",
|
|
618
|
+
"anthropic-dangerous-direct-browser-access": "true",
|
|
619
|
+
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
620
|
+
}, sessionAffinityHeaders, model.headers, optionsHeaders);
|
|
605
621
|
return {
|
|
606
622
|
client: new Anthropic({
|
|
607
623
|
apiKey,
|
|
608
624
|
authToken: null,
|
|
609
625
|
baseURL: model.baseUrl,
|
|
610
626
|
dangerouslyAllowBrowser: true,
|
|
611
|
-
defaultHeaders
|
|
612
|
-
accept: "application/json",
|
|
613
|
-
"anthropic-dangerous-direct-browser-access": "true",
|
|
614
|
-
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
615
|
-
}, sessionAffinityHeaders, model.headers, optionsHeaders),
|
|
627
|
+
defaultHeaders,
|
|
616
628
|
fetch
|
|
617
629
|
}),
|
|
618
630
|
isOAuthToken: false,
|
|
619
|
-
serverSideFallback
|
|
631
|
+
serverSideFallback,
|
|
632
|
+
directApiKeyBetaHeader: model.provider === "anthropic" && isAnthropicPublicEndpoint(model.baseUrl ?? process.env.ANTHROPIC_BASE_URL) ? Object.entries(defaultHeaders).findLast(([name]) => name.toLowerCase() === "anthropic-beta")?.[1] ?? "" : void 0
|
|
620
633
|
};
|
|
621
634
|
}
|
|
622
635
|
async function buildParams(model, context, isOAuthTokenResult, options, serverSideFallback = false) {
|
|
@@ -681,18 +694,17 @@ async function buildParams(model, context, isOAuthTokenResult, options, serverSi
|
|
|
681
694
|
}
|
|
682
695
|
async function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messageCacheControlLimit = 4, replayThinkingEnabled = true, allowEmptySignature = false, compaction) {
|
|
683
696
|
const params = [];
|
|
697
|
+
const cacheBreakpointOptOutMessageIndexes = /* @__PURE__ */ new Set();
|
|
684
698
|
const imageBudget = createAnthropicInlineImageBudget();
|
|
685
|
-
const cacheBreakpointOptOutParamIndexes = /* @__PURE__ */ new Set();
|
|
686
699
|
const transformedMessages = transformProviderMessages(messages, model, normalizeAnthropicToolCallId);
|
|
687
700
|
const activeToolTurnAssistantIndex = replayThinkingEnabled ? -1 : findActiveAnthropicToolTurnAssistantIndex(transformedMessages);
|
|
688
701
|
for (let i = 0; i < transformedMessages.length; i++) {
|
|
689
702
|
const msg = transformedMessages[i];
|
|
690
703
|
if (!msg) continue;
|
|
691
704
|
if (msg.role === "user") {
|
|
692
|
-
const isRuntimeContextCarrier = msg.runtimeContextCarrier === true;
|
|
693
705
|
if (typeof msg.content === "string") {
|
|
694
706
|
if (msg.content.trim().length > 0) {
|
|
695
|
-
if (
|
|
707
|
+
if (msg.runtimeContextCarrier && !msg.runtimeContextCarrierRetained) cacheBreakpointOptOutMessageIndexes.add(params.length);
|
|
696
708
|
params.push({
|
|
697
709
|
role: "user",
|
|
698
710
|
content: sanitizeSurrogates(msg.content)
|
|
@@ -717,7 +729,7 @@ async function convertMessages(messages, model, isOAuthTokenValue, cacheControl,
|
|
|
717
729
|
return true;
|
|
718
730
|
});
|
|
719
731
|
if (filteredBlocks.length === 0) continue;
|
|
720
|
-
if (
|
|
732
|
+
if (msg.runtimeContextCarrier && !msg.runtimeContextCarrierRetained) cacheBreakpointOptOutMessageIndexes.add(params.length);
|
|
721
733
|
params.push({
|
|
722
734
|
role: "user",
|
|
723
735
|
content: filteredBlocks
|
|
@@ -802,7 +814,7 @@ async function convertMessages(messages, model, isOAuthTokenValue, cacheControl,
|
|
|
802
814
|
});
|
|
803
815
|
}
|
|
804
816
|
}
|
|
805
|
-
if (cacheControl) applyAnthropicCacheControlToMessages(params, cacheControl, messageCacheControlLimit,
|
|
817
|
+
if (cacheControl) applyAnthropicCacheControlToMessages(params, cacheControl, messageCacheControlLimit, cacheBreakpointOptOutMessageIndexes);
|
|
806
818
|
return params;
|
|
807
819
|
}
|
|
808
820
|
function buildAnthropicSystemBlocks(systemPrompt, isOAuthTokenResult, cacheControl) {
|
package/dist/{anthropic-compaction-replay-CY4tkD4V.mjs → anthropic-compaction-replay-B6sEzXhr.mjs}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as resolveClaudeModelIdentity, h as resolveClaudeOpus5ModelIdentity, u as resolveClaudeFable5ModelIdentity } from "./src-BhgSqnbz.mjs";
|
|
2
2
|
import { l as normalizeNullableString, o as isRecord, u as normalizeOptionalLowercaseString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
3
|
+
import { n as getAiTransportHost } from "./host-DhlhmyR6.mjs";
|
|
4
4
|
import { a as asNonNegativeFiniteNumber, n as estimateBase64DecodedBytes } from "./base64-CEFBpSkN.mjs";
|
|
5
5
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
6
|
-
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, u as splitSystemPromptCacheBoundary } from "./simple-options-
|
|
7
|
-
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
8
|
-
import { s as parsePositiveInteger } from "./transport-utils-
|
|
6
|
+
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, u as splitSystemPromptCacheBoundary } from "./simple-options-Bwi0x0bX.mjs";
|
|
7
|
+
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-_gcOC21Y.mjs";
|
|
8
|
+
import { s as parsePositiveInteger } from "./transport-utils-DdLjoPMb.mjs";
|
|
9
9
|
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
10
10
|
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
11
11
|
/** Inspect resolved credential shape for auth routing without exposing its value. */
|
|
@@ -240,7 +240,7 @@ const ANTHROPIC_IMAGE_MEDIA_TYPE_SET = /* @__PURE__ */ new Set([
|
|
|
240
240
|
"image/gif",
|
|
241
241
|
"image/webp"
|
|
242
242
|
]);
|
|
243
|
-
const ANTHROPIC_INLINE_IMAGES_DECODE_SAFETY_BYTES =
|
|
243
|
+
const ANTHROPIC_INLINE_IMAGES_DECODE_SAFETY_BYTES = 67108864;
|
|
244
244
|
function createAnthropicInlineImageBudget() {
|
|
245
245
|
return { totalBytes: 0 };
|
|
246
246
|
}
|
|
@@ -366,6 +366,23 @@ function applyAnthropicFallbackBoundary(params) {
|
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region packages/ai/src/providers/anthropic-thinking-replay.ts
|
|
368
368
|
const ANTHROPIC_OMITTED_REASONING_TEXT = "[assistant reasoning omitted]";
|
|
369
|
+
function applyAnthropicThinkingBindingControls(params, directApiKeyBetaHeader) {
|
|
370
|
+
if (directApiKeyBetaHeader === void 0 || !isRecord(params.thinking) || params.thinking.type !== "adaptive") return;
|
|
371
|
+
params.thinking.block_binding = { prefix_mismatch_behavior: "drop_block" };
|
|
372
|
+
const betas = directApiKeyBetaHeader.split(",").map((beta) => beta.trim()).filter(Boolean);
|
|
373
|
+
return { "anthropic-beta": [.../* @__PURE__ */ new Set([...betas, "thinking-binding-controls-2026-08-01"])].join(",") };
|
|
374
|
+
}
|
|
375
|
+
function readAnthropicInputTransformations(event) {
|
|
376
|
+
if (!isRecord(event) || event.type !== "message_start" && event.type !== "message_delta") return;
|
|
377
|
+
const transformations = (isRecord(event.message) ? event.message : void 0)?.input_transformations ?? event.input_transformations;
|
|
378
|
+
return Array.isArray(transformations) ? transformations : void 0;
|
|
379
|
+
}
|
|
380
|
+
function logAnthropicThinkingDrops(transformations) {
|
|
381
|
+
const drops = transformations?.filter((entry) => isRecord(entry) && entry.type === "thinking_dropped" && typeof entry.reason === "string" && /^(?:prefix|model|organization|end_user)_binding_mismatch$/.test(entry.reason) && typeof entry.path === "string" && /^messages\.\d{1,10}\.content\.\d{1,10}$/.test(entry.path));
|
|
382
|
+
if (!drops?.length) return;
|
|
383
|
+
const paths = drops.slice(0, 5).map(({ reason, path }) => `${reason} at ${path}`);
|
|
384
|
+
getAiTransportHost().logWarn("anthropic", `replayed thinking dropped: ${drops.length} block(s) (${paths.join(", ")}${drops.length > 5 ? ", …" : ""})`);
|
|
385
|
+
}
|
|
369
386
|
function asReplayMessage(value) {
|
|
370
387
|
return value && typeof value === "object" ? value : void 0;
|
|
371
388
|
}
|
|
@@ -835,4 +852,4 @@ function isAnthropicReplayRejection(error) {
|
|
|
835
852
|
return (record.status === 400 || text.startsWith("http 400:")) && (text.includes("compaction") || text.includes("context_management"));
|
|
836
853
|
}
|
|
837
854
|
//#endregion
|
|
838
|
-
export {
|
|
855
|
+
export { createAnthropicInlineImageBudget as A, omitFoundryBearerCredentialHeaders as B, ANTHROPIC_SERVER_SIDE_FALLBACKS as C, readAnthropicFallbackBoundary as D, applyAnthropicFallbackBoundary as E, applyAnthropicPayloadPolicyToParams as F, resolveAnthropicEphemeralCacheControl as I, resolveAnthropicPayloadPolicy as L, resolveAnthropicImageMediaType as M, applyAnthropicCacheControlToMessages as N, resolveAnthropicFallbackServingModelCost as O, applyAnthropicEphemeralCacheControlMarkers as P, resolveAnthropicServerCompactionPlan as R, readAnthropicInputTransformations as S, CLAUDE_OPUS_FALLBACK_MODEL_COST as T, usesFoundryBearerAuth as V, toClaudeCodeToolName as _, suppressAnthropicCompaction as a, findActiveAnthropicToolTurnAssistantIndex as b, readAnthropicCacheWriteUsage as c, readLastAnthropicIterationUsage as d, normalizeAnthropicToolCallId as f, resolveOriginalAnthropicToolName as g, reconcileAnthropicToolChoice as h, resolveNewestAnthropicCompaction as i, normalizeAnthropicInlineContent as j, applyAnthropicRefusal as k, readAnthropicPromptUsageSnapshot as l, projectAnthropicTools as m, createCompactionCapture as n, applyAnthropicMessageDeltaUsage as o, normalizeAnthropicToolChoice as p, isAnthropicReplayRejection as r, applyAnthropicMessageStartUsage as s, buildAnthropicReplayPlan as t, readAnthropicUsageTokenCount as u, ANTHROPIC_OMITTED_REASONING_TEXT as v, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA as w, logAnthropicThinkingDrops as x, applyAnthropicThinkingBindingControls as y, isAnthropicOAuthApiKey as z };
|
package/dist/{anthropic-payload-policy-i_5_inWe.d.mts → anthropic-payload-policy-kkq8L7tJ.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { D as Model } from "./types-
|
|
1
|
+
import "./index-DcGDVDnC.mjs";
|
|
2
|
+
import { D as Model } from "./types-DmeScJQe.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/anthropic-payload-policy.d.ts
|
|
4
4
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
5
5
|
type AnthropicServiceTier = "auto" | "standard_only";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { D as Model,
|
|
1
|
+
import "./index-DcGDVDnC.mjs";
|
|
2
|
+
import { D as Model, J as StreamOptions, W as SimpleStreamOptions, d as Context, n as Api, q as StreamFunction, s as AssistantMessageEventStreamContract } from "./types-DmeScJQe.mjs";
|
|
3
3
|
//#region packages/ai/src/api-registry.d.ts
|
|
4
4
|
/** Runtime stream adapter signature stored in the API provider registry. */
|
|
5
5
|
type ApiStreamFunction = (model: Model, context: Context, options?: StreamOptions) => AssistantMessageEventStreamContract;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import { n as getAiTransportHost } from "./host-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
2
|
+
import { n as getAiTransportHost } from "./host-DhlhmyR6.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-CGnVB74a.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-Bwi0x0bX.mjs";
|
|
5
5
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
6
|
-
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
6
|
+
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-CZTRmOFP.mjs";
|
|
7
7
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
8
8
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
9
9
|
//#region packages/ai/src/providers/azure-openai-responses.ts
|
|
@@ -25,10 +25,11 @@ function resolveDeploymentName(model, options) {
|
|
|
25
25
|
*/
|
|
26
26
|
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
27
27
|
const stream = new AssistantMessageEventStream();
|
|
28
|
+
const output = createResponsesAssistantOutput(model, "azure-openai-responses");
|
|
28
29
|
runResponsesStreamLifecycle({
|
|
29
30
|
stream,
|
|
30
31
|
model,
|
|
31
|
-
output
|
|
32
|
+
output,
|
|
32
33
|
options,
|
|
33
34
|
resolveRequestModel: (requestModel) => {
|
|
34
35
|
const { baseUrl } = resolveAzureConfig(requestModel, options);
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
2
|
-
import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
2
|
+
import { r as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-BI8kIViN.mjs";
|
|
3
3
|
export { appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue, projectDiagnosticValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-DcQzYRWO.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-
|
|
1
|
+
import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-DmeScJQe.mjs";
|
|
2
2
|
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
3
3
|
/** Generic async-iterable event stream with a separately awaited final result. */
|
|
4
4
|
declare class EventStream<T, R = T> implements AsyncIterable<T> {
|
package/dist/event-stream.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import "./event-stream-
|
|
1
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DcQzYRWO.mjs";
|
|
2
|
+
import "./event-stream-CDHaMazK.mjs";
|
|
3
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|