@openclaw/ai 2026.9.1 → 2026.9.3
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 +3 -2
- package/dist/anthropic-CZy5U0NY.mjs +376 -0
- package/dist/anthropic-payload-policy-wuRCb6MH.d.mts +85 -0
- package/dist/anthropic-stream-reducer-B_yo_7pf.mjs +1669 -0
- package/dist/{api-registry-Cs6HGNqY.d.mts → api-registry-CB1-1oQ2.d.mts} +2 -2
- package/dist/assistant-output-iqnlJCV2.mjs +16 -0
- package/dist/assistant-text-phase-C20rxWwP.mjs +55 -0
- package/dist/{azure-openai-responses-CN4Fy5zV.mjs → azure-openai-responses-Crpa40QR.mjs} +5 -5
- package/dist/{base64-CEFBpSkN.mjs → base64-D-su8YVo.mjs} +1 -27
- package/dist/{diagnostics-KhXK-QJI.mjs → diagnostics-dV98PqIy.mjs} +96 -21
- package/dist/diagnostics.d.mts +3 -1
- package/dist/diagnostics.mjs +3 -3
- package/dist/{event-stream-vK_7r3bj.d.mts → event-stream-C1Z2piyk.d.mts} +11 -3
- package/dist/{event-stream-uSMZJ3FA.mjs → event-stream-D8PARQfL.mjs} +48 -10
- package/dist/event-stream-I_GlBsuZ.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{github-copilot-headers-NCJtz9i0.mjs → github-copilot-headers-B37TB3rB.mjs} +3 -10
- package/dist/github-copilot-request-facts-BTEBMeOv.mjs +16 -0
- package/dist/{google-CC-nrwXg.mjs → google-BDPriaVe.mjs} +10 -10
- package/dist/google-messages-CVn9eFpF.mjs +449 -0
- package/dist/google-shared-BedY23XS.mjs +185 -0
- package/dist/{google-vertex-DCr0pyzQ.mjs → google-vertex-DMz8XQCn.mjs} +7 -6
- package/dist/{host-BIaiBURL.mjs → host-CWuF-sS3.mjs} +84 -34
- package/dist/{host-BztR4tQj.d.mts → host-DK3wmS3e.d.mts} +3 -3
- package/dist/host-policy-CAopLRKA.mjs +37 -0
- package/dist/{index-AfaxKT8w.d.mts → index-CQ6LTHw8.d.mts} +11 -5
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +5 -5
- package/dist/internal/anthropic.d.mts +14 -11
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/google-model-family.d.mts +5 -0
- package/dist/internal/google-model-family.mjs +15 -0
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai-responses-payload-policy.mjs +1 -1
- package/dist/internal/openai.d.mts +8 -103
- package/dist/internal/openai.mjs +10 -10
- package/dist/internal/retry-after.d.mts +2 -4
- package/dist/internal/retry-after.mjs +57 -8
- package/dist/internal/runtime.d.mts +7 -6
- package/dist/internal/runtime.mjs +8 -7
- package/dist/internal/shared.d.mts +14 -3
- package/dist/internal/shared.mjs +6 -4
- package/dist/internal/tool-schema.d.mts +63 -0
- package/dist/internal/tool-schema.mjs +3 -0
- package/dist/{json-parse-BuAJEbdW.mjs → json-parse-Dw_hnxsA.mjs} +1 -1
- package/dist/{mistral-B7etBd_H.mjs → mistral--m-Jm6VZ.mjs} +16 -38
- package/dist/model-transport-url-DKocrEsb.d.mts +28 -0
- package/dist/{openai-chatgpt-responses-BAJ4gq3i.mjs → openai-chatgpt-responses-nDZccFW-.mjs} +62 -54
- package/dist/openai-completions-KuoZyx0d.mjs +187 -0
- package/dist/{openai-completions-compat-4IjSBpr6.d.mts → openai-completions-compat-CXn3T1we.d.mts} +26 -4
- package/dist/{openai-completions-stream-DZjwK8vp.mjs → openai-completions-stream-BQk3SkLD.mjs} +621 -451
- package/dist/openai-prompt-cache-BI0rkM-5.mjs +220 -0
- package/dist/openai-prompt-cache-rrutvqxq.d.mts +16 -0
- package/dist/openai-provider-client-ha_WxTyj.mjs +24 -0
- package/dist/openai-reasoning-effort-BK7FbcLT.mjs +167 -0
- package/dist/{openai-responses-BEUlxfDu.mjs → openai-responses-D99dOzKI.mjs} +14 -32
- package/dist/{openai-responses-compaction-window-DO7yV7az.mjs → openai-responses-compaction-window-D5jbzCi3.mjs} +7 -159
- package/dist/{openai-responses-contracts-bPzSN_Ba.d.mts → openai-responses-contracts-B55afwRo.d.mts} +12 -4
- package/dist/{openai-responses-prompt-observer-internal-C7x4IK7r.mjs → openai-responses-prompt-observer-internal-tApyTLVu.mjs} +3 -3
- package/dist/{openai-responses-shared-DiAdpNAM.mjs → openai-responses-shared-ZyQEzS5i.mjs} +217 -212
- package/dist/openai-tool-projection-793cE3QX.d.mts +37 -0
- package/dist/{openai-tool-schema-BMiHFH36.mjs → openai-tool-schema-CzjyYXun.mjs} +53 -583
- package/dist/openai-tool-schema-ynZBgqW-.d.mts +38 -0
- package/dist/openai-transport-params-DNasp2fU.mjs +674 -0
- package/dist/{provider-error-B6EGq6gg.mjs → provider-error-C6TbKiey.mjs} +29 -13
- package/dist/{provider-options-CxFPtvh7.d.mts → provider-options-BXr9Ec83.d.mts} +19 -42
- package/dist/provider-replay-context-BuSUaAk5.mjs +21 -0
- package/dist/{provider-transcript-transform-WvJmFUAf.mjs → provider-transcript-transform-pPmUIwKt.mjs} +1 -1
- package/dist/provider-types-CAV0Og3m.d.mts +29 -0
- package/dist/provider-types.d.mts +6 -31
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +11 -11
- package/dist/{reasoning-tag-text-partitioner-C-4uedDb.mjs → reasoning-tag-text-partitioner-BQBi4B9d.mjs} +90 -35
- package/dist/record-coerce-DwRYMj3t.mjs +32 -0
- package/dist/retry-after-CdCURCVg.d.mts +15 -0
- package/dist/{sanitize-unicode-S6binQG-.mjs → sanitize-unicode-Bb-v9meu.mjs} +1 -1
- package/dist/session-affinity-CCH7eYdB.mjs +20 -0
- package/dist/{simple-options-0PLDyJ-d.mjs → simple-options-tcKOqnpF.mjs} +3 -3
- package/dist/{src-C8U7lkoa.mjs → src-B2Q_6G8V.mjs} +10 -2
- package/dist/{stream-first-event-timeout-DcNjoFQE.mjs → stream-first-event-timeout-2hfrquuz.mjs} +1 -1
- package/dist/string-coerce-fsri9iCu.mjs +34 -0
- package/dist/{string-normalization--fwJ4S2q.mjs → string-normalization-CmLIasuf.mjs} +1 -1
- package/dist/{tool-schema-json-projection-BtZiml7r.mjs → tool-schema-json-projection-ClptDdAO.mjs} +2 -38
- package/dist/{transport-stream-shared-CytPVLIg.mjs → transport-stream-shared-Cu3ZPhNW.mjs} +5 -5
- package/dist/{transport-stream-shared-BrvFTkoO.d.mts → transport-stream-shared-DOxpGJ-H.d.mts} +4 -4
- package/dist/transport-utils-CCooe-cr.mjs +121 -0
- package/dist/transports.d.mts +114 -41
- package/dist/transports.mjs +796 -1596
- package/dist/types-BADKjDBI.d.mts +1 -0
- package/dist/{types-DbrhszyQ.d.mts → types-Dy1q0CSu.d.mts} +101 -64
- package/dist/types.d.mts +6 -6
- package/dist/types.mjs +4 -4
- package/dist/utf16-slice-CvGodqok.mjs +29 -0
- package/dist/{validation-CJZtym2g.mjs → validation-BDzVDnTs.mjs} +9 -1
- package/dist/{validation-BOwtcl9X.d.mts → validation-CaFUZN9B.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +14 -4
- package/dist/anthropic-compaction-replay-OMJZ0uyo.mjs +0 -838
- package/dist/anthropic-hk7F7ptG.mjs +0 -883
- package/dist/anthropic-payload-policy-DBT1itQ-.d.mts +0 -51
- package/dist/event-stream-DeDhbCc5.d.mts +0 -1
- package/dist/google-shared-CjPY0hZM.mjs +0 -634
- package/dist/google-thinking-level-C-V3tecN.mjs +0 -9
- package/dist/openai-completions-D0QZ0AyB.mjs +0 -403
- package/dist/openai-prompt-cache-2uo_1OR1.d.mts +0 -7
- package/dist/openai-prompt-cache-mZTCdRPo.mjs +0 -12
- package/dist/transport-utils-CtuS1Upe.mjs +0 -138
- package/dist/types-B5EFUmXs.d.mts +0 -1
- package/dist/utf16-slice-qz3nsy87.mjs +0 -84
|
@@ -1,44 +1,13 @@
|
|
|
1
|
-
import { D as Model, G as StopReason, W as SimpleStreamOptions, at as Usage, d as Context, q as StreamFunction } from "../types-
|
|
2
|
-
import {
|
|
3
|
-
import "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { D as Model, G as StopReason, W as SimpleStreamOptions, at as Usage, d as Context, q as StreamFunction } from "../types-Dy1q0CSu.mjs";
|
|
2
|
+
import { _ as resolveOpenAIModelReasoningEfforts, a as BaseOpenAIStreamOptions, b as supportsOpenAIReasoningEffort, d as OpenAIApiReasoningEffort, f as OpenAIReasoningEffort, g as normalizeOpenAIReasoningEffort, h as isOpenAIGpt56Model, l as codeModeToolSurfaceObserver, m as isOpenAIGpt55Model, o as CodeModeToolSurfaceObservation, p as isOpenAIGpt54MiniModel, s as OpenAICompletionsOptions, u as reasoningTagTextPolicy, v as resolveOpenAIReasoningEffortForModel, x as supportsOpenAITemperature, y as resolveOpenAISupportedReasoningEfforts } from "../provider-options-BXr9Ec83.mjs";
|
|
3
|
+
import { a as reconcileOpenAIResponsesToolChoice, i as reconcileOpenAICompletionsToolChoice, n as OpenAIToolProjection, r as projectOpenAITools, t as OpenAICompletionsToolChoice } from "../openai-tool-projection-793cE3QX.mjs";
|
|
4
|
+
import "../types-BADKjDBI.mjs";
|
|
5
|
+
import { o as ResponsesPromptObservation, s as responsesPromptObserver } from "../openai-responses-contracts-B55afwRo.mjs";
|
|
6
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-CXn3T1we.mjs";
|
|
7
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-rrutvqxq.mjs";
|
|
7
8
|
import OpenAI from "openai";
|
|
8
|
-
import { TSchema } from "typebox";
|
|
9
9
|
import { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
10
10
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
|
11
|
-
//#region packages/ai/src/providers/agent-tools-parameter-schema.d.ts
|
|
12
|
-
/**
|
|
13
|
-
* Narrow structural view of the host's model compat config. packages/ai must stay
|
|
14
|
-
* config-agnostic, so only tool-schema-relevant fields are modeled here; the host's
|
|
15
|
-
* ModelCompatConfig remains structurally assignable.
|
|
16
|
-
*/
|
|
17
|
-
export type ToolSchemaModelCompat = {
|
|
18
|
-
toolSchemaProfile?: string;
|
|
19
|
-
unsupportedToolSchemaKeywords?: string[];
|
|
20
|
-
omitEmptyArrayItems?: boolean;
|
|
21
|
-
};
|
|
22
|
-
/** Extracts the compat record whether callers pass a model (`{ compat }`) or the compat itself. */
|
|
23
|
-
export declare function extractToolSchemaModelCompat(modelOrCompat: {
|
|
24
|
-
compat?: unknown;
|
|
25
|
-
} | ToolSchemaModelCompat | undefined): ToolSchemaModelCompat | undefined;
|
|
26
|
-
/** JSON Schema keywords this model/provider rejects in tool schemas. */
|
|
27
|
-
export declare function resolveUnsupportedToolSchemaKeywords(modelOrCompat: {
|
|
28
|
-
compat?: unknown;
|
|
29
|
-
} | ToolSchemaModelCompat | undefined): ReadonlySet<string>;
|
|
30
|
-
/** Whether empty `items: {}` on array schemas must be omitted for this model/provider. */
|
|
31
|
-
export declare function shouldOmitEmptyArrayItems(modelOrCompat: {
|
|
32
|
-
compat?: unknown;
|
|
33
|
-
} | ToolSchemaModelCompat | undefined): boolean;
|
|
34
|
-
export type ToolParameterSchemaOptions = {
|
|
35
|
-
modelProvider?: string;
|
|
36
|
-
modelId?: string;
|
|
37
|
-
modelCompat?: ToolSchemaModelCompat;
|
|
38
|
-
};
|
|
39
|
-
/** Return a provider-compatible JSON schema for a model-facing tool. */
|
|
40
|
-
export declare function normalizeToolParameterSchema(schema: unknown, options?: ToolParameterSchemaOptions): TSchema;
|
|
41
|
-
//#endregion
|
|
42
11
|
//#region packages/ai/src/providers/azure-deployment-map.d.ts
|
|
43
12
|
/** Parses AZURE_OPENAI_DEPLOYMENT_MAP-style model=deployment entries. */
|
|
44
13
|
export declare function parseAzureDeploymentNameMap(value: string | undefined): Map<string, string>;
|
|
@@ -58,18 +27,6 @@ export declare function resolveAzureDeploymentNameFromMap(params: {
|
|
|
58
27
|
export declare function isTraditionalAzureOpenAIHost(hostname: string): boolean;
|
|
59
28
|
export declare function isOpenAICompatibleAzureResponsesBaseUrl(baseUrl: string): boolean;
|
|
60
29
|
//#endregion
|
|
61
|
-
//#region packages/ai/src/providers/clean-for-gemini.d.ts
|
|
62
|
-
export declare const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS: Set<string>;
|
|
63
|
-
export declare function cleanSchemaForGemini(schema: unknown): TSchema;
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region packages/ai/src/providers/clean-for-llamacpp-gbnf.d.ts
|
|
66
|
-
/** llama.cpp rejects grammar repetitions whose expanded rule count reaches 2000. */
|
|
67
|
-
export declare const LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD = 2000;
|
|
68
|
-
/** Removes JSON Schema constraints that llama.cpp cannot compile into GBNF. */
|
|
69
|
-
export declare function cleanSchemaForLlamacppGbnf(schema: unknown): unknown;
|
|
70
|
-
/** Reports schema paths that llama.cpp cannot compile into GBNF. */
|
|
71
|
-
export declare function findLlamacppGbnfSchemaViolations(schema: unknown, path: string): string[];
|
|
72
|
-
//#endregion
|
|
73
30
|
//#region packages/ai/src/openai-completions-messages.d.ts
|
|
74
31
|
/** Convert a normalized transcript to OpenAI Chat Completions messages. */
|
|
75
32
|
export declare function convertMessages(model: Model<"openai-completions">, context: Context, compat: ResolvedOpenAICompletionsCompat, options?: {
|
|
@@ -207,56 +164,4 @@ export declare function mapOpenAIStopReason(reason: string | null, options?: {
|
|
|
207
164
|
allowSingularToolCall?: boolean;
|
|
208
165
|
}): OpenAIStopReasonResult;
|
|
209
166
|
//#endregion
|
|
210
|
-
|
|
211
|
-
/** Repairs recoverable OpenAI tool-schema shapes before canonical normalization. */
|
|
212
|
-
export declare function normalizeOpenAIStrictCompatSchema(schema: unknown): TSchema;
|
|
213
|
-
/** Finds schema paths that violate OpenAI strict tool-schema requirements. */
|
|
214
|
-
export declare function findOpenAIStrictSchemaViolations(schema: unknown, path: string, options?: {
|
|
215
|
-
requireObjectRoot?: boolean;
|
|
216
|
-
}): string[];
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region packages/ai/src/providers/openai-tool-schema.d.ts
|
|
219
|
-
/**
|
|
220
|
-
* OpenAI strict-tool-schema normalization and diagnostics.
|
|
221
|
-
*
|
|
222
|
-
* Strict schemas need all object properties required and `additionalProperties: false`; model
|
|
223
|
-
* compatibility settings can also remove unsupported schema constructs before strict checks run.
|
|
224
|
-
*/
|
|
225
|
-
type ToolSchemaCompatInput = {
|
|
226
|
-
unsupportedToolSchemaKeywords?: unknown;
|
|
227
|
-
omitEmptyArrayItems?: unknown;
|
|
228
|
-
};
|
|
229
|
-
/** Normalizes a tool parameter schema into the OpenAI strict JSON-schema subset. */
|
|
230
|
-
export declare function normalizeStrictOpenAIJsonSchema(schema: unknown, modelCompat?: ToolSchemaCompatInput | null): unknown;
|
|
231
|
-
/** Normalizes tool parameters using strict OpenAI rules only when strict mode is active. */
|
|
232
|
-
export declare function normalizeOpenAIStrictToolParameters<T>(schema: T, strict: boolean, modelCompat?: ToolSchemaCompatInput | null): T;
|
|
233
|
-
/** Returns whether a schema already satisfies OpenAI strict tool-schema constraints. */
|
|
234
|
-
export declare function isStrictOpenAIJsonSchemaCompatible(schema: unknown): boolean;
|
|
235
|
-
type OpenAIStrictToolSchemaDiagnostic = {
|
|
236
|
-
toolIndex: number;
|
|
237
|
-
toolName?: string;
|
|
238
|
-
violations: string[];
|
|
239
|
-
};
|
|
240
|
-
/** Returns strict-schema diagnostics for an already materialized OpenAI tool projection. */
|
|
241
|
-
export declare function findOpenAIStrictToolProjectionDiagnostics(projection: OpenAIToolProjection): OpenAIStrictToolSchemaDiagnostic[];
|
|
242
|
-
/** Resolves strict mode for the projected tools that will be emitted in the request payload. */
|
|
243
|
-
export declare function resolveOpenAIProjectedToolsStrictToolFlag(projection: OpenAIToolProjection, strict: boolean | null | undefined): boolean | undefined;
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region packages/ai/src/providers/schema-keyword-strip.d.ts
|
|
246
|
-
/** Recursively remove schema keywords unsupported by a target provider/tool surface. */
|
|
247
|
-
export declare function stripUnsupportedSchemaKeywords(schema: unknown, unsupportedKeywords: ReadonlySet<string>): unknown;
|
|
248
|
-
//#endregion
|
|
249
|
-
//#region packages/ai/src/providers/tool-schema-json-projection.d.ts
|
|
250
|
-
/** JSON-safe schema value used when projecting runtime tool parameters. */
|
|
251
|
-
export type RuntimeToolInputSchemaJson = null | boolean | number | string | RuntimeToolInputSchemaJson[] | {
|
|
252
|
-
[key: string]: RuntimeToolInputSchemaJson;
|
|
253
|
-
};
|
|
254
|
-
/** Projected runtime tool schema plus validation violations. */
|
|
255
|
-
export type RuntimeToolInputSchemaProjection = {
|
|
256
|
-
readonly schema: RuntimeToolInputSchemaJson;
|
|
257
|
-
readonly violations: readonly string[];
|
|
258
|
-
};
|
|
259
|
-
/** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
|
|
260
|
-
export declare function projectRuntimeToolInputSchema(schema: unknown, path?: string): RuntimeToolInputSchemaProjection;
|
|
261
|
-
//#endregion
|
|
262
|
-
export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, OpenAICompletionsToolChoice, OpenAIReasoningEffort, OpenAIToolProjection, type ResponsesPromptObservation, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, normalizeOpenAIReasoningEffort, projectOpenAITools, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, responsesPromptObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
167
|
+
export { type CodeModeToolSurfaceObservation, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OpenAIApiReasoningEffort, type OpenAICompletionsOptions, OpenAICompletionsToolChoice, OpenAIReasoningEffort, OpenAIToolProjection, type ResponsesPromptObservation, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, normalizeOpenAIReasoningEffort, projectOpenAITools, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, responsesPromptObserver, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
2
|
-
import { a as codeModeToolSurfaceObserver, o as reasoningTagTextPolicy } from "../simple-options-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { _ as cleanSchemaForGemini, a as resolveOpenAIProjectedToolsStrictToolFlag, b as reconcileOpenAIResponsesToolChoice, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, f as stripUnsupportedSchemaKeywords, g as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, h as findLlamacppGbnfSchemaViolations, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as cleanSchemaForLlamacppGbnf, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, p as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords, v as projectOpenAITools, y as reconcileOpenAICompletionsToolChoice } from "../openai-tool-schema-BMiHFH36.mjs";
|
|
7
|
-
import { A as supportsOpenAITemperature, C as isOpenAIGpt54MiniModel, D as resolveOpenAIReasoningEffortForModel, E as normalizeOpenAIReasoningEffort, O as resolveOpenAISupportedReasoningEfforts, S as responsesPromptObserver, T as isOpenAIGpt56Model, k as supportsOpenAIReasoningEffort, w as isOpenAIGpt55Model } from "../openai-responses-compaction-window-DO7yV7az.mjs";
|
|
1
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-BI0rkM-5.mjs";
|
|
2
|
+
import { a as codeModeToolSurfaceObserver, o as reasoningTagTextPolicy } from "../simple-options-tcKOqnpF.mjs";
|
|
3
|
+
import { f as projectOpenAITools, m as reconcileOpenAIResponsesToolChoice, p as reconcileOpenAICompletionsToolChoice } from "../openai-transport-params-DNasp2fU.mjs";
|
|
4
|
+
import { a as convertMessages } from "../openai-completions-stream-BQk3SkLD.mjs";
|
|
5
|
+
import { a as resolveOpenAIModelReasoningEfforts, c as supportsOpenAIReasoningEffort, i as normalizeOpenAIReasoningEffort, l as supportsOpenAITemperature, n as isOpenAIGpt55Model, o as resolveOpenAIReasoningEffortForModel, r as isOpenAIGpt56Model, s as resolveOpenAISupportedReasoningEfforts, t as isOpenAIGpt54MiniModel } from "../openai-reasoning-effort-BK7FbcLT.mjs";
|
|
8
6
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-Drnn_6Qj.mjs";
|
|
7
|
+
import { S as responsesPromptObserver } from "../openai-responses-compaction-window-D5jbzCi3.mjs";
|
|
8
|
+
import { A as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, D as readResponsesToolCallItemIdentity, E as createResponsesToolCallTracker, F as isResponsesTextDeltaEventType, I as resolveResponsesMessageSnapshotCollapse, M as isAzureResponsesTextDeltaEvent, N as isAzureResponsesTextDeltaEventType, O as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, P as isResponsesTextContentPartType, d as mapResponsesTerminalUsage, f as readResponsesReasoningTokens, j as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, k as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, p as resolveResponsesTerminalStopReason } from "../openai-responses-shared-ZyQEzS5i.mjs";
|
|
9
9
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
10
|
-
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-
|
|
11
|
-
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-
|
|
12
|
-
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE,
|
|
10
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-KuoZyx0d.mjs";
|
|
11
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-D99dOzKI.mjs";
|
|
12
|
+
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function parseRetryAfterHttpDateMs(value: string, nowMs?: number): number | undefined;
|
|
4
|
-
//#endregion
|
|
1
|
+
import { i as parseRetryAfterHttpDateMs, n as parseRetryAfterErrorSeconds, r as parseRetryAfterHeadersSeconds, t as parseHttpDateInstant } from "../retry-after-CdCURCVg.mjs";
|
|
2
|
+
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
@@ -34,10 +34,55 @@ const HTTP_DATE_LONG_WEEKDAY_INDEX = new Map([
|
|
|
34
34
|
const IMF_FIXDATE_RE = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT$/;
|
|
35
35
|
const OBSOLETE_RFC850_DATE_RE = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{2}):(\d{2}):(\d{2}) GMT$/;
|
|
36
36
|
const OBSOLETE_ASCTIME_DATE_RE = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{2}| \d) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/;
|
|
37
|
-
|
|
37
|
+
function ownDataValue(value, key) {
|
|
38
|
+
return value && typeof value === "object" ? Object.getOwnPropertyDescriptor(value, key)?.value : void 0;
|
|
39
|
+
}
|
|
40
|
+
/** Reads only retry timing metadata, without invoking provider getters or serialization hooks. */
|
|
41
|
+
function parseRetryAfterHeadersSeconds(headers, nowMs = Date.now()) {
|
|
42
|
+
if (!headers || typeof headers !== "object") return;
|
|
43
|
+
try {
|
|
44
|
+
let entries;
|
|
45
|
+
try {
|
|
46
|
+
entries = ["retry-after", "retry-after-ms"].map((key) => [key, Headers.prototype.get.call(headers, key)]);
|
|
47
|
+
} catch {
|
|
48
|
+
entries = Object.getOwnPropertyNames(headers).flatMap((key) => {
|
|
49
|
+
const name = key.toLowerCase();
|
|
50
|
+
return name === "retry-after" || name === "retry-after-ms" ? [[name, ownDataValue(headers, key)]] : [];
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
let floor;
|
|
54
|
+
for (const [key, value] of entries) {
|
|
55
|
+
const text = typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
56
|
+
const milliseconds = key === "retry-after-ms";
|
|
57
|
+
const numeric = typeof value === "number" ? value >= 0 && (milliseconds || Number.isInteger(value) || value === Infinity) : (milliseconds ? /^\d+(?:\.\d+)?$/ : /^\d+$/).test(text);
|
|
58
|
+
const number = typeof value === "number" ? value : Number(text);
|
|
59
|
+
const retryAt = !numeric && !milliseconds ? parseRetryAfterHttpDateMs(text, nowMs) : void 0;
|
|
60
|
+
const seconds = numeric ? Number.isFinite(number) && number <= Number.MAX_SAFE_INTEGER ? number / (milliseconds ? 1e3 : 1) : Infinity : retryAt === void 0 ? void 0 : Math.max(0, (retryAt - nowMs) / 1e3);
|
|
61
|
+
if (seconds !== void 0) floor = Math.max(floor ?? 0, seconds);
|
|
62
|
+
}
|
|
63
|
+
return floor;
|
|
64
|
+
} catch {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** SDK errors carry native response headers separately from their error body. */
|
|
69
|
+
function parseRetryAfterErrorSeconds(error, nowMs = Date.now()) {
|
|
70
|
+
try {
|
|
71
|
+
const direct = parseRetryAfterHeadersSeconds(ownDataValue(error, "headers"), nowMs);
|
|
72
|
+
const response = parseRetryAfterHeadersSeconds(ownDataValue(ownDataValue(error, "response"), "headers"), nowMs);
|
|
73
|
+
return direct === void 0 && response === void 0 ? void 0 : Math.max(direct ?? 0, response ?? 0);
|
|
74
|
+
} catch {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Round leap seconds forward for Retry-After so an unrepresentable instant cannot retry early. */
|
|
38
79
|
function parseRetryAfterHttpDateMs(value, nowMs = Date.now()) {
|
|
80
|
+
return parseHttpDateInstant(value, nowMs)?.timestampMs;
|
|
81
|
+
}
|
|
82
|
+
/** Parse all three HTTP-date forms while retaining leap-second ordering. */
|
|
83
|
+
function parseHttpDateInstant(value, nowMs = Date.now()) {
|
|
39
84
|
const imfFixdate = IMF_FIXDATE_RE.exec(value);
|
|
40
|
-
if (imfFixdate) return
|
|
85
|
+
if (imfFixdate) return parseHttpDateComponents({
|
|
41
86
|
weekday: HTTP_DATE_SHORT_WEEKDAY_INDEX.get(imfFixdate[1] ?? ""),
|
|
42
87
|
year: Number.parseInt(imfFixdate[4] ?? "", 10),
|
|
43
88
|
month: HTTP_DATE_MONTH_INDEX.get(imfFixdate[3] ?? ""),
|
|
@@ -65,13 +110,13 @@ function parseRetryAfterHttpDateMs(value, nowMs = Date.now()) {
|
|
|
65
110
|
...components
|
|
66
111
|
});
|
|
67
112
|
if (candidate === void 0) return;
|
|
68
|
-
return
|
|
113
|
+
return parseHttpDateComponents({
|
|
69
114
|
year: candidate > Date.UTC(now.getUTCFullYear() + 50, now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()) ? candidateYear - 100 : candidateYear,
|
|
70
115
|
...components
|
|
71
116
|
});
|
|
72
117
|
}
|
|
73
118
|
const asctimeDate = OBSOLETE_ASCTIME_DATE_RE.exec(value);
|
|
74
|
-
if (asctimeDate) return
|
|
119
|
+
if (asctimeDate) return parseHttpDateComponents({
|
|
75
120
|
weekday: HTTP_DATE_SHORT_WEEKDAY_INDEX.get(asctimeDate[1] ?? ""),
|
|
76
121
|
year: Number.parseInt(asctimeDate[7] ?? "", 10),
|
|
77
122
|
month: HTTP_DATE_MONTH_INDEX.get(asctimeDate[2] ?? ""),
|
|
@@ -81,12 +126,16 @@ function parseRetryAfterHttpDateMs(value, nowMs = Date.now()) {
|
|
|
81
126
|
seconds: Number.parseInt(asctimeDate[6] ?? "", 10)
|
|
82
127
|
});
|
|
83
128
|
}
|
|
84
|
-
function
|
|
129
|
+
function parseHttpDateComponents(components) {
|
|
85
130
|
const timestamp = parseHttpDateCalendarMs(components);
|
|
86
131
|
if (timestamp === void 0) return;
|
|
87
|
-
const
|
|
132
|
+
const leapSecond = components.seconds === 60;
|
|
133
|
+
const weekdayTimestamp = leapSecond ? timestamp - 1e3 : timestamp;
|
|
88
134
|
if (new Date(weekdayTimestamp).getUTCDay() !== components.weekday) return;
|
|
89
|
-
return
|
|
135
|
+
return {
|
|
136
|
+
timestampMs: timestamp,
|
|
137
|
+
leapSecond
|
|
138
|
+
};
|
|
90
139
|
}
|
|
91
140
|
function parseHttpDateCalendarMs(components) {
|
|
92
141
|
const { year, month, day, hours, minutes, seconds } = components;
|
|
@@ -98,4 +147,4 @@ function parseHttpDateCalendarMs(components) {
|
|
|
98
147
|
return seconds === 60 ? timestamp + 1e3 : timestamp;
|
|
99
148
|
}
|
|
100
149
|
//#endregion
|
|
101
|
-
export { parseRetryAfterHttpDateMs };
|
|
150
|
+
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { A as ModelThinkingLevel, D as Model, J as StreamOptions, V as ProviderStreamOptions, W as SimpleStreamOptions, a as AssistantMessage, at as Usage, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "../types-
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
1
|
+
import "../index-CQ6LTHw8.mjs";
|
|
2
|
+
import { A as ModelThinkingLevel, D as Model, J as StreamOptions, V as ProviderStreamOptions, W as SimpleStreamOptions, a as AssistantMessage, at as Usage, d as Context, n as Api, s as AssistantMessageEventStreamContract } from "../types-Dy1q0CSu.mjs";
|
|
3
|
+
import { i as getEventStreamCompletion } from "../event-stream-C1Z2piyk.mjs";
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-CB1-1oQ2.mjs";
|
|
5
|
+
import "../types-BADKjDBI.mjs";
|
|
5
6
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
6
|
-
import { C as FirstStreamEventInternalOptions, D as getFirstStreamEventTimeoutHandler, E as createFirstStreamEventTimeoutError, O as getFirstStreamEventTimeoutMs, S as FirstStreamEventAbortController, T as createFirstStreamEventAbortController, g as parseTerminalToolCallArguments, k as withFirstStreamEventTimeout, w as FirstStreamEventTimeoutContext } from "../transport-stream-shared-
|
|
7
|
+
import { C as FirstStreamEventInternalOptions, D as getFirstStreamEventTimeoutHandler, E as createFirstStreamEventTimeoutError, O as getFirstStreamEventTimeoutMs, S as FirstStreamEventAbortController, T as createFirstStreamEventAbortController, g as parseTerminalToolCallArguments, k as withFirstStreamEventTimeout, w as FirstStreamEventTimeoutContext } from "../transport-stream-shared-DOxpGJ-H.mjs";
|
|
7
8
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
8
9
|
export declare const defaultApiRegistry: {
|
|
9
10
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -246,4 +247,4 @@ export type SseByteGuard = {
|
|
|
246
247
|
};
|
|
247
248
|
export declare function createSseByteGuard(reader: ReadableStreamDefaultReader<Uint8Array>, opts: ReadSseStreamWithLimitOptions): SseByteGuard;
|
|
248
249
|
//#endregion
|
|
249
|
-
export { FirstStreamEventAbortController, FirstStreamEventInternalOptions, FirstStreamEventTimeoutContext, type ReasoningTagTextDelta, type ReasoningTagTextPartitioner, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, parseTerminalToolCallArguments, sanitizeSurrogates, withFirstStreamEventTimeout };
|
|
250
|
+
export { FirstStreamEventAbortController, FirstStreamEventInternalOptions, FirstStreamEventTimeoutContext, type ReasoningTagTextDelta, type ReasoningTagTextPartitioner, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, parseTerminalToolCallArguments, sanitizeSurrogates, withFirstStreamEventTimeout };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError } from "../diagnostics-CPeq9F7y.mjs";
|
|
2
|
+
import { a as getEventStreamCompletion } from "../event-stream-D8PARQfL.mjs";
|
|
2
3
|
import { n as createApiRegistry, t as createLlmRuntime } from "../stream-CREqxHgU.mjs";
|
|
3
|
-
import { a as getSupportedThinkingLevels, i as clampThinkingLevel, n as applyProviderReportedUsageCost, o as modelsAreEqual, r as calculateCost, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
4
|
+
import { a as getSupportedThinkingLevels, i as clampThinkingLevel, n as applyProviderReportedUsageCost, o as modelsAreEqual, r as calculateCost, t as sanitizeSurrogates } from "../sanitize-unicode-Bb-v9meu.mjs";
|
|
5
|
+
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-BQBi4B9d.mjs";
|
|
4
6
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-bktO00EJ.mjs";
|
|
5
|
-
import { C as headersToRecord, m as parseTerminalToolCallArguments } from "../transport-stream-shared-
|
|
7
|
+
import { C as headersToRecord, m as parseTerminalToolCallArguments } from "../transport-stream-shared-Cu3ZPhNW.mjs";
|
|
6
8
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
7
|
-
import { i as repairJson, n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "../json-parse-BuAJEbdW.mjs";
|
|
8
|
-
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-BjtkplhG.mjs";
|
|
9
9
|
import { t as shortHash } from "../hash-CHgqbJmD.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
10
|
+
import { i as repairJson, n as parseJsonWithRepair, r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "../json-parse-Dw_hnxsA.mjs";
|
|
11
|
+
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-BjtkplhG.mjs";
|
|
12
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-2hfrquuz.mjs";
|
|
12
13
|
import { t as createSseByteGuard } from "../streaming-byte-guard-CC-HMn_u.mjs";
|
|
13
14
|
import { n as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-CkR4WWy1.mjs";
|
|
14
15
|
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
@@ -200,4 +201,4 @@ function isContextOverflow(message, contextWindow) {
|
|
|
200
201
|
return false;
|
|
201
202
|
}
|
|
202
203
|
//#endregion
|
|
203
|
-
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
204
|
+
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isConfiguredContextSizeOverflowError, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { $ as ThinkingLevel, D as Model, E as Message, J as StreamOptions, W as SimpleStreamOptions, Z as ThinkingBudgets, a as AssistantMessage, n as Api } from "../types-
|
|
2
|
-
import "../
|
|
1
|
+
import { $ as ThinkingLevel, D as Model, E as Message, J as StreamOptions, W as SimpleStreamOptions, Z as ThinkingBudgets, a as AssistantMessage, n as Api } from "../types-Dy1q0CSu.mjs";
|
|
2
|
+
import { a as readAssistantThinkingAppend } from "../event-stream-C1Z2piyk.mjs";
|
|
3
|
+
import "../types-BADKjDBI.mjs";
|
|
3
4
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
4
5
|
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-Cwcjv_fx.mjs";
|
|
5
6
|
//#region packages/ai/src/providers/simple-options.d.ts
|
|
@@ -71,4 +72,14 @@ export type TlsCertificateErrorDetails = {
|
|
|
71
72
|
/** Classify deterministic Node/OpenSSL certificate validation failures. */
|
|
72
73
|
export declare function inspectTlsCertificateError(error: unknown): TlsCertificateErrorDetails | null;
|
|
73
74
|
//#endregion
|
|
74
|
-
|
|
75
|
+
//#region packages/ai/src/providers/github-copilot-request-facts.d.ts
|
|
76
|
+
/** Request facts shared by Copilot transports; identity headers remain plugin-owned. */
|
|
77
|
+
export declare function projectCopilotRequestFacts(messages: readonly {
|
|
78
|
+
role: string;
|
|
79
|
+
content: unknown;
|
|
80
|
+
}[], contentMode: "direct" | "nested", hasImages?: boolean): {
|
|
81
|
+
initiator: "user" | "agent";
|
|
82
|
+
hasImages: boolean;
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { normalizePromptCapabilityIds, normalizeStructuredPromptSection, readAssistantThinkingAppend, sanitizeSurrogates, sortPromptCacheToolsByName };
|
package/dist/internal/shared.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { o as readAssistantThinkingAppend } from "../event-stream-D8PARQfL.mjs";
|
|
2
|
+
import { t as sanitizeSurrogates } from "../sanitize-unicode-Bb-v9meu.mjs";
|
|
3
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, i as transformMessages, l as formatToolResultText, o as describeUnsupportedToolResultMedia, s as extractToolResultBlockText, u as hasMediaPayload } from "../host-CWuF-sS3.mjs";
|
|
4
|
+
import { c as ensureSystemPromptCacheBoundary, d as stripSystemPromptCacheBoundary, f as normalizePromptCapabilityIds, i as clampReasoning, l as prependSystemPromptAdditionAfterCacheBoundary, m as sortPromptCacheToolsByName, n as buildBaseOptions, p as normalizeStructuredPromptSection, r as clampMaxTokensToModel, s as SYSTEM_PROMPT_CACHE_BOUNDARY, t as adjustMaxTokensForThinking, u as splitSystemPromptCacheBoundary } from "../simple-options-tcKOqnpF.mjs";
|
|
5
|
+
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-BTEBMeOv.mjs";
|
|
4
6
|
//#region packages/ai/src/utils/tls-certificate-errors.ts
|
|
5
7
|
const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
|
|
6
8
|
const CERTIFICATE_INVALID_CODES = /* @__PURE__ */ new Set([
|
|
@@ -93,4 +95,4 @@ function inspectTlsCertificateError(error) {
|
|
|
93
95
|
return inspectTlsCertificateErrorInternal(error, /* @__PURE__ */ new Set(), 0);
|
|
94
96
|
}
|
|
95
97
|
//#endregion
|
|
96
|
-
export { SYSTEM_PROMPT_CACHE_BOUNDARY, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, inspectTlsCertificateError, isImageWithMediaPayload, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prependSystemPromptAdditionAfterCacheBoundary, sanitizeSurrogates, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, stripSystemPromptCacheBoundary, transformMessages };
|
|
98
|
+
export { SYSTEM_PROMPT_CACHE_BOUNDARY, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, inspectTlsCertificateError, isImageWithMediaPayload, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prependSystemPromptAdditionAfterCacheBoundary, projectCopilotRequestFacts, readAssistantThinkingAppend, sanitizeSurrogates, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, stripSystemPromptCacheBoundary, transformMessages };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as resolveOpenAIProjectedToolsStrictToolFlag, i as normalizeStrictOpenAIJsonSchema, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics } from "../openai-tool-schema-ynZBgqW-.mjs";
|
|
2
|
+
import { TSchema } from "typebox";
|
|
3
|
+
//#region packages/ai/src/providers/agent-tools-parameter-schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Narrow structural view of the host's model compat config. packages/ai must stay
|
|
6
|
+
* config-agnostic, so only tool-schema-relevant fields are modeled here; the host's
|
|
7
|
+
* ModelCompatConfig remains structurally assignable.
|
|
8
|
+
*/
|
|
9
|
+
export type ToolSchemaModelCompat = {
|
|
10
|
+
toolSchemaProfile?: string;
|
|
11
|
+
unsupportedToolSchemaKeywords?: string[];
|
|
12
|
+
omitEmptyArrayItems?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Extracts the compat record whether callers pass a model (`{ compat }`) or the compat itself. */
|
|
15
|
+
export declare function extractToolSchemaModelCompat(modelOrCompat: {
|
|
16
|
+
compat?: unknown;
|
|
17
|
+
} | ToolSchemaModelCompat | undefined): ToolSchemaModelCompat | undefined;
|
|
18
|
+
/** JSON Schema keywords this model/provider rejects in tool schemas. */
|
|
19
|
+
export declare function resolveUnsupportedToolSchemaKeywords(modelOrCompat: {
|
|
20
|
+
compat?: unknown;
|
|
21
|
+
} | ToolSchemaModelCompat | undefined): ReadonlySet<string>;
|
|
22
|
+
/** Whether empty `items: {}` on array schemas must be omitted for this model/provider. */
|
|
23
|
+
export declare function shouldOmitEmptyArrayItems(modelOrCompat: {
|
|
24
|
+
compat?: unknown;
|
|
25
|
+
} | ToolSchemaModelCompat | undefined): boolean;
|
|
26
|
+
export type ToolParameterSchemaOptions = {
|
|
27
|
+
modelProvider?: string;
|
|
28
|
+
modelId?: string;
|
|
29
|
+
modelCompat?: ToolSchemaModelCompat;
|
|
30
|
+
};
|
|
31
|
+
/** Return a provider-compatible JSON schema for a model-facing tool. */
|
|
32
|
+
export declare function normalizeToolParameterSchema(schema: unknown, options?: ToolParameterSchemaOptions): TSchema;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region packages/ai/src/providers/clean-for-gemini.d.ts
|
|
35
|
+
export declare const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS: Set<string>;
|
|
36
|
+
export declare function cleanSchemaForGemini(schema: unknown): TSchema;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region packages/ai/src/providers/clean-for-llamacpp-gbnf.d.ts
|
|
39
|
+
/** llama.cpp rejects grammar repetitions whose expanded rule count reaches 2000. */
|
|
40
|
+
export declare const LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD = 2000;
|
|
41
|
+
/** Removes JSON Schema constraints that llama.cpp cannot compile into GBNF. */
|
|
42
|
+
export declare function cleanSchemaForLlamacppGbnf(schema: unknown): unknown;
|
|
43
|
+
/** Reports schema paths that llama.cpp cannot compile into GBNF. */
|
|
44
|
+
export declare function findLlamacppGbnfSchemaViolations(schema: unknown, path: string): string[];
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region packages/ai/src/providers/schema-keyword-strip.d.ts
|
|
47
|
+
/** Recursively remove schema keywords unsupported by a target provider/tool surface. */
|
|
48
|
+
export declare function stripUnsupportedSchemaKeywords(schema: unknown, unsupportedKeywords: ReadonlySet<string>): unknown;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region packages/ai/src/providers/tool-schema-json-projection.d.ts
|
|
51
|
+
/** JSON-safe schema value used when projecting runtime tool parameters. */
|
|
52
|
+
export type RuntimeToolInputSchemaJson = null | boolean | number | string | RuntimeToolInputSchemaJson[] | {
|
|
53
|
+
[key: string]: RuntimeToolInputSchemaJson;
|
|
54
|
+
};
|
|
55
|
+
/** Projected runtime tool schema plus validation violations. */
|
|
56
|
+
export type RuntimeToolInputSchemaProjection = {
|
|
57
|
+
readonly schema: RuntimeToolInputSchemaJson;
|
|
58
|
+
readonly violations: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
/** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
|
|
61
|
+
export declare function projectRuntimeToolInputSchema(schema: unknown, path?: string): RuntimeToolInputSchemaProjection;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, resolveOpenAIProjectedToolsStrictToolFlag };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { t as projectRuntimeToolInputSchema } from "../tool-schema-json-projection-ClptDdAO.mjs";
|
|
2
|
+
import { _ as cleanSchemaForGemini, a as resolveOpenAIProjectedToolsStrictToolFlag, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, f as stripUnsupportedSchemaKeywords, g as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, h as findLlamacppGbnfSchemaViolations, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as cleanSchemaForLlamacppGbnf, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, p as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords } from "../openai-tool-schema-CzjyYXun.mjs";
|
|
3
|
+
export { GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, cleanSchemaForGemini, cleanSchemaForLlamacppGbnf, extractToolSchemaModelCompat, findLlamacppGbnfSchemaViolations, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, projectRuntimeToolInputSchema, resolveOpenAIProjectedToolsStrictToolFlag, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, stripUnsupportedSchemaKeywords };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as asNonArrayRecord } from "./record-coerce-DwRYMj3t.mjs";
|
|
2
2
|
import { parse } from "partial-json";
|
|
3
3
|
//#region packages/ai/src/utils/json-parse.ts
|
|
4
4
|
const VALID_JSON_ESCAPES = /* @__PURE__ */ new Set([
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
2
|
-
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-
|
|
3
|
-
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, l as formatToolResultText, n as getAiTransportHost } from "./host-
|
|
4
|
-
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-
|
|
1
|
+
import { r as appendAssistantThinking, t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
2
|
+
import { i as clampThinkingLevel, r as calculateCost, t as sanitizeSurrogates } from "./sanitize-unicode-Bb-v9meu.mjs";
|
|
3
|
+
import { a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, l as formatToolResultText, n as getAiTransportHost } from "./host-CWuF-sS3.mjs";
|
|
4
|
+
import { d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-tcKOqnpF.mjs";
|
|
5
5
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
6
|
-
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments, t as assignTransportErrorDetails } from "./transport-stream-shared-
|
|
7
|
-
import { r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
6
|
+
import { _ as transportAbortError, f as notifyProviderHttpResponse, s as finalizeTerminalToolCallArguments, t as assignTransportErrorDetails } from "./transport-stream-shared-Cu3ZPhNW.mjs";
|
|
8
7
|
import { t as shortHash } from "./hash-CHgqbJmD.mjs";
|
|
9
|
-
import { t as
|
|
8
|
+
import { r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-Dw_hnxsA.mjs";
|
|
9
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
10
|
+
import { t as createAssistantOutput } from "./assistant-output-iqnlJCV2.mjs";
|
|
11
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-pPmUIwKt.mjs";
|
|
10
12
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-Drnn_6Qj.mjs";
|
|
11
13
|
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
12
14
|
import { randomUUID } from "node:crypto";
|
|
@@ -61,7 +63,7 @@ function createBoundedMistralFetcher(maxBytes = MISTRAL_STREAM_BODY_MAX_BYTES, u
|
|
|
61
63
|
const streamMistral = (model, context, options) => {
|
|
62
64
|
const stream = new AssistantMessageEventStream();
|
|
63
65
|
(async () => {
|
|
64
|
-
const output =
|
|
66
|
+
const output = createAssistantOutput(model);
|
|
65
67
|
try {
|
|
66
68
|
const apiKey = options?.apiKey || getEnvApiKey(model.provider);
|
|
67
69
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
@@ -109,7 +111,7 @@ const streamMistral = (model, context, options) => {
|
|
|
109
111
|
type: "start",
|
|
110
112
|
partial: output
|
|
111
113
|
});
|
|
112
|
-
await consumeChatStream(model, output, stream, mistralStream);
|
|
114
|
+
await consumeChatStream(model, output, stream, mistralStream, options?.signal);
|
|
113
115
|
if (options?.signal?.aborted) throw transportAbortError(options.signal);
|
|
114
116
|
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
115
117
|
stream.push({
|
|
@@ -150,31 +152,6 @@ const streamSimpleMistral = (model, context, options) => {
|
|
|
150
152
|
reasoningEffort: shouldUseReasoning && usesReasoningEffort(model) ? mapReasoningEffort(model, reasoning) : void 0
|
|
151
153
|
});
|
|
152
154
|
};
|
|
153
|
-
function createOutput(model) {
|
|
154
|
-
return {
|
|
155
|
-
role: "assistant",
|
|
156
|
-
content: [],
|
|
157
|
-
api: model.api,
|
|
158
|
-
provider: model.provider,
|
|
159
|
-
model: model.id,
|
|
160
|
-
usage: {
|
|
161
|
-
input: 0,
|
|
162
|
-
output: 0,
|
|
163
|
-
cacheRead: 0,
|
|
164
|
-
cacheWrite: 0,
|
|
165
|
-
totalTokens: 0,
|
|
166
|
-
cost: {
|
|
167
|
-
input: 0,
|
|
168
|
-
output: 0,
|
|
169
|
-
cacheRead: 0,
|
|
170
|
-
cacheWrite: 0,
|
|
171
|
-
total: 0
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
stopReason: "stop",
|
|
175
|
-
timestamp: Date.now()
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
155
|
function createMistralToolCallIdNormalizer() {
|
|
179
156
|
const idMap = /* @__PURE__ */ new Map();
|
|
180
157
|
const reverseMap = /* @__PURE__ */ new Map();
|
|
@@ -239,7 +216,7 @@ function readMistralCachedPromptTokens(usage, promptTokens) {
|
|
|
239
216
|
const rawCachedTokens = record.promptTokensDetails?.cachedTokens ?? record.prompt_tokens_details?.cached_tokens ?? record.cachedTokens ?? record.cached_tokens;
|
|
240
217
|
return Math.min(promptTokens, Math.max(0, typeof rawCachedTokens === "number" && Number.isFinite(rawCachedTokens) ? rawCachedTokens : 0));
|
|
241
218
|
}
|
|
242
|
-
async function consumeChatStream(model, output, stream, mistralStream) {
|
|
219
|
+
async function consumeChatStream(model, output, stream, mistralStream, signal) {
|
|
243
220
|
let currentBlock = null;
|
|
244
221
|
let terminalFinishReason;
|
|
245
222
|
const blocks = output.content;
|
|
@@ -270,7 +247,6 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
270
247
|
const toolCallIndex = params.index;
|
|
271
248
|
const idCandidates = explicitId ? findIdentityCandidates((identity) => identity.explicitIds.has(explicitId), params.usedContentIndexes) : /* @__PURE__ */ new Set();
|
|
272
249
|
const nameCandidates = functionName ? findIdentityCandidates((identity) => identity.functionNames.has(functionName), params.usedContentIndexes) : /* @__PURE__ */ new Set();
|
|
273
|
-
const indexCandidates = toolCallIndex === void 0 ? /* @__PURE__ */ new Set() : findIdentityCandidates((identity) => identity.indexes.has(toolCallIndex), params.usedContentIndexes);
|
|
274
250
|
if (idCandidates.size > 0) {
|
|
275
251
|
let candidates = idCandidates;
|
|
276
252
|
if (nameCandidates.size > 0) candidates = intersectCandidates(candidates, nameCandidates);
|
|
@@ -291,6 +267,7 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
291
267
|
if (indexCompatibleCandidates.size === 0) return;
|
|
292
268
|
return requireSingleCandidate(indexCompatibleCandidates);
|
|
293
269
|
}
|
|
270
|
+
const indexCandidates = toolCallIndex === void 0 ? /* @__PURE__ */ new Set() : findIdentityCandidates((identity) => identity.indexes.has(toolCallIndex), params.usedContentIndexes);
|
|
294
271
|
if (functionName) {
|
|
295
272
|
const namelessCandidates = new Set([...indexCandidates].filter((contentIndex) => {
|
|
296
273
|
const identity = toolBlockIdentities.get(contentIndex);
|
|
@@ -323,6 +300,7 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
323
300
|
});
|
|
324
301
|
};
|
|
325
302
|
for await (const event of mistralStream) {
|
|
303
|
+
notifyLlmRequestActivity(signal);
|
|
326
304
|
const chunk = event.data;
|
|
327
305
|
output.responseId ||= chunk.id;
|
|
328
306
|
if (typeof chunk.model === "string" && chunk.model.length > 0 && chunk.model !== model.id) output.responseModel ||= chunk.model;
|
|
@@ -373,7 +351,7 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
373
351
|
continue;
|
|
374
352
|
}
|
|
375
353
|
if (item.type === "thinking") {
|
|
376
|
-
const deltaText = item.thinking.map((part) => "text" in part ? part.text : "").
|
|
354
|
+
const deltaText = item.thinking.map((part) => "text" in part ? part.text : "").join("");
|
|
377
355
|
const thinkingDelta = sanitizeSurrogates(deltaText);
|
|
378
356
|
if (!thinkingDelta) continue;
|
|
379
357
|
if (!currentBlock || currentBlock.type !== "thinking") {
|
|
@@ -389,7 +367,7 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
389
367
|
partial: output
|
|
390
368
|
});
|
|
391
369
|
}
|
|
392
|
-
currentBlock
|
|
370
|
+
appendAssistantThinking(currentBlock, thinkingDelta);
|
|
393
371
|
stream.push({
|
|
394
372
|
type: "thinking_delta",
|
|
395
373
|
contentIndex: blockIndex(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region packages/ai/src/transports/model-transport-debug.d.ts
|
|
2
|
+
type SubsystemLogger = {
|
|
3
|
+
info(message: string): void;
|
|
4
|
+
debug(message: string): void;
|
|
5
|
+
};
|
|
6
|
+
type ModelTransportDebugEnv = NodeJS.ProcessEnv;
|
|
7
|
+
/** Payload debug detail levels accepted by `OPENCLAW_DEBUG_MODEL_PAYLOAD`. */
|
|
8
|
+
type ModelPayloadDebugMode = "off" | "summary" | "tools" | "full-redacted";
|
|
9
|
+
/** SSE debug detail levels accepted by `OPENCLAW_DEBUG_SSE`. */
|
|
10
|
+
type ModelSseDebugMode = "off" | "events" | "peek";
|
|
11
|
+
/** Resolves model payload debug verbosity from `OPENCLAW_DEBUG_MODEL_PAYLOAD`. */
|
|
12
|
+
declare function resolveModelPayloadDebugMode(env?: ModelTransportDebugEnv): ModelPayloadDebugMode;
|
|
13
|
+
/** Resolves SSE stream debug verbosity from `OPENCLAW_DEBUG_SSE`. */
|
|
14
|
+
declare function resolveModelSseDebugMode(env?: ModelTransportDebugEnv): ModelSseDebugMode;
|
|
15
|
+
/** Emits model-fetch metadata at info level by default; other diagnostics require debug env. */
|
|
16
|
+
declare function emitModelTransportDebug(log: SubsystemLogger, message: string): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region packages/ai/src/transports/model-transport-url.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Debug formatting helpers for model transport endpoints.
|
|
21
|
+
* Keeps logs useful without exposing credentials, request params, or fragments.
|
|
22
|
+
*/
|
|
23
|
+
/** Return a sanitized URL suitable for logs and diagnostics. */
|
|
24
|
+
declare function formatModelTransportDebugUrl(rawUrl: string): string;
|
|
25
|
+
/** Format a configured base URL for debug output, or the implicit default. */
|
|
26
|
+
declare function formatModelTransportDebugBaseUrl(rawUrl: string | undefined): string;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { resolveModelSseDebugMode as a, resolveModelPayloadDebugMode as i, formatModelTransportDebugUrl as n, emitModelTransportDebug as r, formatModelTransportDebugBaseUrl as t };
|