@remnic/core 10.0.74 → 10.0.75

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 (293) hide show
  1. package/dist/access-admin-ops-surface.js +46 -45
  2. package/dist/access-authorization-probe.js +47 -46
  3. package/dist/access-boundary.js +46 -45
  4. package/dist/access-cli.js +102 -101
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-extraction-force-flush.js +46 -45
  7. package/dist/access-http-briefing.js +47 -46
  8. package/dist/access-http-query.js +48 -47
  9. package/dist/access-http.js +65 -64
  10. package/dist/access-identity-continuity-surface.js +46 -45
  11. package/dist/access-lcm-surface.js +46 -45
  12. package/dist/access-mcp.js +55 -54
  13. package/dist/access-namespace-preflight.js +46 -45
  14. package/dist/access-observe-write-category.js +6 -6
  15. package/dist/access-observe-write-surface.js +46 -45
  16. package/dist/access-offline-manifest.js +5 -5
  17. package/dist/access-operations-batch.js +47 -46
  18. package/dist/access-operations.js +54 -53
  19. package/dist/access-recall-concurrency.js +46 -45
  20. package/dist/access-recall-response.js +46 -45
  21. package/dist/access-recall-surface.js +46 -45
  22. package/dist/access-schema.js +5 -5
  23. package/dist/access-service.js +46 -45
  24. package/dist/access-surface-catalog.js +48 -47
  25. package/dist/access-surface-catalog.js.map +1 -1
  26. package/dist/active-recall.js +16 -16
  27. package/dist/adapters/index.js +4 -4
  28. package/dist/adapters/registry.js +2 -2
  29. package/dist/{auto-sync-ANOJDQD4.js → auto-sync-XHSS3XPL.js} +5 -5
  30. package/dist/briefing.js +13 -13
  31. package/dist/buffer.js +3 -3
  32. package/dist/calibration.js +5 -4
  33. package/dist/calibration.js.map +1 -1
  34. package/dist/causal-consolidation.js +14 -14
  35. package/dist/{chunk-NHTEEGE4.js → chunk-233S3MXC.js} +3 -3
  36. package/dist/{chunk-N7NAGECH.js → chunk-36B5VPRU.js} +2 -2
  37. package/dist/{chunk-LC55ZXLR.js → chunk-3GGCMRO7.js} +2 -2
  38. package/dist/{chunk-RZED7FAU.js → chunk-3M7YP42P.js} +2 -2
  39. package/dist/{chunk-KPCTZB3U.js → chunk-3MBSD53O.js} +2 -2
  40. package/dist/{chunk-VWHWWIFS.js → chunk-4DLZ2ITE.js} +2 -2
  41. package/dist/{chunk-WN2DASTS.js → chunk-5BE3FLKL.js} +4 -4
  42. package/dist/{chunk-45SFSQON.js → chunk-5IQL4N37.js} +9 -9
  43. package/dist/{chunk-CIL4GHMD.js → chunk-6Q6AQ36B.js} +2 -2
  44. package/dist/{chunk-XV7PJVQO.js → chunk-6RPPZL7W.js} +2 -2
  45. package/dist/{chunk-EQ6EMJRG.js → chunk-6Y5ANLDH.js} +2 -2
  46. package/dist/{chunk-V33ETCF6.js → chunk-7FFGWIBN.js} +2 -2
  47. package/dist/{chunk-5RW247F5.js → chunk-AY2UK5XK.js} +14 -9
  48. package/dist/chunk-AY2UK5XK.js.map +1 -0
  49. package/dist/{chunk-5QV6CE6K.js → chunk-B36ACJG7.js} +2 -2
  50. package/dist/{chunk-2WDFLORC.js → chunk-BZTA7DR4.js} +3 -3
  51. package/dist/{chunk-5XOCAJHC.js → chunk-C44DRDZM.js} +2 -2
  52. package/dist/{chunk-UIFWZMO7.js → chunk-CLVILSBR.js} +7 -7
  53. package/dist/{chunk-KH2HB3OW.js → chunk-COIQ5N4J.js} +2 -2
  54. package/dist/{chunk-CU5N4RDI.js → chunk-DANFOVQG.js} +2 -2
  55. package/dist/{chunk-FU2ZLXVN.js → chunk-DEGE32C3.js} +2 -2
  56. package/dist/{chunk-YIJECSIX.js → chunk-DJDJBMFX.js} +9 -2
  57. package/dist/chunk-DJDJBMFX.js.map +1 -0
  58. package/dist/{chunk-LUXVW5UU.js → chunk-E22CQZ3H.js} +14 -14
  59. package/dist/{chunk-DVDRKCZK.js → chunk-ELUG6NKQ.js} +2 -2
  60. package/dist/{chunk-DLLQMNYQ.js → chunk-F3FNXE7C.js} +3 -3
  61. package/dist/{chunk-YIXWY4OZ.js → chunk-FETPTCQZ.js} +2 -2
  62. package/dist/{chunk-WPPAXTW6.js → chunk-FGUWCE5I.js} +2 -2
  63. package/dist/{chunk-FDUCIUQ5.js → chunk-FJ2VJTGA.js} +2 -2
  64. package/dist/{chunk-ENPJX3BB.js → chunk-FMFCQRDM.js} +3 -3
  65. package/dist/{chunk-BNU5TQLR.js → chunk-FOQ7TW2T.js} +2 -2
  66. package/dist/{chunk-DHQLVS7J.js → chunk-FP2AT4WL.js} +2 -2
  67. package/dist/{chunk-DLZGSZVC.js → chunk-FYQUUIPI.js} +4 -4
  68. package/dist/{chunk-XTN54NML.js → chunk-G3T6YMBO.js} +4 -4
  69. package/dist/{chunk-MUH7RR6T.js → chunk-G5NH3SSX.js} +5 -5
  70. package/dist/{chunk-G7I2RQ64.js → chunk-GCJA5KKT.js} +2 -2
  71. package/dist/{chunk-A2BH2VE2.js → chunk-GWOFCHPN.js} +2 -2
  72. package/dist/{chunk-TJ5YGCPV.js → chunk-GXVK754R.js} +2 -2
  73. package/dist/{chunk-Y2ZGT4W7.js → chunk-HB5TNQMM.js} +2 -2
  74. package/dist/{chunk-QYLEE4UQ.js → chunk-HCFNZWFB.js} +2 -2
  75. package/dist/{chunk-F4ZHKDBW.js → chunk-HLWXCDUQ.js} +2 -2
  76. package/dist/{chunk-62O7YWBR.js → chunk-HTDXNIO6.js} +2 -2
  77. package/dist/{chunk-4RASUAN3.js → chunk-HXFIILGF.js} +4 -4
  78. package/dist/{chunk-6EKP7BJW.js → chunk-I4LJJ44E.js} +2 -2
  79. package/dist/{chunk-STDAR7M7.js → chunk-IBQ7LGUJ.js} +6 -6
  80. package/dist/{chunk-PUP7NTNB.js → chunk-IRFQKR4Y.js} +2 -2
  81. package/dist/{chunk-BEQU6QGW.js → chunk-IVXOYE43.js} +2 -2
  82. package/dist/{chunk-WXPBDEMW.js → chunk-JDQEQE2R.js} +2 -2
  83. package/dist/{chunk-CAVXVGYK.js → chunk-KAED7IBB.js} +2 -2
  84. package/dist/{chunk-OFOV6TTZ.js → chunk-KNZDGZSY.js} +2 -2
  85. package/dist/{chunk-KFZ3A2EA.js → chunk-L4QYW2HO.js} +2 -2
  86. package/dist/{chunk-IXBIL5WY.js → chunk-LJUQPT5G.js} +3 -3
  87. package/dist/{chunk-4SOISEZ3.js → chunk-MBENRPMY.js} +10 -10
  88. package/dist/chunk-MJFL75J6.js +42 -0
  89. package/dist/chunk-MJFL75J6.js.map +1 -0
  90. package/dist/{chunk-OKBGLAAI.js → chunk-N6GEGRCT.js} +2 -2
  91. package/dist/{chunk-U2A56LLF.js → chunk-OBQ2NZAR.js} +10 -10
  92. package/dist/{chunk-WGRAB3KB.js → chunk-ORVPS4ZW.js} +2 -2
  93. package/dist/{chunk-PFUXPTBT.js → chunk-P3AQ2YSX.js} +4 -4
  94. package/dist/{chunk-DE4U5PTV.js → chunk-P4TEQSIZ.js} +2 -2
  95. package/dist/{chunk-DQVT45LZ.js → chunk-P7HNMNN2.js} +7 -7
  96. package/dist/{chunk-ZG4GNPRE.js → chunk-PBE7NFB5.js} +5 -5
  97. package/dist/{chunk-T64HVBAP.js → chunk-PLGBPFEO.js} +2 -2
  98. package/dist/{chunk-5MA7ZLPD.js → chunk-QNUNAXBE.js} +35 -1
  99. package/dist/chunk-QNUNAXBE.js.map +1 -0
  100. package/dist/{chunk-GO2GCJ7S.js → chunk-R24RYSQX.js} +41 -41
  101. package/dist/{chunk-YJX3K5LK.js → chunk-RXGFITWS.js} +4 -4
  102. package/dist/{chunk-JEX2JL3U.js → chunk-SHVLNI4L.js} +2 -2
  103. package/dist/{chunk-LIGA5KHG.js → chunk-SY4AFWUZ.js} +31 -31
  104. package/dist/{chunk-GI47WZWA.js → chunk-SYDPJUFR.js} +2 -2
  105. package/dist/{chunk-55NKJDKX.js → chunk-SZBZOUHR.js} +2 -2
  106. package/dist/{chunk-UEY5TPEE.js → chunk-T6C3G67T.js} +2 -2
  107. package/dist/{chunk-E3NBMTTX.js → chunk-TLTBACYX.js} +2 -2
  108. package/dist/{chunk-AVVCPA7U.js → chunk-UCPH56YX.js} +2 -2
  109. package/dist/{chunk-HPCWJMMQ.js → chunk-URS56HGW.js} +5 -5
  110. package/dist/{chunk-GJOBCNST.js → chunk-VEQVXNWR.js} +4 -4
  111. package/dist/{chunk-2H3SITYD.js → chunk-VEWTHVX2.js} +2 -2
  112. package/dist/{chunk-K5Y42U2P.js → chunk-VPEMGBTI.js} +2 -2
  113. package/dist/{chunk-Q2QPHGEC.js → chunk-VYOAYFDV.js} +47 -47
  114. package/dist/{chunk-5JBVPJCT.js → chunk-WIAXVBQH.js} +2 -2
  115. package/dist/{chunk-KWUMXJN7.js → chunk-X53HJENJ.js} +2 -2
  116. package/dist/{chunk-KY3KJUNN.js → chunk-XC7OYOQC.js} +6 -6
  117. package/dist/{chunk-43FLJLT2.js → chunk-Y5HZFIQO.js} +1 -1
  118. package/dist/{chunk-DOJBV6WR.js → chunk-YK6SFDP2.js} +4 -4
  119. package/dist/{chunk-WBMT3C6A.js → chunk-Z3CKK5RR.js} +3 -3
  120. package/dist/{chunk-RQHIN3PY.js → chunk-ZG57BEUS.js} +2 -2
  121. package/dist/{chunk-MOJ4UDA3.js → chunk-ZZSFRWKD.js} +2 -2
  122. package/dist/cli.js +78 -77
  123. package/dist/coding/export-okf-codegraph.js +12 -12
  124. package/dist/compounding/engine.js +14 -14
  125. package/dist/config.js +16 -16
  126. package/dist/connectors/codex-materialize-runner.js +13 -13
  127. package/dist/connectors/index.js +13 -13
  128. package/dist/convergence-refresh.js +15 -15
  129. package/dist/corpus-watermark.js +15 -15
  130. package/dist/deep-recall-http-glue.js +6 -6
  131. package/dist/deep-recall-policy-llm.js +3 -3
  132. package/dist/deep-recall.js +2 -2
  133. package/dist/entity-retrieval.js +13 -13
  134. package/dist/external-wiki-access.js +47 -46
  135. package/dist/extraction-faithfulness.js +3 -3
  136. package/dist/extraction-judge.js +3 -3
  137. package/dist/extraction.js +21 -20
  138. package/dist/fallback-llm-codex-subscription.d.ts.map +1 -1
  139. package/dist/fallback-llm-codex-subscription.js +1 -1
  140. package/dist/fallback-llm.js +2 -2
  141. package/dist/{first-start-migration-A6PHIBUQ.js → first-start-migration-QVD22WWS.js} +4 -4
  142. package/dist/harmonic-retrieval.js +13 -13
  143. package/dist/index.js +127 -126
  144. package/dist/lcm/engine.js +2 -2
  145. package/dist/lcm/index.js +5 -5
  146. package/dist/local-llm-native-schema.d.ts +50 -0
  147. package/dist/local-llm-native-schema.d.ts.map +1 -0
  148. package/dist/local-llm-native-schema.js +8 -0
  149. package/dist/local-llm-native-schema.js.map +1 -0
  150. package/dist/local-llm.d.ts +1 -0
  151. package/dist/local-llm.d.ts.map +1 -1
  152. package/dist/local-llm.js +4 -3
  153. package/dist/location/index.js +15 -15
  154. package/dist/maintenance/memory-governance.js +13 -13
  155. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
  156. package/dist/maintenance/rebuild-memory-projection-runner.js +15 -15
  157. package/dist/maintenance/rebuild-memory-projection.js +14 -14
  158. package/dist/memory-browse-operations.js +47 -46
  159. package/dist/memory-browse.js +3 -3
  160. package/dist/model-registry.d.ts +11 -0
  161. package/dist/model-registry.d.ts.map +1 -1
  162. package/dist/model-registry.js +1 -1
  163. package/dist/namespaces/migrate.js +14 -14
  164. package/dist/namespaces/search.js +7 -7
  165. package/dist/namespaces/storage.js +13 -13
  166. package/dist/offline-sync-changeset-generations.js +3 -3
  167. package/dist/offline-sync-embedding-generation.js +2 -2
  168. package/dist/offline-sync-snapshot-stream.js +5 -5
  169. package/dist/offline-sync.js +7 -7
  170. package/dist/operator-doctor-corpus.js +16 -16
  171. package/dist/operator-toolkit.js +25 -25
  172. package/dist/orchestration/backlog-scheduler.d.ts +8 -0
  173. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
  174. package/dist/orchestration/backlog-scheduler.js +115 -103
  175. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  176. package/dist/orchestration/buffer-drain-runner.js +103 -102
  177. package/dist/orchestration/maintenance.js +26 -25
  178. package/dist/orchestrator.js +102 -101
  179. package/dist/recall-navigation-operations.js +47 -46
  180. package/dist/recall-navigation.js +46 -45
  181. package/dist/recall-planner-llm.js +2 -2
  182. package/dist/recall-state-view-admission.js +3 -3
  183. package/dist/recall-why-service.js +3 -3
  184. package/dist/resume-bundles.js +16 -16
  185. package/dist/search/factory.js +6 -6
  186. package/dist/search/index.js +11 -11
  187. package/dist/search/lancedb-backend.js +2 -2
  188. package/dist/search/meilisearch-backend.js +2 -2
  189. package/dist/search/orama-backend.js +2 -2
  190. package/dist/semantic-consolidation.js +14 -14
  191. package/dist/semantic-rule-promotion.js +13 -13
  192. package/dist/semantic-rule-verifier.js +13 -13
  193. package/dist/source-agent-qualifier.js +16 -16
  194. package/dist/standup/build.js +13 -13
  195. package/dist/storage.js +12 -12
  196. package/dist/summarizer.js +7 -6
  197. package/dist/support-passport/index.js +49 -48
  198. package/dist/transfer/export-okf.js +13 -13
  199. package/dist/verified-recall.js +13 -13
  200. package/dist/who-knows-cli.js +14 -14
  201. package/dist/who-knows.js +13 -13
  202. package/package.json +2 -2
  203. package/src/backlog-scheduler.test.ts +104 -0
  204. package/src/fallback-llm-codex-subscription.ts +10 -1
  205. package/src/local-llm-json-schema-fallback.test.ts +315 -0
  206. package/src/local-llm-native-schema.ts +78 -0
  207. package/src/local-llm.ts +8 -9
  208. package/src/model-registry.ts +40 -0
  209. package/src/orchestration/backlog-scheduler.ts +32 -0
  210. package/dist/chunk-5MA7ZLPD.js.map +0 -1
  211. package/dist/chunk-5RW247F5.js.map +0 -1
  212. package/dist/chunk-YIJECSIX.js.map +0 -1
  213. /package/dist/{auto-sync-ANOJDQD4.js.map → auto-sync-XHSS3XPL.js.map} +0 -0
  214. /package/dist/{chunk-NHTEEGE4.js.map → chunk-233S3MXC.js.map} +0 -0
  215. /package/dist/{chunk-N7NAGECH.js.map → chunk-36B5VPRU.js.map} +0 -0
  216. /package/dist/{chunk-LC55ZXLR.js.map → chunk-3GGCMRO7.js.map} +0 -0
  217. /package/dist/{chunk-RZED7FAU.js.map → chunk-3M7YP42P.js.map} +0 -0
  218. /package/dist/{chunk-KPCTZB3U.js.map → chunk-3MBSD53O.js.map} +0 -0
  219. /package/dist/{chunk-VWHWWIFS.js.map → chunk-4DLZ2ITE.js.map} +0 -0
  220. /package/dist/{chunk-WN2DASTS.js.map → chunk-5BE3FLKL.js.map} +0 -0
  221. /package/dist/{chunk-45SFSQON.js.map → chunk-5IQL4N37.js.map} +0 -0
  222. /package/dist/{chunk-CIL4GHMD.js.map → chunk-6Q6AQ36B.js.map} +0 -0
  223. /package/dist/{chunk-XV7PJVQO.js.map → chunk-6RPPZL7W.js.map} +0 -0
  224. /package/dist/{chunk-EQ6EMJRG.js.map → chunk-6Y5ANLDH.js.map} +0 -0
  225. /package/dist/{chunk-V33ETCF6.js.map → chunk-7FFGWIBN.js.map} +0 -0
  226. /package/dist/{chunk-5QV6CE6K.js.map → chunk-B36ACJG7.js.map} +0 -0
  227. /package/dist/{chunk-2WDFLORC.js.map → chunk-BZTA7DR4.js.map} +0 -0
  228. /package/dist/{chunk-5XOCAJHC.js.map → chunk-C44DRDZM.js.map} +0 -0
  229. /package/dist/{chunk-UIFWZMO7.js.map → chunk-CLVILSBR.js.map} +0 -0
  230. /package/dist/{chunk-KH2HB3OW.js.map → chunk-COIQ5N4J.js.map} +0 -0
  231. /package/dist/{chunk-CU5N4RDI.js.map → chunk-DANFOVQG.js.map} +0 -0
  232. /package/dist/{chunk-FU2ZLXVN.js.map → chunk-DEGE32C3.js.map} +0 -0
  233. /package/dist/{chunk-LUXVW5UU.js.map → chunk-E22CQZ3H.js.map} +0 -0
  234. /package/dist/{chunk-DVDRKCZK.js.map → chunk-ELUG6NKQ.js.map} +0 -0
  235. /package/dist/{chunk-DLLQMNYQ.js.map → chunk-F3FNXE7C.js.map} +0 -0
  236. /package/dist/{chunk-YIXWY4OZ.js.map → chunk-FETPTCQZ.js.map} +0 -0
  237. /package/dist/{chunk-WPPAXTW6.js.map → chunk-FGUWCE5I.js.map} +0 -0
  238. /package/dist/{chunk-FDUCIUQ5.js.map → chunk-FJ2VJTGA.js.map} +0 -0
  239. /package/dist/{chunk-ENPJX3BB.js.map → chunk-FMFCQRDM.js.map} +0 -0
  240. /package/dist/{chunk-BNU5TQLR.js.map → chunk-FOQ7TW2T.js.map} +0 -0
  241. /package/dist/{chunk-DHQLVS7J.js.map → chunk-FP2AT4WL.js.map} +0 -0
  242. /package/dist/{chunk-DLZGSZVC.js.map → chunk-FYQUUIPI.js.map} +0 -0
  243. /package/dist/{chunk-XTN54NML.js.map → chunk-G3T6YMBO.js.map} +0 -0
  244. /package/dist/{chunk-MUH7RR6T.js.map → chunk-G5NH3SSX.js.map} +0 -0
  245. /package/dist/{chunk-G7I2RQ64.js.map → chunk-GCJA5KKT.js.map} +0 -0
  246. /package/dist/{chunk-A2BH2VE2.js.map → chunk-GWOFCHPN.js.map} +0 -0
  247. /package/dist/{chunk-TJ5YGCPV.js.map → chunk-GXVK754R.js.map} +0 -0
  248. /package/dist/{chunk-Y2ZGT4W7.js.map → chunk-HB5TNQMM.js.map} +0 -0
  249. /package/dist/{chunk-QYLEE4UQ.js.map → chunk-HCFNZWFB.js.map} +0 -0
  250. /package/dist/{chunk-F4ZHKDBW.js.map → chunk-HLWXCDUQ.js.map} +0 -0
  251. /package/dist/{chunk-62O7YWBR.js.map → chunk-HTDXNIO6.js.map} +0 -0
  252. /package/dist/{chunk-4RASUAN3.js.map → chunk-HXFIILGF.js.map} +0 -0
  253. /package/dist/{chunk-6EKP7BJW.js.map → chunk-I4LJJ44E.js.map} +0 -0
  254. /package/dist/{chunk-STDAR7M7.js.map → chunk-IBQ7LGUJ.js.map} +0 -0
  255. /package/dist/{chunk-PUP7NTNB.js.map → chunk-IRFQKR4Y.js.map} +0 -0
  256. /package/dist/{chunk-BEQU6QGW.js.map → chunk-IVXOYE43.js.map} +0 -0
  257. /package/dist/{chunk-WXPBDEMW.js.map → chunk-JDQEQE2R.js.map} +0 -0
  258. /package/dist/{chunk-CAVXVGYK.js.map → chunk-KAED7IBB.js.map} +0 -0
  259. /package/dist/{chunk-OFOV6TTZ.js.map → chunk-KNZDGZSY.js.map} +0 -0
  260. /package/dist/{chunk-KFZ3A2EA.js.map → chunk-L4QYW2HO.js.map} +0 -0
  261. /package/dist/{chunk-IXBIL5WY.js.map → chunk-LJUQPT5G.js.map} +0 -0
  262. /package/dist/{chunk-4SOISEZ3.js.map → chunk-MBENRPMY.js.map} +0 -0
  263. /package/dist/{chunk-OKBGLAAI.js.map → chunk-N6GEGRCT.js.map} +0 -0
  264. /package/dist/{chunk-U2A56LLF.js.map → chunk-OBQ2NZAR.js.map} +0 -0
  265. /package/dist/{chunk-WGRAB3KB.js.map → chunk-ORVPS4ZW.js.map} +0 -0
  266. /package/dist/{chunk-PFUXPTBT.js.map → chunk-P3AQ2YSX.js.map} +0 -0
  267. /package/dist/{chunk-DE4U5PTV.js.map → chunk-P4TEQSIZ.js.map} +0 -0
  268. /package/dist/{chunk-DQVT45LZ.js.map → chunk-P7HNMNN2.js.map} +0 -0
  269. /package/dist/{chunk-ZG4GNPRE.js.map → chunk-PBE7NFB5.js.map} +0 -0
  270. /package/dist/{chunk-T64HVBAP.js.map → chunk-PLGBPFEO.js.map} +0 -0
  271. /package/dist/{chunk-GO2GCJ7S.js.map → chunk-R24RYSQX.js.map} +0 -0
  272. /package/dist/{chunk-YJX3K5LK.js.map → chunk-RXGFITWS.js.map} +0 -0
  273. /package/dist/{chunk-JEX2JL3U.js.map → chunk-SHVLNI4L.js.map} +0 -0
  274. /package/dist/{chunk-LIGA5KHG.js.map → chunk-SY4AFWUZ.js.map} +0 -0
  275. /package/dist/{chunk-GI47WZWA.js.map → chunk-SYDPJUFR.js.map} +0 -0
  276. /package/dist/{chunk-55NKJDKX.js.map → chunk-SZBZOUHR.js.map} +0 -0
  277. /package/dist/{chunk-UEY5TPEE.js.map → chunk-T6C3G67T.js.map} +0 -0
  278. /package/dist/{chunk-E3NBMTTX.js.map → chunk-TLTBACYX.js.map} +0 -0
  279. /package/dist/{chunk-AVVCPA7U.js.map → chunk-UCPH56YX.js.map} +0 -0
  280. /package/dist/{chunk-HPCWJMMQ.js.map → chunk-URS56HGW.js.map} +0 -0
  281. /package/dist/{chunk-GJOBCNST.js.map → chunk-VEQVXNWR.js.map} +0 -0
  282. /package/dist/{chunk-2H3SITYD.js.map → chunk-VEWTHVX2.js.map} +0 -0
  283. /package/dist/{chunk-K5Y42U2P.js.map → chunk-VPEMGBTI.js.map} +0 -0
  284. /package/dist/{chunk-Q2QPHGEC.js.map → chunk-VYOAYFDV.js.map} +0 -0
  285. /package/dist/{chunk-5JBVPJCT.js.map → chunk-WIAXVBQH.js.map} +0 -0
  286. /package/dist/{chunk-KWUMXJN7.js.map → chunk-X53HJENJ.js.map} +0 -0
  287. /package/dist/{chunk-KY3KJUNN.js.map → chunk-XC7OYOQC.js.map} +0 -0
  288. /package/dist/{chunk-43FLJLT2.js.map → chunk-Y5HZFIQO.js.map} +0 -0
  289. /package/dist/{chunk-DOJBV6WR.js.map → chunk-YK6SFDP2.js.map} +0 -0
  290. /package/dist/{chunk-WBMT3C6A.js.map → chunk-Z3CKK5RR.js.map} +0 -0
  291. /package/dist/{chunk-RQHIN3PY.js.map → chunk-ZG57BEUS.js.map} +0 -0
  292. /package/dist/{chunk-MOJ4UDA3.js.map → chunk-ZZSFRWKD.js.map} +0 -0
  293. /package/dist/{first-start-migration-A6PHIBUQ.js.map → first-start-migration-QVD22WWS.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: \"recall_why\", operation: \"recall_why\" },\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: \"deep_recall\", operation: \"deep_recall\" },\n { tool: \"memory_expand\", operation: \"memory_expand\" },\n { tool: \"memory_traverse\", operation: \"memory_traverse\" },\n { tool: \"memory_ls\", operation: \"memory_ls\" },\n { tool: \"memory_tree\", operation: \"memory_tree\" },\n { tool: \"memory_find\", operation: \"memory_find\" },\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/recall/why\", operation: \"recall_why\" },\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: \"POST\", pathname: \"/engram/v1/recall/deep\", operation: \"deep_recall\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/expand\", operation: \"memory_expand\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/traverse\", operation: \"memory_traverse\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/ls\", operation: \"memory_ls\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/tree\", operation: \"memory_tree\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/find\", operation: \"memory_find\" },\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/briefing\", operation: \"briefing\" },\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;AAAA,EAC9D,EAAE,MAAM,uBAAuB,WAAW,sBAAsB;AAAA,EAChE,EAAE,MAAM,eAAe,WAAW,cAAc;AAAA,EAChD,EAAE,MAAM,cAAc,WAAW,aAAa;AAAA,EAC9C,EAAE,MAAM,aAAa,WAAW,YAAY;AAAA,EAC5C,EAAE,MAAM,wBAAwB,WAAW,uBAAuB;AAAA,EAClE,EAAE,MAAM,oBAAoB,WAAW,mBAAmB;AAAA,EAC1D,EAAE,MAAM,kBAAkB,WAAW,iBAAiB;AAAA,EACtD,EAAE,MAAM,kBAAkB,WAAW,iBAAiB;AAAA,EACtD,EAAE,MAAM,qBAAqB,WAAW,oBAAoB;AAAA,EAC5D,EAAE,MAAM,uBAAuB,WAAW,sBAAsB;AAAA,EAChE,EAAE,MAAM,mBAAmB,WAAW,kB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U,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: \"recall_why\", operation: \"recall_why\" },\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: \"deep_recall\", operation: \"deep_recall\" },\n { tool: \"memory_expand\", operation: \"memory_expand\" },\n { tool: \"memory_traverse\", operation: \"memory_traverse\" },\n { tool: \"memory_ls\", operation: \"memory_ls\" },\n { tool: \"memory_tree\", operation: \"memory_tree\" },\n { tool: \"memory_find\", operation: \"memory_find\" },\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/recall/why\", operation: \"recall_why\" },\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: \"POST\", pathname: \"/engram/v1/recall/deep\", operation: \"deep_recall\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/expand\", operation: \"memory_expand\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/traverse\", operation: \"memory_traverse\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/ls\", operation: \"memory_ls\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/tree\", operation: \"memory_tree\" },\n { method: \"POST\", pathname: \"/engram/v1/memory/find\", operation: \"memory_find\" },\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/briefing\", operation: \"briefing\" },\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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,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":[]}
