@remnic/core 9.3.756 → 9.3.758

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 (171) hide show
  1. package/dist/access-admin-ops-surface.d.ts +1 -1
  2. package/dist/access-admin-ops-surface.js +25 -25
  3. package/dist/access-boundary.d.ts +1 -1
  4. package/dist/access-boundary.js +26 -26
  5. package/dist/access-cli.js +86 -85
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-http.d.ts +1 -1
  8. package/dist/access-http.js +31 -31
  9. package/dist/access-identity-continuity-surface.d.ts +166 -0
  10. package/dist/access-identity-continuity-surface.js +128 -0
  11. package/dist/access-lcm-surface.d.ts +1 -1
  12. package/dist/access-lcm-surface.js +25 -25
  13. package/dist/access-mcp.d.ts +1 -1
  14. package/dist/access-mcp.js +30 -30
  15. package/dist/access-observe-write-surface.d.ts +1 -1
  16. package/dist/access-observe-write-surface.js +25 -25
  17. package/dist/access-operations-batch.js +27 -27
  18. package/dist/access-operations.d.ts +1 -1
  19. package/dist/access-operations.js +29 -29
  20. package/dist/access-recall-surface.d.ts +1 -1
  21. package/dist/access-recall-surface.js +25 -25
  22. package/dist/access-schema.js +4 -4
  23. package/dist/{access-service-CJwcDoQp.d.ts → access-service-Z-8CnmrW.d.ts} +3 -2
  24. package/dist/access-service.d.ts +1 -1
  25. package/dist/access-service.js +25 -25
  26. package/dist/access-surface-catalog.d.ts +1 -1
  27. package/dist/{auto-sync-RZO5ZPHR.js → auto-sync-2SOUW4JW.js} +5 -5
  28. package/dist/briefing.js +9 -9
  29. package/dist/calibration.js +2 -2
  30. package/dist/{capsule-crypto-FFWJ4X4A.js → capsule-crypto-CZJSLEFG.js} +2 -2
  31. package/dist/capsule-crypto-CZJSLEFG.js.map +1 -0
  32. package/dist/causal-consolidation.js +13 -13
  33. package/dist/{chunk-WEPWY4HB.js → chunk-2BFLDH5F.js} +2 -2
  34. package/dist/{chunk-JTYM4HPA.js → chunk-2MR3MFQB.js} +2 -2
  35. package/dist/chunk-3I4FUAVJ.js +20 -0
  36. package/dist/chunk-3I4FUAVJ.js.map +1 -0
  37. package/dist/{chunk-TH7WMHVK.js → chunk-3NN73CM7.js} +2 -2
  38. package/dist/{chunk-A6XCHI53.js → chunk-3QLPBCFG.js} +8 -8
  39. package/dist/{chunk-EJJQDP3H.js → chunk-437S3G37.js} +1 -1
  40. package/dist/{chunk-DWDDQLSZ.js → chunk-6C6BBBCI.js} +276 -202
  41. package/dist/chunk-6C6BBBCI.js.map +1 -0
  42. package/dist/{chunk-7XH7VJN4.js → chunk-6T4LTI2F.js} +4 -4
  43. package/dist/{chunk-UNV6ZGTS.js → chunk-7I2QTC2K.js} +2 -2
  44. package/dist/{chunk-6DA5BBLS.js → chunk-7ME6VBF7.js} +107 -107
  45. package/dist/{chunk-AGNBY3VG.js → chunk-APJQ6UEA.js} +4 -4
  46. package/dist/{chunk-GG6G2RYR.js → chunk-CJDGB3EG.js} +2 -2
  47. package/dist/{chunk-PRX77NPC.js → chunk-CQCCVJZO.js} +2 -2
  48. package/dist/{chunk-ZUDM75KG.js → chunk-DCWIQFNA.js} +4 -4
  49. package/dist/{chunk-7APVFQ34.js → chunk-DUQHQ3TL.js} +294 -238
  50. package/dist/chunk-DUQHQ3TL.js.map +1 -0
  51. package/dist/{chunk-EF3VFQC4.js → chunk-EOTTKLPJ.js} +2 -2
  52. package/dist/{chunk-TCKP4EHY.js → chunk-FLVL4L3L.js} +2 -2
  53. package/dist/{chunk-NLXKSM46.js → chunk-HO3VUUGI.js} +2 -2
  54. package/dist/{chunk-4I45UZ4V.js → chunk-IBAU2RZN.js} +2 -2
  55. package/dist/{chunk-OLAVQS6S.js → chunk-ILB2MFTS.js} +2 -2
  56. package/dist/{chunk-4AC57RCM.js → chunk-IWI2ICTF.js} +4 -4
  57. package/dist/{chunk-5VWRYFQE.js → chunk-K2DJQOE3.js} +2 -2
  58. package/dist/{chunk-BTH6MQJT.js → chunk-LQDA67TT.js} +2 -2
  59. package/dist/{chunk-PBZQVVLG.js → chunk-LX4ZWRGD.js} +2 -2
  60. package/dist/{chunk-3I2IASNK.js → chunk-M5QKGHCR.js} +2 -2
  61. package/dist/{chunk-PPAEJXVF.js → chunk-NNL4LJAD.js} +2 -2
  62. package/dist/{chunk-TXV3I2O6.js → chunk-ODC4HOUZ.js} +2 -2
  63. package/dist/{chunk-7CFGXWYX.js → chunk-PJ5AG6D4.js} +2 -2
  64. package/dist/{chunk-EVVLGYHR.js → chunk-QEAOKI4U.js} +3 -3
  65. package/dist/{chunk-ZUHD6XZZ.js → chunk-QJUZAUAD.js} +32 -32
  66. package/dist/{chunk-REZ4TUD2.js → chunk-QKOTOUVR.js} +3 -3
  67. package/dist/{chunk-NG2NHB4C.js → chunk-QOGXUNWL.js} +2 -2
  68. package/dist/{chunk-YMGQXBPS.js → chunk-RF6BZHOD.js} +2 -2
  69. package/dist/{chunk-6DXXIXED.js → chunk-RQNV75HR.js} +2 -2
  70. package/dist/{chunk-GBXP62CL.js → chunk-TMXTQCJ7.js} +4 -4
  71. package/dist/{chunk-ZW5SZ3TH.js → chunk-TVWF3GNF.js} +8 -8
  72. package/dist/{chunk-5J4OL7TJ.js → chunk-VUA4S7P6.js} +4 -4
  73. package/dist/{chunk-PS572XYO.js → chunk-XQT5GSWU.js} +2 -2
  74. package/dist/{chunk-H2T4OJNI.js → chunk-YQYG24C6.js} +4 -4
  75. package/dist/{chunk-2OZ2JEUP.js → chunk-YTU7WKYN.js} +2 -2
  76. package/dist/{chunk-Y4TAFMUE.js → chunk-ZFYML7C3.js} +2 -2
  77. package/dist/{chunk-5ZKT7WTR.js → chunk-ZLOD23PD.js} +5 -5
  78. package/dist/{cli-cZyANcmY.d.ts → cli-C5pCwszN.d.ts} +1 -1
  79. package/dist/cli.d.ts +2 -2
  80. package/dist/cli.js +52 -52
  81. package/dist/compounding/engine.js +9 -9
  82. package/dist/config-record.d.ts +11 -0
  83. package/dist/config-record.js +8 -0
  84. package/dist/config-record.js.map +1 -0
  85. package/dist/connectors/codex-materialize-runner.js +9 -9
  86. package/dist/connectors/index.js +9 -9
  87. package/dist/consolidation-provenance-check.js +2 -2
  88. package/dist/conversation-index/backend.js +2 -2
  89. package/dist/entity-retrieval.js +9 -9
  90. package/dist/extraction-faithfulness.js +3 -3
  91. package/dist/extraction-judge.js +3 -3
  92. package/dist/extraction.js +3 -3
  93. package/dist/fallback-llm.js +2 -2
  94. package/dist/index.d.ts +3 -2
  95. package/dist/index.js +124 -120
  96. package/dist/lcm/index.js +3 -3
  97. package/dist/maintenance/memory-governance.js +9 -9
  98. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +9 -9
  99. package/dist/maintenance/rebuild-memory-projection.js +10 -10
  100. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  101. package/dist/namespaces/migrate.js +16 -16
  102. package/dist/namespaces/search.js +6 -6
  103. package/dist/namespaces/storage.js +9 -9
  104. package/dist/operator-toolkit.js +21 -21
  105. package/dist/orchestration/maintenance.js +11 -11
  106. package/dist/orchestrator.js +85 -84
  107. package/dist/recall-planner-llm.js +2 -2
  108. package/dist/search/factory.js +5 -5
  109. package/dist/search/index.js +9 -9
  110. package/dist/semantic-consolidation.js +10 -10
  111. package/dist/semantic-rule-promotion.js +9 -9
  112. package/dist/semantic-rule-verifier.js +9 -9
  113. package/dist/storage.d.ts +3 -4
  114. package/dist/storage.js +8 -8
  115. package/dist/summarizer.js +3 -3
  116. package/dist/transfer/backup.js +3 -3
  117. package/dist/transfer/capsule-export.js +3 -3
  118. package/dist/transfer/capsule-import.js +2 -2
  119. package/dist/transfer/import-sqlite.js +2 -2
  120. package/dist/verified-recall.js +9 -9
  121. package/package.json +2 -2
  122. package/src/access-identity-continuity-surface.test.ts +374 -0
  123. package/src/access-identity-continuity-surface.ts +322 -0
  124. package/src/access-service.ts +23 -171
  125. package/src/config-record.ts +25 -0
  126. package/src/index.ts +1 -0
  127. package/src/storage/identity-continuity-store.ts +223 -0
  128. package/src/storage.ts +25 -142
  129. package/dist/chunk-7APVFQ34.js.map +0 -1
  130. package/dist/chunk-DWDDQLSZ.js.map +0 -1
  131. /package/dist/{capsule-crypto-FFWJ4X4A.js.map → access-identity-continuity-surface.js.map} +0 -0
  132. /package/dist/{auto-sync-RZO5ZPHR.js.map → auto-sync-2SOUW4JW.js.map} +0 -0
  133. /package/dist/{chunk-WEPWY4HB.js.map → chunk-2BFLDH5F.js.map} +0 -0
  134. /package/dist/{chunk-JTYM4HPA.js.map → chunk-2MR3MFQB.js.map} +0 -0
  135. /package/dist/{chunk-TH7WMHVK.js.map → chunk-3NN73CM7.js.map} +0 -0
  136. /package/dist/{chunk-A6XCHI53.js.map → chunk-3QLPBCFG.js.map} +0 -0
  137. /package/dist/{chunk-EJJQDP3H.js.map → chunk-437S3G37.js.map} +0 -0
  138. /package/dist/{chunk-7XH7VJN4.js.map → chunk-6T4LTI2F.js.map} +0 -0
  139. /package/dist/{chunk-UNV6ZGTS.js.map → chunk-7I2QTC2K.js.map} +0 -0
  140. /package/dist/{chunk-6DA5BBLS.js.map → chunk-7ME6VBF7.js.map} +0 -0
  141. /package/dist/{chunk-AGNBY3VG.js.map → chunk-APJQ6UEA.js.map} +0 -0
  142. /package/dist/{chunk-GG6G2RYR.js.map → chunk-CJDGB3EG.js.map} +0 -0
  143. /package/dist/{chunk-PRX77NPC.js.map → chunk-CQCCVJZO.js.map} +0 -0
  144. /package/dist/{chunk-ZUDM75KG.js.map → chunk-DCWIQFNA.js.map} +0 -0
  145. /package/dist/{chunk-EF3VFQC4.js.map → chunk-EOTTKLPJ.js.map} +0 -0
  146. /package/dist/{chunk-TCKP4EHY.js.map → chunk-FLVL4L3L.js.map} +0 -0
  147. /package/dist/{chunk-NLXKSM46.js.map → chunk-HO3VUUGI.js.map} +0 -0
  148. /package/dist/{chunk-4I45UZ4V.js.map → chunk-IBAU2RZN.js.map} +0 -0
  149. /package/dist/{chunk-OLAVQS6S.js.map → chunk-ILB2MFTS.js.map} +0 -0
  150. /package/dist/{chunk-4AC57RCM.js.map → chunk-IWI2ICTF.js.map} +0 -0
  151. /package/dist/{chunk-5VWRYFQE.js.map → chunk-K2DJQOE3.js.map} +0 -0
  152. /package/dist/{chunk-BTH6MQJT.js.map → chunk-LQDA67TT.js.map} +0 -0
  153. /package/dist/{chunk-PBZQVVLG.js.map → chunk-LX4ZWRGD.js.map} +0 -0
  154. /package/dist/{chunk-3I2IASNK.js.map → chunk-M5QKGHCR.js.map} +0 -0
  155. /package/dist/{chunk-PPAEJXVF.js.map → chunk-NNL4LJAD.js.map} +0 -0
  156. /package/dist/{chunk-TXV3I2O6.js.map → chunk-ODC4HOUZ.js.map} +0 -0
  157. /package/dist/{chunk-7CFGXWYX.js.map → chunk-PJ5AG6D4.js.map} +0 -0
  158. /package/dist/{chunk-EVVLGYHR.js.map → chunk-QEAOKI4U.js.map} +0 -0
  159. /package/dist/{chunk-ZUHD6XZZ.js.map → chunk-QJUZAUAD.js.map} +0 -0
  160. /package/dist/{chunk-REZ4TUD2.js.map → chunk-QKOTOUVR.js.map} +0 -0
  161. /package/dist/{chunk-NG2NHB4C.js.map → chunk-QOGXUNWL.js.map} +0 -0
  162. /package/dist/{chunk-YMGQXBPS.js.map → chunk-RF6BZHOD.js.map} +0 -0
  163. /package/dist/{chunk-6DXXIXED.js.map → chunk-RQNV75HR.js.map} +0 -0
  164. /package/dist/{chunk-GBXP62CL.js.map → chunk-TMXTQCJ7.js.map} +0 -0
  165. /package/dist/{chunk-ZW5SZ3TH.js.map → chunk-TVWF3GNF.js.map} +0 -0
  166. /package/dist/{chunk-5J4OL7TJ.js.map → chunk-VUA4S7P6.js.map} +0 -0
  167. /package/dist/{chunk-PS572XYO.js.map → chunk-XQT5GSWU.js.map} +0 -0
  168. /package/dist/{chunk-H2T4OJNI.js.map → chunk-YQYG24C6.js.map} +0 -0
  169. /package/dist/{chunk-2OZ2JEUP.js.map → chunk-YTU7WKYN.js.map} +0 -0
  170. /package/dist/{chunk-Y4TAFMUE.js.map → chunk-ZFYML7C3.js.map} +0 -0
  171. /package/dist/{chunk-5ZKT7WTR.js.map → chunk-ZLOD23PD.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-GDB4J2H3.js";
9
9
  import {
10
10
  importCapsule
11
- } from "./chunk-3I2IASNK.js";
11
+ } from "./chunk-M5QKGHCR.js";
12
12
  import {
13
13
  getTrustZoneStoreStatus,
14
14
  isTrustZoneName,
@@ -38,9 +38,6 @@ import {
38
38
  import {
39
39
  estimateRecallTokens
40
40
  } from "./chunk-6MMONPHM.js";
41
- import {
42
- namespaceCollectionName
43
- } from "./chunk-PS572XYO.js";
44
41
  import {
45
42
  combineNamespaces,
46
43
  defaultGitInvoker,
@@ -54,6 +51,9 @@ import {
54
51
  resolveWritableNamespaceValue,
55
52
  sanitizeFragment
56
53
  } from "./chunk-W3M34XT4.js";
54
+ import {
55
+ namespaceCollectionName
56
+ } from "./chunk-XQT5GSWU.js";
57
57
  import {
58
58
  namespaceIdentityFromToken
59
59
  } from "./chunk-ZFXCQPNO.js";
@@ -64,30 +64,30 @@ import {
64
64
  listMemoryGovernanceRuns,
65
65
  readMemoryGovernanceRunArtifact,
66
66
  runMemoryGovernance
67
- } from "./chunk-PRX77NPC.js";
67
+ } from "./chunk-CQCCVJZO.js";
68
+ import {
69
+ recordMemoryOutcome
70
+ } from "./chunk-EIR5VLIH.js";
68
71
  import {
69
72
  recordObjectiveStateSnapshotsFromObservedMessages
70
73
  } from "./chunk-ICP53SKG.js";
71
74
  import {
72
75
  objectiveStateStoreOverrideForNamespace
73
76
  } from "./chunk-6HMYUWXR.js";
74
- import {
75
- recordMemoryOutcome
76
- } from "./chunk-EIR5VLIH.js";
77
77
  import {
78
78
  buildGraphSnapshot
79
79
  } from "./chunk-TQT3USCG.js";
80
- import {
81
- persistExplicitCapture,
82
- queueExplicitCaptureForReview,
83
- validateExplicitCaptureInput
84
- } from "./chunk-K5LLP4CY.js";
85
80
  import {
86
81
  wrapWorkLayerContext
87
82
  } from "./chunk-EI6V5UXY.js";
88
83
  import {
89
84
  formatProfileTraceAscii
90
85
  } from "./chunk-PNLCEFE4.js";
86
+ import {
87
+ persistExplicitCapture,
88
+ queueExplicitCaptureForReview,
89
+ validateExplicitCaptureInput
90
+ } from "./chunk-K5LLP4CY.js";
91
91
  import {
92
92
  buildProcedurePersistBody,
93
93
  normalizeProcedureSteps
@@ -95,17 +95,21 @@ import {
95
95
  import {
96
96
  CrossNamespaceBudget
97
97
  } from "./chunk-ODPLEWB6.js";
98
+ import {
99
+ filterTrajectoriesByLookbackDays,
100
+ readCausalTrajectoryRecords
101
+ } from "./chunk-SQNED75R.js";
98
102
  import {
99
103
  FileCalendarSource,
100
104
  buildBriefing,
101
105
  enqueuePassiveCorrectionNotification,
102
106
  parseBriefingFocus,
103
107
  parseBriefingWindow
104
- } from "./chunk-YMGQXBPS.js";
108
+ } from "./chunk-RF6BZHOD.js";
105
109
  import {
106
110
  parseEntityFile,
107
111
  selfDeps
108
- } from "./chunk-7APVFQ34.js";
112
+ } from "./chunk-DUQHQ3TL.js";
109
113
  import {
110
114
  supersessionKeysForFact
111
115
  } from "./chunk-TKZ3AL5V.js";
@@ -133,19 +137,15 @@ import {
133
137
  import {
134
138
  displayErrorDetail
135
139
  } from "./chunk-6KYMPV2O.js";
136
- import {
137
- computeContentHash
138
- } from "./chunk-W5H6ZRPT.js";
139
140
  import {
140
141
  createVersion
141
142
  } from "./chunk-VF4XKTX3.js";
143
+ import {
144
+ computeContentHash
145
+ } from "./chunk-W5H6ZRPT.js";
142
146
  import {
143
147
  defaultCapsulesDir
144
148
  } from "./chunk-ZY2MNJR6.js";
145
- import {
146
- filterTrajectoriesByLookbackDays,
147
- readCausalTrajectoryRecords
148
- } from "./chunk-SQNED75R.js";
149
149
  import {
150
150
  canReadNamespace,
151
151
  canWriteNamespace,
@@ -182,7 +182,7 @@ import {
182
182
  } from "./chunk-NU3CSQ4H.js";
183
183
  import {
184
184
  exportCapsule
185
- } from "./chunk-TCKP4EHY.js";
185
+ } from "./chunk-FLVL4L3L.js";
186
186
  import {
187
187
  evaluateActionConfidence
188
188
  } from "./chunk-Z2YFLXHU.js";
@@ -6682,6 +6682,238 @@ var AccessRecallSurface = class {
6682
6682
  }
6683
6683
  };
6684
6684
 
6685
+ // src/access-identity-continuity-surface.ts
6686
+ var AccessIdentityContinuitySurface = class {
6687
+ constructor(deps) {
6688
+ this.deps = deps;
6689
+ }
6690
+ deps;
6691
+ async continuityAuditGenerate(request) {
6692
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6693
+ return {
6694
+ enabled: false,
6695
+ reason: "Identity continuity is disabled. Enable `identityContinuityEnabled: true`."
6696
+ };
6697
+ }
6698
+ if (!resolveConsolidationCapabilities(this.deps.orchestrator.config).continuityAudit) {
6699
+ return {
6700
+ enabled: false,
6701
+ reason: "Continuity audits are disabled. Enable `continuityAuditEnabled: true`."
6702
+ };
6703
+ }
6704
+ if (!this.deps.orchestrator.compounding) {
6705
+ return {
6706
+ enabled: false,
6707
+ reason: "Compounding engine is disabled. Enable `compoundingEnabled: true`."
6708
+ };
6709
+ }
6710
+ const period = request.period === "monthly" ? "monthly" : "weekly";
6711
+ const key = request.key?.trim() || void 0;
6712
+ const audit = await this.deps.orchestrator.compounding.synthesizeContinuityAudit({ period, key });
6713
+ return { enabled: true, period: audit.period, key: audit.key, reportPath: audit.reportPath };
6714
+ }
6715
+ async continuityIncidentOpen(request) {
6716
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6717
+ return {
6718
+ enabled: false,
6719
+ reason: "Identity continuity is disabled. Enable `identityContinuityEnabled: true`."
6720
+ };
6721
+ }
6722
+ if (!resolveRecallAuxiliaryCapabilities(this.deps.orchestrator.config).continuityIncidentLogging) {
6723
+ return {
6724
+ enabled: false,
6725
+ reason: "Continuity incident logging is disabled. Enable `continuityIncidentLoggingEnabled: true`."
6726
+ };
6727
+ }
6728
+ const symptom = request.symptom?.trim();
6729
+ if (!symptom) throw new EngramAccessInputError("symptom is required");
6730
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, void 0, request.principal);
6731
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6732
+ const created = await storage.appendContinuityIncident({
6733
+ symptom,
6734
+ triggerWindow: request.triggerWindow?.trim() || void 0,
6735
+ suspectedCause: request.suspectedCause?.trim() || void 0
6736
+ });
6737
+ return { created: true, incident: created };
6738
+ }
6739
+ async continuityIncidentClose(request) {
6740
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6741
+ return { enabled: false, reason: "Identity continuity is disabled." };
6742
+ }
6743
+ if (!resolveRecallAuxiliaryCapabilities(this.deps.orchestrator.config).continuityIncidentLogging) {
6744
+ return { enabled: false, reason: "Continuity incident logging is disabled." };
6745
+ }
6746
+ const id = request.id?.trim();
6747
+ if (!id) throw new EngramAccessInputError("id is required");
6748
+ const fixApplied = request.fixApplied?.trim();
6749
+ if (!fixApplied) throw new EngramAccessInputError("fixApplied is required");
6750
+ const verificationResult = request.verificationResult?.trim();
6751
+ if (!verificationResult) throw new EngramAccessInputError("verificationResult is required");
6752
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, void 0, request.principal);
6753
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6754
+ const closed = await storage.closeContinuityIncident(id, {
6755
+ fixApplied,
6756
+ verificationResult,
6757
+ preventiveRule: request.preventiveRule?.trim() || void 0
6758
+ });
6759
+ if (!closed) return { closed: false, reason: `Incident not found: ${id}` };
6760
+ return { closed: true, incident: closed };
6761
+ }
6762
+ async continuityIncidentList(request) {
6763
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6764
+ return { enabled: false, reason: "Identity continuity is disabled." };
6765
+ }
6766
+ const state = request.state === "closed" || request.state === "all" ? request.state : "open";
6767
+ const limit = Math.max(1, Math.min(200, Math.floor(request.limit ?? 25)));
6768
+ const resolvedNs = this.deps.resolveReadableNamespace(request.namespace, request.principal);
6769
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6770
+ const incidents = await storage.readContinuityIncidents(limit, state);
6771
+ return { state, incidents, count: incidents.length };
6772
+ }
6773
+ async continuityLoopAddOrUpdate(request) {
6774
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6775
+ return { enabled: false, reason: "Identity continuity is disabled." };
6776
+ }
6777
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, void 0, request.principal);
6778
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6779
+ const loop = await storage.upsertIdentityImprovementLoop({
6780
+ id: request.id?.trim() || "",
6781
+ cadence: request.cadence,
6782
+ purpose: request.purpose?.trim() || "",
6783
+ status: request.status,
6784
+ killCondition: request.killCondition?.trim() || "",
6785
+ lastReviewed: request.lastReviewed?.trim() || void 0,
6786
+ notes: request.notes?.trim() || void 0
6787
+ });
6788
+ return { saved: true, loop };
6789
+ }
6790
+ async continuityLoopReview(request) {
6791
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6792
+ return { enabled: false, reason: "Identity continuity is disabled." };
6793
+ }
6794
+ const id = request.id?.trim();
6795
+ if (!id) throw new EngramAccessInputError("id is required");
6796
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, void 0, request.principal);
6797
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6798
+ const reviewed = await storage.reviewIdentityImprovementLoop(id, {
6799
+ status: request.status,
6800
+ notes: request.notes?.trim() || void 0,
6801
+ reviewedAt: request.reviewedAt?.trim() || void 0
6802
+ });
6803
+ if (!reviewed) return { reviewed: false, reason: `Continuity loop not found: ${id}` };
6804
+ return { reviewed: true, loop: reviewed };
6805
+ }
6806
+ async identityAnchorGet(request) {
6807
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6808
+ return { enabled: false, reason: "Identity continuity is disabled." };
6809
+ }
6810
+ const resolvedNs = this.deps.resolveReadableNamespace(request.namespace, request.principal);
6811
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6812
+ const anchor = await storage.readIdentityAnchor();
6813
+ if (!anchor) {
6814
+ return {
6815
+ found: false,
6816
+ message: "No identity anchor found yet. Use identity_anchor_update to create one."
6817
+ };
6818
+ }
6819
+ return { found: true, anchor };
6820
+ }
6821
+ async identityAnchorUpdate(request) {
6822
+ if (!resolveIdentityContinuityCapabilities(this.deps.orchestrator.config).identityContinuity) {
6823
+ return { enabled: false, reason: "Identity continuity is disabled." };
6824
+ }
6825
+ const updates = {
6826
+ "Identity Traits": request.identityTraits?.trim() || void 0,
6827
+ "Communication Preferences": request.communicationPreferences?.trim() || void 0,
6828
+ "Operating Principles": request.operatingPrinciples?.trim() || void 0,
6829
+ "Continuity Notes": request.continuityNotes?.trim() || void 0
6830
+ };
6831
+ const hasUpdate = Object.values(updates).some((value) => typeof value === "string" && value.length > 0);
6832
+ if (!hasUpdate) {
6833
+ throw new EngramAccessInputError("At least one section field is required.");
6834
+ }
6835
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, void 0, request.principal);
6836
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6837
+ const existing = await storage.readIdentityAnchor();
6838
+ const merged = this.mergeIdentityAnchorSections(existing, updates);
6839
+ await storage.writeIdentityAnchor(merged);
6840
+ const updatedSections = Object.entries(updates).filter(([, value]) => typeof value === "string" && value.length > 0).map(([name]) => name);
6841
+ return { updated: true, sections: updatedSections, anchor: merged };
6842
+ }
6843
+ async memoryIdentity(request) {
6844
+ const resolvedNs = this.deps.resolveReadableNamespace(request.namespace, request.principal);
6845
+ const storage = await this.deps.orchestrator.getStorage(resolvedNs);
6846
+ const identity = await storage.readIdentityReflections();
6847
+ if (!identity) return { found: false, message: "No identity reflections found." };
6848
+ return { found: true, identity };
6849
+ }
6850
+ /** Conservative identity anchor section merge (matches tools.ts mergeIdentityAnchor logic). */
6851
+ mergeIdentityAnchorSections(existingRaw, updates) {
6852
+ const title = "# Identity Continuity Anchor";
6853
+ const sectionOrder = ["Identity Traits", "Communication Preferences", "Operating Principles", "Continuity Notes"];
6854
+ const lines = (existingRaw ?? "").replace(/\r/g, "").split("\n");
6855
+ const headerLines = [];
6856
+ const sectionContent = /* @__PURE__ */ new Map();
6857
+ const order = [];
6858
+ let current = null;
6859
+ for (const line of lines) {
6860
+ const match = line.match(/^##\s+(.+?)\s*$/);
6861
+ if (match) {
6862
+ current = match[1].trim();
6863
+ if (!sectionContent.has(current)) {
6864
+ sectionContent.set(current, []);
6865
+ order.push(current);
6866
+ }
6867
+ continue;
6868
+ }
6869
+ if (!current) {
6870
+ headerLines.push(line);
6871
+ } else {
6872
+ sectionContent.get(current)?.push(line);
6873
+ }
6874
+ }
6875
+ const sections = /* @__PURE__ */ new Map();
6876
+ for (const [name, contentLines] of sectionContent) {
6877
+ sections.set(name, contentLines.join("\n").trim());
6878
+ }
6879
+ const header = headerLines.join("\n").trim() || title;
6880
+ for (const sectionName of sectionOrder) {
6881
+ const previous = sections.get(sectionName)?.trim();
6882
+ const next = updates[sectionName]?.trim();
6883
+ const existing = previous === "- (empty)" ? "" : previous;
6884
+ if (!next) {
6885
+ if (!sections.has(sectionName)) sections.set(sectionName, "");
6886
+ continue;
6887
+ }
6888
+ if (!existing) {
6889
+ sections.set(sectionName, next);
6890
+ continue;
6891
+ }
6892
+ if (existing.includes(next)) continue;
6893
+ if (next.includes(existing)) {
6894
+ sections.set(sectionName, next);
6895
+ continue;
6896
+ }
6897
+ sections.set(sectionName, `${existing}
6898
+
6899
+ ${next}`);
6900
+ }
6901
+ const finalOrder = [
6902
+ ...sectionOrder.filter((section) => sections.has(section)),
6903
+ ...order.filter((section) => !sectionOrder.includes(section) && sections.has(section))
6904
+ ];
6905
+ const output = [header, ""];
6906
+ for (const name of finalOrder) {
6907
+ output.push(`## ${name}`, "");
6908
+ const body = sections.get(name)?.trim();
6909
+ if (body) output.push(body, "");
6910
+ else output.push("");
6911
+ }
6912
+ return `${output.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd()}
6913
+ `;
6914
+ }
6915
+ };
6916
+
6685
6917
  // src/access-service.ts
