mengram-ai 2.14.1 → 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 +6 -2
  2. package/index.js +53 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -170,6 +170,7 @@ export declare class MengramClient {
170
170
  getAllFull(options?: { userId?: string }): Promise<Entity[]>;
171
171
  get(name: string, options?: { userId?: string }): Promise<Entity | null>;
172
172
  delete(name: string, options?: { userId?: string }): Promise<boolean>;
173
+ fixEntityType(name: string, newType: string, options?: { userId?: string }): Promise<{status: string}>;
173
174
  stats(options?: { userId?: string }): Promise<Stats>;
174
175
  graph(options?: { userId?: string }): Promise<{ nodes: any[]; edges: any[] }>;
175
176
  getProfile(userId?: string, options?: { force?: boolean }): Promise<CognitiveProfile>;
@@ -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>;
@@ -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
@@ -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.1",
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",