@xlaunch/llm 0.2.0-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/LICENSE +22 -0
- package/README.md +174 -0
- package/lib/index.js +2300 -0
- package/lib/invariant.js +84 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +547 -0
- package/lib/typert.remote-client.d.ts +26 -0
- package/lib/typert.remote-client.js +102 -0
- package/lib/types/adapter-failure.d.ts +14 -0
- package/lib/types/adapter-failure.js +105 -0
- package/lib/types/api-key.d.ts +28 -0
- package/lib/types/api-key.js +34 -0
- package/lib/types/assembler.d.ts +75 -0
- package/lib/types/assembler.js +191 -0
- package/lib/types/assistant-stream.d.ts +166 -0
- package/lib/types/assistant-stream.js +458 -0
- package/lib/types/attribution.d.ts +47 -0
- package/lib/types/attribution.js +46 -0
- package/lib/types/brand.d.ts +56 -0
- package/lib/types/brand.js +53 -0
- package/lib/types/call-config.d.ts +53 -0
- package/lib/types/call-config.js +46 -0
- package/lib/types/content.d.ts +130 -0
- package/lib/types/content.js +284 -0
- package/lib/types/error.d.ts +73 -0
- package/lib/types/error.js +145 -0
- package/lib/types/index.d.ts +408 -0
- package/lib/types/index.js +920 -0
- package/lib/types/invariant.d.ts +13 -0
- package/lib/types/invariant.js +100 -0
- package/lib/types/message.d.ts +197 -0
- package/lib/types/message.js +82 -0
- package/lib/types/retry-policy.d.ts +66 -0
- package/lib/types/retry-policy.js +127 -0
- package/lib/types/types.d.ts +430 -0
- package/lib/types/types.js +7 -0
- package/package.json +81 -0
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/** Package-owned LLM stream-protocol invariants. @module @xlaunch/llm/invariant */
|
|
3
|
+
const PACKAGE_NAME = "@xlaunch/llm";
|
|
4
|
+
/** Cordis companion plugin name. */
|
|
5
|
+
const name = "llm-invariant";
|
|
6
|
+
/** Service required before the companion can reserve package ownership. */
|
|
7
|
+
const inject = ["invariants"];
|
|
8
|
+
/** Require one chunk index to be a non-negative safe integer. */
|
|
9
|
+
function validateIndex(index, fail) {
|
|
10
|
+
if (!Number.isSafeInteger(index) || index < 0) fail(`LLM stream block index must be a non-negative safe integer, got ${index}`);
|
|
11
|
+
}
|
|
12
|
+
/** Require a delta to address an open block of its matching type. */
|
|
13
|
+
function validateDelta(open, index, expected, fail) {
|
|
14
|
+
validateIndex(index, fail);
|
|
15
|
+
const actual = open.get(index);
|
|
16
|
+
if (actual !== expected) fail(`${expected} delta at index ${index} requires an open ${expected} block, got ${String(actual)}`);
|
|
17
|
+
}
|
|
18
|
+
/** Wrap one provider stream and enforce its grammar as chunks are consumed. */
|
|
19
|
+
async function* validateStream(source, fail) {
|
|
20
|
+
const open = /* @__PURE__ */ new Map();
|
|
21
|
+
let usageSeen = false;
|
|
22
|
+
let finished = false;
|
|
23
|
+
for await (const chunk of source) {
|
|
24
|
+
if (finished) fail(`LLM stream emitted ${chunk.type} after terminal finish`);
|
|
25
|
+
switch (chunk.type) {
|
|
26
|
+
case "block-start":
|
|
27
|
+
validateIndex(chunk.index, fail);
|
|
28
|
+
if (open.has(chunk.index)) fail(`LLM stream repeated block-start index ${chunk.index}`);
|
|
29
|
+
open.set(chunk.index, chunk.blockType);
|
|
30
|
+
break;
|
|
31
|
+
case "text-delta":
|
|
32
|
+
validateDelta(open, chunk.index, "text", fail);
|
|
33
|
+
break;
|
|
34
|
+
case "reasoning-delta":
|
|
35
|
+
validateDelta(open, chunk.index, "reasoning", fail);
|
|
36
|
+
break;
|
|
37
|
+
case "tool-call-delta":
|
|
38
|
+
validateDelta(open, chunk.index, "tool-call", fail);
|
|
39
|
+
break;
|
|
40
|
+
case "block-end": {
|
|
41
|
+
validateIndex(chunk.index, fail);
|
|
42
|
+
const blockType = open.get(chunk.index);
|
|
43
|
+
if (blockType === void 0) fail(`LLM stream block-end index ${chunk.index} has no open block`);
|
|
44
|
+
if (chunk.block.type !== blockType) fail(`LLM stream block-end index ${chunk.index} closes ${chunk.block.type}, expected ${blockType}`);
|
|
45
|
+
open.delete(chunk.index);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "usage":
|
|
49
|
+
if (usageSeen) fail("LLM stream emitted usage more than once");
|
|
50
|
+
usageSeen = true;
|
|
51
|
+
break;
|
|
52
|
+
case "finish":
|
|
53
|
+
if (open.size > 0 && chunk.reason.kind !== "error" && chunk.reason.kind !== "aborted") fail(`LLM stream finished with ${open.size} open block(s)`);
|
|
54
|
+
finished = true;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
yield chunk;
|
|
58
|
+
}
|
|
59
|
+
if (!finished) fail("LLM stream ended without a terminal finish chunk");
|
|
60
|
+
}
|
|
61
|
+
/** Install validation around every provider stream. */
|
|
62
|
+
const install = (ctx, fail) => {
|
|
63
|
+
ctx.on("llm/stream", (_options, next) => validateStream(next(), fail), {
|
|
64
|
+
global: true,
|
|
65
|
+
prepend: true
|
|
66
|
+
});
|
|
67
|
+
ctx.on("llm/adapters-updated", () => {
|
|
68
|
+
const llm = ctx.get("llm");
|
|
69
|
+
if (llm === void 0) return;
|
|
70
|
+
for (const provider of llm.listProviders()) try {
|
|
71
|
+
llm.providerRetryPolicy(provider.id);
|
|
72
|
+
} catch {
|
|
73
|
+
fail(`llm/adapters-updated fired while provider "${provider.id}" has no readable registration`);
|
|
74
|
+
}
|
|
75
|
+
}, { global: true });
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Register the LLM invariant companion.
|
|
79
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
80
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
81
|
+
*/
|
|
82
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
83
|
+
//#endregion
|
|
84
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/* Generated by @xlaunch/typert-generator from FaceModel — do not edit. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
const _xlaunch_llm_llm_discoverModels_parameter_0$schema = z.string()
|
|
5
|
+
const _xlaunch_llm_llm_discoverModels_parameter_1$schema = z.object({
|
|
6
|
+
'provider': z.string().optional(),
|
|
7
|
+
'baseURL': z.string().optional(),
|
|
8
|
+
'api': z.string().optional(),
|
|
9
|
+
'apiKey': z.string().optional(),
|
|
10
|
+
})
|
|
11
|
+
const _xlaunch_llm_llm_discoverModels_result$schema = z.array(z.object({
|
|
12
|
+
'id': z.string(),
|
|
13
|
+
'name': z.string().optional(),
|
|
14
|
+
'contextWindow': z.number().optional(),
|
|
15
|
+
'maxTokens': z.number().optional(),
|
|
16
|
+
}))
|
|
17
|
+
const _xlaunch_llm_llm_listConfigurableProviders_result$schema = z.array(z.object({
|
|
18
|
+
'provider': z.string(),
|
|
19
|
+
'displayName': z.string(),
|
|
20
|
+
'settingsNs': z.string(),
|
|
21
|
+
'settingsPath': z.array(z.string()),
|
|
22
|
+
'declared': z.boolean().optional(),
|
|
23
|
+
}))
|
|
24
|
+
const _xlaunch_llm_llm_listProviders_result$schema = z.array(z.object({
|
|
25
|
+
'id': z.string(),
|
|
26
|
+
'name': z.string(),
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
export const TYPERT = {
|
|
30
|
+
package: '@xlaunch/llm',
|
|
31
|
+
face: 'host',
|
|
32
|
+
schemas: [
|
|
33
|
+
],
|
|
34
|
+
invocations: [
|
|
35
|
+
{
|
|
36
|
+
id: '@xlaunch/llm#llm/discoverModels',
|
|
37
|
+
service: 'llm',
|
|
38
|
+
namespace: 'llm',
|
|
39
|
+
method: 'discoverModels',
|
|
40
|
+
implementation: 'remoteDiscoverModels',
|
|
41
|
+
invocation: { kind: 'direct' },
|
|
42
|
+
parameters: [
|
|
43
|
+
{
|
|
44
|
+
name: 'settingsNs',
|
|
45
|
+
wire: 'settingsNs',
|
|
46
|
+
source: 'json',
|
|
47
|
+
codec: {
|
|
48
|
+
mode: 'strict',
|
|
49
|
+
typeSymbol: '@xlaunch/llm#llm/discoverModels:settingsNs',
|
|
50
|
+
schema: _xlaunch_llm_llm_discoverModels_parameter_0$schema,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'request',
|
|
55
|
+
wire: 'request',
|
|
56
|
+
source: 'json',
|
|
57
|
+
codec: {
|
|
58
|
+
mode: 'strict',
|
|
59
|
+
typeSymbol: '@xlaunch/llm/types#LlmModelDiscoveryRequest',
|
|
60
|
+
schema: _xlaunch_llm_llm_discoverModels_parameter_1$schema,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
cancellation: { parameter: 'signal' },
|
|
65
|
+
result: {
|
|
66
|
+
mode: 'strict',
|
|
67
|
+
typeSymbol: '@xlaunch/llm#llm/discoverModels:result',
|
|
68
|
+
schema: _xlaunch_llm_llm_discoverModels_result$schema,
|
|
69
|
+
},
|
|
70
|
+
sourceLocation: {"file":"packages/llm/llm/src/index.ts","line":625,"column":9},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: '@xlaunch/llm#llm/listConfigurableProviders',
|
|
74
|
+
service: 'llm',
|
|
75
|
+
namespace: 'llm',
|
|
76
|
+
method: 'listConfigurableProviders',
|
|
77
|
+
invocation: { kind: 'direct' },
|
|
78
|
+
parameters: [
|
|
79
|
+
],
|
|
80
|
+
result: {
|
|
81
|
+
mode: 'strict',
|
|
82
|
+
typeSymbol: '@xlaunch/llm#llm/listConfigurableProviders:result',
|
|
83
|
+
schema: _xlaunch_llm_llm_listConfigurableProviders_result$schema,
|
|
84
|
+
},
|
|
85
|
+
sourceLocation: {"file":"packages/llm/llm/src/index.ts","line":538,"column":3},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: '@xlaunch/llm#llm/listProviders',
|
|
89
|
+
service: 'llm',
|
|
90
|
+
namespace: 'llm',
|
|
91
|
+
method: 'listProviders',
|
|
92
|
+
invocation: { kind: 'direct' },
|
|
93
|
+
parameters: [
|
|
94
|
+
],
|
|
95
|
+
result: {
|
|
96
|
+
mode: 'strict',
|
|
97
|
+
typeSymbol: '@xlaunch/llm#llm/listProviders:result',
|
|
98
|
+
schema: _xlaunch_llm_llm_listProviders_result$schema,
|
|
99
|
+
},
|
|
100
|
+
sourceLocation: {"file":"packages/llm/llm/src/index.ts","line":466,"column":3},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
model: {
|
|
104
|
+
"services": [
|
|
105
|
+
{
|
|
106
|
+
"description": "The abstract `llm` service: an adapter registry plus a streaming model-call API, interceptable via the `llm/stream` waterfall.",
|
|
107
|
+
"summary": "The abstract `llm` service: an adapter registry plus a streaming model-call API, interceptable via the `llm/stream` waterfall.",
|
|
108
|
+
"tags": [],
|
|
109
|
+
"jsDoc": "/**\n * The abstract `llm` service: an adapter registry plus a streaming model-call\n * API, interceptable via the `llm/stream` waterfall.\n */",
|
|
110
|
+
"key": "llm",
|
|
111
|
+
"exportName": "LlmRuntime",
|
|
112
|
+
"members": [
|
|
113
|
+
{
|
|
114
|
+
"kind": "method",
|
|
115
|
+
"name": "registerAdapter",
|
|
116
|
+
"signature": "registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHandle",
|
|
117
|
+
"summary": "Register an adapter for the given provider routes.",
|
|
118
|
+
"jsDoc": "/**\n * Register an adapter for the given provider routes. Throws `LlmError` with code\n * `DUPLICATE_ADAPTER` if any provider already has an adapter (all-or-nothing).\n * Disposed with the fiber.\n * @param providers - every provider route this adapter should serve.\n * @param adapter - the adapter that streams calls for those providers.\n * @returns the disposer, carrying {@link AdapterRegistrationHandle.replace}.\n */"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"kind": "method",
|
|
122
|
+
"name": "listProviders",
|
|
123
|
+
"signature": "@Remote listProviders(): LlmProviderInfo[]",
|
|
124
|
+
"summary": "Describe provider routes with a registered adapter.",
|
|
125
|
+
"jsDoc": "/**\n * Describe provider routes with a registered adapter.\n * @returns detached provider metadata in registration order.\n */"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"kind": "method",
|
|
129
|
+
"name": "registerConfigurableProviders",
|
|
130
|
+
"signature": "registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): DirectoryRegistrationHandle",
|
|
131
|
+
"summary": "Declare provider routes an adapter plugin can activate through configuration.",
|
|
132
|
+
"jsDoc": "/**\n * Declare provider routes an adapter plugin can activate through\n * configuration. Registration is all-or-nothing: an empty list, invalid\n * entry, or a provider already declared by any registration throws\n * `LlmError` without registering the rest. Disposed with the fiber.\n * @param entries - every configurable provider this plugin owns.\n * @returns a handle that withdraws all of them, and can atomically replace them.\n */"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"kind": "method",
|
|
136
|
+
"name": "listConfigurableProviders",
|
|
137
|
+
"signature": "@Remote listConfigurableProviders(): LlmConfigurableProvider[]",
|
|
138
|
+
"summary": "List every declared configurable provider, registered or dormant.",
|
|
139
|
+
"jsDoc": "/**\n * List every declared configurable provider, registered or dormant.\n * @returns detached directory entries in declaration order.\n */"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"kind": "method",
|
|
143
|
+
"name": "registerModelDiscovery",
|
|
144
|
+
"signature": "registerModelDiscovery( settingsNs: string, discover: ( request: LlmModelDiscoveryRequest, signal?: AbortSignal, ) => Promise<readonly LlmDiscoveredModel[]>, ): () => void",
|
|
145
|
+
"summary": "Offer to interrogate provider endpoints on behalf of the settings namespace this plugin owns.",
|
|
146
|
+
"jsDoc": "/**\n * Offer to interrogate provider endpoints on behalf of the settings\n * namespace this plugin owns. The namespace is the key because that is what\n * a configuration surface already holds from the configurable-provider\n * directory, and because a provider being *added* has no route to name yet.\n * Disposed with the fiber.\n * @param settingsNs - the namespace whose profiles this discovery serves.\n * @param discover - interrogates one endpoint and must honor the supplied signal.\n * @returns the disposer that withdraws the offer.\n */"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"kind": "method",
|
|
150
|
+
"name": "discoverModels",
|
|
151
|
+
"signature": "async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal?: AbortSignal, ): Promise<LlmDiscoveredModel[]>",
|
|
152
|
+
"summary": "Interrogate one provider endpoint for the models it advertises.",
|
|
153
|
+
"jsDoc": "/**\n * Interrogate one provider endpoint for the models it advertises. The\n * request describes a draft, not a stored route, so nothing here reads or\n * writes settings or credentials — the caller owns both, and the reply is\n * candidate metadata a surface may offer for adoption.\n * @param settingsNs - namespace whose registered discovery serves this draft.\n * @param request - the endpoint, protocol, and one-shot credential to use.\n * @param signal - caller cancellation.\n * @returns the advertised models, deduplicated in endpoint order.\n */"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"kind": "method",
|
|
157
|
+
"name": "remoteDiscoverModels",
|
|
158
|
+
"signature": "@Remote('discoverModels') async remoteDiscoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal: AbortSignal, ): Promise<LlmDiscoveredModel[]>",
|
|
159
|
+
"summary": "Remote adapter for one draft provider interrogation.",
|
|
160
|
+
"jsDoc": "/**\n * Remote adapter for one draft provider interrogation.\n * @param settingsNs - namespace whose registered discovery serves this draft.\n * @param request - endpoint, protocol, and one-shot credential to use.\n * @param signal - caller cancellation supplied by the Remote carrier.\n * @returns advertised models in endpoint order.\n * @throws RemoteError with `llm/model-discovery-rejected` when discovery refuses or fails.\n */"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"kind": "method",
|
|
164
|
+
"name": "providerRetryPolicy",
|
|
165
|
+
"signature": "providerRetryPolicy(provider: string): ResolvedRetryPolicy",
|
|
166
|
+
"summary": "Resolve the retry policy captured when one provider route was registered.",
|
|
167
|
+
"jsDoc": "/**\n * Resolve the retry policy captured when one provider route was registered.\n * @param provider - registered provider route to inspect.\n * @returns the provider-owned policy, with normal defaults already resolved.\n */"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"kind": "method",
|
|
171
|
+
"name": "imageRequestPricing",
|
|
172
|
+
"signature": "imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined",
|
|
173
|
+
"summary": "Resolve provider-side request-image pricing for one exact route, or `undefined` when the provider is unregistered or declares none.",
|
|
174
|
+
"jsDoc": "/**\n * Resolve provider-side request-image pricing for one exact route, or\n * `undefined` when the provider is unregistered or declares none. Unknown\n * providers degrade to `undefined` rather than throwing because callers\n * price durable history whose route may no longer be mounted.\n * @param provider - provider route named by a request header.\n * @param model - exact model id named by the same header.\n * @returns the owning adapter's image pricing for the route, when declared.\n */"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"kind": "method",
|
|
178
|
+
"name": "fileRequestText",
|
|
179
|
+
"signature": "fileRequestText(ref: FileAttachmentRef): string",
|
|
180
|
+
"summary": "Resolve the exact text one durable file occurrence contributes to every provider request in the current execution environment.",
|
|
181
|
+
"jsDoc": "/**\n * Resolve the exact text one durable file occurrence contributes to every\n * provider request in the current execution environment.\n * @param ref - durable verbatim file reference from model history.\n * @returns the same deterministic handle text used at adapter dispatch.\n */"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"kind": "method",
|
|
185
|
+
"name": "listModels",
|
|
186
|
+
"signature": "async listModels(provider: string): Promise<LlmModelInfo[]>",
|
|
187
|
+
"summary": "Discover models advertised by one registered provider.",
|
|
188
|
+
"jsDoc": "/**\n * Discover models advertised by one registered provider. Catalog membership\n * is advisory and never changes routing or request validation.\n * @param provider - registered provider route to inspect.\n * @returns detached model metadata in adapter-preferred order.\n */"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"kind": "method",
|
|
192
|
+
"name": "resolveModelInfo",
|
|
193
|
+
"signature": "async resolveModelInfo( provider: string, model: string, signal?: AbortSignal, ): Promise<LlmResolvedModelInfo>",
|
|
194
|
+
"summary": "Resolve and validate all metadata from the adapter that owns one exact route.",
|
|
195
|
+
"jsDoc": "/**\n * Resolve and validate all metadata from the adapter that owns one exact\n * route. The result is detached from adapter-owned objects; catalog\n * membership remains advisory and does not control request routing.\n * @param provider - registered provider route to inspect.\n * @param model - exact model id passed to the adapter.\n * @param signal - optional cancellation for adapter-owned asynchronous lookup.\n * @returns exact model identity plus available context and reasoning metadata.\n */"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"kind": "method",
|
|
199
|
+
"name": "resolveCallConfig",
|
|
200
|
+
"signature": "async resolveCallConfig(config: LlmCallConfig, signal?: AbortSignal): Promise<LlmCallConfig>",
|
|
201
|
+
"summary": "Validate a conversation call config against its exact model capability and materialize adapter-configured defaults.",
|
|
202
|
+
"jsDoc": "/**\n * Validate a conversation call config against its exact model capability and\n * materialize adapter-configured defaults. Unsupported explicit efforts\n * reject before provider I/O; no clamping or aliasing is performed. This\n * standalone query does not bind a later dispatch; use {@link prepareCall}\n * when logging and streaming must share one adapter registration.\n * @param config - provider/model route and optional request controls.\n * @param signal - optional cancellation for adapter-owned capability lookup.\n * @returns a detached config only when a default must be materialized.\n */"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"kind": "method",
|
|
206
|
+
"name": "prepareCall",
|
|
207
|
+
"signature": "async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<PreparedLlmCall>",
|
|
208
|
+
"summary": "Resolve one call under its current adapter registration.",
|
|
209
|
+
"jsDoc": "/**\n * Resolve one call under its current adapter registration. The returned\n * one-shot handle keeps that registration across header logging and dispatch,\n * so HMR cannot combine one adapter's capability result with another adapter.\n * @param config - provider/model route and optional request controls.\n * @param signal - optional cancellation for adapter-owned capability lookup.\n * @returns a prepared config and its registration-bound stream entry point.\n */"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"kind": "method",
|
|
213
|
+
"name": "stream",
|
|
214
|
+
"signature": "stream(options: GenerateOptions): AsyncIterable<StreamChunk>",
|
|
215
|
+
"summary": "Stream one model call as raw chunks (token-level deltas).",
|
|
216
|
+
"jsDoc": "/**\n * Stream one model call as raw chunks (token-level deltas). Replay state is\n * retained only when the same adapter instance owns its historical provider\n * and the target provider. Final adapter selection remains fixed through\n * asynchronous exact-model resolution and dispatch. Adapter selection,\n * dispatch, and iteration failures become terminal `error` or `aborted`\n * finish chunks; middleware, nested-call, cleanup, and consumer failures\n * remain thrown.\n * @param options - the full request; `options.provider` selects the adapter.\n * @returns the chunk stream, possibly wrapped by `llm/stream` listeners.\n */"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"types": [
|
|
220
|
+
{
|
|
221
|
+
"name": "AdapterRegistrationHandle",
|
|
222
|
+
"declaration": "export interface AdapterRegistrationHandle {\n (): void;\n replace(providers: string[]): void;\n}"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "AgentInstructionChange",
|
|
226
|
+
"declaration": "export interface AgentInstructionChange {\n action: 'set' | 'replace' | 'remove';\n scope: string;\n path: string;\n digest?: string;\n}"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "AgentInstructionSource",
|
|
230
|
+
"declaration": "export interface AgentInstructionSource {\n kind: 'agent-instructions';\n form: 'instructions';\n baseline?: true;\n baselineIdentity?: string;\n changes: AgentInstructionChange[];\n}"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "AgentMessageSource",
|
|
234
|
+
"declaration": "export interface AgentMessageSource {\n readonly kind: 'agent-message';\n readonly form: 'relay';\n readonly senderSessionId: SessionId;\n}"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "AssistantProvenance",
|
|
238
|
+
"declaration": "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "AttachmentId",
|
|
242
|
+
"declaration": "export type AttachmentId = Branded<'AttachmentId'>;"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "Branded",
|
|
246
|
+
"declaration": "export type Branded<B extends string> = string & { readonly [BRAND]: B; };"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "BrandedNumber",
|
|
250
|
+
"declaration": "export type BrandedNumber<B extends string> = number & { readonly [BRAND]: B; };"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "ContentBlock",
|
|
254
|
+
"declaration": "export type ContentBlock = ContentBlockMap[ContentBlockType];"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "ContentBlockMap",
|
|
258
|
+
"declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n file: FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": "ContentBlockType",
|
|
262
|
+
"declaration": "export type ContentBlockType = keyof ContentBlockMap;"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "ContextFormed",
|
|
266
|
+
"declaration": "export type ContextFormed = { readonly form?: never; } | { readonly form: 'instructions'; } | { readonly form: 'catalog'; } | { readonly form: 'snapshot'; readonly sections: readonly ContextSnapshotSection[]; } | { readonly form: 'notice'; readonly summary: string; } | { readonly form: 'relay'; } | { readonly form: 'recall'; };"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "ContextSnapshotSection",
|
|
270
|
+
"declaration": "export interface ContextSnapshotSection {\n readonly name: string;\n readonly text: string;\n}"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "DirectoryRegistrationHandle",
|
|
274
|
+
"declaration": "export interface DirectoryRegistrationHandle {\n (): void;\n replace(entries: readonly LlmConfigurableProvider[]): void;\n}"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "FileAttachmentRef",
|
|
278
|
+
"declaration": "export interface FileAttachmentRef {\n attachmentId: AttachmentId;\n name: string;\n bytes: number;\n}"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "FileBlock",
|
|
282
|
+
"declaration": "export interface FileBlock {\n type: 'file';\n attachment: FileAttachmentRef;\n}"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"name": "FinishReason",
|
|
286
|
+
"declaration": "export type FinishReason = FinishReasonMap[keyof FinishReasonMap];"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "FinishReasonMap",
|
|
290
|
+
"declaration": "export interface FinishReasonMap {\n stop: { kind: 'stop'; };\n 'tool-calls': { kind: 'tool-calls'; };\n 'max-tokens': { kind: 'max-tokens'; };\n aborted: { kind: 'aborted'; failure: LlmFailure; };\n error: { kind: 'error'; failure: LlmFailure; };\n}"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "GenerateOptions",
|
|
294
|
+
"declaration": "export interface GenerateOptions {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n messages: Message[];\n system?: string;\n tools?: ToolSchema[];\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n signal?: AbortSignal;\n sessionId?: Branded<'SessionId'>;\n purpose?: 'compaction' | 'session-title';\n}"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "GoalId",
|
|
298
|
+
"declaration": "export type GoalId = Branded<'GoalId'>;"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "GoalMessageSource",
|
|
302
|
+
"declaration": "export interface GoalMessageSource {\n readonly kind: 'goal';\n readonly goalId: GoalId;\n readonly revision: number;\n readonly round: number;\n}"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"name": "ImageAttachmentRef",
|
|
306
|
+
"declaration": "export interface ImageAttachmentRef {\n attachmentId: AttachmentId;\n mediaType: ImageMediaType;\n bytes: number;\n width: number;\n height: number;\n name?: string;\n originalDimensions?: { width: number; height: number; };\n}"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "ImageBlock",
|
|
310
|
+
"declaration": "export interface ImageBlock {\n type: 'image';\n attachment: ImageAttachmentRef;\n}"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "ImageMediaType",
|
|
314
|
+
"declaration": "export type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"name": "LlmAdapter",
|
|
318
|
+
"declaration": "export abstract class LlmAdapter {\n providerInfo(provider: string): LlmProviderInfo;\n providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;\n imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;\n listModels(_provider: string): Promise<readonly LlmModelInfo[]>;\n resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<LlmResolvedModelInfo>;\n prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;\n abstract stream(options: GenerateOptions): AsyncIterable<StreamChunk>;\n}"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"name": "LlmCallConfig",
|
|
322
|
+
"declaration": "export interface LlmCallConfig {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n}"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "LlmCallConfigAdapterDefaults",
|
|
326
|
+
"declaration": "export interface LlmCallConfigAdapterDefaults {\n reasoningEffort?: true;\n maxTokens?: true;\n}"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"name": "LlmConfigurableProvider",
|
|
330
|
+
"declaration": "export interface LlmConfigurableProvider {\n provider: string;\n displayName: string;\n settingsNs: string;\n settingsPath: readonly string[];\n declared?: boolean;\n}"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"name": "LlmDiscoveredModel",
|
|
334
|
+
"declaration": "export interface LlmDiscoveredModel {\n id: string;\n name?: string;\n contextWindow?: number;\n maxTokens?: number;\n}"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"name": "LlmFailure",
|
|
338
|
+
"declaration": "export interface LlmFailure {\n readonly message: string;\n readonly code: string;\n readonly status?: number;\n readonly providerRetryAfterMs?: number;\n readonly requestId?: ProviderRequestId;\n}"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "LlmImageRequestPrice",
|
|
342
|
+
"declaration": "export interface LlmImageRequestPrice {\n visualTokens: number;\n text: string;\n}"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"name": "LlmImageRequestPricing",
|
|
346
|
+
"declaration": "export interface LlmImageRequestPricing {\n priceImages(images: readonly ImageAttachmentRef[]): readonly LlmImageRequestPrice[];\n}"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"name": "LlmModelContext",
|
|
350
|
+
"declaration": "export interface LlmModelContext {\n contextWindow: number;\n}"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "LlmModelDiscoveryRequest",
|
|
354
|
+
"declaration": "export interface LlmModelDiscoveryRequest {\n provider?: string;\n baseURL?: string;\n api?: string;\n apiKey?: string;\n}"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"name": "LlmModelInfo",
|
|
358
|
+
"declaration": "export interface LlmModelInfo {\n provider: string;\n id: string;\n name: string;\n description?: string;\n inputModalities?: readonly ModelModality[];\n}"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"name": "LlmModelReasoningInfo",
|
|
362
|
+
"declaration": "export interface LlmModelReasoningInfo {\n efforts: readonly LlmReasoningEffortInfo[];\n defaultEffort?: ReasoningEffortId;\n}"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"name": "LlmProviderInfo",
|
|
366
|
+
"declaration": "export interface LlmProviderInfo {\n id: string;\n name: string;\n}"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"name": "LlmReasoningEffortInfo",
|
|
370
|
+
"declaration": "export interface LlmReasoningEffortInfo {\n id: ReasoningEffortId;\n name: string;\n description?: string;\n}"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"name": "LlmResolvedModelInfo",
|
|
374
|
+
"declaration": "export interface LlmResolvedModelInfo extends LlmModelInfo {\n context?: LlmModelContext;\n defaultMaxTokens?: number;\n reasoning?: LlmModelReasoningInfo;\n}"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"name": "Message",
|
|
378
|
+
"declaration": "export interface Message {\n readonly id: MessageId;\n readonly role: 'system' | 'user' | 'assistant';\n readonly content: ContentBlock[];\n readonly source: MessageSource;\n}"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"name": "MessageId",
|
|
382
|
+
"declaration": "export type MessageId = Branded<'MessageId'>;"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"name": "MessageSource",
|
|
386
|
+
"declaration": "export type MessageSource = MessageSourceMap[keyof MessageSourceMap];"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "MessageSourceMap",
|
|
390
|
+
"declaration": "export interface MessageSourceMap {\n user: { kind: 'user'; };\n plugin: { kind: 'plugin'; plugin: string; } & ContextFormed;\n model: ModelMessageSource;\n tool: ToolMessageSource;\n 'agent-message': AgentMessageSource;\n 'subagent-settled': SubagentSettledMessageSource;\n 'agent-instructions': AgentInstructionSource;\n 'user-rpc': { kind: 'user'; rpcId: SessionRequestId; clientTimeZone?: string; };\n 'skill-invocation': SkillInvocationSource;\n goal: GoalMessageSource;\n 'session-reference': SessionReferenceSource;\n}"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "ModelMessageSource",
|
|
394
|
+
"declaration": "export interface ModelMessageSource extends AssistantProvenance {\n kind: 'model';\n}"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"name": "ModelModality",
|
|
398
|
+
"declaration": "export type ModelModality = ModelModalityMap[keyof ModelModalityMap];"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"name": "ModelModalityMap",
|
|
402
|
+
"declaration": "export interface ModelModalityMap {\n text: 'text';\n image: 'image';\n}"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"name": "OptionalSessionSeq",
|
|
406
|
+
"declaration": "export type OptionalSessionSeq = SessionSeq | null;"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "PreparedAdapterCall",
|
|
410
|
+
"declaration": "export interface PreparedAdapterCall {\n readonly model: LlmResolvedModelInfo;\n stream(options: GenerateOptions): AsyncIterable<StreamChunk>;\n}"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "PreparedLlmCall",
|
|
414
|
+
"declaration": "export interface PreparedLlmCall {\n readonly config: LlmCallConfig;\n readonly retryPolicy: ResolvedRetryPolicy;\n readonly context?: LlmModelContext;\n readonly inputModalities?: readonly ModelModality[];\n readonly adapterDefaults: LlmCallConfigAdapterDefaults;\n stream(options: GenerateOptions): AsyncIterable<StreamChunk>;\n}"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"name": "ProviderRequestId",
|
|
418
|
+
"declaration": "export type ProviderRequestId = Branded<'ProviderRequestId'>;"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "ReasoningBlock",
|
|
422
|
+
"declaration": "export interface ReasoningBlock {\n type: 'reasoning';\n text: string;\n}"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "ReasoningEffortId",
|
|
426
|
+
"declaration": "export type ReasoningEffortId = Branded<'ReasoningEffortId'>;"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"name": "ReplayEnvelope",
|
|
430
|
+
"declaration": "export interface ReplayEnvelope {\n response: unknown;\n blocks?: readonly unknown[];\n}"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "ResolvedAlwaysRetryPolicy",
|
|
434
|
+
"declaration": "export interface ResolvedAlwaysRetryPolicy extends ResolvedRetryBackoff {\n readonly mode: 'always';\n}"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"name": "ResolvedNormalRetryPolicy",
|
|
438
|
+
"declaration": "export interface ResolvedNormalRetryPolicy extends ResolvedRetryBackoff {\n readonly mode: 'normal';\n readonly maxRetries: number;\n readonly retryableCodes: readonly string[];\n}"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"name": "ResolvedRetryBackoff",
|
|
442
|
+
"declaration": "export interface ResolvedRetryBackoff {\n readonly initialDelayMs: number;\n readonly maxDelayMs: number;\n readonly jitterRatio: number;\n}"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "ResolvedRetryPolicy",
|
|
446
|
+
"declaration": "export type ResolvedRetryPolicy = ResolvedNormalRetryPolicy | ResolvedAlwaysRetryPolicy;"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"name": "SessionId",
|
|
450
|
+
"declaration": "export type SessionId = Branded<'SessionId'>;"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "SessionReferenceSource",
|
|
454
|
+
"declaration": "export interface SessionReferenceSource {\n kind: 'session-reference';\n form: 'recall';\n version: 1;\n references: { sessionId: string; label: string; capturedFormatVersion?: number; capturedThroughSeq: OptionalSessionSeq; compacted: boolean; originalMessages: number; retainedMessages: number; omittedMessages: number; omittedBytes: number; truncated: boolean; inputIndex: number; }[];\n}"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"name": "SessionRequestId",
|
|
458
|
+
"declaration": "export type SessionRequestId = Branded<'session-request-id'>;"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"name": "SessionSeq",
|
|
462
|
+
"declaration": "export type SessionSeq = BrandedNumber<'SessionSeq'>;"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"name": "SkillInvocationSource",
|
|
466
|
+
"declaration": "export interface SkillInvocationSource {\n readonly kind: 'skill-invocation';\n readonly name: string;\n readonly form: 'instructions';\n}"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "StreamChunk",
|
|
470
|
+
"declaration": "export type StreamChunk = { type: 'block-start'; index: number; blockType: ContentBlockType; } | { type: 'text-delta'; index: number; text: string; } | { type: 'reasoning-delta'; index: number; text: string; } | { type: 'tool-call-delta'; index: number; id: ToolCallId; name?: string; argumentsDelta: string; } | { type: 'block-end'; index: number; block: ContentBlock; } | { type: 'usage'; usage: TokenUsage; } | { type: 'finish'; reason: FinishReason; replayState?: ReplayEnvelope; };"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"name": "SubagentSettledMessageSource",
|
|
474
|
+
"declaration": "export interface SubagentSettledMessageSource {\n readonly kind: 'subagent-settled';\n readonly form: 'notice';\n readonly summary: string;\n readonly senderSessionId: SessionId;\n}"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"name": "TextBlock",
|
|
478
|
+
"declaration": "export interface TextBlock {\n type: 'text';\n text: string;\n}"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"name": "TokenUsage",
|
|
482
|
+
"declaration": "export interface TokenUsage {\n inputTokens: number;\n outputTokens: number;\n totalTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n reasoningTokens?: number;\n}"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"name": "ToolCallBlock",
|
|
486
|
+
"declaration": "export interface ToolCallBlock {\n type: 'tool-call';\n id: ToolCallId;\n name: string;\n arguments: string;\n}"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"name": "ToolCallId",
|
|
490
|
+
"declaration": "export type ToolCallId = Branded<'ToolCallId'>;"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "ToolMessageSource",
|
|
494
|
+
"declaration": "export interface ToolMessageSource {\n kind: 'tool';\n callId: ToolCallId;\n}"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "ToolResultBlock",
|
|
498
|
+
"declaration": "export interface ToolResultBlock {\n type: 'tool-result';\n toolCallId: ToolCallId;\n content: ContentBlock[];\n isError?: boolean;\n}"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"name": "ToolSchema",
|
|
502
|
+
"declaration": "export interface ToolSchema {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n}"
|
|
503
|
+
}
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
],
|
|
507
|
+
"events": [
|
|
508
|
+
{
|
|
509
|
+
"description": "The provider topology changed: an adapter registered or unregistered routes, or the configurable-provider directory gained or lost entries. This payload-free registry notification fires at each commit point (including registration disposal); consumers re-read `listProviders()`, `listModels()`, or `listConfigurableProviders()` for the new state. Observer failures are contained and cannot veto the registry mutation.",
|
|
510
|
+
"summary": "The provider topology changed: an adapter registered or unregistered routes, or the configurable-provider directory gained or lost entries.",
|
|
511
|
+
"tags": [
|
|
512
|
+
{
|
|
513
|
+
"name": "mode",
|
|
514
|
+
"comment": "emit",
|
|
515
|
+
"text": "@mode emit"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"jsDoc": "/**\n * The provider topology changed: an adapter registered or unregistered\n * routes, or the configurable-provider directory gained or lost entries.\n * This payload-free registry notification fires at each commit point\n * (including registration disposal); consumers re-read `listProviders()`,\n * `listModels()`, or `listConfigurableProviders()` for the new state.\n * Observer failures are contained and cannot veto the registry mutation.\n * @mode emit\n */",
|
|
519
|
+
"name": "llm/adapters-updated",
|
|
520
|
+
"mode": "emit",
|
|
521
|
+
"signature": "'llm/adapters-updated'(): void"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"description": "Waterfall around every streaming model call (retry, replay, routing). Bound to the {@link LlmRuntime}; call `next()` to reach the resolved adapter's stream, or yield your own chunks to short-circuit.",
|
|
525
|
+
"summary": "Waterfall around every streaming model call (retry, replay, routing).",
|
|
526
|
+
"tags": [
|
|
527
|
+
{
|
|
528
|
+
"name": "param",
|
|
529
|
+
"argument": "options",
|
|
530
|
+
"comment": "- the full request. A LOOP-built request carries the process-local {@link markAgentLoopRequest} identity and arrives deep-frozen (mutation throws): its content is a pure function of the session log (the reconstructability Agent Note), so listeners read it, never rewrite it. Hand-built calls do not carry that marker; their messages already obey the immutable creation contract.",
|
|
531
|
+
"text": "@param options - the full request. A LOOP-built request carries the\n * process-local {@link markAgentLoopRequest} identity and arrives deep-frozen\n * (mutation throws): its content is a pure function of the session log (the\n * reconstructability Agent Note), so listeners read it, never rewrite it.\n * Hand-built calls do not carry that marker; their messages already obey\n * the immutable creation contract.\n *"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "mode",
|
|
535
|
+
"comment": "waterfall",
|
|
536
|
+
"text": "@mode waterfall"
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
"jsDoc": "/**\n * Waterfall around every streaming model call (retry, replay, routing).\n * Bound to the {@link LlmRuntime}; call `next()` to reach the resolved\n * adapter's stream, or yield your own chunks to short-circuit.\n * @param options - the full request. A LOOP-built request carries the\n * process-local {@link markAgentLoopRequest} identity and arrives deep-frozen\n * (mutation throws): its content is a pure function of the session log (the\n * reconstructability Agent Note), so listeners read it, never rewrite it.\n * Hand-built calls do not carry that marker; their messages already obey\n * the immutable creation contract.\n * @mode waterfall\n */",
|
|
540
|
+
"name": "llm/stream",
|
|
541
|
+
"mode": "waterfall",
|
|
542
|
+
"signature": "'llm/stream'(this: LlmRuntime, options: GenerateOptions, next: () => AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>"
|
|
543
|
+
}
|
|
544
|
+
],
|
|
545
|
+
"objects": []
|
|
546
|
+
},
|
|
547
|
+
}
|