@remnic/core 10.0.165 → 10.0.167
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 +129 -128
- package/dist/access-authorization-probe.js +4 -4
- package/dist/access-boundary.js +3 -3
- package/dist/access-cli.d.ts.map +1 -1
- package/dist/access-cli.js +145 -138
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +37 -0
- package/dist/access-coding-context-resolution.d.ts.map +1 -1
- package/dist/access-coding-context-resolution.js +48 -4
- package/dist/access-errors.d.ts +5 -0
- package/dist/access-errors.d.ts.map +1 -1
- package/dist/access-errors.js +3 -1
- package/dist/access-extraction-force-flush-preempt.js +129 -128
- package/dist/access-extraction-force-flush.js +129 -128
- package/dist/access-http-briefing.js +129 -128
- package/dist/access-http-query.js +129 -128
- package/dist/access-http.d.ts.map +1 -1
- package/dist/access-http.js +129 -128
- package/dist/access-identity-continuity-surface.js +129 -128
- package/dist/access-lcm-surface.js +129 -128
- package/dist/access-mcp.js +129 -128
- package/dist/access-memory-search-fanout.js +2 -2
- package/dist/access-namespace-preflight.js +4 -4
- package/dist/access-observe-transcript.js +3 -2
- package/dist/access-observe-write-category.js +9 -9
- package/dist/access-observe-write-surface.d.ts +1 -0
- package/dist/access-observe-write-surface.d.ts.map +1 -1
- package/dist/access-observe-write-surface.js +129 -128
- package/dist/access-offline-manifest.js +9 -8
- package/dist/access-operations-batch.js +129 -128
- package/dist/access-operations.d.ts +1 -1
- package/dist/access-operations.js +129 -128
- package/dist/access-recall-concurrency.d.ts +3 -16
- package/dist/access-recall-concurrency.d.ts.map +1 -1
- package/dist/access-recall-concurrency.js +129 -128
- package/dist/access-recall-corpus-versions.d.ts +4 -1
- package/dist/access-recall-corpus-versions.d.ts.map +1 -1
- package/dist/access-recall-corpus-versions.js +4 -1
- package/dist/access-recall-diagnostics.js +3 -3
- package/dist/access-recall-response.d.ts.map +1 -1
- package/dist/access-recall-response.js +129 -128
- package/dist/access-recall-surface.d.ts +1 -0
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +129 -128
- package/dist/access-schema.d.ts +1 -0
- package/dist/access-schema.d.ts.map +1 -1
- package/dist/access-schema.js +2 -2
- package/dist/access-service.d.ts +3 -15
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +131 -128
- package/dist/access-surface-catalog.js +5 -5
- package/dist/access-token-capabilities.js +2 -2
- package/dist/active-recall.js +21 -21
- package/dist/artifact-search.js +2 -2
- package/dist/auto-sync-L3M4RKJD.js +1 -1
- package/dist/briefing.js +19 -19
- package/dist/buffer-add-turns-bounded.js +2 -2
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +1 -1
- package/dist/buffer.js +11 -10
- package/dist/calibration.js +2 -2
- package/dist/capsule-import-gate.js +2 -2
- package/dist/causal-consolidation.js +20 -20
- package/dist/{chunk-5V3IBSVB.js → chunk-22V3CMIW.js} +4 -4
- package/dist/{chunk-7IWRLYFJ.js → chunk-2TJSGIKT.js} +2 -2
- package/dist/{chunk-V6M6N3EE.js → chunk-333SBFXB.js} +2 -2
- package/dist/{chunk-XBW7U7GM.js → chunk-3PNJZTDV.js} +5 -2
- package/dist/chunk-3PNJZTDV.js.map +1 -0
- package/dist/{chunk-XE4UYWW3.js → chunk-3YOX2BQD.js} +3 -3
- package/dist/{chunk-XEBNSY7N.js → chunk-4D2EY4WM.js} +2 -2
- package/dist/{chunk-5HFCXTGY.js → chunk-4D77BI3J.js} +29 -189
- package/dist/chunk-4D77BI3J.js.map +1 -0
- package/dist/{chunk-LPV72KRQ.js → chunk-4IMOGAFF.js} +3 -3
- package/dist/{chunk-QBREZ4QL.js → chunk-4L25GAYL.js} +2 -2
- package/dist/{chunk-HADD45AR.js → chunk-4WCLZBM2.js} +2 -2
- package/dist/{chunk-B3GKQ6DU.js → chunk-5MA6ZQ4Z.js} +2 -2
- package/dist/{chunk-V4ASAWRP.js → chunk-5PUZV73Z.js} +3 -3
- package/dist/{chunk-3QLAOYBL.js → chunk-5QDTZIGH.js} +3 -3
- package/dist/{chunk-WXDTOE6F.js → chunk-5VMRM2X3.js} +2 -2
- package/dist/{chunk-VE23DIBH.js → chunk-6QWFZ3X5.js} +2 -2
- package/dist/{chunk-SDGD6MYV.js → chunk-7F7HRJI2.js} +2 -2
- package/dist/{chunk-QFPNWSVH.js → chunk-7OCKK5M5.js} +6 -6
- package/dist/{chunk-WAJL65KW.js → chunk-7VIJUZYW.js} +3 -3
- package/dist/{chunk-EI2M2CFJ.js → chunk-A5UOREWD.js} +3 -3
- package/dist/{chunk-32CA7B6L.js → chunk-AQZL7JBZ.js} +2 -2
- package/dist/{chunk-EDA6CDBT.js → chunk-AVWOULJH.js} +2 -2
- package/dist/{chunk-4HKK5HUI.js → chunk-B3M56D2A.js} +2 -2
- package/dist/{chunk-YAVIBVCU.js → chunk-BFPQJNFZ.js} +5 -5
- package/dist/{chunk-YAVIBVCU.js.map → chunk-BFPQJNFZ.js.map} +1 -1
- package/dist/{chunk-SRN5M4LQ.js → chunk-BKTCVXMK.js} +4 -4
- package/dist/{chunk-TXVTNDQT.js → chunk-BPCR5DZP.js} +2 -2
- package/dist/{chunk-6S4DM53Y.js → chunk-C5QYWM6F.js} +6 -6
- package/dist/chunk-CKELO7Q6.js +113 -0
- package/dist/chunk-CKELO7Q6.js.map +1 -0
- package/dist/{chunk-IEB6XYW6.js → chunk-CKZWLAHN.js} +2 -2
- package/dist/{chunk-JVIWVJ2A.js → chunk-CUPILBIP.js} +3 -3
- package/dist/{chunk-274UY54Z.js → chunk-DFZYZOLH.js} +3 -3
- package/dist/{chunk-FSI45NUK.js → chunk-EZG54YDS.js} +2 -2
- package/dist/{chunk-7ZFB4VZS.js → chunk-FFWFFAP3.js} +2 -2
- package/dist/{chunk-22VXXA67.js → chunk-FGT7CUYZ.js} +2 -2
- package/dist/{chunk-Z3SXC3MP.js → chunk-FOTFLHBN.js} +2 -2
- package/dist/{chunk-RH6XWXMA.js → chunk-FRYCXXTB.js} +3 -3
- package/dist/{chunk-B377OKUP.js → chunk-G64WYD2S.js} +4 -4
- package/dist/{chunk-JJEQRSYU.js → chunk-GBSXTTLP.js} +2 -2
- package/dist/{chunk-2YODOG2O.js → chunk-GIL2M2OI.js} +3 -3
- package/dist/{chunk-YVRQ5JRA.js → chunk-GYOKVJPB.js} +14 -8
- package/dist/chunk-GYOKVJPB.js.map +1 -0
- package/dist/{chunk-ARJ3KCX4.js → chunk-HDLNSDLK.js} +2 -2
- package/dist/{chunk-VXUO5JZC.js → chunk-HDWISXFH.js} +6 -6
- package/dist/{chunk-RNFMFC37.js → chunk-IDYYGOOQ.js} +28 -1
- package/dist/chunk-IDYYGOOQ.js.map +1 -0
- package/dist/{chunk-IHOKB3L3.js → chunk-IE2ZLO3R.js} +785 -515
- package/dist/chunk-IE2ZLO3R.js.map +1 -0
- package/dist/{chunk-EZ47HOJ6.js → chunk-IXI6S2VJ.js} +4 -4
- package/dist/{chunk-VXMWTRQX.js → chunk-J74YOBB3.js} +4 -4
- package/dist/{chunk-AMW3IDCO.js → chunk-JFMMEHVG.js} +2 -2
- package/dist/{chunk-XKZBZOKV.js → chunk-JIF22AXI.js} +18 -1
- package/dist/chunk-JIF22AXI.js.map +1 -0
- package/dist/{chunk-JTSSSR4L.js → chunk-KIUFT2WZ.js} +3 -3
- package/dist/{chunk-L6BLTV4D.js → chunk-L7SEYUHS.js} +2 -2
- package/dist/{chunk-WRAK5LLB.js → chunk-LPUEBFX2.js} +3 -3
- package/dist/{chunk-DBVSU3HE.js → chunk-LVGTH6IQ.js} +9 -9
- package/dist/{chunk-33VVVP57.js → chunk-MEVBSF6T.js} +4 -1
- package/dist/chunk-MEVBSF6T.js.map +1 -0
- package/dist/{chunk-CJCTKL6Y.js → chunk-MGKCKY7X.js} +4 -1
- package/dist/chunk-MGKCKY7X.js.map +1 -0
- package/dist/{chunk-SOGOHLWN.js → chunk-N7AIFTSH.js} +1 -1
- package/dist/chunk-N7AIFTSH.js.map +1 -0
- package/dist/chunk-O3XGASU5.js +197 -0
- package/dist/chunk-O3XGASU5.js.map +1 -0
- package/dist/{chunk-OGBQMY46.js → chunk-O544TUJO.js} +2 -2
- package/dist/{chunk-TFNZXOXK.js → chunk-OAQRZ4SV.js} +2 -2
- package/dist/{chunk-IEEV27BC.js → chunk-OO2HEUZ4.js} +2 -2
- package/dist/{chunk-YMC4AYJK.js → chunk-OWM2VWNX.js} +10 -10
- package/dist/{chunk-4LPTSB5V.js → chunk-PFLN6TTW.js} +2 -2
- package/dist/{chunk-YOR5QBEU.js → chunk-QFTK6EDM.js} +4 -4
- package/dist/{chunk-A2WFUMUN.js → chunk-QKDXO4FD.js} +4 -4
- package/dist/{chunk-Y7HLGKKU.js → chunk-QLQUAVVP.js} +4 -4
- package/dist/{chunk-MUMQWCE2.js → chunk-QPFM6DHY.js} +2 -2
- package/dist/{chunk-YWPCDR3I.js → chunk-QVXEXGIM.js} +3 -3
- package/dist/{chunk-UPE7TJWN.js → chunk-QWWHYBPT.js} +2 -2
- package/dist/{chunk-NZHZQGLB.js → chunk-QXTKN25V.js} +2 -2
- package/dist/{chunk-OAGTKS73.js → chunk-RFLC6PKQ.js} +2 -2
- package/dist/{chunk-ZRLTQ2Y7.js → chunk-RO5EGRAI.js} +2 -2
- package/dist/{chunk-5D4NBANY.js → chunk-SIONKXLU.js} +2 -2
- package/dist/{chunk-6XTUZKCZ.js → chunk-SMDZTJ2D.js} +2 -2
- package/dist/{chunk-OFSAKEZB.js → chunk-T4BT4FQN.js} +2 -2
- package/dist/{chunk-IC35ZYLM.js → chunk-TAD6QMMD.js} +4 -4
- package/dist/{chunk-EAHNSQ7H.js → chunk-TB6VFEHQ.js} +2 -2
- package/dist/{chunk-6ARSFTLD.js → chunk-TNRGWJYT.js} +2 -2
- package/dist/{chunk-6TPWIPE3.js → chunk-U3BCW7GX.js} +3 -3
- package/dist/{chunk-JCAMHTS2.js → chunk-UBG65KEY.js} +7 -5
- package/dist/{chunk-JCAMHTS2.js.map → chunk-UBG65KEY.js.map} +1 -1
- package/dist/{chunk-CGOPDXLK.js → chunk-UMEUU66X.js} +2 -2
- package/dist/{chunk-5LTXYM7D.js → chunk-UYIBNDQE.js} +2 -2
- package/dist/{chunk-UGQEJWR3.js → chunk-VHXRLD6S.js} +2 -2
- package/dist/{chunk-WJ6S54ES.js → chunk-VOLTQNAP.js} +2 -2
- package/dist/{chunk-SBU5GDOT.js → chunk-VRHY7Y5A.js} +7 -7
- package/dist/{chunk-E5RJPLNL.js → chunk-W7N7NWG5.js} +3 -3
- package/dist/{chunk-UPWOMMVU.js → chunk-WECKZ3KT.js} +7 -7
- package/dist/{chunk-PCUDFWX5.js → chunk-WEFFO2MJ.js} +2 -2
- package/dist/{chunk-QCP75JGO.js → chunk-WQUGCOKF.js} +5 -5
- package/dist/{chunk-FKBGK3NC.js → chunk-WWUQ6CP3.js} +2 -2
- package/dist/{chunk-KR6PEAM4.js → chunk-X67XNZ64.js} +8 -8
- package/dist/{chunk-UYHDMCY2.js → chunk-XUVCQ4YZ.js} +2 -2
- package/dist/{chunk-7IJ2H43M.js → chunk-YY57TRKN.js} +2 -2
- package/dist/{chunk-AU6AEUFD.js → chunk-YYXYZM2I.js} +2 -2
- package/dist/{chunk-3FBAEPCU.js → chunk-ZDUE44CC.js} +2 -2
- package/dist/{chunk-PRE7R3RQ.js → chunk-ZQUOUPP3.js} +12 -3
- package/dist/chunk-ZQUOUPP3.js.map +1 -0
- package/dist/{chunk-RDO6AMDL.js → chunk-ZWDDY4WF.js} +2 -2
- package/dist/{chunk-QASTQVGK.js → chunk-ZX546Y3Y.js} +2 -2
- package/dist/chunk-ZX546Y3Y.js.map +1 -0
- package/dist/cli.js +129 -128
- package/dist/coding/architecture-surfaces.d.ts +0 -24
- package/dist/coding/architecture-surfaces.d.ts.map +1 -1
- package/dist/coding/codegraph-surfaces.d.ts.map +1 -1
- package/dist/coding/export-okf-codegraph.js +51 -24
- package/dist/coding/export-okf-codegraph.js.map +1 -1
- package/dist/coding/git-context.d.ts +23 -0
- package/dist/coding/git-context.d.ts.map +1 -1
- package/dist/coding/git-context.js +31 -0
- package/dist/coding/git-context.js.map +1 -0
- package/dist/coding/session-delta-surfaces.d.ts +0 -23
- package/dist/coding/session-delta-surfaces.d.ts.map +1 -1
- package/dist/compounding/engine.js +20 -20
- package/dist/config.js +21 -21
- package/dist/connectors/codex-materialize-runner.js +19 -19
- package/dist/connectors/droid-mcp.d.ts +4 -3
- package/dist/connectors/droid-mcp.d.ts.map +1 -1
- package/dist/connectors/index.js +23 -23
- package/dist/convergence-refresh.js +21 -21
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +23 -23
- package/dist/deep-recall-config.js +2 -2
- package/dist/deep-recall-http-glue.js +4 -4
- package/dist/entity-recall-cancellation.js +2 -2
- package/dist/entity-recall-reads.js +3 -3
- package/dist/entity-retrieval.js +21 -21
- package/dist/explicit-capture.js +129 -128
- package/dist/external-wiki-access.js +4 -4
- package/dist/extraction-judge.js +1 -1
- package/dist/extraction.js +31 -30
- package/dist/harmonic-retrieval.js +19 -19
- package/dist/index.js +208 -206
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +21 -21
- package/dist/maintenance/memory-governance.js +19 -19
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -19
- package/dist/maintenance/rebuild-memory-projection-runner.js +21 -21
- package/dist/maintenance/rebuild-memory-projection.js +20 -20
- package/dist/memory-browse-http-glue.js +2 -2
- package/dist/memory-browse-operations.js +4 -4
- package/dist/memory-browse.js +6 -6
- package/dist/memory-controller.d.ts +8 -0
- package/dist/memory-controller.d.ts.map +1 -1
- package/dist/memory-controller.js +1 -1
- package/dist/namespaces/migrate.js +20 -20
- package/dist/namespaces/search.js +8 -8
- package/dist/namespaces/storage.js +19 -19
- package/dist/offline-sync-impression-drain.js +8 -7
- package/dist/operator-doctor-corpus.js +26 -26
- package/dist/operator-doctor-replica.js +4 -4
- package/dist/operator-toolkit.js +35 -34
- package/dist/orchestration/backlog-scheduler.js +130 -129
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +130 -129
- package/dist/orchestration/episodic-context-section.d.ts +3 -2
- package/dist/orchestration/episodic-context-section.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +34 -33
- package/dist/orchestration/orchestrator-helpers.d.ts +10 -0
- package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -1
- package/dist/orchestration/orchestrator-init.d.ts +12 -13
- package/dist/orchestration/orchestrator-init.d.ts.map +1 -1
- package/dist/orchestration/recall-entry.d.ts.map +1 -1
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/session-context.d.ts +5 -1
- package/dist/orchestration/session-context.d.ts.map +1 -1
- package/dist/orchestration/startup-search-sync.d.ts +73 -0
- package/dist/orchestration/startup-search-sync.d.ts.map +1 -0
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.d.ts +4 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +129 -128
- package/dist/qmd-daemon-session.js +2 -2
- package/dist/qmd.js +3 -3
- 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-http-glue.js +2 -2
- package/dist/recall-navigation-operations.js +4 -4
- package/dist/recall-navigation.js +129 -128
- package/dist/recall-qos.d.ts +26 -0
- package/dist/recall-qos.d.ts.map +1 -1
- package/dist/recall-qos.js +9 -1
- package/dist/recall-state-view-admission.js +6 -6
- package/dist/recall-why-service.js +6 -6
- 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/relay/mission.d.ts +3 -3
- package/dist/replica-divergence.js +3 -3
- package/dist/resume-bundles.js +23 -23
- package/dist/search/factory.js +7 -7
- package/dist/search/index.js +9 -9
- package/dist/semantic-consolidation.js +20 -20
- package/dist/semantic-rule-promotion.js +19 -19
- package/dist/semantic-rule-verifier.js +19 -19
- package/dist/source-agent-qualifier.js +29 -28
- package/dist/standup/build.js +20 -20
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage.js +18 -18
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +7 -7
- package/dist/tokens.js +3 -3
- package/dist/transfer/export-okf.js +19 -19
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +19 -19
- package/dist/who-knows-cli.js +21 -21
- package/dist/who-knows.js +20 -20
- package/package.json +12 -2
- package/src/access-cli.ts +18 -9
- package/src/access-coding-context-resolution.ts +138 -0
- package/src/access-errors.ts +5 -0
- package/src/access-http-admission.test.ts +76 -0
- package/src/access-http.test.ts +2 -0
- package/src/access-http.ts +4 -0
- package/src/access-observe-write-surface.ts +2 -1
- package/src/access-operations-batch.ts +2 -2
- package/src/access-recall-concurrency.ts +179 -22
- package/src/access-recall-corpus-versions.ts +12 -7
- package/src/access-recall-response.ts +25 -2
- package/src/access-recall-surface.ts +6 -4
- package/src/access-schema.ts +9 -0
- package/src/access-service-raw-excerpt-read-gate.test.ts +7 -2
- package/src/access-service-recall-concurrency.test.ts +242 -0
- package/src/access-service-set-coding-context.test.ts +210 -0
- package/src/access-service.ts +43 -58
- package/src/buffer-turn-helpers.ts +3 -0
- package/src/capsule-import-gate.test.ts +106 -0
- package/src/coding/access-coding-context.test.ts +3 -0
- package/src/coding/architecture-surfaces.ts +2 -1
- package/src/coding/codegraph-surfaces.test.ts +34 -0
- package/src/coding/codegraph-surfaces.ts +3 -2
- package/src/coding/git-context.test.ts +29 -0
- package/src/coding/git-context.ts +63 -2
- package/src/coding/session-delta-surfaces.ts +2 -1
- package/src/connectors/droid-mcp.test.ts +46 -0
- package/src/connectors/droid-mcp.ts +5 -5
- package/src/harmonic-graph-version.test.ts +63 -0
- package/src/memory-controller.test.ts +38 -0
- package/src/memory-controller.ts +25 -2
- package/src/orchestration/episodic-context-section.ts +6 -7
- package/src/orchestration/orchestrator-helpers.ts +10 -0
- package/src/orchestration/orchestrator-init.ts +57 -303
- package/src/orchestration/recall-entry.ts +59 -4
- package/src/orchestration/recall-internal.ts +10 -10
- package/src/orchestration/session-context.ts +11 -1
- package/src/orchestration/startup-search-sync.ts +492 -0
- package/src/orchestration/task-exit.test.ts +45 -0
- package/src/orchestration/turn-ingestion-buffered.test.ts +224 -0
- package/src/orchestration/turn-ingestion.ts +28 -35
- package/src/orchestrator-flush.test.ts +7 -7
- package/src/orchestrator-init.test.ts +364 -12
- package/src/orchestrator-source-attribution.test.ts +100 -0
- package/src/orchestrator-startup-ready-path.test.ts +133 -10
- package/src/orchestrator.ts +16 -1
- package/src/recall-qos.test.ts +62 -0
- package/src/recall-qos.ts +75 -0
- package/src/recall-retrieval-failure.test.ts +282 -18
- package/src/recall-search-options.test.ts +13 -1
- package/src/storage/buffer-drain-handin-memo.test.ts +140 -0
- package/src/types.ts +1 -1
- package/dist/chunk-33VVVP57.js.map +0 -1
- package/dist/chunk-3QNFHI6T.js +0 -38
- package/dist/chunk-3QNFHI6T.js.map +0 -1
- package/dist/chunk-5HFCXTGY.js.map +0 -1
- package/dist/chunk-CJCTKL6Y.js.map +0 -1
- package/dist/chunk-IHOKB3L3.js.map +0 -1
- package/dist/chunk-PRE7R3RQ.js.map +0 -1
- package/dist/chunk-QASTQVGK.js.map +0 -1
- package/dist/chunk-RNFMFC37.js.map +0 -1
- package/dist/chunk-SOGOHLWN.js.map +0 -1
- package/dist/chunk-XBW7U7GM.js.map +0 -1
- package/dist/chunk-XKZBZOKV.js.map +0 -1
- package/dist/chunk-YVRQ5JRA.js.map +0 -1
- /package/dist/{chunk-5V3IBSVB.js.map → chunk-22V3CMIW.js.map} +0 -0
- /package/dist/{chunk-7IWRLYFJ.js.map → chunk-2TJSGIKT.js.map} +0 -0
- /package/dist/{chunk-V6M6N3EE.js.map → chunk-333SBFXB.js.map} +0 -0
- /package/dist/{chunk-XE4UYWW3.js.map → chunk-3YOX2BQD.js.map} +0 -0
- /package/dist/{chunk-XEBNSY7N.js.map → chunk-4D2EY4WM.js.map} +0 -0
- /package/dist/{chunk-LPV72KRQ.js.map → chunk-4IMOGAFF.js.map} +0 -0
- /package/dist/{chunk-QBREZ4QL.js.map → chunk-4L25GAYL.js.map} +0 -0
- /package/dist/{chunk-HADD45AR.js.map → chunk-4WCLZBM2.js.map} +0 -0
- /package/dist/{chunk-B3GKQ6DU.js.map → chunk-5MA6ZQ4Z.js.map} +0 -0
- /package/dist/{chunk-V4ASAWRP.js.map → chunk-5PUZV73Z.js.map} +0 -0
- /package/dist/{chunk-3QLAOYBL.js.map → chunk-5QDTZIGH.js.map} +0 -0
- /package/dist/{chunk-WXDTOE6F.js.map → chunk-5VMRM2X3.js.map} +0 -0
- /package/dist/{chunk-VE23DIBH.js.map → chunk-6QWFZ3X5.js.map} +0 -0
- /package/dist/{chunk-SDGD6MYV.js.map → chunk-7F7HRJI2.js.map} +0 -0
- /package/dist/{chunk-QFPNWSVH.js.map → chunk-7OCKK5M5.js.map} +0 -0
- /package/dist/{chunk-WAJL65KW.js.map → chunk-7VIJUZYW.js.map} +0 -0
- /package/dist/{chunk-EI2M2CFJ.js.map → chunk-A5UOREWD.js.map} +0 -0
- /package/dist/{chunk-32CA7B6L.js.map → chunk-AQZL7JBZ.js.map} +0 -0
- /package/dist/{chunk-EDA6CDBT.js.map → chunk-AVWOULJH.js.map} +0 -0
- /package/dist/{chunk-4HKK5HUI.js.map → chunk-B3M56D2A.js.map} +0 -0
- /package/dist/{chunk-SRN5M4LQ.js.map → chunk-BKTCVXMK.js.map} +0 -0
- /package/dist/{chunk-TXVTNDQT.js.map → chunk-BPCR5DZP.js.map} +0 -0
- /package/dist/{chunk-6S4DM53Y.js.map → chunk-C5QYWM6F.js.map} +0 -0
- /package/dist/{chunk-IEB6XYW6.js.map → chunk-CKZWLAHN.js.map} +0 -0
- /package/dist/{chunk-JVIWVJ2A.js.map → chunk-CUPILBIP.js.map} +0 -0
- /package/dist/{chunk-274UY54Z.js.map → chunk-DFZYZOLH.js.map} +0 -0
- /package/dist/{chunk-FSI45NUK.js.map → chunk-EZG54YDS.js.map} +0 -0
- /package/dist/{chunk-7ZFB4VZS.js.map → chunk-FFWFFAP3.js.map} +0 -0
- /package/dist/{chunk-22VXXA67.js.map → chunk-FGT7CUYZ.js.map} +0 -0
- /package/dist/{chunk-Z3SXC3MP.js.map → chunk-FOTFLHBN.js.map} +0 -0
- /package/dist/{chunk-RH6XWXMA.js.map → chunk-FRYCXXTB.js.map} +0 -0
- /package/dist/{chunk-B377OKUP.js.map → chunk-G64WYD2S.js.map} +0 -0
- /package/dist/{chunk-JJEQRSYU.js.map → chunk-GBSXTTLP.js.map} +0 -0
- /package/dist/{chunk-2YODOG2O.js.map → chunk-GIL2M2OI.js.map} +0 -0
- /package/dist/{chunk-ARJ3KCX4.js.map → chunk-HDLNSDLK.js.map} +0 -0
- /package/dist/{chunk-VXUO5JZC.js.map → chunk-HDWISXFH.js.map} +0 -0
- /package/dist/{chunk-EZ47HOJ6.js.map → chunk-IXI6S2VJ.js.map} +0 -0
- /package/dist/{chunk-VXMWTRQX.js.map → chunk-J74YOBB3.js.map} +0 -0
- /package/dist/{chunk-AMW3IDCO.js.map → chunk-JFMMEHVG.js.map} +0 -0
- /package/dist/{chunk-JTSSSR4L.js.map → chunk-KIUFT2WZ.js.map} +0 -0
- /package/dist/{chunk-L6BLTV4D.js.map → chunk-L7SEYUHS.js.map} +0 -0
- /package/dist/{chunk-WRAK5LLB.js.map → chunk-LPUEBFX2.js.map} +0 -0
- /package/dist/{chunk-DBVSU3HE.js.map → chunk-LVGTH6IQ.js.map} +0 -0
- /package/dist/{chunk-OGBQMY46.js.map → chunk-O544TUJO.js.map} +0 -0
- /package/dist/{chunk-TFNZXOXK.js.map → chunk-OAQRZ4SV.js.map} +0 -0
- /package/dist/{chunk-IEEV27BC.js.map → chunk-OO2HEUZ4.js.map} +0 -0
- /package/dist/{chunk-YMC4AYJK.js.map → chunk-OWM2VWNX.js.map} +0 -0
- /package/dist/{chunk-4LPTSB5V.js.map → chunk-PFLN6TTW.js.map} +0 -0
- /package/dist/{chunk-YOR5QBEU.js.map → chunk-QFTK6EDM.js.map} +0 -0
- /package/dist/{chunk-A2WFUMUN.js.map → chunk-QKDXO4FD.js.map} +0 -0
- /package/dist/{chunk-Y7HLGKKU.js.map → chunk-QLQUAVVP.js.map} +0 -0
- /package/dist/{chunk-MUMQWCE2.js.map → chunk-QPFM6DHY.js.map} +0 -0
- /package/dist/{chunk-YWPCDR3I.js.map → chunk-QVXEXGIM.js.map} +0 -0
- /package/dist/{chunk-UPE7TJWN.js.map → chunk-QWWHYBPT.js.map} +0 -0
- /package/dist/{chunk-NZHZQGLB.js.map → chunk-QXTKN25V.js.map} +0 -0
- /package/dist/{chunk-OAGTKS73.js.map → chunk-RFLC6PKQ.js.map} +0 -0
- /package/dist/{chunk-ZRLTQ2Y7.js.map → chunk-RO5EGRAI.js.map} +0 -0
- /package/dist/{chunk-5D4NBANY.js.map → chunk-SIONKXLU.js.map} +0 -0
- /package/dist/{chunk-6XTUZKCZ.js.map → chunk-SMDZTJ2D.js.map} +0 -0
- /package/dist/{chunk-OFSAKEZB.js.map → chunk-T4BT4FQN.js.map} +0 -0
- /package/dist/{chunk-IC35ZYLM.js.map → chunk-TAD6QMMD.js.map} +0 -0
- /package/dist/{chunk-EAHNSQ7H.js.map → chunk-TB6VFEHQ.js.map} +0 -0
- /package/dist/{chunk-6ARSFTLD.js.map → chunk-TNRGWJYT.js.map} +0 -0
- /package/dist/{chunk-6TPWIPE3.js.map → chunk-U3BCW7GX.js.map} +0 -0
- /package/dist/{chunk-CGOPDXLK.js.map → chunk-UMEUU66X.js.map} +0 -0
- /package/dist/{chunk-5LTXYM7D.js.map → chunk-UYIBNDQE.js.map} +0 -0
- /package/dist/{chunk-UGQEJWR3.js.map → chunk-VHXRLD6S.js.map} +0 -0
- /package/dist/{chunk-WJ6S54ES.js.map → chunk-VOLTQNAP.js.map} +0 -0
- /package/dist/{chunk-SBU5GDOT.js.map → chunk-VRHY7Y5A.js.map} +0 -0
- /package/dist/{chunk-E5RJPLNL.js.map → chunk-W7N7NWG5.js.map} +0 -0
- /package/dist/{chunk-UPWOMMVU.js.map → chunk-WECKZ3KT.js.map} +0 -0
- /package/dist/{chunk-PCUDFWX5.js.map → chunk-WEFFO2MJ.js.map} +0 -0
- /package/dist/{chunk-QCP75JGO.js.map → chunk-WQUGCOKF.js.map} +0 -0
- /package/dist/{chunk-FKBGK3NC.js.map → chunk-WWUQ6CP3.js.map} +0 -0
- /package/dist/{chunk-KR6PEAM4.js.map → chunk-X67XNZ64.js.map} +0 -0
- /package/dist/{chunk-UYHDMCY2.js.map → chunk-XUVCQ4YZ.js.map} +0 -0
- /package/dist/{chunk-7IJ2H43M.js.map → chunk-YY57TRKN.js.map} +0 -0
- /package/dist/{chunk-AU6AEUFD.js.map → chunk-YYXYZM2I.js.map} +0 -0
- /package/dist/{chunk-3FBAEPCU.js.map → chunk-ZDUE44CC.js.map} +0 -0
- /package/dist/{chunk-RDO6AMDL.js.map → chunk-ZWDDY4WF.js.map} +0 -0
|
@@ -38,6 +38,7 @@ import { PolicyRuntimeManager, type RuntimePolicyValues } from "../policy-runtim
|
|
|
38
38
|
import { LastRecallStore, RecallHandleHistoryStore, TierMigrationStatusStore } from "../recall-state.js";
|
|
39
39
|
import { RelevanceStore } from "../relevance.js";
|
|
40
40
|
import { NoopSearchBackend } from "../search/noop-backend.js";
|
|
41
|
+
import { StartupSearchSyncRunner } from "./startup-search-sync.js";
|
|
41
42
|
import type { SearchBackend } from "../search/port.js";
|
|
42
43
|
import { SessionObserverState } from "../session-observer-state.js";
|
|
43
44
|
import { SharedContextManager } from "../shared-context/manager.js";
|
|
@@ -100,23 +101,6 @@ export interface OrchestratorInitDeps {
|
|
|
100
101
|
wearablesAutoSyncHandle: { stop(): Promise<void> } | null;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
/** Outcome of one backend bring-up: probe, catalog-union discovery, per-namespace
|
|
104
|
-
* collection ensure, and the missing-collection noop swap. "ready" carries the
|
|
105
|
-
* epoch and discovery the full sync needs for its corpus update. "degraded" is
|
|
106
|
-
* the probed-available backend whose collection check answered "unknown" — the
|
|
107
|
-
* ensure is unverified, so neither sync may claim success. */
|
|
108
|
-
type StartupBackendEnsure =
|
|
109
|
-
| { state: "ready"; epoch: number; discovery: { namespaces: string[]; complete: boolean } }
|
|
110
|
-
| { state: "unavailable" | "missing" | "degraded" | "retired" };
|
|
111
|
-
|
|
112
|
-
type StartupBackendEnsureFlight = {
|
|
113
|
-
epoch: number;
|
|
114
|
-
promise: Promise<StartupBackendEnsure>;
|
|
115
|
-
controller: AbortController;
|
|
116
|
-
liveCallers: number;
|
|
117
|
-
cleanup: Array<() => void>;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
104
|
export class OrchestratorInitCoordinator {
|
|
121
105
|
private nextStartupEpoch = 0;
|
|
122
106
|
private activeStartupEpoch: number | null = null;
|
|
@@ -124,7 +108,6 @@ export class OrchestratorInitCoordinator {
|
|
|
124
108
|
private maintenanceNamespacesFlight:
|
|
125
109
|
| { epoch: number; promise: Promise<string[]> }
|
|
126
110
|
| undefined;
|
|
127
|
-
private startupBackendEnsureFlight: StartupBackendEnsureFlight | undefined;
|
|
128
111
|
private correctionCatalogFlight:
|
|
129
112
|
| { epoch: number; promise: Promise<Awaited<ReturnType<NamespaceCatalog["listNamespaces"]>>> }
|
|
130
113
|
| undefined;
|
|
@@ -671,10 +654,39 @@ export class OrchestratorInitCoordinator {
|
|
|
671
654
|
this.deps.deferredSyncSucceeded = true;
|
|
672
655
|
}
|
|
673
656
|
}
|
|
674
|
-
// Otherwise the flag stays false and the
|
|
657
|
+
// Otherwise the flag stays false and the retry loop owns the
|
|
675
658
|
// sync: the corpus update when maintenance is on, backend recovery when
|
|
676
659
|
// the probe failed.
|
|
677
660
|
|
|
661
|
+
// But only remnic-server runs a retry loop (#3525): the OpenClaw service,
|
|
662
|
+
// `remnic` CLI invocations, and the bench adapter drive Orchestrator
|
|
663
|
+
// directly, so their index would go stale after the update left this
|
|
664
|
+
// awaited path. Fire the same startupSearchSync once the ready mark
|
|
665
|
+
// settles — registered now so a deferred-init failure still gets the
|
|
666
|
+
// update — and record the success in the shared flag, so a server retry
|
|
667
|
+
// that races in sees the same bookkeeping either direction. Only the
|
|
668
|
+
// sync run itself joins startupWarmups: the deferredReady-derived outer
|
|
669
|
+
// promise would make drainStartupWarmups() wait on the ready gate that
|
|
670
|
+
// destroy() must not touch, while the abort signal already cancels the
|
|
671
|
+
// run.
|
|
672
|
+
void this.deps.deferredReady.then(async () => {
|
|
673
|
+
if (signal.aborted
|
|
674
|
+
|| !resolveQmdCapabilities(this.deps.config).qmdMaintenance
|
|
675
|
+
|| this.deps.deferredSyncSucceeded) return;
|
|
676
|
+
try {
|
|
677
|
+
const sync = this.startupSearchSync(signal);
|
|
678
|
+
const tracked = sync.then(() => undefined, () => undefined);
|
|
679
|
+
this.startupWarmups.add(tracked);
|
|
680
|
+
void tracked.then(() => this.startupWarmups.delete(tracked));
|
|
681
|
+
// deferredSyncSucceeded is published by the shared run itself when it
|
|
682
|
+
// completes for a current epoch — including a run this fire joined —
|
|
683
|
+
// so no duplicate `qmd update` can be queued behind a success.
|
|
684
|
+
await sync;
|
|
685
|
+
} catch (err) {
|
|
686
|
+
log.warn(`post-ready QMD sync failed (non-fatal): ${err}`);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
|
|
678
690
|
if (signal.aborted || !this.isCurrentStartupEpoch(epoch)) return;
|
|
679
691
|
|
|
680
692
|
// Build the default namespace's authoritative fact-hash index now, in the
|
|
@@ -881,7 +893,6 @@ export class OrchestratorInitCoordinator {
|
|
|
881
893
|
|
|
882
894
|
log.info("orchestrator initialized (full — deferred steps complete)");
|
|
883
895
|
}
|
|
884
|
-
|
|
885
896
|
/**
|
|
886
897
|
* Readiness level of startupSearchSync (#3518): probe, catalog-union
|
|
887
898
|
* collection ensure, and the missing-collection noop swap — WITHOUT the
|
|
@@ -892,8 +903,20 @@ export class OrchestratorInitCoordinator {
|
|
|
892
903
|
* warm-up search, false while unavailable, retired, or noop-disposed.
|
|
893
904
|
*/
|
|
894
905
|
async startupSearchReadySync(signal?: AbortSignal): Promise<boolean> {
|
|
895
|
-
|
|
896
|
-
|
|
906
|
+
return this.searchSync().startupSearchReadySync(signal);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Freshness-dependent one-shot entry point (#3525): joins the shared
|
|
911
|
+
* startupSearchSync when this lifecycle still owes a corpus sync, so a
|
|
912
|
+
* caller that needs a fresh index — the `remnic` one-shot diagnostic
|
|
913
|
+
* commands, an OpenClaw boot — waits for the same update the post-ready
|
|
914
|
+
* fire started instead of querying a stale index and aborting the run in
|
|
915
|
+
* flight. Resolves true when the index is already synced or no sync is
|
|
916
|
+
* owed (maintenance disabled); false when the joined sync failed.
|
|
917
|
+
*/
|
|
918
|
+
async joinStartupSearchSync(signal?: AbortSignal): Promise<boolean> {
|
|
919
|
+
return this.searchSync().joinStartupSearchSync(signal);
|
|
897
920
|
}
|
|
898
921
|
|
|
899
922
|
/**
|
|
@@ -911,288 +934,19 @@ export class OrchestratorInitCoordinator {
|
|
|
911
934
|
* Returns true if the sync succeeded (QMD now available), false otherwise.
|
|
912
935
|
*/
|
|
913
936
|
async startupSearchSync(signal?: AbortSignal): Promise<boolean> {
|
|
914
|
-
|
|
915
|
-
if (ensured.state !== "ready") return false;
|
|
916
|
-
const { epoch, discovery } = ensured;
|
|
917
|
-
// A caller whose own signal aborted must not dispatch update work even
|
|
918
|
-
// when joined callers kept the shared ensure alive to a ready result.
|
|
919
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
920
|
-
log.debug("startupSearchSync: aborted or retired after the shared backend ensure");
|
|
921
|
-
return false;
|
|
922
|
-
}
|
|
923
|
-
const namespaces = discovery.namespaces;
|
|
924
|
-
|
|
925
|
-
// Run index update — namespace-aware when enabled.
|
|
926
|
-
// qmd.update() swallows errors internally, so we: (1) snapshot fail/run
|
|
927
|
-
// timestamps, (2) reset throttles so the update isn't skipped by stale
|
|
928
|
-
// backoff, and (3) verify timestamps after update to confirm it executed
|
|
929
|
-
// and didn't fail silently.
|
|
930
|
-
// The abort signal is forwarded into the QMD subprocess call so the
|
|
931
|
-
// long-running `qmd update` process is killed promptly on shutdown.
|
|
932
|
-
if (resolveQmdCapabilities(this.deps.config).qmdMaintenance) {
|
|
933
|
-
try {
|
|
934
|
-
const failTsBefore = "lastUpdateFailedAtMs" in this.deps.qmd
|
|
935
|
-
? (this.deps.qmd as any).lastUpdateFailedAtMs as number | null
|
|
936
|
-
: null;
|
|
937
|
-
const hasRunTs = "lastUpdateRanAtMs" in this.deps.qmd;
|
|
938
|
-
if ("resetUpdateThrottles" in this.deps.qmd) {
|
|
939
|
-
(this.deps.qmd as any).resetUpdateThrottles();
|
|
940
|
-
}
|
|
941
|
-
log.info("startupSearchSync: updating index to match current disk state");
|
|
942
|
-
const updateAbort = this.linkedEpochAbortController(epoch, signal);
|
|
943
|
-
let namespacesUpdated = 0;
|
|
944
|
-
try {
|
|
945
|
-
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
946
|
-
namespacesUpdated = await this.deps.namespaceSearchRouter.updateNamespaces(
|
|
947
|
-
namespaces,
|
|
948
|
-
{ signal: updateAbort.controller.signal },
|
|
949
|
-
);
|
|
950
|
-
} else {
|
|
951
|
-
await this.deps.qmd.update({ signal: updateAbort.controller.signal });
|
|
952
|
-
}
|
|
953
|
-
} finally {
|
|
954
|
-
updateAbort.dispose();
|
|
955
|
-
}
|
|
956
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
957
|
-
log.debug("startupSearchSync: aborted or retired after update");
|
|
958
|
-
return false;
|
|
959
|
-
}
|
|
960
|
-
const failTsAfter = "lastUpdateFailedAtMs" in this.deps.qmd
|
|
961
|
-
? (this.deps.qmd as any).lastUpdateFailedAtMs as number | null
|
|
962
|
-
: null;
|
|
963
|
-
const runTsAfter = hasRunTs
|
|
964
|
-
? (this.deps.qmd as any).lastUpdateRanAtMs as number | null
|
|
965
|
-
: null;
|
|
966
|
-
if (failTsAfter !== null && failTsAfter !== failTsBefore) {
|
|
967
|
-
log.warn("startupSearchSync: update silently failed (detected via fail timestamp)");
|
|
968
|
-
return false;
|
|
969
|
-
}
|
|
970
|
-
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
971
|
-
if (namespacesUpdated === 0) {
|
|
972
|
-
log.warn("startupSearchSync: no namespace backends were eligible for update (all unavailable or collections missing)");
|
|
973
|
-
return false;
|
|
974
|
-
}
|
|
975
|
-
log.info(`startupSearchSync: namespace updates succeeded (${namespacesUpdated}/${namespaces.length} namespaces updated)`);
|
|
976
|
-
} else if (hasRunTs && runTsAfter === null) {
|
|
977
|
-
log.warn("startupSearchSync: update was throttled/skipped (run timestamp is null after reset + update)");
|
|
978
|
-
return false;
|
|
979
|
-
}
|
|
980
|
-
log.info("startupSearchSync: sync complete");
|
|
981
|
-
} catch (err) {
|
|
982
|
-
log.warn(`startupSearchSync: update failed: ${err}`);
|
|
983
|
-
return false;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
// Warmup search to pre-load embedding models
|
|
988
|
-
if (!signal?.aborted && this.isCurrentStartupEpoch(epoch)) {
|
|
989
|
-
const warmupAbort = this.linkedEpochAbortController(epoch, signal);
|
|
990
|
-
try {
|
|
991
|
-
await this.deps.qmd.search(
|
|
992
|
-
"warmup",
|
|
993
|
-
this.deps.config.defaultNamespace,
|
|
994
|
-
1,
|
|
995
|
-
undefined,
|
|
996
|
-
{ signal: warmupAbort.controller.signal },
|
|
997
|
-
);
|
|
998
|
-
log.info("startupSearchSync: warmup complete");
|
|
999
|
-
} catch (err) {
|
|
1000
|
-
log.debug(`startupSearchSync: warmup search failed (non-fatal): ${err}`);
|
|
1001
|
-
} finally {
|
|
1002
|
-
warmupAbort.dispose();
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
return discovery.complete;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* The shared readiness half of the startup sync: probe, catalog-union
|
|
1011
|
-
* namespace discovery, per-namespace collection ensure, and the
|
|
1012
|
-
* missing-collection noop swap. `startupSearchReadySync` exposes this for
|
|
1013
|
-
* the awaited ready path; `startupSearchSync` layers the corpus update and
|
|
1014
|
-
* warm-up search on top for the post-ready retry loop (#3518). Concurrent
|
|
1015
|
-
* callers join one in-flight `runStartupSearchBackend` so nobody observes
|
|
1016
|
-
* the mid-run state where probe() has already flipped isAvailable() (#3518
|
|
1017
|
-
* second read).
|
|
1018
|
-
*/
|
|
1019
|
-
private ensureStartupSearchBackend(
|
|
1020
|
-
signal?: AbortSignal,
|
|
1021
|
-
): Promise<StartupBackendEnsure> {
|
|
1022
|
-
if (signal?.aborted) return Promise.resolve({ state: "retired" });
|
|
1023
|
-
// Share one backend bring-up across concurrent callers (#3518 second
|
|
1024
|
-
// read): probe() flips isAvailable() before the collection ensure and the
|
|
1025
|
-
// missing-collection noop swap finish, so a readiness caller arriving
|
|
1026
|
-
// mid-run must await the SAME run — never observe the half-finished state
|
|
1027
|
-
// or start a second probe/ensure. Three boundaries keep the sharing safe
|
|
1028
|
-
// (#3518 third read): the flight is joined only while its epoch is still
|
|
1029
|
-
// current and it has not been abandoned, so a caller after a lifecycle
|
|
1030
|
-
// restart runs its own ensure instead of inheriting "retired"; and the
|
|
1031
|
-
// shared run aborts only when its epoch retires or every participating
|
|
1032
|
-
// caller's signal has aborted — never because one caller's per-attempt
|
|
1033
|
-
// timeout fired while other callers still hold it.
|
|
1034
|
-
let flight = this.startupBackendEnsureFlight;
|
|
1035
|
-
if (
|
|
1036
|
-
!flight ||
|
|
1037
|
-
!this.isCurrentStartupEpoch(flight.epoch) ||
|
|
1038
|
-
flight.controller.signal.aborted
|
|
1039
|
-
) {
|
|
1040
|
-
const epoch = this.currentOrNewStartupEpoch();
|
|
1041
|
-
if (epoch === null) return Promise.resolve({ state: "retired" });
|
|
1042
|
-
const controller = new AbortController();
|
|
1043
|
-
const run = this.runStartupSearchBackend(epoch, controller.signal);
|
|
1044
|
-
const next: StartupBackendEnsureFlight = {
|
|
1045
|
-
epoch,
|
|
1046
|
-
promise: run,
|
|
1047
|
-
controller,
|
|
1048
|
-
liveCallers: 0,
|
|
1049
|
-
cleanup: [],
|
|
1050
|
-
};
|
|
1051
|
-
this.startupBackendEnsureFlight = next;
|
|
1052
|
-
// run.then(clear, clear) clears the flight on settle in both directions
|
|
1053
|
-
// without creating a second derived promise that could reject
|
|
1054
|
-
// unhandled; settle also removes every registered caller listener.
|
|
1055
|
-
const settle = () => {
|
|
1056
|
-
if (this.startupBackendEnsureFlight === next) {
|
|
1057
|
-
this.startupBackendEnsureFlight = undefined;
|
|
1058
|
-
}
|
|
1059
|
-
for (const remove of next.cleanup) remove();
|
|
1060
|
-
};
|
|
1061
|
-
run.then(settle, settle);
|
|
1062
|
-
flight = next;
|
|
1063
|
-
}
|
|
1064
|
-
// Each caller holds the shared run open until its own signal aborts; the
|
|
1065
|
-
// last live caller's abort cancels the run for everyone.
|
|
1066
|
-
flight.liveCallers += 1;
|
|
1067
|
-
if (signal) {
|
|
1068
|
-
const held = flight;
|
|
1069
|
-
// An aborted caller releases its slot and settles its own wait as
|
|
1070
|
-
// "retired" — it must not stay parked on the shared run while live
|
|
1071
|
-
// callers keep it going.
|
|
1072
|
-
return new Promise<StartupBackendEnsure>((resolve, reject) => {
|
|
1073
|
-
const onCallerAbort = () => {
|
|
1074
|
-
held.liveCallers -= 1;
|
|
1075
|
-
if (held.liveCallers <= 0) held.controller.abort();
|
|
1076
|
-
resolve({ state: "retired" });
|
|
1077
|
-
};
|
|
1078
|
-
signal.addEventListener("abort", onCallerAbort, { once: true });
|
|
1079
|
-
held.cleanup.push(() => signal.removeEventListener("abort", onCallerAbort));
|
|
1080
|
-
held.promise.then(
|
|
1081
|
-
(result) => {
|
|
1082
|
-
signal.removeEventListener("abort", onCallerAbort);
|
|
1083
|
-
resolve(result);
|
|
1084
|
-
},
|
|
1085
|
-
(err) => {
|
|
1086
|
-
signal.removeEventListener("abort", onCallerAbort);
|
|
1087
|
-
reject(err);
|
|
1088
|
-
},
|
|
1089
|
-
);
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
return flight.promise;
|
|
937
|
+
return this.searchSync().startupSearchSync(signal);
|
|
1093
938
|
}
|
|
1094
939
|
|
|
1095
|
-
private
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
log.debug("startupSearchSync: aborted or retired after probe");
|
|
1107
|
-
return { state: "retired" };
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
log.info(`startupSearchSync: backend now available ${this.deps.qmd.debugStatus()}`);
|
|
1111
|
-
|
|
1112
|
-
// Clear namespace router cache so re-probe picks up newly available backends
|
|
1113
|
-
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
1114
|
-
this.deps.namespaceSearchRouter.clearCache();
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
// Ensure collections — namespace-aware when enabled.
|
|
1118
|
-
// Use the catalog-union namespace set (issue #1499 sweep, same class as
|
|
1119
|
-
// NHZEV): this is the QMD startup-recovery sync that ensures collections AND
|
|
1120
|
-
// lets `startupSearchSync` run `updateNamespaces(...)` over the SAME
|
|
1121
|
-
// `namespaces` set. A dynamic namespace that exists only in the persisted
|
|
1122
|
-
// catalog must be ensured and re-synced here too, otherwise after a
|
|
1123
|
-
// backend-was-unavailable-at-boot recovery its collection stays stale.
|
|
1124
|
-
// Falls back to the configured set on any catalog read failure.
|
|
1125
|
-
const discovery = await this.startupNamespaces(epoch);
|
|
1126
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
1127
|
-
log.debug("startupSearchSync: aborted or retired after namespace discovery");
|
|
1128
|
-
return { state: "retired" };
|
|
1129
|
-
}
|
|
1130
|
-
const namespaces = discovery.namespaces;
|
|
1131
|
-
|
|
1132
|
-
const states = await Promise.all(
|
|
1133
|
-
namespaces.map(async (namespace) => {
|
|
1134
|
-
const epochAbort = this.linkedEpochAbortController(epoch, signal);
|
|
1135
|
-
try {
|
|
1136
|
-
return {
|
|
1137
|
-
namespace,
|
|
1138
|
-
state: resolveNamespaceCapabilities(this.deps.config).namespaces
|
|
1139
|
-
? await this.deps.namespaceSearchRouter.ensureNamespaceCollection(
|
|
1140
|
-
namespace,
|
|
1141
|
-
{ signal: epochAbort.controller.signal },
|
|
1142
|
-
)
|
|
1143
|
-
: await this.deps.qmd.ensureCollection(
|
|
1144
|
-
this.deps.config.memoryDir,
|
|
1145
|
-
this.deps.config.qmdCollection,
|
|
1146
|
-
{ signal: epochAbort.controller.signal },
|
|
1147
|
-
),
|
|
1148
|
-
};
|
|
1149
|
-
} finally {
|
|
1150
|
-
epochAbort.dispose();
|
|
1151
|
-
}
|
|
1152
|
-
}),
|
|
1153
|
-
);
|
|
1154
|
-
|
|
1155
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
1156
|
-
log.debug("startupSearchSync: aborted or retired after ensureCollection");
|
|
1157
|
-
return { state: "retired" };
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
const defaultState =
|
|
1161
|
-
states.find((e) => e.namespace === this.deps.config.defaultNamespace)?.state ?? "unknown";
|
|
1162
|
-
if (defaultState === "missing") {
|
|
1163
|
-
await this.deps.disposeSearchBackendIfNeeded();
|
|
1164
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
1165
|
-
log.debug("startupSearchSync: aborted or retired while disposing a missing backend");
|
|
1166
|
-
return { state: "retired" };
|
|
1167
|
-
}
|
|
1168
|
-
// Reset the real backend's available flag before replacing it with noop.
|
|
1169
|
-
// probe() set available=true earlier in this call; without this reset,
|
|
1170
|
-
// any code that captured a reference to the old backend (e.g. a concurrent
|
|
1171
|
-
// recall() that read this.deps.qmd before the reassignment) would observe
|
|
1172
|
-
// isAvailable()===true against a backend with a missing collection.
|
|
1173
|
-
if ("available" in this.deps.qmd) {
|
|
1174
|
-
// SAFETY: the concrete backend owns `available`; the SearchBackend interface does not declare it.
|
|
1175
|
-
(this.deps.qmd as any).available = false;
|
|
1176
|
-
}
|
|
1177
|
-
this.deps.qmd = new NoopSearchBackend();
|
|
1178
|
-
log.warn("startupSearchSync: search collection missing; disabling search (fallback retrieval remains enabled)");
|
|
1179
|
-
return { state: "missing" };
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
// "unknown" means the collection check could not determine the state
|
|
1183
|
-
// (timeout, cancelled auto-create, failed recheck). Retrieval stays
|
|
1184
|
-
// fail-open on the probed backend, but the ensure is unverified: neither
|
|
1185
|
-
// the readiness sync nor the full sync may claim success — the next
|
|
1186
|
-
// attempt re-checks, and the warm-up gate counts this as degraded
|
|
1187
|
-
// rather than warmed (#3518 third read). Explicit "skipped" (remote or
|
|
1188
|
-
// daemon-only modes that run no local check) still counts as ready.
|
|
1189
|
-
if (defaultState === "unknown") {
|
|
1190
|
-
log.warn(
|
|
1191
|
-
"startupSearchSync: collection check could not verify the default collection; the sync stays unready until a retry verifies it",
|
|
1192
|
-
);
|
|
1193
|
-
return { state: "degraded" };
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
return { state: "ready", epoch, discovery };
|
|
940
|
+
private searchSyncRunner: StartupSearchSyncRunner | undefined;
|
|
941
|
+
private searchSync(): StartupSearchSyncRunner {
|
|
942
|
+
this.searchSyncRunner ??= new StartupSearchSyncRunner({
|
|
943
|
+
deps: this.deps,
|
|
944
|
+
currentOrNewStartupEpoch: () => this.currentOrNewStartupEpoch(),
|
|
945
|
+
isCurrentStartupEpoch: (epoch) => this.isCurrentStartupEpoch(epoch),
|
|
946
|
+
linkedEpochAbortController: (epoch, signal) => this.linkedEpochAbortController(epoch, signal),
|
|
947
|
+
probeForStartupEpoch: (epoch, signal) => this.probeForStartupEpoch(epoch, signal),
|
|
948
|
+
startupNamespaces: (epoch) => this.startupNamespaces(epoch),
|
|
949
|
+
});
|
|
950
|
+
return this.searchSyncRunner;
|
|
1197
951
|
}
|
|
1198
952
|
}
|
|
@@ -16,6 +16,7 @@ import { log } from "../logger.js";
|
|
|
16
16
|
import { resolvePrincipal } from "../namespaces/principal.js";
|
|
17
17
|
import { type RecallSectionAppendOptions, type RecallSectionBuckets } from "./recall-section-coordinator.js";
|
|
18
18
|
import { type RecallInvocationOptions, abortRecallError } from "./orchestrator-helpers.js";
|
|
19
|
+
import { isAbortError } from "../abort-error.js";
|
|
19
20
|
import { ProfilingCollector } from "../profiling.js";
|
|
20
21
|
import { trustResultFor, type TrustStageResultItem } from "../trust-score-stage.js";
|
|
21
22
|
import type { RecallResultFormatter } from "./recall-result-formatter.js";
|
|
@@ -24,6 +25,7 @@ import { stateViewPacketActive } from "../recall-state-view-anchors.js";
|
|
|
24
25
|
import { resultStateViewKey, stateViewPacketKeys } from "../recall-state-view.js";
|
|
25
26
|
import { applyRecallStateViews } from "../recall-state-view-wire.js";
|
|
26
27
|
import { composeRecallContext, type RecallContextComposition } from "../recall-context-composition.js";
|
|
28
|
+
import { clientDeadlineTimerMs, resolveClientDeadlineAtMs } from "../recall-qos.js";
|
|
27
29
|
import {
|
|
28
30
|
memoriesToStandingEntries,
|
|
29
31
|
prefixStandingMemoryBlock,
|
|
@@ -87,7 +89,17 @@ export class RecallEntryCoordinator {
|
|
|
87
89
|
const caps = resolveCapabilities(this.deps.config);
|
|
88
90
|
const graphCaps = resolveGraphConstructionCapabilities(this.deps.config); // #1566 Cluster A
|
|
89
91
|
const abortController = new AbortController();
|
|
92
|
+
let clientDeadlineFired = false;
|
|
93
|
+
let clientDeadlineHandle: NodeJS.Timeout | null = null;
|
|
94
|
+
let outerTimeoutFired = false;
|
|
90
95
|
const onAbort = () => {
|
|
96
|
+
// Real caller cancellation retires the deadline timer too: a late fire
|
|
97
|
+
// must not flip clientDeadlineFired and reclassify the abort as a
|
|
98
|
+
// timeout (#3514 review).
|
|
99
|
+
if (clientDeadlineHandle) {
|
|
100
|
+
clearTimeout(clientDeadlineHandle);
|
|
101
|
+
clientDeadlineHandle = null;
|
|
102
|
+
}
|
|
91
103
|
abortController.abort();
|
|
92
104
|
};
|
|
93
105
|
if (options.abortSignal?.aborted) {
|
|
@@ -106,6 +118,19 @@ export class RecallEntryCoordinator {
|
|
|
106
118
|
throw new Error("authentication required: namespaces are enabled and no principal was supplied");
|
|
107
119
|
}
|
|
108
120
|
|
|
121
|
+
// Resolve the client's absolute deadline ONCE at method entry (issue
|
|
122
|
+
// #3499): a relative budget then counts from arrival, and this abort
|
|
123
|
+
// timer bounds the init gate, standing reads, and the inner race. It is
|
|
124
|
+
// armed after validation so a rejecting call never leaks the timer.
|
|
125
|
+
const clientDeadlineAtMs = resolveClientDeadlineAtMs(options.deadlineMs, Date.now());
|
|
126
|
+
if (clientDeadlineAtMs !== null) {
|
|
127
|
+
clientDeadlineHandle = setTimeout(() => {
|
|
128
|
+
if (options.abortSignal?.aborted) return;
|
|
129
|
+
clientDeadlineFired = true;
|
|
130
|
+
abortController.abort();
|
|
131
|
+
}, clientDeadlineTimerMs(clientDeadlineAtMs, Date.now()));
|
|
132
|
+
}
|
|
133
|
+
|
|
109
134
|
// Wait for initialization to complete before attempting recall. The timeout
|
|
110
135
|
// is configurable so OpenClaw's per-hook budget and Remnic's internal init
|
|
111
136
|
// gate can stay aligned during cold starts.
|
|
@@ -134,8 +159,11 @@ export class RecallEntryCoordinator {
|
|
|
134
159
|
if (initGateTimeoutHandle) clearTimeout(initGateTimeoutHandle);
|
|
135
160
|
if (onInitGateAbort)
|
|
136
161
|
abortController.signal.removeEventListener("abort", onInitGateAbort);
|
|
137
|
-
|
|
162
|
+
// A fired client deadline is a timeout, not cancellation — the flow
|
|
163
|
+
// below then degrades to the missing-note response instead of "".
|
|
164
|
+
if (gateResult === "aborted" && !clientDeadlineFired) {
|
|
138
165
|
this.deps.logRecallFailure(abortRecallError("recall aborted before init"));
|
|
166
|
+
if (clientDeadlineHandle) clearTimeout(clientDeadlineHandle);
|
|
139
167
|
return "";
|
|
140
168
|
}
|
|
141
169
|
if (gateResult === "timeout") {
|
|
@@ -153,6 +181,7 @@ export class RecallEntryCoordinator {
|
|
|
153
181
|
"[secure-store locked] Memory store is encrypted and locked. " +
|
|
154
182
|
"Unlock the secure-store inside this daemon process, or restart the daemon through a secure-store aware launcher that installs the key.";
|
|
155
183
|
log.warn("recall blocked: secure-store is locked");
|
|
184
|
+
if (clientDeadlineHandle) clearTimeout(clientDeadlineHandle);
|
|
156
185
|
return lockedMsg;
|
|
157
186
|
}
|
|
158
187
|
|
|
@@ -214,9 +243,23 @@ export class RecallEntryCoordinator {
|
|
|
214
243
|
})
|
|
215
244
|
: innerObserver,
|
|
216
245
|
};
|
|
246
|
+
// Forward the RESOLVED absolute deadline: a relative deadlineMs re-read
|
|
247
|
+
// from recallStart downstream would restart the budget after the init
|
|
248
|
+
// gate and standing reads already consumed part of it (#3514 review).
|
|
249
|
+
if (clientDeadlineAtMs !== null) recallOptions.deadlineMs = clientDeadlineAtMs;
|
|
217
250
|
try {
|
|
218
251
|
const recallPromise = this.deps.recallInternal(prompt, sessionKey, recallOptions, caps, graphCaps);
|
|
219
|
-
const
|
|
252
|
+
const configuredOuterMs = this.deps.config.recallOuterTimeoutMs ?? 75_000;
|
|
253
|
+
// The client's own deadlineMs (issue #3499) bounds this entry race
|
|
254
|
+
// too — phase-one work can stall outside every section budget. The
|
|
255
|
+
// deadline resolved at method entry already deducts elapsed init and
|
|
256
|
+
// standing-read time from the remaining budget here.
|
|
257
|
+
const clientRemainingMs =
|
|
258
|
+
clientDeadlineAtMs === null ? null : clientDeadlineTimerMs(clientDeadlineAtMs, Date.now());
|
|
259
|
+
const RECALL_TIMEOUT_MS =
|
|
260
|
+
clientRemainingMs === null
|
|
261
|
+
? configuredOuterMs
|
|
262
|
+
: Math.min(configuredOuterMs > 0 ? configuredOuterMs : Number.POSITIVE_INFINITY, clientRemainingMs);
|
|
220
263
|
if (RECALL_TIMEOUT_MS <= 0) {
|
|
221
264
|
return prefixStandingMemoryBlock(await recallPromise, standingText, standingBudget);
|
|
222
265
|
}
|
|
@@ -224,6 +267,12 @@ export class RecallEntryCoordinator {
|
|
|
224
267
|
let timeoutHandle: NodeJS.Timeout | null = null;
|
|
225
268
|
const timeoutPromise = new Promise<string>((_, reject) => {
|
|
226
269
|
timeoutHandle = setTimeout(() => {
|
|
270
|
+
// Mark BEFORE the synchronous abort(): abort-aware code rejecting
|
|
271
|
+
// inside abort() reaches the catch with an AbortError, and only
|
|
272
|
+
// this flag keeps it classified as a timeout. A caller abort that
|
|
273
|
+
// already landed keeps its cancellation meaning — the late-firing
|
|
274
|
+
// race timer must not reclassify it (#3514 review).
|
|
275
|
+
if (!options.abortSignal?.aborted) outerTimeoutFired = true;
|
|
227
276
|
abortController.abort();
|
|
228
277
|
reject(new Error("recall timeout"));
|
|
229
278
|
}, RECALL_TIMEOUT_MS);
|
|
@@ -258,9 +307,14 @@ export class RecallEntryCoordinator {
|
|
|
258
307
|
} catch (err) {
|
|
259
308
|
this.deps.logRecallFailure(err);
|
|
260
309
|
this.deps.profiler.endTrace();
|
|
261
|
-
|
|
310
|
+
// A fired client deadline is a timeout, not caller cancellation: the
|
|
311
|
+
// caller still expects the degraded response, not "" (issue #3499).
|
|
312
|
+
const deadlineFired = clientDeadlineFired || outerTimeoutFired;
|
|
313
|
+
const missing = options.abortSignal?.aborted && !deadlineFired
|
|
262
314
|
? null
|
|
263
|
-
: recallFailureComposition(
|
|
315
|
+
: recallFailureComposition(
|
|
316
|
+
deadlineFired && isAbortError(err) ? new Error("recall timeout") : err,
|
|
317
|
+
);
|
|
264
318
|
if (!missing) return "";
|
|
265
319
|
if (standingText.length > 0) {
|
|
266
320
|
missing.context = prefixStandingMemoryBlock(missing.context ?? "", standingText, standingBudget);
|
|
@@ -270,6 +324,7 @@ export class RecallEntryCoordinator {
|
|
|
270
324
|
});
|
|
271
325
|
return composeRecallContext(missing);
|
|
272
326
|
} finally {
|
|
327
|
+
if (clientDeadlineHandle) clearTimeout(clientDeadlineHandle);
|
|
273
328
|
options.abortSignal?.removeEventListener("abort", onAbort);
|
|
274
329
|
}
|
|
275
330
|
}
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
createBoundedCoreSectionRunner,
|
|
58
58
|
createRecallSectionMetricRecorder,
|
|
59
59
|
resolveRecallCoreSectionDeadlineMs,
|
|
60
|
+
resolveRecallOuterDeadlineAtMs,
|
|
60
61
|
} from "../recall-qos.js";
|
|
61
62
|
import { buildRecallQueryPolicy } from "../recall-query-policy.js";
|
|
62
63
|
import { type GraphRecallExpandedEntry, type LastRecallSnapshot } from "../recall-state.js";
|
|
@@ -172,17 +173,16 @@ export class RecallInternalCoordinator {
|
|
|
172
173
|
// section, against the request budget still left when that section starts.
|
|
173
174
|
const recallSectionDeadlineMs = this.deps.config.recallCoreDeadlineMs ?? 75_000;
|
|
174
175
|
const recallOuterTimeoutMs = this.deps.config.recallOuterTimeoutMs ?? 75_000;
|
|
175
|
-
const enrichmentSectionDeadlineMs =
|
|
176
|
-
this.deps.config.recallEnrichmentDeadlineMs ?? 60_000;
|
|
176
|
+
const enrichmentSectionDeadlineMs = this.deps.config.recallEnrichmentDeadlineMs ?? 60_000;
|
|
177
177
|
// Wrap entire recall body in try/finally so profiling trace is always closed,
|
|
178
178
|
// even on unexpected exceptions (e.g., throwIfRecallAborted, phase-1 errors).
|
|
179
179
|
try {
|
|
180
|
-
const recordRecallSectionMetric =
|
|
181
|
-
timings,
|
|
182
|
-
|
|
180
|
+
const recordRecallSectionMetric =
|
|
181
|
+
createRecallSectionMetricRecorder({ timings, logger: log });
|
|
182
|
+
// The client's deadlineMs (issue #3499) caps the configured ceiling.
|
|
183
|
+
const outerDeadlineAtMs = resolveRecallOuterDeadlineAtMs({
|
|
184
|
+
recallStart, recallOuterTimeoutMs, clientDeadlineMs: options.deadlineMs,
|
|
183
185
|
});
|
|
184
|
-
const outerDeadlineAtMs =
|
|
185
|
-
recallOuterTimeoutMs > 0 ? recallStart + recallOuterTimeoutMs : null;
|
|
186
186
|
const enrichmentAbort = () =>
|
|
187
187
|
createEnrichmentAbortHandle(options.abortSignal, resolveRecallCoreSectionDeadlineMs({
|
|
188
188
|
configuredCoreDeadlineMs: enrichmentSectionDeadlineMs,
|
|
@@ -566,7 +566,7 @@ export class RecallInternalCoordinator {
|
|
|
566
566
|
this.deps.trackRecallBackgroundWrite(
|
|
567
567
|
this.deps.lastRecall.record({
|
|
568
568
|
sessionKey,
|
|
569
|
-
query:
|
|
569
|
+
query: prompt,
|
|
570
570
|
memoryIds: [],
|
|
571
571
|
namespace: selfNamespace,
|
|
572
572
|
traceId,
|
|
@@ -4932,7 +4932,7 @@ export class RecallInternalCoordinator {
|
|
|
4932
4932
|
sectionBuckets, recalledMemoryPaths,
|
|
4933
4933
|
recalledMemoryNamespaces: episodicMemoryNamespaces,
|
|
4934
4934
|
scopePlan, namespacesEnabled,
|
|
4935
|
-
enrichmentSectionDeadlineMs,
|
|
4935
|
+
enrichmentSectionDeadlineMs, outerDeadlineAtMs,
|
|
4936
4936
|
recordMetric: recordRecallSectionMetric, abortSignal: options.abortSignal,
|
|
4937
4937
|
});
|
|
4938
4938
|
} catch (err) {
|
|
@@ -5230,7 +5230,7 @@ export class RecallInternalCoordinator {
|
|
|
5230
5230
|
this.deps.trackRecallBackgroundWrite(
|
|
5231
5231
|
this.deps.lastRecall.record({
|
|
5232
5232
|
sessionKey,
|
|
5233
|
-
query:
|
|
5233
|
+
query: prompt,
|
|
5234
5234
|
memoryIds: recalledMemoryIds,
|
|
5235
5235
|
namespace: selfNamespace,
|
|
5236
5236
|
recallNamespaces,
|
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
|
|
36
36
|
export interface SessionContextDeps {
|
|
37
37
|
readonly _codingContextBySession: Map<string, CodingContext>;
|
|
38
|
+
/** First authenticated writer to an unclaimed session owns its context. */
|
|
39
|
+
readonly _codingContextOwnerBySession: Map<string, string>;
|
|
38
40
|
/** Defensive init for Object.create(prototype) fakes — creates the session-binding maps on the orchestrator. */
|
|
39
41
|
ensureSessionBindingMaps(): void;
|
|
40
42
|
_passiveCorrectionService: CorrectionService | null;
|
|
@@ -248,7 +250,7 @@ export class SessionContextCoordinator {
|
|
|
248
250
|
*
|
|
249
251
|
* Pass `null` to clear.
|
|
250
252
|
*/
|
|
251
|
-
setCodingContextForSession(sessionKey: string, codingContext: CodingContext | null): void {
|
|
253
|
+
setCodingContextForSession(sessionKey: string, codingContext: CodingContext | null, owner?: string): void {
|
|
252
254
|
if (typeof sessionKey !== "string" || sessionKey.length === 0) return;
|
|
253
255
|
// Defensive init — `Object.create(Orchestrator.prototype)` stubs in
|
|
254
256
|
// legacy tests skip class-field initializers. The init runs on the
|
|
@@ -257,9 +259,17 @@ export class SessionContextCoordinator {
|
|
|
257
259
|
this.deps.ensureSessionBindingMaps();
|
|
258
260
|
if (codingContext === null) {
|
|
259
261
|
this.deps._codingContextBySession.delete(sessionKey);
|
|
262
|
+
this.deps._codingContextOwnerBySession.delete(sessionKey);
|
|
260
263
|
return;
|
|
261
264
|
}
|
|
262
265
|
this.deps._codingContextBySession.set(sessionKey, codingContext);
|
|
266
|
+
if (owner !== undefined) this.deps._codingContextOwnerBySession.set(sessionKey, owner);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** The principal that claimed this session's coding context, if any. */
|
|
270
|
+
getCodingContextOwnerForSession(sessionKey: string | undefined): string | undefined {
|
|
271
|
+
if (!sessionKey) return undefined;
|
|
272
|
+
return this.deps._codingContextOwnerBySession?.get(sessionKey);
|
|
263
273
|
}
|
|
264
274
|
|
|
265
275
|
/**
|