@remnic/core 9.69.36 → 9.69.38

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 (690) hide show
  1. package/dist/access-admin-ops-surface.d.ts +14 -12
  2. package/dist/access-admin-ops-surface.js +77 -74
  3. package/dist/access-authorization-probe.d.ts +14 -12
  4. package/dist/access-authorization-probe.js +78 -75
  5. package/dist/access-boundary.d.ts +14 -12
  6. package/dist/access-boundary.js +77 -74
  7. package/dist/access-cli.js +180 -170
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +2 -1
  10. package/dist/access-extraction-force-flush.d.ts +14 -12
  11. package/dist/access-extraction-force-flush.js +77 -74
  12. package/dist/access-health-types.d.ts +2 -1
  13. package/dist/access-http-briefing.d.ts +14 -12
  14. package/dist/access-http-briefing.js +78 -75
  15. package/dist/access-http-lcm-compaction.d.ts +14 -12
  16. package/dist/access-http-lifecycle-flush.d.ts +14 -12
  17. package/dist/access-http-offline-stream.d.ts +14 -12
  18. package/dist/access-http-query.d.ts +3 -2
  19. package/dist/access-http-query.js +79 -76
  20. package/dist/access-http.d.ts +15 -13
  21. package/dist/access-http.js +97 -94
  22. package/dist/access-identity-continuity-surface.d.ts +12 -10
  23. package/dist/access-identity-continuity-surface.js +77 -74
  24. package/dist/access-lcm-surface.d.ts +14 -12
  25. package/dist/access-lcm-surface.js +77 -74
  26. package/dist/access-mcp.d.ts +14 -12
  27. package/dist/access-mcp.js +86 -83
  28. package/dist/access-memory-search-fanout.d.ts +3 -2
  29. package/dist/{access-namespace-preflight-D8qri11P.d.ts → access-namespace-preflight-DY4z6L5X.d.ts} +1 -1
  30. package/dist/access-namespace-preflight.d.ts +4 -3
  31. package/dist/access-namespace-preflight.js +77 -74
  32. package/dist/access-observe-transcript.d.ts +12 -10
  33. package/dist/access-observe-write-category.d.ts +37 -0
  34. package/dist/access-observe-write-category.js +34 -0
  35. package/dist/access-observe-write-surface.d.ts +17 -15
  36. package/dist/access-observe-write-surface.js +77 -74
  37. package/dist/access-offline-manifest.d.ts +12 -10
  38. package/dist/access-offline-manifest.js +15 -15
  39. package/dist/access-operations-batch.js +80 -77
  40. package/dist/access-operations.d.ts +17 -30
  41. package/dist/access-operations.js +85 -82
  42. package/dist/access-recall-concurrency.d.ts +14 -12
  43. package/dist/access-recall-concurrency.js +77 -74
  44. package/dist/access-recall-response.d.ts +14 -12
  45. package/dist/access-recall-response.js +77 -74
  46. package/dist/access-recall-surface.d.ts +14 -12
  47. package/dist/access-recall-surface.js +77 -74
  48. package/dist/access-schema.d.ts +214 -111
  49. package/dist/access-schema.js +7 -13
  50. package/dist/{access-service-Cl_x57xR.d.ts → access-service-gBcdRUHY.d.ts} +101 -77
  51. package/dist/access-service-helpers.d.ts +14 -12
  52. package/dist/access-service.d.ts +14 -12
  53. package/dist/access-service.js +77 -74
  54. package/dist/access-surface-catalog.d.ts +14 -12
  55. package/dist/access-surface-catalog.js +79 -76
  56. package/dist/access-surface-catalog.js.map +1 -1
  57. package/dist/access-wearables-meetings-surface.d.ts +5 -3
  58. package/dist/action-confidence.d.ts +2 -1
  59. package/dist/active-memory-bridge.d.ts +2 -1
  60. package/dist/active-memory-bridge.js +3 -3
  61. package/dist/active-recall.d.ts +2 -1
  62. package/dist/active-recall.js +20 -16
  63. package/dist/active-recall.js.map +1 -1
  64. package/dist/activity/digest.d.ts +2 -1
  65. package/dist/adapters/index.js +4 -4
  66. package/dist/adapters/registry.js +2 -2
  67. package/dist/ambient-provenance.d.ts +2 -1
  68. package/dist/artifact-search.d.ts +2 -1
  69. package/dist/{auto-sync-4YFATLFQ.js → auto-sync-RP4C6ZPF.js} +12 -10
  70. package/dist/{auto-sync-4YFATLFQ.js.map → auto-sync-RP4C6ZPF.js.map} +1 -1
  71. package/dist/background-generation-config.d.ts +10 -0
  72. package/dist/background-generation-config.js +9 -0
  73. package/dist/background-generation.d.ts +25 -0
  74. package/dist/background-generation.js +11 -0
  75. package/dist/background-generation.js.map +1 -0
  76. package/dist/behavior-learner.d.ts +2 -1
  77. package/dist/behavior-signals.d.ts +2 -1
  78. package/dist/bootstrap.d.ts +12 -10
  79. package/dist/briefing-window.d.ts +3 -2
  80. package/dist/briefing.d.ts +3 -2
  81. package/dist/briefing.js +25 -24
  82. package/dist/buffer-surprise-report.d.ts +2 -1
  83. package/dist/buffer-turn-helpers.d.ts +2 -1
  84. package/dist/buffer.d.ts +3 -2
  85. package/dist/buffer.js +8 -8
  86. package/dist/bulk-import/index.d.ts +4 -3
  87. package/dist/calibration.d.ts +3 -1
  88. package/dist/calibration.js +5 -3
  89. package/dist/calibration.js.map +1 -1
  90. package/dist/capabilities.d.ts +2 -1
  91. package/dist/{capsule-merge-ZCXUPLNJ.js → capsule-merge-IPG4IOFP.js} +2 -2
  92. package/dist/{catalog-Bq1AxZwF.d.ts → catalog-CW87xGx8.d.ts} +1 -1
  93. package/dist/causal-behavior.d.ts +2 -1
  94. package/dist/causal-behavior.js +2 -2
  95. package/dist/causal-chain.js +2 -2
  96. package/dist/causal-consolidation.d.ts +2 -1
  97. package/dist/causal-consolidation.js +27 -26
  98. package/dist/causal-consolidation.js.map +1 -1
  99. package/dist/causal-retrieval.js +2 -2
  100. package/dist/causal-trajectory-graph.d.ts +2 -1
  101. package/dist/causal-trajectory.js +1 -1
  102. package/dist/{chunk-LO4UKPKX.js → chunk-27MKMTBY.js} +2 -2
  103. package/dist/{chunk-TK4FHQRN.js → chunk-2J3V5QEO.js} +4 -4
  104. package/dist/{chunk-DVOBLPSQ.js → chunk-2MT4ADLQ.js} +15 -39
  105. package/dist/chunk-2MT4ADLQ.js.map +1 -0
  106. package/dist/{chunk-JSRVXI6E.js → chunk-2OGTN37H.js} +10 -10
  107. package/dist/{chunk-DK4X5B6I.js → chunk-2PTNJTBE.js} +2 -2
  108. package/dist/chunk-2QG4SLZI.js +44 -0
  109. package/dist/chunk-2QG4SLZI.js.map +1 -0
  110. package/dist/{chunk-27IOSH2W.js → chunk-375ARKRS.js} +32 -11
  111. package/dist/chunk-375ARKRS.js.map +1 -0
  112. package/dist/{chunk-PWPIERBM.js → chunk-37CAEC7E.js} +4 -4
  113. package/dist/{chunk-S2ULTQZR.js → chunk-3N3PBBEH.js} +2 -2
  114. package/dist/{chunk-ZTG4P7NZ.js → chunk-3OYSIVOO.js} +168 -168
  115. package/dist/{chunk-ZBEGS7OB.js → chunk-474DL7UB.js} +3 -3
  116. package/dist/{chunk-YNN26CIZ.js → chunk-4B3HBIFX.js} +2 -2
  117. package/dist/{chunk-HC4GFLMQ.js → chunk-4BCHFSC7.js} +3 -3
  118. package/dist/{chunk-YEDVOYL2.js → chunk-4RX5O34R.js} +2 -2
  119. package/dist/{chunk-W6IJMWTZ.js → chunk-5AERZWJD.js} +2 -2
  120. package/dist/{chunk-XPJNT6PI.js → chunk-5N4MZLEH.js} +10 -6
  121. package/dist/chunk-5N4MZLEH.js.map +1 -0
  122. package/dist/{chunk-UBG4GAEP.js → chunk-5U7K4W6K.js} +6 -2
  123. package/dist/chunk-5U7K4W6K.js.map +1 -0
  124. package/dist/{chunk-PAAJWQH5.js → chunk-62D2PAAM.js} +4 -4
  125. package/dist/{chunk-JHZCXUQI.js → chunk-62QIQEUC.js} +157 -154
  126. package/dist/chunk-62QIQEUC.js.map +1 -0
  127. package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
  128. package/dist/{chunk-326KUXIR.js → chunk-6EHM2AV7.js} +6 -6
  129. package/dist/{chunk-YM7YN37H.js → chunk-6ET2VII7.js} +2 -2
  130. package/dist/chunk-6H2G7RFT.js +58 -0
  131. package/dist/chunk-6H2G7RFT.js.map +1 -0
  132. package/dist/{chunk-A2YQL2FF.js → chunk-6P4REYKL.js} +5 -5
  133. package/dist/{chunk-FVJ4D6L7.js → chunk-6PRY6CLC.js} +4 -4
  134. package/dist/{chunk-GLZH5VEN.js → chunk-6ZMNTRU3.js} +2 -2
  135. package/dist/{chunk-Z7ACR6MJ.js → chunk-74AHCL56.js} +3 -3
  136. package/dist/{chunk-5VAF4ID4.js → chunk-7S53BPTU.js} +25 -25
  137. package/dist/{chunk-EEBQFG5E.js → chunk-A6CKMIPK.js} +14 -14
  138. package/dist/chunk-A6CXG5WI.js +51 -0
  139. package/dist/chunk-A6CXG5WI.js.map +1 -0
  140. package/dist/{chunk-JR6PP7UM.js → chunk-ACY4ZPF7.js} +28 -2
  141. package/dist/chunk-ACY4ZPF7.js.map +1 -0
  142. package/dist/{chunk-2YLMUME2.js → chunk-AECJY3GJ.js} +2 -2
  143. package/dist/{chunk-NPNSKE76.js → chunk-B36GUU6T.js} +4 -4
  144. package/dist/{chunk-Y63ZFP4X.js → chunk-BJEJUOGM.js} +2 -2
  145. package/dist/{chunk-7CBKAQIG.js → chunk-BOADKFN4.js} +28 -4
  146. package/dist/chunk-BOADKFN4.js.map +1 -0
  147. package/dist/{chunk-TLHNF6GA.js → chunk-BV4ZKIZH.js} +1 -1
  148. package/dist/{chunk-3FJKJ5UZ.js → chunk-BX4EOMKT.js} +2 -2
  149. package/dist/{chunk-6J6K3STG.js → chunk-BYZKLEWG.js} +15 -12
  150. package/dist/chunk-BYZKLEWG.js.map +1 -0
  151. package/dist/{chunk-BJETIR53.js → chunk-CBFYCDYO.js} +3 -3
  152. package/dist/{chunk-ZWEZXVYH.js → chunk-CEO4DONG.js} +2 -2
  153. package/dist/chunk-CWTCMZGE.js +858 -0
  154. package/dist/chunk-CWTCMZGE.js.map +1 -0
  155. package/dist/{chunk-WPDKBUWX.js → chunk-DPMTLJCT.js} +2 -2
  156. package/dist/{chunk-65RENJGB.js → chunk-E2AWJ7KQ.js} +8 -4
  157. package/dist/chunk-E2AWJ7KQ.js.map +1 -0
  158. package/dist/{chunk-LYDJRF45.js → chunk-EY5JAWZC.js} +2 -2
  159. package/dist/{chunk-R4OCGPSH.js → chunk-FJMYMJLR.js} +2 -2
  160. package/dist/{chunk-OS2AT2JU.js → chunk-G43PMSME.js} +27 -10
  161. package/dist/chunk-G43PMSME.js.map +1 -0
  162. package/dist/{chunk-YXLUTALO.js → chunk-GAS7KYC7.js} +5 -5
  163. package/dist/{chunk-LSLCFCCQ.js → chunk-GDYU6VF4.js} +1 -1
  164. package/dist/chunk-GDYU6VF4.js.map +1 -0
  165. package/dist/{chunk-UDZYNIDJ.js → chunk-GGAXFTNH.js} +2 -2
  166. package/dist/{chunk-QURNMKME.js → chunk-GQQVEH6V.js} +6 -6
  167. package/dist/{chunk-J7PB5UQ4.js → chunk-GT4ZHOKT.js} +3 -3
  168. package/dist/{chunk-WIKO4SCR.js → chunk-H3TKENU4.js} +5 -5
  169. package/dist/{chunk-ZLN7AROH.js → chunk-HIP6DKJJ.js} +5 -5
  170. package/dist/{chunk-UYUCCQ46.js → chunk-HVS7TH2Y.js} +2 -2
  171. package/dist/{chunk-Z3O53WZR.js → chunk-IWO6QXWJ.js} +2 -2
  172. package/dist/{chunk-4MDKNUV4.js → chunk-IYKZJVL5.js} +1 -1
  173. package/dist/chunk-IYKZJVL5.js.map +1 -0
  174. package/dist/{chunk-42DJ235G.js → chunk-J272ODKJ.js} +2 -2
  175. package/dist/{chunk-JR6H5CYS.js → chunk-JA2QJOAX.js} +2 -2
  176. package/dist/{chunk-R3TLVTWW.js → chunk-JDX2OA4R.js} +3 -3
  177. package/dist/chunk-JE26AUX6.js +16 -0
  178. package/dist/chunk-JE26AUX6.js.map +1 -0
  179. package/dist/{chunk-AJTG3CP7.js → chunk-JHU4EYDV.js} +11 -1
  180. package/dist/chunk-JHU4EYDV.js.map +1 -0
  181. package/dist/{chunk-HXSAWV3A.js → chunk-JNSENHV5.js} +6 -6
  182. package/dist/{chunk-RRZKTSFG.js → chunk-JPOX2AJB.js} +2 -2
  183. package/dist/{chunk-TKFSXDOB.js → chunk-K5DA5TRG.js} +9 -9
  184. package/dist/{chunk-AZSKROVQ.js → chunk-KDFDXEXZ.js} +2 -2
  185. package/dist/{chunk-AKE4GGQ3.js → chunk-KQW3YGEN.js} +2 -2
  186. package/dist/{chunk-B3O3IRZN.js → chunk-L63GFNKL.js} +1 -1
  187. package/dist/{chunk-YEN4TREG.js → chunk-LQNRVPTV.js} +54 -567
  188. package/dist/chunk-LQNRVPTV.js.map +1 -0
  189. package/dist/{chunk-YJ6VCDMZ.js → chunk-M6HBPLBA.js} +2 -2
  190. package/dist/chunk-MCRVQ5YQ.js +14 -0
  191. package/dist/chunk-MCRVQ5YQ.js.map +1 -0
  192. package/dist/{chunk-L2WQVSKP.js → chunk-MLWMR2GE.js} +2 -2
  193. package/dist/{chunk-WHHEPAO3.js → chunk-NWMUSKED.js} +8 -8
  194. package/dist/chunk-OEBLZZKK.js +53 -0
  195. package/dist/chunk-OEBLZZKK.js.map +1 -0
  196. package/dist/{chunk-JRWW7GM6.js → chunk-OKO57IXB.js} +7 -7
  197. package/dist/{chunk-L2QLDZJC.js → chunk-P4ZAEYKG.js} +67 -33
  198. package/dist/chunk-P4ZAEYKG.js.map +1 -0
  199. package/dist/{chunk-MPAJFFP3.js → chunk-PGAB2V53.js} +5 -5
  200. package/dist/{chunk-MPAJFFP3.js.map → chunk-PGAB2V53.js.map} +1 -1
  201. package/dist/{chunk-VYXDUPYE.js → chunk-PPQEP4OH.js} +2 -2
  202. package/dist/{chunk-LEMD7WZJ.js → chunk-QHT7MOUF.js} +70 -25
  203. package/dist/chunk-QHT7MOUF.js.map +1 -0
  204. package/dist/chunk-QJ2AX6DU.js +19 -0
  205. package/dist/chunk-QJ2AX6DU.js.map +1 -0
  206. package/dist/{chunk-Q4AUIFUA.js → chunk-QMWKENNK.js} +4 -4
  207. package/dist/{chunk-XCOV45MO.js → chunk-R4VAUNNC.js} +3 -3
  208. package/dist/{chunk-353KGBKY.js → chunk-RW4QNB4J.js} +4 -4
  209. package/dist/{chunk-FQXJAC3T.js → chunk-SGUDMW2K.js} +4 -4
  210. package/dist/{chunk-S5G2LAL7.js → chunk-SV4Z2S67.js} +4 -4
  211. package/dist/{chunk-HUT2JR6I.js → chunk-T32B72QX.js} +3 -3
  212. package/dist/{chunk-OQ7SSRXP.js → chunk-TRHBQVVO.js} +23 -17
  213. package/dist/chunk-TRHBQVVO.js.map +1 -0
  214. package/dist/{chunk-LMCD5W5B.js → chunk-TRLOFIQC.js} +2 -2
  215. package/dist/{chunk-JZ2CHRLB.js → chunk-TTSJ7WUC.js} +2 -2
  216. package/dist/{chunk-CNV2A557.js → chunk-TUKGXQ5T.js} +3 -3
  217. package/dist/{chunk-QATYVTP7.js → chunk-UIOIDW3L.js} +2 -2
  218. package/dist/{chunk-776GVKL7.js → chunk-ULDBGA5W.js} +2 -2
  219. package/dist/{chunk-NN4JEFON.js → chunk-UQNYPK7G.js} +3 -3
  220. package/dist/{chunk-A5UQ52YQ.js → chunk-UZZ7SQT3.js} +5 -5
  221. package/dist/{chunk-F6IVBYFS.js → chunk-V6G2PSXA.js} +72 -72
  222. package/dist/{chunk-RUXPVSML.js → chunk-VHOSM5G4.js} +6 -6
  223. package/dist/{chunk-QBLDCI6E.js → chunk-VMNCZ627.js} +2 -2
  224. package/dist/{chunk-P3ONDDIJ.js → chunk-VV4ZVUE6.js} +2 -2
  225. package/dist/{chunk-A7GQBJP5.js → chunk-X2NFFBTO.js} +4 -4
  226. package/dist/{chunk-ECKG5WSI.js → chunk-XGRXQR6T.js} +2 -2
  227. package/dist/{chunk-LNDLXMH6.js → chunk-XN6XT6GR.js} +3 -3
  228. package/dist/{chunk-C6KRO3SU.js → chunk-XVDZFTN5.js} +4 -4
  229. package/dist/chunk-XVZA6VXC.js +160 -0
  230. package/dist/chunk-XVZA6VXC.js.map +1 -0
  231. package/dist/{chunk-2BQ4ZIWC.js → chunk-XWLLFKHM.js} +8 -8
  232. package/dist/chunk-YFTNZMGR.js +71 -0
  233. package/dist/chunk-YFTNZMGR.js.map +1 -0
  234. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  235. package/dist/{chunk-BNGHPYZU.js → chunk-YUW66UAH.js} +3 -3
  236. package/dist/{chunk-5JG5EBVL.js → chunk-ZEGL7YCC.js} +2 -2
  237. package/dist/{chunk-PHP3MUGF.js → chunk-ZKZFFWLV.js} +2 -2
  238. package/dist/{chunk-GCBIXUPT.js → chunk-ZMWSYUUL.js} +2 -2
  239. package/dist/{chunk-X2QPKLPL.js → chunk-ZZUVBZL2.js} +2 -2
  240. package/dist/{cli-p813oxbm.d.ts → cli-BNg-TAlz.d.ts} +5 -5
  241. package/dist/cli-fallback.d.ts +4 -2
  242. package/dist/cli-fallback.js +3 -1
  243. package/dist/cli.d.ts +16 -14
  244. package/dist/cli.js +125 -119
  245. package/dist/coding/export-okf-codegraph.d.ts +2 -1
  246. package/dist/coding/export-okf-codegraph.js +24 -23
  247. package/dist/coding/export-okf-codegraph.js.map +1 -1
  248. package/dist/coding/pre-action-gate.d.ts +2 -1
  249. package/dist/coding/pre-action-gate.js +2 -2
  250. package/dist/compat/codex-cli-fallback.d.ts +1 -1
  251. package/dist/compat/codex-cli-fallback.js +3 -1
  252. package/dist/compat/codex-cli-fallback.js.map +1 -1
  253. package/dist/compounding/engine.d.ts +3 -2
  254. package/dist/compounding/engine.js +25 -24
  255. package/dist/compounding/preference-consolidator.d.ts +2 -1
  256. package/dist/compression-optimizer.d.ts +2 -1
  257. package/dist/config.d.ts +2 -1
  258. package/dist/config.js +18 -14
  259. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  260. package/dist/connectors/codex-materialize-runner.js +24 -23
  261. package/dist/connectors/codex-materialize.d.ts +2 -1
  262. package/dist/connectors/index.d.ts +2 -1
  263. package/dist/connectors/index.js +27 -26
  264. package/dist/consolidation-provenance-check.d.ts +3 -2
  265. package/dist/consolidation-undo.d.ts +3 -2
  266. package/dist/contradiction/index.d.ts +5 -3
  267. package/dist/contradiction/index.js +7 -7
  268. package/dist/{contradiction-scan-GVD4JJ7B.js → contradiction-scan-BSGKZHYJ.js} +4 -4
  269. package/dist/contradiction-scan-BSGKZHYJ.js.map +1 -0
  270. package/dist/converge-config.d.ts +2 -1
  271. package/dist/convergence-refresh.d.ts +3 -2
  272. package/dist/convergence-refresh.js +27 -26
  273. package/dist/conversation-index/backend.d.ts +2 -1
  274. package/dist/conversation-index/chunker.d.ts +2 -1
  275. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  276. package/dist/conversation-index/indexer.d.ts +2 -1
  277. package/dist/conversation-index/search.d.ts +2 -1
  278. package/dist/corpus-watermark.d.ts +2 -1
  279. package/dist/corpus-watermark.js +27 -26
  280. package/dist/cross-lingual-recall.d.ts +2 -1
  281. package/dist/dashboard-runtime.js +2 -2
  282. package/dist/day-summary.d.ts +2 -1
  283. package/dist/deep-recall-http-glue.d.ts +14 -12
  284. package/dist/deep-recall-http-glue.js +2 -12
  285. package/dist/deep-recall-mcp-tools.d.ts +14 -12
  286. package/dist/deep-recall-policy-llm.d.ts +3 -1
  287. package/dist/deep-recall-policy-llm.js +5 -3
  288. package/dist/deep-recall-seeds.d.ts +2 -1
  289. package/dist/deep-recall.js +2 -2
  290. package/dist/delinearize.d.ts +2 -1
  291. package/dist/dependency-propagation-config.d.ts +2 -1
  292. package/dist/{dependency-propagation-delivery-DLiAtj25.d.ts → dependency-propagation-delivery-Cq1ekOwV.d.ts} +1 -1
  293. package/dist/direct-answer-wiring.d.ts +2 -1
  294. package/dist/direct-answer.d.ts +2 -1
  295. package/dist/embedding-fallback.d.ts +2 -1
  296. package/dist/enrichment/index.d.ts +2 -1
  297. package/dist/entity-origin-fields.d.ts +2 -1
  298. package/dist/entity-retrieval.d.ts +3 -2
  299. package/dist/entity-retrieval.js +26 -25
  300. package/dist/entity-schema.d.ts +2 -1
  301. package/dist/episodic-context.d.ts +2 -1
  302. package/dist/eval-trajectory-contracts.d.ts +2 -1
  303. package/dist/eval-trajectory-store.d.ts +2 -1
  304. package/dist/eval-trajectory.d.ts +2 -1
  305. package/dist/event-order-recall.js +3 -3
  306. package/dist/explicit-capture.d.ts +12 -10
  307. package/dist/explicit-capture.js +6 -6
  308. package/dist/external-wiki-access.d.ts +14 -12
  309. package/dist/external-wiki-access.js +78 -75
  310. package/dist/external-wiki-collection-registration.d.ts +2 -1
  311. package/dist/external-wiki-collection.d.ts +2 -1
  312. package/dist/external-wiki-mcp-tools.d.ts +14 -12
  313. package/dist/extraction-error-classification.d.ts +2 -1
  314. package/dist/extraction-faithfulness.d.ts +3 -1
  315. package/dist/extraction-faithfulness.js +5 -3
  316. package/dist/extraction-judge-telemetry.d.ts +3 -1
  317. package/dist/extraction-judge-training.d.ts +3 -1
  318. package/dist/extraction-judge.d.ts +3 -1
  319. package/dist/extraction-judge.js +6 -4
  320. package/dist/extraction-liveness.d.ts +2 -1
  321. package/dist/extraction-normalization.d.ts +2 -1
  322. package/dist/extraction-normalization.js +2 -2
  323. package/dist/extraction-prompt.d.ts +12 -2
  324. package/dist/extraction-prompt.js +7 -3
  325. package/dist/extraction-source-grounding-rules.d.ts +4 -2
  326. package/dist/extraction-source-grounding-rules.js +1 -1
  327. package/dist/extraction-source-grounding.d.ts +3 -2
  328. package/dist/extraction-source-grounding.js +4 -4
  329. package/dist/extraction-span-config.d.ts +16 -0
  330. package/dist/extraction-span-config.js +15 -0
  331. package/dist/extraction-span-config.js.map +1 -0
  332. package/dist/extraction-span-materialize.d.ts +106 -0
  333. package/dist/extraction-span-materialize.js +30 -0
  334. package/dist/extraction-span-materialize.js.map +1 -0
  335. package/dist/extraction-span-slice.js +3 -12
  336. package/dist/extraction-span-slice.js.map +1 -1
  337. package/dist/extraction-span-source-hash.js +4 -46
  338. package/dist/extraction-span-source-hash.js.map +1 -1
  339. package/dist/extraction-span-validate.js +3 -15
  340. package/dist/extraction-span-validate.js.map +1 -1
  341. package/dist/extraction.d.ts +8 -1
  342. package/dist/extraction.js +48 -43
  343. package/dist/fallback-llm-codex-subscription.d.ts +79 -0
  344. package/dist/fallback-llm-codex-subscription.js +22 -0
  345. package/dist/fallback-llm-codex-subscription.js.map +1 -0
  346. package/dist/fallback-llm.d.ts +5 -1
  347. package/dist/fallback-llm.js +4 -2
  348. package/dist/{first-start-migration-L3UFX5CU.js → first-start-migration-ZWMV5CX4.js} +4 -4
  349. package/dist/{generic-recall-paths-DbitKJI5.d.ts → generic-recall-paths-BcySh_f9.d.ts} +1 -1
  350. package/dist/graph-append-error.d.ts +2 -1
  351. package/dist/graph-dashboard-diff.d.ts +2 -1
  352. package/dist/graph-dashboard-key.d.ts +2 -1
  353. package/dist/graph-dashboard-parser.d.ts +2 -1
  354. package/dist/graph-edge-reinforcement.d.ts +2 -1
  355. package/dist/graph-jsonl.d.ts +2 -1
  356. package/dist/graph-path-reconstruction.d.ts +2 -1
  357. package/dist/graph-path-scoring.d.ts +2 -1
  358. package/dist/graph-snapshot.d.ts +2 -1
  359. package/dist/graph.d.ts +2 -1
  360. package/dist/harmonic-retrieval.js +3 -3
  361. package/dist/importance.d.ts +2 -1
  362. package/dist/importers/index.d.ts +2 -1
  363. package/dist/importers/test-utils.d.ts +2 -1
  364. package/dist/in-flight-reads.d.ts +2 -1
  365. package/dist/{index-BINUgPFo.d.ts → index-DWOb4wz9.d.ts} +2 -2
  366. package/dist/index.d.ts +712 -704
  367. package/dist/index.js +368 -299
  368. package/dist/intent.d.ts +2 -1
  369. package/dist/lcm/engine.d.ts +2 -1
  370. package/dist/lcm/engine.js +2 -2
  371. package/dist/lcm/index.d.ts +2 -1
  372. package/dist/lcm/index.js +7 -7
  373. package/dist/lcm/tools.d.ts +2 -1
  374. package/dist/lifecycle.d.ts +2 -1
  375. package/dist/live-connectors-runner.d.ts +2 -1
  376. package/dist/local-llm-config.d.ts +7 -1
  377. package/dist/local-llm-config.js +12 -0
  378. package/dist/local-llm.d.ts +2 -1
  379. package/dist/local-model-endpoint.d.ts +2 -1
  380. package/dist/location/index.d.ts +4 -3
  381. package/dist/location/index.js +60 -59
  382. package/dist/maintenance/memory-governance.d.ts +2 -1
  383. package/dist/maintenance/memory-governance.js +24 -23
  384. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
  385. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +25 -24
  386. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  387. package/dist/maintenance/rebuild-memory-projection.js +26 -25
  388. package/dist/{maintenance-ag1gYztC.d.ts → maintenance-CW9wCzMP.d.ts} +3 -3
  389. package/dist/mcp-memory-inspector-app.d.ts +14 -12
  390. package/dist/memory-action-policy.d.ts +2 -1
  391. package/dist/memory-cache.d.ts +2 -1
  392. package/dist/memory-controller.d.ts +2 -1
  393. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  394. package/dist/memory-projection-store.d.ts +2 -1
  395. package/dist/memory-provenance.d.ts +2 -1
  396. package/dist/memory-snapshot.d.ts +2 -1
  397. package/dist/memory-subject-cli.d.ts +14 -12
  398. package/dist/memory-subject.d.ts +14 -12
  399. package/dist/memory-worth-outcomes.d.ts +3 -2
  400. package/dist/models-json.d.ts +2 -1
  401. package/dist/namespaces/migrate.d.ts +4 -3
  402. package/dist/namespaces/migrate.js +25 -24
  403. package/dist/namespaces/principal.d.ts +2 -1
  404. package/dist/namespaces/search.d.ts +2 -1
  405. package/dist/namespaces/search.js +4 -4
  406. package/dist/namespaces/storage.d.ts +4 -3
  407. package/dist/namespaces/storage.js +24 -23
  408. package/dist/native-knowledge.d.ts +2 -1
  409. package/dist/offline-sync-impression-drain.d.ts +2 -1
  410. package/dist/offline-sync-impression-drain.js +4 -4
  411. package/dist/operator-doctor-corpus.d.ts +2 -1
  412. package/dist/operator-doctor-corpus.js +28 -27
  413. package/dist/operator-doctor-replica.d.ts +2 -1
  414. package/dist/operator-toolkit.d.ts +4 -3
  415. package/dist/operator-toolkit.js +49 -44
  416. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  417. package/dist/orchestration/maintenance.d.ts +5 -4
  418. package/dist/orchestration/maintenance.js +37 -36
  419. package/dist/{orchestrator-Cf3G-3Ed.d.ts → orchestrator-DocO0_hw.d.ts} +9 -9
  420. package/dist/orchestrator.d.ts +12 -10
  421. package/dist/orchestrator.js +208 -198
  422. package/dist/patterns-cli.d.ts +2 -1
  423. package/dist/{pipeline-AwB03fw_.d.ts → pipeline-CiYcqqhl.d.ts} +1 -1
  424. package/dist/policy-runtime.d.ts +2 -1
  425. package/dist/proactive-contention.d.ts +2 -1
  426. package/dist/provenance.d.ts +2 -1
  427. package/dist/provenance.js +2 -2
  428. package/dist/{public-http-C3bLjE-L.d.ts → public-http-C0FoTiL_.d.ts} +1 -1
  429. package/dist/qmd-preflight.d.ts +3 -2
  430. package/dist/{qmd-Bfaydrfm.d.ts → qmd-qXD4vatU.d.ts} +1 -1
  431. package/dist/qmd-recall-cache.d.ts +2 -1
  432. package/dist/qmd.d.ts +3 -2
  433. package/dist/recall-concurrency-config.d.ts +2 -1
  434. package/dist/recall-disclosure-escalation.d.ts +2 -1
  435. package/dist/recall-explain-renderer.d.ts +2 -1
  436. package/dist/recall-explain-renderer.js +3 -3
  437. package/dist/recall-memory-map.d.ts +2 -1
  438. package/dist/recall-navigate-access.d.ts +2 -1
  439. package/dist/recall-navigate-access.js +2 -2
  440. package/dist/recall-navigate-disclosure.d.ts +2 -1
  441. package/dist/recall-navigate-disclosure.js +1 -1
  442. package/dist/recall-navigate.d.ts +2 -1
  443. package/dist/recall-navigate.js +2 -2
  444. package/dist/recall-planner-llm.d.ts +3 -1
  445. package/dist/recall-planner-llm.js +4 -2
  446. package/dist/recall-planner-llm.js.map +1 -1
  447. package/dist/recall-state-view-admission.d.ts +3 -2
  448. package/dist/recall-state-view-admission.js +6 -6
  449. package/dist/recall-state.d.ts +2 -1
  450. package/dist/recall-tag-filter.d.ts +2 -1
  451. package/dist/recall-timings.d.ts +2 -1
  452. package/dist/recall-xray-cli.d.ts +2 -1
  453. package/dist/recall-xray-cli.js +4 -4
  454. package/dist/recall-xray-renderer.d.ts +2 -1
  455. package/dist/recall-xray-renderer.js +3 -3
  456. package/dist/recall-xray.d.ts +2 -1
  457. package/dist/recall-xray.js +2 -2
  458. package/dist/reconcile/cursor.d.ts +2 -1
  459. package/dist/reconcile/cursor.js +2 -2
  460. package/dist/reconcile/manifest.d.ts +12 -2
  461. package/dist/reconcile/manifest.js +8 -6
  462. package/dist/reconcile/plan.d.ts +2 -1
  463. package/dist/reconcile/plan.js +2 -2
  464. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  465. package/dist/replay/normalizers/claude.d.ts +2 -1
  466. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  467. package/dist/replay/normalizers/shared.d.ts +2 -1
  468. package/dist/replay/runner.d.ts +2 -1
  469. package/dist/replay/types.d.ts +2 -1
  470. package/dist/replica-divergence.d.ts +2 -1
  471. package/dist/replica-peers-config.d.ts +2 -1
  472. package/dist/{resolution-OHJZG45O.js → resolution-4GG3QZRJ.js} +8 -8
  473. package/dist/resolution-4GG3QZRJ.js.map +1 -0
  474. package/dist/resolve-auth-token.d.ts +2 -1
  475. package/dist/resume-bundles.js +19 -15
  476. package/dist/retrieval-agents.d.ts +3 -2
  477. package/dist/retrieval-tiers.d.ts +2 -1
  478. package/dist/routing/engine.d.ts +2 -1
  479. package/dist/routing/store.d.ts +2 -1
  480. package/dist/salvage-envelope.d.ts +2 -1
  481. package/dist/salvage-envelope.js +2 -2
  482. package/dist/schemas.d.ts +370 -160
  483. package/dist/schemas.js +1 -1
  484. package/dist/{scope-profiles-nxTKvjE-.d.ts → scope-profiles-BT9rqC3w.d.ts} +1 -1
  485. package/dist/search/embed-helper.d.ts +2 -1
  486. package/dist/search/factory.d.ts +2 -1
  487. package/dist/search/factory.js +3 -3
  488. package/dist/search/index.d.ts +2 -1
  489. package/dist/search/index.js +7 -7
  490. package/dist/search/lancedb-backend.d.ts +2 -1
  491. package/dist/search/meilisearch-backend.d.ts +2 -1
  492. package/dist/search/noop-backend.d.ts +2 -1
  493. package/dist/search/orama-backend.d.ts +2 -1
  494. package/dist/search/port.d.ts +2 -1
  495. package/dist/search/remote-backend.d.ts +2 -1
  496. package/dist/{semantic-consolidation-C83DVakV.d.ts → semantic-consolidation-CmZi7thY.d.ts} +1 -1
  497. package/dist/semantic-consolidation.d.ts +3 -2
  498. package/dist/semantic-consolidation.js +25 -24
  499. package/dist/semantic-rule-promotion.js +24 -23
  500. package/dist/semantic-rule-verifier.d.ts +2 -1
  501. package/dist/semantic-rule-verifier.js +24 -23
  502. package/dist/{service-q-xtOoAr.d.ts → service-CLkA7AQB.d.ts} +2 -2
  503. package/dist/session-observer-bands.d.ts +2 -1
  504. package/dist/session-observer-state.d.ts +2 -1
  505. package/dist/shared-context/manager.d.ts +8 -7
  506. package/dist/signal.d.ts +2 -1
  507. package/dist/source-agent-qualifier.d.ts +2 -1
  508. package/dist/source-agent-qualifier.js +40 -39
  509. package/dist/standup/build.js +25 -24
  510. package/dist/{storage-Ca0MbTfm.d.ts → storage-wvX01lht.d.ts} +1 -1
  511. package/dist/storage.d.ts +3 -2
  512. package/dist/storage.js +23 -22
  513. package/dist/subject-config.d.ts +2 -1
  514. package/dist/subject-config.js +2 -2
  515. package/dist/summarizer.d.ts +2 -1
  516. package/dist/summarizer.js +6 -3
  517. package/dist/summary-snapshot.d.ts +2 -1
  518. package/dist/support-passport/index.d.ts +17 -15
  519. package/dist/support-passport/index.js +83 -80
  520. package/dist/temporal-supersession.d.ts +3 -2
  521. package/dist/temporal-timeline-recall.d.ts +2 -1
  522. package/dist/temporal-validity.d.ts +2 -1
  523. package/dist/threading.d.ts +2 -1
  524. package/dist/tier-migration.d.ts +3 -2
  525. package/dist/tier-routing.d.ts +2 -1
  526. package/dist/tier-routing.js +3 -3
  527. package/dist/{tier-stats-VK5PCO2L.js → tier-stats-LUSUUNU6.js} +4 -4
  528. package/dist/topics.d.ts +2 -1
  529. package/dist/transcript.d.ts +2 -1
  530. package/dist/transfer/capsule-import.js +1 -1
  531. package/dist/transfer/export-okf.d.ts +2 -1
  532. package/dist/transfer/export-okf.js +24 -23
  533. package/dist/transfer/types.d.ts +98 -98
  534. package/dist/trust-score-stage.d.ts +2 -1
  535. package/dist/trust-score.d.ts +2 -1
  536. package/dist/{types-yDgWDkrJ.d.ts → types-Cyr32ABj.d.ts} +51 -10
  537. package/dist/types.d.ts +2 -1
  538. package/dist/types.js +1 -1
  539. package/dist/utility-runtime.d.ts +2 -1
  540. package/dist/verified-recall.js +24 -23
  541. package/dist/who-knows-cli.d.ts +14 -12
  542. package/dist/who-knows-cli.js +25 -24
  543. package/dist/who-knows.d.ts +14 -12
  544. package/dist/who-knows.js +24 -23
  545. package/dist/write-envelope.d.ts +7 -1
  546. package/dist/write-envelope.js +1 -1
  547. package/package.json +42 -2
  548. package/src/access-boundary.ts +21 -6
  549. package/src/access-category-alias.test.ts +488 -51
  550. package/src/access-http.test.ts +292 -5
  551. package/src/access-http.ts +4 -0
  552. package/src/access-mcp.test.ts +2 -2
  553. package/src/access-observe-write-category.ts +25 -0
  554. package/src/access-observe-write-surface.ts +58 -57
  555. package/src/access-operations-batch.ts +28 -2
  556. package/src/access-operations.ts +6 -4
  557. package/src/access-schema.ts +106 -50
  558. package/src/access-service.ts +23 -9
  559. package/src/background-generation-config.ts +79 -0
  560. package/src/background-generation.test.ts +123 -0
  561. package/src/background-generation.ts +52 -0
  562. package/src/cli-fallback.ts +8 -2
  563. package/src/config.test.ts +172 -0
  564. package/src/config.ts +4 -45
  565. package/src/extraction-prompt.ts +37 -3
  566. package/src/extraction-source-grounding-rules.ts +46 -9
  567. package/src/extraction-source-grounding.ts +2 -1
  568. package/src/extraction-span-config.ts +81 -0
  569. package/src/extraction-span-materialize.test.ts +376 -0
  570. package/src/extraction-span-materialize.ts +241 -0
  571. package/src/extraction.ts +70 -25
  572. package/src/fallback-llm-codex-subscription.ts +168 -0
  573. package/src/fallback-llm.test.ts +46 -0
  574. package/src/fallback-llm.ts +60 -48
  575. package/src/index.ts +2 -16
  576. package/src/local-llm-config.ts +84 -0
  577. package/src/providers/codex-subscription.test.ts +804 -1
  578. package/src/providers/codex-subscription.ts +407 -65
  579. package/src/reconcile/manifest.test.ts +11 -1
  580. package/src/reconcile/manifest.ts +12 -0
  581. package/src/schemas.ts +14 -0
  582. package/src/source-agent-qualifier.ts +5 -1
  583. package/src/summarizer.ts +25 -0
  584. package/src/testing/subjects/extraction-lifecycle.test.ts +27 -10
  585. package/src/types.ts +12 -11
  586. package/src/write-envelope.ts +5 -0
  587. package/dist/chunk-27IOSH2W.js.map +0 -1
  588. package/dist/chunk-4MDKNUV4.js.map +0 -1
  589. package/dist/chunk-65RENJGB.js.map +0 -1
  590. package/dist/chunk-6J6K3STG.js.map +0 -1
  591. package/dist/chunk-7CBKAQIG.js.map +0 -1
  592. package/dist/chunk-AJTG3CP7.js.map +0 -1
  593. package/dist/chunk-DVOBLPSQ.js.map +0 -1
  594. package/dist/chunk-JHZCXUQI.js.map +0 -1
  595. package/dist/chunk-JR6PP7UM.js.map +0 -1
  596. package/dist/chunk-L2QLDZJC.js.map +0 -1
  597. package/dist/chunk-LEMD7WZJ.js.map +0 -1
  598. package/dist/chunk-LSLCFCCQ.js.map +0 -1
  599. package/dist/chunk-OQ7SSRXP.js.map +0 -1
  600. package/dist/chunk-OS2AT2JU.js.map +0 -1
  601. package/dist/chunk-UBG4GAEP.js.map +0 -1
  602. package/dist/chunk-XPJNT6PI.js.map +0 -1
  603. package/dist/chunk-YEN4TREG.js.map +0 -1
  604. /package/dist/{contradiction-scan-GVD4JJ7B.js.map → access-observe-write-category.js.map} +0 -0
  605. /package/dist/{resolution-OHJZG45O.js.map → background-generation-config.js.map} +0 -0
  606. /package/dist/{capsule-merge-ZCXUPLNJ.js.map → capsule-merge-IPG4IOFP.js.map} +0 -0
  607. /package/dist/{chunk-LO4UKPKX.js.map → chunk-27MKMTBY.js.map} +0 -0
  608. /package/dist/{chunk-TK4FHQRN.js.map → chunk-2J3V5QEO.js.map} +0 -0
  609. /package/dist/{chunk-JSRVXI6E.js.map → chunk-2OGTN37H.js.map} +0 -0
  610. /package/dist/{chunk-DK4X5B6I.js.map → chunk-2PTNJTBE.js.map} +0 -0
  611. /package/dist/{chunk-PWPIERBM.js.map → chunk-37CAEC7E.js.map} +0 -0
  612. /package/dist/{chunk-S2ULTQZR.js.map → chunk-3N3PBBEH.js.map} +0 -0
  613. /package/dist/{chunk-ZTG4P7NZ.js.map → chunk-3OYSIVOO.js.map} +0 -0
  614. /package/dist/{chunk-ZBEGS7OB.js.map → chunk-474DL7UB.js.map} +0 -0
  615. /package/dist/{chunk-YNN26CIZ.js.map → chunk-4B3HBIFX.js.map} +0 -0
  616. /package/dist/{chunk-HC4GFLMQ.js.map → chunk-4BCHFSC7.js.map} +0 -0
  617. /package/dist/{chunk-YEDVOYL2.js.map → chunk-4RX5O34R.js.map} +0 -0
  618. /package/dist/{chunk-W6IJMWTZ.js.map → chunk-5AERZWJD.js.map} +0 -0
  619. /package/dist/{chunk-PAAJWQH5.js.map → chunk-62D2PAAM.js.map} +0 -0
  620. /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
  621. /package/dist/{chunk-326KUXIR.js.map → chunk-6EHM2AV7.js.map} +0 -0
  622. /package/dist/{chunk-YM7YN37H.js.map → chunk-6ET2VII7.js.map} +0 -0
  623. /package/dist/{chunk-A2YQL2FF.js.map → chunk-6P4REYKL.js.map} +0 -0
  624. /package/dist/{chunk-FVJ4D6L7.js.map → chunk-6PRY6CLC.js.map} +0 -0
  625. /package/dist/{chunk-GLZH5VEN.js.map → chunk-6ZMNTRU3.js.map} +0 -0
  626. /package/dist/{chunk-Z7ACR6MJ.js.map → chunk-74AHCL56.js.map} +0 -0
  627. /package/dist/{chunk-5VAF4ID4.js.map → chunk-7S53BPTU.js.map} +0 -0
  628. /package/dist/{chunk-EEBQFG5E.js.map → chunk-A6CKMIPK.js.map} +0 -0
  629. /package/dist/{chunk-2YLMUME2.js.map → chunk-AECJY3GJ.js.map} +0 -0
  630. /package/dist/{chunk-NPNSKE76.js.map → chunk-B36GUU6T.js.map} +0 -0
  631. /package/dist/{chunk-Y63ZFP4X.js.map → chunk-BJEJUOGM.js.map} +0 -0
  632. /package/dist/{chunk-TLHNF6GA.js.map → chunk-BV4ZKIZH.js.map} +0 -0
  633. /package/dist/{chunk-3FJKJ5UZ.js.map → chunk-BX4EOMKT.js.map} +0 -0
  634. /package/dist/{chunk-BJETIR53.js.map → chunk-CBFYCDYO.js.map} +0 -0
  635. /package/dist/{chunk-ZWEZXVYH.js.map → chunk-CEO4DONG.js.map} +0 -0
  636. /package/dist/{chunk-WPDKBUWX.js.map → chunk-DPMTLJCT.js.map} +0 -0
  637. /package/dist/{chunk-LYDJRF45.js.map → chunk-EY5JAWZC.js.map} +0 -0
  638. /package/dist/{chunk-R4OCGPSH.js.map → chunk-FJMYMJLR.js.map} +0 -0
  639. /package/dist/{chunk-YXLUTALO.js.map → chunk-GAS7KYC7.js.map} +0 -0
  640. /package/dist/{chunk-UDZYNIDJ.js.map → chunk-GGAXFTNH.js.map} +0 -0
  641. /package/dist/{chunk-QURNMKME.js.map → chunk-GQQVEH6V.js.map} +0 -0
  642. /package/dist/{chunk-J7PB5UQ4.js.map → chunk-GT4ZHOKT.js.map} +0 -0
  643. /package/dist/{chunk-WIKO4SCR.js.map → chunk-H3TKENU4.js.map} +0 -0
  644. /package/dist/{chunk-ZLN7AROH.js.map → chunk-HIP6DKJJ.js.map} +0 -0
  645. /package/dist/{chunk-UYUCCQ46.js.map → chunk-HVS7TH2Y.js.map} +0 -0
  646. /package/dist/{chunk-Z3O53WZR.js.map → chunk-IWO6QXWJ.js.map} +0 -0
  647. /package/dist/{chunk-42DJ235G.js.map → chunk-J272ODKJ.js.map} +0 -0
  648. /package/dist/{chunk-JR6H5CYS.js.map → chunk-JA2QJOAX.js.map} +0 -0
  649. /package/dist/{chunk-R3TLVTWW.js.map → chunk-JDX2OA4R.js.map} +0 -0
  650. /package/dist/{chunk-HXSAWV3A.js.map → chunk-JNSENHV5.js.map} +0 -0
  651. /package/dist/{chunk-RRZKTSFG.js.map → chunk-JPOX2AJB.js.map} +0 -0
  652. /package/dist/{chunk-TKFSXDOB.js.map → chunk-K5DA5TRG.js.map} +0 -0
  653. /package/dist/{chunk-AZSKROVQ.js.map → chunk-KDFDXEXZ.js.map} +0 -0
  654. /package/dist/{chunk-AKE4GGQ3.js.map → chunk-KQW3YGEN.js.map} +0 -0
  655. /package/dist/{chunk-B3O3IRZN.js.map → chunk-L63GFNKL.js.map} +0 -0
  656. /package/dist/{chunk-YJ6VCDMZ.js.map → chunk-M6HBPLBA.js.map} +0 -0
  657. /package/dist/{chunk-L2WQVSKP.js.map → chunk-MLWMR2GE.js.map} +0 -0
  658. /package/dist/{chunk-WHHEPAO3.js.map → chunk-NWMUSKED.js.map} +0 -0
  659. /package/dist/{chunk-JRWW7GM6.js.map → chunk-OKO57IXB.js.map} +0 -0
  660. /package/dist/{chunk-VYXDUPYE.js.map → chunk-PPQEP4OH.js.map} +0 -0
  661. /package/dist/{chunk-Q4AUIFUA.js.map → chunk-QMWKENNK.js.map} +0 -0
  662. /package/dist/{chunk-XCOV45MO.js.map → chunk-R4VAUNNC.js.map} +0 -0
  663. /package/dist/{chunk-353KGBKY.js.map → chunk-RW4QNB4J.js.map} +0 -0
  664. /package/dist/{chunk-FQXJAC3T.js.map → chunk-SGUDMW2K.js.map} +0 -0
  665. /package/dist/{chunk-S5G2LAL7.js.map → chunk-SV4Z2S67.js.map} +0 -0
  666. /package/dist/{chunk-HUT2JR6I.js.map → chunk-T32B72QX.js.map} +0 -0
  667. /package/dist/{chunk-LMCD5W5B.js.map → chunk-TRLOFIQC.js.map} +0 -0
  668. /package/dist/{chunk-JZ2CHRLB.js.map → chunk-TTSJ7WUC.js.map} +0 -0
  669. /package/dist/{chunk-CNV2A557.js.map → chunk-TUKGXQ5T.js.map} +0 -0
  670. /package/dist/{chunk-QATYVTP7.js.map → chunk-UIOIDW3L.js.map} +0 -0
  671. /package/dist/{chunk-776GVKL7.js.map → chunk-ULDBGA5W.js.map} +0 -0
  672. /package/dist/{chunk-NN4JEFON.js.map → chunk-UQNYPK7G.js.map} +0 -0
  673. /package/dist/{chunk-A5UQ52YQ.js.map → chunk-UZZ7SQT3.js.map} +0 -0
  674. /package/dist/{chunk-F6IVBYFS.js.map → chunk-V6G2PSXA.js.map} +0 -0
  675. /package/dist/{chunk-RUXPVSML.js.map → chunk-VHOSM5G4.js.map} +0 -0
  676. /package/dist/{chunk-QBLDCI6E.js.map → chunk-VMNCZ627.js.map} +0 -0
  677. /package/dist/{chunk-P3ONDDIJ.js.map → chunk-VV4ZVUE6.js.map} +0 -0
  678. /package/dist/{chunk-A7GQBJP5.js.map → chunk-X2NFFBTO.js.map} +0 -0
  679. /package/dist/{chunk-ECKG5WSI.js.map → chunk-XGRXQR6T.js.map} +0 -0
  680. /package/dist/{chunk-LNDLXMH6.js.map → chunk-XN6XT6GR.js.map} +0 -0
  681. /package/dist/{chunk-C6KRO3SU.js.map → chunk-XVDZFTN5.js.map} +0 -0
  682. /package/dist/{chunk-2BQ4ZIWC.js.map → chunk-XWLLFKHM.js.map} +0 -0
  683. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
  684. /package/dist/{chunk-BNGHPYZU.js.map → chunk-YUW66UAH.js.map} +0 -0
  685. /package/dist/{chunk-5JG5EBVL.js.map → chunk-ZEGL7YCC.js.map} +0 -0
  686. /package/dist/{chunk-PHP3MUGF.js.map → chunk-ZKZFFWLV.js.map} +0 -0
  687. /package/dist/{chunk-GCBIXUPT.js.map → chunk-ZMWSYUUL.js.map} +0 -0
  688. /package/dist/{chunk-X2QPKLPL.js.map → chunk-ZZUVBZL2.js.map} +0 -0
  689. /package/dist/{first-start-migration-L3UFX5CU.js.map → first-start-migration-ZWMV5CX4.js.map} +0 -0
  690. /package/dist/{tier-stats-VK5PCO2L.js.map → tier-stats-LUSUUNU6.js.map} +0 -0
