@remnic/core 10.0.165 → 10.0.166

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 (418) hide show
  1. package/dist/access-admin-ops-surface.js +128 -127
  2. package/dist/access-authorization-probe.js +4 -4
  3. package/dist/access-boundary.js +3 -3
  4. package/dist/access-cli.d.ts.map +1 -1
  5. package/dist/access-cli.js +144 -137
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-coding-context-resolution.d.ts +37 -0
  8. package/dist/access-coding-context-resolution.d.ts.map +1 -1
  9. package/dist/access-coding-context-resolution.js +48 -4
  10. package/dist/access-errors.d.ts +5 -0
  11. package/dist/access-errors.d.ts.map +1 -1
  12. package/dist/access-errors.js +3 -1
  13. package/dist/access-extraction-force-flush-preempt.js +128 -127
  14. package/dist/access-extraction-force-flush.js +128 -127
  15. package/dist/access-http-briefing.js +128 -127
  16. package/dist/access-http-query.js +128 -127
  17. package/dist/access-http.d.ts.map +1 -1
  18. package/dist/access-http.js +128 -127
  19. package/dist/access-identity-continuity-surface.js +128 -127
  20. package/dist/access-lcm-surface.js +128 -127
  21. package/dist/access-mcp.js +128 -127
  22. package/dist/access-memory-search-fanout.js +2 -2
  23. package/dist/access-namespace-preflight.js +4 -4
  24. package/dist/access-observe-transcript.js +3 -2
  25. package/dist/access-observe-write-category.js +9 -9
  26. package/dist/access-observe-write-surface.d.ts +1 -0
  27. package/dist/access-observe-write-surface.d.ts.map +1 -1
  28. package/dist/access-observe-write-surface.js +128 -127
  29. package/dist/access-offline-manifest.js +9 -8
  30. package/dist/access-operations-batch.js +128 -127
  31. package/dist/access-operations.d.ts +1 -1
  32. package/dist/access-operations.js +128 -127
  33. package/dist/access-recall-concurrency.d.ts +3 -16
  34. package/dist/access-recall-concurrency.d.ts.map +1 -1
  35. package/dist/access-recall-concurrency.js +128 -127
  36. package/dist/access-recall-corpus-versions.d.ts +4 -1
  37. package/dist/access-recall-corpus-versions.d.ts.map +1 -1
  38. package/dist/access-recall-corpus-versions.js +4 -1
  39. package/dist/access-recall-diagnostics.js +3 -3
  40. package/dist/access-recall-response.d.ts.map +1 -1
  41. package/dist/access-recall-response.js +128 -127
  42. package/dist/access-recall-surface.d.ts +1 -0
  43. package/dist/access-recall-surface.d.ts.map +1 -1
  44. package/dist/access-recall-surface.js +128 -127
  45. package/dist/access-schema.d.ts +1 -0
  46. package/dist/access-schema.d.ts.map +1 -1
  47. package/dist/access-schema.js +2 -2
  48. package/dist/access-service.d.ts +3 -15
  49. package/dist/access-service.d.ts.map +1 -1
  50. package/dist/access-service.js +130 -127
  51. package/dist/access-surface-catalog.js +5 -5
  52. package/dist/access-token-capabilities.js +2 -2
  53. package/dist/active-recall.js +21 -21
  54. package/dist/artifact-search.js +2 -2
  55. package/dist/auto-sync-L3M4RKJD.js +1 -1
  56. package/dist/briefing.js +19 -19
  57. package/dist/buffer-add-turns-bounded.js +2 -2
  58. package/dist/buffer-turn-helpers.d.ts.map +1 -1
  59. package/dist/buffer-turn-helpers.js +1 -1
  60. package/dist/buffer.js +11 -10
  61. package/dist/calibration.js +2 -2
  62. package/dist/capsule-import-gate.js +2 -2
  63. package/dist/causal-consolidation.js +20 -20
  64. package/dist/{chunk-5V3IBSVB.js → chunk-22V3CMIW.js} +4 -4
  65. package/dist/{chunk-IHOKB3L3.js → chunk-2FCZIWRI.js} +785 -515
  66. package/dist/chunk-2FCZIWRI.js.map +1 -0
  67. package/dist/{chunk-7IWRLYFJ.js → chunk-2TJSGIKT.js} +2 -2
  68. package/dist/{chunk-V6M6N3EE.js → chunk-333SBFXB.js} +2 -2
  69. package/dist/{chunk-XBW7U7GM.js → chunk-3PNJZTDV.js} +5 -2
  70. package/dist/chunk-3PNJZTDV.js.map +1 -0
  71. package/dist/{chunk-XE4UYWW3.js → chunk-3YOX2BQD.js} +3 -3
  72. package/dist/{chunk-V4ASAWRP.js → chunk-47LDDGAL.js} +3 -3
  73. package/dist/{chunk-XEBNSY7N.js → chunk-4D2EY4WM.js} +2 -2
  74. package/dist/{chunk-5HFCXTGY.js → chunk-4D77BI3J.js} +29 -189
  75. package/dist/chunk-4D77BI3J.js.map +1 -0
  76. package/dist/{chunk-LPV72KRQ.js → chunk-4IMOGAFF.js} +3 -3
  77. package/dist/{chunk-QBREZ4QL.js → chunk-4L25GAYL.js} +2 -2
  78. package/dist/{chunk-HADD45AR.js → chunk-4WCLZBM2.js} +2 -2
  79. package/dist/{chunk-B3GKQ6DU.js → chunk-5MA6ZQ4Z.js} +2 -2
  80. package/dist/{chunk-3QLAOYBL.js → chunk-5QDTZIGH.js} +3 -3
  81. package/dist/{chunk-WXDTOE6F.js → chunk-5VMRM2X3.js} +2 -2
  82. package/dist/{chunk-VE23DIBH.js → chunk-6QWFZ3X5.js} +2 -2
  83. package/dist/{chunk-SDGD6MYV.js → chunk-7F7HRJI2.js} +2 -2
  84. package/dist/{chunk-QFPNWSVH.js → chunk-7OCKK5M5.js} +6 -6
  85. package/dist/{chunk-YAVIBVCU.js → chunk-7QF26EWO.js} +5 -5
  86. package/dist/{chunk-WAJL65KW.js → chunk-7VIJUZYW.js} +3 -3
  87. package/dist/{chunk-EI2M2CFJ.js → chunk-A5UOREWD.js} +3 -3
  88. package/dist/{chunk-32CA7B6L.js → chunk-AQZL7JBZ.js} +2 -2
  89. package/dist/{chunk-EDA6CDBT.js → chunk-AVWOULJH.js} +2 -2
  90. package/dist/{chunk-4HKK5HUI.js → chunk-B3M56D2A.js} +2 -2
  91. package/dist/{chunk-SRN5M4LQ.js → chunk-BKTCVXMK.js} +4 -4
  92. package/dist/{chunk-TXVTNDQT.js → chunk-BPCR5DZP.js} +2 -2
  93. package/dist/chunk-CKELO7Q6.js +113 -0
  94. package/dist/chunk-CKELO7Q6.js.map +1 -0
  95. package/dist/{chunk-IEB6XYW6.js → chunk-CKZWLAHN.js} +2 -2
  96. package/dist/{chunk-JVIWVJ2A.js → chunk-CUPILBIP.js} +3 -3
  97. package/dist/{chunk-274UY54Z.js → chunk-DFZYZOLH.js} +3 -3
  98. package/dist/{chunk-6S4DM53Y.js → chunk-E6EESRJ6.js} +6 -6
  99. package/dist/{chunk-FSI45NUK.js → chunk-EZG54YDS.js} +2 -2
  100. package/dist/{chunk-7ZFB4VZS.js → chunk-FFWFFAP3.js} +2 -2
  101. package/dist/{chunk-22VXXA67.js → chunk-FGT7CUYZ.js} +2 -2
  102. package/dist/{chunk-Z3SXC3MP.js → chunk-FOTFLHBN.js} +2 -2
  103. package/dist/{chunk-RH6XWXMA.js → chunk-FRYCXXTB.js} +3 -3
  104. package/dist/{chunk-B377OKUP.js → chunk-G64WYD2S.js} +4 -4
  105. package/dist/{chunk-JJEQRSYU.js → chunk-GBSXTTLP.js} +2 -2
  106. package/dist/{chunk-2YODOG2O.js → chunk-GIL2M2OI.js} +3 -3
  107. package/dist/{chunk-YVRQ5JRA.js → chunk-GYOKVJPB.js} +14 -8
  108. package/dist/chunk-GYOKVJPB.js.map +1 -0
  109. package/dist/{chunk-ARJ3KCX4.js → chunk-HDLNSDLK.js} +2 -2
  110. package/dist/{chunk-VXUO5JZC.js → chunk-HDWISXFH.js} +6 -6
  111. package/dist/{chunk-RNFMFC37.js → chunk-IDYYGOOQ.js} +28 -1
  112. package/dist/chunk-IDYYGOOQ.js.map +1 -0
  113. package/dist/{chunk-EZ47HOJ6.js → chunk-IXI6S2VJ.js} +4 -4
  114. package/dist/{chunk-VXMWTRQX.js → chunk-J74YOBB3.js} +4 -4
  115. package/dist/{chunk-AMW3IDCO.js → chunk-JFMMEHVG.js} +2 -2
  116. package/dist/{chunk-6TPWIPE3.js → chunk-JFZZDMEZ.js} +3 -3
  117. package/dist/{chunk-JTSSSR4L.js → chunk-KIUFT2WZ.js} +3 -3
  118. package/dist/{chunk-L6BLTV4D.js → chunk-L7SEYUHS.js} +2 -2
  119. package/dist/{chunk-WRAK5LLB.js → chunk-LPUEBFX2.js} +3 -3
  120. package/dist/{chunk-DBVSU3HE.js → chunk-LVGTH6IQ.js} +9 -9
  121. package/dist/{chunk-33VVVP57.js → chunk-MEVBSF6T.js} +4 -1
  122. package/dist/chunk-MEVBSF6T.js.map +1 -0
  123. package/dist/{chunk-CJCTKL6Y.js → chunk-MGKCKY7X.js} +4 -1
  124. package/dist/chunk-MGKCKY7X.js.map +1 -0
  125. package/dist/{chunk-SOGOHLWN.js → chunk-N7AIFTSH.js} +1 -1
  126. package/dist/chunk-N7AIFTSH.js.map +1 -0
  127. package/dist/chunk-O3XGASU5.js +197 -0
  128. package/dist/chunk-O3XGASU5.js.map +1 -0
  129. package/dist/{chunk-OGBQMY46.js → chunk-O544TUJO.js} +2 -2
  130. package/dist/{chunk-TFNZXOXK.js → chunk-OAQRZ4SV.js} +2 -2
  131. package/dist/{chunk-IEEV27BC.js → chunk-OO2HEUZ4.js} +2 -2
  132. package/dist/{chunk-YMC4AYJK.js → chunk-OWM2VWNX.js} +10 -10
  133. package/dist/{chunk-4LPTSB5V.js → chunk-PFLN6TTW.js} +2 -2
  134. package/dist/{chunk-YOR5QBEU.js → chunk-QFTK6EDM.js} +4 -4
  135. package/dist/{chunk-A2WFUMUN.js → chunk-QKDXO4FD.js} +4 -4
  136. package/dist/{chunk-Y7HLGKKU.js → chunk-QLQUAVVP.js} +4 -4
  137. package/dist/{chunk-MUMQWCE2.js → chunk-QPFM6DHY.js} +2 -2
  138. package/dist/{chunk-YWPCDR3I.js → chunk-QVXEXGIM.js} +3 -3
  139. package/dist/{chunk-UPE7TJWN.js → chunk-QWWHYBPT.js} +2 -2
  140. package/dist/{chunk-NZHZQGLB.js → chunk-QXTKN25V.js} +2 -2
  141. package/dist/{chunk-OAGTKS73.js → chunk-RFLC6PKQ.js} +2 -2
  142. package/dist/{chunk-ZRLTQ2Y7.js → chunk-RO5EGRAI.js} +2 -2
  143. package/dist/{chunk-5D4NBANY.js → chunk-SIONKXLU.js} +2 -2
  144. package/dist/{chunk-6XTUZKCZ.js → chunk-SMDZTJ2D.js} +2 -2
  145. package/dist/{chunk-OFSAKEZB.js → chunk-T4BT4FQN.js} +2 -2
  146. package/dist/{chunk-IC35ZYLM.js → chunk-TAD6QMMD.js} +4 -4
  147. package/dist/{chunk-EAHNSQ7H.js → chunk-TB6VFEHQ.js} +2 -2
  148. package/dist/{chunk-6ARSFTLD.js → chunk-TNRGWJYT.js} +2 -2
  149. package/dist/{chunk-JCAMHTS2.js → chunk-UBG65KEY.js} +7 -5
  150. package/dist/{chunk-JCAMHTS2.js.map → chunk-UBG65KEY.js.map} +1 -1
  151. package/dist/{chunk-CGOPDXLK.js → chunk-UMEUU66X.js} +2 -2
  152. package/dist/{chunk-5LTXYM7D.js → chunk-UYIBNDQE.js} +2 -2
  153. package/dist/{chunk-UGQEJWR3.js → chunk-VHXRLD6S.js} +2 -2
  154. package/dist/{chunk-WJ6S54ES.js → chunk-VOLTQNAP.js} +2 -2
  155. package/dist/{chunk-SBU5GDOT.js → chunk-VRHY7Y5A.js} +7 -7
  156. package/dist/{chunk-E5RJPLNL.js → chunk-W7N7NWG5.js} +3 -3
  157. package/dist/{chunk-UPWOMMVU.js → chunk-WECKZ3KT.js} +7 -7
  158. package/dist/{chunk-PCUDFWX5.js → chunk-WEFFO2MJ.js} +2 -2
  159. package/dist/{chunk-QCP75JGO.js → chunk-WQUGCOKF.js} +5 -5
  160. package/dist/{chunk-FKBGK3NC.js → chunk-WWUQ6CP3.js} +2 -2
  161. package/dist/{chunk-KR6PEAM4.js → chunk-X67XNZ64.js} +8 -8
  162. package/dist/{chunk-UYHDMCY2.js → chunk-XUVCQ4YZ.js} +2 -2
  163. package/dist/{chunk-7IJ2H43M.js → chunk-YY57TRKN.js} +2 -2
  164. package/dist/{chunk-AU6AEUFD.js → chunk-YYXYZM2I.js} +2 -2
  165. package/dist/{chunk-3FBAEPCU.js → chunk-ZDUE44CC.js} +2 -2
  166. package/dist/{chunk-PRE7R3RQ.js → chunk-ZQUOUPP3.js} +12 -3
  167. package/dist/chunk-ZQUOUPP3.js.map +1 -0
  168. package/dist/{chunk-RDO6AMDL.js → chunk-ZWDDY4WF.js} +2 -2
  169. package/dist/{chunk-QASTQVGK.js → chunk-ZX546Y3Y.js} +2 -2
  170. package/dist/chunk-ZX546Y3Y.js.map +1 -0
  171. package/dist/cli.js +128 -127
  172. package/dist/coding/architecture-surfaces.d.ts +0 -24
  173. package/dist/coding/architecture-surfaces.d.ts.map +1 -1
  174. package/dist/coding/codegraph-surfaces.d.ts.map +1 -1
  175. package/dist/coding/export-okf-codegraph.js +51 -24
  176. package/dist/coding/export-okf-codegraph.js.map +1 -1
  177. package/dist/coding/git-context.d.ts +23 -0
  178. package/dist/coding/git-context.d.ts.map +1 -1
  179. package/dist/coding/git-context.js +31 -0
  180. package/dist/coding/git-context.js.map +1 -0
  181. package/dist/coding/session-delta-surfaces.d.ts +0 -23
  182. package/dist/coding/session-delta-surfaces.d.ts.map +1 -1
  183. package/dist/compounding/engine.js +20 -20
  184. package/dist/config.js +21 -21
  185. package/dist/connectors/codex-materialize-runner.js +19 -19
  186. package/dist/connectors/index.js +23 -23
  187. package/dist/convergence-refresh.js +21 -21
  188. package/dist/conversation-index/backend.js +2 -2
  189. package/dist/corpus-watermark.js +23 -23
  190. package/dist/deep-recall-config.js +2 -2
  191. package/dist/deep-recall-http-glue.js +4 -4
  192. package/dist/entity-recall-cancellation.js +2 -2
  193. package/dist/entity-recall-reads.js +3 -3
  194. package/dist/entity-retrieval.js +21 -21
  195. package/dist/explicit-capture.js +128 -127
  196. package/dist/external-wiki-access.js +4 -4
  197. package/dist/extraction-judge.js +1 -1
  198. package/dist/extraction.js +31 -30
  199. package/dist/harmonic-retrieval.js +19 -19
  200. package/dist/index.js +207 -205
  201. package/dist/local-llm.js +2 -2
  202. package/dist/location/index.js +21 -21
  203. package/dist/maintenance/memory-governance.js +19 -19
  204. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -19
  205. package/dist/maintenance/rebuild-memory-projection-runner.js +21 -21
  206. package/dist/maintenance/rebuild-memory-projection.js +20 -20
  207. package/dist/memory-browse-http-glue.js +2 -2
  208. package/dist/memory-browse-operations.js +4 -4
  209. package/dist/memory-browse.js +6 -6
  210. package/dist/namespaces/migrate.js +20 -20
  211. package/dist/namespaces/search.js +8 -8
  212. package/dist/namespaces/storage.js +19 -19
  213. package/dist/offline-sync-impression-drain.js +8 -7
  214. package/dist/operator-doctor-corpus.js +26 -26
  215. package/dist/operator-doctor-replica.js +4 -4
  216. package/dist/operator-toolkit.js +35 -34
  217. package/dist/orchestration/backlog-scheduler.js +129 -128
  218. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  219. package/dist/orchestration/buffer-drain-runner.js +129 -128
  220. package/dist/orchestration/episodic-context-section.d.ts +3 -2
  221. package/dist/orchestration/episodic-context-section.d.ts.map +1 -1
  222. package/dist/orchestration/maintenance.js +34 -33
  223. package/dist/orchestration/orchestrator-helpers.d.ts +10 -0
  224. package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -1
  225. package/dist/orchestration/orchestrator-init.d.ts +12 -13
  226. package/dist/orchestration/orchestrator-init.d.ts.map +1 -1
  227. package/dist/orchestration/recall-entry.d.ts.map +1 -1
  228. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  229. package/dist/orchestration/session-context.d.ts +5 -1
  230. package/dist/orchestration/session-context.d.ts.map +1 -1
  231. package/dist/orchestration/startup-search-sync.d.ts +73 -0
  232. package/dist/orchestration/startup-search-sync.d.ts.map +1 -0
  233. package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
  234. package/dist/orchestrator.d.ts +4 -1
  235. package/dist/orchestrator.d.ts.map +1 -1
  236. package/dist/orchestrator.js +128 -127
  237. package/dist/qmd-daemon-session.js +2 -2
  238. package/dist/qmd.js +3 -3
  239. package/dist/recall-explain-renderer.js +3 -3
  240. package/dist/recall-navigate-access.js +2 -2
  241. package/dist/recall-navigate-disclosure.js +2 -2
  242. package/dist/recall-navigate.js +2 -2
  243. package/dist/recall-navigation-http-glue.js +2 -2
  244. package/dist/recall-navigation-operations.js +4 -4
  245. package/dist/recall-navigation.js +128 -127
  246. package/dist/recall-qos.d.ts +26 -0
  247. package/dist/recall-qos.d.ts.map +1 -1
  248. package/dist/recall-qos.js +9 -1
  249. package/dist/recall-state-view-admission.js +6 -6
  250. package/dist/recall-why-service.js +6 -6
  251. package/dist/recall-xray-cli.js +4 -4
  252. package/dist/recall-xray-renderer.js +3 -3
  253. package/dist/recall-xray.js +2 -2
  254. package/dist/relay/mission.d.ts +3 -3
  255. package/dist/replica-divergence.js +3 -3
  256. package/dist/resume-bundles.js +23 -23
  257. package/dist/search/factory.js +7 -7
  258. package/dist/search/index.js +9 -9
  259. package/dist/semantic-consolidation.js +20 -20
  260. package/dist/semantic-rule-promotion.js +19 -19
  261. package/dist/semantic-rule-verifier.js +19 -19
  262. package/dist/source-agent-qualifier.js +29 -28
  263. package/dist/standup/build.js +20 -20
  264. package/dist/storage/buffer-drain-claims.js +2 -2
  265. package/dist/storage/buffer-session-files.js +2 -2
  266. package/dist/storage.js +18 -18
  267. package/dist/summarizer.js +3 -3
  268. package/dist/support-passport/index.js +7 -7
  269. package/dist/tokens.js +3 -3
  270. package/dist/transfer/export-okf.js +19 -19
  271. package/dist/types.d.ts +1 -0
  272. package/dist/types.d.ts.map +1 -1
  273. package/dist/types.js +1 -1
  274. package/dist/verified-recall.js +19 -19
  275. package/dist/who-knows-cli.js +21 -21
  276. package/dist/who-knows.js +20 -20
  277. package/package.json +12 -2
  278. package/src/access-cli.ts +18 -9
  279. package/src/access-coding-context-resolution.ts +138 -0
  280. package/src/access-errors.ts +5 -0
  281. package/src/access-http-admission.test.ts +76 -0
  282. package/src/access-http.test.ts +2 -0
  283. package/src/access-http.ts +4 -0
  284. package/src/access-observe-write-surface.ts +2 -1
  285. package/src/access-operations-batch.ts +2 -2
  286. package/src/access-recall-concurrency.ts +179 -22
  287. package/src/access-recall-corpus-versions.ts +12 -7
  288. package/src/access-recall-response.ts +25 -2
  289. package/src/access-recall-surface.ts +6 -4
  290. package/src/access-schema.ts +9 -0
  291. package/src/access-service-raw-excerpt-read-gate.test.ts +7 -2
  292. package/src/access-service-recall-concurrency.test.ts +242 -0
  293. package/src/access-service-set-coding-context.test.ts +210 -0
  294. package/src/access-service.ts +43 -58
  295. package/src/buffer-turn-helpers.ts +3 -0
  296. package/src/capsule-import-gate.test.ts +106 -0
  297. package/src/coding/access-coding-context.test.ts +3 -0
  298. package/src/coding/architecture-surfaces.ts +2 -1
  299. package/src/coding/codegraph-surfaces.test.ts +34 -0
  300. package/src/coding/codegraph-surfaces.ts +3 -2
  301. package/src/coding/git-context.test.ts +29 -0
  302. package/src/coding/git-context.ts +63 -2
  303. package/src/coding/session-delta-surfaces.ts +2 -1
  304. package/src/harmonic-graph-version.test.ts +63 -0
  305. package/src/orchestration/episodic-context-section.ts +6 -7
  306. package/src/orchestration/orchestrator-helpers.ts +10 -0
  307. package/src/orchestration/orchestrator-init.ts +57 -303
  308. package/src/orchestration/recall-entry.ts +59 -4
  309. package/src/orchestration/recall-internal.ts +10 -10
  310. package/src/orchestration/session-context.ts +11 -1
  311. package/src/orchestration/startup-search-sync.ts +492 -0
  312. package/src/orchestration/task-exit.test.ts +45 -0
  313. package/src/orchestration/turn-ingestion-buffered.test.ts +224 -0
  314. package/src/orchestration/turn-ingestion.ts +28 -35
  315. package/src/orchestrator-flush.test.ts +7 -7
  316. package/src/orchestrator-init.test.ts +364 -12
  317. package/src/orchestrator-source-attribution.test.ts +100 -0
  318. package/src/orchestrator-startup-ready-path.test.ts +133 -10
  319. package/src/orchestrator.ts +16 -1
  320. package/src/recall-qos.test.ts +62 -0
  321. package/src/recall-qos.ts +75 -0
  322. package/src/recall-retrieval-failure.test.ts +282 -18
  323. package/src/recall-search-options.test.ts +13 -1
  324. package/src/storage/buffer-drain-handin-memo.test.ts +140 -0
  325. package/src/types.ts +1 -1
  326. package/dist/chunk-33VVVP57.js.map +0 -1
  327. package/dist/chunk-3QNFHI6T.js +0 -38
  328. package/dist/chunk-3QNFHI6T.js.map +0 -1
  329. package/dist/chunk-5HFCXTGY.js.map +0 -1
  330. package/dist/chunk-CJCTKL6Y.js.map +0 -1
  331. package/dist/chunk-IHOKB3L3.js.map +0 -1
  332. package/dist/chunk-PRE7R3RQ.js.map +0 -1
  333. package/dist/chunk-QASTQVGK.js.map +0 -1
  334. package/dist/chunk-RNFMFC37.js.map +0 -1
  335. package/dist/chunk-SOGOHLWN.js.map +0 -1
  336. package/dist/chunk-XBW7U7GM.js.map +0 -1
  337. package/dist/chunk-YVRQ5JRA.js.map +0 -1
  338. /package/dist/{chunk-5V3IBSVB.js.map → chunk-22V3CMIW.js.map} +0 -0
  339. /package/dist/{chunk-7IWRLYFJ.js.map → chunk-2TJSGIKT.js.map} +0 -0
  340. /package/dist/{chunk-V6M6N3EE.js.map → chunk-333SBFXB.js.map} +0 -0
  341. /package/dist/{chunk-XE4UYWW3.js.map → chunk-3YOX2BQD.js.map} +0 -0
  342. /package/dist/{chunk-V4ASAWRP.js.map → chunk-47LDDGAL.js.map} +0 -0
  343. /package/dist/{chunk-XEBNSY7N.js.map → chunk-4D2EY4WM.js.map} +0 -0
  344. /package/dist/{chunk-LPV72KRQ.js.map → chunk-4IMOGAFF.js.map} +0 -0
  345. /package/dist/{chunk-QBREZ4QL.js.map → chunk-4L25GAYL.js.map} +0 -0
  346. /package/dist/{chunk-HADD45AR.js.map → chunk-4WCLZBM2.js.map} +0 -0
  347. /package/dist/{chunk-B3GKQ6DU.js.map → chunk-5MA6ZQ4Z.js.map} +0 -0
  348. /package/dist/{chunk-3QLAOYBL.js.map → chunk-5QDTZIGH.js.map} +0 -0
  349. /package/dist/{chunk-WXDTOE6F.js.map → chunk-5VMRM2X3.js.map} +0 -0
  350. /package/dist/{chunk-VE23DIBH.js.map → chunk-6QWFZ3X5.js.map} +0 -0
  351. /package/dist/{chunk-SDGD6MYV.js.map → chunk-7F7HRJI2.js.map} +0 -0
  352. /package/dist/{chunk-QFPNWSVH.js.map → chunk-7OCKK5M5.js.map} +0 -0
  353. /package/dist/{chunk-YAVIBVCU.js.map → chunk-7QF26EWO.js.map} +0 -0
  354. /package/dist/{chunk-WAJL65KW.js.map → chunk-7VIJUZYW.js.map} +0 -0
  355. /package/dist/{chunk-EI2M2CFJ.js.map → chunk-A5UOREWD.js.map} +0 -0
  356. /package/dist/{chunk-32CA7B6L.js.map → chunk-AQZL7JBZ.js.map} +0 -0
  357. /package/dist/{chunk-EDA6CDBT.js.map → chunk-AVWOULJH.js.map} +0 -0
  358. /package/dist/{chunk-4HKK5HUI.js.map → chunk-B3M56D2A.js.map} +0 -0
  359. /package/dist/{chunk-SRN5M4LQ.js.map → chunk-BKTCVXMK.js.map} +0 -0
  360. /package/dist/{chunk-TXVTNDQT.js.map → chunk-BPCR5DZP.js.map} +0 -0
  361. /package/dist/{chunk-IEB6XYW6.js.map → chunk-CKZWLAHN.js.map} +0 -0
  362. /package/dist/{chunk-JVIWVJ2A.js.map → chunk-CUPILBIP.js.map} +0 -0
  363. /package/dist/{chunk-274UY54Z.js.map → chunk-DFZYZOLH.js.map} +0 -0
  364. /package/dist/{chunk-6S4DM53Y.js.map → chunk-E6EESRJ6.js.map} +0 -0
  365. /package/dist/{chunk-FSI45NUK.js.map → chunk-EZG54YDS.js.map} +0 -0
  366. /package/dist/{chunk-7ZFB4VZS.js.map → chunk-FFWFFAP3.js.map} +0 -0
  367. /package/dist/{chunk-22VXXA67.js.map → chunk-FGT7CUYZ.js.map} +0 -0
  368. /package/dist/{chunk-Z3SXC3MP.js.map → chunk-FOTFLHBN.js.map} +0 -0
  369. /package/dist/{chunk-RH6XWXMA.js.map → chunk-FRYCXXTB.js.map} +0 -0
  370. /package/dist/{chunk-B377OKUP.js.map → chunk-G64WYD2S.js.map} +0 -0
  371. /package/dist/{chunk-JJEQRSYU.js.map → chunk-GBSXTTLP.js.map} +0 -0
  372. /package/dist/{chunk-2YODOG2O.js.map → chunk-GIL2M2OI.js.map} +0 -0
  373. /package/dist/{chunk-ARJ3KCX4.js.map → chunk-HDLNSDLK.js.map} +0 -0
  374. /package/dist/{chunk-VXUO5JZC.js.map → chunk-HDWISXFH.js.map} +0 -0
  375. /package/dist/{chunk-EZ47HOJ6.js.map → chunk-IXI6S2VJ.js.map} +0 -0
  376. /package/dist/{chunk-VXMWTRQX.js.map → chunk-J74YOBB3.js.map} +0 -0
  377. /package/dist/{chunk-AMW3IDCO.js.map → chunk-JFMMEHVG.js.map} +0 -0
  378. /package/dist/{chunk-6TPWIPE3.js.map → chunk-JFZZDMEZ.js.map} +0 -0
  379. /package/dist/{chunk-JTSSSR4L.js.map → chunk-KIUFT2WZ.js.map} +0 -0
  380. /package/dist/{chunk-L6BLTV4D.js.map → chunk-L7SEYUHS.js.map} +0 -0
  381. /package/dist/{chunk-WRAK5LLB.js.map → chunk-LPUEBFX2.js.map} +0 -0
  382. /package/dist/{chunk-DBVSU3HE.js.map → chunk-LVGTH6IQ.js.map} +0 -0
  383. /package/dist/{chunk-OGBQMY46.js.map → chunk-O544TUJO.js.map} +0 -0
  384. /package/dist/{chunk-TFNZXOXK.js.map → chunk-OAQRZ4SV.js.map} +0 -0
  385. /package/dist/{chunk-IEEV27BC.js.map → chunk-OO2HEUZ4.js.map} +0 -0
  386. /package/dist/{chunk-YMC4AYJK.js.map → chunk-OWM2VWNX.js.map} +0 -0
  387. /package/dist/{chunk-4LPTSB5V.js.map → chunk-PFLN6TTW.js.map} +0 -0
  388. /package/dist/{chunk-YOR5QBEU.js.map → chunk-QFTK6EDM.js.map} +0 -0
  389. /package/dist/{chunk-A2WFUMUN.js.map → chunk-QKDXO4FD.js.map} +0 -0
  390. /package/dist/{chunk-Y7HLGKKU.js.map → chunk-QLQUAVVP.js.map} +0 -0
  391. /package/dist/{chunk-MUMQWCE2.js.map → chunk-QPFM6DHY.js.map} +0 -0
  392. /package/dist/{chunk-YWPCDR3I.js.map → chunk-QVXEXGIM.js.map} +0 -0
  393. /package/dist/{chunk-UPE7TJWN.js.map → chunk-QWWHYBPT.js.map} +0 -0
  394. /package/dist/{chunk-NZHZQGLB.js.map → chunk-QXTKN25V.js.map} +0 -0
  395. /package/dist/{chunk-OAGTKS73.js.map → chunk-RFLC6PKQ.js.map} +0 -0
  396. /package/dist/{chunk-ZRLTQ2Y7.js.map → chunk-RO5EGRAI.js.map} +0 -0
  397. /package/dist/{chunk-5D4NBANY.js.map → chunk-SIONKXLU.js.map} +0 -0
  398. /package/dist/{chunk-6XTUZKCZ.js.map → chunk-SMDZTJ2D.js.map} +0 -0
  399. /package/dist/{chunk-OFSAKEZB.js.map → chunk-T4BT4FQN.js.map} +0 -0
  400. /package/dist/{chunk-IC35ZYLM.js.map → chunk-TAD6QMMD.js.map} +0 -0
  401. /package/dist/{chunk-EAHNSQ7H.js.map → chunk-TB6VFEHQ.js.map} +0 -0
  402. /package/dist/{chunk-6ARSFTLD.js.map → chunk-TNRGWJYT.js.map} +0 -0
  403. /package/dist/{chunk-CGOPDXLK.js.map → chunk-UMEUU66X.js.map} +0 -0
  404. /package/dist/{chunk-5LTXYM7D.js.map → chunk-UYIBNDQE.js.map} +0 -0
  405. /package/dist/{chunk-UGQEJWR3.js.map → chunk-VHXRLD6S.js.map} +0 -0
  406. /package/dist/{chunk-WJ6S54ES.js.map → chunk-VOLTQNAP.js.map} +0 -0
  407. /package/dist/{chunk-SBU5GDOT.js.map → chunk-VRHY7Y5A.js.map} +0 -0
  408. /package/dist/{chunk-E5RJPLNL.js.map → chunk-W7N7NWG5.js.map} +0 -0
  409. /package/dist/{chunk-UPWOMMVU.js.map → chunk-WECKZ3KT.js.map} +0 -0
  410. /package/dist/{chunk-PCUDFWX5.js.map → chunk-WEFFO2MJ.js.map} +0 -0
  411. /package/dist/{chunk-QCP75JGO.js.map → chunk-WQUGCOKF.js.map} +0 -0
  412. /package/dist/{chunk-FKBGK3NC.js.map → chunk-WWUQ6CP3.js.map} +0 -0
  413. /package/dist/{chunk-KR6PEAM4.js.map → chunk-X67XNZ64.js.map} +0 -0
  414. /package/dist/{chunk-UYHDMCY2.js.map → chunk-XUVCQ4YZ.js.map} +0 -0
  415. /package/dist/{chunk-7IJ2H43M.js.map → chunk-YY57TRKN.js.map} +0 -0
  416. /package/dist/{chunk-AU6AEUFD.js.map → chunk-YYXYZM2I.js.map} +0 -0
  417. /package/dist/{chunk-3FBAEPCU.js.map → chunk-ZDUE44CC.js.map} +0 -0
  418. /package/dist/{chunk-RDO6AMDL.js.map → chunk-ZWDDY4WF.js.map} +0 -0
