@remnic/core 10.0.144 → 10.0.146
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.js +189 -183
- package/dist/access-cli.js +189 -183
- package/dist/access-cli.js.map +1 -1
- package/dist/access-correlation.d.ts +4 -0
- package/dist/access-correlation.d.ts.map +1 -0
- package/dist/access-correlation.js +10 -0
- package/dist/access-extraction-force-flush-preempt.js +189 -183
- package/dist/access-extraction-force-flush.js +189 -183
- package/dist/access-http-briefing.js +189 -183
- package/dist/access-http-query.js +189 -183
- package/dist/access-http.d.ts.map +1 -1
- package/dist/access-http.js +189 -183
- package/dist/access-identity-continuity-surface.js +189 -183
- package/dist/access-lcm-surface.js +189 -183
- package/dist/access-mcp.js +189 -183
- package/dist/access-observe-write-category.js +13 -13
- package/dist/access-observe-write-surface.d.ts.map +1 -1
- package/dist/access-observe-write-surface.js +189 -183
- package/dist/access-offline-manifest.js +11 -11
- package/dist/access-operations-batch.js +189 -183
- package/dist/access-operations.js +189 -183
- package/dist/access-recall-concurrency.js +189 -183
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +189 -183
- package/dist/access-recall-surface.js +189 -183
- package/dist/access-schema.js +9 -9
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +189 -183
- package/dist/active-recall.js +33 -33
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/auto-sync-PSZJHHXB.js +2 -2
- package/dist/briefing.js +22 -22
- package/dist/buffer-add-turns-bounded.d.ts +27 -0
- package/dist/buffer-add-turns-bounded.d.ts.map +1 -0
- package/dist/buffer-add-turns-bounded.js +13 -0
- package/dist/buffer-admission-idempotency.d.ts +18 -0
- package/dist/buffer-admission-idempotency.d.ts.map +1 -0
- package/dist/buffer-admission-idempotency.js +18 -0
- package/dist/buffer-persistence.d.ts +4 -0
- package/dist/buffer-persistence.d.ts.map +1 -1
- package/dist/buffer-persistence.js +1 -1
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +1 -1
- package/dist/buffer-types.d.ts.map +1 -1
- package/dist/buffer.d.ts +11 -0
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +15 -10
- package/dist/calibration.js +4 -4
- package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +25 -25
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-AWKD2A73.js → chunk-2NGTY22Z.js} +12 -12
- package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-EDGWAJLS.js → chunk-2WD2TRTJ.js} +2 -2
- package/dist/{chunk-AZFQXYIJ.js → chunk-33VVVP57.js} +9 -2
- package/dist/{chunk-AZFQXYIJ.js.map → chunk-33VVVP57.js.map} +1 -1
- package/dist/{chunk-AOZYOS4G.js → chunk-3MXQ5XJT.js} +2 -2
- package/dist/{chunk-XGDWR2L6.js → chunk-3NLBDM7V.js} +2 -2
- package/dist/{chunk-XVZA6VXC.js → chunk-3SL52JKD.js} +4 -4
- package/dist/chunk-4IJBNRMZ.js +45 -0
- package/dist/chunk-4IJBNRMZ.js.map +1 -0
- package/dist/{chunk-LE27GU4M.js → chunk-4N4BAO66.js} +2 -2
- package/dist/{chunk-UC3KG7KX.js → chunk-4WX32RLU.js} +3 -3
- package/dist/{chunk-WVV54HL2.js → chunk-4Y4LPKFV.js} +7 -7
- package/dist/{chunk-MFDEEOOZ.js → chunk-5BE3FLKL.js} +4 -4
- package/dist/chunk-5EP2V675.js +60 -0
- package/dist/chunk-5EP2V675.js.map +1 -0
- package/dist/chunk-5JD4DXQX.js +91 -0
- package/dist/chunk-5JD4DXQX.js.map +1 -0
- package/dist/{chunk-MPQQIHA7.js → chunk-5LL2X5SO.js} +2 -2
- package/dist/{chunk-CBJRI6VJ.js → chunk-64TIBZPZ.js} +2 -2
- package/dist/{chunk-LL7WIK2Z.js → chunk-6NPLVV6M.js} +2 -2
- package/dist/{chunk-DC55RIEZ.js → chunk-73TPOGS4.js} +9 -9
- package/dist/{chunk-XF2QQQXO.js → chunk-7P72BY4F.js} +2 -2
- package/dist/{chunk-XUKBX3GO.js → chunk-7YHU3NJD.js} +15 -15
- package/dist/chunk-7ZFB4VZS.js +73 -0
- package/dist/chunk-7ZFB4VZS.js.map +1 -0
- package/dist/{chunk-6CSWINXA.js → chunk-AIDFYS4Z.js} +14 -14
- package/dist/{chunk-E23BTVB2.js → chunk-AO5LKFGO.js} +4 -4
- package/dist/{chunk-G4NKURT4.js → chunk-C6S353AG.js} +30 -1
- package/dist/chunk-C6S353AG.js.map +1 -0
- package/dist/{chunk-JY3WATTF.js → chunk-C6Z3H23R.js} +2 -2
- package/dist/{chunk-FWDVW2BD.js → chunk-CAWVPY6E.js} +499 -480
- package/dist/chunk-CAWVPY6E.js.map +1 -0
- package/dist/{chunk-VAVCFMMQ.js → chunk-CJ2SYU4S.js} +2 -2
- package/dist/{chunk-WZ55LEUN.js → chunk-CLVILSBR.js} +22 -22
- package/dist/{chunk-B72X3KWL.js → chunk-COJBTRTQ.js} +2 -2
- package/dist/{chunk-NWS4I4K7.js → chunk-CVCKYMVX.js} +2 -2
- package/dist/{chunk-2LQUPEWF.js → chunk-EJ6EPEMP.js} +36 -33
- package/dist/chunk-EJ6EPEMP.js.map +1 -0
- package/dist/{chunk-6MEQHJTF.js → chunk-FMFCQRDM.js} +3 -3
- package/dist/{chunk-A3EWNU5V.js → chunk-G2TK5YYU.js} +2 -2
- package/dist/{chunk-WWQMZBDI.js → chunk-GCHM5BYL.js} +4 -4
- package/dist/{chunk-RHQSAXN3.js → chunk-GCQIXPWZ.js} +2 -2
- package/dist/{chunk-VEFGHRKV.js → chunk-GMO3BGOF.js} +1 -1
- package/dist/{chunk-I3UBDUHO.js → chunk-H6OTEBPK.js} +2 -2
- package/dist/{chunk-MIG4KRYU.js → chunk-HADCITEA.js} +8 -8
- package/dist/{chunk-M43GO34S.js → chunk-HASIFVWH.js} +2 -2
- package/dist/{chunk-RQBYC7EK.js → chunk-HLWXCDUQ.js} +2 -2
- package/dist/{chunk-JVSHXYOO.js → chunk-HOGSBSCH.js} +2 -2
- package/dist/{chunk-BFPF5N3H.js → chunk-HXFIILGF.js} +4 -4
- package/dist/{chunk-2JAT4S7N.js → chunk-IMULTENA.js} +2 -2
- package/dist/{chunk-B4I37XX6.js → chunk-IOMWNBMH.js} +15 -15
- package/dist/{chunk-74BX5NCU.js → chunk-IXR3SNHL.js} +2 -2
- package/dist/{chunk-2S4XW47C.js → chunk-J3EU5H7W.js} +2 -2
- package/dist/{chunk-EUL3S3LE.js → chunk-J5WI4QRP.js} +4 -4
- package/dist/{chunk-N7LYEA3K.js → chunk-JOQZRIL4.js} +2 -2
- package/dist/{chunk-DLX277NS.js → chunk-JXAHMR5L.js} +2 -2
- package/dist/{chunk-POXJ3KXJ.js → chunk-KG7RO5XU.js} +3 -3
- package/dist/{chunk-JVNGFQJN.js → chunk-KJ3Z7JHF.js} +1 -1
- package/dist/{chunk-JVNGFQJN.js.map → chunk-KJ3Z7JHF.js.map} +1 -1
- package/dist/{chunk-R45L4TV6.js → chunk-KQAFEZQX.js} +6 -6
- package/dist/{chunk-L6CMR5OI.js → chunk-L2DACC2T.js} +2 -2
- package/dist/{chunk-77SYM565.js → chunk-LD7I5AZW.js} +9 -9
- package/dist/{chunk-OYUTSLBU.js → chunk-LKXED2DT.js} +14 -14
- package/dist/{chunk-3KQPFIVV.js → chunk-LMFINE37.js} +2 -2
- package/dist/{chunk-OYHGCAGQ.js → chunk-LYM65HMS.js} +2 -2
- package/dist/{chunk-OV3XHQAB.js → chunk-LYSE5FNF.js} +43 -48
- package/dist/chunk-LYSE5FNF.js.map +1 -0
- package/dist/{chunk-MEALRZYB.js → chunk-MKJBZR7J.js} +2 -2
- package/dist/{chunk-AGJJTD3Q.js → chunk-MONIOXEG.js} +2 -2
- package/dist/{chunk-RVUD4WN3.js → chunk-ND7ZKKVK.js} +2 -2
- package/dist/{chunk-PKPW7MXT.js → chunk-O7CHKXSF.js} +4 -4
- package/dist/{chunk-UH3FPX3L.js → chunk-OM5ESBES.js} +2 -2
- package/dist/{chunk-Y6IRNAWT.js → chunk-OSM5MKAU.js} +2 -2
- package/dist/chunk-PXY2B7BG.js +51 -0
- package/dist/chunk-PXY2B7BG.js.map +1 -0
- package/dist/{chunk-5IGWEYNV.js → chunk-QDY4TSKK.js} +3 -3
- package/dist/{chunk-IJBOJJVS.js → chunk-QP6CBFYL.js} +2 -2
- package/dist/{chunk-MZCGHPIJ.js → chunk-RB7NXZ2E.js} +2 -2
- package/dist/{chunk-FJVWKIDV.js → chunk-RMPHPB6B.js} +2 -2
- package/dist/{chunk-QPOWOQYH.js → chunk-RXXXT5PA.js} +6 -6
- package/dist/{chunk-FYH62SF3.js → chunk-S627NPRV.js} +6 -6
- package/dist/{chunk-YCNSMVWG.js → chunk-SDGD6MYV.js} +64 -3
- package/dist/chunk-SDGD6MYV.js.map +1 -0
- package/dist/{chunk-6DHSEJIO.js → chunk-SXVU57SW.js} +2 -2
- package/dist/{chunk-YWXFO7G2.js → chunk-TAUBEJ37.js} +5 -5
- package/dist/{chunk-GOZXQNIM.js → chunk-TH6OYP6I.js} +3 -3
- package/dist/{chunk-QJJURIZV.js → chunk-TNACU47L.js} +3 -3
- package/dist/{chunk-4Y26S76X.js → chunk-TRFSTCQK.js} +14 -2
- package/dist/chunk-TRFSTCQK.js.map +1 -0
- package/dist/{chunk-YLTU2DC4.js → chunk-U2PSE7MB.js} +2 -2
- package/dist/{chunk-2VS3DAXE.js → chunk-V3D2OOVE.js} +2 -2
- package/dist/{chunk-PCMGMPQZ.js → chunk-X4EF7IG3.js} +4 -4
- package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-CBTERRF5.js → chunk-XCJDDXJX.js} +2 -2
- package/dist/{chunk-RSRHWNNM.js → chunk-XPDMJC5O.js} +3 -3
- package/dist/{chunk-NLSMLRH4.js → chunk-XTGQTSZZ.js} +2 -2
- package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
- package/dist/chunk-YRHBSYQR.js +15 -0
- package/dist/chunk-YRHBSYQR.js.map +1 -0
- package/dist/{chunk-VEPT6DXJ.js → chunk-YVK7WZYC.js} +5 -5
- package/dist/{chunk-2IMKMMUS.js → chunk-ZDWZYKCL.js} +11 -11
- package/dist/{chunk-FAPJG3OG.js → chunk-ZDZJNXL6.js} +4 -4
- package/dist/{chunk-BNQJKWWZ.js → chunk-ZG4GNPRE.js} +8 -8
- package/dist/cli.js +189 -183
- package/dist/coding/export-okf-codegraph.js +21 -21
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +23 -23
- package/dist/config.js +33 -33
- package/dist/connectors/codex-materialize-runner.js +22 -22
- package/dist/connectors/index.js +22 -22
- package/dist/contradiction/index.js +7 -7
- package/dist/convergence-refresh.js +24 -24
- package/dist/corpus-watermark.js +24 -24
- package/dist/dashboard-runtime.js +2 -2
- package/dist/deep-recall-http-glue.js +10 -10
- package/dist/deep-recall.js +2 -2
- package/dist/entity-retrieval.js +25 -25
- package/dist/event-order-recall.js +4 -4
- package/dist/explicit-capture.js +189 -183
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +32 -32
- package/dist/{graph-edge-decay-EKWXRBWF.js → graph-edge-decay-BC3IO2J4.js} +6 -6
- package/dist/graph-edge-decay-BC3IO2J4.js.map +1 -0
- package/dist/graph-jsonl.js +4 -4
- package/dist/graph-snapshot.js +4 -4
- package/dist/graph.js +5 -5
- package/dist/harmonic-retrieval.js +22 -22
- package/dist/index.js +324 -318
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.js +9 -9
- package/dist/local-llm.js +3 -3
- package/dist/location/index.js +23 -23
- package/dist/maintenance/memory-governance.js +22 -22
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +22 -22
- package/dist/maintenance/rebuild-memory-projection-runner.js +24 -24
- package/dist/maintenance/rebuild-memory-projection.js +23 -23
- package/dist/memory-browse.js +7 -7
- package/dist/memory-subject.js +1 -1
- package/dist/namespaces/migrate.js +23 -23
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.js +22 -22
- package/dist/offline-sync-changeset-generations.js +3 -3
- package/dist/offline-sync-embedding-generation.js +2 -2
- package/dist/offline-sync-snapshot-stream.js +6 -6
- package/dist/offline-sync.js +7 -7
- package/dist/operator-doctor-corpus.js +25 -25
- package/dist/operator-toolkit.js +43 -43
- package/dist/orchestration/backlog-scheduler.js +190 -184
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +190 -184
- package/dist/orchestration/maintenance.js +34 -34
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/turn-ingestion-buffered.d.ts +13 -0
- package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -0
- package/dist/orchestration/turn-ingestion.d.ts +2 -2
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.js +189 -183
- package/dist/qmd.js +3 -3
- package/dist/recall-attempt-timing.d.ts +18 -0
- package/dist/recall-attempt-timing.d.ts.map +1 -0
- package/dist/recall-attempt-timing.js +14 -0
- package/dist/recall-attempt-timing.js.map +1 -0
- package/dist/recall-enrichment-promise.d.ts +22 -0
- package/dist/recall-enrichment-promise.d.ts.map +1 -0
- package/dist/recall-enrichment-promise.js +10 -0
- package/dist/recall-enrichment-promise.js.map +1 -0
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation.js +189 -183
- package/dist/recall-phase2-timing.d.ts +44 -0
- package/dist/recall-phase2-timing.d.ts.map +1 -0
- package/dist/recall-phase2-timing.js +22 -0
- package/dist/recall-phase2-timing.js.map +1 -0
- package/dist/recall-state-view-admission.js +6 -6
- package/dist/recall-timings.d.ts +35 -0
- package/dist/recall-timings.d.ts.map +1 -1
- package/dist/recall-timings.js +2 -1
- package/dist/recall-why-service.js +8 -8
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/manifest.js +3 -3
- package/dist/{resolution-A3NAI3YE.js → resolution-TCO63RRC.js} +8 -8
- package/dist/resolution-TCO63RRC.js.map +1 -0
- package/dist/resume-bundles.js +34 -34
- package/dist/salvage-envelope.js +1 -1
- package/dist/search/factory.js +6 -6
- package/dist/search/index.js +10 -10
- package/dist/semantic-consolidation.js +23 -23
- package/dist/semantic-rule-promotion.js +22 -22
- package/dist/semantic-rule-verifier.js +22 -22
- package/dist/source-agent-qualifier.js +25 -25
- package/dist/standup/build.js +22 -22
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.d.ts +4 -0
- package/dist/storage/buffer-session-files.d.ts.map +1 -1
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage.d.ts +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +22 -22
- package/dist/subject-config.js +1 -1
- package/dist/summarizer.js +5 -5
- package/dist/support-passport/index.js +8 -8
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.js +23 -23
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +22 -22
- package/dist/who-knows-cli.js +23 -23
- package/dist/who-knows.js +22 -22
- package/dist/write-envelope.js +1 -1
- package/package.json +2 -2
- package/src/access-correlation.ts +17 -0
- package/src/access-http.ts +7 -8
- package/src/access-observe-write-surface.ts +10 -0
- package/src/access-service.ts +3 -1
- package/src/buffer-add-turns-bounded.ts +97 -0
- package/src/buffer-admission-idempotency.test.ts +297 -0
- package/src/buffer-admission-idempotency.ts +67 -0
- package/src/buffer-drain-handover.test.ts +1 -0
- package/src/buffer-persistence.ts +19 -1
- package/src/buffer-turn-helpers.ts +8 -1
- package/src/buffer-types.ts +1 -0
- package/src/buffer.ts +40 -43
- package/src/orchestration/recall-internal.ts +63 -75
- package/src/orchestration/turn-ingestion-buffered.ts +74 -0
- package/src/orchestration/turn-ingestion.ts +4 -78
- package/src/recall-attempt-timing.ts +78 -0
- package/src/recall-enrichment-promise.ts +62 -0
- package/src/recall-phase2-timing.ts +146 -0
- package/src/recall-timings-access.test.ts +140 -2
- package/src/recall-timings-request-contract.test.ts +488 -0
- package/src/recall-timings.ts +70 -0
- package/src/storage/buffer-session-files.ts +71 -0
- package/src/storage.ts +1 -0
- package/src/types.ts +2 -0
- package/dist/chunk-2LQUPEWF.js.map +0 -1
- package/dist/chunk-4Y26S76X.js.map +0 -1
- package/dist/chunk-FWDVW2BD.js.map +0 -1
- package/dist/chunk-G4NKURT4.js.map +0 -1
- package/dist/chunk-OV3XHQAB.js.map +0 -1
- package/dist/chunk-YCNSMVWG.js.map +0 -1
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → access-correlation.js.map} +0 -0
- /package/dist/{graph-edge-decay-EKWXRBWF.js.map → buffer-add-turns-bounded.js.map} +0 -0
- /package/dist/{resolution-A3NAI3YE.js.map → buffer-admission-idempotency.js.map} +0 -0
- /package/dist/{chunk-AWKD2A73.js.map → chunk-2NGTY22Z.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-EDGWAJLS.js.map → chunk-2WD2TRTJ.js.map} +0 -0
- /package/dist/{chunk-AOZYOS4G.js.map → chunk-3MXQ5XJT.js.map} +0 -0
- /package/dist/{chunk-XGDWR2L6.js.map → chunk-3NLBDM7V.js.map} +0 -0
- /package/dist/{chunk-XVZA6VXC.js.map → chunk-3SL52JKD.js.map} +0 -0
- /package/dist/{chunk-LE27GU4M.js.map → chunk-4N4BAO66.js.map} +0 -0
- /package/dist/{chunk-UC3KG7KX.js.map → chunk-4WX32RLU.js.map} +0 -0
- /package/dist/{chunk-WVV54HL2.js.map → chunk-4Y4LPKFV.js.map} +0 -0
- /package/dist/{chunk-MFDEEOOZ.js.map → chunk-5BE3FLKL.js.map} +0 -0
- /package/dist/{chunk-MPQQIHA7.js.map → chunk-5LL2X5SO.js.map} +0 -0
- /package/dist/{chunk-CBJRI6VJ.js.map → chunk-64TIBZPZ.js.map} +0 -0
- /package/dist/{chunk-LL7WIK2Z.js.map → chunk-6NPLVV6M.js.map} +0 -0
- /package/dist/{chunk-DC55RIEZ.js.map → chunk-73TPOGS4.js.map} +0 -0
- /package/dist/{chunk-XF2QQQXO.js.map → chunk-7P72BY4F.js.map} +0 -0
- /package/dist/{chunk-XUKBX3GO.js.map → chunk-7YHU3NJD.js.map} +0 -0
- /package/dist/{chunk-6CSWINXA.js.map → chunk-AIDFYS4Z.js.map} +0 -0
- /package/dist/{chunk-E23BTVB2.js.map → chunk-AO5LKFGO.js.map} +0 -0
- /package/dist/{chunk-JY3WATTF.js.map → chunk-C6Z3H23R.js.map} +0 -0
- /package/dist/{chunk-VAVCFMMQ.js.map → chunk-CJ2SYU4S.js.map} +0 -0
- /package/dist/{chunk-WZ55LEUN.js.map → chunk-CLVILSBR.js.map} +0 -0
- /package/dist/{chunk-B72X3KWL.js.map → chunk-COJBTRTQ.js.map} +0 -0
- /package/dist/{chunk-NWS4I4K7.js.map → chunk-CVCKYMVX.js.map} +0 -0
- /package/dist/{chunk-6MEQHJTF.js.map → chunk-FMFCQRDM.js.map} +0 -0
- /package/dist/{chunk-A3EWNU5V.js.map → chunk-G2TK5YYU.js.map} +0 -0
- /package/dist/{chunk-WWQMZBDI.js.map → chunk-GCHM5BYL.js.map} +0 -0
- /package/dist/{chunk-RHQSAXN3.js.map → chunk-GCQIXPWZ.js.map} +0 -0
- /package/dist/{chunk-VEFGHRKV.js.map → chunk-GMO3BGOF.js.map} +0 -0
- /package/dist/{chunk-I3UBDUHO.js.map → chunk-H6OTEBPK.js.map} +0 -0
- /package/dist/{chunk-MIG4KRYU.js.map → chunk-HADCITEA.js.map} +0 -0
- /package/dist/{chunk-M43GO34S.js.map → chunk-HASIFVWH.js.map} +0 -0
- /package/dist/{chunk-RQBYC7EK.js.map → chunk-HLWXCDUQ.js.map} +0 -0
- /package/dist/{chunk-JVSHXYOO.js.map → chunk-HOGSBSCH.js.map} +0 -0
- /package/dist/{chunk-BFPF5N3H.js.map → chunk-HXFIILGF.js.map} +0 -0
- /package/dist/{chunk-2JAT4S7N.js.map → chunk-IMULTENA.js.map} +0 -0
- /package/dist/{chunk-B4I37XX6.js.map → chunk-IOMWNBMH.js.map} +0 -0
- /package/dist/{chunk-74BX5NCU.js.map → chunk-IXR3SNHL.js.map} +0 -0
- /package/dist/{chunk-2S4XW47C.js.map → chunk-J3EU5H7W.js.map} +0 -0
- /package/dist/{chunk-EUL3S3LE.js.map → chunk-J5WI4QRP.js.map} +0 -0
- /package/dist/{chunk-N7LYEA3K.js.map → chunk-JOQZRIL4.js.map} +0 -0
- /package/dist/{chunk-DLX277NS.js.map → chunk-JXAHMR5L.js.map} +0 -0
- /package/dist/{chunk-POXJ3KXJ.js.map → chunk-KG7RO5XU.js.map} +0 -0
- /package/dist/{chunk-R45L4TV6.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-L6CMR5OI.js.map → chunk-L2DACC2T.js.map} +0 -0
- /package/dist/{chunk-77SYM565.js.map → chunk-LD7I5AZW.js.map} +0 -0
- /package/dist/{chunk-OYUTSLBU.js.map → chunk-LKXED2DT.js.map} +0 -0
- /package/dist/{chunk-3KQPFIVV.js.map → chunk-LMFINE37.js.map} +0 -0
- /package/dist/{chunk-OYHGCAGQ.js.map → chunk-LYM65HMS.js.map} +0 -0
- /package/dist/{chunk-MEALRZYB.js.map → chunk-MKJBZR7J.js.map} +0 -0
- /package/dist/{chunk-AGJJTD3Q.js.map → chunk-MONIOXEG.js.map} +0 -0
- /package/dist/{chunk-RVUD4WN3.js.map → chunk-ND7ZKKVK.js.map} +0 -0
- /package/dist/{chunk-PKPW7MXT.js.map → chunk-O7CHKXSF.js.map} +0 -0
- /package/dist/{chunk-UH3FPX3L.js.map → chunk-OM5ESBES.js.map} +0 -0
- /package/dist/{chunk-Y6IRNAWT.js.map → chunk-OSM5MKAU.js.map} +0 -0
- /package/dist/{chunk-5IGWEYNV.js.map → chunk-QDY4TSKK.js.map} +0 -0
- /package/dist/{chunk-IJBOJJVS.js.map → chunk-QP6CBFYL.js.map} +0 -0
- /package/dist/{chunk-MZCGHPIJ.js.map → chunk-RB7NXZ2E.js.map} +0 -0
- /package/dist/{chunk-FJVWKIDV.js.map → chunk-RMPHPB6B.js.map} +0 -0
- /package/dist/{chunk-QPOWOQYH.js.map → chunk-RXXXT5PA.js.map} +0 -0
- /package/dist/{chunk-FYH62SF3.js.map → chunk-S627NPRV.js.map} +0 -0
- /package/dist/{chunk-6DHSEJIO.js.map → chunk-SXVU57SW.js.map} +0 -0
- /package/dist/{chunk-YWXFO7G2.js.map → chunk-TAUBEJ37.js.map} +0 -0
- /package/dist/{chunk-GOZXQNIM.js.map → chunk-TH6OYP6I.js.map} +0 -0
- /package/dist/{chunk-QJJURIZV.js.map → chunk-TNACU47L.js.map} +0 -0
- /package/dist/{chunk-YLTU2DC4.js.map → chunk-U2PSE7MB.js.map} +0 -0
- /package/dist/{chunk-2VS3DAXE.js.map → chunk-V3D2OOVE.js.map} +0 -0
- /package/dist/{chunk-PCMGMPQZ.js.map → chunk-X4EF7IG3.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-CBTERRF5.js.map → chunk-XCJDDXJX.js.map} +0 -0
- /package/dist/{chunk-RSRHWNNM.js.map → chunk-XPDMJC5O.js.map} +0 -0
- /package/dist/{chunk-NLSMLRH4.js.map → chunk-XTGQTSZZ.js.map} +0 -0
- /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
- /package/dist/{chunk-VEPT6DXJ.js.map → chunk-YVK7WZYC.js.map} +0 -0
- /package/dist/{chunk-2IMKMMUS.js.map → chunk-ZDWZYKCL.js.map} +0 -0
- /package/dist/{chunk-FAPJG3OG.js.map → chunk-ZDZJNXL6.js.map} +0 -0
- /package/dist/{chunk-BNQJKWWZ.js.map → chunk-ZG4GNPRE.js.map} +0 -0
package/dist/who-knows.js
CHANGED
|
@@ -9,22 +9,22 @@ import {
|
|
|
9
9
|
loadWhoKnowsEntities,
|
|
10
10
|
tokenizeTopic,
|
|
11
11
|
validateWhoKnowsInput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-HOGSBSCH.js";
|
|
13
|
+
import "./chunk-EJ6EPEMP.js";
|
|
14
14
|
import "./chunk-QGVCFVX6.js";
|
|
15
15
|
import "./chunk-UHVXE24Y.js";
|
|
16
16
|
import "./chunk-AW56K4SI.js";
|
|
17
17
|
import "./chunk-G6OFEGUR.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-YCK26VSL.js";
|
|
22
|
-
import "./chunk-EXYT52NR.js";
|
|
18
|
+
import "./chunk-SDGD6MYV.js";
|
|
19
|
+
import "./chunk-XCJDDXJX.js";
|
|
20
|
+
import "./chunk-HADCITEA.js";
|
|
23
21
|
import "./chunk-3DJ6R4CC.js";
|
|
24
22
|
import "./chunk-66DUCUOC.js";
|
|
25
23
|
import "./chunk-CYEPCZN5.js";
|
|
26
24
|
import "./chunk-DLR3SBOM.js";
|
|
25
|
+
import "./chunk-YCK26VSL.js";
|
|
27
26
|
import "./chunk-WNEVEMJ3.js";
|
|
27
|
+
import "./chunk-EXYT52NR.js";
|
|
28
28
|
import "./chunk-Y5NLBXPV.js";
|
|
29
29
|
import "./chunk-TFA6HPOA.js";
|
|
30
30
|
import "./chunk-F4TWWUMP.js";
|
|
@@ -35,47 +35,49 @@ import "./chunk-PPUNC7UX.js";
|
|
|
35
35
|
import "./chunk-X3724WL4.js";
|
|
36
36
|
import "./chunk-MRPOZBJC.js";
|
|
37
37
|
import "./chunk-L76BQSWB.js";
|
|
38
|
-
import "./chunk-DM2T26WE.js";
|
|
39
38
|
import "./chunk-LDXUBPMO.js";
|
|
39
|
+
import "./chunk-DM2T26WE.js";
|
|
40
40
|
import "./chunk-FF6N7BXC.js";
|
|
41
41
|
import "./chunk-JNDMIAJ4.js";
|
|
42
42
|
import "./chunk-AAD2ZS6P.js";
|
|
43
|
+
import "./chunk-ZIKENA2C.js";
|
|
44
|
+
import "./chunk-YXZG5TVN.js";
|
|
43
45
|
import "./chunk-3OUGSOJP.js";
|
|
44
46
|
import "./chunk-SCU65EZI.js";
|
|
45
47
|
import "./chunk-3ONXXHQO.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-YXZG5TVN.js";
|
|
48
|
+
import "./chunk-3WU7XOFN.js";
|
|
48
49
|
import "./chunk-P4GUQSK3.js";
|
|
49
50
|
import "./chunk-4LZ7SVKM.js";
|
|
50
51
|
import "./chunk-YHTG64XV.js";
|
|
51
|
-
import "./chunk-3WU7XOFN.js";
|
|
52
52
|
import "./chunk-G7D6GZ5J.js";
|
|
53
53
|
import "./chunk-4QEDFEBY.js";
|
|
54
54
|
import "./chunk-UUSL22HE.js";
|
|
55
55
|
import "./chunk-5WITETWU.js";
|
|
56
56
|
import "./chunk-6CIAGZ6X.js";
|
|
57
|
-
import "./chunk-7VLBZKNB.js";
|
|
58
57
|
import "./chunk-Y33KJ556.js";
|
|
59
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-4Y4LPKFV.js";
|
|
60
59
|
import "./chunk-B7HYXVME.js";
|
|
61
|
-
import "./chunk-OR42ZI54.js";
|
|
62
|
-
import "./chunk-IUM3VSHI.js";
|
|
63
60
|
import "./chunk-EZ47HOJ6.js";
|
|
64
61
|
import "./chunk-AF2XMJKD.js";
|
|
62
|
+
import "./chunk-OR42ZI54.js";
|
|
63
|
+
import "./chunk-IUM3VSHI.js";
|
|
65
64
|
import "./chunk-23G5P7TA.js";
|
|
66
|
-
import "./chunk-AZFQXYIJ.js";
|
|
67
65
|
import "./chunk-MMRTPH3J.js";
|
|
68
66
|
import "./chunk-I55KAVET.js";
|
|
69
67
|
import "./chunk-L2EXJQJP.js";
|
|
70
68
|
import "./chunk-45GF7Y3V.js";
|
|
71
69
|
import "./chunk-QSF5SJAM.js";
|
|
72
70
|
import "./chunk-E2AWJ7KQ.js";
|
|
71
|
+
import "./chunk-7VLBZKNB.js";
|
|
72
|
+
import "./chunk-33VVVP57.js";
|
|
73
|
+
import "./chunk-W5BIQOAJ.js";
|
|
73
74
|
import "./chunk-HADD45AR.js";
|
|
74
75
|
import "./chunk-RNFMFC37.js";
|
|
75
76
|
import "./chunk-YCVB7X56.js";
|
|
76
77
|
import "./chunk-PQVCH2AE.js";
|
|
77
78
|
import "./chunk-PJKTFXE2.js";
|
|
78
|
-
import "./chunk-
|
|
79
|
+
import "./chunk-KJ3Z7JHF.js";
|
|
80
|
+
import "./chunk-YBA52OKG.js";
|
|
79
81
|
import "./chunk-X26YOFGS.js";
|
|
80
82
|
import "./chunk-BT7NVCML.js";
|
|
81
83
|
import "./chunk-TOSPNM4T.js";
|
|
@@ -89,17 +91,15 @@ import "./chunk-7RJUVTVF.js";
|
|
|
89
91
|
import "./chunk-AL3UYZ5N.js";
|
|
90
92
|
import "./chunk-RL6NEVXT.js";
|
|
91
93
|
import "./chunk-YET735EZ.js";
|
|
94
|
+
import "./chunk-TSUSHXBW.js";
|
|
95
|
+
import "./chunk-LEII44QG.js";
|
|
92
96
|
import "./chunk-HLUHEMN4.js";
|
|
93
97
|
import "./chunk-5FVVY2EB.js";
|
|
94
98
|
import "./chunk-BTNNL7ZW.js";
|
|
95
|
-
import "./chunk-EBV6VXKF.js";
|
|
96
|
-
import "./chunk-JVNGFQJN.js";
|
|
97
|
-
import "./chunk-YBA52OKG.js";
|
|
98
|
-
import "./chunk-TSUSHXBW.js";
|
|
99
|
-
import "./chunk-LEII44QG.js";
|
|
100
99
|
import "./chunk-JDSVLVCG.js";
|
|
101
100
|
import "./chunk-5GKPFL3S.js";
|
|
102
101
|
import "./chunk-JAKIDQB2.js";
|
|
102
|
+
import "./chunk-EBV6VXKF.js";
|
|
103
103
|
import "./chunk-P7FMDTKL.js";
|
|
104
104
|
import "./chunk-VUFL7X3H.js";
|
|
105
105
|
import "./chunk-C5LWPYS3.js";
|
package/dist/write-envelope.js
CHANGED
|
@@ -17,10 +17,10 @@ import "./chunk-BT7NVCML.js";
|
|
|
17
17
|
import "./chunk-TOSPNM4T.js";
|
|
18
18
|
import "./chunk-HLUHEMN4.js";
|
|
19
19
|
import "./chunk-5FVVY2EB.js";
|
|
20
|
-
import "./chunk-EBV6VXKF.js";
|
|
21
20
|
import "./chunk-JDSVLVCG.js";
|
|
22
21
|
import "./chunk-5GKPFL3S.js";
|
|
23
22
|
import "./chunk-JAKIDQB2.js";
|
|
23
|
+
import "./chunk-EBV6VXKF.js";
|
|
24
24
|
import "./chunk-P7FMDTKL.js";
|
|
25
25
|
import "./chunk-X4OZMANG.js";
|
|
26
26
|
import "./chunk-R2MBW2S4.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.146",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3396,7 +3396,7 @@
|
|
|
3396
3396
|
"core"
|
|
3397
3397
|
],
|
|
3398
3398
|
"peerDependencies": {
|
|
3399
|
-
"@remnic/coding-graph": "^10.0.
|
|
3399
|
+
"@remnic/coding-graph": "^10.0.146"
|
|
3400
3400
|
},
|
|
3401
3401
|
"peerDependenciesMeta": {
|
|
3402
3402
|
"@remnic/coding-graph": {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
// Server-generated per-request correlation id for the access HTTP transport.
|
|
4
|
+
// Scoped per request in EngramAccessHttpServer and read downstream (recall
|
|
5
|
+
// timings, MCP dispatch, logs) without threading the id through every call.
|
|
6
|
+
// The id never derives from client input: clients may echo it back, but a
|
|
7
|
+
// client-supplied value can never install a correlation context.
|
|
8
|
+
const correlationIdStore = new AsyncLocalStorage<string>();
|
|
9
|
+
|
|
10
|
+
export function runWithCorrelationId<T>(correlationId: string, fn: () => T): T {
|
|
11
|
+
return correlationIdStore.run(correlationId, fn);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The current HTTP request's server-generated correlation id; undefined outside HTTP dispatch. */
|
|
15
|
+
export function currentCorrelationId(): string | undefined {
|
|
16
|
+
return correlationIdStore.getStore();
|
|
17
|
+
}
|
package/src/access-http.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createServer, type IncomingMessage, type Server, type ServerResponse } from "node:http";
|
|
2
2
|
import { randomUUID, timingSafeEqual } from "node:crypto";
|
|
3
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
3
|
import { existsSync } from "node:fs";
|
|
5
4
|
import { readFile } from "node:fs/promises";
|
|
6
5
|
import path from "node:path";
|
|
7
6
|
import { fileURLToPath, URL } from "node:url";
|
|
8
7
|
import { gunzipSync } from "node:zlib";
|
|
8
|
+
import { currentCorrelationId, runWithCorrelationId } from "./access-correlation.js";
|
|
9
9
|
import { log } from "./logger.js";
|
|
10
10
|
import { respondBufferAdmissionError } from "./access-http-admission.js";
|
|
11
11
|
import { resolveNamespaceCapabilities } from "./capabilities.js";
|
|
@@ -119,7 +119,6 @@ export function resolveDefaultAdminConsolePublicDir(sourceUrl = import.meta.url)
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const defaultAdminConsolePublicDir = resolveDefaultAdminConsolePublicDir();
|
|
122
|
-
const correlationIdStore = new AsyncLocalStorage<string>();
|
|
123
122
|
const RELAY_ADMIN_CONSOLE_ASSETS = new Map<string, string>([
|
|
124
123
|
["relay.css", "text/css; charset=utf-8"],
|
|
125
124
|
["relay-model.js", "application/javascript; charset=utf-8"],
|
|
@@ -408,7 +407,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
408
407
|
};
|
|
409
408
|
req.once("aborted", abortDisconnectedRequest);
|
|
410
409
|
res.once("close", abortDisconnectedRequest);
|
|
411
|
-
|
|
410
|
+
runWithCorrelationId(correlationId, () => {
|
|
412
411
|
void this.handle(req, res, correlationId, abortController.signal).catch((err) => {
|
|
413
412
|
if (err instanceof BriefingTimeoutError) {
|
|
414
413
|
this.respondJson(res, 504, { error: err.message, code: "briefing_timeout" });
|
|
@@ -1232,7 +1231,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
1232
1231
|
includeContent: false,
|
|
1233
1232
|
signal: this.createRequestAbortSignal(req, res),
|
|
1234
1233
|
});
|
|
1235
|
-
await respondOfflineSnapshotStream(res, result,
|
|
1234
|
+
await respondOfflineSnapshotStream(res, result, currentCorrelationId());
|
|
1236
1235
|
return;
|
|
1237
1236
|
}
|
|
1238
1237
|
if (
|
|
@@ -1265,7 +1264,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
1265
1264
|
includeTranscripts: includeTranscriptsRaw !== "false",
|
|
1266
1265
|
signal: this.createRequestAbortSignal(req, res),
|
|
1267
1266
|
});
|
|
1268
|
-
await respondOfflineManifestStream(res, result,
|
|
1267
|
+
await respondOfflineManifestStream(res, result, currentCorrelationId());
|
|
1269
1268
|
return;
|
|
1270
1269
|
}
|
|
1271
1270
|
|
|
@@ -3294,7 +3293,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
3294
3293
|
const raw = req.headers["mcp-session-id"];
|
|
3295
3294
|
return typeof raw === "string" ? raw.trim() : undefined;
|
|
3296
3295
|
})();
|
|
3297
|
-
const mcpCorrelationId =
|
|
3296
|
+
const mcpCorrelationId = currentCorrelationId() ?? randomUUID();
|
|
3298
3297
|
const requestIdentity = this.resolveRequestIdentity(req);
|
|
3299
3298
|
// Per-token namespace enforcement on the MCP dispatch path (issue #1850
|
|
3300
3299
|
// finding 1): MCP `tools/call` previously never applied the namespace
|
|
@@ -3391,7 +3390,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
3391
3390
|
res.statusCode = status;
|
|
3392
3391
|
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
3393
3392
|
res.setHeader("content-length", String(Buffer.byteLength(body)));
|
|
3394
|
-
const cid =
|
|
3393
|
+
const cid = currentCorrelationId();
|
|
3395
3394
|
if (cid) {
|
|
3396
3395
|
res.setHeader("x-request-id", cid);
|
|
3397
3396
|
}
|
|
@@ -3410,7 +3409,7 @@ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
|
|
|
3410
3409
|
for (const [key, value] of Object.entries(headers)) {
|
|
3411
3410
|
res.setHeader(key, value);
|
|
3412
3411
|
}
|
|
3413
|
-
const cid =
|
|
3412
|
+
const cid = currentCorrelationId();
|
|
3414
3413
|
if (cid) {
|
|
3415
3414
|
res.setHeader("x-request-id", cid);
|
|
3416
3415
|
}
|
|
@@ -37,6 +37,7 @@ import { forceFlushPreemptCall } from "./access-extraction-force-flush-preempt.j
|
|
|
37
37
|
import { ObserveTranscriptPersister, observeTranscriptSessionKey } from "./access-observe-transcript.js";
|
|
38
38
|
import { createObserveStageTimer } from "./access-observe-stage-timing.js";
|
|
39
39
|
import { archiveObservedTurns } from "./access-observe-lcm-archive.js";
|
|
40
|
+
import { scopeObserveBufferAdmissionIdempotencyKey } from "./buffer-admission-idempotency.js";
|
|
40
41
|
import { recordObserveObjectiveState } from "./access-observe-objective-state.js";
|
|
41
42
|
import { FileCalendarSource, buildBriefing, parseBriefingFocus, parseBriefingWindow } from "./briefing.js";
|
|
42
43
|
import {
|
|
@@ -878,6 +879,15 @@ export class AccessObserveWriteSurface {
|
|
|
878
879
|
codingContext: this.deps.orchestrator.getCodingContextForSession(request.sessionKey) ?? undefined,
|
|
879
880
|
abortSignal: observeAbortController.signal,
|
|
880
881
|
};
|
|
882
|
+
const clientIdempotencyKey = request.idempotencyKey?.trim();
|
|
883
|
+
if (clientIdempotencyKey) {
|
|
884
|
+
ingestOptions.bufferAdmissionIdempotencyKey = scopeObserveBufferAdmissionIdempotencyKey({
|
|
885
|
+
sessionKey: request.sessionKey,
|
|
886
|
+
writeNamespace,
|
|
887
|
+
principal: principalOverride,
|
|
888
|
+
clientKey: clientIdempotencyKey,
|
|
889
|
+
});
|
|
890
|
+
}
|
|
881
891
|
if (request.authenticatedPrincipal !== undefined && request.authenticatedPrincipal.trim().length > 0) {
|
|
882
892
|
ingestOptions.sessionOwnerPrincipal = request.authenticatedPrincipal.trim();
|
|
883
893
|
}
|
package/src/access-service.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
} from "./access-health-types.js";
|
|
17
17
|
import { AccessIdempotencyStore, hashAccessIdempotencyPayload } from "./access-idempotency.js";
|
|
18
18
|
import { type RecallCoordinatorHost, type RecallExecResult, coordinateRecall } from "./access-recall-concurrency.js";
|
|
19
|
+
import { recordRecallAttempt } from "./recall-attempt-timing.js";
|
|
19
20
|
import { enforceNamespaceAllowList, tokenCapabilityStore } from "./access-token-capabilities.js";
|
|
20
21
|
import {
|
|
21
22
|
resolveCompressionCapabilities,
|
|
@@ -2677,7 +2678,8 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
|
|
|
2677
2678
|
}
|
|
2678
2679
|
|
|
2679
2680
|
private async executeRecall(request: EngramAccessRecallRequest): Promise<RecallExecResult> {
|
|
2680
|
-
return this.
|
|
2681
|
+
return recordRecallAttempt(this.orchestrator.config, request.abortSignal, () =>
|
|
2682
|
+
this.accessRecallSurface.executeRecall(request));
|
|
2681
2683
|
}
|
|
2682
2684
|
|
|
2683
2685
|
async recallExplain(request: EngramAccessRecallExplainRequest = {}): Promise<EngramAccessRecallExplainResponse> {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Bounded multi-session turn admission (#3368 split from buffer.ts). */
|
|
2
|
+
|
|
3
|
+
import { selectEvictedBufferKeys } from "./buffer-eviction.js";
|
|
4
|
+
import {
|
|
5
|
+
hasBufferedAdmissionIdempotencyKey,
|
|
6
|
+
recordBufferedAdmissionIdempotencyKey,
|
|
7
|
+
} from "./buffer-admission-idempotency.js";
|
|
8
|
+
import { refuseOverCapBatch, resolveMaxTurnsPerSession } from "./buffer-session-cap.js";
|
|
9
|
+
import type { BufferSessionPersistence } from "./buffer-persistence.js";
|
|
10
|
+
import type { BufferIngressCounters } from "./buffer-ingress-counters.js";
|
|
11
|
+
import type { AddTurnMutationResult, AddTurnOutcome } from "./buffer-types.js";
|
|
12
|
+
import { EVICTION_HOOKS } from "./buffer-turn-helpers.js";
|
|
13
|
+
import type { BufferEntryState, BufferState, BufferTurn, PluginConfig } from "./types.js";
|
|
14
|
+
|
|
15
|
+
export type AddTurnsBoundedOutcome =
|
|
16
|
+
| Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }>
|
|
17
|
+
| null
|
|
18
|
+
| "duplicate";
|
|
19
|
+
|
|
20
|
+
export interface AddTurnsBoundedHost {
|
|
21
|
+
readonly config: PluginConfig;
|
|
22
|
+
readonly maxSessionEntries: number;
|
|
23
|
+
get state(): BufferState;
|
|
24
|
+
readonly persistence: BufferSessionPersistence;
|
|
25
|
+
readonly ingress: BufferIngressCounters;
|
|
26
|
+
enqueueMutation<T>(work: () => Promise<T>): Promise<T>;
|
|
27
|
+
loadUnlocked(): Promise<void>;
|
|
28
|
+
peekEntry(bufferKey: string): BufferEntryState | null;
|
|
29
|
+
recordTurnUnlocked(bufferKey: string, turn: BufferTurn): Promise<AddTurnMutationResult>;
|
|
30
|
+
completeAddTurnOutcome(
|
|
31
|
+
bufferKey: string,
|
|
32
|
+
turn: BufferTurn,
|
|
33
|
+
mutation: AddTurnMutationResult,
|
|
34
|
+
): Promise<AddTurnOutcome>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function addTurnsBoundedWithAdmissionKey(
|
|
38
|
+
host: AddTurnsBoundedHost,
|
|
39
|
+
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
40
|
+
admissionKey?: string,
|
|
41
|
+
): Promise<AddTurnsBoundedOutcome> {
|
|
42
|
+
const pending = await host.enqueueMutation(async () => {
|
|
43
|
+
await host.loadUnlocked();
|
|
44
|
+
if (admissionKey && hasBufferedAdmissionIdempotencyKey(host.state, admissionKey)) {
|
|
45
|
+
return "duplicate" as const;
|
|
46
|
+
}
|
|
47
|
+
const additions: Array<{ bufferKey: string; turn: BufferTurn }> = [];
|
|
48
|
+
for (const batch of batches) {
|
|
49
|
+
for (const turn of batch.turns) {
|
|
50
|
+
additions.push({ bufferKey: batch.bufferKey, turn });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (refuseOverCapBatch((key) => host.peekEntry(key) ?? null, batches, resolveMaxTurnsPerSession(host.config.bufferMaxTurnsPerSession))) {
|
|
55
|
+
return host.ingress.refuseAll(additions);
|
|
56
|
+
}
|
|
57
|
+
const entries = host.state.entries ?? {};
|
|
58
|
+
const newKeys = [
|
|
59
|
+
...new Set(
|
|
60
|
+
additions
|
|
61
|
+
.map(({ bufferKey }) => bufferKey)
|
|
62
|
+
.filter((bufferKey) => host.peekEntry(bufferKey) === null),
|
|
63
|
+
),
|
|
64
|
+
];
|
|
65
|
+
const count = Object.keys(entries).length;
|
|
66
|
+
const requiredEvictions = Math.max(0, count + newKeys.length - host.maxSessionEntries);
|
|
67
|
+
if (requiredEvictions > 0) {
|
|
68
|
+
const target = Math.max(0, host.maxSessionEntries - newKeys.length);
|
|
69
|
+
const evicted = selectEvictedBufferKeys(entries, newKeys, target, EVICTION_HOOKS);
|
|
70
|
+
if (newKeys.length > 0 && evicted.length < requiredEvictions) return host.ingress.refuseAll(additions);
|
|
71
|
+
for (const key of evicted) delete entries[key];
|
|
72
|
+
host.persistence.markEvicted(evicted);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const recorded: Array<{ bufferKey: string; turn: BufferTurn; mutation: AddTurnMutationResult }> = [];
|
|
76
|
+
for (const { bufferKey, turn } of additions) {
|
|
77
|
+
recorded.push({ bufferKey, turn, mutation: await host.recordTurnUnlocked(bufferKey, turn) });
|
|
78
|
+
}
|
|
79
|
+
if (admissionKey) {
|
|
80
|
+
recordBufferedAdmissionIdempotencyKey(host.state, admissionKey, recorded.length);
|
|
81
|
+
host.persistence.markAdmissionIdempotencyDirty();
|
|
82
|
+
}
|
|
83
|
+
return recorded;
|
|
84
|
+
});
|
|
85
|
+
if (pending === "duplicate") return "duplicate";
|
|
86
|
+
if (pending === null) return null;
|
|
87
|
+
|
|
88
|
+
const outcomes: Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }> = [];
|
|
89
|
+
for (const item of pending) {
|
|
90
|
+
outcomes.push({
|
|
91
|
+
bufferKey: item.bufferKey,
|
|
92
|
+
turn: item.turn,
|
|
93
|
+
outcome: await host.completeAddTurnOutcome(item.bufferKey, item.turn, item.mutation),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return outcomes;
|
|
97
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { mkdtemp } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
BUFFER_ADMISSION_IDEMPOTENCY_CAP,
|
|
10
|
+
recordBufferedAdmissionIdempotencyKey,
|
|
11
|
+
scopeObserveBufferAdmissionIdempotencyKey,
|
|
12
|
+
} from "./buffer-admission-idempotency.js";
|
|
13
|
+
import {
|
|
14
|
+
BUFFER_SESSION_DEFER_INTERVAL_MS,
|
|
15
|
+
BUFFER_SESSION_DEFER_MIN_BYTES,
|
|
16
|
+
BufferSessionPersistence,
|
|
17
|
+
} from "./buffer-persistence.js";
|
|
18
|
+
import { SmartBuffer } from "./buffer.js";
|
|
19
|
+
import type { BufferStorage } from "./buffer-persistence.js";
|
|
20
|
+
import { BufferSessionFiles } from "./storage/buffer-session-files.js";
|
|
21
|
+
import { TurnIngestionCoordinator, type TurnIngestionDeps } from "./orchestration/turn-ingestion.js";
|
|
22
|
+
|
|
23
|
+
function plainIo() {
|
|
24
|
+
return {
|
|
25
|
+
read: async (filePath: string) => readFileSync(filePath, "utf8"),
|
|
26
|
+
write: async (filePath: string, content: string) => {
|
|
27
|
+
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
28
|
+
writeFileSync(filePath, content);
|
|
29
|
+
},
|
|
30
|
+
append: async (filePath: string, content: string) => {
|
|
31
|
+
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
32
|
+
appendFileSync(filePath, content);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
import { ExtractionQueueCoordinator } from "./orchestration/extraction-queue-coordinator.js";
|
|
37
|
+
import { SessionObserverState } from "./session-observer-state.js";
|
|
38
|
+
import { TranscriptManager } from "./transcript.js";
|
|
39
|
+
import { parseConfig } from "./config.js";
|
|
40
|
+
import type { BufferEntryState, BufferState, BufferTurn, PluginConfig } from "./types.js";
|
|
41
|
+
import type { ReplayTurn } from "./replay/types.js";
|
|
42
|
+
|
|
43
|
+
class FakeStorage {
|
|
44
|
+
saved: BufferState | null = null;
|
|
45
|
+
async loadBuffer(): Promise<BufferState> {
|
|
46
|
+
return structuredClone(this.saved ?? { turns: [], lastExtractionAt: null, extractionCount: 0 });
|
|
47
|
+
}
|
|
48
|
+
async saveBuffer(state: BufferState): Promise<void> {
|
|
49
|
+
this.saved = structuredClone(state);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function makeConfig(memoryDir: string): PluginConfig {
|
|
54
|
+
return parseConfig({ memoryDir, bufferSaveDebounceMs: 0, bufferMaxSessions: 8, bufferMaxTurnsPerSession: 20 });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function turn(content: string, sessionKey = "s1"): BufferTurn {
|
|
58
|
+
return { role: "user", content, timestamp: "2026-11-19T00:00:00.000Z", sessionKey };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function depsFor(buffer: SmartBuffer, memoryDir: string): TurnIngestionDeps {
|
|
62
|
+
const unreachable = (n: string): never => { throw new Error(n); };
|
|
63
|
+
return {
|
|
64
|
+
buffer,
|
|
65
|
+
config: makeConfig(memoryDir),
|
|
66
|
+
bulkImportWriteNamespace: () => unreachable("bulkImportWriteNamespace"),
|
|
67
|
+
extractionQueueCoordinator: new ExtractionQueueCoordinator(),
|
|
68
|
+
getStorage: async () => unreachable("getStorage"),
|
|
69
|
+
heartbeatObserverChains: new Map(),
|
|
70
|
+
lcmEngine: null,
|
|
71
|
+
passiveCorrectionDedup: new Set(),
|
|
72
|
+
passiveCorrectionService: () => unreachable("passiveCorrectionService"),
|
|
73
|
+
passiveCorrectionTelemetry: { detected: 0, queued: 0, autoApplied: 0, suppressedReasonCounts: {} },
|
|
74
|
+
queueBufferedExtraction: async () => {},
|
|
75
|
+
resolveMemoryIdOrHandle: (ref) => ref,
|
|
76
|
+
runExtraction: () => unreachable("runExtraction"),
|
|
77
|
+
sessionObserver: new SessionObserverState({ memoryDir, debounceMs: 0, bands: [] }),
|
|
78
|
+
shouldQueueExtraction: () => false,
|
|
79
|
+
transcript: new TranscriptManager(makeConfig(memoryDir)),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
test("#3368 retry with same admission key does not duplicate buffered turns", async () => {
|
|
84
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "buf-idem-"));
|
|
85
|
+
const storage = new FakeStorage();
|
|
86
|
+
const buffer = new SmartBuffer(makeConfig(memoryDir), storage, null, { countIngress: false });
|
|
87
|
+
const coordinator = new TurnIngestionCoordinator(depsFor(buffer, memoryDir));
|
|
88
|
+
const replay: ReplayTurn = {
|
|
89
|
+
source: "openclaw",
|
|
90
|
+
sessionKey: "s1",
|
|
91
|
+
role: "user",
|
|
92
|
+
content: "hello durable",
|
|
93
|
+
timestamp: "2026-11-19T00:00:00.000Z",
|
|
94
|
+
};
|
|
95
|
+
const opts = {
|
|
96
|
+
archiveLcm: false,
|
|
97
|
+
extractionMode: "buffered" as const,
|
|
98
|
+
writeNamespaceOverride: "default",
|
|
99
|
+
bufferAdmissionIdempotencyKey: "obs-3368-key",
|
|
100
|
+
};
|
|
101
|
+
await coordinator.ingestReplayBatch([replay], opts);
|
|
102
|
+
const afterFirst = storage.saved?.entries?.s1?.turns.length ?? 0;
|
|
103
|
+
assert.equal(afterFirst, 1);
|
|
104
|
+
await coordinator.ingestReplayBatch([replay], opts);
|
|
105
|
+
const afterSecond = storage.saved?.entries?.s1?.turns.length ?? 0;
|
|
106
|
+
assert.equal(afterSecond, 1);
|
|
107
|
+
assert.equal(storage.saved?.admissionIdempotency?.["obs-3368-key"], 1);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("#3368 different keys keep identical content", async () => {
|
|
111
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "buf-idem-2-"));
|
|
112
|
+
const storage = new FakeStorage();
|
|
113
|
+
const buffer = new SmartBuffer(makeConfig(memoryDir), storage, null, { countIngress: false });
|
|
114
|
+
const coordinator = new TurnIngestionCoordinator(depsFor(buffer, memoryDir));
|
|
115
|
+
const replay: ReplayTurn = {
|
|
116
|
+
source: "openclaw",
|
|
117
|
+
sessionKey: "s1",
|
|
118
|
+
role: "user",
|
|
119
|
+
content: "same words",
|
|
120
|
+
timestamp: "2026-11-19T00:00:00.000Z",
|
|
121
|
+
};
|
|
122
|
+
const base = { archiveLcm: false, extractionMode: "buffered" as const, writeNamespaceOverride: "default" };
|
|
123
|
+
await coordinator.ingestReplayBatch([replay], { ...base, bufferAdmissionIdempotencyKey: "key-a" });
|
|
124
|
+
await coordinator.ingestReplayBatch([replay], { ...base, bufferAdmissionIdempotencyKey: "key-b" });
|
|
125
|
+
assert.equal(storage.saved?.entries?.s1?.turns.length, 2);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("#3368 scoped client keys do not dedupe across namespaces", async () => {
|
|
129
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "buf-idem-scope-"));
|
|
130
|
+
const storage = new FakeStorage();
|
|
131
|
+
const buffer = new SmartBuffer(makeConfig(memoryDir), storage, null, { countIngress: false });
|
|
132
|
+
const coordinator = new TurnIngestionCoordinator(depsFor(buffer, memoryDir));
|
|
133
|
+
const replay: ReplayTurn = {
|
|
134
|
+
source: "openclaw",
|
|
135
|
+
sessionKey: "s1",
|
|
136
|
+
role: "user",
|
|
137
|
+
content: "scoped",
|
|
138
|
+
timestamp: "2026-11-19T00:00:00.000Z",
|
|
139
|
+
};
|
|
140
|
+
const base = { archiveLcm: false, extractionMode: "buffered" as const, bufferAdmissionIdempotencyKey: "client-key" };
|
|
141
|
+
const keyA = scopeObserveBufferAdmissionIdempotencyKey({
|
|
142
|
+
sessionKey: "s1",
|
|
143
|
+
writeNamespace: "ns-a",
|
|
144
|
+
clientKey: "client-key",
|
|
145
|
+
});
|
|
146
|
+
const keyB = scopeObserveBufferAdmissionIdempotencyKey({
|
|
147
|
+
sessionKey: "s1",
|
|
148
|
+
writeNamespace: "ns-b",
|
|
149
|
+
clientKey: "client-key",
|
|
150
|
+
});
|
|
151
|
+
await coordinator.ingestReplayBatch([replay], { ...base, writeNamespaceOverride: "ns-a", bufferAdmissionIdempotencyKey: keyA });
|
|
152
|
+
await coordinator.ingestReplayBatch([replay], { ...base, writeNamespaceOverride: "ns-b", bufferAdmissionIdempotencyKey: keyB });
|
|
153
|
+
assert.equal(storage.saved?.entries?.s1?.turns.length, 2);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("#3368 observe idempotency keys survive BufferSessionFiles restart", async () => {
|
|
157
|
+
const stateDir = await mkdtemp(path.join(os.tmpdir(), "buf-idem-files-"));
|
|
158
|
+
const files = new BufferSessionFiles(stateDir, plainIo());
|
|
159
|
+
const storage: BufferStorage = {
|
|
160
|
+
loadBuffer: () => files.load(),
|
|
161
|
+
saveBuffer: (state) => files.reconcile(state),
|
|
162
|
+
saveBufferSession: (key, entry) => files.save(key, entry),
|
|
163
|
+
saveBufferAdmissionIdempotency: (state) => files.saveAdmissionIdempotency(state),
|
|
164
|
+
deleteBufferSession: (key) => files.remove(key),
|
|
165
|
+
};
|
|
166
|
+
const memoryDir = stateDir;
|
|
167
|
+
const buffer = new SmartBuffer(makeConfig(memoryDir), storage, null, { countIngress: false });
|
|
168
|
+
const coordinator = new TurnIngestionCoordinator(depsFor(buffer, memoryDir));
|
|
169
|
+
const replay: ReplayTurn = {
|
|
170
|
+
source: "openclaw",
|
|
171
|
+
sessionKey: "s1",
|
|
172
|
+
role: "user",
|
|
173
|
+
content: "durable",
|
|
174
|
+
timestamp: "2026-11-19T00:00:00.000Z",
|
|
175
|
+
};
|
|
176
|
+
const idemKey = "obs-restart-key";
|
|
177
|
+
await coordinator.ingestReplayBatch([
|
|
178
|
+
replay,
|
|
179
|
+
], {
|
|
180
|
+
archiveLcm: false,
|
|
181
|
+
extractionMode: "buffered",
|
|
182
|
+
writeNamespaceOverride: "default",
|
|
183
|
+
bufferAdmissionIdempotencyKey: idemKey,
|
|
184
|
+
});
|
|
185
|
+
const bufferAfterRestart = new SmartBuffer(makeConfig(memoryDir), storage, null, { countIngress: false });
|
|
186
|
+
await bufferAfterRestart.load();
|
|
187
|
+
const coordinatorAfterRestart = new TurnIngestionCoordinator(depsFor(bufferAfterRestart, memoryDir));
|
|
188
|
+
await coordinatorAfterRestart.ingestReplayBatch([replay], {
|
|
189
|
+
archiveLcm: false,
|
|
190
|
+
extractionMode: "buffered",
|
|
191
|
+
writeNamespaceOverride: "default",
|
|
192
|
+
bufferAdmissionIdempotencyKey: idemKey,
|
|
193
|
+
});
|
|
194
|
+
const reloaded = await files.load();
|
|
195
|
+
assert.equal(reloaded.entries?.s1?.turns.length, 1);
|
|
196
|
+
assert.equal(reloaded.admissionIdempotency?.[idemKey], 1);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("#3368 restored idempotency map without order participates in eviction cap", () => {
|
|
200
|
+
const state: BufferState = {
|
|
201
|
+
turns: [],
|
|
202
|
+
lastExtractionAt: null,
|
|
203
|
+
extractionCount: 0,
|
|
204
|
+
admissionIdempotency: { restored: 1 },
|
|
205
|
+
};
|
|
206
|
+
for (let i = 0; i < BUFFER_ADMISSION_IDEMPOTENCY_CAP; i++) {
|
|
207
|
+
recordBufferedAdmissionIdempotencyKey(state, `k${i}`, 1);
|
|
208
|
+
}
|
|
209
|
+
assert.equal(Object.keys(state.admissionIdempotency!).length, BUFFER_ADMISSION_IDEMPOTENCY_CAP);
|
|
210
|
+
assert.equal(state.admissionIdempotency!.restored, undefined);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("#3368 incomplete order array still evicts orphan map keys", () => {
|
|
214
|
+
const state: BufferState = {
|
|
215
|
+
turns: [],
|
|
216
|
+
lastExtractionAt: null,
|
|
217
|
+
extractionCount: 0,
|
|
218
|
+
admissionIdempotency: { restored: 1, orphan: 1 },
|
|
219
|
+
admissionIdempotencyOrder: ["stale-only"],
|
|
220
|
+
};
|
|
221
|
+
for (let i = 0; i < BUFFER_ADMISSION_IDEMPOTENCY_CAP; i++) {
|
|
222
|
+
recordBufferedAdmissionIdempotencyKey(state, `k${i}`, 1);
|
|
223
|
+
}
|
|
224
|
+
assert.equal(Object.keys(state.admissionIdempotency!).length, BUFFER_ADMISSION_IDEMPOTENCY_CAP);
|
|
225
|
+
assert.equal(state.admissionIdempotency!.restored, undefined);
|
|
226
|
+
assert.equal(state.admissionIdempotency!.orphan, undefined);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("#3368 admission idempotency is not persisted while a session write is deferred", async () => {
|
|
230
|
+
class DeferAdmissionStorage {
|
|
231
|
+
readonly writes = new Map<string, number>();
|
|
232
|
+
admissionPersistSaves = 0;
|
|
233
|
+
private initial: BufferState = { turns: [], lastExtractionAt: null, extractionCount: 0 };
|
|
234
|
+
|
|
235
|
+
async loadBuffer(): Promise<BufferState> {
|
|
236
|
+
return structuredClone(this.initial);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async saveBuffer(state: BufferState): Promise<void> {
|
|
240
|
+
this.initial = structuredClone(state);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async saveBufferSession(key: string, entry: BufferEntryState): Promise<void> {
|
|
244
|
+
this.writes.set(key, (this.writes.get(key) ?? 0) + 1);
|
|
245
|
+
void entry;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async saveBufferAdmissionIdempotency(state: BufferState): Promise<void> {
|
|
249
|
+
this.admissionPersistSaves++;
|
|
250
|
+
this.initial = { ...this.initial, ...structuredClone(state) };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async deleteBufferSession(): Promise<void> {}
|
|
254
|
+
|
|
255
|
+
isBufferSessionClaimed(): boolean {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const bigEntry = (): BufferEntryState => ({
|
|
261
|
+
turns: [
|
|
262
|
+
{
|
|
263
|
+
role: "user",
|
|
264
|
+
content: "x".repeat(BUFFER_SESSION_DEFER_MIN_BYTES),
|
|
265
|
+
timestamp: "2026-11-19T00:00:00.000Z",
|
|
266
|
+
sessionKey: "big",
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
lastExtractionAt: null,
|
|
270
|
+
extractionCount: 0,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const storage = new DeferAdmissionStorage();
|
|
274
|
+
const entries = new Map<string, BufferEntryState>([["big", bigEntry()]]);
|
|
275
|
+
const peek = (key: string) => entries.get(key);
|
|
276
|
+
const persistence = new BufferSessionPersistence();
|
|
277
|
+
let now = 1_000;
|
|
278
|
+
const clock = () => now;
|
|
279
|
+
const state: BufferState = {
|
|
280
|
+
turns: [],
|
|
281
|
+
lastExtractionAt: null,
|
|
282
|
+
extractionCount: 0,
|
|
283
|
+
admissionIdempotency: { "obs-key": 1 },
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
persistence.markDirty("big");
|
|
287
|
+
await persistence.persist(storage, state, peek, undefined, { now: clock, allowDeferral: true });
|
|
288
|
+
assert.equal(storage.writes.get("big"), 1);
|
|
289
|
+
|
|
290
|
+
persistence.markDirty("big");
|
|
291
|
+
persistence.markAdmissionIdempotencyDirty();
|
|
292
|
+
now += 1_000;
|
|
293
|
+
await persistence.persist(storage, state, peek, undefined, { now: clock, allowDeferral: true });
|
|
294
|
+
assert.equal(storage.writes.get("big"), 1, "large session rewrite deferred");
|
|
295
|
+
assert.equal(storage.admissionPersistSaves, 0, "idempotency must not land ahead of deferred turns");
|
|
296
|
+
assert.equal(persistence.hasPending(), true);
|
|
297
|
+
});
|