@remnic/core 10.0.161 → 10.0.163
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 +68 -68
- package/dist/access-cli.js +68 -68
- package/dist/access-extraction-force-flush-preempt.js +68 -68
- package/dist/access-extraction-force-flush.js +68 -68
- package/dist/access-http-briefing.js +68 -68
- package/dist/access-http-query.js +68 -68
- package/dist/access-http.js +68 -68
- package/dist/access-identity-continuity-surface.js +68 -68
- package/dist/access-lcm-surface.js +68 -68
- package/dist/access-mcp.js +68 -68
- package/dist/access-observe-write-category.js +5 -5
- package/dist/access-observe-write-surface.js +68 -68
- package/dist/access-operations-batch.js +68 -68
- package/dist/access-operations.js +68 -68
- package/dist/access-recall-concurrency.js +68 -68
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +68 -68
- package/dist/access-recall-surface.js +68 -68
- package/dist/access-schema.js +4 -4
- package/dist/access-service.js +68 -68
- package/dist/active-recall.js +10 -10
- package/dist/briefing.js +9 -9
- package/dist/buffer.js +2 -2
- package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-GWVG7LGC.js} +2 -2
- package/dist/causal-consolidation.js +10 -10
- package/dist/{chunk-HIPHLFIQ.js → chunk-22VXXA67.js} +2 -2
- package/dist/{chunk-IFFCHE3O.js → chunk-2S3M2GLC.js} +8 -2
- package/dist/{chunk-IFFCHE3O.js.map → chunk-2S3M2GLC.js.map} +1 -1
- package/dist/{chunk-VGCK2RV3.js → chunk-3QLAOYBL.js} +2 -2
- package/dist/{chunk-6NPLVV6M.js → chunk-4HKK5HUI.js} +2 -2
- package/dist/{chunk-XTAGZXOM.js → chunk-4LPTSB5V.js} +2 -2
- package/dist/{chunk-HKOGDSNS.js → chunk-4NBUHYUV.js} +2 -2
- package/dist/{chunk-VVVFT435.js → chunk-5D4NBANY.js} +5 -5
- package/dist/{chunk-VVVFT435.js.map → chunk-5D4NBANY.js.map} +1 -1
- package/dist/{chunk-K3KSTSGM.js → chunk-5LTXYM7D.js} +2 -2
- package/dist/{chunk-M7BCA43N.js → chunk-5MXKS25U.js} +5 -5
- package/dist/{chunk-KTZNXQWL.js → chunk-6ARSFTLD.js} +2 -2
- package/dist/{chunk-773QSFFN.js → chunk-6TPWIPE3.js} +2 -2
- package/dist/{chunk-L2DACC2T.js → chunk-ARJ3KCX4.js} +2 -2
- package/dist/{chunk-6PVS6JET.js → chunk-AU6AEUFD.js} +2 -2
- package/dist/{chunk-R45L4TV6.js → chunk-BUKK5SWA.js} +6 -6
- package/dist/{chunk-JUYTXFDV.js → chunk-CGOPDXLK.js} +2 -2
- package/dist/{chunk-TGH7AU5U.js → chunk-DBVSU3HE.js} +8 -8
- package/dist/{chunk-3UKPFFMS.js → chunk-E5RJPLNL.js} +2 -2
- package/dist/{chunk-TLJV42SZ.js → chunk-EDA6CDBT.js} +2 -2
- package/dist/{chunk-ZWSSUWKO.js → chunk-EI2M2CFJ.js} +2 -2
- package/dist/{chunk-V24YLFJW.js → chunk-FNV6ZPCY.js} +6 -4
- package/dist/chunk-FNV6ZPCY.js.map +1 -0
- package/dist/{chunk-BDFOBNLX.js → chunk-FSI45NUK.js} +2 -2
- package/dist/{chunk-BFJQBCDL.js → chunk-GDAFI6HH.js} +239 -156
- package/dist/chunk-GDAFI6HH.js.map +1 -0
- package/dist/{chunk-DFK6AQWM.js → chunk-IC35ZYLM.js} +2 -2
- package/dist/{chunk-PJFSSXXY.js → chunk-JJEQRSYU.js} +2 -2
- package/dist/{chunk-5UE45DLK.js → chunk-JVIWVJ2A.js} +2 -2
- package/dist/{chunk-BNQJKWWZ.js → chunk-K3FH3LAQ.js} +4 -4
- package/dist/{chunk-UADAXWUJ.js → chunk-KR6PEAM4.js} +7 -7
- package/dist/{chunk-YKAQKIPR.js → chunk-L6BLTV4D.js} +2 -2
- package/dist/{chunk-2YJYBAR3.js → chunk-OAGTKS73.js} +2 -2
- package/dist/{chunk-BXLOS5AJ.js → chunk-OWHERGF2.js} +2 -2
- package/dist/{chunk-CA7XVRHZ.js → chunk-PCUDFWX5.js} +2 -2
- package/dist/{chunk-I6IKSDUO.js → chunk-PRE7R3RQ.js} +2 -2
- package/dist/{chunk-MWEJL436.js → chunk-QBREZ4QL.js} +2 -2
- package/dist/{chunk-TFA6HPOA.js → chunk-QCP75JGO.js} +5 -5
- package/dist/{chunk-MZETCZJF.js → chunk-QFPNWSVH.js} +5 -5
- package/dist/{chunk-52EM4UQU.js → chunk-QUC4S2D2.js} +10 -9
- package/dist/chunk-QUC4S2D2.js.map +1 -0
- package/dist/{chunk-7PCWJZXG.js → chunk-RDO6AMDL.js} +2 -2
- package/dist/{chunk-QDY4TSKK.js → chunk-RH6XWXMA.js} +3 -3
- package/dist/{chunk-BT5TAOXG.js → chunk-SBU5GDOT.js} +3 -3
- package/dist/{chunk-KJ3Z7JHF.js → chunk-SOGOHLWN.js} +1 -1
- package/dist/chunk-SOGOHLWN.js.map +1 -0
- package/dist/{chunk-TBOCVPXL.js → chunk-SRN5M4LQ.js} +3 -3
- package/dist/{chunk-NBHMEYM4.js → chunk-TFNZXOXK.js} +2 -2
- package/dist/{chunk-O7CHKXSF.js → chunk-UGQEJWR3.js} +2 -2
- package/dist/{chunk-DQEMWVMT.js → chunk-UVYI6VIX.js} +1 -1
- package/dist/{chunk-H6OTEBPK.js → chunk-V6M6N3EE.js} +2 -2
- package/dist/{chunk-AQ6GV5MU.js → chunk-VXMWTRQX.js} +2 -2
- package/dist/{chunk-PCCNK3RX.js → chunk-VXUO5JZC.js} +11 -13
- package/dist/chunk-VXUO5JZC.js.map +1 -0
- package/dist/{chunk-UR6COSJN.js → chunk-WAJL65KW.js} +3 -3
- package/dist/{chunk-V3D2OOVE.js → chunk-WRAK5LLB.js} +2 -2
- package/dist/{chunk-BTCZVBV3.js → chunk-XE4UYWW3.js} +3 -3
- package/dist/{chunk-VXKPZ6BO.js → chunk-Y7HLGKKU.js} +2 -2
- package/dist/{chunk-YAFMWQRL.js → chunk-YMC4AYJK.js} +4 -4
- package/dist/chunk-YMC4AYJK.js.map +1 -0
- package/dist/{chunk-B7F2G57I.js → chunk-YWPCDR3I.js} +2 -2
- package/dist/{chunk-NFTFMMKT.js → chunk-Z3SXC3MP.js} +2 -2
- package/dist/{chunk-DS24H6M4.js → chunk-ZRLTQ2Y7.js} +2 -2
- package/dist/cli.js +68 -68
- package/dist/coding/export-okf-codegraph.js +8 -8
- package/dist/compounding/engine.js +10 -10
- package/dist/config.js +10 -10
- package/dist/connectors/codex-materialize-runner.js +9 -9
- package/dist/connectors/index.js +9 -9
- package/dist/convergence-refresh.js +11 -11
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +11 -11
- package/dist/deep-recall-http-glue.js +5 -5
- package/dist/entity-retrieval.js +9 -9
- package/dist/explicit-capture.js +68 -68
- package/dist/extraction-error-classification.d.ts +11 -2
- package/dist/extraction-error-classification.d.ts.map +1 -1
- package/dist/extraction-error-classification.js +3 -1
- package/dist/extraction-reply-diagnostic.d.ts +4 -2
- package/dist/extraction-reply-diagnostic.d.ts.map +1 -1
- package/dist/extraction-reply-diagnostic.js +1 -1
- package/dist/extraction.js +14 -14
- package/dist/harmonic-retrieval.js +9 -9
- package/dist/index.js +74 -74
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +2 -2
- package/dist/location/index.js +10 -10
- package/dist/maintenance/memory-governance.js +9 -9
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +9 -9
- package/dist/maintenance/rebuild-memory-projection-runner.js +11 -11
- package/dist/maintenance/rebuild-memory-projection.js +10 -10
- package/dist/namespaces/migrate.js +10 -10
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.js +9 -9
- package/dist/operator-doctor-corpus.js +12 -12
- package/dist/operator-toolkit.js +17 -17
- package/dist/orchestration/backlog-scheduler.js +69 -69
- package/dist/orchestration/buffer-drain-runner.js +69 -69
- package/dist/orchestration/extraction-drain.d.ts.map +1 -1
- package/dist/orchestration/extraction-run-helpers.d.ts +7 -0
- package/dist/orchestration/extraction-run-helpers.d.ts.map +1 -1
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +17 -17
- package/dist/orchestration/orchestrator-init.d.ts +28 -1
- package/dist/orchestration/orchestrator-init.d.ts.map +1 -1
- package/dist/orchestrator.d.ts +13 -9
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +68 -68
- 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 +68 -68
- 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/resume-bundles.js +11 -11
- package/dist/search/factory.js +5 -5
- package/dist/search/index.js +9 -9
- package/dist/semantic-consolidation.js +10 -10
- package/dist/semantic-rule-promotion.js +9 -9
- package/dist/semantic-rule-verifier.js +9 -9
- package/dist/source-agent-qualifier.js +11 -11
- package/dist/standup/build.js +9 -9
- package/dist/storage.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 +9 -9
- package/dist/types-extraction-failure.d.ts +12 -0
- package/dist/types-extraction-failure.d.ts.map +1 -0
- package/dist/types-extraction-failure.js +1 -0
- package/dist/types-extraction-failure.js.map +1 -0
- package/dist/types.d.ts +3 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +9 -9
- package/dist/who-knows-cli.js +10 -10
- package/dist/who-knows.js +9 -9
- package/package.json +2 -2
- package/src/access-observe-replay-durability.test.ts +23 -3
- package/src/buffer-admission-idempotency.test.ts +1 -1
- package/src/buffer-ingress-invariant.test.ts +1 -1
- package/src/config.test.ts +3 -2
- package/src/config.ts +1 -1
- package/src/extraction-error-classification.ts +13 -2
- package/src/extraction-queue-concurrency-default.test.ts +107 -0
- package/src/extraction-reply-diagnostic-wiring.test.ts +4 -4
- package/src/extraction-reply-diagnostic.test.ts +3 -1
- package/src/extraction-reply-diagnostic.ts +9 -1
- package/src/extraction.ts +6 -6
- package/src/orchestration/extraction-drain-parts.test.ts +33 -0
- package/src/orchestration/extraction-drain.ts +7 -1
- package/src/orchestration/extraction-queue-coordinator.ts +1 -1
- package/src/orchestration/extraction-run-helpers.ts +14 -0
- package/src/orchestration/extraction-run.test.ts +28 -5
- package/src/orchestration/extraction-run.ts +11 -13
- package/src/orchestration/orchestrator-init.ts +259 -111
- package/src/orchestrator-extraction-queue.test.ts +3 -3
- package/src/orchestrator-flush.test.ts +43 -34
- package/src/orchestrator-init.test.ts +66 -3
- package/src/orchestrator-startup-ready-path.test.ts +506 -0
- package/src/orchestrator.ts +18 -9
- package/src/storage.ts +1 -1
- package/src/types-extraction-failure.ts +11 -0
- package/src/types.ts +3 -9
- package/dist/chunk-52EM4UQU.js.map +0 -1
- package/dist/chunk-BFJQBCDL.js.map +0 -1
- package/dist/chunk-KJ3Z7JHF.js.map +0 -1
- package/dist/chunk-PCCNK3RX.js.map +0 -1
- package/dist/chunk-V24YLFJW.js.map +0 -1
- package/dist/chunk-YAFMWQRL.js.map +0 -1
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-GWVG7LGC.js.map} +0 -0
- /package/dist/{chunk-HIPHLFIQ.js.map → chunk-22VXXA67.js.map} +0 -0
- /package/dist/{chunk-VGCK2RV3.js.map → chunk-3QLAOYBL.js.map} +0 -0
- /package/dist/{chunk-6NPLVV6M.js.map → chunk-4HKK5HUI.js.map} +0 -0
- /package/dist/{chunk-XTAGZXOM.js.map → chunk-4LPTSB5V.js.map} +0 -0
- /package/dist/{chunk-HKOGDSNS.js.map → chunk-4NBUHYUV.js.map} +0 -0
- /package/dist/{chunk-K3KSTSGM.js.map → chunk-5LTXYM7D.js.map} +0 -0
- /package/dist/{chunk-M7BCA43N.js.map → chunk-5MXKS25U.js.map} +0 -0
- /package/dist/{chunk-KTZNXQWL.js.map → chunk-6ARSFTLD.js.map} +0 -0
- /package/dist/{chunk-773QSFFN.js.map → chunk-6TPWIPE3.js.map} +0 -0
- /package/dist/{chunk-L2DACC2T.js.map → chunk-ARJ3KCX4.js.map} +0 -0
- /package/dist/{chunk-6PVS6JET.js.map → chunk-AU6AEUFD.js.map} +0 -0
- /package/dist/{chunk-R45L4TV6.js.map → chunk-BUKK5SWA.js.map} +0 -0
- /package/dist/{chunk-JUYTXFDV.js.map → chunk-CGOPDXLK.js.map} +0 -0
- /package/dist/{chunk-TGH7AU5U.js.map → chunk-DBVSU3HE.js.map} +0 -0
- /package/dist/{chunk-3UKPFFMS.js.map → chunk-E5RJPLNL.js.map} +0 -0
- /package/dist/{chunk-TLJV42SZ.js.map → chunk-EDA6CDBT.js.map} +0 -0
- /package/dist/{chunk-ZWSSUWKO.js.map → chunk-EI2M2CFJ.js.map} +0 -0
- /package/dist/{chunk-BDFOBNLX.js.map → chunk-FSI45NUK.js.map} +0 -0
- /package/dist/{chunk-DFK6AQWM.js.map → chunk-IC35ZYLM.js.map} +0 -0
- /package/dist/{chunk-PJFSSXXY.js.map → chunk-JJEQRSYU.js.map} +0 -0
- /package/dist/{chunk-5UE45DLK.js.map → chunk-JVIWVJ2A.js.map} +0 -0
- /package/dist/{chunk-BNQJKWWZ.js.map → chunk-K3FH3LAQ.js.map} +0 -0
- /package/dist/{chunk-UADAXWUJ.js.map → chunk-KR6PEAM4.js.map} +0 -0
- /package/dist/{chunk-YKAQKIPR.js.map → chunk-L6BLTV4D.js.map} +0 -0
- /package/dist/{chunk-2YJYBAR3.js.map → chunk-OAGTKS73.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-OWHERGF2.js.map} +0 -0
- /package/dist/{chunk-CA7XVRHZ.js.map → chunk-PCUDFWX5.js.map} +0 -0
- /package/dist/{chunk-I6IKSDUO.js.map → chunk-PRE7R3RQ.js.map} +0 -0
- /package/dist/{chunk-MWEJL436.js.map → chunk-QBREZ4QL.js.map} +0 -0
- /package/dist/{chunk-TFA6HPOA.js.map → chunk-QCP75JGO.js.map} +0 -0
- /package/dist/{chunk-MZETCZJF.js.map → chunk-QFPNWSVH.js.map} +0 -0
- /package/dist/{chunk-7PCWJZXG.js.map → chunk-RDO6AMDL.js.map} +0 -0
- /package/dist/{chunk-QDY4TSKK.js.map → chunk-RH6XWXMA.js.map} +0 -0
- /package/dist/{chunk-BT5TAOXG.js.map → chunk-SBU5GDOT.js.map} +0 -0
- /package/dist/{chunk-TBOCVPXL.js.map → chunk-SRN5M4LQ.js.map} +0 -0
- /package/dist/{chunk-NBHMEYM4.js.map → chunk-TFNZXOXK.js.map} +0 -0
- /package/dist/{chunk-O7CHKXSF.js.map → chunk-UGQEJWR3.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-UVYI6VIX.js.map} +0 -0
- /package/dist/{chunk-H6OTEBPK.js.map → chunk-V6M6N3EE.js.map} +0 -0
- /package/dist/{chunk-AQ6GV5MU.js.map → chunk-VXMWTRQX.js.map} +0 -0
- /package/dist/{chunk-UR6COSJN.js.map → chunk-WAJL65KW.js.map} +0 -0
- /package/dist/{chunk-V3D2OOVE.js.map → chunk-WRAK5LLB.js.map} +0 -0
- /package/dist/{chunk-BTCZVBV3.js.map → chunk-XE4UYWW3.js.map} +0 -0
- /package/dist/{chunk-VXKPZ6BO.js.map → chunk-Y7HLGKKU.js.map} +0 -0
- /package/dist/{chunk-B7F2G57I.js.map → chunk-YWPCDR3I.js.map} +0 -0
- /package/dist/{chunk-NFTFMMKT.js.map → chunk-Z3SXC3MP.js.map} +0 -0
- /package/dist/{chunk-DS24H6M4.js.map → chunk-ZRLTQ2Y7.js.map} +0 -0
|
@@ -47,6 +47,7 @@ import type { PluginConfig } from "../types.js";
|
|
|
47
47
|
import { type UtilityRuntimeValues, loadUtilityRuntimeValues } from "../utility-runtime.js";
|
|
48
48
|
import { WearablesService } from "../wearables/service.js";
|
|
49
49
|
import { startupDiscoveryWithTimeout } from "./startup-collection-checks.js";
|
|
50
|
+
import type { SearchCollectionState } from "./orchestrator-helpers.js";
|
|
50
51
|
import type { MeetingsService } from "../meetings/service.js";
|
|
51
52
|
import {
|
|
52
53
|
COMPACTION_SIGNAL_MAX_AGE_MS,
|
|
@@ -99,6 +100,23 @@ export interface OrchestratorInitDeps {
|
|
|
99
100
|
wearablesAutoSyncHandle: { stop(): Promise<void> } | null;
|
|
100
101
|
}
|
|
101
102
|
|
|
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
|
+
|
|
102
120
|
export class OrchestratorInitCoordinator {
|
|
103
121
|
private nextStartupEpoch = 0;
|
|
104
122
|
private activeStartupEpoch: number | null = null;
|
|
@@ -106,6 +124,7 @@ export class OrchestratorInitCoordinator {
|
|
|
106
124
|
private maintenanceNamespacesFlight:
|
|
107
125
|
| { epoch: number; promise: Promise<string[]> }
|
|
108
126
|
| undefined;
|
|
127
|
+
private startupBackendEnsureFlight: StartupBackendEnsureFlight | undefined;
|
|
109
128
|
private correctionCatalogFlight:
|
|
110
129
|
| { epoch: number; promise: Promise<Awaited<ReturnType<NamespaceCatalog["listNamespaces"]>>> }
|
|
111
130
|
| undefined;
|
|
@@ -116,6 +135,9 @@ export class OrchestratorInitCoordinator {
|
|
|
116
135
|
| undefined;
|
|
117
136
|
private readonly startupStorageWrites = new Set<Promise<void>>();
|
|
118
137
|
private readonly startupWarmups = new Set<Promise<void>>();
|
|
138
|
+
/** Default-namespace collection state from the initialize() check,
|
|
139
|
+
* epoch-scoped so a retired lifecycle's outcome cannot leak into the next. */
|
|
140
|
+
private startupDefaultCollection: { epoch: number; state: SearchCollectionState } | undefined;
|
|
119
141
|
|
|
120
142
|
constructor(
|
|
121
143
|
private readonly deps: OrchestratorInitDeps,
|
|
@@ -168,6 +190,7 @@ export class OrchestratorInitCoordinator {
|
|
|
168
190
|
this.startupClosed = false;
|
|
169
191
|
this.maintenanceNamespacesFlight = undefined;
|
|
170
192
|
this.correctionCatalogFlight = undefined;
|
|
193
|
+
this.startupDefaultCollection = undefined;
|
|
171
194
|
this.recoveredCorrectionNamespaces = new Set<string>();
|
|
172
195
|
this.correctionRecoveryChain = Promise.resolve();
|
|
173
196
|
return epoch;
|
|
@@ -523,6 +546,7 @@ export class OrchestratorInitCoordinator {
|
|
|
523
546
|
states.find(
|
|
524
547
|
(entry) => entry.namespace === this.deps.config.defaultNamespace,
|
|
525
548
|
)?.state ?? "unknown";
|
|
549
|
+
this.startupDefaultCollection = { epoch, state: defaultState };
|
|
526
550
|
if (defaultState === "missing") {
|
|
527
551
|
await this.deps.disposeSearchBackendIfNeeded();
|
|
528
552
|
if (!this.isCurrentStartupEpoch(epoch)) {
|
|
@@ -625,41 +649,31 @@ export class OrchestratorInitCoordinator {
|
|
|
625
649
|
// triggered update — which can be days ago if the daemon restarted without
|
|
626
650
|
// new extractions. This is the root cause of "0 memories" recall results
|
|
627
651
|
// despite thousands of facts on disk.
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
this.deps.deferredSyncSucceeded = true;
|
|
649
|
-
} else {
|
|
650
|
-
this.deps.deferredSyncSucceeded = false;
|
|
651
|
-
log.warn("QMD startup sync used configured namespace fallback; retry remains armed");
|
|
652
|
-
}
|
|
653
|
-
} catch (err) {
|
|
654
|
-
log.warn(`QMD startup sync failed (non-fatal): ${err}`);
|
|
655
|
-
// deferredSyncSucceeded stays false — server retry will attempt sync
|
|
652
|
+
//
|
|
653
|
+
// The corpus-wide update is deliberately NOT awaited here (#3518): the
|
|
654
|
+
// probe and collection ensure already ran in initialize(), the model
|
|
655
|
+
// warm-up below is the last thing deferredReady waits on, and the update
|
|
656
|
+
// runs after the ready mark under the server retry loop, which sees
|
|
657
|
+
// deferredSyncSucceeded === false and calls startupSearchSync. The index
|
|
658
|
+
// lands atomically, so recall serves the previous index until the update
|
|
659
|
+
// commits rather than holding readiness for a full reindex.
|
|
660
|
+
if (this.deps.qmd.isAvailable() && !resolveQmdCapabilities(this.deps.config).qmdMaintenance) {
|
|
661
|
+
// Available backend with maintenance disabled — no corpus update is
|
|
662
|
+
// owed, but probe availability alone is not sync-done: an "unknown"
|
|
663
|
+
// ensure must not stamp success, or ensureSearchReady would skip
|
|
664
|
+
// collection re-verification. Only a verified ensure — "present" or
|
|
665
|
+
// explicit "skipped" — disarms the retry loop.
|
|
666
|
+
const collection = this.startupDefaultCollection;
|
|
667
|
+
if (
|
|
668
|
+
collection?.epoch === epoch &&
|
|
669
|
+
(collection.state === "present" || collection.state === "skipped")
|
|
670
|
+
) {
|
|
671
|
+
this.deps.deferredSyncSucceeded = true;
|
|
656
672
|
}
|
|
657
|
-
} else if (!(this.deps.qmd.isAvailable())) {
|
|
658
|
-
// QMD not available at deferred init time — server retry will handle it
|
|
659
|
-
} else {
|
|
660
|
-
// QMD available but maintenance disabled — consider sync not needed
|
|
661
|
-
this.deps.deferredSyncSucceeded = true;
|
|
662
673
|
}
|
|
674
|
+
// Otherwise the flag stays false and the server retry loop owns the
|
|
675
|
+
// sync: the corpus update when maintenance is on, backend recovery when
|
|
676
|
+
// the probe failed.
|
|
663
677
|
|
|
664
678
|
if (signal.aborted || !this.isCurrentStartupEpoch(epoch)) return;
|
|
665
679
|
|
|
@@ -868,11 +882,26 @@ export class OrchestratorInitCoordinator {
|
|
|
868
882
|
log.info("orchestrator initialized (full — deferred steps complete)");
|
|
869
883
|
}
|
|
870
884
|
|
|
885
|
+
/**
|
|
886
|
+
* Readiness level of startupSearchSync (#3518): probe, catalog-union
|
|
887
|
+
* collection ensure, and the missing-collection noop swap — WITHOUT the
|
|
888
|
+
* corpus-wide index update. The awaited ready path and the warm-up gate use
|
|
889
|
+
* this so readiness waits only on the probe, the collection and the model
|
|
890
|
+
* warm-up; the corpus update runs after ready under the server retry loop
|
|
891
|
+
* via startupSearchSync. Returns true when the backend is usable for
|
|
892
|
+
* warm-up search, false while unavailable, retired, or noop-disposed.
|
|
893
|
+
*/
|
|
894
|
+
async startupSearchReadySync(signal?: AbortSignal): Promise<boolean> {
|
|
895
|
+
const ensured = await this.ensureStartupSearchBackend(signal);
|
|
896
|
+
return ensured.state === "ready";
|
|
897
|
+
}
|
|
898
|
+
|
|
871
899
|
/**
|
|
872
900
|
* Namespace-aware startup search sync. Re-probes QMD, ensures collections
|
|
873
901
|
* (namespace-aware when namespacesEnabled), runs update, and warms up search.
|
|
874
902
|
* Designed for server retry paths that run after the deferred init completes
|
|
875
|
-
* when QMD was not available during initial startup
|
|
903
|
+
* when QMD was not available during initial startup — and, since #3518, for
|
|
904
|
+
* the post-ready corpus update the deferred path no longer awaits.
|
|
876
905
|
*
|
|
877
906
|
* Accepts an optional AbortSignal so callers can interrupt the sync during
|
|
878
907
|
* shutdown. The signal is checked between phases and forwarded into the QMD
|
|
@@ -882,88 +911,17 @@ export class OrchestratorInitCoordinator {
|
|
|
882
911
|
* Returns true if the sync succeeded (QMD now available), false otherwise.
|
|
883
912
|
*/
|
|
884
913
|
async startupSearchSync(signal?: AbortSignal): Promise<boolean> {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
if (!available) return false;
|
|
891
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
892
|
-
log.debug("startupSearchSync: aborted or retired after probe");
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
log.info(`startupSearchSync: backend now available ${this.deps.qmd.debugStatus()}`);
|
|
897
|
-
|
|
898
|
-
// Clear namespace router cache so re-probe picks up newly available backends
|
|
899
|
-
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
900
|
-
this.deps.namespaceSearchRouter.clearCache();
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
// Ensure collections — namespace-aware when enabled.
|
|
904
|
-
// Use the catalog-union namespace set (issue #1499 sweep, same class as
|
|
905
|
-
// NHZEV): this is the QMD startup-recovery sync that ensures collections AND
|
|
906
|
-
// runs `updateNamespaces(...)` below over the SAME `namespaces` set. A dynamic
|
|
907
|
-
// namespace that exists only in the persisted catalog must be ensured and
|
|
908
|
-
// re-synced here too, otherwise after a backend-was-unavailable-at-boot
|
|
909
|
-
// recovery its collection stays stale. Falls back to the configured set on any
|
|
910
|
-
// catalog read failure.
|
|
911
|
-
const discovery = await this.startupNamespaces(epoch);
|
|
914
|
+
const ensured = await this.ensureStartupSearchBackend(signal);
|
|
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.
|
|
912
919
|
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
913
|
-
log.debug("startupSearchSync: aborted or retired after
|
|
920
|
+
log.debug("startupSearchSync: aborted or retired after the shared backend ensure");
|
|
914
921
|
return false;
|
|
915
922
|
}
|
|
916
923
|
const namespaces = discovery.namespaces;
|
|
917
924
|
|
|
918
|
-
const states = await Promise.all(
|
|
919
|
-
namespaces.map(async (namespace) => {
|
|
920
|
-
const epochAbort = this.linkedEpochAbortController(epoch, signal);
|
|
921
|
-
try {
|
|
922
|
-
return {
|
|
923
|
-
namespace,
|
|
924
|
-
state: resolveNamespaceCapabilities(this.deps.config).namespaces
|
|
925
|
-
? await this.deps.namespaceSearchRouter.ensureNamespaceCollection(
|
|
926
|
-
namespace,
|
|
927
|
-
{ signal: epochAbort.controller.signal },
|
|
928
|
-
)
|
|
929
|
-
: await this.deps.qmd.ensureCollection(
|
|
930
|
-
this.deps.config.memoryDir,
|
|
931
|
-
this.deps.config.qmdCollection,
|
|
932
|
-
{ signal: epochAbort.controller.signal },
|
|
933
|
-
),
|
|
934
|
-
};
|
|
935
|
-
} finally {
|
|
936
|
-
epochAbort.dispose();
|
|
937
|
-
}
|
|
938
|
-
}),
|
|
939
|
-
);
|
|
940
|
-
|
|
941
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
942
|
-
log.debug("startupSearchSync: aborted or retired after ensureCollection");
|
|
943
|
-
return false;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
const defaultState =
|
|
947
|
-
states.find((e) => e.namespace === this.deps.config.defaultNamespace)?.state ?? "unknown";
|
|
948
|
-
if (defaultState === "missing") {
|
|
949
|
-
await this.deps.disposeSearchBackendIfNeeded();
|
|
950
|
-
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
951
|
-
log.debug("startupSearchSync: aborted or retired while disposing a missing backend");
|
|
952
|
-
return false;
|
|
953
|
-
}
|
|
954
|
-
// Reset the real backend's available flag before replacing it with noop.
|
|
955
|
-
// probe() set available=true earlier in this call; without this reset,
|
|
956
|
-
// any code that captured a reference to the old backend (e.g. a concurrent
|
|
957
|
-
// recall() that read this.deps.qmd before the reassignment) would observe
|
|
958
|
-
// isAvailable()===true against a backend with a missing collection.
|
|
959
|
-
if ("available" in this.deps.qmd) {
|
|
960
|
-
(this.deps.qmd as any).available = false;
|
|
961
|
-
}
|
|
962
|
-
this.deps.qmd = new NoopSearchBackend();
|
|
963
|
-
log.warn("startupSearchSync: search collection missing; disabling search (fallback retrieval remains enabled)");
|
|
964
|
-
return false;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
925
|
// Run index update — namespace-aware when enabled.
|
|
968
926
|
// qmd.update() swallows errors internally, so we: (1) snapshot fail/run
|
|
969
927
|
// timestamps, (2) reset throttles so the update isn't skipped by stale
|
|
@@ -1047,4 +1005,194 @@ export class OrchestratorInitCoordinator {
|
|
|
1047
1005
|
|
|
1048
1006
|
return discovery.complete;
|
|
1049
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;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
private async runStartupSearchBackend(
|
|
1096
|
+
epoch: number,
|
|
1097
|
+
signal?: AbortSignal,
|
|
1098
|
+
): Promise<StartupBackendEnsure> {
|
|
1099
|
+
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
1100
|
+
return { state: "retired" };
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
const available = await this.probeForStartupEpoch(epoch, signal);
|
|
1104
|
+
if (!available) return { state: "unavailable" };
|
|
1105
|
+
if (signal?.aborted || !this.isCurrentStartupEpoch(epoch)) {
|
|
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 };
|
|
1197
|
+
}
|
|
1050
1198
|
}
|
|
@@ -35,7 +35,7 @@ function installCapturingLogger(): { entries: LogEntry[] } {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function createCoordinator(): ExtractionQueueCoordinator {
|
|
38
|
-
return new ExtractionQueueCoordinator();
|
|
38
|
+
return new ExtractionQueueCoordinator(1);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// ── Per-key FIFO: queued tasks retain their own captured scope and settlement ─
|
|
@@ -495,8 +495,8 @@ test("tasks sharing a buffer key never run concurrently even with free capacity"
|
|
|
495
495
|
assert.equal(otherKey.outcome, "finished");
|
|
496
496
|
});
|
|
497
497
|
|
|
498
|
-
test("
|
|
499
|
-
const coordinator =
|
|
498
|
+
test("an explicit limit of 1 keeps the queue serial", async () => {
|
|
499
|
+
const coordinator = createParallelCoordinator(1);
|
|
500
500
|
assert.equal(coordinator.maxConcurrency, 1);
|
|
501
501
|
const first = makeParkedTask(false);
|
|
502
502
|
const second = makeParkedTask(false);
|