@remnic/core 9.69.37 → 9.69.39

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 (697) hide show
  1. package/dist/access-admin-ops-surface.d.ts +14 -12
  2. package/dist/access-admin-ops-surface.js +86 -83
  3. package/dist/access-authorization-probe.d.ts +14 -12
  4. package/dist/access-authorization-probe.js +87 -84
  5. package/dist/access-boundary.d.ts +14 -12
  6. package/dist/access-boundary.js +86 -83
  7. package/dist/access-cli.js +197 -191
  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 +86 -83
  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 +87 -84
  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 +88 -85
  20. package/dist/access-http.d.ts +15 -13
  21. package/dist/access-http.js +108 -105
  22. package/dist/access-identity-continuity-surface.d.ts +12 -10
  23. package/dist/access-identity-continuity-surface.js +86 -83
  24. package/dist/access-lcm-surface.d.ts +14 -12
  25. package/dist/access-lcm-surface.js +86 -83
  26. package/dist/access-mcp.d.ts +14 -12
  27. package/dist/access-mcp.js +97 -94
  28. package/dist/access-memory-search-fanout.d.ts +3 -2
  29. package/dist/{access-namespace-preflight-CV5cHujx.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 +86 -83
  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 +86 -83
  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 +91 -88
  40. package/dist/access-operations.d.ts +17 -30
  41. package/dist/access-operations.js +96 -93
  42. package/dist/access-recall-concurrency.d.ts +14 -12
  43. package/dist/access-recall-concurrency.js +86 -83
  44. package/dist/access-recall-response.d.ts +14 -12
  45. package/dist/access-recall-response.js +86 -83
  46. package/dist/access-recall-surface.d.ts +14 -12
  47. package/dist/access-recall-surface.js +86 -83
  48. package/dist/access-schema.d.ts +210 -107
  49. package/dist/access-schema.js +9 -15
  50. package/dist/{access-service-DwHC7lcV.d.ts → access-service-MY4bsr_Q.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 +86 -83
  54. package/dist/access-surface-catalog.d.ts +14 -12
  55. package/dist/access-surface-catalog.js +88 -85
  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 -17
  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-FSRJDU63.js → auto-sync-RP4C6ZPF.js} +11 -9
  70. package/dist/{auto-sync-FSRJDU63.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/behavior-learner.d.ts +2 -1
  76. package/dist/behavior-signals.d.ts +2 -1
  77. package/dist/bootstrap.d.ts +12 -10
  78. package/dist/briefing-window.d.ts +3 -2
  79. package/dist/briefing.d.ts +3 -2
  80. package/dist/briefing.js +27 -26
  81. package/dist/buffer-surprise-report.d.ts +2 -1
  82. package/dist/buffer-turn-helpers.d.ts +2 -1
  83. package/dist/buffer.d.ts +3 -2
  84. package/dist/buffer.js +8 -8
  85. package/dist/bulk-import/index.d.ts +4 -3
  86. package/dist/calibration.d.ts +3 -1
  87. package/dist/calibration.js +4 -2
  88. package/dist/calibration.js.map +1 -1
  89. package/dist/capabilities.d.ts +2 -1
  90. package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
  91. package/dist/{capsule-merge-ZCXUPLNJ.js → capsule-merge-IPG4IOFP.js} +2 -2
  92. package/dist/{catalog-Cl4H8N89.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 +29 -28
  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-graph.js +2 -2
  102. package/dist/causal-trajectory.js +1 -1
  103. package/dist/{chunk-YHU5XUF4.js → chunk-27MKMTBY.js} +2 -2
  104. package/dist/{chunk-TK4FHQRN.js → chunk-2J3V5QEO.js} +4 -4
  105. package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
  106. package/dist/chunk-2QG4SLZI.js +44 -0
  107. package/dist/chunk-2QG4SLZI.js.map +1 -0
  108. package/dist/{chunk-TFRDUD3M.js → chunk-2ZTDRNCS.js} +2 -2
  109. package/dist/{chunk-PWPIERBM.js → chunk-37CAEC7E.js} +4 -4
  110. package/dist/{chunk-X7BCM2NA.js → chunk-3EKVN2OP.js} +2 -2
  111. package/dist/{chunk-S2ULTQZR.js → chunk-3N3PBBEH.js} +2 -2
  112. package/dist/{chunk-XCF3SFHD.js → chunk-3NPNBVFR.js} +2 -2
  113. package/dist/{chunk-JO5TQAKW.js → chunk-4BCHFSC7.js} +3 -3
  114. package/dist/{chunk-Q6D7EUSQ.js → chunk-4JVQRFZD.js} +10 -10
  115. package/dist/{chunk-YEDVOYL2.js → chunk-4RX5O34R.js} +2 -2
  116. package/dist/{chunk-JMPYZJQN.js → chunk-4RZLTZVM.js} +4 -4
  117. package/dist/{chunk-Q7JK6YEB.js → chunk-54NX5EG4.js} +2 -2
  118. package/dist/{chunk-GWK7FEUL.js → chunk-5FAGCOZD.js} +4 -4
  119. package/dist/{chunk-2PUE5P7C.js → chunk-5N4MZLEH.js} +5 -5
  120. package/dist/{chunk-B2YKTE7P.js → chunk-5SPCMAUC.js} +10 -10
  121. package/dist/{chunk-3OHISDDW.js → chunk-5U7K4W6K.js} +2 -2
  122. package/dist/{chunk-CYEMS2PG.js → chunk-5YCNDC3C.js} +3 -3
  123. package/dist/{chunk-PAAJWQH5.js → chunk-62D2PAAM.js} +4 -4
  124. package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
  125. package/dist/chunk-6AGWBKQU.js +94 -0
  126. package/dist/chunk-6AGWBKQU.js.map +1 -0
  127. package/dist/{chunk-326KUXIR.js → chunk-6EHM2AV7.js} +6 -6
  128. package/dist/{chunk-YM7YN37H.js → chunk-6ET2VII7.js} +2 -2
  129. package/dist/chunk-6H2G7RFT.js +58 -0
  130. package/dist/chunk-6H2G7RFT.js.map +1 -0
  131. package/dist/{chunk-A2YQL2FF.js → chunk-6P4REYKL.js} +5 -5
  132. package/dist/{chunk-7RKBPXY6.js → chunk-6YAIN5XJ.js} +2 -2
  133. package/dist/{chunk-2L5FSNPC.js → chunk-A7GQBJP5.js} +10 -10
  134. package/dist/{chunk-UYVXIY6C.js → chunk-AAZEKXUP.js} +2 -2
  135. package/dist/{chunk-JR6PP7UM.js → chunk-ACY4ZPF7.js} +28 -2
  136. package/dist/chunk-ACY4ZPF7.js.map +1 -0
  137. package/dist/{chunk-IQZ6ISFX.js → chunk-AECJY3GJ.js} +2 -2
  138. package/dist/{chunk-76DRU7C4.js → chunk-AENM6GKU.js} +2 -2
  139. package/dist/{chunk-KTRXQQFN.js → chunk-B36GUU6T.js} +4 -4
  140. package/dist/{chunk-TLHNF6GA.js → chunk-BV4ZKIZH.js} +1 -1
  141. package/dist/{chunk-ZWEZXVYH.js → chunk-CEO4DONG.js} +2 -2
  142. package/dist/chunk-CWTCMZGE.js +858 -0
  143. package/dist/chunk-CWTCMZGE.js.map +1 -0
  144. package/dist/{chunk-ZEPVWLCN.js → chunk-CZTPU65V.js} +25 -25
  145. package/dist/{chunk-TRU6JBOI.js → chunk-D545Z7UH.js} +3 -3
  146. package/dist/{chunk-6E5GYDIE.js → chunk-DGS34QSY.js} +2 -2
  147. package/dist/{chunk-65RENJGB.js → chunk-E2AWJ7KQ.js} +8 -4
  148. package/dist/chunk-E2AWJ7KQ.js.map +1 -0
  149. package/dist/{chunk-6Z3WW2MW.js → chunk-ENBPQEVU.js} +3 -3
  150. package/dist/{chunk-DOKKRZPH.js → chunk-EYKIDK33.js} +21 -19
  151. package/dist/chunk-EYKIDK33.js.map +1 -0
  152. package/dist/{chunk-PNEDMJ53.js → chunk-F4EHXVP7.js} +2 -2
  153. package/dist/{chunk-JPKZTCWZ.js → chunk-FNHLI2RE.js} +3 -3
  154. package/dist/{chunk-D2DIYEFW.js → chunk-FWWWUPOE.js} +12 -36
  155. package/dist/chunk-FWWWUPOE.js.map +1 -0
  156. package/dist/{chunk-M3MYMWXG.js → chunk-FXHOZGSE.js} +2 -2
  157. package/dist/{chunk-SAKA6PPL.js → chunk-GAS7KYC7.js} +5 -5
  158. package/dist/{chunk-LSLCFCCQ.js → chunk-GDYU6VF4.js} +1 -1
  159. package/dist/chunk-GDYU6VF4.js.map +1 -0
  160. package/dist/{chunk-2AR5JFD7.js → chunk-GG5FHZJJ.js} +6 -6
  161. package/dist/{chunk-WS3WNLST.js → chunk-GI4ZBWPQ.js} +3 -3
  162. package/dist/{chunk-JYR4LH76.js → chunk-GMIQV6DD.js} +2 -2
  163. package/dist/{chunk-WIKO4SCR.js → chunk-H3TKENU4.js} +5 -5
  164. package/dist/{chunk-ZLN7AROH.js → chunk-HIP6DKJJ.js} +5 -5
  165. package/dist/{chunk-SF6RFI5Z.js → chunk-HWLIMQE2.js} +2 -2
  166. package/dist/{chunk-JZYECQWN.js → chunk-IL6ODG6M.js} +2 -2
  167. package/dist/{chunk-GNR6YEWZ.js → chunk-IQEJIOEU.js} +6 -6
  168. package/dist/{chunk-BICNRVEC.js → chunk-IWO6QXWJ.js} +2 -2
  169. package/dist/{chunk-RN3MVLW3.js → chunk-IYKZJVL5.js} +1 -1
  170. package/dist/chunk-IYKZJVL5.js.map +1 -0
  171. package/dist/{chunk-42DJ235G.js → chunk-J272ODKJ.js} +2 -2
  172. package/dist/{chunk-R3TLVTWW.js → chunk-JDX2OA4R.js} +3 -3
  173. package/dist/{chunk-G5MO3VQA.js → chunk-JKKII6GX.js} +2 -2
  174. package/dist/{chunk-L5OXE4PX.js → chunk-JTQR6L2N.js} +3 -3
  175. package/dist/{chunk-VDX2J7OX.js → chunk-KQAFEZQX.js} +2 -2
  176. package/dist/{chunk-AKE4GGQ3.js → chunk-KQW3YGEN.js} +2 -2
  177. package/dist/{chunk-LMMQKZK3.js → chunk-L63GFNKL.js} +1 -1
  178. package/dist/{chunk-BRZWWUCJ.js → chunk-LMLGBG6H.js} +2 -2
  179. package/dist/{chunk-3IXB77DA.js → chunk-LPYYY4AP.js} +318 -278
  180. package/dist/chunk-LPYYY4AP.js.map +1 -0
  181. package/dist/{chunk-YEN4TREG.js → chunk-LQNRVPTV.js} +54 -567
  182. package/dist/chunk-LQNRVPTV.js.map +1 -0
  183. package/dist/{chunk-CQ7SSBO4.js → chunk-M6HBPLBA.js} +2 -2
  184. package/dist/chunk-MCRVQ5YQ.js +14 -0
  185. package/dist/chunk-MCRVQ5YQ.js.map +1 -0
  186. package/dist/{chunk-3YMDY3ZF.js → chunk-MUTVRKKY.js} +16 -16
  187. package/dist/{chunk-FCFAYMTU.js → chunk-NXGSONWM.js} +2 -2
  188. package/dist/{chunk-4WGAMREC.js → chunk-O4M4BDIJ.js} +2 -2
  189. package/dist/{chunk-5SYI2F47.js → chunk-O76F5QPP.js} +2 -2
  190. package/dist/{chunk-SROIT6QY.js → chunk-OPBFP4TF.js} +28 -11
  191. package/dist/chunk-OPBFP4TF.js.map +1 -0
  192. package/dist/{chunk-7MJBKZPU.js → chunk-P4ZAEYKG.js} +68 -34
  193. package/dist/chunk-P4ZAEYKG.js.map +1 -0
  194. package/dist/{chunk-57GDHV2D.js → chunk-PCOVEDPK.js} +6 -6
  195. package/dist/{chunk-PPTOAHTZ.js → chunk-PGAB2V53.js} +2 -2
  196. package/dist/{chunk-HHDTBYDJ.js → chunk-Q432REND.js} +2 -2
  197. package/dist/{chunk-XAITGGX5.js → chunk-Q4AUIFUA.js} +4 -4
  198. package/dist/{chunk-5LLQAUMI.js → chunk-Q7CLGFA7.js} +3 -3
  199. package/dist/{chunk-KUK56OPR.js → chunk-QHT7MOUF.js} +12 -12
  200. package/dist/{chunk-W6IJMWTZ.js → chunk-QTQ6XKGT.js} +4 -4
  201. package/dist/{chunk-FLLORID2.js → chunk-RLJHJQUY.js} +9 -9
  202. package/dist/{chunk-353KGBKY.js → chunk-RW4QNB4J.js} +4 -4
  203. package/dist/{chunk-GWQVMKUJ.js → chunk-SCXURCVT.js} +3 -3
  204. package/dist/{chunk-FQXJAC3T.js → chunk-SGUDMW2K.js} +4 -4
  205. package/dist/{chunk-LSDEIZ76.js → chunk-TA4C3XB7.js} +6 -6
  206. package/dist/{chunk-YIZ2EUUL.js → chunk-TNZNSMVJ.js} +94 -94
  207. package/dist/{chunk-CIYUWSMZ.js → chunk-TRLOFIQC.js} +2 -2
  208. package/dist/{chunk-TL7NLM2L.js → chunk-TSP5WH72.js} +2 -2
  209. package/dist/{chunk-3K6UFW5B.js → chunk-UHRZ324M.js} +8 -8
  210. package/dist/{chunk-JLXWRQNR.js → chunk-UZEHHXYC.js} +170 -167
  211. package/dist/chunk-UZEHHXYC.js.map +1 -0
  212. package/dist/{chunk-A5UQ52YQ.js → chunk-UZZ7SQT3.js} +5 -5
  213. package/dist/{chunk-GHX5PNXW.js → chunk-VBSNUH4J.js} +2 -2
  214. package/dist/{chunk-MR6LQVZ5.js → chunk-VJIE4D2I.js} +3 -3
  215. package/dist/{chunk-OTPXEE6W.js → chunk-VSL63CFJ.js} +15 -12
  216. package/dist/chunk-VSL63CFJ.js.map +1 -0
  217. package/dist/{chunk-2JGGZICG.js → chunk-WBM2MVBK.js} +2 -2
  218. package/dist/{chunk-CD3C4BJN.js → chunk-WIWLX65T.js} +2 -2
  219. package/dist/{chunk-GDDSXVWR.js → chunk-X4TD4O2F.js} +3 -3
  220. package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
  221. package/dist/{chunk-FPQDZCUX.js → chunk-XH3HGI2N.js} +2 -2
  222. package/dist/{chunk-C6KRO3SU.js → chunk-XVDZFTN5.js} +4 -4
  223. package/dist/{chunk-3SL52JKD.js → chunk-XVZA6VXC.js} +4 -4
  224. package/dist/chunk-YDVAM7S4.js +221 -0
  225. package/dist/chunk-YDVAM7S4.js.map +1 -0
  226. package/dist/chunk-YFTNZMGR.js +71 -0
  227. package/dist/chunk-YFTNZMGR.js.map +1 -0
  228. package/dist/{chunk-VELCIWJZ.js → chunk-YKREX63Z.js} +19 -10
  229. package/dist/chunk-YKREX63Z.js.map +1 -0
  230. package/dist/{chunk-BLHX5FQW.js → chunk-YUW66UAH.js} +2 -2
  231. package/dist/{chunk-DOQLHCSS.js → chunk-ZBW7A667.js} +2 -2
  232. package/dist/{chunk-4DPDIOVA.js → chunk-ZEGL7YCC.js} +2 -2
  233. package/dist/{chunk-VVX5PZFS.js → chunk-ZHXSOMYH.js} +2 -2
  234. package/dist/{chunk-GCBIXUPT.js → chunk-ZMWSYUUL.js} +2 -2
  235. package/dist/{chunk-X2QPKLPL.js → chunk-ZZUVBZL2.js} +2 -2
  236. package/dist/{cli-1mzd5TM4.d.ts → cli-DGq0MNpO.d.ts} +5 -5
  237. package/dist/cli-fallback.d.ts +4 -2
  238. package/dist/cli-fallback.js +3 -1
  239. package/dist/cli.d.ts +16 -14
  240. package/dist/cli.js +139 -134
  241. package/dist/coding/export-okf-codegraph.d.ts +2 -1
  242. package/dist/coding/export-okf-codegraph.js +26 -25
  243. package/dist/coding/export-okf-codegraph.js.map +1 -1
  244. package/dist/coding/pre-action-gate.d.ts +2 -1
  245. package/dist/coding/pre-action-gate.js +2 -2
  246. package/dist/compat/codex-cli-fallback.d.ts +1 -1
  247. package/dist/compat/codex-cli-fallback.js +3 -1
  248. package/dist/compat/codex-cli-fallback.js.map +1 -1
  249. package/dist/compounding/engine.d.ts +3 -2
  250. package/dist/compounding/engine.js +27 -26
  251. package/dist/compounding/preference-consolidator.d.ts +2 -1
  252. package/dist/compression-optimizer.d.ts +2 -1
  253. package/dist/config.d.ts +2 -1
  254. package/dist/config.js +18 -15
  255. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  256. package/dist/connectors/codex-materialize-runner.js +26 -25
  257. package/dist/connectors/codex-materialize.d.ts +2 -1
  258. package/dist/connectors/index.d.ts +2 -1
  259. package/dist/connectors/index.js +29 -28
  260. package/dist/consolidation-provenance-check.d.ts +3 -2
  261. package/dist/consolidation-undo.d.ts +3 -2
  262. package/dist/contradiction/index.d.ts +5 -3
  263. package/dist/contradiction/index.js +7 -7
  264. package/dist/{contradiction-scan-GVD4JJ7B.js → contradiction-scan-BSGKZHYJ.js} +4 -4
  265. package/dist/contradiction-scan-BSGKZHYJ.js.map +1 -0
  266. package/dist/converge-config.d.ts +2 -1
  267. package/dist/convergence-refresh.d.ts +3 -2
  268. package/dist/convergence-refresh.js +29 -28
  269. package/dist/conversation-index/backend.d.ts +2 -1
  270. package/dist/conversation-index/chunker.d.ts +2 -1
  271. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  272. package/dist/conversation-index/indexer.d.ts +2 -1
  273. package/dist/conversation-index/search.d.ts +2 -1
  274. package/dist/corpus-watermark.d.ts +2 -1
  275. package/dist/corpus-watermark.js +29 -28
  276. package/dist/cross-lingual-recall.d.ts +2 -1
  277. package/dist/day-summary.d.ts +2 -1
  278. package/dist/deep-recall-http-glue.d.ts +14 -12
  279. package/dist/deep-recall-http-glue.js +4 -14
  280. package/dist/deep-recall-mcp-tools.d.ts +14 -12
  281. package/dist/deep-recall-policy-llm.d.ts +3 -1
  282. package/dist/deep-recall-policy-llm.js +5 -3
  283. package/dist/deep-recall-seeds.d.ts +2 -1
  284. package/dist/delinearize.d.ts +2 -1
  285. package/dist/dependency-propagation-config.d.ts +2 -1
  286. package/dist/{dependency-propagation-delivery-Bua2ApHV.d.ts → dependency-propagation-delivery-Cq1ekOwV.d.ts} +1 -1
  287. package/dist/direct-answer-wiring.d.ts +2 -1
  288. package/dist/direct-answer.d.ts +2 -1
  289. package/dist/embedding-fallback.d.ts +2 -1
  290. package/dist/enrichment/index.d.ts +2 -1
  291. package/dist/entity-origin-fields.d.ts +2 -1
  292. package/dist/entity-retrieval.d.ts +3 -2
  293. package/dist/entity-retrieval.js +28 -27
  294. package/dist/entity-schema.d.ts +2 -1
  295. package/dist/episodic-context.d.ts +2 -1
  296. package/dist/eval-trajectory-contracts.d.ts +2 -1
  297. package/dist/eval-trajectory-store.d.ts +2 -1
  298. package/dist/eval-trajectory.d.ts +2 -1
  299. package/dist/event-order-recall.js +3 -3
  300. package/dist/explicit-capture.d.ts +12 -10
  301. package/dist/explicit-capture.js +6 -6
  302. package/dist/external-wiki-access.d.ts +14 -12
  303. package/dist/external-wiki-access.js +87 -84
  304. package/dist/external-wiki-collection-registration.d.ts +2 -1
  305. package/dist/external-wiki-collection.d.ts +2 -1
  306. package/dist/external-wiki-mcp-tools.d.ts +14 -12
  307. package/dist/extraction-error-classification.d.ts +2 -1
  308. package/dist/extraction-faithfulness.d.ts +3 -1
  309. package/dist/extraction-faithfulness.js +5 -3
  310. package/dist/extraction-judge-telemetry.d.ts +3 -1
  311. package/dist/extraction-judge-training.d.ts +3 -1
  312. package/dist/extraction-judge.d.ts +3 -1
  313. package/dist/extraction-judge.js +5 -3
  314. package/dist/extraction-liveness.d.ts +2 -1
  315. package/dist/extraction-normalization.d.ts +2 -1
  316. package/dist/extraction-prompt.d.ts +2 -1
  317. package/dist/extraction-source-grounding-rules.d.ts +2 -1
  318. package/dist/extraction-source-grounding.d.ts +2 -1
  319. package/dist/extraction-source-grounding.js +3 -3
  320. package/dist/extraction-span-config.d.ts +2 -1
  321. package/dist/extraction-span-materialize.d.ts +2 -1
  322. package/dist/extraction-span-materialize.js +2 -2
  323. package/dist/extraction.d.ts +2 -1
  324. package/dist/extraction.js +46 -45
  325. package/dist/fallback-llm-codex-subscription.d.ts +79 -0
  326. package/dist/fallback-llm-codex-subscription.js +22 -0
  327. package/dist/fallback-llm-codex-subscription.js.map +1 -0
  328. package/dist/fallback-llm.d.ts +5 -1
  329. package/dist/fallback-llm.js +4 -2
  330. package/dist/{first-start-migration-GZ45G5FS.js → first-start-migration-ZWMV5CX4.js} +6 -6
  331. package/dist/{generic-recall-paths-DJBADojG.d.ts → generic-recall-paths-BcySh_f9.d.ts} +1 -1
  332. package/dist/graph-append-error.d.ts +2 -1
  333. package/dist/graph-dashboard-diff.d.ts +2 -1
  334. package/dist/graph-dashboard-key.d.ts +2 -1
  335. package/dist/graph-dashboard-parser.d.ts +2 -1
  336. package/dist/{graph-edge-decay-ROSUPDX3.js → graph-edge-decay-MKIRZ762.js} +5 -5
  337. package/dist/graph-edge-decay-MKIRZ762.js.map +1 -0
  338. package/dist/graph-edge-reinforcement.d.ts +2 -1
  339. package/dist/graph-jsonl.d.ts +2 -1
  340. package/dist/graph-jsonl.js +3 -3
  341. package/dist/graph-path-reconstruction.d.ts +2 -1
  342. package/dist/graph-path-scoring.d.ts +2 -1
  343. package/dist/graph-snapshot.d.ts +2 -1
  344. package/dist/graph-snapshot.js +3 -3
  345. package/dist/graph.d.ts +2 -1
  346. package/dist/graph.js +2 -2
  347. package/dist/harmonic-retrieval.js +3 -3
  348. package/dist/importance.d.ts +2 -1
  349. package/dist/importers/index.d.ts +2 -1
  350. package/dist/importers/test-utils.d.ts +2 -1
  351. package/dist/in-flight-reads.d.ts +2 -1
  352. package/dist/{index-Bsy8ygLL.d.ts → index-DWOb4wz9.d.ts} +2 -2
  353. package/dist/index.d.ts +713 -705
  354. package/dist/index.js +419 -346
  355. package/dist/intent.d.ts +2 -1
  356. package/dist/lcm/engine.d.ts +2 -1
  357. package/dist/lcm/engine.js +4 -4
  358. package/dist/lcm/index.d.ts +2 -1
  359. package/dist/lcm/index.js +12 -12
  360. package/dist/lcm/tools.d.ts +2 -1
  361. package/dist/lifecycle.d.ts +2 -1
  362. package/dist/live-connectors-runner.d.ts +2 -1
  363. package/dist/local-llm-config.d.ts +7 -1
  364. package/dist/local-llm-config.js +12 -0
  365. package/dist/local-llm.d.ts +2 -1
  366. package/dist/local-model-endpoint.d.ts +2 -1
  367. package/dist/location/index.d.ts +4 -3
  368. package/dist/location/index.js +60 -59
  369. package/dist/maintenance/memory-governance.d.ts +2 -1
  370. package/dist/maintenance/memory-governance.js +26 -25
  371. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
  372. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +27 -26
  373. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  374. package/dist/maintenance/rebuild-memory-projection.js +28 -27
  375. package/dist/{maintenance-DItyBwTC.d.ts → maintenance-CW9wCzMP.d.ts} +3 -3
  376. package/dist/mcp-memory-inspector-app.d.ts +14 -12
  377. package/dist/memory-action-policy.d.ts +2 -1
  378. package/dist/memory-cache.d.ts +2 -1
  379. package/dist/memory-controller.d.ts +2 -1
  380. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  381. package/dist/memory-projection-store.d.ts +2 -1
  382. package/dist/memory-provenance.d.ts +2 -1
  383. package/dist/memory-snapshot.d.ts +2 -1
  384. package/dist/memory-subject-cli.d.ts +14 -12
  385. package/dist/memory-subject.d.ts +14 -12
  386. package/dist/memory-worth-outcomes.d.ts +3 -2
  387. package/dist/models-json.d.ts +2 -1
  388. package/dist/namespaces/migrate.d.ts +4 -3
  389. package/dist/namespaces/migrate.js +27 -26
  390. package/dist/namespaces/principal.d.ts +2 -1
  391. package/dist/namespaces/search.d.ts +2 -1
  392. package/dist/namespaces/search.js +6 -6
  393. package/dist/namespaces/storage.d.ts +4 -3
  394. package/dist/namespaces/storage.js +26 -25
  395. package/dist/native-knowledge.d.ts +2 -1
  396. package/dist/offline-sync-impression-drain.d.ts +2 -1
  397. package/dist/offline-sync-impression-drain.js +4 -4
  398. package/dist/operator-doctor-corpus.d.ts +2 -1
  399. package/dist/operator-doctor-corpus.js +30 -29
  400. package/dist/operator-doctor-replica.d.ts +2 -1
  401. package/dist/operator-toolkit.d.ts +4 -3
  402. package/dist/operator-toolkit.js +53 -49
  403. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  404. package/dist/orchestration/maintenance.d.ts +5 -4
  405. package/dist/orchestration/maintenance.js +39 -38
  406. package/dist/{orchestrator-DBUX-aAM.d.ts → orchestrator-ComHLm49.d.ts} +22 -11
  407. package/dist/orchestrator.d.ts +12 -10
  408. package/dist/orchestrator.js +224 -218
  409. package/dist/patterns-cli.d.ts +2 -1
  410. package/dist/{pipeline-BqgcOk1Z.d.ts → pipeline-CiYcqqhl.d.ts} +1 -1
  411. package/dist/policy-runtime.d.ts +2 -1
  412. package/dist/proactive-contention.d.ts +2 -1
  413. package/dist/provenance.d.ts +2 -1
  414. package/dist/provenance.js +2 -2
  415. package/dist/{public-http-CqtZ5kv3.d.ts → public-http-CuK4_Cb1.d.ts} +1 -1
  416. package/dist/qmd-preflight.d.ts +3 -2
  417. package/dist/{qmd-BD0ikV_Y.d.ts → qmd-qXD4vatU.d.ts} +1 -1
  418. package/dist/qmd-recall-cache.d.ts +2 -1
  419. package/dist/qmd.d.ts +3 -2
  420. package/dist/recall-concurrency-config.d.ts +2 -1
  421. package/dist/recall-disclosure-escalation.d.ts +2 -1
  422. package/dist/recall-explain-renderer.d.ts +2 -1
  423. package/dist/recall-explain-renderer.js +3 -3
  424. package/dist/recall-memory-map.d.ts +2 -1
  425. package/dist/recall-navigate-access.d.ts +2 -1
  426. package/dist/recall-navigate-access.js +2 -2
  427. package/dist/recall-navigate-disclosure.d.ts +2 -1
  428. package/dist/recall-navigate-disclosure.js +1 -1
  429. package/dist/recall-navigate.d.ts +2 -1
  430. package/dist/recall-navigate.js +2 -2
  431. package/dist/recall-planner-llm.d.ts +3 -1
  432. package/dist/recall-planner-llm.js +4 -2
  433. package/dist/recall-planner-llm.js.map +1 -1
  434. package/dist/recall-state-view-admission.d.ts +3 -2
  435. package/dist/recall-state-view-admission.js +9 -9
  436. package/dist/recall-state-view-anchors.d.ts +85 -0
  437. package/dist/recall-state-view-anchors.js +21 -0
  438. package/dist/recall-state-view-anchors.js.map +1 -0
  439. package/dist/recall-state-view-inject.js +2 -2
  440. package/dist/recall-state-view-render.js +2 -2
  441. package/dist/recall-state-view-widen.js +2 -2
  442. package/dist/recall-state-view-wire.js +3 -3
  443. package/dist/recall-state-view.d.ts +37 -1
  444. package/dist/recall-state-view.js +11 -3
  445. package/dist/recall-state.d.ts +2 -1
  446. package/dist/recall-tag-filter.d.ts +2 -1
  447. package/dist/recall-timings.d.ts +2 -1
  448. package/dist/recall-xray-cli.d.ts +2 -1
  449. package/dist/recall-xray-cli.js +4 -4
  450. package/dist/recall-xray-renderer.d.ts +2 -1
  451. package/dist/recall-xray-renderer.js +3 -3
  452. package/dist/recall-xray.d.ts +2 -1
  453. package/dist/recall-xray.js +2 -2
  454. package/dist/reconcile/cursor.d.ts +2 -1
  455. package/dist/reconcile/cursor.js +2 -2
  456. package/dist/reconcile/manifest.d.ts +2 -1
  457. package/dist/reconcile/manifest.js +4 -4
  458. package/dist/reconcile/plan.d.ts +2 -1
  459. package/dist/reconcile/plan.js +2 -2
  460. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  461. package/dist/replay/normalizers/claude.d.ts +2 -1
  462. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  463. package/dist/replay/normalizers/shared.d.ts +2 -1
  464. package/dist/replay/runner.d.ts +2 -1
  465. package/dist/replay/types.d.ts +2 -1
  466. package/dist/replica-divergence.d.ts +2 -1
  467. package/dist/replica-peers-config.d.ts +2 -1
  468. package/dist/{resolution-OHJZG45O.js → resolution-4GG3QZRJ.js} +8 -8
  469. package/dist/resolution-4GG3QZRJ.js.map +1 -0
  470. package/dist/resolve-auth-token.d.ts +2 -1
  471. package/dist/resume-bundles.js +19 -16
  472. package/dist/retrieval-agents.d.ts +3 -2
  473. package/dist/retrieval-tiers.d.ts +2 -1
  474. package/dist/routing/engine.d.ts +2 -1
  475. package/dist/routing/store.d.ts +2 -1
  476. package/dist/salvage-envelope.d.ts +2 -1
  477. package/dist/salvage-envelope.js +2 -2
  478. package/dist/schemas.d.ts +160 -160
  479. package/dist/{scope-profiles-BIJMsd0B.d.ts → scope-profiles-BT9rqC3w.d.ts} +1 -1
  480. package/dist/search/embed-helper.d.ts +2 -1
  481. package/dist/search/factory.d.ts +2 -1
  482. package/dist/search/factory.js +5 -5
  483. package/dist/search/index.d.ts +2 -1
  484. package/dist/search/index.js +13 -13
  485. package/dist/search/lancedb-backend.d.ts +2 -1
  486. package/dist/search/meilisearch-backend.d.ts +2 -1
  487. package/dist/search/noop-backend.d.ts +2 -1
  488. package/dist/search/orama-backend.d.ts +2 -1
  489. package/dist/search/port.d.ts +2 -1
  490. package/dist/search/remote-backend.d.ts +2 -1
  491. package/dist/{semantic-consolidation-D7sJocll.d.ts → semantic-consolidation-CmZi7thY.d.ts} +1 -1
  492. package/dist/semantic-consolidation.d.ts +3 -2
  493. package/dist/semantic-consolidation.js +27 -26
  494. package/dist/semantic-rule-promotion.js +26 -25
  495. package/dist/semantic-rule-verifier.d.ts +2 -1
  496. package/dist/semantic-rule-verifier.js +26 -25
  497. package/dist/{service-fwgEngUj.d.ts → service-CLkA7AQB.d.ts} +2 -2
  498. package/dist/session-observer-bands.d.ts +2 -1
  499. package/dist/session-observer-state.d.ts +2 -1
  500. package/dist/shared-context/manager.d.ts +8 -7
  501. package/dist/signal.d.ts +2 -1
  502. package/dist/source-agent-qualifier.d.ts +2 -1
  503. package/dist/source-agent-qualifier.js +41 -40
  504. package/dist/standup/build.js +27 -26
  505. package/dist/{storage-Cbll3-Tk.d.ts → storage-wvX01lht.d.ts} +1 -1
  506. package/dist/storage.d.ts +3 -2
  507. package/dist/storage.js +25 -24
  508. package/dist/subject-config.d.ts +2 -1
  509. package/dist/subject-config.js +2 -2
  510. package/dist/summarizer.d.ts +2 -1
  511. package/dist/summarizer.js +6 -3
  512. package/dist/summary-snapshot.d.ts +2 -1
  513. package/dist/support-passport/index.d.ts +17 -15
  514. package/dist/support-passport/index.js +92 -89
  515. package/dist/temporal-supersession.d.ts +3 -2
  516. package/dist/temporal-timeline-recall.d.ts +2 -1
  517. package/dist/temporal-validity.d.ts +2 -1
  518. package/dist/threading.d.ts +2 -1
  519. package/dist/tier-migration.d.ts +3 -2
  520. package/dist/tier-routing.d.ts +2 -1
  521. package/dist/tier-routing.js +3 -3
  522. package/dist/{tier-stats-VK5PCO2L.js → tier-stats-LUSUUNU6.js} +4 -4
  523. package/dist/topics.d.ts +2 -1
  524. package/dist/transcript.d.ts +2 -1
  525. package/dist/transfer/backup.js +2 -2
  526. package/dist/transfer/capsule-export.js +2 -2
  527. package/dist/transfer/capsule-import.js +3 -3
  528. package/dist/transfer/export-okf.d.ts +2 -1
  529. package/dist/transfer/export-okf.js +26 -25
  530. package/dist/transfer/types.d.ts +78 -78
  531. package/dist/trust-score-stage.d.ts +2 -1
  532. package/dist/trust-score.d.ts +2 -1
  533. package/dist/{types-48sPkWB0.d.ts → types-Cyr32ABj.d.ts} +3 -1
  534. package/dist/types.d.ts +2 -1
  535. package/dist/types.js +1 -1
  536. package/dist/utility-runtime.d.ts +2 -1
  537. package/dist/verified-recall.js +26 -25
  538. package/dist/who-knows-cli.d.ts +14 -12
  539. package/dist/who-knows-cli.js +27 -26
  540. package/dist/who-knows.d.ts +14 -12
  541. package/dist/who-knows.js +26 -25
  542. package/dist/write-envelope.d.ts +7 -1
  543. package/dist/write-envelope.js +1 -1
  544. package/package.json +2 -2
  545. package/src/access-boundary.ts +21 -6
  546. package/src/access-category-alias.test.ts +488 -51
  547. package/src/access-http.test.ts +249 -0
  548. package/src/access-http.ts +2 -0
  549. package/src/access-mcp.test.ts +2 -2
  550. package/src/access-observe-write-category.ts +25 -0
  551. package/src/access-observe-write-surface.ts +58 -57
  552. package/src/access-operations-batch.ts +28 -2
  553. package/src/access-operations.ts +6 -4
  554. package/src/access-schema.ts +106 -50
  555. package/src/access-service.ts +23 -9
  556. package/src/background-generation-config.ts +79 -0
  557. package/src/background-generation.test.ts +123 -0
  558. package/src/background-generation.ts +52 -0
  559. package/src/cli-fallback.ts +8 -2
  560. package/src/config.test.ts +172 -0
  561. package/src/config.ts +2 -43
  562. package/src/fallback-llm-codex-subscription.ts +168 -0
  563. package/src/fallback-llm.test.ts +46 -0
  564. package/src/fallback-llm.ts +60 -48
  565. package/src/index.ts +2 -16
  566. package/src/local-llm-config.ts +84 -0
  567. package/src/orchestration/recall-internal.ts +91 -74
  568. package/src/orchestration/recall-rerank-coordinator.ts +41 -4
  569. package/src/orchestration/recall-search-pipeline.ts +25 -18
  570. package/src/orchestration/recall-state-view-pipeline.test.ts +89 -0
  571. package/src/providers/codex-subscription.test.ts +804 -1
  572. package/src/providers/codex-subscription.ts +407 -65
  573. package/src/recall-rerank-coordinator.test.ts +153 -0
  574. package/src/recall-state-view-anchors.ts +163 -0
  575. package/src/recall-state-view-widen.ts +21 -7
  576. package/src/recall-state-view-zero-diff.test.ts +30 -0
  577. package/src/recall-state-view.test.ts +161 -0
  578. package/src/recall-state-view.ts +206 -35
  579. package/src/summarizer.ts +25 -0
  580. package/src/trust-score-recall-paths.test.ts +1 -1
  581. package/src/types.ts +3 -2
  582. package/src/write-envelope.ts +5 -0
  583. package/dist/chunk-255PC37A.js +0 -120
  584. package/dist/chunk-255PC37A.js.map +0 -1
  585. package/dist/chunk-3IXB77DA.js.map +0 -1
  586. package/dist/chunk-65RENJGB.js.map +0 -1
  587. package/dist/chunk-7MJBKZPU.js.map +0 -1
  588. package/dist/chunk-D2DIYEFW.js.map +0 -1
  589. package/dist/chunk-DOKKRZPH.js.map +0 -1
  590. package/dist/chunk-JLXWRQNR.js.map +0 -1
  591. package/dist/chunk-JR6PP7UM.js.map +0 -1
  592. package/dist/chunk-LSLCFCCQ.js.map +0 -1
  593. package/dist/chunk-OTPXEE6W.js.map +0 -1
  594. package/dist/chunk-RN3MVLW3.js.map +0 -1
  595. package/dist/chunk-SROIT6QY.js.map +0 -1
  596. package/dist/chunk-VELCIWJZ.js.map +0 -1
  597. package/dist/chunk-YEN4TREG.js.map +0 -1
  598. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → access-observe-write-category.js.map} +0 -0
  599. /package/dist/{contradiction-scan-GVD4JJ7B.js.map → background-generation-config.js.map} +0 -0
  600. /package/dist/{graph-edge-decay-ROSUPDX3.js.map → background-generation.js.map} +0 -0
  601. /package/dist/{resolution-OHJZG45O.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  602. /package/dist/{capsule-merge-ZCXUPLNJ.js.map → capsule-merge-IPG4IOFP.js.map} +0 -0
  603. /package/dist/{chunk-YHU5XUF4.js.map → chunk-27MKMTBY.js.map} +0 -0
  604. /package/dist/{chunk-TK4FHQRN.js.map → chunk-2J3V5QEO.js.map} +0 -0
  605. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
  606. /package/dist/{chunk-TFRDUD3M.js.map → chunk-2ZTDRNCS.js.map} +0 -0
  607. /package/dist/{chunk-PWPIERBM.js.map → chunk-37CAEC7E.js.map} +0 -0
  608. /package/dist/{chunk-X7BCM2NA.js.map → chunk-3EKVN2OP.js.map} +0 -0
  609. /package/dist/{chunk-S2ULTQZR.js.map → chunk-3N3PBBEH.js.map} +0 -0
  610. /package/dist/{chunk-XCF3SFHD.js.map → chunk-3NPNBVFR.js.map} +0 -0
  611. /package/dist/{chunk-JO5TQAKW.js.map → chunk-4BCHFSC7.js.map} +0 -0
  612. /package/dist/{chunk-Q6D7EUSQ.js.map → chunk-4JVQRFZD.js.map} +0 -0
  613. /package/dist/{chunk-YEDVOYL2.js.map → chunk-4RX5O34R.js.map} +0 -0
  614. /package/dist/{chunk-JMPYZJQN.js.map → chunk-4RZLTZVM.js.map} +0 -0
  615. /package/dist/{chunk-Q7JK6YEB.js.map → chunk-54NX5EG4.js.map} +0 -0
  616. /package/dist/{chunk-GWK7FEUL.js.map → chunk-5FAGCOZD.js.map} +0 -0
  617. /package/dist/{chunk-2PUE5P7C.js.map → chunk-5N4MZLEH.js.map} +0 -0
  618. /package/dist/{chunk-B2YKTE7P.js.map → chunk-5SPCMAUC.js.map} +0 -0
  619. /package/dist/{chunk-3OHISDDW.js.map → chunk-5U7K4W6K.js.map} +0 -0
  620. /package/dist/{chunk-CYEMS2PG.js.map → chunk-5YCNDC3C.js.map} +0 -0
  621. /package/dist/{chunk-PAAJWQH5.js.map → chunk-62D2PAAM.js.map} +0 -0
  622. /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
  623. /package/dist/{chunk-326KUXIR.js.map → chunk-6EHM2AV7.js.map} +0 -0
  624. /package/dist/{chunk-YM7YN37H.js.map → chunk-6ET2VII7.js.map} +0 -0
  625. /package/dist/{chunk-A2YQL2FF.js.map → chunk-6P4REYKL.js.map} +0 -0
  626. /package/dist/{chunk-7RKBPXY6.js.map → chunk-6YAIN5XJ.js.map} +0 -0
  627. /package/dist/{chunk-2L5FSNPC.js.map → chunk-A7GQBJP5.js.map} +0 -0
  628. /package/dist/{chunk-UYVXIY6C.js.map → chunk-AAZEKXUP.js.map} +0 -0
  629. /package/dist/{chunk-IQZ6ISFX.js.map → chunk-AECJY3GJ.js.map} +0 -0
  630. /package/dist/{chunk-76DRU7C4.js.map → chunk-AENM6GKU.js.map} +0 -0
  631. /package/dist/{chunk-KTRXQQFN.js.map → chunk-B36GUU6T.js.map} +0 -0
  632. /package/dist/{chunk-TLHNF6GA.js.map → chunk-BV4ZKIZH.js.map} +0 -0
  633. /package/dist/{chunk-ZWEZXVYH.js.map → chunk-CEO4DONG.js.map} +0 -0
  634. /package/dist/{chunk-ZEPVWLCN.js.map → chunk-CZTPU65V.js.map} +0 -0
  635. /package/dist/{chunk-TRU6JBOI.js.map → chunk-D545Z7UH.js.map} +0 -0
  636. /package/dist/{chunk-6E5GYDIE.js.map → chunk-DGS34QSY.js.map} +0 -0
  637. /package/dist/{chunk-6Z3WW2MW.js.map → chunk-ENBPQEVU.js.map} +0 -0
  638. /package/dist/{chunk-PNEDMJ53.js.map → chunk-F4EHXVP7.js.map} +0 -0
  639. /package/dist/{chunk-JPKZTCWZ.js.map → chunk-FNHLI2RE.js.map} +0 -0
  640. /package/dist/{chunk-M3MYMWXG.js.map → chunk-FXHOZGSE.js.map} +0 -0
  641. /package/dist/{chunk-SAKA6PPL.js.map → chunk-GAS7KYC7.js.map} +0 -0
  642. /package/dist/{chunk-2AR5JFD7.js.map → chunk-GG5FHZJJ.js.map} +0 -0
  643. /package/dist/{chunk-WS3WNLST.js.map → chunk-GI4ZBWPQ.js.map} +0 -0
  644. /package/dist/{chunk-JYR4LH76.js.map → chunk-GMIQV6DD.js.map} +0 -0
  645. /package/dist/{chunk-WIKO4SCR.js.map → chunk-H3TKENU4.js.map} +0 -0
  646. /package/dist/{chunk-ZLN7AROH.js.map → chunk-HIP6DKJJ.js.map} +0 -0
  647. /package/dist/{chunk-SF6RFI5Z.js.map → chunk-HWLIMQE2.js.map} +0 -0
  648. /package/dist/{chunk-JZYECQWN.js.map → chunk-IL6ODG6M.js.map} +0 -0
  649. /package/dist/{chunk-GNR6YEWZ.js.map → chunk-IQEJIOEU.js.map} +0 -0
  650. /package/dist/{chunk-BICNRVEC.js.map → chunk-IWO6QXWJ.js.map} +0 -0
  651. /package/dist/{chunk-42DJ235G.js.map → chunk-J272ODKJ.js.map} +0 -0
  652. /package/dist/{chunk-R3TLVTWW.js.map → chunk-JDX2OA4R.js.map} +0 -0
  653. /package/dist/{chunk-G5MO3VQA.js.map → chunk-JKKII6GX.js.map} +0 -0
  654. /package/dist/{chunk-L5OXE4PX.js.map → chunk-JTQR6L2N.js.map} +0 -0
  655. /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
  656. /package/dist/{chunk-AKE4GGQ3.js.map → chunk-KQW3YGEN.js.map} +0 -0
  657. /package/dist/{chunk-LMMQKZK3.js.map → chunk-L63GFNKL.js.map} +0 -0
  658. /package/dist/{chunk-BRZWWUCJ.js.map → chunk-LMLGBG6H.js.map} +0 -0
  659. /package/dist/{chunk-CQ7SSBO4.js.map → chunk-M6HBPLBA.js.map} +0 -0
  660. /package/dist/{chunk-3YMDY3ZF.js.map → chunk-MUTVRKKY.js.map} +0 -0
  661. /package/dist/{chunk-FCFAYMTU.js.map → chunk-NXGSONWM.js.map} +0 -0
  662. /package/dist/{chunk-4WGAMREC.js.map → chunk-O4M4BDIJ.js.map} +0 -0
  663. /package/dist/{chunk-5SYI2F47.js.map → chunk-O76F5QPP.js.map} +0 -0
  664. /package/dist/{chunk-57GDHV2D.js.map → chunk-PCOVEDPK.js.map} +0 -0
  665. /package/dist/{chunk-PPTOAHTZ.js.map → chunk-PGAB2V53.js.map} +0 -0
  666. /package/dist/{chunk-HHDTBYDJ.js.map → chunk-Q432REND.js.map} +0 -0
  667. /package/dist/{chunk-XAITGGX5.js.map → chunk-Q4AUIFUA.js.map} +0 -0
  668. /package/dist/{chunk-5LLQAUMI.js.map → chunk-Q7CLGFA7.js.map} +0 -0
  669. /package/dist/{chunk-KUK56OPR.js.map → chunk-QHT7MOUF.js.map} +0 -0
  670. /package/dist/{chunk-W6IJMWTZ.js.map → chunk-QTQ6XKGT.js.map} +0 -0
  671. /package/dist/{chunk-FLLORID2.js.map → chunk-RLJHJQUY.js.map} +0 -0
  672. /package/dist/{chunk-353KGBKY.js.map → chunk-RW4QNB4J.js.map} +0 -0
  673. /package/dist/{chunk-GWQVMKUJ.js.map → chunk-SCXURCVT.js.map} +0 -0
  674. /package/dist/{chunk-FQXJAC3T.js.map → chunk-SGUDMW2K.js.map} +0 -0
  675. /package/dist/{chunk-LSDEIZ76.js.map → chunk-TA4C3XB7.js.map} +0 -0
  676. /package/dist/{chunk-YIZ2EUUL.js.map → chunk-TNZNSMVJ.js.map} +0 -0
  677. /package/dist/{chunk-CIYUWSMZ.js.map → chunk-TRLOFIQC.js.map} +0 -0
  678. /package/dist/{chunk-TL7NLM2L.js.map → chunk-TSP5WH72.js.map} +0 -0
  679. /package/dist/{chunk-3K6UFW5B.js.map → chunk-UHRZ324M.js.map} +0 -0
  680. /package/dist/{chunk-A5UQ52YQ.js.map → chunk-UZZ7SQT3.js.map} +0 -0
  681. /package/dist/{chunk-GHX5PNXW.js.map → chunk-VBSNUH4J.js.map} +0 -0
  682. /package/dist/{chunk-MR6LQVZ5.js.map → chunk-VJIE4D2I.js.map} +0 -0
  683. /package/dist/{chunk-2JGGZICG.js.map → chunk-WBM2MVBK.js.map} +0 -0
  684. /package/dist/{chunk-CD3C4BJN.js.map → chunk-WIWLX65T.js.map} +0 -0
  685. /package/dist/{chunk-GDDSXVWR.js.map → chunk-X4TD4O2F.js.map} +0 -0
  686. /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
  687. /package/dist/{chunk-FPQDZCUX.js.map → chunk-XH3HGI2N.js.map} +0 -0
  688. /package/dist/{chunk-C6KRO3SU.js.map → chunk-XVDZFTN5.js.map} +0 -0
  689. /package/dist/{chunk-3SL52JKD.js.map → chunk-XVZA6VXC.js.map} +0 -0
  690. /package/dist/{chunk-BLHX5FQW.js.map → chunk-YUW66UAH.js.map} +0 -0
  691. /package/dist/{chunk-DOQLHCSS.js.map → chunk-ZBW7A667.js.map} +0 -0
  692. /package/dist/{chunk-4DPDIOVA.js.map → chunk-ZEGL7YCC.js.map} +0 -0
  693. /package/dist/{chunk-VVX5PZFS.js.map → chunk-ZHXSOMYH.js.map} +0 -0
  694. /package/dist/{chunk-GCBIXUPT.js.map → chunk-ZMWSYUUL.js.map} +0 -0
  695. /package/dist/{chunk-X2QPKLPL.js.map → chunk-ZZUVBZL2.js.map} +0 -0
  696. /package/dist/{first-start-migration-GZ45G5FS.js.map → first-start-migration-ZWMV5CX4.js.map} +0 -0
  697. /package/dist/{tier-stats-VK5PCO2L.js.map → tier-stats-LUSUUNU6.js.map} +0 -0
@@ -0,0 +1,858 @@
1
+ import {
2
+ callCodexCliFallback,
3
+ getCodexCliFallbackRunnerForProcess,
4
+ isCodexCliFallbackRunnerRegistered,
5
+ normalizeCodexCliTimeoutMs,
6
+ setCodexCliFallbackRunnerForProcess
7
+ } from "./chunk-E2AWJ7KQ.js";
8
+ import {
9
+ launchProcess
10
+ } from "./chunk-ZEFVK7XC.js";
11
+ import {
12
+ expandTildePath
13
+ } from "./chunk-6KH5NLQS.js";
14
+ import {
15
+ raceAbort
16
+ } from "./chunk-BTTPKDIL.js";
17
+ import {
18
+ log
19
+ } from "./chunk-3WCASNQZ.js";
20
+
21
+ // src/providers/codex-subscription.ts
22
+ import { mkdir, mkdtemp, readFile, rm, stat } from "fs/promises";
23
+ import os from "os";
24
+ import path from "path";
25
+ var CODEX_SUBSCRIPTION_PROVIDER_ID = "codex-subscription";
26
+ var CODEX_EXECUTABLE_ENV = "REMNIC_CODEX_EXECUTABLE";
27
+ var DEFAULT_REASONING_EFFORT = "medium";
28
+ var DEFAULT_TIMEOUT_MS = 12e4;
29
+ var LOGIN_STATUS_TIMEOUT_MS = 1e4;
30
+ var LOGIN_STATUS_CACHE_TTL_MS = 10 * 6e4;
31
+ var STDIO_LIMIT = 64e3;
32
+ var OUTPUT_SUMMARY_LIMIT = 500;
33
+ var PATH_BEARING_ENV_KEYS = Object.freeze({ CODEX_HOME: true, HOME: true, USERPROFILE: true });
34
+ var CODEX_RUNTIME_ENV_ALLOWLIST = Object.freeze({
35
+ ALL_PROXY: true,
36
+ APPDATA: true,
37
+ CODEX_HOME: true,
38
+ COLORTERM: true,
39
+ COMSPEC: true,
40
+ FORCE_COLOR: true,
41
+ HOME: true,
42
+ HOMEDRIVE: true,
43
+ HOMEPATH: true,
44
+ LANG: true,
45
+ LOCALAPPDATA: true,
46
+ LOGNAME: true,
47
+ NO_COLOR: true,
48
+ NODE_EXTRA_CA_CERTS: true,
49
+ NO_PROXY: true,
50
+ NUMBER_OF_PROCESSORS: true,
51
+ OS: true,
52
+ PATH: true,
53
+ PATHEXT: true,
54
+ PROGRAMDATA: true,
55
+ PROCESSOR_ARCHITECTURE: true,
56
+ HTTP_PROXY: true,
57
+ HTTPS_PROXY: true,
58
+ SHELL: true,
59
+ SSL_CERT_DIR: true,
60
+ SSL_CERT_FILE: true,
61
+ SYSTEMDRIVE: true,
62
+ SYSTEMROOT: true,
63
+ TEMP: true,
64
+ TERM: true,
65
+ TMP: true,
66
+ TMPDIR: true,
67
+ USER: true,
68
+ USERNAME: true,
69
+ USERPROFILE: true,
70
+ WINDIR: true,
71
+ XDG_CACHE_HOME: true,
72
+ XDG_CONFIG_HOME: true,
73
+ XDG_DATA_HOME: true,
74
+ XDG_RUNTIME_DIR: true
75
+ });
76
+ var LOGIN_OK_PATTERN = /logged in using chatgpt/i;
77
+ var LOGIN_API_KEY_PATTERN = /api key/i;
78
+ var AUTH_FAILURE_PATTERN = /\b401\b|\b403\b|unauthorized|forbidden|not logged in|no active|re-?authenticat|token expired|session expired|please log ?in/i;
79
+ var TIMEOUT_PATTERN = /timed out after \d+ms/i;
80
+ var SECRET_ECHO_PATTERNS = [
81
+ /sk-[A-Za-z0-9_-]{8,}/g,
82
+ /Bearer\s+[A-Za-z0-9._-]{8,}/g,
83
+ /eyJ[A-Za-z0-9._-]{10,}/g
84
+ ];
85
+ function codexSubscriptionBuiltinProviderConfig() {
86
+ return {
87
+ baseUrl: "codex-cli://subscription",
88
+ api: "codex-cli",
89
+ models: []
90
+ };
91
+ }
92
+ var CodexSubscriptionAuthError = class extends Error {
93
+ reason;
94
+ constructor(reason, message) {
95
+ super(message);
96
+ this.name = "CodexSubscriptionAuthError";
97
+ this.reason = reason;
98
+ }
99
+ };
100
+ var CodexSubscriptionConfigError = class extends Error {
101
+ constructor(message) {
102
+ super(message);
103
+ this.name = "CodexSubscriptionConfigError";
104
+ }
105
+ };
106
+ var CodexSubscriptionTimeoutError = class extends Error {
107
+ constructor(timeoutMs) {
108
+ super(`codex-subscription request timed out after ${timeoutMs}ms`);
109
+ this.name = "TimeoutError";
110
+ }
111
+ };
112
+ var loginStatusCache = /* @__PURE__ */ new Map();
113
+ var childrenByRunner = /* @__PURE__ */ new WeakMap();
114
+ var runnerByOwner = /* @__PURE__ */ new WeakMap();
115
+ var shutdownByRunner = /* @__PURE__ */ new WeakMap();
116
+ var defaultRegisteredRunner;
117
+ var coreRunnerRegistered = false;
118
+ function createCodexSubscriptionRunner(deps = {}) {
119
+ const envSource = deps.env ?? process.env;
120
+ const children = /* @__PURE__ */ new Set();
121
+ const shutdown = new AbortController();
122
+ const runnerDeps = {
123
+ ...deps,
124
+ runCodexExec: deps.runCodexExec ?? ((request) => runCodexExecSubprocess(request, children)),
125
+ runLoginStatus: deps.runLoginStatus ?? ((executable, env, timeoutMs, signal) => runLoginStatusSubprocess(executable, env, timeoutMs, signal, children))
126
+ };
127
+ const runner = (request) => {
128
+ const signal = request.options.signal ? AbortSignal.any([request.options.signal, shutdown.signal]) : shutdown.signal;
129
+ if (signal.aborted) {
130
+ return Promise.reject(abortErrorOf(signal));
131
+ }
132
+ return runCodexSubscriptionRequest(
133
+ { ...request, options: { ...request.options, signal } },
134
+ runnerDeps,
135
+ envSource
136
+ );
137
+ };
138
+ childrenByRunner.set(runner, children);
139
+ shutdownByRunner.set(runner, shutdown);
140
+ return runner;
141
+ }
142
+ function getCodexSubscriptionRunnerForOwner(owner) {
143
+ let runner = runnerByOwner.get(owner);
144
+ const shutdown = runner ? shutdownByRunner.get(runner) : void 0;
145
+ if (!runner || shutdown?.signal.aborted) {
146
+ runner = createCodexSubscriptionRunner();
147
+ runnerByOwner.set(owner, runner);
148
+ }
149
+ return runner;
150
+ }
151
+ function getCodexSubscriptionShutdownSignal(runner) {
152
+ return shutdownByRunner.get(runner)?.signal;
153
+ }
154
+ function ensureCodexSubscriptionRunnerRegistered(deps = {}) {
155
+ if (isCodexCliFallbackRunnerRegistered()) return false;
156
+ defaultRegisteredRunner = createCodexSubscriptionRunner(deps);
157
+ setCodexCliFallbackRunnerForProcess(defaultRegisteredRunner);
158
+ coreRunnerRegistered = true;
159
+ return true;
160
+ }
161
+ function isDefaultRegisteredCodexSubscriptionRunner() {
162
+ return defaultRegisteredRunner !== void 0 && getCodexCliFallbackRunnerForProcess() === defaultRegisteredRunner;
163
+ }
164
+ function terminateActiveCodexSubscriptionChildren(signal = "SIGTERM", runner) {
165
+ const target = runner ?? defaultRegisteredRunner;
166
+ if (!target) return;
167
+ const shutdown = shutdownByRunner.get(target);
168
+ if (shutdown && !shutdown.signal.aborted) {
169
+ shutdown.abort(new DOMException("The operation was aborted.", "AbortError"));
170
+ }
171
+ const pids = childrenByRunner.get(target);
172
+ if (!pids) return;
173
+ for (const pid of pids) {
174
+ terminateCodexChildPid(pid, signal);
175
+ }
176
+ }
177
+ function beginCodexSubscriptionShutdown(runner, forceKillAfterMs = 1e3) {
178
+ terminateActiveCodexSubscriptionChildren("SIGTERM", runner);
179
+ const timer = setTimeout(() => {
180
+ terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
181
+ }, forceKillAfterMs);
182
+ timer.unref();
183
+ return () => {
184
+ clearTimeout(timer);
185
+ terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
186
+ };
187
+ }
188
+ async function runCodexSubscriptionRequest(request, deps, envSource) {
189
+ const { config } = request;
190
+ assertNoApiKeyConfig(config);
191
+ const executable = resolveExecutable(config, envSource);
192
+ const env = buildIsolatedEnv(envSource);
193
+ const providerTimeoutMs = config.retryOptions?.timeoutMs !== void 0 ? normalizeCodexCliTimeoutMs(config.retryOptions.timeoutMs) : void 0;
194
+ const timeoutMs = request.options.timeoutMs ?? providerTimeoutMs ?? DEFAULT_TIMEOUT_MS;
195
+ const now = deps.now ?? Date.now;
196
+ const deadlineStartedAt = now();
197
+ if (request.options.signal?.aborted) {
198
+ throw abortErrorOf(request.options.signal);
199
+ }
200
+ await assertSubscriptionLogin(executable, env, deps, {
201
+ loginStatusTimeoutMs: Math.min(LOGIN_STATUS_TIMEOUT_MS, timeoutMs),
202
+ callerTimeoutMs: timeoutMs,
203
+ deadlineStartedAt,
204
+ signal: request.options.signal
205
+ });
206
+ if (request.options.signal?.aborted) {
207
+ throw abortErrorOf(request.options.signal);
208
+ }
209
+ const remainingTimeoutMs = timeoutMs - (now() - deadlineStartedAt);
210
+ if (remainingTimeoutMs <= 0) {
211
+ throw new CodexSubscriptionTimeoutError(timeoutMs);
212
+ }
213
+ let tempDir;
214
+ try {
215
+ tempDir = await mkdtemp(path.join(deps.tmpdir?.() ?? os.tmpdir(), "remnic-codex-sub-"));
216
+ const workspacePath = path.join(tempDir, "workspace");
217
+ const outputPath = path.join(tempDir, "last-message.txt");
218
+ await mkdir(workspacePath, { recursive: true });
219
+ const runCodexExec = deps.runCodexExec;
220
+ const result = await runCodexExec({
221
+ executable,
222
+ args: buildExecArgs(request.modelId, config, workspacePath, outputPath),
223
+ input: buildPrompt(request.messages),
224
+ env,
225
+ outputPath,
226
+ workspacePath,
227
+ timeoutMs: remainingTimeoutMs,
228
+ signal: request.options.signal
229
+ });
230
+ if (result.status !== 0) {
231
+ const failure = execFailureError(result, remainingTimeoutMs, executable, env);
232
+ if (failure instanceof CodexSubscriptionTimeoutError) {
233
+ throw failure;
234
+ }
235
+ if (request.options.signal?.aborted) {
236
+ throw abortErrorOf(request.options.signal);
237
+ }
238
+ throw failure;
239
+ }
240
+ if (request.options.signal?.aborted) {
241
+ throw abortErrorOf(request.options.signal);
242
+ }
243
+ const content = result.outputText.trim();
244
+ if (content.length === 0) {
245
+ throw new Error(
246
+ `codex-subscription: codex exec returned no final message (${summarizeOutput(result.stderr, result.stdout)})`
247
+ );
248
+ }
249
+ return { content, ...usageFrom(result) };
250
+ } finally {
251
+ if (tempDir) {
252
+ await rm(tempDir, { force: true, recursive: true }).catch(() => {
253
+ });
254
+ }
255
+ }
256
+ }
257
+ function assertNoApiKeyConfig(config) {
258
+ if (config.apiKey !== void 0 && config.apiKey !== "") {
259
+ throw new CodexSubscriptionConfigError(
260
+ `${CODEX_SUBSCRIPTION_PROVIDER_ID} does not accept apiKey configuration: it authenticates through the Codex CLI login. Remove the apiKey field and run \`codex login\` with a ChatGPT account instead.`
261
+ );
262
+ }
263
+ }
264
+ function resolveExecutable(config, env) {
265
+ const configured = config.codexCliExecutable ?? config.executable ?? env[CODEX_EXECUTABLE_ENV] ?? "codex";
266
+ const expanded = expandTildePath(String(configured).trim());
267
+ if (expanded.trim().length === 0) {
268
+ throw new CodexSubscriptionConfigError(`${CODEX_EXECUTABLE_ENV} / executable must not be empty`);
269
+ }
270
+ if (expanded.includes("/") || expanded.includes("\\")) {
271
+ return path.resolve(expanded);
272
+ }
273
+ return expanded;
274
+ }
275
+ function buildIsolatedEnv(source) {
276
+ const env = {};
277
+ for (const [key, value] of Object.entries(source)) {
278
+ if (value !== void 0 && isAllowedEnvKey(key)) {
279
+ env[key] = PATH_BEARING_ENV_KEYS[key.toUpperCase()] === true ? normalizePathEnvValue(value) : value;
280
+ }
281
+ }
282
+ return env;
283
+ }
284
+ function normalizePathEnvValue(value) {
285
+ const trimmed = value.trim();
286
+ if (trimmed.length === 0) {
287
+ return value;
288
+ }
289
+ const expanded = expandTildePath(trimmed);
290
+ return path.isAbsolute(expanded) ? expanded : path.resolve(expanded);
291
+ }
292
+ function isAllowedEnvKey(key) {
293
+ const normalized = key.toUpperCase();
294
+ return CODEX_RUNTIME_ENV_ALLOWLIST[normalized] === true || normalized.startsWith("LC_");
295
+ }
296
+ async function assertSubscriptionLogin(executable, env, deps, ctx) {
297
+ const now = deps.now ?? Date.now;
298
+ const cacheKey = `${executable}\0${resolveCodexAuthHome(env) ?? ""}`;
299
+ const cached = loginStatusCache.get(cacheKey);
300
+ if (cached && now() - cached.at < LOGIN_STATUS_CACHE_TTL_MS) {
301
+ if (!cached.settled || await authStoreFingerprint(env) === cached.fingerprint) {
302
+ await waitForLoginEntry(cached, cacheKey, ctx, now);
303
+ return;
304
+ }
305
+ }
306
+ loginStatusCache.delete(cacheKey);
307
+ if (ctx.signal?.aborted) {
308
+ throw abortErrorOf(ctx.signal);
309
+ }
310
+ const entry = {
311
+ at: now(),
312
+ fingerprint: null,
313
+ waiters: 0,
314
+ settled: false,
315
+ controller: new AbortController(),
316
+ promise: Promise.resolve(void 0)
317
+ };
318
+ entry.promise = runLoginStatusCheck(executable, env, deps, ctx, entry);
319
+ entry.promise.then(
320
+ () => {
321
+ entry.settled = true;
322
+ },
323
+ () => {
324
+ entry.settled = true;
325
+ if (loginStatusCache.get(cacheKey) === entry) {
326
+ loginStatusCache.delete(cacheKey);
327
+ }
328
+ }
329
+ );
330
+ loginStatusCache.set(cacheKey, entry);
331
+ await waitForLoginEntry(entry, cacheKey, ctx, now);
332
+ }
333
+ async function runLoginStatusCheck(executable, env, deps, ctx, entry) {
334
+ const runLoginStatus = deps.runLoginStatus;
335
+ const result = await runLoginStatus(executable, env, ctx.loginStatusTimeoutMs, entry.controller.signal);
336
+ const output = `${result.stdout}
337
+ ${result.stderr}`.trim();
338
+ if (TIMEOUT_PATTERN.test(output)) {
339
+ throw new CodexSubscriptionTimeoutError(ctx.loginStatusTimeoutMs);
340
+ }
341
+ if (result.status === 0 && LOGIN_OK_PATTERN.test(output)) {
342
+ entry.fingerprint = await authStoreFingerprint(env);
343
+ return;
344
+ }
345
+ const apiKeyNote = LOGIN_API_KEY_PATTERN.test(output) ? " The CLI currently reports an API-key login; subscription extraction needs a ChatGPT login." : "";
346
+ throw new CodexSubscriptionAuthError(
347
+ "unauthenticated",
348
+ `codex-subscription: no ChatGPT-backed Codex login found. Run \`codex login\` and choose the ChatGPT account option, then retry.${apiKeyNote}`
349
+ );
350
+ }
351
+ async function waitForLoginEntry(entry, cacheKey, ctx, now) {
352
+ const remainingMs = ctx.callerTimeoutMs - (now() - ctx.deadlineStartedAt);
353
+ if (remainingMs <= 0) {
354
+ throw new CodexSubscriptionTimeoutError(ctx.callerTimeoutMs);
355
+ }
356
+ const signal = ctx.signal;
357
+ let rejectOnAbort;
358
+ const abortWait = new Promise((_resolve, reject) => {
359
+ rejectOnAbort = reject;
360
+ });
361
+ const onAbort = () => {
362
+ if (signal === void 0) return;
363
+ rejectOnAbort(abortErrorOf(signal));
364
+ };
365
+ signal?.addEventListener("abort", onAbort, { once: true });
366
+ entry.waiters++;
367
+ let deadlineTimer;
368
+ try {
369
+ await Promise.race([
370
+ entry.promise,
371
+ abortWait,
372
+ new Promise((_resolve, reject) => {
373
+ deadlineTimer = setTimeout(
374
+ () => reject(new CodexSubscriptionTimeoutError(ctx.callerTimeoutMs)),
375
+ remainingMs
376
+ );
377
+ })
378
+ ]);
379
+ } catch (err) {
380
+ if (signal?.aborted) {
381
+ throw abortErrorOf(signal);
382
+ }
383
+ throw err;
384
+ } finally {
385
+ clearTimeout(deadlineTimer);
386
+ signal?.removeEventListener("abort", onAbort);
387
+ entry.waiters--;
388
+ if (entry.waiters <= 0 && !entry.settled) {
389
+ entry.controller.abort();
390
+ if (loginStatusCache.get(cacheKey) === entry) {
391
+ loginStatusCache.delete(cacheKey);
392
+ }
393
+ }
394
+ }
395
+ }
396
+ async function authStoreFingerprint(env) {
397
+ const home = resolveCodexAuthHome(env);
398
+ if (!home) {
399
+ return null;
400
+ }
401
+ try {
402
+ const stats = await stat(path.join(home, "auth.json"));
403
+ return `${stats.mtimeMs}:${stats.size}`;
404
+ } catch {
405
+ return null;
406
+ }
407
+ }
408
+ function resolveCodexAuthHome(env) {
409
+ if (env.CODEX_HOME) return env.CODEX_HOME;
410
+ const profile = env.HOME ?? env.USERPROFILE;
411
+ return profile ? path.join(profile, ".codex") : void 0;
412
+ }
413
+ function buildExecArgs(modelId, config, workspacePath, outputPath) {
414
+ const reasoningEffort = readReasoningEffort(config) ?? DEFAULT_REASONING_EFFORT;
415
+ return [
416
+ "exec",
417
+ "--strict-config",
418
+ "--model",
419
+ modelId,
420
+ "--config",
421
+ `model_reasoning_effort=${JSON.stringify(reasoningEffort)}`,
422
+ "--config",
423
+ 'approval_policy="never"',
424
+ "--config",
425
+ 'web_search="disabled"',
426
+ "--disable",
427
+ "hooks",
428
+ "--disable",
429
+ "shell_tool",
430
+ "--disable",
431
+ "unified_exec",
432
+ "--disable",
433
+ "apps",
434
+ "--disable",
435
+ "plugins",
436
+ "--disable",
437
+ "remote_plugin",
438
+ "--disable",
439
+ "multi_agent",
440
+ "--disable",
441
+ "browser_use",
442
+ "--disable",
443
+ "browser_use_external",
444
+ "--disable",
445
+ "computer_use",
446
+ "--disable",
447
+ "image_generation",
448
+ "--disable",
449
+ "in_app_browser",
450
+ "--disable",
451
+ "goals",
452
+ "--disable",
453
+ "memories",
454
+ "--disable",
455
+ "chronicle",
456
+ "--disable",
457
+ "tool_suggest",
458
+ "--disable",
459
+ "workspace_dependencies",
460
+ "--disable",
461
+ "shell_snapshot",
462
+ "--ephemeral",
463
+ "--ignore-user-config",
464
+ "--ignore-rules",
465
+ "--sandbox",
466
+ "read-only",
467
+ "--cd",
468
+ workspacePath,
469
+ "--skip-git-repo-check",
470
+ "--json",
471
+ "--output-last-message",
472
+ outputPath,
473
+ "-"
474
+ ];
475
+ }
476
+ function readReasoningEffort(config) {
477
+ for (const value of [config.codexCliReasoningEffort, config.reasoningEffort]) {
478
+ if (typeof value === "string") {
479
+ const normalized = value.trim().toLowerCase();
480
+ if (normalized === "low" || normalized === "medium" || normalized === "high" || normalized === "xhigh") {
481
+ return normalized;
482
+ }
483
+ throw new CodexSubscriptionConfigError(
484
+ "codex-subscription reasoningEffort must be one of low, medium, high, xhigh (got unrecognized value)"
485
+ );
486
+ }
487
+ }
488
+ return void 0;
489
+ }
490
+ function buildPrompt(messages) {
491
+ const transcript = messages.map((message) => JSON.stringify({ role: message.role, content: message.content })).join("\n");
492
+ return [
493
+ "You are acting as an LLM completion endpoint for a memory-extraction pipeline, not as a coding agent.",
494
+ "Answer the request in the transcript below. Do not inspect files, run commands, browse, or use tools.",
495
+ "Return only the final answer text. If the request asks for JSON, return raw JSON only.",
496
+ "",
497
+ 'TRANSCRIPT (JSON Lines: one {"role":"...","content":"..."} object per message; newlines inside content are escaped):',
498
+ transcript
499
+ ].join("\n");
500
+ }
501
+ function execFailureError(result, timeoutMs, executable, env) {
502
+ const combined = `${result.stderr}
503
+ ${result.stdout}`;
504
+ if (TIMEOUT_PATTERN.test(combined)) {
505
+ return new CodexSubscriptionTimeoutError(timeoutMs);
506
+ }
507
+ if (AUTH_FAILURE_PATTERN.test(combined)) {
508
+ loginStatusCache.delete(`${executable}\0${env.CODEX_HOME ?? env.HOME ?? ""}`);
509
+ return new CodexSubscriptionAuthError(
510
+ "expired_or_revoked",
511
+ "codex-subscription: the Codex CLI rejected the request as unauthenticated (session expired or revoked). Run `codex login` again to re-authenticate, then retry."
512
+ );
513
+ }
514
+ const exitLabel = result.signal ? `signal ${result.signal}` : `exit ${result.status ?? "unknown"}`;
515
+ return new Error(
516
+ `codex-subscription: codex exec failed (${exitLabel}): ${summarizeOutput(result.stderr, result.stdout)}`
517
+ );
518
+ }
519
+ function summarizeOutput(stderr, stdout) {
520
+ const summary = [stderr.trim(), stdout.trim()].filter((part) => part.length > 0).join("\n");
521
+ if (summary.length === 0) {
522
+ return "no process output";
523
+ }
524
+ return redactSecretEchoes(summary).slice(-OUTPUT_SUMMARY_LIMIT);
525
+ }
526
+ function redactSecretEchoes(value) {
527
+ let redacted = value;
528
+ for (const pattern of SECRET_ECHO_PATTERNS) {
529
+ redacted = redacted.replace(pattern, "[redacted]");
530
+ }
531
+ return redacted;
532
+ }
533
+ function usageFrom(result) {
534
+ const usage = parseCodexJsonlUsage(`${result.stdout}
535
+ ${result.stderr}`);
536
+ if (!usage) {
537
+ return {};
538
+ }
539
+ return {
540
+ usage: {
541
+ inputTokens: usage.inputTokens,
542
+ outputTokens: usage.outputTokens,
543
+ totalTokens: usage.inputTokens + usage.outputTokens
544
+ }
545
+ };
546
+ }
547
+ function parseCodexJsonlUsage(output) {
548
+ let usage;
549
+ for (const line of output.split(/\r?\n/)) {
550
+ const trimmed = line.trim();
551
+ if (!trimmed.startsWith("{")) continue;
552
+ try {
553
+ const event = JSON.parse(trimmed);
554
+ if (event.type !== "turn.completed" || !event.usage) continue;
555
+ const inputTokens = readCounter(event.usage.input_tokens);
556
+ const outputTokens = readCounter(event.usage.output_tokens);
557
+ if (inputTokens !== void 0 && outputTokens !== void 0) {
558
+ usage = { inputTokens, outputTokens };
559
+ }
560
+ } catch {
561
+ }
562
+ }
563
+ return usage;
564
+ }
565
+ function readCounter(value) {
566
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
567
+ return void 0;
568
+ }
569
+ return value;
570
+ }
571
+ function abortErrorOf(signal) {
572
+ if (signal.reason instanceof CodexSubscriptionTimeoutError) return signal.reason;
573
+ const reason = signal.reason instanceof Error ? signal.reason : signal.reason !== void 0 ? new Error(String(signal.reason)) : new DOMException("The operation was aborted.", "AbortError");
574
+ const match = /fallback LLM timed out after (\d+)ms/i.exec(reason.message);
575
+ if (match) {
576
+ return new CodexSubscriptionTimeoutError(Number(match[1]));
577
+ }
578
+ return reason;
579
+ }
580
+ function appendBounded(existing, next) {
581
+ const redacted = redactSecretEchoes(existing + next);
582
+ return redacted.length > STDIO_LIMIT ? redacted.slice(-STDIO_LIMIT) : redacted;
583
+ }
584
+ async function runLoginStatusSubprocess(executable, env, timeoutMs, signal, children) {
585
+ return await runSubprocess(executable, ["login", "status"], {
586
+ env,
587
+ stdin: void 0,
588
+ timeoutMs,
589
+ timeoutLabel: "login status",
590
+ signal,
591
+ children
592
+ });
593
+ }
594
+ async function runCodexExecSubprocess(request, children) {
595
+ const result = await runSubprocess(request.executable, request.args, {
596
+ env: request.env,
597
+ stdin: request.input,
598
+ timeoutMs: request.timeoutMs,
599
+ timeoutLabel: "exec",
600
+ signal: request.signal,
601
+ cwd: request.workspacePath,
602
+ children
603
+ });
604
+ if (result.status === 124) return { ...result, outputText: "" };
605
+ let outputText = "";
606
+ try {
607
+ outputText = (await readFile(request.outputPath, "utf8")).trim();
608
+ } catch {
609
+ }
610
+ return { ...result, outputText };
611
+ }
612
+ async function runSubprocess(executable, args, options) {
613
+ return await new Promise((resolve, reject) => {
614
+ if (options.signal?.aborted) {
615
+ reject(abortErrorOf(options.signal));
616
+ return;
617
+ }
618
+ const child = launchProcess(executable, args, {
619
+ ...options.cwd ? { cwd: options.cwd } : {},
620
+ env: options.env,
621
+ stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"],
622
+ detached: process.platform !== "win32",
623
+ windowsHide: true
624
+ });
625
+ registerActiveCodexChild(child.pid, options.children);
626
+ let stdout = "";
627
+ let stderr = "";
628
+ let timedOut = false;
629
+ let settled = false;
630
+ let killTimeout;
631
+ const clearKillTimeout = () => {
632
+ if (killTimeout) {
633
+ clearTimeout(killTimeout);
634
+ killTimeout = void 0;
635
+ }
636
+ };
637
+ const terminate = (signal) => {
638
+ if (child.pid && process.platform !== "win32") {
639
+ try {
640
+ process.kill(-child.pid, signal);
641
+ return;
642
+ } catch {
643
+ }
644
+ }
645
+ child.kill(signal);
646
+ };
647
+ const scheduleForcedKill = () => {
648
+ clearKillTimeout();
649
+ killTimeout = setTimeout(() => terminate("SIGKILL"), 1e3);
650
+ killTimeout.unref();
651
+ };
652
+ const finish = (fn) => {
653
+ if (settled) return;
654
+ settled = true;
655
+ clearTimeout(timeout);
656
+ options.signal?.removeEventListener("abort", onAbort);
657
+ fn();
658
+ };
659
+ const settleTimeout = () => {
660
+ timedOut = true;
661
+ stderr = appendBounded(
662
+ stderr,
663
+ `
664
+ codex-subscription: ${options.timeoutLabel} timed out after ${options.timeoutMs}ms.`
665
+ );
666
+ finish(() => {
667
+ resolve({
668
+ status: 124,
669
+ signal: "SIGTERM",
670
+ stdout,
671
+ stderr
672
+ });
673
+ });
674
+ };
675
+ const onAbort = () => {
676
+ const reasonText = options.signal?.reason instanceof Error ? options.signal.reason.message : String(options.signal?.reason ?? "");
677
+ terminate("SIGTERM");
678
+ scheduleForcedKill();
679
+ if (/fallback LLM timed out after \d+ms/i.test(reasonText)) {
680
+ settleTimeout();
681
+ return;
682
+ }
683
+ finish(() => reject(abortErrorOf(options.signal)));
684
+ };
685
+ options.signal?.addEventListener("abort", onAbort, { once: true });
686
+ const timeout = options.timeoutMs ? setTimeout(() => {
687
+ terminate("SIGTERM");
688
+ scheduleForcedKill();
689
+ settleTimeout();
690
+ }, options.timeoutMs) : void 0;
691
+ timeout?.unref();
692
+ child.stdout?.setEncoding("utf8");
693
+ child.stderr?.setEncoding("utf8");
694
+ child.stdout?.on("data", (chunk) => {
695
+ stdout = appendBounded(stdout, chunk);
696
+ });
697
+ child.stderr?.on("data", (chunk) => {
698
+ stderr = appendBounded(stderr, chunk);
699
+ });
700
+ child.stdin?.on("error", (error) => {
701
+ stderr = appendBounded(stderr, `
702
+ codex-subscription: stdin error: ${error.code ?? error.message}`);
703
+ });
704
+ child.on("error", (error) => {
705
+ unregisterActiveCodexChild(child.pid, options.children);
706
+ finish(() => {
707
+ reject(
708
+ child.pid ? new Error(`codex-subscription: codex CLI failed after start: ${safeMessage(error)}`, { cause: error }) : new CodexSubscriptionAuthError(
709
+ "unauthenticated",
710
+ `codex-subscription: codex CLI not found at \`${executable}\` \u2014 install the Codex CLI and run \`codex login\` with a ChatGPT account, then retry.`
711
+ )
712
+ );
713
+ });
714
+ });
715
+ child.on("close", (status, signal) => {
716
+ clearKillTimeout();
717
+ unregisterActiveCodexChild(child.pid, options.children);
718
+ finish(() => {
719
+ resolve({
720
+ status: timedOut ? status === null || status === 0 ? 124 : status : status,
721
+ signal: timedOut ? signal ?? "SIGTERM" : signal,
722
+ stdout,
723
+ stderr
724
+ });
725
+ });
726
+ });
727
+ if (options.stdin !== void 0) {
728
+ try {
729
+ child.stdin?.end(options.stdin);
730
+ } catch (error) {
731
+ log.debug(`codex-subscription: failed writing prompt to stdin: ${safeMessage(error)}`);
732
+ }
733
+ }
734
+ });
735
+ }
736
+ function safeMessage(error) {
737
+ return error instanceof Error ? error.message : String(error);
738
+ }
739
+ function registerActiveCodexChild(pid, children) {
740
+ if (pid === void 0) return;
741
+ children.add(pid);
742
+ }
743
+ function unregisterActiveCodexChild(pid, children) {
744
+ if (pid === void 0) return;
745
+ children.delete(pid);
746
+ }
747
+ function terminateCodexChildPid(pid, signal) {
748
+ if (process.platform !== "win32") {
749
+ try {
750
+ process.kill(-pid, signal);
751
+ return;
752
+ } catch {
753
+ }
754
+ }
755
+ try {
756
+ process.kill(pid, signal);
757
+ } catch {
758
+ }
759
+ }
760
+
761
+ // src/fallback-llm-codex-subscription.ts
762
+ function isTerminalCodexSubscriptionError(error) {
763
+ return error instanceof CodexSubscriptionTimeoutError || error instanceof CodexSubscriptionAuthError || error instanceof CodexSubscriptionConfigError;
764
+ }
765
+ async function raceFallbackLlmDeadline(work, timeoutMs, abortOnTimeout) {
766
+ const deadline = new AbortController();
767
+ const timer = setTimeout(() => deadline.abort(), timeoutMs);
768
+ deadline.signal.addEventListener("abort", abortOnTimeout, { once: true });
769
+ try {
770
+ const value = await raceAbort(
771
+ work,
772
+ deadline.signal,
773
+ `fallback LLM timed out after ${timeoutMs}ms`
774
+ );
775
+ return { timedOut: false, value };
776
+ } catch (error) {
777
+ if (!deadline.signal.aborted) throw error;
778
+ const afterAbort = await Promise.race([
779
+ work.then(
780
+ (value) => ({ state: "value", value }),
781
+ (lateError) => ({ state: "error", error: lateError })
782
+ ),
783
+ new Promise((resolve) => {
784
+ setImmediate(() => resolve({ state: "pending" }));
785
+ })
786
+ ]);
787
+ if (afterAbort.state === "value") return { timedOut: false, value: afterAbort.value };
788
+ if (afterAbort.state === "error") throw afterAbort.error;
789
+ void work.then(
790
+ () => void 0,
791
+ () => void 0
792
+ );
793
+ return { timedOut: true };
794
+ } finally {
795
+ clearTimeout(timer);
796
+ deadline.signal.removeEventListener("abort", abortOnTimeout);
797
+ }
798
+ }
799
+ async function tryCodexSubscriptionProvider(model, messages, options, resolveFallbackApiKey, runner) {
800
+ if (model.providerConfig.api !== "codex-cli") return void 0;
801
+ if (model.providerId === CODEX_SUBSCRIPTION_PROVIDER_ID) {
802
+ assertNoApiKeyConfig(model.providerConfig);
803
+ }
804
+ const resolvedApiKey = model.providerConfig.apiKey === void 0 ? void 0 : await resolveFallbackApiKey();
805
+ const rawKey = model.providerConfig.apiKey;
806
+ const needsResolution = rawKey === "secretref-managed" || typeof rawKey === "object" && rawKey !== null;
807
+ if (needsResolution && !resolvedApiKey) {
808
+ throw new Error(`API key for provider "${model.providerId}" could not be resolved from secret ref`);
809
+ }
810
+ const effectiveConfig = {
811
+ ...model.providerConfig,
812
+ ...resolvedApiKey ? { apiKey: resolvedApiKey } : {}
813
+ };
814
+ const callOptions = {
815
+ timeoutMs: options.timeoutMs === void 0 ? void 0 : Math.max(1, options.timeoutMs - Math.min(100, Math.max(5, Math.floor(options.timeoutMs / 5)))),
816
+ signal: options.signal
817
+ };
818
+ if (isCodexCliFallbackRunnerRegistered() && !(runner && isDefaultRegisteredCodexSubscriptionRunner())) {
819
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions);
820
+ }
821
+ if (runner) {
822
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions, runner);
823
+ }
824
+ ensureCodexSubscriptionRunnerRegistered();
825
+ return await callCodexCliFallback(effectiveConfig, model.modelId, messages, callOptions);
826
+ }
827
+ function abortReason(signal) {
828
+ const reason = signal?.reason;
829
+ return reason instanceof Error ? reason : new Error("fallback LLM request aborted");
830
+ }
831
+ function withCodexRuntimeShutdown(options, runner) {
832
+ if (!runner) return options;
833
+ const shutdown = getCodexSubscriptionShutdownSignal(runner);
834
+ if (!shutdown) return options;
835
+ return {
836
+ ...options,
837
+ signal: options.signal ? AbortSignal.any([options.signal, shutdown]) : shutdown
838
+ };
839
+ }
840
+
841
+ export {
842
+ CODEX_SUBSCRIPTION_PROVIDER_ID,
843
+ codexSubscriptionBuiltinProviderConfig,
844
+ CodexSubscriptionAuthError,
845
+ CodexSubscriptionConfigError,
846
+ CodexSubscriptionTimeoutError,
847
+ createCodexSubscriptionRunner,
848
+ getCodexSubscriptionRunnerForOwner,
849
+ ensureCodexSubscriptionRunnerRegistered,
850
+ terminateActiveCodexSubscriptionChildren,
851
+ beginCodexSubscriptionShutdown,
852
+ isTerminalCodexSubscriptionError,
853
+ raceFallbackLlmDeadline,
854
+ tryCodexSubscriptionProvider,
855
+ abortReason,
856
+ withCodexRuntimeShutdown
857
+ };
858
+ //# sourceMappingURL=chunk-CWTCMZGE.js.map