@remnic/core 1.1.10 → 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-BTTNyo1i.d.ts → access-service-DDjzFALq.d.ts} +54 -5
- 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-5GCNE7CN.js → chunk-BZSQEPRW.js} +454 -140
- 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-BrEwQTnW.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 +19 -1
- package/dist/explicit-cue-recall.js +10 -4
- 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 +289 -115
- 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-6IvQ-Phj.d.ts → orchestrator-DDMPqU6R.d.ts} +10 -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/sdk-compat.d.ts +3 -2
- package/dist/sdk-compat.js.map +1 -1
- 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-5GCNE7CN.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-ERUDW6DU.js +0 -965
- package/dist/chunk-ERUDW6DU.js.map +0 -1
- package/dist/chunk-GGD5W7TB.js.map +0 -1
- package/dist/chunk-IBX3VFOM.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-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
|
},
|
|
@@ -3025,7 +3060,8 @@ ${preview}`,
|
|
|
3025
3060
|
return {
|
|
3026
3061
|
totalMessages: this.archive.getMessageCount(sessionId),
|
|
3027
3062
|
totalSummaryNodes: this.dag.getNodeCount(sessionId),
|
|
3028
|
-
maxDepth: this.dag.getMaxDepth(sessionId)
|
|
3063
|
+
maxDepth: this.dag.getMaxDepth(sessionId),
|
|
3064
|
+
maxTurnIndex: this.archive.getMaxTurnIndex(sessionId)
|
|
3029
3065
|
};
|
|
3030
3066
|
}
|
|
3031
3067
|
return {
|
|
@@ -3388,6 +3424,102 @@ function sanitizeSessionKeyForFilename(sessionKey) {
|
|
|
3388
3424
|
const hash = createHash2("sha256").update(sessionKey).digest("hex").slice(0, 12);
|
|
3389
3425
|
return `${readable}-${hash}`;
|
|
3390
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
|
+
}
|
|
3391
3523
|
function isArtifactMemoryPath(filePath) {
|
|
3392
3524
|
return /(?:^|[\\/])artifacts(?:[\\/]|$)/i.test(filePath);
|
|
3393
3525
|
}
|
|
@@ -4438,7 +4570,10 @@ var Orchestrator = class _Orchestrator {
|
|
|
4438
4570
|
);
|
|
4439
4571
|
return result2 ? { content: result2.content } : null;
|
|
4440
4572
|
}
|
|
4441
|
-
const result = await this.fastLlm.chatCompletion(messages,
|
|
4573
|
+
const result = await this.fastLlm.chatCompletion(messages, {
|
|
4574
|
+
...options,
|
|
4575
|
+
forceDisableThinking: true
|
|
4576
|
+
});
|
|
4442
4577
|
return result ? { content: result.content } : null;
|
|
4443
4578
|
}
|
|
4444
4579
|
/**
|
|
@@ -4452,7 +4587,12 @@ var Orchestrator = class _Orchestrator {
|
|
|
4452
4587
|
chatCompletion: (messages, options) => this.fastChatCompletion(messages, options ?? {})
|
|
4453
4588
|
};
|
|
4454
4589
|
}
|
|
4455
|
-
return
|
|
4590
|
+
return {
|
|
4591
|
+
chatCompletion: (messages, options) => this.fastLlm.chatCompletion(messages, {
|
|
4592
|
+
...options ?? {},
|
|
4593
|
+
forceDisableThinking: true
|
|
4594
|
+
})
|
|
4595
|
+
};
|
|
4456
4596
|
}
|
|
4457
4597
|
async initialize() {
|
|
4458
4598
|
this.deferredReady = new Promise((resolve) => {
|
|
@@ -5147,7 +5287,7 @@ ${doc.content}` : doc.content,
|
|
|
5147
5287
|
}
|
|
5148
5288
|
async runDeepSleepGovernanceNow(options) {
|
|
5149
5289
|
const targetStorage = options?.storage ?? this.storage;
|
|
5150
|
-
const { runMemoryGovernance } = await import("./memory-governance-
|
|
5290
|
+
const { runMemoryGovernance } = await import("./memory-governance-IMPQZXFC.js");
|
|
5151
5291
|
const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-LR2NBAZE.js");
|
|
5152
5292
|
const govResult = await runMemoryGovernance({
|
|
5153
5293
|
memoryDir: targetStorage.dir,
|
|
@@ -5249,7 +5389,8 @@ ${doc.content}` : doc.content,
|
|
|
5249
5389
|
operation: "semantic-consolidation",
|
|
5250
5390
|
maxTokens: llmOpts.maxTokens,
|
|
5251
5391
|
temperature: llmOpts.temperature,
|
|
5252
|
-
priority: "background"
|
|
5392
|
+
priority: "background",
|
|
5393
|
+
forceDisableThinking: true
|
|
5253
5394
|
});
|
|
5254
5395
|
response = fastResult ? { content: fastResult.content } : null;
|
|
5255
5396
|
} else {
|
|
@@ -7011,6 +7152,11 @@ ${r.snippet.trim()}
|
|
|
7011
7152
|
if (!entry) return defaultEnabled;
|
|
7012
7153
|
return entry.enabled !== false;
|
|
7013
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
|
+
}
|
|
7014
7160
|
getRecallSectionMaxChars(sectionId) {
|
|
7015
7161
|
const entry = this.getRecallSectionEntry(sectionId);
|
|
7016
7162
|
if (!entry) return void 0;
|
|
@@ -9086,6 +9232,114 @@ ${formatted}`;
|
|
|
9086
9232
|
log.debug(`Explicit cue recall assembly error: ${err}`);
|
|
9087
9233
|
}
|
|
9088
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
|
+
}
|
|
9089
9343
|
if (profile)
|
|
9090
9344
|
this.appendRecallSection(
|
|
9091
9345
|
sectionBuckets,
|
|
@@ -10093,12 +10347,27 @@ _Context: ${topQuestion.context}_`
|
|
|
10093
10347
|
if (xrayResult?.explain?.reinforcementBoost !== void 0 && xrayResult.explain.reinforcementBoost > 0) {
|
|
10094
10348
|
scoreDecomposition.reinforcementBoost = xrayResult.explain.reinforcementBoost;
|
|
10095
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
|
+
}
|
|
10096
10364
|
results.push({
|
|
10097
10365
|
memoryId: derivedId,
|
|
10098
10366
|
path: recalledPath,
|
|
10099
10367
|
servedBy,
|
|
10100
10368
|
scoreDecomposition,
|
|
10101
|
-
admittedBy: []
|
|
10369
|
+
admittedBy: [],
|
|
10370
|
+
...provenance ? { provenance } : {}
|
|
10102
10371
|
});
|
|
10103
10372
|
}
|
|
10104
10373
|
let xrayConsidered;
|
|
@@ -10309,6 +10578,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10309
10578
|
role: turn.role,
|
|
10310
10579
|
content: turn.content,
|
|
10311
10580
|
timestamp: turn.timestamp,
|
|
10581
|
+
sourceValidAt: turn.sourceValidAt,
|
|
10312
10582
|
sessionKey: key,
|
|
10313
10583
|
parts: turn.parts,
|
|
10314
10584
|
rawContent: turn.rawContent,
|
|
@@ -10316,7 +10586,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10316
10586
|
});
|
|
10317
10587
|
bySession.set(key, list);
|
|
10318
10588
|
}
|
|
10319
|
-
const
|
|
10589
|
+
const replaySlices = [];
|
|
10320
10590
|
for (const [key, sessionTurns] of bySession.entries()) {
|
|
10321
10591
|
if (sessionTurns.length === 0) continue;
|
|
10322
10592
|
if (options.archiveLcm !== false && this.lcmEngine?.enabled) {
|
|
@@ -10331,19 +10601,33 @@ _Context: ${topQuestion.context}_`
|
|
|
10331
10601
|
}))
|
|
10332
10602
|
);
|
|
10333
10603
|
}
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
onTaskSettled: (err) => err ? reject(err) : resolve()
|
|
10343
|
-
}).catch(reject);
|
|
10344
|
-
})
|
|
10345
|
-
);
|
|
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
|
+
}
|
|
10346
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
|
+
);
|
|
10347
10631
|
if (replayTasks.length > 0) {
|
|
10348
10632
|
const settled = await Promise.allSettled(replayTasks);
|
|
10349
10633
|
const firstRejected = settled.find(
|
|
@@ -10419,6 +10703,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10419
10703
|
role: turn.role,
|
|
10420
10704
|
content: turn.content,
|
|
10421
10705
|
timestamp: turn.timestamp,
|
|
10706
|
+
sourceValidAt: turn.timestamp,
|
|
10422
10707
|
sessionKey,
|
|
10423
10708
|
parts: turn.parts,
|
|
10424
10709
|
rawContent: turn.rawContent,
|
|
@@ -10438,17 +10723,27 @@ _Context: ${topQuestion.context}_`
|
|
|
10438
10723
|
}))
|
|
10439
10724
|
);
|
|
10440
10725
|
}
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
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
|
+
}
|
|
10452
10747
|
}
|
|
10453
10748
|
async observeSessionHeartbeat(sessionKey, options = {}) {
|
|
10454
10749
|
if (this.config.sessionObserverEnabled !== true) return;
|
|
@@ -10514,6 +10809,7 @@ _Context: ${topQuestion.context}_`
|
|
|
10514
10809
|
await this.runExtraction(turnsToExtract, {
|
|
10515
10810
|
clearBufferAfterExtraction: options.clearBufferAfterExtraction ?? true,
|
|
10516
10811
|
skipCharThreshold: options.skipCharThreshold ?? false,
|
|
10812
|
+
skipUserTurnThreshold: options.skipUserTurnThreshold ?? false,
|
|
10517
10813
|
deadlineMs: options.extractionDeadlineMs,
|
|
10518
10814
|
bufferKey,
|
|
10519
10815
|
abortSignal: options.abortSignal,
|
|
@@ -10622,6 +10918,7 @@ ${normalized}`).digest("hex");
|
|
|
10622
10918
|
log.debug(`running extraction on ${turns.length} turns`);
|
|
10623
10919
|
const clearBufferAfterExtraction = options.clearBufferAfterExtraction ?? true;
|
|
10624
10920
|
const skipCharThreshold = options.skipCharThreshold ?? false;
|
|
10921
|
+
const skipUserTurnThreshold = options.skipUserTurnThreshold ?? false;
|
|
10625
10922
|
const deadlineMs = typeof options.deadlineMs === "number" && Number.isFinite(options.deadlineMs) ? options.deadlineMs : void 0;
|
|
10626
10923
|
const bufferKey = options.bufferKey ?? turns[0]?.sessionKey ?? "default";
|
|
10627
10924
|
const throwIfDeadlineExceeded = (stage) => {
|
|
@@ -10652,15 +10949,24 @@ ${normalized}`).digest("hex");
|
|
|
10652
10949
|
...t,
|
|
10653
10950
|
content: t.content.trim().slice(0, this.config.extractionMaxTurnChars)
|
|
10654
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);
|
|
10655
10961
|
throwIfDeadlineExceeded("before_extract");
|
|
10656
10962
|
throwIfAborted2("before_extract");
|
|
10657
|
-
const userTurns =
|
|
10658
|
-
const totalChars =
|
|
10963
|
+
const userTurns = targetTurns.filter((t) => t.role === "user");
|
|
10964
|
+
const totalChars = targetTurns.reduce(
|
|
10659
10965
|
(sum, t) => sum + t.content.length,
|
|
10660
10966
|
0
|
|
10661
10967
|
);
|
|
10662
10968
|
const belowCharThreshold = totalChars < this.config.extractionMinChars;
|
|
10663
|
-
const belowUserTurnThreshold = userTurns.length < this.config.extractionMinUserTurns;
|
|
10969
|
+
const belowUserTurnThreshold = !skipUserTurnThreshold && userTurns.length < this.config.extractionMinUserTurns;
|
|
10664
10970
|
if (!skipCharThreshold && belowCharThreshold || belowUserTurnThreshold) {
|
|
10665
10971
|
log.debug(
|
|
10666
10972
|
`skipping extraction: below threshold (totalChars=${totalChars}, userTurns=${userTurns.length})`
|
|
@@ -10674,11 +10980,11 @@ ${normalized}`).digest("hex");
|
|
|
10674
10980
|
defaultNamespaceForPrincipal(principal, this.config)
|
|
10675
10981
|
);
|
|
10676
10982
|
const storage = await this.storageRouter.storageFor(selfNamespace);
|
|
10677
|
-
const shouldPersistProcessedFingerprint =
|
|
10983
|
+
const shouldPersistProcessedFingerprint = targetTurns.some(
|
|
10678
10984
|
(turn) => turn.persistProcessedFingerprint === true
|
|
10679
10985
|
);
|
|
10680
10986
|
const extractionFingerprint = this.buildExtractionFingerprint(
|
|
10681
|
-
|
|
10987
|
+
targetTurns,
|
|
10682
10988
|
bufferKey
|
|
10683
10989
|
);
|
|
10684
10990
|
let meta = extractionFingerprint && shouldPersistProcessedFingerprint ? await storage.loadMeta() : null;
|
|
@@ -10738,7 +11044,7 @@ ${normalized}`).digest("hex");
|
|
|
10738
11044
|
result,
|
|
10739
11045
|
storage,
|
|
10740
11046
|
threadIdForExtraction,
|
|
10741
|
-
{ sessionKey, principal }
|
|
11047
|
+
{ sessionKey, principal, validAt: sourceValidAt }
|
|
10742
11048
|
);
|
|
10743
11049
|
meta ??= await storage.loadMeta();
|
|
10744
11050
|
if (extractionFingerprint && shouldPersistProcessedFingerprint) {
|
|
@@ -11099,6 +11405,7 @@ ${normalized}`).digest("hex");
|
|
|
11099
11405
|
};
|
|
11100
11406
|
return attachCitation(content, citationContext, citationTemplate);
|
|
11101
11407
|
};
|
|
11408
|
+
const supersessionOrderingAt = (validAt) => validAt && validAt.length > 0 ? validAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
11102
11409
|
const persistedIds = [];
|
|
11103
11410
|
const persistedIdsByStorage = /* @__PURE__ */ new Map();
|
|
11104
11411
|
const trackPersistedId = (targetStorage, id, options = {}) => {
|
|
@@ -11194,7 +11501,7 @@ ${normalized}`).digest("hex");
|
|
|
11194
11501
|
newMemoryId: hashDedupMatchingFact.frontmatter.id,
|
|
11195
11502
|
entityRef: options.entityRef,
|
|
11196
11503
|
structuredAttributes: options.structuredAttributes,
|
|
11197
|
-
createdAt: (
|
|
11504
|
+
createdAt: supersessionOrderingAt(options.validAt),
|
|
11198
11505
|
enabled: true,
|
|
11199
11506
|
useCallerTimestamp: true
|
|
11200
11507
|
});
|
|
@@ -11234,6 +11541,7 @@ ${normalized}`).digest("hex");
|
|
|
11234
11541
|
intentActionType: options.intentActionType,
|
|
11235
11542
|
intentEntityTypes: options.intentEntityTypes,
|
|
11236
11543
|
memoryKind: options.memoryKind,
|
|
11544
|
+
validAt: options.validAt,
|
|
11237
11545
|
// Index the RAW content hash so hasFactContentHash(rawContent)
|
|
11238
11546
|
// returns true on subsequent extractions. Without this, the index
|
|
11239
11547
|
// would record the hash of citedContent (which changes every call
|
|
@@ -11248,7 +11556,7 @@ ${normalized}`).digest("hex");
|
|
|
11248
11556
|
newMemoryId: promotedId,
|
|
11249
11557
|
entityRef: options.entityRef,
|
|
11250
11558
|
structuredAttributes: options.structuredAttributes,
|
|
11251
|
-
createdAt: (
|
|
11559
|
+
createdAt: supersessionOrderingAt(options.validAt),
|
|
11252
11560
|
enabled: true
|
|
11253
11561
|
});
|
|
11254
11562
|
} catch (sharedSupersessionErr) {
|
|
@@ -11710,6 +12018,7 @@ ${normalized}`).digest("hex");
|
|
|
11710
12018
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11711
12019
|
memoryKind: memoryKind2,
|
|
11712
12020
|
structuredAttributes: fact.structuredAttributes,
|
|
12021
|
+
validAt: sourceContext?.validAt,
|
|
11713
12022
|
contentHashSource: rawChunkedContent
|
|
11714
12023
|
}
|
|
11715
12024
|
);
|
|
@@ -11737,7 +12046,8 @@ ${normalized}`).digest("hex");
|
|
|
11737
12046
|
intentGoal: inferredIntent?.goal,
|
|
11738
12047
|
intentActionType: inferredIntent?.actionType,
|
|
11739
12048
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11740
|
-
memoryKind: memoryKind2
|
|
12049
|
+
memoryKind: memoryKind2,
|
|
12050
|
+
validAt: sourceContext?.validAt
|
|
11741
12051
|
}
|
|
11742
12052
|
);
|
|
11743
12053
|
}
|
|
@@ -11761,7 +12071,7 @@ ${normalized}`).digest("hex");
|
|
|
11761
12071
|
newMemoryId: parentId,
|
|
11762
12072
|
entityRef: supersessionEntityRef,
|
|
11763
12073
|
structuredAttributes: fact.structuredAttributes,
|
|
11764
|
-
createdAt: (
|
|
12074
|
+
createdAt: supersessionOrderingAt(sourceContext?.validAt),
|
|
11765
12075
|
enabled: this.config.temporalSupersessionEnabled
|
|
11766
12076
|
});
|
|
11767
12077
|
} catch (err) {
|
|
@@ -11781,6 +12091,7 @@ ${normalized}`).digest("hex");
|
|
|
11781
12091
|
intentActionType: inferredIntent?.actionType,
|
|
11782
12092
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11783
12093
|
memoryKind: memoryKind2,
|
|
12094
|
+
validAt: sourceContext?.validAt,
|
|
11784
12095
|
source: extractionWriteSource
|
|
11785
12096
|
});
|
|
11786
12097
|
if (this.contentHashIndex) {
|
|
@@ -11881,6 +12192,7 @@ ${normalized}`).digest("hex");
|
|
|
11881
12192
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11882
12193
|
memoryKind,
|
|
11883
12194
|
structuredAttributes: fact.structuredAttributes,
|
|
12195
|
+
validAt: sourceContext?.validAt,
|
|
11884
12196
|
contentHashSource: writeCategory === "fact" ? fact.content : void 0
|
|
11885
12197
|
}
|
|
11886
12198
|
);
|
|
@@ -11896,7 +12208,7 @@ ${normalized}`).digest("hex");
|
|
|
11896
12208
|
newMemoryId: memoryId,
|
|
11897
12209
|
entityRef: supersessionEntityRef,
|
|
11898
12210
|
structuredAttributes: fact.structuredAttributes,
|
|
11899
|
-
createdAt: (
|
|
12211
|
+
createdAt: supersessionOrderingAt(sourceContext?.validAt),
|
|
11900
12212
|
enabled: this.config.temporalSupersessionEnabled
|
|
11901
12213
|
});
|
|
11902
12214
|
} catch (err) {
|
|
@@ -11932,6 +12244,7 @@ ${normalized}`).digest("hex");
|
|
|
11932
12244
|
intentActionType: inferredIntent?.actionType,
|
|
11933
12245
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
11934
12246
|
memoryKind,
|
|
12247
|
+
validAt: sourceContext?.validAt,
|
|
11935
12248
|
source: extractionWriteSource
|
|
11936
12249
|
});
|
|
11937
12250
|
if (this.config.multiGraphMemoryEnabled) {
|
|
@@ -11996,6 +12309,7 @@ ${normalized}`).digest("hex");
|
|
|
11996
12309
|
const safeFacts = Array.isArray(entity?.facts) ? entity.facts.filter((f) => typeof f === "string") : [];
|
|
11997
12310
|
const id = await storage.writeEntity(name, type, safeFacts, {
|
|
11998
12311
|
source: typeof entity?.source === "string" ? entity.source : "extraction",
|
|
12312
|
+
timestamp: sourceContext?.validAt,
|
|
11999
12313
|
sessionKey: sourceContext?.sessionKey,
|
|
12000
12314
|
principal: sourceContext?.principal,
|
|
12001
12315
|
structuredSections: Array.isArray(entity?.structuredSections) ? entity.structuredSections : void 0
|
|
@@ -14393,4 +14707,4 @@ export {
|
|
|
14393
14707
|
resolvePersistedMemoryRelativePath,
|
|
14394
14708
|
Orchestrator
|
|
14395
14709
|
};
|
|
14396
|
-
//# sourceMappingURL=chunk-
|
|
14710
|
+
//# sourceMappingURL=chunk-BZSQEPRW.js.map
|