@ai.ntellect/core 0.7.7 → 1.0.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 (111) hide show
  1. package/README.md +158 -81
  2. package/index.ts +462 -22
  3. package/package copy.json +21 -0
  4. package/package.json +9 -44
  5. package/tsconfig.json +108 -22
  6. package/types.ts +62 -0
  7. package/utils/executor.ts +42 -0
  8. package/.mocharc.json +0 -5
  9. package/dist/graph/controller.d.ts +0 -31
  10. package/dist/graph/controller.d.ts.map +0 -1
  11. package/dist/graph/controller.js +0 -71
  12. package/dist/graph/controller.js.map +0 -1
  13. package/dist/graph/event-manager.d.ts +0 -92
  14. package/dist/graph/event-manager.d.ts.map +0 -1
  15. package/dist/graph/event-manager.js +0 -244
  16. package/dist/graph/event-manager.js.map +0 -1
  17. package/dist/graph/index.d.ts +0 -159
  18. package/dist/graph/index.d.ts.map +0 -1
  19. package/dist/graph/index.js +0 -303
  20. package/dist/graph/index.js.map +0 -1
  21. package/dist/graph/logger.d.ts +0 -46
  22. package/dist/graph/logger.d.ts.map +0 -1
  23. package/dist/graph/logger.js +0 -69
  24. package/dist/graph/logger.js.map +0 -1
  25. package/dist/graph/node.d.ts +0 -92
  26. package/dist/graph/node.d.ts.map +0 -1
  27. package/dist/graph/node.js +0 -249
  28. package/dist/graph/node.js.map +0 -1
  29. package/dist/graph/observer.d.ts +0 -113
  30. package/dist/graph/observer.d.ts.map +0 -1
  31. package/dist/graph/observer.js +0 -198
  32. package/dist/graph/observer.js.map +0 -1
  33. package/dist/index.d.ts +0 -26
  34. package/dist/index.d.ts.map +0 -1
  35. package/dist/index.js +0 -42
  36. package/dist/index.js.map +0 -1
  37. package/dist/interfaces/index.d.ts +0 -447
  38. package/dist/interfaces/index.d.ts.map +0 -1
  39. package/dist/interfaces/index.js +0 -75
  40. package/dist/interfaces/index.js.map +0 -1
  41. package/dist/modules/agenda/adapters/node-cron/index.d.ts +0 -17
  42. package/dist/modules/agenda/adapters/node-cron/index.d.ts.map +0 -1
  43. package/dist/modules/agenda/adapters/node-cron/index.js +0 -30
  44. package/dist/modules/agenda/adapters/node-cron/index.js.map +0 -1
  45. package/dist/modules/agenda/index.d.ts +0 -63
  46. package/dist/modules/agenda/index.d.ts.map +0 -1
  47. package/dist/modules/agenda/index.js +0 -141
  48. package/dist/modules/agenda/index.js.map +0 -1
  49. package/dist/modules/embedding/adapters/ai/index.d.ts +0 -29
  50. package/dist/modules/embedding/adapters/ai/index.d.ts.map +0 -1
  51. package/dist/modules/embedding/adapters/ai/index.js +0 -58
  52. package/dist/modules/embedding/adapters/ai/index.js.map +0 -1
  53. package/dist/modules/embedding/index.d.ts +0 -36
  54. package/dist/modules/embedding/index.d.ts.map +0 -1
  55. package/dist/modules/embedding/index.js +0 -60
  56. package/dist/modules/embedding/index.js.map +0 -1
  57. package/dist/modules/memory/adapters/in-memory/index.d.ts +0 -120
  58. package/dist/modules/memory/adapters/in-memory/index.d.ts.map +0 -1
  59. package/dist/modules/memory/adapters/in-memory/index.js +0 -211
  60. package/dist/modules/memory/adapters/in-memory/index.js.map +0 -1
  61. package/dist/modules/memory/adapters/meilisearch/index.d.ts +0 -110
  62. package/dist/modules/memory/adapters/meilisearch/index.d.ts.map +0 -1
  63. package/dist/modules/memory/adapters/meilisearch/index.js +0 -321
  64. package/dist/modules/memory/adapters/meilisearch/index.js.map +0 -1
  65. package/dist/modules/memory/adapters/redis/index.d.ts +0 -82
  66. package/dist/modules/memory/adapters/redis/index.d.ts.map +0 -1
  67. package/dist/modules/memory/adapters/redis/index.js +0 -159
  68. package/dist/modules/memory/adapters/redis/index.js.map +0 -1
  69. package/dist/modules/memory/index.d.ts +0 -67
  70. package/dist/modules/memory/index.d.ts.map +0 -1
  71. package/dist/modules/memory/index.js +0 -104
  72. package/dist/modules/memory/index.js.map +0 -1
  73. package/dist/types/index.d.ts +0 -166
  74. package/dist/types/index.d.ts.map +0 -1
  75. package/dist/types/index.js +0 -3
  76. package/dist/types/index.js.map +0 -1
  77. package/dist/utils/generate-action-schema.d.ts +0 -5
  78. package/dist/utils/generate-action-schema.d.ts.map +0 -1
  79. package/dist/utils/generate-action-schema.js +0 -44
  80. package/dist/utils/generate-action-schema.js.map +0 -1
  81. package/dist/utils/header-builder.d.ts +0 -12
  82. package/dist/utils/header-builder.d.ts.map +0 -1
  83. package/dist/utils/header-builder.js +0 -35
  84. package/dist/utils/header-builder.js.map +0 -1
  85. package/graph/controller.ts +0 -74
  86. package/graph/event-manager.ts +0 -295
  87. package/graph/index.ts +0 -397
  88. package/graph/logger.ts +0 -70
  89. package/graph/node.ts +0 -305
  90. package/graph/observer.ts +0 -368
  91. package/interfaces/index.ts +0 -545
  92. package/modules/agenda/adapters/node-cron/index.ts +0 -25
  93. package/modules/agenda/index.ts +0 -146
  94. package/modules/embedding/adapters/ai/index.ts +0 -42
  95. package/modules/embedding/index.ts +0 -45
  96. package/modules/memory/adapters/in-memory/index.ts +0 -207
  97. package/modules/memory/adapters/meilisearch/index.ts +0 -361
  98. package/modules/memory/adapters/redis/index.ts +0 -164
  99. package/modules/memory/index.ts +0 -93
  100. package/test/graph/controller.test.ts +0 -187
  101. package/test/graph/event-manager.test.ts +0 -72
  102. package/test/graph/index.test.ts +0 -768
  103. package/test/graph/node.test.ts +0 -510
  104. package/test/graph/observer.test.ts +0 -398
  105. package/test/modules/agenda/node-cron.test.ts +0 -307
  106. package/test/modules/memory/adapters/in-memory.test.ts +0 -153
  107. package/test/modules/memory/adapters/meilisearch.test.ts +0 -287
  108. package/test/modules/memory/base.test.ts +0 -230
  109. package/types/index.ts +0 -184
  110. package/utils/generate-action-schema.ts +0 -46
  111. package/utils/header-builder.ts +0 -40
