@openclaw/ai 2026.9.5 → 2026.9.6
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-COtDvgtt.mjs → anthropic-DZQ_7gD1.mjs} +35 -35
- package/dist/{anthropic-payload-policy-5Erq1Nzy.d.mts → anthropic-payload-policy-DyfwikYJ.d.mts} +4 -4
- package/dist/{anthropic-stream-reducer-BvdYYWL8.mjs → anthropic-stream-reducer-D6ZI1wwj.mjs} +32 -16
- package/dist/{api-registry-Ba2Cv-ut.d.mts → api-registry-C2T3lTV7.d.mts} +2 -2
- package/dist/{assistant-output-BsEkB-vU.mjs → assistant-output-DM1JBNs1.mjs} +1 -1
- package/dist/{azure-openai-responses-YrgnD583.mjs → azure-openai-responses-DS86GYzq.mjs} +5 -5
- package/dist/{base64-BQOzsvUH.mjs → base64-CPmadnUf.mjs} +8 -8
- package/dist/{diagnostics-Dm4bisWG.mjs → diagnostics-CH8j2wIG.mjs} +55 -10
- package/dist/{diagnostics-CPeq9F7y.mjs → diagnostics-DzrF1h4J.mjs} +18 -1
- package/dist/diagnostics.d.mts +11 -5
- package/dist/diagnostics.mjs +4 -4
- package/dist/event-stream-C0nsgbj2.d.mts +1 -0
- package/dist/{event-stream-CCoa-qSI.d.mts → event-stream-CjnIZZst.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-BuhpRO9r.mjs → google-BZJFjhuC.mjs} +5 -5
- package/dist/{google-messages-CyWnYlh0.mjs → google-messages-DB7GKkDk.mjs} +3 -3
- package/dist/{google-shared-BT5ZeNer.mjs → google-shared-Bok4I6zB.mjs} +5 -5
- package/dist/{google-vertex-C7EplRvt.mjs → google-vertex-3eVNR2qW.mjs} +4 -4
- package/dist/{host-FZ1RA_qD.d.mts → host-DH-Z-LDb.d.mts} +3 -3
- package/dist/{host-policy-DUnXSx0I.mjs → host-policy-DZO3oPPk.mjs} +1 -1
- package/dist/{host-B4MeUNBc.mjs → host-yTvBrYM2.mjs} +41 -7
- package/dist/{index-DaF2QbwS.d.mts → index-C25RT6bP.d.mts} +36 -8
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +12 -8
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +1 -1
- package/dist/internal/openai.d.mts +22 -8
- package/dist/internal/openai.mjs +11 -10
- package/dist/internal/runtime.d.mts +6 -6
- package/dist/internal/runtime.mjs +5 -5
- package/dist/internal/shared.d.mts +5 -4
- package/dist/internal/shared.mjs +4 -4
- package/dist/internal/tool-schema.d.mts +1 -1
- package/dist/internal/tool-schema.mjs +1 -1
- package/dist/{mistral-moA-mbwl.mjs → mistral-C_13dVBn.mjs} +5 -5
- package/dist/{model-transport-url-DKocrEsb.d.mts → model-transport-url-C5f59L3Y.d.mts} +1 -1
- package/dist/{openai-chatgpt-responses-DWID3EFO.mjs → openai-chatgpt-responses-sTxPl4zM.mjs} +107 -84
- package/dist/{openai-completions-DJ1Vm-CD.mjs → openai-completions-BO6D_hrB.mjs} +10 -10
- package/dist/{openai-completions-compat-CkwdxTZx.mjs → openai-completions-compat-CUollwl6.mjs} +1 -1
- package/dist/{openai-completions-compat-JE7gqxb9.d.mts → openai-completions-compat-DfJG1wSO.d.mts} +3 -3
- package/dist/{openai-completions-stream-Bu98b0Hv.mjs → openai-completions-stream-BpuJ0ZOA.mjs} +38 -25
- package/dist/{openai-prompt-cache-CJ_xEevu.d.mts → openai-prompt-cache-C4RHdN4n.d.mts} +2 -2
- package/dist/{openai-prompt-cache-1wfaIszn.mjs → openai-prompt-cache-CjV_2IRI.mjs} +1 -1
- package/dist/{openai-provider-client-DPo0Hmak.mjs → openai-provider-client-BP8J1aeg.mjs} +2 -2
- package/dist/{openai-reasoning-effort-NlFZmfEu.mjs → openai-reasoning-effort-ash8dPrd.mjs} +12 -4
- package/dist/{openai-responses-BejZzQCP.mjs → openai-responses-BJ_IEoMU.mjs} +7 -7
- package/dist/{openai-responses-compaction-window-D6P5oZP5.mjs → openai-responses-compaction-window-BiNCT0bS.mjs} +3 -3
- package/dist/{openai-responses-contracts-Dflvrfa8.d.mts → openai-responses-contracts-B1ENJFpI.d.mts} +4 -4
- package/dist/{openai-responses-prompt-observer-internal-C15_-OwV.mjs → openai-responses-prompt-observer-internal-DPHWgbBH.mjs} +14 -11
- package/dist/openai-responses-request-lifecycle-DFuyO1pQ.mjs +36 -0
- package/dist/{openai-responses-shared-CwsziD_m.mjs → openai-responses-shared-DvSqtJ6_.mjs} +481 -410
- package/dist/{openai-responses-terminal-usage-Dl3J6zrf.d.mts → openai-responses-terminal-usage-BNFbvY9f.d.mts} +2 -2
- package/dist/{openai-tool-schema-BO8rwyAD.mjs → openai-tool-schema-D4BMcj2D.mjs} +171 -95
- package/dist/{openai-transport-params-DQeuAvBl.mjs → openai-transport-params-DZKOTSfH.mjs} +9 -9
- package/dist/{positive-integer-DtjCkbue.mjs → positive-integer-BiUxrd71.mjs} +1 -1
- package/dist/{provider-error-DDqw9Qda.mjs → provider-error-CRhW7lkJ.mjs} +40 -7
- package/dist/{provider-error-CzNw4BWX.d.mts → provider-error-xumb1V3F.d.mts} +3 -1
- package/dist/{provider-options-DprLsWh9.d.mts → provider-options-DZYq53lj.d.mts} +6 -4
- package/dist/{provider-replay-context-CnUSOwhr.mjs → provider-replay-context-DPr3w20a.mjs} +1 -1
- package/dist/{provider-transcript-transform-BsRAhuWJ.mjs → provider-transcript-transform-BTocjCRs.mjs} +1 -1
- package/dist/{provider-transport-turn-state-CkGToCD2.mjs → provider-transport-turn-state-lrXEFkYr.mjs} +1 -1
- package/dist/{provider-types-CAKRC7N5.d.mts → provider-types-w1rEqrGP.d.mts} +3 -3
- 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-Dy9IO8Dc.mjs → reasoning-tag-text-partitioner-Di38crhI.mjs} +154 -35
- package/dist/{simple-options-C6cFWj_f.mjs → simple-options-np1XPuhm.mjs} +2 -2
- package/dist/{src-DeKjbE8I.mjs → src-DwGYYyZp.mjs} +15 -6
- package/dist/{stream-first-event-timeout-C9ZadkJW.mjs → stream-first-event-timeout-BeptfRL6.mjs} +1 -1
- package/dist/{transport-stream-shared-D-6FQSHm.mjs → transport-stream-shared-B5RioB_Q.mjs} +5 -13
- package/dist/{transport-stream-shared-BbUkFaHi.d.mts → transport-stream-shared-B7Z9oCYg.d.mts} +5 -5
- package/dist/{transport-utils-1cyq5Y7x.mjs → transport-utils-03Qi0CN2.mjs} +3 -3
- package/dist/transports.d.mts +11 -11
- package/dist/transports.mjs +70 -45
- package/dist/types-DTvddOfm.d.mts +1 -0
- package/dist/{types-4_uVs5WH.d.mts → types-qZFbaDbK.d.mts} +2 -0
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +3 -3
- package/dist/{validation-Ctzu2DhF.d.mts → validation-DhQhmt6t.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +5 -5
- package/dist/event-stream-DmSCpi1T.d.mts +0 -1
- package/dist/types-DkJfb4W3.d.mts +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as resolveClaudeSonnet5ModelIdentity, g as resolveClaudeOpus5ModelIdentity, y as supportsClaudeAdaptiveThinking } from "./src-DwGYYyZp.mjs";
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
4
|
-
import { E as resolveAnthropicThinkingEffort, O as usesClaudeFable5MessagesContract, T as requiresClaudeAdaptiveThinking, b as
|
|
5
|
-
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-
|
|
6
|
-
import { C as applyAnthropicThinkingBindingControls, D as ANTHROPIC_SERVER_SIDE_FALLBACKS, H as resolveAnthropicContextManagementBetaHeader, I as applyAnthropicRequestCacheControl, J as usesFoundryBearerAuth, K as isAnthropicOAuthApiKey, L as buildAnthropicSystemBlocks, N as applyAnthropicContextManagementToRequest, O as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, V as resolveAnthropicCacheOptions, d as convertAnthropicTools, f as buildAnthropicReplayPlan, g as normalizeAnthropicToolCallId, h as suppressAnthropicCompaction, l as buildAnthropicGenerationParams, p as isAnthropicReplayRejection, q as omitFoundryBearerCredentialHeaders, t as consumeAnthropicStream, u as convertAnthropicMessages, z as isDirectAnthropicModel } from "./anthropic-stream-reducer-
|
|
4
|
+
import { E as resolveAnthropicThinkingEffort, O as usesClaudeFable5MessagesContract, T as requiresClaudeAdaptiveThinking, b as applyClaudeRequestContract, k as usesClaudeStreamingRefusalContract, n as getAiTransportHost, r as resolveAiTransportHeaderSentinels, w as prepareClaudeNoPrefillRequestContext, x as buildAnthropicClaudeCodeIdentity } from "./host-yTvBrYM2.mjs";
|
|
5
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-03Qi0CN2.mjs";
|
|
6
|
+
import { C as applyAnthropicThinkingBindingControls, D as ANTHROPIC_SERVER_SIDE_FALLBACKS, H as resolveAnthropicContextManagementBetaHeader, I as applyAnthropicRequestCacheControl, J as usesFoundryBearerAuth, K as isAnthropicOAuthApiKey, L as buildAnthropicSystemBlocks, N as applyAnthropicContextManagementToRequest, O as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, V as resolveAnthropicCacheOptions, d as convertAnthropicTools, f as buildAnthropicReplayPlan, g as normalizeAnthropicToolCallId, h as suppressAnthropicCompaction, l as buildAnthropicGenerationParams, p as isAnthropicReplayRejection, q as omitFoundryBearerCredentialHeaders, t as consumeAnthropicStream, u as convertAnthropicMessages, z as isDirectAnthropicModel } from "./anthropic-stream-reducer-D6ZI1wwj.mjs";
|
|
7
7
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import { n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking } from "./simple-options-
|
|
8
|
+
import { n as buildBaseOptions, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking } from "./simple-options-np1XPuhm.mjs";
|
|
9
9
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
10
|
-
import { T as parseJsonWithRepair, l as finalizeTransportStream, n as assignTransportErrorDetails, p as notifyProviderHttpResponse } from "./transport-stream-shared-
|
|
10
|
+
import { T as parseJsonWithRepair, l as finalizeTransportStream, n as assignTransportErrorDetails, p as notifyProviderHttpResponse } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
11
11
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
12
12
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
13
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
13
|
+
import { t as createAssistantOutput } from "./assistant-output-DM1JBNs1.mjs";
|
|
14
14
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Bcunsn4I.mjs";
|
|
15
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
15
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-BTocjCRs.mjs";
|
|
16
16
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-B37TB3rB.mjs";
|
|
17
17
|
import Anthropic from "@anthropic-ai/sdk";
|
|
18
18
|
import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
|
|
@@ -73,6 +73,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
73
73
|
let isOAuth;
|
|
74
74
|
let serverSideFallback = false;
|
|
75
75
|
let directApiKeyBetaHeader;
|
|
76
|
+
let claudeCodeVersion;
|
|
76
77
|
if (requestOptions?.client) {
|
|
77
78
|
client = requestOptions.client;
|
|
78
79
|
isOAuth = false;
|
|
@@ -92,8 +93,9 @@ const streamAnthropic = (model, context, options) => {
|
|
|
92
93
|
isOAuth = created.isOAuthToken;
|
|
93
94
|
serverSideFallback = created.serverSideFallback;
|
|
94
95
|
directApiKeyBetaHeader = created.directApiKeyBetaHeader;
|
|
96
|
+
claudeCodeVersion = created.claudeCodeVersion;
|
|
95
97
|
}
|
|
96
|
-
const builtParams = await buildParams(model, requestContext, isOAuth, requestOptions, serverSideFallback);
|
|
98
|
+
const builtParams = await buildParams(model, requestContext, isOAuth, requestOptions, serverSideFallback, claudeCodeVersion);
|
|
97
99
|
usedCompactionReplay = builtParams.usedCompactionReplay;
|
|
98
100
|
let params = builtParams.params;
|
|
99
101
|
const toolProjection = builtParams.toolProjection;
|
|
@@ -186,7 +188,7 @@ const streamSimpleAnthropic = (model, context, options) => {
|
|
|
186
188
|
if (resolveClaudeOpus5ModelIdentity(model) || resolveClaudeSonnet5ModelIdentity(model)) return streamAnthropic(model, context, {
|
|
187
189
|
...base,
|
|
188
190
|
thinkingEnabled: true,
|
|
189
|
-
effort: resolveAnthropicThinkingEffort(model, reasoning
|
|
191
|
+
effort: resolveAnthropicThinkingEffort(model, reasoning)
|
|
190
192
|
});
|
|
191
193
|
if (!reasoning) return streamAnthropic(model, context, {
|
|
192
194
|
...base,
|
|
@@ -281,29 +283,27 @@ function createClient(model, apiKey, thinkingEnabled, interleavedThinking, useFi
|
|
|
281
283
|
isOAuthToken: false,
|
|
282
284
|
serverSideFallback: false
|
|
283
285
|
};
|
|
284
|
-
if (isAnthropicOAuthApiKey(apiKey))
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
serverSideFallback: false
|
|
306
|
-
};
|
|
286
|
+
if (isAnthropicOAuthApiKey(apiKey)) {
|
|
287
|
+
const identity = buildAnthropicClaudeCodeIdentity([
|
|
288
|
+
"claude-code-20250219",
|
|
289
|
+
"oauth-2025-04-20",
|
|
290
|
+
...betaFeatures
|
|
291
|
+
].join(","), model.headers, optionsHeaders);
|
|
292
|
+
return {
|
|
293
|
+
client: new Anthropic({
|
|
294
|
+
apiKey: null,
|
|
295
|
+
authToken: apiKey,
|
|
296
|
+
baseURL: model.baseUrl,
|
|
297
|
+
dangerouslyAllowBrowser: true,
|
|
298
|
+
defaultHeaders: identity.headers,
|
|
299
|
+
fetch,
|
|
300
|
+
maxRetries: 0
|
|
301
|
+
}),
|
|
302
|
+
isOAuthToken: true,
|
|
303
|
+
serverSideFallback: false,
|
|
304
|
+
claudeCodeVersion: identity.version
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
307
|
const serverSideFallback = supportsAnthropicServerSideFallback(model);
|
|
308
308
|
if (serverSideFallback) betaFeatures.push(ANTHROPIC_SERVER_SIDE_FALLBACK_BETA);
|
|
309
309
|
const sessionAffinityHeaders = sessionId && getAnthropicCompat(model).sendSessionAffinityHeaders ? { "x-session-affinity": sessionId } : {};
|
|
@@ -327,10 +327,10 @@ function createClient(model, apiKey, thinkingEnabled, interleavedThinking, useFi
|
|
|
327
327
|
directApiKeyBetaHeader: isDirectAnthropicModel(model) ? Object.entries(defaultHeaders).findLast(([name]) => name.toLowerCase() === "anthropic-beta")?.[1] ?? "" : void 0
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
async function buildParams(model, context, isOAuthTokenResult, options, serverSideFallback = false) {
|
|
330
|
+
async function buildParams(model, context, isOAuthTokenResult, options, serverSideFallback = false, claudeCodeVersion) {
|
|
331
331
|
const replayThinkingEnabled = requiresClaudeAdaptiveThinking(model) || options?.thinkingEnabled === true;
|
|
332
332
|
const { cacheControl, supportsCacheControlOnTools } = resolveAnthropicCacheOptions(model, options?.cacheRetention);
|
|
333
|
-
const system = buildAnthropicSystemBlocks(context.systemPrompt, isOAuthTokenResult, cacheControl);
|
|
333
|
+
const system = buildAnthropicSystemBlocks(context.systemPrompt, isOAuthTokenResult, cacheControl, claudeCodeVersion);
|
|
334
334
|
const compat = getAnthropicCompat(model);
|
|
335
335
|
const convertedTools = context.tools ? convertAnthropicTools(context.tools, isOAuthTokenResult, compat.supportsEagerToolInputStreaming) : void 0;
|
|
336
336
|
const tools = convertedTools?.tools;
|
package/dist/{anthropic-payload-policy-5Erq1Nzy.d.mts → anthropic-payload-policy-DyfwikYJ.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { O as Model } from "./types-
|
|
3
|
-
import { t as AnthropicContextManagementOptions } from "./provider-options-
|
|
1
|
+
import "./index-C25RT6bP.mjs";
|
|
2
|
+
import { O as Model } from "./types-qZFbaDbK.mjs";
|
|
3
|
+
import { t as AnthropicContextManagementOptions } from "./provider-options-DZYq53lj.mjs";
|
|
4
4
|
import { TextBlockParam } from "@anthropic-ai/sdk/resources/messages.js";
|
|
5
5
|
//#region packages/ai/src/transports/anthropic-payload-policy.d.ts
|
|
6
6
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
@@ -60,7 +60,7 @@ declare function resolveAnthropicCacheOptions(model: Model<"anthropic-messages">
|
|
|
60
60
|
cacheControl: AnthropicEphemeralCacheControl | undefined;
|
|
61
61
|
supportsCacheControlOnTools: boolean;
|
|
62
62
|
};
|
|
63
|
-
declare function buildAnthropicSystemBlocks(systemPrompt: string | undefined, isOAuthToken: boolean, cacheControl: AnthropicEphemeralCacheControl | undefined): TextBlockParam[] | undefined;
|
|
63
|
+
declare function buildAnthropicSystemBlocks(systemPrompt: string | undefined, isOAuthToken: boolean, cacheControl: AnthropicEphemeralCacheControl | undefined, claudeCodeVersion?: string): TextBlockParam[] | undefined;
|
|
64
64
|
/** Allocate tool and history checkpoints around the prepared stable system blocks. */
|
|
65
65
|
declare function applyAnthropicRequestCacheControl(payload: {
|
|
66
66
|
system?: unknown;
|
package/dist/{anthropic-stream-reducer-BvdYYWL8.mjs → anthropic-stream-reducer-D6ZI1wwj.mjs}
RENAMED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as supportsClaudeNativeXhighEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeOpus5ModelIdentity, h as resolveClaudeOpus55ModelIdentity, y as supportsClaudeAdaptiveThinking } from "./src-DwGYYyZp.mjs";
|
|
2
2
|
import { r as appendAssistantThinking } from "./event-stream-D8PARQfL.mjs";
|
|
3
3
|
import { i as normalizeOptionalLowercaseString, r as normalizeNullableString } from "./string-coerce-fsri9iCu.mjs";
|
|
4
4
|
import { a as asRecord, o as isRecord, r as asOptionalObjectRecord, s as readStringField } from "./record-coerce-DwRYMj3t.mjs";
|
|
5
|
-
import { C as mapAnthropicStopReason, E as resolveAnthropicThinkingEffort, T as requiresClaudeAdaptiveThinking, _ as isImageWithMediaPayload, d as describeToolResultMediaPlaceholder,
|
|
6
|
-
import { i as asNonNegativeFiniteNumber, n as estimateBase64DecodedBytes } from "./base64-
|
|
7
|
-
import "./transport-utils-
|
|
8
|
-
import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-
|
|
5
|
+
import { C as mapAnthropicStopReason, E as resolveAnthropicThinkingEffort, M as calculateCost, T as requiresClaudeAdaptiveThinking, _ as isImageWithMediaPayload, d as describeToolResultMediaPlaceholder, m as extractToolResultText, n as getAiTransportHost, p as extractToolResultBlockText, v as sanitizeSurrogates, y as ANTHROPIC_CLAUDE_CODE_VERSION } from "./host-yTvBrYM2.mjs";
|
|
6
|
+
import { i as asNonNegativeFiniteNumber, n as estimateBase64DecodedBytes } from "./base64-CPmadnUf.mjs";
|
|
7
|
+
import "./transport-utils-03Qi0CN2.mjs";
|
|
8
|
+
import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-DZO3oPPk.mjs";
|
|
9
9
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
10
|
-
import { f as splitSystemPromptCacheBoundary, h as stripSystemPromptRelocatableBoundary, m as stripSystemPromptCacheBoundary, v as sortPromptCacheToolsByName } from "./simple-options-
|
|
11
|
-
import { t as parsePositiveInteger } from "./positive-integer-
|
|
10
|
+
import { f as splitSystemPromptCacheBoundary, h as stripSystemPromptRelocatableBoundary, m as stripSystemPromptCacheBoundary, v as sortPromptCacheToolsByName } from "./simple-options-np1XPuhm.mjs";
|
|
11
|
+
import { t as parsePositiveInteger } from "./positive-integer-BiUxrd71.mjs";
|
|
12
12
|
import { n as projectRuntimeToolInputSchema } from "./tool-schema-json-projection-CD9c_fK8.mjs";
|
|
13
|
-
import { E as parseStreamingJson, _ as sanitizeTransportPayloadText, c as finalizeTerminalToolCallArguments, g as sanitizeNonEmptyTransportPayloadText, r as coerceTransportToolCallArguments, v as transportAbortError, w as createToolArgumentPreviewSchedule, x as parseJsonObjectPreservingUnsafeIntegers } from "./transport-stream-shared-
|
|
14
|
-
import { n as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-
|
|
13
|
+
import { E as parseStreamingJson, _ as sanitizeTransportPayloadText, c as finalizeTerminalToolCallArguments, g as sanitizeNonEmptyTransportPayloadText, r as coerceTransportToolCallArguments, v as transportAbortError, w as createToolArgumentPreviewSchedule, x as parseJsonObjectPreservingUnsafeIntegers } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
14
|
+
import { n as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-DPr3w20a.mjs";
|
|
15
15
|
import { i as tagPendingCommentaryText } from "./assistant-text-phase-C20rxWwP.mjs";
|
|
16
16
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
17
17
|
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
@@ -104,7 +104,7 @@ function resolveAnthropicCacheOptions(model, cacheRetention) {
|
|
|
104
104
|
supportsCacheControlOnTools: model.compat?.supportsCacheControlOnTools ?? model.provider !== "fireworks"
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function buildAnthropicSystemBlocks(systemPrompt, isOAuthToken, cacheControl) {
|
|
107
|
+
function buildAnthropicSystemBlocks(systemPrompt, isOAuthToken, cacheControl, claudeCodeVersion = ANTHROPIC_CLAUDE_CODE_VERSION) {
|
|
108
108
|
const blocks = systemPrompt ? [{
|
|
109
109
|
type: "text",
|
|
110
110
|
text: sanitizeSurrogates(systemPrompt)
|
|
@@ -119,7 +119,7 @@ function buildAnthropicSystemBlocks(systemPrompt, isOAuthToken, cacheControl) {
|
|
|
119
119
|
const identityCacheControl = blocks.some((block) => block.cache_control) ? void 0 : cacheControl;
|
|
120
120
|
blocks.unshift({
|
|
121
121
|
type: "text",
|
|
122
|
-
text:
|
|
122
|
+
text: `x-anthropic-billing-header: cc_version=${claudeCodeVersion}; cc_entrypoint=sdk-cli;`
|
|
123
123
|
}, {
|
|
124
124
|
type: "text",
|
|
125
125
|
text: "You are Claude Code, Anthropic's official CLI for Claude.",
|
|
@@ -383,25 +383,41 @@ const CLAUDE_OPUS_FALLBACK_MODEL_COST = {
|
|
|
383
383
|
cacheRead: .5,
|
|
384
384
|
cacheWrite: 6.25
|
|
385
385
|
};
|
|
386
|
+
const CLAUDE_OPUS_55_FALLBACK_MODEL_COST = {
|
|
387
|
+
input: 4,
|
|
388
|
+
output: 20,
|
|
389
|
+
cacheRead: .2,
|
|
390
|
+
cacheWrite: 5
|
|
391
|
+
};
|
|
386
392
|
function resolveFallbackModelIdentity(modelId) {
|
|
387
393
|
if (!modelId?.trim()) return null;
|
|
388
394
|
const ref = { id: modelId };
|
|
389
395
|
const normalized = resolveClaudeModelIdentity(ref);
|
|
396
|
+
if (resolveClaudeOpus55ModelIdentity(ref)) return "claude-opus-5-5";
|
|
390
397
|
if (normalized === "opus" || normalized === "opus-5" || resolveClaudeOpus5ModelIdentity(ref)) return "claude-opus-5";
|
|
391
398
|
if (resolveClaudeFable5ModelIdentity(ref)) return "claude-fable-5";
|
|
392
399
|
if (/^claude-opus-4-8(?=$|[^a-z0-9])/.test(normalized)) return "claude-opus-4-8";
|
|
393
400
|
return normalized || null;
|
|
394
401
|
}
|
|
395
|
-
function
|
|
396
|
-
|
|
402
|
+
function resolveClaudeOpusFallbackCost(modelId) {
|
|
403
|
+
if (modelId === "claude-opus-5-5") return CLAUDE_OPUS_55_FALLBACK_MODEL_COST;
|
|
404
|
+
return modelId === "claude-opus-5" || modelId === "claude-opus-4-8" ? CLAUDE_OPUS_FALLBACK_MODEL_COST : void 0;
|
|
397
405
|
}
|
|
398
406
|
/** Resolve billed rates from the serving model reported by Anthropic's fallback stream. */
|
|
399
407
|
function resolveAnthropicFallbackServingModelCost(params) {
|
|
400
408
|
const requestedModelId = resolveFallbackModelIdentity(params.requestedModelId);
|
|
401
409
|
const servingModelId = resolveFallbackModelIdentity(params.servingModelId);
|
|
402
|
-
|
|
403
|
-
if (
|
|
404
|
-
|
|
410
|
+
const servingCost = resolveClaudeOpusFallbackCost(servingModelId);
|
|
411
|
+
if (!servingCost || servingModelId === requestedModelId) return params.requestedCost;
|
|
412
|
+
const requestedCost = resolveClaudeOpusFallbackCost(requestedModelId);
|
|
413
|
+
if (requestedCost === servingCost) return params.requestedCost;
|
|
414
|
+
if (!requestedCost) return servingCost;
|
|
415
|
+
return {
|
|
416
|
+
input: params.requestedCost.input / requestedCost.input * servingCost.input,
|
|
417
|
+
output: params.requestedCost.output / requestedCost.output * servingCost.output,
|
|
418
|
+
cacheRead: params.requestedCost.cacheRead / requestedCost.cacheRead * servingCost.cacheRead,
|
|
419
|
+
cacheWrite: params.requestedCost.cacheWrite / requestedCost.cacheWrite * servingCost.cacheWrite
|
|
420
|
+
};
|
|
405
421
|
}
|
|
406
422
|
function readBoundaryModel(value) {
|
|
407
423
|
if (!value || typeof value !== "object") return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { G as SimpleStreamOptions, J as StreamFunction, O as Model, Y as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "./types-
|
|
1
|
+
import "./index-C25RT6bP.mjs";
|
|
2
|
+
import { G as SimpleStreamOptions, J as StreamFunction, O as Model, Y as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "./types-qZFbaDbK.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,4 +1,4 @@
|
|
|
1
|
-
import { a as createEmptyTransportUsage } from "./transport-stream-shared-
|
|
1
|
+
import { a as createEmptyTransportUsage } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/assistant-output.ts
|
|
3
3
|
function createAssistantOutput(model, api = model.api) {
|
|
4
4
|
return {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.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-
|
|
5
|
-
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-
|
|
2
|
+
import { n as getAiTransportHost } from "./host-yTvBrYM2.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-CjV_2IRI.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-np1XPuhm.mjs";
|
|
5
|
+
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-DZKOTSfH.mjs";
|
|
6
6
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
7
|
-
import { a as runResponsesStreamLifecycle, i as createResponsesAssistantOutput, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
7
|
+
import { a as runResponsesStreamLifecycle, i as createResponsesAssistantOutput, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-DvSqtJ6_.mjs";
|
|
8
8
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
9
9
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
10
10
|
//#region packages/ai/src/providers/azure-openai-responses.ts
|
|
@@ -63,14 +63,11 @@ function estimateBase64DecodedBytes(base64) {
|
|
|
63
63
|
const estimated = Math.floor(effectiveLen * 3 / 4) - padding;
|
|
64
64
|
return Math.max(0, estimated);
|
|
65
65
|
}
|
|
66
|
-
function isBase64DataChar(code) {
|
|
67
|
-
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47;
|
|
68
|
-
}
|
|
69
66
|
function base64DataValue(code) {
|
|
70
67
|
if (code >= 65 && code <= 90) return code - 65;
|
|
71
68
|
if (code >= 97 && code <= 122) return code - 97 + 26;
|
|
72
69
|
if (code >= 48 && code <= 57) return code - 48 + 52;
|
|
73
|
-
return code === 43 ? 62 : 63;
|
|
70
|
+
return code === 43 ? 62 : code === 47 ? 63 : -1;
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
76
73
|
* Normalizes and validates a base64 string, returning canonical no-whitespace
|
|
@@ -81,7 +78,7 @@ function canonicalizeBase64(base64) {
|
|
|
81
78
|
let outLen = 0;
|
|
82
79
|
let padding = 0;
|
|
83
80
|
let sawPadding = false;
|
|
84
|
-
let
|
|
81
|
+
let lastDataValue = 0;
|
|
85
82
|
for (let i = 0; i < base64.length; i += 1) {
|
|
86
83
|
const code = base64.charCodeAt(i);
|
|
87
84
|
if (code <= 32) {
|
|
@@ -96,8 +93,11 @@ function canonicalizeBase64(base64) {
|
|
|
96
93
|
padding += 1;
|
|
97
94
|
if (padding > 2) return;
|
|
98
95
|
sawPadding = true;
|
|
99
|
-
} else
|
|
100
|
-
|
|
96
|
+
} else {
|
|
97
|
+
const value = base64DataValue(code);
|
|
98
|
+
if (sawPadding || value < 0) return;
|
|
99
|
+
lastDataValue = value;
|
|
100
|
+
}
|
|
101
101
|
if (out !== void 0) {
|
|
102
102
|
out[outLen] = code;
|
|
103
103
|
outLen += 1;
|
|
@@ -109,7 +109,7 @@ function canonicalizeBase64(base64) {
|
|
|
109
109
|
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
110
110
|
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
111
111
|
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
112
|
-
if (padBitMask !== 0 && (
|
|
112
|
+
if (padBitMask !== 0 && (lastDataValue & padBitMask) !== 0) return;
|
|
113
113
|
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
114
114
|
return remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder);
|
|
115
115
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError } from "./diagnostics-
|
|
1
|
+
import { a as isProviderRefusalAssistantError } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
2
|
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
3
|
+
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
4
|
+
import "./provider-error-CRhW7lkJ.mjs";
|
|
5
|
+
import { r as asFiniteNumber } from "./base64-CPmadnUf.mjs";
|
|
5
6
|
//#region packages/normalization-core/src/error-coercion.ts
|
|
6
7
|
function readProperty(value, key) {
|
|
7
8
|
try {
|
|
@@ -70,6 +71,20 @@ function collectNestedErrorCandidates(err) {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
//#endregion
|
|
74
|
+
//#region packages/normalization-core/src/json-coercion.ts
|
|
75
|
+
/** Parses JSON without throwing, returning undefined for invalid input. */
|
|
76
|
+
function safeParseJson(value) {
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(value);
|
|
79
|
+
} catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Parses JSON into a non-array record, returning undefined for every other result. */
|
|
84
|
+
function safeParseJsonRecord(value) {
|
|
85
|
+
return /^[\t\n\r ]*\{/.test(value) ? asOptionalRecord(safeParseJson(value)) : void 0;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
73
88
|
//#region packages/ai/src/providers/openai-responses-terminal-usage.ts
|
|
74
89
|
/**
|
|
75
90
|
* Canonical mapping for terminal OpenAI Responses events.
|
|
@@ -81,7 +96,7 @@ function collectNestedErrorCandidates(err) {
|
|
|
81
96
|
*/
|
|
82
97
|
/** A known output ceiling can resume sampling after admitted tools have settled. */
|
|
83
98
|
function isResponsesOutputLimitToolCallError(message) {
|
|
84
|
-
return message.stopReason === "error" && message.errorCode === "incomplete_tool_call" && !isProviderRefusalAssistantError(message) && message.diagnostics?.some(({ type, details }) => type === "openai_responses_terminal" && details?.eventType === "response.incomplete" && details.incompleteReason === "max_output_tokens") === true;
|
|
99
|
+
return message.stopReason === "error" && message.errorCode === "incomplete_tool_call" && !isProviderRefusalAssistantError(message) && message.diagnostics?.some(({ type, details }) => type === "openai_responses_terminal" && details?.eventType === "response.incomplete" && details.stopReason === "length" && details.incompleteReason === "max_output_tokens") === true;
|
|
85
100
|
}
|
|
86
101
|
function readReportedCount(value) {
|
|
87
102
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
@@ -154,6 +169,39 @@ function resolveResponsesTerminalStopReason(params) {
|
|
|
154
169
|
return { stopReason };
|
|
155
170
|
}
|
|
156
171
|
//#endregion
|
|
172
|
+
//#region packages/ai/src/transports/openai-responses-stream-errors.ts
|
|
173
|
+
const OUTPUT_IDENTITY_ERROR_CODE = "responses_output_identity_conflict";
|
|
174
|
+
function outputType(type) {
|
|
175
|
+
return type === "reasoning" || type === "message" || type === "function_call" || type === "compaction" ? type : "other";
|
|
176
|
+
}
|
|
177
|
+
function isResponsesProviderTool(item) {
|
|
178
|
+
return outputType(item.type) === "other";
|
|
179
|
+
}
|
|
180
|
+
/** Inspect the admitted request, including payload-hook changes and transport retries. */
|
|
181
|
+
function hasOnlyResponsesFunctionTools(request) {
|
|
182
|
+
return request !== void 0 && (request.tools === void 0 || Array.isArray(request.tools) && request.tools.every((tool) => isRecord(tool) && tool.type === "function"));
|
|
183
|
+
}
|
|
184
|
+
var ResponsesOutputIdentityError = class extends Error {
|
|
185
|
+
constructor(details) {
|
|
186
|
+
super("Responses stream changed output item identity");
|
|
187
|
+
this.code = OUTPUT_IDENTITY_ERROR_CODE;
|
|
188
|
+
this.name = "ResponsesOutputIdentityError";
|
|
189
|
+
this.errorBody = JSON.stringify({
|
|
190
|
+
...details,
|
|
191
|
+
expectedType: outputType(details.expectedType),
|
|
192
|
+
actualType: outputType(details.actualType),
|
|
193
|
+
mismatch: details.expectedType !== details.actualType ? "type" : "call_id",
|
|
194
|
+
eventType: details.eventType === "response.output_item.added" || details.eventType === "response.output_item.done" || details.eventType === "response.completed" || details.eventType === "response.incomplete" ? details.eventType : "unknown",
|
|
195
|
+
retrySafe: details.retrySafe && !details.completedToolCall
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
/** Resume only a response that could not have completed tools or exposed visible output. */
|
|
200
|
+
function resolveResponsesOutputIdentityRetry(message) {
|
|
201
|
+
if (message.errorCode !== OUTPUT_IDENTITY_ERROR_CODE) return;
|
|
202
|
+
return message.stopReason === "error" && message.content?.every((block) => block.type === "thinking" || block.type === "text" && block.text.length === 0) === true && safeParseJsonRecord(message.errorBody ?? "")?.retrySafe === true ? "retry" : "stop";
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
157
205
|
//#region packages/ai/src/utils/retryable-network-errors.ts
|
|
158
206
|
const WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE = "ERR_WEBSOCKET_NON_RETRYABLE_CLOSE";
|
|
159
207
|
const TRANSIENT_NETWORK_CODES = /* @__PURE__ */ new Set([
|
|
@@ -260,12 +308,9 @@ function resolveModelSseDebugMode(env = process.env) {
|
|
|
260
308
|
function isModelTransportDebugEnabled(env = process.env) {
|
|
261
309
|
return isTruthyEnv(env.OPENCLAW_DEBUG_MODEL_TRANSPORT) || resolveModelPayloadDebugMode(env) !== "off" || resolveModelSseDebugMode(env) !== "off" || isTruthyEnv(env.OPENCLAW_DEBUG_CODE_MODE);
|
|
262
310
|
}
|
|
263
|
-
|
|
264
|
-
return message.startsWith("[model-fetch]");
|
|
265
|
-
}
|
|
266
|
-
/** Emits model-fetch metadata at info level by default; other diagnostics require debug env. */
|
|
311
|
+
/** Emits transport diagnostics at debug, promoted to info by explicit debug flags. */
|
|
267
312
|
function emitModelTransportDebug(log, message) {
|
|
268
|
-
if (
|
|
313
|
+
if (isModelTransportDebugEnabled()) {
|
|
269
314
|
log.info(message);
|
|
270
315
|
return;
|
|
271
316
|
}
|
|
@@ -295,4 +340,4 @@ function formatModelTransportDebugBaseUrl(rawUrl) {
|
|
|
295
340
|
return rawUrl ? formatModelTransportDebugUrl(rawUrl) : "default";
|
|
296
341
|
}
|
|
297
342
|
//#endregion
|
|
298
|
-
export { resolveModelSseDebugMode as a, isTransientNetworkError as c,
|
|
343
|
+
export { extractErrorCodeOrErrno as _, resolveModelSseDebugMode as a, isTransientNetworkError as c, isResponsesProviderTool as d, resolveResponsesOutputIdentityRetry as f, resolveResponsesTerminalStopReason as g, readResponsesReasoningTokens as h, resolveModelPayloadDebugMode as i, ResponsesOutputIdentityError as l, mapResponsesTerminalUsage as m, formatModelTransportDebugUrl as n, WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE as o, isResponsesOutputLimitToolCallError as p, emitModelTransportDebug as r, hasRetryableConnectionErrorCode as s, formatModelTransportDebugBaseUrl as t, hasOnlyResponsesFunctionTools as u, toErrorObject as v };
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
import { Guard } from "typebox/guard";
|
|
2
|
+
//#region packages/llm-core/src/utils/provider-refusal.ts
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
function isBoundedText(value, maxBytes) {
|
|
5
|
+
return typeof value === "string" && value.length <= maxBytes && value.trim().length > 0 && encoder.encode(value).byteLength <= maxBytes;
|
|
6
|
+
}
|
|
7
|
+
/** Keep exact provider text. Truncation must never make an invalid continuation usable. */
|
|
8
|
+
function readProviderRefusalReview(value) {
|
|
9
|
+
if (!Guard.IsObjectNotArray(value) || !isBoundedText(value.explanation, 65536)) return;
|
|
10
|
+
const continuation = Guard.IsObjectNotArray(value.continuation) ? value.continuation.message : void 0;
|
|
11
|
+
return {
|
|
12
|
+
explanation: value.explanation,
|
|
13
|
+
...isBoundedText(continuation, 1024) ? { continuation: { message: continuation } } : {},
|
|
14
|
+
...typeof value.errorType === "string" && value.errorType.trim() ? { errorType: value.errorType } : {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
1
18
|
//#region packages/llm-core/src/utils/diagnostics.ts
|
|
2
19
|
/** True when the provider explicitly refused the request payload. */
|
|
3
20
|
function isProviderRefusalAssistantError(message) {
|
|
@@ -37,4 +54,4 @@ function appendAssistantMessageDiagnostic(message, diagnostic) {
|
|
|
37
54
|
message.diagnostics = [...message.diagnostics ?? [], diagnostic];
|
|
38
55
|
}
|
|
39
56
|
//#endregion
|
|
40
|
-
export { isProviderRefusalAssistantError as a, formatThrownValue as i, createAssistantMessageDiagnostic as n, extractDiagnosticError as r, appendAssistantMessageDiagnostic as t };
|
|
57
|
+
export { isProviderRefusalAssistantError as a, formatThrownValue as i, createAssistantMessageDiagnostic as n, readProviderRefusalReview as o, extractDiagnosticError as r, appendAssistantMessageDiagnostic as t };
|
package/dist/diagnostics.d.mts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { a as ProviderRefusalReview, o as readProviderRefusalReview } from "./index-C25RT6bP.mjs";
|
|
2
|
+
import { a as AssistantMessage, dt as DiagnosticErrorInfo, ft as appendAssistantMessageDiagnostic, gt as isProviderRefusalAssistantError, ht as formatThrownValue, mt as extractDiagnosticError, pt as createAssistantMessageDiagnostic, ut as AssistantMessageDiagnostic } from "./types-qZFbaDbK.mjs";
|
|
3
|
+
import "./types-DTvddOfm.mjs";
|
|
4
|
+
import { n as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-BNFbvY9f.mjs";
|
|
5
|
+
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-xumb1V3F.mjs";
|
|
4
6
|
import { r as projectDiagnosticValue, t as DiagnosticProjectionPolicy } from "./credential-redaction-BKv49aiv.mjs";
|
|
5
|
-
import { n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-
|
|
7
|
+
import { n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-C5f59L3Y.mjs";
|
|
8
|
+
//#region packages/ai/src/transports/openai-responses-stream-errors.d.ts
|
|
9
|
+
/** Resume only a response that could not have completed tools or exposed visible output. */
|
|
10
|
+
export declare function resolveResponsesOutputIdentityRetry(message: Pick<AssistantMessage, "errorCode"> & Partial<Pick<AssistantMessage, "stopReason" | "errorBody" | "content">>): "retry" | "stop" | undefined;
|
|
11
|
+
//#endregion
|
|
6
12
|
//#region packages/ai/src/utils/retryable-network-errors.d.ts
|
|
7
13
|
export declare const WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE = "ERR_WEBSOCKET_NON_RETRYABLE_CLOSE";
|
|
8
14
|
export declare function hasRetryableConnectionErrorCode(message: string): boolean;
|
|
9
15
|
/** Returns true when any nested error proves a transient network failure. */
|
|
10
16
|
export declare function isTransientNetworkError(err: unknown): boolean;
|
|
11
17
|
//#endregion
|
|
12
|
-
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, projectDiagnosticValue };
|
|
18
|
+
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor, type ProviderRefusalReview, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, projectDiagnosticValue, readProviderRefusalReview };
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
2
|
-
import { i as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
3
|
-
import { c as isTransientNetworkError,
|
|
4
|
-
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue };
|
|
1
|
+
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
|
+
import { i as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-CRhW7lkJ.mjs";
|
|
3
|
+
import { c as isTransientNetworkError, f as resolveResponsesOutputIdentityRetry, n as formatModelTransportDebugUrl, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, p as isResponsesOutputLimitToolCallError, r as emitModelTransportDebug, s as hasRetryableConnectionErrorCode, t as formatModelTransportDebugBaseUrl } from "./diagnostics-CH8j2wIG.mjs";
|
|
4
|
+
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue, readProviderRefusalReview, resolveResponsesOutputIdentityRetry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-CjnIZZst.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ThinkingContent, a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-
|
|
1
|
+
import { $ as ThinkingContent, a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-qZFbaDbK.mjs";
|
|
2
2
|
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
3
3
|
/** Returns only an append whose current and previously observed snapshots still match. */
|
|
4
4
|
declare function readAssistantThinkingAppend(block: ThinkingContent, previous: string): string | undefined;
|
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-CjnIZZst.mjs";
|
|
2
|
+
import "./event-stream-C0nsgbj2.mjs";
|
|
3
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.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-yTvBrYM2.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-np1XPuhm.mjs";
|
|
4
4
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
5
|
-
import { u as mergeTransportHeaders } from "./transport-stream-shared-
|
|
6
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
5
|
+
import { u as mergeTransportHeaders } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
6
|
+
import { t as createAssistantOutput } from "./assistant-output-DM1JBNs1.mjs";
|
|
7
7
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Bcunsn4I.mjs";
|
|
8
|
-
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
8
|
+
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-Bok4I6zB.mjs";
|
|
9
9
|
import { GoogleGenAI } from "@google/genai";
|
|
10
10
|
//#region packages/ai/src/providers/google.ts
|
|
11
11
|
let toolCallCounter = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as appendAssistantThinking } from "./event-stream-D8PARQfL.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { v as sortPromptCacheToolsByName } from "./simple-options-
|
|
4
|
-
import { _ as sanitizeTransportPayloadText, r as coerceTransportToolCallArguments, v as transportAbortError } from "./transport-stream-shared-
|
|
2
|
+
import { M as calculateCost, _ as isImageWithMediaPayload, d as describeToolResultMediaPlaceholder, m as extractToolResultText, v as sanitizeSurrogates } from "./host-yTvBrYM2.mjs";
|
|
3
|
+
import { v as sortPromptCacheToolsByName } from "./simple-options-np1XPuhm.mjs";
|
|
4
|
+
import { _ as sanitizeTransportPayloadText, r as coerceTransportToolCallArguments, v as transportAbortError } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
5
5
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
6
6
|
//#region packages/ai/src/transports/google-thinking-level.ts
|
|
7
7
|
/** Returns whether a Gemini Flash model accepts the MINIMAL thinking level. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
3
|
-
import { m as notifyProviderStreamOpened, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-
|
|
4
|
-
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-
|
|
5
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
1
|
+
import { N as clampThinkingLevel, v as sanitizeSurrogates } from "./host-yTvBrYM2.mjs";
|
|
2
|
+
import { m as stripSystemPromptCacheBoundary } from "./simple-options-np1XPuhm.mjs";
|
|
3
|
+
import { m as notifyProviderStreamOpened, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
4
|
+
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-DB7GKkDk.mjs";
|
|
5
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-BTocjCRs.mjs";
|
|
6
6
|
import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google-shared.ts
|
|
8
8
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
2
2
|
import { a as normalizeOptionalString } from "./string-coerce-fsri9iCu.mjs";
|
|
3
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
6
|
-
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-yTvBrYM2.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-np1XPuhm.mjs";
|
|
5
|
+
import { t as createAssistantOutput } from "./assistant-output-DM1JBNs1.mjs";
|
|
6
|
+
import { n as buildGoogleSimpleThinking, r as runGoogleGenerateContentLifecycle, t as buildGoogleGenerateContentParams } from "./google-shared-Bok4I6zB.mjs";
|
|
7
7
|
import { GoogleGenAI, ResourceScope } from "@google/genai";
|
|
8
8
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
9
9
|
const API_VERSION = "v1";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { O as Model, d as Context, n as Api, q as StreamFn } from "./types-
|
|
3
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import "./index-C25RT6bP.mjs";
|
|
2
|
+
import { O as Model, d as Context, n as Api, q as StreamFn } from "./types-qZFbaDbK.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-C2T3lTV7.mjs";
|
|
4
4
|
//#region packages/ai/src/host.d.ts
|
|
5
5
|
/** Provider capability facts needed by the package-owned transports. */
|
|
6
6
|
interface AiProviderRequestCapabilities {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getAiTransportHost } from "./host-
|
|
1
|
+
import { n as getAiTransportHost } from "./host-yTvBrYM2.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/host-policy.ts
|
|
3
3
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
4
4
|
const host = getAiTransportHost();
|