@remnic/core 9.3.613 → 9.3.615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-cli.js +59 -58
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +4 -2
- package/dist/access-http.js +23 -23
- package/dist/access-mcp.d.ts +9 -2
- package/dist/access-mcp.js +20 -20
- package/dist/access-schema.d.ts +26 -14
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-D2J9dh_9.d.ts → access-service-CBNEKjzN.d.ts} +71 -6
- package/dist/access-service.d.ts +2 -2
- package/dist/access-service.js +17 -17
- package/dist/active-recall.js +20 -3
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/behavior-learner.js +2 -3
- package/dist/behavior-learner.js.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer.d.ts +1 -1
- package/dist/buffer.js +1 -1
- package/dist/calibration.d.ts +5 -2
- package/dist/calibration.js +7 -5
- package/dist/calibration.js.map +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/causal-consolidation.d.ts +8 -2
- package/dist/causal-consolidation.js +13 -11
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-3BP57I6J.js → chunk-2F6NP3NT.js} +2 -1
- package/dist/{chunk-3BP57I6J.js.map → chunk-2F6NP3NT.js.map} +1 -1
- package/dist/{chunk-AU7Q3LSC.js → chunk-2QSZNTDO.js} +4 -4
- package/dist/{chunk-HSVJGWYS.js → chunk-2ROPI5OE.js} +2 -2
- package/dist/{chunk-C4SQJZAF.js → chunk-2SGJY2UY.js} +6 -3
- package/dist/chunk-2SGJY2UY.js.map +1 -0
- package/dist/{chunk-ZDTVJXIP.js → chunk-3MAONBX3.js} +13 -5
- package/dist/chunk-3MAONBX3.js.map +1 -0
- package/dist/{chunk-G3Z3QEF5.js → chunk-3PY7VHV7.js} +2 -2
- package/dist/chunk-3PY7VHV7.js.map +1 -0
- package/dist/{chunk-CF3ZF2YU.js → chunk-3QSU4NFF.js} +3 -3
- package/dist/{chunk-AJA46VX5.js → chunk-3T74IZB3.js} +11 -2
- package/dist/chunk-3T74IZB3.js.map +1 -0
- package/dist/{chunk-KVEVLBKC.js → chunk-4HFJQCJZ.js} +13 -8
- package/dist/chunk-4HFJQCJZ.js.map +1 -0
- package/dist/{chunk-KGK2QKWL.js → chunk-4R4KTDIE.js} +1 -1
- package/dist/chunk-4R4KTDIE.js.map +1 -0
- package/dist/{chunk-OI27U2HT.js → chunk-5BTCT236.js} +2 -2
- package/dist/{chunk-TH67Q46T.js → chunk-5OHHEORR.js} +64 -21
- package/dist/chunk-5OHHEORR.js.map +1 -0
- package/dist/{chunk-CO7ZO4TU.js → chunk-5VDJMYTF.js} +2 -2
- package/dist/{chunk-BFBF3XEF.js → chunk-6BDVBBBY.js} +33 -25
- package/dist/{chunk-BFBF3XEF.js.map → chunk-6BDVBBBY.js.map} +1 -1
- package/dist/{chunk-EAZGEEG2.js → chunk-6L46YAEZ.js} +45 -9
- package/dist/chunk-6L46YAEZ.js.map +1 -0
- package/dist/{chunk-YFS5OEKO.js → chunk-7MLB4NCL.js} +2 -2
- package/dist/{chunk-LZ3VEOU5.js → chunk-AL4RAJL5.js} +22 -5
- package/dist/chunk-AL4RAJL5.js.map +1 -0
- package/dist/{chunk-557IAFPD.js → chunk-APRRL26Q.js} +2 -2
- package/dist/{chunk-QDDHYAKV.js → chunk-AZDOWD2L.js} +2 -2
- package/dist/{chunk-MLT75J5S.js → chunk-B6SU7YSE.js} +3 -3
- package/dist/{chunk-FXKPZ3H6.js → chunk-BPSGLMQ4.js} +2 -2
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-NOMEVTUD.js → chunk-C6C7XVKG.js} +5 -4
- package/dist/chunk-C6C7XVKG.js.map +1 -0
- package/dist/{chunk-XKIQZXUB.js → chunk-CI7RKSRE.js} +7 -1
- package/dist/chunk-CI7RKSRE.js.map +1 -0
- package/dist/{chunk-IK34DVAC.js → chunk-CIOMS6DI.js} +2 -2
- package/dist/{chunk-2I5JGH3M.js → chunk-CYEPCZN5.js} +2 -2
- package/dist/{chunk-2I5JGH3M.js.map → chunk-CYEPCZN5.js.map} +1 -1
- package/dist/{chunk-JHMFYY7L.js → chunk-DCGT4FPP.js} +13 -5
- package/dist/chunk-DCGT4FPP.js.map +1 -0
- package/dist/{chunk-7DZRO2DC.js → chunk-DEPRLVLK.js} +2 -2
- package/dist/{chunk-CSKLPDN6.js → chunk-DEVUWMME.js} +52 -19
- package/dist/chunk-DEVUWMME.js.map +1 -0
- package/dist/{chunk-DHGSZ3UD.js → chunk-DGNQRNLL.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-HJNQQICM.js → chunk-EXUAP5LH.js} +108 -51
- package/dist/chunk-EXUAP5LH.js.map +1 -0
- package/dist/chunk-FAV25DUZ.js +12 -0
- package/dist/chunk-FAV25DUZ.js.map +1 -0
- package/dist/{chunk-ETUPBUHB.js → chunk-GDASG7NC.js} +2 -2
- package/dist/{chunk-L227SKTB.js → chunk-GDB4J2H3.js} +17 -1
- package/dist/chunk-GDB4J2H3.js.map +1 -0
- package/dist/{chunk-IP73YCZP.js → chunk-GLPBYIXN.js} +4 -2
- package/dist/chunk-GLPBYIXN.js.map +1 -0
- package/dist/{chunk-4HP7HIE3.js → chunk-HP5FMB6L.js} +2 -2
- package/dist/{chunk-EVZFIAPG.js → chunk-IBTZEBUD.js} +23 -10
- package/dist/chunk-IBTZEBUD.js.map +1 -0
- package/dist/{chunk-DOX2CG6Y.js → chunk-IEUU7O4F.js} +2 -2
- package/dist/{chunk-EUML3N6B.js → chunk-IMA6GU4Y.js} +3 -3
- package/dist/chunk-IMA6GU4Y.js.map +1 -0
- package/dist/{chunk-JNANKJLN.js → chunk-JOASJWQR.js} +2 -2
- package/dist/chunk-JOASJWQR.js.map +1 -0
- package/dist/{chunk-WSGF57U2.js → chunk-JQDZQ4TB.js} +2 -2
- package/dist/{chunk-HINSGUA7.js → chunk-KBL3JJR6.js} +9 -13
- package/dist/chunk-KBL3JJR6.js.map +1 -0
- package/dist/{chunk-IOTENEVL.js → chunk-KGLPJROV.js} +57 -50
- package/dist/chunk-KGLPJROV.js.map +1 -0
- package/dist/{chunk-W7L6HXUC.js → chunk-LXOM6IQU.js} +2 -2
- package/dist/{chunk-G6R5UD3Q.js → chunk-MGN7VHWQ.js} +42 -1
- package/dist/{chunk-G6R5UD3Q.js.map → chunk-MGN7VHWQ.js.map} +1 -1
- package/dist/{chunk-DLJ4IR6M.js → chunk-MHQC2WU2.js} +2 -2
- package/dist/chunk-MHQC2WU2.js.map +1 -0
- package/dist/{chunk-5RPTH6AU.js → chunk-NM5NQYJE.js} +20 -19
- package/dist/chunk-NM5NQYJE.js.map +1 -0
- package/dist/{chunk-6JGNHWCI.js → chunk-OBIRVF36.js} +3 -3
- package/dist/{chunk-CHCA44C3.js → chunk-ODPLEWB6.js} +3 -3
- package/dist/chunk-ODPLEWB6.js.map +1 -0
- package/dist/{chunk-HENLZHIT.js → chunk-OIF36KGD.js} +7 -4
- package/dist/chunk-OIF36KGD.js.map +1 -0
- package/dist/{chunk-GUPISBV2.js → chunk-PP2JH3GP.js} +2 -2
- package/dist/{chunk-OXJBNGBK.js → chunk-PSUB67YB.js} +2 -2
- package/dist/{chunk-UWY7GIVS.js → chunk-PYIFUBRK.js} +45 -13
- package/dist/chunk-PYIFUBRK.js.map +1 -0
- package/dist/{chunk-KIB7SDIJ.js → chunk-Q6YIJGXJ.js} +2 -2
- package/dist/{chunk-ZT3EGNLR.js → chunk-QPD426WT.js} +2 -2
- package/dist/{chunk-RLV3PQGH.js → chunk-QVO4YOB7.js} +6 -6
- package/dist/{chunk-GMAG2HS4.js → chunk-RG3LBSGH.js} +46 -9
- package/dist/chunk-RG3LBSGH.js.map +1 -0
- package/dist/{chunk-XSWKORGM.js → chunk-S53OYO3F.js} +3 -1
- package/dist/chunk-S53OYO3F.js.map +1 -0
- package/dist/{chunk-YCN4BVDK.js → chunk-SCPFRKIT.js} +4 -2
- package/dist/chunk-SCPFRKIT.js.map +1 -0
- package/dist/{chunk-NZPF2SYV.js → chunk-T7N6KQGS.js} +138 -5
- package/dist/chunk-T7N6KQGS.js.map +1 -0
- package/dist/{chunk-VJXSUAO7.js → chunk-TNOWU6RP.js} +13 -10
- package/dist/chunk-TNOWU6RP.js.map +1 -0
- package/dist/{chunk-PCI747N2.js → chunk-TZVQQTG4.js} +48 -19
- package/dist/chunk-TZVQQTG4.js.map +1 -0
- package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-IK7DCC5H.js → chunk-VMGLYN42.js} +2 -2
- package/dist/{chunk-KM2A35EO.js → chunk-WB3LYXC5.js} +11 -7
- package/dist/chunk-WB3LYXC5.js.map +1 -0
- package/dist/{chunk-PPPZY2EU.js → chunk-WD2W4234.js} +9 -3
- package/dist/chunk-WD2W4234.js.map +1 -0
- package/dist/{chunk-NSKYFGDL.js → chunk-X4QQB7O6.js} +2 -2
- package/dist/{chunk-HPWVAEET.js → chunk-X6IRLNOO.js} +3 -7
- package/dist/chunk-X6IRLNOO.js.map +1 -0
- package/dist/{chunk-46GJIW5M.js → chunk-XAZOWLW4.js} +5 -5
- package/dist/{chunk-46GJIW5M.js.map → chunk-XAZOWLW4.js.map} +1 -1
- package/dist/{chunk-XPSVGJYA.js → chunk-YRMKDTKF.js} +12 -9
- package/dist/chunk-YRMKDTKF.js.map +1 -0
- package/dist/{chunk-6ZZP4EJF.js → chunk-ZJR7VG5L.js} +3 -3
- package/dist/{chunk-6ZZP4EJF.js.map → chunk-ZJR7VG5L.js.map} +1 -1
- package/dist/{chunk-2QANQKSQ.js → chunk-ZK32E74R.js} +156 -45
- package/dist/chunk-ZK32E74R.js.map +1 -0
- package/dist/{cli-OrfKXNU4.d.ts → cli-Cw729yLf.d.ts} +6 -2
- package/dist/cli.d.ts +3 -3
- package/dist/cli.js +61 -60
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.js +39 -11
- package/dist/compounding/preference-consolidator.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.js +1 -1
- package/dist/contradiction/index.js +4 -4
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/indexer.js +1 -1
- package/dist/cross-namespace-budget.js +1 -1
- package/dist/enrichment/index.js +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/evals.js +1 -1
- package/dist/explicit-capture.d.ts +11 -1
- package/dist/explicit-capture.js +1 -1
- package/dist/extraction-judge.js +8 -1
- package/dist/extraction.js +2 -2
- package/dist/fallback-llm.d.ts +23 -6
- package/dist/fallback-llm.js +5 -3
- package/dist/{first-start-migration-GYJWIH36.js → first-start-migration-FF7YFGRP.js} +6 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +95 -94
- package/dist/index.js.map +1 -1
- package/dist/lcm/archive.js +2 -2
- package/dist/lcm/engine.js +5 -5
- package/dist/lcm/index.js +7 -7
- package/dist/lcm/summarizer.js +3 -3
- package/dist/maintenance/memory-governance-cron.d.ts +6 -4
- package/dist/maintenance/memory-governance-cron.js +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +2 -2
- package/dist/mcp-memory-inspector-app.js +1 -1
- package/dist/migrate/from-engram.js +1 -1
- package/dist/namespaces/migrate.js +16 -15
- package/dist/namespaces/search.js +12 -11
- package/dist/namespaces/storage.js +3 -3
- package/dist/network/webdav.d.ts +2 -0
- package/dist/network/webdav.js +1 -1
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +3 -1
- package/dist/operator-toolkit.js +21 -20
- package/dist/{orchestrator-DTRQG75J.d.ts → orchestrator-CqWOjfgl.d.ts} +46 -3
- package/dist/orchestrator.d.ts +1 -1
- package/dist/orchestrator.js +48 -45
- package/dist/patterns-cli.js +1 -1
- package/dist/qmd-recall-cache.d.ts +2 -0
- package/dist/qmd-recall-cache.js +1 -1
- package/dist/qmd.d.ts +37 -2
- package/dist/qmd.js +4 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +57 -0
- package/dist/recall-planner-llm.js +167 -0
- package/dist/recall-planner-llm.js.map +1 -0
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/resume-bundles.js +2 -2
- package/dist/retrieval-agents.js +2 -2
- package/dist/routing/store.js +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/factory.js +11 -10
- package/dist/search/index.js +11 -10
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +3 -2
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +3 -2
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/noop-backend.js +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +3 -2
- package/dist/search/port.d.ts +6 -1
- package/dist/search/port.js +7 -0
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/search/remote-backend.js +1 -1
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-state.js +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.js +2 -2
- package/dist/temporal-index.js +1 -1
- package/dist/{tier-stats-SKML2OSF.js → tier-stats-3LYQ3VV5.js} +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-sqlite.js +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/types.d.ts +32 -0
- package/dist/types.js +1 -1
- package/dist/utility-learner.js +1 -1
- package/dist/utility-runtime.js +2 -2
- package/dist/verified-recall.js +3 -3
- package/dist/work/board.js +2 -2
- package/dist/work/storage.d.ts +2 -0
- package/dist/work/storage.js +1 -1
- package/package.json +1 -1
- package/src/access-http.ts +24 -10
- package/src/access-mcp.test.ts +160 -0
- package/src/access-mcp.ts +72 -7
- package/src/access-schema.ts +11 -0
- package/src/access-service-coding-write.test.ts +478 -0
- package/src/access-service.ts +237 -32
- package/src/active-recall.test.ts +40 -0
- package/src/active-recall.ts +19 -2
- package/src/behavior-learner.ts +5 -3
- package/src/buffer-session.test.ts +58 -0
- package/src/buffer-surprise-trigger.test.ts +4 -18
- package/src/buffer.ts +39 -11
- package/src/calibration.ts +10 -4
- package/src/causal-consolidation.test.ts +47 -2
- package/src/causal-consolidation.ts +13 -9
- package/src/cli.ts +19 -4
- package/src/compounding/engine.ts +2 -0
- package/src/compounding/preference-consolidator.test.ts +292 -0
- package/src/compounding/preference-consolidator.ts +55 -19
- package/src/config.test.ts +213 -0
- package/src/config.ts +175 -4
- package/src/connectors/codex-materialize-runner.ts +7 -4
- package/src/consolidation-provenance-check.ts +24 -5
- package/src/conversation-index/indexer.test.ts +22 -0
- package/src/conversation-index/indexer.ts +7 -3
- package/src/cross-namespace-budget.test.ts +44 -21
- package/src/cross-namespace-budget.ts +2 -2
- package/src/enrichment/pipeline.ts +11 -16
- package/src/evals.ts +1 -1
- package/src/explicit-capture.ts +19 -2
- package/src/extraction-judge-chain.test.ts +55 -0
- package/src/extraction-judge.ts +7 -9
- package/src/extraction.ts +16 -5
- package/src/fallback-llm.test.ts +600 -1
- package/src/fallback-llm.ts +91 -22
- package/src/maintenance/memory-governance-cron.ts +39 -29
- package/src/mcp-memory-inspector-app.ts +54 -12
- package/src/message-parts/index.ts +6 -0
- package/src/message-parts/message-parts.test.ts +30 -0
- package/src/migrate/from-engram.ts +19 -5
- package/src/namespaces/search.test.ts +15 -2
- package/src/namespaces/search.ts +1 -1
- package/src/network/webdav.ts +61 -21
- package/src/operator-toolkit.ts +6 -2
- package/src/orchestrator.ts +173 -20
- package/src/qmd-client.test.ts +85 -0
- package/src/qmd-recall-cache.test.ts +16 -0
- package/src/qmd-recall-cache.ts +7 -0
- package/src/qmd.test.ts +54 -0
- package/src/qmd.ts +119 -19
- package/src/recall-planner-llm.test.ts +224 -0
- package/src/recall-planner-llm.ts +289 -0
- package/src/routing/store.ts +4 -8
- package/src/search/factory.ts +3 -0
- package/src/search/lancedb-backend.ts +15 -3
- package/src/search/meilisearch-backend.ts +70 -7
- package/src/search/noop-backend.ts +5 -1
- package/src/search/orama-backend.ts +15 -3
- package/src/search/port.ts +15 -0
- package/src/search/remote-backend.ts +5 -1
- package/src/session-observer-state.ts +1 -1
- package/src/summarizer.ts +3 -3
- package/src/temporal-index.test.ts +18 -0
- package/src/temporal-index.ts +45 -0
- package/src/training-export/cli-date-validation.test.ts +36 -0
- package/src/training-export/date-parse.ts +21 -2
- package/src/transfer/export-sqlite.ts +3 -0
- package/src/types.ts +35 -0
- package/src/utility-learner.ts +1 -0
- package/src/work/storage.ts +23 -0
- package/dist/chunk-2QANQKSQ.js.map +0 -1
- package/dist/chunk-5RPTH6AU.js.map +0 -1
- package/dist/chunk-AJA46VX5.js.map +0 -1
- package/dist/chunk-C4SQJZAF.js.map +0 -1
- package/dist/chunk-CHCA44C3.js.map +0 -1
- package/dist/chunk-CSKLPDN6.js.map +0 -1
- package/dist/chunk-DLJ4IR6M.js.map +0 -1
- package/dist/chunk-EAZGEEG2.js.map +0 -1
- package/dist/chunk-EUML3N6B.js.map +0 -1
- package/dist/chunk-EVZFIAPG.js.map +0 -1
- package/dist/chunk-G3Z3QEF5.js.map +0 -1
- package/dist/chunk-GMAG2HS4.js.map +0 -1
- package/dist/chunk-HENLZHIT.js.map +0 -1
- package/dist/chunk-HINSGUA7.js.map +0 -1
- package/dist/chunk-HJNQQICM.js.map +0 -1
- package/dist/chunk-HPWVAEET.js.map +0 -1
- package/dist/chunk-IOTENEVL.js.map +0 -1
- package/dist/chunk-IP73YCZP.js.map +0 -1
- package/dist/chunk-JHMFYY7L.js.map +0 -1
- package/dist/chunk-JNANKJLN.js.map +0 -1
- package/dist/chunk-KGK2QKWL.js.map +0 -1
- package/dist/chunk-KM2A35EO.js.map +0 -1
- package/dist/chunk-KVEVLBKC.js.map +0 -1
- package/dist/chunk-L227SKTB.js.map +0 -1
- package/dist/chunk-LZ3VEOU5.js.map +0 -1
- package/dist/chunk-NOMEVTUD.js.map +0 -1
- package/dist/chunk-NZPF2SYV.js.map +0 -1
- package/dist/chunk-PCI747N2.js.map +0 -1
- package/dist/chunk-PPPZY2EU.js.map +0 -1
- package/dist/chunk-TH67Q46T.js.map +0 -1
- package/dist/chunk-UWY7GIVS.js.map +0 -1
- package/dist/chunk-VJXSUAO7.js.map +0 -1
- package/dist/chunk-XKIQZXUB.js.map +0 -1
- package/dist/chunk-XPSVGJYA.js.map +0 -1
- package/dist/chunk-XSWKORGM.js.map +0 -1
- package/dist/chunk-YCN4BVDK.js.map +0 -1
- package/dist/chunk-ZDTVJXIP.js.map +0 -1
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-AU7Q3LSC.js.map → chunk-2QSZNTDO.js.map} +0 -0
- /package/dist/{chunk-HSVJGWYS.js.map → chunk-2ROPI5OE.js.map} +0 -0
- /package/dist/{chunk-CF3ZF2YU.js.map → chunk-3QSU4NFF.js.map} +0 -0
- /package/dist/{chunk-OI27U2HT.js.map → chunk-5BTCT236.js.map} +0 -0
- /package/dist/{chunk-CO7ZO4TU.js.map → chunk-5VDJMYTF.js.map} +0 -0
- /package/dist/{chunk-YFS5OEKO.js.map → chunk-7MLB4NCL.js.map} +0 -0
- /package/dist/{chunk-557IAFPD.js.map → chunk-APRRL26Q.js.map} +0 -0
- /package/dist/{chunk-QDDHYAKV.js.map → chunk-AZDOWD2L.js.map} +0 -0
- /package/dist/{chunk-MLT75J5S.js.map → chunk-B6SU7YSE.js.map} +0 -0
- /package/dist/{chunk-FXKPZ3H6.js.map → chunk-BPSGLMQ4.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-IK34DVAC.js.map → chunk-CIOMS6DI.js.map} +0 -0
- /package/dist/{chunk-7DZRO2DC.js.map → chunk-DEPRLVLK.js.map} +0 -0
- /package/dist/{chunk-DHGSZ3UD.js.map → chunk-DGNQRNLL.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-ETUPBUHB.js.map → chunk-GDASG7NC.js.map} +0 -0
- /package/dist/{chunk-4HP7HIE3.js.map → chunk-HP5FMB6L.js.map} +0 -0
- /package/dist/{chunk-DOX2CG6Y.js.map → chunk-IEUU7O4F.js.map} +0 -0
- /package/dist/{chunk-WSGF57U2.js.map → chunk-JQDZQ4TB.js.map} +0 -0
- /package/dist/{chunk-W7L6HXUC.js.map → chunk-LXOM6IQU.js.map} +0 -0
- /package/dist/{chunk-6JGNHWCI.js.map → chunk-OBIRVF36.js.map} +0 -0
- /package/dist/{chunk-GUPISBV2.js.map → chunk-PP2JH3GP.js.map} +0 -0
- /package/dist/{chunk-OXJBNGBK.js.map → chunk-PSUB67YB.js.map} +0 -0
- /package/dist/{chunk-KIB7SDIJ.js.map → chunk-Q6YIJGXJ.js.map} +0 -0
- /package/dist/{chunk-ZT3EGNLR.js.map → chunk-QPD426WT.js.map} +0 -0
- /package/dist/{chunk-RLV3PQGH.js.map → chunk-QVO4YOB7.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-IK7DCC5H.js.map → chunk-VMGLYN42.js.map} +0 -0
- /package/dist/{chunk-NSKYFGDL.js.map → chunk-X4QQB7O6.js.map} +0 -0
- /package/dist/{first-start-migration-GYJWIH36.js.map → first-start-migration-FF7YFGRP.js.map} +0 -0
- /package/dist/{tier-stats-SKML2OSF.js.map → tier-stats-3LYQ3VV5.js.map} +0 -0
package/dist/access-schema.d.ts
CHANGED
|
@@ -111,8 +111,8 @@ declare const recallRequestSchema: z.ZodObject<{
|
|
|
111
111
|
mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
|
|
112
112
|
cwd?: string | undefined;
|
|
113
113
|
includeLowConfidence?: boolean | undefined;
|
|
114
|
-
disclosure?: "chunk" | "section" | "raw" | undefined;
|
|
115
114
|
idempotencyKey?: string | undefined;
|
|
115
|
+
disclosure?: "chunk" | "section" | "raw" | undefined;
|
|
116
116
|
asOf?: string | undefined;
|
|
117
117
|
includeDebug?: boolean | undefined;
|
|
118
118
|
codingContext?: {
|
|
@@ -132,8 +132,8 @@ declare const recallRequestSchema: z.ZodObject<{
|
|
|
132
132
|
mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
|
|
133
133
|
cwd?: string | undefined;
|
|
134
134
|
includeLowConfidence?: boolean | undefined;
|
|
135
|
-
disclosure?: "chunk" | "section" | "raw" | undefined;
|
|
136
135
|
idempotencyKey?: string | undefined;
|
|
136
|
+
disclosure?: "chunk" | "section" | "raw" | undefined;
|
|
137
137
|
asOf?: string | undefined;
|
|
138
138
|
includeDebug?: boolean | undefined;
|
|
139
139
|
codingContext?: {
|
|
@@ -241,20 +241,20 @@ declare const observeRequestSchema: z.ZodObject<{
|
|
|
241
241
|
}, "strip", z.ZodTypeAny, {
|
|
242
242
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
243
243
|
payload: Record<string, unknown>;
|
|
244
|
-
|
|
244
|
+
ordinal?: number | null | undefined;
|
|
245
245
|
toolName?: string | null | undefined;
|
|
246
|
+
tool_name?: string | null | undefined;
|
|
246
247
|
filePath?: string | null | undefined;
|
|
247
|
-
ordinal?: number | null | undefined;
|
|
248
248
|
file_path?: string | null | undefined;
|
|
249
249
|
createdAt?: string | null | undefined;
|
|
250
250
|
created_at?: string | null | undefined;
|
|
251
251
|
}, {
|
|
252
252
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
253
253
|
payload: Record<string, unknown>;
|
|
254
|
-
|
|
254
|
+
ordinal?: number | null | undefined;
|
|
255
255
|
toolName?: string | null | undefined;
|
|
256
|
+
tool_name?: string | null | undefined;
|
|
256
257
|
filePath?: string | null | undefined;
|
|
257
|
-
ordinal?: number | null | undefined;
|
|
258
258
|
file_path?: string | null | undefined;
|
|
259
259
|
createdAt?: string | null | undefined;
|
|
260
260
|
created_at?: string | null | undefined;
|
|
@@ -265,10 +265,10 @@ declare const observeRequestSchema: z.ZodObject<{
|
|
|
265
265
|
parts?: {
|
|
266
266
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
267
267
|
payload: Record<string, unknown>;
|
|
268
|
-
|
|
268
|
+
ordinal?: number | null | undefined;
|
|
269
269
|
toolName?: string | null | undefined;
|
|
270
|
+
tool_name?: string | null | undefined;
|
|
270
271
|
filePath?: string | null | undefined;
|
|
271
|
-
ordinal?: number | null | undefined;
|
|
272
272
|
file_path?: string | null | undefined;
|
|
273
273
|
createdAt?: string | null | undefined;
|
|
274
274
|
created_at?: string | null | undefined;
|
|
@@ -281,10 +281,10 @@ declare const observeRequestSchema: z.ZodObject<{
|
|
|
281
281
|
parts?: {
|
|
282
282
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
283
283
|
payload: Record<string, unknown>;
|
|
284
|
-
|
|
284
|
+
ordinal?: number | null | undefined;
|
|
285
285
|
toolName?: string | null | undefined;
|
|
286
|
+
tool_name?: string | null | undefined;
|
|
286
287
|
filePath?: string | null | undefined;
|
|
287
|
-
ordinal?: number | null | undefined;
|
|
288
288
|
file_path?: string | null | undefined;
|
|
289
289
|
createdAt?: string | null | undefined;
|
|
290
290
|
created_at?: string | null | undefined;
|
|
@@ -309,10 +309,10 @@ declare const observeRequestSchema: z.ZodObject<{
|
|
|
309
309
|
parts?: {
|
|
310
310
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
311
311
|
payload: Record<string, unknown>;
|
|
312
|
-
|
|
312
|
+
ordinal?: number | null | undefined;
|
|
313
313
|
toolName?: string | null | undefined;
|
|
314
|
+
tool_name?: string | null | undefined;
|
|
314
315
|
filePath?: string | null | undefined;
|
|
315
|
-
ordinal?: number | null | undefined;
|
|
316
316
|
file_path?: string | null | undefined;
|
|
317
317
|
createdAt?: string | null | undefined;
|
|
318
318
|
created_at?: string | null | undefined;
|
|
@@ -332,10 +332,10 @@ declare const observeRequestSchema: z.ZodObject<{
|
|
|
332
332
|
parts?: {
|
|
333
333
|
kind: "text" | "tool_call" | "tool_result" | "patch" | "file_read" | "file_write" | "step_start" | "step_finish" | "snapshot" | "retry";
|
|
334
334
|
payload: Record<string, unknown>;
|
|
335
|
-
|
|
335
|
+
ordinal?: number | null | undefined;
|
|
336
336
|
toolName?: string | null | undefined;
|
|
337
|
+
tool_name?: string | null | undefined;
|
|
337
338
|
filePath?: string | null | undefined;
|
|
338
|
-
ordinal?: number | null | undefined;
|
|
339
339
|
file_path?: string | null | undefined;
|
|
340
340
|
createdAt?: string | null | undefined;
|
|
341
341
|
created_at?: string | null | undefined;
|
|
@@ -361,6 +361,8 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
|
|
|
361
361
|
entityRef: z.ZodOptional<z.ZodString>;
|
|
362
362
|
ttl: z.ZodOptional<z.ZodString>;
|
|
363
363
|
sourceReason: z.ZodOptional<z.ZodString>;
|
|
364
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
365
|
+
projectTag: z.ZodOptional<z.ZodString>;
|
|
364
366
|
}, "strip", z.ZodTypeAny, {
|
|
365
367
|
content: string;
|
|
366
368
|
schemaVersion?: number | undefined;
|
|
@@ -373,7 +375,9 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
|
|
|
373
375
|
entityRef?: string | undefined;
|
|
374
376
|
ttl?: string | undefined;
|
|
375
377
|
sourceReason?: string | undefined;
|
|
378
|
+
cwd?: string | undefined;
|
|
376
379
|
idempotencyKey?: string | undefined;
|
|
380
|
+
projectTag?: string | undefined;
|
|
377
381
|
}, {
|
|
378
382
|
content: string;
|
|
379
383
|
schemaVersion?: number | undefined;
|
|
@@ -386,7 +390,9 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
|
|
|
386
390
|
entityRef?: string | undefined;
|
|
387
391
|
ttl?: string | undefined;
|
|
388
392
|
sourceReason?: string | undefined;
|
|
393
|
+
cwd?: string | undefined;
|
|
389
394
|
idempotencyKey?: string | undefined;
|
|
395
|
+
projectTag?: string | undefined;
|
|
390
396
|
}>;
|
|
391
397
|
declare const suggestionSubmitRequestSchema: z.ZodObject<{
|
|
392
398
|
schemaVersion: z.ZodOptional<z.ZodNumber>;
|
|
@@ -401,6 +407,8 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
|
|
|
401
407
|
entityRef: z.ZodOptional<z.ZodString>;
|
|
402
408
|
ttl: z.ZodOptional<z.ZodString>;
|
|
403
409
|
sourceReason: z.ZodOptional<z.ZodString>;
|
|
410
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
411
|
+
projectTag: z.ZodOptional<z.ZodString>;
|
|
404
412
|
}, "strip", z.ZodTypeAny, {
|
|
405
413
|
content: string;
|
|
406
414
|
schemaVersion?: number | undefined;
|
|
@@ -413,7 +421,9 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
|
|
|
413
421
|
entityRef?: string | undefined;
|
|
414
422
|
ttl?: string | undefined;
|
|
415
423
|
sourceReason?: string | undefined;
|
|
424
|
+
cwd?: string | undefined;
|
|
416
425
|
idempotencyKey?: string | undefined;
|
|
426
|
+
projectTag?: string | undefined;
|
|
417
427
|
}, {
|
|
418
428
|
content: string;
|
|
419
429
|
schemaVersion?: number | undefined;
|
|
@@ -426,7 +436,9 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
|
|
|
426
436
|
entityRef?: string | undefined;
|
|
427
437
|
ttl?: string | undefined;
|
|
428
438
|
sourceReason?: string | undefined;
|
|
439
|
+
cwd?: string | undefined;
|
|
429
440
|
idempotencyKey?: string | undefined;
|
|
441
|
+
projectTag?: string | undefined;
|
|
430
442
|
}>;
|
|
431
443
|
declare const reviewDispositionRequestSchema: z.ZodObject<{
|
|
432
444
|
memoryId: z.ZodString;
|
package/dist/access-schema.js
CHANGED
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
trustZoneDemoSeedRequestSchema,
|
|
26
26
|
trustZonePromoteRequestSchema,
|
|
27
27
|
validateRequest
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-WD2W4234.js";
|
|
29
|
+
import "./chunk-VDX2J7OX.js";
|
|
30
30
|
import "./chunk-WEHSQBFR.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-DQEMWVMT.js";
|
|
32
32
|
import "./chunk-J4EB7DNW.js";
|
|
33
33
|
import "./chunk-BJMBJZ2Y.js";
|
|
34
34
|
import "./chunk-UKJAGEXH.js";
|
|
@@ -6,7 +6,7 @@ import { AnomalyDetectorResult } from './recall-audit-anomaly.js';
|
|
|
6
6
|
import { ExplicitCaptureInput } from './explicit-capture.js';
|
|
7
7
|
import { BudgetDecision } from './cross-namespace-budget.js';
|
|
8
8
|
import { readMemoryGovernanceRunArtifact } from './maintenance/memory-governance.js';
|
|
9
|
-
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot, P as PatternReinforcementResult } from './orchestrator-
|
|
9
|
+
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot, P as PatternReinforcementResult } from './orchestrator-CqWOjfgl.js';
|
|
10
10
|
import { LiveConnectorsRunSummary } from './live-connectors-runner.js';
|
|
11
11
|
import { LastRecallSnapshot } from './recall-state.js';
|
|
12
12
|
import { GraphSnapshotRequest, GraphSnapshotResponse } from './graph-snapshot.js';
|
|
@@ -644,9 +644,18 @@ interface EngramAccessWriteEnvelope {
|
|
|
644
644
|
*/
|
|
645
645
|
authenticatedPrincipal?: string;
|
|
646
646
|
}
|
|
647
|
-
|
|
647
|
+
/**
|
|
648
|
+
* Optional git/project context for project-scoped writes (#1434). When no
|
|
649
|
+
* explicit `namespace` is supplied, these route the write to the same project
|
|
650
|
+
* namespace recall/observe resolve from `cwd`/`projectTag` (rule 42 symmetry).
|
|
651
|
+
*/
|
|
652
|
+
interface CodingScopedWriteInput {
|
|
653
|
+
cwd?: string;
|
|
654
|
+
projectTag?: string;
|
|
648
655
|
}
|
|
649
|
-
interface
|
|
656
|
+
interface EngramAccessMemoryStoreRequest extends EngramAccessWriteEnvelope, ExplicitCaptureInput, CodingScopedWriteInput {
|
|
657
|
+
}
|
|
658
|
+
interface EngramAccessSuggestionSubmitRequest extends EngramAccessWriteEnvelope, ExplicitCaptureInput, CodingScopedWriteInput {
|
|
650
659
|
}
|
|
651
660
|
interface EngramAccessWriteResponse {
|
|
652
661
|
schemaVersion: 1;
|
|
@@ -774,6 +783,47 @@ declare class EngramAccessService {
|
|
|
774
783
|
private resolveRecallNamespace;
|
|
775
784
|
private resolveRequestPrincipal;
|
|
776
785
|
private resolveWritableNamespace;
|
|
786
|
+
/**
|
|
787
|
+
* Resolve a coding context from `cwd`/`projectTag` WITHOUT persisting it to
|
|
788
|
+
* any session — the read-only half of `maybeAttachCodingContext`. Returns
|
|
789
|
+
* null when project scoping is off or nothing resolves. `projectTag` takes
|
|
790
|
+
* priority over `cwd` (matching `maybeAttachCodingContext`).
|
|
791
|
+
*/
|
|
792
|
+
private resolveCodingContextFromOptions;
|
|
793
|
+
/**
|
|
794
|
+
* Resolve the write namespace for explicit-write tools (memory_store /
|
|
795
|
+
* suggestion_submit), project-scoping the write the same way recall does so a
|
|
796
|
+
* memory stored with a client-injected `cwd`/`projectTag` is discoverable by
|
|
797
|
+
* project-scoped recall (#1434, rule 42).
|
|
798
|
+
*
|
|
799
|
+
* Precedence:
|
|
800
|
+
* - An explicit `namespace` always wins and is authorized strictly via
|
|
801
|
+
* `resolveWritableNamespace` → `canWriteNamespace`. A coding-overlay
|
|
802
|
+
* namespace string (`<base>-project-*`) is NOT a writable target via the
|
|
803
|
+
* explicit field — project scoping is requested with `cwd`/`projectTag`,
|
|
804
|
+
* never by naming the derived namespace — so there is no way to bypass the
|
|
805
|
+
* policy allow-list by guessing/forging an overlay name (Codex review).
|
|
806
|
+
* - With NO coding overlay, the write stays on `config.defaultNamespace` —
|
|
807
|
+
* exactly the pre-#1434 behavior, so an unqualified write is NOT silently
|
|
808
|
+
* moved to a principal self namespace (Codex review).
|
|
809
|
+
* - WITH a coding overlay, the base is the principal self namespace
|
|
810
|
+
* (`defaultNamespaceForPrincipal`, write-checked) — the SAME base recall,
|
|
811
|
+
* observe, and the orchestrator buffer-flush write path overlay onto
|
|
812
|
+
* (rule 42 / Cursor) — so a project-scoped store lands exactly where
|
|
813
|
+
* project-scoped recall searches. The overlay namespace is always REBUILT
|
|
814
|
+
* from the authenticated principal's base, never accepted as a caller
|
|
815
|
+
* string, so a caller can never reach another principal's subtree.
|
|
816
|
+
*
|
|
817
|
+
* Read-only: this NEVER mutates session coding context, so the idempotency
|
|
818
|
+
* peeks and dryRun preflights that call it stay side-effect free (Codex
|
|
819
|
+
* review). It prefers the per-call `cwd`/`projectTag` (the project explicitly
|
|
820
|
+
* identified for this write), else the session's existing context. The HTTP
|
|
821
|
+
* surface lets the peek and the write each resolve independently; the peek's
|
|
822
|
+
* namespace only gates rate-limiting (memory_store/suggestion_submit run their
|
|
823
|
+
* own idempotency check), so a benign session-context change between the two
|
|
824
|
+
* never fails a write — there is no namespace to "pin".
|
|
825
|
+
*/
|
|
826
|
+
private resolveCodingScopedWriteNamespace;
|
|
777
827
|
private objectiveStateStoreLocationForNamespace;
|
|
778
828
|
private resolveReadableNamespace;
|
|
779
829
|
private buildRecallDebug;
|
|
@@ -831,6 +881,17 @@ declare class EngramAccessService {
|
|
|
831
881
|
* being in a repo is a normal runtime state.
|
|
832
882
|
*/
|
|
833
883
|
private maybeAttachCodingContext;
|
|
884
|
+
/**
|
|
885
|
+
* Seed the session's coding binding AFTER a committed, project-scoped explicit
|
|
886
|
+
* write (memory_store / suggestion_submit), mirroring the recall path's
|
|
887
|
+
* `maybeAttachCodingContext` so a later bare recall/write on the same session
|
|
888
|
+
* is scoped to the same project. Called only from the post-persist path, so it
|
|
889
|
+
* never fires on dryRun, replay/conflict, or quota-rejected requests. Skips
|
|
890
|
+
* when an explicit `namespace` was supplied — that write bypassed the coding
|
|
891
|
+
* overlay, so binding the session to a project it never wrote to would make
|
|
892
|
+
* later bare recalls miss (Codex review).
|
|
893
|
+
*/
|
|
894
|
+
private attachCodingContextAfterScopedWrite;
|
|
834
895
|
recall(request: EngramAccessRecallRequest): Promise<EngramAccessRecallResponse>;
|
|
835
896
|
private executeRecall;
|
|
836
897
|
recallExplain(request?: EngramAccessRecallExplainRequest): Promise<EngramAccessRecallExplainResponse>;
|
|
@@ -889,9 +950,13 @@ declare class EngramAccessService {
|
|
|
889
950
|
recall?: EngramAccessRecallResponse;
|
|
890
951
|
}>;
|
|
891
952
|
private xrayQueue;
|
|
892
|
-
memoryStore(request: EngramAccessMemoryStoreRequest
|
|
953
|
+
memoryStore(request: EngramAccessMemoryStoreRequest, hooks?: {
|
|
954
|
+
enforceWriteQuota?: () => void | Promise<void>;
|
|
955
|
+
}): Promise<EngramAccessWriteResponse>;
|
|
893
956
|
peekMemoryStoreIdempotency(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessIdempotencyStatus>;
|
|
894
|
-
suggestionSubmit(request: EngramAccessSuggestionSubmitRequest
|
|
957
|
+
suggestionSubmit(request: EngramAccessSuggestionSubmitRequest, hooks?: {
|
|
958
|
+
enforceWriteQuota?: () => void | Promise<void>;
|
|
959
|
+
}): Promise<EngramAccessWriteResponse>;
|
|
895
960
|
peekSuggestionSubmitIdempotency(request: EngramAccessSuggestionSubmitRequest): Promise<EngramAccessIdempotencyStatus>;
|
|
896
961
|
private validateWriteCandidate;
|
|
897
962
|
memoryGet(memoryId: string, namespace?: string, principal?: string): Promise<EngramAccessMemoryResponse>;
|
|
@@ -1489,4 +1554,4 @@ declare class EngramAccessService {
|
|
|
1489
1554
|
}): Promise<DreamsRunResult>;
|
|
1490
1555
|
}
|
|
1491
1556
|
|
|
1492
|
-
export { type
|
|
1557
|
+
export { type EngramAccessReviewDispositionRequest as $, type EngramAccessMemoryBrowseRequest as A, type EngramAccessMemoryBrowseResponse as B, type CodingScopedWriteInput as C, type EngramAccessMemoryRecord as D, EngramAccessService as E, type EngramAccessMemoryResponse as F, type EngramAccessMemoryStoreRequest as G, type EngramAccessMemorySummary as H, type EngramAccessObserveMessage as I, type EngramAccessObserveRequest as J, type EngramAccessObserveResponse as K, type EngramAccessOfflineSyncApplyFileContentRequest as L, type EngramAccessOfflineSyncApplyFileContentResponse as M, type EngramAccessOfflineSyncApplyRequest as N, type EngramAccessOfflineSyncApplyResponse as O, type ProcedureStatsConfigSnapshot as P, type EngramAccessOfflineSyncFileContentRequest as Q, type EngramAccessOfflineSyncFileContentResponse as R, type EngramAccessOfflineSyncFilesRequest as S, type EngramAccessOfflineSyncFilesResponse as T, type EngramAccessOfflineSyncSnapshotRequest as U, type EngramAccessOfflineSyncSnapshotResponse as V, type EngramAccessOfflineSyncSnapshotStreamResponse as W, type EngramAccessQualityResponse as X, type EngramAccessRecallExplainRequest as Y, type EngramAccessRecallExplainResponse as Z, type EngramAccessRecallRequest as _, type EngramAccessRecallResponse as a, type EngramAccessReviewDispositionResponse as a0, type EngramAccessReviewQueueResponse as a1, type EngramAccessSetCodingContextRequest as a2, type EngramAccessSuggestionSubmitRequest as a3, type EngramAccessTimelineResponse as a4, type EngramAccessTrustZoneBrowseRequest as a5, type EngramAccessTrustZoneBrowseResponse as a6, type EngramAccessTrustZoneDemoSeedRequest as a7, type EngramAccessTrustZoneDemoSeedResponse as a8, type EngramAccessTrustZonePromoteRequest as a9, type EngramAccessTrustZonePromoteResponse as aa, type EngramAccessTrustZoneRecordSummary as ab, type EngramAccessTrustZoneStatusResponse as ac, type EngramAccessWriteEnvelope as ad, type EngramAccessWriteResponse as ae, shapeMemorySummary as af, EngramAccessInputError as b, type ProcedureStatsRecent as c, type ProcedureStatsReport as d, type ProcedureStatusCounts as e, computeProcedureStats as f, formatProcedureStatsText as g, ENGRAM_ACCESS_WRITE_SCHEMA_VERSION as h, type EngramAccessActionConfidenceRequest as i, type EngramAccessActionConfidenceResponse as j, type EngramAccessBriefingRequest as k, type EngramAccessBriefingResponse as l, type EngramAccessCapsuleListResponse as m, type EngramAccessDaySummaryRequest as n, type EngramAccessEntityListResponse as o, type EngramAccessEntityResponse as p, type EngramAccessEntitySummary as q, type EngramAccessHealthResponse as r, type EngramAccessLcmCompactionFlushRequest as s, type EngramAccessLcmCompactionFlushResponse as t, type EngramAccessLcmCompactionRecordRequest as u, type EngramAccessLcmCompactionRecordResponse as v, type EngramAccessLcmSearchRequest as w, type EngramAccessLcmSearchResponse as x, type EngramAccessLcmStatusResponse as y, type EngramAccessMaintenanceResponse as z };
|
package/dist/access-service.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import './storage.js';
|
|
2
2
|
import './types-B1VHaf2w.js';
|
|
3
|
-
export { h as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, i as EngramAccessActionConfidenceRequest, j as EngramAccessActionConfidenceResponse, k as EngramAccessBriefingRequest, l as EngramAccessBriefingResponse, m as EngramAccessCapsuleListResponse, n as EngramAccessDaySummaryRequest, o as EngramAccessEntityListResponse, p as EngramAccessEntityResponse, q as EngramAccessEntitySummary, r as EngramAccessHealthResponse, b as EngramAccessInputError, s as EngramAccessLcmCompactionFlushRequest, t as EngramAccessLcmCompactionFlushResponse, u as EngramAccessLcmCompactionRecordRequest, v as EngramAccessLcmCompactionRecordResponse, w as EngramAccessLcmSearchRequest, x as EngramAccessLcmSearchResponse, y as EngramAccessLcmStatusResponse, z as EngramAccessMaintenanceResponse, A as EngramAccessMemoryBrowseRequest, B as EngramAccessMemoryBrowseResponse,
|
|
3
|
+
export { C as CodingScopedWriteInput, h as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, i as EngramAccessActionConfidenceRequest, j as EngramAccessActionConfidenceResponse, k as EngramAccessBriefingRequest, l as EngramAccessBriefingResponse, m as EngramAccessCapsuleListResponse, n as EngramAccessDaySummaryRequest, o as EngramAccessEntityListResponse, p as EngramAccessEntityResponse, q as EngramAccessEntitySummary, r as EngramAccessHealthResponse, b as EngramAccessInputError, s as EngramAccessLcmCompactionFlushRequest, t as EngramAccessLcmCompactionFlushResponse, u as EngramAccessLcmCompactionRecordRequest, v as EngramAccessLcmCompactionRecordResponse, w as EngramAccessLcmSearchRequest, x as EngramAccessLcmSearchResponse, y as EngramAccessLcmStatusResponse, z as EngramAccessMaintenanceResponse, A as EngramAccessMemoryBrowseRequest, B as EngramAccessMemoryBrowseResponse, D as EngramAccessMemoryRecord, F as EngramAccessMemoryResponse, G as EngramAccessMemoryStoreRequest, H as EngramAccessMemorySummary, I as EngramAccessObserveMessage, J as EngramAccessObserveRequest, K as EngramAccessObserveResponse, L as EngramAccessOfflineSyncApplyFileContentRequest, M as EngramAccessOfflineSyncApplyFileContentResponse, N as EngramAccessOfflineSyncApplyRequest, O as EngramAccessOfflineSyncApplyResponse, Q as EngramAccessOfflineSyncFileContentRequest, R as EngramAccessOfflineSyncFileContentResponse, S as EngramAccessOfflineSyncFilesRequest, T as EngramAccessOfflineSyncFilesResponse, U as EngramAccessOfflineSyncSnapshotRequest, V as EngramAccessOfflineSyncSnapshotResponse, W as EngramAccessOfflineSyncSnapshotStreamResponse, X as EngramAccessQualityResponse, Y as EngramAccessRecallExplainRequest, Z as EngramAccessRecallExplainResponse, _ as EngramAccessRecallRequest, a as EngramAccessRecallResponse, $ as EngramAccessReviewDispositionRequest, a0 as EngramAccessReviewDispositionResponse, a1 as EngramAccessReviewQueueResponse, E as EngramAccessService, a2 as EngramAccessSetCodingContextRequest, a3 as EngramAccessSuggestionSubmitRequest, a4 as EngramAccessTimelineResponse, a5 as EngramAccessTrustZoneBrowseRequest, a6 as EngramAccessTrustZoneBrowseResponse, a7 as EngramAccessTrustZoneDemoSeedRequest, a8 as EngramAccessTrustZoneDemoSeedResponse, a9 as EngramAccessTrustZonePromoteRequest, aa as EngramAccessTrustZonePromoteResponse, ab as EngramAccessTrustZoneRecordSummary, ac as EngramAccessTrustZoneStatusResponse, ad as EngramAccessWriteEnvelope, ae as EngramAccessWriteResponse, af as shapeMemorySummary } from './access-service-CBNEKjzN.js';
|
|
4
4
|
import './recall-explain-renderer.js';
|
|
5
5
|
import './types.js';
|
|
6
6
|
import './recall-audit-anomaly.js';
|
|
7
7
|
import './explicit-capture.js';
|
|
8
8
|
import './cross-namespace-budget.js';
|
|
9
9
|
import './maintenance/memory-governance.js';
|
|
10
|
-
import './orchestrator-
|
|
10
|
+
import './orchestrator-CqWOjfgl.js';
|
|
11
11
|
import './live-connectors-runner.js';
|
|
12
12
|
import './recall-state.js';
|
|
13
13
|
import './graph-snapshot.js';
|
package/dist/access-service.js
CHANGED
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
EngramAccessInputError,
|
|
4
4
|
EngramAccessService,
|
|
5
5
|
shapeMemorySummary
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-OXJBNGBK.js";
|
|
6
|
+
} from "./chunk-ZK32E74R.js";
|
|
7
|
+
import "./chunk-GDASG7NC.js";
|
|
8
|
+
import "./chunk-GDB4J2H3.js";
|
|
9
|
+
import "./chunk-DGNQRNLL.js";
|
|
10
|
+
import "./chunk-PSUB67YB.js";
|
|
12
11
|
import "./chunk-SOBJ6NEY.js";
|
|
12
|
+
import "./chunk-BT7NVCML.js";
|
|
13
13
|
import "./chunk-H7XKCNR6.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-5BTCT236.js";
|
|
15
15
|
import "./chunk-EDQVAMQI.js";
|
|
16
16
|
import "./chunk-JGSKJHF7.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-BPSGLMQ4.js";
|
|
18
|
+
import "./chunk-JQDZQ4TB.js";
|
|
19
|
+
import "./chunk-CI7RKSRE.js";
|
|
20
20
|
import "./chunk-UEY3VB6W.js";
|
|
21
21
|
import "./chunk-EIR5VLIH.js";
|
|
22
22
|
import "./chunk-7V2SGZ3H.js";
|
|
@@ -24,16 +24,16 @@ import "./chunk-EI6V5UXY.js";
|
|
|
24
24
|
import "./chunk-QY7YA7OL.js";
|
|
25
25
|
import "./chunk-NNVTUXEB.js";
|
|
26
26
|
import "./chunk-QDW3E4RD.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-IMA6GU4Y.js";
|
|
28
|
+
import "./chunk-ODPLEWB6.js";
|
|
29
29
|
import "./chunk-XL7FK7PJ.js";
|
|
30
30
|
import "./chunk-2LSZVONP.js";
|
|
31
31
|
import "./chunk-DEUNUKTD.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-AZDOWD2L.js";
|
|
33
|
+
import "./chunk-7MLB4NCL.js";
|
|
34
34
|
import "./chunk-5UZXUTVO.js";
|
|
35
35
|
import "./chunk-4H5ZJHEN.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-4R4KTDIE.js";
|
|
37
37
|
import "./chunk-RULE4VG5.js";
|
|
38
38
|
import "./chunk-SCU65EZI.js";
|
|
39
39
|
import "./chunk-KILOTVIF.js";
|
|
@@ -60,9 +60,9 @@ import "./chunk-TVVEYCNW.js";
|
|
|
60
60
|
import "./chunk-RFYAYKTD.js";
|
|
61
61
|
import "./chunk-LBLXEFWK.js";
|
|
62
62
|
import "./chunk-VFUEZZBS.js";
|
|
63
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-VDX2J7OX.js";
|
|
64
64
|
import "./chunk-WEHSQBFR.js";
|
|
65
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-DQEMWVMT.js";
|
|
66
66
|
import "./chunk-J4EB7DNW.js";
|
|
67
67
|
import "./chunk-BJMBJZ2Y.js";
|
|
68
68
|
import "./chunk-UKJAGEXH.js";
|
package/dist/active-recall.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-6MKAMLQL.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_REASONING_MODEL
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T7N6KQGS.js";
|
|
8
8
|
import "./chunk-PHK3HARR.js";
|
|
9
9
|
import "./chunk-Z5LAYHGJ.js";
|
|
10
10
|
import "./chunk-4DJQYKMN.js";
|
|
@@ -230,11 +230,26 @@ function createActiveRecallEngine(deps, config) {
|
|
|
230
230
|
}
|
|
231
231
|
const cached = cache.get(cacheKey);
|
|
232
232
|
if (cacheEnabled && cached) {
|
|
233
|
-
|
|
233
|
+
const result2 = {
|
|
234
234
|
...cloneRecallResult(cached.value),
|
|
235
235
|
latencyMs: Math.max(0, now() - currentTime),
|
|
236
236
|
cacheHit: true
|
|
237
237
|
};
|
|
238
|
+
result2.transcriptPath = null;
|
|
239
|
+
if (config.persistTranscripts) {
|
|
240
|
+
try {
|
|
241
|
+
result2.transcriptPath = await appendActiveRecallTranscript(
|
|
242
|
+
config.transcriptDir,
|
|
243
|
+
input,
|
|
244
|
+
config,
|
|
245
|
+
result2,
|
|
246
|
+
queryBundle
|
|
247
|
+
);
|
|
248
|
+
} catch {
|
|
249
|
+
result2.transcriptPath = null;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return result2;
|
|
238
253
|
}
|
|
239
254
|
const start = currentTime;
|
|
240
255
|
const recallContext = await deps.recall(queryBundle, input.sessionKey);
|
|
@@ -303,9 +318,11 @@ function createActiveRecallEngine(deps, config) {
|
|
|
303
318
|
}
|
|
304
319
|
if (cacheEnabled) {
|
|
305
320
|
const completedAt = now();
|
|
321
|
+
const cachedValue = cloneRecallResult(result);
|
|
322
|
+
cachedValue.transcriptPath = null;
|
|
306
323
|
cache.set(cacheKey, {
|
|
307
324
|
expiresAt: completedAt + config.cacheTtlMs,
|
|
308
|
-
value:
|
|
325
|
+
value: cachedValue
|
|
309
326
|
});
|
|
310
327
|
enforceCacheLimit(cache);
|
|
311
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/active-recall.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { DEFAULT_REASONING_MODEL } from \"./config.js\";\nimport { collapseWhitespace, truncateCodePointSafe } from \"./whitespace.js\";\nimport type {\n ActiveRecallChatType,\n ActiveRecallModelFallbackPolicy,\n ActiveRecallPromptStyle,\n ActiveRecallQueryMode,\n ActiveRecallThinking,\n} from \"./types.js\";\n\nexport interface ActiveRecallTurn {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport interface ActiveRecallInput {\n sessionKey: string;\n agentId: string;\n chatType: ActiveRecallChatType;\n recentTurns: ActiveRecallTurn[];\n currentMessage: string;\n}\n\nexport interface ActiveRecallConfig {\n enabled: boolean;\n agents: string[] | null;\n allowedChatTypes: ActiveRecallChatType[];\n queryMode: ActiveRecallQueryMode;\n promptStyle: ActiveRecallPromptStyle;\n customInstruction: string | null;\n promptAppend: string | null;\n maxSummaryChars: number;\n recentUserTurns: number;\n recentAssistantTurns: number;\n recentUserChars: number;\n recentAssistantChars: number;\n thinking: ActiveRecallThinking;\n timeoutMs: number;\n cacheTtlMs: number;\n persistTranscripts: boolean;\n transcriptDir: string;\n entityGraphDepth: number;\n includeCausalTrajectories: boolean;\n includeDaySummary: boolean;\n attachRecallExplain: boolean;\n modelOverride: string | null;\n modelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n}\n\nexport interface ActiveRecallResult {\n summary: string | null;\n citations: Array<{ memoryId: string; relevance: number }>;\n latencyMs: number;\n cacheHit: boolean;\n modelUsed: string;\n transcriptPath: string | null;\n}\n\nexport interface ActiveRecallDependencies {\n recall(query: string, sessionKey: string): Promise<string | null>;\n getLastRecallSnapshot?(sessionKey: string): { memoryIds?: string[] } | null;\n walkEntityGraph?(params: {\n sessionKey: string;\n query: string;\n depth: number;\n }): Promise<string[]>;\n loadCausalTrajectories?(params: {\n sessionKey: string;\n query: string;\n }): Promise<string[]>;\n loadDaySummary?(sessionKey: string): Promise<string | null>;\n explainLastRecall?(sessionKey: string): Promise<string | null>;\n generateSummary?(params: {\n prompt: string;\n sessionKey: string;\n agentId: string;\n model: string;\n timeoutMs: number;\n thinking: ActiveRecallThinking;\n fallbackPolicy: ActiveRecallModelFallbackPolicy;\n }): Promise<{ text: string | null; modelUsed?: string; cacheHit?: boolean }>;\n now?: () => number;\n}\n\ninterface CachedRecallResult {\n expiresAt: number;\n value: ActiveRecallResult;\n}\n\ninterface ActiveRecallTurnWithIndex {\n index: number;\n role: ActiveRecallTurn[\"role\"];\n content: string;\n}\n\nconst ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;\n\nconst NONE_SET = new Set([\n \"\",\n \"none\",\n \"no_reply\",\n \"nothing useful\",\n \"no relevant memory\",\n \"timeout\",\n \"[]\",\n \"{}\",\n \"null\",\n \"n/a\",\n]);\n\nconst STYLE_INSTRUCTIONS: Record<ActiveRecallPromptStyle, string> = {\n balanced: \"Summarize the most relevant memory context in a compact, neutral way.\",\n strict: \"Only include memory that is directly supported by the retrieved context.\",\n contextual: \"Prefer concise context that helps the next reply stay grounded in recent work.\",\n \"recall-heavy\": \"Bias toward richer recall coverage when multiple retrieved items reinforce each other.\",\n \"precision-heavy\": \"Bias toward precision. Omit anything uncertain or weakly supported.\",\n \"preference-only\": \"Only surface user preference or operating-style memory when present.\",\n};\n\nfunction cloneRecallResult(value: ActiveRecallResult): ActiveRecallResult {\n return {\n ...value,\n citations: [...value.citations],\n };\n}\n\nfunction buildCacheKey(input: ActiveRecallInput, config: ActiveRecallConfig, queryBundle: string): string {\n return JSON.stringify({\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n customInstruction: config.customInstruction,\n promptAppend: config.promptAppend,\n maxSummaryChars: config.maxSummaryChars,\n entityGraphDepth: config.entityGraphDepth,\n includeCausalTrajectories: config.includeCausalTrajectories,\n includeDaySummary: config.includeDaySummary,\n attachRecallExplain: config.attachRecallExplain,\n modelOverride: config.modelOverride,\n modelFallbackPolicy: config.modelFallbackPolicy,\n thinking: config.thinking,\n queryBundle,\n });\n}\n\nfunction pruneExpiredCache(\n cache: Map<string, CachedRecallResult>,\n currentTime: number,\n): void {\n for (const [key, entry] of cache.entries()) {\n if (entry.expiresAt <= currentTime) {\n cache.delete(key);\n }\n }\n}\n\nfunction enforceCacheLimit(cache: Map<string, CachedRecallResult>): void {\n while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (typeof oldestKey !== \"string\") {\n break;\n }\n cache.delete(oldestKey);\n }\n}\n\nfunction cropTurns(\n turns: ActiveRecallTurn[],\n role: \"user\" | \"assistant\",\n maxTurns: number,\n maxChars: number,\n): ActiveRecallTurnWithIndex[] {\n if (maxTurns <= 0) {\n return [];\n }\n\n const selected: ActiveRecallTurnWithIndex[] = [];\n for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {\n const turn = turns[index];\n if (turn?.role === role) {\n selected.push({\n index,\n role: turn.role,\n content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars)),\n });\n }\n }\n\n return selected.reverse();\n}\n\nfunction mergeChronologicalTurns(\n userTurns: ActiveRecallTurnWithIndex[],\n assistantTurns: ActiveRecallTurnWithIndex[],\n): ActiveRecallTurnWithIndex[] {\n return [...userTurns, ...assistantTurns]\n .sort((left, right) => left.index - right.index)\n .filter((value) => value.content.length > 0);\n}\n\nexport function buildActiveRecallQueryBundle(\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n): string {\n if (config.queryMode === \"message\") {\n return collapseWhitespace(input.currentMessage);\n }\n\n const userTurns = cropTurns(\n input.recentTurns,\n \"user\",\n config.recentUserTurns,\n config.recentUserChars,\n );\n const assistantTurns = cropTurns(\n input.recentTurns,\n \"assistant\",\n config.recentAssistantTurns,\n config.recentAssistantChars,\n );\n const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);\n\n const parts = [\n ...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`),\n ];\n\n if (config.queryMode === \"full\") {\n return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n }\n\n return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n}\n\nexport function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null {\n if (value == null) return null;\n const compact = collapseWhitespace(value);\n if (NONE_SET.has(compact.toLowerCase())) return null;\n return truncateCodePointSafe(compact, maxChars);\n}\n\nfunction sanitizeTranscriptPathSegment(value: string): string {\n const normalized = collapseWhitespace(value);\n return encodeURIComponent(normalized.length > 0 ? normalized : \"unknown\").replaceAll(\n \".\",\n \"%2E\",\n );\n}\n\nexport function buildActiveRecallPrompt(params: {\n config: ActiveRecallConfig;\n queryBundle: string;\n recallContext: string | null;\n graphContext: string[];\n causalContext: string[];\n daySummary: string | null;\n recallExplain: string | null;\n}): string {\n const sections = [\n params.config.customInstruction?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],\n `Query bundle:\\n${params.queryBundle}`,\n params.recallContext ? `Retrieved memory:\\n${params.recallContext}` : null,\n params.graphContext.length > 0 ? `Entity graph:\\n${params.graphContext.join(\"\\n\")}` : null,\n params.causalContext.length > 0 ? `Causal trajectories:\\n${params.causalContext.join(\"\\n\")}` : null,\n params.daySummary ? `Day summary:\\n${params.daySummary}` : null,\n params.recallExplain ? `Recall explain:\\n${params.recallExplain}` : null,\n params.config.promptAppend?.trim() || null,\n \"Return either NONE or a compact summary grounded only in the supplied context.\",\n ];\n return sections.filter((value): value is string => !!value && value.trim().length > 0).join(\"\\n\\n\");\n}\n\nasync function appendActiveRecallTranscript(\n transcriptRoot: string,\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n result: ActiveRecallResult,\n queryBundle: string,\n): Promise<string> {\n const date = new Date().toISOString().slice(0, 10);\n const filePath = path.join(\n transcriptRoot,\n \"agents\",\n sanitizeTranscriptPathSegment(input.agentId),\n date,\n `${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`,\n );\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(\n filePath,\n `${JSON.stringify({\n ts: new Date().toISOString(),\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n queryBundle,\n summary: result.summary,\n citations: result.citations,\n latencyMs: result.latencyMs,\n cacheHit: result.cacheHit,\n modelUsed: result.modelUsed,\n })}\\n`,\n \"utf8\",\n );\n return filePath;\n}\n\nexport function createActiveRecallEngine(\n deps: ActiveRecallDependencies,\n config: ActiveRecallConfig,\n) {\n const cache = new Map<string, CachedRecallResult>();\n const now = deps.now ?? (() => Date.now());\n\n return {\n async run(input: ActiveRecallInput): Promise<ActiveRecallResult> {\n if (!config.enabled) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"disabled\",\n transcriptPath: null,\n };\n }\n if (config.agents && !config.agents.includes(input.agentId)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n if (!config.allowedChatTypes.includes(input.chatType)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n\n const queryBundle = buildActiveRecallQueryBundle(input, config);\n const cacheKey = buildCacheKey(input, config, queryBundle);\n const currentTime = now();\n const cacheEnabled = config.cacheTtlMs > 0;\n if (cacheEnabled) {\n pruneExpiredCache(cache, currentTime);\n }\n const cached = cache.get(cacheKey);\n if (cacheEnabled && cached) {\n return {\n ...cloneRecallResult(cached.value),\n latencyMs: Math.max(0, now() - currentTime),\n cacheHit: true,\n };\n }\n\n const start = currentTime;\n const recallContext = await deps.recall(queryBundle, input.sessionKey);\n const graphContext =\n config.entityGraphDepth > 0 && deps.walkEntityGraph\n ? await deps.walkEntityGraph({\n sessionKey: input.sessionKey,\n query: queryBundle,\n depth: config.entityGraphDepth,\n })\n : [];\n const causalContext =\n config.includeCausalTrajectories && deps.loadCausalTrajectories\n ? await deps.loadCausalTrajectories({\n sessionKey: input.sessionKey,\n query: queryBundle,\n })\n : [];\n const daySummary =\n config.includeDaySummary && deps.loadDaySummary\n ? await deps.loadDaySummary(input.sessionKey)\n : null;\n const recallExplain =\n config.attachRecallExplain && deps.explainLastRecall\n ? await deps.explainLastRecall(input.sessionKey)\n : null;\n const prompt = buildActiveRecallPrompt({\n config,\n queryBundle,\n recallContext,\n graphContext,\n causalContext,\n daySummary,\n recallExplain,\n });\n\n const generated = deps.generateSummary\n ? await deps.generateSummary({\n prompt,\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n model: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n timeoutMs: config.timeoutMs,\n thinking: config.thinking,\n fallbackPolicy: config.modelFallbackPolicy,\n })\n : {\n text: recallContext,\n modelUsed: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n cacheHit: false,\n };\n const summary = normalizeActiveRecallSummary(\n generated.text,\n config.maxSummaryChars,\n );\n const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);\n const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({\n memoryId,\n relevance: Number((1 / (index + 1)).toFixed(3)),\n }));\n const result: ActiveRecallResult = {\n summary,\n citations,\n latencyMs: Math.max(0, now() - start),\n cacheHit: generated.cacheHit === true,\n modelUsed: generated.modelUsed ?? config.modelOverride ?? DEFAULT_REASONING_MODEL,\n transcriptPath: null,\n };\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n\n if (cacheEnabled) {\n const completedAt = now();\n cache.set(cacheKey, {\n expiresAt: completedAt + config.cacheTtlMs,\n value: cloneRecallResult(result),\n });\n enforceCacheLimit(cache);\n }\n return result;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,UAAU;AAgGjB,IAAM,kCAAkC;AAExC,IAAM,WAAW,oBAAI,IAAI;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,qBAA8D;AAAA,EAClE,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB;AAEA,SAAS,kBAAkB,OAA+C;AACxE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,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AAAA,MACZ;AACJ,YAAM,UAAU;AAAA,QACd,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AACA,YAAM,WAAW,KAAK,wBAAwB,MAAM,UAAU;AAC9D,YAAM,aAAa,UAAU,aAAa,CAAC,GAAG,IAAI,CAAC,UAAU,WAAW;AAAA,QACtE;AAAA,QACA,WAAW,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC;AAAA,MAChD,EAAE;AACF,YAAM,SAA6B;AAAA,QACjC;AAAA,QACA;AAAA,QACA,WAAW,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK;AAAA,QACpC,UAAU,UAAU,aAAa;AAAA,QACjC,WAAW,UAAU,aAAa,OAAO,iBAAiB;AAAA,QAC1D,gBAAgB;AAAA,MAClB;AACA,UAAI,OAAO,oBAAoB;AAC7B,YAAI;AACF,iBAAO,iBAAiB,MAAM;AAAA,YAC5B,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,QAAQ;AACN,iBAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAEA,UAAI,cAAc;AAChB,cAAM,cAAc,IAAI;AACxB,cAAM,IAAI,UAAU;AAAA,UAClB,WAAW,cAAc,OAAO;AAAA,UAChC,OAAO,kBAAkB,MAAM;AAAA,QACjC,CAAC;AACD,0BAAkB,KAAK;AAAA,MACzB;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/active-recall.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { DEFAULT_REASONING_MODEL } from \"./config.js\";\nimport { collapseWhitespace, truncateCodePointSafe } from \"./whitespace.js\";\nimport type {\n ActiveRecallChatType,\n ActiveRecallModelFallbackPolicy,\n ActiveRecallPromptStyle,\n ActiveRecallQueryMode,\n ActiveRecallThinking,\n} from \"./types.js\";\n\nexport interface ActiveRecallTurn {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport interface ActiveRecallInput {\n sessionKey: string;\n agentId: string;\n chatType: ActiveRecallChatType;\n recentTurns: ActiveRecallTurn[];\n currentMessage: string;\n}\n\nexport interface ActiveRecallConfig {\n enabled: boolean;\n agents: string[] | null;\n allowedChatTypes: ActiveRecallChatType[];\n queryMode: ActiveRecallQueryMode;\n promptStyle: ActiveRecallPromptStyle;\n customInstruction: string | null;\n promptAppend: string | null;\n maxSummaryChars: number;\n recentUserTurns: number;\n recentAssistantTurns: number;\n recentUserChars: number;\n recentAssistantChars: number;\n thinking: ActiveRecallThinking;\n timeoutMs: number;\n cacheTtlMs: number;\n persistTranscripts: boolean;\n transcriptDir: string;\n entityGraphDepth: number;\n includeCausalTrajectories: boolean;\n includeDaySummary: boolean;\n attachRecallExplain: boolean;\n modelOverride: string | null;\n modelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n}\n\nexport interface ActiveRecallResult {\n summary: string | null;\n citations: Array<{ memoryId: string; relevance: number }>;\n latencyMs: number;\n cacheHit: boolean;\n modelUsed: string;\n transcriptPath: string | null;\n}\n\nexport interface ActiveRecallDependencies {\n recall(query: string, sessionKey: string): Promise<string | null>;\n getLastRecallSnapshot?(sessionKey: string): { memoryIds?: string[] } | null;\n walkEntityGraph?(params: {\n sessionKey: string;\n query: string;\n depth: number;\n }): Promise<string[]>;\n loadCausalTrajectories?(params: {\n sessionKey: string;\n query: string;\n }): Promise<string[]>;\n loadDaySummary?(sessionKey: string): Promise<string | null>;\n explainLastRecall?(sessionKey: string): Promise<string | null>;\n generateSummary?(params: {\n prompt: string;\n sessionKey: string;\n agentId: string;\n model: string;\n timeoutMs: number;\n thinking: ActiveRecallThinking;\n fallbackPolicy: ActiveRecallModelFallbackPolicy;\n }): Promise<{ text: string | null; modelUsed?: string; cacheHit?: boolean }>;\n now?: () => number;\n}\n\ninterface CachedRecallResult {\n expiresAt: number;\n value: ActiveRecallResult;\n}\n\ninterface ActiveRecallTurnWithIndex {\n index: number;\n role: ActiveRecallTurn[\"role\"];\n content: string;\n}\n\nconst ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;\n\nconst NONE_SET = new Set([\n \"\",\n \"none\",\n \"no_reply\",\n \"nothing useful\",\n \"no relevant memory\",\n \"timeout\",\n \"[]\",\n \"{}\",\n \"null\",\n \"n/a\",\n]);\n\nconst STYLE_INSTRUCTIONS: Record<ActiveRecallPromptStyle, string> = {\n balanced: \"Summarize the most relevant memory context in a compact, neutral way.\",\n strict: \"Only include memory that is directly supported by the retrieved context.\",\n contextual: \"Prefer concise context that helps the next reply stay grounded in recent work.\",\n \"recall-heavy\": \"Bias toward richer recall coverage when multiple retrieved items reinforce each other.\",\n \"precision-heavy\": \"Bias toward precision. Omit anything uncertain or weakly supported.\",\n \"preference-only\": \"Only surface user preference or operating-style memory when present.\",\n};\n\nfunction cloneRecallResult(value: ActiveRecallResult): ActiveRecallResult {\n return {\n ...value,\n citations: [...value.citations],\n };\n}\n\nfunction buildCacheKey(input: ActiveRecallInput, config: ActiveRecallConfig, queryBundle: string): string {\n return JSON.stringify({\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n customInstruction: config.customInstruction,\n promptAppend: config.promptAppend,\n maxSummaryChars: config.maxSummaryChars,\n entityGraphDepth: config.entityGraphDepth,\n includeCausalTrajectories: config.includeCausalTrajectories,\n includeDaySummary: config.includeDaySummary,\n attachRecallExplain: config.attachRecallExplain,\n modelOverride: config.modelOverride,\n modelFallbackPolicy: config.modelFallbackPolicy,\n thinking: config.thinking,\n queryBundle,\n });\n}\n\nfunction pruneExpiredCache(\n cache: Map<string, CachedRecallResult>,\n currentTime: number,\n): void {\n for (const [key, entry] of cache.entries()) {\n if (entry.expiresAt <= currentTime) {\n cache.delete(key);\n }\n }\n}\n\nfunction enforceCacheLimit(cache: Map<string, CachedRecallResult>): void {\n while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (typeof oldestKey !== \"string\") {\n break;\n }\n cache.delete(oldestKey);\n }\n}\n\nfunction cropTurns(\n turns: ActiveRecallTurn[],\n role: \"user\" | \"assistant\",\n maxTurns: number,\n maxChars: number,\n): ActiveRecallTurnWithIndex[] {\n if (maxTurns <= 0) {\n return [];\n }\n\n const selected: ActiveRecallTurnWithIndex[] = [];\n for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {\n const turn = turns[index];\n if (turn?.role === role) {\n selected.push({\n index,\n role: turn.role,\n content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars)),\n });\n }\n }\n\n return selected.reverse();\n}\n\nfunction mergeChronologicalTurns(\n userTurns: ActiveRecallTurnWithIndex[],\n assistantTurns: ActiveRecallTurnWithIndex[],\n): ActiveRecallTurnWithIndex[] {\n return [...userTurns, ...assistantTurns]\n .sort((left, right) => left.index - right.index)\n .filter((value) => value.content.length > 0);\n}\n\nexport function buildActiveRecallQueryBundle(\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n): string {\n if (config.queryMode === \"message\") {\n return collapseWhitespace(input.currentMessage);\n }\n\n const userTurns = cropTurns(\n input.recentTurns,\n \"user\",\n config.recentUserTurns,\n config.recentUserChars,\n );\n const assistantTurns = cropTurns(\n input.recentTurns,\n \"assistant\",\n config.recentAssistantTurns,\n config.recentAssistantChars,\n );\n const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);\n\n const parts = [\n ...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`),\n ];\n\n if (config.queryMode === \"full\") {\n return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n }\n\n return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n}\n\nexport function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null {\n if (value == null) return null;\n const compact = collapseWhitespace(value);\n if (NONE_SET.has(compact.toLowerCase())) return null;\n return truncateCodePointSafe(compact, maxChars);\n}\n\nfunction sanitizeTranscriptPathSegment(value: string): string {\n const normalized = collapseWhitespace(value);\n return encodeURIComponent(normalized.length > 0 ? normalized : \"unknown\").replaceAll(\n \".\",\n \"%2E\",\n );\n}\n\nexport function buildActiveRecallPrompt(params: {\n config: ActiveRecallConfig;\n queryBundle: string;\n recallContext: string | null;\n graphContext: string[];\n causalContext: string[];\n daySummary: string | null;\n recallExplain: string | null;\n}): string {\n const sections = [\n params.config.customInstruction?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],\n `Query bundle:\\n${params.queryBundle}`,\n params.recallContext ? `Retrieved memory:\\n${params.recallContext}` : null,\n params.graphContext.length > 0 ? `Entity graph:\\n${params.graphContext.join(\"\\n\")}` : null,\n params.causalContext.length > 0 ? `Causal trajectories:\\n${params.causalContext.join(\"\\n\")}` : null,\n params.daySummary ? `Day summary:\\n${params.daySummary}` : null,\n params.recallExplain ? `Recall explain:\\n${params.recallExplain}` : null,\n params.config.promptAppend?.trim() || null,\n \"Return either NONE or a compact summary grounded only in the supplied context.\",\n ];\n return sections.filter((value): value is string => !!value && value.trim().length > 0).join(\"\\n\\n\");\n}\n\nasync function appendActiveRecallTranscript(\n transcriptRoot: string,\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n result: ActiveRecallResult,\n queryBundle: string,\n): Promise<string> {\n const date = new Date().toISOString().slice(0, 10);\n const filePath = path.join(\n transcriptRoot,\n \"agents\",\n sanitizeTranscriptPathSegment(input.agentId),\n date,\n `${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`,\n );\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(\n filePath,\n `${JSON.stringify({\n ts: new Date().toISOString(),\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n queryBundle,\n summary: result.summary,\n citations: result.citations,\n latencyMs: result.latencyMs,\n cacheHit: result.cacheHit,\n modelUsed: result.modelUsed,\n })}\\n`,\n \"utf8\",\n );\n return filePath;\n}\n\nexport function createActiveRecallEngine(\n deps: ActiveRecallDependencies,\n config: ActiveRecallConfig,\n) {\n const cache = new Map<string, CachedRecallResult>();\n const now = deps.now ?? (() => Date.now());\n\n return {\n async run(input: ActiveRecallInput): Promise<ActiveRecallResult> {\n if (!config.enabled) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"disabled\",\n transcriptPath: null,\n };\n }\n if (config.agents && !config.agents.includes(input.agentId)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n if (!config.allowedChatTypes.includes(input.chatType)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n\n const queryBundle = buildActiveRecallQueryBundle(input, config);\n const cacheKey = buildCacheKey(input, config, queryBundle);\n const currentTime = now();\n const cacheEnabled = config.cacheTtlMs > 0;\n if (cacheEnabled) {\n pruneExpiredCache(cache, currentTime);\n }\n const cached = cache.get(cacheKey);\n if (cacheEnabled && cached) {\n const result: ActiveRecallResult = {\n ...cloneRecallResult(cached.value),\n latencyMs: Math.max(0, now() - currentTime),\n cacheHit: true,\n };\n result.transcriptPath = null;\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n return result;\n }\n\n const start = currentTime;\n const recallContext = await deps.recall(queryBundle, input.sessionKey);\n const graphContext =\n config.entityGraphDepth > 0 && deps.walkEntityGraph\n ? await deps.walkEntityGraph({\n sessionKey: input.sessionKey,\n query: queryBundle,\n depth: config.entityGraphDepth,\n })\n : [];\n const causalContext =\n config.includeCausalTrajectories && deps.loadCausalTrajectories\n ? await deps.loadCausalTrajectories({\n sessionKey: input.sessionKey,\n query: queryBundle,\n })\n : [];\n const daySummary =\n config.includeDaySummary && deps.loadDaySummary\n ? await deps.loadDaySummary(input.sessionKey)\n : null;\n const recallExplain =\n config.attachRecallExplain && deps.explainLastRecall\n ? await deps.explainLastRecall(input.sessionKey)\n : null;\n const prompt = buildActiveRecallPrompt({\n config,\n queryBundle,\n recallContext,\n graphContext,\n causalContext,\n daySummary,\n recallExplain,\n });\n\n const generated = deps.generateSummary\n ? await deps.generateSummary({\n prompt,\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n model: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n timeoutMs: config.timeoutMs,\n thinking: config.thinking,\n fallbackPolicy: config.modelFallbackPolicy,\n })\n : {\n text: recallContext,\n modelUsed: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n cacheHit: false,\n };\n const summary = normalizeActiveRecallSummary(\n generated.text,\n config.maxSummaryChars,\n );\n const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);\n const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({\n memoryId,\n relevance: Number((1 / (index + 1)).toFixed(3)),\n }));\n const result: ActiveRecallResult = {\n summary,\n citations,\n latencyMs: Math.max(0, now() - start),\n cacheHit: generated.cacheHit === true,\n modelUsed: generated.modelUsed ?? config.modelOverride ?? DEFAULT_REASONING_MODEL,\n transcriptPath: null,\n };\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n\n if (cacheEnabled) {\n const completedAt = now();\n const cachedValue = cloneRecallResult(result);\n cachedValue.transcriptPath = null;\n cache.set(cacheKey, {\n expiresAt: completedAt + config.cacheTtlMs,\n value: cachedValue,\n });\n enforceCacheLimit(cache);\n }\n return result;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,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AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,QAAQ;AACN,iBAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAEA,UAAI,cAAc;AAChB,cAAM,cAAc,IAAI;AACxB,cAAM,cAAc,kBAAkB,MAAM;AAC5C,oBAAY,iBAAiB;AAC7B,cAAM,IAAI,UAAU;AAAA,UAClB,WAAW,cAAc,OAAO;AAAA,UAChC,OAAO;AAAA,QACT,CAAC;AACD,0BAAkB,KAAK;AAAA,MACzB;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result"]}
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import "../chunk-SEDEKFYQ.js";
|
|
2
2
|
import {
|
|
3
3
|
AdapterRegistry
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-2QSZNTDO.js";
|
|
5
|
+
import {
|
|
6
|
+
CodexAdapter
|
|
7
|
+
} from "../chunk-RSUYKGGZ.js";
|
|
5
8
|
import {
|
|
6
9
|
HermesAdapter
|
|
7
10
|
} from "../chunk-42NQ7AVG.js";
|
|
@@ -11,9 +14,6 @@ import {
|
|
|
11
14
|
import {
|
|
12
15
|
ClaudeCodeAdapter
|
|
13
16
|
} from "../chunk-J64TK33U.js";
|
|
14
|
-
import {
|
|
15
|
-
CodexAdapter
|
|
16
|
-
} from "../chunk-RSUYKGGZ.js";
|
|
17
17
|
import "../chunk-7RXCMVFQ.js";
|
|
18
18
|
import "../chunk-PZ5AY32C.js";
|
|
19
19
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AdapterRegistry
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2QSZNTDO.js";
|
|
4
|
+
import "../chunk-RSUYKGGZ.js";
|
|
4
5
|
import "../chunk-42NQ7AVG.js";
|
|
5
6
|
import "../chunk-TMSXWOBZ.js";
|
|
6
7
|
import "../chunk-J64TK33U.js";
|
|
7
|
-
import "../chunk-RSUYKGGZ.js";
|
|
8
8
|
import "../chunk-7RXCMVFQ.js";
|
|
9
9
|
import "../chunk-PZ5AY32C.js";
|
|
10
10
|
export {
|
package/dist/behavior-learner.js
CHANGED
|
@@ -51,13 +51,12 @@ function aggregateSignalPressure(signals) {
|
|
|
51
51
|
return Math.max(-1, Math.min(1, net / signals.length));
|
|
52
52
|
}
|
|
53
53
|
function selectRecentSignals(input) {
|
|
54
|
-
if (input.learningWindowDays <= 0) return [...input.signals];
|
|
55
54
|
const nowMs = (input.now ?? /* @__PURE__ */ new Date()).getTime();
|
|
56
|
-
const minTs = nowMs - input.learningWindowDays * 864e5;
|
|
55
|
+
const minTs = input.learningWindowDays <= 0 ? Number.NEGATIVE_INFINITY : nowMs - input.learningWindowDays * 864e5;
|
|
57
56
|
return input.signals.filter((signal) => {
|
|
58
57
|
const ts = Date.parse(signal.timestamp);
|
|
59
58
|
if (!Number.isFinite(ts)) return false;
|
|
60
|
-
return ts >= minTs;
|
|
59
|
+
return ts >= minTs && ts <= nowMs;
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
function parameterDirection(parameter, pressure) {
|