package/src/extraction.ts CHANGED
@@ -20,18 +20,8 @@ import {
20
20
  type ProactiveQuestionsResultParsed,
21
21
  DaySummaryResultSchema,
22
22
  } from "./schemas.js";
23
- import type {
24
- BufferTurn,
25
- ExtractionResult,
26
- ConsolidationResult,
27
- MemoryFile,
28
- PluginConfig,
29
- LlmTraceEvent,
30
- GatewayConfig,
31
- MemoryCategory,
32
- DaySummaryResult as DaySummaryResultShape,
33
- ExtractionFailureClass,
34
- } from "./types.js";
23
+ import type { BufferTurn, ExtractionResult, ConsolidationResult, MemoryFile, PluginConfig, LlmTraceEvent, GatewayConfig, MemoryCategory, DaySummaryResult as DaySummaryResultShape, ExtractionFailureClass } from "./types.js";
24
+ import type { ExtractedFactSpanRef } from "./extraction-span-config.js";
35
25
  import { ModelRegistry } from "./model-registry.js";
36
26
  import { extractJsonCandidates } from "./json-extract.js";
37
27
  import { sanitizeMemoryContent } from "./sanitize.js";
@@ -53,13 +43,14 @@ import { AMBIENT_CAPTURE_PROMPT_SECTION_COMPACT, clampAmbientCaptureConfidence }
53
43
  import {
54
44
  CONSOLIDATION_RESPONSE_SCHEMA,
55
45
  CUE_ANCHOR_PROMPT_INSTRUCTION,
56
- EXTRACTION_RESPONSE_SHAPE,
46
+ extractionResponseShape,
57
47
  OUTPUT_LANGUAGE_POLICY,
58
48
  PROFILE_CONSOLIDATION_RESPONSE_SCHEMA,
59
49
  buildConsolidationSystemPrompt,
60
50
  buildExtractionInstructions,
61
51
  buildProfileConsolidationSystemPrompt,
62
52
  eventTimePromptInstruction,
53
+ spanModePromptSection,
63
54
  } from "./extraction-prompt.js";