6686
6918
  var EngramAccessInputError = class extends Error {
6687
6919
  };
@@ -6905,6 +7137,16 @@ var EngramAccessService = class {
6905
7137
  }
6906
7138
  return this._accessRecallSurface;
6907
7139
  }
7140
+ /** AccessIdentityContinuitySurface (access-service decomposition). Lazy; selfDeps live wiring. */
7141
+ _accessIdentityContinuitySurface;
7142
+ get accessIdentityContinuitySurface() {
7143
+ if (!this._accessIdentityContinuitySurface) {
7144
+ this._accessIdentityContinuitySurface = new AccessIdentityContinuitySurface(
7145
+ selfDeps(this)
7146
+ );
7147
+ }
7148
+ return this._accessIdentityContinuitySurface;
7149
+ }
6908
7150
  get briefingEnabled() {
6909
7151
  return this.orchestrator.config.briefing?.enabled === true;
6910
7152
  }
@@ -9037,114 +9279,25 @@ var EngramAccessService = class {
9037
9279
  // ── Parity tools (match OpenClaw plugin feature set) ──────────────────
9038
9280
  // ── Continuity / Identity ──────────────────────────────────────────────
9039
9281
  async continuityAuditGenerate(request) {
9040
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9041
- return { enabled: false, reason: "Identity continuity is disabled. Enable `identityContinuityEnabled: true`." };
9042
- }
9043
- if (!resolveConsolidationCapabilities(this.orchestrator.config).continuityAudit) {
9044
- return { enabled: false, reason: "Continuity audits are disabled. Enable `continuityAuditEnabled: true`." };
9045
- }
9046
- if (!this.orchestrator.compounding) {
9047
- return { enabled: false, reason: "Compounding engine is disabled. Enable `compoundingEnabled: true`." };
9048
- }
9049
- const period = request.period === "monthly" ? "monthly" : "weekly";
9050
- const key = request.key?.trim() || void 0;
9051
- const audit = await this.orchestrator.compounding.synthesizeContinuityAudit({ period, key });
9052
- return { enabled: true, period: audit.period, key: audit.key, reportPath: audit.reportPath };
9282
+ return this.accessIdentityContinuitySurface.continuityAuditGenerate(request);
9053
9283
  }
