@anvia/core 1.0.0-rc.8 → 1.0.0

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.
Files changed (41) hide show
  1. package/README.md +99 -77
  2. package/dist/agent/index.d.ts +11 -16
  3. package/dist/agent/index.js +4 -4
  4. package/dist/{agent-XPQBM4rX.d.ts → agent-qRKa3ibC.d.ts} +11 -7
  5. package/dist/{chunk-YA2655FX.js → chunk-3ZLM6OAZ.js} +304 -100
  6. package/dist/chunk-3ZLM6OAZ.js.map +1 -0
  7. package/dist/{chunk-X4LK4ODN.js → chunk-AHLKV6KP.js} +1 -1
  8. package/dist/chunk-AHLKV6KP.js.map +1 -0
  9. package/dist/chunk-J6LVLV6P.js +13 -0
  10. package/dist/chunk-J6LVLV6P.js.map +1 -0
  11. package/dist/{chunk-QOUPWOGW.js → chunk-SPD4XVR7.js} +1 -1
  12. package/dist/{chunk-5C6B6ZRH.js → chunk-YA7BMX7D.js} +50 -3
  13. package/dist/chunk-YA7BMX7D.js.map +1 -0
  14. package/dist/documents/index.js +26 -1
  15. package/dist/documents/index.js.map +1 -1
  16. package/dist/evals/index.d.ts +5 -5
  17. package/dist/evals/index.js +3 -3
  18. package/dist/evals/index.js.map +1 -1
  19. package/dist/index.d.ts +7 -12
  20. package/dist/index.js +7 -5
  21. package/dist/internal/agent.d.ts +4 -9
  22. package/dist/internal/agent.js +4 -4
  23. package/dist/mcp/index.d.ts +3 -17
  24. package/dist/mcp/index.js +1 -15
  25. package/dist/memory/index.d.ts +6 -3
  26. package/dist/memory/index.js +4 -2
  27. package/dist/observability/index.d.ts +2 -2
  28. package/dist/pipeline/index.d.ts +6 -11
  29. package/dist/pipeline/index.js +3 -3
  30. package/dist/pipeline/index.js.map +1 -1
  31. package/dist/{types-Sue2hb_L.d.ts → types-CLCLFpAL.d.ts} +23 -15
  32. package/dist/{types-DKOXVTcq.d.ts → types-CSYt7-It.d.ts} +18 -3
  33. package/dist/types-DjqRHeAi.d.ts +31 -0
  34. package/package.json +10 -4
  35. package/dist/chunk-5C6B6ZRH.js.map +0 -1
  36. package/dist/chunk-76JLMBVT.js +0 -716
  37. package/dist/chunk-76JLMBVT.js.map +0 -1
  38. package/dist/chunk-X4LK4ODN.js.map +0 -1
  39. package/dist/chunk-YA2655FX.js.map +0 -1
  40. package/dist/client-DTPl0hZv.d.ts +0 -84
  41. /package/dist/{chunk-QOUPWOGW.js.map → chunk-SPD4XVR7.js.map} +0 -0
package/README.md CHANGED
@@ -58,7 +58,7 @@ const agent = new Agent({
58
58
  });
59
59
 
60
60
  const result = await agent.generate({ prompt: "What is happening with order A123?" });
61
- if (result.status === "completed") console.log(result.output);
61
+ if (result.type === "response") console.log(result.output);
62
62
  ```
63
63
 
64
64
  ## Direct Completions
@@ -229,7 +229,7 @@ rather than recursively accumulating failed attempts. Truncated output and reaso
229
229
  parse and schema repairs include only a bounded, text-only preview of the latest failed response.
230
230
  The correction asks for shorter raw JSON matching the schema, without Markdown or commentary.
231
231
  Transport failures and structured-output failures therefore cannot exceed `maxAttempts` in total.
232
- Completed Agent results expose the last generation's `finishReason` and `providerFinishReason`, and
232
+ Agent response outcomes expose the last generation's `finishReason` and `providerFinishReason`, and
233
233
  the same fields remain attached to each assistant message's Anvia generation metadata.
234
234
 
235
235
  Malformed, incomplete, or non-JSON provider tool arguments fail with
@@ -256,30 +256,35 @@ exists; its message never contains the rejected model response. The `completion.
256
256
  event records the same safe diagnostics and whether failed output was omitted or previewed, never