64
55
  import { zodToJsonSchema } from "zod-to-json-schema";
65
56
  import {
@@ -70,8 +61,15 @@ import {
70
61
  isPlainRecord,
71
62
  } from "./extraction-normalization.js";
72
63
  export { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
64
+ import {
65
+ applyExtractionSpanMaterialization,
66
+ bindLocalExtractionPrompt,
67
+ buildSpanMaterializeTurns,
68
+ stripUntrustedFactSpans,
69
+ truncateLocalExtractionConversation,
70
+ type SpanMaterializeTurn,
71
+ } from "./extraction-span-materialize.js";
73
72
  import { resolveLocalLlmCapabilities, resolveMemoryLifecycleCapabilities, resolvePipelineProcessingCapabilities, resolveRecallAuxiliaryCapabilities } from "./capabilities.js";
74
-
75
73
  type ExtractionQuestion = ExtractionResult["questions"][number];
76
74
  type ExtractedFactResult = ExtractionResult["facts"][number];
77
75
  type ExtractedEntityResult = ExtractionResult["entities"][number];
@@ -113,6 +111,28 @@ function normalizeQuestion(question: ExtractionQuestion): ExtractionQuestion {
113
111
  };
114
112
  }
115
113
 
114
+ function normalizeExtractedSpanRef(value: unknown): ExtractedFactSpanRef | undefined {
115
+ if (!isPlainRecord(value)) return undefined;
116
+ const { sourceMessageIndex, charStart, charEnd, frame, sourceHash, sourceLength } = value;
117
+ if (
118
+ typeof sourceMessageIndex !== "number" ||
119
+ typeof charStart !== "number" ||
120
+ typeof charEnd !== "number" ||
121
+ typeof frame !== "string"
122
+ ) {
123
+ return undefined;
124
+ }
125
+ return {
126
+ sourceMessageIndex,
127
+ charStart,
128
+ charEnd,
129
+ frame,
130
+ ...(typeof sourceHash === "string" && typeof sourceLength === "number"
131
+ ? { sourceHash, sourceLength }
132
+ : {}),
133
+ };
134
+ }
135
+
116
136
  function normalizeFactKey(fact: Pick<ExtractedFactResult, "category" | "content">): string {
117
137
  return `${fact.category}:${fact.content.trim().toLowerCase()}`;
118
138
  }
@@ -206,6 +226,22 @@ export class ExtractionEngine {
206
226
  return !this.useGatewayModelSource && this.client !== null;
207
227
  }
208
228
 
229
+ /**
230
+ * Span-mode materialization (issue #2333 Phase B): sibling module, called
231
+ * after parse and before sanitize/grounding so downstream sees one content
232
+ * form. Offsets index the exact prompt turn texts and die at materialization.
233
+ */
234
+ private applySpanMaterialization(
235
+ result: ExtractionResult,
236
+ spanTurns: readonly SpanMaterializeTurn[],
237
+ ): ExtractionResult {
238
+ return applyExtractionSpanMaterialization(
239
+ result,
240
+ spanTurns,
241
+ this.config.extraction?.spanMode ?? "off",
242
+ );
243
+ }
244
+
209
245
  /**
210
246
  * Build FallbackLlmOptions with the configured gateway agent ID injected.
211
247
  */
@@ -328,6 +364,7 @@ export class ExtractionEngine {
328
364
  procedureSteps,
329
365
  reasoningTrace,
330
366
  quote: extractionText(f.quote),
367
+ span: normalizeExtractedSpanRef(f.span),
331
368
  eventTime: extractionText(f.eventTime) ?? extractionText(f.event_time),
332
369
  };
333
370
  })
