@openclaw/ai 2026.9.6 → 2026.9.7
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-DZQ_7gD1.mjs → anthropic-Cw2pgccz.mjs} +37 -66
- package/dist/{anthropic-payload-policy-DyfwikYJ.d.mts → anthropic-payload-policy-NIPVYXPq.d.mts} +7 -5
- package/dist/{anthropic-stream-reducer-D6ZI1wwj.mjs → anthropic-stream-reducer-D9MCkl8Z.mjs} +192 -261
- package/dist/{api-registry-C2T3lTV7.d.mts → api-registry-D-nbmSqr.d.mts} +2 -2
- package/dist/{azure-openai-responses-DS86GYzq.mjs → azure-openai-responses-BwT3-X8P.mjs} +22 -33
- package/dist/{base64-CPmadnUf.mjs → base64-C1PsYcRQ.mjs} +15 -9
- package/dist/{diagnostics-CH8j2wIG.mjs → diagnostics-CJaB6g8J.mjs} +3 -3
- package/dist/diagnostics.d.mts +4 -4
- package/dist/diagnostics.mjs +2 -2
- package/dist/{env-api-keys-bktO00EJ.mjs → env-api-keys-CyX4VKGO.mjs} +7 -5
- package/dist/event-stream-CMQfX_yr.d.mts +1 -0
- package/dist/{event-stream-CjnIZZst.d.mts → event-stream-DOPFYVqs.d.mts} +2 -2
- package/dist/{event-stream-D8PARQfL.mjs → event-stream-vd9UnCAU.mjs} +10 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-BZJFjhuC.mjs → google-BfapkS_K.mjs} +8 -11
- package/dist/google-interactions-DW3iXzjc.mjs +574 -0
- package/dist/{google-messages-DB7GKkDk.mjs → google-messages-CtjVtVot.mjs} +35 -71
- package/dist/{google-shared-Bok4I6zB.mjs → google-shared-Y2YfotEu.mjs} +43 -47
- package/dist/{google-vertex-3eVNR2qW.mjs → google-vertex-Dov4kBWu.mjs} +16 -30
- package/dist/{host-yTvBrYM2.mjs → host-CHi3X87F.mjs} +29 -188
- package/dist/{host-policy-DZO3oPPk.mjs → host-policy-BOAwRg_M.mjs} +2 -14
- package/dist/{host-DH-Z-LDb.d.mts → host-rxlNaBwm.d.mts} +9 -3
- package/dist/{index-C25RT6bP.d.mts → index-D6KsSE74.d.mts} +28 -8
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +6 -6
- package/dist/internal/anthropic.d.mts +8 -7
- package/dist/internal/anthropic.mjs +5 -5
- 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-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +31 -8
- package/dist/internal/openai.mjs +13 -13
- package/dist/internal/runtime.d.mts +31 -70
- package/dist/internal/runtime.mjs +10 -65
- package/dist/internal/shared.d.mts +14 -12
- package/dist/internal/shared.mjs +5 -4
- package/dist/internal/tool-schema.d.mts +1 -1
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-C_13dVBn.mjs → mistral-RS6mboC-.mjs} +46 -93
- package/dist/{openai-chatgpt-responses-sTxPl4zM.mjs → openai-chatgpt-responses-CYbidtrn.mjs} +26 -30
- package/dist/{openai-completions-BO6D_hrB.mjs → openai-completions-D14ihPYk.mjs} +14 -12
- package/dist/{openai-completions-compat-CUollwl6.mjs → openai-completions-compat-BOVWBZDn.mjs} +3 -5
- package/dist/{openai-completions-compat-DfJG1wSO.d.mts → openai-completions-compat-qJjmqQ71.d.mts} +3 -3
- package/dist/{openai-completions-stream-BpuJ0ZOA.mjs → openai-completions-stream-CDCuw3DP.mjs} +101 -173
- package/dist/{openai-prompt-cache-C4RHdN4n.d.mts → openai-prompt-cache-CouErLh7.d.mts} +2 -2
- package/dist/{openai-prompt-cache-CjV_2IRI.mjs → openai-prompt-cache-D2V7MqR7.mjs} +1 -1
- package/dist/{openai-provider-client-BP8J1aeg.mjs → openai-provider-client-CwfsGBbA.mjs} +2 -2
- package/dist/{openai-reasoning-effort-ash8dPrd.mjs → openai-reasoning-effort-ConhwkeX.mjs} +2 -1
- package/dist/{openai-responses-BJ_IEoMU.mjs → openai-responses-CKCBEc2W.mjs} +12 -11
- package/dist/openai-responses-compaction-replay-DiYn-gFM.d.mts +12 -0
- package/dist/{openai-responses-compaction-window-BiNCT0bS.mjs → openai-responses-compaction-window-UNK1GDpy.mjs} +5 -5
- package/dist/{openai-responses-contracts-DWrfMODE.mjs → openai-responses-contracts-CLxnqS9p.mjs} +1 -1
- package/dist/{openai-responses-contracts-B1ENJFpI.d.mts → openai-responses-contracts-D1iZ0njF.d.mts} +4 -4
- package/dist/{openai-responses-prompt-observer-internal-DPHWgbBH.mjs → openai-responses-prompt-observer-internal-iAqLb4tk.mjs} +12 -12
- package/dist/{openai-responses-request-lifecycle-DFuyO1pQ.mjs → openai-responses-request-lifecycle-Fsag-IGZ.mjs} +1 -1
- package/dist/{openai-responses-shared-DvSqtJ6_.mjs → openai-responses-shared-DL4ulQn7.mjs} +312 -122
- package/dist/{openai-responses-terminal-usage-BNFbvY9f.d.mts → openai-responses-terminal-usage-BE7lf7nW.d.mts} +2 -2
- package/dist/{openai-stop-reason-Drnn_6Qj.mjs → openai-stop-reason-8s70vDXj.mjs} +2 -12
- package/dist/{openai-tool-schema-ynZBgqW-.d.mts → openai-tool-schema-a5ysBBga.d.mts} +0 -6
- package/dist/{openai-tool-schema-D4BMcj2D.mjs → openai-tool-schema-vsl-cE-n.mjs} +243 -383
- package/dist/{openai-transport-params-DZKOTSfH.mjs → openai-transport-params-BwlpzX-2.mjs} +60 -105
- package/dist/{positive-integer-BiUxrd71.mjs → positive-integer-CjN5OJbH.mjs} +1 -1
- package/dist/{provider-error-CRhW7lkJ.mjs → provider-error-CwT_j2v0.mjs} +43 -4
- package/dist/{provider-options-DZYq53lj.d.mts → provider-options-Df7ov0K1.d.mts} +2 -2
- package/dist/{provider-replay-context-DPr3w20a.mjs → provider-replay-context-DsyI5jOP.mjs} +1 -1
- package/dist/{provider-transcript-transform-BTocjCRs.mjs → provider-transcript-transform-JbFbHV8h.mjs} +17 -2
- package/dist/{provider-transport-turn-state-lrXEFkYr.mjs → provider-transport-turn-state-BheUi_hl.mjs} +1 -1
- package/dist/{provider-types-w1rEqrGP.d.mts → provider-types-d4XnoZMd.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +15 -11
- package/dist/{reasoning-tag-text-partitioner-Di38crhI.mjs → reasoning-tag-text-partitioner-B6FIIBt6.mjs} +47 -71
- package/dist/{record-coerce-DwRYMj3t.mjs → record-coerce-CNDovvft.mjs} +1 -1
- package/dist/simple-options-CGAkCwtM.mjs +349 -0
- package/dist/{src-DwGYYyZp.mjs → src-H4aXcFuX.mjs} +43 -25
- package/dist/{stream-CREqxHgU.mjs → stream-DDsCBgd-.mjs} +1 -7
- package/dist/{stream-first-event-timeout-BeptfRL6.mjs → stream-first-event-timeout-B9o0S4SZ.mjs} +1 -1
- package/dist/{tool-schema-json-projection-CD9c_fK8.mjs → tool-schema-json-projection-Ct8SeBeJ.mjs} +63 -23
- package/dist/{transport-stream-shared-B5RioB_Q.mjs → transport-stream-shared-Dh5qKJ8e.mjs} +62 -28
- package/dist/{transport-stream-shared-B7Z9oCYg.d.mts → transport-stream-shared-yYhXa4kX.d.mts} +12 -6
- package/dist/{transport-utils-03Qi0CN2.mjs → transport-utils-C-4bf2Ok.mjs} +3 -4
- package/dist/transports.d.mts +36 -32
- package/dist/transports.mjs +160 -216
- package/dist/types-CB-_vNyI.d.mts +1 -0
- package/dist/{types-qZFbaDbK.d.mts → types-CLLR3eB4.d.mts} +3 -1
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +4 -4
- package/dist/{validation-Dw7cb6BV.mjs → validation-BFZc40Ig.mjs} +80 -54
- package/dist/{validation-DhQhmt6t.d.mts → validation-Cat2wQsc.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/assistant-output-DM1JBNs1.mjs +0 -16
- package/dist/event-stream-C0nsgbj2.d.mts +0 -1
- package/dist/simple-options-np1XPuhm.mjs +0 -175
- package/dist/types-DTvddOfm.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { o as isRecord, r as asOptionalObjectRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
+
import { C as applyProviderReportedUsageCost, S as headersToRecord, T as clampThinkingLevel, n as getAiTransportHost, w as calculateCost } from "./host-CHi3X87F.mjs";
|
|
1
3
|
import { a as normalizeOptionalString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as projectRuntimeToolInputSchema, t as prepareRuntimeToolInputSchema } from "./tool-schema-json-projection-CD9c_fK8.mjs";
|
|
10
|
-
import { p as notifyProviderHttpResponse, v as transportAbortError } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
4
|
+
import { a as normalizeOpenAIReasoningEffort, c as resolveOpenAIReasoningEffortMapping, f as MODEL_CATALOG_THINKING_LEVELS, m as resolveOpenAIThinkingApi, o as resolveOpenAIModelReasoningEfforts, s as resolveOpenAIReasoningEffortForModel, u as supportsOpenAIReasoningEffort } from "./openai-reasoning-effort-ConhwkeX.mjs";
|
|
5
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-D2V7MqR7.mjs";
|
|
6
|
+
import { i as isCodeModeModelVisibleToolName } from "./transport-utils-C-4bf2Ok.mjs";
|
|
7
|
+
import { i as resolveOpenAICompletionsCompat, o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-BOVWBZDn.mjs";
|
|
8
|
+
import { n as resolveModelRequestTimeoutMs } from "./host-policy-BOAwRg_M.mjs";
|
|
9
|
+
import { m as notifyProviderHttpResponse } from "./transport-stream-shared-Dh5qKJ8e.mjs";
|
|
10
|
+
import { n as projectRuntimeToolInputSchema, t as prepareRuntimeToolInputSchema } from "./tool-schema-json-projection-Ct8SeBeJ.mjs";
|
|
11
11
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Bcunsn4I.mjs";
|
|
12
|
-
import { a as resolveOpenAIProjectedToolsStrictToolFlag, t as findOpenAIStrictToolProjectionDiagnostics } from "./openai-tool-schema-
|
|
13
|
-
import { i as OPENAI_RESPONSES_APIS } from "./openai-responses-contracts-
|
|
12
|
+
import { a as resolveOpenAIProjectedToolsStrictToolFlag, t as findOpenAIStrictToolProjectionDiagnostics } from "./openai-tool-schema-vsl-cE-n.mjs";
|
|
13
|
+
import { i as OPENAI_RESPONSES_APIS } from "./openai-responses-contracts-CLxnqS9p.mjs";
|
|
14
14
|
import { hash } from "node:crypto";
|
|
15
15
|
//#region packages/normalization-core/src/node-crypto.ts
|
|
16
16
|
function sha256Hex(input) {
|
|
@@ -28,9 +28,7 @@ function redactIdentifier(value, opts) {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region packages/ai/src/transports/openai-transport-shared.ts
|
|
31
|
-
/** Shared options, usage shape, cache identity,
|
|
32
|
-
const MODEL_STREAM_COOPERATIVE_YIELD_INTERVAL_MS = 12;
|
|
33
|
-
const MODEL_STREAM_COOPERATIVE_YIELD_MAX_EVENTS = 64;
|
|
31
|
+
/** Shared options, usage shape, cache identity, and ordering for OpenAI APIs. */
|
|
34
32
|
const OPENAI_RESPONSE_MODEL_HEADER_NAMES = /* @__PURE__ */ new Set(["openai-model", "x-openai-model"]);
|
|
35
33
|
const OPENAI_RESPONSE_MODEL_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
36
34
|
"response.created",
|
|
@@ -243,9 +241,6 @@ function createOpenAIProviderAcceptanceHook(options, response, model) {
|
|
|
243
241
|
model
|
|
244
242
|
});
|
|
245
243
|
}
|
|
246
|
-
function throwIfModelStreamAborted(signal) {
|
|
247
|
-
if (signal?.aborted) throw transportAbortError(signal);
|
|
248
|
-
}
|
|
249
244
|
/** Measure one UTF-8 append without double-counting a surrogate pair split across chunks. */
|
|
250
245
|
function measureUtf8AppendBytes(bufferEndsWithHighSurrogate, chunk) {
|
|
251
246
|
let bytes = Buffer.byteLength(chunk, "utf8");
|
|
@@ -261,21 +256,6 @@ function measureUtf8AppendBytes(bufferEndsWithHighSurrogate, chunk) {
|
|
|
261
256
|
endsWithHighSurrogate: finalCodeUnit >= 55296 && finalCodeUnit <= 56319
|
|
262
257
|
};
|
|
263
258
|
}
|
|
264
|
-
function createModelStreamCooperativeScheduler(signal) {
|
|
265
|
-
let lastYieldedAt = Date.now();
|
|
266
|
-
let eventsSinceYield = 0;
|
|
267
|
-
return { async afterEvent() {
|
|
268
|
-
throwIfModelStreamAborted(signal);
|
|
269
|
-
eventsSinceYield += 1;
|
|
270
|
-
if (eventsSinceYield < MODEL_STREAM_COOPERATIVE_YIELD_MAX_EVENTS && Date.now() - lastYieldedAt < MODEL_STREAM_COOPERATIVE_YIELD_INTERVAL_MS) return;
|
|
271
|
-
eventsSinceYield = 0;
|
|
272
|
-
await new Promise((resolve) => {
|
|
273
|
-
setTimeout(resolve, 0);
|
|
274
|
-
});
|
|
275
|
-
throwIfModelStreamAborted(signal);
|
|
276
|
-
lastYieldedAt = Date.now();
|
|
277
|
-
} };
|
|
278
|
-
}
|
|
279
259
|
function resolvePromptCacheKey(options, cacheRetention) {
|
|
280
260
|
if (cacheRetention === "none") return;
|
|
281
261
|
return clampOpenAIPromptCacheKey(options?.promptCacheKey ?? options?.sessionId);
|
|
@@ -477,102 +457,78 @@ function projectOpenAIToolDescriptors(tools, schemas) {
|
|
|
477
457
|
diagnostics
|
|
478
458
|
};
|
|
479
459
|
}
|
|
480
|
-
function
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
/** Keeps Responses tool choices aligned with surviving function schemas. */
|
|
484
|
-
function reconcileOpenAIResponsesToolChoice(choice, projection) {
|
|
460
|
+
function reconcileToolChoice(choice, projection, responses) {
|
|
461
|
+
const label = responses ? "OpenAI Responses" : "OpenAI Chat Completions";
|
|
485
462
|
if (choice === "auto") return projection.tools.length > 0 ? choice : void 0;
|
|
486
463
|
if (choice === "required") {
|
|
487
|
-
if (projection.tools.length === 0) throw new Error(
|
|
464
|
+
if (projection.tools.length === 0) throw new Error(`${label} tool_choice requires a tool, but no tools survived schema conversion`);
|
|
488
465
|
return choice;
|
|
489
466
|
}
|
|
490
467
|
if (choice === "none" || !isRecord(choice)) return choice;
|
|
491
468
|
const choiceType = choice.type;
|
|
469
|
+
if (!responses && choiceType === "custom") throw new Error("OpenAI Chat Completions custom tool_choice is unsupported because this adapter emits function tools only");
|
|
492
470
|
if (choiceType === "function") {
|
|
493
|
-
const
|
|
471
|
+
const functionChoice = responses ? choice : choice.function;
|
|
472
|
+
const functionName = isRecord(functionChoice) ? functionChoice.name : void 0;
|
|
494
473
|
if (typeof functionName !== "string") return choice;
|
|
495
|
-
|
|
496
|
-
return {
|
|
474
|
+
if (!projection.tools.some((tool) => tool.name === functionName)) throw new Error(`${label} tool_choice requested unavailable tool "${functionName}" after schema conversion`);
|
|
475
|
+
return responses ? {
|
|
497
476
|
type: "function",
|
|
498
477
|
name: functionName
|
|
478
|
+
} : {
|
|
479
|
+
type: "function",
|
|
480
|
+
function: { name: functionName }
|
|
499
481
|
};
|
|
500
482
|
}
|
|
501
483
|
if (choiceType !== "allowed_tools") return choice;
|
|
502
|
-
const
|
|
503
|
-
|
|
484
|
+
const allowedConfig = responses ? choice : choice.allowed_tools;
|
|
485
|
+
if (!isRecord(allowedConfig)) return choice;
|
|
486
|
+
const { mode, tools } = allowedConfig;
|
|
504
487
|
if (mode !== "auto" && mode !== "required" || !Array.isArray(tools)) return choice;
|
|
505
|
-
const
|
|
488
|
+
const responseTools = [];
|
|
489
|
+
const completionTools = [];
|
|
506
490
|
for (const tool of tools) {
|
|
507
491
|
if (!isRecord(tool) || tool.type !== "function") {
|
|
508
|
-
|
|
492
|
+
if (responses) responseTools.push(tool);
|
|
509
493
|
continue;
|
|
510
494
|
}
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
495
|
+
const functionChoice = responses ? tool : tool.function;
|
|
496
|
+
const functionName = isRecord(functionChoice) ? functionChoice.name : void 0;
|
|
497
|
+
if (typeof functionName === "string" && projection.tools.some((projectedTool) => projectedTool.name === functionName)) {
|
|
498
|
+
if (responses) responseTools.push({
|
|
499
|
+
type: "function",
|
|
500
|
+
name: functionName
|
|
501
|
+
});
|
|
502
|
+
else completionTools.push({
|
|
503
|
+
type: "function",
|
|
504
|
+
function: { name: functionName }
|
|
505
|
+
});
|
|
506
|
+
}
|
|
516
507
|
}
|
|
517
|
-
if (
|
|
508
|
+
if (responseTools.length === 0 && completionTools.length === 0) {
|
|
518
509
|
if (mode === "auto") return "none";
|
|
519
|
-
throw new Error(
|
|
510
|
+
throw new Error(`${label} tool_choice requires a tool, but no allowed tools survived schema conversion`);
|
|
520
511
|
}
|
|
521
|
-
return {
|
|
512
|
+
return responses ? {
|
|
522
513
|
type: "allowed_tools",
|
|
523
514
|
mode,
|
|
524
|
-
tools:
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
/** Keeps Chat Completions tool choices aligned with surviving function schemas. */
|
|
528
|
-
function reconcileOpenAICompletionsToolChoice(choice, projection) {
|
|
529
|
-
if (choice === "auto") return projection.tools.length > 0 ? choice : void 0;
|
|
530
|
-
if (choice === "required") {
|
|
531
|
-
if (projection.tools.length === 0) throw new Error("OpenAI Chat Completions tool_choice requires a tool, but no tools survived schema conversion");
|
|
532
|
-
return choice;
|
|
533
|
-
}
|
|
534
|
-
if (choice === "none" || !isRecord(choice)) return choice;
|
|
535
|
-
const choiceType = choice.type;
|
|
536
|
-
if (choiceType === "custom") throw new Error("OpenAI Chat Completions custom tool_choice is unsupported because this adapter emits function tools only");
|
|
537
|
-
if (choiceType === "function") {
|
|
538
|
-
const functionChoice = choice.function;
|
|
539
|
-
if (!isRecord(functionChoice)) return choice;
|
|
540
|
-
const functionName = functionChoice.name;
|
|
541
|
-
if (typeof functionName !== "string") return choice;
|
|
542
|
-
requireProjectedFunction(functionName, projection, "OpenAI Chat Completions tool_choice");
|
|
543
|
-
return {
|
|
544
|
-
type: "function",
|
|
545
|
-
function: { name: functionName }
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
if (choiceType !== "allowed_tools") return choice;
|
|
549
|
-
const allowedConfig = choice.allowed_tools;
|
|
550
|
-
if (!isRecord(allowedConfig)) return choice;
|
|
551
|
-
const mode = allowedConfig.mode;
|
|
552
|
-
const tools = allowedConfig.tools;
|
|
553
|
-
if (mode !== "auto" && mode !== "required" || !Array.isArray(tools)) return choice;
|
|
554
|
-
const normalizedAllowedTools = [];
|
|
555
|
-
for (const tool of tools) {
|
|
556
|
-
if (!isRecord(tool) || tool.type !== "function") continue;
|
|
557
|
-
const functionChoice = tool.function;
|
|
558
|
-
const functionName = isRecord(functionChoice) ? functionChoice.name : void 0;
|
|
559
|
-
if (typeof functionName === "string" && projection.tools.some((projectedTool) => projectedTool.name === functionName)) normalizedAllowedTools.push({
|
|
560
|
-
type: "function",
|
|
561
|
-
function: { name: functionName }
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (normalizedAllowedTools.length === 0) {
|
|
565
|
-
if (mode === "auto") return "none";
|
|
566
|
-
throw new Error("OpenAI Chat Completions tool_choice requires a tool, but no allowed tools survived schema conversion");
|
|
567
|
-
}
|
|
568
|
-
return {
|
|
515
|
+
tools: responseTools
|
|
516
|
+
} : {
|
|
569
517
|
type: "allowed_tools",
|
|
570
518
|
allowed_tools: {
|
|
571
519
|
mode,
|
|
572
|
-
tools:
|
|
520
|
+
tools: completionTools
|
|
573
521
|
}
|
|
574
522
|
};
|
|
575
523
|
}
|
|
524
|
+
/** Keeps Responses tool choices aligned with surviving function schemas. */
|
|
525
|
+
function reconcileOpenAIResponsesToolChoice(choice, projection) {
|
|
526
|
+
return reconcileToolChoice(choice, projection, true);
|
|
527
|
+
}
|
|
528
|
+
/** Keeps Chat Completions tool choices aligned with surviving function schemas. */
|
|
529
|
+
function reconcileOpenAICompletionsToolChoice(choice, projection) {
|
|
530
|
+
return reconcileToolChoice(choice, projection, false);
|
|
531
|
+
}
|
|
576
532
|
//#endregion
|
|
577
533
|
//#region packages/ai/src/transports/openai-transport-params.ts
|
|
578
534
|
const MAX_OPENAI_STRICT_TOOL_DOWNGRADE_DIAGNOSTIC_KEYS = 256;
|
|
@@ -733,16 +689,15 @@ function buildOpenAIClientHeaders(model, context, optionHeaders, turnHeaders, se
|
|
|
733
689
|
...optionHeaders,
|
|
734
690
|
...turnHeaders
|
|
735
691
|
};
|
|
736
|
-
const resolvedHeaders =
|
|
692
|
+
const resolvedHeaders = getAiTransportHost().resolveProviderRequestHeaders({
|
|
737
693
|
provider: model.provider,
|
|
738
694
|
api: model.api,
|
|
739
695
|
baseUrl: model.baseUrl,
|
|
740
|
-
capability: "llm",
|
|
741
|
-
transport: "stream",
|
|
742
696
|
providerHeaders,
|
|
743
697
|
callerHeaders: Object.keys(callerHeaders).length > 0 ? callerHeaders : void 0,
|
|
744
|
-
precedence: "caller-wins"
|
|
745
|
-
|
|
698
|
+
precedence: "caller-wins",
|
|
699
|
+
model
|
|
700
|
+
}) ?? {};
|
|
746
701
|
const sendSessionIdHeader = (OPENAI_RESPONSES_APIS.has(model.api) && model.compat && "sendSessionIdHeader" in model.compat ? model.compat?.sendSessionIdHeader : void 0) ?? usesNativeOpenAICodexResponsesBackend(model);
|
|
747
702
|
if (sessionId && cacheRetention !== "none" && sendSessionIdHeader && !Object.keys(resolvedHeaders).some((key) => normalizeLowercaseStringOrEmpty(key) === "session_id")) resolvedHeaders.session_id = clampOpenAIPromptCacheKey(sessionId) ?? sessionId;
|
|
748
703
|
return resolveOpencodeSessionHeaders(model, {
|
|
@@ -782,4 +737,4 @@ function getCompat(model) {
|
|
|
782
737
|
};
|
|
783
738
|
}
|
|
784
739
|
//#endregion
|
|
785
|
-
export {
|
|
740
|
+
export { redactIdentifier as A, log as C, readOpenAICompletionsReasoningBatch as D, readOpenAICompletionsContentDeltas as E, resolveOpenAIClientBaseUrl as O, isOpenAICompletionsThinkingEnabled as S, parseOpenAICompletionsUsage as T, resolveOpenAIReasoningEffortMap as _, enforceCodeModeResponsesToolSurface as a, createOpenAIResponseHook as b, readCodeModePayloadToolName as c, prepareOpenAITools as d, projectOpenAITools as f, resolveOpenAISimpleReasoningEffort as g, resolveOpenAIRequestReasoning as h, buildOpenAISdkRequestOptions as i, sha256Hex as j, resolvePromptCacheKey as k, resolveCodeModeResponsesVisibleToolNames as l, reconcileOpenAIResponsesToolChoice as m, buildOpenAIClientHeaders as n, filterCodeModePayloadTools as o, reconcileOpenAICompletionsToolChoice as p, buildOpenAISdkClientOptions as r, getCompat as s, assertCodeModeResponsesToolSurface as t, resolveOpenAIStrictToolFlagWithDiagnostics as u, GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP as v, measureUtf8AppendBytes as w, createResponseModelTracker as x, createOpenAIProviderAcceptanceHook as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as parseStrictPositiveInteger } from "./base64-
|
|
1
|
+
import { o as parseStrictPositiveInteger } from "./base64-C1PsYcRQ.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/positive-integer.ts
|
|
3
3
|
function parsePositiveInteger(value) {
|
|
4
4
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { i as asOptionalRecord } from "./record-coerce-CNDovvft.mjs";
|
|
1
2
|
import { o as normalizeStringifiedOptionalString } from "./string-coerce-fsri9iCu.mjs";
|
|
2
|
-
import { i as asOptionalRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
3
|
-
import { t as truncateUtf16Safe } from "./utf16-slice-CvGodqok.mjs";
|
|
4
3
|
import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
|
|
5
|
-
import { n as estimateBase64DecodedBytes } from "./base64-
|
|
4
|
+
import { n as estimateBase64DecodedBytes } from "./base64-C1PsYcRQ.mjs";
|
|
6
5
|
import { parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
|
|
7
6
|
//#region packages/normalization-core/src/balanced-json.ts
|
|
8
7
|
function isJsonOpeningDelimiter(char, openers) {
|
|
@@ -191,6 +190,34 @@ function compareStableStrings(left, right) {
|
|
|
191
190
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
192
191
|
}
|
|
193
192
|
//#endregion
|
|
193
|
+
//#region packages/normalization-core/src/utf16-slice.ts
|
|
194
|
+
function isHighSurrogate(codeUnit) {
|
|
195
|
+
return codeUnit >= 55296 && codeUnit <= 56319;
|
|
196
|
+
}
|
|
197
|
+
function isLowSurrogate(codeUnit) {
|
|
198
|
+
return codeUnit >= 56320 && codeUnit <= 57343;
|
|
199
|
+
}
|
|
200
|
+
/** Slices a UTF-16 string without returning dangling surrogate halves at either edge. */
|
|
201
|
+
function sliceUtf16Safe(input, start, end) {
|
|
202
|
+
const len = input.length;
|
|
203
|
+
let from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
|
204
|
+
let to = end === void 0 ? len : end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
|
205
|
+
if (to <= from) return "";
|
|
206
|
+
if (from > 0 && from < len) {
|
|
207
|
+
if (isLowSurrogate(input.charCodeAt(from)) && isHighSurrogate(input.charCodeAt(from - 1))) from += 1;
|
|
208
|
+
}
|
|
209
|
+
if (to > 0 && to < len) {
|
|
210
|
+
if (isHighSurrogate(input.charCodeAt(to - 1)) && isLowSurrogate(input.charCodeAt(to))) to -= 1;
|
|
211
|
+
}
|
|
212
|
+
return input.slice(from, to);
|
|
213
|
+
}
|
|
214
|
+
/** Truncates a UTF-16 string without cutting a surrogate pair in half. */
|
|
215
|
+
function truncateUtf16Safe(input, maxLen) {
|
|
216
|
+
const limit = Math.max(0, Math.floor(maxLen));
|
|
217
|
+
if (input.length <= limit) return input;
|
|
218
|
+
return sliceUtf16Safe(input, 0, limit);
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
194
221
|
//#region packages/ai/src/utils/credential-redaction.ts
|
|
195
222
|
const NON_CREDENTIAL_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
196
223
|
"passwordfile",
|
|
@@ -227,6 +254,9 @@ const LOOSE_QUOTED_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|prov
|
|
|
227
254
|
const LOOSE_CREDENTIAL_PAIR_RE = /\b((?!(?:api|endpoint|method|model|provider|status|type)=)[A-Za-z][A-Za-z0-9_.-]{0,64})=([A-Za-z0-9+/._~%=-]{16,})(?=[;&#'"\s]|$)/giu;
|
|
228
255
|
const MEDIA_DATA_URL_RE = /data:(?:audio|image|video)\/[a-z0-9.+-]+(?:;[^,;\s]+)*;base64,[ \t]*(?:\r?\n[ \t]*)?[a-z0-9+/_=-]+(?:[ \t]*\r?\n[ \t]*[a-z0-9+/_=-]+)*/giu;
|
|
229
256
|
const MAX_DIAGNOSTIC_JSON_LENGTH = 16384;
|
|
257
|
+
const UNCHANGED_DIAGNOSTIC_TEXT_MAX_ENTRIES = 2048;
|
|
258
|
+
const UNCHANGED_DIAGNOSTIC_TEXT_MAX_LENGTH = 2048;
|
|
259
|
+
const unchangedDiagnosticText = /* @__PURE__ */ new Set();
|
|
230
260
|
const BRACKET_PROSE_PATTERN = String.raw`(\[+)([A-Za-z][A-Za-z0-9 _.-]*|\s*\d+\s+(?!(?:true|false|null)(?![\w-]))[A-Za-z][A-Za-z0-9 _.=-]*)(\]+)`;
|
|
231
261
|
const BRACKET_PROSE_RE = new RegExp(`^${BRACKET_PROSE_PATTERN}$`, "u");
|
|
232
262
|
const BRACKET_PROSE_PART_RE = new RegExp(String.raw`(?<!\[)${BRACKET_PROSE_PATTERN}`, "gu");
|
|
@@ -386,6 +416,15 @@ function projectDiagnosticValue(value, policy = {}, seen = /* @__PURE__ */ new W
|
|
|
386
416
|
}
|
|
387
417
|
/** Redacts bounded structured JSON while preserving harmless diagnostic text byte-for-byte. */
|
|
388
418
|
function redactDiagnosticText(value) {
|
|
419
|
+
if (unchangedDiagnosticText.has(value)) return value;
|
|
420
|
+
const projected = projectDiagnosticText(value);
|
|
421
|
+
if (projected === value && value.length <= UNCHANGED_DIAGNOSTIC_TEXT_MAX_LENGTH) {
|
|
422
|
+
if (unchangedDiagnosticText.size >= UNCHANGED_DIAGNOSTIC_TEXT_MAX_ENTRIES) unchangedDiagnosticText.clear();
|
|
423
|
+
unchangedDiagnosticText.add(value);
|
|
424
|
+
}
|
|
425
|
+
return projected;
|
|
426
|
+
}
|
|
427
|
+
function projectDiagnosticText(value) {
|
|
389
428
|
const text = redactCredentialText(value).replace(MEDIA_DATA_URL_RE, "<redacted>");
|
|
390
429
|
if (!looksLikeDiagnosticJson(text)) return text;
|
|
391
430
|
const allowProse = !hasSensitiveProseContent(text);
|
|
@@ -501,4 +540,4 @@ function projectProviderError(error, signal) {
|
|
|
501
540
|
}
|
|
502
541
|
}
|
|
503
542
|
//#endregion
|
|
504
|
-
export { redactDiagnosticText as a, projectDiagnosticValue as i, projectProviderError as n,
|
|
543
|
+
export { redactDiagnosticText as a, projectDiagnosticValue as i, projectProviderError as n, truncateUtf16Safe as o, createDiagnosticRecord as r, stableStringify as s, configureProviderErrorRedactor as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Y as StreamOptions } from "./types-
|
|
1
|
+
import { Y as StreamOptions } from "./types-CLLR3eB4.mjs";
|
|
2
2
|
import { t as OpenAICompletionsToolChoice } from "./openai-tool-projection-793cE3QX.mjs";
|
|
3
|
-
import "./types-
|
|
3
|
+
import "./types-CB-_vNyI.mjs";
|
|
4
4
|
import Anthropic from "@anthropic-ai/sdk";
|
|
5
5
|
//#region packages/ai/src/providers/openai-reasoning-effort.d.ts
|
|
6
6
|
declare const ENABLED_REASONING_EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as shortHash } from "./transport-stream-shared-Dh5qKJ8e.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/provider-replay-context.ts
|
|
3
3
|
function hashReplayContextValue(value) {
|
|
4
4
|
const normalized = value?.trim();
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import { i as transformMessages } from "./host-
|
|
1
|
+
import { i as transformMessages } from "./host-CHi3X87F.mjs";
|
|
2
|
+
import { a as createEmptyTransportUsage } from "./transport-stream-shared-Dh5qKJ8e.mjs";
|
|
3
|
+
//#region packages/ai/src/transports/assistant-output.ts
|
|
4
|
+
function createAssistantOutput(model, api = model.api) {
|
|
5
|
+
return {
|
|
6
|
+
role: "assistant",
|
|
7
|
+
content: [],
|
|
8
|
+
api,
|
|
9
|
+
provider: model.provider,
|
|
10
|
+
model: model.id,
|
|
11
|
+
usage: createEmptyTransportUsage(),
|
|
12
|
+
stopReason: "stop",
|
|
13
|
+
timestamp: Date.now()
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
2
17
|
//#region packages/ai/src/provider-transcript-transform.ts
|
|
3
18
|
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
19
|
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
@@ -29,4 +44,4 @@ function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
|
29
44
|
}), target, normalizeToolCallId);
|
|
30
45
|
}
|
|
31
46
|
//#endregion
|
|
32
|
-
export { transformProviderMessages as t };
|
|
47
|
+
export { createAssistantOutput as n, transformProviderMessages as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getAiTransportHost } from "./host-
|
|
1
|
+
import { n as getAiTransportHost } from "./host-CHi3X87F.mjs";
|
|
2
2
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-Bcunsn4I.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region packages/ai/src/transports/provider-transport-turn-state.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as index_d_exports } from "./index-
|
|
2
|
-
import { O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, f as ImageContent, it as ToolResultMessage, n as Api, s as AssistantMessageEventStreamContract, st as UserMessage } from "./types-
|
|
3
|
-
import "./types-
|
|
1
|
+
import { t as index_d_exports } from "./index-D6KsSE74.mjs";
|
|
2
|
+
import { O as Model, X as TextContent, Y as StreamOptions, a as AssistantMessage, d as Context, f as ImageContent, it as ToolResultMessage, n as Api, s as AssistantMessageEventStreamContract, st as UserMessage } from "./types-CLLR3eB4.mjs";
|
|
3
|
+
import "./types-CB-_vNyI.mjs";
|
|
4
4
|
//#region packages/ai/src/provider-types.d.ts
|
|
5
5
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
6
|
type VideoContent = Omit<ImageContent, "type"> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as supportsClaudeFastMode, S as
|
|
2
|
-
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-
|
|
3
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
4
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
5
|
-
import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-
|
|
6
|
-
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RawModelCostConfig, type RawPricingTier, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type isProviderRefusalAssistantError, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
|
|
1
|
+
import { C as resolveClaudeSonnet5ModelIdentity, D as supportsClaudeNativeMaxEffort, E as supportsClaudeFastMode, O as supportsClaudeNativeXhighEffort, S as resolveClaudeSonnet55ModelIdentity, T as supportsClaudeAdaptiveThinking, _ as resolveClaudeModelIdentity, a as ProviderRefusalReview, b as resolveClaudeOpus55ModelIdentity, c as CLAUDE_OPUS_55_THINKING_PROFILE, d as CLAUDE_SONNET_5_THINKING_PROFILE, f as bindsClaudeThinkingPrefix, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, i as normalizeResolvedPricing, l as CLAUDE_OPUS_5_THINKING_PROFILE, m as requiresClaudeDefaultSampling, n as calculateUsageCost, o as readProviderRefusalReview, p as requiresClaudeBetweenToolsThinking, r as normalizeModelCostConfig, s as CLAUDE_FABLE_5_THINKING_PROFILE, u as CLAUDE_SONNET_55_THINKING_PROFILE, v as resolveClaudeMythos5ModelIdentity, w as supportsClaude1MContext, x as resolveClaudeOpus5ModelIdentity, y as resolveClaudeNativeThinkingLevelMap } from "./index-D6KsSE74.mjs";
|
|
2
|
+
import { $ as ThinkingContent, A as ModelCostRates, B as ProviderReplayState, C as KnownImagesApi, E as MaybePromise, F as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, G as SimpleStreamOptions, I as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, K as StopReason, L as PricingTier, M as OpenAICompletionsCompat, N as OpenAIResponsesCompat, P as OpenRouterRouting, Q as ThinkingBudgets, R as Provider, S as KnownApi, T as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, U as RawModelCostConfig, V as ProviderResponse, W as RawPricingTier, X as TextContent, Y as StreamOptions, Z as TextSignatureV1, _ as ImagesModel, a as AssistantMessage, at as Transport, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as ValidateToolArgumentsFn, dt as DiagnosticErrorInfo, et as ThinkingLevel, f as ImageContent, ft as appendAssistantMessageDiagnostic, g as ImagesInputContent, gt as isProviderRefusalAssistantError, h as ImagesFunction, ht as formatThrownValue, i as AssistantImages, it as ToolResultMessage, j as ModelThinkingLevel, k as ModelCostConfig, l as CacheRetention, lt as VercelGatewayRouting, m as ImagesContext, mt as extractDiagnosticError, n as Api, nt as Tool, o as AssistantMessageEvent, ot as Usage, p as ImagesApi, pt as createAssistantMessageDiagnostic, q as StreamFn, r as AssistantDeliveryTtsFacts, rt as ToolCall, s as AssistantMessageEventStreamContract, st as UserMessage, t as AnthropicMessagesCompat, tt as ThinkingLevelMap, u as CompleteSimpleFn, ut as AssistantMessageDiagnostic, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderImagesOptions } from "./types-CLLR3eB4.mjs";
|
|
3
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-DOPFYVqs.mjs";
|
|
4
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-Cat2wQsc.mjs";
|
|
5
|
+
import { a as ProviderContextHandoff, c as ProviderStreamFunction, d as VideoContent, f as resolveProviderContext, i as ProviderContext, l as ProviderStreamOptions, n as ModelInputContent, o as ProviderMessage, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderModel, t as MediaContent, u as ProviderUserMessage } from "./provider-types-d4XnoZMd.mjs";
|
|
6
|
+
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RawModelCostConfig, type RawPricingTier, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type extractDiagnosticError, type formatThrownValue, type isProviderRefusalAssistantError, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type validateToolArguments, type validateToolCall };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ApiRegistry } from "./api-registry-
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-D-nbmSqr.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CouErLh7.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
4
4
|
/** Source id used for built-in API provider registrations. */
|
|
5
5
|
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import { n as projectProviderError } from "./provider-error-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-CwT_j2v0.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-D2V7MqR7.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
5
5
|
/** Source id used for built-in API provider registrations. */
|
|
6
6
|
const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
@@ -62,35 +62,39 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const registerBuiltIns = [
|
|
65
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
65
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-Cw2pgccz.mjs").then((n) => n.t), (module) => ({
|
|
66
66
|
stream: module.streamAnthropic,
|
|
67
67
|
streamSimple: module.streamSimpleAnthropic
|
|
68
68
|
})),
|
|
69
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
69
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-D14ihPYk.mjs").then((n) => n.t), (module) => ({
|
|
70
70
|
stream: module.streamOpenAICompletions,
|
|
71
71
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
72
72
|
})),
|
|
73
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
73
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-RS6mboC-.mjs"), (module) => ({
|
|
74
74
|
stream: module.streamMistral,
|
|
75
75
|
streamSimple: module.streamSimpleMistral
|
|
76
76
|
})),
|
|
77
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
77
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-CKCBEc2W.mjs").then((n) => n.t), (module) => ({
|
|
78
78
|
stream: module.streamOpenAIResponses,
|
|
79
79
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
80
80
|
})),
|
|
81
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
81
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-BwT3-X8P.mjs"), (module) => ({
|
|
82
82
|
stream: module.streamAzureOpenAIResponses,
|
|
83
83
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
84
84
|
})),
|
|
85
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
85
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-CYbidtrn.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamOpenAICodexResponses,
|
|
87
87
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
88
88
|
})),
|
|
89
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
89
|
+
createLazyRegistration("google-generative-ai", () => import("./google-BfapkS_K.mjs"), (module) => ({
|
|
90
90
|
stream: module.streamGoogle,
|
|
91
91
|
streamSimple: module.streamSimpleGoogle
|
|
92
92
|
})),
|
|
93
|
-
createLazyRegistration("google-
|
|
93
|
+
createLazyRegistration("google-interactions", () => import("./google-interactions-DW3iXzjc.mjs"), (module) => ({
|
|
94
|
+
stream: module.streamGoogleInteractions,
|
|
95
|
+
streamSimple: module.streamSimpleGoogleInteractions
|
|
96
|
+
})),
|
|
97
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-Dov4kBWu.mjs"), (module) => ({
|
|
94
98
|
stream: module.streamGoogleVertex,
|
|
95
99
|
streamSimple: module.streamSimpleGoogleVertex
|
|
96
100
|
}))
|