@openclaw/ai 2026.7.2-beta.6 → 2026.7.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/{anthropic-CH4UUnZr.mjs → anthropic-BML72tLz.mjs} +468 -101
- package/dist/{api-registry-DlMgPR39.d.mts → api-registry-BXYnCOIR.d.mts} +2 -1
- package/dist/{azure-openai-responses-client-compat-C7K7QfUE.mjs → azure-openai-responses-client-compat-a_O_GVQV.mjs} +2 -23
- package/dist/{azure-openai-responses-CImcwB83.mjs → azure-openai-responses-kEN8II8I.mjs} +13 -11
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-CtMlqaQ4.mjs} +4 -5
- package/dist/{event-stream-YjaPW20U.d.mts → event-stream-0nZeBKl2.d.mts} +1 -1
- package/dist/{event-stream-D8n2uFee.mjs → event-stream-ReMmOTzX.mjs} +6 -14
- package/dist/event-stream.d.mts +1 -1
- package/dist/event-stream.mjs +1 -1
- package/dist/{github-copilot-headers-NCJtz9i0.mjs → github-copilot-headers-BsH5cqGj.mjs} +12 -1
- package/dist/{google-CtSg0iTS.mjs → google-DTM4O3e9.mjs} +5 -5
- package/dist/{google-shared-DNBz5rcD.mjs → google-shared-BAP0BQVi.mjs} +22 -34
- package/dist/{google-vertex-31f1uS9L.mjs → google-vertex-D58MZHCQ.mjs} +19 -6
- package/dist/host-4t713IeR.mjs +37 -0
- package/dist/{anthropic-SrGtwsJu.d.mts → index-BoTnz8cv.d.mts} +1 -27
- package/dist/index.d.mts +50 -7
- package/dist/index.mjs +5 -5
- package/dist/internal/anthropic.d.mts +62 -22
- package/dist/internal/anthropic.mjs +4 -5
- package/dist/internal/openai.d.mts +82 -98
- package/dist/internal/openai.mjs +6 -8
- package/dist/internal/runtime.d.mts +34 -13
- package/dist/internal/runtime.mjs +14 -26
- package/dist/internal/shared.d.mts +9 -26
- package/dist/internal/shared.mjs +2 -6
- package/dist/{json-parse-BvXNt1-7.mjs → json-parse-DzNSIQBq.mjs} +6 -4
- package/dist/{llm-request-activity-BjtkplhG.mjs → llm-request-activity-CehVkZP-.mjs} +19 -1
- package/dist/{mistral-CWmpvWYh.mjs → mistral-CePVNdws.mjs} +39 -141
- package/dist/model-utils-DgmOla96.mjs +69 -0
- package/dist/{openai-chatgpt-responses-B84Ibtrd.mjs → openai-chatgpt-responses-BHqbcipc.mjs} +154 -101
- package/dist/{openai-completions-DsOxhOD1.mjs → openai-completions-9qYFVS7H.mjs} +295 -81
- package/dist/{openai-responses-BT7A3sLu.mjs → openai-responses-D6l9URyV.mjs} +8 -10
- package/dist/openai-responses-shared-L3PWZvkm.mjs +1949 -0
- package/dist/{openai-tool-projection-OhX64DoP.mjs → openai-tool-projection-BPlyXt8H.mjs} +12 -32
- package/dist/providers.d.mts +2 -3
- package/dist/providers.mjs +10 -11
- package/dist/reasoning-tag-text-partitioner-axhAdUwg.mjs +394 -0
- package/dist/{src-QkygScBs.mjs → src-CZ503MYJ.mjs} +5 -24
- package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-RjWszj8c.mjs} +22 -2
- package/dist/transform-messages-BhGF_fF4.mjs +507 -0
- package/dist/{types-bzp5k29J.d.mts → types-DRgdPqaZ.d.mts} +0 -19
- package/dist/types.d.mts +5 -5
- package/dist/types.mjs +4 -4
- package/dist/{validation-B-j7cOYp.d.mts → validation-BDMWOr8d.d.mts} +1 -1
- package/dist/{validation-DAa_yFOM.mjs → validation-FrchoOlv.mjs} +7 -2
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/npm-shrinkwrap.json +645 -0
- package/package.json +11 -36
- package/dist/anthropic-usage-DWU-x8MI.mjs +0 -459
- package/dist/cache-retention-0x979a5V.mjs +0 -12
- package/dist/deferred-event-buffer-DAvyP7qA.mjs +0 -19
- package/dist/error-coercion-DgxlWC0n.mjs +0 -15
- package/dist/host-B9GUmcra.d.mts +0 -173
- package/dist/host-Dog2WQiR.mjs +0 -369
- package/dist/index-BVVgDSdq.d.mts +0 -1
- package/dist/internal/retry-after.d.mts +0 -5
- package/dist/internal/retry-after.mjs +0 -101
- package/dist/number-coercion-DvG7SNMg.mjs +0 -129
- package/dist/openai-completions-compat-DBWjXoMZ.d.mts +0 -43
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/openai-reasoning-compat-YgeLncHw.mjs +0 -396
- package/dist/openai-responses-shared-pXl6Wd8S.mjs +0 -392
- package/dist/openai-responses-stream-internal-Cw5txaGW.mjs +0 -2964
- package/dist/prompt-cache-stability-Cwcjv_fx.d.mts +0 -13
- package/dist/provider-error-CAEvRjry.mjs +0 -47
- package/dist/provider-options-D8bB3z9b.d.mts +0 -144
- package/dist/reasoning-tag-text-partitioner-CGDyLWUR.mjs +0 -12209
- package/dist/simple-options-9lhRrN73.mjs +0 -50
- package/dist/stream-first-event-timeout-DvDeSucC.d.mts +0 -29
- package/dist/tls-certificate-errors-DXSpluKI.mjs +0 -93
- 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
- package/dist/transports.d.mts +0 -573
- package/dist/transports.mjs +0 -4110
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/utils/prompt-cache-stability.d.ts
|
|
2
|
-
/** Canonicalizes provider tool order without relying on host locale settings. */
|
|
3
|
-
declare function sortPromptCacheToolsByName<T extends {
|
|
4
|
-
readonly name?: string;
|
|
5
|
-
readonly wireName?: string;
|
|
6
|
-
readonly description?: string;
|
|
7
|
-
}>(tools: readonly T[]): T[];
|
|
8
|
-
/** Normalize structured prompt text before hashing or snapshot comparison. */
|
|
9
|
-
declare function normalizeStructuredPromptSection(text: string): string;
|
|
10
|
-
/** Normalize, de-dupe, and sort capability ids for stable prompt payloads. */
|
|
11
|
-
declare function normalizePromptCapabilityIds(capabilities: ReadonlyArray<string>): string[];
|
|
12
|
-
//#endregion
|
|
13
|
-
export { normalizeStructuredPromptSection as n, sortPromptCacheToolsByName as r, normalizePromptCapabilityIds as t };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { o as truncateUtf16Safe } from "./tool-result-text-CTpIRbYd.mjs";
|
|
2
|
-
//#region packages/ai/src/utils/provider-error.ts
|
|
3
|
-
const MAX_ERROR_BODY_LENGTH = 4e3;
|
|
4
|
-
function stringify(value) {
|
|
5
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
6
|
-
try {
|
|
7
|
-
return JSON.stringify(value, (_key, candidate) => {
|
|
8
|
-
if (typeof candidate !== "object" || candidate === null) return candidate;
|
|
9
|
-
if (seen.has(candidate)) return "[Circular]";
|
|
10
|
-
seen.add(candidate);
|
|
11
|
-
return candidate;
|
|
12
|
-
}) ?? String(value);
|
|
13
|
-
} catch {
|
|
14
|
-
return String(value);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function readStatus(error) {
|
|
18
|
-
for (const value of [
|
|
19
|
-
error.status,
|
|
20
|
-
error.statusCode,
|
|
21
|
-
error.response?.status,
|
|
22
|
-
error.response?.statusCode
|
|
23
|
-
]) if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
24
|
-
}
|
|
25
|
-
function readBody(error) {
|
|
26
|
-
for (const value of [
|
|
27
|
-
error.body,
|
|
28
|
-
error.error,
|
|
29
|
-
error.response?.body,
|
|
30
|
-
error.response?.data
|
|
31
|
-
]) {
|
|
32
|
-
if (value === void 0 || value === null) continue;
|
|
33
|
-
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) continue;
|
|
34
|
-
const body = (typeof value === "string" ? value : stringify(value)).trim();
|
|
35
|
-
if (body.length > 0) return body.length <= MAX_ERROR_BODY_LENGTH ? body : `${truncateUtf16Safe(body, MAX_ERROR_BODY_LENGTH)}... [truncated]`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function formatProviderError(error) {
|
|
39
|
-
if (!(error instanceof Error)) return stringify(error);
|
|
40
|
-
const httpError = error;
|
|
41
|
-
const status = readStatus(httpError);
|
|
42
|
-
const body = readBody(httpError);
|
|
43
|
-
if (status === void 0 || body === void 0 || error.message.includes(body)) return error.message;
|
|
44
|
-
return `${status}: ${body}`;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { formatProviderError as t };
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { z as StreamOptions } from "./types-bzp5k29J.mjs";
|
|
2
|
-
import OpenAI from "openai";
|
|
3
|
-
import Anthropic from "@anthropic-ai/sdk";
|
|
4
|
-
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
5
|
-
|
|
6
|
-
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
7
|
-
type OpenAIReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
8
|
-
type OpenAIApiReasoningEffort = OpenAIReasoningEffort | (string & {});
|
|
9
|
-
type OpenAIReasoningModel = {
|
|
10
|
-
provider?: unknown;
|
|
11
|
-
id?: unknown;
|
|
12
|
-
name?: unknown;
|
|
13
|
-
api?: unknown;
|
|
14
|
-
baseUrl?: unknown;
|
|
15
|
-
compat?: unknown;
|
|
16
|
-
};
|
|
17
|
-
/** Return whether a model is the GPT-5.4 mini family. */
|
|
18
|
-
declare function isOpenAIGpt54MiniModel(model: OpenAIReasoningModel): boolean;
|
|
19
|
-
/** Return whether a model is the GPT-5.5 family. */
|
|
20
|
-
declare function isOpenAIGpt55Model(model: OpenAIReasoningModel): boolean;
|
|
21
|
-
/** Return whether a model is the GPT-5.6 family. */
|
|
22
|
-
declare function isOpenAIGpt56Model(model: OpenAIReasoningModel): boolean;
|
|
23
|
-
/** Normalize user-facing reasoning effort names to API effort names. */
|
|
24
|
-
declare function normalizeOpenAIReasoningEffort(effort: string): string;
|
|
25
|
-
/** Resolve the reasoning efforts accepted by a specific OpenAI-compatible model. */
|
|
26
|
-
declare function resolveOpenAISupportedReasoningEfforts(model: OpenAIReasoningModel): readonly OpenAIApiReasoningEffort[];
|
|
27
|
-
/**
|
|
28
|
-
* Return whether a model accepts the temperature parameter. The GPT-5.6
|
|
29
|
-
* family rejects it with a 400; catalog compat can override per model.
|
|
30
|
-
*/
|
|
31
|
-
declare function supportsOpenAITemperature(model: OpenAIReasoningModel): boolean;
|
|
32
|
-
/** Return whether a model accepts a requested reasoning effort. */
|
|
33
|
-
declare function supportsOpenAIReasoningEffort(model: OpenAIReasoningModel, effort: string): boolean;
|
|
34
|
-
/** Resolve a requested reasoning effort to the closest value supported by the model. */
|
|
35
|
-
declare function resolveOpenAIReasoningEffortForModel(params: {
|
|
36
|
-
model: OpenAIReasoningModel;
|
|
37
|
-
effort: string;
|
|
38
|
-
fallbackMap?: Record<string, string>;
|
|
39
|
-
}): OpenAIApiReasoningEffort | undefined;
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region packages/ai/src/providers/openai-tool-projection.d.ts
|
|
42
|
-
type OpenAIToolDescriptor = {
|
|
43
|
-
readonly name?: unknown;
|
|
44
|
-
readonly description?: unknown;
|
|
45
|
-
readonly parameters: unknown;
|
|
46
|
-
};
|
|
47
|
-
type OpenAIProjectedTool = {
|
|
48
|
-
readonly toolIndex: number;
|
|
49
|
-
readonly name: string;
|
|
50
|
-
readonly description?: string;
|
|
51
|
-
readonly parameters: Record<string, unknown>;
|
|
52
|
-
};
|
|
53
|
-
type OpenAIToolProjectionDiagnostic = {
|
|
54
|
-
readonly toolIndex: number;
|
|
55
|
-
readonly toolName?: string;
|
|
56
|
-
readonly violations: readonly string[];
|
|
57
|
-
};
|
|
58
|
-
type OpenAIToolProjection = {
|
|
59
|
-
readonly inputToolCount: number;
|
|
60
|
-
readonly tools: readonly OpenAIProjectedTool[];
|
|
61
|
-
readonly diagnostics: readonly OpenAIToolProjectionDiagnostic[];
|
|
62
|
-
};
|
|
63
|
-
type OpenAIResponsesToolChoice = ResponseCreateParamsStreaming["tool_choice"];
|
|
64
|
-
type OpenAICompletionsSdkToolChoice = OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming["tool_choice"];
|
|
65
|
-
type OpenAICompletionsToolChoice = Exclude<OpenAICompletionsSdkToolChoice, {
|
|
66
|
-
type: "custom";
|
|
67
|
-
}>;
|
|
68
|
-
/** Snapshots direct/custom tool descriptors before OpenAI payload construction. */
|
|
69
|
-
declare function projectOpenAITools(tools: readonly OpenAIToolDescriptor[]): OpenAIToolProjection;
|
|
70
|
-
/** Keeps Responses tool choices aligned with surviving function schemas. */
|
|
71
|
-
declare function reconcileOpenAIResponsesToolChoice(choice: OpenAIResponsesToolChoice, projection: OpenAIToolProjection): OpenAIResponsesToolChoice | undefined;
|
|
72
|
-
/** Keeps Chat Completions tool choices aligned with surviving function schemas. */
|
|
73
|
-
declare function reconcileOpenAICompletionsToolChoice(choice: OpenAICompletionsSdkToolChoice, projection: OpenAIToolProjection): OpenAICompletionsSdkToolChoice | undefined;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region packages/ai/src/provider-options.d.ts
|
|
76
|
-
type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
77
|
-
type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
78
|
-
/** Provider options shared by the Anthropic provider and canonical transport. */
|
|
79
|
-
interface AnthropicOptions extends StreamOptions {
|
|
80
|
-
/**
|
|
81
|
-
* Enable extended thinking.
|
|
82
|
-
* For Opus 4.6+ and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
|
|
83
|
-
* For older models: uses budget-based thinking with thinkingBudgetTokens.
|
|
84
|
-
*/
|
|
85
|
-
thinkingEnabled?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Token budget for extended thinking (older models only).
|
|
88
|
-
* Ignored for Opus 4.6+ and Sonnet 4.6, which use adaptive thinking.
|
|
89
|
-
*/
|
|
90
|
-
thinkingBudgetTokens?: number;
|
|
91
|
-
/**
|
|
92
|
-
* Effort level for adaptive thinking (Opus 4.6+ and Sonnet 4.6).
|
|
93
|
-
* Controls how much thinking Claude allocates:
|
|
94
|
-
* - "max": Always thinks with no constraints (Opus 4.6 only)
|
|
95
|
-
* - "xhigh": Highest reasoning level (Opus 4.7+)
|
|
96
|
-
* - "high": Always thinks, deep reasoning (default)
|
|
97
|
-
* - "medium": Moderate thinking, may skip for simple queries
|
|
98
|
-
* - "low": Minimal thinking, skips for simple tasks
|
|
99
|
-
* Ignored for older models.
|
|
100
|
-
*/
|
|
101
|
-
effort?: AnthropicEffort;
|
|
102
|
-
/**
|
|
103
|
-
* Controls how thinking content is returned in API responses.
|
|
104
|
-
* - "summarized": Thinking blocks contain summarized thinking text (default here).
|
|
105
|
-
* - "omitted": Thinking blocks return an empty thinking field; the encrypted
|
|
106
|
-
* signature still travels back for multi-turn continuity. Use for faster
|
|
107
|
-
* time-to-first-text-token when your UI does not surface thinking.
|
|
108
|
-
*
|
|
109
|
-
* Note: Anthropic's API default for Claude Opus 4.7+ and Claude Mythos Preview
|
|
110
|
-
* is "omitted". We default to "summarized" here to keep behavior consistent
|
|
111
|
-
* with older Claude 4 models. Set this explicitly to "omitted" to opt in.
|
|
112
|
-
*/
|
|
113
|
-
thinkingDisplay?: AnthropicThinkingDisplay;
|
|
114
|
-
interleavedThinking?: boolean;
|
|
115
|
-
toolChoice?: "auto" | "any" | "none" | {
|
|
116
|
-
type: "tool";
|
|
117
|
-
name: string;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Pre-built Anthropic client instance. When provided, skips internal client
|
|
121
|
-
* construction entirely. Use this to inject alternative SDK clients such as
|
|
122
|
-
* `AnthropicVertex` that shares the same messaging API.
|
|
123
|
-
*/
|
|
124
|
-
client?: Anthropic;
|
|
125
|
-
}
|
|
126
|
-
/** Options shared by the OpenAI Responses and Completions transports. */
|
|
127
|
-
type BaseOpenAIStreamOptions = StreamOptions & {
|
|
128
|
-
topP?: number;
|
|
129
|
-
authProfileId?: string;
|
|
130
|
-
firstEventTimeoutMs?: number;
|
|
131
|
-
onFirstEventTimeout?: (reason: Error) => void;
|
|
132
|
-
openclawCodeModeToolSurface?: boolean;
|
|
133
|
-
frequencyPenalty?: number;
|
|
134
|
-
presencePenalty?: number;
|
|
135
|
-
seed?: number;
|
|
136
|
-
};
|
|
137
|
-
/** Superset retained under the provider's published compatibility type name. */
|
|
138
|
-
type OpenAICompletionsOptions = BaseOpenAIStreamOptions & {
|
|
139
|
-
toolChoice?: OpenAICompletionsToolChoice;
|
|
140
|
-
reasoning?: OpenAIReasoningEffort;
|
|
141
|
-
reasoningEffort?: OpenAIReasoningEffort;
|
|
142
|
-
};
|
|
143
|
-
//#endregion
|
|
144
|
-
export { resolveOpenAIReasoningEffortForModel as _, OpenAICompletionsOptions as a, supportsOpenAITemperature as b, projectOpenAITools as c, OpenAIApiReasoningEffort as d, OpenAIReasoningEffort as f, normalizeOpenAIReasoningEffort as g, isOpenAIGpt56Model as h, BaseOpenAIStreamOptions as i, reconcileOpenAICompletionsToolChoice as l, isOpenAIGpt55Model as m, AnthropicOptions as n, OpenAICompletionsToolChoice as o, isOpenAIGpt54MiniModel as p, AnthropicThinkingDisplay as r, OpenAIToolProjection as s, AnthropicEffort as t, reconcileOpenAIResponsesToolChoice as u, resolveOpenAISupportedReasoningEfforts as v, supportsOpenAIReasoningEffort as y };
|