@@ -45,22 +45,22 @@ import "./chunk-ZCUTSMR2.js";
45
45
  import "./chunk-QDW3E4RD.js";
46
46
  import "./chunk-6L63IN3M.js";
47
47
  import "./chunk-ZJP66Q4I.js";
48
- import "./chunk-45SFSQON.js";
49
- import "./chunk-QGVCFVX6.js";
48
+ import "./chunk-5IQL4N37.js";
50
49
  import "./chunk-UHVXE24Y.js";
50
+ import "./chunk-QGVCFVX6.js";
51
51
  import "./chunk-IGOW4TJE.js";
52
52
  import "./chunk-G6OFEGUR.js";
53
53
  import "./chunk-7PMOCQOL.js";
54
- import "./chunk-JEX2JL3U.js";
55
- import "./chunk-U2A56LLF.js";
56
- import "./chunk-DOJBV6WR.js";
57
- import "./chunk-PFUXPTBT.js";
58
- import "./chunk-CYEPCZN5.js";
59
- import "./chunk-DLZGSZVC.js";
54
+ import "./chunk-SHVLNI4L.js";
55
+ import "./chunk-OBQ2NZAR.js";
60
56
  import "./chunk-OVZIYLBZ.js";
61
- import "./chunk-WNEVEMJ3.js";
62
57
  import "./chunk-EXYT52NR.js";
