@openclaw/ai 2026.8.1-beta.2 → 2026.8.1
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-B6dLpq5L.mjs → anthropic-Djj7L1rx.mjs} +49 -39
- package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-CY4tkD4V.mjs} +42 -44
- package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-i_5_inWe.d.mts} +4 -2
- package/dist/{api-registry-k3zTz0cV.d.mts → api-registry-C9-wZd_W.d.mts} +2 -1
- package/dist/{azure-openai-responses-mxIOtUnn.mjs → azure-openai-responses-Bj3czHNa.mjs} +4 -4
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/diagnostics.d.mts +2 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/event-stream-C988TSLe.d.mts +1 -0
- package/dist/{event-stream-BP6AWT8j.d.mts → event-stream-UhnxHuqt.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-C7h2QzDX.mjs → google-0Ca6TYbw.mjs} +4 -4
- package/dist/{google-shared-B0Qr9OR7.mjs → google-shared-DVfL9COU.mjs} +22 -8
- package/dist/{google-vertex-Bhc3TjDl.mjs → google-vertex-5dAMxprN.mjs} +4 -4
- package/dist/{host-DTqNc7ad.mjs → host-D51fmkH6.mjs} +40 -33
- package/dist/{host-vWgMMhiJ.d.mts → host-DoPJJ1KD.d.mts} +7 -7
- package/dist/index-N3zr6__t.d.mts +105 -0
- package/dist/index.d.mts +9 -10
- package/dist/index.mjs +2 -3
- package/dist/internal/anthropic.d.mts +57 -49
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +65 -63
- package/dist/internal/openai.mjs +10 -8
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +53 -40
- package/dist/internal/runtime.mjs +10 -9
- package/dist/internal/shared.d.mts +37 -23
- package/dist/internal/shared.mjs +4 -4
- package/dist/{json-parse-CDnesDM_.mjs → json-parse-BuAJEbdW.mjs} +18 -2
- package/dist/{headers-DdOQtGuU.mjs → llm-request-activity-BjtkplhG.mjs} +1 -9
- package/dist/{mistral-CEWoQI_g.mjs → mistral-BCnrI-kV.mjs} +64 -53
- package/dist/{openai-chatgpt-responses-CrPmqERt.mjs → openai-chatgpt-responses-CGBGWSqr.mjs} +45 -20
- package/dist/{openai-completions-BPnt4Sml.mjs → openai-completions-BaTuwID7.mjs} +63 -258
- package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-DB7FFq7k.d.mts} +3 -3
- package/dist/openai-completions-stream-Bpns6uNc.mjs +1622 -0
- package/dist/{openai-responses-DhIKtOup.mjs → openai-responses-1GBcQujk.mjs} +8 -6
- package/dist/openai-responses-compaction-window-DwydGZI8.mjs +686 -0
- package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-DgaR3t5T.d.mts} +14 -5
- package/dist/{openai-responses-payload-policy-BSs371VM.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +2 -0
- package/dist/{openai-responses-prompt-observer-internal-DgNTYnRY.mjs → openai-responses-prompt-observer-internal-_nhGTn2b.mjs} +3 -3
- package/dist/{openai-responses-shared-DXIt3iY5.mjs → openai-responses-shared-zPmKnhF5.mjs} +345 -1553
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-Dgl4H2MU.mjs +1695 -0
- package/dist/{provider-error-BUwEnjXq.mjs → provider-error-jZP5NMTZ.mjs} +3 -82
- package/dist/{provider-options-B96RdNpH.d.mts → provider-options-HvA_slFa.d.mts} +23 -4
- package/dist/provider-transcript-transform-C01bQ5a3.mjs +32 -0
- package/dist/provider-types.d.mts +18 -17
- package/dist/providers.d.mts +5 -6
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-rnPwX2pg.mjs → reasoning-tag-text-partitioner-CwzKb0bA.mjs} +4 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-BYqrYtC_.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/{simple-options-D58D5Kvw.mjs → simple-options-DKx86yX9.mjs} +42 -4
- package/dist/{anthropic-JsNA5KCu.mjs → src-Bu3FiFAG.mjs} +1 -1
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{streaming-byte-guard-BrbkbwUu.mjs → streaming-byte-guard-CC-HMn_u.mjs} +5 -6
- package/dist/string-normalization--fwJ4S2q.mjs +16 -0
- package/dist/{tool-schema-json-projection-q5d7QX5c.mjs → tool-schema-json-projection-qvTEs5Am.mjs} +17 -8
- package/dist/transport-stream-shared-CT5ycdzn.mjs +342 -0
- package/dist/transport-stream-shared-NjwWNaRY.d.mts +138 -0
- package/dist/{transport-utils-DJqkxbhC.mjs → transport-utils-BHx9z8Cl.mjs} +9 -9
- package/dist/transports.d.mts +140 -169
- package/dist/transports.mjs +269 -1262
- package/dist/types-DtGu2d3C.d.mts +1 -0
- package/dist/{types-BHNrPS1l.d.mts → types-h38Azne1.d.mts} +53 -17
- package/dist/types.d.mts +6 -5
- package/dist/types.mjs +1 -2
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DT9SrFn3.d.mts → validation-C68lP2uy.d.mts} +1 -2
- package/dist/validation.d.mts +1 -1
- package/package.json +6 -6
- package/dist/anthropic-SrGtwsJu.d.mts +0 -100
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/openai-responses-contracts-CyfIkQi5.mjs +0 -253
- package/dist/openai-responses-payload-policy-BDxV-W0c.mjs +0 -206
- package/dist/openai-stop-reason-BkFkqqK0.mjs +0 -563
- package/dist/openai-tool-projection-CY04OcvQ.mjs +0 -338
- package/dist/provider-transcript-transform-ePx-Bbfr.mjs +0 -155
- package/dist/record-coerce-DdXsgUd_.mjs +0 -23
- package/dist/src-D2H6yKkH.mjs +0 -2
- package/dist/stream-first-event-timeout-DvDeSucC.d.mts +0 -29
- package/dist/string-coerce-fsri9iCu.mjs +0 -34
- package/dist/types-BVVgDSdq.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
+
import { d as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeXhighEffort, p as supportsClaudeAdaptiveThinking, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
4
|
+
import { o as isRecord } from "./utf16-slice-qz3nsy87.mjs";
|
|
5
|
+
import { r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-DCkltN94.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-D51fmkH6.mjs";
|
|
7
|
+
import { n as projectProviderError } from "./provider-error-jZP5NMTZ.mjs";
|
|
8
|
+
import { A as applyAnthropicCacheControlToMessages, C as applyAnthropicFallbackBoundary, D as createAnthropicInlineImageBudget, E as applyAnthropicRefusal, I as isAnthropicOAuthApiKey, L as omitFoundryBearerCredentialHeaders, O as normalizeAnthropicInlineContent, R as usesFoundryBearerAuth, T as resolveAnthropicFallbackServingModelCost, _ as toClaudeCodeToolName, a as suppressAnthropicCompaction, b as ANTHROPIC_SERVER_SIDE_FALLBACKS, f as normalizeAnthropicToolCallId, g as resolveOriginalAnthropicToolName, h as reconcileAnthropicToolChoice, k as resolveAnthropicImageMediaType, 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 readAnthropicFallbackBoundary, x as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, y as findActiveAnthropicToolTurnAssistantIndex } from "./anthropic-compaction-replay-CY4tkD4V.mjs";
|
|
7
9
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { d as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, u as splitSystemPromptCacheBoundary } from "./simple-options-DKx86yX9.mjs";
|
|
11
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-BHx9z8Cl.mjs";
|
|
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-CT5ycdzn.mjs";
|
|
10
14
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
11
|
-
import { n as parseStreamingJson, t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-DJqkxbhC.mjs";
|
|
15
|
+
import { n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
16
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
17
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-C01bQ5a3.mjs";
|
|
15
18
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
16
19
|
import Anthropic from "@anthropic-ai/sdk";
|
|
17
20
|
import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
|
|
@@ -108,22 +111,20 @@ const ANTHROPIC_MESSAGE_EVENTS = /* @__PURE__ */ new Set([
|
|
|
108
111
|
]);
|
|
109
112
|
async function* iterateAnthropicEvents(response, requireMessageStop = false) {
|
|
110
113
|
if (!response.body) throw new Error("Attempted to iterate over an Anthropic response with no body");
|
|
111
|
-
let sawMessageStart = false;
|
|
112
114
|
let sawMessageEnd = false;
|
|
113
115
|
for await (const sse of Stream.rawEvents(response)) {
|
|
114
116
|
if (sse.event === "error") throw new Error(sse.data);
|
|
115
117
|
if (!ANTHROPIC_MESSAGE_EVENTS.has(sse.event ?? "")) continue;
|
|
116
118
|
try {
|
|
117
119
|
const event = parseJsonWithRepair(sse.data);
|
|
118
|
-
if (event.type === "
|
|
119
|
-
else if (event.type === "message_stop") sawMessageEnd = true;
|
|
120
|
+
if (event.type === "message_stop") sawMessageEnd = true;
|
|
120
121
|
yield event;
|
|
121
122
|
} catch (error) {
|
|
122
123
|
if (error instanceof SyntaxError) throw new Error(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause: error });
|
|
123
124
|
throw error;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
if (
|
|
127
|
+
if (requireMessageStop && !sawMessageEnd) throw new Error("Anthropic stream ended before message_stop");
|
|
127
128
|
}
|
|
128
129
|
const streamAnthropic = (model, context, options) => {
|
|
129
130
|
const stream = new AssistantMessageEventStream();
|
|
@@ -197,14 +198,18 @@ const streamAnthropic = (model, context, options) => {
|
|
|
197
198
|
...params,
|
|
198
199
|
stream: true
|
|
199
200
|
}, sdkRequestOptions).asResponse();
|
|
200
|
-
await
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
await notifyProviderHttpResponse({
|
|
202
|
+
options: requestOptions,
|
|
203
|
+
response,
|
|
204
|
+
model
|
|
205
|
+
});
|
|
204
206
|
const blocks = output.content;
|
|
205
207
|
const blockIndexes = /* @__PURE__ */ new Map();
|
|
208
|
+
const toolArgumentPreviewSchedules = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
const sealedToolCalls = [];
|
|
206
210
|
const compactionCapture = createCompactionCapture(output, model, requestOptions);
|
|
207
|
-
|
|
211
|
+
const requireMessageStop = refusalBuffer !== void 0 || model.provider === "anthropic" && isAnthropicPublicEndpoint(model.baseUrl);
|
|
212
|
+
for await (const event of iterateAnthropicEvents(response, requireMessageStop)) if (event.type === "message_start") {
|
|
208
213
|
output.responseId = event.message.id;
|
|
209
214
|
output.responseModel = event.message.model;
|
|
210
215
|
messageStartPromptUsage = applyAnthropicMessageStartUsage(output.usage, event.message.usage);
|
|
@@ -214,11 +219,12 @@ const streamAnthropic = (model, context, options) => {
|
|
|
214
219
|
partial: output
|
|
215
220
|
});
|
|
216
221
|
} else if (event.type === "content_block_start") {
|
|
217
|
-
const rawContentBlock = event.content_block;
|
|
222
|
+
const rawContentBlock = isRecord(event.content_block) ? event.content_block : void 0;
|
|
218
223
|
if (requestOptions?.anthropicServerCompaction === true && compactionCapture.begin(event.index, rawContentBlock, output.content.length)) continue;
|
|
219
224
|
const fallbackBoundary = refusalBuffer ? readAnthropicFallbackBoundary(event.content_block) : null;
|
|
220
225
|
if (fallbackBoundary) {
|
|
221
226
|
refusalBuffer?.discard();
|
|
227
|
+
sealedToolCalls.length = 0;
|
|
222
228
|
blockIndexes.clear();
|
|
223
229
|
applyAnthropicFallbackBoundary({
|
|
224
230
|
output,
|
|
@@ -312,6 +318,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
312
318
|
};
|
|
313
319
|
output.content.push(block);
|
|
314
320
|
blockIndexes.set(event.index, output.content.length - 1);
|
|
321
|
+
toolArgumentPreviewSchedules.set(block, createToolArgumentPreviewSchedule());
|
|
315
322
|
eventSink.push({
|
|
316
323
|
type: "toolcall_start",
|
|
317
324
|
contentIndex: output.content.length - 1,
|
|
@@ -319,7 +326,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
319
326
|
});
|
|
320
327
|
}
|
|
321
328
|
} else if (event.type === "content_block_delta") {
|
|
322
|
-
const rawDelta = event.delta;
|
|
329
|
+
const rawDelta = isRecord(event.delta) ? event.delta : void 0;
|
|
323
330
|
if (compactionCapture.delta(event.index, rawDelta)) continue;
|
|
324
331
|
else if (event.delta.type === "text_delta") {
|
|
325
332
|
const index = blockIndexes.get(event.index);
|
|
@@ -349,8 +356,8 @@ const streamAnthropic = (model, context, options) => {
|
|
|
349
356
|
const index = blockIndexes.get(event.index);
|
|
350
357
|
const block = index === void 0 ? void 0 : blocks[index];
|
|
351
358
|
if (index !== void 0 && block?.type === "toolCall") {
|
|
352
|
-
block.partialJson
|
|
353
|
-
block.arguments = parseStreamingJson(block.partialJson);
|
|
359
|
+
block.partialJson = (block.partialJson ?? "") + event.delta.partial_json;
|
|
360
|
+
if (toolArgumentPreviewSchedules.get(block)?.(block.partialJson.length)) block.arguments = parseStreamingJson(block.partialJson);
|
|
354
361
|
eventSink.push({
|
|
355
362
|
type: "toolcall_delta",
|
|
356
363
|
contentIndex: index,
|
|
@@ -385,16 +392,10 @@ const streamAnthropic = (model, context, options) => {
|
|
|
385
392
|
content: block.thinking,
|
|
386
393
|
partial: output
|
|
387
394
|
});
|
|
388
|
-
else if (block.type === "toolCall") {
|
|
389
|
-
block
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
type: "toolcall_end",
|
|
393
|
-
contentIndex: index,
|
|
394
|
-
toolCall: block,
|
|
395
|
-
partial: output
|
|
396
|
-
});
|
|
397
|
-
}
|
|
395
|
+
else if (block.type === "toolCall") sealedToolCalls.push({
|
|
396
|
+
block,
|
|
397
|
+
contentIndex: index
|
|
398
|
+
});
|
|
398
399
|
}
|
|
399
400
|
} else if (event.type === "message_delta") {
|
|
400
401
|
if (event.delta.stop_reason) if (event.delta.stop_reason === "refusal") applyAnthropicRefusal(output, event.delta.stop_details, model.provider);
|
|
@@ -404,6 +405,17 @@ const streamAnthropic = (model, context, options) => {
|
|
|
404
405
|
}
|
|
405
406
|
if (requestOptions?.signal?.aborted) throw transportAbortError(requestOptions.signal);
|
|
406
407
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
408
|
+
if ([...blockIndexes.values()].some((index) => blocks[index]?.type === "toolCall")) throw new Error("Provider completed stream with an incomplete tool call");
|
|
409
|
+
finalizeTerminalToolCallArguments(sealedToolCalls.map(({ block }) => block), (block) => block.partialJson && block.partialJson.length > 0 ? block.partialJson : block.arguments);
|
|
410
|
+
for (const sealed of sealedToolCalls) {
|
|
411
|
+
delete sealed.block.partialJson;
|
|
412
|
+
eventSink.push({
|
|
413
|
+
type: "toolcall_end",
|
|
414
|
+
contentIndex: sealed.contentIndex,
|
|
415
|
+
toolCall: sealed.block,
|
|
416
|
+
partial: output
|
|
417
|
+
});
|
|
418
|
+
}
|
|
407
419
|
refusalBuffer?.flush();
|
|
408
420
|
stream.push({
|
|
409
421
|
type: "done",
|
|
@@ -412,6 +424,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
412
424
|
});
|
|
413
425
|
stream.end();
|
|
414
426
|
} catch (error) {
|
|
427
|
+
output.content = output.content.filter((block) => block.type !== "toolCall");
|
|
415
428
|
for (const block of output.content) {
|
|
416
429
|
delete block.index;
|
|
417
430
|
delete block.partialJson;
|
|
@@ -488,9 +501,6 @@ const streamSimpleAnthropic = (model, context, options) => {
|
|
|
488
501
|
thinkingBudgetTokens: thinkingEnabled ? adjusted.thinkingBudget : void 0
|
|
489
502
|
});
|
|
490
503
|
};
|
|
491
|
-
function isOAuthToken(apiKey) {
|
|
492
|
-
return getAiTransportHost().resolveSecretSentinel(apiKey).includes("sk-ant-oat");
|
|
493
|
-
}
|
|
494
504
|
function isAnthropicPublicEndpoint(baseUrl) {
|
|
495
505
|
if (!baseUrl) return true;
|
|
496
506
|
try {
|
|
@@ -567,7 +577,7 @@ function createClient(model, apiKey, thinkingEnabled, interleavedThinking, useFi
|
|
|
567
577
|
isOAuthToken: false,
|
|
568
578
|
serverSideFallback: false
|
|
569
579
|
};
|
|
570
|
-
if (
|
|
580
|
+
if (isAnthropicOAuthApiKey(apiKey)) return {
|
|
571
581
|
client: new Anthropic({
|
|
572
582
|
apiKey: null,
|
|
573
583
|
authToken: apiKey,
|
|
@@ -646,7 +656,7 @@ async function buildParams(model, context, isOAuthTokenResult, options, serverSi
|
|
|
646
656
|
display
|
|
647
657
|
};
|
|
648
658
|
const effort = options?.effort ?? (mandatoryAdaptiveThinking ? "high" : void 0);
|
|
649
|
-
if (effort) params.output_config =
|
|
659
|
+
if (effort) params.output_config = { effort };
|
|
650
660
|
} else params.thinking = {
|
|
651
661
|
type: "enabled",
|
|
652
662
|
budget_tokens: options?.thinkingBudgetTokens ?? ANTHROPIC_MIN_THINKING_BUDGET_TOKENS,
|
package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-CY4tkD4V.mjs}
RENAMED
|
@@ -1,13 +1,35 @@
|
|
|
1
|
-
import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as estimateBase64DecodedBytes } from "./provider-error-BUwEnjXq.mjs";
|
|
6
|
-
import { r as asNonNegativeFiniteNumber, s as parseStrictPositiveInteger } from "./number-coercion-H9qHik3g.mjs";
|
|
1
|
+
import { o as resolveClaudeFable5ModelIdentity, s as resolveClaudeModelIdentity, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.mjs";
|
|
2
|
+
import { l as normalizeNullableString, o as isRecord, u as normalizeOptionalLowercaseString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
|
+
import { n as getAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
4
|
+
import { a as asNonNegativeFiniteNumber, n as estimateBase64DecodedBytes } from "./base64-CEFBpSkN.mjs";
|
|
7
5
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-
|
|
6
|
+
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, u as splitSystemPromptCacheBoundary } from "./simple-options-DKx86yX9.mjs";
|
|
7
|
+
import { a as resolveProviderEndpoint, o as resolveProviderRequestCapabilities, t as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-qvTEs5Am.mjs";
|
|
8
|
+
import { s as parsePositiveInteger } from "./transport-utils-BHx9z8Cl.mjs";
|
|
10
9
|
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
10
|
+
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
11
|
+
/** Inspect resolved credential shape for auth routing without exposing its value. */
|
|
12
|
+
function isAnthropicOAuthApiKey(apiKey) {
|
|
13
|
+
return typeof apiKey === "string" && getAiTransportHost().resolveSecretSentinel(apiKey).includes("sk-ant-oat");
|
|
14
|
+
}
|
|
15
|
+
function usesFoundryBearerAuth(model) {
|
|
16
|
+
return model.provider === "microsoft-foundry" && (model.authHeader === true || hasBearerAuthorizationHeader(model.headers));
|
|
17
|
+
}
|
|
18
|
+
function hasBearerAuthorizationHeader(headers) {
|
|
19
|
+
if (!headers) return false;
|
|
20
|
+
return Object.entries(headers).some(([key, value]) => key.toLowerCase() === "authorization" && /^bearer\s+\S+/i.test(value.trim()));
|
|
21
|
+
}
|
|
22
|
+
function omitFoundryBearerCredentialHeaders(headers) {
|
|
23
|
+
if (!headers) return;
|
|
24
|
+
const next = {};
|
|
25
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
26
|
+
const lower = key.toLowerCase();
|
|
27
|
+
if (lower === "authorization" || lower === "x-api-key" || lower === "api-key") continue;
|
|
28
|
+
next[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
11
33
|
//#region packages/ai/src/transports/anthropic-payload-policy.ts
|
|
12
34
|
/**
|
|
13
35
|
* Anthropic-family request payload policy helpers.
|
|
@@ -16,10 +38,6 @@ import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
|
16
38
|
*/
|
|
17
39
|
const ANTHROPIC_CACHE_CONTROL_LIMIT = 4;
|
|
18
40
|
const ANTHROPIC_COMPACT_THRESHOLD_MIN = 5e4;
|
|
19
|
-
function parsePositiveInteger(value) {
|
|
20
|
-
if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
|
|
21
|
-
return typeof value === "string" ? parseStrictPositiveInteger(value) : void 0;
|
|
22
|
-
}
|
|
23
41
|
/** Resolve the Anthropic input-token trigger, including the API's minimum. */
|
|
24
42
|
function resolveAnthropicCompactThreshold(contextWindow, configured) {
|
|
25
43
|
const configuredThreshold = parsePositiveInteger(configured);
|
|
@@ -28,11 +46,11 @@ function resolveAnthropicCompactThreshold(contextWindow, configured) {
|
|
|
28
46
|
return Math.max(ANTHROPIC_COMPACT_THRESHOLD_MIN, resolvedContextWindow === void 0 ? ANTHROPIC_COMPACT_THRESHOLD_MIN : Math.floor(resolvedContextWindow * .7));
|
|
29
47
|
}
|
|
30
48
|
/** Resolve the server-compaction gate and effective threshold for an Anthropic route. */
|
|
31
|
-
function resolveAnthropicServerCompactionPlan(model, extraParams) {
|
|
49
|
+
function resolveAnthropicServerCompactionPlan(model, extraParams, apiKey) {
|
|
32
50
|
const provider = normalizeOptionalLowercaseString(model.provider);
|
|
33
51
|
const api = normalizeOptionalLowercaseString(model.api);
|
|
34
|
-
const endpointClass = resolveProviderEndpoint(model
|
|
35
|
-
const enabled = extraParams?.anthropicServerCompaction === true && provider === "anthropic" && api === "anthropic-messages" && (endpointClass === "default" || endpointClass === "anthropic-public");
|
|
52
|
+
const endpointClass = resolveProviderEndpoint(model).endpointClass;
|
|
53
|
+
const enabled = extraParams?.anthropicServerCompaction === true && !isAnthropicOAuthApiKey(apiKey) && provider === "anthropic" && api === "anthropic-messages" && (endpointClass === "default" || endpointClass === "anthropic-public");
|
|
36
54
|
return {
|
|
37
55
|
enabled,
|
|
38
56
|
...enabled ? { threshold: resolveAnthropicCompactThreshold(model.contextWindow, extraParams?.anthropicCompactThreshold) } : {}
|
|
@@ -150,14 +168,14 @@ function countAnthropicCacheControlMarkers(blocks) {
|
|
|
150
168
|
return count;
|
|
151
169
|
}
|
|
152
170
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
153
|
-
function resolveAnthropicPayloadPolicy(input) {
|
|
171
|
+
function resolveAnthropicPayloadPolicy(input, model) {
|
|
154
172
|
const capabilities = resolveProviderRequestCapabilities({
|
|
155
173
|
provider: input.provider,
|
|
156
174
|
api: input.api,
|
|
157
175
|
baseUrl: input.baseUrl,
|
|
158
176
|
capability: "llm",
|
|
159
177
|
transport: "stream"
|
|
160
|
-
});
|
|
178
|
+
}, model);
|
|
161
179
|
const serverCompactionPlan = resolveAnthropicServerCompactionPlan(input, input.extraParams);
|
|
162
180
|
return {
|
|
163
181
|
allowsServiceTier: capabilities.allowsAnthropicServiceTier,
|
|
@@ -249,25 +267,6 @@ async function normalizeAnthropicInlineContent(content, budget) {
|
|
|
249
267
|
return normalized;
|
|
250
268
|
}
|
|
251
269
|
//#endregion
|
|
252
|
-
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
253
|
-
function usesFoundryBearerAuth(model) {
|
|
254
|
-
return model.provider === "microsoft-foundry" && (model.authHeader === true || hasBearerAuthorizationHeader(model.headers));
|
|
255
|
-
}
|
|
256
|
-
function hasBearerAuthorizationHeader(headers) {
|
|
257
|
-
if (!headers) return false;
|
|
258
|
-
return Object.entries(headers).some(([key, value]) => key.toLowerCase() === "authorization" && /^bearer\s+\S+/i.test(value.trim()));
|
|
259
|
-
}
|
|
260
|
-
function omitFoundryBearerCredentialHeaders(headers) {
|
|
261
|
-
if (!headers) return;
|
|
262
|
-
const next = {};
|
|
263
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
264
|
-
const lower = key.toLowerCase();
|
|
265
|
-
if (lower === "authorization" || lower === "x-api-key" || lower === "api-key") continue;
|
|
266
|
-
next[key] = value;
|
|
267
|
-
}
|
|
268
|
-
return Object.keys(next).length > 0 ? next : void 0;
|
|
269
|
-
}
|
|
270
|
-
//#endregion
|
|
271
270
|
//#region packages/ai/src/providers/anthropic-refusal.ts
|
|
272
271
|
function readAnthropicRefusalDetails(value) {
|
|
273
272
|
if (!value || typeof value !== "object") return {
|
|
@@ -752,14 +751,13 @@ function buildAnthropicReplayContext(model, options) {
|
|
|
752
751
|
authProfileHash: hashReplayValue(options?.authProfileId)
|
|
753
752
|
};
|
|
754
753
|
}
|
|
754
|
+
function isAnthropicCompactionState(state) {
|
|
755
|
+
if (state.v !== 1 || typeof state.data !== "string" || typeof state.provider !== "string" || typeof state.api !== "string" || typeof state.model !== "string" || typeof state.baseUrlHash !== "string" || state.sessionHash !== void 0 && typeof state.sessionHash !== "string" || state.authProfileHash !== void 0 && typeof state.authProfileHash !== "string") return false;
|
|
756
|
+
if (state.type === ANTHROPIC_COMPACTION_SUPPRESSION_TYPE) return state.data === ANTHROPIC_COMPACTION_SUPPRESSION_DATA;
|
|
757
|
+
return state.type === ANTHROPIC_COMPACTION_REPLAY_TYPE && state.data.length > 0 && (state.replayIndex === void 0 || typeof state.replayIndex === "number" && Number.isSafeInteger(state.replayIndex) && state.replayIndex >= 0);
|
|
758
|
+
}
|
|
755
759
|
function readAnthropicCompactionState(value) {
|
|
756
|
-
|
|
757
|
-
const state = value;
|
|
758
|
-
if (!(state.v === 1 && typeof state.data === "string" && typeof state.provider === "string" && typeof state.api === "string" && typeof state.model === "string" && typeof state.baseUrlHash === "string" && (state.sessionHash === void 0 || typeof state.sessionHash === "string") && (state.authProfileHash === void 0 || typeof state.authProfileHash === "string"))) return;
|
|
759
|
-
const replayState = state;
|
|
760
|
-
if (replayState.type === ANTHROPIC_COMPACTION_SUPPRESSION_TYPE) return replayState.data === ANTHROPIC_COMPACTION_SUPPRESSION_DATA ? replayState : void 0;
|
|
761
|
-
if (replayState.type !== ANTHROPIC_COMPACTION_REPLAY_TYPE || replayState.data.length === 0 || replayState.replayIndex !== void 0 && (!Number.isSafeInteger(replayState.replayIndex) || replayState.replayIndex < 0)) return;
|
|
762
|
-
return replayState;
|
|
760
|
+
return isRecord(value) && isAnthropicCompactionState(value) ? value : void 0;
|
|
763
761
|
}
|
|
764
762
|
function replayContextMatches(state, context) {
|
|
765
763
|
return state.provider === context.provider && state.api === context.api && state.model === context.model && state.baseUrlHash === context.baseUrlHash && state.sessionHash === context.sessionHash && state.authProfileHash === context.authProfileHash;
|
|
@@ -837,4 +835,4 @@ function isAnthropicReplayRejection(error) {
|
|
|
837
835
|
return (record.status === 400 || text.startsWith("http 400:")) && (text.includes("compaction") || text.includes("context_management"));
|
|
838
836
|
}
|
|
839
837
|
//#endregion
|
|
840
|
-
export {
|
|
838
|
+
export { applyAnthropicCacheControlToMessages as A, applyAnthropicFallbackBoundary as C, createAnthropicInlineImageBudget as D, applyAnthropicRefusal as E, resolveAnthropicServerCompactionPlan as F, isAnthropicOAuthApiKey as I, omitFoundryBearerCredentialHeaders as L, applyAnthropicPayloadPolicyToParams as M, resolveAnthropicEphemeralCacheControl as N, normalizeAnthropicInlineContent as O, resolveAnthropicPayloadPolicy as P, usesFoundryBearerAuth as R, CLAUDE_OPUS_FALLBACK_MODEL_COST as S, resolveAnthropicFallbackServingModelCost as T, toClaudeCodeToolName as _, suppressAnthropicCompaction as a, ANTHROPIC_SERVER_SIDE_FALLBACKS as b, readAnthropicCacheWriteUsage as c, readLastAnthropicIterationUsage as d, normalizeAnthropicToolCallId as f, resolveOriginalAnthropicToolName as g, reconcileAnthropicToolChoice as h, resolveNewestAnthropicCompaction as i, applyAnthropicEphemeralCacheControlMarkers as j, resolveAnthropicImageMediaType 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, readAnthropicFallbackBoundary as w, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA as x, findActiveAnthropicToolTurnAssistantIndex as y };
|
package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-i_5_inWe.d.mts}
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./index-N3zr6__t.mjs";
|
|
2
|
+
import { D as Model } from "./types-h38Azne1.mjs";
|
|
1
3
|
//#region packages/ai/src/transports/anthropic-payload-policy.d.ts
|
|
2
4
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
3
5
|
type AnthropicServiceTier = "auto" | "standard_only";
|
|
@@ -31,7 +33,7 @@ declare function resolveAnthropicServerCompactionPlan(model: {
|
|
|
31
33
|
api?: unknown;
|
|
32
34
|
baseUrl?: string;
|
|
33
35
|
contextWindow?: unknown;
|
|
34
|
-
}, extraParams?: Record<string, unknown
|
|
36
|
+
}, extraParams?: Record<string, unknown>, apiKey?: string): {
|
|
35
37
|
enabled: boolean;
|
|
36
38
|
threshold?: number;
|
|
37
39
|
};
|
|
@@ -40,7 +42,7 @@ declare function resolveAnthropicEphemeralCacheControl(baseUrl: string | undefin
|
|
|
40
42
|
/** Apply one shared deepest-stable-message cache breakpoint policy. */
|
|
41
43
|
declare function applyAnthropicCacheControlToMessages(messages: unknown, cacheControl: AnthropicEphemeralCacheControl, markerLimit: number, cacheBreakpointOptOutMessageIndexes: ReadonlySet<number>): void;
|
|
42
44
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
43
|
-
declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput): AnthropicPayloadPolicy;
|
|
45
|
+
declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput, model?: Model): AnthropicPayloadPolicy;
|
|
44
46
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
45
47
|
declare function applyAnthropicPayloadPolicyToParams(payloadObj: Record<string, unknown>, policy: AnthropicPayloadPolicy, cacheBreakpointOptOutMessageIndexes: ReadonlySet<number>): void;
|
|
46
48
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./index-N3zr6__t.mjs";
|
|
2
|
+
import { D as Model, H as StreamFunction, U as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract, z as SimpleStreamOptions } from "./types-h38Azne1.mjs";
|
|
2
3
|
//#region packages/ai/src/api-registry.d.ts
|
|
3
4
|
/** Runtime stream adapter signature stored in the API provider registry. */
|
|
4
5
|
type ApiStreamFunction = (model: Model, context: Context, options?: StreamOptions) => AssistantMessageEventStreamContract;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
2
|
+
import { n as getAiTransportHost } from "./host-D51fmkH6.mjs";
|
|
4
3
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
5
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
6
|
-
import {
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-DKx86yX9.mjs";
|
|
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-zPmKnhF5.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
|
|
@@ -68,4 +68,76 @@ function parseStrictNonNegativeInteger(value) {
|
|
|
68
68
|
return parsed !== void 0 && parsed >= 0 ? parsed : void 0;
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
-
|
|
71
|
+
//#region packages/media-core/src/base64.ts
|
|
72
|
+
/** Estimates decoded bytes without allocating a cleaned copy of the base64 payload. */
|
|
73
|
+
function estimateBase64DecodedBytes(base64) {
|
|
74
|
+
let effectiveLen = 0;
|
|
75
|
+
for (let i = 0; i < base64.length; i += 1) {
|
|
76
|
+
if (base64.charCodeAt(i) <= 32) continue;
|
|
77
|
+
effectiveLen += 1;
|
|
78
|
+
}
|
|
79
|
+
if (effectiveLen === 0) return 0;
|
|
80
|
+
let padding = 0;
|
|
81
|
+
let end = base64.length - 1;
|
|
82
|
+
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
83
|
+
if (end >= 0 && base64[end] === "=") {
|
|
84
|
+
padding = 1;
|
|
85
|
+
end -= 1;
|
|
86
|
+
while (end >= 0 && base64.charCodeAt(end) <= 32) end -= 1;
|
|
87
|
+
if (end >= 0 && base64[end] === "=") padding = 2;
|
|
88
|
+
}
|
|
89
|
+
const estimated = Math.floor(effectiveLen * 3 / 4) - padding;
|
|
90
|
+
return Math.max(0, estimated);
|
|
91
|
+
}
|
|
92
|
+
function isBase64DataChar(code) {
|
|
93
|
+
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
94
|
+
}
|
|
95
|
+
function base64DataValue(code) {
|
|
96
|
+
if (code >= 65 && code <= 90) return code - 65;
|
|
97
|
+
if (code >= 97 && code <= 122) return code - 97 + 26;
|
|
98
|
+
if (code >= 48 && code <= 57) return code - 48 + 52;
|
|
99
|
+
return code === 43 ? 62 : 63;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Normalizes and validates a base64 string, returning canonical no-whitespace
|
|
103
|
+
* base64 only when the input has valid alphabet, padding, and length.
|
|
104
|
+
*/
|
|
105
|
+
function canonicalizeBase64(base64) {
|
|
106
|
+
let out;
|
|
107
|
+
let outLen = 0;
|
|
108
|
+
let padding = 0;
|
|
109
|
+
let sawPadding = false;
|
|
110
|
+
let lastDataCode = 0;
|
|
111
|
+
for (let i = 0; i < base64.length; i += 1) {
|
|
112
|
+
const code = base64.charCodeAt(i);
|
|
113
|
+
if (code <= 32) {
|
|
114
|
+
if (out === void 0) {
|
|
115
|
+
out = Buffer.allocUnsafe(base64.length - 1);
|
|
116
|
+
for (let j = 0; j < i; j += 1) out[j] = base64.charCodeAt(j);
|
|
117
|
+
outLen = i;
|
|
118
|
+
}
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (code === 61) {
|
|
122
|
+
padding += 1;
|
|
123
|
+
if (padding > 2) return;
|
|
124
|
+
sawPadding = true;
|
|
125
|
+
} else if (sawPadding || !isBase64DataChar(code)) return;
|
|
126
|
+
else lastDataCode = code;
|
|
127
|
+
if (out !== void 0) {
|
|
128
|
+
out[outLen] = code;
|
|
129
|
+
outLen += 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const cleanedLength = out === void 0 ? base64.length : outLen;
|
|
133
|
+
if (cleanedLength === 0) return;
|
|
134
|
+
const remainder = cleanedLength % 4;
|
|
135
|
+
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
136
|
+
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
137
|
+
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
138
|
+
if (padBitMask !== 0 && (base64DataValue(lastDataCode) & padBitMask) !== 0) return;
|
|
139
|
+
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
140
|
+
return remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder);
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { asNonNegativeFiniteNumber as a, parseStrictNonNegativeInteger as c, asFiniteNumberInRange as i, parseStrictPositiveInteger as l, estimateBase64DecodedBytes as n, clampTimerTimeoutMs as o, asFiniteNumber as r, parseStrictFiniteNumber as s, canonicalizeBase64 as t, resolveTimerTimeoutMs as u };
|
package/dist/diagnostics.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
2
2
|
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-CzNw4BWX.mjs";
|
|
3
|
-
|
|
4
3
|
//#region packages/ai/src/utils/credential-redaction.d.ts
|
|
5
4
|
type DiagnosticMediaField = {
|
|
6
5
|
kind: "context";
|
|
@@ -17,9 +16,9 @@ type DiagnosticProjectionPolicy = {
|
|
|
17
16
|
kind: "redacted";
|
|
18
17
|
}>) => Record<string, unknown>;
|
|
19
18
|
};
|
|
20
|
-
declare function projectDiagnosticValue(value: unknown, policy?: DiagnosticProjectionPolicy, seen?: WeakSet<object>, mediaPayload?: boolean, state?: {
|
|
19
|
+
export declare function projectDiagnosticValue(value: unknown, policy?: DiagnosticProjectionPolicy, seen?: WeakSet<object>, mediaPayload?: boolean, state?: {
|
|
21
20
|
changed: boolean;
|
|
22
21
|
nodesRemaining: number;
|
|
23
22
|
}): unknown;
|
|
24
23
|
//#endregion
|
|
25
|
-
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue
|
|
24
|
+
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue };
|
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-jZP5NMTZ.mjs";
|
|
3
3
|
export { appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, extractDiagnosticError, formatThrownValue, projectDiagnosticValue };
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __exportAll = (all, no_symbols) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
14
|
-
//#endregion
|
|
1
|
+
import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
15
2
|
//#region packages/ai/src/env-api-keys.ts
|
|
16
3
|
let existsSync = null;
|
|
17
4
|
let homedir = null;
|
|
@@ -169,4 +156,4 @@ function getEnvApiKey(provider) {
|
|
|
169
156
|
}
|
|
170
157
|
}
|
|
171
158
|
//#endregion
|
|
172
|
-
export { getEnvApiKey as n,
|
|
159
|
+
export { getEnvApiKey as n, findEnvKeys as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-UhnxHuqt.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
1
|
+
import { a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-h38Azne1.mjs";
|
|
3
2
|
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
4
3
|
/** Generic async-iterable event stream with a separately awaited final result. */
|
|
5
4
|
declare class EventStream<T, R = T> implements AsyncIterable<T> {
|
package/dist/event-stream.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-UhnxHuqt.mjs";
|
|
2
|
+
import "./event-stream-C988TSLe.mjs";
|
|
2
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import {
|
|
2
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-D51fmkH6.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-DKx86yX9.mjs";
|
|
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-DVfL9COU.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google.ts
|
|
8
8
|
let toolCallCounter = 0;
|