@remnic/core 9.66.9 → 9.66.11

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 (204) hide show
  1. package/dist/access-admin-ops-surface.js +21 -20
  2. package/dist/access-authorization-probe.js +22 -21
  3. package/dist/access-boundary.js +21 -20
  4. package/dist/access-cli.js +87 -86
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-extraction-force-flush.js +21 -20
  7. package/dist/access-http-query.js +23 -22
  8. package/dist/access-http.js +38 -37
  9. package/dist/access-identity-continuity-surface.js +21 -20
  10. package/dist/access-lcm-surface.js +21 -20
  11. package/dist/access-mcp.js +30 -29
  12. package/dist/access-namespace-preflight.js +21 -20
  13. package/dist/access-observe-write-surface.js +21 -20
  14. package/dist/access-operations-batch.js +24 -23
  15. package/dist/access-operations.js +29 -28
  16. package/dist/access-recall-concurrency.js +21 -20
  17. package/dist/access-recall-response.js +21 -20
  18. package/dist/access-recall-surface.js +21 -20
  19. package/dist/access-schema.js +3 -3
  20. package/dist/access-service.js +21 -20
  21. package/dist/access-surface-catalog.js +23 -22
  22. package/dist/access-surface-catalog.js.map +1 -1
  23. package/dist/adapters/index.js +4 -4
  24. package/dist/adapters/registry.js +2 -2
  25. package/dist/briefing.js +8 -8
  26. package/dist/causal-consolidation.js +10 -9
  27. package/dist/causal-consolidation.js.map +1 -1
  28. package/dist/{chunk-5GZ6UWY5.js → chunk-245QROHZ.js} +5 -5
  29. package/dist/{chunk-A7GQBJP5.js → chunk-2L5FSNPC.js} +10 -10
  30. package/dist/{chunk-SJ5L4ZZX.js → chunk-2OXBS2LV.js} +2 -2
  31. package/dist/chunk-3UXOZBHV.js +20 -0
  32. package/dist/chunk-3UXOZBHV.js.map +1 -0
  33. package/dist/{chunk-G775FE2E.js → chunk-4PHT7KE2.js} +11 -11
  34. package/dist/{chunk-TKSBOV7N.js → chunk-4PWANX5V.js} +6 -6
  35. package/dist/{chunk-TEJKBBWS.js → chunk-4QKWBVEE.js} +11 -11
  36. package/dist/{chunk-MFI4QPW5.js → chunk-54BRW3BL.js} +2 -2
  37. package/dist/{chunk-23F7HGBV.js → chunk-5E7KXID5.js} +1 -1
  38. package/dist/{chunk-VX5YHEGJ.js → chunk-6H7JWYTC.js} +17 -12
  39. package/dist/chunk-6H7JWYTC.js.map +1 -0
  40. package/dist/{chunk-5CSKIWEB.js → chunk-7BS5UVXA.js} +3 -3
  41. package/dist/{chunk-Q5YKVBIV.js → chunk-7FLINMUE.js} +2 -2
  42. package/dist/{chunk-ZC5L6ME2.js → chunk-7MOYAT4Y.js} +3 -3
  43. package/dist/{chunk-NABJLNLU.js → chunk-BCM6ZAJ3.js} +190 -52
  44. package/dist/chunk-BCM6ZAJ3.js.map +1 -0
  45. package/dist/{chunk-KVXMN33W.js → chunk-C6TMLF3A.js} +4 -4
  46. package/dist/{chunk-47BX23NA.js → chunk-D3AUQXTJ.js} +2 -2
  47. package/dist/{chunk-3HHLOKKU.js → chunk-DJLH3XWM.js} +2 -2
  48. package/dist/{chunk-SRILZVR4.js → chunk-E2PORO7O.js} +2 -2
  49. package/dist/{chunk-G3TUQJFU.js → chunk-E62M4H4M.js} +2 -2
  50. package/dist/{chunk-GB4R6B5M.js → chunk-EG4FHU5C.js} +2 -2
  51. package/dist/{chunk-QU2V4IO3.js → chunk-EMAEDM2J.js} +2 -2
  52. package/dist/{chunk-FNYVWAIK.js → chunk-G3B3LP6A.js} +18 -18
  53. package/dist/{chunk-D6Q5EPOV.js → chunk-HCERYDRI.js} +2 -2
  54. package/dist/{chunk-5NZIRM4Q.js → chunk-HJQZQUPC.js} +7 -7
  55. package/dist/{chunk-CIWOW2FH.js → chunk-HPGXB56F.js} +2 -2
  56. package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
  57. package/dist/{chunk-UAWSKMWQ.js → chunk-ISX7JODR.js} +2 -2
  58. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  59. package/dist/{chunk-HWWGPS2N.js → chunk-JNZSNJ43.js} +2 -2
  60. package/dist/{chunk-JHU543UU.js → chunk-K6PWPC7O.js} +2 -2
  61. package/dist/{chunk-JVGBDNXA.js → chunk-KT3ERTF6.js} +2 -2
  62. package/dist/{chunk-SOQLXIQX.js → chunk-KWLDB64F.js} +2 -2
  63. package/dist/{chunk-7JPKRZD5.js → chunk-LPSTQR26.js} +2 -2
  64. package/dist/{chunk-OT7WQ2I3.js → chunk-LTWFU6VJ.js} +2 -2
  65. package/dist/{chunk-NSP3HFJZ.js → chunk-PVV42HM4.js} +6 -3
  66. package/dist/chunk-PVV42HM4.js.map +1 -0
  67. package/dist/{chunk-TWMGWLHD.js → chunk-PWVRMD37.js} +2 -2
  68. package/dist/{chunk-AAJK3PZ6.js → chunk-QB66LBXA.js} +2 -2
  69. package/dist/{chunk-XVNDP3RO.js → chunk-QKTGCL6M.js} +2 -2
  70. package/dist/{chunk-LTDN5WYF.js → chunk-S47XNAWD.js} +2 -2
  71. package/dist/{chunk-IBHUZEKL.js → chunk-SQEIPTDV.js} +2 -2
  72. package/dist/{chunk-J67E4JNT.js → chunk-TGKLVAML.js} +2 -2
  73. package/dist/{chunk-VCYY7XEL.js → chunk-TS37MXC7.js} +2 -2
  74. package/dist/{chunk-ZJGHOPEO.js → chunk-UWOA5L6N.js} +70 -73
  75. package/dist/{chunk-ZJGHOPEO.js.map → chunk-UWOA5L6N.js.map} +1 -1
  76. package/dist/{chunk-ZVUGRXSY.js → chunk-WD424KYT.js} +2 -2
  77. package/dist/{chunk-B3TZLAO4.js → chunk-X5SDZMO7.js} +2 -2
  78. package/dist/{chunk-FUPIAP6Q.js → chunk-XN33JLRF.js} +3 -3
  79. package/dist/{chunk-MBDUNO7J.js → chunk-XZ7QLOTJ.js} +5 -21
  80. package/dist/chunk-XZ7QLOTJ.js.map +1 -0
  81. package/dist/{chunk-OJSCH7QT.js → chunk-Y2ECPAJI.js} +7 -7
  82. package/dist/{chunk-DGKVUPBM.js → chunk-Y6KDJQLK.js} +7 -7
  83. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  84. package/dist/{chunk-Q3UMNZRK.js → chunk-ZIGSNLYI.js} +3 -3
  85. package/dist/{chunk-RF3LMSQW.js → chunk-ZRQPX2DW.js} +2 -2
  86. package/dist/cli.js +61 -60
  87. package/dist/coding/export-okf-codegraph.js +8 -8
  88. package/dist/compounding/engine.js +8 -8
  89. package/dist/connectors/codex-materialize-runner.js +9 -8
  90. package/dist/connectors/index.js +9 -8
  91. package/dist/convergence-refresh.js +10 -10
  92. package/dist/corpus-watermark.js +10 -10
  93. package/dist/dashboard-runtime.js +2 -2
  94. package/dist/entity-retrieval.js +8 -8
  95. package/dist/external-wiki-access.js +22 -21
  96. package/dist/extraction-span-tokens.d.ts +16 -0
  97. package/dist/extraction-span-tokens.js +34 -0
  98. package/dist/extraction-span-tokens.js.map +1 -0
  99. package/dist/extraction.js +9 -8
  100. package/dist/{first-start-migration-UG32BSG2.js → first-start-migration-KHIMCBIC.js} +4 -4
  101. package/dist/harmonic-retrieval.js +1 -1
  102. package/dist/index.d.ts +102 -1
  103. package/dist/index.js +126 -117
  104. package/dist/lcm/engine.js +4 -4
  105. package/dist/lcm/index.js +9 -9
  106. package/dist/location/index.js +10 -10
  107. package/dist/maintenance/memory-governance.js +8 -8
  108. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +8 -8
  109. package/dist/maintenance/rebuild-memory-projection.js +9 -9
  110. package/dist/namespaces/migrate.js +9 -9
  111. package/dist/namespaces/search.js +4 -4
  112. package/dist/namespaces/storage.js +8 -8
  113. package/dist/operator-doctor-corpus.js +11 -11
  114. package/dist/operator-toolkit.js +16 -16
  115. package/dist/orchestration/maintenance.js +16 -16
  116. package/dist/orchestrator.js +88 -87
  117. package/dist/recall-deep-frontier.d.ts +15 -0
  118. package/dist/recall-deep-frontier.js +29 -0
  119. package/dist/recall-deep-frontier.js.map +1 -0
  120. package/dist/search/factory.js +3 -3
  121. package/dist/search/index.js +7 -7
  122. package/dist/semantic-consolidation.js +10 -9
  123. package/dist/semantic-rule-promotion.js +8 -8
  124. package/dist/semantic-rule-verifier.js +8 -8
  125. package/dist/source-agent-qualifier.js +9 -8
  126. package/dist/standup/build.js +8 -8
  127. package/dist/storage.js +7 -7
  128. package/dist/support-passport/index.js +24 -23
  129. package/dist/transfer/autodetect.js +1 -1
  130. package/dist/transfer/backup.js +1 -1
  131. package/dist/transfer/capsule-export.js +2 -2
  132. package/dist/transfer/export-okf.d.ts +8 -0
  133. package/dist/transfer/export-okf.js +10 -9
  134. package/dist/verified-recall.js +8 -8
  135. package/dist/who-knows-cli.js +9 -9
  136. package/dist/who-knows.js +8 -8
  137. package/package.json +2 -2
  138. package/src/activity/index.ts +2 -0
  139. package/src/activity/privacy-status.test.ts +117 -0
  140. package/src/activity/privacy-status.ts +65 -0
  141. package/src/activity/timeline/index.ts +1 -0
  142. package/src/activity/timeline/week-previous.test.ts +119 -0
  143. package/src/activity/timeline/week-previous.ts +83 -0
  144. package/src/activity/vault-insert.test.ts +105 -0
  145. package/src/activity/vault-insert.ts +86 -0
  146. package/src/cli/okf-commands.ts +2 -5
  147. package/src/extraction-span-tokens.test.ts +69 -0
  148. package/src/extraction-span-tokens.ts +44 -0
  149. package/src/okf/render.ts +11 -2
  150. package/src/recall-deep-frontier.test.ts +85 -0
  151. package/src/recall-deep-frontier.ts +39 -0
  152. package/src/transfer/export-okf.test.ts +77 -1
  153. package/src/transfer/export-okf.ts +25 -9
  154. package/dist/chunk-MBDUNO7J.js.map +0 -1
  155. package/dist/chunk-NABJLNLU.js.map +0 -1
  156. package/dist/chunk-NSP3HFJZ.js.map +0 -1
  157. package/dist/chunk-VX5YHEGJ.js.map +0 -1
  158. /package/dist/{chunk-5GZ6UWY5.js.map → chunk-245QROHZ.js.map} +0 -0
  159. /package/dist/{chunk-A7GQBJP5.js.map → chunk-2L5FSNPC.js.map} +0 -0
  160. /package/dist/{chunk-SJ5L4ZZX.js.map → chunk-2OXBS2LV.js.map} +0 -0
  161. /package/dist/{chunk-G775FE2E.js.map → chunk-4PHT7KE2.js.map} +0 -0
  162. /package/dist/{chunk-TKSBOV7N.js.map → chunk-4PWANX5V.js.map} +0 -0
  163. /package/dist/{chunk-TEJKBBWS.js.map → chunk-4QKWBVEE.js.map} +0 -0
  164. /package/dist/{chunk-MFI4QPW5.js.map → chunk-54BRW3BL.js.map} +0 -0
  165. /package/dist/{chunk-23F7HGBV.js.map → chunk-5E7KXID5.js.map} +0 -0
  166. /package/dist/{chunk-5CSKIWEB.js.map → chunk-7BS5UVXA.js.map} +0 -0
  167. /package/dist/{chunk-Q5YKVBIV.js.map → chunk-7FLINMUE.js.map} +0 -0
  168. /package/dist/{chunk-ZC5L6ME2.js.map → chunk-7MOYAT4Y.js.map} +0 -0
  169. /package/dist/{chunk-KVXMN33W.js.map → chunk-C6TMLF3A.js.map} +0 -0
  170. /package/dist/{chunk-47BX23NA.js.map → chunk-D3AUQXTJ.js.map} +0 -0
  171. /package/dist/{chunk-3HHLOKKU.js.map → chunk-DJLH3XWM.js.map} +0 -0
  172. /package/dist/{chunk-SRILZVR4.js.map → chunk-E2PORO7O.js.map} +0 -0
  173. /package/dist/{chunk-G3TUQJFU.js.map → chunk-E62M4H4M.js.map} +0 -0
  174. /package/dist/{chunk-GB4R6B5M.js.map → chunk-EG4FHU5C.js.map} +0 -0
  175. /package/dist/{chunk-QU2V4IO3.js.map → chunk-EMAEDM2J.js.map} +0 -0
  176. /package/dist/{chunk-FNYVWAIK.js.map → chunk-G3B3LP6A.js.map} +0 -0
  177. /package/dist/{chunk-D6Q5EPOV.js.map → chunk-HCERYDRI.js.map} +0 -0
  178. /package/dist/{chunk-5NZIRM4Q.js.map → chunk-HJQZQUPC.js.map} +0 -0
  179. /package/dist/{chunk-CIWOW2FH.js.map → chunk-HPGXB56F.js.map} +0 -0
  180. /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
  181. /package/dist/{chunk-UAWSKMWQ.js.map → chunk-ISX7JODR.js.map} +0 -0
  182. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  183. /package/dist/{chunk-HWWGPS2N.js.map → chunk-JNZSNJ43.js.map} +0 -0
  184. /package/dist/{chunk-JHU543UU.js.map → chunk-K6PWPC7O.js.map} +0 -0
  185. /package/dist/{chunk-JVGBDNXA.js.map → chunk-KT3ERTF6.js.map} +0 -0
  186. /package/dist/{chunk-SOQLXIQX.js.map → chunk-KWLDB64F.js.map} +0 -0
  187. /package/dist/{chunk-7JPKRZD5.js.map → chunk-LPSTQR26.js.map} +0 -0
  188. /package/dist/{chunk-OT7WQ2I3.js.map → chunk-LTWFU6VJ.js.map} +0 -0
  189. /package/dist/{chunk-TWMGWLHD.js.map → chunk-PWVRMD37.js.map} +0 -0
  190. /package/dist/{chunk-AAJK3PZ6.js.map → chunk-QB66LBXA.js.map} +0 -0
  191. /package/dist/{chunk-XVNDP3RO.js.map → chunk-QKTGCL6M.js.map} +0 -0
  192. /package/dist/{chunk-LTDN5WYF.js.map → chunk-S47XNAWD.js.map} +0 -0
  193. /package/dist/{chunk-IBHUZEKL.js.map → chunk-SQEIPTDV.js.map} +0 -0
  194. /package/dist/{chunk-J67E4JNT.js.map → chunk-TGKLVAML.js.map} +0 -0
  195. /package/dist/{chunk-VCYY7XEL.js.map → chunk-TS37MXC7.js.map} +0 -0
  196. /package/dist/{chunk-ZVUGRXSY.js.map → chunk-WD424KYT.js.map} +0 -0
  197. /package/dist/{chunk-B3TZLAO4.js.map → chunk-X5SDZMO7.js.map} +0 -0
  198. /package/dist/{chunk-FUPIAP6Q.js.map → chunk-XN33JLRF.js.map} +0 -0
  199. /package/dist/{chunk-OJSCH7QT.js.map → chunk-Y2ECPAJI.js.map} +0 -0
  200. /package/dist/{chunk-DGKVUPBM.js.map → chunk-Y6KDJQLK.js.map} +0 -0
  201. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
  202. /package/dist/{chunk-Q3UMNZRK.js.map → chunk-ZIGSNLYI.js.map} +0 -0
  203. /package/dist/{chunk-RF3LMSQW.js.map → chunk-ZRQPX2DW.js.map} +0 -0
  204. /package/dist/{first-start-migration-UG32BSG2.js.map → first-start-migration-KHIMCBIC.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/access-surface-catalog.ts"],"sourcesContent":["/**\n * Static inventory of every handler on the MCP and HTTP access surfaces, with\n * its migration status against the access boundary (issue #1525).\n *\n * The fitness test (`access-surface-catalog.test.ts`) walks this catalog,\n * checks each entry against the live registry, and counts unmigrated handlers.\n * The ratchet (`scripts/check-ratchets.mjs`) reads this file and counts\n * `operation: null` entries so the unmigrated count can only decrease.\n *\n * WHEN MIGRATING A HANDLER (follow-up PRs):\n * 1. Add the operation to `access-operations.ts` via `defineOperation`.\n * 2. Flip its entry here from `operation: null` to `operation: \"<name>\"`.\n * 3. Delete the surface-local validation the handler used to do.\n * 4. Run `node scripts/check-ratchets.mjs --update` to ratchet the count\n * down — the improvement is recorded in `scripts/ratchet-baseline.json`.\n *\n * WHEN ADDING A NEW HANDLER:\n * 1. Add the entry here with `operation: null` (the fitness test will fail\n * until you either migrate it or acknowledge it as unmigrated).\n * 2. Migrate it in the same PR if it carries user input — the boundary's\n * whole point is that no new handler bypasses it.\n */\n\nimport type { OperationName } from \"./access-boundary.js\";\nimport { SUPPORT_PASSPORT_OWNER_HTTP_ROUTES } from \"./support-passport/access-http.js\";\nimport { SUPPORT_PASSPORT_PUBLIC_HTTP_ROUTES } from \"./support-passport/public-http.js\";\n\n/**\n * One row per MCP tool, keyed by the canonical SHORT name (no `engram.`/\n * `remnic.` prefix — both aliases dispatch to the same operation). The name\n * MUST match the tool's short suffix as advertised by `tools/list`.\n */\nexport interface McpToolEntry {\n readonly tool: string;\n readonly operation: OperationName | null;\n}\n\n/**\n * One row per HTTP route that invokes an access-service method. Routes that\n * only serve static assets, SSE streams, or admin console HTML are excluded —\n * they don't carry user-validated request envelopes into the facade.\n */\nexport interface HttpRouteEntry {\n readonly method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n readonly pathname: string;\n readonly operation: OperationName | null;\n}\n\n// Each tool below corresponds 1:1 to an `engram.*` definition in\n// `EngramMcpServer.tools` (access-mcp.ts). The fitness test asserts the live\n// `tools/list` response matches this list by short name, so a new tool cannot\n// land without either migrating it or acknowledging the unmigrated count.\nexport const MCP_TOOLS: readonly McpToolEntry[] = [\n { tool: \"recall\", operation: \"recall\" },\n { tool: \"recall_explain\", operation: \"recall_explain\" },\n { tool: \"set_coding_context\", operation: \"set_coding_context\" },\n { tool: \"recall_tier_explain\", operation: \"recall_tier_explain\" },\n { tool: \"recall_xray\", operation: \"recall_xray\" },\n { tool: \"who_knows\", operation: \"who_knows\" },\n { tool: \"promotion_candidates\", operation: \"promotion_candidates\" },\n { tool: \"wearables_status\", operation: \"wearables_status\" },\n { tool: \"wearables_sync\", operation: \"wearables_sync\" },\n { tool: \"transcript_day\", operation: \"transcript_day\" },\n { tool: \"transcript_search\", operation: \"transcript_search\" },\n { tool: \"transcript_memories\", operation: \"transcript_memories\" },\n { tool: \"location_status\", operation: \"location_status\" },\n { tool: \"location_check\", operation: \"location_check\" },\n { tool: \"location_sync\", operation: \"location_sync\" },\n { tool: \"location_backfill\", operation: \"location_backfill\" },\n { tool: \"location_day\", operation: \"location_day\" },\n { tool: \"meetings_list\", operation: \"meetings_list\" },\n { tool: \"meetings_get\", operation: \"meetings_get\" },\n { tool: \"meetings_build\", operation: \"meetings_build\" },\n { tool: \"standup\", operation: \"standup\" },\n { tool: \"action_confidence\", operation: \"action_confidence\" },\n { tool: \"chatgpt_memory_inspector\", operation: \"chatgpt_memory_inspector\" },\n { tool: \"day_summary\", operation: \"day_summary\" },\n { tool: \"capsule_export\", operation: \"capsule_export\" },\n { tool: \"capsule_import\", operation: \"capsule_import\" },\n { tool: \"capsule_list\", operation: \"capsule_list\" },\n { tool: \"memory_governance_run\", operation: \"memory_governance_run\" },\n { tool: \"entity_synthesis_run\", operation: \"entity_synthesis_run\" },\n { tool: \"procedure_mining_run\", operation: \"procedure_mining_run\" },\n { tool: \"pattern_reinforcement_run\", operation: \"pattern_reinforcement_run\" },\n { tool: \"procedural_stats\", operation: \"procedural_stats\" },\n { tool: \"procedure_library_maintenance\", operation: \"procedure_library_maintenance\" },\n { tool: \"memory_get\", operation: \"memory_get\" },\n { tool: \"memory_timeline\", operation: \"memory_timeline\" },\n { tool: \"memory_store\", operation: \"memory_store\" },\n // Correction Contract (issue #1580) — one plan/apply pipeline.\n { tool: \"memory_correct_plan\", operation: \"memory_correct_plan\" },\n { tool: \"memory_correct_apply\", operation: \"memory_correct_apply\" },\n // Conversational memory inspection + correction (issue #1583) — unmigrated\n // handler dispatched to processChatMessage (not a boundary operation).\n { tool: \"memory_chat\", operation: \"chat_message\" },\n { tool: \"coding_decision\", operation: \"coding_decision\" },\n { tool: \"coding_architecture\", operation: \"coding_architecture\" },\n // codegraph parity tools (issue #1554)\n { tool: \"codegraph_index\", operation: \"codegraph_index\" },\n { tool: \"codegraph_list_projects\", operation: \"codegraph_list_projects\" },\n { tool: \"codegraph_delete_project\", operation: \"codegraph_delete_project\" },\n { tool: \"codegraph_index_status\", operation: \"codegraph_index_status\" },\n { tool: \"codegraph_search_graph\", operation: \"codegraph_search_graph\" },\n { tool: \"codegraph_trace_path\", operation: \"codegraph_trace_path\" },\n { tool: \"codegraph_detect_changes\", operation: \"codegraph_detect_changes\" },\n { tool: \"codegraph_query_graph\", operation: \"codegraph_query_graph\" },\n { tool: \"codegraph_get_schema\", operation: \"codegraph_get_schema\" },\n { tool: \"codegraph_get_snippet\", operation: \"codegraph_get_snippet\" },\n { tool: \"codegraph_get_architecture\", operation: \"codegraph_get_architecture\" },\n { tool: \"codegraph_search_code\", operation: \"codegraph_search_code\" },\n { tool: \"codegraph_manage_adr\", operation: \"codegraph_manage_adr\" },\n { tool: \"codegraph_ingest_traces\", operation: \"codegraph_ingest_traces\" },\n { tool: \"coding_delta\", operation: \"coding_delta\" },\n { tool: \"suggestion_submit\", operation: \"suggestion_submit\" },\n { tool: \"entity_get\", operation: \"entity_get\" },\n { tool: \"review_queue_list\", operation: \"review_queue_list\" },\n { tool: \"observe\", operation: \"observe\" },\n { tool: \"lcm_search\", operation: \"lcm_search\" },\n { tool: \"lcm_compaction_flush\", operation: \"lcm_compaction_flush\" },\n { tool: \"extraction_force_flush\", operation: \"extraction_force_flush\" },\n { tool: \"lcm_compaction_record\", operation: \"lcm_compaction_record\" },\n { tool: \"continuity_audit_generate\", operation: \"continuity_audit_generate\" },\n { tool: \"continuity_incident_open\", operation: \"continuity_incident_open\" },\n { tool: \"continuity_incident_close\", operation: \"continuity_incident_close\" },\n { tool: \"continuity_incident_list\", operation: \"continuity_incident_list\" },\n { tool: \"continuity_loop_add_or_update\", operation: \"continuity_loop_add_or_update\" },\n { tool: \"continuity_loop_review\", operation: \"continuity_loop_review\" },\n { tool: \"identity_anchor_get\", operation: \"identity_anchor_get\" },\n { tool: \"identity_anchor_update\", operation: \"identity_anchor_update\" },\n { tool: \"memory_identity\", operation: \"memory_identity\" },\n { tool: \"work_task\", operation: \"work_task\" },\n { tool: \"work_project\", operation: \"work_project\" },\n { tool: \"work_board\", operation: \"work_board\" },\n { tool: \"shared_context_write_output\", operation: \"shared_context_write_output\" },\n { tool: \"shared_feedback_record\", operation: \"shared_feedback_record\" },\n { tool: \"shared_priorities_append\", operation: \"shared_priorities_append\" },\n { tool: \"shared_context_cross_signals_run\", operation: \"shared_context_cross_signals_run\" },\n { tool: \"shared_context_curate_daily\", operation: \"shared_context_curate_daily\" },\n { tool: \"compounding_weekly_synthesize\", operation: \"compounding_weekly_synthesize\" },\n { tool: \"compounding_promote_candidate\", operation: \"compounding_promote_candidate\" },\n { tool: \"compression_guidelines_optimize\", operation: \"compression_guidelines_optimize\" },\n { tool: \"compression_guidelines_activate\", operation: \"compression_guidelines_activate\" },\n { tool: \"memory_search\", operation: \"memory_search\" },\n { tool: \"external_wiki_search\", operation: \"external_wiki_search\" },\n { tool: \"memory_profile\", operation: \"memory_profile\" },\n { tool: \"memory_entities_list\", operation: \"memory_entities_list\" },\n { tool: \"memory_questions\", operation: \"memory_questions\" },\n { tool: \"memory_last_recall\", operation: \"memory_last_recall\" },\n { tool: \"memory_intent_debug\", operation: \"memory_intent_debug\" },\n { tool: \"memory_qmd_debug\", operation: \"memory_qmd_debug\" },\n { tool: \"memory_graph_explain\", operation: \"memory_graph_explain\" },\n { tool: \"graph_snapshot\", operation: \"graph_snapshot\" },\n { tool: \"memory_feedback\", operation: \"memory_feedback\" },\n { tool: \"memory_promote\", operation: \"memory_promote\" },\n { tool: \"memory_outcome\", operation: \"memory_outcome\" },\n { tool: \"memory_action_apply\", operation: \"memory_action_apply\" },\n { tool: \"context_checkpoint\", operation: \"context_checkpoint\" },\n { tool: \"briefing\", operation: \"briefing\" },\n { tool: \"review_list\", operation: \"review_list\" },\n { tool: \"review_resolve\", operation: \"review_resolve\" },\n { tool: \"contradiction_scan_run\", operation: \"contradiction_scan_run\" },\n { tool: \"preference_drift_scan\", operation: \"preference_drift_scan\" },\n { tool: \"memory_summarize_hourly\", operation: \"memory_summarize_hourly\" },\n { tool: \"conversation_index_update\", operation: \"conversation_index_update\" },\n { tool: \"profiling_report\", operation: \"profiling_report\" },\n { tool: \"graph_edge_decay_run\", operation: \"graph_edge_decay_run\" },\n { tool: \"live_connectors_run\", operation: \"live_connectors_run\" },\n { tool: \"peer_list\", operation: \"peer_list\" },\n { tool: \"peer_get\", operation: \"peer_get\" },\n { tool: \"peer_set\", operation: \"peer_set\" },\n { tool: \"peer_delete\", operation: \"peer_delete\" },\n { tool: \"peer_profile_get\", operation: \"peer_profile_get\" },\n { tool: \"peer_forget\", operation: \"peer_forget\" },\n { tool: \"console_state\", operation: \"console_state\" },\n { tool: \"dreams_status\", operation: \"dreams_status\" },\n { tool: \"dreams_run\", operation: \"dreams_run\" },\n { tool: \"support_passport_memory_preview\", operation: \"support_passport_memory_preview\" },\n { tool: \"support_passport_cards_list\", operation: \"support_passport_cards_list\" },\n { tool: \"support_passport_draft_create\", operation: \"support_passport_draft_create\" },\n { tool: \"support_passport_drafts_generate\", operation: \"support_passport_drafts_generate\" },\n { tool: \"support_passport_card_replace\", operation: \"support_passport_card_replace\" },\n { tool: \"support_passport_card_approve\", operation: \"support_passport_card_approve\" },\n { tool: \"support_passport_card_reject\", operation: \"support_passport_card_reject\" },\n { tool: \"support_passport_card_withdraw\", operation: \"support_passport_card_withdraw\" },\n { tool: \"support_passport_grant_create\", operation: \"support_passport_grant_create\" },\n { tool: \"support_passport_grants_list\", operation: \"support_passport_grants_list\" },\n { tool: \"support_passport_grant_revoke\", operation: \"support_passport_grant_revoke\" },\n];\n\n// Each route below corresponds 1:1 to a service-invoking route branch in\n// `EngramAccessHttpServer.handle` (access-http.ts). Pathname patterns use\n// `:param` for path segments. The fitness test asserts each entry resolves\n// against the catalog so a new service route cannot land without either\n// Infrastructure routes (health, the /mcp delegate, admin console, UI assets)\n// carry no user request envelope and are intentionally excluded. The adapters\n// route was migrated through the boundary in issue #1850 round 5 (finding 1):\n// it is now op-gated by `enforceTokenOp(\"adapters_status\")` so a scoped token\n// cannot reach adapter metadata, and is tracked here so the gate is enforced.\nexport const HTTP_ROUTES: readonly HttpRouteEntry[] = [\n { method: \"GET\", pathname: \"/engram/v1/adapters\", operation: \"adapters_status\" },\n { method: \"POST\", pathname: \"/engram/v1/recall\", operation: \"recall\" },\n { method: \"POST\", pathname: \"/engram/v1/external-wikis/search\", operation: \"external_wiki_search\" },\n { method: \"POST\", pathname: \"/engram/v1/memories/search\", operation: \"memory_search\" },\n { method: \"POST\", pathname: \"/engram/v1/coding-context\", operation: \"set_coding_context\" },\n { method: \"POST\", pathname: \"/engram/v1/capsules/export\", operation: \"capsule_export\" },\n { method: \"POST\", pathname: \"/engram/v1/capsules/import\", operation: \"capsule_import\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/snapshot\", operation: \"offline_sync_snapshot\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/capabilities\", operation: \"offline_sync_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/snapshot\", operation: \"offline_sync_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/files\", operation: \"offline_sync_files\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/file-content\", operation: \"offline_sync_file_content\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/apply-file-content\", operation: \"offline_sync_apply_file_content\" },\n {\n method: \"POST\",\n pathname: \"/engram/v1/offline-sync/convergence-complete\",\n operation: \"offline_sync_apply_file_content\",\n },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/apply\", operation: \"offline_sync_apply\" },\n { method: \"POST\", pathname: \"/engram/v1/recall/explain\", operation: \"recall_explain\" },\n { method: \"POST\", pathname: \"/engram/v1/action-confidence\", operation: \"action_confidence\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/tier-explain\", operation: \"recall_tier_explain\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/xray\", operation: \"recall_xray\" },\n { method: \"GET\", pathname: \"/engram/v1/who-knows\", operation: \"who_knows\" },\n { method: \"GET\", pathname: \"/engram/v1/namespace/writable\", operation: \"namespace_writable\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/status\", operation: \"wearables_status\" },\n { method: \"POST\", pathname: \"/engram/v1/wearables/sync\", operation: \"wearables_sync\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/transcript\", operation: \"transcript_day\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/transcripts/search\", operation: \"transcript_search\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/memories\", operation: \"transcript_memories\" },\n { method: \"GET\", pathname: \"/engram/v1/location/status\", operation: \"location_status\" },\n { method: \"GET\", pathname: \"/engram/v1/location/check\", operation: \"location_check\" },\n { method: \"POST\", pathname: \"/engram/v1/location/sync\", operation: \"location_sync\" },\n { method: \"POST\", pathname: \"/engram/v1/location/backfill\", operation: \"location_backfill\" },\n { method: \"GET\", pathname: \"/engram/v1/location/day\", operation: \"location_day\" },\n { method: \"GET\", pathname: \"/engram/v1/meetings\", operation: \"meetings_list\" },\n { method: \"POST\", pathname: \"/engram/v1/meetings/build\", operation: \"meetings_build\" },\n { method: \"GET\", pathname: \"/engram/v1/meetings/:id\", operation: \"meetings_get\" },\n { method: \"GET\", pathname: \"/engram/v1/standup\", operation: \"standup\" },\n { method: \"POST\", pathname: \"/engram/v1/observe\", operation: \"observe\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/search\", operation: \"lcm_search\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/compaction/flush\", operation: \"lcm_compaction_flush\" },\n { method: \"POST\", pathname: \"/engram/v1/extraction/flush\", operation: \"extraction_force_flush\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/compaction/record\", operation: \"lcm_compaction_record\" },\n { method: \"GET\", pathname: \"/engram/v1/lcm/status\", operation: \"lcm_status\" },\n { method: \"GET\", pathname: \"/engram/v1/relay/missions/:id\", operation: \"relay_mission_read\" },\n { method: \"POST\", pathname: \"/engram/v1/relay/missions/:id/events\", operation: \"relay_mission_append\" },\n // Correction Contract (issue #1580) — plan/apply/pending.\n { method: \"POST\", pathname: \"/engram/v1/correction/plan\", operation: \"memory_correct_plan\" },\n { method: \"POST\", pathname: \"/engram/v1/correction/apply\", operation: \"memory_correct_apply\" },\n { method: \"GET\", pathname: \"/engram/v1/correction/pending\", operation: \"correction_pending\" },\n { method: \"POST\", pathname: \"/engram/v1/memories\", operation: \"memory_store\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/decisions\", operation: \"coding_decision\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/architecture\", operation: \"coding_architecture\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/delta\", operation: \"coding_delta\" },\n { method: \"POST\", pathname: \"/engram/v1/suggestions\", operation: \"suggestion_submit\" },\n { method: \"GET\", pathname: \"/engram/v1/memories\", operation: \"memory_list\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/timings\", operation: \"recall_timings\" },\n { method: \"GET\", pathname: \"/engram/v1/memories/:id\", operation: \"memory_get\" },\n { method: \"GET\", pathname: \"/engram/v1/memories/:id/timeline\", operation: \"memory_timeline\" },\n { method: \"GET\", pathname: \"/engram/v1/entities\", operation: \"entity_list\" },\n { method: \"GET\", pathname: \"/engram/v1/entities/:id\", operation: \"entity_get\" },\n { method: \"GET\", pathname: \"/engram/v1/review-queue\", operation: \"review_queue_list\" },\n { method: \"GET\", pathname: \"/engram/v1/maintenance\", operation: \"maintenance_status\" },\n { method: \"GET\", pathname: \"/engram/v1/quality\", operation: \"quality_status\" },\n { method: \"GET\", pathname: \"/engram/v1/trust-zones/status\", operation: \"trust_zones_status\" },\n { method: \"GET\", pathname: \"/engram/v1/procedural/stats\", operation: \"procedural_stats\" },\n { method: \"GET\", pathname: \"/engram/v1/trust-zones/records\", operation: \"trust_zones_records\" },\n { method: \"POST\", pathname: \"/engram/v1/review-disposition\", operation: \"review_disposition\" },\n { method: \"GET\", pathname: \"/engram/v1/review/deck\", operation: \"review_deck_list\" },\n { method: \"POST\", pathname: \"/engram/v1/review/deck/action\", operation: \"review_deck_action\" },\n { method: \"POST\", pathname: \"/engram/v1/review/deck/undo\", operation: \"review_deck_undo\" },\n { method: \"POST\", pathname: \"/engram/v1/trust-zones/promote\", operation: \"trust_zones_promote\" },\n { method: \"POST\", pathname: \"/engram/v1/trust-zones/demo-seed\", operation: \"trust_zones_demo_seed\" },\n { method: \"POST\", pathname: \"/v1/citations/observed\", operation: \"citations_observed\" },\n { method: \"GET\", pathname: \"/engram/v1/review/contradictions\", operation: \"review_list\" },\n { method: \"GET\", pathname: \"/engram/v1/review/contradictions/:id\", operation: \"contradiction_detail\" },\n { method: \"POST\", pathname: \"/engram/v1/review/resolve\", operation: \"review_resolve\" },\n { method: \"GET\", pathname: \"/engram/v1/graph/snapshot\", operation: \"graph_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/contradiction-scan\", operation: \"contradiction_scan_run\" },\n { method: \"GET\", pathname: \"/engram/v1/console/state\", operation: \"console_state\" },\n { method: \"GET\", pathname: \"/engram/v1/peers\", operation: \"peer_list\" },\n { method: \"GET\", pathname: \"/engram/v1/peers/:id/profile\", operation: \"peer_profile_get\" },\n { method: \"GET\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_get\" },\n { method: \"PUT\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_set\" },\n { method: \"DELETE\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_delete\" },\n { method: \"GET\", pathname: \"/engram/v1/dreams/status\", operation: \"dreams_status\" },\n { method: \"POST\", pathname: \"/engram/v1/dreams/run\", operation: \"dreams_run\" },\n // SSE-only endpoints: carried in the catalog for completeness tracking.\n // The operation registration makes them visible to the boundary; the\n // streaming lifecycle is owned by the HTTP transport (handleGraphEventsSSE).\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/snapshot-stream\", operation: \"offline_sync_snapshot_stream\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/manifest-stream\", operation: \"offline_sync_snapshot_stream\" },\n { method: \"GET\", pathname: \"/engram/v1/graph/events\", operation: \"graph_events\" },\n { method: \"POST\", pathname: \"/engram/v1/chat/message\", operation: \"chat_message\" },\n { method: \"GET\", pathname: \"/engram/v1/chat/events/:id\", operation: \"chat_events\" },\n ...SUPPORT_PASSPORT_OWNER_HTTP_ROUTES,\n ...SUPPORT_PASSPORT_PUBLIC_HTTP_ROUTES,\n];\n\n/**\n * Total unmigrated-handler count across both surfaces. The ratchet baseline\n * tracks this number; it may only decrease. `access-surface-catalog.test.ts`\n * recomputes it from the live catalog and asserts equality, so a catalog edit\n * without a baseline bump (or, ideally, a migration) fails the gate.\n */\nexport function countUnmigratedHandlers(): number {\n let count = 0;\n for (const entry of MCP_TOOLS) {\n if (entry.operation === null) count += 1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,EAAE,QAAQ,OAAO,UAAU,oBAAoB,WAAW,YAAY;AAAA,EACtE,EAAE,QAAQ,OAAO,UAAU,gCAAgC,WAAW,mBAAmB;AAAA,EACzF,EAAE,QAAQ,OAAO,UAAU,wBAAwB,WAAW,WAAW;AAAA,EACzE,EAAE,QAAQ,OAAO,UAAU,wBAAwB,WAAW,WAAW;AAAA,EACzE,EAAE,QAAQ,UAAU,UAAU,wBAAwB,WAAW,cAAc;AAAA,EAC/E,EAAE,QAAQ,OAAO,UAAU,4BAA4B,WAAW,gBAAgB;AAAA,EAClF,EAAE,QAAQ,QAAQ,UAAU,yBAAyB,WAAW,aAAa;AAAA;AAAA;AAAA;AAAA,EAI7E,EAAE,QAAQ,OAAO,UAAU,2CAA2C,WAAW,+BAA+B;AAAA,EAChH,EAAE,QAAQ,OAAO,UAAU,2CAA2C,WAAW,+BAA+B;AAAA,EAChH,EAAE,QAAQ,OAAO,UAAU,2BAA2B,WAAW,eAAe;AAAA,EAChF,EAAE,QAAQ,QAAQ,UAAU,2BAA2B,WAAW,eAAe;AAAA,EACjF,EAAE,QAAQ,OAAO,UAAU,8BAA8B,WAAW,cAAc;AAAA,EAClF,GAAG;AAAA,EACH,GAAG;AACL;AAQO,SAAS,0BAAkC;AAChD,MAAI,QAAQ;AACZ,aAAW,SAAS,WAAW;AAC7B,QAAI,MAAM,cAAc,KAAM,UAAS;AAAA,EACzC;AACA,aAAW,SAAS,aAAa;AAC/B,QAAI,MAAM,cAAc,KAAM,UAAS;AAAA,EACzC;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/access-surface-catalog.ts"],"sourcesContent":["/**\n * Static inventory of every handler on the MCP and HTTP access surfaces, with\n * its migration status against the access boundary (issue #1525).\n *\n * The fitness test (`access-surface-catalog.test.ts`) walks this catalog,\n * checks each entry against the live registry, and counts unmigrated handlers.\n * The ratchet (`scripts/check-ratchets.mjs`) reads this file and counts\n * `operation: null` entries so the unmigrated count can only decrease.\n *\n * WHEN MIGRATING A HANDLER (follow-up PRs):\n * 1. Add the operation to `access-operations.ts` via `defineOperation`.\n * 2. Flip its entry here from `operation: null` to `operation: \"<name>\"`.\n * 3. Delete the surface-local validation the handler used to do.\n * 4. Run `node scripts/check-ratchets.mjs --update` to ratchet the count\n * down — the improvement is recorded in `scripts/ratchet-baseline.json`.\n *\n * WHEN ADDING A NEW HANDLER:\n * 1. Add the entry here with `operation: null` (the fitness test will fail\n * until you either migrate it or acknowledge it as unmigrated).\n * 2. Migrate it in the same PR if it carries user input — the boundary's\n * whole point is that no new handler bypasses it.\n */\n\nimport type { OperationName } from \"./access-boundary.js\";\nimport { SUPPORT_PASSPORT_OWNER_HTTP_ROUTES } from \"./support-passport/access-http.js\";\nimport { SUPPORT_PASSPORT_PUBLIC_HTTP_ROUTES } from \"./support-passport/public-http.js\";\n\n/**\n * One row per MCP tool, keyed by the canonical SHORT name (no `engram.`/\n * `remnic.` prefix — both aliases dispatch to the same operation). The name\n * MUST match the tool's short suffix as advertised by `tools/list`.\n */\nexport interface McpToolEntry {\n readonly tool: string;\n readonly operation: OperationName | null;\n}\n\n/**\n * One row per HTTP route that invokes an access-service method. Routes that\n * only serve static assets, SSE streams, or admin console HTML are excluded —\n * they don't carry user-validated request envelopes into the facade.\n */\nexport interface HttpRouteEntry {\n readonly method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n readonly pathname: string;\n readonly operation: OperationName | null;\n}\n\n// Each tool below corresponds 1:1 to an `engram.*` definition in\n// `EngramMcpServer.tools` (access-mcp.ts). The fitness test asserts the live\n// `tools/list` response matches this list by short name, so a new tool cannot\n// land without either migrating it or acknowledging the unmigrated count.\nexport const MCP_TOOLS: readonly McpToolEntry[] = [\n { tool: \"recall\", operation: \"recall\" },\n { tool: \"recall_explain\", operation: \"recall_explain\" },\n { tool: \"set_coding_context\", operation: \"set_coding_context\" },\n { tool: \"recall_tier_explain\", operation: \"recall_tier_explain\" },\n { tool: \"recall_xray\", operation: \"recall_xray\" },\n { tool: \"who_knows\", operation: \"who_knows\" },\n { tool: \"promotion_candidates\", operation: \"promotion_candidates\" },\n { tool: \"wearables_status\", operation: \"wearables_status\" },\n { tool: \"wearables_sync\", operation: \"wearables_sync\" },\n { tool: \"transcript_day\", operation: \"transcript_day\" },\n { tool: \"transcript_search\", operation: \"transcript_search\" },\n { tool: \"transcript_memories\", operation: \"transcript_memories\" },\n { tool: \"location_status\", operation: \"location_status\" },\n { tool: \"location_check\", operation: \"location_check\" },\n { tool: \"location_sync\", operation: \"location_sync\" },\n { tool: \"location_backfill\", operation: \"location_backfill\" },\n { tool: \"location_day\", operation: \"location_day\" },\n { tool: \"meetings_list\", operation: \"meetings_list\" },\n { tool: \"meetings_get\", operation: \"meetings_get\" },\n { tool: \"meetings_build\", operation: \"meetings_build\" },\n { tool: \"standup\", operation: \"standup\" },\n { tool: \"action_confidence\", operation: \"action_confidence\" },\n { tool: \"chatgpt_memory_inspector\", operation: \"chatgpt_memory_inspector\" },\n { tool: \"day_summary\", operation: \"day_summary\" },\n { tool: \"capsule_export\", operation: \"capsule_export\" },\n { tool: \"capsule_import\", operation: \"capsule_import\" },\n { tool: \"capsule_list\", operation: \"capsule_list\" },\n { tool: \"memory_governance_run\", operation: \"memory_governance_run\" },\n { tool: \"entity_synthesis_run\", operation: \"entity_synthesis_run\" },\n { tool: \"procedure_mining_run\", operation: \"procedure_mining_run\" },\n { tool: \"pattern_reinforcement_run\", operation: \"pattern_reinforcement_run\" },\n { tool: \"procedural_stats\", operation: \"procedural_stats\" },\n { tool: \"procedure_library_maintenance\", operation: \"procedure_library_maintenance\" },\n { tool: \"memory_get\", operation: \"memory_get\" },\n { tool: \"memory_timeline\", operation: \"memory_timeline\" },\n { tool: \"memory_store\", operation: \"memory_store\" },\n // Correction Contract (issue #1580) — one plan/apply pipeline.\n { tool: \"memory_correct_plan\", operation: \"memory_correct_plan\" },\n { tool: \"memory_correct_apply\", operation: \"memory_correct_apply\" },\n // Conversational memory inspection + correction (issue #1583) — unmigrated\n // handler dispatched to processChatMessage (not a boundary operation).\n { tool: \"memory_chat\", operation: \"chat_message\" },\n { tool: \"coding_decision\", operation: \"coding_decision\" },\n { tool: \"coding_architecture\", operation: \"coding_architecture\" },\n // codegraph parity tools (issue #1554)\n { tool: \"codegraph_index\", operation: \"codegraph_index\" },\n { tool: \"codegraph_list_projects\", operation: \"codegraph_list_projects\" },\n { tool: \"codegraph_delete_project\", operation: \"codegraph_delete_project\" },\n { tool: \"codegraph_index_status\", operation: \"codegraph_index_status\" },\n { tool: \"codegraph_search_graph\", operation: \"codegraph_search_graph\" },\n { tool: \"codegraph_trace_path\", operation: \"codegraph_trace_path\" },\n { tool: \"codegraph_detect_changes\", operation: \"codegraph_detect_changes\" },\n { tool: \"codegraph_query_graph\", operation: \"codegraph_query_graph\" },\n { tool: \"codegraph_get_schema\", operation: \"codegraph_get_schema\" },\n { tool: \"codegraph_get_snippet\", operation: \"codegraph_get_snippet\" },\n { tool: \"codegraph_get_architecture\", operation: \"codegraph_get_architecture\" },\n { tool: \"codegraph_search_code\", operation: \"codegraph_search_code\" },\n { tool: \"codegraph_manage_adr\", operation: \"codegraph_manage_adr\" },\n { tool: \"codegraph_ingest_traces\", operation: \"codegraph_ingest_traces\" },\n { tool: \"coding_delta\", operation: \"coding_delta\" },\n { tool: \"suggestion_submit\", operation: \"suggestion_submit\" },\n { tool: \"entity_get\", operation: \"entity_get\" },\n { tool: \"review_queue_list\", operation: \"review_queue_list\" },\n { tool: \"observe\", operation: \"observe\" },\n { tool: \"lcm_search\", operation: \"lcm_search\" },\n { tool: \"lcm_compaction_flush\", operation: \"lcm_compaction_flush\" },\n { tool: \"extraction_force_flush\", operation: \"extraction_force_flush\" },\n { tool: \"lcm_compaction_record\", operation: \"lcm_compaction_record\" },\n { tool: \"continuity_audit_generate\", operation: \"continuity_audit_generate\" },\n { tool: \"continuity_incident_open\", operation: \"continuity_incident_open\" },\n { tool: \"continuity_incident_close\", operation: \"continuity_incident_close\" },\n { tool: \"continuity_incident_list\", operation: \"continuity_incident_list\" },\n { tool: \"continuity_loop_add_or_update\", operation: \"continuity_loop_add_or_update\" },\n { tool: \"continuity_loop_review\", operation: \"continuity_loop_review\" },\n { tool: \"identity_anchor_get\", operation: \"identity_anchor_get\" },\n { tool: \"identity_anchor_update\", operation: \"identity_anchor_update\" },\n { tool: \"memory_identity\", operation: \"memory_identity\" },\n { tool: \"work_task\", operation: \"work_task\" },\n { tool: \"work_project\", operation: \"work_project\" },\n { tool: \"work_board\", operation: \"work_board\" },\n { tool: \"shared_context_write_output\", operation: \"shared_context_write_output\" },\n { tool: \"shared_feedback_record\", operation: \"shared_feedback_record\" },\n { tool: \"shared_priorities_append\", operation: \"shared_priorities_append\" },\n { tool: \"shared_context_cross_signals_run\", operation: \"shared_context_cross_signals_run\" },\n { tool: \"shared_context_curate_daily\", operation: \"shared_context_curate_daily\" },\n { tool: \"compounding_weekly_synthesize\", operation: \"compounding_weekly_synthesize\" },\n { tool: \"compounding_promote_candidate\", operation: \"compounding_promote_candidate\" },\n { tool: \"compression_guidelines_optimize\", operation: \"compression_guidelines_optimize\" },\n { tool: \"compression_guidelines_activate\", operation: \"compression_guidelines_activate\" },\n { tool: \"memory_search\", operation: \"memory_search\" },\n { tool: \"external_wiki_search\", operation: \"external_wiki_search\" },\n { tool: \"memory_profile\", operation: \"memory_profile\" },\n { tool: \"memory_entities_list\", operation: \"memory_entities_list\" },\n { tool: \"memory_questions\", operation: \"memory_questions\" },\n { tool: \"memory_last_recall\", operation: \"memory_last_recall\" },\n { tool: \"memory_intent_debug\", operation: \"memory_intent_debug\" },\n { tool: \"memory_qmd_debug\", operation: \"memory_qmd_debug\" },\n { tool: \"memory_graph_explain\", operation: \"memory_graph_explain\" },\n { tool: \"graph_snapshot\", operation: \"graph_snapshot\" },\n { tool: \"memory_feedback\", operation: \"memory_feedback\" },\n { tool: \"memory_promote\", operation: \"memory_promote\" },\n { tool: \"memory_outcome\", operation: \"memory_outcome\" },\n { tool: \"memory_action_apply\", operation: \"memory_action_apply\" },\n { tool: \"context_checkpoint\", operation: \"context_checkpoint\" },\n { tool: \"briefing\", operation: \"briefing\" },\n { tool: \"review_list\", operation: \"review_list\" },\n { tool: \"review_resolve\", operation: \"review_resolve\" },\n { tool: \"contradiction_scan_run\", operation: \"contradiction_scan_run\" },\n { tool: \"preference_drift_scan\", operation: \"preference_drift_scan\" },\n { tool: \"memory_summarize_hourly\", operation: \"memory_summarize_hourly\" },\n { tool: \"conversation_index_update\", operation: \"conversation_index_update\" },\n { tool: \"profiling_report\", operation: \"profiling_report\" },\n { tool: \"graph_edge_decay_run\", operation: \"graph_edge_decay_run\" },\n { tool: \"live_connectors_run\", operation: \"live_connectors_run\" },\n { tool: \"peer_list\", operation: \"peer_list\" },\n { tool: \"peer_get\", operation: \"peer_get\" },\n { tool: \"peer_set\", operation: \"peer_set\" },\n { tool: \"peer_delete\", operation: \"peer_delete\" },\n { tool: \"peer_profile_get\", operation: \"peer_profile_get\" },\n { tool: \"peer_forget\", operation: \"peer_forget\" },\n { tool: \"console_state\", operation: \"console_state\" },\n { tool: \"dreams_status\", operation: \"dreams_status\" },\n { tool: \"dreams_run\", operation: \"dreams_run\" },\n { tool: \"support_passport_memory_preview\", operation: \"support_passport_memory_preview\" },\n { tool: \"support_passport_cards_list\", operation: \"support_passport_cards_list\" },\n { tool: \"support_passport_draft_create\", operation: \"support_passport_draft_create\" },\n { tool: \"support_passport_drafts_generate\", operation: \"support_passport_drafts_generate\" },\n { tool: \"support_passport_card_replace\", operation: \"support_passport_card_replace\" },\n { tool: \"support_passport_card_approve\", operation: \"support_passport_card_approve\" },\n { tool: \"support_passport_card_reject\", operation: \"support_passport_card_reject\" },\n { tool: \"support_passport_card_withdraw\", operation: \"support_passport_card_withdraw\" },\n { tool: \"support_passport_grant_create\", operation: \"support_passport_grant_create\" },\n { tool: \"support_passport_grants_list\", operation: \"support_passport_grants_list\" },\n { tool: \"support_passport_grant_revoke\", operation: \"support_passport_grant_revoke\" },\n];\n\n// Each route below corresponds 1:1 to a service-invoking route branch in\n// `EngramAccessHttpServer.handle` (access-http.ts). Pathname patterns use\n// `:param` for path segments. The fitness test asserts each entry resolves\n// against the catalog so a new service route cannot land without either\n// Infrastructure routes (health, the /mcp delegate, admin console, UI assets)\n// carry no user request envelope and are intentionally excluded. The adapters\n// route was migrated through the boundary in issue #1850 round 5 (finding 1):\n// it is now op-gated by `enforceTokenOp(\"adapters_status\")` so a scoped token\n// cannot reach adapter metadata, and is tracked here so the gate is enforced.\nexport const HTTP_ROUTES: readonly HttpRouteEntry[] = [\n { method: \"GET\", pathname: \"/engram/v1/adapters\", operation: \"adapters_status\" },\n { method: \"POST\", pathname: \"/engram/v1/recall\", operation: \"recall\" },\n { method: \"POST\", pathname: \"/engram/v1/external-wikis/search\", operation: \"external_wiki_search\" },\n { method: \"POST\", pathname: \"/engram/v1/memories/search\", operation: \"memory_search\" },\n { method: \"POST\", pathname: \"/engram/v1/coding-context\", operation: \"set_coding_context\" },\n { method: \"POST\", pathname: \"/engram/v1/capsules/export\", operation: \"capsule_export\" },\n { method: \"POST\", pathname: \"/engram/v1/capsules/import\", operation: \"capsule_import\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/snapshot\", operation: \"offline_sync_snapshot\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/capabilities\", operation: \"offline_sync_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/snapshot\", operation: \"offline_sync_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/files\", operation: \"offline_sync_files\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/file-content\", operation: \"offline_sync_file_content\" },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/apply-file-content\", operation: \"offline_sync_apply_file_content\" },\n {\n method: \"POST\",\n pathname: \"/engram/v1/offline-sync/convergence-complete\",\n operation: \"offline_sync_apply_file_content\",\n },\n { method: \"POST\", pathname: \"/engram/v1/offline-sync/apply\", operation: \"offline_sync_apply\" },\n { method: \"POST\", pathname: \"/engram/v1/recall/explain\", operation: \"recall_explain\" },\n { method: \"POST\", pathname: \"/engram/v1/action-confidence\", operation: \"action_confidence\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/tier-explain\", operation: \"recall_tier_explain\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/xray\", operation: \"recall_xray\" },\n { method: \"GET\", pathname: \"/engram/v1/who-knows\", operation: \"who_knows\" },\n { method: \"GET\", pathname: \"/engram/v1/namespace/writable\", operation: \"namespace_writable\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/status\", operation: \"wearables_status\" },\n { method: \"POST\", pathname: \"/engram/v1/wearables/sync\", operation: \"wearables_sync\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/transcript\", operation: \"transcript_day\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/transcripts/search\", operation: \"transcript_search\" },\n { method: \"GET\", pathname: \"/engram/v1/wearables/memories\", operation: \"transcript_memories\" },\n { method: \"GET\", pathname: \"/engram/v1/location/status\", operation: \"location_status\" },\n { method: \"GET\", pathname: \"/engram/v1/location/check\", operation: \"location_check\" },\n { method: \"POST\", pathname: \"/engram/v1/location/sync\", operation: \"location_sync\" },\n { method: \"POST\", pathname: \"/engram/v1/location/backfill\", operation: \"location_backfill\" },\n { method: \"GET\", pathname: \"/engram/v1/location/day\", operation: \"location_day\" },\n { method: \"GET\", pathname: \"/engram/v1/meetings\", operation: \"meetings_list\" },\n { method: \"POST\", pathname: \"/engram/v1/meetings/build\", operation: \"meetings_build\" },\n { method: \"GET\", pathname: \"/engram/v1/meetings/:id\", operation: \"meetings_get\" },\n { method: \"GET\", pathname: \"/engram/v1/standup\", operation: \"standup\" },\n { method: \"POST\", pathname: \"/engram/v1/observe\", operation: \"observe\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/search\", operation: \"lcm_search\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/compaction/flush\", operation: \"lcm_compaction_flush\" },\n { method: \"POST\", pathname: \"/engram/v1/extraction/flush\", operation: \"extraction_force_flush\" },\n { method: \"POST\", pathname: \"/engram/v1/lcm/compaction/record\", operation: \"lcm_compaction_record\" },\n { method: \"GET\", pathname: \"/engram/v1/lcm/status\", operation: \"lcm_status\" },\n { method: \"GET\", pathname: \"/engram/v1/relay/missions/:id\", operation: \"relay_mission_read\" },\n { method: \"POST\", pathname: \"/engram/v1/relay/missions/:id/events\", operation: \"relay_mission_append\" },\n // Correction Contract (issue #1580) — plan/apply/pending.\n { method: \"POST\", pathname: \"/engram/v1/correction/plan\", operation: \"memory_correct_plan\" },\n { method: \"POST\", pathname: \"/engram/v1/correction/apply\", operation: \"memory_correct_apply\" },\n { method: \"GET\", pathname: \"/engram/v1/correction/pending\", operation: \"correction_pending\" },\n { method: \"POST\", pathname: \"/engram/v1/memories\", operation: \"memory_store\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/decisions\", operation: \"coding_decision\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/architecture\", operation: \"coding_architecture\" },\n { method: \"POST\", pathname: \"/engram/v1/coding/delta\", operation: \"coding_delta\" },\n { method: \"POST\", pathname: \"/engram/v1/suggestions\", operation: \"suggestion_submit\" },\n { method: \"GET\", pathname: \"/engram/v1/memories\", operation: \"memory_list\" },\n { method: \"GET\", pathname: \"/engram/v1/recall/timings\", operation: \"recall_timings\" },\n { method: \"GET\", pathname: \"/engram/v1/memories/:id\", operation: \"memory_get\" },\n { method: \"GET\", pathname: \"/engram/v1/memories/:id/timeline\", operation: \"memory_timeline\" },\n { method: \"GET\", pathname: \"/engram/v1/entities\", operation: \"entity_list\" },\n { method: \"GET\", pathname: \"/engram/v1/entities/:id\", operation: \"entity_get\" },\n { method: \"GET\", pathname: \"/engram/v1/review-queue\", operation: \"review_queue_list\" },\n { method: \"GET\", pathname: \"/engram/v1/maintenance\", operation: \"maintenance_status\" },\n { method: \"GET\", pathname: \"/engram/v1/quality\", operation: \"quality_status\" },\n { method: \"GET\", pathname: \"/engram/v1/trust-zones/status\", operation: \"trust_zones_status\" },\n { method: \"GET\", pathname: \"/engram/v1/procedural/stats\", operation: \"procedural_stats\" },\n { method: \"GET\", pathname: \"/engram/v1/trust-zones/records\", operation: \"trust_zones_records\" },\n { method: \"POST\", pathname: \"/engram/v1/review-disposition\", operation: \"review_disposition\" },\n { method: \"GET\", pathname: \"/engram/v1/review/deck\", operation: \"review_deck_list\" },\n { method: \"POST\", pathname: \"/engram/v1/review/deck/action\", operation: \"review_deck_action\" },\n { method: \"POST\", pathname: \"/engram/v1/review/deck/undo\", operation: \"review_deck_undo\" },\n { method: \"POST\", pathname: \"/engram/v1/trust-zones/promote\", operation: \"trust_zones_promote\" },\n { method: \"POST\", pathname: \"/engram/v1/trust-zones/demo-seed\", operation: \"trust_zones_demo_seed\" },\n { method: \"POST\", pathname: \"/v1/citations/observed\", operation: \"citations_observed\" },\n { method: \"GET\", pathname: \"/engram/v1/review/contradictions\", operation: \"review_list\" },\n { method: \"GET\", pathname: \"/engram/v1/review/contradictions/:id\", operation: \"contradiction_detail\" },\n { method: \"POST\", pathname: \"/engram/v1/review/resolve\", operation: \"review_resolve\" },\n { method: \"GET\", pathname: \"/engram/v1/graph/snapshot\", operation: \"graph_snapshot\" },\n { method: \"POST\", pathname: \"/engram/v1/contradiction-scan\", operation: \"contradiction_scan_run\" },\n { method: \"GET\", pathname: \"/engram/v1/console/state\", operation: \"console_state\" },\n { method: \"GET\", pathname: \"/engram/v1/peers\", operation: \"peer_list\" },\n { method: \"GET\", pathname: \"/engram/v1/peers/:id/profile\", operation: \"peer_profile_get\" },\n { method: \"GET\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_get\" },\n { method: \"PUT\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_set\" },\n { method: \"DELETE\", pathname: \"/engram/v1/peers/:id\", operation: \"peer_delete\" },\n { method: \"GET\", pathname: \"/engram/v1/dreams/status\", operation: \"dreams_status\" },\n { method: \"POST\", pathname: \"/engram/v1/dreams/run\", operation: \"dreams_run\" },\n // SSE-only endpoints: carried in the catalog for completeness tracking.\n // The operation registration makes them visible to the boundary; the\n // streaming lifecycle is owned by the HTTP transport (handleGraphEventsSSE).\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/snapshot-stream\", operation: \"offline_sync_snapshot_stream\" },\n { method: \"GET\", pathname: \"/engram/v1/offline-sync/manifest-stream\", operation: \"offline_sync_snapshot_stream\" },\n { method: \"GET\", pathname: \"/engram/v1/graph/events\", operation: \"graph_events\" },\n { method: \"POST\", pathname: \"/engram/v1/chat/message\", operation: \"chat_message\" },\n { method: \"GET\", pathname: \"/engram/v1/chat/events/:id\", operation: \"chat_events\" },\n ...SUPPORT_PASSPORT_OWNER_HTTP_ROUTES,\n ...SUPPORT_PASSPORT_PUBLIC_HTTP_ROUTES,\n];\n\n/**\n * Total unmigrated-handler count across both surfaces. The ratchet baseline\n * tracks this number; it may only decrease. `access-surface-catalog.test.ts`\n * recomputes it from the live catalog and asserts equality, so a catalog edit\n * without a baseline bump (or, ideally, a migration) fails the gate.\n */\nexport function countUnmigratedHandlers(): number {\n let count = 0;\n for (const entry of MCP_TOOLS) {\n if (entry.operation === null) count += 1;\n }\n for (const entry of HTTP_ROUTES) {\n if (entry.operation === null) count += 1;\n }\n return count;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDO,IAAM,YAAqC;AAAA,EAChD,EAAE,MAAM,UAAU,WAAW,SAAS;AAAA,EACtC,EAAE,MAAM,kBAAkB,WAAW,iBAAiB;AAAA,EACtD,EAAE,MAAM,sBAAsB,WAAW,qBAAqB;AA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ChH,EAAE,QAAQ,OAAO,UAAU,2CAA2C,WAAW,+BAA+B;AAAA,EAChH,EAAE,QAAQ,OAAO,UAAU,2BAA2B,WAAW,eAAe;AAAA,EAChF,EAAE,QAAQ,QAAQ,UAAU,2BAA2B,WAAW,eAAe;AAAA,EACjF,EAAE,QAAQ,OAAO,UAAU,8BAA8B,WAAW,cAAc;AAAA,EAClF,GAAG;AAAA,EACH,GAAG;AACL;AAQO,SAAS,0BAAkC;AAChD,MAAI,QAAQ;AACZ,aAAW,SAAS,WAAW;AAC7B,QAAI,MAAM,cAAc,KAAM,UAAS;AAAA,EACzC;AACA,aAAW,SAAS,aAAa;AAC/B,QAAI,MAAM,cAAc,KAAM,UAAS;AAAA,EACzC;AACA,SAAO;AACT;","names":[]}