58
+ import "./chunk-YK6SFDP2.js";
59
+ import "./chunk-P3AQ2YSX.js";
60
+ import "./chunk-CYEPCZN5.js";
61
+ import "./chunk-FYQUUIPI.js";
63
62
  import "./chunk-Y5NLBXPV.js";
63
+ import "./chunk-WNEVEMJ3.js";
64
64
  import "./chunk-TFA6HPOA.js";
65
65
  import "./chunk-F4TWWUMP.js";
66
66
  import "./chunk-72A4L5JJ.js";
@@ -73,7 +73,7 @@ import "./chunk-S2HLHAZ4.js";
73
73
  import "./chunk-DM2T26WE.js";
74
74
  import "./chunk-LDXUBPMO.js";
75
75
  import "./chunk-FF6N7BXC.js";
76
- import "./chunk-WXPBDEMW.js";
76
+ import "./chunk-JDQEQE2R.js";
77
77
  import "./chunk-AAD2ZS6P.js";
78
78
  import "./chunk-BV2BRHD4.js";
79
79
  import "./chunk-ZIKENA2C.js";
@@ -105,11 +105,11 @@ import "./chunk-C64XATK7.js";
105
105
  import "./chunk-42JKGUFJ.js";
106
106
  import "./chunk-23G5P7TA.js";
