@remnic/core 9.3.736 → 9.3.738
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 +17 -6
- package/dist/access-boundary.js +10 -10
- package/dist/access-cli.js +26 -26
- package/dist/access-http.d.ts +17 -6
- package/dist/access-http.js +15 -15
- package/dist/access-mcp.d.ts +17 -6
- package/dist/access-mcp.js +14 -14
- package/dist/access-operations-batch.js +12 -12
- package/dist/access-operations.d.ts +17 -6
- package/dist/access-operations.js +13 -13
- package/dist/{access-service-CdC0q4pr.d.ts → access-service-DwQ6BIQw.d.ts} +3 -3
- package/dist/access-service.d.ts +16 -5
- package/dist/access-service.js +9 -9
- package/dist/access-surface-catalog.d.ts +17 -6
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +3 -3
- 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 +16 -4
- 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/buffer.js +2 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +99 -2
- package/dist/capabilities.js +7 -1
- package/dist/{catalog-D2NLDg4S.d.ts → catalog-_Bap6vfD.d.ts} +1 -1
- 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-G54IDCD3.js → chunk-23PLOBWT.js} +30 -27
- package/dist/chunk-23PLOBWT.js.map +1 -0
- package/dist/{chunk-K3Y2SJTN.js → chunk-56LP72AD.js} +6 -6
- package/dist/{chunk-ZBZ4XULO.js → chunk-66RZ4EIT.js} +3 -3
- package/dist/{chunk-IPI45Q4S.js → chunk-75PDC7VT.js} +9 -8
- package/dist/chunk-75PDC7VT.js.map +1 -0
- package/dist/{chunk-GB2FZOWB.js → chunk-7B7IPPN5.js} +5 -5
- package/dist/{chunk-QNTLWH3T.js → chunk-A7INTIC5.js} +3 -3
- package/dist/{chunk-FLPKEMSO.js → chunk-AKKFHN3I.js} +2 -2
- package/dist/{chunk-AAIHDIMD.js → chunk-BHJAMSVC.js} +7 -7
- package/dist/{chunk-BXPG5AVX.js → chunk-BHQQVUEQ.js} +6 -6
- package/dist/{chunk-HFXZIF3V.js → chunk-BVG2IZOB.js} +3 -3
- package/dist/{chunk-NDKW67ER.js → chunk-C53JDEH3.js} +4 -4
- package/dist/{chunk-AESC5OQJ.js → chunk-CKHPUOAP.js} +2 -2
- package/dist/{chunk-OYHYBHHI.js → chunk-DS3FZ7GS.js} +4 -4
- package/dist/{chunk-AE2HPUP7.js → chunk-EKQ3LWBM.js} +428 -370
- package/dist/chunk-EKQ3LWBM.js.map +1 -0
- package/dist/{chunk-UO6MPN77.js → chunk-EU543UDC.js} +10 -9
- package/dist/chunk-EU543UDC.js.map +1 -0
- package/dist/{chunk-E4LYJ7PY.js → chunk-IFCM6OLK.js} +6 -6
- package/dist/{chunk-5BOQNB2K.js → chunk-JQSP7YBJ.js} +3 -3
- package/dist/{chunk-2T2N7ISV.js → chunk-L3TYGUTH.js} +3 -3
- package/dist/{chunk-AB2E5DCN.js → chunk-MAU7DFCJ.js} +2 -2
- package/dist/{chunk-P6VLG7KE.js → chunk-N2O23WYA.js} +2 -2
- package/dist/{chunk-HYNHLBKA.js → chunk-OQQRWPFZ.js} +5 -2
- package/dist/chunk-OQQRWPFZ.js.map +1 -0
- package/dist/{chunk-IXGXALRV.js → chunk-QTJOORGN.js} +2 -2
- package/dist/{chunk-JWDE7OVJ.js → chunk-RJBW4EOU.js} +46 -2
- package/dist/{chunk-JWDE7OVJ.js.map → chunk-RJBW4EOU.js.map} +1 -1
- package/dist/{chunk-AE7NTZ75.js → chunk-TNLXCSXV.js} +3 -3
- package/dist/{chunk-NNJKEAP2.js → chunk-VRBBZH4U.js} +4 -4
- package/dist/{chunk-VOEVVIP3.js → chunk-W2FBVBQ4.js} +4 -4
- package/dist/{chunk-WNGXQMRI.js → chunk-WFNH4UDF.js} +5 -2
- package/dist/chunk-WFNH4UDF.js.map +1 -0
- package/dist/{chunk-CHJIWG2H.js → chunk-WVAEIKUY.js} +2 -2
- package/dist/{chunk-FF36YNKY.js → chunk-XIQAOGAA.js} +11 -10
- package/dist/chunk-XIQAOGAA.js.map +1 -0
- package/dist/{chunk-HLPYL6LC.js → chunk-Y5OOHER4.js} +14 -12
- package/dist/chunk-Y5OOHER4.js.map +1 -0
- package/dist/{chunk-GYICIICQ.js → chunk-YF2MMBKA.js} +9 -7
- package/dist/chunk-YF2MMBKA.js.map +1 -0
- package/dist/{chunk-IX4L7E5G.js → chunk-YXOXAQ5Y.js} +2 -2
- package/dist/{cli-BHy6Bo6u.d.ts → cli-BlEIWDQw.d.ts} +3 -3
- package/dist/cli.d.ts +9 -7
- package/dist/cli.js +21 -21
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +2 -2
- 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 +1 -1
- package/dist/contradiction/index.js +2 -2
- package/dist/{contradiction-scan-2B4AE4TI.js → contradiction-scan-CWO3LIWV.js} +3 -3
- 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 -2
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +16 -4
- package/dist/explicit-capture.js +2 -2
- 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-2RQYDIZ7.js → first-start-migration-5DXD3TF2.js} +2 -2
- 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 +20 -18
- package/dist/index.js +32 -32
- 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 -2
- 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 +17 -6
- 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 -2
- 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 -2
- 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/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +6 -6
- package/dist/{orchestrator-C-xp_rtZ.d.ts → orchestrator-CJZ21ZiB.d.ts} +78 -12
- package/dist/orchestrator.d.ts +16 -4
- package/dist/orchestrator.js +21 -21
- 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-consolidation-COdwU-me.d.ts → semantic-consolidation-DsIEiCka.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 -3
- 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-KPDIISG7.js → tier-stats-QID73BBB.js} +2 -2
- 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 +2 -2
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-w3Y232yi.d.ts → types-CglNn2V-.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 +7 -8
- package/src/buffer.ts +2 -1
- package/src/capabilities.test.ts +137 -0
- package/src/capabilities.ts +209 -0
- package/src/cli/creation-ledger-commands.ts +3 -3
- package/src/cli/research-status-commands.ts +4 -4
- package/src/cli.ts +9 -10
- package/src/compounding/engine.ts +7 -7
- package/src/correction/correction-access-wiring.ts +3 -2
- package/src/extraction.ts +8 -10
- package/src/operator-toolkit.ts +6 -7
- package/src/orchestration/entity-synthesis-coordinator.ts +2 -1
- package/src/orchestration/maintenance.ts +5 -7
- package/src/orchestration/recall-result-formatter.ts +438 -0
- package/src/orchestration/semantic-consolidation-coordinator.ts +2 -2
- package/src/orchestrator.ts +71 -355
- package/dist/chunk-AE2HPUP7.js.map +0 -1
- package/dist/chunk-FF36YNKY.js.map +0 -1
- package/dist/chunk-G54IDCD3.js.map +0 -1
- package/dist/chunk-GYICIICQ.js.map +0 -1
- package/dist/chunk-HLPYL6LC.js.map +0 -1
- package/dist/chunk-HYNHLBKA.js.map +0 -1
- package/dist/chunk-IPI45Q4S.js.map +0 -1
- package/dist/chunk-UO6MPN77.js.map +0 -1
- package/dist/chunk-WNGXQMRI.js.map +0 -1
- /package/dist/{chunk-K3Y2SJTN.js.map → chunk-56LP72AD.js.map} +0 -0
- /package/dist/{chunk-ZBZ4XULO.js.map → chunk-66RZ4EIT.js.map} +0 -0
- /package/dist/{chunk-GB2FZOWB.js.map → chunk-7B7IPPN5.js.map} +0 -0
- /package/dist/{chunk-QNTLWH3T.js.map → chunk-A7INTIC5.js.map} +0 -0
- /package/dist/{chunk-FLPKEMSO.js.map → chunk-AKKFHN3I.js.map} +0 -0
- /package/dist/{chunk-AAIHDIMD.js.map → chunk-BHJAMSVC.js.map} +0 -0
- /package/dist/{chunk-BXPG5AVX.js.map → chunk-BHQQVUEQ.js.map} +0 -0
- /package/dist/{chunk-HFXZIF3V.js.map → chunk-BVG2IZOB.js.map} +0 -0
- /package/dist/{chunk-NDKW67ER.js.map → chunk-C53JDEH3.js.map} +0 -0
- /package/dist/{chunk-AESC5OQJ.js.map → chunk-CKHPUOAP.js.map} +0 -0
- /package/dist/{chunk-OYHYBHHI.js.map → chunk-DS3FZ7GS.js.map} +0 -0
- /package/dist/{chunk-E4LYJ7PY.js.map → chunk-IFCM6OLK.js.map} +0 -0
- /package/dist/{chunk-5BOQNB2K.js.map → chunk-JQSP7YBJ.js.map} +0 -0
- /package/dist/{chunk-2T2N7ISV.js.map → chunk-L3TYGUTH.js.map} +0 -0
- /package/dist/{chunk-AB2E5DCN.js.map → chunk-MAU7DFCJ.js.map} +0 -0
- /package/dist/{chunk-P6VLG7KE.js.map → chunk-N2O23WYA.js.map} +0 -0
- /package/dist/{chunk-IXGXALRV.js.map → chunk-QTJOORGN.js.map} +0 -0
- /package/dist/{chunk-AE7NTZ75.js.map → chunk-TNLXCSXV.js.map} +0 -0
- /package/dist/{chunk-NNJKEAP2.js.map → chunk-VRBBZH4U.js.map} +0 -0
- /package/dist/{chunk-VOEVVIP3.js.map → chunk-W2FBVBQ4.js.map} +0 -0
- /package/dist/{chunk-CHJIWG2H.js.map → chunk-WVAEIKUY.js.map} +0 -0
- /package/dist/{chunk-IX4L7E5G.js.map → chunk-YXOXAQ5Y.js.map} +0 -0
- /package/dist/{contradiction-scan-2B4AE4TI.js.map → contradiction-scan-CWO3LIWV.js.map} +0 -0
- /package/dist/{first-start-migration-2RQYDIZ7.js.map → first-start-migration-5DXD3TF2.js.map} +0 -0
- /package/dist/{tier-stats-KPDIISG7.js.map → tier-stats-QID73BBB.js.map} +0 -0
package/src/orchestrator.ts
CHANGED
|
@@ -101,6 +101,8 @@ import { CompressionGuidelineCoordinator } from "./orchestration/compression-gui
|
|
|
101
101
|
import { SemanticConsolidationCoordinator } from "./orchestration/semantic-consolidation-coordinator.js";
|
|
102
102
|
import { LifecyclePolicyCoordinator } from "./orchestration/lifecycle-policy-coordinator.js";
|
|
103
103
|
import { EntitySynthesisCoordinator } from "./orchestration/entity-synthesis-coordinator.js";
|
|
104
|
+
import { RecallResultFormatter } from "./orchestration/recall-result-formatter.js";
|
|
105
|
+
export { hasIdentityRecoveryIntent, resolveEffectiveIdentityInjectionMode } from "./orchestration/recall-result-formatter.js";
|
|
104
106
|
import {
|
|
105
107
|
runLiveConnectorsOnce,
|
|
106
108
|
type LiveConnectorsRunSummary,
|
|
@@ -265,8 +267,7 @@ import {
|
|
|
265
267
|
type TrustZoneSearchResult,
|
|
266
268
|
} from "./trust-zones.js";
|
|
267
269
|
import { tryDirectAnswer, type DirectAnswerSources } from "./direct-answer-wiring.js";
|
|
268
|
-
import {
|
|
269
|
-
resolveNamespaceCapabilities,
|
|
270
|
+
import { resolveNamespaceCapabilities,
|
|
270
271
|
resolveCapabilities,
|
|
271
272
|
resolveGraphConstructionCapabilities,
|
|
272
273
|
resolveMemoryLifecycleCapabilities,
|
|
@@ -280,7 +281,7 @@ import {
|
|
|
280
281
|
resolveQmdCapabilities,
|
|
281
282
|
resolveIdentityContinuityCapabilities,
|
|
282
283
|
resolveLocalLlmCapabilities,
|
|
283
|
-
resolveSecurityCapabilities, resolveEvalCapabilities, resolveUtilityLearningCapabilities, resolveObjectiveStateCapabilities, resolveCompressionCapabilities} from "./capabilities.js";
|
|
284
|
+
resolveSecurityCapabilities, resolveEvalCapabilities, resolveUtilityLearningCapabilities, resolveObjectiveStateCapabilities, resolveCompressionCapabilities, resolvePresentationCapabilities, resolveConsolidationCapabilities, resolveRecallAuxiliaryCapabilities } from "./capabilities.js";
|
|
284
285
|
import { DEFAULT_TAXONOMY } from "./taxonomy/index.js";
|
|
285
286
|
import {
|
|
286
287
|
searchHarmonicRetrieval,
|
|
@@ -1368,31 +1369,6 @@ export async function resolveRecallModeDecisionAsync(
|
|
|
1368
1369
|
};
|
|
1369
1370
|
}
|
|
1370
1371
|
|
|
1371
|
-
export function hasIdentityRecoveryIntent(prompt: string): boolean {
|
|
1372
|
-
const text = typeof prompt === "string" ? prompt.toLowerCase() : "";
|
|
1373
|
-
if (!text) return false;
|
|
1374
|
-
return /\b(identity|continuity|recover(?:y|ing|ed)?|incident|drift|restore|regress(?:ion|ed|ing)?)\b/i.test(
|
|
1375
|
-
text,
|
|
1376
|
-
);
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
export function resolveEffectiveIdentityInjectionMode(options: {
|
|
1380
|
-
configuredMode: IdentityInjectionMode;
|
|
1381
|
-
recallMode: RecallPlanMode;
|
|
1382
|
-
prompt: string;
|
|
1383
|
-
}): { mode: IdentityInjectionMode; shouldInject: boolean } {
|
|
1384
|
-
if (
|
|
1385
|
-
options.configuredMode === "recovery_only" &&
|
|
1386
|
-
!hasIdentityRecoveryIntent(options.prompt)
|
|
1387
|
-
) {
|
|
1388
|
-
return { mode: "recovery_only", shouldInject: false };
|
|
1389
|
-
}
|
|
1390
|
-
if (options.recallMode === "minimal" && options.configuredMode === "full") {
|
|
1391
|
-
return { mode: "minimal", shouldInject: true };
|
|
1392
|
-
}
|
|
1393
|
-
return { mode: options.configuredMode, shouldInject: true };
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
1372
|
export function computeArtifactCandidateFetchLimit(
|
|
1397
1373
|
targetCount: number,
|
|
1398
1374
|
): number {
|
|
@@ -1928,6 +1904,11 @@ export class Orchestrator {
|
|
|
1928
1904
|
* hands it to `enqueue`.
|
|
1929
1905
|
*/
|
|
1930
1906
|
readonly extractionQueueCoordinator: ExtractionQueueCoordinator;
|
|
1907
|
+
/**
|
|
1908
|
+
* Issue #1526: recall result formatting + identity continuity section moved
|
|
1909
|
+
* to RecallResultFormatter.
|
|
1910
|
+
*/
|
|
1911
|
+
readonly recallResultFormatter: RecallResultFormatter;
|
|
1931
1912
|
private heartbeatObserverChains = new Map<string, Promise<void>>();
|
|
1932
1913
|
private recentExtractionFingerprints = new Map<string, number>();
|
|
1933
1914
|
private readonly consolidationObservers = new Set<
|
|
@@ -2583,7 +2564,7 @@ export class Orchestrator {
|
|
|
2583
2564
|
private async contentHashIndexForStorage(
|
|
2584
2565
|
targetStorage: StorageManager,
|
|
2585
2566
|
): Promise<ContentHashIndex | null> {
|
|
2586
|
-
if (!this.config.
|
|
2567
|
+
if (!resolveRecallAuxiliaryCapabilities(this.config).factDeduplication) return null;
|
|
2587
2568
|
|
|
2588
2569
|
if (targetStorage.dir === this.storage.dir) {
|
|
2589
2570
|
if (!this.contentHashIndex) {
|
|
@@ -2846,7 +2827,7 @@ export class Orchestrator {
|
|
|
2846
2827
|
if (config.defaultNamespace) this.storageRouter.bindCatalogWriteHook(this.storage, config.defaultNamespace);
|
|
2847
2828
|
// Wire page-level versioning (issue #371)
|
|
2848
2829
|
this.storage.setVersioningConfig({
|
|
2849
|
-
enabled: config.
|
|
2830
|
+
enabled: resolveRecallAuxiliaryCapabilities(config).versioning,
|
|
2850
2831
|
maxVersionsPerPage: config.versioningMaxPerPage,
|
|
2851
2832
|
sidecarDir: config.versioningSidecarDir,
|
|
2852
2833
|
});
|
|
@@ -2869,7 +2850,7 @@ export class Orchestrator {
|
|
|
2869
2850
|
// Wire at-rest encryption (issue #690 PR 3/4).
|
|
2870
2851
|
// If secureStoreEnabled, check whether the keyring already holds a key
|
|
2871
2852
|
// for this memory dir (e.g. operator unlocked before daemon restart).
|
|
2872
|
-
if (config.
|
|
2853
|
+
if (resolveRecallAuxiliaryCapabilities(config).secureStore) {
|
|
2873
2854
|
// Mark the store as required so writes throw SecureStoreLockedError
|
|
2874
2855
|
// instead of silently falling back to plaintext when locked (P1 finding
|
|
2875
2856
|
// from Cursor review of PR #767).
|
|
@@ -2896,6 +2877,7 @@ export class Orchestrator {
|
|
|
2896
2877
|
});
|
|
2897
2878
|
// Issue #1526: background extraction queue lives on its own coordinator.
|
|
2898
2879
|
this.extractionQueueCoordinator = new ExtractionQueueCoordinator();
|
|
2880
|
+
this.recallResultFormatter = new RecallResultFormatter(this.config);
|
|
2899
2881
|
const conversationIndexRuntime = createConversationIndexRuntime(config, {
|
|
2900
2882
|
getQmd: () => this.conversationQmd,
|
|
2901
2883
|
getFaiss: () => this.conversationFaiss,
|
|
@@ -2906,7 +2888,7 @@ export class Orchestrator {
|
|
|
2906
2888
|
this.sharedContext = config.sharedContextEnabled
|
|
2907
2889
|
? new SharedContextManager(config)
|
|
2908
2890
|
: undefined;
|
|
2909
|
-
this.compounding = config.
|
|
2891
|
+
this.compounding = resolveConsolidationCapabilities(config).compounding
|
|
2910
2892
|
? new CompoundingEngine(config, this.storage)
|
|
2911
2893
|
: undefined;
|
|
2912
2894
|
this.buffer = new SmartBuffer(config, this.storage);
|
|
@@ -3098,7 +3080,7 @@ export class Orchestrator {
|
|
|
3098
3080
|
this.boxBuilders.set(
|
|
3099
3081
|
dir,
|
|
3100
3082
|
new BoxBuilder(dir, {
|
|
3101
|
-
memoryBoxesEnabled: this.config.
|
|
3083
|
+
memoryBoxesEnabled: resolvePresentationCapabilities(this.config).memoryBoxes,
|
|
3102
3084
|
traceWeaverEnabled: this.config.traceWeaverEnabled,
|
|
3103
3085
|
boxTopicShiftThreshold: this.config.boxTopicShiftThreshold,
|
|
3104
3086
|
boxTimeGapMs: this.config.boxTimeGapMs,
|
|
@@ -3444,7 +3426,7 @@ export class Orchestrator {
|
|
|
3444
3426
|
});
|
|
3445
3427
|
|
|
3446
3428
|
// Initialize content-hash dedup index
|
|
3447
|
-
if (this.config.
|
|
3429
|
+
if (resolveRecallAuxiliaryCapabilities(this.config).factDeduplication) {
|
|
3448
3430
|
this.contentHashIndex = this.storage.createContentHashIndex();
|
|
3449
3431
|
await this.contentHashIndex.load();
|
|
3450
3432
|
log.info(
|
|
@@ -3470,7 +3452,7 @@ export class Orchestrator {
|
|
|
3470
3452
|
);
|
|
3471
3453
|
this.buffer.resetToEmpty();
|
|
3472
3454
|
}
|
|
3473
|
-
if (this.config.
|
|
3455
|
+
if (resolveRecallAuxiliaryCapabilities(this.config).compactionReset) {
|
|
3474
3456
|
try {
|
|
3475
3457
|
const wsDir = this.config.workspaceDir || defaultWorkspaceDir();
|
|
3476
3458
|
const files = await readdir(wsDir).catch(() => [] as string[]);
|
|
@@ -3694,7 +3676,7 @@ export class Orchestrator {
|
|
|
3694
3676
|
// Awaited so callers of `deferredReady` can rely on warmups being complete
|
|
3695
3677
|
// and shutdown sequencing does not race with in-flight cache builds.
|
|
3696
3678
|
const cacheWarmups: Promise<void>[] = [];
|
|
3697
|
-
if (this.config.
|
|
3679
|
+
if (resolveRecallAuxiliaryCapabilities(this.config).knowledgeIndex) {
|
|
3698
3680
|
cacheWarmups.push(
|
|
3699
3681
|
(async () => {
|
|
3700
3682
|
try {
|
|
@@ -4013,7 +3995,7 @@ export class Orchestrator {
|
|
|
4013
3995
|
const cadenceKey = options.namespace ?? "";
|
|
4014
3996
|
// Master switch: a disabled feature is never bypassed, even with
|
|
4015
3997
|
// force=true. `force` only relaxes the cadence floor below.
|
|
4016
|
-
if (!this.config.
|
|
3998
|
+
if (!resolveConsolidationCapabilities(this.config).patternReinforcement) {
|
|
4017
3999
|
return { ran: false, skippedReason: "disabled", namespace: cadenceKey };
|
|
4018
4000
|
}
|
|
4019
4001
|
const cadence = this.config.patternReinforcementCadenceMs;
|
|
@@ -4072,7 +4054,7 @@ export class Orchestrator {
|
|
|
4072
4054
|
? { itemCount: result.result.clustersFound }
|
|
4073
4055
|
: { itemCount: 0 };
|
|
4074
4056
|
},
|
|
4075
|
-
{ enabled: this.config.
|
|
4057
|
+
{ enabled: resolveConsolidationCapabilities(this.config).patternReinforcement },
|
|
4076
4058
|
);
|
|
4077
4059
|
}
|
|
4078
4060
|
|
|
@@ -4116,7 +4098,7 @@ export class Orchestrator {
|
|
|
4116
4098
|
});
|
|
4117
4099
|
return { itemCount: result.clustersFound };
|
|
4118
4100
|
},
|
|
4119
|
-
{ enabled: this.config.
|
|
4101
|
+
{ enabled: resolveConsolidationCapabilities(this.config).semanticConsolidation },
|
|
4120
4102
|
);
|
|
4121
4103
|
}
|
|
4122
4104
|
|
|
@@ -5447,7 +5429,7 @@ export class Orchestrator {
|
|
|
5447
5429
|
// memory directory, reject recall with a clear human-readable error
|
|
5448
5430
|
// rather than surfacing a cryptic SecureStoreLockedError from deep
|
|
5449
5431
|
// inside the storage layer.
|
|
5450
|
-
if (this.config.
|
|
5432
|
+
if (resolveRecallAuxiliaryCapabilities(this.config).secureStore && !this.storage.isSecureStoreUnlocked()) {
|
|
5451
5433
|
const lockedMsg =
|
|
5452
5434
|
"[secure-store locked] Memory store is encrypted and locked. " +
|
|
5453
5435
|
"Unlock the secure-store inside this daemon process, or restart the daemon through a secure-store aware launcher that installs the key.";
|
|
@@ -5585,7 +5567,7 @@ export class Orchestrator {
|
|
|
5585
5567
|
});
|
|
5586
5568
|
const observationNamespaces = observationScopePlan.readNamespaces;
|
|
5587
5569
|
const observationQueryPolicy = buildRecallQueryPolicy(prompt, sessionKey, {
|
|
5588
|
-
cronRecallPolicyEnabled: this.config.
|
|
5570
|
+
cronRecallPolicyEnabled: resolveRecallAuxiliaryCapabilities(this.config).cronRecallPolicy,
|
|
5589
5571
|
cronRecallNormalizedQueryMaxChars:
|
|
5590
5572
|
this.config.cronRecallNormalizedQueryMaxChars,
|
|
5591
5573
|
cronRecallInstructionHeavyTokenCap:
|
|
@@ -7011,7 +6993,7 @@ export class Orchestrator {
|
|
|
7011
6993
|
// recall searches, incl. coding `readFallbacks`). See the
|
|
7012
6994
|
// `lcmReadSessionIds` derivation after `recallNamespaces` is built.
|
|
7013
6995
|
const queryPolicy = buildRecallQueryPolicy(prompt, sessionKey, {
|
|
7014
|
-
cronRecallPolicyEnabled: this.config.
|
|
6996
|
+
cronRecallPolicyEnabled: resolveRecallAuxiliaryCapabilities(this.config).cronRecallPolicy,
|
|
7015
6997
|
cronRecallNormalizedQueryMaxChars:
|
|
7016
6998
|
this.config.cronRecallNormalizedQueryMaxChars,
|
|
7017
6999
|
cronRecallInstructionHeavyTokenCap:
|
|
@@ -7174,7 +7156,7 @@ export class Orchestrator {
|
|
|
7174
7156
|
return limit;
|
|
7175
7157
|
})()
|
|
7176
7158
|
: 0;
|
|
7177
|
-
const recallHeadroom = this.config.
|
|
7159
|
+
const recallHeadroom = resolvePresentationCapabilities(this.config).verbatimArtifacts
|
|
7178
7160
|
? Math.max(12, this.config.verbatimArtifactsMaxRecall * 4)
|
|
7179
7161
|
: 12;
|
|
7180
7162
|
const computedFetchLimit =
|
|
@@ -7187,7 +7169,7 @@ export class Orchestrator {
|
|
|
7187
7169
|
const qmdFetchLimit = computedFetchLimit;
|
|
7188
7170
|
const qmdHybridFetchLimit = computeQmdHybridFetchLimit(
|
|
7189
7171
|
qmdFetchLimit,
|
|
7190
|
-
this.config.
|
|
7172
|
+
resolvePresentationCapabilities(this.config).verbatimArtifacts,
|
|
7191
7173
|
this.config.verbatimArtifactsMaxRecall,
|
|
7192
7174
|
);
|
|
7193
7175
|
const embeddingFetchLimit = computedFetchLimit;
|
|
@@ -7879,11 +7861,11 @@ export class Orchestrator {
|
|
|
7879
7861
|
if (
|
|
7880
7862
|
!this.isRecallSectionEnabled(
|
|
7881
7863
|
"entity-retrieval",
|
|
7882
|
-
this.config.
|
|
7864
|
+
resolveRecallAuxiliaryCapabilities(this.config).entityRetrieval,
|
|
7883
7865
|
)
|
|
7884
7866
|
)
|
|
7885
7867
|
return null;
|
|
7886
|
-
if (!this.config.
|
|
7868
|
+
if (!resolveRecallAuxiliaryCapabilities(this.config).entityRetrieval) return null;
|
|
7887
7869
|
const maxChars =
|
|
7888
7870
|
this.getRecallSectionMaxChars("entity-retrieval") ??
|
|
7889
7871
|
this.config.entityRetrievalMaxChars;
|
|
@@ -7956,11 +7938,11 @@ export class Orchestrator {
|
|
|
7956
7938
|
if (
|
|
7957
7939
|
!this.isRecallSectionEnabled(
|
|
7958
7940
|
"knowledge-index",
|
|
7959
|
-
this.config.
|
|
7941
|
+
resolveRecallAuxiliaryCapabilities(this.config).knowledgeIndex,
|
|
7960
7942
|
)
|
|
7961
7943
|
)
|
|
7962
7944
|
return null;
|
|
7963
|
-
if (!this.config.
|
|
7945
|
+
if (!resolveRecallAuxiliaryCapabilities(this.config).knowledgeIndex) return null;
|
|
7964
7946
|
const t0 = Date.now();
|
|
7965
7947
|
try {
|
|
7966
7948
|
const knowledgeIndexMaxChars =
|
|
@@ -8051,11 +8033,11 @@ export class Orchestrator {
|
|
|
8051
8033
|
if (
|
|
8052
8034
|
!this.isRecallSectionEnabled(
|
|
8053
8035
|
"verbatim-artifacts",
|
|
8054
|
-
this.config.
|
|
8036
|
+
resolvePresentationCapabilities(this.config).verbatimArtifacts === true,
|
|
8055
8037
|
)
|
|
8056
8038
|
)
|
|
8057
8039
|
return [];
|
|
8058
|
-
if (!this.config.
|
|
8040
|
+
if (!resolvePresentationCapabilities(this.config).verbatimArtifacts) return [];
|
|
8059
8041
|
const t0 = Date.now();
|
|
8060
8042
|
const targetCount = computeArtifactRecallLimit(
|
|
8061
8043
|
recallMode,
|
|
@@ -8286,10 +8268,10 @@ export class Orchestrator {
|
|
|
8286
8268
|
const calibrationPromise = (async (): Promise<string | null> => {
|
|
8287
8269
|
const t0 = Date.now();
|
|
8288
8270
|
if (
|
|
8289
|
-
!this.config.
|
|
8271
|
+
!resolveConsolidationCapabilities(this.config).calibration ||
|
|
8290
8272
|
!this.isRecallSectionEnabled(
|
|
8291
8273
|
"calibration-rules",
|
|
8292
|
-
this.config.
|
|
8274
|
+
resolveConsolidationCapabilities(this.config).calibration === true,
|
|
8293
8275
|
)
|
|
8294
8276
|
) {
|
|
8295
8277
|
recordRecallSectionMetric({
|
|
@@ -8451,7 +8433,7 @@ export class Orchestrator {
|
|
|
8451
8433
|
query: retrievalQuery,
|
|
8452
8434
|
maxResults,
|
|
8453
8435
|
sessionKey,
|
|
8454
|
-
anchorsEnabled: this.config.
|
|
8436
|
+
anchorsEnabled: resolveConsolidationCapabilities(this.config).abstractionAnchors,
|
|
8455
8437
|
abortSignal: harmonicRetrievalAbort.signal,
|
|
8456
8438
|
}),
|
|
8457
8439
|
),
|
|
@@ -8498,10 +8480,10 @@ export class Orchestrator {
|
|
|
8498
8480
|
const verifiedRecallPromise = (async (): Promise<string | null> => {
|
|
8499
8481
|
const t0 = Date.now();
|
|
8500
8482
|
if (
|
|
8501
|
-
!this.config.
|
|
8483
|
+
!resolveRecallAuxiliaryCapabilities(this.config).verifiedRecall ||
|
|
8502
8484
|
!this.isRecallSectionEnabled(
|
|
8503
8485
|
"verified-episodes",
|
|
8504
|
-
this.config.
|
|
8486
|
+
resolveRecallAuxiliaryCapabilities(this.config).verifiedRecall === true,
|
|
8505
8487
|
)
|
|
8506
8488
|
) {
|
|
8507
8489
|
recordRecallSectionMetric({
|
|
@@ -8587,10 +8569,10 @@ export class Orchestrator {
|
|
|
8587
8569
|
const verifiedRulesPromise = (async (): Promise<string | null> => {
|
|
8588
8570
|
const t0 = Date.now();
|
|
8589
8571
|
if (
|
|
8590
|
-
!this.config.
|
|
8572
|
+
!resolveRecallAuxiliaryCapabilities(this.config).semanticRuleVerification ||
|
|
8591
8573
|
!this.isRecallSectionEnabled(
|
|
8592
8574
|
"verified-rules",
|
|
8593
|
-
this.config.
|
|
8575
|
+
resolveRecallAuxiliaryCapabilities(this.config).semanticRuleVerification === true,
|
|
8594
8576
|
)
|
|
8595
8577
|
) {
|
|
8596
8578
|
recordRecallSectionMetric({
|
|
@@ -8676,10 +8658,10 @@ export class Orchestrator {
|
|
|
8676
8658
|
const t0 = Date.now();
|
|
8677
8659
|
if (
|
|
8678
8660
|
!resolveCreationMemoryCapabilities(this.config).creationMemory ||
|
|
8679
|
-
!this.config.
|
|
8661
|
+
!resolveRecallAuxiliaryCapabilities(this.config).workProductRecall ||
|
|
8680
8662
|
!this.isRecallSectionEnabled(
|
|
8681
8663
|
"work-products",
|
|
8682
|
-
this.config.
|
|
8664
|
+
resolveRecallAuxiliaryCapabilities(this.config).workProductRecall === true,
|
|
8683
8665
|
)
|
|
8684
8666
|
) {
|
|
8685
8667
|
recordRecallSectionMetric({
|
|
@@ -9187,7 +9169,7 @@ export class Orchestrator {
|
|
|
9187
9169
|
const transcriptPromise = (async (): Promise<string | null> => {
|
|
9188
9170
|
const t0 = Date.now();
|
|
9189
9171
|
if (
|
|
9190
|
-
!this.config.
|
|
9172
|
+
!resolvePresentationCapabilities(this.config).transcript ||
|
|
9191
9173
|
!this.isRecallSectionEnabled("transcript", true)
|
|
9192
9174
|
) {
|
|
9193
9175
|
recordRecallSectionMetric({
|
|
@@ -9293,7 +9275,7 @@ export class Orchestrator {
|
|
|
9293
9275
|
this._recallWorkspaceOverrides.get(effectiveSessionKey);
|
|
9294
9276
|
this._recallWorkspaceOverrides.delete(effectiveSessionKey);
|
|
9295
9277
|
|
|
9296
|
-
if (!this.config.
|
|
9278
|
+
if (!resolveRecallAuxiliaryCapabilities(this.config).compactionReset) return null;
|
|
9297
9279
|
|
|
9298
9280
|
const workspaceDir =
|
|
9299
9281
|
compactionWorkspaceDir ||
|
|
@@ -9646,9 +9628,9 @@ export class Orchestrator {
|
|
|
9646
9628
|
const recentBoxesPromise = observeEnrichmentPromise(
|
|
9647
9629
|
this.isRecallSectionEnabled(
|
|
9648
9630
|
"memory-boxes",
|
|
9649
|
-
this.config.
|
|
9631
|
+
resolvePresentationCapabilities(this.config).memoryBoxes === true,
|
|
9650
9632
|
) &&
|
|
9651
|
-
this.config.
|
|
9633
|
+
resolvePresentationCapabilities(this.config).memoryBoxes &&
|
|
9652
9634
|
this.config.boxRecallDays > 0
|
|
9653
9635
|
? Promise.all(
|
|
9654
9636
|
profileStorages.map((storage) =>
|
|
@@ -12751,7 +12733,7 @@ export class Orchestrator {
|
|
|
12751
12733
|
): Promise<void> {
|
|
12752
12734
|
const mode = this.config.correctionCaptureMode;
|
|
12753
12735
|
if (mode === "off") return;
|
|
12754
|
-
if (!this.config.
|
|
12736
|
+
if (!resolveRecallAuxiliaryCapabilities(this.config).correction) return;
|
|
12755
12737
|
|
|
12756
12738
|
try {
|
|
12757
12739
|
const corrections = detectPassiveCorrections(
|
|
@@ -12771,7 +12753,7 @@ export class Orchestrator {
|
|
|
12771
12753
|
const result = await capturePassiveCorrections(
|
|
12772
12754
|
corrections,
|
|
12773
12755
|
{
|
|
12774
|
-
correctionEnabled: this.config.
|
|
12756
|
+
correctionEnabled: resolveRecallAuxiliaryCapabilities(this.config).correction,
|
|
12775
12757
|
isLiveSession: opts.isLiveSession,
|
|
12776
12758
|
bufferKey: opts.bufferKey,
|
|
12777
12759
|
sessionKey: opts.sessionKey,
|
|
@@ -13205,7 +13187,7 @@ export class Orchestrator {
|
|
|
13205
13187
|
}
|
|
13206
13188
|
|
|
13207
13189
|
let threadIdForExtraction: string | null = null;
|
|
13208
|
-
if (this.config.
|
|
13190
|
+
if (resolvePresentationCapabilities(this.config).threading && turns.length > 0) {
|
|
13209
13191
|
const lastTurn = turns[turns.length - 1];
|
|
13210
13192
|
try {
|
|
13211
13193
|
threadIdForExtraction = await this.threading.processTurn(lastTurn, []);
|
|
@@ -13335,7 +13317,7 @@ export class Orchestrator {
|
|
|
13335
13317
|
// Topics are derived from the current extraction's facts and entities only —
|
|
13336
13318
|
// not from readAllMemories() — so box topics accurately reflect the current
|
|
13337
13319
|
// session window and the call is free of expensive full-corpus I/O.
|
|
13338
|
-
if (this.config.
|
|
13320
|
+
if (resolvePresentationCapabilities(this.config).memoryBoxes && persistedIds.length > 0) {
|
|
13339
13321
|
const extractionTopics = deriveTopicsFromExtraction(result);
|
|
13340
13322
|
// Derive episodic metadata from buffer turns (REMem-inspired)
|
|
13341
13323
|
const firstUserTurn = turns.find((t) => t.role === "user");
|
|
@@ -13356,7 +13338,7 @@ export class Orchestrator {
|
|
|
13356
13338
|
// Batch-append persisted IDs so non-fact memories (entities/questions) are
|
|
13357
13339
|
// always attached to the thread. The helper excludes pending_review ids (#1635).
|
|
13358
13340
|
if (
|
|
13359
|
-
this.config.
|
|
13341
|
+
resolvePresentationCapabilities(this.config).threading &&
|
|
13360
13342
|
threadIdForExtraction &&
|
|
13361
13343
|
persistedIds.length > 0
|
|
13362
13344
|
) {
|
|
@@ -13367,7 +13349,7 @@ export class Orchestrator {
|
|
|
13367
13349
|
}
|
|
13368
13350
|
|
|
13369
13351
|
// Thread title update for the already-established thread context.
|
|
13370
|
-
if (this.config.
|
|
13352
|
+
if (resolvePresentationCapabilities(this.config).threading && threadIdForExtraction) {
|
|
13371
13353
|
const conversationContent = turns.map((t) => t.content).join(" ");
|
|
13372
13354
|
try {
|
|
13373
13355
|
await this.threading.updateThreadTitle(
|
|
@@ -15268,7 +15250,7 @@ export class Orchestrator {
|
|
|
15268
15250
|
|
|
15269
15251
|
if (chunkResult.chunked && chunkResult.chunks.length > 1) {
|
|
15270
15252
|
// Classify memory kind (v8.0 Phase 2B: HiMem episode/note dual store)
|
|
15271
|
-
const memoryKind = this.config.
|
|
15253
|
+
const memoryKind = resolvePresentationCapabilities(this.config).episodeNoteMode
|
|
15272
15254
|
? classifyMemoryKind(fact.content, fact.tags ?? [], writeCategory)
|
|
15273
15255
|
: undefined;
|
|
15274
15256
|
|
|
@@ -15525,7 +15507,7 @@ export class Orchestrator {
|
|
|
15525
15507
|
}
|
|
15526
15508
|
try {
|
|
15527
15509
|
if (
|
|
15528
|
-
this.config.
|
|
15510
|
+
resolvePresentationCapabilities(this.config).verbatimArtifacts &&
|
|
15529
15511
|
this.config.verbatimArtifactCategories.includes(writeCategory) &&
|
|
15530
15512
|
fact.confidence >= this.config.verbatimArtifactsMinConfidence &&
|
|
15531
15513
|
!postWriteGuard
|
|
@@ -15622,7 +15604,7 @@ export class Orchestrator {
|
|
|
15622
15604
|
const memoryKind =
|
|
15623
15605
|
writeCategory === "procedure"
|
|
15624
15606
|
? undefined
|
|
15625
|
-
: this.config.
|
|
15607
|
+
: resolvePresentationCapabilities(this.config).episodeNoteMode
|
|
15626
15608
|
? classifyMemoryKind(fact.content, fact.tags ?? [], writeCategory)
|
|
15627
15609
|
: undefined;
|
|
15628
15610
|
|
|
@@ -15822,7 +15804,7 @@ export class Orchestrator {
|
|
|
15822
15804
|
}
|
|
15823
15805
|
}
|
|
15824
15806
|
if (
|
|
15825
|
-
this.config.
|
|
15807
|
+
resolvePresentationCapabilities(this.config).verbatimArtifacts &&
|
|
15826
15808
|
this.config.verbatimArtifactCategories.includes(writeCategory) &&
|
|
15827
15809
|
fact.confidence >= this.config.verbatimArtifactsMinConfidence &&
|
|
15828
15810
|
!postWriteGuard
|
|
@@ -16438,7 +16420,7 @@ export class Orchestrator {
|
|
|
16438
16420
|
log.info(`merged ${entitiesMerged} fragmented entity files`);
|
|
16439
16421
|
}
|
|
16440
16422
|
|
|
16441
|
-
if (this.config.
|
|
16423
|
+
if (resolvePresentationCapabilities(this.config).entitySummary) {
|
|
16442
16424
|
try {
|
|
16443
16425
|
const synthesized = await this.processEntitySynthesisQueue(
|
|
16444
16426
|
this.config.defaultNamespace,
|
|
@@ -16582,7 +16564,7 @@ export class Orchestrator {
|
|
|
16582
16564
|
}
|
|
16583
16565
|
|
|
16584
16566
|
// Semantic consolidation pass — find similar memories, synthesize canonical versions
|
|
16585
|
-
if (this.config.
|
|
16567
|
+
if (resolveConsolidationCapabilities(this.config).semanticConsolidation) {
|
|
16586
16568
|
try {
|
|
16587
16569
|
const stateFilePath = path.join(
|
|
16588
16570
|
this.config.memoryDir,
|
|
@@ -16946,226 +16928,55 @@ export class Orchestrator {
|
|
|
16946
16928
|
}
|
|
16947
16929
|
}
|
|
16948
16930
|
|
|
16931
|
+
// Issue #1526: recall result formatting moved to RecallResultFormatter. Thin
|
|
16932
|
+
// delegation keeps the private API stable for callers + tests.
|
|
16949
16933
|
private formatQmdResults(
|
|
16950
16934
|
title: string,
|
|
16951
16935
|
results: QmdSearchResult[],
|
|
16952
16936
|
sessionKey?: string,
|
|
16953
16937
|
trustByPath?: Map<string, TrustStageResultItem> | null,
|
|
16954
16938
|
): string {
|
|
16955
|
-
|
|
16956
|
-
// resolution requires the handle history to have been recorded for this
|
|
16957
|
-
// session, which only happens when sessionKey is present. Rendering handles
|
|
16958
|
-
// without recording would show tokens a user can never resolve (cursor
|
|
16959
|
-
// review). The rendering logic itself lives in the pure handles module.
|
|
16960
|
-
const handleByIndex = buildHandleIndexForResults(
|
|
16961
|
-
results,
|
|
16962
|
-
this.config.recallMemoryHandles === true && sessionKey != null,
|
|
16963
|
-
);
|
|
16964
|
-
// Issue #1577 — epistemic hedge. Append a deterministic, component-derived
|
|
16965
|
-
// suffix so the downstream model knows each memory's trust status (the
|
|
16966
|
-
// cheap lever against confident-stale-answer failures). Gated separately
|
|
16967
|
-
// from scoring so rendering can ship after the stage is stable. High-band
|
|
16968
|
-
// and neutral items get no suffix (don't waste tokens on the common case).
|
|
16969
|
-
const renderHedge = this.config.trustScoreEpistemicRendering && trustByPath !== null && trustByPath !== undefined;
|
|
16970
|
-
const hedgeMap = renderHedge ? trustByPath : null;
|
|
16971
|
-
const lines = results.map((r, i) => {
|
|
16972
|
-
const snippet = r.snippet
|
|
16973
|
-
? r.snippet.slice(0, 500).replace(/\n/g, " ")
|
|
16974
|
-
: "(no preview)";
|
|
16975
|
-
const source = typeof r.line === "number" ? `${r.path}:${r.line}` : r.path;
|
|
16976
|
-
const head = `[${i + 1}] ${source} (score: ${r.score.toFixed(3)})\n${snippet}`;
|
|
16977
|
-
const handle = handleByIndex.get(i);
|
|
16978
|
-
const hedged = head.replace(/\s+$/, "");
|
|
16979
|
-
const withHandle = handle ? `${hedged} ${handle}` : hedged;
|
|
16980
|
-
if (hedgeMap) {
|
|
16981
|
-
const item = hedgeMap.get(r.path);
|
|
16982
|
-
if (item) {
|
|
16983
|
-
const hedge = renderEpistemicHedge(item.trust);
|
|
16984
|
-
if (hedge.length > 0) return `${withHandle} ${hedge}`;
|
|
16985
|
-
}
|
|
16986
|
-
}
|
|
16987
|
-
return withHandle;
|
|
16988
|
-
});
|
|
16989
|
-
return `## ${title}\n\n${lines.join("\n\n")}`;
|
|
16939
|
+
return this.recallResultFormatter.formatQmdResults(title, results, sessionKey, trustByPath);
|
|
16990
16940
|
}
|
|
16991
16941
|
|
|
16992
16942
|
private formatObjectiveStateResults(
|
|
16993
16943
|
results: ObjectiveStateSearchResult[],
|
|
16994
16944
|
): string {
|
|
16995
|
-
|
|
16996
|
-
const parts = [
|
|
16997
|
-
snapshot.recordedAt.replace("T", " ").slice(0, 16),
|
|
16998
|
-
`${snapshot.kind}/${snapshot.changeKind}`,
|
|
16999
|
-
];
|
|
17000
|
-
if (snapshot.outcome) parts.push(snapshot.outcome);
|
|
17001
|
-
const header = `[${index + 1}] ${parts.join(" | ")} | ${snapshot.scope}`;
|
|
17002
|
-
const detailParts = [snapshot.summary];
|
|
17003
|
-
if (snapshot.command) detailParts.push(`command: ${snapshot.command}`);
|
|
17004
|
-
else if (snapshot.toolName)
|
|
17005
|
-
detailParts.push(`tool: ${snapshot.toolName}`);
|
|
17006
|
-
return `${header}\n${detailParts.join(" | ")}`;
|
|
17007
|
-
});
|
|
17008
|
-
return `## Objective State\n\n${lines.join("\n\n")}`;
|
|
16945
|
+
return this.recallResultFormatter.formatObjectiveStateResults(results);
|
|
17009
16946
|
}
|
|
17010
16947
|
|
|
17011
16948
|
private formatCausalTrajectoryResults(
|
|
17012
16949
|
results: CausalTrajectorySearchResult[],
|
|
17013
16950
|
): string {
|
|
17014
|
-
|
|
17015
|
-
const header = [
|
|
17016
|
-
`[${index + 1}] ${record.recordedAt.replace("T", " ").slice(0, 16)}`,
|
|
17017
|
-
record.outcomeKind,
|
|
17018
|
-
].join(" | ");
|
|
17019
|
-
const details = [
|
|
17020
|
-
`goal: ${record.goal}`,
|
|
17021
|
-
`action: ${record.actionSummary}`,
|
|
17022
|
-
`observation: ${record.observationSummary}`,
|
|
17023
|
-
`outcome: ${record.outcomeSummary}`,
|
|
17024
|
-
];
|
|
17025
|
-
if (record.followUpSummary)
|
|
17026
|
-
details.push(`follow-up: ${record.followUpSummary}`);
|
|
17027
|
-
if (matchedFields.length > 0)
|
|
17028
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17029
|
-
return `${header}\n${details.join("\n")}`;
|
|
17030
|
-
});
|
|
17031
|
-
|
|
17032
|
-
return `## Causal Trajectories\n\n${lines.join("\n\n")}`;
|
|
16951
|
+
return this.recallResultFormatter.formatCausalTrajectoryResults(results);
|
|
17033
16952
|
}
|
|
17034
16953
|
|
|
17035
16954
|
private formatTrustZoneResults(results: TrustZoneSearchResult[]): string {
|
|
17036
|
-
|
|
17037
|
-
const header = [
|
|
17038
|
-
`[${index + 1}] ${record.recordedAt.replace("T", " ").slice(0, 16)}`,
|
|
17039
|
-
record.zone,
|
|
17040
|
-
record.kind,
|
|
17041
|
-
].join(" | ");
|
|
17042
|
-
const details = [
|
|
17043
|
-
record.summary,
|
|
17044
|
-
`provenance: ${record.provenance.sourceClass}`,
|
|
17045
|
-
];
|
|
17046
|
-
if (record.entityRefs && record.entityRefs.length > 0) {
|
|
17047
|
-
details.push(`entities: ${record.entityRefs.join(", ")}`);
|
|
17048
|
-
}
|
|
17049
|
-
if (record.tags && record.tags.length > 0) {
|
|
17050
|
-
details.push(`tags: ${record.tags.join(", ")}`);
|
|
17051
|
-
}
|
|
17052
|
-
if (matchedFields.length > 0) {
|
|
17053
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17054
|
-
}
|
|
17055
|
-
return `${header}\n${details.join("\n")}`;
|
|
17056
|
-
});
|
|
17057
|
-
|
|
17058
|
-
return `## Trust Zones\n\n${lines.join("\n\n")}`;
|
|
16955
|
+
return this.recallResultFormatter.formatTrustZoneResults(results);
|
|
17059
16956
|
}
|
|
17060
16957
|
|
|
17061
16958
|
private formatHarmonicRetrievalResults(
|
|
17062
16959
|
results: HarmonicRetrievalResult[],
|
|
17063
16960
|
): string {
|
|
17064
|
-
|
|
17065
|
-
(
|
|
17066
|
-
{ node, matchedAnchors, matchedFields, nodeScore, anchorScore },
|
|
17067
|
-
index,
|
|
17068
|
-
) => {
|
|
17069
|
-
const header = [
|
|
17070
|
-
`[${index + 1}] ${node.recordedAt.replace("T", " ").slice(0, 16)}`,
|
|
17071
|
-
`${node.kind}/${node.abstractionLevel}`,
|
|
17072
|
-
node.sessionKey,
|
|
17073
|
-
].join(" | ");
|
|
17074
|
-
const details = [
|
|
17075
|
-
node.title,
|
|
17076
|
-
node.summary,
|
|
17077
|
-
`scores: node=${nodeScore.toFixed(1)} anchor=${anchorScore.toFixed(1)}`,
|
|
17078
|
-
];
|
|
17079
|
-
if (matchedAnchors.length > 0) {
|
|
17080
|
-
details.push(
|
|
17081
|
-
`anchors: ${matchedAnchors.map((anchor) => `${anchor.anchorType}:${anchor.anchorValue}`).join("; ")}`,
|
|
17082
|
-
);
|
|
17083
|
-
}
|
|
17084
|
-
if (matchedFields.length > 0) {
|
|
17085
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17086
|
-
}
|
|
17087
|
-
return `${header}\n${details.join("\n")}`;
|
|
17088
|
-
},
|
|
17089
|
-
);
|
|
17090
|
-
|
|
17091
|
-
return `## Harmonic Retrieval\n\n${lines.join("\n\n")}`;
|
|
16961
|
+
return this.recallResultFormatter.formatHarmonicRetrievalResults(results);
|
|
17092
16962
|
}
|
|
17093
16963
|
|
|
17094
16964
|
private formatWorkProductResults(
|
|
17095
16965
|
results: WorkProductLedgerSearchResult[],
|
|
17096
16966
|
): string {
|
|
17097
|
-
|
|
17098
|
-
const header = [
|
|
17099
|
-
`[${index + 1}] ${entry.recordedAt.replace("T", " ").slice(0, 16)}`,
|
|
17100
|
-
`${entry.kind}/${entry.action}`,
|
|
17101
|
-
entry.sessionKey,
|
|
17102
|
-
].join(" | ");
|
|
17103
|
-
const details = [entry.summary, `scope: ${entry.scope}`];
|
|
17104
|
-
if (entry.artifactPath) details.push(`artifact: ${entry.artifactPath}`);
|
|
17105
|
-
if (entry.tags && entry.tags.length > 0)
|
|
17106
|
-
details.push(`tags: ${entry.tags.join(", ")}`);
|
|
17107
|
-
if (matchedFields.length > 0)
|
|
17108
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17109
|
-
return `${header}\n${details.join("\n")}`;
|
|
17110
|
-
});
|
|
17111
|
-
|
|
17112
|
-
return `## Work Products\n\n${lines.join("\n\n")}`;
|
|
16967
|
+
return this.recallResultFormatter.formatWorkProductResults(results);
|
|
17113
16968
|
}
|
|
17114
16969
|
|
|
17115
16970
|
private formatVerifiedEpisodeResults(
|
|
17116
16971
|
results: VerifiedEpisodeResult[],
|
|
17117
16972
|
): string {
|
|
17118
|
-
|
|
17119
|
-
({ box, verifiedEpisodeCount, matchedFields }, index) => {
|
|
17120
|
-
const header = [
|
|
17121
|
-
`[${index + 1}] ${box.sealedAt.replace("T", " ").slice(0, 16)}`,
|
|
17122
|
-
box.traceId ? `trace:${box.traceId.slice(0, 12)}` : "trace:none",
|
|
17123
|
-
].join(" | ");
|
|
17124
|
-
const details = [
|
|
17125
|
-
box.goal ?? `topics: ${box.topics.join(", ")}`,
|
|
17126
|
-
`verified episodes: ${verifiedEpisodeCount}`,
|
|
17127
|
-
];
|
|
17128
|
-
if (box.toolsUsed && box.toolsUsed.length > 0) {
|
|
17129
|
-
details.push(`tools: ${box.toolsUsed.join(", ")}`);
|
|
17130
|
-
}
|
|
17131
|
-
if (matchedFields.length > 0) {
|
|
17132
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17133
|
-
}
|
|
17134
|
-
return `${header}\n${details.join("\n")}`;
|
|
17135
|
-
},
|
|
17136
|
-
);
|
|
17137
|
-
|
|
17138
|
-
return `## Verified Episodes\n\n${lines.join("\n\n")}`;
|
|
16973
|
+
return this.recallResultFormatter.formatVerifiedEpisodeResults(results);
|
|
17139
16974
|
}
|
|
17140
16975
|
|
|
17141
16976
|
private formatVerifiedSemanticRuleResults(
|
|
17142
16977
|
results: VerifiedSemanticRuleResult[],
|
|
17143
16978
|
): string {
|
|
17144
|
-
|
|
17145
|
-
(
|
|
17146
|
-
{
|
|
17147
|
-
rule,
|
|
17148
|
-
sourceMemoryId,
|
|
17149
|
-
verificationStatus,
|
|
17150
|
-
effectiveConfidence,
|
|
17151
|
-
matchedFields,
|
|
17152
|
-
},
|
|
17153
|
-
index,
|
|
17154
|
-
) => {
|
|
17155
|
-
const header = [
|
|
17156
|
-
`[${index + 1}] ${rule.frontmatter.updated.replace("T", " ").slice(0, 16)}`,
|
|
17157
|
-
verificationStatus,
|
|
17158
|
-
`confidence:${effectiveConfidence.toFixed(2)}`,
|
|
17159
|
-
].join(" | ");
|
|
17160
|
-
const details = [rule.content, `source memory: ${sourceMemoryId}`];
|
|
17161
|
-
if (matchedFields.length > 0) {
|
|
17162
|
-
details.push(`matched: ${matchedFields.join(", ")}`);
|
|
17163
|
-
}
|
|
17164
|
-
return `${header}\n${details.join("\n")}`;
|
|
17165
|
-
},
|
|
17166
|
-
);
|
|
17167
|
-
|
|
17168
|
-
return `## Verified Rules\n\n${lines.join("\n\n")}`;
|
|
16979
|
+
return this.recallResultFormatter.formatVerifiedSemanticRuleResults(results);
|
|
17169
16980
|
}
|
|
17170
16981
|
|
|
17171
16982
|
private summarizeIdentityText(
|
|
@@ -17173,42 +16984,21 @@ export class Orchestrator {
|
|
|
17173
16984
|
maxLines: number,
|
|
17174
16985
|
maxChars: number,
|
|
17175
16986
|
): string {
|
|
17176
|
-
|
|
17177
|
-
.replace(/\r/g, "")
|
|
17178
|
-
.split("\n")
|
|
17179
|
-
.map((line) => line.trim())
|
|
17180
|
-
.filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
17181
|
-
const compact = lines.slice(0, Math.max(1, maxLines)).join(" ");
|
|
17182
|
-
if (compact.length <= maxChars) return compact;
|
|
17183
|
-
return `${compact.slice(0, Math.max(0, maxChars - 1))}…`;
|
|
16987
|
+
return this.recallResultFormatter.summarizeIdentityText(raw, maxLines, maxChars);
|
|
17184
16988
|
}
|
|
17185
16989
|
|
|
17186
16990
|
private formatOpenIncidentLine(
|
|
17187
16991
|
incident: ContinuityIncidentRecord,
|
|
17188
16992
|
includeDetails: boolean,
|
|
17189
16993
|
): string {
|
|
17190
|
-
|
|
17191
|
-
if (!includeDetails) return `- ${base}`;
|
|
17192
|
-
const parts = [base];
|
|
17193
|
-
if (incident.suspectedCause)
|
|
17194
|
-
parts.push(`cause: ${incident.suspectedCause.trim()}`);
|
|
17195
|
-
if (incident.triggerWindow)
|
|
17196
|
-
parts.push(`window: ${incident.triggerWindow.trim()}`);
|
|
17197
|
-
return `- ${parts.join(" | ")}`;
|
|
16994
|
+
return this.recallResultFormatter.formatOpenIncidentLine(incident, includeDetails);
|
|
17198
16995
|
}
|
|
17199
16996
|
|
|
17200
16997
|
private trimIdentitySection(
|
|
17201
16998
|
content: string,
|
|
17202
16999
|
maxChars: number,
|
|
17203
17000
|
): { text: string; truncated: boolean } {
|
|
17204
|
-
|
|
17205
|
-
if (content.length <= maxChars) return { text: content, truncated: false };
|
|
17206
|
-
const suffix = "\n\n...(identity continuity trimmed)";
|
|
17207
|
-
if (maxChars <= suffix.length) {
|
|
17208
|
-
return { text: content.slice(0, maxChars), truncated: true };
|
|
17209
|
-
}
|
|
17210
|
-
const headroom = Math.max(0, maxChars - suffix.length);
|
|
17211
|
-
return { text: `${content.slice(0, headroom)}${suffix}`, truncated: true };
|
|
17001
|
+
return this.recallResultFormatter.trimIdentitySection(content, maxChars);
|
|
17212
17002
|
}
|
|
17213
17003
|
|
|
17214
17004
|
private async buildIdentityContinuitySection(options: {
|
|
@@ -17221,81 +17011,7 @@ export class Orchestrator {
|
|
|
17221
17011
|
injectedChars: number;
|
|
17222
17012
|
truncated: boolean;
|
|
17223
17013
|
} | null> {
|
|
17224
|
-
|
|
17225
|
-
if (this.config.identityMaxInjectChars <= 0) return null;
|
|
17226
|
-
|
|
17227
|
-
const resolved = resolveEffectiveIdentityInjectionMode({
|
|
17228
|
-
configuredMode: this.config.identityInjectionMode,
|
|
17229
|
-
recallMode: options.recallMode,
|
|
17230
|
-
prompt: options.prompt,
|
|
17231
|
-
});
|
|
17232
|
-
if (!resolved.shouldInject) return null;
|
|
17233
|
-
|
|
17234
|
-
const [anchorRaw, loopsRaw, incidents] = await Promise.all([
|
|
17235
|
-
options.storage.readIdentityAnchor(),
|
|
17236
|
-
options.storage.readIdentityImprovementLoops(),
|
|
17237
|
-
options.storage.readContinuityIncidents(200),
|
|
17238
|
-
]);
|
|
17239
|
-
const openIncidents = incidents.filter(
|
|
17240
|
-
(incident) => incident.state === "open",
|
|
17241
|
-
);
|
|
17242
|
-
|
|
17243
|
-
const lines: string[] = [];
|
|
17244
|
-
if (resolved.mode === "full") {
|
|
17245
|
-
lines.push("## Identity Continuity");
|
|
17246
|
-
if (anchorRaw && anchorRaw.trim().length > 0) {
|
|
17247
|
-
lines.push("", "### Anchor", "", anchorRaw.trim());
|
|
17248
|
-
}
|
|
17249
|
-
if (loopsRaw && loopsRaw.trim().length > 0) {
|
|
17250
|
-
lines.push("", "### Improvement Loops", "", loopsRaw.trim());
|
|
17251
|
-
}
|
|
17252
|
-
lines.push("", "### Open Incidents", "");
|
|
17253
|
-
if (openIncidents.length === 0) {
|
|
17254
|
-
lines.push("- none");
|
|
17255
|
-
} else {
|
|
17256
|
-
lines.push(
|
|
17257
|
-
...openIncidents
|
|
17258
|
-
.slice(0, 5)
|
|
17259
|
-
.map((incident) => this.formatOpenIncidentLine(incident, true)),
|
|
17260
|
-
);
|
|
17261
|
-
}
|
|
17262
|
-
} else {
|
|
17263
|
-
const anchorSummary = anchorRaw
|
|
17264
|
-
? this.summarizeIdentityText(anchorRaw, 3, 320)
|
|
17265
|
-
: "";
|
|
17266
|
-
const loopsSummary = loopsRaw
|
|
17267
|
-
? this.summarizeIdentityText(loopsRaw, 2, 240)
|
|
17268
|
-
: "";
|
|
17269
|
-
lines.push("## Identity Continuity Signals", "");
|
|
17270
|
-
if (anchorSummary) lines.push(`- anchor: ${anchorSummary}`);
|
|
17271
|
-
if (loopsSummary) lines.push(`- loops: ${loopsSummary}`);
|
|
17272
|
-
if (openIncidents.length === 0) {
|
|
17273
|
-
lines.push("- incidents: 0 open");
|
|
17274
|
-
} else {
|
|
17275
|
-
lines.push(`- incidents: ${openIncidents.length} open`);
|
|
17276
|
-
lines.push(
|
|
17277
|
-
...openIncidents
|
|
17278
|
-
.slice(0, 2)
|
|
17279
|
-
.map((incident) => this.formatOpenIncidentLine(incident, false)),
|
|
17280
|
-
);
|
|
17281
|
-
}
|
|
17282
|
-
}
|
|
17283
|
-
|
|
17284
|
-
const body = lines.join("\n").trim();
|
|
17285
|
-
if (!body) return null;
|
|
17286
|
-
|
|
17287
|
-
const { text, truncated } = this.trimIdentitySection(
|
|
17288
|
-
body,
|
|
17289
|
-
this.config.identityMaxInjectChars,
|
|
17290
|
-
);
|
|
17291
|
-
if (!text) return null;
|
|
17292
|
-
|
|
17293
|
-
return {
|
|
17294
|
-
section: text,
|
|
17295
|
-
mode: resolved.mode,
|
|
17296
|
-
injectedChars: text.length,
|
|
17297
|
-
truncated,
|
|
17298
|
-
};
|
|
17014
|
+
return this.recallResultFormatter.buildIdentityContinuitySection(options);
|
|
17299
17015
|
}
|
|
17300
17016
|
|
|
17301
17017
|
private emitTrace(event: EngramTraceEvent): void {
|