mengram-ai 2.14.0 → 2.14.2

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 (3) hide show
  1. package/index.d.ts +13 -9
  2. package/index.js +55 -4
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -167,11 +167,12 @@ export declare class MengramClient {
167
167
  addText(text: string, options?: MemoryOptions): Promise<AddResult>;
168
168
  search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
169
169
  getAll(options?: MemoryOptions): Promise<Entity[]>;
170
- getAllFull(): Promise<Entity[]>;
171
- get(name: string): Promise<Entity | null>;
172
- delete(name: string): Promise<boolean>;
173
- stats(): Promise<Stats>;
174
- graph(): Promise<{ nodes: any[]; edges: any[] }>;
170
+ getAllFull(options?: { userId?: string }): Promise<Entity[]>;
171
+ get(name: string, options?: { userId?: string }): Promise<Entity | null>;
172
+ delete(name: string, options?: { userId?: string }): Promise<boolean>;
173
+ fixEntityType(name: string, newType: string, options?: { userId?: string }): Promise<{status: string}>;
174
+ stats(options?: { userId?: string }): Promise<Stats>;
175
+ graph(options?: { userId?: string }): Promise<{ nodes: any[]; edges: any[] }>;
175
176
  getProfile(userId?: string, options?: { force?: boolean }): Promise<CognitiveProfile>;
176
177
  timeline(options?: { after?: string; before?: string; limit?: number }): Promise<any[]>;
177
178
 
@@ -181,8 +182,8 @@ export declare class MengramClient {
181
182
  // Procedural Memory
182
183
  procedures(options?: { query?: string; limit?: number }): Promise<Procedure[]>;
183
184
  procedureFeedback(procedureId: string, options?: { success?: boolean; context?: string; failedAtStep?: number }): Promise<FeedbackResult>;
184
- procedureHistory(procedureId: string): Promise<ProcedureHistoryResult>;
185
- procedureEvolution(procedureId: string): Promise<{ evolution: ProcedureEvolutionEntry[] }>;
185
+ procedureHistory(procedureId: string, options?: { userId?: string }): Promise<ProcedureHistoryResult>;
186
+ procedureEvolution(procedureId: string, options?: { userId?: string }): Promise<{ evolution: ProcedureEvolutionEntry[] }>;
186
187
 
187
188
  // Unified Search
188
189
  searchAll(query: string, options?: { limit?: number }): Promise<UnifiedSearchResult>;
@@ -193,8 +194,8 @@ export declare class MengramClient {
193
194
  agentStatus(options?: { userId?: string }): Promise<any>;
194
195
 
195
196
  // Insights
196
- insights(): Promise<any>;
197
- reflect(): Promise<any>;
197
+ insights(options?: { userId?: string }): Promise<any>;
198
+ reflect(options?: { userId?: string }): Promise<any>;
198
199
  reflections(options?: { scope?: string; userId?: string }): Promise<any[]>;
199
200
 
200
201
  // Webhooks
@@ -217,13 +218,16 @@ export declare class MengramClient {
217
218
  listKeys(): Promise<ApiKey[]>;
218
219
  createKey(name?: string): Promise<{ key: string; name: string }>;
219
220
  revokeKey(keyId: string): Promise<any>;
221
+ renameKey(keyId: string, name: string): Promise<ApiKey>;
220
222
 
221
223
  // Memory Management
222
224
  reindex(options?: { userId?: string }): Promise<any>;
223
225
  dedup(options?: { userId?: string }): Promise<any>;
224
226
  dedupAll(options?: { userId?: string }): Promise<any>;
227
+ dedupEntity(name: string, options?: { userId?: string }): Promise<{status: string, entity: string, merged: number}>;
225
228
  archiveFact(entityName: string, factContent: string, options?: { userId?: string }): Promise<any>;
226
229
  merge(sourceName: string, targetName: string, options?: { userId?: string }): Promise<any>;
230
+ mergeUser(options?: { userId?: string }): Promise<{status: string}>;
227
231
  feed(options?: { limit?: number; userId?: string }): Promise<any[]>;
228
232
 
229
233
  // Jobs
package/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * const { MengramClient } = require('mengram-ai');
6
6
  * // or: import { MengramClient } from 'mengram-ai';
7
7
  *
8
- * const m = new MengramClient('mg-...');
8
+ * const m = new MengramClient('om-...');
9
9
  *
10
10
  * await m.add([
11
11
  * { role: 'user', content: 'I prefer dark mode and use Vim.' },
@@ -17,7 +17,7 @@
17
17
 
18
18
  class MengramClient {
19
19
  /**
20
- * @param {string} apiKey - Your Mengram API key (mg-...)
20
+ * @param {string} apiKey - Your Mengram API key (om-...)
21
21
  * @param {object} [options]
22
22
  * @param {string} [options.baseUrl] - API base URL (default: https://mengram.io)
23
23
  * @param {number} [options.timeout] - Request timeout in ms (default: 30000)
@@ -198,6 +198,20 @@ class MengramClient {
198
198
  }
199
199
  }
200
200
 
201
+ /**
202
+ * Fix/change the type of an entity.
203
+ * @param {string} name - Entity name
204
+ * @param {string} newType - New entity type
205
+ * @param {object} [options]
206
+ * @param {string} [options.userId] - Sub-user ID
207
+ * @returns {Promise<{status: string}>}
208
+ */
209
+ async fixEntityType(name, newType, options = {}) {
210
+ const params = { new_type: newType };
211
+ if (options.userId && options.userId !== 'default') params.sub_user_id = options.userId;
212
+ return this._request('PATCH', `/v1/entity/${encodeURIComponent(name)}/type`, null, params);
213
+ }
214
+
201
215
  /**
202
216
  * Get usage statistics.
203
217
  * @returns {Promise<object>}
@@ -619,6 +633,16 @@ class MengramClient {
619
633
  return this._request('DELETE', `/v1/keys/${keyId}`);
620
634
  }
621
635
 
636
+ /**
637
+ * Rename an API key.
638
+ * @param {string} keyId - Key ID
639
+ * @param {string} name - New key name
640
+ * @returns {Promise<object>}
641
+ */
642
+ async renameKey(keyId, name) {
643
+ return this._request('PATCH', `/v1/keys/${keyId}`, { name });
644
+ }
645
+
622
646
  // ---- Memory Management ----
623
647
 
624
648
  /**
@@ -657,6 +681,19 @@ class MengramClient {
657
681
  return this._request('POST', '/v1/dedup_all', null, params);
658
682
  }
659
683
 
684
+ /**
685
+ * Deduplicate memories within a specific entity.
686
+ * @param {string} name - Entity name
687
+ * @param {object} [options]
688
+ * @param {string} [options.userId] - Sub-user ID
689
+ * @returns {Promise<{status: string, entity: string, merged: number}>}
690
+ */
691
+ async dedupEntity(name, options = {}) {
692
+ const params = {};
693
+ if (options.userId && options.userId !== 'default') params.sub_user_id = options.userId;
694
+ return this._request('POST', `/v1/entity/${encodeURIComponent(name)}/dedup`, null, params);
695
+ }
696
+
660
697
  /**
661
698
  * Archive a specific fact from an entity.
662
699
  * @param {string} entityName - Name of the entity
@@ -668,7 +705,7 @@ class MengramClient {
668
705
  async archiveFact(entityName, factContent, options = {}) {
669
706
  const params = {};
670
707
  if (options.userId && options.userId !== 'default') params.sub_user_id = options.userId;
671
- return this._request('POST', '/v1/archive_fact', { entity: entityName, fact: factContent }, params);
708
+ return this._request('POST', '/v1/archive_fact', { entity_name: entityName, fact_content: factContent }, params);
672
709
  }
673
710
 
674
711
  /**
@@ -682,7 +719,21 @@ class MengramClient {
682
719
  async merge(sourceName, targetName, options = {}) {
683
720
  const params = {};
684
721
  if (options.userId && options.userId !== 'default') params.sub_user_id = options.userId;
685
- return this._request('POST', '/v1/merge', { source: sourceName, target: targetName }, params);
722
+ params.source = sourceName;
723
+ params.target = targetName;
724
+ return this._request('POST', '/v1/merge', undefined, params);
725
+ }
726
+
727
+ /**
728
+ * Merge all duplicate entities for a user.
729
+ * @param {object} [options]
730
+ * @param {string} [options.userId] - Sub-user ID
731
+ * @returns {Promise<{status: string}>}
732
+ */
733
+ async mergeUser(options = {}) {
734
+ const params = {};
735
+ if (options.userId && options.userId !== 'default') params.sub_user_id = options.userId;
736
+ return this._request('POST', '/v1/merge_user', null, params);
686
737
  }
687
738
 
688
739
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mengram-ai",
3
- "version": "2.14.0",
3
+ "version": "2.14.2",
4
4
  "description": "Human-like memory for AI — semantic, episodic & procedural memory. Experience-driven procedures, Cognitive Profile, unified search, memory agents. Free Mem0 alternative.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",