@ai.ntellect/core 0.5.0 → 0.6.1

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 (131) hide show
  1. package/.mocharc.json +1 -1
  2. package/README.md +311 -272
  3. package/create-llm-to-select-multiple-graph copy.ts +243 -0
  4. package/create-llm-to-select-multiple-graph.ts +148 -0
  5. package/dist/graph/controller.js +63 -0
  6. package/dist/graph/engine.js +563 -0
  7. package/dist/index.js +6 -6
  8. package/dist/memory/adapters/meilisearch/index.js +249 -0
  9. package/dist/memory/adapters/redis/index.js +96 -0
  10. package/dist/memory/index.js +9 -0
  11. package/dist/services/agenda.js +115 -0
  12. package/dist/services/embedding.js +40 -0
  13. package/dist/services/queue.js +99 -103
  14. package/dist/test/graph/controller.test.js +170 -0
  15. package/dist/test/graph/engine.test.js +465 -0
  16. package/dist/test/memory/adapters/meilisearch.test.js +250 -0
  17. package/dist/test/memory/adapters/redis.test.js +143 -0
  18. package/dist/test/memory/base.test.js +209 -0
  19. package/dist/test/services/agenda.test.js +230 -0
  20. package/dist/test/services/queue.test.js +258 -0
  21. package/dist/types/index.js +2 -0
  22. package/dist/utils/generate-object.js +32 -11
  23. package/dist/utils/inject-actions.js +2 -2
  24. package/dist/utils/queue-item-transformer.js +2 -2
  25. package/dist/utils/state-manager.js +20 -0
  26. package/graph/controller.ts +64 -0
  27. package/graph/engine.ts +790 -0
  28. package/index copy.ts +81 -0
  29. package/index.ts +7 -7
  30. package/interfaces/index.ts +119 -0
  31. package/memory/adapters/meilisearch/index.ts +286 -0
  32. package/memory/adapters/redis/index.ts +103 -0
  33. package/memory/index.ts +22 -0
  34. package/package.json +7 -2
  35. package/services/agenda.ts +48 -43
  36. package/services/embedding.ts +26 -0
  37. package/services/queue.ts +2 -29
  38. package/test/.env.test +4 -0
  39. package/test/graph/controller.test.ts +186 -0
  40. package/test/graph/engine.test.ts +546 -0
  41. package/test/memory/adapters/meilisearch.test.ts +297 -0
  42. package/test/memory/adapters/redis.test.ts +160 -0
  43. package/test/memory/base.test.ts +229 -0
  44. package/test/services/agenda.test.ts +280 -0
  45. package/test/services/queue.test.ts +286 -44
  46. package/tsconfig.json +10 -10
  47. package/types/index.ts +278 -0
  48. package/utils/queue-item-transformer.ts +8 -11
  49. package/utils/setup-graphs.ts +45 -0
  50. package/utils/stringifiy-zod-schema.ts +45 -0
  51. package/.nvmrc +0 -1
  52. package/README.FR.md +0 -916
  53. package/agent/index.ts +0 -151
  54. package/agent/workflow/conditions.ts +0 -16
  55. package/agent/workflow/handlers/interpreter.handler.ts +0 -48
  56. package/agent/workflow/handlers/memory.handler.ts +0 -106
  57. package/agent/workflow/handlers/orchestrator.handler.ts +0 -23
  58. package/agent/workflow/handlers/queue.handler.ts +0 -34
  59. package/agent/workflow/handlers/scheduler.handler.ts +0 -61
  60. package/agent/workflow/index.ts +0 -62
  61. package/dist/agent/index.d.ts +0 -38
  62. package/dist/agent/index.js +0 -143
  63. package/dist/agent/tools/get-rss.d.ts +0 -16
  64. package/dist/agent/tools/get-rss.js +0 -62
  65. package/dist/bull.d.ts +0 -1
  66. package/dist/bull.js +0 -9
  67. package/dist/examples/index.d.ts +0 -2
  68. package/dist/examples/index.js +0 -89
  69. package/dist/index.d.ts +0 -7
  70. package/dist/llm/interpreter/context.d.ts +0 -15
  71. package/dist/llm/interpreter/context.js +0 -89
  72. package/dist/llm/interpreter/index.d.ts +0 -21
  73. package/dist/llm/interpreter/index.js +0 -87
  74. package/dist/llm/memory-manager/context.d.ts +0 -2
  75. package/dist/llm/memory-manager/context.js +0 -22
  76. package/dist/llm/memory-manager/index.d.ts +0 -17
  77. package/dist/llm/memory-manager/index.js +0 -107
  78. package/dist/llm/orchestrator/context.d.ts +0 -2
  79. package/dist/llm/orchestrator/context.js +0 -23
  80. package/dist/llm/orchestrator/index.d.ts +0 -44
  81. package/dist/llm/orchestrator/index.js +0 -139
  82. package/dist/llm/orchestrator/types.d.ts +0 -12
  83. package/dist/memory/cache.d.ts +0 -22
  84. package/dist/memory/cache.js +0 -165
  85. package/dist/memory/persistent.d.ts +0 -57
  86. package/dist/memory/persistent.js +0 -189
  87. package/dist/services/queue.d.ts +0 -13
  88. package/dist/services/redis-cache.d.ts +0 -37
  89. package/dist/services/redis-cache.js +0 -93
  90. package/dist/services/scheduler.d.ts +0 -40
  91. package/dist/services/scheduler.js +0 -99
  92. package/dist/services/telegram-monitor.d.ts +0 -0
  93. package/dist/services/telegram-monitor.js +0 -118
  94. package/dist/t.d.ts +0 -46
  95. package/dist/t.js +0 -102
  96. package/dist/test.d.ts +0 -0
  97. package/dist/test.js +0 -438
  98. package/dist/types.d.ts +0 -258
  99. package/dist/types.js +0 -22
  100. package/dist/utils/generate-object.d.ts +0 -12
  101. package/dist/utils/header-builder.d.ts +0 -11
  102. package/dist/utils/inject-actions.d.ts +0 -2
  103. package/dist/utils/queue-item-transformer.d.ts +0 -7
  104. package/dist/utils/sanitize-results.d.ts +0 -17
  105. package/dist/utils/schema-generator.d.ts +0 -16
  106. package/examples/actions/get-rss.ts +0 -71
  107. package/examples/index.ts +0 -98
  108. package/index.html +0 -42
  109. package/llm/dynamic-condition/example.ts +0 -36
  110. package/llm/dynamic-condition/index.ts +0 -108
  111. package/llm/interpreter/context.ts +0 -94
  112. package/llm/interpreter/index.ts +0 -140
  113. package/llm/memory-manager/context.ts +0 -19
  114. package/llm/memory-manager/index.ts +0 -115
  115. package/llm/orchestrator/context.ts +0 -19
  116. package/llm/orchestrator/index.ts +0 -192
  117. package/llm/orchestrator/types.ts +0 -14
  118. package/memory/cache.ts +0 -221
  119. package/memory/persistent.ts +0 -265
  120. package/script.js +0 -167
  121. package/services/cache.ts +0 -298
  122. package/services/telegram-monitor.ts +0 -138
  123. package/services/workflow.ts +0 -491
  124. package/t.py +0 -79
  125. package/t.ts +0 -25
  126. package/test/llm/orchestrator.test.ts +0 -47
  127. package/test/llm/synthesizer.test.ts +0 -31
  128. package/types.ts +0 -367
  129. package/utils/schema-generator.ts +0 -73
  130. package/utils/state-manager.ts +0 -25
  131. /package/dist/{llm/orchestrator/types.js → interfaces/index.js} +0 -0