@@ -628,7 +665,7 @@ export class ExtractionEngine {
628
665
  const ambient = ctx.ambientCapture === true;
629
666
  const proactiveAdditions = await this.answerProactiveQuestions(
630
667
  conversation, base, proactive, maxAdditional, ctx.sourceConnector, ambient, signal);
631
- const sanitizedAdditions = this.sanitizeExtractionResult(proactiveAdditions, ctx.messageTimestamp);
668
+ const sanitizedAdditions = this.sanitizeExtractionResult({ ...proactiveAdditions, facts: stripUntrustedFactSpans(proactiveAdditions.facts) }, ctx.messageTimestamp);
632
669
  const groundedAdditions = applyGroundingWithConnector(this.config, sanitizedAdditions, ctx);
633
670
  if (!this.hasExtractionOutputs(groundedAdditions)) return base;
634
671
  return this.mergeProactiveExtractionPass(base, groundedAdditions, maxAdditional);
@@ -1102,6 +1139,7 @@ export class ExtractionEngine {
1102
1139
  ? resolvedConnector
1103
1140
  : undefined;
1104
1141
  const { conversation, renderedConversation } = renderExtractionConversation(boundedTurns, headerConnector(sourceConnector));
1142
+ const spanTurns = buildSpanMaterializeTurns(boundedTurns.map((turn) => turn.content));
1105
1143
 
1106
1144
  const groundingSource = boundedTurns
1107
1145
  .map((turn) => turn.content)
@@ -1191,7 +1229,16 @@ export class ExtractionEngine {
1191
1229
  this.profiler.endSpan("local-llm", extractionTraceId);
1192
1230
  this.emit({ kind: "llm_end", traceId, model: this.config.localLlmModel, operation: "extraction", durationMs });
1193
1231
  log.debug(`extraction: used local LLM — ${localResult.facts.length} facts, ${localResult.entities.length} entities`);
1194
- const sanitized = this.sanitizeExtractionResult(localResult, messageTimestamp);
1232
+ const localSpanTurns = bindLocalExtractionPrompt(
1233
+ conversation,
1234
+ boundedTurns,
1235
+ this.modelRegistry.calculateContextSizes(
1236
+ this.config.localLlmModel,
1237
+ this.config.localLlmMaxContext,
1238
+ ).maxInputChars,
1239
+ renderedConversation,
1240
+ ).spanTurns;
1241
+ const sanitized = this.sanitizeExtractionResult(this.applySpanMaterialization(localResult, localSpanTurns), messageTimestamp);
1195
1242
  const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
1196
1243
  const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
1197
1244
  return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector, ambientCapture);
@@ -1240,7 +1287,7 @@ export class ExtractionEngine {
1240
1287
  this.profiler.endSpan("direct-client", extractionTraceId);
1241
1288
  this.emit({ kind: "llm_end", traceId, model: this.config.model, operation: "extraction", durationMs });
1242
1289
  log.debug(`extraction: used direct client (${this.config.model}) — ${directResult.facts.length} facts, ${directResult.entities.length} entities`);
1243
- const sanitized = this.sanitizeExtractionResult(directResult, messageTimestamp);
1290
+ const sanitized = this.sanitizeExtractionResult(this.applySpanMaterialization(directResult, spanTurns), messageTimestamp);
1244
1291
  const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
1245
1292
  const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
1246
1293
  return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector, ambientCapture);
@@ -1303,7 +1350,7 @@ export class ExtractionEngine {
1303
1350
  role: "system" as const,
1304
1351
  content:
1305
1352
  buildExtractionInstructions(this.config, existingEntities, ambientCapture) +
1306
- `\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${EXTRACTION_RESPONSE_SHAPE}`,
1353
+ `\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${extractionResponseShape(this.config.extraction?.spanMode ?? "off")}`,
1307
1354
  },
1308
1355
  { role: "user" as const, content: conversation },
1309
1356
  ];
@@ -1338,7 +1385,7 @@ export class ExtractionEngine {
1338
1385
  `extracted ${result.facts.length} facts, ${result.entities.length} entities, ${(result.questions ?? []).length} questions via fallback (${detailed.modelUsed})`,
1339
1386
  );
1340
1387
  const normalized = this.normalizeExtractionResultPayload(result);
1341
- const sanitized = this.sanitizeExtractionResult(normalized, messageTimestamp);
1388
+ const sanitized = this.sanitizeExtractionResult(this.applySpanMaterialization(normalized, spanTurns), messageTimestamp);
1342
1389
  const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
1343
1390
  const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
1344
1391
  return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector, ambientCapture);
