bugx-cli 0.1.1__py3-none-any.whl
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.
- bugx_cli/__init__.py +6 -0
- bugx_cli/cli.py +1685 -0
- bugx_cli/commands/__init__.py +1 -0
- bugx_cli/commands/advisory.py +94 -0
- bugx_cli/commands/agent.py +4210 -0
- bugx_cli/commands/audit.py +632 -0
- bugx_cli/commands/autonomous.py +260 -0
- bugx_cli/commands/cloud.py +1371 -0
- bugx_cli/commands/daemon.py +50 -0
- bugx_cli/commands/doctor.py +1590 -0
- bugx_cli/commands/goal.py +107 -0
- bugx_cli/commands/interaction.py +248 -0
- bugx_cli/commands/knowledge.py +619 -0
- bugx_cli/commands/lifecycle.py +2763 -0
- bugx_cli/commands/patch.py +1014 -0
- bugx_cli/commands/plugin.py +2749 -0
- bugx_cli/commands/plugin_claude.py +1446 -0
- bugx_cli/commands/plugin_cline.py +269 -0
- bugx_cli/commands/plugin_codex.py +74 -0
- bugx_cli/commands/plugin_funide.py +729 -0
- bugx_cli/commands/plugin_qoder.py +216 -0
- bugx_cli/commands/plugin_zcode.py +710 -0
- bugx_cli/commands/project.py +670 -0
- bugx_cli/commands/report.py +256 -0
- bugx_cli/commands/skill.py +251 -0
- bugx_cli/commands/stats.py +133 -0
- bugx_cli/commands/system.py +2567 -0
- bugx_cli/common.py +906 -0
- bugx_cli/host_adapters.py +1892 -0
- bugx_cli/hosts/__init__.py +80 -0
- bugx_cli/hosts/base.py +99 -0
- bugx_cli/hosts/registry.py +573 -0
- bugx_cli/hosts/template_engine.py +188 -0
- bugx_cli/infra/__init__.py +209 -0
- bugx_cli/infra/ai_advisor.py +851 -0
- bugx_cli/infra/engine_installer.py +1945 -0
- bugx_cli/infra/host_sync.py +548 -0
- bugx_cli/infra/mcp_advisor.py +826 -0
- bugx_cli/infra/security.py +339 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/bugx-mcp-manifest.json +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/CATALOG.json +141 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/README.md +254 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android-interaction.json +81 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android.json +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/desktop-macos.json +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios-interaction.json +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios.json +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/memory-macos.json +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/__init__.py +146 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_artifacts.py +766 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_eval.py +1155 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_execution.py +718 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_orchestrator.py +1351 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_targets.py +877 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_workspace.py +770 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/feature_baseline.py +150 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/README.md +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE.txt +362 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/UPSTREAM.md +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/axe.min.js +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-1024.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-512.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-tight.svg +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar.svg +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-cn.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.svg +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-zh.svg +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/codex.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/dsh.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/project-layout.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/zcode.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/README.md +37 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/manifest.json +94 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/10-schema-inventory.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/20-query-and-integrity.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/80-evidence-regression.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/manifest.json +123 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/00-scope.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/10-process-model.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/20-package-integrity.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/30-ui-behavior.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/80-evidence-regression.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/memory-testing.md +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/manifest.json +155 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/android.md +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/h5.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/ios.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/miniprogram.md +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/webview.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/10-platform-inventory.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/20-masvs-static.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/30-component-exposure.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/40-device-behavior.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/80-evidence-regression.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/manifest.json +127 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/00-scope.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/10-static-white-box.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/20-memory-concurrency.md +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/30-behavior-black-box.md +39 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/80-evidence-regression.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/platform-testing.md +174 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/manifest.json +191 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/graphql.md +5 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/h5.md +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/multi-tenant.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/oauth.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/upload.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/websocket.md +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/00-scope.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/10-discovery.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/20-auth-session.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/30-authz-business.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/40-input-output.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/50-state-async.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/60-file-ssrf-deser.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/70-config-dependency.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/80-evidence-regression.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/INTERFACE.md +61 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/README.md +58 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/__init__.py +109 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph.py +1096 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph_store.py +1868 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/audit_campaign.py +1232 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/behavior_graph.py +465 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/ghsa_advisories.py +174 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/models.py +93 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/mutator.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/patcher.py +126 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/scout.py +278 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/synthesizer.py +207 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/verifier.py +103 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx.md +1299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx_paths.py +1881 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cli-help.txt +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/INTERFACE.md +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/__init__.py +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/auto_sync.py +398 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_client.py +1218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_onboard.py +743 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_schema.py +648 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/consent.py +81 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/device_identity.py +307 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/endpoint_router.py +415 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/flywheel_client.py +769 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/network_transport.py +296 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/onboard_wizard.py +493 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sensitive_filter.py +285 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_pull.py +695 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_push.py +723 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/AGENT_GUIDE.md +359 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/README.md +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-blackbox.md +541 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-opencode.md +469 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-quick.md +44 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-runtime-contract.md +353 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-worker.md +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/engine_gap_contracts.py +473 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/README.md +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/__init__.py +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_ai_review.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_backfill.py +54 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_bootstrap.py +713 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_business.py +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_cli.py +715 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_discovery.py +1429 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_evidence.py +1024 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_forensics.py +124 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_gate.py +277 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_intelligence.py +734 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_manifest.py +396 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_platform.py +77 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_validate.py +241 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/module_coverage.py +157 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/INTERFACE.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/README.md +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/__init__.py +5 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/interaction_preset.py +408 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/engine-integrity.json +2797 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/README.md +49 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/__init__.py +82 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/concurrency_fuzzer.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/differential_oracle.py +1164 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/fuzz_input.py +1291 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/stateful_fuzzer.py +404 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/README.md +61 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/__init__.py +130 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/capacity_planner.py +124 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/dependency_lock.py +317 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/goal_governor.py +754 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/guide_budget.py +458 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/lockdown.sh +50 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/readonly_enforcer.py +154 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/runtime_tool_gate.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/secret_redactor.py +784 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/token_budget.py +38 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/INTERFACE.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/__init__.py +121 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/base.py +111 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/claude.py +99 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/cline.py +298 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/codex.py +300 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/dsh.py +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/opencode.py +209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/pi.py +94 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/zcode.py +99 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/INTERFACE.md +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/__init__.py +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/adapters.py +412 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/autonomous_runner.py +1152 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/cline.py +448 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/common.py +103 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/free_models.py +786 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_bootstrap.py +389 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_evaluators.py +761 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_probe.py +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_provider_arbitrator.py +831 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_registry.py +662 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_usage.py +127 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_process_tracker.py +509 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_registry_gate.py +379 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/pi.py +102 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/provider_facts.py +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/INTERFACE.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/README.md +67 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/__init__.py +140 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_base_usage.py +152 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_codex_usage.py +297 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_dsh_usage.py +184 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_mcp_toml.py +365 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_zcode_usage.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/base.py +479 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/claude.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/cline.py +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/codex.py +1006 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/dsh.py +526 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/opencode.py +358 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/pi.py +308 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/zcode.py +219 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/i18n.py +252 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/README.md +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/__init__.py +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/build_info.py +105 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/client_metadata.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/json_utils.py +22 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/python_runtime.py +540 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/safe_xml.py +221 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_bugx.py +118 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/INTERFACE.md +31 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/README.md +106 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/__init__.py +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/candidate_revalidation.py +484 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/common.py +1060 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_confirm_phase.py +391 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_settlement.py +1432 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_adjudication.py +666 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_snapshot.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/judge_phase.py +848 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lesson_context.py +536 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lifecycle_reporter.py +627 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/orchestrator_controls.py +686 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_commit.py +567 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_coverage_sync.py +598 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_dry_run.py +817 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_observability.py +367 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_phase.py +1223 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_receipt.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_round_lifecycle.py +786 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_phase.py +1029 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_recon_scout.py +879 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_state_builder.py +1133 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/report_sharing.py +414 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/round_orchestrator.py +1116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/session_runtime.py +1670 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_gates.py +1050 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_interaction.py +1003 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_version_gate.py +879 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_bridge.py +1253 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_coverage.py +423 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_degraded.py +1211 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_barriers.py +424 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_orchestrator.py +1246 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_prior.py +749 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/INTERFACE.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/README.md +160 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/__init__.py +67 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/_facade.py +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/archive_ops.py +630 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/auto_materialization.py +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/bug-log.md +22 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/cli.py +275 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/export_ops.py +554 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_confirmation.py +1316 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_io.py +299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_lifecycle.py +730 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_verification.py +405 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/incidents.py +1005 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson-replay-cases.json +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_ledger.py +241 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_replay.py +272 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/life_ledger.py +668 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/mistake-book.md +130 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/patterns.py +684 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/receipt_contract.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/schema.py +1192 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/sync_ops.py +940 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/tool_experience.py +683 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/verify_life.py +1597 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/lesson-ledger.json +275 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/README.md +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/en-US.json +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/zh-CN.json +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/INTERFACE.md +75 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/README.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/__init__.py +128 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/base.py +717 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/channel_lifecycle.py +751 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/graph_handlers.py +222 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/knowledge_handlers.py +536 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/mining_handlers.py +586 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/resource_prompt_table.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/retrieval_handlers.py +249 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/rpc_server.py +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/supervisor_handlers.py +1461 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/telemetry_handlers.py +227 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/tool_table.py +1030 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/README.md +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/__init__.py +1 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/common.py +363 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/environment.py +567 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/verifier.py +758 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/metadata.txt +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/README.md +157 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/__init__.py +242 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_plan.py +187 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_planner.py +195 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_archetype.py +542 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_router.py +269 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/dynamic_flow_analyzer.py +533 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/impact_pruner.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/intent_adjudicator.py +175 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/judge_pipeline.py +1246 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/logic_analysis.py +419 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/prompt_harness.py +1704 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/source_inspector.py +267 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/spec_harvester.py +449 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/target_sandbox_manager.py +573 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/test_capability_verifier.py +1364 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/tools-kb.md +38 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/unit_kind.py +122 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/INTERFACE.md +83 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/README.md +51 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/SPEC.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/__init__.py +76 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/android_probe.py +552 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/base.py +147 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/codebase_memory_probe.py +647 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/desktop_probe.py +342 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/differential_probe.py +434 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/efficiency_probe.py +232 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ios_binary_probe.py +472 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/memory_probe.py +392 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/miniprogram_probe.py +385 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/mobile_probe.py +466 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/native_probe.py +302 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/openwiki_probe.py +263 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/pattern_probe.py +453 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/platform_probe.py +424 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/probe_registry.py +1770 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_fixture_corpus.py +340 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_probe.py +1510 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_rules.py +1481 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sca_scanner.py +779 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_accessibility.py +149 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_audit.py +513 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_contract.py +273 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_evidence.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_measurements.py +314 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_repair.py +250 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_review.py +133 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_storybook.py +107 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_tokens.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_visual_diff.py +131 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/web_probe.py +714 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/INTERFACE.md +62 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/README.md +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/SPEC.md +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/__init__.py +201 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/arbitrator.py +316 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/constants.py +247 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/detector.py +399 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/extractors.py +836 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/fingerprint.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/storage.py +258 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/strategy.py +301 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/codex_dialog_dispatch.md +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_en.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_zh.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/l0_router.md +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/anti_patterns.md +16 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/concurrency_rules.md +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/memory_leak_rules.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/prompt_injection_defense.md +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_explore.md +31 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_gate.md +43 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_mutate.md +42 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_repair.md +85 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/README.md +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/__init__.py +169 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/fix_watchlist.py +391 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_dynamic.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_repair_loop.py +462 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_selfcheck.py +862 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/minimize_repro.py +466 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/patch_synthesizer.py +617 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/regression_pack.py +379 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_fixer.py +910 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_loop.py +311 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_repair.py +348 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_rounds.py +212 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_scope.py +281 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/self_heal.py +604 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_generator.py +1108 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_quality_auditor.py +410 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_strategy.py +511 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/INTERFACE.md +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/README.md +69 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/SPEC.md +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/__init__.py +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/attestation.py +228 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/authority.py +255 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/finding_report.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/formal_report_builder.py +924 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/html_renderers.py +696 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/models.py +759 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/pdf_exporter.py +231 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/projects_assets.py +730 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_client.py +743 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_data_builder.py +388 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_share.py +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/sast_bridge.py +116 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/server.py +832 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/visual_report_builder.py +796 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web-conformance.md +168 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web_conformance.py +428 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/workbench_assets.py +484 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/INTERFACE.md +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/README.md +161 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/__init__.py +3 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/code_analyzer.py +1720 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/codebase_memory_bridge.py +337 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/context_assembler.py +240 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/corpus_fetch.py +369 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/graph_ego.py +597 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_auto.py +662 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sources.py +168 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sync.py +1003 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/memory_store.py +480 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/query_planner.py +1020 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/rrf_engine.py +137 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_extractor.py +1209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_normalizer.py +373 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_spec.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/symbol_index.py +1151 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/universal_code_matcher.py +622 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_bridge.py +476 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_supervisor.py +362 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/README.md +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/PROVENANCE.json +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/crypto.yaml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/network.yaml +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/resilience.yaml +47 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/storage.yaml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/LICENSE +173 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/PROVENANCE.json +270 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-asymmetric-key-pair-used-for-multiple-purposes.yml +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-backup-manifest.yml +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-event-bound.yml +49 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-invalidated-enrollment.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-no-confirmation-required.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-validity-duration.yml +24 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-algorithms.yaml +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-modes.yaml +13 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-content-provider-exported.yml +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-custom-deeplink-scheme.yml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-dangerous-app-permissions.yaml +65 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-data-unencrypted-shared-storage-no-user-interaction-apis.yml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-data-unencrypted-shared-storage-no-user-interaction-manifest.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debuggable-flag.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debugger-checks.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-autoverify-missing.yml +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-unvalidated-parameter.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-device-passcode-present.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-fileprovider-broad-scope.yml +46 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-crypto-keys-usage.yml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-security-provider.yaml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-internal-communication.yml +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-leaking-extras.yml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-input-field-usage.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-key-generation-with-insufficient-key-length.yml +21 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-keyboard-cache-input-types.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-local-storage-input-validation.yml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-native-debugger-checks.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-checkservertrusted.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-hostname-verification.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-insecure-trust-anchors.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-onreceivedsslerror.yml +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-non-random-use.yml +16 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-object-deserialization.yml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-overlay-protection.yml +68 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-pendingintent-mutable.yml +39 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-random-apis-insufficient-entropy.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-root-detection.yaml +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sdk-version.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications-manifest.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications.yml +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-screenshot.yml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sql-injection-contentprovider.yml +17 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-ssl-socket-hostnameverifier.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-strictmode.yml +10 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-system-alert-window.yml +9 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-allow-local-access.yml +15 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-bridges.yml +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-safebrowsing.yml +20 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-url-handlers.yml +41 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/PROVENANCE.json +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/network.yaml +37 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/platform.yaml +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/storage.yaml +48 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/LICENSE +165 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/PROVENANCE.json +58 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/auth.yaml +59 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/crypto.yaml +66 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/jailbreak.yaml +14 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/keyboard.yaml +34 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/logging.yaml +23 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/network.yaml +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/resilience.yaml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/secrets.yaml +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/storage.yaml +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/webview.yaml +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/README.md +198 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/__init__.py +3 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/bugx_logging.py +1464 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/daemon_runner.py +623 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/fixture_solidify.py +444 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/global_telemetry.py +549 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/incident_eval.py +148 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction.py +605 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction_store.py +435 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interactive_menu.py +95 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/log_analytics.py +922 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/mining_quality_framework.py +1387 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/model_runner.py +732 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/platform_adapter.py +579 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/prep_validate.py +478 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_graph.py +827 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_init.py +481 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_profile.py +224 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_settings.py +964 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/provider_window.py +97 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/resume_ticket.py +115 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/scenario_eval.py +856 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/seed_drill.py +549 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/self_audit.py +550 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/session_profile.py +205 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/setup_ui_env.py +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/startup_environment.py +859 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/sync_store.py +1421 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/tool_install_targets.py +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/README.md +35 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/agent-graph.schema.json +368 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/attack-graph.schema.json +88 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/evidence-bundle.schema.json +33 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/skill-pack.schema.json +230 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/worker-checkpoint.schema.json +119 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/secure_atomic.py +289 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/README.md +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/c.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/cpp.txt +32 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/css.txt +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/go.txt +46 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/java.txt +30 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/javascript.txt +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/kotlin.txt +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/python.txt +71 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/rust.txt +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/swift.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/typescript.txt +29 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/README.md +53 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/__init__.py +189 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_docs_mcp_server.py +418 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_mcp_server.py +1161 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_runtime.py +968 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_session_proof.py +605 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mobile_ui_inspector.py +405 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_pack.py +1214 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_synthesizer.py +1153 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/tools_kb.py +313 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/INTERFACE.md +121 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/README.md +209 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/SPEC.md +25 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/__init__.py +175 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/audit_supervisor.py +1015 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/budget_governor.py +1254 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_handler.py +368 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_pipeline.py +1564 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_sync.py +653 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_events.py +74 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_sync.py +590 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/cli.py +812 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/context_sync.py +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/coverage_sync.py +115 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_commit.py +470 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_sync.py +688 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_workflow.py +676 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_policy.py +224 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_sync.py +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/graph_sync.py +669 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lease_manager.py +788 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lifecycle_blocks.py +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/next_round_sync.py +126 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/observability.py +140 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/recovery_sync.py +165 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/rejection_remedies.py +355 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/round_governor.py +306 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/serial_authorization.py +544 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/start_sync.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/state_store.py +249 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_host.py +511 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_models.py +1143 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/systemic_failure.py +104 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/task_scheduler.py +1640 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_checkpoint.py +230 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_execution.py +265 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_handoff.py +192 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_lifecycle.py +396 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_runtime.py +1005 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_sync.py +89 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/README.md +36 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/__init__.py +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/exceptions.py +52 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/graph_models.py +357 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/path_containment.py +151 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/target_fingerprint.py +310 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/worker_claim.py +411 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/INTERFACE.md +50 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/README.md +57 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/SPEC.md +26 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/__init__.py +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/__init__.py +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/base.py +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/bugx.py +102 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/claude.py +222 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/cline.py +407 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/codex.py +260 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/dsh.py +177 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/opencode.py +218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/pi.py +272 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/registry.py +100 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/zcode.py +312 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/api_routes_post.py +668 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/dispatcher.py +1376 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/docs_session_service.py +473 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/handler.py +674 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/ide_cloud_service.py +526 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/mcp_inspector.py +1747 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/00-base.css +1060 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/01-monitoring.css +802 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/02-header-actions.css +321 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/03-trigger-popover.css +697 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/04-composer.css +628 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/05-skills-center.css +878 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/06-mcp-center.css +623 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/07-skill-detail.css +265 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/08-files-management.css +167 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/09-files-center.css +386 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/10-icons.css +105 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/11-project-options.css +185 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/12-profile-tab.css +383 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-CXAsl8mr.js +333 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-DHQUtWtx.css +1 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-B8Z6Jvzv.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-C44pakCn.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-500-normal-Bb4u56_6.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-500-normal-BdVUvljg.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-400-normal-CWV284fw.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-400-normal-DLkyKLvH.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-500-normal-8-8HP2PF.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-ext-500-normal-DaDZE_Na.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-400-normal-BccYJ-vZ.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-400-normal-Cw5-AHNN.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-500-normal-By8GFJzz.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-500-normal-z-Q6FFuG.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-400-normal-DJ5YJwmz.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-400-normal-Dn3IlU-Z.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-CUHe9xxf.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-DVVamBqs.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-400-normal-CEpydyUl.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-400-normal-Cp7z-ARB.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-500-normal-BYjRCDVy.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-ext-500-normal-D-qasQTj.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-BbG3LG1A.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-DR1UuFon.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-8N8MYVKB.woff +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-Bi3OSTTW.woff2 +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/design-tokens.css +113 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/favicon.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/icon-192.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/index.html +55 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/manifest.webmanifest +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/project-settings.js +9602 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/sw.js +8 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/workspace_service.py +218 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/agents/bugx.md +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/dsh-patch.yml +18 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/cordis.patch.yml +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/index.js +219 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/package.json +28 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx/SKILL.md +70 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx-dsh/SKILL.md +229 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/client.js +87 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/cordis.patch.yml +4 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/index.js +7 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/package.json +27 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/mcp-lock.json +3075 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/opencode.json +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/README.md +12 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/index.ts +299 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/manifest.json +11 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/pi/skills/bugx/SKILL.md +69 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-claude/SKILL.md +326 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-opencode/SKILL.md +129 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-zcode/SKILL.md +459 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/connector-meta.json +19 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/icon.png +0 -0
- bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/skills/bugx/SKILL.md +70 -0
- bugx_cli-0.1.1.dist-info/METADATA +335 -0
- bugx_cli-0.1.1.dist-info/RECORD +762 -0
- bugx_cli-0.1.1.dist-info/WHEEL +5 -0
- bugx_cli-0.1.1.dist-info/entry_points.txt +2 -0
- bugx_cli-0.1.1.dist-info/licenses/LICENSE +55 -0
- bugx_cli-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,856 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""core/scenario_eval.py - L1–L6 分级场景自回归评测引擎。
|
|
3
|
+
|
|
4
|
+
## 为什么需要它(而不是扩 ``agent_eval.py``)
|
|
5
|
+
|
|
6
|
+
``agent_eval.py`` 回答的是「给定有已知漏洞的 fixture,能发现几个」。它的 case
|
|
7
|
+
schema **强制**要求 ``fixture`` + ``root_cause`` + ``minimum_severity``——三个
|
|
8
|
+
字段都预设了「这段代码里藏着一个可命名的漏洞」。
|
|
9
|
+
|
|
10
|
+
但 L1–L3 级测的根本不是漏洞:
|
|
11
|
+
|
|
12
|
+
L1 空项目 有没有覆盖单元?空结果是否明确而非崩溃/伪造/挂死?
|
|
13
|
+
L2 单文件 单元拆分对不对?干净代码上会不会**编造**发现?
|
|
14
|
+
L3 多语言 Python/JS/Go 是否都被真的看过,还是静默跳过某种语言?
|
|
15
|
+
|
|
16
|
+
把这些硬塞进 ``root_cause`` 语义会得到两种坏结果:要么给干净代码编造标准答案
|
|
17
|
+
(污染 precision 基线),要么这些级别根本进不了评测。所以两类评测分开:
|
|
18
|
+
**漏洞发现**留在 ``agent_eval.py``,**流水线行为**归本模块。
|
|
19
|
+
|
|
20
|
+
## 分级
|
|
21
|
+
|
|
22
|
+
L1 空项目 最小链路:不崩、不伪造、不死循环
|
|
23
|
+
L2 单文件 单元拆分 + 干净代码零误报
|
|
24
|
+
L3 多语言 语言覆盖完整性
|
|
25
|
+
L4 已知漏洞 委托 ``agent_eval.py``(本模块只做汇总)
|
|
26
|
+
L5 畸形环境 环境不健康时必须 fail-closed
|
|
27
|
+
L6 并发/超时 委托 ``scripts/run_fault_matrix.py``
|
|
28
|
+
|
|
29
|
+
## 收据
|
|
30
|
+
|
|
31
|
+
每次运行产出 ``scenario-receipt.json``:逐级结论 + 度量(耗时、Token)+ 与基线的
|
|
32
|
+
差异。收据是**可比较**的:同一份基线跑两次,除时间戳外应当字节一致。
|
|
33
|
+
"""
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
# --- 引擎导入根(直接执行脚本时自举 core.* 命名空间)---
|
|
36
|
+
import sys as _sys
|
|
37
|
+
from pathlib import Path as _Path
|
|
38
|
+
|
|
39
|
+
for _p in _Path(__file__).resolve().parents:
|
|
40
|
+
if (_p / "core" / "bugx.md").is_file():
|
|
41
|
+
if str(_p) not in _sys.path:
|
|
42
|
+
_sys.path.insert(0, str(_p))
|
|
43
|
+
break
|
|
44
|
+
del _p
|
|
45
|
+
import sys
|
|
46
|
+
from pathlib import Path
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
import argparse
|
|
50
|
+
import hashlib
|
|
51
|
+
import json
|
|
52
|
+
import os
|
|
53
|
+
import re
|
|
54
|
+
import shutil
|
|
55
|
+
import subprocess
|
|
56
|
+
import tempfile
|
|
57
|
+
import time
|
|
58
|
+
from dataclasses import asdict, dataclass, field
|
|
59
|
+
from pathlib import Path
|
|
60
|
+
|
|
61
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
62
|
+
SCENARIOS_ROOT = REPO_ROOT / "verification" / "evals" / "scenarios"
|
|
63
|
+
RECEIPT_SCHEMA = 1
|
|
64
|
+
|
|
65
|
+
#: 级别定义。``runner`` 说明该级由谁执行:本模块或外部组件。
|
|
66
|
+
LEVELS: tuple[dict[str, object], ...] = (
|
|
67
|
+
{
|
|
68
|
+
"id": "L1", "name": "空项目", "dir": "L1-empty",
|
|
69
|
+
"runner": "builtin",
|
|
70
|
+
"intent": "最小链路:无覆盖单元时给出明确空结果,不崩、不伪造、不挂死",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "L2", "name": "单文件", "dir": "L2-single",
|
|
74
|
+
"runner": "builtin",
|
|
75
|
+
"intent": "单元拆分正确,且干净代码上零误报",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "L3", "name": "多语言", "dir": "L3-multilang",
|
|
79
|
+
"runner": "builtin",
|
|
80
|
+
"intent": "每种语言都被识别并纳入覆盖,不静默跳过",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "L4", "name": "已知漏洞", "dir": None,
|
|
84
|
+
"runner": "builtin",
|
|
85
|
+
"intent": "召回率/精确率/证据有效性(委托 agent_eval.py)",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "L5", "name": "畸形环境", "dir": "L5-malformed",
|
|
89
|
+
"runner": "builtin",
|
|
90
|
+
"intent": "环境不健康时 fail-closed,绝不静默降级",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "L6", "name": "并发超时", "dir": None,
|
|
94
|
+
"runner": "builtin",
|
|
95
|
+
"intent": "9 类故障注入(委托 scripts/run_fault_matrix.py)",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "L7", "name": "自身健康", "dir": None,
|
|
99
|
+
"runner": "builtin",
|
|
100
|
+
"intent": (
|
|
101
|
+
"BugX 自己有没有坏:6 类结构性风险内省(委托 l7_selfcheck.py)。"
|
|
102
|
+
"L1-L6 测「挖得准不准」,L7 测「BugX 自身是否健康」——"
|
|
103
|
+
"真机无人值守撞出的缺陷几乎全在这一层"
|
|
104
|
+
),
|
|
105
|
+
},
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass
|
|
110
|
+
class LevelResult:
|
|
111
|
+
"""单级结论。``ok`` 是唯一判定器;``detail`` 只说人话,不参与判定。"""
|
|
112
|
+
|
|
113
|
+
level: str
|
|
114
|
+
name: str
|
|
115
|
+
ok: bool
|
|
116
|
+
skipped: bool = False
|
|
117
|
+
duration_seconds: float = 0.0
|
|
118
|
+
checks: list[dict[str, object]] = field(default_factory=list)
|
|
119
|
+
detail: str = ""
|
|
120
|
+
metrics: dict[str, object] = field(default_factory=dict)
|
|
121
|
+
|
|
122
|
+
def add(self, name: str, ok: bool, detail: str = "") -> None:
|
|
123
|
+
self.checks.append({"check": name, "ok": bool(ok), "detail": detail})
|
|
124
|
+
if not ok:
|
|
125
|
+
self.ok = False
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _run(argv: list[str], *, cwd: Path, timeout: float = 120.0,
|
|
129
|
+
env: dict[str, str] | None = None) -> tuple[int, str, str]:
|
|
130
|
+
"""执行子命令并返回 (rc, stdout, stderr)。超时视为失败而非异常。"""
|
|
131
|
+
merged = {**os.environ, **(env or {})}
|
|
132
|
+
# 仓库直跑 CLI:子进程 cwd 是场景工作区,须显式指回仓库根;
|
|
133
|
+
# HOME 隔离:评测的全局引擎读写落在一次性沙箱,不碰真实 ~/.bugx/。
|
|
134
|
+
repo_root = _repo_root()
|
|
135
|
+
# 与仓库 wrapper(interfaces/bin/bugx.js)保持同一包入口,避免
|
|
136
|
+
# ``interfaces.cli.bugx_cli`` 的相对包名与内部绝对导入 ``bugx_cli``
|
|
137
|
+
# 分裂,误加载 site-packages 中的旧快照。
|
|
138
|
+
merged["PYTHONPATH"] = os.pathsep.join(
|
|
139
|
+
(str(repo_root / "interfaces" / "cli"), str(repo_root)),
|
|
140
|
+
)
|
|
141
|
+
# L3 等场景验证当前 checkout;不让已安装的旧引擎成为量具。
|
|
142
|
+
merged["BUGX_DEV_MODE"] = "1"
|
|
143
|
+
# 源码树里的版本声明是构建模板;开发态启动门禁需要同一解析值。
|
|
144
|
+
merged["BUGX_VERSION"] = os.environ.get("BUGX_VERSION", "0.1.1")
|
|
145
|
+
merged["HOME"] = str(_sandbox_home())
|
|
146
|
+
try:
|
|
147
|
+
proc = subprocess.run(
|
|
148
|
+
argv, cwd=str(cwd), capture_output=True, text=True,
|
|
149
|
+
timeout=timeout, env=merged, check=False,
|
|
150
|
+
)
|
|
151
|
+
return proc.returncode, proc.stdout, proc.stderr
|
|
152
|
+
except subprocess.TimeoutExpired as exc:
|
|
153
|
+
return 124, exc.stdout or "", f"timeout after {timeout}s"
|
|
154
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
155
|
+
return 127, "", f"{type(exc).__name__}: {exc}"
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _materialize(level_dir: Path, dest: Path) -> Path:
|
|
159
|
+
"""把只读场景复制到临时工作区。场景本身保持干净,不写入运行产物。
|
|
160
|
+
|
|
161
|
+
为什么不原地跑:``bugx init`` 会写 ``.bugx/``、``.dsh/`` 等目录。跑在仓库里
|
|
162
|
+
会污染工作树,且上一轮残留会让下一轮判定失真(典型表现:L1「空项目」因为
|
|
163
|
+
上一轮的 ``.bugx`` 而识别出单元)。
|
|
164
|
+
"""
|
|
165
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
166
|
+
shutil.copytree(level_dir, dest, dirs_exist_ok=True)
|
|
167
|
+
return dest
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _init_git_baseline(work: Path) -> tuple[int, str]:
|
|
171
|
+
"""为需要真实项目基线的场景创建一次性 Git 仓库。"""
|
|
172
|
+
commands = (
|
|
173
|
+
["git", "init", "-q", "."],
|
|
174
|
+
["git", "config", "user.name", "BugX Scenario"],
|
|
175
|
+
["git", "config", "user.email", "bugx-scenario@invalid"],
|
|
176
|
+
["git", "add", "-A"],
|
|
177
|
+
[
|
|
178
|
+
"git", "-c", "user.name=BugX Scenario",
|
|
179
|
+
"-c", "user.email=bugx-scenario@invalid",
|
|
180
|
+
"commit", "-qm", "scenario fixture",
|
|
181
|
+
],
|
|
182
|
+
)
|
|
183
|
+
for argv in commands:
|
|
184
|
+
rc, out, err = _run(argv, cwd=work, timeout=60.0)
|
|
185
|
+
if rc != 0:
|
|
186
|
+
return rc, (err or out)[-300:]
|
|
187
|
+
return 0, ""
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _repo_root() -> Path:
|
|
191
|
+
"""引擎仓根(core/bugx.md 所在目录的父级)。"""
|
|
192
|
+
return Path(__file__).resolve().parents[2]
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
_SANDBOX_HOME: list[Path] = []
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def _sandbox_home() -> Path:
|
|
199
|
+
"""一次评测会话共享的隔离 HOME,保护真实 ~/.bugx/ 不被评测写入。
|
|
200
|
+
|
|
201
|
+
F-RSI-20261110-002 评测版事故:全局 ~/.bugx/core 曾被场景评测的
|
|
202
|
+
``bugx init`` 静默写入(旧 build 的快照 CLI + 无 HOME 隔离),随后
|
|
203
|
+
「已安装 431 > 安装源 430」的降级判定让 init 在 L1/L2/L3 全挂。
|
|
204
|
+
"""
|
|
205
|
+
if not _SANDBOX_HOME:
|
|
206
|
+
_SANDBOX_HOME.append(Path(tempfile.mkdtemp(prefix="bugx-scenario-home-")))
|
|
207
|
+
return _SANDBOX_HOME[0]
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _bugx_argv() -> list[str]:
|
|
211
|
+
"""量具与被测物同源:优先仓库直跑 CLI;PATH 快照只作最后退化。
|
|
212
|
+
|
|
213
|
+
快照 CLI 落后仓库多个 build,用它评测仓库修复等于拿旧量具测新代码
|
|
214
|
+
(实测:快照 430 对仓库 434 的 init 在三个级别全部「拒绝降级」)。
|
|
215
|
+
"""
|
|
216
|
+
return [sys.executable, "-m", "bugx_cli.cli"]
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
#: 覆盖清单的两种真实形态。写成两种不是「兼容性懒惰」——实测 2026-11-03:
|
|
220
|
+
#: ``module-coverage.md`` 的单元是**表格行**(``| 1 | 内部 | ROOT | ... |``),
|
|
221
|
+
#: 第一次写这个函数时按列表行 ``- [ ]`` 解析,于是在三语言场景上数出 0 个单元、
|
|
222
|
+
#: 误判成产品缺陷。同时保留列表行是因为 bootstrap 阶段确实会产出那种形态。
|
|
223
|
+
_TABLE_UNIT = re.compile(r"^\|\s*\d+\s*\|")
|
|
224
|
+
_LIST_UNIT = re.compile(r"^- \[")
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def _count_units(root: Path) -> int | None:
|
|
228
|
+
"""读覆盖清单里的单元数。清单缺失返回 None(区别于「有清单但 0 单元」)。"""
|
|
229
|
+
manifests = list((root / ".bugx").rglob("module-coverage.md"))
|
|
230
|
+
if not manifests:
|
|
231
|
+
return None
|
|
232
|
+
total = 0
|
|
233
|
+
for manifest in manifests:
|
|
234
|
+
try:
|
|
235
|
+
text = manifest.read_text(encoding="utf-8", errors="replace")
|
|
236
|
+
except OSError:
|
|
237
|
+
continue
|
|
238
|
+
for line in text.splitlines():
|
|
239
|
+
if _TABLE_UNIT.match(line) or _LIST_UNIT.match(line):
|
|
240
|
+
total += 1
|
|
241
|
+
return total
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def run_l1_empty(root: Path, work: Path) -> LevelResult:
|
|
245
|
+
"""L1:空项目必须给出明确的空结果。
|
|
246
|
+
|
|
247
|
+
判定不看「有没有输出」,看三件事同时成立:
|
|
248
|
+
1. 命令正常返回(不崩、不超时)
|
|
249
|
+
2. 覆盖单元为 0 或被明确标注为「无」
|
|
250
|
+
3. 没有伪造发现
|
|
251
|
+
"""
|
|
252
|
+
result = LevelResult(level="L1", name="空项目", ok=True)
|
|
253
|
+
started = time.monotonic()
|
|
254
|
+
rc, out, err = _run([*_bugx_argv(), "init", "--root", ".", "--cloud-sync", "local"],
|
|
255
|
+
cwd=work, timeout=180.0)
|
|
256
|
+
result.add("init 成功", rc == 0, (err or out)[-300:] if rc != 0 else "")
|
|
257
|
+
units = _count_units(work)
|
|
258
|
+
result.add(
|
|
259
|
+
"覆盖单元为 0",
|
|
260
|
+
units in (0, None),
|
|
261
|
+
f"发现 {units} 个单元;空项目不应有可挖掘单元",
|
|
262
|
+
)
|
|
263
|
+
# 空项目若报出发现,一定是伪造
|
|
264
|
+
findings = list((work / ".bugx").rglob("findings*.json"))
|
|
265
|
+
fabricated = []
|
|
266
|
+
for path in findings:
|
|
267
|
+
try:
|
|
268
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
269
|
+
except (OSError, ValueError):
|
|
270
|
+
continue
|
|
271
|
+
if isinstance(payload, dict) and payload.get("findings"):
|
|
272
|
+
fabricated.append(path.name)
|
|
273
|
+
result.add("无伪造发现", not fabricated, f"空项目产出发现:{fabricated}")
|
|
274
|
+
result.duration_seconds = time.monotonic() - started
|
|
275
|
+
result.metrics = {"units": units, "fabricated": len(fabricated)}
|
|
276
|
+
return result
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def run_l2_single(root: Path, work: Path) -> LevelResult:
|
|
280
|
+
"""L2:单文件必须正确拆出 1 个单元,且干净代码上零误报。"""
|
|
281
|
+
result = LevelResult(level="L2", name="单文件", ok=True)
|
|
282
|
+
started = time.monotonic()
|
|
283
|
+
rc, out, err = _run([*_bugx_argv(), "init", "--root", ".", "--cloud-sync", "local"],
|
|
284
|
+
cwd=work, timeout=180.0)
|
|
285
|
+
result.add("init 成功", rc == 0, (err or out)[-300:] if rc != 0 else "")
|
|
286
|
+
source_files = [
|
|
287
|
+
p for p in work.rglob("*.py")
|
|
288
|
+
if ".bugx" not in p.parts and p.name != "conftest.py"
|
|
289
|
+
]
|
|
290
|
+
result.add("场景含 1 个源文件", len(source_files) == 1,
|
|
291
|
+
f"实际 {len(source_files)} 个:{[p.name for p in source_files]}")
|
|
292
|
+
# 干净代码:任何断言为 confirmed 的发现都算误报
|
|
293
|
+
false_positives = _confirmed_findings(work)
|
|
294
|
+
result.add(
|
|
295
|
+
"干净代码零误报", not false_positives,
|
|
296
|
+
f"误报 {len(false_positives)} 条:{false_positives[:3]}",
|
|
297
|
+
)
|
|
298
|
+
result.duration_seconds = time.monotonic() - started
|
|
299
|
+
result.metrics = {"source_files": len(source_files),
|
|
300
|
+
"false_positives": len(false_positives)}
|
|
301
|
+
return result
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def _confirmed_findings(root: Path) -> list[str]:
|
|
305
|
+
"""收集被判定为 confirmed 的发现标题(用于零误报检查)。"""
|
|
306
|
+
titles: list[str] = []
|
|
307
|
+
for path in (root / ".bugx").rglob("*.json"):
|
|
308
|
+
if "findings" not in path.name:
|
|
309
|
+
continue
|
|
310
|
+
try:
|
|
311
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
312
|
+
except (OSError, ValueError):
|
|
313
|
+
continue
|
|
314
|
+
items = payload.get("findings") if isinstance(payload, dict) else payload
|
|
315
|
+
if not isinstance(items, list):
|
|
316
|
+
continue
|
|
317
|
+
for item in items:
|
|
318
|
+
if not isinstance(item, dict):
|
|
319
|
+
continue
|
|
320
|
+
status = str(item.get("status", "")).lower()
|
|
321
|
+
if status in {"confirmed", "verified", "fixed"}:
|
|
322
|
+
titles.append(str(item.get("title") or item.get("id") or "?"))
|
|
323
|
+
return titles
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def run_l3_multilang(root: Path, work: Path) -> LevelResult:
|
|
327
|
+
"""L3:三种语言都必须被识别并纳入覆盖。
|
|
328
|
+
|
|
329
|
+
这一级抓的是「静默跳过某种语言」——最危险的一类缺陷,因为审计报告看起来
|
|
330
|
+
完整,实际有文件从未被看过。
|
|
331
|
+
"""
|
|
332
|
+
result = LevelResult(level="L3", name="多语言", ok=True)
|
|
333
|
+
started = time.monotonic()
|
|
334
|
+
git_rc, git_detail = _init_git_baseline(work)
|
|
335
|
+
if git_rc != 0:
|
|
336
|
+
rc, out, err = git_rc, "", f"Git 基线初始化失败:{git_detail}"
|
|
337
|
+
else:
|
|
338
|
+
rc, out, err = _run(
|
|
339
|
+
[*_bugx_argv(), "init", "--root", ".", "--cloud-sync", "local"],
|
|
340
|
+
cwd=work, timeout=180.0,
|
|
341
|
+
)
|
|
342
|
+
result.add("init 成功", rc == 0, (err or out)[-300:] if rc != 0 else "")
|
|
343
|
+
expected = {".py": "python", ".js": "javascript", ".go": "go"}
|
|
344
|
+
present = {ext: kind for ext, kind in expected.items()
|
|
345
|
+
if any(work.rglob(f"*{ext}"))}
|
|
346
|
+
result.add(
|
|
347
|
+
"场景含三种语言", len(present) == 3,
|
|
348
|
+
f"仅发现:{sorted(present.values())}",
|
|
349
|
+
)
|
|
350
|
+
# 语言探测必须对每个文件给出判定,缺失即「静默跳过」
|
|
351
|
+
rc, out, err = _run(
|
|
352
|
+
[*_bugx_argv(), "engine", "--root", ".", "status"], cwd=work, timeout=120.0,
|
|
353
|
+
)
|
|
354
|
+
result.add("engine status 可执行", rc == 0, (err or out)[-300:] if rc != 0 else "")
|
|
355
|
+
units = _count_units(work)
|
|
356
|
+
result.add(
|
|
357
|
+
"覆盖单元非空", bool(units),
|
|
358
|
+
f"三语言场景应有覆盖单元,实际 {units}",
|
|
359
|
+
)
|
|
360
|
+
result.duration_seconds = time.monotonic() - started
|
|
361
|
+
result.metrics = {"languages": sorted(present.values()), "units": units}
|
|
362
|
+
return result
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def _doctor_check(root: Path, name_contains: str) -> dict[str, object]:
|
|
366
|
+
"""在 ``doctor --json`` 输出里取指定检查项的结论。
|
|
367
|
+
|
|
368
|
+
用结构化 JSON 而不是 grep 文本:文本判据无法区分「这条检查失败」与
|
|
369
|
+
「别处的日志恰好含这个词」,而 L5 的全部价值就在于精确定位。
|
|
370
|
+
"""
|
|
371
|
+
rc, out, err = _run(
|
|
372
|
+
[*_bugx_argv(), "doctor", "--root", ".", "--json"],
|
|
373
|
+
cwd=root, timeout=120.0,
|
|
374
|
+
)
|
|
375
|
+
payload: object = None
|
|
376
|
+
for candidate in (out, err):
|
|
377
|
+
text = (candidate or "").strip()
|
|
378
|
+
if not text.startswith("{"):
|
|
379
|
+
continue
|
|
380
|
+
try:
|
|
381
|
+
payload = json.loads(text)
|
|
382
|
+
break
|
|
383
|
+
except ValueError:
|
|
384
|
+
continue
|
|
385
|
+
if not isinstance(payload, dict):
|
|
386
|
+
return {"ok": False, "detail": f"doctor --json 无有效输出 (rc={rc})"}
|
|
387
|
+
checks = payload.get("checks")
|
|
388
|
+
if not isinstance(checks, list):
|
|
389
|
+
return {"ok": False, "detail": "doctor --json 缺 checks 数组"}
|
|
390
|
+
for item in checks:
|
|
391
|
+
if not isinstance(item, dict):
|
|
392
|
+
continue
|
|
393
|
+
if name_contains in str(item.get("name", "")):
|
|
394
|
+
return {"ok": bool(item.get("ok")), "detail": str(item.get("detail") or "")}
|
|
395
|
+
return {"ok": False, "detail": f"未找到检查项:{name_contains}"}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
def _probe_engine_integrity(root: Path) -> dict[str, object]:
|
|
399
|
+
"""引擎完整性检查项——缺 engine-integrity.json 时它必须失败。"""
|
|
400
|
+
return _doctor_check(root, "引擎完整性")
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def _probe_state_writable(root: Path) -> dict[str, object]:
|
|
404
|
+
"""状态目录可写性——只读时写入类检查必须失败。"""
|
|
405
|
+
# doctor 没有专门的「状态目录可写」项,改用实际写入探测:与 doctor 的
|
|
406
|
+
# fail-closed 结论等价,但更直接(能否写是一条客观事实,不是文本判断)。
|
|
407
|
+
probe = root / ".bugx" / "state" / ".write-probe"
|
|
408
|
+
try:
|
|
409
|
+
probe.parent.mkdir(parents=True, exist_ok=True)
|
|
410
|
+
probe.write_text("x", encoding="utf-8")
|
|
411
|
+
probe.unlink()
|
|
412
|
+
return {"ok": True, "detail": "状态目录可写"}
|
|
413
|
+
except OSError as exc:
|
|
414
|
+
return {"ok": False, "detail": f"{type(exc).__name__}: {exc}"}
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def _probe_coverage_paths(root: Path) -> dict[str, object]:
|
|
418
|
+
"""覆盖清单路径安全性——含逃逸路径时必须被拒。"""
|
|
419
|
+
return _doctor_check(root, "覆盖")
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
def _inject_missing_integrity(work: Path) -> None:
|
|
423
|
+
for path in work.rglob("engine-integrity.json"):
|
|
424
|
+
path.unlink()
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def _inject_readonly_state(work: Path) -> None:
|
|
428
|
+
state = work / ".bugx" / "state"
|
|
429
|
+
state.mkdir(parents=True, exist_ok=True)
|
|
430
|
+
state.chmod(0o500)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def _inject_escaping_manifest(work: Path) -> None:
|
|
434
|
+
"""覆盖清单里塞一个逃逸路径(../../etc/passwd 类)。"""
|
|
435
|
+
manifests = list((work / ".bugx").rglob("module-coverage.md"))
|
|
436
|
+
target = manifests[0] if manifests else (
|
|
437
|
+
work / ".bugx" / "state" / "module-coverage.md"
|
|
438
|
+
)
|
|
439
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
440
|
+
target.write_text(
|
|
441
|
+
"- [ ] ../../../../etc/passwd\n- [ ] 内部:src/app.py:all\n",
|
|
442
|
+
encoding="utf-8",
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
#: 畸形注入用例:(名称, 注入函数, 定向探针)。探针必须能**区分**注入前后,
|
|
447
|
+
#: 否则这一级等于没测——第一版就是败在这里。
|
|
448
|
+
MALFORMED_CASES: tuple[tuple[str, object, object], ...] = (
|
|
449
|
+
("状态目录只读", _inject_readonly_state, _probe_state_writable),
|
|
450
|
+
("覆盖清单含逃逸路径", _inject_escaping_manifest, _probe_coverage_paths),
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
#: 刻意**不**收录的畸形,附原因——避免后来者再把它加回来重踩:
|
|
454
|
+
#:
|
|
455
|
+
#: * 「缺 engine-integrity.json」:``engine-integrity.json`` 是**全局引擎**的
|
|
456
|
+
#: 文件,项目里本来就没有。删它等于什么都没做,而 doctor 如实报告「全局引擎
|
|
457
|
+
#: 488 个文件哈希一致」是对的。第一版把它当项目级畸形,判据因此永远通过——
|
|
458
|
+
#: 这类「测了一个不存在的对象」的用例,比没有用例更糟:它给出虚假的安全感。
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def run_l5_malformed(root: Path, work: Path) -> LevelResult:
|
|
462
|
+
"""L5:环境不健康时必须 fail-closed。
|
|
463
|
+
|
|
464
|
+
## 判据为什么必须**定向**
|
|
465
|
+
|
|
466
|
+
第一版判据是「``doctor`` 非零退出 **或** 输出里出现『缺失/拒绝/权限』等词」。
|
|
467
|
+
实测这个判据是坏的:一个**完全正常**的项目跑 ``doctor`` 也返回 rc=1,并含
|
|
468
|
+
27 处上述关键词——因为总有可选宿主检查在失败(hosts.json、Pi Skill、
|
|
469
|
+
OpenCode 配置)。于是该判据无条件放行,L5 等于什么都没测。
|
|
470
|
+
|
|
471
|
+
现在的判据是:拿**同一次运行**里、同一条检查项在「注入前」与「注入后」的
|
|
472
|
+
结论比对。只有「注入前通过 → 注入后失败」才算真的 fail-closed。这样自然
|
|
473
|
+
排除了那些与本次注入无关的既存失败。
|
|
474
|
+
"""
|
|
475
|
+
result = LevelResult(level="L5", name="畸形环境", ok=True)
|
|
476
|
+
started = time.monotonic()
|
|
477
|
+
scenario = SCENARIOS_ROOT / "L5-malformed"
|
|
478
|
+
for name, inject, probe in MALFORMED_CASES:
|
|
479
|
+
with tempfile.TemporaryDirectory(prefix="bugx-l5-") as tmp:
|
|
480
|
+
case_root = Path(tmp) / "proj"
|
|
481
|
+
case_root.mkdir(parents=True)
|
|
482
|
+
if scenario.is_dir():
|
|
483
|
+
shutil.copytree(scenario, case_root, dirs_exist_ok=True)
|
|
484
|
+
_run([*_bugx_argv(), "init", "--root", ".", "--cloud-sync", "local"],
|
|
485
|
+
cwd=case_root, timeout=120.0)
|
|
486
|
+
# 基线:注入**前**该检查项的状态。这一步是整个判据的地基。
|
|
487
|
+
before = probe(case_root)
|
|
488
|
+
try:
|
|
489
|
+
inject(case_root)
|
|
490
|
+
except OSError as exc:
|
|
491
|
+
result.add(f"{name}(注入)", False, f"注入失败:{exc}")
|
|
492
|
+
continue
|
|
493
|
+
after = probe(case_root)
|
|
494
|
+
if not before["ok"]:
|
|
495
|
+
# 注入前就没通过 → 这条检查项对本项目不适用,无法作为判据。
|
|
496
|
+
result.add(
|
|
497
|
+
f"{name}(前置状态)", True,
|
|
498
|
+
f"注入前该项已失败({before['detail'][:80]}),跳过定向比对",
|
|
499
|
+
)
|
|
500
|
+
continue
|
|
501
|
+
detected = not after["ok"]
|
|
502
|
+
result.add(
|
|
503
|
+
f"{name} → fail-closed",
|
|
504
|
+
detected,
|
|
505
|
+
(f"已检出({after['detail'][:120]})" if detected
|
|
506
|
+
else f"注入后仍报告通过({after['detail'][:120]}):畸形被静默接受"),
|
|
507
|
+
)
|
|
508
|
+
for path in case_root.rglob("*"):
|
|
509
|
+
try:
|
|
510
|
+
if path.is_dir():
|
|
511
|
+
path.chmod(0o700)
|
|
512
|
+
except OSError:
|
|
513
|
+
pass
|
|
514
|
+
result.duration_seconds = time.monotonic() - started
|
|
515
|
+
return result
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
def run_l4_known_vulns(root: Path, work: Path) -> LevelResult:
|
|
519
|
+
"""L4:委托 ``agent_eval.py`` 的召回/精确/证据/复现评分。
|
|
520
|
+
|
|
521
|
+
这里**不重算**任何指标——重算是分叉的开始。本函数只做两件事:调用既有评测、
|
|
522
|
+
把它的结论翻译成 LevelResult。度量(耗时/Token)随收据一起记录。
|
|
523
|
+
"""
|
|
524
|
+
result = LevelResult(level="L4", name="已知漏洞", ok=True)
|
|
525
|
+
started = time.monotonic()
|
|
526
|
+
rc, out, err = _run(
|
|
527
|
+
[sys.executable, str(REPO_ROOT / "core" / "agent" / "agent_eval.py"),
|
|
528
|
+
"score", "--strict"],
|
|
529
|
+
cwd=REPO_ROOT, timeout=300.0,
|
|
530
|
+
)
|
|
531
|
+
combined = f"{out}\n{err}"
|
|
532
|
+
result.add("agent_eval score 通过", rc == 0, combined[-400:] if rc != 0 else "")
|
|
533
|
+
# 抓取关键指标写进收据,便于跨轮比较
|
|
534
|
+
metrics: dict[str, object] = {}
|
|
535
|
+
for line in combined.splitlines():
|
|
536
|
+
line = line.strip()
|
|
537
|
+
for label, key in (
|
|
538
|
+
("发现率:", "recall"), ("精确率:", "precision"),
|
|
539
|
+
("证据有效率:", "evidence_validity"), ("可复现率:", "reproducibility"),
|
|
540
|
+
("综合质量分:", "quality"),
|
|
541
|
+
# F-022 管线接线:评测集内嵌 feature baseline 时 completeness
|
|
542
|
+
# 维度随 agent_eval 输出流转(无 baseline 时这些行不存在,跳过)
|
|
543
|
+
("完备性召回:", "completeness_recall"),
|
|
544
|
+
("完备性精确:", "completeness_precision"),
|
|
545
|
+
):
|
|
546
|
+
if line.startswith(label):
|
|
547
|
+
value = line[len(label):].strip()
|
|
548
|
+
metrics[key] = value
|
|
549
|
+
if line.startswith("耗时/Token:"):
|
|
550
|
+
parts = line[len("耗时/Token:"):].strip().split("/")
|
|
551
|
+
metrics["duration"] = parts[0].strip()
|
|
552
|
+
metrics["tokens"] = parts[-1].strip() if len(parts) > 1 else None
|
|
553
|
+
recall = metrics.get("recall")
|
|
554
|
+
result.add(
|
|
555
|
+
"关键指标可解析", bool(recall),
|
|
556
|
+
(f"发现率:{recall}" if recall
|
|
557
|
+
else f"未能从输出解析发现率:{combined[-200:]}"),
|
|
558
|
+
)
|
|
559
|
+
result.duration_seconds = time.monotonic() - started
|
|
560
|
+
result.metrics = metrics
|
|
561
|
+
return result
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def run_l6_fault_matrix(root: Path, work: Path) -> LevelResult:
|
|
565
|
+
"""L6:委托 ``scripts/run_fault_matrix.py`` 的 9 类故障注入。
|
|
566
|
+
|
|
567
|
+
同样不重写:故障注入的语义(租约回收、预算终态、输出截断…)已经在那个
|
|
568
|
+
脚本里被仔细定义过,复制一份只会让两处慢慢漂移。
|
|
569
|
+
"""
|
|
570
|
+
result = LevelResult(level="L6", name="并发超时", ok=True)
|
|
571
|
+
started = time.monotonic()
|
|
572
|
+
sandbox = Path(tempfile.mkdtemp(prefix="bugx-l6-"))
|
|
573
|
+
receipt = sandbox / "fault-matrix-receipt.json"
|
|
574
|
+
try:
|
|
575
|
+
rc, out, err = _run(
|
|
576
|
+
[sys.executable, str(REPO_ROOT / "scripts" / "cve" / "run_fault_matrix.py"),
|
|
577
|
+
"--sandbox", str(sandbox), "--output", str(receipt), "--json"],
|
|
578
|
+
cwd=REPO_ROOT, timeout=600.0,
|
|
579
|
+
)
|
|
580
|
+
combined = f"{out}\n{err}"
|
|
581
|
+
result.add("故障矩阵通过", rc == 0, combined[-400:] if rc != 0 else "")
|
|
582
|
+
metrics: dict[str, object] = {}
|
|
583
|
+
if receipt.is_file():
|
|
584
|
+
try:
|
|
585
|
+
payload = json.loads(receipt.read_text(encoding="utf-8"))
|
|
586
|
+
except (OSError, ValueError):
|
|
587
|
+
payload = None
|
|
588
|
+
if isinstance(payload, dict):
|
|
589
|
+
scenarios = payload.get("scenarios") or payload.get("cases") or []
|
|
590
|
+
if isinstance(scenarios, list):
|
|
591
|
+
metrics["scenarios_total"] = len(scenarios)
|
|
592
|
+
# 真实收据用 ``status`` 字符串(PASSED/FAILED),不是 ``ok``
|
|
593
|
+
# 布尔。第一版按 ``not s.get("ok", True)`` 取失败项,恒为空,
|
|
594
|
+
# 于是「全部通过」与「判别失效」在收据里长得一模一样。
|
|
595
|
+
failed = [
|
|
596
|
+
(s.get("case_id") or s.get("name") or "?")
|
|
597
|
+
for s in scenarios
|
|
598
|
+
if isinstance(s, dict)
|
|
599
|
+
and str(s.get("status", "")).upper() not in {"PASSED", "OK"}
|
|
600
|
+
]
|
|
601
|
+
metrics["scenarios_failed"] = failed
|
|
602
|
+
result.add(
|
|
603
|
+
"无失败场景", not failed,
|
|
604
|
+
f"{len(failed)} 个场景失败:{failed}",
|
|
605
|
+
)
|
|
606
|
+
result.add(
|
|
607
|
+
"收据含场景结果", bool(metrics.get("scenarios_total")),
|
|
608
|
+
"故障矩阵收据没有 scenarios/cases 数组",
|
|
609
|
+
)
|
|
610
|
+
else:
|
|
611
|
+
result.add("生成故障矩阵收据", False, f"缺少 {receipt}")
|
|
612
|
+
result.duration_seconds = time.monotonic() - started
|
|
613
|
+
result.metrics = metrics
|
|
614
|
+
return result
|
|
615
|
+
finally:
|
|
616
|
+
shutil.rmtree(sandbox, ignore_errors=True)
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
def run_l7_selfcheck(root: Path, work: Path) -> LevelResult:
|
|
620
|
+
"""L7:BugX 自身健康自检。
|
|
621
|
+
|
|
622
|
+
与 L1-L6 的根本区别:**不需要外部项目**。L1-L6 都在验证「给一个项目,
|
|
623
|
+
BugX 能不能正确处理」,L7 验证「BugX 自己的结构有没有坏」。
|
|
624
|
+
|
|
625
|
+
## 静态与动态两层
|
|
626
|
+
|
|
627
|
+
静态 6 项(``l7_selfcheck``)是结构分析,0.00s,每轮都跑。
|
|
628
|
+
动态 4 项(``l7_dynamic``)真起子进程跑 CLI,约 12s,按需开启。
|
|
629
|
+
|
|
630
|
+
为什么不在这一级默认开动态:L7 作为级别会被每轮调用,一条 12s 的
|
|
631
|
+
检查会让整轮变慢 30%,然后它就会被从流程里摘掉——保护归零。
|
|
632
|
+
动态层通过 ``RSI_L7_DYNAMIC=1`` 显式开启,用于提交前 / 排查。
|
|
633
|
+
|
|
634
|
+
这个取舍是刻意的:**能持续跑的低成本检查,胜过跑不动的高成本检查**。
|
|
635
|
+
"""
|
|
636
|
+
result = LevelResult(level="L7", name="自身健康", ok=True)
|
|
637
|
+
started = time.monotonic()
|
|
638
|
+
try:
|
|
639
|
+
from core.repair import l7_selfcheck
|
|
640
|
+
except ImportError as exc: # 归档路径导入失败必须显式判红,而不是换名重试
|
|
641
|
+
result.add("自检模块可导入", False, str(exc))
|
|
642
|
+
return result
|
|
643
|
+
|
|
644
|
+
dynamic = os.environ.get("RSI_L7_DYNAMIC", "").strip() in {"1", "true", "yes"}
|
|
645
|
+
payload = l7_selfcheck.run_all(root, dynamic=dynamic)
|
|
646
|
+
summary = payload.get("summary", {})
|
|
647
|
+
if summary.get("not_applicable"):
|
|
648
|
+
# 目标不是引擎仓库:跳过而不是记 0/0「通过」。0/0 会被误读成
|
|
649
|
+
# 「什么都没检查但绿灯」,而实际情况是「这层检查对当前目标无意义」。
|
|
650
|
+
result.ok = True
|
|
651
|
+
result.skipped = True
|
|
652
|
+
result.add("L7 不适用", True, str(summary.get("reason") or ""))
|
|
653
|
+
result.duration_seconds = round(time.monotonic() - started, 2)
|
|
654
|
+
return result
|
|
655
|
+
result.add(
|
|
656
|
+
"全部自检通过",
|
|
657
|
+
bool(summary.get("ok")),
|
|
658
|
+
f"{summary.get('passed', 0)}/{summary.get('total', 0)} 通过"
|
|
659
|
+
+ (f";失败:{', '.join(summary.get('checks_failed', []))}"
|
|
660
|
+
if summary.get("checks_failed") else ""),
|
|
661
|
+
)
|
|
662
|
+
for check in payload.get("checks", []):
|
|
663
|
+
result.add(
|
|
664
|
+
f"{check.get('id')} {check.get('name')}",
|
|
665
|
+
bool(check.get("ok")),
|
|
666
|
+
str(check.get("detail") or "")[:300],
|
|
667
|
+
)
|
|
668
|
+
# 计时必须真实:L7 静态 0.00s、动态约 12s,两类成本差三个数量级。
|
|
669
|
+
# 不记时会让「动态到底值不值这个价」变成猜测。
|
|
670
|
+
result.duration_seconds = time.monotonic() - started
|
|
671
|
+
return result
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
BUILTIN_RUNNERS = {
|
|
675
|
+
"L1": run_l1_empty,
|
|
676
|
+
"L2": run_l2_single,
|
|
677
|
+
"L3": run_l3_multilang,
|
|
678
|
+
"L4": run_l4_known_vulns,
|
|
679
|
+
"L5": run_l5_malformed,
|
|
680
|
+
"L6": run_l6_fault_matrix,
|
|
681
|
+
"L7": run_l7_selfcheck,
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
#: 在**仓库根**执行、不需要临时工作区的级别。L4/L6 评的是仓库自带的评测集与
|
|
686
|
+
#: 故障矩阵,物化到临时目录反而会让它们找不到 ``verification/evals/`` 和 ``scripts/``。
|
|
687
|
+
REPO_LEVELS = frozenset({"L4", "L6", "L7"})
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
def run_level(level: dict[str, object], *, keep: bool = False) -> LevelResult:
|
|
691
|
+
"""执行单个级别。"""
|
|
692
|
+
level_id = str(level["id"])
|
|
693
|
+
runner = str(level["runner"])
|
|
694
|
+
if runner != "builtin":
|
|
695
|
+
return LevelResult(
|
|
696
|
+
level=level_id, name=str(level["name"]), ok=True, skipped=True,
|
|
697
|
+
detail=f"由 {runner} 执行:{level['intent']}",
|
|
698
|
+
)
|
|
699
|
+
if level_id in REPO_LEVELS:
|
|
700
|
+
return BUILTIN_RUNNERS[level_id](REPO_ROOT, REPO_ROOT)
|
|
701
|
+
scenario_dir = SCENARIOS_ROOT / str(level["dir"])
|
|
702
|
+
if not scenario_dir.is_dir():
|
|
703
|
+
return LevelResult(
|
|
704
|
+
level=level_id, name=str(level["name"]), ok=False,
|
|
705
|
+
detail=f"场景目录缺失:{scenario_dir}",
|
|
706
|
+
)
|
|
707
|
+
tmp_root = Path(tempfile.mkdtemp(prefix=f"bugx-{level_id.lower()}-"))
|
|
708
|
+
try:
|
|
709
|
+
work = _materialize(scenario_dir, tmp_root / "proj")
|
|
710
|
+
return BUILTIN_RUNNERS[level_id](tmp_root / "proj", work)
|
|
711
|
+
finally:
|
|
712
|
+
for path in tmp_root.rglob("*"):
|
|
713
|
+
try:
|
|
714
|
+
if path.is_dir():
|
|
715
|
+
path.chmod(0o700)
|
|
716
|
+
except OSError:
|
|
717
|
+
pass
|
|
718
|
+
if not keep:
|
|
719
|
+
shutil.rmtree(tmp_root, ignore_errors=True)
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
def build_receipt(results: list[LevelResult], *, started_at: float) -> dict[str, object]:
|
|
723
|
+
"""组装机器可读收据。字段顺序固定,便于跨轮 diff。"""
|
|
724
|
+
total_duration = sum(r.duration_seconds for r in results)
|
|
725
|
+
executed = [r for r in results if not r.skipped]
|
|
726
|
+
failed = [r.level for r in results if not r.ok]
|
|
727
|
+
return {
|
|
728
|
+
"schema_version": RECEIPT_SCHEMA,
|
|
729
|
+
"generated_at_unix": int(started_at),
|
|
730
|
+
"levels": [
|
|
731
|
+
{
|
|
732
|
+
"level": r.level,
|
|
733
|
+
"name": r.name,
|
|
734
|
+
"ok": r.ok,
|
|
735
|
+
"skipped": r.skipped,
|
|
736
|
+
"duration_seconds": round(r.duration_seconds, 3),
|
|
737
|
+
"metrics": r.metrics,
|
|
738
|
+
"detail": r.detail,
|
|
739
|
+
"checks": r.checks,
|
|
740
|
+
}
|
|
741
|
+
for r in results
|
|
742
|
+
],
|
|
743
|
+
"summary": {
|
|
744
|
+
"levels_total": len(results),
|
|
745
|
+
"levels_executed": len(executed),
|
|
746
|
+
"levels_failed": failed,
|
|
747
|
+
"ok": not failed,
|
|
748
|
+
"duration_seconds": round(total_duration, 3),
|
|
749
|
+
},
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def receipt_digest(receipt: dict[str, object]) -> str:
|
|
754
|
+
"""除时间戳外的内容摘要,用于「同一基线两次运行应一致」的比对。"""
|
|
755
|
+
stable = {k: v for k, v in receipt.items() if k != "generated_at_unix"}
|
|
756
|
+
blob = json.dumps(stable, sort_keys=True, ensure_ascii=False).encode("utf-8")
|
|
757
|
+
return hashlib.sha256(blob).hexdigest()
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
def compare_baseline(receipt: dict[str, object], baseline: dict[str, object]) -> list[str]:
|
|
761
|
+
"""与基线对比,返回回退项。只报「变坏」,不报「新增通过」。"""
|
|
762
|
+
failures: list[str] = []
|
|
763
|
+
before = {str(item["level"]): item for item in baseline.get("levels", [])}
|
|
764
|
+
for item in receipt.get("levels", []):
|
|
765
|
+
level = str(item["level"])
|
|
766
|
+
prev = before.get(level)
|
|
767
|
+
if prev is None:
|
|
768
|
+
continue
|
|
769
|
+
if prev.get("ok") and not item.get("ok"):
|
|
770
|
+
failures.append(f"{level} 由通过回退为失败:{item.get('detail') or ''}")
|
|
771
|
+
# 总体回退只在「基线里的每个级别本轮都还在,且确实变坏」时才报。
|
|
772
|
+
# 否则新增一个从未跑过的级别(本身失败)也会触发总体告警——那不是回退,
|
|
773
|
+
# 是首次覆盖,混进来会让基线一加级别就永久报警。
|
|
774
|
+
prev_summary = baseline.get("summary", {})
|
|
775
|
+
known_bad = {
|
|
776
|
+
level for level, prev in before.items()
|
|
777
|
+
if prev.get("ok") is False
|
|
778
|
+
}
|
|
779
|
+
now_items = {str(item["level"]): item for item in receipt.get("levels", [])}
|
|
780
|
+
regressed = {
|
|
781
|
+
level for level in before
|
|
782
|
+
if before[level].get("ok") and level in now_items
|
|
783
|
+
and not now_items[level].get("ok")
|
|
784
|
+
}
|
|
785
|
+
if (prev_summary.get("ok") and not receipt.get("summary", {}).get("ok")
|
|
786
|
+
and regressed):
|
|
787
|
+
failures.append("总体由 ok 回退为失败")
|
|
788
|
+
return failures
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
def main(argv: list[str] | None = None) -> int:
|
|
792
|
+
parser = argparse.ArgumentParser(description="L1–L6 分级场景自回归评测")
|
|
793
|
+
parser.add_argument("--root", default=str(REPO_ROOT), help="仓库根目录")
|
|
794
|
+
parser.add_argument("--level", action="append", default=None,
|
|
795
|
+
help="只跑指定级别(可重复,如 --level L1 --level L2)")
|
|
796
|
+
parser.add_argument("--receipt", default=None, help="收据输出路径")
|
|
797
|
+
parser.add_argument("--baseline", default=None, help="基线收据路径(对比回退)")
|
|
798
|
+
parser.add_argument("--keep", action="store_true", help="保留临时工作区便于排查")
|
|
799
|
+
parser.add_argument("--json", action="store_true", help="把收据打到 stdout")
|
|
800
|
+
args = parser.parse_args(argv)
|
|
801
|
+
|
|
802
|
+
selected = set(args.level or [])
|
|
803
|
+
started = time.time()
|
|
804
|
+
results: list[LevelResult] = []
|
|
805
|
+
for level in LEVELS:
|
|
806
|
+
if selected and str(level["id"]) not in selected:
|
|
807
|
+
continue
|
|
808
|
+
results.append(run_level(level, keep=args.keep))
|
|
809
|
+
|
|
810
|
+
receipt = build_receipt(results, started_at=started)
|
|
811
|
+
receipt["digest"] = receipt_digest(receipt)
|
|
812
|
+
|
|
813
|
+
baseline_failures: list[str] = []
|
|
814
|
+
if args.baseline:
|
|
815
|
+
path = Path(args.baseline).expanduser()
|
|
816
|
+
if path.is_file():
|
|
817
|
+
try:
|
|
818
|
+
baseline_failures = compare_baseline(
|
|
819
|
+
receipt, json.loads(path.read_text(encoding="utf-8")),
|
|
820
|
+
)
|
|
821
|
+
except (OSError, ValueError) as exc:
|
|
822
|
+
baseline_failures = [f"基线无法读取:{exc}"]
|
|
823
|
+
else:
|
|
824
|
+
baseline_failures = [f"基线文件不存在:{path}"]
|
|
825
|
+
receipt["baseline_failures"] = baseline_failures
|
|
826
|
+
|
|
827
|
+
if args.receipt:
|
|
828
|
+
target = Path(args.receipt).expanduser()
|
|
829
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
830
|
+
target.write_text(
|
|
831
|
+
json.dumps(receipt, indent=2, ensure_ascii=False) + "\n", encoding="utf-8",
|
|
832
|
+
)
|
|
833
|
+
|
|
834
|
+
if args.json:
|
|
835
|
+
print(json.dumps(receipt, indent=2, ensure_ascii=False))
|
|
836
|
+
else:
|
|
837
|
+
for item in receipt["levels"]:
|
|
838
|
+
mark = "SKIP" if item["skipped"] else ("PASS" if item["ok"] else "FAIL")
|
|
839
|
+
print(f"[{item['level']}] {mark:4s} {item['name']:8s} "
|
|
840
|
+
f"{item['duration_seconds']:6.2f}s {item['detail']}")
|
|
841
|
+
for check in item["checks"]:
|
|
842
|
+
if not check["ok"]:
|
|
843
|
+
print(f" ✗ {check['check']}: {check['detail']}")
|
|
844
|
+
summary = receipt["summary"]
|
|
845
|
+
print(f"\n汇总:{summary['levels_executed']}/{summary['levels_total']} 级执行,"
|
|
846
|
+
f"失败 {summary['levels_failed'] or '无'},"
|
|
847
|
+
f"耗时 {summary['duration_seconds']:.2f}s")
|
|
848
|
+
for failure in baseline_failures:
|
|
849
|
+
print(f" 基线回退:{failure}")
|
|
850
|
+
|
|
851
|
+
failed = bool(receipt["summary"]["levels_failed"]) or bool(baseline_failures)
|
|
852
|
+
return 1 if failed else 0
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
if __name__ == "__main__":
|
|
856
|
+
sys.exit(main())
|