@remnic/core 9.7.9 → 9.7.11
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/access-admin-ops-surface.js +5 -5
- package/dist/access-boundary.d.ts +1 -1
- package/dist/access-boundary.js +6 -6
- package/dist/access-cli.js +36 -36
- package/dist/access-http.d.ts +2 -1
- package/dist/access-http.js +10 -10
- package/dist/access-identity-continuity-surface.js +5 -5
- package/dist/access-lcm-surface.js +5 -5
- package/dist/access-mcp.js +9 -9
- package/dist/access-observe-write-surface.js +5 -5
- package/dist/access-operations-batch.js +7 -7
- package/dist/access-operations.d.ts +4 -4
- package/dist/access-operations.js +8 -8
- package/dist/access-recall-surface.js +5 -5
- package/dist/access-schema.d.ts +64 -64
- package/dist/access-service.js +5 -5
- package/dist/access-surface-catalog.js +2 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/briefing.js +3 -3
- package/dist/causal-consolidation.js +4 -4
- package/dist/{chunk-HHAA35A3.js → chunk-2VN4JAX7.js} +548 -161
- package/dist/chunk-2VN4JAX7.js.map +1 -0
- package/dist/{chunk-MLT5EG6K.js → chunk-3OQ4IZJN.js} +4 -4
- package/dist/{chunk-DLPXS7BE.js → chunk-5U65RIVI.js} +348 -49
- package/dist/chunk-5U65RIVI.js.map +1 -0
- package/dist/{chunk-QKVX4Y6D.js → chunk-673NPXE3.js} +2 -2
- package/dist/{chunk-POUD5BLV.js → chunk-6LM6PPDX.js} +4 -2
- package/dist/chunk-6LM6PPDX.js.map +1 -0
- package/dist/chunk-7XRUYC6G.js +1794 -0
- package/dist/chunk-7XRUYC6G.js.map +1 -0
- package/dist/{chunk-5CFHYQU3.js → chunk-DLWYAN6A.js} +2 -2
- package/dist/{chunk-TY43GBX2.js → chunk-EQF5763Z.js} +2 -2
- package/dist/{chunk-SKXBOZDF.js → chunk-GHVJASQ4.js} +3 -3
- package/dist/{chunk-YGAOLHKN.js → chunk-JYRFO4EH.js} +4 -4
- package/dist/{chunk-F3FC7SMO.js → chunk-JZM5QUTE.js} +2 -2
- package/dist/{chunk-PV7E2FGY.js → chunk-KXLRMM35.js} +6 -6
- package/dist/{chunk-PHXCPVSX.js → chunk-L4H6MQ7I.js} +2 -2
- package/dist/{chunk-FKCJH7KP.js → chunk-LQKITFGB.js} +2 -2
- package/dist/{chunk-27VEKQQA.js → chunk-MXRMNKSY.js} +3 -3
- package/dist/{chunk-EIKBKQ6L.js → chunk-QHT4W3RU.js} +127 -9
- package/dist/chunk-QHT4W3RU.js.map +1 -0
- package/dist/{chunk-CDGGQGUU.js → chunk-SBFDL2EQ.js} +2 -2
- package/dist/{chunk-I2THZUAF.js → chunk-SECMZACR.js} +2 -2
- package/dist/{chunk-JU3GHO6J.js → chunk-TGBJ2OMK.js} +2 -2
- package/dist/{chunk-DE6ENYLG.js → chunk-TXLGHDHS.js} +2 -2
- package/dist/{chunk-KGNFFCZJ.js → chunk-U4KHQTJ6.js} +2 -2
- package/dist/{chunk-Y5U35ZVS.js → chunk-UTDA43TB.js} +2 -2
- package/dist/{chunk-CK6RI52P.js → chunk-VCEH5UYS.js} +2 -2
- package/dist/{chunk-UXWGPODH.js → chunk-VRAD2FGO.js} +7 -7
- package/dist/{chunk-KKASNHGF.js → chunk-W6R43NLA.js} +19 -19
- package/dist/{chunk-UP25ZZCN.js → chunk-WUDBMLC6.js} +2 -2
- package/dist/{chunk-XG5CGR3K.js → chunk-XF4KOVDK.js} +5 -5
- package/dist/{chunk-KPXAJ77O.js → chunk-YLTG6BO4.js} +2 -2
- package/dist/cli.js +23 -23
- package/dist/compounding/engine.js +3 -3
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/index.js +3 -3
- package/dist/entity-retrieval.js +3 -3
- package/dist/index.d.ts +3990 -4
- package/dist/index.js +90 -43
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.js +8 -8
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/namespaces/migrate.js +4 -4
- package/dist/namespaces/storage.js +3 -3
- package/dist/operator-toolkit.js +7 -7
- package/dist/orchestration/maintenance.js +5 -5
- package/dist/orchestrator.js +36 -36
- package/dist/retrieval-agents.js +2 -2
- package/dist/schemas.d.ts +74 -74
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/shared-context/manager.d.ts +8 -8
- package/dist/storage.js +2 -2
- package/dist/temporal-index-compat.d.ts +1 -0
- package/dist/temporal-index-compat.js +16 -0
- package/dist/temporal-index-compat.js.map +1 -0
- package/dist/temporal-index.d.ts +58 -7
- package/dist/temporal-index.js +23 -3
- package/dist/transfer/types.d.ts +66 -66
- package/dist/verified-recall.js +3 -3
- package/package.json +2 -2
- package/src/access-boundary.ts +2 -0
- package/src/access-http.ts +147 -6
- package/src/access-mcp-cancellation.test.ts +2 -2
- package/src/access-operations.ts +2 -0
- package/src/access-surface-catalog.ts +2 -0
- package/src/index.ts +53 -0
- package/src/orchestration/consolidation-run.ts +5 -5
- package/src/orchestration/contradiction-linking-coordinator.ts +2 -2
- package/src/orchestration/lifecycle-policy-coordinator.ts +2 -2
- package/src/orchestration/persistence-index.ts +6 -6
- package/src/orchestration/recall-search-pipeline.ts +36 -21
- package/src/orchestration/semantic-consolidation-coordinator.ts +2 -2
- package/src/orchestrator.ts +0 -4
- package/src/relay/mission-access.test.ts +379 -0
- package/src/relay/mission-access.ts +125 -0
- package/src/relay/mission-fixture.ts +301 -0
- package/src/relay/mission.test.ts +964 -0
- package/src/relay/mission.ts +1725 -0
- package/src/temporal-index-compat.ts +311 -0
- package/src/temporal-index.test.ts +273 -22
- package/src/temporal-index.ts +427 -178
- package/dist/chunk-DLPXS7BE.js.map +0 -1
- package/dist/chunk-EIKBKQ6L.js.map +0 -1
- package/dist/chunk-HHAA35A3.js.map +0 -1
- package/dist/chunk-POUD5BLV.js.map +0 -1
- package/dist/chunk-VCFADTFS.js +0 -467
- package/dist/chunk-VCFADTFS.js.map +0 -1
- /package/dist/{chunk-MLT5EG6K.js.map → chunk-3OQ4IZJN.js.map} +0 -0
- /package/dist/{chunk-QKVX4Y6D.js.map → chunk-673NPXE3.js.map} +0 -0
- /package/dist/{chunk-5CFHYQU3.js.map → chunk-DLWYAN6A.js.map} +0 -0
- /package/dist/{chunk-TY43GBX2.js.map → chunk-EQF5763Z.js.map} +0 -0
- /package/dist/{chunk-SKXBOZDF.js.map → chunk-GHVJASQ4.js.map} +0 -0
- /package/dist/{chunk-YGAOLHKN.js.map → chunk-JYRFO4EH.js.map} +0 -0
- /package/dist/{chunk-F3FC7SMO.js.map → chunk-JZM5QUTE.js.map} +0 -0
- /package/dist/{chunk-PV7E2FGY.js.map → chunk-KXLRMM35.js.map} +0 -0
- /package/dist/{chunk-PHXCPVSX.js.map → chunk-L4H6MQ7I.js.map} +0 -0
- /package/dist/{chunk-FKCJH7KP.js.map → chunk-LQKITFGB.js.map} +0 -0
- /package/dist/{chunk-27VEKQQA.js.map → chunk-MXRMNKSY.js.map} +0 -0
- /package/dist/{chunk-CDGGQGUU.js.map → chunk-SBFDL2EQ.js.map} +0 -0
- /package/dist/{chunk-I2THZUAF.js.map → chunk-SECMZACR.js.map} +0 -0
- /package/dist/{chunk-JU3GHO6J.js.map → chunk-TGBJ2OMK.js.map} +0 -0
- /package/dist/{chunk-DE6ENYLG.js.map → chunk-TXLGHDHS.js.map} +0 -0
- /package/dist/{chunk-KGNFFCZJ.js.map → chunk-U4KHQTJ6.js.map} +0 -0
- /package/dist/{chunk-Y5U35ZVS.js.map → chunk-UTDA43TB.js.map} +0 -0
- /package/dist/{chunk-CK6RI52P.js.map → chunk-VCEH5UYS.js.map} +0 -0
- /package/dist/{chunk-UXWGPODH.js.map → chunk-VRAD2FGO.js.map} +0 -0
- /package/dist/{chunk-KKASNHGF.js.map → chunk-W6R43NLA.js.map} +0 -0
- /package/dist/{chunk-UP25ZZCN.js.map → chunk-WUDBMLC6.js.map} +0 -0
- /package/dist/{chunk-XG5CGR3K.js.map → chunk-XF4KOVDK.js.map} +0 -0
- /package/dist/{chunk-KPXAJ77O.js.map → chunk-YLTG6BO4.js.map} +0 -0
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
processChatMessage,
|
|
14
14
|
sessionBelongsToPrincipal,
|
|
15
15
|
subscribeChatTranscript
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GHVJASQ4.js";
|
|
17
|
+
import {
|
|
18
|
+
RelayMissionStoreError
|
|
19
|
+
} from "./chunk-7XRUYC6G.js";
|
|
17
20
|
import {
|
|
18
21
|
validateRequest
|
|
19
22
|
} from "./chunk-2MR3MFQB.js";
|
|
@@ -28,7 +31,7 @@ import {
|
|
|
28
31
|
} from "./chunk-35NN3ZFA.js";
|
|
29
32
|
import {
|
|
30
33
|
getOperation
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-6LM6PPDX.js";
|
|
32
35
|
import {
|
|
33
36
|
assertOperationAllowed,
|
|
34
37
|
enforceNamespaceAllowList,
|
|
@@ -38,7 +41,7 @@ import {
|
|
|
38
41
|
import {
|
|
39
42
|
CorrectionContractError,
|
|
40
43
|
EngramAccessInputError
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-3OQ4IZJN.js";
|
|
42
45
|
import {
|
|
43
46
|
isTrustZoneName
|
|
44
47
|
} from "./chunk-JGSKJHF7.js";
|
|
@@ -374,6 +377,20 @@ function decodePeerIdSegment(raw) {
|
|
|
374
377
|
throw new EngramAccessInputError("peerId path segment is not valid percent-encoded input");
|
|
375
378
|
}
|
|
376
379
|
}
|
|
380
|
+
function decodeRelayMissionIdSegment(raw) {
|
|
381
|
+
try {
|
|
382
|
+
return decodeURIComponent(raw);
|
|
383
|
+
} catch {
|
|
384
|
+
throw new EngramAccessInputError(
|
|
385
|
+
"missionId path segment is not valid percent-encoded input"
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function rejectBlankRelayNamespace(value) {
|
|
390
|
+
if (value !== void 0 && value !== null && value.trim().length === 0) {
|
|
391
|
+
throw new EngramAccessInputError("Relay namespace must not be blank when provided");
|
|
392
|
+
}
|
|
393
|
+
}
|
|
377
394
|
function codingContextFromProjectTag(projectTag) {
|
|
378
395
|
const projectId = projectTagProjectId(projectTag);
|
|
379
396
|
return {
|
|
@@ -403,7 +420,7 @@ var EngramAccessHttpServer = class {
|
|
|
403
420
|
readiness;
|
|
404
421
|
resourceMetadataUrl;
|
|
405
422
|
externalRequestHandler;
|
|
406
|
-
|
|
423
|
+
writeRequestSlots = [];
|
|
407
424
|
writeRateLimitMaxRequests;
|
|
408
425
|
writeRateLimitWindowMs;
|
|
409
426
|
mcpServer;
|
|
@@ -504,6 +521,14 @@ var EngramAccessHttpServer = class {
|
|
|
504
521
|
this.respondJson(res, 400, { error: err.message, code: "correction_contract_error" });
|
|
505
522
|
return;
|
|
506
523
|
}
|
|
524
|
+
if (err instanceof RelayMissionStoreError) {
|
|
525
|
+
const status = err.code === "idempotency_conflict" ? 409 : err.code === "limit_exceeded" ? 413 : err.code === "lock_unavailable" ? 503 : 500;
|
|
526
|
+
this.respondJson(res, status, {
|
|
527
|
+
error: status >= 500 ? "relay_backend_unavailable" : err.message,
|
|
528
|
+
code: `relay_${err.code}`
|
|
529
|
+
});
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
507
532
|
if (res.headersSent) {
|
|
508
533
|
res.destroy(err);
|
|
509
534
|
return;
|
|
@@ -1358,6 +1383,87 @@ var EngramAccessHttpServer = class {
|
|
|
1358
1383
|
this.respondJson(res, 200, await this.service.lcmStatus());
|
|
1359
1384
|
return;
|
|
1360
1385
|
}
|
|
1386
|
+
const relayEventMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)\/events$/.exec(pathname);
|
|
1387
|
+
if (req.method === "POST" && relayEventMatch) {
|
|
1388
|
+
const missionId = decodeRelayMissionIdSegment(relayEventMatch[1] ?? "");
|
|
1389
|
+
const body = await this.readJsonBody(req);
|
|
1390
|
+
const unexpectedFields = Object.keys(body).filter(
|
|
1391
|
+
(key) => key !== "namespace" && key !== "event"
|
|
1392
|
+
);
|
|
1393
|
+
if (unexpectedFields.length > 0) {
|
|
1394
|
+
throw new EngramAccessInputError(
|
|
1395
|
+
`Relay append body contains unexpected field(s): ${unexpectedFields.sort().join(", ")}`
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
if (!Object.prototype.hasOwnProperty.call(body, "event")) {
|
|
1399
|
+
throw new EngramAccessInputError("Relay append body must contain an event object");
|
|
1400
|
+
}
|
|
1401
|
+
if (Object.prototype.hasOwnProperty.call(body, "namespace") && body.namespace !== void 0 && body.namespace !== null && typeof body.namespace !== "string") {
|
|
1402
|
+
throw new EngramAccessInputError("namespace must be a string when provided");
|
|
1403
|
+
}
|
|
1404
|
+
rejectBlankRelayNamespace(
|
|
1405
|
+
typeof body.namespace === "string" ? body.namespace : void 0
|
|
1406
|
+
);
|
|
1407
|
+
const namespace = this.resolveNamespace(
|
|
1408
|
+
req,
|
|
1409
|
+
typeof body.namespace === "string" ? body.namespace : void 0
|
|
1410
|
+
);
|
|
1411
|
+
const op = getOperation("relay_mission_append");
|
|
1412
|
+
if (!op) {
|
|
1413
|
+
throw new Error("access-boundary: operation not registered: relay_mission_append");
|
|
1414
|
+
}
|
|
1415
|
+
let releaseWriteQuota;
|
|
1416
|
+
try {
|
|
1417
|
+
const output = await op.run(
|
|
1418
|
+
{ missionId, namespace, event: body.event },
|
|
1419
|
+
{
|
|
1420
|
+
service: this.service,
|
|
1421
|
+
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1422
|
+
hooks: {
|
|
1423
|
+
enforceWriteQuota: () => {
|
|
1424
|
+
releaseWriteQuota ??= this.reserveWriteRateLimitSlot();
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
if (output.result.appended) {
|
|
1430
|
+
releaseWriteQuota = void 0;
|
|
1431
|
+
}
|
|
1432
|
+
this.respondJson(res, output.result.appended ? 201 : 200, output.result);
|
|
1433
|
+
} finally {
|
|
1434
|
+
releaseWriteQuota?.();
|
|
1435
|
+
}
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
const relayMissionMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)$/.exec(pathname);
|
|
1439
|
+
if (req.method === "GET" && relayMissionMatch) {
|
|
1440
|
+
const missionId = decodeRelayMissionIdSegment(relayMissionMatch[1] ?? "");
|
|
1441
|
+
rejectBlankRelayNamespace(parsed.searchParams.get("namespace"));
|
|
1442
|
+
const namespace = this.resolveNamespace(
|
|
1443
|
+
req,
|
|
1444
|
+
parsed.searchParams.get("namespace") ?? void 0
|
|
1445
|
+
);
|
|
1446
|
+
const op = getOperation("relay_mission_read");
|
|
1447
|
+
if (!op) {
|
|
1448
|
+
throw new Error("access-boundary: operation not registered: relay_mission_read");
|
|
1449
|
+
}
|
|
1450
|
+
const output = await op.run(
|
|
1451
|
+
{
|
|
1452
|
+
missionId,
|
|
1453
|
+
namespace,
|
|
1454
|
+
since: parsed.searchParams.get("since") ?? void 0,
|
|
1455
|
+
until: parsed.searchParams.get("until") ?? void 0,
|
|
1456
|
+
limit: parsed.searchParams.get("limit") ?? void 0
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
service: this.service,
|
|
1460
|
+
authenticatedPrincipal: this.resolveRequestPrincipal(req)
|
|
1461
|
+
}
|
|
1462
|
+
);
|
|
1463
|
+
res.setHeader("cache-control", "no-store");
|
|
1464
|
+
this.respondJson(res, 200, output.result);
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1361
1467
|
if (req.method === "POST" && pathname === "/engram/v1/memories") {
|
|
1362
1468
|
const body = await this.readValidatedBody(req, "memoryStore");
|
|
1363
1469
|
const envelope = {
|
|
@@ -2917,15 +3023,27 @@ var EngramAccessHttpServer = class {
|
|
|
2917
3023
|
}
|
|
2918
3024
|
ensureWriteRateLimitAvailable() {
|
|
2919
3025
|
const now = Date.now();
|
|
2920
|
-
while (this.
|
|
2921
|
-
this.
|
|
3026
|
+
while (this.writeRequestSlots.length > 0 && now - (this.writeRequestSlots[0]?.recordedAt ?? 0) > this.writeRateLimitWindowMs) {
|
|
3027
|
+
this.writeRequestSlots.shift();
|
|
2922
3028
|
}
|
|
2923
|
-
if (this.
|
|
3029
|
+
if (this.writeRequestSlots.length >= this.writeRateLimitMaxRequests) {
|
|
2924
3030
|
throw new HttpError(429, "write_rate_limited", "write_rate_limited");
|
|
2925
3031
|
}
|
|
2926
3032
|
}
|
|
2927
3033
|
recordWriteRateLimitHit() {
|
|
2928
|
-
this.
|
|
3034
|
+
this.writeRequestSlots.push({ recordedAt: Date.now() });
|
|
3035
|
+
}
|
|
3036
|
+
reserveWriteRateLimitSlot() {
|
|
3037
|
+
this.ensureWriteRateLimitAvailable();
|
|
3038
|
+
const slot = { recordedAt: Date.now() };
|
|
3039
|
+
this.writeRequestSlots.push(slot);
|
|
3040
|
+
let active = true;
|
|
3041
|
+
return () => {
|
|
3042
|
+
if (!active) return;
|
|
3043
|
+
active = false;
|
|
3044
|
+
const index = this.writeRequestSlots.indexOf(slot);
|
|
3045
|
+
if (index >= 0) this.writeRequestSlots.splice(index, 1);
|
|
3046
|
+
};
|
|
2929
3047
|
}
|
|
2930
3048
|
shouldCountWriteRateLimit(response) {
|
|
2931
3049
|
return response.dryRun !== true && response.idempotencyReplay !== true;
|
|
@@ -2972,4 +3090,4 @@ function positiveIntQueryParam(value, label) {
|
|
|
2972
3090
|
export {
|
|
2973
3091
|
EngramAccessHttpServer
|
|
2974
3092
|
};
|
|
2975
|
-
//# sourceMappingURL=chunk-
|
|
3093
|
+
//# sourceMappingURL=chunk-QHT4W3RU.js.map
|