107
107
  import "./chunk-4KLQI3L2.js";
108
- import "./chunk-AVVCPA7U.js";
108
+ import "./chunk-UCPH56YX.js";
109
109
  import "./chunk-I55KAVET.js";
110
110
  import "./chunk-L2EXJQJP.js";
111
111
  import "./chunk-45GF7Y3V.js";
112
- import "./chunk-YIJECSIX.js";
112
+ import "./chunk-DJDJBMFX.js";
113
113
  import "./chunk-E2AWJ7KQ.js";
114
114
  import "./chunk-W5BIQOAJ.js";
115
115
  import "./chunk-HADD45AR.js";
@@ -145,15 +145,15 @@ import "./chunk-BTNNL7ZW.js";
145
145
  import "./chunk-JDSVLVCG.js";
146
146
  import "./chunk-5GKPFL3S.js";
147
147
  import "./chunk-JAKIDQB2.js";
148
- import "./chunk-UIFWZMO7.js";
148
+ import "./chunk-CLVILSBR.js";
149
149
  import "./chunk-UI3NYK34.js";
150
150
  import "./chunk-XXR4A33N.js";
151
151
  import "./chunk-UWMZT2TY.js";
152
- import "./chunk-F4ZHKDBW.js";
153
- import "./chunk-WN2DASTS.js";
152
+ import "./chunk-HLWXCDUQ.js";
153
+ import "./chunk-5BE3FLKL.js";
154
+ import "./chunk-63LFM77Z.js";
154
155
  import "./chunk-LDWE7OZS.js";
155
156
  import "./chunk-GCGJW34D.js";
156
- import "./chunk-63LFM77Z.js";
157
157
  import "./chunk-XZ66U5M3.js";
158
158
  import "./chunk-SWRRZNHM.js";
159
159
  import "./chunk-JNA7LFMQ.js";
@@ -3,7 +3,10 @@ import {
3
3
  AdapterRegistry,
4
4
  GrokAdapter,
5
5
  OpenCodeAdapter
6
- } from "../chunk-XTN54NML.js";
6
+ } from "../chunk-G3T6YMBO.js";
7
+ import {
8
+ ReplitAdapter
9
+ } from "../chunk-SI36RWC3.js";
7
10
  import {
8
11
  ClaudeCodeAdapter
9
12
  } from "../chunk-3JKYQBLC.js";