package/dist/test.js DELETED
@@ -1,438 +0,0 @@
1
- "use strict";
2
- // import ccxt from "ccxt";
3
- // import { configDotenv } from "dotenv";
4
- // import { parseEther } from "ethers";
5
- // import Parser from "rss-parser";
6
- // import { z } from "zod";
7
- // // import { Orchestrator } from "./llm/orchestrator";
8
- // configDotenv();
9
- // interface HoneypotParams {
10
- // address: string;
11
- // chainName?: string;
12
- // simulateLiquidity?: boolean;
13
- // }
14
- // // Mapping des noms de chaînes vers leurs IDs
15
- // const CHAIN_IDS: { [key: string]: string } = {
16
- // ethereum: "1",
17
- // bsc: "56",
18
- // polygon: "137",
19
- // matic: "137",
20
- // avalanche: "43114",
21
- // avax: "43114",
22
- // fantom: "250",
23
- // ftm: "250",
24
- // arbitrum: "42161",
25
- // arb: "42161",
26
- // optimism: "10",
27
- // base: "8453",
28
- // zksync: "324",
29
- // solana: "solana",
30
- // sol: "solana",
31
- // };
32
- // export const checkHoneypot = {
33
- // name: "check-honeypot",
34
- // description: `Analyze a token to detect if it is a honeypot. RESPECT THIS FORMAT FOR CHAIN NAME: ${CHAIN_IDS.toString()}`,
35
- // parameters: z.object({
36
- // address: z.string().describe("Address of the token"),
37
- // chainName: z.string().describe("Chain name (default: eth)"),
38
- // }),
39
- // execute: async ({
40
- // address,
41
- // chainName,
42
- // }: {
43
- // address: string;
44
- // chainName?: string;
45
- // }) => {
46
- // try {
47
- // const API_URL = "https://api.honeypot.is/v2/IsHoneypot";
48
- // const chainId = getChainId(chainName);
49
- // console.log("💰 Checking honeypot for token", {
50
- // address,
51
- // chainId,
52
- // });
53
- // if (chainId === "solana") {
54
- // return {
55
- // status: "error",
56
- // message:
57
- // "L'analyse des tokens Solana n'est pas encore supportée. Cette fonctionnalité sera disponible prochainement.",
58
- // chain: {
59
- // name: "Solana",
60
- // id: "solana",
61
- // },
62
- // };
63
- // }
64
- // const queryParams = new URLSearchParams({
65
- // address: address,
66
- // ...(chainId && { chainId }),
67
- // ...{ simulateLiquidity: "true" },
68
- // });
69
- // const response = await fetch(`${API_URL}?${queryParams}`);
70
- // if (!response.ok) {
71
- // throw new Error(
72
- // `Erreur API: ${response.status} ${response.statusText}`
73
- // );
74
- // }
75
- // const data: any = await response.json();
76
- // const result = {
77
- // status: "success",
78
- // token: {
79
- // name: data.token.name,
80
- // symbol: data.token.symbol,
81
- // address: data.token.address,
82
- // holders: data.token.totalHolders,
83
- // },
84
- // risk: {
85
- // level: data.summary.risk,
86
- // score: data.summary.riskLevel,
87
- // flags: data.summary.flags || [],
88
- // },
89
- // analysis: {
90
- // isHoneypot: data.honeypotResult?.isHoneypot || false,
91
- // reason: data.honeypotResult?.honeypotReason || null,
92
- // buyTax: data.simulationResult?.buyTax || 0,
93
- // sellTax: data.simulationResult?.sellTax || 0,
94
- // holders: {
95
- // total: data.holderAnalysis?.holders || 0,
96
- // successful: data.holderAnalysis?.successful || 0,
97
- // failed: data.holderAnalysis?.failed || 0,
98
- // siphoned: data.holderAnalysis?.siphoned || 0,
99
- // },
100
- // },
101
- // chain: {
102
- // name: data.chain.name,
103
- // id: data.chain.id,
104
- // },
105
- // };
106
- // return result;
107
- // } catch (error: any) {
108
- // throw error;
109
- // }
110
- // },
111
- // };
112
- // function getChainId(chainName?: string): string | undefined {
113
- // if (!chainName) return undefined;
114
- // const normalizedChainName = chainName.toLowerCase();
115
- // return CHAIN_IDS[normalizedChainName];
116
- // }
117
- // export interface NetworkConfig {
118
- // name: string;
119
- // id?: number;
120
- // rpc: string;
121
- // explorerUrl: string;
122
- // nativeToken: string; // WETH
123
- // }
124
- // export const networkConfigs: Record<string, NetworkConfig> = {
125
- // ethereum: {
126
- // name: "Ethereum Mainnet",
127
- // id: 1,
128
- // rpc: "https://eth.llamarpc.com",
129
- // explorerUrl: "https://etherscan.io",
130
- // nativeToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
131
- // },
132
- // polygon: {
133
- // name: "Polygon Mainnet",
134
- // id: 137,
135
- // rpc: "https://polygon.llamarpc.com",
136
- // explorerUrl: "https://polygonscan.com",
137
- // nativeToken: "0x0000000000000000000000000000000000001010",
138
- // },
139
- // arbitrum: {
140
- // name: "Arbitrum Mainnet",
141
- // id: 42161,
142
- // rpc: "https://arbitrum.llamarpc.com",
143
- // explorerUrl: "https://arbiscan.io",
144
- // nativeToken: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
145
- // },
146
- // base: {
147
- // name: "Base Mainnet",
148
- // id: 8453,
149
- // rpc: "https://base.llamarpc.com",
150
- // explorerUrl: "https://basescan.org",
151
- // nativeToken: "0x4200000000000000000000000000000000000006",
152
- // },
153
- // solana: {
154
- // name: "Solana Mainnet",
155
- // rpc: "https://api.mainnet-beta.solana.com",
156
- // explorerUrl: "https://solscan.io",
157
- // nativeToken: "So11111111111111111111111111111111111111112",
158
- // },
159
- // sepolia: {
160
- // name: "Sepolia Testnet",
161
- // id: 11155111,
162
- // rpc: "https://sepolia.llamarpc.com",
163
- // explorerUrl: "https://sepolia.etherscan.io",
164
- // nativeToken: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
165
- // },
166
- // baseSepolia: {
167
- // name: "Base Sepolia Testnet",
168
- // id: 84532,
169
- // rpc: "https://base-sepolia-rpc.publicnode.com",
170
- // explorerUrl: "https://sepolia.basescan.org",
171
- // nativeToken: "0x4200000000000000000000000000000000000006",
172
- // },
173
- // };
174
- // export const getNetworkProvider = (networkName: string) => {
175
- // const config = networkConfigs[networkName.toLowerCase()];
176
- // if (!config) {
177
- // throw new Error(`Network ${networkName} not supported`);
178
- // }
179
- // return { config };
180
- // };
181
- // export type TransactionPrepared = {
182
- // to: string;
183
- // value: string;
184
- // data?: string;
185
- // chain: {
186
- // id: number;
187
- // rpc: string;
188
- // };
189
- // type: "transfer" | "approve" | "swap";
190
- // method?: string;
191
- // params?: any[];
192
- // };
193
- // export const prepareEvmTransaction = {
194
- // name: "prepare-evm-transaction",
195
- // description: "Prepare a transaction for the user to sign.",
196
- // parameters: z.object({
197
- // walletAddress: z.string(),
198
- // amount: z
199
- // .string()
200
- // .describe("Ask the user for the amount to send, if not specified"),
201
- // network: z
202
- // .string()
203
- // .describe(
204
- // "Examples networks: ethereum, arbitrum, base. IMPORTANT: You must respect the network name."
205
- // ),
206
- // }),
207
- // execute: async ({
208
- // walletAddress,
209
- // amount,
210
- // network,
211
- // }: {
212
- // walletAddress: string;
213
- // amount: string;
214
- // network: string;
215
- // }): Promise<TransactionPrepared> => {
216
- // try {
217
- // console.log("💰 Preparing transaction", {
218
- // to: walletAddress,
219
- // amount,
220
- // network,
221
- // });
222
- // const networkConfig = networkConfigs[network.toLowerCase()];
223
- // if (!networkConfig) {
224
- // throw new Error(`Network ${network} not found`);
225
- // }
226
- // return {
227
- // to: walletAddress,
228
- // value: parseEther(amount).toString(),
229
- // chain: {
230
- // id: networkConfig.id || 0,
231
- // rpc: networkConfig.rpc,
232
- // },
233
- // type: "transfer",
234
- // };
235
- // } catch (error) {
236
- // console.error("💰 Error sending transaction:", error);
237
- // throw new Error("An error occurred while sending the transaction");
238
- // }
239
- // },
240
- // };
241
- // export const fetchMarkPrice = {
242
- // name: "fetch-mark-price",
243
- // description: "Fetches mark price for the market",
244
- // parameters: z.object({
245
- // symbol: z
246
- // .string()
247
- // .describe(
248
- // "Unified symbol of the market to fetch the ticker for (default: BTC/USDT)"
249
- // ),
250
- // params: z.object({
251
- // subType: z
252
- // .string()
253
- // .describe("Type of funding rate: 'linear' or 'inverse'"),
254
- // }),
255
- // }),
256
- // execute: async ({ symbol, params }: { symbol: string; params: any }) => {
257
- // try {
258
- // const binance = new ccxt.binance({});
259
- // // Fetch mark price from the Binance API
260
- // const markPrice = await binance.fetchMarkPrice(symbol, params);
261
- // console.log("Mark price fetched:", markPrice);
262
- // return markPrice;
263
- // } catch (error: any) {
264
- // console.error("Error fetching mark price:", error);
265
- // throw error;
266
- // }
267
- // },
268
- // };
269
- // interface ChainTVL {
270
- // name: string;
271
- // tvl: number;
272
- // tokenSymbol: string | null;
273
- // chainId: number | string | null;
274
- // gecko_id: string | null;
275
- // cmcId: string | null;
276
- // }
277
- // export const getChainsTVL = {
278
- // name: "get_chains_tvl",
279
- // description:
280
- // "Get current TVL (Total Value Locked) of all chains from DeFiLlama",
281
- // parameters: z.object({
282
- // limit: z
283
- // .number()
284
- // .optional()
285
- // .default(10)
286
- // .describe("Number of top chains to return (default: 10)"),
287
- // }),
288
- // execute: async ({ limit }: { limit: number }) => {
289
- // try {
290
- // const response = await fetch("https://api.llama.fi/v2/chains", {
291
- // headers: { accept: "*/*" },
292
- // });
293
- // if (!response.ok) {
294
- // throw new Error(`HTTP error! status: ${response.status}`);
295
- // }
296
- // const chains = (await response.json()) as ChainTVL[];
297
- // // Sort chains by TVL in descending order and take top N
298
- // const topChains = chains
299
- // .sort((a, b) => b.tvl - a.tvl)
300
- // .slice(0, limit)
301
- // .map((chain) => ({
302
- // name: chain.name,
303
- // tvl: chain.tvl,
304
- // tokenSymbol: chain.tokenSymbol,
305
- // }));
306
- // const totalTVL = chains.reduce((sum, chain) => sum + chain.tvl, 0);
307
- // return {
308
- // summary: {
309
- // totalTVL,
310
- // numberOfChains: chains.length,
311
- // },
312
- // topChains,
313
- // };
314
- // } catch (error) {
315
- // console.error("Error retrieving chains TVL data:", error);
316
- // throw new Error(
317
- // `Failed to fetch chains TVL data: ${(error as Error).message}`
318
- // );
319
- // }
320
- // },
321
- // };
322
- // (async () => {
323
- // // const cacheMemory = new CacheMemory();
324
- // // const memory = new PersistentMemory({
325
- // // host: "http://localhost:7700",
326
- // // apiKey: "aSampleMasterKey",
327
- // // });
328
- // // const orchestrator = new Orchestrator({
329
- // // id: "1",
330
- // // tools: [
331
- // // prepareEvmTransaction,
332
- // // checkHoneypot,
333
- // // getChainsTVL,
334
- // // getRssNews,
335
- // // {
336
- // // name: "hello",
337
- // // description: "hello",
338
- // // parameters: z.object({
339
- // // name: z.string(),
340
- // // }),
341
- // // execute: async () => {
342
- // // console.log("hello");
343
- // // },
344
- // // },
345
- // // ],
346
- // // memory: {
347
- // // persistent: memory,
348
- // // cache: cacheMemory,
349
- // // },
350
- // // });
351
- // // const securityInterpreter = new Interpreter(
352
- // // "security",
353
- // // securityInterpreterContext
354
- // // );
355
- // // const marketInterpreter = new Interpreter("market", marketInterpreterContext);
356
- // // const generalInterpreter = new Interpreter(
357
- // // "general",
358
- // // generalInterpreterContext
359
- // // );
360
- // // const ccacheMemory = await cacheMemory.findSimilarActions(
361
- // // "le top 3 des chaines par TVL en DeFi",
362
- // // {
363
- // // similarityThreshold: 50,
364
- // // maxResults: 5,
365
- // // userId: "1",
366
- // // scope: MemoryScope.GLOBAL,
367
- // // }
368
- // // );
369
- // // console.log("✅ RECENT_ACTIONS: ", ccacheMemory);
370
- // // const agent = new Agent({
371
- // // interpreters: [securityInterpreter, marketInterpreter, generalInterpreter],
372
- // // orchestrator,
373
- // // memory: {
374
- // // persistent: memory,
375
- // // cache: cacheMemory,
376
- // // },
377
- // // stream: false,
378
- // // maxEvaluatorIteration: 1,
379
- // // });
380
- // // const prompt = "c quoi les news";
381
- // // const result = await agent.process(prompt, {});
382
- // // const scheduler = new ActionScheduler(
383
- // // new ActionQueueManager(orchestrator.tools),
384
- // // orchestrator,
385
- // // {
386
- // // onActionScheduled: (action: ScheduledAction) => {
387
- // // console.log("🗓️ Action programmée:", {
388
- // // id: action.id,
389
- // // name: action.action.name,
390
- // // scheduledTime: action.scheduledTime,
391
- // // });
392
- // // },
393
- // // onActionStart: (action: ScheduledAction) => {
394
- // // console.log("▶️ Action démarrée:", action.id);
395
- // // },
396
- // // onActionComplete: (action: ScheduledAction, result: any) => {
397
- // // console.log("✅ Action terminée:", {
398
- // // id: action.id,
399
- // // result,
400
- // // });
401
- // // },
402
- // // onActionFailed: (action: ScheduledAction, error: any) => {
403
- // // console.error("❌ Action échouée:", {
404
- // // id: action.id,
405
- // // error: error.message,
406
- // // });
407
- // // },
408
- // // onActionCancelled: (actionId: string) => {
409
- // // console.log("🚫 Action annulée:", actionId);
410
- // // },
411
- // // }
412
- // // );
413
- // // Test du scheduler
414
- // // console.log("🕒 Testing scheduler...");
415
- // // const scheduledTime = new Date(Date.now() + 10000);
416
- // // const actionId = await scheduler.scheduleAction(
417
- // // {
418
- // // name: "hello",
419
- // // description: "hello",
420
- // // parameters: z.object({
421
- // // name: z.string(),
422
- // // }),
423
- // // execute: async () => {
424
- // // console.log("hello");
425
- // // return "Hello executed!";
426
- // // },
427
- // // },
428
- // // scheduledTime,
429
- // // "user123",
430
- // // {
431
- // // type: "daily",
432
- // // interval: 1,
433
- // // }
434
- // // );
435
- // // // Attendre 15 secondes
436
- // // await new Promise((resolve) => setTimeout(resolve, 15000));
437
- // // console.log("✅ Test terminé");
438
- // })();
package/dist/types.d.ts DELETED
@@ -1,258 +0,0 @@
1
- import { Embedding, EmbeddingModel, StreamTextResult } from "ai";
2
- import { z } from "zod";
3
- export interface BaseLLM {
4
- process: (prompt: string) => Promise<string | object>;
5
- streamProcess?: (prompt: string) => Promise<StreamTextResult<Record<string, any>>>;
6
- }
7
- export type User = {
8
- id: string;
9
- };
10
- export interface QueueItem {
11
- name: string;
12
- parameters: QueueItemParameter[];
13
- }
14
- export interface IEventHandler {
15
- emitQueueStart(actions: QueueItem[]): void;
16
- emitActionStart(action: QueueItem): void;
17
- emitActionComplete(action: QueueResult): void;
18
- emitQueueComplete(): void;
19
- }
20
- export type AgentEvent = {
21
- onMessage?: (data: any) => void;
22
- onQueueStart?: (actions: QueueItem[]) => void;
23
- onActionStart?: (action: QueueItem) => void;
24
- onActionComplete?: (action: QueueResult) => void;
25
- onQueueComplete?: (actions: QueueResult[]) => void;
26
- onConfirmationRequired?: (message: string) => Promise<boolean>;
27
- };
28
- export interface QueueResult {
29
- name: string;
30
- parameters: Record<string, string>;
31
- result: any;
32
- error: string | null;
33
- cancelled?: boolean;
34
- }
35
- export interface QueueCallbacks {
36
- onActionStart?: (action: QueueItem) => void;
37
- onActionComplete?: (result: QueueResult) => void;
38
- onQueueComplete?: (results: QueueResult[]) => void;
39
- onConfirmationRequired?: (message: string) => Promise<boolean>;
40
- }
41
- export interface ProcessPromptCallbacks {
42
- onQueueStart?: (actions: QueueItem[]) => void | Promise<void>;
43
- onActionStart?: (action: QueueItem) => void | Promise<void>;
44
- onActionComplete?: (action: QueueResult) => void | Promise<void>;
45
- onQueueComplete?: (actions: QueueResult[]) => void | Promise<void>;
46
- onConfirmationRequired?: (message: string) => Promise<boolean>;
47
- }
48
- export type Behavior = {
49
- role: string;
50
- language: string;
51
- guidelines: {
52
- important: string[];
53
- warnings: string[];
54
- steps?: string[];
55
- };
56
- examplesMessages?: {
57
- role: string;
58
- content: string;
59
- }[];
60
- };
61
- export type State = {
62
- userRequest: string;
63
- results: string;
64
- };
65
- export interface ActionSchema {
66
- name: string;
67
- description: string;
68
- parameters: z.ZodObject<{
69
- [key: string]: z.ZodType;
70
- }>;
71
- execute: (args: any) => Promise<any>;
72
- examples?: {
73
- role: string;
74
- content: string;
75
- parameters?: Record<string, any>;
76
- }[];
77
- confirmation?: {
78
- requireConfirmation: boolean;
79
- message: string;
80
- };
81
- }
82
- export type ProcessPromptResult = {
83
- type: "success" | "clarification" | "confirmation";
84
- data: QueueResult[] | {
85
- validationErrors: string[];
86
- prompt: string;
87
- } | {
88
- actions: QueueItem[];
89
- };
90
- initialPrompt: string;
91
- };
92
- export interface ActionPattern {
93
- id: string;
94
- actions: QueueResult[];
95
- embeddings: number[][];
96
- queries: string[];
97
- purpose: string;
98
- }
99
- export interface MatchOptions {
100
- similarityThreshold?: number;
101
- maxResults?: number;
102
- }
103
- export interface MatchResult {
104
- data: any;
105
- similarityPercentage: number;
106
- purpose: string;
107
- name?: string;
108
- parameters?: Record<string, any>;
109
- }
110
- export interface SummarizerAgent {
111
- process: (results: object, onFinish?: (event: any) => void) => Promise<{
112
- actions: {
113
- name: string;
114
- reasoning: string;
115
- }[];
116
- response: string;
117
- } | StreamTextResult<Record<string, any>>>;
118
- streamProcess: (results: object, onFinish?: (event: any) => void) => Promise<StreamTextResult<Record<string, any>>>;
119
- }
120
- export interface CacheMemoryOptions {
121
- embeddingModel: EmbeddingModel<string>;
122
- cacheTTL?: number;
123
- redisUrl?: string;
124
- cachePrefix?: string;
125
- }
126
- export type GenerateObjectResponse = {
127
- shouldContinue: boolean;
128
- actions: Array<{
129
- name: string;
130
- parameters: Array<{
131
- name: string;
132
- value: any;
133
- }>;
134
- scheduler?: {
135
- isScheduled: boolean;
136
- cronExpression: string;
137
- reason?: string;
138
- };
139
- }>;
140
- socialResponse?: {
141
- shouldRespond: boolean;
142
- response?: string;
143
- isPartialResponse?: boolean;
144
- };
145
- interpreter?: string;
146
- };
147
- export interface CreateMemoryInput {
148
- query: string;
149
- data: any;
150
- userId?: string;
151
- scope?: MemoryScope;
152
- ttl?: number;
153
- }
154
- export interface CacheMemoryType {
155
- id: string;
156
- data: any;
157
- query: string;
158
- embedding: Embedding;
159
- userId?: string;
160
- scope: MemoryScope;
161
- createdAt: Date;
162
- }
163
- export interface PersistentMemoryOptions {
164
- host: string;
165
- apiKey: string;
166
- indexPrefix?: string;
167
- }
168
- export interface MemoryChunk {
169
- content: string;
170
- embedding: number[];
171
- }
172
- export type MemoryScopeType = (typeof MemoryScope)[keyof typeof MemoryScope];
173
- export interface LongTermMemory {
174
- id: string;
175
- query: string;
176
- category: string;
177
- data: any;
178
- roomId: string;
179
- createdAt: Date;
180
- chunks?: MemoryChunk[];
181
- tags: string[];
182
- }
183
- export declare const ActionSchema: z.ZodArray<z.ZodObject<{
184
- name: z.ZodString;
185
- parameters: z.ZodArray<z.ZodObject<{
186
- name: z.ZodString;
187
- value: z.ZodString;
188
- }, "strip", z.ZodTypeAny, {
189
- value: string;
190
- name: string;
191
- }, {
192
- value: string;
193
- name: string;
194
- }>, "many">;
195
- }, "strip", z.ZodTypeAny, {
196
- name: string;
197
- parameters: {
198
- value: string;
199
- name: string;
200
- }[];
201
- }, {
202
- name: string;
203
- parameters: {
204
- value: string;
205
- name: string;
206
- }[];
207
- }>, "many">;
208
- export declare enum MemoryType {
209
- ACTION = "action",
210
- CONVERSATION = "conversation",
211
- KNOWLEDGE = "knowledge"
212
- }
213
- export declare enum MemoryScope {
214
- GLOBAL = "global",
215
- USER = "user"
216
- }
217
- export interface ActionData {
218
- name?: string;
219
- parameters?: Record<string, any>;
220
- }
221
- export interface QueueItemParameter {
222
- name: string;
223
- value: string;
224
- }
225
- export interface TransformedQueueItem {
226
- name: string;
227
- parameters: QueueItemParameter[];
228
- }
229
- export interface ScheduledAction {
230
- id: string;
231
- action: {
232
- name: string;
233
- parameters: QueueItemParameter[];
234
- };
235
- scheduledTime: Date;
236
- userId: string;
237
- status: "pending" | "completed" | "failed";
238
- recurrence?: {
239
- type: "daily" | "weekly" | "monthly";
240
- interval: number;
241
- };
242
- }
243
- export interface ScheduledActionEvents {
244
- onActionStart?: (action: ScheduledAction) => void;
245
- onActionComplete?: (action: ScheduledAction, result: any) => void;
246
- onActionFailed?: (action: ScheduledAction, error: Error) => void;
247
- onActionScheduled?: (action: ScheduledAction) => void;
248
- onActionCancelled?: (actionId: string) => void;
249
- }
250
- export interface WorkflowPattern {
251
- query: string;
252
- actions: Array<{
253
- done: boolean;
254
- name: string;
255
- result: string;
256
- }>;
257
- success: boolean;
258
- }