@openclaw/ai 2026.9.1-beta.1 → 2026.9.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/dist/{anthropic-DI4PZKKB.mjs → anthropic-BDdqdVLK.mjs} +222 -216
- package/dist/{anthropic-compaction-replay-nhKaCXu6.mjs → anthropic-compaction-replay-DB2FGLQc.mjs} +160 -68
- package/dist/{anthropic-payload-policy-B_0n0enE.d.mts → anthropic-payload-policy-d46X2pR0.d.mts} +28 -4
- package/dist/{api-registry-CTd8NzcD.d.mts → api-registry-DWtPjzyn.d.mts} +2 -2
- package/dist/{azure-openai-responses-D8dI0ekg.mjs → azure-openai-responses-C5bZRfAP.mjs} +12 -9
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/{diagnostics-COpOtRwq.mjs → diagnostics-CPeq9F7y.mjs} +5 -1
- package/dist/diagnostics-DfFyKeX_.mjs +136 -0
- package/dist/{diagnostics-BaTA9eVl.d.mts → diagnostics-DnPnOui6.d.mts} +5 -1
- package/dist/diagnostics.d.mts +8 -3
- package/dist/diagnostics.mjs +4 -3
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/{event-stream-uSMZJ3FA.mjs → event-stream-BgDvQeum.mjs} +3 -9
- package/dist/{event-stream-LiXePESD.d.mts → event-stream-BhT5T1Ay.d.mts} +1 -1
- package/dist/event-stream-zctLx0yr.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-Od-LLdVK.mjs → google-4qeuE8iX.mjs} +9 -7
- package/dist/{google-shared-Bgr9lFPw.mjs → google-shared-CWeG8RIl.mjs} +27 -23
- package/dist/{google-vertex-aerRSXc4.mjs → google-vertex-O9BcnB6X.mjs} +8 -6
- package/dist/{host-D51fmkH6.mjs → host-CEvLw30U.mjs} +54 -9
- package/dist/{host-DsbPMFU6.d.mts → host-DjzGmdZ2.d.mts} +3 -3
- package/dist/index-FnHM2FcI.d.mts +117 -0
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +6 -6
- package/dist/internal/anthropic.d.mts +59 -55
- 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 +66 -64
- package/dist/internal/openai.mjs +10 -10
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +43 -43
- package/dist/internal/runtime.mjs +10 -8
- package/dist/internal/shared.d.mts +25 -25
- package/dist/internal/shared.mjs +95 -4
- package/dist/{mistral-EiHdymeb.mjs → mistral-Tb6oalqH.mjs} +30 -23
- package/dist/{openai-chatgpt-responses-DHpF9o1e.mjs → openai-chatgpt-responses-yUXjPNfu.mjs} +76 -137
- package/dist/{openai-completions-EFPiUGfS.mjs → openai-completions-BIUV3RDT.mjs} +26 -22
- package/dist/{openai-completions-compat-BefmHT26.d.mts → openai-completions-compat-CpjYUArk.d.mts} +5 -5
- package/dist/{openai-completions-stream-DUlGwRMz.mjs → openai-completions-stream-BsrBe3Gg.mjs} +103 -96
- package/dist/openai-prompt-cache-CGnVB74a.mjs +21 -0
- package/dist/openai-prompt-cache-CNoIfHYC.d.mts +16 -0
- package/dist/{openai-responses-BogP8OjX.mjs → openai-responses-CCL41ALM.mjs} +15 -14
- package/dist/openai-responses-compaction-window-BMVHFOtq.mjs +697 -0
- package/dist/{openai-responses-contracts-Dvj_UtPy.d.mts → openai-responses-contracts-rF5DDRNS.d.mts} +23 -6
- package/dist/{openai-responses-payload-policy-CNGFT9zr.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +1 -0
- package/dist/{openai-responses-prompt-observer-internal-Cd4hJG-S.mjs → openai-responses-prompt-observer-internal-D0bhBfgL.mjs} +4 -18
- package/dist/{openai-responses-shared-DJThc6jW.mjs → openai-responses-shared-Bmma_3Qc.mjs} +438 -309
- package/dist/{openai-tool-schema-ho-hIkQf.mjs → openai-tool-schema-_pTAJqKF.mjs} +30 -40
- package/dist/{provider-error-DDOs_Bz0.mjs → provider-error-9TraxGvt.mjs} +20 -92
- package/dist/{provider-options-MdMBLzlU.d.mts → provider-options-Bcc_p-TU.d.mts} +26 -6
- package/dist/provider-replay-context-BuSUaAk5.mjs +21 -0
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-BaMbI1hr.mjs} +1 -1
- package/dist/provider-types.d.mts +19 -20
- package/dist/providers.d.mts +6 -6
- package/dist/providers.mjs +11 -11
- package/dist/{reasoning-tag-text-partitioner-5ygO2rZc.mjs → reasoning-tag-text-partitioner-DLCNXki6.mjs} +158 -94
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-D6xUvZaS.mjs} +2 -8
- package/dist/{simple-options-CFj7x3J4.mjs → simple-options-BjHCCh4v.mjs} +42 -6
- package/dist/{src-Bu3FiFAG.mjs → src-2qBGKg8O.mjs} +83 -2
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-mJhXDcyz.mjs} +21 -31
- package/dist/{transport-stream-shared-ljShVIZB.mjs → transport-stream-shared-CZqMhfIw.mjs} +19 -6
- package/dist/{transport-stream-shared-rvaCyFYt.d.mts → transport-stream-shared-xnaqxmbP.d.mts} +5 -5
- package/dist/{transport-utils-LJ1_rbi-.mjs → transport-utils-7il795_9.mjs} +5 -8
- package/dist/transports.d.mts +121 -85
- package/dist/transports.mjs +747 -464
- package/dist/types-3Lnm-QSJ.d.mts +1 -0
- package/dist/{types-DhLoJbFm.d.mts → types-CJ1-Ht7A.d.mts} +55 -19
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +5 -5
- package/dist/{validation-Dk7q7NMN.d.mts → validation-AKZBDGQd.d.mts} +1 -1
- package/dist/{validation-B61OhAio.mjs → validation-CJZtym2g.mjs} +7 -5
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/anthropic-BECQCNdF.d.mts +0 -98
- package/dist/event-stream-BKp4fOt_.d.mts +0 -1
- package/dist/index-Qbej8io0.d.mts +0 -3
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/openai-responses-contracts-QUY12X0B.mjs +0 -233
- package/dist/openai-responses-payload-policy-D8EdimYe.mjs +0 -204
- package/dist/provider-options-AvldWZt8.mjs +0 -21
- package/dist/tls-certificate-errors-DXSpluKI.mjs +0 -93
- package/dist/types-GiAjXatj.d.mts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-FnHM2FcI.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AssistantMessageDiagnostic } from "./diagnostics-
|
|
1
|
+
import { t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
|
|
2
2
|
import { TSchema } from "typebox";
|
|
3
3
|
//#region packages/llm-core/src/types.d.ts
|
|
4
4
|
/** Provider API families with first-class request/stream adapters in OpenClaw. */
|
|
@@ -93,6 +93,23 @@ interface StreamOptions {
|
|
|
93
93
|
* its body stream is consumed.
|
|
94
94
|
*/
|
|
95
95
|
onResponse?: (response: ProviderResponse, model: Model) => void | Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Observe a live response that accepts user input before generation finishes.
|
|
98
|
+
* `steer` resolves false only when the input was definitely not admitted;
|
|
99
|
+
* admitted input cannot be withdrawn. Providers settle pending submissions
|
|
100
|
+
* before closing the response and call the returned cleanup on closure.
|
|
101
|
+
*/
|
|
102
|
+
onActiveResponse?: (control: {
|
|
103
|
+
steer(messages: readonly UserMessage[]): Promise<boolean>;
|
|
104
|
+
/** Read-only after closure: deferred input still needs an explicit continuation request. */
|
|
105
|
+
needsContinuation?: () => boolean;
|
|
106
|
+
}) => (() => void) | void;
|
|
107
|
+
/**
|
|
108
|
+
* The caller can execute completed async calls before generation finishes.
|
|
109
|
+
* Providers advertise async tools only with this host capability; this is
|
|
110
|
+
* independent of parallel execution of an ordinary completed tool batch.
|
|
111
|
+
*/
|
|
112
|
+
asyncToolExecution?: boolean;
|
|
96
113
|
/**
|
|
97
114
|
* Optional custom HTTP headers to include in API requests.
|
|
98
115
|
* Merged with provider defaults; can override default headers.
|
|
@@ -104,10 +121,7 @@ interface StreamOptions {
|
|
|
104
121
|
* For example, OpenAI and Anthropic SDK clients default to 10 minutes.
|
|
105
122
|
*/
|
|
106
123
|
timeoutMs?: number;
|
|
107
|
-
/**
|
|
108
|
-
* Maximum retry attempts for providers/SDKs that support client-side retries.
|
|
109
|
-
* For example, OpenAI and Anthropic SDK clients default to 2.
|
|
110
|
-
*/
|
|
124
|
+
/** @deprecated Ignored by built-in text transports; retries are owned by the host runner. */
|
|
111
125
|
maxRetries?: number;
|
|
112
126
|
/**
|
|
113
127
|
* Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
|
|
@@ -217,6 +231,8 @@ interface ImageContent {
|
|
|
217
231
|
}
|
|
218
232
|
/** Normalized assistant tool call emitted by providers or repaired from text. */
|
|
219
233
|
interface ToolCall {
|
|
234
|
+
/** The provider completed this call and permits generation to continue without its result. */
|
|
235
|
+
async?: true;
|
|
220
236
|
type: "toolCall";
|
|
221
237
|
id: string;
|
|
222
238
|
name: string;
|
|
@@ -255,6 +271,24 @@ interface Usage {
|
|
|
255
271
|
totalOrigin?: "provider-billed";
|
|
256
272
|
};
|
|
257
273
|
}
|
|
274
|
+
/** Per-million-token rates for separately billed token buckets. */
|
|
275
|
+
type ModelCostRates = Pick<Usage["cost"], "input" | "output" | "cacheRead" | "cacheWrite">;
|
|
276
|
+
/** One whole-request tier on the cache-inclusive prompt-token axis. */
|
|
277
|
+
type PricingTier = ModelCostRates & {
|
|
278
|
+
/** Half-open prompt-token interval `[start, end)`. */
|
|
279
|
+
range: [number, number];
|
|
280
|
+
};
|
|
281
|
+
type RawPricingTier = ModelCostRates & {
|
|
282
|
+
/** `[start]` is an open-ended upper tier. */
|
|
283
|
+
range: [number, number] | [number];
|
|
284
|
+
};
|
|
285
|
+
/** Normalized pricing used by token accounting and usage summaries. */
|
|
286
|
+
type ModelCostConfig = ModelCostRates & {
|
|
287
|
+
tieredPricing?: PricingTier[];
|
|
288
|
+
};
|
|
289
|
+
type RawModelCostConfig = ModelCostRates & {
|
|
290
|
+
tieredPricing?: RawPricingTier[];
|
|
291
|
+
};
|
|
258
292
|
/** Normalized assistant stop reasons across text providers. */
|
|
259
293
|
type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
260
294
|
/** Stable error codes for provider outcomes that cannot be replayed safely. */
|
|
@@ -266,12 +300,9 @@ interface UserMessage {
|
|
|
266
300
|
content: string | (TextContent | ImageContent)[];
|
|
267
301
|
timestamp: number;
|
|
268
302
|
/**
|
|
269
|
-
* Marks a user message
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* and stripped on replay — so providers must NOT anchor a prompt-cache
|
|
273
|
-
* breakpoint on them, or the breakpoint would land on bytes that change every
|
|
274
|
-
* turn. Anchoring stays on the last stable (non-carrier) user message.
|
|
303
|
+
* Marks a user message carrying runtime context. Provider replay policy decides
|
|
304
|
+
* whether the carrier is transient or retained append-only; only retained
|
|
305
|
+
* carriers are stable prompt-cache anchors.
|
|
275
306
|
*/
|
|
276
307
|
runtimeContextCarrier?: boolean;
|
|
277
308
|
}
|
|
@@ -289,6 +320,8 @@ interface AssistantMessage {
|
|
|
289
320
|
content: (TextContent | ThinkingContent | ToolCall)[];
|
|
290
321
|
openclawDelivery?: {
|
|
291
322
|
audioAsVoice?: true;
|
|
323
|
+
/** Exact media directives consumed by the managed-media transcript rewrite owner. */
|
|
324
|
+
mediaUrls?: string[];
|
|
292
325
|
replyToCurrent?: true;
|
|
293
326
|
replyToId?: string;
|
|
294
327
|
/** Provider text phase is unresolved until the assistant turn reaches terminal state. */
|
|
@@ -449,6 +482,8 @@ interface OpenAICompletionsCompat {
|
|
|
449
482
|
supportsDeveloperRole?: boolean;
|
|
450
483
|
/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */
|
|
451
484
|
supportsReasoningEffort?: boolean;
|
|
485
|
+
/** Per-level reasoning effort overrides, e.g. map "off" to "low" for models that cannot disable thinking. */
|
|
486
|
+
reasoningEffortMap?: Record<string, string>;
|
|
452
487
|
/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */
|
|
453
488
|
supportsUsageInStreaming?: boolean;
|
|
454
489
|
/** Which field to use for max tokens. Default: auto-detected from URL. */
|
|
@@ -486,12 +521,18 @@ interface OpenAICompletionsCompat {
|
|
|
486
521
|
interface OpenAIResponsesCompat {
|
|
487
522
|
/** Whether the provider supports the `developer` role (vs `system`). Default: true. */
|
|
488
523
|
supportsDeveloperRole?: boolean;
|
|
524
|
+
/** Whether to send reasoning effort settings. Defaults to the model's known capabilities. */
|
|
525
|
+
supportsReasoningEffort?: boolean;
|
|
526
|
+
/** Provider-native reasoning efforts accepted by the model. Overrides known model defaults. */
|
|
527
|
+
supportedReasoningEfforts?: string[];
|
|
489
528
|
/** Whether the model accepts the `temperature` parameter. Default: true. */
|
|
490
529
|
supportsTemperature?: boolean;
|
|
491
530
|
/** Whether to send the OpenAI `session_id` cache-affinity header from `options.sessionId` when caching is enabled. Default: true. */
|
|
492
531
|
sendSessionIdHeader?: boolean;
|
|
493
532
|
/** Whether the provider supports `prompt_cache_retention: "24h"`. Default: true. */
|
|
494
533
|
supportsLongCacheRetention?: boolean;
|
|
534
|
+
/** Whether the provider honors top-level `instructions`. Defaults to true only for verified native routes (OpenAI, xAI); every other route defaults to false and embeds the system prompt in `input` unless set true here after verifying against that endpoint. */
|
|
535
|
+
supportsInstructions?: boolean;
|
|
495
536
|
}
|
|
496
537
|
/** Compatibility settings for Anthropic Messages-compatible APIs. */
|
|
497
538
|
interface AnthropicMessagesCompat {
|
|
@@ -616,12 +657,7 @@ interface Model<TApi extends Api = Api> {
|
|
|
616
657
|
*/
|
|
617
658
|
thinkingLevelMap?: ThinkingLevelMap;
|
|
618
659
|
input: ("text" | "image")[];
|
|
619
|
-
cost:
|
|
620
|
-
input: number;
|
|
621
|
-
output: number;
|
|
622
|
-
cacheRead: number;
|
|
623
|
-
cacheWrite: number;
|
|
624
|
-
};
|
|
660
|
+
cost: RawModelCostConfig;
|
|
625
661
|
contextWindow?: number;
|
|
626
662
|
/**
|
|
627
663
|
* Optional effective runtime cap used for compaction/session budgeting.
|
|
@@ -636,7 +672,7 @@ interface Model<TApi extends Api = Api> {
|
|
|
636
672
|
/** Sends runtime credentials as Authorization: Bearer instead of provider-specific key headers. */
|
|
637
673
|
authHeader?: boolean;
|
|
638
674
|
/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */
|
|
639
|
-
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : never;
|
|
675
|
+
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "azure-openai-responses" | "openai-codex-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : never;
|
|
640
676
|
/** Provider-documented media input limits used by attachment preprocessing. */
|
|
641
677
|
mediaInput?: {
|
|
642
678
|
image?: {
|
|
@@ -657,4 +693,4 @@ type StreamFn = (model: Model, context: Context, options?: SimpleStreamOptions)
|
|
|
657
693
|
type CompleteSimpleFn = (model: Model, context: Pick<Context, "systemPrompt" | "messages">, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
658
694
|
type ValidateToolArgumentsFn = (tool: Tool, toolCall: ToolCall) => unknown;
|
|
659
695
|
//#endregion
|
|
660
|
-
export {
|
|
696
|
+
export { ThinkingLevel as $, ModelThinkingLevel as A, ProviderResponse as B, KnownImagesApi as C, Model as D, Message as E, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as F, StopReason as G, RawModelCostConfig as H, PricingTier as I, StreamOptions as J, StreamFn as K, Provider as L, OpenAIResponsesCompat as M, OpenRouterRouting as N, ModelCostConfig as O, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as P, ThinkingContent as Q, ProviderImagesOptions as R, KnownApi as S, MaybePromise as T, RawPricingTier as U, ProviderStreamOptions as V, SimpleStreamOptions as W, TextSignatureV1 as X, TextContent as Y, ThinkingBudgets as Z, ImagesModel as _, AssistantMessage as a, Usage as at, ImagesProvider as b, AssistantMessageEventStreamLike as c, VercelGatewayRouting as ct, Context as d, ThinkingLevelMap as et, ImageContent as f, ImagesInputContent as g, ImagesFunction as h, AssistantImages as i, Transport as it, OpenAICompletionsCompat as j, ModelCostRates as k, CacheRetention as l, ImagesContext as m, Api as n, ToolCall as nt, AssistantMessageEvent as o, UserMessage as ot, ImagesApi as p, StreamFunction as q, AssistantDeliveryTtsFacts as r, ToolResultMessage as rt, AssistantMessageEventStreamContract as s, ValidateToolArgumentsFn as st, AnthropicMessagesCompat as t, Tool as tt, CompleteSimpleFn as u, ImagesOptions as v, KnownImagesProvider as w, ImagesStopReason as x, ImagesOutputContent as y, ProviderReplayState as z };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-
|
|
3
|
-
import { $ as
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import "./types-
|
|
7
|
-
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
1
|
+
import { _ as supportsClaude1MContext, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeMaxEffort, c as bindsClaudeThinkingPrefix, d as resolveClaudeFable5ModelIdentity, f as resolveClaudeModelIdentity, g as resolveClaudeSonnet5ModelIdentity, h as resolveClaudeOpus5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeDefaultSampling, m as resolveClaudeNativeThinkingLevelMap, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeMythos5ModelIdentity, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as requiresClaudeMandatoryAdaptiveThinking, v as supportsClaudeAdaptiveThinking, x as supportsClaudeNativeXhighEffort, y as supportsClaudeFastMode } from "./index-FnHM2FcI.mjs";
|
|
2
|
+
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, s as isProviderRefusalAssistantError, t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
|
|
3
|
+
import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, E as Message, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, V as ProviderStreamOptions, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, q as StreamFunction, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-CJ1-Ht7A.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BhT5T1Ay.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-AKZBDGQd.mjs";
|
|
6
|
+
import "./types-3Lnm-QSJ.mjs";
|
|
7
|
+
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/types.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeResolvedPricing, s as bindsClaudeThinkingPrefix, t as calculateUsageCost, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./src-2qBGKg8O.mjs";
|
|
2
2
|
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
3
|
-
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
3
|
+
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BgDvQeum.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
|
|
6
|
+
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, bindsClaudeThinkingPrefix, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nt as ToolCall, tt as Tool } from "./types-CJ1-Ht7A.mjs";
|
|
2
2
|
//#region packages/llm-core/src/validation.d.ts
|
|
3
3
|
/** Finds the target tool and validates/coerces a model-emitted tool call. */
|
|
4
4
|
declare function validateToolCall(tools: Tool[], toolCall: ToolCall): unknown;
|
|
@@ -2,7 +2,7 @@ import { Compile } from "typebox/compile";
|
|
|
2
2
|
//#region packages/llm-core/src/validation.ts
|
|
3
3
|
const validatorCache = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
/** Maximum string length accepted for schema-gated JSON coercion. */
|
|
5
|
-
const MAX_JSON_COERCE_LENGTH =
|
|
5
|
+
const MAX_JSON_COERCE_LENGTH = 65536;
|
|
6
6
|
function isObjectBackedRecord(value) {
|
|
7
7
|
return typeof value === "object" && value !== null;
|
|
8
8
|
}
|
|
@@ -181,10 +181,12 @@ function validateToolArguments(tool, toolCall) {
|
|
|
181
181
|
validator.Convert(args);
|
|
182
182
|
if (isJsonSchemaObject(tool.parameters)) {
|
|
183
183
|
const coerced = coerceWithJsonSchema(args, tool.parameters);
|
|
184
|
-
if (coerced !== args)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
if (coerced !== args) {
|
|
185
|
+
if (isObjectBackedRecord(args) && isObjectBackedRecord(coerced)) {
|
|
186
|
+
for (const key of Object.keys(args)) delete args[key];
|
|
187
|
+
Object.assign(args, coerced);
|
|
188
|
+
} else return validator.Check(coerced) ? coerced : args;
|
|
189
|
+
}
|
|
188
190
|
}
|
|
189
191
|
if (validator.Check(args)) return args;
|
|
190
192
|
const errors = validator.Errors(args).map((error) => ` - ${formatValidationPath(error)}: ${error.message}`).join("\n") || "Unknown validation error";
|
package/dist/validation.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
1
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-AKZBDGQd.mjs";
|
|
2
2
|
export { validateToolArguments, validateToolCall };
|
package/dist/validation.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
1
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
|
|
2
2
|
export { validateToolArguments, validateToolCall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/ai",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.2",
|
|
4
4
|
"description": "Reusable model provider adapters and streaming runtime from OpenClaw",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@anthropic-ai/sdk": "0.
|
|
107
|
-
"@google/genai": "2.
|
|
108
|
-
"@mistralai/mistralai": "2.
|
|
106
|
+
"@anthropic-ai/sdk": "0.120.0",
|
|
107
|
+
"@google/genai": "2.18.0",
|
|
108
|
+
"@mistralai/mistralai": "2.6.4",
|
|
109
109
|
"openai": "7.5.0",
|
|
110
110
|
"partial-json": "0.1.7",
|
|
111
|
-
"typebox": "1.3.
|
|
111
|
+
"typebox": "1.3.18"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@openclaw/model-catalog-core": "0.0.0-private",
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
//#region packages/llm-core/src/model-contracts/anthropic.d.ts
|
|
2
|
-
type ClaudeModelRef = {
|
|
3
|
-
id?: string;
|
|
4
|
-
params?: Record<string, unknown>;
|
|
5
|
-
};
|
|
6
|
-
type ClaudeEffortModelRef = ClaudeModelRef & {
|
|
7
|
-
thinkingLevelMap?: Record<string, string | null | undefined>;
|
|
8
|
-
};
|
|
9
|
-
declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
|
|
10
|
-
readonly levels: readonly [{
|
|
11
|
-
readonly id: "minimal";
|
|
12
|
-
}, {
|
|
13
|
-
readonly id: "low";
|
|
14
|
-
}, {
|
|
15
|
-
readonly id: "medium";
|
|
16
|
-
}, {
|
|
17
|
-
readonly id: "high";
|
|
18
|
-
}, {
|
|
19
|
-
readonly id: "xhigh";
|
|
20
|
-
}, {
|
|
21
|
-
readonly id: "adaptive";
|
|
22
|
-
}, {
|
|
23
|
-
readonly id: "max";
|
|
24
|
-
}];
|
|
25
|
-
readonly defaultLevel: "high";
|
|
26
|
-
readonly preserveWhenCatalogReasoningFalse: true;
|
|
27
|
-
};
|
|
28
|
-
declare const CLAUDE_SONNET_5_THINKING_PROFILE: {
|
|
29
|
-
readonly levels: readonly [{
|
|
30
|
-
readonly id: "off";
|
|
31
|
-
}, {
|
|
32
|
-
readonly id: "minimal";
|
|
33
|
-
}, {
|
|
34
|
-
readonly id: "low";
|
|
35
|
-
}, {
|
|
36
|
-
readonly id: "medium";
|
|
37
|
-
}, {
|
|
38
|
-
readonly id: "high";
|
|
39
|
-
}, {
|
|
40
|
-
readonly id: "xhigh";
|
|
41
|
-
}, {
|
|
42
|
-
readonly id: "adaptive";
|
|
43
|
-
}, {
|
|
44
|
-
readonly id: "max";
|
|
45
|
-
}];
|
|
46
|
-
readonly defaultLevel: "high";
|
|
47
|
-
};
|
|
48
|
-
declare const CLAUDE_OPUS_5_THINKING_PROFILE: {
|
|
49
|
-
readonly levels: readonly [{
|
|
50
|
-
readonly id: "off";
|
|
51
|
-
}, {
|
|
52
|
-
readonly id: "minimal";
|
|
53
|
-
}, {
|
|
54
|
-
readonly id: "low";
|
|
55
|
-
}, {
|
|
56
|
-
readonly id: "medium";
|
|
57
|
-
}, {
|
|
58
|
-
readonly id: "high";
|
|
59
|
-
}, {
|
|
60
|
-
readonly id: "xhigh";
|
|
61
|
-
}, {
|
|
62
|
-
readonly id: "adaptive";
|
|
63
|
-
}, {
|
|
64
|
-
readonly id: "max";
|
|
65
|
-
}];
|
|
66
|
-
readonly defaultLevel: "high";
|
|
67
|
-
};
|
|
68
|
-
/** Resolve the canonical normalized Claude model id for one runtime model ref. */
|
|
69
|
-
declare function resolveClaudeModelIdentity(ref: ClaudeModelRef): string;
|
|
70
|
-
/** Resolve Claude Fable 5 through direct ids, cloud ids, or deployment metadata. */
|
|
71
|
-
declare function resolveClaudeFable5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
72
|
-
/** Resolve Claude Mythos 5 through direct ids, cloud ids, or deployment metadata. */
|
|
73
|
-
declare function resolveClaudeMythos5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
74
|
-
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
75
|
-
declare function requiresClaudeMandatoryAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
76
|
-
/** Resolve Claude Sonnet 5 through direct ids, cloud ids, or deployment metadata. */
|
|
77
|
-
declare function resolveClaudeSonnet5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
78
|
-
/** Resolve Claude Opus 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
79
|
-
declare function resolveClaudeOpus5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
80
|
-
/** Return whether a Claude model supports adaptive thinking. */
|
|
81
|
-
declare function supportsClaudeAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
82
|
-
/** Return whether a Claude model has a native 1M-token context window. */
|
|
83
|
-
declare function supportsClaude1MContext(ref: ClaudeModelRef): boolean;
|
|
84
|
-
/** Return whether a Claude model supports Anthropic's native fast mode. */
|
|
85
|
-
declare function supportsClaudeFastMode(ref: ClaudeModelRef): boolean;
|
|
86
|
-
/** Return whether a Claude model supports native max effort. */
|
|
87
|
-
declare function supportsClaudeNativeMaxEffort(ref: ClaudeModelRef): boolean;
|
|
88
|
-
/** Return whether a Claude model supports native xhigh effort. */
|
|
89
|
-
declare function supportsClaudeNativeXhighEffort(ref: ClaudeModelRef): boolean;
|
|
90
|
-
/** Return whether a Claude model rejects caller-selected sampling parameters. */
|
|
91
|
-
declare function requiresClaudeDefaultSampling(ref: ClaudeModelRef): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Fill native Claude effort mappings only when the provider did not publish a
|
|
94
|
-
* narrower route-specific contract.
|
|
95
|
-
*/
|
|
96
|
-
declare function resolveClaudeNativeThinkingLevelMap(ref: ClaudeEffortModelRef): Record<string, string | null | undefined> | undefined;
|
|
97
|
-
//#endregion
|
|
98
|
-
export { requiresClaudeMandatoryAdaptiveThinking as a, resolveClaudeMythos5ModelIdentity as c, resolveClaudeSonnet5ModelIdentity as d, supportsClaude1MContext as f, supportsClaudeNativeXhighEffort as g, supportsClaudeNativeMaxEffort as h, requiresClaudeDefaultSampling as i, resolveClaudeNativeThinkingLevelMap as l, supportsClaudeFastMode as m, CLAUDE_OPUS_5_THINKING_PROFILE as n, resolveClaudeFable5ModelIdentity as o, supportsClaudeAdaptiveThinking as p, CLAUDE_SONNET_5_THINKING_PROFILE as r, resolveClaudeModelIdentity as s, CLAUDE_FABLE_5_THINKING_PROFILE as t, resolveClaudeOpus5ModelIdentity as u };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./event-stream-LiXePESD.mjs";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/providers/openai-prompt-cache.d.ts
|
|
2
|
-
/** Maximum prompt cache key length accepted by OpenAI-compatible request metadata. */
|
|
3
|
-
declare const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
4
|
-
/** Truncates a prompt cache key by Unicode code point count. */
|
|
5
|
-
declare function clampOpenAIPromptCacheKey(key: string | undefined): string | undefined;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { clampOpenAIPromptCacheKey as n, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH as t };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/providers/openai-prompt-cache.ts
|
|
2
|
-
/** Maximum prompt cache key length accepted by OpenAI-compatible request metadata. */
|
|
3
|
-
const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
4
|
-
/** Truncates a prompt cache key by Unicode code point count. */
|
|
5
|
-
function clampOpenAIPromptCacheKey(key) {
|
|
6
|
-
if (key === void 0) return;
|
|
7
|
-
const chars = Array.from(key);
|
|
8
|
-
if (chars.length <= 64) return key;
|
|
9
|
-
return chars.slice(0, 64).join("");
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { clampOpenAIPromptCacheKey as n, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH as t };
|