@@ -13,9 +16,6 @@ import {
13
16
  import {
14
17
  HermesAdapter
15
18
  } from "../chunk-HCAGBFE7.js";
16
- import {
17
- ReplitAdapter
18
- } from "../chunk-SI36RWC3.js";
19
19
  import "../chunk-NJAIR57U.js";
20
20
  import "../chunk-PZ5AY32C.js";
21
21
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AdapterRegistry
3
- } from "../chunk-XTN54NML.js";
3
+ } from "../chunk-G3T6YMBO.js";
4
+ import "../chunk-SI36RWC3.js";
4
5
  import "../chunk-3JKYQBLC.js";
5
6
  import "../chunk-7RKSJVOQ.js";
6
7
  import "../chunk-HCAGBFE7.js";
7
- import "../chunk-SI36RWC3.js";
8
8
  import "../chunk-NJAIR57U.js";
9
9
  import "../chunk-PZ5AY32C.js";
10
10
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  dateInTimezone,
3
3
  defaultTimezone
4
- } from "./chunk-5QV6CE6K.js";
5
- import "./chunk-TJ5YGCPV.js";
4
+ } from "./chunk-B36ACJG7.js";
5
+ import "./chunk-GXVK754R.js";
6
6
  import "./chunk-UOBPK2OS.js";
7
7
  import "./chunk-CIO7GCWE.js";
8
8
  import "./chunk-YN2DQ2D6.js";
@@ -13,11 +13,11 @@ import {
13
13
  } from "./chunk-V7IZKJI3.js";
14
14
  import "./chunk-QDW3E4RD.js";
15
15
  import "./chunk-UHVXE24Y.js";
16
- import "./chunk-AVVCPA7U.js";
16
+ import "./chunk-UCPH56YX.js";
17
17
  import "./chunk-I55KAVET.js";
18
18
  import "./chunk-L2EXJQJP.js";
19
19
  import "./chunk-45GF7Y3V.js";
20
- import "./chunk-YIJECSIX.js";
20
+ import "./chunk-DJDJBMFX.js";
21
21
  import "./chunk-E2AWJ7KQ.js";
22
22
  import "./chunk-YCVB7X56.js";
23
23
  import "./chunk-YBA52OKG.js";
@@ -98,4 +98,4 @@ function startWearablesAutoSync(settings, deps) {
98
98
  export {
99
99
  startWearablesAutoSync
100
100
  };
101
- //# sourceMappingURL=auto-sync-ANOJDQD4.js.map
101
+ //# sourceMappingURL=auto-sync-XHSS3XPL.js.map
package/dist/briefing.js CHANGED
@@ -18,26 +18,26 @@ import {
18
18
  renderBriefingMarkdown,
19
19
  resolveBriefingSaveDir,
20
20
  validateBriefingFormat
21
- } from "./chunk-WPPAXTW6.js";
21
+ } from "./chunk-FGUWCE5I.js";
22
22
  import "./chunk-X2KO4FK5.js";
23
23
  import "./chunk-GZFKCLRC.js";
24
24
  import "./chunk-EKUI7I2X.js";
25
- import "./chunk-45SFSQON.js";
26
- import "./chunk-QGVCFVX6.js";
25
+ import "./chunk-5IQL4N37.js";
27
26
  import "./chunk-UHVXE24Y.js";
27
+ import "./chunk-QGVCFVX6.js";
28
28
  import "./chunk-IGOW4TJE.js";
29
29
  import "./chunk-G6OFEGUR.js";
30
30
  import "./chunk-7PMOCQOL.js";
31
- import "./chunk-JEX2JL3U.js";
32
- import "./chunk-U2A56LLF.js";
33
- import "./chunk-DOJBV6WR.js";
34
- import "./chunk-PFUXPTBT.js";
35
- import "./chunk-CYEPCZN5.js";
36
- import "./chunk-DLZGSZVC.js";
31
+ import "./chunk-SHVLNI4L.js";
32
+ import "./chunk-OBQ2NZAR.js";
37
33
  import "./chunk-OVZIYLBZ.js";
38
- import "./chunk-WNEVEMJ3.js";
39
34
  import "./chunk-EXYT52NR.js";
35
+ import "./chunk-YK6SFDP2.js";
36
+ import "./chunk-P3AQ2YSX.js";
37
+ import "./chunk-CYEPCZN5.js";
38
+ import "./chunk-FYQUUIPI.js";
40
39
  import "./chunk-Y5NLBXPV.js";
40
+ import "./chunk-WNEVEMJ3.js";
41
41
  import "./chunk-TFA6HPOA.js";
42
42
  import "./chunk-F4TWWUMP.js";
43
43
  import "./chunk-72A4L5JJ.js";
@@ -50,7 +50,7 @@ import "./chunk-S2HLHAZ4.js";
50
50
  import "./chunk-DM2T26WE.js";
51
51
  import "./chunk-LDXUBPMO.js";
52
52
  import "./chunk-FF6N7BXC.js";
53
- import "./chunk-WXPBDEMW.js";
53
+ import "./chunk-JDQEQE2R.js";
54
54
  import "./chunk-AAD2ZS6P.js";
55
55
  import "./chunk-BV2BRHD4.js";
56
56
  import "./chunk-ZIKENA2C.js";
@@ -82,11 +82,11 @@ import "./chunk-C64XATK7.js";
82
82
  import "./chunk-42JKGUFJ.js";
83
83
  import "./chunk-23G5P7TA.js";
84
84
  import "./chunk-4KLQI3L2.js";
85
- import "./chunk-AVVCPA7U.js";
85
+ import "./chunk-UCPH56YX.js";
86
86
  import "./chunk-I55KAVET.js";
87
87
  import "./chunk-L2EXJQJP.js";
88
88
  import "./chunk-45GF7Y3V.js";
89
- import "./chunk-YIJECSIX.js";
89
+ import "./chunk-DJDJBMFX.js";
90
90
  import "./chunk-E2AWJ7KQ.js";
91
91
  import "./chunk-W5BIQOAJ.js";
92
92
  import "./chunk-HADD45AR.js";
package/dist/buffer.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  SmartBuffer
3
- } from "./chunk-UEY5TPEE.js";
3
+ } from "./chunk-T6C3G67T.js";
4
4
  import "./chunk-MPDLLLOG.js";
5
5
  import "./chunk-H3FZVNRN.js";
6
6
  import "./chunk-KASJJGRG.js";
7
- import "./chunk-DE4U5PTV.js";
8
- import "./chunk-43FLJLT2.js";
7
+ import "./chunk-P4TEQSIZ.js";
8
+ import "./chunk-Y5HZFIQO.js";
9
9
  import "./chunk-CSAKJVXW.js";
10
10
  import "./chunk-K2XUWZBM.js";
11
11
  import "./chunk-OD4FM2U7.js";
@@ -4,18 +4,19 @@ import {
4
4
  import "./chunk-QW27DOHG.js";
5
5
  import {
6
6
  LocalLlmClient
7
- } from "./chunk-5RW247F5.js";
7
+ } from "./chunk-AY2UK5XK.js";
8
+ import "./chunk-QEDLJDHP.js";
8
9
  import "./chunk-U4LUIE6Y.js";
9
10
  import "./chunk-T6OZW2WR.js";
10
11
  import "./chunk-5YQXWVCP.js";
11
- import "./chunk-QEDLJDHP.js";
12
+ import "./chunk-MJFL75J6.js";
12
13
  import {
13
14
  FallbackLlmClient
14
- } from "./chunk-AVVCPA7U.js";
15
+ } from "./chunk-UCPH56YX.js";
15
16
  import "./chunk-I55KAVET.js";
16
17
  import "./chunk-L2EXJQJP.js";
17
18
  import "./chunk-45GF7Y3V.js";
18
- import "./chunk-YIJECSIX.js";
19
+ import "./chunk-DJDJBMFX.js";
19
20
  import "./chunk-E2AWJ7KQ.js";
20
21
  import "./chunk-TOTT6S2V.js";
