@aigne/core 1.13.0 → 1.14.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 +15 -0
- package/README.md +13 -26
- package/README.zh.md +24 -37
- package/lib/cjs/agents/agent.d.ts +522 -15
- package/lib/cjs/agents/agent.js +357 -36
- package/lib/cjs/agents/ai-agent.d.ts +210 -52
- package/lib/cjs/agents/ai-agent.js +182 -24
- package/lib/cjs/agents/mcp-agent.d.ts +112 -0
- package/lib/cjs/agents/mcp-agent.js +79 -1
- package/lib/cjs/agents/team-agent.d.ts +99 -0
- package/lib/cjs/agents/team-agent.js +94 -0
- package/lib/cjs/agents/user-agent.d.ts +6 -4
- package/lib/cjs/agents/user-agent.js +16 -5
- package/lib/cjs/aigne/aigne.d.ts +263 -16
- package/lib/cjs/aigne/aigne.js +130 -20
- package/lib/cjs/aigne/context.d.ts +24 -8
- package/lib/cjs/aigne/context.js +8 -22
- package/lib/cjs/aigne/message-queue.d.ts +26 -4
- package/lib/cjs/aigne/message-queue.js +42 -7
- package/lib/cjs/aigne/usage.d.ts +9 -0
- package/lib/cjs/aigne/usage.js +3 -0
- package/lib/cjs/client/client.d.ts +81 -3
- package/lib/cjs/client/client.js +38 -0
- package/lib/cjs/client/index.d.ts +1 -0
- package/lib/cjs/client/index.js +17 -0
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/loader/agent-js.d.ts +1 -1
- package/lib/cjs/loader/agent-js.js +2 -2
- package/lib/cjs/loader/agent-yaml.d.ts +3 -2
- package/lib/cjs/loader/agent-yaml.js +2 -1
- package/lib/cjs/loader/index.d.ts +4 -4
- package/lib/cjs/memory/default-memory.d.ts +16 -0
- package/lib/cjs/memory/default-memory.js +70 -0
- package/lib/cjs/memory/index.d.ts +3 -0
- package/lib/cjs/memory/index.js +19 -0
- package/lib/cjs/memory/memory.d.ts +89 -0
- package/lib/cjs/memory/memory.js +132 -0
- package/lib/cjs/memory/recorder.d.ts +86 -0
- package/lib/cjs/memory/recorder.js +50 -0
- package/lib/cjs/memory/retriever.d.ts +99 -0
- package/lib/cjs/memory/retriever.js +51 -0
- package/lib/cjs/models/bedrock-chat-model.d.ts +12 -3
- package/lib/cjs/models/bedrock-chat-model.js +54 -24
- package/lib/cjs/models/chat-model.d.ts +278 -1
- package/lib/cjs/models/chat-model.js +54 -0
- package/lib/cjs/models/claude-chat-model.d.ts +49 -3
- package/lib/cjs/models/claude-chat-model.js +34 -2
- package/lib/cjs/models/deepseek-chat-model.d.ts +16 -0
- package/lib/cjs/models/deepseek-chat-model.js +16 -0
- package/lib/cjs/models/gemini-chat-model.d.ts +14 -0
- package/lib/cjs/models/gemini-chat-model.js +14 -0
- package/lib/cjs/models/ollama-chat-model.d.ts +16 -0
- package/lib/cjs/models/ollama-chat-model.js +16 -0
- package/lib/cjs/models/open-router-chat-model.d.ts +16 -0
- package/lib/cjs/models/open-router-chat-model.js +16 -0
- package/lib/cjs/models/openai-chat-model.d.ts +67 -3
- package/lib/cjs/models/openai-chat-model.js +47 -2
- package/lib/cjs/models/xai-chat-model.d.ts +16 -0
- package/lib/cjs/models/xai-chat-model.js +16 -0
- package/lib/cjs/prompt/prompt-builder.d.ts +4 -4
- package/lib/cjs/prompt/prompt-builder.js +19 -18
- package/lib/cjs/prompt/prompts/memory-message-template.d.ts +1 -0
- package/lib/cjs/prompt/prompts/memory-message-template.js +10 -0
- package/lib/cjs/prompt/template.js +5 -1
- package/lib/cjs/server/error.d.ts +11 -0
- package/lib/cjs/server/error.js +11 -0
- package/lib/cjs/server/index.d.ts +2 -0
- package/lib/cjs/server/index.js +18 -0
- package/lib/cjs/server/server.d.ts +89 -8
- package/lib/cjs/server/server.js +58 -0
- package/lib/cjs/utils/fs.d.ts +2 -0
- package/lib/cjs/utils/fs.js +25 -0
- package/lib/cjs/utils/prompts.d.ts +1 -0
- package/lib/cjs/utils/prompts.js +11 -2
- package/lib/cjs/utils/type-utils.d.ts +1 -0
- package/lib/cjs/utils/type-utils.js +14 -0
- package/lib/dts/agents/agent.d.ts +522 -15
- package/lib/dts/agents/ai-agent.d.ts +210 -52
- package/lib/dts/agents/mcp-agent.d.ts +112 -0
- package/lib/dts/agents/team-agent.d.ts +99 -0
- package/lib/dts/agents/user-agent.d.ts +6 -4
- package/lib/dts/aigne/aigne.d.ts +263 -16
- package/lib/dts/aigne/context.d.ts +24 -8
- package/lib/dts/aigne/message-queue.d.ts +26 -4
- package/lib/dts/aigne/usage.d.ts +9 -0
- package/lib/dts/client/client.d.ts +81 -3
- package/lib/dts/client/index.d.ts +1 -0
- package/lib/dts/index.d.ts +0 -1
- package/lib/dts/loader/agent-js.d.ts +1 -1
- package/lib/dts/loader/agent-yaml.d.ts +3 -2
- package/lib/dts/loader/index.d.ts +4 -4
- package/lib/dts/memory/default-memory.d.ts +16 -0
- package/lib/dts/memory/index.d.ts +3 -0
- package/lib/dts/memory/memory.d.ts +89 -0
- package/lib/dts/memory/recorder.d.ts +86 -0
- package/lib/dts/memory/retriever.d.ts +99 -0
- package/lib/dts/models/bedrock-chat-model.d.ts +12 -3
- package/lib/dts/models/chat-model.d.ts +278 -1
- package/lib/dts/models/claude-chat-model.d.ts +49 -3
- package/lib/dts/models/deepseek-chat-model.d.ts +16 -0
- package/lib/dts/models/gemini-chat-model.d.ts +14 -0
- package/lib/dts/models/ollama-chat-model.d.ts +16 -0
- package/lib/dts/models/open-router-chat-model.d.ts +16 -0
- package/lib/dts/models/openai-chat-model.d.ts +67 -3
- package/lib/dts/models/xai-chat-model.d.ts +16 -0
- package/lib/dts/prompt/prompt-builder.d.ts +4 -4
- package/lib/dts/prompt/prompts/memory-message-template.d.ts +1 -0
- package/lib/dts/server/error.d.ts +11 -0
- package/lib/dts/server/index.d.ts +2 -0
- package/lib/dts/server/server.d.ts +89 -8
- package/lib/dts/utils/fs.d.ts +2 -0
- package/lib/dts/utils/prompts.d.ts +1 -0
- package/lib/dts/utils/type-utils.d.ts +1 -0
- package/lib/esm/agents/agent.d.ts +522 -15
- package/lib/esm/agents/agent.js +351 -35
- package/lib/esm/agents/ai-agent.d.ts +210 -52
- package/lib/esm/agents/ai-agent.js +183 -25
- package/lib/esm/agents/mcp-agent.d.ts +112 -0
- package/lib/esm/agents/mcp-agent.js +79 -1
- package/lib/esm/agents/team-agent.d.ts +99 -0
- package/lib/esm/agents/team-agent.js +94 -0
- package/lib/esm/agents/user-agent.d.ts +6 -4
- package/lib/esm/agents/user-agent.js +17 -6
- package/lib/esm/aigne/aigne.d.ts +263 -16
- package/lib/esm/aigne/aigne.js +132 -22
- package/lib/esm/aigne/context.d.ts +24 -8
- package/lib/esm/aigne/context.js +9 -22
- package/lib/esm/aigne/message-queue.d.ts +26 -4
- package/lib/esm/aigne/message-queue.js +42 -8
- package/lib/esm/aigne/usage.d.ts +9 -0
- package/lib/esm/aigne/usage.js +3 -0
- package/lib/esm/client/client.d.ts +81 -3
- package/lib/esm/client/client.js +38 -0
- package/lib/esm/client/index.d.ts +1 -0
- package/lib/esm/client/index.js +1 -0
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/loader/agent-js.d.ts +1 -1
- package/lib/esm/loader/agent-js.js +2 -2
- package/lib/esm/loader/agent-yaml.d.ts +3 -2
- package/lib/esm/loader/agent-yaml.js +2 -1
- package/lib/esm/loader/index.d.ts +4 -4
- package/lib/esm/memory/default-memory.d.ts +16 -0
- package/lib/esm/memory/default-memory.js +63 -0
- package/lib/esm/memory/index.d.ts +3 -0
- package/lib/esm/memory/index.js +3 -0
- package/lib/esm/memory/memory.d.ts +89 -0
- package/lib/esm/memory/memory.js +127 -0
- package/lib/esm/memory/recorder.d.ts +86 -0
- package/lib/esm/memory/recorder.js +46 -0
- package/lib/esm/memory/retriever.d.ts +99 -0
- package/lib/esm/memory/retriever.js +47 -0
- package/lib/esm/models/bedrock-chat-model.d.ts +12 -3
- package/lib/esm/models/bedrock-chat-model.js +56 -26
- package/lib/esm/models/chat-model.d.ts +278 -1
- package/lib/esm/models/chat-model.js +54 -0
- package/lib/esm/models/claude-chat-model.d.ts +49 -3
- package/lib/esm/models/claude-chat-model.js +35 -3
- package/lib/esm/models/deepseek-chat-model.d.ts +16 -0
- package/lib/esm/models/deepseek-chat-model.js +16 -0
- package/lib/esm/models/gemini-chat-model.d.ts +14 -0
- package/lib/esm/models/gemini-chat-model.js +14 -0
- package/lib/esm/models/ollama-chat-model.d.ts +16 -0
- package/lib/esm/models/ollama-chat-model.js +16 -0
- package/lib/esm/models/open-router-chat-model.d.ts +16 -0
- package/lib/esm/models/open-router-chat-model.js +16 -0
- package/lib/esm/models/openai-chat-model.d.ts +67 -3
- package/lib/esm/models/openai-chat-model.js +47 -2
- package/lib/esm/models/xai-chat-model.d.ts +16 -0
- package/lib/esm/models/xai-chat-model.js +16 -0
- package/lib/esm/prompt/prompt-builder.d.ts +4 -4
- package/lib/esm/prompt/prompt-builder.js +20 -19
- package/lib/esm/prompt/prompts/memory-message-template.d.ts +1 -0
- package/lib/esm/prompt/prompts/memory-message-template.js +7 -0
- package/lib/esm/prompt/template.js +5 -1
- package/lib/esm/server/error.d.ts +11 -0
- package/lib/esm/server/error.js +11 -0
- package/lib/esm/server/index.d.ts +2 -0
- package/lib/esm/server/index.js +2 -0
- package/lib/esm/server/server.d.ts +89 -8
- package/lib/esm/server/server.js +58 -0
- package/lib/esm/utils/fs.d.ts +2 -0
- package/lib/esm/utils/fs.js +21 -0
- package/lib/esm/utils/prompts.d.ts +1 -0
- package/lib/esm/utils/prompts.js +10 -2
- package/lib/esm/utils/type-utils.d.ts +1 -0
- package/lib/esm/utils/type-utils.js +13 -0
- package/package.json +14 -11
- package/lib/cjs/agents/memory.d.ts +0 -26
- package/lib/cjs/agents/memory.js +0 -45
- package/lib/dts/agents/memory.d.ts +0 -26
- package/lib/esm/agents/memory.d.ts +0 -26
- package/lib/esm/agents/memory.js +0 -41
- /package/{LICENSE → LICENSE.md} +0 -0
package/lib/dts/aigne/aigne.d.ts
CHANGED
|
@@ -1,38 +1,285 @@
|
|
|
1
|
-
import { Agent } from "../agents/agent.js";
|
|
1
|
+
import { Agent, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
2
|
+
import type { UserAgent } from "../agents/user-agent.js";
|
|
2
3
|
import { ChatModel } from "../models/chat-model.js";
|
|
3
|
-
import { AIGNEContext, type
|
|
4
|
-
import { MessageQueue } from "./message-queue.js";
|
|
4
|
+
import { AIGNEContext, type InvokeOptions } from "./context.js";
|
|
5
|
+
import { type MessagePayload, MessageQueue, type MessageQueueListener, type Unsubscribe } from "./message-queue.js";
|
|
5
6
|
import type { ContextLimits } from "./usage.js";
|
|
7
|
+
/**
|
|
8
|
+
* Options for the AIGNE class.
|
|
9
|
+
*/
|
|
6
10
|
export interface AIGNEOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The name of the AIGNE instance.
|
|
13
|
+
*/
|
|
7
14
|
name?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The description of the AIGNE instance.
|
|
17
|
+
*/
|
|
8
18
|
description?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Global model to use for all agents not specifying a model.
|
|
21
|
+
*/
|
|
9
22
|
model?: ChatModel;
|
|
23
|
+
/**
|
|
24
|
+
* Skills to use for the AIGNE instance.
|
|
25
|
+
*/
|
|
10
26
|
skills?: Agent[];
|
|
27
|
+
/**
|
|
28
|
+
* Agents to use for the AIGNE instance.
|
|
29
|
+
*/
|
|
11
30
|
agents?: Agent[];
|
|
31
|
+
/**
|
|
32
|
+
* Limits for the AIGNE instance, such as timeout, max tokens, max invocations, etc.
|
|
33
|
+
*/
|
|
12
34
|
limits?: ContextLimits;
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* AIGNE is a class that orchestrates multiple agents to build complex AI applications.
|
|
38
|
+
* It serves as the central coordination point for agent interactions, message passing, and execution flow.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* Here's a simple example of how to use AIGNE:
|
|
42
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-simple}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* Here's an example of how to use AIGNE with streaming response:
|
|
46
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-streaming}
|
|
47
|
+
*/
|
|
14
48
|
export declare class AIGNE {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Loads an AIGNE instance from a directory containing an aigne.yaml file and agent definitions.
|
|
51
|
+
* This static method provides a convenient way to initialize an AIGNE system from configuration files.
|
|
52
|
+
*
|
|
53
|
+
* @param path - Path to the directory containing the aigne.yaml file.
|
|
54
|
+
* @param options - Options to override the loaded configuration.
|
|
55
|
+
* @returns A fully initialized AIGNE instance with configured agents and skills.
|
|
56
|
+
*/
|
|
57
|
+
static load(path: string, options?: AIGNEOptions): Promise<AIGNE>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new AIGNE instance with the specified options.
|
|
60
|
+
*
|
|
61
|
+
* @param options - Configuration options for the AIGNE instance including name, description, model, and agents.
|
|
62
|
+
*/
|
|
18
63
|
constructor(options?: AIGNEOptions);
|
|
64
|
+
/**
|
|
65
|
+
* Optional name identifier for this AIGNE instance.
|
|
66
|
+
*/
|
|
19
67
|
name?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Optional description of this AIGNE instance's purpose or functionality.
|
|
70
|
+
*/
|
|
20
71
|
description?: string;
|
|
21
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Global model to use for all agents that don't specify their own model.
|
|
74
|
+
*/
|
|
22
75
|
model?: ChatModel;
|
|
23
|
-
|
|
24
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Usage limits applied to this AIGNE instance's execution.
|
|
78
|
+
*/
|
|
79
|
+
limits?: ContextLimits;
|
|
80
|
+
/**
|
|
81
|
+
* Message queue for handling inter-agent communication.
|
|
82
|
+
*
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
readonly messageQueue: MessageQueue;
|
|
86
|
+
/**
|
|
87
|
+
* Collection of skill agents available to this AIGNE instance.
|
|
88
|
+
* Provides indexed access by skill name.
|
|
89
|
+
*/
|
|
90
|
+
readonly skills: Agent<Message, Message>[] & {
|
|
91
|
+
[key: string]: Agent<Message, Message>;
|
|
25
92
|
};
|
|
26
|
-
|
|
27
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Collection of primary agents managed by this AIGNE instance.
|
|
95
|
+
* Provides indexed access by agent name.
|
|
96
|
+
*/
|
|
97
|
+
readonly agents: Agent<Message, Message>[] & {
|
|
98
|
+
[key: string]: Agent<Message, Message>;
|
|
28
99
|
};
|
|
29
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Adds one or more agents to this AIGNE instance.
|
|
102
|
+
* Each agent is attached to this AIGNE instance, allowing it to access the AIGNE's resources.
|
|
103
|
+
*
|
|
104
|
+
* @param agents - One or more Agent instances to add to this AIGNE.
|
|
105
|
+
*/
|
|
30
106
|
addAgent(...agents: Agent[]): void;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new execution context for this AIGNE instance.
|
|
109
|
+
* Contexts isolate state for different flows or conversations.
|
|
110
|
+
*
|
|
111
|
+
* @returns A new AIGNEContext instance bound to this AIGNE.
|
|
112
|
+
*/
|
|
31
113
|
newContext(): AIGNEContext;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Creates a user agent for consistent interactions with a specified agent.
|
|
116
|
+
* This method allows you to create a wrapper around an agent for repeated invocations.
|
|
117
|
+
*
|
|
118
|
+
* @param agent - Target agent to be wrapped for consistent invocation
|
|
119
|
+
* @returns A user agent instance that provides a convenient interface for interacting with the target agent
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* Here's an example of how to create a user agent and invoke it consistently:
|
|
123
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-user-agent}
|
|
124
|
+
*/
|
|
125
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>): UserAgent<I, O>;
|
|
126
|
+
/**
|
|
127
|
+
* Invokes an agent with a message and returns both the output and the active agent.
|
|
128
|
+
* This overload is useful when you need to track which agent was ultimately responsible for generating the response.
|
|
129
|
+
*
|
|
130
|
+
* @param agent - Target agent to invoke
|
|
131
|
+
* @param message - Input message to send to the agent (can be a string or a structured message object)
|
|
132
|
+
* @param options.returnActiveAgent - Must be true to return the final active agent
|
|
133
|
+
* @param options.streaming - Must be false to return a response stream
|
|
134
|
+
* @returns A promise resolving to a tuple containing the agent's response and the final active agent
|
|
135
|
+
*/
|
|
136
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I | string, options: InvokeOptions & {
|
|
137
|
+
returnActiveAgent: true;
|
|
138
|
+
streaming?: false;
|
|
139
|
+
}): Promise<[O, Agent]>;
|
|
140
|
+
/**
|
|
141
|
+
* Invokes an agent with a message and returns both a stream of the response and the active agent.
|
|
142
|
+
* This overload is useful when you need streaming responses while also tracking which agent provided them.
|
|
143
|
+
*
|
|
144
|
+
* @param agent - Target agent to invoke
|
|
145
|
+
* @param message - Input message to send to the agent (can be a string or a structured message object)
|
|
146
|
+
* @param options.returnActiveAgent - Must be true to return the final active agent
|
|
147
|
+
* @param options.streaming - Must be true to return a response stream
|
|
148
|
+
* @returns A promise resolving to a tuple containing the agent's response stream and a promise for the final agent
|
|
149
|
+
*/
|
|
150
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I | string, options: InvokeOptions & {
|
|
151
|
+
returnActiveAgent: true;
|
|
152
|
+
streaming: true;
|
|
153
|
+
}): Promise<[AgentResponseStream<O>, Promise<Agent>]>;
|
|
154
|
+
/**
|
|
155
|
+
* Invokes an agent with a message and returns just the output.
|
|
156
|
+
* This is the standard way to invoke an agent when you only need the response.
|
|
157
|
+
*
|
|
158
|
+
* @param agent - Target agent to invoke
|
|
159
|
+
* @param message - Input message to send to the agent (can be a string or a structured message object)
|
|
160
|
+
* @param options - Optional configuration parameters for the invocation
|
|
161
|
+
* @returns A promise resolving to the agent's complete response
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* Here's a simple example of how to invoke an agent:
|
|
165
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-simple}
|
|
166
|
+
*/
|
|
167
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I | string, options?: InvokeOptions & {
|
|
168
|
+
returnActiveAgent?: false;
|
|
169
|
+
streaming?: false;
|
|
170
|
+
}): Promise<O>;
|
|
171
|
+
/**
|
|
172
|
+
* Invokes an agent with a message and returns a stream of the response.
|
|
173
|
+
* This allows processing the response incrementally as it's being generated.
|
|
174
|
+
*
|
|
175
|
+
* @param agent - Target agent to invoke
|
|
176
|
+
* @param message - Input message to send to the agent (can be a string or a structured message object)
|
|
177
|
+
* @param options - Configuration with streaming enabled to receive incremental response chunks
|
|
178
|
+
* @returns A promise resolving to a stream of the agent's response that can be consumed incrementally
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* Here's an example of how to invoke an agent with streaming response:
|
|
182
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-streaming}
|
|
183
|
+
*/
|
|
184
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I | string, options: InvokeOptions & {
|
|
185
|
+
returnActiveAgent?: false;
|
|
186
|
+
streaming: true;
|
|
187
|
+
}): Promise<AgentResponseStream<O>>;
|
|
188
|
+
/**
|
|
189
|
+
* General implementation signature that handles all overload cases.
|
|
190
|
+
* This unified signature supports all the different invocation patterns defined by the overloads.
|
|
191
|
+
*
|
|
192
|
+
* @param agent - Target agent to invoke or wrap
|
|
193
|
+
* @param message - Optional input message to send to the agent
|
|
194
|
+
* @param options - Optional configuration parameters for the invocation
|
|
195
|
+
* @returns Either a UserAgent (when no message provided) or a promise resolving to the agent's response
|
|
196
|
+
* with optional active agent information based on the provided options
|
|
197
|
+
*/
|
|
198
|
+
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message?: I | string, options?: InvokeOptions): UserAgent<I, O> | Promise<AgentResponse<O> | [AgentResponse<O>, Agent]>;
|
|
199
|
+
/**
|
|
200
|
+
* Publishes a message to the message queue for inter-agent communication.
|
|
201
|
+
* This method broadcasts a message to all subscribers of the specified topic(s).
|
|
202
|
+
* It creates a new context internally and delegates to the context's publish method.
|
|
203
|
+
*
|
|
204
|
+
* @param topic - The topic or array of topics to publish the message to
|
|
205
|
+
* @param payload - The message payload to be delivered to subscribers
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* Here's an example of how to publish a message:
|
|
209
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-publish-message}
|
|
210
|
+
*/
|
|
211
|
+
publish(topic: string | string[], payload: Omit<MessagePayload, "context"> | Message | string): void;
|
|
212
|
+
/**
|
|
213
|
+
* Subscribes to receive the next message on a specific topic.
|
|
214
|
+
* This overload returns a Promise that resolves with the next message published to the topic.
|
|
215
|
+
* It's useful for one-time message handling or when using async/await patterns.
|
|
216
|
+
*
|
|
217
|
+
* @param topic - The topic to subscribe to
|
|
218
|
+
* @returns A Promise that resolves with the next message payload published to the specified topic
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* Here's an example of how to subscribe to a topic and receive the next message:
|
|
222
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-publish-message}
|
|
223
|
+
*/
|
|
224
|
+
subscribe(topic: string | string[], listener?: undefined): Promise<MessagePayload>;
|
|
225
|
+
/**
|
|
226
|
+
* Subscribes to messages on a specific topic with a listener callback.
|
|
227
|
+
* This overload registers a listener function that will be called for each message published to the topic.
|
|
228
|
+
* It's useful for continuous message handling or event-driven architectures.
|
|
229
|
+
*
|
|
230
|
+
* @param topic - The topic to subscribe to
|
|
231
|
+
* @param listener - Callback function that will be invoked when messages arrive on the specified topic
|
|
232
|
+
* @returns An Unsubscribe function that can be called to cancel the subscription
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* Here's an example of how to subscribe to a topic with a listener:
|
|
236
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-subscribe-topic}
|
|
237
|
+
*/
|
|
238
|
+
subscribe(topic: string | string[], listener: MessageQueueListener): Unsubscribe;
|
|
239
|
+
/**
|
|
240
|
+
* Generic subscribe signature that handles both Promise and listener patterns.
|
|
241
|
+
* This is the implementation signature that supports both overloaded behaviors.
|
|
242
|
+
*
|
|
243
|
+
* @param topic - The topic to subscribe to
|
|
244
|
+
* @param listener - Optional callback function
|
|
245
|
+
* @returns Either a Promise for the next message or an Unsubscribe function
|
|
246
|
+
*/
|
|
247
|
+
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
248
|
+
/**
|
|
249
|
+
* Unsubscribes a listener from a specific topic in the message queue.
|
|
250
|
+
* This method stops a previously registered listener from receiving further messages.
|
|
251
|
+
* It should be called when message processing is complete or when the component is no longer interested
|
|
252
|
+
* in messages published to the specified topic.
|
|
253
|
+
*
|
|
254
|
+
* @param topic - The topic to unsubscribe from
|
|
255
|
+
* @param listener - The listener function that was previously subscribed to the topic
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-subscribe-topic}
|
|
259
|
+
*/
|
|
260
|
+
unsubscribe(topic: string | string[], listener: MessageQueueListener): void;
|
|
261
|
+
/**
|
|
262
|
+
* Gracefully shuts down the AIGNE instance and all its agents and skills.
|
|
263
|
+
* This ensures proper cleanup of resources before termination.
|
|
264
|
+
*
|
|
265
|
+
* @returns A promise that resolves when shutdown is complete.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* Here's an example of shutdown an AIGNE instance:
|
|
269
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown}
|
|
270
|
+
*/
|
|
36
271
|
shutdown(): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Asynchronous dispose method for the AIGNE instance.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* Here's an example of using async dispose:
|
|
277
|
+
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown-using}
|
|
278
|
+
*/
|
|
279
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Initializes handlers for process exit events to ensure clean shutdown.
|
|
282
|
+
* This registers handlers for SIGINT and exit events to properly terminate all agents.
|
|
283
|
+
*/
|
|
37
284
|
private initProcessExitHandler;
|
|
38
285
|
}
|
|
@@ -6,12 +6,18 @@ import { type OmitPropertiesFromArrayFirstElement } from "../utils/type-utils.js
|
|
|
6
6
|
import type { Args, Listener, TypedEventEmitter } from "../utils/typed-event-emtter.js";
|
|
7
7
|
import { type MessagePayload, MessageQueue, type MessageQueueListener, type Unsubscribe } from "./message-queue.js";
|
|
8
8
|
import { type ContextLimits, type ContextUsage } from "./usage.js";
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
9
12
|
export interface AgentEvent {
|
|
10
13
|
parentContextId?: string;
|
|
11
14
|
contextId: string;
|
|
12
15
|
timestamp: number;
|
|
13
16
|
agent: Agent;
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
15
21
|
export interface ContextEventMap {
|
|
16
22
|
agentStarted: [AgentEvent & {
|
|
17
23
|
input: Message;
|
|
@@ -23,13 +29,22 @@ export interface ContextEventMap {
|
|
|
23
29
|
error: Error;
|
|
24
30
|
}];
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
26
35
|
export type ContextEmitEventMap = {
|
|
27
36
|
[K in keyof ContextEventMap]: OmitPropertiesFromArrayFirstElement<ContextEventMap[K], "contextId" | "parentContextId" | "timestamp">;
|
|
28
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
29
41
|
export interface InvokeOptions extends AgentInvokeOptions {
|
|
30
42
|
returnActiveAgent?: boolean;
|
|
31
43
|
disableTransfer?: boolean;
|
|
32
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
33
48
|
export interface Context extends TypedEventEmitter<ContextEventMap, ContextEmitEventMap> {
|
|
34
49
|
model?: ChatModel;
|
|
35
50
|
skills?: Agent[];
|
|
@@ -76,12 +91,12 @@ export interface Context extends TypedEventEmitter<ContextEventMap, ContextEmitE
|
|
|
76
91
|
* @param topic topic name, or an array of topic names
|
|
77
92
|
* @param payload message to publish
|
|
78
93
|
*/
|
|
79
|
-
publish(topic: string | string[], payload: Omit<MessagePayload, "context">): void;
|
|
80
|
-
subscribe(topic: string, listener?: undefined): Promise<MessagePayload>;
|
|
81
|
-
subscribe(topic: string, listener: MessageQueueListener): Unsubscribe;
|
|
82
|
-
subscribe(topic: string, listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
83
|
-
subscribe(topic: string, listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
84
|
-
unsubscribe(topic: string, listener: MessageQueueListener): void;
|
|
94
|
+
publish(topic: string | string[], payload: Omit<MessagePayload, "context"> | Message | string): void;
|
|
95
|
+
subscribe(topic: string | string[], listener?: undefined): Promise<MessagePayload>;
|
|
96
|
+
subscribe(topic: string | string[], listener: MessageQueueListener): Unsubscribe;
|
|
97
|
+
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
98
|
+
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
99
|
+
unsubscribe(topic: string | string[], listener: MessageQueueListener): void;
|
|
85
100
|
/**
|
|
86
101
|
* Create a child context with the same configuration as the parent context.
|
|
87
102
|
* If `reset` is true, the child context will have a new state (such as: usage).
|
|
@@ -94,7 +109,9 @@ export interface Context extends TypedEventEmitter<ContextEventMap, ContextEmitE
|
|
|
94
109
|
reset?: boolean;
|
|
95
110
|
}): Context;
|
|
96
111
|
}
|
|
97
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @hidden
|
|
114
|
+
*/
|
|
98
115
|
export declare class AIGNEContext implements Context {
|
|
99
116
|
constructor(parent?: ConstructorParameters<typeof AIGNEContextInternal>[0]);
|
|
100
117
|
parentId?: string;
|
|
@@ -109,7 +126,6 @@ export declare class AIGNEContext implements Context {
|
|
|
109
126
|
reset?: boolean;
|
|
110
127
|
}): AIGNEContext;
|
|
111
128
|
invoke: Context["invoke"];
|
|
112
|
-
private onInvokeSuccess;
|
|
113
129
|
publish: Context["publish"];
|
|
114
130
|
subscribe: Context["subscribe"];
|
|
115
131
|
unsubscribe: Context["unsubscribe"];
|
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import type { Message } from "../agents/agent.js";
|
|
3
3
|
import type { Context } from "./context.js";
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
4
7
|
export declare const UserInputTopic = "UserInputTopic";
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
5
11
|
export declare const UserOutputTopic = "UserOutputTopic";
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
6
15
|
export interface MessagePayload {
|
|
7
16
|
role: "user" | "agent";
|
|
8
17
|
source?: string;
|
|
9
18
|
message: Message;
|
|
10
19
|
context: Context;
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare function toMessagePayload(payload: Omit<MessagePayload, "context"> | string | Message, options?: Partial<Pick<MessagePayload, "role" | "source">>): Omit<MessagePayload, "context">;
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
12
28
|
export type MessageQueueListener = (message: MessagePayload) => void;
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
13
32
|
export type Unsubscribe = () => void;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
14
36
|
export declare class MessageQueue {
|
|
15
37
|
events: EventEmitter<[never]>;
|
|
16
38
|
publish(topic: string | string[], payload: MessagePayload): void;
|
|
17
39
|
error(error: Error): void;
|
|
18
|
-
subscribe(topic: string, listener?: undefined): Promise<MessagePayload>;
|
|
19
|
-
subscribe(topic: string, listener: MessageQueueListener): Unsubscribe;
|
|
20
|
-
subscribe(topic: string, listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
21
|
-
unsubscribe(topic: string, listener: MessageQueueListener): void;
|
|
40
|
+
subscribe(topic: string | string[], listener?: undefined): Promise<MessagePayload>;
|
|
41
|
+
subscribe(topic: string | string[], listener: MessageQueueListener): Unsubscribe;
|
|
42
|
+
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
43
|
+
unsubscribe(topic: string | string[], listener: MessageQueueListener): void;
|
|
22
44
|
}
|
package/lib/dts/aigne/usage.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
1
4
|
export interface ContextUsage {
|
|
2
5
|
inputTokens: number;
|
|
3
6
|
outputTokens: number;
|
|
4
7
|
agentCalls: number;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
6
12
|
export declare function newEmptyContextUsage(): ContextUsage;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
7
16
|
export interface ContextLimits {
|
|
8
17
|
maxTokens?: number;
|
|
9
18
|
maxAgentInvokes?: number;
|
|
@@ -1,19 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client module used to interact with the AIGNE framework.
|
|
3
|
+
*/
|
|
1
4
|
import type { AgentInvokeOptions, AgentResponse, AgentResponseStream, Message } from "../agents/agent.js";
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the AIGNEClient.
|
|
7
|
+
*/
|
|
2
8
|
export interface AIGNEClientOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The URL of the AIGNE server to connect to.
|
|
11
|
+
* This should point to the base endpoint where the AIGNEServer is hosted.
|
|
12
|
+
*/
|
|
3
13
|
url: string;
|
|
4
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Options for invoking an agent through the AIGNEClient.
|
|
17
|
+
* Extends the standard AgentInvokeOptions with client-specific options.
|
|
18
|
+
*/
|
|
5
19
|
export interface AIGNEClientInvokeOptions extends AgentInvokeOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Additional fetch API options to customize the HTTP request.
|
|
22
|
+
* These options will be merged with the default options used by the client.
|
|
23
|
+
*/
|
|
6
24
|
fetchOptions?: Partial<RequestInit>;
|
|
7
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Client for interacting with a remote AIGNE server.
|
|
28
|
+
* AIGNEClient provides a client-side interface that matches the AIGNE API,
|
|
29
|
+
* allowing applications to invoke agents and receive responses from a remote AIGNE instance.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* Here's a simple example of how to use AIGNEClient:
|
|
33
|
+
* {@includeCode ../../test/client/client.test.ts#example-aigne-client-simple}
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Here's an example of how to use AIGNEClient with streaming response:
|
|
37
|
+
* {@includeCode ../../test/client/client.test.ts#example-aigne-client-streaming}
|
|
38
|
+
*/
|
|
8
39
|
export declare class AIGNEClient {
|
|
9
40
|
options: AIGNEClientOptions;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new AIGNEClient instance.
|
|
43
|
+
*
|
|
44
|
+
* @param options - Configuration options for connecting to the AIGNE server
|
|
45
|
+
*/
|
|
10
46
|
constructor(options: AIGNEClientOptions);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Invokes an agent in non-streaming mode and returns the complete response.
|
|
49
|
+
*
|
|
50
|
+
* @param agent - Name of the agent to invoke
|
|
51
|
+
* @param input - Input message for the agent
|
|
52
|
+
* @param options - Options with streaming mode explicitly set to false or omitted
|
|
53
|
+
* @returns The complete agent response
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* Here's a simple example of how to use AIGNEClient:
|
|
57
|
+
* {@includeCode ../../test/client/client.test.ts#example-aigne-client-simple}
|
|
58
|
+
*/
|
|
14
59
|
invoke<I extends Message, O extends Message>(agent: string, input: I, options?: AIGNEClientInvokeOptions & {
|
|
15
60
|
streaming?: false;
|
|
16
61
|
}): Promise<O>;
|
|
62
|
+
/**
|
|
63
|
+
* Invokes an agent with streaming mode enabled and returns a stream of response chunks.
|
|
64
|
+
*
|
|
65
|
+
* @param agent - Name of the agent to invoke
|
|
66
|
+
* @param input - Input message for the agent
|
|
67
|
+
* @param options - Options with streaming mode explicitly set to true
|
|
68
|
+
* @returns A stream of agent response chunks
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* Here's an example of how to use AIGNEClient with streaming response:
|
|
72
|
+
* {@includeCode ../../test/client/client.test.ts#example-aigne-client-streaming}
|
|
73
|
+
*/
|
|
74
|
+
invoke<I extends Message, O extends Message>(agent: string, input: I, options: AIGNEClientInvokeOptions & {
|
|
75
|
+
streaming: true;
|
|
76
|
+
}): Promise<AgentResponseStream<O>>;
|
|
77
|
+
/**
|
|
78
|
+
* Invokes an agent with the given input and options.
|
|
79
|
+
*
|
|
80
|
+
* @param agent - Name of the agent to invoke
|
|
81
|
+
* @param input - Input message for the agent
|
|
82
|
+
* @param options - Options for the invocation
|
|
83
|
+
* @returns Either a complete response or a response stream depending on the streaming option
|
|
84
|
+
*/
|
|
17
85
|
invoke<I extends Message, O extends Message>(agent: string, input: I, options?: AIGNEClientInvokeOptions): Promise<AgentResponse<O>>;
|
|
86
|
+
/**
|
|
87
|
+
* Enhanced fetch method that handles error responses from the AIGNE server.
|
|
88
|
+
* This method wraps the standard fetch API to provide better error handling and reporting.
|
|
89
|
+
*
|
|
90
|
+
* @param args - Standard fetch API arguments (url and options)
|
|
91
|
+
* @returns A Response object if the request was successful
|
|
92
|
+
* @throws Error with detailed information if the request failed
|
|
93
|
+
*
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
18
96
|
fetch(...args: Parameters<typeof globalThis.fetch>): Promise<Response>;
|
|
19
97
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client.js";
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./agents/agent.js";
|
|
2
2
|
export * from "./agents/ai-agent.js";
|
|
3
3
|
export * from "./agents/mcp-agent.js";
|
|
4
|
-
export * from "./agents/memory.js";
|
|
5
4
|
export * from "./agents/team-agent.js";
|
|
6
5
|
export * from "./agents/types.js";
|
|
7
6
|
export * from "./agents/user-agent.js";
|
|
@@ -2,7 +2,7 @@ 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
4
|
name: string;
|
|
5
|
-
|
|
5
|
+
process: (args_0: Message) => Message;
|
|
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;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
|
+
import { AIAgentToolChoice } from "../agents/ai-agent.js";
|
|
2
3
|
export declare function loadAgentFromYamlFile(path: string): Promise<{
|
|
3
4
|
type: "ai";
|
|
4
5
|
name: string;
|
|
5
6
|
description?: string | undefined;
|
|
7
|
+
skills?: string[] | undefined;
|
|
6
8
|
memory?: true | {
|
|
7
9
|
subscribeTopic?: string[] | undefined;
|
|
8
10
|
} | undefined;
|
|
9
|
-
skills?: string[] | undefined;
|
|
10
11
|
instructions?: string | undefined;
|
|
11
12
|
inputSchema?: ZodObject<Record<string, ZodType<any, z.ZodTypeDef, any>>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
12
13
|
[x: string]: any;
|
|
13
14
|
}, {
|
|
14
15
|
[x: string]: any;
|
|
15
16
|
}> | undefined;
|
|
16
|
-
toolChoice?:
|
|
17
|
+
toolChoice?: AIAgentToolChoice | undefined;
|
|
17
18
|
outputSchema?: ZodObject<Record<string, ZodType<any, z.ZodTypeDef, any>>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
18
19
|
[x: string]: any;
|
|
19
20
|
}, {
|
|
@@ -8,8 +8,8 @@ export declare function load(options: LoadOptions): Promise<{
|
|
|
8
8
|
model: ChatModel | undefined;
|
|
9
9
|
agents: Agent<import("../agents/agent.js").Message, import("../agents/agent.js").Message>[];
|
|
10
10
|
skills: Agent<import("../agents/agent.js").Message, import("../agents/agent.js").Message>[];
|
|
11
|
-
description?: string | null | undefined;
|
|
12
11
|
name?: string | null | undefined;
|
|
12
|
+
description?: string | null | undefined;
|
|
13
13
|
chat_model?: {
|
|
14
14
|
name?: string | null | undefined;
|
|
15
15
|
temperature?: number | null | undefined;
|
|
@@ -63,8 +63,8 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
63
63
|
agents: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
64
64
|
skills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
description?: string | null | undefined;
|
|
67
66
|
name?: string | null | undefined;
|
|
67
|
+
description?: string | null | undefined;
|
|
68
68
|
skills?: string[] | null | undefined;
|
|
69
69
|
chat_model?: {
|
|
70
70
|
name?: string | null | undefined;
|
|
@@ -76,8 +76,8 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
76
76
|
} | null | undefined;
|
|
77
77
|
agents?: string[] | null | undefined;
|
|
78
78
|
}, {
|
|
79
|
-
description?: string | null | undefined;
|
|
80
79
|
name?: string | null | undefined;
|
|
80
|
+
description?: string | null | undefined;
|
|
81
81
|
skills?: string[] | null | undefined;
|
|
82
82
|
chat_model?: string | {
|
|
83
83
|
name?: string | null | undefined;
|
|
@@ -90,8 +90,8 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
90
90
|
agents?: string[] | null | undefined;
|
|
91
91
|
}>;
|
|
92
92
|
export declare function loadAIGNEFile(path: string): Promise<{
|
|
93
|
-
description?: string | null | undefined;
|
|
94
93
|
name?: string | null | undefined;
|
|
94
|
+
description?: string | null | undefined;
|
|
95
95
|
skills?: string[] | null | undefined;
|
|
96
96
|
chat_model?: {
|
|
97
97
|
name?: string | null | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Memory, MemoryAgent, type MemoryAgentOptions } from "./memory.js";
|
|
2
|
+
export declare const DEFAULT_MAX_MEMORY_COUNT = 10;
|
|
3
|
+
export interface DefaultMemoryOptions extends Partial<MemoryAgentOptions> {
|
|
4
|
+
}
|
|
5
|
+
export declare class DefaultMemory extends MemoryAgent {
|
|
6
|
+
constructor(options?: DefaultMemoryOptions);
|
|
7
|
+
storage: Memory[];
|
|
8
|
+
search(options?: {
|
|
9
|
+
limit?: number;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
result: Memory[];
|
|
12
|
+
}>;
|
|
13
|
+
create(memory: Pick<Memory, "content">): Promise<{
|
|
14
|
+
result: Memory;
|
|
15
|
+
}>;
|
|
16
|
+
}
|