@openclaw/ai 2026.9.4 → 2026.9.6
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 +1 -1
- package/dist/{anthropic-C4Qu4H0Z.mjs → anthropic-DZQ_7gD1.mjs} +37 -38
- package/dist/{anthropic-payload-policy-BZ8umAbk.d.mts → anthropic-payload-policy-DyfwikYJ.d.mts} +4 -4
- package/dist/{anthropic-stream-reducer-CILWF7JD.mjs → anthropic-stream-reducer-D6ZI1wwj.mjs} +70 -50
- package/dist/{api-registry-ByUwIR0e.d.mts → api-registry-C2T3lTV7.d.mts} +2 -2
- package/dist/{assistant-output-tLt4H-iQ.mjs → assistant-output-DM1JBNs1.mjs} +1 -1
- package/dist/{azure-openai-responses-BAlqlKKc.mjs → azure-openai-responses-DS86GYzq.mjs} +6 -9
- package/dist/{base64-D-su8YVo.mjs → base64-CPmadnUf.mjs} +12 -12
- package/dist/credential-redaction-BKv49aiv.d.mts +24 -0
- package/dist/{diagnostics-QuErwCIl.mjs → diagnostics-CH8j2wIG.mjs} +139 -7
- package/dist/{diagnostics-CPeq9F7y.mjs → diagnostics-DzrF1h4J.mjs} +18 -1
- package/dist/diagnostics.d.mts +11 -24
- package/dist/diagnostics.mjs +4 -4
- package/dist/event-stream-C0nsgbj2.d.mts +1 -0
- package/dist/{event-stream-Bt5Y4Pav.d.mts → event-stream-CjnIZZst.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{google-DPBAOaOW.mjs → google-BZJFjhuC.mjs} +6 -9
- package/dist/{google-messages-6JkpHrhJ.mjs → google-messages-DB7GKkDk.mjs} +3 -3
- package/dist/{google-shared-BvBeW9aq.mjs → google-shared-Bok4I6zB.mjs} +13 -13
- package/dist/{google-vertex-k-TMCAYD.mjs → google-vertex-3eVNR2qW.mjs} +5 -8
- package/dist/{host-4atIX-2V.d.mts → host-DH-Z-LDb.d.mts} +5 -3
- package/dist/{host-policy-Zcg_cNz8.mjs → host-policy-DZO3oPPk.mjs} +1 -1
- package/dist/{host-B8YfDGd4.mjs → host-yTvBrYM2.mjs} +63 -31
- package/dist/{index-DdD3qerf.d.mts → index-C25RT6bP.d.mts} +37 -14
- package/dist/index.d.mts +7 -8
- package/dist/index.mjs +5 -6
- package/dist/internal/anthropic.d.mts +13 -10
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-completions-compat.d.mts +2 -0
- package/dist/internal/openai-completions-compat.mjs +2 -0
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +24 -53
- package/dist/internal/openai.mjs +12 -9
- package/dist/internal/runtime.d.mts +6 -8
- package/dist/internal/runtime.mjs +6 -10
- package/dist/internal/shared.d.mts +7 -5
- package/dist/internal/shared.mjs +4 -3
- package/dist/internal/tool-schema.d.mts +4 -4
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-CxUZ1jUb.mjs → mistral-C_13dVBn.mjs} +9 -13
- package/dist/{model-transport-url-DKocrEsb.d.mts → model-transport-url-C5f59L3Y.d.mts} +1 -1
- package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-sTxPl4zM.mjs} +150 -83
- package/dist/{openai-completions-yJuk7eis.mjs → openai-completions-BO6D_hrB.mjs} +11 -12
- package/dist/{openai-prompt-cache-Bds-n_9Q.mjs → openai-completions-compat-CUollwl6.mjs} +5 -50
- package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-DfJG1wSO.d.mts} +4 -4
- package/dist/{openai-completions-stream-Da2vvl-S.mjs → openai-completions-stream-BpuJ0ZOA.mjs} +117 -106
- package/dist/{openai-prompt-cache-B4eYo2-I.d.mts → openai-prompt-cache-C4RHdN4n.d.mts} +2 -2
- package/dist/openai-prompt-cache-CjV_2IRI.mjs +46 -0
- package/dist/{openai-provider-client-S2gCrM2Z.mjs → openai-provider-client-BP8J1aeg.mjs} +2 -2
- package/dist/openai-reasoning-effort-ash8dPrd.mjs +243 -0
- package/dist/{openai-responses-DaYwH05E.mjs → openai-responses-BJ_IEoMU.mjs} +8 -12
- package/dist/{openai-responses-compaction-window-CIhBAkkq.mjs → openai-responses-compaction-window-BiNCT0bS.mjs} +20 -62
- package/dist/{openai-responses-contracts-BjBAqAg_.d.mts → openai-responses-contracts-B1ENJFpI.d.mts} +9 -5
- package/dist/openai-responses-contracts-DWrfMODE.mjs +81 -0
- package/dist/{openai-responses-payload-policy-rLRPsSmB.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +5 -3
- package/dist/openai-responses-prompt-observer-internal-DPHWgbBH.mjs +198 -0
- package/dist/openai-responses-request-lifecycle-DFuyO1pQ.mjs +36 -0
- package/dist/{openai-responses-shared-B8RdBPCv.mjs → openai-responses-shared-DvSqtJ6_.mjs} +859 -581
- package/dist/openai-responses-terminal-usage-BNFbvY9f.d.mts +47 -0
- package/dist/{openai-tool-schema-CzjyYXun.mjs → openai-tool-schema-D4BMcj2D.mjs} +262 -162
- package/dist/{openai-transport-params-9aPuV5YY.mjs → openai-transport-params-DZKOTSfH.mjs} +157 -47
- package/dist/{positive-integer-41zhOdcV.mjs → positive-integer-BiUxrd71.mjs} +1 -1
- package/dist/{provider-error-BA-v_tKd.mjs → provider-error-CRhW7lkJ.mjs} +139 -44
- package/dist/{provider-error-CzNw4BWX.d.mts → provider-error-xumb1V3F.d.mts} +3 -1
- package/dist/{provider-options-Ceqv1OKk.d.mts → provider-options-DZYq53lj.d.mts} +12 -7
- package/dist/{provider-replay-context-CJ_YvcEW.mjs → provider-replay-context-DPr3w20a.mjs} +1 -1
- package/dist/{provider-transcript-transform-V5YzU9zh.mjs → provider-transcript-transform-BTocjCRs.mjs} +1 -1
- package/dist/{provider-transport-turn-state-D5EXOFL2.mjs → provider-transport-turn-state-lrXEFkYr.mjs} +1 -1
- package/dist/{provider-types-CVjKjsuq.d.mts → provider-types-w1rEqrGP.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -7
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-BcR5pztD.mjs → reasoning-tag-text-partitioner-Di38crhI.mjs} +167 -40
- package/dist/{simple-options-BQbb4yQL.mjs → simple-options-np1XPuhm.mjs} +5 -3
- package/dist/{usage-cost-BNWbbXav.mjs → src-DwGYYyZp.mjs} +18 -11
- package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-BeptfRL6.mjs} +1 -1
- package/dist/{string-normalization-CmLIasuf.mjs → string-normalization-J9ZiLfGO.mjs} +13 -1
- package/dist/tool-schema-json-projection-CD9c_fK8.mjs +134 -0
- package/dist/{transport-stream-shared-zHll9BxO.mjs → transport-stream-shared-B5RioB_Q.mjs} +16 -24
- package/dist/{transport-stream-shared-DNvmoWnv.d.mts → transport-stream-shared-B7Z9oCYg.d.mts} +5 -5
- package/dist/{transport-utils-zrYjICLZ.mjs → transport-utils-03Qi0CN2.mjs} +3 -3
- package/dist/transports.d.mts +27 -13
- package/dist/transports.mjs +168 -462
- package/dist/types-DTvddOfm.d.mts +1 -0
- package/dist/{types-Ntv5z2g2.d.mts → types-qZFbaDbK.d.mts} +49 -3
- package/dist/types.d.mts +6 -7
- package/dist/types.mjs +4 -5
- package/dist/{validation-B0t_G2H6.d.mts → validation-DhQhmt6t.d.mts} +1 -1
- package/dist/{validation-BDzVDnTs.mjs → validation-Dw7cb6BV.mjs} +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +11 -6
- package/dist/diagnostics-DnPnOui6.d.mts +0 -29
- package/dist/event-stream-C3WGFsum.d.mts +0 -1
- package/dist/openai-responses-contracts-DDOHA62Y.mjs +0 -245
- package/dist/openai-responses-prompt-observer-internal-f8J7wpsk.mjs +0 -32
- package/dist/src-DDmEryvj.mjs +0 -2
- package/dist/tool-schema-json-projection-ClptDdAO.mjs +0 -82
- package/dist/types-DlfwzH3T.d.mts +0 -1
package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-sTxPl4zM.mjs}
RENAMED
|
@@ -1,22 +1,86 @@
|
|
|
1
|
-
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
1
|
+
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { o as isRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
4
|
+
import { d as supportsOpenAITemperature } from "./openai-reasoning-effort-ash8dPrd.mjs";
|
|
5
|
+
import { A as headersToRecord, n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-yTvBrYM2.mjs";
|
|
6
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-CjV_2IRI.mjs";
|
|
7
|
+
import { _ as extractErrorCodeOrErrno, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, v as toErrorObject } from "./diagnostics-CH8j2wIG.mjs";
|
|
8
|
+
import { s as resolveTimerTimeoutMs } from "./base64-CPmadnUf.mjs";
|
|
9
|
+
import { t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-03Qi0CN2.mjs";
|
|
8
10
|
import { parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
|
|
9
|
-
import { m as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-
|
|
10
|
-
import {
|
|
11
|
+
import { m as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-np1XPuhm.mjs";
|
|
12
|
+
import { S as createResponseModelTracker, b as createOpenAIProviderAcceptanceHook, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, x as createOpenAIResponseHook } from "./openai-transport-params-DZKOTSfH.mjs";
|
|
11
13
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { b as withProviderResponseHook, m as notifyProviderStreamOpened, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
15
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-BeptfRL6.mjs";
|
|
16
|
+
import { h as responsesPromptObserver } from "./openai-responses-contracts-DWrfMODE.mjs";
|
|
17
|
+
import { D as ResponsesStreamFailure, E as resolveNextResponsesEncryptedContentAttempt, M as recordResponsesContextUsage, S as commitResponsesEncryptedContentAttempt, Z as suppressOpenAIResponsesCompaction, c as readOpenAIMisalignmentReview, i as createResponsesAssistantOutput, l as processResponsesStream, n as applyResponsesServiceTierPricing, o as convertResponsesToolPayload, q as buildOpenAIResponsesReasoningReplayMetadata, r as convertResponsesMessages, w as isInvalidEncryptedContentError } from "./openai-responses-shared-DvSqtJ6_.mjs";
|
|
16
18
|
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
17
19
|
import { n as registerSessionResourceCleanup } from "./session-resources-CkR4WWy1.mjs";
|
|
18
|
-
import { t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-
|
|
20
|
+
import { i as resolveOpenAIResponsesTextFormat, t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-DPHWgbBH.mjs";
|
|
21
|
+
import { n as withResponsesRequestAcceptance, t as responsesRequestLifecycle } from "./openai-responses-request-lifecycle-DFuyO1pQ.mjs";
|
|
19
22
|
import { n as resolveOpenAICodexAccountId } from "./openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
23
|
+
//#region packages/ai/src/providers/openai-chatgpt-responses-events.ts
|
|
24
|
+
var CodexApiError = class extends Error {
|
|
25
|
+
constructor(message, options) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "CodexApiError";
|
|
28
|
+
this.code = options?.code;
|
|
29
|
+
this.status = options?.status;
|
|
30
|
+
this.payload = options?.payload;
|
|
31
|
+
this.cause = options?.cause;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function extractCodexEventError(event) {
|
|
35
|
+
const nested = isRecord(event.error) ? event.error : void 0;
|
|
36
|
+
return {
|
|
37
|
+
code: typeof event.code === "string" ? event.code : typeof nested?.code === "string" ? nested.code : void 0,
|
|
38
|
+
message: typeof event.message === "string" ? event.message : typeof nested?.message === "string" ? nested.message : void 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function* mapCodexEvents(events, initialResponseHeaders, options) {
|
|
42
|
+
const responseModelTracker = createResponseModelTracker();
|
|
43
|
+
responseModelTracker.begin(initialResponseHeaders);
|
|
44
|
+
for await (const event of withResponsesRequestAcceptance(events, responsesRequestLifecycle.get(options), options?.signal)) {
|
|
45
|
+
responseModelTracker.observeEvent(event);
|
|
46
|
+
const type = typeof event.type === "string" ? event.type : void 0;
|
|
47
|
+
if (!type) continue;
|
|
48
|
+
if (type === "error") {
|
|
49
|
+
const { code, message } = extractCodexEventError(event);
|
|
50
|
+
throw new CodexApiError(`Codex error: ${message || code || JSON.stringify(event)}`, {
|
|
51
|
+
code,
|
|
52
|
+
payload: event
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (type === "response.done" || type === "response.completed" || type === "response.incomplete") {
|
|
56
|
+
const response = isRecord(event.response) ? event.response : void 0;
|
|
57
|
+
const normalizedResponse = response ? {
|
|
58
|
+
...response,
|
|
59
|
+
status: normalizeCodexStatus(response.status),
|
|
60
|
+
model: responseModelTracker.resolve()
|
|
61
|
+
} : response;
|
|
62
|
+
yield {
|
|
63
|
+
...event,
|
|
64
|
+
type: type === "response.done" ? "response.completed" : type,
|
|
65
|
+
response: normalizedResponse
|
|
66
|
+
};
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
yield event;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function normalizeCodexStatus(status) {
|
|
73
|
+
switch (status) {
|
|
74
|
+
case "completed":
|
|
75
|
+
case "incomplete":
|
|
76
|
+
case "failed":
|
|
77
|
+
case "cancelled":
|
|
78
|
+
case "queued":
|
|
79
|
+
case "in_progress": return status;
|
|
80
|
+
default: return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
20
84
|
//#region packages/ai/src/providers/openai-chatgpt-responses-protocol.ts
|
|
21
85
|
const OPENAI_CHATGPT_RESPONSES_SUCCESS_BODY_MAX_BYTES = 16777216;
|
|
22
86
|
var CodexProtocolError = class extends Error {
|
|
@@ -98,14 +162,6 @@ const RETRYABLE_WEBSOCKET_CLOSE_CODES = /* @__PURE__ */ new Set([
|
|
|
98
162
|
const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
|
|
99
163
|
const WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE = "websocket_connection_limit_reached";
|
|
100
164
|
const OPENAI_CHATGPT_RESPONSES_ERROR_BODY_MAX_BYTES = 16384;
|
|
101
|
-
const CODEX_RESPONSE_STATUSES = /* @__PURE__ */ new Set([
|
|
102
|
-
"completed",
|
|
103
|
-
"incomplete",
|
|
104
|
-
"failed",
|
|
105
|
-
"cancelled",
|
|
106
|
-
"queued",
|
|
107
|
-
"in_progress"
|
|
108
|
-
]);
|
|
109
165
|
function resolveRequestTimeoutMs(options) {
|
|
110
166
|
const timeoutMs = options?.timeoutMs;
|
|
111
167
|
return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 1) : void 0;
|
|
@@ -190,7 +246,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
190
246
|
websocketStarted = false;
|
|
191
247
|
websocketRequestSent = false;
|
|
192
248
|
try {
|
|
193
|
-
await processWebSocketStream(resolveCodexWebSocketUrl(model.baseUrl), activeAttempt.request, websocketHeaders, output, stream, model, () => {
|
|
249
|
+
const terminal = await processWebSocketStream(resolveCodexWebSocketUrl(model.baseUrl), activeAttempt.request, websocketHeaders, output, stream, model, () => {
|
|
194
250
|
websocketStarted = true;
|
|
195
251
|
}, () => {
|
|
196
252
|
commitSemanticAttempt(activeAttempt);
|
|
@@ -199,6 +255,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
199
255
|
}, options?.signal);
|
|
200
256
|
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
201
257
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new CodexApiError(output.errorMessage ?? "An unknown error occurred");
|
|
258
|
+
if (terminal && activeAttempt.kind === "initial") recordResponsesContextUsage(output, model, options, activeAttempt.request, terminal.output, "provider");
|
|
202
259
|
stream.push({
|
|
203
260
|
type: "done",
|
|
204
261
|
reason: output.stopReason,
|
|
@@ -249,6 +306,12 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
249
306
|
});
|
|
250
307
|
let attemptResponse;
|
|
251
308
|
try {
|
|
309
|
+
const lifecycle = responsesRequestLifecycle.get(options);
|
|
310
|
+
if (lifecycle) {
|
|
311
|
+
await lifecycle.beforeDispatch(activeSignal);
|
|
312
|
+
activeSignal?.throwIfAborted();
|
|
313
|
+
lifecycle.assertCurrent();
|
|
314
|
+
}
|
|
252
315
|
attemptResponse = await fetch(resolveCodexUrl(model.baseUrl), {
|
|
253
316
|
method: "POST",
|
|
254
317
|
headers: sseHeaders,
|
|
@@ -291,7 +354,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
291
354
|
semanticAttempt = nextSemanticAttempt;
|
|
292
355
|
}
|
|
293
356
|
const hookedResponseStream = withProviderResponseHook({
|
|
294
|
-
stream: mapCodexEvents(parseOpenAIChatGptResponsesSse(response)),
|
|
357
|
+
stream: mapCodexEvents(parseOpenAIChatGptResponsesSse(response), response.headers, requestOptions),
|
|
295
358
|
signal: firstEventAbort.signal,
|
|
296
359
|
abort: firstEventAbort.abort,
|
|
297
360
|
hook: createOpenAIProviderAcceptanceHook(options, response, model),
|
|
@@ -300,7 +363,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
300
363
|
partial: output
|
|
301
364
|
})
|
|
302
365
|
});
|
|
303
|
-
await processResponsesStream(hookedResponseStream, output, stream, model, {
|
|
366
|
+
const terminal = await processResponsesStream(hookedResponseStream, output, stream, model, {
|
|
304
367
|
serviceTier: options?.serviceTier,
|
|
305
368
|
firstEventTimeoutMs: getFirstStreamEventTimeoutMs(options),
|
|
306
369
|
abortFirstEventStream: firstEventAbort.abort,
|
|
@@ -315,6 +378,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
315
378
|
});
|
|
316
379
|
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
317
380
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
381
|
+
if (terminal && semanticAttempt.kind === "initial") recordResponsesContextUsage(output, model, options, semanticAttempt.request, terminal.output, "provider");
|
|
318
382
|
stream.push({
|
|
319
383
|
type: "done",
|
|
320
384
|
reason: output.stopReason,
|
|
@@ -322,9 +386,20 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
322
386
|
});
|
|
323
387
|
stream.end();
|
|
324
388
|
} catch (error) {
|
|
389
|
+
await responsesRequestLifecycle.get(options)?.settle().catch(() => void 0);
|
|
325
390
|
const requestTimedOut = isRequestTimeoutError(error, options?.signal, requestTimeoutSignal, requestTimeoutMs) && requestTimeoutMs !== void 0;
|
|
326
391
|
const normalizedError = requestTimedOut && requestTimeoutMs !== void 0 ? formatRequestTimeoutError(requestTimeoutMs, error) : error;
|
|
327
392
|
for (const block of output.content) delete block.partialJson;
|
|
393
|
+
const providerRefusal = readCodexProviderRefusal(normalizedError);
|
|
394
|
+
if (providerRefusal) appendAssistantMessageDiagnostic(output, {
|
|
395
|
+
type: "provider_refusal",
|
|
396
|
+
timestamp: Date.now(),
|
|
397
|
+
details: {
|
|
398
|
+
provider: "openai",
|
|
399
|
+
category: providerRefusal.category,
|
|
400
|
+
...providerRefusal.review ? { review: providerRefusal.review } : {}
|
|
401
|
+
}
|
|
402
|
+
});
|
|
328
403
|
const terminal = assignTransportErrorDetails(output, normalizedError, options?.signal);
|
|
329
404
|
getAiTransportHost().logWarn("openai-transport", "ChatGPT Responses stream terminated", {
|
|
330
405
|
provider: model.provider,
|
|
@@ -353,9 +428,11 @@ const streamSimpleOpenAICodexResponses = (model, context, options) => {
|
|
|
353
428
|
const resolvedOptions = {
|
|
354
429
|
...buildBaseOptions(model, options, apiKey),
|
|
355
430
|
authProfileId: options?.authProfileId,
|
|
356
|
-
reasoningEffort:
|
|
431
|
+
reasoningEffort: resolveOpenAISimpleReasoningEffort(model, options?.reasoning)
|
|
357
432
|
};
|
|
358
433
|
responsesPromptObserver.copy(options, resolvedOptions);
|
|
434
|
+
const lifecycle = responsesRequestLifecycle.get(options);
|
|
435
|
+
if (lifecycle) responsesRequestLifecycle.set(resolvedOptions, lifecycle);
|
|
359
436
|
return streamOpenAICodexResponses(model, context, resolvedOptions);
|
|
360
437
|
};
|
|
361
438
|
function buildRequestBody(model, context, options, replayMode = "checkpoint") {
|
|
@@ -376,20 +453,24 @@ function buildRequestBody(model, context, options, replayMode = "checkpoint") {
|
|
|
376
453
|
include: ["reasoning.encrypted_content"],
|
|
377
454
|
prompt_cache_key: options?.cacheRetention === "none" ? void 0 : clampOpenAIPromptCacheKey(options?.promptCacheKey ?? options?.sessionId)
|
|
378
455
|
};
|
|
456
|
+
if (options?.responseFormat !== void 0) body.text = {
|
|
457
|
+
...body.text,
|
|
458
|
+
format: resolveOpenAIResponsesTextFormat(options.responseFormat)
|
|
459
|
+
};
|
|
379
460
|
if (options?.temperature !== void 0 && supportsOpenAITemperature(model)) body.temperature = options.temperature;
|
|
380
461
|
if (options?.serviceTier !== void 0) body.service_tier = options.serviceTier;
|
|
381
462
|
if (context.tools) {
|
|
382
|
-
const tools = convertResponsesToolPayload(context.tools, { strict:
|
|
463
|
+
const tools = convertResponsesToolPayload(context.tools, { strict: false });
|
|
383
464
|
if (tools.length > 0) {
|
|
384
465
|
body.tools = tools;
|
|
385
466
|
body.tool_choice = "auto";
|
|
386
467
|
body.parallel_tool_calls = true;
|
|
387
468
|
}
|
|
388
469
|
}
|
|
389
|
-
const effort = options?.reasoningEffort === void 0 ? void 0 :
|
|
470
|
+
const effort = options?.reasoningEffort === void 0 ? void 0 : resolveOpenAIRequestReasoning(model, options.reasoningEffort).effort;
|
|
390
471
|
if (effort !== void 0) body.reasoning = {
|
|
391
472
|
effort,
|
|
392
|
-
summary: options?.reasoningSummary ?? "auto"
|
|
473
|
+
...effort === "none" ? {} : { summary: options?.reasoningSummary ?? "auto" }
|
|
393
474
|
};
|
|
394
475
|
return body;
|
|
395
476
|
}
|
|
@@ -409,60 +490,39 @@ function resolveCodexWebSocketUrl(baseUrl) {
|
|
|
409
490
|
if (url.protocol === "http:") url.protocol = "ws:";
|
|
410
491
|
return url.toString();
|
|
411
492
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
493
|
+
function isJsonRecord(value) {
|
|
494
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Structured refusal code carried by the OpenAI Responses transport. Every
|
|
498
|
+
* terminal Responses path preserves it: a non-OK HTTP body parsed by
|
|
499
|
+
* {@link parseErrorResponse}, an SSE/WebSocket `error` event mapped by
|
|
500
|
+
* {@link mapCodexEvents}, and a `response.failed` event normalized into
|
|
501
|
+
* {@link ResponsesStreamFailure}. Only the app-server surface carries the
|
|
502
|
+
* `codexErrorInfo` discriminator, so both shapes must be read here.
|
|
503
|
+
*/
|
|
504
|
+
function readCodexProviderRefusal(error) {
|
|
505
|
+
if (!(error instanceof ResponsesStreamFailure || error instanceof CodexApiError)) return;
|
|
506
|
+
const payload = error instanceof CodexApiError ? error.payload : isJsonRecord(error.response) ? error.response : void 0;
|
|
507
|
+
const nested = isJsonRecord(payload?.error) ? payload.error : void 0;
|
|
508
|
+
const codexErrorInfo = payload?.codexErrorInfo ?? nested?.codexErrorInfo;
|
|
509
|
+
if (error.code === "cyber_policy" || codexErrorInfo === "cyberPolicy") return { category: "cyber" };
|
|
510
|
+
if (error.code === "misalignment_policy_violation" || codexErrorInfo === "misalignmentPolicyViolation") {
|
|
511
|
+
const details = nested?.misalignment ?? payload?.misalignment;
|
|
512
|
+
const review = readOpenAIMisalignmentReview(details, true);
|
|
513
|
+
return {
|
|
514
|
+
category: "misalignment",
|
|
515
|
+
...review ? { review } : {}
|
|
516
|
+
};
|
|
420
517
|
}
|
|
421
|
-
};
|
|
518
|
+
return (typeof payload?.message === "string" ? payload.message : typeof nested?.message === "string" ? nested.message : "").startsWith("This content was flagged for possible biological risk.") ? { category: "bio" } : void 0;
|
|
519
|
+
}
|
|
422
520
|
function isCodexNonTransportError(error) {
|
|
423
521
|
return error instanceof CodexApiError || error instanceof CodexProtocolError || error instanceof ResponsesStreamFailure;
|
|
424
522
|
}
|
|
425
523
|
function isWebSocketConnectionLimitReachedError(error) {
|
|
426
524
|
return error instanceof CodexApiError && error.code === WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE;
|
|
427
525
|
}
|
|
428
|
-
function extractCodexEventError(event) {
|
|
429
|
-
const nested = event.error && typeof event.error === "object" ? event.error : void 0;
|
|
430
|
-
return {
|
|
431
|
-
code: typeof event.code === "string" ? event.code : typeof nested?.code === "string" ? nested.code : void 0,
|
|
432
|
-
message: typeof event.message === "string" ? event.message : typeof nested?.message === "string" ? nested.message : void 0
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
async function* mapCodexEvents(events) {
|
|
436
|
-
for await (const event of events) {
|
|
437
|
-
const type = typeof event.type === "string" ? event.type : void 0;
|
|
438
|
-
if (!type) continue;
|
|
439
|
-
if (type === "error") {
|
|
440
|
-
const { code, message } = extractCodexEventError(event);
|
|
441
|
-
throw new CodexApiError(`Codex error: ${message || code || JSON.stringify(event)}`, {
|
|
442
|
-
code,
|
|
443
|
-
payload: event
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
if (type === "response.done" || type === "response.completed" || type === "response.incomplete") {
|
|
447
|
-
const response = event.response;
|
|
448
|
-
const normalizedResponse = response ? {
|
|
449
|
-
...response,
|
|
450
|
-
status: normalizeCodexStatus(response.status)
|
|
451
|
-
} : response;
|
|
452
|
-
yield {
|
|
453
|
-
...event,
|
|
454
|
-
type: type === "response.done" ? "response.completed" : type,
|
|
455
|
-
response: normalizedResponse
|
|
456
|
-
};
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
yield event;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function normalizeCodexStatus(status) {
|
|
463
|
-
if (typeof status !== "string") return;
|
|
464
|
-
return CODEX_RESPONSE_STATUSES.has(status) ? status : void 0;
|
|
465
|
-
}
|
|
466
526
|
const OPENAI_BETA_RESPONSES_WEBSOCKETS = "responses_websockets=2026-02-06";
|
|
467
527
|
const SESSION_WEBSOCKET_CACHE_TTL_MS = 3e5;
|
|
468
528
|
const SESSION_WEBSOCKET_MAX_AGE_MS = 33e5;
|
|
@@ -614,11 +674,7 @@ async function acquireWebSocket(url, headers, sessionId, signal) {
|
|
|
614
674
|
const socket = await connectWebSocket(url, headers, signal);
|
|
615
675
|
return {
|
|
616
676
|
socket,
|
|
617
|
-
release: (
|
|
618
|
-
if (keep === false) {
|
|
619
|
-
closeWebSocketSilently(socket);
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
677
|
+
release: () => {
|
|
622
678
|
closeWebSocketSilently(socket);
|
|
623
679
|
}
|
|
624
680
|
};
|
|
@@ -863,12 +919,18 @@ async function processWebSocketStream(url, body, headers, output, stream, model,
|
|
|
863
919
|
egress: "native-codex-websocket",
|
|
864
920
|
payloadVariant
|
|
865
921
|
});
|
|
922
|
+
const lifecycle = responsesRequestLifecycle.get(options);
|
|
923
|
+
if (lifecycle) {
|
|
924
|
+
await lifecycle.beforeDispatch(options?.signal);
|
|
925
|
+
options?.signal?.throwIfAborted();
|
|
926
|
+
lifecycle.assertCurrent();
|
|
927
|
+
}
|
|
866
928
|
socket.send(JSON.stringify({
|
|
867
929
|
type: "response.create",
|
|
868
930
|
...requestBody
|
|
869
931
|
}));
|
|
870
932
|
onRequestSent?.();
|
|
871
|
-
await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal)), output, stream, onFirstProviderEvent, () => notifyProviderStreamOpened({
|
|
933
|
+
const terminal = await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal), void 0, options), output, stream, onFirstProviderEvent, () => notifyProviderStreamOpened({
|
|
872
934
|
options,
|
|
873
935
|
cancelStream: () => {
|
|
874
936
|
keepConnection = false;
|
|
@@ -901,6 +963,7 @@ async function processWebSocketStream(url, body, headers, output, stream, model,
|
|
|
901
963
|
lastResponseItems: responseItems
|
|
902
964
|
};
|
|
903
965
|
}
|
|
966
|
+
return terminal;
|
|
904
967
|
} catch (error) {
|
|
905
968
|
if (entry) entry.continuation = void 0;
|
|
906
969
|
keepConnection = false;
|
|
@@ -963,8 +1026,11 @@ function parseErrorResponse(raw, response) {
|
|
|
963
1026
|
let message = raw || statusText || "Request failed";
|
|
964
1027
|
let friendlyMessage;
|
|
965
1028
|
let code;
|
|
1029
|
+
let payload;
|
|
966
1030
|
try {
|
|
967
|
-
const
|
|
1031
|
+
const parsed = JSON.parse(raw);
|
|
1032
|
+
payload = isJsonRecord(parsed) ? parsed : void 0;
|
|
1033
|
+
const err = parsed?.error;
|
|
968
1034
|
if (err) {
|
|
969
1035
|
code = err.code || err.type || void 0;
|
|
970
1036
|
if (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(code ?? "") || status === 429) {
|
|
@@ -979,7 +1045,8 @@ function parseErrorResponse(raw, response) {
|
|
|
979
1045
|
const retryAfterSuffix = Number.isFinite(retryAfterSeconds) ? `; Retry-After: ${Math.ceil(retryAfterSeconds ?? 0)} seconds` : "";
|
|
980
1046
|
return new CodexApiError(`${friendlyMessage || message}${retryAfterSuffix}`, {
|
|
981
1047
|
code,
|
|
982
|
-
status
|
|
1048
|
+
status,
|
|
1049
|
+
payload
|
|
983
1050
|
});
|
|
984
1051
|
}
|
|
985
1052
|
function extractOpenAICodexAccountId(token) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { N as clampThinkingLevel } from "./host-yTvBrYM2.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-CUollwl6.mjs";
|
|
5
5
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
6
|
-
import { n as buildBaseOptions, o as reasoningTagTextPolicy } from "./simple-options-
|
|
7
|
-
import {
|
|
6
|
+
import { n as buildBaseOptions, o as reasoningTagTextPolicy } from "./simple-options-np1XPuhm.mjs";
|
|
7
|
+
import { C as isOpenAICompletionsThinkingEnabled, b as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-DZKOTSfH.mjs";
|
|
8
8
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
9
|
-
import { b as withProviderResponseHook, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-
|
|
9
|
+
import { b as withProviderResponseHook, n as assignTransportErrorDetails, v as transportAbortError } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
10
10
|
import { a as tagUnresolvedTextAsCommentary, t as clearPendingCommentaryText } from "./assistant-text-phase-C20rxWwP.mjs";
|
|
11
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
12
|
-
import { a as convertMessages, i as buildOpenAICompletionsRequest, s as finalizeOpenAICompletionsToolCalls, t as processCompletionsStream } from "./openai-completions-stream-
|
|
13
|
-
import { i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-
|
|
14
|
-
import { n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
11
|
+
import { t as createAssistantOutput } from "./assistant-output-DM1JBNs1.mjs";
|
|
12
|
+
import { a as convertMessages, i as buildOpenAICompletionsRequest, s as finalizeOpenAICompletionsToolCalls, t as processCompletionsStream } from "./openai-completions-stream-BpuJ0ZOA.mjs";
|
|
13
|
+
import { i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-BeptfRL6.mjs";
|
|
14
|
+
import { n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-lrXEFkYr.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-BP8J1aeg.mjs";
|
|
17
17
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
18
18
|
var openai_completions_exports = /* @__PURE__ */ __exportAll({
|
|
19
19
|
convertMessages: () => convertMessages,
|
|
@@ -154,11 +154,10 @@ const streamSimpleOpenAICompletions = (model, context, options) => {
|
|
|
154
154
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
155
155
|
const base = buildBaseOptions(model, options, apiKey);
|
|
156
156
|
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : void 0;
|
|
157
|
-
const reasoningEffort = clampedReasoning === "off" ? void 0 : clampedReasoning === "max" ? "xhigh" : clampedReasoning;
|
|
158
157
|
const toolChoice = options?.toolChoice;
|
|
159
158
|
return streamOpenAICompletions(model, context, {
|
|
160
159
|
...base,
|
|
161
|
-
reasoningEffort,
|
|
160
|
+
reasoningEffort: clampedReasoning,
|
|
162
161
|
toolChoice
|
|
163
162
|
});
|
|
164
163
|
};
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
2
|
-
import { a as resolveProviderRequestCapabilities } from "./host-policy-
|
|
3
|
-
//#region packages/normalization-core/src/code-points.ts
|
|
4
|
-
/** Truncates to a nonnegative code-point budget; grapheme clusters may be split. */
|
|
5
|
-
function truncateCodePoints(text, maxCodePoints) {
|
|
6
|
-
const limit = Math.max(0, Math.trunc(maxCodePoints) || 0);
|
|
7
|
-
if (text.length <= limit) return text;
|
|
8
|
-
const prefix = [];
|
|
9
|
-
for (const codePoint of text) {
|
|
10
|
-
if (prefix.length >= limit) break;
|
|
11
|
-
prefix.push(codePoint);
|
|
12
|
-
}
|
|
13
|
-
return prefix.join("");
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
2
|
+
import { a as resolveProviderRequestCapabilities } from "./host-policy-DZO3oPPk.mjs";
|
|
16
3
|
//#region packages/ai/src/providers/openai-response-format.ts
|
|
17
4
|
const JSON_SCHEMA_RESPONSE_FORMAT_NAME = "openclaw_response";
|
|
18
5
|
const OLLAMA_CLOUD_ORIGIN = "https://ollama.com";
|
|
@@ -127,9 +114,6 @@ function resolveOpenAICompletionsCompatDefaults(input) {
|
|
|
127
114
|
supportsLongCacheRetention: !isModelStudioLike && provider !== "cloudflare-workers-ai" && provider !== "cloudflare-ai-gateway" && knownProviderFamily !== "together" && !input.baseUrl?.includes("api.cloudflare.com") && !input.baseUrl?.includes("gateway.ai.cloudflare.com") && !input.baseUrl?.includes("api.together.ai") && !input.baseUrl?.includes("api.together.xyz")
|
|
128
115
|
};
|
|
129
116
|
}
|
|
130
|
-
function resolveOpenAICompletionsCompatDefaultsFromCapabilities(input) {
|
|
131
|
-
return resolveOpenAICompletionsCompatDefaults(input);
|
|
132
|
-
}
|
|
133
117
|
/** Detects endpoint capabilities and defaults for an OpenAI-completions model. */
|
|
134
118
|
function detectOpenAICompletionsCompat(model, resolveCapabilities) {
|
|
135
119
|
const capabilities = (resolveCapabilities ?? ((input) => resolveProviderRequestCapabilities(input, model)))({
|
|
@@ -143,7 +127,7 @@ function detectOpenAICompletionsCompat(model, resolveCapabilities) {
|
|
|
143
127
|
});
|
|
144
128
|
return {
|
|
145
129
|
capabilities,
|
|
146
|
-
defaults:
|
|
130
|
+
defaults: resolveOpenAICompletionsCompatDefaults({
|
|
147
131
|
provider: model.provider,
|
|
148
132
|
modelId: model.id,
|
|
149
133
|
baseUrl: model.baseUrl,
|
|
@@ -164,6 +148,8 @@ function resolveOpenAICompletionsCompat(model, resolveCapabilities) {
|
|
|
164
148
|
supportsStore: configured?.supportsStore ?? defaults.supportsStore,
|
|
165
149
|
supportsDeveloperRole: configured?.supportsDeveloperRole ?? defaults.supportsDeveloperRole,
|
|
166
150
|
supportsReasoningEffort: configured?.supportsReasoningEffort ?? defaults.supportsReasoningEffort,
|
|
151
|
+
supportedReasoningEfforts: configured?.supportedReasoningEfforts,
|
|
152
|
+
reasoningEffortMap: configured?.reasoningEffortMap,
|
|
167
153
|
supportsUsageInStreaming: configured?.supportsUsageInStreaming ?? defaults.supportsUsageInStreaming,
|
|
168
154
|
maxTokensField: configured?.maxTokensField ?? defaults.maxTokensField,
|
|
169
155
|
requiresToolResultName: configured?.requiresToolResultName ?? false,
|
|
@@ -186,35 +172,4 @@ function resolveOpenAICompletionsCompat(model, resolveCapabilities) {
|
|
|
186
172
|
};
|
|
187
173
|
}
|
|
188
174
|
//#endregion
|
|
189
|
-
|
|
190
|
-
const EXTENDED_RETENTION_MODELS = /* @__PURE__ */ new Set([
|
|
191
|
-
"gpt-5.5",
|
|
192
|
-
"gpt-5.5-pro",
|
|
193
|
-
"gpt-5.4",
|
|
194
|
-
"gpt-5.2",
|
|
195
|
-
"gpt-5.1-codex-max",
|
|
196
|
-
"gpt-5.1",
|
|
197
|
-
"gpt-5.1-codex",
|
|
198
|
-
"gpt-5.1-codex-mini",
|
|
199
|
-
"gpt-5.1-chat-latest",
|
|
200
|
-
"gpt-5",
|
|
201
|
-
"gpt-5-codex",
|
|
202
|
-
"gpt-4.1"
|
|
203
|
-
]);
|
|
204
|
-
/** Selects documented lifetime fields shared by Responses and Chat Completions. */
|
|
205
|
-
function resolveOpenAIPromptCacheParams(model, cacheRetention, compat) {
|
|
206
|
-
if (cacheRetention !== "long" || !compat.supportsPromptCacheKey || !compat.supportsLongCacheRetention) return {};
|
|
207
|
-
const version = /^gpt-(\d+)(?:\.(\d+))?(?:-|$)/.exec(model.id);
|
|
208
|
-
if (version && (Number(version[1]) > 5 || Number(version[1]) === 5 && Number(version[2]) >= 6)) return { prompt_cache_options: { ttl: "30m" } };
|
|
209
|
-
const modelId = model.id.replace(/-\d{4}-\d{2}-\d{2}$/, "");
|
|
210
|
-
return !isNativeOpenAIEndpoint(model) || EXTENDED_RETENTION_MODELS.has(modelId) ? { prompt_cache_retention: "24h" } : {};
|
|
211
|
-
}
|
|
212
|
-
/** Maximum prompt cache key length accepted by OpenAI-compatible request metadata. */
|
|
213
|
-
const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
214
|
-
/** Truncates a prompt cache key by Unicode code point count. */
|
|
215
|
-
function clampOpenAIPromptCacheKey(key) {
|
|
216
|
-
if (key === void 0) return;
|
|
217
|
-
return truncateCodePoints(key, 64);
|
|
218
|
-
}
|
|
219
|
-
//#endregion
|
|
220
|
-
export { isNativeOpenAIEndpoint as a, resolveOpenAIPromptCacheKeySupport as c, shouldOmitOllamaCompatResponseFormat as d, detectOpenAICompletionsCompat as i, usesNativeOpenAICodexResponsesBackend as l, clampOpenAIPromptCacheKey as n, isOpenAICodexResponsesModel as o, resolveOpenAIPromptCacheParams as r, resolveOpenAICompletionsCompat as s, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH as t, resolveOpenAICompletionsResponseFormat as u };
|
|
175
|
+
export { resolveOpenAIPromptCacheKeySupport as a, shouldOmitOllamaCompatResponseFormat as c, resolveOpenAICompletionsCompat as i, isNativeOpenAIEndpoint as n, usesNativeOpenAICodexResponsesBackend as o, isOpenAICodexResponsesModel as r, resolveOpenAICompletionsResponseFormat as s, detectOpenAICompletionsCompat as t };
|
package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-DfJG1wSO.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-C25RT6bP.mjs";
|
|
2
|
+
import { M as OpenAICompletionsCompat, O as Model } from "./types-qZFbaDbK.mjs";
|
|
3
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-DH-Z-LDb.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";
|
|
@@ -24,7 +24,7 @@ type DetectedOpenAICompletionsCompat = {
|
|
|
24
24
|
capabilities: ProviderRequestCapabilities;
|
|
25
25
|
defaults: OpenAICompletionsCompatDefaults;
|
|
26
26
|
};
|
|
27
|
-
type ResolvedOpenAICompletionsCompat = Omit<Required<OpenAICompletionsCompat>, "cacheControlFormat" | "openRouterRouting" | "sendSessionAffinityHeaders" | "reasoningEffortMap"> & {
|
|
27
|
+
type ResolvedOpenAICompletionsCompat = Omit<Required<OpenAICompletionsCompat>, "cacheControlFormat" | "openRouterRouting" | "sendSessionAffinityHeaders" | "reasoningEffortMap" | "supportedReasoningEfforts"> & Pick<OpenAICompletionsCompat, "reasoningEffortMap" | "supportedReasoningEfforts"> & {
|
|
28
28
|
cacheControlFormat?: OpenAICompletionsCompat["cacheControlFormat"];
|
|
29
29
|
openRouterRouting?: OpenAICompletionsCompat["openRouterRouting"];
|
|
30
30
|
sessionAffinity: OpenAICompletionsSessionAffinity;
|