@openclaw/ai 2026.11.5 → 2026.11.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/{anthropic-CNEzO12C.mjs → anthropic-CBz5v2U3.mjs} +16 -15
- package/dist/{anthropic-payload-policy-DVk38bnY.d.mts → anthropic-payload-policy-BTrHSS_v.d.mts} +4 -8
- package/dist/{anthropic-stream-lifecycle-DJUtasDB.mjs → anthropic-stream-lifecycle-96vq-4V9.mjs} +154 -88
- package/dist/{anthropic-tool-projection-DcvsDiyX.mjs → anthropic-tool-projection-A9GceDnD.mjs} +4 -5
- package/dist/{anthropic-tool-projection-DKAlondV.d.mts → anthropic-tool-projection-DCOX8qai.d.mts} +1 -3
- package/dist/{api-registry-DY2MLUyg.d.mts → api-registry-DUEK-a3o.d.mts} +2 -4
- package/dist/{assistant-message-events-CHMJgbhs.mjs → assistant-message-events-DtSjIQmB.mjs} +1 -2
- package/dist/{assistant-output-C3czmoN4.mjs → assistant-output-kYOaiso5.mjs} +2 -3
- package/dist/{azure-openai-responses-client-compat-D0dvJMbZ.mjs → azure-deployment-map-hwDQc3uL.mjs} +2 -16
- package/dist/{azure-openai-responses-DRkduRmW.mjs → azure-openai-responses-CZheDTt_.mjs} +12 -12
- package/dist/azure-openai-responses-client-compat-DLsS6V6z.mjs +13 -0
- package/dist/{base64-C8CdcsjU.mjs → base64-FdymvxN9.mjs} +1 -2
- package/dist/cloudflare-BCLfDuew.mjs +15 -0
- package/dist/{credential-redaction-DrgndwTJ.d.mts → credential-redaction-BNv5SWQz.d.mts} +0 -2
- package/dist/{deferred-event-buffer-tIGkTkTm.mjs → deferred-event-buffer-BgT1IIfq.mjs} +1 -2
- package/dist/{diagnostics-CloVGQiK.mjs → diagnostics-BNlb1zlT.mjs} +12 -19
- package/dist/{diagnostics-o1PrVNQb.mjs → diagnostics-DP1SXgAW.mjs} +1 -2
- package/dist/diagnostics.d.mts +6 -10
- package/dist/diagnostics.mjs +3 -3
- package/dist/{env-api-keys-BuHc86ya.mjs → env-api-keys-DlUbTgKq.mjs} +1 -2
- package/dist/{event-stream-BYmtRe8-.d.mts → event-stream-BJS9Q8G_.d.mts} +1 -3
- package/dist/{event-stream-X2gmsUWv.mjs → event-stream-Bf6cK7-d.mjs} +1 -2
- package/dist/event-stream-CPiqa8PI.d.mts +1 -0
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -1
- package/dist/{expect-lbe3Hgrh.mjs → expect-DqyhV9d8.mjs} +1 -2
- package/dist/github-copilot-headers-CqLRrd-i.mjs +22 -0
- package/dist/{github-copilot-request-facts-BZ_EMo7X.mjs → github-copilot-request-facts-BxuLEdNF.mjs} +2 -3
- package/dist/{google-DqG05iBa.mjs → google-BUgkXPYL.mjs} +6 -7
- package/dist/{google-interactions-BE7cxFPc.mjs → google-interactions-84f0xFly.mjs} +36 -25
- package/dist/{google-messages-p2iBzsAp.mjs → google-messages-Dip5zphv.mjs} +16 -20
- package/dist/{google-provider-stream-DZ6tqteU.mjs → google-provider-stream-COaKMdQv.mjs} +14 -15
- package/dist/{google-shared-BMYt1xSI.mjs → google-shared-Dooy5JJL.mjs} +11 -14
- package/dist/{google-vertex-CAq2q1Ln.mjs → google-vertex--S8AlXUD.mjs} +4 -5
- package/dist/{google-video-slots-Bxt-OXO8.mjs → google-video-slots-CzdrKzrO.mjs} +2 -3
- package/dist/{host-DqX-64Pb.mjs → host-Cf7zb-48.mjs} +73 -89
- package/dist/{host-ccbwPC3A.d.mts → host-Dgpzj407.d.mts} +3 -5
- package/dist/{host-policy-Bk85E9ue.mjs → host-policy-B1qzS7Xe.mjs} +2 -3
- package/dist/{index-Bczt0MnO.d.mts → index-BDF5kurq.d.mts} +10 -10
- package/dist/index.d.mts +8 -10
- package/dist/index.mjs +11 -11
- package/dist/internal/anthropic.d.mts +10 -21
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.d.mts +1 -3
- package/dist/internal/google-model-family.mjs +2 -3
- package/dist/internal/google.d.mts +3 -5
- package/dist/internal/google.mjs +1 -1
- package/dist/internal/model-request-body.d.mts +5 -5
- package/dist/internal/model-request-body.mjs +19 -6
- package/dist/internal/openai-completions-compat.d.mts +1 -3
- package/dist/internal/openai-completions-compat.mjs +2 -2
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -4
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +10 -32
- package/dist/internal/openai.mjs +12 -11
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +0 -4
- package/dist/internal/reasoning-tag-text-partitioner.mjs +64 -125
- package/dist/internal/retry-after.d.mts +1 -1
- package/dist/internal/retry-after.mjs +1 -2
- package/dist/internal/runtime.d.mts +9 -43
- package/dist/internal/runtime.mjs +14 -15
- package/dist/internal/session-resources.d.mts +11 -0
- package/dist/{session-resources-vKvGIE3J.mjs → internal/session-resources.mjs} +2 -3
- package/dist/internal/shared.d.mts +17 -26
- package/dist/internal/shared.mjs +10 -10
- package/dist/internal/tool-schema.d.mts +2 -22
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{llm-request-activity-DzaHoRAU.mjs → llm-request-activity-v1liRqNt.mjs} +1 -2
- package/dist/{mistral-DIGInqJI.mjs → mistral-BAps5cN2.mjs} +713 -299
- package/dist/{model-transport-url-BdksnBqu.d.mts → model-transport-url-Dad-sfx2.d.mts} +0 -4
- package/dist/{number-coercion-C7HsBgUL.mjs → number-coercion-BO6bhGm6.mjs} +2 -3
- package/dist/{observe-async-iterator-DgmegcZR.mjs → observe-async-iterator-DdOlbgrr.mjs} +1 -2
- package/dist/{observe-async-iterator-AlARO5wS.d.mts → observe-async-iterator-DeB_Vxes.d.mts} +14 -7
- package/dist/openai-BtJTmLWF.mjs +21460 -0
- package/dist/{openai-chatgpt-jwt-KWcgd0d_.mjs → openai-chatgpt-jwt-v5F5jJmX.mjs} +1 -2
- package/dist/{openai-chatgpt-responses-C6rEZcsZ.mjs → openai-chatgpt-responses-CYXMKG89.mjs} +53 -49
- package/dist/{openai-completions-B93R3N3b.mjs → openai-completions-Bi4Ghg3V.mjs} +6 -7
- package/dist/{openai-completions-compat-CJ-NsDzg.d.mts → openai-completions-compat-BJBQ682M.d.mts} +10 -5
- package/dist/{openai-completions-compat-CS3dlDBR.mjs → openai-completions-compat-DZLGotNt.mjs} +19 -16
- package/dist/{openai-completions-reasoning-replay-BwT1xwRI.mjs → openai-completions-reasoning-replay-DyH5XzNo.mjs} +1 -2
- package/dist/{openai-completions-transport-DHTFq-BM.mjs → openai-completions-transport-otONaRhv.mjs} +160 -527
- package/dist/{openai-prompt-cache-BZGaIWYh.d.mts → openai-prompt-cache-C5rwtmA_.d.mts} +2 -4
- package/dist/{openai-prompt-cache-3H_Fz0ya.mjs → openai-prompt-cache-CJv1bvw0.mjs} +3 -5
- package/dist/openai-provider-client-apBsWo9b.mjs +51 -0
- package/dist/{openai-responses-DSxPKV0U.mjs → openai-responses-CiIAm8fJ.mjs} +14 -14
- package/dist/{openai-responses-compaction-replay-DXF5BjD2.d.mts → openai-responses-compaction-replay-CUw4owu9.d.mts} +6 -7
- package/dist/{openai-responses-contracts-Cb1IIRRG.d.mts → openai-responses-contracts-bYtvXSvv.d.mts} +7 -12
- package/dist/{openai-responses-contracts-xU-n9AJJ.mjs → openai-responses-contracts-eppTI5DQ.mjs} +11 -18
- package/dist/{openai-responses-endpoint-CqO3ejTe.mjs → openai-responses-endpoint-AeVu3HmP.mjs} +80 -34
- package/dist/{openai-responses-payload-policy-BsQaD-gD.d.mts → openai-responses-payload-policy-Cihgy9fC.d.mts} +0 -2
- package/dist/{openai-responses-request-lifecycle-C_3FKkl7.mjs → openai-responses-request-lifecycle-DfE4xNHj.mjs} +120 -20
- package/dist/{openai-responses-shared-En3Jf0Vg.mjs → openai-responses-shared-BAJzOqwt.mjs} +1649 -312
- package/dist/{openai-responses-terminal-usage-D7IhRA6i.d.mts → openai-responses-terminal-usage-BYXQTt9u.d.mts} +2 -4
- package/dist/openai-responses-websocket-DywDiO81.mjs +8143 -0
- package/dist/{openai-stop-reason-8s70vDXj.mjs → openai-stop-reason-cA0GUHlU.mjs} +4 -3
- package/dist/{openai-tool-schema-CvxySRyf.mjs → openai-tool-schema-Ca74_fkR.mjs} +17 -26
- package/dist/openai.LICENSE +201 -0
- package/dist/{otel-B2u5HGvm.mjs → otel-C5Cn7IFQ.mjs} +8 -8
- package/dist/{overflow-CpApyjG2.mjs → overflow-CM0yZomw.mjs} +2 -3
- package/dist/{positive-integer-DiqE5vNi.mjs → positive-integer-AM4ltyhP.mjs} +2 -3
- package/dist/{prompt-cache-stability-w-ICeyOI.mjs → prompt-cache-stability-oTx0nIsh.mjs} +3 -4
- package/dist/{prompt-cache-stability-Cwcjv_fx.d.mts → prompt-cache-stability-xNfkD-3g.d.mts} +0 -2
- package/dist/{provider-error-DD-fo4Rz.mjs → provider-error-B7aKA_dg.mjs} +24 -23
- package/dist/{provider-error-CnaWYTRY.d.mts → provider-error-DZMru0Jv.d.mts} +0 -2
- package/dist/{provider-options-BQ2Msop2.d.mts → provider-options-CR_UfgUE.d.mts} +15 -11
- package/dist/{provider-replay-context--QGWotXx.mjs → provider-replay-context-CHJQzB0n.mjs} +3 -4
- package/dist/{provider-transcript-transform-Hr1kCoMX.mjs → provider-transcript-transform-C-WfgiLJ.mjs} +2 -3
- package/dist/{provider-transport-turn-state-DyaOKAYm.mjs → provider-transport-turn-state-BdMA1v46.mjs} +4 -27
- package/dist/{provider-types-B1e98js5.d.mts → provider-types-CfiTmXyw.d.mts} +3 -5
- package/dist/provider-types.d.mts +7 -7
- package/dist/provider-types.mjs +1 -2
- package/dist/providers.d.mts +2 -4
- package/dist/providers.mjs +14 -15
- package/dist/{record-coerce-BQaoiN3r.mjs → record-coerce-BgUo6bj4.mjs} +1 -2
- package/dist/{request-headers-DO4Mqhw1.mjs → request-headers-DJ4QrMC_.mjs} +1 -2
- package/dist/{required-api-key-2zZTkmsi.mjs → required-api-key-BniLGxy4.mjs} +2 -3
- package/dist/{retry-after-DnHBlFS2.d.mts → retry-after-f3ZIm8TA.d.mts} +0 -2
- package/dist/rolldown-runtime-DYf_mQCB.mjs +34 -0
- package/dist/{sanitize-unicode-CRGuMONI.mjs → sanitize-unicode-B3kUqQ-q.mjs} +1 -2
- package/dist/{sanitize-unicode-BISmUlUv.d.mts → sanitize-unicode-DlVtgmsw.d.mts} +2 -6
- package/dist/{session-affinity-DA4WHv1h.mjs → session-affinity-Czm9tjAm.mjs} +1 -2
- package/dist/{simple-options-CQNPKCEb.mjs → simple-options-D8CTqHvk.mjs} +40 -16
- package/dist/src-CNWvILd1.mjs +2 -0
- package/dist/{src-CQ7nH2mL.mjs → src-CmBmaGOV.mjs} +87 -20
- package/dist/{stable-stringify-CchQEmeA.mjs → stable-stringify-CGB-o900.mjs} +10 -8
- package/dist/{stream-DM-q0y5H.mjs → stream-BEE5qy7Z.mjs} +5 -7
- package/dist/{stream-first-event-timeout-B7RcufAV.mjs → stream-first-event-timeout-CWiv_y--.mjs} +2 -3
- package/dist/{streaming-byte-guard-DBXr1XYn.mjs → streaming-byte-guard-gOcUrHJF.mjs} +1 -2
- package/dist/{string-coerce-BCuWMIrk.mjs → string-coerce-CpcyRbc6.mjs} +1 -2
- package/dist/{string-normalization-B8TDDBX_.mjs → string-normalization-CS77PHD3.mjs} +2 -3
- package/dist/{telemetry-DJibfNKZ.mjs → telemetry-Cd4i-clM.mjs} +6 -8
- package/dist/{tool-schema-json-projection-BSHb4gaJ.mjs → tool-schema-json-projection-C13fPskA.mjs} +11 -16
- package/dist/{transport-stream-shared-CBVh6QEc.mjs → transport-stream-shared-DEpLe9fG.mjs} +24 -30
- package/dist/{transport-stream-shared-D3IAU4jn.d.mts → transport-stream-shared-DW4DoJLv.d.mts} +7 -8
- package/dist/{transport-utils-rxOHnq9y.mjs → transport-utils-Cx9L80PZ.mjs} +6 -8
- package/dist/transports.d.mts +29 -82
- package/dist/transports.mjs +39 -38
- package/dist/{types-BVdTf0YV.d.mts → types-BNp71XKW.d.mts} +11 -6
- package/dist/types-CwcLeW-7.d.mts +1 -0
- package/dist/{types-OVEWUaDh.mjs → types-DIBUKaTM.mjs} +1 -2
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +9 -9
- package/dist/{usage-CJH5D6Ea.mjs → usage-B8ggJtuG.mjs} +1 -2
- package/dist/{validation-QmyD0E5A.d.mts → validation-BFNWNeUl.d.mts} +1 -3
- package/dist/{validation-DGXqfvkj.mjs → validation-BO7nCOKO.mjs} +5 -8
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/ws.LICENSE +20 -0
- package/dist/x509-transport-state-D4gFbgWG.mjs +40 -0
- package/package.json +13 -7
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +0 -1
- package/dist/cloudflare-BJ2_Xabx.mjs +0 -39
- package/dist/event-stream-B4ZcSvsu.d.mts +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/src-BUsVkrNt.mjs +0 -105
- package/dist/types-Cb3-5WM9.d.mts +0 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { G as ProviderStreamOptions, N as ModelThinkingLevel, a as AssistantMessage, at as StreamOptions, d as Context, gt as Usage, k as Model, n as Api, s as AssistantMessageEventStreamContract, tt as SimpleStreamOptions } from "../types-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { i as getEventStreamCompletion } from "../event-stream-
|
|
4
|
-
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-
|
|
5
|
-
import
|
|
6
|
-
import "
|
|
7
|
-
import { n as isContextOverflow, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
8
|
-
import {
|
|
9
|
-
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
1
|
+
import { G as ProviderStreamOptions, N as ModelThinkingLevel, a as AssistantMessage, at as StreamOptions, d as Context, gt as Usage, k as Model, n as Api, s as AssistantMessageEventStreamContract, tt as SimpleStreamOptions } from "../types-BNp71XKW.mjs";
|
|
2
|
+
import "../index-BDF5kurq.mjs";
|
|
3
|
+
import { i as getEventStreamCompletion } from "../event-stream-BJS9Q8G_.mjs";
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-DUEK-a3o.mjs";
|
|
5
|
+
import "../types-CwcLeW-7.mjs";
|
|
6
|
+
import { SessionResourceCleanup, SessionResourceOwner, cleanupSessionResources, getSessionResourceOwnerId, registerSessionResourceCleanup } from "./session-resources.mjs";
|
|
7
|
+
import { n as isContextOverflow, t as sanitizeSurrogates } from "../sanitize-unicode-DlVtgmsw.mjs";
|
|
8
|
+
import { b as parseTerminalToolCallArguments } from "../transport-stream-shared-DW4DoJLv.mjs";
|
|
10
9
|
export declare const defaultApiRegistry: {
|
|
11
10
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
12
11
|
getApiProvider: (api: Api) => RegisteredApiProvider | undefined;
|
|
@@ -49,8 +48,6 @@ declare const { stream, complete, streamSimple, completeSimple }: {
|
|
|
49
48
|
completeSimple: <TApi extends Api>(model: Model<TApi>, context: Context, options?: SimpleStreamOptions) => Promise<AssistantMessage>;
|
|
50
49
|
cleanupSessionResources: (sessionId?: string) => void;
|
|
51
50
|
};
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region packages/ai/src/env-api-keys.d.ts
|
|
54
51
|
/**
|
|
55
52
|
* Find configured environment variables that can provide an API key for a provider.
|
|
56
53
|
*
|
|
@@ -65,8 +62,6 @@ export declare function findEnvKeys(provider: string): string[] | undefined;
|
|
|
65
62
|
* Will not return API keys for providers that require OAuth tokens.
|
|
66
63
|
*/
|
|
67
64
|
export declare function getEnvApiKey(provider: string): string | undefined;
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region packages/ai/src/model-utils.d.ts
|
|
70
65
|
/** Calculates and stores model cost fields from token usage and per-million pricing. */
|
|
71
66
|
export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage["cost"];
|
|
72
67
|
/** Replaces the catalog estimate when the provider reports an authoritative billed total. */
|
|
@@ -77,20 +72,6 @@ export declare function getSupportedThinkingLevels<TApi extends Api>(model: Mode
|
|
|
77
72
|
export declare function clampThinkingLevel<TApi extends Api>(model: Model<TApi>, level: ModelThinkingLevel): ModelThinkingLevel;
|
|
78
73
|
/** Compares model identity by provider and id. */
|
|
79
74
|
export declare function modelsAreEqual<TApi extends Api>(a: Model<TApi> | null | undefined, b: Model<TApi> | null | undefined): boolean;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region packages/ai/src/session-resources.d.ts
|
|
82
|
-
/** Runtime transport owner attached to retained provider resources. */
|
|
83
|
-
export type SessionResourceOwner = ReturnType<typeof getDefaultAiTransportHost>;
|
|
84
|
-
/** Cleanup callback for resources tied to an LLM session or all sessions. */
|
|
85
|
-
export type SessionResourceCleanup = (sessionId?: string, owner?: SessionResourceOwner) => void;
|
|
86
|
-
/** Returns a process-local key that keeps retained resources separated by runtime owner. */
|
|
87
|
-
export declare function getSessionResourceOwnerId(owner: SessionResourceOwner): number;
|
|
88
|
-
/** Registers a session-resource cleanup hook and returns an unregister function. */
|
|
89
|
-
export declare function registerSessionResourceCleanup(cleanup: SessionResourceCleanup): () => void;
|
|
90
|
-
/** Runs all registered cleanup hooks, aggregating failures after every hook has run. */
|
|
91
|
-
export declare function cleanupSessionResources(sessionId?: string, owner?: SessionResourceOwner): void;
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region packages/ai/src/utils/deferred-event-buffer.d.ts
|
|
94
75
|
export declare function createDeferredEventBuffer<T>(sink: {
|
|
95
76
|
push(event: T): void;
|
|
96
77
|
}): {
|
|
@@ -98,16 +79,10 @@ export declare function createDeferredEventBuffer<T>(sink: {
|
|
|
98
79
|
flush(): void;
|
|
99
80
|
discard(): void;
|
|
100
81
|
};
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region packages/ai/src/utils/hash.d.ts
|
|
103
82
|
/** Fast deterministic hash to shorten long strings */
|
|
104
83
|
export declare function shortHash(str: string): string;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region packages/ai/src/utils/headers.d.ts
|
|
107
84
|
/** Converts a Headers object to a plain record for provider request handling. */
|
|
108
85
|
export declare function headersToRecord(headers: Headers): Record<string, string>;
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region packages/ai/src/utils/json-parse.d.ts
|
|
111
86
|
/**
|
|
112
87
|
* Repairs malformed JSON string literals by:
|
|
113
88
|
* - escaping raw control characters inside strings
|
|
@@ -140,13 +115,9 @@ export type ToolArgumentPreviewSchedule = (accumulatedChars: number) => boolean;
|
|
|
140
115
|
* staleness, linear total parse work.
|
|
141
116
|
*/
|
|
142
117
|
export declare function createToolArgumentPreviewSchedule(): ToolArgumentPreviewSchedule;
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region packages/ai/src/utils/llm-request-activity.d.ts
|
|
145
118
|
type ActivityListener = (progress: boolean, progressTimeoutMs?: number) => void;
|
|
146
119
|
export declare function notifyLlmRequestActivity(signal: AbortSignal | undefined, progress?: boolean, progressTimeoutMs?: number): void;
|
|
147
120
|
export declare function onLlmRequestActivity(signal: AbortSignal, listener: ActivityListener): () => void;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region packages/ai/src/utils/oauth/openai-chatgpt-jwt.d.ts
|
|
150
121
|
declare const OPENAI_CODEX_AUTH_CLAIM = "https://api.openai.com/auth";
|
|
151
122
|
export type OpenAICodexJwtPayload = {
|
|
152
123
|
[OPENAI_CODEX_AUTH_CLAIM]?: {
|
|
@@ -156,8 +127,6 @@ export type OpenAICodexJwtPayload = {
|
|
|
156
127
|
};
|
|
157
128
|
export declare function decodeOpenAICodexJwtPayload(token: string): OpenAICodexJwtPayload | null;
|
|
158
129
|
export declare function resolveOpenAICodexAccountId(token: string): string | null;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region packages/ai/src/utils/stream-first-event-timeout.d.ts
|
|
161
130
|
export type FirstStreamEventTimeoutContext = {
|
|
162
131
|
provider?: string;
|
|
163
132
|
api?: string;
|
|
@@ -183,8 +152,6 @@ export declare function getFirstStreamEventTimeoutHandler(options: unknown): ((r
|
|
|
183
152
|
export declare function createFirstStreamEventTimeoutError(context: FirstStreamEventTimeoutContext): Error;
|
|
184
153
|
export declare function createFirstStreamEventAbortController(parentSignal?: AbortSignal): FirstStreamEventAbortController;
|
|
185
154
|
export declare function withFirstStreamEventTimeout<T>(stream: AsyncIterable<T>, context: FirstStreamEventTimeoutContext): AsyncIterable<T>;
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region packages/ai/src/utils/streaming-byte-guard.d.ts
|
|
188
155
|
/** Bounds cumulative stream bytes without waiting for reader cleanup after overflow. */
|
|
189
156
|
export type SseStreamOverflow = {
|
|
190
157
|
size: number;
|
|
@@ -204,5 +171,4 @@ export type SseByteGuard = {
|
|
|
204
171
|
export declare function createSseByteGuard(reader: ReadableStreamDefaultReader<Uint8Array>, opts: ReadSseStreamWithLimitOptions): SseByteGuard;
|
|
205
172
|
/** Lazily bound an SDK response while preserving upstream cancellation. */
|
|
206
173
|
export declare function boundResponseBody(response: Response, options: ReadSseStreamWithLimitOptions): Response;
|
|
207
|
-
|
|
208
|
-
export { complete, completeSimple, getApiProvider, getApiProviders, getEventStreamCompletion, isContextOverflow, parseTerminalToolCallArguments, sanitizeSurrogates, stream, streamSimple };
|
|
174
|
+
export { SessionResourceCleanup, SessionResourceOwner, cleanupSessionResources, complete, completeSimple, getApiProvider, getApiProviders, getEventStreamCompletion, getSessionResourceOwnerId, isContextOverflow, parseTerminalToolCallArguments, registerSessionResourceCleanup, sanitizeSurrogates, stream, streamSimple };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { o as getEventStreamCompletion } from "../event-stream-
|
|
2
|
-
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-
|
|
3
|
-
import { A as
|
|
4
|
-
import {
|
|
5
|
-
import { t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
6
|
-
import { A as
|
|
7
|
-
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-
|
|
8
|
-
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-
|
|
9
|
-
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-
|
|
10
|
-
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-
|
|
11
|
-
import { n as createSseByteGuard, t as boundResponseBody } from "../streaming-byte-guard-
|
|
12
|
-
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-
|
|
13
|
-
import { t as isContextOverflow } from "../overflow-
|
|
14
|
-
|
|
1
|
+
import { o as getEventStreamCompletion } from "../event-stream-Bf6cK7-d.mjs";
|
|
2
|
+
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-BEE5qy7Z.mjs";
|
|
3
|
+
import { A as headersToRecord, F as modelsAreEqual, M as calculateCost, N as clampThinkingLevel, P as getSupportedThinkingLevels, j as applyProviderReportedUsageCost } from "../host-Cf7zb-48.mjs";
|
|
4
|
+
import { cleanupSessionResources, getSessionResourceOwnerId, registerSessionResourceCleanup } from "./session-resources.mjs";
|
|
5
|
+
import { t as sanitizeSurrogates } from "../sanitize-unicode-B3kUqQ-q.mjs";
|
|
6
|
+
import { A as parseJsonWithRepair, M as repairJson, O as shortHash, j as parseStreamingJson, k as createToolArgumentPreviewSchedule, v as parseTerminalToolCallArguments } from "../transport-stream-shared-DEpLe9fG.mjs";
|
|
7
|
+
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-DlUbTgKq.mjs";
|
|
8
|
+
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-BgT1IIfq.mjs";
|
|
9
|
+
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-v1liRqNt.mjs";
|
|
10
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-CWiv_y--.mjs";
|
|
11
|
+
import { n as createSseByteGuard, t as boundResponseBody } from "../streaming-byte-guard-gOcUrHJF.mjs";
|
|
12
|
+
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-v5F5jJmX.mjs";
|
|
13
|
+
import { t as isContextOverflow } from "../overflow-CM0yZomw.mjs";
|
|
14
|
+
// packages/ai/src/internal/default-runtime.ts
|
|
15
15
|
const DEFAULT_RUNTIME_KEY = Symbol.for("openclaw.ai.defaultRuntime");
|
|
16
16
|
function resolveDefaultRuntime() {
|
|
17
17
|
const globalStore = globalThis;
|
|
@@ -29,5 +29,4 @@ const defaultApiRegistry = defaultRuntime.registry;
|
|
|
29
29
|
const defaultLlmRuntime = defaultRuntime.runtime;
|
|
30
30
|
const { getApiProvider, getApiProviders } = defaultApiRegistry;
|
|
31
31
|
const { stream, complete, streamSimple, completeSimple } = defaultLlmRuntime;
|
|
32
|
-
//#endregion
|
|
33
32
|
export { applyProviderReportedUsageCost, boundResponseBody, calculateCost, clampThinkingLevel, cleanupSessionResources, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSessionResourceOwnerId, getSupportedThinkingLevels, headersToRecord, isContextOverflow, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { m as getDefaultAiTransportHost } from "../host-Dgpzj407.mjs";
|
|
2
|
+
/** Runtime transport owner attached to retained provider resources. */
|
|
3
|
+
export type SessionResourceOwner = ReturnType<typeof getDefaultAiTransportHost>;
|
|
4
|
+
/** Cleanup callback for resources tied to an LLM session or all sessions. */
|
|
5
|
+
export type SessionResourceCleanup = (sessionId?: string, owner?: SessionResourceOwner) => void;
|
|
6
|
+
/** Returns a process-local key that keeps retained resources separated by runtime owner. */
|
|
7
|
+
export declare function getSessionResourceOwnerId(owner: SessionResourceOwner): number;
|
|
8
|
+
/** Registers a session-resource cleanup hook and returns an unregister function. */
|
|
9
|
+
export declare function registerSessionResourceCleanup(cleanup: SessionResourceCleanup): () => void;
|
|
10
|
+
/** Runs all registered cleanup hooks, aggregating failures after every hook has run. */
|
|
11
|
+
export declare function cleanupSessionResources(sessionId?: string, owner?: SessionResourceOwner): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/session-resources.ts
|
|
2
2
|
const sessionResourceCleanups = /* @__PURE__ */ new Set();
|
|
3
3
|
const sessionResourceOwnerIds = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
let nextSessionResourceOwnerId = 1;
|
|
@@ -27,5 +27,4 @@ function cleanupSessionResources(sessionId, owner) {
|
|
|
27
27
|
}
|
|
28
28
|
if (errors.length > 0) throw new AggregateError(errors, "Failed to cleanup session resources");
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
export { getSessionResourceOwnerId as n, registerSessionResourceCleanup as r, cleanupSessionResources as t };
|
|
30
|
+
export { cleanupSessionResources, getSessionResourceOwnerId, registerSessionResourceCleanup };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { O as Message, a as AssistantMessage, ct as ThinkingBudgets, d as Context, k as Model, n as Api, tt as SimpleStreamOptions, ut as ThinkingLevel, z as PreparedSystemPrompt } from "../types-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { a as readAssistantThinkingAppend } from "../event-stream-
|
|
4
|
-
import "../types-
|
|
5
|
-
import { u as ProviderStreamOptions } from "../provider-types-
|
|
6
|
-
import { f as preparedRequestSuffix } from "../provider-options-
|
|
1
|
+
import { O as Message, a as AssistantMessage, ct as ThinkingBudgets, d as Context, k as Model, n as Api, tt as SimpleStreamOptions, ut as ThinkingLevel, z as PreparedSystemPrompt } from "../types-BNp71XKW.mjs";
|
|
2
|
+
import "../index-BDF5kurq.mjs";
|
|
3
|
+
import { a as readAssistantThinkingAppend } from "../event-stream-BJS9Q8G_.mjs";
|
|
4
|
+
import "../types-CwcLeW-7.mjs";
|
|
5
|
+
import { u as ProviderStreamOptions } from "../provider-types-CfiTmXyw.mjs";
|
|
6
|
+
import { f as preparedRequestSuffix, m as uncachedSuffixMessage } from "../provider-options-CR_UfgUE.mjs";
|
|
7
7
|
import { serializeModelRequestBody } from "./model-request-body.mjs";
|
|
8
|
-
import { r as matchesContextOverflowMessage, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
9
|
-
import { i as projectProviderError } from "../provider-error-
|
|
10
|
-
import {
|
|
11
|
-
import { i as projectPreparedDiagnosticValue, n as isCredentialFieldName } from "../credential-redaction-
|
|
12
|
-
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-
|
|
13
|
-
//#region packages/ai/src/providers/simple-options.d.ts
|
|
8
|
+
import { r as matchesContextOverflowMessage, t as sanitizeSurrogates } from "../sanitize-unicode-DlVtgmsw.mjs";
|
|
9
|
+
import { i as projectProviderError } from "../provider-error-DZMru0Jv.mjs";
|
|
10
|
+
import { h as iterateSseFrames } from "../transport-stream-shared-DW4DoJLv.mjs";
|
|
11
|
+
import { i as projectPreparedDiagnosticValue, n as isCredentialFieldName } from "../credential-redaction-BNv5SWQz.mjs";
|
|
12
|
+
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-xNfkD-3g.mjs";
|
|
14
13
|
type FirstEventStreamOptions = {
|
|
15
14
|
firstEventTimeoutMs?: number;
|
|
16
15
|
onFirstEventTimeout?: (reason: Error) => void;
|
|
@@ -24,8 +23,6 @@ export declare function adjustMaxTokensForThinking(baseMaxTokens: number | undef
|
|
|
24
23
|
maxTokens: number;
|
|
25
24
|
thinkingBudget: number;
|
|
26
25
|
};
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region packages/ai/src/providers/tool-result-text.d.ts
|
|
29
26
|
export declare function describeToolResultMediaPlaceholder(blocks: readonly unknown[]): string | undefined;
|
|
30
27
|
export declare function extractToolResultBlockText(block: unknown): string | undefined;
|
|
31
28
|
export declare function extractToolResultText(blocks: readonly unknown[], options?: {
|
|
@@ -42,8 +39,6 @@ export declare function formatToolResultText(params: {
|
|
|
42
39
|
omittedMediaPlaceholder?: string;
|
|
43
40
|
isError: boolean;
|
|
44
41
|
}): string;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region packages/ai/src/media-payload.d.ts
|
|
47
42
|
/** Media metadata alone is not an attachment; provider emitters need inline bytes. */
|
|
48
43
|
export declare function hasMediaPayload(block: unknown): block is Record<string, unknown> & {
|
|
49
44
|
data: string;
|
|
@@ -53,11 +48,7 @@ export declare function isImageWithMediaPayload<T>(block: T): block is T & {
|
|
|
53
48
|
type: "image";
|
|
54
49
|
data: string;
|
|
55
50
|
};
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region packages/ai/src/transcript-transform.d.ts
|
|
58
51
|
export declare function transformMessages<TApi extends Api>(messages: Message[], model: Model<TApi>, normalizeToolCallId?: (id: string, model: Model<TApi>, source: AssistantMessage) => string): Message[];
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region packages/ai/src/replay-turn-classification.d.ts
|
|
61
52
|
type AssistantTurnLike = {
|
|
62
53
|
role?: unknown;
|
|
63
54
|
stopReason?: unknown;
|
|
@@ -75,8 +66,6 @@ export declare const FAILED_ASSISTANT_REPLAY_TEXT = "[This turn failed before it
|
|
|
75
66
|
export declare function resolveFailedAssistantReplay(message: AssistantTurnLike, options: {
|
|
76
67
|
pairingAware: boolean;
|
|
77
68
|
}): "keep" | "drop" | "marker";
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region packages/ai/src/utils/system-prompt-cache-boundary.d.ts
|
|
80
69
|
export declare const SYSTEM_PROMPT_CACHE_BOUNDARY = "\n<!-- OPENCLAW_CACHE_BOUNDARY -->\n";
|
|
81
70
|
/** Producer-delimited Runtime facts; instructions must remain outside this region. */
|
|
82
71
|
export declare const SYSTEM_PROMPT_RELOCATABLE_BOUNDARY = "\n<!-- OPENCLAW-RELOCATABLE-BOUNDARY -->\n";
|
|
@@ -96,14 +85,17 @@ export declare function splitSystemPromptCacheBoundary(text: string): {
|
|
|
96
85
|
stablePrefix: string;
|
|
97
86
|
dynamicSuffix: string;
|
|
98
87
|
} | undefined;
|
|
88
|
+
/** Keep the stripped prompt's separator in wire text while marking its stable prefix. */
|
|
89
|
+
export declare function splitSystemPromptCacheBoundaryForWire(text: string): {
|
|
90
|
+
stablePrefix: string;
|
|
91
|
+
dynamicSuffix: string;
|
|
92
|
+
} | undefined;
|
|
99
93
|
/** Keep explicit cache breakpoints while removing relocation metadata. */
|
|
100
94
|
export declare function stripSystemPromptRelocatableBoundary(text: string): string;
|
|
101
95
|
export declare function prependSystemPromptAdditionAfterCacheBoundary(params: {
|
|
102
96
|
systemPrompt: string;
|
|
103
97
|
systemPromptAddition?: string;
|
|
104
98
|
}): string;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region packages/ai/src/providers/github-copilot-request-facts.d.ts
|
|
107
99
|
/** Request facts shared by Copilot transports; identity headers remain plugin-owned. */
|
|
108
100
|
export declare function projectCopilotRequestFacts(messages: readonly {
|
|
109
101
|
role: string;
|
|
@@ -114,5 +106,4 @@ export declare function projectCopilotRequestFacts(messages: readonly {
|
|
|
114
106
|
initiator: "user" | "agent";
|
|
115
107
|
hasImages: boolean;
|
|
116
108
|
};
|
|
117
|
-
|
|
118
|
-
export { isCredentialFieldName, iterateSseFrames, matchesContextOverflowMessage, normalizePromptCapabilityIds, normalizeStructuredPromptSection, preparedRequestSuffix, projectPreparedDiagnosticValue, projectProviderError, readAssistantThinkingAppend, sanitizeSurrogates, serializeModelRequestBody, sortPromptCacheToolsByName };
|
|
109
|
+
export { isCredentialFieldName, iterateSseFrames, matchesContextOverflowMessage, normalizePromptCapabilityIds, normalizeStructuredPromptSection, preparedRequestSuffix, projectPreparedDiagnosticValue, projectProviderError, readAssistantThinkingAppend, sanitizeSurrogates, serializeModelRequestBody, sortPromptCacheToolsByName, uncachedSuffixMessage };
|
package/dist/internal/shared.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { s as readAssistantThinkingAppend } from "../event-stream-
|
|
2
|
-
import {
|
|
3
|
-
import { i as isCredentialFieldName, n as projectProviderError, o as projectPreparedDiagnosticValue } from "../provider-error-
|
|
4
|
-
import { t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
5
|
-
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-
|
|
6
|
-
import { C as
|
|
7
|
-
import {
|
|
1
|
+
import { s as readAssistantThinkingAppend } from "../event-stream-Bf6cK7-d.mjs";
|
|
2
|
+
import { I as hasMediaPayload, L as isImageWithMediaPayload, c as transformMessages, d as hasOnlyAssistantReasoningContent, f as isReasoningOnlyLengthAssistantTurn, l as FAILED_ASSISTANT_REPLAY_TEXT, m as resolveFailedAssistantReplay, p as isStreamErrorFallbackContent, u as STREAM_ERROR_FALLBACK_TEXT } from "../host-Cf7zb-48.mjs";
|
|
3
|
+
import { i as isCredentialFieldName, n as projectProviderError, o as projectPreparedDiagnosticValue } from "../provider-error-B7aKA_dg.mjs";
|
|
4
|
+
import { t as sanitizeSurrogates } from "../sanitize-unicode-B3kUqQ-q.mjs";
|
|
5
|
+
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-oTx0nIsh.mjs";
|
|
6
|
+
import { C as splitSystemPromptCacheBoundaryForWire, E as stripSystemPromptRelocatableBoundary, S as splitSystemPromptCacheBoundary, T as stripSystemPromptCacheBoundary, _ as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, a as describeToolResultMediaPlaceholder, b as prepareSystemPrompt, c as extractToolResultText, f as preparedRequestSuffix, g as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, h as SYSTEM_PROMPT_CACHE_BOUNDARY, i as clampReasoning, l as formatToolResultText, m as uncachedSuffixMessage, n as buildBaseOptions, o as describeUnsupportedToolResultMedia, r as clampMaxTokensToModel, s as extractToolResultBlockText, t as adjustMaxTokensForThinking, v as createSystemPromptCacheBoundaryStripper, w as splitSystemPromptRelocatableBoundary, x as prependSystemPromptAdditionAfterCacheBoundary, y as ensureSystemPromptCacheBoundary } from "../simple-options-D8CTqHvk.mjs";
|
|
7
|
+
import { p as iterateSseFrames } from "../transport-stream-shared-DEpLe9fG.mjs";
|
|
8
8
|
import { serializeModelRequestBody } from "./model-request-body.mjs";
|
|
9
|
-
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-
|
|
10
|
-
import { n as matchesContextOverflowMessage } from "../overflow-
|
|
11
|
-
export { FAILED_ASSISTANT_REPLAY_TEXT, STREAM_ERROR_FALLBACK_TEXT, SYSTEM_PROMPT_CACHE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, createSystemPromptCacheBoundaryStripper, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, hasOnlyAssistantReasoningContent, isCredentialFieldName, isImageWithMediaPayload, isReasoningOnlyLengthAssistantTurn, isStreamErrorFallbackContent, iterateSseFrames, matchesContextOverflowMessage, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prepareSystemPrompt, preparedRequestSuffix, prependSystemPromptAdditionAfterCacheBoundary, projectCopilotRequestFacts, projectPreparedDiagnosticValue, projectProviderError, readAssistantThinkingAppend, resolveFailedAssistantReplay, sanitizeSurrogates, serializeModelRequestBody, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, splitSystemPromptRelocatableBoundary, stripSystemPromptCacheBoundary, stripSystemPromptRelocatableBoundary, transformMessages };
|
|
9
|
+
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-BxuLEdNF.mjs";
|
|
10
|
+
import { n as matchesContextOverflowMessage } from "../overflow-CM0yZomw.mjs";
|
|
11
|
+
export { FAILED_ASSISTANT_REPLAY_TEXT, STREAM_ERROR_FALLBACK_TEXT, SYSTEM_PROMPT_CACHE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, createSystemPromptCacheBoundaryStripper, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, hasOnlyAssistantReasoningContent, isCredentialFieldName, isImageWithMediaPayload, isReasoningOnlyLengthAssistantTurn, isStreamErrorFallbackContent, iterateSseFrames, matchesContextOverflowMessage, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prepareSystemPrompt, preparedRequestSuffix, prependSystemPromptAdditionAfterCacheBoundary, projectCopilotRequestFacts, projectPreparedDiagnosticValue, projectProviderError, readAssistantThinkingAppend, resolveFailedAssistantReplay, sanitizeSurrogates, serializeModelRequestBody, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, splitSystemPromptCacheBoundaryForWire, splitSystemPromptRelocatableBoundary, stripSystemPromptCacheBoundary, stripSystemPromptRelocatableBoundary, transformMessages, uncachedSuffixMessage };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as prepareAnthropicInputSchema } from "../anthropic-tool-projection-
|
|
1
|
+
import { g as OpenAIToolProjection } from "../provider-options-CR_UfgUE.mjs";
|
|
2
|
+
import { a as prepareAnthropicInputSchema } from "../anthropic-tool-projection-DCOX8qai.mjs";
|
|
3
3
|
import { TSchema } from "typebox";
|
|
4
|
-
//#region packages/ai/src/providers/agent-tools-parameter-schema.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Narrow structural view of the host's model compat config. packages/ai must stay
|
|
7
6
|
* config-agnostic, so only tool-schema-relevant fields are modeled here; the host's
|
|
@@ -32,20 +31,14 @@ export type ToolParameterSchemaOptions = {
|
|
|
32
31
|
};
|
|
33
32
|
/** Return a provider-compatible JSON schema for a model-facing tool. */
|
|
34
33
|
export declare function normalizeToolParameterSchema(schema: unknown, options?: ToolParameterSchemaOptions): TSchema;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region packages/ai/src/providers/clean-for-gemini.d.ts
|
|
37
34
|
export declare const GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS: Set<string>;
|
|
38
35
|
export declare function cleanSchemaForGemini(schema: unknown, toolName?: string): TSchema;
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region packages/ai/src/providers/clean-for-llamacpp-gbnf.d.ts
|
|
41
36
|
/** llama.cpp rejects grammar repetitions whose expanded rule count reaches 2000. */
|
|
42
37
|
export declare const LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD = 2000;
|
|
43
38
|
/** Removes JSON Schema constraints that llama.cpp cannot compile into GBNF. */
|
|
44
39
|
export declare function cleanSchemaForLlamacppGbnf(schema: unknown, toolName?: string): unknown;
|
|
45
40
|
/** Reports schema paths that llama.cpp cannot compile into GBNF. */
|
|
46
41
|
export declare function findLlamacppGbnfSchemaViolations(schema: unknown, path: string): string[];
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region packages/ai/src/providers/openai-tool-schema-compat.d.ts
|
|
49
42
|
/** Repairs recoverable OpenAI tool-schema shapes before canonical normalization. */
|
|
50
43
|
export declare function normalizeOpenAIStrictCompatSchema(schema: unknown, toolName?: string): TSchema;
|
|
51
44
|
/** Finds nested open dictionaries whose keys compatibility normalization closes. */
|
|
@@ -54,8 +47,6 @@ export declare function findCompatClosedObjectPaths(schema: unknown, path: strin
|
|
|
54
47
|
export declare function findOpenAIStrictSchemaViolations(schema: unknown, path: string, options?: {
|
|
55
48
|
requireObjectRoot?: boolean;
|
|
56
49
|
}): string[];
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region packages/ai/src/providers/openai-tool-schema.d.ts
|
|
59
50
|
type ToolSchemaCompatInput = {
|
|
60
51
|
unsupportedToolSchemaKeywords?: unknown;
|
|
61
52
|
omitEmptyArrayItems?: unknown;
|
|
@@ -74,8 +65,6 @@ export declare function findOpenAIStrictToolProjectionDiagnostics(projection: Op
|
|
|
74
65
|
}[];
|
|
75
66
|
/** Resolves strict mode for the projected tools that will be emitted in the request payload. */
|
|
76
67
|
export declare function resolveOpenAIProjectedToolsStrictToolFlag(projection: OpenAIToolProjection, strict: boolean | null | undefined): boolean | undefined;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region packages/ai/src/providers/openai-function-tool.d.ts
|
|
79
68
|
type OpenAIFunctionDescriptor = {
|
|
80
69
|
name: string;
|
|
81
70
|
description: string | undefined;
|
|
@@ -91,12 +80,8 @@ export declare function prepareOpenAIFunctionTool(name: string, description: str
|
|
|
91
80
|
function: OpenAIFunctionDescriptor;
|
|
92
81
|
};
|
|
93
82
|
};
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region packages/ai/src/providers/schema-keyword-strip.d.ts
|
|
96
83
|
/** Remove schema keywords unsupported by a target provider/tool surface. */
|
|
97
84
|
export declare function stripUnsupportedSchemaKeywords(schema: unknown, unsupportedKeywords: ReadonlySet<string>): unknown;
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region packages/ai/src/providers/tool-schema-depth.d.ts
|
|
100
85
|
/** Schema nodes and expanded references share this budget; containers are transparent. */
|
|
101
86
|
export declare const MAX_TOOL_SCHEMA_DEPTH = 128;
|
|
102
87
|
export type ToolSchemaPosition = {
|
|
@@ -111,12 +96,8 @@ export declare function inheritToolSchemaTruncation<T>(source: unknown, result:
|
|
|
111
96
|
export declare function reportToolSchemaTruncation(schema: unknown, toolName?: string): void;
|
|
112
97
|
/** Bound schema structure without changing literal data or caching mutable provider inputs. */
|
|
113
98
|
export declare function truncateToolSchemaDepth(schema: unknown, toolName?: string): unknown;
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region packages/ai/src/providers/schema-walk.d.ts
|
|
116
99
|
export declare const SCHEMA_MAP_KEYS: Set<string>;
|
|
117
100
|
export declare const SCHEMA_NESTED_KEYS: Set<string>;
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region packages/ai/src/providers/tool-schema-json-projection.d.ts
|
|
120
101
|
/** JSON-safe schema value used when projecting runtime tool parameters. */
|
|
121
102
|
type RuntimeToolInputSchemaJson = null | boolean | number | string | RuntimeToolInputSchemaJson[] | {
|
|
122
103
|
[key: string]: RuntimeToolInputSchemaJson;
|
|
@@ -137,5 +118,4 @@ export declare function getPublishedRuntimeToolInputSchema(schema: unknown): Pub
|
|
|
137
118
|
export declare function publishRuntimeToolInputSchema(schema: unknown, path?: string, toolName?: string): RuntimeToolInputSchemaProjection;
|
|
138
119
|
/** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
|
|
139
120
|
export declare function projectRuntimeToolInputSchema(schema: unknown, path?: string, toolName?: string): RuntimeToolInputSchemaProjection;
|
|
140
|
-
//#endregion
|
|
141
121
|
export { type RuntimeToolInputSchemaJson, type RuntimeToolInputSchemaProjection, prepareAnthropicInputSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as MAX_TOOL_SCHEMA_DEPTH, f as inheritToolSchemaTruncation, g as wasToolSchemaTruncated, h as truncateToolSchemaDepth, i as publishRuntimeToolInputSchema, m as toolSchemaChildPosition, p as reportToolSchemaTruncation, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, v as SCHEMA_MAP_KEYS, y as SCHEMA_NESTED_KEYS } from "../tool-schema-json-projection-
|
|
2
|
-
import { r as prepareAnthropicInputSchema } from "../anthropic-tool-projection-
|
|
3
|
-
import { _ as cleanSchemaForLlamacppGbnf, a as resolveOpenAIProjectedToolsStrictToolFlag, b as cleanSchemaForGemini, c as normalizeOpenAIStrictCompatSchema, d as resolveUnsupportedToolSchemaKeywords, f as shouldOmitEmptyArrayItems, g as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, h as stripUnsupportedSchemaKeywords, i as normalizeStrictOpenAIJsonSchema, l as extractToolSchemaModelCompat, n as isStrictOpenAIJsonSchemaCompatible, o as findCompatClosedObjectPaths, r as normalizeOpenAIStrictToolParameters, s as findOpenAIStrictSchemaViolations, t as findOpenAIStrictToolProjectionDiagnostics, u as normalizeToolParameterSchema, v as findLlamacppGbnfSchemaViolations, x as prepareOpenAIFunctionTool, y as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS } from "../openai-tool-schema-
|
|
1
|
+
import { d as MAX_TOOL_SCHEMA_DEPTH, f as inheritToolSchemaTruncation, g as wasToolSchemaTruncated, h as truncateToolSchemaDepth, i as publishRuntimeToolInputSchema, m as toolSchemaChildPosition, p as reportToolSchemaTruncation, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, v as SCHEMA_MAP_KEYS, y as SCHEMA_NESTED_KEYS } from "../tool-schema-json-projection-C13fPskA.mjs";
|
|
2
|
+
import { r as prepareAnthropicInputSchema } from "../anthropic-tool-projection-A9GceDnD.mjs";
|
|
3
|
+
import { _ as cleanSchemaForLlamacppGbnf, a as resolveOpenAIProjectedToolsStrictToolFlag, b as cleanSchemaForGemini, c as normalizeOpenAIStrictCompatSchema, d as resolveUnsupportedToolSchemaKeywords, f as shouldOmitEmptyArrayItems, g as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, h as stripUnsupportedSchemaKeywords, i as normalizeStrictOpenAIJsonSchema, l as extractToolSchemaModelCompat, n as isStrictOpenAIJsonSchemaCompatible, o as findCompatClosedObjectPaths, r as normalizeOpenAIStrictToolParameters, s as findOpenAIStrictSchemaViolations, t as findOpenAIStrictToolProjectionDiagnostics, u as normalizeToolParameterSchema, v as findLlamacppGbnfSchemaViolations, x as prepareOpenAIFunctionTool, y as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS } from "../openai-tool-schema-Ca74_fkR.mjs";
|
|
4
4
|
export { GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, MAX_TOOL_SCHEMA_DEPTH, SCHEMA_MAP_KEYS, SCHEMA_NESTED_KEYS, cleanSchemaForGemini, cleanSchemaForLlamacppGbnf, extractToolSchemaModelCompat, findCompatClosedObjectPaths, findLlamacppGbnfSchemaViolations, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, getPublishedRuntimeToolInputSchema, inheritToolSchemaTruncation, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, prepareAnthropicInputSchema, prepareOpenAIFunctionTool, projectRuntimeToolInputSchema, publishRuntimeToolInputSchema, reportToolSchemaTruncation, resolveOpenAIProjectedToolsStrictToolFlag, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, stripUnsupportedSchemaKeywords, toolSchemaChildPosition, truncateToolSchemaDepth, wasToolSchemaTruncated };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/ai/src/utils/llm-request-activity.ts
|
|
2
2
|
const requestActivityListeners = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function notifyLlmRequestActivity(signal, progress = true, progressTimeoutMs) {
|
|
4
4
|
if (!signal) return;
|
|
@@ -12,5 +12,4 @@ function onLlmRequestActivity(signal, listener) {
|
|
|
12
12
|
if (listeners.delete(listener) && listeners.size === 0) requestActivityListeners.delete(signal);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { onLlmRequestActivity as n, notifyLlmRequestActivity as t };
|