@remnic/core 9.3.708 → 9.3.710

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 (266) hide show
  1. package/dist/access-boundary.d.ts +7 -7
  2. package/dist/access-boundary.js +8 -8
  3. package/dist/access-cli.js +111 -24
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +6 -6
  6. package/dist/access-http.js +12 -12
  7. package/dist/access-mcp.d.ts +14 -6
  8. package/dist/access-mcp.js +11 -11
  9. package/dist/access-operations-batch.js +9 -9
  10. package/dist/access-operations.d.ts +28 -8
  11. package/dist/access-operations.js +14 -10
  12. package/dist/access-schema.d.ts +6 -6
  13. package/dist/{access-service-j1c1gptF.d.ts → access-service-CoIA0NrG.d.ts} +186 -3
  14. package/dist/access-service.d.ts +6 -6
  15. package/dist/access-service.js +7 -7
  16. package/dist/access-surface-catalog.d.ts +6 -6
  17. package/dist/access-surface-catalog.js +7 -0
  18. package/dist/access-surface-catalog.js.map +1 -1
  19. package/dist/action-confidence.d.ts +1 -1
  20. package/dist/active-memory-bridge.d.ts +1 -1
  21. package/dist/active-recall.d.ts +1 -1
  22. package/dist/active-recall.js +1 -1
  23. package/dist/behavior-learner.d.ts +1 -1
  24. package/dist/behavior-signals.d.ts +1 -1
  25. package/dist/bootstrap.d.ts +4 -4
  26. package/dist/briefing.d.ts +1 -1
  27. package/dist/briefing.js +3 -3
  28. package/dist/buffer-surprise-report.d.ts +1 -1
  29. package/dist/buffer.d.ts +1 -1
  30. package/dist/calibration.d.ts +1 -1
  31. package/dist/capabilities.d.ts +1 -1
  32. package/dist/{catalog-CKxilpzS.d.ts → catalog-DQCZrBjw.d.ts} +1 -1
  33. package/dist/causal-behavior.d.ts +1 -1
  34. package/dist/causal-consolidation.d.ts +1 -1
  35. package/dist/causal-consolidation.js +4 -4
  36. package/dist/{chunk-PDJQVAGM.js → chunk-2T4TDXPC.js} +14 -14
  37. package/dist/{chunk-W2WQ4LE7.js → chunk-35YJ6KCV.js} +2 -2
  38. package/dist/{chunk-C63MK3WL.js → chunk-3TCRU4JA.js} +2 -2
  39. package/dist/{chunk-WRGPE6AW.js → chunk-3XHD3XGK.js} +44 -1
  40. package/dist/chunk-3XHD3XGK.js.map +1 -0
  41. package/dist/{chunk-GKI6LX5L.js → chunk-54TI5GLV.js} +2 -2
  42. package/dist/{chunk-IVCQW4C4.js → chunk-7IBEWQLG.js} +2 -2
  43. package/dist/{chunk-Y6YHAGQP.js → chunk-7NDYFAJS.js} +2 -2
  44. package/dist/{chunk-SPETAWFE.js → chunk-AZVHBFI3.js} +2 -2
  45. package/dist/{chunk-MLLTU5FX.js → chunk-BOGENF7P.js} +1 -1
  46. package/dist/chunk-BOGENF7P.js.map +1 -0
  47. package/dist/{chunk-3PTOZJOI.js → chunk-BQCFXAMN.js} +2 -2
  48. package/dist/{chunk-4E2QCH46.js → chunk-CNVIWMQI.js} +2 -2
  49. package/dist/{chunk-4DZATVK5.js → chunk-CXMXAC5R.js} +3 -3
  50. package/dist/{chunk-STYMKPFT.js → chunk-EVX52NCY.js} +1459 -21
  51. package/dist/chunk-EVX52NCY.js.map +1 -0
  52. package/dist/{chunk-W2S3Z5MT.js → chunk-GMRNKPWO.js} +2 -2
  53. package/dist/{chunk-HIV5E57C.js → chunk-HSDJCT3V.js} +2 -2
  54. package/dist/{chunk-NM6TSEGQ.js → chunk-JNOYYWCA.js} +2 -2
  55. package/dist/{chunk-IONFO7UK.js → chunk-JQ7XVM4V.js} +3 -3
  56. package/dist/{chunk-2VQYHHWB.js → chunk-JSDZMOT7.js} +11 -2
  57. package/dist/chunk-JSDZMOT7.js.map +1 -0
  58. package/dist/{chunk-WSWYIKXX.js → chunk-KOEKDZ6A.js} +62 -5
  59. package/dist/chunk-KOEKDZ6A.js.map +1 -0
  60. package/dist/{chunk-WQADZ3ZY.js → chunk-NK3SPJLM.js} +20 -19
  61. package/dist/chunk-NK3SPJLM.js.map +1 -0
  62. package/dist/{chunk-WDH3KUZU.js → chunk-NXL5CVE7.js} +2 -2
  63. package/dist/{chunk-BGAHTI4C.js → chunk-OK7FUX6R.js} +6 -6
  64. package/dist/{chunk-24FGNOQS.js → chunk-P6PRSI3W.js} +85 -4
  65. package/dist/chunk-P6PRSI3W.js.map +1 -0
  66. package/dist/{chunk-66TSLESZ.js → chunk-PKE7EJMX.js} +2 -2
  67. package/dist/chunk-PKE7EJMX.js.map +1 -0
  68. package/dist/{chunk-MOXFPLD6.js → chunk-QXNFQKWU.js} +2 -2
  69. package/dist/{chunk-MRX6ZXHZ.js → chunk-S6FQLQGH.js} +2 -2
  70. package/dist/{chunk-6HPJMR5I.js → chunk-SKQCFAYU.js} +2 -2
  71. package/dist/{chunk-EJDAXR7O.js → chunk-VWB3HDY6.js} +56 -8
  72. package/dist/chunk-VWB3HDY6.js.map +1 -0
  73. package/dist/{chunk-N75N5SNX.js → chunk-XD33EX2F.js} +3 -3
  74. package/dist/{chunk-ESMY4RJ4.js → chunk-XKU4YE6Z.js} +2 -2
  75. package/dist/{chunk-XKMDDM7P.js → chunk-Y6PIFKXX.js} +2 -2
  76. package/dist/{chunk-RH2OSRQY.js → chunk-Z56IHRVV.js} +2 -2
  77. package/dist/{cli-CbT-pyM4.d.ts → cli-qex-L3GT.d.ts} +3 -3
  78. package/dist/cli.d.ts +6 -6
  79. package/dist/cli.js +26 -26
  80. package/dist/compounding/engine.d.ts +1 -1
  81. package/dist/compounding/engine.js +3 -3
  82. package/dist/compounding/preference-consolidator.d.ts +1 -1
  83. package/dist/compression-optimizer.d.ts +1 -1
  84. package/dist/config.d.ts +1 -1
  85. package/dist/config.js +1 -1
  86. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  87. package/dist/connectors/codex-materialize-runner.js +3 -3
  88. package/dist/connectors/codex-materialize.d.ts +1 -1
  89. package/dist/connectors/index.d.ts +1 -1
  90. package/dist/connectors/index.js +3 -3
  91. package/dist/consolidation-provenance-check.d.ts +1 -1
  92. package/dist/consolidation-undo.d.ts +1 -1
  93. package/dist/contradiction/index.d.ts +1 -1
  94. package/dist/conversation-index/backend.d.ts +1 -1
  95. package/dist/conversation-index/chunker.d.ts +1 -1
  96. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  97. package/dist/conversation-index/indexer.d.ts +1 -1
  98. package/dist/conversation-index/search.d.ts +1 -1
  99. package/dist/day-summary.d.ts +1 -1
  100. package/dist/delinearize.d.ts +1 -1
  101. package/dist/direct-answer-wiring.d.ts +1 -1
  102. package/dist/direct-answer.d.ts +1 -1
  103. package/dist/embedding-fallback.d.ts +1 -1
  104. package/dist/enrichment/index.d.ts +1 -1
  105. package/dist/entity-retrieval.d.ts +1 -1
  106. package/dist/entity-retrieval.js +3 -3
  107. package/dist/entity-schema.d.ts +1 -1
  108. package/dist/explicit-capture.d.ts +4 -4
  109. package/dist/extraction-faithfulness.d.ts +1 -1
  110. package/dist/extraction-judge-telemetry.d.ts +1 -1
  111. package/dist/extraction-judge-training.d.ts +1 -1
  112. package/dist/extraction-judge.d.ts +1 -1
  113. package/dist/extraction.d.ts +1 -1
  114. package/dist/fallback-llm.d.ts +1 -1
  115. package/dist/identity-continuity.d.ts +1 -1
  116. package/dist/importance.d.ts +1 -1
  117. package/dist/index.d.ts +9 -9
  118. package/dist/index.js +32 -32
  119. package/dist/intent.d.ts +1 -1
  120. package/dist/lcm/engine.d.ts +1 -1
  121. package/dist/lcm/index.d.ts +1 -1
  122. package/dist/lcm/tools.d.ts +1 -1
  123. package/dist/lifecycle.d.ts +1 -1
  124. package/dist/live-connectors-runner.d.ts +1 -1
  125. package/dist/local-llm.d.ts +1 -1
  126. package/dist/maintenance/memory-governance.d.ts +1 -1
  127. package/dist/maintenance/memory-governance.js +3 -3
  128. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  129. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  130. package/dist/mcp-memory-inspector-app.d.ts +6 -6
  131. package/dist/memory-action-policy.d.ts +1 -1
  132. package/dist/memory-cache.d.ts +1 -1
  133. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  134. package/dist/memory-projection-store.d.ts +1 -1
  135. package/dist/memory-provenance.d.ts +1 -1
  136. package/dist/memory-worth-outcomes.d.ts +1 -1
  137. package/dist/models-json.d.ts +1 -1
  138. package/dist/namespaces/migrate.d.ts +2 -2
  139. package/dist/namespaces/migrate.js +4 -4
  140. package/dist/namespaces/principal.d.ts +1 -1
  141. package/dist/namespaces/search.d.ts +1 -1
  142. package/dist/namespaces/storage.d.ts +2 -2
  143. package/dist/namespaces/storage.js +3 -3
  144. package/dist/native-knowledge.d.ts +1 -1
  145. package/dist/operator-toolkit.d.ts +1 -1
  146. package/dist/operator-toolkit.js +9 -9
  147. package/dist/orchestration/maintenance.d.ts +2 -2
  148. package/dist/orchestration/maintenance.js +5 -5
  149. package/dist/{orchestrator-D4ovYV3x.d.ts → orchestrator-DsVKLEBk.d.ts} +3 -3
  150. package/dist/orchestrator.d.ts +4 -4
  151. package/dist/orchestrator.js +15 -15
  152. package/dist/patterns-cli.d.ts +1 -1
  153. package/dist/policy-runtime.d.ts +1 -1
  154. package/dist/provenance.d.ts +1 -1
  155. package/dist/qmd-recall-cache.d.ts +1 -1
  156. package/dist/qmd.d.ts +1 -1
  157. package/dist/recall-disclosure-escalation.d.ts +1 -1
  158. package/dist/recall-explain-renderer.d.ts +1 -1
  159. package/dist/recall-explain-renderer.js +3 -3
  160. package/dist/recall-planner-llm.d.ts +1 -1
  161. package/dist/recall-state.d.ts +1 -1
  162. package/dist/recall-tag-filter.d.ts +1 -1
  163. package/dist/recall-xray-cli.d.ts +1 -1
  164. package/dist/recall-xray-cli.js +4 -4
  165. package/dist/recall-xray-renderer.d.ts +1 -1
  166. package/dist/recall-xray-renderer.js +3 -3
  167. package/dist/recall-xray.d.ts +1 -1
  168. package/dist/recall-xray.js +2 -2
  169. package/dist/resolve-auth-token.d.ts +1 -1
  170. package/dist/resume-bundles.js +2 -2
  171. package/dist/retrieval-agents.d.ts +1 -1
  172. package/dist/retrieval-tiers.d.ts +1 -1
  173. package/dist/routing/engine.d.ts +1 -1
  174. package/dist/routing/store.d.ts +1 -1
  175. package/dist/schemas.d.ts +2 -2
  176. package/dist/search/embed-helper.d.ts +1 -1
  177. package/dist/search/factory.d.ts +1 -1
  178. package/dist/search/index.d.ts +1 -1
  179. package/dist/search/lancedb-backend.d.ts +1 -1
  180. package/dist/search/meilisearch-backend.d.ts +1 -1
  181. package/dist/search/noop-backend.d.ts +1 -1
  182. package/dist/search/orama-backend.d.ts +1 -1
  183. package/dist/search/port.d.ts +1 -1
  184. package/dist/search/remote-backend.d.ts +1 -1
  185. package/dist/{semantic-consolidation-DyMUCsfN.d.ts → semantic-consolidation-_hVxkTuF.d.ts} +1 -1
  186. package/dist/semantic-consolidation.d.ts +2 -2
  187. package/dist/semantic-consolidation.js +4 -4
  188. package/dist/semantic-rule-promotion.js +3 -3
  189. package/dist/semantic-rule-verifier.d.ts +1 -1
  190. package/dist/semantic-rule-verifier.js +3 -3
  191. package/dist/session-observer-bands.d.ts +1 -1
  192. package/dist/session-observer-state.d.ts +1 -1
  193. package/dist/shared-context/manager.d.ts +1 -1
  194. package/dist/signal.d.ts +1 -1
  195. package/dist/storage.d.ts +8 -1
  196. package/dist/storage.js +2 -2
  197. package/dist/summarizer.d.ts +1 -1
  198. package/dist/summary-snapshot.d.ts +1 -1
  199. package/dist/temporal-supersession.d.ts +1 -1
  200. package/dist/temporal-validity.d.ts +1 -1
  201. package/dist/threading.d.ts +1 -1
  202. package/dist/tier-migration.d.ts +1 -1
  203. package/dist/tier-routing.d.ts +1 -1
  204. package/dist/topics.d.ts +1 -1
  205. package/dist/transcript.d.ts +1 -1
  206. package/dist/transfer/types.d.ts +12 -12
  207. package/dist/{types-Couvz-L3.d.ts → types-DUK4vVnN.d.ts} +27 -0
  208. package/dist/types.d.ts +1 -1
  209. package/dist/types.js +1 -1
  210. package/dist/utility-runtime.d.ts +1 -1
  211. package/dist/verified-recall.js +3 -3
  212. package/package.json +2 -2
  213. package/src/access-boundary.ts +2 -0
  214. package/src/access-cli.ts +107 -2
  215. package/src/access-http.ts +70 -1
  216. package/src/access-mcp.ts +65 -0
  217. package/src/access-operations.ts +122 -0
  218. package/src/access-service.ts +92 -0
  219. package/src/access-surface-catalog.test.ts +6 -1
  220. package/src/access-surface-catalog.ts +7 -0
  221. package/src/cli.ts +1 -0
  222. package/src/config.test.ts +10 -0
  223. package/src/config.ts +43 -0
  224. package/src/correction/correction-access-wiring.ts +887 -0
  225. package/src/correction/correction-contract.ts +416 -0
  226. package/src/correction/correction-executor.test.ts +742 -0
  227. package/src/correction/correction-executor.ts +473 -0
  228. package/src/correction/correction-planner.test.ts +446 -0
  229. package/src/correction/correction-planner.ts +546 -0
  230. package/src/correction/correction-service.ts +180 -0
  231. package/src/correction/correction-surfaces.test.ts +245 -0
  232. package/src/correction/index.ts +43 -0
  233. package/src/storage.ts +10 -0
  234. package/src/types.ts +27 -0
  235. package/dist/chunk-24FGNOQS.js.map +0 -1
  236. package/dist/chunk-2VQYHHWB.js.map +0 -1
  237. package/dist/chunk-66TSLESZ.js.map +0 -1
  238. package/dist/chunk-EJDAXR7O.js.map +0 -1
  239. package/dist/chunk-MLLTU5FX.js.map +0 -1
  240. package/dist/chunk-STYMKPFT.js.map +0 -1
  241. package/dist/chunk-WQADZ3ZY.js.map +0 -1
  242. package/dist/chunk-WRGPE6AW.js.map +0 -1
  243. package/dist/chunk-WSWYIKXX.js.map +0 -1
  244. /package/dist/{chunk-PDJQVAGM.js.map → chunk-2T4TDXPC.js.map} +0 -0
  245. /package/dist/{chunk-W2WQ4LE7.js.map → chunk-35YJ6KCV.js.map} +0 -0
  246. /package/dist/{chunk-C63MK3WL.js.map → chunk-3TCRU4JA.js.map} +0 -0
  247. /package/dist/{chunk-GKI6LX5L.js.map → chunk-54TI5GLV.js.map} +0 -0
  248. /package/dist/{chunk-IVCQW4C4.js.map → chunk-7IBEWQLG.js.map} +0 -0
  249. /package/dist/{chunk-Y6YHAGQP.js.map → chunk-7NDYFAJS.js.map} +0 -0
  250. /package/dist/{chunk-SPETAWFE.js.map → chunk-AZVHBFI3.js.map} +0 -0
  251. /package/dist/{chunk-3PTOZJOI.js.map → chunk-BQCFXAMN.js.map} +0 -0
  252. /package/dist/{chunk-4E2QCH46.js.map → chunk-CNVIWMQI.js.map} +0 -0
  253. /package/dist/{chunk-4DZATVK5.js.map → chunk-CXMXAC5R.js.map} +0 -0
  254. /package/dist/{chunk-W2S3Z5MT.js.map → chunk-GMRNKPWO.js.map} +0 -0
  255. /package/dist/{chunk-HIV5E57C.js.map → chunk-HSDJCT3V.js.map} +0 -0
  256. /package/dist/{chunk-NM6TSEGQ.js.map → chunk-JNOYYWCA.js.map} +0 -0
  257. /package/dist/{chunk-IONFO7UK.js.map → chunk-JQ7XVM4V.js.map} +0 -0
  258. /package/dist/{chunk-WDH3KUZU.js.map → chunk-NXL5CVE7.js.map} +0 -0
  259. /package/dist/{chunk-BGAHTI4C.js.map → chunk-OK7FUX6R.js.map} +0 -0
  260. /package/dist/{chunk-MOXFPLD6.js.map → chunk-QXNFQKWU.js.map} +0 -0
  261. /package/dist/{chunk-MRX6ZXHZ.js.map → chunk-S6FQLQGH.js.map} +0 -0
  262. /package/dist/{chunk-6HPJMR5I.js.map → chunk-SKQCFAYU.js.map} +0 -0
  263. /package/dist/{chunk-N75N5SNX.js.map → chunk-XD33EX2F.js.map} +0 -0
  264. /package/dist/{chunk-ESMY4RJ4.js.map → chunk-XKU4YE6Z.js.map} +0 -0
  265. /package/dist/{chunk-XKMDDM7P.js.map → chunk-Y6PIFKXX.js.map} +0 -0
  266. /package/dist/{chunk-RH2OSRQY.js.map → chunk-Z56IHRVV.js.map} +0 -0