257
257
  the model output itself.
258
258
 
259
- Agent results are discriminated by `status`. Completed results include typed `output` and `text`;
260
- guardrail blocks return `status: "blocked"`, `stage`, and `text`; tool approvals and first-class
261
- questions return a JSON-safe `status: "suspended"` result.
259
+ Agent outcomes are discriminated by `type`. Successful responses include typed `output` and `text`;
260
+ guardrail blocks return `type: "blocked"`, `stage`, `reason`, and an optional `message`; tool
261
+ approvals and first-class questions return a JSON-safe `type: "interaction"` outcome.
262
262
 
263
263
  ```ts
264
- const result = await agent.generate({ prompt: "Help with this request." });
265
-
266
- if (result.status === "completed") console.log(result.output);
267
- if (result.status === "blocked") console.log(result.stage, result.text);
268
- if (result.status === "suspended") {
269
- const resumed = await agent.generate({
270
- continuation: result.continuation,
271
- response:
272
- result.interaction.type === "tool-approval"
273
- ? { type: "tool-approval", approved: true }
264
+ const outcome = await agent.generate({ prompt: "Help with this request." });
265
+
266
+ switch (outcome.type) {
267
+ case "response":
268
+ console.log(outcome.output);
269
+ break;
270
+ case "blocked":
271
+ console.log(outcome.stage, outcome.reason);
272
+ break;
273
+ case "interaction": {
274
+ const response =
275
+ outcome.interaction.type === "tool-approval"
276
+ ? { type: "tool-approval" as const, approved: true }
274
277
  : {
275
- type: "tool-question",
276
- answers: result.interaction.questions.map((question) => ({
278
+ type: "tool-question" as const,
279
+ answers: outcome.interaction.questions.map((question) => ({
277
280
  questionId: question.id,
278
281
  value: "application-provided answer",
279
282
  })),
280
- },
281
- });
282
- console.log(resumed.status, resumed.resumedFrom);
283
+ };
284
+ const resumed = await agent.resume(outcome.continuation, response);
285
+ console.log(resumed.type, resumed.resumedFrom);
286
+ break;
287
+ }
283
288
  }
284
289
  ```
285
290
 
