@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
|
@@ -42,6 +42,7 @@ import { TranscriptManager } from "../transcript.js";
|
|
|
42
42
|
import type { BufferTurn, PluginConfig, SourceConnectorProvenance } from "../types.js";
|
|
43
43
|
|
|
44
44
|
import { groupTurnsByExtractionScope, bufferTurnsEqual } from "../buffer-turn-helpers.js";
|
|
45
|
+
import { ingestReplayBatchBuffered } from "./turn-ingestion-buffered.js";
|
|
45
46
|
import { ExtractionDrain } from "./extraction-drain.js";
|
|
46
47
|
import { skipClaimedSession } from "./buffer-drain-gate.js";
|
|
47
48
|
import { queueBufferedCaptureScopeGroups, type CaptureScopeGroupQueueOptions, type ExtractionTaskExecutionContext } from "./extraction-task-queueing.js";
|
|
@@ -281,6 +282,8 @@ export class TurnIngestionCoordinator {
|
|
|
281
282
|
extractionMode?: "immediate" | "buffered";
|
|
282
283
|
/** #3251: invoked per trigger-queued extraction promise (buffered mode). */
|
|
283
284
|
onExtractionQueued?: (extraction: Promise<void>) => void;
|
|
285
|
+
/** #3368: durable observe retry — skip buffer add when key already admitted. */
|
|
286
|
+
bufferAdmissionIdempotencyKey?: string;
|
|
284
287
|
/**
|
|
285
288
|
* #3251: the ALREADY-resolved native coding context for this capture
|
|
286
289
|
* (buffered mode). Pinned on the durable turns so drains re-resolve
|
|
@@ -322,7 +325,7 @@ export class TurnIngestionCoordinator {
|
|
|
322
325
|
// applies to extraction, never to durable admission. The abort pre-check
|
|
323
326
|
// below guards only the immediate (forced-queue) path.
|
|
324
327
|
if (options.extractionMode === "buffered") {
|
|
325
|
-
return this.
|
|
328
|
+
return ingestReplayBatchBuffered(this.deps, bySession, options);
|
|
326
329
|
}
|
|
327
330
|
|
|
328
331
|
if (options.abortSignal?.aborted) {
|
|
@@ -404,83 +407,6 @@ export class TurnIngestionCoordinator {
|
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
409
|
|
|
407
|
-
/** #3251 buffered capture: durable scope-pinned admission; await settles at durability. */
|
|
408
|
-
private async ingestReplayBatchBuffered(
|
|
409
|
-
bySession: Map<string, BufferTurn[]>,
|
|
410
|
-
options: {
|
|
411
|
-
deadlineMs?: number;
|
|
412
|
-
archiveLcm?: boolean;
|
|
413
|
-
abortSignal?: AbortSignal;
|
|
414
|
-
writeNamespaceOverride?: string;
|
|
415
|
-
principalOverride?: string;
|
|
416
|
-
scopeProfileWritePlan?: ResolvedScopeProfilePlan | null;
|
|
417
|
-
codingContext?: import("../types.js").CodingContext;
|
|
418
|
-
onExtractionQueued?: (extraction: Promise<void>) => void;
|
|
419
|
-
},
|
|
420
|
-
): Promise<void> {
|
|
421
|
-
// #3251: resolve the original actual storage target ONCE at method entry,
|
|
422
|
-
// BEFORE any LCM archival or buffer admission. Explicit override is
|
|
423
|
-
// authoritative; otherwise namespaces OFF → the collapsed default store;
|
|
424
|
-
// namespaces ON → the plan's writeNamespace. Reject before any side
|
|
425
|
-
// effect if neither is available.
|
|
426
|
-
const resolvedWriteTarget =
|
|
427
|
-
options.writeNamespaceOverride ??
|
|
428
|
-
(resolveNamespaceCapabilities(this.deps.config).namespaces === true
|
|
429
|
-
? options.scopeProfileWritePlan?.writeNamespace
|
|
430
|
-
: this.deps.config.defaultNamespace);
|
|
431
|
-
if (!resolvedWriteTarget) {
|
|
432
|
-
throw new StorageTargetRequiredError(
|
|
433
|
-
"accepted capture requires an explicit storage target (writeNamespaceOverride or scopeProfileWritePlan.writeNamespace)",
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
const pin = (turn: BufferTurn): BufferTurn => {
|
|
437
|
-
const pinned: BufferTurn = { ...turn, acceptedCapture: true, writeNamespaceOverride: resolvedWriteTarget };
|
|
438
|
-
if (options.codingContext) pinned.codingContext = options.codingContext;
|
|
439
|
-
if (options.principalOverride) pinned.principalOverride = options.principalOverride;
|
|
440
|
-
if (options.scopeProfileWritePlan) pinned.scopeProfileWritePlan = options.scopeProfileWritePlan;
|
|
441
|
-
return pinned;
|
|
442
|
-
};
|
|
443
|
-
const batches = [...bySession].map(([bufferKey, sessionTurns]) => ({ bufferKey, turns: sessionTurns.map(pin) }));
|
|
444
|
-
const outcomes = await this.deps.buffer.addTurnsBounded(batches);
|
|
445
|
-
if (outcomes === null) {
|
|
446
|
-
const refusedKey = batches.find((batch) => batch.turns.length > 0)?.bufferKey ?? "unknown";
|
|
447
|
-
throw new ReplayAdmissionRefusedError(
|
|
448
|
-
`durable observe capture refused: extraction buffer at entry capacity for batch containing ${refusedKey}`,
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// All requested session keys were capacity-admitted together before any
|
|
453
|
-
// turn was saved. There is no retry identity: a repeat after a crash that
|
|
454
|
-
// persisted only a prefix duplicates that prefix, as on main.
|
|
455
|
-
await this.deps.buffer.flushPendingSave({ throwOnFailure: true });
|
|
456
|
-
|
|
457
|
-
if (options.archiveLcm !== false && this.deps.lcmEngine?.enabled) {
|
|
458
|
-
for (const [bufferKey, sessionTurns] of bySession) {
|
|
459
|
-
await this.deps.lcmEngine.observeMessages(
|
|
460
|
-
bufferKey,
|
|
461
|
-
sessionTurns.map((turn) => ({
|
|
462
|
-
role: turn.role,
|
|
463
|
-
content: turn.content,
|
|
464
|
-
parts: turn.parts,
|
|
465
|
-
rawContent: turn.rawContent,
|
|
466
|
-
sourceFormat: turn.sourceFormat,
|
|
467
|
-
})),
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
for (const { bufferKey, outcome } of outcomes) {
|
|
473
|
-
if (outcome.decision !== "keep_buffering" && outcome.extractionTurns) {
|
|
474
|
-
queueBufferedCaptureScopeGroups(
|
|
475
|
-
this.deps.queueBufferedExtraction,
|
|
476
|
-
outcome.extractionTurns,
|
|
477
|
-
bufferKey,
|
|
478
|
-
options,
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
410
|
/**
|
|
485
411
|
* Ingest a batch of bulk-import turns (#460). Like ingestReplayBatch, this
|
|
486
412
|
* normalizes user/assistant turns into the extraction buffer and awaits
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
|
|
4
|
+
import { isAbortError } from "./abort-error.js";
|
|
5
|
+
import { currentCorrelationId } from "./access-correlation.js";
|
|
6
|
+
import {
|
|
7
|
+
recordRecallTiming,
|
|
8
|
+
type RecallTimingEmission,
|
|
9
|
+
type RecallTimingOutcome,
|
|
10
|
+
} from "./recall-timings.js";
|
|
11
|
+
import type { PluginConfig } from "./types.js";
|
|
12
|
+
|
|
13
|
+
// Receives the recall pipeline's per-phase timing payload for the attempt in
|
|
14
|
+
// flight, so the attempt's single record (requestId + outcome + httpTotalMs +
|
|
15
|
+
// phases) is pushed once, from recordRecallAttempt's `finally`. Scoped per
|
|
16
|
+
// attempt via AsyncLocalStorage: no recall option or signature carries it.
|
|
17
|
+
const attemptSinkStore = new AsyncLocalStorage<(payload: RecallTimingEmission) => void>();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Pipeline side. Inside a recorded attempt the payload folds into that
|
|
21
|
+
* attempt's record; outside one (x-ray, daemon hooks, direct orchestrator
|
|
22
|
+
* callers) it keeps the legacy success-only push.
|
|
23
|
+
*/
|
|
24
|
+
export function emitRecallTiming(config: PluginConfig, payload: RecallTimingEmission): void {
|
|
25
|
+
const sink = attemptSinkStore.getStore();
|
|
26
|
+
if (sink) {
|
|
27
|
+
sink(payload);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
recordRecallTiming(config, payload);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Run one executed recall and leave exactly one timing record for it, pushed
|
|
35
|
+
* in `finally` so denials, disconnects and assembly failures carry the same
|
|
36
|
+
* trail as successes. `requestId` is the HTTP request's server-generated
|
|
37
|
+
* correlation id (x-request-id); outside HTTP dispatch it falls back to a
|
|
38
|
+
* generated `local:<uuid>` id in the same field, so a record says whether it
|
|
39
|
+
* has an HTTP request behind it. Never derived from client input.
|
|
40
|
+
*/
|
|
41
|
+
export async function recordRecallAttempt<T>(
|
|
42
|
+
config: PluginConfig,
|
|
43
|
+
abortSignal: AbortSignal | undefined,
|
|
44
|
+
run: () => Promise<T>,
|
|
45
|
+
): Promise<T> {
|
|
46
|
+
const requestId = currentCorrelationId() ?? `local:${randomUUID()}`;
|
|
47
|
+
const startedMs = performance.now();
|
|
48
|
+
const emitted: RecallTimingEmission[] = [];
|
|
49
|
+
let failure: { abortError: boolean } | undefined;
|
|
50
|
+
try {
|
|
51
|
+
return await attemptSinkStore.run((payload) => {
|
|
52
|
+
emitted.push(payload);
|
|
53
|
+
}, run);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
failure = { abortError: isAbortError(err) };
|
|
56
|
+
throw err;
|
|
57
|
+
} finally {
|
|
58
|
+
const phases = emitted.at(-1);
|
|
59
|
+
// aborted: the request/flight signal fired, or an abort error was thrown
|
|
60
|
+
// (the pipeline's soft abort returns normally with the signal already
|
|
61
|
+
// aborted). error: any other throw, or a normal return from a pipeline
|
|
62
|
+
// that never reached its timing emit (the entry coordinator swallows
|
|
63
|
+
// outer timeouts, init-gate aborts and internal failures into a degraded
|
|
64
|
+
// context). ok: the pipeline ran to completion.
|
|
65
|
+
const outcome: RecallTimingOutcome =
|
|
66
|
+
abortSignal?.aborted === true || failure?.abortError === true
|
|
67
|
+
? "aborted"
|
|
68
|
+
: failure !== undefined || phases === undefined
|
|
69
|
+
? "error"
|
|
70
|
+
: "ok";
|
|
71
|
+
recordRecallTiming(config, {
|
|
72
|
+
...phases,
|
|
73
|
+
requestId,
|
|
74
|
+
outcome,
|
|
75
|
+
httpTotalMs: performance.now() - startedMs,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type DeferredEnrichmentOutcome<T> =
|
|
2
|
+
| { status: "resolved"; value: T }
|
|
3
|
+
| { status: "rejected"; error: unknown };
|
|
4
|
+
|
|
5
|
+
export type ObservedDeferredEnrichmentPromise<T> =
|
|
6
|
+
Promise<DeferredEnrichmentOutcome<T>> & {
|
|
7
|
+
getSettledOutcome: () => DeferredEnrichmentOutcome<T> | undefined;
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Cancelable child abort signal owned by one enrichment promise. */
|
|
12
|
+
export interface EnrichmentAbortHandle {
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
cancel: () => void;
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Child abort controller that follows `parentSignal`; `dispose` detaches the listener. */
|
|
19
|
+
export function createEnrichmentAbortHandle(parentSignal?: AbortSignal): EnrichmentAbortHandle {
|
|
20
|
+
const controller = new AbortController();
|
|
21
|
+
const onAbort = () => controller.abort();
|
|
22
|
+
if (parentSignal?.aborted) {
|
|
23
|
+
controller.abort();
|
|
24
|
+
} else if (parentSignal) {
|
|
25
|
+
parentSignal.addEventListener("abort", onAbort, { once: true });
|
|
26
|
+
}
|
|
27
|
+
let disposed = false;
|
|
28
|
+
const dispose = () => {
|
|
29
|
+
if (disposed) return;
|
|
30
|
+
disposed = true;
|
|
31
|
+
parentSignal?.removeEventListener("abort", onAbort);
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
signal: controller.signal,
|
|
35
|
+
cancel: () => {
|
|
36
|
+
controller.abort();
|
|
37
|
+
dispose();
|
|
38
|
+
},
|
|
39
|
+
dispose,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Never-rejecting view of `promise` that also exposes its settled outcome and a cancel hook. */
|
|
44
|
+
export function observeEnrichmentPromise<T>(
|
|
45
|
+
promise: Promise<T>,
|
|
46
|
+
cancel: () => void = () => {},
|
|
47
|
+
): ObservedDeferredEnrichmentPromise<T> {
|
|
48
|
+
let settledOutcome: DeferredEnrichmentOutcome<T> | undefined;
|
|
49
|
+
const settled = promise
|
|
50
|
+
.then<DeferredEnrichmentOutcome<T>, DeferredEnrichmentOutcome<T>>(
|
|
51
|
+
(value) => ({ status: "resolved", value }),
|
|
52
|
+
(error) => ({ status: "rejected", error }),
|
|
53
|
+
)
|
|
54
|
+
.then((outcome) => {
|
|
55
|
+
settledOutcome = outcome;
|
|
56
|
+
return outcome;
|
|
57
|
+
});
|
|
58
|
+
return Object.assign(settled, {
|
|
59
|
+
getSettledOutcome: () => settledOutcome,
|
|
60
|
+
cancel,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase-2 await timing fields for the recall-timings attempt record (issue
|
|
3
|
+
* #1830). Each instrumented phase-2 await contributes three optionally-named
|
|
4
|
+
* fields: `phase2<Name>Ms` (monotonic elapsed of the await itself),
|
|
5
|
+
* `phase2<Name>Status` (ok | timeout | error | skipped), and — for promises
|
|
6
|
+
* started earlier in phase 1 and awaited later — `phase2<Name>TotalMs`
|
|
7
|
+
* (monotonic time since the promise was created). The await fields are
|
|
8
|
+
* OVERLAPPING, not additive: awaits of promises started earlier include time
|
|
9
|
+
* spent doing other phase-2 work.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type Phase2AwaitStatus = "ok" | "timeout" | "error" | "skipped";
|
|
13
|
+
|
|
14
|
+
export const PHASE2_AWAIT_NAMES = [
|
|
15
|
+
"Harmonic",
|
|
16
|
+
"GraphSnapshot",
|
|
17
|
+
"IntentSnapshot",
|
|
18
|
+
"Compression",
|
|
19
|
+
"Compounding",
|
|
20
|
+
"Questions",
|
|
21
|
+
"Prefilter",
|
|
22
|
+
] as const;
|
|
23
|
+
|
|
24
|
+
export type Phase2AwaitName = (typeof PHASE2_AWAIT_NAMES)[number];
|
|
25
|
+
|
|
26
|
+
/** Awaits of promises started earlier in phase 1; their await time overlaps earlier work. */
|
|
27
|
+
export const PHASE2_AWAIT_TOTAL_NAMES: readonly Phase2AwaitName[] = [
|
|
28
|
+
"Harmonic",
|
|
29
|
+
"Compounding",
|
|
30
|
+
"Prefilter",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const PHASE2_AWAIT_STATUSES: readonly Phase2AwaitStatus[] = [
|
|
34
|
+
"ok",
|
|
35
|
+
"timeout",
|
|
36
|
+
"error",
|
|
37
|
+
"skipped",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export function phase2MsField(name: Phase2AwaitName): string {
|
|
41
|
+
return `phase2${name}Ms`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function phase2StatusField(name: Phase2AwaitName): string {
|
|
45
|
+
return `phase2${name}Status`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function phase2TotalField(name: Phase2AwaitName): string {
|
|
49
|
+
return `phase2${name}TotalMs`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Phase2AwaitTiming {
|
|
53
|
+
status: Phase2AwaitStatus;
|
|
54
|
+
/** Monotonic elapsed ms of the await itself (measured at the await site). */
|
|
55
|
+
ms: number;
|
|
56
|
+
/** Monotonic ms since the awaited promise was created (started-earlier awaits only). */
|
|
57
|
+
totalMs?: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Fold one await's timing into the recall pipeline's flat timing payload. Values stay string-encoded ("12ms") so the recall-timings sanitizer parses them like every other phase. */
|
|
61
|
+
export function recordPhase2Await(
|
|
62
|
+
sink: Record<string, string>,
|
|
63
|
+
name: Phase2AwaitName,
|
|
64
|
+
timing: Phase2AwaitTiming,
|
|
65
|
+
): void {
|
|
66
|
+
sink[phase2MsField(name)] = `${Math.max(0, Math.round(timing.ms))}ms`;
|
|
67
|
+
sink[phase2StatusField(name)] = timing.status;
|
|
68
|
+
if (timing.totalMs !== undefined) {
|
|
69
|
+
sink[phase2TotalField(name)] = `${Math.max(0, Math.round(timing.totalMs))}ms`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Phase2Timer {
|
|
74
|
+
/** Time one direct phase-2 await. A throw is re-thrown unchanged after its status is recorded. */
|
|
75
|
+
step<T>(name: Phase2AwaitName, run: () => Promise<T>): Promise<T>;
|
|
76
|
+
/** Record a phase-2 await that did not run (section disabled): 0 ms, status skipped. */
|
|
77
|
+
skipped(name: Phase2AwaitName): void;
|
|
78
|
+
/**
|
|
79
|
+
* Time one await of an enrichment promise started earlier (`startedMs` is its
|
|
80
|
+
* performance.now() creation time). `run` reports the await's own outcome
|
|
81
|
+
* through `onStatus`; `isSkipped` is read after the await so a section that
|
|
82
|
+
* skipped itself (disabled / limit 0) is recorded as skipped, not ok.
|
|
83
|
+
*/
|
|
84
|
+
enrichment<T>(
|
|
85
|
+
name: Phase2AwaitName,
|
|
86
|
+
startedMs: number,
|
|
87
|
+
isSkipped: () => boolean,
|
|
88
|
+
run: (onStatus: (status: Phase2AwaitStatus) => void) => Promise<T>,
|
|
89
|
+
): Promise<T>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Per-recall phase-2 await timer; all durations are performance.now() deltas, never wall clock. */
|
|
93
|
+
export function createPhase2Timer(
|
|
94
|
+
sink: Record<string, string>,
|
|
95
|
+
isAborted: () => boolean,
|
|
96
|
+
): Phase2Timer {
|
|
97
|
+
return {
|
|
98
|
+
async step<T>(name: Phase2AwaitName, run: () => Promise<T>): Promise<T> {
|
|
99
|
+
const awaitStartMs = performance.now();
|
|
100
|
+
try {
|
|
101
|
+
const value = await run();
|
|
102
|
+
recordPhase2Await(sink, name, { status: "ok", ms: performance.now() - awaitStartMs });
|
|
103
|
+
return value;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
recordPhase2Await(sink, name, {
|
|
106
|
+
status: isAborted() ? "skipped" : "error",
|
|
107
|
+
ms: performance.now() - awaitStartMs,
|
|
108
|
+
});
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
skipped(name: Phase2AwaitName): void {
|
|
113
|
+
recordPhase2Await(sink, name, { status: "skipped", ms: 0 });
|
|
114
|
+
},
|
|
115
|
+
async enrichment<T>(
|
|
116
|
+
name: Phase2AwaitName,
|
|
117
|
+
startedMs: number,
|
|
118
|
+
isSkipped: () => boolean,
|
|
119
|
+
run: (onStatus: (status: Phase2AwaitStatus) => void) => Promise<T>,
|
|
120
|
+
): Promise<T> {
|
|
121
|
+
const awaitStartMs = performance.now();
|
|
122
|
+
const reported: Phase2AwaitStatus[] = [];
|
|
123
|
+
let threw = false;
|
|
124
|
+
try {
|
|
125
|
+
return await run((status) => {
|
|
126
|
+
reported.push(status);
|
|
127
|
+
});
|
|
128
|
+
} catch (err) {
|
|
129
|
+
threw = true;
|
|
130
|
+
throw err;
|
|
131
|
+
} finally {
|
|
132
|
+
const nowMs = performance.now();
|
|
133
|
+
const status: Phase2AwaitStatus = threw
|
|
134
|
+
? (isAborted() ? "skipped" : "error")
|
|
135
|
+
: (reported.at(-1) ?? "ok");
|
|
136
|
+
recordPhase2Await(
|
|
137
|
+
sink,
|
|
138
|
+
name,
|
|
139
|
+
status === "ok" && isSkipped()
|
|
140
|
+
? { status: "skipped", ms: 0, totalMs: 0 }
|
|
141
|
+
: { status, ms: nowMs - awaitStartMs, totalMs: nowMs - startedMs },
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -31,6 +31,9 @@ function makeConfig(memoryDir: string, overrides: Record<string, unknown> = {})
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// Outside HTTP dispatch (direct service calls) the id is a generated fallback, marked "local:" in the same field.
|
|
35
|
+
const REQUEST_ID_PATTERN = /^local:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
36
|
+
|
|
34
37
|
test("authenticated recall timings route returns two recalls without user-correlatable inputs", async () => {
|
|
35
38
|
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-recall-timings-"));
|
|
36
39
|
const config = makeConfig(memoryDir);
|
|
@@ -48,8 +51,10 @@ test("authenticated recall timings route returns two recalls without user-correl
|
|
|
48
51
|
const started = await server.start();
|
|
49
52
|
const url = `http://${started.host}:${started.port}/engram/v1/recall/timings`;
|
|
50
53
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
// Drive recalls through the service path (HTTP / MCP recall route) so the
|
|
55
|
+
// records carry the attempt contract (requestId + outcome + httpTotalMs).
|
|
56
|
+
await service.recall({ query: "private first query", sessionKey: "private:first:session" });
|
|
57
|
+
await service.recall({ query: "private second query", sessionKey: "private:second:session", mode: "no_recall" });
|
|
53
58
|
|
|
54
59
|
const denied = await fetch(url);
|
|
55
60
|
assert.equal(denied.status, 401);
|
|
@@ -111,6 +116,10 @@ test("authenticated recall timings route returns two recalls without user-correl
|
|
|
111
116
|
assert.ok(record.timingsMs.total >= 0);
|
|
112
117
|
assert.equal(typeof record.recallPlan, "string");
|
|
113
118
|
assert.equal(typeof record.queryPolicy, "string");
|
|
119
|
+
// Attempt contract (requestId + outcome + monotonic httpTotalMs).
|
|
120
|
+
assert.match(record.requestId, REQUEST_ID_PATTERN);
|
|
121
|
+
assert.equal(record.outcome, "ok");
|
|
122
|
+
assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
|
|
114
123
|
assert.equal("query" in record, false);
|
|
115
124
|
assert.equal("prompt" in record, false);
|
|
116
125
|
assert.equal("sessionKey" in record, false);
|
|
@@ -193,6 +202,11 @@ test("recall timing records expose only the fixed telemetry schema", () => {
|
|
|
193
202
|
namespace: "default",
|
|
194
203
|
recallPlan: "full",
|
|
195
204
|
queryPolicy: "general/full",
|
|
205
|
+
// Attempt contract defaults for legacy emitters: no id, not an error,
|
|
206
|
+
// no monotonic duration measured.
|
|
207
|
+
requestId: "",
|
|
208
|
+
outcome: "ok",
|
|
209
|
+
httpTotalMs: 0,
|
|
196
210
|
timingsMs: {
|
|
197
211
|
total: 7,
|
|
198
212
|
qmd: 3,
|
|
@@ -340,3 +354,127 @@ test("batch context without transport operator fails closed when config names no
|
|
|
340
354
|
}) as { result: { count: number } };
|
|
341
355
|
assert.equal(output.result.count, 0);
|
|
342
356
|
});
|
|
357
|
+
|
|
358
|
+
test("recall timing record allowlists requestId, outcome, and monotonic httpTotalMs (attempt contract)", () => {
|
|
359
|
+
const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-fields"));
|
|
360
|
+
recordRecallTiming(config, {
|
|
361
|
+
timestamp: new Date(0).toISOString(),
|
|
362
|
+
namespace: "default",
|
|
363
|
+
total: "42ms",
|
|
364
|
+
recallPlan: "full",
|
|
365
|
+
queryPolicy: "general/full",
|
|
366
|
+
requestId: "attempt-1",
|
|
367
|
+
outcome: "error",
|
|
368
|
+
httpTotalMs: 123.5,
|
|
369
|
+
// Not part of the record contract: dropped by the sanitizer.
|
|
370
|
+
query: "private user text",
|
|
371
|
+
sessionKey: "private:session",
|
|
372
|
+
});
|
|
373
|
+
const record = getRecallTimings(config)[0];
|
|
374
|
+
assert.ok(record);
|
|
375
|
+
assert.equal(record.requestId, "attempt-1");
|
|
376
|
+
assert.equal(record.outcome, "error");
|
|
377
|
+
assert.equal(record.httpTotalMs, 123.5);
|
|
378
|
+
assert.equal("query" in record, false);
|
|
379
|
+
assert.equal("sessionKey" in record, false);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
test("attempt contract fields fail closed for legacy emitters and bad values", () => {
|
|
383
|
+
const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-defaults"));
|
|
384
|
+
recordRecallTiming(config, {
|
|
385
|
+
timestamp: new Date(0).toISOString(),
|
|
386
|
+
namespace: "default",
|
|
387
|
+
total: 5,
|
|
388
|
+
recallPlan: "full",
|
|
389
|
+
queryPolicy: "general/full",
|
|
390
|
+
requestId: 42,
|
|
391
|
+
outcome: "bogus",
|
|
392
|
+
httpTotalMs: "12ms",
|
|
393
|
+
});
|
|
394
|
+
recordRecallTiming(config, {
|
|
395
|
+
timestamp: new Date(0).toISOString(),
|
|
396
|
+
namespace: "default",
|
|
397
|
+
total: 6,
|
|
398
|
+
recallPlan: "full",
|
|
399
|
+
queryPolicy: "general/full",
|
|
400
|
+
httpTotalMs: -3,
|
|
401
|
+
});
|
|
402
|
+
const [newest, oldest] = getRecallTimings(config);
|
|
403
|
+
assert.ok(newest && oldest);
|
|
404
|
+
// Direct orchestrator callers (x-ray, daemon hooks) predate the contract:
|
|
405
|
+
// their records carry neutral defaults, never a misleading id or duration.
|
|
406
|
+
assert.equal(newest.requestId, "");
|
|
407
|
+
assert.equal(newest.outcome, "ok");
|
|
408
|
+
assert.equal(newest.httpTotalMs, 0);
|
|
409
|
+
// Parsed and sanitized: non-string requestId drops, unknown outcome fails
|
|
410
|
+
// closed to "ok", "12ms" parses, negative durations floor to 0.
|
|
411
|
+
assert.equal(oldest.requestId, "");
|
|
412
|
+
assert.equal(oldest.outcome, "ok");
|
|
413
|
+
assert.equal(oldest.httpTotalMs, 12);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test("service recall records exactly one attempt in finally with contract fields", async () => {
|
|
417
|
+
const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-ok"));
|
|
418
|
+
const service = new EngramAccessService(new Orchestrator(config));
|
|
419
|
+
await service.recall({ query: "contract probe", sessionKey: "contract:probe:session" });
|
|
420
|
+
const records = getRecallTimings(config);
|
|
421
|
+
// One attempt, one record: the pipeline's per-phase payload folds into the
|
|
422
|
+
// finally-record instead of pushing a second entry.
|
|
423
|
+
assert.equal(records.length, 1);
|
|
424
|
+
const record = records[0]!;
|
|
425
|
+
assert.match(record.requestId, REQUEST_ID_PATTERN);
|
|
426
|
+
assert.equal(record.outcome, "ok");
|
|
427
|
+
assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
|
|
428
|
+
assert.ok(Number.isFinite(record.timingsMs.total) && record.timingsMs.total >= 0);
|
|
429
|
+
assert.equal(record.recallPlan, "full");
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
test("denied recall attempt still records outcome error in finally", async () => {
|
|
433
|
+
const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-attempt-error"));
|
|
434
|
+
const service = new EngramAccessService(new Orchestrator(config));
|
|
435
|
+
await assert.rejects(
|
|
436
|
+
service.recall({ query: "contract probe", sessionKey: "contract:probe:session", asOf: " " }),
|
|
437
|
+
/asOf/,
|
|
438
|
+
);
|
|
439
|
+
const records = getRecallTimings(config);
|
|
440
|
+
// The attempt failed before the pipeline ran: the finally-record is the
|
|
441
|
+
// only trace, with the error outcome and the monotonic total it measured.
|
|
442
|
+
assert.equal(records.length, 1);
|
|
443
|
+
const record = records[0]!;
|
|
444
|
+
assert.match(record.requestId, REQUEST_ID_PATTERN);
|
|
445
|
+
assert.equal(record.outcome, "error");
|
|
446
|
+
assert.ok(Number.isFinite(record.httpTotalMs) && record.httpTotalMs >= 0);
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
test("phase-2 await fields are allowlisted, enum-bounded, and carry no extra content", () => {
|
|
450
|
+
const config = makeConfig(path.join(os.tmpdir(), "remnic-recall-timing-phase2-sanitizer"));
|
|
451
|
+
recordRecallTiming(config, {
|
|
452
|
+
timestamp: new Date(0).toISOString(),
|
|
453
|
+
namespace: "default",
|
|
454
|
+
total: "9ms",
|
|
455
|
+
recallPlan: "full",
|
|
456
|
+
queryPolicy: "general/full",
|
|
457
|
+
outcome: "aborted",
|
|
458
|
+
phase2HarmonicMs: "7ms",
|
|
459
|
+
phase2HarmonicStatus: "timeout",
|
|
460
|
+
phase2HarmonicTotalMs: "30ms",
|
|
461
|
+
phase2QuestionsMs: "2ms",
|
|
462
|
+
// A status outside the enum, and a total on an await that has none, drop.
|
|
463
|
+
phase2QuestionsStatus: "private user question text",
|
|
464
|
+
phase2QuestionsTotalMs: "5ms",
|
|
465
|
+
// Not part of the contract at all.
|
|
466
|
+
phase2SecretMs: "1ms",
|
|
467
|
+
phase2HarmonicQuery: "private query",
|
|
468
|
+
});
|
|
469
|
+
const record = getRecallTimings(config)[0];
|
|
470
|
+
assert.ok(record);
|
|
471
|
+
assert.equal(record.outcome, "aborted");
|
|
472
|
+
assert.equal(record.phase2HarmonicMs, 7);
|
|
473
|
+
assert.equal(record.phase2HarmonicStatus, "timeout");
|
|
474
|
+
assert.equal(record.phase2HarmonicTotalMs, 30);
|
|
475
|
+
assert.equal(record.phase2QuestionsMs, 2);
|
|
476
|
+
assert.equal("phase2QuestionsStatus" in record, false);
|
|
477
|
+
assert.equal("phase2QuestionsTotalMs" in record, false);
|
|
478
|
+
assert.equal("phase2SecretMs" in record, false);
|
|
479
|
+
assert.equal("phase2HarmonicQuery" in record, false);
|
|
480
|
+
});
|