@remnic/core 10.0.135 → 10.0.137

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 (295) hide show
  1. package/dist/access-admin-ops-surface.js +152 -152
  2. package/dist/access-cli.js +152 -152
  3. package/dist/access-extraction-force-flush-preempt.d.ts +11 -0
  4. package/dist/access-extraction-force-flush-preempt.d.ts.map +1 -0
  5. package/dist/access-extraction-force-flush-preempt.js +576 -0
  6. package/dist/access-extraction-force-flush.js +152 -152
  7. package/dist/access-http-briefing.js +152 -152
  8. package/dist/access-http-query.js +152 -152
  9. package/dist/access-http.js +152 -152
  10. package/dist/access-identity-continuity-surface.js +152 -152
  11. package/dist/access-lcm-surface.js +152 -152
  12. package/dist/access-mcp.js +152 -152
  13. package/dist/access-observe-write-category.js +10 -10
  14. package/dist/access-observe-write-surface.d.ts.map +1 -1
  15. package/dist/access-observe-write-surface.js +152 -152
  16. package/dist/access-offline-manifest.js +15 -15
  17. package/dist/access-operations-batch.js +152 -152
  18. package/dist/access-operations.js +152 -152
  19. package/dist/access-recall-concurrency.js +152 -152
  20. package/dist/access-recall-diagnostics.js +8 -8
  21. package/dist/access-recall-response.js +152 -152
  22. package/dist/access-recall-surface.js +152 -152
  23. package/dist/access-schema.js +9 -9
  24. package/dist/access-service.js +152 -152
  25. package/dist/access-surface-catalog.js +4 -4
  26. package/dist/active-memory-bridge.js +7 -7
  27. package/dist/active-recall.js +31 -31
  28. package/dist/{auto-sync-BO5YZKM6.js → auto-sync-PSZJHHXB.js} +5 -5
  29. package/dist/briefing.js +21 -21
  30. package/dist/buffer.js +10 -10
  31. package/dist/calibration.js +3 -3
  32. package/dist/causal-consolidation.js +22 -22
  33. package/dist/{chunk-T4KY6UYF.js → chunk-274UY54Z.js} +2 -2
  34. package/dist/{chunk-3TVCG6ST.js → chunk-2DWTO7XP.js} +6 -6
  35. package/dist/{chunk-ZKYWI3N5.js → chunk-2LZHXBJM.js} +13 -13
  36. package/dist/{chunk-45BPRD6P.js → chunk-2SZWPNG4.js} +2 -2
  37. package/dist/{chunk-MEQPK3KG.js → chunk-3BRHOVRU.js} +3 -3
  38. package/dist/{chunk-HLWXCDUQ.js → chunk-3DAWHP5K.js} +5 -5
  39. package/dist/{chunk-7DWLU7GU.js → chunk-3F6COEHZ.js} +1 -1
  40. package/dist/chunk-3F6COEHZ.js.map +1 -0
  41. package/dist/{chunk-L2NXX7B7.js → chunk-3KOHTVQO.js} +6 -6
  42. package/dist/{chunk-KVCFAWBZ.js → chunk-3PZDG5ZH.js} +2 -2
  43. package/dist/{chunk-G2LJ6KVK.js → chunk-4HXJFMPS.js} +15 -15
  44. package/dist/chunk-4HXJFMPS.js.map +1 -0
  45. package/dist/{chunk-SS7CPYWD.js → chunk-4VL2H5Q3.js} +2 -2
  46. package/dist/{chunk-EVM7JM3U.js → chunk-4XPWHXEF.js} +2 -2
  47. package/dist/{chunk-PVCGXXQB.js → chunk-5K2UIHW4.js} +2 -2
  48. package/dist/{chunk-U5I2G4VU.js → chunk-5WZT6WQW.js} +4 -4
  49. package/dist/{chunk-TL6QIZT7.js → chunk-66MBMBSH.js} +2 -2
  50. package/dist/{chunk-KLUCX6OH.js → chunk-77SYM565.js} +14 -14
  51. package/dist/{chunk-MKXKED3B.js → chunk-7WIZNDR5.js} +2 -2
  52. package/dist/{chunk-Z4EIJ6CR.js → chunk-B7ZHJGPX.js} +20 -20
  53. package/dist/{chunk-GQ6MZ43R.js → chunk-D3CBHMMY.js} +9 -9
  54. package/dist/{chunk-VTL2NQED.js → chunk-DGKSCOB4.js} +6 -6
  55. package/dist/{chunk-3RW5ZCYO.js → chunk-DIBOWE53.js} +2 -2
  56. package/dist/{chunk-IDMIRW7C.js → chunk-DONY5FXC.js} +5 -5
  57. package/dist/{chunk-G5RFNMJ2.js → chunk-E3DXY24J.js} +3 -3
  58. package/dist/{chunk-QRZNVNNS.js → chunk-EEY326VH.js} +3 -3
  59. package/dist/{chunk-L7V55O3P.js → chunk-EFMAYZOB.js} +2 -2
  60. package/dist/{chunk-K4BSIADH.js → chunk-ET3RHBTM.js} +2 -2
  61. package/dist/{chunk-OIGJZHDU.js → chunk-EUL3S3LE.js} +7 -7
  62. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  63. package/dist/{chunk-DUTLMAUC.js → chunk-F4DXTUHY.js} +2 -2
  64. package/dist/{chunk-DK2VBJ6Q.js → chunk-FAPJG3OG.js} +4 -4
  65. package/dist/{chunk-M2XR6B6V.js → chunk-FEUWI5QH.js} +2 -2
  66. package/dist/{chunk-LAUZ3EQU.js → chunk-FIP6HDPC.js} +2 -2
  67. package/dist/{chunk-PWTXXSJ5.js → chunk-FJUCMMNT.js} +2 -2
  68. package/dist/{chunk-VO3HCFSR.js → chunk-GAVFANAB.js} +2 -2
  69. package/dist/{chunk-SPHBQTWE.js → chunk-GOYLBPSW.js} +3 -3
  70. package/dist/{chunk-5RPRVPZU.js → chunk-H2N65TDE.js} +2 -2
  71. package/dist/{chunk-SEQ3PEJ4.js → chunk-H3IOEMTW.js} +5 -5
  72. package/dist/{chunk-P76WH5JD.js → chunk-IM4XEI2C.js} +2 -2
  73. package/dist/{chunk-HA6V3CLH.js → chunk-JCWI43TO.js} +2 -2
  74. package/dist/{chunk-6IPTMGLJ.js → chunk-K4EBUTPN.js} +3 -3
  75. package/dist/{chunk-45GDXYAW.js → chunk-KYY7NODE.js} +21 -21
  76. package/dist/{chunk-AHA5VQGP.js → chunk-LEII44QG.js} +4 -4
  77. package/dist/{chunk-H37DI6HW.js → chunk-LKJVCDVS.js} +2 -2
  78. package/dist/{chunk-IE3KZVCC.js → chunk-N7HF7C4N.js} +6 -6
  79. package/dist/{chunk-J6U6KUMK.js → chunk-N7IJEGSE.js} +2 -2
  80. package/dist/{chunk-FEAIHXCI.js → chunk-O6NONCRR.js} +9 -9
  81. package/dist/{chunk-C2KE5DMD.js → chunk-O6ZSWHVR.js} +4 -4
  82. package/dist/{chunk-C73N66PR.js → chunk-OBPOIZNR.js} +2 -2
  83. package/dist/{chunk-TSJQ7C2T.js → chunk-OFMK76LD.js} +16 -16
  84. package/dist/{chunk-CLVILSBR.js → chunk-OZNBZJ3S.js} +22 -22
  85. package/dist/{chunk-KW3FFIIG.js → chunk-P3TQ62XC.js} +344 -307
  86. package/dist/chunk-P3TQ62XC.js.map +1 -0
  87. package/dist/{chunk-JDY34KBL.js → chunk-QUMKDRCF.js} +4 -4
  88. package/dist/{chunk-7OX7U2XB.js → chunk-QYUYM7XE.js} +4 -4
  89. package/dist/{chunk-MWDMUMQ6.js → chunk-S57YMPLX.js} +2 -2
  90. package/dist/{chunk-V6JECHY6.js → chunk-SBRUTD5O.js} +6 -6
  91. package/dist/{chunk-PK7IEAQB.js → chunk-SDRF2WLZ.js} +2 -2
  92. package/dist/{chunk-IP25A6HJ.js → chunk-SMMRDLLU.js} +16 -16
  93. package/dist/{chunk-BTY6DUFW.js → chunk-SU63UQPL.js} +7 -7
  94. package/dist/{chunk-TVDJEUV5.js → chunk-SX4BR26Y.js} +2 -2
  95. package/dist/{chunk-OIG4ZFMB.js → chunk-SZK2DX5U.js} +5 -5
  96. package/dist/{chunk-5BE3FLKL.js → chunk-TAUHAP5J.js} +4 -4
  97. package/dist/{chunk-KRMAIJMP.js → chunk-TDPBSVFW.js} +3 -3
  98. package/dist/{chunk-NS7U4ZYU.js → chunk-TSUSHXBW.js} +2 -2
  99. package/dist/{chunk-YMFPFXEX.js → chunk-TYOS62PM.js} +5 -5
  100. package/dist/{chunk-BFDXJHYG.js → chunk-U3GJUARA.js} +2 -2
  101. package/dist/{chunk-ETDVI7JS.js → chunk-UBSN42MM.js} +3 -3
  102. package/dist/{chunk-P3WRNWWM.js → chunk-UPE7TJWN.js} +2 -2
  103. package/dist/{chunk-FASAQQF7.js → chunk-V4HY4PEF.js} +2 -2
  104. package/dist/{chunk-VY3DHUL7.js → chunk-VRWQUUZ7.js} +8 -8
  105. package/dist/{chunk-MFPPRA4F.js → chunk-W4VZ52B3.js} +3 -3
  106. package/dist/{chunk-AGDPIO6J.js → chunk-WS2X4WHX.js} +2 -2
  107. package/dist/{chunk-P4G6C7XS.js → chunk-X4V5BBI2.js} +2 -2
  108. package/dist/{chunk-K2VRKCPA.js → chunk-XBW7U7GM.js} +4 -4
  109. package/dist/{chunk-UA2NDTIU.js → chunk-YAVIBVCU.js} +4 -4
  110. package/dist/{chunk-XMT27576.js → chunk-YDAAGCM5.js} +3 -3
  111. package/dist/{chunk-JGM3OWPQ.js → chunk-YMNFHNZH.js} +2 -2
  112. package/dist/{chunk-DJ7WVEWX.js → chunk-YVXM5QFL.js} +2 -2
  113. package/dist/{chunk-FMFCQRDM.js → chunk-ZANNIXXE.js} +3 -3
  114. package/dist/{chunk-OJXK5C6Z.js → chunk-ZG4GNPRE.js} +7 -7
  115. package/dist/{chunk-B3DR2JBZ.js → chunk-ZZYJNT2J.js} +4 -4
  116. package/dist/cli.js +152 -152
  117. package/dist/coding/export-okf-codegraph.js +20 -20
  118. package/dist/compounding/engine.js +22 -22
  119. package/dist/config.d.ts.map +1 -1
  120. package/dist/config.js +31 -31
  121. package/dist/connectors/codex-materialize-runner.js +21 -21
  122. package/dist/connectors/index.js +23 -23
  123. package/dist/contradiction/index.js +12 -12
  124. package/dist/{contradiction-scan-IBPYGQZF.js → contradiction-scan-DTQFAW22.js} +6 -6
  125. package/dist/convergence-refresh.js +22 -22
  126. package/dist/corpus-watermark.js +23 -23
  127. package/dist/dashboard-runtime.js +2 -2
  128. package/dist/deep-recall-http-glue.js +10 -10
  129. package/dist/embedding-fallback.js +2 -2
  130. package/dist/entity-retrieval.js +20 -20
  131. package/dist/event-order-recall.js +2 -2
  132. package/dist/explicit-capture.js +152 -152
  133. package/dist/extraction-normalization.js +1 -1
  134. package/dist/extraction.js +32 -32
  135. package/dist/{first-start-migration-FILJH3RO.js → first-start-migration-BPVJ4HJQ.js} +8 -8
  136. package/dist/graph-edge-decay-EKWXRBWF.js +1 -1
  137. package/dist/harmonic-retrieval.js +20 -20
  138. package/dist/index.js +291 -291
  139. package/dist/lcm/engine.js +3 -3
  140. package/dist/lcm/index.js +8 -8
  141. package/dist/local-llm-config.js +2 -2
  142. package/dist/location/index.js +23 -23
  143. package/dist/maintenance/memory-governance.js +20 -20
  144. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +20 -20
  145. package/dist/maintenance/rebuild-memory-projection-runner.js +22 -22
  146. package/dist/maintenance/rebuild-memory-projection.js +21 -21
  147. package/dist/memory-browse.js +9 -9
  148. package/dist/namespaces/migrate.js +22 -22
  149. package/dist/namespaces/search.js +4 -4
  150. package/dist/namespaces/storage.js +21 -21
  151. package/dist/offline-sync-changeset-generations.js +3 -3
  152. package/dist/offline-sync-embedding-generation.js +2 -2
  153. package/dist/offline-sync-impression-drain.js +3 -3
  154. package/dist/offline-sync-snapshot-stream.js +6 -6
  155. package/dist/offline-sync.js +5 -5
  156. package/dist/operator-doctor-corpus.js +24 -24
  157. package/dist/operator-toolkit.js +41 -41
  158. package/dist/orchestration/backlog-scheduler.js +153 -153
  159. package/dist/orchestration/buffer-drain-runner.js +153 -153
  160. package/dist/orchestration/extraction-queue-coordinator.d.ts +10 -0
  161. package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
  162. package/dist/orchestration/maintenance.js +34 -34
  163. package/dist/orchestrator.js +156 -156
  164. package/dist/qmd.js +4 -4
  165. package/dist/recall-explain-renderer.js +3 -3
  166. package/dist/recall-navigate-access.js +2 -2
  167. package/dist/recall-navigate-disclosure.js +2 -2
  168. package/dist/recall-navigate.js +2 -2
  169. package/dist/recall-navigation.js +152 -152
  170. package/dist/recall-state-view-admission.js +5 -5
  171. package/dist/recall-why-service.js +15 -15
  172. package/dist/recall-why.js +6 -6
  173. package/dist/recall-xray-cli.js +4 -4
  174. package/dist/recall-xray-renderer.js +3 -3
  175. package/dist/recall-xray.js +2 -2
  176. package/dist/reconcile/cursor.js +2 -2
  177. package/dist/reconcile/manifest.js +3 -3
  178. package/dist/reconcile/plan.js +2 -2
  179. package/dist/{resolution-G4SLHSEU.js → resolution-7XBNQVKU.js} +9 -9
  180. package/dist/resolution-7XBNQVKU.js.map +1 -0
  181. package/dist/resume-bundles.js +33 -33
  182. package/dist/search/factory.js +3 -3
  183. package/dist/search/index.js +3 -3
  184. package/dist/semantic-consolidation.js +22 -22
  185. package/dist/semantic-rule-promotion.js +20 -20
  186. package/dist/semantic-rule-verifier.js +20 -20
  187. package/dist/source-agent-qualifier.js +29 -29
  188. package/dist/standup/build.js +21 -21
  189. package/dist/storage.js +19 -19
  190. package/dist/summarizer.js +1 -1
  191. package/dist/support-passport/index.js +12 -12
  192. package/dist/tier-routing.js +4 -4
  193. package/dist/{tier-stats-FXEUJN73.js → tier-stats-FLFKN7Y6.js} +8 -8
  194. package/dist/transfer/export-okf.js +20 -20
  195. package/dist/types.d.ts +4 -7
  196. package/dist/types.d.ts.map +1 -1
  197. package/dist/types.js +1 -1
  198. package/dist/verified-recall.js +20 -20
  199. package/dist/who-knows-cli.js +21 -21
  200. package/dist/who-knows.js +20 -20
  201. package/package.json +2 -2
  202. package/src/access-extraction-force-flush-preempt-coordinator.test.ts +60 -0
  203. package/src/access-extraction-force-flush-preempt.test.ts +41 -0
  204. package/src/access-extraction-force-flush-preempt.ts +56 -0
  205. package/src/access-observe-write-surface.ts +2 -14
  206. package/src/access-serve-trust-principal-config.test.ts +270 -0
  207. package/src/access-trust-principal-header.test.ts +6 -4
  208. package/src/config.ts +6 -8
  209. package/src/orchestration/extraction-queue-coordinator.ts +23 -0
  210. package/src/types.ts +11 -8
  211. package/dist/chunk-7DWLU7GU.js.map +0 -1
  212. package/dist/chunk-G2LJ6KVK.js.map +0 -1
  213. package/dist/chunk-KW3FFIIG.js.map +0 -1
  214. /package/dist/{contradiction-scan-IBPYGQZF.js.map → access-extraction-force-flush-preempt.js.map} +0 -0
  215. /package/dist/{auto-sync-BO5YZKM6.js.map → auto-sync-PSZJHHXB.js.map} +0 -0
  216. /package/dist/{chunk-T4KY6UYF.js.map → chunk-274UY54Z.js.map} +0 -0
  217. /package/dist/{chunk-3TVCG6ST.js.map → chunk-2DWTO7XP.js.map} +0 -0
  218. /package/dist/{chunk-ZKYWI3N5.js.map → chunk-2LZHXBJM.js.map} +0 -0
  219. /package/dist/{chunk-45BPRD6P.js.map → chunk-2SZWPNG4.js.map} +0 -0
  220. /package/dist/{chunk-MEQPK3KG.js.map → chunk-3BRHOVRU.js.map} +0 -0
  221. /package/dist/{chunk-HLWXCDUQ.js.map → chunk-3DAWHP5K.js.map} +0 -0
  222. /package/dist/{chunk-L2NXX7B7.js.map → chunk-3KOHTVQO.js.map} +0 -0
  223. /package/dist/{chunk-KVCFAWBZ.js.map → chunk-3PZDG5ZH.js.map} +0 -0
  224. /package/dist/{chunk-SS7CPYWD.js.map → chunk-4VL2H5Q3.js.map} +0 -0
  225. /package/dist/{chunk-EVM7JM3U.js.map → chunk-4XPWHXEF.js.map} +0 -0
  226. /package/dist/{chunk-PVCGXXQB.js.map → chunk-5K2UIHW4.js.map} +0 -0
  227. /package/dist/{chunk-U5I2G4VU.js.map → chunk-5WZT6WQW.js.map} +0 -0
  228. /package/dist/{chunk-TL6QIZT7.js.map → chunk-66MBMBSH.js.map} +0 -0
  229. /package/dist/{chunk-KLUCX6OH.js.map → chunk-77SYM565.js.map} +0 -0
  230. /package/dist/{chunk-MKXKED3B.js.map → chunk-7WIZNDR5.js.map} +0 -0
  231. /package/dist/{chunk-Z4EIJ6CR.js.map → chunk-B7ZHJGPX.js.map} +0 -0
  232. /package/dist/{chunk-GQ6MZ43R.js.map → chunk-D3CBHMMY.js.map} +0 -0
  233. /package/dist/{chunk-VTL2NQED.js.map → chunk-DGKSCOB4.js.map} +0 -0
  234. /package/dist/{chunk-3RW5ZCYO.js.map → chunk-DIBOWE53.js.map} +0 -0
  235. /package/dist/{chunk-IDMIRW7C.js.map → chunk-DONY5FXC.js.map} +0 -0
  236. /package/dist/{chunk-G5RFNMJ2.js.map → chunk-E3DXY24J.js.map} +0 -0
  237. /package/dist/{chunk-QRZNVNNS.js.map → chunk-EEY326VH.js.map} +0 -0
  238. /package/dist/{chunk-L7V55O3P.js.map → chunk-EFMAYZOB.js.map} +0 -0
  239. /package/dist/{chunk-K4BSIADH.js.map → chunk-ET3RHBTM.js.map} +0 -0
  240. /package/dist/{chunk-OIGJZHDU.js.map → chunk-EUL3S3LE.js.map} +0 -0
  241. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  242. /package/dist/{chunk-DUTLMAUC.js.map → chunk-F4DXTUHY.js.map} +0 -0
  243. /package/dist/{chunk-DK2VBJ6Q.js.map → chunk-FAPJG3OG.js.map} +0 -0
  244. /package/dist/{chunk-M2XR6B6V.js.map → chunk-FEUWI5QH.js.map} +0 -0
  245. /package/dist/{chunk-LAUZ3EQU.js.map → chunk-FIP6HDPC.js.map} +0 -0
  246. /package/dist/{chunk-PWTXXSJ5.js.map → chunk-FJUCMMNT.js.map} +0 -0
  247. /package/dist/{chunk-VO3HCFSR.js.map → chunk-GAVFANAB.js.map} +0 -0
  248. /package/dist/{chunk-SPHBQTWE.js.map → chunk-GOYLBPSW.js.map} +0 -0
  249. /package/dist/{chunk-5RPRVPZU.js.map → chunk-H2N65TDE.js.map} +0 -0
  250. /package/dist/{chunk-SEQ3PEJ4.js.map → chunk-H3IOEMTW.js.map} +0 -0
  251. /package/dist/{chunk-P76WH5JD.js.map → chunk-IM4XEI2C.js.map} +0 -0
  252. /package/dist/{chunk-HA6V3CLH.js.map → chunk-JCWI43TO.js.map} +0 -0
  253. /package/dist/{chunk-6IPTMGLJ.js.map → chunk-K4EBUTPN.js.map} +0 -0
  254. /package/dist/{chunk-45GDXYAW.js.map → chunk-KYY7NODE.js.map} +0 -0
  255. /package/dist/{chunk-AHA5VQGP.js.map → chunk-LEII44QG.js.map} +0 -0
  256. /package/dist/{chunk-H37DI6HW.js.map → chunk-LKJVCDVS.js.map} +0 -0
  257. /package/dist/{chunk-IE3KZVCC.js.map → chunk-N7HF7C4N.js.map} +0 -0
  258. /package/dist/{chunk-J6U6KUMK.js.map → chunk-N7IJEGSE.js.map} +0 -0
  259. /package/dist/{chunk-FEAIHXCI.js.map → chunk-O6NONCRR.js.map} +0 -0
  260. /package/dist/{chunk-C2KE5DMD.js.map → chunk-O6ZSWHVR.js.map} +0 -0
  261. /package/dist/{chunk-C73N66PR.js.map → chunk-OBPOIZNR.js.map} +0 -0
  262. /package/dist/{chunk-TSJQ7C2T.js.map → chunk-OFMK76LD.js.map} +0 -0
  263. /package/dist/{chunk-CLVILSBR.js.map → chunk-OZNBZJ3S.js.map} +0 -0
  264. /package/dist/{chunk-JDY34KBL.js.map → chunk-QUMKDRCF.js.map} +0 -0
  265. /package/dist/{chunk-7OX7U2XB.js.map → chunk-QYUYM7XE.js.map} +0 -0
  266. /package/dist/{chunk-MWDMUMQ6.js.map → chunk-S57YMPLX.js.map} +0 -0
  267. /package/dist/{chunk-V6JECHY6.js.map → chunk-SBRUTD5O.js.map} +0 -0
  268. /package/dist/{chunk-PK7IEAQB.js.map → chunk-SDRF2WLZ.js.map} +0 -0
  269. /package/dist/{chunk-IP25A6HJ.js.map → chunk-SMMRDLLU.js.map} +0 -0
  270. /package/dist/{chunk-BTY6DUFW.js.map → chunk-SU63UQPL.js.map} +0 -0
  271. /package/dist/{chunk-TVDJEUV5.js.map → chunk-SX4BR26Y.js.map} +0 -0
  272. /package/dist/{chunk-OIG4ZFMB.js.map → chunk-SZK2DX5U.js.map} +0 -0
  273. /package/dist/{chunk-5BE3FLKL.js.map → chunk-TAUHAP5J.js.map} +0 -0
  274. /package/dist/{chunk-KRMAIJMP.js.map → chunk-TDPBSVFW.js.map} +0 -0
  275. /package/dist/{chunk-NS7U4ZYU.js.map → chunk-TSUSHXBW.js.map} +0 -0
  276. /package/dist/{chunk-YMFPFXEX.js.map → chunk-TYOS62PM.js.map} +0 -0
  277. /package/dist/{chunk-BFDXJHYG.js.map → chunk-U3GJUARA.js.map} +0 -0
  278. /package/dist/{chunk-ETDVI7JS.js.map → chunk-UBSN42MM.js.map} +0 -0
  279. /package/dist/{chunk-P3WRNWWM.js.map → chunk-UPE7TJWN.js.map} +0 -0
  280. /package/dist/{chunk-FASAQQF7.js.map → chunk-V4HY4PEF.js.map} +0 -0
  281. /package/dist/{chunk-VY3DHUL7.js.map → chunk-VRWQUUZ7.js.map} +0 -0
  282. /package/dist/{chunk-MFPPRA4F.js.map → chunk-W4VZ52B3.js.map} +0 -0
  283. /package/dist/{chunk-AGDPIO6J.js.map → chunk-WS2X4WHX.js.map} +0 -0
  284. /package/dist/{chunk-P4G6C7XS.js.map → chunk-X4V5BBI2.js.map} +0 -0
  285. /package/dist/{chunk-K2VRKCPA.js.map → chunk-XBW7U7GM.js.map} +0 -0
  286. /package/dist/{chunk-UA2NDTIU.js.map → chunk-YAVIBVCU.js.map} +0 -0
  287. /package/dist/{chunk-XMT27576.js.map → chunk-YDAAGCM5.js.map} +0 -0
  288. /package/dist/{chunk-JGM3OWPQ.js.map → chunk-YMNFHNZH.js.map} +0 -0
  289. /package/dist/{chunk-DJ7WVEWX.js.map → chunk-YVXM5QFL.js.map} +0 -0
  290. /package/dist/{chunk-FMFCQRDM.js.map → chunk-ZANNIXXE.js.map} +0 -0
  291. /package/dist/{chunk-OJXK5C6Z.js.map → chunk-ZG4GNPRE.js.map} +0 -0
  292. /package/dist/{chunk-B3DR2JBZ.js.map → chunk-ZZYJNT2J.js.map} +0 -0
  293. /package/dist/{resolution-G4SLHSEU.js.map → contradiction-scan-DTQFAW22.js.map} +0 -0
  294. /package/dist/{first-start-migration-FILJH3RO.js.map → first-start-migration-BPVJ4HJQ.js.map} +0 -0
  295. /package/dist/{tier-stats-FXEUJN73.js.map → tier-stats-FLFKN7Y6.js.map} +0 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Keyed force-flush preemption must abort ONLY the armed slot matching the
