@remnic/core 9.3.653 → 9.3.655
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-cli.js +24 -24
- package/dist/access-http.d.ts +4 -4
- package/dist/access-http.js +17 -17
- package/dist/access-mcp.d.ts +4 -4
- package/dist/access-mcp.js +16 -16
- package/dist/access-schema.d.ts +12 -12
- package/dist/{access-service-CdJFd3_b.d.ts → access-service-BEJvriUt.d.ts} +11 -2
- package/dist/access-service.d.ts +4 -4
- package/dist/access-service.js +15 -15
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +3 -3
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/{chunk-GI45G4BK.js → chunk-2RCGZ67B.js} +4 -4
- package/dist/{chunk-BEMWL2FZ.js → chunk-54LOUIBE.js} +2 -2
- package/dist/{chunk-E3J6O6N7.js → chunk-55ZMNKMQ.js} +20 -9
- package/dist/{chunk-E3J6O6N7.js.map → chunk-55ZMNKMQ.js.map} +1 -1
- package/dist/{chunk-7WEB3FLJ.js → chunk-5PLUC5OB.js} +2 -2
- package/dist/{chunk-SPMZZUEJ.js → chunk-5QD3QD76.js} +2684 -401
- package/dist/chunk-5QD3QD76.js.map +1 -0
- package/dist/{chunk-WLGE6KEO.js → chunk-67G4T7KI.js} +3 -3
- package/dist/{chunk-JX2RINDR.js → chunk-6G5JEN55.js} +2 -2
- package/dist/{chunk-R3PQUPQ4.js → chunk-6IMKOIZ6.js} +85 -3
- package/dist/chunk-6IMKOIZ6.js.map +1 -0
- package/dist/{chunk-KJDKZVF3.js → chunk-A3Y37UWI.js} +3 -3
- package/dist/{chunk-CFOCZPIQ.js → chunk-BGKXTVNG.js} +2 -2
- package/dist/{chunk-QQHIQ7JD.js → chunk-COVZLGMR.js} +87 -18
- package/dist/chunk-COVZLGMR.js.map +1 -0
- package/dist/{chunk-JVRPJ7D4.js → chunk-EKQMQQ3U.js} +48 -12
- package/dist/chunk-EKQMQQ3U.js.map +1 -0
- package/dist/{chunk-H3PHZLMF.js → chunk-GKKAXVAJ.js} +20 -11
- package/dist/chunk-GKKAXVAJ.js.map +1 -0
- package/dist/{chunk-JBHXMCYN.js → chunk-GRYAECRV.js} +2 -2
- package/dist/{chunk-EHQLDFSH.js → chunk-IQ53ZSXV.js} +2 -2
- package/dist/{chunk-C63WC454.js → chunk-KOI765XP.js} +125 -1
- package/dist/chunk-KOI765XP.js.map +1 -0
- package/dist/{chunk-IVYSVAC6.js → chunk-KZZ4YAEC.js} +2 -2
- package/dist/{chunk-2DGQLOOM.js → chunk-M3VYPE2H.js} +1 -1
- package/dist/{chunk-2DGQLOOM.js.map → chunk-M3VYPE2H.js.map} +1 -1
- package/dist/{chunk-JF7SFXTG.js → chunk-NCSJKK23.js} +2 -2
- package/dist/{chunk-XMN6MMTU.js → chunk-NRBGRZW4.js} +2 -2
- package/dist/{chunk-NOBL7OUP.js → chunk-OKW6F5S5.js} +12 -5
- package/dist/{chunk-NOBL7OUP.js.map → chunk-OKW6F5S5.js.map} +1 -1
- package/dist/{chunk-BNFRL6QW.js → chunk-PTMJ2FH2.js} +2 -2
- package/dist/{chunk-KWM33SPU.js → chunk-PVE7KSQP.js} +2 -2
- package/dist/{chunk-EW52H5EM.js → chunk-QDVQ4AN2.js} +12 -5
- package/dist/chunk-QDVQ4AN2.js.map +1 -0
- package/dist/{chunk-PYWNNF2I.js → chunk-QRSKPI62.js} +99 -66
- package/dist/chunk-QRSKPI62.js.map +1 -0
- package/dist/{chunk-YM3LR4LS.js → chunk-SSSXWIBP.js} +5 -5
- package/dist/{chunk-C43KEWEV.js → chunk-TDZSSJV4.js} +1 -1
- package/dist/chunk-TDZSSJV4.js.map +1 -0
- package/dist/{chunk-Y7NWBBHV.js → chunk-TEO46GMM.js} +2 -2
- package/dist/{chunk-AJE7FJVE.js → chunk-UCEABZZN.js} +2 -2
- package/dist/{chunk-IENGGY2C.js → chunk-UCEDY5M7.js} +2 -2
- package/dist/{chunk-PRQXUSQV.js → chunk-UYNFWZWG.js} +2 -2
- package/dist/{chunk-V4UDXYGG.js → chunk-WDTUYOLS.js} +2 -2
- package/dist/{chunk-RZOBQ23O.js → chunk-XOFXKASO.js} +2 -2
- package/dist/chunk-XRKQOQLY.js +212 -0
- package/dist/chunk-XRKQOQLY.js.map +1 -0
- package/dist/{chunk-WTI35CVJ.js → chunk-YYN3LIYA.js} +5 -5
- package/dist/{cli-DDo7Qgs-.d.ts → cli-BGahB_d3.d.ts} +3 -3
- package/dist/cli.d.ts +5 -5
- package/dist/cli.js +29 -29
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +19 -1
- package/dist/contradiction/index.js +1 -1
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +3 -3
- package/dist/explicit-capture.js +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +37 -35
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +4 -4
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +1 -1
- package/dist/namespaces/migrate.js +11 -11
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +15 -4
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.d.ts +52 -3
- package/dist/namespaces/storage.js +9 -5
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +14 -14
- package/dist/{orchestrator-8fTZsa0y.d.ts → orchestrator-BgzZlWxH.d.ts} +500 -3
- package/dist/orchestrator.d.ts +3 -3
- package/dist/orchestrator.js +20 -20
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +5 -1
- package/dist/qmd.js +2 -2
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/{resolution-3SAP4SH2.js → resolution-IDTEBJFS.js} +2 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +2 -2
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +6 -6
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +6 -6
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +17 -1
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-DKdYzQOg.d.ts → semantic-consolidation-Z8d_uMq8.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/{types-D8yUmSik.d.ts → types-2OPlQWJG.d.ts} +23 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +1 -1
- package/src/access-http.ts +7 -0
- package/src/access-mcp.ts +7 -0
- package/src/access-service.ts +12 -0
- package/src/cli.ts +104 -0
- package/src/config.test.ts +109 -0
- package/src/config.ts +164 -0
- package/src/contradiction/contradiction.test.ts +284 -0
- package/src/contradiction/resolution.ts +151 -4
- package/src/explicit-capture.ts +31 -10
- package/src/index.ts +10 -0
- package/src/maintenance/namespace-planner.test.ts +1120 -0
- package/src/maintenance/namespace-planner.ts +893 -0
- package/src/namespaces/catalog.test.ts +3356 -0
- package/src/namespaces/catalog.ts +2123 -0
- package/src/namespaces/search.test.ts +130 -2
- package/src/namespaces/search.ts +71 -10
- package/src/namespaces/storage.ts +210 -30
- package/src/orchestrator-flush.test.ts +720 -0
- package/src/orchestrator.ts +881 -239
- package/src/qmd-client.test.ts +59 -0
- package/src/qmd.ts +124 -84
- package/src/search/port.ts +16 -0
- package/src/types.ts +23 -0
- package/dist/chunk-C43KEWEV.js.map +0 -1
- package/dist/chunk-C63WC454.js.map +0 -1
- package/dist/chunk-EW52H5EM.js.map +0 -1
- package/dist/chunk-H3PHZLMF.js.map +0 -1
- package/dist/chunk-JVRPJ7D4.js.map +0 -1
- package/dist/chunk-ORGWWNJG.js +0 -131
- package/dist/chunk-ORGWWNJG.js.map +0 -1
- package/dist/chunk-PYWNNF2I.js.map +0 -1
- package/dist/chunk-QQHIQ7JD.js.map +0 -1
- package/dist/chunk-R3PQUPQ4.js.map +0 -1
- package/dist/chunk-SPMZZUEJ.js.map +0 -1
- /package/dist/{chunk-GI45G4BK.js.map → chunk-2RCGZ67B.js.map} +0 -0
- /package/dist/{chunk-BEMWL2FZ.js.map → chunk-54LOUIBE.js.map} +0 -0
- /package/dist/{chunk-7WEB3FLJ.js.map → chunk-5PLUC5OB.js.map} +0 -0
- /package/dist/{chunk-WLGE6KEO.js.map → chunk-67G4T7KI.js.map} +0 -0
- /package/dist/{chunk-JX2RINDR.js.map → chunk-6G5JEN55.js.map} +0 -0
- /package/dist/{chunk-KJDKZVF3.js.map → chunk-A3Y37UWI.js.map} +0 -0
- /package/dist/{chunk-CFOCZPIQ.js.map → chunk-BGKXTVNG.js.map} +0 -0
- /package/dist/{chunk-JBHXMCYN.js.map → chunk-GRYAECRV.js.map} +0 -0
- /package/dist/{chunk-EHQLDFSH.js.map → chunk-IQ53ZSXV.js.map} +0 -0
- /package/dist/{chunk-IVYSVAC6.js.map → chunk-KZZ4YAEC.js.map} +0 -0
- /package/dist/{chunk-JF7SFXTG.js.map → chunk-NCSJKK23.js.map} +0 -0
- /package/dist/{chunk-XMN6MMTU.js.map → chunk-NRBGRZW4.js.map} +0 -0
- /package/dist/{chunk-BNFRL6QW.js.map → chunk-PTMJ2FH2.js.map} +0 -0
- /package/dist/{chunk-KWM33SPU.js.map → chunk-PVE7KSQP.js.map} +0 -0
- /package/dist/{chunk-YM3LR4LS.js.map → chunk-SSSXWIBP.js.map} +0 -0
- /package/dist/{chunk-Y7NWBBHV.js.map → chunk-TEO46GMM.js.map} +0 -0
- /package/dist/{chunk-AJE7FJVE.js.map → chunk-UCEABZZN.js.map} +0 -0
- /package/dist/{chunk-IENGGY2C.js.map → chunk-UCEDY5M7.js.map} +0 -0
- /package/dist/{chunk-PRQXUSQV.js.map → chunk-UYNFWZWG.js.map} +0 -0
- /package/dist/{chunk-V4UDXYGG.js.map → chunk-WDTUYOLS.js.map} +0 -0
- /package/dist/{chunk-RZOBQ23O.js.map → chunk-XOFXKASO.js.map} +0 -0
- /package/dist/{chunk-WTI35CVJ.js.map → chunk-YYN3LIYA.js.map} +0 -0
- /package/dist/{resolution-3SAP4SH2.js.map → resolution-IDTEBJFS.js.map} +0 -0
package/src/qmd-client.test.ts
CHANGED
|
@@ -70,6 +70,65 @@ function captureSubprocessArgs(client: QmdClient): string[][] {
|
|
|
70
70
|
return calls;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
test("updateStrict respects QMD update min-interval throttles", async () => {
|
|
74
|
+
const client = new QmdClient("memories", 3, { updateMinIntervalMs: 60_000 });
|
|
75
|
+
client.resetUpdateThrottles();
|
|
76
|
+
const calls = captureSubprocessArgs(client);
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
await client.updateStrict();
|
|
80
|
+
await assert.rejects(
|
|
81
|
+
() => client.updateStrict(),
|
|
82
|
+
/QMD update skipped by min-interval gate|QMD update skipped by global min-interval gate/,
|
|
83
|
+
);
|
|
84
|
+
} finally {
|
|
85
|
+
client.resetUpdateThrottles();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
assert.equal(calls.length, 1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("embedCollectionStrict rejects QMD embed subprocess failures", async () => {
|
|
92
|
+
const client = new QmdClient("memories", 3, { updateMinIntervalMs: 60_000 });
|
|
93
|
+
client.resetUpdateThrottles();
|
|
94
|
+
const internals = client as unknown as SubprocessInternals;
|
|
95
|
+
const calls: string[][] = [];
|
|
96
|
+
internals.available = true;
|
|
97
|
+
internals.runQmdCommand = async (args: string[]) => {
|
|
98
|
+
calls.push(args);
|
|
99
|
+
throw new Error("embed subprocess failed");
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
await assert.rejects(
|
|
104
|
+
() => client.embedCollectionStrict("memories--project"),
|
|
105
|
+
/embed subprocess failed/,
|
|
106
|
+
);
|
|
107
|
+
} finally {
|
|
108
|
+
client.resetUpdateThrottles();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
assert.deepEqual(calls, [["embed", "-c", "memories--project"]]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("embedCollectionStrict respects QMD embed min-interval throttles", async () => {
|
|
115
|
+
const client = new QmdClient("memories", 3, { updateMinIntervalMs: 60_000 });
|
|
116
|
+
client.resetUpdateThrottles();
|
|
117
|
+
const calls = captureSubprocessArgs(client);
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
await client.embedCollectionStrict("memories--project");
|
|
121
|
+
await assert.rejects(
|
|
122
|
+
() => client.embedCollectionStrict("memories--project"),
|
|
123
|
+
/QMD embed skipped by per-collection min-interval gate/,
|
|
124
|
+
);
|
|
125
|
+
} finally {
|
|
126
|
+
client.resetUpdateThrottles();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
assert.equal(calls.length, 1);
|
|
130
|
+
});
|
|
131
|
+
|
|
73
132
|
test("ensureCollection treats cancelled auto-create as unknown", async () => {
|
|
74
133
|
const client = new QmdClient("memories", 3, {});
|
|
75
134
|
const internals = client as unknown as SubprocessInternals & {
|
package/src/qmd.ts
CHANGED
|
@@ -1232,9 +1232,14 @@ export class QmdClient implements SearchBackend {
|
|
|
1232
1232
|
resetUpdateThrottles(): void {
|
|
1233
1233
|
this._lastUpdateFailAtMs = null;
|
|
1234
1234
|
this.lastUpdateRunAtMs = null;
|
|
1235
|
+
this.lastEmbedFailAtMs = null;
|
|
1235
1236
|
const gs = getGlobalQmdState();
|
|
1236
1237
|
gs.lastGlobalUpdateRunAtMs = null;
|
|
1237
1238
|
gs.lastGlobalUpdateFailAtMs = null;
|
|
1239
|
+
gs.lastGlobalEmbedRunAtMs = null;
|
|
1240
|
+
gs.lastGlobalEmbedFailAtMs = null;
|
|
1241
|
+
gs.lastEmbedByCollectionMs = {};
|
|
1242
|
+
gs.lastEmbedFailByCollectionMs = {};
|
|
1238
1243
|
}
|
|
1239
1244
|
|
|
1240
1245
|
private readonly updateTimeoutMs: number;
|
|
@@ -2493,6 +2498,14 @@ export class QmdClient implements SearchBackend {
|
|
|
2493
2498
|
);
|
|
2494
2499
|
}
|
|
2495
2500
|
|
|
2501
|
+
async updateStrict(execution?: SearchExecutionOptions): Promise<void> {
|
|
2502
|
+
await this.runUpdateForCollection(
|
|
2503
|
+
this.collection,
|
|
2504
|
+
{ perCollectionThrottle: false, strict: true },
|
|
2505
|
+
execution?.signal,
|
|
2506
|
+
);
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2496
2509
|
async updateCollection(
|
|
2497
2510
|
collection: string,
|
|
2498
2511
|
execution?: SearchExecutionOptions,
|
|
@@ -2510,7 +2523,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2510
2523
|
): Promise<void> {
|
|
2511
2524
|
await this.runUpdateForCollection(
|
|
2512
2525
|
collection,
|
|
2513
|
-
{ perCollectionThrottle: true, strict: true },
|
|
2526
|
+
{ perCollectionThrottle: true, strict: true, force: true },
|
|
2514
2527
|
execution?.signal,
|
|
2515
2528
|
);
|
|
2516
2529
|
}
|
|
@@ -2521,7 +2534,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2521
2534
|
|
|
2522
2535
|
private async runUpdateForCollection(
|
|
2523
2536
|
collection: string,
|
|
2524
|
-
options: { perCollectionThrottle: boolean; strict?: boolean },
|
|
2537
|
+
options: { perCollectionThrottle: boolean; strict?: boolean; force?: boolean },
|
|
2525
2538
|
signal?: AbortSignal,
|
|
2526
2539
|
): Promise<void> {
|
|
2527
2540
|
if (this.available === false) {
|
|
@@ -2539,12 +2552,13 @@ export class QmdClient implements SearchBackend {
|
|
|
2539
2552
|
}
|
|
2540
2553
|
const globalState = getGlobalQmdState();
|
|
2541
2554
|
const now = Date.now();
|
|
2542
|
-
if (!options.
|
|
2555
|
+
if (!options.force && options.perCollectionThrottle) {
|
|
2543
2556
|
if (
|
|
2544
2557
|
globalState.lastGlobalUpdateFailAtMs &&
|
|
2545
2558
|
now - globalState.lastGlobalUpdateFailAtMs < QMD_UPDATE_BACKOFF_MS
|
|
2546
2559
|
) {
|
|
2547
2560
|
log.debug("QMD update: suppressed by global failure backoff");
|
|
2561
|
+
if (options.strict) throw new Error("QMD update skipped by global failure backoff");
|
|
2548
2562
|
return;
|
|
2549
2563
|
}
|
|
2550
2564
|
const lastCollectionRun = globalState.lastUpdateByCollectionMs[name];
|
|
@@ -2553,6 +2567,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2553
2567
|
now - lastCollectionRun < this.updateMinIntervalMs
|
|
2554
2568
|
) {
|
|
2555
2569
|
log.debug(`QMD update: suppressed by per-collection min-interval gate (${name})`);
|
|
2570
|
+
if (options.strict) throw new Error("QMD update skipped by per-collection min-interval gate");
|
|
2556
2571
|
return;
|
|
2557
2572
|
}
|
|
2558
2573
|
const lastCollectionFail = globalState.lastUpdateFailByCollectionMs[name];
|
|
@@ -2561,14 +2576,16 @@ export class QmdClient implements SearchBackend {
|
|
|
2561
2576
|
now - lastCollectionFail < QMD_UPDATE_BACKOFF_MS
|
|
2562
2577
|
) {
|
|
2563
2578
|
log.debug(`QMD update: suppressed by per-collection failure backoff (${name})`);
|
|
2579
|
+
if (options.strict) throw new Error("QMD update skipped by per-collection failure backoff");
|
|
2564
2580
|
return;
|
|
2565
2581
|
}
|
|
2566
|
-
} else if (!options.
|
|
2582
|
+
} else if (!options.force) {
|
|
2567
2583
|
if (
|
|
2568
2584
|
this.lastUpdateRunAtMs &&
|
|
2569
2585
|
now - this.lastUpdateRunAtMs < this.updateMinIntervalMs
|
|
2570
2586
|
) {
|
|
2571
2587
|
log.debug("QMD update: suppressed due to min-interval gate");
|
|
2588
|
+
if (options.strict) throw new Error("QMD update skipped by min-interval gate");
|
|
2572
2589
|
return;
|
|
2573
2590
|
}
|
|
2574
2591
|
if (
|
|
@@ -2576,6 +2593,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2576
2593
|
now - this._lastUpdateFailAtMs < QMD_UPDATE_BACKOFF_MS
|
|
2577
2594
|
) {
|
|
2578
2595
|
log.debug("QMD update: suppressed due to recent failures (backoff)");
|
|
2596
|
+
if (options.strict) throw new Error("QMD update skipped by recent failure backoff");
|
|
2579
2597
|
return;
|
|
2580
2598
|
}
|
|
2581
2599
|
if (
|
|
@@ -2583,6 +2601,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2583
2601
|
now - globalState.lastGlobalUpdateRunAtMs < this.updateMinIntervalMs
|
|
2584
2602
|
) {
|
|
2585
2603
|
log.debug("QMD update: suppressed by global min-interval gate");
|
|
2604
|
+
if (options.strict) throw new Error("QMD update skipped by global min-interval gate");
|
|
2586
2605
|
return;
|
|
2587
2606
|
}
|
|
2588
2607
|
if (
|
|
@@ -2590,6 +2609,7 @@ export class QmdClient implements SearchBackend {
|
|
|
2590
2609
|
now - globalState.lastGlobalUpdateFailAtMs < QMD_UPDATE_BACKOFF_MS
|
|
2591
2610
|
) {
|
|
2592
2611
|
log.debug("QMD update: suppressed by global failure backoff");
|
|
2612
|
+
if (options.strict) throw new Error("QMD update skipped by global failure backoff");
|
|
2593
2613
|
return;
|
|
2594
2614
|
}
|
|
2595
2615
|
}
|
|
@@ -2633,117 +2653,137 @@ export class QmdClient implements SearchBackend {
|
|
|
2633
2653
|
}
|
|
2634
2654
|
|
|
2635
2655
|
async embed(): Promise<void> {
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2656
|
+
await this.runEmbedForCollection(this.collection, { perCollectionThrottle: false });
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
async embedStrict(): Promise<void> {
|
|
2660
|
+
await this.runEmbedForCollection(this.collection, { perCollectionThrottle: false, strict: true });
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
async embedCollection(collection: string): Promise<void> {
|
|
2664
|
+
await this.runEmbedForCollection(collection, { perCollectionThrottle: true });
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
async embedCollectionStrict(collection: string): Promise<void> {
|
|
2668
|
+
await this.runEmbedForCollection(collection, { perCollectionThrottle: true, strict: true });
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
private async runEmbedForCollection(
|
|
2672
|
+
collection: string,
|
|
2673
|
+
options: { perCollectionThrottle: boolean; strict?: boolean },
|
|
2674
|
+
): Promise<void> {
|
|
2675
|
+
if (this.available === false) {
|
|
2676
|
+
if (options.strict) throw new Error("QMD unavailable");
|
|
2643
2677
|
return;
|
|
2644
2678
|
}
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
) {
|
|
2649
|
-
log.debug("QMD embed: suppressed by global min-interval gate");
|
|
2679
|
+
const name = collection.trim();
|
|
2680
|
+
if (!name) {
|
|
2681
|
+
if (options.strict) throw new Error("QMD collection name is required");
|
|
2650
2682
|
return;
|
|
2651
2683
|
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2684
|
+
const globalState = getGlobalQmdState();
|
|
2685
|
+
const now = Date.now();
|
|
2686
|
+
if (options.perCollectionThrottle) {
|
|
2687
|
+
if (
|
|
2688
|
+
globalState.lastGlobalEmbedFailAtMs &&
|
|
2689
|
+
now - globalState.lastGlobalEmbedFailAtMs < QMD_EMBED_BACKOFF_MS
|
|
2690
|
+
) {
|
|
2691
|
+
log.debug(`QMD embed: suppressed by global failure backoff (${name})`);
|
|
2692
|
+
if (options.strict) throw new Error("QMD embed skipped by global failure backoff");
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
const lastCollectionRun = globalState.lastEmbedByCollectionMs[name];
|
|
2696
|
+
if (
|
|
2697
|
+
Number.isFinite(lastCollectionRun) &&
|
|
2698
|
+
now - lastCollectionRun < this.updateMinIntervalMs
|
|
2699
|
+
) {
|
|
2700
|
+
log.debug(`QMD embed: suppressed by per-collection min-interval gate (${name})`);
|
|
2701
|
+
if (options.strict) throw new Error("QMD embed skipped by per-collection min-interval gate");
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
const lastCollectionFail = globalState.lastEmbedFailByCollectionMs[name];
|
|
2705
|
+
if (
|
|
2706
|
+
Number.isFinite(lastCollectionFail) &&
|
|
2707
|
+
now - lastCollectionFail < QMD_EMBED_BACKOFF_MS
|
|
2708
|
+
) {
|
|
2709
|
+
log.debug(`QMD embed: suppressed by per-collection failure backoff (${name})`);
|
|
2710
|
+
if (options.strict) throw new Error("QMD embed skipped by per-collection failure backoff");
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
} else {
|
|
2714
|
+
if (
|
|
2715
|
+
this.lastEmbedFailAtMs &&
|
|
2716
|
+
now - this.lastEmbedFailAtMs < QMD_EMBED_BACKOFF_MS
|
|
2717
|
+
) {
|
|
2718
|
+
log.debug("QMD embed: suppressed due to recent failures (backoff)");
|
|
2719
|
+
if (options.strict) throw new Error("QMD embed skipped by recent failure backoff");
|
|
2720
|
+
return;
|
|
2721
|
+
}
|
|
2722
|
+
if (
|
|
2723
|
+
globalState.lastGlobalEmbedRunAtMs &&
|
|
2724
|
+
now - globalState.lastGlobalEmbedRunAtMs < this.updateMinIntervalMs
|
|
2725
|
+
) {
|
|
2726
|
+
log.debug("QMD embed: suppressed by global min-interval gate");
|
|
2727
|
+
if (options.strict) throw new Error("QMD embed skipped by global min-interval gate");
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2730
|
+
if (
|
|
2731
|
+
globalState.lastGlobalEmbedFailAtMs &&
|
|
2732
|
+
now - globalState.lastGlobalEmbedFailAtMs < QMD_EMBED_BACKOFF_MS
|
|
2733
|
+
) {
|
|
2734
|
+
log.debug("QMD embed: suppressed by global failure backoff");
|
|
2735
|
+
if (options.strict) throw new Error("QMD embed skipped by global failure backoff");
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2658
2738
|
}
|
|
2659
2739
|
try {
|
|
2660
2740
|
const startedAtMs = Date.now();
|
|
2661
|
-
await this.runQmdCommand(this.buildEmbedArgs(
|
|
2741
|
+
await this.runQmdCommand(this.buildEmbedArgs(name), 300_000);
|
|
2662
2742
|
const durationMs = Date.now() - startedAtMs;
|
|
2663
2743
|
if (this.slowLog?.enabled && durationMs >= this.slowLog.thresholdMs) {
|
|
2664
2744
|
log.warn(`SLOW QMD embed: durationMs=${durationMs}`);
|
|
2665
2745
|
}
|
|
2666
|
-
globalState.lastGlobalEmbedRunAtMs = Date.now();
|
|
2667
|
-
log.debug("QMD embed completed");
|
|
2668
|
-
} catch (err) {
|
|
2669
|
-
if (isVectorDimensionMismatchError(err)) {
|
|
2670
|
-
try {
|
|
2671
|
-
log.warn("QMD embed hit a vector dimension mismatch; retrying with force re-embed");
|
|
2672
|
-
await this.runQmdCommand(this.buildEmbedArgs(this.collection, true), 300_000);
|
|
2673
|
-
globalState.lastGlobalEmbedRunAtMs = Date.now();
|
|
2674
|
-
this.lastEmbedFailAtMs = null;
|
|
2675
|
-
globalState.lastGlobalEmbedFailAtMs = null;
|
|
2676
|
-
log.warn("QMD embed recovered by forcing a full vector rebuild");
|
|
2677
|
-
return;
|
|
2678
|
-
} catch (retryErr) {
|
|
2679
|
-
const retryMsg = retryErr instanceof Error ? retryErr.message : String(retryErr);
|
|
2680
|
-
log.warn(`QMD force re-embed failed after dimension mismatch: ${retryMsg}`);
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
const now = Date.now();
|
|
2684
|
-
this.lastEmbedFailAtMs = now;
|
|
2685
|
-
globalState.lastGlobalEmbedFailAtMs = now;
|
|
2686
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
2687
|
-
log.warn(`QMD embed failed: ${msg}`);
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
async embedCollection(collection: string): Promise<void> {
|
|
2692
|
-
if (this.available === false) return;
|
|
2693
|
-
const name = collection.trim();
|
|
2694
|
-
if (!name) return;
|
|
2695
|
-
const globalState = getGlobalQmdState();
|
|
2696
|
-
const now = Date.now();
|
|
2697
|
-
if (
|
|
2698
|
-
globalState.lastGlobalEmbedFailAtMs &&
|
|
2699
|
-
now - globalState.lastGlobalEmbedFailAtMs < QMD_EMBED_BACKOFF_MS
|
|
2700
|
-
) {
|
|
2701
|
-
log.debug(`QMD embed: suppressed by global failure backoff (${name})`);
|
|
2702
|
-
return;
|
|
2703
|
-
}
|
|
2704
|
-
const lastCollectionRun = globalState.lastEmbedByCollectionMs[name];
|
|
2705
|
-
if (
|
|
2706
|
-
Number.isFinite(lastCollectionRun) &&
|
|
2707
|
-
now - lastCollectionRun < this.updateMinIntervalMs
|
|
2708
|
-
) {
|
|
2709
|
-
log.debug(`QMD embed: suppressed by per-collection min-interval gate (${name})`);
|
|
2710
|
-
return;
|
|
2711
|
-
}
|
|
2712
|
-
const lastCollectionFail = globalState.lastEmbedFailByCollectionMs[name];
|
|
2713
|
-
if (
|
|
2714
|
-
Number.isFinite(lastCollectionFail) &&
|
|
2715
|
-
now - lastCollectionFail < QMD_EMBED_BACKOFF_MS
|
|
2716
|
-
) {
|
|
2717
|
-
log.debug(`QMD embed: suppressed by per-collection failure backoff (${name})`);
|
|
2718
|
-
return;
|
|
2719
|
-
}
|
|
2720
|
-
try {
|
|
2721
|
-
await this.runQmdCommand(this.buildEmbedArgs(name), 300_000);
|
|
2722
2746
|
const at = Date.now();
|
|
2723
|
-
|
|
2747
|
+
if (options.perCollectionThrottle) {
|
|
2748
|
+
globalState.lastEmbedByCollectionMs[name] = at;
|
|
2749
|
+
}
|
|
2724
2750
|
globalState.lastGlobalEmbedRunAtMs = at;
|
|
2751
|
+
log.debug(`QMD embed completed for collection=${name}`);
|
|
2725
2752
|
} catch (err) {
|
|
2753
|
+
let failure: unknown = err;
|
|
2726
2754
|
if (isVectorDimensionMismatchError(err)) {
|
|
2727
2755
|
try {
|
|
2728
2756
|
log.warn(`QMD embed for collection ${name} hit a vector dimension mismatch; retrying with force re-embed`);
|
|
2729
2757
|
await this.runQmdCommand(this.buildEmbedArgs(name, true), 300_000);
|
|
2730
2758
|
const recoveredAt = Date.now();
|
|
2731
|
-
|
|
2759
|
+
if (options.perCollectionThrottle) {
|
|
2760
|
+
globalState.lastEmbedByCollectionMs[name] = recoveredAt;
|
|
2761
|
+
delete globalState.lastEmbedFailByCollectionMs[name];
|
|
2762
|
+
} else {
|
|
2763
|
+
this.lastEmbedFailAtMs = null;
|
|
2764
|
+
}
|
|
2732
2765
|
globalState.lastGlobalEmbedRunAtMs = recoveredAt;
|
|
2733
|
-
delete globalState.lastEmbedFailByCollectionMs[name];
|
|
2734
2766
|
globalState.lastGlobalEmbedFailAtMs = null;
|
|
2735
2767
|
log.warn(`QMD embed for collection ${name} recovered by forcing a full vector rebuild`);
|
|
2736
2768
|
return;
|
|
2737
2769
|
} catch (retryErr) {
|
|
2770
|
+
failure = retryErr;
|
|
2738
2771
|
const retryMsg = retryErr instanceof Error ? retryErr.message : String(retryErr);
|
|
2739
2772
|
log.warn(`QMD force re-embed failed for collection ${name}: ${retryMsg}`);
|
|
2740
2773
|
}
|
|
2741
2774
|
}
|
|
2742
2775
|
const at = Date.now();
|
|
2743
|
-
|
|
2776
|
+
if (options.perCollectionThrottle) {
|
|
2777
|
+
globalState.lastEmbedFailByCollectionMs[name] = at;
|
|
2778
|
+
} else {
|
|
2779
|
+
this.lastEmbedFailAtMs = at;
|
|
2780
|
+
}
|
|
2744
2781
|
globalState.lastGlobalEmbedFailAtMs = at;
|
|
2745
|
-
const msg =
|
|
2782
|
+
const msg = failure instanceof Error ? failure.message : String(failure);
|
|
2746
2783
|
log.warn(`QMD embed failed for collection ${name}: ${msg}`);
|
|
2784
|
+
if (options.strict) {
|
|
2785
|
+
throw failure;
|
|
2786
|
+
}
|
|
2747
2787
|
}
|
|
2748
2788
|
}
|
|
2749
2789
|
|
package/src/search/port.ts
CHANGED
|
@@ -81,6 +81,12 @@ export interface SearchBackend {
|
|
|
81
81
|
|
|
82
82
|
// ── Maintenance ──
|
|
83
83
|
update(execution?: SearchExecutionOptions): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Optional strict refresh used by callers that must know whether the backend
|
|
86
|
+
* was actually refreshed before writing success markers. Ordinary update
|
|
87
|
+
* calls remain fail-open for migration/maintenance resilience.
|
|
88
|
+
*/
|
|
89
|
+
updateStrict?(execution?: SearchExecutionOptions): Promise<void>;
|
|
84
90
|
updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void>;
|
|
85
91
|
updateCollectionFromDir?(collection: string, memoryDir: string, execution?: SearchExecutionOptions): Promise<void>;
|
|
86
92
|
/**
|
|
@@ -96,7 +102,17 @@ export interface SearchBackend {
|
|
|
96
102
|
*/
|
|
97
103
|
updateCollectionStrict?(collection: string, execution?: SearchExecutionOptions): Promise<void>;
|
|
98
104
|
embed(): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Optional strict embed used by callers that must know vectors were actually
|
|
107
|
+
* refreshed before writing success markers.
|
|
108
|
+
*/
|
|
109
|
+
embedStrict?(): Promise<void>;
|
|
99
110
|
embedCollection(collection: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Optional strict collection embed used by callers that must know vectors were
|
|
113
|
+
* actually refreshed before writing success markers.
|
|
114
|
+
*/
|
|
115
|
+
embedCollectionStrict?(collection: string): Promise<void>;
|
|
100
116
|
|
|
101
117
|
// ── Collection management ──
|
|
102
118
|
/**
|
package/src/types.ts
CHANGED
|
@@ -1216,6 +1216,18 @@ export interface PluginConfig {
|
|
|
1216
1216
|
// QMD maintenance (debounced singleflight)
|
|
1217
1217
|
qmdMaintenanceEnabled: boolean;
|
|
1218
1218
|
qmdMaintenanceDebounceMs: number;
|
|
1219
|
+
/**
|
|
1220
|
+
* Namespace-aware maintenance fanout (issue #1500). When namespaces are
|
|
1221
|
+
* enabled, background maintenance jobs use the rebuildable namespace catalog
|
|
1222
|
+
* to discover dynamic project/team namespaces rather than only processing the
|
|
1223
|
+
* configured default/shared/policy set.
|
|
1224
|
+
*/
|
|
1225
|
+
maintenanceNamespaceFanoutEnabled: boolean;
|
|
1226
|
+
maintenanceMaxNamespacesPerCycle: number;
|
|
1227
|
+
maintenanceIncludeProjectNamespaces: boolean;
|
|
1228
|
+
maintenanceIncludeBranchNamespaces: boolean;
|
|
1229
|
+
maintenanceIncludeTeamProjectNamespaces: boolean;
|
|
1230
|
+
maintenanceNamespaceLockStaleMs: number;
|
|
1219
1231
|
qmdAutoEmbedEnabled: boolean;
|
|
1220
1232
|
qmdEmbedMinIntervalMs: number;
|
|
1221
1233
|
qmdUpdateTimeoutMs: number;
|
|
@@ -1292,6 +1304,17 @@ export interface PluginConfig {
|
|
|
1292
1304
|
|
|
1293
1305
|
// v3.0 Multi-agent memory (namespaces)
|
|
1294
1306
|
namespacesEnabled: boolean;
|
|
1307
|
+
/**
|
|
1308
|
+
* Enable the rebuildable namespace catalog (issue #1499). When enabled and
|
|
1309
|
+
* `namespacesEnabled` is also true, storage resolution and read/write paths
|
|
1310
|
+
* record cheap, failure-tolerant namespace touches in
|
|
1311
|
+
* `<memoryDir>/state/namespaces.jsonl`. The catalog is downstream metadata —
|
|
1312
|
+
* filesystem memory remains the source of truth, and the catalog is fully
|
|
1313
|
+
* rebuildable from disk via `remnic namespaces rebuild`. The catalog is inert
|
|
1314
|
+
* (a no-op that enumerates nothing) whenever `namespacesEnabled` is false, so
|
|
1315
|
+
* existing single-namespace behavior is unchanged. Default on.
|
|
1316
|
+
*/
|
|
1317
|
+
namespaceCatalogEnabled: boolean;
|
|
1295
1318
|
defaultNamespace: string;
|
|
1296
1319
|
sharedNamespace: string;
|
|
1297
1320
|
principalFromSessionKeyMode: PrincipalFromSessionKeyMode;
|