@hasna/mementos 0.14.75 → 0.14.79
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/bun.lock +93 -0
- package/dist/cli/commands/info-context.d.ts.map +1 -1
- package/dist/cli/commands/info-stale.d.ts.map +1 -1
- package/dist/cli/commands/io-export.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-crud.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-list.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-recall.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-search.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-tail.d.ts.map +1 -1
- package/dist/cli/commands/project.d.ts.map +1 -1
- package/dist/cli/commands/system-watch.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts +38 -0
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +2009 -334
- package/dist/db/__fixtures__/fail-closed-stub-server.d.ts.map +1 -1
- package/dist/db/memory-project-link.d.ts +13 -0
- package/dist/db/memory-project-link.d.ts.map +1 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/pg-migrations.d.ts +0 -6
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/db/projects.d.ts +22 -1
- package/dist/db/projects.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2828 -163
- package/dist/lib/package-version.d.ts +3 -0
- package/dist/lib/package-version.d.ts.map +1 -0
- package/dist/mcp/index.js +414 -0
- package/dist/memory-project-link/index.d.ts +2 -0
- package/dist/memory-project-link/index.d.ts.map +1 -0
- package/dist/memory-project-link/schema.d.ts +5 -0
- package/dist/memory-project-link/schema.d.ts.map +1 -0
- package/dist/project-registration/authority.d.ts +39 -0
- package/dist/project-registration/authority.d.ts.map +1 -0
- package/dist/project-registration/http.d.ts +29 -0
- package/dist/project-registration/http.d.ts.map +1 -0
- package/dist/project-registration/index.d.ts +8 -0
- package/dist/project-registration/index.d.ts.map +1 -0
- package/dist/project-registration/project-references.d.ts +71 -0
- package/dist/project-registration/project-references.d.ts.map +1 -0
- package/dist/project-registration/schema.d.ts +5 -0
- package/dist/project-registration/schema.d.ts.map +1 -0
- package/dist/project-registration/types.d.ts +168 -0
- package/dist/project-registration/types.d.ts.map +1 -0
- package/dist/project-registration.d.ts +2 -0
- package/dist/project-registration.d.ts.map +1 -0
- package/dist/project-registration.js +1496 -0
- package/dist/sdk/index.d.ts +127 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +74 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2573 -138
- package/dist/server/routes/memories.d.ts +1 -0
- package/dist/server/routes/memories.d.ts.map +1 -1
- package/dist/server/routes/memory-project-link.d.ts +2 -0
- package/dist/server/routes/memory-project-link.d.ts.map +1 -0
- package/dist/server/routes/project-registration.d.ts +2 -0
- package/dist/server/routes/project-registration.d.ts.map +1 -0
- package/dist/types/index.d.ts +119 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +9 -3
- package/dashboard/bun.lock +0 -519
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/lib/package-version.ts"],"names":[],"mappings":"AAIA,4EAA4E;AAC5E,wBAAgB,yBAAyB,IAAI,MAAM,CAclD"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -1241,6 +1241,394 @@ var init_api_mode = __esm(() => {
|
|
|
1241
1241
|
};
|
|
1242
1242
|
});
|
|
1243
1243
|
|
|
1244
|
+
// src/project-registration/schema.ts
|
|
1245
|
+
function sqliteMementosProjectRegistrationSchemaSql() {
|
|
1246
|
+
return `
|
|
1247
|
+
CREATE TABLE IF NOT EXISTS mementos_project_registration_receipts (
|
|
1248
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1249
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1250
|
+
route TEXT NOT NULL,
|
|
1251
|
+
package_version TEXT NOT NULL,
|
|
1252
|
+
authority_id TEXT NOT NULL,
|
|
1253
|
+
tenant_id TEXT NOT NULL,
|
|
1254
|
+
corpus_id TEXT NOT NULL,
|
|
1255
|
+
operation_id TEXT NOT NULL,
|
|
1256
|
+
step_id TEXT NOT NULL,
|
|
1257
|
+
resource_kind TEXT NOT NULL CHECK(resource_kind = 'project'),
|
|
1258
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'inverse')),
|
|
1259
|
+
target_selector TEXT NOT NULL,
|
|
1260
|
+
idempotency_key TEXT NOT NULL,
|
|
1261
|
+
request_digest TEXT NOT NULL,
|
|
1262
|
+
precondition_digest TEXT NOT NULL,
|
|
1263
|
+
normalized_call_digest TEXT NOT NULL,
|
|
1264
|
+
outcome TEXT NOT NULL CHECK(outcome IN (
|
|
1265
|
+
'accepted', 'duplicate_of_accepted', 'terminal_nonacceptance'
|
|
1266
|
+
)),
|
|
1267
|
+
reason TEXT,
|
|
1268
|
+
target_id TEXT,
|
|
1269
|
+
result_revision TEXT,
|
|
1270
|
+
result_digest TEXT,
|
|
1271
|
+
duplicate_of_receipt_id TEXT,
|
|
1272
|
+
accepted_receipt_id TEXT,
|
|
1273
|
+
created_by_operation INTEGER NOT NULL CHECK(created_by_operation IN (0, 1)),
|
|
1274
|
+
created_at TEXT NOT NULL
|
|
1275
|
+
);
|
|
1276
|
+
|
|
1277
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_project_registration_receipts_lookup
|
|
1278
|
+
ON mementos_project_registration_receipts (
|
|
1279
|
+
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
1280
|
+
resource_kind, direction, idempotency_key, target_selector
|
|
1281
|
+
);
|
|
1282
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_mementos_project_registration_receipts_accepted_step
|
|
1283
|
+
ON mementos_project_registration_receipts (
|
|
1284
|
+
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
1285
|
+
resource_kind, direction
|
|
1286
|
+
)
|
|
1287
|
+
WHERE outcome = 'accepted';
|
|
1288
|
+
|
|
1289
|
+
CREATE TABLE IF NOT EXISTS mementos_project_registration_bindings (
|
|
1290
|
+
authority_id TEXT NOT NULL,
|
|
1291
|
+
tenant_id TEXT NOT NULL,
|
|
1292
|
+
corpus_id TEXT NOT NULL,
|
|
1293
|
+
resource_kind TEXT NOT NULL CHECK(resource_kind = 'project'),
|
|
1294
|
+
target_selector TEXT NOT NULL,
|
|
1295
|
+
operation_id TEXT NOT NULL,
|
|
1296
|
+
step_id TEXT NOT NULL,
|
|
1297
|
+
direction TEXT NOT NULL CHECK(direction = 'forward'),
|
|
1298
|
+
idempotency_key TEXT NOT NULL,
|
|
1299
|
+
request_digest TEXT NOT NULL,
|
|
1300
|
+
precondition_digest TEXT NOT NULL,
|
|
1301
|
+
normalized_call_digest TEXT NOT NULL,
|
|
1302
|
+
state TEXT NOT NULL CHECK(state IN (
|
|
1303
|
+
'pending', 'accepted', 'terminal_nonacceptance', 'removed'
|
|
1304
|
+
)),
|
|
1305
|
+
target_id TEXT,
|
|
1306
|
+
accepted_receipt_id TEXT,
|
|
1307
|
+
result_revision TEXT,
|
|
1308
|
+
result_digest TEXT,
|
|
1309
|
+
removed_receipt_id TEXT,
|
|
1310
|
+
created_at TEXT NOT NULL,
|
|
1311
|
+
updated_at TEXT NOT NULL,
|
|
1312
|
+
PRIMARY KEY(authority_id, tenant_id, corpus_id, resource_kind, target_selector),
|
|
1313
|
+
UNIQUE(accepted_receipt_id)
|
|
1314
|
+
);
|
|
1315
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_mementos_project_registration_binding_target
|
|
1316
|
+
ON mementos_project_registration_bindings(
|
|
1317
|
+
authority_id, tenant_id, corpus_id, resource_kind, target_id
|
|
1318
|
+
)
|
|
1319
|
+
WHERE target_id IS NOT NULL;
|
|
1320
|
+
|
|
1321
|
+
CREATE TRIGGER IF NOT EXISTS mementos_project_registration_receipts_immutable_update
|
|
1322
|
+
BEFORE UPDATE ON mementos_project_registration_receipts
|
|
1323
|
+
BEGIN
|
|
1324
|
+
SELECT RAISE(ABORT, 'mementos project registration receipts are immutable');
|
|
1325
|
+
END;
|
|
1326
|
+
|
|
1327
|
+
CREATE TRIGGER IF NOT EXISTS mementos_project_registration_receipts_immutable_delete
|
|
1328
|
+
BEFORE DELETE ON mementos_project_registration_receipts
|
|
1329
|
+
BEGIN
|
|
1330
|
+
SELECT RAISE(ABORT, 'mementos project registration receipts are immutable');
|
|
1331
|
+
END;
|
|
1332
|
+
`;
|
|
1333
|
+
}
|
|
1334
|
+
function postgresMementosProjectRegistrationSchemaSql() {
|
|
1335
|
+
return `
|
|
1336
|
+
CREATE TABLE IF NOT EXISTS mementos_project_registration_receipts (
|
|
1337
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1338
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1339
|
+
route TEXT NOT NULL,
|
|
1340
|
+
package_version TEXT NOT NULL,
|
|
1341
|
+
authority_id TEXT NOT NULL,
|
|
1342
|
+
tenant_id TEXT NOT NULL,
|
|
1343
|
+
corpus_id TEXT NOT NULL,
|
|
1344
|
+
operation_id TEXT NOT NULL,
|
|
1345
|
+
step_id TEXT NOT NULL,
|
|
1346
|
+
resource_kind TEXT NOT NULL CHECK(resource_kind = 'project'),
|
|
1347
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'inverse')),
|
|
1348
|
+
target_selector TEXT NOT NULL,
|
|
1349
|
+
idempotency_key TEXT NOT NULL,
|
|
1350
|
+
request_digest TEXT NOT NULL,
|
|
1351
|
+
precondition_digest TEXT NOT NULL,
|
|
1352
|
+
normalized_call_digest TEXT NOT NULL,
|
|
1353
|
+
outcome TEXT NOT NULL CHECK(outcome IN (
|
|
1354
|
+
'accepted', 'duplicate_of_accepted', 'terminal_nonacceptance'
|
|
1355
|
+
)),
|
|
1356
|
+
reason TEXT,
|
|
1357
|
+
target_id TEXT,
|
|
1358
|
+
result_revision TEXT,
|
|
1359
|
+
result_digest TEXT,
|
|
1360
|
+
duplicate_of_receipt_id TEXT,
|
|
1361
|
+
accepted_receipt_id TEXT,
|
|
1362
|
+
created_by_operation BOOLEAN NOT NULL,
|
|
1363
|
+
created_at TIMESTAMPTZ NOT NULL
|
|
1364
|
+
);
|
|
1365
|
+
|
|
1366
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_project_registration_receipts_lookup
|
|
1367
|
+
ON mementos_project_registration_receipts (
|
|
1368
|
+
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
1369
|
+
resource_kind, direction, idempotency_key, target_selector
|
|
1370
|
+
);
|
|
1371
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_mementos_project_registration_receipts_accepted_step
|
|
1372
|
+
ON mementos_project_registration_receipts (
|
|
1373
|
+
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
1374
|
+
resource_kind, direction
|
|
1375
|
+
)
|
|
1376
|
+
WHERE outcome = 'accepted';
|
|
1377
|
+
|
|
1378
|
+
CREATE TABLE IF NOT EXISTS mementos_project_registration_bindings (
|
|
1379
|
+
authority_id TEXT NOT NULL,
|
|
1380
|
+
tenant_id TEXT NOT NULL,
|
|
1381
|
+
corpus_id TEXT NOT NULL,
|
|
1382
|
+
resource_kind TEXT NOT NULL CHECK(resource_kind = 'project'),
|
|
1383
|
+
target_selector TEXT NOT NULL,
|
|
1384
|
+
operation_id TEXT NOT NULL,
|
|
1385
|
+
step_id TEXT NOT NULL,
|
|
1386
|
+
direction TEXT NOT NULL CHECK(direction = 'forward'),
|
|
1387
|
+
idempotency_key TEXT NOT NULL,
|
|
1388
|
+
request_digest TEXT NOT NULL,
|
|
1389
|
+
precondition_digest TEXT NOT NULL,
|
|
1390
|
+
normalized_call_digest TEXT NOT NULL,
|
|
1391
|
+
state TEXT NOT NULL CHECK(state IN (
|
|
1392
|
+
'pending', 'accepted', 'terminal_nonacceptance', 'removed'
|
|
1393
|
+
)),
|
|
1394
|
+
target_id TEXT,
|
|
1395
|
+
accepted_receipt_id TEXT UNIQUE,
|
|
1396
|
+
result_revision TEXT,
|
|
1397
|
+
result_digest TEXT,
|
|
1398
|
+
removed_receipt_id TEXT,
|
|
1399
|
+
created_at TIMESTAMPTZ NOT NULL,
|
|
1400
|
+
updated_at TIMESTAMPTZ NOT NULL,
|
|
1401
|
+
PRIMARY KEY(authority_id, tenant_id, corpus_id, resource_kind, target_selector)
|
|
1402
|
+
);
|
|
1403
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_mementos_project_registration_binding_target
|
|
1404
|
+
ON mementos_project_registration_bindings(
|
|
1405
|
+
authority_id, tenant_id, corpus_id, resource_kind, target_id
|
|
1406
|
+
)
|
|
1407
|
+
WHERE target_id IS NOT NULL;
|
|
1408
|
+
|
|
1409
|
+
CREATE OR REPLACE FUNCTION mementos_project_registration_receipts_immutable()
|
|
1410
|
+
RETURNS trigger
|
|
1411
|
+
LANGUAGE plpgsql
|
|
1412
|
+
AS $$
|
|
1413
|
+
BEGIN
|
|
1414
|
+
RAISE EXCEPTION 'mementos project registration receipts are immutable';
|
|
1415
|
+
END;
|
|
1416
|
+
$$;
|
|
1417
|
+
DROP TRIGGER IF EXISTS mementos_project_registration_receipts_immutable
|
|
1418
|
+
ON mementos_project_registration_receipts;
|
|
1419
|
+
CREATE TRIGGER mementos_project_registration_receipts_immutable
|
|
1420
|
+
BEFORE UPDATE OR DELETE ON mementos_project_registration_receipts
|
|
1421
|
+
FOR EACH ROW EXECUTE FUNCTION mementos_project_registration_receipts_immutable();
|
|
1422
|
+
`;
|
|
1423
|
+
}
|
|
1424
|
+
function sqliteMementosProjectGuardedUpdateSchemaSql() {
|
|
1425
|
+
return `
|
|
1426
|
+
CREATE TABLE IF NOT EXISTS mementos_project_update_receipts (
|
|
1427
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1428
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1429
|
+
route TEXT NOT NULL CHECK(route = 'mementos.project-guarded-update.v1'),
|
|
1430
|
+
package_version TEXT NOT NULL,
|
|
1431
|
+
authority_id TEXT NOT NULL,
|
|
1432
|
+
tenant_id TEXT NOT NULL,
|
|
1433
|
+
corpus_id TEXT NOT NULL,
|
|
1434
|
+
operation_id TEXT NOT NULL,
|
|
1435
|
+
step_id TEXT NOT NULL,
|
|
1436
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'rollback')),
|
|
1437
|
+
idempotency_key TEXT NOT NULL,
|
|
1438
|
+
request_digest TEXT NOT NULL,
|
|
1439
|
+
outcome TEXT NOT NULL CHECK(outcome = 'accepted'),
|
|
1440
|
+
target_id TEXT NOT NULL,
|
|
1441
|
+
expected_revision TEXT NOT NULL,
|
|
1442
|
+
result_revision TEXT NOT NULL,
|
|
1443
|
+
result_digest TEXT NOT NULL,
|
|
1444
|
+
accepted_receipt_id TEXT,
|
|
1445
|
+
before_project_json TEXT NOT NULL,
|
|
1446
|
+
after_project_json TEXT NOT NULL,
|
|
1447
|
+
created_at TEXT NOT NULL,
|
|
1448
|
+
UNIQUE(authority_id, tenant_id, corpus_id, direction, idempotency_key)
|
|
1449
|
+
);
|
|
1450
|
+
|
|
1451
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_project_update_receipts_target
|
|
1452
|
+
ON mementos_project_update_receipts(
|
|
1453
|
+
authority_id, tenant_id, corpus_id, target_id, created_at
|
|
1454
|
+
);
|
|
1455
|
+
|
|
1456
|
+
CREATE TRIGGER IF NOT EXISTS mementos_project_update_receipts_immutable_update
|
|
1457
|
+
BEFORE UPDATE ON mementos_project_update_receipts
|
|
1458
|
+
BEGIN
|
|
1459
|
+
SELECT RAISE(ABORT, 'mementos project update receipts are immutable');
|
|
1460
|
+
END;
|
|
1461
|
+
|
|
1462
|
+
CREATE TRIGGER IF NOT EXISTS mementos_project_update_receipts_immutable_delete
|
|
1463
|
+
BEFORE DELETE ON mementos_project_update_receipts
|
|
1464
|
+
BEGIN
|
|
1465
|
+
SELECT RAISE(ABORT, 'mementos project update receipts are immutable');
|
|
1466
|
+
END;
|
|
1467
|
+
`;
|
|
1468
|
+
}
|
|
1469
|
+
function postgresMementosProjectGuardedUpdateSchemaSql() {
|
|
1470
|
+
return `
|
|
1471
|
+
CREATE TABLE IF NOT EXISTS mementos_project_update_receipts (
|
|
1472
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1473
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1474
|
+
route TEXT NOT NULL CHECK(route = 'mementos.project-guarded-update.v1'),
|
|
1475
|
+
package_version TEXT NOT NULL,
|
|
1476
|
+
authority_id TEXT NOT NULL,
|
|
1477
|
+
tenant_id TEXT NOT NULL,
|
|
1478
|
+
corpus_id TEXT NOT NULL,
|
|
1479
|
+
operation_id TEXT NOT NULL,
|
|
1480
|
+
step_id TEXT NOT NULL,
|
|
1481
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'rollback')),
|
|
1482
|
+
idempotency_key TEXT NOT NULL,
|
|
1483
|
+
request_digest TEXT NOT NULL,
|
|
1484
|
+
outcome TEXT NOT NULL CHECK(outcome = 'accepted'),
|
|
1485
|
+
target_id TEXT NOT NULL,
|
|
1486
|
+
expected_revision TEXT NOT NULL,
|
|
1487
|
+
result_revision TEXT NOT NULL,
|
|
1488
|
+
result_digest TEXT NOT NULL,
|
|
1489
|
+
accepted_receipt_id TEXT,
|
|
1490
|
+
before_project_json JSONB NOT NULL,
|
|
1491
|
+
after_project_json JSONB NOT NULL,
|
|
1492
|
+
created_at TIMESTAMPTZ NOT NULL,
|
|
1493
|
+
UNIQUE(authority_id, tenant_id, corpus_id, direction, idempotency_key)
|
|
1494
|
+
);
|
|
1495
|
+
|
|
1496
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_project_update_receipts_target
|
|
1497
|
+
ON mementos_project_update_receipts(
|
|
1498
|
+
authority_id, tenant_id, corpus_id, target_id, created_at
|
|
1499
|
+
);
|
|
1500
|
+
|
|
1501
|
+
CREATE OR REPLACE FUNCTION mementos_project_update_receipts_immutable()
|
|
1502
|
+
RETURNS trigger
|
|
1503
|
+
LANGUAGE plpgsql
|
|
1504
|
+
AS $$
|
|
1505
|
+
BEGIN
|
|
1506
|
+
RAISE EXCEPTION 'mementos project update receipts are immutable';
|
|
1507
|
+
END;
|
|
1508
|
+
$$;
|
|
1509
|
+
DROP TRIGGER IF EXISTS mementos_project_update_receipts_immutable
|
|
1510
|
+
ON mementos_project_update_receipts;
|
|
1511
|
+
CREATE TRIGGER mementos_project_update_receipts_immutable
|
|
1512
|
+
BEFORE UPDATE OR DELETE ON mementos_project_update_receipts
|
|
1513
|
+
FOR EACH ROW EXECUTE FUNCTION mementos_project_update_receipts_immutable();
|
|
1514
|
+
`;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
// src/memory-project-link/schema.ts
|
|
1518
|
+
function sqliteMementosMemoryProjectLinkSchemaSql() {
|
|
1519
|
+
return `
|
|
1520
|
+
CREATE TABLE IF NOT EXISTS mementos_memory_project_link_receipts (
|
|
1521
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1522
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1523
|
+
route TEXT NOT NULL CHECK(route = 'mementos.memory-project-link.v1'),
|
|
1524
|
+
package_version TEXT NOT NULL,
|
|
1525
|
+
authority_id TEXT NOT NULL,
|
|
1526
|
+
tenant_id TEXT NOT NULL,
|
|
1527
|
+
corpus_id TEXT NOT NULL,
|
|
1528
|
+
operation_id TEXT NOT NULL,
|
|
1529
|
+
step_id TEXT NOT NULL,
|
|
1530
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'rollback')),
|
|
1531
|
+
idempotency_key TEXT NOT NULL,
|
|
1532
|
+
request_digest TEXT NOT NULL,
|
|
1533
|
+
outcome TEXT NOT NULL CHECK(outcome IN ('accepted', 'no_change')),
|
|
1534
|
+
target_memory_id TEXT NOT NULL,
|
|
1535
|
+
requested_project_id TEXT NOT NULL,
|
|
1536
|
+
expected_memory_version INTEGER NOT NULL,
|
|
1537
|
+
expected_memory_revision TEXT NOT NULL,
|
|
1538
|
+
expected_project_revision TEXT,
|
|
1539
|
+
result_memory_version INTEGER NOT NULL,
|
|
1540
|
+
result_memory_revision TEXT NOT NULL,
|
|
1541
|
+
result_memory_digest TEXT NOT NULL,
|
|
1542
|
+
result_project_revision TEXT,
|
|
1543
|
+
result_project_digest TEXT,
|
|
1544
|
+
accepted_receipt_id TEXT,
|
|
1545
|
+
before_link_json TEXT NOT NULL,
|
|
1546
|
+
after_link_json TEXT NOT NULL,
|
|
1547
|
+
before_project_revision TEXT,
|
|
1548
|
+
before_project_digest TEXT,
|
|
1549
|
+
after_project_revision TEXT,
|
|
1550
|
+
after_project_digest TEXT,
|
|
1551
|
+
created_at TEXT NOT NULL,
|
|
1552
|
+
UNIQUE(authority_id, tenant_id, corpus_id, direction, idempotency_key)
|
|
1553
|
+
);
|
|
1554
|
+
|
|
1555
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_memory_project_link_receipts_target
|
|
1556
|
+
ON mementos_memory_project_link_receipts(
|
|
1557
|
+
authority_id, tenant_id, corpus_id, target_memory_id, created_at
|
|
1558
|
+
);
|
|
1559
|
+
|
|
1560
|
+
CREATE TRIGGER IF NOT EXISTS mementos_memory_project_link_receipts_immutable_update
|
|
1561
|
+
BEFORE UPDATE ON mementos_memory_project_link_receipts
|
|
1562
|
+
BEGIN
|
|
1563
|
+
SELECT RAISE(ABORT, 'mementos memory project link receipts are immutable');
|
|
1564
|
+
END;
|
|
1565
|
+
|
|
1566
|
+
CREATE TRIGGER IF NOT EXISTS mementos_memory_project_link_receipts_immutable_delete
|
|
1567
|
+
BEFORE DELETE ON mementos_memory_project_link_receipts
|
|
1568
|
+
BEGIN
|
|
1569
|
+
SELECT RAISE(ABORT, 'mementos memory project link receipts are immutable');
|
|
1570
|
+
END;
|
|
1571
|
+
`;
|
|
1572
|
+
}
|
|
1573
|
+
function postgresMementosMemoryProjectLinkSchemaSql() {
|
|
1574
|
+
return `
|
|
1575
|
+
CREATE TABLE IF NOT EXISTS mementos_memory_project_link_receipts (
|
|
1576
|
+
receipt_id TEXT PRIMARY KEY,
|
|
1577
|
+
authority TEXT NOT NULL CHECK(authority = 'mementos'),
|
|
1578
|
+
route TEXT NOT NULL CHECK(route = 'mementos.memory-project-link.v1'),
|
|
1579
|
+
package_version TEXT NOT NULL,
|
|
1580
|
+
authority_id TEXT NOT NULL,
|
|
1581
|
+
tenant_id TEXT NOT NULL,
|
|
1582
|
+
corpus_id TEXT NOT NULL,
|
|
1583
|
+
operation_id TEXT NOT NULL,
|
|
1584
|
+
step_id TEXT NOT NULL,
|
|
1585
|
+
direction TEXT NOT NULL CHECK(direction IN ('forward', 'rollback')),
|
|
1586
|
+
idempotency_key TEXT NOT NULL,
|
|
1587
|
+
request_digest TEXT NOT NULL,
|
|
1588
|
+
outcome TEXT NOT NULL CHECK(outcome IN ('accepted', 'no_change')),
|
|
1589
|
+
target_memory_id TEXT NOT NULL,
|
|
1590
|
+
requested_project_id TEXT NOT NULL,
|
|
1591
|
+
expected_memory_version INTEGER NOT NULL,
|
|
1592
|
+
expected_memory_revision TEXT NOT NULL,
|
|
1593
|
+
expected_project_revision TEXT,
|
|
1594
|
+
result_memory_version INTEGER NOT NULL,
|
|
1595
|
+
result_memory_revision TEXT NOT NULL,
|
|
1596
|
+
result_memory_digest TEXT NOT NULL,
|
|
1597
|
+
result_project_revision TEXT,
|
|
1598
|
+
result_project_digest TEXT,
|
|
1599
|
+
accepted_receipt_id TEXT,
|
|
1600
|
+
before_link_json JSONB NOT NULL,
|
|
1601
|
+
after_link_json JSONB NOT NULL,
|
|
1602
|
+
before_project_revision TEXT,
|
|
1603
|
+
before_project_digest TEXT,
|
|
1604
|
+
after_project_revision TEXT,
|
|
1605
|
+
after_project_digest TEXT,
|
|
1606
|
+
created_at TIMESTAMPTZ NOT NULL,
|
|
1607
|
+
UNIQUE(authority_id, tenant_id, corpus_id, direction, idempotency_key)
|
|
1608
|
+
);
|
|
1609
|
+
|
|
1610
|
+
CREATE INDEX IF NOT EXISTS idx_mementos_memory_project_link_receipts_target
|
|
1611
|
+
ON mementos_memory_project_link_receipts(
|
|
1612
|
+
authority_id, tenant_id, corpus_id, target_memory_id, created_at
|
|
1613
|
+
);
|
|
1614
|
+
|
|
1615
|
+
CREATE OR REPLACE FUNCTION mementos_memory_project_link_receipts_immutable()
|
|
1616
|
+
RETURNS trigger
|
|
1617
|
+
LANGUAGE plpgsql
|
|
1618
|
+
AS $$
|
|
1619
|
+
BEGIN
|
|
1620
|
+
RAISE EXCEPTION 'mementos memory project link receipts are immutable';
|
|
1621
|
+
END;
|
|
1622
|
+
$$;
|
|
1623
|
+
DROP TRIGGER IF EXISTS mementos_memory_project_link_receipts_immutable
|
|
1624
|
+
ON mementos_memory_project_link_receipts;
|
|
1625
|
+
CREATE TRIGGER mementos_memory_project_link_receipts_immutable
|
|
1626
|
+
BEFORE UPDATE OR DELETE ON mementos_memory_project_link_receipts
|
|
1627
|
+
FOR EACH ROW EXECUTE FUNCTION mementos_memory_project_link_receipts_immutable();
|
|
1628
|
+
`;
|
|
1629
|
+
}
|
|
1630
|
+
var init_schema = () => {};
|
|
1631
|
+
|
|
1244
1632
|
// src/db/migrations.ts
|
|
1245
1633
|
var MEMORY_VERSION_SNAPSHOT_TRIGGER = `
|
|
1246
1634
|
CREATE TRIGGER IF NOT EXISTS memories_version_snapshot
|
|
@@ -1261,6 +1649,7 @@ BEGIN
|
|
|
1261
1649
|
END;
|
|
1262
1650
|
`, MIGRATIONS;
|
|
1263
1651
|
var init_migrations = __esm(() => {
|
|
1652
|
+
init_schema();
|
|
1264
1653
|
MIGRATIONS = [
|
|
1265
1654
|
`
|
|
1266
1655
|
CREATE TABLE IF NOT EXISTS projects (
|
|
@@ -2194,6 +2583,18 @@ UPDATE memory_audit_log SET new_value_hash = NULL
|
|
|
2194
2583
|
AND new_value_hash NOT GLOB '*[^0-9A-F]*';
|
|
2195
2584
|
|
|
2196
2585
|
INSERT OR IGNORE INTO _migrations (id) VALUES (37);
|
|
2586
|
+
`,
|
|
2587
|
+
`
|
|
2588
|
+
${sqliteMementosProjectRegistrationSchemaSql()}
|
|
2589
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (38);
|
|
2590
|
+
`,
|
|
2591
|
+
`
|
|
2592
|
+
${sqliteMementosProjectGuardedUpdateSchemaSql()}
|
|
2593
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (39);
|
|
2594
|
+
`,
|
|
2595
|
+
`
|
|
2596
|
+
${sqliteMementosMemoryProjectLinkSchemaSql()}
|
|
2597
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (40);
|
|
2197
2598
|
`
|
|
2198
2599
|
];
|
|
2199
2600
|
});
|
|
@@ -12317,6 +12718,7 @@ var init_retention = __esm(() => {
|
|
|
12317
12718
|
// src/db/pg-migrations.ts
|
|
12318
12719
|
var PG_MIGRATIONS;
|
|
12319
12720
|
var init_pg_migrations = __esm(() => {
|
|
12721
|
+
init_schema();
|
|
12320
12722
|
PG_MIGRATIONS = [
|
|
12321
12723
|
`
|
|
12322
12724
|
CREATE TABLE IF NOT EXISTS projects (
|
|
@@ -13078,6 +13480,18 @@ var init_pg_migrations = __esm(() => {
|
|
|
13078
13480
|
$$ LANGUAGE plpgsql;
|
|
13079
13481
|
|
|
13080
13482
|
INSERT INTO _migrations (id) VALUES (37) ON CONFLICT DO NOTHING;
|
|
13483
|
+
`,
|
|
13484
|
+
`
|
|
13485
|
+
${postgresMementosProjectRegistrationSchemaSql()}
|
|
13486
|
+
INSERT INTO _migrations (id) VALUES (38) ON CONFLICT DO NOTHING;
|
|
13487
|
+
`,
|
|
13488
|
+
`
|
|
13489
|
+
${postgresMementosProjectGuardedUpdateSchemaSql()}
|
|
13490
|
+
INSERT INTO _migrations (id) VALUES (39) ON CONFLICT DO NOTHING;
|
|
13491
|
+
`,
|
|
13492
|
+
`
|
|
13493
|
+
${postgresMementosMemoryProjectLinkSchemaSql()}
|
|
13494
|
+
INSERT INTO _migrations (id) VALUES (40) ON CONFLICT DO NOTHING;
|
|
13081
13495
|
`
|
|
13082
13496
|
];
|
|
13083
13497
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory-project-link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,mCAAmC,EACnC,0CAA0C,EAC1C,wCAAwC,GACzC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MEMENTOS_MEMORY_PROJECT_LINK_ROUTE: "mementos.memory-project-link.v1";
|
|
2
|
+
export declare const MEMORY_PROJECT_LINK_RECEIPT_COLUMNS: readonly ["receipt_id", "authority", "route", "package_version", "authority_id", "tenant_id", "corpus_id", "operation_id", "step_id", "direction", "idempotency_key", "request_digest", "outcome", "target_memory_id", "requested_project_id", "expected_memory_version", "expected_memory_revision", "expected_project_revision", "result_memory_version", "result_memory_revision", "result_memory_digest", "result_project_revision", "result_project_digest", "accepted_receipt_id", "before_link_json", "after_link_json", "before_project_revision", "before_project_digest", "after_project_revision", "after_project_digest", "created_at"];
|
|
3
|
+
export declare function sqliteMementosMemoryProjectLinkSchemaSql(): string;
|
|
4
|
+
export declare function postgresMementosMemoryProjectLinkSchemaSql(): string;
|
|
5
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/memory-project-link/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,EAC7C,iCAA0C,CAAC;AAE7C,eAAO,MAAM,mCAAmC,qnBAgCtC,CAAC;AAEX,wBAAgB,wCAAwC,IAAI,MAAM,CAsDjE;AAED,wBAAgB,0CAA0C,IAAI,MAAM,CAwDnE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DbAdapter } from "../storage.js";
|
|
2
|
+
import { type MementosProjectRegistrationAuthority, type MementosProjectRegistrationAuthorityOptions, type MementosProjectRegistrationCapability, type MementosProjectRegistrationDirection, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
|
|
3
|
+
export declare function canonicalMementosProjectRegistrationJson(value: unknown): string;
|
|
4
|
+
export declare function digestMementosProjectRegistrationValue(value: unknown): string;
|
|
5
|
+
export declare function deriveMementosProjectRegistrationIdempotencyKey(input: {
|
|
6
|
+
operation_id: string;
|
|
7
|
+
step_id: string;
|
|
8
|
+
direction: MementosProjectRegistrationDirection;
|
|
9
|
+
target_selector: string;
|
|
10
|
+
request_digest: string;
|
|
11
|
+
precondition_digest: string;
|
|
12
|
+
}): string;
|
|
13
|
+
export declare class PackageOwnedMementosProjectRegistrationAuthority implements MementosProjectRegistrationAuthority {
|
|
14
|
+
private readonly db;
|
|
15
|
+
readonly authority: "mementos";
|
|
16
|
+
private readonly capabilityValue;
|
|
17
|
+
private readonly now;
|
|
18
|
+
private readonly faultInjector?;
|
|
19
|
+
constructor(db: DbAdapter, options?: MementosProjectRegistrationAuthorityOptions);
|
|
20
|
+
private fault;
|
|
21
|
+
private writeBoundary;
|
|
22
|
+
private terminal;
|
|
23
|
+
private duplicateForwardOrTerminal;
|
|
24
|
+
capability(): Promise<MementosProjectRegistrationCapability>;
|
|
25
|
+
create(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
|
|
26
|
+
readExact(request: {
|
|
27
|
+
resource_kind: "project";
|
|
28
|
+
target_id: string;
|
|
29
|
+
target: MementosProjectRegistrationPathHandle;
|
|
30
|
+
response_byte_limit: number;
|
|
31
|
+
time_budget_ms: number;
|
|
32
|
+
}): Promise<MementosProjectRegistrationRecord>;
|
|
33
|
+
lookupReceipt(request: MementosProjectRegistrationLookupRequest): Promise<MementosProjectRegistrationLookupResult>;
|
|
34
|
+
compensate(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
|
|
35
|
+
verifyInverse(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationInverseVerification>;
|
|
36
|
+
}
|
|
37
|
+
export declare function createMementosProjectRegistrationAuthority(db: DbAdapter, options?: MementosProjectRegistrationAuthorityOptions): MementosProjectRegistrationAuthority;
|
|
38
|
+
export declare const createLocalMementosProjectRegistrationAuthority: typeof createMementosProjectRegistrationAuthority;
|
|
39
|
+
//# sourceMappingURL=authority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../src/project-registration/authority.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS/C,OAAO,EAIL,KAAK,oCAAoC,EACzC,KAAK,2CAA2C,EAEhD,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EAEzC,KAAK,8CAA8C,EACnD,KAAK,wCAAwC,EAC7C,KAAK,uCAAuC,EAC5C,KAAK,qCAAqC,EAC1C,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EACxC,MAAM,YAAY,CAAC;AA8CpB,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/E;AAaD,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7E;AAMD,wBAAgB,+CAA+C,CAAC,KAAK,EAAE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oCAAoC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,GAAG,MAAM,CAUT;AAqwBD,qBAAa,gDACb,YAAW,oCAAoC;IAO3C,OAAO,CAAC,QAAQ,CAAC,EAAE;IANrB,QAAQ,CAAC,SAAS,EAAG,UAAU,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IACxE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAA+D;gBAG3E,EAAE,EAAE,SAAS,EAC9B,OAAO,GAAE,2CAAgD;IA0B3D,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,QAAQ;IAyBhB,OAAO,CAAC,0BAA0B;IA6C5B,UAAU,IAAI,OAAO,CAAC,qCAAqC,CAAC;IAO5D,MAAM,CACV,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IAkHxC,SAAS,CAAC,OAAO,EAAE;QACvB,aAAa,EAAE,SAAS,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,qCAAqC,CAAC;QAC9C,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,iCAAiC,CAAC;IA2BxC,aAAa,CACjB,OAAO,EAAE,wCAAwC,GAChD,OAAO,CAAC,uCAAuC,CAAC;IAa7C,UAAU,CACd,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IA4LxC,aAAa,CACjB,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,8CAA8C,CAAC;CAgD3D;AAED,wBAAgB,0CAA0C,CACxD,EAAE,EAAE,SAAS,EACb,OAAO,GAAE,2CAAgD,GACxD,oCAAoC,CAEtC;AAED,eAAO,MAAM,+CAA+C,mDAChB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type MementosProjectRegistrationAuthority, type MementosProjectRegistrationCapability, type MementosProjectRegistrationHttpClientOptions, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Handle one package-owned registration request. The canonical path is private
|
|
4
|
+
* request material and is converted back to a structural handle before the
|
|
5
|
+
* authority sees it; no capability or result serializes it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function handleMementosProjectRegistrationHttpRequest(request: Request, url: URL, authority: MementosProjectRegistrationAuthority, basePath?: "/v1/project-registration" | "/api/project-registration"): Promise<Response | null>;
|
|
8
|
+
export declare class MementosProjectRegistrationHttpClient implements MementosProjectRegistrationAuthority {
|
|
9
|
+
readonly authority: "mementos";
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
private readonly fetchImpl;
|
|
12
|
+
private readonly headers;
|
|
13
|
+
constructor(options: MementosProjectRegistrationHttpClientOptions);
|
|
14
|
+
private request;
|
|
15
|
+
capability(): Promise<MementosProjectRegistrationCapability>;
|
|
16
|
+
create(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
|
|
17
|
+
readExact(request: {
|
|
18
|
+
resource_kind: "project";
|
|
19
|
+
target_id: string;
|
|
20
|
+
target: MementosProjectRegistrationPathHandle;
|
|
21
|
+
response_byte_limit: number;
|
|
22
|
+
time_budget_ms: number;
|
|
23
|
+
}): Promise<MementosProjectRegistrationRecord>;
|
|
24
|
+
lookupReceipt(request: MementosProjectRegistrationLookupRequest): Promise<MementosProjectRegistrationLookupResult>;
|
|
25
|
+
compensate(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
|
|
26
|
+
verifyInverse(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationInverseVerification>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createMementosProjectRegistrationHttpClient(options: MementosProjectRegistrationHttpClientOptions): MementosProjectRegistrationAuthority;
|
|
29
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/project-registration/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oCAAoC,EACzC,KAAK,qCAAqC,EAC1C,KAAK,4CAA4C,EACjD,KAAK,8CAA8C,EACnD,KAAK,wCAAwC,EAC7C,KAAK,uCAAuC,EAC5C,KAAK,qCAAqC,EAC1C,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EAExC,MAAM,YAAY,CAAC;AA2FpB;;;;GAIG;AACH,wBAAsB,4CAA4C,CAChE,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,oCAAoC,EAC/C,QAAQ,GAAE,0BAA0B,GAAG,2BACX,GAC3B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAqD1B;AAsBD,qBAAa,qCACb,YAAW,oCAAoC;IAC7C,QAAQ,CAAC,SAAS,EAAG,UAAU,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,OAAO,EAAE,4CAA4C;YAUnD,OAAO;IAiCf,UAAU,IAAI,OAAO,CAAC,qCAAqC,CAAC;IAO5D,MAAM,CACV,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IAQxC,SAAS,CAAC,OAAO,EAAE;QACvB,aAAa,EAAE,SAAS,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,qCAAqC,CAAC;QAC9C,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,iCAAiC,CAAC;IAYxC,aAAa,CACjB,OAAO,EAAE,wCAAwC,GAChD,OAAO,CAAC,uCAAuC,CAAC;IAO7C,UAAU,CACd,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IAQxC,aAAa,CACjB,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,8CAA8C,CAAC;CAS3D;AAED,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,4CAA4C,GACpD,oCAAoC,CAEtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PackageOwnedMementosProjectRegistrationAuthority, canonicalMementosProjectRegistrationJson, createLocalMementosProjectRegistrationAuthority, createMementosProjectRegistrationAuthority, deriveMementosProjectRegistrationIdempotencyKey, digestMementosProjectRegistrationValue, } from "./authority.js";
|
|
2
|
+
export { MementosProjectRegistrationHttpClient, createMementosProjectRegistrationHttpClient, handleMementosProjectRegistrationHttpRequest, } from "./http.js";
|
|
3
|
+
export { postgresMementosProjectRegistrationSchemaSql, postgresMementosProjectGuardedUpdateSchemaSql, sqliteMementosProjectRegistrationSchemaSql, sqliteMementosProjectGuardedUpdateSchemaSql, } from "./schema.js";
|
|
4
|
+
export { MEMENTOS_PROJECT_REFERENCE_SURFACES, hasMementosProjectReferences, mementosProjectReferenceCounts, } from "./project-references.js";
|
|
5
|
+
export type { MementosProjectReferenceCounts, MementosProjectReferenceKey, } from "./project-references.js";
|
|
6
|
+
export { MEMENTOS_PROJECT_REGISTRATION_CALLER_ROUTE, MEMENTOS_PROJECT_REGISTRATION_ROUTE, MEMENTOS_PROJECT_REGISTRATION_SCHEMA_VERSION, MEMENTOS_PROJECT_GUARDED_UPDATE_ROUTE, MementosProjectRegistrationError, } from "./types.js";
|
|
7
|
+
export type { MementosProjectRegistrationAuthority, MementosProjectRegistrationAuthorityOptions, MementosProjectRegistrationBounds, MementosProjectRegistrationCapability, MementosProjectRegistrationDirection, MementosProjectRegistrationErrorCode, MementosProjectRegistrationFaultPoint, MementosProjectRegistrationHttpClientOptions, MementosProjectRegistrationInverseVerification, MementosProjectRegistrationLookupRequest, MementosProjectRegistrationLookupResult, MementosProjectRegistrationOutcome, MementosProjectRegistrationPathHandle, MementosProjectRegistrationReceipt, MementosProjectRegistrationRecord, MementosProjectRegistrationRequest, MementosProjectRegistrationResourceKind, MementosProjectRegistrationResponseControl, } from "./types.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-registration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gDAAgD,EAChD,wCAAwC,EACxC,+CAA+C,EAC/C,0CAA0C,EAC1C,+CAA+C,EAC/C,sCAAsC,GACvC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qCAAqC,EACrC,2CAA2C,EAC3C,4CAA4C,GAC7C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,4CAA4C,EAC5C,6CAA6C,EAC7C,0CAA0C,EAC1C,2CAA2C,GAC5C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mCAAmC,EACnC,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EACnC,4CAA4C,EAC5C,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oCAAoC,EACpC,2CAA2C,EAC3C,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,oCAAoC,EACpC,qCAAqC,EACrC,4CAA4C,EAC5C,8CAA8C,EAC9C,wCAAwC,EACxC,uCAAuC,EACvC,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,GAC3C,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { DbAdapter } from "../storage.js";
|
|
2
|
+
/**
|
|
3
|
+
* Every supported schema column that directly points at a Mementos project.
|
|
4
|
+
* Counts, receipt digests, inverse admission, and the conditional DELETE all
|
|
5
|
+
* derive from this registry so adding a relationship cannot update one guard
|
|
6
|
+
* while silently bypassing another.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MEMENTOS_PROJECT_REFERENCE_SURFACES: readonly [{
|
|
9
|
+
readonly key: "memories";
|
|
10
|
+
readonly table: "memories";
|
|
11
|
+
readonly column: "project_id";
|
|
12
|
+
}, {
|
|
13
|
+
readonly key: "sessions";
|
|
14
|
+
readonly table: "sessions";
|
|
15
|
+
readonly column: "project_id";
|
|
16
|
+
}, {
|
|
17
|
+
readonly key: "entities";
|
|
18
|
+
readonly table: "entities";
|
|
19
|
+
readonly column: "project_id";
|
|
20
|
+
}, {
|
|
21
|
+
readonly key: "agents";
|
|
22
|
+
readonly table: "agents";
|
|
23
|
+
readonly column: "active_project_id";
|
|
24
|
+
}, {
|
|
25
|
+
readonly key: "tool_events";
|
|
26
|
+
readonly table: "tool_events";
|
|
27
|
+
readonly column: "project_id";
|
|
28
|
+
}, {
|
|
29
|
+
readonly key: "tasks";
|
|
30
|
+
readonly table: "tasks";
|
|
31
|
+
readonly column: "project_id";
|
|
32
|
+
}, {
|
|
33
|
+
readonly key: "memory_consolidation_runs";
|
|
34
|
+
readonly table: "memory_consolidation_runs";
|
|
35
|
+
readonly column: "project_id";
|
|
36
|
+
}, {
|
|
37
|
+
readonly key: "memory_reflection_runs";
|
|
38
|
+
readonly table: "memory_reflection_runs";
|
|
39
|
+
readonly column: "project_id";
|
|
40
|
+
}, {
|
|
41
|
+
readonly key: "memory_acl";
|
|
42
|
+
readonly table: "memory_acl";
|
|
43
|
+
readonly column: "project_id";
|
|
44
|
+
}, {
|
|
45
|
+
readonly key: "search_history";
|
|
46
|
+
readonly table: "search_history";
|
|
47
|
+
readonly column: "project_id";
|
|
48
|
+
}, {
|
|
49
|
+
readonly key: "session_memory_jobs";
|
|
50
|
+
readonly table: "session_memory_jobs";
|
|
51
|
+
readonly column: "project_id";
|
|
52
|
+
}, {
|
|
53
|
+
readonly key: "synthesis_events";
|
|
54
|
+
readonly table: "synthesis_events";
|
|
55
|
+
readonly column: "project_id";
|
|
56
|
+
}, {
|
|
57
|
+
readonly key: "synthesis_runs";
|
|
58
|
+
readonly table: "synthesis_runs";
|
|
59
|
+
readonly column: "project_id";
|
|
60
|
+
}, {
|
|
61
|
+
readonly key: "webhook_hooks";
|
|
62
|
+
readonly table: "webhook_hooks";
|
|
63
|
+
readonly column: "project_id";
|
|
64
|
+
}];
|
|
65
|
+
export type MementosProjectReferenceKey = (typeof MEMENTOS_PROJECT_REFERENCE_SURFACES)[number]["key"];
|
|
66
|
+
export type MementosProjectReferenceCounts = Record<MementosProjectReferenceKey, number>;
|
|
67
|
+
export declare function mementosProjectReferenceCounts(db: DbAdapter, projectId: string): MementosProjectReferenceCounts;
|
|
68
|
+
export declare function hasMementosProjectReferences(counts: MementosProjectReferenceCounts): boolean;
|
|
69
|
+
/** Delete exactly one project only when every registered direct relationship is absent. */
|
|
70
|
+
export declare function deleteMementosProjectIfUnreferenced(db: DbAdapter, projectId: string): number;
|
|
71
|
+
//# sourceMappingURL=project-references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-references.d.ts","sourceRoot":"","sources":["../../src/project-registration/project-references.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BtC,CAAC;AAEX,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;AASzF,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,SAAS,EACb,SAAS,EAAE,MAAM,GAChB,8BAA8B,CAYhC;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAET;AAED,2FAA2F;AAC3F,wBAAgB,mCAAmC,CACjD,EAAE,EAAE,SAAS,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,CAaR"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function sqliteMementosProjectRegistrationSchemaSql(): string;
|
|
2
|
+
export declare function postgresMementosProjectRegistrationSchemaSql(): string;
|
|
3
|
+
export declare function sqliteMementosProjectGuardedUpdateSchemaSql(): string;
|
|
4
|
+
export declare function postgresMementosProjectGuardedUpdateSchemaSql(): string;
|
|
5
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/project-registration/schema.ts"],"names":[],"mappings":"AAAA,wBAAgB,0CAA0C,IAAI,MAAM,CAwFnE;AAED,wBAAgB,4CAA4C,IAAI,MAAM,CAyFrE;AAED,wBAAgB,2CAA2C,IAAI,MAAM,CA4CpE;AAED,wBAAgB,6CAA6C,IAAI,MAAM,CA8CtE"}
|