3
+ * caller's session key.
4
+ *
5
+ * Follow-up to the caller-key forwarding: `preemptRunning(preferredKey?)`
6
+ * falls back to the newest armed slot whenever no key-matched slot is armed,
7
+ * so a force-flush whose own extraction is not (yet) armed still killed an
8
+ * unrelated background task - the exact failure PR #3468 reports. The
9
+ * coordinator therefore gains `preemptKeyed(key)`: abort every armed slot
10
+ * whose key matches, and abort nothing when none does. `preemptRunning`
11
+ * keeps its newest-slot fallback for the keyless call sites (front-enqueue
12
+ * flush path).
13
+ */
14
+ import assert from "node:assert/strict";
15
+ import test from "node:test";
16
+ import { ExtractionQueueCoordinator } from "./orchestration/extraction-queue-coordinator.js";
17
+
18
+ interface Capture {
19
+ key: string;
20
+ aborted: string[];
21
+ }
22
+
23
+ function captureSlot(
24
+ coordinator: ExtractionQueueCoordinator,
25
+ capture: Capture,
26
+ key: string,
27
+ ): void {
28
+ const slot = coordinator.registerPreemptSlot(key);
29
+ slot.arm(() => void capture.aborted.push(key));
30
+ }
31
+
32
+ test("preemptKeyed aborts only the armed slot with the matching key", () => {
33
+ const coordinator = new ExtractionQueueCoordinator();
34
+ const mine: Capture = { key: "sess-a", aborted: [] };
35
+ const other: Capture = { key: "sess-b", aborted: [] };
36
+ captureSlot(coordinator, mine, "sess-a");
37
+ captureSlot(coordinator, other, "sess-b");
38
+ coordinator.preemptKeyed("sess-a");
39
+ assert.deepEqual(mine.aborted, ["sess-a"]);
40
+ assert.deepEqual(other.aborted, []);
41
+ });
42
+
43
+ test("preemptKeyed aborts nothing when no armed slot matches", () => {
44
+ const coordinator = new ExtractionQueueCoordinator();
45
+ const other: Capture = { key: "sess-b", aborted: [] };
46
+ captureSlot(coordinator, other, "sess-b");
47
+ coordinator.preemptKeyed("sess-c");
48
+ assert.deepEqual(other.aborted, []);
49
+ });
50
+
51
+ test("preemptRunning keeps the newest-slot fallback for keyless calls", () => {
52
+ const coordinator = new ExtractionQueueCoordinator();
53
+ const first: Capture = { key: "sess-a", aborted: [] };
54
+ const second: Capture = { key: "sess-b", aborted: [] };
55
+ captureSlot(coordinator, first, "sess-a");
56
+ captureSlot(coordinator, second, "sess-b");
57
+ coordinator.preemptRunning();
58
+ assert.deepEqual(first.aborted, []);
59
+ assert.deepEqual(second.aborted, ["sess-b"]);
60
+ });
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The force-flush preemption callback must preempt the CALLER'S OWN session
3
+ * extraction slot, never an arbitrary newest-armed slot.
4
+ *
5
+ * `preemptRunning(preferredKey?)` already prefers a key-matched slot and only
6
+ * falls back to the newest armed slot when no key is given. The write surface
7
+ * passed no key, so every force-flush killed whichever background task armed
8
+ * last — typically the backlog scheduler's buffer drain — instead of the
9
+ * caller's own queued extraction. That turned each force-flush into collateral
10
+ * damage for the 8,972-turn extraction backlog (observed 2026-11-17: repeated
11
+ * `extraction preempted for force-flush` failures on unrelated sessions).
12
+ */
13
+ import assert from "node:assert/strict";
14
+ import test from "node:test";
15
+ import { forceFlushPreemptCallback } from "./access-extraction-force-flush-preempt.js";
16
+
17
+ test("forwards the caller session key as keyed-only preemption", () => {
18
+ const keyed: string[] = [];
19
+ const unkeyed: number[] = [];
20
+ const callback = forceFlushPreemptCallback("pi:session-a", {
21
+ preemptRunning: () => void unkeyed.push(1),
22
+ preemptKeyed: (key) => void keyed.push(key),
23
+ });
24
+ callback();
25
+ assert.deepEqual(keyed, ["pi:session-a"]);
26
+ assert.deepEqual(unkeyed, []);
27
+ });
28
+
29
+ test("falls back to newest-slot preemption when no session key is known", () => {
30
+ const unkeyed: number[] = [];
31
+ const callback = forceFlushPreemptCallback(undefined, {
32
+ preemptRunning: () => void unkeyed.push(1),
33
+ });
34
+ callback();
35
+ assert.deepEqual(unkeyed, [1]);
36
+ });
37
+
38
+ test("a missing coordinator is a no-op, not a throw", () => {
39
+ const callback = forceFlushPreemptCallback("pi:session-a", undefined);
40
+ assert.doesNotThrow(() => callback());
41
+ });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The force-flush preemption callback factory.
3
+ *
4
+ * A keyed force-flush must abort ONLY the armed slot matching the caller's
5
+ * session (`coordinator.preemptKeyed`) - `preemptRunning(preferredKey?)`
6
+ * falls back to the newest armed slot whenever no key-matched slot is armed,
7
+ * which killed unrelated background drains exactly when the caller's own
8
+ * extraction was not yet armed (the failure PR #3468 reports). The keyless
9
+ * call keeps `preemptRunning`'s newest-slot fallback, which the front-enqueue
10
+ * flush path relies on.
11
+ */
12
+ import { extractionForceFlush } from "./access-extraction-force-flush.js";
13
+ import type { AccessObserveWriteSurfaceDeps } from "./access-observe-write-surface.js";
14
+ import { PendingObserveExtractionTracker } from "./access-observe-helpers.js";
15
+ import type { EngramAccessExtractionForceFlushRequest, EngramAccessExtractionForceFlushResponse } from "./access-service.js";
16
+
17
+ export function forceFlushPreemptCallback(
18
+ sessionKey: string | undefined,
19
+ coordinator:
20
+ | {
21
+ preemptRunning?: (preferredKey?: string) => void;
22
+ preemptKeyed?: (key: string) => void;
23
+ }
24
+ | undefined,
25
+ ): () => void {
26
+ return () => {
27
+ if (sessionKey !== undefined) {
28
+ coordinator?.preemptKeyed?.(sessionKey);
29
+ return;
30
+ }
31
+ coordinator?.preemptRunning?.();
32
+ };
33
+ }
34
+
35
+ /** The force-flush call with the keyed preemption callback attached, so the
36
+ * write surface stays under the file-size ratchet (issue #1995). */
37
+ export function forceFlushPreemptCall(
38
+ deps: AccessObserveWriteSurfaceDeps,
39
+ request: EngramAccessExtractionForceFlushRequest,
40
+ pending: PendingObserveExtractionTracker,
41
+ ): Promise<EngramAccessExtractionForceFlushResponse> {
42
+ return extractionForceFlush(
43
+ deps,
44
+ request,
45
+ (sessionKey, principal, namespace, abortSignal, registerCancellation, scopeHint) =>
46
+ pending.wait(
47
+ sessionKey,
48
+ principal,
49
+ namespace,
50
+ abortSignal,
51
+ registerCancellation,
52
+ scopeHint,
53
+ forceFlushPreemptCallback(sessionKey, deps.orchestrator.extractionQueueCoordinator),
54
+ ),
55
+ );
56
+ }
@@ -33,6 +33,7 @@ import { buildWithBriefingLocation, reapplyCategoryCoercion, splitCanonicalWrite
33
33
  import { abortError } from "./abort-error.js";
34
34
  import { withBriefingDeadline } from "./briefing-deadline.js";
35
35
  import { extractionForceFlush } from "./access-extraction-force-flush.js";
36
+ import { forceFlushPreemptCall } from "./access-extraction-force-flush-preempt.js";
36
37
  import { ObserveTranscriptPersister, observeTranscriptSessionKey } from "./access-observe-transcript.js";
37
38
  import { createObserveStageTimer } from "./access-observe-stage-timing.js";
38
39
  import { archiveObservedTurns } from "./access-observe-lcm-archive.js";
@@ -932,20 +933,7 @@ export class AccessObserveWriteSurface {
932
933
  async extractionForceFlush(
933
934
  request: EngramAccessExtractionForceFlushRequest
934
935
  ): Promise<EngramAccessExtractionForceFlushResponse> {
935
- return extractionForceFlush(
936
- this.deps,
937
- request,
938
- (sessionKey, principal, namespace, abortSignal, registerCancellation, scopeHint) =>
939
- this.pendingObserveExtractions.wait(
940
- sessionKey,
941
- principal,
942
- namespace,
943
- abortSignal,
944
- registerCancellation,
945
- scopeHint,
946
- () => this.deps.orchestrator.extractionQueueCoordinator?.preemptRunning(),
947
- )
948
- );
936
+ return forceFlushPreemptCall(this.deps, request, this.pendingObserveExtractions);
949
937
  }
950
938
  async workTask(request: {
951
939
  action: "create" | "get" | "list" | "update" | "transition" | "delete";
@@ -0,0 +1,270 @@
1
+ /**
2
+ * `agentAccessHttp.trustPrincipalHeader` config path (issue #3462).
3
+ *
4
+ * The per-request principal header (`x-engram-principal`) was only reachable
5
+ * through the `--trust-principal-header` CLI flag; a fleet daemon started
6
+ * without the flag silently ignored pane-sent principals. This drives the
7
+ * registered `engram access http-serve` action (registerCli + recording
8
+ * program mock, as in cli-wearables-fuse.test.ts) against real namespace
9
+ * storage and asserts the precedence contract:
10
+ *
11
+ * - explicit `--trust-principal-header` flag wins,
12
+ * - absent flag falls back to `agentAccessHttp.trustPrincipalHeader` config,
13
+ * - both unset: header ignored (unchanged behavior),
14
+ * - parseConfig coerces bool-like strings and defaults to false.
15
+ */
16
+
17
+ import assert from "node:assert/strict";
18
+ import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
19
+ import os from "node:os";
20
+ import path from "node:path";
21
+ import test from "node:test";
22
+
23
+ import {
24
+ registerCli,
25
+ type CliApi,
26
+ type CliCommand,
27
+ type CliProgram,
28
+ } from "./cli.js";
29
+ import { parseConfig } from "./config.js";
30
+ import { NamespaceStorageRouter } from "./namespaces/storage.js";
31
+ import type { Orchestrator } from "./orchestrator.js";
32
+
33
+ /** Recording commander stand-in (same shape as cli-wearables-fuse.test.ts). */
34
+ class RecCmd implements CliCommand {
35
+ readonly children = new Map<string, RecCmd>();
36
+ readonly options: string[] = [];
37
+ readonly args: string[] = [];
38
+ actionFn?: (...args: unknown[]) => Promise<void> | void;
39
+ constructor(readonly rawName: string) {}
40
+ description(): CliCommand {
41
+ return this;
42
+ }
43
+ option(flags: string): CliCommand {
44
+ this.options.push(flags);
45
+ return this;
46
+ }
47
+ requiredOption(flags: string): CliCommand {
48
+ this.options.push(flags);
49
+ return this;
50
+ }
51
+ argument(name: string): CliCommand {
52
+ this.args.push(name);
53
+ return this;
54
+ }
55
+ action(fn: (...args: unknown[]) => Promise<void> | void): CliCommand {
56
+ this.actionFn = fn;
57
+ return this;
58
+ }
59
+ command(name: string): CliCommand {
60
+ const key = name.split(/\s+/)[0]!;
61
+ const child = new RecCmd(name);
62
+ this.children.set(key, child);
63
+ return child;
64
+ }
65
+ }
66
+
67
+ class RecProgram implements CliProgram {
68
+ readonly root = new RecCmd("__program__");
69
+ command(name: string): CliCommand {
70
+ return this.root.command(name);
71
+ }
72
+ }
73
+
74
+ const SERVE_TOKEN = "synthetic-serve-token";
75
+
76
+ /** CLI options shape commander hands the `engram access http-serve` action (flag values stay strings). */
77
+ interface ServeCliOptions {
78
+ host?: string;
79
+ port?: string;
80
+ token?: string;
81
+ trustPrincipalHeader?: boolean;
82
+ }
83
+
84
+ interface ServeFixture {
85
+ serve: (options: ServeCliOptions) => Promise<{ host: string; port: number }>;
86
+ stop: () => Promise<void>;
87
+ cleanup: () => Promise<void>;
88
+ }
89
+
90
+ interface EntityListBody {
91
+ entities?: Array<{ name?: string }>;
92
+ }
93
+
94
+ /** Config input for the fixture's access server; parseConfig accepts bool-like strings for the flag. */
95
+ interface FixtureAccessHttp {
96
+ principal: string;
97
+ trustPrincipalHeader?: boolean | string;
98
+ }
99
+
100
+ /**
101
+ * Entity reads need only config + real storage routing from the orchestrator
102
+ * (same Pick pattern as access-entity-principal.test.ts). The configured
103
+ * access principal is "reader", who may read `restricted` but NOT `default`;
104
+ * the header-supplied principal "owner" may read both — so a 200 on
105
+ * `namespace=default` proves the header principal was trusted.
106
+ */
107
+ async function createServeFixture(options: { trustPrincipalHeader?: boolean | string } = {}): Promise<ServeFixture> {
108
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-serve-trust-"));
109
+ const agentAccessHttp: FixtureAccessHttp = {
110
+ principal: "reader",
111
+ };
112
+ if (options.trustPrincipalHeader !== undefined) {
113
+ agentAccessHttp.trustPrincipalHeader = options.trustPrincipalHeader;
114
+ }
115
+ const config = parseConfig({
116
+ memoryDir,
117
+ namespacesEnabled: true,
118
+ defaultNamespace: "default",
119
+ namespacePolicies: [
120
+ { name: "default", readPrincipals: ["owner"], writePrincipals: ["owner"] },
121
+ { name: "restricted", readPrincipals: ["owner", "reader"], writePrincipals: ["owner"] },
122
+ ],
123
+ agentAccessHttp,
124
+ });
125
+ const router = new NamespaceStorageRouter(config);
126
+ for (const namespace of ["default", "restricted"]) {
127
+ const storage = await router.storageFor(namespace);
128
+ const entitiesDir = path.join(storage.dir, "entities");
129
+ await mkdir(entitiesDir, { recursive: true });
130
+ await writeFile(path.join(entitiesDir, "project-widget.md"), [
131
+ `# Widget-${namespace}`,
132
+ "",
133
+ "**Type:** project",
134
+ "",
135
+ "## Summary",
136
+ "",
137
+ `Synthetic entity in ${namespace}.`,
138
+ "",
139
+ ].join("\n"));
140
+ }
141
+
142
+ const dependencies: Pick<Orchestrator, "config" | "getStorage" | "initialize"> = {
143
+ config,
144
+ getStorage: (namespace?: string) => router.storageFor(namespace ?? config.defaultNamespace),
145
+ initialize: async () => {},
146
+ };
147
+
148
+ const program = new RecProgram();
149
+ const api: CliApi = {
150
+ registerCli: (handler) => handler({ program }),
151
+ };
152
+ // SAFETY: registerCli and the http-serve action touch only config, getStorage, and
153
+ // initialize on the orchestrator; each member is provided with its real shape.
154
+ registerCli(api, dependencies as Parameters<typeof registerCli>[1]);
155
+ const engram = program.root.children.get("engram");
156
+ const access = engram?.children.get("access");
157
+ const serveCmd = access?.children.get("http-serve");
158
+ const stopCmd = access?.children.get("http-stop");
159
+ assert.ok(serveCmd?.actionFn, "engram access http-serve registered an action");
160
+ assert.ok(stopCmd?.actionFn, "engram access http-stop registered an action");
161
+
162
+ const stop = async () => {
163
+ await stopCmd!.actionFn!({});
164
+ };
165
+
166
+ const serve = async (options: ServeCliOptions) => {
167
+ const logs: string[] = [];
168
+ const originalLog = console.log;
169
+ console.log = (...args: unknown[]) => {
170
+ logs.push(args.map(String).join(" "));
171
+ };
172
+ try {
173
+ await serveCmd!.actionFn!(options);
174
+ } finally {
175
+ console.log = originalLog;
176
+ }
177
+ const statusLine = logs.map((line) => line.trim()).find((line) => line.startsWith("{"));
178
+ assert.ok(statusLine, "http-serve printed its status JSON");
179
+ // SAFETY: http-serve prints the server.start() status JSON ({ running, host, port, ... });
180
+ // only running/host/port are read and each is asserted below.
181
+ const status = JSON.parse(statusLine) as { running?: boolean; host?: string; port?: number };
182
+ assert.equal(status.running, true);
183
+ assert.ok(Number.isInteger(status.port), "http-serve status carries an integer port");
184
+ return { host: status.host ?? "127.0.0.1", port: status.port! };
185
+ };
186
+
187
+ return { serve, stop, cleanup: () => rm(memoryDir, { recursive: true, force: true }) };
188
+ }
189
+
190
+ async function readDefaultNamespaceAsOwner(
191
+ fixture: ServeFixture,
192
+ serveOptions: ServeCliOptions,
193
+ ): Promise<Response> {
194
+ const { host, port } = await fixture.serve(serveOptions);
195
+ try {
196
+ return await fetch(`http://${host}:${port}/engram/v1/entities?namespace=default`, {
197
+ headers: {
198
+ authorization: "Bearer " + SERVE_TOKEN,
199
+ "x-engram-principal": "owner",
200
+ },
201
+ });
202
+ } finally {
203
+ await fixture.stop();
204
+ }
205
+ }
206
+
207
+ test("parseConfig defaults agentAccessHttp.trustPrincipalHeader to false and coerces bool-like strings", () => {
208
+ assert.equal(parseConfig({}).agentAccessHttp.trustPrincipalHeader, false);
209
+ assert.equal(parseConfig({ agentAccessHttp: {} }).agentAccessHttp.trustPrincipalHeader, false);
210
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: true } }).agentAccessHttp.trustPrincipalHeader, true);
211
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: false } }).agentAccessHttp.trustPrincipalHeader, false);
212
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: "true" } }).agentAccessHttp.trustPrincipalHeader, true);
213
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: "1" } }).agentAccessHttp.trustPrincipalHeader, true);
214
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: "false" } }).agentAccessHttp.trustPrincipalHeader, false);
215
+ assert.equal(parseConfig({ agentAccessHttp: { trustPrincipalHeader: "0" } }).agentAccessHttp.trustPrincipalHeader, false);
216
+ });
217
+
218
+ test("absent flag falls back to agentAccessHttp.trustPrincipalHeader config (issue #3462)", async () => {
219
+ const fixture = await createServeFixture({ trustPrincipalHeader: true });
220
+ try {
221
+ // NO --trust-principal-header flag: config alone must trust the header.
222
+ // reader cannot read `default`; the header principal "owner" can.
223
+ const response = await readDefaultNamespaceAsOwner(fixture, {
224
+ host: "127.0.0.1",
225
+ port: "0",
226
+ token: "synthetic-serve-token",
227
+ });
228
+ assert.equal(response.status, 200);
229
+ // SAFETY: a 200 from /engram/v1/entities carries the entity-list envelope; only entity names are read.
230
+ const body = (await response.json()) as EntityListBody;
231
+ assert.equal(body.entities?.[0]?.name, "Widget-default");
232
+ } finally {
233
+ await fixture.cleanup();
234
+ }
235
+ });
236
+
237
+ test("explicit --trust-principal-header flag wins over config", async () => {
238
+ const fixture = await createServeFixture();
239
+ try {
240
+ const response = await readDefaultNamespaceAsOwner(fixture, {
241
+ host: "127.0.0.1",
242
+ port: "0",
243
+ token: "synthetic-serve-token",
244
+ trustPrincipalHeader: true,
245
+ });
246
+ assert.equal(response.status, 200);
247
+ // SAFETY: a 200 from /engram/v1/entities carries the entity-list envelope; only entity names are read.
248
+ const body = (await response.json()) as EntityListBody;
249
+ assert.equal(body.entities?.[0]?.name, "Widget-default");
250
+ } finally {
251
+ await fixture.cleanup();
252
+ }
253
+ });
254
+
255
+ test("both unset: x-engram-principal header stays ignored", async () => {
256
+ const fixture = await createServeFixture();
257
+ try {
258
+ const response = await readDefaultNamespaceAsOwner(fixture, {
259
+ host: "127.0.0.1",
260
+ port: "0",
261
+ token: "synthetic-serve-token",
262
+ });
263
+ assert.equal(response.status, 400);
264
+ // SAFETY: an ACL refusal from the access server answers { error }; only the message is read.
265
+ const body = (await response.json()) as { error?: string };
266
+ assert.match(body.error ?? "", /not readable/);
267
+ } finally {
268
+ await fixture.cleanup();
269
+ }
270
+ });
@@ -33,16 +33,18 @@ function makeConfig(memoryDir: string, agentAccessHttp?: AgentAccessHttpRawOverr
33
33
  });
