@remnic/core 1.1.12 → 1.1.14
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.d.ts +2 -1
- package/dist/access-cli.js +263 -82
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +26 -60
- package/dist/access-http.js +43 -29
- package/dist/access-mcp.d.ts +24 -6
- package/dist/access-mcp.js +35 -28
- package/dist/access-schema.d.ts +9 -6
- package/dist/access-schema.js +7 -5
- package/dist/access-service-DcCDmNYC.d.ts +1542 -0
- package/dist/access-service.d.ts +25 -7
- package/dist/access-service.js +33 -26
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.js +11 -3
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +24 -0
- package/dist/adapters/claude-code.js +9 -0
- package/dist/adapters/codex.d.ts +25 -0
- package/dist/adapters/codex.js +9 -0
- package/dist/adapters/hermes.d.ts +35 -0
- package/dist/adapters/hermes.js +9 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.js +26 -0
- package/dist/adapters/registry.d.ts +20 -0
- package/dist/adapters/registry.js +13 -0
- package/dist/adapters/replit.d.ts +28 -0
- package/dist/adapters/replit.js +9 -0
- package/dist/adapters/types.d.ts +43 -0
- package/dist/adapters/types.js +8 -0
- package/dist/bootstrap.d.ts +20 -5
- package/dist/boxes.d.ts +7 -0
- package/dist/boxes.js +1 -1
- package/dist/briefing.d.ts +5 -3
- package/dist/briefing.js +9 -6
- package/dist/buffer-surprise-report.js +1 -1
- package/dist/buffer.d.ts +18 -4
- package/dist/buffer.js +1 -1
- package/dist/calibration.js +4 -4
- package/dist/capsule-cli.d.ts +4 -4
- package/dist/capsule-cli.js +1 -1
- package/dist/capsule-crypto-5CYAGVC5.js +18 -0
- package/dist/capsule-merge-4MGKE7C5.js +189 -0
- package/dist/causal-behavior.d.ts +8 -28
- package/dist/causal-behavior.js +6 -3
- package/dist/causal-behavior.js.map +1 -1
- package/dist/causal-chain.js +3 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +24 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/chunk-25MQ7IHJ.js +427 -0
- package/dist/chunk-25MQ7IHJ.js.map +1 -0
- package/dist/chunk-2F2W355T.js +256 -0
- package/dist/chunk-2F2W355T.js.map +1 -0
- package/dist/chunk-2KI4QFHU.js +228 -0
- package/dist/chunk-2KI4QFHU.js.map +1 -0
- package/dist/chunk-2PRQG7PV.js +86 -0
- package/dist/chunk-2PRQG7PV.js.map +1 -0
- package/dist/chunk-2QR3XXIC.js +2272 -0
- package/dist/chunk-2QR3XXIC.js.map +1 -0
- package/dist/chunk-2WWLHTZY.js +121 -0
- package/dist/chunk-326G7DJK.js +2185 -0
- package/dist/chunk-326G7DJK.js.map +1 -0
- package/dist/chunk-34DQE4KF.js +174 -0
- package/dist/chunk-34DQE4KF.js.map +1 -0
- package/dist/chunk-3APJ5EVB.js +601 -0
- package/dist/chunk-3APJ5EVB.js.map +1 -0
- package/dist/chunk-3HPAPHUK.js +51 -0
- package/dist/chunk-3HPAPHUK.js.map +1 -0
- package/dist/chunk-3JXBXXM2.js +69 -0
- package/dist/chunk-3JXBXXM2.js.map +1 -0
- package/dist/chunk-3KW65B36.js +681 -0
- package/dist/chunk-3KW65B36.js.map +1 -0
- package/dist/chunk-3UXOZBHV.js +20 -0
- package/dist/chunk-3UXOZBHV.js.map +1 -0
- package/dist/chunk-3VAL7ZL2.js +266 -0
- package/dist/chunk-3VAL7ZL2.js.map +1 -0
- package/dist/chunk-3Y4P7RXM.js +31 -0
- package/dist/chunk-3Y4P7RXM.js.map +1 -0
- package/dist/chunk-47VWKCAF.js +273 -0
- package/dist/chunk-47VWKCAF.js.map +1 -0
- package/dist/chunk-4CRG46BG.js +271 -0
- package/dist/chunk-5375UYTQ.js +914 -0
- package/dist/chunk-5375UYTQ.js.map +1 -0
- package/dist/chunk-56K5QLHX.js +506 -0
- package/dist/chunk-56K5QLHX.js.map +1 -0
- package/dist/chunk-5RGLBDQF.js +596 -0
- package/dist/chunk-5RGLBDQF.js.map +1 -0
- package/dist/chunk-5UZXUTVO.js +9 -0
- package/dist/chunk-5UZXUTVO.js.map +1 -0
- package/dist/chunk-65PG43EQ.js +105 -0
- package/dist/chunk-65PG43EQ.js.map +1 -0
- package/dist/chunk-66DHUKLO.js +57 -0
- package/dist/chunk-66DHUKLO.js.map +1 -0
- package/dist/chunk-6FC5EGNV.js +46 -0
- package/dist/chunk-6FC5EGNV.js.map +1 -0
- package/dist/chunk-6H2TESSP.js +62 -0
- package/dist/chunk-6H2TESSP.js.map +1 -0
- package/dist/chunk-6LVVDPJ4.js +32 -0
- package/dist/chunk-6LVVDPJ4.js.map +1 -0
- package/dist/chunk-6RVI47ZR.js +159 -0
- package/dist/chunk-6RVI47ZR.js.map +1 -0
- package/dist/chunk-7AAT6G4Q.js +5117 -0
- package/dist/chunk-7AAT6G4Q.js.map +1 -0
- package/dist/chunk-7DTASS5T.js +29 -0
- package/dist/chunk-7DTASS5T.js.map +1 -0
- package/dist/chunk-7IASACLB.js +596 -0
- package/dist/chunk-7MNMYOFP.js +32 -0
- package/dist/chunk-7MNMYOFP.js.map +1 -0
- package/dist/chunk-7N4KAIGN.js +133 -0
- package/dist/chunk-7N4KAIGN.js.map +1 -0
- package/dist/chunk-7OZ53EXP.js +101 -0
- package/dist/chunk-7OZ53EXP.js.map +1 -0
- package/dist/chunk-7XYTQGCC.js +134 -0
- package/dist/chunk-7XYTQGCC.js.map +1 -0
- package/dist/chunk-A2XUIMJ3.js +341 -0
- package/dist/chunk-A2XUIMJ3.js.map +1 -0
- package/dist/chunk-AGZQD76C.js +201 -0
- package/dist/chunk-AGZQD76C.js.map +1 -0
- package/dist/chunk-APO3DCMU.js +361 -0
- package/dist/chunk-APO3DCMU.js.map +1 -0
- package/dist/chunk-BFBF3XEF.js +283 -0
- package/dist/chunk-BFBF3XEF.js.map +1 -0
- package/dist/chunk-BJ3KMYTB.js +1974 -0
- package/dist/chunk-BJ3KMYTB.js.map +1 -0
- package/dist/chunk-CHEL3SKB.js +6758 -0
- package/dist/chunk-CHEL3SKB.js.map +1 -0
- package/dist/chunk-CQZRLNMV.js +1491 -0
- package/dist/chunk-CQZRLNMV.js.map +1 -0
- package/dist/chunk-D46YSIYX.js +892 -0
- package/dist/chunk-D46YSIYX.js.map +1 -0
- package/dist/chunk-DINWEURR.js +648 -0
- package/dist/chunk-DINWEURR.js.map +1 -0
- package/dist/chunk-DK5LDEQM.js +530 -0
- package/dist/chunk-DK5LDEQM.js.map +1 -0
- package/dist/chunk-DOM4GKSW.js +34 -0
- package/dist/chunk-DOM4GKSW.js.map +1 -0
- package/dist/chunk-EDTHC6UD.js +1075 -0
- package/dist/chunk-EFJ3MQ4V.js +721 -0
- package/dist/chunk-EHRTFRWW.js +89 -0
- package/dist/chunk-EHRTFRWW.js.map +1 -0
- package/dist/chunk-FAJ7FZYM.js +11 -0
- package/dist/chunk-FAJ7FZYM.js.map +1 -0
- package/dist/chunk-FBYESMQ2.js +570 -0
- package/dist/chunk-FDU6HUUL.js +147 -0
- package/dist/chunk-FF4KLI5W.js +99 -0
- package/dist/chunk-FF4KLI5W.js.map +1 -0
- package/dist/chunk-FIT6DMX6.js +310 -0
- package/dist/chunk-FIT6DMX6.js.map +1 -0
- package/dist/chunk-FJ43PRLT.js +272 -0
- package/dist/chunk-FJ43PRLT.js.map +1 -0
- package/dist/chunk-FKFMOY3N.js +32 -0
- package/dist/chunk-FKFMOY3N.js.map +1 -0
- package/dist/chunk-FLTNHQK6.js +262 -0
- package/dist/chunk-FLTNHQK6.js.map +1 -0
- package/dist/chunk-GA454ALV.js +12436 -0
- package/dist/chunk-GA454ALV.js.map +1 -0
- package/dist/chunk-GGKRUQOO.js +228 -0
- package/dist/chunk-GIF42EW3.js +63 -0
- package/dist/chunk-GIF42EW3.js.map +1 -0
- package/dist/chunk-GL6I6MEQ.js +647 -0
- package/dist/chunk-H3ME6L6D.js +709 -0
- package/dist/chunk-H3ME6L6D.js.map +1 -0
- package/dist/chunk-HHLLAQGZ.js +1 -0
- package/dist/chunk-HXXBL2KD.js +2040 -0
- package/dist/chunk-I5V2VDIW.js +219 -0
- package/dist/chunk-I5V2VDIW.js.map +1 -0
- package/dist/chunk-I6K5FBRQ.js +35 -0
- package/dist/chunk-I6K5FBRQ.js.map +1 -0
- package/dist/chunk-ICRIXAP2.js +121 -0
- package/dist/chunk-ICRIXAP2.js.map +1 -0
- package/dist/chunk-J4EB7DNW.js +11 -0
- package/dist/chunk-J4EB7DNW.js.map +1 -0
- package/dist/chunk-JLFA7DQG.js +62 -0
- package/dist/chunk-JLFA7DQG.js.map +1 -0
- package/dist/chunk-KJTKLXTH.js +9 -0
- package/dist/chunk-KJTKLXTH.js.map +1 -0
- package/dist/chunk-KLAO5DGL.js +917 -0
- package/dist/chunk-KLAO5DGL.js.map +1 -0
- package/dist/chunk-KNKUID7G.js +183 -0
- package/dist/chunk-KOSORCJG.js +624 -0
- package/dist/chunk-KOSORCJG.js.map +1 -0
- package/dist/chunk-KUJVMMZQ.js +1262 -0
- package/dist/chunk-KUJVMMZQ.js.map +1 -0
- package/dist/chunk-LCR46JY5.js +123 -0
- package/dist/chunk-LCR46JY5.js.map +1 -0
- package/dist/chunk-LLQ2LLWF.js +148 -0
- package/dist/chunk-LLQ2LLWF.js.map +1 -0
- package/dist/chunk-LPMVBPA3.js +236 -0
- package/dist/chunk-LT3NLYSI.js +50 -0
- package/dist/chunk-LT3NLYSI.js.map +1 -0
- package/dist/chunk-LUDTDZLK.js +287 -0
- package/dist/chunk-LUDTDZLK.js.map +1 -0
- package/dist/chunk-M23FSH32.js +3963 -0
- package/dist/chunk-M23FSH32.js.map +1 -0
- package/dist/chunk-MC26UJIM.js +118 -0
- package/dist/chunk-ME6ESPZU.js +119 -0
- package/dist/chunk-ME6ESPZU.js.map +1 -0
- package/dist/chunk-MGKYQQYF.js +272 -0
- package/dist/chunk-MJFNCJXV.js +66 -0
- package/dist/chunk-MJFNCJXV.js.map +1 -0
- package/dist/chunk-MSWG7JI6.js +237 -0
- package/dist/chunk-MSWG7JI6.js.map +1 -0
- package/dist/chunk-MT25YHYH.js +141 -0
- package/dist/chunk-MT25YHYH.js.map +1 -0
- package/dist/chunk-MT4HVDUZ.js +53 -0
- package/dist/chunk-MY6TPVXW.js +219 -0
- package/dist/chunk-N2D6GXBM.js +267 -0
- package/dist/chunk-N2D6GXBM.js.map +1 -0
- package/dist/chunk-NJ3MJQZX.js +46 -0
- package/dist/chunk-NJ3MJQZX.js.map +1 -0
- package/dist/chunk-NMZY542O.js +335 -0
- package/dist/chunk-NMZY542O.js.map +1 -0
- package/dist/chunk-NNVTUXEB.js +23 -0
- package/dist/chunk-NZL6GGQE.js +375 -0
- package/dist/chunk-NZL6GGQE.js.map +1 -0
- package/dist/chunk-P4NEIHUT.js +108 -0
- package/dist/chunk-P7FMDTKL.js +103 -0
- package/dist/chunk-P7FMDTKL.js.map +1 -0
- package/dist/chunk-PHK3HARR.js +32 -0
- package/dist/chunk-PHK3HARR.js.map +1 -0
- package/dist/chunk-PIRJPV5T.js +98 -0
- package/dist/chunk-PIRJPV5T.js.map +1 -0
- package/dist/chunk-PK7H5L6Y.js +159 -0
- package/dist/chunk-PK7H5L6Y.js.map +1 -0
- package/dist/chunk-PR5FBTFU.js +233 -0
- package/dist/chunk-PR5FBTFU.js.map +1 -0
- package/dist/chunk-PU63GXWS.js +174 -0
- package/dist/chunk-PU63GXWS.js.map +1 -0
- package/dist/chunk-PZIAX57I.js +124 -0
- package/dist/chunk-PZIAX57I.js.map +1 -0
- package/dist/chunk-Q7P4WJDP.js +26 -0
- package/dist/chunk-Q7P4WJDP.js.map +1 -0
- package/dist/chunk-QQUAB63I.js +63 -0
- package/dist/chunk-QQUAB63I.js.map +1 -0
- package/dist/chunk-QRNI5JBH.js +18 -0
- package/dist/chunk-RHY3HH7P.js +601 -0
- package/dist/chunk-RHY3HH7P.js.map +1 -0
- package/dist/chunk-RRF5UOBJ.js +91 -0
- package/dist/chunk-RXDLTSWT.js +124 -0
- package/dist/chunk-RXDLTSWT.js.map +1 -0
- package/dist/chunk-RYED3SPJ.js +42 -0
- package/dist/chunk-RYED3SPJ.js.map +1 -0
- package/dist/chunk-S7KDBTWT.js +106 -0
- package/dist/chunk-S7KDBTWT.js.map +1 -0
- package/dist/chunk-SEDEKFYQ.js +1 -0
- package/dist/chunk-TECVW3JP.js +36 -0
- package/dist/chunk-TECVW3JP.js.map +1 -0
- package/dist/chunk-TFO23QT4.js +88 -0
- package/dist/chunk-TFO23QT4.js.map +1 -0
- package/dist/chunk-TK4UEOSK.js +76 -0
- package/dist/chunk-TK4UEOSK.js.map +1 -0
- package/dist/chunk-TKWGAOLV.js +122 -0
- package/dist/chunk-TKWGAOLV.js.map +1 -0
- package/dist/chunk-TMM4S4IJ.js +597 -0
- package/dist/chunk-TMM4S4IJ.js.map +1 -0
- package/dist/chunk-TMQLARTH.js +188 -0
- package/dist/chunk-TMQLARTH.js.map +1 -0
- package/dist/chunk-TPDBFYEG.js +130 -0
- package/dist/chunk-TPDBFYEG.js.map +1 -0
- package/dist/chunk-TPMQ3G6Z.js +145 -0
- package/dist/chunk-TPMQ3G6Z.js.map +1 -0
- package/dist/chunk-TZOLIGIG.js +61 -0
- package/dist/chunk-TZOLIGIG.js.map +1 -0
- package/dist/chunk-U3PN77QT.js +113 -0
- package/dist/chunk-U3WSW6PZ.js +277 -0
- package/dist/chunk-U4SCL7B7.js +640 -0
- package/dist/chunk-U4SCL7B7.js.map +1 -0
- package/dist/chunk-UWK5OXUJ.js +156 -0
- package/dist/chunk-UWK5OXUJ.js.map +1 -0
- package/dist/chunk-UWVJF25J.js +74 -0
- package/dist/chunk-UXHQAFNA.js +1317 -0
- package/dist/chunk-UXHQAFNA.js.map +1 -0
- package/dist/chunk-V5OCT34X.js +1 -0
- package/dist/chunk-VLXA6PI2.js +304 -0
- package/dist/chunk-VLXA6PI2.js.map +1 -0
- package/dist/chunk-VNO6ZJ35.js +500 -0
- package/dist/chunk-VNO6ZJ35.js.map +1 -0
- package/dist/chunk-VW676BEI.js +827 -0
- package/dist/chunk-VW676BEI.js.map +1 -0
- package/dist/chunk-W3LR522O.js +2296 -0
- package/dist/chunk-W4L6CZKA.js +96 -0
- package/dist/chunk-W4L6CZKA.js.map +1 -0
- package/dist/chunk-W4RVMTHR.js +372 -0
- package/dist/chunk-W4RVMTHR.js.map +1 -0
- package/dist/chunk-WEHSQBFR.js +188 -0
- package/dist/chunk-WEHSQBFR.js.map +1 -0
- package/dist/chunk-WELDCG6C.js +380 -0
- package/dist/chunk-WELDCG6C.js.map +1 -0
- package/dist/chunk-WZYKANL3.js +2800 -0
- package/dist/chunk-WZYKANL3.js.map +1 -0
- package/dist/chunk-XIG5PDM7.js +48 -0
- package/dist/chunk-XJNBEDFE.js +193 -0
- package/dist/chunk-XJNBEDFE.js.map +1 -0
- package/dist/chunk-XVVIG67A.js +291 -0
- package/dist/chunk-XVVIG67A.js.map +1 -0
- package/dist/chunk-XVZ7B3HG.js +135 -0
- package/dist/chunk-YBPYIAA5.js +73 -0
- package/dist/chunk-YBPYIAA5.js.map +1 -0
- package/dist/chunk-Z734BLO3.js +21 -0
- package/dist/chunk-Z734BLO3.js.map +1 -0
- package/dist/chunk-ZKSK55RC.js +269 -0
- package/dist/chunk-ZKSK55RC.js.map +1 -0
- package/dist/chunk-ZTFCYYEZ.js +69 -0
- package/dist/chunk-ZTFCYYEZ.js.map +1 -0
- package/dist/chunk-ZY2MNJR6.js +329 -0
- package/dist/chunk-ZY2MNJR6.js.map +1 -0
- package/dist/cli-D3VpkVwB.d.ts +1136 -0
- package/dist/cli.d.ts +39 -10
- package/dist/cli.js +108 -49
- package/dist/commitment-ledger.js +1 -1
- package/dist/compat/checks.d.ts +5 -0
- package/dist/compat/checks.js +11 -0
- package/dist/compat/checks.js.map +1 -0
- package/dist/compat/types.d.ts +30 -0
- package/dist/compat/types.js +1 -0
- package/dist/compat/types.js.map +1 -0
- package/dist/compounding/engine.d.ts +221 -0
- package/dist/compounding/engine.js +32 -0
- package/dist/compounding/engine.js.map +1 -0
- package/dist/compounding/preference-consolidator.d.ts +92 -0
- package/dist/compounding/preference-consolidator.js +553 -0
- package/dist/compounding/preference-consolidator.js.map +1 -0
- package/dist/config.d.ts +4 -2
- package/dist/config.js +9 -4
- package/dist/conflict-policy-DyJ2wd-h.d.ts +4 -0
- package/dist/connectors/codex-materialize-runner.d.ts +64 -0
- package/dist/connectors/codex-materialize-runner.js +33 -0
- package/dist/connectors/codex-materialize-runner.js.map +1 -0
- package/dist/connectors/codex-materialize.d.ts +195 -0
- package/dist/connectors/codex-materialize.js +38 -0
- package/dist/connectors/codex-materialize.js.map +1 -0
- package/dist/connectors/index.d.ts +444 -0
- package/dist/connectors/index.js +115 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors-cli-CwbyjGR7.d.ts +257 -0
- package/dist/connectors-cli.d.ts +1 -1
- package/dist/consolidation-provenance-check.d.ts +3 -1
- package/dist/consolidation-undo.d.ts +3 -1
- package/dist/contradiction/index.d.ts +258 -0
- package/dist/contradiction/index.js +43 -0
- package/dist/contradiction/index.js.map +1 -0
- package/dist/contradiction-review-ATP4S6IC.js +30 -0
- package/dist/contradiction-review-ATP4S6IC.js.map +1 -0
- package/dist/contradiction-scan-5A4IDZV5.js +13 -0
- package/dist/contradiction-scan-5A4IDZV5.js.map +1 -0
- package/dist/conversation-index/backend.d.ts +97 -0
- package/dist/conversation-index/backend.js +13 -0
- package/dist/conversation-index/backend.js.map +1 -0
- package/dist/conversation-index/chunker.d.ts +16 -0
- package/dist/conversation-index/chunker.js +8 -0
- package/dist/conversation-index/chunker.js.map +1 -0
- package/dist/conversation-index/cleanup.d.ts +11 -0
- package/dist/conversation-index/cleanup.js +9 -0
- package/dist/conversation-index/cleanup.js.map +1 -0
- package/dist/conversation-index/faiss-adapter.d.ts +6 -0
- package/dist/conversation-index/faiss-adapter.js +16 -0
- package/dist/conversation-index/faiss-adapter.js.map +1 -0
- package/dist/conversation-index/indexer.d.ts +23 -0
- package/dist/conversation-index/indexer.js +15 -0
- package/dist/conversation-index/indexer.js.map +1 -0
- package/dist/conversation-index/search.d.ts +6 -0
- package/dist/conversation-index/search.js +11 -0
- package/dist/conversation-index/search.js.map +1 -0
- package/dist/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +163 -0
- package/dist/enrichment/index.js +18 -0
- package/dist/enrichment/index.js.map +1 -0
- package/dist/entity-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +8 -5
- package/dist/evals.js +1 -1
- package/dist/explicit-capture.d.ts +20 -5
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-training.js +1 -1
- package/dist/extraction.js +8 -8
- package/dist/faiss-adapter-CzPghc4C.d.ts +70 -0
- package/dist/fallback-llm.d.ts +2 -0
- package/dist/fallback-llm.js +4 -4
- package/dist/graph-edge-decay-5DI5GUNL.js +207 -0
- package/dist/index.d.ts +66 -711
- package/dist/index.js +556 -2680
- package/dist/index.js.map +1 -1
- package/dist/lcm/archive.d.ts +89 -0
- package/dist/lcm/archive.js +12 -0
- package/dist/lcm/archive.js.map +1 -0
- package/dist/lcm/dag.d.ts +48 -0
- package/dist/lcm/dag.js +8 -0
- package/dist/lcm/dag.js.map +1 -0
- package/dist/lcm/engine.d.ts +116 -0
- package/dist/lcm/engine.js +20 -0
- package/dist/lcm/engine.js.map +1 -0
- package/dist/lcm/index.d.ts +12 -0
- package/dist/lcm/index.js +44 -0
- package/dist/lcm/index.js.map +1 -0
- package/dist/lcm/queue.d.ts +62 -0
- package/dist/lcm/queue.js +8 -0
- package/dist/lcm/queue.js.map +1 -0
- package/dist/lcm/recall.d.ts +20 -0
- package/dist/lcm/recall.js +8 -0
- package/dist/lcm/recall.js.map +1 -0
- package/dist/lcm/schema.d.ts +16 -0
- package/dist/lcm/schema.js +14 -0
- package/dist/lcm/schema.js.map +1 -0
- package/dist/lcm/summarizer.d.ts +38 -0
- package/dist/lcm/summarizer.js +12 -0
- package/dist/lcm/summarizer.js.map +1 -0
- package/dist/lcm/tools.d.ts +29 -0
- package/dist/lcm/tools.js +8 -0
- package/dist/lcm/tools.js.map +1 -0
- package/dist/live-connectors-runner.js +5 -5
- package/dist/local-llm.js +3 -3
- package/dist/maintenance/archive-observations.d.ts +18 -0
- package/dist/maintenance/archive-observations.js +8 -0
- package/dist/maintenance/archive-observations.js.map +1 -0
- package/dist/maintenance/backup-stamp.d.ts +3 -0
- package/dist/maintenance/backup-stamp.js +8 -0
- package/dist/maintenance/backup-stamp.js.map +1 -0
- package/dist/maintenance/memory-governance-cron.d.ts +85 -0
- package/dist/maintenance/memory-governance-cron.js +22 -0
- package/dist/maintenance/memory-governance-cron.js.map +1 -0
- package/dist/maintenance/memory-governance.d.ts +137 -0
- package/dist/maintenance/memory-governance.js +40 -0
- package/dist/maintenance/memory-governance.js.map +1 -0
- package/dist/maintenance/migrate-observations.d.ts +18 -0
- package/dist/maintenance/migrate-observations.js +9 -0
- package/dist/maintenance/migrate-observations.js.map +1 -0
- package/dist/maintenance/observation-ledger-utils.d.ts +10 -0
- package/dist/maintenance/observation-ledger-utils.js +10 -0
- package/dist/maintenance/observation-ledger-utils.js.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +15 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +28 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js.map +1 -0
- package/dist/maintenance/rebuild-memory-projection.d.ts +77 -0
- package/dist/maintenance/rebuild-memory-projection.js +35 -0
- package/dist/maintenance/rebuild-memory-projection.js.map +1 -0
- package/dist/maintenance/rebuild-observations.d.ts +17 -0
- package/dist/maintenance/rebuild-observations.js +9 -0
- package/dist/maintenance/rebuild-observations.js.map +1 -0
- package/dist/mcp-memory-inspector-app.d.ts +24 -6
- package/dist/memory-projection-store.d.ts +108 -3
- package/dist/memory-projection-store.js +2 -1
- package/dist/memory-worth-outcomes.d.ts +4 -2
- package/dist/migrate/from-engram.d.ts +24 -0
- package/dist/migrate/from-engram.js +12 -0
- package/dist/migrate/from-engram.js.map +1 -0
- package/dist/namespaces/migrate.d.ts +50 -0
- package/dist/namespaces/migrate.js +50 -0
- package/dist/namespaces/migrate.js.map +1 -0
- package/dist/namespaces/principal.d.ts +17 -0
- package/dist/namespaces/principal.js +16 -0
- package/dist/namespaces/principal.js.map +1 -0
- package/dist/namespaces/search.d.ts +46 -0
- package/dist/namespaces/search.js +28 -0
- package/dist/namespaces/search.js.map +1 -0
- package/dist/namespaces/storage.d.ts +32 -0
- package/dist/namespaces/storage.js +28 -0
- package/dist/namespaces/storage.js.map +1 -0
- package/dist/network/tailscale.d.ts +41 -0
- package/dist/network/tailscale.js +9 -0
- package/dist/network/tailscale.js.map +1 -0
- package/dist/network/webdav.d.ts +39 -0
- package/dist/network/webdav.js +10 -0
- package/dist/network/webdav.js.map +1 -0
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +4 -2
- package/dist/operator-toolkit.js +32 -14
- package/dist/opik-exporter.js +2 -2
- package/dist/opik-exporter.js.map +1 -1
- package/dist/orchestrator-DuWl9Hwx.d.ts +1244 -0
- package/dist/orchestrator.d.ts +22 -7
- package/dist/orchestrator.js +79 -44
- package/dist/path-MR5JPYOP.js +9 -0
- package/dist/path-MR5JPYOP.js.map +1 -0
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +102 -3
- package/dist/qmd.js +23 -5
- package/dist/recall-explain-renderer.js +3 -3
- 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/replay/normalizers/chatgpt.d.ts +6 -0
- package/dist/replay/normalizers/chatgpt.js +11 -0
- package/dist/replay/normalizers/chatgpt.js.map +1 -0
- package/dist/replay/normalizers/claude.d.ts +6 -0
- package/dist/replay/normalizers/claude.js +11 -0
- package/dist/replay/normalizers/claude.js.map +1 -0
- package/dist/replay/normalizers/openclaw.d.ts +6 -0
- package/dist/replay/normalizers/openclaw.js +11 -0
- package/dist/replay/normalizers/openclaw.js.map +1 -0
- package/dist/replay/normalizers/shared.d.ts +16 -0
- package/dist/replay/normalizers/shared.js +14 -0
- package/dist/replay/normalizers/shared.js.map +1 -0
- package/dist/replay/runner.d.ts +35 -0
- package/dist/replay/runner.js +16 -0
- package/dist/replay/runner.js.map +1 -0
- package/dist/replay/types.d.ts +57 -0
- package/dist/replay/types.js +19 -0
- package/dist/replay/types.js.map +1 -0
- package/dist/resolution-B7FNQSSP.js +12 -0
- package/dist/resolution-B7FNQSSP.js.map +1 -0
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/resume-bundles.js +8 -6
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/routing/engine.d.ts +35 -0
- package/dist/routing/engine.js +16 -0
- package/dist/routing/engine.js.map +1 -0
- package/dist/routing/store.d.ts +27 -0
- package/dist/routing/store.js +10 -0
- package/dist/routing/store.js.map +1 -0
- package/dist/runtime/better-sqlite.d.ts +8 -0
- package/dist/runtime/better-sqlite.js +10 -0
- package/dist/runtime/better-sqlite.js.map +1 -0
- package/dist/runtime/child-process.d.ts +32 -0
- package/dist/runtime/child-process.js +10 -0
- package/dist/runtime/child-process.js.map +1 -0
- package/dist/runtime/env.d.ts +5 -0
- package/dist/runtime/env.js +12 -0
- package/dist/runtime/env.js.map +1 -0
- package/dist/schemas.d.ts +22 -22
- package/dist/sdk-compat.js +1 -1
- package/dist/search/document-scanner.d.ts +22 -0
- package/dist/search/document-scanner.js +8 -0
- package/dist/search/document-scanner.js.map +1 -0
- package/dist/search/embed-helper.d.ts +35 -0
- package/dist/search/embed-helper.js +9 -0
- package/dist/search/embed-helper.js.map +1 -0
- package/dist/search/factory.d.ts +32 -0
- package/dist/search/factory.js +29 -0
- package/dist/search/factory.js.map +1 -0
- package/dist/search/index.d.ts +15 -0
- package/dist/search/index.js +50 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/lancedb-backend.d.ts +51 -0
- package/dist/search/lancedb-backend.js +10 -0
- package/dist/search/lancedb-backend.js.map +1 -0
- package/dist/search/meilisearch-backend.d.ts +48 -0
- package/dist/search/meilisearch-backend.js +10 -0
- package/dist/search/meilisearch-backend.js.map +1 -0
- package/dist/search/noop-backend.d.ts +26 -0
- package/dist/search/noop-backend.js +8 -0
- package/dist/search/noop-backend.js.map +1 -0
- package/dist/search/orama-backend.d.ts +53 -0
- package/dist/search/orama-backend.js +10 -0
- package/dist/search/orama-backend.js.map +1 -0
- package/dist/search/port.d.ts +61 -0
- package/dist/search/port.js +1 -0
- package/dist/search/port.js.map +1 -0
- package/dist/search/remote-backend.d.ts +39 -0
- package/dist/search/remote-backend.js +9 -0
- package/dist/search/remote-backend.js.map +1 -0
- package/dist/secure-store/index.d.ts +890 -0
- package/dist/secure-store/index.js +156 -0
- package/dist/secure-store/index.js.map +1 -0
- package/dist/semantic-VwGI14Ok.d.ts +69 -0
- package/dist/semantic-consolidation-4HkHWgeI.d.ts +180 -0
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +13 -6
- package/dist/semantic-rule-promotion.js +8 -5
- package/dist/semantic-rule-verifier.js +8 -5
- package/dist/shared-context/manager.d.ts +131 -0
- package/dist/shared-context/manager.js +15 -0
- package/dist/shared-context/manager.js.map +1 -0
- package/dist/skills-registry.js +13 -1
- package/dist/skills-registry.js.map +1 -1
- package/dist/state-store-VZU2IA53.js +16 -0
- package/dist/state-store-VZU2IA53.js.map +1 -0
- package/dist/storage-paths.d.ts +9 -0
- package/dist/storage-paths.js +20 -0
- package/dist/storage-paths.js.map +1 -0
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +7 -4
- package/dist/summarizer.d.ts +5 -0
- package/dist/summarizer.js +9 -8
- package/dist/summary-snapshot.js +2 -1
- package/dist/surfaces/dreams.d.ts +16 -0
- package/dist/surfaces/dreams.js +282 -0
- package/dist/surfaces/dreams.js.map +1 -0
- package/dist/surfaces/heartbeat.d.ts +17 -0
- package/dist/surfaces/heartbeat.js +265 -0
- package/dist/surfaces/heartbeat.js.map +1 -0
- package/dist/temporal-supersession.d.ts +3 -1
- package/dist/threading.d.ts +5 -0
- package/dist/threading.js +2 -1
- package/dist/tier-migration.d.ts +4 -2
- package/dist/tokens.js +2 -2
- package/dist/transcript.d.ts +15 -1
- package/dist/transcript.js +2 -1
- package/dist/transfer/autodetect.d.ts +4 -0
- package/dist/transfer/autodetect.js +15 -0
- package/dist/transfer/autodetect.js.map +1 -0
- package/dist/transfer/backup.d.ts +21 -0
- package/dist/transfer/backup.js +17 -0
- package/dist/transfer/backup.js.map +1 -0
- package/dist/transfer/capsule-export.d.ts +113 -0
- package/dist/transfer/capsule-export.js +19 -0
- package/dist/transfer/capsule-export.js.map +1 -0
- package/dist/transfer/capsule-import.d.ts +124 -0
- package/dist/transfer/capsule-import.js +16 -0
- package/dist/transfer/capsule-import.js.map +1 -0
- package/dist/transfer/constants.d.ts +13 -0
- package/dist/transfer/constants.js +12 -0
- package/dist/transfer/constants.js.map +1 -0
- package/dist/transfer/export-json.d.ts +11 -0
- package/dist/transfer/export-json.js +11 -0
- package/dist/transfer/export-json.js.map +1 -0
- package/dist/transfer/export-md.d.ts +10 -0
- package/dist/transfer/export-md.js +13 -0
- package/dist/transfer/export-md.js.map +1 -0
- package/dist/transfer/export-sqlite.d.ts +9 -0
- package/dist/transfer/export-sqlite.js +12 -0
- package/dist/transfer/export-sqlite.js.map +1 -0
- package/dist/transfer/fs-utils.d.ts +61 -0
- package/dist/transfer/fs-utils.js +40 -0
- package/dist/transfer/fs-utils.js.map +1 -0
- package/dist/transfer/import-json.d.ts +16 -0
- package/dist/transfer/import-json.js +13 -0
- package/dist/transfer/import-json.js.map +1 -0
- package/dist/transfer/import-md.d.ts +14 -0
- package/dist/transfer/import-md.js +11 -0
- package/dist/transfer/import-md.js.map +1 -0
- package/dist/transfer/import-sqlite.d.ts +14 -0
- package/dist/transfer/import-sqlite.js +12 -0
- package/dist/transfer/import-sqlite.js.map +1 -0
- package/dist/transfer/sqlite-schema.d.ts +4 -0
- package/dist/transfer/sqlite-schema.js +10 -0
- package/dist/transfer/sqlite-schema.js.map +1 -0
- package/dist/transfer/types.d.ts +916 -0
- package/dist/transfer/types.js +30 -0
- package/dist/transfer/types.js.map +1 -0
- package/dist/types.d.ts +28 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +9 -6
- package/dist/work/board.d.ts +43 -0
- package/dist/work/board.js +14 -0
- package/dist/work/board.js.map +1 -0
- package/dist/work/boundary.d.ts +8 -0
- package/dist/work/boundary.js +14 -0
- package/dist/work/boundary.js.map +1 -0
- package/dist/work/storage.d.ts +39 -0
- package/dist/work/storage.js +11 -0
- package/dist/work/storage.js.map +1 -0
- package/dist/work/types.d.ts +75 -0
- package/dist/work/types.js +1 -0
- package/dist/work/types.js.map +1 -0
- package/package.json +2767 -6
- package/scripts/faiss_index.py +816 -0
- package/scripts/faiss_requirements.txt +3 -0
- package/skills/remnic-entities/SKILL.md +51 -0
- package/skills/remnic-memory-workflow/SKILL.md +61 -0
- package/skills/remnic-recall/SKILL.md +51 -0
- package/skills/remnic-remember/SKILL.md +56 -0
- package/skills/remnic-search/SKILL.md +51 -0
- package/skills/remnic-status/SKILL.md +51 -0
- package/src/abort-error.test.ts +49 -0
- package/src/abort-error.ts +46 -0
- package/src/abstraction-nodes.ts +162 -0
- package/src/access-audit.test.ts +178 -0
- package/src/access-audit.ts +125 -0
- package/src/access-cli.test.ts +439 -0
- package/src/access-cli.ts +438 -0
- package/src/access-http.test.ts +225 -0
- package/src/access-http.ts +1899 -0
- package/src/access-idempotency.ts +232 -0
- package/src/access-mcp.test.ts +568 -0
- package/src/access-mcp.ts +3056 -0
- package/src/access-schema-pi.test.ts +60 -0
- package/src/access-schema.ts +522 -0
- package/src/access-service-namespace.test.ts +123 -0
- package/src/access-service.ts +5629 -0
- package/src/action-confidence.test.ts +206 -0
- package/src/action-confidence.ts +466 -0
- package/src/active-memory-bridge.test.ts +285 -0
- package/src/active-memory-bridge.ts +217 -0
- package/src/active-recall.test.ts +484 -0
- package/src/active-recall.ts +459 -0
- package/src/adapters/claude-code.ts +56 -0
- package/src/adapters/codex.ts +57 -0
- package/src/adapters/hermes.ts +64 -0
- package/src/adapters/index.ts +6 -0
- package/src/adapters/registry.ts +41 -0
- package/src/adapters/replit.ts +55 -0
- package/src/adapters/types.ts +51 -0
- package/src/behavior-learner.ts +144 -0
- package/src/behavior-signals.ts +73 -0
- package/src/binary-lifecycle/backend.ts +117 -0
- package/src/binary-lifecycle/index.ts +35 -0
- package/src/binary-lifecycle/manifest.ts +79 -0
- package/src/binary-lifecycle/pipeline.ts +352 -0
- package/src/binary-lifecycle/scanner.ts +89 -0
- package/src/binary-lifecycle/types.ts +89 -0
- package/src/bootstrap.ts +178 -0
- package/src/boxes.ts +521 -0
- package/src/briefing.test.ts +1535 -0
- package/src/briefing.ts +1382 -0
- package/src/buffer-session.test.ts +443 -0
- package/src/buffer-surprise-report.ts +176 -0
- package/src/buffer-surprise-telemetry.test.ts +606 -0
- package/src/buffer-surprise-trigger.test.ts +766 -0
- package/src/buffer-surprise.test.ts +339 -0
- package/src/buffer-surprise.ts +203 -0
- package/src/buffer.ts +900 -0
- package/src/bulk-import/cli-command.test.ts +204 -0
- package/src/bulk-import/index.ts +34 -0
- package/src/bulk-import/pipeline.test.ts +445 -0
- package/src/bulk-import/pipeline.ts +178 -0
- package/src/bulk-import/registry.test.ts +151 -0
- package/src/bulk-import/registry.ts +72 -0
- package/src/bulk-import/types.test.ts +272 -0
- package/src/bulk-import/types.ts +145 -0
- package/src/calibration.ts +394 -0
- package/src/capsule-cli.test.ts +398 -0
- package/src/capsule-cli.ts +565 -0
- package/src/causal-behavior.ts +308 -0
- package/src/causal-chain.ts +419 -0
- package/src/causal-consolidation.ts +370 -0
- package/src/causal-retrieval.ts +286 -0
- package/src/causal-trajectory-graph.ts +60 -0
- package/src/causal-trajectory.ts +303 -0
- package/src/chunking.ts +220 -0
- package/src/citations.ts +232 -0
- package/src/cli.ts +9403 -0
- package/src/codex-cli-fallback.ts +162 -0
- package/src/codex-thread-key.ts +1 -0
- package/src/coding/access-coding-context.test.ts +197 -0
- package/src/coding/coding-branch-scope.test.ts +281 -0
- package/src/coding/coding-namespace.test.ts +360 -0
- package/src/coding/coding-namespace.ts +412 -0
- package/src/coding/coding-orchestrator.test.ts +249 -0
- package/src/coding/git-context.test.ts +507 -0
- package/src/coding/git-context.ts +336 -0
- package/src/coding/mcp-set-coding-context.test.ts +174 -0
- package/src/coding/review-context.test.ts +316 -0
- package/src/coding/review-context.ts +349 -0
- package/src/coding/wire-coding-context.test.ts +468 -0
- package/src/commitment-ledger.test.ts +78 -0
- package/src/commitment-ledger.ts +337 -0
- package/src/compat/checks.test.ts +206 -0
- package/src/compat/checks.ts +716 -0
- package/src/compat/types.ts +33 -0
- package/src/compounding/engine.ts +1686 -0
- package/src/compounding/preference-consolidator.ts +778 -0
- package/src/compression-optimizer.ts +312 -0
- package/src/config.test.ts +930 -0
- package/src/config.ts +3807 -0
- package/src/connectors/codex/instructions.md +160 -0
- package/src/connectors/codex/resources/namespace-cheatsheet.md +48 -0
- package/src/connectors/codex-marketplace.ts +500 -0
- package/src/connectors/codex-materialize-runner.ts +212 -0
- package/src/connectors/codex-materialize.ts +983 -0
- package/src/connectors/coerce.ts +62 -0
- package/src/connectors/index.test.ts +1570 -0
- package/src/connectors/index.ts +3222 -0
- package/src/connectors/live/framework.ts +164 -0
- package/src/connectors/live/github.test.ts +1218 -0
- package/src/connectors/live/github.ts +1068 -0
- package/src/connectors/live/gmail.test.ts +1706 -0
- package/src/connectors/live/gmail.ts +1293 -0
- package/src/connectors/live/google-drive.test.ts +696 -0
- package/src/connectors/live/google-drive.ts +724 -0
- package/src/connectors/live/index.ts +101 -0
- package/src/connectors/live/live-connectors.test.ts +689 -0
- package/src/connectors/live/notion.test.ts +1109 -0
- package/src/connectors/live/notion.ts +978 -0
- package/src/connectors/live/registry.ts +103 -0
- package/src/connectors/live/state-store.ts +399 -0
- package/src/connectors/live/transient-errors.ts +150 -0
- package/src/connectors/weclone-installer.test.ts +850 -0
- package/src/connectors-cli.ts +513 -0
- package/src/console/state.test.ts +224 -0
- package/src/console/state.ts +514 -0
- package/src/console/trace.test.ts +813 -0
- package/src/console/trace.ts +603 -0
- package/src/console/tui.test.ts +582 -0
- package/src/console/tui.ts +508 -0
- package/src/consolidation-operator.ts +182 -0
- package/src/consolidation-provenance-check.ts +551 -0
- package/src/consolidation-undo.ts +718 -0
- package/src/contradiction/contradiction-judge.test.ts +189 -0
- package/src/contradiction/contradiction-judge.ts +333 -0
- package/src/contradiction/contradiction-review.ts +574 -0
- package/src/contradiction/contradiction-scan.ts +504 -0
- package/src/contradiction/contradiction.test.ts +2230 -0
- package/src/contradiction/index.ts +37 -0
- package/src/contradiction/resolution.ts +383 -0
- package/src/conversation-index/backend.ts +323 -0
- package/src/conversation-index/chunker.ts +47 -0
- package/src/conversation-index/cleanup.ts +53 -0
- package/src/conversation-index/faiss-adapter.ts +384 -0
- package/src/conversation-index/indexer.test.ts +164 -0
- package/src/conversation-index/indexer.ts +192 -0
- package/src/conversation-index/search.ts +37 -0
- package/src/cross-namespace-budget.test.ts +275 -0
- package/src/cross-namespace-budget.ts +365 -0
- package/src/cue-anchors.ts +163 -0
- package/src/curation/index.ts +544 -0
- package/src/dashboard-runtime.ts +337 -0
- package/src/day-summary.ts +122 -0
- package/src/dedup/index.ts +330 -0
- package/src/dedup/semantic.test.ts +1577 -0
- package/src/dedup/semantic.ts +148 -0
- package/src/delinearize.ts +193 -0
- package/src/direct-answer-wiring.test.ts +473 -0
- package/src/direct-answer-wiring.ts +180 -0
- package/src/direct-answer.test.ts +484 -0
- package/src/direct-answer.ts +273 -0
- package/src/embedding-fallback.ts +565 -0
- package/src/enrichment/audit.ts +89 -0
- package/src/enrichment/index.ts +27 -0
- package/src/enrichment/pipeline.ts +197 -0
- package/src/enrichment/provider-registry.ts +85 -0
- package/src/enrichment/types.ts +100 -0
- package/src/enrichment/web-search-provider.ts +63 -0
- package/src/entity-retrieval.ts +774 -0
- package/src/entity-schema.ts +239 -0
- package/src/evals.ts +1312 -0
- package/src/event-order-recall.test.ts +4164 -0
- package/src/event-order-recall.ts +2802 -0
- package/src/evidence-pack.test.ts +89 -0
- package/src/evidence-pack.ts +388 -0
- package/src/explicit-capture.ts +530 -0
- package/src/explicit-cue-recall.test.ts +3019 -0
- package/src/explicit-cue-recall.ts +5545 -0
- package/src/extraction-judge-telemetry.ts +234 -0
- package/src/extraction-judge-training.ts +221 -0
- package/src/extraction-judge.ts +846 -0
- package/src/extraction-timeout.test.ts +265 -0
- package/src/extraction.ts +2719 -0
- package/src/fallback-llm.test.ts +1060 -0
- package/src/fallback-llm.ts +918 -0
- package/src/focused-list-recall.test.ts +734 -0
- package/src/focused-list-recall.ts +1160 -0
- package/src/graph-dashboard-diff.ts +35 -0
- package/src/graph-dashboard-key.ts +5 -0
- package/src/graph-dashboard-parser.ts +104 -0
- package/src/graph-edge-reinforcement.ts +192 -0
- package/src/graph-events.ts +151 -0
- package/src/graph-recall.test.ts +164 -0
- package/src/graph-recall.ts +189 -0
- package/src/graph-retrieval.test.ts +809 -0
- package/src/graph-retrieval.ts +823 -0
- package/src/graph-snapshot.ts +329 -0
- package/src/graph.ts +813 -0
- package/src/harmonic-retrieval.ts +223 -0
- package/src/himem.ts +154 -0
- package/src/hygiene.ts +87 -0
- package/src/identity-continuity.ts +333 -0
- package/src/importance.ts +328 -0
- package/src/importers/base.test.ts +294 -0
- package/src/importers/base.ts +436 -0
- package/src/importers/index.ts +21 -0
- package/src/index.ts +1204 -0
- package/src/intent.ts +154 -0
- package/src/json-extract.ts +85 -0
- package/src/json-store.ts +42 -0
- package/src/lcm/archive.ts +617 -0
- package/src/lcm/dag.ts +199 -0
- package/src/lcm/engine.ts +645 -0
- package/src/lcm/index.ts +7 -0
- package/src/lcm/queue.test.ts +178 -0
- package/src/lcm/queue.ts +200 -0
- package/src/lcm/recall.ts +117 -0
- package/src/lcm/schema.ts +154 -0
- package/src/lcm/summarizer.ts +235 -0
- package/src/lcm/tools.ts +191 -0
- package/src/lcm-engine.test.ts +660 -0
- package/src/legacy-hook-compat.test.ts +20 -0
- package/src/legacy-hook-compat.ts +45 -0
- package/src/lifecycle.ts +289 -0
- package/src/live-connectors-runner.ts +385 -0
- package/src/local-llm-qos.test.ts +303 -0
- package/src/local-llm-thinking.test.ts +292 -0
- package/src/local-llm.ts +1464 -0
- package/src/logger.ts +49 -0
- package/src/maintenance/archive-observations.ts +147 -0
- package/src/maintenance/backup-stamp.ts +3 -0
- package/src/maintenance/dreams-ledger.ts +516 -0
- package/src/maintenance/first-start-migration.ts +362 -0
- package/src/maintenance/forget.test.ts +206 -0
- package/src/maintenance/forget.ts +126 -0
- package/src/maintenance/graph-edge-decay.test.ts +409 -0
- package/src/maintenance/graph-edge-decay.ts +394 -0
- package/src/maintenance/memory-governance-cron.ts +447 -0
- package/src/maintenance/memory-governance.ts +1039 -0
- package/src/maintenance/migrate-observations.ts +216 -0
- package/src/maintenance/observation-ledger-utils.ts +54 -0
- package/src/maintenance/pattern-reinforcement.test.ts +875 -0
- package/src/maintenance/pattern-reinforcement.ts +369 -0
- package/src/maintenance/purge.ts +334 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +78 -0
- package/src/maintenance/rebuild-memory-projection.ts +1234 -0
- package/src/maintenance/rebuild-observations.ts +178 -0
- package/src/maintenance/tier-stats.test.ts +378 -0
- package/src/maintenance/tier-stats.ts +222 -0
- package/src/mcp-memory-inspector-app.ts +421 -0
- package/src/memory-action-policy.ts +80 -0
- package/src/memory-cache.ts +208 -0
- package/src/memory-extension/claude-code-publisher.ts +51 -0
- package/src/memory-extension/codex-publisher.ts +149 -0
- package/src/memory-extension/hermes-publisher.ts +51 -0
- package/src/memory-extension/index.ts +100 -0
- package/src/memory-extension/shared-instructions.ts +133 -0
- package/src/memory-extension/types.ts +86 -0
- package/src/memory-extension-host/host-discovery.ts +276 -0
- package/src/memory-extension-host/index.ts +14 -0
- package/src/memory-extension-host/render-extensions-block.ts +73 -0
- package/src/memory-extension-host/types.ts +21 -0
- package/src/memory-lifecycle-ledger-utils.ts +116 -0
- package/src/memory-projection-format.ts +11 -0
- package/src/memory-projection-store.ts +951 -0
- package/src/memory-provenance.test.ts +196 -0
- package/src/memory-provenance.ts +484 -0
- package/src/memory-worth-bench.test.ts +71 -0
- package/src/memory-worth-bench.ts +265 -0
- package/src/memory-worth-filter.test.ts +209 -0
- package/src/memory-worth-filter.ts +204 -0
- package/src/memory-worth-frontmatter.test.ts +311 -0
- package/src/memory-worth-outcomes.test.ts +316 -0
- package/src/memory-worth-outcomes.ts +286 -0
- package/src/memory-worth.test.ts +317 -0
- package/src/memory-worth.ts +215 -0
- package/src/message-parts/index.ts +806 -0
- package/src/message-parts/message-parts.test.ts +421 -0
- package/src/migrate/from-engram.ts +789 -0
- package/src/model-registry.ts +313 -0
- package/src/models-json.ts +76 -0
- package/src/namespaces/migrate.ts +187 -0
- package/src/namespaces/path.ts +25 -0
- package/src/namespaces/principal.test.ts +195 -0
- package/src/namespaces/principal.ts +86 -0
- package/src/namespaces/search.test.ts +105 -0
- package/src/namespaces/search.ts +233 -0
- package/src/namespaces/storage.ts +74 -0
- package/src/native-knowledge.ts +1823 -0
- package/src/negative.ts +72 -0
- package/src/network/tailscale.ts +179 -0
- package/src/network/webdav.ts +385 -0
- package/src/objective-state-writers.ts +951 -0
- package/src/objective-state.ts +320 -0
- package/src/onboarding/index.ts +529 -0
- package/src/openai-chat-compat.ts +56 -0
- package/src/operator-toolkit.ts +2132 -0
- package/src/opik-exporter.test.ts +72 -0
- package/src/opik-exporter.ts +587 -0
- package/src/orchestrator-extraction-queue.test.ts +197 -0
- package/src/orchestrator-flush.test.ts +1171 -0
- package/src/orchestrator-pattern-reinforcement.test.ts +128 -0
- package/src/orchestrator-source-attribution.test.ts +701 -0
- package/src/orchestrator.ts +16368 -0
- package/src/page-versioning.ts +450 -0
- package/src/patterns-cli.ts +574 -0
- package/src/peers/index.ts +54 -0
- package/src/peers/migrate-from-identity-anchor.test.ts +291 -0
- package/src/peers/migrate-from-identity-anchor.ts +350 -0
- package/src/peers/peers.test.ts +419 -0
- package/src/peers/profile-reasoner.ts +694 -0
- package/src/peers/storage.ts +1350 -0
- package/src/peers/types.ts +138 -0
- package/src/plugin-id.ts +84 -0
- package/src/policy-runtime.ts +209 -0
- package/src/procedural/procedure-miner.ts +150 -0
- package/src/procedural/procedure-recall.ts +93 -0
- package/src/procedural/procedure-stats.ts +213 -0
- package/src/procedural/procedure-types.ts +132 -0
- package/src/procedural/reinforcement-core.test.ts +132 -0
- package/src/procedural/reinforcement-core.ts +73 -0
- package/src/profiling.test.ts +263 -0
- package/src/profiling.ts +435 -0
- package/src/projection/index.ts +398 -0
- package/src/qmd-recall-cache.test.ts +138 -0
- package/src/qmd-recall-cache.ts +111 -0
- package/src/qmd.test.ts +258 -0
- package/src/qmd.ts +2614 -0
- package/src/reasoning-trace-recall.ts +201 -0
- package/src/reasoning-trace-types.ts +235 -0
- package/src/recall-audit-anomaly.test.ts +246 -0
- package/src/recall-audit-anomaly.ts +297 -0
- package/src/recall-audit.test.ts +51 -0
- package/src/recall-audit.ts +72 -0
- package/src/recall-budget-config.test.ts +87 -0
- package/src/recall-disclosure-escalation.test.ts +196 -0
- package/src/recall-disclosure-escalation.ts +158 -0
- package/src/recall-disclosure-shaping.test.ts +146 -0
- package/src/recall-disclosure.test.ts +214 -0
- package/src/recall-explain-renderer.test.ts +140 -0
- package/src/recall-explain-renderer.ts +356 -0
- package/src/recall-mmr.test.ts +808 -0
- package/src/recall-mmr.ts +607 -0
- package/src/recall-qos.test.ts +85 -0
- package/src/recall-qos.ts +82 -0
- package/src/recall-query-policy.ts +221 -0
- package/src/recall-state.test.ts +233 -0
- package/src/recall-state.ts +456 -0
- package/src/recall-tag-filter.ts +143 -0
- package/src/recall-tokenization.ts +35 -0
- package/src/recall-xray-cli.test.ts +118 -0
- package/src/recall-xray-cli.ts +100 -0
- package/src/recall-xray-disclosure-telemetry.test.ts +183 -0
- package/src/recall-xray-renderer.test.ts +539 -0
- package/src/recall-xray-renderer.ts +487 -0
- package/src/recall-xray.test.ts +503 -0
- package/src/recall-xray.ts +621 -0
- package/src/reconstruct.ts +41 -0
- package/src/release-changelog.ts +35 -0
- package/src/relevance.ts +67 -0
- package/src/replay/normalizers/chatgpt.ts +133 -0
- package/src/replay/normalizers/claude.ts +102 -0
- package/src/replay/normalizers/openclaw.ts +119 -0
- package/src/replay/normalizers/shared.ts +69 -0
- package/src/replay/runner.ts +197 -0
- package/src/replay/types.ts +143 -0
- package/src/rerank.test.ts +48 -0
- package/src/rerank.ts +176 -0
- package/src/resolve-auth-token.test.ts +226 -0
- package/src/resolve-auth-token.ts +151 -0
- package/src/resolve-provider-secret.test.ts +187 -0
- package/src/resolve-provider-secret.ts +410 -0
- package/src/response-guidance-recall.test.ts +3952 -0
- package/src/response-guidance-recall.ts +4431 -0
- package/src/resume-bundles.ts +415 -0
- package/src/retrieval-agents.ts +623 -0
- package/src/retrieval-tiers.ts +25 -0
- package/src/retrieval.ts +104 -0
- package/src/review/index.test.ts +201 -0
- package/src/review/index.ts +536 -0
- package/src/routing/engine.ts +162 -0
- package/src/routing/store.ts +321 -0
- package/src/runtime/better-sqlite.test.ts +32 -0
- package/src/runtime/better-sqlite.ts +76 -0
- package/src/runtime/child-process.ts +67 -0
- package/src/runtime/env.ts +48 -0
- package/src/sanitize.ts +58 -0
- package/src/schemas.ts +449 -0
- package/src/sdk-compat.ts +87 -0
- package/src/search/document-scanner.ts +96 -0
- package/src/search/embed-helper.ts +142 -0
- package/src/search/factory.ts +189 -0
- package/src/search/index.ts +10 -0
- package/src/search/lancedb-backend.ts +342 -0
- package/src/search/meilisearch-backend.ts +232 -0
- package/src/search/noop-backend.ts +57 -0
- package/src/search/orama-backend.ts +358 -0
- package/src/search/port.ts +86 -0
- package/src/search/remote-backend.ts +124 -0
- package/src/secure-store/cipher.ts +271 -0
- package/src/secure-store/cli-handlers.ts +355 -0
- package/src/secure-store/cli-renderer.ts +131 -0
- package/src/secure-store/header.ts +373 -0
- package/src/secure-store/index.ts +137 -0
- package/src/secure-store/kdf.ts +263 -0
- package/src/secure-store/keyring.ts +106 -0
- package/src/secure-store/metadata.ts +394 -0
- package/src/secure-store/passphrase-reader.ts +252 -0
- package/src/secure-store/secure-fs.ts +571 -0
- package/src/secure-store/secure-store.test.ts +755 -0
- package/src/semantic-chunking.ts +545 -0
- package/src/semantic-consolidation.test.ts +182 -0
- package/src/semantic-consolidation.ts +432 -0
- package/src/semantic-rule-promotion.ts +183 -0
- package/src/semantic-rule-verifier.ts +160 -0
- package/src/session-integrity.ts +569 -0
- package/src/session-observer-bands.ts +11 -0
- package/src/session-observer-state.ts +346 -0
- package/src/session-toggles.test.ts +96 -0
- package/src/session-toggles.ts +159 -0
- package/src/shared-context/manager.ts +810 -0
- package/src/signal.ts +84 -0
- package/src/skills-registry.test.ts +277 -0
- package/src/skills-registry.ts +120 -0
- package/src/source-attribution-roundtrip.test.ts +215 -0
- package/src/source-attribution.test.ts +1425 -0
- package/src/source-attribution.ts +639 -0
- package/src/spaces/index.ts +627 -0
- package/src/storage-paths.ts +117 -0
- package/src/storage.ts +6657 -0
- package/src/store-contract.ts +55 -0
- package/src/summarizer.ts +844 -0
- package/src/summary-snapshot.test.ts +681 -0
- package/src/summary-snapshot.ts +238 -0
- package/src/surfaces/dreams.test.ts +394 -0
- package/src/surfaces/dreams.ts +346 -0
- package/src/surfaces/heartbeat.test.ts +415 -0
- package/src/surfaces/heartbeat.ts +325 -0
- package/src/sync/index.ts +308 -0
- package/src/targeted-fact-recall.test.ts +1694 -0
- package/src/targeted-fact-recall.ts +2905 -0
- package/src/taxonomy/default-taxonomy.ts +87 -0
- package/src/taxonomy/index.ts +26 -0
- package/src/taxonomy/resolver-doc-generator.ts +57 -0
- package/src/taxonomy/resolver.ts +184 -0
- package/src/taxonomy/taxonomy-loader.ts +186 -0
- package/src/taxonomy/types.ts +48 -0
- package/src/telemetry-transcript.ts +70 -0
- package/src/temporal-index.ts +890 -0
- package/src/temporal-supersession.test.ts +2703 -0
- package/src/temporal-supersession.ts +493 -0
- package/src/temporal-validity.test.ts +448 -0
- package/src/temporal-validity.ts +123 -0
- package/src/threading.ts +395 -0
- package/src/tier-migration.ts +124 -0
- package/src/tier-routing.ts +102 -0
- package/src/tmt.ts +462 -0
- package/src/tokens.test.ts +178 -0
- package/src/tokens.ts +279 -0
- package/src/topics.ts +147 -0
- package/src/training-export/cli-date-validation.test.ts +258 -0
- package/src/training-export/converter.test.ts +452 -0
- package/src/training-export/converter.ts +319 -0
- package/src/training-export/date-parse.ts +117 -0
- package/src/training-export/index.ts +26 -0
- package/src/training-export/registry.test.ts +85 -0
- package/src/training-export/registry.ts +57 -0
- package/src/training-export/types.ts +31 -0
- package/src/transcript.ts +1179 -0
- package/src/transfer/autodetect.ts +30 -0
- package/src/transfer/backup.ts +138 -0
- package/src/transfer/capsule-crypto.ts +485 -0
- package/src/transfer/capsule-encrypt.test.ts +690 -0
- package/src/transfer/capsule-export.ts +543 -0
- package/src/transfer/capsule-fork.ts +375 -0
- package/src/transfer/capsule-import.ts +564 -0
- package/src/transfer/capsule-merge.ts +433 -0
- package/src/transfer/conflict-policy.ts +16 -0
- package/src/transfer/constants.ts +13 -0
- package/src/transfer/exclusions.ts +37 -0
- package/src/transfer/export-json.ts +65 -0
- package/src/transfer/export-md.ts +59 -0
- package/src/transfer/export-sqlite.ts +52 -0
- package/src/transfer/fs-utils.ts +269 -0
- package/src/transfer/import-json.ts +108 -0
- package/src/transfer/import-md.ts +84 -0
- package/src/transfer/import-sqlite.ts +100 -0
- package/src/transfer/integrity.ts +71 -0
- package/src/transfer/sqlite-schema.ts +16 -0
- package/src/transfer/types.ts +297 -0
- package/src/trust-zones.ts +1186 -0
- package/src/types.ts +3074 -0
- package/src/user-model.test.ts +124 -0
- package/src/user-model.ts +162 -0
- package/src/utility-learner.ts +353 -0
- package/src/utility-runtime.ts +88 -0
- package/src/utility-telemetry.ts +215 -0
- package/src/utils/category-dir.ts +44 -0
- package/src/utils/errno.ts +6 -0
- package/src/utils/iso-timestamp.test.ts +37 -0
- package/src/utils/iso-timestamp.ts +164 -0
- package/src/utils/path.ts +26 -0
- package/src/verified-recall.ts +138 -0
- package/src/version-utils.test.ts +10 -0
- package/src/version-utils.ts +9 -0
- package/src/whitespace.ts +10 -0
- package/src/work/board.ts +359 -0
- package/src/work/boundary.ts +107 -0
- package/src/work/storage.ts +436 -0
- package/src/work/types.ts +82 -0
- package/src/work-product-ledger.ts +265 -0
- package/dist/access-service-DDjzFALq.d.ts +0 -2088
- package/dist/capsule-crypto-SJS5VVAP.js +0 -18
- package/dist/capsule-export-7QNCBZOQ.js +0 -17
- package/dist/capsule-import-EPBHD2EN.js +0 -16
- package/dist/capsule-merge-DI7PNQ2H.js +0 -189
- package/dist/chunk-23ZZK64Y.js +0 -26
- package/dist/chunk-23ZZK64Y.js.map +0 -1
- package/dist/chunk-242S3I2A.js +0 -647
- package/dist/chunk-2LGMW3DJ.js +0 -111
- package/dist/chunk-3B6KIRBH.js +0 -5213
- package/dist/chunk-3B6KIRBH.js.map +0 -1
- package/dist/chunk-457A4P3L.js +0 -119
- package/dist/chunk-457A4P3L.js.map +0 -1
- package/dist/chunk-4IS4SXIQ.js +0 -2040
- package/dist/chunk-4YM32CRU.js +0 -721
- package/dist/chunk-6TBWYBJ3.js +0 -236
- package/dist/chunk-74EMIVE4.js +0 -329
- package/dist/chunk-74EMIVE4.js.map +0 -1
- package/dist/chunk-767ODGE6.js +0 -183
- package/dist/chunk-7V22HTMD.js +0 -623
- package/dist/chunk-7V22HTMD.js.map +0 -1
- package/dist/chunk-7ZM3BFKK.js +0 -9705
- package/dist/chunk-7ZM3BFKK.js.map +0 -1
- package/dist/chunk-AQJNPMOA.js +0 -643
- package/dist/chunk-AQJNPMOA.js.map +0 -1
- package/dist/chunk-ASAITVLA.js +0 -64
- package/dist/chunk-ASAITVLA.js.map +0 -1
- package/dist/chunk-BBE34QBJ.js +0 -275
- package/dist/chunk-BBE34QBJ.js.map +0 -1
- package/dist/chunk-BZSQEPRW.js +0 -14710
- package/dist/chunk-BZSQEPRW.js.map +0 -1
- package/dist/chunk-CPKTBRS2.js +0 -891
- package/dist/chunk-CPKTBRS2.js.map +0 -1
- package/dist/chunk-D4GAOFF6.js +0 -562
- package/dist/chunk-D4GAOFF6.js.map +0 -1
- package/dist/chunk-D54LZC5L.js +0 -147
- package/dist/chunk-DF3RVK3X.js +0 -119
- package/dist/chunk-DF3RVK3X.js.map +0 -1
- package/dist/chunk-DZZPC36E.js +0 -1451
- package/dist/chunk-DZZPC36E.js.map +0 -1
- package/dist/chunk-E2UCDP5S.js +0 -570
- package/dist/chunk-E6K4NIEU.js +0 -747
- package/dist/chunk-E6K4NIEU.js.map +0 -1
- package/dist/chunk-EEQLFRUM.js +0 -89
- package/dist/chunk-ETOW6ACV.js +0 -158
- package/dist/chunk-ETOW6ACV.js.map +0 -1
- package/dist/chunk-FMEBPEAO.js +0 -347
- package/dist/chunk-FMEBPEAO.js.map +0 -1
- package/dist/chunk-FQDPCE3I.js +0 -1837
- package/dist/chunk-FQDPCE3I.js.map +0 -1
- package/dist/chunk-FYIYMQ5N.js +0 -221
- package/dist/chunk-FYIYMQ5N.js.map +0 -1
- package/dist/chunk-G2WADRQ3.js +0 -219
- package/dist/chunk-G4SK7DSQ.js +0 -121
- package/dist/chunk-GVPWB7EY.js +0 -390
- package/dist/chunk-GVPWB7EY.js.map +0 -1
- package/dist/chunk-HELQZFZO.js +0 -1075
- package/dist/chunk-HL5LRPNA.js +0 -1914
- package/dist/chunk-HL5LRPNA.js.map +0 -1
- package/dist/chunk-HQZVVSVB.js +0 -147
- package/dist/chunk-HQZVVSVB.js.map +0 -1
- package/dist/chunk-HY3L4WKC.js +0 -2195
- package/dist/chunk-HY3L4WKC.js.map +0 -1
- package/dist/chunk-IB3BFHGN.js +0 -228
- package/dist/chunk-IXEJRKCZ.js +0 -18
- package/dist/chunk-JBMSGZEQ.js +0 -441
- package/dist/chunk-JBMSGZEQ.js.map +0 -1
- package/dist/chunk-JESOB2HO.js +0 -108
- package/dist/chunk-JKDVIE52.js +0 -272
- package/dist/chunk-JRNQ3RNA.js +0 -284
- package/dist/chunk-JRNQ3RNA.js.map +0 -1
- package/dist/chunk-K6WK37A6.js +0 -865
- package/dist/chunk-K6WK37A6.js.map +0 -1
- package/dist/chunk-MARWOCVP.js +0 -48
- package/dist/chunk-MNU6ZBWT.js +0 -4454
- package/dist/chunk-MNU6ZBWT.js.map +0 -1
- package/dist/chunk-N5AKDXAI.js +0 -74
- package/dist/chunk-OA3L7BFR.js +0 -183
- package/dist/chunk-OA3L7BFR.js.map +0 -1
- package/dist/chunk-OR64ZGRZ.js +0 -23
- package/dist/chunk-P77UEOU2.js +0 -1521
- package/dist/chunk-P77UEOU2.js.map +0 -1
- package/dist/chunk-PH4C2U43.js +0 -239
- package/dist/chunk-PH4C2U43.js.map +0 -1
- package/dist/chunk-RVPLBATS.js +0 -1586
- package/dist/chunk-RVPLBATS.js.map +0 -1
- package/dist/chunk-U5JMRGKX.js +0 -340
- package/dist/chunk-U5JMRGKX.js.map +0 -1
- package/dist/chunk-URB2WSKZ.js +0 -350
- package/dist/chunk-URB2WSKZ.js.map +0 -1
- package/dist/chunk-UVMUAWVT.js +0 -596
- package/dist/chunk-WEJG4TB5.js +0 -118
- package/dist/chunk-X7HPGUVG.js +0 -271
- package/dist/chunk-XAMBKFQS.js +0 -2777
- package/dist/chunk-XAMBKFQS.js.map +0 -1
- package/dist/chunk-XJKFSSDW.js +0 -726
- package/dist/chunk-XJKFSSDW.js.map +0 -1
- package/dist/chunk-XMHBH5H6.js +0 -283
- package/dist/chunk-XMHBH5H6.js.map +0 -1
- package/dist/chunk-XMVFHBHT.js +0 -277
- package/dist/chunk-Y3VMVTYX.js +0 -53
- package/dist/chunk-YNB73F22.js +0 -137
- package/dist/chunk-YNB73F22.js.map +0 -1
- package/dist/chunk-Z2E7VW55.js +0 -335
- package/dist/chunk-Z2E7VW55.js.map +0 -1
- package/dist/chunk-ZG7PTKBK.js +0 -2296
- package/dist/chunk-ZNQN6ZTA.js +0 -135
- package/dist/chunk-ZVTKDVVM.js +0 -827
- package/dist/chunk-ZVTKDVVM.js.map +0 -1
- package/dist/cli-BR8KpIU0.d.ts +0 -1259
- package/dist/codex-materialize-CQlLTzke.d.ts +0 -139
- package/dist/connectors-cli-DFGtY2DB.d.ts +0 -257
- package/dist/contradiction-review-5LTTVDQV.js +0 -22
- package/dist/contradiction-scan-QTXAMBUA.js +0 -414
- package/dist/contradiction-scan-QTXAMBUA.js.map +0 -1
- package/dist/engine-35M5BKQ7.js +0 -28
- package/dist/fs-utils-IRVUFB6G.js +0 -30
- package/dist/graph-edge-decay-PWB63GRE.js +0 -207
- package/dist/memory-governance-IMPQZXFC.js +0 -37
- package/dist/memory-projection-store-CY8TU40w.d.ts +0 -222
- package/dist/orchestrator-DDMPqU6R.d.ts +0 -1792
- package/dist/path-RMTY5Y5A.js +0 -9
- package/dist/port-B6VEDIkC.d.ts +0 -53
- package/dist/resolution-YGIBORXI.js +0 -101
- package/dist/resolution-YGIBORXI.js.map +0 -1
- package/dist/secure-store-4R2GSO7S.js +0 -156
- package/dist/semantic-consolidation-ByBXb-sf.d.ts +0 -180
- package/dist/state-store-3EH7HYIN.js +0 -16
- package/dist/types-V3FJ26TF.js +0 -30
- /package/dist/{capsule-crypto-SJS5VVAP.js.map → adapters/claude-code.js.map} +0 -0
- /package/dist/{capsule-export-7QNCBZOQ.js.map → adapters/codex.js.map} +0 -0
- /package/dist/{capsule-import-EPBHD2EN.js.map → adapters/hermes.js.map} +0 -0
- /package/dist/{contradiction-review-5LTTVDQV.js.map → adapters/index.js.map} +0 -0
- /package/dist/{engine-35M5BKQ7.js.map → adapters/registry.js.map} +0 -0
- /package/dist/{fs-utils-IRVUFB6G.js.map → adapters/replit.js.map} +0 -0
- /package/dist/{memory-governance-IMPQZXFC.js.map → adapters/types.js.map} +0 -0
- /package/dist/{path-RMTY5Y5A.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
- /package/dist/{capsule-merge-DI7PNQ2H.js.map → capsule-merge-4MGKE7C5.js.map} +0 -0
- /package/dist/{chunk-G4SK7DSQ.js.map → chunk-2WWLHTZY.js.map} +0 -0
- /package/dist/{chunk-X7HPGUVG.js.map → chunk-4CRG46BG.js.map} +0 -0
- /package/dist/{chunk-UVMUAWVT.js.map → chunk-7IASACLB.js.map} +0 -0
- /package/dist/{chunk-HELQZFZO.js.map → chunk-EDTHC6UD.js.map} +0 -0
- /package/dist/{chunk-4YM32CRU.js.map → chunk-EFJ3MQ4V.js.map} +0 -0
- /package/dist/{chunk-E2UCDP5S.js.map → chunk-FBYESMQ2.js.map} +0 -0
- /package/dist/{chunk-D54LZC5L.js.map → chunk-FDU6HUUL.js.map} +0 -0
- /package/dist/{chunk-IB3BFHGN.js.map → chunk-GGKRUQOO.js.map} +0 -0
- /package/dist/{chunk-242S3I2A.js.map → chunk-GL6I6MEQ.js.map} +0 -0
- /package/dist/{secure-store-4R2GSO7S.js.map → chunk-HHLLAQGZ.js.map} +0 -0
- /package/dist/{chunk-4IS4SXIQ.js.map → chunk-HXXBL2KD.js.map} +0 -0
- /package/dist/{chunk-767ODGE6.js.map → chunk-KNKUID7G.js.map} +0 -0
- /package/dist/{chunk-6TBWYBJ3.js.map → chunk-LPMVBPA3.js.map} +0 -0
- /package/dist/{chunk-WEJG4TB5.js.map → chunk-MC26UJIM.js.map} +0 -0
- /package/dist/{chunk-JKDVIE52.js.map → chunk-MGKYQQYF.js.map} +0 -0
- /package/dist/{chunk-Y3VMVTYX.js.map → chunk-MT4HVDUZ.js.map} +0 -0
- /package/dist/{chunk-G2WADRQ3.js.map → chunk-MY6TPVXW.js.map} +0 -0
- /package/dist/{chunk-OR64ZGRZ.js.map → chunk-NNVTUXEB.js.map} +0 -0
- /package/dist/{chunk-JESOB2HO.js.map → chunk-P4NEIHUT.js.map} +0 -0
- /package/dist/{chunk-IXEJRKCZ.js.map → chunk-QRNI5JBH.js.map} +0 -0
- /package/dist/{chunk-EEQLFRUM.js.map → chunk-RRF5UOBJ.js.map} +0 -0
- /package/dist/{state-store-3EH7HYIN.js.map → chunk-SEDEKFYQ.js.map} +0 -0
- /package/dist/{chunk-2LGMW3DJ.js.map → chunk-U3PN77QT.js.map} +0 -0
- /package/dist/{chunk-XMVFHBHT.js.map → chunk-U3WSW6PZ.js.map} +0 -0
- /package/dist/{chunk-N5AKDXAI.js.map → chunk-UWVJF25J.js.map} +0 -0
- /package/dist/{types-V3FJ26TF.js.map → chunk-V5OCT34X.js.map} +0 -0
- /package/dist/{chunk-ZG7PTKBK.js.map → chunk-W3LR522O.js.map} +0 -0
- /package/dist/{chunk-MARWOCVP.js.map → chunk-XIG5PDM7.js.map} +0 -0
- /package/dist/{chunk-ZNQN6ZTA.js.map → chunk-XVZ7B3HG.js.map} +0 -0
- /package/dist/{graph-edge-decay-PWB63GRE.js.map → graph-edge-decay-5DI5GUNL.js.map} +0 -0
|
@@ -0,0 +1,3019 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
buildExplicitCueRecallSection,
|
|
6
|
+
buildTrajectoryAnalysisRecallSection,
|
|
7
|
+
collectBenchmarkAnchorCues,
|
|
8
|
+
collectContentLexicalCues,
|
|
9
|
+
collectExplicitTurnReferences,
|
|
10
|
+
collectLexicalCues,
|
|
11
|
+
collectQuestionSlotCues,
|
|
12
|
+
collectStructuredPlanCues,
|
|
13
|
+
collectTemporalLexicalCues,
|
|
14
|
+
type ExplicitCueRecallEngine,
|
|
15
|
+
} from "./explicit-cue-recall.js";
|
|
16
|
+
|
|
17
|
+
type Message = { role: string; content: string; turnIndex?: number };
|
|
18
|
+
|
|
19
|
+
class FakeCueEngine implements ExplicitCueRecallEngine {
|
|
20
|
+
constructor(private readonly sessions: Record<string, Message[]>) {}
|
|
21
|
+
|
|
22
|
+
async expandContext(
|
|
23
|
+
sessionId: string,
|
|
24
|
+
fromTurn: number,
|
|
25
|
+
toTurn: number,
|
|
26
|
+
_maxTokens: number,
|
|
27
|
+
): Promise<Array<{ turn_index: number; role: string; content: string }>> {
|
|
28
|
+
const messages = this.sessions[sessionId] ?? [];
|
|
29
|
+
const from = Math.max(0, Math.floor(fromTurn));
|
|
30
|
+
const to = Math.floor(toTurn);
|
|
31
|
+
if (from > to) return [];
|
|
32
|
+
return messages
|
|
33
|
+
.map((message, offset) => ({
|
|
34
|
+
turn_index: message.turnIndex ?? offset,
|
|
35
|
+
role: message.role,
|
|
36
|
+
content: message.content,
|
|
37
|
+
}))
|
|
38
|
+
.filter((message) => message.turn_index >= from && message.turn_index <= to);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async searchContextFull(
|
|
42
|
+
query: string,
|
|
43
|
+
limit: number,
|
|
44
|
+
sessionId?: string,
|
|
45
|
+
): Promise<
|
|
46
|
+
Array<{
|
|
47
|
+
turn_index: number;
|
|
48
|
+
role: string;
|
|
49
|
+
content: string;
|
|
50
|
+
session_id: string;
|
|
51
|
+
score?: number;
|
|
52
|
+
}>
|
|
53
|
+
> {
|
|
54
|
+
const needle = normalizeForSearch(query);
|
|
55
|
+
const sessionEntries = Object.entries(this.sessions).filter(
|
|
56
|
+
([candidateSessionId]) => !sessionId || candidateSessionId === sessionId,
|
|
57
|
+
);
|
|
58
|
+
const results: Array<{
|
|
59
|
+
turn_index: number;
|
|
60
|
+
role: string;
|
|
61
|
+
content: string;
|
|
62
|
+
session_id: string;
|
|
63
|
+
score?: number;
|
|
64
|
+
}> = [];
|
|
65
|
+
for (const [candidateSessionId, messages] of sessionEntries) {
|
|
66
|
+
for (let index = 0; index < messages.length; index += 1) {
|
|
67
|
+
const message = messages[index]!;
|
|
68
|
+
if (!normalizeForSearch(message.content).includes(needle)) continue;
|
|
69
|
+
results.push({
|
|
70
|
+
turn_index: message.turnIndex ?? index,
|
|
71
|
+
role: message.role,
|
|
72
|
+
content: message.content,
|
|
73
|
+
session_id: candidateSessionId,
|
|
74
|
+
score: 1,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return results.slice(0, Math.max(0, Math.floor(limit)));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async getStats(sessionId?: string): Promise<{
|
|
82
|
+
totalMessages: number;
|
|
83
|
+
maxTurnIndex?: number;
|
|
84
|
+
}> {
|
|
85
|
+
const sessionEntries = Object.entries(this.sessions).filter(
|
|
86
|
+
([candidateSessionId]) => !sessionId || candidateSessionId === sessionId,
|
|
87
|
+
);
|
|
88
|
+
let maxTurn = -1;
|
|
89
|
+
let totalMessages = 0;
|
|
90
|
+
for (const [, messages] of sessionEntries) {
|
|
91
|
+
totalMessages += messages.length;
|
|
92
|
+
for (let index = 0; index < messages.length; index += 1) {
|
|
93
|
+
maxTurn = Math.max(maxTurn, messages[index]?.turnIndex ?? index);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { totalMessages, maxTurnIndex: maxTurn };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
class NoSearchCueEngine extends FakeCueEngine {
|
|
101
|
+
async searchContextFull(): ReturnType<FakeCueEngine["searchContextFull"]> {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
test("collectExplicitTurnReferences parses turns, steps, ranges, and plural labels", () => {
|
|
107
|
+
assert.deepEqual(collectExplicitTurnReferences("Review turns 4-5 and step 8"), [
|
|
108
|
+
{ number: 4, includeDirectTurn: true },
|
|
109
|
+
{ number: 5, includeDirectTurn: true },
|
|
110
|
+
{ number: 8, includeDirectTurn: false },
|
|
111
|
+
]);
|
|
112
|
+
assert.deepEqual(
|
|
113
|
+
collectExplicitTurnReferences("Compare actions #2 through 4 and observations 7"),
|
|
114
|
+
[
|
|
115
|
+
{ number: 2, includeDirectTurn: false },
|
|
116
|
+
{ number: 3, includeDirectTurn: false },
|
|
117
|
+
{ number: 4, includeDirectTurn: false },
|
|
118
|
+
{ number: 7, includeDirectTurn: false },
|
|
119
|
+
],
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("collectLexicalCues extracts visible ids, dates, and bracket labels", () => {
|
|
124
|
+
assert.deepEqual(
|
|
125
|
+
collectLexicalCues("Use D1:1 from session_alpha on 2026-04-30 [profile decision]."),
|
|
126
|
+
["2026-04-30", "D1:1", "profile decision", "session_alpha"],
|
|
127
|
+
);
|
|
128
|
+
assert.deepEqual(
|
|
129
|
+
collectLexicalCues("What did Maya Chen tell Jordan about session_2?"),
|
|
130
|
+
["Jordan", "Maya Chen", "session_2"],
|
|
131
|
+
);
|
|
132
|
+
assert.deepEqual(
|
|
133
|
+
collectLexicalCues("Can Maya Chen remember what Jordan said?"),
|
|
134
|
+
["Jordan", "Maya Chen"],
|
|
135
|
+
);
|
|
136
|
+
assert.deepEqual(
|
|
137
|
+
collectLexicalCues("Were Maya Chen and Jordan aligned?"),
|
|
138
|
+
["Jordan", "Maya Chen"],
|
|
139
|
+
);
|
|
140
|
+
assert.deepEqual(
|
|
141
|
+
collectTemporalLexicalCues("As of 2025-02-01, what changed yesterday?"),
|
|
142
|
+
["as of", "changed", "yesterday"],
|
|
143
|
+
);
|
|
144
|
+
assert.deepEqual(
|
|
145
|
+
collectLexicalCues("As of 2025-02-01, what changed yesterday?"),
|
|
146
|
+
["2025-02-01", "as of", "changed", "yesterday"],
|
|
147
|
+
);
|
|
148
|
+
assert.deepEqual(
|
|
149
|
+
collectQuestionSlotCues("What city does the user live in now?"),
|
|
150
|
+
["city"],
|
|
151
|
+
);
|
|
152
|
+
assert.deepEqual(
|
|
153
|
+
collectBenchmarkAnchorCues("Use plan 1, chat ids 7, and source chat ids 8 for information extraction."),
|
|
154
|
+
[
|
|
155
|
+
"ability=information_extraction",
|
|
156
|
+
"chat-7",
|
|
157
|
+
"chat_id=7",
|
|
158
|
+
"plan-1",
|
|
159
|
+
"plan_id=1",
|
|
160
|
+
"source_chat-8",
|
|
161
|
+
"source_chat_id=8",
|
|
162
|
+
"chat_id=8",
|
|
163
|
+
].sort((left, right) => left.localeCompare(right)),
|
|
164
|
+
);
|
|
165
|
+
assert.deepEqual(
|
|
166
|
+
collectBenchmarkAnchorCues("Use chat id 7."),
|
|
167
|
+
["chat_id=7", "chat-7"].sort((left, right) => left.localeCompare(right)),
|
|
168
|
+
);
|
|
169
|
+
assert.deepEqual(
|
|
170
|
+
collectBenchmarkAnchorCues("Use chat ids 7 and 8 for the answer."),
|
|
171
|
+
["chat_id=7", "chat-7", "chat_id=8", "chat-8"].sort((left, right) =>
|
|
172
|
+
left.localeCompare(right),
|
|
173
|
+
),
|
|
174
|
+
);
|
|
175
|
+
assert.deepEqual(
|
|
176
|
+
collectBenchmarkAnchorCues("Using chat id 27, who owns the late evidence?"),
|
|
177
|
+
["chat_id=27", "chat-27"].sort((left, right) => left.localeCompare(right)),
|
|
178
|
+
);
|
|
179
|
+
assert.deepEqual(
|
|
180
|
+
collectBenchmarkAnchorCues("Using chat id 27 late-arriving evidence, who owns it?"),
|
|
181
|
+
["chat_id=27", "chat-27"].sort((left, right) => left.localeCompare(right)),
|
|
182
|
+
);
|
|
183
|
+
assert.deepEqual(
|
|
184
|
+
collectLexicalCues("What city does the user live in now?"),
|
|
185
|
+
["city", "now"],
|
|
186
|
+
);
|
|
187
|
+
assert.deepEqual(
|
|
188
|
+
collectStructuredPlanCues("Join Jennifer for the same dinner and accommodation."),
|
|
189
|
+
["accommodation", "dinner", "join", "same"],
|
|
190
|
+
);
|
|
191
|
+
assert.deepEqual(
|
|
192
|
+
collectStructuredPlanCues("Join the same team meeting."),
|
|
193
|
+
[],
|
|
194
|
+
);
|
|
195
|
+
assert.deepEqual(
|
|
196
|
+
collectLexicalCues("Join Jennifer for the same dinner and accommodation."),
|
|
197
|
+
["Jennifer"],
|
|
198
|
+
);
|
|
199
|
+
assert.deepEqual(
|
|
200
|
+
collectLexicalCues("Join Jennifer for the same dinner and accommodation.", {
|
|
201
|
+
includeStructuredPlanCues: true,
|
|
202
|
+
}),
|
|
203
|
+
["accommodation", "dinner", "Jennifer", "join", "same"],
|
|
204
|
+
);
|
|
205
|
+
assert.deepEqual(
|
|
206
|
+
collectContentLexicalCues(
|
|
207
|
+
"How many new columns did I want to add to the transactions table across my requests?",
|
|
208
|
+
),
|
|
209
|
+
[
|
|
210
|
+
"transactions table",
|
|
211
|
+
"transactions",
|
|
212
|
+
"columns",
|
|
213
|
+
"table",
|
|
214
|
+
"add",
|
|
215
|
+
"new",
|
|
216
|
+
],
|
|
217
|
+
);
|
|
218
|
+
assert.deepEqual(
|
|
219
|
+
collectLexicalCues(
|
|
220
|
+
"How many new columns did I want to add to the transactions table across my requests?",
|
|
221
|
+
{ includeContentLexicalCues: true },
|
|
222
|
+
),
|
|
223
|
+
[
|
|
224
|
+
"add",
|
|
225
|
+
"columns",
|
|
226
|
+
"new",
|
|
227
|
+
"table",
|
|
228
|
+
"transactions",
|
|
229
|
+
"transactions table",
|
|
230
|
+
],
|
|
231
|
+
);
|
|
232
|
+
assert.deepEqual(
|
|
233
|
+
collectContentLexicalCues(
|
|
234
|
+
"How many different user roles and security features am I trying to implement across my sessions?",
|
|
235
|
+
),
|
|
236
|
+
[
|
|
237
|
+
"security features",
|
|
238
|
+
"user roles",
|
|
239
|
+
"security",
|
|
240
|
+
"sessions",
|
|
241
|
+
"roles",
|
|
242
|
+
"user",
|
|
243
|
+
],
|
|
244
|
+
);
|
|
245
|
+
assert.deepEqual(
|
|
246
|
+
collectLexicalCues(
|
|
247
|
+
"Could you show me how to implement a login feature?",
|
|
248
|
+
{ includeContentLexicalCues: true },
|
|
249
|
+
),
|
|
250
|
+
[
|
|
251
|
+
"access control",
|
|
252
|
+
"account lockout",
|
|
253
|
+
"account lockout feature",
|
|
254
|
+
"authentication",
|
|
255
|
+
"authorization",
|
|
256
|
+
"code snippets",
|
|
257
|
+
"failed login attempts",
|
|
258
|
+
"format all code snippets",
|
|
259
|
+
"implement login",
|
|
260
|
+
"implementation details",
|
|
261
|
+
"login",
|
|
262
|
+
"login feature",
|
|
263
|
+
"password hashing",
|
|
264
|
+
"rate limiting",
|
|
265
|
+
"redis",
|
|
266
|
+
"role-based access control",
|
|
267
|
+
"syntax highlighting",
|
|
268
|
+
],
|
|
269
|
+
);
|
|
270
|
+
const meetingCues = collectLexicalCues(
|
|
271
|
+
"When and where did I say I first met Vickie?",
|
|
272
|
+
{ includeContentLexicalCues: true },
|
|
273
|
+
);
|
|
274
|
+
assert.ok(meetingCues.includes("I met Vickie"));
|
|
275
|
+
assert.ok(meetingCues.includes("met Vickie"));
|
|
276
|
+
assert.ok(meetingCues.includes("Vickie at"));
|
|
277
|
+
assert.deepEqual(
|
|
278
|
+
collectLexicalCues(
|
|
279
|
+
"How many weeks do I have between finishing the transaction management features and the final deployment deadline?",
|
|
280
|
+
{ includeContentLexicalCues: true },
|
|
281
|
+
),
|
|
282
|
+
[
|
|
283
|
+
"deadline",
|
|
284
|
+
"deployment",
|
|
285
|
+
"deployment deadline",
|
|
286
|
+
"final",
|
|
287
|
+
"final deployment",
|
|
288
|
+
"finishing",
|
|
289
|
+
"management",
|
|
290
|
+
"management features",
|
|
291
|
+
"milestones",
|
|
292
|
+
"schedule",
|
|
293
|
+
"timeline",
|
|
294
|
+
"transaction",
|
|
295
|
+
"transaction management",
|
|
296
|
+
"weeks",
|
|
297
|
+
],
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
test("buildExplicitCueRecallSection searches benchmark anchor cues", async () => {
|
|
302
|
+
const engine = new FakeCueEngine({
|
|
303
|
+
beam: [
|
|
304
|
+
{
|
|
305
|
+
role: "system",
|
|
306
|
+
content:
|
|
307
|
+
"BEAM evidence anchors: session_id=beam-100K-demo-plan-plan-1-1; plan_id=plan-1; chat_id=7; ability=information_extraction",
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
role: "user",
|
|
311
|
+
content: "The plan-specific deployment owner is Nia.",
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const section = await buildExplicitCueRecallSection({
|
|
317
|
+
engine,
|
|
318
|
+
sessionId: "beam",
|
|
319
|
+
query: "For information extraction, use plan plan-1 and chat id 7.",
|
|
320
|
+
maxChars: 2000,
|
|
321
|
+
includeBenchmarkAnchorCues: true,
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
assert.match(section, /plan-specific deployment owner is Nia/);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("buildExplicitCueRecallSection can search content lexical cues", async () => {
|
|
328
|
+
const engine = new FakeCueEngine({
|
|
329
|
+
beam: [
|
|
330
|
+
{
|
|
331
|
+
role: "user",
|
|
332
|
+
content:
|
|
333
|
+
"I want to add category and notes columns to the transactions table.",
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const section = await buildExplicitCueRecallSection({
|
|
339
|
+
engine,
|
|
340
|
+
sessionId: "beam",
|
|
341
|
+
query:
|
|
342
|
+
"How many new columns did I want to add to the transactions table across my requests?",
|
|
343
|
+
maxChars: 2000,
|
|
344
|
+
includeContentLexicalCues: true,
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
assert.match(section, /category and notes columns/);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
test("buildExplicitCueRecallSection searches meeting fact cues for named first-meeting questions", async () => {
|
|
351
|
+
const engine = new FakeCueEngine({
|
|
352
|
+
beam: [
|
|
353
|
+
{
|
|
354
|
+
role: "assistant",
|
|
355
|
+
content:
|
|
356
|
+
"That sounds like a great connection you've made with Vickie, and a laptop could be a useful gift.",
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
role: "user",
|
|
360
|
+
content:
|
|
361
|
+
"I met Vickie at the New Gary Community Library on January 15, 2023, and we bonded over science fiction books.",
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
const section = await buildExplicitCueRecallSection({
|
|
367
|
+
engine,
|
|
368
|
+
sessionId: "beam",
|
|
369
|
+
query: "When and where did I say I first met Vickie?",
|
|
370
|
+
maxChars: 2000,
|
|
371
|
+
includeContentLexicalCues: true,
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
assert.match(section, /I met Vickie at the New Gary Community Library/);
|
|
375
|
+
assert.match(section, /January 15, 2023/);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
test("buildExplicitCueRecallSection expands implementation intent to durable formatting instructions", async () => {
|
|
379
|
+
const engine = new FakeCueEngine({
|
|
380
|
+
beam: [
|
|
381
|
+
{
|
|
382
|
+
role: "user",
|
|
383
|
+
content:
|
|
384
|
+
"Use Flask-Login for the login feature with authentication and authorization checks.",
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
role: "user",
|
|
388
|
+
content:
|
|
389
|
+
"Always format all code snippets with syntax highlighting when I ask about implementation details.",
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const section = await buildExplicitCueRecallSection({
|
|
395
|
+
engine,
|
|
396
|
+
sessionId: "beam",
|
|
397
|
+
query: "Could you show me how to implement a login feature?",
|
|
398
|
+
maxChars: 2000,
|
|
399
|
+
includeContentLexicalCues: true,
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
assert.match(section, /syntax highlighting/);
|
|
403
|
+
assert.ok(
|
|
404
|
+
section.indexOf("syntax highlighting") < section.indexOf("Flask-Login"),
|
|
405
|
+
"durable implementation-formatting instructions should precede broad auth implementation evidence",
|
|
406
|
+
);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
test("buildExplicitCueRecallSection expands security-feature intent to common auth controls", async () => {
|
|
410
|
+
const engine = new FakeCueEngine({
|
|
411
|
+
beam: [
|
|
412
|
+
{
|
|
413
|
+
role: "user",
|
|
414
|
+
content: "I am implementing password hashing with Werkzeug.security.",
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
role: "user",
|
|
418
|
+
content: "I am implementing role-based access control for user roles.",
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
role: "user",
|
|
422
|
+
content:
|
|
423
|
+
"I am implementing account lockout after 5 failed login attempts using Redis.",
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
const section = await buildExplicitCueRecallSection({
|
|
429
|
+
engine,
|
|
430
|
+
sessionId: "beam",
|
|
431
|
+
query:
|
|
432
|
+
"How many different user roles and security features am I trying to implement across my sessions?",
|
|
433
|
+
maxChars: 4000,
|
|
434
|
+
includeContentLexicalCues: true,
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
assert.match(section, /password hashing/);
|
|
438
|
+
assert.match(section, /role-based access control/);
|
|
439
|
+
assert.match(section, /account lockout/);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test("buildExplicitCueRecallSection searches deeper for security feature enumeration evidence", async () => {
|
|
443
|
+
const engine = new FakeCueEngine({
|
|
444
|
+
beam: [
|
|
445
|
+
{
|
|
446
|
+
role: "assistant",
|
|
447
|
+
content: "General authentication advice without account lockout.",
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
role: "assistant",
|
|
451
|
+
content: "A login form example with ordinary validation.",
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
role: "assistant",
|
|
455
|
+
content: "A security checklist with password hashing and RBAC.",
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
role: "assistant",
|
|
459
|
+
content: "Redis can also be used as an efficient session store.",
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
role: "user",
|
|
463
|
+
content:
|
|
464
|
+
"I am implementing the account lockout feature after 5 failed login attempts using Redis 7.0 for rate limiting.",
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
const section = await buildExplicitCueRecallSection({
|
|
470
|
+
engine,
|
|
471
|
+
sessionId: "beam",
|
|
472
|
+
query:
|
|
473
|
+
"How many different user roles and security features am I trying to implement across my sessions?",
|
|
474
|
+
maxChars: 4000,
|
|
475
|
+
includeContentLexicalCues: true,
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
assert.match(section, /account lockout feature/);
|
|
479
|
+
assert.match(section, /failed login attempts/);
|
|
480
|
+
assert.match(section, /Redis 7\.0/);
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
test("buildExplicitCueRecallSection scans exact security cues when FTS misses", async () => {
|
|
484
|
+
const engine = new NoSearchCueEngine({
|
|
485
|
+
beam: [
|
|
486
|
+
{
|
|
487
|
+
role: "user",
|
|
488
|
+
content: "I am implementing password hashing with Werkzeug.security.",
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
role: "user",
|
|
492
|
+
content: "I am implementing role-based access control for user roles.",
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
role: "user",
|
|
496
|
+
content:
|
|
497
|
+
"I am implementing the account lockout feature after 5 failed login attempts using Redis 7.0 for rate limiting.",
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const section = await buildExplicitCueRecallSection({
|
|
503
|
+
engine,
|
|
504
|
+
sessionId: "beam",
|
|
505
|
+
query:
|
|
506
|
+
"How many different user roles and security features am I trying to implement across my sessions?",
|
|
507
|
+
maxChars: 4000,
|
|
508
|
+
includeContentLexicalCues: true,
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
assert.match(section, /password hashing/);
|
|
512
|
+
assert.match(section, /role-based access control/);
|
|
513
|
+
assert.match(section, /account lockout feature/);
|
|
514
|
+
assert.match(section, /failed login attempts/);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
test("buildExplicitCueRecallSection skips full transcript cue scans when content lexical cues are disabled", async () => {
|
|
518
|
+
let statsCalls = 0;
|
|
519
|
+
const engine: ExplicitCueRecallEngine = {
|
|
520
|
+
async expandContext() {
|
|
521
|
+
throw new Error("full transcript scan should be gated");
|
|
522
|
+
},
|
|
523
|
+
async getStats() {
|
|
524
|
+
statsCalls += 1;
|
|
525
|
+
return { totalMessages: 3, maxTurnIndex: 2 };
|
|
526
|
+
},
|
|
527
|
+
async searchContextFull() {
|
|
528
|
+
return [];
|
|
529
|
+
},
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const section = await buildExplicitCueRecallSection({
|
|
533
|
+
engine,
|
|
534
|
+
sessionId: "beam",
|
|
535
|
+
query:
|
|
536
|
+
"How many different user roles and security features am I trying to implement across my sessions?",
|
|
537
|
+
maxChars: 4000,
|
|
538
|
+
includeContentLexicalCues: false,
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
assert.equal(section, "");
|
|
542
|
+
assert.equal(statsCalls, 0);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
test("buildExplicitCueRecallSection scans exact project-summary and contradiction cues when FTS misses", async () => {
|
|
546
|
+
const engine = new NoSearchCueEngine({
|
|
547
|
+
beam: [
|
|
548
|
+
{
|
|
549
|
+
role: "user",
|
|
550
|
+
content:
|
|
551
|
+
"I've never written any Flask routes or handled HTTP requests in this project, so I'm starting from scratch.",
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
role: "user",
|
|
555
|
+
content:
|
|
556
|
+
"I'm trying to implement the basic homepage route with Flask using @app.route('/').",
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
role: "assistant",
|
|
560
|
+
content:
|
|
561
|
+
"Use Werkzeug.security with generate_password_hash; the default method is pbkdf2:sha256.",
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
role: "assistant",
|
|
565
|
+
content:
|
|
566
|
+
"Resolve the SQLite UNIQUE constraint by verifying UUID uniqueness for transactions.",
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
role: "assistant",
|
|
570
|
+
content:
|
|
571
|
+
"Fix CSRF errors by including hidden_tag(), enabling WTF_CSRF_ENABLED, and checking browser cookies.",
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
role: "assistant",
|
|
575
|
+
content:
|
|
576
|
+
"The app plan included Initial project setup, transaction CRUD, deployment configuration, integration test coverage, and deployment and test improvements.",
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
role: "assistant",
|
|
580
|
+
content: [
|
|
581
|
+
"The budget tracker work covered expenses, income, analytics, and data visualization.",
|
|
582
|
+
"A detailed MVP schedule targeted April 15, 2024.",
|
|
583
|
+
"The phases covered authentication, transaction management, analytics, and deployment.",
|
|
584
|
+
"Before launch we added stronger password hashing.",
|
|
585
|
+
"Token-Based Authentication: issue a JWT access_token for stateless APIs.",
|
|
586
|
+
"Role-Based Access Control: add user and admin route restrictions.",
|
|
587
|
+
"Input Validation: validate and sanitize requests to prevent SQL injection.",
|
|
588
|
+
"Confluence documentation uses tables and diagrams for architecture decisions.",
|
|
589
|
+
].join("\n"),
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
const contradictionSection = await buildExplicitCueRecallSection({
|
|
595
|
+
engine,
|
|
596
|
+
sessionId: "beam",
|
|
597
|
+
query: "Have I worked with Flask routes and handled HTTP requests in this project?",
|
|
598
|
+
maxChars: 4000,
|
|
599
|
+
includeContentLexicalCues: true,
|
|
600
|
+
});
|
|
601
|
+
assert.match(contradictionSection, /never written any Flask routes/);
|
|
602
|
+
assert.match(contradictionSection, /basic homepage route/);
|
|
603
|
+
|
|
604
|
+
const summarySection = await buildExplicitCueRecallSection({
|
|
605
|
+
engine,
|
|
606
|
+
sessionId: "beam",
|
|
607
|
+
query:
|
|
608
|
+
"Can you give me a comprehensive summary of how I handled the security and database challenges?",
|
|
609
|
+
maxChars: 4000,
|
|
610
|
+
includeContentLexicalCues: true,
|
|
611
|
+
});
|
|
612
|
+
assert.match(summarySection, /pbkdf2:sha256/);
|
|
613
|
+
assert.match(summarySection, /UUID uniqueness/);
|
|
614
|
+
assert.match(summarySection, /WTF_CSRF_ENABLED/);
|
|
615
|
+
|
|
616
|
+
const progressSummarySection = await buildExplicitCueRecallSection({
|
|
617
|
+
engine,
|
|
618
|
+
sessionId: "beam",
|
|
619
|
+
query:
|
|
620
|
+
"Can you provide a comprehensive summary of how my budget tracker project has progressed, including the key features implemented, the development timeline, security enhancements, and documentation efforts?",
|
|
621
|
+
maxChars: 4000,
|
|
622
|
+
includeContentLexicalCues: true,
|
|
623
|
+
});
|
|
624
|
+
assert.match(progressSummarySection, /Token-Based Authentication/);
|
|
625
|
+
assert.match(progressSummarySection, /JWT access_token/);
|
|
626
|
+
assert.match(progressSummarySection, /Input Validation/);
|
|
627
|
+
assert.match(progressSummarySection, /SQL injection/);
|
|
628
|
+
|
|
629
|
+
const orderingSection = await buildExplicitCueRecallSection({
|
|
630
|
+
engine,
|
|
631
|
+
sessionId: "beam",
|
|
632
|
+
query:
|
|
633
|
+
"Can you walk me through the order in which I brought up different aspects of my app development and deployment across our conversations?",
|
|
634
|
+
maxChars: 4000,
|
|
635
|
+
includeContentLexicalCues: true,
|
|
636
|
+
});
|
|
637
|
+
assert.match(orderingSection, /transaction CRUD/);
|
|
638
|
+
assert.match(orderingSection, /integration test coverage/);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
test("buildExplicitCueRecallSection preserves query-focused lines from long evidence", async () => {
|
|
642
|
+
const engine = new FakeCueEngine({
|
|
643
|
+
beam: [
|
|
644
|
+
{
|
|
645
|
+
role: "user",
|
|
646
|
+
content: [
|
|
647
|
+
"BEAM turn anchors: chat_id=2; source_chat_id=2",
|
|
648
|
+
"Sure, let's break it down for my budget tracker project.",
|
|
649
|
+
"### Components:",
|
|
650
|
+
"1. User Authentication",
|
|
651
|
+
"2. Transaction Management",
|
|
652
|
+
" - Add Expense",
|
|
653
|
+
" - Edit Expense",
|
|
654
|
+
"3. Basic Analytics",
|
|
655
|
+
" - Monthly Summary",
|
|
656
|
+
" - Category Breakdown",
|
|
657
|
+
"4. Deployment",
|
|
658
|
+
"### Milestones:",
|
|
659
|
+
"- Nov 1 - Nov 15, 2023: Initial project setup",
|
|
660
|
+
"- Nov 16 - Dec 15, 2023: User authentication",
|
|
661
|
+
"- Dec 16, 2023 - Jan 15, 2024: Develop transaction management features",
|
|
662
|
+
"- Jan 16 - Feb 15, 2024: Basic analytics",
|
|
663
|
+
"- Feb 16 - Mar 15, 2024: Final adjustments, testing, and deployment",
|
|
664
|
+
].join("\n"),
|
|
665
|
+
},
|
|
666
|
+
],
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
const section = await buildExplicitCueRecallSection({
|
|
670
|
+
engine,
|
|
671
|
+
sessionId: "beam",
|
|
672
|
+
query:
|
|
673
|
+
"How many weeks do I have between finishing the transaction management features and the final deployment deadline?",
|
|
674
|
+
maxChars: 900,
|
|
675
|
+
maxItemChars: 260,
|
|
676
|
+
includeContentLexicalCues: true,
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
assert.match(section, /source_chat_id=2/);
|
|
680
|
+
assert.match(section, /Dec 16, 2023 - Jan 15, 2024/);
|
|
681
|
+
assert.match(section, /Feb 16 - Mar 15, 2024/);
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
test("buildExplicitCueRecallSection searches deeper for temporal schedule evidence", async () => {
|
|
685
|
+
const engine = new FakeCueEngine({
|
|
686
|
+
beam: [
|
|
687
|
+
{
|
|
688
|
+
role: "assistant",
|
|
689
|
+
content:
|
|
690
|
+
"Transaction management validation details for a transactions API endpoint.",
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
role: "assistant",
|
|
694
|
+
content:
|
|
695
|
+
"Transaction management SQLAlchemy model fields for ordinary CRUD work.",
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
role: "assistant",
|
|
699
|
+
content:
|
|
700
|
+
"Transaction management pagination and filtering implementation notes.",
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
role: "assistant",
|
|
704
|
+
content:
|
|
705
|
+
"Transaction management form handling without any project schedule.",
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
role: "user",
|
|
709
|
+
content: [
|
|
710
|
+
"BEAM turn anchors: chat_id=2; source_chat_id=2",
|
|
711
|
+
"### Components:",
|
|
712
|
+
"2. Transaction Management",
|
|
713
|
+
"4. Deployment",
|
|
714
|
+
"### Milestones:",
|
|
715
|
+
"- Dec 16, 2023 - Jan 15, 2024: Develop transaction management features",
|
|
716
|
+
"- Feb 16 - Mar 15, 2024: Final adjustments, testing, and deployment",
|
|
717
|
+
].join("\n"),
|
|
718
|
+
},
|
|
719
|
+
],
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
const section = await buildExplicitCueRecallSection({
|
|
723
|
+
engine,
|
|
724
|
+
sessionId: "beam",
|
|
725
|
+
query:
|
|
726
|
+
"How many weeks do I have between finishing the transaction management features and the final deployment deadline?",
|
|
727
|
+
maxChars: 1200,
|
|
728
|
+
maxItemChars: 360,
|
|
729
|
+
includeContentLexicalCues: true,
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
assert.match(section, /source_chat_id=2/);
|
|
733
|
+
assert.match(section, /Dec 16, 2023 - Jan 15, 2024/);
|
|
734
|
+
assert.match(section, /Feb 16 - Mar 15, 2024/);
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
test("buildTrajectoryAnalysisRecallSection enumerates full action ranges", async () => {
|
|
738
|
+
const engine = new FakeCueEngine({
|
|
739
|
+
ama: makeTrajectoryMessages([
|
|
740
|
+
[71, "go to drawer 4", "arrived at drawer 4"],
|
|
741
|
+
[72, "look", "looked around"],
|
|
742
|
+
[73, "go to safe 1", "arrived at safe 1"],
|
|
743
|
+
[74, "go to drawer 4", "arrived at drawer 4"],
|
|
744
|
+
[75, "look", "looked at drawer 4"],
|
|
745
|
+
[76, "go to shelf 2", "arrived at shelf 2"],
|
|
746
|
+
]),
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
750
|
+
engine,
|
|
751
|
+
sessionId: "ama",
|
|
752
|
+
query: "What actions were performed between step 71 and step 76?",
|
|
753
|
+
maxChars: 4000,
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
assert.match(section, /^## Trajectory analysis/);
|
|
757
|
+
for (const step of [71, 72, 73, 74, 75, 76]) {
|
|
758
|
+
assert.match(section, new RegExp(`Action ${step}`));
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
test("buildTrajectoryAnalysisRecallSection preserves before-step entity history", async () => {
|
|
763
|
+
const engine = new FakeCueEngine({
|
|
764
|
+
ama: makeTrajectoryMessages([
|
|
765
|
+
[8, "open safe 1", "safe 1 is open"],
|
|
766
|
+
[9, "close safe 1", "safe 1 is closed"],
|
|
767
|
+
[20, "take cd 3 from desk 1", "carrying cd 3"],
|
|
768
|
+
[23, "open safe 1", "safe 1 is open"],
|
|
769
|
+
[24, "move cd 3 to safe 1", "cd 3 is in safe 1"],
|
|
770
|
+
[80, "take cd 2 from desk 2", "carrying cd 2"],
|
|
771
|
+
]),
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
775
|
+
engine,
|
|
776
|
+
sessionId: "ama",
|
|
777
|
+
query:
|
|
778
|
+
"Before step 80, which actions were performed on safe 1 and at which steps?",
|
|
779
|
+
maxChars: 4000,
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
assert.match(section, /Action 8.*open safe 1/);
|
|
783
|
+
assert.match(section, /Action 9.*close safe 1/);
|
|
784
|
+
assert.match(section, /Action 23.*open safe 1/);
|
|
785
|
+
assert.doesNotMatch(section, /Action 80/);
|
|
786
|
+
assert.doesNotMatch(section, /move cd 3 to safe 1/);
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
test("buildTrajectoryAnalysisRecallSection summarizes container object transfers for state questions", async () => {
|
|
790
|
+
const engine = new FakeCueEngine({
|
|
791
|
+
ama: makeTrajectoryMessages([
|
|
792
|
+
[8, "open safe 1", "safe 1 is open"],
|
|
793
|
+
[9, "close safe 1", "safe 1 is closed"],
|
|
794
|
+
[23, "open safe 1", "safe 1 is open"],
|
|
795
|
+
[24, "move cd 3 to safe 1", "cd 3 is in safe 1"],
|
|
796
|
+
[83, "close safe 1", "safe 1 is closed"],
|
|
797
|
+
[84, "examine safe 1", "safe 1 is closed"],
|
|
798
|
+
[85, "open safe 1", "safe 1 is open"],
|
|
799
|
+
]),
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
803
|
+
engine,
|
|
804
|
+
sessionId: "ama",
|
|
805
|
+
query:
|
|
806
|
+
"How did the state of safe 1 change throughout the trajectory, including what objects were placed in or removed from it?",
|
|
807
|
+
maxChars: 4000,
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
assert.match(section, /Action 8.*open safe 1/);
|
|
811
|
+
assert.match(section, /Object transfers involving safe 1/);
|
|
812
|
+
assert.match(section, /Action 24.*move cd 3 to safe 1.*cd 3 placed in safe 1/);
|
|
813
|
+
assert.match(section, /Latest safe 1 state at step 85: open/);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
test("buildTrajectoryAnalysisRecallSection keeps broad container history focused on state changes", async () => {
|
|
817
|
+
const engine = new FakeCueEngine({
|
|
818
|
+
ama: makeTrajectoryMessages([
|
|
819
|
+
[8, "open safe 1", "safe 1 is open"],
|
|
820
|
+
[9, "close safe 1", "safe 1 is closed"],
|
|
821
|
+
[12, "open drawer 1", "drawer 1 is open"],
|
|
822
|
+
[13, "close drawer 1", "drawer 1 is closed"],
|
|
823
|
+
[20, "take cd 3 from drawer 4", "carrying cd 3"],
|
|
824
|
+
[23, "open safe 1", "safe 1 is open"],
|
|
825
|
+
[24, "move cd 3 to safe 1", "cd 3 is in safe 1"],
|
|
826
|
+
[80, "take cd 2 from desk 2", "carrying cd 2"],
|
|
827
|
+
]),
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
831
|
+
engine,
|
|
832
|
+
sessionId: "ama",
|
|
833
|
+
query:
|
|
834
|
+
"Until step 80, which containers has the agent interacted with and what state changes occurred?",
|
|
835
|
+
maxChars: 4000,
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
assert.match(section, /Container open\/close state changes/);
|
|
839
|
+
assert.match(section, /Action 8.*open safe 1/);
|
|
840
|
+
assert.match(section, /Action 12.*open drawer 1/);
|
|
841
|
+
assert.doesNotMatch(section, /Object transfers/);
|
|
842
|
+
assert.doesNotMatch(section, /move cd 3 to safe 1/);
|
|
843
|
+
assert.doesNotMatch(section, /take cd 2 from desk 2/);
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
test("buildTrajectoryAnalysisRecallSection summarizes inventory and frequency", async () => {
|
|
847
|
+
const engine = new FakeCueEngine({
|
|
848
|
+
ama: makeTrajectoryMessages([
|
|
849
|
+
[0, "look", "empty inventory"],
|
|
850
|
+
[1, "go to desk 1", "at desk"],
|
|
851
|
+
[2, "take cd 3 from desk 1", "carrying cd 3"],
|
|
852
|
+
[3, "move cd 3 to safe 1", "cd 3 in safe"],
|
|
853
|
+
[4, "take cd 2 from desk 2", "carrying cd 2"],
|
|
854
|
+
[5, "look", "still carrying cd 2"],
|
|
855
|
+
]),
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
const inventorySection = await buildTrajectoryAnalysisRecallSection({
|
|
859
|
+
engine,
|
|
860
|
+
sessionId: "ama",
|
|
861
|
+
query: "What changes occurred to the inventory throughout the trajectory?",
|
|
862
|
+
maxChars: 4000,
|
|
863
|
+
});
|
|
864
|
+
assert.match(inventorySection, /inventory added cd 3/);
|
|
865
|
+
assert.match(inventorySection, /inventory removed cd 3/);
|
|
866
|
+
assert.match(inventorySection, /inventory added cd 2/);
|
|
867
|
+
|
|
868
|
+
const longInventorySection = await buildTrajectoryAnalysisRecallSection({
|
|
869
|
+
engine: new FakeCueEngine({
|
|
870
|
+
ama: makeTrajectoryMessages([
|
|
871
|
+
[1, "take apple 1 from desk 1", "carrying apple"],
|
|
872
|
+
[2, "move apple 1 to safe 1", "apple in safe"],
|
|
873
|
+
[3, "take mug 1 from desk 1", "carrying mug"],
|
|
874
|
+
[4, "move mug 1 to shelf 1", "mug on shelf"],
|
|
875
|
+
[5, "take pen 1 from drawer 1", "carrying pen"],
|
|
876
|
+
[6, "move pen 1 to drawer 2", "pen in drawer"],
|
|
877
|
+
]),
|
|
878
|
+
}),
|
|
879
|
+
sessionId: "ama",
|
|
880
|
+
query: "What changes occurred to the inventory throughout the trajectory?",
|
|
881
|
+
maxChars: 4000,
|
|
882
|
+
});
|
|
883
|
+
assert.match(longInventorySection, /First five inventory changes: step 1: apple 1 added/);
|
|
884
|
+
assert.match(longInventorySection, /Complete inventory changes: .*step 6: pen 1 removed/);
|
|
885
|
+
|
|
886
|
+
const frequencySection = await buildTrajectoryAnalysisRecallSection({
|
|
887
|
+
engine,
|
|
888
|
+
sessionId: "ama",
|
|
889
|
+
query: "Until step 5, what types of actions has the agent performed and how frequently?",
|
|
890
|
+
maxChars: 4000,
|
|
891
|
+
});
|
|
892
|
+
assert.match(frequencySection, /look=2/);
|
|
893
|
+
assert.match(frequencySection, /go=1/);
|
|
894
|
+
assert.match(frequencySection, /take=2/);
|
|
895
|
+
assert.match(frequencySection, /move=1/);
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
test("buildTrajectoryAnalysisRecallSection resolves quoted observation transitions and entity locations", async () => {
|
|
899
|
+
const sourceObservation = [
|
|
900
|
+
"You arrive at garbagecan 1. On the garbagecan 1, you see nothing.",
|
|
901
|
+
"",
|
|
902
|
+
"The current available actions are: go to drawer 4, look.",
|
|
903
|
+
].join("\n");
|
|
904
|
+
const targetObservation = [
|
|
905
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
906
|
+
"",
|
|
907
|
+
"The current available actions are: examine shelf 2, go to shelf 2, look.",
|
|
908
|
+
].join("\n");
|
|
909
|
+
const immediateTargetObservation = [
|
|
910
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
911
|
+
"",
|
|
912
|
+
"The current available actions are: examine garbagecan 1, look.",
|
|
913
|
+
].join("\n");
|
|
914
|
+
const engine = new FakeCueEngine({
|
|
915
|
+
ama: makeTrajectoryMessages([
|
|
916
|
+
[70, "look", sourceObservation],
|
|
917
|
+
[71, "go to drawer 4", immediateTargetObservation],
|
|
918
|
+
[72, "look", "You are facing drawer 4."],
|
|
919
|
+
[73, "go to shelf 2", "You arrive at shelf 2."],
|
|
920
|
+
[74, "go to drawer 4", targetObservation],
|
|
921
|
+
[80, "take cd 2 from desk 2", "carrying cd 2"],
|
|
922
|
+
[90, "move cd 3 to safe 1", "cd 3 is in safe 1"],
|
|
923
|
+
[115, "look", "cd 2 can be moved to safe 1"],
|
|
924
|
+
]),
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
const transitionSection = await buildTrajectoryAnalysisRecallSection({
|
|
928
|
+
engine,
|
|
929
|
+
sessionId: "ama",
|
|
930
|
+
query: `What sequence of actions would transform the state between the observation: "${sourceObservation}" and the observation: "${targetObservation}"?`,
|
|
931
|
+
maxChars: 5000,
|
|
932
|
+
});
|
|
933
|
+
assert.match(transitionSection, /Matched quoted observations: Observation 70 -> Observation 71/);
|
|
934
|
+
assert.match(
|
|
935
|
+
transitionSection,
|
|
936
|
+
/Action sequence that transforms the quoted observations:.*step 71: go to drawer 4/,
|
|
937
|
+
);
|
|
938
|
+
assert.match(transitionSection, /Action 71.*go to drawer 4/);
|
|
939
|
+
assert.doesNotMatch(transitionSection, /Action 72.*look/);
|
|
940
|
+
assert.doesNotMatch(transitionSection, /Action 73.*go to shelf 2/);
|
|
941
|
+
assert.doesNotMatch(transitionSection, /Action 74.*go to drawer 4/);
|
|
942
|
+
assert.doesNotMatch(transitionSection, /Action 80/);
|
|
943
|
+
|
|
944
|
+
const locationSection = await buildTrajectoryAnalysisRecallSection({
|
|
945
|
+
engine,
|
|
946
|
+
sessionId: "ama",
|
|
947
|
+
query: "What is the location of cd 3, cd 2 at step 115?",
|
|
948
|
+
maxChars: 5000,
|
|
949
|
+
});
|
|
950
|
+
assert.match(locationSection, /cd 2 location at step 115: inventory/);
|
|
951
|
+
assert.match(locationSection, /cd 3 location at step 115: safe 1/);
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
test("buildTrajectoryAnalysisRecallSection handles repeated quoted target observations", async () => {
|
|
955
|
+
const sourceObservation = [
|
|
956
|
+
"You pick up the toiletpaper 1 from the countertop 1.",
|
|
957
|
+
"",
|
|
958
|
+
"The current available actions are: go to cabinet 1, look.",
|
|
959
|
+
].join("\n");
|
|
960
|
+
const targetObservation = [
|
|
961
|
+
"You are facing the cabinet 1. Next to it, you see nothing.",
|
|
962
|
+
"",
|
|
963
|
+
"The current available actions are: close cabinet 1, examine cabinet 1, examine toiletpaper 1, go to handtowelholder 1, look, move toiletpaper 1 to cabinet 1.",
|
|
964
|
+
].join("\n");
|
|
965
|
+
const engine = new FakeCueEngine({
|
|
966
|
+
ama: makeTrajectoryMessages([
|
|
967
|
+
[72, "take toiletpaper 1 from countertop 1", sourceObservation],
|
|
968
|
+
[73, "go to cabinet 1", "You arrive at cabinet 1."],
|
|
969
|
+
[74, "look", targetObservation],
|
|
970
|
+
[75, "go to handtowelholder 1", "You arrive at handtowelholder 1."],
|
|
971
|
+
[76, "go to cabinet 1", "You arrive at cabinet 1."],
|
|
972
|
+
[77, "look", targetObservation],
|
|
973
|
+
]),
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
977
|
+
engine,
|
|
978
|
+
sessionId: "ama",
|
|
979
|
+
query: `What sequence of actions would transform the state between the observation: "${sourceObservation}" and the observation: "${targetObservation}"?`,
|
|
980
|
+
maxChars: 5000,
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
assert.match(section, /Matched quoted observations: Observation 72 -> Observation 77/);
|
|
984
|
+
assert.match(section, /step 75: go to handtowelholder 1/);
|
|
985
|
+
assert.match(section, /step 76: go to cabinet 1/);
|
|
986
|
+
assert.match(section, /step 77: look/);
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
test("buildTrajectoryAnalysisRecallSection keeps immediate non-look target transitions narrow", async () => {
|
|
990
|
+
const sourceObservation = [
|
|
991
|
+
"You arrive at garbagecan 1. On the garbagecan 1, you see nothing.",
|
|
992
|
+
"",
|
|
993
|
+
"The current available actions are: go to drawer 4, look.",
|
|
994
|
+
].join("\n");
|
|
995
|
+
const targetObservation = [
|
|
996
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
997
|
+
"",
|
|
998
|
+
"The current available actions are: go to safe 1, look.",
|
|
999
|
+
].join("\n");
|
|
1000
|
+
const repeatedTargetObservation = [
|
|
1001
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
1002
|
+
"",
|
|
1003
|
+
"The current available actions are: examine shelf 2, take pencil 2 from shelf 2.",
|
|
1004
|
+
].join("\n");
|
|
1005
|
+
const engine = new FakeCueEngine({
|
|
1006
|
+
ama: makeTrajectoryMessages([
|
|
1007
|
+
[70, "go to garbagecan 1", sourceObservation],
|
|
1008
|
+
[71, "go to drawer 4", targetObservation],
|
|
1009
|
+
[72, "look", "You are facing drawer 4."],
|
|
1010
|
+
[73, "go to safe 1", "You arrive at safe 1."],
|
|
1011
|
+
[74, "go to drawer 4", repeatedTargetObservation],
|
|
1012
|
+
]),
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1016
|
+
engine,
|
|
1017
|
+
sessionId: "ama",
|
|
1018
|
+
query: `What sequence of actions would transform the state between the observation: "${sourceObservation}" and the observation: "${targetObservation}"?`,
|
|
1019
|
+
maxChars: 5000,
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
assert.match(section, /Matched quoted observations: Observation 70 -> Observation 71/);
|
|
1023
|
+
assert.match(section, /step 71: go to drawer 4/);
|
|
1024
|
+
assert.doesNotMatch(section, /step 72: look/);
|
|
1025
|
+
assert.doesNotMatch(section, /step 74: go to drawer 4/);
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
test("buildTrajectoryAnalysisRecallSection prefers nearest core observation transition", async () => {
|
|
1029
|
+
const sourceObservation = [
|
|
1030
|
+
"You arrive at garbagecan 1. On the garbagecan 1, you see nothing.",
|
|
1031
|
+
"",
|
|
1032
|
+
"The current available actions are: go to drawer 4, look.",
|
|
1033
|
+
].join("\n");
|
|
1034
|
+
const immediateTargetObservation = [
|
|
1035
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
1036
|
+
"",
|
|
1037
|
+
"The current available actions are: examine garbagecan 1, look.",
|
|
1038
|
+
].join("\n");
|
|
1039
|
+
const laterTargetObservation = [
|
|
1040
|
+
"You arrive at drawer 4. The drawer 4 is open. In it, you see a creditcard 1.",
|
|
1041
|
+
"",
|
|
1042
|
+
"The current available actions are: examine shelf 2, take pencil 2 from shelf 2.",
|
|
1043
|
+
].join("\n");
|
|
1044
|
+
const engine = new FakeCueEngine({
|
|
1045
|
+
ama: makeTrajectoryMessages([
|
|
1046
|
+
[70, "go to garbagecan 1", sourceObservation],
|
|
1047
|
+
[71, "go to drawer 4", immediateTargetObservation],
|
|
1048
|
+
[72, "look", "You are facing drawer 4."],
|
|
1049
|
+
[73, "go to safe 1", "You arrive at safe 1."],
|
|
1050
|
+
[74, "go to drawer 4", "You arrive at drawer 4."],
|
|
1051
|
+
[75, "look", "You are facing drawer 4."],
|
|
1052
|
+
[76, "go to shelf 2", "You arrive at shelf 2."],
|
|
1053
|
+
[77, "go to drawer 4", laterTargetObservation],
|
|
1054
|
+
]),
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1058
|
+
engine,
|
|
1059
|
+
sessionId: "ama",
|
|
1060
|
+
query: `What sequence of actions would transform the state between the observation: "${sourceObservation}" and the observation: "${laterTargetObservation}"?`,
|
|
1061
|
+
maxChars: 5000,
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
assert.match(section, /Matched quoted observations: Observation 70 -> Observation 71/);
|
|
1065
|
+
assert.match(section, /step 71: go to drawer 4/);
|
|
1066
|
+
assert.doesNotMatch(section, /step 77: go to drawer 4/);
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
test("buildTrajectoryAnalysisRecallSection includes resulting observations for explicit action sequences", async () => {
|
|
1070
|
+
const startObservation = [
|
|
1071
|
+
"You are facing the toilet 1. Next to it, you see nothing.",
|
|
1072
|
+
"",
|
|
1073
|
+
"The current available actions are: go to countertop 1, look, inventory.",
|
|
1074
|
+
].join("\n");
|
|
1075
|
+
const finalObservation = [
|
|
1076
|
+
"You arrive at cabinet 1. The cabinet 1 is open. In it, you see a candle 2, a cloth 1, and a toiletpaper 3.",
|
|
1077
|
+
"",
|
|
1078
|
+
"The current available actions are: examine handtowelholder 1, examine toiletpaper 1, go to countertop 1, look.",
|
|
1079
|
+
].join("\n");
|
|
1080
|
+
const engine = new FakeCueEngine({
|
|
1081
|
+
ama: makeTrajectoryMessages([
|
|
1082
|
+
[70, "look", startObservation],
|
|
1083
|
+
[71, "go to countertop 1", "You arrive at countertop 1."],
|
|
1084
|
+
[72, "take toiletpaper 1 from countertop 1", "You pick up the toiletpaper 1 from the countertop 1."],
|
|
1085
|
+
[73, "go to cabinet 1", "You arrive at cabinet 1."],
|
|
1086
|
+
[74, "look", "You are facing the cabinet 1."],
|
|
1087
|
+
[75, "go to handtowelholder 1", "You arrive at handtowelholder 1."],
|
|
1088
|
+
[76, "go to cabinet 1", finalObservation],
|
|
1089
|
+
]),
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1093
|
+
engine,
|
|
1094
|
+
sessionId: "ama",
|
|
1095
|
+
query: `When the agent is at the state with observation: "${startObservation}", performs the following sequence of actions: step 70: look; step 71: go to countertop 1; step 72: take toiletpaper 1 from countertop 1; step 73: go to cabinet 1; step 74: look; step 75: go to handtowelholder 1; step 76: go to cabinet 1, what will be the resulting state? Please provide the full observation.`,
|
|
1096
|
+
maxChars: 5000,
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
assert.match(section, /Referenced action sequence and observations/);
|
|
1100
|
+
assert.match(section, /Resulting observation after Action 76: You arrive at cabinet 1/);
|
|
1101
|
+
assert.match(section, /examine handtowelholder 1, examine toiletpaper 1/);
|
|
1102
|
+
});
|
|
1103
|
+
|
|
1104
|
+
test("buildTrajectoryAnalysisRecallSection includes movable object state timelines", async () => {
|
|
1105
|
+
const engine = new FakeCueEngine({
|
|
1106
|
+
ama: makeTrajectoryMessages([
|
|
1107
|
+
[2, "go to toilet 1", "You arrive at toilet 1. On it, you see a toiletpaper 3."],
|
|
1108
|
+
[3, "take toiletpaper 3 from toilet 1", "You pick up the toiletpaper 3 from the toilet 1."],
|
|
1109
|
+
[4, "go to cabinet 1", "You arrive at cabinet 1. The cabinet 1 is closed."],
|
|
1110
|
+
[5, "open cabinet 1", "You open the cabinet 1."],
|
|
1111
|
+
[6, "move toiletpaper 3 to cabinet 1", "You move the toiletpaper 3 to the cabinet 1."],
|
|
1112
|
+
[77, "look", "You are facing the cabinet 1."],
|
|
1113
|
+
]),
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1117
|
+
engine,
|
|
1118
|
+
sessionId: "ama",
|
|
1119
|
+
query:
|
|
1120
|
+
"What is the state of toiletpaper 3 at step 77? When did this change occur and what were the prior whole changes history?",
|
|
1121
|
+
maxChars: 5000,
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
assert.match(section, /Timeline for toiletpaper 3/);
|
|
1125
|
+
assert.match(section, /Action 3.*take toiletpaper 3 from toilet 1/);
|
|
1126
|
+
assert.match(section, /Action 6.*move toiletpaper 3 to cabinet 1/);
|
|
1127
|
+
assert.match(section, /Inferred toiletpaper 3 location at step 77: cabinet 1/);
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
test("buildTrajectoryAnalysisRecallSection keeps disjoint explicit references discrete", async () => {
|
|
1131
|
+
const engine = new FakeCueEngine({
|
|
1132
|
+
ama: makeTrajectoryMessages([
|
|
1133
|
+
[2, "move-2", "state-2"],
|
|
1134
|
+
[20, "unrelated-noise bridge action", "state-20"],
|
|
1135
|
+
[40, "move-40", "state-40"],
|
|
1136
|
+
]),
|
|
1137
|
+
});
|
|
1138
|
+
|
|
1139
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1140
|
+
engine,
|
|
1141
|
+
sessionId: "ama",
|
|
1142
|
+
query: "Compare steps 2 and 40 with unrelated-noise before answering.",
|
|
1143
|
+
maxChars: 4000,
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
assert.match(section, /Action 2.*move-2/);
|
|
1147
|
+
assert.match(section, /Action 40.*move-40/);
|
|
1148
|
+
assert.doesNotMatch(section, /Action 20/);
|
|
1149
|
+
assert.doesNotMatch(section, /unrelated-noise bridge action/);
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
test("buildTrajectoryAnalysisRecallSection infers movement from relative object deltas", async () => {
|
|
1153
|
+
const engine = new FakeCueEngine({
|
|
1154
|
+
ama: makeTrajectoryMessages([
|
|
1155
|
+
[
|
|
1156
|
+
20,
|
|
1157
|
+
"right",
|
|
1158
|
+
[
|
|
1159
|
+
"Active rules:",
|
|
1160
|
+
"baba is you",
|
|
1161
|
+
"",
|
|
1162
|
+
"Objects on the map:",
|
|
1163
|
+
"rule `win` 3 step to the left",
|
|
1164
|
+
].join("\n"),
|
|
1165
|
+
],
|
|
1166
|
+
[
|
|
1167
|
+
21,
|
|
1168
|
+
"left",
|
|
1169
|
+
[
|
|
1170
|
+
"Active rules:",
|
|
1171
|
+
"baba is you",
|
|
1172
|
+
"",
|
|
1173
|
+
"Objects on the map:",
|
|
1174
|
+
"rule `win` 2 step to the left",
|
|
1175
|
+
].join("\n"),
|
|
1176
|
+
],
|
|
1177
|
+
]),
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1181
|
+
engine,
|
|
1182
|
+
sessionId: "ama",
|
|
1183
|
+
query:
|
|
1184
|
+
"Between steps 20 and 21, the rule 'win' block's relative position changed from 3 step to the left to 2 step to the left. What was the actual movement?",
|
|
1185
|
+
maxChars: 4000,
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
assert.match(section, /Relative-position movement cues/);
|
|
1189
|
+
assert.match(section, /rule win changed from 3 step to the left to 2 step to the left/);
|
|
1190
|
+
assert.match(section, /agent moved left/);
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
test("buildTrajectoryAnalysisRecallSection infers same-tile alignment from object disappearance", async () => {
|
|
1194
|
+
const engine = new FakeCueEngine({
|
|
1195
|
+
ama: makeTrajectoryMessages([
|
|
1196
|
+
[
|
|
1197
|
+
41,
|
|
1198
|
+
"right",
|
|
1199
|
+
[
|
|
1200
|
+
"Active rules:",
|
|
1201
|
+
"baba is you",
|
|
1202
|
+
"",
|
|
1203
|
+
"Objects on the map:",
|
|
1204
|
+
"ball 1 step to the right",
|
|
1205
|
+
"rule `win` 3 steps to the left and 1 step up",
|
|
1206
|
+
].join("\n"),
|
|
1207
|
+
],
|
|
1208
|
+
[
|
|
1209
|
+
42,
|
|
1210
|
+
"right",
|
|
1211
|
+
[
|
|
1212
|
+
"Active rules:",
|
|
1213
|
+
"baba is you",
|
|
1214
|
+
"",
|
|
1215
|
+
"Objects on the map:",
|
|
1216
|
+
"rule `win` 4 steps to the left and 1 step up",
|
|
1217
|
+
"rule `ball` 1 step to the right and 4 steps down",
|
|
1218
|
+
].join("\n"),
|
|
1219
|
+
],
|
|
1220
|
+
[
|
|
1221
|
+
43,
|
|
1222
|
+
"down",
|
|
1223
|
+
[
|
|
1224
|
+
"Active rules:",
|
|
1225
|
+
"baba is you",
|
|
1226
|
+
"",
|
|
1227
|
+
"Objects on the map:",
|
|
1228
|
+
"ball 1 step up",
|
|
1229
|
+
"rule `win` 4 steps to the left and 2 steps up",
|
|
1230
|
+
"rule `ball` 1 step to the right and 3 steps down",
|
|
1231
|
+
].join("\n"),
|
|
1232
|
+
],
|
|
1233
|
+
]),
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1237
|
+
engine,
|
|
1238
|
+
sessionId: "ama",
|
|
1239
|
+
query:
|
|
1240
|
+
"At step 41, the ball was 1 step to the right. After moving right in step 42 it vanished, then after moving down in step 43 it reappeared 1 step up. What was the exact position and why was achieving this state the critical objective of the agent's moves from step 39 to 42?",
|
|
1241
|
+
maxChars: 4000,
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
assert.match(section, /Object alignment cues/);
|
|
1245
|
+
assert.match(section, /zero-offset same-tile alignment at the end of step 42/);
|
|
1246
|
+
assert.match(section, /ball reappears 1 step up/);
|
|
1247
|
+
assert.match(section, /future upward interaction or alignment/);
|
|
1248
|
+
assert.match(section, /possible ball manipulation or rule alignment toward a new win condition/);
|
|
1249
|
+
assert.doesNotMatch(section, /not as pushing, collecting, or removing ball/);
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
test("buildTrajectoryAnalysisRecallSection infers rule-text repositioning goals", async () => {
|
|
1253
|
+
const engine = new FakeCueEngine({
|
|
1254
|
+
ama: makeTrajectoryMessages([
|
|
1255
|
+
[
|
|
1256
|
+
39,
|
|
1257
|
+
"up",
|
|
1258
|
+
[
|
|
1259
|
+
"Active rules:",
|
|
1260
|
+
"baba is you",
|
|
1261
|
+
"",
|
|
1262
|
+
"Objects on the map:",
|
|
1263
|
+
"rule `is` 2 step to the left and 2 step up",
|
|
1264
|
+
"rule `win` 1 step to the left and 2 step up",
|
|
1265
|
+
"ball 2 steps to the right and 1 step up",
|
|
1266
|
+
].join("\n"),
|
|
1267
|
+
],
|
|
1268
|
+
[
|
|
1269
|
+
42,
|
|
1270
|
+
"right",
|
|
1271
|
+
[
|
|
1272
|
+
"Active rules:",
|
|
1273
|
+
"baba is you",
|
|
1274
|
+
"",
|
|
1275
|
+
"Objects on the map:",
|
|
1276
|
+
"rule `is` 4 step to the left and 1 step up",
|
|
1277
|
+
"rule `win` 3 step to the left and 1 step up",
|
|
1278
|
+
"rule `ball` 1 step to the right and 4 steps down",
|
|
1279
|
+
].join("\n"),
|
|
1280
|
+
],
|
|
1281
|
+
]),
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1285
|
+
engine,
|
|
1286
|
+
sessionId: "ama",
|
|
1287
|
+
query:
|
|
1288
|
+
"In steps 39-42, what strategic goal did the up, up, right, right maneuver accomplish, and what implicit property of the ball made it necessary?",
|
|
1289
|
+
maxChars: 4000,
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
assert.match(section, /Rule-text positioning cues/);
|
|
1293
|
+
assert.match(section, /rule is moved from 2 step to the left and 2 step up to 4 step to the left and 1 step up/);
|
|
1294
|
+
assert.match(section, /rule win moved from 1 step to the left and 2 step up to 3 step to the left and 1 step up/);
|
|
1295
|
+
assert.match(section, /repositioning the agent to the right of those rule text blocks/);
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
test("buildTrajectoryAnalysisRecallSection recommends alternative moves toward win-rule text", async () => {
|
|
1299
|
+
const engine = new FakeCueEngine({
|
|
1300
|
+
ama: makeTrajectoryMessages([
|
|
1301
|
+
[
|
|
1302
|
+
7,
|
|
1303
|
+
"down",
|
|
1304
|
+
[
|
|
1305
|
+
"Active rules:",
|
|
1306
|
+
"baba is you",
|
|
1307
|
+
"",
|
|
1308
|
+
"Objects on the map:",
|
|
1309
|
+
"rule `is` 2 step to the left and 1 step up",
|
|
1310
|
+
"rule `win` 1 step to the left and 1 step up",
|
|
1311
|
+
"rule `door` 2 steps down",
|
|
1312
|
+
].join("\n"),
|
|
1313
|
+
],
|
|
1314
|
+
[
|
|
1315
|
+
8,
|
|
1316
|
+
"up",
|
|
1317
|
+
[
|
|
1318
|
+
"Active rules:",
|
|
1319
|
+
"baba is you",
|
|
1320
|
+
"",
|
|
1321
|
+
"Objects on the map:",
|
|
1322
|
+
"rule `is` 2 step to the left",
|
|
1323
|
+
"rule `win` 1 step to the left",
|
|
1324
|
+
"rule `door` 3 steps down",
|
|
1325
|
+
].join("\n"),
|
|
1326
|
+
],
|
|
1327
|
+
]),
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1331
|
+
engine,
|
|
1332
|
+
sessionId: "ama",
|
|
1333
|
+
query:
|
|
1334
|
+
"In steps 7-10, the agent gets stuck in a down-up loop. At the start of Step 8, instead of moving up, what alternative move would have represented a clear step towards creating a new win condition?",
|
|
1335
|
+
maxChars: 4000,
|
|
1336
|
+
});
|
|
1337
|
+
|
|
1338
|
+
assert.match(section, /Counterfactual action cues/);
|
|
1339
|
+
assert.match(section, /At the start of step 8, use Observation 7 as the decision state/);
|
|
1340
|
+
assert.match(section, /rule win at 1 step to the left and 1 step up/);
|
|
1341
|
+
assert.match(section, /left is the alternative/);
|
|
1342
|
+
assert.match(section, /IS\/WIN rule text/);
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
test("buildTrajectoryAnalysisRecallSection computes counterfactual relative positions from the prior observation", async () => {
|
|
1346
|
+
const engine = new FakeCueEngine({
|
|
1347
|
+
ama: makeTrajectoryMessages([
|
|
1348
|
+
[
|
|
1349
|
+
46,
|
|
1350
|
+
"down",
|
|
1351
|
+
[
|
|
1352
|
+
"Active rules:",
|
|
1353
|
+
"baba is you",
|
|
1354
|
+
"",
|
|
1355
|
+
"Objects on the map:",
|
|
1356
|
+
"rule `door` 3 step to the left",
|
|
1357
|
+
"rule `is` 4 step to the left and 3 step up",
|
|
1358
|
+
"rule `win` 3 step to the left and 3 step up",
|
|
1359
|
+
].join("\n"),
|
|
1360
|
+
],
|
|
1361
|
+
[
|
|
1362
|
+
47,
|
|
1363
|
+
"left",
|
|
1364
|
+
[
|
|
1365
|
+
"Active rules:",
|
|
1366
|
+
"baba is you",
|
|
1367
|
+
"",
|
|
1368
|
+
"Objects on the map:",
|
|
1369
|
+
"rule `door` 2 step to the left",
|
|
1370
|
+
"rule `is` 3 step to the left and 3 step up",
|
|
1371
|
+
"rule `win` 2 step to the left and 3 step up",
|
|
1372
|
+
].join("\n"),
|
|
1373
|
+
],
|
|
1374
|
+
[
|
|
1375
|
+
48,
|
|
1376
|
+
"up",
|
|
1377
|
+
[
|
|
1378
|
+
"Active rules:",
|
|
1379
|
+
"baba is you",
|
|
1380
|
+
"",
|
|
1381
|
+
"Objects on the map:",
|
|
1382
|
+
"rule `door` 2 step to the left and 1 step down",
|
|
1383
|
+
"rule `is` 3 step to the left and 2 step up",
|
|
1384
|
+
"rule `win` 2 step to the left and 2 step up",
|
|
1385
|
+
].join("\n"),
|
|
1386
|
+
],
|
|
1387
|
+
]),
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1391
|
+
engine,
|
|
1392
|
+
sessionId: "ama",
|
|
1393
|
+
query:
|
|
1394
|
+
"In steps 47 and 48, the agent executes `left` then `up`. If at step 47, the agent had moved `right` instead of `left`, what would the new relative position of the `DOOR` text block be, and why would this be counterproductive to the goal of forming a new rule?",
|
|
1395
|
+
maxChars: 4000,
|
|
1396
|
+
});
|
|
1397
|
+
|
|
1398
|
+
assert.match(section, /Counterfactual action cues/);
|
|
1399
|
+
assert.match(section, /Question target cue: because the query asks for a text\/word block/);
|
|
1400
|
+
assert.match(section, /use Observation 46/);
|
|
1401
|
+
assert.match(section, /static rule door would shift from 3 step to the left to 4 steps to the left/);
|
|
1402
|
+
assert.doesNotMatch(section, /static door would shift/);
|
|
1403
|
+
});
|
|
1404
|
+
|
|
1405
|
+
test("buildTrajectoryAnalysisRecallSection calls out the first non-canceling move after a loop", async () => {
|
|
1406
|
+
const engine = new FakeCueEngine({
|
|
1407
|
+
ama: makeTrajectoryMessages([
|
|
1408
|
+
[
|
|
1409
|
+
19,
|
|
1410
|
+
"right",
|
|
1411
|
+
[
|
|
1412
|
+
"Active rules:",
|
|
1413
|
+
"baba is you",
|
|
1414
|
+
"",
|
|
1415
|
+
"Objects on the map:",
|
|
1416
|
+
"rule `baba` 3 step to the left and 4 steps down",
|
|
1417
|
+
].join("\n"),
|
|
1418
|
+
],
|
|
1419
|
+
[20, "right", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `baba` 4 step to the left and 4 steps down"],
|
|
1420
|
+
[21, "left", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `baba` 3 step to the left and 4 steps down"],
|
|
1421
|
+
[22, "right", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `baba` 4 step to the left and 4 steps down"],
|
|
1422
|
+
[23, "left", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `baba` 3 step to the left and 4 steps down"],
|
|
1423
|
+
[24, "down", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `baba` 3 step to the left and 3 steps down"],
|
|
1424
|
+
]),
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1428
|
+
engine,
|
|
1429
|
+
sessionId: "ama",
|
|
1430
|
+
query:
|
|
1431
|
+
"What was the strategic importance of the down action at step 24 compared to the four preceding right/left actions (steps 20-23)?",
|
|
1432
|
+
maxChars: 4000,
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
assert.match(section, /Action movement summary cues/);
|
|
1436
|
+
assert.match(section, /right, left, right, left, down/);
|
|
1437
|
+
assert.match(section, /hidden absolute position by 1 down/);
|
|
1438
|
+
assert.match(section, /first non-canceling movement after the prior loop/);
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
test("buildTrajectoryAnalysisRecallSection identifies stop-rule blockers and open alternatives", async () => {
|
|
1442
|
+
const observation = [
|
|
1443
|
+
"Active rules:",
|
|
1444
|
+
"wall is stop",
|
|
1445
|
+
"baba is you",
|
|
1446
|
+
"",
|
|
1447
|
+
"Objects on the map:",
|
|
1448
|
+
"wall 1 step to the right",
|
|
1449
|
+
"rule `wall` 3 step to the left",
|
|
1450
|
+
"rule `is` 2 step to the left",
|
|
1451
|
+
"rule `stop` 1 step to the left",
|
|
1452
|
+
].join("\n");
|
|
1453
|
+
const engine = new FakeCueEngine({
|
|
1454
|
+
ama: makeTrajectoryMessages([
|
|
1455
|
+
[3, "right", observation],
|
|
1456
|
+
[4, "right", observation],
|
|
1457
|
+
]),
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1461
|
+
engine,
|
|
1462
|
+
sessionId: "ama",
|
|
1463
|
+
query:
|
|
1464
|
+
"If the agent had instead chosen the action up at step 4, would it have successfully moved, given wall is stop and repeated right failures?",
|
|
1465
|
+
maxChars: 4000,
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
assert.match(section, /Blocked-move cues/);
|
|
1469
|
+
assert.match(section, /Action 3 right is blocked/);
|
|
1470
|
+
assert.match(section, /wall is 1 step to the right/);
|
|
1471
|
+
assert.match(section, /up has no adjacent STOP object/);
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
test("buildTrajectoryAnalysisRecallSection detects direct alignment above the IS word in an active stop rule", async () => {
|
|
1475
|
+
const engine = new FakeCueEngine({
|
|
1476
|
+
ama: makeTrajectoryMessages([
|
|
1477
|
+
[
|
|
1478
|
+
15,
|
|
1479
|
+
"left",
|
|
1480
|
+
[
|
|
1481
|
+
"Active rules:",
|
|
1482
|
+
"wall is stop",
|
|
1483
|
+
"key is win",
|
|
1484
|
+
"baba is you",
|
|
1485
|
+
"",
|
|
1486
|
+
"Objects on the map:",
|
|
1487
|
+
"rule `wall` 1 step to the left and 1 step down",
|
|
1488
|
+
"rule `is` 1 step down",
|
|
1489
|
+
"rule `stop` 1 step to the right and 1 step down",
|
|
1490
|
+
"rule `baba` 1 step to the left and 6 steps down",
|
|
1491
|
+
"rule `is` 6 steps down",
|
|
1492
|
+
"rule `you` 1 step to the right and 6 steps down",
|
|
1493
|
+
].join("\n"),
|
|
1494
|
+
],
|
|
1495
|
+
]),
|
|
1496
|
+
});
|
|
1497
|
+
|
|
1498
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1499
|
+
engine,
|
|
1500
|
+
sessionId: "ama",
|
|
1501
|
+
query:
|
|
1502
|
+
"Considering the sequence of movements from step 12 to step 15, what positional relationship does the agent establish with the words of the wall is stop rule, and why is this strategically critical?",
|
|
1503
|
+
maxChars: 4000,
|
|
1504
|
+
});
|
|
1505
|
+
|
|
1506
|
+
assert.match(section, /Rule-phrase alignment cues/);
|
|
1507
|
+
assert.match(section, /active rule wall is stop is positioned/);
|
|
1508
|
+
assert.match(section, /agent is directly above the rule is block/);
|
|
1509
|
+
assert.match(section, /future down action can push IS out of the phrase/);
|
|
1510
|
+
assert.match(section, /removes the STOP property from wall objects/);
|
|
1511
|
+
});
|
|
1512
|
+
|
|
1513
|
+
test("buildTrajectoryAnalysisRecallSection treats stable repeated stop moves as blocked attempts", async () => {
|
|
1514
|
+
const observation = [
|
|
1515
|
+
"Active rules:",
|
|
1516
|
+
"wall is stop",
|
|
1517
|
+
"ball is win",
|
|
1518
|
+
"baba is you",
|
|
1519
|
+
"",
|
|
1520
|
+
"Objects on the map:",
|
|
1521
|
+
"wall 1 step to the right",
|
|
1522
|
+
"door 3 steps to the right",
|
|
1523
|
+
"rule `wall` 4 step to the left and 1 step up",
|
|
1524
|
+
"rule `is` 3 step to the left and 1 step up",
|
|
1525
|
+
"rule `stop` 2 step to the left and 1 step up",
|
|
1526
|
+
].join("\n");
|
|
1527
|
+
const engine = new FakeCueEngine({
|
|
1528
|
+
ama: makeTrajectoryMessages([
|
|
1529
|
+
[17, "right", observation],
|
|
1530
|
+
[18, "right", observation],
|
|
1531
|
+
[19, "right", observation],
|
|
1532
|
+
[20, "right", observation],
|
|
1533
|
+
[21, "right", observation],
|
|
1534
|
+
]),
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1538
|
+
engine,
|
|
1539
|
+
sessionId: "ama",
|
|
1540
|
+
query:
|
|
1541
|
+
"Between steps 17 and 21, the agent repeatedly attempts to move right but its position remains unchanged. Given wall is stop, why was this action guaranteed to fail, and what other actions would have been more strategic for making progress?",
|
|
1542
|
+
maxChars: 5000,
|
|
1543
|
+
});
|
|
1544
|
+
|
|
1545
|
+
assert.match(section, /blocked\/no-progress attempts/);
|
|
1546
|
+
assert.match(section, /Action 17 right is blocked/);
|
|
1547
|
+
assert.match(section, /wall is 1 step to the right/);
|
|
1548
|
+
assert.doesNotMatch(section, /hidden absolute position by 5 right/);
|
|
1549
|
+
});
|
|
1550
|
+
|
|
1551
|
+
test("buildTrajectoryAnalysisRecallSection treats no-change stop attempts as blocked, not hidden movement", async () => {
|
|
1552
|
+
const observation = [
|
|
1553
|
+
"Active rules:",
|
|
1554
|
+
"ball is win",
|
|
1555
|
+
"wall is stop",
|
|
1556
|
+
"baba is you",
|
|
1557
|
+
"",
|
|
1558
|
+
"Objects on the map:",
|
|
1559
|
+
"wall 1 step to the right",
|
|
1560
|
+
"rule `wall` 4 step to the left and 1 step up",
|
|
1561
|
+
"rule `is` 3 step to the left and 1 step up",
|
|
1562
|
+
"rule `stop` 2 step to the left and 1 step up",
|
|
1563
|
+
].join("\n");
|
|
1564
|
+
const engine = new FakeCueEngine({
|
|
1565
|
+
ama: makeTrajectoryMessages([
|
|
1566
|
+
[84, "right", observation],
|
|
1567
|
+
[85, "right", observation],
|
|
1568
|
+
[86, "right", observation],
|
|
1569
|
+
[87, "right", observation],
|
|
1570
|
+
[88, "right", observation],
|
|
1571
|
+
]),
|
|
1572
|
+
});
|
|
1573
|
+
|
|
1574
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1575
|
+
engine,
|
|
1576
|
+
sessionId: "ama",
|
|
1577
|
+
query:
|
|
1578
|
+
"Between steps 84 and 88, the agent consistently performed the `right` action, but the game state did not change at all. Were any of these actions relevant to making progress toward the goal? Explain why or why not, using the active rules and object positions from the observation.",
|
|
1579
|
+
maxChars: 6000,
|
|
1580
|
+
});
|
|
1581
|
+
|
|
1582
|
+
assert.match(section, /blocked\/no-progress attempts/);
|
|
1583
|
+
assert.match(section, /wall is 1 step to the right/);
|
|
1584
|
+
assert.match(section, /wall is stop/);
|
|
1585
|
+
assert.doesNotMatch(section, /hidden absolute position by 5 right/);
|
|
1586
|
+
});
|
|
1587
|
+
|
|
1588
|
+
test("buildTrajectoryAnalysisRecallSection names nearby IS as the missing push target", async () => {
|
|
1589
|
+
const engine = new FakeCueEngine({
|
|
1590
|
+
ama: makeTrajectoryMessages([
|
|
1591
|
+
[
|
|
1592
|
+
19,
|
|
1593
|
+
"right",
|
|
1594
|
+
[
|
|
1595
|
+
"Active rules:",
|
|
1596
|
+
"baba is you",
|
|
1597
|
+
"ball is win",
|
|
1598
|
+
"",
|
|
1599
|
+
"Objects on the map:",
|
|
1600
|
+
"key 1 step to the right",
|
|
1601
|
+
"rule `is` 2 step to the left",
|
|
1602
|
+
"rule `ball` 3 step to the left",
|
|
1603
|
+
"rule `win` 4 step to the left",
|
|
1604
|
+
].join("\n"),
|
|
1605
|
+
],
|
|
1606
|
+
[20, "left", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nkey 1 step to the right\nrule `is` 2 step to the left"],
|
|
1607
|
+
[21, "right", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nkey 1 step to the right\nrule `is` 2 step to the left"],
|
|
1608
|
+
[22, "down", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nkey 1 step to the right\nrule `is` 2 step to the left"],
|
|
1609
|
+
[23, "up", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nkey 1 step to the right\nrule `is` 2 step to the left"],
|
|
1610
|
+
]),
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1614
|
+
engine,
|
|
1615
|
+
sessionId: "ama",
|
|
1616
|
+
query:
|
|
1617
|
+
"Between steps 19 and 23, the agent executes opposing moves that result in no net change. What crucial, progress-enabling action is conspicuously absent from this sequence, and which nearby object is the most logical target for such an action?",
|
|
1618
|
+
maxChars: 5000,
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
assert.match(section, /Missing-interaction cues/);
|
|
1622
|
+
assert.match(section, /absent progress-enabling action is push/);
|
|
1623
|
+
assert.match(section, /nearby rule IS text block at 2 step to the left/);
|
|
1624
|
+
});
|
|
1625
|
+
|
|
1626
|
+
test("buildTrajectoryAnalysisRecallSection explains wall-stop rule intervention strategy", async () => {
|
|
1627
|
+
const engine = new FakeCueEngine({
|
|
1628
|
+
ama: makeTrajectoryMessages([
|
|
1629
|
+
[
|
|
1630
|
+
8,
|
|
1631
|
+
"up",
|
|
1632
|
+
[
|
|
1633
|
+
"Active rules:",
|
|
1634
|
+
"key is win",
|
|
1635
|
+
"wall is stop",
|
|
1636
|
+
"baba is you",
|
|
1637
|
+
"",
|
|
1638
|
+
"Objects on the map:",
|
|
1639
|
+
"wall 1 step to the right",
|
|
1640
|
+
"door 4 steps to the right and 2 step up",
|
|
1641
|
+
"rule `wall` 4 step to the left and 3 step up",
|
|
1642
|
+
"rule `is` 3 step to the left and 3 step up",
|
|
1643
|
+
"rule `stop` 2 step to the left and 3 step up",
|
|
1644
|
+
].join("\n"),
|
|
1645
|
+
],
|
|
1646
|
+
]),
|
|
1647
|
+
});
|
|
1648
|
+
|
|
1649
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1650
|
+
engine,
|
|
1651
|
+
sessionId: "ama",
|
|
1652
|
+
query:
|
|
1653
|
+
"At Step 8, after moving right three times, the agent is positioned below the WALL IS STOP rule text and chooses to move up. Given that a physical wall blocks access to the door on the right, why was moving up the optimal action for making progress, as opposed to continuing to move right?",
|
|
1654
|
+
maxChars: 5000,
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
assert.match(section, /Rule-intervention strategy cues/);
|
|
1658
|
+
assert.match(section, /wall objects immediately to the right block the right-side\/door path/);
|
|
1659
|
+
assert.match(section, /manipulating the WALL IS STOP rule text/);
|
|
1660
|
+
assert.match(section, /removing STOP from wall objects/);
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
test("buildTrajectoryAnalysisRecallSection explains no-key win-condition repositioning", async () => {
|
|
1664
|
+
const engine = new FakeCueEngine({
|
|
1665
|
+
ama: makeTrajectoryMessages([
|
|
1666
|
+
[
|
|
1667
|
+
25,
|
|
1668
|
+
"down",
|
|
1669
|
+
[
|
|
1670
|
+
"Active rules:",
|
|
1671
|
+
"key is win",
|
|
1672
|
+
"baba is you",
|
|
1673
|
+
"",
|
|
1674
|
+
"Objects on the map:",
|
|
1675
|
+
"door 3 steps to the right and 1 step down",
|
|
1676
|
+
"rule `door` 5 steps to the right and 1 step down",
|
|
1677
|
+
"rule `key` 3 steps to the right and 5 step up",
|
|
1678
|
+
"rule `is` 4 steps to the right and 5 step up",
|
|
1679
|
+
"rule `win` 5 steps to the right and 5 step up",
|
|
1680
|
+
"key 2 steps to the right and 5 steps down",
|
|
1681
|
+
].join("\n"),
|
|
1682
|
+
],
|
|
1683
|
+
[
|
|
1684
|
+
29,
|
|
1685
|
+
"down",
|
|
1686
|
+
[
|
|
1687
|
+
"Active rules:",
|
|
1688
|
+
"key is win",
|
|
1689
|
+
"baba is you",
|
|
1690
|
+
"",
|
|
1691
|
+
"Objects on the map:",
|
|
1692
|
+
"door 3 steps to the right and 3 step up",
|
|
1693
|
+
"rule `door` 5 steps to the right and 3 step up",
|
|
1694
|
+
"rule `key` 3 steps to the right and 5 step up",
|
|
1695
|
+
"rule `is` 4 steps to the right and 5 step up",
|
|
1696
|
+
"rule `win` 5 steps to the right and 5 step up",
|
|
1697
|
+
"key 2 steps to the right and 1 step down",
|
|
1698
|
+
].join("\n"),
|
|
1699
|
+
],
|
|
1700
|
+
]),
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1704
|
+
engine,
|
|
1705
|
+
sessionId: "ama",
|
|
1706
|
+
query:
|
|
1707
|
+
"From step 25 to 29, the agent moves down five consecutive times, seemingly increasing its distance from all the rule blocks. Given the win condition is key is win but no key objects exist, what critical hidden state is the agent changing, and why is this repositioning maneuver essential for eventually solving the puzzle?",
|
|
1708
|
+
maxChars: 5000,
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
assert.match(section, /Rule-intervention strategy cues/);
|
|
1712
|
+
assert.match(section, /Given the question premise that no ordinary key object should be used/);
|
|
1713
|
+
assert.match(section, /changing hidden board position/);
|
|
1714
|
+
assert.match(section, /make an existing object such as door participate in the win condition/);
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
test("buildTrajectoryAnalysisRecallSection explains counterfactual contact pushes", async () => {
|
|
1718
|
+
const engine = new FakeCueEngine({
|
|
1719
|
+
ama: makeTrajectoryMessages([
|
|
1720
|
+
[
|
|
1721
|
+
43,
|
|
1722
|
+
"right",
|
|
1723
|
+
[
|
|
1724
|
+
"Active rules:",
|
|
1725
|
+
"baba is you",
|
|
1726
|
+
"",
|
|
1727
|
+
"Objects on the map:",
|
|
1728
|
+
"key 1 step to the right and 1 step down",
|
|
1729
|
+
"rule `is` 1 step to the left and 1 step down",
|
|
1730
|
+
"rule `wall` 2 step to the left and 1 step up",
|
|
1731
|
+
"rule `stop` 1 step to the left and 1 step up",
|
|
1732
|
+
].join("\n"),
|
|
1733
|
+
],
|
|
1734
|
+
[
|
|
1735
|
+
44,
|
|
1736
|
+
"left",
|
|
1737
|
+
[
|
|
1738
|
+
"Active rules:",
|
|
1739
|
+
"baba is you",
|
|
1740
|
+
"",
|
|
1741
|
+
"Objects on the map:",
|
|
1742
|
+
"key 1 step down",
|
|
1743
|
+
"rule `is` 3 step to the left and 1 step down",
|
|
1744
|
+
"rule `wall` 3 step to the left and 1 step up",
|
|
1745
|
+
"rule `stop` 2 step to the left and 1 step up",
|
|
1746
|
+
].join("\n"),
|
|
1747
|
+
],
|
|
1748
|
+
[
|
|
1749
|
+
45,
|
|
1750
|
+
"left",
|
|
1751
|
+
[
|
|
1752
|
+
"Active rules:",
|
|
1753
|
+
"baba is you",
|
|
1754
|
+
"",
|
|
1755
|
+
"Objects on the map:",
|
|
1756
|
+
"key 1 step to the right and 1 step down",
|
|
1757
|
+
"rule `is` 1 step to the left and 1 step down",
|
|
1758
|
+
"rule `wall` 2 step to the left and 1 step up",
|
|
1759
|
+
"rule `stop` 1 step to the left and 1 step up",
|
|
1760
|
+
].join("\n"),
|
|
1761
|
+
],
|
|
1762
|
+
]),
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1766
|
+
engine,
|
|
1767
|
+
sessionId: "ama",
|
|
1768
|
+
query:
|
|
1769
|
+
"In the transition from step 44 to 45, the agent chose the action left, moving away from the key. Based on the object layout in step 44, what would have happened if the agent had moved down instead, and why would this alternative action have been more strategic for forming the rule WALL IS STOP?",
|
|
1770
|
+
maxChars: 6000,
|
|
1771
|
+
});
|
|
1772
|
+
|
|
1773
|
+
assert.match(section, /Counterfactual contact cues/);
|
|
1774
|
+
assert.match(section, /key is 1 step down/);
|
|
1775
|
+
assert.match(section, /push it one cell down/);
|
|
1776
|
+
assert.match(section, /Do not describe this as merely stepping onto or overlapping the block/);
|
|
1777
|
+
assert.match(section, /same horizontal row/);
|
|
1778
|
+
assert.match(section, /3 steps to the left/);
|
|
1779
|
+
assert.match(section, /alignment with WALL and STOP/);
|
|
1780
|
+
assert.doesNotMatch(section, /treat key as not currently pushable/);
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
test("buildTrajectoryAnalysisRecallSection explains adjacent rule-block setup", async () => {
|
|
1784
|
+
const engine = new FakeCueEngine({
|
|
1785
|
+
ama: makeTrajectoryMessages([
|
|
1786
|
+
[7, "up", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `win` 1 step to the right and 1 step up\nrule `is` 1 step up"],
|
|
1787
|
+
[8, "right", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `win` 1 step up\nrule `is` 1 step to the left and 1 step up"],
|
|
1788
|
+
]),
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1792
|
+
engine,
|
|
1793
|
+
sessionId: "ama",
|
|
1794
|
+
query:
|
|
1795
|
+
"The actions from step 4 to step 8 consist of a multi-step maneuver. By analyzing the agent's final position relative to the rule blocks in the step 8 observation, what crucial strategic advantage does the final right action secure?",
|
|
1796
|
+
maxChars: 6000,
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
assert.match(section, /Adjacent rule-block setup cues/);
|
|
1800
|
+
assert.match(section, /rule win is 1 step up/);
|
|
1801
|
+
assert.match(section, /directly underneath the WIN text block/);
|
|
1802
|
+
assert.match(section, /future up action can push WIN up/);
|
|
1803
|
+
});
|
|
1804
|
+
|
|
1805
|
+
test("buildTrajectoryAnalysisRecallSection does not treat loose push/block proximity as rule setup", async () => {
|
|
1806
|
+
const engine = new FakeCueEngine({
|
|
1807
|
+
ama: makeTrajectoryMessages([
|
|
1808
|
+
[7, "up", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `win` 1 step to the right and 1 step up\nrule `is` 1 step up"],
|
|
1809
|
+
[8, "right", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `win` 1 step up\nrule `is` 1 step to the left and 1 step up"],
|
|
1810
|
+
]),
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1814
|
+
engine,
|
|
1815
|
+
sessionId: "ama",
|
|
1816
|
+
query:
|
|
1817
|
+
"At step 8, after I pushed past wall to reach far block, what changed in relative position?",
|
|
1818
|
+
maxChars: 6000,
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
assert.match(section, /Relative-position movement cues/);
|
|
1822
|
+
assert.doesNotMatch(section, /Adjacent rule-block setup cues/);
|
|
1823
|
+
assert.doesNotMatch(section, /future up action can push WIN up/);
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
test("buildTrajectoryAnalysisRecallSection explains temporary rule transformations", async () => {
|
|
1827
|
+
const engine = new FakeCueEngine({
|
|
1828
|
+
ama: makeTrajectoryMessages([
|
|
1829
|
+
[19, "right", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `ball` 5 steps to the right"],
|
|
1830
|
+
[20, "left", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nkey 1 step to the right\nrule `ball` 5 steps to the right"],
|
|
1831
|
+
[21, "down", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `ball` 5 steps to the right"],
|
|
1832
|
+
]),
|
|
1833
|
+
});
|
|
1834
|
+
|
|
1835
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1836
|
+
engine,
|
|
1837
|
+
sessionId: "ama",
|
|
1838
|
+
query:
|
|
1839
|
+
"The agent's right action at step 19 causes a key to appear in the observation at step 20. The subsequent left action at step 20 causes the key to disappear. What hidden state change most likely occurred?",
|
|
1840
|
+
maxChars: 6000,
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
assert.match(section, /Temporary transformation cues/);
|
|
1844
|
+
assert.match(section, /key appears in Observation 20 but is absent before and after/);
|
|
1845
|
+
assert.match(section, /temporary hidden rule\/text alignment/);
|
|
1846
|
+
assert.match(section, /BALL IS KEY/);
|
|
1847
|
+
});
|
|
1848
|
+
|
|
1849
|
+
test("buildTrajectoryAnalysisRecallSection explains pushed phrase groups as diagonal movement", async () => {
|
|
1850
|
+
const engine = new FakeCueEngine({
|
|
1851
|
+
ama: makeTrajectoryMessages([
|
|
1852
|
+
[
|
|
1853
|
+
9,
|
|
1854
|
+
"right",
|
|
1855
|
+
[
|
|
1856
|
+
"Active rules:",
|
|
1857
|
+
"baba is you",
|
|
1858
|
+
"",
|
|
1859
|
+
"Objects on the map:",
|
|
1860
|
+
"wall 3 steps to the right and 4 steps down",
|
|
1861
|
+
"rule `is` 1 step down",
|
|
1862
|
+
"key 1 step to the right and 1 step down",
|
|
1863
|
+
].join("\n"),
|
|
1864
|
+
],
|
|
1865
|
+
[
|
|
1866
|
+
10,
|
|
1867
|
+
"right",
|
|
1868
|
+
[
|
|
1869
|
+
"Active rules:",
|
|
1870
|
+
"baba is you",
|
|
1871
|
+
"",
|
|
1872
|
+
"Objects on the map:",
|
|
1873
|
+
"wall 2 steps to the right and 4 steps down",
|
|
1874
|
+
"rule `is` 1 step to the left and 1 step down",
|
|
1875
|
+
"key 1 step down",
|
|
1876
|
+
].join("\n"),
|
|
1877
|
+
],
|
|
1878
|
+
]),
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1882
|
+
engine,
|
|
1883
|
+
sessionId: "ama",
|
|
1884
|
+
query:
|
|
1885
|
+
"In the transition from Step 9 to Step 10, the agent executes the action 'down', pushing the 'is' block. A standard push would only change the block's vertical position. However, the 'is' and 'key' blocks both shift their relative horizontal and vertical positions. Based on this outcome, what hidden movement mechanic affecting pushed objects can be inferred?",
|
|
1886
|
+
maxChars: 6000,
|
|
1887
|
+
});
|
|
1888
|
+
|
|
1889
|
+
assert.match(section, /Pushed phrase-group shift cues/);
|
|
1890
|
+
assert.match(section, /contacts rule IS at 1 step down/);
|
|
1891
|
+
assert.match(section, /adjacent KEY at 1 step to the right and 1 step down/);
|
|
1892
|
+
assert.match(section, /one cell down and one cell to the left/);
|
|
1893
|
+
assert.doesNotMatch(section, /this implies the agent moved right relative to a static object/);
|
|
1894
|
+
});
|
|
1895
|
+
|
|
1896
|
+
test("buildTrajectoryAnalysisRecallSection calls out self-reversing progress noise", async () => {
|
|
1897
|
+
const engine = new FakeCueEngine({
|
|
1898
|
+
ama: makeTrajectoryMessages([
|
|
1899
|
+
[19, "right", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 7 steps to the right"],
|
|
1900
|
+
[20, "left", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right"],
|
|
1901
|
+
[21, "down", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right and 1 step up"],
|
|
1902
|
+
[22, "up", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right"],
|
|
1903
|
+
]),
|
|
1904
|
+
});
|
|
1905
|
+
|
|
1906
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1907
|
+
engine,
|
|
1908
|
+
sessionId: "ama",
|
|
1909
|
+
query:
|
|
1910
|
+
"Between step 19 and step 23, the agent performs a sequence of four movements: `right`, `left`, `down`, and `up`. Which of these actions were relevant for making progress towards the goal of touching a `win` object, and why?",
|
|
1911
|
+
maxChars: 6000,
|
|
1912
|
+
});
|
|
1913
|
+
|
|
1914
|
+
assert.match(section, /Self-reversing sequence cues/);
|
|
1915
|
+
assert.match(section, /net displacement 0/);
|
|
1916
|
+
assert.match(section, /self-reversing exploratory noise/);
|
|
1917
|
+
assert.match(section, /none of the named actions made lasting progress/);
|
|
1918
|
+
assert.doesNotMatch(section, /Relative-position movement cues/);
|
|
1919
|
+
});
|
|
1920
|
+
|
|
1921
|
+
test("buildTrajectoryAnalysisRecallSection skips filler before named movement sequences", async () => {
|
|
1922
|
+
const engine = new FakeCueEngine({
|
|
1923
|
+
ama: makeTrajectoryMessages([
|
|
1924
|
+
[19, "right", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 7 steps to the right"],
|
|
1925
|
+
[20, "left", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right"],
|
|
1926
|
+
[21, "down", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right and 1 step up"],
|
|
1927
|
+
[22, "up", "Active rules:\nbaba is you\nball is win\n\nObjects on the map:\nrule `win` 8 steps to the right"],
|
|
1928
|
+
]),
|
|
1929
|
+
});
|
|
1930
|
+
|
|
1931
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1932
|
+
engine,
|
|
1933
|
+
sessionId: "ama",
|
|
1934
|
+
query:
|
|
1935
|
+
"Between step 19 and step 23, the agent performs a sequence of four movements: the following movements are right, left, down, and up. Which of these actions were relevant for making progress toward the goal of touching a win object, and why?",
|
|
1936
|
+
maxChars: 6000,
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
assert.match(section, /Self-reversing sequence cues/);
|
|
1940
|
+
assert.match(section, /net displacement 0/);
|
|
1941
|
+
assert.match(section, /self-reversing exploratory noise/);
|
|
1942
|
+
assert.doesNotMatch(section, /Relative-position movement cues/);
|
|
1943
|
+
});
|
|
1944
|
+
|
|
1945
|
+
test("buildTrajectoryAnalysisRecallSection infers failed text pushes reveal boundaries", async () => {
|
|
1946
|
+
const observation = [
|
|
1947
|
+
"Active rules:",
|
|
1948
|
+
"baba is you",
|
|
1949
|
+
"",
|
|
1950
|
+
"Objects on the map:",
|
|
1951
|
+
"rule `is` 1 step up",
|
|
1952
|
+
"rule `win` 1 step to the right and 1 step up",
|
|
1953
|
+
].join("\n");
|
|
1954
|
+
const engine = new FakeCueEngine({
|
|
1955
|
+
ama: makeTrajectoryMessages([
|
|
1956
|
+
[23, "left", observation],
|
|
1957
|
+
[24, "up", observation],
|
|
1958
|
+
[25, "up", observation],
|
|
1959
|
+
]),
|
|
1960
|
+
});
|
|
1961
|
+
|
|
1962
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
1963
|
+
engine,
|
|
1964
|
+
sessionId: "ama",
|
|
1965
|
+
query:
|
|
1966
|
+
"At Step 24 and 25, the agent's up action repeatedly fails, causing no change in the game state. Based on the object configuration shown in Step 23, what specific object is blocking the agent, and what critical information about the level's layout can be inferred from the agent's inability to push it?",
|
|
1967
|
+
maxChars: 6000,
|
|
1968
|
+
});
|
|
1969
|
+
|
|
1970
|
+
assert.match(section, /Failed-push boundary cues/);
|
|
1971
|
+
assert.match(section, /rule is is 1 step up/);
|
|
1972
|
+
assert.match(section, /No active STOP rule is involved/);
|
|
1973
|
+
assert.match(section, /pressed against the top\/northern edge of the playable area/);
|
|
1974
|
+
});
|
|
1975
|
+
|
|
1976
|
+
test("buildTrajectoryAnalysisRecallSection treats same-relative text pushes as hidden movement", async () => {
|
|
1977
|
+
const beforeContact = [
|
|
1978
|
+
"Active rules:",
|
|
1979
|
+
"baba is you",
|
|
1980
|
+
"",
|
|
1981
|
+
"Objects on the map:",
|
|
1982
|
+
"rule `door` 2 steps to the left",
|
|
1983
|
+
].join("\n");
|
|
1984
|
+
const adjacentDoor = [
|
|
1985
|
+
"Active rules:",
|
|
1986
|
+
"baba is you",
|
|
1987
|
+
"",
|
|
1988
|
+
"Objects on the map:",
|
|
1989
|
+
"rule `door` 1 step to the left",
|
|
1990
|
+
].join("\n");
|
|
1991
|
+
const engine = new FakeCueEngine({
|
|
1992
|
+
ama: makeTrajectoryMessages([
|
|
1993
|
+
[10, "left", beforeContact],
|
|
1994
|
+
[11, "left", adjacentDoor],
|
|
1995
|
+
[12, "left", adjacentDoor],
|
|
1996
|
+
]),
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1999
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2000
|
+
engine,
|
|
2001
|
+
sessionId: "ama",
|
|
2002
|
+
query:
|
|
2003
|
+
"At step 12, the observation still showed the `door` text block in the same relative position after a left move. What hidden state change occurred, and why is this not a failed push?",
|
|
2004
|
+
maxChars: 6000,
|
|
2005
|
+
});
|
|
2006
|
+
|
|
2007
|
+
assert.match(section, /Same-relative text-push cues/);
|
|
2008
|
+
assert.match(section, /cumulative displacement across the named repeated actions/);
|
|
2009
|
+
assert.match(section, /rule door moved one cell left per left action/);
|
|
2010
|
+
assert.match(section, /Action 12 left kept it at the same relative offset/);
|
|
2011
|
+
assert.match(section, /pushed rule door left and moved with it in hidden absolute coordinates/);
|
|
2012
|
+
assert.doesNotMatch(section, /Failed-push boundary cues/);
|
|
2013
|
+
});
|
|
2014
|
+
|
|
2015
|
+
test("buildTrajectoryAnalysisRecallSection recognizes instead-moved alternatives around stop blockers", async () => {
|
|
2016
|
+
const observation = [
|
|
2017
|
+
"Active rules:",
|
|
2018
|
+
"wall is stop",
|
|
2019
|
+
"baba is you",
|
|
2020
|
+
"",
|
|
2021
|
+
"Objects on the map:",
|
|
2022
|
+
"wall 1 step to the right",
|
|
2023
|
+
].join("\n");
|
|
2024
|
+
const engine = new FakeCueEngine({
|
|
2025
|
+
ama: makeTrajectoryMessages([
|
|
2026
|
+
[6, "right", observation],
|
|
2027
|
+
[7, "right", observation],
|
|
2028
|
+
]),
|
|
2029
|
+
});
|
|
2030
|
+
|
|
2031
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2032
|
+
engine,
|
|
2033
|
+
sessionId: "ama",
|
|
2034
|
+
query:
|
|
2035
|
+
"In steps 6 through 10, the agent repeatedly moves right but is blocked. If the agent at step 6 had instead moved left, would it have successfully changed its position?",
|
|
2036
|
+
maxChars: 6000,
|
|
2037
|
+
});
|
|
2038
|
+
|
|
2039
|
+
assert.match(section, /Blocked-move cues/);
|
|
2040
|
+
assert.match(section, /Action 6 right is blocked/);
|
|
2041
|
+
assert.match(section, /left has no adjacent STOP object/);
|
|
2042
|
+
});
|
|
2043
|
+
|
|
2044
|
+
test("buildTrajectoryAnalysisRecallSection explains whole-configuration shifts", async () => {
|
|
2045
|
+
const before = [
|
|
2046
|
+
"Active rules:",
|
|
2047
|
+
"baba is you",
|
|
2048
|
+
"",
|
|
2049
|
+
"Objects on the map:",
|
|
2050
|
+
"rule `is` 1 step up",
|
|
2051
|
+
"rule `win` 1 step to the right and 1 step up",
|
|
2052
|
+
"rule `key` 3 steps to the right and 1 step up",
|
|
2053
|
+
"rule `door` 1 step to the left",
|
|
2054
|
+
"door 1 step to the left and 1 step down",
|
|
2055
|
+
"rule `you` 1 step to the right and 4 steps down",
|
|
2056
|
+
].join("\n");
|
|
2057
|
+
const after = [
|
|
2058
|
+
"Active rules:",
|
|
2059
|
+
"baba is you",
|
|
2060
|
+
"",
|
|
2061
|
+
"Objects on the map:",
|
|
2062
|
+
"rule `is` 1 step to the left and 1 step up",
|
|
2063
|
+
"rule `win` 1 step up",
|
|
2064
|
+
"rule `key` 2 steps to the right and 1 step up",
|
|
2065
|
+
"rule `door` 2 step to the left",
|
|
2066
|
+
"door 2 step to the left and 1 step down",
|
|
2067
|
+
"rule `you` 4 steps down",
|
|
2068
|
+
].join("\n");
|
|
2069
|
+
const engine = new FakeCueEngine({
|
|
2070
|
+
ama: makeTrajectoryMessages([
|
|
2071
|
+
[7, "up", before],
|
|
2072
|
+
[8, "right", after],
|
|
2073
|
+
]),
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2077
|
+
engine,
|
|
2078
|
+
sessionId: "ama",
|
|
2079
|
+
query:
|
|
2080
|
+
"In steps 4-7, the agent makes four consecutive moves without altering the positions of any objects. Then, at step 8, its right action causes the entire level configuration to shift. Why was moving right optimal, and what would moving left or down do instead?",
|
|
2081
|
+
maxChars: 6000,
|
|
2082
|
+
});
|
|
2083
|
+
|
|
2084
|
+
assert.match(section, /Whole-configuration shift cues/);
|
|
2085
|
+
assert.match(section, /coordinated whole-level push\/shift/);
|
|
2086
|
+
assert.match(section, /6 tracked objects or rule words all moved 1 step to the left/);
|
|
2087
|
+
assert.match(section, /moving left or down would move back into empty space or undo the setup/);
|
|
2088
|
+
});
|
|
2089
|
+
|
|
2090
|
+
test("buildTrajectoryAnalysisRecallSection infers blocked-corner escape directions", async () => {
|
|
2091
|
+
const observation = [
|
|
2092
|
+
"Active rules:",
|
|
2093
|
+
"baba is you",
|
|
2094
|
+
"",
|
|
2095
|
+
"Objects on the map:",
|
|
2096
|
+
"rule `is` 1 step up",
|
|
2097
|
+
"rule `win` 1 step to the right and 1 step up",
|
|
2098
|
+
].join("\n");
|
|
2099
|
+
const engine = new FakeCueEngine({
|
|
2100
|
+
ama: makeTrajectoryMessages([
|
|
2101
|
+
[11, "left", observation],
|
|
2102
|
+
[12, "left", observation],
|
|
2103
|
+
[13, "up", observation],
|
|
2104
|
+
[14, "up", observation],
|
|
2105
|
+
[15, "right", "Active rules:\nbaba is you\n\nObjects on the map:\nrule `win` 1 step up"],
|
|
2106
|
+
]),
|
|
2107
|
+
});
|
|
2108
|
+
|
|
2109
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2110
|
+
engine,
|
|
2111
|
+
sessionId: "ama",
|
|
2112
|
+
query:
|
|
2113
|
+
"Question: What can be inferred from the agent's failed moves (left in steps 11-12, up in steps 13-14) before the successful move at step 15?",
|
|
2114
|
+
maxChars: 6000,
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
assert.match(section, /Failed-move escape cues/);
|
|
2118
|
+
assert.match(section, /blocked to the left and above/);
|
|
2119
|
+
assert.match(section, /useful escape direction\(s\) are right and down/);
|
|
2120
|
+
assert.match(section, /successful right move at step 15/);
|
|
2121
|
+
assert.doesNotMatch(section, /Failed-push boundary cues/);
|
|
2122
|
+
});
|
|
2123
|
+
|
|
2124
|
+
test("buildTrajectoryAnalysisRecallSection identifies the only effective action inside a span", async () => {
|
|
2125
|
+
const baseline = [
|
|
2126
|
+
"Active rules:",
|
|
2127
|
+
"baba is you",
|
|
2128
|
+
"",
|
|
2129
|
+
"Objects on the map:",
|
|
2130
|
+
"rule `win` 1 step to the right and 1 step up",
|
|
2131
|
+
"rule `door` 1 step to the left",
|
|
2132
|
+
].join("\n");
|
|
2133
|
+
const changed = [
|
|
2134
|
+
"Active rules:",
|
|
2135
|
+
"baba is you",
|
|
2136
|
+
"",
|
|
2137
|
+
"Objects on the map:",
|
|
2138
|
+
"rule `win` 1 step up",
|
|
2139
|
+
"rule `door` 2 step to the left",
|
|
2140
|
+
].join("\n");
|
|
2141
|
+
const engine = new FakeCueEngine({
|
|
2142
|
+
ama: makeTrajectoryMessages([
|
|
2143
|
+
[11, "left", baseline],
|
|
2144
|
+
[12, "left", baseline],
|
|
2145
|
+
[13, "up", baseline],
|
|
2146
|
+
[14, "up", baseline],
|
|
2147
|
+
[15, "right", changed],
|
|
2148
|
+
]),
|
|
2149
|
+
});
|
|
2150
|
+
|
|
2151
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2152
|
+
engine,
|
|
2153
|
+
sessionId: "ama",
|
|
2154
|
+
query:
|
|
2155
|
+
"In the sequence from step 11 to step 15, only one action caused a change in the game state. Which specific action was relevant, and what evidence proves the other four were ineffective?",
|
|
2156
|
+
maxChars: 6000,
|
|
2157
|
+
});
|
|
2158
|
+
|
|
2159
|
+
assert.match(section, /Only-effective action cues/);
|
|
2160
|
+
assert.match(section, /Observations 11-14 have the same object-relative signature/);
|
|
2161
|
+
assert.match(section, /Action 15 right is the only progress-making action/);
|
|
2162
|
+
assert.match(section, /rule win changed from 1 step to the right and 1 step up to 1 step up/);
|
|
2163
|
+
assert.doesNotMatch(section, /Action movement summary cues/);
|
|
2164
|
+
});
|
|
2165
|
+
|
|
2166
|
+
test("buildTrajectoryAnalysisRecallSection explains active control-rule interaction setup", async () => {
|
|
2167
|
+
const engine = new FakeCueEngine({
|
|
2168
|
+
ama: makeTrajectoryMessages([
|
|
2169
|
+
[
|
|
2170
|
+
29,
|
|
2171
|
+
"down",
|
|
2172
|
+
[
|
|
2173
|
+
"Active rules:",
|
|
2174
|
+
"key is win",
|
|
2175
|
+
"baba is you",
|
|
2176
|
+
"",
|
|
2177
|
+
"Objects on the map:",
|
|
2178
|
+
"rule `baba` 5 step to the left and 1 step down",
|
|
2179
|
+
"rule `is` 4 step to the left and 1 step down",
|
|
2180
|
+
"rule `you` 3 step to the left and 1 step down",
|
|
2181
|
+
].join("\n"),
|
|
2182
|
+
],
|
|
2183
|
+
]),
|
|
2184
|
+
});
|
|
2185
|
+
|
|
2186
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2187
|
+
engine,
|
|
2188
|
+
sessionId: "ama",
|
|
2189
|
+
query:
|
|
2190
|
+
"Between steps 25 and 29, the agent repeatedly moves down. What specific text block is the agent moving to position itself next to, and why is this multi-step approach a necessary prerequisite for interacting with the `baba is you` rule?",
|
|
2191
|
+
maxChars: 6000,
|
|
2192
|
+
});
|
|
2193
|
+
|
|
2194
|
+
assert.match(section, /Control-rule interaction cues/);
|
|
2195
|
+
assert.match(section, /specific target text block is rule baba/);
|
|
2196
|
+
assert.match(section, /BABA IS YOU makes Baba the controlled agent/);
|
|
2197
|
+
assert.match(section, /push a different object or text block into the rule's syntax line/);
|
|
2198
|
+
});
|
|
2199
|
+
|
|
2200
|
+
test("buildTrajectoryAnalysisRecallSection surfaces inactive object rules", async () => {
|
|
2201
|
+
const engine = new FakeCueEngine({
|
|
2202
|
+
ama: makeTrajectoryMessages([
|
|
2203
|
+
[
|
|
2204
|
+
39,
|
|
2205
|
+
"up",
|
|
2206
|
+
[
|
|
2207
|
+
"Active rules:",
|
|
2208
|
+
"baba is you",
|
|
2209
|
+
"",
|
|
2210
|
+
"Objects on the map:",
|
|
2211
|
+
"ball 2 steps to the right and 1 step up",
|
|
2212
|
+
"rule `ball` 3 steps to the right and 3 steps down",
|
|
2213
|
+
].join("\n"),
|
|
2214
|
+
],
|
|
2215
|
+
[
|
|
2216
|
+
42,
|
|
2217
|
+
"right",
|
|
2218
|
+
[
|
|
2219
|
+
"Active rules:",
|
|
2220
|
+
"baba is you",
|
|
2221
|
+
"",
|
|
2222
|
+
"Objects on the map:",
|
|
2223
|
+
"rule `ball` 1 step to the right and 4 steps down",
|
|
2224
|
+
].join("\n"),
|
|
2225
|
+
],
|
|
2226
|
+
]),
|
|
2227
|
+
});
|
|
2228
|
+
|
|
2229
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2230
|
+
engine,
|
|
2231
|
+
sessionId: "ama",
|
|
2232
|
+
query:
|
|
2233
|
+
"In steps 39-42, what strategic goal did the up, up, right, right maneuver accomplish, and what implicit property of the ball made it necessary?",
|
|
2234
|
+
maxChars: 4000,
|
|
2235
|
+
});
|
|
2236
|
+
|
|
2237
|
+
assert.match(section, /Rule-state cues/);
|
|
2238
|
+
assert.match(section, /Active rules in this window: baba is you/);
|
|
2239
|
+
assert.match(section, /No active rule for ball appears/);
|
|
2240
|
+
assert.match(section, /no "ball is push" rule is active/);
|
|
2241
|
+
assert.match(section, /treat ball as not currently pushable/);
|
|
2242
|
+
assert.match(section, /bypassing or repositioning around a not-pushable obstacle/);
|
|
2243
|
+
});
|
|
2244
|
+
|
|
2245
|
+
test("buildTrajectoryAnalysisRecallSection expands sparse turn-index archives", async () => {
|
|
2246
|
+
const engine = new FakeCueEngine({
|
|
2247
|
+
ama: makeTrajectoryMessages([[50, "sparse target action", "sparse target state"]])
|
|
2248
|
+
.map((message, index) => ({
|
|
2249
|
+
...message,
|
|
2250
|
+
turnIndex: 100 + index,
|
|
2251
|
+
})),
|
|
2252
|
+
});
|
|
2253
|
+
|
|
2254
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2255
|
+
engine,
|
|
2256
|
+
sessionId: "ama",
|
|
2257
|
+
query: "What happened in step 50?",
|
|
2258
|
+
maxChars: 4000,
|
|
2259
|
+
});
|
|
2260
|
+
|
|
2261
|
+
assert.match(section, /Action 50.*sparse target action/);
|
|
2262
|
+
assert.match(section, /Observation 50.*sparse target state/);
|
|
2263
|
+
});
|
|
2264
|
+
|
|
2265
|
+
test("buildTrajectoryAnalysisRecallSection rejects reverse-only quoted observation transitions", async () => {
|
|
2266
|
+
const laterObservation = "later state with the source details";
|
|
2267
|
+
const earlierObservation = "earlier state with the target details";
|
|
2268
|
+
const engine = new FakeCueEngine({
|
|
2269
|
+
ama: makeTrajectoryMessages([
|
|
2270
|
+
[5, "first action", earlierObservation],
|
|
2271
|
+
[10, "later action", laterObservation],
|
|
2272
|
+
]),
|
|
2273
|
+
});
|
|
2274
|
+
|
|
2275
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2276
|
+
engine,
|
|
2277
|
+
sessionId: "ama",
|
|
2278
|
+
query: `What sequence of actions would transform the state between the observation: "${laterObservation}" and the observation: "${earlierObservation}"?`,
|
|
2279
|
+
maxChars: 4000,
|
|
2280
|
+
});
|
|
2281
|
+
|
|
2282
|
+
assert.equal(section, "");
|
|
2283
|
+
});
|
|
2284
|
+
|
|
2285
|
+
test("buildTrajectoryAnalysisRecallSection truncates within tiny budgets", async () => {
|
|
2286
|
+
const engine = new FakeCueEngine({
|
|
2287
|
+
ama: makeTrajectoryMessages([[1, "look", "state-1"]]),
|
|
2288
|
+
});
|
|
2289
|
+
const header = "## Trajectory analysis";
|
|
2290
|
+
const newline = "\n";
|
|
2291
|
+
const maxChars = header.length + newline.length + 2;
|
|
2292
|
+
|
|
2293
|
+
const section = await buildTrajectoryAnalysisRecallSection({
|
|
2294
|
+
engine,
|
|
2295
|
+
sessionId: "ama",
|
|
2296
|
+
query: "What actions were performed between step 1 and step 1?",
|
|
2297
|
+
maxChars,
|
|
2298
|
+
});
|
|
2299
|
+
|
|
2300
|
+
assert.ok(section.length <= maxChars);
|
|
2301
|
+
assert.match(section, /^## Trajectory analysis\n/);
|
|
2302
|
+
assert.equal(
|
|
2303
|
+
await buildTrajectoryAnalysisRecallSection({
|
|
2304
|
+
engine,
|
|
2305
|
+
sessionId: "ama",
|
|
2306
|
+
query: "What actions were performed between step 1 and step 1?",
|
|
2307
|
+
maxChars: header.length,
|
|
2308
|
+
}),
|
|
2309
|
+
"",
|
|
2310
|
+
);
|
|
2311
|
+
});
|
|
2312
|
+
|
|
2313
|
+
test("buildExplicitCueRecallSection expands paired action and observation references", async () => {
|
|
2314
|
+
const messages = Array.from({ length: 22 }, (_, index) => ({
|
|
2315
|
+
role: index % 2 === 0 ? "assistant" : "user",
|
|
2316
|
+
content: `filler turn ${index}`,
|
|
2317
|
+
}));
|
|
2318
|
+
messages[16] = { role: "assistant", content: "[Action 8] opened the billing settings" };
|
|
2319
|
+
messages[17] = { role: "user", content: "[Observation 8] plan limit was visible" };
|
|
2320
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2321
|
+
|
|
2322
|
+
const section = await buildExplicitCueRecallSection({
|
|
2323
|
+
engine,
|
|
2324
|
+
sessionId: "bench-session",
|
|
2325
|
+
query: "What happened in Step 8?",
|
|
2326
|
+
maxChars: 2000,
|
|
2327
|
+
});
|
|
2328
|
+
|
|
2329
|
+
assert.match(section, /^## Explicit Cue Evidence/);
|
|
2330
|
+
assert.match(section, /Action 8/);
|
|
2331
|
+
assert.match(section, /Observation 8/);
|
|
2332
|
+
});
|
|
2333
|
+
|
|
2334
|
+
test("buildExplicitCueRecallSection does not leak the next action into step windows", async () => {
|
|
2335
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2336
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2337
|
+
content: `filler turn ${index}`,
|
|
2338
|
+
}));
|
|
2339
|
+
messages[39] = { role: "assistant", content: "[Observation 19] before the range" };
|
|
2340
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2341
|
+
messages[41] = { role: "assistant", content: "[Observation 20] after right" };
|
|
2342
|
+
messages[46] = { role: "user", content: "[Action 23] down" };
|
|
2343
|
+
messages[47] = { role: "assistant", content: "[Observation 23] after down" };
|
|
2344
|
+
messages[48] = { role: "user", content: "[Action 24] future action should not appear" };
|
|
2345
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2346
|
+
|
|
2347
|
+
const section = await buildExplicitCueRecallSection({
|
|
2348
|
+
engine,
|
|
2349
|
+
sessionId: "bench-session",
|
|
2350
|
+
query: "Between steps 20 and 23, which single action mattered?",
|
|
2351
|
+
maxChars: 4000,
|
|
2352
|
+
});
|
|
2353
|
+
|
|
2354
|
+
assert.match(section, /Observation 19/);
|
|
2355
|
+
assert.match(section, /Action 20/);
|
|
2356
|
+
assert.match(section, /Action 23/);
|
|
2357
|
+
assert.match(section, /Observation 23/);
|
|
2358
|
+
assert.doesNotMatch(section, /Action 24/);
|
|
2359
|
+
});
|
|
2360
|
+
|
|
2361
|
+
test("buildExplicitCueRecallSection keeps loop-break action questions inside bounded ranges", async () => {
|
|
2362
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2363
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2364
|
+
content: `filler turn ${index}`,
|
|
2365
|
+
}));
|
|
2366
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2367
|
+
messages[41] = { role: "assistant", content: "[Observation 20] loop started" };
|
|
2368
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2369
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2370
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2371
|
+
messages[49] = { role: "assistant", content: "[Observation 24] successor state" };
|
|
2372
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2373
|
+
|
|
2374
|
+
const section = await buildExplicitCueRecallSection({
|
|
2375
|
+
engine,
|
|
2376
|
+
sessionId: "bench-session",
|
|
2377
|
+
query: "Between steps 20 and 23, which action broke the loop?",
|
|
2378
|
+
maxChars: 4000,
|
|
2379
|
+
});
|
|
2380
|
+
|
|
2381
|
+
assert.match(section, /Action 20/);
|
|
2382
|
+
assert.match(section, /Action 23/);
|
|
2383
|
+
assert.match(section, /Observation 23/);
|
|
2384
|
+
assert.doesNotMatch(section, /Action 24/);
|
|
2385
|
+
assert.doesNotMatch(section, /Observation 24/);
|
|
2386
|
+
});
|
|
2387
|
+
|
|
2388
|
+
test("buildExplicitCueRecallSection treats hash-prefixed loop-break ranges as bounded", async () => {
|
|
2389
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2390
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2391
|
+
content: `filler turn ${index}`,
|
|
2392
|
+
}));
|
|
2393
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2394
|
+
messages[41] = { role: "assistant", content: "[Observation 20] loop started" };
|
|
2395
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2396
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2397
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2398
|
+
messages[49] = { role: "assistant", content: "[Observation 24] successor state" };
|
|
2399
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2400
|
+
|
|
2401
|
+
const section = await buildExplicitCueRecallSection({
|
|
2402
|
+
engine,
|
|
2403
|
+
sessionId: "bench-session",
|
|
2404
|
+
query: "Between actions #20-#23, which action broke the loop?",
|
|
2405
|
+
maxChars: 4000,
|
|
2406
|
+
});
|
|
2407
|
+
|
|
2408
|
+
assert.match(section, /Action 20/);
|
|
2409
|
+
assert.match(section, /Action 23/);
|
|
2410
|
+
assert.match(section, /Observation 23/);
|
|
2411
|
+
assert.doesNotMatch(section, /Action 24/);
|
|
2412
|
+
assert.doesNotMatch(section, /Observation 24/);
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
test("buildExplicitCueRecallSection keeps loop-break action questions inside single steps", async () => {
|
|
2416
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2417
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2418
|
+
content: `filler turn ${index}`,
|
|
2419
|
+
}));
|
|
2420
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2421
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2422
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2423
|
+
messages[49] = { role: "assistant", content: "[Observation 24] successor state" };
|
|
2424
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2425
|
+
|
|
2426
|
+
const section = await buildExplicitCueRecallSection({
|
|
2427
|
+
engine,
|
|
2428
|
+
sessionId: "bench-session",
|
|
2429
|
+
query: "In step 23, which action broke the loop?",
|
|
2430
|
+
maxChars: 4000,
|
|
2431
|
+
});
|
|
2432
|
+
|
|
2433
|
+
assert.match(section, /Action 23/);
|
|
2434
|
+
assert.match(section, /Observation 23/);
|
|
2435
|
+
assert.doesNotMatch(section, /Action 24/);
|
|
2436
|
+
assert.doesNotMatch(section, /Observation 24/);
|
|
2437
|
+
});
|
|
2438
|
+
|
|
2439
|
+
test("buildExplicitCueRecallSection includes successor trajectory evidence when requested", async () => {
|
|
2440
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2441
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2442
|
+
content: `filler turn ${index}`,
|
|
2443
|
+
}));
|
|
2444
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2445
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2446
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2447
|
+
messages[49] = { role: "assistant", content: "[Observation 24] the loop was broken" };
|
|
2448
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2449
|
+
|
|
2450
|
+
const section = await buildExplicitCueRecallSection({
|
|
2451
|
+
engine,
|
|
2452
|
+
sessionId: "bench-session",
|
|
2453
|
+
query: "After step 23, what did the next action accomplish?",
|
|
2454
|
+
maxChars: 4000,
|
|
2455
|
+
});
|
|
2456
|
+
|
|
2457
|
+
assert.match(section, /Action 23/);
|
|
2458
|
+
assert.match(section, /Observation 23/);
|
|
2459
|
+
assert.match(section, /Action 24/);
|
|
2460
|
+
assert.match(section, /Observation 24/);
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2463
|
+
test("buildExplicitCueRecallSection includes successor evidence for explicit loop breaks", async () => {
|
|
2464
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2465
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2466
|
+
content: `filler turn ${index}`,
|
|
2467
|
+
}));
|
|
2468
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2469
|
+
messages[41] = { role: "assistant", content: "[Observation 20] start of loop" };
|
|
2470
|
+
messages[42] = { role: "user", content: "[Action 21] left" };
|
|
2471
|
+
messages[43] = { role: "assistant", content: "[Observation 21] loop returned" };
|
|
2472
|
+
messages[44] = { role: "user", content: "[Action 22] right" };
|
|
2473
|
+
messages[45] = { role: "assistant", content: "[Observation 22] loop repeated" };
|
|
2474
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2475
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2476
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2477
|
+
messages[49] = { role: "assistant", content: "[Observation 24] the loop was broken" };
|
|
2478
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2479
|
+
|
|
2480
|
+
const section = await buildExplicitCueRecallSection({
|
|
2481
|
+
engine,
|
|
2482
|
+
sessionId: "bench-session",
|
|
2483
|
+
query:
|
|
2484
|
+
"Steps 20-23 formed a right-left loop; what did the down action do to break this loop?",
|
|
2485
|
+
maxChars: 4000,
|
|
2486
|
+
});
|
|
2487
|
+
|
|
2488
|
+
assert.match(section, /Action 20/);
|
|
2489
|
+
assert.match(section, /Action 23/);
|
|
2490
|
+
assert.match(section, /Action 24/);
|
|
2491
|
+
assert.match(section, /Observation 24/);
|
|
2492
|
+
});
|
|
2493
|
+
|
|
2494
|
+
test("buildExplicitCueRecallSection includes successor evidence for break-out loop wording", async () => {
|
|
2495
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2496
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2497
|
+
content: `filler turn ${index}`,
|
|
2498
|
+
}));
|
|
2499
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2500
|
+
messages[41] = { role: "assistant", content: "[Observation 20] start of loop" };
|
|
2501
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2502
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2503
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2504
|
+
messages[49] = { role: "assistant", content: "[Observation 24] the loop was broken" };
|
|
2505
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2506
|
+
|
|
2507
|
+
const section = await buildExplicitCueRecallSection({
|
|
2508
|
+
engine,
|
|
2509
|
+
sessionId: "bench-session",
|
|
2510
|
+
query:
|
|
2511
|
+
"Steps 20-23 formed a right-left loop; what did the down action do to break out of the loop?",
|
|
2512
|
+
maxChars: 4000,
|
|
2513
|
+
});
|
|
2514
|
+
|
|
2515
|
+
assert.match(section, /Action 23/);
|
|
2516
|
+
assert.match(section, /Action 24/);
|
|
2517
|
+
assert.match(section, /Observation 24/);
|
|
2518
|
+
});
|
|
2519
|
+
|
|
2520
|
+
test("buildExplicitCueRecallSection includes successor evidence for end and stop loop wording", async () => {
|
|
2521
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2522
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2523
|
+
content: `filler turn ${index}`,
|
|
2524
|
+
}));
|
|
2525
|
+
messages[40] = { role: "user", content: "[Action 20] right" };
|
|
2526
|
+
messages[41] = { role: "assistant", content: "[Observation 20] start of loop" };
|
|
2527
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2528
|
+
messages[47] = { role: "assistant", content: "[Observation 23] loop still continued" };
|
|
2529
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2530
|
+
messages[49] = { role: "assistant", content: "[Observation 24] the loop was stopped" };
|
|
2531
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2532
|
+
|
|
2533
|
+
const endSection = await buildExplicitCueRecallSection({
|
|
2534
|
+
engine,
|
|
2535
|
+
sessionId: "bench-session",
|
|
2536
|
+
query:
|
|
2537
|
+
"Steps 20-23 formed a loop; what did the down action do to end the loop?",
|
|
2538
|
+
maxChars: 4000,
|
|
2539
|
+
});
|
|
2540
|
+
const stopSection = await buildExplicitCueRecallSection({
|
|
2541
|
+
engine,
|
|
2542
|
+
sessionId: "bench-session",
|
|
2543
|
+
query:
|
|
2544
|
+
"Steps 20-23 formed a loop; what did the down action do to stop this loop?",
|
|
2545
|
+
maxChars: 4000,
|
|
2546
|
+
});
|
|
2547
|
+
|
|
2548
|
+
for (const section of [endSection, stopSection]) {
|
|
2549
|
+
assert.match(section, /Action 23/);
|
|
2550
|
+
assert.match(section, /Action 24/);
|
|
2551
|
+
assert.match(section, /Observation 24/);
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
|
|
2555
|
+
test("buildExplicitCueRecallSection does not treat broad break wording as successor intent", async () => {
|
|
2556
|
+
const messages = Array.from({ length: 54 }, (_, index) => ({
|
|
2557
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2558
|
+
content: `filler turn ${index}`,
|
|
2559
|
+
}));
|
|
2560
|
+
messages[46] = { role: "user", content: "[Action 23] left" };
|
|
2561
|
+
messages[47] = { role: "assistant", content: "[Observation 23] the rule broke" };
|
|
2562
|
+
messages[48] = { role: "user", content: "[Action 24] down" };
|
|
2563
|
+
messages[49] = { role: "assistant", content: "[Observation 24] successor state" };
|
|
2564
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2565
|
+
|
|
2566
|
+
const section = await buildExplicitCueRecallSection({
|
|
2567
|
+
engine,
|
|
2568
|
+
sessionId: "bench-session",
|
|
2569
|
+
query: "What broke in step 23?",
|
|
2570
|
+
maxChars: 4000,
|
|
2571
|
+
});
|
|
2572
|
+
|
|
2573
|
+
assert.match(section, /Action 23/);
|
|
2574
|
+
assert.match(section, /Observation 23/);
|
|
2575
|
+
assert.doesNotMatch(section, /Action 24/);
|
|
2576
|
+
assert.doesNotMatch(section, /Observation 24/);
|
|
2577
|
+
});
|
|
2578
|
+
|
|
2579
|
+
test("buildExplicitCueRecallSection resolves action and observation labels when transcript turns are offset", async () => {
|
|
2580
|
+
const messages = Array.from({ length: 130 }, (_, index) => ({
|
|
2581
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2582
|
+
content: `filler turn ${index}`,
|
|
2583
|
+
}));
|
|
2584
|
+
messages[101] = {
|
|
2585
|
+
role: "assistant",
|
|
2586
|
+
content: "[Observation 46]: rule `door` 3 steps to the left",
|
|
2587
|
+
};
|
|
2588
|
+
messages[102] = { role: "user", content: "[Action 47]: left" };
|
|
2589
|
+
messages[103] = {
|
|
2590
|
+
role: "assistant",
|
|
2591
|
+
content: "[Observation 47]: rule `door` 2 steps to the left",
|
|
2592
|
+
};
|
|
2593
|
+
messages[104] = { role: "user", content: "[Action 48]: up" };
|
|
2594
|
+
messages[105] = {
|
|
2595
|
+
role: "assistant",
|
|
2596
|
+
content: "[Observation 48]: rule `door` 2 steps to the left and 1 step down",
|
|
2597
|
+
};
|
|
2598
|
+
messages[106] = {
|
|
2599
|
+
role: "user",
|
|
2600
|
+
content: "[Action 49]: future action should not appear",
|
|
2601
|
+
};
|
|
2602
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2603
|
+
|
|
2604
|
+
const section = await buildExplicitCueRecallSection({
|
|
2605
|
+
engine,
|
|
2606
|
+
sessionId: "bench-session",
|
|
2607
|
+
query: "In steps 47 and 48, what did the left then up maneuver do?",
|
|
2608
|
+
maxChars: 4000,
|
|
2609
|
+
});
|
|
2610
|
+
|
|
2611
|
+
assert.match(section, /Observation 46/);
|
|
2612
|
+
assert.match(section, /Action 47/);
|
|
2613
|
+
assert.match(section, /Observation 47/);
|
|
2614
|
+
assert.match(section, /Action 48/);
|
|
2615
|
+
assert.match(section, /Observation 48/);
|
|
2616
|
+
assert.doesNotMatch(section, /Action 49/);
|
|
2617
|
+
});
|
|
2618
|
+
|
|
2619
|
+
test("buildExplicitCueRecallSection ignores quoted labels when resolving trajectory turns", async () => {
|
|
2620
|
+
const messages = Array.from({ length: 120 }, (_, index) => ({
|
|
2621
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2622
|
+
content: `filler turn ${index}`,
|
|
2623
|
+
}));
|
|
2624
|
+
messages[94] = { role: "user", content: "[Action 47]: fallback move" };
|
|
2625
|
+
messages[95] = { role: "assistant", content: "[Observation 47]: fallback state" };
|
|
2626
|
+
messages[101] = {
|
|
2627
|
+
role: "assistant",
|
|
2628
|
+
content: "The user later quoted [Action 47] while explaining an unrelated review.",
|
|
2629
|
+
};
|
|
2630
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2631
|
+
|
|
2632
|
+
const section = await buildExplicitCueRecallSection({
|
|
2633
|
+
engine,
|
|
2634
|
+
sessionId: "bench-session",
|
|
2635
|
+
query: "What happened in step 47?",
|
|
2636
|
+
maxChars: 4000,
|
|
2637
|
+
});
|
|
2638
|
+
|
|
2639
|
+
assert.match(section, /fallback move/);
|
|
2640
|
+
assert.match(section, /fallback state/);
|
|
2641
|
+
assert.doesNotMatch(section, /unrelated review/);
|
|
2642
|
+
});
|
|
2643
|
+
|
|
2644
|
+
test("buildExplicitCueRecallSection keeps searching past short quoted-label clusters", async () => {
|
|
2645
|
+
const messages = Array.from({ length: 150 }, (_, index) => ({
|
|
2646
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2647
|
+
content: `filler turn ${index}`,
|
|
2648
|
+
}));
|
|
2649
|
+
for (let index = 0; index < 10; index += 1) {
|
|
2650
|
+
const turnIndex = 70 + index * 2;
|
|
2651
|
+
messages[turnIndex] = {
|
|
2652
|
+
role: "assistant",
|
|
2653
|
+
content: `[Action 47]: quoted by assistant ${index}`,
|
|
2654
|
+
};
|
|
2655
|
+
messages[turnIndex + 1] = {
|
|
2656
|
+
role: "user",
|
|
2657
|
+
content: `[Observation 47]: quoted by user ${index}`,
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
messages[110] = { role: "user", content: "[Action 47]: true move" };
|
|
2661
|
+
messages[111] = { role: "assistant", content: "[Observation 47]: true state" };
|
|
2662
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2663
|
+
|
|
2664
|
+
const section = await buildExplicitCueRecallSection({
|
|
2665
|
+
engine,
|
|
2666
|
+
sessionId: "bench-session",
|
|
2667
|
+
query: "What happened in step 47?",
|
|
2668
|
+
maxChars: 4000,
|
|
2669
|
+
});
|
|
2670
|
+
|
|
2671
|
+
assert.match(section, /true move/);
|
|
2672
|
+
assert.match(section, /true state/);
|
|
2673
|
+
assert.doesNotMatch(section, /quoted by assistant/);
|
|
2674
|
+
assert.doesNotMatch(section, /quoted by user/);
|
|
2675
|
+
});
|
|
2676
|
+
|
|
2677
|
+
test("buildExplicitCueRecallSection keeps numeric fallback when label search is saturated", async () => {
|
|
2678
|
+
const messages = Array.from({ length: 180 }, (_, index) => ({
|
|
2679
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2680
|
+
content: `filler turn ${index}`,
|
|
2681
|
+
}));
|
|
2682
|
+
for (let index = 0; index < 70; index += 1) {
|
|
2683
|
+
messages[index] = {
|
|
2684
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2685
|
+
content:
|
|
2686
|
+
index % 2 === 0
|
|
2687
|
+
? `[Action 47]: earlier duplicate ${index}`
|
|
2688
|
+
: `[Observation 47]: earlier duplicate ${index}`,
|
|
2689
|
+
};
|
|
2690
|
+
}
|
|
2691
|
+
messages[93] = { role: "assistant", content: "[Observation 46]: true prior" };
|
|
2692
|
+
messages[94] = { role: "user", content: "[Action 47]: true move" };
|
|
2693
|
+
messages[95] = { role: "assistant", content: "[Observation 47]: true state" };
|
|
2694
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2695
|
+
|
|
2696
|
+
const section = await buildExplicitCueRecallSection({
|
|
2697
|
+
engine,
|
|
2698
|
+
sessionId: "bench-session",
|
|
2699
|
+
query: "What happened in step 47?",
|
|
2700
|
+
maxChars: 8000,
|
|
2701
|
+
});
|
|
2702
|
+
|
|
2703
|
+
assert.match(section, /true prior/);
|
|
2704
|
+
assert.match(section, /true move/);
|
|
2705
|
+
assert.match(section, /true state/);
|
|
2706
|
+
});
|
|
2707
|
+
|
|
2708
|
+
test("buildExplicitCueRecallSection skips unpaired label clusters before fallback evidence", async () => {
|
|
2709
|
+
const messages = Array.from({ length: 140 }, (_, index) => ({
|
|
2710
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2711
|
+
content: `filler turn ${index}`,
|
|
2712
|
+
}));
|
|
2713
|
+
for (let index = 0; index < 35; index += 1) {
|
|
2714
|
+
messages[index] = {
|
|
2715
|
+
role: "user",
|
|
2716
|
+
content: `[Action 47]: same-role quote ${index}`,
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
messages[93] = { role: "assistant", content: "[Observation 46] true prior" };
|
|
2720
|
+
messages[94] = { role: "user", content: "[Action 47] true legacy move" };
|
|
2721
|
+
messages[95] = { role: "assistant", content: "[Observation 47] true legacy state" };
|
|
2722
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2723
|
+
|
|
2724
|
+
const section = await buildExplicitCueRecallSection({
|
|
2725
|
+
engine,
|
|
2726
|
+
sessionId: "bench-session",
|
|
2727
|
+
query: "What happened in step 47?",
|
|
2728
|
+
maxChars: 3000,
|
|
2729
|
+
});
|
|
2730
|
+
|
|
2731
|
+
assert.match(section, /true prior/);
|
|
2732
|
+
assert.match(section, /true legacy move/);
|
|
2733
|
+
assert.match(section, /true legacy state/);
|
|
2734
|
+
assert.doesNotMatch(section, /same-role quote/);
|
|
2735
|
+
});
|
|
2736
|
+
|
|
2737
|
+
test("buildExplicitCueRecallSection prefers nearby legacy labels over early long quote pairs", async () => {
|
|
2738
|
+
const messages = Array.from({ length: 140 }, (_, index) => ({
|
|
2739
|
+
role: index % 2 === 0 ? "user" : "assistant",
|
|
2740
|
+
content: `filler turn ${index}`,
|
|
2741
|
+
}));
|
|
2742
|
+
for (let index = 0; index < 3; index += 1) {
|
|
2743
|
+
const turnIndex = index * 2;
|
|
2744
|
+
const longQuote = "quoted detail ".repeat(250);
|
|
2745
|
+
messages[turnIndex] = {
|
|
2746
|
+
role: "user",
|
|
2747
|
+
content: `[Action 47]: early quote pair ${index} ${longQuote}`,
|
|
2748
|
+
};
|
|
2749
|
+
messages[turnIndex + 1] = {
|
|
2750
|
+
role: "assistant",
|
|
2751
|
+
content: `[Observation 47]: early quote pair ${index} ${longQuote}`,
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
messages[93] = { role: "assistant", content: "[Observation 46] true prior" };
|
|
2755
|
+
messages[94] = { role: "user", content: "[Action 47] true legacy move" };
|
|
2756
|
+
messages[95] = { role: "assistant", content: "[Observation 47] true legacy state" };
|
|
2757
|
+
const engine = new FakeCueEngine({ "bench-session": messages });
|
|
2758
|
+
|
|
2759
|
+
const section = await buildExplicitCueRecallSection({
|
|
2760
|
+
engine,
|
|
2761
|
+
sessionId: "bench-session",
|
|
2762
|
+
query: "What happened in step 47?",
|
|
2763
|
+
maxChars: 3000,
|
|
2764
|
+
});
|
|
2765
|
+
|
|
2766
|
+
assert.match(section, /true legacy move/);
|
|
2767
|
+
assert.match(section, /true legacy state/);
|
|
2768
|
+
assert.doesNotMatch(section, /early quote pair/);
|
|
2769
|
+
});
|
|
2770
|
+
|
|
2771
|
+
test("buildExplicitCueRecallSection expands direct turn references", async () => {
|
|
2772
|
+
const engine = new FakeCueEngine({
|
|
2773
|
+
"bench-session": [
|
|
2774
|
+
{ role: "user", content: "turn zero" },
|
|
2775
|
+
{ role: "assistant", content: "turn one" },
|
|
2776
|
+
{ role: "user", content: "turn two" },
|
|
2777
|
+
{ role: "assistant", content: "turn three target answer" },
|
|
2778
|
+
],
|
|
2779
|
+
});
|
|
2780
|
+
|
|
2781
|
+
const section = await buildExplicitCueRecallSection({
|
|
2782
|
+
engine,
|
|
2783
|
+
sessionId: "bench-session",
|
|
2784
|
+
query: "What was said at Turn 3?",
|
|
2785
|
+
maxChars: 2000,
|
|
2786
|
+
});
|
|
2787
|
+
|
|
2788
|
+
assert.match(section, /turn three target answer/);
|
|
2789
|
+
});
|
|
2790
|
+
|
|
2791
|
+
test("buildExplicitCueRecallSection does not bound sparse turn indexes by message count", async () => {
|
|
2792
|
+
const engine = new FakeCueEngine({
|
|
2793
|
+
"bench-session": [
|
|
2794
|
+
{
|
|
2795
|
+
turnIndex: 450,
|
|
2796
|
+
role: "assistant",
|
|
2797
|
+
content: "sparse retained turn target answer",
|
|
2798
|
+
},
|
|
2799
|
+
],
|
|
2800
|
+
});
|
|
2801
|
+
|
|
2802
|
+
const section = await buildExplicitCueRecallSection({
|
|
2803
|
+
engine,
|
|
2804
|
+
sessionId: "bench-session",
|
|
2805
|
+
query: "What happened at Turn 450?",
|
|
2806
|
+
maxChars: 2000,
|
|
2807
|
+
});
|
|
2808
|
+
|
|
2809
|
+
assert.match(section, /sparse retained turn target answer/);
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
test("buildExplicitCueRecallSection searches lexical cues across sessions when no session is bound", async () => {
|
|
2813
|
+
const engine = new FakeCueEngine({
|
|
2814
|
+
first: [{ role: "user", content: "ordinary context" }],
|
|
2815
|
+
second: [{ role: "assistant", content: "[D1:1] Maya moved to Seattle" }],
|
|
2816
|
+
});
|
|
2817
|
+
|
|
2818
|
+
const section = await buildExplicitCueRecallSection({
|
|
2819
|
+
engine,
|
|
2820
|
+
query: "What did D1:1 establish?",
|
|
2821
|
+
maxChars: 2000,
|
|
2822
|
+
});
|
|
2823
|
+
|
|
2824
|
+
assert.match(section, /Maya moved to Seattle/);
|
|
2825
|
+
});
|
|
2826
|
+
|
|
2827
|
+
test("buildExplicitCueRecallSection searches query-visible speaker names", async () => {
|
|
2828
|
+
const engine = new FakeCueEngine({
|
|
2829
|
+
locomo: [
|
|
2830
|
+
{ role: "user", content: "[D1:1] Maya Chen: I moved to Austin in 2022." },
|
|
2831
|
+
{ role: "assistant", content: "[D1:2] Jordan: The jacket was blue." },
|
|
2832
|
+
],
|
|
2833
|
+
});
|
|
2834
|
+
|
|
2835
|
+
const section = await buildExplicitCueRecallSection({
|
|
2836
|
+
engine,
|
|
2837
|
+
query: "When did Maya Chen move?",
|
|
2838
|
+
maxChars: 2000,
|
|
2839
|
+
});
|
|
2840
|
+
|
|
2841
|
+
assert.match(section, /Maya Chen/);
|
|
2842
|
+
assert.match(section, /2022/);
|
|
2843
|
+
});
|
|
2844
|
+
|
|
2845
|
+
test("buildExplicitCueRecallSection searches explicit temporal cues", async () => {
|
|
2846
|
+
const engine = new FakeCueEngine({
|
|
2847
|
+
old: [{ role: "user", content: "[date: 2025-01-01] allergy: pollen" }],
|
|
2848
|
+
latest: [
|
|
2849
|
+
{
|
|
2850
|
+
role: "user",
|
|
2851
|
+
content: "[date: 2025-02-01] latest allergy update: shellfish",
|
|
2852
|
+
},
|
|
2853
|
+
],
|
|
2854
|
+
});
|
|
2855
|
+
|
|
2856
|
+
const section = await buildExplicitCueRecallSection({
|
|
2857
|
+
engine,
|
|
2858
|
+
query: "As of 2025-02-01, what was the latest allergy update?",
|
|
2859
|
+
maxChars: 2000,
|
|
2860
|
+
});
|
|
2861
|
+
|
|
2862
|
+
assert.match(section, /2025-02-01/);
|
|
2863
|
+
assert.match(section, /shellfish/);
|
|
2864
|
+
});
|
|
2865
|
+
|
|
2866
|
+
test("buildExplicitCueRecallSection prioritizes latest state updates for current questions", async () => {
|
|
2867
|
+
const engine = new FakeCueEngine({
|
|
2868
|
+
amemgym: [
|
|
2869
|
+
{ role: "user", content: "[User state update]: city: Austin" },
|
|
2870
|
+
{ role: "user", content: "I am packing boxes this week." },
|
|
2871
|
+
{ role: "user", content: "[User state update]: city: Denver" },
|
|
2872
|
+
],
|
|
2873
|
+
});
|
|
2874
|
+
|
|
2875
|
+
const section = await buildExplicitCueRecallSection({
|
|
2876
|
+
engine,
|
|
2877
|
+
sessionId: "amemgym",
|
|
2878
|
+
query: "What city does the user live in now?",
|
|
2879
|
+
maxChars: 2000,
|
|
2880
|
+
});
|
|
2881
|
+
|
|
2882
|
+
assert.match(section, /city: Denver/);
|
|
2883
|
+
assert.match(section, /city: Austin/);
|
|
2884
|
+
assert.ok(
|
|
2885
|
+
section.indexOf("city: Denver") < section.indexOf("city: Austin"),
|
|
2886
|
+
"latest matching state should appear before superseded history",
|
|
2887
|
+
);
|
|
2888
|
+
});
|
|
2889
|
+
|
|
2890
|
+
test("buildExplicitCueRecallSection prioritizes latest count updates for how-many questions", async () => {
|
|
2891
|
+
const engine = new FakeCueEngine({
|
|
2892
|
+
beam: [
|
|
2893
|
+
{ role: "user", content: "The main branch has 150 commits merged." },
|
|
2894
|
+
{ role: "assistant", content: "Review the old repository workflow." },
|
|
2895
|
+
{ role: "user", content: "The main branch has now reached 165 commits." },
|
|
2896
|
+
],
|
|
2897
|
+
});
|
|
2898
|
+
|
|
2899
|
+
const section = await buildExplicitCueRecallSection({
|
|
2900
|
+
engine,
|
|
2901
|
+
sessionId: "beam",
|
|
2902
|
+
query: "How many commits have been merged into the main branch?",
|
|
2903
|
+
maxChars: 2000,
|
|
2904
|
+
includeContentLexicalCues: true,
|
|
2905
|
+
});
|
|
2906
|
+
|
|
2907
|
+
assert.match(section, /165 commits/);
|
|
2908
|
+
assert.match(section, /150 commits/);
|
|
2909
|
+
assert.ok(
|
|
2910
|
+
section.indexOf("165 commits") < section.indexOf("150 commits"),
|
|
2911
|
+
"later count updates should appear before stale matching counts",
|
|
2912
|
+
);
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
test("buildExplicitCueRecallSection keeps enumeration queries in historical order", async () => {
|
|
2916
|
+
const engine = new FakeCueEngine({
|
|
2917
|
+
beam: [
|
|
2918
|
+
{ role: "user", content: "I need admin user roles and baseline authentication." },
|
|
2919
|
+
{ role: "user", content: "I also need editor user roles and security audit features." },
|
|
2920
|
+
],
|
|
2921
|
+
});
|
|
2922
|
+
|
|
2923
|
+
const section = await buildExplicitCueRecallSection({
|
|
2924
|
+
engine,
|
|
2925
|
+
sessionId: "beam",
|
|
2926
|
+
query: "How many different user roles and security features am I trying to implement?",
|
|
2927
|
+
maxChars: 2000,
|
|
2928
|
+
includeContentLexicalCues: true,
|
|
2929
|
+
});
|
|
2930
|
+
|
|
2931
|
+
assert.match(section, /admin user roles/);
|
|
2932
|
+
assert.match(section, /editor user roles/);
|
|
2933
|
+
assert.ok(
|
|
2934
|
+
section.indexOf("admin user roles") < section.indexOf("editor user roles"),
|
|
2935
|
+
"enumeration queries should keep historical evidence order instead of latest-only ordering",
|
|
2936
|
+
);
|
|
2937
|
+
});
|
|
2938
|
+
|
|
2939
|
+
test("buildExplicitCueRecallSection searches structured plan field cues", async () => {
|
|
2940
|
+
const engine = new FakeCueEngine({
|
|
2941
|
+
arena: [
|
|
2942
|
+
{
|
|
2943
|
+
role: "assistant",
|
|
2944
|
+
content: [
|
|
2945
|
+
"MemoryArena structured plan field anchors:",
|
|
2946
|
+
"Day 1 dinner: Coco Bambu, Dallas",
|
|
2947
|
+
"Day 1 accommodation: Central Stay, Dallas",
|
|
2948
|
+
].join("\n"),
|
|
2949
|
+
},
|
|
2950
|
+
],
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
const section = await buildExplicitCueRecallSection({
|
|
2954
|
+
engine,
|
|
2955
|
+
sessionId: "arena",
|
|
2956
|
+
query: "Join Jennifer for the same dinner and accommodation.",
|
|
2957
|
+
maxChars: 2000,
|
|
2958
|
+
includeStructuredPlanCues: true,
|
|
2959
|
+
});
|
|
2960
|
+
|
|
2961
|
+
assert.match(section, /Coco Bambu, Dallas/);
|
|
2962
|
+
assert.match(section, /Central Stay, Dallas/);
|
|
2963
|
+
});
|
|
2964
|
+
|
|
2965
|
+
test("buildExplicitCueRecallSection stays silent when disabled by budget or no cues", async () => {
|
|
2966
|
+
const engine = new FakeCueEngine({
|
|
2967
|
+
s1: [{ role: "user", content: "[D1:1] visible" }],
|
|
2968
|
+
});
|
|
2969
|
+
|
|
2970
|
+
assert.equal(
|
|
2971
|
+
await buildExplicitCueRecallSection({
|
|
2972
|
+
engine,
|
|
2973
|
+
sessionId: "s1",
|
|
2974
|
+
query: "What should I do next?",
|
|
2975
|
+
maxChars: 2000,
|
|
2976
|
+
}),
|
|
2977
|
+
"",
|
|
2978
|
+
);
|
|
2979
|
+
assert.equal(
|
|
2980
|
+
await buildExplicitCueRecallSection({
|
|
2981
|
+
engine,
|
|
2982
|
+
sessionId: "s1",
|
|
2983
|
+
query: "What does D1:1 say?",
|
|
2984
|
+
maxChars: 0,
|
|
2985
|
+
}),
|
|
2986
|
+
"",
|
|
2987
|
+
);
|
|
2988
|
+
assert.equal(
|
|
2989
|
+
await buildExplicitCueRecallSection({
|
|
2990
|
+
engine,
|
|
2991
|
+
sessionId: "s1",
|
|
2992
|
+
query: "What does D1:1 say?",
|
|
2993
|
+
maxChars: 2000,
|
|
2994
|
+
maxReferences: 0,
|
|
2995
|
+
}),
|
|
2996
|
+
"",
|
|
2997
|
+
);
|
|
2998
|
+
});
|
|
2999
|
+
|
|
3000
|
+
function normalizeForSearch(value: string): string {
|
|
3001
|
+
return value.toLowerCase().replace(/[^a-z0-9:_-]+/g, " ").trim();
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
function makeTrajectoryMessages(
|
|
3005
|
+
steps: Array<[number, string, string]>,
|
|
3006
|
+
): Message[] {
|
|
3007
|
+
const messages: Message[] = [];
|
|
3008
|
+
for (const [step, action, observation] of steps) {
|
|
3009
|
+
messages.push({
|
|
3010
|
+
role: "user",
|
|
3011
|
+
content: `[Action ${step}]: ${action}`,
|
|
3012
|
+
});
|
|
3013
|
+
messages.push({
|
|
3014
|
+
role: "assistant",
|
|
3015
|
+
content: `[Observation ${step}]: ${observation}`,
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
return messages;
|
|
3019
|
+
}
|