@remnic/core 9.3.716 → 9.3.717

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 (66) hide show
  1. package/dist/access-boundary.d.ts +2 -2
  2. package/dist/access-boundary.js +4 -3
  3. package/dist/access-cli.js +12 -11
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +2 -2
  6. package/dist/access-http.js +8 -7
  7. package/dist/access-mcp.d.ts +2 -2
  8. package/dist/access-mcp.js +7 -6
  9. package/dist/access-operations-batch.js +5 -4
  10. package/dist/access-operations.d.ts +2 -2
  11. package/dist/access-operations.js +6 -5
  12. package/dist/{access-service-BW8cm_uU.d.ts → access-service-d4Tk-Dlr.d.ts} +2 -2
  13. package/dist/access-service.d.ts +2 -2
  14. package/dist/access-service.js +3 -2
  15. package/dist/access-surface-catalog.d.ts +2 -2
  16. package/dist/bootstrap.d.ts +1 -1
  17. package/dist/{chunk-MECU6WSH.js → chunk-2B43BYYZ.js} +6 -6
  18. package/dist/chunk-2KF4HDG2.js +24 -0
  19. package/dist/chunk-2KF4HDG2.js.map +1 -0
  20. package/dist/{chunk-HHLWSWWF.js → chunk-BF2426TN.js} +2 -2
  21. package/dist/{chunk-RBHANGVX.js → chunk-BZAK3RBN.js} +2 -2
  22. package/dist/{chunk-SQ4LU27I.js → chunk-CTUWGJRI.js} +36 -59
  23. package/dist/chunk-CTUWGJRI.js.map +1 -0
  24. package/dist/{chunk-6QUPUTT7.js → chunk-DZYARLJ7.js} +5 -9
  25. package/dist/{chunk-6QUPUTT7.js.map → chunk-DZYARLJ7.js.map} +1 -1
  26. package/dist/{chunk-CTAHKIG6.js → chunk-EM22PCQR.js} +7 -7
  27. package/dist/{chunk-SHRRWOVY.js → chunk-J6BH2OBA.js} +64 -21
  28. package/dist/chunk-J6BH2OBA.js.map +1 -0
  29. package/dist/{chunk-GM3BMWKR.js → chunk-KHQ433G5.js} +2 -2
  30. package/dist/{chunk-SYDHFFAW.js → chunk-OUDAU3T5.js} +4 -4
  31. package/dist/{chunk-O62P2LFL.js → chunk-VZQXJNBD.js} +2 -2
  32. package/dist/{chunk-BNOAB5HH.js → chunk-YAINYEM3.js} +57 -48
  33. package/dist/chunk-YAINYEM3.js.map +1 -0
  34. package/dist/{chunk-3VUPWDSE.js → chunk-ZAVTEQFM.js} +4 -4
  35. package/dist/{chunk-IHMT6XTY.js → chunk-ZXLSNG3T.js} +3 -3
  36. package/dist/{cli-Dpivy32W.d.ts → cli-insNLYs6.d.ts} +2 -2
  37. package/dist/cli.d.ts +3 -3
  38. package/dist/cli.js +12 -11
  39. package/dist/explicit-capture.d.ts +1 -1
  40. package/dist/index.d.ts +4 -4
  41. package/dist/index.js +22 -21
  42. package/dist/index.js.map +1 -1
  43. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  44. package/dist/operator-toolkit.js +5 -3
  45. package/dist/orchestration/maintenance.js +5 -2
  46. package/dist/{orchestrator-vygo2YIM.d.ts → orchestrator-XPKhY2OV.d.ts} +2 -2
  47. package/dist/orchestrator.d.ts +1 -1
  48. package/dist/orchestrator.js +6 -5
  49. package/package.json +2 -2
  50. package/src/access-service.ts +56 -41
  51. package/src/maintenance/namespace-planner.ts +3 -10
  52. package/src/orchestrator.ts +35 -61
  53. package/src/scopes/scope-plan.test.ts +168 -1
  54. package/src/scopes/scope-plan.ts +163 -0
  55. package/dist/chunk-BNOAB5HH.js.map +0 -1
  56. package/dist/chunk-SHRRWOVY.js.map +0 -1
  57. package/dist/chunk-SQ4LU27I.js.map +0 -1
  58. /package/dist/{chunk-MECU6WSH.js.map → chunk-2B43BYYZ.js.map} +0 -0
  59. /package/dist/{chunk-HHLWSWWF.js.map → chunk-BF2426TN.js.map} +0 -0
  60. /package/dist/{chunk-RBHANGVX.js.map → chunk-BZAK3RBN.js.map} +0 -0
  61. /package/dist/{chunk-CTAHKIG6.js.map → chunk-EM22PCQR.js.map} +0 -0
  62. /package/dist/{chunk-GM3BMWKR.js.map → chunk-KHQ433G5.js.map} +0 -0
  63. /package/dist/{chunk-SYDHFFAW.js.map → chunk-OUDAU3T5.js.map} +0 -0
  64. /package/dist/{chunk-O62P2LFL.js.map → chunk-VZQXJNBD.js.map} +0 -0
  65. /package/dist/{chunk-3VUPWDSE.js.map → chunk-ZAVTEQFM.js.map} +0 -0
  66. /package/dist/{chunk-IHMT6XTY.js.map → chunk-ZXLSNG3T.js.map} +0 -0
