@remnic/core 9.65.3 → 9.65.4

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 (429) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +20 -18
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +21 -19
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +20 -18
  7. package/dist/access-cli.js +55 -53
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +1 -1
  10. package/dist/access-extraction-force-flush.d.ts +11 -11
  11. package/dist/access-extraction-force-flush.js +20 -18
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-lcm-compaction.d.ts +11 -11
  14. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  15. package/dist/access-http-offline-stream.d.ts +11 -11
  16. package/dist/access-http-query.d.ts +2 -2
  17. package/dist/access-http-query.js +22 -20
  18. package/dist/access-http.d.ts +12 -12
  19. package/dist/access-http.js +31 -29
  20. package/dist/access-identity-continuity-surface.d.ts +9 -9
  21. package/dist/access-identity-continuity-surface.js +20 -18
  22. package/dist/access-lcm-surface.d.ts +11 -11
  23. package/dist/access-lcm-surface.js +20 -18
  24. package/dist/access-mcp.d.ts +11 -11
  25. package/dist/access-mcp.js +25 -23
  26. package/dist/access-memory-search-fanout.d.ts +2 -2
  27. package/dist/{access-namespace-preflight-B7Usyz-K.d.ts → access-namespace-preflight-D_6mo8ms.d.ts} +1 -1
  28. package/dist/access-namespace-preflight.d.ts +3 -3
  29. package/dist/access-namespace-preflight.js +20 -18
  30. package/dist/access-observe-write-surface.d.ts +11 -11
  31. package/dist/access-observe-write-surface.js +20 -18
  32. package/dist/access-offline-manifest.d.ts +9 -9
  33. package/dist/access-offline-manifest.js +3 -3
  34. package/dist/access-operations-batch.js +21 -19
  35. package/dist/access-operations.d.ts +11 -11
  36. package/dist/access-operations.js +24 -22
  37. package/dist/access-recall-concurrency.d.ts +11 -11
  38. package/dist/access-recall-concurrency.js +20 -18
  39. package/dist/access-recall-response.d.ts +11 -11
  40. package/dist/access-recall-response.js +20 -18
  41. package/dist/access-recall-surface.d.ts +11 -11
  42. package/dist/access-recall-surface.js +20 -18
  43. package/dist/{access-service-DkaIG3n8.d.ts → access-service-DqPa3hy4.d.ts} +7 -7
  44. package/dist/access-service-helpers.d.ts +11 -11
  45. package/dist/access-service.d.ts +11 -11
  46. package/dist/access-service.js +20 -18
  47. package/dist/access-surface-catalog.d.ts +11 -11
  48. package/dist/access-surface-catalog.js +22 -20
  49. package/dist/access-surface-catalog.js.map +1 -1
  50. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  51. package/dist/action-confidence.d.ts +1 -1
  52. package/dist/active-memory-bridge.d.ts +1 -1
  53. package/dist/active-recall.d.ts +1 -1
  54. package/dist/active-recall.js +5 -1
  55. package/dist/active-recall.js.map +1 -1
  56. package/dist/ambient-provenance.d.ts +1 -1
  57. package/dist/artifact-search.d.ts +1 -1
  58. package/dist/{auto-sync-H64ZCNIR.js → auto-sync-XVMLL2RH.js} +5 -5
  59. package/dist/behavior-learner.d.ts +1 -1
  60. package/dist/behavior-signals.d.ts +1 -1
  61. package/dist/bootstrap.d.ts +9 -9
  62. package/dist/briefing-window.d.ts +2 -2
  63. package/dist/briefing.d.ts +2 -2
  64. package/dist/briefing.js +4 -4
  65. package/dist/buffer-surprise-report.d.ts +1 -1
  66. package/dist/buffer-turn-helpers.d.ts +1 -1
  67. package/dist/buffer.d.ts +2 -2
  68. package/dist/bulk-import/index.d.ts +3 -3
  69. package/dist/calibration.d.ts +1 -1
  70. package/dist/capabilities.d.ts +1 -1
  71. package/dist/{catalog-CX2BZEJh.d.ts → catalog-DO_7zfkv.d.ts} +1 -1
  72. package/dist/causal-behavior.d.ts +1 -1
  73. package/dist/causal-consolidation.d.ts +1 -1
  74. package/dist/causal-consolidation.js +9 -6
  75. package/dist/causal-consolidation.js.map +1 -1
  76. package/dist/causal-trajectory-graph.d.ts +1 -1
  77. package/dist/chunk-236PXYG7.js +232 -0
  78. package/dist/chunk-236PXYG7.js.map +1 -0
  79. package/dist/{chunk-IQSC3V2E.js → chunk-2IXQSGCU.js} +2 -2
  80. package/dist/{chunk-GUXS322H.js → chunk-2MVTAIL3.js} +2 -2
  81. package/dist/{chunk-7QOO4LGC.js → chunk-3JZBPTLD.js} +331 -73
  82. package/dist/chunk-3JZBPTLD.js.map +1 -0
  83. package/dist/{chunk-TDKSCV62.js → chunk-3NH3VP3U.js} +2 -2
  84. package/dist/{chunk-URHCUXKI.js → chunk-AXGFOFNY.js} +2 -2
  85. package/dist/{chunk-WN5FSGLE.js → chunk-AZLLH6YA.js} +19 -19
  86. package/dist/{chunk-D27J626P.js → chunk-BK5G2MHO.js} +2 -2
  87. package/dist/{chunk-DHTQP334.js → chunk-CQBIN77D.js} +2 -2
  88. package/dist/{chunk-6VALIZKG.js → chunk-DORFF5N5.js} +2 -2
  89. package/dist/{chunk-76PL4XLG.js → chunk-DPNXADEI.js} +7 -2
  90. package/dist/chunk-DPNXADEI.js.map +1 -0
  91. package/dist/{chunk-MRTUN665.js → chunk-DUEDOYZD.js} +2 -2
  92. package/dist/{chunk-QFMO32TO.js → chunk-DUZARALI.js} +3 -3
  93. package/dist/{chunk-7KFIMGMP.js → chunk-ECLJ4LA2.js} +2 -2
  94. package/dist/{chunk-PDVQ5JU3.js → chunk-GHD2LLG4.js} +2 -2
  95. package/dist/{chunk-RK4WXUI2.js → chunk-HF5BUTI6.js} +2 -2
  96. package/dist/{chunk-3DVBKTSO.js → chunk-HSZMX3ZJ.js} +4 -4
  97. package/dist/{chunk-EV3YFLCB.js → chunk-I23ZHYSL.js} +2 -2
  98. package/dist/{chunk-ODZG724P.js → chunk-I2HTKOOP.js} +2 -2
  99. package/dist/{chunk-AYYGRVRP.js → chunk-IURMJBGP.js} +2 -2
  100. package/dist/{chunk-TYUS5TLG.js → chunk-IWKGOCL6.js} +3 -3
  101. package/dist/{chunk-4XDGYCZI.js → chunk-J3ATBB7M.js} +2 -2
  102. package/dist/{chunk-E4MVQQVX.js → chunk-JPAKBNTM.js} +2 -2
  103. package/dist/{chunk-NZWEEALH.js → chunk-KFIOPZ25.js} +2 -2
  104. package/dist/{chunk-EIVIB73I.js → chunk-KOO37E4Y.js} +2 -2
  105. package/dist/{chunk-57HVIG5U.js → chunk-KPB2QHJZ.js} +2 -2
  106. package/dist/{chunk-NXKJHSDN.js → chunk-LBFFNDFM.js} +1 -1
  107. package/dist/chunk-LBFFNDFM.js.map +1 -0
  108. package/dist/{chunk-Z4RPXHJH.js → chunk-LYBIHM4N.js} +4 -4
  109. package/dist/{chunk-G57LQRP6.js → chunk-MFOSZUIT.js} +2 -2
  110. package/dist/{chunk-AUO2LJ3K.js → chunk-NLEH4RTB.js} +2 -2
  111. package/dist/{chunk-AYDDB3XI.js → chunk-OCCHUEZB.js} +2 -2
  112. package/dist/{chunk-6TAX66IA.js → chunk-OU34IQXV.js} +2 -2
  113. package/dist/{chunk-OJD4WS2E.js → chunk-OZDFB22S.js} +2 -2
  114. package/dist/{chunk-GN55KU2P.js → chunk-PTZQYCJ4.js} +2 -2
  115. package/dist/{chunk-BQUEAVNW.js → chunk-QJW4MZSW.js} +2 -2
  116. package/dist/{chunk-2VXWFYJE.js → chunk-R2MZCYA6.js} +3 -3
  117. package/dist/{chunk-VA5KMSAE.js → chunk-SR5LNI6Q.js} +3 -3
  118. package/dist/{chunk-LBWQ65SX.js → chunk-T42L3S6A.js} +4 -4
  119. package/dist/{chunk-PAYGC3BD.js → chunk-THVI4Y7X.js} +7 -7
  120. package/dist/{chunk-S7Q5CM7E.js → chunk-TJFI3K2O.js} +15 -3
  121. package/dist/chunk-TJFI3K2O.js.map +1 -0
  122. package/dist/{chunk-R47WINCY.js → chunk-UCKG36HO.js} +2 -2
  123. package/dist/{chunk-QXIQPCCN.js → chunk-UFR6HX7A.js} +1 -1
  124. package/dist/{chunk-CDUUDBWJ.js → chunk-VFYRYFLL.js} +2 -2
  125. package/dist/{chunk-P4DHENRE.js → chunk-WDXD6ITO.js} +2 -2
  126. package/dist/{chunk-BKYPJUQL.js → chunk-XGM3VQWG.js} +10 -10
  127. package/dist/{chunk-MBDJJTAT.js → chunk-YDKF4MSJ.js} +3 -3
  128. package/dist/{chunk-YF6UHWOV.js → chunk-YHGCT462.js} +3 -3
  129. package/dist/{chunk-AZAA5DNP.js → chunk-YOXVZJFM.js} +2 -2
  130. package/dist/{chunk-OLWTCWQ2.js → chunk-YZJM6CLF.js} +8 -8
  131. package/dist/chunk-ZCUTSMR2.js +61 -0
  132. package/dist/chunk-ZCUTSMR2.js.map +1 -0
  133. package/dist/{chunk-LUNJ3WFO.js → chunk-ZK4BFABK.js} +4 -4
  134. package/dist/{chunk-H5FW4S5Q.js → chunk-ZPOHEB5Z.js} +31 -31
  135. package/dist/{chunk-RDFF2NAU.js → chunk-ZXBTTMGZ.js} +184 -88
  136. package/dist/chunk-ZXBTTMGZ.js.map +1 -0
  137. package/dist/{cli-ChKeYMZv.d.ts → cli-DO3i14pM.d.ts} +5 -5
  138. package/dist/cli.d.ts +13 -13
  139. package/dist/cli.js +44 -42
  140. package/dist/coding/pre-action-gate.d.ts +1 -1
  141. package/dist/compounding/engine.d.ts +2 -2
  142. package/dist/compounding/engine.js +4 -4
  143. package/dist/compounding/preference-consolidator.d.ts +1 -1
  144. package/dist/compression-optimizer.d.ts +1 -1
  145. package/dist/config.d.ts +1 -1
  146. package/dist/config.js +5 -1
  147. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  148. package/dist/connectors/codex-materialize-runner.js +8 -5
  149. package/dist/connectors/codex-materialize.d.ts +14 -1
  150. package/dist/connectors/codex-materialize.js +10 -1
  151. package/dist/connectors/index.d.ts +1 -1
  152. package/dist/connectors/index.js +8 -5
  153. package/dist/consolidation-provenance-check.d.ts +2 -2
  154. package/dist/consolidation-undo.d.ts +2 -2
  155. package/dist/contradiction/index.d.ts +3 -3
  156. package/dist/contradiction/index.js +1 -1
  157. package/dist/converge-config.d.ts +1 -1
  158. package/dist/convergence-refresh.d.ts +2 -2
  159. package/dist/convergence-refresh.js +6 -6
  160. package/dist/conversation-index/backend.d.ts +1 -1
  161. package/dist/conversation-index/chunker.d.ts +1 -1
  162. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  163. package/dist/conversation-index/indexer.d.ts +1 -1
  164. package/dist/conversation-index/search.d.ts +1 -1
  165. package/dist/corpus-watermark.d.ts +1 -1
  166. package/dist/corpus-watermark.js +6 -6
  167. package/dist/cross-lingual-recall.d.ts +1 -1
  168. package/dist/day-summary.d.ts +1 -1
  169. package/dist/delinearize.d.ts +1 -1
  170. package/dist/dependency-propagation-config.d.ts +1 -1
  171. package/dist/{dependency-propagation-delivery-B8ZMBBCY.d.ts → dependency-propagation-delivery-D23_x-s5.d.ts} +1 -1
  172. package/dist/direct-answer-wiring.d.ts +1 -1
  173. package/dist/direct-answer.d.ts +1 -1
  174. package/dist/embedding-fallback.d.ts +1 -1
  175. package/dist/enrichment/index.d.ts +1 -1
  176. package/dist/entity-origin-fields.d.ts +1 -1
  177. package/dist/entity-retrieval.d.ts +2 -2
  178. package/dist/entity-retrieval.js +4 -4
  179. package/dist/entity-schema.d.ts +1 -1
  180. package/dist/episodic-context.d.ts +1 -1
  181. package/dist/explicit-capture.d.ts +9 -9
  182. package/dist/explicit-capture.js +1 -1
  183. package/dist/external-wiki-access.d.ts +11 -11
  184. package/dist/external-wiki-access.js +21 -19
  185. package/dist/external-wiki-collection-registration.d.ts +1 -1
  186. package/dist/external-wiki-collection.d.ts +1 -1
  187. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  188. package/dist/extraction-error-classification.d.ts +1 -1
  189. package/dist/extraction-faithfulness.d.ts +1 -1
  190. package/dist/extraction-judge-telemetry.d.ts +1 -1
  191. package/dist/extraction-judge-training.d.ts +1 -1
  192. package/dist/extraction-judge.d.ts +1 -1
  193. package/dist/extraction-judge.js +2 -2
  194. package/dist/extraction-liveness.d.ts +1 -1
  195. package/dist/extraction-normalization.d.ts +1 -1
  196. package/dist/extraction-prompt.d.ts +1 -1
  197. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  198. package/dist/extraction-source-grounding.d.ts +1 -1
  199. package/dist/extraction.d.ts +1 -1
  200. package/dist/extraction.js +9 -7
  201. package/dist/fallback-llm.d.ts +1 -1
  202. package/dist/graph-dashboard-diff.d.ts +1 -1
  203. package/dist/graph-dashboard-key.d.ts +1 -1
  204. package/dist/graph-dashboard-parser.d.ts +1 -1
  205. package/dist/graph-edge-reinforcement.d.ts +1 -1
  206. package/dist/graph-path-reconstruction.d.ts +1 -1
  207. package/dist/graph-path-scoring.d.ts +1 -1
  208. package/dist/graph-snapshot.d.ts +1 -1
  209. package/dist/graph.d.ts +1 -1
  210. package/dist/harmonic-retrieval.js +1 -1
  211. package/dist/importance.d.ts +1 -1
  212. package/dist/importers/index.d.ts +1 -1
  213. package/dist/in-flight-reads.d.ts +1 -1
  214. package/dist/{index-CexDrJzC.d.ts → index--QhGIXF2.d.ts} +2 -2
  215. package/dist/index.d.ts +87 -40
  216. package/dist/index.js +79 -58
  217. package/dist/intent.d.ts +1 -1
  218. package/dist/lcm/engine.d.ts +1 -1
  219. package/dist/lcm/index.d.ts +1 -1
  220. package/dist/lcm/tools.d.ts +1 -1
  221. package/dist/lifecycle.d.ts +1 -1
  222. package/dist/live-connectors-runner.d.ts +1 -1
  223. package/dist/local-llm.d.ts +1 -1
  224. package/dist/local-model-endpoint.d.ts +1 -1
  225. package/dist/maintenance/memory-governance.d.ts +1 -1
  226. package/dist/maintenance/memory-governance.js +4 -4
  227. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  228. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
  229. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  230. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  231. package/dist/{maintenance-nkdtSrVr.d.ts → maintenance-PFvY1Pw_.d.ts} +3 -3
  232. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  233. package/dist/memory-action-policy.d.ts +1 -1
  234. package/dist/memory-cache.d.ts +1 -1
  235. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  236. package/dist/memory-projection-store.d.ts +1 -1
  237. package/dist/memory-provenance.d.ts +1 -1
  238. package/dist/memory-snapshot.d.ts +1 -1
  239. package/dist/memory-subject-cli.d.ts +11 -11
  240. package/dist/memory-subject.d.ts +11 -11
  241. package/dist/memory-worth-outcomes.d.ts +2 -2
  242. package/dist/models-json.d.ts +1 -1
  243. package/dist/namespaces/migrate.d.ts +3 -3
  244. package/dist/namespaces/migrate.js +5 -5
  245. package/dist/namespaces/principal.d.ts +1 -1
  246. package/dist/namespaces/search.d.ts +1 -1
  247. package/dist/namespaces/storage.d.ts +3 -3
  248. package/dist/namespaces/storage.js +4 -4
  249. package/dist/native-knowledge.d.ts +1 -1
  250. package/dist/offline-sync-impression-drain.d.ts +1 -1
  251. package/dist/operator-doctor-corpus.d.ts +1 -1
  252. package/dist/operator-doctor-corpus.js +7 -7
  253. package/dist/operator-doctor-replica.d.ts +1 -1
  254. package/dist/operator-toolkit.d.ts +3 -3
  255. package/dist/operator-toolkit.js +16 -13
  256. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  257. package/dist/orchestration/maintenance.d.ts +4 -4
  258. package/dist/orchestration/maintenance.js +10 -10
  259. package/dist/{orchestrator-Bvq1-RQs.d.ts → orchestrator-4wzJrPVm.d.ts} +8 -8
  260. package/dist/orchestrator.d.ts +9 -9
  261. package/dist/orchestrator.js +55 -53
  262. package/dist/patterns-cli.d.ts +1 -1
  263. package/dist/{pipeline-C8vfIiTX.d.ts → pipeline-CgXgdIrF.d.ts} +1 -1
  264. package/dist/policy-runtime.d.ts +1 -1
  265. package/dist/proactive-contention.d.ts +1 -1
  266. package/dist/provenance.d.ts +1 -1
  267. package/dist/{public-http-Cy0aYbys.d.ts → public-http-DhIXYBYI.d.ts} +1 -1
  268. package/dist/{qmd-B9p1SZTZ.d.ts → qmd-BppGGxsi.d.ts} +1 -1
  269. package/dist/qmd-preflight.d.ts +2 -2
  270. package/dist/qmd-recall-cache.d.ts +1 -1
  271. package/dist/qmd.d.ts +2 -2
  272. package/dist/recall-concurrency-config.d.ts +1 -1
  273. package/dist/recall-disclosure-escalation.d.ts +1 -1
  274. package/dist/recall-explain-renderer.d.ts +1 -1
  275. package/dist/recall-explain-renderer.js +3 -3
  276. package/dist/recall-memory-map.d.ts +1 -1
  277. package/dist/recall-planner-llm.d.ts +1 -1
  278. package/dist/recall-state.d.ts +1 -1
  279. package/dist/recall-tag-filter.d.ts +1 -1
  280. package/dist/recall-timings.d.ts +1 -1
  281. package/dist/recall-xray-cli.d.ts +1 -1
  282. package/dist/recall-xray-cli.js +4 -4
  283. package/dist/recall-xray-renderer.d.ts +1 -1
  284. package/dist/recall-xray-renderer.js +3 -3
  285. package/dist/recall-xray.d.ts +1 -1
  286. package/dist/recall-xray.js +2 -2
  287. package/dist/reconcile/cursor.d.ts +1 -1
  288. package/dist/reconcile/manifest.d.ts +1 -1
  289. package/dist/reconcile/manifest.js +2 -2
  290. package/dist/reconcile/plan.d.ts +1 -1
  291. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  292. package/dist/replay/normalizers/claude.d.ts +1 -1
  293. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  294. package/dist/replay/normalizers/shared.d.ts +1 -1
  295. package/dist/replay/runner.d.ts +1 -1
  296. package/dist/replay/types.d.ts +1 -1
  297. package/dist/replica-divergence.d.ts +1 -1
  298. package/dist/replica-peers-config.d.ts +1 -1
  299. package/dist/resolution-4552BNRV.js +1 -1
  300. package/dist/resolve-auth-token.d.ts +1 -1
  301. package/dist/resume-bundles.js +6 -2
  302. package/dist/retrieval-agents.d.ts +2 -2
  303. package/dist/retrieval-tiers.d.ts +1 -1
  304. package/dist/routing/engine.d.ts +1 -1
  305. package/dist/routing/store.d.ts +1 -1
  306. package/dist/salvage-envelope.d.ts +1 -1
  307. package/dist/salvage-envelope.js +1 -1
  308. package/dist/schemas.d.ts +12 -12
  309. package/dist/{scope-profiles-DLrRxFWR.d.ts → scope-profiles-ChZUtxDU.d.ts} +1 -1
  310. package/dist/search/embed-helper.d.ts +1 -1
  311. package/dist/search/factory.d.ts +1 -1
  312. package/dist/search/index.d.ts +1 -1
  313. package/dist/search/lancedb-backend.d.ts +1 -1
  314. package/dist/search/meilisearch-backend.d.ts +1 -1
  315. package/dist/search/noop-backend.d.ts +1 -1
  316. package/dist/search/orama-backend.d.ts +1 -1
  317. package/dist/search/port.d.ts +1 -1
  318. package/dist/search/remote-backend.d.ts +1 -1
  319. package/dist/{semantic-consolidation-DlN6xe20.d.ts → semantic-consolidation-mSPwQSmF.d.ts} +1 -1
  320. package/dist/semantic-consolidation.d.ts +2 -2
  321. package/dist/semantic-consolidation.js +9 -6
  322. package/dist/semantic-rule-promotion.js +4 -4
  323. package/dist/semantic-rule-verifier.d.ts +1 -1
  324. package/dist/semantic-rule-verifier.js +4 -4
  325. package/dist/{service-GkYyVfm9.d.ts → service-BICWLwSP.d.ts} +2 -2
  326. package/dist/session-observer-bands.d.ts +1 -1
  327. package/dist/session-observer-state.d.ts +1 -1
  328. package/dist/shared-context/manager.d.ts +1 -1
  329. package/dist/signal.d.ts +1 -1
  330. package/dist/skills-registry.js +4 -56
  331. package/dist/skills-registry.js.map +1 -1
  332. package/dist/source-agent-qualifier.d.ts +1 -1
  333. package/dist/source-agent-qualifier.js +8 -5
  334. package/dist/{storage-BIDzuKIn.d.ts → storage-B7urx1K3.d.ts} +1 -1
  335. package/dist/storage.d.ts +2 -2
  336. package/dist/storage.js +6 -6
  337. package/dist/subject-config.d.ts +1 -1
  338. package/dist/summarizer.d.ts +1 -1
  339. package/dist/summary-snapshot.d.ts +1 -1
  340. package/dist/support-passport/index.d.ts +14 -14
  341. package/dist/support-passport/index.js +23 -21
  342. package/dist/temporal-supersession.d.ts +2 -2
  343. package/dist/temporal-timeline-recall.d.ts +1 -1
  344. package/dist/temporal-validity.d.ts +1 -1
  345. package/dist/threading.d.ts +1 -1
  346. package/dist/tier-migration.d.ts +2 -2
  347. package/dist/tier-routing.d.ts +1 -1
  348. package/dist/topics.d.ts +1 -1
  349. package/dist/transcript.d.ts +1 -1
  350. package/dist/trust-score-stage.d.ts +1 -1
  351. package/dist/trust-score.d.ts +1 -1
  352. package/dist/{types-BxAcOl5Q.d.ts → types-ETU5N6nB.d.ts} +111 -4
  353. package/dist/types.d.ts +1 -1
  354. package/dist/types.js +1 -1
  355. package/dist/utility-runtime.d.ts +1 -1
  356. package/dist/verified-recall.js +4 -4
  357. package/dist/who-knows-cli.d.ts +11 -11
  358. package/dist/who-knows-cli.js +5 -5
  359. package/dist/who-knows.d.ts +11 -11
  360. package/dist/who-knows.js +4 -4
  361. package/dist/write-envelope.d.ts +1 -1
  362. package/dist/write-envelope.js +1 -1
  363. package/package.json +2 -2
  364. package/src/cli/skills-commands.ts +150 -0
  365. package/src/cli.ts +4 -2
  366. package/src/config.ts +4 -2
  367. package/src/connectors/codex-materialize-runner.ts +16 -0
  368. package/src/connectors/codex-materialize-skills.test.ts +141 -0
  369. package/src/connectors/codex-materialize.ts +58 -40
  370. package/src/connectors/materialize-paths.ts +50 -0
  371. package/src/connectors/materialize-skills.ts +127 -0
  372. package/src/index.ts +5 -10
  373. package/src/procedural/skill-io.test.ts +190 -0
  374. package/src/procedural/skill-io.ts +220 -0
  375. package/src/procedural/skill-projection.test.ts +214 -0
  376. package/src/procedural/skill-projection.ts +356 -0
  377. package/src/types.ts +2 -3
  378. package/dist/chunk-76PL4XLG.js.map +0 -1
  379. package/dist/chunk-7QOO4LGC.js.map +0 -1
  380. package/dist/chunk-NXKJHSDN.js.map +0 -1
  381. package/dist/chunk-RDFF2NAU.js.map +0 -1
  382. package/dist/chunk-S7Q5CM7E.js.map +0 -1
  383. /package/dist/{auto-sync-H64ZCNIR.js.map → auto-sync-XVMLL2RH.js.map} +0 -0
  384. /package/dist/{chunk-IQSC3V2E.js.map → chunk-2IXQSGCU.js.map} +0 -0
  385. /package/dist/{chunk-GUXS322H.js.map → chunk-2MVTAIL3.js.map} +0 -0
  386. /package/dist/{chunk-TDKSCV62.js.map → chunk-3NH3VP3U.js.map} +0 -0
  387. /package/dist/{chunk-URHCUXKI.js.map → chunk-AXGFOFNY.js.map} +0 -0
  388. /package/dist/{chunk-WN5FSGLE.js.map → chunk-AZLLH6YA.js.map} +0 -0
  389. /package/dist/{chunk-D27J626P.js.map → chunk-BK5G2MHO.js.map} +0 -0
  390. /package/dist/{chunk-DHTQP334.js.map → chunk-CQBIN77D.js.map} +0 -0
  391. /package/dist/{chunk-6VALIZKG.js.map → chunk-DORFF5N5.js.map} +0 -0
  392. /package/dist/{chunk-MRTUN665.js.map → chunk-DUEDOYZD.js.map} +0 -0
  393. /package/dist/{chunk-QFMO32TO.js.map → chunk-DUZARALI.js.map} +0 -0
  394. /package/dist/{chunk-7KFIMGMP.js.map → chunk-ECLJ4LA2.js.map} +0 -0
  395. /package/dist/{chunk-PDVQ5JU3.js.map → chunk-GHD2LLG4.js.map} +0 -0
  396. /package/dist/{chunk-RK4WXUI2.js.map → chunk-HF5BUTI6.js.map} +0 -0
  397. /package/dist/{chunk-3DVBKTSO.js.map → chunk-HSZMX3ZJ.js.map} +0 -0
  398. /package/dist/{chunk-EV3YFLCB.js.map → chunk-I23ZHYSL.js.map} +0 -0
  399. /package/dist/{chunk-ODZG724P.js.map → chunk-I2HTKOOP.js.map} +0 -0
  400. /package/dist/{chunk-AYYGRVRP.js.map → chunk-IURMJBGP.js.map} +0 -0
  401. /package/dist/{chunk-TYUS5TLG.js.map → chunk-IWKGOCL6.js.map} +0 -0
  402. /package/dist/{chunk-4XDGYCZI.js.map → chunk-J3ATBB7M.js.map} +0 -0
  403. /package/dist/{chunk-E4MVQQVX.js.map → chunk-JPAKBNTM.js.map} +0 -0
  404. /package/dist/{chunk-NZWEEALH.js.map → chunk-KFIOPZ25.js.map} +0 -0
  405. /package/dist/{chunk-EIVIB73I.js.map → chunk-KOO37E4Y.js.map} +0 -0
  406. /package/dist/{chunk-57HVIG5U.js.map → chunk-KPB2QHJZ.js.map} +0 -0
  407. /package/dist/{chunk-Z4RPXHJH.js.map → chunk-LYBIHM4N.js.map} +0 -0
  408. /package/dist/{chunk-G57LQRP6.js.map → chunk-MFOSZUIT.js.map} +0 -0
  409. /package/dist/{chunk-AUO2LJ3K.js.map → chunk-NLEH4RTB.js.map} +0 -0
  410. /package/dist/{chunk-AYDDB3XI.js.map → chunk-OCCHUEZB.js.map} +0 -0
  411. /package/dist/{chunk-6TAX66IA.js.map → chunk-OU34IQXV.js.map} +0 -0
  412. /package/dist/{chunk-OJD4WS2E.js.map → chunk-OZDFB22S.js.map} +0 -0
  413. /package/dist/{chunk-GN55KU2P.js.map → chunk-PTZQYCJ4.js.map} +0 -0
  414. /package/dist/{chunk-BQUEAVNW.js.map → chunk-QJW4MZSW.js.map} +0 -0
  415. /package/dist/{chunk-2VXWFYJE.js.map → chunk-R2MZCYA6.js.map} +0 -0
  416. /package/dist/{chunk-VA5KMSAE.js.map → chunk-SR5LNI6Q.js.map} +0 -0
  417. /package/dist/{chunk-LBWQ65SX.js.map → chunk-T42L3S6A.js.map} +0 -0
  418. /package/dist/{chunk-PAYGC3BD.js.map → chunk-THVI4Y7X.js.map} +0 -0
  419. /package/dist/{chunk-R47WINCY.js.map → chunk-UCKG36HO.js.map} +0 -0
  420. /package/dist/{chunk-QXIQPCCN.js.map → chunk-UFR6HX7A.js.map} +0 -0
  421. /package/dist/{chunk-CDUUDBWJ.js.map → chunk-VFYRYFLL.js.map} +0 -0
  422. /package/dist/{chunk-P4DHENRE.js.map → chunk-WDXD6ITO.js.map} +0 -0
  423. /package/dist/{chunk-BKYPJUQL.js.map → chunk-XGM3VQWG.js.map} +0 -0
  424. /package/dist/{chunk-MBDJJTAT.js.map → chunk-YDKF4MSJ.js.map} +0 -0
  425. /package/dist/{chunk-YF6UHWOV.js.map → chunk-YHGCT462.js.map} +0 -0
  426. /package/dist/{chunk-AZAA5DNP.js.map → chunk-YOXVZJFM.js.map} +0 -0
  427. /package/dist/{chunk-OLWTCWQ2.js.map → chunk-YZJM6CLF.js.map} +0 -0
  428. /package/dist/{chunk-LUNJ3WFO.js.map → chunk-ZK4BFABK.js.map} +0 -0
  429. /package/dist/{chunk-H5FW4S5Q.js.map → chunk-ZPOHEB5Z.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/connectors/codex-materialize.ts","../src/connectors/materialize-paths.ts","../src/connectors/materialize-skills.ts"],"sourcesContent":["/**\n * codex-materialize.ts — Codex CLI native memory artifact materialization (#378)\n *\n * Periodically writes Remnic memories into the file layout that Codex CLI's\n * phase-2 consolidation reads directly under `<codex_home>/memories/`:\n *\n * memory_summary.md — always-loaded at session start (tight budget)\n * MEMORY.md — searchable handbook (task-group schema)\n * raw_memories.md — mechanical merge of raw memories, latest first\n * rollout_summaries/<slug>.md — per-session recaps\n *\n * Codex's own read path is agnostic to which producer wrote these files — it\n * tags reads by `memory_md` / `memory_summary` / `raw_memories` /\n * `rollout_summaries` / `skills`. By materializing Remnic content into this\n * exact layout we let Codex pick up Remnic memories without a single MCP call.\n *\n * Safety invariants\n * ─────────────────\n * - **Atomic writes.** Every file is rendered under `.remnic-tmp/` and then\n * `rename()`d into place so Codex never observes a half-written file.\n * - **Sentinel-based opt-in.** If `<codex_home>/memories/.remnic-managed` is\n * missing, we SKIP materialization entirely and log a warning. This honors\n * user hand-edits to the directory — a user who manually curated their\n * Codex memory layout will never have those edits overwritten.\n * - **Schema validation.** `MEMORY.md` content is validated against the\n * task-group schema before write. Invalid content throws and nothing is\n * written.\n * - **Idempotent no-ops.** A content hash is written into the sentinel. If\n * the re-rendered hash matches the previous run, we skip writes entirely.\n * - **Token budget.** `memory_summary.md` is truncated to fit under the\n * configured script-aware token estimate, leaving headroom under Codex's\n * 5000-token summary cap.\n *\n * Privacy\n * ───────\n * This module does not persist any user content outside `<codex_home>/memories`\n * — it only mirrors the memories that Remnic already wrote. It does not log\n * memory content to stdout; it logs file names, counts, and hashes.\n */\n\nimport {\n createHash,\n} from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { log } from \"../logger.js\";\nimport { readEnvVar, resolveHomeDir } from \"../runtime/env.js\";\nimport type { MemoryFile } from \"../types.js\";\nimport { estimateTokenCount } from \"../token-estimate.js\";\nimport type { SkillBundle } from \"../procedural/skill-projection.js\";\nimport { expandTildePath } from \"../utils/path.js\";\nimport { ensureSafeManagedSubdir } from \"./materialize-paths.js\";\nimport {\n commitSkillFiles,\n planSkillFiles,\n retiredSkillsAlreadyRemoved,\n skillFilePath,\n skillFileRelPath,\n stageSkillFiles,\n type SkillFile,\n} from \"./materialize-skills.js\";\n\n// ─── Types ─────────────────────────────────────────────────────────────────\n\n/**\n * Input for {@link materializeForNamespace}. Prefer passing pre-loaded\n * `memories` so this module stays I/O-agnostic and trivially testable.\n */\nexport interface MaterializeOptions {\n /** Pre-loaded Remnic memories for this namespace (required). */\n memories: MemoryFile[];\n /** Override `<codex_home>`. Defaults to `$CODEX_HOME` or `~/.codex`. */\n codexHome?: string;\n /** Maximum estimated token size of memory_summary.md. Default 4500. */\n maxSummaryTokens?: number;\n /** Maximum age of rollout_summaries/*.md in days. Default 30. */\n rolloutRetentionDays?: number;\n /** Per-session rollout summaries to render. */\n rolloutSummaries?: RolloutSummaryInput[];\n /**\n * Projected procedural skill bundles (issue #2369). `undefined` leaves\n * `skills/` untouched; an array — even an empty one — is authoritative for\n * the slugs Remnic projected, so retired procedures get their folder\n * removed. Folders this materializer never projected are never touched.\n */\n skills?: SkillBundle[];\n /** Current time, injected for deterministic tests. */\n now?: Date;\n /** Optional logger override for tests. */\n logger?: { info: (msg: string) => void; warn: (msg: string) => void; debug?: (msg: string) => void };\n}\n\n/** Input describing one Codex rollout summary file. */\nexport interface RolloutSummaryInput {\n /** Stable slug for the file (becomes `<slug>.md`). */\n slug: string;\n /** Working directory used during the rollout. */\n cwd?: string;\n /** Path to the raw Codex rollout log, if known. */\n rolloutPath?: string;\n /** ISO-8601 timestamp of the last update. */\n updatedAt?: string;\n /** Opaque thread / session id. */\n threadId?: string;\n /** Markdown body for the recap. */\n body: string;\n /** Freeform keywords / search hints. */\n keywords?: string[];\n}\n\n/** Result of a materialization run. */\nexport interface MaterializeResult {\n /** Namespace that was materialized. */\n namespace: string;\n /** `<codex_home>/memories` path this run targeted. */\n memoriesDir: string;\n /** Was anything actually written (vs. skipped / idempotent no-op)? */\n wrote: boolean;\n /** True if the sentinel was missing and we skipped with a warning. */\n skippedNoSentinel: boolean;\n /** True if the hash matched the previous run and we short-circuited. */\n skippedIdempotent: boolean;\n /** Files that were written this run (relative to `memoriesDir`). */\n filesWritten: string[];\n /** Content hash computed for this run. */\n contentHash: string;\n}\n\n/** On-disk shape of the `.remnic-managed` sentinel. */\ninterface SentinelFile {\n version: number;\n namespace: string;\n updated_at: string;\n content_hash: string;\n /**\n * Slugs under `skills/` that THIS materializer projected (issue #2369).\n * Absent on sentinels written before skill projection existed, which reads\n * as \"we have projected nothing\", so hand-created folders stay untouched.\n */\n projected_skills?: string[];\n}\n\n// ─── Constants ─────────────────────────────────────────────────────────────\n\n/** Bump when the on-disk layout or semantics change. */\nexport const MATERIALIZE_VERSION = 1;\n\n/** Sentinel file name at the root of the materialized memories dir. */\nexport const SENTINEL_FILE = \".remnic-managed\";\n\n/** Scratch directory used for atomic renames. */\nexport const TMP_DIR = \".remnic-tmp\";\n\n/** File names we own. Anything else in the directory is considered user-managed. */\nconst OWNED_FILES = new Set<string>([\n \"memory_summary.md\",\n \"MEMORY.md\",\n \"raw_memories.md\",\n]);\n\n/** Sub-directory for per-session rollout recaps. */\nconst ROLLOUT_SUBDIR = \"rollout_summaries\";\n\n// ─── Public entry points ───────────────────────────────────────────────────\n\n/**\n * Materialize a Remnic namespace into Codex's native memory layout.\n *\n * Returns a {@link MaterializeResult} describing what happened. Callers\n * should treat \"skipped\" as success — the sentinel / idempotent cases are\n * expected and intentional.\n *\n * @throws if `MEMORY.md` fails schema validation (we do not write garbage).\n */\nexport function materializeForNamespace(\n namespace: string,\n options: MaterializeOptions,\n): MaterializeResult {\n const logger = options.logger ?? {\n info: (msg) => log.info(`[codex-materialize] ${msg}`),\n warn: (msg) => log.warn(`[codex-materialize] ${msg}`),\n debug: (msg) => log.debug(`[codex-materialize] ${msg}`),\n };\n const memoriesDir = resolveCodexMemoriesDir(options.codexHome);\n const now = options.now ?? new Date();\n // Honor `0` as \"no summary budget\" — parseConfig already clamps to non-\n // negative integers, so any provided number is meaningful. Only fall back\n // to the default when the caller did not provide the option at all.\n const maxSummaryTokens =\n typeof options.maxSummaryTokens === \"number\" && options.maxSummaryTokens >= 0\n ? options.maxSummaryTokens\n : 4500;\n const rolloutRetentionDays =\n typeof options.rolloutRetentionDays === \"number\" && options.rolloutRetentionDays >= 0\n ? options.rolloutRetentionDays\n : 30;\n\n // ── Sentinel check ─────────────────────────────────────────────────────\n // We deliberately do NOT `mkdirSync(memoriesDir)` before reading the\n // sentinel: creating `~/.codex/memories/` for every user (including ones\n // who never use Codex) would make Remnic's post-consolidation hook leave\n // empty opt-in directories behind on disk. Instead we only check whether\n // the sentinel already exists — if the parent dir doesn't exist, the\n // sentinel can't exist either and we fall straight through to the skip\n // path without touching the filesystem. The `mkdirSync` for `memoriesDir`\n // happens later, only once we know we're actually going to write.\n const sentinelPath = path.join(memoriesDir, SENTINEL_FILE);\n const existingSentinel = readSentinel(sentinelPath);\n if (!existingSentinel) {\n // Log at `debug` when the entire memories dir doesn't exist — that's\n // the common \"user never opted in\" case and should not be noisy.\n // Keep the `warn` level only when the dir exists but lacks a sentinel,\n // which is the \"user hand-curated layout, don't overwrite\" case that\n // genuinely warrants attention.\n if (fs.existsSync(memoriesDir)) {\n logger.warn(\n `sentinel ${SENTINEL_FILE} missing in ${memoriesDir}; skipping materialization to preserve hand-edits`,\n );\n } else {\n logger.debug?.(\n `skipping materialization — ${memoriesDir} does not exist (user not opted in)`,\n );\n }\n return {\n namespace,\n memoriesDir,\n wrote: false,\n skippedNoSentinel: true,\n skippedIdempotent: false,\n filesWritten: [],\n contentHash: \"\",\n };\n }\n\n // Now that we know the user has opted in (sentinel exists), it's safe to\n // ensure the memories dir is present. In practice this is almost always a\n // no-op because the sentinel read above already succeeded, but a defensive\n // mkdirSync protects against a race where the dir was removed between the\n // sentinel read and the first write.\n fs.mkdirSync(memoriesDir, { recursive: true });\n\n // ── Render ─────────────────────────────────────────────────────────────\n const memories = [...options.memories];\n // Track whether the caller actually supplied a rollout set. `undefined`\n // means \"don't touch rollout_summaries/\"; an empty array is still\n // authoritative and means \"we own this dir and it should be empty\".\n const rolloutsSupplied = options.rolloutSummaries !== undefined;\n const rolloutSummaries = options.rolloutSummaries ?? [];\n\n // Prune-before-render: MEMORY.md and memory_summary.md both embed rollout\n // filenames in their body, so they must only ever see the *retained* set.\n // Running pruneRollouts after the renderers (as an earlier revision did)\n // caused MEMORY.md to list `rollout_summaries/<slug>.md` paths for rollouts\n // that were then pruned and never written — a broken link pointing at a\n // ghost file. See review feedback on PR #392.\n const retainedRollouts = pruneRollouts(rolloutSummaries, rolloutRetentionDays, now);\n\n // Deduplicate on sanitized filename. Two different slugs (\"Session 1\" and\n // \"session!!!1\") can sanitize to the same output (\"session-1\"), which would\n // otherwise make the first entry's tmp file get overwritten and cause the\n // later rename step to crash with ENOENT. For each collision slot we keep\n // the entry with the newest `updatedAt` so an unsorted input (or a caller\n // that accidentally appends older recaps after newer ones) can't have an\n // older recap clobber a newer one.\n // We do this at the retained-input level (not just at the written-file\n // level) so MEMORY.md's \"rollout_summary_files\" section lists each slot\n // exactly once and matches what actually gets written to disk.\n const dedupedRollouts: RolloutSummaryInput[] = [];\n const seenNames = new Map<string, number>();\n const parseTs = (value: string | undefined): number => {\n if (!value) return Number.NEGATIVE_INFINITY;\n const parsed = Date.parse(value);\n return Number.isFinite(parsed) ? parsed : Number.NEGATIVE_INFINITY;\n };\n for (const r of retainedRollouts) {\n const name = `${sanitizeSlug(r.slug)}.md`;\n const existingIdx = seenNames.get(name);\n if (existingIdx === undefined) {\n seenNames.set(name, dedupedRollouts.length);\n dedupedRollouts.push(r);\n continue;\n }\n // Newest-wins: only replace the existing entry if the incoming one has a\n // strictly newer timestamp. Ties keep the earlier entry (stable for\n // unsorted inputs) because overwriting on ties would flip rendering output\n // for benign call-order changes.\n const existing = dedupedRollouts[existingIdx];\n if (parseTs(r.updatedAt) > parseTs(existing.updatedAt)) {\n dedupedRollouts[existingIdx] = r;\n }\n }\n\n const memorySummary = renderMemorySummary({\n namespace,\n memories,\n rolloutSummaries: dedupedRollouts,\n maxTokens: maxSummaryTokens,\n });\n\n const memoryMd = renderMemoryMd({\n namespace,\n memories,\n rolloutSummaries: dedupedRollouts,\n });\n\n // Fail fast on schema issues — do not write garbage.\n const validation = validateMemoryMd(memoryMd);\n if (!validation.valid) {\n const reason = validation.errors.join(\"; \");\n logger.warn(`MEMORY.md failed schema validation: ${reason}`);\n throw new Error(`codex-materialize: MEMORY.md schema validation failed: ${reason}`);\n }\n\n const rawMemories = renderRawMemories({ memories });\n\n const rolloutFiles = dedupedRollouts.map((r) => ({\n name: `${sanitizeSlug(r.slug)}.md`,\n body: renderRolloutSummary(r),\n }));\n const destRolloutsDir = path.join(memoriesDir, ROLLOUT_SUBDIR);\n const retainedRolloutNames = new Set(rolloutFiles.map((r) => r.name));\n\n // Skill bundles (issue #2369) — planning, ownership, and disk layout live in\n // materialize-skills.ts.\n const skillPlan = planSkillFiles(options.skills, existingSentinel.projected_skills ?? []);\n\n // ── Idempotence check ──────────────────────────────────────────────────\n const hash = computeContentHash({\n namespace,\n memorySummary,\n memoryMd,\n rawMemories,\n rolloutFiles,\n skillFiles: skillPlan.files,\n });\n\n if (existingSentinel.content_hash === hash) {\n // Idempotence early-return is only safe when the managed files we would\n // have written are still on disk. If a user or external process deleted\n // `MEMORY.md` / `memory_summary.md` / `raw_memories.md` (or any retained\n // rollout file) while the sentinel's hash stayed the same, we must fall\n // through and rewrite — otherwise Codex would be stuck with missing\n // artifacts until a memory-content change happens to flip the hash.\n const requiredFiles = [\n path.join(memoriesDir, \"memory_summary.md\"),\n path.join(memoriesDir, \"MEMORY.md\"),\n path.join(memoriesDir, \"raw_memories.md\"),\n ...rolloutFiles.map((r) => path.join(memoriesDir, ROLLOUT_SUBDIR, r.name)),\n ...skillPlan.files.map((s) => skillFilePath(memoriesDir, s.slug)),\n ];\n const allPresent = requiredFiles.every((f) => fs.existsSync(f));\n const rolloutsClean =\n !rolloutsSupplied ||\n rolloutDirectoryMatchesRetainedSet(\n ensureSafeManagedSubdir(memoriesDir, destRolloutsDir, ROLLOUT_SUBDIR),\n retainedRolloutNames,\n );\n const skillsClean = retiredSkillsAlreadyRemoved(memoriesDir, skillPlan.retiredSlugs);\n if (allPresent && rolloutsClean && skillsClean) {\n logger.debug?.(`no-op materialization for namespace=${namespace} (hash unchanged)`);\n return {\n namespace,\n memoriesDir,\n wrote: false,\n skippedNoSentinel: false,\n skippedIdempotent: true,\n filesWritten: [],\n contentHash: hash,\n };\n }\n logger.debug?.(\n `hash unchanged for namespace=${namespace} but managed files need refresh — forcing rewrite`,\n );\n }\n\n // ── Atomic writes ──────────────────────────────────────────────────────\n // Use a unique, per-run staging sub-directory so two overlapping runs\n // (e.g. a session-end trigger overlapping with a consolidation post-hook)\n // can't stomp each other's tmp files mid-rename. The old \"fixed TMP_DIR,\n // wipe-on-entry\" layout meant run B would delete run A's staging area out\n // from under it, causing ENOENT on A's rename loop. Per-run uniqueness\n // turns the shared dir into an insulated workspace. See review feedback on\n // PR #392.\n const runTag = `${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n const tmpDir = path.join(memoriesDir, `${TMP_DIR}-${runTag}`);\n // Opportunistic GC for stale scratch dirs left behind by a previous\n // crashed run. We only remove entries whose mtime is older than the\n // stale-threshold below — that way we never delete another in-flight\n // run's staging area out from under it. The threshold is deliberately\n // generous (1h) because a healthy materialize completes in milliseconds\n // and there's no legitimate reason for a live staging dir to be older.\n //\n // NB: we compare against `Date.now()` (wall-clock), not against the\n // injected `options.now`. Tests and deterministic replays commonly\n // inject a non-current timestamp, but file mtimes on disk are always\n // wall-clock, so mixing the two would either false-positive delete\n // fresh dirs (test-time in the past) or false-negative skip stale ones\n // (test-time in the future).\n const TMP_STALE_MS = 60 * 60 * 1000;\n const wallClockMs = Date.now();\n try {\n for (const entry of fs.readdirSync(memoriesDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n if (!entry.name.startsWith(TMP_DIR)) continue;\n const stalePath = path.join(memoriesDir, entry.name);\n try {\n const stat = fs.statSync(stalePath);\n if (wallClockMs - stat.mtimeMs < TMP_STALE_MS) continue;\n fs.rmSync(stalePath, { recursive: true, force: true });\n } catch {\n // ignore — another concurrent run may own it, or we lack perms\n }\n }\n } catch {\n // ignore — dir may not exist yet\n }\n fs.mkdirSync(tmpDir, { recursive: true });\n fs.mkdirSync(path.join(tmpDir, ROLLOUT_SUBDIR), { recursive: true });\n\n const filesWritten: string[] = [];\n\n fs.writeFileSync(path.join(tmpDir, \"memory_summary.md\"), memorySummary);\n filesWritten.push(\"memory_summary.md\");\n\n fs.writeFileSync(path.join(tmpDir, \"MEMORY.md\"), memoryMd);\n filesWritten.push(\"MEMORY.md\");\n\n fs.writeFileSync(path.join(tmpDir, \"raw_memories.md\"), rawMemories);\n filesWritten.push(\"raw_memories.md\");\n\n for (const rollout of rolloutFiles) {\n fs.writeFileSync(path.join(tmpDir, ROLLOUT_SUBDIR, rollout.name), rollout.body);\n filesWritten.push(path.join(ROLLOUT_SUBDIR, rollout.name));\n }\n\n stageSkillFiles(tmpDir, skillPlan.files);\n for (const skill of skillPlan.files) {\n filesWritten.push(skillFileRelPath(skill.slug));\n }\n\n // Rename into place. Atomic per-file is sufficient — Codex reads each file\n // independently and tolerates an inconsistent in-between snapshot across\n // files for the duration of the rename loop (milliseconds).\n for (const rel of [\"memory_summary.md\", \"MEMORY.md\", \"raw_memories.md\"]) {\n const src = path.join(tmpDir, rel);\n const dest = path.join(memoriesDir, rel);\n fs.renameSync(src, dest);\n }\n\n const safeDestRolloutsDir = ensureSafeManagedSubdir(memoriesDir, destRolloutsDir, ROLLOUT_SUBDIR);\n // Only garbage-collect rollout files when the caller actually supplied a\n // `rolloutSummaries` array — otherwise we'd wipe legitimately\n // user/Codex-created recap files on every session-end run, since those\n // calls typically omit the rollout set entirely. When rollouts were\n // supplied (even as an empty array — meaning \"we own this dir and it\n // should be empty\"), we clear the stale files we previously owned.\n if (rolloutsSupplied) {\n let existingRollouts: fs.Dirent[];\n try {\n existingRollouts = fs.readdirSync(safeDestRolloutsDir, { withFileTypes: true });\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n existingRollouts = [];\n }\n for (const entry of existingRollouts) {\n if (!entry.isFile()) continue;\n if (!entry.name.endsWith(\".md\")) continue;\n if (retainedRolloutNames.has(entry.name)) continue;\n try {\n fs.unlinkSync(path.join(safeDestRolloutsDir, entry.name));\n } catch (err) {\n throw new Error(\n `codex-materialize: failed to prune stale rollout summary ${entry.name}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n }\n\n for (const rollout of rolloutFiles) {\n const src = path.join(tmpDir, ROLLOUT_SUBDIR, rollout.name);\n const dest = path.join(safeDestRolloutsDir, rollout.name);\n fs.renameSync(src, dest);\n }\n\n commitSkillFiles(memoriesDir, tmpDir, skillPlan);\n\n // Update sentinel last so a crash leaves hash mismatched → next run rewrites.\n const sentinel: SentinelFile = {\n version: MATERIALIZE_VERSION,\n namespace,\n updated_at: now.toISOString(),\n content_hash: hash,\n projected_skills: skillPlan.supplied\n ? skillPlan.files.map((s) => s.slug)\n : (existingSentinel.projected_skills ?? []),\n };\n writeSentinelAtomically(sentinelPath, sentinel);\n\n try {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n } catch {\n // ignore\n }\n\n logger.info(\n `materialized namespace=${namespace} files=${filesWritten.length} hash=${hash.slice(0, 12)}`,\n );\n\n return {\n namespace,\n memoriesDir,\n wrote: true,\n skippedNoSentinel: false,\n skippedIdempotent: false,\n filesWritten,\n contentHash: hash,\n };\n}\n\n/**\n * Create (or refresh) the `.remnic-managed` sentinel. Callers must do this\n * explicitly the first time they want Remnic to start managing a directory —\n * we never write it implicitly, because its presence is the user's opt-in.\n */\nexport function ensureSentinel(memoriesDir: string, namespace: string, now: Date = new Date()): void {\n fs.mkdirSync(memoriesDir, { recursive: true });\n const sentinelPath = path.join(memoriesDir, SENTINEL_FILE);\n if (fs.existsSync(sentinelPath)) {\n readSentinel(sentinelPath);\n return;\n }\n const sentinel: SentinelFile = {\n version: MATERIALIZE_VERSION,\n namespace,\n updated_at: now.toISOString(),\n content_hash: \"\",\n };\n writeSentinelAtomically(sentinelPath, sentinel);\n}\n\n// ─── Rendering ─────────────────────────────────────────────────────────────\n\ninterface RenderContext {\n namespace: string;\n memories: MemoryFile[];\n rolloutSummaries: RolloutSummaryInput[];\n // Historically this interface exposed a `now: Date` field, but neither\n // `renderMemoryMd` nor `renderMemorySummary` ever read it (rendered output\n // is purely a function of `namespace`, `memories`, and `rolloutSummaries`).\n // The field was flagged as dead weight in PR #392 review and removed.\n // If a future renderer needs a timestamp, re-add it here and update both\n // call sites and the schema test.\n}\n\ninterface SummaryRenderContext extends RenderContext {\n maxTokens: number;\n}\n\n/**\n * Render `memory_summary.md` — the always-loaded file.\n * Budget-capped at `maxTokens` whitespace tokens.\n */\nexport function renderMemorySummary(ctx: SummaryRenderContext): string {\n const lines: string[] = [];\n lines.push(\"# Memory Summary\");\n lines.push(\"\");\n lines.push(`_namespace: ${ctx.namespace}_`);\n lines.push(`_source: remnic_`);\n lines.push(\"\");\n\n const highValue = selectSummaryMemories(ctx.memories, 12);\n if (highValue.length > 0) {\n lines.push(\"## Top memories\");\n lines.push(\"\");\n for (const mem of highValue) {\n lines.push(`- ${oneLineSummary(mem)}`);\n }\n lines.push(\"\");\n }\n\n if (ctx.rolloutSummaries.length > 0) {\n lines.push(\"## Recent rollouts\");\n lines.push(\"\");\n const sorted = [...ctx.rolloutSummaries]\n .sort((a, b) => (b.updatedAt ?? \"\").localeCompare(a.updatedAt ?? \"\"))\n .slice(0, 5);\n for (const r of sorted) {\n const when = r.updatedAt ? ` (${r.updatedAt})` : \"\";\n lines.push(`- ${r.slug}${when}`);\n }\n lines.push(\"\");\n }\n\n // Collapse trailing newlines to one without the anchored /\\n+$/ quantifier,\n // which backtracks polynomially (CodeQL js/polynomial-redos).\n const joined = lines.join(\"\\n\");\n let joinedEnd = joined.length;\n while (joinedEnd > 0 && joined[joinedEnd - 1] === \"\\n\") joinedEnd--;\n const full = joinedEnd === joined.length ? joined : `${joined.slice(0, joinedEnd)}\\n`;\n return truncateToTokenBudget(full, ctx.maxTokens);\n}\n\n/**\n * Render `MEMORY.md` — the searchable handbook in Codex's task-group schema.\n */\nexport function renderMemoryMd(ctx: RenderContext): string {\n const lines: string[] = [];\n lines.push(`# Task Group: ${ctx.namespace}`);\n lines.push(`scope: ${ctx.namespace}`);\n lines.push(`applies_to: cwd=*; reuse_rule=namespace-match`);\n lines.push(\"\");\n\n // One \"task\" per top-level topic cluster. For the first cut we group by\n // memory category so the schema validator always sees at least one task.\n const byCategory = groupMemoriesByCategory(ctx.memories);\n let taskIndex = 1;\n if (byCategory.size === 0) {\n lines.push(`## Task ${taskIndex}: baseline — no memories yet`);\n lines.push(\"\");\n lines.push(\"### rollout_summary_files\");\n for (const r of ctx.rolloutSummaries) {\n lines.push(\n `- rollout_summaries/${sanitizeSlug(r.slug)}.md (cwd=${r.cwd ?? \"*\"}, rollout_path=${r.rolloutPath ?? \"\"}, updated_at=${r.updatedAt ?? \"\"}, thread_id=${r.threadId ?? \"\"})`,\n );\n }\n if (ctx.rolloutSummaries.length === 0) {\n lines.push(\"- (none)\");\n }\n lines.push(\"\");\n lines.push(\"### keywords\");\n lines.push(`- ${ctx.namespace}`);\n lines.push(\"\");\n taskIndex += 1;\n } else {\n for (const [category, mems] of byCategory) {\n lines.push(`## Task ${taskIndex}: ${category} memories, outcome=surface-to-codex`);\n lines.push(\"\");\n lines.push(\"### rollout_summary_files\");\n const relevantRollouts = ctx.rolloutSummaries.slice(0, 5);\n if (relevantRollouts.length === 0) {\n lines.push(\"- (none)\");\n } else {\n for (const r of relevantRollouts) {\n lines.push(\n `- rollout_summaries/${sanitizeSlug(r.slug)}.md (cwd=${r.cwd ?? \"*\"}, rollout_path=${r.rolloutPath ?? \"\"}, updated_at=${r.updatedAt ?? \"\"}, thread_id=${r.threadId ?? \"\"})`,\n );\n }\n }\n lines.push(\"\");\n lines.push(\"### keywords\");\n const keywords = collectKeywords(mems, category, ctx.namespace);\n lines.push(`- ${keywords.join(\", \")}`);\n lines.push(\"\");\n taskIndex += 1;\n }\n }\n\n lines.push(\"## User preferences\");\n const prefs = pickCategory(ctx.memories, [\"preference\"]);\n if (prefs.length === 0) {\n lines.push(\"- (none recorded)\");\n } else {\n for (const pref of prefs.slice(0, 20)) {\n lines.push(`- ${oneLineSummary(pref)}`);\n }\n }\n lines.push(\"\");\n\n lines.push(\"## Reusable knowledge\");\n const knowledge = pickCategory(ctx.memories, [\"fact\", \"decision\", \"principle\", \"rule\", \"skill\"]);\n if (knowledge.length === 0) {\n lines.push(\"- (none recorded)\");\n } else {\n for (const mem of knowledge.slice(0, 30)) {\n lines.push(`- ${oneLineSummary(mem)}`);\n }\n }\n lines.push(\"\");\n\n lines.push(\"## Failures and how to do differently\");\n const corrections = pickCategory(ctx.memories, [\"correction\"]);\n if (corrections.length === 0) {\n lines.push(\"- (none recorded)\");\n } else {\n for (const mem of corrections.slice(0, 20)) {\n lines.push(`- ${oneLineSummary(mem)}`);\n }\n }\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n\n/** Render `raw_memories.md` — mechanical dump, latest first. */\nexport function renderRawMemories(ctx: { memories: MemoryFile[] }): string {\n const sorted = [...ctx.memories].sort((a, b) => {\n const aUpdated = a.frontmatter.updated ?? a.frontmatter.created ?? \"\";\n const bUpdated = b.frontmatter.updated ?? b.frontmatter.created ?? \"\";\n return bUpdated.localeCompare(aUpdated);\n });\n\n const lines: string[] = [\"# Raw Memories\", \"\", \"_source: remnic — latest first_\", \"\"];\n for (const mem of sorted) {\n const fm = mem.frontmatter;\n const id = fm.id ?? \"unknown\";\n const category = fm.category ?? \"unknown\";\n const updated = fm.updated ?? fm.created ?? \"\";\n lines.push(`## ${id} (${category}, updated=${updated})`);\n lines.push(\"\");\n lines.push(mem.content.trim());\n lines.push(\"\");\n }\n return lines.join(\"\\n\");\n}\n\n/** Render a single rollout summary file. */\nexport function renderRolloutSummary(input: RolloutSummaryInput): string {\n const lines: string[] = [];\n lines.push(`# Rollout Summary: ${input.slug}`);\n lines.push(\"\");\n const meta: string[] = [];\n if (input.cwd) meta.push(`cwd=${input.cwd}`);\n if (input.rolloutPath) meta.push(`rollout_path=${input.rolloutPath}`);\n if (input.updatedAt) meta.push(`updated_at=${input.updatedAt}`);\n if (input.threadId) meta.push(`thread_id=${input.threadId}`);\n if (meta.length > 0) {\n lines.push(`_${meta.join(\"; \")}_`);\n lines.push(\"\");\n }\n if (input.keywords && input.keywords.length > 0) {\n lines.push(`**keywords:** ${input.keywords.join(\", \")}`);\n lines.push(\"\");\n }\n lines.push(input.body.trim());\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n// ─── Schema validation ─────────────────────────────────────────────────────\n\nexport interface MemoryMdValidation {\n valid: boolean;\n errors: string[];\n}\n\n/**\n * Validate that a rendered `MEMORY.md` matches Codex's task-group schema.\n * We enforce the minimum set of structural requirements called out in #378:\n *\n * - one `# Task Group:` header\n * - `scope:` and `applies_to:` lines directly beneath it\n * - at least one `## Task N:` section\n * - each task section has `### rollout_summary_files` and `### keywords`\n * - `## User preferences`, `## Reusable knowledge`,\n * `## Failures and how to do differently` sections all present\n */\nexport function validateMemoryMd(content: string): MemoryMdValidation {\n const errors: string[] = [];\n const lines = content.split(/\\r?\\n/u);\n\n const taskGroupIndex = lines.findIndex((l) => /^#\\s+Task Group:\\s+\\S+/u.test(l));\n if (taskGroupIndex === -1) {\n errors.push(\"missing `# Task Group:` header\");\n } else {\n const tail = lines.slice(taskGroupIndex + 1, taskGroupIndex + 5);\n if (!tail.some((l) => /^scope:\\s*\\S+/u.test(l))) {\n errors.push(\"missing `scope:` line under Task Group header\");\n }\n if (!tail.some((l) => /^applies_to:\\s*\\S+/u.test(l))) {\n errors.push(\"missing `applies_to:` line under Task Group header\");\n }\n }\n\n const taskHeaders = lines.filter((l) => /^##\\s+Task\\s+\\d+:/u.test(l));\n if (taskHeaders.length === 0) {\n errors.push(\"at least one `## Task N:` section is required\");\n }\n\n // For every task section, make sure we have rollout_summary_files + keywords\n // before the next `##` header at the same level.\n const sectionRegex = /^##\\s+/u;\n for (let i = 0; i < lines.length; i++) {\n if (!/^##\\s+Task\\s+\\d+:/u.test(lines[i])) continue;\n let hasRollout = false;\n let hasKeywords = false;\n for (let j = i + 1; j < lines.length; j++) {\n if (sectionRegex.test(lines[j])) break;\n if (/^###\\s+rollout_summary_files\\s*$/u.test(lines[j])) hasRollout = true;\n if (/^###\\s+keywords\\s*$/u.test(lines[j])) hasKeywords = true;\n }\n if (!hasRollout) errors.push(`task block at line ${i + 1} missing \\`### rollout_summary_files\\``);\n if (!hasKeywords) errors.push(`task block at line ${i + 1} missing \\`### keywords\\``);\n }\n\n const requiredSections = [\n /^##\\s+User preferences\\s*$/u,\n /^##\\s+Reusable knowledge\\s*$/u,\n /^##\\s+Failures and how to do differently\\s*$/u,\n ];\n for (const re of requiredSections) {\n if (!lines.some((l) => re.test(l))) {\n errors.push(`missing required section: ${re.source}`);\n }\n }\n\n return { valid: errors.length === 0, errors };\n}\n\n// ─── Helpers ───────────────────────────────────────────────────────────────\n\nfunction resolveCodexHome(override?: string): string {\n if (override && override.trim().length > 0) {\n return path.resolve(expandTildePath(override.trim()));\n }\n const fromEnv = readEnvVar(\"CODEX_HOME\");\n if (fromEnv && fromEnv.trim().length > 0) {\n return path.resolve(expandTildePath(fromEnv.trim()));\n }\n return path.resolve(resolveHomeDir(), \".codex\");\n}\n\nexport function resolveCodexMemoriesDir(codexHome?: string): string {\n return path.join(resolveCodexHome(codexHome), \"memories\");\n}\n\nexport function hasCodexMaterializeSentinel(codexHome?: string): boolean {\n return readSentinel(path.join(resolveCodexMemoriesDir(codexHome), SENTINEL_FILE)) !== null;\n}\n\nfunction rolloutDirectoryMatchesRetainedSet(\n rolloutsDir: string,\n retainedNames: Set<string>,\n): boolean {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(rolloutsDir, { withFileTypes: true });\n } catch {\n return retainedNames.size === 0;\n }\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n if (!entry.name.endsWith(\".md\")) continue;\n if (!retainedNames.has(entry.name)) return false;\n }\n return true;\n}\n\nfunction readSentinel(sentinelPath: string): SentinelFile | null {\n if (!fs.existsSync(sentinelPath)) return null;\n try {\n const raw = fs.readFileSync(sentinelPath, \"utf-8\");\n const parsed = JSON.parse(raw) as Partial<SentinelFile>;\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n typeof parsed.version !== \"number\" ||\n typeof parsed.namespace !== \"string\" ||\n typeof parsed.updated_at !== \"string\" ||\n typeof parsed.content_hash !== \"string\"\n ) {\n throw new Error(\"invalid sentinel schema\");\n }\n // A sentinel written before issue #2369 has no `projected_skills`, which\n // reads as \"nothing projected\" — so an unrelated skills/ folder written by\n // a user or another tool is never treated as ours.\n const projected = Array.isArray(parsed.projected_skills)\n ? parsed.projected_skills.filter((slug): slug is string => typeof slug === \"string\")\n : [];\n return {\n version: parsed.version,\n namespace: parsed.namespace,\n updated_at: parsed.updated_at,\n content_hash: parsed.content_hash,\n projected_skills: projected,\n };\n } catch (err) {\n throw new Error(\n `codex-materialize: corrupt ${SENTINEL_FILE} sentinel at ${sentinelPath}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\nfunction writeSentinelAtomically(\n sentinelPath: string,\n sentinel: SentinelFile,\n): void {\n const tmpPath = `${sentinelPath}.${process.pid}.${Date.now()}.${Math.random()\n .toString(16)\n .slice(2)}.tmp`;\n try {\n fs.writeFileSync(tmpPath, `${JSON.stringify(sentinel, null, 2)}\\n`, {\n flag: \"wx\",\n });\n fs.renameSync(tmpPath, sentinelPath);\n } catch (err) {\n try {\n fs.rmSync(tmpPath, { force: true });\n } catch {\n // ignore cleanup failures; preserve the original write/rename error\n }\n throw err;\n }\n}\n\nfunction selectSummaryMemories(memories: MemoryFile[], limit: number): MemoryFile[] {\n const scored = memories\n .filter((m) => !m.frontmatter.status || m.frontmatter.status === \"active\")\n .map((m) => {\n const confidence = typeof m.frontmatter.confidence === \"number\" ? m.frontmatter.confidence : 0;\n const importance =\n typeof m.frontmatter.importance === \"object\" &&\n m.frontmatter.importance !== null &&\n typeof (m.frontmatter.importance as { score?: number }).score === \"number\"\n ? ((m.frontmatter.importance as { score: number }).score ?? 0)\n : 0;\n const updated = m.frontmatter.updated ?? m.frontmatter.created ?? \"\";\n return { memory: m, score: importance * 2 + confidence, updated };\n });\n\n scored.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n return b.updated.localeCompare(a.updated);\n });\n\n return scored.slice(0, limit).map((s) => s.memory);\n}\n\nfunction oneLineSummary(memory: MemoryFile): string {\n const raw = memory.content.replace(/\\s+/gu, \" \").trim();\n if (raw.length <= 160) return raw;\n return `${raw.slice(0, 157)}...`;\n}\n\nfunction groupMemoriesByCategory(memories: MemoryFile[]): Map<string, MemoryFile[]> {\n const map = new Map<string, MemoryFile[]>();\n for (const memory of memories) {\n if (memory.frontmatter.status && memory.frontmatter.status !== \"active\") continue;\n const category = memory.frontmatter.category ?? \"unknown\";\n const list = map.get(category) ?? [];\n list.push(memory);\n map.set(category, list);\n }\n return map;\n}\n\nfunction pickCategory(memories: MemoryFile[], categories: string[]): MemoryFile[] {\n const allowed = new Set(categories);\n return memories.filter(\n (m) =>\n (!m.frontmatter.status || m.frontmatter.status === \"active\") &&\n allowed.has(m.frontmatter.category ?? \"\"),\n );\n}\n\nfunction collectKeywords(memories: MemoryFile[], category: string, namespace: string): string[] {\n const keywords = new Set<string>();\n keywords.add(category);\n keywords.add(namespace);\n for (const mem of memories.slice(0, 10)) {\n for (const tag of mem.frontmatter.tags ?? []) {\n if (typeof tag === \"string\" && tag.trim().length > 0) keywords.add(tag.trim());\n }\n }\n return [...keywords].slice(0, 16);\n}\n\nfunction pruneRollouts(\n rollouts: RolloutSummaryInput[],\n retentionDays: number,\n now: Date,\n): RolloutSummaryInput[] {\n // Negative retention → \"infinite retention\" escape hatch. `parseConfig`\n // clamps the knob to >= 0, so in practice only callers passing a negative\n // value intentionally get the all-pass behavior.\n if (retentionDays < 0) return rollouts;\n // retentionDays === 0 → cutoff is exactly `now`, which prunes every\n // rollout whose `updatedAt` is in the past (i.e. all of them in practice).\n // This matches the documented semantics of \"retain for 0 days\".\n const cutoffMs = now.getTime() - retentionDays * 24 * 60 * 60 * 1000;\n return rollouts.filter((r) => {\n if (!r.updatedAt) return true;\n const t = Date.parse(r.updatedAt);\n if (!Number.isFinite(t)) return true;\n return t >= cutoffMs;\n });\n}\n\nfunction sanitizeSlug(slug: string): string {\n const sanitized = slug\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/gu, \"-\")\n .slice(0, 96);\n const trimmed = trimHyphenEdges(sanitized);\n return trimmed || \"rollout\";\n}\n\nfunction trimHyphenEdges(value: string): string {\n let start = 0;\n let end = value.length;\n while (start < end && value[start] === \"-\") start += 1;\n while (end > start && value[end - 1] === \"-\") end -= 1;\n return value.slice(start, end);\n}\n/** Shared script-aware approximation used by the budget check. */\nexport function approximateTokenCount(text: string): number {\n return estimateTokenCount(text);\n}\n\n/**\n * Truncate `text` so it fits under `maxTokens`. We drop trailing lines until\n * under budget, then append a marker so readers can see that truncation occurred.\n */\nexport function truncateToTokenBudget(text: string, maxTokens: number): string {\n if (maxTokens <= 0) return \"\";\n if (approximateTokenCount(text) <= maxTokens) return text;\n\n const lineMarker = \"_[truncated for summary budget]_\";\n const tailMarker = \"[truncated]\";\n if (approximateTokenCount(tailMarker) > maxTokens) return \"\";\n const lineMarkerTokens = approximateTokenCount(lineMarker);\n\n const lines = text.split(/\\r?\\n/u);\n const lineBudget = Math.max(0, maxTokens - lineMarkerTokens);\n while (lines.length > 0 && approximateTokenCount(lines.join(\"\\n\")) > lineBudget) {\n lines.pop();\n }\n lines.push(lineMarker);\n let result = lines.join(\"\\n\");\n\n if (approximateTokenCount(result) > maxTokens) {\n const codePoints = [...result];\n let low = 0;\n let high = codePoints.length;\n while (low < high) {\n const mid = Math.ceil((low + high) / 2);\n const prefix = codePoints.slice(0, mid).join(\"\");\n const candidate = prefix.length > 0 ? `${prefix} ${tailMarker}` : tailMarker;\n if (approximateTokenCount(candidate) <= maxTokens) low = mid;\n else high = mid - 1;\n }\n const prefix = codePoints.slice(0, low).join(\"\");\n result = prefix.length > 0 ? `${prefix} ${tailMarker}` : tailMarker;\n }\n return result;\n}\n\nfunction computeContentHash(input: {\n namespace: string;\n memorySummary: string;\n memoryMd: string;\n rawMemories: string;\n rolloutFiles: Array<{ name: string; body: string }>;\n skillFiles: Array<{ slug: string; body: string }>;\n}): string {\n const hash = createHash(\"sha256\");\n hash.update(`v${MATERIALIZE_VERSION}\\n`);\n hash.update(`namespace=${input.namespace}\\n`);\n hash.update(\"---memory_summary---\\n\");\n hash.update(input.memorySummary);\n hash.update(\"\\n---memory_md---\\n\");\n hash.update(input.memoryMd);\n hash.update(\"\\n---raw_memories---\\n\");\n hash.update(input.rawMemories);\n const sortedRollouts = [...input.rolloutFiles].sort((a, b) => a.name.localeCompare(b.name));\n for (const r of sortedRollouts) {\n hash.update(`\\n---rollout:${r.name}---\\n`);\n hash.update(r.body);\n }\n // Sorted by slug so call order cannot flip the hash (§26).\n const sortedSkills = [...input.skillFiles].sort((a, b) => (a.slug < b.slug ? -1 : a.slug > b.slug ? 1 : 0));\n for (const s of sortedSkills) {\n hash.update(`\\n---skill:${s.slug}---\\n`);\n hash.update(s.body);\n }\n return hash.digest(\"hex\");\n}\n\n// ─── Stat helper for tests / debugging ─────────────────────────────────────\n\n/**\n * Return basic stats about a materialized memories dir. Useful for tests and\n * debug CLI output. Returns `null` if the dir does not exist.\n */\nexport function describeMemoriesDir(memoriesDir: string): {\n exists: boolean;\n hasSentinel: boolean;\n files: string[];\n sentinel: SentinelFile | null;\n} | null {\n if (!fs.existsSync(memoriesDir)) return null;\n const sentinelPath = path.join(memoriesDir, SENTINEL_FILE);\n const sentinel = readSentinel(sentinelPath);\n const files: string[] = [];\n for (const entry of fs.readdirSync(memoriesDir, { withFileTypes: true })) {\n if (entry.isFile() && OWNED_FILES.has(entry.name)) files.push(entry.name);\n }\n const rolloutsDir = path.join(memoriesDir, ROLLOUT_SUBDIR);\n if (fs.existsSync(rolloutsDir)) {\n try {\n for (const entry of fs.readdirSync(rolloutsDir, { withFileTypes: true })) {\n if (entry.isFile() && entry.name.endsWith(\".md\")) {\n files.push(path.join(ROLLOUT_SUBDIR, entry.name));\n }\n }\n } catch {\n // ignore\n }\n }\n return {\n exists: true,\n hasSentinel: sentinel !== null,\n files: files.sort(),\n sentinel,\n };\n}\n","/**\n * materialize-paths.ts — containment guard for the materializer's managed\n * sub-directories (`rollout_summaries/`, `skills/`).\n *\n * Extracted from codex-materialize.ts so the skills section (issue #2369) and\n * the rollout section share ONE containment implementation instead of forking\n * the check (rule 22).\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { pathIsInside } from \"../utils/path-containment.js\";\n\n/**\n * Resolve a managed sub-directory of `memoriesDir`, creating it when absent,\n * and refuse a symlinked or escaping target. Returns the (unchanged) path so\n * callers can use it directly.\n */\nexport function ensureSafeManagedSubdir(memoriesDir: string, subdir: string, label: string): string {\n const memoriesReal = fs.realpathSync(memoriesDir);\n\n try {\n const stat = fs.lstatSync(subdir);\n if (stat.isSymbolicLink()) {\n throw new Error(\"is a symbolic link\");\n }\n if (!stat.isDirectory()) {\n throw new Error(\"is not a directory\");\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") {\n throw new Error(\n `codex-materialize: unsafe ${label} directory at ${subdir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n }\n fs.mkdirSync(subdir, { recursive: true });\n }\n\n const subdirReal = fs.realpathSync(subdir);\n if (!pathIsInside(memoriesReal, subdirReal)) {\n throw new Error(\n `codex-materialize: unsafe ${label} directory at ${subdir}: resolves outside ${memoriesDir}`,\n );\n }\n\n return path.normalize(subdir);\n}\n","/**\n * materialize-skills.ts — the `skills/` section of the Codex materializer\n * (issue #2369).\n *\n * Extracted from codex-materialize.ts (which sits at its structural LOC cap)\n * so the skill staging / commit / prune rules live in one small module. Format\n * and slug rules stay in the host-agnostic `procedural/skill-projection.ts`;\n * this module only decides what lands on disk.\n *\n * Ownership rule: Remnic removes ONLY the slugs a previous run recorded in the\n * sentinel's `projected_skills`. A skill folder a user (or another tool)\n * created is never in that list, so it is never a removal candidate.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { renderSkillBundle, SKILL_FILE_NAME, type SkillBundle } from \"../procedural/skill-projection.js\";\nimport { isValidSkillSlug } from \"../skills-registry.js\";\nimport { ensureSafeManagedSubdir } from \"./materialize-paths.js\";\n\n/** Sub-directory for projected procedural skill bundles. */\nexport const SKILLS_SUBDIR = \"skills\";\n\nexport interface SkillFile {\n slug: string;\n body: string;\n}\n\nexport interface SkillPlan {\n /** False when the caller omitted `skills` — leave `skills/` untouched. */\n supplied: boolean;\n /** Bundles to write, deduplicated on slug. */\n files: SkillFile[];\n /** Previously projected slugs this run no longer projects. */\n retiredSlugs: string[];\n}\n\n/**\n * Decide what this run writes and removes. `undefined` bundles mean \"not our\n * business this run\"; an empty array is authoritative and retires everything\n * previously projected.\n */\nexport function planSkillFiles(\n bundles: SkillBundle[] | undefined,\n previouslyProjectedSlugs: readonly string[],\n): SkillPlan {\n const files: SkillFile[] = [];\n const seen = new Set<string>();\n for (const bundle of bundles ?? []) {\n // Invalid or duplicate slugs are dropped so two bundles can never target\n // one folder and leave the second rename with no source (§37).\n if (!isValidSkillSlug(bundle.slug) || seen.has(bundle.slug)) continue;\n seen.add(bundle.slug);\n files.push({ slug: bundle.slug, body: renderSkillBundle(bundle) });\n }\n const previous = previouslyProjectedSlugs.filter((slug) => isValidSkillSlug(slug));\n return {\n supplied: bundles !== undefined,\n files,\n retiredSlugs: bundles === undefined ? [] : previous.filter((slug) => !seen.has(slug)),\n };\n}\n\n/** Absolute path of a projected bundle's SKILL.md under `memoriesDir`. */\nexport function skillFilePath(memoriesDir: string, slug: string): string {\n return path.join(memoriesDir, SKILLS_SUBDIR, slug, SKILL_FILE_NAME);\n}\n\n/** Relative path recorded in `MaterializeResult.filesWritten`. */\nexport function skillFileRelPath(slug: string): string {\n return path.join(SKILLS_SUBDIR, slug, SKILL_FILE_NAME);\n}\n\n/**\n * True when no retired folder is still on disk. Guards the idempotent\n * early-return: a hash match is only a safe no-op if the removals also landed.\n */\nexport function retiredSkillsAlreadyRemoved(memoriesDir: string, retiredSlugs: readonly string[]): boolean {\n return retiredSlugs.every((slug) => !fs.existsSync(path.join(memoriesDir, SKILLS_SUBDIR, slug)));\n}\n\n/** Render bundles into the per-run staging directory. */\nexport function stageSkillFiles(tmpDir: string, files: readonly SkillFile[]): void {\n for (const file of files) {\n const stagedDir = path.join(tmpDir, SKILLS_SUBDIR, file.slug);\n fs.mkdirSync(stagedDir, { recursive: true });\n fs.writeFileSync(path.join(stagedDir, SKILL_FILE_NAME), file.body);\n }\n}\n\n/**\n * Remove retired folders, then rename each staged SKILL.md into place. Per-file\n * renames (never directory renames) so an existing folder cannot cause\n * ENOTEMPTY and so Codex never observes a half-written file.\n */\nexport function commitSkillFiles(memoriesDir: string, tmpDir: string, plan: SkillPlan): void {\n if (!plan.supplied) return;\n if (plan.files.length === 0 && plan.retiredSlugs.length === 0) return;\n\n const skillsDir = ensureSafeManagedSubdir(memoriesDir, path.join(memoriesDir, SKILLS_SUBDIR), SKILLS_SUBDIR);\n for (const slug of plan.retiredSlugs) {\n const retiredDir = path.join(skillsDir, slug);\n try {\n // Never follow a symlink out of the managed tree while pruning.\n if (fs.lstatSync(retiredDir).isSymbolicLink()) continue;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") continue;\n throw err;\n }\n try {\n fs.rmSync(retiredDir, { recursive: true, force: true });\n } catch (err) {\n throw new Error(\n `codex-materialize: failed to remove retired skill ${slug}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n for (const file of plan.files) {\n const destDir = path.join(skillsDir, file.slug);\n fs.mkdirSync(destDir, { recursive: true });\n fs.renameSync(\n path.join(tmpDir, SKILLS_SUBDIR, file.slug, SKILL_FILE_NAME),\n path.join(destDir, SKILL_FILE_NAME),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwCA;AAAA,EACE;AAAA,OACK;AACP,OAAOA,SAAQ;AACf,OAAOC,WAAU;;;ACnCjB,OAAO,QAAQ;AACf,OAAO,UAAU;AASV,SAAS,wBAAwB,aAAqB,QAAgB,OAAuB;AAClG,QAAM,eAAe,GAAG,aAAa,WAAW;AAEhD,MAAI;AACF,UAAM,OAAO,GAAG,UAAU,MAAM;AAChC,QAAI,KAAK,eAAe,GAAG;AACzB,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC;AACA,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC;AAAA,EACF,SAAS,KAAK;AACZ,QAAK,IAA8B,SAAS,UAAU;AACpD,YAAM,IAAI;AAAA,QACR,6BAA6B,KAAK,iBAAiB,MAAM,KACvD,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CACjD;AAAA,MACF;AAAA,IACF;AACA,OAAG,UAAU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AA,EACF;AACF;","names":["fs","path","fs","path","path","fs","path","fs","prefix"]}
@@ -1,16 +1,16 @@
1
1
  import { CompoundingPromotionReport } from './compounding/engine.js';
2
2
  import { ConversationIndexBackendInspection } from './conversation-index/backend.js';
3
3
  import { MigrateObservationsResult } from './maintenance/migrate-observations.js';
4
- import { M as MemoryFile, m as MemoryFrontmatter, w as MemoryStatus, a8 as BehaviorSignalEvent, Q as QmdSearchResult, ad as BulkImportResult, ai as MemoryActionEvent, K as MemoryLifecycleEvent } from './types-BxAcOl5Q.js';
5
- import { C as ConversationIndexCoordinator, T as TierMigrationCoordinator, O as Orchestrator } from './orchestrator-Bvq1-RQs.js';
6
- import { S as StorageManager } from './storage-BIDzuKIn.js';
4
+ import { M as MemoryFile, m as MemoryFrontmatter, w as MemoryStatus, a9 as BehaviorSignalEvent, Q as QmdSearchResult, ae as BulkImportResult, aj as MemoryActionEvent, K as MemoryLifecycleEvent } from './types-ETU5N6nB.js';
5
+ import { C as ConversationIndexCoordinator, T as TierMigrationCoordinator, O as Orchestrator } from './orchestrator-4wzJrPVm.js';
6
+ import { S as StorageManager } from './storage-B7urx1K3.js';
7
7
  import { TrustZoneDemoSeedResult, TrustZoneName, TrustZonePromotionResult, TrustZoneStoreStatus } from './trust-zones.js';
8
- import { f as EngramAccessService } from './access-service-DkaIG3n8.js';
8
+ import { f as EngramAccessService } from './access-service-DqPa3hy4.js';
9
9
  import { Writable, Readable } from 'node:stream';
10
10
  import { ResolveSecretRefFn } from './resolve-auth-token.js';
11
11
  import { CausalTrajectoryStoreStatus } from './causal-trajectory.js';
12
12
  import { C as ConnectorRunResult, a as ConnectorsOutputFormat } from './connectors-cli-2iaQ5tX2.js';
13
- import { P as ProcessBatchFn } from './pipeline-C8vfIiTX.js';
13
+ import { P as ProcessBatchFn } from './pipeline-CgXgdIrF.js';
14
14
  import { MemoryGovernanceRunResult, MemoryGovernanceSummary, MemoryGovernanceMetrics, MemoryGovernanceQualityScore, MemoryGovernanceReviewQueueEntry, MemoryGovernanceAppliedAction, MemoryGovernanceTransitionReport, MemoryGovernanceManifest, MemoryGovernanceRestoreManifest, RestoreMemoryGovernanceRunResult } from './maintenance/memory-governance.js';
15
15
  import { RebuildMemoryProjectionResult, RepairMemoryProjectionResult, VerifyMemoryProjectionResult } from './maintenance/rebuild-memory-projection.js';
16
16
  import { RebuildObservationsResult } from './maintenance/rebuild-observations.js';
package/dist/cli.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import './compounding/engine.js';
2
2
  import './conversation-index/backend.js';
3
3
  import './maintenance/migrate-observations.js';
4
- import './types-BxAcOl5Q.js';
5
- import './orchestrator-Bvq1-RQs.js';
6
- import './storage-BIDzuKIn.js';
4
+ import './types-ETU5N6nB.js';
5
+ import './orchestrator-4wzJrPVm.js';
6
+ import './storage-B7urx1K3.js';
7
7
  import './trust-zones.js';
8
- export { c as AccessHttpServeCliCommandOptions, d as ArchiveObservationsCliCommandOptions, e as AuditMemoryCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, g as CliCommand, h as CliProgram, i as CompatCliCommandOptions, j as ConnectorsRunCliOutputOptions, k as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, l as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, m as MemoryActionAuditCliNamespaceSummary, n as MemoryActionAuditCliReport, o as MemoryGovernanceCliCommandOptions, q as MemoryGovernanceReportCliCommandOptions, s as MemoryGovernanceRestoreCliCommandOptions, t as MemoryReviewDispositionCliCommandOptions, u as MemoryTimelineCliCommandOptions, v as MigrateCliOrchestrator, w as MigrateCliReport, x as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, y as PolicyDiffEntry, z as PolicyRollbackCliReport, F as PolicyStatusCliReport, H as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, I as RebuildMemoryProjectionCliCommandOptions, J as RebuildObservationsCliCommandOptions, K as RepairMemoryProjectionCliCommandOptions, L as ReplayCliCommandOptions, N as ReplayCliOrchestrator, O as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, Q as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, U as TailscaleSyncCliCommandOptions, V as TierMigrateCliAdapter, W as TierMigrateCoordinatorCliAdapter, X as TierMigrateLegacyCliAdapter, Y as TierStatusCliAdapter, Z as TierStatusCoordinatorCliAdapter, _ as TierStatusLegacyCliAdapter, $ as TrainingExportCliCommandOptions, a0 as VerifyMemoryProjectionCliCommandOptions, a1 as WebDavServeCliCommandOptions, a2 as WorkProjectCliCommandOptions, a3 as WorkTaskCliCommandOptions, a4 as emitConnectorsRunCliResult, a5 as filterNormalMemorySearchResults, a6 as hasDestructivePurgeFailures, a7 as isNormalRetrievalVisibleMemory, a8 as listMemoryMarkdownFilePaths, a9 as parseDurationToMs, aa as parseStrictCliDate, ab as planAggressiveDuplicateDeletions, ac as planExactDuplicateDeletions, ad as registerCli, ae as resolveAccessPrincipalOverride, af as resolveMemoryDirForNamespace, ag as runAbstractionNodeStatusCliCommand, ah as runAccessHttpServeCliCommand, ai as runAccessHttpStatusCliCommand, aj as runAccessHttpStopCliCommand, ak as runAccessMcpServeCliCommand, al as runArchiveObservationsCliCommand, r as runAuditMemoryCliCommand, am as runBenchmarkBaselineReportCliCommand, an as runBenchmarkBaselineSnapshotCliCommand, ao as runBenchmarkCiGateCliCommand, ap as runBenchmarkImportCliCommand, aq as runBenchmarkStatusCliCommand, ar as runBenchmarkStoredBaselineCiGateCliCommand, as as runBenchmarkValidateCliCommand, b as runBulkImportCliCommand, at as runCausalTrajectoryStatusCliCommand, au as runCommitmentLifecycleCliCommand, av as runCommitmentRecordCliCommand, aw as runCommitmentSetStateCliCommand, ax as runCommitmentStatusCliCommand, ay as runCompatCliCommand, az as runCompoundingPromoteCliCommand, aA as runConversationIndexHealthCliCommand, aB as runConversationIndexInspectCliCommand, aC as runConversationIndexRebuildCliCommand, aD as runCueAnchorStatusCliCommand, aE as runDashboardStartCliCommand, aF as runDashboardStatusCliCommand, aG as runDashboardStopCliCommand, aH as runGraphHealthCliCommand, aI as runHarmonicSearchCliCommand, aJ as runMemoryActionAuditCliCommand, aK as runMemoryGovernanceCliCommand, aL as runMemoryGovernanceReportCliCommand, aM as runMemoryGovernanceRestoreCliCommand, aN as runMemoryReviewDispositionCliCommand, aO as runMemoryTimelineCliCommand, aP as runMigrateNormalizeFrontmatterCliCommand, aQ as runMigrateObservationsCliCommand, aR as runMigrateRechunkCliCommand, aS as runMigrateReextractCliCommand, aT as runMigrateRescoreImportanceCliCommand, aU as runObjectiveStateStatusCliCommand, aV as runPolicyDiffCliCommand, aW as runPolicyRollbackCliCommand, aX as runPolicyStatusCliCommand, aY as runRebuildMemoryLifecycleLedgerCliCommand, aZ as runRebuildMemoryProjectionCliCommand, a_ as runRebuildObservationsCliCommand, a$ as runRepairMemoryProjectionCliCommand, b0 as runReplayCliCommand, b1 as runResumeBundleBuildCliCommand, b2 as runResumeBundleRecordCliCommand, b3 as runResumeBundleStatusCliCommand, b4 as runRouteCliCommand, b5 as runSemanticRulePromoteCliCommand, b6 as runSemanticRuleVerifyCliCommand, b7 as runSessionCheckCliCommand, b8 as runSessionRepairCliCommand, b9 as runTailscaleStatusCliCommand, ba as runTailscaleSyncCliCommand, bb as runTierMigrateCliCommand, bc as runTierStatusCliCommand, bd as runTrainingExportCliCommand, be as runTrustZoneDemoSeedCliCommand, bf as runTrustZonePromoteCliCommand, bg as runTrustZoneStatusCliCommand, bh as runUtilityLearningCliCommand, bi as runUtilityLearningStatusCliCommand, bj as runUtilityTelemetryRecordCliCommand, bk as runUtilityTelemetryStatusCliCommand, bl as runVerifiedRecallSearchCliCommand, bm as runVerifyMemoryProjectionCliCommand, bn as runWebDavServeCliCommand, bo as runWebDavStopCliCommand, bp as runWorkProductRecallSearchCliCommand, bq as runWorkProductRecordCliCommand, br as runWorkProductStatusCliCommand, bs as runWorkProjectCliCommand, bt as runWorkTaskCliCommand } from './cli-ChKeYMZv.js';
9
- import './access-service-DkaIG3n8.js';
8
+ export { c as AccessHttpServeCliCommandOptions, d as ArchiveObservationsCliCommandOptions, e as AuditMemoryCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, g as CliCommand, h as CliProgram, i as CompatCliCommandOptions, j as ConnectorsRunCliOutputOptions, k as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, l as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, m as MemoryActionAuditCliNamespaceSummary, n as MemoryActionAuditCliReport, o as MemoryGovernanceCliCommandOptions, q as MemoryGovernanceReportCliCommandOptions, s as MemoryGovernanceRestoreCliCommandOptions, t as MemoryReviewDispositionCliCommandOptions, u as MemoryTimelineCliCommandOptions, v as MigrateCliOrchestrator, w as MigrateCliReport, x as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, y as PolicyDiffEntry, z as PolicyRollbackCliReport, F as PolicyStatusCliReport, H as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, I as RebuildMemoryProjectionCliCommandOptions, J as RebuildObservationsCliCommandOptions, K as RepairMemoryProjectionCliCommandOptions, L as ReplayCliCommandOptions, N as ReplayCliOrchestrator, O as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, Q as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, U as TailscaleSyncCliCommandOptions, V as TierMigrateCliAdapter, W as TierMigrateCoordinatorCliAdapter, X as TierMigrateLegacyCliAdapter, Y as TierStatusCliAdapter, Z as TierStatusCoordinatorCliAdapter, _ as TierStatusLegacyCliAdapter, $ as TrainingExportCliCommandOptions, a0 as VerifyMemoryProjectionCliCommandOptions, a1 as WebDavServeCliCommandOptions, a2 as WorkProjectCliCommandOptions, a3 as WorkTaskCliCommandOptions, a4 as emitConnectorsRunCliResult, a5 as filterNormalMemorySearchResults, a6 as hasDestructivePurgeFailures, a7 as isNormalRetrievalVisibleMemory, a8 as listMemoryMarkdownFilePaths, a9 as parseDurationToMs, aa as parseStrictCliDate, ab as planAggressiveDuplicateDeletions, ac as planExactDuplicateDeletions, ad as registerCli, ae as resolveAccessPrincipalOverride, af as resolveMemoryDirForNamespace, ag as runAbstractionNodeStatusCliCommand, ah as runAccessHttpServeCliCommand, ai as runAccessHttpStatusCliCommand, aj as runAccessHttpStopCliCommand, ak as runAccessMcpServeCliCommand, al as runArchiveObservationsCliCommand, r as runAuditMemoryCliCommand, am as runBenchmarkBaselineReportCliCommand, an as runBenchmarkBaselineSnapshotCliCommand, ao as runBenchmarkCiGateCliCommand, ap as runBenchmarkImportCliCommand, aq as runBenchmarkStatusCliCommand, ar as runBenchmarkStoredBaselineCiGateCliCommand, as as runBenchmarkValidateCliCommand, b as runBulkImportCliCommand, at as runCausalTrajectoryStatusCliCommand, au as runCommitmentLifecycleCliCommand, av as runCommitmentRecordCliCommand, aw as runCommitmentSetStateCliCommand, ax as runCommitmentStatusCliCommand, ay as runCompatCliCommand, az as runCompoundingPromoteCliCommand, aA as runConversationIndexHealthCliCommand, aB as runConversationIndexInspectCliCommand, aC as runConversationIndexRebuildCliCommand, aD as runCueAnchorStatusCliCommand, aE as runDashboardStartCliCommand, aF as runDashboardStatusCliCommand, aG as runDashboardStopCliCommand, aH as runGraphHealthCliCommand, aI as runHarmonicSearchCliCommand, aJ as runMemoryActionAuditCliCommand, aK as runMemoryGovernanceCliCommand, aL as runMemoryGovernanceReportCliCommand, aM as runMemoryGovernanceRestoreCliCommand, aN as runMemoryReviewDispositionCliCommand, aO as runMemoryTimelineCliCommand, aP as runMigrateNormalizeFrontmatterCliCommand, aQ as runMigrateObservationsCliCommand, aR as runMigrateRechunkCliCommand, aS as runMigrateReextractCliCommand, aT as runMigrateRescoreImportanceCliCommand, aU as runObjectiveStateStatusCliCommand, aV as runPolicyDiffCliCommand, aW as runPolicyRollbackCliCommand, aX as runPolicyStatusCliCommand, aY as runRebuildMemoryLifecycleLedgerCliCommand, aZ as runRebuildMemoryProjectionCliCommand, a_ as runRebuildObservationsCliCommand, a$ as runRepairMemoryProjectionCliCommand, b0 as runReplayCliCommand, b1 as runResumeBundleBuildCliCommand, b2 as runResumeBundleRecordCliCommand, b3 as runResumeBundleStatusCliCommand, b4 as runRouteCliCommand, b5 as runSemanticRulePromoteCliCommand, b6 as runSemanticRuleVerifyCliCommand, b7 as runSessionCheckCliCommand, b8 as runSessionRepairCliCommand, b9 as runTailscaleStatusCliCommand, ba as runTailscaleSyncCliCommand, bb as runTierMigrateCliCommand, bc as runTierStatusCliCommand, bd as runTrainingExportCliCommand, be as runTrustZoneDemoSeedCliCommand, bf as runTrustZonePromoteCliCommand, bg as runTrustZoneStatusCliCommand, bh as runUtilityLearningCliCommand, bi as runUtilityLearningStatusCliCommand, bj as runUtilityTelemetryRecordCliCommand, bk as runUtilityTelemetryStatusCliCommand, bl as runVerifiedRecallSearchCliCommand, bm as runVerifyMemoryProjectionCliCommand, bn as runWebDavServeCliCommand, bo as runWebDavStopCliCommand, bp as runWorkProductRecallSearchCliCommand, bq as runWorkProductRecordCliCommand, br as runWorkProductStatusCliCommand, bs as runWorkProjectCliCommand, bt as runWorkTaskCliCommand } from './cli-DO3i14pM.js';
9
+ import './access-service-DqPa3hy4.js';
10
10
  import 'node:stream';
11
11
  import './resolve-auth-token.js';
12
12
  import './causal-trajectory.js';
13
13
  import './connectors-cli-2iaQ5tX2.js';
14
- import './pipeline-C8vfIiTX.js';
14
+ import './pipeline-CgXgdIrF.js';
15
15
  import './maintenance/memory-governance.js';
16
16
  import './maintenance/rebuild-memory-projection.js';
17
17
  import './maintenance/rebuild-observations.js';
@@ -74,14 +74,14 @@ import './fallback-llm.js';
74
74
  import './resolve-provider-secret.js';
75
75
  import './transcript.js';
76
76
  import './summarizer.js';
77
- import './maintenance-nkdtSrVr.js';
78
- import './catalog-CX2BZEJh.js';
77
+ import './maintenance-PFvY1Pw_.js';
78
+ import './catalog-DO_7zfkv.js';
79
79
  import './namespaces/search.js';
80
80
  import './utility-runtime.js';
81
81
  import './tier-routing.js';
82
82
  import './lifecycle.js';
83
83
  import './orchestration/compression-guideline-coordinator.js';
84
- import './semantic-consolidation-DlN6xe20.js';
84
+ import './semantic-consolidation-mSPwQSmF.js';
85
85
  import './connectors/codex-materialize.js';
86
86
  import './logger.js';
87
87
  import './embedding-fallback.js';
@@ -93,11 +93,11 @@ import './harmonic-retrieval.js';
93
93
  import './trust-score-stage.js';
94
94
  import './trust-score.js';
95
95
  import './included-memories.js';
96
- import './dependency-propagation-delivery-B8ZMBBCY.js';
96
+ import './dependency-propagation-delivery-D23_x-s5.js';
97
97
  import './boxes.js';
98
98
  import './namespaces/storage.js';
99
99
  import './threading.js';
100
- import './scope-profiles-DLrRxFWR.js';
100
+ import './scope-profiles-ChZUtxDU.js';
101
101
  import './recall-xray.js';
102
102
  import './memory-provenance.js';
103
103
  import './user-model.js';
@@ -108,7 +108,7 @@ import './relevance.js';
108
108
  import './negative.js';
109
109
  import './session-observer-state.js';
110
110
  import './semantic-BalR6EXU.js';
111
- import './service-GkYyVfm9.js';
111
+ import './service-BICWLwSP.js';
112
112
  import './extraction-judge.js';
113
113
  import './lcm/engine.js';
114
114
  import './lcm/archive.js';
@@ -129,7 +129,7 @@ import './recall-audit.js';
129
129
  import './types-B1VHaf2w.js';
130
130
  import './transfer/capsule-import.js';
131
131
  import './transfer/types.js';
132
- import './access-namespace-preflight-B7Usyz-K.js';
132
+ import './access-namespace-preflight-D_6mo8ms.js';
133
133
  import './access-token-capabilities.js';
134
134
  import 'node:async_hooks';
135
135
  import './recall-explain-renderer.js';
package/dist/cli.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  runWorkProductStatusCliCommand,
92
92
  runWorkProjectCliCommand,
93
93
  runWorkTaskCliCommand
94
- } from "./chunk-7QOO4LGC.js";
94
+ } from "./chunk-3JZBPTLD.js";
95
95
  import "./chunk-MMACM5G2.js";
96
96
  import "./chunk-54BGIBCR.js";
97
97
  import "./chunk-H4CKS5B2.js";
@@ -114,7 +114,7 @@ import "./chunk-DQTCGVFK.js";
114
114
  import "./chunk-EEC4PCG5.js";
115
115
  import "./chunk-IIFFC3RL.js";
116
116
  import "./chunk-AXFWMRKI.js";
117
- import "./chunk-TDKSCV62.js";
117
+ import "./chunk-3NH3VP3U.js";
118
118
  import "./chunk-YLBE6PLR.js";
119
119
  import "./chunk-CDKHKZL5.js";
120
120
  import "./chunk-HSSERO3E.js";
@@ -122,25 +122,25 @@ import "./chunk-NOUJNHWG.js";
122
122
  import "./chunk-HL4DB7TO.js";
123
123
  import "./chunk-HDQUQBPW.js";
124
124
  import "./chunk-6FC3IZ26.js";
125
- import "./chunk-7KFIMGMP.js";
125
+ import "./chunk-ECLJ4LA2.js";
126
126
  import "./chunk-OJP3N7UK.js";
127
- import "./chunk-4XDGYCZI.js";
128
- import "./chunk-AYDDB3XI.js";
129
- import "./chunk-URHCUXKI.js";
127
+ import "./chunk-J3ATBB7M.js";
128
+ import "./chunk-OCCHUEZB.js";
129
+ import "./chunk-AXGFOFNY.js";
130
130
  import "./chunk-NRLELHAY.js";
131
131
  import "./chunk-AM4T6CHX.js";
132
- import "./chunk-2VXWFYJE.js";
132
+ import "./chunk-R2MZCYA6.js";
133
133
  import "./chunk-3T74IZB3.js";
134
134
  import "./chunk-2LA3H54D.js";
135
- import "./chunk-OLWTCWQ2.js";
136
- import "./chunk-MBDJJTAT.js";
135
+ import "./chunk-YZJM6CLF.js";
136
+ import "./chunk-YDKF4MSJ.js";
137
137
  import "./chunk-KFY3SGN7.js";
138
138
  import "./chunk-CMTINOFS.js";
139
- import "./chunk-6VALIZKG.js";
139
+ import "./chunk-DORFF5N5.js";
140
140
  import "./chunk-RMMVQQA6.js";
141
141
  import "./chunk-UR6PBX2J.js";
142
142
  import "./chunk-6GUG4YNM.js";
143
- import "./chunk-QXIQPCCN.js";
143
+ import "./chunk-UFR6HX7A.js";
144
144
  import "./chunk-UOBPK2OS.js";
145
145
  import "./chunk-C7SRUWBW.js";
146
146
  import "./chunk-OZKOPQCM.js";
@@ -151,7 +151,7 @@ import "./chunk-AUDJPF4N.js";
151
151
  import "./chunk-44442YCH.js";
152
152
  import "./chunk-Y4Z4I6WK.js";
153
153
  import "./chunk-CIO7GCWE.js";
154
- import "./chunk-QFMO32TO.js";
154
+ import "./chunk-DUZARALI.js";
155
155
  import "./chunk-KJTKLXTH.js";
156
156
  import "./chunk-2DQ2XREU.js";
157
157
  import "./chunk-OKTXM5H4.js";
@@ -160,7 +160,7 @@ import "./chunk-NOB2T2FC.js";
160
160
  import "./chunk-B7RWBZXW.js";
161
161
  import "./chunk-YBPYIAA5.js";
162
162
  import "./chunk-6TBIWIAG.js";
163
- import "./chunk-76PL4XLG.js";
163
+ import "./chunk-DPNXADEI.js";
164
164
  import "./chunk-ZKOPY4WW.js";
165
165
  import "./chunk-62OKGIJA.js";
166
166
  import "./chunk-XAB6STPO.js";
@@ -180,7 +180,7 @@ import "./chunk-PIG4WJFQ.js";
180
180
  import "./chunk-T3JQTCCO.js";
181
181
  import "./chunk-KFZY2OFH.js";
182
182
  import "./chunk-C6WMSXCJ.js";
183
- import "./chunk-BKYPJUQL.js";
183
+ import "./chunk-XGM3VQWG.js";
184
184
  import "./chunk-V7IZKJI3.js";
185
185
  import "./chunk-SEDEKFYQ.js";
186
186
  import "./chunk-RKNJBZ55.js";
@@ -191,20 +191,20 @@ import "./chunk-TMSXWOBZ.js";
191
191
  import "./chunk-7RXCMVFQ.js";
192
192
  import "./chunk-TB6CBZ5V.js";
193
193
  import "./chunk-3HSRWJTC.js";
194
- import "./chunk-EV3YFLCB.js";
195
- import "./chunk-BQUEAVNW.js";
196
- import "./chunk-D27J626P.js";
197
- import "./chunk-MRTUN665.js";
198
- import "./chunk-VA5KMSAE.js";
194
+ import "./chunk-I23ZHYSL.js";
195
+ import "./chunk-QJW4MZSW.js";
196
+ import "./chunk-BK5G2MHO.js";
197
+ import "./chunk-DUEDOYZD.js";
198
+ import "./chunk-SR5LNI6Q.js";
199
199
  import "./chunk-LDBFXD4F.js";
200
200
  import "./chunk-A5KNZSNA.js";
201
201
  import "./chunk-D24OXEPB.js";
202
- import "./chunk-TYUS5TLG.js";
203
- import "./chunk-57HVIG5U.js";
204
- import "./chunk-PDVQ5JU3.js";
202
+ import "./chunk-IWKGOCL6.js";
203
+ import "./chunk-KPB2QHJZ.js";
204
+ import "./chunk-GHD2LLG4.js";
205
205
  import "./chunk-7T4TOGMS.js";
206
206
  import "./chunk-7YQ6ESEA.js";
207
- import "./chunk-YF6UHWOV.js";
207
+ import "./chunk-YHGCT462.js";
208
208
  import "./chunk-OLBZ2WGG.js";
209
209
  import "./chunk-EQWEIIKQ.js";
210
210
  import "./chunk-I32NKXE2.js";
@@ -220,13 +220,13 @@ import "./chunk-GZ3R6XOE.js";
220
220
  import "./chunk-CK5KOVHW.js";
221
221
  import "./chunk-DJUKBGAD.js";
222
222
  import "./chunk-G73MCJKL.js";
223
- import "./chunk-GN55KU2P.js";
224
- import "./chunk-WN5FSGLE.js";
223
+ import "./chunk-PTZQYCJ4.js";
224
+ import "./chunk-AZLLH6YA.js";
225
225
  import "./chunk-GDASG7NC.js";
226
226
  import "./chunk-GDB4J2H3.js";
227
227
  import "./chunk-6433HV72.js";
228
228
  import "./chunk-VQ7B2Q6M.js";
229
- import "./chunk-NZWEEALH.js";
229
+ import "./chunk-KFIOPZ25.js";
230
230
  import "./chunk-PJSK6OJM.js";
231
231
  import "./chunk-GNVZQ5JN.js";
232
232
  import "./chunk-YN2UN7N3.js";
@@ -235,10 +235,10 @@ import "./chunk-P5FPO2BR.js";
235
235
  import "./chunk-S4DDLTPX.js";
236
236
  import "./chunk-ZVZHG7AI.js";
237
237
  import "./chunk-H7XKCNR6.js";
238
- import "./chunk-AZAA5DNP.js";
238
+ import "./chunk-YOXVZJFM.js";
239
239
  import "./chunk-SOBJ6NEY.js";
240
- import "./chunk-G57LQRP6.js";
241
- import "./chunk-GUXS322H.js";
240
+ import "./chunk-MFOSZUIT.js";
241
+ import "./chunk-2MVTAIL3.js";
242
242
  import "./chunk-CVILPI77.js";
243
243
  import "./chunk-2HIJHXB3.js";
244
244
  import "./chunk-AQEJKOKI.js";
@@ -256,15 +256,14 @@ import "./chunk-NLE6TSLG.js";
256
256
  import "./chunk-IVKIODHO.js";
257
257
  import "./chunk-WKDFJXW5.js";
258
258
  import "./chunk-JUXOTY6J.js";
259
- import "./chunk-QDW3E4RD.js";
260
259
  import "./chunk-7BEPVIH3.js";
261
260
  import "./chunk-7ZNJN5WZ.js";
262
261
  import "./chunk-C37ZRXX7.js";
263
262
  import "./chunk-UFGFMWAD.js";
264
- import "./chunk-EIVIB73I.js";
265
- import "./chunk-P4DHENRE.js";
266
- import "./chunk-OJD4WS2E.js";
267
- import "./chunk-DHTQP334.js";
263
+ import "./chunk-KOO37E4Y.js";
264
+ import "./chunk-WDXD6ITO.js";
265
+ import "./chunk-OZDFB22S.js";
266
+ import "./chunk-CQBIN77D.js";
268
267
  import "./chunk-BIJAWZYW.js";
269
268
  import "./chunk-LXY5VVGM.js";
270
269
  import "./chunk-2LSZVONP.js";
@@ -274,10 +273,10 @@ import "./chunk-CSAKJVXW.js";
274
273
  import "./chunk-K2XUWZBM.js";
275
274
  import "./chunk-OD4FM2U7.js";
276
275
  import "./chunk-ZY2MNJR6.js";
277
- import "./chunk-S7Q5CM7E.js";
278
- import "./chunk-RDFF2NAU.js";
279
- import "./chunk-AYYGRVRP.js";
280
- import "./chunk-PAYGC3BD.js";
276
+ import "./chunk-TJFI3K2O.js";
277
+ import "./chunk-ZXBTTMGZ.js";
278
+ import "./chunk-IURMJBGP.js";
279
+ import "./chunk-THVI4Y7X.js";
281
280
  import "./chunk-UHVXE24Y.js";
282
281
  import "./chunk-46WM6JX2.js";
283
282
  import "./chunk-SXIMQLGV.js";
@@ -296,7 +295,7 @@ import "./chunk-ET356KSB.js";
296
295
  import "./chunk-72A4L5JJ.js";
297
296
  import "./chunk-A7Q43EUZ.js";
298
297
  import "./chunk-S2V7RUCL.js";
299
- import "./chunk-NXKJHSDN.js";
298
+ import "./chunk-LBFFNDFM.js";
300
299
  import "./chunk-SCU65EZI.js";
301
300
  import "./chunk-PO7NXBG2.js";
302
301
  import "./chunk-S2HLHAZ4.js";
@@ -339,6 +338,9 @@ import "./chunk-IJ6WHMFB.js";
339
338
  import "./chunk-3SG4FGDV.js";
340
339
  import "./chunk-JV3C2MNQ.js";
341
340
  import "./chunk-K6MV3TRQ.js";
341
+ import "./chunk-236PXYG7.js";
342
+ import "./chunk-ZCUTSMR2.js";
343
+ import "./chunk-QDW3E4RD.js";
342
344
  import "./chunk-PP7R754B.js";
343
345
  import "./chunk-NXH34IPL.js";
344
346
  import "./chunk-RIAM7DND.js";
@@ -365,8 +367,8 @@ import "./chunk-3QL24R5Y.js";
365
367
  import "./chunk-SYOIVK7K.js";
366
368
  import "./chunk-ZN7SMKAK.js";
367
369
  import "./chunk-LNEWDF2A.js";
368
- import "./chunk-ODZG724P.js";
369
- import "./chunk-LBWQ65SX.js";
370
+ import "./chunk-I2HTKOOP.js";
371
+ import "./chunk-T42L3S6A.js";
370
372
  import "./chunk-ZRUEP4IK.js";
371
373
  import "./chunk-HZNYJN77.js";
372
374
  import "./chunk-Q57GOHLF.js";
@@ -380,11 +382,11 @@ import "./chunk-7RJUVTVF.js";
380
382
  import "./chunk-2LWQSV6A.js";
381
383
  import "./chunk-RL6NEVXT.js";
382
384
  import "./chunk-XDL5CYZN.js";
383
- import "./chunk-JDSVLVCG.js";
384
385
  import "./chunk-HBVPYRDW.js";
385
386
  import "./chunk-JOEJG4SD.js";
386
387
  import "./chunk-5FVVY2EB.js";
387
388
  import "./chunk-FFAZ2XFU.js";
389
+ import "./chunk-JDSVLVCG.js";
388
390
  import "./chunk-5GKPFL3S.js";
389
391
  import "./chunk-JAKIDQB2.js";
390
392
  import "./chunk-FZEEWOI2.js";
@@ -1,5 +1,5 @@
1
1
  import '../causal-trajectory.js';
2
- export { ce as NormalizedActionIntent, cf as PRE_ACTION_FINGERPRINT_VERSION, cg as PRE_ACTION_GATE_DEFAULT_TIMEOUT_MS, ch as PRE_ACTION_WARNING_VERSION, ci as PreActionFailureGate, cj as PreActionGateDependencies, ck as PreActionGateRequest, cl as PreActionGateResult, cm as PreActionGateStatus, cB as normalizeActionIntent, cG as sanitizePayloadString } from '../types-BxAcOl5Q.js';
2
+ export { cg as NormalizedActionIntent, ch as PRE_ACTION_FINGERPRINT_VERSION, ci as PRE_ACTION_GATE_DEFAULT_TIMEOUT_MS, cj as PRE_ACTION_WARNING_VERSION, ck as PreActionFailureGate, cl as PreActionGateDependencies, cm as PreActionGateRequest, cn as PreActionGateResult, co as PreActionGateStatus, cG as normalizeActionIntent, cQ as sanitizePayloadString } from '../types-ETU5N6nB.js';
3
3
  import '../objective-state.js';
4
4
  import '../message-parts/index.js';
5
5
  import '../bounded-jsonl-state.js';
@@ -1,5 +1,5 @@
1
- import { S as StorageManager } from '../storage-BIDzuKIn.js';
2
- import { P as PluginConfig } from '../types-BxAcOl5Q.js';
1
+ import { S as StorageManager } from '../storage-B7urx1K3.js';
2
+ import { P as PluginConfig } from '../types-ETU5N6nB.js';
3
3
  import { SharedFeedbackEntry } from '../shared-context/manager.js';
4
4
  import { QmdConfigProjection } from '../capabilities.js';
5
5
  import '../corpus-read-cancellation.js';
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CompoundingEngine,
3
3
  defaultTierMigrationCycleBudget
4
- } from "../chunk-R47WINCY.js";
4
+ } from "../chunk-UCKG36HO.js";
5
5
  import "../chunk-VI637ILW.js";
