@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.
- package/dist/access-admin-ops-surface.d.ts +14 -12
- package/dist/access-admin-ops-surface.js +86 -83
- package/dist/access-authorization-probe.d.ts +14 -12
- package/dist/access-authorization-probe.js +87 -84
- package/dist/access-boundary.d.ts +14 -12
- package/dist/access-boundary.js +86 -83
- package/dist/access-cli.js +197 -191
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +2 -1
- package/dist/access-extraction-force-flush.d.ts +14 -12
- package/dist/access-extraction-force-flush.js +86 -83
- package/dist/access-health-types.d.ts +2 -1
- package/dist/access-http-briefing.d.ts +14 -12
- package/dist/access-http-briefing.js +87 -84
- package/dist/access-http-lcm-compaction.d.ts +14 -12
- package/dist/access-http-lifecycle-flush.d.ts +14 -12
- package/dist/access-http-offline-stream.d.ts +14 -12
- package/dist/access-http-query.d.ts +3 -2
- package/dist/access-http-query.js +88 -85
- package/dist/access-http.d.ts +15 -13
- package/dist/access-http.js +108 -105
- package/dist/access-identity-continuity-surface.d.ts +12 -10
- package/dist/access-identity-continuity-surface.js +86 -83
- package/dist/access-lcm-surface.d.ts +14 -12
- package/dist/access-lcm-surface.js +86 -83
- package/dist/access-mcp.d.ts +14 -12
- package/dist/access-mcp.js +97 -94
- package/dist/access-memory-search-fanout.d.ts +3 -2
- package/dist/{access-namespace-preflight-CV5cHujx.d.ts → access-namespace-preflight-DY4z6L5X.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +4 -3
- package/dist/access-namespace-preflight.js +86 -83
- package/dist/access-observe-transcript.d.ts +12 -10
- package/dist/access-observe-write-category.d.ts +37 -0
- package/dist/access-observe-write-category.js +34 -0
- package/dist/access-observe-write-surface.d.ts +17 -15
- package/dist/access-observe-write-surface.js +86 -83
- package/dist/access-offline-manifest.d.ts +12 -10
- package/dist/access-offline-manifest.js +15 -15
- package/dist/access-operations-batch.js +91 -88
- package/dist/access-operations.d.ts +17 -30
- package/dist/access-operations.js +96 -93
- package/dist/access-recall-concurrency.d.ts +14 -12
- package/dist/access-recall-concurrency.js +86 -83
- package/dist/access-recall-response.d.ts +14 -12
- package/dist/access-recall-response.js +86 -83
- package/dist/access-recall-surface.d.ts +14 -12
- package/dist/access-recall-surface.js +86 -83
- package/dist/access-schema.d.ts +210 -107
- package/dist/access-schema.js +9 -15
- package/dist/{access-service-DwHC7lcV.d.ts → access-service-MY4bsr_Q.d.ts} +101 -77
- package/dist/access-service-helpers.d.ts +14 -12
- package/dist/access-service.d.ts +14 -12
- package/dist/access-service.js +86 -83
- package/dist/access-surface-catalog.d.ts +14 -12
- package/dist/access-surface-catalog.js +88 -85
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +5 -3
- package/dist/action-confidence.d.ts +2 -1
- package/dist/active-memory-bridge.d.ts +2 -1
- package/dist/active-memory-bridge.js +3 -3
- package/dist/active-recall.d.ts +2 -1
- package/dist/active-recall.js +20 -17
- package/dist/active-recall.js.map +1 -1
- package/dist/activity/digest.d.ts +2 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +2 -1
- package/dist/artifact-search.d.ts +2 -1
- package/dist/{auto-sync-FSRJDU63.js → auto-sync-RP4C6ZPF.js} +11 -9
- package/dist/{auto-sync-FSRJDU63.js.map → auto-sync-RP4C6ZPF.js.map} +1 -1
- package/dist/background-generation-config.d.ts +10 -0
- package/dist/background-generation-config.js +9 -0
- package/dist/background-generation.d.ts +25 -0
- package/dist/background-generation.js +11 -0
- package/dist/behavior-learner.d.ts +2 -1
- package/dist/behavior-signals.d.ts +2 -1
- package/dist/bootstrap.d.ts +12 -10
- package/dist/briefing-window.d.ts +3 -2
- package/dist/briefing.d.ts +3 -2
- package/dist/briefing.js +27 -26
- package/dist/buffer-surprise-report.d.ts +2 -1
- package/dist/buffer-turn-helpers.d.ts +2 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.js +8 -8
- package/dist/bulk-import/index.d.ts +4 -3
- package/dist/calibration.d.ts +3 -1
- package/dist/calibration.js +4 -2
- package/dist/calibration.js.map +1 -1
- package/dist/capabilities.d.ts +2 -1
- package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{capsule-merge-ZCXUPLNJ.js → capsule-merge-IPG4IOFP.js} +2 -2
- package/dist/{catalog-Cl4H8N89.d.ts → catalog-CW87xGx8.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +2 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +2 -1
- package/dist/causal-consolidation.js +29 -28
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +2 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-YHU5XUF4.js → chunk-27MKMTBY.js} +2 -2
- package/dist/{chunk-TK4FHQRN.js → chunk-2J3V5QEO.js} +4 -4
- package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/chunk-2QG4SLZI.js +44 -0
- package/dist/chunk-2QG4SLZI.js.map +1 -0
- package/dist/{chunk-TFRDUD3M.js → chunk-2ZTDRNCS.js} +2 -2
- package/dist/{chunk-PWPIERBM.js → chunk-37CAEC7E.js} +4 -4
- package/dist/{chunk-X7BCM2NA.js → chunk-3EKVN2OP.js} +2 -2
- package/dist/{chunk-S2ULTQZR.js → chunk-3N3PBBEH.js} +2 -2
- package/dist/{chunk-XCF3SFHD.js → chunk-3NPNBVFR.js} +2 -2
- package/dist/{chunk-JO5TQAKW.js → chunk-4BCHFSC7.js} +3 -3
- package/dist/{chunk-Q6D7EUSQ.js → chunk-4JVQRFZD.js} +10 -10
- package/dist/{chunk-YEDVOYL2.js → chunk-4RX5O34R.js} +2 -2
- package/dist/{chunk-JMPYZJQN.js → chunk-4RZLTZVM.js} +4 -4
- package/dist/{chunk-Q7JK6YEB.js → chunk-54NX5EG4.js} +2 -2
- package/dist/{chunk-GWK7FEUL.js → chunk-5FAGCOZD.js} +4 -4
- package/dist/{chunk-2PUE5P7C.js → chunk-5N4MZLEH.js} +5 -5
- package/dist/{chunk-B2YKTE7P.js → chunk-5SPCMAUC.js} +10 -10
- package/dist/{chunk-3OHISDDW.js → chunk-5U7K4W6K.js} +2 -2
- package/dist/{chunk-CYEMS2PG.js → chunk-5YCNDC3C.js} +3 -3
- package/dist/{chunk-PAAJWQH5.js → chunk-62D2PAAM.js} +4 -4
- package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
- package/dist/chunk-6AGWBKQU.js +94 -0
- package/dist/chunk-6AGWBKQU.js.map +1 -0
- package/dist/{chunk-326KUXIR.js → chunk-6EHM2AV7.js} +6 -6
- package/dist/{chunk-YM7YN37H.js → chunk-6ET2VII7.js} +2 -2
- package/dist/chunk-6H2G7RFT.js +58 -0
- package/dist/chunk-6H2G7RFT.js.map +1 -0
- package/dist/{chunk-A2YQL2FF.js → chunk-6P4REYKL.js} +5 -5
- package/dist/{chunk-7RKBPXY6.js → chunk-6YAIN5XJ.js} +2 -2
- package/dist/{chunk-2L5FSNPC.js → chunk-A7GQBJP5.js} +10 -10
- package/dist/{chunk-UYVXIY6C.js → chunk-AAZEKXUP.js} +2 -2
- package/dist/{chunk-JR6PP7UM.js → chunk-ACY4ZPF7.js} +28 -2
- package/dist/chunk-ACY4ZPF7.js.map +1 -0
- package/dist/{chunk-IQZ6ISFX.js → chunk-AECJY3GJ.js} +2 -2
- package/dist/{chunk-76DRU7C4.js → chunk-AENM6GKU.js} +2 -2
- package/dist/{chunk-KTRXQQFN.js → chunk-B36GUU6T.js} +4 -4
- package/dist/{chunk-TLHNF6GA.js → chunk-BV4ZKIZH.js} +1 -1
- package/dist/{chunk-ZWEZXVYH.js → chunk-CEO4DONG.js} +2 -2
- package/dist/chunk-CWTCMZGE.js +858 -0
- package/dist/chunk-CWTCMZGE.js.map +1 -0
- package/dist/{chunk-ZEPVWLCN.js → chunk-CZTPU65V.js} +25 -25
- package/dist/{chunk-TRU6JBOI.js → chunk-D545Z7UH.js} +3 -3
- package/dist/{chunk-6E5GYDIE.js → chunk-DGS34QSY.js} +2 -2
- package/dist/{chunk-65RENJGB.js → chunk-E2AWJ7KQ.js} +8 -4
- package/dist/chunk-E2AWJ7KQ.js.map +1 -0
- package/dist/{chunk-6Z3WW2MW.js → chunk-ENBPQEVU.js} +3 -3
- package/dist/{chunk-DOKKRZPH.js → chunk-EYKIDK33.js} +21 -19
- package/dist/chunk-EYKIDK33.js.map +1 -0
- package/dist/{chunk-PNEDMJ53.js → chunk-F4EHXVP7.js} +2 -2
- package/dist/{chunk-JPKZTCWZ.js → chunk-FNHLI2RE.js} +3 -3
- package/dist/{chunk-D2DIYEFW.js → chunk-FWWWUPOE.js} +12 -36
- package/dist/chunk-FWWWUPOE.js.map +1 -0
- package/dist/{chunk-M3MYMWXG.js → chunk-FXHOZGSE.js} +2 -2
- package/dist/{chunk-SAKA6PPL.js → chunk-GAS7KYC7.js} +5 -5
- package/dist/{chunk-LSLCFCCQ.js → chunk-GDYU6VF4.js} +1 -1
- package/dist/chunk-GDYU6VF4.js.map +1 -0
- package/dist/{chunk-2AR5JFD7.js → chunk-GG5FHZJJ.js} +6 -6
- package/dist/{chunk-WS3WNLST.js → chunk-GI4ZBWPQ.js} +3 -3
- package/dist/{chunk-JYR4LH76.js → chunk-GMIQV6DD.js} +2 -2
- package/dist/{chunk-WIKO4SCR.js → chunk-H3TKENU4.js} +5 -5
- package/dist/{chunk-ZLN7AROH.js → chunk-HIP6DKJJ.js} +5 -5
- package/dist/{chunk-SF6RFI5Z.js → chunk-HWLIMQE2.js} +2 -2
- package/dist/{chunk-JZYECQWN.js → chunk-IL6ODG6M.js} +2 -2
- package/dist/{chunk-GNR6YEWZ.js → chunk-IQEJIOEU.js} +6 -6
- package/dist/{chunk-BICNRVEC.js → chunk-IWO6QXWJ.js} +2 -2
- package/dist/{chunk-RN3MVLW3.js → chunk-IYKZJVL5.js} +1 -1
- package/dist/chunk-IYKZJVL5.js.map +1 -0
- package/dist/{chunk-42DJ235G.js → chunk-J272ODKJ.js} +2 -2
- package/dist/{chunk-R3TLVTWW.js → chunk-JDX2OA4R.js} +3 -3
- package/dist/{chunk-G5MO3VQA.js → chunk-JKKII6GX.js} +2 -2
- package/dist/{chunk-L5OXE4PX.js → chunk-JTQR6L2N.js} +3 -3
- package/dist/{chunk-VDX2J7OX.js → chunk-KQAFEZQX.js} +2 -2
- package/dist/{chunk-AKE4GGQ3.js → chunk-KQW3YGEN.js} +2 -2
- package/dist/{chunk-LMMQKZK3.js → chunk-L63GFNKL.js} +1 -1
- package/dist/{chunk-BRZWWUCJ.js → chunk-LMLGBG6H.js} +2 -2
- package/dist/{chunk-3IXB77DA.js → chunk-LPYYY4AP.js} +318 -278
- package/dist/chunk-LPYYY4AP.js.map +1 -0
- package/dist/{chunk-YEN4TREG.js → chunk-LQNRVPTV.js} +54 -567
- package/dist/chunk-LQNRVPTV.js.map +1 -0
- package/dist/{chunk-CQ7SSBO4.js → chunk-M6HBPLBA.js} +2 -2
- package/dist/chunk-MCRVQ5YQ.js +14 -0
- package/dist/chunk-MCRVQ5YQ.js.map +1 -0
- package/dist/{chunk-3YMDY3ZF.js → chunk-MUTVRKKY.js} +16 -16
- package/dist/{chunk-FCFAYMTU.js → chunk-NXGSONWM.js} +2 -2
- package/dist/{chunk-4WGAMREC.js → chunk-O4M4BDIJ.js} +2 -2
- package/dist/{chunk-5SYI2F47.js → chunk-O76F5QPP.js} +2 -2
- package/dist/{chunk-SROIT6QY.js → chunk-OPBFP4TF.js} +28 -11
- package/dist/chunk-OPBFP4TF.js.map +1 -0
- package/dist/{chunk-7MJBKZPU.js → chunk-P4ZAEYKG.js} +68 -34
- package/dist/chunk-P4ZAEYKG.js.map +1 -0
- package/dist/{chunk-57GDHV2D.js → chunk-PCOVEDPK.js} +6 -6
- package/dist/{chunk-PPTOAHTZ.js → chunk-PGAB2V53.js} +2 -2
- package/dist/{chunk-HHDTBYDJ.js → chunk-Q432REND.js} +2 -2
- package/dist/{chunk-XAITGGX5.js → chunk-Q4AUIFUA.js} +4 -4
- package/dist/{chunk-5LLQAUMI.js → chunk-Q7CLGFA7.js} +3 -3
- package/dist/{chunk-KUK56OPR.js → chunk-QHT7MOUF.js} +12 -12
- package/dist/{chunk-W6IJMWTZ.js → chunk-QTQ6XKGT.js} +4 -4
- package/dist/{chunk-FLLORID2.js → chunk-RLJHJQUY.js} +9 -9
- package/dist/{chunk-353KGBKY.js → chunk-RW4QNB4J.js} +4 -4
- package/dist/{chunk-GWQVMKUJ.js → chunk-SCXURCVT.js} +3 -3
- package/dist/{chunk-FQXJAC3T.js → chunk-SGUDMW2K.js} +4 -4
- package/dist/{chunk-LSDEIZ76.js → chunk-TA4C3XB7.js} +6 -6
- package/dist/{chunk-YIZ2EUUL.js → chunk-TNZNSMVJ.js} +94 -94
- package/dist/{chunk-CIYUWSMZ.js → chunk-TRLOFIQC.js} +2 -2
- package/dist/{chunk-TL7NLM2L.js → chunk-TSP5WH72.js} +2 -2
- package/dist/{chunk-3K6UFW5B.js → chunk-UHRZ324M.js} +8 -8
- package/dist/{chunk-JLXWRQNR.js → chunk-UZEHHXYC.js} +170 -167
- package/dist/chunk-UZEHHXYC.js.map +1 -0
- package/dist/{chunk-A5UQ52YQ.js → chunk-UZZ7SQT3.js} +5 -5
- package/dist/{chunk-GHX5PNXW.js → chunk-VBSNUH4J.js} +2 -2
- package/dist/{chunk-MR6LQVZ5.js → chunk-VJIE4D2I.js} +3 -3
- package/dist/{chunk-OTPXEE6W.js → chunk-VSL63CFJ.js} +15 -12
- package/dist/chunk-VSL63CFJ.js.map +1 -0
- package/dist/{chunk-2JGGZICG.js → chunk-WBM2MVBK.js} +2 -2
- package/dist/{chunk-CD3C4BJN.js → chunk-WIWLX65T.js} +2 -2
- package/dist/{chunk-GDDSXVWR.js → chunk-X4TD4O2F.js} +3 -3
- package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-FPQDZCUX.js → chunk-XH3HGI2N.js} +2 -2
- package/dist/{chunk-C6KRO3SU.js → chunk-XVDZFTN5.js} +4 -4
- package/dist/{chunk-3SL52JKD.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/chunk-YDVAM7S4.js +221 -0
- package/dist/chunk-YDVAM7S4.js.map +1 -0
- package/dist/chunk-YFTNZMGR.js +71 -0
- package/dist/chunk-YFTNZMGR.js.map +1 -0
- package/dist/{chunk-VELCIWJZ.js → chunk-YKREX63Z.js} +19 -10
- package/dist/chunk-YKREX63Z.js.map +1 -0
- package/dist/{chunk-BLHX5FQW.js → chunk-YUW66UAH.js} +2 -2
- package/dist/{chunk-DOQLHCSS.js → chunk-ZBW7A667.js} +2 -2
- package/dist/{chunk-4DPDIOVA.js → chunk-ZEGL7YCC.js} +2 -2
- package/dist/{chunk-VVX5PZFS.js → chunk-ZHXSOMYH.js} +2 -2
- package/dist/{chunk-GCBIXUPT.js → chunk-ZMWSYUUL.js} +2 -2
- package/dist/{chunk-X2QPKLPL.js → chunk-ZZUVBZL2.js} +2 -2
- package/dist/{cli-1mzd5TM4.d.ts → cli-DGq0MNpO.d.ts} +5 -5
- package/dist/cli-fallback.d.ts +4 -2
- package/dist/cli-fallback.js +3 -1
- package/dist/cli.d.ts +16 -14
- package/dist/cli.js +139 -134
- package/dist/coding/export-okf-codegraph.d.ts +2 -1
- package/dist/coding/export-okf-codegraph.js +26 -25
- package/dist/coding/export-okf-codegraph.js.map +1 -1
- package/dist/coding/pre-action-gate.d.ts +2 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compat/codex-cli-fallback.d.ts +1 -1
- package/dist/compat/codex-cli-fallback.js +3 -1
- package/dist/compat/codex-cli-fallback.js.map +1 -1
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +27 -26
- package/dist/compounding/preference-consolidator.d.ts +2 -1
- package/dist/compression-optimizer.d.ts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +18 -15
- package/dist/connectors/codex-materialize-runner.d.ts +2 -1
- package/dist/connectors/codex-materialize-runner.js +26 -25
- package/dist/connectors/codex-materialize.d.ts +2 -1
- package/dist/connectors/index.d.ts +2 -1
- package/dist/connectors/index.js +29 -28
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/contradiction/index.d.ts +5 -3
- package/dist/contradiction/index.js +7 -7
- package/dist/{contradiction-scan-GVD4JJ7B.js → contradiction-scan-BSGKZHYJ.js} +4 -4
- package/dist/contradiction-scan-BSGKZHYJ.js.map +1 -0
- package/dist/converge-config.d.ts +2 -1
- package/dist/convergence-refresh.d.ts +3 -2
- package/dist/convergence-refresh.js +29 -28
- package/dist/conversation-index/backend.d.ts +2 -1
- package/dist/conversation-index/chunker.d.ts +2 -1
- package/dist/conversation-index/faiss-adapter.d.ts +2 -1
- package/dist/conversation-index/indexer.d.ts +2 -1
- package/dist/conversation-index/search.d.ts +2 -1
- package/dist/corpus-watermark.d.ts +2 -1
- package/dist/corpus-watermark.js +29 -28
- package/dist/cross-lingual-recall.d.ts +2 -1
- package/dist/day-summary.d.ts +2 -1
- package/dist/deep-recall-http-glue.d.ts +14 -12
- package/dist/deep-recall-http-glue.js +4 -14
- package/dist/deep-recall-mcp-tools.d.ts +14 -12
- package/dist/deep-recall-policy-llm.d.ts +3 -1
- package/dist/deep-recall-policy-llm.js +5 -3
- package/dist/deep-recall-seeds.d.ts +2 -1
- package/dist/delinearize.d.ts +2 -1
- package/dist/dependency-propagation-config.d.ts +2 -1
- package/dist/{dependency-propagation-delivery-Bua2ApHV.d.ts → dependency-propagation-delivery-Cq1ekOwV.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +2 -1
- package/dist/direct-answer.d.ts +2 -1
- package/dist/embedding-fallback.d.ts +2 -1
- package/dist/enrichment/index.d.ts +2 -1
- package/dist/entity-origin-fields.d.ts +2 -1
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +28 -27
- package/dist/entity-schema.d.ts +2 -1
- package/dist/episodic-context.d.ts +2 -1
- package/dist/eval-trajectory-contracts.d.ts +2 -1
- package/dist/eval-trajectory-store.d.ts +2 -1
- package/dist/eval-trajectory.d.ts +2 -1
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.d.ts +12 -10
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.d.ts +14 -12
- package/dist/external-wiki-access.js +87 -84
- package/dist/external-wiki-collection-registration.d.ts +2 -1
- package/dist/external-wiki-collection.d.ts +2 -1
- package/dist/external-wiki-mcp-tools.d.ts +14 -12
- package/dist/extraction-error-classification.d.ts +2 -1
- package/dist/extraction-faithfulness.d.ts +3 -1
- package/dist/extraction-faithfulness.js +5 -3
- package/dist/extraction-judge-telemetry.d.ts +3 -1
- package/dist/extraction-judge-training.d.ts +3 -1
- package/dist/extraction-judge.d.ts +3 -1
- package/dist/extraction-judge.js +5 -3
- package/dist/extraction-liveness.d.ts +2 -1
- package/dist/extraction-normalization.d.ts +2 -1
- package/dist/extraction-prompt.d.ts +2 -1
- package/dist/extraction-source-grounding-rules.d.ts +2 -1
- package/dist/extraction-source-grounding.d.ts +2 -1
- package/dist/extraction-source-grounding.js +3 -3
- package/dist/extraction-span-config.d.ts +2 -1
- package/dist/extraction-span-materialize.d.ts +2 -1
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.d.ts +2 -1
- package/dist/extraction.js +46 -45
- package/dist/fallback-llm-codex-subscription.d.ts +79 -0
- package/dist/fallback-llm-codex-subscription.js +22 -0
- package/dist/fallback-llm-codex-subscription.js.map +1 -0
- package/dist/fallback-llm.d.ts +5 -1
- package/dist/fallback-llm.js +4 -2
- package/dist/{first-start-migration-GZ45G5FS.js → first-start-migration-ZWMV5CX4.js} +6 -6
- package/dist/{generic-recall-paths-DJBADojG.d.ts → generic-recall-paths-BcySh_f9.d.ts} +1 -1
- package/dist/graph-append-error.d.ts +2 -1
- package/dist/graph-dashboard-diff.d.ts +2 -1
- package/dist/graph-dashboard-key.d.ts +2 -1
- package/dist/graph-dashboard-parser.d.ts +2 -1
- package/dist/{graph-edge-decay-ROSUPDX3.js → graph-edge-decay-MKIRZ762.js} +5 -5
- package/dist/graph-edge-decay-MKIRZ762.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +2 -1
- package/dist/graph-jsonl.d.ts +2 -1
- package/dist/graph-jsonl.js +3 -3
- package/dist/graph-path-reconstruction.d.ts +2 -1
- package/dist/graph-path-scoring.d.ts +2 -1
- package/dist/graph-snapshot.d.ts +2 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +2 -1
- package/dist/graph.js +2 -2
- package/dist/harmonic-retrieval.js +3 -3
- package/dist/importance.d.ts +2 -1
- package/dist/importers/index.d.ts +2 -1
- package/dist/importers/test-utils.d.ts +2 -1
- package/dist/in-flight-reads.d.ts +2 -1
- package/dist/{index-Bsy8ygLL.d.ts → index-DWOb4wz9.d.ts} +2 -2
- package/dist/index.d.ts +713 -705
- package/dist/index.js +419 -346
- package/dist/intent.d.ts +2 -1
- package/dist/lcm/engine.d.ts +2 -1
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/index.d.ts +2 -1
- package/dist/lcm/index.js +12 -12
- package/dist/lcm/tools.d.ts +2 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/live-connectors-runner.d.ts +2 -1
- package/dist/local-llm-config.d.ts +7 -1
- package/dist/local-llm-config.js +12 -0
- package/dist/local-llm.d.ts +2 -1
- package/dist/local-model-endpoint.d.ts +2 -1
- package/dist/location/index.d.ts +4 -3
- package/dist/location/index.js +60 -59
- package/dist/maintenance/memory-governance.d.ts +2 -1
- package/dist/maintenance/memory-governance.js +26 -25
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +27 -26
- package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-projection.js +28 -27
- package/dist/{maintenance-DItyBwTC.d.ts → maintenance-CW9wCzMP.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +14 -12
- package/dist/memory-action-policy.d.ts +2 -1
- package/dist/memory-cache.d.ts +2 -1
- package/dist/memory-controller.d.ts +2 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
- package/dist/memory-projection-store.d.ts +2 -1
- package/dist/memory-provenance.d.ts +2 -1
- package/dist/memory-snapshot.d.ts +2 -1
- package/dist/memory-subject-cli.d.ts +14 -12
- package/dist/memory-subject.d.ts +14 -12
- package/dist/memory-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +2 -1
- package/dist/namespaces/migrate.d.ts +4 -3
- package/dist/namespaces/migrate.js +27 -26
- package/dist/namespaces/principal.d.ts +2 -1
- package/dist/namespaces/search.d.ts +2 -1
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.d.ts +4 -3
- package/dist/namespaces/storage.js +26 -25
- package/dist/native-knowledge.d.ts +2 -1
- package/dist/offline-sync-impression-drain.d.ts +2 -1
- package/dist/offline-sync-impression-drain.js +4 -4
- package/dist/operator-doctor-corpus.d.ts +2 -1
- package/dist/operator-doctor-corpus.js +30 -29
- package/dist/operator-doctor-replica.d.ts +2 -1
- package/dist/operator-toolkit.d.ts +4 -3
- package/dist/operator-toolkit.js +53 -49
- package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
- package/dist/orchestration/maintenance.d.ts +5 -4
- package/dist/orchestration/maintenance.js +39 -38
- package/dist/{orchestrator-DBUX-aAM.d.ts → orchestrator-ComHLm49.d.ts} +22 -11
- package/dist/orchestrator.d.ts +12 -10
- package/dist/orchestrator.js +224 -218
- package/dist/patterns-cli.d.ts +2 -1
- package/dist/{pipeline-BqgcOk1Z.d.ts → pipeline-CiYcqqhl.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +2 -1
- package/dist/proactive-contention.d.ts +2 -1
- package/dist/provenance.d.ts +2 -1
- package/dist/provenance.js +2 -2
- package/dist/{public-http-CqtZ5kv3.d.ts → public-http-CuK4_Cb1.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +3 -2
- package/dist/{qmd-BD0ikV_Y.d.ts → qmd-qXD4vatU.d.ts} +1 -1
- package/dist/qmd-recall-cache.d.ts +2 -1
- package/dist/qmd.d.ts +3 -2
- package/dist/recall-concurrency-config.d.ts +2 -1
- package/dist/recall-disclosure-escalation.d.ts +2 -1
- package/dist/recall-explain-renderer.d.ts +2 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +2 -1
- package/dist/recall-navigate-access.d.ts +2 -1
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.d.ts +2 -1
- package/dist/recall-navigate-disclosure.js +1 -1
- package/dist/recall-navigate.d.ts +2 -1
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-planner-llm.d.ts +3 -1
- package/dist/recall-planner-llm.js +4 -2
- package/dist/recall-planner-llm.js.map +1 -1
- package/dist/recall-state-view-admission.d.ts +3 -2
- package/dist/recall-state-view-admission.js +9 -9
- package/dist/recall-state-view-anchors.d.ts +85 -0
- package/dist/recall-state-view-anchors.js +21 -0
- package/dist/recall-state-view-anchors.js.map +1 -0
- package/dist/recall-state-view-inject.js +2 -2
- package/dist/recall-state-view-render.js +2 -2
- package/dist/recall-state-view-widen.js +2 -2
- package/dist/recall-state-view-wire.js +3 -3
- package/dist/recall-state-view.d.ts +37 -1
- package/dist/recall-state-view.js +11 -3
- package/dist/recall-state.d.ts +2 -1
- package/dist/recall-tag-filter.d.ts +2 -1
- package/dist/recall-timings.d.ts +2 -1
- package/dist/recall-xray-cli.d.ts +2 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +2 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +2 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +2 -1
- package/dist/reconcile/cursor.js +2 -2
- package/dist/reconcile/manifest.d.ts +2 -1
- package/dist/reconcile/manifest.js +4 -4
- package/dist/reconcile/plan.d.ts +2 -1
- package/dist/reconcile/plan.js +2 -2
- package/dist/replay/normalizers/chatgpt.d.ts +2 -1
- package/dist/replay/normalizers/claude.d.ts +2 -1
- package/dist/replay/normalizers/openclaw.d.ts +2 -1
- package/dist/replay/normalizers/shared.d.ts +2 -1
- package/dist/replay/runner.d.ts +2 -1
- package/dist/replay/types.d.ts +2 -1
- package/dist/replica-divergence.d.ts +2 -1
- package/dist/replica-peers-config.d.ts +2 -1
- package/dist/{resolution-OHJZG45O.js → resolution-4GG3QZRJ.js} +8 -8
- package/dist/resolution-4GG3QZRJ.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +2 -1
- package/dist/resume-bundles.js +19 -16
- package/dist/retrieval-agents.d.ts +3 -2
- package/dist/retrieval-tiers.d.ts +2 -1
- package/dist/routing/engine.d.ts +2 -1
- package/dist/routing/store.d.ts +2 -1
- package/dist/salvage-envelope.d.ts +2 -1
- package/dist/salvage-envelope.js +2 -2
- package/dist/schemas.d.ts +160 -160
- package/dist/{scope-profiles-BIJMsd0B.d.ts → scope-profiles-BT9rqC3w.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +2 -1
- package/dist/search/factory.d.ts +2 -1
- package/dist/search/factory.js +5 -5
- package/dist/search/index.d.ts +2 -1
- package/dist/search/index.js +13 -13
- package/dist/search/lancedb-backend.d.ts +2 -1
- package/dist/search/meilisearch-backend.d.ts +2 -1
- package/dist/search/noop-backend.d.ts +2 -1
- package/dist/search/orama-backend.d.ts +2 -1
- package/dist/search/port.d.ts +2 -1
- package/dist/search/remote-backend.d.ts +2 -1
- package/dist/{semantic-consolidation-D7sJocll.d.ts → semantic-consolidation-CmZi7thY.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +3 -2
- package/dist/semantic-consolidation.js +27 -26
- package/dist/semantic-rule-promotion.js +26 -25
- package/dist/semantic-rule-verifier.d.ts +2 -1
- package/dist/semantic-rule-verifier.js +26 -25
- package/dist/{service-fwgEngUj.d.ts → service-CLkA7AQB.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +2 -1
- package/dist/session-observer-state.d.ts +2 -1
- package/dist/shared-context/manager.d.ts +8 -7
- package/dist/signal.d.ts +2 -1
- package/dist/source-agent-qualifier.d.ts +2 -1
- package/dist/source-agent-qualifier.js +41 -40
- package/dist/standup/build.js +27 -26
- package/dist/{storage-Cbll3-Tk.d.ts → storage-wvX01lht.d.ts} +1 -1
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +25 -24
- package/dist/subject-config.d.ts +2 -1
- package/dist/subject-config.js +2 -2
- package/dist/summarizer.d.ts +2 -1
- package/dist/summarizer.js +6 -3
- package/dist/summary-snapshot.d.ts +2 -1
- package/dist/support-passport/index.d.ts +17 -15
- package/dist/support-passport/index.js +92 -89
- package/dist/temporal-supersession.d.ts +3 -2
- package/dist/temporal-timeline-recall.d.ts +2 -1
- package/dist/temporal-validity.d.ts +2 -1
- package/dist/threading.d.ts +2 -1
- package/dist/tier-migration.d.ts +3 -2
- package/dist/tier-routing.d.ts +2 -1
- package/dist/tier-routing.js +3 -3
- package/dist/{tier-stats-VK5PCO2L.js → tier-stats-LUSUUNU6.js} +4 -4
- package/dist/topics.d.ts +2 -1
- package/dist/transcript.d.ts +2 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/export-okf.d.ts +2 -1
- package/dist/transfer/export-okf.js +26 -25
- package/dist/transfer/types.d.ts +78 -78
- package/dist/trust-score-stage.d.ts +2 -1
- package/dist/trust-score.d.ts +2 -1
- package/dist/{types-48sPkWB0.d.ts → types-Cyr32ABj.d.ts} +3 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -1
- package/dist/verified-recall.js +26 -25
- package/dist/who-knows-cli.d.ts +14 -12
- package/dist/who-knows-cli.js +27 -26
- package/dist/who-knows.d.ts +14 -12
- package/dist/who-knows.js +26 -25
- package/dist/write-envelope.d.ts +7 -1
- package/dist/write-envelope.js +1 -1
- package/package.json +2 -2
- package/src/access-boundary.ts +21 -6
- package/src/access-category-alias.test.ts +488 -51
- package/src/access-http.test.ts +249 -0
- package/src/access-http.ts +2 -0
- package/src/access-mcp.test.ts +2 -2
- package/src/access-observe-write-category.ts +25 -0
- package/src/access-observe-write-surface.ts +58 -57
- package/src/access-operations-batch.ts +28 -2
- package/src/access-operations.ts +6 -4
- package/src/access-schema.ts +106 -50
- package/src/access-service.ts +23 -9
- package/src/background-generation-config.ts +79 -0
- package/src/background-generation.test.ts +123 -0
- package/src/background-generation.ts +52 -0
- package/src/cli-fallback.ts +8 -2
- package/src/config.test.ts +172 -0
- package/src/config.ts +2 -43
- package/src/fallback-llm-codex-subscription.ts +168 -0
- package/src/fallback-llm.test.ts +46 -0
- package/src/fallback-llm.ts +60 -48
- package/src/index.ts +2 -16
- package/src/local-llm-config.ts +84 -0
- package/src/orchestration/recall-internal.ts +91 -74
- package/src/orchestration/recall-rerank-coordinator.ts +41 -4
- package/src/orchestration/recall-search-pipeline.ts +25 -18
- package/src/orchestration/recall-state-view-pipeline.test.ts +89 -0
- package/src/providers/codex-subscription.test.ts +804 -1
- package/src/providers/codex-subscription.ts +407 -65
- package/src/recall-rerank-coordinator.test.ts +153 -0
- package/src/recall-state-view-anchors.ts +163 -0
- package/src/recall-state-view-widen.ts +21 -7
- package/src/recall-state-view-zero-diff.test.ts +30 -0
- package/src/recall-state-view.test.ts +161 -0
- package/src/recall-state-view.ts +206 -35
- package/src/summarizer.ts +25 -0
- package/src/trust-score-recall-paths.test.ts +1 -1
- package/src/types.ts +3 -2
- package/src/write-envelope.ts +5 -0
- package/dist/chunk-255PC37A.js +0 -120
- package/dist/chunk-255PC37A.js.map +0 -1
- package/dist/chunk-3IXB77DA.js.map +0 -1
- package/dist/chunk-65RENJGB.js.map +0 -1
- package/dist/chunk-7MJBKZPU.js.map +0 -1
- package/dist/chunk-D2DIYEFW.js.map +0 -1
- package/dist/chunk-DOKKRZPH.js.map +0 -1
- package/dist/chunk-JLXWRQNR.js.map +0 -1
- package/dist/chunk-JR6PP7UM.js.map +0 -1
- package/dist/chunk-LSLCFCCQ.js.map +0 -1
- package/dist/chunk-OTPXEE6W.js.map +0 -1
- package/dist/chunk-RN3MVLW3.js.map +0 -1
- package/dist/chunk-SROIT6QY.js.map +0 -1
- package/dist/chunk-VELCIWJZ.js.map +0 -1
- package/dist/chunk-YEN4TREG.js.map +0 -1
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → access-observe-write-category.js.map} +0 -0
- /package/dist/{contradiction-scan-GVD4JJ7B.js.map → background-generation-config.js.map} +0 -0
- /package/dist/{graph-edge-decay-ROSUPDX3.js.map → background-generation.js.map} +0 -0
- /package/dist/{resolution-OHJZG45O.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{capsule-merge-ZCXUPLNJ.js.map → capsule-merge-IPG4IOFP.js.map} +0 -0
- /package/dist/{chunk-YHU5XUF4.js.map → chunk-27MKMTBY.js.map} +0 -0
- /package/dist/{chunk-TK4FHQRN.js.map → chunk-2J3V5QEO.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-TFRDUD3M.js.map → chunk-2ZTDRNCS.js.map} +0 -0
- /package/dist/{chunk-PWPIERBM.js.map → chunk-37CAEC7E.js.map} +0 -0
- /package/dist/{chunk-X7BCM2NA.js.map → chunk-3EKVN2OP.js.map} +0 -0
- /package/dist/{chunk-S2ULTQZR.js.map → chunk-3N3PBBEH.js.map} +0 -0
- /package/dist/{chunk-XCF3SFHD.js.map → chunk-3NPNBVFR.js.map} +0 -0
- /package/dist/{chunk-JO5TQAKW.js.map → chunk-4BCHFSC7.js.map} +0 -0
- /package/dist/{chunk-Q6D7EUSQ.js.map → chunk-4JVQRFZD.js.map} +0 -0
- /package/dist/{chunk-YEDVOYL2.js.map → chunk-4RX5O34R.js.map} +0 -0
- /package/dist/{chunk-JMPYZJQN.js.map → chunk-4RZLTZVM.js.map} +0 -0
- /package/dist/{chunk-Q7JK6YEB.js.map → chunk-54NX5EG4.js.map} +0 -0
- /package/dist/{chunk-GWK7FEUL.js.map → chunk-5FAGCOZD.js.map} +0 -0
- /package/dist/{chunk-2PUE5P7C.js.map → chunk-5N4MZLEH.js.map} +0 -0
- /package/dist/{chunk-B2YKTE7P.js.map → chunk-5SPCMAUC.js.map} +0 -0
- /package/dist/{chunk-3OHISDDW.js.map → chunk-5U7K4W6K.js.map} +0 -0
- /package/dist/{chunk-CYEMS2PG.js.map → chunk-5YCNDC3C.js.map} +0 -0
- /package/dist/{chunk-PAAJWQH5.js.map → chunk-62D2PAAM.js.map} +0 -0
- /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
- /package/dist/{chunk-326KUXIR.js.map → chunk-6EHM2AV7.js.map} +0 -0
- /package/dist/{chunk-YM7YN37H.js.map → chunk-6ET2VII7.js.map} +0 -0
- /package/dist/{chunk-A2YQL2FF.js.map → chunk-6P4REYKL.js.map} +0 -0
- /package/dist/{chunk-7RKBPXY6.js.map → chunk-6YAIN5XJ.js.map} +0 -0
- /package/dist/{chunk-2L5FSNPC.js.map → chunk-A7GQBJP5.js.map} +0 -0
- /package/dist/{chunk-UYVXIY6C.js.map → chunk-AAZEKXUP.js.map} +0 -0
- /package/dist/{chunk-IQZ6ISFX.js.map → chunk-AECJY3GJ.js.map} +0 -0
- /package/dist/{chunk-76DRU7C4.js.map → chunk-AENM6GKU.js.map} +0 -0
- /package/dist/{chunk-KTRXQQFN.js.map → chunk-B36GUU6T.js.map} +0 -0
- /package/dist/{chunk-TLHNF6GA.js.map → chunk-BV4ZKIZH.js.map} +0 -0
- /package/dist/{chunk-ZWEZXVYH.js.map → chunk-CEO4DONG.js.map} +0 -0
- /package/dist/{chunk-ZEPVWLCN.js.map → chunk-CZTPU65V.js.map} +0 -0
- /package/dist/{chunk-TRU6JBOI.js.map → chunk-D545Z7UH.js.map} +0 -0
- /package/dist/{chunk-6E5GYDIE.js.map → chunk-DGS34QSY.js.map} +0 -0
- /package/dist/{chunk-6Z3WW2MW.js.map → chunk-ENBPQEVU.js.map} +0 -0
- /package/dist/{chunk-PNEDMJ53.js.map → chunk-F4EHXVP7.js.map} +0 -0
- /package/dist/{chunk-JPKZTCWZ.js.map → chunk-FNHLI2RE.js.map} +0 -0
- /package/dist/{chunk-M3MYMWXG.js.map → chunk-FXHOZGSE.js.map} +0 -0
- /package/dist/{chunk-SAKA6PPL.js.map → chunk-GAS7KYC7.js.map} +0 -0
- /package/dist/{chunk-2AR5JFD7.js.map → chunk-GG5FHZJJ.js.map} +0 -0
- /package/dist/{chunk-WS3WNLST.js.map → chunk-GI4ZBWPQ.js.map} +0 -0
- /package/dist/{chunk-JYR4LH76.js.map → chunk-GMIQV6DD.js.map} +0 -0
- /package/dist/{chunk-WIKO4SCR.js.map → chunk-H3TKENU4.js.map} +0 -0
- /package/dist/{chunk-ZLN7AROH.js.map → chunk-HIP6DKJJ.js.map} +0 -0
- /package/dist/{chunk-SF6RFI5Z.js.map → chunk-HWLIMQE2.js.map} +0 -0
- /package/dist/{chunk-JZYECQWN.js.map → chunk-IL6ODG6M.js.map} +0 -0
- /package/dist/{chunk-GNR6YEWZ.js.map → chunk-IQEJIOEU.js.map} +0 -0
- /package/dist/{chunk-BICNRVEC.js.map → chunk-IWO6QXWJ.js.map} +0 -0
- /package/dist/{chunk-42DJ235G.js.map → chunk-J272ODKJ.js.map} +0 -0
- /package/dist/{chunk-R3TLVTWW.js.map → chunk-JDX2OA4R.js.map} +0 -0
- /package/dist/{chunk-G5MO3VQA.js.map → chunk-JKKII6GX.js.map} +0 -0
- /package/dist/{chunk-L5OXE4PX.js.map → chunk-JTQR6L2N.js.map} +0 -0
- /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-AKE4GGQ3.js.map → chunk-KQW3YGEN.js.map} +0 -0
- /package/dist/{chunk-LMMQKZK3.js.map → chunk-L63GFNKL.js.map} +0 -0
- /package/dist/{chunk-BRZWWUCJ.js.map → chunk-LMLGBG6H.js.map} +0 -0
- /package/dist/{chunk-CQ7SSBO4.js.map → chunk-M6HBPLBA.js.map} +0 -0
- /package/dist/{chunk-3YMDY3ZF.js.map → chunk-MUTVRKKY.js.map} +0 -0
- /package/dist/{chunk-FCFAYMTU.js.map → chunk-NXGSONWM.js.map} +0 -0
- /package/dist/{chunk-4WGAMREC.js.map → chunk-O4M4BDIJ.js.map} +0 -0
- /package/dist/{chunk-5SYI2F47.js.map → chunk-O76F5QPP.js.map} +0 -0
- /package/dist/{chunk-57GDHV2D.js.map → chunk-PCOVEDPK.js.map} +0 -0
- /package/dist/{chunk-PPTOAHTZ.js.map → chunk-PGAB2V53.js.map} +0 -0
- /package/dist/{chunk-HHDTBYDJ.js.map → chunk-Q432REND.js.map} +0 -0
- /package/dist/{chunk-XAITGGX5.js.map → chunk-Q4AUIFUA.js.map} +0 -0
- /package/dist/{chunk-5LLQAUMI.js.map → chunk-Q7CLGFA7.js.map} +0 -0
- /package/dist/{chunk-KUK56OPR.js.map → chunk-QHT7MOUF.js.map} +0 -0
- /package/dist/{chunk-W6IJMWTZ.js.map → chunk-QTQ6XKGT.js.map} +0 -0
- /package/dist/{chunk-FLLORID2.js.map → chunk-RLJHJQUY.js.map} +0 -0
- /package/dist/{chunk-353KGBKY.js.map → chunk-RW4QNB4J.js.map} +0 -0
- /package/dist/{chunk-GWQVMKUJ.js.map → chunk-SCXURCVT.js.map} +0 -0
- /package/dist/{chunk-FQXJAC3T.js.map → chunk-SGUDMW2K.js.map} +0 -0
- /package/dist/{chunk-LSDEIZ76.js.map → chunk-TA4C3XB7.js.map} +0 -0
- /package/dist/{chunk-YIZ2EUUL.js.map → chunk-TNZNSMVJ.js.map} +0 -0
- /package/dist/{chunk-CIYUWSMZ.js.map → chunk-TRLOFIQC.js.map} +0 -0
- /package/dist/{chunk-TL7NLM2L.js.map → chunk-TSP5WH72.js.map} +0 -0
- /package/dist/{chunk-3K6UFW5B.js.map → chunk-UHRZ324M.js.map} +0 -0
- /package/dist/{chunk-A5UQ52YQ.js.map → chunk-UZZ7SQT3.js.map} +0 -0
- /package/dist/{chunk-GHX5PNXW.js.map → chunk-VBSNUH4J.js.map} +0 -0
- /package/dist/{chunk-MR6LQVZ5.js.map → chunk-VJIE4D2I.js.map} +0 -0
- /package/dist/{chunk-2JGGZICG.js.map → chunk-WBM2MVBK.js.map} +0 -0
- /package/dist/{chunk-CD3C4BJN.js.map → chunk-WIWLX65T.js.map} +0 -0
- /package/dist/{chunk-GDDSXVWR.js.map → chunk-X4TD4O2F.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-FPQDZCUX.js.map → chunk-XH3HGI2N.js.map} +0 -0
- /package/dist/{chunk-C6KRO3SU.js.map → chunk-XVDZFTN5.js.map} +0 -0
- /package/dist/{chunk-3SL52JKD.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-BLHX5FQW.js.map → chunk-YUW66UAH.js.map} +0 -0
- /package/dist/{chunk-DOQLHCSS.js.map → chunk-ZBW7A667.js.map} +0 -0
- /package/dist/{chunk-4DPDIOVA.js.map → chunk-ZEGL7YCC.js.map} +0 -0
- /package/dist/{chunk-VVX5PZFS.js.map → chunk-ZHXSOMYH.js.map} +0 -0
- /package/dist/{chunk-GCBIXUPT.js.map → chunk-ZMWSYUUL.js.map} +0 -0
- /package/dist/{chunk-X2QPKLPL.js.map → chunk-ZZUVBZL2.js.map} +0 -0
- /package/dist/{first-start-migration-GZ45G5FS.js.map → first-start-migration-ZWMV5CX4.js.map} +0 -0
- /package/dist/{tier-stats-VK5PCO2L.js.map → tier-stats-LUSUUNU6.js.map} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
5
6
|
import {
|
|
6
7
|
callCodexCliFallback,
|
|
7
8
|
isCodexCliFallbackRunnerRegistered,
|
|
@@ -16,6 +17,10 @@ import {
|
|
|
16
17
|
__codexSubscriptionTestHooks,
|
|
17
18
|
createCodexSubscriptionRunner,
|
|
18
19
|
ensureCodexSubscriptionRunnerRegistered,
|
|
20
|
+
beginCodexSubscriptionShutdown,
|
|
21
|
+
getCodexSubscriptionRunnerForOwner,
|
|
22
|
+
getCodexSubscriptionShutdownSignal,
|
|
23
|
+
terminateActiveCodexSubscriptionChildren,
|
|
19
24
|
} from "./codex-subscription.js";
|
|
20
25
|
import { parseConfig } from "../config.js";
|
|
21
26
|
import { FallbackLlmClient } from "../fallback-llm.js";
|
|
@@ -664,3 +669,801 @@ test("existing API-key provider config still parses", () => {
|
|
|
664
669
|
assert.equal(parsed.openaiApiKey, EXISTING_API_KEY);
|
|
665
670
|
assert.equal(parsed.model, "gpt-5.5");
|
|
666
671
|
});
|
|
672
|
+
|
|
673
|
+
/** Yield the event loop so synchronously-started fakes register before
|
|
674
|
+
* assertions sample them (no wall-clock sleep). */
|
|
675
|
+
async function flushLoop(turns = 2): Promise<void> {
|
|
676
|
+
for (let i = 0; i < turns; i++) {
|
|
677
|
+
const { promise, resolve } = Promise.withResolvers<void>();
|
|
678
|
+
setImmediate(resolve);
|
|
679
|
+
await promise;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
test("shared login check: each caller times out on its own budget, without cancelling others", async () => {
|
|
684
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
685
|
+
let clock = 0;
|
|
686
|
+
let loginCalls = 0;
|
|
687
|
+
const loginPending = Promise.withResolvers<{ status: number | null; stdout: string; stderr: string }>();
|
|
688
|
+
const runner = createCodexSubscriptionRunner({
|
|
689
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
690
|
+
now: () => clock,
|
|
691
|
+
runLoginStatus: () => {
|
|
692
|
+
loginCalls++;
|
|
693
|
+
return loginPending.promise;
|
|
694
|
+
},
|
|
695
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
696
|
+
});
|
|
697
|
+
const call = (timeoutMs: number) =>
|
|
698
|
+
runner({
|
|
699
|
+
config: { executable: "codex-fake" },
|
|
700
|
+
modelId: "gpt-5.6-luna",
|
|
701
|
+
messages: [{ role: "user", content: "hi" }],
|
|
702
|
+
options: { timeoutMs },
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// Request A starts a 10s-budget login check that stays in flight.
|
|
706
|
+
const slow = call(10_000);
|
|
707
|
+
await flushLoop();
|
|
708
|
+
assert.equal(loginCalls, 1);
|
|
709
|
+
|
|
710
|
+
// Request B has a tiny budget: it must reject on ITS deadline while A's
|
|
711
|
+
// shared check keeps running. Real timer by design: the budget arithmetic
|
|
712
|
+
// uses the injected fake clock, but the deadline race itself exercises the
|
|
713
|
+
// provider's actual timer behavior.
|
|
714
|
+
const startedAt = Date.now();
|
|
715
|
+
await assert.rejects(call(120), (error: unknown) => {
|
|
716
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError);
|
|
717
|
+
assert.equal(error.name, "TimeoutError");
|
|
718
|
+
return true;
|
|
719
|
+
});
|
|
720
|
+
assert.ok(Date.now() - startedAt < 5_000, "B must not wait for A's full 10s check");
|
|
721
|
+
assert.equal(loginCalls, 1, "B must reuse the in-flight check, not start another");
|
|
722
|
+
|
|
723
|
+
// A's check completes and A succeeds — B's timeout did not cancel it.
|
|
724
|
+
loginPending.resolve({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" });
|
|
725
|
+
clock += 1_000;
|
|
726
|
+
assert.equal((await slow).content, "ok");
|
|
727
|
+
|
|
728
|
+
// A's success is cached: a third request runs no new login check.
|
|
729
|
+
await call(5_000);
|
|
730
|
+
assert.equal(loginCalls, 1);
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
test("caller abort reaches the cold login check: no spawn when pre-aborted, wait aborts in flight", async () => {
|
|
734
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
735
|
+
const loginSignals: (AbortSignal | undefined)[] = [];
|
|
736
|
+
const runner = createCodexSubscriptionRunner({
|
|
737
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
738
|
+
now: () => 0,
|
|
739
|
+
runLoginStatus: (_executable, _env, _timeoutMs, signal) => {
|
|
740
|
+
loginSignals.push(signal);
|
|
741
|
+
const { promise, resolve } = Promise.withResolvers<{ status: number | null; stdout: string; stderr: string }>();
|
|
742
|
+
signal?.addEventListener("abort", () => resolve({ status: 1, stdout: "", stderr: "aborted" }));
|
|
743
|
+
return promise;
|
|
744
|
+
},
|
|
745
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
746
|
+
});
|
|
747
|
+
const call = (options: { timeoutMs?: number; signal?: AbortSignal }) =>
|
|
748
|
+
runner({
|
|
749
|
+
config: { executable: "codex-fake" },
|
|
750
|
+
modelId: "gpt-5.6-luna",
|
|
751
|
+
messages: [{ role: "user", content: "hi" }],
|
|
752
|
+
options,
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
// Already-aborted caller: the login check never spawns.
|
|
756
|
+
const pre = new AbortController();
|
|
757
|
+
const preReason = new Error("cancelled before start");
|
|
758
|
+
pre.abort(preReason);
|
|
759
|
+
await assert.rejects(call({ signal: pre.signal }), (error: unknown) => error === preReason);
|
|
760
|
+
assert.equal(loginSignals.length, 0);
|
|
761
|
+
|
|
762
|
+
// Abort while the shared check is in flight: the caller keeps its reason
|
|
763
|
+
// and the login subprocess sees the cancellation.
|
|
764
|
+
const mid = new AbortController();
|
|
765
|
+
const pending = call({ timeoutMs: 60_000, signal: mid.signal });
|
|
766
|
+
await flushLoop();
|
|
767
|
+
assert.equal(loginSignals.length, 1);
|
|
768
|
+
const midReason = new Error("cancelled mid-check");
|
|
769
|
+
mid.abort(midReason);
|
|
770
|
+
await assert.rejects(pending, (error: unknown) => error === midReason);
|
|
771
|
+
await flushLoop();
|
|
772
|
+
assert.ok(loginSignals[0]?.aborted, "the login subprocess signal must be aborted");
|
|
773
|
+
|
|
774
|
+
// The aborted entry is dropped: the next request starts a fresh check.
|
|
775
|
+
const freshController = new AbortController();
|
|
776
|
+
const fresh = call({ signal: freshController.signal });
|
|
777
|
+
await flushLoop();
|
|
778
|
+
assert.equal(loginSignals.length, 2, "aborted entry must not be reused");
|
|
779
|
+
const freshReason = new Error("fresh call cancelled");
|
|
780
|
+
freshController.abort(freshReason);
|
|
781
|
+
await assert.rejects(fresh, (error: unknown) => error === freshReason);
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
test("codex-subscription apiKey and SecretRef are rejected before secret resolution", { concurrency: false }, async () => {
|
|
785
|
+
clearModelsJsonCache();
|
|
786
|
+
clearSecretCache();
|
|
787
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
788
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
789
|
+
|
|
790
|
+
const llm = new FallbackLlmClient({
|
|
791
|
+
agents: { defaults: { model: { primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-5.6-luna` } } },
|
|
792
|
+
models: {
|
|
793
|
+
providers: {
|
|
794
|
+
[CODEX_SUBSCRIPTION_PROVIDER_ID]: {
|
|
795
|
+
baseUrl: "codex-cli://subscription",
|
|
796
|
+
models: [],
|
|
797
|
+
api: "codex-cli",
|
|
798
|
+
apiKey: "secretref-managed",
|
|
799
|
+
executable: "codex-fake",
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
await assert.rejects(
|
|
806
|
+
llm.chatCompletion([{ role: "user", content: "remember this" }]),
|
|
807
|
+
(error: unknown) => {
|
|
808
|
+
// The provider contract error — NOT the generic "could not be resolved
|
|
809
|
+
// from secret ref" — proves rejection happened before resolution.
|
|
810
|
+
assert.ok(error instanceof CodexSubscriptionConfigError);
|
|
811
|
+
assert.match(error.message, /does not accept apiKey/);
|
|
812
|
+
assert.match(error.message, /codex login/);
|
|
813
|
+
return true;
|
|
814
|
+
}
|
|
815
|
+
);
|
|
816
|
+
|
|
817
|
+
clearModelsJsonCache();
|
|
818
|
+
clearSecretCache();
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
test("terminal codex-subscription errors survive the fallback chain", { concurrency: false }, async () => {
|
|
822
|
+
clearModelsJsonCache();
|
|
823
|
+
clearSecretCache();
|
|
824
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
825
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
826
|
+
const execCalls: CodexSubscriptionExecRequest[] = [];
|
|
827
|
+
const runner = createCodexSubscriptionRunner({
|
|
828
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
829
|
+
now: () => 0,
|
|
830
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
831
|
+
runCodexExec: async (request) => {
|
|
832
|
+
execCalls.push(request);
|
|
833
|
+
// The first model times out with auth-shaped text in its output; a
|
|
834
|
+
// later model succeeds — proving the chain still falls through.
|
|
835
|
+
if (request.args.includes("gpt-timeout-model")) {
|
|
836
|
+
return {
|
|
837
|
+
status: 124,
|
|
838
|
+
stdout: "",
|
|
839
|
+
stderr: "error: 401 Unauthorized\ncodex-subscription: exec timed out after 5000ms.\n",
|
|
840
|
+
outputText: "",
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
return { status: 0, stdout: "", stderr: "", outputText: "fallback model answer" };
|
|
844
|
+
},
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
const restore = setCodexCliFallbackRunnerForProcess(runner);
|
|
848
|
+
try {
|
|
849
|
+
const chainLlm = new FallbackLlmClient({
|
|
850
|
+
agents: {
|
|
851
|
+
defaults: {
|
|
852
|
+
model: {
|
|
853
|
+
primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-timeout-model`,
|
|
854
|
+
fallbacks: [`${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-ok-model`],
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
});
|
|
859
|
+
const response = await chainLlm.chatCompletion([{ role: "user", content: "hi" }]);
|
|
860
|
+
assert.equal(response?.content, "fallback model answer");
|
|
861
|
+
assert.equal(execCalls.length, 2);
|
|
862
|
+
|
|
863
|
+
// Sole/last model: the typed timeout must reach the caller instead of a
|
|
864
|
+
// null response the chain would otherwise swallow.
|
|
865
|
+
const soleLlm = new FallbackLlmClient({
|
|
866
|
+
agents: { defaults: { model: { primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-timeout-model` } } },
|
|
867
|
+
});
|
|
868
|
+
await assert.rejects(soleLlm.chatCompletion([{ role: "user", content: "hi" }]), (error: unknown) => {
|
|
869
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError);
|
|
870
|
+
assert.equal(error.name, "TimeoutError");
|
|
871
|
+
return true;
|
|
872
|
+
});
|
|
873
|
+
// Structured parse surfaces the same typed error, not { failureReason: "http_error" }.
|
|
874
|
+
await assert.rejects(
|
|
875
|
+
soleLlm.parseWithSchemaDetailed([{ role: "user", content: "hi" }], { parse: (v) => v }),
|
|
876
|
+
(error: unknown) => {
|
|
877
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError);
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
} finally {
|
|
882
|
+
restore();
|
|
883
|
+
clearModelsJsonCache();
|
|
884
|
+
clearSecretCache();
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
test("exec timeout classification wins over auth-pattern text", async () => {
|
|
889
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
890
|
+
const runner = makeRunner({
|
|
891
|
+
exec: {
|
|
892
|
+
status: 124,
|
|
893
|
+
stderr: "error: stream disconnected: 401 Unauthorized (token expired)\ncodex-subscription: exec timed out after 5000ms.\n",
|
|
894
|
+
},
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
await withRunner(runner, async () => {
|
|
898
|
+
await assert.rejects(
|
|
899
|
+
callCodexCliFallback({}, "gpt-5.6-luna", [{ role: "user", content: "hi" }], { timeoutMs: 5_000 }),
|
|
900
|
+
(error: unknown) => {
|
|
901
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError);
|
|
902
|
+
assert.equal(error instanceof CodexSubscriptionAuthError, false);
|
|
903
|
+
return true;
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
test(
|
|
910
|
+
"a timed-out child that traps SIGTERM and exits 0 still reports timeout",
|
|
911
|
+
{ skip: process.platform === "win32" },
|
|
912
|
+
async () => {
|
|
913
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
914
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-fakebin-"));
|
|
915
|
+
const script = path.join(dir, "codex-fake");
|
|
916
|
+
// Fake codex binary: prints auth-shaped output, traps SIGTERM, exits 0.
|
|
917
|
+
await writeFile(
|
|
918
|
+
script,
|
|
919
|
+
"#!/bin/sh\ntrap 'exit 0' TERM\necho 'error: 401 unauthorized'\nwhile true; do sleep 0.1; done\n",
|
|
920
|
+
{ mode: 0o755 }
|
|
921
|
+
);
|
|
922
|
+
const runner = createCodexSubscriptionRunner({
|
|
923
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
924
|
+
now: () => 0,
|
|
925
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
try {
|
|
929
|
+
await assert.rejects(
|
|
930
|
+
runner({
|
|
931
|
+
config: { executable: script },
|
|
932
|
+
modelId: "gpt-5.6-luna",
|
|
933
|
+
messages: [{ role: "user", content: "hi" }],
|
|
934
|
+
options: { timeoutMs: 300 },
|
|
935
|
+
}),
|
|
936
|
+
(error: unknown) => {
|
|
937
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError, `expected timeout, got: ${error}`);
|
|
938
|
+
assert.equal(error.name, "TimeoutError");
|
|
939
|
+
return true;
|
|
940
|
+
}
|
|
941
|
+
);
|
|
942
|
+
// The detached child group must be untracked after settle — no leak.
|
|
943
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 0);
|
|
944
|
+
} finally {
|
|
945
|
+
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
|
|
950
|
+
test("cached login mode is revalidated when the auth home changes on disk", async () => {
|
|
951
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
952
|
+
const home = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-home-"));
|
|
953
|
+
const codexHome = path.join(home, ".codex");
|
|
954
|
+
await mkdir(codexHome, { recursive: true });
|
|
955
|
+
let loginCalls = 0;
|
|
956
|
+
const runner = createCodexSubscriptionRunner({
|
|
957
|
+
env: { HOME: "/home/alice", CODEX_HOME: codexHome, PATH: "/usr/bin:/bin" },
|
|
958
|
+
now: () => 0,
|
|
959
|
+
runLoginStatus: async () => {
|
|
960
|
+
loginCalls++;
|
|
961
|
+
return { status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" };
|
|
962
|
+
},
|
|
963
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
964
|
+
});
|
|
965
|
+
const call = () =>
|
|
966
|
+
runner({
|
|
967
|
+
config: { executable: "codex-fake" },
|
|
968
|
+
modelId: "gpt-5.6-luna",
|
|
969
|
+
messages: [{ role: "user", content: "hi" }],
|
|
970
|
+
options: {},
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
try {
|
|
974
|
+
await call();
|
|
975
|
+
assert.equal(loginCalls, 1);
|
|
976
|
+
// Unchanged auth home within the TTL: cache hit, no new subprocess.
|
|
977
|
+
await call();
|
|
978
|
+
assert.equal(loginCalls, 1);
|
|
979
|
+
// Another process rewrites the auth store (e.g. switches to an API-key
|
|
980
|
+
// login): the cached ChatGPT mode must not mask it.
|
|
981
|
+
await writeFile(path.join(codexHome, "auth.json"), '{"OPENAI_API_KEY":"sk-fake"}\n');
|
|
982
|
+
await call();
|
|
983
|
+
assert.equal(loginCalls, 2, "auth-home mutation must invalidate the cached login check");
|
|
984
|
+
} finally {
|
|
985
|
+
await rm(home, { force: true, recursive: true }).catch(() => {});
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
test("relative HOME and CODEX_HOME resolve against the original process cwd", async () => {
|
|
990
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
991
|
+
const loginCalls: { executable: string; env: NodeJS.ProcessEnv }[] = [];
|
|
992
|
+
const runner = createCodexSubscriptionRunner({
|
|
993
|
+
env: { HOME: "rel-home", CODEX_HOME: "rel-codex", PATH: "/usr/bin:/bin" },
|
|
994
|
+
now: () => 0,
|
|
995
|
+
runLoginStatus: async (executable, env) => {
|
|
996
|
+
loginCalls.push({ executable, env });
|
|
997
|
+
return { status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" };
|
|
998
|
+
},
|
|
999
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
await runner({
|
|
1003
|
+
config: { executable: "codex-fake" },
|
|
1004
|
+
modelId: "gpt-5.6-luna",
|
|
1005
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1006
|
+
options: {},
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
// The login child and the workspace-cwd exec child must see the SAME
|
|
1010
|
+
// absolute directories, anchored to the daemon's cwd — not whichever cwd
|
|
1011
|
+
// each child happens to run in.
|
|
1012
|
+
assert.equal(loginCalls[0]?.env.CODEX_HOME, path.resolve("rel-codex"));
|
|
1013
|
+
assert.equal(loginCalls[0]?.env.HOME, path.resolve("rel-home"));
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
test(
|
|
1017
|
+
"core provider does not install process signal listeners or call process.exit",
|
|
1018
|
+
{ skip: process.platform === "win32" },
|
|
1019
|
+
async () => {
|
|
1020
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1021
|
+
const before = {
|
|
1022
|
+
sighup: process.listenerCount("SIGHUP"),
|
|
1023
|
+
sigint: process.listenerCount("SIGINT"),
|
|
1024
|
+
sigterm: process.listenerCount("SIGTERM"),
|
|
1025
|
+
exit: process.listenerCount("exit"),
|
|
1026
|
+
};
|
|
1027
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-fakebin-"));
|
|
1028
|
+
const script = path.join(dir, "codex-fake");
|
|
1029
|
+
await writeFile(script, "#!/bin/sh\ntrap '' TERM\nwhile true; do sleep 0.1; done\n", { mode: 0o755 });
|
|
1030
|
+
const runner = createCodexSubscriptionRunner({
|
|
1031
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1032
|
+
now: () => 0,
|
|
1033
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1034
|
+
});
|
|
1035
|
+
const pending = runner({
|
|
1036
|
+
config: { executable: script },
|
|
1037
|
+
modelId: "gpt-5.6-luna",
|
|
1038
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1039
|
+
options: { timeoutMs: 30_000 },
|
|
1040
|
+
});
|
|
1041
|
+
const pendingDone = pending.then(
|
|
1042
|
+
() => {
|
|
1043
|
+
throw new Error("expected terminated child");
|
|
1044
|
+
},
|
|
1045
|
+
() => undefined,
|
|
1046
|
+
);
|
|
1047
|
+
try {
|
|
1048
|
+
const waitUntil = Date.now() + 2_000;
|
|
1049
|
+
while (__codexSubscriptionTestHooks.activeCodexChildCount(runner) === 0 && Date.now() < waitUntil) {
|
|
1050
|
+
await flushLoop();
|
|
1051
|
+
}
|
|
1052
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 1);
|
|
1053
|
+
assert.equal(process.listenerCount("SIGHUP"), before.sighup);
|
|
1054
|
+
assert.equal(process.listenerCount("SIGINT"), before.sigint);
|
|
1055
|
+
assert.equal(process.listenerCount("SIGTERM"), before.sigterm);
|
|
1056
|
+
assert.equal(process.listenerCount("exit"), before.exit);
|
|
1057
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
|
|
1058
|
+
await pendingDone;
|
|
1059
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 0);
|
|
1060
|
+
assert.equal(process.listenerCount("SIGINT"), before.sigint);
|
|
1061
|
+
assert.equal(process.listenerCount("SIGTERM"), before.sigterm);
|
|
1062
|
+
} finally {
|
|
1063
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
|
|
1064
|
+
await pendingDone.catch(() => undefined);
|
|
1065
|
+
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1069
|
+
|
|
1070
|
+
test(
|
|
1071
|
+
"terminating one runtime does not kill another runtime's children",
|
|
1072
|
+
{ skip: process.platform === "win32" },
|
|
1073
|
+
async () => {
|
|
1074
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1075
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-fakebin-"));
|
|
1076
|
+
const script = path.join(dir, "codex-fake");
|
|
1077
|
+
await writeFile(script, "#!/bin/sh\ntrap '' TERM\nwhile true; do sleep 0.1; done\n", { mode: 0o755 });
|
|
1078
|
+
const makeLiveRunner = () =>
|
|
1079
|
+
createCodexSubscriptionRunner({
|
|
1080
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1081
|
+
now: () => 0,
|
|
1082
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1083
|
+
});
|
|
1084
|
+
const first = makeLiveRunner();
|
|
1085
|
+
const second = makeLiveRunner();
|
|
1086
|
+
const ignoreSettle = (pending: Promise<unknown>): Promise<void> =>
|
|
1087
|
+
pending.then(
|
|
1088
|
+
() => {
|
|
1089
|
+
throw new Error("expected terminated child");
|
|
1090
|
+
},
|
|
1091
|
+
() => undefined,
|
|
1092
|
+
);
|
|
1093
|
+
const firstPending = ignoreSettle(
|
|
1094
|
+
first({
|
|
1095
|
+
config: { executable: script },
|
|
1096
|
+
modelId: "gpt-5.6-luna",
|
|
1097
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1098
|
+
options: { timeoutMs: 30_000 },
|
|
1099
|
+
}),
|
|
1100
|
+
);
|
|
1101
|
+
const secondPending = ignoreSettle(
|
|
1102
|
+
second({
|
|
1103
|
+
config: { executable: script },
|
|
1104
|
+
modelId: "gpt-5.6-luna",
|
|
1105
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1106
|
+
options: { timeoutMs: 30_000 },
|
|
1107
|
+
}),
|
|
1108
|
+
);
|
|
1109
|
+
try {
|
|
1110
|
+
const waitUntil = Date.now() + 2_000;
|
|
1111
|
+
while (
|
|
1112
|
+
(__codexSubscriptionTestHooks.activeCodexChildCount(first) === 0 ||
|
|
1113
|
+
__codexSubscriptionTestHooks.activeCodexChildCount(second) === 0) &&
|
|
1114
|
+
Date.now() < waitUntil
|
|
1115
|
+
) {
|
|
1116
|
+
await flushLoop();
|
|
1117
|
+
}
|
|
1118
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(first), 1);
|
|
1119
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(second), 1);
|
|
1120
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", first);
|
|
1121
|
+
await firstPending;
|
|
1122
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(first), 0);
|
|
1123
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(second), 1);
|
|
1124
|
+
} finally {
|
|
1125
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", first);
|
|
1126
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", second);
|
|
1127
|
+
await firstPending.catch(() => undefined);
|
|
1128
|
+
await secondPending.catch(() => undefined);
|
|
1129
|
+
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
);
|
|
1133
|
+
|
|
1134
|
+
test(
|
|
1135
|
+
"typed provider timeout rejects before the fallback outer timer resolves null",
|
|
1136
|
+
{ concurrency: false, skip: process.platform === "win32" },
|
|
1137
|
+
async () => {
|
|
1138
|
+
clearModelsJsonCache();
|
|
1139
|
+
clearSecretCache();
|
|
1140
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1141
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1142
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-fakebin-"));
|
|
1143
|
+
const script = path.join(dir, "codex-fake");
|
|
1144
|
+
await writeFile(
|
|
1145
|
+
script,
|
|
1146
|
+
"#!/bin/sh\ntrap 'exit 0' TERM\nwhile true; do sleep 0.1; done\n",
|
|
1147
|
+
{ mode: 0o755 }
|
|
1148
|
+
);
|
|
1149
|
+
const runner = createCodexSubscriptionRunner({
|
|
1150
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1151
|
+
now: () => 0,
|
|
1152
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1153
|
+
});
|
|
1154
|
+
const restore = setCodexCliFallbackRunnerForProcess(runner);
|
|
1155
|
+
try {
|
|
1156
|
+
const llm = new FallbackLlmClient({
|
|
1157
|
+
agents: { defaults: { model: { primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-5.6-luna` } } },
|
|
1158
|
+
models: {
|
|
1159
|
+
providers: {
|
|
1160
|
+
[CODEX_SUBSCRIPTION_PROVIDER_ID]: {
|
|
1161
|
+
baseUrl: "codex-cli://subscription",
|
|
1162
|
+
api: "codex-cli",
|
|
1163
|
+
models: [],
|
|
1164
|
+
executable: script,
|
|
1165
|
+
},
|
|
1166
|
+
},
|
|
1167
|
+
},
|
|
1168
|
+
});
|
|
1169
|
+
await assert.rejects(
|
|
1170
|
+
llm.chatCompletion([{ role: "user", content: "hi" }], { timeoutMs: 250 }),
|
|
1171
|
+
(error: unknown) => {
|
|
1172
|
+
assert.ok(error instanceof CodexSubscriptionTimeoutError, `expected timeout, got: ${error}`);
|
|
1173
|
+
assert.equal(error.name, "TimeoutError");
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
);
|
|
1177
|
+
} finally {
|
|
1178
|
+
restore();
|
|
1179
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
|
|
1180
|
+
clearModelsJsonCache();
|
|
1181
|
+
clearSecretCache();
|
|
1182
|
+
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
);
|
|
1186
|
+
|
|
1187
|
+
test("concurrent callers share one in-flight login when auth.json already exists", async () => {
|
|
1188
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1189
|
+
const home = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-home-"));
|
|
1190
|
+
const codexHome = path.join(home, ".codex");
|
|
1191
|
+
await mkdir(codexHome, { recursive: true });
|
|
1192
|
+
await writeFile(path.join(codexHome, "auth.json"), '{"tokens":{}}\n');
|
|
1193
|
+
let loginCalls = 0;
|
|
1194
|
+
const loginPending = Promise.withResolvers<{ status: number | null; stdout: string; stderr: string }>();
|
|
1195
|
+
const runner = createCodexSubscriptionRunner({
|
|
1196
|
+
env: { HOME: "/home/alice", CODEX_HOME: codexHome, PATH: "/usr/bin:/bin" },
|
|
1197
|
+
now: () => 0,
|
|
1198
|
+
runLoginStatus: () => {
|
|
1199
|
+
loginCalls++;
|
|
1200
|
+
return loginPending.promise;
|
|
1201
|
+
},
|
|
1202
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
1203
|
+
});
|
|
1204
|
+
const call = () =>
|
|
1205
|
+
runner({
|
|
1206
|
+
config: { executable: "codex-fake" },
|
|
1207
|
+
modelId: "gpt-5.6-luna",
|
|
1208
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1209
|
+
options: { timeoutMs: 10_000 },
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
try {
|
|
1213
|
+
const first = call();
|
|
1214
|
+
await flushLoop();
|
|
1215
|
+
assert.equal(loginCalls, 1);
|
|
1216
|
+
const second = call();
|
|
1217
|
+
await flushLoop();
|
|
1218
|
+
assert.equal(loginCalls, 1, "unsettled login must be reused even when auth.json fingerprint is non-null");
|
|
1219
|
+
loginPending.resolve({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" });
|
|
1220
|
+
assert.equal((await first).content, "ok");
|
|
1221
|
+
assert.equal((await second).content, "ok");
|
|
1222
|
+
assert.equal(loginCalls, 1);
|
|
1223
|
+
} finally {
|
|
1224
|
+
await rm(home, { force: true, recursive: true }).catch(() => {});
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
test("owner runner wins over a core default process runner", { concurrency: false }, async () => {
|
|
1229
|
+
clearModelsJsonCache();
|
|
1230
|
+
clearSecretCache();
|
|
1231
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1232
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1233
|
+
setCodexCliFallbackRunnerForProcess(undefined);
|
|
1234
|
+
const globalCalls: unknown[] = [];
|
|
1235
|
+
const ownerCalls: unknown[] = [];
|
|
1236
|
+
assert.equal(
|
|
1237
|
+
ensureCodexSubscriptionRunnerRegistered({
|
|
1238
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1239
|
+
now: () => 0,
|
|
1240
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1241
|
+
runCodexExec: async (request) => {
|
|
1242
|
+
globalCalls.push(request);
|
|
1243
|
+
return { status: 0, stdout: "", stderr: "", outputText: "global" };
|
|
1244
|
+
},
|
|
1245
|
+
}),
|
|
1246
|
+
true,
|
|
1247
|
+
);
|
|
1248
|
+
const owner = makeRunner({ execCalls: ownerCalls, exec: okExec("owner") });
|
|
1249
|
+
try {
|
|
1250
|
+
const llm = new FallbackLlmClient(
|
|
1251
|
+
{ agents: { defaults: { model: { primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-5.6-luna` } } } },
|
|
1252
|
+
{ codexSubscriptionRunner: owner },
|
|
1253
|
+
);
|
|
1254
|
+
const response = await llm.chatCompletion([{ role: "user", content: "hi" }]);
|
|
1255
|
+
assert.equal(response?.content, "owner");
|
|
1256
|
+
assert.equal(globalCalls.length, 0);
|
|
1257
|
+
assert.equal(ownerCalls.length, 1);
|
|
1258
|
+
} finally {
|
|
1259
|
+
setCodexCliFallbackRunnerForProcess(undefined);
|
|
1260
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1261
|
+
clearModelsJsonCache();
|
|
1262
|
+
clearSecretCache();
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
test("host process runner still wins over an owner runner", { concurrency: false }, async () => {
|
|
1267
|
+
clearModelsJsonCache();
|
|
1268
|
+
clearSecretCache();
|
|
1269
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1270
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1271
|
+
const hostCalls: unknown[] = [];
|
|
1272
|
+
const ownerCalls: unknown[] = [];
|
|
1273
|
+
const host = makeRunner({ execCalls: hostCalls, exec: okExec("host") });
|
|
1274
|
+
const owner = makeRunner({ execCalls: ownerCalls, exec: okExec("owner") });
|
|
1275
|
+
const restore = setCodexCliFallbackRunnerForProcess(host);
|
|
1276
|
+
try {
|
|
1277
|
+
const llm = new FallbackLlmClient(
|
|
1278
|
+
{ agents: { defaults: { model: { primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-5.6-luna` } } } },
|
|
1279
|
+
{ codexSubscriptionRunner: owner },
|
|
1280
|
+
);
|
|
1281
|
+
const response = await llm.chatCompletion([{ role: "user", content: "hi" }]);
|
|
1282
|
+
assert.equal(response?.content, "host");
|
|
1283
|
+
assert.equal(hostCalls.length, 1);
|
|
1284
|
+
assert.equal(ownerCalls.length, 0);
|
|
1285
|
+
} finally {
|
|
1286
|
+
restore();
|
|
1287
|
+
clearModelsJsonCache();
|
|
1288
|
+
clearSecretCache();
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
test(
|
|
1293
|
+
"forced Codex kill runs before a hanging drain",
|
|
1294
|
+
{ concurrency: false, skip: process.platform === "win32" },
|
|
1295
|
+
async () => {
|
|
1296
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1297
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-fakebin-"));
|
|
1298
|
+
const script = path.join(dir, "codex-fake");
|
|
1299
|
+
await writeFile(script, "#!/bin/sh\ntrap '' TERM\nwhile true; do sleep 0.1; done\n", { mode: 0o755 });
|
|
1300
|
+
const runner = createCodexSubscriptionRunner({
|
|
1301
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1302
|
+
now: () => 0,
|
|
1303
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1304
|
+
});
|
|
1305
|
+
const pending = runner({
|
|
1306
|
+
config: { executable: script },
|
|
1307
|
+
modelId: "gpt-5.6-luna",
|
|
1308
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1309
|
+
options: { timeoutMs: 30_000 },
|
|
1310
|
+
});
|
|
1311
|
+
const ignore = pending.then(
|
|
1312
|
+
() => {
|
|
1313
|
+
throw new Error("expected terminated child");
|
|
1314
|
+
},
|
|
1315
|
+
() => undefined,
|
|
1316
|
+
);
|
|
1317
|
+
try {
|
|
1318
|
+
const waitUntil = Date.now() + 2_000;
|
|
1319
|
+
while (__codexSubscriptionTestHooks.activeCodexChildCount(runner) === 0 && Date.now() < waitUntil) {
|
|
1320
|
+
await flushLoop();
|
|
1321
|
+
}
|
|
1322
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 1);
|
|
1323
|
+
const finish = beginCodexSubscriptionShutdown(runner, 40);
|
|
1324
|
+
const killUntil = Date.now() + 500;
|
|
1325
|
+
while (__codexSubscriptionTestHooks.activeCodexChildCount(runner) > 0 && Date.now() < killUntil) {
|
|
1326
|
+
await flushLoop();
|
|
1327
|
+
}
|
|
1328
|
+
assert.equal(__codexSubscriptionTestHooks.activeCodexChildCount(runner), 0);
|
|
1329
|
+
finish();
|
|
1330
|
+
await ignore;
|
|
1331
|
+
} finally {
|
|
1332
|
+
terminateActiveCodexSubscriptionChildren("SIGKILL", runner);
|
|
1333
|
+
await ignore.catch(() => undefined);
|
|
1334
|
+
await rm(dir, { force: true, recursive: true }).catch(() => {});
|
|
1335
|
+
}
|
|
1336
|
+
},
|
|
1337
|
+
);
|
|
1338
|
+
|
|
1339
|
+
test("caller abort that mentions timeout keeps its identity", async () => {
|
|
1340
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1341
|
+
const runner = makeRunner();
|
|
1342
|
+
const controller = new AbortController();
|
|
1343
|
+
controller.abort(new Error("planner timed out after 15ms"));
|
|
1344
|
+
await assert.rejects(
|
|
1345
|
+
runner({
|
|
1346
|
+
config: { executable: "codex-fake" },
|
|
1347
|
+
modelId: "gpt-5.6-luna",
|
|
1348
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1349
|
+
options: { signal: controller.signal },
|
|
1350
|
+
}),
|
|
1351
|
+
(err: unknown) => {
|
|
1352
|
+
assert.ok(err instanceof Error);
|
|
1353
|
+
assert.equal(err instanceof CodexSubscriptionTimeoutError, false);
|
|
1354
|
+
assert.equal(err.message, "planner timed out after 15ms");
|
|
1355
|
+
return true;
|
|
1356
|
+
},
|
|
1357
|
+
);
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
test("owner runner is recreated after shutdown so the same config can restart", async () => {
|
|
1361
|
+
const owner = { reused: true };
|
|
1362
|
+
const first = getCodexSubscriptionRunnerForOwner(owner);
|
|
1363
|
+
beginCodexSubscriptionShutdown(first);
|
|
1364
|
+
assert.equal(getCodexSubscriptionShutdownSignal(first)?.aborted, true);
|
|
1365
|
+
const second = getCodexSubscriptionRunnerForOwner(owner);
|
|
1366
|
+
assert.notEqual(second, first);
|
|
1367
|
+
assert.equal(getCodexSubscriptionShutdownSignal(second)?.aborted, false);
|
|
1368
|
+
});
|
|
1369
|
+
|
|
1370
|
+
test("cached login mode is revalidated from USERPROFILE when HOME is unset", async () => {
|
|
1371
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1372
|
+
const profile = await mkdtemp(path.join(os.tmpdir(), "remnic-codex-userprofile-"));
|
|
1373
|
+
const codexHome = path.join(profile, ".codex");
|
|
1374
|
+
await mkdir(codexHome, { recursive: true });
|
|
1375
|
+
let loginCalls = 0;
|
|
1376
|
+
const runner = createCodexSubscriptionRunner({
|
|
1377
|
+
env: { USERPROFILE: profile, PATH: "/usr/bin:/bin" },
|
|
1378
|
+
now: () => 0,
|
|
1379
|
+
runLoginStatus: async () => {
|
|
1380
|
+
loginCalls++;
|
|
1381
|
+
return { status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" };
|
|
1382
|
+
},
|
|
1383
|
+
runCodexExec: async () => ({ status: 0, stdout: "", stderr: "", outputText: "ok" }),
|
|
1384
|
+
});
|
|
1385
|
+
const call = () =>
|
|
1386
|
+
runner({
|
|
1387
|
+
config: { executable: "codex-fake" },
|
|
1388
|
+
modelId: "gpt-5.6-luna",
|
|
1389
|
+
messages: [{ role: "user", content: "hi" }],
|
|
1390
|
+
options: {},
|
|
1391
|
+
});
|
|
1392
|
+
|
|
1393
|
+
try {
|
|
1394
|
+
await call();
|
|
1395
|
+
assert.equal(loginCalls, 1);
|
|
1396
|
+
await call();
|
|
1397
|
+
assert.equal(loginCalls, 1);
|
|
1398
|
+
await writeFile(path.join(codexHome, "auth.json"), '{"OPENAI_API_KEY":"sk-fake"}\n');
|
|
1399
|
+
await call();
|
|
1400
|
+
assert.equal(loginCalls, 2, "USERPROFILE auth-home mutation must invalidate the cached login check");
|
|
1401
|
+
} finally {
|
|
1402
|
+
await rm(profile, { force: true, recursive: true }).catch(() => {});
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
test("runtime shutdown does not start a fallback model", { concurrency: false }, async () => {
|
|
1407
|
+
clearModelsJsonCache();
|
|
1408
|
+
clearSecretCache();
|
|
1409
|
+
__codexSubscriptionTestHooks.resetLoginStatusCache();
|
|
1410
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1411
|
+
setCodexCliFallbackRunnerForProcess(undefined);
|
|
1412
|
+
const execModels: string[] = [];
|
|
1413
|
+
const runner = createCodexSubscriptionRunner({
|
|
1414
|
+
env: { HOME: "/home/alice", PATH: "/usr/bin:/bin" },
|
|
1415
|
+
now: () => 0,
|
|
1416
|
+
runLoginStatus: async () => ({ status: 0, stdout: "Logged in using ChatGPT\n", stderr: "" }),
|
|
1417
|
+
runCodexExec: async (request) => {
|
|
1418
|
+
const model = request.args.includes("gpt-primary") ? "primary" : "fallback";
|
|
1419
|
+
execModels.push(model);
|
|
1420
|
+
if (model === "primary") {
|
|
1421
|
+
await new Promise<never>((_resolve, reject) => {
|
|
1422
|
+
const fail = (): void => {
|
|
1423
|
+
reject(request.signal?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
1424
|
+
};
|
|
1425
|
+
if (request.signal?.aborted) {
|
|
1426
|
+
fail();
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
request.signal?.addEventListener("abort", fail, { once: true });
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
return { status: 0, stdout: "", stderr: "", outputText: "should-not-run" };
|
|
1433
|
+
},
|
|
1434
|
+
});
|
|
1435
|
+
const llm = new FallbackLlmClient(
|
|
1436
|
+
{
|
|
1437
|
+
agents: {
|
|
1438
|
+
defaults: {
|
|
1439
|
+
model: {
|
|
1440
|
+
primary: `${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-primary`,
|
|
1441
|
+
fallbacks: [`${CODEX_SUBSCRIPTION_PROVIDER_ID}/gpt-fallback`],
|
|
1442
|
+
},
|
|
1443
|
+
},
|
|
1444
|
+
},
|
|
1445
|
+
},
|
|
1446
|
+
{ codexSubscriptionRunner: runner },
|
|
1447
|
+
);
|
|
1448
|
+
try {
|
|
1449
|
+
const pending = llm.chatCompletion([{ role: "user", content: "hi" }]);
|
|
1450
|
+
const waitUntil = Date.now() + 2_000;
|
|
1451
|
+
while (execModels.length === 0 && Date.now() < waitUntil) {
|
|
1452
|
+
await flushLoop();
|
|
1453
|
+
}
|
|
1454
|
+
assert.deepEqual(execModels, ["primary"]);
|
|
1455
|
+
beginCodexSubscriptionShutdown(runner);
|
|
1456
|
+
await assert.rejects(pending, (err: unknown) => {
|
|
1457
|
+
assert.ok(err instanceof Error);
|
|
1458
|
+
assert.equal(err.name, "AbortError");
|
|
1459
|
+
return true;
|
|
1460
|
+
});
|
|
1461
|
+
assert.deepEqual(execModels, ["primary"]);
|
|
1462
|
+
} finally {
|
|
1463
|
+
beginCodexSubscriptionShutdown(runner);
|
|
1464
|
+
setCodexCliFallbackRunnerForProcess(undefined);
|
|
1465
|
+
__codexSubscriptionTestHooks.resetCoreRunnerRegistered();
|
|
1466
|
+
clearModelsJsonCache();
|
|
1467
|
+
clearSecretCache();
|
|
1468
|
+
}
|
|
1469
|
+
});
|