@openclaw/ai 2026.10.1 → 2026.10.5-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/README.md +6 -0
- package/dist/{anthropic-BDfXKgF1.mjs → anthropic-BAHKgWam.mjs} +30 -59
- package/dist/{anthropic-payload-policy-BZUAchqb.d.mts → anthropic-payload-policy-DGblkHL5.d.mts} +19 -16
- package/dist/{anthropic-stream-reducer-DHt9uFWX.mjs → anthropic-stream-reducer-g6w1YVii.mjs} +195 -283
- package/dist/{api-registry-DcEP_o4h.d.mts → api-registry-BhXXYdRA.d.mts} +2 -2
- package/dist/assistant-message-events-CHMJgbhs.mjs +18 -0
- package/dist/{assistant-output-mJ9cL4Qg.mjs → assistant-output-CUEeSotf.mjs} +2 -2
- package/dist/{assistant-text-phase-DAv1BdTm.mjs → assistant-text-phase-BrV8KdFO.mjs} +7 -6
- package/dist/{azure-openai-responses-gn9hMf8x.mjs → azure-openai-responses-C7qBuR23.mjs} +8 -9
- package/dist/{credential-redaction-BKv49aiv.d.mts → credential-redaction-BHxruEH6.d.mts} +3 -1
- package/dist/{diagnostics-Caj-4RBA.mjs → diagnostics-tQasYct1.mjs} +10 -3
- package/dist/diagnostics.d.mts +7 -7
- package/dist/diagnostics.mjs +3 -3
- package/dist/{env-api-keys-CyX4VKGO.mjs → env-api-keys-CrxwdylR.mjs} +24 -35
- package/dist/event-stream-6UNs-AhN.d.mts +1 -0
- package/dist/{event-stream-DrRM_90c.d.mts → event-stream-BcqWLo_u.d.mts} +1 -1
- package/dist/{event-stream-C5AbCAaZ.mjs → event-stream-X2gmsUWv.mjs} +5 -8
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/google-Boz2QcpK.mjs +20 -0
- package/dist/{google-interactions-DXu4IYGb.mjs → google-interactions-tjAb1mc5.mjs} +52 -84
- package/dist/{google-messages-Bmheetdg.mjs → google-messages-C-RZzloH.mjs} +25 -35
- package/dist/google-provider-stream-CMImyxbX.mjs +58 -0
- package/dist/{google-shared-DE_ddfsC.mjs → google-shared-OyAtMTZv.mjs} +6 -15
- package/dist/google-vertex-hCxTJea7.mjs +40 -0
- package/dist/{host-BjIYEjwT.d.mts → host-CTDz7LXD.d.mts} +6 -3
- package/dist/{host-JpNulOOs.mjs → host-JWXZWa-c.mjs} +3 -2
- package/dist/{host-policy-CC5H0iRZ.mjs → host-policy-q4Azym9F.mjs} +1 -1
- package/dist/{index-DJrNQnKw.d.mts → index-BYDvopUB.d.mts} +8 -5
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +7 -6
- package/dist/internal/anthropic.d.mts +5 -5
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +8 -1
- package/dist/internal/openai-responses-payload-policy.mjs +3 -3
- package/dist/internal/openai.d.mts +9 -9
- package/dist/internal/openai.mjs +9 -11
- package/dist/internal/runtime.d.mts +31 -13
- package/dist/internal/runtime.mjs +10 -13
- package/dist/internal/shared.d.mts +5 -5
- package/dist/internal/shared.mjs +6 -7
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{llm-request-activity-D8f_oxHj.mjs → llm-request-activity-CfMuh5cC.mjs} +2 -2
- package/dist/{mistral-1Bnbneg1.mjs → mistral-DUveP4hF.mjs} +71 -146
- package/dist/{model-transport-url-C5f59L3Y.d.mts → model-transport-url-BrsjjdjR.d.mts} +5 -1
- package/dist/{number-coercion-V8-BhME4.mjs → number-coercion-C3hztWoY.mjs} +5 -4
- package/dist/{openai-chatgpt-responses-CB1JwNFF.mjs → openai-chatgpt-responses-OCwckGhY.mjs} +164 -234
- package/dist/{openai-completions-BPadHHKe.mjs → openai-completions-DOltBUe9.mjs} +7 -6
- package/dist/{openai-completions-compat-CJ0ktmGy.d.mts → openai-completions-compat-i-nLZxFy.d.mts} +10 -11
- package/dist/{openai-completions-compat-D7hWYB0G.mjs → openai-completions-compat-pg1q4uNG.mjs} +10 -6
- package/dist/{openai-completions-transport-DITBEALX.mjs → openai-completions-transport-OMrn7gnZ.mjs} +1429 -294
- package/dist/{openai-prompt-cache-Dj8qeOHT.mjs → openai-prompt-cache-Cr2xKVrS.mjs} +1 -1
- package/dist/{openai-prompt-cache-C-Q1Ksfs.d.mts → openai-prompt-cache-DIPMrMFy.d.mts} +2 -2
- package/dist/{openai-responses-1_TvcWI3.mjs → openai-responses-BSBJUA19.mjs} +9 -10
- package/dist/{openai-responses-compaction-replay-BB2SWdsx.d.mts → openai-responses-compaction-replay-B2FE4Nw8.d.mts} +4 -4
- package/dist/{openai-responses-contracts-sAvdqNjS.d.mts → openai-responses-contracts-DKqMJ1Ct.d.mts} +9 -4
- package/dist/{openai-responses-contracts-BKu8O7l4.mjs → openai-responses-contracts-DlKMMTxK.mjs} +26 -6
- package/dist/{openai-responses-compaction-window-m878aVpU.mjs → openai-responses-endpoint-CinGh4VZ.mjs} +14 -4
- package/dist/{openai-responses-prompt-observer-internal-CbH84xIS.mjs → openai-responses-request-lifecycle-D2IFiI0-.mjs} +39 -4
- package/dist/{openai-responses-shared-TCJRAoMW.mjs → openai-responses-shared-DVGhq5xF.mjs} +1036 -327
- package/dist/{openai-responses-terminal-usage-BVvyXZ8u.d.mts → openai-responses-terminal-usage-BygjiAdi.d.mts} +2 -2
- package/dist/{openai-tool-schema-DYNePiF8.mjs → openai-tool-schema-DDPXsvJP.mjs} +236 -399
- package/dist/{positive-integer-CwLi8LUL.mjs → positive-integer-CqWjqSi9.mjs} +1 -1
- package/dist/{provider-error-DQBE1bUQ.mjs → provider-error-CF9GWCs2.mjs} +5 -3
- package/dist/{provider-options-Dk4PeQV3.d.mts → provider-options-CVrXZBtA.d.mts} +3 -2
- package/dist/{provider-transport-turn-state-8c_Nj2NS.mjs → provider-transport-turn-state-LuCaTsSO.mjs} +2 -2
- package/dist/{provider-types-De8PRdR0.d.mts → provider-types-CHtRx0dI.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +12 -12
- package/dist/{reasoning-tag-text-partitioner-Ju9VpUGl.mjs → reasoning-tag-text-partitioner-0-Rsezog.mjs} +13 -12
- package/dist/{required-api-key-D4kn3252.mjs → required-api-key-CFJvcFy_.mjs} +1 -1
- package/dist/{simple-options-wW3117Fu.mjs → simple-options-BARFAzk9.mjs} +9 -11
- package/dist/{src-DWJq14pn.mjs → src-C_wfIUmV.mjs} +19 -4
- package/dist/{stream-CElngO8h.mjs → stream-DwrETW0_.mjs} +12 -21
- package/dist/{stream-first-event-timeout-D9ZmL_s9.mjs → stream-first-event-timeout-Dc42hKv6.mjs} +8 -21
- package/dist/{streaming-byte-guard-CC-HMn_u.mjs → streaming-byte-guard-DBXr1XYn.mjs} +16 -1
- package/dist/{string-normalization-PN10hf6d.mjs → string-normalization-I3ux50s9.mjs} +1 -1
- package/dist/{text-signature-rOn31nxc.mjs → text-signature-B_MB6U_9.mjs} +32 -5
- package/dist/{tool-schema-json-projection-Ct8SeBeJ.mjs → tool-schema-json-projection-B8sG1I9v.mjs} +29 -23
- package/dist/{transport-stream-shared-CAxkgOSj.d.mts → transport-stream-shared-BmpzDtdQ.d.mts} +4 -4
- package/dist/{transport-stream-shared-C5TAc3U_.mjs → transport-stream-shared-DH08b7Il.mjs} +8 -16
- package/dist/transports.d.mts +33 -22
- package/dist/transports.mjs +73 -1234
- package/dist/{types-DvzmWW8J.d.mts → types-Bd2T86VJ.d.mts} +5 -23
- package/dist/types-Kdfw_04V.d.mts +1 -0
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +5 -4
- package/dist/{validation-B3lQt_VE.d.mts → validation-DdGB1yy3.d.mts} +1 -1
- package/dist/{validation-DbqlIfDn.mjs → validation-opC2pjk9.mjs} +2 -3
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +4 -9
- package/dist/env-api-keys-BR0MUYYD.d.mts +0 -17
- package/dist/event-stream-DqDQWqiy.d.mts +0 -1
- package/dist/google-CyMz2jF_.mjs +0 -54
- package/dist/google-vertex-BEW0OQIA.mjs +0 -88
- package/dist/internal/env-api-keys.d.mts +0 -2
- package/dist/internal/env-api-keys.mjs +0 -2
- package/dist/openai-responses-request-lifecycle-Fsag-IGZ.mjs +0 -36
- package/dist/openai-transport-params-ildrm49s.mjs +0 -735
- package/dist/openai-web-search-tools-Cfu0uLyN.mjs +0 -14
- package/dist/provider-replay-context-ywPKKLjL.mjs +0 -25
- package/dist/types-Dlz-8qcy.d.mts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-
|
|
1
|
+
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-pg1q4uNG.mjs";
|
|
2
2
|
//#region packages/normalization-core/src/code-points.ts
|
|
3
3
|
/** Truncates to a nonnegative code-point budget; grapheme clusters may be split. */
|
|
4
4
|
function truncateCodePoints(text, maxCodePoints) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as OpenAICompletionsCompat, k as Model, l as CacheRetention } from "./types-
|
|
2
|
-
import "./types-
|
|
1
|
+
import { N as OpenAICompletionsCompat, k as Model, l as CacheRetention } from "./types-Bd2T86VJ.mjs";
|
|
2
|
+
import "./types-Kdfw_04V.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/openai-prompt-cache.d.ts
|
|
4
4
|
/** Selects documented lifetime fields shared by Responses and Chat Completions. */
|
|
5
5
|
declare function resolveOpenAIPromptCacheParams(model: Pick<Model, "id" | "provider" | "baseUrl">, cacheRetention: CacheRetention, compat: Required<Pick<OpenAICompletionsCompat, "supportsPromptCacheKey" | "supportsLongCacheRetention">>): {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
2
|
+
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-Cr2xKVrS.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-pg1q4uNG.mjs";
|
|
5
5
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
6
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
7
|
-
import {
|
|
8
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
9
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
10
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
11
|
-
import {
|
|
12
|
-
import { t as requireApiKey } from "./required-api-key-D4kn3252.mjs";
|
|
6
|
+
import { n as buildBaseOptions } from "./simple-options-BARFAzk9.mjs";
|
|
7
|
+
import { F as convertProviderResponsesMessages, _t as resolveOpenAISimpleReasoningEffort, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-DVGhq5xF.mjs";
|
|
8
|
+
import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
|
|
9
|
+
import { t as createAssistantOutput } from "./assistant-output-CUEeSotf.mjs";
|
|
10
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-LuCaTsSO.mjs";
|
|
11
|
+
import { t as requireApiKey } from "./required-api-key-CFJvcFy_.mjs";
|
|
13
12
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
14
13
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
15
14
|
streamOpenAIResponses: () => streamOpenAIResponses,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { a as AssistantMessage, k as Model } from "./types-
|
|
3
|
-
import "./provider-options-
|
|
4
|
-
import { i as ReplayableResponseCompactionItem, l as OpenAIResponsesCompactionOutput, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-
|
|
1
|
+
import "./index-BYDvopUB.mjs";
|
|
2
|
+
import { a as AssistantMessage, k as Model } from "./types-Bd2T86VJ.mjs";
|
|
3
|
+
import "./provider-options-CVrXZBtA.mjs";
|
|
4
|
+
import { i as ReplayableResponseCompactionItem, l as OpenAIResponsesCompactionOutput, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-DKqMJ1Ct.mjs";
|
|
5
5
|
import "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/transports/openai-responses-compaction-replay.d.ts
|
|
7
7
|
declare function captureOpenAIResponsesCompaction(output: Pick<AssistantMessage, "providerReplay">, item: ReplayableResponseCompactionItem, boundary: number | "retained-users", model: Model, captureMetadata?: OpenAIResponsesReasoningReplayMetadata, compactedOutput?: OpenAIResponsesCompactionOutput): void;
|
package/dist/{openai-responses-contracts-sAvdqNjS.d.mts → openai-responses-contracts-DKqMJ1Ct.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { M as ModelThinkingLevel, k as Model, n as Api } from "./types-
|
|
3
|
-
import { a as BaseOpenAIStreamOptions, f as OpenAIReasoningEffort } from "./provider-options-
|
|
4
|
-
import "./types-
|
|
1
|
+
import "./index-BYDvopUB.mjs";
|
|
2
|
+
import { M as ModelThinkingLevel, k as Model, n as Api } from "./types-Bd2T86VJ.mjs";
|
|
3
|
+
import { a as BaseOpenAIStreamOptions, f as OpenAIReasoningEffort } from "./provider-options-CVrXZBtA.mjs";
|
|
4
|
+
import "./types-Kdfw_04V.mjs";
|
|
5
5
|
import { ResponseCompactionItem, ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/providers/openai-request-reasoning.d.ts
|
|
7
7
|
type OpenAIRequestReasoningEffort = ModelThinkingLevel | "none";
|
|
@@ -55,12 +55,17 @@ declare const responsesPromptObserver: {
|
|
|
55
55
|
type ResponsesServiceTierObservation = {
|
|
56
56
|
requestedTier: string;
|
|
57
57
|
responseTier: string;
|
|
58
|
+
rejected?: false;
|
|
59
|
+
} | {
|
|
60
|
+
requestedTier: string;
|
|
61
|
+
rejected: true;
|
|
58
62
|
};
|
|
59
63
|
type ResponsesServiceTierObserver = (observation: ResponsesServiceTierObservation) => void;
|
|
60
64
|
declare const responsesServiceTierObserver: {
|
|
61
65
|
set(options: object, observer: ResponsesServiceTierObserver): void;
|
|
62
66
|
get(options: object): ResponsesServiceTierObserver | undefined;
|
|
63
67
|
copy(source: object | undefined, target: object): void;
|
|
68
|
+
reject(options: object | undefined, requestedTier: string): void;
|
|
64
69
|
observe(options: object | undefined, requestedTier: unknown, responseTier: unknown): void;
|
|
65
70
|
};
|
|
66
71
|
//#endregion
|
package/dist/{openai-responses-contracts-BKu8O7l4.mjs → openai-responses-contracts-DlKMMTxK.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE } from "./types-CQc6JNG4.mjs";
|
|
2
2
|
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
3
3
|
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
|
|
4
|
-
import { n as normalizeUniqueTrimmedStringList } from "./string-normalization-
|
|
4
|
+
import { n as normalizeUniqueTrimmedStringList } from "./string-normalization-I3ux50s9.mjs";
|
|
5
5
|
//#region packages/llm-core/src/model-data.ts
|
|
6
6
|
const MODEL_DATA_APIS = [
|
|
7
7
|
"openai-completions",
|
|
@@ -37,7 +37,6 @@ const MODEL_DATA_THINKING_LEVELS = [
|
|
|
37
37
|
];
|
|
38
38
|
[...MODEL_DATA_APIS];
|
|
39
39
|
[...MODEL_DATA_THINKING_FORMATS];
|
|
40
|
-
/** Model-level thinking settings carried by provider catalog metadata. */
|
|
41
40
|
const MODEL_CATALOG_THINKING_LEVELS = [...MODEL_DATA_THINKING_LEVELS];
|
|
42
41
|
const OPENAI_THINKING_APIS = /* @__PURE__ */ new Set([
|
|
43
42
|
"openai-completions",
|
|
@@ -242,6 +241,20 @@ function resolveOpenAIReasoningEffortForModel(params) {
|
|
|
242
241
|
return (requestedRank < 0 ? void 0 : ranked.findLast((effort) => ENABLED_REASONING_EFFORTS.indexOf(effort) <= requestedRank) ?? ranked[0]) ?? supported.find((effort) => !isDisabledReasoningEffort(normalizeOpenAIReasoningEffort(effort)));
|
|
243
242
|
}
|
|
244
243
|
//#endregion
|
|
244
|
+
//#region packages/ai/src/transports/openai-responses-service-tier.ts
|
|
245
|
+
/** Only an explicit parameter rejection permits resending at a slower tier. */
|
|
246
|
+
function isResponsesServiceTierRejection(error) {
|
|
247
|
+
if (!isRecord(error)) return false;
|
|
248
|
+
const detail = isRecord(error.error) ? error.error : error;
|
|
249
|
+
const status = error.status ?? detail.status;
|
|
250
|
+
if (status !== void 0 && status !== 400 && status !== 422) return false;
|
|
251
|
+
return (detail.type === "invalid_request_error" || detail.code === "invalid_request_error" || detail.code === "unsupported_parameter" || detail.code === "unsupported_value" || detail.code === "invalid_value" || detail.code === "invalid_prompt" && detail.message === "Invalid service_tier argument" || detail.code === null && detail.param === "service_tier" && (detail.type === "error" || detail.type === void 0) || status === 400 || status === 422) && (detail.param === "service_tier" || detail.message === "Invalid service_tier argument");
|
|
252
|
+
}
|
|
253
|
+
function nextResponsesServiceTier(requestedTier, error) {
|
|
254
|
+
if (!isResponsesServiceTierRejection(error)) return;
|
|
255
|
+
return requestedTier === "ultrafast" ? "priority" : requestedTier === "priority" ? "default" : void 0;
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
245
258
|
//#region packages/ai/src/transports/openai-responses-contracts.ts
|
|
246
259
|
const DEFAULT_AZURE_OPENAI_API_VERSION = "preview";
|
|
247
260
|
const OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS = "Follow the user request.";
|
|
@@ -285,10 +298,11 @@ var OpenAIResponsesWebSocketSafeRetryError = class extends OpenAIResponsesWebSoc
|
|
|
285
298
|
function readWebSocketServerError(value) {
|
|
286
299
|
if (!isRecord(value) || value.type !== "error") return;
|
|
287
300
|
const details = isRecord(value.error) ? value.error : value;
|
|
288
|
-
|
|
301
|
+
const code = typeof details.code === "string" ? details.code : isResponsesServiceTierRejection(details) ? "invalid_request_error" : void 0;
|
|
302
|
+
if (!code || typeof details.message !== "string") return;
|
|
289
303
|
const rawStatus = value.status ?? value.status_code;
|
|
290
304
|
return {
|
|
291
|
-
code
|
|
305
|
+
code,
|
|
292
306
|
message: details.message,
|
|
293
307
|
param: typeof details.param === "string" ? details.param : null,
|
|
294
308
|
status: typeof rawStatus === "number" ? rawStatus : void 0
|
|
@@ -304,7 +318,7 @@ function parseOpenAIResponsesWebSocketServerError(cause) {
|
|
|
304
318
|
details = readWebSocketServerError(JSON.parse(cause.message));
|
|
305
319
|
} catch {}
|
|
306
320
|
if (!details) return;
|
|
307
|
-
return new (isPreviousResponseRejection(details) || details.code === "websocket_connection_limit_reached" || details.code === "invalid_encrypted_content" || details.code === "thinking_signature_invalid" ? OpenAIResponsesWebSocketSafeRetryError : OpenAIResponsesWebSocketServerError)(details.code, details.status, details.param, details.message, cause);
|
|
321
|
+
return new (isPreviousResponseRejection(details) || isResponsesServiceTierRejection(details) || details.code === "websocket_connection_limit_reached" || details.code === "invalid_encrypted_content" || details.code === "thinking_signature_invalid" ? OpenAIResponsesWebSocketSafeRetryError : OpenAIResponsesWebSocketServerError)(details.code, details.status, details.param, details.message, cause);
|
|
308
322
|
}
|
|
309
323
|
const PROMPT_OBSERVER = Symbol("openaiResponsesPromptObserver");
|
|
310
324
|
const responsesPromptObserver = {
|
|
@@ -331,6 +345,12 @@ const responsesServiceTierObserver = {
|
|
|
331
345
|
const observer = source && responsesServiceTierObserver.get(source);
|
|
332
346
|
if (observer) responsesServiceTierObserver.set(target, observer);
|
|
333
347
|
},
|
|
348
|
+
reject(options, requestedTier) {
|
|
349
|
+
(options && responsesServiceTierObserver.get(options))?.({
|
|
350
|
+
requestedTier,
|
|
351
|
+
rejected: true
|
|
352
|
+
});
|
|
353
|
+
},
|
|
334
354
|
observe(options, requestedTier, responseTier) {
|
|
335
355
|
const observer = options && responsesServiceTierObserver.get(options);
|
|
336
356
|
if (observer && typeof requestedTier === "string" && /^[a-z0-9_-]{1,64}$/i.test(requestedTier) && typeof responseTier === "string" && /^[a-z0-9_-]{1,64}$/i.test(responseTier)) observer({
|
|
@@ -340,4 +360,4 @@ const responsesServiceTierObserver = {
|
|
|
340
360
|
}
|
|
341
361
|
};
|
|
342
362
|
//#endregion
|
|
343
|
-
export {
|
|
363
|
+
export { MODEL_CATALOG_THINKING_LEVELS as A, normalizeOpenAIReasoningEffort as C, resolveOpenAISupportedReasoningEfforts as D, resolveOpenAIReasoningEffortMapping as E, resolveOpenAIThinkingApi as M, supportsOpenAIReasoningEffort as O, isOpenAIGpt6Model as S, resolveOpenAIReasoningEffortForModel as T, isResponsesServiceTierRejection as _, OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE as a, isOpenAIGpt55Model as b, OPENAI_RESPONSES_RETAINED_COMPACTION_REPLAY_TYPE as c, OpenAIResponsesWebSocketSafeRetryError as d, RESPONSE_FAILED_NO_DETAILS_MESSAGE as f, responsesServiceTierObserver as g, responsesPromptObserver as h, OPENAI_RESPONSES_APIS as i, listMappedModelThinkingLevels as j, supportsOpenAITemperature as k, OpenAIResponsesWebSocketPostDispatchError as l, parseOpenAIResponsesWebSocketServerError as m, DEFAULT_AZURE_OPENAI_API_VERSION as n, OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY as o, isPreviousResponseRejection as p, OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS as r, OPENAI_RESPONSES_REASONING_REPLAY_META_KEY as s, AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS as t, OpenAIResponsesWebSocketPreDispatchError as u, nextResponsesServiceTier as v, resolveOpenAIModelReasoningEfforts as w, isOpenAIGpt56Model as x, isOpenAIGpt54MiniModel as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
2
|
import { c as readStringValue, i as normalizeOptionalLowercaseString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-CtgOVOSv.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { O as supportsOpenAIReasoningEffort, i as OPENAI_RESPONSES_APIS } from "./openai-responses-contracts-DlKMMTxK.mjs";
|
|
4
4
|
import { t as canonicalizeBase64 } from "./base64-C8CdcsjU.mjs";
|
|
5
|
-
import { t as parsePositiveInteger } from "./positive-integer-
|
|
6
|
-
import {
|
|
5
|
+
import { t as parsePositiveInteger } from "./positive-integer-CqWjqSi9.mjs";
|
|
6
|
+
import { n as createSseByteGuard } from "./streaming-byte-guard-DBXr1XYn.mjs";
|
|
7
7
|
//#region packages/model-catalog-core/src/provider-id.ts
|
|
8
8
|
function normalizeProviderId(provider) {
|
|
9
9
|
return normalizeLowercaseStringOrEmpty(provider);
|
|
@@ -354,4 +354,14 @@ function createBoundedOpenAIResponsesCompactionFetch(upstreamFetch) {
|
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
356
|
//#endregion
|
|
357
|
-
|
|
357
|
+
//#region packages/ai/src/transports/openai-responses-endpoint.ts
|
|
358
|
+
function isOfficialOpenAIResponsesBaseUrl(baseUrl) {
|
|
359
|
+
if (!baseUrl) return false;
|
|
360
|
+
const url = URL.parse(baseUrl);
|
|
361
|
+
return url !== null && url.origin === "https://api.openai.com" && url.username === "" && url.password === "" && url.search === "" && url.hash === "" && url.pathname.replace(/\/+$/, "") === "/v1";
|
|
362
|
+
}
|
|
363
|
+
function supportsNativeOpenAIResponsesEndpoint(params) {
|
|
364
|
+
return params.provider.trim().toLowerCase() === "openai" && params.api === "openai-responses" && isOfficialOpenAIResponsesBaseUrl(params.baseUrl);
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
export { readOpenAIResponsesCompactionWindow as a, resolveOpenAIResponsesCompactEndpointPlan as c, isOpenAIResponsesCompactionOutput as i, resolveOpenAIResponsesPayloadPolicy as l, supportsNativeOpenAIResponsesEndpoint as n, sanitizeResponsesImagePayload as o, createBoundedOpenAIResponsesCompactionFetch as r, applyOpenAIResponsesPayloadPolicy as s, isOfficialOpenAIResponsesBaseUrl as t, resolveOpenAIResponsesServerCompactionPlan as u };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
+
import { h as responsesPromptObserver } from "./openai-responses-contracts-DlKMMTxK.mjs";
|
|
3
|
+
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-DH08b7Il.mjs";
|
|
4
|
+
import { C as stripSystemPromptCacheBoundary } from "./simple-options-BARFAzk9.mjs";
|
|
4
5
|
//#region packages/ai/src/transports/openai-responses-prompt-observer-internal.ts
|
|
5
6
|
function readFinalResponsesPrompt(request) {
|
|
6
7
|
if (typeof request.instructions === "string") return ["instructions", request.instructions];
|
|
@@ -29,4 +30,38 @@ function createResponsesPromptEgressObserver(options, assembledPrompt) {
|
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
|
-
|
|
33
|
+
//#region packages/ai/src/transports/openai-responses-request-lifecycle.ts
|
|
34
|
+
const lifecycleKey = Symbol("openclaw.responsesRequestLifecycle");
|
|
35
|
+
/** Private transport carrier: serialized options cannot mint host authority. */
|
|
36
|
+
const responsesRequestLifecycle = {
|
|
37
|
+
set(options, lifecycle) {
|
|
38
|
+
Object.defineProperty(options, lifecycleKey, {
|
|
39
|
+
value: lifecycle,
|
|
40
|
+
enumerable: true
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
get(options) {
|
|
44
|
+
if (!options) return;
|
|
45
|
+
return Reflect.get(options, lifecycleKey);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/** A transport receipt must settle before model output can authorize later work. */
|
|
49
|
+
function withResponsesRequestAcceptance(events, lifecycle, signal) {
|
|
50
|
+
if (!lifecycle) return events;
|
|
51
|
+
return { async *[Symbol.asyncIterator]() {
|
|
52
|
+
for await (const event of events) {
|
|
53
|
+
if (isRecord(event) && event.type === "response.created") {
|
|
54
|
+
const response = isRecord(event.response) ? event.response : void 0;
|
|
55
|
+
if (typeof response?.id !== "string" || !response.id.trim()) throw new Error("Provider continuation response has no identity");
|
|
56
|
+
signal?.throwIfAborted();
|
|
57
|
+
lifecycle.assertCurrent();
|
|
58
|
+
await lifecycle.accepted(response.id, signal);
|
|
59
|
+
signal?.throwIfAborted();
|
|
60
|
+
lifecycle.assertCurrent();
|
|
61
|
+
}
|
|
62
|
+
yield event;
|
|
63
|
+
}
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { withResponsesRequestAcceptance as n, createResponsesPromptEgressObserver as r, responsesRequestLifecycle as t };
|