@@ -1,7 +1,10 @@
1
1
  import "../chunk-SEDEKFYQ.js";
2
2
  import {
3
3
  AdapterRegistry
4
- } from "../chunk-RKNJBZ55.js";
4
+ } from "../chunk-JBPKEARU.js";
5
+ import {
6
+ ReplitAdapter
7
+ } from "../chunk-TMSXWOBZ.js";
5
8
  import {
6
9
  ClaudeCodeAdapter
7
10
  } from "../chunk-J64TK33U.js";
@@ -11,9 +14,6 @@ import {
11
14
  import {
12
15
  HermesAdapter
13
16
  } from "../chunk-42NQ7AVG.js";
14
- import {
15
- ReplitAdapter
16
- } from "../chunk-TMSXWOBZ.js";
17
17
  import "../chunk-7RXCMVFQ.js";
18
18
  import "../chunk-PZ5AY32C.js";
19
19
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AdapterRegistry
3
- } from "../chunk-RKNJBZ55.js";
3
+ } from "../chunk-JBPKEARU.js";
4
+ import "../chunk-TMSXWOBZ.js";
4
5
  import "../chunk-J64TK33U.js";
5
6
  import "../chunk-RSUYKGGZ.js";
6
7
  import "../chunk-42NQ7AVG.js";
