@remnic/core 9.3.708 → 9.3.709

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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runPostConsolidationMaterialize
3
- } from "./chunk-4E2QCH46.js";
3
+ } from "./chunk-CNVIWMQI.js";
4
4
  import {
5
5
  discoverMemoryExtensions,
6
6
  renderExtensionsBlock,
@@ -217,4 +217,4 @@ export {
217
217
  buildExtensionsBlockForConsolidation,
218
218
  materializeAfterSemanticConsolidation
219
219
  };
220
- //# sourceMappingURL=chunk-WDH3KUZU.js.map
220
+ //# sourceMappingURL=chunk-NXL5CVE7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listNamespaces
3
- } from "./chunk-NM6TSEGQ.js";
3
+ } from "./chunk-JNOYYWCA.js";
4
4
  import {
5
5
  runConsolidationProvenanceCheck
6
6
  } from "./chunk-7XH7VJN4.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-YBPYIAA5.js";
10
10
  import {
11
11
  summarizeNamespaceMaintenanceHealth
12
- } from "./chunk-Y6YHAGQP.js";
12
+ } from "./chunk-7NDYFAJS.js";
13
13
  import {
14
14
  analyzeSessionIntegrity,
15
15
  applySessionRepair,
@@ -35,17 +35,17 @@ import {
35
35
  } from "./chunk-3PY7VHV7.js";
36
36
  import {
37
37
  parseConfig
38
- } from "./chunk-WRGPE6AW.js";
38
+ } from "./chunk-3XHD3XGK.js";
39
39
  import {
40
40
  listMemoryGovernanceRuns,
41
41
  readMemoryGovernanceRunArtifact
42
- } from "./chunk-ESMY4RJ4.js";
42
+ } from "./chunk-XKU4YE6Z.js";
43
43
  import {
44
44
  analyzeGraphHealth
45
45
  } from "./chunk-YGKUAX2B.js";
46
46
  import {
47
47
  StorageManager
48
- } from "./chunk-2VQYHHWB.js";
48
+ } from "./chunk-JSDZMOT7.js";
49
49
  import {
50
50
  lintWorkspaceFiles
51
51
  } from "./chunk-DM2T26WE.js";
@@ -1395,4 +1395,4 @@ export {
1395
1395
  runBenchmarkRecall,
1396
1396
  runOperatorRepair
1397
1397
  };
1398
- //# sourceMappingURL=chunk-BGAHTI4C.js.map
1398
+ //# sourceMappingURL=chunk-OK7FUX6R.js.map
@@ -3,12 +3,14 @@ import {
3
3
  } from "./chunk-NUWZFSKC.js";
4
4
  import {
5
5
  defineOperation
6
- } from "./chunk-66TSLESZ.js";
6
+ } from "./chunk-PKE7EJMX.js";
7
7
  import {
8
+ CorrectionContractError,
8
9
  DECISION_SUBCOMMANDS,
9
10
  DELTA_SUBCOMMANDS,
11
+ EngramAccessInputError,
10
12
  isCodegraphToolName
11
- } from "./chunk-STYMKPFT.js";
13
+ } from "./chunk-EVX52NCY.js";
12
14
 
13
15
  // src/access-operations.ts
14
16
  import { z } from "zod";
@@ -206,6 +208,81 @@ var codingDeltaOperation = defineOperation({
206
208
  return { result };
207
209
  }
208
210
  });
