@aigne/core 1.17.0 → 1.18.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/CHANGELOG.md +33 -19
- package/lib/cjs/agents/agent.d.ts +27 -11
- package/lib/cjs/agents/agent.js +36 -12
- package/lib/cjs/agents/ai-agent.d.ts +1 -3
- package/lib/cjs/agents/ai-agent.js +2 -11
- package/lib/cjs/agents/mcp-agent.d.ts +1 -1
- package/lib/cjs/agents/mcp-agent.js +5 -11
- package/lib/cjs/agents/user-agent.d.ts +0 -1
- package/lib/cjs/agents/user-agent.js +1 -2
- package/lib/cjs/aigne/context.d.ts +2 -3
- package/lib/cjs/aigne/context.js +3 -5
- package/lib/cjs/aigne/message-queue.d.ts +6 -2
- package/lib/cjs/aigne/message-queue.js +2 -2
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/loader/agent-js.d.ts +1 -1
- package/lib/cjs/loader/agent-yaml.d.ts +2 -1
- package/lib/cjs/loader/agent-yaml.js +3 -2
- package/lib/cjs/loader/index.d.ts +5 -1
- package/lib/cjs/loader/index.js +25 -16
- package/lib/cjs/memory/retriever.d.ts +2 -2
- package/lib/cjs/prompt/prompt-builder.d.ts +2 -6
- package/lib/cjs/prompt/prompt-builder.js +10 -6
- package/lib/cjs/prompt/template.js +1 -3
- package/lib/cjs/utils/logger.js +3 -3
- package/lib/cjs/utils/nodejs.d.ts +8 -0
- package/lib/cjs/utils/nodejs.js +24 -0
- package/lib/dts/agents/agent.d.ts +27 -11
- package/lib/dts/agents/ai-agent.d.ts +1 -3
- package/lib/dts/agents/mcp-agent.d.ts +1 -1
- package/lib/dts/agents/user-agent.d.ts +0 -1
- package/lib/dts/aigne/context.d.ts +2 -3
- package/lib/dts/aigne/message-queue.d.ts +6 -2
- package/lib/dts/index.d.ts +1 -0
- package/lib/dts/loader/agent-js.d.ts +1 -1
- package/lib/dts/loader/agent-yaml.d.ts +2 -1
- package/lib/dts/loader/index.d.ts +5 -1
- package/lib/dts/memory/retriever.d.ts +2 -2
- package/lib/dts/prompt/prompt-builder.d.ts +2 -6
- package/lib/dts/utils/nodejs.d.ts +8 -0
- package/lib/esm/agents/agent.d.ts +27 -11
- package/lib/esm/agents/agent.js +37 -13
- package/lib/esm/agents/ai-agent.d.ts +1 -3
- package/lib/esm/agents/ai-agent.js +2 -11
- package/lib/esm/agents/mcp-agent.d.ts +1 -1
- package/lib/esm/agents/mcp-agent.js +5 -11
- package/lib/esm/agents/user-agent.d.ts +0 -1
- package/lib/esm/agents/user-agent.js +0 -1
- package/lib/esm/aigne/context.d.ts +2 -3
- package/lib/esm/aigne/context.js +3 -2
- package/lib/esm/aigne/message-queue.d.ts +6 -2
- package/lib/esm/aigne/message-queue.js +2 -2
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/loader/agent-js.d.ts +1 -1
- package/lib/esm/loader/agent-yaml.d.ts +2 -1
- package/lib/esm/loader/agent-yaml.js +3 -2
- package/lib/esm/loader/index.d.ts +5 -1
- package/lib/esm/loader/index.js +25 -16
- package/lib/esm/memory/retriever.d.ts +2 -2
- package/lib/esm/prompt/prompt-builder.d.ts +2 -6
- package/lib/esm/prompt/prompt-builder.js +11 -7
- package/lib/esm/prompt/template.js +1 -3
- package/lib/esm/utils/logger.js +3 -3
- package/lib/esm/utils/nodejs.d.ts +8 -0
- package/lib/esm/utils/nodejs.js +21 -0
- package/package.json +4 -6
- package/lib/cjs/memory/default-memory/default-memory-storage/index.d.ts +0 -30
- package/lib/cjs/memory/default-memory/default-memory-storage/index.js +0 -69
- package/lib/cjs/memory/default-memory/default-memory-storage/migrate.d.ts +0 -7
- package/lib/cjs/memory/default-memory/default-memory-storage/migrate.js +0 -53
- package/lib/cjs/memory/default-memory/default-memory-storage/migrations/20250523165801-init.d.ts +0 -7
- package/lib/cjs/memory/default-memory/default-memory-storage/migrations/20250523165801-init.js +0 -33
- package/lib/cjs/memory/default-memory/default-memory-storage/models/memory.d.ts +0 -10
- package/lib/cjs/memory/default-memory/default-memory-storage/models/memory.js +0 -32
- package/lib/cjs/memory/default-memory/index.d.ts +0 -10
- package/lib/cjs/memory/default-memory/index.js +0 -61
- package/lib/cjs/memory/default-memory/storage.d.ts +0 -13
- package/lib/cjs/memory/default-memory/storage.js +0 -6
- package/lib/cjs/utils/fs.d.ts +0 -2
- package/lib/cjs/utils/fs.js +0 -25
- package/lib/dts/memory/default-memory/default-memory-storage/index.d.ts +0 -30
- package/lib/dts/memory/default-memory/default-memory-storage/migrate.d.ts +0 -7
- package/lib/dts/memory/default-memory/default-memory-storage/migrations/20250523165801-init.d.ts +0 -7
- package/lib/dts/memory/default-memory/default-memory-storage/models/memory.d.ts +0 -10
- package/lib/dts/memory/default-memory/index.d.ts +0 -10
- package/lib/dts/memory/default-memory/storage.d.ts +0 -13
- package/lib/dts/utils/fs.d.ts +0 -2
- package/lib/esm/memory/default-memory/default-memory-storage/index.d.ts +0 -30
- package/lib/esm/memory/default-memory/default-memory-storage/index.js +0 -64
- package/lib/esm/memory/default-memory/default-memory-storage/migrate.d.ts +0 -7
- package/lib/esm/memory/default-memory/default-memory-storage/migrate.js +0 -16
- package/lib/esm/memory/default-memory/default-memory-storage/migrations/20250523165801-init.d.ts +0 -7
- package/lib/esm/memory/default-memory/default-memory-storage/migrations/20250523165801-init.js +0 -28
- package/lib/esm/memory/default-memory/default-memory-storage/models/memory.d.ts +0 -10
- package/lib/esm/memory/default-memory/default-memory-storage/models/memory.js +0 -29
- package/lib/esm/memory/default-memory/index.d.ts +0 -10
- package/lib/esm/memory/default-memory/index.js +0 -54
- package/lib/esm/memory/default-memory/storage.d.ts +0 -13
- package/lib/esm/memory/default-memory/storage.js +0 -2
- package/lib/esm/utils/fs.d.ts +0 -2
- package/lib/esm/utils/fs.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
## [1.
|
|
1
|
+
## [1.17.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.16.0...core-v1.17.0) (2025-05-25)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
* add
|
|
7
|
-
* add OrchestratorAgent in agent library ([25a5e9e](https://github.com/AIGNE-io/aigne-framework/commit/25a5e9e6c60d747c8bf484ac884b31dc02c14757))
|
|
8
|
-
* add sequential and parallel helper function ([a295697](https://github.com/AIGNE-io/aigne-framework/commit/a295697b5694754e02954fc5c7f382a3b219a3ab))
|
|
9
|
-
* add support for MCP resources ([1ded2fb](https://github.com/AIGNE-io/aigne-framework/commit/1ded2fbf222fa8984e75df0852ff384524f73b04))
|
|
10
|
-
* **core:** add ChatModelClaude to use models of anthropic ([#30](https://github.com/AIGNE-io/aigne-framework/issues/30)) ([0a62a64](https://github.com/AIGNE-io/aigne-framework/commit/0a62a6499e3da723a4646e67952051708ce7de6a))
|
|
11
|
-
* **core:** add support for subscribing topics for agent memory ([#28](https://github.com/AIGNE-io/aigne-framework/issues/28)) ([eeecc67](https://github.com/AIGNE-io/aigne-framework/commit/eeecc67049a60ebcc4cdba0fbcd987b3d81f4af6))
|
|
12
|
-
* **prompt-builder:** support chat history in PromptBuilder ([6ca05f2](https://github.com/AIGNE-io/aigne-framework/commit/6ca05f28eddb683a4f1e228865f8bbf8a8e190f1))
|
|
13
|
-
* support run puppeteer example chat loop in terminal ([85ce7f8](https://github.com/AIGNE-io/aigne-framework/commit/85ce7f8de8b443c86e50815dd7bcab99f869c4ce))
|
|
14
|
-
* use PromptBuilder instead of string instructions ([e4cb2cb](https://github.com/AIGNE-io/aigne-framework/commit/e4cb2cb6baf4f9bcef390567a4a174e9246c29a3))
|
|
6
|
+
* add user context support ([#131](https://github.com/AIGNE-io/aigne-framework/issues/131)) ([4dd9d20](https://github.com/AIGNE-io/aigne-framework/commit/4dd9d20953f6ac33933723db56efd9b44bafeb02))
|
|
15
7
|
|
|
8
|
+
## [1.18.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.17.0...core-v1.18.0) (2025-05-29)
|
|
16
9
|
|
|
17
|
-
### Bug Fixes
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
* **core:** enforce stricter input/output type checks ([#26](https://github.com/AIGNE-io/aigne-framework/issues/26)) ([ef8cf53](https://github.com/AIGNE-io/aigne-framework/commit/ef8cf53586aff08a809909c56ab2a20f215fa129))
|
|
21
|
-
* **MCP:** catch list resource error treat as empty list ([1885fab](https://github.com/AIGNE-io/aigne-framework/commit/1885fab3585e0dd1467b127e5b47cd0b98282bab))
|
|
22
|
-
* rename @aigne/core-next to @aigne/core ([3a81009](https://github.com/AIGNE-io/aigne-framework/commit/3a8100962c81813217b687ae28e8de604419c622))
|
|
23
|
-
* use text resource from MCP correctly ([8b9eba8](https://github.com/AIGNE-io/aigne-framework/commit/8b9eba83352ec096a2a5d4f410d4c4bde7420bce))
|
|
11
|
+
### Features
|
|
24
12
|
|
|
25
|
-
|
|
13
|
+
* add memory agents support for client agent ([#139](https://github.com/AIGNE-io/aigne-framework/issues/139)) ([57044fa](https://github.com/AIGNE-io/aigne-framework/commit/57044fa87b8abcba395cd05f941d6d312ab65764))
|
|
26
14
|
|
|
27
15
|
|
|
28
|
-
###
|
|
16
|
+
### Dependencies
|
|
29
17
|
|
|
30
|
-
*
|
|
18
|
+
* The following workspace dependencies were updated
|
|
19
|
+
* dependencies
|
|
20
|
+
* @aigne/platform-helpers bumped to 0.1.0
|
|
31
21
|
|
|
32
22
|
## [1.16.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.15.0...core-v1.16.0) (2025-05-23)
|
|
33
23
|
|
|
@@ -208,6 +198,30 @@
|
|
|
208
198
|
|
|
209
199
|
* **core:** use system message as user message for claude model if needed ([#32](https://github.com/AIGNE-io/aigne-framework/issues/32)) ([316a6d5](https://github.com/AIGNE-io/aigne-framework/commit/316a6d51f885cceee4020c24695f6588f6b7425f))
|
|
210
200
|
|
|
201
|
+
## [1.3.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.2.0...core-v1.3.0) (2025-03-24)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Features
|
|
205
|
+
|
|
206
|
+
* add Agent FunctionAgent AIAgent MCPAgent and ExecutionEngine ([4d2a5a1](https://github.com/AIGNE-io/aigne-framework/commit/4d2a5a1b3366b8f935f50a0937c2da6e49073348))
|
|
207
|
+
* add OrchestratorAgent in agent library ([25a5e9e](https://github.com/AIGNE-io/aigne-framework/commit/25a5e9e6c60d747c8bf484ac884b31dc02c14757))
|
|
208
|
+
* add sequential and parallel helper function ([a295697](https://github.com/AIGNE-io/aigne-framework/commit/a295697b5694754e02954fc5c7f382a3b219a3ab))
|
|
209
|
+
* add support for MCP resources ([1ded2fb](https://github.com/AIGNE-io/aigne-framework/commit/1ded2fbf222fa8984e75df0852ff384524f73b04))
|
|
210
|
+
* **core:** add ChatModelClaude to use models of anthropic ([#30](https://github.com/AIGNE-io/aigne-framework/issues/30)) ([0a62a64](https://github.com/AIGNE-io/aigne-framework/commit/0a62a6499e3da723a4646e67952051708ce7de6a))
|
|
211
|
+
* **core:** add support for subscribing topics for agent memory ([#28](https://github.com/AIGNE-io/aigne-framework/issues/28)) ([eeecc67](https://github.com/AIGNE-io/aigne-framework/commit/eeecc67049a60ebcc4cdba0fbcd987b3d81f4af6))
|
|
212
|
+
* **prompt-builder:** support chat history in PromptBuilder ([6ca05f2](https://github.com/AIGNE-io/aigne-framework/commit/6ca05f28eddb683a4f1e228865f8bbf8a8e190f1))
|
|
213
|
+
* support run puppeteer example chat loop in terminal ([85ce7f8](https://github.com/AIGNE-io/aigne-framework/commit/85ce7f8de8b443c86e50815dd7bcab99f869c4ce))
|
|
214
|
+
* use PromptBuilder instead of string instructions ([e4cb2cb](https://github.com/AIGNE-io/aigne-framework/commit/e4cb2cb6baf4f9bcef390567a4a174e9246c29a3))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
### Bug Fixes
|
|
218
|
+
|
|
219
|
+
* **AIAgent:** should pass both arguments (model generated) and input (user input) to tool ([c49d64e](https://github.com/AIGNE-io/aigne-framework/commit/c49d64ee35f7efd83b0f82f43205bb1c40f999e8))
|
|
220
|
+
* **core:** enforce stricter input/output type checks ([#26](https://github.com/AIGNE-io/aigne-framework/issues/26)) ([ef8cf53](https://github.com/AIGNE-io/aigne-framework/commit/ef8cf53586aff08a809909c56ab2a20f215fa129))
|
|
221
|
+
* **MCP:** catch list resource error treat as empty list ([1885fab](https://github.com/AIGNE-io/aigne-framework/commit/1885fab3585e0dd1467b127e5b47cd0b98282bab))
|
|
222
|
+
* rename @aigne/core-next to @aigne/core ([3a81009](https://github.com/AIGNE-io/aigne-framework/commit/3a8100962c81813217b687ae28e8de604419c622))
|
|
223
|
+
* use text resource from MCP correctly ([8b9eba8](https://github.com/AIGNE-io/aigne-framework/commit/8b9eba83352ec096a2a5d4f410d4c4bde7420bce))
|
|
224
|
+
|
|
211
225
|
## [1.2.0](https://github.com/AIGNE-io/aigne-framework/compare/core-next-v1.1.0...core-next-v1.2.0) (2025-03-18)
|
|
212
226
|
|
|
213
227
|
- chore: release v1.2.0
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { inspect } from "node:util";
|
|
2
1
|
import { ZodObject, type ZodType } from "zod";
|
|
3
2
|
import type { Context, UserContext } from "../aigne/context.js";
|
|
4
3
|
import type { MessagePayload } from "../aigne/message-queue.js";
|
|
5
|
-
import type { MemoryAgent } from "../memory/memory.js";
|
|
4
|
+
import type { Memory, MemoryAgent } from "../memory/memory.js";
|
|
5
|
+
import type { MemoryRecorderInput } from "../memory/recorder.js";
|
|
6
|
+
import type { MemoryRetrieverInput } from "../memory/retriever.js";
|
|
7
|
+
import { nodejs } from "../utils/nodejs.js";
|
|
6
8
|
import { type Nullish, type PromiseOrValue, type XOr } from "../utils/type-utils.js";
|
|
7
9
|
import type { GuideRailAgent, GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
8
10
|
import { type TransferAgentOutput } from "./types.js";
|
|
@@ -95,6 +97,10 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
|
|
|
95
97
|
* One or more memory agents this agent can use
|
|
96
98
|
*/
|
|
97
99
|
memory?: MemoryAgent | MemoryAgent[];
|
|
100
|
+
/**
|
|
101
|
+
* Maximum number of memory items to retrieve
|
|
102
|
+
*/
|
|
103
|
+
maxRetrieveMemoryCount?: number;
|
|
98
104
|
}
|
|
99
105
|
export declare const agentOptionsSchema: ZodObject<{
|
|
100
106
|
[key in keyof AgentOptions]: ZodType<AgentOptions[key]>;
|
|
@@ -125,6 +131,8 @@ export interface AgentInvokeOptions<U extends UserContext = UserContext> {
|
|
|
125
131
|
* and returns the final JSON result
|
|
126
132
|
*/
|
|
127
133
|
streaming?: boolean;
|
|
134
|
+
userContext?: U;
|
|
135
|
+
memories?: Pick<Memory, "content">[];
|
|
128
136
|
}
|
|
129
137
|
/**
|
|
130
138
|
* Agent is the base class for all agents.
|
|
@@ -149,11 +157,24 @@ export interface AgentInvokeOptions<U extends UserContext = UserContext> {
|
|
|
149
157
|
* {@includeCode ../../test/agents/agent.test.ts#example-custom-agent}
|
|
150
158
|
*/
|
|
151
159
|
export declare abstract class Agent<I extends Message = Message, O extends Message = Message> {
|
|
160
|
+
/**
|
|
161
|
+
* Custom object inspection behavior
|
|
162
|
+
*
|
|
163
|
+
* When using Node.js's util.inspect function to inspect an agent,
|
|
164
|
+
* only the agent's name will be shown, making output more concise
|
|
165
|
+
*
|
|
166
|
+
* @returns Agent name
|
|
167
|
+
*/
|
|
168
|
+
[nodejs.customInspect]: () => string;
|
|
152
169
|
constructor(options?: AgentOptions<I, O>);
|
|
153
170
|
/**
|
|
154
171
|
* List of memories this agent can use
|
|
155
172
|
*/
|
|
156
173
|
readonly memories: MemoryAgent[];
|
|
174
|
+
/**
|
|
175
|
+
* Maximum number of memory items to retrieve
|
|
176
|
+
*/
|
|
177
|
+
maxRetrieveMemoryCount?: number;
|
|
157
178
|
/**
|
|
158
179
|
* Lifecycle hooks for agent processing.
|
|
159
180
|
*
|
|
@@ -297,6 +318,10 @@ export declare abstract class Agent<I extends Message = Message, O extends Messa
|
|
|
297
318
|
*/
|
|
298
319
|
private checkContextStatus;
|
|
299
320
|
private newDefaultContext;
|
|
321
|
+
retrieveMemories(input: Pick<MemoryRetrieverInput, "limit"> & {
|
|
322
|
+
search?: Message | string;
|
|
323
|
+
}, options: Pick<AgentInvokeOptions, "context">): Promise<Pick<Memory, "content">[]>;
|
|
324
|
+
recordMemories(input: MemoryRecorderInput, options: Pick<AgentInvokeOptions, "context">): Promise<void>;
|
|
300
325
|
/**
|
|
301
326
|
* Invoke the agent with regular (non-streaming) response
|
|
302
327
|
*
|
|
@@ -460,15 +485,6 @@ export declare abstract class Agent<I extends Message = Message, O extends Messa
|
|
|
460
485
|
* {@includeCode ../../test/agents/agent.test.ts#example-agent-shutdown-by-using}
|
|
461
486
|
*/
|
|
462
487
|
shutdown(): Promise<void>;
|
|
463
|
-
/**
|
|
464
|
-
* Custom object inspection behavior
|
|
465
|
-
*
|
|
466
|
-
* When using Node.js's util.inspect function to inspect an agent,
|
|
467
|
-
* only the agent's name will be shown, making output more concise
|
|
468
|
-
*
|
|
469
|
-
* @returns Agent name
|
|
470
|
-
*/
|
|
471
|
-
[inspect.custom](): string;
|
|
472
488
|
/**
|
|
473
489
|
* Async dispose method for shutdown the agent
|
|
474
490
|
*
|
package/lib/cjs/agents/agent.js
CHANGED
|
@@ -40,10 +40,10 @@ exports.FunctionAgent = exports.Agent = exports.agentOptionsSchema = void 0;
|
|
|
40
40
|
exports.isEmptyChunk = isEmptyChunk;
|
|
41
41
|
exports.textDelta = textDelta;
|
|
42
42
|
exports.jsonDelta = jsonDelta;
|
|
43
|
-
const node_util_1 = require("node:util");
|
|
44
43
|
const zod_1 = require("zod");
|
|
45
44
|
const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
46
45
|
const logger_js_1 = require("../utils/logger.js");
|
|
46
|
+
const nodejs_js_1 = require("../utils/nodejs.js");
|
|
47
47
|
const stream_utils_js_1 = require("../utils/stream-utils.js");
|
|
48
48
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
49
49
|
const types_js_1 = require("./types.js");
|
|
@@ -61,6 +61,7 @@ exports.agentOptionsSchema = zod_1.z.object({
|
|
|
61
61
|
skills: zod_1.z.array(zod_1.z.union([zod_1.z.custom(), zod_1.z.custom()])).optional(),
|
|
62
62
|
disableEvents: zod_1.z.boolean().optional(),
|
|
63
63
|
memory: zod_1.z.union([zod_1.z.custom(), zod_1.z.array(zod_1.z.custom())]).optional(),
|
|
64
|
+
maxRetrieveMemoryCount: zod_1.z.number().optional(),
|
|
64
65
|
hooks: zod_1.z
|
|
65
66
|
.object({
|
|
66
67
|
onStart: zod_1.z.custom().optional(),
|
|
@@ -117,6 +118,7 @@ class Agent {
|
|
|
117
118
|
else if (options.memory) {
|
|
118
119
|
this.memories.push(options.memory);
|
|
119
120
|
}
|
|
121
|
+
this.maxRetrieveMemoryCount = options.maxRetrieveMemoryCount;
|
|
120
122
|
this.hooks = options.hooks ?? {};
|
|
121
123
|
this.guideRails = options.guideRails;
|
|
122
124
|
}
|
|
@@ -124,6 +126,10 @@ class Agent {
|
|
|
124
126
|
* List of memories this agent can use
|
|
125
127
|
*/
|
|
126
128
|
memories = [];
|
|
129
|
+
/**
|
|
130
|
+
* Maximum number of memory items to retrieve
|
|
131
|
+
*/
|
|
132
|
+
maxRetrieveMemoryCount;
|
|
127
133
|
/**
|
|
128
134
|
* Lifecycle hooks for agent processing.
|
|
129
135
|
*
|
|
@@ -304,11 +310,33 @@ class Agent {
|
|
|
304
310
|
async newDefaultContext() {
|
|
305
311
|
return Promise.resolve().then(() => __importStar(require("../aigne/context.js"))).then((m) => new m.AIGNEContext());
|
|
306
312
|
}
|
|
313
|
+
async retrieveMemories(input, options) {
|
|
314
|
+
const memories = [];
|
|
315
|
+
for (const memory of this.memories) {
|
|
316
|
+
const ms = (await memory.retrieve({
|
|
317
|
+
...input,
|
|
318
|
+
search: typeof input === "string" ? input : input && (0, prompt_builder_js_1.getMessage)(input),
|
|
319
|
+
limit: input.limit ?? this.maxRetrieveMemoryCount,
|
|
320
|
+
}, options.context)).memories;
|
|
321
|
+
memories.push(...ms);
|
|
322
|
+
}
|
|
323
|
+
return memories;
|
|
324
|
+
}
|
|
325
|
+
async recordMemories(input, options) {
|
|
326
|
+
for (const memory of this.memories) {
|
|
327
|
+
if (memory.autoUpdate) {
|
|
328
|
+
await memory.record(input, options.context);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
307
332
|
async invoke(input, options = {}) {
|
|
308
333
|
const opts = {
|
|
309
334
|
...options,
|
|
310
335
|
context: options.context ?? (await this.newDefaultContext()),
|
|
311
336
|
};
|
|
337
|
+
if (options.userContext) {
|
|
338
|
+
Object.assign(opts.context.userContext, options.userContext);
|
|
339
|
+
}
|
|
312
340
|
const message = typeof input === "string" ? (0, prompt_builder_js_1.createMessage)(input) : input;
|
|
313
341
|
logger_js_1.logger.debug("Invoke agent %s started with input: %O", this.name, input);
|
|
314
342
|
if (!this.disableEvents)
|
|
@@ -482,16 +510,12 @@ class Agent {
|
|
|
482
510
|
async postprocess(input, output, options) {
|
|
483
511
|
this.checkContextStatus(options);
|
|
484
512
|
this.publishToTopics(output, options);
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
],
|
|
492
|
-
}, options.context);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
513
|
+
await this.recordMemories({
|
|
514
|
+
content: [
|
|
515
|
+
{ role: "user", content: input },
|
|
516
|
+
{ role: "agent", content: (0, types_js_1.replaceTransferAgentToName)(output), source: this.name },
|
|
517
|
+
],
|
|
518
|
+
}, options);
|
|
495
519
|
}
|
|
496
520
|
async publishToTopics(output, options) {
|
|
497
521
|
const publishTopics = typeof this.publishTopic === "function" ? await this.publishTopic(output) : this.publishTopic;
|
|
@@ -533,7 +557,7 @@ class Agent {
|
|
|
533
557
|
*
|
|
534
558
|
* @returns Agent name
|
|
535
559
|
*/
|
|
536
|
-
[
|
|
560
|
+
[nodejs_js_1.nodejs.customInspect]() {
|
|
537
561
|
return this.name;
|
|
538
562
|
}
|
|
539
563
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
|
-
import { type DefaultMemoryOptions } from "../memory/default-memory/index.js";
|
|
3
2
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
4
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type Message } from "./agent.js";
|
|
5
4
|
import { ChatModel, type ChatModelInput } from "./chat-model.js";
|
|
@@ -13,7 +12,7 @@ import type { GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
|
13
12
|
* @template I The input message type the agent accepts
|
|
14
13
|
* @template O The output message type the agent returns
|
|
15
14
|
*/
|
|
16
|
-
export interface AIAgentOptions<I extends Message = Message, O extends Message = Message> extends
|
|
15
|
+
export interface AIAgentOptions<I extends Message = Message, O extends Message = Message> extends AgentOptions<I, O> {
|
|
17
16
|
/**
|
|
18
17
|
* The language model to use for this agent
|
|
19
18
|
*
|
|
@@ -65,7 +64,6 @@ export interface AIAgentOptions<I extends Message = Message, O extends Message =
|
|
|
65
64
|
* The template receives a {{memories}} variable containing serialized memory content.
|
|
66
65
|
*/
|
|
67
66
|
memoryPromptTemplate?: string;
|
|
68
|
-
memory?: AgentOptions<I, O>["memory"] | DefaultMemoryOptions | true;
|
|
69
67
|
}
|
|
70
68
|
/**
|
|
71
69
|
* Tool choice options for AI agents
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AIAgent = exports.aiAgentOptionsSchema = exports.aiAgentToolChoiceSchema = exports.AIAgentToolChoice = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const index_js_1 = require("../memory/default-memory/index.js");
|
|
6
|
-
const memory_js_1 = require("../memory/memory.js");
|
|
7
5
|
const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
8
6
|
const template_js_1 = require("../prompt/template.js");
|
|
9
7
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
@@ -101,14 +99,7 @@ class AIAgent extends agent_js_1.Agent {
|
|
|
101
99
|
* @param options Configuration options for the AI agent
|
|
102
100
|
*/
|
|
103
101
|
constructor(options) {
|
|
104
|
-
super(
|
|
105
|
-
...options,
|
|
106
|
-
memory: !options.memory
|
|
107
|
-
? undefined
|
|
108
|
-
: Array.isArray(options.memory) || options.memory instanceof memory_js_1.MemoryAgent
|
|
109
|
-
? options.memory
|
|
110
|
-
: new index_js_1.DefaultMemory(options.memory === true ? {} : options.memory),
|
|
111
|
-
});
|
|
102
|
+
super(options);
|
|
112
103
|
(0, type_utils_js_1.checkArguments)("AIAgent", exports.aiAgentOptionsSchema, options);
|
|
113
104
|
this.model = options.model;
|
|
114
105
|
this.instructions =
|
|
@@ -193,10 +184,10 @@ class AIAgent extends agent_js_1.Agent {
|
|
|
193
184
|
if (!model)
|
|
194
185
|
throw new Error("model is required to run AIAgent");
|
|
195
186
|
const { toolAgents, ...modelInput } = await this.instructions.build({
|
|
187
|
+
...options,
|
|
196
188
|
agent: this,
|
|
197
189
|
input,
|
|
198
190
|
model,
|
|
199
|
-
context: options.context,
|
|
200
191
|
});
|
|
201
192
|
const toolsMap = new Map(toolAgents?.map((i) => [i.name, i]));
|
|
202
193
|
if (this.toolChoice === "router") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, type ClientOptions } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
2
|
import { type SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { StdioServerParameters } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
4
|
import { type StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
5
5
|
import type { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
6
6
|
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
@@ -4,15 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MCPResource = exports.MCPPrompt = exports.MCPTool = exports.MCPBase = exports.MCPAgent = void 0;
|
|
7
|
+
const stdio_client_transport_js_1 = require("@aigne/platform-helpers/mcp/stdio-client-transport.js");
|
|
7
8
|
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
8
9
|
const sse_js_1 = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
9
|
-
const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
10
10
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
11
11
|
const uriTemplate_js_1 = require("@modelcontextprotocol/sdk/shared/uriTemplate.js");
|
|
12
12
|
const p_retry_1 = __importDefault(require("p-retry"));
|
|
13
13
|
const zod_1 = require("zod");
|
|
14
14
|
const logger_js_1 = require("../utils/logger.js");
|
|
15
15
|
const mcp_utils_js_1 = require("../utils/mcp-utils.js");
|
|
16
|
+
const nodejs_js_1 = require("../utils/nodejs.js");
|
|
16
17
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
17
18
|
const agent_js_1 = require("./agent.js");
|
|
18
19
|
const MCP_AGENT_CLIENT_NAME = "AIGNE/MCPAgent";
|
|
@@ -22,7 +23,7 @@ const DEFAULT_TIMEOUT = () => zod_1.z.coerce
|
|
|
22
23
|
.number()
|
|
23
24
|
.int()
|
|
24
25
|
.min(0)
|
|
25
|
-
.safeParse(
|
|
26
|
+
.safeParse(nodejs_js_1.nodejs.env.MCP_TIMEOUT || nodejs_js_1.nodejs.env.TIMEOUT).data || 60e3;
|
|
26
27
|
function isSSEServerParameters(options) {
|
|
27
28
|
return "url" in options && typeof options.url === "string";
|
|
28
29
|
}
|
|
@@ -66,14 +67,7 @@ class MCPAgent extends agent_js_1.Agent {
|
|
|
66
67
|
return MCPAgent.fromTransport(transport, options);
|
|
67
68
|
}
|
|
68
69
|
if (isStdioServerParameters(options)) {
|
|
69
|
-
const transport = () =>
|
|
70
|
-
...options,
|
|
71
|
-
env: {
|
|
72
|
-
...(0, stdio_js_1.getDefaultEnvironment)(),
|
|
73
|
-
...options.env,
|
|
74
|
-
},
|
|
75
|
-
stderr: "pipe",
|
|
76
|
-
});
|
|
70
|
+
const transport = async () => (0, stdio_client_transport_js_1.createStdioClientTransport)(options);
|
|
77
71
|
return MCPAgent.fromTransport(transport, options);
|
|
78
72
|
}
|
|
79
73
|
return new MCPAgent(options);
|
|
@@ -83,7 +77,7 @@ class MCPAgent extends agent_js_1.Agent {
|
|
|
83
77
|
name: MCP_AGENT_CLIENT_NAME,
|
|
84
78
|
version: MCP_AGENT_CLIENT_VERSION,
|
|
85
79
|
}, undefined, isSSEServerParameters(options) ? { transportCreator, ...options } : undefined);
|
|
86
|
-
const transport = transportCreator();
|
|
80
|
+
const transport = await transportCreator();
|
|
87
81
|
logger_js_1.logger.debug(`Connecting to MCP server: ${getMCPServerString(options)}`);
|
|
88
82
|
await client.connect(transport);
|
|
89
83
|
const mcpServer = getMCPServerName(client);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from "node:stream/web";
|
|
2
1
|
import type { Context } from "../aigne/context.js";
|
|
3
2
|
import { type MessagePayload } from "../aigne/message-queue.js";
|
|
4
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type FunctionAgentFn, type Message } from "./agent.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserAgent = void 0;
|
|
4
|
-
const web_1 = require("node:stream/web");
|
|
5
4
|
const message_queue_js_1 = require("../aigne/message-queue.js");
|
|
6
5
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
7
6
|
const agent_js_1 = require("./agent.js");
|
|
@@ -66,7 +65,7 @@ class UserAgent extends agent_js_1.Agent {
|
|
|
66
65
|
});
|
|
67
66
|
get stream() {
|
|
68
67
|
let subscriptions = [];
|
|
69
|
-
return new
|
|
68
|
+
return new ReadableStream({
|
|
70
69
|
start: (controller) => {
|
|
71
70
|
const subscribeTopic = (0, type_utils_js_1.orArrayToArray)(this.subscribeTopic);
|
|
72
71
|
subscriptions = subscribeTopic.map((topic) => this.subscribe(topic, (message) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Emitter } from "strict-event-emitter";
|
|
2
2
|
import { Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
3
3
|
import type { ChatModel } from "../agents/chat-model.js";
|
|
4
4
|
import { UserAgent } from "../agents/user-agent.js";
|
|
@@ -42,7 +42,6 @@ export interface InvokeOptions<U extends UserContext = UserContext> extends Part
|
|
|
42
42
|
returnActiveAgent?: boolean;
|
|
43
43
|
disableTransfer?: boolean;
|
|
44
44
|
sourceAgent?: Agent;
|
|
45
|
-
userContext?: U;
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* @hidden
|
|
@@ -150,7 +149,7 @@ declare class AIGNEContextShared {
|
|
|
150
149
|
messageQueue?: MessageQueue;
|
|
151
150
|
}) | undefined, overrides?: Partial<Context>);
|
|
152
151
|
readonly messageQueue: MessageQueue;
|
|
153
|
-
readonly events:
|
|
152
|
+
readonly events: Emitter<any>;
|
|
154
153
|
get model(): ChatModel | undefined;
|
|
155
154
|
get skills(): Agent<Message, Message>[] | undefined;
|
|
156
155
|
get limits(): ContextLimits | undefined;
|
package/lib/cjs/aigne/context.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.AIGNEContext = void 0;
|
|
7
|
-
const
|
|
4
|
+
const strict_event_emitter_1 = require("strict-event-emitter");
|
|
8
5
|
const uuid_1 = require("uuid");
|
|
9
6
|
const zod_1 = require("zod");
|
|
10
7
|
const agent_js_1 = require("../agents/agent.js");
|
|
@@ -150,7 +147,8 @@ class AIGNEContextShared {
|
|
|
150
147
|
this.userContext = overrides?.userContext ?? {};
|
|
151
148
|
}
|
|
152
149
|
messageQueue;
|
|
153
|
-
|
|
150
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
151
|
+
events = new strict_event_emitter_1.Emitter();
|
|
154
152
|
get model() {
|
|
155
153
|
return this.parent?.model;
|
|
156
154
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Emitter, type EventMap } from "strict-event-emitter";
|
|
2
2
|
import type { Message } from "../agents/agent.js";
|
|
3
3
|
import type { Context } from "./context.js";
|
|
4
4
|
/**
|
|
@@ -30,11 +30,14 @@ export type MessageQueueListener = (message: MessagePayload) => void;
|
|
|
30
30
|
* @hidden
|
|
31
31
|
*/
|
|
32
32
|
export type Unsubscribe = () => void;
|
|
33
|
+
interface MessageQueueEventMap extends EventMap {
|
|
34
|
+
[key: string]: any[];
|
|
35
|
+
}
|
|
33
36
|
/**
|
|
34
37
|
* @hidden
|
|
35
38
|
*/
|
|
36
39
|
export declare class MessageQueue {
|
|
37
|
-
events:
|
|
40
|
+
events: Emitter<MessageQueueEventMap>;
|
|
38
41
|
publish(topic: string | string[], payload: MessagePayload): void;
|
|
39
42
|
error(error: Error): void;
|
|
40
43
|
subscribe(topic: string | string[], listener?: undefined): Promise<MessagePayload>;
|
|
@@ -42,3 +45,4 @@ export declare class MessageQueue {
|
|
|
42
45
|
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
43
46
|
unsubscribe(topic: string | string[], listener: MessageQueueListener): void;
|
|
44
47
|
}
|
|
48
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageQueue = exports.UserOutputTopic = exports.UserInputTopic = void 0;
|
|
4
4
|
exports.toMessagePayload = toMessagePayload;
|
|
5
|
-
const
|
|
5
|
+
const strict_event_emitter_1 = require("strict-event-emitter");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
8
8
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
@@ -40,7 +40,7 @@ function toMessagePayload(payload, options) {
|
|
|
40
40
|
* @hidden
|
|
41
41
|
*/
|
|
42
42
|
class MessageQueue {
|
|
43
|
-
events = new
|
|
43
|
+
events = new strict_event_emitter_1.Emitter();
|
|
44
44
|
publish(topic, payload) {
|
|
45
45
|
(0, type_utils_js_1.checkArguments)("MessageQueue.publish", publishArgsSchema, {
|
|
46
46
|
topic,
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export * from "./agents/team-agent.js";
|
|
|
7
7
|
export * from "./agents/types.js";
|
|
8
8
|
export * from "./agents/user-agent.js";
|
|
9
9
|
export * from "./aigne/index.js";
|
|
10
|
+
export * from "./memory/index.js";
|
|
10
11
|
export * from "./prompt/prompt-builder.js";
|
|
11
12
|
export * from "./prompt/template.js";
|
package/lib/cjs/index.js
CHANGED
|
@@ -23,5 +23,6 @@ __exportStar(require("./agents/team-agent.js"), exports);
|
|
|
23
23
|
__exportStar(require("./agents/types.js"), exports);
|
|
24
24
|
__exportStar(require("./agents/user-agent.js"), exports);
|
|
25
25
|
__exportStar(require("./aigne/index.js"), exports);
|
|
26
|
+
__exportStar(require("./memory/index.js"), exports);
|
|
26
27
|
__exportStar(require("./prompt/prompt-builder.js"), exports);
|
|
27
28
|
__exportStar(require("./prompt/template.js"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
2
|
import type { Message } from "../agents/agent.js";
|
|
3
3
|
export declare function loadAgentFromJsFile(path: string): Promise<{
|
|
4
|
-
name: string;
|
|
5
4
|
process: (args_0: Message) => Message;
|
|
5
|
+
name: string;
|
|
6
6
|
description?: string | undefined;
|
|
7
7
|
inputSchema?: ZodObject<Record<string, ZodType<any, z.ZodTypeDef, any>>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
8
8
|
[x: string]: any;
|
|
@@ -5,10 +5,11 @@ export declare function loadAgentFromYamlFile(path: string): Promise<{
|
|
|
5
5
|
name: string;
|
|
6
6
|
description?: string | undefined;
|
|
7
7
|
skills?: string[] | undefined;
|
|
8
|
+
instructions?: string | undefined;
|
|
8
9
|
memory?: true | {
|
|
10
|
+
provider: string;
|
|
9
11
|
subscribeTopic?: string[] | undefined;
|
|
10
12
|
} | undefined;
|
|
11
|
-
instructions?: string | undefined;
|
|
12
13
|
inputSchema?: ZodObject<Record<string, ZodType<any, z.ZodTypeDef, any>>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
13
14
|
[x: string]: any;
|
|
14
15
|
}, {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadAgentFromYamlFile = loadAgentFromYamlFile;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
4
|
const json_schema_to_zod_1 = require("@aigne/json-schema-to-zod");
|
|
6
5
|
const yaml_1 = require("yaml");
|
|
7
6
|
const zod_1 = require("zod");
|
|
8
7
|
const ai_agent_js_1 = require("../agents/ai-agent.js");
|
|
9
8
|
const camelize_js_1 = require("../utils/camelize.js");
|
|
9
|
+
const nodejs_js_1 = require("../utils/nodejs.js");
|
|
10
10
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
11
11
|
const schema_js_1 = require("./schema.js");
|
|
12
12
|
const agentFileSchema = zod_1.z.discriminatedUnion("type", [
|
|
@@ -43,6 +43,7 @@ const agentFileSchema = zod_1.z.discriminatedUnion("type", [
|
|
|
43
43
|
.union([
|
|
44
44
|
zod_1.z.boolean(),
|
|
45
45
|
zod_1.z.object({
|
|
46
|
+
provider: zod_1.z.string(),
|
|
46
47
|
subscribe_topic: zod_1.z
|
|
47
48
|
.array(zod_1.z.string())
|
|
48
49
|
.nullish()
|
|
@@ -69,7 +70,7 @@ const agentFileSchema = zod_1.z.discriminatedUnion("type", [
|
|
|
69
70
|
}),
|
|
70
71
|
]);
|
|
71
72
|
async function loadAgentFromYamlFile(path) {
|
|
72
|
-
const raw = await (0, type_utils_js_1.tryOrThrow)(() =>
|
|
73
|
+
const raw = await (0, type_utils_js_1.tryOrThrow)(() => nodejs_js_1.nodejs.fs.readFile(path, "utf8"), (error) => new Error(`Failed to load agent definition from ${path}: ${error.message}`));
|
|
73
74
|
const json = await (0, type_utils_js_1.tryOrThrow)(() => (0, yaml_1.parse)(raw), (error) => new Error(`Failed to parse agent definition from ${path}: ${error.message}`));
|
|
74
75
|
const agent = (0, type_utils_js_1.tryOrThrow)(() => (0, camelize_js_1.customCamelize)(agentFileSchema.parse({
|
|
75
76
|
...json,
|
|
@@ -2,6 +2,7 @@ import type { Camelize } from "camelize-ts";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { type Agent } from "../agents/agent.js";
|
|
4
4
|
import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
|
|
5
|
+
import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
|
|
5
6
|
export interface LoadOptions {
|
|
6
7
|
models: {
|
|
7
8
|
new (parameters: {
|
|
@@ -9,6 +10,9 @@ export interface LoadOptions {
|
|
|
9
10
|
modelOptions?: ChatModelOptions;
|
|
10
11
|
}): ChatModel;
|
|
11
12
|
}[];
|
|
13
|
+
memories?: {
|
|
14
|
+
new (parameters?: MemoryAgentOptions): MemoryAgent;
|
|
15
|
+
}[];
|
|
12
16
|
path: string;
|
|
13
17
|
}
|
|
14
18
|
export declare function load(options: LoadOptions): Promise<{
|
|
@@ -26,7 +30,7 @@ export declare function load(options: LoadOptions): Promise<{
|
|
|
26
30
|
presence_penalty?: number | null | undefined;
|
|
27
31
|
} | null | undefined;
|
|
28
32
|
}>;
|
|
29
|
-
export declare function loadAgent(path: string): Promise<Agent>;
|
|
33
|
+
export declare function loadAgent(path: string, options?: LoadOptions): Promise<Agent>;
|
|
30
34
|
export declare function loadModel(models: LoadOptions["models"], model?: Camelize<z.infer<typeof aigneFileSchema>["chat_model"]>, modelOptions?: ChatModelOptions): Promise<ChatModel | undefined>;
|
|
31
35
|
declare const aigneFileSchema: z.ZodObject<{
|
|
32
36
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|