@remnic/core 9.69.33 → 9.69.35
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 -11
- package/dist/access-admin-ops-surface.js +65 -60
- package/dist/access-audit.js +2 -2
- package/dist/access-authorization-probe.d.ts +14 -11
- package/dist/access-authorization-probe.js +66 -61
- package/dist/access-boundary.d.ts +14 -11
- package/dist/access-boundary.js +65 -60
- package/dist/access-cli.js +137 -133
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +3 -1
- package/dist/access-coding-context-resolution.js +3 -3
- package/dist/access-extraction-force-flush.d.ts +14 -11
- package/dist/access-extraction-force-flush.js +65 -60
- package/dist/access-health-types.d.ts +3 -1
- package/dist/access-http-briefing.d.ts +14 -11
- package/dist/access-http-briefing.js +66 -61
- package/dist/access-http-lcm-compaction.d.ts +14 -11
- package/dist/access-http-lifecycle-flush.d.ts +14 -11
- package/dist/access-http-offline-stream.d.ts +14 -11
- package/dist/access-http-query.d.ts +4 -2
- package/dist/access-http-query.js +67 -62
- package/dist/access-http.d.ts +15 -12
- package/dist/access-http.js +86 -82
- package/dist/access-identity-continuity-surface.d.ts +12 -9
- package/dist/access-identity-continuity-surface.js +65 -60
- package/dist/access-lcm-surface.d.ts +14 -11
- package/dist/access-lcm-surface.js +65 -60
- package/dist/access-mcp.d.ts +14 -11
- package/dist/access-mcp.js +74 -70
- package/dist/access-memory-search-fanout.d.ts +4 -2
- package/dist/{access-namespace-preflight-DMR-jOMS.d.ts → access-namespace-preflight-D8qri11P.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +5 -3
- package/dist/access-namespace-preflight.js +65 -60
- package/dist/access-observe-transcript.d.ts +12 -9
- package/dist/access-observe-transcript.js +3 -3
- package/dist/access-observe-write-surface.d.ts +16 -13
- package/dist/access-observe-write-surface.js +65 -60
- package/dist/access-offline-manifest.d.ts +48 -11
- package/dist/access-offline-manifest.js +18 -16
- package/dist/access-operations-batch.js +68 -64
- package/dist/access-operations.d.ts +15 -12
- package/dist/access-operations.js +73 -69
- package/dist/access-recall-concurrency.d.ts +14 -11
- package/dist/access-recall-concurrency.js +65 -60
- package/dist/access-recall-response.d.ts +14 -11
- package/dist/access-recall-response.js +65 -60
- package/dist/access-recall-surface.d.ts +14 -11
- package/dist/access-recall-surface.js +65 -60
- package/dist/access-schema.d.ts +56 -13
- package/dist/access-schema.js +15 -1
- package/dist/{access-service-CJQoQvRa.d.ts → access-service-CKu5ixg9.d.ts} +52 -50
- package/dist/access-service-helpers.d.ts +14 -11
- package/dist/access-service.d.ts +14 -11
- package/dist/access-service.js +65 -60
- package/dist/access-surface-catalog.d.ts +14 -11
- package/dist/access-surface-catalog.js +67 -62
- 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 +3 -1
- package/dist/active-memory-bridge.d.ts +3 -1
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.d.ts +3 -1
- package/dist/active-recall.js +12 -10
- package/dist/active-recall.js.map +1 -1
- package/dist/activity/digest.d.ts +3 -1
- package/dist/adapters/index.d.ts +46 -1
- package/dist/adapters/index.js +10 -6
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +3 -1
- package/dist/artifact-search.d.ts +3 -1
- package/dist/{auto-sync-NSHLUAQI.js → auto-sync-4YFATLFQ.js} +10 -9
- package/dist/{auto-sync-NSHLUAQI.js.map → auto-sync-4YFATLFQ.js.map} +1 -1
- package/dist/behavior-learner.d.ts +3 -1
- package/dist/behavior-signals.d.ts +3 -1
- package/dist/bootstrap.d.ts +12 -9
- package/dist/briefing-window.d.ts +4 -2
- package/dist/briefing.d.ts +4 -2
- package/dist/briefing.js +26 -25
- package/dist/buffer-surprise-report.d.ts +3 -1
- package/dist/buffer-turn-helpers.d.ts +3 -1
- package/dist/buffer.d.ts +4 -2
- package/dist/buffer.js +11 -10
- package/dist/bulk-import/index.d.ts +5 -3
- package/dist/calibration.d.ts +3 -1
- package/dist/calibration.js +3 -2
- package/dist/calibration.js.map +1 -1
- package/dist/capabilities.d.ts +3 -1
- package/dist/{capsule-merge-IPG4IOFP.js → capsule-merge-ZCXUPLNJ.js} +2 -2
- package/dist/{catalog-8O9KY9eA.d.ts → catalog-Bq1AxZwF.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +3 -1
- package/dist/causal-consolidation.d.ts +3 -1
- package/dist/causal-consolidation.js +27 -26
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +3 -1
- package/dist/{chunk-CDKHKZL5.js → chunk-2524MOWK.js} +2 -2
- package/dist/{chunk-HVAEXYPL.js → chunk-255PC37A.js} +47 -25
- package/dist/chunk-255PC37A.js.map +1 -0
- package/dist/{chunk-2C3S7J2S.js → chunk-2BQ4ZIWC.js} +741 -28
- package/dist/chunk-2BQ4ZIWC.js.map +1 -0
- package/dist/{chunk-RKBLRTNT.js → chunk-2YLMUME2.js} +2 -2
- package/dist/{chunk-QOIOACIE.js → chunk-326KUXIR.js} +15 -648
- package/dist/chunk-326KUXIR.js.map +1 -0
- package/dist/{chunk-DBQWVT2H.js → chunk-3CBI2ZSA.js} +2 -2
- package/dist/{chunk-MWFGUESQ.js → chunk-3FJKJ5UZ.js} +2 -2
- package/dist/{chunk-NZXEK3UF.js → chunk-3Q3N35W7.js} +2 -2
- package/dist/{chunk-YYGZJPOK.js → chunk-42DJ235G.js} +2 -2
- package/dist/{chunk-SO7SV523.js → chunk-4MDKNUV4.js} +1 -1
- package/dist/chunk-4MDKNUV4.js.map +1 -0
- package/dist/chunk-5HYUUFMQ.js +1280 -0
- package/dist/chunk-5HYUUFMQ.js.map +1 -0
- package/dist/{chunk-2JVJ7UHC.js → chunk-5JG5EBVL.js} +4 -2
- package/dist/chunk-5JG5EBVL.js.map +1 -0
- package/dist/{chunk-HV7OY4DM.js → chunk-5VAF4ID4.js} +643 -202
- package/dist/chunk-5VAF4ID4.js.map +1 -0
- package/dist/{chunk-N7RWREIQ.js → chunk-65RENJGB.js} +6 -1
- package/dist/chunk-65RENJGB.js.map +1 -0
- package/dist/{chunk-JTH2SE6B.js → chunk-6J6K3STG.js} +8 -8
- package/dist/{chunk-H4VH5VIB.js → chunk-776GVKL7.js} +2 -2
- package/dist/{chunk-BUTCAMJM.js → chunk-A2YQL2FF.js} +5 -5
- package/dist/chunk-A5UQ52YQ.js +211 -0
- package/dist/chunk-A5UQ52YQ.js.map +1 -0
- package/dist/{chunk-X2NFFBTO.js → chunk-A7GQBJP5.js} +4 -4
- package/dist/{chunk-CGC5UQCF.js → chunk-AKE4GGQ3.js} +2 -2
- package/dist/{chunk-B325AGLK.js → chunk-AZSKROVQ.js} +2 -2
- package/dist/{chunk-I5DZ3WGR.js → chunk-BJETIR53.js} +3 -3
- package/dist/{chunk-JT3EB7ZL.js → chunk-BNGHPYZU.js} +5 -5
- package/dist/chunk-BRZWWUCJ.js +13 -0
- package/dist/{chunk-FYDW33ZB.js.map → chunk-BRZWWUCJ.js.map} +1 -1
- package/dist/{chunk-3JVLGJCY.js → chunk-C6KRO3SU.js} +2 -2
- package/dist/{chunk-5NANRSCD.js → chunk-CNV2A557.js} +5 -5
- package/dist/{chunk-PBGVVDLY.js → chunk-DK4X5B6I.js} +2 -2
- package/dist/{chunk-MFDTVQJX.js → chunk-DVOBLPSQ.js} +22 -7
- package/dist/chunk-DVOBLPSQ.js.map +1 -0
- package/dist/{chunk-N2ZNPHA3.js → chunk-ECKG5WSI.js} +2 -2
- package/dist/{chunk-PYLL63BF.js → chunk-EEBQFG5E.js} +9 -9
- package/dist/{chunk-ET356KSB.js → chunk-F4TWWUMP.js} +2 -2
- package/dist/{chunk-RHQMKJFG.js → chunk-F6IVBYFS.js} +55 -51
- package/dist/{chunk-RHQMKJFG.js.map → chunk-F6IVBYFS.js.map} +1 -1
- package/dist/{chunk-CLLPJ6QT.js → chunk-FQXJAC3T.js} +2 -2
- package/dist/{chunk-JGHXXQ2G.js → chunk-FVJ4D6L7.js} +2 -2
- package/dist/{chunk-DD5JFCWM.js → chunk-GCBIXUPT.js} +2 -2
- package/dist/{chunk-MN3LK3KN.js → chunk-GLZH5VEN.js} +2 -2
- package/dist/{chunk-S7T2TY65.js → chunk-HC4GFLMQ.js} +3 -3
- package/dist/{chunk-EQHDH4C2.js → chunk-HUT2JR6I.js} +3 -3
- package/dist/{chunk-UUQG7HAD.js → chunk-HXSAWV3A.js} +4 -4
- package/dist/{chunk-XXIHX75O.js → chunk-J7PB5UQ4.js} +3 -3
- package/dist/{chunk-UGPUYIET.js → chunk-JHZCXUQI.js} +221 -400
- package/dist/chunk-JHZCXUQI.js.map +1 -0
- package/dist/{chunk-LTIZHLV7.js → chunk-JR6H5CYS.js} +2 -2
- package/dist/{chunk-FCSZ4K2X.js → chunk-JR6PP7UM.js} +3 -3
- package/dist/{chunk-TCUKRAMK.js → chunk-JRWW7GM6.js} +10 -10
- package/dist/{chunk-Q726HSJO.js → chunk-JSRVXI6E.js} +16 -15
- package/dist/chunk-JSRVXI6E.js.map +1 -0
- package/dist/{chunk-DB5TGMLZ.js → chunk-JZ2CHRLB.js} +6 -4
- package/dist/{chunk-DB5TGMLZ.js.map → chunk-JZ2CHRLB.js.map} +1 -1
- package/dist/{chunk-JEIXTYVG.js → chunk-L2QLDZJC.js} +46 -17
- package/dist/chunk-L2QLDZJC.js.map +1 -0
- package/dist/{chunk-PL7FYKHT.js → chunk-L2WQVSKP.js} +2 -2
- package/dist/{chunk-JSN44KIB.js → chunk-LEMD7WZJ.js} +9 -9
- package/dist/{chunk-VZWXFXLX.js → chunk-LMCD5W5B.js} +2 -2
- package/dist/{chunk-7BMXZCOT.js → chunk-LNDLXMH6.js} +3 -3
- package/dist/{chunk-3QQTXYZ6.js → chunk-LSLCFCCQ.js} +2 -1
- package/dist/chunk-LSLCFCCQ.js.map +1 -0
- package/dist/{chunk-EONF76DT.js → chunk-LYDJRF45.js} +2 -2
- package/dist/{chunk-MKD3OMPS.js → chunk-M3MYMWXG.js} +2 -2
- package/dist/{chunk-VGXM5B4H.js → chunk-MNIPH6LD.js} +2 -2
- package/dist/{chunk-A7XEPMQ6.js → chunk-MVAQ2WM3.js} +6 -6
- package/dist/chunk-MVAQ2WM3.js.map +1 -0
- package/dist/{chunk-6N3TQFZU.js → chunk-NN4JEFON.js} +3 -3
- package/dist/chunk-NPNSKE76.js +220 -0
- package/dist/chunk-NPNSKE76.js.map +1 -0
- package/dist/{chunk-MOZXTRC2.js → chunk-OQ7SSRXP.js} +19 -19
- package/dist/{chunk-XU6OEECT.js → chunk-OQQXGYMX.js} +3 -3
- package/dist/{chunk-4MHYKEOM.js → chunk-OS2AT2JU.js} +10 -10
- package/dist/{chunk-N57A4KPV.js → chunk-P3ONDDIJ.js} +2 -2
- package/dist/chunk-PCEYGOSL.js +66 -0
- package/dist/chunk-PCEYGOSL.js.map +1 -0
- package/dist/{chunk-R3HKWWUB.js → chunk-PHP3MUGF.js} +2 -2
- package/dist/{chunk-EEOUMG3J.js → chunk-PWPIERBM.js} +38 -6
- package/dist/chunk-PWPIERBM.js.map +1 -0
- package/dist/chunk-Q4AUIFUA.js +111 -0
- package/dist/chunk-Q4AUIFUA.js.map +1 -0
- package/dist/{chunk-P3SB5BNT.js → chunk-QATYVTP7.js} +2 -2
- package/dist/{chunk-LSYDG6MJ.js → chunk-QBLDCI6E.js} +2 -2
- package/dist/{chunk-KCB7F4J7.js → chunk-QURNMKME.js} +2 -2
- package/dist/{chunk-XOVKXJEP.js → chunk-R3TLVTWW.js} +3 -3
- package/dist/{chunk-XXE5P6HJ.js → chunk-RRZKTSFG.js} +2 -2
- package/dist/{chunk-44T3Y7SZ.js → chunk-RUXPVSML.js} +5 -5
- package/dist/{chunk-DCJ3YFIC.js → chunk-S2ULTQZR.js} +2 -2
- package/dist/{chunk-H272ZPQ3.js → chunk-SHEHQBCG.js} +124 -23
- package/dist/chunk-SHEHQBCG.js.map +1 -0
- package/dist/{chunk-EEC4PCG5.js → chunk-SZDLX763.js} +2 -2
- package/dist/{chunk-E2ZHGBAK.js → chunk-T2JSUEH6.js} +2 -2
- package/dist/{chunk-227UFSEQ.js → chunk-TFA6HPOA.js} +2 -2
- package/dist/{chunk-BA6WOZOT.js → chunk-TK4FHQRN.js} +4 -4
- package/dist/{chunk-W27OW7AB.js → chunk-TKFSXDOB.js} +2 -2
- package/dist/chunk-TLHNF6GA.js +647 -0
- package/dist/chunk-TLHNF6GA.js.map +1 -0
- package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
- package/dist/{chunk-FDLDOEO6.js → chunk-UBG4GAEP.js} +51 -6
- package/dist/chunk-UBG4GAEP.js.map +1 -0
- package/dist/{chunk-CETXNLEX.js → chunk-UDZYNIDJ.js} +2 -2
- package/dist/{chunk-H5AFCNGA.js → chunk-UJX4I26O.js} +2 -2
- package/dist/{chunk-E6TDQRF6.js → chunk-UYUCCQ46.js} +2 -2
- package/dist/{chunk-BLUYQFRH.js → chunk-VELCIWJZ.js} +15 -11
- package/dist/chunk-VELCIWJZ.js.map +1 -0
- package/dist/{chunk-OQDPBRQ6.js → chunk-VYXDUPYE.js} +2 -2
- package/dist/{chunk-ZG74PWRW.js → chunk-VZAKYDMJ.js} +2 -2
- package/dist/chunk-W6IJMWTZ.js +72 -0
- package/dist/chunk-W6IJMWTZ.js.map +1 -0
- package/dist/{chunk-NB5BCFUY.js → chunk-WHHEPAO3.js} +4 -4
- package/dist/{chunk-H3TKENU4.js → chunk-WIKO4SCR.js} +5 -5
- package/dist/{chunk-TX2UTLXC.js → chunk-WPDKBUWX.js} +2 -2
- package/dist/{chunk-YFLLGRXO.js → chunk-X2QPKLPL.js} +2 -2
- package/dist/{chunk-PFFZWDPE.js → chunk-XCOV45MO.js} +3 -3
- package/dist/{chunk-5BCNEBEN.js → chunk-XPJNT6PI.js} +4 -4
- package/dist/chunk-XW2T4QAW.js +1 -0
- package/dist/{chunk-J7HFPA6O.js → chunk-Y63ZFP4X.js} +2 -2
- package/dist/{chunk-D223ZDQV.js → chunk-YEDVOYL2.js} +2 -2
- package/dist/{chunk-TLPZ6MKZ.js → chunk-YEN4TREG.js} +541 -5
- package/dist/chunk-YEN4TREG.js.map +1 -0
- package/dist/{chunk-22FVR2KE.js → chunk-YJ6VCDMZ.js} +6 -2
- package/dist/chunk-YJ6VCDMZ.js.map +1 -0
- package/dist/{chunk-RC5DXXWC.js → chunk-YM7YN37H.js} +2 -2
- package/dist/{chunk-BPJNF7J2.js → chunk-YNN26CIZ.js} +2 -2
- package/dist/{chunk-VLXBE57O.js → chunk-YVGXH72Y.js} +2 -2
- package/dist/{chunk-YQAXP5AC.js → chunk-YXLUTALO.js} +5 -5
- package/dist/{chunk-DGGB65KC.js → chunk-Z7ACR6MJ.js} +3 -3
- package/dist/{chunk-X35W4S3L.js → chunk-ZBEGS7OB.js} +4 -4
- package/dist/{chunk-O75CRYGF.js → chunk-ZEFVK7XC.js} +1 -1
- package/dist/chunk-ZEFVK7XC.js.map +1 -0
- package/dist/{chunk-XUE46UYW.js → chunk-ZLN7AROH.js} +6 -6
- package/dist/{chunk-E6JA6XWY.js → chunk-ZTG4P7NZ.js} +1013 -1317
- package/dist/chunk-ZTG4P7NZ.js.map +1 -0
- package/dist/{chunk-HK32G473.js → chunk-ZWEZXVYH.js} +2 -2
- package/dist/{cli-D57e2Mqt.d.ts → cli-Bk7Ctql4.d.ts} +5 -5
- package/dist/cli-fallback.d.ts +11 -4
- package/dist/cli-fallback.js +5 -1
- package/dist/cli.d.ts +16 -13
- package/dist/cli.js +107 -103
- package/dist/coding/export-okf-codegraph.d.ts +3 -1
- package/dist/coding/export-okf-codegraph.js +32 -30
- package/dist/coding/export-okf-codegraph.js.map +1 -1
- package/dist/coding/pre-action-gate.d.ts +3 -1
- package/dist/compat/checks.js +2 -2
- package/dist/compat/codex-cli-fallback.d.ts +1 -1
- package/dist/compat/codex-cli-fallback.js +5 -1
- package/dist/compat/codex-cli-fallback.js.map +1 -1
- package/dist/compounding/engine.d.ts +4 -2
- package/dist/compounding/engine.js +27 -26
- package/dist/compounding/preference-consolidator.d.ts +3 -1
- package/dist/compression-optimizer.d.ts +3 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.js +12 -10
- package/dist/connectors/codex-materialize-runner.d.ts +3 -1
- package/dist/connectors/codex-materialize-runner.js +26 -25
- package/dist/connectors/codex-materialize.d.ts +3 -1
- package/dist/connectors/index.d.ts +3 -1
- package/dist/connectors/index.js +28 -27
- package/dist/consolidation-provenance-check.d.ts +4 -2
- package/dist/consolidation-undo.d.ts +4 -2
- package/dist/contradiction/index.d.ts +5 -3
- package/dist/contradiction/index.js +5 -5
- package/dist/{contradiction-scan-NOYMFG66.js → contradiction-scan-GVD4JJ7B.js} +3 -3
- package/dist/converge-config.d.ts +3 -1
- package/dist/convergence-refresh.d.ts +4 -2
- package/dist/convergence-refresh.js +28 -27
- package/dist/conversation-index/backend.d.ts +3 -1
- package/dist/conversation-index/backend.js +3 -3
- package/dist/conversation-index/chunker.d.ts +3 -1
- package/dist/conversation-index/faiss-adapter.d.ts +3 -1
- package/dist/conversation-index/faiss-adapter.js +2 -2
- package/dist/conversation-index/indexer.d.ts +3 -1
- package/dist/conversation-index/search.d.ts +3 -1
- package/dist/corpus-watermark.d.ts +3 -1
- package/dist/corpus-watermark.js +29 -28
- package/dist/cross-lingual-recall.d.ts +3 -1
- package/dist/day-summary.d.ts +3 -1
- package/dist/deep-recall-http-glue.d.ts +14 -11
- package/dist/deep-recall-http-glue.js +12 -2
- package/dist/deep-recall-mcp-tools.d.ts +14 -11
- package/dist/deep-recall-policy-llm.d.ts +3 -1
- package/dist/deep-recall-policy-llm.js +4 -3
- package/dist/deep-recall-seeds.d.ts +3 -1
- package/dist/delinearize.d.ts +3 -1
- package/dist/dependency-propagation-config.d.ts +3 -1
- package/dist/{dependency-propagation-delivery-CmniEsUK.d.ts → dependency-propagation-delivery-DLiAtj25.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +3 -1
- package/dist/direct-answer.d.ts +3 -1
- package/dist/embedding-fallback.d.ts +3 -1
- package/dist/enrichment/index.d.ts +3 -1
- package/dist/entity-origin-fields.d.ts +3 -1
- package/dist/entity-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +26 -25
- package/dist/entity-schema.d.ts +3 -1
- package/dist/episodic-context.d.ts +3 -1
- package/dist/eval-trajectory-contracts.d.ts +3 -1
- package/dist/eval-trajectory-store.d.ts +3 -1
- package/dist/eval-trajectory.d.ts +3 -1
- package/dist/explicit-capture.d.ts +12 -9
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.d.ts +14 -11
- package/dist/external-wiki-access.js +66 -61
- package/dist/external-wiki-collection-registration.d.ts +3 -1
- package/dist/external-wiki-collection.d.ts +3 -1
- package/dist/external-wiki-mcp-tools.d.ts +14 -11
- package/dist/extraction-error-classification.d.ts +3 -1
- package/dist/extraction-faithfulness.d.ts +3 -1
- package/dist/extraction-faithfulness.js +4 -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 -4
- package/dist/extraction-liveness.d.ts +3 -1
- package/dist/extraction-normalization.d.ts +3 -1
- package/dist/extraction-prompt.d.ts +3 -1
- package/dist/extraction-source-grounding-rules.d.ts +3 -1
- package/dist/extraction-source-grounding.d.ts +3 -1
- package/dist/extraction.d.ts +3 -1
- package/dist/extraction.js +38 -36
- package/dist/fallback-llm.d.ts +3 -1
- package/dist/fallback-llm.js +3 -2
- package/dist/{first-start-migration-RC345GPL.js → first-start-migration-L3UFX5CU.js} +3 -3
- package/dist/generic-recall-paths-DbitKJI5.d.ts +23 -0
- package/dist/graph-append-error.d.ts +3 -1
- package/dist/graph-dashboard-diff.d.ts +3 -1
- package/dist/graph-dashboard-key.d.ts +3 -1
- package/dist/graph-dashboard-parser.d.ts +3 -1
- package/dist/graph-edge-reinforcement.d.ts +3 -1
- package/dist/graph-jsonl.d.ts +3 -1
- package/dist/graph-path-reconstruction.d.ts +3 -1
- package/dist/graph-path-scoring.d.ts +3 -1
- package/dist/graph-snapshot.d.ts +3 -1
- package/dist/graph.d.ts +3 -1
- package/dist/harmonic-retrieval.js +2 -2
- package/dist/importance.d.ts +3 -1
- package/dist/importers/index.d.ts +3 -1
- package/dist/importers/test-utils.d.ts +3 -1
- package/dist/in-flight-reads.d.ts +3 -1
- package/dist/{index-BTAsSkPG.d.ts → index-BINUgPFo.d.ts} +2 -2
- package/dist/index.d.ts +303 -245
- package/dist/index.js +316 -214
- package/dist/intent.d.ts +3 -1
- package/dist/lcm/engine.d.ts +3 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +3 -1
- package/dist/lcm/index.js +7 -7
- package/dist/lcm/tools.d.ts +3 -1
- package/dist/lifecycle.d.ts +3 -1
- package/dist/live-connectors-runner.d.ts +3 -1
- package/dist/local-llm-config.d.ts +26 -0
- package/dist/local-llm-config.js +1 -0
- package/dist/local-llm.d.ts +5 -1
- package/dist/local-llm.js +3 -3
- package/dist/local-model-endpoint.d.ts +3 -1
- package/dist/location/index.d.ts +5 -3
- package/dist/location/index.js +29 -28
- package/dist/maintenance/memory-governance.d.ts +3 -1
- package/dist/maintenance/memory-governance.js +26 -25
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +4 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +26 -25
- package/dist/maintenance/rebuild-memory-projection.d.ts +4 -2
- package/dist/maintenance/rebuild-memory-projection.js +27 -26
- package/dist/{maintenance-DCvQGTzL.d.ts → maintenance-ag1gYztC.d.ts} +378 -4
- package/dist/mcp-memory-inspector-app.d.ts +14 -11
- package/dist/memory-action-policy.d.ts +3 -1
- package/dist/memory-cache.d.ts +3 -1
- package/dist/memory-controller.d.ts +3 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +3 -1
- package/dist/memory-projection-store.d.ts +3 -1
- package/dist/memory-provenance.d.ts +3 -1
- package/dist/memory-snapshot.d.ts +3 -1
- package/dist/memory-subject-cli.d.ts +14 -11
- package/dist/memory-subject.d.ts +14 -11
- package/dist/memory-worth-outcomes.d.ts +4 -2
- package/dist/migrate/from-engram.js +2 -2
- package/dist/models-json.d.ts +3 -1
- package/dist/namespaces/migrate.d.ts +5 -3
- package/dist/namespaces/migrate.js +27 -26
- package/dist/namespaces/principal.d.ts +3 -1
- package/dist/namespaces/search.d.ts +3 -1
- package/dist/namespaces/search.js +8 -8
- package/dist/namespaces/storage.d.ts +5 -3
- package/dist/namespaces/storage.js +26 -25
- package/dist/native-knowledge.d.ts +3 -1
- package/dist/network/tailscale.js +2 -2
- package/dist/offline-sync-impression-drain.d.ts +3 -1
- package/dist/offline-sync-impression-drain.js +6 -6
- package/dist/operator-doctor-corpus.d.ts +3 -1
- package/dist/operator-doctor-corpus.js +30 -29
- package/dist/operator-doctor-replica.d.ts +3 -1
- package/dist/operator-toolkit.d.ts +5 -3
- package/dist/operator-toolkit.js +44 -42
- package/dist/orchestration/compression-guideline-coordinator.d.ts +4 -2
- package/dist/orchestration/maintenance.d.ts +6 -4
- package/dist/orchestration/maintenance.js +44 -39
- package/dist/{orchestrator-CvCsp1tz.d.ts → orchestrator-Cf3G-3Ed.d.ts} +17 -29
- package/dist/orchestrator.d.ts +12 -9
- package/dist/orchestrator.js +141 -135
- package/dist/patterns-cli.d.ts +3 -1
- package/dist/{pipeline-JAdwKBS7.d.ts → pipeline-AwB03fw_.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +3 -1
- package/dist/proactive-contention.d.ts +3 -1
- package/dist/provenance.d.ts +3 -1
- package/dist/{public-http-h-yWu9rj.d.ts → public-http-BetSQn7q.d.ts} +1 -1
- package/dist/{qmd-Cvw9RWKr.d.ts → qmd-Bfaydrfm.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +4 -2
- package/dist/qmd-recall-cache.d.ts +3 -1
- package/dist/qmd.d.ts +4 -2
- package/dist/qmd.js +2 -2
- package/dist/recall-concurrency-config.d.ts +3 -1
- package/dist/recall-disclosure-escalation.d.ts +3 -1
- package/dist/recall-explain-renderer.d.ts +3 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +3 -1
- package/dist/recall-navigate-access.d.ts +3 -1
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.d.ts +3 -1
- package/dist/recall-navigate-disclosure.js +1 -1
- package/dist/recall-navigate.d.ts +3 -1
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-planner-llm.d.ts +3 -1
- package/dist/recall-planner-llm.js +3 -2
- package/dist/recall-planner-llm.js.map +1 -1
- package/dist/recall-state-view-admission.d.ts +57 -0
- package/dist/recall-state-view-admission.js +39 -0
- package/dist/recall-state-view-admission.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.d.ts +18 -1
- package/dist/recall-state-view-widen.js +2 -2
- package/dist/recall-state-view-wire.d.ts +1 -1
- package/dist/recall-state-view-wire.js +3 -3
- package/dist/recall-state-view.d.ts +1 -0
- package/dist/recall-state-view.js +1 -1
- package/dist/recall-state.d.ts +3 -1
- package/dist/recall-tag-filter.d.ts +3 -1
- package/dist/recall-timings.d.ts +3 -1
- package/dist/recall-xray-cli.d.ts +3 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +3 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +10 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +12 -2
- package/dist/reconcile/cursor.js +6 -4
- package/dist/reconcile/cursor.js.map +1 -1
- package/dist/reconcile/manifest.d.ts +38 -2
- package/dist/reconcile/manifest.js +15 -5
- package/dist/reconcile/plan.d.ts +3 -1
- package/dist/replay/normalizers/chatgpt.d.ts +3 -1
- package/dist/replay/normalizers/claude.d.ts +3 -1
- package/dist/replay/normalizers/openclaw.d.ts +3 -1
- package/dist/replay/normalizers/shared.d.ts +3 -1
- package/dist/replay/runner.d.ts +3 -1
- package/dist/replay/types.d.ts +3 -1
- package/dist/replica-divergence.d.ts +3 -1
- package/dist/replica-peers-config.d.ts +3 -1
- package/dist/{resolution-VKATP2HT.js → resolution-OHJZG45O.js} +6 -6
- package/dist/resolution-OHJZG45O.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +3 -1
- package/dist/resume-bundles.js +13 -11
- package/dist/retrieval-agents.d.ts +4 -2
- package/dist/retrieval-tiers.d.ts +3 -1
- package/dist/routing/engine.d.ts +3 -1
- package/dist/routing/store.d.ts +3 -1
- package/dist/runtime/child-process.d.ts +1 -1
- package/dist/runtime/child-process.js +1 -1
- package/dist/salvage-envelope.d.ts +3 -1
- package/dist/salvage-envelope.js +2 -2
- package/dist/{scope-profiles-BShpTPeV.d.ts → scope-profiles-nxTKvjE-.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +3 -1
- package/dist/search/factory.d.ts +3 -1
- package/dist/search/factory.js +7 -7
- package/dist/search/index.d.ts +3 -1
- package/dist/search/index.js +11 -11
- package/dist/search/lancedb-backend.d.ts +3 -1
- package/dist/search/meilisearch-backend.d.ts +3 -1
- package/dist/search/noop-backend.d.ts +3 -1
- package/dist/search/orama-backend.d.ts +3 -1
- package/dist/search/port.d.ts +3 -1
- package/dist/search/remote-backend.d.ts +3 -1
- package/dist/{semantic-consolidation-CusOpe9F.d.ts → semantic-consolidation-C83DVakV.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +4 -2
- package/dist/semantic-consolidation.js +27 -26
- package/dist/semantic-rule-promotion.js +26 -25
- package/dist/semantic-rule-verifier.d.ts +3 -1
- package/dist/semantic-rule-verifier.js +26 -25
- package/dist/{service-BbuVh1eS.d.ts → service-q-xtOoAr.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +3 -1
- package/dist/session-observer-state.d.ts +3 -1
- package/dist/shared-context/manager.d.ts +3 -1
- package/dist/signal.d.ts +3 -1
- package/dist/source-agent-qualifier.d.ts +3 -1
- package/dist/source-agent-qualifier.js +35 -33
- package/dist/standup/build.js +26 -25
- package/dist/{storage-BBLLuVTF.d.ts → storage-Ca0MbTfm.d.ts} +67 -6
- package/dist/storage.d.ts +5 -3
- package/dist/storage.js +25 -24
- package/dist/subject-config.d.ts +3 -1
- package/dist/subject-config.js +2 -2
- package/dist/summarizer.d.ts +3 -1
- package/dist/summarizer.js +6 -6
- package/dist/summary-snapshot.d.ts +3 -1
- package/dist/support-passport/index.d.ts +50 -15
- package/dist/support-passport/index.js +73 -64
- package/dist/temporal-supersession.d.ts +4 -2
- package/dist/temporal-timeline-recall.d.ts +3 -1
- package/dist/temporal-validity.d.ts +3 -1
- package/dist/threading.d.ts +3 -1
- package/dist/tier-migration.d.ts +4 -2
- package/dist/tier-routing.d.ts +3 -1
- package/dist/tier-routing.js +2 -2
- package/dist/{tier-stats-KA6OZX2C.js → tier-stats-VK5PCO2L.js} +3 -3
- package/dist/topics.d.ts +3 -1
- package/dist/transcript.d.ts +3 -1
- package/dist/transfer/capsule-import.js +1 -1
- package/dist/transfer/export-okf.d.ts +3 -1
- package/dist/transfer/export-okf.js +27 -26
- package/dist/transfer/types.d.ts +24 -24
- package/dist/trust-score-stage.d.ts +3 -1
- package/dist/trust-score.d.ts +3 -1
- package/dist/{types-igV4-sbB.d.ts → types-yDgWDkrJ.d.ts} +60 -34
- package/dist/types.d.ts +3 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +3 -1
- package/dist/verified-recall.js +26 -25
- package/dist/who-knows-cli.d.ts +14 -11
- package/dist/who-knows-cli.js +27 -26
- package/dist/who-knows.d.ts +14 -11
- package/dist/who-knows.js +26 -25
- package/dist/write-envelope.d.ts +5 -2
- package/dist/write-envelope.js +3 -1
- package/package.json +2 -2
- package/src/access-category-alias.test.ts +216 -0
- package/src/access-mcp.test.ts +73 -0
- package/src/access-mcp.ts +6 -6
- package/src/access-observe-write-surface.ts +19 -4
- package/src/access-offline-manifest.ts +297 -16
- package/src/access-recall-surface.ts +5 -5
- package/src/access-schema.ts +76 -7
- package/src/access-service.ts +11 -2
- package/src/activity/config.test.ts +124 -1
- package/src/activity/config.ts +150 -18
- package/src/activity/index.ts +3 -0
- package/src/activity/journal-extract-storage.test.ts +129 -0
- package/src/activity/journal-extract.test.ts +314 -0
- package/src/activity/journal-extract.ts +247 -0
- package/src/activity/journal-heading.test.ts +24 -1
- package/src/activity/journal-heading.ts +36 -0
- package/src/activity/journal-read.test.ts +242 -0
- package/src/activity/journal-read.ts +183 -0
- package/src/activity/journal-source.test.ts +15 -15
- package/src/activity/journal-source.ts +21 -14
- package/src/activity/journal-state.lock-worker.ts +30 -0
- package/src/activity/journal-state.test.ts +144 -0
- package/src/activity/journal-state.ts +107 -0
- package/src/activity/journal-strip.test.ts +106 -52
- package/src/activity/journal-strip.ts +35 -10
- package/src/activity/journal-vault-integration.test.ts +230 -0
- package/src/activity/journal-vault-provenance.test.ts +9 -7
- package/src/activity/journal-vault-provenance.ts +4 -10
- package/src/activity/journal-vault-read.test.ts +3 -2
- package/src/activity/journal-vault-read.ts +9 -139
- package/src/activity/journal.test.ts +74 -23
- package/src/activity/runner.test.ts +116 -1
- package/src/activity/runner.ts +25 -0
- package/src/activity/scheduler.ts +4 -0
- package/src/activity/store.test.ts +18 -0
- package/src/activity/store.ts +14 -0
- package/src/activity/sync-registration.ts +4 -0
- package/src/activity/timeline/analysis-metadata.ts +2 -0
- package/src/activity/timeline/analysis-provider.ts +140 -0
- package/src/activity/timeline/analysis-run.test.ts +419 -0
- package/src/activity/timeline/analysis-run.ts +106 -0
- package/src/activity/timeline/analysis.ts +66 -37
- package/src/activity/timeline/corrections.ts +9 -0
- package/src/activity/timeline/index.ts +3 -0
- package/src/activity/timeline/query.test.ts +71 -0
- package/src/activity/timeline/query.ts +57 -8
- package/src/activity/timeline/regenerate.test.ts +505 -0
- package/src/activity/timeline/regenerate.ts +373 -0
- package/src/activity/types.ts +40 -5
- package/src/adapters/grok-opencode.test.ts +146 -0
- package/src/adapters/grok.ts +53 -0
- package/src/adapters/index.ts +2 -0
- package/src/adapters/opencode.ts +52 -0
- package/src/adapters/registry.ts +4 -0
- package/src/cli-fallback.ts +13 -4
- package/src/config.test.ts +27 -1
- package/src/config.ts +17 -1
- package/src/dedup/merge.test.ts +732 -25
- package/src/fallback-llm.test.ts +53 -0
- package/src/fallback-llm.ts +12 -0
- package/src/index.ts +2 -0
- package/src/local-llm-config.ts +25 -0
- package/src/local-llm.ts +3 -1
- package/src/orchestration/dependency-propagation-recovery-replay.ts +1 -1
- package/src/orchestration/extraction-persist-deps.ts +9 -0
- package/src/orchestration/extraction-persist-promotion.test.ts +265 -6
- package/src/orchestration/extraction-persist-promotion.ts +42 -3
- package/src/orchestration/extraction-persist.ts +3 -3
- package/src/orchestration/harmonic-construction-persist.test.ts +115 -4
- package/src/orchestration/harmonic-construction-persist.ts +34 -6
- package/src/orchestration/maintenance.ts +1 -0
- package/src/orchestration/orchestrator-helpers.ts +6 -0
- package/src/orchestration/recall-entry.ts +16 -0
- package/src/orchestration/recall-internal-deps.ts +14 -0
- package/src/orchestration/recall-internal.ts +41 -58
- package/src/orchestration/recall-result-formatter.ts +11 -1
- package/src/orchestration/recall-search-pipeline.ts +121 -11
- package/src/orchestration/recall-state-view-pipeline.test.ts +211 -0
- package/src/orchestration/semantic-merge-commit-effects.ts +76 -17
- package/src/orchestration/semantic-merge-persist.ts +121 -16
- package/src/orchestration/semantic-merge-promotion-payload.ts +133 -54
- package/src/orchestrator.ts +7 -35
- package/src/providers/codex-subscription.test.ts +666 -0
- package/src/providers/codex-subscription.ts +743 -0
- package/src/recall-disclosure.test.ts +20 -0
- package/src/recall-state-view-admission.ts +114 -0
- package/src/recall-state-view-asof.test.ts +176 -0
- package/src/recall-state-view-call.test.ts +175 -0
- package/src/recall-state-view-config.test.ts +16 -0
- package/src/recall-state-view-widen.test.ts +70 -0
- package/src/recall-state-view-widen.ts +28 -7
- package/src/recall-state-view-wire.ts +3 -1
- package/src/recall-state-view-zero-diff.test.ts +20 -11
- package/src/recall-state-view.test.ts +142 -0
- package/src/recall-state-view.ts +72 -24
- package/src/recall-xray-renderer.test.ts +27 -0
- package/src/recall-xray-renderer.ts +4 -0
- package/src/recall-xray.ts +13 -0
- package/src/reconcile/cursor.ts +23 -33
- package/src/reconcile/manifest.ts +96 -11
- package/src/reconcile-identity-cache.test.ts +378 -0
- package/src/runtime/child-process.ts +1 -1
- package/src/storage/cas-revision-host.ts +75 -0
- package/src/storage/cas-revision-store.test.ts +459 -0
- package/src/storage/cas-revision-store.ts +661 -0
- package/src/storage/deletion-revision-store.ts +80 -6
- package/src/storage/tombstone-blocked-capture-index.ts +15 -0
- package/src/storage/tombstone-blocked-capture-mutation.ts +67 -7
- package/src/storage/tombstone-blocked-capture-sync.ts +55 -20
- package/src/storage-contract/failure-semantics.test.ts +1 -1
- package/src/storage-frontmatter-cas.test.ts +698 -1
- package/src/storage-replay.test.ts +166 -3
- package/src/storage.ts +41 -41
- package/src/support-passport/card-projection.ts +82 -33
- package/src/temporal-supersession.test.ts +10 -10
- package/src/types.ts +10 -29
- package/src/write-envelope.ts +1 -1
- package/dist/chunk-22FVR2KE.js.map +0 -1
- package/dist/chunk-2C3S7J2S.js.map +0 -1
- package/dist/chunk-2JVJ7UHC.js.map +0 -1
- package/dist/chunk-2QSZNTDO.js +0 -56
- package/dist/chunk-2QSZNTDO.js.map +0 -1
- package/dist/chunk-3QQTXYZ6.js.map +0 -1
- package/dist/chunk-5VCDKQWQ.js +0 -560
- package/dist/chunk-5VCDKQWQ.js.map +0 -1
- package/dist/chunk-A7XEPMQ6.js.map +0 -1
- package/dist/chunk-BLUYQFRH.js.map +0 -1
- package/dist/chunk-E6JA6XWY.js.map +0 -1
- package/dist/chunk-EEOUMG3J.js.map +0 -1
- package/dist/chunk-FDLDOEO6.js.map +0 -1
- package/dist/chunk-FYDW33ZB.js +0 -13
- package/dist/chunk-H272ZPQ3.js.map +0 -1
- package/dist/chunk-HV7OY4DM.js.map +0 -1
- package/dist/chunk-HVAEXYPL.js.map +0 -1
- package/dist/chunk-JEIXTYVG.js.map +0 -1
- package/dist/chunk-LRICZIGN.js +0 -52
- package/dist/chunk-LRICZIGN.js.map +0 -1
- package/dist/chunk-MFDTVQJX.js.map +0 -1
- package/dist/chunk-N7RWREIQ.js.map +0 -1
- package/dist/chunk-O75CRYGF.js.map +0 -1
- package/dist/chunk-Q726HSJO.js.map +0 -1
- package/dist/chunk-QOIOACIE.js.map +0 -1
- package/dist/chunk-SEDEKFYQ.js +0 -1
- package/dist/chunk-SO7SV523.js.map +0 -1
- package/dist/chunk-TLPZ6MKZ.js.map +0 -1
- package/dist/chunk-UGPUYIET.js.map +0 -1
- package/src/activity/journal-mode.test.ts +0 -32
- package/src/activity/journal-mode.ts +0 -20
- /package/dist/{capsule-merge-IPG4IOFP.js.map → capsule-merge-ZCXUPLNJ.js.map} +0 -0
- /package/dist/{chunk-CDKHKZL5.js.map → chunk-2524MOWK.js.map} +0 -0
- /package/dist/{chunk-RKBLRTNT.js.map → chunk-2YLMUME2.js.map} +0 -0
- /package/dist/{chunk-DBQWVT2H.js.map → chunk-3CBI2ZSA.js.map} +0 -0
- /package/dist/{chunk-MWFGUESQ.js.map → chunk-3FJKJ5UZ.js.map} +0 -0
- /package/dist/{chunk-NZXEK3UF.js.map → chunk-3Q3N35W7.js.map} +0 -0
- /package/dist/{chunk-YYGZJPOK.js.map → chunk-42DJ235G.js.map} +0 -0
- /package/dist/{chunk-JTH2SE6B.js.map → chunk-6J6K3STG.js.map} +0 -0
- /package/dist/{chunk-H4VH5VIB.js.map → chunk-776GVKL7.js.map} +0 -0
- /package/dist/{chunk-BUTCAMJM.js.map → chunk-A2YQL2FF.js.map} +0 -0
- /package/dist/{chunk-X2NFFBTO.js.map → chunk-A7GQBJP5.js.map} +0 -0
- /package/dist/{chunk-CGC5UQCF.js.map → chunk-AKE4GGQ3.js.map} +0 -0
- /package/dist/{chunk-B325AGLK.js.map → chunk-AZSKROVQ.js.map} +0 -0
- /package/dist/{chunk-I5DZ3WGR.js.map → chunk-BJETIR53.js.map} +0 -0
- /package/dist/{chunk-JT3EB7ZL.js.map → chunk-BNGHPYZU.js.map} +0 -0
- /package/dist/{chunk-3JVLGJCY.js.map → chunk-C6KRO3SU.js.map} +0 -0
- /package/dist/{chunk-5NANRSCD.js.map → chunk-CNV2A557.js.map} +0 -0
- /package/dist/{chunk-PBGVVDLY.js.map → chunk-DK4X5B6I.js.map} +0 -0
- /package/dist/{chunk-N2ZNPHA3.js.map → chunk-ECKG5WSI.js.map} +0 -0
- /package/dist/{chunk-PYLL63BF.js.map → chunk-EEBQFG5E.js.map} +0 -0
- /package/dist/{chunk-ET356KSB.js.map → chunk-F4TWWUMP.js.map} +0 -0
- /package/dist/{chunk-CLLPJ6QT.js.map → chunk-FQXJAC3T.js.map} +0 -0
- /package/dist/{chunk-JGHXXQ2G.js.map → chunk-FVJ4D6L7.js.map} +0 -0
- /package/dist/{chunk-DD5JFCWM.js.map → chunk-GCBIXUPT.js.map} +0 -0
- /package/dist/{chunk-MN3LK3KN.js.map → chunk-GLZH5VEN.js.map} +0 -0
- /package/dist/{chunk-S7T2TY65.js.map → chunk-HC4GFLMQ.js.map} +0 -0
- /package/dist/{chunk-EQHDH4C2.js.map → chunk-HUT2JR6I.js.map} +0 -0
- /package/dist/{chunk-UUQG7HAD.js.map → chunk-HXSAWV3A.js.map} +0 -0
- /package/dist/{chunk-XXIHX75O.js.map → chunk-J7PB5UQ4.js.map} +0 -0
- /package/dist/{chunk-LTIZHLV7.js.map → chunk-JR6H5CYS.js.map} +0 -0
- /package/dist/{chunk-FCSZ4K2X.js.map → chunk-JR6PP7UM.js.map} +0 -0
- /package/dist/{chunk-TCUKRAMK.js.map → chunk-JRWW7GM6.js.map} +0 -0
- /package/dist/{chunk-PL7FYKHT.js.map → chunk-L2WQVSKP.js.map} +0 -0
- /package/dist/{chunk-JSN44KIB.js.map → chunk-LEMD7WZJ.js.map} +0 -0
- /package/dist/{chunk-VZWXFXLX.js.map → chunk-LMCD5W5B.js.map} +0 -0
- /package/dist/{chunk-7BMXZCOT.js.map → chunk-LNDLXMH6.js.map} +0 -0
- /package/dist/{chunk-EONF76DT.js.map → chunk-LYDJRF45.js.map} +0 -0
- /package/dist/{chunk-MKD3OMPS.js.map → chunk-M3MYMWXG.js.map} +0 -0
- /package/dist/{chunk-VGXM5B4H.js.map → chunk-MNIPH6LD.js.map} +0 -0
- /package/dist/{chunk-6N3TQFZU.js.map → chunk-NN4JEFON.js.map} +0 -0
- /package/dist/{chunk-MOZXTRC2.js.map → chunk-OQ7SSRXP.js.map} +0 -0
- /package/dist/{chunk-XU6OEECT.js.map → chunk-OQQXGYMX.js.map} +0 -0
- /package/dist/{chunk-4MHYKEOM.js.map → chunk-OS2AT2JU.js.map} +0 -0
- /package/dist/{chunk-N57A4KPV.js.map → chunk-P3ONDDIJ.js.map} +0 -0
- /package/dist/{chunk-R3HKWWUB.js.map → chunk-PHP3MUGF.js.map} +0 -0
- /package/dist/{chunk-P3SB5BNT.js.map → chunk-QATYVTP7.js.map} +0 -0
- /package/dist/{chunk-LSYDG6MJ.js.map → chunk-QBLDCI6E.js.map} +0 -0
- /package/dist/{chunk-KCB7F4J7.js.map → chunk-QURNMKME.js.map} +0 -0
- /package/dist/{chunk-XOVKXJEP.js.map → chunk-R3TLVTWW.js.map} +0 -0
- /package/dist/{chunk-XXE5P6HJ.js.map → chunk-RRZKTSFG.js.map} +0 -0
- /package/dist/{chunk-44T3Y7SZ.js.map → chunk-RUXPVSML.js.map} +0 -0
- /package/dist/{chunk-DCJ3YFIC.js.map → chunk-S2ULTQZR.js.map} +0 -0
- /package/dist/{chunk-EEC4PCG5.js.map → chunk-SZDLX763.js.map} +0 -0
- /package/dist/{chunk-E2ZHGBAK.js.map → chunk-T2JSUEH6.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-BA6WOZOT.js.map → chunk-TK4FHQRN.js.map} +0 -0
- /package/dist/{chunk-W27OW7AB.js.map → chunk-TKFSXDOB.js.map} +0 -0
- /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
- /package/dist/{chunk-CETXNLEX.js.map → chunk-UDZYNIDJ.js.map} +0 -0
- /package/dist/{chunk-H5AFCNGA.js.map → chunk-UJX4I26O.js.map} +0 -0
- /package/dist/{chunk-E6TDQRF6.js.map → chunk-UYUCCQ46.js.map} +0 -0
- /package/dist/{chunk-OQDPBRQ6.js.map → chunk-VYXDUPYE.js.map} +0 -0
- /package/dist/{chunk-ZG74PWRW.js.map → chunk-VZAKYDMJ.js.map} +0 -0
- /package/dist/{chunk-NB5BCFUY.js.map → chunk-WHHEPAO3.js.map} +0 -0
- /package/dist/{chunk-H3TKENU4.js.map → chunk-WIKO4SCR.js.map} +0 -0
- /package/dist/{chunk-TX2UTLXC.js.map → chunk-WPDKBUWX.js.map} +0 -0
- /package/dist/{chunk-YFLLGRXO.js.map → chunk-X2QPKLPL.js.map} +0 -0
- /package/dist/{chunk-PFFZWDPE.js.map → chunk-XCOV45MO.js.map} +0 -0
- /package/dist/{chunk-5BCNEBEN.js.map → chunk-XPJNT6PI.js.map} +0 -0
- /package/dist/{chunk-SEDEKFYQ.js.map → chunk-XW2T4QAW.js.map} +0 -0
- /package/dist/{chunk-J7HFPA6O.js.map → chunk-Y63ZFP4X.js.map} +0 -0
- /package/dist/{chunk-D223ZDQV.js.map → chunk-YEDVOYL2.js.map} +0 -0
- /package/dist/{chunk-RC5DXXWC.js.map → chunk-YM7YN37H.js.map} +0 -0
- /package/dist/{chunk-BPJNF7J2.js.map → chunk-YNN26CIZ.js.map} +0 -0
- /package/dist/{chunk-VLXBE57O.js.map → chunk-YVGXH72Y.js.map} +0 -0
- /package/dist/{chunk-YQAXP5AC.js.map → chunk-YXLUTALO.js.map} +0 -0
- /package/dist/{chunk-DGGB65KC.js.map → chunk-Z7ACR6MJ.js.map} +0 -0
- /package/dist/{chunk-X35W4S3L.js.map → chunk-ZBEGS7OB.js.map} +0 -0
- /package/dist/{chunk-XUE46UYW.js.map → chunk-ZLN7AROH.js.map} +0 -0
- /package/dist/{chunk-HK32G473.js.map → chunk-ZWEZXVYH.js.map} +0 -0
- /package/dist/{contradiction-scan-NOYMFG66.js.map → contradiction-scan-GVD4JJ7B.js.map} +0 -0
- /package/dist/{first-start-migration-RC345GPL.js.map → first-start-migration-L3UFX5CU.js.map} +0 -0
- /package/dist/{resolution-VKATP2HT.js.map → local-llm-config.js.map} +0 -0
- /package/dist/{tier-stats-KA6OZX2C.js.map → tier-stats-VK5PCO2L.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestration/orchestrator-helpers.ts"],"sourcesContent":["/**\n * Orchestrator module-level helpers — relocated from orchestrator.ts\n * (issue #1526, seam 25).\n *\n * Pure functions, types, and constants that previously lived at module\n * level in orchestrator.ts: recall-mode planning, recall snapshots and\n * parsers, abort/race helpers, artifact recall limits, replay\n * source-time slicing, day-summary date utilities, and QMD startup\n * checks. orchestrator.ts re-exports the previously-public names so\n * every existing importer (coordinators, tests, root shims) keeps\n * working unchanged.\n *\n * Behavior-preserving move — no logic changes.\n */\n\nimport { createHash } from \"node:crypto\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { abortError as sharedAbortError, throwIfAborted as sharedThrowIfAborted } from \"../abort-error.js\";\nimport type { CapabilitySet } from \"../capabilities.js\";\nimport { buildCompressionGuidelinesMarkdown as buildCompressionGuidelinesMarkdownV2 } from \"../compression-optimizer.js\";\nimport { FallbackLlmClient } from \"../fallback-llm.js\";\nimport { hasBroadGraphIntent, planRecallMode } from \"../intent.js\";\nimport { resolveLifecycleState } from \"../lifecycle.js\";\nimport { log } from \"../logger.js\";\nimport type { GraphRecallRankedResult, GraphRecallShadowComparison } from \"./graph-recall-coordinator.js\";\nimport { parseQmdExplain } from \"../qmd.js\";\nimport type { GraphRecallExpandedEntry } from \"../recall-state.js\";\nimport type { RecallXrayServedBy } from \"../recall-xray.js\";\nimport type { RecallContextComposition } from \"../recall-context-composition.js\";\nimport { type BufferTurn, type MemoryActionEvent, type MemoryFile, type MemoryFrontmatter, type MemoryIntent, type PluginConfig, type QmdSearchResult, type RecallPlanMode, confidenceTier } from \"../types.js\";\nimport { categoryDirName } from \"../utils/category-dir.js\";\nimport { parseFlexibleIsoTimestamp } from \"../utils/iso-timestamp.js\";\n\n/** Freshness window for the artifact source status cache read by NamespaceReadFanoutCoordinator. */\nexport const ARTIFACT_STATUS_CACHE_TTL_MS = 60_000;\nexport interface BulkImportBatchIngestResult {\n attemptedTurnCount: number;\n extractionCount: number;\n persistedCount: number;\n durableOutputCount: number;\n skippedCount: number;\n failedCount: number;\n postPersistMetadataFailureCount: number;\n processedTurnCount: number;\n}\n\nexport class BulkImportBatchPartialFailureError extends Error {\n readonly partialResult: BulkImportBatchIngestResult;\n\n readonly originalError: unknown;\n\n constructor(\n message: string,\n partialResult: BulkImportBatchIngestResult,\n originalError: unknown,\n ) {\n super(message);\n this.name = \"BulkImportBatchPartialFailureError\";\n this.partialResult = partialResult;\n this.originalError = originalError;\n }\n}\n\nexport interface GraphRecallSnapshot {\n recordedAt: string;\n mode: RecallPlanMode | string;\n queryHash: string;\n queryLength: number;\n namespaces: string[];\n seedCount: number;\n expandedCount: number;\n seeds: string[];\n expanded: GraphRecallExpandedEntry[];\n status?: \"completed\" | \"skipped\" | \"aborted\";\n reason?: string;\n shadowMode?: boolean;\n queryIntent?: MemoryIntent;\n seedResults?: GraphRecallRankedResult[];\n finalResults?: GraphRecallRankedResult[];\n shadowComparison?: GraphRecallShadowComparison;\n}\n\nexport interface IntentDebugSnapshot {\n recordedAt: string;\n promptHash: string;\n promptLength: number;\n retrievalQueryHash: string;\n retrievalQueryLength: number;\n plannerEnabled: boolean;\n plannedMode: RecallPlanMode;\n effectiveMode: RecallPlanMode;\n recallResultLimit: number;\n queryIntent: MemoryIntent;\n graphExpandedIntentDetected: boolean;\n graphDecision: {\n status: \"not_requested\" | \"skipped\" | \"completed\" | \"aborted\";\n reason?: string;\n shadowMode: boolean;\n qmdAvailable: boolean;\n graphRecallEnabled: boolean;\n multiGraphMemoryEnabled: boolean;\n };\n}\n\nexport interface QmdRecallSnapshot {\n recordedAt: string;\n queryHash: string;\n queryLength: number;\n collection?: string;\n namespaces: string[];\n fetchLimit: number;\n primaryResultCount: number;\n hybridResultCount: number;\n queryAwareSeedCount: number;\n resultCount: number;\n intentHint?: string;\n explainEnabled: boolean;\n hybridTopUpUsed: boolean;\n hybridTopUpSkippedReason?: string;\n results: QmdSearchResult[];\n}\n\nexport interface RecallModeDecision {\n plannedMode: RecallPlanMode;\n effectiveMode: RecallPlanMode;\n graphExpandedIntentDetected: boolean;\n graphReason?: string;\n /**\n * Where `plannedMode` came from (issue #1367 / Option C). `\"heuristic\"` for\n * the regex planner; `\"llm\"` when the LLM planner classified it; and\n * `\"heuristic-fallback\"` when the LLM was enabled but errored/timed out and we\n * fell back. Absent on the synchronous heuristic-only path.\n */\n plannerSource?: \"heuristic\" | \"llm\" | \"heuristic-fallback\";\n /** Short rationale from the planner (for telemetry / x-ray). */\n plannerReason?: string;\n /** Wall-clock spent in the LLM planner call, when one was made. */\n plannerLatencyMs?: number;\n /** True when the LLM planner was enabled but fell back to the heuristic. */\n plannerFallbackUsed?: boolean;\n /** Model that served the LLM classification, when one was used. */\n plannerModelUsed?: string;\n /**\n * The regex-heuristic baseline mode, captured whenever the LLM planner ran\n * (any source). Lets operators compare planned-vs-heuristic during rollout —\n * distinct from `plannedMode`, which on the LLM path is the LLM's choice.\n */\n plannerHeuristicMode?: RecallPlanMode;\n /**\n * In shadow mode, the mode the LLM *would* have chosen (recorded for\n * comparison) while `effectiveMode` stays on the heuristic decision.\n */\n shadowLlmMode?: RecallPlanMode;\n}\n\n/**\n * Map the orchestrator's internal `recallSource` strings to the\n * X-ray `servedBy` vocabulary (issue #570 PR 1). The X-ray tier\n * ladder intentionally flattens QMD / embedding / cold-fallback to\n * the `hybrid` tier because they all materialize through the same\n * hybrid BM25+vector pipeline from the caller's perspective. The\n * `recent_scan` path gets its own dedicated tier because it bypasses\n * the hybrid pipeline entirely. `none` is treated as `hybrid` on the\n * theory that a query that returned nothing still routed through the\n * hybrid pipeline — but callers should normally gate capture on\n * `recalledMemoryIds.length > 0`.\n */\nexport function mapRecallSourceToXrayServedBy(\n source:\n | \"none\"\n | \"hot_qmd\"\n | \"hot_embedding\"\n | \"cold_fallback\"\n | \"recent_scan\",\n): RecallXrayServedBy {\n // Exhaustive switch: every current union member is explicitly\n // listed so TypeScript surfaces a compile error if a new source is\n // added without a deliberate mapping. The `never`-typed fallthrough\n // keeps the function total at runtime — if the caller passes an\n // unexpected value that slipped past the type system (e.g. a JSON\n // deserialization), we still fall back to `hybrid`.\n switch (source) {\n case \"recent_scan\":\n return \"recent-scan\";\n case \"hot_qmd\":\n case \"hot_embedding\":\n case \"cold_fallback\":\n case \"none\":\n return \"hybrid\";\n }\n const _exhaustive: never = source;\n void _exhaustive;\n return \"hybrid\";\n}\n\nexport interface RecallInvocationOptions {\n namespace?: string;\n topK?: number;\n mode?: RecallPlanMode;\n abortSignal?: AbortSignal;\n /** Server-resolved identity of the connector performing this recall. */\n sourceConnector?: string;\n /**\n * Capture a `RecallXraySnapshot` for this recall (issue #570). When\n * `true`, the orchestrator builds a snapshot from the data it has\n * already gathered and stashes it in memory, accessible via\n * `getLastXraySnapshot()`. When `false` or absent, nothing is\n * captured and recall behavior is unchanged (schema-only slice).\n */\n xrayCapture?: boolean;\n /**\n * Per-invocation override for `recallBudgetChars` (issue #570 PR 3/4).\n * Flows through `getRecallBudgetChars()` for this recall only — no\n * shared config mutation, so concurrent recalls on the same\n * orchestrator are not affected (CLAUDE.md rule 47: no shared\n * mutable state across async boundaries). Must be a non-negative\n * finite integer; non-conforming values are ignored and the\n * configured budget is used.\n */\n budgetCharsOverride?: number;\n /**\n * Per-invocation principal override (issue #570 PR 4). When set,\n * the orchestrator uses this principal for ACL / namespace checks\n * instead of `resolvePrincipal(sessionKey, config)`. This is the\n * escape hatch for access surfaces (HTTP / MCP) that have already\n * authenticated the caller upstream — threading an unmapped\n * principal through the session-key-based resolver would otherwise\n * collapse it to `\"default\"` and produce false denials in\n * namespace-enabled deployments (CLAUDE.md rule 42).\n */\n principalOverride?: string;\n /**\n * Historical recall point (issue #680). When set, the orchestrator\n * filters out memories whose `valid_at` is after this timestamp OR\n * whose `invalid_at` is at-or-before this timestamp, so callers see\n * the corpus as it existed at `asOf`. ISO 8601 string; comparisons\n * use `Date.parse()` so timezone-aware values round-trip correctly\n * (CLAUDE.md gotcha — never compare ISO strings lexicographically).\n * Invalid values must be rejected at input boundaries (CLAUDE.md\n * rule 51); the orchestrator does NOT silently fall back here.\n */\n asOf?: string;\n /**\n * Issue #681 — when `true`, bypasses `graphTraversalConfidenceFloor`\n * and includes edges below the floor in graph traversal. Useful for\n * diagnostic recall queries that need to surface results that would\n * normally be pruned by confidence decay. Default `false`.\n */\n includeLowConfidence?: boolean;\n /**\n * #1952 — per-call override enabling state-aware recall views for this\n * recall only (MCP `stateView` boolean). ORs with the `recallStateViews`\n * config flag; a change-intent query is still required for any effect.\n */\n stateView?: boolean;\n /**\n * User-aware context scopes active for this recall. Used by X-ray\n * provenance safety checks so boundary-scoped memories are evaluated\n * against the caller's real context.\n */\n currentContextScopes?: readonly unknown[];\n /**\n * Wall-clock ms the caller waited to begin execution — per-principal\n * semaphore queue + single-flight wait (issue #1906). Folded into\n * recall-timings additively as `queueWaitMs`; omitted phases are simply\n * absent, so existing timing consumers are unaffected.\n */\n queueWaitMs?: number;\n onContextComposition?: (composition: RecallContextComposition) => void | PromiseLike<void>;\n}\n\nexport type QueryAwarePrefilter = {\n candidatePaths: Set<string> | null;\n temporalFromDate: string | null;\n matchedTags: string[];\n expandedTags: string[];\n combination: \"none\" | \"temporal\" | \"tag\" | \"intersection\" | \"union\";\n filteredToFullSearch: boolean;\n};\n\n// Recall-specific abort helpers. Thin wrappers over the shared\n// `abort-error.ts` module so every abort in the codebase shares the\n// same `name === \"AbortError\"` classification contract (`isAbortError`\n// works uniformly). We keep the \"recall aborted\" default message for\n// back-compat with call-site logs; callers that pass an explicit\n// message (e.g. \"extraction aborted (before_extract)\") are unaffected.\nexport const abortRecallError = sharedAbortError;\n\nexport function throwIfRecallAborted(\n signal?: AbortSignal,\n message = \"recall aborted\",\n): void {\n sharedThrowIfAborted(signal, message);\n}\n\nexport async function raceRecallAbort<T>(\n promise: Promise<T>,\n signal?: AbortSignal,\n message = \"recall aborted\",\n): Promise<T> {\n throwIfRecallAborted(signal, message);\n if (!signal) return promise;\n\n let onAbort: (() => void) | null = null;\n const abortPromise = new Promise<T>((_resolve, reject) => {\n onAbort = () => reject(abortRecallError(message));\n signal.addEventListener(\"abort\", onAbort, { once: true });\n });\n\n try {\n return await Promise.race([promise, abortPromise]);\n } finally {\n if (onAbort) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n}\n\n/** Maximum age (ms) before a compaction-reset signal file is considered stale and removed. */\nexport const COMPACTION_SIGNAL_MAX_AGE_MS = 60 * 60 * 1000; // 1 hour\n\nexport const DEFAULT_QMD_STARTUP_COLLECTION_CHECK_TIMEOUT_MS = 10_000;\n\nexport type DaySummaryGatherOptions = {\n timeZone?: string;\n now?: Date;\n};\n\nexport function normalizeIanaTimeZone(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n try {\n Intl.DateTimeFormat(undefined, { timeZone: trimmed });\n return trimmed;\n } catch {\n return undefined;\n }\n}\n\nexport function formatDateInTimeZone(date: Date, timeZone: string): string {\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n }).formatToParts(date);\n const get = (type: string): string => parts.find((part) => part.type === type)?.value ?? \"\";\n return `${get(\"year\")}-${get(\"month\")}-${get(\"day\")}`;\n}\n\nexport function utcDateKey(date: Date): string {\n return date.toISOString().slice(0, 10);\n}\n\nexport function utcDateKeysAround(date: Date): string[] {\n const dayMs = 86_400_000;\n const keys = [\n utcDateKey(new Date(date.getTime() - dayMs)),\n utcDateKey(date),\n utcDateKey(new Date(date.getTime() + dayMs)),\n ];\n return keys.filter((value, index, array) => array.indexOf(value) === index);\n}\n\nexport function utcDateKeysForLocalDay(date: Date, timeZone: string): string[] {\n const targetLocalDate = formatDateInTimeZone(date, timeZone);\n const keys = new Set<string>();\n const hourMs = 3_600_000;\n const scanStart = date.getTime() - 48 * hourMs;\n const scanEnd = date.getTime() + 48 * hourMs;\n for (let ms = scanStart; ms <= scanEnd; ms += hourMs) {\n const candidate = new Date(ms);\n if (formatDateInTimeZone(candidate, timeZone) === targetLocalDate) {\n keys.add(utcDateKey(candidate));\n }\n }\n return keys.size > 0 ? [...keys].sort() : utcDateKeysAround(date);\n}\n\nexport function parseFiniteDate(value: unknown): Date | null {\n if (typeof value !== \"string\" || value.trim().length === 0) return null;\n const parsed = new Date(value);\n return Number.isFinite(parsed.getTime()) ? parsed : null;\n}\n\nexport function filterHourlySummaryMarkdownForLocalDay(\n raw: string,\n utcDate: string,\n timeZone: string,\n targetLocalDate: string,\n): string | null {\n const hourHeaderPattern = /^## ([01]\\d|2[0-3]):00[ \\t]*$/gm;\n const matches = Array.from(raw.matchAll(hourHeaderPattern));\n if (matches.length === 0) return null;\n\n const firstSectionStart = matches[0]?.index ?? 0;\n const preamble = raw.slice(0, firstSectionStart).trim();\n const sections: string[] = [];\n for (let index = 0; index < matches.length; index += 1) {\n const match = matches[index];\n const hour = match[1];\n if (!hour) continue;\n const sectionTimestamp = parseFiniteDate(`${utcDate}T${hour}:00:00.000Z`);\n if (\n !sectionTimestamp ||\n formatDateInTimeZone(sectionTimestamp, timeZone) !== targetLocalDate\n ) {\n continue;\n }\n const sectionStart = match.index ?? 0;\n const sectionEnd = matches[index + 1]?.index ?? raw.length;\n const section = raw.slice(sectionStart, sectionEnd).trim();\n if (section.length > 0) sections.push(section);\n }\n\n if (sections.length === 0) return null;\n return [preamble, ...sections]\n .filter((section) => section.length > 0)\n .join(\"\\n\\n\");\n}\n\nexport type SearchCollectionState = \"present\" | \"missing\" | \"unknown\" | \"skipped\";\n\nexport function qmdStartupCollectionCheckTimeoutMs(): number {\n const raw =\n process.env.REMNIC_QMD_STARTUP_COLLECTION_CHECK_TIMEOUT_MS ??\n process.env.ENGRAM_QMD_STARTUP_COLLECTION_CHECK_TIMEOUT_MS;\n if (raw === undefined) return DEFAULT_QMD_STARTUP_COLLECTION_CHECK_TIMEOUT_MS;\n const parsed = Number(raw);\n return Number.isFinite(parsed) && parsed >= 1_000\n ? Math.floor(parsed)\n : DEFAULT_QMD_STARTUP_COLLECTION_CHECK_TIMEOUT_MS;\n}\n\nexport async function qmdStartupCollectionCheckWithTimeout(\n promise: Promise<SearchCollectionState>,\n controller: AbortController,\n label: string,\n): Promise<SearchCollectionState> {\n const timeoutMs = qmdStartupCollectionCheckTimeoutMs();\n let timer: NodeJS.Timeout | undefined;\n let settled = false;\n\n const timeoutPromise = new Promise<SearchCollectionState>((resolve) => {\n timer = setTimeout(() => {\n if (settled) return;\n controller.abort();\n log.warn(\n `QMD startup collection check for ${label} timed out after ${timeoutMs}ms; keeping search enabled fail-open`,\n );\n resolve(\"unknown\");\n }, timeoutMs);\n timer.unref?.();\n });\n\n const checkedPromise = promise\n .catch((err): SearchCollectionState => {\n log.warn(\n `QMD startup collection check for ${label} failed; keeping search enabled fail-open: ${err}`,\n );\n return \"unknown\";\n })\n .finally(() => {\n settled = true;\n if (timer) clearTimeout(timer);\n });\n\n return await Promise.race([checkedPromise, timeoutPromise]);\n}\n\n/** Default workspace directory when no per-agent or config workspace is available. */\nexport function defaultWorkspaceDir(): string {\n return path.join(os.homedir(), \".openclaw\", \"workspace\");\n}\n\n/**\n * Produce a collision-resistant, filesystem-safe identifier from a session key.\n *\n * Session keys follow colon-delimited forms (e.g., `agent:gpucodebot:main`).\n * A naive replace (`:` → `_`) is lossy: different keys like `agent:alpha` and\n * `agent/alpha` would collide. Instead we append a short SHA-256 hash of the\n * original key to the human-readable sanitized prefix, guaranteeing uniqueness\n * while keeping filenames debuggable.\n *\n * Format: `<sanitized>-<12-char-hex-hash>`\n * Example: `agent:gpucodebot:main` → `agent_gpucodebot_main-a1b2c3d4e5f6`\n */\nexport function sanitizeSessionKeyForFilename(sessionKey: string): string {\n const readable = sessionKey.replace(/[^a-zA-Z0-9._-]/g, \"_\");\n const hash = createHash(\"sha256\")\n .update(sessionKey)\n .digest(\"hex\")\n .slice(0, 12);\n return `${readable}-${hash}`;\n}\n\nexport function sourceValidAtMs(turn: BufferTurn): number | null {\n if (typeof turn.sourceValidAt !== \"string\") return null;\n return parseFlexibleIsoTimestamp(turn.sourceValidAt.trim());\n}\n\nexport const SOURCE_VALID_AT_CONTEXT_TURNS = 2;\n\nexport function sourceValidAtSliceKey(turn: BufferTurn, index: number): string {\n const validAtMs = sourceValidAtMs(turn);\n return validAtMs === null ? `unknown:${index}` : String(validAtMs);\n}\n\nexport function asExtractionContextTurn(turn: BufferTurn): BufferTurn {\n return { ...turn, extractionContextOnly: true };\n}\n\nexport function asExtractionTargetTurn(turn: BufferTurn): BufferTurn {\n const { extractionContextOnly: _contextOnly, ...targetTurn } = turn;\n return targetTurn;\n}\n\nexport function sourceValidAtContextTurns(\n turns: readonly BufferTurn[],\n targetStart: number,\n targetEnd: number,\n targetValidAtMs: number | null,\n): BufferTurn[] {\n if (targetValidAtMs === null) return [];\n return turns\n .flatMap((turn, index) => {\n if (index >= targetStart && index < targetEnd) return [];\n const contextValidAtMs = sourceValidAtMs(turn);\n if (contextValidAtMs === null || contextValidAtMs > targetValidAtMs) {\n return [];\n }\n return [{ turn, index, validAtMs: contextValidAtMs }];\n })\n .sort((a, b) => {\n if (a.validAtMs < b.validAtMs) return -1;\n if (a.validAtMs > b.validAtMs) return 1;\n if (a.index === b.index) return 0;\n return a.index < b.index ? -1 : 1;\n })\n .slice(-SOURCE_VALID_AT_CONTEXT_TURNS)\n .map(({ turn }) => asExtractionContextTurn(turn));\n}\n\nexport function targetSourceValidAtSortMs(turns: readonly BufferTurn[]): number {\n let latestMs: number | null = null;\n for (const turn of turns) {\n if (turn.extractionContextOnly === true) continue;\n const validAtMs = sourceValidAtMs(turn);\n if (validAtMs === null) continue;\n if (latestMs === null || validAtMs > latestMs) {\n latestMs = validAtMs;\n }\n }\n return latestMs ?? Number.POSITIVE_INFINITY;\n}\n\nexport function sortSourceValidAtSlicesChronologically(\n slices: BufferTurn[][],\n): BufferTurn[][] {\n return slices\n .map((turns, order) => ({\n turns,\n order,\n targetValidAtMs: targetSourceValidAtSortMs(turns),\n }))\n .sort((a, b) => {\n if (a.targetValidAtMs < b.targetValidAtMs) return -1;\n if (a.targetValidAtMs > b.targetValidAtMs) return 1;\n if (a.order === b.order) return 0;\n return a.order < b.order ? -1 : 1;\n })\n .map((slice) => slice.turns);\n}\n\nexport function splitTurnsBySourceValidAt(\n turns: readonly BufferTurn[],\n options: { includeContext?: boolean } = {},\n): BufferTurn[][] {\n if (turns.length === 0) return [];\n if (!turns.some((turn) => sourceValidAtMs(turn) !== null)) {\n return [[...turns]];\n }\n\n const slices: BufferTurn[][] = [];\n let start = 0;\n while (start < turns.length) {\n const targetValidAtMs = sourceValidAtMs(turns[start]);\n const activeKey = sourceValidAtSliceKey(turns[start], start);\n let end = start + 1;\n while (\n end < turns.length &&\n sourceValidAtSliceKey(turns[end], end) === activeKey\n ) {\n end += 1;\n }\n\n const contextTurns =\n options.includeContext === false\n ? []\n : sourceValidAtContextTurns(turns, start, end, targetValidAtMs);\n slices.push([\n ...contextTurns,\n ...turns.slice(start, end).map(asExtractionTargetTurn),\n ]);\n start = end;\n }\n return sortSourceValidAtSlicesChronologically(slices);\n}\n\nexport function isArtifactMemoryPath(filePath: string): boolean {\n return /(?:^|[\\\\/])artifacts(?:[\\\\/]|$)/i.test(filePath);\n}\n\n/**\n * Meeting records (issue #1900) live at\n * `<root>/meetings/<YYYY-MM-DD>/mtg-<YYYY-MM-DD>-<hash>.md` — inside the QMD\n * collection root (full-text searchable) but NEVER surfaced through generic\n * recall, exactly like `artifacts/`. The predicate matches the FULL record\n * shape (anchored at the filename) rather than any `meetings` path segment, so\n * a namespaced deployment whose non-default namespace is literally named\n * `meetings` (`.../namespaces/meetings/facts/…`) keeps its ordinary memories in\n * recall — only true meeting records are excluded.\n */\nexport function isMeetingRecordPath(filePath: string): boolean {\n return /(?:^|[\\\\/])meetings[\\\\/]\\d{4}-\\d{2}-\\d{2}[\\\\/]mtg-\\d{4}-\\d{2}-\\d{2}-[0-9a-f]{8}\\.md$/i.test(filePath);\n}\n\n/** Exactly `activity/<YYYY-MM-DD>.md`, at the top level of a memory root. */\nconst ACTIVITY_DIGEST_TOPLEVEL = /^activity[\\\\/]\\d{4}-\\d{2}-\\d{2}\\.md$/i;\n/** The digest FILE shape anywhere in a path (root-unaware best-effort). */\nconst ACTIVITY_DIGEST_ANYWHERE = /(?:^|[\\\\/])activity[\\\\/]\\d{4}-\\d{2}-\\d{2}\\.md$/i;\n\n/**\n * Activity day-digests live at `<memoryRoot>/activity/<YYYY-MM-DD>.md` — a\n * dedicated searchable surface (explicit activity search), never generic recall.\n * Captured screen text must not auto-inject into ordinary prompts (issue #1899).\n * Keyed on the path (parseFrontmatter drops the digest's `kind` marker).\n *\n * Root-aware: when `memoryRoot` is given, the path is resolved relative to it and\n * must be the TOP-LEVEL `activity/<date>.md`, so an ordinary memory nested under\n * a category (e.g. `facts/proj/activity/<date>.md`) stays recallable. Without a\n * root, falls back to the digest file shape anywhere (best-effort).\n */\nexport function isActivityDigestPath(filePath: string, memoryRoot?: string): boolean {\n if (memoryRoot !== undefined && memoryRoot.length > 0) {\n const relative = path.relative(memoryRoot, path.resolve(memoryRoot, filePath));\n return ACTIVITY_DIGEST_TOPLEVEL.test(relative);\n }\n return ACTIVITY_DIGEST_ANYWHERE.test(filePath);\n}\n\n/** Exactly `locations/<YYYY-MM-DD>.md`, at the top level of a memory root. */\nconst LOCATION_DAY_TOPLEVEL = /^locations[\\\\/]\\d{4}-\\d{2}-\\d{2}\\.md$/i;\n/** The day-file shape anywhere in a path (root-unaware best-effort). */\nconst LOCATION_DAY_ANYWHERE = /(?:^|[\\\\/])locations[\\\\/]\\d{4}-\\d{2}-\\d{2}\\.md$/i;\n\n/**\n * Location day documents (issue #2044) live at\n * `<memoryRoot>/locations/<YYYY-MM-DD>.md` — a dedicated searchable surface,\n * never generic recall (place history must not auto-inject into ordinary\n * prompts). Root-aware exactly like `isActivityDigestPath`: with a root, only\n * the top-level `locations/<date>.md` matches, so an ordinary memory nested\n * under a category (e.g. `facts/locations-note.md`) stays recallable; without\n * a root, falls back to the day-file shape anywhere (best-effort).\n */\nexport function isLocationDayPath(filePath: string, memoryRoot?: string): boolean {\n if (memoryRoot !== undefined && memoryRoot.length > 0) {\n const relative = path.relative(memoryRoot, path.resolve(memoryRoot, filePath));\n return LOCATION_DAY_TOPLEVEL.test(relative);\n }\n return LOCATION_DAY_ANYWHERE.test(filePath);\n}\n\nexport function buildCompressionGuidelinesMarkdown(\n events: MemoryActionEvent[],\n generatedAtIso: string = new Date().toISOString(),\n): string {\n return buildCompressionGuidelinesMarkdownV2(events, generatedAtIso);\n}\n\n\nexport function applyQueryAwareCandidateFilter(\n candidates: QmdSearchResult[],\n candidatePaths: Set<string> | null,\n): QmdSearchResult[] {\n if (!candidatePaths) return candidates;\n if (candidatePaths.size === 0) return [];\n const filtered = candidates.filter((candidate) =>\n candidatePaths.has(candidate.path),\n );\n return filtered.length > 0 ? filtered : candidates;\n}\n\nexport function tokenizeRecallQuery(prompt: string): string[] {\n return prompt\n .toLowerCase()\n .split(/[^a-z0-9]+/i)\n .map((t) => t.trim())\n .filter((t) => t.length >= 3);\n}\n\nexport function hasLifecycleMetadata(frontmatter: MemoryFrontmatter): boolean {\n return (\n frontmatter.lifecycleState !== undefined ||\n frontmatter.verificationState !== undefined ||\n frontmatter.policyClass !== undefined ||\n frontmatter.lastValidatedAt !== undefined ||\n frontmatter.decayScore !== undefined ||\n frontmatter.heatScore !== undefined\n );\n}\n\nexport function shouldFilterLifecycleRecallCandidate(\n frontmatter: MemoryFrontmatter,\n options: {\n lifecyclePolicyEnabled: boolean;\n lifecycleFilterStaleEnabled: boolean;\n },\n): boolean {\n if (!options.lifecyclePolicyEnabled || !options.lifecycleFilterStaleEnabled)\n return false;\n if (!hasLifecycleMetadata(frontmatter)) return false;\n const lifecycleState = resolveLifecycleState(frontmatter);\n return lifecycleState === \"stale\" || lifecycleState === \"archived\";\n}\n\nexport function lifecycleRecallScoreAdjustment(\n frontmatter: MemoryFrontmatter,\n options: {\n lifecyclePolicyEnabled: boolean;\n },\n): number {\n if (!options.lifecyclePolicyEnabled) return 0;\n if (!hasLifecycleMetadata(frontmatter)) return 0;\n\n let delta = 0;\n const lifecycleState = resolveLifecycleState(frontmatter);\n switch (lifecycleState) {\n case \"active\":\n delta += 0.05;\n break;\n case \"validated\":\n delta += 0.03;\n break;\n case \"candidate\":\n delta -= 0.01;\n break;\n case \"stale\":\n delta -= 0.06;\n break;\n case \"archived\":\n delta -= 0.08;\n break;\n }\n if (frontmatter.verificationState === \"disputed\") {\n delta -= 0.12;\n }\n return delta;\n}\n\nexport function computeArtifactRecallLimit(\n recallMode: RecallPlanMode,\n recallResultLimit: number,\n verbatimArtifactsMaxRecall: number,\n): number {\n if (recallMode === \"no_recall\") return 0;\n if (Math.max(0, recallResultLimit) === 0) return 0;\n const base = Math.max(0, verbatimArtifactsMaxRecall);\n if (recallMode === \"minimal\") {\n return Math.min(base, Math.max(0, recallResultLimit));\n }\n return base;\n}\n\nexport function resolveEffectiveRecallMode(options: {\n plannerEnabled: boolean;\n graphRecallEnabled: boolean;\n multiGraphMemoryEnabled: boolean;\n graphExpandedIntentEnabled?: boolean;\n prompt: string;\n}): RecallPlanMode {\n return resolveRecallModeDecision(options).effectiveMode;\n}\n\nexport interface RecallModeGraphOptions {\n plannerEnabled: boolean;\n graphRecallEnabled: boolean;\n multiGraphMemoryEnabled: boolean;\n graphExpandedIntentEnabled?: boolean;\n prompt: string;\n}\n\n/**\n * Apply the graph-mode overlay + gating to a planner-produced mode.\n *\n * Shared by the heuristic ({@link resolveRecallModeDecision}) and LLM\n * ({@link resolveRecallModeDecisionAsync}) paths so graph promotion and the\n * \"graph disabled → fall back to full\" gating behave identically regardless of\n * which planner produced `plannedModeRaw` (gotcha #39).\n */\nexport function finalizeRecallModeDecision(\n plannedModeRaw: RecallPlanMode,\n options: RecallModeGraphOptions,\n): RecallModeDecision {\n let plannedMode: RecallPlanMode = plannedModeRaw;\n const graphExpandedIntentDetected =\n options.plannerEnabled &&\n options.graphExpandedIntentEnabled === true &&\n hasBroadGraphIntent(options.prompt);\n if (plannedMode !== \"graph_mode\" && graphExpandedIntentDetected) {\n plannedMode = \"graph_mode\";\n }\n if (\n plannedMode === \"graph_mode\" &&\n (!options.graphRecallEnabled || !options.multiGraphMemoryEnabled)\n ) {\n return {\n plannedMode,\n effectiveMode: \"full\",\n graphExpandedIntentDetected,\n graphReason: !options.graphRecallEnabled\n ? \"graph recall disabled by config\"\n : \"multi-graph memory disabled by config\",\n };\n }\n return {\n plannedMode,\n effectiveMode: plannedMode,\n graphExpandedIntentDetected,\n };\n}\n\nexport function resolveRecallModeDecision(options: RecallModeGraphOptions): RecallModeDecision {\n const plannedMode: RecallPlanMode = options.plannerEnabled\n ? planRecallMode(options.prompt)\n : \"full\";\n return finalizeRecallModeDecision(plannedMode, options);\n}\n\n/**\n * Async recall-mode decision with optional LLM-based planning (issue #1367 /\n * Option C). Falls back to the heuristic decision when the LLM planner is\n * disabled, in shadow mode, or unavailable/failed — so this is always safe to\n * await on the recall hot path. Provider-agnostic: the LLM call routes through\n * the gateway/fallback chain.\n *\n * `recallPlannerEnabled === false` keeps the legacy \"always full\" behavior and\n * skips the LLM entirely (the planner as a whole is off).\n */\nexport async function resolveRecallModeDecisionAsync(\n options: RecallModeGraphOptions & {\n config: PluginConfig;\n /**\n * Recall-operation capability gates (issue #1523). REQUIRED: the recall\n * orchestrator always passes a resolved set — the LLM planner gate reads\n * `caps.recallPlannerLlm`, never re-derives from config.\n */\n caps: CapabilitySet;\n hints?: string[];\n llm?: FallbackLlmClient;\n signal?: AbortSignal;\n },\n): Promise<RecallModeDecision> {\n const heuristicDecision = resolveRecallModeDecision(options);\n\n // Planner globally off, or LLM planning not opted into → heuristic only.\n // Read the resolved capability (issue #1523) — never re-derive from config.\n const plannerLlmEnabled = options.caps.recallPlannerLlm;\n if (!options.plannerEnabled || !plannerLlmEnabled) {\n return heuristicDecision;\n }\n\n const { planRecallModeLLM } = await import(\"../recall-planner-llm.js\");\n const planned = await planRecallModeLLM(\n options.prompt,\n options.hints,\n options.config,\n options.caps,\n options.llm,\n options.signal,\n );\n\n // Shadow mode: record what the LLM would have chosen but keep the heuristic\n // effective decision (safe rollout / comparison — gotcha #30).\n if (options.config.recallPlannerShadowMode) {\n return {\n ...heuristicDecision,\n plannerSource: planned.source,\n plannerReason: `shadow:${planned.reason}`,\n plannerLatencyMs: planned.latencyMs,\n plannerFallbackUsed: planned.fallbackUsed,\n plannerModelUsed: planned.modelUsed,\n plannerHeuristicMode: planned.heuristicMode,\n shadowLlmMode: planned.mode,\n };\n }\n\n const llmDecision = finalizeRecallModeDecision(planned.mode, options);\n return {\n ...llmDecision,\n plannerSource: planned.source,\n plannerReason: planned.reason,\n plannerLatencyMs: planned.latencyMs,\n plannerFallbackUsed: planned.fallbackUsed,\n plannerModelUsed: planned.modelUsed,\n plannerHeuristicMode: planned.heuristicMode,\n };\n}\n\nexport function computeArtifactCandidateFetchLimit(\n targetCount: number,\n): number {\n const cappedTarget = Math.max(0, targetCount);\n if (cappedTarget === 0) return 0;\n const headroom = Math.max(8, cappedTarget * 4);\n return Math.min(200, cappedTarget + headroom);\n}\n\nexport function computeQmdHybridFetchLimit(\n recallFetchLimit: number,\n artifactsEnabled: boolean,\n maxArtifactRecall: number,\n): number {\n const cappedRecallLimit = Math.max(0, recallFetchLimit);\n if (cappedRecallLimit === 0) return 0;\n if (!artifactsEnabled) return cappedRecallLimit;\n // Overscan when artifacts are enabled, then filter artifact paths before\n // re-applying the recall cap to avoid artifact-dominated top-N starvation.\n const artifactHeadroom = Math.max(20, Math.max(0, maxArtifactRecall) * 8);\n return Math.min(400, cappedRecallLimit + artifactHeadroom);\n}\n\nexport function summarizeGraphShadowComparison(\n baseline: QmdSearchResult[],\n merged: QmdSearchResult[],\n topN: number,\n): {\n baselineCount: number;\n graphCount: number;\n overlapCount: number;\n overlapRatio: number;\n averageOverlapDelta: number;\n} {\n const limit = Math.max(0, Math.floor(topN));\n const baselineTop = limit > 0 ? baseline.slice(0, limit) : [];\n const graphTop = limit > 0 ? merged.slice(0, limit) : [];\n const baselineByPath = new Map(\n baselineTop.map((item) => [item.path, item.score]),\n );\n const graphByPath = new Map(graphTop.map((item) => [item.path, item.score]));\n\n let overlapCount = 0;\n let overlapDeltaSum = 0;\n for (const [p, baselineScore] of baselineByPath.entries()) {\n const graphScore = graphByPath.get(p);\n if (typeof graphScore !== \"number\") continue;\n overlapCount += 1;\n overlapDeltaSum += graphScore - baselineScore;\n }\n\n const baselineCount = baselineTop.length;\n return {\n baselineCount,\n graphCount: graphTop.length,\n overlapCount,\n overlapRatio: baselineCount > 0 ? overlapCount / baselineCount : 0,\n averageOverlapDelta: overlapCount > 0 ? overlapDeltaSum / overlapCount : 0,\n };\n}\n\nexport function parseGraphRecallRankedResults(\n value: unknown,\n): GraphRecallRankedResult[] {\n if (!Array.isArray(value)) return [];\n const parsed: GraphRecallRankedResult[] = [];\n for (const entry of value) {\n if (!entry || typeof entry !== \"object\") continue;\n const candidate = entry as Partial<GraphRecallRankedResult>;\n if (\n typeof candidate.path !== \"string\" ||\n typeof candidate.score !== \"number\"\n )\n continue;\n parsed.push({\n path: candidate.path,\n score: candidate.score,\n docid: typeof candidate.docid === \"string\" ? candidate.docid : undefined,\n sourceLabels: Array.isArray(candidate.sourceLabels)\n ? candidate.sourceLabels.filter(\n (item): item is string => typeof item === \"string\",\n )\n : [],\n });\n }\n return parsed.slice(0, 64);\n}\n\nexport function parseMemoryIntentSnapshot(value: unknown): MemoryIntent {\n const candidate =\n value && typeof value === \"object\" ? (value as Partial<MemoryIntent>) : {};\n return {\n goal: typeof candidate.goal === \"string\" ? candidate.goal : \"unknown\",\n actionType:\n typeof candidate.actionType === \"string\"\n ? candidate.actionType\n : \"unknown\",\n entityTypes: Array.isArray(candidate.entityTypes)\n ? candidate.entityTypes.filter(\n (item): item is string => typeof item === \"string\",\n )\n : [],\n taskInitiation: candidate.taskInitiation === true,\n };\n}\n\nexport function buildQmdIntentHint(intent: MemoryIntent): string | undefined {\n const parts: string[] = [];\n if (intent.goal !== \"unknown\") {\n parts.push(`goal:${intent.goal.replace(/_/g, \" \")}`);\n }\n if (intent.actionType !== \"unknown\") {\n parts.push(`action:${intent.actionType.replace(/_/g, \" \")}`);\n }\n if (intent.entityTypes.length > 0) {\n parts.push(`entities:${intent.entityTypes.join(\",\")}`);\n }\n if (intent.taskInitiation === true) {\n parts.push(\"task_initiation\");\n }\n return parts.length > 0 ? parts.join(\" \") : undefined;\n}\n\nexport function parseQmdRecallResults(value: unknown): QmdSearchResult[] {\n if (!Array.isArray(value)) return [];\n const parsed: QmdSearchResult[] = [];\n for (const entry of value) {\n if (!entry || typeof entry !== \"object\") continue;\n const candidate = entry as Partial<QmdSearchResult>;\n if (\n typeof candidate.path !== \"string\" ||\n typeof candidate.score !== \"number\"\n )\n continue;\n parsed.push({\n docid: typeof candidate.docid === \"string\" ? candidate.docid : \"\",\n path: candidate.path,\n snippet: typeof candidate.snippet === \"string\" ? candidate.snippet : \"\",\n score: candidate.score,\n explain: parseQmdExplain(candidate.explain),\n transport:\n candidate.transport === \"daemon\" ||\n candidate.transport === \"subprocess\" ||\n candidate.transport === \"hybrid\" ||\n candidate.transport === \"scoped_prefilter\"\n ? candidate.transport\n : undefined,\n });\n }\n return parsed.slice(0, 32);\n}\n\nexport function mergeArtifactRecallCandidates(\n candidatesByNamespace: MemoryFile[][],\n limit: number,\n): MemoryFile[] {\n const cappedLimit = Math.max(0, limit);\n if (cappedLimit === 0) return [];\n\n const out: MemoryFile[] = [];\n const seen = new Set<string>();\n let offset = 0;\n while (out.length < cappedLimit) {\n let hasAnyCandidateAtOffset = false;\n for (const list of candidatesByNamespace) {\n if (offset >= list.length) continue;\n hasAnyCandidateAtOffset = true;\n const item = list[offset];\n const dedupeKey = `${item.frontmatter.id}:${item.frontmatter.sourceMemoryId ?? \"\"}:${item.content}`;\n if (seen.has(dedupeKey)) continue;\n seen.add(dedupeKey);\n out.push(item);\n if (out.length >= cappedLimit) break;\n }\n if (!hasAnyCandidateAtOffset) break;\n offset += 1;\n }\n return out;\n}\n\nexport function resolveRecentThreadMemoryPaths(options: {\n threadEpisodeIds: string[];\n currentMemoryId: string;\n allMemsForGraph: MemoryFile[] | null | undefined;\n pathById?: Map<string, string>;\n storageDir: string;\n maxRecent: number;\n}): string[] {\n const maxRecent = Math.max(0, options.maxRecent);\n if (options.threadEpisodeIds.length === 0 || maxRecent === 0) return [];\n const pathById =\n options.pathById ??\n buildMemoryPathById(options.allMemsForGraph, options.storageDir);\n if (pathById.size === 0) return [];\n\n // #1635 (defensive): skip pending_review ids from legacy episode sets.\n const pendingReviewIds = new Set<string>(\n (options.allMemsForGraph ?? [])\n .filter((m) => m.frontmatter.status === \"pending_review\" && m.frontmatter.id)\n .map((m) => m.frontmatter.id as string),\n );\n\n return options.threadEpisodeIds\n .filter((id) => id !== options.currentMemoryId)\n .filter((id) => !pendingReviewIds.has(id))\n .slice(-maxRecent)\n .map((id) => pathById.get(id))\n .filter((p): p is string => typeof p === \"string\" && p.length > 0);\n}\n\nexport function buildMemoryPathById(\n allMemsForGraph: MemoryFile[] | null | undefined,\n storageDir: string,\n): Map<string, string> {\n const pathById = new Map<string, string>();\n for (const mem of allMemsForGraph ?? []) {\n const id = mem.frontmatter.id;\n if (!id) continue;\n pathById.set(id, path.relative(storageDir, mem.path));\n }\n return pathById;\n}\n\nexport function appendMemoryToGraphContext(options: {\n allMemsForGraph: MemoryFile[] | null | undefined;\n storageDir: string;\n memoryRelPath: string;\n memoryId: string;\n category: MemoryFile[\"frontmatter\"][\"category\"];\n content: string;\n entityRef: string | undefined;\n}): void {\n if (!Array.isArray(options.allMemsForGraph)) return;\n\n const nowIso = new Date().toISOString();\n options.allMemsForGraph.push({\n path: path.join(options.storageDir, options.memoryRelPath),\n content: options.content,\n frontmatter: {\n id: options.memoryId,\n category: options.category,\n created: nowIso,\n updated: nowIso,\n source: \"extraction\",\n confidence: 0.8,\n confidenceTier: \"implied\",\n tags: [],\n entityRef: options.entityRef,\n status: \"active\",\n },\n });\n}\n\nexport function resolvePersistedMemoryRelativePath(options: {\n memoryId: string;\n pathById: Map<string, string>;\n category: string;\n}): string {\n const persisted = options.pathById.get(options.memoryId);\n if (persisted) return persisted;\n if (options.category === \"correction\") {\n return path.join(\"corrections\", `${options.memoryId}.md`);\n }\n // Pick the subtree that matches the StorageManager.writeMemory routing\n // so fallback paths (used before memoryPathById has seen the fresh\n // write) agree with where the file actually lives. Routing goes through\n // the shared categoryDirName() chokepoint (utils/category-dir.ts) so\n // every category — decisions/, preferences/, reasoning-traces/, ... —\n // resolves to the same dir the writer used; otherwise graph edges point\n // at the wrong subtree and graph expansion silently drops those nodes\n // when readMemoryByPath cannot resolve them (issue #564 PR 3 / #1546).\n const subtree = categoryDirName(options.category);\n const idParts = options.memoryId.split(\"-\");\n const maybeTimestamp = Number(idParts[1]);\n if (Number.isFinite(maybeTimestamp) && maybeTimestamp > 0) {\n const day = new Date(maybeTimestamp).toISOString().slice(0, 10);\n return path.join(subtree, day, `${options.memoryId}.md`);\n }\n return path.join(subtree, `${options.memoryId}.md`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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-1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
appendRecallAuditEntry
|
|
3
|
-
} from "./chunk-LBLXEFWK.js";
|
|
4
1
|
import {
|
|
5
2
|
detectRecallAnomalies
|
|
6
3
|
} from "./chunk-RFYAYKTD.js";
|
|
4
|
+
import {
|
|
5
|
+
appendRecallAuditEntry
|
|
6
|
+
} from "./chunk-LBLXEFWK.js";
|
|
7
7
|
|
|
8
8
|
// src/access-audit.ts
|
|
9
9
|
var AccessAuditAdapter = class {
|
|
@@ -62,4 +62,4 @@ var AccessAuditAdapter = class {
|
|
|
62
62
|
export {
|
|
63
63
|
AccessAuditAdapter
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-TVVEYCNW.js.map
|
|
@@ -72,12 +72,39 @@ function parsedMemoryIdentity(filePath, raw, parseMemory, citationTemplate) {
|
|
|
72
72
|
status: inferMemoryStatus(parsed.frontmatter, filePath)
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
+
function citationTemplateFingerprint(citationTemplate) {
|
|
76
|
+
return createHash("sha256").update(citationTemplate ?? DEFAULT_CITATION_FORMAT).digest("hex").slice(0, 16);
|
|
77
|
+
}
|
|
78
|
+
function isReconcileMemoryIdentity(value) {
|
|
79
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
80
|
+
const memory = value;
|
|
81
|
+
if (typeof memory.id !== "string") return false;
|
|
82
|
+
if (typeof memory.category !== "string") return false;
|
|
83
|
+
if (typeof memory.contentHash !== "string" || !SHA256_PATTERN.test(memory.contentHash)) return false;
|
|
84
|
+
if (typeof memory.status !== "string") return false;
|
|
85
|
+
if (memory.normalizerVersion !== void 0 && typeof memory.normalizerVersion !== "number") return false;
|
|
86
|
+
if (memory.identityResolutionVersion !== void 0 && typeof memory.identityResolutionVersion !== "number") {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (memory.contentHashAliases !== void 0 && (!Array.isArray(memory.contentHashAliases) || memory.contentHashAliases.some((alias) => typeof alias !== "string" || !SHA256_PATTERN.test(alias)))) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
function isCachedIdentityReusable(cached) {
|
|
95
|
+
if (cached.memory !== void 0) {
|
|
96
|
+
return cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION && cached.memory.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION;
|
|
97
|
+
}
|
|
98
|
+
return cached.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION && cached.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION;
|
|
99
|
+
}
|
|
75
100
|
async function buildReconcileManifestFile(file, readFile, parseMemory, citationTemplate = DEFAULT_CITATION_FORMAT) {
|
|
76
101
|
let raw = null;
|
|
102
|
+
let readFailed = false;
|
|
77
103
|
if (isMemoryPath(file.path)) {
|
|
78
104
|
try {
|
|
79
105
|
raw = await readFile(file);
|
|
80
106
|
} catch {
|
|
107
|
+
readFailed = true;
|
|
81
108
|
raw = null;
|
|
82
109
|
}
|
|
83
110
|
}
|
|
@@ -85,7 +112,14 @@ async function buildReconcileManifestFile(file, readFile, parseMemory, citationT
|
|
|
85
112
|
raw = null;
|
|
86
113
|
}
|
|
87
114
|
const memory = raw === null ? void 0 : parsedMemoryIdentity(file.path, raw, parseMemory, citationTemplate);
|
|
88
|
-
return { ...file
|
|
115
|
+
if (readFailed) return { ...file };
|
|
116
|
+
return {
|
|
117
|
+
...file,
|
|
118
|
+
...memory ? { memory } : {
|
|
119
|
+
normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,
|
|
120
|
+
identityResolutionVersion: IDENTITY_RESOLUTION_VERSION
|
|
121
|
+
}
|
|
122
|
+
};
|
|
89
123
|
}
|
|
90
124
|
var MANIFEST_BUILD_BATCH_SIZE = 50;
|
|
91
125
|
async function buildReconcileManifest(options) {
|
|
@@ -93,14 +127,20 @@ async function buildReconcileManifest(options) {
|
|
|
93
127
|
for (const cached of options.cachedFiles ?? []) {
|
|
94
128
|
cachedByPath.set(cached.path, cached);
|
|
95
129
|
}
|
|
96
|
-
const files = [];
|
|
97
|
-
const uncached = [];
|
|
98
130
|
const allFiles = [...options.files];
|
|
131
|
+
const files = new Array(allFiles.length);
|
|
132
|
+
const uncached = [];
|
|
99
133
|
for (let i = 0; i < allFiles.length; i += 1) {
|
|
100
134
|
const file = allFiles[i];
|
|
101
135
|
const cached = cachedByPath.get(file.path);
|
|
102
|
-
if (cached !== void 0 && cached.sha256.toLowerCase() === file.sha256.toLowerCase() && (cached
|
|
103
|
-
files
|
|
136
|
+
if (cached !== void 0 && cached.sha256.toLowerCase() === file.sha256.toLowerCase() && isCachedIdentityReusable(cached)) {
|
|
137
|
+
files[i] = {
|
|
138
|
+
...file,
|
|
139
|
+
...cached.memory ? { memory: cached.memory } : {
|
|
140
|
+
normalizerVersion: cached.normalizerVersion,
|
|
141
|
+
identityResolutionVersion: cached.identityResolutionVersion
|
|
142
|
+
}
|
|
143
|
+
};
|
|
104
144
|
} else {
|
|
105
145
|
uncached.push({ index: i, file });
|
|
106
146
|
}
|
|
@@ -294,8 +334,13 @@ function collapseActiveFactDuplicates(plan, localManifests, peerManifests, prior
|
|
|
294
334
|
export {
|
|
295
335
|
RECONCILE_MANIFEST_FORMAT,
|
|
296
336
|
RECONCILE_MANIFEST_SCHEMA_VERSION,
|
|
337
|
+
CONTENT_HASH_NORMALIZER_VERSION,
|
|
338
|
+
IDENTITY_RESOLUTION_VERSION,
|
|
339
|
+
citationTemplateFingerprint,
|
|
340
|
+
isReconcileMemoryIdentity,
|
|
341
|
+
isCachedIdentityReusable,
|
|
297
342
|
buildReconcileManifestFile,
|
|
298
343
|
buildReconcileManifest,
|
|
299
344
|
collapseActiveFactDuplicates
|
|
300
345
|
};
|
|
301
|
-
//# sourceMappingURL=chunk-
|
|
346
|
+
//# sourceMappingURL=chunk-UBG4GAEP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reconcile/manifest.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { computeLegacyContentHash, normalizeLegacyContent } from \"../content-hash.js\";\nimport { inferMemoryStatus } from \"../memory-lifecycle-ledger-utils.js\";\nimport { DEFAULT_CITATION_FORMAT, stripCitationForTemplate } from \"../source-attribution.js\";\nimport { ContentHashIndex, type ContentHashPathEntry } from \"../storage/content-hash-index.js\";\nimport { storedContentIdentityCandidates } from \"../structured-attributes.js\";\nimport type { MemoryFrontmatter, MemoryStatus } from \"../types.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport {\n type ReconcileFileState,\n type ReconcilePlan,\n type ReconcilePlanEntry,\n type ReconcileSemanticAgreement,\n type ReconcileSemanticChange,\n compareReconcilePlanEntries,\n semanticAgreementKey,\n summarizeReconcilePlan,\n} from \"./plan.js\";\n\nexport const RECONCILE_MANIFEST_FORMAT = \"remnic-reconcile-manifest\";\nexport const RECONCILE_MANIFEST_SCHEMA_VERSION = 1;\nexport const CONTENT_HASH_NORMALIZER_VERSION = 4;\n/**\n * Version of the identity-resolution LOGIC (alias recovery, candidate\n * ordering), independent of the content normalizer: a cached manifest entry\n * written before an identity-resolution change carries an older value and is\n * reparsed even when its normalizerVersion still matches (issue #2367\n * review round 2). Bump when parsedMemoryIdentity's output shape or\n * semantics change.\n */\nexport const IDENTITY_RESOLUTION_VERSION = 2;\n\nexport interface ReconcileMemoryIdentity {\n id: string;\n category: string;\n contentHash: string;\n /**\n * Recovered current-normalizer identities for a record whose persisted hash\n * is ambiguous under the legacy normalizer (issue #2367). The persisted\n * hash stays primary; these participate in duplicate bucketing so a\n * replica carrying the current form of the same fact still collapses.\n */\n contentHashAliases?: readonly string[];\n /** See IDENTITY_RESOLUTION_VERSION; absent on pre-versioning cache entries. */\n normalizerVersion?: number;\n identityResolutionVersion?: number;\n status: MemoryStatus;\n}\n\nexport interface ReconcileManifestFile extends ReconcileFileState {\n memory?: ReconcileMemoryIdentity;\n /** Present on sha-only (negative) entries so an upgrade re-parses them. */\n normalizerVersion?: number;\n identityResolutionVersion?: number;\n}\n\ntype ActiveFactManifestFile = ReconcileManifestFile & { memory: ReconcileMemoryIdentity };\n\nexport interface ReconcileManifest {\n format: typeof RECONCILE_MANIFEST_FORMAT;\n schemaVersion: typeof RECONCILE_MANIFEST_SCHEMA_VERSION;\n files: ReconcileManifestFile[];\n}\n\nexport type ReconcileMemoryParser = (raw: string) => { frontmatter: MemoryFrontmatter; content: string } | null;\n\nexport interface BuildReconcileManifestOptions {\n files: Iterable<ReconcileFileState>;\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>;\n parseMemory: ReconcileMemoryParser;\n cachedFiles?: Iterable<ReconcileManifestFile>;\n citationTemplate?: string;\n}\n\nconst SHA256_PATTERN = /^[a-f0-9]{64}$/i;\nconst MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);\n\nfunction isMemoryPath(filePath: string): boolean {\n if (!filePath.endsWith(\".md\")) return false;\n const segments = filePath.split(\"/\");\n let index = 0;\n if (segments[index] === \"cold\" || segments[index] === \"archive\") index += 1;\n return MEMORY_DIRS.has(segments[index] ?? \"\");\n}\n\nfunction parsedMemoryIdentity(\n filePath: string,\n raw: Buffer | string,\n parseMemory: ReconcileMemoryParser,\n citationTemplate: string\n): ReconcileMemoryIdentity | undefined {\n if (!isMemoryPath(filePath)) return undefined;\n const parsed = parseMemory(Buffer.isBuffer(raw) ? raw.toString(\"utf8\") : raw);\n if (!parsed?.frontmatter.id) return undefined;\n\n const storedHash =\n parsed.frontmatter.contentHash && SHA256_PATTERN.test(parsed.frontmatter.contentHash)\n ? parsed.frontmatter.contentHash.toLowerCase()\n : undefined;\n const candidates = storedContentIdentityCandidates(parsed.content, (content) =>\n stripCitationForTemplate(content, citationTemplate)\n );\n const bodyHash = ContentHashIndex.computeHash(candidates[0] ?? \"\");\n const currentMatch = candidates.find((content) => ContentHashIndex.computeHash(content) === storedHash);\n const legacyMatch = [...candidates].reverse().find((content) => computeLegacyContentHash(content) === storedHash);\n let contentHash: string;\n let contentHashAliases: string[] | undefined;\n if (currentMatch) {\n contentHash = ContentHashIndex.computeHash(currentMatch);\n } else if (legacyMatch && normalizeLegacyContent(legacyMatch).length > 0) {\n // A non-empty legacy equality is ambiguous (issue #2367): the persisted\n // hash may be an explicit contentHashSource identity that merely collides\n // with the body's ASCII skeleton under the lossy legacy normalizer, and\n // nothing in the record proves which it is. Keep the persisted hash as\n // the primary identity and expose the recovered current identity as an\n // alias so replicas carrying either form still collapse.\n contentHash = storedHash ?? bodyHash;\n const recovered = ContentHashIndex.computeHash(legacyMatch);\n if (recovered !== contentHash) contentHashAliases = [recovered];\n } else {\n // An EMPTY legacy skeleton identifies nothing (every non-ASCII body maps\n // to it), so preserving it would collapse unrelated records. Recovering\n // the current identity here is repair, not replacement.\n contentHash = legacyMatch ? ContentHashIndex.computeHash(legacyMatch) : (storedHash ?? bodyHash);\n }\n\n return {\n id: parsed.frontmatter.id,\n category: parsed.frontmatter.category,\n contentHash,\n ...(contentHashAliases ? { contentHashAliases } : {}),\n normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,\n identityResolutionVersion: IDENTITY_RESOLUTION_VERSION,\n status: inferMemoryStatus(parsed.frontmatter, filePath),\n };\n}\n\n/**\n * Stable fingerprint of the citation template that `parsedMemoryIdentity` uses\n * to strip inline attribution before hashing. A persisted identity cache is\n * only reusable while this matches: identical file content under a different\n * template yields a different `contentHash`, which would silently change\n * duplicate and conflict decisions on a warm plan.\n */\nexport function citationTemplateFingerprint(citationTemplate?: string): string {\n return createHash(\"sha256\")\n .update(citationTemplate ?? DEFAULT_CITATION_FORMAT)\n .digest(\"hex\")\n .slice(0, 16);\n}\n\n/**\n * Structural guard for identities read back from an on-disk cache. A cache file\n * is untrusted JSON: without this an entry carrying `memory: null` survives the\n * loader's cast and then throws when the hit path dereferences\n * `memory.normalizerVersion`, aborting a manifest build that should instead\n * fall back to a cold parse.\n */\nexport function isReconcileMemoryIdentity(value: unknown): value is ReconcileMemoryIdentity {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n const memory = value as Record<string, unknown>;\n if (typeof memory.id !== \"string\") return false;\n if (typeof memory.category !== \"string\") return false;\n if (typeof memory.contentHash !== \"string\" || !SHA256_PATTERN.test(memory.contentHash)) return false;\n if (typeof memory.status !== \"string\") return false;\n if (memory.normalizerVersion !== undefined && typeof memory.normalizerVersion !== \"number\") return false;\n if (memory.identityResolutionVersion !== undefined && typeof memory.identityResolutionVersion !== \"number\") {\n return false;\n }\n if (\n memory.contentHashAliases !== undefined &&\n (!Array.isArray(memory.contentHashAliases) ||\n memory.contentHashAliases.some((alias) => typeof alias !== \"string\" || !SHA256_PATTERN.test(alias)))\n ) {\n return false;\n }\n return true;\n}\n\n/** A cache hit is valid only when the entry was built by the current parser.\n * Positive hits carry versions on `memory`; sha-only negatives stamp the same\n * versions on the entry itself. Unversioned negatives are pre-upgrade leftovers\n * and must miss so a newer parser can recognize an identity it previously skipped. */\nexport function isCachedIdentityReusable(cached: ReconcileManifestFile): boolean {\n if (cached.memory !== undefined) {\n return (\n cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION &&\n cached.memory.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION\n );\n }\n return (\n cached.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION &&\n cached.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION\n );\n}\n\nexport async function buildReconcileManifestFile(\n file: ReconcileFileState,\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>,\n parseMemory: ReconcileMemoryParser,\n citationTemplate = DEFAULT_CITATION_FORMAT\n): Promise<ReconcileManifestFile> {\n let raw: Buffer | string | null = null;\n let readFailed = false;\n if (isMemoryPath(file.path)) {\n try {\n raw = await readFile(file);\n } catch {\n readFailed = true;\n raw = null;\n }\n }\n if (raw !== null && createHash(\"sha256\").update(raw).digest(\"hex\") !== file.sha256.toLowerCase()) {\n raw = null;\n }\n const memory = raw === null ? undefined : parsedMemoryIdentity(file.path, raw, parseMemory, citationTemplate);\n // A thrown read is not a negative identity. Stamping versions here would\n // make the next warm cycle treat the failure as \"this file has no id\".\n if (readFailed) return { ...file };\n return {\n ...file,\n ...(memory\n ? { memory }\n : {\n normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,\n identityResolutionVersion: IDENTITY_RESOLUTION_VERSION,\n }),\n };\n}\n\n/** Read-batch size for manifest builds. Uncached files are independent (a\n * per-file read + sha256 + frontmatter parse); processing them in bounded\n * batches amortizes the per-file promise/async-hook overhead that dominates\n * boot-scale corpus builds (measured: ~66% of CPU in async_hooks._propagate +\n * GC at ~100k files) and overlaps IO waits, while the bound keeps memory flat.\n * Order is preserved: results land in input order regardless of completion\n * order, so the manifest output is byte-identical to the sequential form. */\nconst MANIFEST_BUILD_BATCH_SIZE = 50;\n\nexport async function buildReconcileManifest(options: BuildReconcileManifestOptions): Promise<ReconcileManifest> {\n const cachedByPath = new Map<string, ReconcileManifestFile>();\n for (const cached of options.cachedFiles ?? []) {\n cachedByPath.set(cached.path, cached);\n }\n\n const allFiles = [...options.files];\n // Every result — cache hit or rebuild — is stored at its own input index.\n // Pushing hits onto a dense array while rebuilds are assigned by index\n // silently drops entries whenever a miss precedes a hit: the rebuild lands\n // on the slot the hit already occupied.\n const files: ReconcileManifestFile[] = new Array(allFiles.length);\n // Cache hits stay on a synchronous fast path (no promise allocation, no\n // Promise.all — a fully-cached rebuild must not regress); only the uncached\n // entries ride the bounded batches.\n const uncached: Array<{ index: number; file: ReconcileFileState }> = [];\n for (let i = 0; i < allFiles.length; i += 1) {\n const file = allFiles[i]!;\n const cached = cachedByPath.get(file.path);\n if (\n cached !== undefined &&\n cached.sha256.toLowerCase() === file.sha256.toLowerCase() &&\n isCachedIdentityReusable(cached)\n ) {\n files[i] = {\n ...file,\n ...(cached.memory\n ? { memory: cached.memory }\n : {\n normalizerVersion: cached.normalizerVersion,\n identityResolutionVersion: cached.identityResolutionVersion,\n }),\n };\n } else {\n uncached.push({ index: i, file });\n }\n }\n for (let i = 0; i < uncached.length; i += MANIFEST_BUILD_BATCH_SIZE) {\n const batch = uncached.slice(i, i + MANIFEST_BUILD_BATCH_SIZE);\n const results = await Promise.all(\n batch.map(({ file }) =>\n buildReconcileManifestFile(file, options.readFile, options.parseMemory, options.citationTemplate)\n )\n );\n for (let j = 0; j < batch.length; j += 1) {\n files[batch[j]!.index] = results[j]!;\n }\n }\n files.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0));\n return {\n format: RECONCILE_MANIFEST_FORMAT,\n schemaVersion: RECONCILE_MANIFEST_SCHEMA_VERSION,\n files,\n };\n}\n\nfunction activeFactByPath(manifest: ReconcileManifest | undefined): Map<string, ActiveFactManifestFile> {\n const result = new Map<string, ActiveFactManifestFile>();\n for (const file of manifest?.files ?? []) {\n if (file.memory?.category === \"fact\" && file.memory.status === \"active\") {\n result.set(file.path, file as ActiveFactManifestFile);\n }\n }\n return result;\n}\n\nfunction memoryIdentityHashes(memory: ReconcileMemoryIdentity): string[] {\n return [memory.contentHash, ...(memory.contentHashAliases ?? [])];\n}\n\nfunction contentHashRows(files: Iterable<ActiveFactManifestFile>, contentHash: string): ContentHashPathEntry[] {\n const rows: ContentHashPathEntry[] = [];\n for (const file of files) {\n rows.push({ path: file.path, contentHash });\n }\n return rows;\n}\n\nfunction classifySemanticChange(\n current: ReconcileSemanticAgreement,\n prior: ReconcileSemanticAgreement | undefined\n): ReconcileSemanticChange {\n if (!prior) return \"unchanged\";\n const localChanged = current.local.sha256 !== prior.local.sha256;\n const peerChanged = current.peer.sha256 !== prior.peer.sha256;\n if (localChanged && peerChanged) return \"both_modified\";\n if (localChanged) return \"local_changed\";\n if (peerChanged) return \"peer_changed\";\n return \"unchanged\";\n}\n\nexport function collapseActiveFactDuplicates(\n plan: ReconcilePlan,\n localManifests: ReadonlyMap<string, ReconcileManifest>,\n peerManifests: ReadonlyMap<string, ReconcileManifest>,\n priorSemanticAgreements?: ReadonlyMap<string, readonly ReconcileSemanticAgreement[]>\n): ReconcilePlan {\n const entriesByNamespace = new Map<string, ReconcilePlanEntry[]>();\n for (const entry of plan.entries) {\n const entries = entriesByNamespace.get(entry.namespace) ?? [];\n entries.push({ ...entry });\n entriesByNamespace.set(entry.namespace, entries);\n }\n\n let changed = false;\n for (const namespace of new Set([...localManifests.keys(), ...peerManifests.keys()])) {\n const entries = entriesByNamespace.get(namespace) ?? [];\n const localManifest = localManifests.get(namespace);\n const peerManifest = peerManifests.get(namespace);\n const localByPath = activeFactByPath(localManifest);\n const peerByPath = activeFactByPath(peerManifest);\n const localFilesByPath = new Map((localManifest?.files ?? []).map((file) => [file.path, file]));\n const peerFilesByPath = new Map((peerManifest?.files ?? []).map((file) => [file.path, file]));\n const priorSemanticByPathPair = new Map(\n (priorSemanticAgreements?.get(namespace) ?? []).map((agreement) => [semanticAgreementKey(agreement), agreement])\n );\n const localByHash = new Map<string, ActiveFactManifestFile[]>();\n const peerByHash = new Map<string, ActiveFactManifestFile[]>();\n\n for (const file of localByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = localByHash.get(hash) ?? [];\n bucket.push(file);\n localByHash.set(hash, bucket);\n }\n }\n for (const file of peerByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = peerByHash.get(hash) ?? [];\n bucket.push(file);\n peerByHash.set(hash, bucket);\n }\n }\n\n const removed = new Set<ReconcilePlanEntry>();\n const replacements: ReconcilePlanEntry[] = [];\n const processedPathPairs = new Set<string>();\n for (const hash of new Set([...localByHash.keys(), ...peerByHash.keys()])) {\n const localCandidates = (localByHash.get(hash) ?? []).filter((file) => {\n const opposite = peerFilesByPath.get(file.path);\n const activeOpposite = peerByPath.get(file.path);\n return (\n opposite === undefined ||\n (activeOpposite !== undefined && memoryIdentityHashes(activeOpposite.memory).includes(hash))\n );\n });\n const peerCandidates = (peerByHash.get(hash) ?? []).filter((file) => {\n const opposite = localFilesByPath.get(file.path);\n const activeOpposite = localByPath.get(file.path);\n return (\n opposite === undefined ||\n (activeOpposite !== undefined && memoryIdentityHashes(activeOpposite.memory).includes(hash))\n );\n });\n const localPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(localCandidates, hash));\n const peerPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(peerCandidates, hash));\n\n if (localPath && peerPath && localPath !== peerPath) {\n const pathPair = `${localPath}\\0${peerPath}`;\n if (processedPathPairs.has(pathPair)) continue;\n processedPathPairs.add(pathPair);\n const localFile = localByPath.get(localPath);\n const peerFile = peerByPath.get(peerPath);\n if (!localFile || !peerFile) continue;\n const duplicatePaths = new Set([\n ...localCandidates.map((file) => file.path),\n ...peerCandidates.map((file) => file.path),\n ]);\n const authoritativeSamePathEntries = new Set(\n entries.filter(\n (entry) =>\n duplicatePaths.has(entry.path) &&\n localFilesByPath.has(entry.path) &&\n peerFilesByPath.has(entry.path) &&\n entry.action !== \"identical\"\n )\n );\n if (authoritativeSamePathEntries.size > 0) {\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path) &&\n !authoritativeSamePathEntries.has(entry) &&\n (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n changed = true;\n }\n }\n continue;\n }\n const unsafeEntry = entries.some(\n (entry) => duplicatePaths.has(entry.path) && (entry.action === \"suppress\" || entry.action === \"conflict\")\n );\n if (unsafeEntry) continue;\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path) &&\n (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n }\n }\n const semanticAgreement: ReconcileSemanticAgreement = {\n local: { path: localPath, sha256: localFile.sha256 },\n peer: { path: peerPath, sha256: peerFile.sha256 },\n };\n replacements.push({\n path: localPath < peerPath ? localPath : peerPath,\n namespace,\n action: \"identical\",\n reason: \"semantic_duplicate\",\n semanticAgreement,\n semanticChange: classifySemanticChange(\n semanticAgreement,\n priorSemanticByPathPair.get(semanticAgreementKey(semanticAgreement))\n ),\n });\n changed = true;\n continue;\n }\n\n const sameSideEntries = entries.filter((entry) => {\n if (localPath && entry.reason === \"local_only\") {\n return localCandidates.some((file) => file.path === entry.path);\n }\n if (peerPath && entry.reason === \"peer_only\") {\n return peerCandidates.some((file) => file.path === entry.path);\n }\n return false;\n });\n const canonicalPath = localPath ?? peerPath;\n const hasSharedCanonical = localPath !== undefined && localPath === peerPath;\n if (!canonicalPath || sameSideEntries.length === 0 || (!hasSharedCanonical && sameSideEntries.length < 2)) {\n continue;\n }\n for (const entry of sameSideEntries) {\n if (entry.path !== canonicalPath) {\n removed.add(entry);\n changed = true;\n }\n }\n }\n\n if (removed.size > 0 || replacements.length > 0) {\n entriesByNamespace.set(\n namespace,\n [...entries.filter((entry) => !removed.has(entry)), ...replacements].sort(compareReconcilePlanEntries)\n );\n }\n }\n\n if (!changed) return plan;\n const entries = [...entriesByNamespace.values()].flat().sort(compareReconcilePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),\n converged: entries.every((entry) => entry.action === \"identical\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAmBpB,IAAM,4BAA4B;AAClC,IAAM,oCAAoC;AAC1C,IAAM,kCAAkC;AASxC,IAAM,8BAA8B;AA4C3C,IAAM,iBAAiB;AACvB,IAAM,cAAc,IAAI,IAAI,oBAAoB;AAEhD,SAAS,aAAa,UAA2B;AAC/C,MAAI,CAAC,SAAS,SAAS,KAAK,EAAG,QAAO;AACtC,QAAM,WAAW,SAAS,MAAM,GAAG;AACnC,MAAI,QAAQ;AACZ,MAAI,SAAS,KAAK,MAAM,UAAU,SAAS,KAAK,MAAM,UAAW,UAAS;AAC1E,SAAO,YAAY,IAAI,SAAS,KAAK,KAAK,EAAE;AAC9C;AAEA,SAAS,qBACP,UACA,KACA,aACA,kBACqC;AACrC,MAAI,CAAC,aAAa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2
2
|
resolveCorpusNamespaceRoots
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ECKG5WSI.js";
|
|
4
4
|
import {
|
|
5
5
|
capabilityAllowsNamespace
|
|
6
6
|
} from "./chunk-MZWSOLMT.js";
|
|
@@ -200,4 +200,4 @@ async function readAggregateExtractionWatermark(options) {
|
|
|
200
200
|
export {
|
|
201
201
|
readAggregateExtractionWatermark
|
|
202
202
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-UDZYNIDJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OKF_RESERVED_BASENAMES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PCEYGOSL.js";
|
|
4
4
|
import {
|
|
5
5
|
MAGIC_BYTES
|
|
6
6
|
} from "./chunk-JN72EPOE.js";
|
|
@@ -202,4 +202,4 @@ export {
|
|
|
202
202
|
publishBundle,
|
|
203
203
|
rejectSymlinkPath
|
|
204
204
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-UJX4I26O.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SupportPassportError,
|
|
3
3
|
getOperation
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JHZCXUQI.js";
|
|
5
5
|
import {
|
|
6
6
|
abortError,
|
|
7
7
|
isAbortError
|
|
@@ -499,4 +499,4 @@ export {
|
|
|
499
499
|
buildSupportPassportPublicRequestHandler,
|
|
500
500
|
composeSupportPassportExternalRequestHandlers
|
|
501
501
|
};
|
|
502
|
-
//# sourceMappingURL=chunk-
|
|
502
|
+
//# sourceMappingURL=chunk-UYUCCQ46.js.map
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
parseRecallStateViews,
|
|
5
5
|
resultStateViewId,
|
|
6
6
|
shouldWidenSuperseded
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-255PC37A.js";
|
|
8
8
|
|
|
9
9
|
// src/recall-state-view-widen.ts
|
|
10
|
-
function widenRecallStateViews(results, query, config, pool = []) {
|
|
10
|
+
function widenRecallStateViews(results, query, config, pool = [], stateViewActive, asOfMs) {
|
|
11
11
|
const raw = typeof config === "object" && config !== null && "recallStateViews" in config ? config.recallStateViews : void 0;
|
|
12
|
-
const enabled = parseRecallStateViews(raw);
|
|
12
|
+
const enabled = stateViewActive === true || parseRecallStateViews(raw);
|
|
13
13
|
if (!enabled || !isChangeOrientedQuery(query)) return results;
|
|
14
|
+
const asOfActive = typeof asOfMs === "number" && Number.isFinite(asOfMs);
|
|
14
15
|
const candidateIds = /* @__PURE__ */ new Set();
|
|
15
16
|
for (const result of results) {
|
|
16
17
|
const id = resultStateViewId(result);
|
|
@@ -18,19 +19,22 @@ function widenRecallStateViews(results, query, config, pool = []) {
|
|
|
18
19
|
}
|
|
19
20
|
const seen = new Set(candidateIds);
|
|
20
21
|
const extra = [];
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (!asOfActive) {
|
|
23
|
+
for (const item of pool) {
|
|
24
|
+
const id = resultStateViewId(item);
|
|
25
|
+
if (!id || seen.has(id)) continue;
|
|
26
|
+
if (!shouldWidenSuperseded(item.supersededBy, candidateIds)) continue;
|
|
27
|
+
extra.push(item);
|
|
28
|
+
seen.add(id);
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
return annotateStateView(extra.length > 0 ? results.concat(extra) : results, query, [], {
|
|
29
|
-
enabled: true
|
|
32
|
+
enabled: true,
|
|
33
|
+
...asOfActive ? { asOfMs } : {}
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export {
|
|
34
38
|
widenRecallStateViews
|
|
35
39
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-VELCIWJZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/recall-state-view-widen.ts"],"sourcesContent":["/**\n * Recall state-view widening (issue #1952).\n *\n * When recallStateViews is on and the query is change-oriented, admit a\n * superseded memory only if its successor is already in the candidate set.\n * Flag off / non-change queries are identity.\n */\nimport {\n annotateStateView,\n isChangeOrientedQuery,\n parseRecallStateViews,\n resultStateViewId,\n shouldWidenSuperseded,\n type StateViewResult,\n} from \"./recall-state-view.js\";\n\nexport function widenRecallStateViews<T extends StateViewResult>(\n results: T[],\n query: string,\n config: unknown,\n pool: readonly T[] = [],\n /**\n * #1952 — per-request effective flag (per-call `stateView` OR config,\n * gated on change intent), computed once at recall entry and threaded\n * through. When `true` it wins over the config read so a per-call\n * override survives a global `false` at the inject seam. Callers that\n * omit it keep the legacy config-only behavior.\n */\n stateViewActive?: boolean,\n /**\n * #1952 — historical recall pin (epoch ms). When set, the pool is\n * never widened (pool rows did not survive the asOf validity filter,\n * so pulling a not-yet-valid successor into a historical snapshot\n * would be wrong) and annotation runs in asOf mode: a predecessor is\n * kept and labeled relative to the snapshot without requiring its\n * successor.\n */\n asOfMs?: number,\n): T[] {\n const raw =\n typeof config === \"object\" && config !== null && \"recallStateViews\" in config\n ? config.recallStateViews\n : undefined;\n const enabled = stateViewActive === true || parseRecallStateViews(raw);\n if (!enabled || !isChangeOrientedQuery(query)) return results;\n const asOfActive = typeof asOfMs === \"number\" && Number.isFinite(asOfMs);\n\n const candidateIds = new Set<string>();\n for (const result of results) {\n const id = resultStateViewId(result);\n if (id) candidateIds.add(id);\n }\n\n const seen = new Set(candidateIds);\n const extra: T[] = [];\n if (!asOfActive) {\n for (const item of pool) {\n const id = resultStateViewId(item);\n if (!id || seen.has(id)) continue;\n if (!shouldWidenSuperseded(item.supersededBy, candidateIds)) continue;\n extra.push(item);\n seen.add(id);\n }\n }\n\n return annotateStateView(extra.length > 0 ? results.concat(extra) : results, query, [], {\n enabled: true,\n ...(asOfActive ? { asOfMs } : {}),\n });\n}\n"],"mappings":";;;;;;;;;AAgBO,SAAS,sBACd,SACA,OACA,QACA,OAAqB,CAAC,GAQtB,iBASA,QACK;AACL,QAAM,MACJ,OAAO,WAAW,YAAY,WAAW,QAAQ,sBAAsB,SACnE,OAAO,mBACP;AACN,QAAM,UAAU,oBAAoB,QAAQ,sBAAsB,GAAG;AACrE,MAAI,CAAC,WAAW,CAAC,sBAAsB,KAAK,EAAG,QAAO;AACtD,QAAM,aAAa,OAAO,WAAW,YAAY,OAAO,SAAS,MAAM;AAEvE,QAAM,eAAe,oBAAI,IAAY;AACrC,aAAW,UAAU,SAAS;AAC5B,UAAM,KAAK,kBAAkB,MAAM;AACnC,QAAI,GAAI,cAAa,IAAI,EAAE;AAAA,EAC7B;AAEA,QAAM,OAAO,IAAI,IAAI,YAAY;AACjC,QAAM,QAAa,CAAC;AACpB,MAAI,CAAC,YAAY;AACf,eAAW,QAAQ,MAAM;AACvB,YAAM,KAAK,kBAAkB,IAAI;AACjC,UAAI,CAAC,MAAM,KAAK,IAAI,EAAE,EAAG;AACzB,UAAI,CAAC,sBAAsB,KAAK,cAAc,YAAY,EAAG;AAC7D,YAAM,KAAK,IAAI;AACf,WAAK,IAAI,EAAE;AAAA,IACb;AAAA,EACF;AAEA,SAAO,kBAAkB,MAAM,SAAS,IAAI,QAAQ,OAAO,KAAK,IAAI,SAAS,OAAO,CAAC,GAAG;AAAA,IACtF,SAAS;AAAA,IACT,GAAI,aAAa,EAAE,OAAO,IAAI,CAAC;AAAA,EACjC,CAAC;AACH;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot,
|
|
3
3
|
resolveNamespaceStorageRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RUXPVSML.js";
|
|
5
5
|
import {
|
|
6
6
|
MutationSerializer,
|
|
7
7
|
withHeldFileLock
|
|
@@ -1473,4 +1473,4 @@ export {
|
|
|
1473
1473
|
isNamespaceKind,
|
|
1474
1474
|
NamespaceCatalog
|
|
1475
1475
|
};
|
|
1476
|
-
//# sourceMappingURL=chunk-
|
|
1476
|
+
//# sourceMappingURL=chunk-VYXDUPYE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
launchProcessSync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZEFVK7XC.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveHomeDir
|
|
6
6
|
} from "./chunk-P2QRMMVQ.js";
|
|
@@ -884,4 +884,4 @@ export {
|
|
|
884
884
|
rollbackFromEngramMigration,
|
|
885
885
|
migrateFromEngram
|
|
886
886
|
};
|
|
887
|
-
//# sourceMappingURL=chunk-
|
|
887
|
+
//# sourceMappingURL=chunk-VZAKYDMJ.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyRecallStateViews
|
|
3
|
+
} from "./chunk-BRZWWUCJ.js";
|
|
4
|
+
import {
|
|
5
|
+
isGenericRecallExcludedPath
|
|
6
|
+
} from "./chunk-A5UQ52YQ.js";
|
|
7
|
+
import {
|
|
8
|
+
shouldFilterSupersededFromRecall
|
|
9
|
+
} from "./chunk-5WITETWU.js";
|
|
10
|
+
import {
|
|
11
|
+
isChangeOrientedQuery
|
|
12
|
+
} from "./chunk-255PC37A.js";
|
|
13
|
+
|
|
14
|
+
// src/recall-state-view-admission.ts
|
|
15
|
+
function resolveRecallStateViewActive(options, config, query) {
|
|
16
|
+
return (options.stateView === true || config.recallStateViews === true) && isChangeOrientedQuery(query);
|
|
17
|
+
}
|
|
18
|
+
function filterRecentScanMemoriesForStateView(memories, config, supersessionOptions, stateViewActive, asOfMs) {
|
|
19
|
+
const asOfActive = typeof asOfMs === "number" && Number.isFinite(asOfMs);
|
|
20
|
+
let stateViewAdmittedIds = null;
|
|
21
|
+
if (stateViewActive && !asOfActive) {
|
|
22
|
+
stateViewAdmittedIds = new Set(
|
|
23
|
+
memories.filter(
|
|
24
|
+
(m) => !isGenericRecallExcludedPath(m.path, config) && m.frontmatter.status !== "superseded" && !shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions)
|
|
25
|
+
).map((m) => m.frontmatter.id).filter((id) => typeof id === "string" && id.length > 0)
|
|
26
|
+
);
|
|
27
|
+
for (let progress = true; progress; ) {
|
|
28
|
+
progress = false;
|
|
29
|
+
for (const m of memories) {
|
|
30
|
+
const id = m.frontmatter.id;
|
|
31
|
+
if (typeof id !== "string" || id.length === 0) continue;
|
|
32
|
+
if (stateViewAdmittedIds.has(id)) continue;
|
|
33
|
+
if (isGenericRecallExcludedPath(m.path, config)) continue;
|
|
34
|
+
if (m.frontmatter.status !== "superseded") continue;
|
|
35
|
+
if (!shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions)) continue;
|
|
36
|
+
if (stateViewAdmittedIds.has(m.frontmatter.supersededBy ?? "")) {
|
|
37
|
+
stateViewAdmittedIds.add(id);
|
|
38
|
+
progress = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return memories.filter((m) => {
|
|
44
|
+
if (isGenericRecallExcludedPath(m.path, config)) return false;
|
|
45
|
+
const status = m.frontmatter.status;
|
|
46
|
+
if (!status || status === "active") return true;
|
|
47
|
+
if (status === "superseded") {
|
|
48
|
+
if (asOfActive) return true;
|
|
49
|
+
const id = m.frontmatter.id;
|
|
50
|
+
if (stateViewAdmittedIds !== null && typeof id === "string" && stateViewAdmittedIds.has(id)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return !shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function indexStateViewAnnotatedResults(results, query, config, stateViewActive, asOfMs) {
|
|
59
|
+
return new Map(
|
|
60
|
+
applyRecallStateViews(results, query, config, stateViewActive, asOfMs).map((xr) => [
|
|
61
|
+
`${xr.namespace ?? ""}\0${xr.path}`,
|
|
62
|
+
xr
|
|
63
|
+
])
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
resolveRecallStateViewActive,
|
|
69
|
+
filterRecentScanMemoriesForStateView,
|
|
70
|
+
indexStateViewAnnotatedResults
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-W6IJMWTZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/recall-state-view-admission.ts"],"sourcesContent":["/**\n * Recall-internal state-view admission (issue #1952).\n *\n * Flag resolution, recent-scan successor-anchor admission, and the X-ray\n * inject-seam annotation live here so recall-internal.ts stays under its\n * ratchet ceiling. Callers keep one-line sites.\n */\n\nimport { isGenericRecallExcludedPath, type GenericRecallPathPolicy } from \"./orchestration/generic-recall-paths.js\";\nimport { isChangeOrientedQuery, type StateViewResult } from \"./recall-state-view.js\";\nimport { applyRecallStateViews } from \"./recall-state-view-wire.js\";\nimport { shouldFilterSupersededFromRecall } from \"./temporal-supersession.js\";\nimport type { MemoryFile } from \"./types.js\";\n\n/** Config flag OR per-call override, gated on change intent; computed once for all branches. */\nexport function resolveRecallStateViewActive(\n options: { stateView?: boolean },\n config: { recallStateViews?: boolean },\n query: string,\n): boolean {\n return (options.stateView === true || config.recallStateViews === true) && isChangeOrientedQuery(query);\n}\n\n/**\n * Superseded-status filtering delegates to shouldFilterSupersededFromRecall\n * so recent-scan and the QMD safety filter share semantics (kill switch,\n * audit mode, PR #402).\n *\n * #1952: an active state view admits a superseded memory whose successor\n * ALSO survives this admission filter — a successor excluded by status or\n * path can never anchor (mirrors the filterSearchResultsByRecallSafety\n * fixpoint). Anchors grow through admitted chain links, so iterate to a\n * fixpoint.\n *\n * PR #713: when `as_of` is active, pass superseded candidates through here\n * — boostSearchResults's `[valid_at, invalid_at)` evaluation is the\n * authoritative historical gate. Other non-active statuses stay excluded.\n */\nexport function filterRecentScanMemoriesForStateView(\n memories: readonly MemoryFile[],\n config: GenericRecallPathPolicy,\n supersessionOptions: { enabled: boolean; includeInRecall: boolean },\n stateViewActive: boolean,\n asOfMs: number | undefined,\n): MemoryFile[] {\n const asOfActive = typeof asOfMs === \"number\" && Number.isFinite(asOfMs);\n let stateViewAdmittedIds: Set<string> | null = null;\n if (stateViewActive && !asOfActive) {\n stateViewAdmittedIds = new Set(\n memories\n .filter(\n (m) =>\n !isGenericRecallExcludedPath(m.path, config) &&\n m.frontmatter.status !== \"superseded\" &&\n !shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions),\n )\n .map((m) => m.frontmatter.id)\n .filter((id): id is string => typeof id === \"string\" && id.length > 0),\n );\n for (let progress = true; progress; ) {\n progress = false;\n for (const m of memories) {\n const id = m.frontmatter.id;\n if (typeof id !== \"string\" || id.length === 0) continue;\n if (stateViewAdmittedIds.has(id)) continue;\n if (isGenericRecallExcludedPath(m.path, config)) continue;\n if (m.frontmatter.status !== \"superseded\") continue;\n if (!shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions)) continue;\n if (stateViewAdmittedIds.has(m.frontmatter.supersededBy ?? \"\")) {\n stateViewAdmittedIds.add(id);\n progress = true;\n }\n }\n }\n }\n return memories.filter((m) => {\n if (isGenericRecallExcludedPath(m.path, config)) return false;\n const status = m.frontmatter.status;\n if (!status || status === \"active\") return true;\n if (status === \"superseded\") {\n if (asOfActive) return true;\n const id = m.frontmatter.id;\n if (\n stateViewAdmittedIds !== null &&\n typeof id === \"string\" &&\n stateViewAdmittedIds.has(id)\n ) {\n return true;\n }\n // Include superseded memory only if the canonical gate says\n // NOT to filter it (kill switch off or audit mode on).\n return !shouldFilterSupersededFromRecall(m.frontmatter, supersessionOptions);\n }\n // Other non-active statuses (archived, retired, etc.) are\n // excluded from the recent-scan path by default.\n return false;\n });\n}\n\n/** Label the captured X-ray branch through the same inject-seam annotator. */\nexport function indexStateViewAnnotatedResults<T extends StateViewResult & { path: string; namespace?: string }>(\n results: T[],\n query: string,\n config: unknown,\n stateViewActive?: boolean,\n asOfMs?: number,\n): Map<string, T> {\n return new Map(\n applyRecallStateViews(results, query, config, stateViewActive, asOfMs).map((xr) => [\n `${xr.namespace ?? \"\"}\\0${xr.path}`,\n xr,\n ]),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeO,SAAS,6BACd,SACA,QACA,OACS;AACT,UAAQ,QAAQ,cAAc,QAAQ,OAAO,qBAAqB,SAAS,sBAAsB,KAAK;AACxG;AAiBO,SAAS,qCACd,UACA,QACA,qBACA,iBACA,QACc;AACd,QAAM,aAAa,OAAO,WAAW,YAAY,OAAO,SAAS,MAAM;AACvE,MAAI,uBAA2C;AAC/C,MAAI,mBAAmB,CAAC,YAAY;AAClC,2BAAuB,IAAI;AAAA,MACzB,SACG;AAAA,QACC,CAAC,MACC,CAAC,4BAA4B,EAAE,MAAM,MAAM,KAC3C,EAAE,YAAY,WAAW,gBACzB,CAAC,iCAAiC,EAAE,aAAa,mBAAmB;AAAA,MACxE,EACC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,EAC3B,OAAO,CAAC,OAAqB,OAAO,OAAO,YAAY,GAAG,SAAS,CAAC;AAAA,IACzE;AACA,aAAS,WAAW,MAAM,YAAY;AACpC,iBAAW;AACX,iBAAW,KAAK,UAAU;AACxB,cAAM,KAAK,EAAE,YAAY;AACzB,YAAI,OAAO,OAAO,YAAY,GAAG,WAAW,EAAG;AAC/C,YAAI,qBAAqB,IAAI,EAAE,EAAG;AAClC,YAAI,4BAA4B,EAAE,MAAM,MAAM,EAAG;AACjD,YAAI,EAAE,YAAY,WAAW,aAAc;AAC3C,YAAI,CAAC,iCAAiC,EAAE,aAAa,mBAAmB,EAAG;AAC3E,YAAI,qBAAqB,IAAI,EAAE,YAAY,gBAAgB,EAAE,GAAG;AAC9D,+BAAqB,IAAI,EAAE;AAC3B,qBAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO,SAAS,OAAO,CAAC,MAAM;AAC5B,QAAI,4BAA4B,EAAE,MAAM,MAAM,EAAG,QAAO;AACxD,UAAM,SAAS,EAAE,YAAY;AAC7B,QAAI,CAAC,UAAU,WAAW,SAAU,QAAO;AAC3C,QAAI,WAAW,cAAc;AAC3B,UAAI,WAAY,QAAO;AACvB,YAAM,KAAK,EAAE,YAAY;AACzB,UACE,yBAAyB,QACzB,OAAO,OAAO,YACd,qBAAqB,IAAI,EAAE,GAC3B;AACA,eAAO;AAAA,MACT;AAGA,aAAO,CAAC,iCAAiC,EAAE,aAAa,mBAAmB;AAAA,IAC7E;AAGA,WAAO;AAAA,EACT,CAAC;AACH;AAGO,SAAS,+BACd,SACA,OACA,QACA,iBACA,QACgB;AAChB,SAAO,IAAI;AAAA,IACT,sBAAsB,SAAS,OAAO,QAAQ,iBAAiB,MAAM,EAAE,IAAI,CAAC,OAAO;AAAA,MACjF,GAAG,GAAG,aAAa,EAAE,KAAK,GAAG,IAAI;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
listMemoryGovernanceRuns,
|
|
9
9
|
readMemoryGovernanceRunArtifact
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HUT2JR6I.js";
|
|
11
11
|
import {
|
|
12
12
|
StorageManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5VAF4ID4.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeProjectionPreview,
|
|
16
16
|
normalizeProjectionTags
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from "./chunk-7RJUVTVF.js";
|
|
48
48
|
import {
|
|
49
49
|
isSupportPassportPrivateMemory
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PWPIERBM.js";
|
|
51
51
|
import {
|
|
52
52
|
isErrnoCode
|
|
53
53
|
} from "./chunk-KNA3BXXL.js";
|
|
@@ -1005,4 +1005,4 @@ export {
|
|
|
1005
1005
|
verifyMemoryProjection,
|
|
1006
1006
|
repairMemoryProjection
|
|
1007
1007
|
};
|
|
1008
|
-
//# sourceMappingURL=chunk-
|
|
1008
|
+
//# sourceMappingURL=chunk-WHHEPAO3.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PROMOTION_CANDIDATES_DEFAULT_MIN_ACCESS,
|
|
3
|
-
isSubjectGuardMode
|
|
4
|
-
} from "./chunk-VYCOJKSX.js";
|
|
5
1
|
import {
|
|
6
2
|
coerceBool,
|
|
7
3
|
coerceNumber
|
|
8
4
|
} from "./chunk-PQVCH2AE.js";
|
|
5
|
+
import {
|
|
6
|
+
PROMOTION_CANDIDATES_DEFAULT_MIN_ACCESS,
|
|
7
|
+
isSubjectGuardMode
|
|
8
|
+
} from "./chunk-VYCOJKSX.js";
|
|
9
9
|
|
|
10
10
|
// src/subject-config.ts
|
|
11
11
|
function assertObjectBlock(value, key, shape) {
|
|
@@ -52,4 +52,4 @@ function parseSubjectRuntimeConfig(cfg) {
|
|
|
52
52
|
export {
|
|
53
53
|
parseSubjectRuntimeConfig
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-WIKO4SCR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getOperation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JHZCXUQI.js";
|
|
4
4
|
import {
|
|
5
5
|
EngramAccessInputError
|
|
6
6
|
} from "./chunk-2Z24E5W2.js";
|
|
@@ -21,4 +21,4 @@ async function respondBriefingHttp(options) {
|
|
|
21
21
|
export {
|
|
22
22
|
respondBriefingHttp
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-WPDKBUWX.js.map
|