@openclaw/ai 2026.8.1-beta.3 → 2026.8.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-B8KwTtlb.mjs → anthropic-DTGZ4VMY.mjs} +25 -23
- package/dist/{anthropic-compaction-replay-4Zx7-aCr.mjs → anthropic-compaction-replay-CKCDrZJv.mjs} +34 -35
- package/dist/{anthropic-payload-policy-CSx7MoKH.d.mts → anthropic-payload-policy-BTzmNC14.d.mts} +3 -2
- package/dist/{api-registry-DFxSnFqG.d.mts → api-registry-BbUHEKER.d.mts} +2 -1
- package/dist/{azure-openai-responses-Aa4mVcYG.mjs → azure-openai-responses-BmqaDXM1.mjs} +6 -5
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/diagnostics.d.mts +2 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/{event-stream-D91-ohD_.d.mts → event-stream-DcvAPSBe.d.mts} +1 -2
- package/dist/event-stream-pXT3FI6X.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-yDRnipeq.mjs → google-CqjVZMwo.mjs} +8 -6
- package/dist/{google-shared-M1dl64nz.mjs → google-shared-Bnqni5j3.mjs} +34 -25
- package/dist/{google-vertex-DCJHM_a5.mjs → google-vertex-D_WREEJi.mjs} +8 -6
- package/dist/{host-DF_yxOsA.mjs → host-BIaiBURL.mjs} +4 -8
- package/dist/{host-DJq_FGcz.d.mts → host-DKFUAmCn.d.mts} +3 -3
- package/dist/index-CefaUGSS.d.mts +111 -0
- package/dist/index.d.mts +9 -10
- package/dist/index.mjs +4 -5
- package/dist/internal/anthropic.d.mts +51 -49
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +65 -63
- package/dist/internal/openai.mjs +10 -9
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +51 -40
- package/dist/internal/runtime.mjs +9 -9
- package/dist/internal/shared.d.mts +25 -25
- package/dist/internal/shared.mjs +3 -3
- package/dist/{json-parse-CDnesDM_.mjs → json-parse-BuAJEbdW.mjs} +18 -2
- package/dist/{mistral-D6hRXI7A.mjs → mistral-C24jVd6f.mjs} +34 -32
- package/dist/{openai-chatgpt-responses-C339VIfT.mjs → openai-chatgpt-responses-Czum0oXz.mjs} +38 -20
- package/dist/openai-completions-BfFwac6f.mjs +404 -0
- package/dist/{openai-completions-compat-B0KTleXp.d.mts → openai-completions-compat-SZhi0Lf4.d.mts} +3 -3
- package/dist/openai-completions-stream-DGOvau4J.mjs +1625 -0
- package/dist/{openai-responses-BXEcr-Tp.mjs → openai-responses-BAryVEJM.mjs} +11 -7
- package/dist/openai-responses-compaction-window-DO7yV7az.mjs +686 -0
- package/dist/{openai-responses-contracts-CD75pQ0m.d.mts → openai-responses-contracts-BthRXano.d.mts} +14 -5
- 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-BG-1AsBI.mjs → openai-responses-prompt-observer-internal--R0kZLOZ.mjs} +3 -2
- package/dist/{openai-responses-shared-Cvt5MgEm.mjs → openai-responses-shared-CxgdGBvm.mjs} +332 -1484
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-CSMh5e9O.mjs +1697 -0
- package/dist/{provider-error-C8mBRJDl.mjs → provider-error-BI8kIViN.mjs} +14 -88
- package/dist/{provider-options-Cc5ZQ6Aa.d.mts → provider-options-DJd_9euj.d.mts} +13 -4
- package/dist/{provider-transcript-transform--gtf0ZbR.mjs → provider-transcript-transform-WvJmFUAf.mjs} +1 -1
- package/dist/provider-types.d.mts +18 -17
- package/dist/providers.d.mts +5 -6
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-5ygO2rZc.mjs → reasoning-tag-text-partitioner-BsUX44Tq.mjs} +30 -20
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-BP7HLLZn.mjs → sanitize-unicode-S6binQG-.mjs} +2 -9
- package/dist/simple-options-rdOPzr7Z.mjs +155 -0
- package/dist/{anthropic-BQXQudmA.mjs → src-C8U7lkoa.mjs} +75 -1
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{streaming-byte-guard-BrbkbwUu.mjs → streaming-byte-guard-CC-HMn_u.mjs} +5 -6
- package/dist/string-normalization--fwJ4S2q.mjs +16 -0
- package/dist/{tool-schema-json-projection-FEr-jOoZ.mjs → tool-schema-json-projection-BtZiml7r.mjs} +22 -32
- package/dist/transport-stream-shared-BbG7PThh.d.mts +138 -0
- package/dist/{simple-options-oqsXB6U3.mjs → transport-stream-shared-D8nQWCUo.mjs} +10 -118
- package/dist/{transport-utils-Bv0FHkd0.mjs → transport-utils-CtuS1Upe.mjs} +10 -10
- package/dist/transports.d.mts +130 -189
- package/dist/transports.mjs +227 -1249
- package/dist/{types-DTAP49HF.d.mts → types-Beemor2E.d.mts} +58 -24
- package/dist/types-COdhCX0U.d.mts +1 -0
- package/dist/types.d.mts +6 -5
- package/dist/types.mjs +3 -4
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DYNNrU9u.d.mts → validation-CC6s7Smp.d.mts} +1 -2
- 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 +6 -6
- package/dist/anthropic-BECQCNdF.d.mts +0 -98
- package/dist/event-stream-BVVgDSdq.d.mts +0 -1
- package/dist/headers-B_e4-1J0.mjs +0 -9
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/openai-completions-D88orSJ9.mjs +0 -632
- package/dist/openai-responses-contracts-DvILoqBk.mjs +0 -247
- package/dist/openai-responses-payload-policy-BDo8CQsx.mjs +0 -208
- package/dist/openai-stop-reason-9OONKyAm.mjs +0 -579
- package/dist/openai-tool-projection-CHGLt03m.mjs +0 -426
- package/dist/provider-options-AvldWZt8.mjs +0 -21
- package/dist/record-coerce-DdXsgUd_.mjs +0 -23
- package/dist/src-D2H6yKkH.mjs +0 -2
- package/dist/stream-first-event-timeout-DvDeSucC.d.mts +0 -29
- package/dist/string-coerce-fsri9iCu.mjs +0 -34
- package/dist/types-BVVgDSdq.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
2
2
|
import { TSchema } from "typebox";
|
|
3
|
-
|
|
4
3
|
//#region packages/llm-core/src/types.d.ts
|
|
5
4
|
/** Provider API families with first-class request/stream adapters in OpenClaw. */
|
|
6
5
|
type KnownApi = "openai-completions" | "mistral-conversations" | "openai-responses" | "azure-openai-responses" | "openai-chatgpt-responses" | "anthropic-messages" | "bedrock-converse-stream" | "google-generative-ai" | "google-vertex";
|
|
@@ -251,10 +250,29 @@ interface Usage {
|
|
|
251
250
|
output: number;
|
|
252
251
|
cacheRead: number;
|
|
253
252
|
cacheWrite: number;
|
|
254
|
-
total: number;
|
|
253
|
+
total: number;
|
|
254
|
+
/** Provenance for the recorded total cost; provider-billed totals are authoritative. */
|
|
255
255
|
totalOrigin?: "provider-billed";
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
+
/** Per-million-token rates for separately billed token buckets. */
|
|
259
|
+
type ModelCostRates = Pick<Usage["cost"], "input" | "output" | "cacheRead" | "cacheWrite">;
|
|
260
|
+
/** One whole-request tier on the cache-inclusive prompt-token axis. */
|
|
261
|
+
type PricingTier = ModelCostRates & {
|
|
262
|
+
/** Half-open prompt-token interval `[start, end)`. */
|
|
263
|
+
range: [number, number];
|
|
264
|
+
};
|
|
265
|
+
type RawPricingTier = ModelCostRates & {
|
|
266
|
+
/** `[start]` is an open-ended upper tier. */
|
|
267
|
+
range: [number, number] | [number];
|
|
268
|
+
};
|
|
269
|
+
/** Normalized pricing used by token accounting and usage summaries. */
|
|
270
|
+
type ModelCostConfig = ModelCostRates & {
|
|
271
|
+
tieredPricing?: PricingTier[];
|
|
272
|
+
};
|
|
273
|
+
type RawModelCostConfig = ModelCostRates & {
|
|
274
|
+
tieredPricing?: RawPricingTier[];
|
|
275
|
+
};
|
|
258
276
|
/** Normalized assistant stop reasons across text providers. */
|
|
259
277
|
type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
260
278
|
/** Stable error codes for provider outcomes that cannot be replayed safely. */
|
|
@@ -289,9 +307,13 @@ interface AssistantMessage {
|
|
|
289
307
|
content: (TextContent | ThinkingContent | ToolCall)[];
|
|
290
308
|
openclawDelivery?: {
|
|
291
309
|
audioAsVoice?: true;
|
|
310
|
+
/** Exact media directives consumed by the managed-media transcript rewrite owner. */
|
|
311
|
+
mediaUrls?: string[];
|
|
292
312
|
replyToCurrent?: true;
|
|
293
|
-
replyToId?: string;
|
|
294
|
-
|
|
313
|
+
replyToId?: string;
|
|
314
|
+
/** Provider text phase is unresolved until the assistant turn reaches terminal state. */
|
|
315
|
+
textPhaseRequiresTerminal?: true;
|
|
316
|
+
/** Parsed once at the assistant write boundary; delivery resolves policy from these facts. */
|
|
295
317
|
tts?: AssistantDeliveryTtsFacts;
|
|
296
318
|
};
|
|
297
319
|
api: Api;
|
|
@@ -371,13 +393,13 @@ type AssistantMessageEvent = {
|
|
|
371
393
|
type: "text_start";
|
|
372
394
|
contentIndex: number;
|
|
373
395
|
partial: AssistantMessage;
|
|
374
|
-
}
|
|
396
|
+
} |
|
|
375
397
|
/**
|
|
376
398
|
* Plain text deltas may omit `partial` to avoid retaining one full assistant
|
|
377
399
|
* snapshot per token. Consumers that need current text should replay `delta`
|
|
378
400
|
* from the latest start/end partial checkpoint.
|
|
379
401
|
*/
|
|
380
|
-
|
|
402
|
+
{
|
|
381
403
|
type: "text_delta";
|
|
382
404
|
contentIndex: number;
|
|
383
405
|
delta: string;
|
|
@@ -490,6 +512,8 @@ interface OpenAIResponsesCompat {
|
|
|
490
512
|
sendSessionIdHeader?: boolean;
|
|
491
513
|
/** Whether the provider supports `prompt_cache_retention: "24h"`. Default: true. */
|
|
492
514
|
supportsLongCacheRetention?: boolean;
|
|
515
|
+
/** 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. */
|
|
516
|
+
supportsInstructions?: boolean;
|
|
493
517
|
}
|
|
494
518
|
/** Compatibility settings for Anthropic Messages-compatible APIs. */
|
|
495
519
|
interface AnthropicMessagesCompat {
|
|
@@ -549,29 +573,44 @@ interface OpenRouterRouting {
|
|
|
549
573
|
quantizations?: string[];
|
|
550
574
|
/** Sorting strategy. Can be a string (e.g., "price", "throughput", "latency") or an object with `by` and `partition`. */
|
|
551
575
|
sort?: string | {
|
|
552
|
-
/** The sorting metric: "price", "throughput", "latency". */
|
|
576
|
+
/** The sorting metric: "price", "throughput", "latency". */
|
|
577
|
+
by?: string;
|
|
578
|
+
/** Partitioning strategy: "model" (default) or "none". */
|
|
553
579
|
partition?: string | null;
|
|
554
580
|
};
|
|
555
581
|
/** Maximum price per million tokens (USD). */
|
|
556
582
|
max_price?: {
|
|
557
|
-
/** Price per million prompt tokens. */
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
583
|
+
/** Price per million prompt tokens. */
|
|
584
|
+
prompt?: number | string;
|
|
585
|
+
/** Price per million completion tokens. */
|
|
586
|
+
completion?: number | string;
|
|
587
|
+
/** Price per image. */
|
|
588
|
+
image?: number | string;
|
|
589
|
+
/** Price per audio unit. */
|
|
590
|
+
audio?: number | string;
|
|
591
|
+
/** Price per request. */
|
|
561
592
|
request?: number | string;
|
|
562
593
|
};
|
|
563
594
|
/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
564
595
|
preferred_min_throughput?: number | {
|
|
565
|
-
/** Minimum tokens/second at the 50th percentile. */
|
|
566
|
-
|
|
567
|
-
|
|
596
|
+
/** Minimum tokens/second at the 50th percentile. */
|
|
597
|
+
p50?: number;
|
|
598
|
+
/** Minimum tokens/second at the 75th percentile. */
|
|
599
|
+
p75?: number;
|
|
600
|
+
/** Minimum tokens/second at the 90th percentile. */
|
|
601
|
+
p90?: number;
|
|
602
|
+
/** Minimum tokens/second at the 99th percentile. */
|
|
568
603
|
p99?: number;
|
|
569
604
|
};
|
|
570
605
|
/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
571
606
|
preferred_max_latency?: number | {
|
|
572
|
-
/** Maximum latency in seconds at the 50th percentile. */
|
|
573
|
-
|
|
574
|
-
|
|
607
|
+
/** Maximum latency in seconds at the 50th percentile. */
|
|
608
|
+
p50?: number;
|
|
609
|
+
/** Maximum latency in seconds at the 75th percentile. */
|
|
610
|
+
p75?: number;
|
|
611
|
+
/** Maximum latency in seconds at the 90th percentile. */
|
|
612
|
+
p90?: number;
|
|
613
|
+
/** Maximum latency in seconds at the 99th percentile. */
|
|
575
614
|
p99?: number;
|
|
576
615
|
};
|
|
577
616
|
}
|
|
@@ -599,12 +638,7 @@ interface Model<TApi extends Api = Api> {
|
|
|
599
638
|
*/
|
|
600
639
|
thinkingLevelMap?: ThinkingLevelMap;
|
|
601
640
|
input: ("text" | "image")[];
|
|
602
|
-
cost:
|
|
603
|
-
input: number;
|
|
604
|
-
output: number;
|
|
605
|
-
cacheRead: number;
|
|
606
|
-
cacheWrite: number;
|
|
607
|
-
};
|
|
641
|
+
cost: RawModelCostConfig;
|
|
608
642
|
contextWindow?: number;
|
|
609
643
|
/**
|
|
610
644
|
* Optional effective runtime cap used for compaction/session budgeting.
|
|
@@ -640,4 +674,4 @@ type StreamFn = (model: Model, context: Context, options?: SimpleStreamOptions)
|
|
|
640
674
|
type CompleteSimpleFn = (model: Model, context: Pick<Context, "systemPrompt" | "messages">, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
641
675
|
type ValidateToolArgumentsFn = (tool: Tool, toolCall: ToolCall) => unknown;
|
|
642
676
|
//#endregion
|
|
643
|
-
export {
|
|
677
|
+
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-CefaUGSS.mjs";
|
package/dist/types.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./index-CefaUGSS.mjs";
|
|
2
2
|
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-BaTA9eVl.mjs";
|
|
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
|
-
|
|
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-Beemor2E.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DcvAPSBe.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-CC6s7Smp.mjs";
|
|
6
|
+
import "./types-COdhCX0U.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, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/types.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as supportsClaudeFastMode, a as CLAUDE_OPUS_5_THINKING_PROFILE, c as requiresClaudeMandatoryAdaptiveThinking, d as resolveClaudeMythos5ModelIdentity, f as resolveClaudeNativeThinkingLevelMap, g as supportsClaudeAdaptiveThinking, h as supportsClaude1MContext, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as resolveClaudeFable5ModelIdentity, m as resolveClaudeSonnet5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeOpus5ModelIdentity, r as normalizeResolvedPricing, s as requiresClaudeDefaultSampling, t as calculateUsageCost, u as resolveClaudeModelIdentity, v as supportsClaudeNativeMaxEffort, y as supportsClaudeNativeXhighEffort } from "./src-C8U7lkoa.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
3
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
4
4
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
|
|
7
|
-
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 };
|
|
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, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region packages/normalization-core/src/string-coerce.ts
|
|
2
|
+
/** Reads a value only when it is already a string, preserving whitespace. */
|
|
3
|
+
function readStringValue(value) {
|
|
4
|
+
return typeof value === "string" ? value : void 0;
|
|
5
|
+
}
|
|
6
|
+
/** Trims string input and returns null for non-strings or empty strings. */
|
|
7
|
+
function normalizeNullableString(value) {
|
|
8
|
+
if (typeof value !== "string") return null;
|
|
9
|
+
const trimmed = value.trim();
|
|
10
|
+
return trimmed ? trimmed : null;
|
|
11
|
+
}
|
|
12
|
+
/** Trims string input and returns undefined for non-strings or empty strings. */
|
|
13
|
+
function normalizeOptionalString(value) {
|
|
14
|
+
return normalizeNullableString(value) ?? void 0;
|
|
15
|
+
}
|
|
16
|
+
/** Stringifies primitive ids/flags before applying optional string normalization. */
|
|
17
|
+
function normalizeStringifiedOptionalString(value) {
|
|
18
|
+
if (typeof value === "string") return normalizeOptionalString(value);
|
|
19
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return normalizeOptionalString(String(value));
|
|
20
|
+
}
|
|
21
|
+
/** Lowercases a normalized optional string. */
|
|
22
|
+
function normalizeOptionalLowercaseString(value) {
|
|
23
|
+
return normalizeOptionalString(value)?.toLowerCase();
|
|
24
|
+
}
|
|
25
|
+
/** Lowercases a normalized string or returns an empty string when absent. */
|
|
26
|
+
function normalizeLowercaseStringOrEmpty(value) {
|
|
27
|
+
return normalizeOptionalLowercaseString(value) ?? "";
|
|
28
|
+
}
|
|
29
|
+
/** Type guard for strings that remain non-empty after trimming. */
|
|
30
|
+
function hasNonEmptyString(value) {
|
|
31
|
+
return normalizeOptionalString(value) !== void 0;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region packages/normalization-core/src/record-coerce.ts
|
|
35
|
+
/** Type guard for non-array object records at browser-safe boundaries. */
|
|
36
|
+
function isRecord(value) {
|
|
37
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
/** Returns a non-array record or undefined. */
|
|
40
|
+
function asOptionalRecord(value) {
|
|
41
|
+
return isRecord(value) ? value : void 0;
|
|
42
|
+
}
|
|
43
|
+
/** Returns a non-array record or a fresh ordinary empty record. */
|
|
44
|
+
function asNonArrayRecord(value) {
|
|
45
|
+
return asOptionalRecord(value) ?? {};
|
|
46
|
+
}
|
|
47
|
+
/** Returns a non-array record or null. */
|
|
48
|
+
function asNullableRecord(value) {
|
|
49
|
+
return isRecord(value) ? value : null;
|
|
50
|
+
}
|
|
51
|
+
/** Returns any object-backed record, including arrays, or undefined. */
|
|
52
|
+
function asOptionalObjectRecord(value) {
|
|
53
|
+
return value && typeof value === "object" ? value : void 0;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region packages/normalization-core/src/utf16-slice.ts
|
|
57
|
+
function isHighSurrogate(codeUnit) {
|
|
58
|
+
return codeUnit >= 55296 && codeUnit <= 56319;
|
|
59
|
+
}
|
|
60
|
+
function isLowSurrogate(codeUnit) {
|
|
61
|
+
return codeUnit >= 56320 && codeUnit <= 57343;
|
|
62
|
+
}
|
|
63
|
+
/** Slices a UTF-16 string without returning dangling surrogate halves at either edge. */
|
|
64
|
+
function sliceUtf16Safe(input, start, end) {
|
|
65
|
+
const len = input.length;
|
|
66
|
+
let from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
|
67
|
+
let to = end === void 0 ? len : end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
|
68
|
+
if (to <= from) return "";
|
|
69
|
+
if (from > 0 && from < len) {
|
|
70
|
+
if (isLowSurrogate(input.charCodeAt(from)) && isHighSurrogate(input.charCodeAt(from - 1))) from += 1;
|
|
71
|
+
}
|
|
72
|
+
if (to > 0 && to < len) {
|
|
73
|
+
if (isHighSurrogate(input.charCodeAt(to - 1)) && isLowSurrogate(input.charCodeAt(to))) to -= 1;
|
|
74
|
+
}
|
|
75
|
+
return input.slice(from, to);
|
|
76
|
+
}
|
|
77
|
+
/** Truncates a UTF-16 string without cutting a surrogate pair in half. */
|
|
78
|
+
function truncateUtf16Safe(input, maxLen) {
|
|
79
|
+
const limit = Math.max(0, Math.floor(maxLen));
|
|
80
|
+
if (input.length <= limit) return input;
|
|
81
|
+
return sliceUtf16Safe(input, 0, limit);
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { asOptionalRecord as a, normalizeLowercaseStringOrEmpty as c, normalizeOptionalString as d, normalizeStringifiedOptionalString as f, asOptionalObjectRecord as i, normalizeNullableString as l, asNonArrayRecord as n, isRecord as o, readStringValue as p, asNullableRecord as r, hasNonEmptyString as s, truncateUtf16Safe as t, normalizeOptionalLowercaseString as u };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { nt as ToolCall, tt as Tool } from "./types-Beemor2E.mjs";
|
|
3
2
|
//#region packages/llm-core/src/validation.d.ts
|
|
4
3
|
/** Finds the target tool and validates/coerces a model-emitted tool call. */
|
|
5
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-CC6s7Smp.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.8.
|
|
3
|
+
"version": "2026.8.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.
|
|
109
|
-
"openai": "
|
|
106
|
+
"@anthropic-ai/sdk": "0.120.0",
|
|
107
|
+
"@google/genai": "2.18.0",
|
|
108
|
+
"@mistralai/mistralai": "2.6.4",
|
|
109
|
+
"openai": "7.5.0",
|
|
110
110
|
"partial-json": "0.1.7",
|
|
111
|
-
"typebox": "1.3.
|
|
111
|
+
"typebox": "1.3.17"
|
|
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
|
-
export { };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/utils/headers.ts
|
|
2
|
-
/** Converts a Headers object to a plain record for provider request handling. */
|
|
3
|
-
function headersToRecord(headers) {
|
|
4
|
-
const result = {};
|
|
5
|
-
for (const [key, value] of headers.entries()) result[key] = value;
|
|
6
|
-
return result;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { headersToRecord as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|