@anvia/core 1.0.0-rc.9 → 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.
- package/README.md +99 -77
- package/dist/agent/index.d.ts +11 -16
- package/dist/agent/index.js +8 -8
- package/dist/{agent-XPQBM4rX.d.ts → agent-qRKa3ibC.d.ts} +11 -7
- package/dist/{chunk-PISJAAMX.js → chunk-3ZLM6OAZ.js} +318 -114
- package/dist/chunk-3ZLM6OAZ.js.map +1 -0
- package/dist/{chunk-WZVHZZW6.js → chunk-6BBOCFHV.js} +2 -2
- package/dist/{chunk-WTRGYFCD.js → chunk-7PHMK7W4.js} +4 -4
- package/dist/{chunk-X4LK4ODN.js → chunk-AHLKV6KP.js} +1 -1
- package/dist/chunk-AHLKV6KP.js.map +1 -0
- package/dist/chunk-J6LVLV6P.js +13 -0
- package/dist/chunk-J6LVLV6P.js.map +1 -0
- package/dist/{chunk-KIXN5DGS.js → chunk-LTXABCOO.js} +2 -2
- package/dist/{chunk-QOUPWOGW.js → chunk-SPD4XVR7.js} +1 -1
- package/dist/{chunk-TC4FILD3.js → chunk-YA7BMX7D.js} +51 -4
- package/dist/chunk-YA7BMX7D.js.map +1 -0
- package/dist/completion/index.js +2 -2
- package/dist/documents/index.js +26 -1
- package/dist/documents/index.js.map +1 -1
- package/dist/evals/index.d.ts +5 -5
- package/dist/evals/index.js +6 -6
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.js +3 -3
- package/dist/index.d.ts +7 -12
- package/dist/index.js +22 -20
- package/dist/internal/agent.d.ts +4 -9
- package/dist/internal/agent.js +8 -8
- package/dist/mcp/index.d.ts +3 -17
- package/dist/mcp/index.js +1 -15
- package/dist/memory/index.d.ts +6 -3
- package/dist/memory/index.js +6 -4
- package/dist/observability/index.d.ts +2 -2
- package/dist/observability/index.js +3 -3
- package/dist/pipeline/index.d.ts +6 -11
- package/dist/pipeline/index.js +6 -6
- package/dist/pipeline/index.js.map +1 -1
- package/dist/{types-Sue2hb_L.d.ts → types-CLCLFpAL.d.ts} +23 -15
- package/dist/{types-DKOXVTcq.d.ts → types-CSYt7-It.d.ts} +18 -3
- package/dist/types-DjqRHeAi.d.ts +31 -0
- package/package.json +10 -4
- package/dist/chunk-76JLMBVT.js +0 -716
- package/dist/chunk-76JLMBVT.js.map +0 -1
- package/dist/chunk-PISJAAMX.js.map +0 -1
- package/dist/chunk-TC4FILD3.js.map +0 -1
- package/dist/chunk-X4LK4ODN.js.map +0 -1
- package/dist/client-DTPl0hZv.d.ts +0 -84
- /package/dist/{chunk-WZVHZZW6.js.map → chunk-6BBOCFHV.js.map} +0 -0
- /package/dist/{chunk-WTRGYFCD.js.map → chunk-7PHMK7W4.js.map} +0 -0
- /package/dist/{chunk-KIXN5DGS.js.map → chunk-LTXABCOO.js.map} +0 -0
- /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.
|
|
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
|
-
|
|
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
|
|
260
|
-
guardrail blocks return `
|
|
261
|
-
questions return a JSON-safe `
|
|
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
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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:
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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: {
|
|
387
|
-
retention: {
|
|
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(
|
|
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
|
|
402
|
-
|
|
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
|
|
516
|
-
|
|
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
|
-
|
|
544
|
-
|
|
545
|
-
} finally {
|
|
546
|
-
await mcp.close();
|
|
547
|
-
}
|
|
578
|
+
```sh
|
|
579
|
+
pnpm add @anvia/mcp
|
|
548
580
|
```
|
|
549
581
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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`:
|
|
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
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -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-
|
|
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
|
|
6
|
-
export { a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput,
|
|
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 '../
|
|
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 '
|
|
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:
|
|
66
|
-
constructor(result:
|
|
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:
|
|
73
|
-
constructor(result:
|
|
67
|
+
readonly result: AgentInteractionOutcome;
|
|
68
|
+
constructor(result: AgentInteractionOutcome);
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
export {
|
|
71
|
+
export { AgentBlockedOutcome, AgentInteractionOutcome, AgentRunBlockedError, AgentRunCancelledError, AgentStreamClosedError, AgentStructuredOutputError, type AgentStructuredOutputFormat, type AgentStructuredOutputPhase, AgentToolSuspensionError, MaxTurnsError };
|
package/dist/agent/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
createVectorContext,
|
|
4
4
|
isVectorContext
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-YK4WAAS4.js";
|
|
5
|
+
} from "../chunk-3ZLM6OAZ.js";
|
|
7
6
|
import "../chunk-OJBFDBLG.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-J6LVLV6P.js";
|
|
8
|
+
import "../chunk-YA7BMX7D.js";
|
|
9
|
+
import "../chunk-6BBOCFHV.js";
|
|
10
|
+
import "../chunk-YK4WAAS4.js";
|
|
9
11
|
import "../chunk-SJMSS5SI.js";
|
|
10
12
|
import "../chunk-EMZKPRE6.js";
|
|
11
|
-
import "../chunk-TC4FILD3.js";
|
|
12
|
-
import "../chunk-WZVHZZW6.js";
|
|
13
13
|
import {
|
|
14
14
|
AgentRunBlockedError,
|
|
15
15
|
AgentRunCancelledError,
|
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
AgentStructuredOutputError,
|
|
18
18
|
AgentToolSuspensionError,
|
|
19
19
|
MaxTurnsError
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-AHLKV6KP.js";
|
|
21
21
|
import "../chunk-ZA564323.js";
|
|
22
22
|
import "../chunk-3RM57ZT2.js";
|
|
23
23
|
import "../chunk-D4PACGPA.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-QGX73TSQ.js";
|
|
24
|
+
import "../chunk-7PHMK7W4.js";
|
|
26
25
|
import "../chunk-7JLAIN6E.js";
|
|
26
|
+
import "../chunk-QGX73TSQ.js";
|
|
27
27
|
import "../chunk-3XQGVDU5.js";
|
|
28
28
|
import "../chunk-3RWESPUG.js";
|
|
29
29
|
import "../chunk-AZB6N7P4.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 './
|
|
6
|
-
import {
|
|
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 {
|
|
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
|
-
|
|
78
|
+
afterTokens: number;
|
|
78
79
|
};
|
|
79
80
|
retention: {
|
|
80
|
-
|
|
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<
|
|
142
|
-
|
|
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>;
|