@memnexus-ai/typescript-sdk 1.53.29 → 1.55.0-next.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.
- package/dist/index.cjs +1877 -206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4921 -1012
- package/dist/index.d.ts +4921 -1012
- package/dist/index.js +1850 -205
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37,6 +37,9 @@ var SdkError = class _SdkError extends Error {
|
|
|
37
37
|
this.name = "SdkError";
|
|
38
38
|
Object.setPrototypeOf(this, _SdkError.prototype);
|
|
39
39
|
}
|
|
40
|
+
status;
|
|
41
|
+
statusText;
|
|
42
|
+
data;
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
// src/http/handlers.ts
|
|
@@ -1318,6 +1321,31 @@ var PatternsService = class extends BaseService {
|
|
|
1318
1321
|
}
|
|
1319
1322
|
return this.client.call(request);
|
|
1320
1323
|
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Compile behavioral instructions from stored patterns
|
|
1326
|
+
* Converts stored behavioral patterns into actionable instructions suitable for injection into AI agent context at conversation start. Uses template-based (non-LLM) generation for deterministic output within the P95 <100ms budget.
|
|
1327
|
+
|
|
1328
|
+
* @param body - Request body
|
|
1329
|
+
*/
|
|
1330
|
+
async compileInstructions(options) {
|
|
1331
|
+
const request = new Request({
|
|
1332
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1333
|
+
method: "POST",
|
|
1334
|
+
path: "/api/patterns/compile-instructions",
|
|
1335
|
+
config: this.config,
|
|
1336
|
+
retry: {
|
|
1337
|
+
attempts: 3,
|
|
1338
|
+
delayMs: 150,
|
|
1339
|
+
maxDelayMs: 5e3,
|
|
1340
|
+
jitterMs: 50,
|
|
1341
|
+
backoffFactor: 2
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
if (options?.body !== void 0) {
|
|
1345
|
+
request.addBody(options?.body);
|
|
1346
|
+
}
|
|
1347
|
+
return this.client.call(request);
|
|
1348
|
+
}
|
|
1321
1349
|
};
|
|
1322
1350
|
|
|
1323
1351
|
// src/services/behavior-service.ts
|
|
@@ -1368,6 +1396,262 @@ var BehaviorService = class extends BaseService {
|
|
|
1368
1396
|
}
|
|
1369
1397
|
};
|
|
1370
1398
|
|
|
1399
|
+
// src/services/recommendations-service.ts
|
|
1400
|
+
var RecommendationsService = class extends BaseService {
|
|
1401
|
+
/**
|
|
1402
|
+
* Create an explicit recommendation
|
|
1403
|
+
* Create a new explicit recommendation (triggerContext + practice pair). Source is set to 'explicit'; triggerEmbedding is generated synchronously before return. SEC-BL-v2-002: practice content is validated against a prompt-injection deny-list. SEC-BL-v2-003: evidenceMemoryIds ownership is verified against the authenticated user.
|
|
1404
|
+
|
|
1405
|
+
* @param body - Request body
|
|
1406
|
+
*/
|
|
1407
|
+
async createRecommendation(body) {
|
|
1408
|
+
const request = new Request({
|
|
1409
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1410
|
+
method: "POST",
|
|
1411
|
+
path: "/api/patterns/recommendations",
|
|
1412
|
+
config: this.config,
|
|
1413
|
+
retry: {
|
|
1414
|
+
attempts: 3,
|
|
1415
|
+
delayMs: 150,
|
|
1416
|
+
maxDelayMs: 5e3,
|
|
1417
|
+
jitterMs: 50,
|
|
1418
|
+
backoffFactor: 2
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
if (body !== void 0) {
|
|
1422
|
+
request.addBody(body);
|
|
1423
|
+
}
|
|
1424
|
+
return this.client.call(request);
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* List pending recommendations
|
|
1428
|
+
* Returns recommendations with status='pending_review' for the authenticated user, ordered by confidence DESC, createdAt ASC.
|
|
1429
|
+
|
|
1430
|
+
* @param limit - Maximum number of results
|
|
1431
|
+
* @param offset - Number of results to skip
|
|
1432
|
+
*/
|
|
1433
|
+
async listPendingRecommendations(options) {
|
|
1434
|
+
const request = new Request({
|
|
1435
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1436
|
+
method: "GET",
|
|
1437
|
+
path: "/api/patterns/recommendations/pending",
|
|
1438
|
+
config: this.config,
|
|
1439
|
+
retry: {
|
|
1440
|
+
attempts: 3,
|
|
1441
|
+
delayMs: 150,
|
|
1442
|
+
maxDelayMs: 5e3,
|
|
1443
|
+
jitterMs: 50,
|
|
1444
|
+
backoffFactor: 2
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
if (options?.limit !== void 0) {
|
|
1448
|
+
request.addQueryParam("limit", {
|
|
1449
|
+
key: "limit",
|
|
1450
|
+
value: options.limit,
|
|
1451
|
+
explode: false,
|
|
1452
|
+
encode: true,
|
|
1453
|
+
style: "form",
|
|
1454
|
+
isLimit: true,
|
|
1455
|
+
isOffset: false,
|
|
1456
|
+
isCursor: false
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
if (options?.offset !== void 0) {
|
|
1460
|
+
request.addQueryParam("offset", {
|
|
1461
|
+
key: "offset",
|
|
1462
|
+
value: options.offset,
|
|
1463
|
+
explode: false,
|
|
1464
|
+
encode: true,
|
|
1465
|
+
style: "form",
|
|
1466
|
+
isLimit: false,
|
|
1467
|
+
isOffset: true,
|
|
1468
|
+
isCursor: false
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
return this.client.call(request);
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Approve a pending recommendation
|
|
1475
|
+
* Transitions a recommendation from status='pending_review' to status='active'. Returns 404 if the recommendation is not found, not owned by the authenticated user, or is not in pending_review status.
|
|
1476
|
+
|
|
1477
|
+
* @param id - Recommendation ID
|
|
1478
|
+
* @param body - Request body
|
|
1479
|
+
*/
|
|
1480
|
+
async approveRecommendation(id, options) {
|
|
1481
|
+
const request = new Request({
|
|
1482
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1483
|
+
method: "PATCH",
|
|
1484
|
+
path: "/api/patterns/recommendations/{id}/approve",
|
|
1485
|
+
config: this.config,
|
|
1486
|
+
retry: {
|
|
1487
|
+
attempts: 3,
|
|
1488
|
+
delayMs: 150,
|
|
1489
|
+
maxDelayMs: 5e3,
|
|
1490
|
+
jitterMs: 50,
|
|
1491
|
+
backoffFactor: 2
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
request.addPathParam("id", {
|
|
1495
|
+
key: "id",
|
|
1496
|
+
value: id,
|
|
1497
|
+
explode: false,
|
|
1498
|
+
encode: true,
|
|
1499
|
+
style: "simple",
|
|
1500
|
+
isLimit: false,
|
|
1501
|
+
isOffset: false,
|
|
1502
|
+
isCursor: false
|
|
1503
|
+
});
|
|
1504
|
+
if (options?.body !== void 0) {
|
|
1505
|
+
request.addBody(options?.body);
|
|
1506
|
+
}
|
|
1507
|
+
return this.client.call(request);
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Dismiss a recommendation
|
|
1511
|
+
* Permanently dismisses a recommendation (any non-dismissed status → dismissed). This transition is terminal — dismissed recommendations cannot be reactivated. Returns 404 if not found, not owned by the authenticated user, or already dismissed.
|
|
1512
|
+
|
|
1513
|
+
* @param id - Recommendation ID
|
|
1514
|
+
* @param body - Request body
|
|
1515
|
+
*/
|
|
1516
|
+
async dismissRecommendation(id, options) {
|
|
1517
|
+
const request = new Request({
|
|
1518
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1519
|
+
method: "PATCH",
|
|
1520
|
+
path: "/api/patterns/recommendations/{id}/dismiss",
|
|
1521
|
+
config: this.config,
|
|
1522
|
+
retry: {
|
|
1523
|
+
attempts: 3,
|
|
1524
|
+
delayMs: 150,
|
|
1525
|
+
maxDelayMs: 5e3,
|
|
1526
|
+
jitterMs: 50,
|
|
1527
|
+
backoffFactor: 2
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
request.addPathParam("id", {
|
|
1531
|
+
key: "id",
|
|
1532
|
+
value: id,
|
|
1533
|
+
explode: false,
|
|
1534
|
+
encode: true,
|
|
1535
|
+
style: "simple",
|
|
1536
|
+
isLimit: false,
|
|
1537
|
+
isOffset: false,
|
|
1538
|
+
isCursor: false
|
|
1539
|
+
});
|
|
1540
|
+
if (options?.body !== void 0) {
|
|
1541
|
+
request.addBody(options?.body);
|
|
1542
|
+
}
|
|
1543
|
+
return this.client.call(request);
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* List active recommendations
|
|
1547
|
+
* Returns recommendations with status='active' for the authenticated user, ordered by confidence DESC. These are the behavioral preferences currently surfacing in Claude via compile-instructions and build_context. SEC-BL-v2-003: results are scoped to the authenticated user — no cross-user data.
|
|
1548
|
+
|
|
1549
|
+
* @param limit - Maximum number of results
|
|
1550
|
+
* @param offset - Number of results to skip
|
|
1551
|
+
*/
|
|
1552
|
+
async listActiveRecommendations(options) {
|
|
1553
|
+
const request = new Request({
|
|
1554
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1555
|
+
method: "GET",
|
|
1556
|
+
path: "/api/patterns/recommendations/active",
|
|
1557
|
+
config: this.config,
|
|
1558
|
+
retry: {
|
|
1559
|
+
attempts: 3,
|
|
1560
|
+
delayMs: 150,
|
|
1561
|
+
maxDelayMs: 5e3,
|
|
1562
|
+
jitterMs: 50,
|
|
1563
|
+
backoffFactor: 2
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
if (options?.limit !== void 0) {
|
|
1567
|
+
request.addQueryParam("limit", {
|
|
1568
|
+
key: "limit",
|
|
1569
|
+
value: options.limit,
|
|
1570
|
+
explode: false,
|
|
1571
|
+
encode: true,
|
|
1572
|
+
style: "form",
|
|
1573
|
+
isLimit: true,
|
|
1574
|
+
isOffset: false,
|
|
1575
|
+
isCursor: false
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
if (options?.offset !== void 0) {
|
|
1579
|
+
request.addQueryParam("offset", {
|
|
1580
|
+
key: "offset",
|
|
1581
|
+
value: options.offset,
|
|
1582
|
+
explode: false,
|
|
1583
|
+
encode: true,
|
|
1584
|
+
style: "form",
|
|
1585
|
+
isLimit: false,
|
|
1586
|
+
isOffset: true,
|
|
1587
|
+
isCursor: false
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
return this.client.call(request);
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Match active recommendations to content
|
|
1594
|
+
* Embeds the supplied content and returns active Recommendations whose triggerContext is semantically similar. Used by the MCP server for just-in-time behavioral nudges on memory save. Results are scoped to the authenticated user — no cross-user data is returned.
|
|
1595
|
+
|
|
1596
|
+
* @param body - Request body
|
|
1597
|
+
*/
|
|
1598
|
+
async matchRecommendations(body) {
|
|
1599
|
+
const request = new Request({
|
|
1600
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1601
|
+
method: "POST",
|
|
1602
|
+
path: "/api/patterns/recommendations/match",
|
|
1603
|
+
config: this.config,
|
|
1604
|
+
retry: {
|
|
1605
|
+
attempts: 3,
|
|
1606
|
+
delayMs: 150,
|
|
1607
|
+
maxDelayMs: 5e3,
|
|
1608
|
+
jitterMs: 50,
|
|
1609
|
+
backoffFactor: 2
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
if (body !== void 0) {
|
|
1613
|
+
request.addBody(body);
|
|
1614
|
+
}
|
|
1615
|
+
return this.client.call(request);
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Pause an active recommendation
|
|
1619
|
+
* Transitions a recommendation from status='active' to status='paused'. Paused recommendations are excluded from compile-instructions and build_context surfacing. Returns 404 if the recommendation is not found, not owned by the authenticated user, or is not in active status. SEC-BL-v2-003: MATCH includes userId — no IDOR.
|
|
1620
|
+
|
|
1621
|
+
* @param id - Recommendation ID
|
|
1622
|
+
* @param body - Request body
|
|
1623
|
+
*/
|
|
1624
|
+
async pauseRecommendation(id, options) {
|
|
1625
|
+
const request = new Request({
|
|
1626
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1627
|
+
method: "PATCH",
|
|
1628
|
+
path: "/api/patterns/recommendations/{id}/pause",
|
|
1629
|
+
config: this.config,
|
|
1630
|
+
retry: {
|
|
1631
|
+
attempts: 3,
|
|
1632
|
+
delayMs: 150,
|
|
1633
|
+
maxDelayMs: 5e3,
|
|
1634
|
+
jitterMs: 50,
|
|
1635
|
+
backoffFactor: 2
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
request.addPathParam("id", {
|
|
1639
|
+
key: "id",
|
|
1640
|
+
value: id,
|
|
1641
|
+
explode: false,
|
|
1642
|
+
encode: true,
|
|
1643
|
+
style: "simple",
|
|
1644
|
+
isLimit: false,
|
|
1645
|
+
isOffset: false,
|
|
1646
|
+
isCursor: false
|
|
1647
|
+
});
|
|
1648
|
+
if (options?.body !== void 0) {
|
|
1649
|
+
request.addBody(options?.body);
|
|
1650
|
+
}
|
|
1651
|
+
return this.client.call(request);
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1371
1655
|
// src/services/narratives-service.ts
|
|
1372
1656
|
var NarrativesService = class extends BaseService {
|
|
1373
1657
|
/**
|
|
@@ -1858,6 +2142,106 @@ var MemoriesService = class extends BaseService {
|
|
|
1858
2142
|
});
|
|
1859
2143
|
return this.client.call(request);
|
|
1860
2144
|
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Aggregated memory analytics
|
|
2147
|
+
* Return aggregated memory counts grouped by a time dimension (day, week, month)
|
|
2148
|
+
or by topic. Useful for activity dashboards and trend analysis.
|
|
2149
|
+
|
|
2150
|
+
* @param groupBy - Dimension to group counts by: day (YYYY-MM-DD), week (YYYY-Www), month (YYYY-MM), or topic
|
|
2151
|
+
* @param after - Filter memories on or after this ISO 8601 timestamp
|
|
2152
|
+
* @param before - Filter memories on or before this ISO 8601 timestamp
|
|
2153
|
+
* @param recent - Shorthand time window relative to now (e.g. 7d, 2w, 1mo). Sets the lower bound. Takes precedence over `after`.
|
|
2154
|
+
* @param topic - Pre-filter to memories that contain this topic before grouping
|
|
2155
|
+
* @param limit - Maximum number of buckets to return
|
|
2156
|
+
*/
|
|
2157
|
+
async getMemoriesStats(options) {
|
|
2158
|
+
const request = new Request({
|
|
2159
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2160
|
+
method: "GET",
|
|
2161
|
+
path: "/api/memories/stats",
|
|
2162
|
+
config: this.config,
|
|
2163
|
+
retry: {
|
|
2164
|
+
attempts: 3,
|
|
2165
|
+
delayMs: 150,
|
|
2166
|
+
maxDelayMs: 5e3,
|
|
2167
|
+
jitterMs: 50,
|
|
2168
|
+
backoffFactor: 2
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
if (options?.groupBy !== void 0) {
|
|
2172
|
+
request.addQueryParam("groupBy", {
|
|
2173
|
+
key: "groupBy",
|
|
2174
|
+
value: options.groupBy,
|
|
2175
|
+
explode: false,
|
|
2176
|
+
encode: true,
|
|
2177
|
+
style: "form",
|
|
2178
|
+
isLimit: false,
|
|
2179
|
+
isOffset: false,
|
|
2180
|
+
isCursor: false
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
if (options?.after !== void 0) {
|
|
2184
|
+
request.addQueryParam("after", {
|
|
2185
|
+
key: "after",
|
|
2186
|
+
value: options.after,
|
|
2187
|
+
explode: false,
|
|
2188
|
+
encode: true,
|
|
2189
|
+
style: "form",
|
|
2190
|
+
isLimit: false,
|
|
2191
|
+
isOffset: false,
|
|
2192
|
+
isCursor: false
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
if (options?.before !== void 0) {
|
|
2196
|
+
request.addQueryParam("before", {
|
|
2197
|
+
key: "before",
|
|
2198
|
+
value: options.before,
|
|
2199
|
+
explode: false,
|
|
2200
|
+
encode: true,
|
|
2201
|
+
style: "form",
|
|
2202
|
+
isLimit: false,
|
|
2203
|
+
isOffset: false,
|
|
2204
|
+
isCursor: false
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
if (options?.recent !== void 0) {
|
|
2208
|
+
request.addQueryParam("recent", {
|
|
2209
|
+
key: "recent",
|
|
2210
|
+
value: options.recent,
|
|
2211
|
+
explode: false,
|
|
2212
|
+
encode: true,
|
|
2213
|
+
style: "form",
|
|
2214
|
+
isLimit: false,
|
|
2215
|
+
isOffset: false,
|
|
2216
|
+
isCursor: false
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
if (options?.topic !== void 0) {
|
|
2220
|
+
request.addQueryParam("topic", {
|
|
2221
|
+
key: "topic",
|
|
2222
|
+
value: options.topic,
|
|
2223
|
+
explode: false,
|
|
2224
|
+
encode: true,
|
|
2225
|
+
style: "form",
|
|
2226
|
+
isLimit: false,
|
|
2227
|
+
isOffset: false,
|
|
2228
|
+
isCursor: false
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
if (options?.limit !== void 0) {
|
|
2232
|
+
request.addQueryParam("limit", {
|
|
2233
|
+
key: "limit",
|
|
2234
|
+
value: options.limit,
|
|
2235
|
+
explode: false,
|
|
2236
|
+
encode: true,
|
|
2237
|
+
style: "form",
|
|
2238
|
+
isLimit: true,
|
|
2239
|
+
isOffset: false,
|
|
2240
|
+
isCursor: false
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
return this.client.call(request);
|
|
2244
|
+
}
|
|
1861
2245
|
/**
|
|
1862
2246
|
* List memories
|
|
1863
2247
|
* List all memories for the authenticated user with pagination.
|
|
@@ -1875,6 +2259,13 @@ var MemoriesService = class extends BaseService {
|
|
|
1875
2259
|
* @param page - Page number (alternative to offset)
|
|
1876
2260
|
* @param sortBy - Field to sort results by
|
|
1877
2261
|
* @param order - Sort order
|
|
2262
|
+
* @param from - Filter memories created on or after this ISO 8601 timestamp (ingestion time lower bound)
|
|
2263
|
+
* @param to - Filter memories created on or before this ISO 8601 timestamp (ingestion time upper bound)
|
|
2264
|
+
* @param recent - Shorthand time filter relative to now (e.g. "24h", "7d", "2w"). Sets the lower bound for ingestion time. Takes precedence over `from` when both are provided.
|
|
2265
|
+
* @param topics - Comma-separated topic names. Memories must have at least one matching topic.
|
|
2266
|
+
* @param excludeTopics - Comma-separated topic names. Memories with any matching topic are excluded.
|
|
2267
|
+
* @param conversationId - Filter to memories belonging to the given conversation.
|
|
2268
|
+
* @param scope - Filter by codeContext scope. Comma-separated key:value pairs (e.g. scope=product:memnexus,team:retrieval). Memories must match ALL specified scope pairs. Allowed keys, product, service, team, role — unknown keys return 400.
|
|
1878
2269
|
*/
|
|
1879
2270
|
async listMemories(options) {
|
|
1880
2271
|
const request = new Request({
|
|
@@ -1922,14 +2313,98 @@ var MemoriesService = class extends BaseService {
|
|
|
1922
2313
|
encode: true,
|
|
1923
2314
|
style: "form",
|
|
1924
2315
|
isLimit: false,
|
|
1925
|
-
isOffset: true,
|
|
2316
|
+
isOffset: true,
|
|
2317
|
+
isCursor: false
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
if (options?.page !== void 0) {
|
|
2321
|
+
request.addQueryParam("page", {
|
|
2322
|
+
key: "page",
|
|
2323
|
+
value: options.page,
|
|
2324
|
+
explode: false,
|
|
2325
|
+
encode: true,
|
|
2326
|
+
style: "form",
|
|
2327
|
+
isLimit: false,
|
|
2328
|
+
isOffset: false,
|
|
2329
|
+
isCursor: false
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
if (options?.sortBy !== void 0) {
|
|
2333
|
+
request.addQueryParam("sortBy", {
|
|
2334
|
+
key: "sortBy",
|
|
2335
|
+
value: options.sortBy,
|
|
2336
|
+
explode: false,
|
|
2337
|
+
encode: true,
|
|
2338
|
+
style: "form",
|
|
2339
|
+
isLimit: false,
|
|
2340
|
+
isOffset: false,
|
|
2341
|
+
isCursor: false
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
if (options?.order !== void 0) {
|
|
2345
|
+
request.addQueryParam("order", {
|
|
2346
|
+
key: "order",
|
|
2347
|
+
value: options.order,
|
|
2348
|
+
explode: false,
|
|
2349
|
+
encode: true,
|
|
2350
|
+
style: "form",
|
|
2351
|
+
isLimit: false,
|
|
2352
|
+
isOffset: false,
|
|
2353
|
+
isCursor: false
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
if (options?.from !== void 0) {
|
|
2357
|
+
request.addQueryParam("from", {
|
|
2358
|
+
key: "from",
|
|
2359
|
+
value: options.from,
|
|
2360
|
+
explode: false,
|
|
2361
|
+
encode: true,
|
|
2362
|
+
style: "form",
|
|
2363
|
+
isLimit: false,
|
|
2364
|
+
isOffset: false,
|
|
2365
|
+
isCursor: false
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
if (options?.to !== void 0) {
|
|
2369
|
+
request.addQueryParam("to", {
|
|
2370
|
+
key: "to",
|
|
2371
|
+
value: options.to,
|
|
2372
|
+
explode: false,
|
|
2373
|
+
encode: true,
|
|
2374
|
+
style: "form",
|
|
2375
|
+
isLimit: false,
|
|
2376
|
+
isOffset: false,
|
|
2377
|
+
isCursor: false
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
if (options?.recent !== void 0) {
|
|
2381
|
+
request.addQueryParam("recent", {
|
|
2382
|
+
key: "recent",
|
|
2383
|
+
value: options.recent,
|
|
2384
|
+
explode: false,
|
|
2385
|
+
encode: true,
|
|
2386
|
+
style: "form",
|
|
2387
|
+
isLimit: false,
|
|
2388
|
+
isOffset: false,
|
|
2389
|
+
isCursor: false
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
if (options?.topics !== void 0) {
|
|
2393
|
+
request.addQueryParam("topics", {
|
|
2394
|
+
key: "topics",
|
|
2395
|
+
value: options.topics,
|
|
2396
|
+
explode: false,
|
|
2397
|
+
encode: true,
|
|
2398
|
+
style: "form",
|
|
2399
|
+
isLimit: false,
|
|
2400
|
+
isOffset: false,
|
|
1926
2401
|
isCursor: false
|
|
1927
2402
|
});
|
|
1928
2403
|
}
|
|
1929
|
-
if (options?.
|
|
1930
|
-
request.addQueryParam("
|
|
1931
|
-
key: "
|
|
1932
|
-
value: options.
|
|
2404
|
+
if (options?.excludeTopics !== void 0) {
|
|
2405
|
+
request.addQueryParam("excludeTopics", {
|
|
2406
|
+
key: "excludeTopics",
|
|
2407
|
+
value: options.excludeTopics,
|
|
1933
2408
|
explode: false,
|
|
1934
2409
|
encode: true,
|
|
1935
2410
|
style: "form",
|
|
@@ -1938,10 +2413,10 @@ var MemoriesService = class extends BaseService {
|
|
|
1938
2413
|
isCursor: false
|
|
1939
2414
|
});
|
|
1940
2415
|
}
|
|
1941
|
-
if (options?.
|
|
1942
|
-
request.addQueryParam("
|
|
1943
|
-
key: "
|
|
1944
|
-
value: options.
|
|
2416
|
+
if (options?.conversationId !== void 0) {
|
|
2417
|
+
request.addQueryParam("conversationId", {
|
|
2418
|
+
key: "conversationId",
|
|
2419
|
+
value: options.conversationId,
|
|
1945
2420
|
explode: false,
|
|
1946
2421
|
encode: true,
|
|
1947
2422
|
style: "form",
|
|
@@ -1950,10 +2425,10 @@ var MemoriesService = class extends BaseService {
|
|
|
1950
2425
|
isCursor: false
|
|
1951
2426
|
});
|
|
1952
2427
|
}
|
|
1953
|
-
if (options?.
|
|
1954
|
-
request.addQueryParam("
|
|
1955
|
-
key: "
|
|
1956
|
-
value: options.
|
|
2428
|
+
if (options?.scope !== void 0) {
|
|
2429
|
+
request.addQueryParam("scope", {
|
|
2430
|
+
key: "scope",
|
|
2431
|
+
value: options.scope,
|
|
1957
2432
|
explode: false,
|
|
1958
2433
|
encode: true,
|
|
1959
2434
|
style: "form",
|
|
@@ -2020,7 +2495,7 @@ var MemoriesService = class extends BaseService {
|
|
|
2020
2495
|
**Array Parameters:**
|
|
2021
2496
|
- `topics`: Provide as comma-separated values (e.g., `topics=typescript,api-design`)
|
|
2022
2497
|
|
|
2023
|
-
* @param q - Search query string
|
|
2498
|
+
* @param q - Search query string. Optional — omit for topic/date-only browsing.
|
|
2024
2499
|
* @param searchMethod - Search algorithm to use
|
|
2025
2500
|
* @param limit - Maximum number of results to return
|
|
2026
2501
|
* @param offset - Number of results to skip for pagination
|
|
@@ -2036,6 +2511,7 @@ var MemoriesService = class extends BaseService {
|
|
|
2036
2511
|
* @param includeTopics - Include associated topics in results
|
|
2037
2512
|
* @param includeEntities - Include mentioned entities in results
|
|
2038
2513
|
* @param includeFacts - Include extracted facts in results
|
|
2514
|
+
* @param includeClaims - Include claims associated with results (defaults to true)
|
|
2039
2515
|
* @param asOfTime - Point-in-time query (ISO 8601 datetime)
|
|
2040
2516
|
* @param validAtTime - Filter by validity time (ISO 8601 datetime)
|
|
2041
2517
|
* @param eventTimeFrom - Event time range start (ISO 8601 datetime)
|
|
@@ -2053,6 +2529,13 @@ var MemoriesService = class extends BaseService {
|
|
|
2053
2529
|
* @param entityWeight - Weight for entity graph branch in hybrid search
|
|
2054
2530
|
* @param topicWeight - Weight for topic graph branch in hybrid search
|
|
2055
2531
|
* @param factWeight - Weight for fact graph branch in hybrid search
|
|
2532
|
+
* @param questionWeight - Weight for question graph branch in hybrid search
|
|
2533
|
+
* @param claimsWeight - Weight for claims vector branch in hybrid search
|
|
2534
|
+
* @param includeFacets - Include facet aggregation (topics, memoryType, effectiveState) in response
|
|
2535
|
+
* @param embeddingProvider - Which embedding provider to use for query-time embedding generation and vector index lookup. `voyage` is the canonical name for the secondary provider (Voyage voyage-3.5, 1024d); `openai` is accepted as a legacy alias and now also resolves to Voyage after v1.66 P0-EMBED-SWAP. Falls back to ollama when the secondary provider is unavailable.
|
|
2536
|
+
* @param scope - Filter by codeContext scope. Comma-separated key:value pairs (e.g. scope=product:memnexus,service:core-api). Memories must match ALL specified scope pairs. Allowed keys, product, service, team, role — unknown keys return 400.
|
|
2537
|
+
* @param taskId - Task-scoped retrieval: returns own-history first, fills remainder with cross-task results.
|
|
2538
|
+
* @param outcomeFilter - Filter by task outcome. Use 'resolved' to find successful approaches from past tasks.
|
|
2056
2539
|
*/
|
|
2057
2540
|
async searchMemoriesGet(options) {
|
|
2058
2541
|
const request = new Request({
|
|
@@ -2260,6 +2743,18 @@ var MemoriesService = class extends BaseService {
|
|
|
2260
2743
|
isCursor: false
|
|
2261
2744
|
});
|
|
2262
2745
|
}
|
|
2746
|
+
if (options?.includeClaims !== void 0) {
|
|
2747
|
+
request.addQueryParam("includeClaims", {
|
|
2748
|
+
key: "includeClaims",
|
|
2749
|
+
value: options.includeClaims,
|
|
2750
|
+
explode: false,
|
|
2751
|
+
encode: true,
|
|
2752
|
+
style: "form",
|
|
2753
|
+
isLimit: false,
|
|
2754
|
+
isOffset: false,
|
|
2755
|
+
isCursor: false
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2263
2758
|
if (options?.asOfTime !== void 0) {
|
|
2264
2759
|
request.addQueryParam("asOfTime", {
|
|
2265
2760
|
key: "asOfTime",
|
|
@@ -2464,6 +2959,90 @@ var MemoriesService = class extends BaseService {
|
|
|
2464
2959
|
isCursor: false
|
|
2465
2960
|
});
|
|
2466
2961
|
}
|
|
2962
|
+
if (options?.questionWeight !== void 0) {
|
|
2963
|
+
request.addQueryParam("questionWeight", {
|
|
2964
|
+
key: "questionWeight",
|
|
2965
|
+
value: options.questionWeight,
|
|
2966
|
+
explode: false,
|
|
2967
|
+
encode: true,
|
|
2968
|
+
style: "form",
|
|
2969
|
+
isLimit: false,
|
|
2970
|
+
isOffset: false,
|
|
2971
|
+
isCursor: false
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
if (options?.claimsWeight !== void 0) {
|
|
2975
|
+
request.addQueryParam("claimsWeight", {
|
|
2976
|
+
key: "claimsWeight",
|
|
2977
|
+
value: options.claimsWeight,
|
|
2978
|
+
explode: false,
|
|
2979
|
+
encode: true,
|
|
2980
|
+
style: "form",
|
|
2981
|
+
isLimit: false,
|
|
2982
|
+
isOffset: false,
|
|
2983
|
+
isCursor: false
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
if (options?.includeFacets !== void 0) {
|
|
2987
|
+
request.addQueryParam("includeFacets", {
|
|
2988
|
+
key: "includeFacets",
|
|
2989
|
+
value: options.includeFacets,
|
|
2990
|
+
explode: false,
|
|
2991
|
+
encode: true,
|
|
2992
|
+
style: "form",
|
|
2993
|
+
isLimit: false,
|
|
2994
|
+
isOffset: false,
|
|
2995
|
+
isCursor: false
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
if (options?.embeddingProvider !== void 0) {
|
|
2999
|
+
request.addQueryParam("embeddingProvider", {
|
|
3000
|
+
key: "embeddingProvider",
|
|
3001
|
+
value: options.embeddingProvider,
|
|
3002
|
+
explode: false,
|
|
3003
|
+
encode: true,
|
|
3004
|
+
style: "form",
|
|
3005
|
+
isLimit: false,
|
|
3006
|
+
isOffset: false,
|
|
3007
|
+
isCursor: false
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
if (options?.scope !== void 0) {
|
|
3011
|
+
request.addQueryParam("scope", {
|
|
3012
|
+
key: "scope",
|
|
3013
|
+
value: options.scope,
|
|
3014
|
+
explode: false,
|
|
3015
|
+
encode: true,
|
|
3016
|
+
style: "form",
|
|
3017
|
+
isLimit: false,
|
|
3018
|
+
isOffset: false,
|
|
3019
|
+
isCursor: false
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
if (options?.taskId !== void 0) {
|
|
3023
|
+
request.addQueryParam("taskId", {
|
|
3024
|
+
key: "taskId",
|
|
3025
|
+
value: options.taskId,
|
|
3026
|
+
explode: false,
|
|
3027
|
+
encode: true,
|
|
3028
|
+
style: "form",
|
|
3029
|
+
isLimit: false,
|
|
3030
|
+
isOffset: false,
|
|
3031
|
+
isCursor: false
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
if (options?.outcomeFilter !== void 0) {
|
|
3035
|
+
request.addQueryParam("outcomeFilter", {
|
|
3036
|
+
key: "outcomeFilter",
|
|
3037
|
+
value: options.outcomeFilter,
|
|
3038
|
+
explode: false,
|
|
3039
|
+
encode: true,
|
|
3040
|
+
style: "form",
|
|
3041
|
+
isLimit: false,
|
|
3042
|
+
isOffset: false,
|
|
3043
|
+
isCursor: false
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
2467
3046
|
return this.client.call(request);
|
|
2468
3047
|
}
|
|
2469
3048
|
/**
|
|
@@ -2566,6 +3145,41 @@ var MemoriesService = class extends BaseService {
|
|
|
2566
3145
|
}
|
|
2567
3146
|
return this.client.call(request);
|
|
2568
3147
|
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Generate memory digest (SSE streaming)
|
|
3150
|
+
* Same as POST /api/memories/digest but uses Server-Sent Events (SSE) to stream
|
|
3151
|
+
the response. Sends `: heartbeat` comments every 10 seconds during processing
|
|
3152
|
+
to prevent gateway read-timeout (default 60s) from killing long-running digests.
|
|
3153
|
+
|
|
3154
|
+
**Event sequence:**
|
|
3155
|
+
- `: heartbeat` — keep-alive comment, sent every 10s during processing
|
|
3156
|
+
- `event: result` / `data: <DigestResponse JSON>` — digest completed successfully
|
|
3157
|
+
- `event: error` / `data: {"error":"...","statusCode":N}` — digest failed
|
|
3158
|
+
- `event: done` / `data: {}` — stream complete (sent after result)
|
|
3159
|
+
|
|
3160
|
+
**Formats and pipeline:** identical to POST /api/memories/digest.
|
|
3161
|
+
|
|
3162
|
+
* @param body - Request body
|
|
3163
|
+
*/
|
|
3164
|
+
async streamMemoryDigest(body) {
|
|
3165
|
+
const request = new Request({
|
|
3166
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3167
|
+
method: "POST",
|
|
3168
|
+
path: "/api/memories/digest/stream",
|
|
3169
|
+
config: this.config,
|
|
3170
|
+
retry: {
|
|
3171
|
+
attempts: 3,
|
|
3172
|
+
delayMs: 150,
|
|
3173
|
+
maxDelayMs: 5e3,
|
|
3174
|
+
jitterMs: 50,
|
|
3175
|
+
backoffFactor: 2
|
|
3176
|
+
}
|
|
3177
|
+
});
|
|
3178
|
+
if (body !== void 0) {
|
|
3179
|
+
request.addBody(body);
|
|
3180
|
+
}
|
|
3181
|
+
return this.client.call(request);
|
|
3182
|
+
}
|
|
2569
3183
|
/**
|
|
2570
3184
|
* Build a context briefing
|
|
2571
3185
|
* Answers "What should I know before working on X?" by combining active work
|
|
@@ -2600,8 +3214,11 @@ var MemoriesService = class extends BaseService {
|
|
|
2600
3214
|
Walks the SUPERSEDES chain from HEAD backwards.
|
|
2601
3215
|
|
|
2602
3216
|
* @param name - Memory name (kebab-case, 2-64 chars)
|
|
3217
|
+
* @param limit - Optional cap on the number of most-recent versions to return.
|
|
3218
|
+
When omitted, the full version chain is returned.
|
|
3219
|
+
|
|
2603
3220
|
*/
|
|
2604
|
-
async getNamedMemoryHistory(name) {
|
|
3221
|
+
async getNamedMemoryHistory(name, options) {
|
|
2605
3222
|
const request = new Request({
|
|
2606
3223
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2607
3224
|
method: "GET",
|
|
@@ -2625,6 +3242,18 @@ var MemoriesService = class extends BaseService {
|
|
|
2625
3242
|
isOffset: false,
|
|
2626
3243
|
isCursor: false
|
|
2627
3244
|
});
|
|
3245
|
+
if (options?.limit !== void 0) {
|
|
3246
|
+
request.addQueryParam("limit", {
|
|
3247
|
+
key: "limit",
|
|
3248
|
+
value: options.limit,
|
|
3249
|
+
explode: false,
|
|
3250
|
+
encode: true,
|
|
3251
|
+
style: "form",
|
|
3252
|
+
isLimit: true,
|
|
3253
|
+
isOffset: false,
|
|
3254
|
+
isCursor: false
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
2628
3257
|
return this.client.call(request);
|
|
2629
3258
|
}
|
|
2630
3259
|
/**
|
|
@@ -2711,6 +3340,56 @@ var MemoriesService = class extends BaseService {
|
|
|
2711
3340
|
}
|
|
2712
3341
|
return this.client.call(request);
|
|
2713
3342
|
}
|
|
3343
|
+
/**
|
|
3344
|
+
* Bulk delete multiple memories
|
|
3345
|
+
* Soft-delete multiple memories at once. Requires confirmDeletion=true.
|
|
3346
|
+
Each memory is verified to belong to the authenticated user.
|
|
3347
|
+
Maximum 100 IDs per request.
|
|
3348
|
+
|
|
3349
|
+
* @param body - Request body
|
|
3350
|
+
*/
|
|
3351
|
+
async bulkDeleteMemories(body) {
|
|
3352
|
+
const request = new Request({
|
|
3353
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3354
|
+
method: "DELETE",
|
|
3355
|
+
path: "/api/memories/bulk",
|
|
3356
|
+
config: this.config,
|
|
3357
|
+
retry: {
|
|
3358
|
+
attempts: 3,
|
|
3359
|
+
delayMs: 150,
|
|
3360
|
+
maxDelayMs: 5e3,
|
|
3361
|
+
jitterMs: 50,
|
|
3362
|
+
backoffFactor: 2
|
|
3363
|
+
}
|
|
3364
|
+
});
|
|
3365
|
+
if (body !== void 0) {
|
|
3366
|
+
request.addBody(body);
|
|
3367
|
+
}
|
|
3368
|
+
return this.client.call(request);
|
|
3369
|
+
}
|
|
3370
|
+
/**
|
|
3371
|
+
* Repair orphaned effectiveState values
|
|
3372
|
+
* Finds memories with effectiveState='superseded' or 'contradicted' but no
|
|
3373
|
+
corresponding incoming SUPERSEDES/CONTRADICTS edges, and resets them to 'current'.
|
|
3374
|
+
This handles cases where edges were deleted but effectiveState wasn't recalculated.
|
|
3375
|
+
|
|
3376
|
+
*/
|
|
3377
|
+
async repairEffectiveState() {
|
|
3378
|
+
const request = new Request({
|
|
3379
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3380
|
+
method: "POST",
|
|
3381
|
+
path: "/api/memories/repair-effective-state",
|
|
3382
|
+
config: this.config,
|
|
3383
|
+
retry: {
|
|
3384
|
+
attempts: 3,
|
|
3385
|
+
delayMs: 150,
|
|
3386
|
+
maxDelayMs: 5e3,
|
|
3387
|
+
jitterMs: 50,
|
|
3388
|
+
backoffFactor: 2
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3391
|
+
return this.client.call(request);
|
|
3392
|
+
}
|
|
2714
3393
|
/**
|
|
2715
3394
|
* Record behavioral feedback on a search result
|
|
2716
3395
|
* Record whether a search result was selected or ignored by the user.
|
|
@@ -3119,8 +3798,128 @@ var MemoriesService = class extends BaseService {
|
|
|
3119
3798
|
isOffset: false,
|
|
3120
3799
|
isCursor: false
|
|
3121
3800
|
});
|
|
3122
|
-
if (options?.body !== void 0) {
|
|
3123
|
-
request.addBody(options?.body);
|
|
3801
|
+
if (options?.body !== void 0) {
|
|
3802
|
+
request.addBody(options?.body);
|
|
3803
|
+
}
|
|
3804
|
+
return this.client.call(request);
|
|
3805
|
+
}
|
|
3806
|
+
/**
|
|
3807
|
+
* Generate LLM explanation for a memory relationship
|
|
3808
|
+
* Uses an LLM to explain why two memories have been flagged with a
|
|
3809
|
+
particular relationship (e.g. contradiction). Returns a short
|
|
3810
|
+
plain-text explanation highlighting the specific differences.
|
|
3811
|
+
|
|
3812
|
+
* @param id - The ID of the source memory
|
|
3813
|
+
* @param body - Request body
|
|
3814
|
+
*/
|
|
3815
|
+
async explainMemoryRelationship(id, body) {
|
|
3816
|
+
const request = new Request({
|
|
3817
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3818
|
+
method: "POST",
|
|
3819
|
+
path: "/api/memories/{id}/explain-relationship",
|
|
3820
|
+
config: this.config,
|
|
3821
|
+
retry: {
|
|
3822
|
+
attempts: 3,
|
|
3823
|
+
delayMs: 150,
|
|
3824
|
+
maxDelayMs: 5e3,
|
|
3825
|
+
jitterMs: 50,
|
|
3826
|
+
backoffFactor: 2
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
request.addPathParam("id", {
|
|
3830
|
+
key: "id",
|
|
3831
|
+
value: id,
|
|
3832
|
+
explode: false,
|
|
3833
|
+
encode: true,
|
|
3834
|
+
style: "simple",
|
|
3835
|
+
isLimit: false,
|
|
3836
|
+
isOffset: false,
|
|
3837
|
+
isCursor: false
|
|
3838
|
+
});
|
|
3839
|
+
if (body !== void 0) {
|
|
3840
|
+
request.addBody(body);
|
|
3841
|
+
}
|
|
3842
|
+
return this.client.call(request);
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Export memories matching filters
|
|
3846
|
+
* Export memories matching an optional search query and filters to JSON or CSV format.
|
|
3847
|
+
When a query is provided, uses hybrid search. When no query is provided, lists memories
|
|
3848
|
+
with optional topic and memoryType filters. Maximum 1000 results per export.
|
|
3849
|
+
|
|
3850
|
+
* @param body - Request body
|
|
3851
|
+
*/
|
|
3852
|
+
async exportMemories(body) {
|
|
3853
|
+
const request = new Request({
|
|
3854
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3855
|
+
method: "POST",
|
|
3856
|
+
path: "/api/memories/export",
|
|
3857
|
+
config: this.config,
|
|
3858
|
+
retry: {
|
|
3859
|
+
attempts: 3,
|
|
3860
|
+
delayMs: 150,
|
|
3861
|
+
maxDelayMs: 5e3,
|
|
3862
|
+
jitterMs: 50,
|
|
3863
|
+
backoffFactor: 2
|
|
3864
|
+
}
|
|
3865
|
+
});
|
|
3866
|
+
if (body !== void 0) {
|
|
3867
|
+
request.addBody(body);
|
|
3868
|
+
}
|
|
3869
|
+
return this.client.call(request);
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Bulk update multiple memories
|
|
3873
|
+
* Update multiple memories at once. Supports updating topics and memoryType.
|
|
3874
|
+
Each memory is verified to belong to the authenticated user.
|
|
3875
|
+
Maximum 100 IDs per request.
|
|
3876
|
+
|
|
3877
|
+
* @param body - Request body
|
|
3878
|
+
*/
|
|
3879
|
+
async bulkUpdateMemories(body) {
|
|
3880
|
+
const request = new Request({
|
|
3881
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3882
|
+
method: "POST",
|
|
3883
|
+
path: "/api/memories/bulk-update",
|
|
3884
|
+
config: this.config,
|
|
3885
|
+
retry: {
|
|
3886
|
+
attempts: 3,
|
|
3887
|
+
delayMs: 150,
|
|
3888
|
+
maxDelayMs: 5e3,
|
|
3889
|
+
jitterMs: 50,
|
|
3890
|
+
backoffFactor: 2
|
|
3891
|
+
}
|
|
3892
|
+
});
|
|
3893
|
+
if (body !== void 0) {
|
|
3894
|
+
request.addBody(body);
|
|
3895
|
+
}
|
|
3896
|
+
return this.client.call(request);
|
|
3897
|
+
}
|
|
3898
|
+
/**
|
|
3899
|
+
* Bulk add or remove topics from memories
|
|
3900
|
+
* Add and/or remove topics from multiple memories at once.
|
|
3901
|
+
At least one of addTopics or removeTopics must be provided.
|
|
3902
|
+
Each memory is verified to belong to the authenticated user.
|
|
3903
|
+
Maximum 100 IDs per request.
|
|
3904
|
+
|
|
3905
|
+
* @param body - Request body
|
|
3906
|
+
*/
|
|
3907
|
+
async bulkTagMemories(body) {
|
|
3908
|
+
const request = new Request({
|
|
3909
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3910
|
+
method: "POST",
|
|
3911
|
+
path: "/api/memories/bulk-tag",
|
|
3912
|
+
config: this.config,
|
|
3913
|
+
retry: {
|
|
3914
|
+
attempts: 3,
|
|
3915
|
+
delayMs: 150,
|
|
3916
|
+
maxDelayMs: 5e3,
|
|
3917
|
+
jitterMs: 50,
|
|
3918
|
+
backoffFactor: 2
|
|
3919
|
+
}
|
|
3920
|
+
});
|
|
3921
|
+
if (body !== void 0) {
|
|
3922
|
+
request.addBody(body);
|
|
3124
3923
|
}
|
|
3125
3924
|
return this.client.call(request);
|
|
3126
3925
|
}
|
|
@@ -3182,6 +3981,30 @@ var InvitesService = class extends BaseService {
|
|
|
3182
3981
|
|
|
3183
3982
|
// src/services/health-service.ts
|
|
3184
3983
|
var HealthService = class extends BaseService {
|
|
3984
|
+
/**
|
|
3985
|
+
* Liveness probe endpoint
|
|
3986
|
+
* Returns 200 if the process is alive. Does not check external dependencies.
|
|
3987
|
+
Used by Kubernetes liveness probes to determine if the container should be restarted.
|
|
3988
|
+
Unlike /health, this endpoint does not query the database — a database outage
|
|
3989
|
+
should not cause the API process to be killed and restarted.
|
|
3990
|
+
|
|
3991
|
+
*/
|
|
3992
|
+
async livenessCheck() {
|
|
3993
|
+
const request = new Request({
|
|
3994
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3995
|
+
method: "GET",
|
|
3996
|
+
path: "/livez",
|
|
3997
|
+
config: this.config,
|
|
3998
|
+
retry: {
|
|
3999
|
+
attempts: 3,
|
|
4000
|
+
delayMs: 150,
|
|
4001
|
+
maxDelayMs: 5e3,
|
|
4002
|
+
jitterMs: 50,
|
|
4003
|
+
backoffFactor: 2
|
|
4004
|
+
}
|
|
4005
|
+
});
|
|
4006
|
+
return this.client.call(request);
|
|
4007
|
+
}
|
|
3185
4008
|
/**
|
|
3186
4009
|
* API health check endpoint
|
|
3187
4010
|
* Returns the health status and uptime of the API service.
|
|
@@ -3300,6 +4123,7 @@ var FactsService = class extends BaseService {
|
|
|
3300
4123
|
* List all facts for the authenticated user
|
|
3301
4124
|
* @param limit - Maximum number of facts to return
|
|
3302
4125
|
* @param offset - Number of facts to skip
|
|
4126
|
+
* @param memoryId - Filter facts to a specific memory
|
|
3303
4127
|
* @param sortBy - Field to sort facts by
|
|
3304
4128
|
* @param order - Sort order
|
|
3305
4129
|
*/
|
|
@@ -3341,6 +4165,18 @@ var FactsService = class extends BaseService {
|
|
|
3341
4165
|
isCursor: false
|
|
3342
4166
|
});
|
|
3343
4167
|
}
|
|
4168
|
+
if (options?.memoryId !== void 0) {
|
|
4169
|
+
request.addQueryParam("memoryId", {
|
|
4170
|
+
key: "memoryId",
|
|
4171
|
+
value: options.memoryId,
|
|
4172
|
+
explode: false,
|
|
4173
|
+
encode: true,
|
|
4174
|
+
style: "form",
|
|
4175
|
+
isLimit: false,
|
|
4176
|
+
isOffset: false,
|
|
4177
|
+
isCursor: false
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
3344
4180
|
if (options?.sortBy !== void 0) {
|
|
3345
4181
|
request.addQueryParam("sortBy", {
|
|
3346
4182
|
key: "sortBy",
|
|
@@ -3519,6 +4355,7 @@ var EntitiesService = class extends BaseService {
|
|
|
3519
4355
|
/**
|
|
3520
4356
|
* List entities
|
|
3521
4357
|
* List all entities for the authenticated user, optionally filtered by type
|
|
4358
|
+
* @param query - Search entities by name (case-insensitive substring match)
|
|
3522
4359
|
* @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
|
|
3523
4360
|
* @param limit - Maximum number of entities to return
|
|
3524
4361
|
* @param offset - Number of entities to skip
|
|
@@ -3537,6 +4374,18 @@ var EntitiesService = class extends BaseService {
|
|
|
3537
4374
|
backoffFactor: 2
|
|
3538
4375
|
}
|
|
3539
4376
|
});
|
|
4377
|
+
if (options?.query !== void 0) {
|
|
4378
|
+
request.addQueryParam("query", {
|
|
4379
|
+
key: "query",
|
|
4380
|
+
value: options.query,
|
|
4381
|
+
explode: false,
|
|
4382
|
+
encode: true,
|
|
4383
|
+
style: "form",
|
|
4384
|
+
isLimit: false,
|
|
4385
|
+
isOffset: false,
|
|
4386
|
+
isCursor: false
|
|
4387
|
+
});
|
|
4388
|
+
}
|
|
3540
4389
|
if (options?.type !== void 0) {
|
|
3541
4390
|
request.addQueryParam("type", {
|
|
3542
4391
|
key: "type",
|
|
@@ -3695,7 +4544,7 @@ var ConversationsService = class extends BaseService {
|
|
|
3695
4544
|
* @param since - Return only conversations created after this timestamp (ISO 8601 format)
|
|
3696
4545
|
* @param sortBy - Field to sort conversations by
|
|
3697
4546
|
* @param order - Sort order
|
|
3698
|
-
* @param
|
|
4547
|
+
* @param minMemories - Return only conversations with at least this many memories (filters out empty init conversations)
|
|
3699
4548
|
*/
|
|
3700
4549
|
async listConversations(options) {
|
|
3701
4550
|
const request = new Request({
|
|
@@ -3771,10 +4620,10 @@ var ConversationsService = class extends BaseService {
|
|
|
3771
4620
|
isCursor: false
|
|
3772
4621
|
});
|
|
3773
4622
|
}
|
|
3774
|
-
if (options?.
|
|
3775
|
-
request.addQueryParam("
|
|
3776
|
-
key: "
|
|
3777
|
-
value: options.
|
|
4623
|
+
if (options?.minMemories !== void 0) {
|
|
4624
|
+
request.addQueryParam("minMemories", {
|
|
4625
|
+
key: "minMemories",
|
|
4626
|
+
value: options.minMemories,
|
|
3778
4627
|
explode: false,
|
|
3779
4628
|
encode: true,
|
|
3780
4629
|
style: "form",
|
|
@@ -4544,6 +5393,33 @@ var ApiKeysService = class extends BaseService {
|
|
|
4544
5393
|
}
|
|
4545
5394
|
};
|
|
4546
5395
|
|
|
5396
|
+
// src/services/alerts-service.ts
|
|
5397
|
+
var AlertsService = class extends BaseService {
|
|
5398
|
+
/**
|
|
5399
|
+
* List active system alerts for the current user
|
|
5400
|
+
* Returns all active, non-expired system alerts that target either
|
|
5401
|
+
all users or the authenticated user specifically. Used by the
|
|
5402
|
+
customer portal to render the system alerts banner.
|
|
5403
|
+
|
|
5404
|
+
*/
|
|
5405
|
+
async getActiveSystemAlerts() {
|
|
5406
|
+
const request = new Request({
|
|
5407
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5408
|
+
method: "GET",
|
|
5409
|
+
path: "/api/alerts/active",
|
|
5410
|
+
config: this.config,
|
|
5411
|
+
retry: {
|
|
5412
|
+
attempts: 3,
|
|
5413
|
+
delayMs: 150,
|
|
5414
|
+
maxDelayMs: 5e3,
|
|
5415
|
+
jitterMs: 50,
|
|
5416
|
+
backoffFactor: 2
|
|
5417
|
+
}
|
|
5418
|
+
});
|
|
5419
|
+
return this.client.call(request);
|
|
5420
|
+
}
|
|
5421
|
+
};
|
|
5422
|
+
|
|
4547
5423
|
// src/services/admin-service.ts
|
|
4548
5424
|
var AdminService = class extends BaseService {
|
|
4549
5425
|
/**
|
|
@@ -4599,22 +5475,232 @@ var AdminService = class extends BaseService {
|
|
|
4599
5475
|
encode: true,
|
|
4600
5476
|
style: "form",
|
|
4601
5477
|
isLimit: false,
|
|
4602
|
-
isOffset: true,
|
|
5478
|
+
isOffset: true,
|
|
5479
|
+
isCursor: false
|
|
5480
|
+
});
|
|
5481
|
+
}
|
|
5482
|
+
return this.client.call(request);
|
|
5483
|
+
}
|
|
5484
|
+
/**
|
|
5485
|
+
* Create invite code
|
|
5486
|
+
* Create a new invite code for the gated preview
|
|
5487
|
+
* @param body - Request body
|
|
5488
|
+
*/
|
|
5489
|
+
async adminCreateInviteCode(body) {
|
|
5490
|
+
const request = new Request({
|
|
5491
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5492
|
+
method: "POST",
|
|
5493
|
+
path: "/api/admin/invites",
|
|
5494
|
+
config: this.config,
|
|
5495
|
+
retry: {
|
|
5496
|
+
attempts: 3,
|
|
5497
|
+
delayMs: 150,
|
|
5498
|
+
maxDelayMs: 5e3,
|
|
5499
|
+
jitterMs: 50,
|
|
5500
|
+
backoffFactor: 2
|
|
5501
|
+
}
|
|
5502
|
+
});
|
|
5503
|
+
if (body !== void 0) {
|
|
5504
|
+
request.addBody(body);
|
|
5505
|
+
}
|
|
5506
|
+
return this.client.call(request);
|
|
5507
|
+
}
|
|
5508
|
+
/**
|
|
5509
|
+
* Get invite system statistics
|
|
5510
|
+
* Aggregate statistics for the invite system
|
|
5511
|
+
*/
|
|
5512
|
+
async adminGetInviteStats() {
|
|
5513
|
+
const request = new Request({
|
|
5514
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5515
|
+
method: "GET",
|
|
5516
|
+
path: "/api/admin/invites/stats",
|
|
5517
|
+
config: this.config,
|
|
5518
|
+
retry: {
|
|
5519
|
+
attempts: 3,
|
|
5520
|
+
delayMs: 150,
|
|
5521
|
+
maxDelayMs: 5e3,
|
|
5522
|
+
jitterMs: 50,
|
|
5523
|
+
backoffFactor: 2
|
|
5524
|
+
}
|
|
5525
|
+
});
|
|
5526
|
+
return this.client.call(request);
|
|
5527
|
+
}
|
|
5528
|
+
/**
|
|
5529
|
+
* Get invite code details
|
|
5530
|
+
* Get details for a single invite code including redemptions
|
|
5531
|
+
* @param code - The invite code
|
|
5532
|
+
*/
|
|
5533
|
+
async adminGetInviteCode(code) {
|
|
5534
|
+
const request = new Request({
|
|
5535
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5536
|
+
method: "GET",
|
|
5537
|
+
path: "/api/admin/invites/{code}",
|
|
5538
|
+
config: this.config,
|
|
5539
|
+
retry: {
|
|
5540
|
+
attempts: 3,
|
|
5541
|
+
delayMs: 150,
|
|
5542
|
+
maxDelayMs: 5e3,
|
|
5543
|
+
jitterMs: 50,
|
|
5544
|
+
backoffFactor: 2
|
|
5545
|
+
}
|
|
5546
|
+
});
|
|
5547
|
+
request.addPathParam("code", {
|
|
5548
|
+
key: "code",
|
|
5549
|
+
value: code,
|
|
5550
|
+
explode: false,
|
|
5551
|
+
encode: true,
|
|
5552
|
+
style: "simple",
|
|
5553
|
+
isLimit: false,
|
|
5554
|
+
isOffset: false,
|
|
5555
|
+
isCursor: false
|
|
5556
|
+
});
|
|
5557
|
+
return this.client.call(request);
|
|
5558
|
+
}
|
|
5559
|
+
/**
|
|
5560
|
+
* Revoke an invite code
|
|
5561
|
+
* Revoke an invite code. Existing accounts created with this code are unaffected.
|
|
5562
|
+
* @param code -
|
|
5563
|
+
*/
|
|
5564
|
+
async adminRevokeInviteCode(code) {
|
|
5565
|
+
const request = new Request({
|
|
5566
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5567
|
+
method: "DELETE",
|
|
5568
|
+
path: "/api/admin/invites/{code}",
|
|
5569
|
+
config: this.config,
|
|
5570
|
+
retry: {
|
|
5571
|
+
attempts: 3,
|
|
5572
|
+
delayMs: 150,
|
|
5573
|
+
maxDelayMs: 5e3,
|
|
5574
|
+
jitterMs: 50,
|
|
5575
|
+
backoffFactor: 2
|
|
5576
|
+
}
|
|
5577
|
+
});
|
|
5578
|
+
request.addPathParam("code", {
|
|
5579
|
+
key: "code",
|
|
5580
|
+
value: code,
|
|
5581
|
+
explode: false,
|
|
5582
|
+
encode: true,
|
|
5583
|
+
style: "simple",
|
|
5584
|
+
isLimit: false,
|
|
5585
|
+
isOffset: false,
|
|
5586
|
+
isCursor: false
|
|
5587
|
+
});
|
|
5588
|
+
return this.client.call(request);
|
|
5589
|
+
}
|
|
5590
|
+
/**
|
|
5591
|
+
* Get gate status with audit info
|
|
5592
|
+
* Get current invite gate state with audit information
|
|
5593
|
+
*/
|
|
5594
|
+
async adminGetGateStatus() {
|
|
5595
|
+
const request = new Request({
|
|
5596
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5597
|
+
method: "GET",
|
|
5598
|
+
path: "/api/admin/gate",
|
|
5599
|
+
config: this.config,
|
|
5600
|
+
retry: {
|
|
5601
|
+
attempts: 3,
|
|
5602
|
+
delayMs: 150,
|
|
5603
|
+
maxDelayMs: 5e3,
|
|
5604
|
+
jitterMs: 50,
|
|
5605
|
+
backoffFactor: 2
|
|
5606
|
+
}
|
|
5607
|
+
});
|
|
5608
|
+
return this.client.call(request);
|
|
5609
|
+
}
|
|
5610
|
+
/**
|
|
5611
|
+
* Toggle invite gate
|
|
5612
|
+
* Toggle the invite gate. When enabled (true), new signups require a valid invite code.
|
|
5613
|
+
When disabled (false), registration is open. Takes effect immediately.
|
|
5614
|
+
|
|
5615
|
+
* @param body - Request body
|
|
5616
|
+
*/
|
|
5617
|
+
async adminSetGateStatus(body) {
|
|
5618
|
+
const request = new Request({
|
|
5619
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5620
|
+
method: "POST",
|
|
5621
|
+
path: "/api/admin/gate",
|
|
5622
|
+
config: this.config,
|
|
5623
|
+
retry: {
|
|
5624
|
+
attempts: 3,
|
|
5625
|
+
delayMs: 150,
|
|
5626
|
+
maxDelayMs: 5e3,
|
|
5627
|
+
jitterMs: 50,
|
|
5628
|
+
backoffFactor: 2
|
|
5629
|
+
}
|
|
5630
|
+
});
|
|
5631
|
+
if (body !== void 0) {
|
|
5632
|
+
request.addBody(body);
|
|
5633
|
+
}
|
|
5634
|
+
return this.client.call(request);
|
|
5635
|
+
}
|
|
5636
|
+
/**
|
|
5637
|
+
* Backfill per-stage memory pipeline status fields by inspecting actual graph state
|
|
5638
|
+
* @param body - Request body
|
|
5639
|
+
*/
|
|
5640
|
+
async adminMigratePerStageStatus(options) {
|
|
5641
|
+
const request = new Request({
|
|
5642
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5643
|
+
method: "POST",
|
|
5644
|
+
path: "/api/admin/migrate/per-stage-status",
|
|
5645
|
+
config: this.config,
|
|
5646
|
+
retry: {
|
|
5647
|
+
attempts: 3,
|
|
5648
|
+
delayMs: 150,
|
|
5649
|
+
maxDelayMs: 5e3,
|
|
5650
|
+
jitterMs: 50,
|
|
5651
|
+
backoffFactor: 2
|
|
5652
|
+
}
|
|
5653
|
+
});
|
|
5654
|
+
if (options?.body !== void 0) {
|
|
5655
|
+
request.addBody(options?.body);
|
|
5656
|
+
}
|
|
5657
|
+
return this.client.call(request);
|
|
5658
|
+
}
|
|
5659
|
+
};
|
|
5660
|
+
|
|
5661
|
+
// src/services/admin-alerts-service.ts
|
|
5662
|
+
var AdminAlertsService = class extends BaseService {
|
|
5663
|
+
/**
|
|
5664
|
+
* List system alerts
|
|
5665
|
+
* @param activeOnly - If true, return only active, non-expired alerts.
|
|
5666
|
+
*/
|
|
5667
|
+
async adminListSystemAlerts(options) {
|
|
5668
|
+
const request = new Request({
|
|
5669
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5670
|
+
method: "GET",
|
|
5671
|
+
path: "/api/admin/alerts",
|
|
5672
|
+
config: this.config,
|
|
5673
|
+
retry: {
|
|
5674
|
+
attempts: 3,
|
|
5675
|
+
delayMs: 150,
|
|
5676
|
+
maxDelayMs: 5e3,
|
|
5677
|
+
jitterMs: 50,
|
|
5678
|
+
backoffFactor: 2
|
|
5679
|
+
}
|
|
5680
|
+
});
|
|
5681
|
+
if (options?.activeOnly !== void 0) {
|
|
5682
|
+
request.addQueryParam("activeOnly", {
|
|
5683
|
+
key: "activeOnly",
|
|
5684
|
+
value: options.activeOnly,
|
|
5685
|
+
explode: false,
|
|
5686
|
+
encode: true,
|
|
5687
|
+
style: "form",
|
|
5688
|
+
isLimit: false,
|
|
5689
|
+
isOffset: false,
|
|
4603
5690
|
isCursor: false
|
|
4604
5691
|
});
|
|
4605
5692
|
}
|
|
4606
5693
|
return this.client.call(request);
|
|
4607
5694
|
}
|
|
4608
5695
|
/**
|
|
4609
|
-
* Create
|
|
4610
|
-
* Create a new invite code for the gated preview
|
|
5696
|
+
* Create a system alert
|
|
4611
5697
|
* @param body - Request body
|
|
4612
5698
|
*/
|
|
4613
|
-
async
|
|
5699
|
+
async adminCreateSystemAlert(body) {
|
|
4614
5700
|
const request = new Request({
|
|
4615
5701
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4616
5702
|
method: "POST",
|
|
4617
|
-
path: "/api/admin/
|
|
5703
|
+
path: "/api/admin/alerts",
|
|
4618
5704
|
config: this.config,
|
|
4619
5705
|
retry: {
|
|
4620
5706
|
attempts: 3,
|
|
@@ -4630,14 +5716,14 @@ var AdminService = class extends BaseService {
|
|
|
4630
5716
|
return this.client.call(request);
|
|
4631
5717
|
}
|
|
4632
5718
|
/**
|
|
4633
|
-
* Get
|
|
4634
|
-
*
|
|
5719
|
+
* Get a system alert by id
|
|
5720
|
+
* @param id - System alert id
|
|
4635
5721
|
*/
|
|
4636
|
-
async
|
|
5722
|
+
async adminGetSystemAlert(id) {
|
|
4637
5723
|
const request = new Request({
|
|
4638
5724
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4639
5725
|
method: "GET",
|
|
4640
|
-
path: "/api/admin/
|
|
5726
|
+
path: "/api/admin/alerts/{id}",
|
|
4641
5727
|
config: this.config,
|
|
4642
5728
|
retry: {
|
|
4643
5729
|
attempts: 3,
|
|
@@ -4647,18 +5733,27 @@ var AdminService = class extends BaseService {
|
|
|
4647
5733
|
backoffFactor: 2
|
|
4648
5734
|
}
|
|
4649
5735
|
});
|
|
5736
|
+
request.addPathParam("id", {
|
|
5737
|
+
key: "id",
|
|
5738
|
+
value: id,
|
|
5739
|
+
explode: false,
|
|
5740
|
+
encode: true,
|
|
5741
|
+
style: "simple",
|
|
5742
|
+
isLimit: false,
|
|
5743
|
+
isOffset: false,
|
|
5744
|
+
isCursor: false
|
|
5745
|
+
});
|
|
4650
5746
|
return this.client.call(request);
|
|
4651
5747
|
}
|
|
4652
5748
|
/**
|
|
4653
|
-
*
|
|
4654
|
-
*
|
|
4655
|
-
* @param code - The invite code
|
|
5749
|
+
* Delete a system alert
|
|
5750
|
+
* @param id - System alert id
|
|
4656
5751
|
*/
|
|
4657
|
-
async
|
|
5752
|
+
async adminDeleteSystemAlert(id) {
|
|
4658
5753
|
const request = new Request({
|
|
4659
5754
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4660
|
-
method: "
|
|
4661
|
-
path: "/api/admin/
|
|
5755
|
+
method: "DELETE",
|
|
5756
|
+
path: "/api/admin/alerts/{id}",
|
|
4662
5757
|
config: this.config,
|
|
4663
5758
|
retry: {
|
|
4664
5759
|
attempts: 3,
|
|
@@ -4668,9 +5763,9 @@ var AdminService = class extends BaseService {
|
|
|
4668
5763
|
backoffFactor: 2
|
|
4669
5764
|
}
|
|
4670
5765
|
});
|
|
4671
|
-
request.addPathParam("
|
|
4672
|
-
key: "
|
|
4673
|
-
value:
|
|
5766
|
+
request.addPathParam("id", {
|
|
5767
|
+
key: "id",
|
|
5768
|
+
value: id,
|
|
4674
5769
|
explode: false,
|
|
4675
5770
|
encode: true,
|
|
4676
5771
|
style: "simple",
|
|
@@ -4681,15 +5776,15 @@ var AdminService = class extends BaseService {
|
|
|
4681
5776
|
return this.client.call(request);
|
|
4682
5777
|
}
|
|
4683
5778
|
/**
|
|
4684
|
-
*
|
|
4685
|
-
*
|
|
4686
|
-
* @param
|
|
5779
|
+
* Update a system alert
|
|
5780
|
+
* @param id -
|
|
5781
|
+
* @param body - Request body
|
|
4687
5782
|
*/
|
|
4688
|
-
async
|
|
5783
|
+
async adminUpdateSystemAlert(id, body) {
|
|
4689
5784
|
const request = new Request({
|
|
4690
5785
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4691
|
-
method: "
|
|
4692
|
-
path: "/api/admin/
|
|
5786
|
+
method: "PATCH",
|
|
5787
|
+
path: "/api/admin/alerts/{id}",
|
|
4693
5788
|
config: this.config,
|
|
4694
5789
|
retry: {
|
|
4695
5790
|
attempts: 3,
|
|
@@ -4699,9 +5794,9 @@ var AdminService = class extends BaseService {
|
|
|
4699
5794
|
backoffFactor: 2
|
|
4700
5795
|
}
|
|
4701
5796
|
});
|
|
4702
|
-
request.addPathParam("
|
|
4703
|
-
key: "
|
|
4704
|
-
value:
|
|
5797
|
+
request.addPathParam("id", {
|
|
5798
|
+
key: "id",
|
|
5799
|
+
value: id,
|
|
4705
5800
|
explode: false,
|
|
4706
5801
|
encode: true,
|
|
4707
5802
|
style: "simple",
|
|
@@ -4709,17 +5804,30 @@ var AdminService = class extends BaseService {
|
|
|
4709
5804
|
isOffset: false,
|
|
4710
5805
|
isCursor: false
|
|
4711
5806
|
});
|
|
5807
|
+
if (body !== void 0) {
|
|
5808
|
+
request.addBody(body);
|
|
5809
|
+
}
|
|
4712
5810
|
return this.client.call(request);
|
|
4713
5811
|
}
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
5812
|
+
};
|
|
5813
|
+
|
|
5814
|
+
// src/services/admin-pipeline-service.ts
|
|
5815
|
+
var AdminPipelineService = class extends BaseService {
|
|
5816
|
+
/**
|
|
5817
|
+
* Re-enqueue a single memory through one pipeline
|
|
5818
|
+
* Admin-only. Re-publishes the requested pipeline job for the given
|
|
5819
|
+
memory and resets the corresponding per-stage status field(s) to
|
|
5820
|
+
`queued`. Used to recover individual memories from transient
|
|
5821
|
+
worker failures or to replay a stage after a code change.
|
|
5822
|
+
|
|
5823
|
+
* @param id - Memory id (admin can target any tenant).
|
|
5824
|
+
* @param body - Request body
|
|
5825
|
+
*/
|
|
5826
|
+
async adminRerunMemoryPipeline(id, body) {
|
|
4719
5827
|
const request = new Request({
|
|
4720
5828
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4721
|
-
method: "
|
|
4722
|
-
path: "/api/admin/
|
|
5829
|
+
method: "POST",
|
|
5830
|
+
path: "/api/admin/memories/{id}/rerun",
|
|
4723
5831
|
config: this.config,
|
|
4724
5832
|
retry: {
|
|
4725
5833
|
attempts: 3,
|
|
@@ -4729,20 +5837,34 @@ var AdminService = class extends BaseService {
|
|
|
4729
5837
|
backoffFactor: 2
|
|
4730
5838
|
}
|
|
4731
5839
|
});
|
|
5840
|
+
request.addPathParam("id", {
|
|
5841
|
+
key: "id",
|
|
5842
|
+
value: id,
|
|
5843
|
+
explode: false,
|
|
5844
|
+
encode: true,
|
|
5845
|
+
style: "simple",
|
|
5846
|
+
isLimit: false,
|
|
5847
|
+
isOffset: false,
|
|
5848
|
+
isCursor: false
|
|
5849
|
+
});
|
|
5850
|
+
if (body !== void 0) {
|
|
5851
|
+
request.addBody(body);
|
|
5852
|
+
}
|
|
4732
5853
|
return this.client.call(request);
|
|
4733
5854
|
}
|
|
4734
5855
|
/**
|
|
4735
|
-
*
|
|
4736
|
-
*
|
|
4737
|
-
|
|
5856
|
+
* Per-queue depth + failure counts for the memory-creation pipelines
|
|
5857
|
+
* Returns BullMQ `getJobCounts()` for each known pipeline queue. Queues
|
|
5858
|
+
that have not yet been provisioned (e.g. `summary-qna` while task 2.3
|
|
5859
|
+
is in flight) are reported with `{ status: "not_configured" }` rather
|
|
5860
|
+
than throwing.
|
|
4738
5861
|
|
|
4739
|
-
* @param body - Request body
|
|
4740
5862
|
*/
|
|
4741
|
-
async
|
|
5863
|
+
async adminGetPipelineHealth() {
|
|
4742
5864
|
const request = new Request({
|
|
4743
5865
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
4744
|
-
method: "
|
|
4745
|
-
path: "/api/admin/
|
|
5866
|
+
method: "GET",
|
|
5867
|
+
path: "/api/admin/pipeline/health",
|
|
4746
5868
|
config: this.config,
|
|
4747
5869
|
retry: {
|
|
4748
5870
|
attempts: 3,
|
|
@@ -4752,9 +5874,37 @@ var AdminService = class extends BaseService {
|
|
|
4752
5874
|
backoffFactor: 2
|
|
4753
5875
|
}
|
|
4754
5876
|
});
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
5877
|
+
return this.client.call(request);
|
|
5878
|
+
}
|
|
5879
|
+
/**
|
|
5880
|
+
* Inspect per-stage pipeline status for a single memory
|
|
5881
|
+
* Debugging affordance — returns the six per-stage status fields and graphSkipReason.
|
|
5882
|
+
* @param id -
|
|
5883
|
+
*/
|
|
5884
|
+
async adminGetMemoryPipelineStatus(id) {
|
|
5885
|
+
const request = new Request({
|
|
5886
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
5887
|
+
method: "GET",
|
|
5888
|
+
path: "/api/admin/memories/{id}/pipeline-status",
|
|
5889
|
+
config: this.config,
|
|
5890
|
+
retry: {
|
|
5891
|
+
attempts: 3,
|
|
5892
|
+
delayMs: 150,
|
|
5893
|
+
maxDelayMs: 5e3,
|
|
5894
|
+
jitterMs: 50,
|
|
5895
|
+
backoffFactor: 2
|
|
5896
|
+
}
|
|
5897
|
+
});
|
|
5898
|
+
request.addPathParam("id", {
|
|
5899
|
+
key: "id",
|
|
5900
|
+
value: id,
|
|
5901
|
+
explode: false,
|
|
5902
|
+
encode: true,
|
|
5903
|
+
style: "simple",
|
|
5904
|
+
isLimit: false,
|
|
5905
|
+
isOffset: false,
|
|
5906
|
+
isCursor: false
|
|
5907
|
+
});
|
|
4758
5908
|
return this.client.call(request);
|
|
4759
5909
|
}
|
|
4760
5910
|
};
|
|
@@ -4763,7 +5913,9 @@ var AdminService = class extends BaseService {
|
|
|
4763
5913
|
import { z } from "zod";
|
|
4764
5914
|
var error = z.object({
|
|
4765
5915
|
/** Error message */
|
|
4766
|
-
error: z.string()
|
|
5916
|
+
error: z.string(),
|
|
5917
|
+
/** Optional constructor name of the underlying error. Present on selected 500 responses for client diagnostics; absent on most error responses. */
|
|
5918
|
+
errorClass: z.string().optional()
|
|
4767
5919
|
});
|
|
4768
5920
|
var pagination = z.object({
|
|
4769
5921
|
/** Maximum number of items per page */
|
|
@@ -4773,7 +5925,23 @@ var pagination = z.object({
|
|
|
4773
5925
|
/** Total number of items */
|
|
4774
5926
|
count: z.number().min(0)
|
|
4775
5927
|
});
|
|
4776
|
-
var
|
|
5928
|
+
var codeContext = z.object({
|
|
5929
|
+
/** Product name (e.g. 'memnexus', 'spearmint') */
|
|
5930
|
+
product: z.string().max(200).optional(),
|
|
5931
|
+
/** Repository name, if different from product */
|
|
5932
|
+
repo: z.string().max(200).optional(),
|
|
5933
|
+
/** Service or package name (e.g. 'core-api', 'mcp-server', 'cli') */
|
|
5934
|
+
service: z.string().max(200).optional(),
|
|
5935
|
+
/** Subsystem or component (e.g. 'extraction-pipeline', 'search', 'billing') */
|
|
5936
|
+
component: z.string().max(200).optional(),
|
|
5937
|
+
/** Team that produced this knowledge (e.g. 'extraction', 'mcp', 'platform') */
|
|
5938
|
+
team: z.string().max(200).optional(),
|
|
5939
|
+
/** Agent role or persona (e.g. 'team-lead', 'implementer', 'reviewer') */
|
|
5940
|
+
role: z.string().max(200).optional(),
|
|
5941
|
+
/** Additional project-specific scope tags */
|
|
5942
|
+
extra: z.object({}).catchall(z.string().max(500)).optional()
|
|
5943
|
+
}).nullable();
|
|
5944
|
+
var memory = z.lazy(() => z.object({
|
|
4777
5945
|
/** Unique memory identifier */
|
|
4778
5946
|
id: z.string(),
|
|
4779
5947
|
/** Optional human-readable name for deterministic retrieval. Only the HEAD version carries the name. */
|
|
@@ -4796,6 +5964,8 @@ var memory = z.object({
|
|
|
4796
5964
|
validFrom: z.string().datetime().optional(),
|
|
4797
5965
|
/** Validity end time (when this fact expires, null means never expires) */
|
|
4798
5966
|
validTo: z.string().datetime().nullable().optional(),
|
|
5967
|
+
/** Environment context for memory scoping — product, service, team, component, role. */
|
|
5968
|
+
codeContext: codeContext.optional(),
|
|
4799
5969
|
/** Creation timestamp */
|
|
4800
5970
|
createdAt: z.string().datetime(),
|
|
4801
5971
|
/** Last update timestamp */
|
|
@@ -4805,23 +5975,57 @@ var memory = z.object({
|
|
|
4805
5975
|
/** Basis for the confidence score */
|
|
4806
5976
|
confidenceBasis: z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
4807
5977
|
/** Effective state of the memory in the narrative */
|
|
4808
|
-
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional(),
|
|
4809
|
-
/**
|
|
4810
|
-
|
|
5978
|
+
effectiveState: z.enum(["current", "superseded", "contradicted", "duplicate"]).optional(),
|
|
5979
|
+
/** Authority level: directive (mandates) > decision (choices with reasoning) > observation (learned during work) > auto-captured (generated content) */
|
|
5980
|
+
authority: z.enum(["directive", "decision", "observation", "auto-captured"]).optional(),
|
|
5981
|
+
/** Legacy aggregate extraction status. DERIVED on read from the six per-stage statuses (contentEmbeddingStatus, summaryStatus, questionsStatus, summaryEmbeddingStatus, questionsEmbeddingStatus, graphStatus). Preserved for SDK compatibility per PRD memory-creation-pipeline-v2 §5 Q7. */
|
|
5982
|
+
extractionStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
4811
5983
|
/** When extraction was completed */
|
|
4812
5984
|
extractionCompletedAt: z.string().datetime().optional(),
|
|
5985
|
+
/** Pipeline 2 content-embedding stage status. Tracks the queue lifecycle for writing m.embedding (primary content embedding). */
|
|
5986
|
+
contentEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5987
|
+
/** AI-generated summary of the memory content */
|
|
5988
|
+
summary: z.string().optional(),
|
|
5989
|
+
/** Pipeline 1 summary stage status. Tracks generation of m.summary by the summary-qna LLM call. */
|
|
5990
|
+
summaryStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5991
|
+
/** Pipeline 1 questions stage status. Tracks generation of anticipated Question nodes by the summary-qna LLM call. */
|
|
5992
|
+
questionsStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5993
|
+
/** Pipeline 2 summary-embedding stage status. Tracks the queue lifecycle for writing m.summaryEmbedding (depends on summaryStatus=completed). */
|
|
5994
|
+
summaryEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5995
|
+
/** Pipeline 2 question-embedding stage status. Tracks the queue lifecycle for writing Question.embedding for each anticipated question (depends on questionsStatus=completed). */
|
|
5996
|
+
questionsEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5997
|
+
/** Pipeline 3 graph-extraction stage status. Tracks generation of entities, facts, topics, authority, and memory-type. Replaces the role formerly played by the monolithic extractionStatus writer. */
|
|
5998
|
+
graphStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5999
|
+
/** When graphStatus=skipped, records why graph extraction was skipped. Mirrors the legacy extractionSkipReason field but scoped to the graph pipeline. */
|
|
6000
|
+
graphSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
6001
|
+
/** When extractionStatus=skipped, records why extraction was skipped. global_disabled = GRAPH_EXTRACTION_ENABLED=false kill switch. */
|
|
6002
|
+
extractionSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy"]).optional(),
|
|
6003
|
+
/** Status of primary (Ollama) embedding generation via durable queue */
|
|
6004
|
+
embeddingStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6005
|
+
/** Status of secondary (OpenAI) dual-write embedding generation via durable queue */
|
|
6006
|
+
embeddingOpenaiStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6007
|
+
/** True if the primary content embedding used a head-truncated input (model context exceeded). */
|
|
6008
|
+
embeddingTruncated: z.boolean().optional(),
|
|
6009
|
+
/** Token count of the original content (pre-truncation, cl100k proxy). Useful for identifying under-indexed memories. */
|
|
6010
|
+
embeddingOriginalTokens: z.number().min(0).optional(),
|
|
6011
|
+
/** Smart-field strategy used to produce the primary content embedding. */
|
|
6012
|
+
embeddingStrategy: z.enum(["full", "head-truncated", "summary-selected", "question-selected"]).optional(),
|
|
4813
6013
|
/** Number of topics extracted from content */
|
|
4814
6014
|
extractedTopicCount: z.number().min(0).optional(),
|
|
4815
6015
|
/** Number of facts extracted from content */
|
|
4816
6016
|
extractedFactCount: z.number().min(0).optional(),
|
|
4817
6017
|
/** Number of entities extracted from content */
|
|
4818
6018
|
extractedEntityCount: z.number().min(0).optional(),
|
|
6019
|
+
/** Number of memories this memory contradicts via outgoing CONTRADICTS relationships */
|
|
6020
|
+
conflictCount: z.number().min(0).optional(),
|
|
6021
|
+
/** Memory visibility level. Null/undefined treated as 'private' for backward compatibility. 'admin_visible' is computed at retrieval time when an org owner/admin queries another member's post-join memory and is never accepted on writes. */
|
|
6022
|
+
visibility: z.enum(["private", "shared_with_users", "shared_with_org", "admin_visible"]).optional(),
|
|
6023
|
+
/** User IDs this memory is shared with (only populated when visibility = 'shared_with_users') */
|
|
6024
|
+
sharedWith: z.array(z.string()).optional(),
|
|
4819
6025
|
/** Topics explicitly provided by the user */
|
|
4820
6026
|
userTopics: z.array(z.string()).optional(),
|
|
4821
6027
|
/** Topics automatically extracted from content */
|
|
4822
6028
|
extractedTopics: z.array(z.string()).optional(),
|
|
4823
|
-
/** Agent session ID that created this memory (MCP session ID or CLI session UUID). Used to group memories by agent instance for conversation threading. */
|
|
4824
|
-
agentSessionId: z.string().nullable().optional(),
|
|
4825
6029
|
/** Entities extracted from memory content */
|
|
4826
6030
|
entities: z.array(z.object({
|
|
4827
6031
|
/** Entity name */
|
|
@@ -4830,13 +6034,41 @@ var memory = z.object({
|
|
|
4830
6034
|
type: z.string(),
|
|
4831
6035
|
/** Extraction confidence */
|
|
4832
6036
|
confidence: z.number().min(0).max(1).optional()
|
|
4833
|
-
})).optional()
|
|
6037
|
+
})).optional(),
|
|
6038
|
+
/** Task identifier for agentic loop memories */
|
|
6039
|
+
taskId: z.string().nullable().optional(),
|
|
6040
|
+
/** Task outcome status */
|
|
6041
|
+
outcome: z.enum(["resolved", "unresolved"]).nullable().optional(),
|
|
6042
|
+
/** Attempt number within the task */
|
|
6043
|
+
attemptNumber: z.number().nullable().optional(),
|
|
6044
|
+
/** Distillation pipeline stage status */
|
|
6045
|
+
distillStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).nullable().optional(),
|
|
6046
|
+
/** Reason distillation was skipped */
|
|
6047
|
+
distillSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
6048
|
+
/** Error message if distillation failed */
|
|
6049
|
+
distillError: z.string().nullable().optional(),
|
|
6050
|
+
/** ISO 8601 timestamp when distillation completed */
|
|
6051
|
+
distillCompletedAt: z.string().nullable().optional()
|
|
6052
|
+
}));
|
|
6053
|
+
var precomputedMemoryFields = z.object({
|
|
6054
|
+
/** Pre-computed memory summary. When supplied, summary-qna LLM call is skipped and m.summary is set inline. */
|
|
6055
|
+
summary: z.string().max(2e3).optional(),
|
|
6056
|
+
/** Pre-computed anticipated questions. When supplied, the questions stage of the summary-qna LLM call is skipped and Question nodes are created inline. Hard-capped at 20. */
|
|
6057
|
+
questions: z.array(z.string().max(500)).max(20).optional(),
|
|
6058
|
+
/** Pre-computed embeddings keyed by Pipeline 2 job kind (content / summary / question). */
|
|
6059
|
+
embeddings: z.object({
|
|
6060
|
+
/** Pre-computed content embedding (m.embedding). Bypasses the content-embedding queue. */
|
|
6061
|
+
content: z.array(z.number()).optional(),
|
|
6062
|
+
/** Pre-computed summary embedding (m.summaryEmbedding). Bypasses the summary-embedding queue. */
|
|
6063
|
+
summary: z.array(z.number()).optional(),
|
|
6064
|
+
/** Pre-computed per-question embeddings — must have the same length as `questions` when both are supplied. */
|
|
6065
|
+
questions: z.array(z.array(z.number())).optional()
|
|
6066
|
+
}).optional()
|
|
4834
6067
|
});
|
|
4835
|
-
var createMemoryRequest = z.object({
|
|
4836
|
-
/** Conversation ID - use "NEW" to create a new conversation
|
|
4837
|
-
conversationId: z.string().min(1),
|
|
4838
|
-
/** Agent session ID (e.g. MCP session ID, Claude Code session UUID). When
|
|
4839
|
-
agentSessionId: z.string().max(200).optional(),
|
|
6068
|
+
var createMemoryRequest = z.lazy(() => z.object({
|
|
6069
|
+
/** Conversation ID - use "NEW" to always create a new conversation, provide an existing ID to append to it, or omit to auto-assign via claudeSessionId session grouping. */
|
|
6070
|
+
conversationId: z.string().min(1).optional(),
|
|
6071
|
+
/** Agent session ID (e.g. MCP session ID, Claude Code session UUID). When conversationId is omitted, reuses or creates a conversation for this session (automatic grouping). Ignored when conversationId is explicitly provided. Works with any MCP client (Claude, Copilot, Cursor, etc.). */
|
|
4840
6072
|
claudeSessionId: z.string().max(200).optional(),
|
|
4841
6073
|
/** Optional human-readable name for deterministic retrieval. Must be unique per user. */
|
|
4842
6074
|
name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/).optional(),
|
|
@@ -4855,8 +6087,32 @@ var createMemoryRequest = z.object({
|
|
|
4855
6087
|
/** Validity start time (when this fact becomes valid, ISO 8601 format) */
|
|
4856
6088
|
validFrom: z.string().datetime().optional(),
|
|
4857
6089
|
/** Validity end time (when this fact expires, ISO 8601 format, omit for never expires) */
|
|
4858
|
-
validTo: z.string().datetime().optional()
|
|
4859
|
-
|
|
6090
|
+
validTo: z.string().datetime().optional(),
|
|
6091
|
+
codeContext: z.object({
|
|
6092
|
+
/** Product name (e.g. 'memnexus', 'spearmint') */
|
|
6093
|
+
product: z.string().max(200).optional(),
|
|
6094
|
+
/** Repository name, if different from product */
|
|
6095
|
+
repo: z.string().max(200).optional(),
|
|
6096
|
+
/** Service or package name (e.g. 'core-api', 'mcp-server', 'cli') */
|
|
6097
|
+
service: z.string().max(200).optional(),
|
|
6098
|
+
/** Subsystem or component (e.g. 'extraction-pipeline', 'search', 'billing') */
|
|
6099
|
+
component: z.string().max(200).optional(),
|
|
6100
|
+
/** Team that produced this knowledge (e.g. 'extraction', 'mcp', 'platform') */
|
|
6101
|
+
team: z.string().max(200).optional(),
|
|
6102
|
+
/** Agent role or persona (e.g. 'team-lead', 'implementer', 'reviewer') */
|
|
6103
|
+
role: z.string().max(200).optional(),
|
|
6104
|
+
/** Additional project-specific scope tags */
|
|
6105
|
+
extra: z.object({}).catchall(z.string().max(500)).optional()
|
|
6106
|
+
}).optional(),
|
|
6107
|
+
/** Privileged-only short-circuit for Pipeline 1/2 — admin/internal/test callers may pre-supply summary, questions, and/or embeddings to bypass LLM and embedding work at create time. Silently ignored for non-privileged callers. */
|
|
6108
|
+
precomputed: precomputedMemoryFields.optional(),
|
|
6109
|
+
/** Task identifier for grouping memories across agentic loop attempts */
|
|
6110
|
+
taskId: z.string().max(200).optional(),
|
|
6111
|
+
/** Task outcome status for this memory */
|
|
6112
|
+
outcome: z.enum(["resolved", "unresolved"]).optional(),
|
|
6113
|
+
/** Request distillation of this memory (Pro/Enterprise only) */
|
|
6114
|
+
distill: z.boolean().optional()
|
|
6115
|
+
}));
|
|
4860
6116
|
var updateMemoryRequest = z.object({
|
|
4861
6117
|
/** Updated memory content */
|
|
4862
6118
|
content: z.string().min(1).max(5e4).optional(),
|
|
@@ -4867,7 +6123,9 @@ var updateMemoryRequest = z.object({
|
|
|
4867
6123
|
/** Updated context or domain */
|
|
4868
6124
|
context: z.string().max(200).optional(),
|
|
4869
6125
|
/** Updated topics */
|
|
4870
|
-
topics: z.array(z.string().max(100)).max(50).optional()
|
|
6126
|
+
topics: z.array(z.string().max(100)).max(50).optional(),
|
|
6127
|
+
/** Task outcome status. Set to null to clear. */
|
|
6128
|
+
outcome: z.enum(["resolved", "unresolved"]).nullable().optional()
|
|
4871
6129
|
});
|
|
4872
6130
|
var createMemoryResponseMeta = z.object({
|
|
4873
6131
|
/** Conversation ID (actual ID if "NEW" was provided) */
|
|
@@ -4883,7 +6141,7 @@ var createMemoryResponse = z.lazy(() => z.object({
|
|
|
4883
6141
|
data: memory,
|
|
4884
6142
|
meta: createMemoryResponseMeta
|
|
4885
6143
|
}));
|
|
4886
|
-
var relatedMemoryResult = z.object({
|
|
6144
|
+
var relatedMemoryResult = z.lazy(() => z.object({
|
|
4887
6145
|
memory: z.object({
|
|
4888
6146
|
/** Unique memory identifier */
|
|
4889
6147
|
id: z.string(),
|
|
@@ -4907,6 +6165,8 @@ var relatedMemoryResult = z.object({
|
|
|
4907
6165
|
validFrom: z.string().datetime().optional(),
|
|
4908
6166
|
/** Validity end time (when this fact expires, null means never expires) */
|
|
4909
6167
|
validTo: z.string().datetime().nullable().optional(),
|
|
6168
|
+
/** Environment context for memory scoping — product, service, team, component, role. */
|
|
6169
|
+
codeContext: codeContext.optional(),
|
|
4910
6170
|
/** Creation timestamp */
|
|
4911
6171
|
createdAt: z.string().datetime(),
|
|
4912
6172
|
/** Last update timestamp */
|
|
@@ -4916,23 +6176,57 @@ var relatedMemoryResult = z.object({
|
|
|
4916
6176
|
/** Basis for the confidence score */
|
|
4917
6177
|
confidenceBasis: z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
4918
6178
|
/** Effective state of the memory in the narrative */
|
|
4919
|
-
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional(),
|
|
4920
|
-
/**
|
|
4921
|
-
|
|
6179
|
+
effectiveState: z.enum(["current", "superseded", "contradicted", "duplicate"]).optional(),
|
|
6180
|
+
/** Authority level: directive (mandates) > decision (choices with reasoning) > observation (learned during work) > auto-captured (generated content) */
|
|
6181
|
+
authority: z.enum(["directive", "decision", "observation", "auto-captured"]).optional(),
|
|
6182
|
+
/** Legacy aggregate extraction status. DERIVED on read from the six per-stage statuses (contentEmbeddingStatus, summaryStatus, questionsStatus, summaryEmbeddingStatus, questionsEmbeddingStatus, graphStatus). Preserved for SDK compatibility per PRD memory-creation-pipeline-v2 §5 Q7. */
|
|
6183
|
+
extractionStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
4922
6184
|
/** When extraction was completed */
|
|
4923
6185
|
extractionCompletedAt: z.string().datetime().optional(),
|
|
6186
|
+
/** Pipeline 2 content-embedding stage status. Tracks the queue lifecycle for writing m.embedding (primary content embedding). */
|
|
6187
|
+
contentEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6188
|
+
/** AI-generated summary of the memory content */
|
|
6189
|
+
summary: z.string().optional(),
|
|
6190
|
+
/** Pipeline 1 summary stage status. Tracks generation of m.summary by the summary-qna LLM call. */
|
|
6191
|
+
summaryStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6192
|
+
/** Pipeline 1 questions stage status. Tracks generation of anticipated Question nodes by the summary-qna LLM call. */
|
|
6193
|
+
questionsStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6194
|
+
/** Pipeline 2 summary-embedding stage status. Tracks the queue lifecycle for writing m.summaryEmbedding (depends on summaryStatus=completed). */
|
|
6195
|
+
summaryEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6196
|
+
/** Pipeline 2 question-embedding stage status. Tracks the queue lifecycle for writing Question.embedding for each anticipated question (depends on questionsStatus=completed). */
|
|
6197
|
+
questionsEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6198
|
+
/** Pipeline 3 graph-extraction stage status. Tracks generation of entities, facts, topics, authority, and memory-type. Replaces the role formerly played by the monolithic extractionStatus writer. */
|
|
6199
|
+
graphStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6200
|
+
/** When graphStatus=skipped, records why graph extraction was skipped. Mirrors the legacy extractionSkipReason field but scoped to the graph pipeline. */
|
|
6201
|
+
graphSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
6202
|
+
/** When extractionStatus=skipped, records why extraction was skipped. global_disabled = GRAPH_EXTRACTION_ENABLED=false kill switch. */
|
|
6203
|
+
extractionSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy"]).optional(),
|
|
6204
|
+
/** Status of primary (Ollama) embedding generation via durable queue */
|
|
6205
|
+
embeddingStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6206
|
+
/** Status of secondary (OpenAI) dual-write embedding generation via durable queue */
|
|
6207
|
+
embeddingOpenaiStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
6208
|
+
/** True if the primary content embedding used a head-truncated input (model context exceeded). */
|
|
6209
|
+
embeddingTruncated: z.boolean().optional(),
|
|
6210
|
+
/** Token count of the original content (pre-truncation, cl100k proxy). Useful for identifying under-indexed memories. */
|
|
6211
|
+
embeddingOriginalTokens: z.number().min(0).optional(),
|
|
6212
|
+
/** Smart-field strategy used to produce the primary content embedding. */
|
|
6213
|
+
embeddingStrategy: z.enum(["full", "head-truncated", "summary-selected", "question-selected"]).optional(),
|
|
4924
6214
|
/** Number of topics extracted from content */
|
|
4925
6215
|
extractedTopicCount: z.number().min(0).optional(),
|
|
4926
6216
|
/** Number of facts extracted from content */
|
|
4927
6217
|
extractedFactCount: z.number().min(0).optional(),
|
|
4928
6218
|
/** Number of entities extracted from content */
|
|
4929
6219
|
extractedEntityCount: z.number().min(0).optional(),
|
|
6220
|
+
/** Number of memories this memory contradicts via outgoing CONTRADICTS relationships */
|
|
6221
|
+
conflictCount: z.number().min(0).optional(),
|
|
6222
|
+
/** Memory visibility level. Null/undefined treated as 'private' for backward compatibility. 'admin_visible' is computed at retrieval time when an org owner/admin queries another member's post-join memory and is never accepted on writes. */
|
|
6223
|
+
visibility: z.enum(["private", "shared_with_users", "shared_with_org", "admin_visible"]).optional(),
|
|
6224
|
+
/** User IDs this memory is shared with (only populated when visibility = 'shared_with_users') */
|
|
6225
|
+
sharedWith: z.array(z.string()).optional(),
|
|
4930
6226
|
/** Topics explicitly provided by the user */
|
|
4931
6227
|
userTopics: z.array(z.string()).optional(),
|
|
4932
6228
|
/** Topics automatically extracted from content */
|
|
4933
6229
|
extractedTopics: z.array(z.string()).optional(),
|
|
4934
|
-
/** Agent session ID that created this memory (MCP session ID or CLI session UUID). Used to group memories by agent instance for conversation threading. */
|
|
4935
|
-
agentSessionId: z.string().nullable().optional(),
|
|
4936
6230
|
/** Entities extracted from memory content */
|
|
4937
6231
|
entities: z.array(z.object({
|
|
4938
6232
|
/** Entity name */
|
|
@@ -4941,7 +6235,21 @@ var relatedMemoryResult = z.object({
|
|
|
4941
6235
|
type: z.string(),
|
|
4942
6236
|
/** Extraction confidence */
|
|
4943
6237
|
confidence: z.number().min(0).max(1).optional()
|
|
4944
|
-
})).optional()
|
|
6238
|
+
})).optional(),
|
|
6239
|
+
/** Task identifier for agentic loop memories */
|
|
6240
|
+
taskId: z.string().nullable().optional(),
|
|
6241
|
+
/** Task outcome status */
|
|
6242
|
+
outcome: z.enum(["resolved", "unresolved"]).nullable().optional(),
|
|
6243
|
+
/** Attempt number within the task */
|
|
6244
|
+
attemptNumber: z.number().nullable().optional(),
|
|
6245
|
+
/** Distillation pipeline stage status */
|
|
6246
|
+
distillStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).nullable().optional(),
|
|
6247
|
+
/** Reason distillation was skipped */
|
|
6248
|
+
distillSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
6249
|
+
/** Error message if distillation failed */
|
|
6250
|
+
distillError: z.string().nullable().optional(),
|
|
6251
|
+
/** ISO 8601 timestamp when distillation completed */
|
|
6252
|
+
distillCompletedAt: z.string().nullable().optional()
|
|
4945
6253
|
}),
|
|
4946
6254
|
/** Relevance score (0-1). For similar: semantic similarity. For related: topic overlap ratio. For conversation: position score. */
|
|
4947
6255
|
score: z.number().min(0).max(1),
|
|
@@ -4949,7 +6257,7 @@ var relatedMemoryResult = z.object({
|
|
|
4949
6257
|
relationship: z.string(),
|
|
4950
6258
|
/** Topics shared with the source memory (only for topic relationship) */
|
|
4951
6259
|
sharedTopics: z.array(z.string()).optional()
|
|
4952
|
-
});
|
|
6260
|
+
}));
|
|
4953
6261
|
var getMemoryResponse = z.lazy(() => z.object({
|
|
4954
6262
|
data: memory
|
|
4955
6263
|
}));
|
|
@@ -4961,7 +6269,27 @@ var updateNamedMemoryRequest = z.object({
|
|
|
4961
6269
|
/** Context or domain */
|
|
4962
6270
|
context: z.string().max(200).optional(),
|
|
4963
6271
|
/** Associated topics */
|
|
4964
|
-
topics: z.array(z.string().max(100)).max(50).optional()
|
|
6272
|
+
topics: z.array(z.string().max(100)).max(50).optional(),
|
|
6273
|
+
/** Conversation to group this version with (overrides previous version's conversation) */
|
|
6274
|
+
conversationId: z.string().max(200).optional(),
|
|
6275
|
+
codeContext: z.object({
|
|
6276
|
+
/** Product name (e.g. 'memnexus', 'spearmint') */
|
|
6277
|
+
product: z.string().max(200).optional(),
|
|
6278
|
+
/** Repository name, if different from product */
|
|
6279
|
+
repo: z.string().max(200).optional(),
|
|
6280
|
+
/** Service or package name (e.g. 'core-api', 'mcp-server', 'cli') */
|
|
6281
|
+
service: z.string().max(200).optional(),
|
|
6282
|
+
/** Subsystem or component (e.g. 'extraction-pipeline', 'search', 'billing') */
|
|
6283
|
+
component: z.string().max(200).optional(),
|
|
6284
|
+
/** Team that produced this knowledge (e.g. 'extraction', 'mcp', 'platform') */
|
|
6285
|
+
team: z.string().max(200).optional(),
|
|
6286
|
+
/** Agent role or persona (e.g. 'team-lead', 'implementer', 'reviewer') */
|
|
6287
|
+
role: z.string().max(200).optional(),
|
|
6288
|
+
/** Additional project-specific scope tags */
|
|
6289
|
+
extra: z.object({}).catchall(z.string().max(500)).optional()
|
|
6290
|
+
}).optional(),
|
|
6291
|
+
/** Additional memory ID that this version supersedes (beyond the implicit version chain) */
|
|
6292
|
+
supersedes: z.string().uuid().optional()
|
|
4965
6293
|
});
|
|
4966
6294
|
var namedMemoryHistoryResponse = z.object({
|
|
4967
6295
|
/** Human-readable name for deterministic retrieval (kebab-case, 2-64 chars) */
|
|
@@ -4974,16 +6302,16 @@ var namedMemoryHistoryResponse = z.object({
|
|
|
4974
6302
|
/** Memory content at this version */
|
|
4975
6303
|
content: z.string(),
|
|
4976
6304
|
/** Effective state — HEAD version is 'current', older versions are 'superseded' */
|
|
4977
|
-
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional(),
|
|
6305
|
+
effectiveState: z.enum(["current", "superseded", "contradicted", "duplicate"]).optional(),
|
|
4978
6306
|
/** When this version was created */
|
|
4979
6307
|
createdAt: z.string().datetime()
|
|
4980
6308
|
}))
|
|
4981
6309
|
});
|
|
4982
6310
|
var batchGetMemoriesRequest = z.object({
|
|
4983
|
-
/** Array of memory IDs to retrieve */
|
|
4984
|
-
ids: z.array(z.string().
|
|
4985
|
-
/** Detail level for each memory. 'minimal' returns raw memory only (default, backward compatible). 'standard' adds topics, entities, facts, and relationships. */
|
|
4986
|
-
detail: z.enum(["minimal", "standard"]).optional()
|
|
6311
|
+
/** Array of memory IDs to retrieve. Non-existent or malformed IDs are returned in the 'missing' array rather than failing the request. */
|
|
6312
|
+
ids: z.array(z.string().min(1).max(200)).min(1).max(100),
|
|
6313
|
+
/** Detail level for each memory. 'minimal' returns raw memory only (default, backward compatible). 'standard' adds topics, entities, facts, and relationships. 'full' additionally adds conversation context and relationship target previews. */
|
|
6314
|
+
detail: z.enum(["minimal", "standard", "full"]).optional()
|
|
4987
6315
|
});
|
|
4988
6316
|
var batchGetMemoriesMeta = z.object({
|
|
4989
6317
|
/** Number of IDs requested */
|
|
@@ -5084,6 +6412,73 @@ var pattern = z.object({
|
|
|
5084
6412
|
/** Confidence score (0-1) */
|
|
5085
6413
|
confidence: z.number().min(0).max(1)
|
|
5086
6414
|
});
|
|
6415
|
+
var compileInstructionsRequest = z.object({
|
|
6416
|
+
conversationContext: z.array(z.string().max(100)).max(20).optional(),
|
|
6417
|
+
currentQuery: z.string().max(2e3).optional(),
|
|
6418
|
+
tokenBudget: z.number().min(50).max(2e3).optional(),
|
|
6419
|
+
minConfidence: z.number().min(0).max(1).optional(),
|
|
6420
|
+
maxInstructions: z.number().min(1).max(10).optional()
|
|
6421
|
+
});
|
|
6422
|
+
var compileInstructionsResponse = z.object({
|
|
6423
|
+
instructions: z.array(z.object({
|
|
6424
|
+
patternId: z.string(),
|
|
6425
|
+
instruction: z.string().max(500),
|
|
6426
|
+
confidence: z.number(),
|
|
6427
|
+
priority: z.number(),
|
|
6428
|
+
source: z.enum(["learned", "explicit", "manual"]),
|
|
6429
|
+
patternType: z.string(),
|
|
6430
|
+
activatedBy: z.array(z.string()),
|
|
6431
|
+
recommendationId: z.string().optional(),
|
|
6432
|
+
triggerContext: z.string().optional(),
|
|
6433
|
+
evidenceSummary: z.string().optional(),
|
|
6434
|
+
firstSurfacing: z.boolean().optional()
|
|
6435
|
+
})),
|
|
6436
|
+
summary: z.string().max(1e3),
|
|
6437
|
+
tokenCount: z.number(),
|
|
6438
|
+
patternsEvaluated: z.number(),
|
|
6439
|
+
patternsActivated: z.number(),
|
|
6440
|
+
conflictsResolved: z.array(z.object({
|
|
6441
|
+
winnerId: z.string(),
|
|
6442
|
+
loserId: z.string(),
|
|
6443
|
+
strategy: z.enum(["priority_override"])
|
|
6444
|
+
})),
|
|
6445
|
+
systemState: z.enum(["ok", "cold_start", "pending_only", "no_match"]).optional(),
|
|
6446
|
+
pendingCount: z.number().min(0).optional(),
|
|
6447
|
+
patternsExcluded: z.number().min(0).optional()
|
|
6448
|
+
});
|
|
6449
|
+
var recommendation = z.object({
|
|
6450
|
+
id: z.string().uuid(),
|
|
6451
|
+
userId: z.string(),
|
|
6452
|
+
triggerContext: z.string().max(500),
|
|
6453
|
+
practice: z.string().max(1e3),
|
|
6454
|
+
evidenceSummary: z.string().max(2e3).optional(),
|
|
6455
|
+
source: z.enum(["explicit", "learned", "manual"]),
|
|
6456
|
+
outcomeSignal: z.enum(["positive", "neutral", "unknown"]),
|
|
6457
|
+
confidence: z.number().min(0).max(1),
|
|
6458
|
+
evidenceMemoryIds: z.array(z.string().uuid()).max(50).optional(),
|
|
6459
|
+
triggerEmbeddingStatus: z.enum(["pending", "complete", "failed"]),
|
|
6460
|
+
applicationCount: z.number().min(0),
|
|
6461
|
+
provisional: z.boolean(),
|
|
6462
|
+
status: z.enum(["pending_review", "active", "paused", "dismissed", "superseded"]),
|
|
6463
|
+
validFrom: z.string().datetime().optional(),
|
|
6464
|
+
validUntil: z.string().datetime().nullable().optional(),
|
|
6465
|
+
supersededBy: z.string().uuid().nullable().optional(),
|
|
6466
|
+
createdAt: z.string().datetime(),
|
|
6467
|
+
updatedAt: z.string().datetime()
|
|
6468
|
+
});
|
|
6469
|
+
var createRecommendationRequest = z.object({
|
|
6470
|
+
triggerContext: z.string().max(500),
|
|
6471
|
+
practice: z.string().max(1e3),
|
|
6472
|
+
evidenceSummary: z.string().max(2e3).optional(),
|
|
6473
|
+
outcomeSignal: z.enum(["positive", "neutral", "unknown"]).optional(),
|
|
6474
|
+
evidenceMemoryIds: z.array(z.string().uuid()).max(50).optional(),
|
|
6475
|
+
activateImmediately: z.boolean().optional()
|
|
6476
|
+
});
|
|
6477
|
+
var matchRecommendationsRequest = z.object({
|
|
6478
|
+
content: z.string().max(1e4),
|
|
6479
|
+
limit: z.number().min(1).max(5).optional(),
|
|
6480
|
+
similarityThreshold: z.number().min(0.1).max(0.99).optional()
|
|
6481
|
+
});
|
|
5087
6482
|
var serviceCheck = z.object({
|
|
5088
6483
|
/** Service status */
|
|
5089
6484
|
status: z.enum(["up", "down"]),
|
|
@@ -5143,32 +6538,44 @@ var searchRequest = z.object({
|
|
|
5143
6538
|
memoryType: z.enum(["episodic", "semantic", "procedural"]).optional(),
|
|
5144
6539
|
/** Filter by conversation ID */
|
|
5145
6540
|
conversationId: z.string().optional(),
|
|
6541
|
+
/** Task-scoped retrieval: returns own-history first, fills remainder with cross-task results. */
|
|
6542
|
+
taskId: z.string().max(200).optional(),
|
|
6543
|
+
/** Filter by task outcome. Use 'resolved' to find successful approaches from past tasks. */
|
|
6544
|
+
outcomeFilter: z.enum(["resolved", "unresolved", "any"]).optional(),
|
|
5146
6545
|
/** Include topics associated with matched memories (defaults to false for performance) */
|
|
5147
6546
|
includeTopics: z.boolean().optional(),
|
|
5148
6547
|
/** Include entities mentioned in matched memories (defaults to false for performance) */
|
|
5149
6548
|
includeEntities: z.boolean().optional(),
|
|
5150
6549
|
/** Include facts extracted from matched memories (defaults to false for performance) */
|
|
5151
6550
|
includeFacts: z.boolean().optional(),
|
|
6551
|
+
/** Include claims associated with matched memories (defaults to true) */
|
|
6552
|
+
includeClaims: z.boolean().optional(),
|
|
5152
6553
|
/** Filter entities by type (e.g., PERSON, TECHNOLOGY, PROJECT) */
|
|
5153
6554
|
entityTypes: z.array(z.string().max(50)).max(20).optional(),
|
|
5154
6555
|
/** Enable entity graph traversal branch in hybrid search (default false) */
|
|
5155
6556
|
expandEntities: z.boolean().optional(),
|
|
5156
|
-
/** Enable topic graph traversal branch in hybrid search (default
|
|
6557
|
+
/** Enable topic graph traversal branch in hybrid search (default true) */
|
|
5157
6558
|
expandTopics: z.boolean().optional(),
|
|
5158
|
-
/** Enable fact graph traversal branch in hybrid search (default
|
|
6559
|
+
/** Enable fact graph traversal branch in hybrid search (default true) */
|
|
5159
6560
|
expandFacts: z.boolean().optional(),
|
|
5160
6561
|
/** Include superseded and contradicted memories in results (default false) */
|
|
5161
6562
|
includeSuperseded: z.boolean().optional(),
|
|
5162
|
-
/** Weight for entity graph branch in hybrid search (0-1, default 0.
|
|
6563
|
+
/** Weight for entity graph branch in hybrid search (0-1, default 0.1) */
|
|
5163
6564
|
entityWeight: z.number().min(0).max(1).optional(),
|
|
5164
6565
|
/** Weight for topic graph branch in hybrid search (0-1, default 0.5) */
|
|
5165
6566
|
topicWeight: z.number().min(0).max(1).optional(),
|
|
5166
6567
|
/** Weight for fact graph branch in hybrid search (0-1, default 0.6) */
|
|
5167
6568
|
factWeight: z.number().min(0).max(1).optional(),
|
|
6569
|
+
/** Weight for question graph branch in hybrid search (0-1) */
|
|
6570
|
+
questionWeight: z.number().min(0).max(1).optional(),
|
|
6571
|
+
/** Weight for claims vector branch in hybrid search (0-1, default 0.5) */
|
|
6572
|
+
claimsWeight: z.number().min(0).max(1).optional(),
|
|
5168
6573
|
/** Field to sort results by (defaults to 'relevance' for search, 'createdAt' for list) */
|
|
5169
6574
|
sortBy: z.enum(["relevance", "createdAt", "updatedAt", "eventTime"]).optional(),
|
|
5170
6575
|
/** Sort order: 'asc' or 'desc' (defaults to 'desc' for timestamps, 'desc' for relevance) */
|
|
5171
|
-
order: z.enum(["asc", "desc"]).optional()
|
|
6576
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
6577
|
+
/** Include facet aggregation (topics, memoryType, effectiveState) in response (defaults to false) */
|
|
6578
|
+
includeFacets: z.boolean().optional()
|
|
5172
6579
|
});
|
|
5173
6580
|
var entity = z.object({
|
|
5174
6581
|
/** Entity name */
|
|
@@ -5176,80 +6583,39 @@ var entity = z.object({
|
|
|
5176
6583
|
/** Entity type */
|
|
5177
6584
|
type: z.string().optional()
|
|
5178
6585
|
});
|
|
5179
|
-
var topicReference = z.object({
|
|
5180
|
-
/** Topic unique identifier */
|
|
5181
|
-
id: z.string().uuid(),
|
|
5182
|
-
/** Topic name */
|
|
5183
|
-
name: z.string(),
|
|
5184
|
-
/** When the topic was created */
|
|
5185
|
-
createdAt: z.string().datetime().optional()
|
|
5186
|
-
});
|
|
5187
6586
|
var searchResult = z.lazy(() => z.object({
|
|
5188
|
-
memory
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
confidenceBasis: z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
5219
|
-
/** Effective state of the memory in the narrative */
|
|
5220
|
-
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional(),
|
|
5221
|
-
/** Status of automatic content extraction */
|
|
5222
|
-
extractionStatus: z.enum(["pending", "completed", "failed", "skipped"]).optional(),
|
|
5223
|
-
/** When extraction was completed */
|
|
5224
|
-
extractionCompletedAt: z.string().datetime().optional(),
|
|
5225
|
-
/** Number of topics extracted from content */
|
|
5226
|
-
extractedTopicCount: z.number().min(0).optional(),
|
|
5227
|
-
/** Number of facts extracted from content */
|
|
5228
|
-
extractedFactCount: z.number().min(0).optional(),
|
|
5229
|
-
/** Number of entities extracted from content */
|
|
5230
|
-
extractedEntityCount: z.number().min(0).optional(),
|
|
5231
|
-
/** Topics explicitly provided by the user */
|
|
5232
|
-
userTopics: z.array(z.string()).optional(),
|
|
5233
|
-
/** Topics automatically extracted from content */
|
|
5234
|
-
extractedTopics: z.array(z.string()).optional(),
|
|
5235
|
-
/** Agent session ID that created this memory (MCP session ID or CLI session UUID). Used to group memories by agent instance for conversation threading. */
|
|
5236
|
-
agentSessionId: z.string().nullable().optional(),
|
|
5237
|
-
/** Entities extracted from memory content */
|
|
5238
|
-
entities: z.array(z.object({
|
|
5239
|
-
/** Entity name */
|
|
5240
|
-
name: z.string(),
|
|
5241
|
-
/** Entity type */
|
|
5242
|
-
type: z.string(),
|
|
5243
|
-
/** Extraction confidence */
|
|
5244
|
-
confidence: z.number().min(0).max(1).optional()
|
|
5245
|
-
})).optional()
|
|
5246
|
-
}),
|
|
5247
|
-
/** Relevance score for this result */
|
|
5248
|
-
score: z.number(),
|
|
6587
|
+
/** Unique memory identifier */
|
|
6588
|
+
id: z.string(),
|
|
6589
|
+
/** Full memory content */
|
|
6590
|
+
content: z.string(),
|
|
6591
|
+
/** Truncated content preview (max 200 chars) */
|
|
6592
|
+
preview: z.string(),
|
|
6593
|
+
/** Optional human-readable name for deterministic retrieval */
|
|
6594
|
+
name: z.string().nullable().optional(),
|
|
6595
|
+
/** Type of memory */
|
|
6596
|
+
memoryType: z.enum(["episodic", "semantic", "procedural"]),
|
|
6597
|
+
/** Associated topics */
|
|
6598
|
+
topics: z.array(z.string()).optional(),
|
|
6599
|
+
/** Conversation this memory belongs to */
|
|
6600
|
+
conversationId: z.string().nullable().optional(),
|
|
6601
|
+
/** System ingestion timestamp */
|
|
6602
|
+
timestamp: z.string().datetime().optional(),
|
|
6603
|
+
/** Event time (when the event actually occurred) */
|
|
6604
|
+
eventTime: z.string().datetime().optional(),
|
|
6605
|
+
/** Validity start time */
|
|
6606
|
+
validFrom: z.string().datetime().optional(),
|
|
6607
|
+
/** Creation timestamp */
|
|
6608
|
+
createdAt: z.string().datetime().optional(),
|
|
6609
|
+
/** Last update timestamp */
|
|
6610
|
+
updatedAt: z.string().datetime().optional(),
|
|
6611
|
+
/** Effective state of the memory */
|
|
6612
|
+
effectiveState: z.string().optional(),
|
|
6613
|
+
/** Confidence score (0-1) */
|
|
6614
|
+
confidenceScore: z.number().min(0).max(1).optional(),
|
|
6615
|
+
/** Overall relevance score for this result */
|
|
6616
|
+
score: z.number().nullable().optional(),
|
|
5249
6617
|
/** Entities mentioned in this memory */
|
|
5250
6618
|
entities: z.array(entity).optional(),
|
|
5251
|
-
/** Topics associated with this memory */
|
|
5252
|
-
topics: z.array(topicReference).optional(),
|
|
5253
6619
|
/** Facts extracted from this memory */
|
|
5254
6620
|
facts: z.array(z.object({
|
|
5255
6621
|
/** Fact subject */
|
|
@@ -5261,10 +6627,8 @@ var searchResult = z.lazy(() => z.object({
|
|
|
5261
6627
|
/** Confidence */
|
|
5262
6628
|
confidence: z.number().min(0).max(1).optional()
|
|
5263
6629
|
})).optional(),
|
|
5264
|
-
/** Search method used to find this result */
|
|
5265
|
-
searchMethod: z.string().optional(),
|
|
5266
6630
|
/** Combined RRF score for hybrid search */
|
|
5267
|
-
hybridScore: z.number().optional(),
|
|
6631
|
+
hybridScore: z.number().nullable().optional(),
|
|
5268
6632
|
/** Vector similarity score (0-1) */
|
|
5269
6633
|
vectorScore: z.number().optional(),
|
|
5270
6634
|
/** Rank in vector search results */
|
|
@@ -5310,22 +6674,80 @@ var temporalMetadata = z.object({
|
|
|
5310
6674
|
includeExpired: z.boolean(),
|
|
5311
6675
|
/** Whether temporal fields are included in results */
|
|
5312
6676
|
temporalFieldsIncluded: z.boolean()
|
|
5313
|
-
})
|
|
6677
|
+
});
|
|
6678
|
+
var searchMeta = z.lazy(() => z.object({
|
|
6679
|
+
/** Total number of results matching the query */
|
|
6680
|
+
total: z.number(),
|
|
6681
|
+
/** Current page number (1-based) */
|
|
6682
|
+
page: z.number(),
|
|
6683
|
+
/** Number of results per page */
|
|
6684
|
+
pageSize: z.number(),
|
|
6685
|
+
/** Search duration in milliseconds */
|
|
6686
|
+
searchTime: z.number(),
|
|
6687
|
+
/** Search method used for this query */
|
|
6688
|
+
searchMethod: z.string(),
|
|
6689
|
+
/** Temporal query metadata (present when temporal filters are used) */
|
|
6690
|
+
temporalMetadata: temporalMetadata.optional()
|
|
6691
|
+
}));
|
|
6692
|
+
var facetEntry = z.object({
|
|
6693
|
+
/** Facet value */
|
|
6694
|
+
value: z.string(),
|
|
6695
|
+
/** Number of results with this value */
|
|
6696
|
+
count: z.number()
|
|
6697
|
+
});
|
|
6698
|
+
var facets = z.lazy(() => z.object({
|
|
6699
|
+
/** Topic facet counts (top 20 by frequency) */
|
|
6700
|
+
topics: z.array(facetEntry),
|
|
6701
|
+
/** Memory type facet counts */
|
|
6702
|
+
memoryType: z.array(facetEntry),
|
|
6703
|
+
/** Effective state facet counts */
|
|
6704
|
+
effectiveState: z.array(facetEntry)
|
|
6705
|
+
}));
|
|
6706
|
+
var claimGroupClaim = z.object({
|
|
6707
|
+
/** Claim ID */
|
|
6708
|
+
id: z.string(),
|
|
6709
|
+
/** Claim content text */
|
|
6710
|
+
content: z.string(),
|
|
6711
|
+
/** Memory this claim was extracted from */
|
|
6712
|
+
memoryId: z.string(),
|
|
6713
|
+
/** Claim creation timestamp */
|
|
6714
|
+
createdAt: z.string(),
|
|
6715
|
+
/** When the claimed event occurred */
|
|
6716
|
+
occurredStart: z.string().optional()
|
|
6717
|
+
});
|
|
6718
|
+
var claimGroupSignals = z.object({
|
|
6719
|
+
/** Number of claims in this group */
|
|
6720
|
+
n_claims: z.number(),
|
|
6721
|
+
/** Minimum LLM-judged alignment score among all pairs in the group (0=conflict, 1=corroborate) */
|
|
6722
|
+
alignment_min: z.number(),
|
|
6723
|
+
/** Days between earliest and latest claim in the group */
|
|
6724
|
+
temporal_spread_days: z.number(),
|
|
6725
|
+
/** True if alignment_min < 0.85, indicating potential conflict */
|
|
6726
|
+
has_low_alignment_pair: z.boolean(),
|
|
6727
|
+
/** True if alignment_min < 0.4 — claims directly conflict or one supersedes the other */
|
|
6728
|
+
has_conflict: z.boolean(),
|
|
6729
|
+
/** True if temporal_spread_days > 30 */
|
|
6730
|
+
has_temporal_spread: z.boolean()
|
|
6731
|
+
});
|
|
6732
|
+
var claimGroup = z.lazy(() => z.object({
|
|
6733
|
+
/** Deterministic group ID */
|
|
6734
|
+
id: z.string(),
|
|
6735
|
+
/** Claims in this group, sorted by createdAt descending (newest first) */
|
|
6736
|
+
claims: z.array(claimGroupClaim),
|
|
6737
|
+
/** Computed signals about the claim cluster */
|
|
6738
|
+
signals: claimGroupSignals
|
|
6739
|
+
}));
|
|
5314
6740
|
var searchResponse = z.lazy(() => z.object({
|
|
5315
|
-
/**
|
|
6741
|
+
/** Flattened search results with memory fields and search metadata */
|
|
5316
6742
|
data: z.array(searchResult),
|
|
5317
|
-
/** Search
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
count: z.number().min(0)
|
|
5326
|
-
}),
|
|
5327
|
-
/** Temporal query metadata (null for semantic/hybrid search) */
|
|
5328
|
-
temporalMetadata
|
|
6743
|
+
/** Search metadata including pagination, timing, and method */
|
|
6744
|
+
meta: searchMeta,
|
|
6745
|
+
/** Facet aggregations (only present when includeFacets=true) */
|
|
6746
|
+
facets: facets.optional(),
|
|
6747
|
+
/** Reader instructions for interpreting claims and resolving conflicts */
|
|
6748
|
+
instructions: z.string().optional(),
|
|
6749
|
+
/** Clusters of related claims that may conflict. Only present when relevant groups exist. Claims within each group are sorted newest-first. */
|
|
6750
|
+
claim_groups: z.array(claimGroup).optional()
|
|
5329
6751
|
}));
|
|
5330
6752
|
var fact = z.object({
|
|
5331
6753
|
/** Unique identifier for the fact */
|
|
@@ -5402,8 +6824,8 @@ var entityNode = z.object({
|
|
|
5402
6824
|
name: z.string(),
|
|
5403
6825
|
/** Normalized (lowercase) name for deduplication */
|
|
5404
6826
|
normalizedName: z.string(),
|
|
5405
|
-
/** Entity type classification */
|
|
5406
|
-
type: z.enum(["PERSON", "
|
|
6827
|
+
/** Entity type classification (v2: PERSON, ORGANIZATION, CONCEPT; legacy types accepted) */
|
|
6828
|
+
type: z.enum(["PERSON", "ORGANIZATION", "CONCEPT", "PROJECT", "TECHNOLOGY", "COMPONENT", "API_ENDPOINT", "FILE", "LOCATION"]),
|
|
5407
6829
|
/** Alternative names for this entity */
|
|
5408
6830
|
aliases: z.array(z.string()).optional(),
|
|
5409
6831
|
/** Extraction confidence score (0-1) */
|
|
@@ -5479,11 +6901,11 @@ var memoryRelationship = z.object({
|
|
|
5479
6901
|
/** ID of the target memory (the memory being related to) */
|
|
5480
6902
|
targetMemoryId: z.string(),
|
|
5481
6903
|
/** Type of relationship between memories */
|
|
5482
|
-
type: z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES"]),
|
|
6904
|
+
type: z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES", "DUPLICATES"]),
|
|
5483
6905
|
/** Confidence score for the relationship (0-1) */
|
|
5484
6906
|
confidence: z.number().min(0).max(1),
|
|
5485
6907
|
/** How the relationship was created */
|
|
5486
|
-
creationMethod: z.enum(["manual", "auto-semantic", "auto-temporal"]),
|
|
6908
|
+
creationMethod: z.enum(["manual", "auto-semantic", "auto-temporal", "auto-llm"]),
|
|
5487
6909
|
/** Human-readable explanation for why this relationship exists */
|
|
5488
6910
|
reason: z.string().optional(),
|
|
5489
6911
|
/** When the relationship was created */
|
|
@@ -5493,7 +6915,7 @@ var createMemoryRelationshipRequest = z.object({
|
|
|
5493
6915
|
/** ID of the target memory to create a relationship with */
|
|
5494
6916
|
targetMemoryId: z.string().min(1),
|
|
5495
6917
|
/** Type of relationship between memories */
|
|
5496
|
-
type: z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES"]),
|
|
6918
|
+
type: z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES", "DUPLICATES"]),
|
|
5497
6919
|
/** Confidence score for the relationship (0-1, defaults to 1.0 for manual) */
|
|
5498
6920
|
confidence: z.number().min(0).max(1).optional(),
|
|
5499
6921
|
/** Optional explanation for the relationship */
|
|
@@ -5554,7 +6976,7 @@ var addMemoryToNarrativeRequest = z.object({
|
|
|
5554
6976
|
/** Position in the narrative (0-indexed, omit for append) */
|
|
5555
6977
|
position: z.number().min(0).optional()
|
|
5556
6978
|
});
|
|
5557
|
-
var narrativeMemory = z.object({
|
|
6979
|
+
var narrativeMemory = z.lazy(() => z.object({
|
|
5558
6980
|
memory: z.object({
|
|
5559
6981
|
/** Unique memory identifier */
|
|
5560
6982
|
id: z.string(),
|
|
@@ -5578,6 +7000,8 @@ var narrativeMemory = z.object({
|
|
|
5578
7000
|
validFrom: z.string().datetime().optional(),
|
|
5579
7001
|
/** Validity end time (when this fact expires, null means never expires) */
|
|
5580
7002
|
validTo: z.string().datetime().nullable().optional(),
|
|
7003
|
+
/** Environment context for memory scoping — product, service, team, component, role. */
|
|
7004
|
+
codeContext: codeContext.optional(),
|
|
5581
7005
|
/** Creation timestamp */
|
|
5582
7006
|
createdAt: z.string().datetime(),
|
|
5583
7007
|
/** Last update timestamp */
|
|
@@ -5587,23 +7011,57 @@ var narrativeMemory = z.object({
|
|
|
5587
7011
|
/** Basis for the confidence score */
|
|
5588
7012
|
confidenceBasis: z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
5589
7013
|
/** Effective state of the memory in the narrative */
|
|
5590
|
-
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional(),
|
|
5591
|
-
/**
|
|
5592
|
-
|
|
7014
|
+
effectiveState: z.enum(["current", "superseded", "contradicted", "duplicate"]).optional(),
|
|
7015
|
+
/** Authority level: directive (mandates) > decision (choices with reasoning) > observation (learned during work) > auto-captured (generated content) */
|
|
7016
|
+
authority: z.enum(["directive", "decision", "observation", "auto-captured"]).optional(),
|
|
7017
|
+
/** Legacy aggregate extraction status. DERIVED on read from the six per-stage statuses (contentEmbeddingStatus, summaryStatus, questionsStatus, summaryEmbeddingStatus, questionsEmbeddingStatus, graphStatus). Preserved for SDK compatibility per PRD memory-creation-pipeline-v2 §5 Q7. */
|
|
7018
|
+
extractionStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
5593
7019
|
/** When extraction was completed */
|
|
5594
7020
|
extractionCompletedAt: z.string().datetime().optional(),
|
|
7021
|
+
/** Pipeline 2 content-embedding stage status. Tracks the queue lifecycle for writing m.embedding (primary content embedding). */
|
|
7022
|
+
contentEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7023
|
+
/** AI-generated summary of the memory content */
|
|
7024
|
+
summary: z.string().optional(),
|
|
7025
|
+
/** Pipeline 1 summary stage status. Tracks generation of m.summary by the summary-qna LLM call. */
|
|
7026
|
+
summaryStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7027
|
+
/** Pipeline 1 questions stage status. Tracks generation of anticipated Question nodes by the summary-qna LLM call. */
|
|
7028
|
+
questionsStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7029
|
+
/** Pipeline 2 summary-embedding stage status. Tracks the queue lifecycle for writing m.summaryEmbedding (depends on summaryStatus=completed). */
|
|
7030
|
+
summaryEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7031
|
+
/** Pipeline 2 question-embedding stage status. Tracks the queue lifecycle for writing Question.embedding for each anticipated question (depends on questionsStatus=completed). */
|
|
7032
|
+
questionsEmbeddingStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7033
|
+
/** Pipeline 3 graph-extraction stage status. Tracks generation of entities, facts, topics, authority, and memory-type. Replaces the role formerly played by the monolithic extractionStatus writer. */
|
|
7034
|
+
graphStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7035
|
+
/** When graphStatus=skipped, records why graph extraction was skipped. Mirrors the legacy extractionSkipReason field but scoped to the graph pipeline. */
|
|
7036
|
+
graphSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
7037
|
+
/** When extractionStatus=skipped, records why extraction was skipped. global_disabled = GRAPH_EXTRACTION_ENABLED=false kill switch. */
|
|
7038
|
+
extractionSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy"]).optional(),
|
|
7039
|
+
/** Status of primary (Ollama) embedding generation via durable queue */
|
|
7040
|
+
embeddingStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7041
|
+
/** Status of secondary (OpenAI) dual-write embedding generation via durable queue */
|
|
7042
|
+
embeddingOpenaiStatus: z.enum(["queued", "running", "completed", "failed", "skipped"]).optional(),
|
|
7043
|
+
/** True if the primary content embedding used a head-truncated input (model context exceeded). */
|
|
7044
|
+
embeddingTruncated: z.boolean().optional(),
|
|
7045
|
+
/** Token count of the original content (pre-truncation, cl100k proxy). Useful for identifying under-indexed memories. */
|
|
7046
|
+
embeddingOriginalTokens: z.number().min(0).optional(),
|
|
7047
|
+
/** Smart-field strategy used to produce the primary content embedding. */
|
|
7048
|
+
embeddingStrategy: z.enum(["full", "head-truncated", "summary-selected", "question-selected"]).optional(),
|
|
5595
7049
|
/** Number of topics extracted from content */
|
|
5596
7050
|
extractedTopicCount: z.number().min(0).optional(),
|
|
5597
7051
|
/** Number of facts extracted from content */
|
|
5598
7052
|
extractedFactCount: z.number().min(0).optional(),
|
|
5599
7053
|
/** Number of entities extracted from content */
|
|
5600
7054
|
extractedEntityCount: z.number().min(0).optional(),
|
|
7055
|
+
/** Number of memories this memory contradicts via outgoing CONTRADICTS relationships */
|
|
7056
|
+
conflictCount: z.number().min(0).optional(),
|
|
7057
|
+
/** Memory visibility level. Null/undefined treated as 'private' for backward compatibility. 'admin_visible' is computed at retrieval time when an org owner/admin queries another member's post-join memory and is never accepted on writes. */
|
|
7058
|
+
visibility: z.enum(["private", "shared_with_users", "shared_with_org", "admin_visible"]).optional(),
|
|
7059
|
+
/** User IDs this memory is shared with (only populated when visibility = 'shared_with_users') */
|
|
7060
|
+
sharedWith: z.array(z.string()).optional(),
|
|
5601
7061
|
/** Topics explicitly provided by the user */
|
|
5602
7062
|
userTopics: z.array(z.string()).optional(),
|
|
5603
7063
|
/** Topics automatically extracted from content */
|
|
5604
7064
|
extractedTopics: z.array(z.string()).optional(),
|
|
5605
|
-
/** Agent session ID that created this memory (MCP session ID or CLI session UUID). Used to group memories by agent instance for conversation threading. */
|
|
5606
|
-
agentSessionId: z.string().nullable().optional(),
|
|
5607
7065
|
/** Entities extracted from memory content */
|
|
5608
7066
|
entities: z.array(z.object({
|
|
5609
7067
|
/** Entity name */
|
|
@@ -5612,13 +7070,27 @@ var narrativeMemory = z.object({
|
|
|
5612
7070
|
type: z.string(),
|
|
5613
7071
|
/** Extraction confidence */
|
|
5614
7072
|
confidence: z.number().min(0).max(1).optional()
|
|
5615
|
-
})).optional()
|
|
7073
|
+
})).optional(),
|
|
7074
|
+
/** Task identifier for agentic loop memories */
|
|
7075
|
+
taskId: z.string().nullable().optional(),
|
|
7076
|
+
/** Task outcome status */
|
|
7077
|
+
outcome: z.enum(["resolved", "unresolved"]).nullable().optional(),
|
|
7078
|
+
/** Attempt number within the task */
|
|
7079
|
+
attemptNumber: z.number().nullable().optional(),
|
|
7080
|
+
/** Distillation pipeline stage status */
|
|
7081
|
+
distillStatus: z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]).nullable().optional(),
|
|
7082
|
+
/** Reason distillation was skipped */
|
|
7083
|
+
distillSkipReason: z.enum(["global_disabled", "plan_excluded", "user_opt_out", "content_too_short", "legacy", "budget_exhausted"]).nullable().optional(),
|
|
7084
|
+
/** Error message if distillation failed */
|
|
7085
|
+
distillError: z.string().nullable().optional(),
|
|
7086
|
+
/** ISO 8601 timestamp when distillation completed */
|
|
7087
|
+
distillCompletedAt: z.string().nullable().optional()
|
|
5616
7088
|
}),
|
|
5617
7089
|
/** Position of this memory in the narrative (0-indexed) */
|
|
5618
7090
|
position: z.number().min(0),
|
|
5619
7091
|
/** Effective state of this memory in the narrative context */
|
|
5620
7092
|
effectiveState: z.enum(["current", "superseded", "contradicted"]).optional()
|
|
5621
|
-
});
|
|
7093
|
+
}));
|
|
5622
7094
|
var narrativeTimelineResponse = z.lazy(() => z.object({
|
|
5623
7095
|
data: z.array(narrativeMemory),
|
|
5624
7096
|
narrative: narrativeThread,
|
|
@@ -5805,7 +7277,7 @@ var listPaymentMethodsResponse = z.lazy(() => z.object({
|
|
|
5805
7277
|
}));
|
|
5806
7278
|
var digestRequest = z.object({
|
|
5807
7279
|
/** The topic or subject to generate a digest for */
|
|
5808
|
-
query: z.string().min(1),
|
|
7280
|
+
query: z.string().min(1).max(2e3),
|
|
5809
7281
|
/** Time window filter (e.g., "7d", "24h", "2w", "30m"). Only considers memories within this window. */
|
|
5810
7282
|
recent: z.string().optional(),
|
|
5811
7283
|
/** Filter to memories with these topics */
|
|
@@ -5817,7 +7289,9 @@ var digestRequest = z.object({
|
|
|
5817
7289
|
/** Maximum number of memories to consider (1-500, default 100) */
|
|
5818
7290
|
maxSources: z.number().min(1).max(500).optional(),
|
|
5819
7291
|
/** Whether to include source memory IDs in the response */
|
|
5820
|
-
includeMemoryIds: z.boolean().optional()
|
|
7292
|
+
includeMemoryIds: z.boolean().optional(),
|
|
7293
|
+
/** Number of most-recent matching memories to return VERBATIM (full stored content, untouched) in `recentMemories`, instead of synthesizing them into `digest`. The remaining (older) memories are still synthesized into `digest` as usual. Recency is determined by event time when present, else system timestamp, else creation time. Default 0 = current behavior (synthesize all memories, `recentMemories` empty). When the total matched count is <= verbatimRecent, all matches are returned in `recentMemories` and `digest` is an empty string (no older memories to synthesize). Range 0-50. */
|
|
7294
|
+
verbatimRecent: z.number().min(0).max(50).optional()
|
|
5821
7295
|
});
|
|
5822
7296
|
var digestTimeRange = z.object({
|
|
5823
7297
|
/** Earliest memory timestamp in the digest sources */
|
|
@@ -5838,6 +7312,12 @@ var digestMetadata = z.lazy(() => z.object({
|
|
|
5838
7312
|
timeRange: digestTimeRange,
|
|
5839
7313
|
/** Output format used for this digest */
|
|
5840
7314
|
format: z.enum(["structured", "narrative", "timeline", "status-report"]),
|
|
7315
|
+
/** Average relevance score (0-1) of the source memories used in synthesis. Low values (<0.02) indicate the query may not have strong matches. */
|
|
7316
|
+
averageRelevance: z.number().min(0).max(1).optional(),
|
|
7317
|
+
/** True when averageRelevance falls in the narrow-window band (>= DIGEST_RELEVANCE_THRESHOLD but < NARROW_WINDOW_FALLBACK_CEILING) — the digest synthesised from weak matches that may not represent strong context. Consumers should surface a warning to the calling agent. */
|
|
7318
|
+
narrowWindowFallback: z.boolean().optional(),
|
|
7319
|
+
/** True when the digest is in the narrow-window band AND the source memories span 2+ distinct codeContext.product values (or none share a product). Indicates the synthesis is drawn from heterogeneous, possibly cross-project sources — likely the wrong project for the calling agent. See support#183. */
|
|
7320
|
+
crossProjectFallback: z.boolean().optional(),
|
|
5841
7321
|
/** ISO 8601 timestamp when the digest was generated */
|
|
5842
7322
|
generatedAt: z.string().datetime(),
|
|
5843
7323
|
/** Recursion stats (only present when recursive synthesis is used) */
|
|
@@ -5891,6 +7371,8 @@ var digestResponse = z.lazy(() => z.object({
|
|
|
5891
7371
|
metadata: digestMetadata,
|
|
5892
7372
|
/** Source memories used to generate the digest, for traceability */
|
|
5893
7373
|
sources: z.array(digestSource),
|
|
7374
|
+
/** The N most-recent matching memories returned VERBATIM (full stored content, untouched), where N = the request's verbatimRecent. Ordered newest-first. Empty/omitted when verbatimRecent is 0 (the default). These memories are NOT synthesized into `digest` — the synthesis covers only the older remainder. Lets callers preserve the exact structure of recent items (per-item status, identifiers, next-step) while still condensing the older tail. */
|
|
7375
|
+
recentMemories: z.array(memory).optional(),
|
|
5894
7376
|
/** Top extracted facts relevant to the digest, deduplicated and ranked by frequency */
|
|
5895
7377
|
keyFacts: z.array(digestKeyFact).optional(),
|
|
5896
7378
|
/** Key entities mentioned across source memories */
|
|
@@ -5898,6 +7380,84 @@ var digestResponse = z.lazy(() => z.object({
|
|
|
5898
7380
|
/** Breakdown of source memories by effective state (current/superseded/contradicted) */
|
|
5899
7381
|
effectiveStateBreakdown: effectiveStateBreakdown.optional()
|
|
5900
7382
|
}));
|
|
7383
|
+
var exportRequest = z.object({
|
|
7384
|
+
/** Optional search query to filter memories for export */
|
|
7385
|
+
query: z.string().max(2e3).optional(),
|
|
7386
|
+
/** Filter by topics */
|
|
7387
|
+
topics: z.array(z.string().max(100)).max(50).optional(),
|
|
7388
|
+
/** Filter by memory type */
|
|
7389
|
+
memoryType: z.enum(["episodic", "semantic", "procedural"]).optional(),
|
|
7390
|
+
/** Export format: json or csv (default: json) */
|
|
7391
|
+
format: z.enum(["json", "csv"]).optional(),
|
|
7392
|
+
/** Optional field selection. If omitted, all standard fields are included. */
|
|
7393
|
+
fields: z.array(z.string().max(50)).max(20).optional(),
|
|
7394
|
+
/** Maximum results to export (default 100, max 1000) */
|
|
7395
|
+
limit: z.number().min(1).max(1e3).optional()
|
|
7396
|
+
});
|
|
7397
|
+
var bulkUpdateRequest = z.object({
|
|
7398
|
+
/** Memory IDs to update (max 100) */
|
|
7399
|
+
ids: z.array(z.string().min(1)).min(1).max(100),
|
|
7400
|
+
/** Fields to update on all specified memories */
|
|
7401
|
+
updates: z.object({
|
|
7402
|
+
/** Replace topics on all specified memories */
|
|
7403
|
+
topics: z.array(z.string().max(100)).max(50).optional(),
|
|
7404
|
+
/** Set memory type on all specified memories */
|
|
7405
|
+
memoryType: z.enum(["episodic", "semantic", "procedural"]).optional()
|
|
7406
|
+
})
|
|
7407
|
+
});
|
|
7408
|
+
var bulkUpdateResponse = z.object({
|
|
7409
|
+
/** Number of memories successfully updated */
|
|
7410
|
+
updated: z.number(),
|
|
7411
|
+
/** Number of memories that failed to update */
|
|
7412
|
+
failed: z.number(),
|
|
7413
|
+
/** Per-item error details */
|
|
7414
|
+
errors: z.array(z.object({
|
|
7415
|
+
/** Memory ID that failed */
|
|
7416
|
+
id: z.string(),
|
|
7417
|
+
/** Error message */
|
|
7418
|
+
error: z.string()
|
|
7419
|
+
}))
|
|
7420
|
+
});
|
|
7421
|
+
var bulkDeleteRequest = z.object({
|
|
7422
|
+
/** Memory IDs to delete (max 100) */
|
|
7423
|
+
ids: z.array(z.string().min(1)).min(1).max(100),
|
|
7424
|
+
/** Must be true to confirm bulk deletion */
|
|
7425
|
+
confirmDeletion: z.literal(true)
|
|
7426
|
+
});
|
|
7427
|
+
var bulkDeleteResponse = z.object({
|
|
7428
|
+
/** Number of memories successfully deleted */
|
|
7429
|
+
deleted: z.number(),
|
|
7430
|
+
/** Number of memories that failed to delete */
|
|
7431
|
+
failed: z.number(),
|
|
7432
|
+
/** Per-item error details */
|
|
7433
|
+
errors: z.array(z.object({
|
|
7434
|
+
/** Memory ID that failed */
|
|
7435
|
+
id: z.string(),
|
|
7436
|
+
/** Error message */
|
|
7437
|
+
error: z.string()
|
|
7438
|
+
}))
|
|
7439
|
+
});
|
|
7440
|
+
var bulkTagRequest = z.object({
|
|
7441
|
+
/** Memory IDs to modify tags on (max 100) */
|
|
7442
|
+
ids: z.array(z.string().min(1)).min(1).max(100),
|
|
7443
|
+
/** Topics to add to all specified memories */
|
|
7444
|
+
addTopics: z.array(z.string().max(100)).max(50).optional(),
|
|
7445
|
+
/** Topics to remove from all specified memories */
|
|
7446
|
+
removeTopics: z.array(z.string().max(100)).max(50).optional()
|
|
7447
|
+
});
|
|
7448
|
+
var bulkTagResponse = z.object({
|
|
7449
|
+
/** Number of memories successfully modified */
|
|
7450
|
+
modified: z.number(),
|
|
7451
|
+
/** Number of memories that failed to modify */
|
|
7452
|
+
failed: z.number(),
|
|
7453
|
+
/** Per-item error details */
|
|
7454
|
+
errors: z.array(z.object({
|
|
7455
|
+
/** Memory ID that failed */
|
|
7456
|
+
id: z.string(),
|
|
7457
|
+
/** Error message */
|
|
7458
|
+
error: z.string()
|
|
7459
|
+
}))
|
|
7460
|
+
});
|
|
5901
7461
|
var buildContextRequest = z.object({
|
|
5902
7462
|
/** What you are about to work on */
|
|
5903
7463
|
context: z.string().min(1).max(2e3),
|
|
@@ -5963,7 +7523,9 @@ var buildContextMeta = z.object({
|
|
|
5963
7523
|
/** Search terms extracted from the context and files */
|
|
5964
7524
|
contextTerms: z.array(z.string()),
|
|
5965
7525
|
/** Hours window used for recent activity */
|
|
5966
|
-
recentHours: z.number()
|
|
7526
|
+
recentHours: z.number(),
|
|
7527
|
+
/** Sections whose backing query exceeded the per-branch timeout and were returned empty. Present only when at least one branch timed out, so an empty section can otherwise be read as 'no data'. */
|
|
7528
|
+
timedOutSections: z.array(z.string()).optional()
|
|
5967
7529
|
});
|
|
5968
7530
|
var buildContextResponse = z.lazy(() => z.object({
|
|
5969
7531
|
/** Most relevant active conversation, or null if none found */
|
|
@@ -5979,6 +7541,39 @@ var buildContextResponse = z.lazy(() => z.object({
|
|
|
5979
7541
|
/** Request metadata for transparency */
|
|
5980
7542
|
meta: buildContextMeta
|
|
5981
7543
|
}));
|
|
7544
|
+
var systemAlert = z.object({
|
|
7545
|
+
id: z.string().uuid(),
|
|
7546
|
+
title: z.string().min(1).max(120),
|
|
7547
|
+
body: z.string().min(1).max(2e3),
|
|
7548
|
+
severity: z.enum(["info", "warning", "critical"]),
|
|
7549
|
+
active: z.boolean().optional(),
|
|
7550
|
+
dismissible: z.boolean().optional(),
|
|
7551
|
+
targetAllUsers: z.boolean().optional(),
|
|
7552
|
+
targetUserIds: z.array(z.string()).optional(),
|
|
7553
|
+
createdAt: z.string().datetime(),
|
|
7554
|
+
expiresAt: z.string().datetime().nullable(),
|
|
7555
|
+
createdBy: z.string()
|
|
7556
|
+
});
|
|
7557
|
+
var createSystemAlertRequest = z.object({
|
|
7558
|
+
title: z.string().min(1).max(120),
|
|
7559
|
+
body: z.string().min(1).max(2e3),
|
|
7560
|
+
severity: z.enum(["info", "warning", "critical"]).optional(),
|
|
7561
|
+
active: z.boolean().optional(),
|
|
7562
|
+
dismissible: z.boolean().optional(),
|
|
7563
|
+
targetAllUsers: z.boolean().optional(),
|
|
7564
|
+
targetUserIds: z.array(z.string().uuid()).max(1e3).optional(),
|
|
7565
|
+
expiresAt: z.string().datetime().nullable().optional()
|
|
7566
|
+
});
|
|
7567
|
+
var updateSystemAlertRequest = z.object({
|
|
7568
|
+
title: z.string().min(1).max(120).optional(),
|
|
7569
|
+
body: z.string().min(1).max(2e3).optional(),
|
|
7570
|
+
severity: z.enum(["info", "warning", "critical"]).optional(),
|
|
7571
|
+
active: z.boolean().optional(),
|
|
7572
|
+
dismissible: z.boolean().optional(),
|
|
7573
|
+
targetAllUsers: z.boolean().optional(),
|
|
7574
|
+
targetUserIds: z.array(z.string().uuid()).max(1e3).optional(),
|
|
7575
|
+
expiresAt: z.string().datetime().nullable().optional()
|
|
7576
|
+
});
|
|
5982
7577
|
|
|
5983
7578
|
// src/index.ts
|
|
5984
7579
|
var Memnexus = class {
|
|
@@ -5993,6 +7588,8 @@ var Memnexus = class {
|
|
|
5993
7588
|
patterns;
|
|
5994
7589
|
/** Behavioral pattern tracking and state management endpoints operations */
|
|
5995
7590
|
behavior;
|
|
7591
|
+
/** Behavioral recommendation management endpoints (v2) operations */
|
|
7592
|
+
recommendations;
|
|
5996
7593
|
/** Narrative thread management endpoints operations */
|
|
5997
7594
|
narratives;
|
|
5998
7595
|
/** Observability and metrics endpoints for production monitoring operations */
|
|
@@ -6017,8 +7614,14 @@ var Memnexus = class {
|
|
|
6017
7614
|
artifacts;
|
|
6018
7615
|
/** API key management endpoints operations */
|
|
6019
7616
|
apiKeys;
|
|
7617
|
+
/** System alerts banner endpoints (customer portal) operations */
|
|
7618
|
+
alerts;
|
|
6020
7619
|
/** Admin management endpoints for invite codes and platform configuration operations */
|
|
6021
7620
|
admin;
|
|
7621
|
+
/** Admin endpoints for managing system alerts operations */
|
|
7622
|
+
adminAlerts;
|
|
7623
|
+
/** Admin Pipeline operations */
|
|
7624
|
+
adminPipeline;
|
|
6022
7625
|
/**
|
|
6023
7626
|
* Create a new SDK client.
|
|
6024
7627
|
* @param config - SDK configuration
|
|
@@ -6033,6 +7636,7 @@ var Memnexus = class {
|
|
|
6033
7636
|
this.system = new SystemService(this.config);
|
|
6034
7637
|
this.patterns = new PatternsService(this.config);
|
|
6035
7638
|
this.behavior = new BehaviorService(this.config);
|
|
7639
|
+
this.recommendations = new RecommendationsService(this.config);
|
|
6036
7640
|
this.narratives = new NarrativesService(this.config);
|
|
6037
7641
|
this.monitoring = new MonitoringService(this.config);
|
|
6038
7642
|
this.memories = new MemoriesService(this.config);
|
|
@@ -6045,7 +7649,10 @@ var Memnexus = class {
|
|
|
6045
7649
|
this.billing = new BillingService(this.config);
|
|
6046
7650
|
this.artifacts = new ArtifactsService(this.config);
|
|
6047
7651
|
this.apiKeys = new ApiKeysService(this.config);
|
|
7652
|
+
this.alerts = new AlertsService(this.config);
|
|
6048
7653
|
this.admin = new AdminService(this.config);
|
|
7654
|
+
this.adminAlerts = new AdminAlertsService(this.config);
|
|
7655
|
+
this.adminPipeline = new AdminPipelineService(this.config);
|
|
6049
7656
|
}
|
|
6050
7657
|
/**
|
|
6051
7658
|
* Set the API token for authentication.
|
|
@@ -6058,6 +7665,7 @@ var Memnexus = class {
|
|
|
6058
7665
|
this.system.token = token;
|
|
6059
7666
|
this.patterns.token = token;
|
|
6060
7667
|
this.behavior.token = token;
|
|
7668
|
+
this.recommendations.token = token;
|
|
6061
7669
|
this.narratives.token = token;
|
|
6062
7670
|
this.monitoring.token = token;
|
|
6063
7671
|
this.memories.token = token;
|
|
@@ -6070,7 +7678,10 @@ var Memnexus = class {
|
|
|
6070
7678
|
this.billing.token = token;
|
|
6071
7679
|
this.artifacts.token = token;
|
|
6072
7680
|
this.apiKeys.token = token;
|
|
7681
|
+
this.alerts.token = token;
|
|
6073
7682
|
this.admin.token = token;
|
|
7683
|
+
this.adminAlerts.token = token;
|
|
7684
|
+
this.adminPipeline.token = token;
|
|
6074
7685
|
}
|
|
6075
7686
|
/**
|
|
6076
7687
|
* Set the base URL for API requests.
|
|
@@ -6083,6 +7694,7 @@ var Memnexus = class {
|
|
|
6083
7694
|
this.system.baseUrl = baseUrl;
|
|
6084
7695
|
this.patterns.baseUrl = baseUrl;
|
|
6085
7696
|
this.behavior.baseUrl = baseUrl;
|
|
7697
|
+
this.recommendations.baseUrl = baseUrl;
|
|
6086
7698
|
this.narratives.baseUrl = baseUrl;
|
|
6087
7699
|
this.monitoring.baseUrl = baseUrl;
|
|
6088
7700
|
this.memories.baseUrl = baseUrl;
|
|
@@ -6095,7 +7707,10 @@ var Memnexus = class {
|
|
|
6095
7707
|
this.billing.baseUrl = baseUrl;
|
|
6096
7708
|
this.artifacts.baseUrl = baseUrl;
|
|
6097
7709
|
this.apiKeys.baseUrl = baseUrl;
|
|
7710
|
+
this.alerts.baseUrl = baseUrl;
|
|
6098
7711
|
this.admin.baseUrl = baseUrl;
|
|
7712
|
+
this.adminAlerts.baseUrl = baseUrl;
|
|
7713
|
+
this.adminPipeline.baseUrl = baseUrl;
|
|
6099
7714
|
}
|
|
6100
7715
|
/**
|
|
6101
7716
|
* Set the environment.
|
|
@@ -6108,6 +7723,7 @@ var Memnexus = class {
|
|
|
6108
7723
|
this.system.environment = environment;
|
|
6109
7724
|
this.patterns.environment = environment;
|
|
6110
7725
|
this.behavior.environment = environment;
|
|
7726
|
+
this.recommendations.environment = environment;
|
|
6111
7727
|
this.narratives.environment = environment;
|
|
6112
7728
|
this.monitoring.environment = environment;
|
|
6113
7729
|
this.memories.environment = environment;
|
|
@@ -6120,12 +7736,18 @@ var Memnexus = class {
|
|
|
6120
7736
|
this.billing.environment = environment;
|
|
6121
7737
|
this.artifacts.environment = environment;
|
|
6122
7738
|
this.apiKeys.environment = environment;
|
|
7739
|
+
this.alerts.environment = environment;
|
|
6123
7740
|
this.admin.environment = environment;
|
|
7741
|
+
this.adminAlerts.environment = environment;
|
|
7742
|
+
this.adminPipeline.environment = environment;
|
|
6124
7743
|
}
|
|
6125
7744
|
};
|
|
6126
7745
|
var index_default = Memnexus;
|
|
6127
7746
|
export {
|
|
7747
|
+
AdminAlertsService,
|
|
7748
|
+
AdminPipelineService,
|
|
6128
7749
|
AdminService,
|
|
7750
|
+
AlertsService,
|
|
6129
7751
|
ApiKeysService,
|
|
6130
7752
|
ArtifactsService,
|
|
6131
7753
|
BehaviorService,
|
|
@@ -6143,6 +7765,7 @@ export {
|
|
|
6143
7765
|
MonitoringService,
|
|
6144
7766
|
NarrativesService,
|
|
6145
7767
|
PatternsService,
|
|
7768
|
+
RecommendationsService,
|
|
6146
7769
|
SdkError,
|
|
6147
7770
|
SerializationStyle,
|
|
6148
7771
|
SystemService,
|
|
@@ -6163,8 +7786,20 @@ export {
|
|
|
6163
7786
|
buildContextPattern,
|
|
6164
7787
|
buildContextRequest,
|
|
6165
7788
|
buildContextResponse,
|
|
7789
|
+
bulkDeleteRequest,
|
|
7790
|
+
bulkDeleteResponse,
|
|
7791
|
+
bulkTagRequest,
|
|
7792
|
+
bulkTagResponse,
|
|
7793
|
+
bulkUpdateRequest,
|
|
7794
|
+
bulkUpdateResponse,
|
|
6166
7795
|
checkoutSessionResponse,
|
|
7796
|
+
claimGroup,
|
|
7797
|
+
claimGroupClaim,
|
|
7798
|
+
claimGroupSignals,
|
|
7799
|
+
codeContext,
|
|
6167
7800
|
community,
|
|
7801
|
+
compileInstructionsRequest,
|
|
7802
|
+
compileInstructionsResponse,
|
|
6168
7803
|
conversation,
|
|
6169
7804
|
createArtifactRequest,
|
|
6170
7805
|
createCheckoutSessionRequest,
|
|
@@ -6176,6 +7811,8 @@ export {
|
|
|
6176
7811
|
createMemoryResponseMeta,
|
|
6177
7812
|
createNarrativeRequest,
|
|
6178
7813
|
createPortalSessionRequest,
|
|
7814
|
+
createRecommendationRequest,
|
|
7815
|
+
createSystemAlertRequest,
|
|
6179
7816
|
index_default as default,
|
|
6180
7817
|
digestEntity,
|
|
6181
7818
|
digestKeyFact,
|
|
@@ -6188,6 +7825,9 @@ export {
|
|
|
6188
7825
|
entity,
|
|
6189
7826
|
entityNode,
|
|
6190
7827
|
error,
|
|
7828
|
+
exportRequest,
|
|
7829
|
+
facetEntry,
|
|
7830
|
+
facets,
|
|
6191
7831
|
fact,
|
|
6192
7832
|
factSearchRequest,
|
|
6193
7833
|
getMemoryResponse,
|
|
@@ -6199,6 +7839,7 @@ export {
|
|
|
6199
7839
|
listInvoicesResponse,
|
|
6200
7840
|
listNarrativesResponse,
|
|
6201
7841
|
listPaymentMethodsResponse,
|
|
7842
|
+
matchRecommendationsRequest,
|
|
6202
7843
|
memory,
|
|
6203
7844
|
memoryRelationship,
|
|
6204
7845
|
memoryRelationshipsResponse,
|
|
@@ -6210,20 +7851,24 @@ export {
|
|
|
6210
7851
|
pattern,
|
|
6211
7852
|
paymentMethod,
|
|
6212
7853
|
portalSessionResponse,
|
|
7854
|
+
precomputedMemoryFields,
|
|
7855
|
+
recommendation,
|
|
6213
7856
|
relatedMemoryResult,
|
|
7857
|
+
searchMeta,
|
|
6214
7858
|
searchRequest,
|
|
6215
7859
|
searchResponse,
|
|
6216
7860
|
searchResult,
|
|
6217
7861
|
serviceCheck,
|
|
6218
7862
|
subscription,
|
|
7863
|
+
systemAlert,
|
|
6219
7864
|
temporalMetadata,
|
|
6220
7865
|
topic,
|
|
6221
|
-
topicReference,
|
|
6222
7866
|
updateArtifactRequest,
|
|
6223
7867
|
updateFactRequest,
|
|
6224
7868
|
updateMemoryRequest,
|
|
6225
7869
|
updateNamedMemoryRequest,
|
|
6226
7870
|
updateNarrativeRequest,
|
|
7871
|
+
updateSystemAlertRequest,
|
|
6227
7872
|
user,
|
|
6228
7873
|
userUsage
|
|
6229
7874
|
};
|