@remnic/core 9.3.550 → 9.3.552

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.
Files changed (56) hide show
  1. package/dist/access-cli.js +3 -3
  2. package/dist/access-http.d.ts +2 -2
  3. package/dist/access-http.js +4 -4
  4. package/dist/access-mcp.d.ts +2 -2
  5. package/dist/access-mcp.js +3 -3
  6. package/dist/access-schema.d.ts +34 -34
  7. package/dist/{access-service-CZfksQuS.d.ts → access-service-D2J9dh_9.d.ts} +3 -1
  8. package/dist/access-service.d.ts +2 -2
  9. package/dist/access-service.js +2 -2
  10. package/dist/active-memory-bridge.d.ts +1 -1
  11. package/dist/active-memory-bridge.js +2 -2
  12. package/dist/bootstrap.d.ts +1 -1
  13. package/dist/{chunk-GSFFWOWU.js → chunk-65OLPXBU.js} +5 -4
  14. package/dist/chunk-65OLPXBU.js.map +1 -0
  15. package/dist/{chunk-DEGH5BUP.js → chunk-BUUYY2H2.js} +4 -3
  16. package/dist/chunk-BUUYY2H2.js.map +1 -0
  17. package/dist/{chunk-2R6MP5C6.js → chunk-GEL3F3RV.js} +4 -4
  18. package/dist/{chunk-YN3WHXBG.js → chunk-KS7WO6EQ.js} +36 -9
  19. package/dist/chunk-KS7WO6EQ.js.map +1 -0
  20. package/dist/{chunk-IC4GELZE.js → chunk-NINRTFSV.js} +5 -2
  21. package/dist/chunk-NINRTFSV.js.map +1 -0
  22. package/dist/{chunk-XDMLTNIG.js → chunk-NYV435HC.js} +9 -2
  23. package/dist/chunk-NYV435HC.js.map +1 -0
  24. package/dist/{chunk-HWVTS5NO.js → chunk-UZYLX7M6.js} +7 -3
  25. package/dist/chunk-UZYLX7M6.js.map +1 -0
  26. package/dist/{cli-9pwA_PXm.d.ts → cli-OrfKXNU4.d.ts} +2 -2
  27. package/dist/cli.d.ts +3 -3
  28. package/dist/cli.js +5 -5
  29. package/dist/explicit-capture.d.ts +1 -1
  30. package/dist/index.d.ts +3 -3
  31. package/dist/index.js +7 -7
  32. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  33. package/dist/namespaces/principal.d.ts +5 -5
  34. package/dist/namespaces/principal.js +1 -1
  35. package/dist/{orchestrator-Co9nxRLF.d.ts → orchestrator-DTRQG75J.d.ts} +1 -1
  36. package/dist/orchestrator.d.ts +1 -1
  37. package/dist/orchestrator.js +2 -2
  38. package/dist/schemas.d.ts +64 -64
  39. package/dist/shared-context/manager.d.ts +2 -2
  40. package/dist/transfer/types.d.ts +12 -12
  41. package/package.json +1 -1
  42. package/src/access-http.ts +1 -0
  43. package/src/access-mcp.ts +1 -0
  44. package/src/access-service.ts +46 -8
  45. package/src/active-memory-bridge.test.ts +28 -0
  46. package/src/active-memory-bridge.ts +5 -2
  47. package/src/namespaces/principal.test.ts +20 -0
  48. package/src/namespaces/principal.ts +13 -7
  49. package/src/orchestrator.ts +13 -1
  50. package/dist/chunk-DEGH5BUP.js.map +0 -1
  51. package/dist/chunk-GSFFWOWU.js.map +0 -1
  52. package/dist/chunk-HWVTS5NO.js.map +0 -1
  53. package/dist/chunk-IC4GELZE.js.map +0 -1
  54. package/dist/chunk-XDMLTNIG.js.map +0 -1
  55. package/dist/chunk-YN3WHXBG.js.map +0 -1
  56. /package/dist/{chunk-2R6MP5C6.js.map → chunk-GEL3F3RV.js.map} +0 -0
@@ -112,7 +112,7 @@ import {
112
112
  defaultNamespaceForPrincipal,
113
113
  recallNamespacesForPrincipal,
114
114
  resolvePrincipal
115
- } from "./chunk-HWVTS5NO.js";
115
+ } from "./chunk-UZYLX7M6.js";
116
116
  import {
117
117
  log
118
118
  } from "./chunk-2ODBA7MQ.js";
