@memnexus-ai/typescript-sdk 1.31.0 → 1.31.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.
- package/dist/index.cjs +105 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +273 -4
- package/dist/index.d.ts +273 -4
- package/dist/index.js +100 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
@@ -5154,7 +5199,7 @@ var user = import_zod.z.object({
|
|
|
5154
5199
|
plan: import_zod.z.enum(["free", "pro", "enterprise"]),
|
|
5155
5200
|
memoryLimit: import_zod.z.number(),
|
|
5156
5201
|
retentionDays: import_zod.z.number().nullable(),
|
|
5157
|
-
deletionStatus: import_zod.z.enum(["none", "pending_deletion", "deleted"]),
|
|
5202
|
+
deletionStatus: import_zod.z.enum(["none", "pending_deletion", "deleting", "deleted"]),
|
|
5158
5203
|
deletionScheduledFor: import_zod.z.string().datetime().nullable(),
|
|
5159
5204
|
createdAt: import_zod.z.string().datetime(),
|
|
5160
5205
|
updatedAt: import_zod.z.string().datetime()
|
|
@@ -5305,6 +5350,60 @@ var listPaymentMethodsResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
|
5305
5350
|
/** List of payment methods */
|
|
5306
5351
|
data: import_zod.z.array(paymentMethod)
|
|
5307
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
|
+
}));
|
|
5308
5407
|
|
|
5309
5408
|
// src/index.ts
|
|
5310
5409
|
var Memnexus = class {
|
|
@@ -5487,6 +5586,11 @@ var index_default = Memnexus;
|
|
|
5487
5586
|
createMemoryResponseMeta,
|
|
5488
5587
|
createNarrativeRequest,
|
|
5489
5588
|
createPortalSessionRequest,
|
|
5589
|
+
digestMetadata,
|
|
5590
|
+
digestRequest,
|
|
5591
|
+
digestResponse,
|
|
5592
|
+
digestSource,
|
|
5593
|
+
digestTimeRange,
|
|
5490
5594
|
entity,
|
|
5491
5595
|
entityNode,
|
|
5492
5596
|
error,
|