@openclaw/ai 2026.11.3 → 2026.11.5-beta.2
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 +11 -8
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +1 -0
- package/dist/anthropic-DEKgalVg.mjs +182 -0
- package/dist/{anthropic-payload-policy-C0ki72BT.d.mts → anthropic-payload-policy-CXCJ5Pmj.d.mts} +21 -4
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-lifecycle-DF2qVvg1.mjs} +845 -649
- package/dist/{anthropic-tool-projection-C2-d1eZ3.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts} +6 -7
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-dGRfr4iT.mjs} +22 -32
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-DY2MLUyg.d.mts} +2 -2
- package/dist/assistant-output-CD4kY9gu.mjs +16 -0
- package/dist/{azure-openai-responses-BvvXzZbi.mjs → azure-openai-responses-DbQV5RTx.mjs} +47 -53
- package/dist/{cloudflare-Dttf8jKq.mjs → cloudflare-BJ2_Xabx.mjs} +1 -1
- package/dist/{credential-redaction-XvsPf7Yi.d.mts → credential-redaction-DrgndwTJ.d.mts} +5 -3
- package/dist/{deferred-event-buffer-DAvyP7qA.mjs → deferred-event-buffer-tIGkTkTm.mjs} +1 -2
- package/dist/{diagnostics-v7oVEW59.mjs → diagnostics-CloVGQiK.mjs} +27 -20
- package/dist/{diagnostics-DzrF1h4J.mjs → diagnostics-o1PrVNQb.mjs} +11 -4
- package/dist/diagnostics.d.mts +6 -7
- package/dist/diagnostics.mjs +4 -4
- package/dist/{env-api-keys-Xd8dm_aV.mjs → env-api-keys-BuHc86ya.mjs} +1 -26
- package/dist/event-stream-B4ZcSvsu.d.mts +1 -0
- package/dist/{event-stream-CzpE1g_o.d.mts → event-stream-BYmtRe8-.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{github-copilot-request-facts-F-EmvkpW.mjs → github-copilot-request-facts-BZ_EMo7X.mjs} +1 -1
- package/dist/{google-Cpi_cLKZ.mjs → google-B1g82bn4.mjs} +7 -8
- package/dist/{google-interactions-CGINbsjO.mjs → google-interactions-Ckr0Z99Z.mjs} +243 -269
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-A-9d3y5V.mjs} +52 -18
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-CNVh4gpm.mjs} +19 -11
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-WNM86ZcW.mjs} +72 -42
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-CXjleC6g.mjs} +3 -3
- package/dist/{google-video-slots-D8tPH8wX.mjs → google-video-slots-Bxt-OXO8.mjs} +1 -1
- package/dist/{host-CWt55nnF.mjs → host-DX7ORpeH.mjs} +46 -39
- package/dist/{host-jJOffdlW.d.mts → host-ccbwPC3A.d.mts} +17 -9
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-jCZebuXx.mjs} +2 -2
- package/dist/index-Bczt0MnO.d.mts +17 -0
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +9 -7
- package/dist/internal/anthropic.d.mts +21 -26
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.mjs +1 -1
- package/dist/internal/google.d.mts +15 -0
- package/dist/internal/google.mjs +1 -0
- package/dist/internal/model-request-body.d.mts +37 -0
- package/dist/internal/model-request-body.mjs +106 -0
- 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 +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +14 -12
- package/dist/internal/openai.mjs +11 -10
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +26 -0
- package/dist/{reasoning-tag-text-partitioner-CU9A4Lg8.mjs → internal/reasoning-tag-text-partitioner.mjs} +313 -111
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +96 -32
- package/dist/internal/runtime.d.mts +15 -41
- package/dist/internal/runtime.mjs +9 -10
- package/dist/internal/shared.d.mts +21 -25
- package/dist/internal/shared.mjs +9 -98
- package/dist/internal/tool-schema.d.mts +10 -10
- package/dist/internal/tool-schema.mjs +4 -4
- package/dist/{llm-request-activity-CfMuh5cC.mjs → llm-request-activity-DzaHoRAU.mjs} +2 -2
- package/dist/mistral-CjHkvsqR.mjs +3741 -0
- package/dist/{openai.LICENSE → mistral.LICENSE} +1 -1
- package/dist/{model-transport-url-BrsjjdjR.d.mts → model-transport-url-BdksnBqu.d.mts} +6 -8
- package/dist/{number-coercion-37gmNkuA.mjs → number-coercion-C7HsBgUL.mjs} +7 -2
- package/dist/observe-async-iterator-AlARO5wS.d.mts +178 -0
- package/dist/observe-async-iterator-DgmegcZR.mjs +181 -0
- package/dist/{openai-chatgpt-responses-BZa3SySh.mjs → openai-chatgpt-responses-CwS5JP7A.mjs} +61 -80
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-CJ-NsDzg.d.mts} +12 -6
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-CstlTQuF.mjs} +74 -50
- package/dist/{openai-completions-CCZ_UHCk.mjs → openai-completions-sj4S-RXQ.mjs} +5 -5
- package/dist/openai-completions-transport-BDAIA0_P.mjs +3406 -0
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-BZGaIWYh.d.mts} +4 -4
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CgDoFhO0.mjs} +5 -4
- package/dist/{openai-responses-compaction-replay-_sUXtcwU.d.mts → openai-responses-compaction-replay-CNHk6k53.d.mts} +4 -4
- package/dist/{openai-responses-contracts-B1nkeLL6.d.mts → openai-responses-contracts-BXMcvO7F.d.mts} +4 -10
- package/dist/{openai-responses-contracts-B5mGAbR6.mjs → openai-responses-contracts-xU-n9AJJ.mjs} +36 -37
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DCkURKS0.mjs} +55 -8
- package/dist/openai-responses-ev_c6oTy.mjs +89 -0
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-DyE30gdD.d.mts} +7 -7
- package/dist/{openai-responses-request-lifecycle-CTqHc02t.mjs → openai-responses-request-lifecycle-BuOs0mwI.mjs} +12 -26
- package/dist/{openai-responses-shared-wx9v1MCn.mjs → openai-responses-shared-BmRQnUPP.mjs} +633 -1493
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-D7IhRA6i.d.mts} +9 -3
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-CsoYgnWy.mjs} +97 -122
- package/dist/otel-Buswj0Mf.mjs +766 -0
- package/dist/{overflow-OF3PgPbw.mjs → overflow-CpApyjG2.mjs} +1 -1
- package/dist/{positive-integer-Bb4Evc7L.mjs → positive-integer-DiqE5vNi.mjs} +2 -3
- package/dist/{prompt-cache-stability-D_MeCQFI.mjs → prompt-cache-stability-w-ICeyOI.mjs} +1 -1
- package/dist/{provider-error-qtZD2inE.mjs → provider-error-DD-fo4Rz.mjs} +71 -234
- package/dist/{provider-options-DAzsyi49.d.mts → provider-options-Mo8NM5d1.d.mts} +16 -5
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-xyU7-CiT.mjs} +2 -2
- package/dist/provider-transcript-transform-DtaxNcC1.mjs +32 -0
- package/dist/{provider-transport-turn-state-D_GjPJHe.mjs → provider-transport-turn-state-BIS8maBK.mjs} +4 -4
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-B1e98js5.d.mts} +3 -3
- package/dist/provider-types.d.mts +7 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +26 -29
- package/dist/{record-coerce-CNDovvft.mjs → record-coerce-BQaoiN3r.mjs} +4 -1
- package/dist/request-headers-DO4Mqhw1.mjs +10 -0
- package/dist/{required-api-key-D088S4Cd.mjs → required-api-key-2zZTkmsi.mjs} +1 -1
- package/dist/{retry-after-BrmTv0jL.d.mts → retry-after-DnHBlFS2.d.mts} +21 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-BISmUlUv.d.mts} +2 -2
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-tLSeECry.mjs} +108 -82
- package/dist/src-BUsVkrNt.mjs +105 -0
- package/dist/{src-CyA0zJnt.mjs → src-CQ7nH2mL.mjs} +4 -7
- package/dist/stable-stringify-CchQEmeA.mjs +84 -0
- package/dist/{stream-C4YDqhFj.mjs → stream-DrtAWu7c.mjs} +2 -6
- package/dist/{stream-first-event-timeout-D_TfJHRJ.mjs → stream-first-event-timeout-B7RcufAV.mjs} +16 -13
- package/dist/{string-coerce-Cj8sqWHx.mjs → string-coerce-BCuWMIrk.mjs} +1 -1
- package/dist/string-normalization-B8TDDBX_.mjs +32 -0
- package/dist/telemetry-CvK1yQg7.mjs +582 -0
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-BQpiJlXJ.mjs} +53 -69
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-D2uFMhMc.mjs} +177 -93
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-D3IAU4jn.d.mts} +29 -15
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-Da_39MYi.mjs} +23 -38
- package/dist/transports.d.mts +42 -39
- package/dist/transports.mjs +215 -296
- package/dist/{types-CVYzKrMl.d.mts → types-BVdTf0YV.d.mts} +38 -3
- package/dist/types-Cb3-5WM9.d.mts +1 -0
- package/dist/{types-BXd0kI8-.mjs → types-OVEWUaDh.mjs} +3 -1
- package/dist/types.d.mts +7 -6
- package/dist/types.mjs +7 -5
- package/dist/{validation-9FSkE8T-.mjs → validation-DGXqfvkj.mjs} +45 -27
- package/dist/{validation-BQ5u20Ru.d.mts → validation-QmyD0E5A.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -2
- package/package.json +40 -6
- package/dist/anthropic-lueA8LUg.mjs +0 -221
- package/dist/assistant-output-BnQm3fov.mjs +0 -47
- package/dist/event-stream-CDpFza-M.d.mts +0 -1
- package/dist/index-DSprYWaz.d.mts +0 -185
- package/dist/mistral-CQ7aoWg2.mjs +0 -512
- package/dist/model-request-body-BD5vy4rP.d.mts +0 -17
- package/dist/openai-CiRi-nVE.mjs +0 -20077
- package/dist/openai-completions-transport-DFvSBbUT.mjs +0 -10881
- package/dist/openai-responses-DQsZKUoI.mjs +0 -87
- package/dist/rolldown-runtime-B4iAMlE-.mjs +0 -35
- package/dist/types-CBJthzJX.d.mts +0 -1
- package/dist/ws.LICENSE +0 -20
package/dist/{anthropic-tool-projection-C2-d1eZ3.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts}
RENAMED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { r as AnthropicOptions } from "./provider-options-
|
|
1
|
+
import { r as AnthropicOptions } from "./provider-options-Mo8NM5d1.mjs";
|
|
2
2
|
import { Tool } from "@anthropic-ai/sdk/resources/messages.js";
|
|
3
3
|
//#region packages/ai/src/providers/anthropic-tool-projection.d.ts
|
|
4
|
-
type AnthropicToolDescriptor = {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly description: string;
|
|
7
|
-
readonly parameters: unknown;
|
|
8
|
-
};
|
|
9
4
|
type AnthropicProjectedTool = {
|
|
10
5
|
readonly originalName: string;
|
|
11
6
|
readonly wireName: string;
|
|
@@ -42,7 +37,11 @@ declare function normalizeAnthropicToolCallId(id: string): string;
|
|
|
42
37
|
/** Prepare a detached JSON projection for Anthropic's tuple dialect. */
|
|
43
38
|
declare function prepareAnthropicInputSchema(schema: Record<string, unknown>): AnthropicProjectedTool["inputSchema"] | null;
|
|
44
39
|
/** Snapshots direct/custom tool descriptors before Anthropic payload construction. */
|
|
45
|
-
declare function projectAnthropicTools(tools: readonly
|
|
40
|
+
declare function projectAnthropicTools(tools: readonly {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly description: string;
|
|
43
|
+
readonly parameters: unknown;
|
|
44
|
+
}[], toWireName: (name: string) => string): AnthropicToolProjection;
|
|
46
45
|
/** Keeps forced Anthropic tool choices aligned with the projected wire names. */
|
|
47
46
|
declare function reconcileAnthropicToolChoice(choice: AnthropicProjectedToolChoice, projection: AnthropicToolProjection): AnthropicProjectedToolChoice | undefined;
|
|
48
47
|
/** Maps Claude Code wire names without trusting every direct/custom descriptor. */
|
package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-dGRfr4iT.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as isRecord } from "./record-coerce-
|
|
2
|
-
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-
|
|
3
|
-
import { _ as
|
|
1
|
+
import { o as isRecord, s as isStringArray } from "./record-coerce-BQaoiN3r.mjs";
|
|
2
|
+
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-w-ICeyOI.mjs";
|
|
3
|
+
import { _ as SCHEMA_ARRAY_KEYS, b as SCHEMA_OBJECT_KEYS, f as inheritToolSchemaTruncation, i as publishRuntimeToolInputSchema, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, v as SCHEMA_MAP_KEYS } from "./tool-schema-json-projection-BQpiJlXJ.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/anthropic-tool-projection.ts
|
|
5
5
|
const CLAUDE_CODE_TOOL_LOOKUP = new Map([
|
|
6
6
|
"Read",
|
|
@@ -76,7 +76,7 @@ function prepareAnthropicInputSchema(schema) {
|
|
|
76
76
|
normalizeAnthropicJsonSchema(normalized);
|
|
77
77
|
const properties = normalized.properties;
|
|
78
78
|
const required = normalized.required;
|
|
79
|
-
if (properties !== void 0 && properties !== null && !isRecord(properties) || required !== void 0 && required !== null &&
|
|
79
|
+
if (properties !== void 0 && properties !== null && !isRecord(properties) || required !== void 0 && required !== null && !isStringArray(required)) {
|
|
80
80
|
if (published) publishedAnthropicSchemas.set(schema, null);
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
@@ -98,36 +98,26 @@ function projectAnthropicTools(tools, toWireName) {
|
|
|
98
98
|
const originalNameByWireName = /* @__PURE__ */ new Map();
|
|
99
99
|
const unavailableOriginalNames = /* @__PURE__ */ new Set();
|
|
100
100
|
for (const tool of tools) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!name) continue;
|
|
107
|
-
const schemaProjection = projectRuntimeToolInputSchema(tool.parameters, `${name}.parameters`, name);
|
|
108
|
-
if (!isRecord(schemaProjection.schema) || schemaProjection.violations.some((violation) => !isProviderSupportedViolation(violation))) {
|
|
109
|
-
unavailableOriginalNames.add(name);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
const inputSchema = prepareAnthropicInputSchema(schemaProjection.schema);
|
|
113
|
-
if (!inputSchema) {
|
|
114
|
-
unavailableOriginalNames.add(name);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
let description;
|
|
118
|
-
try {
|
|
119
|
-
description = typeof tool.description === "string" ? tool.description : void 0;
|
|
120
|
-
} catch {}
|
|
121
|
-
projectedTool = {
|
|
122
|
-
originalName: name,
|
|
123
|
-
wireName: toWireName(name),
|
|
124
|
-
...description ? { description } : {},
|
|
125
|
-
inputSchema
|
|
126
|
-
};
|
|
127
|
-
} catch {
|
|
128
|
-
if (originalName) unavailableOriginalNames.add(originalName);
|
|
101
|
+
const name = tool.name;
|
|
102
|
+
if (!name) continue;
|
|
103
|
+
const schemaProjection = projectRuntimeToolInputSchema(tool.parameters, `${name}.parameters`, name);
|
|
104
|
+
if (!isRecord(schemaProjection.schema) || schemaProjection.violations.some((violation) => !isProviderSupportedViolation(violation))) {
|
|
105
|
+
unavailableOriginalNames.add(name);
|
|
129
106
|
continue;
|
|
130
107
|
}
|
|
108
|
+
const inputSchema = prepareAnthropicInputSchema(schemaProjection.schema);
|
|
109
|
+
if (!inputSchema) {
|
|
110
|
+
unavailableOriginalNames.add(name);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const descriptionValue = tool.description;
|
|
114
|
+
const description = typeof descriptionValue === "string" ? descriptionValue : void 0;
|
|
115
|
+
const projectedTool = {
|
|
116
|
+
originalName: name,
|
|
117
|
+
wireName: toWireName(name),
|
|
118
|
+
...description ? { description } : {},
|
|
119
|
+
inputSchema
|
|
120
|
+
};
|
|
131
121
|
const conflictingName = originalNameByWireName.get(projectedTool.wireName);
|
|
132
122
|
if (conflictingName !== void 0 && conflictingName !== projectedTool.originalName) throw new Error(`Anthropic tool names "${conflictingName}" and "${projectedTool.originalName}" both map to "${projectedTool.wireName}"`);
|
|
133
123
|
originalNameByWireName.set(projectedTool.wireName, projectedTool.originalName);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
1
|
+
import { at as StreamOptions, it as StreamFunction, n as Api, tt as SimpleStreamOptions } from "./types-BVdTf0YV.mjs";
|
|
2
|
+
import "./index-Bczt0MnO.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 = StreamFunction;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { a as createEmptyTransportUsage } from "./transport-stream-shared-D2uFMhMc.mjs";
|
|
2
|
+
//#region packages/ai/src/transports/assistant-output.ts
|
|
3
|
+
function createAssistantOutput(model, api = model.api) {
|
|
4
|
+
return {
|
|
5
|
+
role: "assistant",
|
|
6
|
+
content: [],
|
|
7
|
+
api,
|
|
8
|
+
provider: model.provider,
|
|
9
|
+
model: model.id,
|
|
10
|
+
usage: createEmptyTransportUsage(),
|
|
11
|
+
stopReason: "stop",
|
|
12
|
+
timestamp: Date.now()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { createAssistantOutput as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
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 { F as convertProviderResponsesMessages,
|
|
7
|
-
import { n as OpenAI, t as AzureOpenAI } from "./openai-CiRi-nVE.mjs";
|
|
2
|
+
import { r as getAiTransportHost } from "./host-DX7ORpeH.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-tLSeECry.mjs";
|
|
4
|
+
import { n as getEnvApiKey } from "./env-api-keys-BuHc86ya.mjs";
|
|
5
|
+
import { t as createAssistantOutput } from "./assistant-output-CD4kY9gu.mjs";
|
|
6
|
+
import { F as convertProviderResponsesMessages, It as resolvePromptCacheKey, Lt as withOpenAIErrorResponseHook, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-BmRQnUPP.mjs";
|
|
8
7
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
9
|
-
import { t as requireApiKey } from "./required-api-key-
|
|
8
|
+
import { t as requireApiKey } from "./required-api-key-2zZTkmsi.mjs";
|
|
9
|
+
import OpenAI, { AzureOpenAI } from "openai";
|
|
10
10
|
//#region packages/ai/src/providers/azure-openai-responses.ts
|
|
11
11
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
12
12
|
const AZURE_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
@@ -14,13 +14,6 @@ const AZURE_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
|
14
14
|
"opencode",
|
|
15
15
|
"azure-openai-responses"
|
|
16
16
|
]);
|
|
17
|
-
function resolveDeploymentName(model, options) {
|
|
18
|
-
if (options?.azureDeploymentName) return options.azureDeploymentName;
|
|
19
|
-
return resolveAzureDeploymentNameFromMap({
|
|
20
|
-
modelId: model.id,
|
|
21
|
-
deploymentMap: process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
17
|
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
25
18
|
const stream = new AssistantMessageEventStream();
|
|
26
19
|
const output = createAssistantOutput(model, "azure-openai-responses");
|
|
@@ -28,6 +21,7 @@ const streamAzureOpenAIResponses = (model, context, options) => {
|
|
|
28
21
|
stream,
|
|
29
22
|
model,
|
|
30
23
|
output,
|
|
24
|
+
context,
|
|
31
25
|
options,
|
|
32
26
|
resolveRequestModel: (requestModel) => {
|
|
33
27
|
const { baseUrl } = resolveAzureConfig(requestModel, options);
|
|
@@ -37,9 +31,46 @@ const streamAzureOpenAIResponses = (model, context, options) => {
|
|
|
37
31
|
};
|
|
38
32
|
},
|
|
39
33
|
createClient: (requestModel) => {
|
|
40
|
-
|
|
34
|
+
const apiKey = (options?.apiKey || getEnvApiKey(model.provider) || "").trim();
|
|
35
|
+
if (!apiKey) throw new Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");
|
|
36
|
+
const headers = { ...requestModel.headers };
|
|
37
|
+
if (options?.headers) Object.assign(headers, options.headers);
|
|
38
|
+
const { baseUrl, apiVersion } = resolveAzureConfig(requestModel, options);
|
|
39
|
+
const clientOptions = {
|
|
40
|
+
apiKey,
|
|
41
|
+
dangerouslyAllowBrowser: true,
|
|
42
|
+
defaultHeaders: headers,
|
|
43
|
+
baseURL: baseUrl,
|
|
44
|
+
fetch: withOpenAIErrorResponseHook(getAiTransportHost().buildModelFetch({
|
|
45
|
+
...requestModel,
|
|
46
|
+
baseUrl
|
|
47
|
+
}) ?? globalThis.fetch, options?.onResponse, requestModel),
|
|
48
|
+
maxRetries: 0
|
|
49
|
+
};
|
|
50
|
+
return isOpenAICompatibleAzureResponsesBaseUrl(baseUrl) ? new OpenAI(clientOptions) : new AzureOpenAI({
|
|
51
|
+
...clientOptions,
|
|
52
|
+
apiVersion
|
|
53
|
+
});
|
|
41
54
|
},
|
|
42
|
-
buildParams: (requestModel, replayMode) =>
|
|
55
|
+
buildParams: (requestModel, replayMode) => {
|
|
56
|
+
const params = {
|
|
57
|
+
model: options?.azureDeploymentName ? options.azureDeploymentName : resolveAzureDeploymentNameFromMap({
|
|
58
|
+
modelId: model.id,
|
|
59
|
+
deploymentMap: process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP
|
|
60
|
+
}),
|
|
61
|
+
input: convertProviderResponsesMessages(requestModel, context, AZURE_TOOL_CALL_PROVIDERS, {
|
|
62
|
+
sessionId: options?.sessionId,
|
|
63
|
+
authProfileId: options?.authProfileId,
|
|
64
|
+
mutableInput: Boolean(options?.onPayload),
|
|
65
|
+
replayMode
|
|
66
|
+
}),
|
|
67
|
+
stream: true,
|
|
68
|
+
prompt_cache_key: resolvePromptCacheKey(options, options?.cacheRetention ?? "short"),
|
|
69
|
+
store: false
|
|
70
|
+
};
|
|
71
|
+
applyCommonResponsesParams(params, requestModel, context, options);
|
|
72
|
+
return params;
|
|
73
|
+
}
|
|
43
74
|
});
|
|
44
75
|
return stream;
|
|
45
76
|
};
|
|
@@ -75,42 +106,5 @@ function resolveAzureConfig(model, options) {
|
|
|
75
106
|
apiVersion
|
|
76
107
|
};
|
|
77
108
|
}
|
|
78
|
-
function createClient(model, apiKeyInput, options) {
|
|
79
|
-
const apiKey = apiKeyInput.trim();
|
|
80
|
-
if (!apiKey) throw new Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");
|
|
81
|
-
const headers = { ...model.headers };
|
|
82
|
-
if (options?.headers) Object.assign(headers, options.headers);
|
|
83
|
-
const { baseUrl, apiVersion } = resolveAzureConfig(model, options);
|
|
84
|
-
const clientOptions = {
|
|
85
|
-
apiKey,
|
|
86
|
-
dangerouslyAllowBrowser: true,
|
|
87
|
-
defaultHeaders: headers,
|
|
88
|
-
baseURL: baseUrl,
|
|
89
|
-
fetch: withOpenAIErrorResponseHook(getAiTransportHost().buildModelFetch({
|
|
90
|
-
...model,
|
|
91
|
-
baseUrl
|
|
92
|
-
}) ?? globalThis.fetch, options?.onResponse, model),
|
|
93
|
-
maxRetries: 0
|
|
94
|
-
};
|
|
95
|
-
return isOpenAICompatibleAzureResponsesBaseUrl(baseUrl) ? new OpenAI(clientOptions) : new AzureOpenAI({
|
|
96
|
-
...clientOptions,
|
|
97
|
-
apiVersion
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function buildParams(model, context, options, deploymentName, replayMode) {
|
|
101
|
-
const params = {
|
|
102
|
-
model: deploymentName,
|
|
103
|
-
input: convertProviderResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS, {
|
|
104
|
-
sessionId: options?.sessionId,
|
|
105
|
-
authProfileId: options?.authProfileId,
|
|
106
|
-
replayMode
|
|
107
|
-
}),
|
|
108
|
-
stream: true,
|
|
109
|
-
prompt_cache_key: resolvePromptCacheKey(options, options?.cacheRetention ?? "short"),
|
|
110
|
-
store: false
|
|
111
|
-
};
|
|
112
|
-
applyCommonResponsesParams(params, model, context, options);
|
|
113
|
-
return params;
|
|
114
|
-
}
|
|
115
109
|
//#endregion
|
|
116
110
|
export { streamAzureOpenAIResponses, streamSimpleAzureOpenAIResponses };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as projectCopilotRequestFacts } from "./github-copilot-request-facts-
|
|
1
|
+
import { t as projectCopilotRequestFacts } from "./github-copilot-request-facts-BZ_EMo7X.mjs";
|
|
2
2
|
//#region packages/ai/src/providers/cache-retention.ts
|
|
3
3
|
/**
|
|
4
4
|
* Resolve cache retention preference.
|
|
@@ -9,6 +9,8 @@ type DiagnosticMediaField = {
|
|
|
9
9
|
source?: string | Uint8Array;
|
|
10
10
|
};
|
|
11
11
|
type DiagnosticProjectionPolicy = {
|
|
12
|
+
maxNodes?: number;
|
|
13
|
+
maxKeys?: number;
|
|
12
14
|
redactCredentials?: boolean;
|
|
13
15
|
omitField?: (key: string) => boolean;
|
|
14
16
|
propertyScope?: "enumerable" | "error";
|
|
@@ -17,11 +19,11 @@ type DiagnosticProjectionPolicy = {
|
|
|
17
19
|
kind: "redacted";
|
|
18
20
|
}>) => Record<string, unknown>;
|
|
19
21
|
};
|
|
20
|
-
/** Fresh records need no native-object probe while their prototype stays ordinary. */
|
|
21
|
-
declare function createDiagnosticRecord(): Record<string, unknown>;
|
|
22
22
|
declare function projectDiagnosticValue(value: unknown, policy?: DiagnosticProjectionPolicy, seen?: WeakSet<object>, mediaPayload?: boolean, state?: {
|
|
23
23
|
changed: boolean;
|
|
24
24
|
nodesRemaining: number;
|
|
25
25
|
}): unknown;
|
|
26
|
+
/** Internal producers transfer fresh ordinary records and dense arrays; arrays may be reused. */
|
|
27
|
+
declare function projectPreparedDiagnosticValue(value: unknown, policy?: DiagnosticProjectionPolicy): unknown;
|
|
26
28
|
//#endregion
|
|
27
|
-
export {
|
|
29
|
+
export { projectPreparedDiagnosticValue as i, isCredentialFieldName as n, projectDiagnosticValue as r, DiagnosticProjectionPolicy as t };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
//#region packages/ai/src/utils/deferred-event-buffer.ts
|
|
2
|
-
function createDeferredEventBuffer(sink
|
|
2
|
+
function createDeferredEventBuffer(sink) {
|
|
3
3
|
let events = [];
|
|
4
4
|
return {
|
|
5
5
|
push(event) {
|
|
6
6
|
events.push(event);
|
|
7
|
-
onBufferedEvent?.();
|
|
8
7
|
},
|
|
9
8
|
flush() {
|
|
10
9
|
for (const event of events) sink.push(event);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError } from "./diagnostics-
|
|
2
|
-
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-
|
|
3
|
-
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-
|
|
4
|
-
import { n as asNonNegativeFiniteNumber, t as asFiniteNumber } from "./number-coercion-
|
|
5
|
-
import "./provider-error-
|
|
1
|
+
import { a as isProviderRefusalAssistantError } from "./diagnostics-o1PrVNQb.mjs";
|
|
2
|
+
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-BQaoiN3r.mjs";
|
|
3
|
+
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-BCuWMIrk.mjs";
|
|
4
|
+
import { n as asNonNegativeFiniteNumber, t as asFiniteNumber } from "./number-coercion-C7HsBgUL.mjs";
|
|
5
|
+
import "./provider-error-DD-fo4Rz.mjs";
|
|
6
6
|
//#region packages/normalization-core/src/error-coercion.ts
|
|
7
7
|
function readProperty(value, key) {
|
|
8
8
|
try {
|
|
@@ -133,6 +133,17 @@ function mapResponsesTerminalUsage(usage) {
|
|
|
133
133
|
totalTokens
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
+
/** Apply lifetime pricing after base model pricing, before service-tier adjustments. */
|
|
137
|
+
function applyResponsesCacheWritePricing(usage, reported, promptCacheTtl) {
|
|
138
|
+
if (usage.cacheWrite === 0) return;
|
|
139
|
+
const details = reported?.input_tokens_details?.cache_write_tokens_details;
|
|
140
|
+
const shortWrites = asNonNegativeFiniteNumber(details?.ttl_30m_tokens);
|
|
141
|
+
const longWrites = asNonNegativeFiniteNumber(details?.ttl_12h_tokens);
|
|
142
|
+
const extendedWrites = shortWrites !== void 0 && longWrites !== void 0 && shortWrites + longWrites === usage.cacheWrite ? longWrites : promptCacheTtl === "12h" ? usage.cacheWrite : 0;
|
|
143
|
+
const extendedCost = usage.cost.cacheWrite * (extendedWrites / usage.cacheWrite);
|
|
144
|
+
usage.cost.cacheWrite += extendedCost;
|
|
145
|
+
usage.cost.total += extendedCost;
|
|
146
|
+
}
|
|
136
147
|
/** Reasoning tokens are reported by the agent path only; the package path does not track them. */
|
|
137
148
|
function readResponsesReasoningTokens(usage) {
|
|
138
149
|
return asFiniteNumber(usage?.output_tokens_details?.reasoning_tokens);
|
|
@@ -176,7 +187,7 @@ var DegenerateToolCallArgumentsError = class extends Error {
|
|
|
176
187
|
}
|
|
177
188
|
};
|
|
178
189
|
function countToolCallTrailingWhitespace(delta, previous = 0) {
|
|
179
|
-
const limit =
|
|
190
|
+
const limit = 4096;
|
|
180
191
|
let tail = 0;
|
|
181
192
|
for (let index = delta.length - 1; index >= 0 && tail < limit && TOOL_CALL_WHITESPACE.test(delta.charAt(index)); index--) tail += 1;
|
|
182
193
|
const count = tail === delta.length ? previous + tail : tail;
|
|
@@ -264,9 +275,6 @@ const TRANSIENT_NETWORK_MESSAGE_SNIPPETS = [
|
|
|
264
275
|
"write eproto"
|
|
265
276
|
];
|
|
266
277
|
const RETRYABLE_CONNECTION_ERROR_CODE_RE = /\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|EHOSTUNREACH|ENETUNREACH|EAI_AGAIN|UND_ERR_SOCKET)\b/i;
|
|
267
|
-
function isWrappedFetchFailedMessage(message) {
|
|
268
|
-
return message === "fetch failed" || /:\s*fetch failed$/.test(message);
|
|
269
|
-
}
|
|
270
278
|
function hasRetryableConnectionErrorCode(message) {
|
|
271
279
|
return RETRYABLE_CONNECTION_ERROR_CODE_RE.test(message);
|
|
272
280
|
}
|
|
@@ -283,7 +291,7 @@ function isTransientNetworkError(err) {
|
|
|
283
291
|
if (!candidate || typeof candidate !== "object") continue;
|
|
284
292
|
const message = normalizeLowercaseStringOrEmpty(candidate.message);
|
|
285
293
|
if (!message) continue;
|
|
286
|
-
if (TRANSIENT_NETWORK_MESSAGE_CODE_RE.test(message) ||
|
|
294
|
+
if (TRANSIENT_NETWORK_MESSAGE_CODE_RE.test(message) || message === "fetch failed" || /:\s*fetch failed$/.test(message) || TRANSIENT_NETWORK_MESSAGE_SNIPPETS.some((snippet) => message.includes(snippet))) return true;
|
|
287
295
|
}
|
|
288
296
|
return false;
|
|
289
297
|
}
|
|
@@ -305,24 +313,23 @@ function resolveModelSseDebugMode(env = process.env) {
|
|
|
305
313
|
if (normalized === "peek") return "peek";
|
|
306
314
|
return isTruthyEnv(normalized) ? "events" : "off";
|
|
307
315
|
}
|
|
308
|
-
/** Returns whether any model transport debug channel is enabled. */
|
|
309
|
-
function isModelTransportDebugEnabled(env = process.env) {
|
|
310
|
-
return isTruthyEnv(env.OPENCLAW_DEBUG_MODEL_TRANSPORT) || resolveModelPayloadDebugMode(env) !== "off" || resolveModelSseDebugMode(env) !== "off" || isTruthyEnv(env.OPENCLAW_DEBUG_CODE_MODE);
|
|
311
|
-
}
|
|
312
316
|
/** Emits transport diagnostics at debug, promoted to info by explicit debug flags. */
|
|
313
317
|
function emitModelTransportDebug(log, message) {
|
|
314
|
-
|
|
315
|
-
|
|
318
|
+
const env = process.env;
|
|
319
|
+
if (isTruthyEnv(env.OPENCLAW_DEBUG_MODEL_TRANSPORT) || resolveModelPayloadDebugMode(env) !== "off" || resolveModelSseDebugMode(env) !== "off" || isTruthyEnv(env.OPENCLAW_DEBUG_CODE_MODE)) {
|
|
320
|
+
if (log.isEnabled?.("info") !== false) log.info(typeof message === "function" ? message() : message);
|
|
316
321
|
return;
|
|
317
322
|
}
|
|
318
|
-
log.debug
|
|
323
|
+
if (log.isEnabled?.("debug") === false) return;
|
|
324
|
+
if (typeof message === "function" && log.debugLazy) log.debugLazy(message);
|
|
325
|
+
else log.debug(typeof message === "function" ? message() : message);
|
|
319
326
|
}
|
|
320
327
|
/** The requesting layer owns AbortError classification; deadlines remain failures here. */
|
|
321
328
|
function emitModelTransportError(log, label, detail, signal) {
|
|
322
329
|
const aborted = signal?.aborted === true && signal.reason instanceof Error && signal.reason.name === "AbortError";
|
|
323
|
-
const message = `[${label}] ${aborted ? "aborted" : "error"} ${detail}`;
|
|
330
|
+
const message = () => `[${label}] ${aborted ? "aborted" : "error"} ${typeof detail === "function" ? detail() : detail}`;
|
|
324
331
|
if (aborted) emitModelTransportDebug(log, message);
|
|
325
|
-
else log.warn(message);
|
|
332
|
+
else if (log.isEnabled?.("warn") !== false) log.warn(message());
|
|
326
333
|
}
|
|
327
334
|
//#endregion
|
|
328
335
|
//#region packages/ai/src/transports/model-transport-url.ts
|
|
@@ -345,4 +352,4 @@ function formatModelTransportDebugBaseUrl(rawUrl) {
|
|
|
345
352
|
return rawUrl ? formatModelTransportDebugUrl(rawUrl) : "default";
|
|
346
353
|
}
|
|
347
354
|
//#endregion
|
|
348
|
-
export {
|
|
355
|
+
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
|
-
//#region packages/llm-core/src/utils/
|
|
2
|
+
//#region 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;
|
|
@@ -14,8 +14,6 @@ function readProviderRefusalReview(value) {
|
|
|
14
14
|
...typeof value.errorType === "string" && value.errorType.trim() ? { errorType: value.errorType } : {}
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region packages/llm-core/src/utils/diagnostics.ts
|
|
19
17
|
/** True when the provider explicitly refused the request payload. */
|
|
20
18
|
function isProviderRefusalAssistantError(message) {
|
|
21
19
|
return Boolean(message?.diagnostics?.some((diagnostic) => diagnostic.type === "provider_refusal"));
|
|
@@ -53,5 +51,14 @@ function createAssistantMessageDiagnostic(type, error, details) {
|
|
|
53
51
|
function appendAssistantMessageDiagnostic(message, diagnostic) {
|
|
54
52
|
message.diagnostics = [...message.diagnostics ?? [], diagnostic];
|
|
55
53
|
}
|
|
54
|
+
/** Records only the presence of hidden reasoning; never copies its content. */
|
|
55
|
+
function recordSuppressedReasoning(message) {
|
|
56
|
+
if (!message.diagnostics?.some((entry) => entry.type === "reasoning_suppressed")) appendAssistantMessageDiagnostic(message, {
|
|
57
|
+
type: "reasoning_suppressed",
|
|
58
|
+
timestamp: Date.now()
|
|
59
|
+
});
|
|
60
|
+
if (message.stopReason !== "stop" && message.stopReason !== "length" || message.content.some((block) => block.type === "toolCall" || block.type === "text" && block.text.trim())) return;
|
|
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
|
+
}
|
|
56
63
|
//#endregion
|
|
57
|
-
export { isProviderRefusalAssistantError as a, formatThrownValue as i, createAssistantMessageDiagnostic as n, readProviderRefusalReview as o, extractDiagnosticError as r, appendAssistantMessageDiagnostic as t };
|
|
64
|
+
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,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import { n as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-CpVjkqn-.mjs";
|
|
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-BVdTf0YV.mjs";
|
|
2
|
+
import "./types-Cb3-5WM9.mjs";
|
|
3
|
+
import { r as isResponsesOutputLimitToolCallError } from "./openai-responses-terminal-usage-D7IhRA6i.mjs";
|
|
5
4
|
import { n as ProviderErrorRedactor, r as configureProviderErrorRedactor } from "./provider-error-CnaWYTRY.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { i as emitModelTransportError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-
|
|
5
|
+
import { r as projectDiagnosticValue, t as DiagnosticProjectionPolicy } from "./credential-redaction-DrgndwTJ.mjs";
|
|
6
|
+
import { i as emitModelTransportError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-BdksnBqu.mjs";
|
|
8
7
|
//#region packages/ai/src/transports/openai-responses-stream-errors.d.ts
|
|
9
8
|
/** Resume only a response that could not have completed tools or exposed visible output. */
|
|
10
9
|
export declare function resolveResponsesOutputIdentityRetry(message: Pick<AssistantMessage, "errorCode"> & Partial<Pick<AssistantMessage, "stopReason" | "errorBody" | "content">>): "retry" | "stop" | undefined;
|
|
@@ -15,4 +14,4 @@ export declare function hasRetryableConnectionErrorCode(message: string): boolea
|
|
|
15
14
|
/** Returns true when any nested error proves a transient network failure. */
|
|
16
15
|
export declare function isTransientNetworkError(err: unknown): boolean;
|
|
17
16
|
//#endregion
|
|
18
|
-
export { AssistantMessageDiagnostic, DiagnosticErrorInfo, type DiagnosticProjectionPolicy, type ProviderErrorRedactor,
|
|
17
|
+
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, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
2
|
-
import { a as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-
|
|
3
|
-
import {
|
|
4
|
-
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, emitModelTransportError, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue, readProviderRefusalReview, resolveResponsesOutputIdentityRetry };
|
|
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-o1PrVNQb.mjs";
|
|
2
|
+
import { a as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-DD-fo4Rz.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-CloVGQiK.mjs";
|
|
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 };
|
|
@@ -14,33 +14,8 @@ function loadNodeHelpersSync() {
|
|
|
14
14
|
return nodeHelpers;
|
|
15
15
|
}
|
|
16
16
|
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) loadNodeHelpersSync();
|
|
17
|
-
let procEnvCache = null;
|
|
18
|
-
function getProcessEnv() {
|
|
19
|
-
return typeof process === "undefined" ? void 0 : process.env;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Fallback for https://github.com/oven-sh/bun/issues/27802
|
|
23
|
-
* Bun compiled binaries have an empty `process.env` inside sandbox
|
|
24
|
-
* environments on Linux. We can recover the env from `/proc/self/environ`.
|
|
25
|
-
*/
|
|
26
|
-
function getProcEnv(key) {
|
|
27
|
-
if (typeof process === "undefined" || !process.versions?.bun) return;
|
|
28
|
-
if (Object.keys(process.env).length > 0) return;
|
|
29
|
-
if (procEnvCache === null) {
|
|
30
|
-
procEnvCache = /* @__PURE__ */ new Map();
|
|
31
|
-
try {
|
|
32
|
-
const { readFileSync } = process.getBuiltinModule("node:fs");
|
|
33
|
-
const data = readFileSync("/proc/self/environ", "utf-8");
|
|
34
|
-
for (const entry of data.split("\0")) {
|
|
35
|
-
const idx = entry.indexOf("=");
|
|
36
|
-
if (idx > 0) procEnvCache.set(entry.slice(0, idx), entry.slice(idx + 1));
|
|
37
|
-
}
|
|
38
|
-
} catch {}
|
|
39
|
-
}
|
|
40
|
-
return procEnvCache.get(key);
|
|
41
|
-
}
|
|
42
17
|
function getEnvValue(key) {
|
|
43
|
-
return (
|
|
18
|
+
return (typeof process === "undefined" ? void 0 : process.env)?.[key]?.trim() || void 0;
|
|
44
19
|
}
|
|
45
20
|
let cachedVertexAdcCredentialsExists = null;
|
|
46
21
|
function hasVertexAdcCredentials() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./event-stream-BYmtRe8-.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AssistantMessage,
|
|
1
|
+
import { a as AssistantMessage, lt as ThinkingContent, o as AssistantMessageEvent, s as AssistantMessageEventStreamContract } from "./types-BVdTf0YV.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;
|
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-BYmtRe8-.mjs";
|
|
2
|
+
import "./event-stream-B4ZcSvsu.mjs";
|
|
3
3
|
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
package/dist/event-stream.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { AssistantMessageEventStream, EventStream, createAssistantMessageEventStream };
|
|
1
|
+
export { t as AssistantMessageEventStream, n as EventStream, a as createAssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region packages/normalization-core/src/expect.ts
|
|
2
|
+
/** Returns the value or throws with the named context; use for genuine invariants only. */
|
|
3
|
+
function expectDefined(value, context) {
|
|
4
|
+
if (value === null || value === void 0) throw new Error("expected " + context + " to be defined");
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { expectDefined as t };
|
package/dist/{github-copilot-request-facts-F-EmvkpW.mjs → github-copilot-request-facts-BZ_EMo7X.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as hasRuntimeContextMarker } from "./types-OVEWUaDh.mjs";
|
|
2
2
|
import "./types.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/github-copilot-request-facts.ts
|
|
4
4
|
/** Request facts shared by Copilot transports; identity headers remain plugin-owned. */
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
2
|
-
import { n as getEnvApiKey } from "./env-api-keys-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-DX7ORpeH.mjs";
|
|
2
|
+
import { n as getEnvApiKey } from "./env-api-keys-BuHc86ya.mjs";
|
|
3
3
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
|
-
import { t as requireApiKey } from "./required-api-key-
|
|
5
|
-
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-
|
|
4
|
+
import { t as requireApiKey } from "./required-api-key-2zZTkmsi.mjs";
|
|
5
|
+
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-CNVh4gpm.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google.ts
|
|
8
8
|
const { stream: streamGoogle, streamSimple: streamSimpleGoogle } = createGoogleGenerateContentStreams("google-generative-ai", (model, options) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function createClient(model, apiKey, optionsHeaders) {
|
|
9
|
+
const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
|
|
10
|
+
const optionsHeaders = resolveOpencodeSessionHeaders(model, options);
|
|
12
11
|
const httpOptions = buildGoogleHttpOptions(model, optionsHeaders, "generative-ai");
|
|
13
12
|
const resolvedApiKey = apiKey ? getAiTransportHost().resolveSecretSentinel(apiKey) : void 0;
|
|
14
13
|
return new GoogleGenAI({
|
|
15
14
|
apiKey: resolvedApiKey,
|
|
16
15
|
httpOptions
|
|
17
16
|
});
|
|
18
|
-
}
|
|
17
|
+
}, (model, options) => requireApiKey(model.provider, options?.apiKey));
|
|
19
18
|
//#endregion
|
|
20
19
|
export { streamGoogle, streamSimpleGoogle };
|