@remnic/core 10.0.167 → 10.0.169

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 (390) hide show
  1. package/dist/access-admin-ops-surface.js +139 -138
  2. package/dist/access-cli.js +139 -138
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-coding-context-resolution.js +11 -11
  5. package/dist/access-extraction-force-flush-preempt.js +139 -138
  6. package/dist/access-extraction-force-flush.js +139 -138
  7. package/dist/access-http-briefing.js +139 -138
  8. package/dist/access-http-query.js +139 -138
  9. package/dist/access-http.js +139 -138
  10. package/dist/access-identity-continuity-surface.js +139 -138
  11. package/dist/access-lcm-surface.js +139 -138
  12. package/dist/access-mcp.js +139 -138
  13. package/dist/access-observe-write-category.js +11 -11
  14. package/dist/access-observe-write-surface.js +139 -138
  15. package/dist/access-offline-manifest.js +9 -9
  16. package/dist/access-operations-batch.js +139 -138
  17. package/dist/access-operations.js +139 -138
  18. package/dist/access-recall-concurrency.js +139 -138
  19. package/dist/access-recall-excerpt-attribution.d.ts +19 -0
  20. package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
  21. package/dist/access-recall-excerpt-attribution.js +8 -0
  22. package/dist/access-recall-response.js +139 -138
  23. package/dist/access-recall-surface.d.ts.map +1 -1
  24. package/dist/access-recall-surface.js +139 -138
  25. package/dist/access-schema.js +10 -10
  26. package/dist/access-service.js +139 -138
  27. package/dist/active-recall.js +24 -24
  28. package/dist/adapters/index.js +4 -4
  29. package/dist/adapters/registry.js +2 -2
  30. package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
  31. package/dist/binary-lifecycle/scanner.d.ts +2 -4
  32. package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
  33. package/dist/briefing.js +13 -13
  34. package/dist/buffer-add-turns-bounded.d.ts +11 -1
  35. package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
  36. package/dist/buffer-add-turns-bounded.js +3 -3
  37. package/dist/buffer-session-cap.d.ts +2 -2
  38. package/dist/buffer-session-cap.d.ts.map +1 -1
  39. package/dist/buffer-session-cap.js +1 -1
  40. package/dist/buffer.d.ts +3 -2
  41. package/dist/buffer.d.ts.map +1 -1
  42. package/dist/buffer.js +12 -12
  43. package/dist/bulk-import/index.d.ts +1 -1
  44. package/dist/bulk-import/index.d.ts.map +1 -1
  45. package/dist/bulk-import/index.js +3 -1
  46. package/dist/bulk-import/pipeline.d.ts +8 -0
  47. package/dist/bulk-import/pipeline.d.ts.map +1 -1
  48. package/dist/calibration.d.ts +19 -2
  49. package/dist/calibration.d.ts.map +1 -1
  50. package/dist/calibration.js +28 -5
  51. package/dist/calibration.js.map +1 -1
  52. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  53. package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
  54. package/dist/causal-behavior.js +2 -2
  55. package/dist/causal-chain.js +2 -2
  56. package/dist/causal-consolidation.js +17 -17
  57. package/dist/causal-retrieval.js +2 -2
  58. package/dist/causal-trajectory-graph.js +3 -3
  59. package/dist/causal-trajectory.js +1 -1
  60. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  61. package/dist/{chunk-IE2ZLO3R.js → chunk-32OTLNAU.js} +274 -248
  62. package/dist/chunk-32OTLNAU.js.map +1 -0
  63. package/dist/{chunk-L7SEYUHS.js → chunk-3I3NXB6X.js} +3 -3
  64. package/dist/{chunk-4NBUHYUV.js → chunk-3LADDLAF.js} +5 -5
  65. package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
  66. package/dist/{chunk-HSSERO3E.js → chunk-4P4GF76E.js} +8 -1
  67. package/dist/chunk-4P4GF76E.js.map +1 -0
  68. package/dist/{chunk-5BE3FLKL.js → chunk-5KDDAQ6K.js} +8 -8
  69. package/dist/{chunk-BPCR5DZP.js → chunk-62YZOQFR.js} +5 -5
  70. package/dist/chunk-62YZOQFR.js.map +1 -0
  71. package/dist/{chunk-HLWXCDUQ.js → chunk-63A2BU2B.js} +5 -5
  72. package/dist/{chunk-C5QYWM6F.js → chunk-7FPI5MFB.js} +5 -5
  73. package/dist/{chunk-ZX546Y3Y.js → chunk-7OYDFIL4.js} +2 -2
  74. package/dist/{chunk-CKZWLAHN.js → chunk-ACPFBVUD.js} +2 -2
  75. package/dist/{chunk-BKTCVXMK.js → chunk-AHOYKJ5X.js} +3 -3
  76. package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
  77. package/dist/chunk-AIF6V2OX.js.map +1 -0
  78. package/dist/{chunk-FGT7CUYZ.js → chunk-ALTLOHO7.js} +2 -2
  79. package/dist/{chunk-FMFCQRDM.js → chunk-AUFPPBC3.js} +3 -3
  80. package/dist/{chunk-OAQRZ4SV.js → chunk-B5KTTWC7.js} +2 -2
  81. package/dist/{chunk-73TPOGS4.js → chunk-BFBS7OFQ.js} +9 -9
  82. package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
  83. package/dist/{chunk-ZQUOUPP3.js → chunk-BHRPZBAH.js} +4 -4
  84. package/dist/{chunk-4L25GAYL.js → chunk-CX24SVLK.js} +2 -2
  85. package/dist/{chunk-YY57TRKN.js → chunk-D5ZLTLHF.js} +2 -2
  86. package/dist/{chunk-WEFFO2MJ.js → chunk-D6YCETHG.js} +2 -2
  87. package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
  88. package/dist/{chunk-VRHY7Y5A.js → chunk-DPL5VO5V.js} +3 -3
  89. package/dist/{chunk-LVGTH6IQ.js → chunk-E7ATID4Z.js} +11 -11
  90. package/dist/{chunk-CKELO7Q6.js → chunk-FHWX2REL.js} +2 -2
  91. package/dist/{chunk-CUPILBIP.js → chunk-FMIM36I4.js} +2 -2
  92. package/dist/{chunk-OWM2VWNX.js → chunk-FSXYBIEZ.js} +25 -24
  93. package/dist/chunk-FSXYBIEZ.js.map +1 -0
  94. package/dist/{chunk-A5UOREWD.js → chunk-FWTGO4NE.js} +2 -2
  95. package/dist/{chunk-3SL52JKD.js → chunk-FZVROZKC.js} +5 -5
  96. package/dist/{chunk-U3BCW7GX.js → chunk-G3RLCVJC.js} +3 -3
  97. package/dist/{chunk-UYIBNDQE.js → chunk-GF5NN3LE.js} +2 -2
  98. package/dist/{chunk-7OCKK5M5.js → chunk-GWY5ZFHP.js} +6 -6
  99. package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
  100. package/dist/chunk-H3MLOQ7F.js.map +1 -0
  101. package/dist/{chunk-TNRGWJYT.js → chunk-H4IU24V5.js} +2 -2
  102. package/dist/{chunk-T4BT4FQN.js → chunk-HH6PXQ2B.js} +3 -3
  103. package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
  104. package/dist/{chunk-OM5ESBES.js → chunk-HQPFACXO.js} +2 -2
  105. package/dist/{chunk-QLQUAVVP.js → chunk-I7WPLMUX.js} +16 -16
  106. package/dist/chunk-I7WPLMUX.js.map +1 -0
  107. package/dist/{chunk-IMULTENA.js → chunk-ID65XTF3.js} +2 -2
  108. package/dist/{chunk-WWQMZBDI.js → chunk-IJVU4ILJ.js} +4 -4
  109. package/dist/{chunk-GBSXTTLP.js → chunk-ITGAGNX5.js} +2 -2
  110. package/dist/chunk-IUGOGDCP.js +39 -0
  111. package/dist/chunk-IUGOGDCP.js.map +1 -0
  112. package/dist/{chunk-3PNJZTDV.js → chunk-JGGNUEVD.js} +2 -2
  113. package/dist/{chunk-YYXYZM2I.js → chunk-JN7OSQJR.js} +2 -2
  114. package/dist/{chunk-4D2EY4WM.js → chunk-K2DTHNDY.js} +6 -6
  115. package/dist/{chunk-TH6OYP6I.js → chunk-K36RMINQ.js} +3 -3
  116. package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
  117. package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
  118. package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
  119. package/dist/{chunk-ZWDDY4WF.js → chunk-M7CFCRWJ.js} +2 -2
  120. package/dist/{chunk-QPFM6DHY.js → chunk-MTJFK42O.js} +2 -2
  121. package/dist/{chunk-RO5EGRAI.js → chunk-N3FRR6II.js} +2 -2
  122. package/dist/{chunk-UMEUU66X.js → chunk-O3OEVYUR.js} +2 -2
  123. package/dist/{chunk-J74YOBB3.js → chunk-PFR6ZKQI.js} +8 -8
  124. package/dist/{chunk-TAD6QMMD.js → chunk-PRC7SZYM.js} +2 -2
  125. package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
  126. package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
  127. package/dist/{chunk-GMO3BGOF.js → chunk-QC2MHZDD.js} +1 -1
  128. package/dist/{chunk-FOTFLHBN.js → chunk-QPLI7LUU.js} +3 -2
  129. package/dist/chunk-QPLI7LUU.js.map +1 -0
  130. package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
  131. package/dist/{chunk-HDWISXFH.js → chunk-RVAPK2S7.js} +2 -2
  132. package/dist/{chunk-5PUZV73Z.js → chunk-SEIGLG62.js} +11 -11
  133. package/dist/{chunk-AVWOULJH.js → chunk-SH3GOZWK.js} +2 -2
  134. package/dist/{chunk-PFLN6TTW.js → chunk-T3MCVSUC.js} +2 -2
  135. package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
  136. package/dist/{chunk-CLVILSBR.js → chunk-TGQW3AMK.js} +22 -22
  137. package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
  138. package/dist/{chunk-7VIJUZYW.js → chunk-TQ4CELUR.js} +3 -3
  139. package/dist/{chunk-5QDTZIGH.js → chunk-U7KP6QFU.js} +2 -2
  140. package/dist/{chunk-BUKK5SWA.js → chunk-UPD5XDJX.js} +5 -5
  141. package/dist/{chunk-BUKK5SWA.js.map → chunk-UPD5XDJX.js.map} +1 -1
  142. package/dist/{chunk-QVXEXGIM.js → chunk-VF6SC4OD.js} +2 -2
  143. package/dist/{chunk-EZG54YDS.js → chunk-VKXJQF5C.js} +2 -2
  144. package/dist/{chunk-RFLC6PKQ.js → chunk-VMRPLHEU.js} +2 -2
  145. package/dist/{chunk-U2PSE7MB.js → chunk-VPEIWMUT.js} +2 -2
  146. package/dist/{chunk-X67XNZ64.js → chunk-W4EJMMPP.js} +10 -10
  147. package/dist/{chunk-RB7NXZ2E.js → chunk-W4Q65VJL.js} +2 -2
  148. package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
  149. package/dist/{chunk-W7N7NWG5.js → chunk-WCJQ3OUP.js} +2 -2
  150. package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
  151. package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
  152. package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
  153. package/dist/chunk-WI2WTIMY.js.map +1 -0
  154. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  155. package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
  156. package/dist/{chunk-SIONKXLU.js → chunk-XTRC6SSS.js} +14 -14
  157. package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
  158. package/dist/{chunk-3YOX2BQD.js → chunk-YWMCV5HL.js} +3 -3
  159. package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
  160. package/dist/chunk-YYDUBGUF.js.map +1 -0
  161. package/dist/{chunk-6QWFZ3X5.js → chunk-ZA6CYFAK.js} +2 -2
  162. package/dist/cli.d.ts +1 -6
  163. package/dist/cli.d.ts.map +1 -1
  164. package/dist/cli.js +139 -138
  165. package/dist/coding/export-okf-codegraph.js +24 -24
  166. package/dist/coding/pre-action-gate.js +2 -2
  167. package/dist/compounding/engine.js +14 -14
  168. package/dist/config.js +24 -24
  169. package/dist/connectors/codex-marketplace.d.ts.map +1 -1
  170. package/dist/connectors/codex-materialize-runner.js +14 -14
  171. package/dist/connectors/codex-materialize.d.ts.map +1 -1
  172. package/dist/connectors/codex-materialize.js +1 -1
  173. package/dist/connectors/index.js +15 -15
  174. package/dist/consolidation-provenance-check.js +2 -2
  175. package/dist/convergence-refresh.js +15 -15
  176. package/dist/conversation-index/backend.js +2 -2
  177. package/dist/corpus-watermark.js +15 -15
  178. package/dist/deep-recall-http-glue.js +11 -11
  179. package/dist/embedding-fallback.js +2 -2
  180. package/dist/entity-retrieval.js +14 -14
  181. package/dist/event-order-recall.js +3 -3
  182. package/dist/explicit-capture.js +139 -138
  183. package/dist/extraction-judge.js +1 -1
  184. package/dist/extraction-normalization.js +1 -1
  185. package/dist/extraction-span-materialize.js +2 -2
  186. package/dist/extraction.js +27 -27
  187. package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-CXTNJ7IQ.js} +6 -6
  188. package/dist/graph-edge-decay-CXTNJ7IQ.js.map +1 -0
  189. package/dist/graph-jsonl.js +4 -4
  190. package/dist/graph-snapshot.js +4 -4
  191. package/dist/graph.js +5 -5
  192. package/dist/harmonic-retrieval.js +13 -13
  193. package/dist/index.js +198 -197
  194. package/dist/lcm/index.js +3 -3
  195. package/dist/local-llm.js +2 -2
  196. package/dist/location/index.js +14 -14
  197. package/dist/maintenance/memory-governance.js +13 -13
  198. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
  199. package/dist/maintenance/rebuild-memory-projection-runner.js +15 -15
  200. package/dist/maintenance/rebuild-memory-projection.js +14 -14
  201. package/dist/memory-browse.js +5 -5
  202. package/dist/memory-controller.d.ts.map +1 -1
  203. package/dist/memory-controller.js +1 -1
  204. package/dist/namespaces/migrate.js +14 -14
  205. package/dist/namespaces/search.js +7 -7
  206. package/dist/namespaces/storage.d.ts.map +1 -1
  207. package/dist/namespaces/storage.js +13 -13
  208. package/dist/offline-sync-changeset-generations.js +4 -4
  209. package/dist/offline-sync-embedding-generation.js +3 -3
  210. package/dist/offline-sync-snapshot-stream.js +7 -7
  211. package/dist/offline-sync.js +6 -6
  212. package/dist/operator-doctor-corpus.js +16 -16
  213. package/dist/operator-toolkit.js +35 -35
  214. package/dist/orchestration/backlog-scheduler.d.ts +4 -0
  215. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
  216. package/dist/orchestration/backlog-scheduler.js +150 -143
  217. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  218. package/dist/orchestration/buffer-drain-runner.js +140 -139
  219. package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
  220. package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
  221. package/dist/orchestration/extraction-persist.d.ts.map +1 -1
  222. package/dist/orchestration/maintenance.js +23 -23
  223. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  224. package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
  225. package/dist/orchestrator.d.ts.map +1 -1
  226. package/dist/orchestrator.js +141 -140
  227. package/dist/qmd.js +4 -4
  228. package/dist/recall-navigation.js +139 -138
  229. package/dist/recall-state-view-admission.js +5 -5
  230. package/dist/recall-state-view-packet.d.ts.map +1 -1
  231. package/dist/recall-state-view-packet.js +30 -8
  232. package/dist/recall-state-view-packet.js.map +1 -1
  233. package/dist/recall-why-service.js +5 -5
  234. package/dist/reconcile/manifest.js +2 -2
  235. package/dist/resume-bundles.js +25 -25
  236. package/dist/search/factory.js +6 -6
  237. package/dist/search/index.js +8 -8
  238. package/dist/semantic-consolidation.js +18 -18
  239. package/dist/semantic-rule-promotion.js +13 -13
  240. package/dist/semantic-rule-verifier.js +13 -13
  241. package/dist/source-agent-qualifier.js +18 -18
  242. package/dist/source-attribution.d.ts +3 -3
  243. package/dist/source-attribution.d.ts.map +1 -1
  244. package/dist/source-attribution.js +1 -1
  245. package/dist/standup/build.js +13 -13
  246. package/dist/storage.d.ts +1 -0
  247. package/dist/storage.d.ts.map +1 -1
  248. package/dist/storage.js +12 -12
  249. package/dist/summarizer.d.ts +7 -1
  250. package/dist/summarizer.d.ts.map +1 -1
  251. package/dist/summarizer.js +3 -3
  252. package/dist/support-passport/index.js +16 -16
  253. package/dist/transfer/autodetect.js +3 -3
  254. package/dist/transfer/backup.js +2 -2
  255. package/dist/transfer/capsule-export.js +3 -3
  256. package/dist/transfer/capsule-import.js +3 -3
  257. package/dist/transfer/export-okf.js +13 -13
  258. package/dist/transfer/import-json.js +2 -2
  259. package/dist/transfer/import-md.js +2 -2
  260. package/dist/transfer/types.d.ts +15 -3
  261. package/dist/transfer/types.d.ts.map +1 -1
  262. package/dist/transfer/types.js +3 -1
  263. package/dist/verified-recall.js +13 -13
  264. package/dist/who-knows-cli.js +14 -14
  265. package/dist/who-knows.js +13 -13
  266. package/package.json +2 -2
  267. package/src/access-cli.test.ts +9 -9
  268. package/src/access-recall-excerpt-attribution.ts +69 -0
  269. package/src/access-recall-surface.ts +26 -31
  270. package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
  271. package/src/backlog-scheduler.test.ts +31 -0
  272. package/src/binary-lifecycle/scanner.ts +35 -14
  273. package/src/buffer-add-turns-bounded.ts +16 -2
  274. package/src/buffer-session-cap.ts +4 -4
  275. package/src/buffer.ts +5 -5
  276. package/src/bulk-import/index.ts +1 -0
  277. package/src/bulk-import/pipeline.test.ts +31 -0
  278. package/src/bulk-import/pipeline.ts +14 -0
  279. package/src/calibration.ts +56 -4
  280. package/src/cli.ts +3 -23
  281. package/src/connectors/codex-marketplace-git.test.ts +267 -0
  282. package/src/connectors/codex-marketplace.ts +76 -13
  283. package/src/connectors/codex-materialize.ts +29 -55
  284. package/src/memory-controller.test.ts +11 -0
  285. package/src/memory-controller.ts +5 -1
  286. package/src/namespaces/storage.ts +1 -0
  287. package/src/orchestration/backlog-scheduler.ts +12 -3
  288. package/src/orchestration/extraction-persist-citation.ts +5 -3
  289. package/src/orchestration/extraction-persist.ts +15 -14
  290. package/src/orchestration/recall-internal.ts +2 -3
  291. package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
  292. package/src/orchestration/turn-ingestion-buffered.ts +26 -8
  293. package/src/orchestrator.ts +1 -0
  294. package/src/recall-state-view-packet.test.ts +40 -0
  295. package/src/recall-state-view-packet.ts +46 -9
  296. package/src/source-attribution.test.ts +57 -0
  297. package/src/source-attribution.ts +46 -43
  298. package/src/storage.ts +4 -3
  299. package/src/summarizer-shutdown.test.ts +49 -16
  300. package/src/summarizer.ts +13 -5
  301. package/src/testing/subjects/memory-maintenance.test.ts +293 -0
  302. package/src/transfer/capsule-export.ts +2 -1
  303. package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
  304. package/src/transfer/types.ts +13 -3
  305. package/dist/chunk-AL3TCNSJ.js.map +0 -1
  306. package/dist/chunk-BPCR5DZP.js.map +0 -1
  307. package/dist/chunk-FFWFFAP3.js.map +0 -1
  308. package/dist/chunk-FOTFLHBN.js.map +0 -1
  309. package/dist/chunk-HSSERO3E.js.map +0 -1
  310. package/dist/chunk-IE2ZLO3R.js.map +0 -1
  311. package/dist/chunk-L272A5QW.js.map +0 -1
  312. package/dist/chunk-OWM2VWNX.js.map +0 -1
  313. package/dist/chunk-QLQUAVVP.js.map +0 -1
  314. package/dist/chunk-WEHSQBFR.js.map +0 -1
  315. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
  316. /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
  317. /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  318. /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
  319. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  320. /package/dist/{chunk-L7SEYUHS.js.map → chunk-3I3NXB6X.js.map} +0 -0
  321. /package/dist/{chunk-4NBUHYUV.js.map → chunk-3LADDLAF.js.map} +0 -0
  322. /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
  323. /package/dist/{chunk-5BE3FLKL.js.map → chunk-5KDDAQ6K.js.map} +0 -0
  324. /package/dist/{chunk-HLWXCDUQ.js.map → chunk-63A2BU2B.js.map} +0 -0
  325. /package/dist/{chunk-C5QYWM6F.js.map → chunk-7FPI5MFB.js.map} +0 -0
  326. /package/dist/{chunk-ZX546Y3Y.js.map → chunk-7OYDFIL4.js.map} +0 -0
  327. /package/dist/{chunk-CKZWLAHN.js.map → chunk-ACPFBVUD.js.map} +0 -0
  328. /package/dist/{chunk-BKTCVXMK.js.map → chunk-AHOYKJ5X.js.map} +0 -0
  329. /package/dist/{chunk-FGT7CUYZ.js.map → chunk-ALTLOHO7.js.map} +0 -0
  330. /package/dist/{chunk-FMFCQRDM.js.map → chunk-AUFPPBC3.js.map} +0 -0
  331. /package/dist/{chunk-OAQRZ4SV.js.map → chunk-B5KTTWC7.js.map} +0 -0
  332. /package/dist/{chunk-73TPOGS4.js.map → chunk-BFBS7OFQ.js.map} +0 -0
  333. /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
  334. /package/dist/{chunk-ZQUOUPP3.js.map → chunk-BHRPZBAH.js.map} +0 -0
  335. /package/dist/{chunk-4L25GAYL.js.map → chunk-CX24SVLK.js.map} +0 -0
  336. /package/dist/{chunk-YY57TRKN.js.map → chunk-D5ZLTLHF.js.map} +0 -0
  337. /package/dist/{chunk-WEFFO2MJ.js.map → chunk-D6YCETHG.js.map} +0 -0
  338. /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
  339. /package/dist/{chunk-VRHY7Y5A.js.map → chunk-DPL5VO5V.js.map} +0 -0
  340. /package/dist/{chunk-LVGTH6IQ.js.map → chunk-E7ATID4Z.js.map} +0 -0
  341. /package/dist/{chunk-CKELO7Q6.js.map → chunk-FHWX2REL.js.map} +0 -0
  342. /package/dist/{chunk-CUPILBIP.js.map → chunk-FMIM36I4.js.map} +0 -0
  343. /package/dist/{chunk-A5UOREWD.js.map → chunk-FWTGO4NE.js.map} +0 -0
  344. /package/dist/{chunk-3SL52JKD.js.map → chunk-FZVROZKC.js.map} +0 -0
  345. /package/dist/{chunk-U3BCW7GX.js.map → chunk-G3RLCVJC.js.map} +0 -0
  346. /package/dist/{chunk-UYIBNDQE.js.map → chunk-GF5NN3LE.js.map} +0 -0
  347. /package/dist/{chunk-7OCKK5M5.js.map → chunk-GWY5ZFHP.js.map} +0 -0
  348. /package/dist/{chunk-TNRGWJYT.js.map → chunk-H4IU24V5.js.map} +0 -0
  349. /package/dist/{chunk-T4BT4FQN.js.map → chunk-HH6PXQ2B.js.map} +0 -0
  350. /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
  351. /package/dist/{chunk-OM5ESBES.js.map → chunk-HQPFACXO.js.map} +0 -0
  352. /package/dist/{chunk-IMULTENA.js.map → chunk-ID65XTF3.js.map} +0 -0
  353. /package/dist/{chunk-WWQMZBDI.js.map → chunk-IJVU4ILJ.js.map} +0 -0
  354. /package/dist/{chunk-GBSXTTLP.js.map → chunk-ITGAGNX5.js.map} +0 -0
  355. /package/dist/{chunk-3PNJZTDV.js.map → chunk-JGGNUEVD.js.map} +0 -0
  356. /package/dist/{chunk-YYXYZM2I.js.map → chunk-JN7OSQJR.js.map} +0 -0
  357. /package/dist/{chunk-4D2EY4WM.js.map → chunk-K2DTHNDY.js.map} +0 -0
  358. /package/dist/{chunk-TH6OYP6I.js.map → chunk-K36RMINQ.js.map} +0 -0
  359. /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
  360. /package/dist/{chunk-ZWDDY4WF.js.map → chunk-M7CFCRWJ.js.map} +0 -0
  361. /package/dist/{chunk-QPFM6DHY.js.map → chunk-MTJFK42O.js.map} +0 -0
  362. /package/dist/{chunk-RO5EGRAI.js.map → chunk-N3FRR6II.js.map} +0 -0
  363. /package/dist/{chunk-UMEUU66X.js.map → chunk-O3OEVYUR.js.map} +0 -0
  364. /package/dist/{chunk-J74YOBB3.js.map → chunk-PFR6ZKQI.js.map} +0 -0
  365. /package/dist/{chunk-TAD6QMMD.js.map → chunk-PRC7SZYM.js.map} +0 -0
  366. /package/dist/{chunk-GMO3BGOF.js.map → chunk-QC2MHZDD.js.map} +0 -0
  367. /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
  368. /package/dist/{chunk-HDWISXFH.js.map → chunk-RVAPK2S7.js.map} +0 -0
  369. /package/dist/{chunk-5PUZV73Z.js.map → chunk-SEIGLG62.js.map} +0 -0
  370. /package/dist/{chunk-AVWOULJH.js.map → chunk-SH3GOZWK.js.map} +0 -0
  371. /package/dist/{chunk-PFLN6TTW.js.map → chunk-T3MCVSUC.js.map} +0 -0
  372. /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
  373. /package/dist/{chunk-CLVILSBR.js.map → chunk-TGQW3AMK.js.map} +0 -0
  374. /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
  375. /package/dist/{chunk-7VIJUZYW.js.map → chunk-TQ4CELUR.js.map} +0 -0
  376. /package/dist/{chunk-5QDTZIGH.js.map → chunk-U7KP6QFU.js.map} +0 -0
  377. /package/dist/{chunk-QVXEXGIM.js.map → chunk-VF6SC4OD.js.map} +0 -0
  378. /package/dist/{chunk-EZG54YDS.js.map → chunk-VKXJQF5C.js.map} +0 -0
  379. /package/dist/{chunk-RFLC6PKQ.js.map → chunk-VMRPLHEU.js.map} +0 -0
  380. /package/dist/{chunk-U2PSE7MB.js.map → chunk-VPEIWMUT.js.map} +0 -0
  381. /package/dist/{chunk-X67XNZ64.js.map → chunk-W4EJMMPP.js.map} +0 -0
  382. /package/dist/{chunk-RB7NXZ2E.js.map → chunk-W4Q65VJL.js.map} +0 -0
  383. /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
  384. /package/dist/{chunk-W7N7NWG5.js.map → chunk-WCJQ3OUP.js.map} +0 -0
  385. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  386. /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
  387. /package/dist/{chunk-SIONKXLU.js.map → chunk-XTRC6SSS.js.map} +0 -0
  388. /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
  389. /package/dist/{chunk-3YOX2BQD.js.map → chunk-YWMCV5HL.js.map} +0 -0
  390. /package/dist/{chunk-6QWFZ3X5.js.map → chunk-ZA6CYFAK.js.map} +0 -0
