@openclaw/ai 2026.9.33 → 2026.9.35
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-a0uD7NUz.mjs → anthropic-BL3z3SiB.mjs} +2 -2
- package/dist/{anthropic-payload-policy-BVcxWtQD.d.mts → anthropic-payload-policy-CFbalbbU.d.mts} +3 -3
- package/dist/{anthropic-stream-reducer-Cis7c1sm.mjs → anthropic-stream-reducer-XCL_L8KJ.mjs} +1 -1
- package/dist/{api-registry-pGjnPg1z.d.mts → api-registry-BLbq15N5.d.mts} +2 -2
- package/dist/{azure-openai-responses-CqWvI8x6.mjs → azure-openai-responses-DYSS_bLh.mjs} +3 -3
- package/dist/diagnostics.d.mts +4 -4
- package/dist/env-api-keys-BR0MUYYD.d.mts +17 -0
- package/dist/event-stream-B0vjWzHd.d.mts +1 -0
- package/dist/{event-stream-DOPFYVqs.d.mts → event-stream-CiaHxSK0.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-BfYNxKpG.mjs → google-D9zpPelZ.mjs} +1 -1
- package/dist/{google-interactions-BJNj0ugu.mjs → google-interactions-Br_n4tZB.mjs} +14 -11
- package/dist/{google-messages-C4ZiLG1P.mjs → google-messages-pvt0rKfN.mjs} +3 -1
- package/dist/{google-shared-6u4WCDyl.mjs → google-shared-DPeR7LLA.mjs} +9 -14
- package/dist/{google-vertex-CX1QaTs3.mjs → google-vertex-D4Qde9Qq.mjs} +1 -1
- package/dist/{host-COwfRiSL.d.mts → host-BhpDO5Sy.d.mts} +3 -3
- package/dist/{index-DHeFfpcz.d.mts → index-Iw8l620S.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/internal/anthropic.d.mts +5 -5
- package/dist/internal/anthropic.mjs +2 -2
- package/dist/internal/env-api-keys.d.mts +2 -0
- package/dist/internal/env-api-keys.mjs +2 -0
- package/dist/internal/google-model-family.d.mts +2 -0
- package/dist/internal/google-model-family.mjs +6 -2
- 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 +1 -1
- package/dist/internal/openai.d.mts +9 -9
- package/dist/internal/openai.mjs +6 -6
- package/dist/internal/runtime.d.mts +8 -23
- package/dist/internal/shared.d.mts +3 -3
- package/dist/internal/tool-schema.mjs +1 -1
- package/dist/{openai-chatgpt-responses-L0Jc-0DF.mjs → openai-chatgpt-responses-Crt3yb4D.mjs} +59 -50
- package/dist/{openai-completions-gyTpI3xG.mjs → openai-completions-BwcqZo-Y.mjs} +4 -4
- package/dist/{openai-completions-compat-D1q02qdx.mjs → openai-completions-compat-BuszNIRF.mjs} +5 -1
- package/dist/{openai-completions-compat-CqWP1fn5.d.mts → openai-completions-compat-WTcM-PUc.d.mts} +4 -3
- package/dist/{openai-completions-stream-BrsoGafc.mjs → openai-completions-stream-D--YONza.mjs} +14 -11
- package/dist/{openai-prompt-cache-DHxMpeRz.mjs → openai-prompt-cache-BcwCks0h.mjs} +1 -1
- package/dist/{openai-prompt-cache-YTmJ_iMS.d.mts → openai-prompt-cache-CuY5QDIc.d.mts} +2 -2
- package/dist/{openai-provider-client-D1gd0dfR.mjs → openai-provider-client-Co1u7I3J.mjs} +1 -1
- package/dist/{openai-responses-DluFZzn_.mjs → openai-responses-C7B8_pLG.mjs} +5 -5
- package/dist/{openai-responses-compaction-replay-CQHR2isp.d.mts → openai-responses-compaction-replay-DiGjwK4d.d.mts} +4 -4
- package/dist/{openai-responses-contracts-C2H8pffb.d.mts → openai-responses-contracts-CYScOS7J.d.mts} +4 -4
- package/dist/{openai-responses-prompt-observer-internal-C5WB2Kxf.mjs → openai-responses-prompt-observer-internal-CGhqoBH1.mjs} +6 -6
- package/dist/{openai-responses-shared-BpGnmnV8.mjs → openai-responses-shared-DLz_xgps.mjs} +504 -12
- package/dist/{openai-responses-terminal-usage-D0WZQlIF.d.mts → openai-responses-terminal-usage-CLzeNWqW.d.mts} +2 -2
- package/dist/{openai-tool-schema-vsl-cE-n.mjs → openai-tool-schema-DSAxYnHW.mjs} +18 -1
- package/dist/{openai-transport-params-C4eZAXf2.mjs → openai-transport-params-DzSQTRdN.mjs} +17 -5
- package/dist/{provider-options-yDbWMoEr.d.mts → provider-options-CFiaIG4K.d.mts} +2 -2
- package/dist/{provider-types-CHsKHBBD.d.mts → provider-types-Bx_6hBmK.d.mts} +3 -3
- package/dist/provider-types.d.mts +5 -5
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +9 -9
- package/dist/{transport-stream-shared-CYLM2HEK.d.mts → transport-stream-shared-B_REuIea.d.mts} +4 -4
- package/dist/{transport-utils-CnxX8hPj.mjs → transport-utils-B11GlmDO.mjs} +5 -1
- package/dist/transports.d.mts +15 -13
- package/dist/transports.mjs +18 -503
- package/dist/{types-CLLR3eB4.d.mts → types-B89w6ly2.d.mts} +11 -0
- package/dist/types-DbmNRKvK.d.mts +1 -0
- package/dist/types.d.mts +5 -5
- package/dist/{validation-Cat2wQsc.d.mts → validation-DblQWSRA.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +6 -1
- package/dist/event-stream-CMQfX_yr.d.mts +0 -1
- package/dist/types-CoL-LJ7j.d.mts +0 -1
package/dist/{openai-chatgpt-responses-L0Jc-0DF.mjs → openai-chatgpt-responses-Crt3yb4D.mjs}
RENAMED
|
@@ -3,22 +3,21 @@ import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
|
3
3
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { S as headersToRecord, n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DqhMLv8J.mjs";
|
|
5
5
|
import { d as supportsOpenAITemperature } from "./openai-reasoning-effort-C_0p3psG.mjs";
|
|
6
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
6
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-BcwCks0h.mjs";
|
|
7
7
|
import { _ as extractErrorCodeOrErrno, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, v as toErrorObject } from "./diagnostics-CJaB6g8J.mjs";
|
|
8
8
|
import { s as resolveTimerTimeoutMs } from "./base64-C1PsYcRQ.mjs";
|
|
9
|
-
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-
|
|
9
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-B11GlmDO.mjs";
|
|
10
10
|
import { parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
|
|
11
11
|
import { S as withProviderResponseHook, b as transportAbortError, h as notifyProviderStreamOpened, n as assignTransportErrorDetails } from "./transport-stream-shared-Dt7VrJFd.mjs";
|
|
12
12
|
import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-B9u6-CF3.mjs";
|
|
13
|
-
import { b as createOpenAIResponseHook, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, x as createResponseModelTracker, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-
|
|
13
|
+
import { b as createOpenAIResponseHook, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, x as createResponseModelTracker, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
14
14
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
15
15
|
import { n as createAssistantOutput } from "./provider-transcript-transform-Cg-36VSt.mjs";
|
|
16
16
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-B9o0S4SZ.mjs";
|
|
17
17
|
import { h as responsesPromptObserver } from "./openai-responses-contracts-CLxnqS9p.mjs";
|
|
18
|
-
import { A as recordResponsesContextUsage, P as convertProviderResponsesMessages, S as isInvalidEncryptedContentError, T as ResponsesStreamFailure, Z as suppressOpenAIResponsesCompaction, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, q as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, w as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-
|
|
19
|
-
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
18
|
+
import { A as recordResponsesContextUsage, P as convertProviderResponsesMessages, S as isInvalidEncryptedContentError, T as ResponsesStreamFailure, Z as suppressOpenAIResponsesCompaction, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, q as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, w as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-DLz_xgps.mjs";
|
|
20
19
|
import { n as registerSessionResourceCleanup } from "./session-resources-CkR4WWy1.mjs";
|
|
21
|
-
import { i as resolveOpenAIResponsesTextFormat, t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-
|
|
20
|
+
import { i as resolveOpenAIResponsesTextFormat, t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-CGhqoBH1.mjs";
|
|
22
21
|
import { n as withResponsesRequestAcceptance, t as responsesRequestLifecycle } from "./openai-responses-request-lifecycle-Fsag-IGZ.mjs";
|
|
23
22
|
import { n as resolveOpenAICodexAccountId } from "./openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
24
23
|
//#region packages/ai/src/providers/openai-chatgpt-responses-events.ts
|
|
@@ -83,7 +82,7 @@ function normalizeCodexStatus(status) {
|
|
|
83
82
|
}
|
|
84
83
|
//#endregion
|
|
85
84
|
//#region packages/ai/src/providers/openai-chatgpt-responses-protocol.ts
|
|
86
|
-
const
|
|
85
|
+
const OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES = 16777216;
|
|
87
86
|
var CodexProtocolError = class extends Error {
|
|
88
87
|
constructor(message, options) {
|
|
89
88
|
super(message);
|
|
@@ -95,44 +94,53 @@ var CodexProtocolError = class extends Error {
|
|
|
95
94
|
async function* parseOpenAIChatGptResponsesSse(response) {
|
|
96
95
|
if (!response.body) return;
|
|
97
96
|
const reader = response.body.getReader();
|
|
98
|
-
const guard = createSseByteGuard(reader, {
|
|
99
|
-
maxBytes: OPENAI_CHATGPT_RESPONSES_SUCCESS_BODY_MAX_BYTES,
|
|
100
|
-
onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`OpenAI ChatGPT Responses success body exceeded ${maxBytes} bytes (received ${size})`)
|
|
101
|
-
});
|
|
102
97
|
const decoder = new TextDecoder();
|
|
103
|
-
let buffer =
|
|
98
|
+
let buffer = /* @__PURE__ */ new Uint8Array(1024);
|
|
99
|
+
let size = 0;
|
|
100
|
+
let lineEmpty = true;
|
|
101
|
+
let skipLf = false;
|
|
102
|
+
let cancelReason;
|
|
104
103
|
try {
|
|
105
104
|
while (true) {
|
|
106
|
-
const { done, value } = await
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
event = JSON.parse(data);
|
|
122
|
-
} catch (cause) {
|
|
123
|
-
if (!(cause instanceof SyntaxError)) throw cause;
|
|
124
|
-
throw new CodexProtocolError(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause });
|
|
125
|
-
}
|
|
126
|
-
yield event;
|
|
105
|
+
const { done, value } = await reader.read();
|
|
106
|
+
for (let index = 0; index < (value?.length ?? 0) + (done ? 1 : 0); index++) {
|
|
107
|
+
const byte = value?.[index];
|
|
108
|
+
if (byte !== void 0) {
|
|
109
|
+
const crlf = skipLf && byte === 10;
|
|
110
|
+
skipLf = byte === 13;
|
|
111
|
+
const lineEnding = byte === 10 || byte === 13;
|
|
112
|
+
const boundary = !crlf && lineEnding && lineEmpty;
|
|
113
|
+
lineEmpty = lineEnding;
|
|
114
|
+
if (crlf && size === 0) continue;
|
|
115
|
+
if (size >= OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES) throw new Error(`OpenAI ChatGPT Responses SSE frame exceeded ${OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES} bytes`);
|
|
116
|
+
if (size === buffer.length) {
|
|
117
|
+
const grown = new Uint8Array(Math.min(buffer.length * 2, OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES));
|
|
118
|
+
grown.set(buffer);
|
|
119
|
+
buffer = grown;
|
|
127
120
|
}
|
|
121
|
+
buffer[size++] = byte;
|
|
122
|
+
if (!boundary) continue;
|
|
123
|
+
}
|
|
124
|
+
const chunk = decoder.decode(buffer.subarray(0, size), { stream: !done });
|
|
125
|
+
size = 0;
|
|
126
|
+
const data = chunk.split(/\r\n|\r|\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).join("\n").trim();
|
|
127
|
+
if (!data || data === "[DONE]") continue;
|
|
128
|
+
let event;
|
|
129
|
+
try {
|
|
130
|
+
event = JSON.parse(data);
|
|
131
|
+
} catch (cause) {
|
|
132
|
+
if (!(cause instanceof SyntaxError)) throw cause;
|
|
133
|
+
throw new CodexProtocolError(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause });
|
|
128
134
|
}
|
|
135
|
+
yield event;
|
|
129
136
|
}
|
|
130
137
|
if (done) break;
|
|
131
138
|
}
|
|
139
|
+
} catch (error) {
|
|
140
|
+
cancelReason = error;
|
|
141
|
+
throw error;
|
|
132
142
|
} finally {
|
|
133
|
-
|
|
134
|
-
await guard.cancel();
|
|
135
|
-
} catch {}
|
|
143
|
+
reader.cancel(cancelReason).catch(() => void 0);
|
|
136
144
|
try {
|
|
137
145
|
reader.releaseLock();
|
|
138
146
|
} catch {}
|
|
@@ -163,6 +171,7 @@ const RETRYABLE_CLOSE_CODES = /* @__PURE__ */ new Set([
|
|
|
163
171
|
]);
|
|
164
172
|
const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
|
|
165
173
|
const WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE = "websocket_connection_limit_reached";
|
|
174
|
+
const WEBSOCKET_REPLAY_REJECTION = "Codex error: Persisted response contains hosted-tool, compaction, or unverifiable hidden reasoning state that Rustponses cannot replay. Start a new response or use the Python Responses service for this continuation.";
|
|
166
175
|
const OPENAI_CHATGPT_RESPONSES_ERROR_BODY_MAX_BYTES = 16384;
|
|
167
176
|
function resolveRequestTimeoutMs(options) {
|
|
168
177
|
const timeoutMs = options?.timeoutMs;
|
|
@@ -241,19 +250,18 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
241
250
|
if (transport !== "sse" && !websocketDisabledForSession) {
|
|
242
251
|
const websocketHeaders = buildWebSocketHeaders(modelHeaders, optionHeaders, accountId, apiKey, sessionId || createCodexRequestId());
|
|
243
252
|
let websocketStarted = false;
|
|
244
|
-
let
|
|
245
|
-
let retriedWebSocketConnectionLimit = false;
|
|
253
|
+
let retriedWebSocketRejection = false;
|
|
246
254
|
while (true) {
|
|
247
255
|
const activeAttempt = semanticAttempt;
|
|
256
|
+
const dispatch = {};
|
|
248
257
|
websocketStarted = false;
|
|
249
|
-
websocketRequestSent = false;
|
|
250
258
|
try {
|
|
251
259
|
const terminal = await processWebSocketStream(resolveCodexWebSocketUrl(model.baseUrl), activeAttempt.request, websocketHeaders, output, stream, model, () => {
|
|
252
260
|
websocketStarted = true;
|
|
253
261
|
}, () => {
|
|
254
262
|
commitSemanticAttempt(activeAttempt);
|
|
255
|
-
}, requestOptions, firstEventAbort.abort, observePromptEgress, activeAttempt.kind, () => {
|
|
256
|
-
|
|
263
|
+
}, requestOptions, firstEventAbort.abort, observePromptEgress, activeAttempt.kind, (request) => {
|
|
264
|
+
dispatch.request = request;
|
|
257
265
|
}, options?.signal);
|
|
258
266
|
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
259
267
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new CodexApiError(output.errorMessage ?? "An unknown error occurred");
|
|
@@ -267,19 +275,20 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
267
275
|
return;
|
|
268
276
|
} catch (error) {
|
|
269
277
|
const aborted = activeSignal?.aborted;
|
|
270
|
-
const nextSemanticAttempt = !aborted &&
|
|
278
|
+
const nextSemanticAttempt = !aborted && dispatch.request && !websocketStarted && error instanceof CodexApiError && isInvalidEncryptedContentError(error) ? await resolveNextResponsesEncryptedContentAttempt(activeAttempt, error, { buildFullHistoryRequest: () => buildBody("full-history") }) : void 0;
|
|
271
279
|
if (nextSemanticAttempt) {
|
|
272
280
|
semanticAttempt = nextSemanticAttempt;
|
|
273
|
-
|
|
281
|
+
retriedWebSocketRejection = false;
|
|
274
282
|
continue;
|
|
275
283
|
}
|
|
276
|
-
const
|
|
277
|
-
if (!aborted &&
|
|
278
|
-
|
|
284
|
+
const reconnectBeforeStart = !websocketStarted && isWebSocketConnectionLimitReachedError(error) || !websocketStarted && dispatch.request?.previous_response_id && error instanceof CodexApiError && error.message === WEBSOCKET_REPLAY_REJECTION;
|
|
285
|
+
if (!aborted && reconnectBeforeStart && !retriedWebSocketRejection) {
|
|
286
|
+
retriedWebSocketRejection = true;
|
|
279
287
|
continue;
|
|
280
288
|
}
|
|
281
|
-
|
|
282
|
-
|
|
289
|
+
const transportError = isWebSocketConnectionLimitReachedError(error) ? Object.assign(new Error(error.message, { cause: error }), { code: WEBSOCKET_TRANSPORT_ERROR_CODE }) : error;
|
|
290
|
+
if (aborted || isCodexNonTransportError(transportError)) throw transportError;
|
|
291
|
+
appendAssistantMessageDiagnostic(output, createAssistantMessageDiagnostic("provider_transport_failure", transportError, {
|
|
283
292
|
configuredTransport: transport,
|
|
284
293
|
fallbackTransport: transport === "auto" && !websocketStarted ? "sse" : void 0,
|
|
285
294
|
eventsEmitted: websocketStarted,
|
|
@@ -287,7 +296,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
287
296
|
requestBytes: new TextEncoder().encode(JSON.stringify(activeAttempt.request)).byteLength
|
|
288
297
|
}));
|
|
289
298
|
if (transport === "auto" && options?.sessionId) websocketSseFallbackSessions.add(options.sessionId);
|
|
290
|
-
if (websocketStarted || transport !== "auto") throw
|
|
299
|
+
if (websocketStarted || transport !== "auto") throw transportError;
|
|
291
300
|
break;
|
|
292
301
|
}
|
|
293
302
|
}
|
|
@@ -926,7 +935,7 @@ async function processWebSocketStream(url, body, headers, output, stream, model,
|
|
|
926
935
|
type: "response.create",
|
|
927
936
|
...requestBody
|
|
928
937
|
}));
|
|
929
|
-
onRequestSent?.();
|
|
938
|
+
onRequestSent?.(requestBody);
|
|
930
939
|
const terminal = await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal), void 0, options), output, stream, onFirstProviderEvent, () => notifyProviderStreamOpened({
|
|
931
940
|
options,
|
|
932
941
|
cancelStream: () => {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
3
3
|
import { T as clampThinkingLevel } from "./host-DqhMLv8J.mjs";
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-BuszNIRF.mjs";
|
|
5
5
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
6
6
|
import { S as withProviderResponseHook, b as transportAbortError, n as assignTransportErrorDetails } from "./transport-stream-shared-Dt7VrJFd.mjs";
|
|
7
7
|
import { n as buildBaseOptions, s as prepareModelRequestBody, u as reasoningTagTextPolicy } from "./simple-options-B9u6-CF3.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { C as isOpenAICompletionsThinkingEnabled, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
9
9
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
10
10
|
import { a as tagUnresolvedTextAsCommentary, t as clearPendingCommentaryText } from "./assistant-text-phase-C20rxWwP.mjs";
|
|
11
11
|
import { n as createAssistantOutput } from "./provider-transcript-transform-Cg-36VSt.mjs";
|
|
12
|
-
import { a as convertMessages, i as buildOpenAICompletionsRequest, s as finalizeOpenAICompletionsToolCalls, t as processCompletionsStream } from "./openai-completions-stream-
|
|
12
|
+
import { a as convertMessages, i as buildOpenAICompletionsRequest, s as finalizeOpenAICompletionsToolCalls, t as processCompletionsStream } from "./openai-completions-stream-D--YONza.mjs";
|
|
13
13
|
import { i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-B9o0S4SZ.mjs";
|
|
14
14
|
import { n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-CUUfdJPN.mjs";
|
|
15
15
|
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-B37TB3rB.mjs";
|
|
16
|
-
import { t as createOpenAIProviderClient } from "./openai-provider-client-
|
|
16
|
+
import { t as createOpenAIProviderClient } from "./openai-provider-client-Co1u7I3J.mjs";
|
|
17
17
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
18
18
|
var openai_completions_exports = /* @__PURE__ */ __exportAll({
|
|
19
19
|
convertMessages: () => convertMessages,
|
package/dist/{openai-completions-compat-D1q02qdx.mjs → openai-completions-compat-BuszNIRF.mjs}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
+
import { c as resolveOpenAIReasoningEffortMapping, u as supportsOpenAIReasoningEffort } from "./openai-reasoning-effort-C_0p3psG.mjs";
|
|
2
3
|
import { i as resolveProviderRequestCapabilities } from "./host-policy-B3DuH3Le.mjs";
|
|
3
4
|
//#region packages/ai/src/providers/openai-response-format.ts
|
|
4
5
|
const JSON_SCHEMA_RESPONSE_FORMAT_NAME = "openclaw_response";
|
|
@@ -140,14 +141,17 @@ function resolveSessionAffinity(model, detectedFormat) {
|
|
|
140
141
|
}
|
|
141
142
|
/** Applies explicit model overrides once on top of the canonical transport defaults. */
|
|
142
143
|
function resolveOpenAICompletionsCompat(model, resolveCapabilities) {
|
|
143
|
-
const { defaults } = detectOpenAICompletionsCompat(model, resolveCapabilities);
|
|
144
|
+
const { defaults, capabilities } = detectOpenAICompletionsCompat(model, resolveCapabilities);
|
|
144
145
|
const configured = model.compat;
|
|
146
|
+
const thinkingFormat = configured?.thinkingFormat ?? defaults.thinkingFormat;
|
|
147
|
+
const thinkingOffControlUndeclared = capabilities.usesExplicitProxyLikeEndpoint && thinkingFormat === "zai" && configured?.thinkingFormat === void 0 && !supportsOpenAIReasoningEffort({ compat: configured }, "none") && !supportsOpenAIReasoningEffort({ compat: configured }, "off") && resolveOpenAIReasoningEffortMapping("off", configured?.reasoningEffortMap) === void 0;
|
|
145
148
|
return {
|
|
146
149
|
supportsStore: configured?.supportsStore ?? defaults.supportsStore,
|
|
147
150
|
supportsDeveloperRole: configured?.supportsDeveloperRole ?? defaults.supportsDeveloperRole,
|
|
148
151
|
supportsReasoningEffort: configured?.supportsReasoningEffort ?? defaults.supportsReasoningEffort,
|
|
149
152
|
supportedReasoningEfforts: configured?.supportedReasoningEfforts,
|
|
150
153
|
reasoningEffortMap: configured?.reasoningEffortMap,
|
|
154
|
+
thinkingOffControlUndeclared,
|
|
151
155
|
supportsUsageInStreaming: configured?.supportsUsageInStreaming ?? defaults.supportsUsageInStreaming,
|
|
152
156
|
maxTokensField: configured?.maxTokensField ?? defaults.maxTokensField,
|
|
153
157
|
requiresToolResultName: configured?.requiresToolResultName ?? false,
|
package/dist/{openai-completions-compat-CqWP1fn5.d.mts → openai-completions-compat-WTcM-PUc.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { M as OpenAICompletionsCompat, O as Model } from "./types-
|
|
3
|
-
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-
|
|
1
|
+
import "./index-Iw8l620S.mjs";
|
|
2
|
+
import { M as OpenAICompletionsCompat, O as Model } from "./types-B89w6ly2.mjs";
|
|
3
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-BhpDO5Sy.mjs";
|
|
4
4
|
//#region packages/ai/src/transports/openai-completions-compat.d.ts
|
|
5
5
|
type ProviderRequestCapabilities = AiProviderRequestCapabilities;
|
|
6
6
|
type OpenAICompletionsSessionAffinity = "none" | "openai" | "openrouter";
|
|
@@ -31,6 +31,7 @@ type ResolvedOpenAICompletionsCompat = Omit<Required<OpenAICompletionsCompat>, "
|
|
|
31
31
|
visibleReasoningDetailTypes: string[];
|
|
32
32
|
requiresNonEmptyUserOrAssistantMessage: boolean;
|
|
33
33
|
configuredSupportsLongCacheRetention?: boolean;
|
|
34
|
+
thinkingOffControlUndeclared?: boolean;
|
|
34
35
|
};
|
|
35
36
|
/** Native OpenAI defaults never apply to a configured proxy endpoint. */
|
|
36
37
|
declare function isNativeOpenAIEndpoint(model: {
|
package/dist/{openai-completions-stream-BrsoGafc.mjs → openai-completions-stream-D--YONza.mjs}
RENAMED
|
@@ -4,22 +4,22 @@ import { k as isImageWithMediaPayload, n as getAiTransportHost } from "./host-Dq
|
|
|
4
4
|
import { n as isOpenAIGpt55Model, r as isOpenAIGpt56Model, t as isOpenAIGpt54MiniModel } from "./openai-reasoning-effort-C_0p3psG.mjs";
|
|
5
5
|
import { r as uniqueStrings } from "./string-normalization-J9ZiLfGO.mjs";
|
|
6
6
|
import { o as truncateUtf16Safe } from "./provider-error-CwT_j2v0.mjs";
|
|
7
|
-
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
7
|
+
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BcwCks0h.mjs";
|
|
8
8
|
import { r as emitModelTransportDebug } from "./diagnostics-CJaB6g8J.mjs";
|
|
9
9
|
import { i as asNonNegativeFiniteNumber } from "./base64-C1PsYcRQ.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { c as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
10
|
+
import { l as supportsModelTools, r as estimateStringChars } from "./transport-utils-B11GlmDO.mjs";
|
|
11
|
+
import { c as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-BuszNIRF.mjs";
|
|
12
12
|
import { r as resolveProviderEndpoint } from "./host-policy-B3DuH3Le.mjs";
|
|
13
13
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
14
14
|
import { E as createToolArgumentPreviewSchedule, O as parseStreamingJson, d as iterateModelStream, j as sanitizeSurrogates, l as finalizeTerminalToolCallArguments, y as throwIfModelStreamAborted } from "./transport-stream-shared-Dt7VrJFd.mjs";
|
|
15
15
|
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, S as splitSystemPromptRelocatableBoundary, d as describeToolResultMediaPlaceholder, m as extractToolResultText, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-B9u6-CF3.mjs";
|
|
16
|
-
import { C as
|
|
16
|
+
import { A as resolvePromptCacheKey, C as isOpenAICompletionsThinkingEnabled, D as readOpenAICompletionsContentDeltas, E as parseOpenAICompletionsUsage, O as readOpenAICompletionsReasoningBatch, S as detachPartialSnapshot, T as measureUtf8AppendBytes, d as prepareOpenAITools, f as projectOpenAITools, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, p as reconcileOpenAICompletionsToolChoice, s as getCompat, u as resolveOpenAIStrictToolFlagWithDiagnostics, v as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, w as log } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
17
17
|
import { a as tagUnresolvedTextAsCommentary, i as tagPendingCommentaryText, n as rememberPendingCommentaryTags, r as tagInterruptedTextPhases, t as clearPendingCommentaryText } from "./assistant-text-phase-C20rxWwP.mjs";
|
|
18
18
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
19
19
|
import { t as transformProviderMessages } from "./provider-transcript-transform-Cg-36VSt.mjs";
|
|
20
|
+
import { isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
20
21
|
import { a as withFirstStreamEventTimeout } from "./stream-first-event-timeout-B9o0S4SZ.mjs";
|
|
21
|
-
import { f as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-
|
|
22
|
-
import { isGoogleGemini3FlashModel, isGoogleGemini3ProModel } from "./internal/google-model-family.mjs";
|
|
22
|
+
import { f as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-DSAxYnHW.mjs";
|
|
23
23
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
|
24
24
|
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-B6FIIBt6.mjs";
|
|
25
25
|
import { randomUUID } from "node:crypto";
|
|
@@ -651,7 +651,7 @@ function relocateNonBehavioralRegion(args) {
|
|
|
651
651
|
function applyDirectCompletionsReasoningAndRouting(params, model, reasoning, compat) {
|
|
652
652
|
const nativeEffort = compat.thinkingFormat === "openrouter" ? void 0 : reasoning.effort;
|
|
653
653
|
const reasoningEnabled = reasoning.thinkingEnabled ?? false;
|
|
654
|
-
if (compat.thinkingFormat === "zai" && model.reasoning) params.thinking = reasoningEnabled ? {
|
|
654
|
+
if (compat.thinkingFormat === "zai" && model.reasoning && compat.thinkingOffControlUndeclared && reasoning.thinkingEnabled === false) {} else if (compat.thinkingFormat === "zai" && model.reasoning) params.thinking = reasoningEnabled ? {
|
|
655
655
|
type: "enabled",
|
|
656
656
|
clear_thinking: false
|
|
657
657
|
} : { type: "disabled" };
|
|
@@ -685,7 +685,7 @@ function isGoogleOpenAICompatModel(model) {
|
|
|
685
685
|
return model.provider === "google" || endpointClass === "google-generative-ai" || endpointClass === "google-vertex";
|
|
686
686
|
}
|
|
687
687
|
function requiresGoogleCompatToolCallThoughtSignature(model) {
|
|
688
|
-
return
|
|
688
|
+
return isGoogleGemini3ThinkingLevelModel(model.id);
|
|
689
689
|
}
|
|
690
690
|
const GOOGLE_COMPAT_THOUGHT_SIGNATURE_ELLIPSIS_RE = /[\u2026]|\.\.\./;
|
|
691
691
|
const GOOGLE_COMPAT_THOUGHT_SIGNATURE_BASE64_RE = /^[A-Za-z0-9+/=]+$/;
|
|
@@ -767,6 +767,8 @@ const REASONING_CONTENT_REPLAY_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
|
767
767
|
"kimi-k2.7-code",
|
|
768
768
|
"kimi-k2.7-code-highspeed",
|
|
769
769
|
"kimi-k3",
|
|
770
|
+
"kimi-k3.1-pro",
|
|
771
|
+
"kimi-k3.1-pro-highspeed",
|
|
770
772
|
"kimi-k2-thinking",
|
|
771
773
|
"kimi-k2-thinking-turbo",
|
|
772
774
|
"mimo-v2-pro",
|
|
@@ -1397,7 +1399,7 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1397
1399
|
let chunkPushedEvent = false;
|
|
1398
1400
|
const pushStreamEvent = (event) => {
|
|
1399
1401
|
chunkPushedEvent = true;
|
|
1400
|
-
stream.push(event);
|
|
1402
|
+
stream.push(detachPartialSnapshot(event));
|
|
1401
1403
|
};
|
|
1402
1404
|
const queuePostToolCallDelta = (next) => {
|
|
1403
1405
|
const nextBytes = Buffer.byteLength(next.text, "utf8");
|
|
@@ -1570,7 +1572,8 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1570
1572
|
if (latestBlock?.type === "text" || latestBlock?.type === "toolCall") return;
|
|
1571
1573
|
appendThinkingDelta({ text: "" });
|
|
1572
1574
|
};
|
|
1573
|
-
const flushReasoningTagTextPartitioner = () => {
|
|
1575
|
+
const flushReasoningTagTextPartitioner = (allowRecovery = true) => {
|
|
1576
|
+
if (!(allowRecovery && output.stopReason !== "length" && output.stopReason !== "error" && output.stopReason !== "aborted")) reasoningTagTextPartitioner.markStrict();
|
|
1574
1577
|
for (const delta of reasoningTagTextPartitioner.flush()) appendPartitionedVisibleDelta(delta);
|
|
1575
1578
|
};
|
|
1576
1579
|
const sealTextBeforeReasoning = () => {
|
|
@@ -1662,7 +1665,7 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1662
1665
|
const toolCallDeltas = normalizedDelta.toolCalls;
|
|
1663
1666
|
if (toolCallDeltas.length > 0) {
|
|
1664
1667
|
sawNativeToolCallDelta = true;
|
|
1665
|
-
flushReasoningTagTextPartitioner();
|
|
1668
|
+
flushReasoningTagTextPartitioner(false);
|
|
1666
1669
|
rememberPendingCommentaryTags(provisionalCommentaryTags, tagPendingCommentaryText(output.content));
|
|
1667
1670
|
for (const toolCall of toolCallDeltas) {
|
|
1668
1671
|
const streamIndex = typeof toolCall.index === "number" ? toolCall.index : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-
|
|
1
|
+
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-BuszNIRF.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 { M as OpenAICompletionsCompat, O as Model, l as CacheRetention } from "./types-
|
|
2
|
-
import "./types-
|
|
1
|
+
import { M as OpenAICompletionsCompat, O as Model, l as CacheRetention } from "./types-B89w6ly2.mjs";
|
|
2
|
+
import "./types-DbmNRKvK.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,5 +1,5 @@
|
|
|
1
1
|
import { n as getAiTransportHost } from "./host-DqhMLv8J.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { k as resolveOpenAIClientBaseUrl } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
3
3
|
import { i as resolveCloudflareBaseUrl, r as isCloudflareProvider } from "./github-copilot-headers-B37TB3rB.mjs";
|
|
4
4
|
import OpenAI from "openai";
|
|
5
5
|
//#region packages/ai/src/providers/openai-provider-client.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BcwCks0h.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-BuszNIRF.mjs";
|
|
5
5
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
6
6
|
import { n as buildBaseOptions } from "./simple-options-B9u6-CF3.mjs";
|
|
7
|
-
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-
|
|
7
|
+
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
8
8
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
9
9
|
import { n as createAssistantOutput } from "./provider-transcript-transform-Cg-36VSt.mjs";
|
|
10
10
|
import { n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-CUUfdJPN.mjs";
|
|
11
|
-
import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
11
|
+
import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-DLz_xgps.mjs";
|
|
12
12
|
import { n as hasCopilotVisionInput, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-B37TB3rB.mjs";
|
|
13
|
-
import { t as createOpenAIProviderClient } from "./openai-provider-client-
|
|
13
|
+
import { t as createOpenAIProviderClient } from "./openai-provider-client-Co1u7I3J.mjs";
|
|
14
14
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
15
15
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
16
16
|
streamOpenAIResponses: () => streamOpenAIResponses,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { O as Model, a as AssistantMessage } from "./types-
|
|
3
|
-
import "./provider-options-
|
|
4
|
-
import { i as ReplayableResponseCompactionItem, r as OpenAIResponsesReasoningReplayMetadata, s as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-
|
|
1
|
+
import "./index-Iw8l620S.mjs";
|
|
2
|
+
import { O as Model, a as AssistantMessage } from "./types-B89w6ly2.mjs";
|
|
3
|
+
import "./provider-options-CFiaIG4K.mjs";
|
|
4
|
+
import { i as ReplayableResponseCompactionItem, r as OpenAIResponsesReasoningReplayMetadata, s as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-CYScOS7J.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-C2H8pffb.d.mts → openai-responses-contracts-CYScOS7J.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { O as Model, j as ModelThinkingLevel, n as Api } from "./types-
|
|
3
|
-
import { a as BaseOpenAIStreamOptions, f as OpenAIReasoningEffort } from "./provider-options-
|
|
4
|
-
import "./types-
|
|
1
|
+
import "./index-Iw8l620S.mjs";
|
|
2
|
+
import { O as Model, j as ModelThinkingLevel, n as Api } from "./types-B89w6ly2.mjs";
|
|
3
|
+
import { a as BaseOpenAIStreamOptions, f as OpenAIReasoningEffort } from "./provider-options-CFiaIG4K.mjs";
|
|
4
|
+
import "./types-DbmNRKvK.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";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
2
|
import { n as getAiTransportHost } from "./host-DqhMLv8J.mjs";
|
|
3
3
|
import { d as supportsOpenAITemperature, i as isOpenAIGpt6Model, m as resolveOpenAIThinkingApi } from "./openai-reasoning-effort-C_0p3psG.mjs";
|
|
4
|
-
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
5
|
-
import { o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-
|
|
4
|
+
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BcwCks0h.mjs";
|
|
5
|
+
import { o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-BuszNIRF.mjs";
|
|
6
6
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
7
7
|
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-Dt7VrJFd.mjs";
|
|
8
|
-
import { C as stripSystemPromptCacheBoundary } from "./simple-options-B9u6-CF3.mjs";
|
|
9
|
-
import {
|
|
8
|
+
import { C as stripSystemPromptCacheBoundary, r as clampMaxTokensToModel } from "./simple-options-B9u6-CF3.mjs";
|
|
9
|
+
import { A as resolvePromptCacheKey, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, m as reconcileOpenAIResponsesToolChoice, s as getCompat } from "./openai-transport-params-DzSQTRdN.mjs";
|
|
10
10
|
import { h as responsesPromptObserver, r as OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS } from "./openai-responses-contracts-CLxnqS9p.mjs";
|
|
11
11
|
import { a as applyOpenAIResponsesPayloadPolicy, s as resolveOpenAIResponsesPayloadPolicy } from "./openai-responses-compaction-window-CYGCjAQz.mjs";
|
|
12
|
-
import { F as convertResponsesMessages, N as buildResponsesInputMessage, a as prepareResponsesTools } from "./openai-responses-shared-
|
|
12
|
+
import { F as convertResponsesMessages, N as buildResponsesInputMessage, a as prepareResponsesTools } from "./openai-responses-shared-DLz_xgps.mjs";
|
|
13
13
|
//#region packages/ai/src/transports/openai-responses-params-internal.ts
|
|
14
14
|
const OPENAI_RESPONSES_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
15
15
|
"openai",
|
|
@@ -124,7 +124,7 @@ function buildOpenAIResponsesParams(model, context, options, metadata, replayMod
|
|
|
124
124
|
...metadata ? { metadata } : {}
|
|
125
125
|
};
|
|
126
126
|
const effectiveMaxTokens = options?.maxTokens || model.maxTokens;
|
|
127
|
-
if (effectiveMaxTokens) params.max_output_tokens = Math.max(effectiveMaxTokens, 16);
|
|
127
|
+
if (effectiveMaxTokens) params.max_output_tokens = clampMaxTokensToModel(model, Math.max(effectiveMaxTokens, 16));
|
|
128
128
|
if (options?.temperature !== void 0 && supportsOpenAITemperature(model)) params.temperature = options.temperature;
|
|
129
129
|
if (options?.topP !== void 0 && (!isOpenAIGpt6Model(model) || resolveOpenAIThinkingApi(model.api) === "azure-openai-responses")) params.top_p = options.topP;
|
|
130
130
|
if (options?.responseFormat !== void 0) params.text = {
|