7
- import "../chunk-TMSXWOBZ.js";
8
8
  import "../chunk-7RXCMVFQ.js";
9
9
  import "../chunk-PZ5AY32C.js";
10
10
  export {
package/dist/briefing.js CHANGED
@@ -18,21 +18,21 @@ import {
18
18
  renderBriefingMarkdown,
19
19
  resolveBriefingSaveDir,
20
20
  validateBriefingFormat
21
- } from "./chunk-G3TUQJFU.js";
22
- import "./chunk-G775FE2E.js";
23
- import "./chunk-4ZWCQJNM.js";
21
+ } from "./chunk-E62M4H4M.js";
22
+ import "./chunk-4PHT7KE2.js";
24
23
  import "./chunk-UHVXE24Y.js";
24
+ import "./chunk-4ZWCQJNM.js";
25
25
  import "./chunk-WVGXCBOC.js";
26
- import "./chunk-B3TZLAO4.js";
27
- import "./chunk-5NZIRM4Q.js";
26
+ import "./chunk-X5SDZMO7.js";
27
+ import "./chunk-HJQZQUPC.js";
28
+ import "./chunk-NNBZS3DY.js";
29
+ import "./chunk-CYEPCZN5.js";
28
30
  import "./chunk-GIC6BASP.js";
29
31
  import "./chunk-YQNNHLCG.js";