@@ -1,82 +0,0 @@
1
- import { IMemoryAdapter } from "../../../../interfaces";
2
- import { BaseMemoryType, CreateMemoryInput } from "../../../../types";
3
- /**
4
- * @module RedisAdapter
5
- * @description Adapter implementation for Redis as a memory storage solution.
6
- * Provides integration with Redis for storing and retrieving memory entries with TTL support.
7
- * @implements {IMemoryAdapter}
8
- */
9
- export declare class RedisAdapter implements IMemoryAdapter {
10
- private readonly redisUrl;
11
- private redis;
12
- private readonly cachePrefix;
13
- private readonly cacheTTL;
14
- /**
15
- * Creates an instance of RedisAdapter
16
- * @param {string} redisUrl - Redis connection URL
17
- * @param {Object} options - Configuration options
18
- * @param {string} [options.cachePrefix="memory:"] - Prefix for Redis keys
19
- * @param {number} [options.cacheTTL=3600] - Default TTL in seconds
20
- */
21
- constructor(redisUrl: string, options: {
22
- cachePrefix?: string;
23
- cacheTTL?: number;
24
- });
25
- /**
26
- * Initializes the Redis connection
27
- * @param {string} roomId - Room identifier
28
- * @returns {Promise<void>}
29
- */
30
- init(roomId: string): Promise<void>;
31
- /**
32
- * Creates a new memory entry in Redis
33
- * @param {CreateMemoryInput & { embedding?: number[] }} input - Memory data with optional embedding
34
- * @returns {Promise<BaseMemoryType | undefined>} Created memory or undefined
35
- */
36
- createMemory(input: CreateMemoryInput & {
37
- embedding?: number[];
38
- }): Promise<BaseMemoryType | undefined>;
39
- /**
40
- * Retrieves a memory by ID and room ID from Redis
41
- * @param {string} id - Memory identifier
42
- * @param {string} roomId - Room identifier
43
- * @returns {Promise<BaseMemoryType | null>} Memory entry or null if not found
44
- */
45
- getMemoryById(id: string, roomId: string): Promise<BaseMemoryType | null>;
46
- /**
47
- * Searches for memories in Redis based on pattern matching
48
- * @param {string} query - Search query
49
- * @param {Object} options - Search options
50
- * @param {string} options.roomId - Room identifier
51
- * @param {number} [options.limit] - Maximum number of results
52
- * @returns {Promise<BaseMemoryType[]>} Array of matching memories
53
- */
54
- getMemoryByIndex(query: string, options: {
55
- roomId: string;
56
- limit?: number;
57
- }): Promise<BaseMemoryType[]>;
58
- /**
59
- * Retrieves all memories for a room from Redis
60
- * @param {string} roomId - Room identifier
61
- * @returns {Promise<BaseMemoryType[]>} Array of all memories
62
- */
63
- getAllMemories(roomId: string): Promise<BaseMemoryType[]>;
64
- /**
65
- * Deletes a specific memory from Redis
66
- * @param {string} id - Memory identifier
67
- * @param {string} roomId - Room identifier
68
- * @returns {Promise<void>}
69
- */
70
- clearMemoryById(id: string, roomId: string): Promise<void>;
71
- /**
72
- * Clears all memories across all rooms from Redis
73
- * @returns {Promise<void>}
74
- */
75
- clearAllMemories(): Promise<void>;
76
- /**
77
- * Closes the Redis connection
78
- * @returns {Promise<void>}
79
- */
80
- quit(): Promise<void>;
81
- }
82
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../modules/memory/adapters/redis/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,cAAc;IAa/C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZ3B,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC;;;;;;OAMG;gBAEgB,QAAQ,EAAE,MAAM,EACjC,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAaH;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzC;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE,iBAAiB,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAClD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAoBtC;;;;;OAKG;IACG,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAMjC;;;;;;;OAOG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAY5B;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAY/D;;;;;OAKG;IACG,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOvC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
@@ -1,159 +0,0 @@
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.RedisAdapter = void 0;
13
- const redis_1 = require("redis");
14
- /**
15
- * @module RedisAdapter
16
- * @description Adapter implementation for Redis as a memory storage solution.
17
- * Provides integration with Redis for storing and retrieving memory entries with TTL support.
18
- * @implements {IMemoryAdapter}
19
- */
20
- class RedisAdapter {
21
- /**
22
- * Creates an instance of RedisAdapter
23
- * @param {string} redisUrl - Redis connection URL
24
- * @param {Object} options - Configuration options
25
- * @param {string} [options.cachePrefix="memory:"] - Prefix for Redis keys
26
- * @param {number} [options.cacheTTL=3600] - Default TTL in seconds
27
- */
28
- constructor(redisUrl, options) {
29
- this.redisUrl = redisUrl;
30
- this.cachePrefix = options.cachePrefix || "memory:";
31
- this.cacheTTL = options.cacheTTL || 3600;
32
- this.redis = (0, redis_1.createClient)({
33
- url: redisUrl,
34
- socket: {
35
- tls: true,
36
- rejectUnauthorized: true,
37
- },
38
- });
39
- }
40
- /**
41
- * Initializes the Redis connection
42
- * @param {string} roomId - Room identifier
43
- * @returns {Promise<void>}
44
- */
45
- init(roomId) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- this.redis.on("error", (err) => console.error("Redis Client Error:", err));
48
- yield this.redis.connect();
49
- });
50
- }
51
- /**
52
- * Creates a new memory entry in Redis
53
- * @param {CreateMemoryInput & { embedding?: number[] }} input - Memory data with optional embedding
54
- * @returns {Promise<BaseMemoryType | undefined>} Created memory or undefined
55
- */
56
- createMemory(input) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const memory = {
59
- id: input.id || crypto.randomUUID(),
60
- data: input.data,
61
- embedding: input.embedding,
62
- roomId: input.roomId,
63
- createdAt: new Date(),
64
- };
65
- const key = memory.roomId
66
- ? `${this.cachePrefix}${memory.roomId}:${memory.id}`
67
- : `${this.cachePrefix}${memory.id}`;
68
- yield this.redis.set(key, JSON.stringify(memory), {
69
- EX: this.cacheTTL,
70
- });
71
- return memory;
72
- });
73
- }
74
- /**
75
- * Retrieves a memory by ID and room ID from Redis
76
- * @param {string} id - Memory identifier
77
- * @param {string} roomId - Room identifier
78
- * @returns {Promise<BaseMemoryType | null>} Memory entry or null if not found
79
- */
80
- getMemoryById(id, roomId) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const key = `${this.cachePrefix}${roomId}:${id}`;
83
- const data = yield this.redis.get(key);
84
- return data ? JSON.parse(data) : null;
85
- });
86
- }
87
- /**
88
- * Searches for memories in Redis based on pattern matching
89
- * @param {string} query - Search query
90
- * @param {Object} options - Search options
91
- * @param {string} options.roomId - Room identifier
92
- * @param {number} [options.limit] - Maximum number of results
93
- * @returns {Promise<BaseMemoryType[]>} Array of matching memories
94
- */
95
- getMemoryByIndex(query, options) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- const pattern = `${this.cachePrefix}${options.roomId}:*`;
98
- const keys = yield this.redis.keys(pattern);
99
- const memories = yield Promise.all(keys.map((key) => __awaiter(this, void 0, void 0, function* () {
100
- const data = yield this.redis.get(key);
101
- return data ? JSON.parse(data) : null;
102
- })));
103
- return memories.filter(Boolean).slice(0, options.limit || 10);
104
- });
105
- }
106
- /**
107
- * Retrieves all memories for a room from Redis
108
- * @param {string} roomId - Room identifier
109
- * @returns {Promise<BaseMemoryType[]>} Array of all memories
110
- */
111
- getAllMemories(roomId) {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const pattern = `${this.cachePrefix}${roomId}:*`;
114
- const keys = yield this.redis.keys(pattern);
115
- const memories = yield Promise.all(keys.map((key) => __awaiter(this, void 0, void 0, function* () {
116
- const data = yield this.redis.get(key);
117
- return data ? JSON.parse(data) : null;
118
- })));
119
- return memories.filter(Boolean);
120
- });
121
- }
122
- /**
123
- * Deletes a specific memory from Redis
124
- * @param {string} id - Memory identifier
125
- * @param {string} roomId - Room identifier
126
- * @returns {Promise<void>}
127
- */
128
- clearMemoryById(id, roomId) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const key = `${this.cachePrefix}${roomId}:${id}`;
131
- yield this.redis.del(key);
132
- });
133
- }
134
- /**
135
- * Clears all memories across all rooms from Redis
136
- * @returns {Promise<void>}
137
- */
138
- clearAllMemories() {
139
- return __awaiter(this, void 0, void 0, function* () {
140
- const keys = yield this.redis.keys(`${this.cachePrefix}*`);
141
- if (keys.length > 0) {
142
- yield this.redis.del(keys);
143
- }
144
- });
145
- }
146
- /**
147
- * Closes the Redis connection
148
- * @returns {Promise<void>}
149
- */
150
- quit() {
151
- return __awaiter(this, void 0, void 0, function* () {
152
- if (this.redis) {
153
- yield this.redis.quit();
154
- }
155
- });
156
- }
157
- }
158
- exports.RedisAdapter = RedisAdapter;
159
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/memory/adapters/redis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAqC;AAIrC;;;;;GAKG;AACH,MAAa,YAAY;IAKvB;;;;;;OAMG;IACH,YACmB,QAAgB,EACjC,OAGC;QAJgB,aAAQ,GAAR,QAAQ,CAAQ;QAMjC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,SAAS,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,IAAA,oBAAY,EAAC;YACxB,GAAG,EAAE,QAAQ;YACb,MAAM,EAAE;gBACN,GAAG,EAAE,IAAI;gBACT,kBAAkB,EAAE,IAAI;aACzB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACG,IAAI,CAAC,MAAc;;YACvB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3E,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED;;;;OAIG;IACG,YAAY,CAChB,KAAmD;;YAEnD,MAAM,MAAM,GAAmB;gBAC7B,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE;gBACnC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,SAAS,EAAE,IAAI,IAAI,EAAE;aACtB,CAAC;YAEF,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM;gBACvB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,MAA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G;IACG,IAAI;;YACR,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC1B,CAAC;QACH,CAAC;KAAA;CACF;AAzJD,oCAyJC"}
@@ -1,67 +0,0 @@
1
- import { BaseMemory, IMemoryAdapter } from "../../interfaces";
2
- import { BaseMemoryType, CreateMemoryInput } from "../../types";
3
- /**
4
- * @module Memory
5
- * @description A module for managing memory storage and retrieval operations.
6
- * Implements the BaseMemory abstract class and provides concrete implementations
7
- * for memory-related operations using the provided adapter.
8
- * @extends {BaseMemory}
9
- */
10
- export declare class Memory extends BaseMemory {
11
- /**
12
- * Creates an instance of Memory
13
- * @param {IMemoryAdapter} adapter - The memory adapter implementation to use
14
- */
15
- constructor(adapter: IMemoryAdapter);
16
- /**
17
- * Initializes the memory module with default room
18
- * @returns {Promise<void>}
19
- */
20
- init(): Promise<void>;
21
- /**
22
- * Creates a new memory entry
23
- * @param {CreateMemoryInput & { embedding?: number[] }} input - Memory data with optional embedding
24
- * @returns {Promise<BaseMemoryType | undefined>} Created memory or undefined
25
- */
26
- createMemory(input: CreateMemoryInput & {
27
- embedding?: number[];
28
- }): Promise<BaseMemoryType | undefined>;
29
- /**
30
- * Retrieves a memory by ID and room ID
31
- * @param {string} id - Memory identifier
32
- * @param {string} roomId - Room identifier
33
- * @returns {Promise<BaseMemoryType | null>} Memory entry or null if not found
34
- */
35
- getMemoryById(id: string, roomId: string): Promise<BaseMemoryType | null>;
36
- /**
37
- * Searches for memories based on query and options
38
- * @param {string} query - Search query
39
- * @param {Object} options - Search options
40
- * @param {string} options.roomId - Room identifier
41
- * @param {number} [options.limit] - Maximum number of results to return
42
- * @returns {Promise<BaseMemoryType[]>} Array of matching memories
43
- */
44
- getMemoryByIndex(query: string, options: {
45
- roomId: string;
46
- limit?: number;
47
- }): Promise<BaseMemoryType[]>;
48
- /**
49
- * Retrieves all memories for a specific room
50
- * @param {string} roomId - Room identifier
51
- * @returns {Promise<BaseMemoryType[]>} Array of all memories in the room
52
- */
53
- getAllMemories(roomId: string): Promise<BaseMemoryType[]>;
54
- /**
55
- * Deletes a specific memory
56
- * @param {string} id - Memory identifier
57
- * @param {string} roomId - Room identifier
58
- * @returns {Promise<void>}
59
- */
60
- clearMemoryById(id: string, roomId: string): Promise<void>;
61
- /**
62
- * Clears all memories across all rooms
63
- * @returns {Promise<void>}
64
- */
65
- clearAllMemories(): Promise<void>;
66
- }
67
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhE;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,UAAU;IACpC;;;OAGG;gBACS,OAAO,EAAE,cAAc;IAInC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE,iBAAiB,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAClD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAItC;;;;;OAKG;IACG,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAIjC;;;;;;;OAOG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAI5B;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAI/D;;;;;OAKG;IACG,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}
@@ -1,104 +0,0 @@
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.Memory = void 0;
13
- const interfaces_1 = require("../../interfaces");
14
- /**
15
- * @module Memory
16
- * @description A module for managing memory storage and retrieval operations.
17
- * Implements the BaseMemory abstract class and provides concrete implementations
18
- * for memory-related operations using the provided adapter.
19
- * @extends {BaseMemory}
20
- */
21
- class Memory extends interfaces_1.BaseMemory {
22
- /**
23
- * Creates an instance of Memory
24
- * @param {IMemoryAdapter} adapter - The memory adapter implementation to use
25
- */
26
- constructor(adapter) {
27
- super(adapter);
28
- }
29
- /**
30
- * Initializes the memory module with default room
31
- * @returns {Promise<void>}
32
- */
33
- init() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- yield this.adapter.init("default");
36
- });
37
- }
38
- /**
39
- * Creates a new memory entry
40
- * @param {CreateMemoryInput & { embedding?: number[] }} input - Memory data with optional embedding
41
- * @returns {Promise<BaseMemoryType | undefined>} Created memory or undefined
42
- */
43
- createMemory(input) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- return this.adapter.createMemory(input);
46
- });
47
- }
48
- /**
49
- * Retrieves a memory by ID and room ID
50
- * @param {string} id - Memory identifier
51
- * @param {string} roomId - Room identifier
52
- * @returns {Promise<BaseMemoryType | null>} Memory entry or null if not found
53
- */
54
- getMemoryById(id, roomId) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- return this.adapter.getMemoryById(id, roomId);
57
- });
58
- }
59
- /**
60
- * Searches for memories based on query and options
61
- * @param {string} query - Search query
62
- * @param {Object} options - Search options
63
- * @param {string} options.roomId - Room identifier
64
- * @param {number} [options.limit] - Maximum number of results to return
65
- * @returns {Promise<BaseMemoryType[]>} Array of matching memories
66
- */
67
- getMemoryByIndex(query, options) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- return this.adapter.getMemoryByIndex(query, options);
70
- });
71
- }
72
- /**
73
- * Retrieves all memories for a specific room
74
- * @param {string} roomId - Room identifier
75
- * @returns {Promise<BaseMemoryType[]>} Array of all memories in the room
76
- */
77
- getAllMemories(roomId) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- return this.adapter.getAllMemories(roomId);
80
- });
81
- }
82
- /**
83
- * Deletes a specific memory
84
- * @param {string} id - Memory identifier
85
- * @param {string} roomId - Room identifier
86
- * @returns {Promise<void>}
87
- */
88
- clearMemoryById(id, roomId) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- yield this.adapter.clearMemoryById(id, roomId);
91
- });
92
- }
93
- /**
94
- * Clears all memories across all rooms
95
- * @returns {Promise<void>}
96
- */
97
- clearAllMemories() {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- yield this.adapter.clearAllMemories();
100
- });
101
- }
102
- }
103
- exports.Memory = Memory;
104
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../modules/memory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8D;AAG9D;;;;;;GAMG;AACH,MAAa,MAAO,SAAQ,uBAAU;IACpC;;;OAGG;IACH,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED;;;OAGG;IACG,IAAI;;YACR,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;KAAA;IAED;;;;OAIG;IACG,YAAY,CAChB,KAAmD;;YAEnD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;KAAA;IAED;;;;;OAKG;IACG,aAAa,CACjB,EAAU,EACV,MAAc;;YAEd,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,gBAAgB,CACpB,KAAa,EACb,OAA2C;;YAE3C,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;KAAA;IAED;;;;OAIG;IACG,cAAc,CAAC,MAAc;;YACjC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC;KAAA;IAED;;;;;OAKG;IACG,eAAe,CAAC,EAAU,EAAE,MAAc;;YAC9C,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;KAAA;IAED;;;OAGG;IACG,gBAAgB;;YACpB,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACxC,CAAC;KAAA;CACF;AAlFD,wBAkFC"}
@@ -1,166 +0,0 @@
1
- import { EventEmitter } from "events";
2
- import { ZodSchema } from "zod";
3
- import { IEventEmitter } from "../interfaces";
4
- /**
5
- * Represents the input structure for creating a memory entry.
6
- * @typedef {Object} CreateMemoryInput
7
- * @property {string} query - The query associated with the memory.
8
- * @property {any} data - The data to be stored.
9
- * @property {string} roomId - The room identifier.
10
- * @property {number} [ttl] - Time-to-live in seconds (optional).
11
- */
12
- export interface CreateMemoryInput {
13
- id?: string;
14
- data: string;
15
- embedding?: number[];
16
- roomId: string;
17
- ttl?: number;
18
- }
19
- /**
20
- * Represents a stored memory entry.
21
- * @typedef {Object} BaseMemoryType
22
- * @property {string} id - Unique identifier of the memory entry.
23
- * @property {string} data - Stored data as a string.
24
- * @property {string} query - The associated query.
25
- * @property {number[] | null} embedding - Vector representation of the data.
26
- * @property {string} roomId - The associated room ID.
27
- * @property {Date} createdAt - Creation date.
28
- */
29
- export interface BaseMemoryType {
30
- id: string;
31
- data: string;
32
- embedding?: number[];
33
- roomId: string;
34
- createdAt: Date;
35
- }
36
- /**
37
- * Type for scheduled request entries
38
- * @typedef {Object} ScheduledRequest
39
- */
40
- export type ScheduledRequest = {
41
- /** Unique identifier for the scheduled request */
42
- id: string;
43
- /** The original request string */
44
- originalRequest: string;
45
- /** The cron expression for scheduling */
46
- cronExpression: string;
47
- /** Whether the request is recurring */
48
- isRecurring: boolean;
49
- /** The creation date */
50
- createdAt: Date;
51
- };
52
- /**
53
- * Utility type for extracting schema type from Zod schema
54
- * @template T - Zod schema type
55
- */
56
- export type SchemaType<T> = T extends ZodSchema<infer U> ? U : never;
57
- /**
58
- * Type for graph context based on schema
59
- * @template T - Schema type
60
- */
61
- export type GraphContext<T> = SchemaType<T>;
62
- /**
63
- * Interface representing a node in the graph
64
- * @interface
65
- * @template T - Schema type
66
- * @template I - Input schema type
67
- * @template O - Output schema type
68
- */
69
- export interface Node<T extends ZodSchema, I = any> {
70
- /** Name of the node */
71
- name: string;
72
- /** Description of the node */
73
- description?: string;
74
- /** Schema for node inputs */
75
- params?: I extends void ? never : ZodSchema<I>;
76
- /** Execute function for the node */
77
- execute: (context: GraphContext<T>, params?: I) => Promise<void>;
78
- /** Optional condition for node execution */
79
- condition?: (context: GraphContext<T>, params?: I) => boolean;
80
- /** Array of next node names */
81
- next?: string[] | ((context: GraphContext<T>) => string[]);
82
- /** Array of event names that trigger this node */
83
- events?: string[];
84
- /** Wait for a single event before continuing */
85
- waitForEvent?: boolean;
86
- /** Wait for multiple events configuration */
87
- waitForEvents?: WaitForEvents;
88
- /** Event correlation configuration */
89
- correlateEvents?: {
90
- events: string[];
91
- correlation: (events: GraphEvent<T>[]) => boolean;
92
- timeout?: number;
93
- };
94
- /** Retry configuration */
95
- retry?: {
96
- /** Maximum number of retry attempts */
97
- maxAttempts: number;
98
- /** Delay between retries in milliseconds */
99
- delay: number;
100
- /** Error handler function */
101
- onRetryFailed?: (error: Error, context: GraphContext<T>) => Promise<void>;
102
- /** Continue execution on failed retry */
103
- continueOnFailed?: boolean;
104
- };
105
- /** Error handler function */
106
- onError?: (error: Error) => void;
107
- }
108
- /**
109
- * Interface for graph definition
110
- * @interface
111
- * @template T - Schema type
112
- */
113
- export interface GraphDefinition<T extends ZodSchema> {
114
- /** Name of the graph */
115
- name: string;
116
- /** Array of nodes in the graph */
117
- nodes: Node<T, any>[];
118
- /** Initial context */
119
- context: SchemaType<T>;
120
- /** Schema for validation */
121
- schema: T;
122
- /** Global error handler */
123
- onError?: (error: Error, context: GraphContext<T>) => void;
124
- /** Entry node name */
125
- entryNode?: string;
126
- /** Event emitter instance */
127
- eventEmitter?: IEventEmitter | EventEmitter;
128
- /** Array of events */
129
- events?: string[];
130
- }
131
- /**
132
- * Configuration type for Meilisearch
133
- * @typedef {Object} MeilisearchConfig
134
- */
135
- export type MeilisearchConfig = {
136
- /** Meilisearch host URL */
137
- host: string;
138
- /** API key for authentication */
139
- apiKey: string;
140
- /** Array of searchable attributes */
141
- searchableAttributes?: string[];
142
- /** Array of sortable attributes */
143
- sortableAttributes?: string[];
144
- };
145
- /**
146
- * Settings type for Meilisearch
147
- * @typedef {Object} MeilisearchSettings
148
- */
149
- export type MeilisearchSettings = {
150
- /** Array of searchable attributes */
151
- searchableAttributes?: string[];
152
- /** Array of sortable attributes */
153
- sortableAttributes?: string[];
154
- };
155
- export interface GraphEvent<T extends ZodSchema> {
156
- type: string;
157
- payload?: any;
158
- timestamp: number;
159
- }
160
- export interface WaitForEvents {
161
- events: string[];
162
- timeout?: number;
163
- strategy: "all" | "any" | "race";
164
- onSuccess?: <T extends ZodSchema>(context: GraphContext<T>) => Promise<void>;
165
- }
166
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;CACjB;AAID;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,wBAAwB;IACxB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAIF;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CA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,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,mCAAmC;IACnC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,SAAS;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { z } from "zod";
2
- import { GraphFlow } from "../graph/index";
3
- export declare const generateActionSchema: (graphs: GraphFlow<any>[]) => string;
4
- export declare const getSchemaString: (schema: z.ZodType) => string;
5
- //# sourceMappingURL=generate-action-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-action-schema.d.ts","sourceRoot":"","sources":["../../utils/generate-action-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,oBAAoB,WAAY,SAAS,CAAC,GAAG,CAAC,EAAE,WAU5D,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,CAAC,CAAC,OAAO,KAAG,MA8BnD,CAAC"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSchemaString = exports.generateActionSchema = void 0;
4
- const zod_1 = require("zod");
5
- const generateActionSchema = (graphs) => {
6
- return graphs
7
- .map((graph) => {
8
- const rootNode = Array.from(graph.nodes.values())[0];
9
- const schemaStr = rootNode.params
10
- ? (0, exports.getSchemaString)(rootNode.params)
11
- : "No parameters";
12
- return `Workflow: ${graph.name}\nParameters: ${schemaStr}`;
13
- })
14
- .join("\n\n");
15
- };
16
- exports.generateActionSchema = generateActionSchema;
17
- const getSchemaString = (schema) => {
18
- if (schema instanceof zod_1.z.ZodObject) {
19
- const entries = Object.entries(schema.shape);
20
- const fields = entries.map(([key, value]) => {
21
- const description = value._def.description;
22
- const schemaStr = (0, exports.getSchemaString)(value);
23
- return description
24
- ? `${key}: ${schemaStr} // ${description}`
25
- : `${key}: ${schemaStr}`;
26
- });
27
- return `z.object({${fields.join(", ")}})`;
28
- }
29
- if (schema instanceof zod_1.z.ZodArray) {
30
- return `z.array(${(0, exports.getSchemaString)(schema.element)})`;
31
- }
32
- if (schema instanceof zod_1.z.ZodString) {
33
- return "z.string()";
34
- }
35
- if (schema instanceof zod_1.z.ZodNumber) {
36
- return "z.number()";
37
- }
38
- if (schema instanceof zod_1.z.ZodBoolean) {
39
- return "z.boolean()";
40
- }
41
- return `z.unknown()`;
42
- };
43
- exports.getSchemaString = getSchemaString;
44
- //# sourceMappingURL=generate-action-schema.js.map