@remnic/core 9.3.729 → 9.3.731

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 (345) hide show
  1. package/dist/access-boundary.d.ts +6 -5
  2. package/dist/access-boundary.js +13 -13
  3. package/dist/access-cli.js +34 -33
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +6 -5
  6. package/dist/access-http.js +19 -19
  7. package/dist/access-mcp.d.ts +6 -5
  8. package/dist/access-mcp.js +18 -18
  9. package/dist/access-operations-batch.js +16 -16
  10. package/dist/access-operations.d.ts +11 -10
  11. package/dist/access-operations.js +17 -17
  12. package/dist/access-schema.d.ts +42 -42
  13. package/dist/{access-service-BXMJqkTA.d.ts → access-service-Byoe3HsT.d.ts} +18 -3
  14. package/dist/access-service.d.ts +6 -5
  15. package/dist/access-service.js +12 -12
  16. package/dist/access-surface-catalog.d.ts +6 -5
  17. package/dist/action-confidence.d.ts +1 -1
  18. package/dist/active-memory-bridge.d.ts +1 -1
  19. package/dist/active-recall.d.ts +1 -1
  20. package/dist/active-recall.js +2 -2
  21. package/dist/{auto-sync-F3KCSQFJ.js → auto-sync-G3V5AN4C.js} +2 -2
  22. package/dist/behavior-learner.d.ts +1 -1
  23. package/dist/behavior-signals.d.ts +1 -1
  24. package/dist/bootstrap.d.ts +5 -4
  25. package/dist/briefing.d.ts +1 -1
  26. package/dist/briefing.js +3 -3
  27. package/dist/buffer-surprise-report.d.ts +1 -1
  28. package/dist/buffer.d.ts +1 -1
  29. package/dist/calibration.d.ts +1 -1
  30. package/dist/capabilities.d.ts +55 -2
  31. package/dist/capabilities.js +5 -1
  32. package/dist/{catalog-bMczlO2G.d.ts → catalog-DM1nk7cM.d.ts} +1 -1
  33. package/dist/causal-behavior.d.ts +1 -1
  34. package/dist/causal-consolidation.d.ts +1 -1
  35. package/dist/causal-consolidation.js +4 -4
  36. package/dist/causal-trajectory-graph.d.ts +1 -1
  37. package/dist/{chunk-4NOI577P.js → chunk-24ZLC5QN.js} +2 -2
  38. package/dist/{chunk-DMQWV6SQ.js → chunk-5RZOFIDL.js} +2 -2
  39. package/dist/{chunk-UM5AWJNQ.js → chunk-646B5ERJ.js} +62 -37
  40. package/dist/chunk-646B5ERJ.js.map +1 -0
  41. package/dist/{chunk-H5BWGCRZ.js → chunk-6TUWSUUD.js} +51 -47
  42. package/dist/{chunk-H5BWGCRZ.js.map → chunk-6TUWSUUD.js.map} +1 -1
  43. package/dist/{chunk-36SEDFAU.js → chunk-C5WN74HH.js} +2 -2
  44. package/dist/{chunk-MLKWJOAJ.js → chunk-CGPHMNL4.js} +2 -2
  45. package/dist/{chunk-R6OVFAX6.js → chunk-DJECGBBM.js} +7 -2
  46. package/dist/{chunk-R6OVFAX6.js.map → chunk-DJECGBBM.js.map} +1 -1
  47. package/dist/{chunk-3RCBIOOJ.js → chunk-ESF7TRYJ.js} +18 -2
  48. package/dist/{chunk-3RCBIOOJ.js.map → chunk-ESF7TRYJ.js.map} +1 -1
  49. package/dist/{chunk-EY6MDMHK.js → chunk-F6OEXJQQ.js} +2 -2
  50. package/dist/{chunk-M4V2JVSZ.js → chunk-FFUCCKPN.js} +2 -2
  51. package/dist/{chunk-O6YH5F47.js → chunk-FYWUNVFZ.js} +8 -8
  52. package/dist/{chunk-37436GML.js → chunk-GEXI357K.js} +2 -2
  53. package/dist/{chunk-YGIQORJ3.js → chunk-GGL34GCW.js} +3 -3
  54. package/dist/{chunk-4H4F3BFL.js → chunk-GXTYEG7Q.js} +3 -3
  55. package/dist/{chunk-4H4F3BFL.js.map → chunk-GXTYEG7Q.js.map} +1 -1
  56. package/dist/{chunk-WAS3NV46.js → chunk-H3MB3F62.js} +2 -2
  57. package/dist/{chunk-UTHQPSRC.js → chunk-HHNSLPX7.js} +11 -8
  58. package/dist/chunk-HHNSLPX7.js.map +1 -0
  59. package/dist/{chunk-76NHR6ZL.js → chunk-HJWQJUKQ.js} +4 -4
  60. package/dist/{chunk-Y4YD5TYW.js → chunk-IIBFCZA7.js} +3 -3
  61. package/dist/{chunk-UVPL565C.js → chunk-IQOEW5YV.js} +2 -2
  62. package/dist/{chunk-V4GNSDFH.js → chunk-KQYGNGON.js} +2 -2
  63. package/dist/{chunk-CBWI22JN.js → chunk-KSJCXXOU.js} +2 -2
  64. package/dist/{chunk-M4AYVEWS.js → chunk-LUCARK4W.js} +12 -11
  65. package/dist/chunk-LUCARK4W.js.map +1 -0
  66. package/dist/{chunk-I5REUWLH.js → chunk-NIZQH6AU.js} +3 -3
  67. package/dist/{chunk-4ESAR77N.js → chunk-NOU77OHX.js} +2 -2
  68. package/dist/{chunk-BQCHEV7O.js → chunk-O4ZIBPIW.js} +3 -3
  69. package/dist/{chunk-HOHVIVDR.js → chunk-OBJUKYDO.js} +2 -2
  70. package/dist/{chunk-YKBHOBJK.js → chunk-OEHCMALU.js} +56 -4
  71. package/dist/chunk-OEHCMALU.js.map +1 -0
  72. package/dist/{chunk-YOLZS7NY.js → chunk-OTQE66IX.js} +2 -2
  73. package/dist/{chunk-HEDZUSCS.js → chunk-OUITHS6V.js} +246 -368
  74. package/dist/chunk-OUITHS6V.js.map +1 -0
  75. package/dist/{chunk-4T3BMHKD.js → chunk-OZECYVGI.js} +20 -7
  76. package/dist/chunk-OZECYVGI.js.map +1 -0
  77. package/dist/{chunk-C2PG7IEH.js → chunk-P3VJCTVE.js} +2 -2
  78. package/dist/{chunk-EH5ED3C6.js → chunk-PMAQRUN4.js} +4 -4
  79. package/dist/chunk-PMAQRUN4.js.map +1 -0
  80. package/dist/{chunk-7RLCCNHU.js → chunk-Q6BAA57B.js} +4 -3
  81. package/dist/chunk-Q6BAA57B.js.map +1 -0
  82. package/dist/{chunk-HGNOCPZX.js → chunk-QZHF4BWN.js} +6 -6
  83. package/dist/chunk-SYX73XD7.js +283 -0
  84. package/dist/chunk-SYX73XD7.js.map +1 -0
  85. package/dist/{chunk-ASKXIAHD.js → chunk-WDJCZQB4.js} +2 -2
  86. package/dist/{chunk-AQLOP5F4.js → chunk-WNGXQMRI.js} +95 -6
  87. package/dist/chunk-WNGXQMRI.js.map +1 -0
  88. package/dist/{chunk-JYLFZWUX.js → chunk-XYUFGHUW.js} +2 -2
  89. package/dist/{chunk-3TSTGI6F.js → chunk-ZQUAVZNG.js} +2 -2
  90. package/dist/{chunk-4NR2PDZ5.js → chunk-ZVHRSR2R.js} +14 -4
  91. package/dist/chunk-ZVHRSR2R.js.map +1 -0
  92. package/dist/{cli-DmAiDd8A.d.ts → cli-Dt-tuiYH.d.ts} +3 -3
  93. package/dist/cli.d.ts +7 -6
  94. package/dist/cli.js +35 -35
  95. package/dist/compounding/engine.d.ts +12 -1
  96. package/dist/compounding/engine.js +3 -3
  97. package/dist/compounding/preference-consolidator.d.ts +1 -1
  98. package/dist/compression-optimizer.d.ts +1 -1
  99. package/dist/config.d.ts +1 -1
  100. package/dist/config.js +2 -2
  101. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  102. package/dist/connectors/codex-materialize-runner.js +3 -3
  103. package/dist/connectors/codex-materialize.d.ts +1 -1
  104. package/dist/connectors/index.d.ts +1 -1
  105. package/dist/connectors/index.js +3 -3
  106. package/dist/consolidation-provenance-check.d.ts +1 -1
  107. package/dist/consolidation-undo.d.ts +1 -1
  108. package/dist/contradiction/index.d.ts +1 -1
  109. package/dist/contradiction/index.js +1 -1
  110. package/dist/conversation-index/backend.d.ts +1 -1
  111. package/dist/conversation-index/chunker.d.ts +1 -1
  112. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  113. package/dist/conversation-index/indexer.d.ts +1 -1
  114. package/dist/conversation-index/search.d.ts +1 -1
  115. package/dist/day-summary.d.ts +1 -1
  116. package/dist/delinearize.d.ts +1 -1
  117. package/dist/direct-answer-wiring.d.ts +1 -1
  118. package/dist/direct-answer.d.ts +1 -1
  119. package/dist/embedding-fallback.d.ts +1 -1
  120. package/dist/embedding-fallback.js +2 -2
  121. package/dist/enrichment/index.d.ts +1 -1
  122. package/dist/entity-retrieval.d.ts +1 -1
  123. package/dist/entity-retrieval.js +3 -3
  124. package/dist/entity-schema.d.ts +1 -1
  125. package/dist/explicit-capture.d.ts +6 -4
  126. package/dist/explicit-capture.js +1 -1
  127. package/dist/extraction-faithfulness.d.ts +1 -1
  128. package/dist/extraction-judge-telemetry.d.ts +1 -1
  129. package/dist/extraction-judge-training.d.ts +1 -1
  130. package/dist/extraction-judge.d.ts +1 -1
  131. package/dist/extraction.d.ts +1 -1
  132. package/dist/extraction.js +3 -3
  133. package/dist/fallback-llm.d.ts +1 -1
  134. package/dist/{first-start-migration-22LPFHD5.js → first-start-migration-OOR57AYR.js} +2 -2
  135. package/dist/graph-dashboard-diff.d.ts +1 -1
  136. package/dist/graph-dashboard-key.d.ts +1 -1
  137. package/dist/graph-dashboard-parser.d.ts +1 -1
  138. package/dist/graph-edge-reinforcement.d.ts +1 -1
  139. package/dist/graph-snapshot.d.ts +1 -1
  140. package/dist/graph.d.ts +1 -1
  141. package/dist/identity-continuity.d.ts +1 -1
  142. package/dist/importance.d.ts +1 -1
  143. package/dist/index.d.ts +296 -11
  144. package/dist/index.js +359 -47
  145. package/dist/index.js.map +1 -1
  146. package/dist/intent.d.ts +1 -1
  147. package/dist/lcm/engine.d.ts +1 -1
  148. package/dist/lcm/index.d.ts +1 -1
  149. package/dist/lcm/tools.d.ts +1 -1
  150. package/dist/lifecycle.d.ts +1 -1
  151. package/dist/live-connectors-runner.d.ts +1 -1
  152. package/dist/local-llm.d.ts +1 -1
  153. package/dist/local-model-endpoint.d.ts +1 -1
  154. package/dist/maintenance/memory-governance.d.ts +1 -1
  155. package/dist/maintenance/memory-governance.js +3 -3
  156. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  157. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  158. package/dist/mcp-memory-inspector-app.d.ts +6 -5
  159. package/dist/memory-action-policy.d.ts +1 -1
  160. package/dist/memory-cache.d.ts +1 -1
  161. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  162. package/dist/memory-projection-store.d.ts +1 -1
  163. package/dist/memory-provenance.d.ts +1 -1
  164. package/dist/memory-worth-outcomes.d.ts +1 -1
  165. package/dist/models-json.d.ts +1 -1
  166. package/dist/namespaces/migrate.d.ts +2 -2
  167. package/dist/namespaces/migrate.js +9 -9
  168. package/dist/namespaces/principal.d.ts +1 -1
  169. package/dist/namespaces/search.d.ts +1 -1
  170. package/dist/namespaces/search.js +5 -5
  171. package/dist/namespaces/storage.d.ts +2 -2
  172. package/dist/namespaces/storage.js +3 -3
  173. package/dist/native-knowledge.d.ts +1 -1
  174. package/dist/operator-toolkit.d.ts +1 -1
  175. package/dist/operator-toolkit.js +14 -14
  176. package/dist/orchestration/compression-guideline-coordinator.d.ts +105 -0
  177. package/dist/orchestration/compression-guideline-coordinator.js +12 -0
  178. package/dist/orchestration/maintenance.d.ts +2 -2
  179. package/dist/orchestration/maintenance.js +5 -5
  180. package/dist/{orchestrator-BR0sGsME.d.ts → orchestrator-B4KjaOtY.d.ts} +24 -8
  181. package/dist/orchestrator.d.ts +5 -4
  182. package/dist/orchestrator.js +28 -26
  183. package/dist/patterns-cli.d.ts +1 -1
  184. package/dist/policy-runtime.d.ts +1 -1
  185. package/dist/provenance.d.ts +1 -1
  186. package/dist/provenance.js +1 -1
  187. package/dist/qmd-recall-cache.d.ts +1 -1
  188. package/dist/qmd.d.ts +1 -1
  189. package/dist/recall-disclosure-escalation.d.ts +1 -1
  190. package/dist/recall-explain-renderer.d.ts +1 -1
  191. package/dist/recall-planner-llm.d.ts +1 -1
  192. package/dist/recall-state.d.ts +1 -1
  193. package/dist/recall-tag-filter.d.ts +1 -1
  194. package/dist/recall-xray-cli.d.ts +1 -1
  195. package/dist/recall-xray-renderer.d.ts +1 -1
  196. package/dist/recall-xray.d.ts +1 -1
  197. package/dist/{resolution-MN36NW5P.js → resolution-33PIX3TT.js} +2 -2
  198. package/dist/resolution-33PIX3TT.js.map +1 -0
  199. package/dist/resolve-auth-token.d.ts +1 -1
  200. package/dist/resume-bundles.js +3 -3
  201. package/dist/retrieval-agents.d.ts +1 -1
  202. package/dist/retrieval-tiers.d.ts +1 -1
  203. package/dist/routing/engine.d.ts +1 -1
  204. package/dist/routing/store.d.ts +1 -1
  205. package/dist/schemas.d.ts +84 -84
  206. package/dist/search/embed-helper.d.ts +1 -1
  207. package/dist/search/embed-helper.js +2 -2
  208. package/dist/search/factory.d.ts +1 -1
  209. package/dist/search/factory.js +4 -4
  210. package/dist/search/index.d.ts +1 -1
  211. package/dist/search/index.js +8 -8
  212. package/dist/search/lancedb-backend.d.ts +1 -1
  213. package/dist/search/meilisearch-backend.d.ts +1 -1
  214. package/dist/search/noop-backend.d.ts +1 -1
  215. package/dist/search/orama-backend.d.ts +1 -1
  216. package/dist/search/port.d.ts +1 -1
  217. package/dist/search/remote-backend.d.ts +1 -1
  218. package/dist/{semantic-consolidation-Cl15ksZy.d.ts → semantic-consolidation-CstTvHPo.d.ts} +1 -1
  219. package/dist/semantic-consolidation.d.ts +2 -2
  220. package/dist/semantic-consolidation.js +4 -4
  221. package/dist/semantic-rule-promotion.js +3 -3
  222. package/dist/semantic-rule-verifier.d.ts +1 -1
  223. package/dist/semantic-rule-verifier.js +3 -3
  224. package/dist/session-observer-bands.d.ts +1 -1
  225. package/dist/session-observer-state.d.ts +1 -1
  226. package/dist/shared-context/manager.d.ts +3 -3
  227. package/dist/signal.d.ts +1 -1
  228. package/dist/storage.d.ts +22 -3
  229. package/dist/storage.js +2 -2
  230. package/dist/summarizer.d.ts +1 -1
  231. package/dist/summary-snapshot.d.ts +1 -1
  232. package/dist/temporal-supersession.d.ts +1 -1
  233. package/dist/temporal-validity.d.ts +1 -1
  234. package/dist/threading.d.ts +1 -1
  235. package/dist/tier-migration.d.ts +1 -1
  236. package/dist/tier-routing.d.ts +1 -1
  237. package/dist/topics.d.ts +1 -1
  238. package/dist/transcript.d.ts +1 -1
  239. package/dist/transfer/types.d.ts +46 -46
  240. package/dist/trust-score-stage.d.ts +1 -1
  241. package/dist/trust-score.d.ts +1 -1
  242. package/dist/{types-ChQb9D6s.d.ts → types-VkxElCHR.d.ts} +8 -1
  243. package/dist/types.d.ts +1 -1
  244. package/dist/utility-runtime.d.ts +1 -1
  245. package/dist/verified-recall.js +3 -3
  246. package/package.json +12 -2
  247. package/src/access-service-coding-write.test.ts +2 -2
  248. package/src/access-service.ts +33 -14
  249. package/src/bitemporal-dedup-backfill.test.ts +10 -10
  250. package/src/bitemporal-frontmatter.test.ts +3 -3
  251. package/src/capabilities.test.ts +185 -0
  252. package/src/capabilities.ts +110 -0
  253. package/src/cli/creation-ledger-commands.ts +22 -21
  254. package/src/coding/architecture-surfaces.test.ts +25 -1
  255. package/src/coding/architecture-surfaces.ts +47 -19
  256. package/src/coding/decision-surfaces.ts +12 -3
  257. package/src/coding/review-context-structural.test.ts +303 -0
  258. package/src/coding/review-context.ts +79 -0
  259. package/src/coding/structural-context.test.ts +259 -0
  260. package/src/coding/structural-context.ts +315 -0
  261. package/src/coding/structural-subprocess-provider.test.ts +430 -0
  262. package/src/coding/structural-subprocess-provider.ts +355 -0
  263. package/src/compounding/engine.test.ts +90 -0
  264. package/src/compounding/engine.ts +25 -1
  265. package/src/contradiction/contradiction.test.ts +1 -1
  266. package/src/contradiction/resolution.ts +9 -1
  267. package/src/correction/correction-access-wiring.ts +21 -3
  268. package/src/correction/correction-contract.ts +7 -0
  269. package/src/correction/correction-planner.test.ts +231 -0
  270. package/src/correction/correction-planner.ts +73 -0
  271. package/src/correction/correction-service.ts +29 -0
  272. package/src/correction/correction-storage-integration.test.ts +2 -2
  273. package/src/dedup/semantic.test.ts +1 -1
  274. package/src/explicit-capture.ts +7 -4
  275. package/src/extraction-eventtime-wiring.test.ts +3 -3
  276. package/src/extraction-redaction-rules.test.ts +172 -0
  277. package/src/index.ts +29 -0
  278. package/src/maintenance/forget.test.ts +1 -1
  279. package/src/maintenance/memory-governance.test.ts +1 -1
  280. package/src/maintenance/pattern-reinforcement.test.ts +2 -2
  281. package/src/operator-toolkit.ts +4 -3
  282. package/src/orchestration/compression-guideline-coordinator.ts +449 -0
  283. package/src/orchestrator.ts +345 -464
  284. package/src/procedural/procedure-miner.test.ts +2 -2
  285. package/src/provenance-extraction.test.ts +382 -4
  286. package/src/provenance.ts +158 -22
  287. package/src/recall-handles-wiring.test.ts +1 -1
  288. package/src/search/factory.ts +4 -3
  289. package/src/semantic-rule-promotion.ts +1 -1
  290. package/src/source-attribution-roundtrip.test.ts +2 -2
  291. package/src/storage-contract/atomicity.test.ts +1 -1
  292. package/src/storage-contract/cache-coherence.test.ts +2 -2
  293. package/src/storage-contract/content-hash.test.ts +1 -1
  294. package/src/storage-contract/namespace-routing.test.ts +1 -1
  295. package/src/storage-contract/round-trip.test.ts +3 -3
  296. package/src/storage.ts +23 -2
  297. package/src/temporal-supersession.test.ts +12 -11
  298. package/src/temporal-validity.test.ts +11 -11
  299. package/src/wearables/cli.test.ts +30 -0
  300. package/src/wearables/cli.ts +3 -0
  301. package/src/wearables/memory-gen.test.ts +57 -1
  302. package/src/wearables/memory-gen.ts +31 -7
  303. package/src/wearables/pipeline.test.ts +40 -1
  304. package/src/wearables/pipeline.ts +4 -0
  305. package/src/wearables/service.test.ts +2 -2
  306. package/src/wearables/storage-io.test.ts +3 -3
  307. package/src/wearables/types.ts +7 -0
  308. package/dist/chunk-4NR2PDZ5.js.map +0 -1
  309. package/dist/chunk-4T3BMHKD.js.map +0 -1
  310. package/dist/chunk-7RLCCNHU.js.map +0 -1
  311. package/dist/chunk-AQLOP5F4.js.map +0 -1
  312. package/dist/chunk-EH5ED3C6.js.map +0 -1
  313. package/dist/chunk-HEDZUSCS.js.map +0 -1
  314. package/dist/chunk-M4AYVEWS.js.map +0 -1
  315. package/dist/chunk-UM5AWJNQ.js.map +0 -1
  316. package/dist/chunk-UTHQPSRC.js.map +0 -1
  317. package/dist/chunk-YKBHOBJK.js.map +0 -1
  318. /package/dist/{auto-sync-F3KCSQFJ.js.map → auto-sync-G3V5AN4C.js.map} +0 -0
  319. /package/dist/{chunk-4NOI577P.js.map → chunk-24ZLC5QN.js.map} +0 -0
  320. /package/dist/{chunk-DMQWV6SQ.js.map → chunk-5RZOFIDL.js.map} +0 -0
  321. /package/dist/{chunk-36SEDFAU.js.map → chunk-C5WN74HH.js.map} +0 -0
  322. /package/dist/{chunk-MLKWJOAJ.js.map → chunk-CGPHMNL4.js.map} +0 -0
  323. /package/dist/{chunk-EY6MDMHK.js.map → chunk-F6OEXJQQ.js.map} +0 -0
  324. /package/dist/{chunk-M4V2JVSZ.js.map → chunk-FFUCCKPN.js.map} +0 -0
  325. /package/dist/{chunk-O6YH5F47.js.map → chunk-FYWUNVFZ.js.map} +0 -0
  326. /package/dist/{chunk-37436GML.js.map → chunk-GEXI357K.js.map} +0 -0
  327. /package/dist/{chunk-YGIQORJ3.js.map → chunk-GGL34GCW.js.map} +0 -0
  328. /package/dist/{chunk-WAS3NV46.js.map → chunk-H3MB3F62.js.map} +0 -0
  329. /package/dist/{chunk-76NHR6ZL.js.map → chunk-HJWQJUKQ.js.map} +0 -0
  330. /package/dist/{chunk-Y4YD5TYW.js.map → chunk-IIBFCZA7.js.map} +0 -0
  331. /package/dist/{chunk-UVPL565C.js.map → chunk-IQOEW5YV.js.map} +0 -0
  332. /package/dist/{chunk-V4GNSDFH.js.map → chunk-KQYGNGON.js.map} +0 -0
  333. /package/dist/{chunk-CBWI22JN.js.map → chunk-KSJCXXOU.js.map} +0 -0
  334. /package/dist/{chunk-I5REUWLH.js.map → chunk-NIZQH6AU.js.map} +0 -0
  335. /package/dist/{chunk-4ESAR77N.js.map → chunk-NOU77OHX.js.map} +0 -0
  336. /package/dist/{chunk-BQCHEV7O.js.map → chunk-O4ZIBPIW.js.map} +0 -0
  337. /package/dist/{chunk-HOHVIVDR.js.map → chunk-OBJUKYDO.js.map} +0 -0
  338. /package/dist/{chunk-YOLZS7NY.js.map → chunk-OTQE66IX.js.map} +0 -0
  339. /package/dist/{chunk-C2PG7IEH.js.map → chunk-P3VJCTVE.js.map} +0 -0
  340. /package/dist/{chunk-HGNOCPZX.js.map → chunk-QZHF4BWN.js.map} +0 -0
  341. /package/dist/{chunk-ASKXIAHD.js.map → chunk-WDJCZQB4.js.map} +0 -0
  342. /package/dist/{chunk-JYLFZWUX.js.map → chunk-XYUFGHUW.js.map} +0 -0
  343. /package/dist/{chunk-3TSTGI6F.js.map → chunk-ZQUAVZNG.js.map} +0 -0
  344. /package/dist/{first-start-migration-22LPFHD5.js.map → first-start-migration-OOR57AYR.js.map} +0 -0
  345. /package/dist/{resolution-MN36NW5P.js.map → orchestration/compression-guideline-coordinator.js.map} +0 -0