9054
9284
  async continuityIncidentOpen(request) {
9055
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9056
- return { enabled: false, reason: "Identity continuity is disabled. Enable `identityContinuityEnabled: true`." };
9057
- }
9058
- if (!resolveRecallAuxiliaryCapabilities(this.orchestrator.config).continuityIncidentLogging) {
9059
- return { enabled: false, reason: "Continuity incident logging is disabled. Enable `continuityIncidentLoggingEnabled: true`." };
9060
- }
9061
- const symptom = request.symptom?.trim();
9062
- if (!symptom) throw new EngramAccessInputError("symptom is required");
9063
- const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
9064
- const storage = await this.orchestrator.getStorage(resolvedNs);
9065
- const created = await storage.appendContinuityIncident({
9066
- symptom,
9067
- triggerWindow: request.triggerWindow?.trim() || void 0,
9068
- suspectedCause: request.suspectedCause?.trim() || void 0
9069
- });
9070
- return { created: true, incident: created };
9285
+ return this.accessIdentityContinuitySurface.continuityIncidentOpen(request);
9071
9286
  }
9072
9287
  async continuityIncidentClose(request) {
9073
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9074
- return { enabled: false, reason: "Identity continuity is disabled." };
9075
- }
9076
- if (!resolveRecallAuxiliaryCapabilities(this.orchestrator.config).continuityIncidentLogging) {
9077
- return { enabled: false, reason: "Continuity incident logging is disabled." };
9078
- }
9079
- const id = request.id?.trim();
9080
- if (!id) throw new EngramAccessInputError("id is required");
9081
- const fixApplied = request.fixApplied?.trim();
9082
- if (!fixApplied) throw new EngramAccessInputError("fixApplied is required");
9083
- const verificationResult = request.verificationResult?.trim();
9084
- if (!verificationResult) throw new EngramAccessInputError("verificationResult is required");
9085
- const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
9086
- const storage = await this.orchestrator.getStorage(resolvedNs);
9087
- const closed = await storage.closeContinuityIncident(id, {
9088
- fixApplied,
9089
- verificationResult,
9090
- preventiveRule: request.preventiveRule?.trim() || void 0
9091
- });
9092
- if (!closed) return { closed: false, reason: `Incident not found: ${id}` };
9093
- return { closed: true, incident: closed };
9288
+ return this.accessIdentityContinuitySurface.continuityIncidentClose(request);
9094
9289
  }
