@remnic/core 9.3.733 → 9.3.734
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-boundary.d.ts +10 -10
- package/dist/access-boundary.js +9 -9
- package/dist/access-cli.js +25 -23
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +10 -10
- package/dist/access-http.js +14 -14
- package/dist/access-mcp.d.ts +10 -10
- package/dist/access-mcp.js +13 -13
- package/dist/access-operations-batch.js +11 -11
- package/dist/access-operations.d.ts +10 -10
- package/dist/access-operations.js +12 -12
- package/dist/{access-service-Byoe3HsT.d.ts → access-service-rjFfmfKB.d.ts} +4 -4
- package/dist/access-service.d.ts +10 -10
- package/dist/access-service.js +8 -8
- package/dist/access-surface-catalog.d.ts +10 -10
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +3 -2
- package/dist/active-recall.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing.d.ts +1 -1
- 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/capabilities.d.ts +97 -2
- package/dist/capabilities.js +11 -3
- package/dist/{catalog-DM1nk7cM.d.ts → catalog-DHYXzM4-.d.ts} +2 -2
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-24D66MMN.js → chunk-2L5RTVMO.js} +7 -4
- package/dist/chunk-2L5RTVMO.js.map +1 -0
- package/dist/{chunk-KQYGNGON.js → chunk-3QETM5NG.js} +6 -3
- package/dist/chunk-3QETM5NG.js.map +1 -0
- package/dist/{chunk-ZQUAVZNG.js → chunk-54RCE5Z3.js} +7 -4
- package/dist/chunk-54RCE5Z3.js.map +1 -0
- package/dist/{chunk-NOU77OHX.js → chunk-5DIKZKOD.js} +2 -2
- package/dist/{chunk-CGPHMNL4.js → chunk-5OYHJIJN.js} +10 -6
- package/dist/chunk-5OYHJIJN.js.map +1 -0
- package/dist/{chunk-LUCARK4W.js → chunk-6U7TES2M.js} +29 -28
- package/dist/chunk-6U7TES2M.js.map +1 -0
- package/dist/{chunk-FFUCCKPN.js → chunk-7FPJFCXL.js} +10 -7
- package/dist/chunk-7FPJFCXL.js.map +1 -0
- package/dist/{chunk-PMAQRUN4.js → chunk-CILX2XW7.js} +5 -2
- package/dist/chunk-CILX2XW7.js.map +1 -0
- package/dist/{chunk-ZVHRSR2R.js → chunk-ET5HXSQL.js} +6 -3
- package/dist/chunk-ET5HXSQL.js.map +1 -0
- package/dist/{chunk-KSJCXXOU.js → chunk-FAGERSH2.js} +6 -3
- package/dist/chunk-FAGERSH2.js.map +1 -0
- package/dist/{chunk-FYWUNVFZ.js → chunk-IDIXGGDN.js} +6 -6
- package/dist/{chunk-CX77GNMB.js → chunk-IWMGBNXY.js} +6 -3
- package/dist/chunk-IWMGBNXY.js.map +1 -0
- package/dist/{chunk-GGL34GCW.js → chunk-IZLTOS5L.js} +7 -4
- package/dist/chunk-IZLTOS5L.js.map +1 -0
- package/dist/{chunk-HHNSLPX7.js → chunk-K7PAILHO.js} +10 -9
- package/dist/chunk-K7PAILHO.js.map +1 -0
- package/dist/{chunk-UZYLX7M6.js → chunk-LV32K4OP.js} +9 -6
- package/dist/chunk-LV32K4OP.js.map +1 -0
- package/dist/{chunk-HJWQJUKQ.js → chunk-NDYQIN6C.js} +3 -3
- package/dist/{chunk-DKT3X5C3.js → chunk-PEF2XOIV.js} +7 -4
- package/dist/chunk-PEF2XOIV.js.map +1 -0
- package/dist/{chunk-646B5ERJ.js → chunk-PKO5NJ65.js} +51 -48
- package/dist/chunk-PKO5NJ65.js.map +1 -0
- package/dist/{chunk-QZHF4BWN.js → chunk-Q5LGXWNG.js} +6 -6
- package/dist/{chunk-ESF7TRYJ.js → chunk-SHJGBAIW.js} +37 -2
- package/dist/{chunk-ESF7TRYJ.js.map → chunk-SHJGBAIW.js.map} +1 -1
- package/dist/{chunk-O4ZIBPIW.js → chunk-T7CGPTFU.js} +3 -3
- package/dist/{chunk-PLBIPT6I.js → chunk-TJSQHO4Q.js} +7 -4
- package/dist/chunk-TJSQHO4Q.js.map +1 -0
- package/dist/{chunk-6TUWSUUD.js → chunk-UF3N7IRP.js} +26 -24
- package/dist/chunk-UF3N7IRP.js.map +1 -0
- package/dist/{chunk-P3VJCTVE.js → chunk-UH3NYOHN.js} +4 -3
- package/dist/chunk-UH3NYOHN.js.map +1 -0
- package/dist/{chunk-J6BH2OBA.js → chunk-UK6U5C3N.js} +8 -5
- package/dist/chunk-UK6U5C3N.js.map +1 -0
- package/dist/{chunk-OTQE66IX.js → chunk-V5OVSGB6.js} +6 -3
- package/dist/chunk-V5OVSGB6.js.map +1 -0
- package/dist/{chunk-H3MB3F62.js → chunk-WHQ2JB35.js} +4 -3
- package/dist/chunk-WHQ2JB35.js.map +1 -0
- package/dist/{chunk-NIZQH6AU.js → chunk-WTTVFSCO.js} +8 -7
- package/dist/chunk-WTTVFSCO.js.map +1 -0
- package/dist/{chunk-OUITHS6V.js → chunk-Z7J3OAPR.js} +357 -325
- package/dist/chunk-Z7J3OAPR.js.map +1 -0
- package/dist/{cli-Dt-tuiYH.d.ts → cli-XVpmSoQs.d.ts} +3 -3
- package/dist/cli.d.ts +11 -11
- package/dist/cli.js +20 -20
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +2 -1
- 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/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +2 -1
- package/dist/{contradiction-scan-HWGEOUDS.js → contradiction-scan-OUHMCUBT.js} +3 -2
- 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/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +2 -1
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +2 -1
- package/dist/extraction-faithfulness.d.ts +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/extraction.js +3 -3
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-OOR57AYR.js → first-start-migration-W4U6XDKI.js} +7 -6
- package/dist/first-start-migration-W4U6XDKI.js.map +1 -0
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +43 -43
- 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/local-llm.js +2 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +10 -10
- 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 +2 -2
- package/dist/namespaces/migrate.js +6 -6
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/principal.js +2 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +2 -1
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +11 -11
- package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +6 -5
- package/dist/{orchestrator-B4KjaOtY.d.ts → orchestrator-BXi-gadS.d.ts} +66 -5
- package/dist/orchestrator.d.ts +5 -5
- package/dist/orchestrator.js +20 -18
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- 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-renderer.d.ts +1 -1
- package/dist/recall-xray.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- 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/embed-helper.js +2 -2
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +3 -3
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +3 -3
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-SLAa_prH.d.ts → semantic-DJR8_DMQ.d.ts} +1 -1
- package/dist/{semantic-consolidation-CstTvHPo.d.ts → semantic-consolidation-DeL5grLx.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-rule-verifier.d.ts +1 -1
- 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/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -2
- 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/{tier-stats-3LYQ3VV5.js → tier-stats-LSM35HZY.js} +5 -2
- package/dist/tier-stats-LSM35HZY.js.map +1 -0
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-VkxElCHR.d.ts → types-CpFz51Pv.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-service.ts +42 -37
- package/src/active-memory-bridge.ts +2 -1
- package/src/admin/admin-surfaces.ts +2 -1
- package/src/capabilities.test.ts +178 -0
- package/src/capabilities.ts +197 -0
- package/src/cli.ts +13 -9
- package/src/compounding/engine.ts +4 -3
- package/src/contradiction/contradiction-scan.ts +4 -3
- package/src/embedding-fallback.ts +5 -2
- package/src/entity-retrieval.ts +3 -2
- package/src/explicit-capture.ts +2 -1
- package/src/extraction.ts +6 -3
- package/src/local-llm.ts +4 -3
- package/src/maintenance/first-start-migration.ts +6 -3
- package/src/maintenance/namespace-maintenance-fanout.ts +2 -1
- package/src/maintenance/namespace-planner.ts +4 -3
- package/src/maintenance/tier-stats.ts +2 -1
- package/src/namespaces/catalog.ts +2 -1
- package/src/namespaces/migrate.ts +2 -1
- package/src/namespaces/principal.ts +6 -5
- package/src/namespaces/scope-profiles.ts +2 -1
- package/src/namespaces/search.ts +2 -1
- package/src/namespaces/storage.ts +4 -3
- package/src/operator-toolkit.ts +19 -18
- package/src/orchestration/maintenance.ts +8 -4
- package/src/orchestration/semantic-consolidation-coordinator.ts +454 -0
- package/src/orchestration/tier-migration-coordinator.ts +5 -4
- package/src/orchestrator.ts +78 -417
- package/src/scopes/scope-plan.ts +3 -2
- package/src/search/embed-helper.ts +5 -2
- package/src/search/factory.ts +9 -6
- package/src/summarizer.ts +3 -2
- package/dist/chunk-24D66MMN.js.map +0 -1
- package/dist/chunk-646B5ERJ.js.map +0 -1
- package/dist/chunk-6TUWSUUD.js.map +0 -1
- package/dist/chunk-CGPHMNL4.js.map +0 -1
- package/dist/chunk-CX77GNMB.js.map +0 -1
- package/dist/chunk-DKT3X5C3.js.map +0 -1
- package/dist/chunk-FFUCCKPN.js.map +0 -1
- package/dist/chunk-GGL34GCW.js.map +0 -1
- package/dist/chunk-H3MB3F62.js.map +0 -1
- package/dist/chunk-HHNSLPX7.js.map +0 -1
- package/dist/chunk-J6BH2OBA.js.map +0 -1
- package/dist/chunk-KQYGNGON.js.map +0 -1
- package/dist/chunk-KSJCXXOU.js.map +0 -1
- package/dist/chunk-LUCARK4W.js.map +0 -1
- package/dist/chunk-NIZQH6AU.js.map +0 -1
- package/dist/chunk-OTQE66IX.js.map +0 -1
- package/dist/chunk-OUITHS6V.js.map +0 -1
- package/dist/chunk-P3VJCTVE.js.map +0 -1
- package/dist/chunk-PLBIPT6I.js.map +0 -1
- package/dist/chunk-PMAQRUN4.js.map +0 -1
- package/dist/chunk-UZYLX7M6.js.map +0 -1
- package/dist/chunk-ZQUAVZNG.js.map +0 -1
- package/dist/chunk-ZVHRSR2R.js.map +0 -1
- package/dist/first-start-migration-OOR57AYR.js.map +0 -1
- package/dist/tier-stats-3LYQ3VV5.js.map +0 -1
- /package/dist/{chunk-NOU77OHX.js.map → chunk-5DIKZKOD.js.map} +0 -0
- /package/dist/{chunk-FYWUNVFZ.js.map → chunk-IDIXGGDN.js.map} +0 -0
- /package/dist/{chunk-HJWQJUKQ.js.map → chunk-NDYQIN6C.js.map} +0 -0
- /package/dist/{chunk-QZHF4BWN.js.map → chunk-Q5LGXWNG.js.map} +0 -0
- /package/dist/{chunk-O4ZIBPIW.js.map → chunk-T7CGPTFU.js.map} +0 -0
- /package/dist/{contradiction-scan-HWGEOUDS.js.map → contradiction-scan-OUHMCUBT.js.map} +0 -0
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
} from "./chunk-SYX73XD7.js";
|
|
11
11
|
import {
|
|
12
12
|
MaintenanceScheduler
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5OYHJIJN.js";
|
|
14
|
+
import {
|
|
15
|
+
runPeerProfileReasoner
|
|
16
|
+
} from "./chunk-I74SUMNI.js";
|
|
14
17
|
import {
|
|
15
18
|
migrateFromEngram
|
|
16
19
|
} from "./chunk-7HYPN2GC.js";
|
|
@@ -26,7 +29,7 @@ import {
|
|
|
26
29
|
import {
|
|
27
30
|
CompoundingEngine,
|
|
28
31
|
defaultTierMigrationCycleBudget
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ET5HXSQL.js";
|
|
30
33
|
import {
|
|
31
34
|
SharedContextManager
|
|
32
35
|
} from "./chunk-UFS7OXGL.js";
|
|
@@ -60,7 +63,7 @@ import {
|
|
|
60
63
|
} from "./chunk-UHGBNIOS.js";
|
|
61
64
|
import {
|
|
62
65
|
HourlySummarizer
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-PEF2XOIV.js";
|
|
64
67
|
import {
|
|
65
68
|
buildTargetedFactRecallSection,
|
|
66
69
|
shouldRecallTargetedFactEvidence
|
|
@@ -157,7 +160,7 @@ import {
|
|
|
157
160
|
} from "./chunk-LTHVM4XN.js";
|
|
158
161
|
import {
|
|
159
162
|
ExtractionEngine
|
|
160
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-WTTVFSCO.js";
|
|
161
164
|
import {
|
|
162
165
|
parseMemoryActionEligibilityContext
|
|
163
166
|
} from "./chunk-5GSUBCZM.js";
|
|
@@ -166,7 +169,7 @@ import {
|
|
|
166
169
|
} from "./chunk-PWFWCGOO.js";
|
|
167
170
|
import {
|
|
168
171
|
LocalLlmClient
|
|
169
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-2L5RTVMO.js";
|
|
170
173
|
import {
|
|
171
174
|
buildFocusedListRecallSection,
|
|
172
175
|
shouldRecallFocusedListEvidence
|
|
@@ -190,12 +193,12 @@ import {
|
|
|
190
193
|
} from "./chunk-Q6IP2ARR.js";
|
|
191
194
|
import {
|
|
192
195
|
EmbeddingFallback
|
|
193
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-UH3NYOHN.js";
|
|
194
197
|
import {
|
|
195
198
|
buildEntityRecallSection,
|
|
196
199
|
entityRecentTranscriptLookbackHours,
|
|
197
200
|
readRecentEntityTranscriptEntries
|
|
198
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-V5OVSGB6.js";
|
|
199
202
|
import {
|
|
200
203
|
RoutingRulesStore
|
|
201
204
|
} from "./chunk-WIWPSQYU.js";
|
|
@@ -225,14 +228,14 @@ import {
|
|
|
225
228
|
import {
|
|
226
229
|
runNamespaceMaintenanceFanout,
|
|
227
230
|
summarizeNamespaceMaintenanceHealth
|
|
228
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-FAGERSH2.js";
|
|
229
232
|
import {
|
|
230
233
|
NamespaceCatalog,
|
|
231
234
|
planNamespaceMaintenance
|
|
232
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-7FPJFCXL.js";
|
|
233
236
|
import {
|
|
234
237
|
NamespaceStorageRouter
|
|
235
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-54RCE5Z3.js";
|
|
236
239
|
import {
|
|
237
240
|
searchHarmonicRetrieval
|
|
238
241
|
} from "./chunk-AV5ZEH4M.js";
|
|
@@ -330,14 +333,14 @@ import {
|
|
|
330
333
|
resolveNamespaceFromStorageDir,
|
|
331
334
|
resolveScopePlan,
|
|
332
335
|
resolveScopeProfilePlan
|
|
333
|
-
} from "./chunk-
|
|
336
|
+
} from "./chunk-UK6U5C3N.js";
|
|
334
337
|
import {
|
|
335
338
|
NamespaceSearchRouter
|
|
336
|
-
} from "./chunk-
|
|
339
|
+
} from "./chunk-3QETM5NG.js";
|
|
337
340
|
import {
|
|
338
341
|
createConversationIndexRuntime,
|
|
339
342
|
createSearchBackend
|
|
340
|
-
} from "./chunk-
|
|
343
|
+
} from "./chunk-K7PAILHO.js";
|
|
341
344
|
import {
|
|
342
345
|
NoopSearchBackend
|
|
343
346
|
} from "./chunk-CYEPCZN5.js";
|
|
@@ -360,14 +363,7 @@ import {
|
|
|
360
363
|
} from "./chunk-QDW3E4RD.js";
|
|
361
364
|
import {
|
|
362
365
|
shouldSkipImplicitExtraction
|
|
363
|
-
} from "./chunk-
|
|
364
|
-
import {
|
|
365
|
-
resolveCapabilities,
|
|
366
|
-
resolveCreationMemoryCapabilities,
|
|
367
|
-
resolveGraphConstructionCapabilities,
|
|
368
|
-
resolveIndexingCapabilities,
|
|
369
|
-
resolveMemoryLifecycleCapabilities
|
|
370
|
-
} from "./chunk-ESF7TRYJ.js";
|
|
366
|
+
} from "./chunk-CILX2XW7.js";
|
|
371
367
|
import {
|
|
372
368
|
searchCausalTrajectories
|
|
373
369
|
} from "./chunk-SQNED75R.js";
|
|
@@ -469,7 +465,18 @@ import {
|
|
|
469
465
|
defaultNamespaceForPrincipal,
|
|
470
466
|
recallNamespacesForPrincipal,
|
|
471
467
|
resolvePrincipal
|
|
472
|
-
} from "./chunk-
|
|
468
|
+
} from "./chunk-LV32K4OP.js";
|
|
469
|
+
import {
|
|
470
|
+
resolveCapabilities,
|
|
471
|
+
resolveCreationMemoryCapabilities,
|
|
472
|
+
resolveGraphConstructionCapabilities,
|
|
473
|
+
resolveIdentityContinuityCapabilities,
|
|
474
|
+
resolveIndexingCapabilities,
|
|
475
|
+
resolveLocalLlmCapabilities,
|
|
476
|
+
resolveMemoryLifecycleCapabilities,
|
|
477
|
+
resolveNamespaceCapabilities,
|
|
478
|
+
resolveQmdCapabilities
|
|
479
|
+
} from "./chunk-SHJGBAIW.js";
|
|
473
480
|
import {
|
|
474
481
|
isSafeRouteNamespace,
|
|
475
482
|
selectRouteRule
|
|
@@ -587,7 +594,7 @@ var TierMigrationCoordinator = class {
|
|
|
587
594
|
const { config, tierMigrationStatus } = this.deps;
|
|
588
595
|
const dryRun = options?.dryRun === true;
|
|
589
596
|
const persistSkipped = options?.force === true || trigger === "manual";
|
|
590
|
-
if (!config.
|
|
597
|
+
if (!resolveQmdCapabilities(config).qmdTierMigration && options?.force !== true) {
|
|
591
598
|
const skipped = {
|
|
592
599
|
trigger,
|
|
593
600
|
scanned: 0,
|
|
@@ -601,7 +608,7 @@ var TierMigrationCoordinator = class {
|
|
|
601
608
|
if (persistSkipped) await tierMigrationStatus.recordCycle(skipped);
|
|
602
609
|
return skipped;
|
|
603
610
|
}
|
|
604
|
-
if (trigger === "maintenance" && !config.
|
|
611
|
+
if (trigger === "maintenance" && !resolveQmdCapabilities(config).qmdTierAutoBackfill && options?.force !== true) {
|
|
605
612
|
const skipped = {
|
|
606
613
|
trigger,
|
|
607
614
|
scanned: 0,
|
|
@@ -649,7 +656,7 @@ var TierMigrationCoordinator = class {
|
|
|
649
656
|
}
|
|
650
657
|
const policy = applyUtilityPromotionRuntimePolicy(
|
|
651
658
|
{
|
|
652
|
-
enabled: config.
|
|
659
|
+
enabled: resolveQmdCapabilities(config).qmdTierMigration,
|
|
653
660
|
demotionMinAgeDays: config.qmdTierDemotionMinAgeDays,
|
|
654
661
|
demotionValueThreshold: config.qmdTierDemotionValueThreshold,
|
|
655
662
|
promotionValueThreshold: config.qmdTierPromotionValueThreshold
|
|
@@ -684,7 +691,7 @@ var TierMigrationCoordinator = class {
|
|
|
684
691
|
qmd: this.deps.getQmd(),
|
|
685
692
|
hotCollection: config.qmdCollection,
|
|
686
693
|
coldCollection: config.qmdColdCollection ?? `${config.qmdCollection}-cold`,
|
|
687
|
-
autoEmbed: config.
|
|
694
|
+
autoEmbed: resolveQmdCapabilities(config).qmdAutoEmbed
|
|
688
695
|
});
|
|
689
696
|
let migrated = 0;
|
|
690
697
|
let promoted = 0;
|
|
@@ -872,6 +879,257 @@ var ExtractionQueueCoordinator = class {
|
|
|
872
879
|
}
|
|
873
880
|
};
|
|
874
881
|
|
|
882
|
+
// src/orchestration/semantic-consolidation-coordinator.ts
|
|
883
|
+
var SemanticConsolidationCoordinator = class {
|
|
884
|
+
constructor(deps) {
|
|
885
|
+
this.deps = deps;
|
|
886
|
+
}
|
|
887
|
+
deps;
|
|
888
|
+
get config() {
|
|
889
|
+
return this.deps.config;
|
|
890
|
+
}
|
|
891
|
+
async runSemanticConsolidation(options) {
|
|
892
|
+
const targetStorage = options?.storage ?? this.deps.getStorage();
|
|
893
|
+
const result = {
|
|
894
|
+
clustersFound: 0,
|
|
895
|
+
memoriesConsolidated: 0,
|
|
896
|
+
memoriesArchived: 0,
|
|
897
|
+
errors: 0,
|
|
898
|
+
clusters: []
|
|
899
|
+
};
|
|
900
|
+
if (!this.config.semanticConsolidationEnabled && !options?.force) {
|
|
901
|
+
log.debug("[semantic-consolidation] disabled in config");
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
log.info("[semantic-consolidation] starting run");
|
|
905
|
+
const allMemories = await targetStorage.readAllMemories();
|
|
906
|
+
if (allMemories.length < 10) {
|
|
907
|
+
log.debug("[semantic-consolidation] too few memories, skipping");
|
|
908
|
+
return result;
|
|
909
|
+
}
|
|
910
|
+
const threshold = options?.thresholdOverride ?? this.config.semanticConsolidationThreshold;
|
|
911
|
+
const clusters = findSimilarClusters(allMemories, {
|
|
912
|
+
threshold,
|
|
913
|
+
minClusterSize: this.config.semanticConsolidationMinClusterSize,
|
|
914
|
+
excludeCategories: this.config.semanticConsolidationExcludeCategories,
|
|
915
|
+
maxPerRun: this.config.semanticConsolidationMaxPerRun
|
|
916
|
+
});
|
|
917
|
+
result.clustersFound = clusters.length;
|
|
918
|
+
result.clusters = clusters;
|
|
919
|
+
if (clusters.length === 0) {
|
|
920
|
+
log.info("[semantic-consolidation] no clusters found");
|
|
921
|
+
return result;
|
|
922
|
+
}
|
|
923
|
+
log.info(`[semantic-consolidation] found ${clusters.length} cluster(s)`);
|
|
924
|
+
if (options?.dryRun) {
|
|
925
|
+
log.info(
|
|
926
|
+
"[semantic-consolidation] dry run \u2014 skipping LLM synthesis and archival"
|
|
927
|
+
);
|
|
928
|
+
return result;
|
|
929
|
+
}
|
|
930
|
+
const useGateway = this.config.modelSource === "gateway";
|
|
931
|
+
const modelSetting = this.config.semanticConsolidationModel;
|
|
932
|
+
if (modelSetting === "fast" && this.deps.getFastLlm() && !useGateway) {
|
|
933
|
+
log.info("[semantic-consolidation] using fast local LLM for synthesis");
|
|
934
|
+
}
|
|
935
|
+
const gatewayChainOptions = !useGateway ? {} : modelSetting === "fast" ? this.config.fastGatewayAgentId ? { agentId: this.config.fastGatewayAgentId } : this.config.gatewayAgentId ? { agentId: this.config.gatewayAgentId } : {} : gatewayTaskChainOptions(this.config);
|
|
936
|
+
const llm = new FallbackLlmClient(
|
|
937
|
+
this.config.gatewayConfig,
|
|
938
|
+
fallbackLlmRuntimeContextFromConfig(this.config)
|
|
939
|
+
);
|
|
940
|
+
if (!llm.isAvailable(gatewayChainOptions) && !(modelSetting === "fast" && this.deps.getFastLlm() && !useGateway)) {
|
|
941
|
+
log.warn(
|
|
942
|
+
"[semantic-consolidation] no LLM available \u2014 skipping synthesis"
|
|
943
|
+
);
|
|
944
|
+
return result;
|
|
945
|
+
}
|
|
946
|
+
let extensionsBlock = "";
|
|
947
|
+
try {
|
|
948
|
+
extensionsBlock = await buildExtensionsBlockForConsolidation(this.config);
|
|
949
|
+
} catch (err) {
|
|
950
|
+
log.warn(`[semantic-consolidation] extension discovery failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
|
|
951
|
+
}
|
|
952
|
+
for (const cluster of clusters) {
|
|
953
|
+
let canonicalWriteCompleted = false;
|
|
954
|
+
try {
|
|
955
|
+
const operatorAwareEnabled = this.config.operatorAwareConsolidationEnabled === true;
|
|
956
|
+
let prompt = operatorAwareEnabled ? buildOperatorAwareConsolidationPrompt(cluster) : buildConsolidationPrompt(cluster);
|
|
957
|
+
if (extensionsBlock.length > 0) {
|
|
958
|
+
prompt += "\n\n" + extensionsBlock;
|
|
959
|
+
}
|
|
960
|
+
const messages = [
|
|
961
|
+
{
|
|
962
|
+
role: "system",
|
|
963
|
+
content: operatorAwareEnabled ? 'You are a memory consolidation system. Return ONLY a JSON object with two keys, "operator" and "output". The "operator" value MUST be one of the exact strings "merge", "update", or "split" \u2014 never a pipe-separated placeholder, never prose. The "output" value is the canonical memory text.' : "You are a memory consolidation system. Output only the consolidated memory text."
|
|
964
|
+
},
|
|
965
|
+
{ role: "user", content: prompt }
|
|
966
|
+
];
|
|
967
|
+
const llmOpts = { temperature: 0.2, maxTokens: 2e3 };
|
|
968
|
+
let response = null;
|
|
969
|
+
if (useGateway) {
|
|
970
|
+
response = await llm.chatCompletion(messages, { ...llmOpts, ...gatewayChainOptions });
|
|
971
|
+
} else if (modelSetting === "fast" && this.deps.getFastLlm()) {
|
|
972
|
+
const fastResult = await this.deps.getFastLlm().chatCompletion(messages, {
|
|
973
|
+
operation: "semantic-consolidation",
|
|
974
|
+
maxTokens: llmOpts.maxTokens,
|
|
975
|
+
temperature: llmOpts.temperature,
|
|
976
|
+
priority: "background",
|
|
977
|
+
forceDisableThinking: true
|
|
978
|
+
});
|
|
979
|
+
response = fastResult ? { content: fastResult.content } : null;
|
|
980
|
+
} else {
|
|
981
|
+
response = await llm.chatCompletion(messages, llmOpts);
|
|
982
|
+
}
|
|
983
|
+
if (!response?.content) {
|
|
984
|
+
log.warn(
|
|
985
|
+
`[semantic-consolidation] empty LLM response for cluster in "${cluster.category}"`
|
|
986
|
+
);
|
|
987
|
+
result.errors++;
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
let canonicalContent;
|
|
991
|
+
let operator;
|
|
992
|
+
if (operatorAwareEnabled) {
|
|
993
|
+
const parsed = parseOperatorAwareConsolidationResponse(
|
|
994
|
+
response.content,
|
|
995
|
+
cluster
|
|
996
|
+
);
|
|
997
|
+
canonicalContent = parsed.output;
|
|
998
|
+
operator = parsed.operator;
|
|
999
|
+
} else {
|
|
1000
|
+
canonicalContent = parseConsolidationResponse(response.content);
|
|
1001
|
+
operator = chooseConsolidationOperator(cluster);
|
|
1002
|
+
}
|
|
1003
|
+
cluster.canonicalContent = canonicalContent;
|
|
1004
|
+
const sorted = [...cluster.memories].sort(
|
|
1005
|
+
(a, b) => new Date(b.frontmatter.created).getTime() - new Date(a.frontmatter.created).getTime()
|
|
1006
|
+
);
|
|
1007
|
+
const newest = sorted[0];
|
|
1008
|
+
const lineageIds = cluster.memories.map((m) => m.frontmatter.id);
|
|
1009
|
+
const derivedFromEntries = [];
|
|
1010
|
+
for (const m of cluster.memories) {
|
|
1011
|
+
if (!m.path) continue;
|
|
1012
|
+
const entry = await targetStorage.snapshotForProvenance(m.path);
|
|
1013
|
+
if (entry) derivedFromEntries.push(entry);
|
|
1014
|
+
}
|
|
1015
|
+
const { id: canonicalId, tombstoneBlocked: canonicalBlocked } = await targetStorage.writeMemory(
|
|
1016
|
+
newest.frontmatter.category,
|
|
1017
|
+
canonicalContent,
|
|
1018
|
+
{
|
|
1019
|
+
actor: "semantic-consolidation",
|
|
1020
|
+
confidence: newest.frontmatter.confidence,
|
|
1021
|
+
tags: [
|
|
1022
|
+
...new Set(
|
|
1023
|
+
cluster.memories.flatMap((m) => m.frontmatter.tags ?? [])
|
|
1024
|
+
)
|
|
1025
|
+
],
|
|
1026
|
+
source: "semantic-consolidation",
|
|
1027
|
+
lineage: lineageIds,
|
|
1028
|
+
derivedFrom: derivedFromEntries.length > 0 ? derivedFromEntries : void 0,
|
|
1029
|
+
derivedVia: operator
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
if (canonicalBlocked) {
|
|
1033
|
+
log.info(`[semantic-consolidation] cluster in "${cluster.category}" tombstone-blocked \u2014 keeping ${cluster.memories.length} source(s) active (pending_review ${canonicalId})`);
|
|
1034
|
+
continue;
|
|
1035
|
+
}
|
|
1036
|
+
canonicalWriteCompleted = true;
|
|
1037
|
+
result.memoriesConsolidated++;
|
|
1038
|
+
for (const m of cluster.memories) {
|
|
1039
|
+
const archiveResult = await targetStorage.archiveMemory(m, {
|
|
1040
|
+
actor: "semantic-consolidation",
|
|
1041
|
+
reasonCode: "semantic-consolidation",
|
|
1042
|
+
relatedMemoryIds: [canonicalId]
|
|
1043
|
+
});
|
|
1044
|
+
if (archiveResult) {
|
|
1045
|
+
await this.deps.removeContentHashForMemory(
|
|
1046
|
+
targetStorage,
|
|
1047
|
+
m,
|
|
1048
|
+
"semantic-consolidation"
|
|
1049
|
+
);
|
|
1050
|
+
try {
|
|
1051
|
+
await this.deps.embeddingFallback.removeFromIndex(m.frontmatter.id);
|
|
1052
|
+
if (resolveIndexingCapabilities(this.config).queryAwareIndexing && m.path && m.frontmatter?.created) {
|
|
1053
|
+
deindexMemory(
|
|
1054
|
+
targetStorage.dir,
|
|
1055
|
+
m.path,
|
|
1056
|
+
m.frontmatter.created,
|
|
1057
|
+
m.frontmatter.tags ?? []
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
} catch (cleanupErr) {
|
|
1061
|
+
log.warn(
|
|
1062
|
+
`[semantic-consolidation] index cleanup failed (non-fatal): ${cleanupErr}`
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
result.memoriesArchived++;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
log.info(
|
|
1069
|
+
`[semantic-consolidation] consolidated ${cluster.memories.length} memories \u2192 ${canonicalId}`
|
|
1070
|
+
);
|
|
1071
|
+
} catch (err) {
|
|
1072
|
+
log.warn(
|
|
1073
|
+
`[semantic-consolidation] cluster processing failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1074
|
+
);
|
|
1075
|
+
result.errors++;
|
|
1076
|
+
} finally {
|
|
1077
|
+
if (canonicalWriteCompleted) {
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (result.memoriesArchived > 0) {
|
|
1082
|
+
await this.deps.saveContentHashIndexes().catch(
|
|
1083
|
+
(err) => log.warn(
|
|
1084
|
+
`[semantic-consolidation] content-hash index save failed: ${err}`
|
|
1085
|
+
)
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
log.info(
|
|
1089
|
+
`[semantic-consolidation] complete: clusters=${result.clustersFound}, consolidated=${result.memoriesConsolidated}, archived=${result.memoriesArchived}, errors=${result.errors}`
|
|
1090
|
+
);
|
|
1091
|
+
try {
|
|
1092
|
+
await materializeAfterSemanticConsolidation({
|
|
1093
|
+
config: this.config,
|
|
1094
|
+
memoryDir: targetStorage.dir
|
|
1095
|
+
});
|
|
1096
|
+
} catch (err) {
|
|
1097
|
+
log.warn(
|
|
1098
|
+
`[semantic-consolidation] Codex materialize post-hook failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
if (this.config.peerProfileReasonerEnabled) {
|
|
1102
|
+
try {
|
|
1103
|
+
const peerLlm = new FallbackLlmClient(
|
|
1104
|
+
this.config.gatewayConfig,
|
|
1105
|
+
fallbackLlmRuntimeContextFromConfig(this.config)
|
|
1106
|
+
);
|
|
1107
|
+
const peerResult = await runPeerProfileReasoner({
|
|
1108
|
+
memoryDir: targetStorage.dir,
|
|
1109
|
+
enabled: true,
|
|
1110
|
+
llm: peerLlm,
|
|
1111
|
+
model: this.config.peerProfileReasonerModel,
|
|
1112
|
+
minInteractions: this.config.peerProfileReasonerMinInteractions,
|
|
1113
|
+
maxFieldsPerRun: this.config.peerProfileReasonerMaxFieldsPerRun,
|
|
1114
|
+
log: {
|
|
1115
|
+
debug: (msg) => log.debug(msg),
|
|
1116
|
+
info: (msg) => log.info(msg),
|
|
1117
|
+
warn: (msg) => log.warn(msg)
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
log.info(
|
|
1121
|
+
`[peer-profile-reasoner] complete: peers=${peerResult.peersConsidered}, processed=${peerResult.peersProcessed}, fields=${peerResult.fieldsApplied}`
|
|
1122
|
+
);
|
|
1123
|
+
} catch (err) {
|
|
1124
|
+
log.warn(
|
|
1125
|
+
`[peer-profile-reasoner] post-consolidation hook failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return result;
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
875
1133
|
// src/maintenance/pattern-reinforcement.ts
|
|
876
1134
|
function patternReinforcementKey(content) {
|
|
877
1135
|
return content.trim().toLowerCase().replace(/\s+/g, " ").slice(0, 200);
|
|
@@ -3031,6 +3289,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
3031
3289
|
tierMigrationStatus;
|
|
3032
3290
|
tierMigrationCoordinator;
|
|
3033
3291
|
compressionGuidelineCoordinator;
|
|
3292
|
+
semanticConsolidationCoordinator;
|
|
3034
3293
|
/**
|
|
3035
3294
|
* In-memory X-ray snapshot from the most recent `recall()` call that
|
|
3036
3295
|
* was invoked with `xrayCapture: true` (issue #570 PR 1). Scope is
|
|
@@ -3324,7 +3583,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
3324
3583
|
* @internal
|
|
3325
3584
|
*/
|
|
3326
3585
|
applyCodingNamespaceOverlay(sessionKey, baseNamespace) {
|
|
3327
|
-
if (!this.config.
|
|
3586
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) return baseNamespace;
|
|
3328
3587
|
const codingContext = this.getCodingContextForSession(sessionKey);
|
|
3329
3588
|
const overlay = resolveCodingNamespaceOverlay(codingContext, this.config.codingMode, this.config.defaultNamespace);
|
|
3330
3589
|
if (!overlay) return baseNamespace;
|
|
@@ -3392,7 +3651,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
3392
3651
|
* @internal
|
|
3393
3652
|
*/
|
|
3394
3653
|
applyCodingRecallOverlay(sessionKey) {
|
|
3395
|
-
if (!this.config.
|
|
3654
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) return null;
|
|
3396
3655
|
const codingContext = this.getCodingContextForSession(sessionKey);
|
|
3397
3656
|
const overlay = resolveCodingNamespaceOverlay(codingContext, this.config.codingMode, this.config.defaultNamespace);
|
|
3398
3657
|
if (!overlay) return null;
|
|
@@ -3406,7 +3665,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
3406
3665
|
return getConfiguredNamespaces(this.config);
|
|
3407
3666
|
}
|
|
3408
3667
|
rememberNamespaceStorageDirHint(namespace, storageDir) {
|
|
3409
|
-
if (!this.config.
|
|
3668
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces || !storageDir) return;
|
|
3410
3669
|
const ns = normalizeNamespaceIdentity(namespace);
|
|
3411
3670
|
if (!ns) return;
|
|
3412
3671
|
const defaultNs = normalizeNamespaceIdentity(this.config.defaultNamespace);
|
|
@@ -3557,8 +3816,8 @@ var Orchestrator = class _Orchestrator {
|
|
|
3557
3816
|
return summarizeNamespaceMaintenanceHealth(this.config);
|
|
3558
3817
|
}
|
|
3559
3818
|
buildConfiguredQmdSearchOptions(queryText) {
|
|
3560
|
-
const intentHint = this.config.
|
|
3561
|
-
const explain = this.config.
|
|
3819
|
+
const intentHint = resolveQmdCapabilities(this.config).qmdIntentHints ? buildQmdIntentHint(inferIntentFromText(queryText)) : void 0;
|
|
3820
|
+
const explain = resolveQmdCapabilities(this.config).qmdExplain === true;
|
|
3562
3821
|
const searchOptions = {};
|
|
3563
3822
|
if (intentHint) {
|
|
3564
3823
|
searchOptions.intent = intentHint;
|
|
@@ -3569,15 +3828,15 @@ var Orchestrator = class _Orchestrator {
|
|
|
3569
3828
|
return Object.keys(searchOptions).length > 0 ? searchOptions : void 0;
|
|
3570
3829
|
}
|
|
3571
3830
|
async searchAcrossNamespaces(options) {
|
|
3572
|
-
if (this.config.
|
|
3831
|
+
if (resolveNamespaceCapabilities(this.config).namespaces && options.namespaces !== void 0 && options.namespaces.length === 0) {
|
|
3573
3832
|
return [];
|
|
3574
3833
|
}
|
|
3575
|
-
const namespaces = this.config.
|
|
3834
|
+
const namespaces = resolveNamespaceCapabilities(this.config).namespaces ? Array.from(
|
|
3576
3835
|
new Set(
|
|
3577
3836
|
(options.namespaces?.length ? options.namespaces : this.configuredNamespaceList()).map((value) => value.trim()).filter(Boolean)
|
|
3578
3837
|
)
|
|
3579
3838
|
) : [this.config.defaultNamespace];
|
|
3580
|
-
if (!this.config.
|
|
3839
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) {
|
|
3581
3840
|
switch (options.mode) {
|
|
3582
3841
|
case "hybrid":
|
|
3583
3842
|
return await this.qmd.hybridSearch(
|
|
@@ -3623,7 +3882,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
3623
3882
|
return await this.namespaceSearchRouter.healthForNamespace(namespace, execution);
|
|
3624
3883
|
}
|
|
3625
3884
|
isSearchAvailableForNamespaceRouting() {
|
|
3626
|
-
if (this.config.
|
|
3885
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) return true;
|
|
3627
3886
|
return this.qmd.isAvailable();
|
|
3628
3887
|
}
|
|
3629
3888
|
invalidateLiveContentHashIndex() {
|
|
@@ -3891,6 +4150,14 @@ var Orchestrator = class _Orchestrator {
|
|
|
3891
4150
|
client.disableThinking = true;
|
|
3892
4151
|
return client;
|
|
3893
4152
|
})() : this.localLlm;
|
|
4153
|
+
this.semanticConsolidationCoordinator = new SemanticConsolidationCoordinator({
|
|
4154
|
+
config,
|
|
4155
|
+
getStorage: () => this.storage,
|
|
4156
|
+
getFastLlm: () => this.fastLlm,
|
|
4157
|
+
embeddingFallback: this.embeddingFallback,
|
|
4158
|
+
removeContentHashForMemory: (targetStorage, memory, context) => this.removeContentHashForMemory(targetStorage, memory, context),
|
|
4159
|
+
saveContentHashIndexes: () => this.saveContentHashIndexes()
|
|
4160
|
+
});
|
|
3894
4161
|
this._fastGatewayLlm = config.modelSource === "gateway" ? new FallbackLlmClient(
|
|
3895
4162
|
config.gatewayConfig,
|
|
3896
4163
|
fallbackLlmRuntimeContextFromConfig(config)
|
|
@@ -4003,7 +4270,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4003
4270
|
};
|
|
4004
4271
|
}
|
|
4005
4272
|
routeEngineOptions() {
|
|
4006
|
-
const allowedNamespaces = this.config.
|
|
4273
|
+
const allowedNamespaces = resolveNamespaceCapabilities(this.config).namespaces ? Array.from(
|
|
4007
4274
|
/* @__PURE__ */ new Set([
|
|
4008
4275
|
this.config.defaultNamespace,
|
|
4009
4276
|
this.config.sharedNamespace,
|
|
@@ -4143,7 +4410,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4143
4410
|
get briefingChainFollowupGenerator() {
|
|
4144
4411
|
const chainAvailable = this.config.modelSource === "gateway" ? this._fastGatewayLlm?.isAvailable(
|
|
4145
4412
|
this.config.fastGatewayAgentId || this.config.gatewayAgentId || void 0
|
|
4146
|
-
) === true : this.config.
|
|
4413
|
+
) === true : resolveLocalLlmCapabilities(this.config).localLlm;
|
|
4147
4414
|
if (!chainAvailable) return void 0;
|
|
4148
4415
|
return buildChainFollowupGenerator(this.fastLlmForRerank);
|
|
4149
4416
|
}
|
|
@@ -4158,7 +4425,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4158
4425
|
});
|
|
4159
4426
|
await this.storage.ensureDirectories();
|
|
4160
4427
|
await this.storage.loadAliases();
|
|
4161
|
-
if (this.config.
|
|
4428
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
4162
4429
|
const namespaces = /* @__PURE__ */ new Set([
|
|
4163
4430
|
this.config.defaultNamespace,
|
|
4164
4431
|
this.config.sharedNamespace,
|
|
@@ -4247,12 +4514,12 @@ var Orchestrator = class _Orchestrator {
|
|
|
4247
4514
|
const available = await this.qmd.probe();
|
|
4248
4515
|
if (available) {
|
|
4249
4516
|
log.info(`Search backend: available ${this.qmd.debugStatus()}`);
|
|
4250
|
-
const namespaces = this.config.
|
|
4517
|
+
const namespaces = resolveNamespaceCapabilities(this.config).namespaces ? await this.maintenanceNamespaces() : [this.config.defaultNamespace];
|
|
4251
4518
|
const states = await Promise.all(
|
|
4252
4519
|
namespaces.map(async (namespace) => {
|
|
4253
4520
|
const collectionCheckAbort = new AbortController();
|
|
4254
4521
|
const state = await qmdStartupCollectionCheckWithTimeout(
|
|
4255
|
-
this.config.
|
|
4522
|
+
resolveNamespaceCapabilities(this.config).namespaces ? this.namespaceSearchRouter.ensureNamespaceCollection(
|
|
4256
4523
|
namespace,
|
|
4257
4524
|
{ signal: collectionCheckAbort.signal }
|
|
4258
4525
|
) : this.qmd.ensureCollection(
|
|
@@ -4327,10 +4594,10 @@ var Orchestrator = class _Orchestrator {
|
|
|
4327
4594
|
}
|
|
4328
4595
|
async deferredInitialize(signal) {
|
|
4329
4596
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(this.config);
|
|
4330
|
-
if (this.qmd.isAvailable() && this.config.
|
|
4597
|
+
if (this.qmd.isAvailable() && resolveQmdCapabilities(this.config).qmdMaintenance) {
|
|
4331
4598
|
try {
|
|
4332
4599
|
log.info("QMD startup sync: updating index to match current disk state");
|
|
4333
|
-
if (this.config.
|
|
4600
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
4334
4601
|
await this.namespaceSearchRouter.updateNamespaces(
|
|
4335
4602
|
await this.maintenanceNamespaces(),
|
|
4336
4603
|
{ signal }
|
|
@@ -4414,7 +4681,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4414
4681
|
}
|
|
4415
4682
|
}
|
|
4416
4683
|
if (signal.aborted) return;
|
|
4417
|
-
if (this.config.
|
|
4684
|
+
if (resolveLocalLlmCapabilities(this.config).localLlm) {
|
|
4418
4685
|
try {
|
|
4419
4686
|
await this.validateLocalLlmModel();
|
|
4420
4687
|
} catch (err) {
|
|
@@ -4424,9 +4691,9 @@ var Orchestrator = class _Orchestrator {
|
|
|
4424
4691
|
if (signal.aborted) return;
|
|
4425
4692
|
await this.maintenanceScheduler.autoRegisterCrons(signal);
|
|
4426
4693
|
if (signal.aborted) return;
|
|
4427
|
-
if (lifecycleCaps.lifecyclePolicy && this.config.
|
|
4694
|
+
if (lifecycleCaps.lifecyclePolicy && resolveQmdCapabilities(this.config).qmdTierMigration) {
|
|
4428
4695
|
try {
|
|
4429
|
-
const { runFirstStartMigration } = await import("./first-start-migration-
|
|
4696
|
+
const { runFirstStartMigration } = await import("./first-start-migration-W4U6XDKI.js");
|
|
4430
4697
|
const result = await runFirstStartMigration({
|
|
4431
4698
|
storage: this.storage,
|
|
4432
4699
|
config: this.config,
|
|
@@ -4500,14 +4767,14 @@ var Orchestrator = class _Orchestrator {
|
|
|
4500
4767
|
return false;
|
|
4501
4768
|
}
|
|
4502
4769
|
log.info(`startupSearchSync: backend now available ${this.qmd.debugStatus()}`);
|
|
4503
|
-
if (this.config.
|
|
4770
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
4504
4771
|
this.namespaceSearchRouter.clearCache();
|
|
4505
4772
|
}
|
|
4506
|
-
const namespaces = this.config.
|
|
4773
|
+
const namespaces = resolveNamespaceCapabilities(this.config).namespaces ? await this.maintenanceNamespaces() : [this.config.defaultNamespace];
|
|
4507
4774
|
const states = await Promise.all(
|
|
4508
4775
|
namespaces.map(async (namespace) => ({
|
|
4509
4776
|
namespace,
|
|
4510
|
-
state: this.config.
|
|
4777
|
+
state: resolveNamespaceCapabilities(this.config).namespaces ? await this.namespaceSearchRouter.ensureNamespaceCollection(namespace, { signal }) : await this.qmd.ensureCollection(this.config.memoryDir, this.config.qmdCollection, { signal })
|
|
4511
4778
|
}))
|
|
4512
4779
|
);
|
|
4513
4780
|
if (signal?.aborted) {
|
|
@@ -4524,7 +4791,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4524
4791
|
log.warn("startupSearchSync: search collection missing; disabling search (fallback retrieval remains enabled)");
|
|
4525
4792
|
return false;
|
|
4526
4793
|
}
|
|
4527
|
-
if (this.config.
|
|
4794
|
+
if (resolveQmdCapabilities(this.config).qmdMaintenance) {
|
|
4528
4795
|
try {
|
|
4529
4796
|
const failTsBefore = "lastUpdateFailedAtMs" in this.qmd ? this.qmd.lastUpdateFailedAtMs : null;
|
|
4530
4797
|
const hasRunTs = "lastUpdateRanAtMs" in this.qmd;
|
|
@@ -4533,7 +4800,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4533
4800
|
}
|
|
4534
4801
|
log.info("startupSearchSync: updating index to match current disk state");
|
|
4535
4802
|
let namespacesUpdated = 0;
|
|
4536
|
-
if (this.config.
|
|
4803
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
4537
4804
|
namespacesUpdated = await this.namespaceSearchRouter.updateNamespaces(
|
|
4538
4805
|
namespaces,
|
|
4539
4806
|
{ signal }
|
|
@@ -4551,7 +4818,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
4551
4818
|
log.warn("startupSearchSync: update silently failed (detected via fail timestamp)");
|
|
4552
4819
|
return false;
|
|
4553
4820
|
}
|
|
4554
|
-
if (this.config.
|
|
4821
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
4555
4822
|
if (namespacesUpdated === 0) {
|
|
4556
4823
|
log.warn("startupSearchSync: no namespace backends were eligible for update (all unavailable or collections missing)");
|
|
4557
4824
|
return false;
|
|
@@ -4831,247 +5098,12 @@ ${doc.content}` : doc.content,
|
|
|
4831
5098
|
}
|
|
4832
5099
|
return summarizeGovernanceResultForDreams(govResult, options?.dryRun === true);
|
|
4833
5100
|
}
|
|
5101
|
+
// Issue #1526 (seam 5): semantic consolidation moved to
|
|
5102
|
+
// SemanticConsolidationCoordinator. Thin delegation keeps all
|
|
5103
|
+
// call sites (runConsolidation, runSemanticConsolidationNow,
|
|
5104
|
+
// runSemanticConsolidationFanout) stable.
|
|
4834
5105
|
async runSemanticConsolidation(options) {
|
|
4835
|
-
|
|
4836
|
-
const result = {
|
|
4837
|
-
clustersFound: 0,
|
|
4838
|
-
memoriesConsolidated: 0,
|
|
4839
|
-
memoriesArchived: 0,
|
|
4840
|
-
errors: 0,
|
|
4841
|
-
clusters: []
|
|
4842
|
-
};
|
|
4843
|
-
if (!this.config.semanticConsolidationEnabled && !options?.force) {
|
|
4844
|
-
log.debug("[semantic-consolidation] disabled in config");
|
|
4845
|
-
return result;
|
|
4846
|
-
}
|
|
4847
|
-
log.info("[semantic-consolidation] starting run");
|
|
4848
|
-
const allMemories = await targetStorage.readAllMemories();
|
|
4849
|
-
if (allMemories.length < 10) {
|
|
4850
|
-
log.debug("[semantic-consolidation] too few memories, skipping");
|
|
4851
|
-
return result;
|
|
4852
|
-
}
|
|
4853
|
-
const threshold = options?.thresholdOverride ?? this.config.semanticConsolidationThreshold;
|
|
4854
|
-
const clusters = findSimilarClusters(allMemories, {
|
|
4855
|
-
threshold,
|
|
4856
|
-
minClusterSize: this.config.semanticConsolidationMinClusterSize,
|
|
4857
|
-
excludeCategories: this.config.semanticConsolidationExcludeCategories,
|
|
4858
|
-
maxPerRun: this.config.semanticConsolidationMaxPerRun
|
|
4859
|
-
});
|
|
4860
|
-
result.clustersFound = clusters.length;
|
|
4861
|
-
result.clusters = clusters;
|
|
4862
|
-
if (clusters.length === 0) {
|
|
4863
|
-
log.info("[semantic-consolidation] no clusters found");
|
|
4864
|
-
return result;
|
|
4865
|
-
}
|
|
4866
|
-
log.info(`[semantic-consolidation] found ${clusters.length} cluster(s)`);
|
|
4867
|
-
if (options?.dryRun) {
|
|
4868
|
-
log.info(
|
|
4869
|
-
"[semantic-consolidation] dry run \u2014 skipping LLM synthesis and archival"
|
|
4870
|
-
);
|
|
4871
|
-
return result;
|
|
4872
|
-
}
|
|
4873
|
-
const { FallbackLlmClient: FallbackLlmClient2, gatewayTaskChainOptions: gatewayTaskChainOptions2 } = await import("./fallback-llm.js");
|
|
4874
|
-
const useGateway = this.config.modelSource === "gateway";
|
|
4875
|
-
const modelSetting = this.config.semanticConsolidationModel;
|
|
4876
|
-
if (modelSetting === "fast" && this.fastLlm && !useGateway) {
|
|
4877
|
-
log.info("[semantic-consolidation] using fast local LLM for synthesis");
|
|
4878
|
-
}
|
|
4879
|
-
const gatewayChainOptions = !useGateway ? {} : modelSetting === "fast" ? this.config.fastGatewayAgentId ? { agentId: this.config.fastGatewayAgentId } : this.config.gatewayAgentId ? { agentId: this.config.gatewayAgentId } : {} : gatewayTaskChainOptions2(this.config);
|
|
4880
|
-
const llm = new FallbackLlmClient2(
|
|
4881
|
-
this.config.gatewayConfig,
|
|
4882
|
-
fallbackLlmRuntimeContextFromConfig(this.config)
|
|
4883
|
-
);
|
|
4884
|
-
if (!llm.isAvailable(gatewayChainOptions) && !(modelSetting === "fast" && this.fastLlm && !useGateway)) {
|
|
4885
|
-
log.warn(
|
|
4886
|
-
"[semantic-consolidation] no LLM available \u2014 skipping synthesis"
|
|
4887
|
-
);
|
|
4888
|
-
return result;
|
|
4889
|
-
}
|
|
4890
|
-
let extensionsBlock = "";
|
|
4891
|
-
try {
|
|
4892
|
-
extensionsBlock = await buildExtensionsBlockForConsolidation(this.config);
|
|
4893
|
-
} catch (err) {
|
|
4894
|
-
log.warn(`[semantic-consolidation] extension discovery failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
|
|
4895
|
-
}
|
|
4896
|
-
for (const cluster of clusters) {
|
|
4897
|
-
let canonicalWriteCompleted = false;
|
|
4898
|
-
try {
|
|
4899
|
-
const operatorAwareEnabled = this.config.operatorAwareConsolidationEnabled === true;
|
|
4900
|
-
let prompt = operatorAwareEnabled ? buildOperatorAwareConsolidationPrompt(cluster) : buildConsolidationPrompt(cluster);
|
|
4901
|
-
if (extensionsBlock.length > 0) {
|
|
4902
|
-
prompt += "\n\n" + extensionsBlock;
|
|
4903
|
-
}
|
|
4904
|
-
const messages = [
|
|
4905
|
-
{
|
|
4906
|
-
role: "system",
|
|
4907
|
-
content: operatorAwareEnabled ? 'You are a memory consolidation system. Return ONLY a JSON object with two keys, "operator" and "output". The "operator" value MUST be one of the exact strings "merge", "update", or "split" \u2014 never a pipe-separated placeholder, never prose. The "output" value is the canonical memory text.' : "You are a memory consolidation system. Output only the consolidated memory text."
|
|
4908
|
-
},
|
|
4909
|
-
{ role: "user", content: prompt }
|
|
4910
|
-
];
|
|
4911
|
-
const llmOpts = { temperature: 0.2, maxTokens: 2e3 };
|
|
4912
|
-
let response = null;
|
|
4913
|
-
if (useGateway) {
|
|
4914
|
-
response = await llm.chatCompletion(messages, { ...llmOpts, ...gatewayChainOptions });
|
|
4915
|
-
} else if (modelSetting === "fast" && this.fastLlm) {
|
|
4916
|
-
const fastResult = await this.fastLlm.chatCompletion(messages, {
|
|
4917
|
-
operation: "semantic-consolidation",
|
|
4918
|
-
maxTokens: llmOpts.maxTokens,
|
|
4919
|
-
temperature: llmOpts.temperature,
|
|
4920
|
-
priority: "background",
|
|
4921
|
-
forceDisableThinking: true
|
|
4922
|
-
});
|
|
4923
|
-
response = fastResult ? { content: fastResult.content } : null;
|
|
4924
|
-
} else {
|
|
4925
|
-
response = await llm.chatCompletion(messages, llmOpts);
|
|
4926
|
-
}
|
|
4927
|
-
if (!response?.content) {
|
|
4928
|
-
log.warn(
|
|
4929
|
-
`[semantic-consolidation] empty LLM response for cluster in "${cluster.category}"`
|
|
4930
|
-
);
|
|
4931
|
-
result.errors++;
|
|
4932
|
-
continue;
|
|
4933
|
-
}
|
|
4934
|
-
let canonicalContent;
|
|
4935
|
-
let operator;
|
|
4936
|
-
if (operatorAwareEnabled) {
|
|
4937
|
-
const parsed = parseOperatorAwareConsolidationResponse(
|
|
4938
|
-
response.content,
|
|
4939
|
-
cluster
|
|
4940
|
-
);
|
|
4941
|
-
canonicalContent = parsed.output;
|
|
4942
|
-
operator = parsed.operator;
|
|
4943
|
-
} else {
|
|
4944
|
-
canonicalContent = parseConsolidationResponse(response.content);
|
|
4945
|
-
operator = chooseConsolidationOperator(cluster);
|
|
4946
|
-
}
|
|
4947
|
-
cluster.canonicalContent = canonicalContent;
|
|
4948
|
-
const sorted = [...cluster.memories].sort(
|
|
4949
|
-
(a, b) => new Date(b.frontmatter.created).getTime() - new Date(a.frontmatter.created).getTime()
|
|
4950
|
-
);
|
|
4951
|
-
const newest = sorted[0];
|
|
4952
|
-
const lineageIds = cluster.memories.map((m) => m.frontmatter.id);
|
|
4953
|
-
const derivedFromEntries = [];
|
|
4954
|
-
for (const m of cluster.memories) {
|
|
4955
|
-
if (!m.path) continue;
|
|
4956
|
-
const entry = await targetStorage.snapshotForProvenance(m.path);
|
|
4957
|
-
if (entry) derivedFromEntries.push(entry);
|
|
4958
|
-
}
|
|
4959
|
-
const { id: canonicalId, tombstoneBlocked: canonicalBlocked } = await targetStorage.writeMemory(
|
|
4960
|
-
newest.frontmatter.category,
|
|
4961
|
-
canonicalContent,
|
|
4962
|
-
{
|
|
4963
|
-
actor: "semantic-consolidation",
|
|
4964
|
-
confidence: newest.frontmatter.confidence,
|
|
4965
|
-
tags: [
|
|
4966
|
-
...new Set(
|
|
4967
|
-
cluster.memories.flatMap((m) => m.frontmatter.tags ?? [])
|
|
4968
|
-
)
|
|
4969
|
-
],
|
|
4970
|
-
source: "semantic-consolidation",
|
|
4971
|
-
lineage: lineageIds,
|
|
4972
|
-
derivedFrom: derivedFromEntries.length > 0 ? derivedFromEntries : void 0,
|
|
4973
|
-
derivedVia: operator
|
|
4974
|
-
}
|
|
4975
|
-
);
|
|
4976
|
-
if (canonicalBlocked) {
|
|
4977
|
-
log.info(`[semantic-consolidation] cluster in "${cluster.category}" tombstone-blocked \u2014 keeping ${cluster.memories.length} source(s) active (pending_review ${canonicalId})`);
|
|
4978
|
-
continue;
|
|
4979
|
-
}
|
|
4980
|
-
canonicalWriteCompleted = true;
|
|
4981
|
-
result.memoriesConsolidated++;
|
|
4982
|
-
for (const m of cluster.memories) {
|
|
4983
|
-
const archiveResult = await targetStorage.archiveMemory(m, {
|
|
4984
|
-
actor: "semantic-consolidation",
|
|
4985
|
-
reasonCode: "semantic-consolidation",
|
|
4986
|
-
relatedMemoryIds: [canonicalId]
|
|
4987
|
-
});
|
|
4988
|
-
if (archiveResult) {
|
|
4989
|
-
await this.removeContentHashForMemory(
|
|
4990
|
-
targetStorage,
|
|
4991
|
-
m,
|
|
4992
|
-
"semantic-consolidation"
|
|
4993
|
-
);
|
|
4994
|
-
try {
|
|
4995
|
-
await this.embeddingFallback.removeFromIndex(m.frontmatter.id);
|
|
4996
|
-
if (resolveIndexingCapabilities(this.config).queryAwareIndexing && m.path && m.frontmatter?.created) {
|
|
4997
|
-
deindexMemory(
|
|
4998
|
-
targetStorage.dir,
|
|
4999
|
-
m.path,
|
|
5000
|
-
m.frontmatter.created,
|
|
5001
|
-
m.frontmatter.tags ?? []
|
|
5002
|
-
);
|
|
5003
|
-
}
|
|
5004
|
-
} catch (cleanupErr) {
|
|
5005
|
-
log.warn(
|
|
5006
|
-
`[semantic-consolidation] index cleanup failed (non-fatal): ${cleanupErr}`
|
|
5007
|
-
);
|
|
5008
|
-
}
|
|
5009
|
-
result.memoriesArchived++;
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
|
-
log.info(
|
|
5013
|
-
`[semantic-consolidation] consolidated ${cluster.memories.length} memories \u2192 ${canonicalId}`
|
|
5014
|
-
);
|
|
5015
|
-
} catch (err) {
|
|
5016
|
-
log.warn(
|
|
5017
|
-
`[semantic-consolidation] cluster processing failed: ${err instanceof Error ? err.message : String(err)}`
|
|
5018
|
-
);
|
|
5019
|
-
result.errors++;
|
|
5020
|
-
} finally {
|
|
5021
|
-
if (canonicalWriteCompleted) {
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
if (result.memoriesArchived > 0) {
|
|
5026
|
-
await this.saveContentHashIndexes().catch(
|
|
5027
|
-
(err) => log.warn(
|
|
5028
|
-
`[semantic-consolidation] content-hash index save failed: ${err}`
|
|
5029
|
-
)
|
|
5030
|
-
);
|
|
5031
|
-
}
|
|
5032
|
-
log.info(
|
|
5033
|
-
`[semantic-consolidation] complete: clusters=${result.clustersFound}, consolidated=${result.memoriesConsolidated}, archived=${result.memoriesArchived}, errors=${result.errors}`
|
|
5034
|
-
);
|
|
5035
|
-
try {
|
|
5036
|
-
await materializeAfterSemanticConsolidation({
|
|
5037
|
-
config: this.config,
|
|
5038
|
-
memoryDir: targetStorage.dir
|
|
5039
|
-
});
|
|
5040
|
-
} catch (err) {
|
|
5041
|
-
log.warn(
|
|
5042
|
-
`[semantic-consolidation] Codex materialize post-hook failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
5043
|
-
);
|
|
5044
|
-
}
|
|
5045
|
-
if (this.config.peerProfileReasonerEnabled) {
|
|
5046
|
-
try {
|
|
5047
|
-
const { runPeerProfileReasoner } = await import("./peers/index.js");
|
|
5048
|
-
const llm2 = new FallbackLlmClient2(
|
|
5049
|
-
this.config.gatewayConfig,
|
|
5050
|
-
fallbackLlmRuntimeContextFromConfig(this.config)
|
|
5051
|
-
);
|
|
5052
|
-
const peerResult = await runPeerProfileReasoner({
|
|
5053
|
-
memoryDir: targetStorage.dir,
|
|
5054
|
-
enabled: true,
|
|
5055
|
-
llm: llm2,
|
|
5056
|
-
model: this.config.peerProfileReasonerModel,
|
|
5057
|
-
minInteractions: this.config.peerProfileReasonerMinInteractions,
|
|
5058
|
-
maxFieldsPerRun: this.config.peerProfileReasonerMaxFieldsPerRun,
|
|
5059
|
-
log: {
|
|
5060
|
-
debug: (msg) => log.debug(msg),
|
|
5061
|
-
info: (msg) => log.info(msg),
|
|
5062
|
-
warn: (msg) => log.warn(msg)
|
|
5063
|
-
}
|
|
5064
|
-
});
|
|
5065
|
-
log.info(
|
|
5066
|
-
`[peer-profile-reasoner] complete: peers=${peerResult.peersConsidered}, processed=${peerResult.peersProcessed}, fields=${peerResult.fieldsApplied}`
|
|
5067
|
-
);
|
|
5068
|
-
} catch (err) {
|
|
5069
|
-
log.warn(
|
|
5070
|
-
`[peer-profile-reasoner] post-consolidation hook failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
5071
|
-
);
|
|
5072
|
-
}
|
|
5073
|
-
}
|
|
5074
|
-
return result;
|
|
5106
|
+
return this.semanticConsolidationCoordinator.runSemanticConsolidation(options);
|
|
5075
5107
|
}
|
|
5076
5108
|
async waitForExtractionIdle(timeoutMs = 6e4) {
|
|
5077
5109
|
return this.extractionQueueCoordinator.waitForIdle(timeoutMs);
|
|
@@ -5872,7 +5904,7 @@ ${r.snippet.trim()}
|
|
|
5872
5904
|
options.abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
5873
5905
|
}
|
|
5874
5906
|
const principal = typeof options.principalOverride === "string" && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(sessionKey, this.config);
|
|
5875
|
-
const namespacesEnabled = this.config.
|
|
5907
|
+
const namespacesEnabled = resolveNamespaceCapabilities(this.config).namespaces;
|
|
5876
5908
|
if (namespacesEnabled && !principal) {
|
|
5877
5909
|
throw new Error("authentication required: namespaces are enabled and no principal was supplied");
|
|
5878
5910
|
}
|
|
@@ -6213,7 +6245,7 @@ ${r.snippet.trim()}
|
|
|
6213
6245
|
const scoped = /* @__PURE__ */ new Set();
|
|
6214
6246
|
for (const memoryPath of paths) {
|
|
6215
6247
|
if (!memoryPath || isArtifactMemoryPath(memoryPath)) continue;
|
|
6216
|
-
if (this.config.
|
|
6248
|
+
if (resolveNamespaceCapabilities(this.config).namespaces && !recallNamespaces.includes(this.namespaceFromPath(memoryPath))) {
|
|
6217
6249
|
continue;
|
|
6218
6250
|
}
|
|
6219
6251
|
scoped.add(memoryPath);
|
|
@@ -6296,7 +6328,7 @@ ${r.snippet.trim()}
|
|
|
6296
6328
|
const tokens = Array.from(new Set(tokenizeRecallQuery(query)));
|
|
6297
6329
|
const memories = (await Promise.all(
|
|
6298
6330
|
Array.from(candidatePaths).map(async (memoryPath) => {
|
|
6299
|
-
const namespace = this.config.
|
|
6331
|
+
const namespace = resolveNamespaceCapabilities(this.config).namespaces ? this.namespaceFromPath(memoryPath) : this.config.defaultNamespace;
|
|
6300
6332
|
const storage = await this.storageRouter.storageFor(namespace);
|
|
6301
6333
|
return await storage.readMemoryByPath(memoryPath);
|
|
6302
6334
|
})
|
|
@@ -6768,7 +6800,7 @@ ${r.snippet.trim()}
|
|
|
6768
6800
|
}
|
|
6769
6801
|
}
|
|
6770
6802
|
async resolveStateDirForNamespace(namespace) {
|
|
6771
|
-
if (!this.config.
|
|
6803
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) {
|
|
6772
6804
|
return path3.join(this.config.memoryDir, "state");
|
|
6773
6805
|
}
|
|
6774
6806
|
if (namespace !== this.config.defaultNamespace) {
|
|
@@ -6984,7 +7016,7 @@ ${r.snippet.trim()}
|
|
|
6984
7016
|
}
|
|
6985
7017
|
const timings = {};
|
|
6986
7018
|
const profileTraceId = this.profiler.startTrace("recall", sessionKey, {
|
|
6987
|
-
qmdEnabled: this.config.
|
|
7019
|
+
qmdEnabled: resolveQmdCapabilities(this.config).qmd,
|
|
6988
7020
|
rerankEnabled: caps.rerank,
|
|
6989
7021
|
parallelRetrieval: caps.parallelRetrieval
|
|
6990
7022
|
});
|
|
@@ -7141,7 +7173,7 @@ ${r.snippet.trim()}
|
|
|
7141
7173
|
);
|
|
7142
7174
|
const embeddingFetchLimit = computedFetchLimit;
|
|
7143
7175
|
const principal = typeof options.principalOverride === "string" && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(sessionKey, this.config);
|
|
7144
|
-
const namespacesEnabled = this.config.
|
|
7176
|
+
const namespacesEnabled = resolveNamespaceCapabilities(this.config).namespaces;
|
|
7145
7177
|
if (namespacesEnabled && !principal) {
|
|
7146
7178
|
throw new Error("authentication required: namespaces are enabled and no principal was supplied");
|
|
7147
7179
|
}
|
|
@@ -7317,7 +7349,7 @@ ${r.snippet.trim()}
|
|
|
7317
7349
|
retrievalQueryLength: retrievalQuery.length,
|
|
7318
7350
|
recallMode,
|
|
7319
7351
|
recallResultLimit,
|
|
7320
|
-
qmdEnabled: this.config.
|
|
7352
|
+
qmdEnabled: resolveQmdCapabilities(this.config).qmd,
|
|
7321
7353
|
qmdAvailable: this.qmd.isAvailable(),
|
|
7322
7354
|
recallNamespaces: [],
|
|
7323
7355
|
source: recallSource,
|
|
@@ -7622,7 +7654,7 @@ ${lines.join("\n\n")}`;
|
|
|
7622
7654
|
const identityContinuityPromise = (async () => {
|
|
7623
7655
|
if (!this.isRecallSectionEnabled(
|
|
7624
7656
|
"identity-continuity",
|
|
7625
|
-
this.config.
|
|
7657
|
+
resolveIdentityContinuityCapabilities(this.config).identityContinuity === true
|
|
7626
7658
|
))
|
|
7627
7659
|
return null;
|
|
7628
7660
|
const t0 = Date.now();
|
|
@@ -7850,13 +7882,13 @@ ${rows.join("\n")}
|
|
|
7850
7882
|
}
|
|
7851
7883
|
const objectiveStateSearches = await Promise.all(
|
|
7852
7884
|
recallNamespaces.map(async (namespace) => {
|
|
7853
|
-
const storage = this.config.
|
|
7885
|
+
const storage = resolveNamespaceCapabilities(this.config).namespaces ? await this.getStorage(namespace) : null;
|
|
7854
7886
|
return searchObjectiveStateSnapshots({
|
|
7855
|
-
memoryDir: this.config.
|
|
7887
|
+
memoryDir: resolveNamespaceCapabilities(this.config).namespaces ? storage.dir : this.config.memoryDir,
|
|
7856
7888
|
objectiveStateStoreDir: objectiveStateStoreOverrideForNamespace({
|
|
7857
7889
|
memoryDir: this.config.memoryDir,
|
|
7858
7890
|
configuredStoreDir: this.config.objectiveStateStoreDir,
|
|
7859
|
-
namespacesEnabled: this.config.
|
|
7891
|
+
namespacesEnabled: resolveNamespaceCapabilities(this.config).namespaces,
|
|
7860
7892
|
namespace
|
|
7861
7893
|
}),
|
|
7862
7894
|
query: retrievalQuery,
|
|
@@ -8612,7 +8644,7 @@ ${rows.join("\n")}
|
|
|
8612
8644
|
qmdFetchLimit,
|
|
8613
8645
|
qmdHybridFetchLimit,
|
|
8614
8646
|
{
|
|
8615
|
-
namespacesEnabled: this.config.
|
|
8647
|
+
namespacesEnabled: resolveNamespaceCapabilities(this.config).namespaces,
|
|
8616
8648
|
recallNamespaces,
|
|
8617
8649
|
resolveNamespace: (p) => this.namespaceFromPath(p),
|
|
8618
8650
|
queryAwarePrefilter,
|
|
@@ -8945,7 +8977,7 @@ ${formatted}`;
|
|
|
8945
8977
|
workspaceDir: this.config.workspaceDir,
|
|
8946
8978
|
memoryDir: this.config.memoryDir,
|
|
8947
8979
|
config: this.config.nativeKnowledge,
|
|
8948
|
-
recallNamespaces: this.config.
|
|
8980
|
+
recallNamespaces: resolveNamespaceCapabilities(this.config).namespaces ? recallNamespaces : void 0,
|
|
8949
8981
|
defaultNamespace: this.config.defaultNamespace,
|
|
8950
8982
|
abortSignal: nativeKnowledgeAbort.signal
|
|
8951
8983
|
}).catch(() => []);
|
|
@@ -9700,7 +9732,7 @@ ${tmtNode.summary}`
|
|
|
9700
9732
|
[]
|
|
9701
9733
|
);
|
|
9702
9734
|
let memoryResults = memoryResultsRaw;
|
|
9703
|
-
if (this.config.
|
|
9735
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
9704
9736
|
memoryResults = memoryResults.filter(
|
|
9705
9737
|
(r) => recallNamespaces.includes(this.namespaceFromPath(r.path))
|
|
9706
9738
|
);
|
|
@@ -9983,7 +10015,7 @@ ${tmtNode.summary}`
|
|
|
9983
10015
|
const scopedCandidates = filterRecallCandidates(
|
|
9984
10016
|
prefilteredEmbeddingResults,
|
|
9985
10017
|
{
|
|
9986
|
-
namespacesEnabled: this.config.
|
|
10018
|
+
namespacesEnabled: resolveNamespaceCapabilities(this.config).namespaces,
|
|
9987
10019
|
recallNamespaces,
|
|
9988
10020
|
resolveNamespace: (p) => this.namespaceFromPath(p),
|
|
9989
10021
|
limit: embeddingFetchLimit
|
|
@@ -10144,7 +10176,7 @@ ${tmtNode.summary}`
|
|
|
10144
10176
|
const scopedCandidates = filterRecallCandidates(
|
|
10145
10177
|
prefilteredEmbeddingResults,
|
|
10146
10178
|
{
|
|
10147
|
-
namespacesEnabled: this.config.
|
|
10179
|
+
namespacesEnabled: resolveNamespaceCapabilities(this.config).namespaces,
|
|
10148
10180
|
recallNamespaces,
|
|
10149
10181
|
resolveNamespace: (p) => this.namespaceFromPath(p),
|
|
10150
10182
|
limit: embeddingFetchLimit
|
|
@@ -10809,7 +10841,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10809
10841
|
retrievalQueryLength: retrievalQuery.length,
|
|
10810
10842
|
recallMode,
|
|
10811
10843
|
recallResultLimit,
|
|
10812
|
-
qmdEnabled: this.config.
|
|
10844
|
+
qmdEnabled: resolveQmdCapabilities(this.config).qmd,
|
|
10813
10845
|
qmdAvailable: this.qmd.isAvailable(),
|
|
10814
10846
|
recallNamespaces,
|
|
10815
10847
|
source: recallSource,
|
|
@@ -11982,7 +12014,7 @@ ${normalized}`).digest("hex");
|
|
|
11982
12014
|
const profileAllowsSharedWrites = !scopeProfileWritePlan || Boolean(
|
|
11983
12015
|
scopeProfileWritePlan.profile.readOrder.includes("serverShared") && scopeProfileWritePlan.readNamespaces.includes(this.config.sharedNamespace) && sharedProfileLayer?.readable && sharedProfileLayer.writable && sharedPromotionTarget?.authorized
|
|
11984
12016
|
);
|
|
11985
|
-
const namespacesEnabled = this.config.
|
|
12017
|
+
const namespacesEnabled = resolveNamespaceCapabilities(this.config).namespaces;
|
|
11986
12018
|
const profileAutoPromotionAllows = (category, confidence) => {
|
|
11987
12019
|
if (!scopeProfileWritePlan) return false;
|
|
11988
12020
|
const actualTier = confidenceTier(confidence);
|
|
@@ -12010,7 +12042,7 @@ ${normalized}`).digest("hex");
|
|
|
12010
12042
|
return scopeProfileWritePlan.profile.autoPromote.targets.includes("serverShared") && profileAutoPromotionAllows(category, confidence);
|
|
12011
12043
|
};
|
|
12012
12044
|
const shouldPromoteToShared = (targetStorage, category, confidence) => {
|
|
12013
|
-
if (!this.config.
|
|
12045
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces || !profileAllowsSharedWrites || !sharedAutoPromotionAllows(category, confidence))
|
|
12014
12046
|
return false;
|
|
12015
12047
|
if (this.storageDirNamespace(targetStorage.dir) === this.config.sharedNamespace)
|
|
12016
12048
|
return false;
|
|
@@ -13485,7 +13517,7 @@ ${normalized}`).digest("hex");
|
|
|
13485
13517
|
const needsFullRebuild = !indexesExist(this.config.memoryDir);
|
|
13486
13518
|
if (!needsFullRebuild && persistedIds.length === 0) return;
|
|
13487
13519
|
try {
|
|
13488
|
-
const allMemories = needsFullRebuild && this.config.
|
|
13520
|
+
const allMemories = needsFullRebuild && resolveNamespaceCapabilities(this.config).namespaces ? await this.readAllMemoriesForNamespaces(
|
|
13489
13521
|
Array.from(
|
|
13490
13522
|
/* @__PURE__ */ new Set([
|
|
13491
13523
|
this.config.defaultNamespace,
|
|
@@ -14214,10 +14246,10 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
|
|
|
14214
14246
|
/** Threshold (bytes) at which IDENTITY.md reflections get auto-consolidated */
|
|
14215
14247
|
static IDENTITY_CONSOLIDATE_THRESHOLD = 8e3;
|
|
14216
14248
|
async autoConsolidateIdentity() {
|
|
14217
|
-
const namespaces = this.config.
|
|
14249
|
+
const namespaces = resolveNamespaceCapabilities(this.config).namespaces ? await this.maintenanceNamespaces() : [this.config.defaultNamespace];
|
|
14218
14250
|
for (const namespace of namespaces) {
|
|
14219
14251
|
const storage = await this.storageRouter.storageFor(namespace);
|
|
14220
|
-
const identityNamespace = this.config.
|
|
14252
|
+
const identityNamespace = resolveNamespaceCapabilities(this.config).namespaces && namespace !== this.config.defaultNamespace ? namespace : void 0;
|
|
14221
14253
|
const reflectionsContent = await storage.readIdentityReflections() ?? "";
|
|
14222
14254
|
const existingIdentity = await storage.readIdentity(
|
|
14223
14255
|
this.config.workspaceDir,
|
|
@@ -14486,7 +14518,7 @@ ${lines.join("\n\n")}`;
|
|
|
14486
14518
|
return { text: `${content.slice(0, headroom)}${suffix}`, truncated: true };
|
|
14487
14519
|
}
|
|
14488
14520
|
async buildIdentityContinuitySection(options) {
|
|
14489
|
-
if (!this.config.
|
|
14521
|
+
if (!resolveIdentityContinuityCapabilities(this.config).identityContinuity) return null;
|
|
14490
14522
|
if (this.config.identityMaxInjectChars <= 0) return null;
|
|
14491
14523
|
const resolved = resolveEffectiveIdentityInjectionMode({
|
|
14492
14524
|
configuredMode: this.config.identityInjectionMode,
|
|
@@ -14625,7 +14657,7 @@ ${lines.join("\n\n")}`;
|
|
|
14625
14657
|
storages.push(storage);
|
|
14626
14658
|
};
|
|
14627
14659
|
const fallbackNamespace = fallbackStorageDir !== null ? this.storageDirNamespace(fallbackStorageDir) : this.config.defaultNamespace;
|
|
14628
|
-
if (recallNamespaces.length === 0 || !this.config.
|
|
14660
|
+
if (recallNamespaces.length === 0 || !resolveNamespaceCapabilities(this.config).namespaces || recallNamespaces.includes(fallbackNamespace)) {
|
|
14629
14661
|
addStorage(fallbackStorage);
|
|
14630
14662
|
}
|
|
14631
14663
|
if (recallNamespaces.length > 0) {
|
|
@@ -14736,7 +14768,7 @@ ${lines.join("\n\n")}`;
|
|
|
14736
14768
|
recallNamespaces
|
|
14737
14769
|
);
|
|
14738
14770
|
ownerNamespace = ownerStorage?.namespace ?? null;
|
|
14739
|
-
if (!ownerNamespace && this.config.
|
|
14771
|
+
if (!ownerNamespace && resolveNamespaceCapabilities(this.config).namespaces) return null;
|
|
14740
14772
|
}
|
|
14741
14773
|
ownerNamespace ??= this.namespaceFromPath(memory.path);
|
|
14742
14774
|
if (recallNamespaces.length > 0 && !recallNamespaces.includes(ownerNamespace)) {
|
|
@@ -15088,7 +15120,7 @@ ${lines.join("\n\n")}`;
|
|
|
15088
15120
|
* so facts from non-default namespaces can't cross-match.
|
|
15089
15121
|
*/
|
|
15090
15122
|
semanticDedupScopeFor(targetStorage) {
|
|
15091
|
-
if (!this.config.
|
|
15123
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) return {};
|
|
15092
15124
|
const memoryDir = path3.resolve(this.config.memoryDir);
|
|
15093
15125
|
const storageDir = path3.resolve(targetStorage.dir);
|
|
15094
15126
|
if (storageDir === memoryDir) {
|
|
@@ -15221,7 +15253,7 @@ ${lines.join("\n\n")}`;
|
|
|
15221
15253
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
15222
15254
|
}
|
|
15223
15255
|
};
|
|
15224
|
-
const coldQmdEnabled = this.config.
|
|
15256
|
+
const coldQmdEnabled = resolveQmdCapabilities(this.config).qmdColdTier === true;
|
|
15225
15257
|
const coldCollection = this.config.qmdColdCollection ?? "openclaw-engram-cold";
|
|
15226
15258
|
const coldMaxResults = this.config.qmdColdMaxResults ?? this.config.qmdMaxResults;
|
|
15227
15259
|
let longTerm = [];
|
|
@@ -15256,7 +15288,7 @@ ${lines.join("\n\n")}`;
|
|
|
15256
15288
|
coldFetchLimit,
|
|
15257
15289
|
coldHybridLimit,
|
|
15258
15290
|
{
|
|
15259
|
-
namespacesEnabled: this.config.
|
|
15291
|
+
namespacesEnabled: resolveNamespaceCapabilities(this.config).namespaces,
|
|
15260
15292
|
recallNamespaces: options.recallNamespaces,
|
|
15261
15293
|
resolveNamespace: (p) => this.namespaceFromPath(p),
|
|
15262
15294
|
collection: coldCollection,
|
|
@@ -15302,7 +15334,7 @@ ${lines.join("\n\n")}`;
|
|
|
15302
15334
|
}
|
|
15303
15335
|
if (longTerm.length === 0) return [];
|
|
15304
15336
|
let results = longTerm;
|
|
15305
|
-
if (this.config.
|
|
15337
|
+
if (resolveNamespaceCapabilities(this.config).namespaces) {
|
|
15306
15338
|
const recallRoots = [];
|
|
15307
15339
|
const seenRecallRoots = /* @__PURE__ */ new Set();
|
|
15308
15340
|
for (const namespace of options.recallNamespaces) {
|
|
@@ -15351,8 +15383,8 @@ ${lines.join("\n\n")}`;
|
|
|
15351
15383
|
}
|
|
15352
15384
|
results = results.filter((r) => !isArtifactMemoryPath(r.path));
|
|
15353
15385
|
if (results.length === 0) return [];
|
|
15354
|
-
const isFullModeGraphAssist = this.config.
|
|
15355
|
-
const shouldRunGraphExpansion = this.config.
|
|
15386
|
+
const isFullModeGraphAssist = resolveQmdCapabilities(this.config).qmdTierParityGraph && graphCaps.multiGraphMemory && caps.graphAssistInFullMode && options.recallMode === "full" && results.length >= Math.max(1, this.config.graphAssistMinSeedResults ?? 3);
|
|
15387
|
+
const shouldRunGraphExpansion = resolveQmdCapabilities(this.config).qmdTierParityGraph && (options.recallMode === "graph_mode" || isFullModeGraphAssist);
|
|
15356
15388
|
if (shouldRunGraphExpansion) {
|
|
15357
15389
|
const { merged } = await this.expandResultsViaGraph({
|
|
15358
15390
|
memoryResults: results,
|
|
@@ -15513,7 +15545,7 @@ ${lines.join("\n\n")}`;
|
|
|
15513
15545
|
async flushAccessTracking() {
|
|
15514
15546
|
if (this.accessTrackingBuffer.size === 0) return;
|
|
15515
15547
|
const entries = [];
|
|
15516
|
-
const namespaces = this.config.
|
|
15548
|
+
const namespaces = resolveNamespaceCapabilities(this.config).namespaces ? Array.from(
|
|
15517
15549
|
/* @__PURE__ */ new Set([
|
|
15518
15550
|
this.config.defaultNamespace,
|
|
15519
15551
|
this.config.sharedNamespace,
|
|
@@ -16169,7 +16201,7 @@ ${lines.join("\n\n")}`;
|
|
|
16169
16201
|
return resolved;
|
|
16170
16202
|
}
|
|
16171
16203
|
namespaceFromPath(p) {
|
|
16172
|
-
if (!this.config.
|
|
16204
|
+
if (!resolveNamespaceCapabilities(this.config).namespaces) return this.config.defaultNamespace;
|
|
16173
16205
|
const parts = qmdCollectionPathParts(p);
|
|
16174
16206
|
const collectionNamespace = parts ? this.qmdCollectionNamespaceFromPrefix(parts.collection) : null;
|
|
16175
16207
|
if (collectionNamespace) return collectionNamespace;
|
|
@@ -16270,4 +16302,4 @@ export {
|
|
|
16270
16302
|
resolvePersistedMemoryRelativePath,
|
|
16271
16303
|
Orchestrator
|
|
16272
16304
|
};
|
|
16273
|
-
//# sourceMappingURL=chunk-
|
|
16305
|
+
//# sourceMappingURL=chunk-Z7J3OAPR.js.map
|