@openclaw/ai 2026.8.2 → 2026.8.34
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-DTGZ4VMY.mjs → anthropic-Dhl0np0g.mjs} +196 -186
- package/dist/{anthropic-compaction-replay-CKCDrZJv.mjs → anthropic-compaction-replay-DKGjPxYr.mjs} +26 -9
- package/dist/{anthropic-payload-policy-BTzmNC14.d.mts → anthropic-payload-policy-kkq8L7tJ.d.mts} +2 -2
- package/dist/{api-registry-BbUHEKER.d.mts → api-registry-CAK4bNkq.d.mts} +2 -2
- package/dist/{azure-openai-responses-BmqaDXM1.mjs → azure-openai-responses-CPvqFff1.mjs} +4 -4
- package/dist/event-stream-CDHaMazK.d.mts +1 -0
- package/dist/{event-stream-DcvAPSBe.d.mts → event-stream-DcQzYRWO.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-CqjVZMwo.mjs → google-B6pXyWB0.mjs} +3 -3
- package/dist/{google-shared-Bnqni5j3.mjs → google-shared-C_3CT37v.mjs} +5 -5
- package/dist/{google-vertex-D_WREEJi.mjs → google-vertex-BA2c1toq.mjs} +3 -3
- package/dist/{host-DKFUAmCn.d.mts → host-DL2Zd9ep.d.mts} +3 -3
- package/dist/{host-BIaiBURL.mjs → host-DhlhmyR6.mjs} +17 -2
- package/dist/{index-CefaUGSS.d.mts → index-DcGDVDnC.d.mts} +12 -5
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +3 -3
- package/dist/internal/anthropic.d.mts +13 -8
- 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 +2 -2
- package/dist/internal/shared.d.mts +2 -2
- package/dist/internal/shared.mjs +3 -3
- package/dist/{mistral-C24jVd6f.mjs → mistral-CTcM9TGz.mjs} +5 -5
- package/dist/{openai-chatgpt-responses-Czum0oXz.mjs → openai-chatgpt-responses-QqHf1o9v.mjs} +9 -9
- package/dist/{openai-completions-BfFwac6f.mjs → openai-completions-BCmKwgsc.mjs} +7 -7
- package/dist/{openai-completions-compat-SZhi0Lf4.d.mts → openai-completions-compat-BJE92duO.d.mts} +3 -3
- package/dist/{openai-completions-stream-DGOvau4J.mjs → openai-completions-stream-0mm4YUag.mjs} +9 -9
- 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-DO7yV7az.mjs → openai-responses-compaction-window-vuCaZYLS.mjs} +2 -2
- package/dist/{openai-responses-contracts-BthRXano.d.mts → openai-responses-contracts-DFJOyjd1.d.mts} +6 -3
- package/dist/{openai-responses-BAryVEJM.mjs → openai-responses-pMJVxhHW.mjs} +7 -10
- package/dist/{openai-responses-prompt-observer-internal--R0kZLOZ.mjs → openai-responses-prompt-observer-internal-COaImuDp.mjs} +3 -3
- package/dist/{openai-responses-shared-CxgdGBvm.mjs → openai-responses-shared-CZTRmOFP.mjs} +9 -9
- package/dist/{openai-tool-schema-CSMh5e9O.mjs → openai-tool-schema-DjS9-DHe.mjs} +5 -5
- package/dist/{provider-options-DJd_9euj.d.mts → provider-options-CedgbINH.d.mts} +2 -2
- package/dist/{provider-transcript-transform-WvJmFUAf.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 +9 -9
- package/dist/{sanitize-unicode-S6binQG-.mjs → sanitize-unicode-Cfcaqa9V.mjs} +1 -1
- package/dist/{simple-options-rdOPzr7Z.mjs → simple-options-Bwi0x0bX.mjs} +2 -2
- package/dist/{src-C8U7lkoa.mjs → src-BhgSqnbz.mjs} +14 -1
- package/dist/{tool-schema-json-projection-BtZiml7r.mjs → tool-schema-json-projection-_gcOC21Y.mjs} +1 -1
- package/dist/{transport-stream-shared-BbG7PThh.d.mts → transport-stream-shared-B38NWYTa.d.mts} +4 -4
- package/dist/{transport-stream-shared-D8nQWCUo.mjs → transport-stream-shared-y1YR1k5K.mjs} +1 -1
- package/dist/{transport-utils-CtuS1Upe.mjs → transport-utils-DdLjoPMb.mjs} +1 -1
- package/dist/transports.d.mts +9 -9
- package/dist/transports.mjs +43 -36
- package/dist/types-DmdQ-xcq.d.mts +1 -0
- package/dist/{types-Beemor2E.d.mts → types-DmeScJQe.d.mts} +5 -6
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +2 -2
- package/dist/{validation-CC6s7Smp.d.mts → validation-DPDgbaD3.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +1 -1
- package/dist/event-stream-pXT3FI6X.d.mts +0 -1
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/types-COdhCX0U.d.mts +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { g as
|
|
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-
|
|
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
7
|
import { n as projectProviderError } from "./provider-error-BI8kIViN.mjs";
|
|
8
|
-
import { A as
|
|
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-DKGjPxYr.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,201 +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
|
+
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) {
|
|
402
|
-
if (event.delta.stop_reason === "refusal") applyAnthropicRefusal(output, event.delta.stop_details, model.provider);
|
|
403
|
-
else output.stopReason = mapAnthropicStopReason(event.delta.stop_reason);
|
|
404
|
-
}
|
|
405
|
-
if (event.usage) applyAnthropicMessageDeltaUsage(output.usage, event.usage, messageStartPromptUsage);
|
|
406
|
-
calculateCost(costModel, output.usage);
|
|
407
414
|
}
|
|
408
415
|
if (requestOptions?.signal?.aborted) throw transportAbortError(requestOptions.signal);
|
|
409
416
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
@@ -444,6 +451,8 @@ const streamAnthropic = (model, context, options) => {
|
|
|
444
451
|
error: output
|
|
445
452
|
});
|
|
446
453
|
stream.end();
|
|
454
|
+
} finally {
|
|
455
|
+
logAnthropicThinkingDrops(inputTransformations);
|
|
447
456
|
}
|
|
448
457
|
})();
|
|
449
458
|
return stream;
|
|
@@ -604,21 +613,23 @@ function createClient(model, apiKey, thinkingEnabled, interleavedThinking, useFi
|
|
|
604
613
|
const serverSideFallback = supportsAnthropicServerSideFallback(model);
|
|
605
614
|
if (serverSideFallback) betaFeatures.push(ANTHROPIC_SERVER_SIDE_FALLBACK_BETA);
|
|
606
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);
|
|
607
621
|
return {
|
|
608
622
|
client: new Anthropic({
|
|
609
623
|
apiKey,
|
|
610
624
|
authToken: null,
|
|
611
625
|
baseURL: model.baseUrl,
|
|
612
626
|
dangerouslyAllowBrowser: true,
|
|
613
|
-
defaultHeaders
|
|
614
|
-
accept: "application/json",
|
|
615
|
-
"anthropic-dangerous-direct-browser-access": "true",
|
|
616
|
-
...betaFeatures.length > 0 ? { "anthropic-beta": betaFeatures.join(",") } : {}
|
|
617
|
-
}, sessionAffinityHeaders, model.headers, optionsHeaders),
|
|
627
|
+
defaultHeaders,
|
|
618
628
|
fetch
|
|
619
629
|
}),
|
|
620
630
|
isOAuthToken: false,
|
|
621
|
-
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
|
|
622
633
|
};
|
|
623
634
|
}
|
|
624
635
|
async function buildParams(model, context, isOAuthTokenResult, options, serverSideFallback = false) {
|
|
@@ -683,18 +694,17 @@ async function buildParams(model, context, isOAuthTokenResult, options, serverSi
|
|
|
683
694
|
}
|
|
684
695
|
async function convertMessages(messages, model, isOAuthTokenValue, cacheControl, messageCacheControlLimit = 4, replayThinkingEnabled = true, allowEmptySignature = false, compaction) {
|
|
685
696
|
const params = [];
|
|
697
|
+
const cacheBreakpointOptOutMessageIndexes = /* @__PURE__ */ new Set();
|
|
686
698
|
const imageBudget = createAnthropicInlineImageBudget();
|
|
687
|
-
const cacheBreakpointOptOutParamIndexes = /* @__PURE__ */ new Set();
|
|
688
699
|
const transformedMessages = transformProviderMessages(messages, model, normalizeAnthropicToolCallId);
|
|
689
700
|
const activeToolTurnAssistantIndex = replayThinkingEnabled ? -1 : findActiveAnthropicToolTurnAssistantIndex(transformedMessages);
|
|
690
701
|
for (let i = 0; i < transformedMessages.length; i++) {
|
|
691
702
|
const msg = transformedMessages[i];
|
|
692
703
|
if (!msg) continue;
|
|
693
704
|
if (msg.role === "user") {
|
|
694
|
-
const isRuntimeContextCarrier = msg.runtimeContextCarrier === true;
|
|
695
705
|
if (typeof msg.content === "string") {
|
|
696
706
|
if (msg.content.trim().length > 0) {
|
|
697
|
-
if (
|
|
707
|
+
if (msg.runtimeContextCarrier && !msg.runtimeContextCarrierRetained) cacheBreakpointOptOutMessageIndexes.add(params.length);
|
|
698
708
|
params.push({
|
|
699
709
|
role: "user",
|
|
700
710
|
content: sanitizeSurrogates(msg.content)
|
|
@@ -719,7 +729,7 @@ async function convertMessages(messages, model, isOAuthTokenValue, cacheControl,
|
|
|
719
729
|
return true;
|
|
720
730
|
});
|
|
721
731
|
if (filteredBlocks.length === 0) continue;
|
|
722
|
-
if (
|
|
732
|
+
if (msg.runtimeContextCarrier && !msg.runtimeContextCarrierRetained) cacheBreakpointOptOutMessageIndexes.add(params.length);
|
|
723
733
|
params.push({
|
|
724
734
|
role: "user",
|
|
725
735
|
content: filteredBlocks
|
|
@@ -804,7 +814,7 @@ async function convertMessages(messages, model, isOAuthTokenValue, cacheControl,
|
|
|
804
814
|
});
|
|
805
815
|
}
|
|
806
816
|
}
|
|
807
|
-
if (cacheControl) applyAnthropicCacheControlToMessages(params, cacheControl, messageCacheControlLimit,
|
|
817
|
+
if (cacheControl) applyAnthropicCacheControlToMessages(params, cacheControl, messageCacheControlLimit, cacheBreakpointOptOutMessageIndexes);
|
|
808
818
|
return params;
|
|
809
819
|
}
|
|
810
820
|
function buildAnthropicSystemBlocks(systemPrompt, isOAuthTokenResult, cacheControl) {
|
package/dist/{anthropic-compaction-replay-CKCDrZJv.mjs → anthropic-compaction-replay-DKGjPxYr.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. */
|
|
@@ -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
|
}
|
|
@@ -668,9 +685,9 @@ function applyAnthropicMessageStartUsage(target, payload) {
|
|
|
668
685
|
};
|
|
669
686
|
return promptTokens > 0 ? promptUsage : void 0;
|
|
670
687
|
}
|
|
671
|
-
/** Keep
|
|
672
|
-
function applyAnthropicMessageDeltaUsage(target,
|
|
673
|
-
|
|
688
|
+
/** Keep billing and context distinct; omitted usage preserves the last snapshot. */
|
|
689
|
+
function applyAnthropicMessageDeltaUsage(target, usage, messageStartPromptUsage) {
|
|
690
|
+
if (!usage) return;
|
|
674
691
|
const billedIterations = readAnthropicCompactionBilledUsage(usage.iterations);
|
|
675
692
|
const inputTokens = readAnthropicUsageTokenCount(usage.input_tokens);
|
|
676
693
|
const outputTokens = readAnthropicUsageTokenCount(usage.output_tokens);
|
|
@@ -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-BTzmNC14.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, J as StreamOptions, W as SimpleStreamOptions, d as Context, n as Api, q as StreamFunction, s as AssistantMessageEventStreamContract } from "./types-
|
|
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
|
|
@@ -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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
2
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
3
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
2
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DhlhmyR6.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-Bwi0x0bX.mjs";
|
|
4
4
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
5
|
-
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
5
|
+
import { i as runGoogleGenerateContentLifecycle, n as buildGoogleSimpleThinking, r as createGoogleAssistantOutput, t as buildGoogleGenerateContentParams } from "./google-shared-C_3CT37v.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google.ts
|
|
8
8
|
let toolCallCounter = 0;
|