@ai.ntellect/core 0.7.14 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/graph/event-manager.d.ts +9 -1
  2. package/dist/graph/event-manager.d.ts.map +1 -1
  3. package/dist/graph/event-manager.js +115 -37
  4. package/dist/graph/event-manager.js.map +1 -1
  5. package/dist/graph/index.d.ts +20 -1
  6. package/dist/graph/index.d.ts.map +1 -1
  7. package/dist/graph/index.js +59 -10
  8. package/dist/graph/index.js.map +1 -1
  9. package/dist/graph/node.d.ts +0 -24
  10. package/dist/graph/node.d.ts.map +1 -1
  11. package/dist/graph/node.js +2 -71
  12. package/dist/graph/node.js.map +1 -1
  13. package/dist/graph/observer.d.ts +6 -87
  14. package/dist/graph/observer.d.ts.map +1 -1
  15. package/dist/graph/observer.js +3 -116
  16. package/dist/graph/observer.js.map +1 -1
  17. package/dist/index.d.ts +1 -6
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -6
  20. package/dist/index.js.map +1 -1
  21. package/dist/interfaces/index.d.ts +10 -1
  22. package/dist/interfaces/index.d.ts.map +1 -1
  23. package/dist/interfaces/index.js.map +1 -1
  24. package/dist/modules/agent/agent.d.ts +35 -0
  25. package/dist/modules/agent/agent.d.ts.map +1 -0
  26. package/dist/modules/agent/agent.js +106 -0
  27. package/dist/modules/agent/agent.js.map +1 -0
  28. package/dist/modules/agent/base/executor.d.ts +51 -0
  29. package/dist/modules/agent/base/executor.d.ts.map +1 -0
  30. package/dist/modules/agent/base/executor.js +66 -0
  31. package/dist/modules/agent/base/executor.js.map +1 -0
  32. package/dist/modules/agent/base/index.d.ts +30 -0
  33. package/dist/modules/agent/base/index.d.ts.map +1 -0
  34. package/dist/modules/agent/base/index.js +100 -0
  35. package/dist/modules/agent/base/index.js.map +1 -0
  36. package/dist/modules/agent/generic-assistant.d.ts +20 -0
  37. package/dist/modules/agent/generic-assistant.d.ts.map +1 -0
  38. package/dist/modules/agent/generic-assistant.js +89 -0
  39. package/dist/modules/agent/generic-assistant.js.map +1 -0
  40. package/dist/modules/agent/generic-executor.d.ts +57 -0
  41. package/dist/modules/agent/generic-executor.d.ts.map +1 -0
  42. package/dist/modules/agent/generic-executor.js +200 -0
  43. package/dist/modules/agent/generic-executor.js.map +1 -0
  44. package/dist/modules/agent/llm-factory.d.ts +19 -0
  45. package/dist/modules/agent/llm-factory.d.ts.map +1 -0
  46. package/dist/modules/agent/llm-factory.js +56 -0
  47. package/dist/modules/agent/llm-factory.js.map +1 -0
  48. package/dist/modules/agent/prompt-builder.d.ts +35 -0
  49. package/dist/modules/agent/prompt-builder.d.ts.map +1 -0
  50. package/dist/modules/agent/prompt-builder.js +76 -0
  51. package/dist/modules/agent/prompt-builder.js.map +1 -0
  52. package/dist/modules/memory/adapters/in-memory/index.d.ts.map +1 -1
  53. package/dist/modules/memory/adapters/in-memory/index.js +4 -3
  54. package/dist/modules/memory/adapters/in-memory/index.js.map +1 -1
  55. package/dist/modules/memory/adapters/meilisearch/index.d.ts.map +1 -1
  56. package/dist/modules/memory/adapters/meilisearch/index.js +7 -4
  57. package/dist/modules/memory/adapters/meilisearch/index.js.map +1 -1
  58. package/dist/modules/memory/adapters/redis/index.d.ts.map +1 -1
  59. package/dist/modules/memory/adapters/redis/index.js +2 -1
  60. package/dist/modules/memory/adapters/redis/index.js.map +1 -1
  61. package/dist/modules/nlp/engine.d.ts +126 -0
  62. package/dist/modules/nlp/engine.d.ts.map +1 -0
  63. package/dist/modules/nlp/engine.js +300 -0
  64. package/dist/modules/nlp/engine.js.map +1 -0
  65. package/dist/modules/nlp/index.d.ts +27 -0
  66. package/dist/modules/nlp/index.d.ts.map +1 -0
  67. package/dist/modules/nlp/index.js +56 -0
  68. package/dist/modules/nlp/index.js.map +1 -0
  69. package/dist/types/agent.d.ts +233 -0
  70. package/dist/types/agent.d.ts.map +1 -0
  71. package/dist/types/agent.js +29 -0
  72. package/dist/types/agent.js.map +1 -0
  73. package/dist/types/index.d.ts +72 -18
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/utils/generate-action-schema.d.ts.map +1 -1
  76. package/graph/event-manager.ts +135 -42
  77. package/graph/index.ts +57 -4
  78. package/graph/node.ts +2 -104
  79. package/graph/observer.ts +9 -215
  80. package/index.ts +2 -7
  81. package/interfaces/index.ts +12 -0
  82. package/modules/agent/agent.ts +108 -0
  83. package/modules/agent/base/executor.ts +100 -0
  84. package/modules/agent/base/index.ts +99 -0
  85. package/modules/agent/generic-assistant.ts +90 -0
  86. package/modules/agent/generic-executor.ts +259 -0
  87. package/modules/agent/llm-factory.ts +47 -0
  88. package/modules/agent/prompt-builder.ts +78 -0
  89. package/modules/memory/adapters/in-memory/index.ts +4 -3
  90. package/modules/memory/adapters/meilisearch/index.ts +7 -4
  91. package/modules/memory/adapters/redis/index.ts +2 -1
  92. package/modules/nlp/engine.ts +325 -0
  93. package/modules/nlp/index.ts +45 -0
  94. package/package.json +5 -2
  95. package/test/graph/index.test.ts +6 -4
  96. package/test/graph/node.test.ts +18 -14
  97. package/types/agent.ts +174 -0
  98. package/types/index.ts +74 -18
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NLPEngine = void 0;
13
+ const { dockStart } = require("@nlpjs/basic");
14
+ /**
15
+ * NLP Engine for processing natural language commands
16
+ * @example
17
+ * const engine = await NLPEngine.create({
18
+ * corpus: require('./corpus.json'),
19
+ * responses: require('./responses.json'),
20
+ * entities: require('./entities.json')
21
+ * });
22
+ *
23
+ * engine.addAction('transferTokens', async (data) => {
24
+ * // Handle transfer logic
25
+ * });
26
+ *
27
+ * const response = await engine.process('transfer 5 ETH');
28
+ */
29
+ class NLPEngine {
30
+ constructor() {
31
+ this.intentHandlers = {};
32
+ this.responses = {};
33
+ }
34
+ /**
35
+ * Creates and initializes a new NLP Engine
36
+ */
37
+ static create(config) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const engine = new NLPEngine();
40
+ yield engine.init(config);
41
+ return engine;
42
+ });
43
+ }
44
+ /**
45
+ * Initializes the NLP engine with configuration
46
+ */
47
+ init(_a) {
48
+ return __awaiter(this, arguments, void 0, function* ({ corpus, responses, entities, language = "en", threshold = 0.5, }) {
49
+ const dock = yield dockStart({
50
+ settings: {
51
+ nlp: {
52
+ forceNER: true,
53
+ languages: [language],
54
+ corpora: corpus ? [corpus] : undefined,
55
+ },
56
+ ner: { threshold },
57
+ },
58
+ use: ["Basic", "LangEn"],
59
+ });
60
+ this.manager = dock.get("nlp");
61
+ this.responses = responses || {};
62
+ if (corpus) {
63
+ yield this.manager.addCorpus(corpus);
64
+ }
65
+ if (entities) {
66
+ this.registerEntities(entities);
67
+ }
68
+ yield this.manager.train();
69
+ });
70
+ }
71
+ /**
72
+ * Registers entities for Named Entity Recognition (NER)
73
+ * @private
74
+ * @param {Record<string, any>} entities - Entity definitions
75
+ */
76
+ registerEntities(entities) {
77
+ Object.entries(entities).forEach(([name, data]) => {
78
+ if (data.options) {
79
+ Object.entries(data.options).forEach(([option, texts]) => {
80
+ this.manager.addNerRuleOptionTexts("en", name, option, texts);
81
+ });
82
+ }
83
+ else if (data.regex) {
84
+ this.manager.addNerRegexRule("en", name, data.regex);
85
+ }
86
+ else if (data.trim) {
87
+ data.trim.forEach((trimRule) => {
88
+ if (trimRule.position === "afterLast") {
89
+ trimRule.words.forEach((word) => {
90
+ this.manager.addNerAfterLastCondition("en", name, word);
91
+ });
92
+ }
93
+ else if (trimRule.position === "betweenLast") {
94
+ this.manager.addNerBetweenLastCondition("en", name, trimRule.leftWords, trimRule.rightWords);
95
+ }
96
+ });
97
+ }
98
+ });
99
+ }
100
+ /**
101
+ * Adds an action handler for a specific intent
102
+ * @param {string} name - Intent name
103
+ * @param {ActionHandler} handler - Action handler function
104
+ */
105
+ addAction(name, handler) {
106
+ this.intentHandlers[name] = handler;
107
+ }
108
+ /**
109
+ * Creates and loads a pre-trained NLP Engine
110
+ */
111
+ static loadFromModel(modelPath, responses) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const engine = new NLPEngine();
114
+ engine.responses = responses || {};
115
+ yield engine.loadModel(modelPath);
116
+ return engine;
117
+ });
118
+ }
119
+ /**
120
+ * Loads a pre-trained model and configures default actions
121
+ */
122
+ loadModel(modelPath) {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ const dock = yield dockStart({
125
+ settings: {
126
+ nlp: {
127
+ forceNER: true,
128
+ languages: ["en"],
129
+ },
130
+ },
131
+ use: ["Basic", "LangEn"],
132
+ });
133
+ this.manager = dock.get("nlp");
134
+ yield this.manager.load(modelPath);
135
+ // Configure default actions handler
136
+ this.setupDefaultActions();
137
+ });
138
+ }
139
+ /**
140
+ * Setup default actions to handle responses
141
+ */
142
+ setupDefaultActions() {
143
+ this.manager.onIntent = (data) => __awaiter(this, void 0, void 0, function* () {
144
+ var _a;
145
+ // Execute registered action if exists
146
+ if (((_a = data.actions) === null || _a === void 0 ? void 0 : _a.length) > 0) {
147
+ for (const actionData of data.actions) {
148
+ const result = yield this.executeAction(actionData, data);
149
+ if (result) {
150
+ data.actionResult = result;
151
+ }
152
+ }
153
+ }
154
+ // Format response if answer exists
155
+ if (data.answer && this.responses[data.answer]) {
156
+ data.jsonResponse = this.formatResponse(this.responses[data.answer], data.actionResult || {});
157
+ }
158
+ return data;
159
+ });
160
+ }
161
+ /**
162
+ * Execute a single action
163
+ */
164
+ executeAction(actionData, context) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ const { action, parameters } = actionData;
167
+ const handler = this.manager.actions[action];
168
+ if (handler) {
169
+ return handler(context);
170
+ }
171
+ return null;
172
+ });
173
+ }
174
+ /**
175
+ * Processes natural language input text
176
+ * @param {string} input - Input text to process
177
+ * @returns {Promise<any>} Processing result with intent, entities and response
178
+ */
179
+ process(input) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ const result = yield this.manager.process("en", input);
182
+ console.log("NLP Engine Result:", result);
183
+ // Si une action est définie, exécuter le handler
184
+ if (result.intent) {
185
+ const handler = this.intentHandlers[result.intent.split(".")[1]];
186
+ if (handler) {
187
+ const handlerResult = yield handler(result);
188
+ return Object.assign(Object.assign({}, result), handlerResult);
189
+ }
190
+ }
191
+ return result;
192
+ });
193
+ }
194
+ /**
195
+ * Trains the NLP model with current corpus
196
+ * @returns {Promise<void>}
197
+ */
198
+ train() {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ yield this.manager.train();
201
+ });
202
+ }
203
+ /**
204
+ * Exports the trained model
205
+ * @param {boolean} [minified=true] - Whether to minify the exported model
206
+ * @returns {string} Exported model as string
207
+ */
208
+ export(minified = true) {
209
+ return this.manager.export(minified);
210
+ }
211
+ /**
212
+ * Imports a previously trained model
213
+ * @param {string} data - Model data to import
214
+ */
215
+ import(data) {
216
+ this.manager.import(data);
217
+ }
218
+ /**
219
+ * Saves the current model to a file
220
+ * @param {string} [path='./model.json'] - Path to save the model
221
+ * @returns {Promise<void>}
222
+ */
223
+ saveModel() {
224
+ return __awaiter(this, arguments, void 0, function* (path = "./model.json") {
225
+ this.manager.save();
226
+ this.manager.save("./model.json");
227
+ });
228
+ }
229
+ /**
230
+ * Formats response using template and context
231
+ */
232
+ formatResponse(template, context) {
233
+ const response = JSON.parse(JSON.stringify(template));
234
+ // Format data fields
235
+ if (response.data) {
236
+ Object.keys(response.data).forEach((key) => {
237
+ if (context[key] !== undefined) {
238
+ response.data[key] = context[key];
239
+ }
240
+ });
241
+ }
242
+ return response;
243
+ }
244
+ /**
245
+ * Gets entity value from NLP result
246
+ * @param {any} data - NLP processing result
247
+ * @param {string} entityName - Name of the entity to extract
248
+ * @returns {string|undefined} Entity value if found
249
+ */
250
+ getEntity(data, entityName) {
251
+ var _a;
252
+ const entity = (_a = data.entities) === null || _a === void 0 ? void 0 : _a.find((e) => e.entity === entityName);
253
+ return entity ? entity.utteranceText : undefined;
254
+ }
255
+ /**
256
+ * Gets entity option from NLP result
257
+ * @param {any} data - NLP processing result
258
+ * @param {string} entityName - Name of the entity to extract
259
+ * @returns {string|undefined} Entity option if found
260
+ */
261
+ getEntityOption(data, entityName) {
262
+ var _a;
263
+ const entity = (_a = data.entities) === null || _a === void 0 ? void 0 : _a.find((e) => e.entity === entityName);
264
+ return entity ? entity.option : undefined;
265
+ }
266
+ /**
267
+ * Gets recipient entity from NLP result
268
+ * @param {any} data - NLP processing result
269
+ * @returns {string|undefined} Recipient value if found
270
+ */
271
+ getRecipient(data) {
272
+ var _a;
273
+ const toEntity = (_a = data.entities) === null || _a === void 0 ? void 0 : _a.find((e) => e.entity === "to");
274
+ return toEntity ? toEntity.utteranceText : undefined;
275
+ }
276
+ /**
277
+ * Gets current responses configuration
278
+ * @returns {Record<string, any>} Current responses
279
+ */
280
+ getResponses() {
281
+ return this.responses;
282
+ }
283
+ /**
284
+ * Gets current corpus configuration
285
+ * @returns {any} Current corpus
286
+ */
287
+ getCorpus() {
288
+ return this.manager.corpora;
289
+ }
290
+ /**
291
+ * Gets current entities configuration
292
+ * @returns {any} Current entities configuration
293
+ */
294
+ getEntities() {
295
+ var _a;
296
+ return ((_a = this.manager.nerManager) === null || _a === void 0 ? void 0 : _a.rules) || {};
297
+ }
298
+ }
299
+ exports.NLPEngine = NLPEngine;
300
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../modules/nlp/engine.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E,UAAkB;;QACrC,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,IAAS,EAAE,UAAkB;;QAC3C,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,IAAS;;QACpB,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;QACpE,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,WAAW;;QAChB,OAAO,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,UAAU,0CAAE,KAAK,KAAI,EAAE,CAAC;IAC9C,CAAC;CACF;AAjTD,8BAiTC"}
@@ -0,0 +1,27 @@
1
+ import { NLPNodeConfig } from "@/interfaces";
2
+ import { ZodSchema } from "zod";
3
+ /**
4
+ * NLPNode class handles natural language processing operations with type-safe schema validation
5
+ * @template T - Zod schema type for validation
6
+ */
7
+ export declare class NLPNode<T extends ZodSchema> {
8
+ private config;
9
+ private engine;
10
+ /**
11
+ * Creates an instance of NLPNode
12
+ * @param {NLPNodeConfig<T>} config - Configuration object for the NLP node
13
+ */
14
+ constructor(config: NLPNodeConfig<T>);
15
+ /**
16
+ * Initializes the NLP engine and sets up intent handlers
17
+ * @returns {Promise<void>}
18
+ */
19
+ initialize(): Promise<void>;
20
+ /**
21
+ * Processes the input text through the NLP engine
22
+ * @param {string} input - Text to be processed
23
+ * @returns {Promise<any>} - Processing result from the engine
24
+ */
25
+ process(input: string): Promise<any>;
26
+ }
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/nlp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGhC;;;GAGG;AACH,qBAAa,OAAO,CAAC,CAAC,SAAS,SAAS;IAO1B,OAAO,CAAC,MAAM;IAN1B,OAAO,CAAC,MAAM,CAAa;IAE3B;;;OAGG;gBACiB,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5C;;;OAGG;IACG,UAAU;IAYhB;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM;CAM5B"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NLPNode = void 0;
13
+ const engine_1 = require("./engine");
14
+ /**
15
+ * NLPNode class handles natural language processing operations with type-safe schema validation
16
+ * @template T - Zod schema type for validation
17
+ */
18
+ class NLPNode {
19
+ /**
20
+ * Creates an instance of NLPNode
21
+ * @param {NLPNodeConfig<T>} config - Configuration object for the NLP node
22
+ */
23
+ constructor(config) {
24
+ this.config = config;
25
+ }
26
+ /**
27
+ * Initializes the NLP engine and sets up intent handlers
28
+ * @returns {Promise<void>}
29
+ */
30
+ initialize() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ this.engine = yield engine_1.NLPEngine.create(this.config.nlpConfig);
33
+ console.log("Loaded engine");
34
+ if (this.config.intentHandlers) {
35
+ Object.entries(this.config.intentHandlers).forEach(([intent, handler]) => {
36
+ this.engine.addAction(intent, handler);
37
+ });
38
+ }
39
+ });
40
+ }
41
+ /**
42
+ * Processes the input text through the NLP engine
43
+ * @param {string} input - Text to be processed
44
+ * @returns {Promise<any>} - Processing result from the engine
45
+ */
46
+ process(input) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ console.log("NLP Node processing:", input);
49
+ const result = yield this.engine.process(input);
50
+ console.log("NLP Node result:", result);
51
+ return result;
52
+ });
53
+ }
54
+ }
55
+ exports.NLPNode = NLPNode;
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../modules/nlp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qCAAqC;AAErC;;;GAGG;AACH,MAAa,OAAO;IAGlB;;;OAGG;IACH,YAAoB,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IAEhD;;;OAGG;IACG,UAAU;;YACd,IAAI,CAAC,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAChD,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE;oBACpB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACzC,CAAC,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,OAAO,CAAC,KAAa;;YACzB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF;AApCD,0BAoCC"}
@@ -0,0 +1,233 @@
1
+ import { GraphFlow } from "@/graph";
2
+ import { z } from "zod";
3
+ /**
4
+ * Represents an action that has been executed by the agent
5
+ * @interface ExecutedAction
6
+ * @property {string} name - The name of the executed action
7
+ * @property {boolean} isExecuted - Whether the action was successfully executed
8
+ * @property {string | null} [error] - Optional error message if the action failed
9
+ * @property {any} result - The result of the action execution
10
+ * @property {string} timestamp - When the action was executed
11
+ */
12
+ export type ExecutedAction = {
13
+ name: string;
14
+ isExecuted: boolean;
15
+ error?: string | null;
16
+ result: any;
17
+ timestamp: string;
18
+ };
19
+ /**
20
+ * Represents the context in which an agent operates
21
+ * @interface AgentContext
22
+ * @property {Object} input - The input provided to the agent
23
+ * @property {string} input.raw - The raw input text
24
+ * @property {number[]} [input.embedding] - Optional vector embedding of the input
25
+ * @property {ActionSchema[]} actions - List of actions available to the agent
26
+ * @property {string} response - The agent's response
27
+ * @property {string} [knowledge] - Optional knowledge base or context
28
+ * @property {ExecutedAction[]} executedActions - History of executed actions
29
+ */
30
+ export type AgentContext = {
31
+ input: {
32
+ raw: string;
33
+ embedding?: number[];
34
+ };
35
+ actions: ActionSchema[];
36
+ response: string;
37
+ knowledge?: string;
38
+ executedActions: ExecutedAction[];
39
+ };
40
+ export declare const AgentContextSchema: z.ZodObject<{
41
+ input: z.ZodObject<{
42
+ raw: z.ZodString;
43
+ embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ raw: string;
46
+ embedding?: number[] | undefined;
47
+ }, {
48
+ raw: string;
49
+ embedding?: number[] | undefined;
50
+ }>;
51
+ actions: z.ZodArray<z.ZodObject<{
52
+ name: z.ZodString;
53
+ parameters: z.ZodArray<z.ZodObject<{
54
+ name: z.ZodString;
55
+ value: z.ZodAny;
56
+ }, "strip", z.ZodTypeAny, {
57
+ name: string;
58
+ value?: any;
59
+ }, {
60
+ name: string;
61
+ value?: any;
62
+ }>, "many">;
63
+ isExecuted: z.ZodOptional<z.ZodBoolean>;
64
+ result: z.ZodOptional<z.ZodAny>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ name: string;
67
+ parameters: {
68
+ name: string;
69
+ value?: any;
70
+ }[];
71
+ isExecuted?: boolean | undefined;
72
+ result?: any;
73
+ }, {
74
+ name: string;
75
+ parameters: {
76
+ name: string;
77
+ value?: any;
78
+ }[];
79
+ isExecuted?: boolean | undefined;
80
+ result?: any;
81
+ }>, "many">;
82
+ knowledge: z.ZodOptional<z.ZodString>;
83
+ response: z.ZodString;
84
+ executedActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ name: z.ZodString;
86
+ result: z.ZodAny;
87
+ timestamp: z.ZodString;
88
+ }, "strip", z.ZodTypeAny, {
89
+ name: string;
90
+ timestamp: string;
91
+ result?: any;
92
+ }, {
93
+ name: string;
94
+ timestamp: string;
95
+ result?: any;
96
+ }>, "many">>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ input: {
99
+ raw: string;
100
+ embedding?: number[] | undefined;
101
+ };
102
+ actions: {
103
+ name: string;
104
+ parameters: {
105
+ name: string;
106
+ value?: any;
107
+ }[];
108
+ isExecuted?: boolean | undefined;
109
+ result?: any;
110
+ }[];
111
+ response: string;
112
+ knowledge?: string | undefined;
113
+ executedActions?: {
114
+ name: string;
115
+ timestamp: string;
116
+ result?: any;
117
+ }[] | undefined;
118
+ }, {
119
+ input: {
120
+ raw: string;
121
+ embedding?: number[] | undefined;
122
+ };
123
+ actions: {
124
+ name: string;
125
+ parameters: {
126
+ name: string;
127
+ value?: any;
128
+ }[];
129
+ isExecuted?: boolean | undefined;
130
+ result?: any;
131
+ }[];
132
+ response: string;
133
+ knowledge?: string | undefined;
134
+ executedActions?: {
135
+ name: string;
136
+ timestamp: string;
137
+ result?: any;
138
+ }[] | undefined;
139
+ }>;
140
+ /**
141
+ * Represents a section of the prompt with a title and content
142
+ * @interface PromptSection
143
+ * @property {string} title - The title of the prompt section
144
+ * @property {string | ((context: AgentContext) => string | Promise<string>)} content - The content or a function to generate content
145
+ */
146
+ export type PromptSection = {
147
+ title: string;
148
+ content: string | ((context: AgentContext) => string | Promise<string>);
149
+ };
150
+ /**
151
+ * Supported LLM providers
152
+ */
153
+ export type LLMProvider = "openai" | "anthropic" | "custom";
154
+ /**
155
+ * Supported LLM models
156
+ */
157
+ export type LLMModel = "gpt-4" | "gpt-3.5-turbo" | "claude-2" | string;
158
+ export type ExecutorConfig = {
159
+ llmConfig: LLMConfig;
160
+ verbose?: boolean;
161
+ };
162
+ /**
163
+ * Configuration for the Agent
164
+ * @type AssistantConfig
165
+ * @extends {Omit<ExecutorConfig, "verbose">}
166
+ * @property {string} role - The function/job of the assistant (e.g., "Email Assistant")
167
+ * @property {string} goal - The specific objective the assistant tries to achieve
168
+ * @property {string} backstory - The personality and behavioral traits of the assistant
169
+ * @property {any[]} [tools] - Optional tools the assistant can use
170
+ * @property {any} [memory] - Optional memory system
171
+ * @property {boolean} [verbose] - Whether to log detailed information
172
+ */
173
+ export type AgentConfig = {
174
+ role: string;
175
+ goal: string;
176
+ backstory: string;
177
+ tools: GraphFlow<any>[];
178
+ memory?: any;
179
+ verbose?: boolean;
180
+ llmConfig: ExecutorConfig["llmConfig"];
181
+ };
182
+ /**
183
+ * Represents the schema of an action that can be performed by the agent
184
+ * @interface ActionSchema
185
+ * @property {string} name - The name of the action
186
+ * @property {Array<{name: string, value: any}>} parameters - The parameters required for the action
187
+ */
188
+ export type ActionSchema = {
189
+ name: string;
190
+ parameters: Array<{
191
+ name: string;
192
+ value: any;
193
+ }>;
194
+ };
195
+ /**
196
+ * Represents the output of the agent's decision-making process
197
+ * @interface DecisionOutput
198
+ * @property {ActionSchema[]} actions - The actions to be executed
199
+ * @property {string} response - The agent's response message
200
+ */
201
+ export type DecisionOutput = {
202
+ actions: ActionSchema[];
203
+ response: string;
204
+ };
205
+ /**
206
+ * Configuration for the Language Model
207
+ * @interface LLMConfig
208
+ * @property {LLMProvider} provider - The LLM provider to use
209
+ * @property {string} apiKey - API key for the provider
210
+ * @property {LLMModel} model - The specific model to use
211
+ * @property {number} [temperature] - Optional temperature parameter for response randomness
212
+ * @property {number} [maxTokens] - Optional maximum tokens for the response
213
+ * @property {Function} [customCall] - Optional custom implementation for API calls
214
+ */
215
+ export type LLMConfig = {
216
+ provider: LLMProvider;
217
+ apiKey: string;
218
+ model: LLMModel;
219
+ temperature?: number;
220
+ maxTokens?: number;
221
+ customCall?: (prompt: string | PromptInput, schema: z.ZodType<any>) => Promise<any>;
222
+ };
223
+ /**
224
+ * Structure for prompt input to the LLM
225
+ * @interface PromptInput
226
+ * @property {string} system - The system message/context
227
+ * @property {string} user - The user's input message
228
+ */
229
+ export type PromptInput = {
230
+ system: string;
231
+ user: string;
232
+ };
233
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","s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
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentContextSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.AgentContextSchema = zod_1.z.object({
6
+ input: zod_1.z.object({
7
+ raw: zod_1.z.string(),
8
+ embedding: zod_1.z.array(zod_1.z.number()).optional(),
9
+ }),
10
+ actions: zod_1.z.array(zod_1.z.object({
11
+ name: zod_1.z.string(),
12
+ parameters: zod_1.z.array(zod_1.z.object({
13
+ name: zod_1.z.string(),
14
+ value: zod_1.z.any(),
15
+ })),
16
+ isExecuted: zod_1.z.boolean().optional(),
17
+ result: zod_1.z.any().optional(),
18
+ })),
19
+ knowledge: zod_1.z.string().optional(),
20
+ response: zod_1.z.string(),
21
+ executedActions: zod_1.z
22
+ .array(zod_1.z.object({
23
+ name: zod_1.z.string(),
24
+ result: zod_1.z.any(),
25
+ timestamp: zod_1.z.string(),
26
+ }))
27
+ .optional(),
28
+ });
29
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../types/agent.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AAyCX,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC;QACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;QACf,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KAC1C,CAAC;IACF,OAAO,EAAE,OAAC,CAAC,KAAK,CACd,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,UAAU,EAAE,OAAC,CAAC,KAAK,CACjB,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,KAAK,EAAE,OAAC,CAAC,GAAG,EAAE;SACf,CAAC,CACH;QACD,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QAClC,MAAM,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC,CACH;IACD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,eAAe,EAAE,OAAC;SACf,KAAK,CACJ,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,OAAC,CAAC,GAAG,EAAE;QACf,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;KACtB,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC,CAAC"}