@memnexus-ai/typescript-sdk 1.30.0 → 1.31.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.
package/dist/index.cjs CHANGED
@@ -62,6 +62,11 @@ __export(index_exports, {
62
62
  createNarrativeRequest: () => createNarrativeRequest,
63
63
  createPortalSessionRequest: () => createPortalSessionRequest,
64
64
  default: () => index_default,
65
+ digestMetadata: () => digestMetadata,
66
+ digestRequest: () => digestRequest,
67
+ digestResponse: () => digestResponse,
68
+ digestSource: () => digestSource,
69
+ digestTimeRange: () => digestTimeRange,
65
70
  entity: () => entity,
66
71
  entityNode: () => entityNode,
67
72
  error: () => error,
@@ -2424,6 +2429,46 @@ var MemoriesService = class extends BaseService {
2424
2429
  }
2425
2430
  return this.client.call(request);
2426
2431
  }
2432
+ /**
2433
+ * Generate memory digest
2434
+ * Synthesizes a comprehensive, structured briefing from all relevant memories
2435
+ on a topic. Instead of multiple search rounds, one call returns a complete digest.
2436
+
2437
+ **Formats:**
2438
+ - `structured` (default): Sections with headers, bullet points, key decisions
2439
+ - `narrative`: Chronological prose narrative
2440
+ - `timeline`: Dated event list
2441
+ - `status-report`: Done/In Progress/Blocked grouping
2442
+
2443
+ **Pipeline:**
2444
+ 1. Gather: High-limit search + conversation expansion
2445
+ 2. Organize: Group by conversation, status, timeline
2446
+ 3. Synthesize: LLM generates formatted digest
2447
+
2448
+ Requires an LLM provider to be configured (EXTRACTION_ENABLED=true).
2449
+ Returns 503 if the LLM provider is unavailable and 3+ memories are found.
2450
+
2451
+ * @param body - Request body
2452
+ */
2453
+ async generateMemoryDigest(body) {
2454
+ const request = new Request({
2455
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2456
+ method: "POST",
2457
+ path: "/api/memories/digest",
2458
+ config: this.config,
2459
+ retry: {
2460
+ attempts: 3,
2461
+ delayMs: 150,
2462
+ maxDelayMs: 5e3,
2463
+ jitterMs: 50,
2464
+ backoffFactor: 2
2465
+ }
2466
+ });
2467
+ if (body !== void 0) {
2468
+ request.addBody(body);
2469
+ }
2470
+ return this.client.call(request);
2471
+ }
2427
2472
  /**
2428
2473
  * Get version history for a named memory
2429
2474
  * Returns the full version chain for a named memory, ordered newest-first.
@@ -4180,6 +4225,56 @@ var UsersService = class extends BaseService {
4180
4225
  });
4181
4226
  return this.client.call(request);
4182
4227
  }
4228
+ /**
4229
+ * Initiate account deletion
4230
+ * Schedule the current user's account for deletion after a 7-day grace period.
4231
+ Requires email confirmation. Immediately revokes API keys and cancels
4232
+ any active subscription. The account enters read-only mode.
4233
+
4234
+ * @param body - Request body
4235
+ */
4236
+ async initiateAccountDeletion(body) {
4237
+ const request = new Request({
4238
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
4239
+ method: "POST",
4240
+ path: "/api/users/me/deletion",
4241
+ config: this.config,
4242
+ retry: {
4243
+ attempts: 3,
4244
+ delayMs: 150,
4245
+ maxDelayMs: 5e3,
4246
+ jitterMs: 50,
4247
+ backoffFactor: 2
4248
+ }
4249
+ });
4250
+ if (body !== void 0) {
4251
+ request.addBody(body);
4252
+ }
4253
+ return this.client.call(request);
4254
+ }
4255
+ /**
4256
+ * Cancel account deletion
4257
+ * Cancel a pending account deletion during the grace period.
4258
+ Note: Previously revoked API keys are not restored — new keys must be created.
4259
+ Stripe subscription may need manual reactivation via the billing portal.
4260
+
4261
+ */
4262
+ async cancelAccountDeletion() {
4263
+ const request = new Request({
4264
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
4265
+ method: "DELETE",
4266
+ path: "/api/users/me/deletion",
4267
+ config: this.config,
4268
+ retry: {
4269
+ attempts: 3,
4270
+ delayMs: 150,
4271
+ maxDelayMs: 5e3,
4272
+ jitterMs: 50,
4273
+ backoffFactor: 2
4274
+ }
4275
+ });
4276
+ return this.client.call(request);
4277
+ }
4183
4278
  /**
4184
4279
  * Get user by ID
4185
4280
  * Get a user by their internal ID (admin only)
@@ -5104,6 +5199,8 @@ var user = import_zod.z.object({
5104
5199
  plan: import_zod.z.enum(["free", "pro", "enterprise"]),
5105
5200
  memoryLimit: import_zod.z.number(),
5106
5201
  retentionDays: import_zod.z.number().nullable(),
5202
+ deletionStatus: import_zod.z.enum(["none", "pending_deletion", "deleting", "deleted"]),
5203
+ deletionScheduledFor: import_zod.z.string().datetime().nullable(),
5107
5204
  createdAt: import_zod.z.string().datetime(),
5108
5205
  updatedAt: import_zod.z.string().datetime()
5109
5206
  });
@@ -5253,6 +5350,60 @@ var listPaymentMethodsResponse = import_zod.z.lazy(() => import_zod.z.object({
5253
5350
  /** List of payment methods */
5254
5351
  data: import_zod.z.array(paymentMethod)
5255
5352
  }));