6
6
  import "../chunk-JCWY73FK.js";
7
- import "../chunk-PAYGC3BD.js";
7
+ import "../chunk-THVI4Y7X.js";
8
8
  import "../chunk-UHVXE24Y.js";
9
9
  import "../chunk-46WM6JX2.js";
10
10
  import "../chunk-SXIMQLGV.js";
@@ -23,7 +23,7 @@ import "../chunk-ET356KSB.js";
23
23
  import "../chunk-72A4L5JJ.js";
24
24
  import "../chunk-A7Q43EUZ.js";
25
25
  import "../chunk-S2V7RUCL.js";
26
- import "../chunk-NXKJHSDN.js";
26
+ import "../chunk-LBFFNDFM.js";
27
27
  import "../chunk-SCU65EZI.js";
28
28
  import "../chunk-PO7NXBG2.js";
29
29
  import "../chunk-S2HLHAZ4.js";
@@ -78,10 +78,10 @@ import "../chunk-7RJUVTVF.js";
78
78
  import "../chunk-2LWQSV6A.js";
79
79
  import "../chunk-RL6NEVXT.js";
80
80
  import "../chunk-XDL5CYZN.js";
81
- import "../chunk-JDSVLVCG.js";
82
81
  import "../chunk-JOEJG4SD.js";