@@ -300,17 +305,27 @@ import {
300
305
  ```
301
306
 
302
307
  An Agent with `outputSchema` carries that output type through `generate`, `stream`, `asTool`, and
303
- Pipeline Agent stages. Agent stream finals use the same result shape:
308
+ Pipeline Agent stages. `stream()` returns a handle with one event consumer plus final-value
309
+ promises, steering, and cancellation. Terminal agent events are the flattened outcomes themselves;
310
+ there is no extra `final.result` wrapper:
304
311
 
305
312
  ```ts
306
- for await (const event of agent.stream({ prompt: "Help with this request." })) {
307
- if (event.type === "final") {
308
- if (event.result.status === "completed") console.log(event.result.output);
309
- else console.log(event.result.stage, event.result.text);
310
- }
313
+ const stream = agent.stream({ prompt: "Help with this request." });
314
+
315
+ for await (const event of stream.events) {
316
+ if (event.type === "text_delta") process.stdout.write(event.delta);
317
+ if (event.type === "response") console.log(event.output);
318
+ if (event.type === "interaction") console.log(event.interaction);
319
+ if (event.type === "blocked") console.log(event.reason);
311
320
  }
321
+
322
+ const outcome = await stream.result;
323
+ console.log(outcome.type, await stream.text);
312
324
  ```
313
325
 
326
+ Use `stream.textStream` instead of `stream.events` when only text deltas are needed. Event and text
327
+ iteration share one underlying stream and therefore cannot be consumed independently.
328
+
314
329
  Pass `abortSignal` on a run to cancel the active provider call, tools, and nested Agent tools.
315
330
 
316
331
  ## Memory
@@ -383,8 +398,8 @@ const agent = new Agent({
383
398
  store: memory,
384
399
  savePolicy: "message",
385
400
  compaction: {
386
- trigger: { afterMessages: 50 },
387
- retention: { recentUserTurns: 4 },
401
+ trigger: { afterTokens: 32_000 },
402
+ retention: { recentTokens: 8_000 },
388
403
  compactor,
389
404
  conflictRetries: false,
390
405
  },
@@ -393,13 +408,50 @@ const agent = new Agent({
393
408
 
394
409
  for await (const event of agent.stream({ prompt: "What did we decide?", session })) {
395
410
  if (event.type === "memory_compaction") {
396
- console.log(event.compactedMessageCount, event.usage);
411
+ console.log({
412
+ messages: event.compactedMessageCount,
413
+ beforeTokens: event.originalTokenCount,
414
+ afterTokens: event.resultTokenCount,
415
+ usage: event.usage,
416
+ });
397
417
  }
398
418
  }
399
419
  ```
400
420
 
401
- The trigger is a threshold, not a hard storage limit. Summary-provider retries belong to the
402
- compactor; full snapshot-to-replacement conflict retries are separately opt-in.
421
+ The trigger includes the stored transcript and the incoming user message. Retention keeps as many
422
+ recent complete user-led turns as fit the configured budget; the newest complete turn is always
423
+ kept and never split, even when it exceeds that budget. When `retention` is omitted, it defaults to
424
+ 25% of `afterTokens`.
425
+
426
+ The built-in token counter is a lightweight provider-neutral estimate. Pass `tokenCounter` when you
427
+ have a model-specific tokenizer or counting service. A custom counter may be async, can be called
428
+ multiple times, and must return deterministic, monotonic, nonnegative safe integers:
429
+
430
+ ```ts
431
+ compaction: {
432
+ trigger: { afterTokens: 32_000 },
433
+ retention: { recentTokens: 8_000 },
434
+ tokenCounter: (messages) => tokenizer.count(messages),
435
+ compactor,
436
+ }
437
+ ```
438
+
439
+ You can force the configured policy without starting an Agent run. The result makes a no-op
440
+ explicit rather than throwing:
441
+
442
+ ```ts
443
+ const result = await agent.compactMemory({ session });
444
+
445
+ if (result.type === "compacted") {
446
+ console.log(result.originalTokenCount, result.resultTokenCount);
447
+ } else {
448
+ console.log(result.reason); // "nothing_to_compact"
449
+ }
450
+ ```
451
+
452
+ The automatic trigger is a threshold, not a hard storage limit. Summary-provider retries belong to
453
+ the compactor; full snapshot-to-replacement conflict retries are separately opt-in. A streamed
454
+ `memory_compaction` event is emitted only after the store atomically commits the replacement.
403
455
 
404
456
  ## Structured Extraction
405
457
 
@@ -451,6 +503,13 @@ const { runId, output } = await pipeline.run({
451
503
  Applications own file discovery, file reads, source metadata, and per-file error policy. Core only
452
504
  provides deterministic in-memory chunking and scoped PDF text extraction:
453
505
 
506
+ PDF extraction uses the optional `pdfjs-dist` peer dependency. Install it in applications that call
507
+ `extractPdfText`:
508
+
509
+ ```sh
510
+ pnpm add pdfjs-dist
511
+ ```
512
+
454
513
  ```ts
455
514
  import { readFile } from "node:fs/promises";
456
515
  import { chunkText, extractPdfText } from "@anvia/core/documents";
@@ -512,54 +571,17 @@ console.log(transcript.text);
512
571
 
513
572
  ## MCP
514
573
 
515
- MCP clients own connections. Agents receive immutable server registrations and never own or close
516
- the underlying transport:
517
-
518
- ```ts
519
- import { Agent } from "@anvia/core/agent";
520
- import { McpClient, McpClientGroup } from "@anvia/core/mcp";
521
-
522
- const filesystem = new McpClient({
523
- name: "filesystem",
524
- transport: {
525
- type: "stdio",
526
- command: "npx",
527
- args: ["-y", "@modelcontextprotocol/server-filesystem", "./workspace"],
528
- },
529
- });
530
- const github = new McpClient({
531
- name: "github",
532
- transport: {
533
- type: "streamableHttp",
534
- url: "https://mcp.example.com/mcp",
535
- headers: { authorization: `Bearer ${process.env.MCP_TOKEN}` },
536
- },
537
- tools: { prefix: "github_" },
538
- });
539
-
540
- const mcp = await McpClientGroup.connect({ clients: [filesystem, github] });
541
- const agent = new Agent({ id: "assistant", model, mcpServers: mcp.servers });
574
+ MCP clients live in the optional `@anvia/mcp` package. Core retains the lightweight registration
575
+ contracts that let agents receive immutable MCP server snapshots without owning or closing their
576
+ underlying transports:
542
577
 
543
- try {
544
- await agent.generate({ prompt: "Find the issue and update it." });
545
- } finally {
546
- await mcp.close();
547
- }
578
+ ```sh
579
+ pnpm add @anvia/mcp
548
580
  ```
549
581
 
550
- Construction performs no I/O. `connect()` discovers every tool page once and returns a frozen
551
- registration snapshot. Reconnect and rebuild the Agent to adopt changed remote tools. Built-in
552
- Streamable HTTP connections enforce Anvia URL safety by default and do not accept a custom `fetch`.
553
- Static request headers are explicit transport configuration; arbitrary Fetch `RequestInit` fields
554
- are not exposed because the MCP transport owns its HTTP method, body, abort signal, session, and
555
- protocol headers. Configured headers are sent only to the exact MCP endpoint, are not attached to
556
- OAuth requests, and cause endpoint redirects to fail instead of forwarding credentials. A static
557
- `authorization` header cannot be combined with `authProvider`.
558
- For an intentionally local or private-network server, set `ssrfProtection: "disabled"` on that
559
- transport. This disables hostname and DNS restrictions for the complete transport, including
560
- redirects and OAuth discovery, while still requiring HTTP(S). Use it only when the application owns
561
- and trusts that network boundary. MCP server instructions remain inspectable metadata and are not
562
- added to Agent instructions.
582
+ Import `McpClient` and `McpClientGroup` from `@anvia/mcp`, connect them, and pass the resulting
583
+ `servers` to `new Agent({ mcpServers })`. See the `@anvia/mcp` README for transport configuration,
584
+ connection ownership, URL safety, and cleanup.
563
585
 
564
586
  ## Public Areas
565
587
 
@@ -573,7 +595,7 @@ added to Agent instructions.
573
595
  - `embeddings`: embedding helpers and document embedding utilities
574
596
  - `vector-store`: in-memory vector search and vector search tools
575
597
  - `streaming`: normalized stream helpers
576
- - `mcp`: lifecycle-owning MCP clients, groups, and immutable Agent registrations
598
+ - `mcp`: lightweight MCP tool and server registration contracts used by Agent
577
599
  - `skills`: local skill loading
578
600
  - `observability`: observer interfaces for runs, generations, and tool calls
579
601
  - `evals`: evaluation helpers and reporters
@@ -1,27 +1,22 @@
1
1
  export { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
2
2
  export { R as RetryContext, a as RetryOptions, b as RetrySetting } from '../retry-CjvSlKGW.js';
3
- export { A as Agent, a as AgentContextInput, b as AgentMemory, c as AgentMemoryOptions, d as AgentOptions, e as AgentToolInput, f as AgentToolOptions, C as CreateHybridVectorContextOptions, g as CreateVectorContextOptions, V as VectorContext, h as VectorContextBaseOptions, i as createVectorContext, j as isVectorContext } from '../agent-XPQBM4rX.js';
3
+ export { A as Agent, a as AgentContextInput, b as AgentMemory, c as AgentMemoryOptions, d as AgentOptions, e as AgentToolInput, f as AgentToolOptions, C as CreateHybridVectorContextOptions, g as CreateVectorContextOptions, V as VectorContext, h as VectorContextBaseOptions, i as createVectorContext, j as isVectorContext } from '../agent-qRKa3ibC.js';
4
4
  import { M as Message, U as Usage, C as CompletionFinishReason } from '../types-DgvozfPc.js';
5
- import { A as AgentBlockedResult, t as AgentSuspendedResult } from '../types-Sue2hb_L.js';
6
- export { a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput, g as AgentLifecycle, h as AgentMemoryCompactionEvent, i as AgentPrompt, j as AgentResponse, k as AgentResult, l as AgentRunOptions, m as AgentRunSettings, n as AgentStartEvent, o as AgentSteerInput, p as AgentSteerReceipt, q as AgentStepFinishEvent, r as AgentStream, s as AgentStreamEvent, u as AgentToolCallDeltaEvent, v as AgentToolFinishEvent, w as AgentToolStartEvent } from '../types-Sue2hb_L.js';
5
+ import { A as AgentBlockedOutcome, g as AgentInteractionOutcome } from '../types-CLCLFpAL.js';
6
+ export { a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput, h as AgentLifecycle, i as AgentMemoryCompactionEvent, j as AgentMemoryCompactionOptions, k as AgentOutcome, l as AgentPrompt, m as AgentResponse, n as AgentRunOptions, o as AgentRunSettings, p as AgentStartEvent, q as AgentSteerInput, r as AgentSteerReceipt, s as AgentStepFinishEvent, t as AgentStream, u as AgentStreamEvent, v as AgentToolCallDeltaEvent, w as AgentToolFinishEvent, x as AgentToolStartEvent } from '../types-CLCLFpAL.js';
7
7
  import '../zod-schema-C7F4clpm.js';
8
8
  import 'zod';
9
9
  import '../types-DhkodEft.js';
10
10
  import '../type-utils-CtHVDRn_.js';
11
- import '../client-DTPl0hZv.js';
12
- import 'node:child_process';
13
- import 'node:stream';
14
- import '@modelcontextprotocol/sdk/client/auth.js';
15
- import '@modelcontextprotocol/sdk/client/streamableHttp.js';
16
- import '@modelcontextprotocol/sdk/shared/transport.js';
11
+ import '../types-DjqRHeAi.js';
17
12
  import '../tool-BpqpoRSE.js';
13
+ import '../types-CSYt7-It.js';
18
14
  import '../middleware-kcF8AusP.js';
19
- import '../types-DKOXVTcq.js';
15
+ import './interactions/index.js';
20
16
  import '../types-DC1U1XwW.js';
21
17
  import '../dynamic-tools-aIZlg5x1.js';
22
18
  import '../types-Cr4uiYo5.js';
23
19
  import '../types-CXNE592e.js';
24
- import './interactions/index.js';
25
20
 
26
21
  type AgentStructuredOutputPhase = "truncated" | "content-filter" | "parse" | "schema";
27
22
  type AgentStructuredOutputFormat = "raw" | "json-fence" | "unlabeled-fence";
@@ -62,15 +57,15 @@ declare class AgentRunCancelledError extends Error {
62
57
  constructor(chatHistory: Message[], reason: string, options?: ErrorOptions);
63
58
  }
64
59
  declare class AgentRunBlockedError extends Error {
65
- readonly result: AgentBlockedResult;
66
- constructor(result: AgentBlockedResult);
60
+ readonly result: AgentBlockedOutcome;
61
+ constructor(result: AgentBlockedOutcome);
67
62
  }
68
63
  declare class AgentStreamClosedError extends Error {
69
64
  constructor();
70
65
  }
71
66
  declare class AgentToolSuspensionError extends Error {
72
- readonly result: AgentSuspendedResult;
73
- constructor(result: AgentSuspendedResult);
67
+ readonly result: AgentInteractionOutcome;
68
+ constructor(result: AgentInteractionOutcome);
74
69
  }
75
70
 
76
- export { AgentBlockedResult, AgentRunBlockedError, AgentRunCancelledError, AgentStreamClosedError, AgentStructuredOutputError, type AgentStructuredOutputFormat, type AgentStructuredOutputPhase, AgentSuspendedResult, AgentToolSuspensionError, MaxTurnsError };
71
+ export { AgentBlockedOutcome, AgentInteractionOutcome, AgentRunBlockedError, AgentRunCancelledError, AgentStreamClosedError, AgentStructuredOutputError, type AgentStructuredOutputFormat, type AgentStructuredOutputPhase, AgentToolSuspensionError, MaxTurnsError };
@@ -2,10 +2,10 @@ import {
2
2
  Agent,
3
3
  createVectorContext,
4
4
  isVectorContext
5
- } from "../chunk-YA2655FX.js";
5
+ } from "../chunk-3ZLM6OAZ.js";
6
6
  import "../chunk-OJBFDBLG.js";
7
- import "../chunk-76JLMBVT.js";
8
- import "../chunk-5C6B6ZRH.js";
7
+ import "../chunk-J6LVLV6P.js";
8
+ import "../chunk-YA7BMX7D.js";
9
9
  import "../chunk-6BBOCFHV.js";
10
10
  import "../chunk-YK4WAAS4.js";
11
11
  import "../chunk-SJMSS5SI.js";
@@ -17,7 +17,7 @@ import {
17
17
  AgentStructuredOutputError,
18
18
  AgentToolSuspensionError,
19
19
  MaxTurnsError
20
- } from "../chunk-X4LK4ODN.js";
20
+ } from "../chunk-AHLKV6KP.js";
21
21
  import "../chunk-ZA564323.js";
22
22
  import "../chunk-3RM57ZT2.js";
23
23
  import "../chunk-D4PACGPA.js";
@@ -2,11 +2,12 @@ import { b as RetrySetting } from './retry-CjvSlKGW.js';
2
2
  import { D as Document, c as CompletionModel, P as ProviderTool, J as JsonObject, v as ToolChoice } from './types-DgvozfPc.js';
3
3
  import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
4
4
  import { d as GuardrailPolicyInput, c as GuardrailPolicy } from './types-DhkodEft.js';
5
- import { a as McpServer } from './client-DTPl0hZv.js';
6
- import { g as AgentLifecycle, E as AgentObservabilityOptions, l as AgentRunOptions, k as AgentResult, r as AgentStream, s as AgentStreamEvent } from './types-Sue2hb_L.js';
5
+ import { a as McpServer } from './types-DjqRHeAi.js';
6
+ import { E as MemoryStore, z as MemorySavePolicy, F as MemoryTokenCounter, n as MemoryCompactor, d as MemoryCompactionConflictRetryOptions, y as MemoryOptions, k as MemoryCompactionResult } from './types-CSYt7-It.js';
7
+ import { h as AgentLifecycle, F as AgentObservabilityOptions, n as AgentRunOptions, k as AgentOutcome, o as AgentRunSettings, t as AgentStream, j as AgentMemoryCompactionOptions } from './types-CLCLFpAL.js';
7
8
  import { A as AgentMiddleware } from './middleware-kcF8AusP.js';
8
9
  import { A as AnyTool, T as Tool, c as ToolCallContext, N as NormalizedToolOutput } from './tool-BpqpoRSE.js';
9
- import { D as MemoryStore, y as MemorySavePolicy, m as MemoryCompactor, d as MemoryCompactionConflictRetryOptions, x as MemoryOptions } from './types-DKOXVTcq.js';
10
+ import { AgentContinuation, AgentInteractionResponse } from './agent/interactions/index.js';
10
11
  import { a as SkillSet } from './types-DC1U1XwW.js';
11
12
  import { T as ToolIndex } from './dynamic-tools-aIZlg5x1.js';
12
13
  import { E as EmbeddingModel, c as SparseEmbeddingModel } from './types-Cr4uiYo5.js';
@@ -74,11 +75,12 @@ type AgentMemory = {
74
75
  savePolicy: MemorySavePolicy;
75
76
  compaction?: {
76
77
  trigger: {
77
- afterMessages: number;
78
+ afterTokens: number;
78
79
  };
79
80
  retention: {
80
- recentUserTurns: number;
81
+ recentTokens: number;
81
82
  };
83
+ tokenCounter: MemoryTokenCounter;
82
84
  compactor: MemoryCompactor;
83
85
  conflictRetries: false | MemoryCompactionConflictRetryOptions;
84
86
  } | undefined;
@@ -138,8 +140,10 @@ declare class Agent<Output = string, M extends CompletionModel = CompletionModel
138
140
  readonly middlewares: readonly AgentMiddleware[];
139
141
  readonly memory: AgentMemory | undefined;
140
142
  constructor(options: AgentOptions<Output, M, ContextDocument>);
141
- generate(options: AgentRunOptions<Output, RawResponseOf<M>>): Promise<AgentResult<Output>>;
142
- stream(options: AgentRunOptions<Output, RawResponseOf<M>>): AgentStream<AgentStreamEvent<Output, RawResponseOf<M>>>;
143
+ generate(options: AgentRunOptions<Output, RawResponseOf<M>>): Promise<AgentOutcome<Output>>;
144
+ resume(continuation: AgentContinuation, response: AgentInteractionResponse, settings?: AgentRunSettings<Output, RawResponseOf<M>>): Promise<AgentOutcome<Output>>;
145
+ stream(options: AgentRunOptions<Output, RawResponseOf<M>>): AgentStream<Output, RawResponseOf<M>>;
146
+ compactMemory(options: AgentMemoryCompactionOptions): Promise<MemoryCompactionResult>;
143
147
  asTool(options: AgentToolOptions): Tool<{
144
148
  prompt: string;
145
149
  }, Output>;