agentic-qe 3.8.14 → 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 +28 -0
- package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
- 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/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/kernel/kernel.js +35 -0
- package/dist/kernel/memory-backend.js +3 -1
- package/dist/mcp/bundle.js +405 -351
- package/dist/mcp/entry.js +132 -77
- 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 +11 -0
- package/dist/mcp/protocol-server.js +130 -35
- 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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Command Registry
|
|
3
|
+
*
|
|
4
|
+
* Registers lightweight Commander stubs (name + description) for --help,
|
|
5
|
+
* but defers loading the full command factory/handler until the user actually
|
|
6
|
+
* runs the command. This avoids loading all command modules at startup.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
export interface LazyCommandDef {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
aliases?: string[];
|
|
13
|
+
factory: () => Promise<Command>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register a lazy command that returns a Command object.
|
|
17
|
+
* Used for command factories (createTestCommand, etc.)
|
|
18
|
+
*/
|
|
19
|
+
export declare function registerLazyCommand(program: Command, def: LazyCommandDef): void;
|
|
20
|
+
/**
|
|
21
|
+
* Register a lazy handler that implements ICommandHandler.register().
|
|
22
|
+
* Used for handlers registered via the CommandRegistry pattern.
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerLazyHandler(program: Command, name: string, description: string, factory: () => Promise<{
|
|
25
|
+
register(program: Command, context: any): void;
|
|
26
|
+
}>, context: any, aliases?: string[]): void;
|
|
27
|
+
//# sourceMappingURL=lazy-registry.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Command Registry
|
|
3
|
+
*
|
|
4
|
+
* Registers lightweight Commander stubs (name + description) for --help,
|
|
5
|
+
* but defers loading the full command factory/handler until the user actually
|
|
6
|
+
* runs the command. This avoids loading all command modules at startup.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Replace a stub command with the real one and re-parse.
|
|
10
|
+
* Shared logic between registerLazyCommand and registerLazyHandler.
|
|
11
|
+
*/
|
|
12
|
+
function createLazyStub(program, name, description, aliases) {
|
|
13
|
+
const stub = program.command(name).description(description);
|
|
14
|
+
if (aliases) {
|
|
15
|
+
for (const a of aliases) {
|
|
16
|
+
stub.alias(a);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Disable built-in help on the stub so --help triggers the action
|
|
20
|
+
// instead of displaying the stub's minimal help.
|
|
21
|
+
stub.helpOption(false);
|
|
22
|
+
stub.allowUnknownOption(true);
|
|
23
|
+
stub.allowExcessArguments(true);
|
|
24
|
+
return stub;
|
|
25
|
+
}
|
|
26
|
+
function removeStub(program, stub) {
|
|
27
|
+
const cmds = program.commands;
|
|
28
|
+
const idx = cmds.indexOf(stub);
|
|
29
|
+
if (idx >= 0)
|
|
30
|
+
cmds.splice(idx, 1);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Register a lazy command that returns a Command object.
|
|
34
|
+
* Used for command factories (createTestCommand, etc.)
|
|
35
|
+
*/
|
|
36
|
+
export function registerLazyCommand(program, def) {
|
|
37
|
+
const stub = createLazyStub(program, def.name, def.description, def.aliases);
|
|
38
|
+
stub.action(async () => {
|
|
39
|
+
try {
|
|
40
|
+
const realCmd = await def.factory();
|
|
41
|
+
removeStub(program, stub);
|
|
42
|
+
program.addCommand(realCmd);
|
|
43
|
+
await program.parseAsync(process.argv);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(`Failed to load command '${def.name}':`, error instanceof Error ? error.message : error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Register a lazy handler that implements ICommandHandler.register().
|
|
53
|
+
* Used for handlers registered via the CommandRegistry pattern.
|
|
54
|
+
*/
|
|
55
|
+
export function registerLazyHandler(program, name, description, factory, context, aliases) {
|
|
56
|
+
const stub = createLazyStub(program, name, description, aliases);
|
|
57
|
+
stub.action(async () => {
|
|
58
|
+
try {
|
|
59
|
+
const handler = await factory();
|
|
60
|
+
removeStub(program, stub);
|
|
61
|
+
handler.register(program, context);
|
|
62
|
+
await program.parseAsync(process.argv);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error(`Failed to load command '${name}':`, error instanceof Error ? error.message : error);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=lazy-registry.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Context Budget Tracker (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Tracks estimated token usage across a session and transitions through
|
|
5
|
+
* 5 operational states based on remaining budget. Emits events on state
|
|
6
|
+
* transitions so the CompactionPipeline can auto-trigger appropriate tiers.
|
|
7
|
+
*
|
|
8
|
+
* States (by remaining tokens):
|
|
9
|
+
* Normal > 25_000 -- No action needed
|
|
10
|
+
* Warning <= 25_000 -- Advisory only
|
|
11
|
+
* Pressure <= 18_000 -- Tier 1 (microcompact) runs proactively
|
|
12
|
+
* AutoCompact <= 13_000 -- Tier 2/3 auto-triggered
|
|
13
|
+
* Blocking <= 3_000 -- Tier 4 reactive, blocks new tool calls
|
|
14
|
+
*/
|
|
15
|
+
import { EventEmitter } from 'events';
|
|
16
|
+
export type BudgetState = 'normal' | 'warning' | 'pressure' | 'auto-compact' | 'blocking';
|
|
17
|
+
export interface BudgetTransition {
|
|
18
|
+
from: BudgetState;
|
|
19
|
+
to: BudgetState;
|
|
20
|
+
remainingTokens: number;
|
|
21
|
+
totalBudget: number;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
}
|
|
24
|
+
export interface BudgetSnapshot {
|
|
25
|
+
state: BudgetState;
|
|
26
|
+
usedTokens: number;
|
|
27
|
+
remainingTokens: number;
|
|
28
|
+
totalBudget: number;
|
|
29
|
+
utilizationPercent: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ContextBudgetOptions {
|
|
32
|
+
/** Total context window budget in tokens (default: 100_000) */
|
|
33
|
+
totalBudget?: number;
|
|
34
|
+
/** Threshold for Warning state (default: 25_000 remaining) */
|
|
35
|
+
warningThreshold?: number;
|
|
36
|
+
/** Threshold for Pressure state (default: 18_000 remaining) */
|
|
37
|
+
pressureThreshold?: number;
|
|
38
|
+
/** Threshold for AutoCompact state (default: 13_000 remaining) */
|
|
39
|
+
autoCompactThreshold?: number;
|
|
40
|
+
/** Threshold for Blocking state (default: 3_000 remaining) */
|
|
41
|
+
blockingThreshold?: number;
|
|
42
|
+
}
|
|
43
|
+
export declare class ContextBudgetTracker extends EventEmitter {
|
|
44
|
+
private readonly totalBudget;
|
|
45
|
+
private readonly warningThreshold;
|
|
46
|
+
private readonly pressureThreshold;
|
|
47
|
+
private readonly autoCompactThreshold;
|
|
48
|
+
private readonly blockingThreshold;
|
|
49
|
+
private usedTokens;
|
|
50
|
+
private currentState;
|
|
51
|
+
constructor(options?: ContextBudgetOptions);
|
|
52
|
+
/** Add tokens to the usage counter and re-evaluate state. */
|
|
53
|
+
addTokens(count: number): void;
|
|
54
|
+
/** Remove tokens (e.g., after compaction freed space). */
|
|
55
|
+
releaseTokens(count: number): void;
|
|
56
|
+
/** Set the absolute token count (e.g., after a full recount). */
|
|
57
|
+
setUsedTokens(count: number): void;
|
|
58
|
+
/** Current state. */
|
|
59
|
+
getState(): BudgetState;
|
|
60
|
+
/** Full snapshot of the budget. */
|
|
61
|
+
getSnapshot(): BudgetSnapshot;
|
|
62
|
+
/** Whether the budget is in a state that should block new tool calls. */
|
|
63
|
+
isBlocking(): boolean;
|
|
64
|
+
/** Whether compaction should auto-trigger. */
|
|
65
|
+
shouldAutoCompact(): boolean;
|
|
66
|
+
/** Whether proactive microcompact should run. */
|
|
67
|
+
shouldProactiveCompact(): boolean;
|
|
68
|
+
private evaluate;
|
|
69
|
+
private computeState;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=context-budget.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Context Budget Tracker (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Tracks estimated token usage across a session and transitions through
|
|
5
|
+
* 5 operational states based on remaining budget. Emits events on state
|
|
6
|
+
* transitions so the CompactionPipeline can auto-trigger appropriate tiers.
|
|
7
|
+
*
|
|
8
|
+
* States (by remaining tokens):
|
|
9
|
+
* Normal > 25_000 -- No action needed
|
|
10
|
+
* Warning <= 25_000 -- Advisory only
|
|
11
|
+
* Pressure <= 18_000 -- Tier 1 (microcompact) runs proactively
|
|
12
|
+
* AutoCompact <= 13_000 -- Tier 2/3 auto-triggered
|
|
13
|
+
* Blocking <= 3_000 -- Tier 4 reactive, blocks new tool calls
|
|
14
|
+
*/
|
|
15
|
+
import { EventEmitter } from 'events';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Defaults
|
|
18
|
+
// ============================================================================
|
|
19
|
+
const DEFAULT_TOTAL_BUDGET = 100_000;
|
|
20
|
+
const DEFAULT_WARNING_THRESHOLD = 25_000;
|
|
21
|
+
const DEFAULT_PRESSURE_THRESHOLD = 18_000;
|
|
22
|
+
const DEFAULT_AUTO_COMPACT_THRESHOLD = 13_000;
|
|
23
|
+
const DEFAULT_BLOCKING_THRESHOLD = 3_000;
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// ContextBudgetTracker
|
|
26
|
+
// ============================================================================
|
|
27
|
+
export class ContextBudgetTracker extends EventEmitter {
|
|
28
|
+
totalBudget;
|
|
29
|
+
warningThreshold;
|
|
30
|
+
pressureThreshold;
|
|
31
|
+
autoCompactThreshold;
|
|
32
|
+
blockingThreshold;
|
|
33
|
+
usedTokens = 0;
|
|
34
|
+
currentState = 'normal';
|
|
35
|
+
constructor(options = {}) {
|
|
36
|
+
super();
|
|
37
|
+
this.totalBudget = options.totalBudget ?? DEFAULT_TOTAL_BUDGET;
|
|
38
|
+
this.warningThreshold = options.warningThreshold ?? DEFAULT_WARNING_THRESHOLD;
|
|
39
|
+
this.pressureThreshold = options.pressureThreshold ?? DEFAULT_PRESSURE_THRESHOLD;
|
|
40
|
+
this.autoCompactThreshold = options.autoCompactThreshold ?? DEFAULT_AUTO_COMPACT_THRESHOLD;
|
|
41
|
+
this.blockingThreshold = options.blockingThreshold ?? DEFAULT_BLOCKING_THRESHOLD;
|
|
42
|
+
}
|
|
43
|
+
// --------------------------------------------------------------------------
|
|
44
|
+
// Public API
|
|
45
|
+
// --------------------------------------------------------------------------
|
|
46
|
+
/** Add tokens to the usage counter and re-evaluate state. */
|
|
47
|
+
addTokens(count) {
|
|
48
|
+
this.usedTokens += count;
|
|
49
|
+
this.evaluate();
|
|
50
|
+
}
|
|
51
|
+
/** Remove tokens (e.g., after compaction freed space). */
|
|
52
|
+
releaseTokens(count) {
|
|
53
|
+
this.usedTokens = Math.max(0, this.usedTokens - count);
|
|
54
|
+
this.evaluate();
|
|
55
|
+
}
|
|
56
|
+
/** Set the absolute token count (e.g., after a full recount). */
|
|
57
|
+
setUsedTokens(count) {
|
|
58
|
+
this.usedTokens = Math.max(0, count);
|
|
59
|
+
this.evaluate();
|
|
60
|
+
}
|
|
61
|
+
/** Current state. */
|
|
62
|
+
getState() {
|
|
63
|
+
return this.currentState;
|
|
64
|
+
}
|
|
65
|
+
/** Full snapshot of the budget. */
|
|
66
|
+
getSnapshot() {
|
|
67
|
+
const remaining = Math.max(0, this.totalBudget - this.usedTokens);
|
|
68
|
+
return {
|
|
69
|
+
state: this.currentState,
|
|
70
|
+
usedTokens: this.usedTokens,
|
|
71
|
+
remainingTokens: remaining,
|
|
72
|
+
totalBudget: this.totalBudget,
|
|
73
|
+
utilizationPercent: Math.round((this.usedTokens / this.totalBudget) * 100),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Whether the budget is in a state that should block new tool calls. */
|
|
77
|
+
isBlocking() {
|
|
78
|
+
return this.currentState === 'blocking';
|
|
79
|
+
}
|
|
80
|
+
/** Whether compaction should auto-trigger. */
|
|
81
|
+
shouldAutoCompact() {
|
|
82
|
+
return this.currentState === 'auto-compact' || this.currentState === 'blocking';
|
|
83
|
+
}
|
|
84
|
+
/** Whether proactive microcompact should run. */
|
|
85
|
+
shouldProactiveCompact() {
|
|
86
|
+
return this.currentState === 'pressure'
|
|
87
|
+
|| this.currentState === 'auto-compact'
|
|
88
|
+
|| this.currentState === 'blocking';
|
|
89
|
+
}
|
|
90
|
+
// --------------------------------------------------------------------------
|
|
91
|
+
// Internal
|
|
92
|
+
// --------------------------------------------------------------------------
|
|
93
|
+
evaluate() {
|
|
94
|
+
const remaining = Math.max(0, this.totalBudget - this.usedTokens);
|
|
95
|
+
const newState = this.computeState(remaining);
|
|
96
|
+
if (newState !== this.currentState) {
|
|
97
|
+
const transition = {
|
|
98
|
+
from: this.currentState,
|
|
99
|
+
to: newState,
|
|
100
|
+
remainingTokens: remaining,
|
|
101
|
+
totalBudget: this.totalBudget,
|
|
102
|
+
timestamp: Date.now(),
|
|
103
|
+
};
|
|
104
|
+
this.currentState = newState;
|
|
105
|
+
this.emit('transition', transition);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
computeState(remaining) {
|
|
109
|
+
if (remaining <= this.blockingThreshold)
|
|
110
|
+
return 'blocking';
|
|
111
|
+
if (remaining <= this.autoCompactThreshold)
|
|
112
|
+
return 'auto-compact';
|
|
113
|
+
if (remaining <= this.pressureThreshold)
|
|
114
|
+
return 'pressure';
|
|
115
|
+
if (remaining <= this.warningThreshold)
|
|
116
|
+
return 'warning';
|
|
117
|
+
return 'normal';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=context-budget.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Compaction Pipeline Orchestrator (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the 4-tier context compaction stack:
|
|
5
|
+
* Tier 1: Microcompact (IMP-01) — age/pressure eviction, zero API
|
|
6
|
+
* Tier 2: QE Session Summary — structured local summary, zero API
|
|
7
|
+
* Tier 3: LLM Compact — 9-section summary, one API call
|
|
8
|
+
* Tier 4: Reactive — aggressive message peeling on 413/overflow
|
|
9
|
+
*
|
|
10
|
+
* The pipeline auto-triggers based on ContextBudgetTracker state transitions
|
|
11
|
+
* and can also be invoked manually. Registers as middleware on the IMP-00
|
|
12
|
+
* middleware chain (priority 200, after microcompact at 100).
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolMiddleware } from '../../mcp/middleware/middleware-chain';
|
|
15
|
+
import { ContextBudgetTracker, type BudgetSnapshot } from './context-budget';
|
|
16
|
+
import { type Tier1Result } from './tier1-microcompact';
|
|
17
|
+
import { type ConversationMessage, type Tier2Result } from './tier2-session-summary';
|
|
18
|
+
import { type Tier3Result, type LLMCompactCaller } from './tier3-llm-compact';
|
|
19
|
+
import { type Tier4Result } from './tier4-reactive';
|
|
20
|
+
import { MicrocompactEngine } from '../../mcp/middleware/microcompact';
|
|
21
|
+
export { ContextBudgetTracker, type BudgetTransition, type BudgetSnapshot, type BudgetState } from './context-budget';
|
|
22
|
+
export type { ContextBudgetOptions } from './context-budget';
|
|
23
|
+
export { Tier1Microcompact, type Tier1Result } from './tier1-microcompact';
|
|
24
|
+
export { Tier2SessionSummary, type ConversationMessage, type Tier2Result, type SessionSummaryOptions } from './tier2-session-summary';
|
|
25
|
+
export { Tier3LLMCompact, type Tier3Result, type LLMCompactCaller, type Tier3Options } from './tier3-llm-compact';
|
|
26
|
+
export { Tier4Reactive, type Tier4Result, type Tier4Options } from './tier4-reactive';
|
|
27
|
+
export interface CompactionPipelineOptions {
|
|
28
|
+
/** Total context budget in tokens (default: 100_000) */
|
|
29
|
+
totalBudget?: number;
|
|
30
|
+
/** LLM caller for Tier 3 (optional — falls back to extractive) */
|
|
31
|
+
llmCaller?: LLMCompactCaller;
|
|
32
|
+
/** Max files to restore after compaction (default: 5) */
|
|
33
|
+
maxFileRestorations?: number;
|
|
34
|
+
/** Token budget for file restorations (default: 50_000) */
|
|
35
|
+
fileRestorationBudget?: number;
|
|
36
|
+
/** Shared MicrocompactEngine from IMP-01 middleware (Tier 1 reuses it) */
|
|
37
|
+
sharedMicrocompactEngine?: MicrocompactEngine;
|
|
38
|
+
}
|
|
39
|
+
export type CompactionTierResult = Tier1Result | Tier2Result | Tier3Result | Tier4Result;
|
|
40
|
+
export interface CompactionRunResult {
|
|
41
|
+
tiersExecuted: number[];
|
|
42
|
+
totalTokensSaved: number;
|
|
43
|
+
tierResults: CompactionTierResult[];
|
|
44
|
+
budgetAfter: BudgetSnapshot;
|
|
45
|
+
}
|
|
46
|
+
export declare class CompactionPipeline {
|
|
47
|
+
private readonly budget;
|
|
48
|
+
private readonly tier1;
|
|
49
|
+
private readonly tier2;
|
|
50
|
+
private readonly tier3;
|
|
51
|
+
private readonly tier4;
|
|
52
|
+
private readonly maxFileRestorations;
|
|
53
|
+
private readonly fileRestorationBudget;
|
|
54
|
+
/** Conversation history tracked for Tier 2-4 compaction */
|
|
55
|
+
private conversationHistory;
|
|
56
|
+
/** Recently accessed file paths for post-compact restoration */
|
|
57
|
+
private recentFiles;
|
|
58
|
+
/** Whether a compaction is currently in progress (prevents re-entrancy) */
|
|
59
|
+
private compacting;
|
|
60
|
+
constructor(options?: CompactionPipelineOptions);
|
|
61
|
+
/** Record a conversation message for tracking. */
|
|
62
|
+
addMessage(message: ConversationMessage): void;
|
|
63
|
+
/** Record a recently accessed file path. */
|
|
64
|
+
recordFileAccess(filePath: string): void;
|
|
65
|
+
/** Get the list of files that should be restored after compaction. */
|
|
66
|
+
getFilesForRestoration(): string[];
|
|
67
|
+
/** Get the current budget snapshot. */
|
|
68
|
+
getBudgetSnapshot(): BudgetSnapshot;
|
|
69
|
+
/** Get the budget tracker for direct access. */
|
|
70
|
+
getBudgetTracker(): ContextBudgetTracker;
|
|
71
|
+
/**
|
|
72
|
+
* Manually run compaction up to the specified tier.
|
|
73
|
+
* Returns results from all tiers that executed.
|
|
74
|
+
*/
|
|
75
|
+
runCompaction(maxTier?: 1 | 2 | 3 | 4): Promise<CompactionRunResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Handle a 413 error or context overflow.
|
|
78
|
+
* Triggers Tier 4 reactive compaction immediately.
|
|
79
|
+
*/
|
|
80
|
+
handleOverflow(trigger?: 'status_413' | 'context_overflow'): Promise<Tier4Result>;
|
|
81
|
+
/** Get compaction statistics for the session_cache_stats tool. */
|
|
82
|
+
getStats(): {
|
|
83
|
+
conversationMessages: number;
|
|
84
|
+
budget: BudgetSnapshot;
|
|
85
|
+
recentFiles: string[];
|
|
86
|
+
isCompacting: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Create a ToolMiddleware that plugs this pipeline into the IMP-00 chain.
|
|
90
|
+
* Priority 200 — runs after microcompact (100) in post-hooks.
|
|
91
|
+
* Disabled via AQE_COMPACTION_DISABLED=true.
|
|
92
|
+
*/
|
|
93
|
+
createMiddleware(): ToolMiddleware;
|
|
94
|
+
private handleBudgetTransition;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Compaction Pipeline Orchestrator (IMP-08)
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the 4-tier context compaction stack:
|
|
5
|
+
* Tier 1: Microcompact (IMP-01) — age/pressure eviction, zero API
|
|
6
|
+
* Tier 2: QE Session Summary — structured local summary, zero API
|
|
7
|
+
* Tier 3: LLM Compact — 9-section summary, one API call
|
|
8
|
+
* Tier 4: Reactive — aggressive message peeling on 413/overflow
|
|
9
|
+
*
|
|
10
|
+
* The pipeline auto-triggers based on ContextBudgetTracker state transitions
|
|
11
|
+
* and can also be invoked manually. Registers as middleware on the IMP-00
|
|
12
|
+
* middleware chain (priority 200, after microcompact at 100).
|
|
13
|
+
*/
|
|
14
|
+
import { ContextBudgetTracker } from './context-budget';
|
|
15
|
+
import { Tier1Microcompact } from './tier1-microcompact';
|
|
16
|
+
import { Tier2SessionSummary } from './tier2-session-summary';
|
|
17
|
+
import { Tier3LLMCompact } from './tier3-llm-compact';
|
|
18
|
+
import { Tier4Reactive } from './tier4-reactive';
|
|
19
|
+
import { estimateTokensPadded } from '../../mcp/middleware/microcompact';
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Re-exports
|
|
22
|
+
// ============================================================================
|
|
23
|
+
export { ContextBudgetTracker } from './context-budget';
|
|
24
|
+
export { Tier1Microcompact } from './tier1-microcompact';
|
|
25
|
+
export { Tier2SessionSummary } from './tier2-session-summary';
|
|
26
|
+
export { Tier3LLMCompact } from './tier3-llm-compact';
|
|
27
|
+
export { Tier4Reactive } from './tier4-reactive';
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// CompactionPipeline
|
|
30
|
+
// ============================================================================
|
|
31
|
+
export class CompactionPipeline {
|
|
32
|
+
budget;
|
|
33
|
+
tier1;
|
|
34
|
+
tier2;
|
|
35
|
+
tier3;
|
|
36
|
+
tier4;
|
|
37
|
+
maxFileRestorations;
|
|
38
|
+
fileRestorationBudget;
|
|
39
|
+
/** Conversation history tracked for Tier 2-4 compaction */
|
|
40
|
+
conversationHistory = [];
|
|
41
|
+
/** Recently accessed file paths for post-compact restoration */
|
|
42
|
+
recentFiles = [];
|
|
43
|
+
/** Whether a compaction is currently in progress (prevents re-entrancy) */
|
|
44
|
+
compacting = false;
|
|
45
|
+
constructor(options = {}) {
|
|
46
|
+
this.budget = new ContextBudgetTracker({
|
|
47
|
+
totalBudget: options.totalBudget,
|
|
48
|
+
});
|
|
49
|
+
this.tier1 = options.sharedMicrocompactEngine
|
|
50
|
+
? Tier1Microcompact.fromEngine(options.sharedMicrocompactEngine)
|
|
51
|
+
: new Tier1Microcompact();
|
|
52
|
+
this.tier2 = new Tier2SessionSummary();
|
|
53
|
+
this.tier3 = new Tier3LLMCompact({ llmCall: options.llmCaller });
|
|
54
|
+
this.tier4 = new Tier4Reactive();
|
|
55
|
+
this.maxFileRestorations = options.maxFileRestorations ?? 5;
|
|
56
|
+
this.fileRestorationBudget = options.fileRestorationBudget ?? 50_000;
|
|
57
|
+
// Auto-trigger compaction on budget state transitions
|
|
58
|
+
this.budget.on('transition', (transition) => {
|
|
59
|
+
this.handleBudgetTransition(transition);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// --------------------------------------------------------------------------
|
|
63
|
+
// Public API
|
|
64
|
+
// --------------------------------------------------------------------------
|
|
65
|
+
/** Record a conversation message for tracking. */
|
|
66
|
+
addMessage(message) {
|
|
67
|
+
this.conversationHistory.push(message);
|
|
68
|
+
const tokens = message.estimatedTokens ?? estimateTokensPadded(message.content);
|
|
69
|
+
this.budget.addTokens(tokens);
|
|
70
|
+
}
|
|
71
|
+
/** Record a recently accessed file path. */
|
|
72
|
+
recordFileAccess(filePath) {
|
|
73
|
+
// Deduplicate, keep most recent at the end
|
|
74
|
+
this.recentFiles = this.recentFiles.filter(f => f !== filePath);
|
|
75
|
+
this.recentFiles.push(filePath);
|
|
76
|
+
// Trim to max
|
|
77
|
+
if (this.recentFiles.length > this.maxFileRestorations * 2) {
|
|
78
|
+
this.recentFiles = this.recentFiles.slice(-this.maxFileRestorations * 2);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Get the list of files that should be restored after compaction. */
|
|
82
|
+
getFilesForRestoration() {
|
|
83
|
+
return this.recentFiles.slice(-this.maxFileRestorations);
|
|
84
|
+
}
|
|
85
|
+
/** Get the current budget snapshot. */
|
|
86
|
+
getBudgetSnapshot() {
|
|
87
|
+
return this.budget.getSnapshot();
|
|
88
|
+
}
|
|
89
|
+
/** Get the budget tracker for direct access. */
|
|
90
|
+
getBudgetTracker() {
|
|
91
|
+
return this.budget;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Manually run compaction up to the specified tier.
|
|
95
|
+
* Returns results from all tiers that executed.
|
|
96
|
+
*/
|
|
97
|
+
async runCompaction(maxTier = 4) {
|
|
98
|
+
if (this.compacting) {
|
|
99
|
+
return {
|
|
100
|
+
tiersExecuted: [],
|
|
101
|
+
totalTokensSaved: 0,
|
|
102
|
+
tierResults: [],
|
|
103
|
+
budgetAfter: this.budget.getSnapshot(),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
this.compacting = true;
|
|
107
|
+
const tierResults = [];
|
|
108
|
+
let totalTokensSaved = 0;
|
|
109
|
+
const tiersExecuted = [];
|
|
110
|
+
try {
|
|
111
|
+
// Tier 1: Always run microcompact
|
|
112
|
+
const t1 = this.tier1.compact();
|
|
113
|
+
tierResults.push(t1);
|
|
114
|
+
tiersExecuted.push(1);
|
|
115
|
+
totalTokensSaved += t1.tokensSaved;
|
|
116
|
+
if (maxTier >= 2 && this.conversationHistory.length > 0) {
|
|
117
|
+
// Tier 2: Session summary
|
|
118
|
+
const t2 = this.tier2.compact(this.conversationHistory);
|
|
119
|
+
tierResults.push(t2);
|
|
120
|
+
tiersExecuted.push(2);
|
|
121
|
+
totalTokensSaved += t2.tokensSaved;
|
|
122
|
+
// Replace conversation history with preserved messages
|
|
123
|
+
if (t2.removedMessageCount > 0) {
|
|
124
|
+
this.conversationHistory = [...t2.preservedMessages];
|
|
125
|
+
this.budget.releaseTokens(t2.tokensSaved);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (maxTier >= 3 && this.budget.shouldAutoCompact()) {
|
|
129
|
+
// Tier 3: LLM compact
|
|
130
|
+
const t3 = await this.tier3.compact(this.conversationHistory);
|
|
131
|
+
tierResults.push(t3);
|
|
132
|
+
tiersExecuted.push(3);
|
|
133
|
+
totalTokensSaved += t3.tokensSaved;
|
|
134
|
+
if (t3.tokensSaved > 0) {
|
|
135
|
+
// Replace history with summary-as-message
|
|
136
|
+
this.conversationHistory = [{
|
|
137
|
+
role: 'assistant',
|
|
138
|
+
content: t3.summary,
|
|
139
|
+
timestamp: Date.now(),
|
|
140
|
+
estimatedTokens: t3.summaryTokens,
|
|
141
|
+
}];
|
|
142
|
+
this.budget.releaseTokens(t3.tokensSaved);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (maxTier >= 4 && this.budget.isBlocking()) {
|
|
146
|
+
// Tier 4: Reactive — last resort
|
|
147
|
+
const t4 = this.tier4.compact(this.conversationHistory, 'context_overflow');
|
|
148
|
+
tierResults.push(t4);
|
|
149
|
+
tiersExecuted.push(4);
|
|
150
|
+
totalTokensSaved += t4.tokensSaved;
|
|
151
|
+
if (t4.droppedCount > 0) {
|
|
152
|
+
this.conversationHistory = [...t4.survivingMessages];
|
|
153
|
+
this.budget.releaseTokens(t4.tokensSaved);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
this.compacting = false;
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
tiersExecuted,
|
|
162
|
+
totalTokensSaved,
|
|
163
|
+
tierResults,
|
|
164
|
+
budgetAfter: this.budget.getSnapshot(),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Handle a 413 error or context overflow.
|
|
169
|
+
* Triggers Tier 4 reactive compaction immediately.
|
|
170
|
+
*/
|
|
171
|
+
async handleOverflow(trigger = 'status_413') {
|
|
172
|
+
const result = this.tier4.compact(this.conversationHistory, trigger);
|
|
173
|
+
if (result.droppedCount > 0) {
|
|
174
|
+
this.conversationHistory = [...result.survivingMessages];
|
|
175
|
+
this.budget.releaseTokens(result.tokensSaved);
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
/** Get compaction statistics for the session_cache_stats tool. */
|
|
180
|
+
getStats() {
|
|
181
|
+
return {
|
|
182
|
+
conversationMessages: this.conversationHistory.length,
|
|
183
|
+
budget: this.budget.getSnapshot(),
|
|
184
|
+
recentFiles: this.getFilesForRestoration(),
|
|
185
|
+
isCompacting: this.compacting,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// --------------------------------------------------------------------------
|
|
189
|
+
// Middleware Factory
|
|
190
|
+
// --------------------------------------------------------------------------
|
|
191
|
+
/**
|
|
192
|
+
* Create a ToolMiddleware that plugs this pipeline into the IMP-00 chain.
|
|
193
|
+
* Priority 200 — runs after microcompact (100) in post-hooks.
|
|
194
|
+
* Disabled via AQE_COMPACTION_DISABLED=true.
|
|
195
|
+
*/
|
|
196
|
+
createMiddleware() {
|
|
197
|
+
const compactionDisabled = process.env.AQE_COMPACTION_DISABLED === 'true';
|
|
198
|
+
return {
|
|
199
|
+
name: 'compaction-pipeline',
|
|
200
|
+
priority: 200,
|
|
201
|
+
postToolResult: async (context, result) => {
|
|
202
|
+
if (compactionDisabled)
|
|
203
|
+
return result;
|
|
204
|
+
// Estimate tokens from FULL content for accurate budget tracking,
|
|
205
|
+
// but store truncated content for conversation history (summarization).
|
|
206
|
+
const fullParamsStr = JSON.stringify(context.params);
|
|
207
|
+
const fullResultStr = typeof result === 'string' ? result : JSON.stringify(result);
|
|
208
|
+
const toolUseId = `${context.toolName}-${context.timestamp}`;
|
|
209
|
+
// Track the tool call
|
|
210
|
+
this.addMessage({
|
|
211
|
+
role: 'tool_use',
|
|
212
|
+
content: fullParamsStr.slice(0, 500),
|
|
213
|
+
toolName: context.toolName,
|
|
214
|
+
timestamp: context.timestamp,
|
|
215
|
+
toolUseId,
|
|
216
|
+
// Use full content for token estimation
|
|
217
|
+
estimatedTokens: estimateTokensPadded(fullParamsStr),
|
|
218
|
+
});
|
|
219
|
+
// Track the result
|
|
220
|
+
this.addMessage({
|
|
221
|
+
role: 'tool_result',
|
|
222
|
+
content: fullResultStr.slice(0, 1000),
|
|
223
|
+
toolName: context.toolName,
|
|
224
|
+
timestamp: Date.now(),
|
|
225
|
+
toolUseId,
|
|
226
|
+
estimatedTokens: estimateTokensPadded(fullResultStr),
|
|
227
|
+
});
|
|
228
|
+
// Track file accesses from tool params
|
|
229
|
+
const params = context.params;
|
|
230
|
+
if (typeof params.file_path === 'string') {
|
|
231
|
+
this.recordFileAccess(params.file_path);
|
|
232
|
+
}
|
|
233
|
+
if (typeof params.path === 'string') {
|
|
234
|
+
this.recordFileAccess(params.path);
|
|
235
|
+
}
|
|
236
|
+
return result;
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// --------------------------------------------------------------------------
|
|
241
|
+
// Internal
|
|
242
|
+
// --------------------------------------------------------------------------
|
|
243
|
+
handleBudgetTransition(transition) {
|
|
244
|
+
// Auto-trigger compaction based on state
|
|
245
|
+
if (transition.to === 'pressure') {
|
|
246
|
+
// Tier 1 only — proactive microcompact
|
|
247
|
+
void this.runCompaction(1);
|
|
248
|
+
}
|
|
249
|
+
else if (transition.to === 'auto-compact') {
|
|
250
|
+
// Tiers 1-3
|
|
251
|
+
void this.runCompaction(3);
|
|
252
|
+
}
|
|
253
|
+
else if (transition.to === 'blocking') {
|
|
254
|
+
// All tiers including reactive
|
|
255
|
+
void this.runCompaction(4);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import type { LLMCompactCaller } from './tier3-llm-compact';
|
|
9
|
+
/**
|
|
10
|
+
* Create an LLMCompactCaller if an Anthropic API key is available.
|
|
11
|
+
* Returns undefined if no key is found (Tier 3 will use extractive fallback).
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLLMCompactCaller(): LLMCompactCaller | undefined;
|
|
14
|
+
//# sourceMappingURL=llm-caller-adapter.d.ts.map
|