@openclaw/ai 2026.9.1-beta.1 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-compaction-replay-nhKaCXu6.mjs → anthropic-compaction-replay-OMJZ0uyo.mjs} +37 -34
- package/dist/{anthropic-DI4PZKKB.mjs → anthropic-hk7F7ptG.mjs} +28 -25
- package/dist/{anthropic-payload-policy-B_0n0enE.d.mts → anthropic-payload-policy-DBT1itQ-.d.mts} +3 -3
- package/dist/{api-registry-CTd8NzcD.d.mts → api-registry-Cs6HGNqY.d.mts} +2 -2
- package/dist/{azure-openai-responses-D8dI0ekg.mjs → azure-openai-responses-CN4Fy5zV.mjs} +10 -7
- package/dist/{number-coercion-H9qHik3g.mjs → base64-CEFBpSkN.mjs} +73 -1
- package/dist/{diagnostics-COpOtRwq.mjs → diagnostics-CPeq9F7y.mjs} +5 -1
- package/dist/{diagnostics-BaTA9eVl.d.mts → diagnostics-DnPnOui6.d.mts} +5 -1
- package/dist/diagnostics-KhXK-QJI.mjs +136 -0
- package/dist/diagnostics.d.mts +8 -3
- package/dist/diagnostics.mjs +4 -3
- package/dist/{env-api-keys-DrgeBuva.mjs → env-api-keys-bktO00EJ.mjs} +2 -15
- package/dist/event-stream-DeDhbCc5.d.mts +1 -0
- package/dist/{event-stream-LiXePESD.d.mts → event-stream-vK_7r3bj.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-Od-LLdVK.mjs → google-CC-nrwXg.mjs} +8 -6
- package/dist/{google-shared-Bgr9lFPw.mjs → google-shared-CjPY0hZM.mjs} +25 -23
- package/dist/{google-vertex-aerRSXc4.mjs → google-vertex-DCr0pyzQ.mjs} +7 -5
- package/dist/{host-D51fmkH6.mjs → host-BIaiBURL.mjs} +2 -2
- package/dist/{host-DsbPMFU6.d.mts → host-BztR4tQj.d.mts} +3 -3
- package/dist/index-AfaxKT8w.d.mts +111 -0
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +5 -5
- package/dist/internal/anthropic.d.mts +53 -52
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -3
- package/dist/internal/openai-responses-payload-policy.mjs +2 -3
- package/dist/internal/openai.d.mts +65 -63
- package/dist/internal/openai.mjs +9 -9
- package/dist/internal/retry-after.d.mts +2 -3
- package/dist/internal/runtime.d.mts +43 -43
- package/dist/internal/runtime.mjs +10 -8
- package/dist/internal/shared.d.mts +25 -25
- package/dist/internal/shared.mjs +95 -4
- package/dist/{mistral-EiHdymeb.mjs → mistral-B7etBd_H.mjs} +25 -20
- package/dist/{openai-chatgpt-responses-DHpF9o1e.mjs → openai-chatgpt-responses-BAJ4gq3i.mjs} +63 -122
- package/dist/{openai-completions-EFPiUGfS.mjs → openai-completions-D0QZ0AyB.mjs} +24 -20
- package/dist/{openai-completions-compat-BefmHT26.d.mts → openai-completions-compat-4IjSBpr6.d.mts} +5 -5
- package/dist/{openai-completions-stream-DUlGwRMz.mjs → openai-completions-stream-DZjwK8vp.mjs} +97 -90
- package/dist/{openai-responses-BogP8OjX.mjs → openai-responses-BEUlxfDu.mjs} +12 -8
- package/dist/openai-responses-compaction-window-DO7yV7az.mjs +686 -0
- package/dist/{openai-responses-contracts-Dvj_UtPy.d.mts → openai-responses-contracts-bPzSN_Ba.d.mts} +14 -5
- package/dist/{openai-responses-payload-policy-CNGFT9zr.d.mts → openai-responses-payload-policy-rLRPsSmB.d.mts} +1 -0
- package/dist/{openai-responses-prompt-observer-internal-Cd4hJG-S.mjs → openai-responses-prompt-observer-internal-C7x4IK7r.mjs} +4 -18
- package/dist/{openai-responses-shared-DJThc6jW.mjs → openai-responses-shared-DiAdpNAM.mjs} +274 -221
- package/dist/{openai-tool-schema-ho-hIkQf.mjs → openai-tool-schema-BMiHFH36.mjs} +14 -12
- package/dist/{provider-error-DDOs_Bz0.mjs → provider-error-B6EGq6gg.mjs} +14 -85
- package/dist/{provider-options-MdMBLzlU.d.mts → provider-options-CxFPtvh7.d.mts} +11 -3
- package/dist/{provider-transcript-transform-C01bQ5a3.mjs → provider-transcript-transform-WvJmFUAf.mjs} +1 -1
- package/dist/provider-types.d.mts +19 -20
- package/dist/providers.d.mts +5 -5
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-5ygO2rZc.mjs → reasoning-tag-text-partitioner-C-4uedDb.mjs} +93 -77
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{sanitize-unicode-DCkltN94.mjs → sanitize-unicode-S6binQG-.mjs} +2 -8
- package/dist/{simple-options-CFj7x3J4.mjs → simple-options-0PLDyJ-d.mjs} +42 -6
- package/dist/{src-Bu3FiFAG.mjs → src-C8U7lkoa.mjs} +75 -2
- package/dist/{stream-first-event-timeout-MK28puvq.mjs → stream-first-event-timeout-DcNjoFQE.mjs} +1 -1
- package/dist/{tool-schema-json-projection-qvTEs5Am.mjs → tool-schema-json-projection-BtZiml7r.mjs} +21 -31
- package/dist/{transport-stream-shared-rvaCyFYt.d.mts → transport-stream-shared-BrvFTkoO.d.mts} +5 -5
- package/dist/{transport-stream-shared-ljShVIZB.mjs → transport-stream-shared-CytPVLIg.mjs} +18 -5
- package/dist/{transport-utils-LJ1_rbi-.mjs → transport-utils-CtuS1Upe.mjs} +5 -8
- package/dist/transports.d.mts +120 -85
- package/dist/transports.mjs +218 -249
- package/dist/types-B5EFUmXs.d.mts +1 -0
- package/dist/{types-DhLoJbFm.d.mts → types-DbrhszyQ.d.mts} +27 -13
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +4 -4
- package/dist/{validation-Dk7q7NMN.d.mts → validation-BOwtcl9X.d.mts} +1 -1
- package/dist/{validation-B61OhAio.mjs → validation-CJZtym2g.mjs} +7 -5
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/anthropic-BECQCNdF.d.mts +0 -98
- package/dist/event-stream-BKp4fOt_.d.mts +0 -1
- package/dist/index-Qbej8io0.d.mts +0 -3
- package/dist/openai-responses-contracts-QUY12X0B.mjs +0 -233
- package/dist/openai-responses-payload-policy-D8EdimYe.mjs +0 -204
- package/dist/provider-options-AvldWZt8.mjs +0 -21
- package/dist/tls-certificate-errors-DXSpluKI.mjs +0 -93
- package/dist/types-GiAjXatj.d.mts +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { n as getEnvApiKey } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
1
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
4
|
-
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, l as formatToolResultText, n as getAiTransportHost } from "./host-
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments } from "./transport-stream-shared-
|
|
2
|
+
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-S6binQG-.mjs";
|
|
3
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, l as formatToolResultText, n as getAiTransportHost } from "./host-BIaiBURL.mjs";
|
|
4
|
+
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-0PLDyJ-d.mjs";
|
|
5
|
+
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
6
|
+
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments, t as assignTransportErrorDetails } from "./transport-stream-shared-CytPVLIg.mjs";
|
|
8
7
|
import { r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
9
8
|
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
10
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
9
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-WvJmFUAf.mjs";
|
|
11
10
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-Drnn_6Qj.mjs";
|
|
12
11
|
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
13
12
|
import { randomUUID } from "node:crypto";
|
|
14
|
-
import { HTTPClient
|
|
13
|
+
import { HTTPClient } from "@mistralai/mistralai/lib/http";
|
|
14
|
+
import { Chat } from "@mistralai/mistralai/sdk/chat";
|
|
15
15
|
//#region packages/ai/src/providers/mistral.ts
|
|
16
16
|
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
|
17
|
-
const MISTRAL_STREAM_BODY_MAX_BYTES =
|
|
17
|
+
const MISTRAL_STREAM_BODY_MAX_BYTES = 16777216;
|
|
18
18
|
/**
|
|
19
19
|
* Builds a `Fetcher` that wraps the default `fetch` with a 16 MiB byte cap
|
|
20
20
|
* on streamed response bodies. The wrapped `Response.body` exposes a
|
|
@@ -30,7 +30,8 @@ function createBoundedMistralFetcher(maxBytes = MISTRAL_STREAM_BODY_MAX_BYTES, u
|
|
|
30
30
|
return async (input, init) => {
|
|
31
31
|
const response = init == null ? await upstreamFetch(input) : await upstreamFetch(input, init);
|
|
32
32
|
if (!response.body || typeof response.body.getReader !== "function") return response;
|
|
33
|
-
const
|
|
33
|
+
const reader = response.body.getReader();
|
|
34
|
+
const guard = createSseByteGuard(reader, {
|
|
34
35
|
maxBytes,
|
|
35
36
|
onOverflow: ({ size, maxBytes: cap }) => /* @__PURE__ */ new Error(`mistral: stream body exceeds ${cap} bytes (got ${size})`)
|
|
36
37
|
});
|
|
@@ -79,10 +80,11 @@ const streamMistral = (model, context, options) => {
|
|
|
79
80
|
reportedResponse = response;
|
|
80
81
|
}
|
|
81
82
|
});
|
|
82
|
-
const
|
|
83
|
+
const chat = new Chat({
|
|
83
84
|
apiKey,
|
|
84
85
|
serverURL: model.baseUrl,
|
|
85
|
-
httpClient
|
|
86
|
+
httpClient,
|
|
87
|
+
retryConfig: { strategy: "none" }
|
|
86
88
|
});
|
|
87
89
|
const normalizeMistralToolCallId = createMistralToolCallIdNormalizer();
|
|
88
90
|
let payload = buildChatPayload(model, context, transformProviderMessages(context.messages, model, (id) => normalizeMistralToolCallId(id)), options);
|
|
@@ -93,7 +95,7 @@ const streamMistral = (model, context, options) => {
|
|
|
93
95
|
...options?.headers
|
|
94
96
|
};
|
|
95
97
|
if (resolveMistralPromptCacheKey(options) && options?.sessionId) headers["x-affinity"] ||= options.sessionId;
|
|
96
|
-
const mistralStream = await
|
|
98
|
+
const mistralStream = await chat.stream(payload, {
|
|
97
99
|
headers,
|
|
98
100
|
signal: options?.signal
|
|
99
101
|
});
|
|
@@ -117,9 +119,8 @@ const streamMistral = (model, context, options) => {
|
|
|
117
119
|
});
|
|
118
120
|
stream.end();
|
|
119
121
|
} catch (error) {
|
|
122
|
+
const terminal = assignTransportErrorDetails(output, error, options?.signal);
|
|
120
123
|
output.content = output.content.filter((block) => block.type !== "toolCall");
|
|
121
|
-
const terminal = projectProviderError(error, options?.signal);
|
|
122
|
-
Object.assign(output, terminal);
|
|
123
124
|
stream.push({
|
|
124
125
|
type: "error",
|
|
125
126
|
reason: terminal.stopReason,
|
|
@@ -197,7 +198,8 @@ function deriveMistralToolCallId(id, attempt) {
|
|
|
197
198
|
const normalized = id.replace(/[^a-zA-Z0-9]/g, "");
|
|
198
199
|
if (attempt === 0 && normalized.length === MISTRAL_TOOL_CALL_ID_LENGTH) return normalized;
|
|
199
200
|
const seedBase = normalized || id;
|
|
200
|
-
|
|
201
|
+
const seed = attempt === 0 ? seedBase : `${seedBase}:${attempt}`;
|
|
202
|
+
return shortHash(seed).replace(/[^a-zA-Z0-9]/g, "").padEnd(MISTRAL_TOOL_CALL_ID_LENGTH, "0").slice(0, MISTRAL_TOOL_CALL_ID_LENGTH);
|
|
201
203
|
}
|
|
202
204
|
function buildChatPayload(model, context, messages, options) {
|
|
203
205
|
const payload = {
|
|
@@ -371,7 +373,8 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
371
373
|
continue;
|
|
372
374
|
}
|
|
373
375
|
if (item.type === "thinking") {
|
|
374
|
-
const
|
|
376
|
+
const deltaText = item.thinking.map((part) => "text" in part ? part.text : "").filter((text) => text.length > 0).join("");
|
|
377
|
+
const thinkingDelta = sanitizeSurrogates(deltaText);
|
|
375
378
|
if (!thinkingDelta) continue;
|
|
376
379
|
if (!currentBlock || currentBlock.type !== "thinking") {
|
|
377
380
|
finishCurrentBlock(currentBlock);
|
|
@@ -513,7 +516,7 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
513
516
|
}
|
|
514
517
|
}
|
|
515
518
|
function toFunctionTools(tools) {
|
|
516
|
-
|
|
519
|
+
const converted = tools.flatMap((tool) => {
|
|
517
520
|
try {
|
|
518
521
|
const name = tool.name;
|
|
519
522
|
const description = tool.description;
|
|
@@ -533,7 +536,8 @@ function toFunctionTools(tools) {
|
|
|
533
536
|
} catch {
|
|
534
537
|
return [];
|
|
535
538
|
}
|
|
536
|
-
})
|
|
539
|
+
});
|
|
540
|
+
return sortPromptCacheToolsByName(converted).map(({ value }) => value);
|
|
537
541
|
}
|
|
538
542
|
function stripSymbolKeys(value) {
|
|
539
543
|
if (Array.isArray(value)) return value.map((item) => stripSymbolKeys(item));
|
|
@@ -618,10 +622,11 @@ function toChatMessages(messages, supportsImages) {
|
|
|
618
622
|
const toolContent = [];
|
|
619
623
|
const textResult = extractToolResultText(msg.content);
|
|
620
624
|
const mediaPlaceholder = describeToolResultMediaPlaceholder(msg.content);
|
|
625
|
+
const omittedMediaPlaceholder = msg.content.some(isImageWithMediaPayload) && !supportsImages ? textResult.trim() ? "[tool image omitted: model does not support images]" : mediaPlaceholder === "(see attached media)" ? "(media omitted: model does not support images)" : "(image omitted: model does not support images)" : void 0;
|
|
621
626
|
const toolText = formatToolResultText({
|
|
622
627
|
text: textResult,
|
|
623
628
|
mediaPlaceholder,
|
|
624
|
-
omittedMediaPlaceholder
|
|
629
|
+
omittedMediaPlaceholder,
|
|
625
630
|
isError: msg.isError
|
|
626
631
|
});
|
|
627
632
|
toolContent.push({
|
package/dist/{openai-chatgpt-responses-DHpF9o1e.mjs → openai-chatgpt-responses-BAJ4gq3i.mjs}
RENAMED
|
@@ -1,46 +1,23 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-COpOtRwq.mjs";
|
|
1
|
+
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
|
|
3
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
4
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { c as resolveTimerTimeoutMs, i as clampTimerTimeoutMs } from "./number-coercion-H9qHik3g.mjs";
|
|
3
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-BIaiBURL.mjs";
|
|
4
|
+
import { r as toErrorObject } from "./diagnostics-KhXK-QJI.mjs";
|
|
5
|
+
import { u as resolveTimerTimeoutMs } from "./base64-CEFBpSkN.mjs";
|
|
8
6
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { C as headersToRecord, _ as transportAbortError, p as notifyProviderStreamOpened, y as withProviderResponseHook } from "./transport-stream-shared-
|
|
13
|
-
import { F as commitResponsesEncryptedContentAttempt,
|
|
14
|
-
import { C as createOpenAIProviderAcceptanceHook, w as createOpenAIResponseHook } from "./openai-tool-schema-
|
|
15
|
-
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-
|
|
16
|
-
import {
|
|
7
|
+
import { d as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-0PLDyJ-d.mjs";
|
|
8
|
+
import { c as parseRetryAfterSeconds, t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-CtuS1Upe.mjs";
|
|
9
|
+
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
10
|
+
import { C as headersToRecord, _ as transportAbortError, p as notifyProviderStreamOpened, t as assignTransportErrorDetails, y as withProviderResponseHook } from "./transport-stream-shared-CytPVLIg.mjs";
|
|
11
|
+
import { F as commitResponsesEncryptedContentAttempt, L as isInvalidEncryptedContentError, W as buildOpenAIResponsesReasoningReplayMetadata, a as resolveResponsesReasoningEffort, c as processResponsesStream, i as createResponsesAssistantOutput, n as applyResponsesServiceTierPricing, p as ResponsesStreamFailure, q as suppressOpenAIResponsesCompaction, r as convertResponsesMessages, s as convertResponsesToolPayload, z as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-DiAdpNAM.mjs";
|
|
12
|
+
import { C as createOpenAIProviderAcceptanceHook, w as createOpenAIResponseHook } from "./openai-tool-schema-BMiHFH36.mjs";
|
|
13
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-DcNjoFQE.mjs";
|
|
14
|
+
import { A as supportsOpenAITemperature, S as responsesPromptObserver } from "./openai-responses-compaction-window-DO7yV7az.mjs";
|
|
15
|
+
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
17
16
|
import { n as registerSessionResourceCleanup } from "./session-resources-CkR4WWy1.mjs";
|
|
18
|
-
import "./
|
|
17
|
+
import { t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-C7x4IK7r.mjs";
|
|
19
18
|
import { n as resolveOpenAICodexAccountId } from "./openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
20
|
-
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
21
|
-
import { t as inspectTlsCertificateError } from "./tls-certificate-errors-DXSpluKI.mjs";
|
|
22
|
-
//#region packages/ai/src/internal/retry-sleep.ts
|
|
23
|
-
function sleepWithAbort(ms, signal) {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
if (signal?.aborted) {
|
|
26
|
-
reject(/* @__PURE__ */ new Error("Request was aborted"));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const onAbort = () => {
|
|
30
|
-
clearTimeout(timeout);
|
|
31
|
-
signal?.removeEventListener("abort", onAbort);
|
|
32
|
-
reject(/* @__PURE__ */ new Error("Request was aborted"));
|
|
33
|
-
};
|
|
34
|
-
const timeout = setTimeout(() => {
|
|
35
|
-
signal?.removeEventListener("abort", onAbort);
|
|
36
|
-
resolve();
|
|
37
|
-
}, ms);
|
|
38
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
19
|
//#region packages/ai/src/providers/openai-chatgpt-responses-protocol.ts
|
|
43
|
-
const OPENAI_CHATGPT_RESPONSES_SUCCESS_BODY_MAX_BYTES =
|
|
20
|
+
const OPENAI_CHATGPT_RESPONSES_SUCCESS_BODY_MAX_BYTES = 16777216;
|
|
44
21
|
var CodexProtocolError = class extends Error {
|
|
45
22
|
constructor(message, options) {
|
|
46
23
|
super(message);
|
|
@@ -104,13 +81,11 @@ function loadNodeOs() {
|
|
|
104
81
|
}
|
|
105
82
|
const os = loadNodeOs();
|
|
106
83
|
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
107
|
-
const DEFAULT_MAX_RETRIES = 3;
|
|
108
|
-
const BASE_DELAY_MS = 1e3;
|
|
109
84
|
const REQUEST_COMPRESSION_ZSTD_LEVEL = 3;
|
|
110
85
|
const CODEX_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set(["openai", "opencode"]);
|
|
111
86
|
const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
|
|
112
87
|
const WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE = "websocket_connection_limit_reached";
|
|
113
|
-
const OPENAI_CHATGPT_RESPONSES_ERROR_BODY_MAX_BYTES =
|
|
88
|
+
const OPENAI_CHATGPT_RESPONSES_ERROR_BODY_MAX_BYTES = 16384;
|
|
114
89
|
const CODEX_RESPONSE_STATUSES = /* @__PURE__ */ new Set([
|
|
115
90
|
"completed",
|
|
116
91
|
"incomplete",
|
|
@@ -119,26 +94,6 @@ const CODEX_RESPONSE_STATUSES = /* @__PURE__ */ new Set([
|
|
|
119
94
|
"queued",
|
|
120
95
|
"in_progress"
|
|
121
96
|
]);
|
|
122
|
-
function isRetryableError(status, errorText) {
|
|
123
|
-
if (status === 429 || status === 500 || status === 502 || status === 503 || status === 504) return true;
|
|
124
|
-
return /rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(errorText);
|
|
125
|
-
}
|
|
126
|
-
function resolveHttpRetryDelayMs(response, attempt) {
|
|
127
|
-
const fallbackMs = BASE_DELAY_MS * 2 ** attempt;
|
|
128
|
-
const retryAfterMs = response.headers.get("retry-after-ms");
|
|
129
|
-
if (retryAfterMs) {
|
|
130
|
-
const trimmed = retryAfterMs.trim();
|
|
131
|
-
const millis = Number(trimmed);
|
|
132
|
-
if (/^\d+(?:\.\d+)?$/.test(trimmed) && Number.isFinite(millis)) return clampTimerTimeoutMs(millis, 0) ?? fallbackMs;
|
|
133
|
-
}
|
|
134
|
-
const retryAfter = response.headers.get("retry-after");
|
|
135
|
-
if (!retryAfter) return fallbackMs;
|
|
136
|
-
const trimmed = retryAfter.trim();
|
|
137
|
-
const seconds = Number(trimmed);
|
|
138
|
-
if (/^\d+$/.test(trimmed) && Number.isFinite(seconds)) return clampTimerTimeoutMs(seconds * 1e3, 0) ?? fallbackMs;
|
|
139
|
-
const retryAt = parseRetryAfterHttpDateMs(trimmed);
|
|
140
|
-
return retryAt === void 0 ? fallbackMs : clampTimerTimeoutMs(retryAt - Date.now(), 0) ?? fallbackMs;
|
|
141
|
-
}
|
|
142
97
|
function resolveRequestTimeoutMs(options) {
|
|
143
98
|
const timeoutMs = options?.timeoutMs;
|
|
144
99
|
return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 1) : void 0;
|
|
@@ -267,7 +222,6 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
267
222
|
}
|
|
268
223
|
}
|
|
269
224
|
let response;
|
|
270
|
-
const maxRetries = options?.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
271
225
|
while (true) {
|
|
272
226
|
const activeAttempt = semanticAttempt;
|
|
273
227
|
response = void 0;
|
|
@@ -276,71 +230,58 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
276
230
|
const compressedBody = model.provider === "openai" && !sseHeaders.has("content-encoding") ? compressRequestBodyZstd(bodyJson) : null;
|
|
277
231
|
if (compressedBody) sseHeaders.set("content-encoding", "zstd");
|
|
278
232
|
const sseBody = compressedBody ?? bodyJson;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
body: sseBody,
|
|
292
|
-
signal: activeSignal
|
|
293
|
-
});
|
|
294
|
-
} catch (error) {
|
|
295
|
-
if (error instanceof Error) {
|
|
296
|
-
if (isRequestTimeoutError(error, options?.signal, requestTimeoutSignal, requestTimeoutMs) && requestTimeoutMs !== void 0) throw formatRequestTimeoutError(requestTimeoutMs, error);
|
|
297
|
-
if (error.name === "AbortError" || error.message === "Request was aborted") throw new Error("Request was aborted", { cause: error });
|
|
298
|
-
if (error.name === "TimeoutError" && requestTimeoutMs !== void 0) throw new Error(`Request timed out after ${requestTimeoutMs}ms`, { cause: error });
|
|
299
|
-
}
|
|
300
|
-
const tlsCertificateError = inspectTlsCertificateError(error);
|
|
301
|
-
const lastError = toErrorObject(error, String(error));
|
|
302
|
-
if (attempt < maxRetries && !lastError.message.includes("usage limit") && !tlsCertificateError) {
|
|
303
|
-
await sleepWithAbort(BASE_DELAY_MS * 2 ** attempt, activeSignal);
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
throw lastError;
|
|
307
|
-
}
|
|
308
|
-
response = attemptResponse;
|
|
309
|
-
if (attemptResponse.ok) break;
|
|
310
|
-
const hookStream = withFirstStreamEventTimeout(withProviderResponseHook({
|
|
311
|
-
signal: firstEventAbort.signal,
|
|
312
|
-
abort: firstEventAbort.abort,
|
|
313
|
-
hook: createOpenAIResponseHook(options?.onResponse, attemptResponse, model)
|
|
314
|
-
}), {
|
|
315
|
-
provider: model.provider,
|
|
316
|
-
api: model.api,
|
|
317
|
-
model: model.id,
|
|
318
|
-
timeoutMs: getFirstStreamEventTimeoutMs(options) ?? 0,
|
|
319
|
-
stage: "responses",
|
|
320
|
-
abort: firstEventAbort.abort,
|
|
321
|
-
onTimeout: getFirstStreamEventTimeoutHandler(options)
|
|
233
|
+
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
234
|
+
observePromptEgress?.(activeAttempt.request, {
|
|
235
|
+
egress: "native-codex-sse",
|
|
236
|
+
payloadVariant: activeAttempt.kind
|
|
237
|
+
});
|
|
238
|
+
let attemptResponse;
|
|
239
|
+
try {
|
|
240
|
+
attemptResponse = await fetch(resolveCodexUrl(model.baseUrl), {
|
|
241
|
+
method: "POST",
|
|
242
|
+
headers: sseHeaders,
|
|
243
|
+
body: sseBody,
|
|
244
|
+
signal: activeSignal
|
|
322
245
|
});
|
|
323
|
-
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
246
|
+
} catch (error) {
|
|
247
|
+
if (error instanceof Error) {
|
|
248
|
+
if (isRequestTimeoutError(error, options?.signal, requestTimeoutSignal, requestTimeoutMs) && requestTimeoutMs !== void 0) throw formatRequestTimeoutError(requestTimeoutMs, error);
|
|
249
|
+
if (error.name === "AbortError" || error.message === "Request was aborted") throw new Error("Request was aborted", { cause: error });
|
|
250
|
+
if (error.name === "TimeoutError" && requestTimeoutMs !== void 0) throw new Error(`Request timed out after ${requestTimeoutMs}ms`, { cause: error });
|
|
327
251
|
}
|
|
328
|
-
|
|
329
|
-
terminalResponseError = new CodexApiError(info.friendlyMessage || info.message, { code: info.code });
|
|
330
|
-
break;
|
|
252
|
+
throw toErrorObject(error, String(error));
|
|
331
253
|
}
|
|
332
|
-
|
|
333
|
-
|
|
254
|
+
response = attemptResponse;
|
|
255
|
+
if (attemptResponse.ok) {
|
|
256
|
+
if (!attemptResponse.body) throw new Error("No response body");
|
|
334
257
|
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
335
258
|
commitSemanticAttempt(activeAttempt);
|
|
336
259
|
break;
|
|
337
260
|
}
|
|
261
|
+
const hookStream = withFirstStreamEventTimeout(withProviderResponseHook({
|
|
262
|
+
signal: firstEventAbort.signal,
|
|
263
|
+
abort: firstEventAbort.abort,
|
|
264
|
+
hook: createOpenAIResponseHook(options?.onResponse, attemptResponse, model)
|
|
265
|
+
}), {
|
|
266
|
+
provider: model.provider,
|
|
267
|
+
api: model.api,
|
|
268
|
+
model: model.id,
|
|
269
|
+
timeoutMs: getFirstStreamEventTimeoutMs(options) ?? 0,
|
|
270
|
+
stage: "responses",
|
|
271
|
+
abort: firstEventAbort.abort,
|
|
272
|
+
onTimeout: getFirstStreamEventTimeoutHandler(options)
|
|
273
|
+
});
|
|
274
|
+
const [errorText] = await Promise.all([readChatGptResponsesErrorTextLimited(attemptResponse, activeSignal), hookStream[Symbol.asyncIterator]().next()]);
|
|
275
|
+
const info = parseErrorResponseText(errorText, attemptResponse.status, attemptResponse.statusText);
|
|
276
|
+
const retryAfterSeconds = parseRetryAfterSeconds(attemptResponse.headers);
|
|
277
|
+
const retryAfterSuffix = Number.isFinite(retryAfterSeconds) ? `; Retry-After: ${Math.ceil(retryAfterSeconds ?? 0)} seconds` : "";
|
|
278
|
+
const terminalResponseError = new CodexApiError(`${info.friendlyMessage || info.message}${retryAfterSuffix}`, { code: info.code });
|
|
338
279
|
if (activeSignal?.aborted) throw transportAbortError(activeSignal);
|
|
339
|
-
const nextSemanticAttempt =
|
|
340
|
-
if (!nextSemanticAttempt) throw terminalResponseError
|
|
280
|
+
const nextSemanticAttempt = await resolveNextResponsesEncryptedContentAttempt(activeAttempt, terminalResponseError, { buildFullHistoryRequest: () => buildBody("full-history") });
|
|
281
|
+
if (!nextSemanticAttempt) throw terminalResponseError;
|
|
341
282
|
semanticAttempt = nextSemanticAttempt;
|
|
342
283
|
}
|
|
343
|
-
|
|
284
|
+
const hookedResponseStream = withProviderResponseHook({
|
|
344
285
|
stream: mapCodexEvents(parseOpenAIChatGptResponsesSse(response)),
|
|
345
286
|
signal: firstEventAbort.signal,
|
|
346
287
|
abort: firstEventAbort.abort,
|
|
@@ -349,7 +290,8 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
349
290
|
type: "start",
|
|
350
291
|
partial: output
|
|
351
292
|
})
|
|
352
|
-
})
|
|
293
|
+
});
|
|
294
|
+
await processResponsesStream(hookedResponseStream, output, stream, model, {
|
|
353
295
|
serviceTier: options?.serviceTier,
|
|
354
296
|
firstEventTimeoutMs: getFirstStreamEventTimeoutMs(options),
|
|
355
297
|
abortFirstEventStream: firstEventAbort.abort,
|
|
@@ -374,7 +316,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
374
316
|
const requestTimedOut = isRequestTimeoutError(error, options?.signal, requestTimeoutSignal, requestTimeoutMs) && requestTimeoutMs !== void 0;
|
|
375
317
|
const normalizedError = requestTimedOut && requestTimeoutMs !== void 0 ? formatRequestTimeoutError(requestTimeoutMs, error) : error;
|
|
376
318
|
for (const block of output.content) delete block.partialJson;
|
|
377
|
-
const terminal =
|
|
319
|
+
const terminal = assignTransportErrorDetails(output, normalizedError, options?.signal);
|
|
378
320
|
getAiTransportHost().logWarn("openai-transport", "ChatGPT Responses stream terminated", {
|
|
379
321
|
provider: model.provider,
|
|
380
322
|
api: model.api,
|
|
@@ -384,7 +326,6 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
384
326
|
stopReason: terminal.stopReason,
|
|
385
327
|
failureKind: classifyStreamFailure(error, options?.signal, requestTimedOut)
|
|
386
328
|
});
|
|
387
|
-
Object.assign(output, terminal);
|
|
388
329
|
stream.push({
|
|
389
330
|
type: "error",
|
|
390
331
|
reason: terminal.stopReason,
|
|
@@ -515,8 +456,8 @@ function normalizeCodexStatus(status) {
|
|
|
515
456
|
return CODEX_RESPONSE_STATUSES.has(status) ? status : void 0;
|
|
516
457
|
}
|
|
517
458
|
const OPENAI_BETA_RESPONSES_WEBSOCKETS = "responses_websockets=2026-02-06";
|
|
518
|
-
const SESSION_WEBSOCKET_CACHE_TTL_MS =
|
|
519
|
-
const SESSION_WEBSOCKET_MAX_AGE_MS =
|
|
459
|
+
const SESSION_WEBSOCKET_CACHE_TTL_MS = 3e5;
|
|
460
|
+
const SESSION_WEBSOCKET_MAX_AGE_MS = 33e5;
|
|
520
461
|
const websocketSessionCache = /* @__PURE__ */ new Map();
|
|
521
462
|
const websocketSseFallbackSessions = /* @__PURE__ */ new Set();
|
|
522
463
|
let cachedWebsocket = null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { i as clampThinkingLevel } from "./sanitize-unicode-
|
|
4
|
-
import { n as getAiTransportHost } from "./host-
|
|
5
|
-
import { n as projectProviderError } from "./provider-error-DDOs_Bz0.mjs";
|
|
3
|
+
import { i as clampThinkingLevel } from "./sanitize-unicode-S6binQG-.mjs";
|
|
4
|
+
import { n as getAiTransportHost } from "./host-BIaiBURL.mjs";
|
|
6
5
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
7
6
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { m as sortPromptCacheToolsByName, n as buildBaseOptions, o as reasoningTagTextPolicy, u as splitSystemPromptCacheBoundary } from "./simple-options-0PLDyJ-d.mjs";
|
|
8
|
+
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
9
|
+
import { _ as transportAbortError, t as assignTransportErrorDetails, y as withProviderResponseHook } from "./transport-stream-shared-CytPVLIg.mjs";
|
|
10
|
+
import { E as tagUnresolvedTextAsCommentary, S as shouldOmitOllamaCompatResponseFormat, _ as hasToolCallHistory, b as resolveOpenAICompletionsCompat, g as convertMessages, h as resolveOpenAIReasoningEffortMap, t as processCompletionsStream, v as finalizeOpenAICompletionsToolCalls, w as clearPendingCommentaryText, x as resolveOpenAICompletionsResponseFormat } from "./openai-completions-stream-DZjwK8vp.mjs";
|
|
11
|
+
import { C as createOpenAIProviderAcceptanceHook, T as isOpenAICompletionsThinkingEnabled, j as resolveOpenAIClientBaseUrl, v as projectOpenAITools, y as reconcileOpenAICompletionsToolChoice } from "./openai-tool-schema-BMiHFH36.mjs";
|
|
12
|
+
import { i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-DcNjoFQE.mjs";
|
|
13
13
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, r as isCloudflareProvider, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
14
14
|
import OpenAI from "openai";
|
|
15
15
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
@@ -60,7 +60,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
60
60
|
const requestOptions = {
|
|
61
61
|
signal: firstEventAbort.signal,
|
|
62
62
|
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
63
|
-
maxRetries:
|
|
63
|
+
maxRetries: 0
|
|
64
64
|
};
|
|
65
65
|
const { data: openaiStream, response } = await client.chat.completions.create(params, requestOptions).withResponse();
|
|
66
66
|
const hookedOpenAIStream = withProviderResponseHook({
|
|
@@ -125,6 +125,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
125
125
|
provisionalCommentaryTags,
|
|
126
126
|
signal: options?.signal,
|
|
127
127
|
emitReasoning: shouldEmitReasoning,
|
|
128
|
+
strictReasoningTags: reasoningTagTextPolicy.isStrict(options),
|
|
128
129
|
firstEventTimeoutMs: getFirstStreamEventTimeoutMs(options),
|
|
129
130
|
abortFirstEventStream: firstEventAbort.abort,
|
|
130
131
|
onFirstEventTimeout: getFirstStreamEventTimeoutHandler(options)
|
|
@@ -143,8 +144,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
143
144
|
});
|
|
144
145
|
stream.end();
|
|
145
146
|
} catch (error) {
|
|
146
|
-
const terminal =
|
|
147
|
-
Object.assign(output, terminal);
|
|
147
|
+
const terminal = assignTransportErrorDetails(output, error, options?.signal);
|
|
148
148
|
finalizeOpenAICompletionsToolCalls(output, { allowSilentToolCallPromotion: false });
|
|
149
149
|
clearPendingCommentaryText(provisionalCommentaryTags);
|
|
150
150
|
tagUnresolvedTextAsCommentary(output);
|
|
@@ -189,11 +189,13 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId, compat
|
|
|
189
189
|
});
|
|
190
190
|
Object.assign(headers, copilotHeaders);
|
|
191
191
|
}
|
|
192
|
-
if (sessionId && compat.sessionAffinity !== "none")
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
if (sessionId && compat.sessionAffinity !== "none") {
|
|
193
|
+
if (compat.sessionAffinity === "openrouter") headers["x-session-id"] = sessionId;
|
|
194
|
+
else {
|
|
195
|
+
headers.session_id = sessionId;
|
|
196
|
+
headers["x-client-request-id"] = sessionId;
|
|
197
|
+
headers["x-session-affinity"] = sessionId;
|
|
198
|
+
}
|
|
197
199
|
}
|
|
198
200
|
if (optionsHeaders) Object.assign(headers, optionsHeaders);
|
|
199
201
|
const defaultHeaders = model.provider === "cloudflare-ai-gateway" ? {
|
|
@@ -201,11 +203,13 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId, compat
|
|
|
201
203
|
Authorization: headers.Authorization ?? null,
|
|
202
204
|
"cf-aig-authorization": `Bearer ${apiKey}`
|
|
203
205
|
} : headers;
|
|
206
|
+
const baseUrl = isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model) : model.baseUrl;
|
|
204
207
|
return new OpenAI({
|
|
205
208
|
apiKey,
|
|
206
|
-
baseURL: resolveOpenAIClientBaseUrl(model,
|
|
209
|
+
baseURL: resolveOpenAIClientBaseUrl(model, baseUrl),
|
|
207
210
|
dangerouslyAllowBrowser: true,
|
|
208
211
|
defaultHeaders,
|
|
212
|
+
maxRetries: 0,
|
|
209
213
|
fetch: getAiTransportHost().buildModelFetch(model)
|
|
210
214
|
});
|
|
211
215
|
}
|
|
@@ -256,9 +260,9 @@ function buildParams(model, context, options, compat = resolveOpenAICompletionsC
|
|
|
256
260
|
}
|
|
257
261
|
const reasoningEffortMap = resolveOpenAIReasoningEffortMap(model);
|
|
258
262
|
const thinkingLevelMap = model.thinkingLevelMap;
|
|
259
|
-
const reasoningEffort = options?.reasoningEffort === void 0 ? void 0 : reasoningEffortMap[options.reasoningEffort] ?? thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
260
|
-
const reasoningEnabled = reasoningEffort !== void 0 && reasoningEffort !== "none";
|
|
261
263
|
const offReasoningEffort = reasoningEffortMap.off ?? model.thinkingLevelMap?.off;
|
|
264
|
+
const reasoningEffort = options?.reasoningEffort === void 0 ? offReasoningEffort ?? void 0 : reasoningEffortMap[options.reasoningEffort] ?? thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
265
|
+
const reasoningEnabled = reasoningEffort !== void 0 && reasoningEffort !== "none";
|
|
262
266
|
if (compat.thinkingFormat === "zai" && model.reasoning) params.thinking = reasoningEnabled ? {
|
|
263
267
|
type: "enabled",
|
|
264
268
|
clear_thinking: false
|
package/dist/{openai-completions-compat-BefmHT26.d.mts → openai-completions-compat-4IjSBpr6.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-
|
|
1
|
+
import "./index-AfaxKT8w.mjs";
|
|
2
|
+
import { D as Model, j as OpenAICompletionsCompat } from "./types-DbrhszyQ.mjs";
|
|
3
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-BztR4tQj.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"> & {
|
|
27
|
+
type ResolvedOpenAICompletionsCompat = Omit<Required<OpenAICompletionsCompat>, "cacheControlFormat" | "openRouterRouting" | "sendSessionAffinityHeaders" | "reasoningEffortMap"> & {
|
|
28
28
|
cacheControlFormat?: OpenAICompletionsCompat["cacheControlFormat"];
|
|
29
29
|
openRouterRouting?: OpenAICompletionsCompat["openRouterRouting"];
|
|
30
30
|
sessionAffinity: OpenAICompletionsSessionAffinity;
|
|
@@ -38,6 +38,6 @@ declare function detectOpenAICompletionsCompat(model: Pick<Model<"openai-complet
|
|
|
38
38
|
} | null;
|
|
39
39
|
}, resolveCapabilities?: (input: AiProviderRequestPolicyInput) => ProviderRequestCapabilities): DetectedOpenAICompletionsCompat;
|
|
40
40
|
/** Applies explicit model overrides once on top of the canonical transport defaults. */
|
|
41
|
-
declare function resolveOpenAICompletionsCompat(model: Model<"openai-completions">, resolveCapabilities?: (input: AiProviderRequestPolicyInput) => ProviderRequestCapabilities): ResolvedOpenAICompletionsCompat;
|
|
41
|
+
declare function resolveOpenAICompletionsCompat(model: Pick<Model<"openai-completions">, "id" | "provider" | "baseUrl" | "compat">, resolveCapabilities?: (input: AiProviderRequestPolicyInput) => ProviderRequestCapabilities): ResolvedOpenAICompletionsCompat;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { detectOpenAICompletionsCompat as n, resolveOpenAICompletionsCompat as r, ResolvedOpenAICompletionsCompat as t };
|