30
32
  import "./chunk-6KTXE6A3.js";
31
33
  import "./chunk-N37X5RU7.js";
32
- import "./chunk-NNBZS3DY.js";
33
34
  import "./chunk-W7IGLX4G.js";
34
35
  import "./chunk-GUMZC2BO.js";
35
- import "./chunk-CYEPCZN5.js";
36
36
  import "./chunk-227UFSEQ.js";
37
37
  import "./chunk-ET356KSB.js";
38
38
  import "./chunk-72A4L5JJ.js";
@@ -42,8 +42,8 @@ import "./chunk-XXW32OL7.js";
42
42
  import "./chunk-SCU65EZI.js";
43
43
  import "./chunk-2GF27PGH.js";
44
44
  import "./chunk-S2HLHAZ4.js";
45
- import "./chunk-LDXUBPMO.js";
46
45
  import "./chunk-DM2T26WE.js";
46
+ import "./chunk-LDXUBPMO.js";
47
47
  import "./chunk-XSTNGNJP.js";
48
48
  import "./chunk-AAD2ZS6P.js";
49
49
  import "./chunk-LUDBXTBJ.js";
@@ -4,27 +4,28 @@ import {
4
4
  } from "./chunk-AWGXR2PV.js";
5
5
  import {
6
6
  buildExtensionsBlockForConsolidation
7
- } from "./chunk-JHU543UU.js";
7
+ } from "./chunk-K6PWPC7O.js";
8
8
  import "./chunk-5JMAGU26.js";
