@openclaw/ai 2026.10.2 → 2026.10.5-beta.2
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/README.md +6 -0
- package/dist/{anthropic-C4qygbtf.mjs → anthropic-BalhAzs-.mjs} +33 -63
- package/dist/{anthropic-payload-policy-DD7vzpxE.d.mts → anthropic-payload-policy-DGblkHL5.d.mts} +19 -19
- package/dist/{anthropic-stream-reducer-CWyWE21W.mjs → anthropic-stream-reducer-DkKeXXx4.mjs} +215 -297
- package/dist/{api-registry-B3rC2qu3.d.mts → api-registry-BhXXYdRA.d.mts} +2 -2
- package/dist/assistant-message-events-CHMJgbhs.mjs +18 -0
- package/dist/{assistant-output-D5762GPH.mjs → assistant-output-BuhRpLeD.mjs} +2 -2
- package/dist/{assistant-text-phase-DVZOxbuR.mjs → assistant-text-phase-Bn1hbvK9.mjs} +7 -6
- package/dist/{azure-openai-responses-DO-Fv8ha.mjs → azure-openai-responses-DfT9Ndd8.mjs} +8 -9
- package/dist/{credential-redaction-BKv49aiv.d.mts → credential-redaction-BHxruEH6.d.mts} +3 -1
- package/dist/{diagnostics-Caj-4RBA.mjs → diagnostics-tQasYct1.mjs} +10 -3
- package/dist/diagnostics.d.mts +7 -7
- package/dist/diagnostics.mjs +3 -3
- package/dist/{env-api-keys-CyX4VKGO.mjs → env-api-keys-CrxwdylR.mjs} +24 -35
- package/dist/event-stream-6UNs-AhN.d.mts +1 -0
- package/dist/{event-stream-DrRM_90c.d.mts → event-stream-BcqWLo_u.d.mts} +1 -1
- package/dist/{event-stream-C5AbCAaZ.mjs → event-stream-X2gmsUWv.mjs} +5 -8
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-interactions-DNXzPPwQ.mjs → google-interactions-9SSqsJg9.mjs} +52 -84
- package/dist/{google-messages-l7wgIF5I.mjs → google-messages-DsB7fmoQ.mjs} +26 -35
- package/dist/google-provider-stream-CcEI2-MC.mjs +58 -0
- package/dist/google-sYI2wnY6.mjs +20 -0
- package/dist/{google-shared-V8jogVPq.mjs → google-shared-zGR0QUyS.mjs} +6 -15
- package/dist/google-vertex-Dw_abY1w.mjs +40 -0
- package/dist/{host-u3o8XiAp.mjs → host-Bf3NjYNj.mjs} +3 -2
- package/dist/{host-DiPhRjrc.d.mts → host-CTDz7LXD.d.mts} +6 -3
- package/dist/{host-policy-BwhNNGQR.mjs → host-policy-BzZluO6_.mjs} +1 -1
- package/dist/{index-D27wAoOr.d.mts → index-BYDvopUB.d.mts} +8 -7
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +7 -6
- package/dist/internal/anthropic.d.mts +5 -5
- package/dist/internal/anthropic.mjs +4 -4
- 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 +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +9 -9
- package/dist/internal/openai.mjs +9 -11
- package/dist/internal/runtime.d.mts +31 -13
- package/dist/internal/runtime.mjs +10 -13
- package/dist/internal/shared.d.mts +5 -5
- package/dist/internal/shared.mjs +6 -7
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{llm-request-activity-D8f_oxHj.mjs → llm-request-activity-CfMuh5cC.mjs} +2 -2
- package/dist/{mistral-cnoBDSIg.mjs → mistral-dCDCR5ur.mjs} +71 -146
- package/dist/{model-transport-url-C5f59L3Y.d.mts → model-transport-url-BrsjjdjR.d.mts} +5 -1
- package/dist/{number-coercion-V8-BhME4.mjs → number-coercion-C3hztWoY.mjs} +5 -4
- package/dist/{openai-chatgpt-responses-CHdn8YJ_.mjs → openai-chatgpt-responses-V4iP0dv5.mjs} +118 -194
- package/dist/{openai-completions-BZfHIaZ7.mjs → openai-completions-BY-kr5IS.mjs} +7 -6
- package/dist/{openai-completions-compat-GMN8A0fm.mjs → openai-completions-compat-CYX18uDk.mjs} +10 -6
- package/dist/{openai-completions-compat-BgPg1BRs.d.mts → openai-completions-compat-i-nLZxFy.d.mts} +10 -11
- package/dist/{openai-completions-transport-CuoQfnKV.mjs → openai-completions-transport-v38m71Oq.mjs} +1449 -294
- package/dist/{openai-prompt-cache-CFviG_D4.d.mts → openai-prompt-cache-DIPMrMFy.d.mts} +2 -2
- package/dist/{openai-prompt-cache-BK6E2g4Q.mjs → openai-prompt-cache-r93BJhjm.mjs} +1 -1
- package/dist/{openai-responses-BhAZFsL9.mjs → openai-responses-D5oiAUOG.mjs} +9 -10
- package/dist/{openai-responses-compaction-replay-BBNo098-.d.mts → openai-responses-compaction-replay-B2FE4Nw8.d.mts} +4 -4
- package/dist/{openai-responses-contracts-D5yVZBp-.d.mts → openai-responses-contracts-DKqMJ1Ct.d.mts} +9 -4
- package/dist/{openai-responses-contracts-BKu8O7l4.mjs → openai-responses-contracts-DlKMMTxK.mjs} +26 -6
- package/dist/{openai-responses-compaction-window-tA4QkU0o.mjs → openai-responses-endpoint-CinGh4VZ.mjs} +17 -7
- package/dist/{openai-responses-payload-policy-s1apQlZZ.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +2 -4
- package/dist/{openai-responses-prompt-observer-internal-CefUzh8M.mjs → openai-responses-request-lifecycle-NSIJo9jY.mjs} +39 -4
- package/dist/{openai-responses-shared-CKNmC3vC.mjs → openai-responses-shared-D-aDYAkJ.mjs} +1037 -328
- package/dist/{openai-responses-terminal-usage-CempLedn.d.mts → openai-responses-terminal-usage-BygjiAdi.d.mts} +2 -2
- package/dist/{openai-tool-schema-BIrI0mrA.mjs → openai-tool-schema-DDPXsvJP.mjs} +220 -400
- package/dist/{positive-integer-CwLi8LUL.mjs → positive-integer-CqWjqSi9.mjs} +1 -1
- package/dist/{provider-error-DQBE1bUQ.mjs → provider-error-CF9GWCs2.mjs} +5 -3
- package/dist/{provider-options-CkieKvNJ.d.mts → provider-options-CVrXZBtA.d.mts} +6 -10
- package/dist/{provider-transport-turn-state-BX6TfCyW.mjs → provider-transport-turn-state-BOpxgm-J.mjs} +2 -2
- package/dist/{provider-types-v3bmqsfg.d.mts → provider-types-CHtRx0dI.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +12 -12
- package/dist/{reasoning-tag-text-partitioner-Ju9VpUGl.mjs → reasoning-tag-text-partitioner-CpOy9-IQ.mjs} +374 -235
- package/dist/{required-api-key-D4kn3252.mjs → required-api-key-CFJvcFy_.mjs} +1 -1
- package/dist/{simple-options-7QuSKriJ.mjs → simple-options-BAu4B54D.mjs} +9 -11
- package/dist/{src-VWy9E7DZ.mjs → src-C44MKrW5.mjs} +20 -9
- package/dist/{stream-DFaRxi2D.mjs → stream-Dd8DwRFL.mjs} +12 -21
- package/dist/{stream-first-event-timeout-D9ZmL_s9.mjs → stream-first-event-timeout-Dc42hKv6.mjs} +8 -21
- package/dist/{streaming-byte-guard-CC-HMn_u.mjs → streaming-byte-guard-DBXr1XYn.mjs} +16 -1
- package/dist/{string-normalization-PN10hf6d.mjs → string-normalization-I3ux50s9.mjs} +1 -1
- package/dist/{text-signature-D_vRrx-z.mjs → text-signature-Drb4Erb8.mjs} +32 -5
- package/dist/{tool-schema-json-projection-Ct8SeBeJ.mjs → tool-schema-json-projection-B8sG1I9v.mjs} +29 -23
- package/dist/{transport-stream-shared-DW-7-qLR.d.mts → transport-stream-shared-BmpzDtdQ.d.mts} +4 -4
- package/dist/{transport-stream-shared-CCR7hSW0.mjs → transport-stream-shared-CWGOuLcA.mjs} +8 -16
- package/dist/transports.d.mts +34 -23
- package/dist/transports.mjs +76 -1235
- package/dist/{types-DvzmWW8J.d.mts → types-Bd2T86VJ.d.mts} +5 -23
- package/dist/types-Kdfw_04V.d.mts +1 -0
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +5 -4
- package/dist/{validation-B3lQt_VE.d.mts → validation-DdGB1yy3.d.mts} +1 -1
- package/dist/{validation-DbqlIfDn.mjs → validation-ZX_sPVV0.mjs} +3 -9
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +4 -9
- package/dist/env-api-keys-BR0MUYYD.d.mts +0 -17
- package/dist/event-stream-DqDQWqiy.d.mts +0 -1
- package/dist/google-B2g_Xn4d.mjs +0 -54
- package/dist/google-vertex-_khoip47.mjs +0 -88
- package/dist/internal/env-api-keys.d.mts +0 -2
- package/dist/internal/env-api-keys.mjs +0 -2
- package/dist/openai-responses-endpoint-TV0y50fb.mjs +0 -11
- package/dist/openai-responses-request-lifecycle-Fsag-IGZ.mjs +0 -36
- package/dist/openai-transport-params-D7JMUPjf.mjs +0 -735
- package/dist/openai-web-search-tools-Cfu0uLyN.mjs +0 -14
- package/dist/provider-replay-context-CO_Eplnc.mjs +0 -25
- package/dist/types-UlNana-2.d.mts +0 -1
package/README.md
CHANGED
|
@@ -26,6 +26,12 @@ runtime-local policy can use `createNodeLlmRuntime`; it preserves that host acro
|
|
|
26
26
|
provider work without replacing the process default. `createLlmRuntime` continues
|
|
27
27
|
to use the process-default host.
|
|
28
28
|
|
|
29
|
+
Hosts that attach request state to async contexts should supply
|
|
30
|
+
`runInDetachedAsyncContext` from a context-free root initialized before requests
|
|
31
|
+
start. Retained HTTP continuation timers use it at creation so completed caller
|
|
32
|
+
state can be collected while the response remains reusable for 90 minutes.
|
|
33
|
+
The default host runs the callback directly, including in browsers.
|
|
34
|
+
|
|
29
35
|
The explicit `@openclaw/ai/internal/anthropic`, `google-model-family`, `openai`,
|
|
30
36
|
`openai-completions-compat`, `openai-responses-payload-policy`, `retry-after`, `runtime`, `shared`, and
|
|
31
37
|
`tool-schema` subpaths exist for the OpenClaw application itself.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { w as supportsClaudeAdaptiveThinking } from "./src-
|
|
3
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { w as supportsClaudeAdaptiveThinking } from "./src-C44MKrW5.mjs";
|
|
3
|
+
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
4
|
+
import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
|
|
5
|
+
import { d as streamFragmentError } from "./text-signature-Drb4Erb8.mjs";
|
|
6
|
+
import { D as suppressAnthropicCompaction, J as isAnthropicOAuthApiKey, P as isDirectAnthropicModel, T as isAnthropicReplayRejection, V as supportsAnthropicServerSideFallback, X as usesFoundryBearerAuth, Y as omitFoundryBearerCredentialHeaders, d as applyAnthropicThinkingOptions, l as buildAnthropicRequest, t as consumeAnthropicStream, u as prepareAnthropicRequest } from "./anthropic-stream-reducer-DkKeXXx4.mjs";
|
|
7
7
|
import { i as resolveCacheRetention, n as resolveCloudflareBaseUrl, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
8
|
-
import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-
|
|
9
|
-
import { n as buildBaseOptions, r as clampMaxTokensToModel
|
|
10
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
8
|
+
import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-CWGOuLcA.mjs";
|
|
9
|
+
import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-BAu4B54D.mjs";
|
|
10
|
+
import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
|
|
11
11
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
12
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
13
|
-
import { t as notifyLlmRequestActivity } from "./llm-request-activity-
|
|
12
|
+
import { t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
|
|
13
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
14
14
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
15
|
-
import { t as requireApiKey } from "./required-api-key-
|
|
15
|
+
import { t as requireApiKey } from "./required-api-key-CFJvcFy_.mjs";
|
|
16
16
|
import Anthropic from "@anthropic-ai/sdk";
|
|
17
17
|
import { Stream } from "@anthropic-ai/sdk/core/streaming.js";
|
|
18
18
|
//#region packages/ai/src/providers/anthropic.ts
|
|
@@ -48,8 +48,7 @@ async function* iterateAnthropicEvents(response, signal) {
|
|
|
48
48
|
try {
|
|
49
49
|
yield parseJsonWithRepair(sse.data);
|
|
50
50
|
} catch (error) {
|
|
51
|
-
|
|
52
|
-
throw error;
|
|
51
|
+
throw streamFragmentError(error);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -60,29 +59,11 @@ const streamAnthropic = (model, context, options) => {
|
|
|
60
59
|
(async () => {
|
|
61
60
|
const output = createAssistantOutput(model);
|
|
62
61
|
const refusalBuffer = usesClaudeStreamingRefusalContract(model) ? createDeferredEventBuffer(stream) : void 0;
|
|
63
|
-
let
|
|
62
|
+
let usedCompactionReplay = false;
|
|
64
63
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
let directApiKeyBetaHeader;
|
|
69
|
-
let claudeCodeVersion;
|
|
70
|
-
if (requestOptions?.client) {
|
|
71
|
-
client = requestOptions.client;
|
|
72
|
-
isOAuth = false;
|
|
73
|
-
} else {
|
|
74
|
-
const apiKey = requestOptions?.apiKey ?? getEnvApiKey(model.provider) ?? "";
|
|
75
|
-
const copilotDynamicHeaders = model.provider === "github-copilot" ? buildCopilotDynamicHeaders(requestContext.messages) : void 0;
|
|
76
|
-
const cacheSessionId = (requestOptions?.cacheRetention ?? resolveCacheRetention()) === "none" ? void 0 : requestOptions?.sessionId;
|
|
77
|
-
const created = createClient(model, apiKey, requestOptions?.thinkingEnabled === true, requestOptions?.interleavedThinking ?? true, Boolean(requestContext.tools?.length) && !getAnthropicCompat(model).supportsEagerToolInputStreaming, resolveOpencodeSessionHeaders(model, requestOptions), copilotDynamicHeaders, cacheSessionId);
|
|
78
|
-
client = created.client;
|
|
79
|
-
isOAuth = created.isOAuthToken;
|
|
80
|
-
serverSideFallback = created.serverSideFallback;
|
|
81
|
-
directApiKeyBetaHeader = created.directApiKeyBetaHeader;
|
|
82
|
-
claudeCodeVersion = created.claudeCodeVersion;
|
|
83
|
-
}
|
|
84
|
-
const builtParams = await buildAnthropicRequest(model, requestContext, requestOptions, "provider", isOAuth, serverSideFallback, claudeCodeVersion);
|
|
85
|
-
replayedCompaction = builtParams.replayedCompaction;
|
|
64
|
+
const { client, isOAuthToken, serverSideFallback, directApiKeyBetaHeader, claudeCodeVersion } = createClient(model, requestContext, requestOptions);
|
|
65
|
+
const builtParams = await buildAnthropicRequest(model, requestContext, requestOptions, "provider", isOAuthToken, serverSideFallback, claudeCodeVersion);
|
|
66
|
+
usedCompactionReplay = builtParams.usedCompactionReplay;
|
|
86
67
|
const { params, headers } = await prepareAnthropicRequest(builtParams.params, model, requestOptions, directApiKeyBetaHeader);
|
|
87
68
|
const sdkRequestOptions = {
|
|
88
69
|
...requestOptions?.signal ? { signal: requestOptions.signal } : {},
|
|
@@ -106,7 +87,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
106
87
|
output,
|
|
107
88
|
stream,
|
|
108
89
|
refusalBuffer,
|
|
109
|
-
isOAuthToken
|
|
90
|
+
isOAuthToken,
|
|
110
91
|
toolProjection: builtParams.toolProjection,
|
|
111
92
|
profile: "provider"
|
|
112
93
|
});
|
|
@@ -125,7 +106,7 @@ const streamAnthropic = (model, context, options) => {
|
|
|
125
106
|
refusalBuffer.discard();
|
|
126
107
|
output.content = [];
|
|
127
108
|
}
|
|
128
|
-
if (
|
|
109
|
+
if (usedCompactionReplay && isAnthropicReplayRejection(error)) suppressAnthropicCompaction(output, model, requestOptions);
|
|
129
110
|
stream.push({
|
|
130
111
|
type: "error",
|
|
131
112
|
reason: terminal.stopReason,
|
|
@@ -154,38 +135,27 @@ const streamSimpleAnthropic = (model, context, options) => {
|
|
|
154
135
|
anthropicServerCompaction: options?.anthropicServerCompaction,
|
|
155
136
|
anthropicCompactThreshold: options?.anthropicCompactThreshold,
|
|
156
137
|
cacheTtlPruning: options?.cacheTtlPruning,
|
|
157
|
-
onCompactionRejected: options?.onCompactionRejected,
|
|
158
138
|
authProfileId: options?.authProfileId,
|
|
159
139
|
maxTokens: clampMaxTokensToModel(model, options?.maxTokens ?? model.maxTokens),
|
|
160
140
|
toolChoice: options?.toolChoice,
|
|
161
141
|
thinkingDisplay: options?.thinkingDisplay
|
|
162
142
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
...base,
|
|
166
|
-
thinkingEnabled: false
|
|
167
|
-
});
|
|
168
|
-
const reasoning = options?.reasoning === "off" ? "low" : options?.reasoning;
|
|
169
|
-
if (defaultsClaudeAdaptiveThinking(model) || reasoning && supportsClaudeAdaptiveThinking(model)) return streamAnthropic(model, context, {
|
|
170
|
-
...base,
|
|
171
|
-
thinkingEnabled: true,
|
|
172
|
-
effort: resolveAnthropicThinkingEffort(model, reasoning)
|
|
173
|
-
});
|
|
174
|
-
if (!reasoning) return streamAnthropic(model, context, {
|
|
175
|
-
...base,
|
|
176
|
-
thinkingEnabled: mandatoryAdaptiveThinking
|
|
177
|
-
});
|
|
178
|
-
const adjusted = adjustMaxTokensForThinking(base.maxTokens, model.maxTokens ?? base.maxTokens, reasoning, options?.thinkingBudgets);
|
|
179
|
-
const thinkingEnabled = adjusted.thinkingBudget >= ANTHROPIC_MIN_THINKING_BUDGET_TOKENS;
|
|
180
|
-
const maxTokens = thinkingEnabled ? adjusted.maxTokens : clampMaxTokensToModel(model, options?.maxTokens ?? model.maxTokens);
|
|
181
|
-
return streamAnthropic(model, context, {
|
|
182
|
-
...base,
|
|
183
|
-
maxTokens,
|
|
184
|
-
thinkingEnabled,
|
|
185
|
-
thinkingBudgetTokens: thinkingEnabled ? adjusted.thinkingBudget : void 0
|
|
186
|
-
});
|
|
143
|
+
applyAnthropicThinkingOptions(model, base, options, "provider");
|
|
144
|
+
return streamAnthropic(model, context, base);
|
|
187
145
|
};
|
|
188
|
-
function createClient(model,
|
|
146
|
+
function createClient(model, context, options) {
|
|
147
|
+
if (options?.client) return {
|
|
148
|
+
client: options.client,
|
|
149
|
+
isOAuthToken: false,
|
|
150
|
+
serverSideFallback: false
|
|
151
|
+
};
|
|
152
|
+
const apiKey = options?.apiKey ?? getEnvApiKey(model.provider) ?? "";
|
|
153
|
+
const dynamicHeaders = model.provider === "github-copilot" ? buildCopilotDynamicHeaders(context.messages) : void 0;
|
|
154
|
+
const sessionId = (options?.cacheRetention ?? resolveCacheRetention()) === "none" ? void 0 : options?.sessionId;
|
|
155
|
+
const thinkingEnabled = options?.thinkingEnabled === true;
|
|
156
|
+
const interleavedThinking = options?.interleavedThinking ?? true;
|
|
157
|
+
const useFineGrainedToolStreamingBeta = Boolean(context.tools?.length) && !getAnthropicCompat(model).supportsEagerToolInputStreaming;
|
|
158
|
+
const optionsHeaders = resolveOpencodeSessionHeaders(model, options);
|
|
189
159
|
const needsInterleavedBeta = interleavedThinking && !supportsClaudeAdaptiveThinking(model);
|
|
190
160
|
const betaFeatures = [];
|
|
191
161
|
if (useFineGrainedToolStreamingBeta) betaFeatures.push(FINE_GRAINED_TOOL_STREAMING_BETA);
|
package/dist/{anthropic-payload-policy-DD7vzpxE.d.mts → anthropic-payload-policy-DGblkHL5.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { k as Model } from "./types-
|
|
3
|
-
import { t as AnthropicContextManagementOptions } from "./provider-options-
|
|
1
|
+
import "./index-BYDvopUB.mjs";
|
|
2
|
+
import { k as Model } from "./types-Bd2T86VJ.mjs";
|
|
3
|
+
import { t as AnthropicContextManagementOptions } from "./provider-options-CVrXZBtA.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. */
|
|
@@ -23,26 +23,12 @@ type AnthropicPayloadPolicyInput = {
|
|
|
23
23
|
serviceTier?: AnthropicServiceTier;
|
|
24
24
|
};
|
|
25
25
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
26
|
-
type AnthropicPayloadPolicy =
|
|
27
|
-
allowsServiceTier: boolean;
|
|
28
|
-
cacheControl: AnthropicEphemeralCacheControl | undefined;
|
|
29
|
-
compactThreshold: number;
|
|
30
|
-
serviceTier: AnthropicServiceTier | undefined;
|
|
31
|
-
useServerCompaction: boolean;
|
|
32
|
-
toolClearing?: {
|
|
33
|
-
trigger: number;
|
|
34
|
-
clearAtLeast: number;
|
|
35
|
-
tools: NonNullable<AnthropicContextManagementOptions["cacheTtlPruning"]>["tools"];
|
|
36
|
-
};
|
|
37
|
-
};
|
|
26
|
+
type AnthropicPayloadPolicy = ReturnType<typeof resolveAnthropicPayloadPolicy>;
|
|
38
27
|
/** Resolve the server-compaction gate and effective threshold for an Anthropic route. */
|
|
39
28
|
declare function resolveAnthropicServerCompactionPlan(model: {
|
|
40
|
-
id?: string;
|
|
41
|
-
params?: Record<string, unknown>;
|
|
42
29
|
provider?: unknown;
|
|
43
30
|
api?: unknown;
|
|
44
31
|
baseUrl?: string;
|
|
45
|
-
contextTokens?: unknown;
|
|
46
32
|
contextWindow?: unknown;
|
|
47
33
|
}, extraParams?: Record<string, unknown>, apiKey?: string): {
|
|
48
34
|
enabled: boolean;
|
|
@@ -74,7 +60,21 @@ declare function applyAnthropicRequestCacheControl(payload: {
|
|
|
74
60
|
messages?: unknown;
|
|
75
61
|
}, cacheControl: AnthropicEphemeralCacheControl | undefined, supportsCacheControlOnTools: boolean, cacheBreakpointOptOutMessageIndexes?: ReadonlySet<number>): void;
|
|
76
62
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
77
|
-
declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput, model?: Model):
|
|
63
|
+
declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput, model?: Model): {
|
|
64
|
+
allowsServiceTier: boolean;
|
|
65
|
+
cacheControl: AnthropicEphemeralCacheControl | undefined;
|
|
66
|
+
compactThreshold: number;
|
|
67
|
+
serviceTier: AnthropicServiceTier | undefined;
|
|
68
|
+
useServerCompaction: boolean;
|
|
69
|
+
toolClearing?: {
|
|
70
|
+
trigger: number;
|
|
71
|
+
clearAtLeast: number;
|
|
72
|
+
tools: {
|
|
73
|
+
allow?: string[];
|
|
74
|
+
deny?: string[];
|
|
75
|
+
} | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
};
|
|
78
78
|
type AnthropicContextManagementPayload = {
|
|
79
79
|
context_management?: unknown;
|
|
80
80
|
tools?: unknown;
|