21
22
  import "./chunk-YBA52OKG.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveLocalLlmCapabilities } from \"./capabilities.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { listJsonFiles } from \"./json-store.js\";\nimport { isMacOsReplicationJunkBasename } from \"./utils/macos-replication-junk.js\";\nimport { LocalLlmClient } from \"./local-llm.js\";\nimport { log } from \"./logger.js\";\nimport { writeFileAtomically } from \"./maintenance/atomic-file.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n /**\n * Weeks whose rule reinforcement is already committed. A retry of any of\n * these weeks must not increment `evidenceCount` again. Older indexes\n * persisted a single `appliedWeekId`; reads fold it into this list.\n */\n appliedWeekIds?: string[];\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\n/** Week ids are short (`YYYY-Www`). Longer values are not used as stamps. */\nconst MAX_APPLIED_WEEK_ID_LENGTH = 32;\n\nexport function appliedCalibrationWeekId(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0 || trimmed.length > MAX_APPLIED_WEEK_ID_LENGTH) return undefined;\n return trimmed;\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n const appliedWeekIds = normalizeAppliedWeekIds(raw.appliedWeekIds, raw.appliedWeekId);\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nfunction normalizeAppliedWeekIds(list: unknown, additional: unknown): string[] {\n const weeks: string[] = [];\n if (Array.isArray(list)) {\n for (const entry of list) {\n const week = appliedCalibrationWeekId(entry);\n if (week && !weeks.includes(week)) weeks.push(week);\n }\n }\n const extra = appliedCalibrationWeekId(additional);\n if (extra && !weeks.includes(extra)) weeks.push(extra);\n return weeks;\n}\n\n/**\n * Attach the week stamp to the index that will be written with the reinforced\n * rules. The stamp and the evidence increment commit together. Every\n * previously applied week stays in the list so an out-of-order retry of an\n * older week is still recognized as already applied.\n */\nexport function withAppliedCalibrationWeek(\n index: CalibrationIndex,\n idempotencyKey: string | undefined,\n): CalibrationIndex {\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, idempotencyKey);\n return {\n rules: index.rules,\n updatedAt: index.updatedAt,\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, undefined);\n const stamped: CalibrationIndex = {\n rules: index.rules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n await writeFileAtomically(calibrationIndexPath(memoryDir), JSON.stringify(stamped, null, 2));\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\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 parseEvidenceIds(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 nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => !isMacOsReplicationJunkBasename(f) && f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => !isMacOsReplicationJunkBasename(f) && f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\ninterface CalibrationChatClient {\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: {\n temperature?: number;\n maxTokens?: number;\n agentId?: string;\n modelChain?: AgentPersonaModelConfig;\n }\n ): Promise<{ content?: string | null } | null>;\n}\n\ninterface CalibrationLlmOptions {\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n /** Plugin config. Supplies `localLlm*` settings when the gateway chain is empty. */\n pluginConfig?: PluginConfig;\n}\n\nfunction resolveCalibrationChatClient(options: CalibrationLlmOptions): CalibrationChatClient | null {\n const gateway = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n return gateway;\n }\n const pluginConfig = options.pluginConfig;\n if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {\n log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);\n const local = new LocalLlmClient(pluginConfig);\n return {\n chatCompletion(messages, chatOptions) {\n return local.chatCompletion(messages, {\n temperature: chatOptions?.temperature,\n maxTokens: chatOptions?.maxTokens,\n });\n },\n };\n }\n log.warn(\"[calibration] no LLM available — skipping consolidation\");\n return null;\n}\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: CalibrationChatClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText =\n existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n {\n role: \"user\",\n content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}`,\n },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain }\n );\n\n if (!response?.content) return [];\n\n try {\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 if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\")\n .update(condition + calibration)\n .digest(\"hex\")\n .slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Options weekly compounding passes into calibration. Gateway agent and task\n * chain fields stay limited to `modelSource: \"gateway\"`. `pluginConfig` carries\n * the `localLlm*` settings used when that chain is empty.\n */\nexport function calibrationConsolidationInput(config: PluginConfig): {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig: PluginConfig;\n} {\n const gateway = config.modelSource === \"gateway\";\n return {\n memoryDir: config.memoryDir,\n gatewayConfig: config.gatewayConfig,\n gatewayAgentId: gateway ? (config.gatewayAgentId || undefined) : undefined,\n modelChain: gateway ? config.taskModelChain : undefined,\n workspaceDir: config.workspaceDir,\n pluginConfig: config,\n };\n}\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n /**\n * When set, a week whose reinforcement is already in the index is returned\n * as-is. Weekly synthesis passes the ISO week id so a retry after a later\n * artifact failure does not count the same corrections twice.\n */\n idempotencyKey?: string;\n}): Promise<CalibrationRule[]> {\n try {\n const idempotencyKey = appliedCalibrationWeekId(options.idempotencyKey);\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n if (idempotencyKey && (existingIndex.appliedWeekIds ?? []).includes(idempotencyKey)) {\n log.debug(`[calibration] week ${idempotencyKey} already applied — skipping`);\n return existingIndex.rules;\n }\n\n const llm = resolveCalibrationChatClient(options);\n if (!llm) return [];\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.info(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const newRules = await synthesizeCalibrationRules(\n corrections,\n llm,\n existingIndex.rules,\n options.gatewayAgentId,\n options.modelChain\n );\n if (newRules.length === 0) {\n log.info(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, withAppliedCalibrationWeek({\n rules: allRules,\n updatedAt: existingIndex.updatedAt,\n totalCorrectionsAnalyzed: corrections.length,\n appliedWeekIds: existingIndex.appliedWeekIds,\n }, idempotencyKey));\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(\n `[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`\n );\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n pluginConfig: options.pluginConfig,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n): Promise<CalibrationRule[]> {\n const index = await readCalibrationIndex(memoryDir);\n return index.rules;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,gBAAgB;AAChC,OAAO,UAAU;AAyCjB,SAAS,eAAe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5B,QAAM,QAAQ,MAAM,qBAAqB,SAAS;AAClD,SAAO,MAAM;AACf;","names":[]}