9
9
  import "./chunk-B7RWBZXW.js";
10
10
  import {
11
11
  runPostConsolidationMaterialize
12
- } from "./chunk-MBDUNO7J.js";
12
+ } from "./chunk-XZ7QLOTJ.js";
13
+ import "./chunk-3UXOZBHV.js";
13
14
  import "./chunk-ZXBTTMGZ.js";
14
- import "./chunk-G775FE2E.js";
15
- import "./chunk-4ZWCQJNM.js";
15
+ import "./chunk-4PHT7KE2.js";
16
16
  import "./chunk-UHVXE24Y.js";
17
+ import "./chunk-4ZWCQJNM.js";
17
18
  import "./chunk-WVGXCBOC.js";
18
- import "./chunk-B3TZLAO4.js";
19
- import "./chunk-5NZIRM4Q.js";
19
+ import "./chunk-X5SDZMO7.js";
20
+ import "./chunk-HJQZQUPC.js";
21
+ import "./chunk-NNBZS3DY.js";
22
+ import "./chunk-CYEPCZN5.js";
20
23
  import "./chunk-GIC6BASP.js";
21
24
  import "./chunk-YQNNHLCG.js";
22
25
  import "./chunk-6KTXE6A3.js";
23
26
  import "./chunk-N37X5RU7.js";
