@ai.ntellect/core 0.3.1 → 0.4.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/.nvmrc +1 -0
- package/README.FR.md +201 -261
- package/README.md +208 -260
- package/agent/index.ts +204 -185
- package/agent/tools/get-rss.ts +64 -0
- package/bull.ts +5 -0
- package/dist/agent/index.d.ts +29 -22
- package/dist/agent/index.js +124 -97
- package/dist/agent/tools/get-rss.d.ts +16 -0
- package/dist/agent/tools/get-rss.js +62 -0
- package/dist/bull.d.ts +1 -0
- package/dist/bull.js +9 -0
- package/dist/examples/index.d.ts +2 -0
- package/dist/examples/index.js +89 -0
- package/dist/llm/interpreter/context.d.ts +5 -22
- package/dist/llm/interpreter/context.js +8 -9
- package/dist/llm/interpreter/index.d.ts +9 -5
- package/dist/llm/interpreter/index.js +55 -48
- package/dist/llm/memory-manager/context.d.ts +2 -0
- package/dist/llm/memory-manager/context.js +22 -0
- package/dist/llm/memory-manager/index.d.ts +17 -0
- package/dist/llm/memory-manager/index.js +107 -0
- package/dist/llm/orchestrator/context.d.ts +2 -10
- package/dist/llm/orchestrator/context.js +19 -16
- package/dist/llm/orchestrator/index.d.ts +36 -21
- package/dist/llm/orchestrator/index.js +122 -88
- package/dist/llm/orchestrator/types.d.ts +12 -0
- package/dist/llm/orchestrator/types.js +2 -0
- package/dist/memory/cache.d.ts +6 -6
- package/dist/memory/cache.js +35 -42
- package/dist/memory/persistent.d.ts +9 -13
- package/dist/memory/persistent.js +94 -114
- package/dist/services/redis-cache.d.ts +37 -0
- package/dist/services/redis-cache.js +93 -0
- package/dist/services/scheduler.d.ts +40 -0
- package/dist/services/scheduler.js +99 -0
- package/dist/services/telegram-monitor.d.ts +0 -0
- package/dist/services/telegram-monitor.js +118 -0
- package/dist/test.d.ts +0 -167
- package/dist/test.js +437 -372
- package/dist/types.d.ts +60 -9
- package/dist/utils/generate-object.d.ts +12 -0
- package/dist/utils/generate-object.js +90 -0
- package/dist/utils/header-builder.d.ts +11 -0
- package/dist/utils/header-builder.js +34 -0
- package/dist/utils/inject-actions.js +2 -2
- package/dist/utils/queue-item-transformer.d.ts +2 -2
- package/dist/utils/schema-generator.d.ts +16 -0
- package/dist/utils/schema-generator.js +46 -0
- package/examples/index.ts +103 -0
- package/llm/interpreter/context.ts +20 -8
- package/llm/interpreter/index.ts +81 -54
- package/llm/memory-manager/context.ts +21 -0
- package/llm/memory-manager/index.ts +163 -0
- package/llm/orchestrator/context.ts +20 -13
- package/llm/orchestrator/index.ts +210 -130
- package/llm/orchestrator/types.ts +14 -0
- package/memory/cache.ts +41 -55
- package/memory/persistent.ts +121 -149
- package/package.json +11 -2
- package/services/redis-cache.ts +128 -0
- package/services/scheduler.ts +128 -0
- package/services/telegram-monitor.ts +138 -0
- package/t.py +79 -0
- package/t.spec +38 -0
- package/types.ts +64 -9
- package/utils/generate-object.ts +105 -0
- package/utils/header-builder.ts +40 -0
- package/utils/inject-actions.ts +4 -6
- package/utils/queue-item-transformer.ts +2 -1
- package/utils/schema-generator.ts +73 -0
- package/agent/handlers/ActionHandler.ts +0 -48
- package/agent/handlers/ConfirmationHandler.ts +0 -37
- package/agent/handlers/EventHandler.ts +0 -35
- package/dist/agent/handlers/ActionHandler.d.ts +0 -8
- package/dist/agent/handlers/ActionHandler.js +0 -36
- package/dist/agent/handlers/ConfirmationHandler.d.ts +0 -7
- package/dist/agent/handlers/ConfirmationHandler.js +0 -31
- package/dist/agent/handlers/EventHandler.d.ts +0 -10
- package/dist/agent/handlers/EventHandler.js +0 -34
- package/dist/llm/evaluator/context.d.ts +0 -10
- package/dist/llm/evaluator/context.js +0 -22
- package/dist/llm/evaluator/index.d.ts +0 -16
- package/dist/llm/evaluator/index.js +0 -151
- package/llm/evaluator/context.ts +0 -21
- package/llm/evaluator/index.ts +0 -194
package/agent/index.ts
CHANGED
@@ -1,224 +1,243 @@
|
|
1
|
-
import {
|
1
|
+
import { LanguageModel } from "ai";
|
2
|
+
import WebSocket from "ws";
|
2
3
|
import { Interpreter } from "../llm/interpreter";
|
3
|
-
import {
|
4
|
+
import { MemoryManager } from "../llm/memory-manager";
|
5
|
+
import { AgentRuntime } from "../llm/orchestrator";
|
6
|
+
import { State } from "../llm/orchestrator/types";
|
4
7
|
import { CacheMemory } from "../memory/cache";
|
5
8
|
import { PersistentMemory } from "../memory/persistent";
|
6
|
-
import {
|
9
|
+
import { ActionQueueManager } from "../services/queue";
|
10
|
+
import { CacheConfig, RedisCache } from "../services/redis-cache";
|
11
|
+
import { ActionData, ActionSchema, QueueCallbacks } from "../types";
|
7
12
|
import { QueueItemTransformer } from "../utils/queue-item-transformer";
|
8
|
-
import { ResultSanitizer } from "../utils/sanitize-results";
|
9
|
-
import { ActionHandler } from "./handlers/ActionHandler";
|
10
|
-
|
11
13
|
export class Agent {
|
12
|
-
private readonly
|
13
|
-
private readonly
|
14
|
-
private readonly
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
private readonly agent: AgentRuntime;
|
15
|
+
private readonly memoryManager: MemoryManager;
|
16
|
+
private readonly cache: RedisCache;
|
17
|
+
|
18
|
+
private webSocketClients: Map<
|
19
|
+
string,
|
20
|
+
{ socket: WebSocket; callback: (data: any) => Promise<void> }
|
21
|
+
> = new Map();
|
22
|
+
private readonly config: {
|
23
|
+
orchestrator: {
|
24
|
+
model: LanguageModel;
|
25
|
+
tools: ActionSchema[];
|
26
|
+
memory?: {
|
27
|
+
cache?: CacheMemory;
|
28
|
+
persistent?: PersistentMemory;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
interpreters: Interpreter[];
|
32
|
+
memoryManager: {
|
33
|
+
model: LanguageModel;
|
34
|
+
memory?: {
|
35
|
+
cache?: CacheMemory;
|
36
|
+
persistent?: PersistentMemory;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
maxIterations: number;
|
18
40
|
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
maxEvaluatorIteration = 1,
|
31
|
-
}: {
|
32
|
-
orchestrator: Orchestrator;
|
41
|
+
|
42
|
+
constructor(config: {
|
43
|
+
cache: CacheConfig;
|
44
|
+
orchestrator: {
|
45
|
+
model: LanguageModel;
|
46
|
+
tools: ActionSchema[];
|
47
|
+
memory?: {
|
48
|
+
cache?: CacheMemory;
|
49
|
+
persistent?: PersistentMemory;
|
50
|
+
};
|
51
|
+
};
|
33
52
|
interpreters: Interpreter[];
|
34
|
-
|
35
|
-
|
36
|
-
|
53
|
+
memoryManager: {
|
54
|
+
model: LanguageModel;
|
55
|
+
memory?: {
|
56
|
+
cache?: CacheMemory;
|
57
|
+
persistent?: PersistentMemory;
|
58
|
+
};
|
37
59
|
};
|
38
|
-
|
39
|
-
|
60
|
+
callbacks?: QueueCallbacks;
|
61
|
+
maxIterations: number;
|
40
62
|
}) {
|
41
|
-
this.
|
42
|
-
this.
|
43
|
-
this.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
63
|
+
this.cache = new RedisCache(config.cache);
|
64
|
+
this.config = config;
|
65
|
+
this.agent = new AgentRuntime(
|
66
|
+
config.orchestrator.model,
|
67
|
+
config.orchestrator.tools,
|
68
|
+
config.interpreters,
|
69
|
+
config.cache,
|
70
|
+
config.orchestrator.memory
|
71
|
+
);
|
72
|
+
this.memoryManager = new MemoryManager({
|
73
|
+
model: config.memoryManager.model,
|
74
|
+
memory: {
|
75
|
+
cache: config.memoryManager.memory?.cache ?? undefined,
|
76
|
+
persistent: config.memoryManager.memory?.persistent ?? undefined,
|
77
|
+
},
|
78
|
+
});
|
79
|
+
this.config.maxIterations = 3;
|
48
80
|
}
|
49
81
|
|
50
|
-
async process(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
const
|
55
|
-
similarityThreshold: 70,
|
56
|
-
maxResults: 5,
|
57
|
-
userId: "1",
|
58
|
-
scope: MemoryScope.GLOBAL,
|
59
|
-
});
|
60
|
-
console.log("✅ RECENT_ACTIONS: ", cacheMemories);
|
82
|
+
public async process(state: State, callbacks?: QueueCallbacks): Promise<any> {
|
83
|
+
console.log("🔄 Processing state:");
|
84
|
+
console.dir(state, { depth: null });
|
85
|
+
let countIterations = 0;
|
86
|
+
const response = await this.agent.process(state);
|
61
87
|
|
62
|
-
const
|
63
|
-
|
64
|
-
{
|
65
|
-
similarityThreshold: 80,
|
66
|
-
}
|
88
|
+
const unscheduledActions = response.actions.filter(
|
89
|
+
(action) => !action.scheduler?.isScheduled
|
67
90
|
);
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
? this.handleActions(
|
81
|
-
{
|
82
|
-
initialPrompt: prompt,
|
83
|
-
actions: request.actions,
|
84
|
-
},
|
85
|
-
events
|
86
|
-
)
|
87
|
-
: undefined;
|
88
|
-
}
|
89
|
-
|
90
|
-
private async handleActions(
|
91
|
-
{
|
92
|
-
initialPrompt,
|
93
|
-
actions,
|
94
|
-
}: {
|
95
|
-
initialPrompt: string;
|
96
|
-
actions: {
|
97
|
-
name: string;
|
98
|
-
type: string;
|
99
|
-
parameters: {
|
100
|
-
name: string;
|
101
|
-
value: any;
|
102
|
-
}[];
|
103
|
-
}[];
|
104
|
-
},
|
105
|
-
events: AgentEvent
|
106
|
-
): Promise<any> {
|
107
|
-
const queueItems = this.transformActions(actions as any);
|
108
|
-
|
109
|
-
const actionsResult = await this.actionHandler.executeActions(
|
110
|
-
queueItems,
|
111
|
-
this.orchestrator.tools,
|
112
|
-
{
|
113
|
-
onQueueStart: events.onQueueStart,
|
114
|
-
onActionStart: events.onActionStart,
|
115
|
-
onActionComplete: events.onActionComplete,
|
116
|
-
onQueueComplete: events.onQueueComplete,
|
117
|
-
onConfirmationRequired: events.onConfirmationRequired,
|
91
|
+
// Execute actions if needed
|
92
|
+
if (unscheduledActions?.length > 0 && response.shouldContinue) {
|
93
|
+
console.log("\n📋 Processing action queue");
|
94
|
+
const queueManager = new ActionQueueManager(
|
95
|
+
this.config.orchestrator.tools,
|
96
|
+
callbacks
|
97
|
+
);
|
98
|
+
const queueItems = QueueItemTransformer.transformActionsToQueueItems(
|
99
|
+
response.actions as ActionData[]
|
100
|
+
);
|
101
|
+
if (!queueItems) {
|
102
|
+
throw new Error("No queue items found");
|
118
103
|
}
|
119
|
-
);
|
120
104
|
|
121
|
-
|
105
|
+
console.log(
|
106
|
+
"📋 Actions to execute:",
|
107
|
+
queueItems
|
108
|
+
.map((item) => (typeof item === "string" ? item : item.name))
|
109
|
+
.join(", ")
|
110
|
+
);
|
122
111
|
|
123
|
-
|
124
|
-
(
|
125
|
-
|
112
|
+
queueManager.addToQueue(queueItems);
|
113
|
+
console.log("\n⚡ Executing actions...");
|
114
|
+
const results = await queueManager.processQueue();
|
115
|
+
console.log("✅ Execution results:", results);
|
126
116
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
117
|
+
const updatedNextState: State = {
|
118
|
+
...state,
|
119
|
+
currentContext: state.currentContext,
|
120
|
+
previousActions: [...(state.previousActions || []), ...(results || [])],
|
131
121
|
};
|
132
|
-
}
|
133
122
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
});
|
123
|
+
console.log("\n🔁 Recursively processing with updated state");
|
124
|
+
countIterations++;
|
125
|
+
if (countIterations < this.config.maxIterations) {
|
126
|
+
return this.process(updatedNextState);
|
127
|
+
}
|
140
128
|
}
|
141
129
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
130
|
+
if (countIterations >= this.config.maxIterations) {
|
131
|
+
console.log("Max iterations reached");
|
132
|
+
response.shouldContinue = false;
|
133
|
+
console.log("Forcing stop");
|
134
|
+
}
|
147
135
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
136
|
+
// Handle final interpretation
|
137
|
+
if (
|
138
|
+
!response.shouldContinue &&
|
139
|
+
state.previousActions?.length &&
|
140
|
+
response.interpreter
|
141
|
+
) {
|
142
|
+
console.log("\n🏁 Analysis complete - generating final interpretation");
|
143
|
+
const interpreter = this.getInterpreter(
|
144
|
+
this.config.interpreters,
|
145
|
+
response.interpreter
|
146
|
+
);
|
147
|
+
console.log("🎭 Selected Interpreter:", interpreter?.name);
|
148
|
+
console.dir(state, { depth: null });
|
149
|
+
const interpretationResult = (await interpreter?.process(
|
150
|
+
"Interpret the analysis results",
|
151
|
+
{
|
152
|
+
...state,
|
153
|
+
results: JSON.stringify(state.previousActions),
|
154
|
+
userRequest: state.currentContext,
|
155
|
+
}
|
156
|
+
)) as { response: string };
|
152
157
|
|
153
|
-
|
154
|
-
this.interpreters,
|
155
|
-
evaluation.interpreter
|
156
|
-
);
|
158
|
+
console.log("\n📊 Final Analysis:", interpretationResult.response);
|
157
159
|
|
158
|
-
|
160
|
+
const finalState: State = {
|
161
|
+
...state,
|
162
|
+
results: interpretationResult.response,
|
163
|
+
};
|
159
164
|
|
160
|
-
|
161
|
-
this.evaluatorIteration++;
|
162
|
-
return this.handleActions(
|
163
|
-
{
|
164
|
-
initialPrompt: initialPrompt,
|
165
|
-
actions: evaluation.nextActionsNeeded,
|
166
|
-
},
|
167
|
-
events
|
168
|
-
);
|
165
|
+
console.log("🔄 Final state:", finalState);
|
169
166
|
}
|
170
167
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
168
|
+
// Return the final response at the end of the function
|
169
|
+
const validatedActions = response.actions.map((action) => ({
|
170
|
+
...action,
|
171
|
+
parameters: action.parameters.map((param) => ({
|
172
|
+
...param,
|
173
|
+
value: param.value ?? null, // Set a default value if undefined
|
174
|
+
})),
|
175
|
+
}));
|
176
|
+
|
177
|
+
const result = {
|
178
|
+
...response,
|
179
|
+
actions: validatedActions,
|
180
|
+
results: JSON.stringify(state.previousActions),
|
181
|
+
};
|
182
|
+
if (!result.shouldContinue) {
|
183
|
+
await this.memoryManager.process(state, JSON.stringify(result));
|
184
|
+
}
|
185
|
+
return result;
|
176
186
|
}
|
177
187
|
|
178
188
|
private getInterpreter(interpreters: Interpreter[], name: string) {
|
179
|
-
console.log({ interpreters, name });
|
180
189
|
return interpreters.find((interpreter) => interpreter.name === name);
|
181
190
|
}
|
182
191
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
if (
|
190
|
-
|
192
|
+
public addListener(
|
193
|
+
id: string,
|
194
|
+
url: string,
|
195
|
+
subscriptionMessageFactory: () => string,
|
196
|
+
callback: (data: any, agentContext: Agent) => Promise<void>
|
197
|
+
): void {
|
198
|
+
if (this.webSocketClients.has(id)) {
|
199
|
+
console.warn(`WebSocket with ID ${id} already exists.`);
|
200
|
+
return;
|
191
201
|
}
|
192
|
-
console.log("✅ INTERPRETER: ", interpreter.name);
|
193
|
-
return this.stream
|
194
|
-
? (
|
195
|
-
await interpreter.streamProcess(initialPrompt, {
|
196
|
-
userRequest: initialPrompt,
|
197
|
-
results: data,
|
198
|
-
})
|
199
|
-
).toDataStreamResponse()
|
200
|
-
: await interpreter.process(initialPrompt, {
|
201
|
-
userRequest: initialPrompt,
|
202
|
-
results: data,
|
203
|
-
});
|
204
|
-
}
|
205
202
|
|
206
|
-
|
207
|
-
let predefinedActions =
|
208
|
-
QueueItemTransformer.transformActionsToQueueItems(actions) || [];
|
203
|
+
const socket = new WebSocket(url);
|
209
204
|
|
210
|
-
|
211
|
-
|
205
|
+
const wrappedCallback = async (data: any) => {
|
206
|
+
await callback(data, this);
|
207
|
+
};
|
212
208
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
209
|
+
socket.on("open", () => {
|
210
|
+
console.log(`🔗 WebSocket connected for ID: ${id}`);
|
211
|
+
|
212
|
+
// Envoie le message d'abonnement si une factory est fournie
|
213
|
+
if (subscriptionMessageFactory) {
|
214
|
+
const subscriptionMessage = subscriptionMessageFactory();
|
215
|
+
socket.send(subscriptionMessage);
|
216
|
+
console.log(
|
217
|
+
`📡 Sent subscription message for ID ${id}:`,
|
218
|
+
subscriptionMessage
|
219
|
+
);
|
220
|
+
}
|
221
|
+
});
|
222
|
+
|
223
|
+
socket.on("message", async (message: string) => {
|
224
|
+
console.log(`📨 Message received for WebSocket ID ${id}:`, message);
|
225
|
+
try {
|
226
|
+
const data = JSON.parse(message);
|
227
|
+
await wrappedCallback(data);
|
228
|
+
} catch (error) {
|
229
|
+
console.error(`❌ Error in callback for WebSocket ID ${id}:`, error);
|
230
|
+
}
|
231
|
+
});
|
232
|
+
|
233
|
+
socket.on("error", (error) => {
|
234
|
+
console.error(`❌ WebSocket error for ID ${id}:`, error);
|
235
|
+
});
|
236
|
+
|
237
|
+
socket.on("close", () => {
|
238
|
+
console.log(`🔌 WebSocket closed for ID: ${id}`);
|
239
|
+
});
|
240
|
+
|
241
|
+
this.webSocketClients.set(id, { socket, callback: wrappedCallback });
|
223
242
|
}
|
224
243
|
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import Parser from "rss-parser";
|
2
|
+
import { z } from "zod";
|
3
|
+
|
4
|
+
const RSS_FEEDS = [
|
5
|
+
"https://www.investing.com/rss/news_301.rss",
|
6
|
+
"https://cointelegraph.com/rss/category/analysis",
|
7
|
+
"https://cointelegraph.com/rss/category/top-10-cryptocurrencies",
|
8
|
+
];
|
9
|
+
|
10
|
+
const parser = new Parser();
|
11
|
+
|
12
|
+
function stripHtmlTags(content: string): string {
|
13
|
+
if (!content) return "";
|
14
|
+
return content
|
15
|
+
.replace(/<[^>]*>/g, "")
|
16
|
+
.replace(/\n/g, "")
|
17
|
+
.replace(" ", "");
|
18
|
+
}
|
19
|
+
|
20
|
+
export const getRssNews = {
|
21
|
+
name: "get-news-rss",
|
22
|
+
description: "Get latest news about on website",
|
23
|
+
parameters: z.object({}),
|
24
|
+
execute: async () => {
|
25
|
+
const itemsPerSource = 5;
|
26
|
+
|
27
|
+
try {
|
28
|
+
const feedPromises = RSS_FEEDS.map((url) => parser.parseURL(url));
|
29
|
+
const results = await Promise.allSettled(feedPromises);
|
30
|
+
const successfulFeeds = results
|
31
|
+
.filter(
|
32
|
+
(result): result is PromiseFulfilledResult<Parser.Output<any>> => {
|
33
|
+
return (
|
34
|
+
result.status === "fulfilled" && result.value?.items?.length > 0
|
35
|
+
);
|
36
|
+
}
|
37
|
+
)
|
38
|
+
.map((result) => result.value);
|
39
|
+
const allItems = successfulFeeds
|
40
|
+
.flatMap((feed) => feed.items.slice(0, itemsPerSource))
|
41
|
+
.sort((a, b) => {
|
42
|
+
const dateA = a.pubDate ? new Date(a.pubDate).getTime() : 0;
|
43
|
+
const dateB = b.pubDate ? new Date(b.pubDate).getTime() : 0;
|
44
|
+
return dateB - dateA;
|
45
|
+
})
|
46
|
+
.slice(0, 5)
|
47
|
+
.map((item) => ({
|
48
|
+
title: item.title,
|
49
|
+
content: stripHtmlTags(item.content),
|
50
|
+
link: item.link,
|
51
|
+
date: item.pubDate,
|
52
|
+
source: item.creator || new URL(item.link).hostname,
|
53
|
+
}));
|
54
|
+
|
55
|
+
const result = {
|
56
|
+
status: "success",
|
57
|
+
items: allItems,
|
58
|
+
};
|
59
|
+
return result;
|
60
|
+
} catch (error: any) {
|
61
|
+
throw error;
|
62
|
+
}
|
63
|
+
},
|
64
|
+
};
|
package/bull.ts
ADDED
package/dist/agent/index.d.ts
CHANGED
@@ -1,31 +1,38 @@
|
|
1
|
+
import { LanguageModel } from "ai";
|
1
2
|
import { Interpreter } from "../llm/interpreter";
|
2
|
-
import {
|
3
|
+
import { State } from "../llm/orchestrator/types";
|
3
4
|
import { CacheMemory } from "../memory/cache";
|
4
5
|
import { PersistentMemory } from "../memory/persistent";
|
5
|
-
import {
|
6
|
+
import { CacheConfig } from "../services/redis-cache";
|
7
|
+
import { ActionSchema, QueueCallbacks } from "../types";
|
6
8
|
export declare class Agent {
|
7
|
-
private readonly
|
8
|
-
private readonly
|
9
|
-
private readonly
|
10
|
-
private
|
11
|
-
private readonly
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
private readonly agent;
|
10
|
+
private readonly memoryManager;
|
11
|
+
private readonly cache;
|
12
|
+
private webSocketClients;
|
13
|
+
private readonly config;
|
14
|
+
constructor(config: {
|
15
|
+
cache: CacheConfig;
|
16
|
+
orchestrator: {
|
17
|
+
model: LanguageModel;
|
18
|
+
tools: ActionSchema[];
|
19
|
+
memory?: {
|
20
|
+
cache?: CacheMemory;
|
21
|
+
persistent?: PersistentMemory;
|
22
|
+
};
|
23
|
+
};
|
17
24
|
interpreters: Interpreter[];
|
18
|
-
|
19
|
-
|
20
|
-
|
25
|
+
memoryManager: {
|
26
|
+
model: LanguageModel;
|
27
|
+
memory?: {
|
28
|
+
cache?: CacheMemory;
|
29
|
+
persistent?: PersistentMemory;
|
30
|
+
};
|
21
31
|
};
|
22
|
-
|
23
|
-
|
32
|
+
callbacks?: QueueCallbacks;
|
33
|
+
maxIterations: number;
|
24
34
|
});
|
25
|
-
process(
|
26
|
-
private handleActions;
|
35
|
+
process(state: State, callbacks?: QueueCallbacks): Promise<any>;
|
27
36
|
private getInterpreter;
|
28
|
-
|
29
|
-
private transformActions;
|
30
|
-
private formatResults;
|
37
|
+
addListener(id: string, url: string, subscriptionMessageFactory: () => string, callback: (data: any, agentContext: Agent) => Promise<void>): void;
|
31
38
|
}
|