@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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { o as createEmptyTransportUsage } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
2
|
+
// packages/ai/src/transports/assistant-output.ts
|
|
3
3
|
function createAssistantOutput(model, api = model.api) {
|
|
4
4
|
return {
|
|
5
5
|
role: "assistant",
|
|
@@ -12,5 +12,4 @@ function createAssistantOutput(model, api = model.api) {
|
|
|
12
12
|
timestamp: Date.now()
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { createAssistantOutput as t };
|
package/dist/{azure-openai-responses-client-compat-D0dvJMbZ.mjs → azure-deployment-map-hwDQc3uL.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/providers/azure-deployment-map.ts
|
|
2
2
|
/** Parses AZURE_OPENAI_DEPLOYMENT_MAP-style model=deployment entries. */
|
|
3
3
|
function parseAzureDeploymentNameMap(value) {
|
|
4
4
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -38,18 +38,4 @@ function resolveAzureDeploymentNameFromMap(params) {
|
|
|
38
38
|
const { exact, folded } = getDeploymentLookup(params.deploymentMap);
|
|
39
39
|
return exact.get(params.modelId) ?? folded.get(params.modelId.toLowerCase()) ?? params.modelId;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
//#region packages/ai/src/providers/azure-openai-responses-client-compat.ts
|
|
43
|
-
function isTraditionalAzureOpenAIHost(hostname) {
|
|
44
|
-
return hostname.endsWith(".openai.azure.com") || hostname.endsWith(".cognitiveservices.azure.com");
|
|
45
|
-
}
|
|
46
|
-
function isOpenAICompatibleAzureResponsesBaseUrl(baseUrl) {
|
|
47
|
-
const url = URL.parse(baseUrl);
|
|
48
|
-
if (!url || isTraditionalAzureOpenAIHost(url.hostname)) return false;
|
|
49
|
-
const hostname = url.hostname.toLowerCase();
|
|
50
|
-
if (!(hostname.endsWith(".services.ai.azure.com") || hostname.endsWith(".api.cognitive.microsoft.com"))) return false;
|
|
51
|
-
const normalizedPath = url.pathname.replace(/\/+$/, "");
|
|
52
|
-
return normalizedPath === "/openai/v1" || normalizedPath.endsWith("/openai/v1");
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { resolveAzureDeploymentNameFromMap as i, isTraditionalAzureOpenAIHost as n, parseAzureDeploymentNameMap as r, isOpenAICompatibleAzureResponsesBaseUrl as t };
|
|
41
|
+
export { resolveAzureDeploymentNameFromMap as n, parseAzureDeploymentNameMap as t };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import { r as getAiTransportHost } from "./host-
|
|
3
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
4
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
5
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as requireApiKey } from "./required-api-key-
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-Bf6cK7-d.mjs";
|
|
2
|
+
import { r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-D8CTqHvk.mjs";
|
|
4
|
+
import { n as getEnvApiKey } from "./env-api-keys-DlUbTgKq.mjs";
|
|
5
|
+
import { t as createAssistantOutput } from "./assistant-output-kYOaiso5.mjs";
|
|
6
|
+
import { Dt as convertProviderResponsesMessages, Mn as withOpenAIErrorResponseHook, jn as resolvePromptCacheKey, pn as resolveOpenAISimpleReasoningEffort, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-BAJzOqwt.mjs";
|
|
7
|
+
import { n as resolveAzureDeploymentNameFromMap } from "./azure-deployment-map-hwDQc3uL.mjs";
|
|
8
|
+
import { t as requireApiKey } from "./required-api-key-BniLGxy4.mjs";
|
|
9
|
+
import { n as isTraditionalAzureOpenAIHost, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-DLsS6V6z.mjs";
|
|
10
|
+
import OpenAI, { t as AzureOpenAI } from "./openai-BtJTmLWF.mjs";
|
|
11
|
+
// packages/ai/src/providers/azure-openai-responses.ts
|
|
11
12
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
12
13
|
const AZURE_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
13
14
|
"openai",
|
|
@@ -64,7 +65,7 @@ const streamAzureOpenAIResponses = (model, context, options) => {
|
|
|
64
65
|
replayMode
|
|
65
66
|
}),
|
|
66
67
|
stream: true,
|
|
67
|
-
prompt_cache_key: resolvePromptCacheKey(options, options?.cacheRetention ?? "short"),
|
|
68
|
+
prompt_cache_key: resolvePromptCacheKey(requestModel.compat?.supportsPromptCacheKey === false ? void 0 : options, options?.cacheRetention ?? "short"),
|
|
68
69
|
store: false
|
|
69
70
|
};
|
|
70
71
|
applyCommonResponsesParams(params, requestModel, context, options);
|
|
@@ -105,5 +106,4 @@ function resolveAzureConfig(model, options) {
|
|
|
105
106
|
apiVersion
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
|
-
//#endregion
|
|
109
109
|
export { streamAzureOpenAIResponses, streamSimpleAzureOpenAIResponses };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/ai/src/providers/azure-openai-responses-client-compat.ts
|
|
2
|
+
function isTraditionalAzureOpenAIHost(hostname) {
|
|
3
|
+
return hostname.endsWith(".openai.azure.com") || hostname.endsWith(".cognitiveservices.azure.com");
|
|
4
|
+
}
|
|
5
|
+
function isOpenAICompatibleAzureResponsesBaseUrl(baseUrl) {
|
|
6
|
+
const url = URL.parse(baseUrl);
|
|
7
|
+
if (!url || isTraditionalAzureOpenAIHost(url.hostname)) return false;
|
|
8
|
+
const hostname = url.hostname.toLowerCase();
|
|
9
|
+
if (!(hostname.endsWith(".services.ai.azure.com") || hostname.endsWith(".api.cognitive.microsoft.com"))) return false;
|
|
10
|
+
const normalizedPath = url.pathname.replace(/\/+$/, "");
|
|
11
|
+
return normalizedPath === "/openai/v1" || normalizedPath.endsWith("/openai/v1");
|
|
12
|
+
}
|
|
13
|
+
export { isTraditionalAzureOpenAIHost as n, isOpenAICompatibleAzureResponsesBaseUrl as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/media-core/src/base64.ts
|
|
2
2
|
/** Estimates decoded bytes without allocating a cleaned copy of the base64 payload. */
|
|
3
3
|
function estimateBase64DecodedBytes(base64) {
|
|
4
4
|
let effectiveLen = base64.length;
|
|
@@ -77,5 +77,4 @@ function inspectBase64(base64, dialect) {
|
|
|
77
77
|
canonicalPadBits: (lastDataValue & padBitMask) === 0
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
export { estimateBase64DecodedBytes as n, canonicalizeBase64 as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// packages/ai/src/providers/cloudflare.ts
|
|
2
|
+
function isCloudflareProvider(provider) {
|
|
3
|
+
return provider === "cloudflare-workers-ai" || provider === "cloudflare-ai-gateway";
|
|
4
|
+
}
|
|
5
|
+
/** Substitute `{VAR}` placeholders in a Cloudflare baseUrl from process.env. */
|
|
6
|
+
function resolveCloudflareBaseUrl(model) {
|
|
7
|
+
const url = model.baseUrl;
|
|
8
|
+
if (!url.includes("{")) return url;
|
|
9
|
+
return url.replace(/\{([A-Z_][A-Z0-9_]*)\}/g, (_match, name) => {
|
|
10
|
+
const value = process.env[name];
|
|
11
|
+
if (!value) throw new Error(`${name} is required for provider ${model.provider} but is not set.`);
|
|
12
|
+
return value;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { resolveCloudflareBaseUrl as n, isCloudflareProvider as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region packages/ai/src/utils/credential-redaction.d.ts
|
|
2
1
|
/** Classifies credential-bearing fields, including case-insensitive HTTP header names. */
|
|
3
2
|
declare function isCredentialFieldName(name: string): boolean;
|
|
4
3
|
type DiagnosticMediaField = {
|
|
@@ -25,5 +24,4 @@ declare function projectDiagnosticValue(value: unknown, policy?: DiagnosticProje
|
|
|
25
24
|
}): unknown;
|
|
26
25
|
/** Internal producers transfer fresh ordinary records and dense arrays; arrays may be reused. */
|
|
27
26
|
declare function projectPreparedDiagnosticValue(value: unknown, policy?: DiagnosticProjectionPolicy): unknown;
|
|
28
|
-
//#endregion
|
|
29
27
|
export { projectPreparedDiagnosticValue as i, isCredentialFieldName as n, projectDiagnosticValue as r, DiagnosticProjectionPolicy as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/utils/deferred-event-buffer.ts
|
|
2
2
|
function createDeferredEventBuffer(sink) {
|
|
3
3
|
let events = [];
|
|
4
4
|
return {
|
|
@@ -14,5 +14,4 @@ function createDeferredEventBuffer(sink) {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { createDeferredEventBuffer as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-
|
|
4
|
-
import { n as asNonNegativeFiniteNumber, t as asFiniteNumber } from "./number-coercion-
|
|
5
|
-
import "./provider-error-
|
|
6
|
-
|
|
1
|
+
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
2
|
+
import { a as isProviderRefusalAssistantError } from "./diagnostics-DP1SXgAW.mjs";
|
|
3
|
+
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-CpcyRbc6.mjs";
|
|
4
|
+
import { n as asNonNegativeFiniteNumber, t as asFiniteNumber } from "./number-coercion-BO6bhGm6.mjs";
|
|
5
|
+
import "./provider-error-B7aKA_dg.mjs";
|
|
6
|
+
// packages/normalization-core/src/error-coercion.ts
|
|
7
7
|
function readProperty(value, key) {
|
|
8
8
|
try {
|
|
9
9
|
return value[key];
|
|
@@ -69,8 +69,7 @@ function collectNestedErrorCandidates(err) {
|
|
|
69
69
|
return nested;
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
//#region packages/normalization-core/src/json-coercion.ts
|
|
72
|
+
// packages/normalization-core/src/json-coercion.ts
|
|
74
73
|
/** Parses JSON without throwing, returning undefined for invalid input. */
|
|
75
74
|
function safeParseJson(value) {
|
|
76
75
|
try {
|
|
@@ -83,8 +82,7 @@ function safeParseJson(value) {
|
|
|
83
82
|
function safeParseJsonRecord(value) {
|
|
84
83
|
return /^[\t\n\r ]*\{/.test(value) ? asOptionalRecord(safeParseJson(value)) : void 0;
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
//#region packages/ai/src/providers/openai-responses-terminal-usage.ts
|
|
85
|
+
// packages/ai/src/providers/openai-responses-terminal-usage.ts
|
|
88
86
|
/**
|
|
89
87
|
* Canonical mapping for terminal OpenAI Responses events.
|
|
90
88
|
*
|
|
@@ -175,8 +173,7 @@ function resolveResponsesTerminalStopReason(params) {
|
|
|
175
173
|
if (stopReason === "stop" && params.hasToolCall) return { stopReason: "toolUse" };
|
|
176
174
|
return { stopReason };
|
|
177
175
|
}
|
|
178
|
-
|
|
179
|
-
//#region packages/ai/src/transports/openai-responses-stream-errors.ts
|
|
176
|
+
// packages/ai/src/transports/openai-responses-stream-errors.ts
|
|
180
177
|
const OUTPUT_IDENTITY_ERROR_CODE = "responses_output_identity_conflict";
|
|
181
178
|
const TOOL_CALL_WHITESPACE = /\s/u;
|
|
182
179
|
var DegenerateToolCallArgumentsError = class extends Error {
|
|
@@ -224,8 +221,7 @@ function resolveResponsesOutputIdentityRetry(message) {
|
|
|
224
221
|
if (message.errorCode !== OUTPUT_IDENTITY_ERROR_CODE) return;
|
|
225
222
|
return message.stopReason === "error" && message.content?.every((block) => block.type === "thinking" || block.type === "text" && block.text.length === 0) === true && safeParseJsonRecord(message.errorBody ?? "")?.retrySafe === true ? "retry" : "stop";
|
|
226
223
|
}
|
|
227
|
-
|
|
228
|
-
//#region packages/ai/src/utils/retryable-network-errors.ts
|
|
224
|
+
// packages/ai/src/utils/retryable-network-errors.ts
|
|
229
225
|
const WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE = "ERR_WEBSOCKET_NON_RETRYABLE_CLOSE";
|
|
230
226
|
const TRANSIENT_NETWORK_CODES = /* @__PURE__ */ new Set([
|
|
231
227
|
"ECONNRESET",
|
|
@@ -295,8 +291,7 @@ function isTransientNetworkError(err) {
|
|
|
295
291
|
}
|
|
296
292
|
return false;
|
|
297
293
|
}
|
|
298
|
-
|
|
299
|
-
//#region packages/ai/src/transports/model-transport-debug.ts
|
|
294
|
+
// packages/ai/src/transports/model-transport-debug.ts
|
|
300
295
|
function isTruthyEnv(value) {
|
|
301
296
|
const normalized = normalizeLowercaseStringOrEmpty(value);
|
|
302
297
|
return normalized.length > 0 && normalized !== "0" && normalized !== "false" && normalized !== "off" && normalized !== "no";
|
|
@@ -331,8 +326,7 @@ function emitModelTransportError(log, label, detail, signal) {
|
|
|
331
326
|
if (aborted) emitModelTransportDebug(log, message);
|
|
332
327
|
else if (log.isEnabled?.("warn") !== false) log.warn(message());
|
|
333
328
|
}
|
|
334
|
-
|
|
335
|
-
//#region packages/ai/src/transports/model-transport-url.ts
|
|
329
|
+
// packages/ai/src/transports/model-transport-url.ts
|
|
336
330
|
/**
|
|
337
331
|
* Debug formatting helpers for model transport endpoints.
|
|
338
332
|
* Keeps logs useful without exposing credentials, request params, or fragments.
|
|
@@ -351,5 +345,4 @@ function formatModelTransportDebugUrl(rawUrl) {
|
|
|
351
345
|
function formatModelTransportDebugBaseUrl(rawUrl) {
|
|
352
346
|
return rawUrl ? formatModelTransportDebugUrl(rawUrl) : "default";
|
|
353
347
|
}
|
|
354
|
-
//#endregion
|
|
355
348
|
export { toErrorObject as S, isResponsesOutputLimitToolCallError as _, resolveModelPayloadDebugMode as a, resolveResponsesTerminalStopReason as b, hasRetryableConnectionErrorCode as c, ResponsesOutputIdentityError as d, countToolCallTrailingWhitespace as f, applyResponsesCacheWritePricing as g, resolveResponsesOutputIdentityRetry as h, emitModelTransportError as i, isTransientNetworkError as l, isResponsesProviderTool as m, formatModelTransportDebugUrl as n, resolveModelSseDebugMode as o, hasOnlyResponsesFunctionTools as p, emitModelTransportDebug as r, WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE as s, formatModelTransportDebugBaseUrl as t, DegenerateToolCallArgumentsError as u, mapResponsesTerminalUsage as v, extractErrorCodeOrErrno as x, readResponsesReasoningTokens as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Guard } from "typebox/guard";
|
|
2
|
-
|
|
2
|
+
// packages/llm-core/src/utils/diagnostics.ts
|
|
3
3
|
const encoder = new TextEncoder();
|
|
4
4
|
function isBoundedText(value, maxBytes) {
|
|
5
5
|
return typeof value === "string" && value.length <= maxBytes && value.trim().length > 0 && encoder.encode(value).byteLength <= maxBytes;
|
|
@@ -60,5 +60,4 @@ function recordSuppressedReasoning(message) {
|
|
|
60
60
|
if (message.stopReason !== "stop" && message.stopReason !== "length" || message.content.some((block) => block.type === "toolCall" || block.type === "text" && block.text.trim())) return;
|
|
61
61
|
return /* @__PURE__ */ new Error(`${message.provider}/${message.model} returned only reasoning while configured reasoning: false. Set reasoning: true for this model in models.providers.${message.provider}.models or choose a non-thinking model.` + (message.stopReason === "length" ? " The output token limit was reached before an answer." : ""));
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { isProviderRefusalAssistantError as a, formatThrownValue as i, createAssistantMessageDiagnostic as n, readProviderRefusalReview as o, extractDiagnosticError as r, recordSuppressedReasoning as s, appendAssistantMessageDiagnostic as t };
|
package/dist/diagnostics.d.mts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { At as DiagnosticErrorInfo, Ft as formatThrownValue, It as isProviderRefusalAssistantError, Lt as readProviderRefusalReview, Mt as appendAssistantMessageDiagnostic, Nt as createAssistantMessageDiagnostic, Pt as extractDiagnosticError, Rt as recordSuppressedReasoning, a as AssistantMessage, jt as ProviderRefusalReview, kt as AssistantMessageDiagnostic } from "./types-
|
|
2
|
-
import "./types-
|
|
3
|
-
import { r as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-
|
|
4
|
-
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-
|
|
5
|
-
import { r as projectDiagnosticValue, t as DiagnosticProjectionPolicy } from "./credential-redaction-
|
|
6
|
-
import { i as emitModelTransportError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-
|
|
7
|
-
//#region packages/ai/src/transports/openai-responses-stream-errors.d.ts
|
|
1
|
+
import { At as DiagnosticErrorInfo, Ft as formatThrownValue, It as isProviderRefusalAssistantError, Lt as readProviderRefusalReview, Mt as appendAssistantMessageDiagnostic, Nt as createAssistantMessageDiagnostic, Pt as extractDiagnosticError, Rt as recordSuppressedReasoning, a as AssistantMessage, jt as ProviderRefusalReview, kt as AssistantMessageDiagnostic } from "./types-BNp71XKW.mjs";
|
|
2
|
+
import "./types-CwcLeW-7.mjs";
|
|
3
|
+
import { r as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-BYXQTt9u.mjs";
|
|
4
|
+
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-DZMru0Jv.mjs";
|
|
5
|
+
import { r as projectDiagnosticValue, t as DiagnosticProjectionPolicy } from "./credential-redaction-BNv5SWQz.mjs";
|
|
6
|
+
import { i as emitModelTransportError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-Dad-sfx2.mjs";
|
|
8
7
|
/** Resume only a response that could not have completed tools or exposed visible output. */
|
|
9
8
|
export declare function resolveResponsesOutputIdentityRetry(message: Pick<AssistantMessage, "errorCode"> & Partial<Pick<AssistantMessage, "stopReason" | "errorBody" | "content">>): "retry" | "stop" | undefined;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region packages/ai/src/utils/retryable-network-errors.d.ts
|
|
12
9
|
export declare const WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE = "ERR_WEBSOCKET_NON_RETRYABLE_CLOSE";
|
|
13
10
|
export declare function hasRetryableConnectionErrorCode(message: string): boolean;
|
|
14
11
|
/** Returns true when any nested error proves a transient network failure. */
|
|
15
12
|
export declare function isTransientNetworkError(err: unknown): boolean;
|
|
16
|
-
//#endregion
|
|
17
13
|
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor, ProviderRefusalReview, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, emitModelTransportError, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, projectDiagnosticValue, readProviderRefusalReview, recordSuppressedReasoning };
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, s as recordSuppressedReasoning, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
2
|
-
import { a as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
3
|
-
import { _ as isResponsesOutputLimitToolCallError, c as hasRetryableConnectionErrorCode, h as resolveResponsesOutputIdentityRetry, i as emitModelTransportError, l as isTransientNetworkError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, s as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, t as formatModelTransportDebugBaseUrl } from "./diagnostics-
|
|
1
|
+
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, s as recordSuppressedReasoning, t as appendAssistantMessageDiagnostic } from "./diagnostics-DP1SXgAW.mjs";
|
|
2
|
+
import { a as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-B7aKA_dg.mjs";
|
|
3
|
+
import { _ as isResponsesOutputLimitToolCallError, c as hasRetryableConnectionErrorCode, h as resolveResponsesOutputIdentityRetry, i as emitModelTransportError, l as isTransientNetworkError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, s as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, t as formatModelTransportDebugBaseUrl } from "./diagnostics-BNlb1zlT.mjs";
|
|
4
4
|
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, emitModelTransportError, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue, readProviderRefusalReview, recordSuppressedReasoning, resolveResponsesOutputIdentityRetry };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/env-api-keys.ts
|
|
2
2
|
let nodeHelpers;
|
|
3
3
|
function loadNodeHelpersSync() {
|
|
4
4
|
try {
|
|
@@ -97,5 +97,4 @@ function getEnvApiKey(provider) {
|
|
|
97
97
|
if (getEnvValue("AWS_PROFILE") || getEnvValue("AWS_ACCESS_KEY_ID") && getEnvValue("AWS_SECRET_ACCESS_KEY") || getEnvValue("AWS_BEARER_TOKEN_BEDROCK") || getEnvValue("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") || getEnvValue("AWS_CONTAINER_CREDENTIALS_FULL_URI") || getEnvValue("AWS_WEB_IDENTITY_TOKEN_FILE")) return "<authenticated>";
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
//#endregion
|
|
101
100
|
export { getEnvApiKey as n, findEnvKeys as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as AssistantMessage, lt as ThinkingContent, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-
|
|
2
|
-
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
1
|
+
import { a as AssistantMessage, lt as ThinkingContent, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-BNp71XKW.mjs";
|
|
3
2
|
/** Returns only an append whose current and previously observed snapshots still match. */
|
|
4
3
|
declare function readAssistantThinkingAppend(block: ThinkingContent, previous: string): string | undefined;
|
|
5
4
|
/** Observe native producer settlement without invoking consumer result decorators. */
|
|
@@ -32,5 +31,4 @@ declare class AssistantMessageEventStream extends EventStream<AssistantMessageEv
|
|
|
32
31
|
}
|
|
33
32
|
/** Creates an assistant-message stream for provider and plugin adapters. */
|
|
34
33
|
declare function createAssistantMessageEventStream(): AssistantMessageEventStream;
|
|
35
|
-
//#endregion
|
|
36
34
|
export { readAssistantThinkingAppend as a, getEventStreamCompletion as i, EventStream as n, createAssistantMessageEventStream as r, AssistantMessageEventStream as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/llm-core/src/utils/event-stream.ts
|
|
2
2
|
const thinkingAppends = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
/** Package-internal mutation fact for native reasoning projection. */
|
|
4
4
|
function appendAssistantThinking(block, delta) {
|
|
@@ -163,5 +163,4 @@ var AssistantMessageEventStream = class extends EventStream {
|
|
|
163
163
|
function createAssistantMessageEventStream() {
|
|
164
164
|
return new AssistantMessageEventStream();
|
|
165
165
|
}
|
|
166
|
-
//#endregion
|
|
167
166
|
export { createAssistantMessageEventStream as a, bindAssistantMessageEventStream as i, EventStream as n, getEventStreamCompletion as o, appendAssistantThinking as r, readAssistantThinkingAppend as s, AssistantMessageEventStream as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-BJS9Q8G_.mjs";
|
package/dist/event-stream.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import "./event-stream-
|
|
1
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-BJS9Q8G_.mjs";
|
|
2
|
+
import "./event-stream-CPiqa8PI.mjs";
|
|
3
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
package/dist/event-stream.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as AssistantMessageEventStream, n as EventStream, a as createAssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
export { t as AssistantMessageEventStream, n as EventStream, a as createAssistantMessageEventStream } from "./event-stream-Bf6cK7-d.mjs";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/normalization-core/src/expect.ts
|
|
2
2
|
/** Returns the value or throws with the named context; use for genuine invariants only. */
|
|
3
3
|
function expectDefined(value, context) {
|
|
4
4
|
if (value === null || value === void 0) throw new Error("expected " + context + " to be defined");
|
|
5
5
|
return value;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { expectDefined as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as projectCopilotRequestFacts } from "./github-copilot-request-facts-BxuLEdNF.mjs";
|
|
2
|
+
// packages/ai/src/providers/cache-retention.ts
|
|
3
|
+
/**
|
|
4
|
+
* Resolve cache retention preference.
|
|
5
|
+
* Defaults to "short" and uses OPENCLAW_CACHE_RETENTION for backward compatibility.
|
|
6
|
+
*/
|
|
7
|
+
function resolveCacheRetention(cacheRetention) {
|
|
8
|
+
if (cacheRetention === "short" || cacheRetention === "long" || cacheRetention === "none") return cacheRetention;
|
|
9
|
+
if (typeof process !== "undefined" && process.env.OPENCLAW_CACHE_RETENTION === "long") return "long";
|
|
10
|
+
return "short";
|
|
11
|
+
}
|
|
12
|
+
// packages/ai/src/providers/github-copilot-headers.ts
|
|
13
|
+
function buildCopilotDynamicHeaders(messages) {
|
|
14
|
+
const { initiator, hasImages } = projectCopilotRequestFacts(messages, "direct");
|
|
15
|
+
const headers = {
|
|
16
|
+
"X-Initiator": initiator,
|
|
17
|
+
"Openai-Intent": "conversation-edits"
|
|
18
|
+
};
|
|
19
|
+
if (hasImages) headers["Copilot-Vision-Request"] = "true";
|
|
20
|
+
return headers;
|
|
21
|
+
}
|
|
22
|
+
export { resolveCacheRetention as n, buildCopilotDynamicHeaders as t };
|
package/dist/{github-copilot-request-facts-BZ_EMo7X.mjs → github-copilot-request-facts-BxuLEdNF.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as hasRuntimeContextMarker } from "./types-
|
|
1
|
+
import { p as hasRuntimeContextMarker } from "./types-DIBUKaTM.mjs";
|
|
2
2
|
import "./types.mjs";
|
|
3
|
-
|
|
3
|
+
// packages/ai/src/providers/github-copilot-request-facts.ts
|
|
4
4
|
/** Request facts shared by Copilot transports; identity headers remain plugin-owned. */
|
|
5
5
|
function projectCopilotRequestFacts(messages, contentMode, hasImages) {
|
|
6
6
|
const last = messages.findLast((message) => !hasRuntimeContextMarker(message));
|
|
@@ -14,5 +14,4 @@ function containsContentType(value, type, contentMode = "nested") {
|
|
|
14
14
|
if (!value || typeof value !== "object") return false;
|
|
15
15
|
return "type" in value && value.type === type || contentMode === "nested" && "content" in value && containsContentType(value.content, type);
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { projectCopilotRequestFacts as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
2
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
3
|
-
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-
|
|
4
|
-
import { t as requireApiKey } from "./required-api-key-
|
|
5
|
-
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
2
|
+
import { n as getEnvApiKey } from "./env-api-keys-DlUbTgKq.mjs";
|
|
3
|
+
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Czm9tjAm.mjs";
|
|
4
|
+
import { t as requireApiKey } from "./required-api-key-BniLGxy4.mjs";
|
|
5
|
+
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-COaKMdQv.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
|
-
|
|
7
|
+
// packages/ai/src/providers/google.ts
|
|
8
8
|
const { stream: streamGoogle, streamSimple: streamSimpleGoogle } = createGoogleGenerateContentStreams("google-generative-ai", (model, options) => {
|
|
9
9
|
const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
|
|
10
10
|
const optionsHeaders = resolveOpencodeSessionHeaders(model, options);
|
|
@@ -15,5 +15,4 @@ const { stream: streamGoogle, streamSimple: streamSimpleGoogle } = createGoogleG
|
|
|
15
15
|
httpOptions
|
|
16
16
|
});
|
|
17
17
|
}, (model, options) => requireApiKey(model.provider, options?.apiKey));
|
|
18
|
-
//#endregion
|
|
19
18
|
export { streamGoogle, streamSimpleGoogle };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as streamFragmentError } from "./transport-utils-
|
|
7
|
-
import { t as buildGuardedModelFetch } from "./host-policy-
|
|
8
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
12
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
1
|
+
import "./src-CmBmaGOV.mjs";
|
|
2
|
+
import { a as asRecord, c as readStringField, i as asOptionalRecord } from "./record-coerce-BgUo6bj4.mjs";
|
|
3
|
+
import { t as omitNullRequestHeaders } from "./request-headers-DJ4QrMC_.mjs";
|
|
4
|
+
import { t as AssistantMessageEventStream } from "./event-stream-Bf6cK7-d.mjs";
|
|
5
|
+
import { M as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-Cf7zb-48.mjs";
|
|
6
|
+
import { a as streamFragmentError } from "./transport-utils-Cx9L80PZ.mjs";
|
|
7
|
+
import { t as buildGuardedModelFetch } from "./host-policy-B1qzS7Xe.mjs";
|
|
8
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-B3kUqQ-q.mjs";
|
|
9
|
+
import { T as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-D8CTqHvk.mjs";
|
|
10
|
+
import { E as parseJsonPreservingUnsafeIntegers, S as transportAbortError, _ as notifyProviderStreamOpened, g as notifyProviderHttpResponse, l as failTransportStream, p as iterateSseFrames, r as awaitProviderLifecycleCallback, v as parseTerminalToolCallArguments } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
11
|
+
import { n as getEnvApiKey } from "./env-api-keys-DlUbTgKq.mjs";
|
|
12
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-C-WfgiLJ.mjs";
|
|
13
13
|
import { PROVIDER_MODEL_INPUT, resolveProviderContext } from "./provider-types.mjs";
|
|
14
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
15
|
-
import { a as googleToolParameters, o as mapGoogleToolArguments } from "./google-messages-
|
|
16
|
-
import { n as createGoogleVideoPlaceholder, r as materializeGoogleVideoSlots, t as GOOGLE_VIDEO_SLOT_OMISSION } from "./google-video-slots-
|
|
17
|
-
import { r as buildGoogleInteractionsSimpleThinking } from "./google-shared-
|
|
18
|
-
|
|
19
|
-
var version = "2026.11.
|
|
20
|
-
|
|
21
|
-
//#region packages/ai/src/providers/google-interactions-request.ts
|
|
14
|
+
import { t as createAssistantOutput } from "./assistant-output-kYOaiso5.mjs";
|
|
15
|
+
import { a as googleToolParameters, o as mapGoogleToolArguments } from "./google-messages-Dip5zphv.mjs";
|
|
16
|
+
import { n as createGoogleVideoPlaceholder, r as materializeGoogleVideoSlots, t as GOOGLE_VIDEO_SLOT_OMISSION } from "./google-video-slots-CzdrKzrO.mjs";
|
|
17
|
+
import { r as buildGoogleInteractionsSimpleThinking } from "./google-shared-Dooy5JJL.mjs";
|
|
18
|
+
// packages/ai/package.json
|
|
19
|
+
var version = "2026.11.10-beta.1";
|
|
20
|
+
// packages/ai/src/providers/google-interactions-request.ts
|
|
22
21
|
let packageVersionMemo;
|
|
23
22
|
function resolveGoogleApiClientHeaders(params) {
|
|
24
23
|
const hostHeaders = getAiTransportHost().resolveProviderRequestHeaders({
|
|
@@ -144,6 +143,7 @@ function buildGoogleInteractionsParams(model, context, options = {}, videoSlots)
|
|
|
144
143
|
const generationConfig = {};
|
|
145
144
|
if (options.temperature !== void 0) generationConfig.temperature = options.temperature;
|
|
146
145
|
if (options.topP !== void 0) generationConfig.top_p = options.topP;
|
|
146
|
+
if (options.seed !== void 0) generationConfig.seed = options.seed;
|
|
147
147
|
if (options.maxTokens !== void 0) generationConfig.max_output_tokens = options.maxTokens;
|
|
148
148
|
if (options.stop && options.stop.length > 0) generationConfig.stop_sequences = options.stop;
|
|
149
149
|
if (options.thinking) {
|
|
@@ -171,8 +171,7 @@ function buildGoogleInteractionsParams(model, context, options = {}, videoSlots)
|
|
|
171
171
|
stream: true
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
//#region packages/ai/src/providers/google-interactions.ts
|
|
174
|
+
// packages/ai/src/providers/google-interactions.ts
|
|
176
175
|
/**
|
|
177
176
|
* Gemini Interactions API adapter and lifecycle for OpenClaw.
|
|
178
177
|
* POST /v1beta/interactions
|
|
@@ -195,6 +194,15 @@ function isGoogleInteractionsRequestBody(value) {
|
|
|
195
194
|
if (!record) return false;
|
|
196
195
|
return typeof record.model === "string" && Array.isArray(record.input) && typeof record.store === "boolean" && typeof record.stream === "boolean";
|
|
197
196
|
}
|
|
197
|
+
function applyGoogleServiceTierPricing(cost, tier) {
|
|
198
|
+
const multiplier = tier === "priority" ? 1.8 : tier === "flex" ? .5 : 1;
|
|
199
|
+
if (multiplier === 1) return;
|
|
200
|
+
cost.input *= multiplier;
|
|
201
|
+
cost.output *= multiplier;
|
|
202
|
+
cost.cacheRead *= multiplier;
|
|
203
|
+
cost.cacheWrite *= multiplier;
|
|
204
|
+
cost.total = cost.input + cost.output + cost.cacheRead + cost.cacheWrite;
|
|
205
|
+
}
|
|
198
206
|
const streamGoogleInteractions = (model, context, options) => {
|
|
199
207
|
const stream = new AssistantMessageEventStream();
|
|
200
208
|
const output = createAssistantOutput(model, "google-interactions");
|
|
@@ -208,7 +216,7 @@ const streamGoogleInteractions = (model, context, options) => {
|
|
|
208
216
|
const providerContext = (options?.[PROVIDER_MODEL_INPUT] ?? model.input).includes("video") ? await resolveProviderContext(context, options) : context;
|
|
209
217
|
const videoSlots = /* @__PURE__ */ new Map();
|
|
210
218
|
let body = buildGoogleInteractionsParams(model, providerContext, options, videoSlots);
|
|
211
|
-
const nextBody = await options?.onPayload?.(body, model);
|
|
219
|
+
const nextBody = await awaitProviderLifecycleCallback(options?.onPayload ? () => options.onPayload?.(body, model) : void 0, options?.signal);
|
|
212
220
|
if (nextBody !== void 0) {
|
|
213
221
|
if (!isGoogleInteractionsRequestBody(nextBody)) throw new Error("Google Interactions onPayload returned an invalid request body");
|
|
214
222
|
body = nextBody;
|
|
@@ -489,7 +497,10 @@ const streamGoogleInteractions = (model, context, options) => {
|
|
|
489
497
|
total: 0
|
|
490
498
|
}
|
|
491
499
|
};
|
|
492
|
-
if (model.cost)
|
|
500
|
+
if (model.cost) {
|
|
501
|
+
calculateCost(model, output.usage);
|
|
502
|
+
applyGoogleServiceTierPricing(output.usage.cost, response.headers.get("x-gemini-service-tier") ?? readStringField(interaction, "service_tier") ?? body.service_tier);
|
|
503
|
+
}
|
|
493
504
|
const status = typeof interaction.status === "string" ? interaction.status : "completed";
|
|
494
505
|
if (status === "failed" || status === "cancelled" || status === "budget_exceeded") throw new Error(`Google Interactions API completed with status: ${status}`);
|
|
495
506
|
if (status === "incomplete") output.stopReason = "length";
|
|
@@ -543,10 +554,10 @@ const streamSimpleGoogleInteractions = (model, context, options) => {
|
|
|
543
554
|
return streamGoogleInteractions(model, context, {
|
|
544
555
|
...base,
|
|
545
556
|
...typeof record.topP === "number" ? { topP: record.topP } : {},
|
|
557
|
+
...typeof record.seed === "number" ? { seed: record.seed } : {},
|
|
546
558
|
thinking: buildGoogleInteractionsSimpleThinking(model, options),
|
|
547
559
|
...toolChoice ? { toolChoice } : {},
|
|
548
560
|
...videoMetadata !== void 0 ? { videoMetadata } : {}
|
|
549
561
|
});
|
|
550
562
|
};
|
|
551
|
-
//#endregion
|
|
552
563
|
export { streamGoogleInteractions, streamSimpleGoogleInteractions };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { p as hasRuntimeContextMarker } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
6
|
-
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-
|
|
7
|
-
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText } from "./simple-options-
|
|
8
|
-
import {
|
|
9
|
-
import { t as notifyLlmRequestActivity } from "./llm-request-activity-
|
|
10
|
-
import { isGoogleGemini4Model } from "./internal/google-model-family.mjs";
|
|
1
|
+
import { p as hasRuntimeContextMarker } from "./types-DIBUKaTM.mjs";
|
|
2
|
+
import { a as asRecord, s as isStringArray } from "./record-coerce-BgUo6bj4.mjs";
|
|
3
|
+
import { r as appendAssistantThinking } from "./event-stream-Bf6cK7-d.mjs";
|
|
4
|
+
import { L as isImageWithMediaPayload, M as calculateCost } from "./host-Cf7zb-48.mjs";
|
|
5
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-B3kUqQ-q.mjs";
|
|
6
|
+
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-oTx0nIsh.mjs";
|
|
7
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText } from "./simple-options-D8CTqHvk.mjs";
|
|
8
|
+
import { S as transportAbortError, b as sanitizeTransportPayloadText, i as coerceTransportToolCallArguments, o as createEmptyTransportUsage } from "./transport-stream-shared-DEpLe9fG.mjs";
|
|
9
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-v1liRqNt.mjs";
|
|
10
|
+
import { isGoogleGemini3ProModel, isGoogleGemini4Model } from "./internal/google-model-family.mjs";
|
|
11
11
|
import "./types.mjs";
|
|
12
|
-
|
|
13
|
-
/** Reports MINIMAL support for Gemini
|
|
12
|
+
// packages/ai/src/transports/google-thinking-level.ts
|
|
13
|
+
/** Reports MINIMAL support for Gemini 3 and 4 thinkingLevel models. */
|
|
14
14
|
function googleFlashSupportsMinimalThinking(modelId) {
|
|
15
|
-
if (isGoogleGemini4Model(modelId)) return false;
|
|
15
|
+
if (isGoogleGemini4Model(modelId) || isGoogleGemini3ProModel(modelId)) return false;
|
|
16
16
|
const match = modelId.toLowerCase().match(/(?:^|\/)gemini-3\.(\d+)-flash(?:-|$)/);
|
|
17
17
|
if (!match) return true;
|
|
18
18
|
return Number.parseInt(match[1] ?? "0", 10) < 7;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
//#region packages/ai/src/providers/google-tool-parameters.ts
|
|
20
|
+
// packages/ai/src/providers/google-tool-parameters.ts
|
|
22
21
|
const PYTHON_KEYWORDS = new Set("False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield".split(" "));
|
|
23
22
|
function parameterNames(parameters) {
|
|
24
23
|
const properties = asRecord(parameters.properties);
|
|
@@ -53,8 +52,7 @@ function mapGoogleToolArguments(tools, toolName, args, direction) {
|
|
|
53
52
|
const mapping = direction === "encode" ? names : new Map([...names].map(([name, alias]) => [alias, name]));
|
|
54
53
|
return Object.fromEntries(Object.entries(args).map(([name, value]) => [mapping.get(name) ?? name, value]));
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
//#region packages/ai/src/providers/google-stream.ts
|
|
55
|
+
// packages/ai/src/providers/google-stream.ts
|
|
58
56
|
const GOOGLE_MODEL_RESOURCE_PREFIX = /^(?:(?:projects\/[^/]+\/locations\/[^/]+\/)?publishers\/google\/models\/|google\/|models\/)/u;
|
|
59
57
|
function retainThoughtSignature(existing, incoming) {
|
|
60
58
|
if (typeof incoming === "string" && incoming.length > 0) return incoming;
|
|
@@ -288,8 +286,7 @@ async function consumeGoogleGenerateContentStream(params) {
|
|
|
288
286
|
});
|
|
289
287
|
params.stream.end();
|
|
290
288
|
}
|
|
291
|
-
|
|
292
|
-
//#region packages/ai/src/providers/google-messages.ts
|
|
289
|
+
// packages/ai/src/providers/google-messages.ts
|
|
293
290
|
const GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP = "skip_thought_signature_validator";
|
|
294
291
|
function resolveThoughtSignature(value) {
|
|
295
292
|
return value && value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value) ? value : void 0;
|
|
@@ -445,5 +442,4 @@ function convertGoogleTools(tools) {
|
|
|
445
442
|
parametersJsonSchema: googleToolParameters(tool.parameters)
|
|
446
443
|
})) }];
|
|
447
444
|
}
|
|
448
|
-
//#endregion
|
|
449
445
|
export { googleToolParameters as a, consumeGoogleGenerateContentStream as i, projectGoogleMessages as n, mapGoogleToolArguments as o, requiresGoogleToolCallId as r, googleFlashSupportsMinimalThinking as s, convertGoogleTools as t };
|