83
82
  import "../chunk-5FVVY2EB.js";
84
83
  import "../chunk-FFAZ2XFU.js";
84
+ import "../chunk-JDSVLVCG.js";
85
85
  import "../chunk-5GKPFL3S.js";
86
86
  import "../chunk-JAKIDQB2.js";
87
87
  import "../chunk-P7FMDTKL.js";
@@ -1,4 +1,4 @@
1
- import { y as MemoryCategory, M as MemoryFile } from '../types-BxAcOl5Q.js';
1
+ import { y as MemoryCategory, M as MemoryFile } from '../types-ETU5N6nB.js';
2
2
  import { LcmEngine } from '../lcm/engine.js';
3
3
  import '../message-parts/index.js';
4
4
  import '../bounded-jsonl-state.js';
@@ -1,4 +1,4 @@
1
- import { ae as CompressionGuidelineOptimizerEventCounts, af as CompressionGuidelineOptimizerActionSummary, ag as CompressionGuidelineOptimizerRuleUpdate, ah as MemoryActionType, ai as MemoryActionEvent, aj as CompressionGuidelineOptimizerState } from './types-BxAcOl5Q.js';
1
+ import { af as CompressionGuidelineOptimizerEventCounts, ag as CompressionGuidelineOptimizerActionSummary, ah as CompressionGuidelineOptimizerRuleUpdate, ai as MemoryActionType, aj as MemoryActionEvent, ak as CompressionGuidelineOptimizerState } from './types-ETU5N6nB.js';
2
2
  import './message-parts/index.js';