9095
9290
  async continuityIncidentList(request) {
9096
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9097
- return { enabled: false, reason: "Identity continuity is disabled." };
9098
- }
9099
- const state = request.state === "closed" || request.state === "all" ? request.state : "open";
9100
- const limit = Math.max(1, Math.min(200, Math.floor(request.limit ?? 25)));
9101
- const resolvedNs = this.resolveReadableNamespace(request.namespace, request.principal);
9102
- const storage = await this.orchestrator.getStorage(resolvedNs);
9103
- const incidents = await storage.readContinuityIncidents(limit, state);
9104
- return { state, incidents, count: incidents.length };
9291
+ return this.accessIdentityContinuitySurface.continuityIncidentList(request);
9105
9292
  }
9106
9293
  async continuityLoopAddOrUpdate(request) {
9107
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9108
- return { enabled: false, reason: "Identity continuity is disabled." };
9109
- }
9110
- const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
9111
- const storage = await this.orchestrator.getStorage(resolvedNs);
9112
- const loop = await storage.upsertIdentityImprovementLoop({
9113
- id: request.id?.trim() || "",
9114
- cadence: request.cadence,
9115
- purpose: request.purpose?.trim() || "",
9116
- status: request.status,
9117
- killCondition: request.killCondition?.trim() || "",
9118
- lastReviewed: request.lastReviewed?.trim() || void 0,
9119
- notes: request.notes?.trim() || void 0
9120
- });
9121
- return { saved: true, loop };
9294
+ return this.accessIdentityContinuitySurface.continuityLoopAddOrUpdate(request);
9122
9295
  }