@@ -1156,7 +1156,13 @@ var EngramAccessService = class {
1156
1156
  const normalizedRequest = { ...request, query };
1157
1157
  const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
1158
1158
  const principal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
1159
- return this.withBudgetLock(principal, async () => {
1159
+ if (this.orchestrator.config.namespacesEnabled && !principal) {
1160
+ throw new EngramAccessInputError(
1161
+ "authentication required: namespaces are enabled and no principal was supplied"
1162
+ );
1163
+ }
1164
+ const budgetLockPrincipal = principal ?? "default";
1165
+ return this.withBudgetLock(budgetLockPrincipal, async () => {
1160
1166
  let budgetRecordPrincipal = null;
1161
1167
  const response = await this.handleIdempotentRead({
1162
1168
  operation: "recall",
@@ -1214,7 +1220,13 @@ var EngramAccessService = class {
1214
1220
  );
1215
1221
  const namespace = namespaceOverride ?? this.orchestrator.config.defaultNamespace;
1216
1222
  const mode = this.normalizeRecallMode(request.mode);
1217
- const principal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
1223
+ const maybePrincipal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
1224
+ if (this.orchestrator.config.namespacesEnabled && !maybePrincipal) {
1225
+ throw new EngramAccessInputError(
1226
+ "authentication required: namespaces are enabled and no principal was supplied"
1227
+ );
1228
+ }
1229
+ const principal = maybePrincipal ?? "default";
1218
1230
  const principalNamespace = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
1219
1231
  const modeSkipsBudget = mode === "no_recall";
1220
1232
  const effectiveNamespaces = namespaceOverride ? [namespaceOverride] : recallNamespacesForPrincipal(principal, this.orchestrator.config);
@@ -1365,7 +1377,7 @@ var EngramAccessService = class {
1365
1377
  let auditAnomalies;
1366
1378
  if (this.auditAdapter) {
1367
1379
  try {
1368
- const resolvedAgentId = principal;
1380
+ const resolvedAgentId = principal ?? "__anonymous__";
1369
1381
  const auditEntry = {
1370
1382
  ts: (/* @__PURE__ */ new Date()).toISOString(),
1371
1383
  sessionKey: request.sessionKey ?? "",
@@ -1420,11 +1432,14 @@ var EngramAccessService = class {
1420
1432
  }
1421
1433
  async recallExplain(request = {}) {
1422
1434
  const requestedNamespace = request.namespace?.trim() ? this.resolveNamespace(request.namespace) : void 0;
1435
+ const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
1436
+ const principal = authenticatedPrincipal || resolvePrincipal(request.sessionKey, this.orchestrator.config);
1423
1437
  if (requestedNamespace) {
1424
- const principal = resolvePrincipal(request.sessionKey, this.orchestrator.config);
1425
1438
  if (!canReadNamespace(principal, requestedNamespace, this.orchestrator.config)) {
1426
1439
  return { found: false };
1427
1440
  }
1441
+ } else if (this.orchestrator.config.namespacesEnabled && !principal) {
1442
+ return { found: false };
1428
1443
  }
1429
1444
  const snapshot = request.sessionKey ? (() => {
1430
1445
  const candidate = this.orchestrator.lastRecall.get(request.sessionKey);
@@ -1437,13 +1452,25 @@ var EngramAccessService = class {
1437
1452
  if (!requestedNamespace) return candidate;
1438
1453
  return candidate.namespace === requestedNamespace ? candidate : null;
1439
1454
  })();
1440
- const namespace = requestedNamespace ?? snapshot?.namespace ?? this.orchestrator.config.defaultNamespace;
1455
+ const readableSnapshot = (() => {
1456
+ if (!snapshot || !this.orchestrator.config.namespacesEnabled) return snapshot;
1457
+ const snapshotNamespace = snapshot.namespace ?? this.orchestrator.config.defaultNamespace;
1458
+ return canReadNamespace(principal, snapshotNamespace, this.orchestrator.config) ? snapshot : null;
1459
+ })();
1460
+ const namespace = (() => {
1461
+ if (requestedNamespace) return requestedNamespace;
1462
+ if (readableSnapshot?.namespace) return readableSnapshot.namespace;
1463
+ const fallbackNamespace = this.orchestrator.config.defaultNamespace;
1464
+ if (!this.orchestrator.config.namespacesEnabled) return fallbackNamespace;
1465
+ return canReadNamespace(principal, fallbackNamespace, this.orchestrator.config) ? fallbackNamespace : null;
1466
+ })();
1467
+ if (!namespace) return { found: false };
1441
1468
  const [intent, graph] = await Promise.all([
1442
1469
  this.orchestrator.getLastIntentSnapshot(namespace),
1443
1470
  this.orchestrator.getLastGraphRecallSnapshot(namespace)
1444
1471
  ]);
1445
- if (!snapshot && !intent && !graph) return { found: false };
1446
- return { found: true, snapshot: snapshot ?? void 0, intent, graph };
1472
+ if (!readableSnapshot && !intent && !graph) return { found: false };
1473
+ return { found: true, snapshot: readableSnapshot ?? void 0, intent, graph };
1447
1474
  }
1448
1475
  async recallTierExplain(sessionKey, namespace, authenticatedPrincipal) {
1449
1476
  const namespacesEnabled = this.orchestrator.config.namespacesEnabled;
@@ -4211,4 +4238,4 @@ export {
4211
4238
  shapeMemorySummary,
4212
4239
  EngramAccessService
4213
4240
  };
4214
- //# sourceMappingURL=chunk-YN3WHXBG.js.map
4241
+ //# sourceMappingURL=chunk-KS7WO6EQ.js.map