5353
+ var digestRequest = import_zod.z.object({
5354
+ /** The topic or subject to generate a digest for */
5355
+ query: import_zod.z.string().min(1),
5356
+ /** Time window filter (e.g., "7d", "24h", "2w", "30m"). Only considers memories within this window. */
5357
+ recent: import_zod.z.string().optional(),
5358
+ /** Filter to memories with these topics */
5359
+ topics: import_zod.z.array(import_zod.z.string()).optional(),
5360
+ /** Limit to specific conversation IDs */
5361
+ conversationIds: import_zod.z.array(import_zod.z.string()).optional(),
5362
+ /** Output format: "structured" (sections with headers), "narrative" (chronological prose), "timeline" (dated event list), "status-report" (done/in-progress/blocked) */
5363
+ format: import_zod.z.enum(["structured", "narrative", "timeline", "status-report"]).optional(),
5364
+ /** Maximum number of memories to consider (1-500, default 100) */
5365
+ maxSources: import_zod.z.number().min(1).max(500).optional(),
5366
+ /** Whether to include source memory IDs in the response */
5367
+ includeMemoryIds: import_zod.z.boolean().optional()
5368
+ });
5369
+ var digestTimeRange = import_zod.z.object({
5370
+ /** Earliest memory timestamp in the digest sources */
5371
+ earliest: import_zod.z.string().datetime(),
5372
+ /** Latest memory timestamp in the digest sources */
5373
+ latest: import_zod.z.string().datetime()
5374
+ }).nullable();
5375
+ var digestMetadata = import_zod.z.lazy(() => import_zod.z.object({
5376
+ /** The query used to generate the digest */
5377
+ query: import_zod.z.string(),
5378
+ /** Total number of memories gathered (search + expansion) before synthesis */
5379
+ sourcesConsidered: import_zod.z.number().min(0),
5380
+ /** Number of memories fed into the synthesis step */
5381
+ sourcesUsed: import_zod.z.number().min(0),
5382
+ /** Number of distinct conversations the sources come from */
5383
+ conversationsSpanned: import_zod.z.number().min(0),
5384
+ /** Time range of the source memories (null if no sources found) */
5385
+ timeRange: digestTimeRange,
5386
+ /** Output format used for this digest */
5387
+ format: import_zod.z.enum(["structured", "narrative", "timeline", "status-report"]),
5388
+ /** ISO 8601 timestamp when the digest was generated */
5389
+ generatedAt: import_zod.z.string().datetime()
5390
+ }));
5391
+ var digestSource = import_zod.z.object({
5392
+ /** Source memory ID */
5393
+ memoryId: import_zod.z.string(),
5394
+ /** Relevance score (0-1) for this source memory */
5395
+ relevance: import_zod.z.number().min(0).max(1),
5396
+ /** Conversation ID this memory belongs to */
5397
+ conversation: import_zod.z.string().optional()
5398
+ });
5399
+ var digestResponse = import_zod.z.lazy(() => import_zod.z.object({
5400
+ /** The generated digest content (markdown formatted) */
5401
+ digest: import_zod.z.string(),
5402
+ /** Generation metadata including source statistics */
5403
+ metadata: digestMetadata,
5404
+ /** Source memories used to generate the digest, for traceability */
5405
+ sources: import_zod.z.array(digestSource)
5406
+ }));
5256
5407
 
5257
5408
  // src/index.ts
5258
5409
  var Memnexus = class {
@@ -5435,6 +5586,11 @@ var index_default = Memnexus;
5435
5586
  createMemoryResponseMeta,
5436
5587
  createNarrativeRequest,
5437
5588
  createPortalSessionRequest,
5589
+ digestMetadata,
5590
+ digestRequest,
5591
+ digestResponse,
5592
+ digestSource,
5593
+ digestTimeRange,
5438
5594
  entity,
5439
5595
  entityNode,
5440
5596
  error,