9123
9296
  async continuityLoopReview(request) {
9124
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9125
- return { enabled: false, reason: "Identity continuity is disabled." };
9126
- }
9127
- const id = request.id?.trim();
9128
- if (!id) throw new EngramAccessInputError("id is required");
9129
- const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
9130
- const storage = await this.orchestrator.getStorage(resolvedNs);
9131
- const reviewed = await storage.reviewIdentityImprovementLoop(id, {
9132
- status: request.status,
9133
- notes: request.notes?.trim() || void 0,
9134
- reviewedAt: request.reviewedAt?.trim() || void 0
9135
- });
9136
- if (!reviewed) return { reviewed: false, reason: `Continuity loop not found: ${id}` };
9137
- return { reviewed: true, loop: reviewed };
9297
+ return this.accessIdentityContinuitySurface.continuityLoopReview(request);
9138
9298
  }
9139
9299
  async identityAnchorGet(request) {
9140
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9141
- return { enabled: false, reason: "Identity continuity is disabled." };
9142
- }
9143
- const resolvedNs = this.resolveReadableNamespace(request.namespace, request.principal);
9144
- const storage = await this.orchestrator.getStorage(resolvedNs);
9145
- const anchor = await storage.readIdentityAnchor();
9146
- if (!anchor) return { found: false, message: "No identity anchor found yet. Use identity_anchor_update to create one." };
9147
- return { found: true, anchor };
9300
+ return this.accessIdentityContinuitySurface.identityAnchorGet(request);
9148
9301
  }