1
+ {"version":3,"sources":["../src/calibration.ts"],"sourcesContent":["/**\n * calibration.ts — Prediction-Error-Driven Model-User Calibration\n *\n * Analyzes patterns in user corrections to identify systematic miscalibration\n * between the model's predictions and the user's actual expectations.\n * During consolidation, replays chains of similar corrections through an LLM\n * to synthesize CalibrationRules that adjust model behavior for this specific user.\n *\n * Inspired by:\n * - Cerebellar motor calibration (prediction errors drive lasting adjustments)\n * - Temporal difference learning (dopamine signals prediction error)\n * - Tesla FSD shadow mode (divergence between prediction and reality = training signal)\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveLocalLlmCapabilities } from \"./capabilities.js\";\nimport { OUTPUT_LANGUAGE_POLICY } from \"./extraction-prompt.js\";\nimport { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { listJsonFiles } from \"./json-store.js\";\nimport { isMacOsReplicationJunkBasename } from \"./utils/macos-replication-junk.js\";\nimport { LocalLlmClient } from \"./local-llm.js\";\nimport { log } from \"./logger.js\";\nimport { writeFileAtomically } from \"./maintenance/atomic-file.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, PluginConfig } from \"./types.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CalibrationRule {\n id: string;\n ruleType: \"model_tendency\" | \"user_expectation\" | \"scope_boundary\" | \"verification_required\";\n condition: string;\n modelTendency: string;\n userExpectation: string;\n calibration: string;\n confidence: number;\n evidenceCount: number;\n evidenceCorrectionIds: string[];\n createdAt: string;\n lastReinforcedAt: string;\n}\n\nexport interface CalibrationIndex {\n rules: CalibrationRule[];\n updatedAt: string;\n totalCorrectionsAnalyzed: number;\n /**\n * Weeks whose rule reinforcement is already committed. A retry of any of\n * these weeks must not increment `evidenceCount` again. Older indexes\n * persisted a single `appliedWeekId`; reads fold it into this list.\n */\n appliedWeekIds?: string[];\n}\n\n// ─── Storage ─────────────────────────────────────────────────────────────────\n\nfunction calibrationDir(memoryDir: string): string {\n return path.join(memoryDir, \"state\", \"calibration\");\n}\n\nfunction calibrationIndexPath(memoryDir: string): string {\n return path.join(calibrationDir(memoryDir), \"calibration-index.json\");\n}\n\n/** Week ids are short (`YYYY-Www`). Longer values are not used as stamps. */\nconst MAX_APPLIED_WEEK_ID_LENGTH = 32;\n\nexport function appliedCalibrationWeekId(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0 || trimmed.length > MAX_APPLIED_WEEK_ID_LENGTH) return undefined;\n return trimmed;\n}\n\nexport async function readCalibrationIndex(memoryDir: string): Promise<CalibrationIndex> {\n try {\n const raw = JSON.parse(await readFile(calibrationIndexPath(memoryDir), \"utf8\"));\n const appliedWeekIds = normalizeAppliedWeekIds(raw.appliedWeekIds, raw.appliedWeekId);\n return {\n rules: Array.isArray(raw.rules) ? raw.rules : [],\n updatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : new Date().toISOString(),\n totalCorrectionsAnalyzed: typeof raw.totalCorrectionsAnalyzed === \"number\" ? raw.totalCorrectionsAnalyzed : 0,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n } catch {\n return { rules: [], updatedAt: new Date().toISOString(), totalCorrectionsAnalyzed: 0 };\n }\n}\n\nfunction normalizeAppliedWeekIds(list: unknown, additional: unknown): string[] {\n const weeks: string[] = [];\n if (Array.isArray(list)) {\n for (const entry of list) {\n const week = appliedCalibrationWeekId(entry);\n if (week && !weeks.includes(week)) weeks.push(week);\n }\n }\n const extra = appliedCalibrationWeekId(additional);\n if (extra && !weeks.includes(extra)) weeks.push(extra);\n return weeks;\n}\n\n/**\n * Attach the week stamp to the index that will be written with the reinforced\n * rules. The stamp and the evidence increment commit together. Every\n * previously applied week stays in the list so an out-of-order retry of an\n * older week is still recognized as already applied.\n */\nexport function withAppliedCalibrationWeek(\n index: CalibrationIndex,\n idempotencyKey: string | undefined,\n): CalibrationIndex {\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, idempotencyKey);\n return {\n rules: index.rules,\n updatedAt: index.updatedAt,\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n}\n\nasync function writeCalibrationIndex(memoryDir: string, index: CalibrationIndex): Promise<void> {\n const dir = calibrationDir(memoryDir);\n await mkdir(dir, { recursive: true });\n const appliedWeekIds = normalizeAppliedWeekIds(index.appliedWeekIds, undefined);\n const stamped: CalibrationIndex = {\n rules: index.rules,\n updatedAt: new Date().toISOString(),\n totalCorrectionsAnalyzed: index.totalCorrectionsAnalyzed,\n ...(appliedWeekIds.length > 0 ? { appliedWeekIds } : {}),\n };\n await writeFileAtomically(calibrationIndexPath(memoryDir), JSON.stringify(stamped, null, 2));\n}\n\n// ─── Correction Reading ──────────────────────────────────────────────────────\n\nexport interface CorrectionMemory {\n id: string;\n content: string;\n created: string;\n confidence: number;\n entityRefs: string[];\n tags: string[];\n}\n\nconst CALIBRATION_RULE_TYPES = new Set([\n \"model_tendency\",\n \"user_expectation\",\n \"scope_boundary\",\n \"verification_required\",\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 parseEvidenceIds(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 nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Exported for entity-contamination R-11 regression coverage (#682\n * PR 2/3 — codex review). Tests can drive the real correction-reading\n * path instead of duplicating the regex inline, so calibration parser\n * regressions surface via the contamination suite.\n */\nexport async function readCalibrationCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrections(memoryDir: string): Promise<CorrectionMemory[]> {\n return readCorrectionsImpl(memoryDir);\n}\n\nasync function readCorrectionsImpl(memoryDir: string): Promise<CorrectionMemory[]> {\n const correctionsDir = path.join(memoryDir, \"corrections\");\n const files = await listJsonFiles(correctionsDir).catch(() => {\n // Corrections might be in facts/ directories too\n return [] as string[];\n });\n\n // Also scan facts directories for correction-category files\n const factsDir = path.join(memoryDir, \"facts\");\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const dayDirs = (await readdir(factsDir)).filter((d: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n for (const day of dayDirs) {\n const dayPath = path.join(factsDir, day);\n const dayFiles = (await readdir(dayPath))\n .filter((f: string) => !isMacOsReplicationJunkBasename(f) && f.startsWith(\"correction-\") && f.endsWith(\".md\"))\n .map((f: string) => path.join(dayPath, f));\n files.push(...dayFiles);\n }\n } catch {\n // facts dir might not exist\n }\n\n // Also check the dedicated corrections directory\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const corrFiles = (await readdir(correctionsDir))\n .filter((f: string) => !isMacOsReplicationJunkBasename(f) && f.endsWith(\".md\"))\n .map((f: string) => path.join(correctionsDir, f));\n files.push(...corrFiles);\n } catch {\n // corrections dir might not exist\n }\n\n const corrections: CorrectionMemory[] = [];\n const seen = new Set<string>();\n\n for (const filePath of files) {\n try {\n const raw = await readFile(filePath, \"utf8\");\n\n // Parse frontmatter\n const fmMatch = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n if (!fmMatch) continue;\n\n const content = fmMatch[2].trim();\n if (!content || content.length < 10) continue;\n\n // Extract id from frontmatter\n const idMatch = fmMatch[1].match(/^id:\\s*(.+)$/m);\n const id = idMatch?.[1]?.trim() ?? path.basename(filePath, \".md\");\n\n if (seen.has(id)) continue;\n seen.add(id);\n\n const confMatch = fmMatch[1].match(/^confidence:\\s*(.+)$/m);\n const confidence = confMatch ? parseFloat(confMatch[1]) : 0.9;\n\n const entityMatch = fmMatch[1].match(/^entityRef:\\s*(.+)$/m);\n const entityRefs = entityMatch ? [entityMatch[1].trim()] : [];\n\n corrections.push({ id, content, created: \"\", confidence, entityRefs, tags: [] });\n } catch {\n // skip unparseable files\n }\n }\n\n return corrections;\n}\n\n// ─── LLM-Assisted Clustering and Replay ──────────────────────────────────────\n\nexport const CLUSTER_PROMPT = `You are analyzing user corrections to an AI assistant. Each correction represents a moment where the assistant's prediction of what the user wanted was WRONG.\n\nYour job: Group these corrections into clusters where the SAME TYPE of misunderstanding is happening. Then for each cluster, synthesize a CalibrationRule.\n\nA CalibrationRule describes:\n- condition: When does this type of mistake happen?\n- modelTendency: What does the model tend to assume or do wrong?\n- userExpectation: What does the user actually want instead?\n- calibration: How should the model adjust its behavior?\n- ruleType: One of \"model_tendency\", \"user_expectation\", \"scope_boundary\", \"verification_required\"\n\nFocus on PATTERNS, not individual corrections. A cluster needs at least 2 corrections to be worth a rule.\n${OUTPUT_LANGUAGE_POLICY}\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\n \"ruleType\": \"model_tendency\",\n \"condition\": \"When discussing project scope or task boundaries\",\n \"modelTendency\": \"The model tends to assume broader scope than the user intends\",\n \"userExpectation\": \"The user prefers narrow, specific task definitions and wants to be asked before scope expansion\",\n \"calibration\": \"When uncertain about scope, ask for clarification rather than assuming. Default to the narrower interpretation.\",\n \"confidence\": 0.85,\n \"evidenceIds\": [\"correction-id-1\", \"correction-id-2\"]\n }\n ]\n}`;\n\ninterface CalibrationChatClient {\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: {\n temperature?: number;\n maxTokens?: number;\n agentId?: string;\n modelChain?: AgentPersonaModelConfig;\n }\n ): Promise<{ content?: string | null } | null>;\n}\n\ninterface CalibrationLlmOptions {\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n /** Plugin config. Supplies `localLlm*` settings when the gateway chain is empty. */\n pluginConfig?: PluginConfig;\n}\n\nfunction resolveCalibrationChatClient(options: CalibrationLlmOptions): CalibrationChatClient | null {\n const gateway = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n if (gateway.isAvailable({ agentId: options.gatewayAgentId, modelChain: options.modelChain })) {\n return gateway;\n }\n const pluginConfig = options.pluginConfig;\n if (pluginConfig && resolveLocalLlmCapabilities(pluginConfig).localLlm) {\n log.info(`[calibration] using configured local LLM (model=${pluginConfig.localLlmModel})`);\n const local = new LocalLlmClient(pluginConfig);\n return {\n chatCompletion(messages, chatOptions) {\n return local.chatCompletion(messages, {\n temperature: chatOptions?.temperature,\n maxTokens: chatOptions?.maxTokens,\n });\n },\n };\n }\n log.warn(\"[calibration] no LLM available — skipping consolidation\");\n return null;\n}\n\nexport async function synthesizeCalibrationRules(\n corrections: CorrectionMemory[],\n llm: CalibrationChatClient,\n existingRules: CalibrationRule[],\n agentId?: string,\n modelChain?: AgentPersonaModelConfig\n): Promise<CalibrationRule[]> {\n if (corrections.length < 2) return [];\n\n // Format corrections for the LLM\n const correctionText = corrections\n .slice(0, 50) // limit to avoid huge prompts\n .map((c, i) => `[${c.id}] ${c.content}`)\n .join(\"\\n\\n\");\n\n const existingRulesText =\n existingRules.length > 0\n ? `\\n\\nExisting calibration rules (avoid duplicating these):\\n${existingRules.map((r) => `- ${r.condition}: ${r.calibration}`).join(\"\\n\")}`\n : \"\";\n\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CLUSTER_PROMPT },\n {\n role: \"user\",\n content: `Here are ${corrections.length} corrections from this user:\\n\\n${correctionText}${existingRulesText}`,\n },\n ],\n { temperature: 0.3, maxTokens: 3000, agentId, modelChain }\n );\n\n if (!response?.content) return [];\n\n try {\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 if (!Array.isArray(parsed.rules)) return [];\n\n const now = new Date().toISOString();\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n return rawRules\n .map((r: unknown): CalibrationRule | undefined => {\n if (!r || typeof r !== \"object\" || Array.isArray(r)) return undefined;\n const raw = r as Record<string, unknown>;\n const ruleType = nonEmptyString(raw.ruleType);\n const condition = nonEmptyString(raw.condition);\n const modelTendency = nonEmptyString(raw.modelTendency);\n const calibration = nonEmptyString(raw.calibration);\n const confidence = parseConfidence(raw.confidence);\n if (\n !ruleType ||\n !CALIBRATION_RULE_TYPES.has(ruleType) ||\n !condition ||\n !modelTendency ||\n !calibration ||\n confidence === undefined\n ) {\n return undefined;\n }\n const evidenceCorrectionIds = parseEvidenceIds(raw.evidenceIds);\n return {\n id: `cal-${createHash(\"sha256\")\n .update(condition + calibration)\n .digest(\"hex\")\n .slice(0, 12)}`,\n ruleType: ruleType as CalibrationRule[\"ruleType\"],\n condition,\n modelTendency,\n userExpectation: nonEmptyString(raw.userExpectation) ?? \"\",\n calibration,\n confidence,\n evidenceCount: evidenceCorrectionIds.length,\n evidenceCorrectionIds,\n createdAt: now,\n lastReinforcedAt: now,\n };\n })\n .filter((rule): rule is CalibrationRule => !!rule);\n } catch {\n log.warn(\"[calibration] failed to parse LLM response\");\n return [];\n }\n}\n\n// ─── Recall Section ──────────────────────────────────────────────────────────\n\n/**\n * Build a recall section from calibration rules relevant to the current query.\n * Uses the LLM to select which rules apply to the current context.\n */\nexport function buildCalibrationRecallSection(\n rules: CalibrationRule[],\n query: string,\n maxChars: number = 1200,\n): string | null {\n if (rules.length === 0) return null;\n\n // Simple relevance: include all rules (they're already filtered to this user)\n // In production, could use embedding similarity to filter\n const lines: string[] = [\n \"## Model Calibration (learned from past corrections)\",\n \"\",\n \"Adjustments for this specific user, learned from patterns in their corrections:\",\n \"\",\n ];\n\n let totalChars = lines.join(\"\\n\").length;\n\n for (const rule of rules) {\n const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;\n if (totalChars + line.length + 1 > maxChars) break;\n lines.push(line);\n totalChars += line.length + 1;\n }\n\n if (lines.length <= 4) return null;\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Options weekly compounding passes into calibration. Gateway agent and task\n * chain fields stay limited to `modelSource: \"gateway\"`. `pluginConfig` carries\n * the `localLlm*` settings used when that chain is empty.\n */\nexport function calibrationConsolidationInput(config: PluginConfig): {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig: PluginConfig;\n} {\n const gateway = config.modelSource === \"gateway\";\n return {\n memoryDir: config.memoryDir,\n gatewayConfig: config.gatewayConfig,\n gatewayAgentId: gateway ? (config.gatewayAgentId || undefined) : undefined,\n modelChain: gateway ? config.taskModelChain : undefined,\n workspaceDir: config.workspaceDir,\n pluginConfig: config,\n };\n}\n\n/**\n * Run the full calibration pipeline:\n * 1. Read all corrections\n * 2. Send to LLM for clustering and rule synthesis\n * 3. Merge with existing rules\n * 4. Write updated index\n */\nexport async function runCalibrationConsolidation(options: {\n memoryDir: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n /**\n * When set, a week whose reinforcement is already in the index is returned\n * as-is. Weekly synthesis passes the ISO week id so a retry after a later\n * artifact failure does not count the same corrections twice.\n */\n idempotencyKey?: string;\n}): Promise<CalibrationRule[]> {\n try {\n const idempotencyKey = appliedCalibrationWeekId(options.idempotencyKey);\n const existingIndex = await readCalibrationIndex(options.memoryDir);\n if (idempotencyKey && (existingIndex.appliedWeekIds ?? []).includes(idempotencyKey)) {\n log.debug(`[calibration] week ${idempotencyKey} already applied — skipping`);\n return existingIndex.rules;\n }\n\n const llm = resolveCalibrationChatClient(options);\n if (!llm) return [];\n\n const corrections = await readCorrections(options.memoryDir);\n if (corrections.length < 3) {\n log.info(`[calibration] only ${corrections.length} corrections — need at least 3`);\n return [];\n }\n\n const newRules = await synthesizeCalibrationRules(\n corrections,\n llm,\n existingIndex.rules,\n options.gatewayAgentId,\n options.modelChain\n );\n if (newRules.length === 0) {\n log.info(\"[calibration] no new calibration rules synthesized\");\n return existingIndex.rules;\n }\n\n // Merge: keep existing rules, add new ones (deduplicate by id)\n const ruleMap = new Map(existingIndex.rules.map((r) => [r.id, r]));\n for (const rule of newRules) {\n if (ruleMap.has(rule.id)) {\n // Reinforce existing rule\n const existing = ruleMap.get(rule.id)!;\n existing.lastReinforcedAt = new Date().toISOString();\n existing.evidenceCount += rule.evidenceCount;\n existing.confidence = Math.min(1, existing.confidence + 0.05);\n } else {\n ruleMap.set(rule.id, rule);\n }\n }\n\n const allRules = [...ruleMap.values()];\n await writeCalibrationIndex(options.memoryDir, withAppliedCalibrationWeek({\n rules: allRules,\n updatedAt: existingIndex.updatedAt,\n totalCorrectionsAnalyzed: corrections.length,\n appliedWeekIds: existingIndex.appliedWeekIds,\n }, idempotencyKey));\n\n log.debug(`[calibration] synthesized ${newRules.length} new rule(s), ${allRules.length} total`);\n return allRules;\n } catch (error) {\n log.warn(\n `[calibration] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`\n );\n return [];\n }\n}\n\n/**\n * Standalone entry point for calibration consolidation that can be called\n * independently of weekly compounding. The compounding engine's\n * `synthesizeWeekly()` is one trigger, but orchestrators or periodic\n * maintenance jobs should call this directly so calibration is not gated\n * on weekly compounding being enabled.\n */\nexport async function runCalibrationIfEnabled(options: {\n memoryDir: string;\n calibrationEnabled: boolean;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n}): Promise<CalibrationRule[]> {\n if (!options.calibrationEnabled) {\n return [];\n }\n return runCalibrationConsolidation({\n memoryDir: options.memoryDir,\n gatewayConfig: options.gatewayConfig,\n gatewayAgentId: options.gatewayAgentId,\n modelChain: options.modelChain,\n workspaceDir: options.workspaceDir,\n pluginConfig: options.pluginConfig,\n });\n}\n\n/**\n * Get calibration rules for recall injection.\n * Reads the pre-computed calibration index.\n */\nexport async function getCalibrationRulesForRecall(\n memoryDir: string,\n): Promise<CalibrationRule[]> {\n const index = await readCalibrationIndex(memoryDir);\n return index.rules;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,gBAAgB;AAChC,OAAO,UAAU;AAyCjB,SAAS,eAAe,WAA2B;AACjD,SAAO,KAAK,KAAK,WAAW,SAAS,aAAa;AACpD;AAEA,SAAS,qBAAqB,WAA2B;AACvD,SAAO,KAAK,KAAK,eAAe,SAAS,GAAG,wBAAwB;AACtE;AAGA,IAAM,6BAA6B;AAE5B,SAAS,yBAAyB,OAAoC;AAC3E,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,KAAK,QAAQ,SAAS,2BAA4B,QAAO;AAChF,SAAO;AACT;AAEA,eAAsB,qBAAqB,WAA8C;AACvF,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,qBAAqB,SAAS,GAAG,MAAM,CAAC;AAC9E,UAAM,iBAAiB,wBAAwB,IAAI,gBAAgB,IAAI,aAAa;AACpF,WAAO;AAAA,MACL,OAAO,MAAM,QAAQ,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC;AAAA,MAC/C,WAAW,OAAO,IAAI,cAAc,WAAW,IAAI,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACtF,0BAA0B,OAAO,IAAI,6BAA6B,WAAW,IAAI,2BAA2B;AAAA,MAC5G,GAAI,eAAe,SAAS,IAAI,EAAE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