@@ -0,0 +1,430 @@
1
+ /**
2
+ * Tests for the subprocess structural-context provider (issue #1548 Track A
3
+ * PR 5).
4
+ *
5
+ * Exercises the full 4-state failure matrix mandated by the issue's PR 5
6
+ * acceptance:
7
+ * (a) provider unavailable → {ok:false, code:"provider_unavailable"}
8
+ * (b) provider returns symbols → {ok:true, symbols:[...]}
9
+ * (c) provider times out → {ok:false, code:"provider_timeout"}
10
+ * (d) provider returns malformed JSON → {ok:false, code:"provider_malformed"}
11
+ *
12
+ * The spawn boundary is injected (rule 33 — mock matches production
13
+ * signature) so no real subprocess is ever launched. No filesystem touched
14
+ * for real binaries; `statSync` is bypassed by pointing the command at a
15
+ * path that exists (the repo's package.json) when an "available" probe is
16
+ * needed, or a nonexistent path when "unavailable" is needed.
17
+ */
18
+ import assert from "node:assert/strict";
19
+ import path from "node:path";
20
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
21
+ import { tmpdir } from "node:os";
22
+ import { after, before, test } from "node:test";
23
+
24
+ import {
25
+ createSubprocessStructuralProvider,
26
+ probeStructuralProviderForDoctor,
27
+ type StructuralSpawnFn,
28
+ } from "./structural-subprocess-provider.js";
29
+ import type { PluginConfig } from "../types.js";
30
+
31
+ // Machine-independent fixture paths: a temp dir is created in `before`
32
+ // with a real (executable) dummy binary and a path that never exists. This
33
+ // keeps the probe tests CI-portable (no hard-coded checkout path) and follows
34
+ // the synthetic-test-data-only policy.
35
+ let REPO_ROOT = "";
36
+ let EXISTING_FILE = "";
37
+ let MISSING_FILE = "";
38
+ let NON_EXECUTABLE_FILE = "";
39
+ let tempDir = "";
40
+
41
+ before(() => {
42
+ tempDir = mkdtempSync(path.join(tmpdir(), "structural-provider-"));
43
+ REPO_ROOT = tempDir;
44
+ EXISTING_FILE = path.join(tempDir, "existing-bin");
45
+ // Mode 0o755 so the POSIX executable-access probe reports available.
46
+ writeFileSync(EXISTING_FILE, "#!/bin/sh\necho ok\n", { mode: 0o755 });
47
+ MISSING_FILE = path.join(tempDir, "definitely-missing-bin");
48
+ // A regular file WITHOUT the executable bit — used to assert the probe
49
+ // rejects non-executable files on POSIX (P2 hardening).
50
+ NON_EXECUTABLE_FILE = path.join(tempDir, "non-executable-bin");
51
+ writeFileSync(NON_EXECUTABLE_FILE, "not executable", { mode: 0o644 });
52
+ });
53
+
54
+ after(() => {
55
+ try {
56
+ if (tempDir) rmSync(tempDir, { recursive: true, force: true });
57
+ } catch {
58
+ // best-effort cleanup
59
+ }
60
+ });
61
+
62
+ function configWith(
63
+ codingKnowledge: Partial<PluginConfig["codingKnowledge"]>,
64
+ ): PluginConfig {
65
+ return {
66
+ codingKnowledge: {
67
+ enabled: false,
68
+ decisionRecords: true,
69
+ architectureCard: true,
70
+ sessionDelta: true,
71
+ architectureCardLlmSummary: false,
72
+ structuralProvider: "none",
73
+ structuralProviderCommand: "",
74
+ codegraphTools: false,
75
+ codegraphDbDir: "",
76
+ ...codingKnowledge,
77
+ },
78
+ } as unknown as PluginConfig;
79
+ }
80
+
81
+ /** Build a fake spawn that responds based on the argv[0] subcommand map. */
82
+ function fakeSpawn(
83
+ responses: Record<string, () => { stdout: string; stderr: string }>,
84
+ ): StructuralSpawnFn & { calls: Array<{ argv: readonly string[] }> } {
85
+ const calls: Array<{ argv: readonly string[] }> = [];
86
+ const fn: StructuralSpawnFn = async (_cmd, argv, _opts) => {
87
+ calls.push({ argv });
88
+ const sub = argv[0] ?? "";
89
+ const responder = responses[sub];
90
+ if (!responder) {
91
+ throw new Error(`spawn: unknown subcommand ${sub}`);
92
+ }
93
+ return responder();
94
+ };
95
+ return Object.assign(fn, { calls });
96
+ }
97
+
98
+ // ──────────────────────────────────────────────────────────────────────────
99
+ // Probe — cached once per instance (rule 11)
100
+ // ──────────────────────────────────────────────────────────────────────────
101
+
102
+ test("probe: missing binary → unavailable, detail names the path", async () => {
103
+ const provider = createSubprocessStructuralProvider({ command: MISSING_FILE });
104
+ const probe = await provider.probe();
105
+ assert.equal(probe.available, false);
106
+ assert.match(probe.detail ?? "", /binary not found/);
107
+ });
108
+
109
+ test("probe: existing file → available", async () => {
110
+ const provider = createSubprocessStructuralProvider({ command: EXISTING_FILE });
111
+ const probe = await provider.probe();
112
+ assert.equal(probe.available, true);
113
+ });
114
+
115
+ test("probe: empty command → unavailable, cached", async () => {
116
+ const provider = createSubprocessStructuralProvider({ command: "" });
117
+ const first = await provider.probe();
118
+ const second = await provider.probe();
119
+ assert.equal(first.available, false);
120
+ assert.match(first.detail ?? "", /empty/);
121
+ assert.equal(second, first, "probe result must be cached (same object reference)");
122
+ });
123
+
124
+ test("probe: statSync failure is swallowed (never throws)", async () => {
125
+ const provider = createSubprocessStructuralProvider({ command: "/proc/this/does/not/exist/ anywhere" });
126
+ const probe = await provider.probe();
127
+ assert.equal(probe.available, false);
128
+ });
129
+
130
+ // Skip the executable-bit assertion on Windows (Node X_OK is always true there).
131
+ const execCheckTest = process.platform === "win32" ? test.skip : test;
132
+ execCheckTest("probe: non-executable regular file → unavailable (P2 hardening, POSIX only)", async () => {
133
+ const provider = createSubprocessStructuralProvider({ command: NON_EXECUTABLE_FILE });
134
+ const probe = await provider.probe();
135
+ assert.equal(probe.available, false);
136
+ assert.match(probe.detail ?? "", /not executable/);
137
+ });
138
+
139
+ test("probe: tilde-prefixed command is expanded (rule 17)", async () => {
140
+ // A tilde path pointing at the existing fixture must resolve after
141
+ // expansion. We point HOME at the temp dir so ~/existing-bin resolves.
142
+ const previousHome = process.env.HOME;
143
+ process.env.HOME = tempDir;
144
+ try {
145
+ const provider = createSubprocessStructuralProvider({ command: "~/existing-bin" });
146
+ const probe = await provider.probe();
147
+ assert.equal(probe.available, true, "tilde must expand so the probe finds the binary");
148
+ } finally {
149
+ process.env.HOME = previousHome;
150
+ }
151
+ });
152
+
153
+ // ──────────────────────────────────────────────────────────────────────────
154
+ // symbolsForDiff — 4-state matrix (issue PR 5 acceptance)
155
+ // ──────────────────────────────────────────────────────────────────────────
156
+
157
+ test("symbolsForDiff (a): unavailable binary → provider_unavailable, never throws", async () => {
158
+ const spawn = fakeSpawn({});
159
+ const provider = createSubprocessStructuralProvider({
160
+ command: MISSING_FILE,
161
+ spawn,
162
+ });
163
+ const result = await provider.symbolsForDiff("diff --git a/f b/f");
164
+ assert.equal(result.ok, false);
165
+ if (!result.ok) {
166
+ assert.equal(result.code, "provider_unavailable");
167
+ assert.match(result.detail ?? "", /binary not found/);
168
+ }
169
+ assert.equal(spawn.calls.length, 0, "spawn must not be called when probe fails");
170
+ });
171
+
172
+ test("symbolsForDiff (b): provider returns symbols → ok with parsed symbols", async () => {
173
+ const spawn = fakeSpawn({
174
+ "symbols-for-diff": () => ({
175
+ stdout: JSON.stringify({
176
+ symbols: [
177
+ { symbol: "AuthService.login", path: "src/auth.ts", kind: "method" },
178
+ { symbol: "validateToken", path: "src/auth.ts" },
179
+ ],
180
+ }),
181
+ stderr: "",
182
+ }),
183
+ });
184
+ const provider = createSubprocessStructuralProvider({
185
+ command: EXISTING_FILE,
186
+ spawn,
187
+ });
188
+ const result = await provider.symbolsForDiff("diff --git a/src/auth.ts b/src/auth.ts");
189
+ assert.equal(result.ok, true);
190
+ if (result.ok) {
191
+ assert.equal(result.symbols.length, 2);
192
+ assert.equal(result.symbols[0]!.symbol, "AuthService.login");
193
+ assert.equal(result.symbols[0]!.kind, "method");
194
+ assert.equal(result.symbols[1]!.path, "src/auth.ts");
195
+ }
196
+ });
197
+
198
+ test("symbolsForDiff (c): provider times out → provider_timeout", async () => {
199
+ const spawn = fakeSpawn({
200
+ "symbols-for-diff": () => {
201
+ throw new Error("Command timed out after 5000ms (ETIMEDOUT)");
202
+ },
203
+ });
204
+ const provider = createSubprocessStructuralProvider({
205
+ command: EXISTING_FILE,
206
+ spawn,
207
+ });
208
+ const result = await provider.symbolsForDiff("diff --git a/f b/f");
209
+ assert.equal(result.ok, false);
210
+ if (!result.ok) {
211
+ assert.equal(result.code, "provider_timeout");
212
+ }
213
+ });
214
+
215
+ test("symbolsForDiff (d): malformed JSON → provider_malformed", async () => {
216
+ const spawn = fakeSpawn({
217
+ "symbols-for-diff": () => ({ stdout: "not json {{{", stderr: "" }),
218
+ });
219
+ const provider = createSubprocessStructuralProvider({
220
+ command: EXISTING_FILE,
221
+ spawn,
222
+ });
223
+ const result = await provider.symbolsForDiff("diff --git a/f b/f");
224
+ assert.equal(result.ok, false);
225
+ if (!result.ok) {
226
+ assert.equal(result.code, "provider_malformed");
227
+ }
228
+ });
229
+
230
+ test("symbolsForDiff: object-but-no-symbols-array → provider_malformed", async () => {
231
+ const spawn = fakeSpawn({
232
+ "symbols-for-diff": () => ({ stdout: JSON.stringify({ oops: 1 }), stderr: "" }),
233
+ });
234
+ const provider = createSubprocessStructuralProvider({
235
+ command: EXISTING_FILE,
236
+ spawn,
237
+ });
238
+ const result = await provider.symbolsForDiff("diff");
239
+ assert.equal(result.ok, false);
240
+ if (!result.ok) assert.equal(result.code, "provider_malformed");
241
+ });
242
+
243
+ test("symbolsForDiff: null/array/primitive output → provider_malformed (rule 18)", async () => {
244
+ for (const bad of ["null", "[]", "42", '"a-string"']) {
245
+ const spawn = fakeSpawn({
246
+ "symbols-for-diff": () => ({ stdout: bad, stderr: "" }),
247
+ });
248
+ const provider = createSubprocessStructuralProvider({
249
+ command: EXISTING_FILE,
250
+ spawn,
251
+ });
252
+ const result = await provider.symbolsForDiff("diff");
253
+ assert.equal(result.ok, false, `expected malformed for ${bad}`);
254
+ if (!result.ok) assert.equal(result.code, "provider_malformed");
255
+ }
256
+ });
257
+
258
+ test("symbolsForDiff: symbols with missing/empty symbol name are skipped, not fatal", async () => {
259
+ const spawn = fakeSpawn({
260
+ "symbols-for-diff": () => ({
261
+ stdout: JSON.stringify({
262
+ symbols: [
263
+ { symbol: " " },
264
+ { path: "x.ts" },
265
+ { symbol: "Good", kind: "function" },
266
+ null,
267
+ "not-an-object",
268
+ ],
269
+ }),
270
+ stderr: "",
271
+ }),
272
+ });
273
+ const provider = createSubprocessStructuralProvider({
274
+ command: EXISTING_FILE,
275
+ spawn,
276
+ });
277
+ const result = await provider.symbolsForDiff("diff");
278
+ assert.equal(result.ok, true);
279
+ if (result.ok) {
280
+ assert.equal(result.symbols.length, 1);
281
+ assert.equal(result.symbols[0]!.symbol, "Good");
282
+ }
283
+ });
284
+
285
+ test("symbolsForDiff: non-timeout spawn error → provider_error", async () => {
286
+ const spawn = fakeSpawn({
287
+ "symbols-for-diff": () => {
288
+ throw new Error("non-zero exit code 2");
289
+ },
290
+ });
291
+ const provider = createSubprocessStructuralProvider({
292
+ command: EXISTING_FILE,
293
+ spawn,
294
+ });
295
+ const result = await provider.symbolsForDiff("diff");
296
+ assert.equal(result.ok, false);
297
+ if (!result.ok) assert.equal(result.code, "provider_error");
298
+ });
299
+
300
+ test("symbolsForDiff: argv is an array with subcommand + json payload (rule 10)", async () => {
301
+ const spawn = fakeSpawn({
302
+ "symbols-for-diff": () => ({
303
+ stdout: JSON.stringify({ symbols: [] }),
304
+ stderr: "",
305
+ }),
306
+ });
307
+ const provider = createSubprocessStructuralProvider({
308
+ command: EXISTING_FILE,
309
+ spawn,
310
+ });
311
+ await provider.symbolsForDiff("diff --git a/x b/x");
312
+ assert.equal(spawn.calls.length, 1);
313
+ const argv = spawn.calls[0]!.argv;
314
+ assert.equal(argv[0], "symbols-for-diff");
315
+ const payload = JSON.parse(argv[1]!);
316
+ assert.equal(payload.diff, "diff --git a/x b/x");
317
+ });
318
+
319
+ test("symbolsForDiff: extra args are appended after the payload", async () => {
320
+ const spawn = fakeSpawn({
321
+ "symbols-for-diff": () => ({
322
+ stdout: JSON.stringify({ symbols: [] }),
323
+ stderr: "",
324
+ }),
325
+ });
326
+ const provider = createSubprocessStructuralProvider({
327
+ command: EXISTING_FILE,
328
+ args: ["--format", "json"],
329
+ spawn,
330
+ });
331
+ await provider.symbolsForDiff("diff");
332
+ const argv = spawn.calls[0]!.argv;
333
+ assert.deepEqual([...argv].slice(2), ["--format", "json"]);
334
+ });
335
+
336
+ // ──────────────────────────────────────────────────────────────────────────
337
+ // architectureHints (optional) — same matrix, lighter
338
+ // ──────────────────────────────────────────────────────────────────────────
339
+
340
+ test("architectureHints: returns hints array on success", async () => {
341
+ const spawn = fakeSpawn({
342
+ "architecture-hints": () => ({
343
+ stdout: JSON.stringify(["layered architecture", "sqlite-first"]),
344
+ stderr: "",
345
+ }),
346
+ });
347
+ const provider = createSubprocessStructuralProvider({
348
+ command: EXISTING_FILE,
349
+ spawn,
350
+ });
351
+ const result = await provider.architectureHints?.(REPO_ROOT);
352
+ assert.ok(result);
353
+ assert.equal(result!.ok, true);
354
+ if (result!.ok) assert.equal(result!.hints.length, 2);
355
+ });
356
+
357
+ test("architectureHints: malformed (non-array) → provider_malformed", async () => {
358
+ const spawn = fakeSpawn({
359
+ "architecture-hints": () => ({ stdout: JSON.stringify({ not: "array" }), stderr: "" }),
360
+ });
361
+ const provider = createSubprocessStructuralProvider({
362
+ command: EXISTING_FILE,
363
+ spawn,
364
+ });
365
+ const result = await provider.architectureHints?.(REPO_ROOT);
366
+ assert.ok(result);
367
+ assert.equal(result!.ok, false);
368
+ if (!result!.ok) assert.equal(result!.code, "provider_malformed");
369
+ });
370
+
371
+ // ──────────────────────────────────────────────────────────────────────────
372
+ // close() resets the probe cache
373
+ // ──────────────────────────────────────────────────────────────────────────
374
+
375
+ test("close: resets probe cache so the next probe re-checks", async () => {
376
+ const provider = createSubprocessStructuralProvider({ command: EXISTING_FILE });
377
+ const first = await provider.probe();
378
+ assert.equal(first.available, true);
379
+ provider.close?.();
380
+ const second = await provider.probe();
381
+ assert.notEqual(second, first, "close() must invalidate the cached probe");
382
+ });
383
+
384
+ // ──────────────────────────────────────────────────────────────────────────
385
+ // probeStructuralProviderForDoctor (config → live probe)
386
+ // ──────────────────────────────────────────────────────────────────────────
387
+
388
+ test("doctor probe: inactive config returns inactive status, no probe", async () => {
389
+ const status = await probeStructuralProviderForDoctor(configWith({}));
390
+ assert.equal(status.active, false);
391
+ assert.equal(status.probed, undefined);
392
+ });
393
+
394
+ test("doctor probe: subprocess with missing binary → probed unavailable", async () => {
395
+ const status = await probeStructuralProviderForDoctor(
396
+ configWith({
397
+ enabled: true,
398
+ structuralProvider: "subprocess",
399
+ structuralProviderCommand: MISSING_FILE,
400
+ }),
401
+ );
402
+ assert.equal(status.active, true);
403
+ assert.equal(status.mode, "subprocess");
404
+ assert.equal(status.probed?.available, false);
405
+ assert.match(status.probed?.detail ?? "", /binary not found/);
406
+ });
407
+
408
+ test("doctor probe: subprocess with empty command → probed unavailable (empty)", async () => {
409
+ const status = await probeStructuralProviderForDoctor(
410
+ configWith({
411
+ enabled: true,
412
+ structuralProvider: "subprocess",
413
+ structuralProviderCommand: "",
414
+ }),
415
+ );
416
+ assert.equal(status.probed?.available, false);
417
+ assert.match(status.probed?.detail ?? "", /empty/);
418
+ });
419
+
420
+ test("doctor probe: subprocess with existing file → probed available", async () => {
421
+ const status = await probeStructuralProviderForDoctor(
422
+ configWith({
423
+ enabled: true,
424
+ structuralProvider: "subprocess",
425
+ structuralProviderCommand: EXISTING_FILE,
426
+ }),
427
+ );
428
+ assert.equal(status.probed?.available, true);
429
+ });
430
+