9149
9302
  /**
9150
9303
  * @deprecated since issue #679 PR 5/5 — the identity-anchor model is
@@ -9155,31 +9308,10 @@ var EngramAccessService = class {
9155
9308
  * compatibility but will be removed in a future major version.
9156
9309
  */
9157
9310
  async identityAnchorUpdate(request) {
9158
- if (!resolveIdentityContinuityCapabilities(this.orchestrator.config).identityContinuity) {
9159
- return { enabled: false, reason: "Identity continuity is disabled." };
9160
- }
9161
- const updates = {
9162
- "Identity Traits": request.identityTraits?.trim() || void 0,
9163
- "Communication Preferences": request.communicationPreferences?.trim() || void 0,
9164
- "Operating Principles": request.operatingPrinciples?.trim() || void 0,
9165
- "Continuity Notes": request.continuityNotes?.trim() || void 0
9166
- };
9167
- const hasUpdate = Object.values(updates).some((v) => typeof v === "string" && v.length > 0);
9168
- if (!hasUpdate) throw new EngramAccessInputError("At least one section field is required.");
9169
- const resolvedNs = this.writableNamespaceFor(request.namespace, void 0, request.principal);
9170
- const storage = await this.orchestrator.getStorage(resolvedNs);
9171
- const existing = await storage.readIdentityAnchor();
9172
- const merged = this.mergeIdentityAnchorSections(existing, updates);
9173
- await storage.writeIdentityAnchor(merged);
9174
- const updatedSections = Object.entries(updates).filter(([, v]) => typeof v === "string" && v.length > 0).map(([name]) => name);
9175
- return { updated: true, sections: updatedSections, anchor: merged };
9311
+ return this.accessIdentityContinuitySurface.identityAnchorUpdate(request);
9176
9312
  }