24
- import "./chunk-NNBZS3DY.js";
25
27
  import "./chunk-W7IGLX4G.js";
26
28
  import "./chunk-GUMZC2BO.js";
27
- import "./chunk-CYEPCZN5.js";
28
29
  import "./chunk-227UFSEQ.js";
29
30
  import "./chunk-ET356KSB.js";
30
31
  import "./chunk-72A4L5JJ.js";
@@ -34,8 +35,8 @@ import "./chunk-XXW32OL7.js";
34
35
  import "./chunk-SCU65EZI.js";
35
36
  import "./chunk-2GF27PGH.js";
36
37
  import "./chunk-S2HLHAZ4.js";
37
- import "./chunk-LDXUBPMO.js";
38
38
  import "./chunk-DM2T26WE.js";
39
+ import "./chunk-LDXUBPMO.js";
39
40
  import "./chunk-XSTNGNJP.js";
40
41
  import "./chunk-AAD2ZS6P.js";
41
42
  import "./chunk-LUDBXTBJ.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\n}\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidence(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMaterialize in codex-materialize-runner.ts.\n return runPostConsolidationMaterialize(\"[cmc]\", options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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B,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACnH,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,oCAAoC,SAQpB;AAGpC,SAAO,gCAAgC,SAAS,OAAO;AACzD;","names":[]}