@@ -1414,9 +1461,7 @@ export class ExtractionEngine {
1414
1461
  log.debug(`Model context: ${contextSizes.description}`);
1415
1462
 
1416
1463
  const maxConversationChars = contextSizes.maxInputChars;
1417
- const truncatedConversation = conversation.length > maxConversationChars
1418
- ? conversation.slice(0, maxConversationChars) + "\n\n[truncated]"
1419
- : conversation;
1464
+ const truncatedConversation = truncateLocalExtractionConversation(conversation, maxConversationChars);
1420
1465
 
1421
1466
  const localPrompt = `You are a memory extraction system. Extract durable, reusable memories from this conversation.
1422
1467
 
@@ -1449,9 +1494,9 @@ ${CUE_ANCHOR_PROMPT_INSTRUCTION}\n- Include at most five durable relationships.$
1449
1494
  - Each fact must include a quote copied verbatim from one contiguous conversation span.` : ""}${lifecycleCaps.extractionScopeClassification ? `
1450
1495
  - Set each fact scope to "global" for cross-project knowledge or "project" for codebase-specific knowledge. Tool, command, or CLI-flag instructions tied to one agent are "project" (the same tool name can mean different things across agents); when keeping one, begin the fact with a leading "In <agent>," clause naming that agent.` : ""}${this.config.subjectClassification?.enabled === true ? `
1451
1496
  - Set each fact subject to "user" when it models the person (preferences, relationships, biography, moments, commitments about their life) or "agent" when it is reusable operating knowledge (procedures, principles, tool-usage lessons, debugging strategies, environment facts with no personal content).` : ""}${ambientCapture ? AMBIENT_CAPTURE_PROMPT_SECTION_COMPACT : ""}
