@lunora/agent 1.0.0-alpha.1 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/channels.d.mts +17 -5
- package/dist/channels.d.ts +17 -5
- package/dist/component.d.mts +14 -0
- package/dist/component.d.ts +14 -0
- package/dist/inbound.d.mts +7 -2
- package/dist/inbound.d.ts +7 -2
- package/dist/index.d.mts +136 -28
- package/dist/index.d.ts +136 -28
- package/dist/naming.d.mts +17 -4
- package/dist/naming.d.ts +17 -4
- package/dist/packem_shared/{types.d-BWG0uUtX.d.mts → types.d-BhJFTvz_.d.mts} +123 -24
- package/dist/packem_shared/{types.d-BWG0uUtX.d.ts → types.d-BhJFTvz_.d.ts} +123 -24
- package/dist/sandbox.d.mts +19 -4
- package/dist/sandbox.d.ts +19 -4
- package/dist/telemetry/index.d.mts +28 -5
- package/dist/telemetry/index.d.ts +28 -5
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentDefinition, c as AgentCompact, d as AgentEpisodeExtract, e as AgentGraphExtract, f as AgentGenerate, g as AgentTokenSink, h as AgentRunInput, i as AgentFunctionPaths, j as AgentRunFunction, k as AgentStepLike, l as AgentStreamGenerate, m as AgentRunResult, n as AgentMessageRow, o as AgentConfig, S as SkillDefinition, p as AnyAgentTool, q as AgentAsToolOptions, r as AgentSubToolInput, b as AgentToolDefinition, s as AgentBindingSpec, t as AgentHandle, u as AgentToolConfig, v as AgentFunctionReference, w as AgentModelInput, x as SkillConfig } from "./packem_shared/types.d-
|
|
2
|
-
export type { y as AgentEmailMapper, z as AgentEmailRun, B as AgentGenerateOptions, C as AgentGenerateResult, D as AgentInstructionsContext, E as AgentLiveEvent, F as AgentMemoryOptions, G as AgentMemorySource, H as AgentMessageStatus, J as AgentOnStepFinish, K as AgentPrepareStep, L as AgentPrepareStepInput, M as AgentPrepareStepResult, N as AgentProgressEvent, O as AgentRunHandle, P as AgentStepFinishInfo, Q as AgentStepInfo, R as AgentThreadStatus, T as AgentTokenDelta, U as AgentToolCall, a as AgentToolContext, V as AgentUsage, W as AgentVoiceConfig, X as AgentWorkflowBindingLike, Y as AgentWorkflowInstanceLike } from "./packem_shared/types.d-
|
|
1
|
+
import { A as AgentDefinition, c as AgentCompact, d as AgentEpisodeExtract, e as AgentGraphExtract, f as AgentGenerate, g as AgentTokenSink, h as AgentRunInput, i as AgentFunctionPaths, j as AgentRunFunction, k as AgentStepLike, l as AgentStreamGenerate, m as AgentRunResult, n as AgentMessageRow, o as AgentConfig, S as SkillDefinition, p as AnyAgentTool, q as AgentAsToolOptions, r as AgentSubToolInput, b as AgentToolDefinition, s as AgentBindingSpec, t as AgentHandle, u as AgentToolConfig, v as AgentFunctionReference, w as AgentModelInput, x as SkillConfig } from "./packem_shared/types.d-BhJFTvz_.mjs";
|
|
2
|
+
export type { y as AgentEmailMapper, z as AgentEmailRun, B as AgentGenerateOptions, C as AgentGenerateResult, D as AgentInstructionsContext, E as AgentLiveEvent, F as AgentMemoryOptions, G as AgentMemorySource, H as AgentMessageStatus, J as AgentOnStepFinish, K as AgentPrepareStep, L as AgentPrepareStepInput, M as AgentPrepareStepResult, N as AgentProgressEvent, O as AgentRunHandle, P as AgentStepFinishInfo, Q as AgentStepInfo, R as AgentThreadStatus, T as AgentTokenDelta, U as AgentToolCall, a as AgentToolContext, V as AgentUsage, W as AgentVoiceConfig, X as AgentWorkflowBindingLike, Y as AgentWorkflowInstanceLike } from "./packem_shared/types.d-BhJFTvz_.mjs";
|
|
3
3
|
export { type AgentComponent, agentComponent, agentExtension } from "./component.mjs";
|
|
4
4
|
import { FlexibleSchema, LanguageModel, ModelMessage } from 'ai';
|
|
5
5
|
export { agentBindingName, agentClassName, agentDefaultName, voiceBindingName, voiceClassName } from "./naming.mjs";
|
|
@@ -8,6 +8,10 @@ import { createAi } from '@lunora/ai';
|
|
|
8
8
|
import { WorkflowDefinition } from '@lunora/workflow';
|
|
9
9
|
import '@lunora/mail/inbound';
|
|
10
10
|
import '@lunora/server';
|
|
11
|
+
/**
|
|
12
|
+
* `AgentLoopOptions` is part of the experimental `@lunora/agent` API and may change without a major version bump.
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
11
15
|
interface AgentLoopOptions {
|
|
12
16
|
agent: AgentDefinition;
|
|
13
17
|
/**
|
|
@@ -63,6 +67,7 @@ interface AgentLoopOptions {
|
|
|
63
67
|
* `ceil(maxMessages / 2)`). Returns `undefined` when compaction is unset, the
|
|
64
68
|
* history is short enough, or the tail would be the whole history — a PURE
|
|
65
69
|
* decision (no I/O), unit-testable in isolation.
|
|
70
|
+
* @experimental
|
|
66
71
|
*/
|
|
67
72
|
declare const splitForCompaction: (history: ReadonlyArray<AgentMessageRow>, compaction: AgentConfig["compaction"]) => {
|
|
68
73
|
older: AgentMessageRow[];
|
|
@@ -86,21 +91,31 @@ declare const splitForCompaction: (history: ReadonlyArray<AgentMessageRow>, comp
|
|
|
86
91
|
* Loop control derives ONLY from persisted step outputs (never fresh
|
|
87
92
|
* `Date.now()`/`Math.random()` at the top level), so replays walk the same
|
|
88
93
|
* step-name sequence.
|
|
94
|
+
* @experimental
|
|
89
95
|
*/
|
|
90
96
|
declare const runAgentLoop: (options: AgentLoopOptions) => Promise<AgentRunResult>;
|
|
91
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Input the model provides to a minted `searchMemory` tool.
|
|
99
|
+
* @experimental
|
|
100
|
+
*/
|
|
92
101
|
interface AgentMemorySearchInput {
|
|
93
102
|
/** The natural-language query. */
|
|
94
103
|
query: string;
|
|
95
104
|
/** Per-call retrieval depth (overrides the source's configured `topK`). */
|
|
96
105
|
topK?: number;
|
|
97
106
|
}
|
|
98
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Input the model provides to a minted `readMemory` tool.
|
|
109
|
+
* @experimental
|
|
110
|
+
*/
|
|
99
111
|
interface AgentMemoryReadInput {
|
|
100
112
|
/** The chunk/document id from a `searchMemory` hit. */
|
|
101
113
|
id: string;
|
|
102
114
|
}
|
|
103
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* One ranked hit in a {@link AgentMemorySearchResult}.
|
|
117
|
+
* @experimental
|
|
118
|
+
*/
|
|
104
119
|
interface AgentMemorySearchHit {
|
|
105
120
|
id: string;
|
|
106
121
|
score: number;
|
|
@@ -113,6 +128,7 @@ interface AgentMemorySearchHit {
|
|
|
113
128
|
* hits plus deduped source refs, with the giant joined `.context` string
|
|
114
129
|
* DROPPED — the model reads snippets and decides what (if anything) to pull with
|
|
115
130
|
* `readMemory`, which is the whole point of agentic (vs inject) retrieval.
|
|
131
|
+
* @experimental
|
|
116
132
|
*/
|
|
117
133
|
interface AgentMemorySearchResult {
|
|
118
134
|
results: AgentMemorySearchHit[];
|
|
@@ -123,6 +139,7 @@ interface AgentMemorySearchResult {
|
|
|
123
139
|
* {@link AgentMemorySearchResult} a minted `searchMemory` tool returns. Defensive
|
|
124
140
|
* against a source action that returns a differently-shaped value (the dispatch
|
|
125
141
|
* boundary is untyped): a missing `chunks`/`sources` degrades to empty.
|
|
142
|
+
* @experimental
|
|
126
143
|
*/
|
|
127
144
|
declare const toSearchResults: (retrieved: unknown, snippetChars: number) => AgentMemorySearchResult;
|
|
128
145
|
/**
|
|
@@ -136,6 +153,7 @@ declare const toSearchResults: (retrieved: unknown, snippetChars: number) => Age
|
|
|
136
153
|
* Walks the same two source origins as `collectMemorySources` so the two stay in
|
|
137
154
|
* lockstep; the split is deliberate — inject sources feed retrieval, agentic
|
|
138
155
|
* sources feed tools, and no source is ever on both paths.
|
|
156
|
+
* @experimental
|
|
139
157
|
*/
|
|
140
158
|
declare const collectAgenticMemoryTools: (config: AgentConfig, skills: ReadonlyArray<SkillDefinition>) => Record<string, AnyAgentTool>;
|
|
141
159
|
/**
|
|
@@ -155,9 +173,13 @@ declare const collectAgenticMemoryTools: (config: AgentConfig, skills: ReadonlyA
|
|
|
155
173
|
* Workflows has no in-step await-instance primitive), and the answer is read
|
|
156
174
|
* back from the child's persisted thread — the single source of truth — via the
|
|
157
175
|
* shared `agents:agentMessages` runtime function.
|
|
176
|
+
* @experimental
|
|
158
177
|
*/
|
|
159
178
|
declare const agentAsTool: (options: AgentAsToolOptions) => AgentToolDefinition<AgentSubToolInput, string>;
|
|
160
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* One step of a tool-composition script — call `tool` with `input`, bind the result to `id`.
|
|
181
|
+
* @experimental
|
|
182
|
+
*/
|
|
161
183
|
interface ToolScriptStep {
|
|
162
184
|
/** A stable name later steps reference the output by. */
|
|
163
185
|
id: string;
|
|
@@ -166,11 +188,17 @@ interface ToolScriptStep {
|
|
|
166
188
|
/** The tool to call — one of the tools handed to {@link codeTool}. */
|
|
167
189
|
tool: string;
|
|
168
190
|
}
|
|
169
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* The model-provided input to a {@link codeTool} call.
|
|
193
|
+
* @experimental
|
|
194
|
+
*/
|
|
170
195
|
interface ToolScript {
|
|
171
196
|
steps: ToolScriptStep[];
|
|
172
197
|
}
|
|
173
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* The result of running a {@link ToolScript}: each step's output plus the last one.
|
|
200
|
+
* @experimental
|
|
201
|
+
*/
|
|
174
202
|
interface ToolScriptResult {
|
|
175
203
|
final: unknown;
|
|
176
204
|
results: ReadonlyArray<{
|
|
@@ -178,7 +206,10 @@ interface ToolScriptResult {
|
|
|
178
206
|
output: unknown;
|
|
179
207
|
}>;
|
|
180
208
|
}
|
|
181
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Author-supplied config for {@link codeTool}.
|
|
211
|
+
* @experimental
|
|
212
|
+
*/
|
|
182
213
|
interface CodeToolOptions {
|
|
183
214
|
/** Override the model-facing description (the default lists the available tools). */
|
|
184
215
|
description?: string;
|
|
@@ -229,6 +260,7 @@ interface CodeToolOptions {
|
|
|
229
260
|
* });
|
|
230
261
|
* // The model can now, in one turn, `findUser` then feed `{ "$from": "u", "$path": "id" }` into `recentOrders`.
|
|
231
262
|
* ```
|
|
263
|
+
* @experimental
|
|
232
264
|
*/
|
|
233
265
|
declare const codeTool: (tools: Record<string, AnyAgentTool>, options?: CodeToolOptions) => AgentToolDefinition<ToolScript, ToolScriptResult>;
|
|
234
266
|
/**
|
|
@@ -242,6 +274,7 @@ declare const codeTool: (tools: Record<string, AnyAgentTool>, options?: CodeTool
|
|
|
242
274
|
* and the env-backed `createDispatchRunner` (the same runner the workflow body
|
|
243
275
|
* uses — it POSTs to `/_lunora/scheduler/dispatch`) is built on demand; tests
|
|
244
276
|
* inject a `dispatch` double.
|
|
277
|
+
* @experimental
|
|
245
278
|
*/
|
|
246
279
|
declare const createAgentContext: (env: Record<string, unknown>, specs: ReadonlyArray<AgentBindingSpec>, dispatch?: AgentRunFunction) => Record<string, AgentHandle>;
|
|
247
280
|
/**
|
|
@@ -270,17 +303,25 @@ declare const createAgentContext: (env: Record<string, unknown>, specs: Readonly
|
|
|
270
303
|
*
|
|
271
304
|
* Declaring an agent is enough — codegen auto-registers the `agents:*` runtime
|
|
272
305
|
* functions (from `agentComponent()`) and the `ctx.agents` producer surface.
|
|
306
|
+
* @experimental
|
|
273
307
|
*/
|
|
274
308
|
declare const defineAgent: (config: AgentConfig) => AgentDefinition;
|
|
275
|
-
/**
|
|
309
|
+
/**
|
|
310
|
+
* Runtime brand check for a {@link AgentDefinition}.
|
|
311
|
+
* @experimental
|
|
312
|
+
*/
|
|
276
313
|
declare const isAgentDefinition: (value: unknown) => value is AgentDefinition;
|
|
277
314
|
/**
|
|
278
315
|
* Declare an agent tool — see `AgentToolDefinition` for why `execute` runs in
|
|
279
316
|
* the loop's durable step (with an `AgentToolContext`) rather than inside the
|
|
280
317
|
* model call.
|
|
318
|
+
* @experimental
|
|
281
319
|
*/
|
|
282
320
|
declare const defineAgentTool: <Input, Output>(config: AgentToolConfig<Input, Output>) => AgentToolDefinition<Input, Output>;
|
|
283
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* Author-supplied config for {@link functionTool}.
|
|
323
|
+
* @experimental
|
|
324
|
+
*/
|
|
284
325
|
interface FunctionToolOptions<Input> {
|
|
285
326
|
/** What the tool does — shown to the model (the model decides from it). */
|
|
286
327
|
description: string;
|
|
@@ -312,9 +353,13 @@ interface FunctionToolOptions<Input> {
|
|
|
312
353
|
* The function reference may be a typed `api.*` reference or a `"module:name"`
|
|
313
354
|
* path. The model-provided input is passed verbatim as the function's args, so
|
|
314
355
|
* `inputSchema` should mirror the referenced function's argument validator.
|
|
356
|
+
* @experimental
|
|
315
357
|
*/
|
|
316
358
|
declare const functionTool: <Input extends Record<string, unknown> = Record<string, unknown>, Output = unknown>(reference: AgentFunctionReference | string, options: FunctionToolOptions<Input>) => AgentToolDefinition<Input, Output>;
|
|
317
|
-
/**
|
|
359
|
+
/**
|
|
360
|
+
* Resolve the configured model against the Worker env (see `AgentModelInput`).
|
|
361
|
+
* @experimental
|
|
362
|
+
*/
|
|
318
363
|
declare const resolveAgentModel: (model: AgentModelInput, env: Record<string, unknown>) => LanguageModel;
|
|
319
364
|
/**
|
|
320
365
|
* Build the production LLM-turn seam over AI SDK `generateText`. The agent's
|
|
@@ -327,6 +372,7 @@ declare const resolveAgentModel: (model: AgentModelInput, env: Record<string, un
|
|
|
327
372
|
* `activeTools` / `toolChoice` / `model` overrides (from `prepareStep`) arrive
|
|
328
373
|
* on each call. When `output` is set the model runs with `Output.object` and
|
|
329
374
|
* the parsed answer is returned alongside the text.
|
|
375
|
+
* @experimental
|
|
330
376
|
*/
|
|
331
377
|
declare const createAgentGenerate: (agent: AgentDefinition, env: Record<string, unknown>) => AgentGenerate;
|
|
332
378
|
/**
|
|
@@ -341,6 +387,7 @@ declare const createAgentGenerate: (agent: AgentDefinition, env: Record<string,
|
|
|
341
387
|
* workflow replay serves the memoized final value without re-invoking it — no
|
|
342
388
|
* delta is ever re-emitted. The persisted assistant message stays the single
|
|
343
389
|
* source of truth.
|
|
390
|
+
* @experimental
|
|
344
391
|
*/
|
|
345
392
|
declare const createStreamGenerate: (agent: AgentDefinition, env: Record<string, unknown>) => AgentStreamGenerate;
|
|
346
393
|
/**
|
|
@@ -351,6 +398,7 @@ declare const createStreamGenerate: (agent: AgentDefinition, env: Record<string,
|
|
|
351
398
|
* model over {@link GRAPH_EXTRACTION_SCHEMA}, and returns the parsed
|
|
352
399
|
* `{ entities, relations }`. Wired by `compileAgentWorkflow` and called inside
|
|
353
400
|
* the loop's memoized `memory:extract` step.
|
|
401
|
+
* @experimental
|
|
354
402
|
*/
|
|
355
403
|
declare const createGraphExtract: () => AgentGraphExtract;
|
|
356
404
|
/**
|
|
@@ -359,6 +407,7 @@ declare const createGraphExtract: () => AgentGraphExtract;
|
|
|
359
407
|
* single natural-language summary — so it returns the trimmed model text. Wired
|
|
360
408
|
* by `compileAgentWorkflow` and called inside the loop's memoized
|
|
361
409
|
* `memory:episode` step.
|
|
410
|
+
* @experimental
|
|
362
411
|
*/
|
|
363
412
|
declare const createEpisodeExtract: () => AgentEpisodeExtract;
|
|
364
413
|
/**
|
|
@@ -367,20 +416,29 @@ declare const createEpisodeExtract: () => AgentEpisodeExtract;
|
|
|
367
416
|
* returns the brief. Wired by `compileAgentWorkflow` and called inside the loop's
|
|
368
417
|
* memoized `llm:turn:N` step so the summarization is replay-safe.
|
|
369
418
|
*/
|
|
370
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* One text/image/… content part of an MCP `CallToolResult`.
|
|
421
|
+
* @experimental
|
|
422
|
+
*/
|
|
371
423
|
interface McpContentPart {
|
|
372
424
|
[key: string]: unknown;
|
|
373
425
|
text?: string;
|
|
374
426
|
type: string;
|
|
375
427
|
}
|
|
376
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* The result of an MCP `tools/call` — the structural subset the adapter reads.
|
|
430
|
+
* @experimental
|
|
431
|
+
*/
|
|
377
432
|
interface McpCallResult {
|
|
378
433
|
[key: string]: unknown;
|
|
379
434
|
content?: ReadonlyArray<McpContentPart>;
|
|
380
435
|
isError?: boolean;
|
|
381
436
|
structuredContent?: unknown;
|
|
382
437
|
}
|
|
383
|
-
/**
|
|
438
|
+
/**
|
|
439
|
+
* One entry of an MCP `tools/list` — the structural subset the adapter reads.
|
|
440
|
+
* @experimental
|
|
441
|
+
*/
|
|
384
442
|
interface McpToolInfo {
|
|
385
443
|
description?: string;
|
|
386
444
|
inputSchema: {
|
|
@@ -395,6 +453,7 @@ interface McpToolInfo {
|
|
|
395
453
|
* Structural subset of `@modelcontextprotocol/sdk`'s `Client` the adapter uses.
|
|
396
454
|
* Declaring it locally lets tests inject a mock without the real SDK (and its
|
|
397
455
|
* transport) and keeps the heavy dependency behind a lazy dynamic import.
|
|
456
|
+
* @experimental
|
|
398
457
|
*/
|
|
399
458
|
interface McpClientLike {
|
|
400
459
|
callTool: (params: {
|
|
@@ -407,7 +466,10 @@ interface McpClientLike {
|
|
|
407
466
|
tools: ReadonlyArray<McpToolInfo>;
|
|
408
467
|
}>;
|
|
409
468
|
}
|
|
410
|
-
/**
|
|
469
|
+
/**
|
|
470
|
+
* Options for {@link mcpTools}.
|
|
471
|
+
* @experimental
|
|
472
|
+
*/
|
|
411
473
|
interface McpToolsOptions {
|
|
412
474
|
/**
|
|
413
475
|
* A pre-built (already-connected) MCP client. Takes precedence over `url` —
|
|
@@ -438,6 +500,7 @@ interface McpToolsOptions {
|
|
|
438
500
|
* server's `structuredContent` is returned as-is; otherwise the text parts are
|
|
439
501
|
* joined. An `isError` result is returned as an error STRING (not thrown) so
|
|
440
502
|
* the next LLM turn can recover, consistent with the loop's unknown-tool path.
|
|
503
|
+
* @experimental
|
|
441
504
|
*/
|
|
442
505
|
declare const adaptMcpResult: (result: McpCallResult) => unknown;
|
|
443
506
|
/**
|
|
@@ -460,6 +523,7 @@ declare const adaptMcpResult: (result: McpCallResult) => unknown;
|
|
|
460
523
|
* every call. In the Workers runtime only the HTTP/SSE transports run (stdio
|
|
461
524
|
* does not) — pass `url`, or inject an already-connected `client` for a custom
|
|
462
525
|
* transport (also the test seam).
|
|
526
|
+
* @experimental
|
|
463
527
|
*/
|
|
464
528
|
declare const mcpTools: (options: McpToolsOptions) => Promise<Record<string, AgentToolDefinition<Record<string, unknown>>>>;
|
|
465
529
|
/**
|
|
@@ -467,6 +531,7 @@ declare const mcpTools: (options: McpToolsOptions) => Promise<Record<string, Age
|
|
|
467
531
|
* retrieved memory context (when any), then the persisted thread history with
|
|
468
532
|
* tool calls/results correlated the way providers expect (assistant tool-call
|
|
469
533
|
* parts answered by tool-result parts sharing the `toolCallId`).
|
|
534
|
+
* @experimental
|
|
470
535
|
*/
|
|
471
536
|
declare const buildModelMessages: (options: {
|
|
472
537
|
history: ReadonlyArray<AgentMessageRow>;
|
|
@@ -478,6 +543,7 @@ declare const buildModelMessages: (options: {
|
|
|
478
543
|
* The namespace the agent runtime functions register under. Codegen
|
|
479
544
|
* auto-registers `agentComponent().functions` here whenever `lunora/agents.ts`
|
|
480
545
|
* declares an agent, so the loop's dispatch paths below hold by construction.
|
|
546
|
+
* @experimental
|
|
481
547
|
*/
|
|
482
548
|
declare const AGENT_MODULE = "agents";
|
|
483
549
|
/**
|
|
@@ -485,13 +551,23 @@ declare const AGENT_MODULE = "agents";
|
|
|
485
551
|
* under. Codegen auto-registers `sandboxComponent().invoke` here whenever
|
|
486
552
|
* `lunora/` imports a sandbox tool (`browserTool`/`containerTool`), so the
|
|
487
553
|
* tools' `execute` can dispatch to it through the loop's `run` seam.
|
|
554
|
+
* @experimental
|
|
488
555
|
*/
|
|
489
556
|
declare const SANDBOX_MODULE = "sandbox";
|
|
490
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* The dispatch path of the sandbox runtime action (an internal action).
|
|
559
|
+
* @experimental
|
|
560
|
+
*/
|
|
491
561
|
declare const SANDBOX_INVOKE_PATH: "sandbox:invoke";
|
|
492
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* Default dispatch paths of the agent runtime functions.
|
|
564
|
+
* @experimental
|
|
565
|
+
*/
|
|
493
566
|
declare const DEFAULT_AGENT_FUNCTION_PATHS: AgentFunctionPaths;
|
|
494
|
-
/**
|
|
567
|
+
/**
|
|
568
|
+
* Mint a dispatchable function reference from a path (or pass one through).
|
|
569
|
+
* @experimental
|
|
570
|
+
*/
|
|
495
571
|
declare const toFunctionReference: (source: AgentFunctionReference | string) => AgentFunctionReference;
|
|
496
572
|
/**
|
|
497
573
|
* Declare a reusable skill: a bundle of expertise — an instruction fragment,
|
|
@@ -521,9 +597,13 @@ declare const toFunctionReference: (source: AgentFunctionReference | string) =>
|
|
|
521
597
|
* ordering, per-skill knowledge retrieval) happens in `defineAgent` — a skill
|
|
522
598
|
* only validates its own `name`; tool-name validation is deferred to the merge,
|
|
523
599
|
* which owns the flat model-facing namespace.
|
|
600
|
+
* @experimental
|
|
524
601
|
*/
|
|
525
602
|
declare const defineSkill: (config: SkillConfig) => SkillDefinition;
|
|
526
|
-
/**
|
|
603
|
+
/**
|
|
604
|
+
* Runtime brand check for a {@link SkillDefinition}.
|
|
605
|
+
* @experimental
|
|
606
|
+
*/
|
|
527
607
|
declare const isSkillDefinition: (value: unknown) => value is SkillDefinition;
|
|
528
608
|
/**
|
|
529
609
|
* A control frame the server sends the client as a JSON text message (audio
|
|
@@ -531,6 +611,7 @@ declare const isSkillDefinition: (value: unknown) => value is SkillDefinition;
|
|
|
531
611
|
* connect; `user_transcript` carries the STT result; `assistant_delta` streams
|
|
532
612
|
* the live LLM text; `assistant_done` is the final turn text; `interrupted`
|
|
533
613
|
* acks a barge-in; `error` reports a non-fatal turn failure.
|
|
614
|
+
* @experimental
|
|
534
615
|
*/
|
|
535
616
|
type VoiceServerFrame = {
|
|
536
617
|
audioFormat: "mp3" | "wav";
|
|
@@ -550,7 +631,10 @@ type VoiceServerFrame = {
|
|
|
550
631
|
} | {
|
|
551
632
|
type: "interrupted";
|
|
552
633
|
};
|
|
553
|
-
/**
|
|
634
|
+
/**
|
|
635
|
+
* A control frame the client sends the server (audio rides separate binary frames).
|
|
636
|
+
* @experimental
|
|
637
|
+
*/
|
|
554
638
|
type VoiceClientFrame = {
|
|
555
639
|
text: string;
|
|
556
640
|
type: "text";
|
|
@@ -559,17 +643,35 @@ type VoiceClientFrame = {
|
|
|
559
643
|
} | {
|
|
560
644
|
type: "interrupt";
|
|
561
645
|
};
|
|
562
|
-
/**
|
|
646
|
+
/**
|
|
647
|
+
* A synthesized-audio source the TTS seam yields — normalized to bytes by {@link toByteIterable}.
|
|
648
|
+
* @experimental
|
|
649
|
+
*/
|
|
563
650
|
type VoiceAudioSource = AsyncIterable<Uint8Array> | ReadableStream<Uint8Array> | Uint8Array;
|
|
564
|
-
/**
|
|
651
|
+
/**
|
|
652
|
+
* Transcribe one buffered utterance (16kHz mono 16-bit PCM) to text.
|
|
653
|
+
* @experimental
|
|
654
|
+
*/
|
|
565
655
|
type VoiceTranscribe = (pcm: Uint8Array) => Promise<string>;
|
|
566
|
-
/**
|
|
656
|
+
/**
|
|
657
|
+
* Synthesize one sentence to an audio byte stream; honors `signal` for barge-in.
|
|
658
|
+
* @experimental
|
|
659
|
+
*/
|
|
567
660
|
type VoiceSynthesize = (text: string, signal: AbortSignal) => Promise<VoiceAudioSource>;
|
|
568
|
-
/**
|
|
661
|
+
/**
|
|
662
|
+
* Send a JSON control frame to the client.
|
|
663
|
+
* @experimental
|
|
664
|
+
*/
|
|
569
665
|
type VoiceSend = (frame: VoiceServerFrame) => void;
|
|
570
|
-
/**
|
|
666
|
+
/**
|
|
667
|
+
* Send a binary audio frame to the client.
|
|
668
|
+
* @experimental
|
|
669
|
+
*/
|
|
571
670
|
type VoiceSendAudio = (bytes: Uint8Array) => void;
|
|
572
|
-
/**
|
|
671
|
+
/**
|
|
672
|
+
* The outcome of one voice turn.
|
|
673
|
+
* @experimental
|
|
674
|
+
*/
|
|
573
675
|
interface VoiceTurnResult {
|
|
574
676
|
/** The final assistant text (may be partial if `interrupted`). */
|
|
575
677
|
assistantText: string;
|
|
@@ -578,7 +680,10 @@ interface VoiceTurnResult {
|
|
|
578
680
|
/** The transcribed (or typed) user text — empty when the utterance was silence. */
|
|
579
681
|
userText: string;
|
|
580
682
|
}
|
|
581
|
-
/**
|
|
683
|
+
/**
|
|
684
|
+
* Options for one {@link runVoiceTurn}.
|
|
685
|
+
* @experimental
|
|
686
|
+
*/
|
|
582
687
|
interface RunVoiceTurnOptions {
|
|
583
688
|
/** The agent whose thread + models back this session. */
|
|
584
689
|
agent: AgentDefinition;
|
|
@@ -631,6 +736,7 @@ interface RunVoiceTurnOptions {
|
|
|
631
736
|
* frame never duplicates a row; the thread tables are the same ones the durable
|
|
632
737
|
* agent loop and `useAgentChat` read, so a voice session and a text session on
|
|
633
738
|
* the same `threadKey` share one history.
|
|
739
|
+
* @experimental
|
|
634
740
|
*/
|
|
635
741
|
declare const runVoiceTurn: (options: RunVoiceTurnOptions) => Promise<VoiceTurnResult>;
|
|
636
742
|
/** Parse the JSON identity envelope forwarded on the `x-lunora-identity` upgrade header. */
|
|
@@ -654,6 +760,7 @@ interface VoiceSessionState {
|
|
|
654
760
|
* `SupportVoiceDO extends VoiceSessionDO`, constructed with the agent
|
|
655
761
|
* definition + its export name) bound under the agent's `VOICE_...` Durable
|
|
656
762
|
* Object binding.
|
|
763
|
+
* @experimental
|
|
657
764
|
*/
|
|
658
765
|
declare class VoiceSessionDO {
|
|
659
766
|
protected readonly agent: AgentDefinition;
|
|
@@ -733,6 +840,7 @@ declare class VoiceSessionDO {
|
|
|
733
840
|
*
|
|
734
841
|
* The workflow ctx supplies durability (`step.do`) and the Lunora dispatcher
|
|
735
842
|
* (`run`); the loop supplies determinism (step naming + idempotent persists).
|
|
843
|
+
* @experimental
|
|
736
844
|
*/
|
|
737
845
|
declare const compileAgentWorkflow: (agent: AgentDefinition, exportName: string, options?: {
|
|
738
846
|
paths?: AgentFunctionPaths;
|