211
+ var memoryCorrectPlanSchema = z.preprocess(
212
+ (data) => {
213
+ if (data && typeof data === "object" && !Array.isArray(data)) {
214
+ const out = {};
215
+ for (const [k, v] of Object.entries(data)) {
216
+ if (v !== null) out[k] = v;
217
+ }
218
+ return out;
219
+ }
220
+ return data;
221
+ },
222
+ z.object({
223
+ text: z.string().trim().min(1).max(1e4),
224
+ targetIds: z.array(z.string().trim().min(1).max(512)).optional(),
225
+ sessionKey: z.string().trim().max(512).optional(),
226
+ namespace: z.string().trim().max(256).optional()
227
+ })
228
+ );
229
+ var memoryCorrectPlanOperation = defineOperation({
230
+ name: "memory_correct_plan",
231
+ description: "Plan a memory correction from a plain-language statement (issue #1580). Returns a CorrectionPlan with a diff preview; apply via memory_correct_apply.",
232
+ schema: memoryCorrectPlanSchema,
233
+ handler: async (input, ctx) => {
234
+ try {
235
+ const result = await ctx.service.correctionPlan({
236
+ text: input.text,
237
+ ...input.targetIds ? { targetIds: input.targetIds } : {},
238
+ ...input.sessionKey ? { sessionKey: input.sessionKey } : {},
239
+ ...input.namespace ? { namespace: input.namespace } : {},
240
+ ...ctx.authenticatedPrincipal ? { principal: ctx.authenticatedPrincipal } : {}
241
+ });
242
+ return { result };
243
+ } catch (err) {
244
+ if (err instanceof CorrectionContractError) throw new EngramAccessInputError(err.message);
245
+ throw err;
246
+ }
247
+ }
248
+ });
249
+ var memoryCorrectApplySchema = z.preprocess(
250
+ (data) => {
251
+ if (data && typeof data === "object" && !Array.isArray(data)) {
252
+ const out = {};
253
+ for (const [k, v] of Object.entries(data)) {
254
+ if (v !== null) out[k] = v;
255
+ }
256
+ return out;
257
+ }
258
+ return data;
259
+ },
260
+ z.object({
261
+ planId: z.string().trim().min(1).max(512),
262
+ confirm: z.boolean().optional(),
263
+ sessionKey: z.string().trim().max(512).optional(),
264
+ namespace: z.string().trim().max(256).optional()
265
+ })
266
+ );
267
+ var memoryCorrectApplyOperation = defineOperation({
268
+ name: "memory_correct_apply",
269
+ description: "Apply a planned memory correction by planId (issue #1580). Requires confirm: true when correction.applyRequiresConfirm is on (default).",
270
+ schema: memoryCorrectApplySchema,
271
+ handler: async (input, ctx) => {
272
+ try {
273
+ const result = await ctx.service.correctionApply(input.planId, {
274
+ confirm: input.confirm === true,
275
+ ...input.sessionKey ? { sessionKey: input.sessionKey } : {},
276
+ ...input.namespace ? { namespace: input.namespace } : {},
277
+ ...ctx.authenticatedPrincipal ? { principal: ctx.authenticatedPrincipal } : {}
278
+ });
279
+ return { result };
280
+ } catch (err) {
281
+ if (err instanceof CorrectionContractError) throw new EngramAccessInputError(err.message);
282
+ throw err;
283
+ }
284
+ }
285
+ });
209
286
  var codegraphIndexOperation = defineOperation({
210
287
  name: "codegraph_index",
211
288
  description: "Codegraph parity tool (issue #1554): index. Delegates to the shared codegraph surface handler.",
@@ -352,7 +429,9 @@ var REGISTERED_OPERATIONS = [
352
429
  codegraphSearchCodeOperation.spec.name,
353
430
  codegraphManageAdrOperation.spec.name,
354
431
  codegraphIngestTracesOperation.spec.name,
355
- codingDeltaOperation.spec.name
432
+ codingDeltaOperation.spec.name,
433
+ memoryCorrectPlanOperation.spec.name,
434
+ memoryCorrectApplyOperation.spec.name
356
435
  ];
357
436
 
358
437
  export {
@@ -362,6 +441,8 @@ export {
362
441
  codingDecisionOperation,
363
442
  codingArchitectureOperation,
364
443
  codingDeltaOperation,
444
+ memoryCorrectPlanOperation,
445
+ memoryCorrectApplyOperation,
365
446
  codegraphIndexOperation,
366
447
  codegraphListProjectsOperation,
367
448
  codegraphDeleteProjectOperation,
@@ -378,4 +459,4 @@ export {
378
459
  codegraphIngestTracesOperation,
379
460
  REGISTERED_OPERATIONS
380
461
  };
381
- //# sourceMappingURL=chunk-24FGNOQS.js.map
462
+ //# sourceMappingURL=chunk-P6PRSI3W.js.map
@@ -0,0 +1 @@
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 { EngramAccessInputError } from \"./access-service.js\";\nimport { CorrectionContractError } from \"./correction/correction-contract.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// memory_correct_plan / memory_correct_apply — Correction Contract (#1580)\n// ---------------------------------------------------------------------------\n//\n// One plan/apply pipeline for every memory correction (supersession,\n// invalidation, tombstone, edit, rescope, redaction). The MCP/HTTP/CLI\n// surfaces all dispatch through these two ops so the boundary's validation +\n// error mapping reach every correction path (rule 22 / 39).\n\nconst memoryCorrectPlanSchema = 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 text: z.string().trim().min(1).max(10_000),\n targetIds: z.array(z.string().trim().min(1).max(512)).optional(),\n sessionKey: z.string().trim().max(512).optional(),\n namespace: z.string().trim().max(256).optional(),\n }),\n);\n\nexport interface MemoryCorrectPlanInput {\n text: string;\n targetIds?: string[];\n sessionKey?: string;\n namespace?: string;\n}\n\nexport interface MemoryCorrectPlanOutput {\n readonly result: unknown; // CorrectionPlan — opaque to the boundary\n}\n\nexport const memoryCorrectPlanOperation = defineOperation<\n MemoryCorrectPlanInput,\n MemoryCorrectPlanOutput\n>({\n name: \"memory_correct_plan\",\n description:\n \"Plan a memory correction from a plain-language statement (issue #1580). Returns a CorrectionPlan with a diff preview; apply via memory_correct_apply.\",\n schema: memoryCorrectPlanSchema as z.ZodType<MemoryCorrectPlanInput>,\n handler: async (input, ctx) => {\n try {\n const result = await ctx.service.correctionPlan({\n text: input.text,\n ...(input.targetIds ? { targetIds: input.targetIds } : {}),\n ...(input.sessionKey ? { sessionKey: input.sessionKey } : {}),\n ...(input.namespace ? { namespace: input.namespace } : {}),\n ...(ctx.authenticatedPrincipal ? { principal: ctx.authenticatedPrincipal } : {}),\n });\n return { result };\n } catch (err) {\n if (err instanceof CorrectionContractError) throw new EngramAccessInputError(err.message);\n throw err;\n }\n },\n});\n\nconst memoryCorrectApplySchema = 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 planId: z.string().trim().min(1).max(512),\n confirm: z.boolean().optional(),\n sessionKey: z.string().trim().max(512).optional(),\n namespace: z.string().trim().max(256).optional(),\n }),\n);\n\nexport interface MemoryCorrectApplyInput {\n planId: string;\n confirm?: boolean;\n sessionKey?: string;\n namespace?: string;\n}\n\nexport interface MemoryCorrectApplyOutput {\n readonly result: unknown; // CorrectionOutcome — opaque to the boundary\n}\n\nexport const memoryCorrectApplyOperation = defineOperation<\n MemoryCorrectApplyInput,\n MemoryCorrectApplyOutput\n>({\n name: \"memory_correct_apply\",\n description:\n \"Apply a planned memory correction by planId (issue #1580). Requires confirm: true when correction.applyRequiresConfirm is on (default).\",\n schema: memoryCorrectApplySchema as z.ZodType<MemoryCorrectApplyInput>,\n handler: async (input, ctx) => {\n try {\n const result = await ctx.service.correctionApply(input.planId, {\n confirm: input.confirm === true,\n ...(input.sessionKey ? { sessionKey: input.sessionKey } : {}),\n ...(input.namespace ? { namespace: input.namespace } : {}),\n ...(ctx.authenticatedPrincipal ? { principal: ctx.authenticatedPrincipal } : {}),\n });\n return { result };\n } catch (err) {\n if (err instanceof CorrectionContractError) throw new EngramAccessInputError(err.message);\n throw err;\n }\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 memoryCorrectPlanOperation.spec.name,\n memoryCorrectApplyOperation.spec.name,\n] as const;\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAS,SAAS;AA4ClB,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;AA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AAK;AAAA,EAClC,kCAAkC,KAAK;AAAA,EACvC,6BAA6B,KAAK;AAAA,EAClC,4BAA4B,KAAK;AAAA,EACjC,+BAA+B,KAAK;AAAA,EACpC,qBAAqB,KAAK;AAAA,EAC1B,2BAA2B,KAAK;AAAA,EAChC,4BAA4B,KAAK;AACnC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EngramAccessInputError
3
- } from "./chunk-STYMKPFT.js";
3
+ } from "./chunk-EVX52NCY.js";
4
4
  import {
5
5
  expandTildePath
6
6
  } from "./chunk-EYIEWJNI.js";
@@ -104,4 +104,4 @@ export {
104
104
  listRegisteredOperations,
105
105
  __resetRegistryForTest
106
106
  };
107
- //# sourceMappingURL=chunk-66TSLESZ.js.map
107
+ //# sourceMappingURL=chunk-PKE7EJMX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/access-boundary.ts"],"sourcesContent":["/**\n * Single input-validation and error boundary for the CLI/MCP/HTTP access\n * surfaces (issue #1525, epic #1520 Phase 1).\n *\n * Every operation that crosses the access-service facade passes through ONE\n * registry entry: a zod-validated request envelope, a shared error mapper,\n * and the \"reject invalid input and list valid options\" behavior that\n * CLAUDE.md rules 14/17/24/28/36/48/51 previously had to be re-implemented\n * per handler. The three surfaces become thin adapters — one operation\n * definition, three transports — so a validation fix lands everywhere at\n * once.\n *\n * Host-agnostic (rule 31): operation names carry no `openclaw-*`/`engram-*`\n * prefix. Session/namespace tenancy stays in the handler layer (resolved via\n * ScopePlan #1521); the boundary validates SHAPE, not tenancy.\n */\n\nimport { z } from \"zod\";\nimport { EngramAccessInputError, type EngramAccessService } from \"./access-service.js\";\nimport { expandTildePath } from \"./utils/path.js\";\n\n// ---------------------------------------------------------------------------\n// Canonical operation names — host-agnostic (rule 31)\n// ---------------------------------------------------------------------------\n\n/**\n * Canonical operation ids. One id is shared by the MCP tool, the HTTP route,\n * and the CLI command that expose the same operation. Add to this union as\n * each domain-group migration PR (memory ops → connectors → namespaces …)\n * lands; the fitness test in `access-surface-catalog.test.ts` treats the\n * registered set as the migration state.\n */\nexport type OperationName =\n | \"memory_get\"\n | \"memory_search\"\n | \"memory_store\"\n | \"coding_decision\"\n | \"coding_architecture\"\n // codegraph parity tools (issue #1554) -- each maps to one codegraph_*\n // boundary operation that delegates to the surface handler in\n // coding/codegraph-surfaces.ts. Names match the external tool suffixes.\n | \"codegraph_index\"\n | \"codegraph_list_projects\"\n | \"codegraph_delete_project\"\n | \"codegraph_index_status\"\n | \"codegraph_search_graph\"\n | \"codegraph_trace_path\"\n | \"codegraph_detect_changes\"\n | \"codegraph_query_graph\"\n | \"codegraph_get_schema\"\n | \"codegraph_get_snippet\"\n | \"codegraph_get_architecture\"\n | \"codegraph_search_code\"\n | \"codegraph_manage_adr\"\n | \"codegraph_ingest_traces\"\n | \"memory_correct_plan\"\n | \"memory_correct_apply\"\n | \"coding_delta\"\n // Remaining MCP/HTTP handlers migrated through the boundary (issue #1525).\n | \"recall\"\n | \"recall_explain\"\n | \"set_coding_context\"\n | \"recall_tier_explain\"\n | \"recall_xray\"\n | \"wearables_status\"\n | \"wearables_sync\"\n | \"transcript_day\"\n | \"transcript_search\"\n | \"transcript_memories\"\n | \"action_confidence\"\n | \"chatgpt_memory_inspector\"\n | \"day_summary\"\n | \"capsule_export\"\n | \"capsule_import\"\n | \"capsule_list\"\n | \"memory_governance_run\"\n | \"procedure_mining_run\"\n | \"pattern_reinforcement_run\"\n | \"procedural_stats\"\n | \"memory_timeline\"\n | \"suggestion_submit\"\n | \"entity_get\"\n | \"review_queue_list\"\n | \"observe\"\n | \"lcm_search\"\n | \"lcm_compaction_flush\"\n | \"lcm_compaction_record\"\n | \"continuity_audit_generate\"\n | \"continuity_incident_open\"\n | \"continuity_incident_close\"\n | \"continuity_incident_list\"\n | \"continuity_loop_add_or_update\"\n | \"continuity_loop_review\"\n | \"identity_anchor_get\"\n | \"identity_anchor_update\"\n | \"memory_identity\"\n | \"work_task\"\n | \"work_project\"\n | \"work_board\"\n | \"shared_context_write_output\"\n | \"shared_feedback_record\"\n | \"shared_priorities_append\"\n | \"shared_context_cross_signals_run\"\n | \"shared_context_curate_daily\"\n | \"compounding_weekly_synthesize\"\n | \"compounding_promote_candidate\"\n | \"compression_guidelines_optimize\"\n | \"compression_guidelines_activate\"\n | \"memory_profile\"\n | \"memory_entities_list\"\n | \"memory_questions\"\n | \"memory_last_recall\"\n | \"memory_intent_debug\"\n | \"memory_qmd_debug\"\n | \"memory_graph_explain\"\n | \"graph_snapshot\"\n | \"memory_feedback\"\n | \"memory_promote\"\n | \"memory_outcome\"\n | \"memory_action_apply\"\n | \"context_checkpoint\"\n | \"briefing\"\n | \"review_list\"\n | \"review_resolve\"\n | \"contradiction_scan_run\"\n | \"memory_summarize_hourly\"\n | \"conversation_index_update\"\n | \"profiling_report\"\n | \"graph_edge_decay_run\"\n | \"live_connectors_run\"\n | \"peer_list\"\n | \"peer_get\"\n | \"peer_set\"\n | \"peer_delete\"\n | \"peer_profile_get\"\n | \"peer_forget\"\n | \"console_state\"\n | \"dreams_status\"\n | \"dreams_run\"\n // HTTP-only routes (no direct MCP tool equivalent).\n | \"offline_sync_snapshot\"\n | \"offline_sync_snapshot_stream\"\n | \"offline_sync_files\"\n | \"offline_sync_file_content\"\n | \"offline_sync_apply_file_content\"\n | \"offline_sync_apply\"\n | \"lcm_status\"\n | \"memory_list\"\n | \"entity_list\"\n | \"maintenance_status\"\n | \"quality_status\"\n | \"trust_zones_status\"\n | \"trust_zones_records\"\n | \"review_disposition\"\n | \"trust_zones_promote\"\n | \"trust_zones_demo_seed\"\n | \"citations_observed\"\n | \"contradiction_detail\"\n | \"graph_events\";\n\n// ---------------------------------------------------------------------------\n// Operation context — what every handler receives\n// ---------------------------------------------------------------------------\n\n/**\n * Per-call context. `service` is the facade the handler delegates to; the\n * boundary never reaches past it. `authenticatedPrincipal` is resolved by\n * the SURFACE (MCP header / HTTP identity / CLI flag) before the boundary\n * runs, so handlers stay principal-source-agnostic. `hooks` carries\n * transport-level callbacks (e.g. HTTP write-quota enforcement) that must\n * fire atomically inside the service call; surfaces that have no such hook\n * leave it undefined.\n */\nexport interface OperationContext {\n readonly service: EngramAccessService;\n readonly authenticatedPrincipal?: string;\n readonly hooks?: OperationHooks;\n}\n\n/**\n * Transport-level callbacks a handler forwards into the service call. Kept\n * narrow on purpose: the boundary owns validation + dispatch shape, not\n * transport policy. Add fields here only when a surface genuinely needs a\n * callback the service itself consumes.\n */\nexport interface OperationHooks {\n /** HTTP write-quota gate; throws to reject the write when exhausted. */\n readonly enforceWriteQuota?: () => void | Promise<void>;\n}\n\n// ---------------------------------------------------------------------------\n// Operation spec + bound operation\n// ---------------------------------------------------------------------------\n\nexport interface OperationSpec<In, Out> {\n /** Canonical operation id; matches an {@link OperationName}. */\n readonly name: OperationName;\n readonly description: string;\n /** Zod schema validating the raw request envelope. */\n readonly schema: z.ZodType<In>;\n /** Handler invoked with the parsed input; throws EngramAccessInputError for domain faults. */\n readonly handler: (input: In, ctx: OperationContext) => Promise<Out>;\n}\n\nexport interface BoundOperation<In = unknown, Out = unknown> {\n readonly spec: OperationSpec<In, Out>;\n /** Validate the raw envelope, then invoke the handler. Throws EngramAccessInputError on any validation failure. */\n readonly run: (rawInput: unknown, ctx: OperationContext) => Promise<Out>;\n}\n\n// ---------------------------------------------------------------------------\n// Shared normalizers the boundary owns (rules 17, 28, 36, 48, 51)\n// ---------------------------------------------------------------------------\n\n/**\n * Coerce boolean-like strings at the edge (rule 36). Accepts actual booleans\n * and the string spellings clients send (\"true\"/\"false\"/\"1\"/\"0\"/\"yes\"/\"no\"/\n * \"on\"/\"off\", case-insensitive). Rejects anything else loudly — `Boolean(\"false\")`\n * would silently be `true`, which is the bug rule 36 exists to prevent.\n *\n * `undefined`/`null`/`\"\"` → `undefined`, so callers can keep treating an\n * absent flag as \"use the default\" without a separate presence check.\n */\nexport function coerceBooleanLike(value: unknown): boolean | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"string\") {\n const lower = value.trim().toLowerCase();\n if (lower === \"true\" || lower === \"1\" || lower === \"yes\" || lower === \"on\") return true;\n if (lower === \"false\" || lower === \"0\" || lower === \"no\" || lower === \"off\") return false;\n }\n throw new EngramAccessInputError(\n `expected a boolean-like value (true|false|1|0|yes|no|on|off); got ${JSON.stringify(value)}`,\n );\n}\n\n/**\n * Coerce + validate a positive integer from a numeric string or number\n * (rule 28). Loosely-typed MCP/CLI clients send `\"5\"`; `typeof saved === \"number\"`\n * on read-back would reject it later, so we coerce at the edge and reject\n * booleans/objects loudly (`Number(true) === 1` would silently pass otherwise).\n *\n * `undefined`/`null`/`\"\"` → `undefined`.\n */\nexport function coercePositiveInteger(value: unknown, label: string): number | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value) || value <= 0 || !Number.isInteger(value)) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n return value;\n }\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (!/^[+-]?\\d+$/.test(trimmed)) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n const parsed = Number(trimmed);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n }\n return parsed;\n }\n throw new EngramAccessInputError(`${label} expects a positive integer; got ${JSON.stringify(value)}`);\n}\n\n/**\n * Expand `~` in a path-shaped input (rule 17). Node `fs` does NOT expand `~`;\n * ad-hoc regex drifts. `undefined`/`null`/`\"\"` → `undefined`.\n */\nexport function normalizeOptionalPath(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value !== \"string\") {\n throw new EngramAccessInputError(`expected a path string; got ${JSON.stringify(value)}`);\n }\n return expandTildePath(value);\n}\n\n// ---------------------------------------------------------------------------\n// Error formatting — rule 51: list valid options, never silently default\n// ---------------------------------------------------------------------------\n\n/**\n * Turn a zod failure into an {@link EngramAccessInputError} whose message\n * names the offending field and — for enum/union issues — lists the valid\n * options, so the caller can correct rather than guess (rule 51).\n */\nexport function formatZodIssues(error: z.ZodError): string {\n const parts: string[] = [];\n for (const issue of error.issues) {\n const path = issue.path.length > 0 ? issue.path.join(\".\") : \"(root)\";\n const options = enumOptionsFromIssue(issue);\n const suffix = options ? `. Valid: ${options.join(\", \")}` : \"\";\n parts.push(`${path}: ${issue.message}${suffix}`);\n }\n return parts.length > 0\n ? `request validation failed: ${parts.join(\"; \")}`\n : \"request validation failed\";\n}\n\nfunction enumOptionsFromIssue(issue: z.ZodIssue): readonly string[] | undefined {\n // zod exposes accepted enum values on the issue for ZodEnum / ZodNativeEnum\n // and on the options of invalid_union discriminators. Reading them here\n // keeps \"list valid options\" in ONE place rather than per handler.\n if (issue.code === z.ZodIssueCode.invalid_enum_value) {\n const rawOptions = (issue as { options?: unknown }).options;\n if (Array.isArray(rawOptions)) {\n return rawOptions.map((opt) => String(opt));\n }\n }\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Registry\n// ---------------------------------------------------------------------------\n\nconst registry = new Map<OperationName, BoundOperation>();\n\n/**\n * Register an operation. Throws if the name is already registered — duplicate\n * registration is a programming error, not a runtime input fault, so it throws\n * a plain Error (not the input-error class surfaces translate for clients).\n */\nexport function defineOperation<In, Out>(spec: OperationSpec<In, Out>): BoundOperation<In, Out> {\n if (registry.has(spec.name)) {\n throw new Error(`access-boundary: operation already registered: ${spec.name}`);\n }\n const bound: BoundOperation<In, Out> = {\n spec,\n run: async (rawInput, ctx) => {\n const parseResult = spec.schema.safeParse(rawInput);\n if (!parseResult.success) {\n throw new EngramAccessInputError(formatZodIssues(parseResult.error));\n }\n return spec.handler(parseResult.data, ctx);\n },\n };\n // Store under the canonical name; the cast is safe because In/Out are\n // erased at the registry boundary and recovered by callers via getOperation.\n registry.set(spec.name, bound as unknown as BoundOperation);\n return bound;\n}\n\n/** Look up a registered operation by canonical name. */\nexport function getOperation(name: OperationName): BoundOperation | undefined {\n return registry.get(name);\n}\n\n/** All registered operation names. */\nexport function listRegisteredOperations(): readonly OperationName[] {\n return [...registry.keys()];\n}\n\n/** Test-only: clear the registry so pilot definitions can be re-registered. */\nexport function __resetRegistryForTest(): void {\n registry.clear();\n}\n"],"mappings":";;;;;;;;AAiBA,SAAS,SAAS;AA8MX,SAAS,kBAAkB,OAAqC;AACrE,MAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,GAAI,QAAO;AAClE,MAAI,OAAO,UAAU,UAAW,QAAO;AACvC,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,QAAQ,MAAM,KAAK,EAAE,YAAY;AACvC,QAAI,UAAU,UAAU,UAAU,OAAO,UAAU,SAAS,UAAU,KAAM,QAAO;AACnF,QAAI,UAAU,WAAW,UAAU,OAAO,UAAU,QAAQ,UAAU,MAAO,QAAO;AAAA,EACtF;AACA,QAAM,IAAI;AAAA,IACR,qEAAqE,KAAK,UAAU,KAAK,CAAC;AAAA,EAC5F;AACF;AAUO,SAAS,sBAAsB,OAAgB,OAAmC;AACvF,MAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,GAAI,QAAO;AAClE,MAAI,OAAO,UAAU,UAAU;AAC7B,QAAI,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,KAAK,CAAC,OAAO,UAAU,KAAK,GAAG;AACrE,YAAM,IAAI,uBAAuB,GAAG,KAAK,oCAAoC,KAAK,UAAU,KAAK,CAAC,EAAE;AAAA,IACtG;AACA,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,UAAU,MAAM,KAAK;AAC3B,QAAI,CAAC,aAAa,KAAK,OAAO,GAAG;AAC/B,YAAM,IAAI,uBAAuB,GAAG,KAAK,oCAAoC,KAAK,UAAU,KAAK,CAAC,EAAE;AAAA,IACtG;AACA,UAAM,SAAS,OAAO,OAAO;AAC7B,QAAI,CAAC,OAAO,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I,EAAE;AAAA,EAC/E;AACA,QAAM,QAAiC;AAAA,IACrC;AAAA,IACA,KAAK,OAAO,UAAU,QAAQ;AAC5B,YAAM,cAAc,KAAK,OAAO,UAAU,QAAQ;AAClD,UAAI,CAAC,YAAY,SAAS;AACxB,cAAM,IAAI,uBAAuB,gBAAgB,YAAY,KAAK,CAAC;AAAA,MACrE;AACA,aAAO,KAAK,QAAQ,YAAY,MAAM,GAAG;AAAA,IAC3C;AAAA,EACF;AAGA,WAAS,IAAI,KAAK,MAAM,KAAkC;AAC1D,SAAO;AACT;AAGO,SAAS,aAAa,MAAiD;AAC5E,SAAO,SAAS,IAAI,IAAI;AAC1B;AAGO,SAAS,2BAAqD;AACnE,SAAO,CAAC,GAAG,SAAS,KAAK,CAAC;AAC5B;AAGO,SAAS,yBAA+B;AAC7C,WAAS,MAAM;AACjB;","names":[]}
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-LMDRGRJ2.js";
12
12
  import {
13
13
  parseConfig
14
- } from "./chunk-WRGPE6AW.js";
14
+ } from "./chunk-3XHD3XGK.js";
15
15
  import {
16
16
  resolveObjectiveStateStoreDir,
17
17
  validateObjectiveStateSnapshot
@@ -268,4 +268,4 @@ export {
268
268
  recordResumeBundle,
269
269
  getResumeBundleStatus
270
270
  };
271
- //# sourceMappingURL=chunk-MOXFPLD6.js.map
271
+ //# sourceMappingURL=chunk-QXNFQKWU.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-ZBJMUXZH.js";
8
8
  import {
9
9
  StorageManager
10
- } from "./chunk-2VQYHHWB.js";
10
+ } from "./chunk-JSDZMOT7.js";
11
11
  import {
12
12
  getCachedEpisodeMap,
13
13
  setCachedEpisodeMap
@@ -107,4 +107,4 @@ export {
107
107
  compareVerifiedEpisodeResults,
108
108
  searchVerifiedEpisodes
109
109
  };
110
- //# sourceMappingURL=chunk-MRX6ZXHZ.js.map
110
+ //# sourceMappingURL=chunk-S6FQLQGH.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ZBJMUXZH.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-2VQYHHWB.js";
7
+ } from "./chunk-JSDZMOT7.js";
8
8
  import {
9
9
  getCachedRuleMemories,
10
10
  setCachedRuleMemories
@@ -117,4 +117,4 @@ export {
117
117
  compareVerifiedSemanticRuleResults,
118
118
  searchVerifiedSemanticRules
119
119
  };
120
- //# sourceMappingURL=chunk-6HPJMR5I.js.map
120
+ //# sourceMappingURL=chunk-SKQCFAYU.js.map
@@ -6,16 +6,17 @@ import {
6
6
  } from "./chunk-7WV3F5DQ.js";
7
7
  import {
8
8
  EngramMcpServer
9
- } from "./chunk-WSWYIKXX.js";
9
+ } from "./chunk-KOEKDZ6A.js";
10
10
  import {
11
11
  validateRequest
12
12
  } from "./chunk-NUWZFSKC.js";
13
13
  import {
14
14
  getOperation
15
- } from "./chunk-66TSLESZ.js";
15
+ } from "./chunk-PKE7EJMX.js";
16
16
  import {
17
+ CorrectionContractError,
17
18
  EngramAccessInputError
18
- } from "./chunk-STYMKPFT.js";
19
+ } from "./chunk-EVX52NCY.js";
19
20
  import {
20
21
  projectTagProjectId
21
22
  } from "./chunk-SHRRWOVY.js";
