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
package/dist/mcp/entry.js
CHANGED
|
@@ -20,6 +20,7 @@ import { bootstrapTokenTracking, shutdownTokenTracking } from '../init/token-boo
|
|
|
20
20
|
import { initializeExperienceCapture, stopCleanupTimer } from '../learning/experience-capture-middleware.js';
|
|
21
21
|
import { createInfraHealingOrchestratorSync, ShellCommandRunner } from '../strange-loop/infra-healing/index.js';
|
|
22
22
|
import { setInfraHealingOrchestrator, handleFleetInit } from './handlers/index.js';
|
|
23
|
+
import { parallelPrefetch } from '../boot/parallel-prefetch.js';
|
|
23
24
|
import { readFileSync } from 'node:fs';
|
|
24
25
|
import { resolve, dirname } from 'node:path';
|
|
25
26
|
import { fileURLToPath } from 'node:url';
|
|
@@ -31,11 +32,18 @@ async function main() {
|
|
|
31
32
|
// Output startup message BEFORE suppressing stderr (Claude Code health check needs this)
|
|
32
33
|
const version = pkg.version;
|
|
33
34
|
process.stderr.write(`[agentic-qe-v3] MCP server starting v${version}\n`);
|
|
34
|
-
// Handle graceful shutdown
|
|
35
|
+
// Handle graceful shutdown (includes QualityDaemon)
|
|
35
36
|
const shutdownDaemon = async () => {
|
|
36
37
|
try {
|
|
37
38
|
const { getDaemon } = await import('../workers/daemon.js');
|
|
38
|
-
|
|
39
|
+
const daemon = getDaemon();
|
|
40
|
+
// Stop quality daemon first (if started)
|
|
41
|
+
try {
|
|
42
|
+
const qd = daemon.getQualityDaemon();
|
|
43
|
+
await qd.stop();
|
|
44
|
+
}
|
|
45
|
+
catch { /* not started */ }
|
|
46
|
+
await daemon.stop();
|
|
39
47
|
}
|
|
40
48
|
catch { /* ignore */ }
|
|
41
49
|
};
|
|
@@ -98,81 +106,99 @@ async function main() {
|
|
|
98
106
|
return true;
|
|
99
107
|
});
|
|
100
108
|
try {
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
109
|
+
// IMP-06: Run independent init tasks in parallel via parallelPrefetch.
|
|
110
|
+
// Token tracking, experience capture, infra-healing, and fleet init are
|
|
111
|
+
// all independent — total startup time is bounded by the slowest task
|
|
112
|
+
// rather than the sum of all tasks.
|
|
113
|
+
originalStderrWrite('[MCP] Initializing subsystems in parallel...\n');
|
|
114
|
+
const prefetchResult = await parallelPrefetch([
|
|
115
|
+
{
|
|
116
|
+
// ADR-042: Initialize token tracking and optimization
|
|
117
|
+
name: 'token-tracking',
|
|
118
|
+
fn: async () => {
|
|
119
|
+
await bootstrapTokenTracking({
|
|
120
|
+
enableOptimization: true,
|
|
121
|
+
enablePersistence: true,
|
|
122
|
+
verbose: process.env.AQE_VERBOSE === 'true',
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
// ADR-051: Initialize experience capture and unified memory BEFORE server starts.
|
|
128
|
+
// This ensures all tool invocations (domain, memory, core) write to v3 memory.db
|
|
129
|
+
// from the first request, rather than lazy-initializing on first domain tool call.
|
|
130
|
+
name: 'experience-capture',
|
|
131
|
+
fn: async () => {
|
|
132
|
+
await initializeExperienceCapture();
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
// ADR-057: Initialize infrastructure self-healing
|
|
137
|
+
name: 'infra-healing',
|
|
138
|
+
fn: async () => {
|
|
139
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
140
|
+
const __dirname = dirname(__filename);
|
|
141
|
+
const playbookPath = resolve(__dirname, '../strange-loop/infra-healing/default-playbook.yaml');
|
|
142
|
+
let playbookContent;
|
|
143
|
+
try {
|
|
144
|
+
playbookContent = readFileSync(playbookPath, 'utf-8');
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Fallback for bundled environments where the YAML may not be at the resolved path
|
|
148
|
+
playbookContent = [
|
|
149
|
+
'services:',
|
|
150
|
+
' postgres:',
|
|
151
|
+
' healthCheck: "pg_isready -h localhost -p 5432"',
|
|
152
|
+
' recover: "echo postgres-recovery-placeholder"',
|
|
153
|
+
' verify: "pg_isready -h localhost -p 5432"',
|
|
154
|
+
' redis:',
|
|
155
|
+
' healthCheck: "redis-cli ping"',
|
|
156
|
+
' recover: "echo redis-recovery-placeholder"',
|
|
157
|
+
' verify: "redis-cli ping"',
|
|
158
|
+
' node:',
|
|
159
|
+
' healthCheck: "node --version"',
|
|
160
|
+
' recover: "echo node-recovery-placeholder"',
|
|
161
|
+
' verify: "node --version"',
|
|
162
|
+
].join('\n');
|
|
163
|
+
}
|
|
164
|
+
if (playbookContent) {
|
|
165
|
+
const infraOrchestrator = createInfraHealingOrchestratorSync({
|
|
166
|
+
commandRunner: new ShellCommandRunner(),
|
|
167
|
+
playbook: playbookContent,
|
|
168
|
+
});
|
|
169
|
+
setInfraHealingOrchestrator(infraOrchestrator);
|
|
170
|
+
originalStderrWrite(`[MCP] Infra-healing ready (${infraOrchestrator.getPlaybook().listServices().length} services)\n`);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
originalStderrWrite('[MCP] Infra-healing skipped: no playbook found\n');
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
// Auto-initialize fleet so tools work without requiring fleet_init call
|
|
179
|
+
name: 'fleet-init',
|
|
180
|
+
fn: async () => {
|
|
181
|
+
const fleetResult = await handleFleetInit({
|
|
182
|
+
topology: 'hierarchical',
|
|
183
|
+
maxAgents: 15,
|
|
184
|
+
memoryBackend: 'hybrid',
|
|
185
|
+
lazyLoading: true,
|
|
186
|
+
});
|
|
187
|
+
if (fleetResult.success) {
|
|
188
|
+
originalStderrWrite(`[MCP] Fleet ready: ${fleetResult.data?.fleetId}\n`);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
originalStderrWrite(`[MCP] WARNING: Fleet auto-init failed: ${fleetResult.error}\n`);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
]);
|
|
196
|
+
// Log prefetch results
|
|
197
|
+
if (prefetchResult.completedTasks.length > 0) {
|
|
198
|
+
originalStderrWrite(`[MCP] Initialized: ${prefetchResult.completedTasks.join(', ')} (${prefetchResult.totalTimeMs.toFixed(0)}ms)\n`);
|
|
152
199
|
}
|
|
153
|
-
|
|
154
|
-
originalStderrWrite(`[MCP] WARNING:
|
|
155
|
-
// Non-fatal — MCP server continues without infra-healing
|
|
156
|
-
}
|
|
157
|
-
// Auto-initialize fleet so tools work without requiring fleet_init call
|
|
158
|
-
originalStderrWrite('[MCP] Auto-initializing fleet...\n');
|
|
159
|
-
try {
|
|
160
|
-
const fleetResult = await handleFleetInit({
|
|
161
|
-
topology: 'hierarchical',
|
|
162
|
-
maxAgents: 15,
|
|
163
|
-
memoryBackend: 'hybrid',
|
|
164
|
-
lazyLoading: true,
|
|
165
|
-
});
|
|
166
|
-
if (fleetResult.success) {
|
|
167
|
-
originalStderrWrite(`[MCP] Fleet ready: ${fleetResult.data?.fleetId}\n`);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
originalStderrWrite(`[MCP] WARNING: Fleet auto-init failed: ${fleetResult.error}\n`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
catch (fleetError) {
|
|
174
|
-
originalStderrWrite(`[MCP] WARNING: Fleet auto-init error: ${fleetError}\n`);
|
|
175
|
-
// Non-fatal — tools will prompt user to call fleet_init manually
|
|
200
|
+
for (const failed of prefetchResult.failedTasks) {
|
|
201
|
+
originalStderrWrite(`[MCP] WARNING: ${failed.name} init failed: ${failed.error}\n`);
|
|
176
202
|
}
|
|
177
203
|
// Start the MCP server
|
|
178
204
|
originalStderrWrite('[MCP] Starting server...\n');
|
|
@@ -181,13 +207,42 @@ async function main() {
|
|
|
181
207
|
version,
|
|
182
208
|
});
|
|
183
209
|
originalStderrWrite('[MCP] Ready\n');
|
|
184
|
-
//
|
|
210
|
+
// IMP-10: Start background workers (heartbeat scheduler, etc.)
|
|
185
211
|
try {
|
|
186
212
|
const { getDaemon } = await import('../workers/daemon.js');
|
|
187
213
|
const daemon = getDaemon({ autoStart: false });
|
|
188
214
|
await daemon.start();
|
|
189
215
|
const status = daemon.getStatus();
|
|
190
216
|
originalStderrWrite(`[MCP] Background workers started (${status.workerManager.totalWorkers} workers)\n`);
|
|
217
|
+
// IMP-10: Start QualityDaemon with persistent memory (Finding 1 & 2 resolution)
|
|
218
|
+
try {
|
|
219
|
+
const { UnifiedMemoryManager } = await import('../kernel/unified-memory.js');
|
|
220
|
+
const { PersistentWorkerMemory } = await import('../workers/quality-daemon/persistent-memory.js');
|
|
221
|
+
const { isPrivateIp } = await import('../hooks/security/ssrf-guard.js');
|
|
222
|
+
const unifiedMemory = await UnifiedMemoryManager.getInstanceAsync();
|
|
223
|
+
const persistentMemory = new PersistentWorkerMemory(unifiedMemory);
|
|
224
|
+
const qualityDaemon = daemon.getQualityDaemon({
|
|
225
|
+
notifications: {
|
|
226
|
+
// IMP-07 SSRF guard: block private IPs in webhook URLs (Finding 5)
|
|
227
|
+
urlValidator: (url) => {
|
|
228
|
+
try {
|
|
229
|
+
const parsed = new URL(url);
|
|
230
|
+
const hostname = parsed.hostname.replace(/^\[|\]$/g, '');
|
|
231
|
+
return !isPrivateIp(hostname);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
await qualityDaemon.start(persistentMemory);
|
|
240
|
+
originalStderrWrite(`[MCP] Quality daemon started\n`);
|
|
241
|
+
}
|
|
242
|
+
catch (qdError) {
|
|
243
|
+
originalStderrWrite(`[MCP] WARNING: Quality daemon failed to start: ${qdError}\n`);
|
|
244
|
+
// Non-fatal — MCP continues without quality daemon
|
|
245
|
+
}
|
|
191
246
|
}
|
|
192
247
|
catch (daemonError) {
|
|
193
248
|
originalStderrWrite(`[MCP] WARNING: Background workers failed to start: ${daemonError}\n`);
|
package/dist/mcp/http-server.js
CHANGED
|
@@ -14,6 +14,9 @@ import { createServer } from 'http';
|
|
|
14
14
|
import { join, dirname } from 'path';
|
|
15
15
|
import { fileURLToPath } from 'url';
|
|
16
16
|
import { safeJsonParse } from '../shared/safe-json.js';
|
|
17
|
+
import { createRequire } from 'module';
|
|
18
|
+
const _require = createRequire(import.meta.url);
|
|
19
|
+
const _pkg = _require('../../package.json');
|
|
17
20
|
// AG-UI imports
|
|
18
21
|
import { createEventAdapter, } from '../adapters/ag-ui/index.js';
|
|
19
22
|
// A2A imports
|
|
@@ -626,7 +629,7 @@ class HTTPServerImpl {
|
|
|
626
629
|
res.setHeader('Content-Type', 'application/json');
|
|
627
630
|
res.end(JSON.stringify({
|
|
628
631
|
status: 'ok',
|
|
629
|
-
version:
|
|
632
|
+
version: _pkg.version,
|
|
630
633
|
protocols: ['ag-ui', 'a2a', 'a2ui'],
|
|
631
634
|
agentCardsLoaded: this.agentCardsLoaded,
|
|
632
635
|
agentCount: this.discoveryService.getAgentCount(),
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export { getConnectionPool, initializeConnectionPool, shutdownConnectionPool, cr
|
|
|
8
8
|
export { getLoadBalancer, resetLoadBalancer, createLoadBalancer, type AgentLoadInfo, type LoadBalancingStrategy, type LoadBalancerConfig, type LoadBalancerStats, DEFAULT_LOAD_BALANCER_CONFIG, } from './load-balancer';
|
|
9
9
|
export { getPerformanceMonitor, resetPerformanceMonitor, createPerformanceMonitor, type LatencySample, type ToolExecutionMetric, type PoolMetric, type PerformanceAlert, type PerformanceReport, type PerformanceMonitorConfig, DEFAULT_MONITOR_CONFIG, } from './performance-monitor';
|
|
10
10
|
export * from './handlers';
|
|
11
|
-
export { MCPServer, createMCPServer } from './server';
|
|
12
|
-
export { default } from './server';
|
|
13
11
|
export * from './transport';
|
|
14
12
|
export { MCPProtocolServer, createMCPProtocolServer, quickStart, type MCPServerConfig, type MCPCapabilities, type MCPServerInfo, } from './protocol-server';
|
|
13
|
+
export { MCPProtocolServer as MCPServer } from './protocol-server';
|
|
14
|
+
export { createMCPProtocolServer as createMCPServer } from './protocol-server';
|
|
15
15
|
export { isToolAllowed, getToolScope, getAllowedTools, validateToolAccess, type AgentRole, type ToolScope, } from './tool-scoping';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp/index.js
CHANGED
|
@@ -14,13 +14,14 @@ export { getLoadBalancer, resetLoadBalancer, createLoadBalancer, DEFAULT_LOAD_BA
|
|
|
14
14
|
export { getPerformanceMonitor, resetPerformanceMonitor, createPerformanceMonitor, DEFAULT_MONITOR_CONFIG, } from './performance-monitor';
|
|
15
15
|
// Handlers
|
|
16
16
|
export * from './handlers';
|
|
17
|
-
// Server (legacy)
|
|
18
|
-
export { MCPServer, createMCPServer } from './server';
|
|
19
|
-
export { default } from './server';
|
|
20
17
|
// Transport Layer
|
|
21
18
|
export * from './transport';
|
|
22
|
-
// Protocol Server (
|
|
19
|
+
// Protocol Server (production MCP server)
|
|
23
20
|
export { MCPProtocolServer, createMCPProtocolServer, quickStart, } from './protocol-server';
|
|
21
|
+
// Legacy aliases — server.ts was removed (dead code, never used in production).
|
|
22
|
+
// MCPProtocolServer is the only server. These aliases prevent import breakage.
|
|
23
|
+
export { MCPProtocolServer as MCPServer } from './protocol-server';
|
|
24
|
+
export { createMCPProtocolServer as createMCPServer } from './protocol-server';
|
|
24
25
|
// Per-Agent Tool Scoping
|
|
25
26
|
export { isToolAllowed, getToolScope, getAllowedTools, validateToolAccess, } from './tool-scoping';
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Batch Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* IMP-02: Tool Concurrency Partitioning
|
|
5
|
+
*
|
|
6
|
+
* Enables parallel execution of concurrent-safe tool calls within internal
|
|
7
|
+
* orchestration paths (task_orchestrate, fleet batch ops). Does NOT change
|
|
8
|
+
* the MCP protocol contract — MCP still sends one tool call per request.
|
|
9
|
+
*
|
|
10
|
+
* Strategy:
|
|
11
|
+
* 1. Partition consecutive isConcurrencySafe:true calls into batches
|
|
12
|
+
* 2. Non-safe calls break the batch and run alone, sequentially
|
|
13
|
+
* 3. Each safe batch runs via Promise.all() with a semaphore limiter
|
|
14
|
+
* 4. Results are returned in original input order
|
|
15
|
+
*/
|
|
16
|
+
export interface BatchToolCall {
|
|
17
|
+
name: string;
|
|
18
|
+
handler: () => Promise<unknown>;
|
|
19
|
+
isConcurrencySafe: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface BatchResult {
|
|
22
|
+
results: unknown[];
|
|
23
|
+
parallelBatches: number;
|
|
24
|
+
sequentialCalls: number;
|
|
25
|
+
totalWallTimeMs: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class Semaphore {
|
|
28
|
+
private permits;
|
|
29
|
+
private readonly waiting;
|
|
30
|
+
constructor(permits: number);
|
|
31
|
+
acquire(): Promise<void>;
|
|
32
|
+
release(): void;
|
|
33
|
+
/** Current number of available permits (useful for testing). */
|
|
34
|
+
get available(): number;
|
|
35
|
+
}
|
|
36
|
+
export declare class BatchToolExecutor {
|
|
37
|
+
private readonly maxConcurrency;
|
|
38
|
+
constructor(maxConcurrency?: number);
|
|
39
|
+
/**
|
|
40
|
+
* Execute a batch of tool calls respecting concurrency safety annotations.
|
|
41
|
+
*
|
|
42
|
+
* @returns BatchResult with results in the same order as the input calls.
|
|
43
|
+
*/
|
|
44
|
+
executeBatch(calls: BatchToolCall[]): Promise<BatchResult>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=batch-executor.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Batch Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* IMP-02: Tool Concurrency Partitioning
|
|
5
|
+
*
|
|
6
|
+
* Enables parallel execution of concurrent-safe tool calls within internal
|
|
7
|
+
* orchestration paths (task_orchestrate, fleet batch ops). Does NOT change
|
|
8
|
+
* the MCP protocol contract — MCP still sends one tool call per request.
|
|
9
|
+
*
|
|
10
|
+
* Strategy:
|
|
11
|
+
* 1. Partition consecutive isConcurrencySafe:true calls into batches
|
|
12
|
+
* 2. Non-safe calls break the batch and run alone, sequentially
|
|
13
|
+
* 3. Each safe batch runs via Promise.all() with a semaphore limiter
|
|
14
|
+
* 4. Results are returned in original input order
|
|
15
|
+
*/
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Semaphore — simple concurrency limiter
|
|
18
|
+
// ============================================================================
|
|
19
|
+
export class Semaphore {
|
|
20
|
+
permits;
|
|
21
|
+
waiting = [];
|
|
22
|
+
constructor(permits) {
|
|
23
|
+
if (permits < 1) {
|
|
24
|
+
throw new Error('Semaphore permits must be >= 1');
|
|
25
|
+
}
|
|
26
|
+
this.permits = permits;
|
|
27
|
+
}
|
|
28
|
+
async acquire() {
|
|
29
|
+
if (this.permits > 0) {
|
|
30
|
+
this.permits--;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
this.waiting.push(resolve);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
release() {
|
|
38
|
+
if (this.waiting.length > 0) {
|
|
39
|
+
const next = this.waiting.shift();
|
|
40
|
+
// Resolve on next microtick to avoid stack issues
|
|
41
|
+
queueMicrotask(next);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.permits++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Current number of available permits (useful for testing). */
|
|
48
|
+
get available() {
|
|
49
|
+
return this.permits;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Partition an array of calls into consecutive segments:
|
|
54
|
+
* - Consecutive safe calls → parallel segment
|
|
55
|
+
* - Each non-safe call → its own sequential segment
|
|
56
|
+
*/
|
|
57
|
+
function partitionCalls(calls) {
|
|
58
|
+
const segments = [];
|
|
59
|
+
let currentSafe = [];
|
|
60
|
+
for (let i = 0; i < calls.length; i++) {
|
|
61
|
+
if (calls[i].isConcurrencySafe) {
|
|
62
|
+
currentSafe.push(i);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Flush any accumulated safe calls as a parallel batch
|
|
66
|
+
if (currentSafe.length > 0) {
|
|
67
|
+
segments.push({ kind: 'parallel', indices: currentSafe });
|
|
68
|
+
currentSafe = [];
|
|
69
|
+
}
|
|
70
|
+
segments.push({ kind: 'sequential', indices: [i] });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Flush trailing safe calls
|
|
74
|
+
if (currentSafe.length > 0) {
|
|
75
|
+
segments.push({ kind: 'parallel', indices: currentSafe });
|
|
76
|
+
}
|
|
77
|
+
return segments;
|
|
78
|
+
}
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// BatchToolExecutor
|
|
81
|
+
// ============================================================================
|
|
82
|
+
const DEFAULT_MAX_CONCURRENCY = 10;
|
|
83
|
+
const ENV_KEY = 'AQE_MAX_TOOL_CONCURRENCY';
|
|
84
|
+
export class BatchToolExecutor {
|
|
85
|
+
maxConcurrency;
|
|
86
|
+
constructor(maxConcurrency) {
|
|
87
|
+
if (maxConcurrency !== undefined) {
|
|
88
|
+
this.maxConcurrency = maxConcurrency;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const envVal = process.env[ENV_KEY];
|
|
92
|
+
this.maxConcurrency =
|
|
93
|
+
envVal && !isNaN(Number(envVal)) && Number(envVal) >= 1
|
|
94
|
+
? Number(envVal)
|
|
95
|
+
: DEFAULT_MAX_CONCURRENCY;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Execute a batch of tool calls respecting concurrency safety annotations.
|
|
100
|
+
*
|
|
101
|
+
* @returns BatchResult with results in the same order as the input calls.
|
|
102
|
+
*/
|
|
103
|
+
async executeBatch(calls) {
|
|
104
|
+
if (calls.length === 0) {
|
|
105
|
+
return {
|
|
106
|
+
results: [],
|
|
107
|
+
parallelBatches: 0,
|
|
108
|
+
sequentialCalls: 0,
|
|
109
|
+
totalWallTimeMs: 0,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
const segments = partitionCalls(calls);
|
|
114
|
+
const results = new Array(calls.length);
|
|
115
|
+
let parallelBatches = 0;
|
|
116
|
+
let sequentialCalls = 0;
|
|
117
|
+
const semaphore = new Semaphore(this.maxConcurrency);
|
|
118
|
+
for (const segment of segments) {
|
|
119
|
+
if (segment.kind === 'parallel') {
|
|
120
|
+
parallelBatches++;
|
|
121
|
+
const batchResults = await Promise.all(segment.indices.map(async (idx) => {
|
|
122
|
+
await semaphore.acquire();
|
|
123
|
+
try {
|
|
124
|
+
return await calls[idx].handler();
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
semaphore.release();
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
// Place results back at original indices
|
|
131
|
+
for (let j = 0; j < segment.indices.length; j++) {
|
|
132
|
+
results[segment.indices[j]] = batchResults[j];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// Sequential: exactly one call
|
|
137
|
+
sequentialCalls++;
|
|
138
|
+
const idx = segment.indices[0];
|
|
139
|
+
results[idx] = await calls[idx].handler();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
results,
|
|
144
|
+
parallelBatches,
|
|
145
|
+
sequentialCalls,
|
|
146
|
+
totalWallTimeMs: Date.now() - startTime,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=batch-executor.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Microcompact Engine (IMP-01)
|
|
3
|
+
*
|
|
4
|
+
* Tracks MCP tool results over time and evicts stale entries to reduce
|
|
5
|
+
* context-window pressure. Registers as a postToolResult middleware on the
|
|
6
|
+
* IMP-00 middleware chain.
|
|
7
|
+
*
|
|
8
|
+
* Eviction rules (applied in order on each compact() call):
|
|
9
|
+
* 1. Results older than `maxAgeMs` are cleared — unless they are among
|
|
10
|
+
* the most recent `keepLastN` results.
|
|
11
|
+
* 2. If total estimated tokens still exceed `contextBudget * contextPressureThreshold`,
|
|
12
|
+
* the oldest non-protected results are cleared until the budget is satisfied.
|
|
13
|
+
*
|
|
14
|
+
* Cleared entries have their content replaced with a sentinel string so
|
|
15
|
+
* downstream consumers can detect compacted slots.
|
|
16
|
+
*/
|
|
17
|
+
import type { ToolMiddleware } from './middleware-chain';
|
|
18
|
+
export interface MicrocompactOptions {
|
|
19
|
+
maxAgeMs?: number;
|
|
20
|
+
keepLastN?: number;
|
|
21
|
+
contextPressureThreshold?: number;
|
|
22
|
+
contextBudget?: number;
|
|
23
|
+
sentinel?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ToolResultEntry {
|
|
26
|
+
toolName: string;
|
|
27
|
+
result: unknown;
|
|
28
|
+
timestamp: number;
|
|
29
|
+
estimatedTokens: number;
|
|
30
|
+
cleared: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface MicrocompactResult {
|
|
33
|
+
clearedCount: number;
|
|
34
|
+
tokensSaved: number;
|
|
35
|
+
totalResults: number;
|
|
36
|
+
totalTokens: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Padded heuristic for token estimation: ceil(chars / 3).
|
|
40
|
+
* Intentionally conservative — overestimates slightly to give headroom.
|
|
41
|
+
*/
|
|
42
|
+
export declare function estimateTokensPadded(content: unknown): number;
|
|
43
|
+
export declare class MicrocompactEngine {
|
|
44
|
+
private entries;
|
|
45
|
+
private readonly maxAgeMs;
|
|
46
|
+
private readonly keepLastN;
|
|
47
|
+
private readonly pressureThreshold;
|
|
48
|
+
private readonly contextBudget;
|
|
49
|
+
private readonly sentinel;
|
|
50
|
+
constructor(options?: MicrocompactOptions);
|
|
51
|
+
/** Register a new tool result for tracking. */
|
|
52
|
+
addResult(toolName: string, result: unknown): void;
|
|
53
|
+
/**
|
|
54
|
+
* Run the two-pass eviction algorithm and return a summary.
|
|
55
|
+
*
|
|
56
|
+
* Pass 1 — age-based: clear anything older than `maxAgeMs`, except the
|
|
57
|
+
* most recent `keepLastN` entries (regardless of age).
|
|
58
|
+
* Pass 2 — pressure-based: if total tokens still exceed the threshold,
|
|
59
|
+
* clear the oldest non-protected entries one-by-one until under budget.
|
|
60
|
+
*/
|
|
61
|
+
compact(): MicrocompactResult;
|
|
62
|
+
/** Return current tracking statistics. */
|
|
63
|
+
getStats(): {
|
|
64
|
+
totalResults: number;
|
|
65
|
+
clearedCount: number;
|
|
66
|
+
totalTokens: number;
|
|
67
|
+
};
|
|
68
|
+
/** Expose estimateTokensPadded as a static method for external callers. */
|
|
69
|
+
static estimateTokensPadded(content: unknown): number;
|
|
70
|
+
/** Read-only access to the internal entries (useful for testing). */
|
|
71
|
+
getEntries(): ReadonlyArray<ToolResultEntry>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Result of createMicrocompactMiddleware — returns both the middleware
|
|
75
|
+
* and the engine so callers can share the engine with other subsystems
|
|
76
|
+
* (e.g., the compaction pipeline's Tier 1).
|
|
77
|
+
*/
|
|
78
|
+
export interface MicrocompactMiddlewareResult {
|
|
79
|
+
middleware: ToolMiddleware;
|
|
80
|
+
engine: MicrocompactEngine;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create a ToolMiddleware that plugs the MicrocompactEngine into the
|
|
84
|
+
* IMP-00 middleware chain.
|
|
85
|
+
*
|
|
86
|
+
* The middleware:
|
|
87
|
+
* - Records every tool result via `addResult()`
|
|
88
|
+
* - Runs `compact()` to evict stale historical entries
|
|
89
|
+
* - Returns the current result unchanged (compaction targets history)
|
|
90
|
+
*
|
|
91
|
+
* Priority 100 — runs after most other post-hooks.
|
|
92
|
+
*
|
|
93
|
+
* Returns both the middleware and the underlying engine so the engine
|
|
94
|
+
* can be shared with the compaction pipeline (IMP-08 Tier 1).
|
|
95
|
+
*/
|
|
96
|
+
export declare function createMicrocompactMiddleware(options?: MicrocompactOptions): MicrocompactMiddlewareResult;
|
|
97
|
+
//# sourceMappingURL=microcompact.d.ts.map
|