1452
- ${eventTimePromptInstruction(this.config)}
1497
+ ${eventTimePromptInstruction(this.config)}${spanModePromptSection(this.config.extraction?.spanMode ?? "off")}
1453
1498
  Return only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:
1454
- ${EXTRACTION_RESPONSE_SHAPE}
1499
+ ${extractionResponseShape(this.config.extraction?.spanMode ?? "off")}
1455
1500
 
1456
1501
  Conversation:
1457
1502
  ${truncatedConversation}`;
@@ -1542,7 +1587,7 @@ ${truncatedConversation}`;
1542
1587
  role: "system",
1543
1588
  content:
1544
1589
  buildExtractionInstructions(this.config, existingEntities, ambientCapture) +
1545
- `\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${EXTRACTION_RESPONSE_SHAPE}`,
1590
+ `\n\nReturn only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:\n${extractionResponseShape(this.config.extraction?.spanMode ?? "off")}`,
1546
1591
  },
1547
1592
  { role: "user", content: conversation },
1548
1593
  ],
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Codex-subscription helpers for FallbackLlmClient (issue #2833).
3
+ *
4
+ * Terminal error classification, the `api: "codex-cli"` provider attempt,
5
+ * and Codex runner/lifecycle helpers live here so fallback-llm.ts stays
6
+ * generic chain orchestration.
7
+ */
8
+
9
+ import { raceAbort } from "./abort-error.js";
10
+ import { callCodexCliFallback, isCodexCliFallbackRunnerRegistered } from "./cli-fallback.js";
11
+ import type { CodexCliFallbackRunner } from "./cli-fallback.js";
12
+ import {
13
+ CODEX_SUBSCRIPTION_PROVIDER_ID,
14
+ CodexSubscriptionAuthError,
15
+ CodexSubscriptionConfigError,
16
+ CodexSubscriptionTimeoutError,
17
+ assertNoApiKeyConfig,
18
+ ensureCodexSubscriptionRunnerRegistered,
19
+ getCodexSubscriptionShutdownSignal,
20
+ isDefaultRegisteredCodexSubscriptionRunner,
21
+ } from "./providers/codex-subscription.js";
22
+ import type { ModelProviderConfig } from "./types.js";
23
+
24
+ type CodexSubscriptionAttemptResult = {
25
+ content: string;
26
+ usage?: {
27
+ inputTokens?: number;
28
+ outputTokens?: number;
29
+ totalTokens?: number;
30
+ };
31
+ };
32
+
33
+ /**
34
+ * Terminal codex-subscription failures (timeout, auth, config contract).
35
+ * These carry documented caller guidance (`TimeoutError` name, `codex login`
36
+ * steps), so they must survive the chain instead of collapsing into a
37
+ * generic empty/http_error result (issue #2833).
38
+ */
39
+ export function isTerminalCodexSubscriptionError(error: unknown): boolean {
40
+ return (
41
+ error instanceof CodexSubscriptionTimeoutError ||
42
+ error instanceof CodexSubscriptionAuthError ||
43
+ error instanceof CodexSubscriptionConfigError
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Settle a fallback-LLM chain at the caller deadline. Abort the in-flight
49
+ * work, return immediately, and observe the abandoned promise so a late
50
+ * rejection cannot become unhandled.
51
+ */
52
+ export async function raceFallbackLlmDeadline<T>(
53
+ work: Promise<T>,
54
+ timeoutMs: number,
55
+ abortOnTimeout: () => void,
56
+ ): Promise<{ timedOut: true } | { timedOut: false; value: T }> {
57
+ const deadline = new AbortController();
58
+ const timer = setTimeout(() => deadline.abort(), timeoutMs);
59
+ deadline.signal.addEventListener("abort", abortOnTimeout, { once: true });
60
+ try {
61
+ const value = await raceAbort(
62
+ work,
63
+ deadline.signal,
64
+ `fallback LLM timed out after ${timeoutMs}ms`,
65
+ );
66
+ return { timedOut: false, value };
67
+ } catch (error) {
68
+ if (!deadline.signal.aborted) throw error;
69
+ const afterAbort = await Promise.race([
70
+ work.then(
71
+ (value) => ({ state: "value" as const, value }),
72
+ (lateError) => ({ state: "error" as const, error: lateError }),
73
+ ),
74
+ new Promise<{ state: "pending" }>((resolve) => {
75
+ setImmediate(() => resolve({ state: "pending" }));
76
+ }),
77
+ ]);
78
+ if (afterAbort.state === "value") return { timedOut: false, value: afterAbort.value };
79
+ if (afterAbort.state === "error") throw afterAbort.error;
80
+ void work.then(
81
+ () => undefined,
82
+ () => undefined,
83
+ );
84
+ return { timedOut: true };
85
+ } finally {
86
+ clearTimeout(timer);
87
+ deadline.signal.removeEventListener("abort", abortOnTimeout);
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Attempt the Codex CLI / subscription provider. Returns `undefined` when the
93
+ * model is not `api: "codex-cli"` so the generic FallbackLlmClient path runs.
94
+ *
95
+ * Subscription ids reject a configured apiKey before generic secret resolution
96
+ * — otherwise an unresolvable ref throws a generic error and the provider's
97
+ * `codex login` guidance never surfaces (issue #2833). Other `codex-cli`
98
+ * providers still resolve a configured key. Runtime auth is skipped: the CLI
99
+ * login is the credential.
100
+ */
101
+ export async function tryCodexSubscriptionProvider(
102
+ model: {
103
+ providerId: string;
104
+ modelId: string;
105
+ providerConfig: ModelProviderConfig;
106
+ },
107
+ messages: Array<{ role: "system" | "user" | "assistant"; content: string }>,
108
+ options: { timeoutMs?: number; signal?: AbortSignal },
109
+ resolveFallbackApiKey: () => Promise<string | undefined>,
110
+ runner?: CodexCliFallbackRunner,
111
+ ): Promise<CodexSubscriptionAttemptResult | undefined> {
112
+ if (model.providerConfig.api !== "codex-cli") return undefined;
113
+
114
+ if (model.providerId === CODEX_SUBSCRIPTION_PROVIDER_ID) {
115
+ assertNoApiKeyConfig(model.providerConfig);
116
+ }
117
+
118
+ const resolvedApiKey =
119
+ model.providerConfig.apiKey === undefined ? undefined : await resolveFallbackApiKey();
120
+ const rawKey = model.providerConfig.apiKey;
121
+ const needsResolution =
122
+ rawKey === "secretref-managed" || (typeof rawKey === "object" && rawKey !== null);
123
+ if (needsResolution && !resolvedApiKey) {
124
+ throw new Error(`API key for provider "${model.providerId}" could not be resolved from secret ref`);
125
+ }
126
+
127
+ const effectiveConfig: ModelProviderConfig = {
128
+ ...model.providerConfig,
129
+ ...(resolvedApiKey ? { apiKey: resolvedApiKey } : {}),
130
+ };
131
+
132
+ // Let the provider surface its typed timeout before the generic outer deadline.
133
+ const callOptions = {
134
+ timeoutMs: options.timeoutMs === undefined
135
+ ? undefined
136
+ : Math.max(1, options.timeoutMs - Math.min(100, Math.max(5, Math.floor(options.timeoutMs / 5)))),
137
+ signal: options.signal,
138
+ };
139
+ // A host/benchmark runner on the process seam still wins. The core
140
+ // default runner does not: prefer the owning runtime so shutdown
141
+ // terminates the request that runtime started.
142
+ if (isCodexCliFallbackRunnerRegistered() && !(runner && isDefaultRegisteredCodexSubscriptionRunner())) {
143
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions);
144
+ }
145
+ if (runner) {
146
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions, runner);
147
+ }
148
+ ensureCodexSubscriptionRunnerRegistered();
149
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions);
150
+ }
151
+
152
+ export function abortReason(signal: AbortSignal | undefined): Error {
153
+ const reason = signal?.reason;
154
+ return reason instanceof Error ? reason : new Error("fallback LLM request aborted");
155
+ }
156
+
157
+ export function withCodexRuntimeShutdown<T extends { signal?: AbortSignal }>(
158
+ options: T,
159
+ runner: CodexCliFallbackRunner | undefined,
160
+ ): T {
161
+ if (!runner) return options;
162
+ const shutdown = getCodexSubscriptionShutdownSignal(runner);
163
+ if (!shutdown) return options;
164
+ return {
165
+ ...options,
166
+ signal: options.signal ? AbortSignal.any([options.signal, shutdown]) : shutdown,
167
+ };
168
+ }
@@ -939,6 +939,52 @@ test("fallback llm aborts codex-cli fallback requests when timeout wins", { conc
939
939
  }
940
940
  });
941
941
 
942
+ test("fallback llm timeout is a hard deadline when the provider never settles", { concurrency: false }, async () => {
943
+ clearModelsJsonCache();
944
+ clearSecretCache();
945
+
946
+ const restoreRunner = __codexCliFallbackTestHooks.setRunCodexCliForTest(
947
+ async (request) =>
948
+ await new Promise<never>(() => {
949
+ request.options.signal?.addEventListener("abort", () => undefined, { once: true });
950
+ }),
951
+ );
952
+
953
+ const llm = new FallbackLlmClient({
954
+ agents: {
955
+ defaults: {
956
+ model: {
957
+ primary: "codex-cli/gpt-custom",
958
+ },
959
+ },
960
+ },
961
+ models: {
962
+ providers: {
963
+ "codex-cli": {
964
+ baseUrl: "",
965
+ api: "codex-cli",
966
+ apiKey: "codex-test-key",
967
+ models: [],
968
+ },
969
+ },
970
+ },
971
+ });
972
+
973
+ try {
974
+ const started = Date.now();
975
+ const response = await llm.chatCompletion(
976
+ [{ role: "user", content: "Say OK" }],
977
+ { temperature: 0, maxTokens: 16, timeoutMs: 30 },
978
+ );
979
+ assert.equal(response, null);
980
+ assert.ok(Date.now() - started < 1_000, "outer timeout must settle without waiting on the provider");
981
+ } finally {
982
+ restoreRunner();
983
+ clearModelsJsonCache();
984
+ clearSecretCache();
985
+ }
986
+ });
987
+
942
988
  test("fallback llm can call Ollama native chat and suppress thinking", { concurrency: false }, async () => {
943
989
  clearModelsJsonCache();
944
990
  clearSecretCache();
@@ -16,10 +16,17 @@ import {
16
16
  import {
17
17
  CODEX_SUBSCRIPTION_PROVIDER_ID,
18
18
  codexSubscriptionBuiltinProviderConfig,
19
- ensureCodexSubscriptionRunnerRegistered,
19
+ getCodexSubscriptionRunnerForOwner,
20
20
  } from "./providers/codex-subscription.js";
21
21
  import { loadModelsJsonProviders } from "./models-json.js";
22
- import { callCodexCliFallback } from "./cli-fallback.js";
22
+ import {
23
+ abortReason,
24
+ isTerminalCodexSubscriptionError,
25
+ raceFallbackLlmDeadline,
26
+ tryCodexSubscriptionProvider,
27
+ withCodexRuntimeShutdown,
28
+ } from "./fallback-llm-codex-subscription.js";
29
+ import type { CodexCliFallbackRunner } from "./cli-fallback.js";
23
30
  import { resolveHomeDir } from "./runtime/env.js";
24
31
  import { expandTildePath } from "./utils/path.js";
25
32
 
@@ -85,6 +92,8 @@ export interface FallbackLlmRuntimeContext {
85
92
  getRuntimeAuthForModel?: GetRuntimeAuthForModelFn | null;
86
93
  resolveApiKeyForProvider?: ResolveApiKeyFn | null;
87
94
  workspaceDir?: string;
95
+ /** Per-runtime Codex child owner. Shutdown must terminate only this runner. */
96
+ codexSubscriptionRunner?: CodexCliFallbackRunner;
88
97
  }
89
98
 
90
99
  export function fallbackLlmRuntimeContextFromConfig(
@@ -98,6 +107,7 @@ export function fallbackLlmRuntimeContextFromConfig(
98
107
  workspaceDir: config.workspaceDir,
99
108
  resolveApiKeyForProvider: config.providerApiKeyResolver,
100
109
  getRuntimeAuthForModel: config.runtimeAuthForModelResolver,
110
+ codexSubscriptionRunner: getCodexSubscriptionRunnerForOwner(config),
101
111
  ...overrides,
102
112
  };
103
113
  }
@@ -224,12 +234,14 @@ export class FallbackLlmClient {
224
234
  log.warn("fallback LLM: no models configured in gateway");
225
235
  return null;
226
236
  }
237
+ options = withCodexRuntimeShutdown(options, this.runtimeContext.codexSubscriptionRunner);
227
238
 
228
239
  const runChain = async (
229
240
  initialOptions: FallbackLlmOptions,
230
241
  ): Promise<FallbackLlmResponse | null> => {
231
242
  let runOptions = initialOptions;
232
243
  let lastRejectedResponse: FallbackLlmResponse | null = null;
244
+ let terminalError: unknown;
233
245
  // Try each model in the chain
234
246
  for (let i = 0; i < models.length; i++) {
235
247
  if (runOptions.signal?.aborted) {
@@ -257,6 +269,9 @@ export class FallbackLlmClient {
257
269
  return response;
258
270
  }
259
271
  } catch (err) {
272
+ if (isTerminalCodexSubscriptionError(err) && runOptions.signal?.aborted) {
273
+ throw err;
274
+ }
260
275
  if (runOptions.signal?.aborted) {
261
276
  throw abortReason(runOptions.signal);
262
277
  }
@@ -289,6 +304,9 @@ export class FallbackLlmClient {
289
304
  continue;
290
305
  }
291
306
  } catch (retryError) {
307
+ if (isTerminalCodexSubscriptionError(retryError) && runOptions.signal?.aborted) {
308
+ throw retryError;
309
+ }
292
310
  if (runOptions.signal?.aborted) throw abortReason(runOptions.signal);
293
311
  const retryErrorMsg = runOptions.redactProviderErrors
294
312
  ? "provider error details redacted"
@@ -298,6 +316,9 @@ export class FallbackLlmClient {
298
316
  log.debug(
299
317
  `fallback LLM: ${model.modelString} unstructured retry failed (${retryErrorMsg})`,
300
318
  );
319
+ if (isTerminalCodexSubscriptionError(retryError)) {
320
+ terminalError = retryError;
321
+ }
301
322
  }
302
323
  continue;
303
324
  }
@@ -307,11 +328,20 @@ export class FallbackLlmClient {
307
328
  ? err.message
308
329
  : String(err);
309
330
  log.debug(`fallback LLM: ${model.modelString} failed (${errorMsg}), trying next...`);
331
+ if (isTerminalCodexSubscriptionError(err)) {
332
+ terminalError = err;
333
+ }
310
334
  // Continue to next model in chain
311
335
  }
312
336
  }
313
337
 
314
338
  log.warn(`fallback LLM: all ${models.length} models in chain failed`);
339
+ // A terminal typed provider failure must reach the caller when the
340
+ // chain is exhausted — the documented timeout/re-login guidance
341
+ // depends on it (issue #2833).
342
+ if (terminalError !== undefined) {
343
+ throw terminalError;
344
+ }
315
345
  return lastRejectedResponse;
316
346
  };
317
347
 
@@ -320,7 +350,6 @@ export class FallbackLlmClient {
320
350
  log.warn("fallback LLM: timed out before request started");
321
351
  return null;
322
352
  }
323
- let timeoutHandle: ReturnType<typeof setTimeout> | undefined;
324
353
  const controller = new AbortController();
325
354
  const onCallerAbort = (): void => {
326
355
  controller.abort(abortReason(options.signal));
@@ -331,22 +360,22 @@ export class FallbackLlmClient {
331
360
  }
332
361
  const timedOptions = { ...options, signal: controller.signal };
333
362
  const chain = runChain(timedOptions);
334
- chain.catch(() => {});
363
+ const guarded = chain.then(
364
+ (value) => value,
365
+ (err) => {
366
+ if (isTerminalCodexSubscriptionError(err)) throw err;
367
+ return null;
368
+ },
369
+ );
335
370
  try {
336
- return await Promise.race([
337
- chain,
338
- new Promise<null>((resolve) => {
339
- timeoutHandle = setTimeout(() => {
340
- log.warn(`fallback LLM: timed out after ${options.timeoutMs}ms`);
341
- controller.abort(
342
- new Error(`fallback LLM timed out after ${options.timeoutMs}ms`),
343
- );
344
- resolve(null);
345
- }, options.timeoutMs);
346
- }),
347
- ]);
371
+ const outcome = await raceFallbackLlmDeadline(guarded, options.timeoutMs, () => {
372
+ log.warn(`fallback LLM: timed out after ${options.timeoutMs}ms`);
373
+ controller.abort(
374
+ new Error(`fallback LLM timed out after ${options.timeoutMs}ms`),
375
+ );
376
+ });
377
+ return outcome.timedOut ? null : outcome.value;
348
378
  } finally {
349
- if (timeoutHandle) clearTimeout(timeoutHandle);
350
379
  options.signal?.removeEventListener("abort", onCallerAbort);
351
380
  }
352
381
  }
@@ -386,7 +415,9 @@ export class FallbackLlmClient {
386
415
  // Caller aborts must propagate (e.g. recall planner cancellation) — do
387
416
  // not swallow them as a provider failure, or abort-driven callers lose
388
417
  // cancellation and treat it as an extraction error (codex review).
389
- if (options.signal?.aborted) throw err;
418
+ // Terminal codex-subscription failures propagate for the same reason:
419
+ // their TimeoutError/auth guidance is the documented contract.
420
+ if (options.signal?.aborted || isTerminalCodexSubscriptionError(err)) throw err;
390
421
  log.warn("fallback LLM: chatCompletion threw during structured parse:", err);
391
422
  return { result: null, failureReason: "http_error" };
392
423
  }
@@ -643,24 +674,22 @@ export class FallbackLlmClient {
643
674
  messages: Array<{ role: "system" | "user" | "assistant"; content: string }>,
644
675
  options: FallbackLlmOptions,
645
676
  ): Promise<{ content: string; usage?: FallbackLlmResponse["usage"] } | null> {
646
- // Try the gateway's native runtime auth first — it handles all provider-
647
- // specific transforms (OAuth exchange, base URL rewrite, etc.)
648
- const runtimeAuth = model.providerConfig.api === "codex-cli"
649
- ? null
650
- : await this.resolveRuntimeAuth(model);
677
+ const codexResult = await tryCodexSubscriptionProvider(
678
+ model,
679
+ messages,
680
+ options,
681
+ () => this.resolveFallbackApiKey(model),
682
+ this.runtimeContext.codexSubscriptionRunner,
683
+ );
684
+ if (codexResult !== undefined) return codexResult;
685
+ const runtimeAuth = await this.resolveRuntimeAuth(model);
651
686
  const effectiveBaseUrl = runtimeAuth?.baseUrl ?? model.providerConfig.baseUrl;
652
- const resolvedApiKey = runtimeAuth?.apiKey
653
- ?? (
654
- model.providerConfig.api === "codex-cli" && model.providerConfig.apiKey === undefined
655
- ? undefined
656
- : await this.resolveFallbackApiKey(model)
657
- );
687
+ const resolvedApiKey = runtimeAuth?.apiKey ?? await this.resolveFallbackApiKey(model);
658
688
 
659
689
  // If the raw key looks like an unresolved secret ref and resolution fails,
660
690
  // skip this provider entirely so the chain falls through to the next.
661
691
  const rawKey = model.providerConfig.apiKey;
662
- const needsResolution = rawKey === "secretref-managed"
663
- || (typeof rawKey === "object" && rawKey !== null);
692
+ const needsResolution = rawKey === "secretref-managed" || (typeof rawKey === "object" && rawKey !== null);
664
693
  if (needsResolution && !resolvedApiKey) {
665
694
  throw new Error(`API key for provider "${model.providerId}" could not be resolved from secret ref`);
666
695
  }
@@ -675,18 +704,6 @@ export class FallbackLlmClient {
675
704
  return await this.callAnthropic(effectiveConfig, model.modelId, messages, options);
676
705
  }
677
706
 
678
- if (model.providerConfig.api === "codex-cli") {
679
- // Registers the core subprocess transport only when no host/benchmark
680
- // runner claimed the seam, so daemon/plugin runtimes work out of the box.
681
- ensureCodexSubscriptionRunnerRegistered();
682
- return await callCodexCliFallback(
683
- effectiveConfig,
684
- model.modelId,
685
- messages,
686
- { timeoutMs: options.timeoutMs, signal: options.signal },
687
- );
688
- }
689
-
690
707
  if (model.providerConfig.api === "ollama-chat") {
691
708
  return await this.callOllamaChat(effectiveConfig, model.modelId, messages, options);
692
709
  }
@@ -1125,11 +1142,6 @@ export class FallbackLlmClient {
1125
1142
  }
1126
1143
  }
1127
1144
 
1128
- function abortReason(signal: AbortSignal | undefined): Error {
1129
- const reason = signal?.reason;
1130
- return reason instanceof Error ? reason : new Error("fallback LLM request aborted");
1131
- }
1132
-
1133
1145
  function normalizeRuntimePath(value: unknown): string | undefined {
1134
1146
  if (typeof value !== "string") return undefined;
1135
1147
  const trimmed = value.trim();
package/src/index.ts CHANGED
@@ -150,8 +150,7 @@ export {
150
150
  type CodexCliFallbackResult,
151
151
  type CodexCliFallbackRunner,
152
152
  } from "./cli-fallback.js";
153
- export { CODEX_SUBSCRIPTION_PROVIDER_ID, codexSubscriptionBuiltinProviderConfig, createCodexSubscriptionRunner, ensureCodexSubscriptionRunnerRegistered, CodexSubscriptionAuthError, CodexSubscriptionConfigError, CodexSubscriptionTimeoutError } from "./providers/codex-subscription.js";
154
-
153
+ export { CODEX_SUBSCRIPTION_PROVIDER_ID, beginCodexSubscriptionShutdown, codexSubscriptionBuiltinProviderConfig, createCodexSubscriptionRunner, ensureCodexSubscriptionRunnerRegistered, getCodexSubscriptionRunnerForOwner, terminateActiveCodexSubscriptionChildren, CodexSubscriptionAuthError, CodexSubscriptionConfigError, CodexSubscriptionTimeoutError } from "./providers/codex-subscription.js";
155
154
  // ---------------------------------------------------------------------------
156
155
  // Smart buffer (issue #563)
157
156
  // ---------------------------------------------------------------------------
@@ -564,20 +563,7 @@ export {
564
563
  type StructuralSpawnFn,
565
564
  } from "./coding/structural-subprocess-provider.js";
566
565
 
567
- export {
568
- validateRequest,
569
- formatZodError,
570
- recallRequestSchema,
571
- observeRequestSchema,
572
- memoryStoreRequestSchema,
573
- suggestionSubmitRequestSchema,
574
- type SchemaValidationError,
575
- type SchemaName,
576
- type RecallRequest,
577
- type ObserveRequest,
578
- type MemoryStoreRequest,
579
- type SuggestionSubmitRequest,
580
- } from "./access-schema.js";
566
+ export * from "./access-schema.js";
581
567
 
582
568
  // ---------------------------------------------------------------------------
583
569
  // Day summary / LCM