@@ -27,7 +28,7 @@ import {
27
28
  } from "./chunk-DEUNUKTD.js";
28
29
  import {
29
30
  isRecallDisclosure
30
- } from "./chunk-MLLTU5FX.js";
31
+ } from "./chunk-BOGENF7P.js";
31
32
  import {
32
33
  OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
33
34
  OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
@@ -209,7 +210,8 @@ var EngramAccessHttpServer = class {
209
210
  codingDecisionVisible: this.service.decisionRecordSurfaceVisible,
210
211
  architectureCardVisible: this.service.architectureCardSurfaceVisible,
211
212
  codegraphVisible: this.service.codegraphSurfaceVisible,
212
- sessionDeltaVisible: this.service.sessionDeltaSurfaceVisible
213
+ sessionDeltaVisible: this.service.sessionDeltaSurfaceVisible,
214
+ correctionVisible: this.service.correctionSurfaceVisible
213
215
  });
214
216
  }
215
217
  async start() {
@@ -232,6 +234,10 @@ var EngramAccessHttpServer = class {
232
234
  this.respondJson(res, 400, { error: err.message, code: "input_error" });
233
235
  return;
234
236
  }
237
+ if (err instanceof CorrectionContractError) {
238
+ this.respondJson(res, 400, { error: err.message, code: "correction_contract_error" });
239
+ return;
240
+ }
235
241
  if (res.headersSent) {
236
242
  res.destroy(err);
237
243
  return;
@@ -1050,6 +1056,47 @@ var EngramAccessHttpServer = class {
1050
1056
  this.respondJson(res, 200, output.result);
1051
1057
  return;
1052
1058
  }
1059
+ if (req.method === "POST" && pathname === "/engram/v1/correction/plan") {
1060
+ this.ensureWriteRateLimitAvailable();
1061
+ const body = await this.readJsonBody(req);
1062
+ const op = getOperation("memory_correct_plan");
1063
+ if (!op) {
1064
+ throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_plan");
1065
+ }
1066
+ const output = await op.run(body, {
1067
+ service: this.service,
1068
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
1069
+ });
1070
+ this.recordWriteRateLimitHit();
1071
+ this.respondJson(res, 200, output.result);
1072
+ return;
1073
+ }
1074
+ if (req.method === "POST" && pathname === "/engram/v1/correction/apply") {
1075
+ this.ensureWriteRateLimitAvailable();
1076
+ const body = await this.readJsonBody(req);
1077
+ const op = getOperation("memory_correct_apply");
1078
+ if (!op) {
1079
+ throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_apply");
1080
+ }
1081
+ const output = await op.run(body, {
1082
+ service: this.service,
1083
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
1084
+ });
1085
+ this.recordWriteRateLimitHit();
1086
+ this.respondJson(res, 200, output.result);
1087
+ return;
1088
+ }
1089
+ if (req.method === "GET" && pathname === "/engram/v1/correction/pending") {
1090
+ const namespace = parsed.searchParams.get("namespace") ?? void 0;
1091
+ const sessionKey = parsed.searchParams.get("sessionKey") ?? void 0;
1092
+ const plans = await this.service.correctionListPending({
1093
+ ...namespace ? { namespace } : {},
1094
+ ...sessionKey ? { sessionKey } : {},
1095
+ principal: this.resolveRequestPrincipal(req)
1096
+ });
1097
+ this.respondJson(res, 200, plans);
1098
+ return;
1099
+ }
1053
1100
  if (req.method === "POST" && pathname === "/engram/v1/suggestions") {
1054
1101
  void getOperation("suggestion_submit");
1055
1102
  const body = await this.readValidatedBody(req, "suggestionSubmit");
@@ -1913,7 +1960,7 @@ var EngramAccessHttpServer = class {
1913
1960
  ]);
1914
1961
  const isCodegraphManageAdr = toolName === "engram.codegraph_manage_adr" || toolName === "remnic.codegraph_manage_adr";
1915
1962
  const codegraphWrite = CODEGRAPH_WRITE_TOOLS.has(toolName) || isCodegraphManageAdr && (toolArgsSubcommand === "record" || toolArgsSubcommand === "supersede");
1916
- const isMcpWrite = request.method === "tools/call" && (toolName === "engram.memory_store" || toolName === "remnic.memory_store" || toolName === "engram.suggestion_submit" || toolName === "remnic.suggestion_submit" || toolName === "engram.observe" || toolName === "remnic.observe" || toolName === "engram.lcm_compaction_flush" || toolName === "remnic.lcm_compaction_flush" || toolName === "engram.lcm_compaction_record" || toolName === "remnic.lcm_compaction_record" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") || !memoryActionApplyDryRun && (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") || codingDecisionWrite || codingArchitectureWrite || codegraphWrite);
1963
+ const isMcpWrite = request.method === "tools/call" && (toolName === "engram.memory_store" || toolName === "remnic.memory_store" || toolName === "engram.suggestion_submit" || toolName === "remnic.suggestion_submit" || toolName === "engram.observe" || toolName === "remnic.observe" || toolName === "engram.lcm_compaction_flush" || toolName === "remnic.lcm_compaction_flush" || toolName === "engram.lcm_compaction_record" || toolName === "remnic.lcm_compaction_record" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") || !memoryActionApplyDryRun && (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") || (toolName === "engram.memory_correct_apply" || toolName === "remnic.memory_correct_apply" || toolName === "engram.memory_correct_plan" || toolName === "remnic.memory_correct_plan") || codingDecisionWrite || codingArchitectureWrite || codegraphWrite);
1917
1964
  if (isMcpWrite) {
1918
1965
  this.ensureWriteRateLimitAvailable();
1919
1966
  }
@@ -1935,7 +1982,8 @@ var EngramAccessHttpServer = class {
1935
1982
  const isError = result?.isError === true;
1936
1983
  const structured = result?.structuredContent;
1937
1984
  const isRejectedCodegraph = structured?.ok === false;
1938
- if (!isError && !isRejectedCodegraph && structured && this.shouldCountWriteRateLimit(structured)) {
1985
+ const counts = structured ? this.shouldCountWriteRateLimit(structured) : true;
1986
+ if (!isError && !isRejectedCodegraph && counts) {
1939
1987
  this.recordWriteRateLimitHit();
1940
1988
  }
1941
1989
  }
@@ -2302,4 +2350,4 @@ function positiveIntQueryParam(value, label) {
2302
2350
  export {
2303
2351
  EngramAccessHttpServer
2304
2352
  };
2305
- //# sourceMappingURL=chunk-EJDAXR7O.js.map
2353
+ //# sourceMappingURL=chunk-VWB3HDY6.js.map