@openclaw/ai 2026.9.6 → 2026.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-DZQ_7gD1.mjs → anthropic-CTXJlfnS.mjs} +37 -66
- package/dist/{anthropic-payload-policy-DyfwikYJ.d.mts → anthropic-payload-policy-NIPVYXPq.d.mts} +7 -5
- package/dist/{anthropic-stream-reducer-D6ZI1wwj.mjs → anthropic-stream-reducer-DrsBCsFY.mjs} +192 -261
- package/dist/{api-registry-C2T3lTV7.d.mts → api-registry-D-nbmSqr.d.mts} +2 -2
- package/dist/{azure-openai-responses-DS86GYzq.mjs → azure-openai-responses-BBxv4QVI.mjs} +22 -33
- package/dist/{base64-CPmadnUf.mjs → base64-C1PsYcRQ.mjs} +15 -9
- package/dist/{diagnostics-CH8j2wIG.mjs → diagnostics-CJaB6g8J.mjs} +3 -3
- package/dist/diagnostics.d.mts +4 -4
- package/dist/diagnostics.mjs +2 -2
- package/dist/{env-api-keys-bktO00EJ.mjs → env-api-keys-CyX4VKGO.mjs} +7 -5
- package/dist/event-stream-CMQfX_yr.d.mts +1 -0
- package/dist/{event-stream-CjnIZZst.d.mts → event-stream-DOPFYVqs.d.mts} +2 -2
- package/dist/{event-stream-D8PARQfL.mjs → event-stream-vd9UnCAU.mjs} +10 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-BZJFjhuC.mjs → google-B3HEK0Ag.mjs} +8 -11
- package/dist/google-interactions-vMlEfPAA.mjs +574 -0
- package/dist/{google-messages-DB7GKkDk.mjs → google-messages-Dz2dAnGo.mjs} +35 -71
- package/dist/{google-shared-Bok4I6zB.mjs → google-shared-B58i3c8H.mjs} +43 -47
- package/dist/{google-vertex-3eVNR2qW.mjs → google-vertex-DYFXzEbh.mjs} +16 -30
- package/dist/{host-yTvBrYM2.mjs → host-DwBmNMCC.mjs} +29 -188
- package/dist/{host-policy-DZO3oPPk.mjs → host-policy-wK-ay_RK.mjs} +2 -14
- package/dist/{host-DH-Z-LDb.d.mts → host-rxlNaBwm.d.mts} +9 -3
- package/dist/{index-C25RT6bP.d.mts → index-D6KsSE74.d.mts} +28 -8
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +6 -6
- package/dist/internal/anthropic.d.mts +8 -7
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +31 -8
- package/dist/internal/openai.mjs +13 -13
- package/dist/internal/runtime.d.mts +31 -70
- package/dist/internal/runtime.mjs +10 -65
- package/dist/internal/shared.d.mts +14 -12
- package/dist/internal/shared.mjs +5 -4
- package/dist/internal/tool-schema.d.mts +1 -1
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-C_13dVBn.mjs → mistral-7wDWcjfF.mjs} +46 -93
- package/dist/{openai-chatgpt-responses-sTxPl4zM.mjs → openai-chatgpt-responses-Bc7NZrQR.mjs} +26 -30
- package/dist/{openai-completions-BO6D_hrB.mjs → openai-completions-CHnwIV-W.mjs} +14 -12
- package/dist/{openai-completions-compat-CUollwl6.mjs → openai-completions-compat-BJf57ZxN.mjs} +3 -5
- package/dist/{openai-completions-compat-DfJG1wSO.d.mts → openai-completions-compat-qJjmqQ71.d.mts} +3 -3
- package/dist/{openai-completions-stream-BpuJ0ZOA.mjs → openai-completions-stream-dju_5F3P.mjs} +101 -173
- package/dist/{openai-prompt-cache-CjV_2IRI.mjs → openai-prompt-cache-BTMs80_O.mjs} +1 -1
- package/dist/{openai-prompt-cache-C4RHdN4n.d.mts → openai-prompt-cache-CouErLh7.d.mts} +2 -2
- package/dist/{openai-provider-client-BP8J1aeg.mjs → openai-provider-client-G8Otsq2Q.mjs} +2 -2
- package/dist/{openai-reasoning-effort-ash8dPrd.mjs → openai-reasoning-effort-C_0p3psG.mjs} +5 -4
- package/dist/{openai-responses-BJ_IEoMU.mjs → openai-responses-DbPe3-Py.mjs} +12 -11
- package/dist/openai-responses-compaction-replay-DiYn-gFM.d.mts +12 -0
- package/dist/{openai-responses-compaction-window-BiNCT0bS.mjs → openai-responses-compaction-window-CYGCjAQz.mjs} +5 -5
- package/dist/{openai-responses-contracts-DWrfMODE.mjs → openai-responses-contracts-CLxnqS9p.mjs} +1 -1
- package/dist/{openai-responses-contracts-B1ENJFpI.d.mts → openai-responses-contracts-D1iZ0njF.d.mts} +4 -4
- package/dist/{openai-responses-prompt-observer-internal-DPHWgbBH.mjs → openai-responses-prompt-observer-internal-BX3QTNSv.mjs} +12 -12
- package/dist/{openai-responses-request-lifecycle-DFuyO1pQ.mjs → openai-responses-request-lifecycle-Fsag-IGZ.mjs} +1 -1
- package/dist/{openai-responses-shared-DvSqtJ6_.mjs → openai-responses-shared-CIEHiKx7.mjs} +312 -122
- package/dist/{openai-responses-terminal-usage-BNFbvY9f.d.mts → openai-responses-terminal-usage-BE7lf7nW.d.mts} +2 -2
- package/dist/{openai-stop-reason-Drnn_6Qj.mjs → openai-stop-reason-8s70vDXj.mjs} +2 -12
- package/dist/{openai-tool-schema-ynZBgqW-.d.mts → openai-tool-schema-a5ysBBga.d.mts} +0 -6
- package/dist/{openai-tool-schema-D4BMcj2D.mjs → openai-tool-schema-vsl-cE-n.mjs} +243 -383
- package/dist/{openai-transport-params-DZKOTSfH.mjs → openai-transport-params-DyFJ4cgR.mjs} +60 -105
- package/dist/{positive-integer-BiUxrd71.mjs → positive-integer-CjN5OJbH.mjs} +1 -1
- package/dist/{provider-error-CRhW7lkJ.mjs → provider-error-CwT_j2v0.mjs} +43 -4
- package/dist/{provider-options-DZYq53lj.d.mts → provider-options-Df7ov0K1.d.mts} +2 -2
- package/dist/{provider-replay-context-DPr3w20a.mjs → provider-replay-context-Bs5aWE1d.mjs} +1 -1
- package/dist/{provider-transcript-transform-BTocjCRs.mjs → provider-transcript-transform-DjA5Fk2P.mjs} +17 -2
- package/dist/{provider-transport-turn-state-lrXEFkYr.mjs → provider-transport-turn-state-Dw7OtYUs.mjs} +1 -1
- package/dist/{provider-types-w1rEqrGP.d.mts → provider-types-d4XnoZMd.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +15 -11
- package/dist/{reasoning-tag-text-partitioner-Di38crhI.mjs → reasoning-tag-text-partitioner-B6FIIBt6.mjs} +47 -71
- package/dist/{record-coerce-DwRYMj3t.mjs → record-coerce-CNDovvft.mjs} +1 -1
- package/dist/simple-options-BkDPMuxw.mjs +349 -0
- package/dist/{src-DwGYYyZp.mjs → src-H4aXcFuX.mjs} +43 -25
- package/dist/{stream-CREqxHgU.mjs → stream-DDsCBgd-.mjs} +1 -7
- package/dist/{stream-first-event-timeout-BeptfRL6.mjs → stream-first-event-timeout-B9o0S4SZ.mjs} +1 -1
- package/dist/{tool-schema-json-projection-CD9c_fK8.mjs → tool-schema-json-projection-Ct8SeBeJ.mjs} +63 -23
- package/dist/{transport-stream-shared-B5RioB_Q.mjs → transport-stream-shared-BU5pwY6W.mjs} +62 -28
- package/dist/{transport-stream-shared-B7Z9oCYg.d.mts → transport-stream-shared-yYhXa4kX.d.mts} +12 -6
- package/dist/{transport-utils-03Qi0CN2.mjs → transport-utils-CqXzku3R.mjs} +3 -4
- package/dist/transports.d.mts +36 -32
- package/dist/transports.mjs +160 -216
- package/dist/types-CB-_vNyI.d.mts +1 -0
- package/dist/{types-qZFbaDbK.d.mts → types-CLLR3eB4.d.mts} +3 -1
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +4 -4
- package/dist/{validation-Dw7cb6BV.mjs → validation-BFZc40Ig.mjs} +80 -54
- package/dist/{validation-DhQhmt6t.d.mts → validation-Cat2wQsc.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/assistant-output-DM1JBNs1.mjs +0 -16
- package/dist/event-stream-C0nsgbj2.d.mts +0 -1
- package/dist/simple-options-np1XPuhm.mjs +0 -175
- package/dist/types-DTvddOfm.d.mts +0 -1
- package/dist/utf16-slice-CvGodqok.mjs +0 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { G as SimpleStreamOptions, J as StreamFunction, O as Model, Y as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "./types-
|
|
1
|
+
import "./index-D6KsSE74.mjs";
|
|
2
|
+
import { G as SimpleStreamOptions, J as StreamFunction, O as Model, Y as StreamOptions, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "./types-CLLR3eB4.mjs";
|
|
3
3
|
//#region packages/ai/src/api-registry.d.ts
|
|
4
4
|
/** Runtime stream adapter signature stored in the API provider registry. */
|
|
5
5
|
type ApiStreamFunction = (model: Model, context: Context, options?: StreamOptions) => AssistantMessageEventStreamContract;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import { n as getAiTransportHost } from "./host-
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
4
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
5
|
-
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-
|
|
6
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
2
|
+
import { n as getAiTransportHost } from "./host-DwBmNMCC.mjs";
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-BTMs80_O.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-BkDPMuxw.mjs";
|
|
5
|
+
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-DyFJ4cgR.mjs";
|
|
6
|
+
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
7
|
+
import { n as createAssistantOutput } from "./provider-transcript-transform-DjA5Fk2P.mjs";
|
|
8
|
+
import { P as convertProviderResponsesMessages, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-CIEHiKx7.mjs";
|
|
9
|
+
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
9
10
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
10
11
|
//#region packages/ai/src/providers/azure-openai-responses.ts
|
|
11
12
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
@@ -23,7 +24,7 @@ function resolveDeploymentName(model, options) {
|
|
|
23
24
|
}
|
|
24
25
|
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
25
26
|
const stream = new AssistantMessageEventStream();
|
|
26
|
-
const output =
|
|
27
|
+
const output = createAssistantOutput(model, "azure-openai-responses");
|
|
27
28
|
runResponsesStreamLifecycle({
|
|
28
29
|
stream,
|
|
29
30
|
model,
|
|
@@ -62,24 +63,18 @@ function normalizeAzureBaseUrl(baseUrl) {
|
|
|
62
63
|
} catch {
|
|
63
64
|
throw new Error(`Invalid Azure OpenAI base URL: ${baseUrl}`);
|
|
64
65
|
}
|
|
65
|
-
const isAzureHost = url.hostname.endsWith(".openai.azure.com") || url.hostname.endsWith(".cognitiveservices.azure.com");
|
|
66
66
|
const normalizedPath = url.pathname.replace(/\/+$/, "");
|
|
67
|
-
if (
|
|
67
|
+
if (isTraditionalAzureOpenAIHost(url.hostname) && (normalizedPath === "" || normalizedPath === "/" || normalizedPath === "/openai")) {
|
|
68
68
|
url.pathname = "/openai/v1";
|
|
69
69
|
url.search = "";
|
|
70
70
|
}
|
|
71
71
|
return url.toString().replace(/\/+$/, "");
|
|
72
72
|
}
|
|
73
|
-
function buildDefaultBaseUrl(resourceName) {
|
|
74
|
-
return `https://${resourceName}.openai.azure.com/openai/v1`;
|
|
75
|
-
}
|
|
76
73
|
function resolveAzureConfig(model, options) {
|
|
77
74
|
const apiVersion = options?.azureApiVersion || process.env.AZURE_OPENAI_API_VERSION || DEFAULT_AZURE_API_VERSION;
|
|
78
75
|
const baseUrl = options?.azureBaseUrl?.trim() || process.env.AZURE_OPENAI_BASE_URL?.trim() || void 0;
|
|
79
76
|
const resourceName = options?.azureResourceName || process.env.AZURE_OPENAI_RESOURCE_NAME;
|
|
80
|
-
|
|
81
|
-
if (!resolvedBaseUrl && resourceName) resolvedBaseUrl = buildDefaultBaseUrl(resourceName);
|
|
82
|
-
if (!resolvedBaseUrl && model.baseUrl) resolvedBaseUrl = model.baseUrl;
|
|
77
|
+
const resolvedBaseUrl = baseUrl || (resourceName ? `https://${resourceName}.openai.azure.com/openai/v1` : model.baseUrl);
|
|
83
78
|
if (!resolvedBaseUrl) throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");
|
|
84
79
|
return {
|
|
85
80
|
baseUrl: normalizeAzureBaseUrl(resolvedBaseUrl),
|
|
@@ -92,32 +87,26 @@ function createClient(model, apiKeyInput, options) {
|
|
|
92
87
|
const headers = { ...model.headers };
|
|
93
88
|
if (options?.headers) Object.assign(headers, options.headers);
|
|
94
89
|
const { baseUrl, apiVersion } = resolveAzureConfig(model, options);
|
|
95
|
-
const
|
|
96
|
-
...model,
|
|
97
|
-
baseUrl
|
|
98
|
-
});
|
|
99
|
-
if (isOpenAICompatibleAzureResponsesBaseUrl(baseUrl)) return new OpenAI({
|
|
90
|
+
const clientOptions = {
|
|
100
91
|
apiKey,
|
|
101
92
|
dangerouslyAllowBrowser: true,
|
|
102
93
|
defaultHeaders: headers,
|
|
103
94
|
baseURL: baseUrl,
|
|
104
|
-
fetch:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
apiKey,
|
|
109
|
-
apiVersion,
|
|
110
|
-
dangerouslyAllowBrowser: true,
|
|
111
|
-
defaultHeaders: headers,
|
|
112
|
-
baseURL: baseUrl,
|
|
113
|
-
fetch: guardedFetch,
|
|
95
|
+
fetch: getAiTransportHost().buildModelFetch({
|
|
96
|
+
...model,
|
|
97
|
+
baseUrl
|
|
98
|
+
}),
|
|
114
99
|
maxRetries: 0
|
|
100
|
+
};
|
|
101
|
+
return isOpenAICompatibleAzureResponsesBaseUrl(baseUrl) ? new OpenAI(clientOptions) : new AzureOpenAI({
|
|
102
|
+
...clientOptions,
|
|
103
|
+
apiVersion
|
|
115
104
|
});
|
|
116
105
|
}
|
|
117
106
|
function buildParams(model, context, options, deploymentName, replayMode = "checkpoint") {
|
|
118
107
|
const params = {
|
|
119
108
|
model: deploymentName,
|
|
120
|
-
input:
|
|
109
|
+
input: convertProviderResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS, {
|
|
121
110
|
sessionId: options?.sessionId,
|
|
122
111
|
authProfileId: options?.authProfileId,
|
|
123
112
|
replayMode
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
+
import { a as normalizeOptionalString } from "./string-coerce-fsri9iCu.mjs";
|
|
1
2
|
//#region packages/normalization-core/src/number-coercion.ts
|
|
2
3
|
/** Returns a number only when the input is already finite. */
|
|
3
4
|
function asFiniteNumber(value) {
|
|
4
|
-
return Number.isFinite(value) ? value : void 0;
|
|
5
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
5
6
|
}
|
|
6
7
|
/** Returns a finite number only when it is zero or greater. */
|
|
7
8
|
function asNonNegativeFiniteNumber(value) {
|
|
8
9
|
const number = asFiniteNumber(value);
|
|
9
10
|
return number && number < 0 ? void 0 : number;
|
|
10
11
|
}
|
|
11
|
-
function normalizeNumericString(value) {
|
|
12
|
-
const trimmed = value.trim();
|
|
13
|
-
return trimmed ? trimmed : void 0;
|
|
14
|
-
}
|
|
15
12
|
/** Parses only safe integer numbers or base-10 integer strings. */
|
|
16
13
|
function parseStrictInteger(value) {
|
|
17
14
|
if (typeof value === "number") return Number.isSafeInteger(value) ? value : void 0;
|
|
18
|
-
|
|
19
|
-
const normalized = normalizeNumericString(value);
|
|
15
|
+
const normalized = normalizeOptionalString(value);
|
|
20
16
|
if (!normalized || !/^[+-]?\d+$/.test(normalized)) return;
|
|
21
17
|
const parsed = Number(normalized);
|
|
22
18
|
return Number.isSafeInteger(parsed) ? parsed : void 0;
|
|
@@ -74,6 +70,12 @@ function base64DataValue(code) {
|
|
|
74
70
|
* base64 only when the input has valid alphabet, padding, and length.
|
|
75
71
|
*/
|
|
76
72
|
function canonicalizeBase64(base64) {
|
|
73
|
+
const facts = inspectBase64(base64, "canonical");
|
|
74
|
+
return facts?.canonicalPadBits ? facts.base64 : void 0;
|
|
75
|
+
}
|
|
76
|
+
/** One validating pass for the canonical and strict attachment dialects. */
|
|
77
|
+
function inspectBase64(base64, dialect) {
|
|
78
|
+
if (dialect === "attachment" && (base64.length === 0 || base64.length % 4 !== 0)) return;
|
|
77
79
|
let out;
|
|
78
80
|
let outLen = 0;
|
|
79
81
|
let padding = 0;
|
|
@@ -82,6 +84,7 @@ function canonicalizeBase64(base64) {
|
|
|
82
84
|
for (let i = 0; i < base64.length; i += 1) {
|
|
83
85
|
const code = base64.charCodeAt(i);
|
|
84
86
|
if (code <= 32) {
|
|
87
|
+
if (dialect === "attachment") return;
|
|
85
88
|
if (out === void 0) {
|
|
86
89
|
out = Buffer.allocUnsafe(base64.length - 1);
|
|
87
90
|
for (let j = 0; j < i; j += 1) out[j] = base64.charCodeAt(j);
|
|
@@ -109,9 +112,12 @@ function canonicalizeBase64(base64) {
|
|
|
109
112
|
if (remainder !== 0 && (sawPadding || remainder === 1)) return;
|
|
110
113
|
const effectivePadding = remainder === 0 ? padding : 4 - remainder;
|
|
111
114
|
const padBitMask = effectivePadding === 2 ? 15 : effectivePadding === 1 ? 3 : 0;
|
|
112
|
-
if (padBitMask !== 0 && (lastDataValue & padBitMask) !== 0) return;
|
|
113
115
|
const cleaned = out === void 0 ? base64 : out.subarray(0, outLen).toString("latin1");
|
|
114
|
-
return
|
|
116
|
+
return {
|
|
117
|
+
base64: remainder === 0 ? cleaned : cleaned + "=".repeat(4 - remainder),
|
|
118
|
+
decodedBytes: Math.floor(cleanedLength * 3 / 4) - padding,
|
|
119
|
+
canonicalPadBits: (lastDataValue & padBitMask) === 0
|
|
120
|
+
};
|
|
115
121
|
}
|
|
116
122
|
//#endregion
|
|
117
123
|
export { clampTimerTimeoutMs as a, asNonNegativeFiniteNumber as i, estimateBase64DecodedBytes as n, parseStrictPositiveInteger as o, asFiniteNumber as r, resolveTimerTimeoutMs as s, canonicalizeBase64 as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
|
+
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
3
|
import { n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import { r as asFiniteNumber } from "./base64-CPmadnUf.mjs";
|
|
4
|
+
import "./provider-error-CwT_j2v0.mjs";
|
|
5
|
+
import { r as asFiniteNumber } from "./base64-C1PsYcRQ.mjs";
|
|
6
6
|
//#region packages/normalization-core/src/error-coercion.ts
|
|
7
7
|
function readProperty(value, key) {
|
|
8
8
|
try {
|
package/dist/diagnostics.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ProviderRefusalReview, o as readProviderRefusalReview } from "./index-
|
|
2
|
-
import { a as AssistantMessage, dt as DiagnosticErrorInfo, ft as appendAssistantMessageDiagnostic, gt as isProviderRefusalAssistantError, ht as formatThrownValue, mt as extractDiagnosticError, pt as createAssistantMessageDiagnostic, ut as AssistantMessageDiagnostic } from "./types-
|
|
3
|
-
import "./types-
|
|
4
|
-
import { n as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-
|
|
1
|
+
import { a as ProviderRefusalReview, o as readProviderRefusalReview } from "./index-D6KsSE74.mjs";
|
|
2
|
+
import { a as AssistantMessage, dt as DiagnosticErrorInfo, ft as appendAssistantMessageDiagnostic, gt as isProviderRefusalAssistantError, ht as formatThrownValue, mt as extractDiagnosticError, pt as createAssistantMessageDiagnostic, ut as AssistantMessageDiagnostic } from "./types-CLLR3eB4.mjs";
|
|
3
|
+
import "./types-CB-_vNyI.mjs";
|
|
4
|
+
import { n as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-BE7lf7nW.mjs";
|
|
5
5
|
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-xumb1V3F.mjs";
|
|
6
6
|
import { r as projectDiagnosticValue, t as DiagnosticProjectionPolicy } from "./credential-redaction-BKv49aiv.mjs";
|
|
7
7
|
import { n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-C5f59L3Y.mjs";
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
|
-
import { i as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
3
|
-
import { c as isTransientNetworkError, f as resolveResponsesOutputIdentityRetry, n as formatModelTransportDebugUrl, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, p as isResponsesOutputLimitToolCallError, r as emitModelTransportDebug, s as hasRetryableConnectionErrorCode, t as formatModelTransportDebugBaseUrl } from "./diagnostics-
|
|
2
|
+
import { i as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-CwT_j2v0.mjs";
|
|
3
|
+
import { c as isTransientNetworkError, f as resolveResponsesOutputIdentityRetry, n as formatModelTransportDebugUrl, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, p as isResponsesOutputLimitToolCallError, r as emitModelTransportDebug, s as hasRetryableConnectionErrorCode, t as formatModelTransportDebugBaseUrl } from "./diagnostics-CJaB6g8J.mjs";
|
|
4
4
|
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue, readProviderRefusalReview, resolveResponsesOutputIdentityRetry };
|
|
@@ -88,16 +88,18 @@ function hasVertexAdcCredentials() {
|
|
|
88
88
|
return cachedVertexAdcCredentialsExists === true;
|
|
89
89
|
}
|
|
90
90
|
function getApiKeyEnvVars(provider) {
|
|
91
|
-
if (provider === "github-copilot") return ["COPILOT_GITHUB_TOKEN"];
|
|
92
|
-
if (provider === "anthropic") return ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
|
|
93
|
-
if (provider === "moonshot") return ["MOONSHOT_API_KEY", "KIMI_API_KEY"];
|
|
94
|
-
if (provider === "kimi" || provider === "kimi-coding") return ["KIMI_API_KEY", "KIMICODE_API_KEY"];
|
|
95
91
|
const envVar = {
|
|
92
|
+
"github-copilot": "COPILOT_GITHUB_TOKEN",
|
|
93
|
+
anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
|
94
|
+
moonshot: ["MOONSHOT_API_KEY", "KIMI_API_KEY"],
|
|
95
|
+
kimi: ["KIMI_API_KEY", "KIMICODE_API_KEY"],
|
|
96
|
+
"kimi-coding": ["KIMI_API_KEY", "KIMICODE_API_KEY"],
|
|
96
97
|
openai: "OPENAI_API_KEY",
|
|
97
98
|
meta: "MODEL_API_KEY",
|
|
98
99
|
"azure-openai-responses": "AZURE_OPENAI_API_KEY",
|
|
99
100
|
deepseek: "DEEPSEEK_API_KEY",
|
|
100
101
|
google: "GEMINI_API_KEY",
|
|
102
|
+
"google-interactions": "GEMINI_API_KEY",
|
|
101
103
|
"google-vertex": "GOOGLE_CLOUD_API_KEY",
|
|
102
104
|
groq: "GROQ_API_KEY",
|
|
103
105
|
cerebras: "CEREBRAS_API_KEY",
|
|
@@ -122,7 +124,7 @@ function getApiKeyEnvVars(provider) {
|
|
|
122
124
|
"xiaomi-token-plan-ams": "XIAOMI_TOKEN_PLAN_AMS_API_KEY",
|
|
123
125
|
"xiaomi-token-plan-sgp": "XIAOMI_TOKEN_PLAN_SGP_API_KEY"
|
|
124
126
|
}[provider];
|
|
125
|
-
return envVar ? [envVar] : void 0;
|
|
127
|
+
return Array.isArray(envVar) ? envVar : envVar ? [envVar] : void 0;
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
130
|
* Find configured environment variables that can provide an API key for a provider.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-DOPFYVqs.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ThinkingContent, a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-
|
|
1
|
+
import { $ as ThinkingContent, a as AssistantMessage, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-CLLR3eB4.mjs";
|
|
2
2
|
//#region packages/llm-core/src/utils/event-stream.d.ts
|
|
3
3
|
/** Returns only an append whose current and previously observed snapshots still match. */
|
|
4
4
|
declare function readAssistantThinkingAppend(block: ThinkingContent, previous: string): string | undefined;
|
|
@@ -6,7 +6,7 @@ declare function readAssistantThinkingAppend(block: ThinkingContent, previous: s
|
|
|
6
6
|
declare function getEventStreamCompletion(stream: object): Promise<unknown> | undefined;
|
|
7
7
|
/** Generic async-iterable event stream with a separately awaited final result. */
|
|
8
8
|
declare class EventStream<T, R = T> implements AsyncIterable<T> {
|
|
9
|
-
|
|
9
|
+
protected queue: (T | undefined)[];
|
|
10
10
|
private queueHead;
|
|
11
11
|
private waiting;
|
|
12
12
|
protected done: boolean;
|
|
@@ -95,6 +95,16 @@ var EventStream = class {
|
|
|
95
95
|
/** Assistant-message event stream that resolves on done/error terminal events. */
|
|
96
96
|
var AssistantMessageEventStream = class extends EventStream {
|
|
97
97
|
push(event) {
|
|
98
|
+
if (!this.done && event.type === "text_delta" && !event.partial) {
|
|
99
|
+
const previous = this.queue[this.queue.length - 1];
|
|
100
|
+
if (previous?.type === "text_delta" && !previous.partial && previous.contentIndex === event.contentIndex) {
|
|
101
|
+
this.queue[this.queue.length - 1] = {
|
|
102
|
+
...event,
|
|
103
|
+
delta: previous.delta + event.delta
|
|
104
|
+
};
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
98
108
|
if (event.type === "thinking_delta" || event.type === "thinking_end") {
|
|
99
109
|
const block = event.partial.content[event.contentIndex];
|
|
100
110
|
if (block?.type === "thinking") {
|
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-DOPFYVqs.mjs";
|
|
2
|
+
import "./event-stream-CMQfX_yr.mjs";
|
|
3
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
package/dist/event-stream.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
1
|
+
import { i as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
2
2
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as AssistantMessageEventStream } from "./event-stream-vd9UnCAU.mjs";
|
|
2
|
+
import { n as getAiTransportHost, r as resolveAiTransportHeaderSentinels } from "./host-DwBmNMCC.mjs";
|
|
3
|
+
import { f as mergeTransportHeaders } from "./transport-stream-shared-BU5pwY6W.mjs";
|
|
4
|
+
import { n as buildBaseOptions } from "./simple-options-BkDPMuxw.mjs";
|
|
5
|
+
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
6
|
+
import { n as createAssistantOutput } from "./provider-transcript-transform-DjA5Fk2P.mjs";
|
|
7
7
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-Bcunsn4I.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-B58i3c8H.mjs";
|
|
9
9
|
import { GoogleGenAI } from "@google/genai";
|
|
10
10
|
//#region packages/ai/src/providers/google.ts
|
|
11
11
|
let toolCallCounter = 0;
|
|
@@ -20,7 +20,7 @@ const streamGoogle = (model, context, options) => {
|
|
|
20
20
|
createClient: () => {
|
|
21
21
|
return createClient(model, options?.apiKey || getEnvApiKey(model.provider) || "", resolveOpencodeSessionHeaders(model, options));
|
|
22
22
|
},
|
|
23
|
-
buildParams: () =>
|
|
23
|
+
buildParams: () => buildGoogleGenerateContentParams(model, context, options),
|
|
24
24
|
nextToolCallId: (name) => `${name}_${Date.now()}_${++toolCallCounter}`
|
|
25
25
|
});
|
|
26
26
|
return stream;
|
|
@@ -47,8 +47,5 @@ function createClient(model, apiKey, optionsHeaders) {
|
|
|
47
47
|
httpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : void 0
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function buildParams(model, context, options = {}) {
|
|
51
|
-
return buildGoogleGenerateContentParams(model, context, options);
|
|
52
|
-
}
|
|
53
50
|
//#endregion
|
|
54
51
|
export { streamGoogle, streamSimpleGoogle };
|