agentic-qe 3.8.13 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +48 -0
- package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
- package/dist/audit/witness-chain.js +15 -3
- package/dist/boot/fast-paths.d.ts +24 -0
- package/dist/boot/fast-paths.js +43 -0
- package/dist/boot/parallel-prefetch.d.ts +26 -0
- package/dist/boot/parallel-prefetch.js +36 -0
- package/dist/cli/bundle.js +12 -9431
- package/dist/cli/chunks/adapter-WBR5NXS3.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-PQYB7VRU.js +2 -0
- package/dist/cli/chunks/agent-handler-QDAB5NQS.js +33 -0
- package/dist/cli/chunks/aqe-learning-engine-TK4JQCGT.js +2 -0
- package/dist/cli/chunks/audit-S7JUYYVP.js +3 -0
- package/dist/cli/chunks/base-2WXOSMBQ.js +2 -0
- package/dist/cli/chunks/better-sqlite3-7KY2RDXO.js +2 -0
- package/dist/cli/chunks/brain-handler-PPEGDCN4.js +68 -0
- package/dist/cli/chunks/branch-enumerator-XK4V5W7L.js +7 -0
- package/dist/cli/chunks/browser-PALA5PL3.js +4 -0
- package/dist/cli/chunks/browser-workflow-42F7GK5T.js +2 -0
- package/dist/cli/chunks/chunk-24FKIJNC.js +15 -0
- package/dist/cli/chunks/chunk-263XS447.js +2 -0
- package/dist/cli/chunks/chunk-2BZFNEN2.js +4 -0
- package/dist/cli/chunks/chunk-2E5NQNSU.js +180 -0
- package/dist/cli/chunks/chunk-2I7J3O6V.js +2 -0
- package/dist/cli/chunks/chunk-3ADGXLTM.js +14 -0
- package/dist/cli/chunks/chunk-3IHG3WOY.js +12 -0
- package/dist/cli/chunks/chunk-3IUNFTIF.js +2 -0
- package/dist/cli/chunks/chunk-3JPRUND5.js +2 -0
- package/dist/cli/chunks/chunk-3NZLZHJI.js +2 -0
- package/dist/cli/chunks/chunk-3THRQEZ2.js +95 -0
- package/dist/cli/chunks/chunk-3ZOONQG6.js +2 -0
- package/dist/cli/chunks/chunk-4B6NCELM.js +2 -0
- package/dist/cli/chunks/chunk-4I2IOUS4.js +2 -0
- package/dist/cli/chunks/chunk-4VBTXZRM.js +2 -0
- package/dist/cli/chunks/chunk-4VUPRTVX.js +3 -0
- package/dist/cli/chunks/chunk-4YOMLWEK.js +70 -0
- package/dist/cli/chunks/chunk-4YS3IJ45.js +2 -0
- package/dist/cli/chunks/chunk-5SKGFSKD.js +2 -0
- package/dist/cli/chunks/chunk-5T2ZQWKF.js +27 -0
- package/dist/cli/chunks/chunk-62ADTHV7.js +2 -0
- package/dist/cli/chunks/chunk-6EOS7KX2.js +2 -0
- package/dist/cli/chunks/chunk-6SVX4DJC.js +6 -0
- package/dist/cli/chunks/chunk-72WOAVK6.js +2 -0
- package/dist/cli/chunks/chunk-7R6YMLVS.js +3 -0
- package/dist/cli/chunks/chunk-7VDBAVTY.js +2 -0
- package/dist/cli/chunks/chunk-AFLLQ5PP.js +15 -0
- package/dist/cli/chunks/chunk-AKE543X2.js +2 -0
- package/dist/cli/chunks/chunk-B36CDR4U.js +2 -0
- package/dist/cli/chunks/chunk-B6LLWYQ6.js +2 -0
- package/dist/cli/chunks/chunk-BDIEMZ22.js +91 -0
- package/dist/cli/chunks/chunk-BGXNSCXX.js +4 -0
- package/dist/cli/chunks/chunk-BLBRY5UD.js +2 -0
- package/dist/cli/chunks/chunk-BPWXXEH2.js +3029 -0
- package/dist/cli/chunks/chunk-BR26T7ZS.js +180 -0
- package/dist/cli/chunks/chunk-BTREG4IW.js +2 -0
- package/dist/cli/chunks/chunk-BULKFVYX.js +2 -0
- package/dist/cli/chunks/chunk-BXAXGEFC.js +24 -0
- package/dist/cli/chunks/chunk-CL6POIX4.js +2 -0
- package/dist/cli/chunks/chunk-CS2KS7LP.js +2 -0
- package/dist/cli/chunks/chunk-CWFB6BSA.js +316 -0
- package/dist/cli/chunks/chunk-DRT3WKQW.js +2 -0
- package/dist/cli/chunks/chunk-EHDQJQ6Y.js +27 -0
- package/dist/cli/chunks/chunk-ESVQ6MEB.js +2 -0
- package/dist/cli/chunks/chunk-FEKY7T6Q.js +2 -0
- package/dist/cli/chunks/chunk-FGA7VIFR.js +7 -0
- package/dist/cli/chunks/chunk-FIA6X7UL.js +2 -0
- package/dist/cli/chunks/chunk-GAOJV3OX.js +2 -0
- package/dist/cli/chunks/chunk-GKNNSCLC.js +5 -0
- package/dist/cli/chunks/chunk-GPQ57KA4.js +2 -0
- package/dist/cli/chunks/chunk-GRUUQAR6.js +2 -0
- package/dist/cli/chunks/chunk-HRO6OZQD.js +2 -0
- package/dist/cli/chunks/chunk-HY6PMO5W.js +66 -0
- package/dist/cli/chunks/chunk-IAV2JMIX.js +167 -0
- package/dist/cli/chunks/chunk-IFNIIK34.js +21 -0
- package/dist/cli/chunks/chunk-IGJPMN4I.js +3 -0
- package/dist/cli/chunks/chunk-J3KWWR6Z.js +1 -0
- package/dist/cli/chunks/chunk-JBANAPWG.js +2 -0
- package/dist/cli/chunks/chunk-JJO7Y4H3.js +604 -0
- package/dist/cli/chunks/chunk-JRYGQO2W.js +2 -0
- package/dist/cli/chunks/chunk-JXM26HEE.js +2 -0
- package/dist/cli/chunks/chunk-JZSDOIXA.js +2 -0
- package/dist/cli/chunks/chunk-KP5NUODU.js +3 -0
- package/dist/cli/chunks/chunk-LHJQD2VU.js +750 -0
- package/dist/cli/chunks/chunk-LNQIY6BP.js +2 -0
- package/dist/cli/chunks/chunk-MDUHYUHF.js +2 -0
- package/dist/cli/chunks/chunk-MV6CMOJQ.js +65 -0
- package/dist/cli/chunks/chunk-MZOFWJTM.js +2 -0
- package/dist/cli/chunks/chunk-N2NS2PHA.js +45 -0
- package/dist/cli/chunks/chunk-N4TL73TH.js +314 -0
- package/dist/cli/chunks/chunk-N5UXCLFI.js +2 -0
- package/dist/cli/chunks/chunk-NZ2VCPN4.js +2 -0
- package/dist/cli/chunks/chunk-OF4D7MYI.js +2 -0
- package/dist/cli/chunks/chunk-OI5NGQO2.js +2 -0
- package/dist/cli/chunks/chunk-OLHKGP35.js +2 -0
- package/dist/cli/chunks/chunk-QOVHWZEP.js +1 -0
- package/dist/cli/chunks/chunk-RFSN6IDA.js +79 -0
- package/dist/cli/chunks/chunk-RTGGL7D7.js +4 -0
- package/dist/cli/chunks/chunk-RU5WAHB7.js +3 -0
- package/dist/cli/chunks/chunk-SUSEVMZT.js +2 -0
- package/dist/cli/chunks/chunk-TLHP5EII.js +2 -0
- package/dist/cli/chunks/chunk-TWUWL5EJ.js +2 -0
- package/dist/cli/chunks/chunk-U5RN7YQW.js +2 -0
- package/dist/cli/chunks/chunk-UFUVUO3J.js +2 -0
- package/dist/cli/chunks/chunk-UQHYFOBX.js +16 -0
- package/dist/cli/chunks/chunk-VOS4NQSF.js +2 -0
- package/dist/cli/chunks/chunk-VSVXUTJN.js +256 -0
- package/dist/cli/chunks/chunk-WBQSXPBI.js +2 -0
- package/dist/cli/chunks/chunk-WGMPEW2T.js +2 -0
- package/dist/cli/chunks/chunk-WIEC7VKK.js +2 -0
- package/dist/cli/chunks/chunk-WJ3DLOXF.js +14 -0
- package/dist/cli/chunks/chunk-X3KI6JOY.js +9 -0
- package/dist/cli/chunks/chunk-X5IJGWYG.js +2 -0
- package/dist/cli/chunks/chunk-XIBDETCS.js +146 -0
- package/dist/cli/chunks/chunk-XLRQYLWW.js +2 -0
- package/dist/cli/chunks/chunk-XO6PVK2P.js +3 -0
- package/dist/cli/chunks/chunk-XRE2HCWG.js +3 -0
- package/dist/cli/chunks/chunk-XT2V2322.js +2 -0
- package/dist/cli/chunks/chunk-Y7BHKZFJ.js +18 -0
- package/dist/cli/chunks/chunk-YAGODYIG.js +59 -0
- package/dist/cli/chunks/chunk-YANUP2RO.js +2 -0
- package/dist/cli/chunks/chunk-YPFOCNOE.js +30 -0
- package/dist/cli/chunks/chunk-YR6ZZGH7.js +81 -0
- package/dist/cli/chunks/chunk-YVA65UZL.js +2 -0
- package/dist/cli/chunks/chunk-YW2THB5Q.js +2 -0
- package/dist/cli/chunks/chunk-ZAPS3UGQ.js +20 -0
- package/dist/cli/chunks/chunk-ZDATDCYN.js +2 -0
- package/dist/cli/chunks/ci-J374KDLI.js +81 -0
- package/dist/cli/chunks/ci-output-7JN7F6CI.js +2 -0
- package/dist/cli/chunks/claude-flow-setup-245JLJCN.js +2 -0
- package/dist/cli/chunks/client-MCSNSH2C.js +2 -0
- package/dist/cli/chunks/cline-installer-LBA2M5N3.js +4 -0
- package/dist/cli/chunks/code-U4N4WONM.js +38 -0
- package/dist/cli/chunks/code-index-extractor-A57Z6BO4.js +3 -0
- package/dist/cli/chunks/codex-installer-UXMK2N4T.js +8 -0
- package/dist/cli/chunks/completions-W66BSCOE.js +1364 -0
- package/dist/cli/chunks/complexity-analyzer-AB4OZARV.js +2 -0
- package/dist/cli/chunks/continuedev-installer-LRFZ2SJM.js +14 -0
- package/dist/cli/chunks/copilot-installer-CQ3JYBIB.js +3 -0
- package/dist/cli/chunks/cost-tracker-4F723RB6.js +2 -0
- package/dist/cli/chunks/coverage-4PUEQXAY.js +27 -0
- package/dist/cli/chunks/cross-domain-router-OWR5IJ5G.js +2 -0
- package/dist/cli/chunks/cursor-installer-JZEDEDHA.js +3 -0
- package/dist/cli/chunks/daemon-B7TWGHXQ.js +19 -0
- package/dist/cli/chunks/dag-attention-scheduler-JWO6XI6A.js +2 -0
- package/dist/cli/chunks/detect-L6ZZHUSX.js +2 -0
- package/dist/cli/chunks/domain-handler-FT5FLZWL.js +25 -0
- package/dist/cli/chunks/domain-transfer-5Y4FGJAJ.js +2 -0
- package/dist/cli/chunks/dream-4TDBIYED.js +2 -0
- package/dist/cli/chunks/esm-node-2PKHKOTS.js +2 -0
- package/dist/cli/chunks/eval-GHMPFGWV.js +15 -0
- package/dist/cli/chunks/fast-paths-B3R647KN.js +2 -0
- package/dist/cli/chunks/feature-flags-DWS7ARSX.js +2 -0
- package/dist/cli/chunks/feature-flags-IVQ3AL4Q.js +2 -0
- package/dist/cli/chunks/file-discovery-QFPA6GMV.js +2 -0
- package/dist/cli/chunks/fleet-EKOKMOMW.js +43 -0
- package/dist/cli/chunks/gnn-wrapper-OYC55N5E.js +2 -0
- package/dist/cli/chunks/heartbeat-handler-MBBS4IBU.js +48 -0
- package/dist/cli/chunks/heartbeat-scheduler-XDGMOT7X.js +2 -0
- package/dist/cli/chunks/hnsw-index-YO7CT23I.js +2 -0
- package/dist/cli/chunks/hnswlib-node-56YWVXFE.js +2 -0
- package/dist/cli/chunks/hooks-L5VLZGEK.js +101 -0
- package/dist/cli/chunks/hypergraph-engine-A4Y2ZRAG.js +2 -0
- package/dist/cli/chunks/hypergraph-handler-3HDGB5SZ.js +35 -0
- package/dist/cli/chunks/impact-analyzer-UEIGXSZ4.js +2 -0
- package/dist/cli/chunks/init-handler-JDET6WUN.js +68 -0
- package/dist/cli/chunks/init-wizard-JWZUGIPJ.js +2 -0
- package/dist/cli/chunks/kernel-YNDTVKIW.js +2 -0
- package/dist/cli/chunks/kilocode-installer-GZZG5AFW.js +4 -0
- package/dist/cli/chunks/kiro-installer-IWNY5TKH.js +74 -0
- package/dist/cli/chunks/knowledge-graph-NGJKFTSN.js +2 -0
- package/dist/cli/chunks/learning-722ZNSZ6.js +107 -0
- package/dist/cli/chunks/llm-router-DNAV746L.js +30 -0
- package/dist/cli/chunks/load-Y3GCUFM4.js +2 -0
- package/dist/cli/chunks/load-test-GZUBXFF3.js +2 -0
- package/dist/cli/chunks/mcp-LKPIBZ3W.js +2 -0
- package/dist/cli/chunks/memory-L57MLFOP.js +32 -0
- package/dist/cli/chunks/memory-backend-3NQIZUXE.js +2 -0
- package/dist/cli/chunks/memory-handlers-MDZQ7HVW.js +2 -0
- package/dist/cli/chunks/opencode-installer-4HUB36H5.js +3 -0
- package/dist/cli/chunks/orchestrator-QHSBB2UC.js +371 -0
- package/dist/cli/chunks/pipeline-D3QER35Z.js +19 -0
- package/dist/cli/chunks/platform-T4E7Q3RD.js +2 -0
- package/dist/cli/chunks/plugin-JHW2YPRC.js +27 -0
- package/dist/cli/chunks/prime-radiant-advanced-wasm-G7CFNNQV.js +2 -0
- package/dist/cli/chunks/protocol-executor-SPUVRDWT.js +2 -0
- package/dist/cli/chunks/protocol-handler-2BQQ4HDM.js +20 -0
- package/dist/cli/chunks/prove-UQ6JFT73.js +3 -0
- package/dist/cli/chunks/qe-reasoning-bank-3HBK2FVD.js +2 -0
- package/dist/cli/chunks/quality-JRZYMC77.js +7 -0
- package/dist/cli/chunks/queen-coordinator-RW3NKO5A.js +2 -0
- package/dist/cli/chunks/real-embeddings-GK63VF35.js +2 -0
- package/dist/cli/chunks/roocode-installer-F4E2LAYR.js +4 -0
- package/dist/cli/chunks/router-RJGHWDQ3.js +2 -0
- package/dist/cli/chunks/routing-feedback-ZXBXFKX6.js +2 -0
- package/dist/cli/chunks/routing-handler-VNKFUUGB.js +20 -0
- package/dist/cli/chunks/ruvector-commands-2TLNHC3A.js +8 -0
- package/dist/cli/chunks/rvf-dual-writer-MQW2SJLT.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-LKFKTMUN.js +2 -0
- package/dist/cli/chunks/safe-db-G22E5ROA.js +2 -0
- package/dist/cli/chunks/schedule-Y7VVCPYV.js +2 -0
- package/dist/cli/chunks/scheduler-AUQIFQB7.js +2 -0
- package/dist/cli/chunks/security-EBEG2OPU.js +14 -0
- package/dist/cli/chunks/shared-rvf-dual-writer-BVSCQAFS.js +2 -0
- package/dist/cli/chunks/sqlite-persistence-JAVHUGGL.js +2 -0
- package/dist/cli/chunks/status-handler-VZ32M4G4.js +45 -0
- package/dist/cli/chunks/structural-health-K6LRCKV6.js +2 -0
- package/dist/cli/chunks/sync-MHSHNLIM.js +23 -0
- package/dist/cli/chunks/task-handler-JNOIBZ2G.js +49 -0
- package/dist/cli/chunks/task-handlers-P5DSUKND.js +2 -0
- package/dist/cli/chunks/test-DO22BNIL.js +33 -0
- package/dist/cli/chunks/test-scheduling-VLRQZEFL.js +15 -0
- package/dist/cli/chunks/token-bootstrap-4VJKGVMK.js +2 -0
- package/dist/cli/chunks/token-usage-LG3PXRXH.js +25 -0
- package/dist/cli/chunks/transformers-GY7SIKEU.js +2 -0
- package/dist/cli/chunks/tree-sitter-wasm-parser-FT2KB66N.js +2 -0
- package/dist/cli/chunks/types-QJGNBKP2.js +2 -0
- package/dist/cli/chunks/unified-memory-XYGENQUT.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-MVEGQBF3.js +2 -0
- package/dist/cli/chunks/unified-persistence-PFRCWEUG.js +2 -0
- package/dist/cli/chunks/validate-VQCRSVNQ.js +21 -0
- package/dist/cli/chunks/validate-swarm-A5DHAWTP.js +14 -0
- package/dist/cli/chunks/vibium-RZBSL4EB.js +2 -0
- package/dist/cli/chunks/visual-security-V47BLGJM.js +2 -0
- package/dist/cli/chunks/web-tree-sitter-7C4NXEOF.js +2 -0
- package/dist/cli/chunks/windsurf-installer-ES3KPQG3.js +7 -0
- package/dist/cli/chunks/witness-chain-BR63P4A7.js +2 -0
- package/dist/cli/chunks/workflow-JETHX4ML.js +51 -0
- package/dist/cli/chunks/workflow-orchestrator-7PZMX3JZ.js +2 -0
- package/dist/cli/chunks/wrappers-WP5RH745.js +2 -0
- package/dist/cli/commands/daemon.d.ts +13 -0
- package/dist/cli/commands/daemon.js +224 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
- package/dist/cli/commands/plugin.d.ts +12 -0
- package/dist/cli/commands/plugin.js +135 -0
- package/dist/cli/commands/workflow.d.ts +10 -0
- package/dist/cli/commands/workflow.js +587 -0
- package/dist/cli/handlers/brain-handler.js +13 -8
- package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
- package/dist/cli/handlers/heartbeat-handler.js +20 -10
- package/dist/cli/handlers/hypergraph-handler.js +3 -3
- package/dist/cli/handlers/init-handler.js +10 -9
- package/dist/cli/handlers/interfaces.d.ts +4 -4
- package/dist/cli/index.js +159 -638
- package/dist/cli/lazy-registry.d.ts +27 -0
- package/dist/cli/lazy-registry.js +70 -0
- package/dist/context/compaction/context-budget.d.ts +71 -0
- package/dist/context/compaction/context-budget.js +120 -0
- package/dist/context/compaction/index.d.ts +96 -0
- package/dist/context/compaction/index.js +259 -0
- package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
- package/dist/context/compaction/llm-caller-adapter.js +47 -0
- package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
- package/dist/context/compaction/tier1-microcompact.js +47 -0
- package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
- package/dist/context/compaction/tier2-session-summary.js +172 -0
- package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
- package/dist/context/compaction/tier3-llm-compact.js +166 -0
- package/dist/context/compaction/tier4-reactive.d.ts +54 -0
- package/dist/context/compaction/tier4-reactive.js +129 -0
- package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
- package/dist/coordination/consensus/providers/claude-provider.js +23 -3
- package/dist/domains/test-generation/generators/base-test-generator.d.ts +1 -1
- package/dist/domains/test-generation/generators/base-test-generator.js +11 -11
- package/dist/domains/test-generation/generators/go-test-generator.js +12 -12
- package/dist/domains/test-generation/generators/junit5-generator.js +9 -9
- package/dist/domains/test-generation/generators/kotlin-junit-generator.js +10 -10
- package/dist/domains/test-generation/generators/pytest-generator.js +8 -8
- package/dist/domains/test-generation/generators/swift-testing-generator.js +8 -8
- package/dist/domains/test-generation/generators/test-value-helpers.d.ts +20 -0
- package/dist/domains/test-generation/generators/test-value-helpers.js +48 -0
- package/dist/domains/test-generation/generators/xunit-generator.js +11 -11
- package/dist/hooks/cross-phase-hooks.d.ts +11 -0
- package/dist/hooks/cross-phase-hooks.js +73 -9
- package/dist/hooks/security/config-snapshot.d.ts +21 -0
- package/dist/hooks/security/config-snapshot.js +33 -0
- package/dist/hooks/security/exit-codes.d.ts +28 -0
- package/dist/hooks/security/exit-codes.js +33 -0
- package/dist/hooks/security/index.d.ts +15 -0
- package/dist/hooks/security/index.js +15 -0
- package/dist/hooks/security/ssrf-guard.d.ts +25 -0
- package/dist/hooks/security/ssrf-guard.js +69 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/init/init-wizard-hooks.js +15 -1
- package/dist/init/phases/07-hooks.js +2 -2
- package/dist/init/settings-merge.js +3 -7
- package/dist/kernel/kernel.js +35 -0
- package/dist/kernel/memory-backend.js +3 -1
- package/dist/mcp/bundle.js +416 -362
- package/dist/mcp/entry.js +132 -77
- package/dist/mcp/http-server.js +4 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/middleware/batch-executor.d.ts +46 -0
- package/dist/mcp/middleware/batch-executor.js +150 -0
- package/dist/mcp/middleware/microcompact.d.ts +97 -0
- package/dist/mcp/middleware/microcompact.js +179 -0
- package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
- package/dist/mcp/middleware/middleware-chain.js +60 -0
- package/dist/mcp/protocol-server.d.ts +16 -0
- package/dist/mcp/protocol-server.js +140 -36
- package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
- package/dist/mcp/services/session-durability-middleware.js +64 -0
- package/dist/mcp/services/session-resume.d.ts +29 -0
- package/dist/mcp/services/session-resume.js +221 -0
- package/dist/mcp/services/session-store.d.ts +84 -0
- package/dist/mcp/services/session-store.js +163 -0
- package/dist/mcp/tool-registry.d.ts +9 -0
- package/dist/mcp/tool-registry.js +30 -1
- package/dist/mcp/types.d.ts +1 -0
- package/dist/plugins/cache.d.ts +44 -0
- package/dist/plugins/cache.js +149 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +15 -0
- package/dist/plugins/lifecycle.d.ts +67 -0
- package/dist/plugins/lifecycle.js +175 -0
- package/dist/plugins/manifest.d.ts +45 -0
- package/dist/plugins/manifest.js +173 -0
- package/dist/plugins/resolver.d.ts +37 -0
- package/dist/plugins/resolver.js +80 -0
- package/dist/plugins/security.d.ts +23 -0
- package/dist/plugins/security.js +125 -0
- package/dist/plugins/sources/github.d.ts +17 -0
- package/dist/plugins/sources/github.js +77 -0
- package/dist/plugins/sources/local.d.ts +20 -0
- package/dist/plugins/sources/local.js +32 -0
- package/dist/plugins/sources/npm.d.ts +18 -0
- package/dist/plugins/sources/npm.js +82 -0
- package/dist/shared/llm/retry.d.ts +5 -2
- package/dist/shared/llm/retry.js +7 -3
- package/dist/shared/prompt-cache-latch.d.ts +41 -0
- package/dist/shared/prompt-cache-latch.js +63 -0
- package/dist/shared/retry-engine.d.ts +77 -0
- package/dist/shared/retry-engine.js +194 -0
- package/dist/workers/daemon.d.ts +8 -0
- package/dist/workers/daemon.js +13 -0
- package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
- package/dist/workers/quality-daemon/ci-monitor.js +147 -0
- package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
- package/dist/workers/quality-daemon/coverage-delta.js +135 -0
- package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
- package/dist/workers/quality-daemon/git-watcher.js +209 -0
- package/dist/workers/quality-daemon/index.d.ts +119 -0
- package/dist/workers/quality-daemon/index.js +343 -0
- package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
- package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
- package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
- package/dist/workers/quality-daemon/notification-service.js +178 -0
- package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
- package/dist/workers/quality-daemon/persistent-memory.js +30 -0
- package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
- package/dist/workers/quality-daemon/priority-queue.js +126 -0
- package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
- package/dist/workers/quality-daemon/test-suggester.js +121 -0
- package/dist/workers/worker-manager.js +2 -1
- package/package.json +1 -1
- package/dist/mcp/server.d.ts +0 -46
- package/dist/mcp/server.js +0 -802
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{g}from"./chunk-YAGODYIG.js";import{b as p,c as d}from"./chunk-3ZOONQG6.js";import{f as h}from"./chunk-SUSEVMZT.js";import{b as m,c as f}from"./chunk-JZSDOIXA.js";f();var I={maxDepth:5,riskWeights:{directImpact:.4,transitiveImpact:.2,testCoverage:.2,criticalPath:.15,dependencyCount:.05},testPatterns:["**/*.test.ts","**/*.test.tsx","**/*.spec.ts","**/*.spec.tsx","**/test_*.py","**/*_test.py","**/*_test.go"],criticalPaths:["**/auth/**","**/security/**","**/payment/**","**/api/**","**/core/**"],namespace:"code-intelligence:impact"},u=class{constructor(e,t,i={}){this.memory=e;this.config={...I,...i},this.knowledgeGraph=t||new g(e)}config;knowledgeGraph;async analyzeImpact(e){try{let{changedFiles:t,depth:i=this.config.maxDepth,includeTests:n=!0}=e;if(t.length===0)return p({directImpact:[],transitiveImpact:[],impactedTests:[],riskLevel:"info",recommendations:[]});let r=await this.analyzeDirectImpact(t),l=await this.analyzeTransitiveImpact(t,r,i),s=[];if(n){let a=await this.getImpactedTests(t);a.success&&(s=a.value)}let c={directImpact:r,transitiveImpact:l,impactedTests:s,riskLevel:"info",recommendations:[]};return c.riskLevel=this.calculateRiskLevel(c),c.recommendations=this.getRecommendations(c),await this.storeAnalysis(t,c),p(c)}catch(t){return d(m(t))}}async getImpactedTests(e){try{let t=new Set;for(let i of e){if(this.isTestFile(i)){t.add(i);continue}let n=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:3});if(n.success)for(let s of n.value.nodes)this.isTestFile(s.path)&&t.add(s.path);let r=this.getBaseName(i),l=[`${r}.test`,`${r}.spec`,`test_${r}`,`${r}_test`];for(let s of l){let c=await this.memory.search(`code-intelligence:kg:node:*${s}*`,10);for(let a of c){let o=await this.memory.get(a);o?.properties?.path&&this.isTestFile(o.properties.path)&&t.add(o.properties.path)}}}return p(Array.from(t))}catch(t){return d(m(t))}}calculateRiskLevel(e){let t=this.config.riskWeights,i=0,n=Math.min(1,e.directImpact.length/10);i+=n*t.directImpact;let r=Math.min(1,e.transitiveImpact.length/20);i+=r*t.transitiveImpact;let l=e.impactedTests.length>0?Math.max(0,1-e.impactedTests.length/(e.directImpact.length||1)):1;i+=l*t.testCoverage;let s=this.countCriticalFiles([...e.directImpact.map(o=>o.file),...e.transitiveImpact.map(o=>o.file)]),c=Math.min(1,s/5);i+=c*t.criticalPath;let a=this.calculateAverageRiskScore([...e.directImpact,...e.transitiveImpact]);return i+=a*t.dependencyCount,i>=.8?"critical":i>=.6?"high":i>=.4?"medium":i>=.2?"low":"info"}getRecommendations(e){let t=[];(e.riskLevel==="critical"||e.riskLevel==="high")&&t.push("This change has significant impact - consider peer review before merging"),e.impactedTests.length===0&&e.directImpact.length>0?t.push("No tests found for impacted files - add test coverage"):e.impactedTests.length<e.directImpact.length/2&&t.push("Test coverage appears low for impacted files"),e.impactedTests.length>0&&(e.impactedTests.length<=10?t.push(`Run these ${e.impactedTests.length} tests: ${e.impactedTests.slice(0,3).join(", ")}${e.impactedTests.length>3?"...":""}`):t.push(`Run all ${e.impactedTests.length} impacted tests before deployment`));let i=[...e.directImpact,...e.transitiveImpact].filter(r=>this.isCriticalPath(r.file));i.length>0&&t.push(`${i.length} critical path files affected - extra scrutiny recommended`),e.transitiveImpact.length>10&&t.push("Large transitive impact - consider breaking down into smaller changes");let n=[...e.directImpact,...e.transitiveImpact].filter(r=>r.riskScore>=.7);return n.length>0&&t.push(`${n.length} high-risk files impacted: ${n.slice(0,2).map(r=>this.getFileName(r.file)).join(", ")}`),t}async analyzeDirectImpact(e){let t=[];for(let i of e){let n=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:1});if(n.success){let{nodes:r,edges:l}=n.value;for(let s of r){if(s.path===i)continue;let c=l.find(o=>o.target===s.id||o.source===s.id),a=this.calculateFileRiskScore(s.path,s.inDegree,s.outDegree);t.push({file:s.path,reason:`Directly ${c?.type||"depends on"} ${this.getFileName(i)}`,distance:1,riskScore:a})}}}return this.deduplicateImpact(t)}async analyzeTransitiveImpact(e,t,i){let n=[],r=new Set([...e,...t.map(s=>s.file)]),l=t.map(s=>({file:s.file,distance:1}));for(;l.length>0;){let s=l.shift();if(s.distance>=i)continue;let c=await this.knowledgeGraph.mapDependencies({files:[s.file],direction:"incoming",depth:1});if(c.success)for(let a of c.value.nodes){if(r.has(a.path)||a.path===s.file)continue;r.add(a.path);let o=this.calculateFileRiskScore(a.path,a.inDegree,a.outDegree,s.distance+1);n.push({file:a.path,reason:`Transitively depends via ${this.getFileName(s.file)}`,distance:s.distance+1,riskScore:o}),l.push({file:a.path,distance:s.distance+1})}}return this.deduplicateImpact(n)}calculateFileRiskScore(e,t,i,n=1){let r=0;return r+=Math.min(.3,t/20),r+=Math.min(.2,i/30),this.isCriticalPath(e)&&(r+=.3),this.isEntryPoint(e)&&(r+=.2),r=r*Math.pow(.8,n-1),Math.min(1,Math.max(0,r))}calculateAverageRiskScore(e){return e.length===0?0:e.reduce((i,n)=>i+n.riskScore,0)/e.length}countCriticalFiles(e){return e.filter(t=>this.isCriticalPath(t)).length}isTestFile(e){return[/\.test\.[tj]sx?$/,/\.spec\.[tj]sx?$/,/_test\.[tj]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/].some(i=>i.test(e))}isCriticalPath(e){return this.config.criticalPaths.map(i=>i.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*")).some(i=>new RegExp(i).test(e))}isEntryPoint(e){return[/\/index\.[tj]sx?$/,/\/main\.[tj]sx?$/,/\/app\.[tj]sx?$/,/^src\/[^/]+\.[tj]sx?$/,/\/server\.[tj]sx?$/,/\/__init__\.py$/,/\/main\.go$/].some(i=>i.test(e))}getBaseName(e){return this.getFileName(e).replace(/\.[^.]+$/,"")}getFileName(e){return e.split(/[/\\]/).pop()||e}deduplicateImpact(e){let t=new Map;for(let i of e){let n=t.get(i.file);(!n||i.distance<n.distance)&&t.set(i.file,i)}return Array.from(t.values()).sort((i,n)=>n.riskScore!==i.riskScore?n.riskScore-i.riskScore:i.distance-n.distance)}async storeAnalysis(e,t){let i=h();await this.memory.set(`${this.config.namespace}:analysis:${i}`,{id:i,changedFiles:e,analysis:t,timestamp:new Date().toISOString()},{namespace:this.config.namespace,persist:!0})}};export{u as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{c as t,e as o}from"./chunk-4I2IOUS4.js";var L={};o(L,{DotProductAttention:()=>d,FlashAttention:()=>u,HyperbolicAttention:()=>f,LinearAttention:()=>h,MoEAttention:()=>_,MultiHeadAttention:()=>A,RuvectorLayer:()=>a,SonaEngine:()=>b,TensorCompress:()=>c,default:()=>n,differentiableSearch:()=>l,getCompressionLevel:()=>p,hierarchicalForward:()=>s,init:()=>m,pipeline:()=>q});import{createRequire as r}from"module";var i,e,n,a,c,l,s,p,m,u,d,A,f,h,_,b,q,g=t(()=>{i=r(import.meta.url),e=i("better-sqlite3"),n=e,{RuvectorLayer:a,TensorCompress:c,differentiableSearch:l,hierarchicalForward:s,getCompressionLevel:p,init:m,FlashAttention:u,DotProductAttention:d,MultiHeadAttention:A,HyperbolicAttention:f,LinearAttention:h,MoEAttention:_,SonaEngine:b,pipeline:q}=e||{}});export{n as a,a as b,c,l as d,s as e,p as f,m as g,u as h,d as i,A as j,f as k,h as l,_ as m,b as n,q as o,L as p,g as q};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{a as B}from"./chunk-JRYGQO2W.js";import{f as T}from"./chunk-SUSEVMZT.js";import{M as te,b as $}from"./chunk-2I7J3O6V.js";import{d as O,f as ee}from"./chunk-4I2IOUS4.js";var R=O(d=>{var ae=d&&d.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)s.hasOwnProperty(i)&&(n[i]=s[i])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(d,"__esModule",{value:!0});var oe=Object.prototype.hasOwnProperty;function J(t,e){return oe.call(t,e)}d.hasOwnProperty=J;function Y(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r<e.length;r++)e[r]=""+r;return e}if(Object.keys)return Object.keys(t);var n=[];for(var s in t)J(t,s)&&n.push(s);return n}d._objectKeys=Y;function pe(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}d._deepClone=pe;function ce(t){for(var e=0,r=t.length,n;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}d.isInteger=ce;function b(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}d.escapePathComponent=b;function le(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}d.unescapePathComponent=le;function F(t,e){var r;for(var n in t)if(J(t,n)){if(t[n]===e)return b(n)+"/";if(typeof t[n]=="object"&&(r=F(t[n],e),r!=""))return b(n)+"/"+r}return""}d._getPathRecursive=F;function he(t,e){if(t===e)return"/";var r=F(t,e);if(r==="")throw new Error("Object not found in root");return"/"+r}d.getPath=he;function L(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)if(L(t[e]))return!0}else if(typeof t=="object"){for(var n=Y(t),s=n.length,i=0;i<s;i++)if(L(t[n[i]]))return!0}}return!1}d.hasUndefined=L;function W(t,e){var r=[t];for(var n in e){var s=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof s<"u"&&r.push(n+": "+s)}return r.join(`
|
|
3
|
+
`)}var fe=(function(t){ae(e,t);function e(r,n,s,i,a){var c=this.constructor,h=t.call(this,W(r,{name:n,index:s,operation:i,tree:a}))||this;return h.name=n,h.index=s,h.operation=i,h.tree=a,Object.setPrototypeOf(h,c.prototype),h.message=W(r,{name:n,index:s,operation:i,tree:a}),h}return e})(Error);d.PatchError=fe});var x=O(l=>{Object.defineProperty(l,"__esModule",{value:!0});var m=R();l.JsonPatchError=m.PatchError;l.deepClone=m._deepClone;var y={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){var n=N(r,this.path);n&&(n=m._deepClone(n));var s=g(r,{op:"remove",path:this.from}).removed;return g(r,{op:"add",path:this.path,value:s}),{newDocument:r,removed:n}},copy:function(t,e,r){var n=N(r,this.from);return g(r,{op:"add",path:this.path,value:m._deepClone(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:P(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},ue={add:function(t,e,r){return m.isInteger(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:y.move,copy:y.copy,test:y.test,_get:y._get};function N(t,e){if(e=="")return t;var r={op:"_get",path:e};return g(t,r),r.value}l.getValueByPointer=N;function g(t,e,r,n,s,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),s===void 0&&(s=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(e,0,t,e.path):D(e,0)),e.path===""){var a={newDocument:t};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=t,a;if(e.op==="move"||e.op==="copy")return a.newDocument=N(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=P(t,e.value),a.test===!1)throw new l.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a.newDocument=t,a}else{if(e.op==="remove")return a.removed=t,a.newDocument=null,a;if(e.op==="_get")return e.value=t,a;if(r)throw new l.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=m._deepClone(t));var c=e.path||"",h=c.split("/"),o=t,p=1,v=h.length,E=void 0,f=void 0,C=void 0;for(typeof r=="function"?C=r:C=D;;){if(f=h[p],f&&f.indexOf("~")!=-1&&(f=m.unescapePathComponent(f)),s&&(f=="__proto__"||f=="prototype"&&p>0&&h[p-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&E===void 0&&(o[f]===void 0?E=h.slice(0,p).join("/"):p==v-1&&(E=e.path),E!==void 0&&C(e,0,t,E)),p++,Array.isArray(o)){if(f==="-")f=o.length;else{if(r&&!m.isInteger(f))throw new l.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);m.isInteger(f)&&(f=~~f)}if(p>=v){if(r&&e.op==="add"&&f>o.length)throw new l.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);var a=ue[e.op].call(e,o,f,t);if(a.test===!1)throw new l.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a}}else if(p>=v){var a=y[e.op].call(e,o,f,t);if(a.test===!1)throw new l.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a}if(o=o[f],r&&p<v&&(!o||typeof o!="object"))throw new l.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}l.applyOperation=g;function K(t,e,r,n,s){if(n===void 0&&(n=!0),s===void 0&&(s=!0),r&&!Array.isArray(e))throw new l.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=m._deepClone(t));for(var i=new Array(e.length),a=0,c=e.length;a<c;a++)i[a]=g(t,e[a],r,!0,s,a),t=i[a].newDocument;return i.newDocument=t,i}l.applyPatch=K;function de(t,e,r){var n=g(t,e);if(n.test===!1)throw new l.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}l.applyReducer=de;function D(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new l.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(y[t.op]){if(typeof t.path!="string")throw new l.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new l.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new l.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new l.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&m.hasUndefined(t.value))throw new l.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var s=t.path.split("/").length,i=n.split("/").length;if(s!==i+1&&s!==i)throw new l.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new l.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var a={op:"_get",path:t.from,value:void 0},c=G([a],r);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new l.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new l.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}l.validator=D;function G(t,e,r){try{if(!Array.isArray(t))throw new l.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)K(m._deepClone(e),m._deepClone(t),r||!0);else{r=r||D;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(s){if(s instanceof l.JsonPatchError)return s;throw s}}l.validate=G;function P(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),s,i,a;if(r&&n){if(i=t.length,i!=e.length)return!1;for(s=i;s--!==0;)if(!P(t[s],e[s]))return!1;return!0}if(r!=n)return!1;var c=Object.keys(t);if(i=c.length,i!==Object.keys(e).length)return!1;for(s=i;s--!==0;)if(!e.hasOwnProperty(c[s]))return!1;for(s=i;s--!==0;)if(a=c[s],!P(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}l._areEquals=P});var Q=O(_=>{Object.defineProperty(_,"__esModule",{value:!0});var u=R(),ve=x(),M=new WeakMap,me=(function(){function t(e){this.observers=new Map,this.obj=e}return t})(),Ee=(function(){function t(e,r){this.callback=e,this.observer=r}return t})();function ge(t){return M.get(t)}function we(t,e){return t.observers.get(e)}function ye(t,e){t.observers.delete(e.callback)}function _e(t,e){e.unobserve()}_.unobserve=_e;function Pe(t,e){var r=[],n,s=ge(t);if(!s)s=new me(t),M.set(t,s);else{var i=we(s,e);n=i&&i.observer}if(n)return n;if(n={},s.value=u._deepClone(t),e){n.callback=e,n.next=null;var a=function(){U(n)},c=function(){clearTimeout(n.next),n.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=r,n.object=t,n.unobserve=function(){U(n),clearTimeout(n.next),ye(s,n),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},s.observers.set(e,new Ee(e,n)),n}_.observe=Pe;function U(t,e){e===void 0&&(e=!1);var r=M.get(t.object);H(r.value,t.object,t.patches,"",e),t.patches.length&&ve.applyPatch(r.value,t.patches);var n=t.patches;return n.length>0&&(t.patches=[],t.callback&&t.callback(n)),n}_.generate=U;function H(t,e,r,n,s){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=u._objectKeys(e),a=u._objectKeys(t),c=!1,h=!1,o=a.length-1;o>=0;o--){var p=a[o],v=t[p];if(u.hasOwnProperty(e,p)&&!(e[p]===void 0&&v!==void 0&&Array.isArray(e)===!1)){var E=e[p];typeof v=="object"&&v!=null&&typeof E=="object"&&E!=null&&Array.isArray(v)===Array.isArray(E)?H(v,E,r,n+"/"+u.escapePathComponent(p),s):v!==E&&(c=!0,s&&r.push({op:"test",path:n+"/"+u.escapePathComponent(p),value:u._deepClone(v)}),r.push({op:"replace",path:n+"/"+u.escapePathComponent(p),value:u._deepClone(E)}))}else Array.isArray(t)===Array.isArray(e)?(s&&r.push({op:"test",path:n+"/"+u.escapePathComponent(p),value:u._deepClone(v)}),r.push({op:"remove",path:n+"/"+u.escapePathComponent(p)}),h=!0):(s&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),c=!0)}if(!(!h&&i.length==a.length))for(var o=0;o<i.length;o++){var p=i[o];!u.hasOwnProperty(t,p)&&e[p]!==void 0&&r.push({op:"add",path:n+"/"+u.escapePathComponent(p),value:u._deepClone(e[p])})}}}function Ae(t,e,r){r===void 0&&(r=!1);var n=[];return H(t,e,n,"",r),n}_.compare=Ae});var j=O(w=>{var Oe=x();Object.assign(w,Oe);var Te=Q();Object.assign(w,Te);var S=R();w.JsonPatchError=S.PatchError;w.deepClone=S._deepClone;w.escapePathComponent=S.escapePathComponent;w.unescapePathComponent=S.unescapePathComponent});var re=1e4,ne=2166136261;function se(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}var q=new Uint8Array(256);for(let t=0;t<256;t++){let e=0,r=t;for(;r;)e++,r&=r-1;q[t]=e}var X="0123456789abcdef";function ie(t){let e=Math.min(t.length,16),r="";for(let n=0;n<e;n++){let s=t[n];r+=X[s>>4]+X[s&15]}return r}var I=class{dimensions;baseSeed;constructor(e){if(this.dimensions=e?.dimensions??re,this.baseSeed=e?.seed??ne,this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}fingerprint(e){let r=`${e.id}|${e.domain}|${e.type}|${e.content??""}`,n=se(r)^this.baseSeed,s=this.generateVector(n);return{vector:s,dimensions:this.dimensions,hash:ie(s)}}compositionalBind(e,r){if(e.length!==r.length)throw new Error(`Cannot bind vectors of different lengths: ${e.length} vs ${r.length}`);let n=new Uint8Array(e.length);for(let s=0;s<e.length;s++)n[s]=e[s]^r[s];return n}hammingDistance(e,r){if(e.length!==r.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${e.length} vs ${r.length}`);let n=0;for(let s=0;s<e.length;s++)n+=q[e[s]^r[s]];return n}similarity(e,r){return 1-this.hammingDistance(e,r)/this.dimensions}batchFingerprint(e){return e.map(r=>this.fingerprint(r))}generateVector(e){let r=Math.ceil(this.dimensions/8),n=new Uint8Array(r),s=new B(e),i=0;for(;i<r;){let c=s.next(),h=r-i,o=h<4?h:4;for(let p=0;p<o;p++)n[i++]=c>>>p*8&255}let a=this.dimensions%8;return a>0&&(n[r-1]&=(1<<a)-1),n}};function be(t){return new I(t)}var A=ee(j(),1),Re=`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS pattern_deltas (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
pattern_id TEXT NOT NULL,
|
|
7
|
+
version INTEGER NOT NULL,
|
|
8
|
+
timestamp INTEGER NOT NULL,
|
|
9
|
+
type TEXT NOT NULL CHECK (type IN ('genesis', 'update', 'rollback')),
|
|
10
|
+
patch TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
reverse_patch TEXT NOT NULL DEFAULT '[]',
|
|
12
|
+
metadata TEXT
|
|
13
|
+
);
|
|
14
|
+
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_pid_version
|
|
15
|
+
ON pattern_deltas (pattern_id, version);
|
|
16
|
+
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_timestamp
|
|
17
|
+
ON pattern_deltas (timestamp);
|
|
18
|
+
`;function Z(t,e){let r=A.compare(t,e),n=A.compare(e,t);return{forward:r,reverse:n}}function Ne(t,e){let r=JSON.parse(JSON.stringify(t));return A.applyPatch(r,e).newDocument}function V(t){return{id:t.id,patternId:t.pattern_id,version:t.version,timestamp:t.timestamp,type:t.type,patch:JSON.parse(t.patch),reversePatch:JSON.parse(t.reverse_patch),metadata:t.metadata?JSON.parse(t.metadata):void 0}}var k=class{db;config;prepared=new Map;initialized=!1;constructor(e,r){this.db=e,this.config={maxVersionsPerPattern:r?.maxVersionsPerPattern??100,compressDeltas:r?.compressDeltas??!1}}initialize(){this.initialized||(this.db.exec(Re),this.prepareStatements(),this.initialized=!0)}prepareStatements(){this.prepared.set("insert",this.db.prepare(`
|
|
19
|
+
INSERT INTO pattern_deltas (id, pattern_id, version, timestamp, type, patch, reverse_patch, metadata)
|
|
20
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
21
|
+
`)),this.prepared.set("getHistory",this.db.prepare(`
|
|
22
|
+
SELECT * FROM pattern_deltas
|
|
23
|
+
WHERE pattern_id = ?
|
|
24
|
+
ORDER BY version ASC
|
|
25
|
+
`)),this.prepared.set("currentVersion",this.db.prepare(`
|
|
26
|
+
SELECT MAX(version) as max_version FROM pattern_deltas
|
|
27
|
+
WHERE pattern_id = ?
|
|
28
|
+
`)),this.prepared.set("incrementalSync",this.db.prepare(`
|
|
29
|
+
SELECT * FROM pattern_deltas
|
|
30
|
+
WHERE timestamp > ?
|
|
31
|
+
ORDER BY timestamp ASC
|
|
32
|
+
`)),this.prepared.set("countForPattern",this.db.prepare(`
|
|
33
|
+
SELECT COUNT(*) as cnt FROM pattern_deltas
|
|
34
|
+
WHERE pattern_id = ?
|
|
35
|
+
`)),this.prepared.set("deleteOldest",this.db.prepare(`
|
|
36
|
+
DELETE FROM pattern_deltas
|
|
37
|
+
WHERE pattern_id = ? AND version IN (
|
|
38
|
+
SELECT version FROM pattern_deltas
|
|
39
|
+
WHERE pattern_id = ?
|
|
40
|
+
ORDER BY version ASC
|
|
41
|
+
LIMIT ?
|
|
42
|
+
)
|
|
43
|
+
`))}ensureInitialized(){if(!this.initialized)throw new Error("DeltaTracker not initialized. Call initialize() first.")}createGenesis(e,r,n){this.ensureInitialized();let s=this.getCurrentVersion(e);if(s>=0)throw new Error(`Genesis already exists for pattern ${e} (current version: ${s})`);let i={id:T(),patternId:e,version:0,timestamp:Date.now(),type:"genesis",patch:[],reversePatch:[],metadata:{...n,snapshot:r}};return this.insertEvent(i),i}recordDelta(e,r,n,s){this.ensureInitialized();let i=this.getCurrentVersion(e);if(i<0)throw new Error(`No genesis found for pattern ${e}. Call createGenesis() first.`);let{forward:a,reverse:c}=Z(r,n),h={id:T(),patternId:e,version:i+1,timestamp:Date.now(),type:"update",patch:a,reversePatch:c,metadata:s};return this.insertEvent(h),this.enforceRetention(e),h}rollback(e,r){this.ensureInitialized();let n=this.getHistory(e);if(n.length===0)throw new Error(`No history found for pattern ${e}`);let s=n[n.length-1].version;if(r<0||r>s)throw new Error(`Invalid rollback version ${r}. Valid range: 0-${s}`);if(r===s)return this.reconstructState(n,s);let i=this.reconstructState(n,r),a=this.reconstructState(n,s),{forward:c,reverse:h}=Z(a,i),o={id:T(),patternId:e,version:s+1,timestamp:Date.now(),type:"rollback",patch:c,reversePatch:h,metadata:{rolledBackTo:r}};return this.insertEvent(o),this.enforceRetention(e),i}getHistory(e){return this.ensureInitialized(),this.prepared.get("getHistory").all(e).map(V)}incrementalSync(e){return this.ensureInitialized(),this.prepared.get("incrementalSync").all(e).map(V)}getCurrentVersion(e){return this.ensureInitialized(),this.prepared.get("currentVersion").get(e).max_version??-1}insertEvent(e){this.prepared.get("insert").run(e.id,e.patternId,e.version,e.timestamp,e.type,JSON.stringify(e.patch),JSON.stringify(e.reversePatch),e.metadata?JSON.stringify(e.metadata):null)}reconstructState(e,r){let n=e.find(i=>i.type==="genesis");if(!n||!n.metadata?.snapshot)throw new Error("Cannot reconstruct state: no genesis snapshot found");let s=JSON.parse(JSON.stringify(n.metadata.snapshot));for(let i of e)if(i.version!==0){if(i.version>r)break;s=Ne(s,i.patch)}return s}enforceRetention(e){let{maxVersionsPerPattern:r}=this.config,s=this.prepared.get("countForPattern").get(e).cnt;if(s>r){let i=s-r;this.db.prepare(`DELETE FROM pattern_deltas
|
|
44
|
+
WHERE pattern_id = ? AND version != 0 AND id IN (
|
|
45
|
+
SELECT id FROM pattern_deltas
|
|
46
|
+
WHERE pattern_id = ? AND version != 0
|
|
47
|
+
ORDER BY version ASC
|
|
48
|
+
LIMIT ?
|
|
49
|
+
)`).run(e,e,i)}}};te();var De=128,Se=8,Ce=1e4,z=class{dimension;beta;maxPatterns;patterns;constructor(e){if(this.dimension=e?.dimension??De,this.beta=e?.beta??Se,this.maxPatterns=e?.maxPatterns??Ce,this.patterns=[],this.dimension<=0)throw new Error(`Hopfield dimension must be positive, got ${this.dimension}`);if(this.beta<=0)throw new Error(`Hopfield beta must be positive, got ${this.beta}`);if(this.maxPatterns<=0)throw new Error(`Hopfield maxPatterns must be positive, got ${this.maxPatterns}`)}store(e,r){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Pattern dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.dotProduct(e,e)===0)throw new Error("Cannot store zero-magnitude pattern in Hopfield memory");let s=this.normalize(e);this.patterns.length>=this.maxPatterns&&this.patterns.shift(),this.patterns.push({pattern:s,metadata:r??{},storedAt:Date.now()})}recall(e){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Query dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.patterns.length===0)return null;let r=this.normalize(e),n=new Float32Array(this.patterns.length);for(let p=0;p<this.patterns.length;p++)n[p]=this.beta*this.dotProduct(this.patterns[p].pattern,r);let s=this.softmax(n),i=0,a=s[0];for(let p=1;p<s.length;p++)s[p]>a&&(a=s[p],i=p);let c=this.patterns[i],h=this.getEnergy(r),o=this.cosineSimilarity(r,c.pattern);return{pattern:new Float32Array(c.pattern),metadata:{...c.metadata},energy:h,similarity:o}}batchRecall(e){return this.assertEnabled(),e.map(r=>this.recall(r))}getPatternCount(){return this.patterns.length}clear(){this.patterns.length=0}getEnergy(e){if(e.length!==this.dimension)throw new Error(`State dimension mismatch: expected ${this.dimension}, got ${e.length}`);let r=this.normalize(e);if(this.patterns.length===0)return .5*this.dotProduct(r,r);let n=new Float32Array(this.patterns.length);for(let o=0;o<this.patterns.length;o++)n[o]=this.dotProduct(this.patterns[o].pattern,r);let s=new Float32Array(this.patterns.length),i=-1/0;for(let o=0;o<this.patterns.length;o++)s[o]=this.beta*n[o],s[o]>i&&(i=s[o]);let a=0;for(let o=0;o<this.patterns.length;o++)a+=Math.exp(s[o]-i);let c=1/this.beta*(i+Math.log(a)),h=this.dotProduct(r,r);return-c+.5*h}softmax(e){let r=new Float32Array(e.length),n=-1/0;for(let i=0;i<e.length;i++)e[i]>n&&(n=e[i]);let s=0;for(let i=0;i<e.length;i++)r[i]=Math.exp(e[i]-n),s+=r[i];if(s>0)for(let i=0;i<r.length;i++)r[i]/=s;return r}dotProduct(e,r){let n=0;for(let s=0;s<e.length;s++)n+=e[s]*r[s];return n}cosineSimilarity(e,r){let n=this.dotProduct(e,r),s=Math.sqrt(this.dotProduct(e,e)),i=Math.sqrt(this.dotProduct(r,r));return s===0||i===0?0:n/(s*i)}normalize(e){let r=Math.sqrt(this.dotProduct(e,e)),n=new Float32Array(e.length);if(r>0)for(let s=0;s<e.length;s++)n[s]=e[s]/r;return n}assertEnabled(){if(!$().useHopfieldMemory)throw new Error("Hopfield memory is disabled (useHopfieldMemory feature flag is false)")}};function $e(t){return new z(t)}export{be as a,k as b,$e as c};
|
|
50
|
+
/*! Bundled license information:
|
|
51
|
+
|
|
52
|
+
fast-json-patch/commonjs/helpers.js:
|
|
53
|
+
(*!
|
|
54
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
55
|
+
* (c) 2017-2022 Joachim Wester
|
|
56
|
+
* MIT licensed
|
|
57
|
+
*)
|
|
58
|
+
|
|
59
|
+
fast-json-patch/commonjs/duplex.js:
|
|
60
|
+
(*!
|
|
61
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
62
|
+
* (c) 2017-2021 Joachim Wester
|
|
63
|
+
* MIT license
|
|
64
|
+
*)
|
|
65
|
+
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{d as l,f as i}from"./chunk-NZ2VCPN4.js";import{a as r,c as g}from"./chunk-JZSDOIXA.js";g();var c=class extends i{config={name:"qe/tests/schedule",description:"Schedule and execute tests using phase-based pipeline with git-aware selection and flaky tracking. Runs tests in phases (unit, integration, e2e), selects affected tests from git changes, and tracks flaky tests.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{cwd:{type:"string",description:"Working directory for test execution (defaults to project root)"},gitRef:{type:"string",description:'Git ref to compare for affected test selection (e.g., "main", "HEAD~3")'},useGitAware:{type:"boolean",description:"Enable git-aware test selection to only run affected tests",default:!0},trackFlaky:{type:"boolean",description:"Enable flaky test tracking and quarantine",default:!0}}}}async execute(s,o){try{let{runTestPipeline:n}=await import("./test-scheduling-VLRQZEFL.js"),d=await l(o),t=await n({cwd:s.cwd||process.cwd(),memory:d,baseRef:s.gitRef,flakyHistoryPath:s.trackFlaky!==!1?".agentic-qe/flaky-history.json":void 0,runAllTests:s.useGitAware===!1}),u=t.phaseResults.reduce((e,a)=>e+a.totalTests,0),f=t.phaseResults.reduce((e,a)=>e+a.passed,0),p=t.phaseResults.reduce((e,a)=>e+a.failed,0);return{success:!0,data:{pipelineId:o.requestId,phases:t.phaseResults.map(e=>({phaseId:e.phaseId,phaseName:e.phaseName,totalTests:e.totalTests,passed:e.passed,failed:e.failed,passRate:e.passRate,durationMs:e.durationMs})),gitAware:{enabled:!t.ranAllTests,selectedTests:t.selectedTests.length,gitRef:s.gitRef},flakyTracking:{enabled:s.trackFlaky!==!1},totalDuration:t.totalDurationMs,ranAllTests:t.ranAllTests,summary:`Executed ${t.phaseResults.length} phases, ${u} tests (${f} passed, ${p} failed) in ${t.totalDurationMs}ms`}}}catch(n){return{success:!1,error:r(n)}}}};export{c as a};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{c as t}from"./chunk-4I2IOUS4.js";function o(e){try{return e.prepare(`
|
|
3
|
+
SELECT COUNT(*) as count FROM sqlite_master
|
|
4
|
+
WHERE type='table' AND name IN ('hypergraph_nodes', 'hypergraph_edges')
|
|
5
|
+
`).get().count===2}catch{return!1}}var r,a,E,n,p=t(()=>{"use strict";r=`
|
|
6
|
+
-- Hypergraph nodes (functions, modules, tests, files, classes)
|
|
7
|
+
CREATE TABLE IF NOT EXISTS hypergraph_nodes (
|
|
8
|
+
id TEXT PRIMARY KEY,
|
|
9
|
+
type TEXT NOT NULL, -- 'function', 'module', 'test', 'file', 'class'
|
|
10
|
+
name TEXT NOT NULL,
|
|
11
|
+
file_path TEXT,
|
|
12
|
+
line_start INTEGER,
|
|
13
|
+
line_end INTEGER,
|
|
14
|
+
complexity REAL,
|
|
15
|
+
coverage REAL,
|
|
16
|
+
metadata TEXT, -- JSON
|
|
17
|
+
embedding BLOB, -- Vector embedding
|
|
18
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
19
|
+
updated_at TEXT DEFAULT (datetime('now'))
|
|
20
|
+
);
|
|
21
|
+
`,a=`
|
|
22
|
+
-- Hypergraph edges (relationships)
|
|
23
|
+
CREATE TABLE IF NOT EXISTS hypergraph_edges (
|
|
24
|
+
id TEXT PRIMARY KEY,
|
|
25
|
+
source_id TEXT NOT NULL REFERENCES hypergraph_nodes(id),
|
|
26
|
+
target_id TEXT NOT NULL REFERENCES hypergraph_nodes(id),
|
|
27
|
+
type TEXT NOT NULL, -- 'calls', 'imports', 'tests', 'depends_on', 'covers'
|
|
28
|
+
weight REAL DEFAULT 1.0,
|
|
29
|
+
properties TEXT, -- JSON
|
|
30
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
31
|
+
UNIQUE(source_id, target_id, type)
|
|
32
|
+
);
|
|
33
|
+
`,E=`
|
|
34
|
+
-- Indexes for fast traversal
|
|
35
|
+
CREATE INDEX IF NOT EXISTS idx_hg_nodes_type ON hypergraph_nodes(type);
|
|
36
|
+
CREATE INDEX IF NOT EXISTS idx_hg_nodes_file ON hypergraph_nodes(file_path);
|
|
37
|
+
CREATE INDEX IF NOT EXISTS idx_hg_nodes_name ON hypergraph_nodes(name);
|
|
38
|
+
CREATE INDEX IF NOT EXISTS idx_hg_edges_source ON hypergraph_edges(source_id);
|
|
39
|
+
CREATE INDEX IF NOT EXISTS idx_hg_edges_target ON hypergraph_edges(target_id);
|
|
40
|
+
CREATE INDEX IF NOT EXISTS idx_hg_edges_type ON hypergraph_edges(type);
|
|
41
|
+
`,n=`
|
|
42
|
+
${r}
|
|
43
|
+
${a}
|
|
44
|
+
${E}
|
|
45
|
+
`});export{r as a,a as b,E as c,n as d,o as e,p as f};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{a as k,b as q,c as G,d as D}from"./chunk-YPFOCNOE.js";import{d as V}from"./chunk-VSVXUTJN.js";import{a as W}from"./chunk-X5IJGWYG.js";import{a as P}from"./chunk-EHDQJQ6Y.js";import{b as x,f as z,i as j}from"./chunk-4YS3IJ45.js";import{b as T,c as S}from"./chunk-3ZOONQG6.js";import{a as F}from"./chunk-3JPRUND5.js";import{c as E}from"./chunk-4VUPRTVX.js";import{a as h,b as L,c as M}from"./chunk-JZSDOIXA.js";import{M as Y,b as B}from"./chunk-2I7J3O6V.js";F();M();var A={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var R=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
|
|
3
|
+
describe('{{methodName}}', () => {
|
|
4
|
+
it('should {{expectedBehavior}}', {{async}} () => {
|
|
5
|
+
// Arrange
|
|
6
|
+
{{arrangeCode}}
|
|
7
|
+
|
|
8
|
+
// Act
|
|
9
|
+
{{actCode}}
|
|
10
|
+
|
|
11
|
+
// Assert
|
|
12
|
+
{{assertCode}}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});`,variables:[{name:"className",type:"string",required:!0,description:"Class under test"},{name:"methodName",type:"string",required:!0,description:"Method under test"},{name:"expectedBehavior",type:"string",required:!0,description:"Expected behavior in plain English"},{name:"async",type:"string",required:!1,defaultValue:"",description:"async keyword if needed"},{name:"arrangeCode",type:"code",required:!0,description:"Setup code"},{name:"actCode",type:"code",required:!0,description:"Action code"},{name:"assertCode",type:"code",required:!0,description:"Assertion code"}]},context:{testType:"unit",tags:["unit-test","aaa","arrange-act-assert","best-practice"]}},{patternType:"mock-pattern",name:"Dependency Mock",description:"Pattern for mocking external dependencies in tests",template:{type:"code",content:`const mock{{DependencyName}} = {
|
|
16
|
+
{{mockMethods}}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
vi.mock('{{modulePath}}', () => ({
|
|
20
|
+
{{DependencyName}}: vi.fn(() => mock{{DependencyName}}),
|
|
21
|
+
}));`,variables:[{name:"DependencyName",type:"string",required:!0,description:"Name of dependency to mock"},{name:"modulePath",type:"string",required:!0,description:"Module path to mock"},{name:"mockMethods",type:"code",required:!0,description:"Mock method implementations"}]},context:{framework:"vitest",testType:"unit",tags:["mock","vitest","dependency-injection"]}},{patternType:"coverage-strategy",name:"Risk-Based Coverage",description:"Prioritize coverage by code risk and complexity",template:{type:"prompt",content:`Analyze coverage gaps for {{targetPath}} with focus on:
|
|
22
|
+
1. Critical business logic paths
|
|
23
|
+
2. Error handling branches
|
|
24
|
+
3. Edge cases and boundary conditions
|
|
25
|
+
4. High-complexity functions (cyclomatic complexity > 10)
|
|
26
|
+
|
|
27
|
+
Risk scoring:
|
|
28
|
+
- Critical: Business logic, auth, payments
|
|
29
|
+
- High: Data validation, external integrations
|
|
30
|
+
- Medium: Internal utilities, helpers
|
|
31
|
+
- Low: Config, constants`,variables:[{name:"targetPath",type:"string",required:!0,description:"Path to analyze"}]},context:{tags:["coverage","risk-based","prioritization"]}},{patternType:"flaky-fix",name:"Timing-Based Flakiness",description:"Fix flaky tests caused by timing issues",template:{type:"prompt",content:`The test {{testName}} is flaky due to timing issues.
|
|
32
|
+
|
|
33
|
+
Common fixes:
|
|
34
|
+
1. Replace setTimeout with explicit waits
|
|
35
|
+
2. Use waitFor or waitForCondition
|
|
36
|
+
3. Mock time-dependent functions
|
|
37
|
+
4. Increase timeouts for async operations
|
|
38
|
+
5. Add retry logic with exponential backoff
|
|
39
|
+
|
|
40
|
+
Check for:
|
|
41
|
+
- Race conditions in async code
|
|
42
|
+
- Missing await keywords
|
|
43
|
+
- Shared state between tests
|
|
44
|
+
- External service dependencies`,variables:[{name:"testName",type:"string",required:!0,description:"Name of flaky test"}]},context:{tags:["flaky","timing","async","stability"]}},{patternType:"assertion-pattern",qeDomain:"quality-assessment",name:"Quality Gate Checklist",description:"Evaluate deployment readiness against quality gate criteria",template:{type:"prompt",content:`Quality gate evaluation for {{targetModule}}:
|
|
45
|
+
|
|
46
|
+
1. Test coverage >= {{coverageThreshold}}%
|
|
47
|
+
2. No critical/high severity bugs open
|
|
48
|
+
3. All P1 tests passing
|
|
49
|
+
4. Performance benchmarks within SLA (p95 < {{latencyThresholdMs}}ms)
|
|
50
|
+
5. Security scan clean (no critical CVEs)
|
|
51
|
+
6. Code review approved
|
|
52
|
+
|
|
53
|
+
Fail the gate if ANY criterion is unmet. Report which criteria passed/failed.`,variables:[{name:"targetModule",type:"string",required:!0,description:"Module or service to evaluate"},{name:"coverageThreshold",type:"number",required:!1,defaultValue:80,description:"Minimum coverage %"},{name:"latencyThresholdMs",type:"number",required:!1,defaultValue:500,description:"P95 latency limit in ms"}]},context:{tags:["quality-gate","deployment","readiness","sla"]},confidence:.6},{patternType:"assertion-pattern",qeDomain:"quality-assessment",name:"Metric Threshold Validator",description:"Validate quality metrics against configurable thresholds",template:{type:"code",content:`function validateMetrics(metrics: Record<string, number>, thresholds: Record<string, { min?: number; max?: number }>) {
|
|
54
|
+
const violations: string[] = [];
|
|
55
|
+
for (const [metric, value] of Object.entries(metrics)) {
|
|
56
|
+
const threshold = thresholds[metric];
|
|
57
|
+
if (!threshold) continue;
|
|
58
|
+
if (threshold.min !== undefined && value < threshold.min) {
|
|
59
|
+
violations.push(\`\${metric}: \${value} < min \${threshold.min}\`);
|
|
60
|
+
}
|
|
61
|
+
if (threshold.max !== undefined && value > threshold.max) {
|
|
62
|
+
violations.push(\`\${metric}: \${value} > max \${threshold.max}\`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { pass: violations.length === 0, violations };
|
|
66
|
+
}`,variables:[]},context:{tags:["metrics","threshold","validation","scoring"]},confidence:.6},{patternType:"error-handling",qeDomain:"defect-intelligence",name:"Root Cause Analysis Workflow",description:"Systematic root cause analysis for test failures and production incidents",template:{type:"prompt",content:`Root cause analysis for: {{incidentDescription}}
|
|
67
|
+
|
|
68
|
+
1. **Reproduce**: Confirm the failure is deterministic
|
|
69
|
+
2. **Isolate**: Narrow down to the smallest failing component
|
|
70
|
+
3. **Timeline**: When did it last pass? What changed since?
|
|
71
|
+
4. **Categorize**: Is it a code bug, config issue, data issue, or environment?
|
|
72
|
+
5. **Five Whys**: Ask why at least 5 times to reach the root cause
|
|
73
|
+
6. **Fix**: Propose fix with test to prevent regression
|
|
74
|
+
7. **Verify**: Run the fix and confirm the original failure is resolved`,variables:[{name:"incidentDescription",type:"string",required:!0,description:"Description of the failure or incident"}]},context:{tags:["root-cause","rca","debugging","incident"]},confidence:.6},{patternType:"error-handling",qeDomain:"defect-intelligence",name:"Regression Risk Scorer",description:"Score change risk for regression based on code complexity and history",template:{type:"prompt",content:`Regression risk assessment for {{changePath}}:
|
|
75
|
+
|
|
76
|
+
Risk factors (score each 0-3):
|
|
77
|
+
- Lines changed: {{linesChanged}} \u2192 complexity risk
|
|
78
|
+
- Files affected: {{filesAffected}} \u2192 blast radius
|
|
79
|
+
- Previous bugs in area: historical defect density
|
|
80
|
+
- Test coverage of changed code: gap risk
|
|
81
|
+
- Dependency depth: cascade risk
|
|
82
|
+
|
|
83
|
+
Total risk = sum / 15 \u2192 Low (<0.3), Medium (0.3-0.6), High (>0.6)`,variables:[{name:"changePath",type:"string",required:!0,description:"File or module changed"},{name:"linesChanged",type:"number",required:!0,description:"Number of lines changed"},{name:"filesAffected",type:"number",required:!0,description:"Number of files affected"}]},context:{tags:["regression","risk","prediction","change-analysis"]},confidence:.6},{patternType:"test-template",qeDomain:"requirements-validation",name:"Gherkin BDD Scenario",description:"Behavior-driven development scenario in Given/When/Then format",template:{type:"code",content:`Feature: {{featureName}}
|
|
84
|
+
|
|
85
|
+
Scenario: {{scenarioDescription}}
|
|
86
|
+
Given {{precondition}}
|
|
87
|
+
When {{action}}
|
|
88
|
+
Then {{expectedOutcome}}
|
|
89
|
+
|
|
90
|
+
Scenario: {{scenarioDescription}} - error case
|
|
91
|
+
Given {{precondition}}
|
|
92
|
+
When {{errorAction}}
|
|
93
|
+
Then {{errorOutcome}}`,variables:[{name:"featureName",type:"string",required:!0,description:"Feature under test"},{name:"scenarioDescription",type:"string",required:!0,description:"What the scenario validates"},{name:"precondition",type:"string",required:!0,description:"Given precondition"},{name:"action",type:"string",required:!0,description:"When action"},{name:"expectedOutcome",type:"string",required:!0,description:"Then expected result"},{name:"errorAction",type:"string",required:!0,description:"When error action"},{name:"errorOutcome",type:"string",required:!0,description:"Then error result"}]},context:{tags:["bdd","gherkin","requirements","acceptance"]},confidence:.6},{patternType:"test-template",qeDomain:"requirements-validation",name:"Acceptance Criteria Testability Check",description:"Evaluate whether acceptance criteria are testable and complete",template:{type:"prompt",content:`Testability assessment for: {{requirementId}} - {{requirementTitle}}
|
|
94
|
+
|
|
95
|
+
Acceptance criteria:
|
|
96
|
+
{{acceptanceCriteria}}
|
|
97
|
+
|
|
98
|
+
Evaluate each criterion:
|
|
99
|
+
1. **Observable**: Can we verify the outcome without internal knowledge?
|
|
100
|
+
2. **Measurable**: Is there a quantifiable threshold or clear pass/fail?
|
|
101
|
+
3. **Atomic**: Does each criterion test exactly one thing?
|
|
102
|
+
4. **Achievable**: Can this be tested with available tools?
|
|
103
|
+
5. **Complete**: Are edge cases and error paths covered?
|
|
104
|
+
|
|
105
|
+
Flag any untestable or ambiguous criteria with suggested rewrites.`,variables:[{name:"requirementId",type:"string",required:!0,description:"Requirement identifier"},{name:"requirementTitle",type:"string",required:!0,description:"Requirement title"},{name:"acceptanceCriteria",type:"string",required:!0,description:"The acceptance criteria text"}]},context:{tags:["requirements","testability","acceptance-criteria","validation"]},confidence:.6},{patternType:"refactor-safe",name:"Safe Refactoring Checklist",description:"Ensure refactoring preserves behavior with systematic safety checks",template:{type:"prompt",content:`Safe refactoring checklist for {{targetPath}}:
|
|
106
|
+
|
|
107
|
+
Before refactoring:
|
|
108
|
+
1. Run existing tests \u2014 capture baseline results
|
|
109
|
+
2. Check coverage of code being refactored
|
|
110
|
+
3. Identify all callers and dependents via references
|
|
111
|
+
|
|
112
|
+
During refactoring:
|
|
113
|
+
4. Make one semantic change at a time
|
|
114
|
+
5. Keep public API signatures stable (or update all callers)
|
|
115
|
+
6. Preserve error handling contracts
|
|
116
|
+
|
|
117
|
+
After refactoring:
|
|
118
|
+
7. Run full test suite \u2014 compare to baseline
|
|
119
|
+
8. Check for any new uncovered paths
|
|
120
|
+
9. Verify no unused imports or dead code introduced`,variables:[{name:"targetPath",type:"string",required:!0,description:"Path to refactor"}]},context:{tags:["refactor","safety","code-change","impact"]},confidence:.6},{patternType:"refactor-safe",name:"Dependency Impact Analysis",description:"Analyze the blast radius of a code change through the dependency graph",template:{type:"prompt",content:`Impact analysis for changes in {{changedFile}}:
|
|
121
|
+
|
|
122
|
+
1. Direct dependents: files that import/require {{changedFile}}
|
|
123
|
+
2. Transitive dependents: files that depend on direct dependents
|
|
124
|
+
3. Test coverage: which tests exercise the changed code?
|
|
125
|
+
4. Integration points: does this affect API contracts or events?
|
|
126
|
+
5. Risk tier: Critical (auth/payments) > High (business logic) > Medium (utils)
|
|
127
|
+
|
|
128
|
+
Output: sorted list of affected files with risk scores.`,variables:[{name:"changedFile",type:"string",required:!0,description:"File being changed"}]},context:{tags:["impact","dependency","blast-radius","analysis"]},confidence:.6},{patternType:"assertion-pattern",qeDomain:"security-compliance",name:"OWASP Top 10 Security Audit",description:"Check code against OWASP Top 10 vulnerability categories",template:{type:"prompt",content:`Security audit for {{targetPath}} against OWASP Top 10:
|
|
129
|
+
|
|
130
|
+
1. **A01 Broken Access Control**: Check authorization on every endpoint
|
|
131
|
+
2. **A02 Cryptographic Failures**: No plaintext secrets, proper hashing
|
|
132
|
+
3. **A03 Injection**: Parameterized queries, input sanitization
|
|
133
|
+
4. **A04 Insecure Design**: Threat modeling, least privilege
|
|
134
|
+
5. **A05 Security Misconfiguration**: Default creds, verbose errors
|
|
135
|
+
6. **A06 Vulnerable Components**: Check dependencies for CVEs
|
|
136
|
+
7. **A07 Auth Failures**: Brute force protection, session management
|
|
137
|
+
8. **A08 Data Integrity Failures**: Verify signatures, safe deserialization
|
|
138
|
+
9. **A09 Logging Failures**: Audit trail, no sensitive data in logs
|
|
139
|
+
10. **A10 SSRF**: Validate/allowlist outbound URLs
|
|
140
|
+
|
|
141
|
+
Flag findings as Critical/High/Medium/Low with remediation guidance.`,variables:[{name:"targetPath",type:"string",required:!0,description:"Code path to audit"}]},context:{tags:["owasp","security","audit","vulnerability"]},confidence:.6},{patternType:"assertion-pattern",qeDomain:"security-compliance",name:"Input Sanitization Pattern",description:"Validate and sanitize inputs at system boundaries to prevent injection",template:{type:"code",content:`// Input validation at system boundary
|
|
142
|
+
function validateInput(input: unknown, schema: {
|
|
143
|
+
type: 'string' | 'number' | 'boolean';
|
|
144
|
+
maxLength?: number;
|
|
145
|
+
pattern?: RegExp;
|
|
146
|
+
allowedValues?: unknown[];
|
|
147
|
+
}): { valid: boolean; sanitized: unknown; errors: string[] } {
|
|
148
|
+
const errors: string[] = [];
|
|
149
|
+
if (typeof input !== schema.type) {
|
|
150
|
+
errors.push(\`Expected \${schema.type}, got \${typeof input}\`);
|
|
151
|
+
return { valid: false, sanitized: null, errors };
|
|
152
|
+
}
|
|
153
|
+
if (schema.type === 'string') {
|
|
154
|
+
let str = input as string;
|
|
155
|
+
if (schema.maxLength && str.length > schema.maxLength) {
|
|
156
|
+
str = str.slice(0, schema.maxLength);
|
|
157
|
+
errors.push('Input truncated to max length');
|
|
158
|
+
}
|
|
159
|
+
if (schema.pattern && !schema.pattern.test(str)) {
|
|
160
|
+
errors.push('Input does not match expected pattern');
|
|
161
|
+
return { valid: false, sanitized: null, errors };
|
|
162
|
+
}
|
|
163
|
+
return { valid: errors.length === 0, sanitized: str, errors };
|
|
164
|
+
}
|
|
165
|
+
return { valid: true, sanitized: input, errors };
|
|
166
|
+
}`,variables:[]},context:{tags:["security","validation","sanitization","injection-prevention"]},confidence:.6},{patternType:"api-contract",name:"OpenAPI Contract Validator",description:"Validate API responses against OpenAPI/Swagger schema",template:{type:"code",content:`describe('{{apiEndpoint}} contract', () => {
|
|
167
|
+
it('should match the OpenAPI schema for {{operationId}}', async () => {
|
|
168
|
+
const response = await request(app).{{httpMethod}}('{{apiEndpoint}}');
|
|
169
|
+
expect(response.status).toBe({{expectedStatus}});
|
|
170
|
+
expect(response.body).toMatchSchema(openApiSpec.paths['{{apiEndpoint}}'].{{httpMethod}}.responses['{{expectedStatus}}'].content['application/json'].schema);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should return proper error for invalid input', async () => {
|
|
174
|
+
const response = await request(app).{{httpMethod}}('{{apiEndpoint}}').send({{invalidPayload}});
|
|
175
|
+
expect(response.status).toBe(400);
|
|
176
|
+
expect(response.body).toHaveProperty('errors');
|
|
177
|
+
});
|
|
178
|
+
});`,variables:[{name:"apiEndpoint",type:"string",required:!0,description:"API endpoint path"},{name:"operationId",type:"string",required:!0,description:"OpenAPI operation ID"},{name:"httpMethod",type:"string",required:!0,description:"HTTP method (get/post/put/delete)"},{name:"expectedStatus",type:"number",required:!0,description:"Expected HTTP status code"},{name:"invalidPayload",type:"object",required:!0,description:"Invalid request body for error case"}]},context:{tags:["api","contract","openapi","schema-validation"]},confidence:.6},{patternType:"api-contract",name:"Consumer-Driven Contract Test",description:"Pact-style consumer-driven contract testing between services",template:{type:"code",content:`// Consumer side contract
|
|
179
|
+
const pact = new Pact({
|
|
180
|
+
consumer: '{{consumerName}}',
|
|
181
|
+
provider: '{{providerName}}',
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe('{{consumerName}} -> {{providerName}} contract', () => {
|
|
185
|
+
beforeAll(() => pact.setup());
|
|
186
|
+
afterAll(() => pact.finalize());
|
|
187
|
+
|
|
188
|
+
it('should receive {{expectedResource}}', async () => {
|
|
189
|
+
await pact.addInteraction({
|
|
190
|
+
state: '{{providerState}}',
|
|
191
|
+
uponReceiving: '{{interactionDescription}}',
|
|
192
|
+
withRequest: { method: '{{httpMethod}}', path: '{{requestPath}}' },
|
|
193
|
+
willRespondWith: {
|
|
194
|
+
status: 200,
|
|
195
|
+
body: like({{expectedShape}}),
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const result = await client.{{clientMethod}}();
|
|
200
|
+
expect(result).toBeDefined();
|
|
201
|
+
});
|
|
202
|
+
});`,variables:[{name:"consumerName",type:"string",required:!0,description:"Consumer service name"},{name:"providerName",type:"string",required:!0,description:"Provider service name"},{name:"expectedResource",type:"string",required:!0,description:"Resource being consumed"},{name:"providerState",type:"string",required:!0,description:"Provider state precondition"},{name:"interactionDescription",type:"string",required:!0,description:"Interaction description"},{name:"httpMethod",type:"string",required:!0,description:"HTTP method"},{name:"requestPath",type:"string",required:!0,description:"Request path"},{name:"expectedShape",type:"object",required:!0,description:"Expected response shape"},{name:"clientMethod",type:"string",required:!0,description:"Client method to call"}]},context:{tags:["contract","pact","consumer-driven","microservice"]},confidence:.6},{patternType:"a11y-check",name:"WCAG Contrast and ARIA Check",description:"Validate WCAG 2.2 color contrast ratios and ARIA attribute correctness",template:{type:"prompt",content:`Accessibility audit for {{componentName}}:
|
|
203
|
+
|
|
204
|
+
WCAG 2.2 AA Compliance:
|
|
205
|
+
1. **Color Contrast**: Text contrast ratio >= 4.5:1 (normal), >= 3:1 (large)
|
|
206
|
+
2. **ARIA Roles**: All interactive elements have correct role attributes
|
|
207
|
+
3. **ARIA Labels**: Forms and buttons have aria-label or aria-labelledby
|
|
208
|
+
4. **Focus Management**: Tab order is logical, focus visible on all interactive elements
|
|
209
|
+
5. **Screen Reader**: Content is meaningful when linearized
|
|
210
|
+
6. **Keyboard**: All functionality accessible via keyboard alone
|
|
211
|
+
|
|
212
|
+
Test with: axe-core, pa11y, or lighthouse --accessibility`,variables:[{name:"componentName",type:"string",required:!0,description:"UI component to audit"}]},context:{tags:["wcag","accessibility","aria","contrast","a11y"]},confidence:.6},{patternType:"visual-baseline",name:"Visual Regression Baseline",description:"Capture and compare screenshots for visual regression detection",template:{type:"code",content:`describe('{{pageName}} visual regression', () => {
|
|
213
|
+
it('should match baseline screenshot', async () => {
|
|
214
|
+
await page.goto('{{pageUrl}}');
|
|
215
|
+
await page.waitForLoadState('networkidle');
|
|
216
|
+
|
|
217
|
+
const screenshot = await page.screenshot({ fullPage: {{fullPage}} });
|
|
218
|
+
expect(screenshot).toMatchSnapshot('{{pageName}}-baseline.png', {
|
|
219
|
+
maxDiffPixelRatio: {{maxDiffRatio}},
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('should match baseline at mobile viewport', async () => {
|
|
224
|
+
await page.setViewportSize({ width: 375, height: 812 });
|
|
225
|
+
await page.goto('{{pageUrl}}');
|
|
226
|
+
const screenshot = await page.screenshot({ fullPage: {{fullPage}} });
|
|
227
|
+
expect(screenshot).toMatchSnapshot('{{pageName}}-mobile-baseline.png', {
|
|
228
|
+
maxDiffPixelRatio: {{maxDiffRatio}},
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});`,variables:[{name:"pageName",type:"string",required:!0,description:"Page name for snapshot naming"},{name:"pageUrl",type:"string",required:!0,description:"Page URL to capture"},{name:"fullPage",type:"boolean",required:!1,defaultValue:!0,description:"Capture full page"},{name:"maxDiffRatio",type:"number",required:!1,defaultValue:.01,description:"Max pixel diff ratio"}]},context:{tags:["visual","screenshot","regression","baseline","playwright"]},confidence:.6},{patternType:"perf-benchmark",name:"Load Test Scenario",description:"k6-style load test with ramp-up stages and SLA assertions",template:{type:"code",content:`import http from 'k6/http';
|
|
232
|
+
import { check, sleep } from 'k6';
|
|
233
|
+
|
|
234
|
+
export const options = {
|
|
235
|
+
stages: [
|
|
236
|
+
{ duration: '{{rampUpDuration}}', target: {{peakUsers}} },
|
|
237
|
+
{ duration: '{{steadyDuration}}', target: {{peakUsers}} },
|
|
238
|
+
{ duration: '{{rampDownDuration}}', target: 0 },
|
|
239
|
+
],
|
|
240
|
+
thresholds: {
|
|
241
|
+
http_req_duration: ['p(95)<{{p95ThresholdMs}}'],
|
|
242
|
+
http_req_failed: ['rate<{{errorRateThreshold}}'],
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export default function () {
|
|
247
|
+
const res = http.get('{{targetUrl}}');
|
|
248
|
+
check(res, {
|
|
249
|
+
'status is 200': (r) => r.status === 200,
|
|
250
|
+
'response time < {{p95ThresholdMs}}ms': (r) => r.timings.duration < {{p95ThresholdMs}},
|
|
251
|
+
});
|
|
252
|
+
sleep(1);
|
|
253
|
+
}`,variables:[{name:"targetUrl",type:"string",required:!0,description:"Target URL to load test"},{name:"peakUsers",type:"number",required:!0,description:"Peak concurrent users"},{name:"rampUpDuration",type:"string",required:!1,defaultValue:"2m",description:"Ramp-up duration"},{name:"steadyDuration",type:"string",required:!1,defaultValue:"5m",description:"Steady state duration"},{name:"rampDownDuration",type:"string",required:!1,defaultValue:"1m",description:"Ramp-down duration"},{name:"p95ThresholdMs",type:"number",required:!1,defaultValue:500,description:"P95 latency threshold in ms"},{name:"errorRateThreshold",type:"number",required:!1,defaultValue:.01,description:"Max error rate (0-1)"}]},context:{tags:["load-test","k6","performance","sla"]},confidence:.6},{patternType:"perf-benchmark",name:"Circuit Breaker Resilience Test",description:"Test circuit breaker behavior under fault injection",template:{type:"prompt",content:`Resilience test for {{serviceName}} circuit breaker:
|
|
254
|
+
|
|
255
|
+
1. **Closed state**: Verify normal requests pass through
|
|
256
|
+
2. **Fault injection**: Inject {{faultType}} faults at {{faultRate}}% rate
|
|
257
|
+
3. **Trip threshold**: Verify breaker opens after {{failureThreshold}} consecutive failures
|
|
258
|
+
4. **Open state**: Verify requests fail fast (no upstream calls)
|
|
259
|
+
5. **Half-open probe**: After {{cooldownMs}}ms, verify single probe request
|
|
260
|
+
6. **Recovery**: On probe success, verify breaker closes and traffic resumes
|
|
261
|
+
7. **Metrics**: Verify circuit state changes are logged and observable`,variables:[{name:"serviceName",type:"string",required:!0,description:"Service with circuit breaker"},{name:"faultType",type:"string",required:!1,defaultValue:"latency",description:"Type of fault (latency/error/timeout)"},{name:"faultRate",type:"number",required:!1,defaultValue:50,description:"Fault injection rate %"},{name:"failureThreshold",type:"number",required:!1,defaultValue:5,description:"Failures to trip breaker"},{name:"cooldownMs",type:"number",required:!1,defaultValue:3e4,description:"Cooldown before half-open"}]},context:{tags:["chaos","circuit-breaker","resilience","fault-injection"]},confidence:.6},{patternType:"coverage-strategy",qeDomain:"learning-optimization",name:"Cross-Domain Pattern Transfer",description:"Strategy for transferring useful patterns from one QE domain to related domains",template:{type:"prompt",content:`Pattern transfer from {{sourceDomain}} to {{targetDomain}}:
|
|
262
|
+
|
|
263
|
+
1. Identify generalizable patterns in source domain (success rate > 70%)
|
|
264
|
+
2. Check domain compatibility (related domains get 80% relevance, unrelated 50%)
|
|
265
|
+
3. Adapt pattern context: replace domain-specific terms with target equivalents
|
|
266
|
+
4. Set transferred pattern confidence to source * compatibility factor
|
|
267
|
+
5. Store in target domain with provenance metadata
|
|
268
|
+
6. Track transfer outcomes to learn which transfers are valuable`,variables:[{name:"sourceDomain",type:"string",required:!0,description:"Source QE domain"},{name:"targetDomain",type:"string",required:!0,description:"Target QE domain"}]},context:{tags:["transfer","cross-domain","learning","pattern-reuse"]},confidence:.6},{patternType:"coverage-strategy",qeDomain:"learning-optimization",name:"Pattern Quality Promotion Pipeline",description:"Pipeline for promoting short-term patterns to long-term based on success evidence",template:{type:"prompt",content:`Pattern promotion evaluation for {{patternName}}:
|
|
269
|
+
|
|
270
|
+
Criteria (all must pass):
|
|
271
|
+
1. Usage count >= 3 successful applications
|
|
272
|
+
2. Success rate >= 70%
|
|
273
|
+
3. Confidence score >= 0.6
|
|
274
|
+
4. Coherence check: no contradiction with existing long-term patterns
|
|
275
|
+
5. Age: pattern has existed for at least 24 hours (not rushed)
|
|
276
|
+
|
|
277
|
+
On promotion:
|
|
278
|
+
- Move from short-term to long-term tier
|
|
279
|
+
- Boost confidence by 10%
|
|
280
|
+
- Enable for cross-domain transfer to related domains
|
|
281
|
+
- Mark as reusable for token savings optimization`,variables:[{name:"patternName",type:"string",required:!0,description:"Pattern to evaluate for promotion"}]},context:{tags:["promotion","learning","quality","pipeline"]},confidence:.6}];var w={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88,languages:["typescript","javascript"]},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}};function C(n,e,r,t,a=w,o){let i=[];for(let[c,s]of Object.entries(a)){let p=0,l=[],u=n.filter(m=>s.domains.includes(m)).length,d=u>0?u/n.length*.4:0;if(p+=d*t.similarity,d>0&&l.push(`Domain match: ${(d*100).toFixed(0)}%`),e&&e.length>0){let m=e.filter(I=>s.capabilities.some(v=>v.toLowerCase().includes(I.toLowerCase()))).length,y=m>0?m/e.length*.3:0;p+=y*t.capabilities,y>0&&l.push(`Capability match: ${(y*100).toFixed(0)}%`)}else p+=.15*t.capabilities;if(p+=s.performanceScore*.3*t.performance,l.push(`Performance score: ${(s.performanceScore*100).toFixed(0)}%`),o&&s.languages&&s.languages.length>0){let m=t.language??1,y=o.toLowerCase();if(s.languages.some(v=>v.toLowerCase()===y)){let v=.15*m;p+=v,l.push(`Language match: ${o}`)}}let f=r.get(c)||0;if(f>0){let m=Math.min(.1,f*.02);p+=m,l.push(`Pattern matches: ${f}`)}i.push({agent:c,score:p,reasoning:l})}return i.sort((c,s)=>s.score-c.score),i}var _={"test-generation":["test-execution","coverage-analysis","requirements-validation"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution","quality-assessment"],"quality-assessment":["test-execution","coverage-analysis","defect-intelligence"],"defect-intelligence":["quality-assessment","code-intelligence"],"requirements-validation":["test-generation","quality-assessment"],"code-intelligence":["defect-intelligence","security-compliance"],"security-compliance":["code-intelligence","quality-assessment"],"contract-testing":["test-generation","test-execution"],"visual-accessibility":["quality-assessment"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence"]};function U(n,e){if(n.length===e)return n;if(n.length>e){let r=n.length/e,t=new Array(e).fill(0);for(let a=0;a<e;a++){let o=Math.floor(a*r),i=Math.floor((a+1)*r),c=0;for(let s=o;s<i;s++)c+=n[s];t[a]=c/(i-o)}return Q(t)}else{let r=new Array(e).fill(0),t=(n.length-1)/(e-1);for(let a=0;a<e;a++){let o=a*t,i=Math.floor(o),c=Math.min(i+1,n.length-1),s=o-i;r[a]=n[i]*(1-s)+n[c]*s}return Q(r)}}function $(n,e){let r=new Array(e).fill(0),t=n.toLowerCase().trim();for(let a=0;a<3;a++)for(let o=0;o<t.length;o++){let i=t.charCodeAt(o),c=i*(o+1)*(a+1)%e;r[c]+=Math.sin(i*(a+1))/(o+1)}return Q(r)}function Q(n){let e=Math.sqrt(n.reduce((r,t)=>r+t*t,0));if(e>0)for(let r=0;r<n.length;r++)n[r]/=e;return n}F();M();Y();var b=E.create("PatternPromotion");async function X(n,e){let r=z(n);if(!r.meetsUsageCriteria||!r.meetsQualityCriteria)return!1;if(e.coherenceService&&e.coherenceService.isInitialized()){let t=await e.searchPatterns("",{tier:"long-term",limit:1e3}),i=[...t.success?t.value.map(s=>s.pattern):[],n].map(s=>({id:s.id,embedding:s.embedding||[],weight:s.confidence,metadata:{name:s.name,domain:s.qeDomain}})),c=await e.coherenceService.checkCoherence(i);if(c.energy>=e.coherenceThreshold){let s={patternId:n.id,patternName:n.name,reason:"coherence_violation",energy:c.energy,existingPatternConflicts:c.contradictions?.map(p=>p.nodeIds).flat()};return e.eventBus&&await e.eventBus.publish({id:`pattern-promotion-blocked-${n.id}`,type:"pattern:promotion_blocked",timestamp:new Date,source:"learning-optimization",payload:s}),b.info("Pattern promotion blocked due to coherence violation",{name:n.name,energy:c.energy}),!1}}return!0}async function H(n,e){let r=await e.patternStore.promote(n);if(r.success){try{e.getSqliteStore().promotePattern(n)}catch(t){b.warn("SQLite pattern promotion persist failed",{error:h(t)})}if(B().useSublinearSolver)try{let t=e.getSqliteStore().getDatabase?.();if(t){let a=new N(t),o=await e.getPattern(n);if(o){let i=await e.searchPatterns("",{domain:o.qeDomain,tier:"long-term",limit:20});if(i.success)for(let{pattern:c}of i.value)c.id!==n&&a.recordCoOccurrence(n,c.id)}}}catch(t){b.warn("Citation graph update failed (non-fatal)",{error:h(t)})}if(e.rvfDualWriter)try{let t=await e.getPattern(n);t?.embedding&&t.embedding.length>0&&e.rvfDualWriter.writePattern(n,t.embedding)}catch(t){b.warn("RVF dual-write on promote failed (non-fatal)",{patternId:n,error:h(t)})}P().then(t=>t.append("PATTERN_PROMOTE",{patternId:n},"reasoning-bank")).catch(t=>{b.warn("Witness chain PATTERN_PROMOTE failed",{error:h(t)})}),b.info("Promoted pattern to long-term",{patternId:n}),e.eventBus&&await e.eventBus.publish({id:`pattern-promoted-${n}`,type:"pattern:promoted",timestamp:new Date,source:"learning-optimization",payload:{patternId:n,newTier:"long-term"}})}else b.error("Failed to promote pattern",r.error,{patternId:n})}async function K(n){let e=await n.patternStore.getStats(),r=0,t=0;for(let[a,o]of Object.entries(_)){let i=a,c=e.byDomain[i]||0;if(c===0)continue;let s=await n.searchPatterns("",{domain:i,limit:50});if(s.success)for(let p of o){if((e.byDomain[p]||0)>=c){t++;continue}for(let{pattern:u}of s.value){let d=await n.searchPatterns(u.name,{domain:p,limit:1});if(d.success&&d.value.length>0&&d.value[0].score>.8){t++;continue}let f=Math.max(.3,(u.confidence||.5)*.8);(await n.storePattern({patternType:u.patternType,qeDomain:p,name:`${u.name} (from ${i})`,description:`${u.description} [Transferred from ${i} domain]`,template:u.template,context:{...u.context,relatedDomains:[i,p],tags:[...u.context.tags,"cross-domain-transfer",`source:${i}`]},confidence:f})).success?r++:t++}}}return b.info("Cross-domain transfer complete",{transferred:r,skipped:t}),{transferred:r,skipped:t}}var J=`
|
|
282
|
+
CREATE TABLE IF NOT EXISTS pattern_citations (
|
|
283
|
+
source_pattern_id TEXT NOT NULL,
|
|
284
|
+
target_pattern_id TEXT NOT NULL,
|
|
285
|
+
weight REAL NOT NULL DEFAULT 1.0,
|
|
286
|
+
relationship TEXT NOT NULL DEFAULT 'co-occurrence',
|
|
287
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
288
|
+
PRIMARY KEY (source_pattern_id, target_pattern_id)
|
|
289
|
+
);
|
|
290
|
+
CREATE INDEX IF NOT EXISTS idx_citations_source ON pattern_citations(source_pattern_id);
|
|
291
|
+
CREATE INDEX IF NOT EXISTS idx_citations_target ON pattern_citations(target_pattern_id);
|
|
292
|
+
`,N=class{constructor(e){this.db=e}initialized=!1;ensureSchema(){this.initialized||(this.db.exec(J),this.initialized=!0)}recordCoOccurrence(e,r){this.ensureSchema();let[t,a]=e<r?[e,r]:[r,e];this.db.prepare(`
|
|
293
|
+
INSERT INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
|
|
294
|
+
VALUES (?, ?, 1.0, 'co-occurrence')
|
|
295
|
+
ON CONFLICT(source_pattern_id, target_pattern_id)
|
|
296
|
+
DO UPDATE SET weight = weight + 1.0
|
|
297
|
+
`).run(t,a)}recordDerivation(e,r){this.ensureSchema(),this.db.prepare(`
|
|
298
|
+
INSERT INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
|
|
299
|
+
VALUES (?, ?, 2.0, 'derivation')
|
|
300
|
+
ON CONFLICT(source_pattern_id, target_pattern_id)
|
|
301
|
+
DO UPDATE SET weight = MAX(weight, 2.0), relationship = 'derivation'
|
|
302
|
+
`).run(e,r)}buildGraph(){this.ensureSchema();let e=this.db.prepare("SELECT source_pattern_id, target_pattern_id, weight, relationship FROM pattern_citations").all(),r=new Set;for(let i of e)r.add(i.source_pattern_id),r.add(i.target_pattern_id);let t=Array.from(r),a=new Map;t.forEach((i,c)=>a.set(i,c));let o=[];for(let i of e){let c=a.get(i.source_pattern_id),s=a.get(i.target_pattern_id);o.push([c,s,i.weight]),i.relationship==="co-occurrence"&&o.push([s,c,i.weight])}return{nodes:t,edges:o}}bootstrapFromExistingData(){this.ensureSchema();let e=0,r=this.db.prepare(`
|
|
303
|
+
SELECT id, qe_domain FROM qe_patterns WHERE qe_domain IS NOT NULL ORDER BY qe_domain
|
|
304
|
+
`).all(),t=new Map;for(let p of r){let l=t.get(p.qe_domain)??[];l.push(p.id),t.set(p.qe_domain,l)}let a=this.db.prepare(`
|
|
305
|
+
INSERT OR IGNORE INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
|
|
306
|
+
VALUES (?, ?, 1.0, 'co-occurrence')
|
|
307
|
+
`),o=this.db.transaction(p=>{for(let[l,u]of p)a.run(l,u).changes>0&&e++}),i=[];for(let[,p]of t){let l=p.slice(0,50);for(let u=0;u<l.length;u++)for(let d=u+1;d<l.length;d++){let[f,m]=l[u]<l[d]?[l[u],l[d]]:[l[d],l[u]];i.push([f,m])}}o(i);let c=this.db.prepare(`
|
|
308
|
+
SELECT source_pattern_id, target_pattern_id, relationship_type
|
|
309
|
+
FROM pattern_relationships
|
|
310
|
+
WHERE relationship_type IN ('merged', 'derived', 'superseded')
|
|
311
|
+
`).all(),s=this.db.prepare(`
|
|
312
|
+
INSERT OR IGNORE INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
|
|
313
|
+
VALUES (?, ?, 2.0, 'derivation')
|
|
314
|
+
`);for(let p of c)s.run(p.source_pattern_id,p.target_pattern_id).changes>0&&e++;return e}getEdgeCount(){return this.ensureSchema(),this.db.prepare("SELECT COUNT(*) as cnt FROM pattern_citations").get().cnt}};var g=E.create("QEReasoningBank"),O=class{constructor(e,r,t={},a){this.memory=e;this.eventBus=r;this.coherenceService=a;this.config={...A,...t},t.rvfDualWriter&&(this.rvfDualWriter=t.rvfDualWriter),this.patternStore=W(e,{embeddingDimension:this.config.embeddingDimension,...t.patternStore})}config;patternStore;initialized=!1;sqliteStore=null;rvfDualWriter=null;getSqliteStore(){return this.sqliteStore||(this.sqliteStore=V(),this.sqliteStore.initialize().catch(e=>{g.warn("SQLitePatternStore init failed",{error:h(e)})})),this.sqliteStore}setRvfDualWriter(e){this.rvfDualWriter=e}stats={routingRequests:0,totalRoutingConfidence:0,learningOutcomes:0,successfulOutcomes:0};async initialize(){if(!this.initialized){await this.patternStore.initialize();try{let e=this.getSqliteStore();await e.initialize(),this.patternStore.setSqliteStore(e)}catch(e){g.warn("Failed to wire SQLitePatternStore into PatternStore",{error:h(e)})}await this.loadPretrainedPatterns(),this.initialized=!0;try{let e="reasoning-bank:cross-domain-seeded";if(!await this.memory.get(e))await this.memory.set(e,!0),await this.seedCrossDomainPatterns();else{let t=await this.patternStore.getStats();g.info("Cross-domain transfer already complete",{totalPatterns:t.totalPatterns})}}catch(e){g.warn("Cross-domain seeding failed (non-fatal)",{error:e})}g.info("Initialized")}}async loadPretrainedPatterns(){let e=await this.patternStore.getStats();if(e.totalPatterns>0){g.info("Found existing patterns",{totalPatterns:e.totalPatterns});return}for(let r of R)try{await this.patternStore.create(r)}catch(t){g.warn("Failed to load pattern",{name:r.name,error:t})}g.info("Loaded foundational patterns",{count:R.length})}async seedCrossDomainPatterns(){return this.initialized||await this.initialize(),K({searchPatterns:this.searchPatterns.bind(this),storePattern:this.storePattern.bind(this),patternStore:this.patternStore})}async storePattern(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return S(new Error("Pattern learning is disabled"));if(!e.embedding){let t=await this.embed(`${e.name} ${e.description} ${e.context?.tags?.join(" ")||""}`);e={...e,embedding:t}}let r=await this.patternStore.create(e);if(r.success&&(P().then(t=>t.append("PATTERN_CREATE",{patternId:r.value.id,domain:r.value.qeDomain,confidence:r.value.confidence,name:r.value.name},"reasoning-bank")).catch(t=>{g.warn("Witness chain PATTERN_CREATE failed",{error:h(t)})}),this.rvfDualWriter&&r.value.embedding&&r.value.embedding.length>0))try{this.rvfDualWriter.writePattern(r.value.id,r.value.embedding)}catch(t){g.warn("RVF dual-write failed (non-fatal)",{patternId:r.value.id,error:h(t)})}return r}async searchPatterns(e,r){this.initialized||await this.initialize();let t=e,a=!0;return typeof e=="string"&&(e.trim()===""?(a=!1,t=""):t=await this.embed(e)),this.patternStore.search(t,{...r,useVectorSearch:a})}async getPattern(e){return this.initialized||await this.initialize(),this.patternStore.get(e)}async recordOutcome(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return T(void 0);let r=await this.patternStore.recordUsage(e.patternId,e.success);try{this.getSqliteStore().recordUsage(e.patternId,e.success,e.metrics,e.feedback)}catch(t){g.warn("SQLite pattern usage persist failed",{error:h(t)})}if(r.success){this.stats.learningOutcomes++,e.success&&this.stats.successfulOutcomes++,P().then(o=>o.append("PATTERN_UPDATE",{patternId:e.patternId,success:e.success},"reasoning-bank")).catch(o=>{g.warn("Witness chain PATTERN_UPDATE failed",{error:h(o)})});let t=await this.getPattern(e.patternId),a=this.getPromotionDeps();t&&await X(t,a)&&(await H(e.patternId,a),g.info("Pattern promoted to long-term",{name:t.name}))}return r}getPromotionDeps(){return{patternStore:this.patternStore,coherenceService:this.coherenceService,eventBus:this.eventBus,coherenceThreshold:this.config.coherenceThreshold||.4,getSqliteStore:this.getSqliteStore.bind(this),rvfDualWriter:this.rvfDualWriter,searchPatterns:this.searchPatterns.bind(this),getPattern:this.getPattern.bind(this)}}async routeTask(e){if(this.initialized||await this.initialize(),!this.config.enableRouting)return S(new Error("Task routing is disabled"));this.stats.routingRequests++;try{let r=e.domain?[e.domain]:x(e.task);r.length===0&&r.push("test-generation");let t=await this.embed(e.task),a=await this.patternStore.search(t,{limit:this.config.maxRoutingCandidates,domain:r[0],useVectorSearch:!0}),o=a.success?a.value.map(d=>d.pattern):[],i=new Map;for(let[d,f]of Object.entries(w)){let m=o.filter(y=>f.domains.includes(y.qeDomain)).length;m>0&&i.set(d,m)}let c=C(r,e.capabilities,i,this.config.routingWeights),s=c[0],p=c.slice(1,4),l=[];if(this.config.enableGuidance&&r.length>0){let d=q(r[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});l.push(...d.slice(0,5))}this.stats.totalRoutingConfidence+=s.score;let u={recommendedAgent:s.agent,confidence:s.score,alternatives:p.map(d=>({agent:d.agent,score:d.score})),domains:r,patterns:o,guidance:l,reasoning:s.reasoning.join("; ")};return T(u)}catch(r){return S(L(r))}}getGuidance(e,r){return k(e)}generateContext(e,r){return D(e,r||{})}checkAntiPatterns(e,r){return G(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-GK63VF35.js"),t=await r(e);return t.length!==this.config.embeddingDimension?U(t,this.config.embeddingDimension):t}catch(r){process.env.DEBUG&&g.warn("ONNX embeddings unavailable, using hash fallback",{error:h(r)})}return $(e,this.config.embeddingDimension)}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let t of j)r[t]=e.byDomain[t]||0;return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:this.stats.routingRequests,avgRoutingConfidence:this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,learningOutcomes:this.stats.learningOutcomes,patternSuccessRate:this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0,patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function Ve(n,e,r,t){return new O(n,e,r,t)}export{A as a,R as b,w as c,C as d,_ as e,O as f,Ve as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{a as M}from"./chunk-24FKIJNC.js";import{f as b}from"./chunk-SUSEVMZT.js";import{f as y,o as T}from"./chunk-JJO7Y4H3.js";import{a as p,c as S}from"./chunk-JZSDOIXA.js";T();S();import*as c from"path";import*as d from"fs";var m=null,u=null,l=null;function R(o){l=o}async function P(){return m||u||(u=(async()=>{let o=y(),e=c.join(o,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let r=new M({sqlite:{path:c.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await r.initialize(),m=r,r})(),u)}function $(){if(l)try{l()}catch{}m&&(m.dispose().catch(()=>{}),m=null),u=null}async function D(o){return o?.memory?o.memory:P()}var C={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},h=class{logger=C;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,r){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:r,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let r=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let t=e,{properties:a,required:n}=this.config.schema;if(n)for(let i of n)i in t||r.push(`Missing required field: ${i}`);for(let[i,s]of Object.entries(t)){let g=a[i];if(!g)continue;let f=this.validateType(i,s,g);f&&r.push(f)}return{valid:r.length===0,errors:r}}validateType(e,r,t){if(r==null)return null;let a=Array.isArray(r)?"array":typeof r;if(t.type==="array"&&!Array.isArray(r))return`${e} must be an array`;if(t.type!=="array"&&a!==t.type)return`${e} must be of type ${t.type}, got ${a}`;if(t.enum&&!t.enum.includes(r))return`${e} must be one of: ${t.enum.join(", ")}`;if(t.type==="number"){let n=r;if(t.minimum!==void 0&&n<t.minimum)return`${e} must be >= ${t.minimum}`;if(t.maximum!==void 0&&n>t.maximum)return`${e} must be <= ${t.maximum}`}if(t.type==="string"){let n=r;if(t.minLength!==void 0&&n.length<t.minLength)return`${e} must be at least ${t.minLength} characters`;if(t.maxLength!==void 0&&n.length>t.maxLength)return`${e} must be at most ${t.maxLength} characters`}return null}async invoke(e,r={}){let t=Date.now(),a=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(t,a)};let i={requestId:a,startTime:t,streaming:r.streaming,onStream:r.onStream,abortSignal:r.abortSignal,demoMode:r.demoMode};try{let s=await this.execute(e,i);return{...s,metadata:{...s.metadata,...this.createMetadata(t,a)}}}catch(s){return{success:!1,error:p(s),metadata:this.createMetadata(t,a)}}}createMetadata(e,r){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:r,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,r){e.streaming&&e.onStream&&e.onStream(r)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{R as a,P as b,$ as c,D as d,C as e,h as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
var t=null,r=null,l=!1;async function c(){return l&&!r?t:r||(r=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only")return null;let{isRvfNativeAvailable:a}=await import("./rvf-native-adapter-LKFKTMUN.js");if(!a())return null;let{getUnifiedMemory:u}=await import("./unified-memory-XYGENQUT.js"),n=u().getDatabase();if(!n)return null;let{RvfDualWriter:o}=await import("./rvf-dual-writer-MQW2SJLT.js"),i=new o(n,{rvfPath:".agentic-qe/brain.rvf",mode:"dual-write",dimensions:384});return await i.initialize(),t=i,i}catch(e){return(process.env.DEBUG||process.env.AQE_VERBOSE)&&console.debug("[RVF] Dual-writer init failed, degrading to sqlite-only:",e instanceof Error?e.message:e),null}finally{l=!0,r=null,import("./base-2WXOSMBQ.js").then(({registerRvfResetFn:e})=>e(s)).catch(()=>{})}})(),r)}function v(){return t}function s(){if(t){try{t.close()}catch{}t=null}r=null,l=!1}export{c as a,v as b,s as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{c as u}from"./chunk-4I2IOUS4.js";function t(){return{...e}}function o(r){e={...e,...r}}function i(){e={...s}}function a(){return e.useBrowserMode}function E(){return e.useScreenshotCapture}function l(){return e.useVisualRegression}function c(){return e.useE2EExecution}function f(){return e.defaultHeadless}function d(){return e.useAutoRetry}function _(){return e.logPerformanceMetrics}function I(){return e.useAxeCore}function p(){let r={};process.env.VIBIUM_USE_BROWSER_MODE!==void 0&&(r.useBrowserMode=process.env.VIBIUM_USE_BROWSER_MODE==="true"),process.env.VIBIUM_USE_SCREENSHOT_CAPTURE!==void 0&&(r.useScreenshotCapture=process.env.VIBIUM_USE_SCREENSHOT_CAPTURE==="true"),process.env.VIBIUM_USE_VISUAL_REGRESSION!==void 0&&(r.useVisualRegression=process.env.VIBIUM_USE_VISUAL_REGRESSION==="true"),process.env.VIBIUM_USE_E2E_EXECUTION!==void 0&&(r.useE2EExecution=process.env.VIBIUM_USE_E2E_EXECUTION==="true"),process.env.VIBIUM_DEFAULT_HEADLESS!==void 0&&(r.defaultHeadless=process.env.VIBIUM_DEFAULT_HEADLESS==="true"),process.env.VIBIUM_USE_AUTO_RETRY!==void 0&&(r.useAutoRetry=process.env.VIBIUM_USE_AUTO_RETRY==="true"),process.env.VIBIUM_LOG_PERFORMANCE_METRICS!==void 0&&(r.logPerformanceMetrics=process.env.VIBIUM_LOG_PERFORMANCE_METRICS==="true"),process.env.VIBIUM_USE_AXE_CORE!==void 0&&(r.useAxeCore=process.env.VIBIUM_USE_AXE_CORE==="true"),o(r)}function U(){o({defaultHeadless:!0,useAutoRetry:!0,logPerformanceMetrics:!0})}function R(){o({defaultHeadless:!1,logPerformanceMetrics:!0})}function S(){o({useBrowserMode:!1,useScreenshotCapture:!1,useVisualRegression:!1,useE2EExecution:!1,useAxeCore:!1})}var s,e,n=u(()=>{s={useBrowserMode:!0,useScreenshotCapture:!0,useVisualRegression:!0,useE2EExecution:!0,defaultHeadless:!1,useAutoRetry:!0,logPerformanceMetrics:!0,useAxeCore:!0},e={...s}});export{s as a,t as b,o as c,i as d,a as e,E as f,l as g,c as h,f as i,d as j,_ as k,I as l,p as m,U as n,R as o,S as p,n as q};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|
|
2
|
+
import{e as a}from"./chunk-RU5WAHB7.js";import{b as w,d as y}from"./chunk-WGMPEW2T.js";import{a as f,c as P}from"./chunk-JZSDOIXA.js";import{randomUUID as v}from"crypto";import*as i from"fs";import*as n from"path";import*as c from"os";y();P();var k=".aqe",b="schedules.json",F="1.0.0",g=5e3,x=50,p=10*1024*1024,d=class{schedulesPath;debug;lockFile;initialized=!1;constructor(e={}){e.schedulesPath&&this.validateSchedulesPath(e.schedulesPath),this.schedulesPath=e.schedulesPath??this.getDefaultSchedulesPath(),this.lockFile=`${this.schedulesPath}.lock`,this.debug=e.debug??!1}validateSchedulesPath(e){let s=c.homedir(),t=n.resolve(e),r=n.resolve(s);if(t.startsWith(r+n.sep)||t===r)return;let l=process.cwd(),h=n.resolve(l);if(t.startsWith(h+n.sep)||t===h)return;let u=c.tmpdir(),S=n.resolve(u);if(!(t.startsWith(S+n.sep)||t===S))throw new Error(`Security: Custom schedulesPath must be within home directory (${s}), current working directory (${l}), or temp directory (${u}). Provided path: ${e}`)}getDefaultSchedulesPath(){let e=c.homedir();return n.join(e,k,b)}async initialize(){if(this.initialized)return;let e=n.dirname(this.schedulesPath);i.existsSync(e)||(i.mkdirSync(e,{recursive:!0}),this.log(`Created directory: ${e}`)),this.initialized=!0}async loadSchedules(){if(await this.initialize(),!i.existsSync(this.schedulesPath))return this.log("Schedules file does not exist, returning empty array"),[];try{let e=i.readFileSync(this.schedulesPath,"utf-8"),s=this.parseSchedulesFile(e);return this.log(`Loaded ${s.schedules.length} schedules`),s.schedules}catch(e){return await this.handleCorruptFile(e),[]}}async saveSchedule(e){await this.initialize(),await this.withFileLock(async()=>{let s=await this.loadSchedulesUnsafe(),t=s.findIndex(r=>r.id===e.id);t>=0?(s[t]=e,this.log(`Updated schedule: ${e.id}`)):(s.push(e),this.log(`Added schedule: ${e.id}`)),await this.writeSchedules(s)})}async removeSchedule(e){await this.initialize(),await this.withFileLock(async()=>{let s=await this.loadSchedulesUnsafe(),t=s.filter(r=>r.id!==e);if(t.length===s.length){this.log(`Schedule not found: ${e}`);return}await this.writeSchedules(t),this.log(`Removed schedule: ${e}`)})}async getSchedules(){return this.loadSchedules()}async getSchedule(e){return(await this.loadSchedules()).find(t=>t.id===e)}async getDueSchedules(){let e=await this.loadSchedules(),s=new Date;return e.filter(t=>t.enabled?new Date(t.nextRun)<=s:!1)}async markExecuted(e){await this.initialize(),await this.withFileLock(async()=>{let s=await this.loadSchedulesUnsafe(),t=s.find(l=>l.id===e);if(!t)throw new Error(`Schedule not found: ${e}`);let r=new Date;t.lastRun=r.toISOString(),t.nextRun=a(t.schedule,r).toISOString(),await this.writeSchedules(s),this.log(`Marked executed: ${e}, next run: ${t.nextRun}`)})}async setEnabled(e,s){await this.initialize(),await this.withFileLock(async()=>{let t=await this.loadSchedulesUnsafe(),r=t.find(l=>l.id===e);if(!r)throw new Error(`Schedule not found: ${e}`);r.enabled=s,s&&(r.nextRun=a(r.schedule,new Date).toISOString()),await this.writeSchedules(t),this.log(`Set enabled=${s}: ${e}`)})}async getEnabledSchedules(){return(await this.loadSchedules()).filter(s=>s.enabled)}async getSchedulesByWorkflow(e){return(await this.loadSchedules()).filter(t=>t.workflowId===e)}async clearAll(){await this.initialize(),await this.withFileLock(async()=>{await this.writeSchedules([]),this.log("Cleared all schedules")})}async getStats(){let e=await this.loadSchedules(),s=new Date;return{total:e.length,enabled:e.filter(t=>t.enabled).length,disabled:e.filter(t=>!t.enabled).length,due:e.filter(t=>t.enabled&&new Date(t.nextRun)<=s).length}}async loadSchedulesUnsafe(){if(!i.existsSync(this.schedulesPath))return[];try{let e=i.readFileSync(this.schedulesPath,"utf-8");return this.parseSchedulesFile(e).schedules}catch{return[]}}parseSchedulesFile(e){let s=Buffer.byteLength(e,"utf-8");if(s>p)throw new Error(`Schedules file exceeds maximum allowed size (${p/(1024*1024)}MB). File is ${(s/(1024*1024)).toFixed(2)}MB.`);let t=w(e);if(!t.schedules||!Array.isArray(t.schedules))throw new Error("Invalid schedules file: missing schedules array");for(let r of t.schedules)if(!r.id||!r.workflowId||!r.schedule)throw new Error("Invalid schedule entry: missing required fields");return t}async writeSchedules(e){let s={version:F,updatedAt:new Date().toISOString(),schedules:e},t=JSON.stringify(s,null,2);i.writeFileSync(this.schedulesPath,t,"utf-8"),this.log(`Wrote ${e.length} schedules to disk`)}async handleCorruptFile(e){let s=f(e);this.log(`Corrupt schedules file detected: ${s}`);let t=`${this.schedulesPath}.corrupt.${Date.now()}`;try{i.existsSync(this.schedulesPath)&&(i.copyFileSync(this.schedulesPath,t),this.log(`Backed up corrupt file to: ${t}`))}catch(r){this.log(`Failed to backup corrupt file: ${r}`)}try{i.existsSync(this.schedulesPath)&&(i.unlinkSync(this.schedulesPath),this.log("Removed corrupt schedules file"))}catch(r){this.log(`Failed to remove corrupt file: ${r}`)}}async withFileLock(e){await this.acquireLock();try{return await e()}finally{this.releaseLock()}}async acquireLock(){let e=Date.now();for(;i.existsSync(this.lockFile);){try{let s=i.statSync(this.lockFile);if(Date.now()-s.mtimeMs>g){i.unlinkSync(this.lockFile),this.log("Removed stale lock file");break}}catch{break}if(Date.now()-e>g)throw new Error("Timeout waiting for scheduler lock");await this.sleep(x)}try{i.writeFileSync(this.lockFile,`${process.pid}:${Date.now()}`,{flag:"wx"})}catch(s){if(s.code==="EEXIST")return this.acquireLock();throw s}}releaseLock(){try{i.existsSync(this.lockFile)&&i.unlinkSync(this.lockFile)}catch(e){console.debug("[PersistentScheduler] Lock release error:",e instanceof Error?e.message:e)}}sleep(e){return new Promise(s=>setTimeout(s,e))}log(e){this.debug&&console.log(`[PersistentScheduler] ${e}`)}};function E(o={}){return new d(o)}function m(){let o=Date.now().toString(36),e=v().slice(0,8);return`sched-${o}-${e}`}function $(o){let e=new Date;return{id:m(),workflowId:o.workflowId,pipelinePath:o.pipelinePath,schedule:o.schedule,scheduleDescription:o.scheduleDescription,nextRun:a(o.schedule,e).toISOString(),enabled:o.enabled??!0,createdAt:e.toISOString()}}export{d as a,E as b,m as c,$ as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
|