@openclaw/ai 2026.11.5 → 2026.11.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/{anthropic-CNEzO12C.mjs → anthropic-CBz5v2U3.mjs} +16 -15
- package/dist/{anthropic-payload-policy-DVk38bnY.d.mts → anthropic-payload-policy-BTrHSS_v.d.mts} +4 -8
- package/dist/{anthropic-stream-lifecycle-DJUtasDB.mjs → anthropic-stream-lifecycle-96vq-4V9.mjs} +154 -88
- package/dist/{anthropic-tool-projection-DcvsDiyX.mjs → anthropic-tool-projection-A9GceDnD.mjs} +4 -5
- package/dist/{anthropic-tool-projection-DKAlondV.d.mts → anthropic-tool-projection-DCOX8qai.d.mts} +1 -3
- package/dist/{api-registry-DY2MLUyg.d.mts → api-registry-DUEK-a3o.d.mts} +2 -4
- package/dist/{assistant-message-events-CHMJgbhs.mjs → assistant-message-events-DtSjIQmB.mjs} +1 -2
- package/dist/{assistant-output-C3czmoN4.mjs → assistant-output-kYOaiso5.mjs} +2 -3
- package/dist/{azure-openai-responses-client-compat-D0dvJMbZ.mjs → azure-deployment-map-hwDQc3uL.mjs} +2 -16
- package/dist/{azure-openai-responses-DRkduRmW.mjs → azure-openai-responses-CZheDTt_.mjs} +12 -12
- package/dist/azure-openai-responses-client-compat-DLsS6V6z.mjs +13 -0
- package/dist/{base64-C8CdcsjU.mjs → base64-FdymvxN9.mjs} +1 -2
- package/dist/cloudflare-BCLfDuew.mjs +15 -0
- package/dist/{credential-redaction-DrgndwTJ.d.mts → credential-redaction-BNv5SWQz.d.mts} +0 -2
- package/dist/{deferred-event-buffer-tIGkTkTm.mjs → deferred-event-buffer-BgT1IIfq.mjs} +1 -2
- package/dist/{diagnostics-CloVGQiK.mjs → diagnostics-BNlb1zlT.mjs} +12 -19
- package/dist/{diagnostics-o1PrVNQb.mjs → diagnostics-DP1SXgAW.mjs} +1 -2
- package/dist/diagnostics.d.mts +6 -10
- package/dist/diagnostics.mjs +3 -3
- package/dist/{env-api-keys-BuHc86ya.mjs → env-api-keys-DlUbTgKq.mjs} +1 -2
- package/dist/{event-stream-BYmtRe8-.d.mts → event-stream-BJS9Q8G_.d.mts} +1 -3
- package/dist/{event-stream-X2gmsUWv.mjs → event-stream-Bf6cK7-d.mjs} +1 -2
- package/dist/event-stream-CPiqa8PI.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{expect-lbe3Hgrh.mjs → expect-DqyhV9d8.mjs} +1 -2
- package/dist/github-copilot-headers-CqLRrd-i.mjs +22 -0
- package/dist/{github-copilot-request-facts-BZ_EMo7X.mjs → github-copilot-request-facts-BxuLEdNF.mjs} +2 -3
- package/dist/{google-DqG05iBa.mjs → google-BUgkXPYL.mjs} +6 -7
- package/dist/{google-interactions-BE7cxFPc.mjs → google-interactions-84f0xFly.mjs} +36 -25
- package/dist/{google-messages-p2iBzsAp.mjs → google-messages-Dip5zphv.mjs} +16 -20
- package/dist/{google-provider-stream-DZ6tqteU.mjs → google-provider-stream-COaKMdQv.mjs} +14 -15
- package/dist/{google-shared-BMYt1xSI.mjs → google-shared-Dooy5JJL.mjs} +11 -14
- package/dist/{google-vertex-CAq2q1Ln.mjs → google-vertex--S8AlXUD.mjs} +4 -5
- package/dist/{google-video-slots-Bxt-OXO8.mjs → google-video-slots-CzdrKzrO.mjs} +2 -3
- package/dist/{host-DqX-64Pb.mjs → host-Cf7zb-48.mjs} +73 -89
- package/dist/{host-ccbwPC3A.d.mts → host-Dgpzj407.d.mts} +3 -5
- package/dist/{host-policy-Bk85E9ue.mjs → host-policy-B1qzS7Xe.mjs} +2 -3
- package/dist/{index-Bczt0MnO.d.mts → index-BDF5kurq.d.mts} +10 -10
- package/dist/index.d.mts +8 -10
- package/dist/index.mjs +11 -11
- package/dist/internal/anthropic.d.mts +10 -21
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.d.mts +1 -3
- package/dist/internal/google-model-family.mjs +2 -3
- package/dist/internal/google.d.mts +3 -5
- package/dist/internal/google.mjs +1 -1
- package/dist/internal/model-request-body.d.mts +5 -5
- package/dist/internal/model-request-body.mjs +19 -6
- package/dist/internal/openai-completions-compat.d.mts +1 -3
- package/dist/internal/openai-completions-compat.mjs +2 -2
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -4
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +10 -32
- package/dist/internal/openai.mjs +12 -11
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +0 -4
- package/dist/internal/reasoning-tag-text-partitioner.mjs +64 -125
- package/dist/internal/retry-after.d.mts +1 -1
- package/dist/internal/retry-after.mjs +1 -2
- package/dist/internal/runtime.d.mts +9 -43
- package/dist/internal/runtime.mjs +14 -15
- package/dist/internal/session-resources.d.mts +11 -0
- package/dist/{session-resources-vKvGIE3J.mjs → internal/session-resources.mjs} +2 -3
- package/dist/internal/shared.d.mts +17 -26
- package/dist/internal/shared.mjs +10 -10
- package/dist/internal/tool-schema.d.mts +2 -22
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{llm-request-activity-DzaHoRAU.mjs → llm-request-activity-v1liRqNt.mjs} +1 -2
- package/dist/{mistral-DIGInqJI.mjs → mistral-BAps5cN2.mjs} +713 -299
- package/dist/{model-transport-url-BdksnBqu.d.mts → model-transport-url-Dad-sfx2.d.mts} +0 -4
- package/dist/{number-coercion-C7HsBgUL.mjs → number-coercion-BO6bhGm6.mjs} +2 -3
- package/dist/{observe-async-iterator-DgmegcZR.mjs → observe-async-iterator-DdOlbgrr.mjs} +1 -2
- package/dist/{observe-async-iterator-AlARO5wS.d.mts → observe-async-iterator-DeB_Vxes.d.mts} +14 -7
- package/dist/openai-BtJTmLWF.mjs +21460 -0
- package/dist/{openai-chatgpt-jwt-KWcgd0d_.mjs → openai-chatgpt-jwt-v5F5jJmX.mjs} +1 -2
- package/dist/{openai-chatgpt-responses-C6rEZcsZ.mjs → openai-chatgpt-responses-CYXMKG89.mjs} +53 -49
- package/dist/{openai-completions-B93R3N3b.mjs → openai-completions-Bi4Ghg3V.mjs} +6 -7
- package/dist/{openai-completions-compat-CJ-NsDzg.d.mts → openai-completions-compat-BJBQ682M.d.mts} +10 -5
- package/dist/{openai-completions-compat-CS3dlDBR.mjs → openai-completions-compat-DZLGotNt.mjs} +19 -16
- package/dist/{openai-completions-reasoning-replay-BwT1xwRI.mjs → openai-completions-reasoning-replay-DyH5XzNo.mjs} +1 -2
- package/dist/{openai-completions-transport-DHTFq-BM.mjs → openai-completions-transport-otONaRhv.mjs} +160 -527
- package/dist/{openai-prompt-cache-BZGaIWYh.d.mts → openai-prompt-cache-C5rwtmA_.d.mts} +2 -4
- package/dist/{openai-prompt-cache-3H_Fz0ya.mjs → openai-prompt-cache-CJv1bvw0.mjs} +3 -5
- package/dist/openai-provider-client-apBsWo9b.mjs +51 -0
- package/dist/{openai-responses-DSxPKV0U.mjs → openai-responses-CiIAm8fJ.mjs} +14 -14
- package/dist/{openai-responses-compaction-replay-DXF5BjD2.d.mts → openai-responses-compaction-replay-CUw4owu9.d.mts} +6 -7
- package/dist/{openai-responses-contracts-Cb1IIRRG.d.mts → openai-responses-contracts-bYtvXSvv.d.mts} +7 -12
- package/dist/{openai-responses-contracts-xU-n9AJJ.mjs → openai-responses-contracts-eppTI5DQ.mjs} +11 -18
- package/dist/{openai-responses-endpoint-CqO3ejTe.mjs → openai-responses-endpoint-AeVu3HmP.mjs} +80 -34
- package/dist/{openai-responses-payload-policy-BsQaD-gD.d.mts → openai-responses-payload-policy-Cihgy9fC.d.mts} +0 -2
- package/dist/{openai-responses-request-lifecycle-C_3FKkl7.mjs → openai-responses-request-lifecycle-DfE4xNHj.mjs} +120 -20
- package/dist/{openai-responses-shared-En3Jf0Vg.mjs → openai-responses-shared-BAJzOqwt.mjs} +1649 -312
- package/dist/{openai-responses-terminal-usage-D7IhRA6i.d.mts → openai-responses-terminal-usage-BYXQTt9u.d.mts} +2 -4
- package/dist/openai-responses-websocket-DywDiO81.mjs +8143 -0
- package/dist/{openai-stop-reason-8s70vDXj.mjs → openai-stop-reason-cA0GUHlU.mjs} +4 -3
- package/dist/{openai-tool-schema-CvxySRyf.mjs → openai-tool-schema-Ca74_fkR.mjs} +17 -26
- package/dist/openai.LICENSE +201 -0
- package/dist/{otel-B2u5HGvm.mjs → otel-C5Cn7IFQ.mjs} +8 -8
- package/dist/{overflow-CpApyjG2.mjs → overflow-CM0yZomw.mjs} +2 -3
- package/dist/{positive-integer-DiqE5vNi.mjs → positive-integer-AM4ltyhP.mjs} +2 -3
- package/dist/{prompt-cache-stability-w-ICeyOI.mjs → prompt-cache-stability-oTx0nIsh.mjs} +3 -4
- package/dist/{prompt-cache-stability-Cwcjv_fx.d.mts → prompt-cache-stability-xNfkD-3g.d.mts} +0 -2
- package/dist/{provider-error-DD-fo4Rz.mjs → provider-error-B7aKA_dg.mjs} +24 -23
- package/dist/{provider-error-CnaWYTRY.d.mts → provider-error-DZMru0Jv.d.mts} +0 -2
- package/dist/{provider-options-BQ2Msop2.d.mts → provider-options-CR_UfgUE.d.mts} +15 -11
- package/dist/{provider-replay-context--QGWotXx.mjs → provider-replay-context-CHJQzB0n.mjs} +3 -4
- package/dist/{provider-transcript-transform-Hr1kCoMX.mjs → provider-transcript-transform-C-WfgiLJ.mjs} +2 -3
- package/dist/{provider-transport-turn-state-DyaOKAYm.mjs → provider-transport-turn-state-BdMA1v46.mjs} +4 -27
- package/dist/{provider-types-B1e98js5.d.mts → provider-types-CfiTmXyw.d.mts} +3 -5
- package/dist/provider-types.d.mts +7 -7
- package/dist/provider-types.mjs +1 -2
- package/dist/providers.d.mts +2 -4
- package/dist/providers.mjs +14 -15
- package/dist/{record-coerce-BQaoiN3r.mjs → record-coerce-BgUo6bj4.mjs} +1 -2
- package/dist/{request-headers-DO4Mqhw1.mjs → request-headers-DJ4QrMC_.mjs} +1 -2
- package/dist/{required-api-key-2zZTkmsi.mjs → required-api-key-BniLGxy4.mjs} +2 -3
- package/dist/{retry-after-DnHBlFS2.d.mts → retry-after-f3ZIm8TA.d.mts} +0 -2
- package/dist/rolldown-runtime-DYf_mQCB.mjs +34 -0
- package/dist/{sanitize-unicode-CRGuMONI.mjs → sanitize-unicode-B3kUqQ-q.mjs} +1 -2
- package/dist/{sanitize-unicode-BISmUlUv.d.mts → sanitize-unicode-DlVtgmsw.d.mts} +2 -6
- package/dist/{session-affinity-DA4WHv1h.mjs → session-affinity-Czm9tjAm.mjs} +1 -2
- package/dist/{simple-options-CQNPKCEb.mjs → simple-options-D8CTqHvk.mjs} +40 -16
- package/dist/src-CNWvILd1.mjs +2 -0
- package/dist/{src-CQ7nH2mL.mjs → src-CmBmaGOV.mjs} +87 -20
- package/dist/{stable-stringify-CchQEmeA.mjs → stable-stringify-CGB-o900.mjs} +10 -8
- package/dist/{stream-DM-q0y5H.mjs → stream-BEE5qy7Z.mjs} +5 -7
- package/dist/{stream-first-event-timeout-B7RcufAV.mjs → stream-first-event-timeout-CWiv_y--.mjs} +2 -3
- package/dist/{streaming-byte-guard-DBXr1XYn.mjs → streaming-byte-guard-gOcUrHJF.mjs} +1 -2
- package/dist/{string-coerce-BCuWMIrk.mjs → string-coerce-CpcyRbc6.mjs} +1 -2
- package/dist/{string-normalization-B8TDDBX_.mjs → string-normalization-CS77PHD3.mjs} +2 -3
- package/dist/{telemetry-DJibfNKZ.mjs → telemetry-Cd4i-clM.mjs} +6 -8
- package/dist/{tool-schema-json-projection-BSHb4gaJ.mjs → tool-schema-json-projection-C13fPskA.mjs} +11 -16
- package/dist/{transport-stream-shared-CBVh6QEc.mjs → transport-stream-shared-DEpLe9fG.mjs} +24 -30
- package/dist/{transport-stream-shared-D3IAU4jn.d.mts → transport-stream-shared-DW4DoJLv.d.mts} +7 -8
- package/dist/{transport-utils-rxOHnq9y.mjs → transport-utils-Cx9L80PZ.mjs} +6 -8
- package/dist/transports.d.mts +29 -82
- package/dist/transports.mjs +39 -38
- package/dist/{types-BVdTf0YV.d.mts → types-BNp71XKW.d.mts} +11 -6
- package/dist/types-CwcLeW-7.d.mts +1 -0
- package/dist/{types-OVEWUaDh.mjs → types-DIBUKaTM.mjs} +1 -2
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +9 -9
- package/dist/{usage-CJH5D6Ea.mjs → usage-B8ggJtuG.mjs} +1 -2
- package/dist/{validation-QmyD0E5A.d.mts → validation-BFNWNeUl.d.mts} +1 -3
- package/dist/{validation-DGXqfvkj.mjs → validation-BO7nCOKO.mjs} +5 -8
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/ws.LICENSE +20 -0
- package/dist/x509-transport-state-D4gFbgWG.mjs +40 -0
- package/package.json +13 -7
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +0 -1
- package/dist/cloudflare-BJ2_Xabx.mjs +0 -39
- package/dist/event-stream-B4ZcSvsu.d.mts +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/src-BUsVkrNt.mjs +0 -105
- package/dist/types-Cb3-5WM9.d.mts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as isRecord } from "./record-coerce-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { o as isRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import { O as shortHash } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
3
|
+
// packages/ai/src/transports/provider-replay-context.ts
|
|
4
4
|
function isProviderReplayContext(value) {
|
|
5
5
|
return isRecord(value) && typeof value.provider === "string" && typeof value.api === "string" && typeof value.model === "string" && (value.baseUrlHash === void 0 || typeof value.baseUrlHash === "string") && (value.sessionHash === void 0 || typeof value.sessionHash === "string") && (value.authProfileHash === void 0 || typeof value.authProfileHash === "string");
|
|
6
6
|
}
|
|
@@ -20,5 +20,4 @@ function buildProviderReplayContext(model, options) {
|
|
|
20
20
|
function providerReplayContextMatches(state, context) {
|
|
21
21
|
return state.provider === context.provider && state.api === context.api && state.baseUrlHash === context.baseUrlHash && state.sessionHash === context.sessionHash;
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { isProviderReplayContext as n, providerReplayContextMatches as r, buildProviderReplayContext as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as transformMessages } from "./host-
|
|
2
|
-
|
|
1
|
+
import { c as transformMessages } from "./host-Cf7zb-48.mjs";
|
|
2
|
+
// packages/ai/src/provider-transcript-transform.ts
|
|
3
3
|
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
4
4
|
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
5
5
|
function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
@@ -28,5 +28,4 @@ function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
|
28
28
|
return Object.isFrozen(message) && Object.isFrozen(content) && result.length === content.length && result.every((block, index) => block === content[index]) ? message : Object.assign({}, message, { content: result });
|
|
29
29
|
}), target, normalizeToolCallId);
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { transformProviderMessages as t };
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
|
-
import { Ft as resolveOpenAIClientBaseUrl, Lt as withOpenAIErrorResponseHook } from "./openai-responses-shared-En3Jf0Vg.mjs";
|
|
1
|
+
import { r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
2
|
+
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-Czm9tjAm.mjs";
|
|
5
3
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
|
|
7
|
-
//#region packages/ai/src/providers/openai-provider-client.ts
|
|
8
|
-
function createOpenAIProviderClient(model, apiKey, headers, optionsHeaders, onResponse) {
|
|
9
|
-
if (optionsHeaders) Object.assign(headers, optionsHeaders);
|
|
10
|
-
const defaultHeaders = model.provider === "cloudflare-ai-gateway" ? {
|
|
11
|
-
...headers,
|
|
12
|
-
Authorization: headers.Authorization ?? null,
|
|
13
|
-
"cf-aig-authorization": `Bearer ${apiKey}`
|
|
14
|
-
} : headers;
|
|
15
|
-
const baseUrl = isCloudflareProvider(model.provider) ? resolveCloudflareBaseUrl(model) : model.baseUrl;
|
|
16
|
-
return new OpenAI({
|
|
17
|
-
apiKey,
|
|
18
|
-
baseURL: resolveOpenAIClientBaseUrl(model, baseUrl),
|
|
19
|
-
dangerouslyAllowBrowser: true,
|
|
20
|
-
defaultHeaders,
|
|
21
|
-
maxRetries: 0,
|
|
22
|
-
fetch: withOpenAIErrorResponseHook(getAiTransportHost().buildModelFetch(model) ?? globalThis.fetch, onResponse, model)
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region packages/ai/src/transports/provider-transport-turn-state.ts
|
|
4
|
+
// packages/ai/src/transports/provider-transport-turn-state.ts
|
|
27
5
|
function resolveProviderTransportTurnState(model, params) {
|
|
28
6
|
const normalizedProvider = model.provider.trim().toLowerCase();
|
|
29
7
|
const allowRuntimePluginLoad = normalizedProvider === "openai" || normalizedProvider === "azure-openai" || normalizedProvider === "azure-openai-responses";
|
|
@@ -60,5 +38,4 @@ function resolveProviderSimpleCompletionHeaders(model, options) {
|
|
|
60
38
|
...optionHeaders
|
|
61
39
|
};
|
|
62
40
|
}
|
|
63
|
-
|
|
64
|
-
export { createOpenAIProviderClient as i, resolveProviderSimpleCompletionHeaders as n, resolveProviderTransportTurnState as r, filterProviderTurnHeadersForExplicitOpencodeSession as t };
|
|
41
|
+
export { resolveProviderSimpleCompletionHeaders as n, resolveProviderTransportTurnState as r, filterProviderTurnHeadersForExplicitOpencodeSession as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { _t as UserMessage, a as AssistantMessage, at as StreamOptions, d as Context, k as Model, mt as ToolResultMessage, n as Api, ot as TextContent, p as ImageContent, s as AssistantMessageEventStreamContract } from "./types-
|
|
2
|
-
import "./index-
|
|
3
|
-
import "./types-
|
|
4
|
-
//#region packages/ai/src/provider-types.d.ts
|
|
1
|
+
import { _t as UserMessage, a as AssistantMessage, at as StreamOptions, d as Context, k as Model, mt as ToolResultMessage, n as Api, ot as TextContent, p as ImageContent, s as AssistantMessageEventStreamContract } from "./types-BNp71XKW.mjs";
|
|
2
|
+
import "./index-BDF5kurq.mjs";
|
|
3
|
+
import "./types-CwcLeW-7.mjs";
|
|
5
4
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
5
|
declare const PROVIDER_MODEL_INPUT: unique symbol;
|
|
7
6
|
type VideoContent = Omit<ImageContent, "type"> & {
|
|
@@ -27,5 +26,4 @@ type ProviderStreamOptions = StreamOptions & {
|
|
|
27
26
|
type ProviderStreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = ProviderStreamOptions> = (model: ProviderModel<TApi>, context: ProviderContext, options?: TOptions) => AssistantMessageEventStreamContract;
|
|
28
27
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
29
28
|
declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
30
|
-
//#endregion
|
|
31
29
|
export { ProviderContext as a, ProviderModel as c, ProviderUserMessage as d, VideoContent as f, PROVIDER_MODEL_INPUT as i, ProviderStreamFunction as l, ModelInputContent as n, ProviderContextHandoff as o, resolveProviderContext as p, PROVIDER_CONTEXT_HANDOFF as r, ProviderMessage as s, MediaContent as t, ProviderStreamOptions as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { $ as RawPricingTier, A as ModelCostConfig, At as DiagnosticErrorInfo, B as PricingTier, C as KnownApi, Ct as isRuntimeContextMessage, D as MaybePromise, Dt as runtimeContextContentToText, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as readRuntimeContextMetadata, F as OpenAIResponsesCompat, Ft as formatThrownValue, H as ProviderImagesOptions, I as OpenRouterRouting, It as isProviderRefusalAssistantError, J as RUNTIME_CONTEXT_CUSTOM_TYPE, K as REPETITIVE_OUTPUT_ERROR_CODE, L as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Lt as readProviderRefusalReview, M as ModelRequestHeaders, Mt as appendAssistantMessageDiagnostic, N as ModelThinkingLevel, Nt as createAssistantMessageDiagnostic, Ot as setRuntimeContextRetention, P as OpenAICompletionsCompat, Pt as extractDiagnosticError, Q as RawModelCostConfig, R as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Rt as recordSuppressedReasoning, S as ImagesStopReason, St as hasRuntimeContextMarker, T as KnownImagesProvider, Tt as labelRuntimeContextText, U as ProviderReplayState, V as Provider, W as ProviderResponse, X as RUNTIME_CONTEXT_FOOTER, Y as RUNTIME_CONTEXT_END_MARKER, Z as RUNTIME_CONTEXT_HEADER, _ as ImagesInputContent, _t as UserMessage, a as AssistantMessage, at as StreamOptions, b as ImagesOutputContent, bt as escapeRuntimeContextFooter, c as AssistantMessageEventStreamLike, ct as ThinkingBudgets, dt as ThinkingLevelMap, et as RuntimeContextMessage, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Tool, g as ImagesFunction, gt as Usage, h as ImagesContext, ht as Transport, i as AssistantImages, j as ModelCostRates, jt as ProviderRefusalReview, kt as AssistantMessageDiagnostic, l as CacheRetention, lt as ThinkingContent, m as ImagesApi, mt as ToolResultMessage, n as Api, nt as StopReason, o as AssistantMessageEvent, ot as TextContent, p as ImageContent, pt as ToolCall, q as RUNTIME_CONTEXT_BEGIN_MARKER, r as AssistantDeliveryTtsFacts, rt as StreamFn, s as AssistantMessageEventStreamContract, st as TextSignatureV1, t as AnthropicMessagesCompat, tt as SimpleStreamOptions, u as CompleteSimpleFn, ut as ThinkingLevel, v as ImagesModel, vt as ValidateToolArgumentsFn, w as KnownImagesApi, wt as labelRuntimeContextContent, x as ImagesProvider, xt as hasLegacyRuntimeContextEnvelope, y as ImagesOptions, yt as VercelGatewayRouting, z as PreparedSystemPrompt } from "./types-
|
|
3
|
-
import { a as
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-
|
|
7
|
-
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_HAIKU_55_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 DEFAULT_MISSING_TOOL_RESULT_TEXT, 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 ModelRequestHeaders, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PreparedSystemPrompt, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type REPETITIVE_OUTPUT_ERROR_CODE, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, 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 appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type observeAsyncIterator, type omitNullRequestHeaders, type readProviderRefusalReview, type readRuntimeContextMetadata, type recordSuppressedReasoning, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type validateToolArguments, type validateToolCall };
|
|
1
|
+
import { A as usesClaude5RequestContract, C as supportsClaude1MContext, D as supportsClaudeNativeMaxEffort, E as supportsClaudeInHistorySystemMessages, O as supportsClaudeNativeXhighEffort, S as resolveClaudeSonnet5ModelIdentity, T as supportsClaudeFastMode, _ as resolveClaudeMythos5ModelIdentity, a as CLAUDE_OPUS_5_THINKING_PROFILE, b as resolveClaudeOpus5ModelIdentity, c as bindsClaudeThinkingPrefix, d as requiresClaudeBetweenToolsThinking, f as requiresClaudeDefaultSampling, g as resolveClaudeModelIdentity, h as resolveClaudeHaiku55ModelIdentity, i as CLAUDE_OPUS_55_THINKING_PROFILE, k as supportsClaudeServerCompaction, l as isReleasedAdaptiveClaudeGeneration, m as resolveClaudeFable5ModelIdentity, n as CLAUDE_FABLE_5_THINKING_PROFILE, o as CLAUDE_SONNET_55_THINKING_PROFILE, p as requiresClaudeMandatoryAdaptiveThinking, r as CLAUDE_HAIKU_55_THINKING_PROFILE, s as CLAUDE_SONNET_5_THINKING_PROFILE, t as observeAsyncIterator, u as rejectsClaudeAssistantPrefill, v as resolveClaudeNativeThinkingLevelMap, w as supportsClaudeAdaptiveThinking, x as resolveClaudeSonnet55ModelIdentity, y as resolveClaudeOpus55ModelIdentity } from "./observe-async-iterator-DeB_Vxes.mjs";
|
|
2
|
+
import { $ as RawPricingTier, A as ModelCostConfig, At as DiagnosticErrorInfo, B as PricingTier, C as KnownApi, Ct as isRuntimeContextMessage, D as MaybePromise, Dt as runtimeContextContentToText, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as readRuntimeContextMetadata, F as OpenAIResponsesCompat, Ft as formatThrownValue, H as ProviderImagesOptions, I as OpenRouterRouting, It as isProviderRefusalAssistantError, J as RUNTIME_CONTEXT_CUSTOM_TYPE, K as REPETITIVE_OUTPUT_ERROR_CODE, L as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Lt as readProviderRefusalReview, M as ModelRequestHeaders, Mt as appendAssistantMessageDiagnostic, N as ModelThinkingLevel, Nt as createAssistantMessageDiagnostic, Ot as setRuntimeContextRetention, P as OpenAICompletionsCompat, Pt as extractDiagnosticError, Q as RawModelCostConfig, R as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, Rt as recordSuppressedReasoning, S as ImagesStopReason, St as hasRuntimeContextMarker, T as KnownImagesProvider, Tt as labelRuntimeContextText, U as ProviderReplayState, V as Provider, W as ProviderResponse, X as RUNTIME_CONTEXT_FOOTER, Y as RUNTIME_CONTEXT_END_MARKER, Z as RUNTIME_CONTEXT_HEADER, _ as ImagesInputContent, _t as UserMessage, a as AssistantMessage, at as StreamOptions, b as ImagesOutputContent, bt as escapeRuntimeContextFooter, c as AssistantMessageEventStreamLike, ct as ThinkingBudgets, dt as ThinkingLevelMap, et as RuntimeContextMessage, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Tool, g as ImagesFunction, gt as Usage, h as ImagesContext, ht as Transport, i as AssistantImages, j as ModelCostRates, jt as ProviderRefusalReview, kt as AssistantMessageDiagnostic, l as CacheRetention, lt as ThinkingContent, m as ImagesApi, mt as ToolResultMessage, n as Api, nt as StopReason, o as AssistantMessageEvent, ot as TextContent, p as ImageContent, pt as ToolCall, q as RUNTIME_CONTEXT_BEGIN_MARKER, r as AssistantDeliveryTtsFacts, rt as StreamFn, s as AssistantMessageEventStreamContract, st as TextSignatureV1, t as AnthropicMessagesCompat, tt as SimpleStreamOptions, u as CompleteSimpleFn, ut as ThinkingLevel, v as ImagesModel, vt as ValidateToolArgumentsFn, w as KnownImagesApi, wt as labelRuntimeContextContent, x as ImagesProvider, xt as hasLegacyRuntimeContextEnvelope, y as ImagesOptions, yt as VercelGatewayRouting, z as PreparedSystemPrompt } from "./types-BNp71XKW.mjs";
|
|
3
|
+
import { a as extractEmbeddingUsage, i as calculateUsageCost, n as appendTextDeltaToAssistantMessage, o as normalizeModelCostConfig, r as EmbeddingUsage, s as normalizeResolvedPricing, t as omitNullRequestHeaders } from "./index-BDF5kurq.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BJS9Q8G_.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-BFNWNeUl.mjs";
|
|
6
|
+
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-CfiTmXyw.mjs";
|
|
7
|
+
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_HAIKU_55_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 DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EmbeddingUsage, 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 ModelRequestHeaders, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PreparedSystemPrompt, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type REPETITIVE_OUTPUT_ERROR_CODE, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, 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 appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type extractEmbeddingUsage, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isReleasedAdaptiveClaudeGeneration, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type observeAsyncIterator, type omitNullRequestHeaders, type readProviderRefusalReview, type readRuntimeContextMetadata, type recordSuppressedReasoning, type rejectsClaudeAssistantPrefill, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type usesClaude5RequestContract, type validateToolArguments, type validateToolCall };
|
package/dist/provider-types.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/provider-types.ts
|
|
2
2
|
const PROVIDER_CONTEXT_HANDOFF = Symbol("providerContextHandoff");
|
|
3
3
|
const PROVIDER_MODEL_INPUT = Symbol("providerModelInput");
|
|
4
4
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
5
5
|
async function resolveProviderContext(context, options) {
|
|
6
6
|
return options?.[PROVIDER_CONTEXT_HANDOFF]?.() ?? context;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { PROVIDER_CONTEXT_HANDOFF, PROVIDER_MODEL_INPUT, resolveProviderContext };
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
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-
|
|
3
|
-
//#region packages/ai/src/providers/register-builtins.d.ts
|
|
1
|
+
import { n as ApiRegistry } from "./api-registry-DUEK-a3o.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-C5rwtmA_.mjs";
|
|
4
3
|
/** Source id used for built-in API provider registrations. */
|
|
5
4
|
export declare const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
6
5
|
/** Registers every built-in API provider in one runtime registry. */
|
|
7
6
|
export declare function registerBuiltInApiProviders(registry: ApiRegistry): void;
|
|
8
7
|
/** Restores the built-in provider registry state for tests. */
|
|
9
8
|
export declare function resetApiProviders(registry: ApiRegistry): void;
|
|
10
|
-
//#endregion
|
|
11
9
|
export { OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey };
|
package/dist/providers.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
4
|
-
import { t as createZeroUsage } from "./usage-
|
|
5
|
-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-Bf6cK7-d.mjs";
|
|
2
|
+
import { n as projectProviderError } from "./provider-error-B7aKA_dg.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-CJv1bvw0.mjs";
|
|
4
|
+
import { t as createZeroUsage } from "./usage-B8ggJtuG.mjs";
|
|
5
|
+
// packages/ai/src/providers/register-builtins.ts
|
|
6
6
|
/** Source id used for built-in API provider registrations. */
|
|
7
7
|
const BUILT_IN_API_PROVIDER_SOURCE_ID = "core:built-in";
|
|
8
8
|
function createLazyStream(load, select) {
|
|
@@ -47,39 +47,39 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
const registerBuiltIns = [
|
|
50
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
50
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-CBz5v2U3.mjs").then((n) => n.t), (module) => ({
|
|
51
51
|
stream: module.streamAnthropic,
|
|
52
52
|
streamSimple: module.streamSimpleAnthropic
|
|
53
53
|
})),
|
|
54
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
54
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-Bi4Ghg3V.mjs").then((n) => n.t), (module) => ({
|
|
55
55
|
stream: module.streamOpenAICompletions,
|
|
56
56
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
57
57
|
})),
|
|
58
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
58
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-BAps5cN2.mjs").then((n) => n.t), (module) => ({
|
|
59
59
|
stream: module.streamMistral,
|
|
60
60
|
streamSimple: module.streamSimpleMistral
|
|
61
61
|
})),
|
|
62
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
62
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-CiIAm8fJ.mjs").then((n) => n.t), (module) => ({
|
|
63
63
|
stream: module.streamOpenAIResponses,
|
|
64
64
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
65
65
|
})),
|
|
66
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
66
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-CZheDTt_.mjs"), (module) => ({
|
|
67
67
|
stream: module.streamAzureOpenAIResponses,
|
|
68
68
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
69
69
|
})),
|
|
70
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
70
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-CYXMKG89.mjs"), (module) => ({
|
|
71
71
|
stream: module.streamOpenAICodexResponses,
|
|
72
72
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
73
73
|
})),
|
|
74
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
74
|
+
createLazyRegistration("google-generative-ai", () => import("./google-BUgkXPYL.mjs"), (module) => ({
|
|
75
75
|
stream: module.streamGoogle,
|
|
76
76
|
streamSimple: module.streamSimpleGoogle
|
|
77
77
|
})),
|
|
78
|
-
createLazyRegistration("google-interactions", () => import("./google-interactions-
|
|
78
|
+
createLazyRegistration("google-interactions", () => import("./google-interactions-84f0xFly.mjs"), (module) => ({
|
|
79
79
|
stream: module.streamGoogleInteractions,
|
|
80
80
|
streamSimple: module.streamSimpleGoogleInteractions
|
|
81
81
|
})),
|
|
82
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex
|
|
82
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex--S8AlXUD.mjs"), (module) => ({
|
|
83
83
|
stream: module.streamGoogleVertex,
|
|
84
84
|
streamSimple: module.streamSimpleGoogleVertex
|
|
85
85
|
}))
|
|
@@ -93,5 +93,4 @@ function resetApiProviders(registry) {
|
|
|
93
93
|
registry.unregisterApiProviders(BUILT_IN_API_PROVIDER_SOURCE_ID);
|
|
94
94
|
registerBuiltInApiProviders(registry);
|
|
95
95
|
}
|
|
96
|
-
//#endregion
|
|
97
96
|
export { BUILT_IN_API_PROVIDER_SOURCE_ID, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, clampOpenAIPromptCacheKey, registerBuiltInApiProviders, resetApiProviders };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/normalization-core/src/record-coerce.ts
|
|
2
2
|
/** Type guard for non-array object records at browser-safe boundaries. */
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -31,5 +31,4 @@ function asNullableRecord(value) {
|
|
|
31
31
|
function asOptionalObjectRecord(value) {
|
|
32
32
|
return value && typeof value === "object" ? value : void 0;
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { asRecord as a, readStringField as c, asOptionalRecord as i, asNullableRecord as n, isRecord as o, asOptionalObjectRecord as r, isStringArray as s, asNonArrayRecord as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/llm-core/src/utils/request-headers.ts
|
|
2
2
|
/** Materialize merged overrides for HTTP clients that cannot consume SDK deletion sentinels. */
|
|
3
3
|
function omitNullRequestHeaders(headers) {
|
|
4
4
|
if (!headers) return;
|
|
@@ -6,5 +6,4 @@ function omitNullRequestHeaders(headers) {
|
|
|
6
6
|
for (const [name, value] of Object.entries(headers)) if (value !== null) result[name] = value;
|
|
7
7
|
return result;
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { omitNullRequestHeaders as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
2
|
-
|
|
1
|
+
import { n as getEnvApiKey } from "./env-api-keys-DlUbTgKq.mjs";
|
|
2
|
+
// packages/ai/src/utils/required-api-key.ts
|
|
3
3
|
function requireApiKey(provider, apiKey) {
|
|
4
4
|
const resolved = apiKey || getEnvApiKey(provider);
|
|
5
5
|
if (!resolved) throw new Error(`No API key for provider: ${provider}`);
|
|
6
6
|
return resolved;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { requireApiKey as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region packages/ai/src/internal/retry-after.d.ts
|
|
2
1
|
type HttpDateInstant = {
|
|
3
2
|
timestampMs: number;
|
|
4
3
|
leapSecond: boolean;
|
|
@@ -41,5 +40,4 @@ declare function resolveProviderErrorRetrySeconds(error: unknown, nowMs?: number
|
|
|
41
40
|
declare function parseRetryAfterHttpDateMs(value: string, nowMs?: number): number | undefined;
|
|
42
41
|
/** Parse all three HTTP-date forms while retaining leap-second ordering. */
|
|
43
42
|
declare function parseHttpDateInstant(value: string, nowMs?: number): HttpDateInstant | undefined;
|
|
44
|
-
//#endregion
|
|
45
43
|
export { parseHttpDateInstant as a, parseRetryAfterHeadersSeconds as c, parseRetryAfterTextSeconds as d, resolveProviderErrorRetrySeconds as f, parseGoogleRetryDelaySeconds as i, parseRetryAfterHeadersTiming as l, RetryAfterTiming as n, parseRetryAfterErrorSeconds as o, hasExplicitRetryText as r, parseRetryAfterErrorTiming as s, RETRY_AFTER_TEXT_RE as t, parseRetryAfterHttpDateMs as u };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/utils/sanitize-unicode.ts
|
|
2
2
|
/** Remove unpaired surrogates rejected by providers; preserve valid Unicode pairs. */
|
|
3
3
|
function sanitizeSurrogates(text) {
|
|
4
4
|
if (text.isWellFormed()) return text;
|
|
5
5
|
return text.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { sanitizeSurrogates as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as AssistantMessage } from "./types-
|
|
2
|
-
import "./types-
|
|
3
|
-
//#region packages/ai/src/utils/overflow.d.ts
|
|
1
|
+
import { a as AssistantMessage } from "./types-BNp71XKW.mjs";
|
|
2
|
+
import "./types-CwcLeW-7.mjs";
|
|
4
3
|
declare const CONTEXT_OVERFLOW_PATTERN_SCOPES: {
|
|
5
4
|
readonly "assistant-error": RegExp[];
|
|
6
5
|
readonly "failover-explicit": RegExp[];
|
|
@@ -19,9 +18,6 @@ declare function matchesContextOverflowMessage(errorMessage: string, scope: Cont
|
|
|
19
18
|
* a length stop remains undetectable because the original token count is unknown.
|
|
20
19
|
*/
|
|
21
20
|
declare function isContextOverflow(message: AssistantMessage, contextWindow?: number): boolean;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region packages/ai/src/utils/sanitize-unicode.d.ts
|
|
24
21
|
/** Remove unpaired surrogates rejected by providers; preserve valid Unicode pairs. */
|
|
25
22
|
declare function sanitizeSurrogates(text: string): string;
|
|
26
|
-
//#endregion
|
|
27
23
|
export { isContextOverflow as n, matchesContextOverflowMessage as r, sanitizeSurrogates as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/transports/session-affinity.ts
|
|
2
2
|
function isOpencodeEndpoint(baseUrl) {
|
|
3
3
|
const url = URL.parse(baseUrl);
|
|
4
4
|
return url?.protocol === "https:" && url.hostname.replace(/\.$/, "") === "opencode.ai";
|
|
@@ -15,5 +15,4 @@ function resolveOpencodeSessionHeaders(model, options) {
|
|
|
15
15
|
function hasOpencodeSessionHeader(model, options) {
|
|
16
16
|
return [model.headers, options?.headers].some((headers) => Object.keys(headers ?? {}).some((name) => name.toLowerCase() === "x-opencode-session"));
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { resolveOpencodeSessionHeaders as n, hasOpencodeSessionHeader as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { o as isRecord } from "./record-coerce-
|
|
2
|
-
import {
|
|
3
|
-
import { y as responsesServiceTierObserver } from "./openai-responses-contracts-
|
|
4
|
-
import { c as truncateUtf16Safe } from "./provider-error-
|
|
5
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
6
|
-
import { n as normalizeStructuredPromptSection } from "./prompt-cache-stability-
|
|
7
|
-
import {
|
|
1
|
+
import { o as isRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import { I as hasMediaPayload } from "./host-Cf7zb-48.mjs";
|
|
3
|
+
import { y as responsesServiceTierObserver } from "./openai-responses-contracts-eppTI5DQ.mjs";
|
|
4
|
+
import { c as truncateUtf16Safe } from "./provider-error-B7aKA_dg.mjs";
|
|
5
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-B3kUqQ-q.mjs";
|
|
6
|
+
import { n as normalizeStructuredPromptSection } from "./prompt-cache-stability-oTx0nIsh.mjs";
|
|
7
|
+
import { a as copyProviderAcceptanceObserver } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
8
8
|
import { modelRequestBodyState } from "./internal/model-request-body.mjs";
|
|
9
9
|
import { PROVIDER_CONTEXT_HANDOFF, PROVIDER_MODEL_INPUT } from "./provider-types.mjs";
|
|
10
|
-
|
|
10
|
+
// packages/ai/src/utils/system-prompt-cache-boundary.ts
|
|
11
11
|
const SYSTEM_PROMPT_CACHE_BOUNDARY = "\n<!-- OPENCLAW_CACHE_BOUNDARY -->\n";
|
|
12
12
|
/** Producer-delimited Runtime facts; instructions must remain outside this region. */
|
|
13
13
|
const SYSTEM_PROMPT_RELOCATABLE_BOUNDARY = "\n<!-- OPENCLAW-RELOCATABLE-BOUNDARY -->\n";
|
|
@@ -79,6 +79,23 @@ function splitSystemPromptCacheBoundary(text) {
|
|
|
79
79
|
dynamicSuffix: text.slice(boundaryIndex + 34).trimStart()
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
+
/** Keep the stripped prompt's separator in wire text while marking its stable prefix. */
|
|
83
|
+
function splitSystemPromptCacheBoundaryForWire(text) {
|
|
84
|
+
const split = splitSystemPromptCacheBoundary(text);
|
|
85
|
+
if (!split) return;
|
|
86
|
+
const wireText = text.replaceAll(SYSTEM_PROMPT_CACHE_BOUNDARY, "\n");
|
|
87
|
+
if (!split.stablePrefix) return {
|
|
88
|
+
stablePrefix: "",
|
|
89
|
+
dynamicSuffix: wireText
|
|
90
|
+
};
|
|
91
|
+
return split.dynamicSuffix ? {
|
|
92
|
+
stablePrefix: split.stablePrefix,
|
|
93
|
+
dynamicSuffix: wireText.slice(split.stablePrefix.length)
|
|
94
|
+
} : {
|
|
95
|
+
stablePrefix: wireText,
|
|
96
|
+
dynamicSuffix: ""
|
|
97
|
+
};
|
|
98
|
+
}
|
|
82
99
|
/** Keep explicit cache breakpoints while removing relocation metadata. */
|
|
83
100
|
function stripSystemPromptRelocatableBoundary(text) {
|
|
84
101
|
return text.replaceAll(SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, "\n").replaceAll(SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, "").replaceAll(SYSTEM_PROMPT_RELOCATABLE_BOUNDARY.trim(), "").replaceAll(SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END.trim(), "");
|
|
@@ -92,8 +109,7 @@ function prependSystemPromptAdditionAfterCacheBoundary(params) {
|
|
|
92
109
|
const dynamicSuffix = split.dynamicSuffix ? normalizeStructuredPromptSection(split.dynamicSuffix) : "";
|
|
93
110
|
return `${split.stablePrefix}${SYSTEM_PROMPT_CACHE_BOUNDARY}${systemPromptAddition}${dynamicSuffix ? `\n\n${dynamicSuffix}` : ""}`;
|
|
94
111
|
}
|
|
95
|
-
|
|
96
|
-
//#region packages/ai/src/provider-options.ts
|
|
112
|
+
// packages/ai/src/provider-options.ts
|
|
97
113
|
const measuredRequestPressures = /* @__PURE__ */ new WeakMap();
|
|
98
114
|
/** Request-local pressure admitted by the host's matched provider-usage owner. */
|
|
99
115
|
const measuredRequestPressure = {
|
|
@@ -170,8 +186,18 @@ const preparedRequestSuffix = {
|
|
|
170
186
|
return ids && !ids.has(id) && ids.has(normalized) ? normalized : id;
|
|
171
187
|
}
|
|
172
188
|
};
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
const UNCACHED_SUFFIX_MESSAGE = Symbol("uncachedSuffixMessage");
|
|
190
|
+
/** A side request's own suffix: transports place no prompt-cache checkpoint on or after it. */
|
|
191
|
+
const uncachedSuffixMessage = {
|
|
192
|
+
mark(message) {
|
|
193
|
+
Reflect.set(message, UNCACHED_SUFFIX_MESSAGE, true);
|
|
194
|
+
return message;
|
|
195
|
+
},
|
|
196
|
+
has(message) {
|
|
197
|
+
return Reflect.get(message, UNCACHED_SUFFIX_MESSAGE) === true;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
// packages/ai/src/providers/tool-result-text.ts
|
|
175
201
|
const STRUCTURED_TOOL_RESULT_MAX_CHARS = 8e3;
|
|
176
202
|
const IMAGE_TOOL_RESULT_TYPES = /* @__PURE__ */ new Set([
|
|
177
203
|
"image",
|
|
@@ -296,8 +322,7 @@ function formatToolResultText(params) {
|
|
|
296
322
|
const body = params.text.trim() ? `${params.text}${params.omittedMediaPlaceholder ? `\n${params.omittedMediaPlaceholder}` : ""}` : params.omittedMediaPlaceholder ?? params.mediaPlaceholder ?? "(no tool output)";
|
|
297
323
|
return `${params.isError ? "[tool error] " : ""}${body}`;
|
|
298
324
|
}
|
|
299
|
-
|
|
300
|
-
//#region packages/ai/src/providers/simple-options.ts
|
|
325
|
+
// packages/ai/src/providers/simple-options.ts
|
|
301
326
|
function buildBaseOptions(model, options, apiKey) {
|
|
302
327
|
const firstEventOptions = options;
|
|
303
328
|
const baseOptions = {
|
|
@@ -354,5 +379,4 @@ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLeve
|
|
|
354
379
|
thinkingBudget
|
|
355
380
|
};
|
|
356
381
|
}
|
|
357
|
-
|
|
358
|
-
export { stripSystemPromptCacheBoundary as C, splitSystemPromptRelocatableBoundary as S, createSystemPromptCacheBoundaryStripper as _, describeToolResultMediaPlaceholder as a, prependSystemPromptAdditionAfterCacheBoundary as b, extractToolResultText as c, measuredRequestPressure as d, preparedRequestSuffix as f, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END as g, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY as h, clampReasoning as i, formatToolResultText as l, SYSTEM_PROMPT_CACHE_BOUNDARY as m, buildBaseOptions as n, describeUnsupportedToolResultMedia as o, reasoningTagTextPolicy as p, clampMaxTokensToModel as r, extractToolResultBlockText as s, adjustMaxTokensForThinking as t, codeModeToolSurfaceObserver as u, ensureSystemPromptCacheBoundary as v, stripSystemPromptRelocatableBoundary as w, splitSystemPromptCacheBoundary as x, prepareSystemPrompt as y };
|
|
382
|
+
export { splitSystemPromptCacheBoundaryForWire as C, stripSystemPromptRelocatableBoundary as E, splitSystemPromptCacheBoundary as S, stripSystemPromptCacheBoundary as T, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END as _, describeToolResultMediaPlaceholder as a, prepareSystemPrompt as b, extractToolResultText as c, measuredRequestPressure as d, preparedRequestSuffix as f, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY as g, SYSTEM_PROMPT_CACHE_BOUNDARY as h, clampReasoning as i, formatToolResultText as l, uncachedSuffixMessage as m, buildBaseOptions as n, describeUnsupportedToolResultMedia as o, reasoningTagTextPolicy as p, clampMaxTokensToModel as r, extractToolResultBlockText as s, adjustMaxTokensForThinking as t, codeModeToolSurfaceObserver as u, createSystemPromptCacheBoundaryStripper as v, splitSystemPromptRelocatableBoundary as w, prependSystemPromptAdditionAfterCacheBoundary as x, ensureSystemPromptCacheBoundary as y };
|