@@ -0,0 +1,106 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdir, mkdtemp, rm, symlink, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+ import test from "node:test";
6
+ import { ZodError } from "zod";
7
+
8
+ import { EngramAccessInputError } from "./access-errors.js";
9
+ import { defaultCapsulesDir } from "./capsule-cli.js";
10
+ import { isCapsuleImportArchiveInputError, validateCapsuleImportArchive } from "./capsule-import-gate.js";
11
+
12
+ async function storeFixture(t: test.TestContext): Promise<{ storageDir: string; archivePath: string }> {
13
+ const storageDir = await mkdtemp(path.join(tmpdir(), "remnic-gate-"));
14
+ t.after(() => rm(storageDir, { recursive: true, force: true }));
15
+ const storeDir = defaultCapsulesDir(storageDir);
16
+ await mkdir(storeDir, { recursive: true });
17
+ const archivePath = path.join(storeDir, "capsule.tgz");
18
+ await writeFile(archivePath, "archive-bytes");
19
+ return { storageDir, archivePath };
20
+ }
21
+
22
+ test("capsule import gate: an archive inside the capsule store validates", async (t) => {
23
+ const { storageDir, archivePath } = await storeFixture(t);
24
+ await assert.doesNotReject(validateCapsuleImportArchive(archivePath, storageDir));
25
+ });
26
+
27
+ test("capsule import gate: an archive outside the store is refused with the shared message", async (t) => {
28
+ const { storageDir } = await storeFixture(t);
29
+ const outside = path.join(storageDir, "outside.tgz");
30
+ await writeFile(outside, "bytes");
31
+
32
+ await assert.rejects(
33
+ validateCapsuleImportArchive(outside, storageDir),
34
+ (err: Error) =>
35
+ err instanceof EngramAccessInputError &&
36
+ /existing file inside the namespace capsule store/.test(err.message),
37
+ );
38
+ });
39
+
40
+ test("capsule import gate: a missing path is refused without revealing it is missing", async (t) => {
41
+ const { storageDir } = await storeFixture(t);
42
+ const missing = path.join(defaultCapsulesDir(storageDir), "never.tgz");
43
+
44
+ await assert.rejects(
45
+ validateCapsuleImportArchive(missing, storageDir),
46
+ /existing file inside the namespace capsule store/,
47
+ );
48
+ });
49
+
50
+ test("capsule import gate: .. traversal out of the store is refused", async (t) => {
51
+ const { storageDir, archivePath } = await storeFixture(t);
52
+ const traversed = path.join(defaultCapsulesDir(storageDir), "..", "outside-store.tgz");
53
+ await writeFile(path.resolve(traversed), "bytes");
54
+
55
+ await assert.rejects(
56
+ validateCapsuleImportArchive(traversed, storageDir),
57
+ /existing file inside the namespace capsule store/,
58
+ );
59
+ // The real archive still validates — the refusal is about the traversal, not the store.
60
+ await assert.doesNotReject(validateCapsuleImportArchive(archivePath, storageDir));
61
+ });
62
+
63
+ test("capsule import gate: a store symlink to a file outside the store is refused", async (t) => {
64
+ const { storageDir } = await storeFixture(t);
65
+ const outside = path.join(storageDir, "outside-target.tgz");
66
+ await writeFile(outside, "bytes");
67
+ // The link path itself sits inside the store; only its real path escapes.
68
+ const link = path.join(defaultCapsulesDir(storageDir), "escape.tgz");
69
+ await symlink(outside, link);
70
+
71
+ await assert.rejects(
72
+ validateCapsuleImportArchive(link, storageDir),
73
+ /existing file inside the namespace capsule store/,
74
+ );
75
+ });
76
+
77
+ test("capsule import gate: a directory inside the store is refused as not-a-file", async (t) => {
78
+ const { storageDir } = await storeFixture(t);
79
+ await mkdir(path.join(defaultCapsulesDir(storageDir), "a-dir"), { recursive: true });
80
+
81
+ await assert.rejects(
82
+ validateCapsuleImportArchive(path.join(defaultCapsulesDir(storageDir), "a-dir"), storageDir),
83
+ /must point to a file/,
84
+ );
85
+ });
86
+
87
+ test("capsule import gate: a missing capsule store is refused like any other path", async (t) => {
88
+ const storageDir = await mkdtemp(path.join(tmpdir(), "remnic-gate-nostore-"));
89
+ t.after(() => rm(storageDir, { recursive: true, force: true }));
90
+ const archivePath = path.join(storageDir, "whatever.tgz");
91
+
92
+ await assert.rejects(
93
+ validateCapsuleImportArchive(archivePath, storageDir),
94
+ /existing file inside the namespace capsule store/,
95
+ );
96
+ });
97
+
98
+ test("archive input classifier: zod errors and archive-shape messages are input faults", () => {
99
+ assert.ok(isCapsuleImportArchiveInputError(new ZodError([]), "anything"));
100
+ assert.ok(isCapsuleImportArchiveInputError(Object.assign(new Error("x"), { code: "Z_ANY" }), "anything"));
101
+ assert.ok(isCapsuleImportArchiveInputError(new Error("y"), "importCapsule: archive is truncated"));
102
+ assert.ok(isCapsuleImportArchiveInputError(new Error("y"), "importCapsule: manifest invalid"));
103
+ assert.ok(isCapsuleImportArchiveInputError(new Error("y"), "gunzip failed: incorrect header check"));
104
+ assert.ok(isCapsuleImportArchiveInputError(new Error("y"), "unexpected end of file"));
105
+ assert.ok(!isCapsuleImportArchiveInputError(new Error("db unavailable"), "importCapsule: backend write failed"));
106
+ });
@@ -22,6 +22,9 @@ function makeService(): {
22
22
  } {
23
23
  const calls: Array<{ sessionKey: string; ctx: CodingContext | null }> = [];
24
24
  const stubOrchestrator = {
25
+ // Namespaces off keeps this suite on the permissive validation path; the
26
+ // principal-binding gate is covered in access-service-set-coding-context.test.ts.
27
+ config: { namespacesEnabled: false },
25
28
  setCodingContextForSession(sessionKey: string, ctx: CodingContext | null) {
26
29
  calls.push({ sessionKey, ctx });
27
30
  },
@@ -22,6 +22,7 @@
22
22
  * - `refresh`: build a fresh card from the repo, persist it, and
23
23
  * snapshot the prior version.
24
24
  */
25
+ import { codingContextLocalRoot } from "../access-coding-context-resolution.js";
25
26
  import type {
26
27
  CodingKnowledgeConfig,
27
28
  CodingContext,
@@ -244,7 +245,7 @@ async function architectureRefresh(
244
245
  ctx: ArchitectureSurfaceContext,
245
246
  codingContext: CodingContext,
246
247
  ): Promise<ArchitectureSurfaceResponse> {
247
- const repoRoot = codingContext.rootPath ?? codingContext.projectId;
248
+ const repoRoot = codingContextLocalRoot(codingContext);
248
249
  // Authorize the write + resolve storage BEFORE scanning the repo or
249
250
  // invoking the summariser, so an unauthorized refresh fails fast instead
250
251
  // of doing work (and an LLM call) it cannot persist (codex review: buildCard
@@ -953,3 +953,37 @@ test("LSP wiring: a failed LSP pass is non-fatal — index still reports ok with
953
953
  assert.equal(result.lsp?.error, "lsp_resolution_error", "the degradation code surfaces (never silent)");
954
954
  assert.equal(result.lsp?.message, "server crashed", "the degradation message surfaces");
955
955
  });
956
+
957
+ // ──────────────────────────────────────────────────────────────────────────
958
+ // #3515 review (wAK): a client-supplied rootPath is remote to the daemon —
959
+ // surfaces must never open it as a local path. It degrades to the projectId,
960
+ // which is what a projectTag-derived context already carries.
961
+ // ──────────────────────────────────────────────────────────────────────────
962
+
963
+ test("remote coding-context rootPath is never passed to repo scanning", async () => {
964
+ const remoteCtx: CodingContext = { ...CODING_CONTEXT, remote: true };
965
+ let built = "";
966
+ let indexed = "";
967
+ const ctx = makeEnabledCtx({
968
+ getCodingContext: () => remoteCtx,
969
+ buildArchitectureCard: async (root: string) => {
970
+ built = root;
971
+ return { card: "stub" };
972
+ },
973
+ reportIndexStatus: async (_store: CodegraphStore, repoRoot: string) => {
974
+ indexed = repoRoot;
975
+ return { ok: true, status: { mode: "fresh" } };
976
+ },
977
+ });
978
+ const arch = await handleCodegraphTool({ tool: "get_architecture", sessionKey: "s1" }, ctx);
979
+ assert.notEqual(built, CODING_CONTEXT.rootPath, "remote rootPath must not reach the scanner");
980
+ // projectId is caller-chosen and may itself be path-shaped, so the remote
981
+ // root degrades to the tag form — the same non-path label a
982
+ // projectTag-derived context already carries.
983
+ assert.equal(built, `tag:${remoteCtx.projectId}`, "remote root degrades to the tag label like a projectTag context");
984
+ assert.equal(arch.ok, true);
985
+ const status = await handleCodegraphTool({ tool: "index_status", sessionKey: "s1" }, ctx);
986
+ assert.notEqual(indexed, CODING_CONTEXT.rootPath);
987
+ assert.equal(indexed, `tag:${remoteCtx.projectId}`);
988
+ assert.equal(status.ok, true);
989
+ });
@@ -19,6 +19,7 @@
19
19
  * or architecture-card logic.
20
20
  */
21
21
  import type { PluginConfig, CodingContext } from "../types.js";
22
+ import { codingContextLocalRoot } from "../access-coding-context-resolution.js";
22
23
  import {
23
24
  codegraphRuntimeAvailable,
24
25
  codegraphSurfaceVisible,
@@ -633,7 +634,7 @@ async function handleGetArchitecture(
633
634
  ctx: CodegraphSurfaceContext,
634
635
  ): Promise<CodegraphSurfaceResponse> {
635
636
  const codingContext = resolveCodingContext(request, ctx);
636
- const repoRoot = request.repoRoot ?? codingContext.rootPath;
637
+ const repoRoot = request.repoRoot ?? codingContextLocalRoot(codingContext);
637
638
  // Composition (issue #1554): deterministic architecture card from Track A
638
639
  // (no live graph) + live graph stats from the per-project store. Two
639
640
  // existing sources, one composed response -- no duplicated card logic.
@@ -785,7 +786,7 @@ function resolveRepoRoot(request: CodegraphSurfaceRequest, ctx: CodegraphSurface
785
786
  if (typeof request.repoRoot === "string" && request.repoRoot.trim().length > 0) {
786
787
  return request.repoRoot.trim();
787
788
  }
788
- return resolveCodingContext(request, ctx).rootPath;
789
+ return codingContextLocalRoot(resolveCodingContext(request, ctx));
789
790
  }
790
791
 
791
792
  /**
@@ -822,3 +822,32 @@ test("a non-repo-only cache remembers non-repos but always re-reads repos", asyn
822
822
  await resolveGitContext("/tmp/z", { invoker: notRepo, cache });
823
823
  assert.equal(nonRepoCalls, 1);
824
824
  });
825
+
826
+ test("probeGitContext: dubious-ownership exit 128 is inconclusive, a real non-repo is conclusive", async () => {
827
+ const { probeGitContext } = await import("./git-context.js");
828
+ const dubious: GitInvoker = (cwd, args) =>
829
+ args.includes("--show-toplevel")
830
+ ? { stdout: "", stderr: "fatal: detected dubious ownership in repository at '/repo'", exitCode: 128 }
831
+ : { stdout: "", exitCode: 1 };
832
+ const d = await probeGitContext("/repo", { invoker: dubious });
833
+ assert.equal(d.conclusive, false, "operational git failure must not masquerade as a confirmed non-repo");
834
+
835
+ const notRepo: GitInvoker = (cwd, args) =>
836
+ args.includes("--show-toplevel")
837
+ ? { stdout: "", stderr: "fatal: not a git repository (or any of the parent directories): .git", exitCode: 128 }
838
+ : { stdout: "", exitCode: 1 };
839
+ const n = await probeGitContext("/tmp/x", { invoker: notRepo });
840
+ assert.equal(n.conclusive, true);
841
+ assert.equal(n.context, null);
842
+
843
+ // Inside a confirmed repo, an optional probe failing (no origin) stays conclusive.
844
+ const noOrigin: GitInvoker = (cwd, args) => {
845
+ if (args.includes("--show-toplevel")) return { stdout: "/repo\n", exitCode: 0 };
846
+ if (args[0] === "remote") return { stdout: "", stderr: "error: No such remote 'origin'", exitCode: 2 };
847
+ if (args[1] === "--abbrev-ref") return { stdout: "main\n", exitCode: 0 };
848
+ if (args[0] === "symbolic-ref" || args[0] === "rev-parse") return { stdout: "", stderr: "", exitCode: 1 };
849
+ return { stdout: "", exitCode: 1 };
850
+ };
851
+ const r = await probeGitContext("/repo", { invoker: noOrigin });
852
+ assert.equal(r.conclusive, true, "a missing origin inside a repo is a conclusive result, not a degraded probe");
853
+ });
@@ -74,6 +74,10 @@ export interface GitInvokeOptions {
74
74
  export interface GitInvokeResult {
75
75
  stdout: string;
76
76
  exitCode: number;
77
+ /** Captured when the invoker can supply it; used to tell a confirmed
78
+ * "not a git repository" answer from operational failures (e.g. exit 128
79
+ * for dubious ownership) that must stay inconclusive. */
80
+ stderr?: string;
77
81
  }
78
82
 
79
83
  /**
@@ -99,6 +103,7 @@ export interface SyncGitInvoker {
99
103
  const DEFAULT_GIT_TIMEOUT_MS = 2_000;
100
104
  const GIT_TIMEOUT_EXIT_CODE = 124;
101
105
  const GIT_SPAWN_ERROR_EXIT_CODE = 127;
106
+ const NOT_A_GIT_REPOSITORY = /not a git repository|outside repository|this operation must be run in a work tree/i;
102
107
 
103
108
  export function defaultGitInvokerSync(): SyncGitInvoker {
104
109
  return (cwd: string, args: string[]) => {
@@ -111,6 +116,7 @@ export function defaultGitInvokerSync(): SyncGitInvoker {
111
116
  if (result.error) return { stdout: "", exitCode: GIT_SPAWN_ERROR_EXIT_CODE };
112
117
  return {
113
118
  stdout: typeof result.stdout === "string" ? result.stdout : "",
119
+ stderr: result.stderr ?? "",
114
120
  exitCode: typeof result.status === "number" ? result.status : 1,
115
121
  };
116
122
  };
@@ -128,10 +134,11 @@ export function defaultGitInvoker(): GitInvoker {
128
134
  cwd,
129
135
  encoding: "utf-8",
130
136
  shell: false,
131
- stdio: ["ignore", "pipe", "ignore"],
137
+ stdio: ["ignore", "pipe", "pipe"],
132
138
  });
133
139
  const { promise, resolve, reject } = Promise.withResolvers<GitInvokeResult>();
134
140
  let stdout = "";
141
+ let stderr = "";
135
142
  let settled = false;
136
143
  let timer: NodeJS.Timeout | undefined;
137
144
 
@@ -164,9 +171,13 @@ export function defaultGitInvoker(): GitInvoker {
164
171
  child.stdout?.on("data", (chunk: string | Buffer) => {
165
172
  stdout += chunk.toString();
166
173
  });
174
+ child.stderr?.setEncoding("utf-8");
175
+ child.stderr?.on("data", (chunk: string | Buffer) => {
176
+ stderr += chunk.toString();
177
+ });
167
178
  child.once("error", () => finish({ stdout: "", exitCode: GIT_SPAWN_ERROR_EXIT_CODE }));
168
179
  child.once("close", (exitCode: number | null) => {
169
- finish({ stdout, exitCode: typeof exitCode === "number" ? exitCode : 1 });
180
+ finish({ stdout, stderr, exitCode: exitCode ?? 1 });
170
181
  });
171
182
  options.abortSignal?.addEventListener("abort", onAbort, { once: true });
172
183
 
@@ -573,3 +584,53 @@ export const sharedGitContextCache = new GitContextCache();
573
584
  * read a repo fresh; they only skip repeat probes of non-repo directories.
574
585
  */
575
586
  export const sharedNonRepoGitContextCache = new GitContextCache({ cacheRepos: false });
587
+
588
+ /**
589
+ * A probe verdict: `context` is the resolved context or `null`, and
590
+ * `conclusive` tells the two nulls apart. `conclusive: true` means git
591
+ * answered (a real repo or a confirmed non-repo); `conclusive: false` means
592
+ * the probe itself failed — spawn error, timeout, or an invoker throw —
593
+ * so the null carries no evidence about the directory.
594
+ */
595
+ export interface GitContextProbeResult {
596
+ context: GitContext | null;
597
+ conclusive: boolean;
598
+ }
599
+
600
+ /**
601
+ * `resolveGitContext` with the inconclusive distinction surfaced: the
602
+ * existing cache path already refuses to cache timeout/spawn-failure
603
+ * results, so a cached `null` is conclusive by construction. Callers that
604
+ * clear state on `null` (the plugin's coding-context sync) must only do so
605
+ * on a conclusive verdict.
606
+ */
607
+ export async function probeGitContext(
608
+ cwd: string,
609
+ options: ResolveGitContextOptions = {},
610
+ ): Promise<GitContextProbeResult> {
611
+ let inconclusive = false;
612
+ const inner = options.invoker ?? defaultGitInvoker();
613
+ const invoker: GitInvoker = async (probeCwd, args, invokeOptions) => {
614
+ let result: GitInvokeResult;
615
+ try {
616
+ result = await inner(probeCwd, args, invokeOptions);
617
+ } catch (err) {
618
+ inconclusive = true;
619
+ throw err;
620
+ }
621
+ if (result.exitCode === GIT_TIMEOUT_EXIT_CODE || result.exitCode === GIT_SPAWN_ERROR_EXIT_CODE) {
622
+ inconclusive = true;
623
+ } else if (
624
+ args[0] === "rev-parse" && args.includes("--show-toplevel")
625
+ && result.exitCode !== 0 && result.stderr !== undefined && !NOT_A_GIT_REPOSITORY.test(result.stderr)
626
+ ) {
627
+ // The repo probe's nonzero exit decides "not a repo", but dubious
628
+ // ownership, a corrupt .git or an unreadable cwd exit the same 128 —
629
+ // only git's own "not a repository" answer is conclusive.
630
+ inconclusive = true;
631
+ }
632
+ return result;
633
+ };
634
+ const context = await resolveGitContext(cwd, { ...options, invoker });
635
+ return { context, conclusive: !inconclusive };
636
+ }
@@ -21,6 +21,7 @@
21
21
  * state file is operator-side bookkeeping, not user memory content — the
22
22
  * same way `calibration.ts` writes are uncounted).
23
23
  */
24
+ import { codingContextLocalRoot } from "../access-coding-context-resolution.js";
24
25
  import type {
25
26
  CodingKnowledgeConfig,
26
27
  CodingContext,
@@ -224,7 +225,7 @@ async function deltaGet(
224
225
  // coding context was resolved from; it MUST exist for a delta to make
225
226
  // sense. Fall back to `projectId` only as a path hint — refresh is the
226
227
  // caller's responsibility (the gate already required a context).
227
- const repoRoot = codingContext.rootPath ?? codingContext.projectId;
228
+ const repoRoot = codingContextLocalRoot(codingContext);
228
229
  const sliceResult: ResolveSliceResult = resolveSlice(
229
230
  repoRoot,
230
231
  lastSeen?.head ?? null,
@@ -0,0 +1,63 @@
1
+ import assert from "node:assert/strict";
2
+ import { statSync, writeFileSync } from "node:fs";
3
+ import { mkdtemp, rm } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
5
+ import path from "node:path";
6
+ import test from "node:test";
7
+
8
+ import {
9
+ bumpHarmonicGraphVersion,
10
+ HARMONIC_GRAPH_VERSION_SENTINEL,
11
+ readHarmonicGraphStamp,
12
+ } from "./harmonic-graph-version.js";
13
+
14
+ test("harmonic version: bump appends one byte to the sentinel, creating it", async (t) => {
15
+ const nodeDir = await mkdtemp(path.join(tmpdir(), "remnic-hgv-"));
16
+ t.after(() => rm(nodeDir, { recursive: true, force: true }));
17
+ const sentinel = path.join(nodeDir, HARMONIC_GRAPH_VERSION_SENTINEL);
18
+
19
+ bumpHarmonicGraphVersion(nodeDir);
20
+ assert.equal(statSync(sentinel).size, 1);
21
+ bumpHarmonicGraphVersion(nodeDir);
22
+ assert.equal(statSync(sentinel).size, 2);
23
+ });
24
+
25
+ test("harmonic version: stamp changes when the harmonic sentinel grows", async (t) => {
26
+ const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-hgv-mem-"));
27
+ t.after(() => rm(memoryDir, { recursive: true, force: true }));
28
+ const nodeDir = path.join(memoryDir, "abstraction-nodes");
29
+
30
+ const before = readHarmonicGraphStamp(memoryDir, nodeDir);
31
+ assert.equal(before, "0:0:0:0");
32
+
33
+ bumpHarmonicGraphVersion(nodeDir);
34
+ const after = readHarmonicGraphStamp(memoryDir, nodeDir);
35
+ assert.notEqual(after, before);
36
+ assert.equal(after.split(":")[3], "1");
37
+ });
38
+
39
+ test("harmonic version: stamp reflects the corpus sentinel too", async (t) => {
40
+ const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-hgv-mem2-"));
41
+ const nodeDir = await mkdtemp(path.join(tmpdir(), "remnic-hgv-node2-"));
42
+ t.after(() => rm(memoryDir, { recursive: true, force: true }));
43
+ t.after(() => rm(nodeDir, { recursive: true, force: true }));
44
+
45
+ const { MEMORY_CORPUS_VERSION_SENTINEL } = await import("./memory-corpus-version.js");
46
+ const { mkdirSync } = await import("node:fs");
47
+ const stateDir = path.join(memoryDir, "state");
48
+ mkdirSync(stateDir, { recursive: true });
49
+ writeFileSync(path.join(stateDir, MEMORY_CORPUS_VERSION_SENTINEL), "xxx");
50
+
51
+ const stamp = readHarmonicGraphStamp(memoryDir, nodeDir);
52
+ assert.equal(stamp.split(":")[0], "3");
53
+ });
54
+
55
+ test("harmonic version: a failed bump is fail-open, never throws", async (t) => {
56
+ const base = await mkdtemp(path.join(tmpdir(), "remnic-hgv-ro-"));
57
+ t.after(() => rm(base, { recursive: true, force: true }));
58
+ // A regular file in place of the store dir makes mkdirSync fail; bump swallows it.
59
+ const fileAsDir = path.join(base, "not-a-dir");
60
+ writeFileSync(fileAsDir, "x");
61
+
62
+ assert.doesNotThrow(() => bumpHarmonicGraphVersion(fileAsDir));
63
+ });
@@ -40,8 +40,9 @@ export async function appendEpisodicContextSection(
40
40
  scopePlan: ScopePlan;
41
41
  namespacesEnabled: boolean;
42
42
  enrichmentSectionDeadlineMs: number;
43
- recallOuterTimeoutMs: number;
44
- recallStart: number;
43
+ /** Absolute deadline for the whole request (already client-clamped),
44
+ * or null when unbounded. */
45
+ outerDeadlineAtMs: number | null;
45
46
  abortSignal?: AbortSignal;
46
47
  recordMetric: (metric: RecallSectionMetric) => void;
47
48
  },
@@ -72,12 +73,10 @@ export async function appendEpisodicContextSection(
72
73
  return;
73
74
  }
74
75
 
75
- const outerDeadlineAtMs =
76
- options.recallOuterTimeoutMs > 0
77
- ? options.recallStart + options.recallOuterTimeoutMs
78
- : null;
79
76
  const remainingOuterMs =
80
- outerDeadlineAtMs === null ? null : outerDeadlineAtMs - deps.recallAssemblyClockMs();
77
+ options.outerDeadlineAtMs === null
78
+ ? null
79
+ : options.outerDeadlineAtMs - deps.recallAssemblyClockMs();
81
80
  const deadlineMs = resolveRecallCoreSectionDeadlineMs({
82
81
  configuredCoreDeadlineMs: options.enrichmentSectionDeadlineMs,
83
82
  remainingOuterMs,
@@ -263,6 +263,16 @@ export interface RecallInvocationOptions {
263
263
  * absent, so existing timing consumers are unaffected.
264
264
  */
265
265
  queueWaitMs?: number;
266
+ /**
267
+ * Client's own deadline for this recall (issue #3499). Epoch-sized
268
+ * values are absolute; smaller values read as a budget from now — the
269
+ * force-flush convention (issue #3140). Caps the request's outer
270
+ * deadline at `min(configured, client)` so a client whose own budget is
271
+ * tighter than `recallOuterTimeoutMs` gets a degraded recall inside what
272
+ * remains instead of an answer it can no longer use. Never a rejection:
273
+ * an already-passed deadline behaves like a 0-remaining budget.
274
+ */
275
+ deadlineMs?: number;
266
276
  onContextComposition?: (composition: RecallContextComposition) => void | PromiseLike<void>;
267
277
  }
268
278