@@ -416,19 +416,71 @@ export async function synthesizeCalibrationRules(
416
416
 
417
417
  // ─── Recall Section ──────────────────────────────────────────────────────────
418
418
 
419
+ /**
420
+ * Lexical similarity score in `[0, 1]` between a query and a calibration
421
+ * rule — the same token-overlap idiom as `session-experience-recall.ts`
422
+ * (Jaccard over lowercase tokens longer than two chars). Shared code so
423
+ * the ranker and any future embedding scorer share one field mapping:
424
+ * the rule's *when/how* text, not its id.
425
+ */
426
+ export function calibrationRuleQueryScore(
427
+ rule: CalibrationRule,
428
+ query: string,
429
+ ): number {
430
+ const norm = (s: string) =>
431
+ s
432
+ .toLowerCase()
433
+ .split(/[^a-z0-9]+/)
434
+ .filter((t) => t.length > 2);
435
+ const queryTokens = new Set(norm(query));
436
+ const ruleTokens = new Set(
437
+ norm(
438
+ `${rule.condition} ${rule.modelTendency} ${rule.userExpectation} ${rule.calibration}`,
439
+ ),
440
+ );
441
+ if (queryTokens.size === 0 || ruleTokens.size === 0) return 0;
442
+ let inter = 0;
443
+ for (const t of queryTokens) {
444
+ if (ruleTokens.has(t)) inter++;
445
+ }
446
+ const union = new Set([...queryTokens, ...ruleTokens]);
447
+ return inter / Math.max(1, union.size);
448
+ }
449
+
450
+ /**
451
+ * Order calibration rules by query relevance (issue #3552). Highest
452
+ * lexical-similarity first; ties and all-zero scores keep index order, so
453
+ * an unscoreable query yields the historical include-all ordering.
454
+ */
455
+ export function rankCalibrationRulesForQuery(
456
+ rules: readonly CalibrationRule[],
457
+ query: string,
458
+ ): CalibrationRule[] {
459
+ return rules
460
+ .map((rule, index) => ({ rule, index, score: calibrationRuleQueryScore(rule, query) }))
461
+ .sort((a, b) => b.score - a.score || a.index - b.index)
462
+ .map((entry) => entry.rule);
463
+ }
464
+
419
465
  /**
420
466
  * Build a recall section from calibration rules relevant to the current query.
421
- * Uses the LLM to select which rules apply to the current context.
467
+ * Rules are similarity-ranked against the query before `maxRules` and
468
+ * `maxChars` caps apply, so relevant rules win the budget instead of
469
+ * whichever happen to sit earliest in the index. When nothing matches
470
+ * the query the index order is preserved — the include-all fallback.
422
471
  */
423
472
  export function buildCalibrationRecallSection(
424
473
  rules: CalibrationRule[],
425
474
  query: string,
426
475
  maxChars: number = 1200,
476
+ maxRules?: number,
427
477
  ): string | null {
428
478
  if (rules.length === 0) return null;
429
479
 
430
- // Simple relevance: include all rules (they're already filtered to this user)
431
- // In production, could use embedding similarity to filter
480
+ const ranked = rankCalibrationRulesForQuery(rules, query);
481
+ const selected =
482
+ maxRules !== undefined ? ranked.slice(0, Math.max(0, maxRules)) : ranked;
483
+
432
484
  const lines: string[] = [
433
485
  "## Model Calibration (learned from past corrections)",
434
486
  "",
@@ -438,7 +490,7 @@ export function buildCalibrationRecallSection(
438
490
 
439
491
  let totalChars = lines.join("\n").length;
440
492
 
441
- for (const rule of rules) {
493
+ for (const rule of selected) {
442
494
  const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;
443
495
  if (totalChars + line.length + 1 > maxChars) break;
444
496
  lines.push(line);
package/src/cli.ts CHANGED
@@ -52,6 +52,7 @@ import { isReplaySource, normalizeReplaySessionKey, type ReplaySource, type Repl
52
52
  import {
53
53
  getBulkImportSource,
54
54
  listBulkImportSources,
55
+ processBatchFromIngest,
55
56
  registerBulkImportSource,
56
57
  runBulkImportPipeline,
57
58
  type BulkImportResult,
@@ -3416,12 +3417,7 @@ async function walkMemoryMarkdownFiles(
3416
3417
  /**
3417
3418
  * List absolute paths of every `*.md` file under each recall category directory
3418
3419
  * of `memoryDir` (facts/, corrections/, decisions/, ...; see
3419
- * `walkMemoryMarkdownFiles`). Used by the bulk-import CLI to derive a per-batch
3420
- * `memoriesCreated` count via set-subtraction of "paths after extraction"
3421
- * against "paths before extraction". Caveat: the extraction queue is shared
3422
- * across sessions, so concurrent organic extractions between the two snapshots
3423
- * can still inflate the count; the set diff at least ignores pre-existing and
3424
- * deleted files. Exported for category-dir coverage tests (#1546).
3420
+ * `walkMemoryMarkdownFiles`). Exported for category-dir coverage tests (#1546).
3425
3421
  */
3426
3422
  export async function listMemoryMarkdownFilePaths(memoryDir: string): Promise<string[]> {
3427
3423
  const paths: string[] = [];
@@ -5142,23 +5138,7 @@ export function registerCli(
5142
5138
  writeNamespace,
5143
5139
  );
5144
5140
  const writeRoot = writeStorage.dir;
5145
- const ingestBatch: ProcessBatchFn = async (turns) => {
5146
- // Filename-set diff correctly excludes files that already existed
5147
- // (vs. a naïve `after - before` integer subtraction, which would
5148
- // inflate when unrelated files are deleted mid-batch). Concurrent
5149
- // organic extractions against the same writeRoot can still inflate
5150
- // this count; the extraction engine does not expose a per-session
5151
- // hook for "files created by this run", so full isolation against
5152
- // concurrent writes is tracked as a follow-up.
5153
- const before = new Set(await listMemoryMarkdownFilePaths(writeRoot));
5154
- await orchestrator.ingestBulkImportBatch(turns, {});
5155
- const after = await listMemoryMarkdownFilePaths(writeRoot);
5156
- let memoriesCreated = 0;
5157
- for (const p of after) {
5158
- if (!before.has(p)) memoriesCreated += 1;
5159
- }
5160
- return { memoriesCreated, duplicatesSkipped: 0 };
5161
- };
5141
+ const ingestBatch = processBatchFromIngest((turns) => orchestrator.ingestBulkImportBatch(turns, {}));
5162
5142
  try {
5163
5143
  const result = await runBulkImportCliCommand({
5164
5144
  memoryDir: writeRoot,
@@ -0,0 +1,267 @@
1
+ /**
2
+ * #3611: `resolveGit` delegated git URLs to raw-URL resolution — only
3
+ * GitHub-HTTPS-shaped inputs survived; SSH URLs (git@host:o/r.git), GitLab,
4
+ * self-hosted remotes, and file:// / local-path git sources all threw
5
+ * "Git URL resolution requires a GitHub-format URL", and the error even
6
+ * misdirected to --type github, which cannot parse SSH form either.
7
+ *
8
+ * Root fix: resolve the manifest by really cloning the source
9
+ * (`git clone --depth 1`), then reading marketplace.json from the
10
+ * checkout. These tests use local file:// remotes so they are hermetic —
11
+ * the same code path carries SSH and hosted HTTPS URLs because git
12
+ * handles the transport.
13
+ */
14
+ import assert from "node:assert/strict";
15
+ import { execFileSync } from "node:child_process";
16
+ import { existsSync } from "node:fs";
17
+ import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises";
18
+ import os from "node:os";
19
+ import path from "node:path";
20
+ import test from "node:test";
21
+
22
+ import { parseConfig } from "../config.js";
23
+ import { installFromMarketplace } from "./codex-marketplace.js";
24
+
25
+ const MANIFEST = JSON.stringify(
26
+ {
27
+ version: 1,
28
+ name: "test-market",
29
+ description: "fixture",
30
+ plugins: [
31
+ {
32
+ name: "demo",
33
+ version: "1.0.0",
34
+ description: "demo plugin",
35
+ repository: "owner/repo",
36
+ installType: "git",
37
+ },
38
+ ],
39
+ },
40
+ null,
41
+ 2,
42
+ );
43
+
44
+ function git(cwd: string, args: string[]): void {
45
+ execFileSync("git", args, {
46
+ cwd,
47
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
48
+ stdio: ["ignore", "ignore", "ignore"],
49
+ });
50
+ }
51
+
52
+ async function makeGitRemote(): Promise<{ dir: string; fileUrl: string }> {
53
+ const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-git-"));
54
+ git(dir, ["init", "-q", "-b", "main"]);
55
+ // Fleet git-identity-guard hook lives in a global core.hooksPath and
56
+ // refuses fixture commits; point this throwaway repo at an empty dir.
57
+ const noHooks = path.join(dir, ".no-hooks");
58
+ await mkdir(noHooks);
59
+ git(dir, ["config", "core.hooksPath", noHooks]);
60
+ git(dir, ["config", "user.email", "test@example.com"]);
61
+ git(dir, ["config", "user.name", "test"]);
62
+ await writeFile(path.join(dir, "marketplace.json"), MANIFEST);
63
+ git(dir, ["add", "marketplace.json"]);
64
+ git(dir, ["commit", "-qm", "init"]);
65
+ return { dir, fileUrl: `file://${dir}` };
66
+ }
67
+
68
+ function marketplaceConfig(memoryDir: string) {
69
+ return parseConfig({
70
+ openaiApiKey: "sk-test",
71
+ memoryDir,
72
+ workspaceDir: path.join(memoryDir, "workspace"),
73
+ codexMarketplaceEnabled: true,
74
+ });
75
+ }
76
+
77
+ test("#3611 git source resolves a file:// remote by cloning", async () => {
78
+ const remote = await makeGitRemote();
79
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
80
+ try {
81
+ const result = await installFromMarketplace(
82
+ remote.fileUrl,
83
+ "git",
84
+ marketplaceConfig(memoryDir),
85
+ );
86
+ assert.equal(result.ok, true, result.message);
87
+ assert.deepEqual(result.pluginsFound, ["demo"]);
88
+ } finally {
89
+ await rm(remote.dir, { recursive: true, force: true });
90
+ await rm(memoryDir, { recursive: true, force: true });
91
+ }
92
+ });
93
+
94
+ test("#3611 git source resolves a local-path remote by cloning", async () => {
95
+ const remote = await makeGitRemote();
96
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
97
+ try {
98
+ const result = await installFromMarketplace(
99
+ remote.dir,
100
+ "git",
101
+ marketplaceConfig(memoryDir),
102
+ );
103
+ assert.equal(result.ok, true, result.message);
104
+ assert.deepEqual(result.pluginsFound, ["demo"]);
105
+ } finally {
106
+ await rm(remote.dir, { recursive: true, force: true });
107
+ await rm(memoryDir, { recursive: true, force: true });
108
+ }
109
+ });
110
+
111
+ test("#3611 ambient git config cannot re-enable ext:: or run hooks", async () => {
112
+ // w7X's second exploit: a hostile global gitconfig can re-enable the ext::
113
+ // transport (arbitrary command execution) and point hooksPath at a
114
+ // post-checkout hook that runs during our clone. The clone must run with
115
+ // GIT_CONFIG_NOSYSTEM/GIT_CONFIG_GLOBAL neutralized, a closed protocol
116
+ // allowlist, and hooks disabled.
117
+ const hostile = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-hostile-"));
118
+ const remote = await makeGitRemote();
119
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
120
+ const hooksDir = path.join(hostile, "hooks");
121
+ const hookMarker = path.join(hostile, "hook-ran");
122
+ const extMarker = path.join(hostile, "ext-ran");
123
+ try {
124
+ await mkdir(hooksDir);
125
+ await writeFile(
126
+ path.join(hooksDir, "post-checkout"),
127
+ `#!/bin/sh\ntouch ${hookMarker}\n`,
128
+ { mode: 0o755 },
129
+ );
130
+ const cfgFile = path.join(hostile, "gitconfig");
131
+ await writeFile(
132
+ cfgFile,
133
+ `[protocol "ext"]\n\tallow = always\n[core]\n\thooksPath = ${hooksDir}\n`,
134
+ );
135
+
136
+ const prev = process.env.GIT_CONFIG_GLOBAL;
137
+ process.env.GIT_CONFIG_GLOBAL = cfgFile;
138
+ try {
139
+ const cloned = await installFromMarketplace(
140
+ remote.fileUrl,
141
+ "git",
142
+ marketplaceConfig(memoryDir),
143
+ );
144
+ assert.equal(cloned.ok, true, cloned.message);
145
+ assert.equal(
146
+ existsSync(hookMarker),
147
+ false,
148
+ "ambient hooksPath ran a post-checkout hook during clone",
149
+ );
150
+
151
+ const ext = await installFromMarketplace(
152
+ `ext::sh -c "touch ${extMarker}"`,
153
+ "git",
154
+ marketplaceConfig(memoryDir),
155
+ );
156
+ assert.equal(ext.ok, false, "ext:: transport must not be allowed");
157
+ assert.equal(
158
+ existsSync(extMarker),
159
+ false,
160
+ "ambient protocol.ext.allow=always let ext:: execute a command",
161
+ );
162
+ } finally {
163
+ if (prev === undefined) {
164
+ delete process.env.GIT_CONFIG_GLOBAL;
165
+ } else {
166
+ process.env.GIT_CONFIG_GLOBAL = prev;
167
+ }
168
+ }
169
+ } finally {
170
+ await rm(hostile, { recursive: true, force: true });
171
+ await rm(remote.dir, { recursive: true, force: true });
172
+ await rm(memoryDir, { recursive: true, force: true });
173
+ }
174
+ });
175
+
176
+ test("#3611 a failed clone leaves no temp dir behind", async () => {
177
+ // w7X's third finding: mkdtemp ran before the clone, and the rm sat in a
178
+ // finally that only wrapped resolveLocal — every clone failure (including
179
+ // timeout) leaked remnic-marketplace-git-* dirs.
180
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
181
+ try {
182
+ const count = async () =>
183
+ (await readdir(os.tmpdir())).filter((d) =>
184
+ d.startsWith("remnic-marketplace-git-"),
185
+ ).length;
186
+ const before = await count();
187
+ const result = await installFromMarketplace(
188
+ "file:///definitely/not/a/repo-3611",
189
+ "git",
190
+ marketplaceConfig(memoryDir),
191
+ );
192
+ assert.equal(result.ok, false);
193
+ assert.equal(await count(), before, "failed clone leaked a temp dir");
194
+ } finally {
195
+ await rm(memoryDir, { recursive: true, force: true });
196
+ }
197
+ });
198
+
199
+ test("#3611 scheme-less github.com/owner/repo resolves via the github route", async () => {
200
+ // Post-#3628 regression (Main's diff read): the removed regex also accepted
201
+ // scheme-less `github.com/owner/repo` and routed it to resolveGithub. With
202
+ // resolveGit = clone, the same string is treated as a local path and fails.
203
+ // The fix must restore the github route for that form — proven here by a
204
+ // stubbed fetch observing the raw.githubusercontent.com request.
205
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
206
+ const prevFetch = globalThis.fetch;
207
+ const calls: string[] = [];
208
+ globalThis.fetch = async (input: Parameters<typeof fetch>[0]) => {
209
+ calls.push(String(input));
210
+ return new Response(MANIFEST, { status: 200 });
211
+ };
212
+ try {
213
+ const result = await installFromMarketplace(
214
+ "github.com/owner/repo",
215
+ "git",
216
+ marketplaceConfig(memoryDir),
217
+ );
218
+ assert.equal(result.ok, true, result.message);
219
+ assert.deepEqual(result.pluginsFound, ["demo"]);
220
+ assert.ok(
221
+ calls.some((u) => u.includes("raw.githubusercontent.com/owner/repo")),
222
+ `expected a GitHub raw manifest fetch, got: ${calls.join(", ") || "(none)"}`,
223
+ );
224
+ } finally {
225
+ globalThis.fetch = prevFetch;
226
+ await rm(memoryDir, { recursive: true, force: true });
227
+ }
228
+ });
229
+
230
+ test("#3611 flag-shaped git source is rejected before clone", async () => {
231
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
232
+ try {
233
+ const result = await installFromMarketplace(
234
+ "--upload-pack=/bin/false",
235
+ "git",
236
+ marketplaceConfig(memoryDir),
237
+ );
238
+ assert.equal(result.ok, false);
239
+ assert.ok(
240
+ result.errors.some((e) => e.includes("must not look like a flag")),
241
+ `expected the flag guard, got: ${result.errors.join("; ")}`,
242
+ );
243
+ } finally {
244
+ await rm(memoryDir, { recursive: true, force: true });
245
+ }
246
+ });
247
+
248
+ test("#3611 non-repo git source fails as a clone error, not the stub", async () => {
249
+ const notRepo = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-notgit-"));
250
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
251
+ try {
252
+ const result = await installFromMarketplace(
253
+ `file://${notRepo}`,
254
+ "git",
255
+ marketplaceConfig(memoryDir),
256
+ );
257
+ assert.equal(result.ok, false);
258
+ assert.equal(result.pluginsFound.length, 0);
259
+ assert.ok(
260
+ !result.errors.some((e) => e.includes("GitHub-format URL")),
261
+ `must not fall back to the raw-URL delegation stub: ${result.errors.join("; ")}`,
262
+ );
263
+ } finally {
264
+ await rm(notRepo, { recursive: true, force: true });
265
+ await rm(memoryDir, { recursive: true, force: true });
266
+ }
267
+ });
@@ -17,8 +17,11 @@
17
17
  * manifest files.
18
18
  */
19
19
 
20
+ import { execFile, type ExecFileException } from "node:child_process";
20
21
  import fs from "node:fs";
22
+ import os from "node:os";
21
23
  import path from "node:path";
24
+ import { promisify } from "node:util";
22
25
 
23
26
  import { log } from "../logger.js";
24
27
  import type { PluginConfig } from "../types.js";
@@ -105,6 +108,11 @@ export const MARKETPLACE_MANIFEST_FILENAME = "marketplace.json";
105
108
  /** Valid install types for validation. */
106
109
  const VALID_INSTALL_TYPES = new Set<string>(["github", "git", "local", "url"]);
107
110
 
111
+ /** Bound on a manifest-fetching shallow clone (issue #3611). */
112
+ const GIT_CLONE_TIMEOUT_MS = 120_000;
113
+
114
+ const execFileAsync = promisify(execFile);
115
+
108
116
  // ── Generate ──────────────────────────────────────────────────────────────
109
117
 
110
118
  /**
@@ -445,27 +453,82 @@ async function resolveGithub(
445
453
  /**
446
454
  * Resolve marketplace.json from a git URL.
447
455
  *
448
- * For now this delegates to URL-based resolution by constructing a raw URL.
449
- * Full git clone support can be added later.
456
+ * Shallow-clones the source into a temp dir and reads the manifest from the
457
+ * checkout, so every transport git supports (HTTPS, SSH, file://, local
458
+ * paths, self-hosted) resolves the same way. The clone runs hermetically:
459
+ * ambient git config is ignored (a hostile ~/.gitconfig could re-enable the
460
+ * ext:: transport, which runs arbitrary commands), the protocol allowlist
461
+ * is closed to https/ssh/file, hooks and templates are neutralized, and
462
+ * GIT_TERMINAL_PROMPT=0 keeps a credential prompt from hanging the install.
450
463
  */
451
464
  async function resolveGit(
452
465
  gitUrl: string,
453
466
  logger: MarketplaceLogger,
454
467
  ): Promise<MarketplaceManifest> {
455
- // For git URLs that look like GitHub HTTPS URLs, extract owner/repo and
456
- // delegate to the GitHub resolver.
457
- const ghMatch = gitUrl.match(
458
- /^(?:https?:\/\/)?github\.com\/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+?)(?:\.git)?$/u,
468
+ // Scheme-less github.com/owner/repo is a form the pre-#3628 code accepted:
469
+ // git clone would treat it as a local path, so route it to the GitHub
470
+ // resolver instead.
471
+ const ghSchemaless = gitUrl.match(
472
+ /^github\.com\/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+?)(?:\.git)?$/u,
459
473
  );
460
- if (ghMatch?.[1]) {
461
- logger.debug?.(`git URL looks like GitHub — delegating to github resolver`);
462
- return resolveGithub(ghMatch[1], logger);
474
+ if (ghSchemaless?.[1]) {
475
+ return resolveGithub(ghSchemaless[1], logger);
463
476
  }
464
477
 
465
- throw new Error(
466
- `Git URL resolution requires a GitHub-format URL for now. ` +
467
- `Got: ${gitUrl}. Use --type github or --type url instead.`,
468
- );
478
+ if (gitUrl.startsWith("-")) {
479
+ throw new Error(`Invalid git source: ${gitUrl} (must not look like a flag)`);
480
+ }
481
+
482
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "remnic-marketplace-git-"));
483
+ const cloneDir = path.join(tmpDir, "repo");
484
+ const emptyTemplate = path.join(tmpDir, "template");
485
+ fs.mkdirSync(emptyTemplate);
486
+
487
+ try {
488
+ logger.debug?.(`cloning git source for marketplace manifest: ${gitUrl}`);
489
+ try {
490
+ await execFileAsync(
491
+ "git",
492
+ [
493
+ "-c",
494
+ "core.hooksPath=/dev/null",
495
+ "clone",
496
+ "--quiet",
497
+ "--depth",
498
+ "1",
499
+ "--template",
500
+ emptyTemplate,
501
+ "--",
502
+ gitUrl,
503
+ cloneDir,
504
+ ],
505
+ {
506
+ env: {
507
+ ...process.env,
508
+ GIT_TERMINAL_PROMPT: "0",
509
+ GIT_CONFIG_NOSYSTEM: "1",
510
+ GIT_CONFIG_GLOBAL: "/dev/null",
511
+ // Ambient GIT_CONFIG_KEY_*/GIT_CONFIG_VALUE_* pairs cannot inject
512
+ // config either.
513
+ GIT_CONFIG_COUNT: "0",
514
+ GIT_ALLOW_PROTOCOL: "https:ssh:file",
515
+ },
516
+ timeout: GIT_CLONE_TIMEOUT_MS,
517
+ },
518
+ );
519
+ } catch (err) {
520
+ // SAFETY: the only awaited call in the try block is the git clone, and
521
+ // execFile rejections are always ExecFileException carrying the child's
522
+ // stderr.
523
+ const stderr = (err as ExecFileException).stderr?.toString().trim();
524
+ const detail = stderr || (err instanceof Error ? err.message : String(err));
525
+ throw new Error(`Failed to clone git source ${gitUrl}: ${detail}`);
526
+ }
527
+
528
+ return resolveLocal(cloneDir, logger);
529
+ } finally {
530
+ fs.rmSync(tmpDir, { recursive: true, force: true });
531
+ }
469
532
  }
470
533
 
471
534
  // ── Helpers ───────────────────────────────────────────────────────────────
@@ -611,50 +611,30 @@ export function renderMemoryMd(ctx: RenderContext): string {
611
611
  lines.push(`applies_to: cwd=*; reuse_rule=namespace-match`);
612
612
  lines.push("");
613
613
 
614
- // One "task" per top-level topic cluster. For the first cut we group by
615
- // memory category so the schema validator always sees at least one task.
616
- const byCategory = groupMemoriesByCategory(ctx.memories);
617
- let taskIndex = 1;
618
- if (byCategory.size === 0) {
619
- lines.push(`## Task ${taskIndex}: baseline — no memories yet`);
620
- lines.push("");
621
- lines.push("### rollout_summary_files");
622
- for (const r of ctx.rolloutSummaries) {
614
+ // One task per namespace: there is no topic clustering yet, so a task per
615
+ // memory category would emit identical rollout lists under every task and
616
+ // claim per-task scoping that does not exist. The documented contract is a
617
+ // single task carrying all rollouts until real clustering lands (#3614).
618
+ const activeMemories = ctx.memories.filter(
619
+ (m) => !m.frontmatter.status || m.frontmatter.status === "active",
620
+ );
621
+ lines.push(`## Task 1: ${ctx.namespace} memories, outcome=surface-to-codex`);
622
+ lines.push("");
623
+ lines.push("### rollout_summary_files");
624
+ const rollouts = ctx.rolloutSummaries.slice(0, 5);
625
+ if (rollouts.length === 0) {
626
+ lines.push("- (none)");
627
+ } else {
628
+ for (const r of rollouts) {
623
629
  lines.push(
624
630
  `- rollout_summaries/${sanitizeSlug(r.slug)}.md (cwd=${r.cwd ?? "*"}, rollout_path=${r.rolloutPath ?? ""}, updated_at=${r.updatedAt ?? ""}, thread_id=${r.threadId ?? ""})`,
625
631
  );
626
632
  }
627
- if (ctx.rolloutSummaries.length === 0) {
628
- lines.push("- (none)");
629
- }
630
- lines.push("");
631
- lines.push("### keywords");
632
- lines.push(`- ${ctx.namespace}`);
633
- lines.push("");
634
- taskIndex += 1;
635
- } else {
636
- for (const [category, mems] of byCategory) {
637
- lines.push(`## Task ${taskIndex}: ${category} memories, outcome=surface-to-codex`);
638
- lines.push("");
639
- lines.push("### rollout_summary_files");
640
- const relevantRollouts = ctx.rolloutSummaries.slice(0, 5);
641
- if (relevantRollouts.length === 0) {
642
- lines.push("- (none)");
643
- } else {
644
- for (const r of relevantRollouts) {
645
- lines.push(
646
- `- rollout_summaries/${sanitizeSlug(r.slug)}.md (cwd=${r.cwd ?? "*"}, rollout_path=${r.rolloutPath ?? ""}, updated_at=${r.updatedAt ?? ""}, thread_id=${r.threadId ?? ""})`,
647
- );
648
- }
649
- }
650
- lines.push("");
651
- lines.push("### keywords");
652
- const keywords = collectKeywords(mems, category, ctx.namespace);
653
- lines.push(`- ${keywords.join(", ")}`);
654
- lines.push("");
655
- taskIndex += 1;
656
- }
657
633
  }
634
+ lines.push("");
635
+ lines.push("### keywords");
636
+ lines.push(`- ${collectKeywords(activeMemories, ctx.namespace).join(", ")}`);
637
+ lines.push("");
658
638
 
659
639
  lines.push("## User preferences");
660
640
  const prefs = pickCategory(ctx.memories, ["preference"]);
@@ -932,18 +912,6 @@ function oneLineSummary(memory: MemoryFile): string {
932
912
  return `${raw.slice(0, 157)}...`;
933
913
  }
934
914
 
935
- function groupMemoriesByCategory(memories: MemoryFile[]): Map<string, MemoryFile[]> {
936
- const map = new Map<string, MemoryFile[]>();
937
- for (const memory of memories) {
938
- if (memory.frontmatter.status && memory.frontmatter.status !== "active") continue;
939
- const category = memory.frontmatter.category ?? "unknown";
940
- const list = map.get(category) ?? [];
941
- list.push(memory);
942
- map.set(category, list);
943
- }
944
- return map;
945
- }
946
-
947
915
  function pickCategory(memories: MemoryFile[], categories: string[]): MemoryFile[] {
948
916
  const allowed = new Set(categories);
949
917
  return memories.filter(
@@ -953,13 +921,19 @@ function pickCategory(memories: MemoryFile[], categories: string[]): MemoryFile[
953
921
  );
954
922
  }
955
923
 
956
- function collectKeywords(memories: MemoryFile[], category: string, namespace: string): string[] {
924
+ function collectKeywords(memories: MemoryFile[], namespace: string): string[] {
957
925
  const keywords = new Set<string>();
958
- keywords.add(category);
959
926
  keywords.add(namespace);
960
- for (const mem of memories.slice(0, 10)) {
927
+ // Two passes so the tag flood cannot crowd out a category: every active
928
+ // memory's category is guaranteed a slot, then tags fill what remains.
929
+ for (const mem of memories) {
930
+ const category = (mem.frontmatter.category ?? "").trim();
931
+ if (category.length > 0) keywords.add(category);
932
+ }
933
+ for (const mem of memories) {
961
934
  for (const tag of mem.frontmatter.tags ?? []) {
962
- if (typeof tag === "string" && tag.trim().length > 0) keywords.add(tag.trim());
935
+ const trimmed = tag.trim();
936
+ if (trimmed.length > 0) keywords.add(trimmed);
963
937
  }
964
938
  }
965
939
  return [...keywords].slice(0, 16);
@@ -283,6 +283,17 @@ test("an unreadable receipt-failure history keeps the gate closed", async () =>
283
283
  assert.ok(result.demotionReasons.includes("recent_receipt_failures"));
284
284
  });
285
285
 
286
+ test("a non-finite receipt-failure count keeps the gate closed", async () => {
287
+ const h = harness();
288
+ h.deps.recorder = {
289
+ ...h.deps.recorder!,
290
+ trailingReceiptFailures: async () => Number.NaN,
291
+ };
292
+ const result = await new MemoryControllerCoordinator(h.deps).run({ prompt: RECALL_PROMPT });
293
+ assert.equal(result.effectiveMode, "shadow");
294
+ assert.ok(result.demotionReasons.includes("recent_receipt_failures"));
295
+ });
296
+
286
297
  test("executor error or missing executor records a failure class and demotes next run", async () => {
287
298
  const h = harness({
288
299
  executors: {
@@ -547,7 +547,11 @@ export class MemoryControllerCoordinator {
547
547
  // Unknown receipt health keeps the gate closed.
548
548
  recorded = 1;
549
549
  }
550
- if (Number.isFinite(recorded) && recorded > this.consecutiveReceiptFailures) {
550
+ if (!Number.isFinite(recorded)) {
551
+ // A count that is not a real number is unreadable history too.
552
+ recorded = 1;
553
+ }
554
+ if (recorded > this.consecutiveReceiptFailures) {
551
555
  this.consecutiveReceiptFailures = recorded;
552
556
  }
553
557
  }
@@ -376,6 +376,7 @@ export class NamespaceStorageRouter {
376
376
  // (used by extraction and shared-promotion paths) strip citations consistently,
377
377
  // matching the behaviour of the primary this.storage instance in the orchestrator.
378
378
  sm.citationTemplate = this.config.inlineSourceAttributionFormat;
379
+ sm.citationTemplateHistory = this.config.inlineSourceAttributionFormatHistory;
379
380
  // #1522: install the post-write catalog touch at the chokepoint — every
380
381
  // successful write on this StorageManager records the namespace touch.
381
382
  this.bindCatalogWriteHook(sm, ns);