@@ -0,0 +1,180 @@
1
+ /**
2
+ * correction/correction-service.ts — thin orchestration for the Correction
3
+ * Contract (issue #1580 PR 3).
4
+ *
5
+ * Owns the single plan/apply pipeline every correction surface (MCP / HTTP /
6
+ * CLI) calls. Authorizes the caller through the existing namespace policy,
7
+ * constructs the planner + executor with their collaborators, and exposes
8
+ * `plan` / `apply` / `listPending` / `discard`.
9
+ *
10
+ * The service NEVER accepts a caller-supplied namespace without policy
11
+ * validation (rule 42; checklist §16 foreign-ID guard): a principal may only
12
+ * PLAN against namespaces they can READ and APPLY against namespaces they can
13
+ * WRITE — both resolved through the injected namespace policy.
14
+ */
15
+
16
+ import {
17
+ CorrectionContractError,
18
+ type CorrectionOutcome,
19
+ type CorrectionPlan,
20
+ type CorrectionRequest,
21
+ } from "./correction-contract.js";
22
+ import { CorrectionPlanner, type PlannerDeps } from "./correction-planner.js";
23
+ import { CorrectionExecutor, type ExecutorDeps } from "./correction-executor.js";
24
+
25
+ // ---------------------------------------------------------------------------
26
+ // Injected collaborators — the access-service wires these from the orchestrator.
27
+ // ---------------------------------------------------------------------------
28
+
29
+ /**
30
+ * Namespace policy façade. The access-service already implements these via
31
+ * `resolveWritableNamespace` / `canReadNamespace` / `canWriteNamespace`; the
32
+ * correction service consumes them through this narrow interface so the
33
+ * correction modules stay decoupled from the access-service's surface area.
34
+ */
35
+ export interface CorrectionNamespacePolicy {
36
+ /**
37
+ * Resolve the AUTHORIZED effective namespace for a plan/apply request.
38
+ * Throws when the caller lacks read+write scope. The returned namespace is
39
+ * the ONE the planner + executor operate in.
40
+ */
41
+ resolveAuthorizedNamespace(request: {
42
+ namespace?: string;
43
+ sessionKey?: string;
44
+ principal?: string;
45
+ }): Promise<string>;
46
+ /**
47
+ * Whether the caller may WRITE a given namespace. Used to authorize rescope
48
+ * destinations before the executor moves a memory across namespaces.
49
+ */
50
+ canWriteNamespace(request: {
51
+ namespace: string;
52
+ sessionKey?: string;
53
+ principal?: string;
54
+ }): Promise<boolean>;
55
+ /** Namespaces the caller may read — scopes the planner's search. */
56
+ readableNamespaces(request: {
57
+ namespace?: string;
58
+ sessionKey?: string;
59
+ principal?: string;
60
+ }): Promise<readonly string[]>;
61
+ }
62
+
63
+ /**
64
+ * Factory wiring for the planner + executor deps. The service holds ONE
65
+ * planner + ONE executor for its lifetime; both are stateless across requests
66
+ * (per-request scope is threaded through method parameters, rules 11/47).
67
+ */
68
+ export interface CorrectionServiceDeps {
69
+ readonly policy: CorrectionNamespacePolicy;
70
+ /**
71
+ * Planner collaborators. The planner takes `readableNamespaces` per call to
72
+ * `plan()`, so a single deps instance serves callers with different scopes.
73
+ */
74
+ plannerDeps(): PlannerDeps;
75
+ /** Executor collaborators (one per service). */
76
+ executorDeps(): ExecutorDeps;
77
+ /** Whether the correction feature is enabled (gate). */
78
+ isEnabled(): boolean;
79
+ /** Whether apply requires explicit confirmation (rule 48). */
80
+ applyRequiresConfirm(): boolean;
81
+ }
82
+
83
+ // ---------------------------------------------------------------------------
84
+ // Service
85
+ // ---------------------------------------------------------------------------
86
+
87
+ export class CorrectionService {
88
+ private readonly planner: CorrectionPlanner;
89
+ private readonly executor: CorrectionExecutor;
90
+
91
+ constructor(private readonly deps: CorrectionServiceDeps) {
92
+ this.planner = new CorrectionPlanner(deps.plannerDeps());
93
+ this.executor = new CorrectionExecutor(deps.executorDeps(), this.planner);
94
+ }
95
+
96
+ /**
97
+ * Plan a correction. Read-only — produces + persists a {@link CorrectionPlan}.
98
+ * Safe to run with the gate ON (default) since the plan writes no memory state.
99
+ *
100
+ * The plan is stored under the AUTHORIZED (writable) namespace — the same
101
+ * namespace apply/listPending/discard resolve — so the plan is always
102
+ * found by the caller that created it (review threads: plan-stored-wrong-
103
+ * namespace + cross-namespace candidate mismatch). Candidates are located
104
+ * within that single namespace too: a correction can only affect memories
105
+ * the principal can write, so reading from a non-writable namespace to
106
+ * draft a correction that can never be applied would be misleading.
107
+ */
108
+ async plan(request: CorrectionRequest): Promise<CorrectionPlan> {
109
+ this.requireEnabled();
110
+ const authorized = await this.deps.policy.resolveAuthorizedNamespace(request);
111
+ return this.planner.plan(request, [authorized]);
112
+ }
113
+
114
+ /**
115
+ * Apply a persisted plan by id. Requires `confirm: true` (or interactive
116
+ * yes at the CLI) when `applyRequiresConfirm` is on (default).
117
+ */
118
+ async apply(
119
+ planId: string,
120
+ opts: {
121
+ confirm?: boolean;
122
+ namespace?: string;
123
+ sessionKey?: string;
124
+ principal?: string;
125
+ },
126
+ ): Promise<CorrectionOutcome> {
127
+ this.requireEnabled();
128
+ if (this.deps.applyRequiresConfirm() && opts.confirm !== true) {
129
+ throw new CorrectionContractError(
130
+ "Correction apply requires explicit confirmation (pass `confirm: true`).",
131
+ );
132
+ }
133
+ const namespace = await this.deps.policy.resolveAuthorizedNamespace({
134
+ ...(opts.namespace ? { namespace: opts.namespace } : {}),
135
+ ...(opts.sessionKey ? { sessionKey: opts.sessionKey } : {}),
136
+ ...(opts.principal ? { principal: opts.principal } : {}),
137
+ });
138
+ return this.executor.apply(namespace, planId, {
139
+ confirm: true,
140
+ // Authorize rescope destinations through the namespace policy bound to
141
+ // THIS caller's principal (review thread: authorize-rescope-destination).
142
+ canWriteDestination: (dest) =>
143
+ this.deps.policy.canWriteNamespace({
144
+ namespace: dest,
145
+ ...(opts.sessionKey ? { sessionKey: opts.sessionKey } : {}),
146
+ ...(opts.principal ? { principal: opts.principal } : {}),
147
+ }),
148
+ });
149
+ }
150
+
151
+ /** List pending (not-yet-applied) plans for the caller's namespace. */
152
+ async listPending(opts: {
153
+ namespace?: string;
154
+ sessionKey?: string;
155
+ principal?: string;
156
+ }): Promise<CorrectionPlan[]> {
157
+ this.requireEnabled();
158
+ const namespace = await this.deps.policy.resolveAuthorizedNamespace(opts);
159
+ return this.planner.listPending(namespace);
160
+ }
161
+
162
+ /** Discard a pending plan. Idempotent. */
163
+ async discard(
164
+ planId: string,
165
+ opts: { namespace?: string; sessionKey?: string; principal?: string },
166
+ ): Promise<void> {
167
+ this.requireEnabled();
168
+ const namespace = await this.deps.policy.resolveAuthorizedNamespace(opts);
169
+ await this.planner.markConsumed(namespace, planId, "discarded");
170
+ await this.planner.deletePlan(namespace, planId);
171
+ }
172
+
173
+ private requireEnabled(): void {
174
+ if (!this.deps.isEnabled()) {
175
+ throw new CorrectionContractError(
176
+ "Correction Contract is disabled (set correction.enabled = true to enable).",
177
+ );
178
+ }
179
+ }
180
+ }
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Correction Contract surface tests (issue #1580 PR 3).
3
+ *
4
+ * Asserts the three transports (MCP / HTTP / CLI) all dispatch through the
5
+ * SAME boundary operations (memory_correct_plan / memory_correct_apply) so
6
+ * validation + namespace policy reach every correction path (rule 22 / 39).
7
+ *
8
+ * Gate parity test: when correctionVisible is off, tools/list is byte-identical
9
+ * to pre-feature — the two correction tools are absent (rule 39).
10
+ */
11
+ import { test } from "node:test";
12
+ import assert from "node:assert/strict";
13
+ import { EngramMcpServer } from "../access-mcp.js";
14
+ import type { EngramAccessService } from "../access-service.js";
15
+ import { getOperation, __resetRegistryForTest } from "../access-boundary.js";
16
+ import type { CorrectionPlan, CorrectionOutcome } from "./correction-contract.js";
17
+
18
+ // Re-register operations after a prior test file cleared the registry.
19
+ import "../access-operations.js";
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Helpers — safe extraction without inline casts
23
+ // ---------------------------------------------------------------------------
24
+
25
+ function extractToolNames(response: unknown): Set<string> {
26
+ if (typeof response !== "object" || response === null) return new Set();
27
+ const r = response as { result?: unknown };
28
+ if (typeof r.result !== "object" || r.result === null) return new Set();
29
+ const result = r.result as { tools?: unknown };
30
+ if (!Array.isArray(result.tools)) return new Set();
31
+ const names = new Set<string>();
32
+ for (const t of result.tools) {
33
+ if (typeof t === "object" && t !== null && "name" in t) {
34
+ const name = t.name;
35
+ if (typeof name === "string") names.add(name);
36
+ }
37
+ }
38
+ return names;
39
+ }
40
+
41
+ interface MockCalls {
42
+ planRequests: Array<{ text: string; targetIds?: string[]; principal?: string }>;
43
+ applyRequests: Array<{ planId: string; confirm: boolean; principal?: string }>;
44
+ }
45
+
46
+ function makeMockService(
47
+ planResponse: CorrectionPlan,
48
+ applyResponse: CorrectionOutcome,
49
+ ): { service: EngramAccessService; calls: MockCalls } {
50
+ const calls: MockCalls = { planRequests: [], applyRequests: [] };
51
+ const service = {
52
+ briefingEnabled: true,
53
+ correctionPlan(req: {
54
+ text: string;
55
+ targetIds?: string[];
56
+ principal?: string;
57
+ }): Promise<CorrectionPlan> {
58
+ calls.planRequests.push(req);
59
+ return Promise.resolve(planResponse);
60
+ },
61
+ correctionApply(
62
+ planId: string,
63
+ opts: { confirm?: boolean; principal?: string },
64
+ ): Promise<CorrectionOutcome> {
65
+ calls.applyRequests.push({
66
+ planId,
67
+ confirm: opts.confirm === true,
68
+ ...(opts.principal ? { principal: opts.principal } : {}),
69
+ });
70
+ return Promise.resolve(applyResponse);
71
+ },
72
+ correctionListPending(): Promise<CorrectionPlan[]> {
73
+ return Promise.resolve([]);
74
+ },
75
+ } as unknown as EngramAccessService;
76
+ return { service, calls };
77
+ }
78
+
79
+ const STUB_PLAN: CorrectionPlan = {
80
+ planId: "corr-test-1",
81
+ request: { text: "we migrated to MySQL" },
82
+ affected: [],
83
+ classification: "outdated",
84
+ actions: [],
85
+ diff: "--- old\n+++ new",
86
+ confidence: 0.9,
87
+ warnings: [],
88
+ createdAt: "2026-01-01T00:00:00.000Z",
89
+ expiresAt: "2026-01-02T00:00:00.000Z",
90
+ namespace: "default",
91
+ status: "pending",
92
+ };
93
+
94
+ const STUB_OUTCOME: CorrectionOutcome = {
95
+ planId: "corr-test-1",
96
+ status: "applied",
97
+ results: [],
98
+ auditMemoryId: "audit-1",
99
+ appliedAt: "2026-01-01T00:00:00.000Z",
100
+ };
101
+
102
+ // ---------------------------------------------------------------------------
103
+ // Gate parity: tools/list visibility (rule 39)
104
+ // ---------------------------------------------------------------------------
105
+
106
+ test("tools/list gate: correction tools absent when correctionVisible off (byte-identical)", async () => {
107
+ const stub = { briefingEnabled: true } as unknown as EngramAccessService;
108
+ const server = new EngramMcpServer(stub, { emitLegacyTools: true, correctionVisible: false });
109
+ const response = await server.handleRequest({ jsonrpc: "2.0", id: 1, method: "tools/list" });
110
+ const names = extractToolNames(response);
111
+ assert.equal(names.has("engram.memory_correct_plan"), false, "plan tool must be absent when gate off");
112
+ assert.equal(names.has("engram.memory_correct_apply"), false, "apply tool must be absent when gate off");
113
+ assert.equal(names.has("remnic.memory_correct_plan"), false, "plan alias must be absent when gate off");
114
+ assert.equal(names.has("remnic.memory_correct_apply"), false, "apply alias must be absent when gate off");
115
+ });
116
+
117
+ test("tools/list gate: correction tools present when correctionVisible on (default)", async () => {
118
+ const stub = { briefingEnabled: true } as unknown as EngramAccessService;
119
+ // correctionVisible defaults to true (enabled by default — plan is read-only).
120
+ const server = new EngramMcpServer(stub, { emitLegacyTools: true });
121
+ const response = await server.handleRequest({ jsonrpc: "2.0", id: 1, method: "tools/list" });
122
+ const names = extractToolNames(response);
123
+ assert.equal(names.has("engram.memory_correct_plan"), true, "plan tool must be present by default");
124
+ assert.equal(names.has("engram.memory_correct_apply"), true, "apply tool must be present by default");
125
+ assert.equal(names.has("remnic.memory_correct_plan"), true, "plan alias must be present");
126
+ assert.equal(names.has("remnic.memory_correct_apply"), true, "apply alias must be present");
127
+ });
128
+
129
+ // ---------------------------------------------------------------------------
130
+ // MCP dispatch: tools/call → boundary operation → service method
131
+ // ---------------------------------------------------------------------------
132
+
133
+ test("MCP surface: memory_correct_plan dispatches to service.correctionPlan", async () => {
134
+ const { service, calls } = makeMockService(STUB_PLAN, STUB_OUTCOME);
135
+ const server = new EngramMcpServer(service, { emitLegacyTools: true, correctionVisible: true });
136
+ const response = await server.handleRequest({
137
+ jsonrpc: "2.0",
138
+ id: 1,
139
+ method: "tools/call",
140
+ params: {
141
+ name: "engram.memory_correct_plan",
142
+ arguments: { text: "we migrated to MySQL in March", targetIds: ["mem-1"] },
143
+ },
144
+ });
145
+ assert.equal(calls.planRequests.length, 1, "service.correctionPlan called exactly once");
146
+ assert.equal(calls.planRequests[0]?.text, "we migrated to MySQL in March");
147
+ assert.deepEqual(calls.planRequests[0]?.targetIds, ["mem-1"]);
148
+ // The response result is the plan returned by the service.
149
+ assert.equal(
150
+ typeof response === "object" && response !== null && "result" in response,
151
+ true,
152
+ "response must have a result",
153
+ );
154
+ });
155
+
156
+ test("MCP surface: memory_correct_apply dispatches to service.correctionApply with confirm", async () => {
157
+ const { service, calls } = makeMockService(STUB_PLAN, STUB_OUTCOME);
158
+ const server = new EngramMcpServer(service, { emitLegacyTools: true, correctionVisible: true });
159
+ await server.handleRequest({
160
+ jsonrpc: "2.0",
161
+ id: 2,
162
+ method: "tools/call",
163
+ params: {
164
+ name: "engram.memory_correct_apply",
165
+ arguments: { planId: "corr-test-1", confirm: true },
166
+ },
167
+ });
168
+ assert.equal(calls.applyRequests.length, 1, "service.correctionApply called exactly once");
169
+ assert.equal(calls.applyRequests[0]?.planId, "corr-test-1");
170
+ assert.equal(calls.applyRequests[0]?.confirm, true);
171
+ });
172
+
173
+ test("MCP surface: remnic.memory_correct_plan alias dispatches identically", async () => {
174
+ const { service, calls } = makeMockService(STUB_PLAN, STUB_OUTCOME);
175
+ const server = new EngramMcpServer(service, { emitLegacyTools: true, correctionVisible: true });
176
+ await server.handleRequest({
177
+ jsonrpc: "2.0",
178
+ id: 3,
179
+ method: "tools/call",
180
+ params: {
181
+ name: "remnic.memory_correct_plan",
182
+ arguments: { text: "alias test" },
183
+ },
184
+ });
185
+ assert.equal(calls.planRequests.length, 1, "alias dispatches to the same service method");
186
+ assert.equal(calls.planRequests[0]?.text, "alias test");
187
+ });
188
+
189
+ // ---------------------------------------------------------------------------
190
+ // Boundary validation: empty text rejected (rule 51)
191
+ // ---------------------------------------------------------------------------
192
+
193
+ test("boundary: memory_correct_plan rejects empty text with a structured error", async () => {
194
+ const { service } = makeMockService(STUB_PLAN, STUB_OUTCOME);
195
+ const server = new EngramMcpServer(service, { emitLegacyTools: true, correctionVisible: true });
196
+ const response = await server.handleRequest({
197
+ jsonrpc: "2.0",
198
+ id: 4,
199
+ method: "tools/call",
200
+ params: {
201
+ name: "engram.memory_correct_plan",
202
+ arguments: { text: "" },
203
+ },
204
+ });
205
+ // The MCP server wraps boundary errors in an isError result.
206
+ if (typeof response === "object" && response !== null && "result" in response) {
207
+ const result = response.result;
208
+ if (typeof result === "object" && result !== null && "isError" in result) {
209
+ assert.equal(result.isError, true, "empty text must produce an error result");
210
+ return;
211
+ }
212
+ }
213
+ assert.fail("expected an isError result for empty text");
214
+ });
215
+
216
+ test("boundary: memory_correct_apply rejects missing planId with a structured error", async () => {
217
+ const { service } = makeMockService(STUB_PLAN, STUB_OUTCOME);
218
+ const server = new EngramMcpServer(service, { emitLegacyTools: true, correctionVisible: true });
219
+ const response = await server.handleRequest({
220
+ jsonrpc: "2.0",
221
+ id: 5,
222
+ method: "tools/call",
223
+ params: {
224
+ name: "engram.memory_correct_apply",
225
+ arguments: {},
226
+ },
227
+ });
228
+ if (typeof response === "object" && response !== null && "result" in response) {
229
+ const result = response.result;
230
+ if (typeof result === "object" && result !== null && "isError" in result) {
231
+ assert.equal(result.isError, true, "missing planId must produce an error result");
232
+ return;
233
+ }
234
+ }
235
+ assert.fail("expected an isError result for missing planId");
236
+ });
237
+
238
+ // ---------------------------------------------------------------------------
239
+ // Operation registry: both ops are registered
240
+ // ---------------------------------------------------------------------------
241
+
242
+ test("registry: memory_correct_plan + memory_correct_apply are registered operations", () => {
243
+ assert.ok(getOperation("memory_correct_plan"), "memory_correct_plan must be registered");
244
+ assert.ok(getOperation("memory_correct_apply"), "memory_correct_apply must be registered");
245
+ });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * correction/index.ts — barrel for the Correction Contract (issue #1580).
3
+ *
4
+ * One plan/apply pipeline for all memory corrections. See
5
+ * {@link CorrectionService} for the single entry point every surface calls.
6
+ */
7
+
8
+ export {
9
+ CorrectionContractError,
10
+ CORRECTION_ACTION_KINDS,
11
+ CORRECTION_CLASSIFICATIONS,
12
+ CORRECTION_TEXT_MAX,
13
+ REDACTION_PATTERN_MAX,
14
+ deterministicFallbackPlan,
15
+ newPlanId,
16
+ validateCorrectionAction,
17
+ validateCorrectionRequest,
18
+ validateMemoryDraft,
19
+ validateRedactionPattern,
20
+ } from "./correction-contract.js";
21
+
22
+ export type {
23
+ CorrectionAction,
24
+ CorrectionAffectedEntry,
25
+ CorrectionClassification,
26
+ CorrectionOutcome,
27
+ CorrectionPlan,
28
+ CorrectionRequest,
29
+ CorrectionActionResult,
30
+ MemoryDraft,
31
+ } from "./correction-contract.js";
32
+
33
+ export { CorrectionPlanner, parsePlan } from "./correction-planner.js";
34
+ export type { LlmClassificationResult, PlannerCandidate, PlannerDeps } from "./correction-planner.js";
35
+
36
+ export { CorrectionExecutor } from "./correction-executor.js";
37
+ export type { ExecutorDeps, ExecutorMemory } from "./correction-executor.js";
38
+
39
+ export { CorrectionService } from "./correction-service.js";
40
+ export type { CorrectionNamespacePolicy, CorrectionServiceDeps } from "./correction-service.js";
41
+
42
+ export { createCorrectionService, isCorrectionFeatureEnabled } from "./correction-access-wiring.js";
43
+ export type { CorrectionAccessWiring } from "./correction-access-wiring.js";
package/src/storage.ts CHANGED
@@ -3184,6 +3184,16 @@ export class StorageManager {
3184
3184
  return this.tombstoneStoreLoadPromise;
3185
3185
  }
3186
3186
 
3187
+ /**
3188
+ * Whether tombstones are enabled on this storage. Callers that need to
3189
+ * distinguish "tombstones disabled" (null return is expected) from
3190
+ * "persistence failed" (appendTombstone swallows store errors and also
3191
+ * returns null) use this to fail closed when enabled (#1580 review OgIqp).
3192
+ */
3193
+ isTombstonesEnabled(): boolean {
3194
+ return this.tombstonesConfig.enabled;
3195
+ }
3196
+
3187
3197
  /**
3188
3198
  * Append a tombstone for a retired memory (issue #1579 emitters).
3189
3199
  * Best-effort: a tombstone append failure MUST NOT fail the supersession /
package/src/types.ts CHANGED
@@ -822,6 +822,33 @@ export interface PluginConfig {
822
822
  * deployments prefer the older (always-inject) behavior. Default `false`.
823
823
  */
824
824
  temporalExpiredInInjection: boolean;
825
+ /**
826
+ * Correction Contract (issue #1580) — one plan/apply pipeline for memory
827
+ * corrections. Master visibility + enforcement gate for the
828
+ * `memory_correct_plan` / `memory_correct_apply` tools. Default `true`:
829
+ * planning is read-only (locates candidates + drafts a pending plan file)
830
+ * and safe to ship on; `false` hides the tools and rejects runtime calls so
831
+ * the surface cannot drift out of sync. Parsed from `correction.enabled`
832
+ * (nested) or `correctionEnabled` (flat legacy).
833
+ */
834
+ correctionEnabled: boolean;
835
+ /**
836
+ * Whether `memory_correct_apply` requires an explicit `confirm: true` to
837
+ * mutate memories. Default `true` (least-privileged). Parsed from
838
+ * `correction.applyRequiresConfirm` / `correctionApplyRequiresConfirm`.
839
+ */
840
+ correctionApplyRequiresConfirm: boolean;
841
+ /**
842
+ * Max memories a single correction plan may touch; over-limit plans are
843
+ * rejected, never silently truncated (review thread). Default `10`. Parsed
844
+ * from `correction.maxAffected` / `correctionMaxAffected`.
845
+ */
846
+ correctionMaxAffected: number;
847
+ /**
848
+ * Plan time-to-live in hours; expired plans are rejected at apply. Default
849
+ * `24`. Parsed from `correction.planTtlHours` / `correctionPlanTtlHours`.
850
+ */
851
+ correctionPlanTtlHours: number;
825
852
  // Tombstones — non-resurrection invariant (issue #1579).
826
853
  /**
827
854
  * Master gate for the tombstone non-resurrection invariant. When `true`
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/access-operations.ts"],"sourcesContent":["/**\n * Pilot operation definitions for the access boundary (issue #1525).\n *\n * Three operations migrate through the registry in this PR — `memory_get`,\n * `memory_search`, and the `memory_store` write op — so the boundary's\n * normalization matrix (rules 17/28/36/48/51) and shared error mapping reach\n * MCP, HTTP, and CLI from one place. Domain-group migrations (memory ops →\n * connectors → namespaces …) land as follow-up PRs that add `defineOperation`\n * calls here and delete the surface-local validation they replace.\n *\n * Importing this module for its side effects registers the pilot operations;\n * surfaces then dispatch via {@link getOperation} from `./access-boundary.js`.\n */\n\nimport { z } from \"zod\";\n\nimport { defineOperation } from \"./access-boundary.js\";\nimport { memoryStoreRequestSchema, type MemoryStoreRequest } from \"./access-schema.js\";\nimport type {\n EngramAccessMemoryResponse,\n EngramAccessWriteResponse,\n} from \"./access-service.js\";\nimport {\n DECISION_SUBCOMMANDS,\n type DecisionSurfaceRequest,\n type DecisionSurfaceResponse,\n} from \"./coding/decision-surfaces.js\";\nimport {\n type ArchitectureSurfaceRequest,\n type ArchitectureSurfaceResponse,\n} from \"./coding/architecture-surfaces.js\";\nimport {\n type CodegraphSurfaceRequest,\n type CodegraphSurfaceResponse,\n isCodegraphToolName,\n} from \"./coding/codegraph-surfaces.js\";\nimport {\n DELTA_SUBCOMMANDS,\n type DeltaSurfaceRequest,\n type DeltaSurfaceResponse,\n} from \"./coding/session-delta-surfaces.js\";\n\n// ---------------------------------------------------------------------------\n// memory_get — fetch one memory by id\n// ---------------------------------------------------------------------------\n\n/**\n * `memoryId` is required and non-empty (rule 51: the MCP dispatcher previously\n * fell back to `typeof args.memoryId === \"string\" ? args.memoryId : \"\"`,\n * silently passing an empty id into the service). `namespace` is\n * `.nullable().optional()` because MCP clients send `null` (gotcha #2).\n * `namespace` has no `.min(1)` because the pre-boundary handlers forwarded\n * empty/whitespace strings, and `resolveNamespace` treats empty identically\n * to absent (both trim to falsy → default namespace). Rejecting empty would\n * break HTTP callers that send a bare `?namespace=` (Cursor review).\n */\nconst memoryGetSchema = z.object({\n memoryId: z.string().trim().min(1, \"memoryId is required\").max(512),\n namespace: z.string().trim().max(256).nullable().optional(),\n});\n\nexport interface MemoryGetInput {\n readonly memoryId: string;\n readonly namespace?: string | null;\n}\n\nexport interface MemoryGetOutput {\n readonly result: EngramAccessMemoryResponse;\n}\n\nexport const memoryGetOperation = defineOperation<MemoryGetInput, MemoryGetOutput>({\n name: \"memory_get\",\n description: \"Fetch one memory by id.\",\n schema: memoryGetSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.memoryGet(\n input.memoryId,\n input.namespace ?? undefined,\n ctx.authenticatedPrincipal,\n );\n return { result };\n },\n});\n\n// ---------------------------------------------------------------------------\n// memory_search — semantic search across memories\n// ---------------------------------------------------------------------------\n\nconst memorySearchSchema = z.object({\n query: z.string().trim().min(1, \"query is required\").max(2048),\n namespace: z.string().trim().max(256).nullable().optional(),\n // No upper cap: the pre-boundary MCP handler forwarded any finite number to\n // memorySearch, and the QMD/search backends honor large limits. Capping at\n // 100 would reject existing clients that request larger result sets.\n maxResults: z.number().int().min(1).nullable().optional(),\n collection: z.string().trim().min(1).max(256).nullable().optional(),\n});\n\nexport interface MemorySearchInput {\n readonly query: string;\n readonly namespace?: string | null;\n readonly maxResults?: number | null;\n readonly collection?: string | null;\n}\n\nexport interface MemorySearchOutput {\n readonly result: {\n readonly query: string;\n readonly results: ReadonlyArray<{ path: string; score: number; snippet: string }>;\n readonly count: number;\n };\n}\n\nexport const memorySearchOperation = defineOperation<MemorySearchInput, MemorySearchOutput>({\n name: \"memory_search\",\n description: \"Search memories across readable namespaces.\",\n schema: memorySearchSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.memorySearch({\n query: input.query,\n namespace: input.namespace ?? undefined,\n maxResults: input.maxResults ?? undefined,\n collection: input.collection ?? undefined,\n principal: ctx.authenticatedPrincipal,\n });\n return { result };\n },\n});\n\n// ---------------------------------------------------------------------------\n// memory_store — the pilot WRITE op\n// ---------------------------------------------------------------------------\n\nexport type MemoryStoreInput = MemoryStoreRequest;\n\nexport interface MemoryStoreOutput {\n readonly result: EngramAccessWriteResponse;\n}\n\nexport const memoryStoreOperation = defineOperation<MemoryStoreInput, MemoryStoreOutput>({\n name: \"memory_store\",\n description: \"Store an explicit memory through the access layer.\",\n // Reuse the existing schema verbatim — the migration is behavior-preserving;\n // the schema's external contract is NOT changing in this PR (per the issue's\n // pitfall note).\n schema: memoryStoreRequestSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.memoryStore(\n {\n ...input,\n authenticatedPrincipal: ctx.authenticatedPrincipal,\n },\n // Forward transport-level hooks (e.g. HTTP's atomic write-quota gate)\n // so the hook still fires inside the service's idempotent-write lock —\n // never before, never on a replay (#1434 invariant preserved by the\n // boundary migration).\n\n ctx.hooks,\n );\n return { result };\n },\n});\n\n// ---------------------------------------------------------------------------\n// coding_decision — decision-record surfaces (issue #1548 Track A PR 2)\n// ---------------------------------------------------------------------------\n\n/**\n * The subcommand field is required and MUST be one of the four valid values\n * (rule 51 — reject loudly, list the options, never silently default). The\n * remaining fields are optional because each subcommand uses a different\n * subset; the handler validates subcommand-specific requirements after\n * routing.\n */\n/**\n * MCP clients send `null` for absent optional fields. Zod `.optional()`\n * rejects `null`, so strip nulls at the object level before the inner\n * schema validates (review: cursor null-field thread).\n */\nconst codingDecisionSchema = z.preprocess(\n (data) => {\n if (data && typeof data === \"object\" && !Array.isArray(data)) {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(data as Record<string, unknown>)) {\n if (v !== null) out[k] = v;\n }\n return out;\n }\n return data;\n },\n z.object({\n subcommand: z.enum(DECISION_SUBCOMMANDS),\n sessionKey: z.string().trim().max(512).optional(),\n namespace: z.string().trim().max(256).optional(),\n id: z.string().trim().max(512).optional(),\n title: z.string().trim().max(512).optional(),\n status: z.string().trim().max(64).optional(),\n context: z.string().trim().max(8192).optional(),\n decision: z.string().trim().max(8192).optional(),\n consequences: z.string().trim().max(8192).optional(),\n entityRefs: z.array(z.string().trim().min(1).max(256)).optional(),\n supersedesId: z.string().trim().max(512).optional(),\n }),\n);\n\nexport type CodingDecisionInput = DecisionSurfaceRequest;\nexport type CodingDecisionOutput = { result: DecisionSurfaceResponse };\n\nexport const codingDecisionOperation = defineOperation<\n CodingDecisionInput,\n CodingDecisionOutput\n>({\n name: \"coding_decision\",\n description:\n \"List, get, record, or supersede decision records in the session's coding namespace (issue #1548 Track A).\",\n schema: codingDecisionSchema as z.ZodType<CodingDecisionInput>,\n handler: async (input, ctx) => {\n const result = await ctx.service.codingDecision(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\n// ---------------------------------------------------------------------------\n// coding_architecture — architecture-card surfaces (issue #1548 Track A PR 3)\n// ---------------------------------------------------------------------------\n\nconst codingArchitectureSchema = z.preprocess(\n (data) => {\n if (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n const obj = data as Record<string, unknown>;\n const cleaned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null) cleaned[key] = value;\n }\n return cleaned;\n }\n return data;\n },\n z.object({\n subcommand: z.enum([\"get\", \"refresh\"]),\n sessionKey: z.string().optional(),\n namespace: z.string().optional(),\n }),\n);\n\nexport type CodingArchitectureInput = ArchitectureSurfaceRequest;\nexport type CodingArchitectureOutput = { result: ArchitectureSurfaceResponse };\n\nexport const codingArchitectureOperation = defineOperation<\n CodingArchitectureInput,\n CodingArchitectureOutput\n>({\n name: \"coding_architecture\",\n description:\n \"Get or refresh the architecture card for the session's coding namespace (issue #1548 Track A PR 3).\",\n schema: codingArchitectureSchema as z.ZodType<CodingArchitectureInput>,\n handler: async (input, ctx) => {\n const result = await ctx.service.codingArchitecture(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nconst codegraphSurfaceSchema = z.preprocess(\n (data) => {\n if (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n const obj = data as Record<string, unknown>;\n const cleaned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null) cleaned[key] = value;\n }\n return cleaned;\n }\n return data;\n },\n z.object({\n tool: z.string().refine(isCodegraphToolName, {\n message: \"tool must be one of the codegraph tool names\",\n }),\n sessionKey: z.string().max(512).optional(),\n principal: z.string().max(256).optional(),\n project: z.string().max(256).optional(),\n query: z.string().max(2048).optional(),\n limit: z.number().int().positive().max(200).optional(),\n start: z.string().max(512).optional(),\n direction: z.string().max(64).optional(),\n depth: z.number().int().positive().max(10).optional(),\n qualifiedName: z.string().max(1024).optional(),\n path: z.string().max(2048).optional(),\n structuredQuery: z.record(z.string(), z.unknown()).optional(),\n head: z.string().max(256).optional(),\n repoRoot: z.string().max(2048).optional(),\n mode: z.string().max(64).optional(),\n confirm: z.boolean().optional(),\n subcommand: z.string().max(64).optional(),\n id: z.string().max(512).optional(),\n title: z.string().max(512).optional(),\n status: z.string().max(64).optional(),\n context: z.string().max(8192).optional(),\n decision: z.string().max(8192).optional(),\n consequences: z.string().max(8192).optional(),\n entityRefs: z.array(z.string().max(256)).optional(),\n supersedesId: z.string().max(512).optional(),\n traces: z.array(z.unknown()).optional(),\n }),\n) as z.ZodType<CodegraphSurfaceRequest>;\n\n// ---------------------------------------------------------------------------\n// coding_delta — session-delta surface (issue #1548 Track A PR 4)\n// ---------------------------------------------------------------------------\n\nconst codingDeltaSchema = z.preprocess(\n (data) => {\n if (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n const obj = data as Record<string, unknown>;\n const cleaned: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== null) cleaned[key] = value;\n }\n return cleaned;\n }\n return data;\n },\n z.object({\n subcommand: z.enum(DELTA_SUBCOMMANDS),\n sessionKey: z.string().trim().max(512).optional(),\n namespace: z.string().trim().max(256).optional(),\n }),\n);\n\nexport type CodingDeltaInput = DeltaSurfaceRequest;\nexport type CodingDeltaOutput = { result: DeltaSurfaceResponse };\n\nexport const codingDeltaOperation = defineOperation<\n CodingDeltaInput,\n CodingDeltaOutput\n>({\n name: \"coding_delta\",\n description:\n \"Get the session delta (commits + touched files since last seen) for the session's coding namespace (issue #1548 Track A PR 4).\",\n schema: codingDeltaSchema as z.ZodType<CodingDeltaInput>,\n handler: async (input, ctx) => {\n const result = await ctx.service.codingDelta(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\n// ---------------------------------------------------------------------------\n// Surface registration map — what each transport calls the pilot ops\n// ---------------------------------------------------------------------------\n\n/**\n * The canonical short names (no `engram.`/`remnic.` prefix) of the operations\n * the boundary owns today. The fitness test treats this set as the migrated\n * set; everything else on a surface is unmigrated and counted by the ratchet.\n */\nexport const codegraphIndexOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_index\",\n description:\n \"Codegraph parity tool (issue #1554): index. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphListProjectsOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_list_projects\",\n description:\n \"Codegraph parity tool (issue #1554): list_projects. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphDeleteProjectOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_delete_project\",\n description:\n \"Codegraph parity tool (issue #1554): delete_project. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphIndexStatusOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_index_status\",\n description:\n \"Codegraph parity tool (issue #1554): index_status. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphSearchGraphOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_search_graph\",\n description:\n \"Codegraph parity tool (issue #1554): search_graph. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphTracePathOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_trace_path\",\n description:\n \"Codegraph parity tool (issue #1554): trace_path. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphDetectChangesOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_detect_changes\",\n description:\n \"Codegraph parity tool (issue #1554): detect_changes. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphQueryGraphOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_query_graph\",\n description:\n \"Codegraph parity tool (issue #1554): query_graph. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphGetSchemaOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_get_schema\",\n description:\n \"Codegraph parity tool (issue #1554): get_schema. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphGetSnippetOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_get_snippet\",\n description:\n \"Codegraph parity tool (issue #1554): get_snippet. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphGetArchitectureOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_get_architecture\",\n description:\n \"Codegraph parity tool (issue #1554): get_architecture. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphSearchCodeOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_search_code\",\n description:\n \"Codegraph parity tool (issue #1554): search_code. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphManageAdrOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_manage_adr\",\n description:\n \"Codegraph parity tool (issue #1554): manage_adr. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\nexport const codegraphIngestTracesOperation = defineOperation<\n CodegraphSurfaceRequest,\n { result: CodegraphSurfaceResponse }\n>({\n name: \"codegraph_ingest_traces\",\n description:\n \"Codegraph parity tool (issue #1554): ingest_traces. Delegates to the shared codegraph surface handler.\",\n schema: codegraphSurfaceSchema,\n handler: async (input, ctx) => {\n const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);\n return { result };\n },\n});\n\n// Batch-migrated operations (issue #1525): registers all remaining\n// handlers through the boundary as a side effect of importing this module.\nimport \"./access-operations-batch.js\";\n\nexport const REGISTERED_OPERATIONS = [\n memoryGetOperation.spec.name,\n memorySearchOperation.spec.name,\n memoryStoreOperation.spec.name,\n codingDecisionOperation.spec.name,\n codingArchitectureOperation.spec.name,\n codegraphIndexOperation.spec.name,\n codegraphListProjectsOperation.spec.name,\n codegraphDeleteProjectOperation.spec.name,\n codegraphIndexStatusOperation.spec.name,\n codegraphSearchGraphOperation.spec.name,\n codegraphTracePathOperation.spec.name,\n codegraphDetectChangesOperation.spec.name,\n codegraphQueryGraphOperation.spec.name,\n codegraphGetSchemaOperation.spec.name,\n codegraphGetSnippetOperation.spec.name,\n codegraphGetArchitectureOperation.spec.name,\n codegraphSearchCodeOperation.spec.name,\n codegraphManageAdrOperation.spec.name,\n codegraphIngestTracesOperation.spec.name,\n codingDeltaOperation.spec.name,\n] as const;\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,SAAS;AA0ClB,IAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,sBAAsB,EAAE,IAAI,GAAG;AAAA,EAClE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAC5D,CAAC;AAWM,IAAM,qBAAqB,gBAAiD;AAAA,EACjF,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS,OAAO,OAAO,QAAQ;AAC7B,UAAM,SAAS,MAAM,IAAI,QAAQ;AAAA,MAC/B,MAAM;AAAA,MACN,MAAM,aAAa;AAAA,MACnB,IAAI;AAAA,IACN;AACA,WAAO,EAAE,OAAO;AAAA,EAClB;AACF,CAAC;AAMD,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,mBAAmB,EAAE,IAAI,IAAI;AAAA,EAC7D,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA,EAI1D,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS;AAAA,EACxD,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,C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