@openclaw/ai 2026.7.2-beta.7 → 2026.8.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-CH4UUnZr.mjs → anthropic-B6dLpq5L.mjs} +55 -203
- package/dist/{src-QkygScBs.mjs → anthropic-JsNA5KCu.mjs} +0 -1
- package/dist/anthropic-compaction-replay-8lJNKXOE.mjs +840 -0
- package/dist/anthropic-payload-policy-CiEuQS72.d.mts +49 -0
- package/dist/{api-registry-DlMgPR39.d.mts → api-registry-k3zTz0cV.d.mts} +1 -1
- package/dist/{azure-openai-responses-CImcwB83.mjs → azure-openai-responses-mxIOtUnn.mjs} +23 -29
- package/dist/diagnostics.d.mts +24 -1
- package/dist/diagnostics.mjs +2 -1
- package/dist/{event-stream-YjaPW20U.d.mts → event-stream-BP6AWT8j.d.mts} +4 -1
- package/dist/{event-stream-D8n2uFee.mjs → event-stream-uSMZJ3FA.mjs} +26 -5
- package/dist/event-stream.d.mts +1 -1
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-CtSg0iTS.mjs → google-C7h2QzDX.mjs} +5 -5
- package/dist/{google-shared-DNBz5rcD.mjs → google-shared-B0Qr9OR7.mjs} +146 -89
- package/dist/google-thinking-level-C-V3tecN.mjs +9 -0
- package/dist/{google-vertex-31f1uS9L.mjs → google-vertex-Bhc3TjDl.mjs} +11 -7
- package/dist/{llm-request-activity-BjtkplhG.mjs → headers-DdOQtGuU.mjs} +9 -1
- package/dist/host-DTqNc7ad.mjs +466 -0
- package/dist/{host-B9GUmcra.d.mts → host-vWgMMhiJ.d.mts} +9 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +7 -5
- package/dist/internal/anthropic.d.mts +29 -5
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -0
- package/dist/internal/openai-responses-payload-policy.mjs +3 -0
- package/dist/internal/openai.d.mts +6 -6
- package/dist/internal/openai.mjs +8 -7
- package/dist/internal/runtime.d.mts +17 -5
- package/dist/internal/runtime.mjs +85 -73
- package/dist/internal/shared.d.mts +1 -6
- package/dist/internal/shared.mjs +3 -5
- package/dist/{json-parse-BvXNt1-7.mjs → json-parse-CDnesDM_.mjs} +4 -6
- package/dist/{mistral-CWmpvWYh.mjs → mistral-CEWoQI_g.mjs} +45 -48
- package/dist/number-coercion-H9qHik3g.mjs +71 -0
- package/dist/openai-chatgpt-jwt-KWcgd0d_.mjs +19 -0
- package/dist/{openai-chatgpt-responses-B84Ibtrd.mjs → openai-chatgpt-responses-CrPmqERt.mjs} +284 -240
- package/dist/{openai-completions-DsOxhOD1.mjs → openai-completions-BPnt4Sml.mjs} +65 -99
- package/dist/{openai-completions-compat-DBWjXoMZ.d.mts → openai-completions-compat-Dt3dcawL.d.mts} +2 -2
- package/dist/{openai-responses-BT7A3sLu.mjs → openai-responses-DhIKtOup.mjs} +18 -41
- package/dist/openai-responses-contracts-CyfIkQi5.mjs +253 -0
- package/dist/openai-responses-contracts-XpZJxrRG.d.mts +68 -0
- package/dist/openai-responses-payload-policy-BDxV-W0c.mjs +206 -0
- package/dist/openai-responses-payload-policy-BSs371VM.d.mts +40 -0
- package/dist/openai-responses-prompt-observer-internal-DgNTYnRY.mjs +46 -0
- package/dist/{openai-responses-stream-internal-Cw5txaGW.mjs → openai-responses-shared-DXIt3iY5.mjs} +1406 -940
- package/dist/{openai-reasoning-compat-YgeLncHw.mjs → openai-stop-reason-BkFkqqK0.mjs} +204 -37
- package/dist/openai-tool-projection-CY04OcvQ.mjs +338 -0
- package/dist/provider-error-BUwEnjXq.mjs +429 -0
- package/dist/provider-error-CzNw4BWX.d.mts +12 -0
- package/dist/{provider-options-D8bB3z9b.d.mts → provider-options-B96RdNpH.d.mts} +9 -3
- package/dist/provider-transcript-transform-ePx-Bbfr.mjs +155 -0
- package/dist/provider-types.d.mts +31 -0
- package/dist/provider-types.mjs +8 -0
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +17 -19
- package/dist/{reasoning-tag-text-partitioner-CGDyLWUR.mjs → reasoning-tag-text-partitioner-rnPwX2pg.mjs} +14 -8
- package/dist/record-coerce-DdXsgUd_.mjs +23 -0
- package/dist/sanitize-unicode-BYqrYtC_.mjs +90 -0
- package/dist/session-resources-CkR4WWy1.mjs +21 -0
- package/dist/simple-options-D58D5Kvw.mjs +117 -0
- package/dist/src-D2H6yKkH.mjs +2 -0
- package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-MK28puvq.mjs} +2 -2
- package/dist/string-coerce-fsri9iCu.mjs +34 -0
- package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → tool-schema-json-projection-q5d7QX5c.mjs} +32 -7
- package/dist/transport-utils-DJqkxbhC.mjs +138 -0
- package/dist/transports.d.mts +166 -241
- package/dist/transports.mjs +1979 -1825
- package/dist/types-BDdaOVi2.mjs +6 -0
- package/dist/{types-bzp5k29J.d.mts → types-BHNrPS1l.d.mts} +23 -1
- package/dist/types.d.mts +4 -4
- package/dist/types.mjs +6 -4
- package/dist/utf16-slice-CvGodqok.mjs +29 -0
- package/dist/{validation-DAa_yFOM.mjs → validation-B61OhAio.mjs} +6 -6
- package/dist/{validation-B-j7cOYp.d.mts → validation-DT9SrFn3.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +15 -1
- package/dist/anthropic-usage-DWU-x8MI.mjs +0 -459
- package/dist/error-coercion-DgxlWC0n.mjs +0 -15
- package/dist/headers-B_e4-1J0.mjs +0 -9
- package/dist/host-Dog2WQiR.mjs +0 -369
- package/dist/number-coercion-DvG7SNMg.mjs +0 -129
- package/dist/openai-chatgpt-jwt-DhAAzLkj.mjs +0 -39
- package/dist/openai-responses-shared-pXl6Wd8S.mjs +0 -392
- package/dist/openai-tool-projection-OhX64DoP.mjs +0 -215
- package/dist/provider-error-CAEvRjry.mjs +0 -47
- package/dist/sanitize-unicode-DT5o51ur.mjs +0 -26
- package/dist/simple-options-9lhRrN73.mjs +0 -50
- package/dist/tool-result-text-CTpIRbYd.mjs +0 -225
- package/dist/transform-messages-C8mBqZxF.mjs +0 -2
- package/dist/transport-stream-shared-D81p90xq.mjs +0 -297
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region packages/llm-core/src/types.ts
|
|
2
|
+
/** Stable error codes for provider outcomes that cannot be replayed safely. */
|
|
3
|
+
const PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE = "PROVIDER_POST_DISPATCH_AMBIGUITY";
|
|
4
|
+
const PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE = "PROVIDER_FAILURE_WITH_OUTPUT";
|
|
5
|
+
//#endregion
|
|
6
|
+
export { PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as n, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as t };
|
|
@@ -196,6 +196,20 @@ interface ThinkingContent {
|
|
|
196
196
|
* to the API for multi-turn continuity. */
|
|
197
197
|
redacted?: boolean;
|
|
198
198
|
}
|
|
199
|
+
/** Opaque provider-owned state that must survive transcript replay without being rendered. */
|
|
200
|
+
interface ProviderReplayState {
|
|
201
|
+
v: 1;
|
|
202
|
+
type: string;
|
|
203
|
+
id?: string;
|
|
204
|
+
data: string;
|
|
205
|
+
replayIndex?: number;
|
|
206
|
+
provider: Provider;
|
|
207
|
+
api: Api;
|
|
208
|
+
model: string;
|
|
209
|
+
baseUrlHash?: string;
|
|
210
|
+
sessionHash?: string;
|
|
211
|
+
authProfileHash?: string;
|
|
212
|
+
}
|
|
199
213
|
/** Base64 image content block with MIME type metadata. */
|
|
200
214
|
interface ImageContent {
|
|
201
215
|
type: "image";
|
|
@@ -217,6 +231,10 @@ interface Usage {
|
|
|
217
231
|
output: number;
|
|
218
232
|
cacheRead: number;
|
|
219
233
|
cacheWrite: number;
|
|
234
|
+
/** Whether the provider reported a cache-read/write token split. */
|
|
235
|
+
cacheTelemetry?: {
|
|
236
|
+
state: "available" | "unavailable";
|
|
237
|
+
};
|
|
220
238
|
/** Subset of `cacheWrite` written with 1-hour retention when reported. */
|
|
221
239
|
cacheWrite1h?: number;
|
|
222
240
|
/** Exact context snapshot for the final provider iteration. */
|
|
@@ -239,6 +257,9 @@ interface Usage {
|
|
|
239
257
|
}
|
|
240
258
|
/** Normalized assistant stop reasons across text providers. */
|
|
241
259
|
type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
260
|
+
/** Stable error codes for provider outcomes that cannot be replayed safely. */
|
|
261
|
+
declare const PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE = "PROVIDER_POST_DISPATCH_AMBIGUITY";
|
|
262
|
+
declare const PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE = "PROVIDER_FAILURE_WITH_OUTPUT";
|
|
242
263
|
/** User turn in a text-model conversation. */
|
|
243
264
|
interface UserMessage {
|
|
244
265
|
role: "user";
|
|
@@ -263,6 +284,7 @@ interface AssistantMessage {
|
|
|
263
284
|
model: string;
|
|
264
285
|
responseModel?: string;
|
|
265
286
|
responseId?: string;
|
|
287
|
+
providerReplay?: ProviderReplayState;
|
|
266
288
|
turnId?: string;
|
|
267
289
|
diagnostics?: AssistantMessageDiagnostic[];
|
|
268
290
|
usage: Usage;
|
|
@@ -603,4 +625,4 @@ type StreamFn = (model: Model, context: Context, options?: SimpleStreamOptions)
|
|
|
603
625
|
type CompleteSimpleFn = (model: Model, context: Pick<Context, "systemPrompt" | "messages">, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
604
626
|
type ValidateToolArgumentsFn = (tool: Tool, toolCall: ToolCall) => unknown;
|
|
605
627
|
//#endregion
|
|
606
|
-
export {
|
|
628
|
+
export { Usage as $, OpenRouterRouting as A, StreamFn as B, KnownImagesProvider as C, ModelThinkingLevel as D, Model as E, ProviderReplayState as F, ThinkingBudgets as G, StreamOptions as H, ProviderResponse as I, ThinkingLevelMap as J, ThinkingContent as K, ProviderStreamOptions as L, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE as M, Provider as N, OpenAICompletionsCompat as O, ProviderImagesOptions as P, Transport as Q, SimpleStreamOptions as R, KnownImagesApi as S, Message as T, TextContent as U, StreamFunction as V, TextSignatureV1 as W, ToolCall as X, Tool as Y, ToolResultMessage as Z, ImagesOptions as _, AssistantMessageEvent as a, ImagesStopReason as b, CacheRetention as c, ImageContent as d, UserMessage as et, ImagesApi as f, ImagesModel as g, ImagesInputContent as h, AssistantMessage as i, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE as j, OpenAIResponsesCompat as k, CompleteSimpleFn as l, ImagesFunction as m, Api as n, VercelGatewayRouting as nt, AssistantMessageEventStreamContract as o, ImagesContext as p, ThinkingLevel as q, AssistantImages as r, AssistantMessageEventStreamLike as s, AnthropicMessagesCompat as t, ValidateToolArgumentsFn as tt, Context as u, ImagesOutputContent as v, MaybePromise as w, KnownApi as x, ImagesProvider as y, StopReason as z };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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 "./anthropic-SrGtwsJu.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
|
-
export { AnthropicMessagesCompat, Api, 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, ProviderImagesOptions, 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 };
|
|
3
|
+
import { $ as Usage, A as OpenRouterRouting, B as StreamFn, C as KnownImagesProvider, D as ModelThinkingLevel, E as Model, F as ProviderReplayState, G as ThinkingBudgets, H as StreamOptions, I as ProviderResponse, J as ThinkingLevelMap, K as ThinkingContent, L as ProviderStreamOptions, M as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, N as Provider, O as OpenAICompletionsCompat, P as ProviderImagesOptions, Q as Transport, R as SimpleStreamOptions, S as KnownImagesApi, T as Message, U as TextContent, V as StreamFunction, W as TextSignatureV1, X as ToolCall, Y as Tool, Z as ToolResultMessage, _ as ImagesOptions, a as AssistantMessageEvent, b as ImagesStopReason, c as CacheRetention, d as ImageContent, et as UserMessage, f as ImagesApi, g as ImagesModel, h as ImagesInputContent, i as AssistantMessage, j as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, k as OpenAIResponsesCompat, l as CompleteSimpleFn, m as ImagesFunction, n as Api, nt as VercelGatewayRouting, o as AssistantMessageEventStreamContract, p as ImagesContext, q as ThinkingLevel, r as AssistantImages, s as AssistantMessageEventStreamLike, t as AnthropicMessagesCompat, tt as ValidateToolArgumentsFn, u as Context, v as ImagesOutputContent, w as MaybePromise, x as KnownApi, y as ImagesProvider, z as StopReason } from "./types-BHNrPS1l.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BP6AWT8j.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-DT9SrFn3.mjs";
|
|
6
|
+
export { AnthropicMessagesCompat, Api, 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,5 +1,7 @@
|
|
|
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 "./anthropic-JsNA5KCu.mjs";
|
|
2
|
+
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
2
3
|
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
3
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
5
|
-
|
|
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-B61OhAio.mjs";
|
|
6
|
+
import "./src-D2H6yKkH.mjs";
|
|
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 };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region packages/normalization-core/src/utf16-slice.ts
|
|
2
|
+
function isHighSurrogate(codeUnit) {
|
|
3
|
+
return codeUnit >= 55296 && codeUnit <= 56319;
|
|
4
|
+
}
|
|
5
|
+
function isLowSurrogate(codeUnit) {
|
|
6
|
+
return codeUnit >= 56320 && codeUnit <= 57343;
|
|
7
|
+
}
|
|
8
|
+
/** Slices a UTF-16 string without returning dangling surrogate halves at either edge. */
|
|
9
|
+
function sliceUtf16Safe(input, start, end) {
|
|
10
|
+
const len = input.length;
|
|
11
|
+
let from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
|
12
|
+
let to = end === void 0 ? len : end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
|
13
|
+
if (to <= from) return "";
|
|
14
|
+
if (from > 0 && from < len) {
|
|
15
|
+
if (isLowSurrogate(input.charCodeAt(from)) && isHighSurrogate(input.charCodeAt(from - 1))) from += 1;
|
|
16
|
+
}
|
|
17
|
+
if (to > 0 && to < len) {
|
|
18
|
+
if (isHighSurrogate(input.charCodeAt(to - 1)) && isLowSurrogate(input.charCodeAt(to))) to -= 1;
|
|
19
|
+
}
|
|
20
|
+
return input.slice(from, to);
|
|
21
|
+
}
|
|
22
|
+
/** Truncates a UTF-16 string without cutting a surrogate pair in half. */
|
|
23
|
+
function truncateUtf16Safe(input, maxLen) {
|
|
24
|
+
const limit = Math.max(0, Math.floor(maxLen));
|
|
25
|
+
if (input.length <= limit) return input;
|
|
26
|
+
return sliceUtf16Safe(input, 0, limit);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { truncateUtf16Safe as t };
|
|
@@ -3,11 +3,11 @@ import { Compile } from "typebox/compile";
|
|
|
3
3
|
const validatorCache = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
/** Maximum string length accepted for schema-gated JSON coercion. */
|
|
5
5
|
const MAX_JSON_COERCE_LENGTH = 64 * 1024;
|
|
6
|
-
function
|
|
6
|
+
function isObjectBackedRecord(value) {
|
|
7
7
|
return typeof value === "object" && value !== null;
|
|
8
8
|
}
|
|
9
9
|
function isJsonSchemaObject(value) {
|
|
10
|
-
return
|
|
10
|
+
return isObjectBackedRecord(value);
|
|
11
11
|
}
|
|
12
12
|
function getSchemaTypes(schema) {
|
|
13
13
|
if (typeof schema.type === "string") return [schema.type];
|
|
@@ -22,12 +22,12 @@ function matchesJsonType(value, type) {
|
|
|
22
22
|
case "string": return typeof value === "string";
|
|
23
23
|
case "null": return value === null;
|
|
24
24
|
case "array": return Array.isArray(value);
|
|
25
|
-
case "object": return
|
|
25
|
+
case "object": return isObjectBackedRecord(value) && !Array.isArray(value);
|
|
26
26
|
default: return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function isValidatorSchema(value) {
|
|
30
|
-
return
|
|
30
|
+
return isObjectBackedRecord(value);
|
|
31
31
|
}
|
|
32
32
|
const JSON_NUMBER_TOKEN_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:e[+-]?\d+)?$/iu;
|
|
33
33
|
function parseJsonNumberString(value) {
|
|
@@ -146,7 +146,7 @@ function coerceWithJsonSchema(value, schema) {
|
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
if (schemaTypes.includes("object") &&
|
|
149
|
+
if (schemaTypes.includes("object") && isObjectBackedRecord(nextValue) && !Array.isArray(nextValue)) applySchemaObjectCoercion(nextValue, schema);
|
|
150
150
|
if (schemaTypes.includes("array") && Array.isArray(nextValue)) applySchemaArrayCoercion(nextValue, schema);
|
|
151
151
|
return nextValue;
|
|
152
152
|
}
|
|
@@ -181,7 +181,7 @@ 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) if (
|
|
184
|
+
if (coerced !== args) if (isObjectBackedRecord(args) && isObjectBackedRecord(coerced)) {
|
|
185
185
|
for (const key of Object.keys(args)) delete args[key];
|
|
186
186
|
Object.assign(args, coerced);
|
|
187
187
|
} else return validator.Check(coerced) ? coerced : args;
|
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-DT9SrFn3.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-B61OhAio.mjs";
|
|
2
2
|
export { validateToolArguments, validateToolCall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/ai",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.2",
|
|
4
4
|
"description": "Reusable model provider adapters and streaming runtime from OpenClaw",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
"import": "./dist/types.mjs",
|
|
62
62
|
"default": "./dist/types.mjs"
|
|
63
63
|
},
|
|
64
|
+
"./provider-types": {
|
|
65
|
+
"types": "./dist/provider-types.d.mts",
|
|
66
|
+
"import": "./dist/provider-types.mjs",
|
|
67
|
+
"default": "./dist/provider-types.mjs"
|
|
68
|
+
},
|
|
64
69
|
"./validation": {
|
|
65
70
|
"types": "./dist/validation.d.mts",
|
|
66
71
|
"import": "./dist/validation.mjs",
|
|
@@ -76,6 +81,11 @@
|
|
|
76
81
|
"import": "./dist/internal/openai.mjs",
|
|
77
82
|
"default": "./dist/internal/openai.mjs"
|
|
78
83
|
},
|
|
84
|
+
"./internal/openai-responses-payload-policy": {
|
|
85
|
+
"types": "./dist/internal/openai-responses-payload-policy.d.mts",
|
|
86
|
+
"import": "./dist/internal/openai-responses-payload-policy.mjs",
|
|
87
|
+
"default": "./dist/internal/openai-responses-payload-policy.mjs"
|
|
88
|
+
},
|
|
79
89
|
"./internal/retry-after": {
|
|
80
90
|
"types": "./dist/internal/retry-after.d.mts",
|
|
81
91
|
"import": "./dist/internal/retry-after.mjs",
|
|
@@ -100,6 +110,10 @@
|
|
|
100
110
|
"partial-json": "0.1.7",
|
|
101
111
|
"typebox": "1.3.6"
|
|
102
112
|
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@openclaw/model-catalog-core": "0.0.0-private",
|
|
115
|
+
"@openclaw/normalization-core": "0.0.0-private"
|
|
116
|
+
},
|
|
103
117
|
"engines": {
|
|
104
118
|
"node": ">=22.19.0"
|
|
105
119
|
},
|