34
34
  }
35
35
 
36
- test("agentAccessHttp.trustPrincipalHeader defaults off and takes only explicit true", () => {
37
- for (const input of [undefined, false, "yes", 1, { trust: true }]) {
36
+ test("agentAccessHttp.trustPrincipalHeader defaults off and accepts bool-like strings", () => {
37
+ for (const input of [undefined, false, 1, { trust: true }, "garbage"]) {
38
38
  const parsed = makeConfig(
39
39
  "/tmp/remnic-tph-default",
40
40
  input === undefined ? {} : { trustPrincipalHeader: input },
41
41
  );
42
42
  assert.equal(parsed.agentAccessHttp.trustPrincipalHeader, false, `input ${String(input)}`);
43
43
  }
44
- const trusted = makeConfig("/tmp/remnic-tph-on", { trustPrincipalHeader: true });
45
- assert.equal(trusted.agentAccessHttp.trustPrincipalHeader, true);
44
+ for (const input of [true, "yes", "1", "on"]) {
45
+ const parsed = makeConfig("/tmp/remnic-tph-on", { trustPrincipalHeader: input });
46
+ assert.equal(parsed.agentAccessHttp.trustPrincipalHeader, true, `input ${String(input)}`);
47
+ }
46
48
  });
47
49
 
48
50
  /** One timings-probe server per flag value; the route 200s for the operator principal and 403s otherwise. */
package/src/config.ts CHANGED
@@ -435,13 +435,11 @@ function isSecretRefShape(value: unknown): value is import("./types.js").SecretR
435
435
  }
436
436
 
437
437
  /**
438
- * Parse the `agentAccessHttp.authToken` field. Accepts:
439
- * - `string` → env-expanded immediately (current behavior preserved)
440
- * - `SecretRef` object (`{source, ...}`) → preserved verbatim for runtime
441
- * resolution by OpenClaw's gateway secret resolver
442
- * - `undefined` / empty string → fall back to env var, then `undefined`
443
- * - Any other shape → throw with a clear, actionable error so operators can
444
- * debug rather than chasing a generic startup failure (issue #757).
438
+ * Parse `agentAccessHttp.authToken`: string → env-expanded immediately (current behavior
439
+ * preserved); SecretRef object (`{source, ...}`) → preserved verbatim for runtime resolution
440
+ * by OpenClaw's gateway secret resolver; undefined/empty string → env var fallback then
441
+ * undefined; any other shape → throw with an actionable error, never a generic startup
442
+ * failure operators must chase down (issue #757).
445
443
  */
446
444
  function parseAgentAccessAuthToken(raw: unknown): import("./types.js").AgentAccessAuthToken | undefined {
447
445
  if (raw === undefined || raw === null) {
@@ -1487,7 +1485,7 @@ export function parseConfig(
1487
1485
  60_000,
1488
1486
  "agentAccessHttp.writeRateLimitWindowMs",
1489
1487
  ),
1490
- trustPrincipalHeader: rawAgentAccessHttp?.trustPrincipalHeader === true,
1488
+ trustPrincipalHeader: coerceBool(rawAgentAccessHttp?.trustPrincipalHeader, "agentAccessHttp.trustPrincipalHeader") ?? false,
1491
1489
  };
1492
1490
 
1493
1491
  let baseUrl: string | undefined;
@@ -291,6 +291,29 @@ export class ExtractionQueueCoordinator {
291
291
  }
292
292
  }
293
293
 
294
+ /** Test + force-flush observability: register a keyed preempt slot the way
295
+ * `runEntry` does for a queued task, so callers can exercise the keyed
296
+ * preemption path without a full queue. */
297
+ registerPreemptSlot(key: string): ExtractionPreemptHandle {
298
+ const slot: PreemptSlot = {};
299
+ this.preemptSlots.set(slot, { key });
300
+ return this.createPreemptHandle(slot);
301
+ }
302
+
303
+ /** Force-flush-scoped preemption: abort EVERY armed slot whose key matches
304
+ * `key` and abort nothing when none does. Unlike `preemptRunning` there is
305
+ * deliberately no newest-slot fallback - a keyed caller (force-flush on
306
+ * session K) must never take out an unrelated background task just
307
+ * because K's own extraction is not (yet) armed. */
308
+ preemptKeyed(key: string): void {
309
+ for (const state of this.preemptSlots.values()) {
310
+ if (state.key !== key || state.armed === undefined) continue;
311
+ const abort = state.armed.abort;
312
+ state.armed = undefined;
313
+ abort();
314
+ }
315
+ }
316
+
294
317
  private createPreemptHandle(slot: PreemptSlot): ExtractionPreemptHandle {
295
318
  return {
296
319
  arm: (abort: () => void) => {
package/src/types.ts CHANGED
@@ -92,7 +92,13 @@ export type CodexCompactionFlushMode = "signal" | "heuristic" | "auto";
92
92
  export type DreamingNarrativePromptStyle = "reflective" | "diary" | "analytical";
93
93
  export type HeartbeatDetectionMode = "runtime-signal" | "heuristic" | "auto";
94
94
  export type ActiveRecallQueryMode = "message" | "recent" | "full";
95
- export type ActiveRecallPromptStyle = "balanced" | "strict" | "contextual" | "recall-heavy" | "precision-heavy" | "preference-only";
95
+ export type ActiveRecallPromptStyle =
96
+ | "balanced"
97
+ | "strict"
98
+ | "contextual"
99
+ | "recall-heavy"
100
+ | "precision-heavy"
101
+ | "preference-only";
96
102
  export type ActiveRecallThinking = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "adaptive";
97
103
  export type ActiveRecallChatType = "direct" | "group" | "channel";
98
104
  export type ActiveRecallModelFallbackPolicy = "default-remote" | "resolved-only";
@@ -285,11 +291,8 @@ export interface AgentAccessHttpConfig {
285
291
  enabled: boolean;
286
292
  host: string;
287
293
  port: number;
288
- /**
289
- * Bearer token. Either a literal string (env-expanded) or an unresolved
290
- * SecretRef object preserved verbatim from openclaw.json — resolved at
291
- * service-start time via {@link resolveAgentAccessAuthToken}.
292
- */
294
+ /** Literal string (env-expanded) or unresolved SecretRef object, preserved verbatim and
295
+ * resolved at service-start time via {@link resolveAgentAccessAuthToken}. */
293
296
  authToken?: AgentAccessAuthToken;
294
297
  principal?: string;
295
298
  maxBodyBytes: number;
@@ -297,8 +300,8 @@ export interface AgentAccessHttpConfig {
297
300
  writeRateLimitMaxRequests: number;
298
301
  /** Rolling window for the write rate limit, in ms (issue #1937). */
299
302
  writeRateLimitWindowMs: number;
300
- /** Trust the `x-engram-principal` header for per-request principal resolution (default off; trusted proxies only). */
301
- trustPrincipalHeader?: boolean;
303
+ /** Trust the per-request `X-Engram-Principal` header; only behind the bearer-token trust boundary; `--trust-principal-header` overrides (issue #3462). */
304
+ trustPrincipalHeader: boolean;
302
305
  }
303
306
 
304
307
  export interface DreamingConfig {