@remnic/core 1.1.11 → 1.1.12
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/README.md +3 -3
- package/dist/access-cli.js +67 -59
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +7 -4
- package/dist/access-http.js +30 -26
- package/dist/access-mcp.d.ts +9 -4
- package/dist/access-mcp.js +29 -25
- package/dist/access-schema.d.ts +188 -8
- package/dist/access-schema.js +12 -3
- package/dist/{access-service-BkXt3di1.d.ts → access-service-DDjzFALq.d.ts} +60 -11
- package/dist/access-service.d.ts +7 -4
- package/dist/access-service.js +26 -23
- package/dist/action-confidence.d.ts +83 -0
- package/dist/action-confidence.js +22 -0
- package/dist/active-memory-bridge.d.ts +1 -1
- 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 +4 -2
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +5 -5
- 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/calibration.js +4 -4
- package/dist/{capsule-export-LLEVB2RG.js → capsule-export-7QNCBZOQ.js} +3 -3
- package/dist/{capsule-import-UW45R2MZ.js → capsule-import-EPBHD2EN.js} +3 -3
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +11 -11
- package/dist/{chunk-VQXK37XA.js → chunk-23ZZK64Y.js} +1 -1
- package/dist/chunk-23ZZK64Y.js.map +1 -0
- package/dist/{chunk-HJYHRE4S.js → chunk-242S3I2A.js} +2 -2
- package/dist/{chunk-MCC6KDQF.js → chunk-3B6KIRBH.js} +131 -13
- package/dist/chunk-3B6KIRBH.js.map +1 -0
- package/dist/chunk-4RA3C3EV.js +60 -0
- package/dist/chunk-4RA3C3EV.js.map +1 -0
- package/dist/{chunk-EYNQTST2.js → chunk-4YM32CRU.js} +4 -4
- package/dist/{chunk-6AUUAZEX.js → chunk-5NXIJZFX.js} +38 -8
- package/dist/chunk-5NXIJZFX.js.map +1 -0
- package/dist/chunk-6NKAQ74D.js +2237 -0
- package/dist/chunk-6NKAQ74D.js.map +1 -0
- package/dist/{chunk-PHNGXFQ6.js → chunk-7V22HTMD.js} +3 -3
- package/dist/{chunk-363MWCD3.js → chunk-7ZM3BFKK.js} +84 -62
- package/dist/chunk-7ZM3BFKK.js.map +1 -0
- package/dist/chunk-AC5LO7IU.js +308 -0
- package/dist/chunk-AC5LO7IU.js.map +1 -0
- package/dist/chunk-AH2JUU6X.js +336 -0
- package/dist/chunk-AH2JUU6X.js.map +1 -0
- package/dist/{chunk-VX2IUQFE.js → chunk-AQJNPMOA.js} +41 -11
- package/dist/chunk-AQJNPMOA.js.map +1 -0
- package/dist/{chunk-P73JTV34.js → chunk-BBE34QBJ.js} +4 -4
- package/dist/{chunk-KUHRUM6B.js → chunk-BZSQEPRW.js} +452 -139
- package/dist/chunk-BZSQEPRW.js.map +1 -0
- package/dist/chunk-C5BCH4ZS.js +317 -0
- package/dist/chunk-C5BCH4ZS.js.map +1 -0
- package/dist/{chunk-C5HUWVH2.js → chunk-CPKTBRS2.js} +6 -6
- package/dist/{chunk-IBX3VFOM.js → chunk-D4GAOFF6.js} +118 -2
- package/dist/chunk-D4GAOFF6.js.map +1 -0
- package/dist/chunk-DB5A3NHS.js +906 -0
- package/dist/chunk-DB5A3NHS.js.map +1 -0
- package/dist/{chunk-I6BQZSML.js → chunk-DZZPC36E.js} +10 -10
- package/dist/{chunk-O4XJUPSF.js → chunk-E2UCDP5S.js} +39 -2
- package/dist/chunk-E2UCDP5S.js.map +1 -0
- package/dist/{chunk-SRBJUAMP.js → chunk-FMEBPEAO.js} +11 -67
- package/dist/chunk-FMEBPEAO.js.map +1 -0
- package/dist/{chunk-4DXC6HQQ.js → chunk-FQDPCE3I.js} +5 -5
- package/dist/{chunk-NN3LPQ5D.js → chunk-HELQZFZO.js} +155 -16
- package/dist/chunk-HELQZFZO.js.map +1 -0
- package/dist/{chunk-57QNCUEZ.js → chunk-HL5LRPNA.js} +2 -2
- package/dist/{chunk-VTU2B4VF.js → chunk-HQZVVSVB.js} +2 -1
- package/dist/chunk-HQZVVSVB.js.map +1 -0
- package/dist/{chunk-6Z6UH6TK.js → chunk-HY3L4WKC.js} +69 -3
- package/dist/chunk-HY3L4WKC.js.map +1 -0
- package/dist/{chunk-QIGOEM65.js → chunk-IB3BFHGN.js} +5 -5
- package/dist/{chunk-RXTFCYQF.js → chunk-JESOB2HO.js} +6 -6
- package/dist/{chunk-2YMTO4ZJ.js → chunk-JKDVIE52.js} +9 -2
- package/dist/chunk-JKDVIE52.js.map +1 -0
- package/dist/{chunk-WGK4VHGP.js → chunk-MNU6ZBWT.js} +302 -140
- package/dist/chunk-MNU6ZBWT.js.map +1 -0
- package/dist/chunk-OAZ5MFUB.js +4124 -0
- package/dist/chunk-OAZ5MFUB.js.map +1 -0
- package/dist/{chunk-ZTSE2ZJ6.js → chunk-OIGNEXKZ.js} +50 -3
- package/dist/chunk-OIGNEXKZ.js.map +1 -0
- package/dist/chunk-OZKZ2TRP.js +3729 -0
- package/dist/chunk-OZKZ2TRP.js.map +1 -0
- package/dist/{chunk-GGD5W7TB.js → chunk-PD6O7AXF.js} +7 -2
- package/dist/chunk-PD6O7AXF.js.map +1 -0
- package/dist/{chunk-S3IP6R6K.js → chunk-PH4C2U43.js} +23 -3
- package/dist/chunk-PH4C2U43.js.map +1 -0
- package/dist/chunk-PYPOFEMK.js +294 -0
- package/dist/chunk-PYPOFEMK.js.map +1 -0
- package/dist/{chunk-EQINRHYR.js → chunk-QDZ2RLEC.js} +243 -7
- package/dist/chunk-QDZ2RLEC.js.map +1 -0
- package/dist/{chunk-KWBPHZUU.js → chunk-RK6F44Y6.js} +3 -2
- package/dist/chunk-RK6F44Y6.js.map +1 -0
- package/dist/{chunk-36CTNQY7.js → chunk-RVPLBATS.js} +42 -10
- package/dist/chunk-RVPLBATS.js.map +1 -0
- package/dist/chunk-SOAU2OE2.js +125 -0
- package/dist/chunk-SOAU2OE2.js.map +1 -0
- package/dist/{chunk-A4ACKWIW.js → chunk-U5JMRGKX.js} +55 -4
- package/dist/chunk-U5JMRGKX.js.map +1 -0
- package/dist/{chunk-LIO5X3CM.js → chunk-UVMUAWVT.js} +2 -2
- package/dist/chunk-VWT3F4IV.js +2161 -0
- package/dist/chunk-VWT3F4IV.js.map +1 -0
- package/dist/{chunk-PB5KW5PL.js → chunk-WEJG4TB5.js} +6 -6
- package/dist/{chunk-KBYWQWSB.js → chunk-X7HPGUVG.js} +2 -2
- package/dist/{chunk-Y5KDIOKF.js → chunk-XAMBKFQS.js} +383 -9
- package/dist/chunk-XAMBKFQS.js.map +1 -0
- package/dist/{chunk-ZL4S7ARC.js → chunk-Y3VMVTYX.js} +3 -3
- package/dist/{chunk-Z5S5HNGY.js → chunk-ZG7PTKBK.js} +21 -5
- package/dist/chunk-ZG7PTKBK.js.map +1 -0
- package/dist/{chunk-6XA7UN4Z.js → chunk-ZNQN6ZTA.js} +2 -2
- package/dist/{chunk-WTFWLUSX.js → chunk-ZVTKDVVM.js} +2 -2
- package/dist/{cli-Cvy2SNhF.d.ts → cli-BR8KpIU0.d.ts} +2 -2
- package/dist/cli.d.ts +7 -4
- package/dist/cli.js +44 -40
- package/dist/codex-cli-fallback.d.ts +1 -0
- package/dist/codex-cli-fallback.js +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/{contradiction-scan-3Z6YW7YA.js → contradiction-scan-QTXAMBUA.js} +3 -2
- package/dist/contradiction-scan-QTXAMBUA.js.map +1 -0
- 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-wiring.js +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/{engine-FOC3IJLA.js → engine-35M5BKQ7.js} +7 -7
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +5 -5
- package/dist/entity-schema.d.ts +1 -1
- package/dist/event-order-recall.d.ts +17 -0
- package/dist/event-order-recall.js +11 -0
- package/dist/event-order-recall.js.map +1 -0
- package/dist/evidence-pack.d.ts +3 -1
- package/dist/evidence-pack.js +5 -3
- package/dist/explicit-capture.d.ts +4 -2
- package/dist/explicit-cue-recall.d.ts +4 -1
- package/dist/explicit-cue-recall.js +4 -2
- 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 +8 -7
- package/dist/fallback-llm.d.ts +2 -1
- package/dist/fallback-llm.js +4 -4
- package/dist/focused-list-recall.d.ts +17 -0
- package/dist/focused-list-recall.js +11 -0
- package/dist/focused-list-recall.js.map +1 -0
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/{index-1qIcnbG1.d.ts → index-DJ9QWMw-.d.ts} +3 -2
- package/dist/index.d.ts +49 -12
- package/dist/index.js +284 -114
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/intent.js +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +8 -4
- package/dist/local-llm.js +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +106 -0
- package/dist/mcp-memory-inspector-app.js +20 -0
- package/dist/mcp-memory-inspector-app.js.map +1 -0
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/{memory-governance-F3QOJGEY.js → memory-governance-IMPQZXFC.js} +7 -7
- package/dist/memory-governance-IMPQZXFC.js.map +1 -0
- 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 +57 -0
- package/dist/memory-provenance.js +13 -0
- package/dist/memory-provenance.js.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/objective-state-writers.d.ts +1 -1
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +11 -11
- package/dist/{orchestrator-AOQMo7QI.d.ts → orchestrator-DDMPqU6R.d.ts} +9 -1
- package/dist/orchestrator.d.ts +4 -2
- package/dist/orchestrator.js +53 -46
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +3 -1
- package/dist/recall-explain-renderer.js +5 -3
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +3 -1
- package/dist/recall-xray-cli.d.ts +3 -1
- package/dist/recall-xray-cli.js +6 -4
- package/dist/recall-xray-renderer.d.ts +3 -1
- package/dist/recall-xray-renderer.js +5 -3
- package/dist/recall-xray.d.ts +8 -1
- package/dist/recall-xray.js +4 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resolve-provider-secret.js +1 -1
- package/dist/response-guidance-recall.d.ts +18 -0
- package/dist/response-guidance-recall.js +11 -0
- package/dist/response-guidance-recall.js.map +1 -0
- package/dist/resume-bundles.js +3 -3
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/semantic-consolidation.d.ts +1 -1
- package/dist/semantic-consolidation.js +6 -6
- package/dist/semantic-rule-promotion.js +5 -5
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +6 -6
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +4 -4
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +6 -6
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/targeted-fact-recall.d.ts +17 -0
- package/dist/targeted-fact-recall.js +11 -0
- package/dist/targeted-fact-recall.js.map +1 -0
- package/dist/telemetry-transcript.d.ts +7 -0
- package/dist/telemetry-transcript.js +16 -0
- package/dist/telemetry-transcript.js.map +1 -0
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-supersession.js +2 -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/tokens.js +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/trust-zones.d.ts +3 -2
- package/dist/trust-zones.js +1 -1
- package/dist/types.d.ts +60 -2
- package/dist/types.js +1 -1
- package/dist/user-model.d.ts +37 -0
- package/dist/user-model.js +28 -0
- package/dist/user-model.js.map +1 -0
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-2YMTO4ZJ.js.map +0 -1
- package/dist/chunk-363MWCD3.js.map +0 -1
- package/dist/chunk-36CTNQY7.js.map +0 -1
- package/dist/chunk-6AUUAZEX.js.map +0 -1
- package/dist/chunk-6Z6UH6TK.js.map +0 -1
- package/dist/chunk-74WWN7ZW.js +0 -82
- package/dist/chunk-74WWN7ZW.js.map +0 -1
- package/dist/chunk-A4ACKWIW.js.map +0 -1
- package/dist/chunk-EQINRHYR.js.map +0 -1
- package/dist/chunk-GGD5W7TB.js.map +0 -1
- package/dist/chunk-IBX3VFOM.js.map +0 -1
- package/dist/chunk-KUHRUM6B.js.map +0 -1
- package/dist/chunk-KWBPHZUU.js.map +0 -1
- package/dist/chunk-MCC6KDQF.js.map +0 -1
- package/dist/chunk-NN3LPQ5D.js.map +0 -1
- package/dist/chunk-O4XJUPSF.js.map +0 -1
- package/dist/chunk-S2JJBLJG.js +0 -2101
- package/dist/chunk-S2JJBLJG.js.map +0 -1
- package/dist/chunk-S3IP6R6K.js.map +0 -1
- package/dist/chunk-SRBJUAMP.js.map +0 -1
- package/dist/chunk-VQXK37XA.js.map +0 -1
- package/dist/chunk-VTU2B4VF.js.map +0 -1
- package/dist/chunk-VX2IUQFE.js.map +0 -1
- package/dist/chunk-WGK4VHGP.js.map +0 -1
- package/dist/chunk-Y5KDIOKF.js.map +0 -1
- package/dist/chunk-Z5S5HNGY.js.map +0 -1
- package/dist/chunk-ZTSE2ZJ6.js.map +0 -1
- package/dist/contradiction-scan-3Z6YW7YA.js.map +0 -1
- /package/dist/{capsule-export-LLEVB2RG.js.map → action-confidence.js.map} +0 -0
- /package/dist/{capsule-import-UW45R2MZ.js.map → capsule-export-7QNCBZOQ.js.map} +0 -0
- /package/dist/{engine-FOC3IJLA.js.map → capsule-import-EPBHD2EN.js.map} +0 -0
- /package/dist/{chunk-HJYHRE4S.js.map → chunk-242S3I2A.js.map} +0 -0
- /package/dist/{chunk-EYNQTST2.js.map → chunk-4YM32CRU.js.map} +0 -0
- /package/dist/{chunk-PHNGXFQ6.js.map → chunk-7V22HTMD.js.map} +0 -0
- /package/dist/{chunk-P73JTV34.js.map → chunk-BBE34QBJ.js.map} +0 -0
- /package/dist/{chunk-C5HUWVH2.js.map → chunk-CPKTBRS2.js.map} +0 -0
- /package/dist/{chunk-I6BQZSML.js.map → chunk-DZZPC36E.js.map} +0 -0
- /package/dist/{chunk-4DXC6HQQ.js.map → chunk-FQDPCE3I.js.map} +0 -0
- /package/dist/{chunk-57QNCUEZ.js.map → chunk-HL5LRPNA.js.map} +0 -0
- /package/dist/{chunk-QIGOEM65.js.map → chunk-IB3BFHGN.js.map} +0 -0
- /package/dist/{chunk-RXTFCYQF.js.map → chunk-JESOB2HO.js.map} +0 -0
- /package/dist/{chunk-LIO5X3CM.js.map → chunk-UVMUAWVT.js.map} +0 -0
- /package/dist/{chunk-PB5KW5PL.js.map → chunk-WEJG4TB5.js.map} +0 -0
- /package/dist/{chunk-KBYWQWSB.js.map → chunk-X7HPGUVG.js.map} +0 -0
- /package/dist/{chunk-ZL4S7ARC.js.map → chunk-Y3VMVTYX.js.map} +0 -0
- /package/dist/{chunk-6XA7UN4Z.js.map → chunk-ZNQN6ZTA.js.map} +0 -0
- /package/dist/{chunk-WTFWLUSX.js.map → chunk-ZVTKDVVM.js.map} +0 -0
- /package/dist/{memory-governance-F3QOJGEY.js.map → engine-35M5BKQ7.js.map} +0 -0
|
@@ -2,15 +2,12 @@ import {
|
|
|
2
2
|
CompoundingEngine,
|
|
3
3
|
SharedContextManager,
|
|
4
4
|
defaultTierMigrationCycleBudget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FQDPCE3I.js";
|
|
6
6
|
import {
|
|
7
7
|
applyUtilityPromotionRuntimePolicy,
|
|
8
8
|
applyUtilityRankingRuntimeDelta,
|
|
9
9
|
loadUtilityRuntimeValues
|
|
10
10
|
} from "./chunk-FSFEQI74.js";
|
|
11
|
-
import {
|
|
12
|
-
isValidAsOf
|
|
13
|
-
} from "./chunk-MDYG7VI7.js";
|
|
14
11
|
import {
|
|
15
12
|
TierMigrationExecutor
|
|
16
13
|
} from "./chunk-Z5AAYHUC.js";
|
|
@@ -25,15 +22,36 @@ import {
|
|
|
25
22
|
} from "./chunk-UHGBNIOS.js";
|
|
26
23
|
import {
|
|
27
24
|
HourlySummarizer
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7V22HTMD.js";
|
|
26
|
+
import {
|
|
27
|
+
buildTargetedFactRecallSection,
|
|
28
|
+
shouldRecallTargetedFactEvidence
|
|
29
|
+
} from "./chunk-VWT3F4IV.js";
|
|
29
30
|
import {
|
|
30
31
|
applyTemporalSupersession,
|
|
31
32
|
normalizeSupersessionKey,
|
|
32
33
|
shouldFilterSupersededFromRecall
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OIGNEXKZ.js";
|
|
35
|
+
import {
|
|
36
|
+
isValidAsOf
|
|
37
|
+
} from "./chunk-MDYG7VI7.js";
|
|
34
38
|
import {
|
|
35
39
|
SessionObserverState
|
|
36
40
|
} from "./chunk-JR4ZC3G4.js";
|
|
41
|
+
import {
|
|
42
|
+
applyRuntimeRetrievalPolicy
|
|
43
|
+
} from "./chunk-5IZL4DCV.js";
|
|
44
|
+
import {
|
|
45
|
+
RelevanceStore
|
|
46
|
+
} from "./chunk-5NPGSAVB.js";
|
|
47
|
+
import {
|
|
48
|
+
RerankCache,
|
|
49
|
+
rerankLocalOrNoop
|
|
50
|
+
} from "./chunk-C7VW7C3F.js";
|
|
51
|
+
import {
|
|
52
|
+
buildResponseGuidanceRecallSection,
|
|
53
|
+
shouldRecallResponseGuidance
|
|
54
|
+
} from "./chunk-OZKZ2TRP.js";
|
|
37
55
|
import {
|
|
38
56
|
mergeWithAgentResults,
|
|
39
57
|
runDirectAgent,
|
|
@@ -53,63 +71,66 @@ import {
|
|
|
53
71
|
resolvePromptTagPrefilterAsync
|
|
54
72
|
} from "./chunk-V3RXWQIE.js";
|
|
55
73
|
import {
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
LastRecallStore,
|
|
75
|
+
TierMigrationStatusStore,
|
|
76
|
+
clampGraphRecallExpandedEntries
|
|
77
|
+
} from "./chunk-WPGJYVUH.js";
|
|
58
78
|
import {
|
|
59
79
|
findUnresolvedEntityRefs
|
|
60
80
|
} from "./chunk-X7XN6YU4.js";
|
|
61
81
|
import {
|
|
62
|
-
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import {
|
|
65
|
-
RerankCache,
|
|
66
|
-
rerankLocalOrNoop
|
|
67
|
-
} from "./chunk-C7VW7C3F.js";
|
|
82
|
+
applyReasoningTraceBoost
|
|
83
|
+
} from "./chunk-ZZTOURJI.js";
|
|
68
84
|
import {
|
|
69
85
|
reorderRecallResultsWithMmr
|
|
70
86
|
} from "./chunk-YDBIWGNI.js";
|
|
71
87
|
import {
|
|
72
88
|
createRecallSectionMetricRecorder
|
|
73
89
|
} from "./chunk-7DHTMOND.js";
|
|
74
|
-
import {
|
|
75
|
-
LastRecallStore,
|
|
76
|
-
TierMigrationStatusStore,
|
|
77
|
-
clampGraphRecallExpandedEntries
|
|
78
|
-
} from "./chunk-WPGJYVUH.js";
|
|
79
90
|
import {
|
|
80
91
|
buildQmdRecallCacheKey,
|
|
81
92
|
getCachedQmdRecall,
|
|
82
93
|
setCachedQmdRecall
|
|
83
94
|
} from "./chunk-YCN4BVDK.js";
|
|
84
|
-
import {
|
|
85
|
-
applyReasoningTraceBoost
|
|
86
|
-
} from "./chunk-ZZTOURJI.js";
|
|
87
95
|
import {
|
|
88
96
|
NegativeExampleStore
|
|
89
97
|
} from "./chunk-D654IBA6.js";
|
|
90
|
-
import {
|
|
91
|
-
evaluateMemoryActionPolicy
|
|
92
|
-
} from "./chunk-H63EDPFJ.js";
|
|
93
98
|
import {
|
|
94
99
|
applyMemoryWorthFilter,
|
|
95
100
|
buildMemoryWorthCounterMap
|
|
96
101
|
} from "./chunk-3GPTTA4J.js";
|
|
102
|
+
import {
|
|
103
|
+
runLiveConnectorsOnce
|
|
104
|
+
} from "./chunk-XMVFHBHT.js";
|
|
105
|
+
import {
|
|
106
|
+
evaluateMemoryActionPolicy
|
|
107
|
+
} from "./chunk-H63EDPFJ.js";
|
|
97
108
|
import {
|
|
98
109
|
hasBroadGraphIntent,
|
|
99
110
|
inferIntentFromText,
|
|
100
111
|
intentCompatibilityScore,
|
|
101
112
|
isTaskInitiationIntent,
|
|
102
113
|
planRecallMode
|
|
103
|
-
} from "./chunk-
|
|
104
|
-
import {
|
|
105
|
-
runLiveConnectorsOnce
|
|
106
|
-
} from "./chunk-XMVFHBHT.js";
|
|
114
|
+
} from "./chunk-PD6O7AXF.js";
|
|
107
115
|
import {
|
|
108
116
|
classifyMemoryKind
|
|
109
117
|
} from "./chunk-YAZNBMNF.js";
|
|
118
|
+
import {
|
|
119
|
+
recordJudgeTrainingPair
|
|
120
|
+
} from "./chunk-DF3RVK3X.js";
|
|
121
|
+
import {
|
|
122
|
+
createDeferCountMap,
|
|
123
|
+
createVerdictCache,
|
|
124
|
+
getVerdictKind,
|
|
125
|
+
judgeFactDurability,
|
|
126
|
+
validateProcedureExtraction
|
|
127
|
+
} from "./chunk-C4SQJZAF.js";
|
|
110
128
|
import {
|
|
111
129
|
ExtractionEngine
|
|
112
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-ZG7PTKBK.js";
|
|
131
|
+
import {
|
|
132
|
+
looksLikeMechanicalTelemetryTranscript
|
|
133
|
+
} from "./chunk-4RA3C3EV.js";
|
|
113
134
|
import {
|
|
114
135
|
parseMemoryActionEligibilityContext
|
|
115
136
|
} from "./chunk-WW3QQF4H.js";
|
|
@@ -118,59 +139,73 @@ import {
|
|
|
118
139
|
} from "./chunk-QR3C7BKQ.js";
|
|
119
140
|
import {
|
|
120
141
|
LocalLlmClient
|
|
121
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-HELQZFZO.js";
|
|
122
143
|
import {
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
buildFocusedListRecallSection,
|
|
145
|
+
shouldRecallFocusedListEvidence
|
|
146
|
+
} from "./chunk-DB5A3NHS.js";
|
|
125
147
|
import {
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
buildEntityRecallSection,
|
|
149
|
+
entityRecentTranscriptLookbackHours,
|
|
150
|
+
readRecentEntityTranscriptEntries
|
|
151
|
+
} from "./chunk-UVMUAWVT.js";
|
|
128
152
|
import {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
} from "./chunk-
|
|
153
|
+
buildEventOrderRecallSection,
|
|
154
|
+
shouldRecallEventOrderEvidence
|
|
155
|
+
} from "./chunk-6NKAQ74D.js";
|
|
156
|
+
import {
|
|
157
|
+
buildExplicitCueRecallSection
|
|
158
|
+
} from "./chunk-OAZ5MFUB.js";
|
|
135
159
|
import {
|
|
136
160
|
formatDaySummaryMemories
|
|
137
161
|
} from "./chunk-3IQ2TR4N.js";
|
|
138
162
|
import {
|
|
139
163
|
tryDirectAnswer
|
|
140
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-5NXIJZFX.js";
|
|
141
165
|
import {
|
|
142
166
|
EmbeddingFallback
|
|
143
167
|
} from "./chunk-Z2E7VW55.js";
|
|
144
168
|
import {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
readRecentEntityTranscriptEntries
|
|
148
|
-
} from "./chunk-LIO5X3CM.js";
|
|
169
|
+
CODEX_THREAD_KEY_PREFIX
|
|
170
|
+
} from "./chunk-3PG3H5TD.js";
|
|
149
171
|
import {
|
|
150
172
|
buildCompressionGuidelinesMarkdown,
|
|
151
173
|
computeCompressionGuidelineCandidate,
|
|
152
174
|
refineCompressionGuidelineCandidateSemantically,
|
|
153
175
|
renderCompressionGuidelinesMarkdown
|
|
154
176
|
} from "./chunk-2NMMFZ5T.js";
|
|
177
|
+
import {
|
|
178
|
+
buildConsolidationPrompt,
|
|
179
|
+
buildExtensionsBlockForConsolidation,
|
|
180
|
+
buildOperatorAwareConsolidationPrompt,
|
|
181
|
+
chooseConsolidationOperator,
|
|
182
|
+
findSimilarClusters,
|
|
183
|
+
materializeAfterSemanticConsolidation,
|
|
184
|
+
parseConsolidationResponse,
|
|
185
|
+
parseOperatorAwareConsolidationResponse
|
|
186
|
+
} from "./chunk-CPKTBRS2.js";
|
|
155
187
|
import {
|
|
156
188
|
RoutingRulesStore,
|
|
157
189
|
normalizeReplaySessionKey
|
|
158
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-FMEBPEAO.js";
|
|
159
191
|
import {
|
|
160
192
|
searchVerifiedEpisodes
|
|
161
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-JESOB2HO.js";
|
|
162
194
|
import {
|
|
163
195
|
ThreadingManager
|
|
164
196
|
} from "./chunk-JRNQ3RNA.js";
|
|
165
197
|
import {
|
|
166
198
|
searchVerifiedSemanticRules
|
|
167
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-WEJG4TB5.js";
|
|
168
200
|
import {
|
|
169
201
|
searchWorkProductLedgerEntries
|
|
170
202
|
} from "./chunk-CULXMQJH.js";
|
|
171
203
|
import {
|
|
172
204
|
TranscriptManager
|
|
173
205
|
} from "./chunk-E6K4NIEU.js";
|
|
206
|
+
import {
|
|
207
|
+
PolicyRuntimeManager
|
|
208
|
+
} from "./chunk-EABGC2TL.js";
|
|
174
209
|
import {
|
|
175
210
|
NamespaceSearchRouter,
|
|
176
211
|
NamespaceStorageRouter,
|
|
@@ -178,20 +213,22 @@ import {
|
|
|
178
213
|
createConversationIndexRuntime,
|
|
179
214
|
createSearchBackend,
|
|
180
215
|
writeConversationChunks
|
|
181
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-HL5LRPNA.js";
|
|
182
217
|
import {
|
|
183
218
|
parseQmdExplain
|
|
184
219
|
} from "./chunk-P77UEOU2.js";
|
|
185
220
|
import {
|
|
186
|
-
|
|
187
|
-
|
|
221
|
+
isAboveImportanceThreshold,
|
|
222
|
+
scoreImportance
|
|
223
|
+
} from "./chunk-JXS5PDQ7.js";
|
|
188
224
|
import {
|
|
189
225
|
searchHarmonicRetrieval
|
|
190
226
|
} from "./chunk-HMDCOMYU.js";
|
|
191
227
|
import {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
228
|
+
collectNativeKnowledgeChunks,
|
|
229
|
+
formatNativeKnowledgeSection,
|
|
230
|
+
searchNativeKnowledge
|
|
231
|
+
} from "./chunk-7SEAZFFB.js";
|
|
195
232
|
import {
|
|
196
233
|
recordEvalShadowRecall
|
|
197
234
|
} from "./chunk-K6WK37A6.js";
|
|
@@ -199,17 +236,9 @@ import {
|
|
|
199
236
|
EXTRACTION_JUDGE_VERDICT_CATEGORY,
|
|
200
237
|
recordJudgeVerdict
|
|
201
238
|
} from "./chunk-AJU4PJGY.js";
|
|
202
|
-
import {
|
|
203
|
-
collectNativeKnowledgeChunks,
|
|
204
|
-
formatNativeKnowledgeSection,
|
|
205
|
-
searchNativeKnowledge
|
|
206
|
-
} from "./chunk-7SEAZFFB.js";
|
|
207
239
|
import {
|
|
208
240
|
applyCommitmentLedgerLifecycle
|
|
209
241
|
} from "./chunk-FYIYMQ5N.js";
|
|
210
|
-
import {
|
|
211
|
-
CODEX_THREAD_KEY_PREFIX
|
|
212
|
-
} from "./chunk-3PG3H5TD.js";
|
|
213
242
|
import {
|
|
214
243
|
semanticChunkContent
|
|
215
244
|
} from "./chunk-KVE7R4CG.js";
|
|
@@ -219,19 +248,9 @@ import {
|
|
|
219
248
|
import {
|
|
220
249
|
SmartBuffer
|
|
221
250
|
} from "./chunk-JBMSGZEQ.js";
|
|
222
|
-
import {
|
|
223
|
-
buildConsolidationPrompt,
|
|
224
|
-
buildExtensionsBlockForConsolidation,
|
|
225
|
-
buildOperatorAwareConsolidationPrompt,
|
|
226
|
-
chooseConsolidationOperator,
|
|
227
|
-
findSimilarClusters,
|
|
228
|
-
materializeAfterSemanticConsolidation,
|
|
229
|
-
parseConsolidationResponse,
|
|
230
|
-
parseOperatorAwareConsolidationResponse
|
|
231
|
-
} from "./chunk-C5HUWVH2.js";
|
|
232
251
|
import {
|
|
233
252
|
FallbackLlmClient
|
|
234
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-AQJNPMOA.js";
|
|
235
254
|
import {
|
|
236
255
|
buildRecallQueryPolicy
|
|
237
256
|
} from "./chunk-6HZ6AO2P.js";
|
|
@@ -260,13 +279,13 @@ import {
|
|
|
260
279
|
import {
|
|
261
280
|
listTrustZoneRecords,
|
|
262
281
|
searchTrustZoneRecords
|
|
263
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-QDZ2RLEC.js";
|
|
264
283
|
import {
|
|
265
284
|
buildXraySnapshot
|
|
266
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-JKDVIE52.js";
|
|
267
286
|
import {
|
|
268
287
|
parseMessageParts
|
|
269
|
-
} from "./chunk-
|
|
288
|
+
} from "./chunk-D4GAOFF6.js";
|
|
270
289
|
import {
|
|
271
290
|
objectiveStateStoreOverrideForNamespace,
|
|
272
291
|
searchObjectiveStateSnapshots
|
|
@@ -277,31 +296,21 @@ import {
|
|
|
277
296
|
import {
|
|
278
297
|
launchProcessSync
|
|
279
298
|
} from "./chunk-OR64ZGRZ.js";
|
|
299
|
+
import {
|
|
300
|
+
buildProcedurePersistBody
|
|
301
|
+
} from "./chunk-QDW3E4RD.js";
|
|
280
302
|
import {
|
|
281
303
|
shouldSkipImplicitExtraction
|
|
282
304
|
} from "./chunk-GVPWB7EY.js";
|
|
283
305
|
import {
|
|
284
306
|
selectRouteRule
|
|
285
307
|
} from "./chunk-2LGMW3DJ.js";
|
|
286
|
-
import {
|
|
287
|
-
buildProcedurePersistBody
|
|
288
|
-
} from "./chunk-QDW3E4RD.js";
|
|
289
308
|
import {
|
|
290
309
|
GraphIndex
|
|
291
310
|
} from "./chunk-RK2Y4XOM.js";
|
|
292
311
|
import {
|
|
293
312
|
searchCausalTrajectories
|
|
294
313
|
} from "./chunk-G2WADRQ3.js";
|
|
295
|
-
import {
|
|
296
|
-
canReadNamespace,
|
|
297
|
-
defaultNamespaceForPrincipal,
|
|
298
|
-
recallNamespacesForPrincipal,
|
|
299
|
-
resolvePrincipal
|
|
300
|
-
} from "./chunk-N5AKDXAI.js";
|
|
301
|
-
import {
|
|
302
|
-
decideLifecycleTransition,
|
|
303
|
-
resolveLifecycleState
|
|
304
|
-
} from "./chunk-TBBDFYXW.js";
|
|
305
314
|
import {
|
|
306
315
|
ContentHashIndex,
|
|
307
316
|
StorageManager,
|
|
@@ -309,8 +318,9 @@ import {
|
|
|
309
318
|
fingerprintEntityStructuredFacts,
|
|
310
319
|
normalizeAttributePairs,
|
|
311
320
|
normalizeEntityName,
|
|
312
|
-
parseEntityFile
|
|
313
|
-
|
|
321
|
+
parseEntityFile,
|
|
322
|
+
parseFlexibleIsoTimestamp
|
|
323
|
+
} from "./chunk-3B6KIRBH.js";
|
|
314
324
|
import {
|
|
315
325
|
attachCitation,
|
|
316
326
|
hasCitationForTemplate,
|
|
@@ -318,13 +328,13 @@ import {
|
|
|
318
328
|
} from "./chunk-NN2DKE4T.js";
|
|
319
329
|
import {
|
|
320
330
|
confidenceTier
|
|
321
|
-
} from "./chunk-
|
|
322
|
-
import {
|
|
323
|
-
isActiveMemoryStatus
|
|
324
|
-
} from "./chunk-RULE4VG5.js";
|
|
331
|
+
} from "./chunk-23ZZK64Y.js";
|
|
325
332
|
import {
|
|
326
333
|
openBetterSqlite3
|
|
327
334
|
} from "./chunk-XJKFSSDW.js";
|
|
335
|
+
import {
|
|
336
|
+
isActiveMemoryStatus
|
|
337
|
+
} from "./chunk-RULE4VG5.js";
|
|
328
338
|
import {
|
|
329
339
|
lintWorkspaceFiles,
|
|
330
340
|
rotateMarkdownFileToArchive
|
|
@@ -335,6 +345,16 @@ import {
|
|
|
335
345
|
import {
|
|
336
346
|
resolveHomeDir
|
|
337
347
|
} from "./chunk-MARWOCVP.js";
|
|
348
|
+
import {
|
|
349
|
+
canReadNamespace,
|
|
350
|
+
defaultNamespaceForPrincipal,
|
|
351
|
+
recallNamespacesForPrincipal,
|
|
352
|
+
resolvePrincipal
|
|
353
|
+
} from "./chunk-N5AKDXAI.js";
|
|
354
|
+
import {
|
|
355
|
+
decideLifecycleTransition,
|
|
356
|
+
resolveLifecycleState
|
|
357
|
+
} from "./chunk-TBBDFYXW.js";
|
|
338
358
|
import {
|
|
339
359
|
log
|
|
340
360
|
} from "./chunk-2ODBA7MQ.js";
|
|
@@ -342,6 +362,9 @@ import {
|
|
|
342
362
|
keyring_exports,
|
|
343
363
|
secureStoreDir
|
|
344
364
|
} from "./chunk-BJMBJZ2Y.js";
|
|
365
|
+
import {
|
|
366
|
+
buildRetrievedMemoryProvenance
|
|
367
|
+
} from "./chunk-AC5LO7IU.js";
|
|
345
368
|
|
|
346
369
|
// src/orchestrator.ts
|
|
347
370
|
import path6 from "path";
|
|
@@ -2413,6 +2436,15 @@ var LcmSummarizer = class {
|
|
|
2413
2436
|
* 2 = Deterministic truncation (no LLM)
|
|
2414
2437
|
*/
|
|
2415
2438
|
async summarizeWithEscalation(text, targetTokens) {
|
|
2439
|
+
if (this.config.telemetryPrefilterEnabled && looksLikeMechanicalTelemetryTranscript(text)) {
|
|
2440
|
+
return {
|
|
2441
|
+
text: deterministicTruncate(
|
|
2442
|
+
text,
|
|
2443
|
+
Math.min(targetTokens, this.config.deterministicMaxTokens)
|
|
2444
|
+
),
|
|
2445
|
+
escalation: 2
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2416
2448
|
try {
|
|
2417
2449
|
const result = await this.summarizeFn(text, targetTokens, false);
|
|
2418
2450
|
if (result && estimateTokens(result) <= targetTokens * 1.5) {
|
|
@@ -2668,6 +2700,8 @@ function extractLcmConfig(cfg) {
|
|
|
2668
2700
|
deterministicMaxTokens: cfg.lcmDeterministicMaxTokens ?? 512,
|
|
2669
2701
|
archiveRetentionDays: cfg.lcmArchiveRetentionDays ?? 90,
|
|
2670
2702
|
recallBudgetShare: cfg.lcmRecallBudgetShare ?? 0.15,
|
|
2703
|
+
observeConcurrency: typeof cfg.lcmObserveConcurrency === "number" && Number.isFinite(cfg.lcmObserveConcurrency) ? Math.max(1, Math.floor(cfg.lcmObserveConcurrency)) : 1,
|
|
2704
|
+
telemetryPrefilterEnabled: cfg.lcmTelemetryPrefilterEnabled !== false,
|
|
2671
2705
|
messagePartsEnabled: cfg.messagePartsEnabled === true,
|
|
2672
2706
|
messagePartsRecallMaxResults: typeof cfg.messagePartsRecallMaxResults === "number" ? Math.max(0, Math.floor(cfg.messagePartsRecallMaxResults)) : 6
|
|
2673
2707
|
};
|
|
@@ -2721,11 +2755,12 @@ var LcmEngine = class {
|
|
|
2721
2755
|
leafBatchSize: this.config.leafBatchSize,
|
|
2722
2756
|
rollupFanIn: this.config.rollupFanIn,
|
|
2723
2757
|
maxDepth: this.config.maxDepth,
|
|
2724
|
-
deterministicMaxTokens: this.config.deterministicMaxTokens
|
|
2758
|
+
deterministicMaxTokens: this.config.deterministicMaxTokens,
|
|
2759
|
+
telemetryPrefilterEnabled: this.config.telemetryPrefilterEnabled
|
|
2725
2760
|
}
|
|
2726
2761
|
);
|
|
2727
2762
|
const observeQueue = new LcmWorkQueue({
|
|
2728
|
-
concurrency:
|
|
2763
|
+
concurrency: this.config.observeConcurrency,
|
|
2729
2764
|
worker: async (sessionId, messages) => {
|
|
2730
2765
|
await this.processObserveMessages(sessionId, messages);
|
|
2731
2766
|
},
|
|
@@ -3389,6 +3424,102 @@ function sanitizeSessionKeyForFilename(sessionKey) {
|
|
|
3389
3424
|
const hash = createHash2("sha256").update(sessionKey).digest("hex").slice(0, 12);
|
|
3390
3425
|
return `${readable}-${hash}`;
|
|
3391
3426
|
}
|
|
3427
|
+
function latestSourceValidAtFromTurns(turns) {
|
|
3428
|
+
let latestMs = null;
|
|
3429
|
+
for (const turn of turns) {
|
|
3430
|
+
if (turn.extractionContextOnly === true) continue;
|
|
3431
|
+
if (typeof turn.sourceValidAt !== "string") continue;
|
|
3432
|
+
const parsed = parseFlexibleIsoTimestamp(turn.sourceValidAt.trim());
|
|
3433
|
+
if (parsed === null) continue;
|
|
3434
|
+
if (latestMs === null || parsed > latestMs) {
|
|
3435
|
+
latestMs = parsed;
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
return latestMs === null ? void 0 : new Date(latestMs).toISOString();
|
|
3439
|
+
}
|
|
3440
|
+
function sourceValidAtMs(turn) {
|
|
3441
|
+
if (typeof turn.sourceValidAt !== "string") return null;
|
|
3442
|
+
return parseFlexibleIsoTimestamp(turn.sourceValidAt.trim());
|
|
3443
|
+
}
|
|
3444
|
+
var SOURCE_VALID_AT_CONTEXT_TURNS = 2;
|
|
3445
|
+
function sourceValidAtSliceKey(turn, index) {
|
|
3446
|
+
const validAtMs = sourceValidAtMs(turn);
|
|
3447
|
+
return validAtMs === null ? `unknown:${index}` : String(validAtMs);
|
|
3448
|
+
}
|
|
3449
|
+
function asExtractionContextTurn(turn) {
|
|
3450
|
+
return { ...turn, extractionContextOnly: true };
|
|
3451
|
+
}
|
|
3452
|
+
function asExtractionTargetTurn(turn) {
|
|
3453
|
+
const { extractionContextOnly: _contextOnly, ...targetTurn } = turn;
|
|
3454
|
+
return targetTurn;
|
|
3455
|
+
}
|
|
3456
|
+
function sourceValidAtContextTurns(turns, targetStart, targetEnd, targetValidAtMs) {
|
|
3457
|
+
if (targetValidAtMs === null) return [];
|
|
3458
|
+
return turns.flatMap((turn, index) => {
|
|
3459
|
+
if (index >= targetStart && index < targetEnd) return [];
|
|
3460
|
+
const contextValidAtMs = sourceValidAtMs(turn);
|
|
3461
|
+
if (contextValidAtMs === null || contextValidAtMs > targetValidAtMs) {
|
|
3462
|
+
return [];
|
|
3463
|
+
}
|
|
3464
|
+
return [{ turn, index, validAtMs: contextValidAtMs }];
|
|
3465
|
+
}).sort((a, b) => {
|
|
3466
|
+
if (a.validAtMs < b.validAtMs) return -1;
|
|
3467
|
+
if (a.validAtMs > b.validAtMs) return 1;
|
|
3468
|
+
if (a.index === b.index) return 0;
|
|
3469
|
+
return a.index < b.index ? -1 : 1;
|
|
3470
|
+
}).slice(-SOURCE_VALID_AT_CONTEXT_TURNS).map(({ turn }) => asExtractionContextTurn(turn));
|
|
3471
|
+
}
|
|
3472
|
+
function targetSourceValidAtSortMs(turns) {
|
|
3473
|
+
let latestMs = null;
|
|
3474
|
+
for (const turn of turns) {
|
|
3475
|
+
if (turn.extractionContextOnly === true) continue;
|
|
3476
|
+
const validAtMs = sourceValidAtMs(turn);
|
|
3477
|
+
if (validAtMs === null) continue;
|
|
3478
|
+
if (latestMs === null || validAtMs > latestMs) {
|
|
3479
|
+
latestMs = validAtMs;
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
return latestMs ?? Number.POSITIVE_INFINITY;
|
|
3483
|
+
}
|
|
3484
|
+
function sortSourceValidAtSlicesChronologically(slices) {
|
|
3485
|
+
return slices.map((turns, order) => ({
|
|
3486
|
+
turns,
|
|
3487
|
+
order,
|
|
3488
|
+
targetValidAtMs: targetSourceValidAtSortMs(turns)
|
|
3489
|
+
})).sort((a, b) => {
|
|
3490
|
+
if (a.targetValidAtMs < b.targetValidAtMs) return -1;
|
|
3491
|
+
if (a.targetValidAtMs > b.targetValidAtMs) return 1;
|
|
3492
|
+
if (a.order === b.order) return 0;
|
|
3493
|
+
return a.order < b.order ? -1 : 1;
|
|
3494
|
+
}).map((slice) => slice.turns);
|
|
3495
|
+
}
|
|
3496
|
+
function splitTurnsBySourceValidAt(turns) {
|
|
3497
|
+
if (turns.length === 0) return [];
|
|
3498
|
+
if (!turns.some((turn) => sourceValidAtMs(turn) !== null)) {
|
|
3499
|
+
return [[...turns]];
|
|
3500
|
+
}
|
|
3501
|
+
const slices = [];
|
|
3502
|
+
let start = 0;
|
|
3503
|
+
while (start < turns.length) {
|
|
3504
|
+
const targetValidAtMs = sourceValidAtMs(turns[start]);
|
|
3505
|
+
const activeKey = sourceValidAtSliceKey(turns[start], start);
|
|
3506
|
+
let end = start + 1;
|
|
3507
|
+
while (end < turns.length && sourceValidAtSliceKey(turns[end], end) === activeKey) {
|
|
3508
|
+
end += 1;
|
|
3509
|
+
}
|
|
3510
|
+
slices.push([
|
|
3511
|
+
...sourceValidAtContextTurns(
|
|
3512
|
+
turns,
|
|
3513
|
+
start,
|
|
3514
|
+
end,
|
|
3515
|
+
targetValidAtMs
|
|
3516
|
+
),
|
|
3517
|
+
...turns.slice(start, end).map(asExtractionTargetTurn)
|
|
3518
|
+
]);
|
|
3519
|
+
start = end;
|
|
3520
|
+
}
|
|
3521
|
+
return sortSourceValidAtSlicesChronologically(slices);
|
|
3522
|
+
}
|
|
3392
3523
|
function isArtifactMemoryPath(filePath) {
|
|
3393
3524
|
return /(?:^|[\\/])artifacts(?:[\\/]|$)/i.test(filePath);
|
|
3394
3525
|
}
|
|
@@ -4439,7 +4570,10 @@ var Orchestrator = class _Orchestrator {
|
|
|
4439
4570
|
);
|
|
4440
4571
|
return result2 ? { content: result2.content } : null;
|
|
4441
4572
|
}
|
|
4442
|
-
const result = await this.fastLlm.chatCompletion(messages,
|
|
4573
|
+
const result = await this.fastLlm.chatCompletion(messages, {
|
|
4574
|
+
...options,
|
|
4575
|
+
forceDisableThinking: true
|
|
4576
|
+
});
|
|
4443
4577
|
return result ? { content: result.content } : null;
|
|
4444
4578
|
}
|
|
4445
4579
|
/**
|
|
@@ -4453,7 +4587,12 @@ var Orchestrator = class _Orchestrator {
|
|
|
4453
4587
|
chatCompletion: (messages, options) => this.fastChatCompletion(messages, options ?? {})
|
|
4454
4588
|
};
|
|
4455
4589
|
}
|
|
4456
|
-
return
|
|
4590
|
+
return {
|
|
4591
|
+
chatCompletion: (messages, options) => this.fastLlm.chatCompletion(messages, {
|
|
4592
|
+
...options ?? {},
|
|
4593
|
+
forceDisableThinking: true
|
|
4594
|
+
})
|
|
4595
|
+
};
|
|
4457
4596
|
}
|
|
4458
4597
|
async initialize() {
|
|
4459
4598
|
this.deferredReady = new Promise((resolve) => {
|
|
@@ -5148,7 +5287,7 @@ ${doc.content}` : doc.content,
|
|
|
5148
5287
|
}
|
|
5149
5288
|
async runDeepSleepGovernanceNow(options) {
|
|
5150
5289
|
const targetStorage = options?.storage ?? this.storage;
|
|
5151
|
-
const { runMemoryGovernance } = await import("./memory-governance-
|
|
5290
|
+
const { runMemoryGovernance } = await import("./memory-governance-IMPQZXFC.js");
|
|
5152
5291
|
const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-LR2NBAZE.js");
|
|
5153
5292
|
const govResult = await runMemoryGovernance({
|
|
5154
5293
|
memoryDir: targetStorage.dir,
|
|
@@ -5250,7 +5389,8 @@ ${doc.content}` : doc.content,
|
|
|
5250
5389
|
operation: "semantic-consolidation",
|
|
5251
5390
|
maxTokens: llmOpts.maxTokens,
|
|
5252
5391
|
temperature: llmOpts.temperature,
|
|
5253
|
-
priority: "background"
|
|
5392
|
+
priority: "background",
|
|
5393
|
+
forceDisableThinking: true
|
|
5254
5394
|
});
|
|
5255
5395
|
response = fastResult ? { content: fastResult.content } : null;
|
|
5256
5396
|
} else {
|
|
@@ -7012,6 +7152,11 @@ ${r.snippet.trim()}
|
|
|
7012
7152
|
if (!entry) return defaultEnabled;
|
|
7013
7153
|
return entry.enabled !== false;
|
|
7014
7154
|
}
|
|
7155
|
+
isSpecializedRecallSectionEnabled(sectionId, topLevelEnabled) {
|
|
7156
|
+
const entry = this.getRecallSectionEntry(sectionId);
|
|
7157
|
+
if (!entry) return topLevelEnabled;
|
|
7158
|
+
return entry.enabled === true || topLevelEnabled && entry.enabled !== false;
|
|
7159
|
+
}
|
|
7015
7160
|
getRecallSectionMaxChars(sectionId) {
|
|
7016
7161
|
const entry = this.getRecallSectionEntry(sectionId);
|
|
7017
7162
|
if (!entry) return void 0;
|
|
@@ -9087,6 +9232,114 @@ ${formatted}`;
|
|
|
9087
9232
|
log.debug(`Explicit cue recall assembly error: ${err}`);
|
|
9088
9233
|
}
|
|
9089
9234
|
}
|
|
9235
|
+
const targetedFactMaxChars = this.getRecallSectionMaxChars("targeted-facts") ?? this.config.targetedFactRecallMaxChars;
|
|
9236
|
+
if (this.isSpecializedRecallSectionEnabled(
|
|
9237
|
+
"targeted-facts",
|
|
9238
|
+
this.config.targetedFactRecallEnabled
|
|
9239
|
+
) && targetedFactMaxChars !== 0 && this.lcmEngine?.enabled && recallMode !== "no_recall" && shouldRecallTargetedFactEvidence(retrievalQuery)) {
|
|
9240
|
+
try {
|
|
9241
|
+
const targetedFactSection = await buildTargetedFactRecallSection({
|
|
9242
|
+
engine: this.lcmEngine,
|
|
9243
|
+
sessionId: sessionKey,
|
|
9244
|
+
query: retrievalQuery,
|
|
9245
|
+
maxChars: targetedFactMaxChars,
|
|
9246
|
+
maxSearchResults: this.getRecallSectionNumber("targeted-facts", "maxResults") ?? this.config.targetedFactRecallMaxResults,
|
|
9247
|
+
maxScanWindowTurns: this.getRecallSectionNumber("targeted-facts", "maxTurns") ?? this.config.targetedFactRecallScanWindowTurns,
|
|
9248
|
+
maxScanWindowTokens: this.getRecallSectionNumber("targeted-facts", "maxTokens") ?? this.config.targetedFactRecallScanWindowTokens
|
|
9249
|
+
});
|
|
9250
|
+
if (targetedFactSection) {
|
|
9251
|
+
this.appendRecallSection(
|
|
9252
|
+
sectionBuckets,
|
|
9253
|
+
"targeted-facts",
|
|
9254
|
+
targetedFactSection
|
|
9255
|
+
);
|
|
9256
|
+
}
|
|
9257
|
+
} catch (err) {
|
|
9258
|
+
log.debug(`Targeted fact recall assembly error: ${err}`);
|
|
9259
|
+
}
|
|
9260
|
+
}
|
|
9261
|
+
const focusedListMaxChars = this.getRecallSectionMaxChars("focused-list") ?? this.config.focusedListRecallMaxChars;
|
|
9262
|
+
if (this.isSpecializedRecallSectionEnabled(
|
|
9263
|
+
"focused-list",
|
|
9264
|
+
this.config.focusedListRecallEnabled
|
|
9265
|
+
) && focusedListMaxChars !== 0 && this.lcmEngine?.enabled && recallMode !== "no_recall" && shouldRecallFocusedListEvidence(retrievalQuery)) {
|
|
9266
|
+
try {
|
|
9267
|
+
const focusedListSection = await buildFocusedListRecallSection({
|
|
9268
|
+
engine: this.lcmEngine,
|
|
9269
|
+
sessionId: sessionKey,
|
|
9270
|
+
query: retrievalQuery,
|
|
9271
|
+
maxChars: focusedListMaxChars,
|
|
9272
|
+
maxSearchResults: this.getRecallSectionNumber("focused-list", "maxResults") ?? this.config.focusedListRecallMaxResults,
|
|
9273
|
+
maxScanWindowTurns: this.getRecallSectionNumber("focused-list", "maxTurns") ?? this.config.focusedListRecallScanWindowTurns,
|
|
9274
|
+
maxScanWindowTokens: this.getRecallSectionNumber("focused-list", "maxTokens") ?? this.config.focusedListRecallScanWindowTokens
|
|
9275
|
+
});
|
|
9276
|
+
if (focusedListSection) {
|
|
9277
|
+
this.appendRecallSection(
|
|
9278
|
+
sectionBuckets,
|
|
9279
|
+
"focused-list",
|
|
9280
|
+
focusedListSection
|
|
9281
|
+
);
|
|
9282
|
+
}
|
|
9283
|
+
} catch (err) {
|
|
9284
|
+
log.debug(`Focused list recall assembly error: ${err}`);
|
|
9285
|
+
}
|
|
9286
|
+
}
|
|
9287
|
+
const responseGuidanceMaxChars = this.getRecallSectionMaxChars("response-guidance") ?? this.config.responseGuidanceRecallMaxChars;
|
|
9288
|
+
const responseGuidanceEntry = this.getRecallSectionEntry("response-guidance");
|
|
9289
|
+
const responseGuidanceMatchesQuery = shouldRecallResponseGuidance(retrievalQuery);
|
|
9290
|
+
const responseGuidanceForcedByPipeline = responseGuidanceEntry?.forceGeneric === true && !responseGuidanceMatchesQuery;
|
|
9291
|
+
if (this.isSpecializedRecallSectionEnabled(
|
|
9292
|
+
"response-guidance",
|
|
9293
|
+
this.config.responseGuidanceRecallEnabled
|
|
9294
|
+
) && responseGuidanceMaxChars !== 0 && this.lcmEngine?.enabled && recallMode !== "no_recall" && (responseGuidanceMatchesQuery || responseGuidanceForcedByPipeline)) {
|
|
9295
|
+
try {
|
|
9296
|
+
const responseGuidanceSection = await buildResponseGuidanceRecallSection({
|
|
9297
|
+
engine: this.lcmEngine,
|
|
9298
|
+
sessionId: sessionKey,
|
|
9299
|
+
query: retrievalQuery,
|
|
9300
|
+
maxChars: responseGuidanceMaxChars,
|
|
9301
|
+
maxSearchResults: this.getRecallSectionNumber("response-guidance", "maxResults") ?? this.config.responseGuidanceRecallMaxResults,
|
|
9302
|
+
maxScanWindowTurns: this.getRecallSectionNumber("response-guidance", "maxTurns") ?? this.config.responseGuidanceRecallScanWindowTurns,
|
|
9303
|
+
maxScanWindowTokens: this.getRecallSectionNumber("response-guidance", "maxTokens") ?? this.config.responseGuidanceRecallScanWindowTokens,
|
|
9304
|
+
forceGeneric: responseGuidanceForcedByPipeline
|
|
9305
|
+
});
|
|
9306
|
+
if (responseGuidanceSection) {
|
|
9307
|
+
this.appendRecallSection(
|
|
9308
|
+
sectionBuckets,
|
|
9309
|
+
"response-guidance",
|
|
9310
|
+
responseGuidanceSection
|
|
9311
|
+
);
|
|
9312
|
+
}
|
|
9313
|
+
} catch (err) {
|
|
9314
|
+
log.debug(`Response guidance recall assembly error: ${err}`);
|
|
9315
|
+
}
|
|
9316
|
+
}
|
|
9317
|
+
const eventOrderMaxChars = this.getRecallSectionMaxChars("event-order") ?? this.config.eventOrderRecallMaxChars;
|
|
9318
|
+
if (this.isSpecializedRecallSectionEnabled(
|
|
9319
|
+
"event-order",
|
|
9320
|
+
this.config.eventOrderRecallEnabled
|
|
9321
|
+
) && eventOrderMaxChars !== 0 && this.lcmEngine?.enabled && recallMode !== "no_recall" && shouldRecallEventOrderEvidence(retrievalQuery)) {
|
|
9322
|
+
try {
|
|
9323
|
+
const eventOrderSection = await buildEventOrderRecallSection({
|
|
9324
|
+
engine: this.lcmEngine,
|
|
9325
|
+
sessionId: sessionKey,
|
|
9326
|
+
query: retrievalQuery,
|
|
9327
|
+
maxChars: eventOrderMaxChars,
|
|
9328
|
+
maxItems: this.getRecallSectionNumber("event-order", "maxResults") ?? this.config.eventOrderRecallMaxResults,
|
|
9329
|
+
maxScanWindowTurns: this.getRecallSectionNumber("event-order", "maxTurns") ?? this.config.eventOrderRecallScanWindowTurns,
|
|
9330
|
+
maxScanWindowTokens: this.getRecallSectionNumber("event-order", "maxTokens") ?? this.config.eventOrderRecallScanWindowTokens
|
|
9331
|
+
});
|
|
9332
|
+
if (eventOrderSection) {
|
|
9333
|
+
this.appendRecallSection(
|
|
9334
|
+
sectionBuckets,
|
|
9335
|
+
"event-order",
|
|
9336
|
+
eventOrderSection
|
|
9337
|
+
);
|
|
9338
|
+
}
|
|
9339
|
+
} catch (err) {
|
|
9340
|
+
log.debug(`Event order recall assembly error: ${err}`);
|
|
9341
|
+
}
|
|
9342
|
+
}
|
|
9090
9343
|
if (profile)
|
|
9091
9344
|
this.appendRecallSection(
|
|
9092
9345
|
sectionBuckets,
|
|
@@ -10094,12 +10347,27 @@ _Context: ${topQuestion.context}_`
|
|
|
10094
10347
|
if (xrayResult?.explain?.reinforcementBoost !== void 0 && xrayResult.explain.reinforcementBoost > 0) {
|
|
10095
10348
|
scoreDecomposition.reinforcementBoost = xrayResult.explain.reinforcementBoost;
|
|
10096
10349
|
}
|
|
10350
|
+
const resultNamespace = this.namespaceFromPath(recalledPath);
|
|
10351
|
+
let provenance;
|
|
10352
|
+
try {
|
|
10353
|
+
const resultStorage = await this.storageRouter.storageFor(resultNamespace);
|
|
10354
|
+
const memory = await resultStorage.readMemoryByPath(recalledPath);
|
|
10355
|
+
if (memory) {
|
|
10356
|
+
provenance = buildRetrievedMemoryProvenance(memory, {
|
|
10357
|
+
namespace: resultNamespace,
|
|
10358
|
+
retrievalReason: `served-by=${servedBy}`,
|
|
10359
|
+
currentContextScopes: options.currentContextScopes
|
|
10360
|
+
});
|
|
10361
|
+
}
|
|
10362
|
+
} catch {
|
|
10363
|
+
}
|
|
10097
10364
|
results.push({
|
|
10098
10365
|
memoryId: derivedId,
|
|
10099
10366
|
path: recalledPath,
|
|
10100
10367
|
servedBy,
|
|
10101
10368
|
scoreDecomposition,
|
|
10102
|
-
admittedBy: []
|
|
10369
|
+
admittedBy: [],
|
|
10370
|
+
...provenance ? { provenance } : {}
|
|
10103
10371
|
});
|
|
10104
10372
|
}
|
|
10105
10373
|
let xrayConsidered;
|
|
@@ -10310,6 +10578,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10310
10578
|
role: turn.role,
|
|
10311
10579
|
content: turn.content,
|
|
10312
10580
|
timestamp: turn.timestamp,
|
|
10581
|
+
sourceValidAt: turn.sourceValidAt,
|
|
10313
10582
|
sessionKey: key,
|
|
10314
10583
|
parts: turn.parts,
|
|
10315
10584
|
rawContent: turn.rawContent,
|
|
@@ -10317,7 +10586,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10317
10586
|
});
|
|
10318
10587
|
bySession.set(key, list);
|
|
10319
10588
|
}
|
|
10320
|
-
const
|
|
10589
|
+
const replaySlices = [];
|
|
10321
10590
|
for (const [key, sessionTurns] of bySession.entries()) {
|
|
10322
10591
|
if (sessionTurns.length === 0) continue;
|
|
10323
10592
|
if (options.archiveLcm !== false && this.lcmEngine?.enabled) {
|
|
@@ -10332,19 +10601,33 @@ _Context: ${topQuestion.context}_`
|
|
|
10332
10601
|
}))
|
|
10333
10602
|
);
|
|
10334
10603
|
}
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
onTaskSettled: (err) => err ? reject(err) : resolve()
|
|
10344
|
-
}).catch(reject);
|
|
10345
|
-
})
|
|
10346
|
-
);
|
|
10604
|
+
for (const sessionSlice of splitTurnsBySourceValidAt(sessionTurns)) {
|
|
10605
|
+
replaySlices.push({
|
|
10606
|
+
bufferKey: key,
|
|
10607
|
+
order: replaySlices.length,
|
|
10608
|
+
targetValidAtMs: targetSourceValidAtSortMs(sessionSlice),
|
|
10609
|
+
turns: sessionSlice
|
|
10610
|
+
});
|
|
10611
|
+
}
|
|
10347
10612
|
}
|
|
10613
|
+
const replayTasks = replaySlices.sort((a, b) => {
|
|
10614
|
+
if (a.targetValidAtMs < b.targetValidAtMs) return -1;
|
|
10615
|
+
if (a.targetValidAtMs > b.targetValidAtMs) return 1;
|
|
10616
|
+
if (a.order === b.order) return 0;
|
|
10617
|
+
return a.order < b.order ? -1 : 1;
|
|
10618
|
+
}).map(
|
|
10619
|
+
({ bufferKey, turns: sessionSlice }) => new Promise((resolve, reject) => {
|
|
10620
|
+
void this.queueBufferedExtraction(sessionSlice, "trigger_mode", {
|
|
10621
|
+
skipDedupeCheck: true,
|
|
10622
|
+
clearBufferAfterExtraction: false,
|
|
10623
|
+
skipCharThreshold: true,
|
|
10624
|
+
skipUserTurnThreshold: true,
|
|
10625
|
+
bufferKey,
|
|
10626
|
+
extractionDeadlineMs: options.deadlineMs,
|
|
10627
|
+
onTaskSettled: (err) => err ? reject(err) : resolve()
|
|
10628
|
+
}).catch(reject);
|
|
10629
|
+
})
|
|
10630
|
+
);
|
|
10348
10631
|
if (replayTasks.length > 0) {
|
|
10349
10632
|
const settled = await Promise.allSettled(replayTasks);
|
|
10350
10633
|
const firstRejected = settled.find(
|
|
@@ -10420,6 +10703,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10420
10703
|
role: turn.role,
|
|
10421
10704
|
content: turn.content,
|
|
10422
10705
|
timestamp: turn.timestamp,
|
|
10706
|
+
sourceValidAt: turn.timestamp,
|
|
10423
10707
|
sessionKey,
|
|
10424
10708
|
parts: turn.parts,
|
|
10425
10709
|
rawContent: turn.rawContent,
|
|
@@ -10439,17 +10723,27 @@ _Context: ${topQuestion.context}_`
|
|
|
10439
10723
|
}))
|
|
10440
10724
|
);
|
|
10441
10725
|
}
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10726
|
+
const importTasks = splitTurnsBySourceValidAt(sessionTurns).map(
|
|
10727
|
+
(sessionSlice) => new Promise((resolve, reject) => {
|
|
10728
|
+
void this.queueBufferedExtraction(sessionSlice, "trigger_mode", {
|
|
10729
|
+
skipDedupeCheck: true,
|
|
10730
|
+
clearBufferAfterExtraction: false,
|
|
10731
|
+
skipCharThreshold: true,
|
|
10732
|
+
skipUserTurnThreshold: true,
|
|
10733
|
+
bufferKey: sessionKey,
|
|
10734
|
+
extractionDeadlineMs: options.deadlineMs,
|
|
10735
|
+
writeNamespaceOverride: this.bulkImportWriteNamespace(),
|
|
10736
|
+
onTaskSettled: (err) => err ? reject(err) : resolve()
|
|
10737
|
+
}).catch(reject);
|
|
10738
|
+
})
|
|
10739
|
+
);
|
|
10740
|
+
const settled = await Promise.allSettled(importTasks);
|
|
10741
|
+
const firstRejected = settled.find(
|
|
10742
|
+
(result) => result.status === "rejected"
|
|
10743
|
+
);
|
|
10744
|
+
if (firstRejected) {
|
|
10745
|
+
throw firstRejected.reason;
|
|
10746
|
+
}
|
|
10453
10747
|
}
|
|
10454
10748
|
async observeSessionHeartbeat(sessionKey, options = {}) {
|
|
10455
10749
|
if (this.config.sessionObserverEnabled !== true) return;
|
|
@@ -10515,6 +10809,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10515
10809
|
await this.runExtraction(turnsToExtract, {
|
|
10516
10810
|
clearBufferAfterExtraction: options.clearBufferAfterExtraction ?? true,
|
|
10517
10811
|
skipCharThreshold: options.skipCharThreshold ?? false,
|
|
10812
|
+
skipUserTurnThreshold: options.skipUserTurnThreshold ?? false,
|
|
10518
10813
|
deadlineMs: options.extractionDeadlineMs,
|
|
10519
10814
|
bufferKey,
|
|
10520
10815
|
abortSignal: options.abortSignal,
|
|
@@ -10623,6 +10918,7 @@ ${normalized}`).digest("hex");
|
|
|
10623
10918
|
log.debug(`running extraction on ${turns.length} turns`);
|
|
10624
10919
|
const clearBufferAfterExtraction = options.clearBufferAfterExtraction ?? true;
|
|
10625
10920
|
const skipCharThreshold = options.skipCharThreshold ?? false;
|
|
10921
|
+
const skipUserTurnThreshold = options.skipUserTurnThreshold ?? false;
|
|
10626
10922
|
const deadlineMs = typeof options.deadlineMs === "number" && Number.isFinite(options.deadlineMs) ? options.deadlineMs : void 0;
|
|
10627
10923
|
const bufferKey = options.bufferKey ?? turns[0]?.sessionKey ?? "default";
|
|
10628
10924
|
const throwIfDeadlineExceeded = (stage) => {
|
|
@@ -10653,15 +10949,24 @@ ${normalized}`).digest("hex");
|
|
|
10653
10949
|
...t,
|
|
10654
10950
|
content: t.content.trim().slice(0, this.config.extractionMaxTurnChars)
|
|
10655
10951
|
})).filter((t) => t.content.length > 0);
|
|
10952
|
+
const targetTurns = normalizedTurns.filter(
|
|
10953
|
+
(turn) => turn.extractionContextOnly !== true
|
|
10954
|
+
);
|
|
10955
|
+
if (targetTurns.length === 0) {
|
|
10956
|
+
log.debug("skipping extraction: no non-context turns after normalization");
|
|
10957
|
+
await clearBuffer();
|
|
10958
|
+
return;
|
|
10959
|
+
}
|
|
10960
|
+
const sourceValidAt = latestSourceValidAtFromTurns(targetTurns);
|
|
10656
10961
|
throwIfDeadlineExceeded("before_extract");
|
|
10657
10962
|
throwIfAborted2("before_extract");
|
|
10658
|
-
const userTurns =
|
|
10659
|
-
const totalChars =
|
|
10963
|
+
const userTurns = targetTurns.filter((t) => t.role === "user");
|
|
10964
|
+
const totalChars = targetTurns.reduce(
|
|
10660
10965
|
(sum, t) => sum + t.content.length,
|
|
10661
10966
|
0
|
|
10662
10967
|
);
|
|
10663
10968
|
const belowCharThreshold = totalChars < this.config.extractionMinChars;
|
|
10664
|
-
const belowUserTurnThreshold = userTurns.length < this.config.extractionMinUserTurns;
|
|
10969
|
+
const belowUserTurnThreshold = !skipUserTurnThreshold && userTurns.length < this.config.extractionMinUserTurns;
|
|
10665
10970
|
if (!skipCharThreshold && belowCharThreshold || belowUserTurnThreshold) {
|
|
10666
10971
|
log.debug(
|
|
10667
10972
|
`skipping extraction: below threshold (totalChars=${totalChars}, userTurns=${userTurns.length})`
|
|
@@ -10675,11 +10980,11 @@ ${normalized}`).digest("hex");
|
|
|
10675
10980
|
defaultNamespaceForPrincipal(principal, this.config)
|
|
10676
10981
|
);
|
|
10677
10982
|
const storage = await this.storageRouter.storageFor(selfNamespace);
|
|
10678
|
-
const shouldPersistProcessedFingerprint =
|
|
10983
|
+
const shouldPersistProcessedFingerprint = targetTurns.some(
|
|
10679
10984
|
(turn) => turn.persistProcessedFingerprint === true
|
|
10680
10985
|
);
|
|
10681
10986
|
const extractionFingerprint = this.buildExtractionFingerprint(
|
|
10682
|
-
|
|
10987
|
+
targetTurns,
|
|
10683
10988
|
bufferKey
|
|
10684
10989
|
);
|
|
10685
10990
|
let meta = extractionFingerprint && shouldPersistProcessedFingerprint ? await storage.loadMeta() : null;
|
|
@@ -10739,7 +11044,7 @@ ${normalized}`).digest("hex");
|
|
|
10739
11044
|
result,
|
|
10740
11045
|
storage,
|
|
10741
11046
|
threadIdForExtraction,
|
|
10742
|
-
{ sessionKey, principal }
|
|
11047
|
+
{ sessionKey, principal, validAt: sourceValidAt }
|
|
10743
11048
|
);
|
|
10744
11049
|
meta ??= await storage.loadMeta();
|
|
10745
11050
|
if (extractionFingerprint && shouldPersistProcessedFingerprint) {
|
|
@@ -11100,6 +11405,7 @@ ${normalized}`).digest("hex");
|
|
|
11100
11405
|
};
|
|
11101
11406
|
return attachCitation(content, citationContext, citationTemplate);
|
|
11102
11407
|
};
|
|
11408
|
+
const supersessionOrderingAt = (validAt) => validAt && validAt.length > 0 ? validAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
11103
11409
|
const persistedIds = [];
|
|
11104
11410
|
const persistedIdsByStorage = /* @__PURE__ */ new Map();
|
|
11105
11411
|
const trackPersistedId = (targetStorage, id, options = {}) => {
|
|
@@ -11195,7 +11501,7 @@ ${normalized}`).digest("hex");
|
|
|
11195
11501
|
newMemoryId: hashDedupMatchingFact.frontmatter.id,
|
|
11196
11502
|
entityRef: options.entityRef,
|
|
11197
11503
|
structuredAttributes: options.structuredAttributes,
|
|
11198
|
-
createdAt: (
|
|
11504
|
+
createdAt: supersessionOrderingAt(options.validAt),
|
|
11199
11505
|
enabled: true,
|
|
11200
11506
|
useCallerTimestamp: true
|
|
11201
11507
|
});
|
|
@@ -11235,6 +11541,7 @@ ${normalized}`).digest("hex");
|
|
|
11235
11541
|
intentActionType: options.intentActionType,
|
|
11236
11542
|
intentEntityTypes: options.intentEntityTypes,
|
|
11237
11543
|
memoryKind: options.memoryKind,
|
|
11544
|
+
validAt: options.validAt,
|
|
11238
11545
|
// Index the RAW content hash so hasFactContentHash(rawContent)
|
|
11239
11546
|
// returns true on subsequent extractions. Without this, the index
|
|
11240
11547
|
// would record the hash of citedContent (which changes every call
|
|
@@ -11249,7 +11556,7 @@ ${normalized}`).digest("hex");
|
|
|
11249
11556
|
newMemoryId: promotedId,
|
|
11250
11557
|
entityRef: options.entityRef,
|
|
11251
11558
|
structuredAttributes: options.structuredAttributes,
|
|
11252
|
-
createdAt: (
|
|
11559
|
+
createdAt: supersessionOrderingAt(options.validAt),
|
|
11253
11560
|
enabled: true
|
|
11254
11561
|
});
|
|
11255
11562
|
} catch (sharedSupersessionErr) {
|
|
@@ -11711,6 +12018,7 @@ ${normalized}`).digest("hex");
|
|
|
11711
12018
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11712
12019
|
memoryKind: memoryKind2,
|
|
11713
12020
|
structuredAttributes: fact.structuredAttributes,
|
|
12021
|
+
validAt: sourceContext?.validAt,
|
|
11714
12022
|
contentHashSource: rawChunkedContent
|
|
11715
12023
|
}
|
|
11716
12024
|
);
|
|
@@ -11738,7 +12046,8 @@ ${normalized}`).digest("hex");
|
|
|
11738
12046
|
intentGoal: inferredIntent?.goal,
|
|
11739
12047
|
intentActionType: inferredIntent?.actionType,
|
|
11740
12048
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11741
|
-
memoryKind: memoryKind2
|
|
12049
|
+
memoryKind: memoryKind2,
|
|
12050
|
+
validAt: sourceContext?.validAt
|
|
11742
12051
|
}
|
|
11743
12052
|
);
|
|
11744
12053
|
}
|
|
@@ -11762,7 +12071,7 @@ ${normalized}`).digest("hex");
|
|
|
11762
12071
|
newMemoryId: parentId,
|
|
11763
12072
|
entityRef: supersessionEntityRef,
|
|
11764
12073
|
structuredAttributes: fact.structuredAttributes,
|
|
11765
|
-
createdAt: (
|
|
12074
|
+
createdAt: supersessionOrderingAt(sourceContext?.validAt),
|
|
11766
12075
|
enabled: this.config.temporalSupersessionEnabled
|
|
11767
12076
|
});
|
|
11768
12077
|
} catch (err) {
|
|
@@ -11782,6 +12091,7 @@ ${normalized}`).digest("hex");
|
|
|
11782
12091
|
intentActionType: inferredIntent?.actionType,
|
|
11783
12092
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11784
12093
|
memoryKind: memoryKind2,
|
|
12094
|
+
validAt: sourceContext?.validAt,
|
|
11785
12095
|
source: extractionWriteSource
|
|
11786
12096
|
});
|
|
11787
12097
|
if (this.contentHashIndex) {
|
|
@@ -11882,6 +12192,7 @@ ${normalized}`).digest("hex");
|
|
|
11882
12192
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11883
12193
|
memoryKind,
|
|
11884
12194
|
structuredAttributes: fact.structuredAttributes,
|
|
12195
|
+
validAt: sourceContext?.validAt,
|
|
11885
12196
|
contentHashSource: writeCategory === "fact" ? fact.content : void 0
|
|
11886
12197
|
}
|
|
11887
12198
|
);
|
|
@@ -11897,7 +12208,7 @@ ${normalized}`).digest("hex");
|
|
|
11897
12208
|
newMemoryId: memoryId,
|
|
11898
12209
|
entityRef: supersessionEntityRef,
|
|
11899
12210
|
structuredAttributes: fact.structuredAttributes,
|
|
11900
|
-
createdAt: (
|
|
12211
|
+
createdAt: supersessionOrderingAt(sourceContext?.validAt),
|
|
11901
12212
|
enabled: this.config.temporalSupersessionEnabled
|
|
11902
12213
|
});
|
|
11903
12214
|
} catch (err) {
|
|
@@ -11933,6 +12244,7 @@ ${normalized}`).digest("hex");
|
|
|
11933
12244
|
intentActionType: inferredIntent?.actionType,
|
|
11934
12245
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11935
12246
|
memoryKind,
|
|
12247
|
+
validAt: sourceContext?.validAt,
|
|
11936
12248
|
source: extractionWriteSource
|
|
11937
12249
|
});
|
|
11938
12250
|
if (this.config.multiGraphMemoryEnabled) {
|
|
@@ -11997,6 +12309,7 @@ ${normalized}`).digest("hex");
|
|
|
11997
12309
|
const safeFacts = Array.isArray(entity?.facts) ? entity.facts.filter((f) => typeof f === "string") : [];
|
|
11998
12310
|
const id = await storage.writeEntity(name, type, safeFacts, {
|
|
11999
12311
|
source: typeof entity?.source === "string" ? entity.source : "extraction",
|
|
12312
|
+
timestamp: sourceContext?.validAt,
|
|
12000
12313
|
sessionKey: sourceContext?.sessionKey,
|
|
12001
12314
|
principal: sourceContext?.principal,
|
|
12002
12315
|
structuredSections: Array.isArray(entity?.structuredSections) ? entity.structuredSections : void 0
|
|
@@ -14394,4 +14707,4 @@ export {
|
|
|
14394
14707
|
resolvePersistedMemoryRelativePath,
|
|
14395
14708
|
Orchestrator
|
|
14396
14709
|
};
|
|
14397
|
-
//# sourceMappingURL=chunk-
|
|
14710
|
+
//# sourceMappingURL=chunk-BZSQEPRW.js.map
|