@@ -32,18 +32,8 @@ import {
32
32
  runMemoryGovernance
33
33
  } from "./chunk-XZTUMWKQ.js";
34
34
  import {
35
- clusterByKey,
36
- combineNamespaces,
37
- defaultGitInvoker,
38
- expandScopeProfileReadNamespaces,
39
- lcmSessionKeyForNamespace,
40
- projectTagProjectId,
41
- resolveCodingNamespaceOverlay,
42
- resolveGitContext,
43
- resolveScopePlan,
44
- resolveScopeProfilePlan,
45
- sanitizeFragment
46
- } from "./chunk-SHRRWOVY.js";
35
+ clusterByKey
36
+ } from "./chunk-2KF4HDG2.js";
47
37
  import {
48
38
  getTrustZoneStoreStatus,
49
39
  isTrustZoneName,
@@ -59,6 +49,19 @@ import {
59
49
  import {
60
50
  estimateRecallTokens
61
51
  } from "./chunk-AJOIM6UR.js";
52
+ import {
53
+ combineNamespaces,
54
+ defaultGitInvoker,
55
+ expandScopeProfileReadNamespaces,
56
+ lcmSessionKeyForNamespace,
57
+ projectTagProjectId,
58
+ resolveCodingNamespaceOverlay,
59
+ resolveGitContext,
60
+ resolveScopePlan,
61
+ resolveScopeProfilePlan,
62
+ resolveWritableNamespaceValue,
63
+ sanitizeFragment
64
+ } from "./chunk-J6BH2OBA.js";
62
65
  import {
63
66
  namespaceCollectionName
64
67
  } from "./chunk-CTOQEZSN.js";
@@ -4412,13 +4415,19 @@ var EngramAccessService = class {
4412
4415
  if (trusted) return trusted;
4413
4416
  return resolvePrincipal(sessionKey, this.orchestrator.config);
4414
4417
  }
4415
- resolveWritableNamespace(namespace, sessionKey, authenticatedPrincipal) {
4416
- const resolved = this.resolveNamespace(namespace);
4417
- const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
4418
- if (!canWriteNamespace(principal, resolved, this.orchestrator.config)) {
4419
- throw new EngramAccessInputError(`namespace is not writable: ${resolved}`);
4418
+ writableNamespaceFor(namespace, sessionKey, authenticatedPrincipal) {
4419
+ const result = resolveWritableNamespaceValue(
4420
+ namespace,
4421
+ sessionKey,
4422
+ authenticatedPrincipal,
4423
+ this.orchestrator.config
4424
+ );
4425
+ if (!result.ok) {
4426
+ throw new EngramAccessInputError(
4427
+ result.reason === "unsupported" ? `unsupported namespace: ${result.namespace}` : `namespace is not writable: ${result.namespace}`
4428
+ );
4420
4429
  }
4421
- return resolved;
4430
+ return result.namespace;
4422
4431
  }
4423
4432
  /**
4424
4433
  * Resolve a coding context from `cwd`/`projectTag` WITHOUT persisting it to
@@ -4486,7 +4495,7 @@ var EngramAccessService = class {
4486
4495
  async resolveCodingScopedWriteNamespace(request) {
4487
4496
  const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
4488
4497
  if (hasExplicitNamespace) {
4489
- return this.resolveWritableNamespace(
4498
+ return this.writableNamespaceFor(
4490
4499
  request.namespace,
4491
4500
  request.sessionKey,
4492
4501
  request.authenticatedPrincipal
@@ -4504,7 +4513,7 @@ var EngramAccessService = class {
4504
4513
  return profilePlan.writeNamespace;
4505
4514
  }
4506
4515
  if (!overlay) {
4507
- return this.resolveWritableNamespace(
4516
+ return this.writableNamespaceFor(
4508
4517
  void 0,
4509
4518
  request.sessionKey,
4510
4519
  request.authenticatedPrincipal
@@ -4582,7 +4591,7 @@ var EngramAccessService = class {
4582
4591
  );
4583
4592
  const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
4584
4593
  if (hasExplicitNamespace) {
4585
- const writeNamespace2 = this.resolveWritableNamespace(
4594
+ const writeNamespace2 = this.writableNamespaceFor(
4586
4595
  request.namespace,
4587
4596
  request.sessionKey,
4588
4597
  request.authenticatedPrincipal
@@ -4676,7 +4685,7 @@ var EngramAccessService = class {
4676
4685
  };
4677
4686
  }
4678
4687
  if (!codingOverlayApplied) {
4679
- const writeNamespace2 = this.resolveWritableNamespace(
4688
+ const writeNamespace2 = this.writableNamespaceFor(
4680
4689
  void 0,
4681
4690
  request.sessionKey,
4682
4691
  request.authenticatedPrincipal
@@ -6687,14 +6696,14 @@ var EngramAccessService = class {
6687
6696
  if (this._correctionService) return this._correctionService;
6688
6697
  const service = createCorrectionService({
6689
6698
  orchestrator: this.orchestrator,
6690
- resolveAuthorizedNamespace: async (req) => this.resolveWritableNamespace(req.namespace, req.sessionKey, req.principal),
6699
+ resolveAuthorizedNamespace: async (req) => this.writableNamespaceFor(req.namespace, req.sessionKey, req.principal),
6691
6700
  resolveReadableNamespaces: (req) => {
6692
6701
  const principal = this.resolveRequestPrincipal(req.sessionKey, req.principal);
6693
6702
  return recallNamespacesForPrincipal(principal, this.orchestrator.config);
6694
6703
  },
6695
6704
  canWriteNamespace: (req) => {
6696
6705
  try {
6697
- this.resolveWritableNamespace(req.namespace, req.sessionKey, req.principal);
6706
+ this.writableNamespaceFor(req.namespace, req.sessionKey, req.principal);
6698
6707
  return Promise.resolve(true);
6699
6708
  } catch {
6700
6709
  return Promise.resolve(false);
@@ -7016,7 +7025,7 @@ var EngramAccessService = class {
7016
7025
  if (deepSleep.enabled === false && deepSleep.enabledExplicitlySet === true) {
7017
7026
  throw new Error("memory governance is disabled by dreams.phases.deepSleep.enabled=false");
7018
7027
  }
7019
- const resolvedNamespace = this.resolveWritableNamespace(
7028
+ const resolvedNamespace = this.writableNamespaceFor(
7020
7029
  request.namespace,
7021
7030
  void 0,
7022
7031
  request.authenticatedPrincipal ?? principal
@@ -7054,7 +7063,7 @@ var EngramAccessService = class {
7054
7063
  };
7055
7064
  }
7056
7065
  async procedureMiningRun(request, principal) {
7057
- const resolvedNamespace = this.resolveWritableNamespace(
7066
+ const resolvedNamespace = this.writableNamespaceFor(
7058
7067
  request.namespace,
7059
7068
  void 0,
7060
7069
  request.authenticatedPrincipal ?? principal
@@ -7073,7 +7082,7 @@ var EngramAccessService = class {
7073
7082
  };
7074
7083
  }
7075
7084
  async liveConnectorsRun(request = {}, principal) {
7076
- this.resolveWritableNamespace(
7085
+ this.writableNamespaceFor(
7077
7086
  void 0,
7078
7087
  void 0,
7079
7088
  request.authenticatedPrincipal ?? principal
@@ -7103,7 +7112,7 @@ var EngramAccessService = class {
7103
7112
  * other maintenance MCP tools.
7104
7113
  */
7105
7114
  async patternReinforcementRun(request = {}, principal) {
7106
- const resolvedNamespace = this.resolveWritableNamespace(
7115
+ const resolvedNamespace = this.writableNamespaceFor(
7107
7116
  request.namespace,
7108
7117
  void 0,
7109
7118
  request.authenticatedPrincipal ?? principal
@@ -7337,7 +7346,7 @@ var EngramAccessService = class {
7337
7346
  if (!isTrustZoneName(request.targetZone)) {
7338
7347
  throw new EngramAccessInputError(`unsupported trust-zone target: ${String(request.targetZone)}`);
7339
7348
  }
7340
- const resolvedNamespace = this.resolveWritableNamespace(
7349
+ const resolvedNamespace = this.writableNamespaceFor(
7341
7350
  request.namespace,
7342
7351
  void 0,
7343
7352
  request.authenticatedPrincipal
@@ -7368,7 +7377,7 @@ var EngramAccessService = class {
7368
7377
  };
7369
7378
  }
7370
7379
  async trustZoneDemoSeed(request) {
7371
- const resolvedNamespace = this.resolveWritableNamespace(
7380
+ const resolvedNamespace = this.writableNamespaceFor(
7372
7381
  request.namespace,
7373
7382
  void 0,
7374
7383
  request.authenticatedPrincipal
@@ -7401,7 +7410,7 @@ var EngramAccessService = class {
7401
7410
  if (reasonCode.length === 0) {
7402
7411
  throw new EngramAccessInputError("reasonCode is required");
7403
7412
  }
7404
- const resolvedNamespace = this.resolveWritableNamespace(
7413
+ const resolvedNamespace = this.writableNamespaceFor(
7405
7414
  request.namespace,
7406
7415
  void 0,
7407
7416
  request.authenticatedPrincipal
@@ -8148,7 +8157,7 @@ var EngramAccessService = class {
8148
8157
  }
8149
8158
  const symptom = request.symptom?.trim();
8150
8159
  if (!symptom) throw new EngramAccessInputError("symptom is required");
8151
- const resolvedNs = this.resolveWritableNamespace(request.namespace, void 0, request.principal);
8160
+ const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
8152
8161
  const storage = await this.orchestrator.getStorage(resolvedNs);
8153
8162
  const created = await storage.appendContinuityIncident({
8154
8163
  symptom,
@@ -8170,7 +8179,7 @@ var EngramAccessService = class {
8170
8179
  if (!fixApplied) throw new EngramAccessInputError("fixApplied is required");
8171
8180
  const verificationResult = request.verificationResult?.trim();
8172
8181
  if (!verificationResult) throw new EngramAccessInputError("verificationResult is required");
8173
- const resolvedNs = this.resolveWritableNamespace(request.namespace, void 0, request.principal);
8182
+ const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
8174
8183
  const storage = await this.orchestrator.getStorage(resolvedNs);
8175
8184
  const closed = await storage.closeContinuityIncident(id, {
8176
8185
  fixApplied,
@@ -8195,7 +8204,7 @@ var EngramAccessService = class {
8195
8204
  if (!this.orchestrator.config.identityContinuityEnabled) {
8196
8205
  return { enabled: false, reason: "Identity continuity is disabled." };
8197
8206
  }
8198
- const resolvedNs = this.resolveWritableNamespace(request.namespace, void 0, request.principal);
8207
+ const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
8199
8208
  const storage = await this.orchestrator.getStorage(resolvedNs);
8200
8209
  const loop = await storage.upsertIdentityImprovementLoop({
8201
8210
  id: request.id?.trim() || "",
@@ -8214,7 +8223,7 @@ var EngramAccessService = class {
8214
8223
  }
8215
8224
  const id = request.id?.trim();
8216
8225
  if (!id) throw new EngramAccessInputError("id is required");
8217
- const resolvedNs = this.resolveWritableNamespace(request.namespace, void 0, request.principal);
8226
+ const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
8218
8227
  const storage = await this.orchestrator.getStorage(resolvedNs);
8219
8228
  const reviewed = await storage.reviewIdentityImprovementLoop(id, {
8220
8229
  status: request.status,
@@ -8254,7 +8263,7 @@ var EngramAccessService = class {
8254
8263
  };
8255
8264
  const hasUpdate = Object.values(updates).some((v) => typeof v === "string" && v.length > 0);
8256
8265
  if (!hasUpdate) throw new EngramAccessInputError("At least one section field is required.");
8257
- const resolvedNs = this.resolveWritableNamespace(request.namespace, void 0, request.principal);
8266
+ const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
8258
8267
  const storage = await this.orchestrator.getStorage(resolvedNs);
8259
8268
  const existing = await storage.readIdentityAnchor();
8260
8269
  const merged = this.mergeIdentityAnchorSections(existing, updates);
@@ -8757,7 +8766,7 @@ ${next}`);
8757
8766
  "memoryId must not contain path separators"
8758
8767
  );
8759
8768
  }
8760
- const resolvedNs = this.resolveWritableNamespace(
8769
+ const resolvedNs = this.writableNamespaceFor(
8761
8770
  request.namespace,
8762
8771
  request.sessionKey,
8763
8772
  request.principal
@@ -8770,7 +8779,7 @@ ${next}`);
8770
8779
  });
8771
8780
  }
8772
8781
  async memoryPromote(request) {
8773
- const resolvedNs = this.resolveWritableNamespace(request.namespace, request.sessionKey, request.principal);
8782
+ const resolvedNs = this.writableNamespaceFor(request.namespace, request.sessionKey, request.principal);
8774
8783
  const storage = await this.orchestrator.getStorage(resolvedNs);
8775
8784
  await storage.updateMemoryFrontmatter(request.memoryId, {
8776
8785
  lifecycleState: "active",
@@ -8804,7 +8813,7 @@ ${next}`);
8804
8813
  `memory_action_apply: outcome must be "applied", "skipped", or "failed"; got ${JSON.stringify(outcome)}`
8805
8814
  );
8806
8815
  }
8807
- const resolvedNs = this.resolveWritableNamespace(
8816
+ const resolvedNs = this.writableNamespaceFor(
8808
8817
  request.namespace,
8809
8818
  request.sessionKey,
8810
8819
  request.principal
@@ -8839,7 +8848,7 @@ ${next}`);
8839
8848
  return { recorded, event: preview };
8840
8849
  }
8841
8850
  async contextCheckpoint(request) {
8842
- const resolvedNs = this.resolveWritableNamespace(request.namespace, request.sessionKey, request.principal);
8851
+ const resolvedNs = this.writableNamespaceFor(request.namespace, request.sessionKey, request.principal);
8843
8852
  const storage = await this.orchestrator.getStorage(resolvedNs);
8844
8853
  const storageDir = storage.dir;
8845
8854
  const { writeFile: writeFile4, mkdir: mkdir5 } = await import("fs/promises");
@@ -8881,7 +8890,7 @@ ${next}`);
8881
8890
  */
8882
8891
  async recordCitationUsage(request) {
8883
8892
  if (request.entries.length === 0) return { submitted: 0, matched: 0 };
8884
- const resolvedNamespace = this.resolveWritableNamespace(
8893
+ const resolvedNamespace = this.writableNamespaceFor(
8885
8894
  request.namespace,
8886
8895
  request.sessionId,
8887
8896
  request.authenticatedPrincipal
@@ -9108,7 +9117,7 @@ ${next}`);
9108
9117
  "authentication required: namespaces are enabled and no principal was supplied"
9109
9118
  );
9110
9119
  }
9111
- const resolved = this.resolveWritableNamespace(namespace, void 0, principal);
9120
+ const resolved = this.writableNamespaceFor(namespace, void 0, principal);
9112
9121
  const storage = await this.orchestrator.getStorage(resolved);
9113
9122
  return { namespace: resolved, storage };
9114
9123
  }
@@ -9151,7 +9160,7 @@ ${next}`);
9151
9160
  */
9152
9161
  async capsuleImport(opts) {
9153
9162
  const { namespace, principal, root: explicitRoot, memoryDir: explicitMemoryDir, ...importOptions } = opts;
9154
- const resolvedNamespace = this.resolveWritableNamespace(namespace, void 0, principal);
9163
+ const resolvedNamespace = this.writableNamespaceFor(namespace, void 0, principal);
9155
9164
  const storage = await this.orchestrator.getStorage(resolvedNamespace);
9156
9165
  const root = explicitRoot ?? storage.dir;
9157
9166
  const memoryDir = explicitMemoryDir ?? this.orchestrator.config.memoryDir;
@@ -9211,7 +9220,7 @@ ${next}`);
9211
9220
  */
9212
9221
  async capsuleExport(opts) {
9213
9222
  const { namespace, principal, root: explicitRoot, memoryDir: explicitMemoryDir, ...exportOptions } = opts;
9214
- const resolvedNamespace = this.resolveWritableNamespace(namespace, void 0, principal);
9223
+ const resolvedNamespace = this.writableNamespaceFor(namespace, void 0, principal);
9215
9224
  const storage = await this.orchestrator.getStorage(resolvedNamespace);
9216
9225
  const root = explicitRoot ?? storage.dir;
9217
9226
  const memoryDir = explicitMemoryDir ?? this.orchestrator.config.memoryDir;
@@ -9394,7 +9403,7 @@ ${next}`);
9394
9403
  }
9395
9404
  }
9396
9405
  async offlineSyncApplyFileContent(options) {
9397
- const resolvedNamespace = this.resolveWritableNamespace(
9406
+ const resolvedNamespace = this.writableNamespaceFor(
9398
9407
  options.namespace,
9399
9408
  void 0,
9400
9409
  options.principal
@@ -9431,7 +9440,7 @@ ${next}`);
9431
9440
  }
9432
9441
  }
9433
9442
  async offlineSyncApply(options) {
9434
- const resolvedNamespace = this.resolveWritableNamespace(
9443
+ const resolvedNamespace = this.writableNamespaceFor(
9435
9444
  options.namespace,
9436
9445
  void 0,
9437
9446
  options.principal
@@ -9497,7 +9506,7 @@ ${next}`);
9497
9506
  );
9498
9507
  }
9499
9508
  const dryRun = options.dryRun === true;
9500
- const resolvedNamespace = this.resolveWritableNamespace(
9509
+ const resolvedNamespace = this.writableNamespaceFor(
9501
9510
  options.namespace,
9502
9511
  void 0,
9503
9512
  options.authenticatedPrincipal
@@ -9751,4 +9760,4 @@ export {
9751
9760
  shapeMemorySummary,
9752
9761
  EngramAccessService
9753
9762
  };
9754
- //# sourceMappingURL=chunk-BNOAB5HH.js.map
9763
+ //# sourceMappingURL=chunk-YAINYEM3.js.map