3
3
  import './bounded-jsonl-state.js';
4
4
  import './types-CM86alG1.js';
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PluginConfig } from './types-BxAcOl5Q.js';
1
+ import { P as PluginConfig } from './types-ETU5N6nB.js';
2
2
  import './message-parts/index.js';
3
3
  import './bounded-jsonl-state.js';
4
4
  import './types-CM86alG1.js';
package/dist/config.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  isOpenaiApiKeyDisabled,
5
5
  parseConfig,
6
6
  resolveEnvVars
7
- } from "./chunk-76PL4XLG.js";
7
+ } from "./chunk-DPNXADEI.js";
8
8
  import "./chunk-ZKOPY4WW.js";
9
9
  import "./chunk-62OKGIJA.js";
10
10
  import "./chunk-XAB6STPO.js";
@@ -30,6 +30,9 @@ import "./chunk-IJ6WHMFB.js";
30
30
  import "./chunk-3SG4FGDV.js";
31
31
  import "./chunk-JV3C2MNQ.js";
32
32
  import "./chunk-K6MV3TRQ.js";
33
+ import "./chunk-236PXYG7.js";
34
+ import "./chunk-ZCUTSMR2.js";
35
+ import "./chunk-QDW3E4RD.js";
33
36
  import "./chunk-PP7R754B.js";
34
37
  import "./chunk-NXH34IPL.js";
35
38
  import "./chunk-RIAM7DND.js";
@@ -42,6 +45,7 @@ import "./chunk-HBVPYRDW.js";
42
45
  import "./chunk-JOEJG4SD.js";
43
46
  import "./chunk-5FVVY2EB.js";
44
47
  import "./chunk-FFAZ2XFU.js";
48
+ import "./chunk-JDSVLVCG.js";
45
49
  import "./chunk-5GKPFL3S.js";
46
50
  import "./chunk-JAKIDQB2.js";
47
51
  import "./chunk-FZEEWOI2.js";
@@ -1,4 +1,4 @@
1
- import { P as PluginConfig, M as MemoryFile } from '../types-BxAcOl5Q.js';
1
+ import { P as PluginConfig, M as MemoryFile } from '../types-ETU5N6nB.js';
2
2
  import { RolloutSummaryInput, MaterializeResult } from './codex-materialize.js';
3
3
  import '../message-parts/index.js';
4
4
  import '../bounded-jsonl-state.js';