agentic-qe 3.8.13 → 3.9.0
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/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +48 -0
- package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
- package/dist/audit/witness-chain.js +15 -3
- package/dist/boot/fast-paths.d.ts +24 -0
- package/dist/boot/fast-paths.js +43 -0
- package/dist/boot/parallel-prefetch.d.ts +26 -0
- package/dist/boot/parallel-prefetch.js +36 -0
- package/dist/cli/bundle.js +12 -9431
- package/dist/cli/chunks/adapter-WBR5NXS3.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-PQYB7VRU.js +2 -0
- package/dist/cli/chunks/agent-handler-QDAB5NQS.js +33 -0
- package/dist/cli/chunks/aqe-learning-engine-TK4JQCGT.js +2 -0
- package/dist/cli/chunks/audit-S7JUYYVP.js +3 -0
- package/dist/cli/chunks/base-2WXOSMBQ.js +2 -0
- package/dist/cli/chunks/better-sqlite3-7KY2RDXO.js +2 -0
- package/dist/cli/chunks/brain-handler-PPEGDCN4.js +68 -0
- package/dist/cli/chunks/branch-enumerator-XK4V5W7L.js +7 -0
- package/dist/cli/chunks/browser-PALA5PL3.js +4 -0
- package/dist/cli/chunks/browser-workflow-42F7GK5T.js +2 -0
- package/dist/cli/chunks/chunk-24FKIJNC.js +15 -0
- package/dist/cli/chunks/chunk-263XS447.js +2 -0
- package/dist/cli/chunks/chunk-2BZFNEN2.js +4 -0
- package/dist/cli/chunks/chunk-2E5NQNSU.js +180 -0
- package/dist/cli/chunks/chunk-2I7J3O6V.js +2 -0
- package/dist/cli/chunks/chunk-3ADGXLTM.js +14 -0
- package/dist/cli/chunks/chunk-3IHG3WOY.js +12 -0
- package/dist/cli/chunks/chunk-3IUNFTIF.js +2 -0
- package/dist/cli/chunks/chunk-3JPRUND5.js +2 -0
- package/dist/cli/chunks/chunk-3NZLZHJI.js +2 -0
- package/dist/cli/chunks/chunk-3THRQEZ2.js +95 -0
- package/dist/cli/chunks/chunk-3ZOONQG6.js +2 -0
- package/dist/cli/chunks/chunk-4B6NCELM.js +2 -0
- package/dist/cli/chunks/chunk-4I2IOUS4.js +2 -0
- package/dist/cli/chunks/chunk-4VBTXZRM.js +2 -0
- package/dist/cli/chunks/chunk-4VUPRTVX.js +3 -0
- package/dist/cli/chunks/chunk-4YOMLWEK.js +70 -0
- package/dist/cli/chunks/chunk-4YS3IJ45.js +2 -0
- package/dist/cli/chunks/chunk-5SKGFSKD.js +2 -0
- package/dist/cli/chunks/chunk-5T2ZQWKF.js +27 -0
- package/dist/cli/chunks/chunk-62ADTHV7.js +2 -0
- package/dist/cli/chunks/chunk-6EOS7KX2.js +2 -0
- package/dist/cli/chunks/chunk-6SVX4DJC.js +6 -0
- package/dist/cli/chunks/chunk-72WOAVK6.js +2 -0
- package/dist/cli/chunks/chunk-7R6YMLVS.js +3 -0
- package/dist/cli/chunks/chunk-7VDBAVTY.js +2 -0
- package/dist/cli/chunks/chunk-AFLLQ5PP.js +15 -0
- package/dist/cli/chunks/chunk-AKE543X2.js +2 -0
- package/dist/cli/chunks/chunk-B36CDR4U.js +2 -0
- package/dist/cli/chunks/chunk-B6LLWYQ6.js +2 -0
- package/dist/cli/chunks/chunk-BDIEMZ22.js +91 -0
- package/dist/cli/chunks/chunk-BGXNSCXX.js +4 -0
- package/dist/cli/chunks/chunk-BLBRY5UD.js +2 -0
- package/dist/cli/chunks/chunk-BPWXXEH2.js +3029 -0
- package/dist/cli/chunks/chunk-BR26T7ZS.js +180 -0
- package/dist/cli/chunks/chunk-BTREG4IW.js +2 -0
- package/dist/cli/chunks/chunk-BULKFVYX.js +2 -0
- package/dist/cli/chunks/chunk-BXAXGEFC.js +24 -0
- package/dist/cli/chunks/chunk-CL6POIX4.js +2 -0
- package/dist/cli/chunks/chunk-CS2KS7LP.js +2 -0
- package/dist/cli/chunks/chunk-CWFB6BSA.js +316 -0
- package/dist/cli/chunks/chunk-DRT3WKQW.js +2 -0
- package/dist/cli/chunks/chunk-EHDQJQ6Y.js +27 -0
- package/dist/cli/chunks/chunk-ESVQ6MEB.js +2 -0
- package/dist/cli/chunks/chunk-FEKY7T6Q.js +2 -0
- package/dist/cli/chunks/chunk-FGA7VIFR.js +7 -0
- package/dist/cli/chunks/chunk-FIA6X7UL.js +2 -0
- package/dist/cli/chunks/chunk-GAOJV3OX.js +2 -0
- package/dist/cli/chunks/chunk-GKNNSCLC.js +5 -0
- package/dist/cli/chunks/chunk-GPQ57KA4.js +2 -0
- package/dist/cli/chunks/chunk-GRUUQAR6.js +2 -0
- package/dist/cli/chunks/chunk-HRO6OZQD.js +2 -0
- package/dist/cli/chunks/chunk-HY6PMO5W.js +66 -0
- package/dist/cli/chunks/chunk-IAV2JMIX.js +167 -0
- package/dist/cli/chunks/chunk-IFNIIK34.js +21 -0
- package/dist/cli/chunks/chunk-IGJPMN4I.js +3 -0
- package/dist/cli/chunks/chunk-J3KWWR6Z.js +1 -0
- package/dist/cli/chunks/chunk-JBANAPWG.js +2 -0
- package/dist/cli/chunks/chunk-JJO7Y4H3.js +604 -0
- package/dist/cli/chunks/chunk-JRYGQO2W.js +2 -0
- package/dist/cli/chunks/chunk-JXM26HEE.js +2 -0
- package/dist/cli/chunks/chunk-JZSDOIXA.js +2 -0
- package/dist/cli/chunks/chunk-KP5NUODU.js +3 -0
- package/dist/cli/chunks/chunk-LHJQD2VU.js +750 -0
- package/dist/cli/chunks/chunk-LNQIY6BP.js +2 -0
- package/dist/cli/chunks/chunk-MDUHYUHF.js +2 -0
- package/dist/cli/chunks/chunk-MV6CMOJQ.js +65 -0
- package/dist/cli/chunks/chunk-MZOFWJTM.js +2 -0
- package/dist/cli/chunks/chunk-N2NS2PHA.js +45 -0
- package/dist/cli/chunks/chunk-N4TL73TH.js +314 -0
- package/dist/cli/chunks/chunk-N5UXCLFI.js +2 -0
- package/dist/cli/chunks/chunk-NZ2VCPN4.js +2 -0
- package/dist/cli/chunks/chunk-OF4D7MYI.js +2 -0
- package/dist/cli/chunks/chunk-OI5NGQO2.js +2 -0
- package/dist/cli/chunks/chunk-OLHKGP35.js +2 -0
- package/dist/cli/chunks/chunk-QOVHWZEP.js +1 -0
- package/dist/cli/chunks/chunk-RFSN6IDA.js +79 -0
- package/dist/cli/chunks/chunk-RTGGL7D7.js +4 -0
- package/dist/cli/chunks/chunk-RU5WAHB7.js +3 -0
- package/dist/cli/chunks/chunk-SUSEVMZT.js +2 -0
- package/dist/cli/chunks/chunk-TLHP5EII.js +2 -0
- package/dist/cli/chunks/chunk-TWUWL5EJ.js +2 -0
- package/dist/cli/chunks/chunk-U5RN7YQW.js +2 -0
- package/dist/cli/chunks/chunk-UFUVUO3J.js +2 -0
- package/dist/cli/chunks/chunk-UQHYFOBX.js +16 -0
- package/dist/cli/chunks/chunk-VOS4NQSF.js +2 -0
- package/dist/cli/chunks/chunk-VSVXUTJN.js +256 -0
- package/dist/cli/chunks/chunk-WBQSXPBI.js +2 -0
- package/dist/cli/chunks/chunk-WGMPEW2T.js +2 -0
- package/dist/cli/chunks/chunk-WIEC7VKK.js +2 -0
- package/dist/cli/chunks/chunk-WJ3DLOXF.js +14 -0
- package/dist/cli/chunks/chunk-X3KI6JOY.js +9 -0
- package/dist/cli/chunks/chunk-X5IJGWYG.js +2 -0
- package/dist/cli/chunks/chunk-XIBDETCS.js +146 -0
- package/dist/cli/chunks/chunk-XLRQYLWW.js +2 -0
- package/dist/cli/chunks/chunk-XO6PVK2P.js +3 -0
- package/dist/cli/chunks/chunk-XRE2HCWG.js +3 -0
- package/dist/cli/chunks/chunk-XT2V2322.js +2 -0
- package/dist/cli/chunks/chunk-Y7BHKZFJ.js +18 -0
- package/dist/cli/chunks/chunk-YAGODYIG.js +59 -0
- package/dist/cli/chunks/chunk-YANUP2RO.js +2 -0
- package/dist/cli/chunks/chunk-YPFOCNOE.js +30 -0
- package/dist/cli/chunks/chunk-YR6ZZGH7.js +81 -0
- package/dist/cli/chunks/chunk-YVA65UZL.js +2 -0
- package/dist/cli/chunks/chunk-YW2THB5Q.js +2 -0
- package/dist/cli/chunks/chunk-ZAPS3UGQ.js +20 -0
- package/dist/cli/chunks/chunk-ZDATDCYN.js +2 -0
- package/dist/cli/chunks/ci-J374KDLI.js +81 -0
- package/dist/cli/chunks/ci-output-7JN7F6CI.js +2 -0
- package/dist/cli/chunks/claude-flow-setup-245JLJCN.js +2 -0
- package/dist/cli/chunks/client-MCSNSH2C.js +2 -0
- package/dist/cli/chunks/cline-installer-LBA2M5N3.js +4 -0
- package/dist/cli/chunks/code-U4N4WONM.js +38 -0
- package/dist/cli/chunks/code-index-extractor-A57Z6BO4.js +3 -0
- package/dist/cli/chunks/codex-installer-UXMK2N4T.js +8 -0
- package/dist/cli/chunks/completions-W66BSCOE.js +1364 -0
- package/dist/cli/chunks/complexity-analyzer-AB4OZARV.js +2 -0
- package/dist/cli/chunks/continuedev-installer-LRFZ2SJM.js +14 -0
- package/dist/cli/chunks/copilot-installer-CQ3JYBIB.js +3 -0
- package/dist/cli/chunks/cost-tracker-4F723RB6.js +2 -0
- package/dist/cli/chunks/coverage-4PUEQXAY.js +27 -0
- package/dist/cli/chunks/cross-domain-router-OWR5IJ5G.js +2 -0
- package/dist/cli/chunks/cursor-installer-JZEDEDHA.js +3 -0
- package/dist/cli/chunks/daemon-B7TWGHXQ.js +19 -0
- package/dist/cli/chunks/dag-attention-scheduler-JWO6XI6A.js +2 -0
- package/dist/cli/chunks/detect-L6ZZHUSX.js +2 -0
- package/dist/cli/chunks/domain-handler-FT5FLZWL.js +25 -0
- package/dist/cli/chunks/domain-transfer-5Y4FGJAJ.js +2 -0
- package/dist/cli/chunks/dream-4TDBIYED.js +2 -0
- package/dist/cli/chunks/esm-node-2PKHKOTS.js +2 -0
- package/dist/cli/chunks/eval-GHMPFGWV.js +15 -0
- package/dist/cli/chunks/fast-paths-B3R647KN.js +2 -0
- package/dist/cli/chunks/feature-flags-DWS7ARSX.js +2 -0
- package/dist/cli/chunks/feature-flags-IVQ3AL4Q.js +2 -0
- package/dist/cli/chunks/file-discovery-QFPA6GMV.js +2 -0
- package/dist/cli/chunks/fleet-EKOKMOMW.js +43 -0
- package/dist/cli/chunks/gnn-wrapper-OYC55N5E.js +2 -0
- package/dist/cli/chunks/heartbeat-handler-MBBS4IBU.js +48 -0
- package/dist/cli/chunks/heartbeat-scheduler-XDGMOT7X.js +2 -0
- package/dist/cli/chunks/hnsw-index-YO7CT23I.js +2 -0
- package/dist/cli/chunks/hnswlib-node-56YWVXFE.js +2 -0
- package/dist/cli/chunks/hooks-L5VLZGEK.js +101 -0
- package/dist/cli/chunks/hypergraph-engine-A4Y2ZRAG.js +2 -0
- package/dist/cli/chunks/hypergraph-handler-3HDGB5SZ.js +35 -0
- package/dist/cli/chunks/impact-analyzer-UEIGXSZ4.js +2 -0
- package/dist/cli/chunks/init-handler-JDET6WUN.js +68 -0
- package/dist/cli/chunks/init-wizard-JWZUGIPJ.js +2 -0
- package/dist/cli/chunks/kernel-YNDTVKIW.js +2 -0
- package/dist/cli/chunks/kilocode-installer-GZZG5AFW.js +4 -0
- package/dist/cli/chunks/kiro-installer-IWNY5TKH.js +74 -0
- package/dist/cli/chunks/knowledge-graph-NGJKFTSN.js +2 -0
- package/dist/cli/chunks/learning-722ZNSZ6.js +107 -0
- package/dist/cli/chunks/llm-router-DNAV746L.js +30 -0
- package/dist/cli/chunks/load-Y3GCUFM4.js +2 -0
- package/dist/cli/chunks/load-test-GZUBXFF3.js +2 -0
- package/dist/cli/chunks/mcp-LKPIBZ3W.js +2 -0
- package/dist/cli/chunks/memory-L57MLFOP.js +32 -0
- package/dist/cli/chunks/memory-backend-3NQIZUXE.js +2 -0
- package/dist/cli/chunks/memory-handlers-MDZQ7HVW.js +2 -0
- package/dist/cli/chunks/opencode-installer-4HUB36H5.js +3 -0
- package/dist/cli/chunks/orchestrator-QHSBB2UC.js +371 -0
- package/dist/cli/chunks/pipeline-D3QER35Z.js +19 -0
- package/dist/cli/chunks/platform-T4E7Q3RD.js +2 -0
- package/dist/cli/chunks/plugin-JHW2YPRC.js +27 -0
- package/dist/cli/chunks/prime-radiant-advanced-wasm-G7CFNNQV.js +2 -0
- package/dist/cli/chunks/protocol-executor-SPUVRDWT.js +2 -0
- package/dist/cli/chunks/protocol-handler-2BQQ4HDM.js +20 -0
- package/dist/cli/chunks/prove-UQ6JFT73.js +3 -0
- package/dist/cli/chunks/qe-reasoning-bank-3HBK2FVD.js +2 -0
- package/dist/cli/chunks/quality-JRZYMC77.js +7 -0
- package/dist/cli/chunks/queen-coordinator-RW3NKO5A.js +2 -0
- package/dist/cli/chunks/real-embeddings-GK63VF35.js +2 -0
- package/dist/cli/chunks/roocode-installer-F4E2LAYR.js +4 -0
- package/dist/cli/chunks/router-RJGHWDQ3.js +2 -0
- package/dist/cli/chunks/routing-feedback-ZXBXFKX6.js +2 -0
- package/dist/cli/chunks/routing-handler-VNKFUUGB.js +20 -0
- package/dist/cli/chunks/ruvector-commands-2TLNHC3A.js +8 -0
- package/dist/cli/chunks/rvf-dual-writer-MQW2SJLT.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-LKFKTMUN.js +2 -0
- package/dist/cli/chunks/safe-db-G22E5ROA.js +2 -0
- package/dist/cli/chunks/schedule-Y7VVCPYV.js +2 -0
- package/dist/cli/chunks/scheduler-AUQIFQB7.js +2 -0
- package/dist/cli/chunks/security-EBEG2OPU.js +14 -0
- package/dist/cli/chunks/shared-rvf-dual-writer-BVSCQAFS.js +2 -0
- package/dist/cli/chunks/sqlite-persistence-JAVHUGGL.js +2 -0
- package/dist/cli/chunks/status-handler-VZ32M4G4.js +45 -0
- package/dist/cli/chunks/structural-health-K6LRCKV6.js +2 -0
- package/dist/cli/chunks/sync-MHSHNLIM.js +23 -0
- package/dist/cli/chunks/task-handler-JNOIBZ2G.js +49 -0
- package/dist/cli/chunks/task-handlers-P5DSUKND.js +2 -0
- package/dist/cli/chunks/test-DO22BNIL.js +33 -0
- package/dist/cli/chunks/test-scheduling-VLRQZEFL.js +15 -0
- package/dist/cli/chunks/token-bootstrap-4VJKGVMK.js +2 -0
- package/dist/cli/chunks/token-usage-LG3PXRXH.js +25 -0
- package/dist/cli/chunks/transformers-GY7SIKEU.js +2 -0
- package/dist/cli/chunks/tree-sitter-wasm-parser-FT2KB66N.js +2 -0
- package/dist/cli/chunks/types-QJGNBKP2.js +2 -0
- package/dist/cli/chunks/unified-memory-XYGENQUT.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-MVEGQBF3.js +2 -0
- package/dist/cli/chunks/unified-persistence-PFRCWEUG.js +2 -0
- package/dist/cli/chunks/validate-VQCRSVNQ.js +21 -0
- package/dist/cli/chunks/validate-swarm-A5DHAWTP.js +14 -0
- package/dist/cli/chunks/vibium-RZBSL4EB.js +2 -0
- package/dist/cli/chunks/visual-security-V47BLGJM.js +2 -0
- package/dist/cli/chunks/web-tree-sitter-7C4NXEOF.js +2 -0
- package/dist/cli/chunks/windsurf-installer-ES3KPQG3.js +7 -0
- package/dist/cli/chunks/witness-chain-BR63P4A7.js +2 -0
- package/dist/cli/chunks/workflow-JETHX4ML.js +51 -0
- package/dist/cli/chunks/workflow-orchestrator-7PZMX3JZ.js +2 -0
- package/dist/cli/chunks/wrappers-WP5RH745.js +2 -0
- package/dist/cli/commands/daemon.d.ts +13 -0
- package/dist/cli/commands/daemon.js +224 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
- package/dist/cli/commands/plugin.d.ts +12 -0
- package/dist/cli/commands/plugin.js +135 -0
- package/dist/cli/commands/workflow.d.ts +10 -0
- package/dist/cli/commands/workflow.js +587 -0
- package/dist/cli/handlers/brain-handler.js +13 -8
- package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
- package/dist/cli/handlers/heartbeat-handler.js +20 -10
- package/dist/cli/handlers/hypergraph-handler.js +3 -3
- package/dist/cli/handlers/init-handler.js +10 -9
- package/dist/cli/handlers/interfaces.d.ts +4 -4
- package/dist/cli/index.js +159 -638
- package/dist/cli/lazy-registry.d.ts +27 -0
- package/dist/cli/lazy-registry.js +70 -0
- package/dist/context/compaction/context-budget.d.ts +71 -0
- package/dist/context/compaction/context-budget.js +120 -0
- package/dist/context/compaction/index.d.ts +96 -0
- package/dist/context/compaction/index.js +259 -0
- package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
- package/dist/context/compaction/llm-caller-adapter.js +47 -0
- package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
- package/dist/context/compaction/tier1-microcompact.js +47 -0
- package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
- package/dist/context/compaction/tier2-session-summary.js +172 -0
- package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
- package/dist/context/compaction/tier3-llm-compact.js +166 -0
- package/dist/context/compaction/tier4-reactive.d.ts +54 -0
- package/dist/context/compaction/tier4-reactive.js +129 -0
- package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
- package/dist/coordination/consensus/providers/claude-provider.js +23 -3
- package/dist/domains/test-generation/generators/base-test-generator.d.ts +1 -1
- package/dist/domains/test-generation/generators/base-test-generator.js +11 -11
- package/dist/domains/test-generation/generators/go-test-generator.js +12 -12
- package/dist/domains/test-generation/generators/junit5-generator.js +9 -9
- package/dist/domains/test-generation/generators/kotlin-junit-generator.js +10 -10
- package/dist/domains/test-generation/generators/pytest-generator.js +8 -8
- package/dist/domains/test-generation/generators/swift-testing-generator.js +8 -8
- package/dist/domains/test-generation/generators/test-value-helpers.d.ts +20 -0
- package/dist/domains/test-generation/generators/test-value-helpers.js +48 -0
- package/dist/domains/test-generation/generators/xunit-generator.js +11 -11
- package/dist/hooks/cross-phase-hooks.d.ts +11 -0
- package/dist/hooks/cross-phase-hooks.js +73 -9
- package/dist/hooks/security/config-snapshot.d.ts +21 -0
- package/dist/hooks/security/config-snapshot.js +33 -0
- package/dist/hooks/security/exit-codes.d.ts +28 -0
- package/dist/hooks/security/exit-codes.js +33 -0
- package/dist/hooks/security/index.d.ts +15 -0
- package/dist/hooks/security/index.js +15 -0
- package/dist/hooks/security/ssrf-guard.d.ts +25 -0
- package/dist/hooks/security/ssrf-guard.js +69 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/init/init-wizard-hooks.js +15 -1
- package/dist/init/phases/07-hooks.js +2 -2
- package/dist/init/settings-merge.js +3 -7
- package/dist/kernel/kernel.js +35 -0
- package/dist/kernel/memory-backend.js +3 -1
- package/dist/mcp/bundle.js +416 -362
- package/dist/mcp/entry.js +132 -77
- package/dist/mcp/http-server.js +4 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/middleware/batch-executor.d.ts +46 -0
- package/dist/mcp/middleware/batch-executor.js +150 -0
- package/dist/mcp/middleware/microcompact.d.ts +97 -0
- package/dist/mcp/middleware/microcompact.js +179 -0
- package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
- package/dist/mcp/middleware/middleware-chain.js +60 -0
- package/dist/mcp/protocol-server.d.ts +16 -0
- package/dist/mcp/protocol-server.js +140 -36
- package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
- package/dist/mcp/services/session-durability-middleware.js +64 -0
- package/dist/mcp/services/session-resume.d.ts +29 -0
- package/dist/mcp/services/session-resume.js +221 -0
- package/dist/mcp/services/session-store.d.ts +84 -0
- package/dist/mcp/services/session-store.js +163 -0
- package/dist/mcp/tool-registry.d.ts +9 -0
- package/dist/mcp/tool-registry.js +30 -1
- package/dist/mcp/types.d.ts +1 -0
- package/dist/plugins/cache.d.ts +44 -0
- package/dist/plugins/cache.js +149 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +15 -0
- package/dist/plugins/lifecycle.d.ts +67 -0
- package/dist/plugins/lifecycle.js +175 -0
- package/dist/plugins/manifest.d.ts +45 -0
- package/dist/plugins/manifest.js +173 -0
- package/dist/plugins/resolver.d.ts +37 -0
- package/dist/plugins/resolver.js +80 -0
- package/dist/plugins/security.d.ts +23 -0
- package/dist/plugins/security.js +125 -0
- package/dist/plugins/sources/github.d.ts +17 -0
- package/dist/plugins/sources/github.js +77 -0
- package/dist/plugins/sources/local.d.ts +20 -0
- package/dist/plugins/sources/local.js +32 -0
- package/dist/plugins/sources/npm.d.ts +18 -0
- package/dist/plugins/sources/npm.js +82 -0
- package/dist/shared/llm/retry.d.ts +5 -2
- package/dist/shared/llm/retry.js +7 -3
- package/dist/shared/prompt-cache-latch.d.ts +41 -0
- package/dist/shared/prompt-cache-latch.js +63 -0
- package/dist/shared/retry-engine.d.ts +77 -0
- package/dist/shared/retry-engine.js +194 -0
- package/dist/workers/daemon.d.ts +8 -0
- package/dist/workers/daemon.js +13 -0
- package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
- package/dist/workers/quality-daemon/ci-monitor.js +147 -0
- package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
- package/dist/workers/quality-daemon/coverage-delta.js +135 -0
- package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
- package/dist/workers/quality-daemon/git-watcher.js +209 -0
- package/dist/workers/quality-daemon/index.d.ts +119 -0
- package/dist/workers/quality-daemon/index.js +343 -0
- package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
- package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
- package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
- package/dist/workers/quality-daemon/notification-service.js +178 -0
- package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
- package/dist/workers/quality-daemon/persistent-memory.js +30 -0
- package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
- package/dist/workers/quality-daemon/priority-queue.js +126 -0
- package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
- package/dist/workers/quality-daemon/test-suggester.js +121 -0
- package/dist/workers/worker-manager.js +2 -1
- package/package.json +1 -1
- package/dist/mcp/server.d.ts +0 -46
- package/dist/mcp/server.js +0 -802
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - LLM Caller Adapter for Tier 3 Compaction (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Lightweight adapter that creates an LLMCompactCaller from an Anthropic
|
|
5
|
+
* API key. Uses Haiku-class model for cost efficiency. Falls back
|
|
6
|
+
* gracefully when no API key is available.
|
|
7
|
+
*/
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Factory
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Create an LLMCompactCaller if an Anthropic API key is available.
|
|
13
|
+
* Returns undefined if no key is found (Tier 3 will use extractive fallback).
|
|
14
|
+
*/
|
|
15
|
+
export function createLLMCompactCaller() {
|
|
16
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
17
|
+
if (!apiKey)
|
|
18
|
+
return undefined;
|
|
19
|
+
const baseUrl = process.env.ANTHROPIC_BASE_URL || 'https://api.anthropic.com';
|
|
20
|
+
const model = 'claude-haiku-4-5-20251001'; // Cost-effective for summarization
|
|
21
|
+
return {
|
|
22
|
+
async call(systemPrompt, userPrompt) {
|
|
23
|
+
const response = await fetch(`${baseUrl}/v1/messages`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
'anthropic-version': '2023-06-01',
|
|
28
|
+
'x-api-key': apiKey,
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify({
|
|
31
|
+
model,
|
|
32
|
+
max_tokens: 4096,
|
|
33
|
+
system: systemPrompt,
|
|
34
|
+
messages: [{ role: 'user', content: userPrompt }],
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
const errorData = await response.json();
|
|
39
|
+
throw new Error(`LLM compact call failed (${response.status}): ${errorData.error?.message ?? 'unknown'}`);
|
|
40
|
+
}
|
|
41
|
+
const data = await response.json();
|
|
42
|
+
const textBlock = data.content.find(b => b.type === 'text');
|
|
43
|
+
return textBlock?.text ?? '';
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=llm-caller-adapter.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 1: Microcompact Bridge (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Thin integration layer that bridges the IMP-01 MicrocompactEngine into
|
|
5
|
+
* the 4-tier compaction pipeline. Tier 1 is zero-API-call: it evicts stale
|
|
6
|
+
* tool results based on age and context pressure.
|
|
7
|
+
*
|
|
8
|
+
* This module does NOT duplicate IMP-01 logic — it delegates to the existing
|
|
9
|
+
* MicrocompactEngine and translates its results into the CompactionResult
|
|
10
|
+
* format used by the pipeline.
|
|
11
|
+
*/
|
|
12
|
+
import { MicrocompactEngine, type MicrocompactOptions } from '../../mcp/middleware/microcompact';
|
|
13
|
+
export interface Tier1Result {
|
|
14
|
+
tier: 1;
|
|
15
|
+
tokensSaved: number;
|
|
16
|
+
clearedCount: number;
|
|
17
|
+
totalTokens: number;
|
|
18
|
+
totalResults: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class Tier1Microcompact {
|
|
21
|
+
private readonly engine;
|
|
22
|
+
constructor(options?: MicrocompactOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Construct from an existing MicrocompactEngine instance
|
|
25
|
+
* (e.g., the one already registered as middleware via IMP-01).
|
|
26
|
+
*/
|
|
27
|
+
static fromEngine(engine: MicrocompactEngine): Tier1Microcompact;
|
|
28
|
+
/** Run microcompact eviction and return a pipeline-compatible result. */
|
|
29
|
+
compact(): Tier1Result;
|
|
30
|
+
/** Expose the underlying engine for callers that need direct access. */
|
|
31
|
+
getEngine(): MicrocompactEngine;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tier1-microcompact.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 1: Microcompact Bridge (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Thin integration layer that bridges the IMP-01 MicrocompactEngine into
|
|
5
|
+
* the 4-tier compaction pipeline. Tier 1 is zero-API-call: it evicts stale
|
|
6
|
+
* tool results based on age and context pressure.
|
|
7
|
+
*
|
|
8
|
+
* This module does NOT duplicate IMP-01 logic — it delegates to the existing
|
|
9
|
+
* MicrocompactEngine and translates its results into the CompactionResult
|
|
10
|
+
* format used by the pipeline.
|
|
11
|
+
*/
|
|
12
|
+
import { MicrocompactEngine, } from '../../mcp/middleware/microcompact';
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Tier1Microcompact
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export class Tier1Microcompact {
|
|
17
|
+
engine;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.engine = new MicrocompactEngine(options);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Construct from an existing MicrocompactEngine instance
|
|
23
|
+
* (e.g., the one already registered as middleware via IMP-01).
|
|
24
|
+
*/
|
|
25
|
+
static fromEngine(engine) {
|
|
26
|
+
const tier = new Tier1Microcompact();
|
|
27
|
+
// Replace internal engine with the shared one
|
|
28
|
+
tier.engine = engine;
|
|
29
|
+
return tier;
|
|
30
|
+
}
|
|
31
|
+
/** Run microcompact eviction and return a pipeline-compatible result. */
|
|
32
|
+
compact() {
|
|
33
|
+
const result = this.engine.compact();
|
|
34
|
+
return {
|
|
35
|
+
tier: 1,
|
|
36
|
+
tokensSaved: result.tokensSaved,
|
|
37
|
+
clearedCount: result.clearedCount,
|
|
38
|
+
totalTokens: result.totalTokens,
|
|
39
|
+
totalResults: result.totalResults,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Expose the underlying engine for callers that need direct access. */
|
|
43
|
+
getEngine() {
|
|
44
|
+
return this.engine;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=tier1-microcompact.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 2: QE Session Summary (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Builds a structured session summary from already-captured context data,
|
|
5
|
+
* without making any API calls. Uses ContextCompiler output (memory,
|
|
6
|
+
* coverage, test results, requirements, defects, git) to produce a
|
|
7
|
+
* condensed representation that preserves QE-relevant state.
|
|
8
|
+
*
|
|
9
|
+
* Key constraints:
|
|
10
|
+
* - Zero API calls (purely local computation)
|
|
11
|
+
* - Preserves tool_use / tool_result message pairs (never breaks pairs)
|
|
12
|
+
* - Retains at least `minRecentTokens` of recent conversation
|
|
13
|
+
* - Caps summary at `maxSummaryTokens`
|
|
14
|
+
*/
|
|
15
|
+
export interface ConversationMessage {
|
|
16
|
+
role: 'user' | 'assistant' | 'tool_use' | 'tool_result';
|
|
17
|
+
content: string;
|
|
18
|
+
toolName?: string;
|
|
19
|
+
timestamp?: number;
|
|
20
|
+
estimatedTokens?: number;
|
|
21
|
+
/** If this is a tool_use, the ID linking it to its tool_result pair */
|
|
22
|
+
toolUseId?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SessionSummaryOptions {
|
|
25
|
+
/** Minimum tokens of recent conversation to preserve (default: 10_000) */
|
|
26
|
+
minRecentTokens?: number;
|
|
27
|
+
/** Maximum tokens for the summary output (default: 40_000) */
|
|
28
|
+
maxSummaryTokens?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface Tier2Result {
|
|
31
|
+
tier: 2;
|
|
32
|
+
/** The condensed summary text */
|
|
33
|
+
summary: string;
|
|
34
|
+
/** Tokens in the summary */
|
|
35
|
+
summaryTokens: number;
|
|
36
|
+
/** Messages preserved verbatim (recent tail) */
|
|
37
|
+
preservedMessages: ConversationMessage[];
|
|
38
|
+
/** Tokens in preserved messages */
|
|
39
|
+
preservedTokens: number;
|
|
40
|
+
/** Total messages before compaction */
|
|
41
|
+
originalMessageCount: number;
|
|
42
|
+
/** Messages removed */
|
|
43
|
+
removedMessageCount: number;
|
|
44
|
+
/** Tokens freed */
|
|
45
|
+
tokensSaved: number;
|
|
46
|
+
}
|
|
47
|
+
export declare class Tier2SessionSummary {
|
|
48
|
+
private readonly minRecentTokens;
|
|
49
|
+
private readonly maxSummaryTokens;
|
|
50
|
+
constructor(options?: SessionSummaryOptions);
|
|
51
|
+
/**
|
|
52
|
+
* Compact a conversation by summarizing old messages and preserving recent ones.
|
|
53
|
+
*
|
|
54
|
+
* Algorithm:
|
|
55
|
+
* 1. Walk backward from the end, accumulating tokens until `minRecentTokens`
|
|
56
|
+
* is reached. Never split a tool_use/tool_result pair.
|
|
57
|
+
* 2. Everything before the split point is summarized into structured sections.
|
|
58
|
+
* 3. Return summary + preserved tail.
|
|
59
|
+
*/
|
|
60
|
+
compact(messages: ConversationMessage[]): Tier2Result;
|
|
61
|
+
/**
|
|
62
|
+
* Walk backward to find the first index where we've accumulated enough
|
|
63
|
+
* recent tokens. Never splits a tool_use/tool_result pair.
|
|
64
|
+
*/
|
|
65
|
+
private findSplitIndex;
|
|
66
|
+
/**
|
|
67
|
+
* Build a structured summary from older messages.
|
|
68
|
+
* Sections mirror QE-specific concerns.
|
|
69
|
+
*/
|
|
70
|
+
private buildSummary;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=tier2-session-summary.d.ts.map
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 2: QE Session Summary (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Builds a structured session summary from already-captured context data,
|
|
5
|
+
* without making any API calls. Uses ContextCompiler output (memory,
|
|
6
|
+
* coverage, test results, requirements, defects, git) to produce a
|
|
7
|
+
* condensed representation that preserves QE-relevant state.
|
|
8
|
+
*
|
|
9
|
+
* Key constraints:
|
|
10
|
+
* - Zero API calls (purely local computation)
|
|
11
|
+
* - Preserves tool_use / tool_result message pairs (never breaks pairs)
|
|
12
|
+
* - Retains at least `minRecentTokens` of recent conversation
|
|
13
|
+
* - Caps summary at `maxSummaryTokens`
|
|
14
|
+
*/
|
|
15
|
+
import { estimateTokensPadded } from '../../mcp/middleware/microcompact';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Defaults
|
|
18
|
+
// ============================================================================
|
|
19
|
+
const DEFAULT_MIN_RECENT_TOKENS = 10_000;
|
|
20
|
+
const DEFAULT_MAX_SUMMARY_TOKENS = 40_000;
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Tier2SessionSummary
|
|
23
|
+
// ============================================================================
|
|
24
|
+
export class Tier2SessionSummary {
|
|
25
|
+
minRecentTokens;
|
|
26
|
+
maxSummaryTokens;
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.minRecentTokens = options.minRecentTokens ?? DEFAULT_MIN_RECENT_TOKENS;
|
|
29
|
+
this.maxSummaryTokens = options.maxSummaryTokens ?? DEFAULT_MAX_SUMMARY_TOKENS;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Compact a conversation by summarizing old messages and preserving recent ones.
|
|
33
|
+
*
|
|
34
|
+
* Algorithm:
|
|
35
|
+
* 1. Walk backward from the end, accumulating tokens until `minRecentTokens`
|
|
36
|
+
* is reached. Never split a tool_use/tool_result pair.
|
|
37
|
+
* 2. Everything before the split point is summarized into structured sections.
|
|
38
|
+
* 3. Return summary + preserved tail.
|
|
39
|
+
*/
|
|
40
|
+
compact(messages) {
|
|
41
|
+
if (messages.length === 0) {
|
|
42
|
+
return {
|
|
43
|
+
tier: 2,
|
|
44
|
+
summary: '',
|
|
45
|
+
summaryTokens: 0,
|
|
46
|
+
preservedMessages: [],
|
|
47
|
+
preservedTokens: 0,
|
|
48
|
+
originalMessageCount: 0,
|
|
49
|
+
removedMessageCount: 0,
|
|
50
|
+
tokensSaved: 0,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Annotate with token estimates if missing
|
|
54
|
+
const annotated = messages.map(m => ({
|
|
55
|
+
...m,
|
|
56
|
+
estimatedTokens: m.estimatedTokens ?? estimateTokensPadded(m.content),
|
|
57
|
+
}));
|
|
58
|
+
// Find the split point: walk backward, preserving at least minRecentTokens
|
|
59
|
+
const splitIndex = this.findSplitIndex(annotated);
|
|
60
|
+
const toSummarize = annotated.slice(0, splitIndex);
|
|
61
|
+
const toPreserve = annotated.slice(splitIndex);
|
|
62
|
+
const originalTokens = annotated.reduce((s, m) => s + m.estimatedTokens, 0);
|
|
63
|
+
const preservedTokens = toPreserve.reduce((s, m) => s + m.estimatedTokens, 0);
|
|
64
|
+
// Build summary from the older messages
|
|
65
|
+
const summary = this.buildSummary(toSummarize);
|
|
66
|
+
const summaryTokens = Math.min(estimateTokensPadded(summary), this.maxSummaryTokens);
|
|
67
|
+
const tokensSaved = originalTokens - preservedTokens - summaryTokens;
|
|
68
|
+
return {
|
|
69
|
+
tier: 2,
|
|
70
|
+
summary,
|
|
71
|
+
summaryTokens,
|
|
72
|
+
preservedMessages: toPreserve,
|
|
73
|
+
preservedTokens,
|
|
74
|
+
originalMessageCount: messages.length,
|
|
75
|
+
removedMessageCount: toSummarize.length,
|
|
76
|
+
tokensSaved: Math.max(0, tokensSaved),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// --------------------------------------------------------------------------
|
|
80
|
+
// Internal
|
|
81
|
+
// --------------------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* Walk backward to find the first index where we've accumulated enough
|
|
84
|
+
* recent tokens. Never splits a tool_use/tool_result pair.
|
|
85
|
+
*/
|
|
86
|
+
findSplitIndex(messages) {
|
|
87
|
+
let accumulatedTokens = 0;
|
|
88
|
+
let splitIndex = messages.length;
|
|
89
|
+
// Map each toolUseId to the index of its tool_use and tool_result messages
|
|
90
|
+
const toolUseIndex = new Map();
|
|
91
|
+
const toolResultIndex = new Map();
|
|
92
|
+
for (let i = 0; i < messages.length; i++) {
|
|
93
|
+
const m = messages[i];
|
|
94
|
+
if (m.toolUseId) {
|
|
95
|
+
if (m.role === 'tool_use')
|
|
96
|
+
toolUseIndex.set(m.toolUseId, i);
|
|
97
|
+
if (m.role === 'tool_result')
|
|
98
|
+
toolResultIndex.set(m.toolUseId, i);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
102
|
+
const msg = messages[i];
|
|
103
|
+
accumulatedTokens += msg.estimatedTokens ?? 0;
|
|
104
|
+
splitIndex = i;
|
|
105
|
+
if (accumulatedTokens >= this.minRecentTokens) {
|
|
106
|
+
// Before finalizing the split, check we're not orphaning a pair.
|
|
107
|
+
// Case 1: We landed on a tool_result — pull its tool_use into the preserved set.
|
|
108
|
+
if (msg.role === 'tool_result' && msg.toolUseId) {
|
|
109
|
+
const tuIdx = toolUseIndex.get(msg.toolUseId);
|
|
110
|
+
if (tuIdx !== undefined && tuIdx < i) {
|
|
111
|
+
splitIndex = tuIdx;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Case 2: We landed on a tool_use whose tool_result is in the preserved tail.
|
|
115
|
+
// The tool_use is already included, so this is fine — no action needed.
|
|
116
|
+
// Case 3: We landed on a tool_use whose tool_result is BEFORE us (summarized away).
|
|
117
|
+
// This means the result is already gone — the tool_use without its result is
|
|
118
|
+
// useless, so push split one further back to exclude it too.
|
|
119
|
+
if (msg.role === 'tool_use' && msg.toolUseId) {
|
|
120
|
+
const trIdx = toolResultIndex.get(msg.toolUseId);
|
|
121
|
+
if (trIdx !== undefined && trIdx < i) {
|
|
122
|
+
// The result is in the summarized section — exclude this orphaned tool_use
|
|
123
|
+
splitIndex = i + 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return splitIndex;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build a structured summary from older messages.
|
|
133
|
+
* Sections mirror QE-specific concerns.
|
|
134
|
+
*/
|
|
135
|
+
buildSummary(messages) {
|
|
136
|
+
if (messages.length === 0)
|
|
137
|
+
return '';
|
|
138
|
+
const sections = [];
|
|
139
|
+
// Extract user requests
|
|
140
|
+
const userRequests = messages
|
|
141
|
+
.filter(m => m.role === 'user')
|
|
142
|
+
.map(m => m.content.slice(0, 200));
|
|
143
|
+
if (userRequests.length > 0) {
|
|
144
|
+
sections.push(`## User Requests\n${userRequests.map(r => `- ${r}`).join('\n')}`);
|
|
145
|
+
}
|
|
146
|
+
// Extract tool calls and results
|
|
147
|
+
const toolCalls = messages.filter(m => m.role === 'tool_use');
|
|
148
|
+
if (toolCalls.length > 0) {
|
|
149
|
+
const toolSummary = toolCalls.map(t => `- ${t.toolName ?? 'unknown'}: ${t.content.slice(0, 100)}`);
|
|
150
|
+
sections.push(`## Tool Calls (${toolCalls.length})\n${toolSummary.join('\n')}`);
|
|
151
|
+
}
|
|
152
|
+
// Extract assistant responses (non-tool)
|
|
153
|
+
const assistantMsgs = messages.filter(m => m.role === 'assistant');
|
|
154
|
+
if (assistantMsgs.length > 0) {
|
|
155
|
+
const keyFindings = assistantMsgs
|
|
156
|
+
.map(m => m.content.slice(0, 150))
|
|
157
|
+
.slice(-5); // Keep last 5 findings
|
|
158
|
+
sections.push(`## Key Findings\n${keyFindings.map(f => `- ${f}`).join('\n')}`);
|
|
159
|
+
}
|
|
160
|
+
const summary = `# Session Summary (Tier 2 Compaction)\n\n` +
|
|
161
|
+
`Compacted ${messages.length} messages at ${new Date().toISOString()}\n\n` +
|
|
162
|
+
sections.join('\n\n');
|
|
163
|
+
// Truncate if over budget
|
|
164
|
+
const tokens = estimateTokensPadded(summary);
|
|
165
|
+
if (tokens > this.maxSummaryTokens) {
|
|
166
|
+
const charLimit = this.maxSummaryTokens * 3; // reverse of ceil(chars/3)
|
|
167
|
+
return summary.slice(0, charLimit) + '\n\n[Summary truncated to fit budget]';
|
|
168
|
+
}
|
|
169
|
+
return summary;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=tier2-session-summary.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 3: LLM-Powered Compaction (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* When session context exceeds safe thresholds and Tier 2 is insufficient,
|
|
5
|
+
* Tier 3 forks a single LLM call to produce a structured 9-section QE
|
|
6
|
+
* summary. This is the most expensive compaction tier (one API call) but
|
|
7
|
+
* produces the highest-quality summaries.
|
|
8
|
+
*
|
|
9
|
+
* The 9-section format is QE-specific:
|
|
10
|
+
* 1. Primary QE Objective
|
|
11
|
+
* 2. Key Technical Findings
|
|
12
|
+
* 3. Files and Test Artifacts
|
|
13
|
+
* 4. Errors and Fixes Applied
|
|
14
|
+
* 5. Quality Gates Status
|
|
15
|
+
* 6. All User Requests (verbatim intent)
|
|
16
|
+
* 7. Pending QE Tasks
|
|
17
|
+
* 8. Current Analysis State
|
|
18
|
+
* 9. Suggested Next Action
|
|
19
|
+
*/
|
|
20
|
+
import type { ConversationMessage } from './tier2-session-summary';
|
|
21
|
+
export interface Tier3Options {
|
|
22
|
+
/** Max tokens reserved for the summary output (default: 20_000) */
|
|
23
|
+
maxSummaryTokens?: number;
|
|
24
|
+
/** LLM caller — injected to decouple from routing layer */
|
|
25
|
+
llmCall?: LLMCompactCaller;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Abstraction over the LLM call used for compaction.
|
|
29
|
+
* Implementors wire this to their routing layer (e.g., model-route MCP tool).
|
|
30
|
+
*/
|
|
31
|
+
export interface LLMCompactCaller {
|
|
32
|
+
/**
|
|
33
|
+
* Send a single-turn prompt and get a text response.
|
|
34
|
+
* Should use a cost-effective model (Haiku-class).
|
|
35
|
+
*/
|
|
36
|
+
call(systemPrompt: string, userPrompt: string): Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
export interface Tier3Result {
|
|
39
|
+
tier: 3;
|
|
40
|
+
/** The structured 9-section summary */
|
|
41
|
+
summary: string;
|
|
42
|
+
/** Tokens in the summary */
|
|
43
|
+
summaryTokens: number;
|
|
44
|
+
/** Original message count */
|
|
45
|
+
originalMessageCount: number;
|
|
46
|
+
/** Tokens freed */
|
|
47
|
+
tokensSaved: number;
|
|
48
|
+
/** Whether fallback (no LLM) was used */
|
|
49
|
+
usedFallback: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare class Tier3LLMCompact {
|
|
52
|
+
private readonly maxSummaryTokens;
|
|
53
|
+
private readonly llmCall;
|
|
54
|
+
constructor(options?: Tier3Options);
|
|
55
|
+
/**
|
|
56
|
+
* Compact a conversation using a single LLM call.
|
|
57
|
+
* Falls back to a local extractive summary if no LLM caller is configured.
|
|
58
|
+
*/
|
|
59
|
+
compact(messages: ConversationMessage[]): Promise<Tier3Result>;
|
|
60
|
+
/** Build a compact transcript for the LLM prompt. */
|
|
61
|
+
private buildTranscript;
|
|
62
|
+
/** Extractive fallback when no LLM is available. */
|
|
63
|
+
private extractiveFallback;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=tier3-llm-compact.d.ts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 3: LLM-Powered Compaction (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* When session context exceeds safe thresholds and Tier 2 is insufficient,
|
|
5
|
+
* Tier 3 forks a single LLM call to produce a structured 9-section QE
|
|
6
|
+
* summary. This is the most expensive compaction tier (one API call) but
|
|
7
|
+
* produces the highest-quality summaries.
|
|
8
|
+
*
|
|
9
|
+
* The 9-section format is QE-specific:
|
|
10
|
+
* 1. Primary QE Objective
|
|
11
|
+
* 2. Key Technical Findings
|
|
12
|
+
* 3. Files and Test Artifacts
|
|
13
|
+
* 4. Errors and Fixes Applied
|
|
14
|
+
* 5. Quality Gates Status
|
|
15
|
+
* 6. All User Requests (verbatim intent)
|
|
16
|
+
* 7. Pending QE Tasks
|
|
17
|
+
* 8. Current Analysis State
|
|
18
|
+
* 9. Suggested Next Action
|
|
19
|
+
*/
|
|
20
|
+
import { estimateTokensPadded } from '../../mcp/middleware/microcompact';
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Defaults
|
|
23
|
+
// ============================================================================
|
|
24
|
+
const DEFAULT_MAX_SUMMARY_TOKENS = 20_000;
|
|
25
|
+
const COMPACTION_SYSTEM_PROMPT = `You are a QE session compaction agent. Summarize the conversation into exactly 9 sections.
|
|
26
|
+
Be concise but preserve all actionable information. Use bullet points.
|
|
27
|
+
Output ONLY the 9 sections with their headers — no preamble, no closing.`;
|
|
28
|
+
const COMPACTION_USER_TEMPLATE = `Summarize this QE session into 9 sections:
|
|
29
|
+
|
|
30
|
+
## 1. Primary QE Objective
|
|
31
|
+
## 2. Key Technical Findings
|
|
32
|
+
## 3. Files and Test Artifacts
|
|
33
|
+
## 4. Errors and Fixes Applied
|
|
34
|
+
## 5. Quality Gates Status
|
|
35
|
+
## 6. All User Requests
|
|
36
|
+
## 7. Pending QE Tasks
|
|
37
|
+
## 8. Current Analysis State
|
|
38
|
+
## 9. Suggested Next Action
|
|
39
|
+
|
|
40
|
+
Session transcript:
|
|
41
|
+
`;
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Tier3LLMCompact
|
|
44
|
+
// ============================================================================
|
|
45
|
+
export class Tier3LLMCompact {
|
|
46
|
+
maxSummaryTokens;
|
|
47
|
+
llmCall;
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
this.maxSummaryTokens = options.maxSummaryTokens ?? DEFAULT_MAX_SUMMARY_TOKENS;
|
|
50
|
+
this.llmCall = options.llmCall;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Compact a conversation using a single LLM call.
|
|
54
|
+
* Falls back to a local extractive summary if no LLM caller is configured.
|
|
55
|
+
*/
|
|
56
|
+
async compact(messages) {
|
|
57
|
+
const originalTokens = messages.reduce((s, m) => s + (m.estimatedTokens ?? estimateTokensPadded(m.content)), 0);
|
|
58
|
+
if (messages.length === 0) {
|
|
59
|
+
return {
|
|
60
|
+
tier: 3,
|
|
61
|
+
summary: '',
|
|
62
|
+
summaryTokens: 0,
|
|
63
|
+
originalMessageCount: 0,
|
|
64
|
+
tokensSaved: 0,
|
|
65
|
+
usedFallback: false,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Build the transcript to send to the LLM
|
|
69
|
+
const transcript = this.buildTranscript(messages);
|
|
70
|
+
let summary;
|
|
71
|
+
let usedFallback;
|
|
72
|
+
if (this.llmCall) {
|
|
73
|
+
try {
|
|
74
|
+
const userPrompt = COMPACTION_USER_TEMPLATE + transcript;
|
|
75
|
+
summary = await this.llmCall.call(COMPACTION_SYSTEM_PROMPT, userPrompt);
|
|
76
|
+
usedFallback = false;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// LLM call failed — fall back to extractive summary
|
|
80
|
+
summary = this.extractiveFallback(messages);
|
|
81
|
+
usedFallback = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// No LLM configured — use extractive fallback
|
|
86
|
+
summary = this.extractiveFallback(messages);
|
|
87
|
+
usedFallback = true;
|
|
88
|
+
}
|
|
89
|
+
// Truncate if over budget
|
|
90
|
+
const summaryTokens = estimateTokensPadded(summary);
|
|
91
|
+
if (summaryTokens > this.maxSummaryTokens) {
|
|
92
|
+
const charLimit = this.maxSummaryTokens * 3;
|
|
93
|
+
summary = summary.slice(0, charLimit) + '\n\n[LLM summary truncated to fit budget]';
|
|
94
|
+
}
|
|
95
|
+
const finalTokens = estimateTokensPadded(summary);
|
|
96
|
+
return {
|
|
97
|
+
tier: 3,
|
|
98
|
+
summary,
|
|
99
|
+
summaryTokens: finalTokens,
|
|
100
|
+
originalMessageCount: messages.length,
|
|
101
|
+
tokensSaved: Math.max(0, originalTokens - finalTokens),
|
|
102
|
+
usedFallback,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// --------------------------------------------------------------------------
|
|
106
|
+
// Internal
|
|
107
|
+
// --------------------------------------------------------------------------
|
|
108
|
+
/** Build a compact transcript for the LLM prompt. */
|
|
109
|
+
buildTranscript(messages) {
|
|
110
|
+
// Budget: leave room for system prompt + template + output
|
|
111
|
+
const maxTranscriptChars = (this.maxSummaryTokens * 3) * 2; // 2x output budget for input
|
|
112
|
+
const lines = [];
|
|
113
|
+
let charCount = 0;
|
|
114
|
+
for (const msg of messages) {
|
|
115
|
+
const prefix = msg.role === 'tool_use'
|
|
116
|
+
? `[tool:${msg.toolName ?? 'unknown'}]`
|
|
117
|
+
: `[${msg.role}]`;
|
|
118
|
+
const line = `${prefix} ${msg.content.slice(0, 500)}`;
|
|
119
|
+
if (charCount + line.length > maxTranscriptChars) {
|
|
120
|
+
lines.push(`... (${messages.length - lines.length} earlier messages omitted)`);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
lines.push(line);
|
|
124
|
+
charCount += line.length;
|
|
125
|
+
}
|
|
126
|
+
return lines.join('\n');
|
|
127
|
+
}
|
|
128
|
+
/** Extractive fallback when no LLM is available. */
|
|
129
|
+
extractiveFallback(messages) {
|
|
130
|
+
const sections = [];
|
|
131
|
+
// Section 1: Objective — first user message
|
|
132
|
+
const firstUser = messages.find(m => m.role === 'user');
|
|
133
|
+
sections.push(`## 1. Primary QE Objective\n${firstUser?.content.slice(0, 300) ?? 'Unknown'}`);
|
|
134
|
+
// Section 2: Findings — assistant messages
|
|
135
|
+
const findings = messages
|
|
136
|
+
.filter(m => m.role === 'assistant')
|
|
137
|
+
.slice(-3)
|
|
138
|
+
.map(m => `- ${m.content.slice(0, 150)}`);
|
|
139
|
+
sections.push(`## 2. Key Technical Findings\n${findings.join('\n') || '- None captured'}`);
|
|
140
|
+
// Section 3: Files — extract paths from tool calls
|
|
141
|
+
const filePaths = new Set();
|
|
142
|
+
for (const m of messages) {
|
|
143
|
+
const pathMatches = m.content.match(/[\w/.-]+\.(ts|js|json|yaml|md)/g);
|
|
144
|
+
if (pathMatches)
|
|
145
|
+
pathMatches.forEach(p => filePaths.add(p));
|
|
146
|
+
}
|
|
147
|
+
sections.push(`## 3. Files and Test Artifacts\n${[...filePaths].slice(0, 20).map(f => `- ${f}`).join('\n') || '- None'}`);
|
|
148
|
+
// Section 4: Errors
|
|
149
|
+
const errors = messages
|
|
150
|
+
.filter(m => m.content.toLowerCase().includes('error') || m.content.toLowerCase().includes('fail'))
|
|
151
|
+
.slice(-3)
|
|
152
|
+
.map(m => `- ${m.content.slice(0, 100)}`);
|
|
153
|
+
sections.push(`## 4. Errors and Fixes Applied\n${errors.join('\n') || '- None'}`);
|
|
154
|
+
// Sections 5-9: minimal placeholders
|
|
155
|
+
sections.push(`## 5. Quality Gates Status\n- Not assessed (extractive fallback)`);
|
|
156
|
+
const userReqs = messages
|
|
157
|
+
.filter(m => m.role === 'user')
|
|
158
|
+
.map(m => `- ${m.content.slice(0, 200)}`);
|
|
159
|
+
sections.push(`## 6. All User Requests\n${userReqs.join('\n') || '- None'}`);
|
|
160
|
+
sections.push(`## 7. Pending QE Tasks\n- Resume from last action`);
|
|
161
|
+
sections.push(`## 8. Current Analysis State\n- Session compacted at ${new Date().toISOString()}`);
|
|
162
|
+
sections.push(`## 9. Suggested Next Action\n- Review compacted summary and continue`);
|
|
163
|
+
return `# QE Session Summary (Tier 3 — Extractive Fallback)\n\n${sections.join('\n\n')}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=tier3-llm-compact.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Tier 4: Reactive Compaction (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Last-resort compaction triggered by 413 errors or context overflow
|
|
5
|
+
* detection. Aggressively peels the oldest conversation rounds until
|
|
6
|
+
* the estimated token count drops below the recovery target.
|
|
7
|
+
*
|
|
8
|
+
* This tier is destructive — it drops messages entirely (no summary).
|
|
9
|
+
* It exists to recover from situations where the context window is
|
|
10
|
+
* critically full and the session would otherwise fail.
|
|
11
|
+
*/
|
|
12
|
+
import type { ConversationMessage } from './tier2-session-summary';
|
|
13
|
+
export interface Tier4Options {
|
|
14
|
+
/** Target remaining tokens after reactive compaction (default: 30_000) */
|
|
15
|
+
recoveryTarget?: number;
|
|
16
|
+
/** Minimum messages to always preserve at the tail (default: 4) */
|
|
17
|
+
minPreservedMessages?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface Tier4Result {
|
|
20
|
+
tier: 4;
|
|
21
|
+
/** Messages surviving after compaction */
|
|
22
|
+
survivingMessages: ConversationMessage[];
|
|
23
|
+
/** Surviving token count */
|
|
24
|
+
survivingTokens: number;
|
|
25
|
+
/** Messages dropped */
|
|
26
|
+
droppedCount: number;
|
|
27
|
+
/** Tokens freed */
|
|
28
|
+
tokensSaved: number;
|
|
29
|
+
/** The trigger that caused reactive compaction */
|
|
30
|
+
trigger: 'status_413' | 'context_overflow' | 'manual';
|
|
31
|
+
}
|
|
32
|
+
export declare class Tier4Reactive {
|
|
33
|
+
private readonly recoveryTarget;
|
|
34
|
+
private readonly minPreserved;
|
|
35
|
+
constructor(options?: Tier4Options);
|
|
36
|
+
/**
|
|
37
|
+
* Aggressively peel oldest messages until under the recovery target.
|
|
38
|
+
*
|
|
39
|
+
* Algorithm:
|
|
40
|
+
* 1. Compute total tokens.
|
|
41
|
+
* 2. If already under target, return early.
|
|
42
|
+
* 3. Walk forward from the oldest message, dropping messages until
|
|
43
|
+
* remaining tokens are at or below recoveryTarget.
|
|
44
|
+
* 4. Never drop below minPreservedMessages from the tail.
|
|
45
|
+
* 5. When dropping a tool_result, also drop its paired tool_use (and vice versa).
|
|
46
|
+
*/
|
|
47
|
+
compact(messages: ConversationMessage[], trigger?: Tier4Result['trigger']): Tier4Result;
|
|
48
|
+
/**
|
|
49
|
+
* Convenience: check if a given HTTP status or error message indicates
|
|
50
|
+
* a context overflow that should trigger reactive compaction.
|
|
51
|
+
*/
|
|
52
|
+
static isContextOverflow(statusOrMessage: number | string): boolean;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=tier4-reactive.d.ts.map
|