@openclaw/ai 2026.7.2-beta.7 → 2026.8.1-beta.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-CH4UUnZr.mjs → anthropic-CE-7SkF6.mjs} +28 -191
- package/dist/{anthropic-usage-DWU-x8MI.mjs → anthropic-usage-Ma4iX6uG.mjs} +262 -4
- package/dist/{api-registry-DlMgPR39.d.mts → api-registry-EpJoVwM1.d.mts} +1 -1
- package/dist/{azure-openai-responses-CImcwB83.mjs → azure-openai-responses-Cc_kasye.mjs} +4 -4
- package/dist/{event-stream-D8n2uFee.mjs → event-stream-CEV9t6da.mjs} +10 -2
- package/dist/{event-stream-YjaPW20U.d.mts → event-stream-DRmDMRHH.d.mts} +2 -1
- package/dist/event-stream.d.mts +1 -1
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-CtSg0iTS.mjs → google-CGQu21aw.mjs} +5 -5
- package/dist/{google-shared-DNBz5rcD.mjs → google-shared-Cq2UKx1l.mjs} +151 -85
- package/dist/{google-vertex-31f1uS9L.mjs → google-vertex-CusxWzvE.mjs} +10 -7
- package/dist/{host-Dog2WQiR.mjs → host-Bl7Kgddo.mjs} +40 -2
- package/dist/{host-B9GUmcra.d.mts → host-Dn4_SZI2.d.mts} +2 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/internal/anthropic.d.mts +19 -3
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai.d.mts +4 -4
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/runtime.d.mts +2 -2
- package/dist/internal/runtime.mjs +3 -3
- package/dist/internal/shared.d.mts +1 -1
- package/dist/internal/shared.mjs +3 -4
- package/dist/{mistral-CWmpvWYh.mjs → mistral-Dx6VzNjf.mjs} +25 -9
- package/dist/model-utils-Dau5dlgm.mjs +64 -0
- package/dist/number-coercion-1Miyb5MO.mjs +66 -0
- package/dist/{openai-chatgpt-responses-B84Ibtrd.mjs → openai-chatgpt-responses-SC9m0FSf.mjs} +94 -131
- package/dist/{openai-completions-DsOxhOD1.mjs → openai-completions-BaIpl93j.mjs} +47 -66
- package/dist/{openai-reasoning-compat-YgeLncHw.mjs → openai-reasoning-compat-DKebnIBL.mjs} +147 -6
- package/dist/{openai-responses-BT7A3sLu.mjs → openai-responses-Bdx3V_Yu.mjs} +6 -22
- package/dist/openai-responses-contracts-BBKBfAqR.d.mts +116 -0
- package/dist/openai-responses-prompt-observer-internal-DDZPxRfr.mjs +46 -0
- package/dist/{openai-responses-shared-pXl6Wd8S.mjs → openai-responses-shared-CCyMvg7M.mjs} +21 -10
- package/dist/{openai-responses-stream-internal-Cw5txaGW.mjs → openai-responses-stream-internal-Bl8YyVtF.mjs} +244 -81
- package/dist/{openai-tool-projection-OhX64DoP.mjs → openai-transport-shared-Cipt7egQ.mjs} +129 -29
- package/dist/{provider-error-CAEvRjry.mjs → provider-error-DI0Ts28U.mjs} +1 -1
- package/dist/{provider-options-D8bB3z9b.d.mts → provider-options-C5kYML7i.d.mts} +1 -1
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +9 -9
- package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-BIBomOGq.mjs} +1 -1
- package/dist/{tool-result-text-CTpIRbYd.mjs → tool-result-text-Dvkp2Dus.mjs} +51 -2
- package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → tool-schema-json-projection-B1b-XCn5.mjs} +28 -1
- package/dist/transform-messages-DfjpNXNQ.mjs +2 -0
- package/dist/{transport-stream-shared-D81p90xq.mjs → transport-stream-shared-CPNv7A3r.mjs} +4 -4
- package/dist/transports.d.mts +41 -73
- package/dist/transports.mjs +317 -601
- package/dist/{types-bzp5k29J.d.mts → types-CH7ReIcU.d.mts} +4 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +1 -1
- package/dist/{validation-B-j7cOYp.d.mts → validation-CcPcuEbR.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +1 -1
- package/dist/error-coercion-DgxlWC0n.mjs +0 -15
- package/dist/number-coercion-DvG7SNMg.mjs +0 -129
- package/dist/openai-completions-compat-DBWjXoMZ.d.mts +0 -43
- package/dist/simple-options-9lhRrN73.mjs +0 -50
- package/dist/transform-messages-C8mBqZxF.mjs +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z as StreamOptions } from "./types-
|
|
1
|
+
import { z as StreamOptions } from "./types-CH7ReIcU.mjs";
|
|
2
2
|
import OpenAI from "openai";
|
|
3
3
|
import Anthropic from "@anthropic-ai/sdk";
|
|
4
4
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-EpJoVwM1.mjs";
|
|
2
2
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-2uo_1OR1.mjs";
|
|
3
3
|
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
package/dist/providers.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
|
|
2
2
|
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
@@ -64,35 +64,35 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
const registerBuiltIns = [
|
|
67
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
67
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-CE-7SkF6.mjs").then((n) => n.t), (module) => ({
|
|
68
68
|
stream: module.streamAnthropic,
|
|
69
69
|
streamSimple: module.streamSimpleAnthropic
|
|
70
70
|
})),
|
|
71
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
71
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-BaIpl93j.mjs").then((n) => n.t), (module) => ({
|
|
72
72
|
stream: module.streamOpenAICompletions,
|
|
73
73
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
74
74
|
})),
|
|
75
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
75
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-Dx6VzNjf.mjs"), (module) => ({
|
|
76
76
|
stream: module.streamMistral,
|
|
77
77
|
streamSimple: module.streamSimpleMistral
|
|
78
78
|
})),
|
|
79
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
79
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-Bdx3V_Yu.mjs").then((n) => n.t), (module) => ({
|
|
80
80
|
stream: module.streamOpenAIResponses,
|
|
81
81
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
82
82
|
})),
|
|
83
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
83
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-Cc_kasye.mjs"), (module) => ({
|
|
84
84
|
stream: module.streamAzureOpenAIResponses,
|
|
85
85
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
86
86
|
})),
|
|
87
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
87
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-SC9m0FSf.mjs"), (module) => ({
|
|
88
88
|
stream: module.streamOpenAICodexResponses,
|
|
89
89
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
90
90
|
})),
|
|
91
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
91
|
+
createLazyRegistration("google-generative-ai", () => import("./google-CGQu21aw.mjs"), (module) => ({
|
|
92
92
|
stream: module.streamGoogle,
|
|
93
93
|
streamSimple: module.streamSimpleGoogle
|
|
94
94
|
})),
|
|
95
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex-
|
|
95
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-CusxWzvE.mjs"), (module) => ({
|
|
96
96
|
stream: module.streamGoogleVertex,
|
|
97
97
|
streamSimple: module.streamSimpleGoogleVertex
|
|
98
98
|
}))
|
package/dist/{stream-first-event-timeout-BBys9hSb.mjs → stream-first-event-timeout-BIBomOGq.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as clampTimerTimeoutMs } from "./number-coercion-
|
|
1
|
+
import { n as clampTimerTimeoutMs } from "./number-coercion-1Miyb5MO.mjs";
|
|
2
2
|
//#region packages/ai/src/utils/stream-first-event-timeout.ts
|
|
3
3
|
function getFirstStreamEventTimeoutMs(options) {
|
|
4
4
|
return options?.firstEventTimeoutMs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as normalizeLowercaseStringOrEmpty, b as isRecord, n as getAiTransportHost } from "./host-Bl7Kgddo.mjs";
|
|
2
2
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
|
|
3
3
|
//#region packages/ai/src/utils/prompt-cache-stability.ts
|
|
4
4
|
/**
|
|
@@ -65,6 +65,55 @@ function prependSystemPromptAdditionAfterCacheBoundary(params) {
|
|
|
65
65
|
return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}\n\n${dynamicSuffix}`;
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
|
+
//#region packages/ai/src/providers/simple-options.ts
|
|
69
|
+
function buildBaseOptions(model, options, apiKey) {
|
|
70
|
+
const firstEventOptions = options;
|
|
71
|
+
return {
|
|
72
|
+
temperature: options?.temperature,
|
|
73
|
+
maxTokens: options?.maxTokens,
|
|
74
|
+
stop: options?.stop,
|
|
75
|
+
signal: options?.signal,
|
|
76
|
+
apiKey: apiKey || options?.apiKey,
|
|
77
|
+
transport: options?.transport,
|
|
78
|
+
cacheRetention: options?.cacheRetention,
|
|
79
|
+
sessionId: options?.sessionId,
|
|
80
|
+
promptCacheKey: options?.promptCacheKey,
|
|
81
|
+
headers: options?.headers,
|
|
82
|
+
onPayload: options?.onPayload,
|
|
83
|
+
onResponse: options?.onResponse,
|
|
84
|
+
timeoutMs: options?.timeoutMs,
|
|
85
|
+
firstEventTimeoutMs: firstEventOptions?.firstEventTimeoutMs,
|
|
86
|
+
onFirstEventTimeout: firstEventOptions?.onFirstEventTimeout,
|
|
87
|
+
maxRetries: options?.maxRetries,
|
|
88
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
89
|
+
metadata: options?.metadata
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function clampMaxTokensToModel(model, requestedMaxTokens) {
|
|
93
|
+
return requestedMaxTokens === void 0 ? void 0 : Math.max(1, Math.min(requestedMaxTokens, model.maxTokens));
|
|
94
|
+
}
|
|
95
|
+
function clampReasoning(effort) {
|
|
96
|
+
return effort === "xhigh" ? "high" : effort;
|
|
97
|
+
}
|
|
98
|
+
function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
|
|
99
|
+
const budgets = {
|
|
100
|
+
minimal: 1024,
|
|
101
|
+
low: 2048,
|
|
102
|
+
medium: 8192,
|
|
103
|
+
high: 16384,
|
|
104
|
+
max: 32768,
|
|
105
|
+
...customBudgets
|
|
106
|
+
};
|
|
107
|
+
const minOutputTokens = 1024;
|
|
108
|
+
let thinkingBudget = budgets[clampReasoning(reasoningLevel)];
|
|
109
|
+
const maxTokens = baseMaxTokens === void 0 ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);
|
|
110
|
+
if (maxTokens <= thinkingBudget) thinkingBudget = Math.max(0, maxTokens - minOutputTokens);
|
|
111
|
+
return {
|
|
112
|
+
maxTokens,
|
|
113
|
+
thinkingBudget
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
68
117
|
//#region packages/normalization-core/src/utf16-slice.ts
|
|
69
118
|
function isHighSurrogate(codeUnit) {
|
|
70
119
|
return codeUnit >= 55296 && codeUnit <= 56319;
|
|
@@ -222,4 +271,4 @@ function extractToolResultText(blocks) {
|
|
|
222
271
|
return sanitizeSurrogates(truncateProviderToolText(structuredTexts.join("\n")));
|
|
223
272
|
}
|
|
224
273
|
//#endregion
|
|
225
|
-
export { isImageWithMediaPayload as a,
|
|
274
|
+
export { normalizeStructuredPromptSection as _, isImageWithMediaPayload as a, buildBaseOptions as c, SYSTEM_PROMPT_CACHE_BOUNDARY as d, ensureSystemPromptCacheBoundary as f, normalizePromptCapabilityIds as g, stripSystemPromptCacheBoundary as h, hasMediaPayload as i, clampMaxTokensToModel as l, splitSystemPromptCacheBoundary as m, extractToolResultBlockText as n, truncateUtf16Safe as o, prependSystemPromptAdditionAfterCacheBoundary as p, extractToolResultText as r, adjustMaxTokensForThinking as s, describeToolResultMediaPlaceholder as t, clampReasoning as u, sortPromptCacheToolsByName as v };
|
package/dist/{tool-schema-json-projection-BwNu3nDi.mjs → tool-schema-json-projection-B1b-XCn5.mjs}
RENAMED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
+
import { n as getAiTransportHost } from "./host-Bl7Kgddo.mjs";
|
|
1
2
|
import { types } from "node:util";
|
|
3
|
+
//#region packages/ai/src/transports/host-policy.ts
|
|
4
|
+
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
5
|
+
const host = getAiTransportHost();
|
|
6
|
+
if (options !== void 0) return host.buildModelFetch(model, timeoutMs, options) ?? globalThis.fetch;
|
|
7
|
+
if (timeoutMs !== void 0) return host.buildModelFetch(model, timeoutMs) ?? globalThis.fetch;
|
|
8
|
+
return host.buildModelFetch(model) ?? globalThis.fetch;
|
|
9
|
+
}
|
|
10
|
+
function resolveProviderEndpoint(baseUrl) {
|
|
11
|
+
return { endpointClass: getAiTransportHost().resolveProviderEndpointClass(baseUrl) };
|
|
12
|
+
}
|
|
13
|
+
function resolveProviderRequestCapabilities(input) {
|
|
14
|
+
return getAiTransportHost().resolveProviderRequestCapabilities(input);
|
|
15
|
+
}
|
|
16
|
+
function resolveProviderRequestPolicyConfig(input) {
|
|
17
|
+
return { headers: getAiTransportHost().resolveProviderRequestHeaders(input) };
|
|
18
|
+
}
|
|
19
|
+
function resolveModelRequestTimeoutMs(model, timeoutMs) {
|
|
20
|
+
return timeoutMs ?? getAiTransportHost().resolveModelRequestTimeoutMs(model);
|
|
21
|
+
}
|
|
22
|
+
function resolveOpenAIStrictToolSetting(model, options) {
|
|
23
|
+
return getAiTransportHost().resolveOpenAIStrictToolSetting(model, options);
|
|
24
|
+
}
|
|
25
|
+
function transformTransportMessages(messages, model, normalizeToolCallId, options) {
|
|
26
|
+
return getAiTransportHost().transformTransportMessages(messages, model, normalizeToolCallId, options);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
2
29
|
//#region packages/ai/src/providers/tool-schema-json-projection.ts
|
|
3
30
|
function isJsonValue(value) {
|
|
4
31
|
if (value === null) return true;
|
|
@@ -91,4 +118,4 @@ function projectRuntimeToolInputSchema(schema, path = "parameters") {
|
|
|
91
118
|
};
|
|
92
119
|
}
|
|
93
120
|
//#endregion
|
|
94
|
-
export { projectRuntimeToolInputSchema as t };
|
|
121
|
+
export { resolveProviderEndpoint as a, transformTransportMessages as c, resolveOpenAIStrictToolSetting as i, buildGuardedModelFetch as n, resolveProviderRequestCapabilities as o, resolveModelRequestTimeoutMs as r, resolveProviderRequestPolicyConfig as s, projectRuntimeToolInputSchema as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as createAssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import {
|
|
1
|
+
import { r as createAssistantMessageEventStream } from "./event-stream-CEV9t6da.mjs";
|
|
2
|
+
import { n as getAiTransportHost, v as normalizeOptionalString } from "./host-Bl7Kgddo.mjs";
|
|
3
3
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-DT5o51ur.mjs";
|
|
4
|
-
import { o as truncateUtf16Safe } from "./tool-result-text-
|
|
5
|
-
import { i as parseStrictNonNegativeInteger, r as parseStrictFiniteNumber, t as asFiniteNumberInRange } from "./number-coercion-
|
|
4
|
+
import { o as truncateUtf16Safe } from "./tool-result-text-Dvkp2Dus.mjs";
|
|
5
|
+
import { i as parseStrictNonNegativeInteger, r as parseStrictFiniteNumber, t as asFiniteNumberInRange } from "./number-coercion-1Miyb5MO.mjs";
|
|
6
6
|
import { parseRetryAfterHttpDateMs } from "./internal/retry-after.mjs";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
//#region packages/ai/src/transports/transport-utils.ts
|
package/dist/transports.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { E as Model, L as StreamFn, O as OpenAICompletionsCompat, X as Usage, a as AssistantMessageEvent, i as AssistantMessage, n as Api, u as Context } from "./types-
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
3
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
4
|
-
import { a as OpenAICompletionsOptions,
|
|
5
|
-
import {
|
|
1
|
+
import { E as Model, L as StreamFn, O as OpenAICompletionsCompat, X as Usage, a as AssistantMessageEvent, i as AssistantMessage, n as Api, u as Context } from "./types-CH7ReIcU.mjs";
|
|
2
|
+
import { t as AssistantMessageEventStream } from "./event-stream-DRmDMRHH.mjs";
|
|
3
|
+
import { n as ApiRegistry } from "./api-registry-EpJoVwM1.mjs";
|
|
4
|
+
import { a as OpenAICompletionsOptions, i as BaseOpenAIStreamOptions, s as OpenAIToolProjection } from "./provider-options-C5kYML7i.mjs";
|
|
5
|
+
import { a as ReplayableResponseReasoningItem, c as ResolvedOpenAICompletionsCompat, i as OpenAIResponsesRequestParams, l as detectOpenAICompletionsCompat, n as OpenAIResponsesReasoningReplayMetadata, o as ResponsesPromptObservation, r as OpenAIResponsesReplayContext, t as OpenAIResponsesOptions, u as resolveOpenAICompletionsCompat } from "./openai-responses-contracts-BBKBfAqR.mjs";
|
|
6
6
|
import { n as FirstStreamEventInternalOptions } from "./stream-first-event-timeout-DvDeSucC.mjs";
|
|
7
7
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-Cwcjv_fx.mjs";
|
|
8
8
|
import OpenAI from "openai";
|
|
9
|
-
import {
|
|
9
|
+
import { ResponseCreateParamsStreaming, ResponseInput } from "openai/resources/responses/responses.js";
|
|
10
10
|
import { ChatCompletionChunk } from "openai/resources/chat/completions.js";
|
|
11
11
|
|
|
12
12
|
//#region packages/ai/src/transports/anthropic-payload-policy.d.ts
|
|
@@ -15,7 +15,7 @@ type AnthropicServiceTier = "auto" | "standard_only";
|
|
|
15
15
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
16
16
|
type AnthropicEphemeralCacheControl = {
|
|
17
17
|
type: "ephemeral";
|
|
18
|
-
ttl?: "1h";
|
|
18
|
+
ttl?: "1h" | "5m";
|
|
19
19
|
};
|
|
20
20
|
type AnthropicPayloadPolicyInput = {
|
|
21
21
|
api?: string;
|
|
@@ -33,6 +33,8 @@ type AnthropicPayloadPolicy = {
|
|
|
33
33
|
};
|
|
34
34
|
/** Resolve Anthropic cache-control marker retention for a request endpoint. */
|
|
35
35
|
declare function resolveAnthropicEphemeralCacheControl(baseUrl: string | undefined, cacheRetention: AnthropicPayloadPolicyInput["cacheRetention"]): AnthropicEphemeralCacheControl | undefined;
|
|
36
|
+
/** Apply one shared deepest-stable-message cache breakpoint policy. */
|
|
37
|
+
declare function applyAnthropicCacheControlToMessages(messages: unknown, cacheControl: AnthropicEphemeralCacheControl, markerLimit: number, cacheBreakpointOptOutMessageIndexes: ReadonlySet<number>): void;
|
|
36
38
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
37
39
|
declare function resolveAnthropicPayloadPolicy(input: AnthropicPayloadPolicyInput): AnthropicPayloadPolicy;
|
|
38
40
|
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
|
@@ -126,6 +128,15 @@ declare const log: {
|
|
|
126
128
|
info(message: string, data?: Record<string, unknown>): void;
|
|
127
129
|
warn(message: string, data?: Record<string, unknown>): void;
|
|
128
130
|
};
|
|
131
|
+
type OpenAICompletionsContentDelta = {
|
|
132
|
+
kind: "thinking";
|
|
133
|
+
signature?: string;
|
|
134
|
+
text: string;
|
|
135
|
+
} | {
|
|
136
|
+
kind: "text";
|
|
137
|
+
text: string;
|
|
138
|
+
source?: "refusal";
|
|
139
|
+
};
|
|
129
140
|
type OpenAIModeCompatInput = Omit<OpenAICompletionsCompat, "thinkingFormat"> & {
|
|
130
141
|
thinkingFormat?: string;
|
|
131
142
|
requiresStringContent?: boolean;
|
|
@@ -160,12 +171,20 @@ type MutableAssistantOutput = {
|
|
|
160
171
|
errorType?: string;
|
|
161
172
|
errorBody?: string;
|
|
162
173
|
};
|
|
174
|
+
declare function parseOpenAICompletionsUsage(rawUsage: NonNullable<ChatCompletionChunk["usage"]> & {
|
|
175
|
+
cost?: unknown;
|
|
176
|
+
prompt_cache_hit_tokens?: number;
|
|
177
|
+
}, model: Model, options?: {
|
|
178
|
+
includeReasoningTokens?: boolean;
|
|
179
|
+
}): MutableAssistantOutput["usage"];
|
|
163
180
|
type ModelStreamCooperativeScheduler = {
|
|
164
181
|
afterEvent: () => Promise<void>;
|
|
165
182
|
};
|
|
166
183
|
declare function throwIfModelStreamAborted(signal?: AbortSignal): void;
|
|
167
184
|
declare function createModelStreamCooperativeScheduler(signal?: AbortSignal): ModelStreamCooperativeScheduler;
|
|
168
185
|
declare function resolvePromptCacheKey(options: Pick<BaseOpenAIStreamOptions, "promptCacheKey" | "sessionId"> | undefined, cacheRetention: "short" | "long" | "none"): string | undefined;
|
|
186
|
+
declare function isOpenAICompletionsThinkingEnabled(effort: string): boolean;
|
|
187
|
+
declare function readOpenAICompletionsContentDeltas(content: unknown, topLevelRefusal?: unknown, mirroredThinking?: readonly string[]): OpenAICompletionsContentDelta[];
|
|
169
188
|
//#endregion
|
|
170
189
|
//#region packages/ai/src/transports/openai-transport-params.d.ts
|
|
171
190
|
declare function readCodeModePayloadToolName(tool: unknown): string | undefined;
|
|
@@ -247,18 +266,12 @@ declare function processOpenAICompletionsStream(responseStream: AsyncIterable<Ch
|
|
|
247
266
|
}): Promise<void>;
|
|
248
267
|
declare function shouldEmitOpenAICompletionsReasoningForModel(model: OpenAIModeModel, options: OpenAICompletionsOptions | undefined): boolean;
|
|
249
268
|
declare function buildOpenAICompletionsParams(model: OpenAIModeModel, context: Context, options: OpenAICompletionsOptions | undefined): Record<string, unknown>;
|
|
250
|
-
declare function parseTransportChunkUsage(rawUsage: NonNullable<ChatCompletionChunk["usage"]> & {
|
|
251
|
-
cost?: unknown;
|
|
252
|
-
prompt_tokens_details?: {
|
|
253
|
-
cache_write_tokens?: number | null;
|
|
254
|
-
};
|
|
255
|
-
}, model: Model): MutableAssistantOutput["usage"];
|
|
256
269
|
declare const completionsTesting: {
|
|
257
270
|
getCompat: typeof getCompat;
|
|
258
271
|
createSseDoneDetector: typeof createSseDoneDetector;
|
|
259
272
|
createOpenAICompletionsClient: typeof createOpenAICompletionsClient;
|
|
260
273
|
buildOpenAICompletionsClientConfig: typeof buildOpenAICompletionsClientConfig;
|
|
261
|
-
parseTransportChunkUsage: typeof
|
|
274
|
+
parseTransportChunkUsage: typeof parseOpenAICompletionsUsage;
|
|
262
275
|
processOpenAICompletionsStream: typeof processOpenAICompletionsStream;
|
|
263
276
|
shouldEmitOpenAICompletionsReasoningForModel: typeof shouldEmitOpenAICompletionsReasoningForModel;
|
|
264
277
|
};
|
|
@@ -351,67 +364,18 @@ declare function summarizeResponsesFailedNoDetailsObservation(observation: Respo
|
|
|
351
364
|
declare function normalizeResponsesFailedEvent(event: Record<string, unknown>, model: Model): ResponsesFailedEventSummary;
|
|
352
365
|
declare function summarizeResponsesPayload(params: unknown): string;
|
|
353
366
|
//#endregion
|
|
354
|
-
//#region packages/ai/src/transports/openai-responses-contracts.d.ts
|
|
355
|
-
declare const OPENAI_RESPONSES_REASONING_REPLAY_META_KEY = "__openclaw_replay";
|
|
356
|
-
type OpenAIResponsesReasoningReplayMetadata = {
|
|
357
|
-
v: 1;
|
|
358
|
-
source: "openai-responses";
|
|
359
|
-
provider: string;
|
|
360
|
-
api: Api;
|
|
361
|
-
model: string;
|
|
362
|
-
baseUrlHash?: string;
|
|
363
|
-
sessionHash?: string;
|
|
364
|
-
authProfileHash?: string;
|
|
365
|
-
};
|
|
366
|
-
type ReplayableResponseReasoningItem = Omit<ResponseReasoningItem, "id"> & {
|
|
367
|
-
id?: string;
|
|
368
|
-
[OPENAI_RESPONSES_REASONING_REPLAY_META_KEY]?: OpenAIResponsesReasoningReplayMetadata;
|
|
369
|
-
};
|
|
370
|
-
type OpenAIResponsesOptions = BaseOpenAIStreamOptions & {
|
|
371
|
-
reasoning?: OpenAIReasoningEffort;
|
|
372
|
-
reasoningEffort?: OpenAIReasoningEffort;
|
|
373
|
-
reasoningSummary?: "auto" | "detailed" | "concise" | null;
|
|
374
|
-
replayResponsesItemIds?: boolean;
|
|
375
|
-
serviceTier?: ResponseCreateParamsStreaming["service_tier"];
|
|
376
|
-
toolChoice?: ResponseCreateParamsStreaming["tool_choice"];
|
|
377
|
-
};
|
|
378
|
-
type OpenAIResponsesReplayContext = {
|
|
379
|
-
provider: string;
|
|
380
|
-
api: Api;
|
|
381
|
-
model: string;
|
|
382
|
-
baseUrlHash?: string;
|
|
383
|
-
sessionHash?: string;
|
|
384
|
-
authProfileHash?: string;
|
|
385
|
-
};
|
|
386
|
-
type OpenAIResponsesRequestParams = {
|
|
387
|
-
model: string;
|
|
388
|
-
input: ResponseInput;
|
|
389
|
-
stream: true;
|
|
390
|
-
instructions?: string;
|
|
391
|
-
prompt_cache_key?: string;
|
|
392
|
-
prompt_cache_retention?: "24h";
|
|
393
|
-
metadata?: Record<string, string>;
|
|
394
|
-
store?: boolean;
|
|
395
|
-
max_output_tokens?: number;
|
|
396
|
-
temperature?: number;
|
|
397
|
-
top_p?: number;
|
|
398
|
-
text?: ResponseCreateParamsStreaming["text"];
|
|
399
|
-
service_tier?: ResponseCreateParamsStreaming["service_tier"];
|
|
400
|
-
tools?: FunctionTool[];
|
|
401
|
-
tool_choice?: ResponseCreateParamsStreaming["tool_choice"];
|
|
402
|
-
reasoning?: {
|
|
403
|
-
effort: OpenAIApiReasoningEffort;
|
|
404
|
-
} | {
|
|
405
|
-
effort: OpenAIApiReasoningEffort;
|
|
406
|
-
summary: NonNullable<OpenAIResponsesOptions["reasoningSummary"]>;
|
|
407
|
-
};
|
|
408
|
-
include?: string[];
|
|
409
|
-
};
|
|
410
|
-
//#endregion
|
|
411
367
|
//#region packages/ai/src/transports/openai-responses-params-internal.d.ts
|
|
412
368
|
declare function sanitizeOpenAICodexResponsesParams<T extends Record<string, unknown>>(model: Model, params: T): T;
|
|
413
369
|
declare function buildOpenAIResponsesParams(model: Model, context: Context, options: OpenAIResponsesOptions | undefined, metadata?: Record<string, string>): OpenAIResponsesRequestParams;
|
|
414
370
|
//#endregion
|
|
371
|
+
//#region packages/ai/src/transports/openai-responses-prompt-observer-internal.d.ts
|
|
372
|
+
type ResponsesPromptRequest = {
|
|
373
|
+
instructions?: unknown;
|
|
374
|
+
input?: unknown;
|
|
375
|
+
};
|
|
376
|
+
type ResponsesPromptMetadata = Pick<ResponsesPromptObservation, "egress" | "payloadVariant">;
|
|
377
|
+
declare function createResponsesPromptEgressObserver(options: object | undefined, assembledPrompt: string | undefined): ((request: ResponsesPromptRequest, metadata: ResponsesPromptMetadata) => void) | undefined;
|
|
378
|
+
//#endregion
|
|
415
379
|
//#region packages/ai/src/transports/openai-responses-replay-internal.d.ts
|
|
416
380
|
type ResponsesClientLike = ReturnType<typeof createOpenAIResponsesClient>;
|
|
417
381
|
declare function isInvalidEncryptedContentError(error: unknown): boolean;
|
|
@@ -424,7 +388,11 @@ declare function createResponsesStreamWithEncryptedContentRetry(params: {
|
|
|
424
388
|
request: OpenAIResponsesRequestParams;
|
|
425
389
|
requestOptions: unknown;
|
|
426
390
|
model: Model;
|
|
427
|
-
|
|
391
|
+
observePrompt?: NonNullable<ReturnType<typeof createResponsesPromptEgressObserver>>;
|
|
392
|
+
}): Promise<{
|
|
393
|
+
stream: AsyncIterable<unknown>;
|
|
394
|
+
response: Response;
|
|
395
|
+
}>;
|
|
428
396
|
declare function resolveAzureOpenAIApiVersion(env?: NodeJS.ProcessEnv): string;
|
|
429
397
|
//#endregion
|
|
430
398
|
//#region packages/ai/src/transports/openai-responses-stream-terminal-internal.d.ts
|
|
@@ -570,4 +538,4 @@ declare function failTransportStream(params: {
|
|
|
570
538
|
//#region packages/ai/src/transports/transport-utils.d.ts
|
|
571
539
|
declare function isCodeModeModelVisibleToolName(name: string, visibleToolNames: ReadonlySet<string>): boolean;
|
|
572
540
|
//#endregion
|
|
573
|
-
export { GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, MutableAssistantOutput, type OpenAICompletionsOptions, OpenAIModeModel, ResolvedOpenAICompletionsCompat, WritableTransportStream, applyAnthropicEphemeralCacheControlMarkers, applyAnthropicPayloadPolicyToParams, applyOpenAIResponsesPayloadPolicy, assertCodeModeResponsesToolSurface, assignTransportErrorDetails, buildOpenAIClientHeaders, buildOpenAICompletionsParams, buildOpenAISdkClientOptions, buildOpenAISdkRequestOptions, buildTransportAwareSimpleStreamFn, canonicalizeMaxTokensParam, coerceTransportToolCallArguments, createAnthropicMessagesTransportStreamFn, createAzureOpenAIResponsesTransportStreamFn, createBoundaryAwareStreamFnForModel, createDeepSeekTextFilter, createEmptyTransportUsage, createModelStreamCooperativeScheduler, createOpenAICompletionsTransportStreamFn, createOpenAIResponsesTransportStreamFn, createOpenClawTransportStreamFnForModel, createTransportAwareStreamFnForModel, createWritableTransportEventStream, detectOpenAICompletionsCompat, emitModelTransportDebug, enforceCodeModeResponsesToolSurface, failTransportStream, filterCodeModePayloadTools, finalizeTransportStream, flattenCompletionMessagesToStringContent, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, getCompat, hasOpenAICompatibleConversationTurn, isCodeModeModelVisibleToolName, isOpenAICodexResponsesModel, log, mergeTransportHeaders, mergeTransportMetadata, normalizeCodexResponsesBaseUrlForOpenAISdk, parseJsonObjectPreservingUnsafeIntegers, parseJsonPreservingUnsafeIntegers, prepareModelForSimpleCompletion, prepareTransportAwareSimpleModel, quoteUnsafeIntegerLiterals, readCodeModePayloadToolName, resolveAnthropicEphemeralCacheControl, resolveAnthropicMessagesUrl, resolveAnthropicPayloadPolicy, resolveCodeModeResponsesVisibleToolNames, resolveMaxTokensParam, resolveModelPayloadDebugMode, resolveModelSseDebugMode, resolveOpenAICompletionsCompat, resolveOpenAIReasoningEffortMap, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIStrictToolFlagWithDiagnostics, resolvePromptCacheKey, resolveReplayableResponsesMessageId, resolveTransportAwareSimpleApi, sanitizeNonEmptyTransportPayloadText, sanitizeResponsesImagePayload, sanitizeTransportPayloadText, sortPromptCacheToolsByName as sortTransportToolsByName, stripCompletionMessagesToRoleContent, throwIfModelStreamAborted, transportAbortError, usesNativeOpenAICodexResponsesBackend };
|
|
541
|
+
export { GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, MutableAssistantOutput, OpenAICompletionsContentDelta, type OpenAICompletionsOptions, OpenAIModeModel, ResolvedOpenAICompletionsCompat, WritableTransportStream, applyAnthropicCacheControlToMessages, applyAnthropicEphemeralCacheControlMarkers, applyAnthropicPayloadPolicyToParams, applyOpenAIResponsesPayloadPolicy, assertCodeModeResponsesToolSurface, assignTransportErrorDetails, buildOpenAIClientHeaders, buildOpenAICompletionsParams, buildOpenAISdkClientOptions, buildOpenAISdkRequestOptions, buildTransportAwareSimpleStreamFn, canonicalizeMaxTokensParam, coerceTransportToolCallArguments, createAnthropicMessagesTransportStreamFn, createAzureOpenAIResponsesTransportStreamFn, createBoundaryAwareStreamFnForModel, createDeepSeekTextFilter, createEmptyTransportUsage, createModelStreamCooperativeScheduler, createOpenAICompletionsTransportStreamFn, createOpenAIResponsesTransportStreamFn, createOpenClawTransportStreamFnForModel, createTransportAwareStreamFnForModel, createWritableTransportEventStream, detectOpenAICompletionsCompat, emitModelTransportDebug, enforceCodeModeResponsesToolSurface, failTransportStream, filterCodeModePayloadTools, finalizeTransportStream, flattenCompletionMessagesToStringContent, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, getCompat, hasOpenAICompatibleConversationTurn, isCodeModeModelVisibleToolName, isOpenAICodexResponsesModel, isOpenAICompletionsThinkingEnabled, log, mergeTransportHeaders, mergeTransportMetadata, normalizeCodexResponsesBaseUrlForOpenAISdk, parseJsonObjectPreservingUnsafeIntegers, parseJsonPreservingUnsafeIntegers, parseOpenAICompletionsUsage, prepareModelForSimpleCompletion, prepareTransportAwareSimpleModel, quoteUnsafeIntegerLiterals, readCodeModePayloadToolName, readOpenAICompletionsContentDeltas, resolveAnthropicEphemeralCacheControl, resolveAnthropicMessagesUrl, resolveAnthropicPayloadPolicy, resolveCodeModeResponsesVisibleToolNames, resolveMaxTokensParam, resolveModelPayloadDebugMode, resolveModelSseDebugMode, resolveOpenAICompletionsCompat, resolveOpenAIReasoningEffortMap, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIStrictToolFlagWithDiagnostics, resolvePromptCacheKey, resolveReplayableResponsesMessageId, resolveTransportAwareSimpleApi, sanitizeNonEmptyTransportPayloadText, sanitizeResponsesImagePayload, sanitizeTransportPayloadText, sortPromptCacheToolsByName as sortTransportToolsByName, stripCompletionMessagesToRoleContent, throwIfModelStreamAborted, transportAbortError, usesNativeOpenAICodexResponsesBackend };
|