@openclaw/ai 2026.8.1-beta.3 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-B8KwTtlb.mjs → anthropic-Djj7L1rx.mjs} +21 -21
- package/dist/{anthropic-compaction-replay-4Zx7-aCr.mjs → anthropic-compaction-replay-CY4tkD4V.mjs} +33 -34
- package/dist/{anthropic-payload-policy-CSx7MoKH.d.mts → anthropic-payload-policy-i_5_inWe.d.mts} +3 -2
- package/dist/{api-registry-DFxSnFqG.d.mts → api-registry-C9-wZd_W.d.mts} +2 -1
- package/dist/{azure-openai-responses-Aa4mVcYG.mjs → azure-openai-responses-Bj3czHNa.mjs} +4 -4
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/diagnostics.d.mts +2 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/event-stream-C988TSLe.d.mts +1 -0
- package/dist/{event-stream-D91-ohD_.d.mts → event-stream-UhnxHuqt.d.mts} +1 -2
- package/dist/event-stream.d.mts +2 -1
- package/dist/{google-yDRnipeq.mjs → google-0Ca6TYbw.mjs} +4 -4
- package/dist/{google-shared-M1dl64nz.mjs → google-shared-DVfL9COU.mjs} +14 -7
- package/dist/{google-vertex-DCJHM_a5.mjs → google-vertex-5dAMxprN.mjs} +4 -4
- package/dist/{host-DF_yxOsA.mjs → host-D51fmkH6.mjs} +4 -8
- package/dist/{host-DJq_FGcz.d.mts → host-DoPJJ1KD.d.mts} +3 -3
- package/dist/index-N3zr6__t.d.mts +105 -0
- package/dist/index.d.mts +9 -10
- package/dist/index.mjs +2 -3
- package/dist/internal/anthropic.d.mts +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-BCnrI-kV.mjs} +22 -25
- package/dist/{openai-chatgpt-responses-C339VIfT.mjs → openai-chatgpt-responses-CGBGWSqr.mjs} +31 -14
- package/dist/openai-completions-BaTuwID7.mjs +401 -0
- package/dist/{openai-completions-compat-B0KTleXp.d.mts → openai-completions-compat-DB7FFq7k.d.mts} +3 -3
- package/dist/openai-completions-stream-Bpns6uNc.mjs +1622 -0
- package/dist/{openai-responses-BXEcr-Tp.mjs → openai-responses-1GBcQujk.mjs} +8 -6
- package/dist/openai-responses-compaction-window-DwydGZI8.mjs +686 -0
- package/dist/{openai-responses-contracts-CD75pQ0m.d.mts → openai-responses-contracts-DgaR3t5T.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-_nhGTn2b.mjs} +3 -2
- package/dist/{openai-responses-shared-Cvt5MgEm.mjs → openai-responses-shared-zPmKnhF5.mjs} +315 -1468
- package/dist/openai-stop-reason-Drnn_6Qj.mjs +28 -0
- package/dist/openai-tool-schema-Dgl4H2MU.mjs +1695 -0
- package/dist/{provider-error-C8mBRJDl.mjs → provider-error-jZP5NMTZ.mjs} +3 -77
- package/dist/{provider-options-Cc5ZQ6Aa.d.mts → provider-options-HvA_slFa.d.mts} +13 -4
- package/dist/{provider-transcript-transform--gtf0ZbR.mjs → provider-transcript-transform-C01bQ5a3.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-CwzKb0bA.mjs} +1 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-BP7HLLZn.mjs → sanitize-unicode-DCkltN94.mjs} +1 -2
- package/dist/simple-options-DKx86yX9.mjs +155 -0
- package/dist/{anthropic-BQXQudmA.mjs → src-Bu3FiFAG.mjs} +1 -0
- 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-qvTEs5Am.mjs} +2 -2
- package/dist/{simple-options-oqsXB6U3.mjs → transport-stream-shared-CT5ycdzn.mjs} +10 -118
- package/dist/transport-stream-shared-NjwWNaRY.d.mts +138 -0
- package/dist/{transport-utils-Bv0FHkd0.mjs → transport-utils-BHx9z8Cl.mjs} +9 -9
- package/dist/transports.d.mts +127 -189
- package/dist/transports.mjs +181 -1214
- package/dist/types-DtGu2d3C.d.mts +1 -0
- package/dist/{types-DTAP49HF.d.mts → types-h38Azne1.d.mts} +38 -17
- package/dist/types.d.mts +5 -4
- package/dist/types.mjs +1 -2
- package/dist/utf16-slice-qz3nsy87.mjs +84 -0
- package/dist/{validation-DYNNrU9u.d.mts → validation-C68lP2uy.d.mts} +1 -2
- package/dist/validation.d.mts +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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-N3zr6__t.mjs";
|
|
@@ -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,7 +250,8 @@ 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
|
}
|
|
@@ -289,9 +289,13 @@ interface AssistantMessage {
|
|
|
289
289
|
content: (TextContent | ThinkingContent | ToolCall)[];
|
|
290
290
|
openclawDelivery?: {
|
|
291
291
|
audioAsVoice?: true;
|
|
292
|
+
/** Exact media directives consumed by the managed-media transcript rewrite owner. */
|
|
293
|
+
mediaUrls?: string[];
|
|
292
294
|
replyToCurrent?: true;
|
|
293
|
-
replyToId?: string;
|
|
294
|
-
|
|
295
|
+
replyToId?: string;
|
|
296
|
+
/** Provider text phase is unresolved until the assistant turn reaches terminal state. */
|
|
297
|
+
textPhaseRequiresTerminal?: true;
|
|
298
|
+
/** Parsed once at the assistant write boundary; delivery resolves policy from these facts. */
|
|
295
299
|
tts?: AssistantDeliveryTtsFacts;
|
|
296
300
|
};
|
|
297
301
|
api: Api;
|
|
@@ -371,13 +375,13 @@ type AssistantMessageEvent = {
|
|
|
371
375
|
type: "text_start";
|
|
372
376
|
contentIndex: number;
|
|
373
377
|
partial: AssistantMessage;
|
|
374
|
-
}
|
|
378
|
+
} |
|
|
375
379
|
/**
|
|
376
380
|
* Plain text deltas may omit `partial` to avoid retaining one full assistant
|
|
377
381
|
* snapshot per token. Consumers that need current text should replay `delta`
|
|
378
382
|
* from the latest start/end partial checkpoint.
|
|
379
383
|
*/
|
|
380
|
-
|
|
384
|
+
{
|
|
381
385
|
type: "text_delta";
|
|
382
386
|
contentIndex: number;
|
|
383
387
|
delta: string;
|
|
@@ -490,6 +494,8 @@ interface OpenAIResponsesCompat {
|
|
|
490
494
|
sendSessionIdHeader?: boolean;
|
|
491
495
|
/** Whether the provider supports `prompt_cache_retention: "24h"`. Default: true. */
|
|
492
496
|
supportsLongCacheRetention?: boolean;
|
|
497
|
+
/** 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. */
|
|
498
|
+
supportsInstructions?: boolean;
|
|
493
499
|
}
|
|
494
500
|
/** Compatibility settings for Anthropic Messages-compatible APIs. */
|
|
495
501
|
interface AnthropicMessagesCompat {
|
|
@@ -549,29 +555,44 @@ interface OpenRouterRouting {
|
|
|
549
555
|
quantizations?: string[];
|
|
550
556
|
/** Sorting strategy. Can be a string (e.g., "price", "throughput", "latency") or an object with `by` and `partition`. */
|
|
551
557
|
sort?: string | {
|
|
552
|
-
/** The sorting metric: "price", "throughput", "latency". */
|
|
558
|
+
/** The sorting metric: "price", "throughput", "latency". */
|
|
559
|
+
by?: string;
|
|
560
|
+
/** Partitioning strategy: "model" (default) or "none". */
|
|
553
561
|
partition?: string | null;
|
|
554
562
|
};
|
|
555
563
|
/** Maximum price per million tokens (USD). */
|
|
556
564
|
max_price?: {
|
|
557
|
-
/** Price per million prompt tokens. */
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
565
|
+
/** Price per million prompt tokens. */
|
|
566
|
+
prompt?: number | string;
|
|
567
|
+
/** Price per million completion tokens. */
|
|
568
|
+
completion?: number | string;
|
|
569
|
+
/** Price per image. */
|
|
570
|
+
image?: number | string;
|
|
571
|
+
/** Price per audio unit. */
|
|
572
|
+
audio?: number | string;
|
|
573
|
+
/** Price per request. */
|
|
561
574
|
request?: number | string;
|
|
562
575
|
};
|
|
563
576
|
/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
564
577
|
preferred_min_throughput?: number | {
|
|
565
|
-
/** Minimum tokens/second at the 50th percentile. */
|
|
566
|
-
|
|
567
|
-
|
|
578
|
+
/** Minimum tokens/second at the 50th percentile. */
|
|
579
|
+
p50?: number;
|
|
580
|
+
/** Minimum tokens/second at the 75th percentile. */
|
|
581
|
+
p75?: number;
|
|
582
|
+
/** Minimum tokens/second at the 90th percentile. */
|
|
583
|
+
p90?: number;
|
|
584
|
+
/** Minimum tokens/second at the 99th percentile. */
|
|
568
585
|
p99?: number;
|
|
569
586
|
};
|
|
570
587
|
/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
571
588
|
preferred_max_latency?: number | {
|
|
572
|
-
/** Maximum latency in seconds at the 50th percentile. */
|
|
573
|
-
|
|
574
|
-
|
|
589
|
+
/** Maximum latency in seconds at the 50th percentile. */
|
|
590
|
+
p50?: number;
|
|
591
|
+
/** Maximum latency in seconds at the 75th percentile. */
|
|
592
|
+
p75?: number;
|
|
593
|
+
/** Maximum latency in seconds at the 90th percentile. */
|
|
594
|
+
p90?: number;
|
|
595
|
+
/** Maximum latency in seconds at the 99th percentile. */
|
|
575
596
|
p99?: number;
|
|
576
597
|
};
|
|
577
598
|
}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as supportsClaudeNativeXhighEffort, a as requiresClaudeDefaultSampling, c as resolveClaudeModelIdentity, d as resolveClaudeOpus5ModelIdentity, f as resolveClaudeSonnet5ModelIdentity, g as supportsClaudeNativeMaxEffort, h as supportsClaudeFastMode, i as CLAUDE_SONNET_5_THINKING_PROFILE, l as resolveClaudeMythos5ModelIdentity, m as supportsClaudeAdaptiveThinking, n as CLAUDE_FABLE_5_THINKING_PROFILE, o as requiresClaudeMandatoryAdaptiveThinking, p as supportsClaude1MContext, r as CLAUDE_OPUS_5_THINKING_PROFILE, s as resolveClaudeFable5ModelIdentity, u as resolveClaudeNativeThinkingLevelMap } from "./index-N3zr6__t.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 Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
3
|
+
import { $ as Transport, A as OpenAIResponsesCompat, B as StopReason, C as KnownImagesApi, D as Model, E as Message, F as ProviderImagesOptions, G as TextSignatureV1, H as StreamFunction, I as ProviderReplayState, J as ThinkingLevel, K as ThinkingBudgets, L as ProviderResponse, M as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, N as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, O as ModelThinkingLevel, P as Provider, Q as ToolResultMessage, R as ProviderStreamOptions, S as KnownApi, T as MaybePromise, U as StreamOptions, V as StreamFn, W as TextContent, X as Tool, Y as ThinkingLevelMap, Z as ToolCall, _ as ImagesModel, a as AssistantMessage, b as ImagesProvider, c as AssistantMessageEventStreamLike, d as Context, et as Usage, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, j as OpenRouterRouting, k as OpenAICompletionsCompat, l as CacheRetention, m as ImagesContext, n as Api, nt as ValidateToolArgumentsFn, o as AssistantMessageEvent, p as ImagesApi, q as ThinkingContent, r as AssistantDeliveryTtsFacts, rt as VercelGatewayRouting, s as AssistantMessageEventStreamContract, t as AnthropicMessagesCompat, tt as UserMessage, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as SimpleStreamOptions } from "./types-h38Azne1.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-UhnxHuqt.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-C68lP2uy.mjs";
|
|
6
|
+
import "./types-DtGu2d3C.mjs";
|
|
6
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 };
|
package/dist/types.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./
|
|
1
|
+
import { a as requiresClaudeMandatoryAdaptiveThinking, c as resolveClaudeMythos5ModelIdentity, d as resolveClaudeSonnet5ModelIdentity, f as supportsClaude1MContext, g as supportsClaudeNativeXhighEffort, h as supportsClaudeNativeMaxEffort, i as requiresClaudeDefaultSampling, l as resolveClaudeNativeThinkingLevelMap, m as supportsClaudeFastMode, n as CLAUDE_OPUS_5_THINKING_PROFILE, o as resolveClaudeFable5ModelIdentity, p as supportsClaudeAdaptiveThinking, r as CLAUDE_SONNET_5_THINKING_PROFILE, s as resolveClaudeModelIdentity, t as CLAUDE_FABLE_5_THINKING_PROFILE, u as resolveClaudeOpus5ModelIdentity } from "./src-Bu3FiFAG.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
5
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-B61OhAio.mjs";
|
|
6
|
-
import "./src-D2H6yKkH.mjs";
|
|
7
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 };
|
|
@@ -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 { X as Tool, Z as ToolCall } from "./types-
|
|
2
|
-
|
|
1
|
+
import { X as Tool, Z as ToolCall } from "./types-h38Azne1.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;
|
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-C68lP2uy.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.1
|
|
3
|
+
"version": "2026.8.1",
|
|
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.16"
|
|
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 { };
|