9177
9313
  async memoryIdentity(request) {
9178
- const resolvedNs = this.resolveReadableNamespace(request.namespace, request.principal);
9179
- const storage = await this.orchestrator.getStorage(resolvedNs);
9180
- const identity = await storage.readIdentityReflections();
9181
- if (!identity) return { found: false, message: "No identity reflections found." };
9182
- return { found: true, identity };
9314
+ return this.accessIdentityContinuitySurface.memoryIdentity(request);
9183
9315
  }
9184
9316
  // ── Work Layer ──────────────────────────────────────────────────────────
9185
9317
  async workTask(request) {
@@ -9309,65 +9441,6 @@ var EngramAccessService = class {
9309
9441
  expectedGuidelineVersion: request.expectedGuidelineVersion
9310
9442
  });
9311
9443
  }
9312
- /** Conservative identity anchor section merge (matches tools.ts mergeIdentityAnchor logic). */
9313
- mergeIdentityAnchorSections(existingRaw, updates) {
9314
- const TITLE = "# Identity Continuity Anchor";
9315
- const SECTION_ORDER = ["Identity Traits", "Communication Preferences", "Operating Principles", "Continuity Notes"];
9316
- const lines = (existingRaw ?? "").replace(/\r/g, "").split("\n");
9317
- const headerLines = [];
9318
- const sectionContent = /* @__PURE__ */ new Map();
9319
- const order = [];
9320
- let current = null;
9321
- for (const line of lines) {
9322
- const m = line.match(/^##\s+(.+?)\s*$/);
9323
- if (m) {
9324
- current = m[1].trim();
9325
- if (!sectionContent.has(current)) {
9326
- sectionContent.set(current, []);
9327
- order.push(current);
9328
- }
9329
- continue;
9330
- }
9331
- if (!current) {
9332
- headerLines.push(line);
9333
- } else {
9334
- sectionContent.get(current)?.push(line);
9335
- }
9336
- }
9337
- const sections = /* @__PURE__ */ new Map();
9338
- for (const [name, cLines] of sectionContent) sections.set(name, cLines.join("\n").trim());
9339
- const header = headerLines.join("\n").trim() || TITLE;
9340
- for (const sectionName of SECTION_ORDER) {
9341
- const prev = sections.get(sectionName)?.trim();
9342
- const next = updates[sectionName]?.trim();
9343
- const existing = prev === "- (empty)" ? "" : prev;
9344
- if (!next) {
9345
- if (!sections.has(sectionName)) sections.set(sectionName, "");
9346
- continue;
9347
- }
9348
- if (!existing) {
9349
- sections.set(sectionName, next);
9350
- continue;
9351
- }
9352
- if (existing.includes(next)) continue;
9353
- if (next.includes(existing)) {
9354
- sections.set(sectionName, next);
9355
- continue;
9356
- }
9357
- sections.set(sectionName, `${existing}
9358
-
9359
- ${next}`);
9360
- }
9361
- const finalOrder = [...SECTION_ORDER.filter((s) => sections.has(s)), ...order.filter((s) => !SECTION_ORDER.includes(s) && sections.has(s))];
9362
- const out = [header, ""];
9363
- for (const name of finalOrder) {
9364
- out.push(`## ${name}`, "");
9365
- const body = sections.get(name)?.trim();
9366
- if (body) out.push(body, "");
9367
- else out.push("");
9368
- }
9369
- return out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
9370
- }
9371
9444
  // ── Memory search & debug ─────────────────────────────────────────────
9372
9445
  async memorySearch(request) {
9373
9446
  const { query, namespace, maxResults, principal } = request;
@@ -10836,6 +10909,7 @@ export {
10836
10909
  qmdCollectionPathParts,
10837
10910
  QmdResultResolver,
10838
10911
  AccessRecallSurface,
10912
+ AccessIdentityContinuitySurface,
10839
10913
  EngramAccessInputError,
10840
10914
  ENGRAM_ACCESS_WRITE_SCHEMA_VERSION,
10841
10915
  buildProjectedGovernanceProposedActions,
@@ -10844,4 +10918,4 @@ export {
10844
10918
  EngramAccessService,
10845
10919
  AccessAdminOpsSurface
10846
10920
  };
10847
- //# sourceMappingURL=chunk-DWDDQLSZ.js.map
10921
+ //# sourceMappingURL=chunk-6C6BBBCI.js.map