1
+ {"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\n}\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidence(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMa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,KAAK,SAAS,EAAE;AAAA,IAClC;AAEA,eAAW,QAAQ,OAAO,OAAO;AAC/B,YAAM,KAAK,KAAK,KAAK,OAAO,EAAE;AAAA,IAChC;AAEA,UAAM,KAAK,EAAE;AACb,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,QAAI,KAAK,kDAAkD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACnH,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,oCAAoC,SAQpB;AAGpC,SAAO,gCAAgC,SAAS,OAAO;AACzD;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startLocationAutoSync
3
- } from "./chunk-CIWOW2FH.js";
3
+ } from "./chunk-HPGXB56F.js";
4
4
  import {
5
5
  ensureContradictionScanCron,
6
6
  ensureDaySummaryCron,
@@ -12,14 +12,14 @@ import {
12
12
  } from "./chunk-666A3MOW.js";
13
13
  import {
14
14
  rebuildMemoryLifecycleLedger
15
- } from "./chunk-ZVUGRXSY.js";
15
+ } from "./chunk-WD424KYT.js";
16
16
  import {
17
17
  planNamespaceMaintenance,
18
18
  runNamespaceMaintenanceBatchPlan
19
- } from "./chunk-FUPIAP6Q.js";
19
+ } from "./chunk-XN33JLRF.js";
20
20
  import {
21
21
  rebuildMemoryProjection
22
- } from "./chunk-Q3UMNZRK.js";
22
+ } from "./chunk-ZIGSNLYI.js";
23
23
  import {
24
24
  validateActivityBaseUrl
25
25
  } from "./chunk-VSWRJQQW.js";
@@ -1742,4 +1742,4 @@ export {
1742
1742
  ActivitySyncScheduler,
1743
1743
  MaintenanceScheduler
1744
1744
  };
1745
- //# sourceMappingURL=chunk-5GZ6UWY5.js.map
1745
+ //# sourceMappingURL=chunk-245QROHZ.js.map
@@ -1,12 +1,3 @@
1
- import {
2
- LcmDag
3
- } from "./chunk-7N4KAIGN.js";
4
- import {
5
- LcmWorkQueue
6
- } from "./chunk-TPDBFYEG.js";
7
- import {
8
- assembleCompressedHistoryWithTrace
9
- } from "./chunk-UXPUUL3G.js";
10
1
  import {
11
2
  ensureLcmStateDir,
12
3
  openLcmDatabase
@@ -17,6 +8,15 @@ import {
17
8
  import {
18
9
  LcmArchive
19
10
  } from "./chunk-WVP2I6C5.js";
11
+ import {
12
+ LcmDag
13
+ } from "./chunk-7N4KAIGN.js";
14
+ import {
15
+ LcmWorkQueue
16
+ } from "./chunk-TPDBFYEG.js";
17
+ import {
18
+ assembleCompressedHistoryWithTrace
19
+ } from "./chunk-UXPUUL3G.js";
20
20
  import {
21
21
  nativeBindingRecoveryHint
22
22
  } from "./chunk-LD72P4YS.js";
@@ -573,4 +573,4 @@ export {
573
573
  extractLcmConfig,
574
574
  LcmEngine
575
575
  };
576
- //# sourceMappingURL=chunk-A7GQBJP5.js.map
576
+ //# sourceMappingURL=chunk-2L5FSNPC.js.map
@@ -2,7 +2,7 @@ import {
2
2
  WHO_KNOWS_DEFAULT_LIMIT,
3
3
  WHO_KNOWS_MAX_LIMIT,
4
4
  validateWhoKnowsInput
5
- } from "./chunk-AAJK3PZ6.js";
5
+ } from "./chunk-QB66LBXA.js";
6
6
 
7
7
  // src/who-knows-cli.ts
8
8
  function extractWhoKnowsRawArgs(rest) {
@@ -74,4 +74,4 @@ export {
74
74
  renderWhoKnowsText,
75
75
  renderWhoKnows
76
76
  };
77
- //# sourceMappingURL=chunk-SJ5L4ZZX.js.map
77
+ //# sourceMappingURL=chunk-2OXBS2LV.js.map
@@ -0,0 +1,20 @@
1
+ // src/namespaces/path.ts
2
+ import path from "path";
3
+ function assertNamespacePathInsideRoot(root, candidate, namespace, label = "namespace path") {
4
+ const relative = path.relative(root, candidate);
5
+ if (relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative)) {
6
+ return;
7
+ }
8
+ throw new Error(`invalid ${label}: ${namespace}`);
9
+ }
10
+ function resolveNamespaceChildRoot(memoryDir, namespace, label = "namespace path") {
11
+ const namespaceRoot = path.resolve(memoryDir, "namespaces");
12
+ const candidate = path.resolve(namespaceRoot, namespace);
13
+ assertNamespacePathInsideRoot(namespaceRoot, candidate, namespace, label);
14
+ return candidate;
15
+ }
16
+
17
+ export {
18
+ resolveNamespaceChildRoot
19
+ };
20
+ //# sourceMappingURL=chunk-3UXOZBHV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/namespaces/path.ts"],"sourcesContent":["import path from \"node:path\";\n\nexport function assertNamespacePathInsideRoot(\n root: string,\n candidate: string,\n namespace: string,\n label = \"namespace path\",\n): void {\n const relative = path.relative(root, candidate);\n if (relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative))) {\n return;\n }\n throw new Error(`invalid ${label}: ${namespace}`);\n}\n\nexport function resolveNamespaceChildRoot(\n memoryDir: string,\n namespace: string,\n label = \"namespace path\",\n): string {\n const namespaceRoot = path.resolve(memoryDir, \"namespaces\");\n const candidate = path.resolve(namespaceRoot, namespace);\n assertNamespacePathInsideRoot(namespaceRoot, candidate, namespace, label);\n return candidate;\n}\n"],"mappings":";AAAA,OAAO,UAAU;AAEV,SAAS,8BACd,MACA,WACA,WACA,QAAQ,kBACF;AACN,QAAM,WAAW,KAAK,SAAS,MAAM,SAAS;AAC9C,MAAI,aAAa,MAAO,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,QAAQ,GAAI;AACjF;AAAA,EACF;AACA,QAAM,IAAI,MAAM,WAAW,KAAK,KAAK,SAAS,EAAE;AAClD;AAEO,SAAS,0BACd,WACA,WACA,QAAQ,kBACA;AACR,QAAM,gBAAgB,KAAK,QAAQ,WAAW,YAAY;AAC1D,QAAM,YAAY,KAAK,QAAQ,eAAe,SAAS;AACvD,gCAA8B,eAAe,WAAW,WAAW,KAAK;AACxE,SAAO;AACT;","names":[]}
@@ -1,9 +1,3 @@
1
- import {
2
- TombstoneStore,
3
- applyTombstoneResurrectionGate,
4
- buildRetiredFactTombstoneInputs,
5
- collectRetiredMemoriesForRebuild
6
- } from "./chunk-4ZWCQJNM.js";
7
1
  import {
8
2
  WEARABLES_DIR_NAME,
9
3
  escapeSegmentText,
@@ -15,9 +9,15 @@ import {
15
9
  unescapeSegmentText,
16
10
  unescapeSpeakerLabel
17
11
  } from "./chunk-UHVXE24Y.js";
12
+ import {
13
+ TombstoneStore,
14
+ applyTombstoneResurrectionGate,
15
+ buildRetiredFactTombstoneInputs,
16
+ collectRetiredMemoriesForRebuild
17
+ } from "./chunk-4ZWCQJNM.js";
18
18
  import {
19
19
  normalizeQmdResultPath
20
- } from "./chunk-B3TZLAO4.js";
20
+ } from "./chunk-X5SDZMO7.js";
21
21
  import {
22
22
  withholdToolScopedFromSharedNamespace
23
23
  } from "./chunk-S2V7RUCL.js";
@@ -36,6 +36,9 @@ import {
36
36
  import {
37
37
  createMemorySnapshot
38
38
  } from "./chunk-S2HLHAZ4.js";
39
+ import {
40
+ rotateMarkdownFileToArchive
41
+ } from "./chunk-DM2T26WE.js";
39
42
  import {
40
43
  closeContinuityIncidentRecord,
41
44
  createContinuityIncidentRecord,
@@ -45,9 +48,6 @@ import {
45
48
  serializeContinuityIncident,
46
49
  upsertContinuityLoopInMarkdown
47
50
  } from "./chunk-LDXUBPMO.js";
48
- import {
49
- rotateMarkdownFileToArchive
50
- } from "./chunk-DM2T26WE.js";
51
51
  import {
52
52
  parseFaithfulnessField,
53
53
  serializeFaithfulnessFields
@@ -11374,4 +11374,4 @@ export {
11374
11374
  isValidBufferSurpriseEvent,
11375
11375
  StorageManager3 as StorageManager
11376
11376
  };
11377
- //# sourceMappingURL=chunk-G775FE2E.js.map
11377
+ //# sourceMappingURL=chunk-4PHT7KE2.js.map