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,1253 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""launch_phases/supervisor_bridge.py - Supervisor 探活、MCP 状态门禁、探针健康检查与降级处理。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from core.launch_phases.startup_interaction import ask_interaction, answered_values
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import shlex
|
|
11
|
+
import stat
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
import time
|
|
15
|
+
from contextlib import contextmanager
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Any, Mapping
|
|
18
|
+
|
|
19
|
+
from core.launch_phases import common as _common
|
|
20
|
+
from core.launch_phases.common import (
|
|
21
|
+
AGENT_DIR,
|
|
22
|
+
MANIFEST_TABLE_HEADER,
|
|
23
|
+
RUNTIME_STARTED_THIS_PROCESS,
|
|
24
|
+
is_runtime_started_this_process,
|
|
25
|
+
supervisor_state_path,
|
|
26
|
+
TOOLS_KB,
|
|
27
|
+
PREP_RECORD,
|
|
28
|
+
PREP_VALIDATE,
|
|
29
|
+
RESTART_REQUIRED,
|
|
30
|
+
PROBE_JSON_CACHE,
|
|
31
|
+
SUPERVISOR_MCP_HARD_CHANNELS,
|
|
32
|
+
resolve_project_root,
|
|
33
|
+
uses_project_layout,
|
|
34
|
+
coverage_manifest_path,
|
|
35
|
+
child_environment,
|
|
36
|
+
run_child,
|
|
37
|
+
run_bounded,
|
|
38
|
+
sync_codebase_memory_env as _sync_codebase_memory_env,
|
|
39
|
+
bugx_paths,
|
|
40
|
+
)
|
|
41
|
+
import hashlib
|
|
42
|
+
import shutil
|
|
43
|
+
import uuid
|
|
44
|
+
from core.host_runtime import host_registry
|
|
45
|
+
from core.repair import self_heal
|
|
46
|
+
from core.runtime.tool_install_targets import PROBE_REPAIR_TARGETS
|
|
47
|
+
from core.launch_phases.startup_gates import (
|
|
48
|
+
detect_startup_environment,
|
|
49
|
+
emit_startup_gate,
|
|
50
|
+
ask_interaction,
|
|
51
|
+
answered_value,
|
|
52
|
+
answered_values,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
from core.supervisor import audit_supervisor
|
|
57
|
+
supervisor_type = audit_supervisor.Supervisor
|
|
58
|
+
budget_type = audit_supervisor.RunBudget
|
|
59
|
+
except ImportError:
|
|
60
|
+
supervisor_type = None
|
|
61
|
+
budget_type = None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# ---------------------------------------------------------------------------
|
|
68
|
+
# DOC-256: 架构解耦导出:Coverage 清单与降级探针治理
|
|
69
|
+
# ---------------------------------------------------------------------------
|
|
70
|
+
from core.launch_phases.supervisor_coverage import (
|
|
71
|
+
carry_over_previous_manifest,
|
|
72
|
+
append_manifest_rows,
|
|
73
|
+
coverage_bootstrap_runtime_lock,
|
|
74
|
+
runtime_coverage_recovery_mode,
|
|
75
|
+
state_path_exists_or_symlink,
|
|
76
|
+
bootstrap_coverage_manifest,
|
|
77
|
+
bootstrap_coverage_manifest_locked,
|
|
78
|
+
)
|
|
79
|
+
_carry_over_previous_manifest = carry_over_previous_manifest
|
|
80
|
+
_append_manifest_rows = append_manifest_rows
|
|
81
|
+
_coverage_bootstrap_runtime_lock = coverage_bootstrap_runtime_lock
|
|
82
|
+
_runtime_coverage_recovery_mode = runtime_coverage_recovery_mode
|
|
83
|
+
_state_path_exists_or_symlink = state_path_exists_or_symlink
|
|
84
|
+
_bootstrap_coverage_manifest = bootstrap_coverage_manifest
|
|
85
|
+
_bootstrap_coverage_manifest_locked = bootstrap_coverage_manifest_locked
|
|
86
|
+
|
|
87
|
+
from core.launch_phases.supervisor_degraded import (
|
|
88
|
+
degraded_actions,
|
|
89
|
+
DegradedDecision,
|
|
90
|
+
degraded_decision,
|
|
91
|
+
degraded_item_not_applicable,
|
|
92
|
+
degraded_item_advisory,
|
|
93
|
+
degraded_item_transient,
|
|
94
|
+
degraded_item_critical,
|
|
95
|
+
degraded_exemption_hit,
|
|
96
|
+
degraded_decision_for_policy,
|
|
97
|
+
degraded_receipt_for_report,
|
|
98
|
+
report_self_heal,
|
|
99
|
+
emit_self_heal_evidence,
|
|
100
|
+
preflight_probe_id,
|
|
101
|
+
auto_provision_accelerators,
|
|
102
|
+
autonomous_degraded_choices,
|
|
103
|
+
watchlist_error_report,
|
|
104
|
+
safe_watchlist_incident_id,
|
|
105
|
+
check_fix_regressions,
|
|
106
|
+
report_degraded_probes,
|
|
107
|
+
record_degraded_choices,
|
|
108
|
+
degraded_install,
|
|
109
|
+
prompt_degraded_choices,
|
|
110
|
+
tooling_exemptions,
|
|
111
|
+
degraded_gate,
|
|
112
|
+
DEGRADED_HEALED,
|
|
113
|
+
DEGRADED_NOT_APPLICABLE,
|
|
114
|
+
DEGRADED_EXEMPTED,
|
|
115
|
+
DEGRADED_BLOCKED,
|
|
116
|
+
DEGRADED_DEFERRED,
|
|
117
|
+
DEGRADED_TRANSIENT,
|
|
118
|
+
DEGRADED_PASSING_STATUSES,
|
|
119
|
+
)
|
|
120
|
+
_DEGRADED_HEALED = DEGRADED_HEALED
|
|
121
|
+
_DEGRADED_NOT_APPLICABLE = DEGRADED_NOT_APPLICABLE
|
|
122
|
+
_DEGRADED_EXEMPTED = DEGRADED_EXEMPTED
|
|
123
|
+
_DEGRADED_BLOCKED = DEGRADED_BLOCKED
|
|
124
|
+
_DEGRADED_DEFERRED = DEGRADED_DEFERRED
|
|
125
|
+
_DEGRADED_TRANSIENT = DEGRADED_TRANSIENT
|
|
126
|
+
_DEGRADED_PASSING_STATUSES = DEGRADED_PASSING_STATUSES
|
|
127
|
+
_degraded_actions = degraded_actions
|
|
128
|
+
_DegradedDecision = DegradedDecision
|
|
129
|
+
_degraded_decision = degraded_decision
|
|
130
|
+
_degraded_item_not_applicable = degraded_item_not_applicable
|
|
131
|
+
_degraded_item_advisory = degraded_item_advisory
|
|
132
|
+
_degraded_item_transient = degraded_item_transient
|
|
133
|
+
_degraded_item_critical = degraded_item_critical
|
|
134
|
+
_degraded_exemption_hit = degraded_exemption_hit
|
|
135
|
+
_degraded_decision_for_policy = degraded_decision_for_policy
|
|
136
|
+
_degraded_receipt_for_report = degraded_receipt_for_report
|
|
137
|
+
_report_self_heal = report_self_heal
|
|
138
|
+
_emit_self_heal_evidence = emit_self_heal_evidence
|
|
139
|
+
_preflight_probe_id = preflight_probe_id
|
|
140
|
+
_watchlist_error_report = watchlist_error_report
|
|
141
|
+
_safe_watchlist_incident_id = safe_watchlist_incident_id
|
|
142
|
+
_record_degraded_choices = record_degraded_choices
|
|
143
|
+
_degraded_install = degraded_install
|
|
144
|
+
_prompt_degraded_choices = prompt_degraded_choices
|
|
145
|
+
_tooling_exemptions = tooling_exemptions
|
|
146
|
+
|
|
147
|
+
def get_supervisor() -> object:
|
|
148
|
+
"""Load the external scheduler lazily so legacy imports stay lightweight."""
|
|
149
|
+
try:
|
|
150
|
+
from core.supervisor import audit_supervisor
|
|
151
|
+
except (ImportError, OSError) as exc:
|
|
152
|
+
raise ValueError(f"并发 Supervisor 无法加载: {exc}") from exc
|
|
153
|
+
budget_type = audit_supervisor.RunBudget
|
|
154
|
+
supervisor_type = audit_supervisor.Supervisor
|
|
155
|
+
return supervisor_type(
|
|
156
|
+
resolve_project_root(),
|
|
157
|
+
budget=budget_type(),
|
|
158
|
+
state_path=supervisor_state_path(),
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
def supervisor_units() -> list[str]:
|
|
162
|
+
"""Read stable internal/business unit IDs for the current project."""
|
|
163
|
+
from core.coverage import module_coverage
|
|
164
|
+
manifest = coverage_manifest_path()
|
|
165
|
+
_bootstrap_coverage_manifest(manifest)
|
|
166
|
+
if not manifest.is_file():
|
|
167
|
+
raise ValueError("覆盖清单没有可调度的最小单元(清单缺失且项目无可发现源码)")
|
|
168
|
+
try:
|
|
169
|
+
rows, errors = module_coverage.parse_manifest(manifest)
|
|
170
|
+
except (OSError, ValueError) as exc:
|
|
171
|
+
raise ValueError(f"覆盖单元无法加载: {exc}") from exc
|
|
172
|
+
if errors:
|
|
173
|
+
raise ValueError("覆盖清单无效,不能建立并发任务队列: " + "; ".join(errors))
|
|
174
|
+
units = sorted({module_coverage.coverage_unit_id(row) for row in rows})
|
|
175
|
+
if not units:
|
|
176
|
+
raise ValueError("覆盖清单没有可调度的最小单元")
|
|
177
|
+
return units
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
_AUTO_REBIND_REASON = "auto-rebind current workspace target on drift"
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _supervisor_recovery_snapshot(supervisor: object) -> dict[str, object]:
|
|
184
|
+
"""Return one authoritative Supervisor snapshot plus its machine action."""
|
|
185
|
+
from core.mcp_handlers.base import next_action, recovery_chain
|
|
186
|
+
|
|
187
|
+
snapshot = supervisor.status_with_gate()
|
|
188
|
+
if not isinstance(snapshot, Mapping):
|
|
189
|
+
raise ValueError("Supervisor status_with_gate 返回了无效快照")
|
|
190
|
+
state = snapshot.get("state")
|
|
191
|
+
gate = snapshot.get("parallel_gate")
|
|
192
|
+
if not isinstance(state, Mapping) or not isinstance(gate, Mapping):
|
|
193
|
+
raise ValueError("Supervisor 快照缺少 state/parallel_gate")
|
|
194
|
+
state_payload = dict(state)
|
|
195
|
+
gate_payload = dict(gate)
|
|
196
|
+
return {
|
|
197
|
+
"state": state_payload,
|
|
198
|
+
"parallel_gate": gate_payload,
|
|
199
|
+
"status": state_payload.get("status"),
|
|
200
|
+
"coverage_complete": state_payload.get("coverage_complete"),
|
|
201
|
+
"confirmation_gate": state_payload.get("confirmation_gate", {}),
|
|
202
|
+
"active_workers": gate_payload.get("active_workers", []),
|
|
203
|
+
"next_action": next_action(state_payload, gate_payload),
|
|
204
|
+
"recovery_chain": recovery_chain(state_payload, gate_payload),
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _coverage_manifest_exists(root: Path | None) -> bool:
|
|
209
|
+
"""Check only the active project's trusted coverage manifest."""
|
|
210
|
+
try:
|
|
211
|
+
from core.coverage.coverage_manifest import default_manifest_for_root
|
|
212
|
+
|
|
213
|
+
return default_manifest_for_root(root or resolve_project_root()).is_file()
|
|
214
|
+
except (ImportError, OSError, RuntimeError, ValueError):
|
|
215
|
+
return False
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _host_reset_budget_arguments(
|
|
219
|
+
state: Mapping[str, object],
|
|
220
|
+
*,
|
|
221
|
+
budget_override: Mapping[str, object] | None = None,
|
|
222
|
+
allow_serial: bool | None = None,
|
|
223
|
+
serial_reason: str | None = None,
|
|
224
|
+
) -> dict[str, object]:
|
|
225
|
+
"""Build the explicit host MCP arguments for a budget reset."""
|
|
226
|
+
current = state.get("budget")
|
|
227
|
+
values = dict(current) if isinstance(current, Mapping) else {}
|
|
228
|
+
values.update(dict(budget_override or {}))
|
|
229
|
+
if allow_serial is None:
|
|
230
|
+
allow_serial = not bool(values.get("require_parallel", True))
|
|
231
|
+
serial_reason = values.get("serial_reason")
|
|
232
|
+
arguments: dict[str, object] = {
|
|
233
|
+
"caller_role": "host",
|
|
234
|
+
"force": True,
|
|
235
|
+
"renew_wall_clock": True,
|
|
236
|
+
"allow_serial": allow_serial,
|
|
237
|
+
}
|
|
238
|
+
if allow_serial and isinstance(serial_reason, str) and serial_reason.strip():
|
|
239
|
+
arguments["serial_reason"] = serial_reason
|
|
240
|
+
for key in (
|
|
241
|
+
"max_rounds", "max_wall_seconds", "max_round_wall_seconds",
|
|
242
|
+
"max_tool_calls", "max_cost_units", "max_concurrency",
|
|
243
|
+
):
|
|
244
|
+
if key in values:
|
|
245
|
+
arguments[key] = values[key]
|
|
246
|
+
return arguments
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def _host_mcp_call(root: Path, tool: str, arguments: Mapping[str, object]) -> dict[str, object]:
|
|
250
|
+
"""Call one host-only Supervisor MCP tool in-process."""
|
|
251
|
+
from core.skills.bugx_mcp_server import BugxMcpService
|
|
252
|
+
|
|
253
|
+
return BugxMcpService(root, role="host").call(tool, arguments)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def auto_recover_supervisor(
|
|
257
|
+
root: Path | None = None,
|
|
258
|
+
*,
|
|
259
|
+
supervisor: object | None = None,
|
|
260
|
+
snapshot: Mapping[str, object] | None = None,
|
|
261
|
+
coverage_manifest_exists: bool | None = None,
|
|
262
|
+
budget_override: Mapping[str, object] | None = None,
|
|
263
|
+
allow_serial: bool | None = None,
|
|
264
|
+
serial_reason: str | None = None,
|
|
265
|
+
) -> dict[str, object]:
|
|
266
|
+
"""Execute the host recovery chain and return a fresh status snapshot.
|
|
267
|
+
|
|
268
|
+
This is the in-process equivalent of the host-only MCP calls. The
|
|
269
|
+
Supervisor remains the authority, so each mutation writes its normal
|
|
270
|
+
``target_rebound``/``budget_reset`` event before the next action is read.
|
|
271
|
+
"""
|
|
272
|
+
supervisor = supervisor or get_supervisor()
|
|
273
|
+
current = dict(snapshot) if isinstance(snapshot, Mapping) else {}
|
|
274
|
+
if not current.get("parallel_gate") or "next_action" not in current:
|
|
275
|
+
current = _supervisor_recovery_snapshot(supervisor)
|
|
276
|
+
# F-RSI-20261110-035:外部快照必须带 state 子对象——预算重置的参数
|
|
277
|
+
# 继承(max_rounds/max_wall_seconds/...)从 current["state"]["budget"]
|
|
278
|
+
# 读取;缺 state 时旧实现静默用默认值重置(红探针实测预算键全部丢失,
|
|
279
|
+
# 返回 "recovered" 伪装健康)。内部路径经 _supervisor_recovery_snapshot
|
|
280
|
+
# 构造(缺 state/gate 会 ValueError fail-closed),只有外部传入的
|
|
281
|
+
# snapshot 需要这道闸。
|
|
282
|
+
if isinstance(snapshot, Mapping) and not isinstance(current.get("state"), Mapping):
|
|
283
|
+
detail = (
|
|
284
|
+
"外部快照缺少 state 子对象:预算参数继承无法保证,"
|
|
285
|
+
"拒绝自动恢复(fail-closed)"
|
|
286
|
+
)
|
|
287
|
+
print(f"[supervisor] ✗ 自动恢复拒绝: {detail}")
|
|
288
|
+
return {
|
|
289
|
+
"status": "blocked",
|
|
290
|
+
"reason": "recovery_snapshot_missing_state",
|
|
291
|
+
"detail": detail,
|
|
292
|
+
"snapshot": current,
|
|
293
|
+
"events": [],
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
gate = current.get("parallel_gate")
|
|
297
|
+
gate = gate if isinstance(gate, Mapping) else {}
|
|
298
|
+
status = str(current.get("status") or "")
|
|
299
|
+
next_action = str(current.get("next_action") or "")
|
|
300
|
+
drift = bool(gate.get("target_drift")) or next_action == "REBUILD_PLAN"
|
|
301
|
+
manifest_exists = (
|
|
302
|
+
_coverage_manifest_exists(root)
|
|
303
|
+
if coverage_manifest_exists is None else bool(coverage_manifest_exists)
|
|
304
|
+
)
|
|
305
|
+
events: list[dict[str, object]] = []
|
|
306
|
+
|
|
307
|
+
if drift:
|
|
308
|
+
if not manifest_exists:
|
|
309
|
+
detail = "target drift requires an existing coverage manifest"
|
|
310
|
+
print(f"[supervisor] ✗ 自动重绑未执行: {detail}")
|
|
311
|
+
return {
|
|
312
|
+
"status": "blocked",
|
|
313
|
+
"reason": "coverage_manifest_missing",
|
|
314
|
+
"detail": detail,
|
|
315
|
+
"snapshot": current,
|
|
316
|
+
"events": events,
|
|
317
|
+
}
|
|
318
|
+
try:
|
|
319
|
+
_host_mcp_call(
|
|
320
|
+
root or resolve_project_root(),
|
|
321
|
+
"bugx_supervisor_rebind_target",
|
|
322
|
+
{
|
|
323
|
+
"caller_role": "host",
|
|
324
|
+
"reason": _AUTO_REBIND_REASON,
|
|
325
|
+
},
|
|
326
|
+
)
|
|
327
|
+
except Exception as exc: # noqa: BLE001 - recovery must fail closed
|
|
328
|
+
detail = f"自动重绑目标失败: {exc}"
|
|
329
|
+
print(f"[supervisor] ✗ {detail}")
|
|
330
|
+
return {
|
|
331
|
+
"status": "blocked",
|
|
332
|
+
"reason": "supervisor_rebind_failed",
|
|
333
|
+
"detail": detail,
|
|
334
|
+
"snapshot": current,
|
|
335
|
+
"events": events,
|
|
336
|
+
}
|
|
337
|
+
event = {
|
|
338
|
+
"type": "host_auto_rebind",
|
|
339
|
+
"action": "REBUILD_PLAN",
|
|
340
|
+
"tool": "bugx_supervisor_rebind_target",
|
|
341
|
+
"caller_role": "host",
|
|
342
|
+
"reason": _AUTO_REBIND_REASON,
|
|
343
|
+
}
|
|
344
|
+
events.append(event)
|
|
345
|
+
print("[supervisor] ✓ 已自动重绑当前工作区目标,继续读取 recovery_chain")
|
|
346
|
+
current = _supervisor_recovery_snapshot(supervisor)
|
|
347
|
+
status = str(current.get("status") or "")
|
|
348
|
+
next_action = str(current.get("next_action") or "")
|
|
349
|
+
|
|
350
|
+
budget_due = status == "BUDGET_EXHAUSTED" or next_action == "RESET_BUDGET"
|
|
351
|
+
if budget_due:
|
|
352
|
+
try:
|
|
353
|
+
arguments = _host_reset_budget_arguments(
|
|
354
|
+
current.get("state") if isinstance(current.get("state"), Mapping) else current,
|
|
355
|
+
budget_override=budget_override,
|
|
356
|
+
allow_serial=allow_serial,
|
|
357
|
+
serial_reason=serial_reason,
|
|
358
|
+
)
|
|
359
|
+
_host_mcp_call(
|
|
360
|
+
root or resolve_project_root(),
|
|
361
|
+
"bugx_supervisor_reset_budget",
|
|
362
|
+
arguments,
|
|
363
|
+
)
|
|
364
|
+
except Exception as exc: # noqa: BLE001 - recovery must fail closed
|
|
365
|
+
detail = f"自动预算续期失败: {exc}"
|
|
366
|
+
print(f"[supervisor] ✗ {detail}")
|
|
367
|
+
return {
|
|
368
|
+
"status": "blocked",
|
|
369
|
+
"reason": "supervisor_budget_reset_failed",
|
|
370
|
+
"detail": detail,
|
|
371
|
+
"snapshot": current,
|
|
372
|
+
"events": events,
|
|
373
|
+
}
|
|
374
|
+
event = {
|
|
375
|
+
"type": "host_auto_budget_reset",
|
|
376
|
+
"action": "RESET_BUDGET",
|
|
377
|
+
"tool": "bugx_supervisor_reset_budget",
|
|
378
|
+
"caller_role": "host",
|
|
379
|
+
"force": True,
|
|
380
|
+
"renew_wall_clock": True,
|
|
381
|
+
}
|
|
382
|
+
events.append(event)
|
|
383
|
+
print("[supervisor] ✓ 已自动开启新 budget epoch 并续期墙钟,继续读取 recovery_chain")
|
|
384
|
+
current = _supervisor_recovery_snapshot(supervisor)
|
|
385
|
+
|
|
386
|
+
final_gate = current.get("parallel_gate")
|
|
387
|
+
final_gate = final_gate if isinstance(final_gate, Mapping) else {}
|
|
388
|
+
final_status = str(current.get("status") or "")
|
|
389
|
+
final_action = str(current.get("next_action") or "")
|
|
390
|
+
if (
|
|
391
|
+
final_gate.get("target_drift")
|
|
392
|
+
or final_action in {"REBUILD_PLAN", "RESET_BUDGET"}
|
|
393
|
+
or final_status == "BUDGET_EXHAUSTED"
|
|
394
|
+
):
|
|
395
|
+
detail = "自动 recovery 后 Supervisor 仍未解除 drift/budget 门禁"
|
|
396
|
+
print(f"[supervisor] ✗ {detail}")
|
|
397
|
+
return {
|
|
398
|
+
"status": "blocked",
|
|
399
|
+
"reason": "supervisor_recovery_incomplete",
|
|
400
|
+
"detail": detail,
|
|
401
|
+
"snapshot": current,
|
|
402
|
+
"events": events,
|
|
403
|
+
}
|
|
404
|
+
if events and final_status != "RUNNING":
|
|
405
|
+
detail = f"自动 recovery 已执行,但 Supervisor 未回到 RUNNING(当前为 {final_status or 'unknown'})"
|
|
406
|
+
print(f"[supervisor] ✗ {detail}")
|
|
407
|
+
return {
|
|
408
|
+
"status": "blocked",
|
|
409
|
+
"reason": "supervisor_recovery_incomplete",
|
|
410
|
+
"detail": detail,
|
|
411
|
+
"snapshot": current,
|
|
412
|
+
"events": events,
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
"status": "recovered" if events else "noop",
|
|
416
|
+
"snapshot": current,
|
|
417
|
+
"events": events,
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def _archive_supervisor_state() -> None:
|
|
422
|
+
"""Archive the previous run before a new big lifecycle starts."""
|
|
423
|
+
supervisor_state = supervisor_state_path()
|
|
424
|
+
archive_dir = AGENT_DIR / "audit-supervisor-archive"
|
|
425
|
+
if uses_project_layout():
|
|
426
|
+
archive_dir = bugx_paths.require(resolve_project_root()).lifecycle_root / "recovery" / "supervisor"
|
|
427
|
+
archive_dir.mkdir(parents=True, exist_ok=True)
|
|
428
|
+
# DOC-228:归档上一轮快照时必须**一并**归档 `.revision` 栅栏。
|
|
429
|
+
# `StateStore.ensure_new_run_allowed()` 对「栅栏存在但 state/backup 均不存在」
|
|
430
|
+
# 是 fail-closed(RECOVERY_REQUIRED: revision fence exists without a state
|
|
431
|
+
# snapshot)。只搬走快照而留下栅栏,会让自动续轮的 `ensure_supervisor(new_run=True)`
|
|
432
|
+
# 永久失败(实测 3 个 test_auto_* 用例命中「自动轮询无法启动下一轮」)。
|
|
433
|
+
for source in (
|
|
434
|
+
supervisor_state,
|
|
435
|
+
supervisor_state.with_name(supervisor_state.name + ".bak"),
|
|
436
|
+
supervisor_state.with_name(supervisor_state.name + ".revision"),
|
|
437
|
+
):
|
|
438
|
+
if not source.exists() and not source.is_symlink():
|
|
439
|
+
continue
|
|
440
|
+
if source.is_symlink():
|
|
441
|
+
raise ValueError(f"拒绝归档符号链接 Supervisor 状态: {source}")
|
|
442
|
+
target = archive_dir / f"{source.name}.{int(time.time())}.{uuid.uuid4().hex[:8]}"
|
|
443
|
+
os.replace(source, target)
|
|
444
|
+
lock = supervisor_state.with_name(supervisor_state.name + ".lock")
|
|
445
|
+
if lock.exists() or lock.is_symlink():
|
|
446
|
+
if lock.is_symlink():
|
|
447
|
+
raise ValueError(f"拒绝清理符号链接 Supervisor 锁: {lock}")
|
|
448
|
+
lock.unlink()
|
|
449
|
+
evidence = _common.COVERAGE_EVIDENCE
|
|
450
|
+
if evidence.exists() or evidence.is_symlink():
|
|
451
|
+
if evidence.is_symlink():
|
|
452
|
+
raise ValueError(f"拒绝归档符号链接覆盖证据: {evidence}")
|
|
453
|
+
os.replace(evidence, archive_dir / f"{evidence.name}.{int(time.time())}.{uuid.uuid4().hex[:8]}")
|
|
454
|
+
|
|
455
|
+
def _expected_supervisor_run_id(lifecycle_id: str | None,
|
|
456
|
+
session_id: str | None) -> str | None:
|
|
457
|
+
"""PE-20261005-003: Supervisor run_id 用 polling 限定形式,消除跨 polling 撞键。
|
|
458
|
+
|
|
459
|
+
session_id 即 polling_id(lifecycle_id 每个 polling 都从 000001 重编号,
|
|
460
|
+
裸形式 `lifecycle-{lifecycle_id}` 跨轮必然碰撞);session_id 缺失时
|
|
461
|
+
(无 polling 上下文的遗留单轮布局)回退裸形式。
|
|
462
|
+
"""
|
|
463
|
+
if not lifecycle_id:
|
|
464
|
+
return None
|
|
465
|
+
if session_id:
|
|
466
|
+
return f"lifecycle-{session_id}-{lifecycle_id}"
|
|
467
|
+
return f"lifecycle-{lifecycle_id}"
|
|
468
|
+
|
|
469
|
+
def ensure_supervisor(allow_serial: bool = False,
|
|
470
|
+
serial_reason: str | None = None,
|
|
471
|
+
lifecycle_id: str | None = None,
|
|
472
|
+
new_run: bool = False,
|
|
473
|
+
session_id: str | None = None,
|
|
474
|
+
life_id: str | None = None,
|
|
475
|
+
life_kind: str = "mine",
|
|
476
|
+
plan_hash: str | None = None,
|
|
477
|
+
budget_override: Mapping[str, object] | None = None) -> dict:
|
|
478
|
+
"""Create/resume the Worker controller bound to one Project/Session/Round/Life."""
|
|
479
|
+
if allow_serial and not isinstance(serial_reason, str) or \
|
|
480
|
+
allow_serial and not serial_reason.strip():
|
|
481
|
+
raise ValueError("允许串行时必须提供非空 --serial-reason")
|
|
482
|
+
# [BEGIN DEV_ONLY: FAST_VERIFICATION_BUDGET]
|
|
483
|
+
effective_budget_override = dict(budget_override or {})
|
|
484
|
+
try:
|
|
485
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
486
|
+
except ImportError:
|
|
487
|
+
try:
|
|
488
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
489
|
+
except ImportError:
|
|
490
|
+
try_get_preset_runtime_config = None
|
|
491
|
+
if try_get_preset_runtime_config is not None:
|
|
492
|
+
preset_cfg = try_get_preset_runtime_config(resolve_project_root() if uses_project_layout() else None)
|
|
493
|
+
if preset_cfg.get("round_duration_seconds") is not None:
|
|
494
|
+
effective_budget_override["max_round_wall_seconds"] = int(preset_cfg["round_duration_seconds"])
|
|
495
|
+
if preset_cfg.get("max_rounds") is not None:
|
|
496
|
+
effective_budget_override["max_rounds"] = int(preset_cfg["max_rounds"])
|
|
497
|
+
if preset_cfg.get("max_total_wall_seconds") is not None:
|
|
498
|
+
effective_budget_override["max_wall_seconds"] = int(preset_cfg["max_total_wall_seconds"])
|
|
499
|
+
if preset_cfg.get("max_worker_concurrency") is not None:
|
|
500
|
+
effective_budget_override["max_concurrency"] = int(preset_cfg["max_worker_concurrency"])
|
|
501
|
+
budget_override = effective_budget_override
|
|
502
|
+
# [END DEV_ONLY: FAST_VERIFICATION_BUDGET]
|
|
503
|
+
expected_run_id = _expected_supervisor_run_id(lifecycle_id, session_id)
|
|
504
|
+
project_id = None
|
|
505
|
+
if uses_project_layout():
|
|
506
|
+
project_id = hashlib.sha256(
|
|
507
|
+
str(resolve_project_root().resolve()).encode("utf-8")
|
|
508
|
+
).hexdigest()[:16]
|
|
509
|
+
if new_run:
|
|
510
|
+
_archive_supervisor_state()
|
|
511
|
+
coverage_units = supervisor_units()
|
|
512
|
+
supervisor_state = supervisor_state_path()
|
|
513
|
+
if not supervisor_state.is_file():
|
|
514
|
+
if allow_serial:
|
|
515
|
+
budget = None
|
|
516
|
+
try:
|
|
517
|
+
from core.supervisor import audit_supervisor
|
|
518
|
+
budget_values = audit_supervisor.RunBudget().to_dict()
|
|
519
|
+
budget_values.update(dict(budget_override or {}))
|
|
520
|
+
budget = audit_supervisor.RunBudget.from_dict({
|
|
521
|
+
**budget_values,
|
|
522
|
+
"require_parallel": False, "serial_reason": serial_reason,
|
|
523
|
+
"require_confirmation": True,
|
|
524
|
+
})
|
|
525
|
+
supervisor = audit_supervisor.Supervisor(
|
|
526
|
+
resolve_project_root(), budget=budget, state_path=supervisor_state,
|
|
527
|
+
)
|
|
528
|
+
state = supervisor.start(
|
|
529
|
+
coverage_units=coverage_units, run_id=expected_run_id,
|
|
530
|
+
project_id=project_id, session_id=session_id,
|
|
531
|
+
round_id=lifecycle_id, life_id=life_id, plan_hash=plan_hash,
|
|
532
|
+
life_kind=life_kind,
|
|
533
|
+
)
|
|
534
|
+
except (ImportError, OSError, ValueError) as exc:
|
|
535
|
+
raise ValueError(f"无法建立串行例外 Supervisor: {exc}") from exc
|
|
536
|
+
else:
|
|
537
|
+
try:
|
|
538
|
+
from core.supervisor import audit_supervisor
|
|
539
|
+
budget_values = audit_supervisor.RunBudget().to_dict()
|
|
540
|
+
budget_values.update(dict(budget_override or {}))
|
|
541
|
+
budget = audit_supervisor.RunBudget.from_dict({
|
|
542
|
+
**budget_values,
|
|
543
|
+
"require_confirmation": True,
|
|
544
|
+
})
|
|
545
|
+
supervisor = audit_supervisor.Supervisor(
|
|
546
|
+
resolve_project_root(), budget=budget, state_path=supervisor_state,
|
|
547
|
+
)
|
|
548
|
+
state = supervisor.start(
|
|
549
|
+
coverage_units=coverage_units, run_id=expected_run_id,
|
|
550
|
+
project_id=project_id, session_id=session_id,
|
|
551
|
+
round_id=lifecycle_id, life_id=life_id, plan_hash=plan_hash,
|
|
552
|
+
life_kind=life_kind,
|
|
553
|
+
)
|
|
554
|
+
except (ImportError, OSError, ValueError) as exc:
|
|
555
|
+
raise ValueError(f"无法建立并发 Supervisor: {exc}") from exc
|
|
556
|
+
else:
|
|
557
|
+
supervisor = get_supervisor()
|
|
558
|
+
state = supervisor.status()
|
|
559
|
+
if expected_run_id and state.run_id != expected_run_id:
|
|
560
|
+
# PE-20261005-003: 仅接受「同轮升级兼容」——引擎升级前以旧裸形式
|
|
561
|
+
# 创建、且 session_id 一致的在途 run;跨 polling 植入的旧 state
|
|
562
|
+
# (session 不一致)一律拒绝,不得静默收养。
|
|
563
|
+
legacy_run_id = f"lifecycle-{lifecycle_id}" if lifecycle_id else None
|
|
564
|
+
same_session_legacy = bool(
|
|
565
|
+
legacy_run_id
|
|
566
|
+
and state.run_id == legacy_run_id
|
|
567
|
+
and session_id
|
|
568
|
+
and getattr(state, "session_id", None) == session_id
|
|
569
|
+
)
|
|
570
|
+
if not same_session_legacy:
|
|
571
|
+
raise ValueError(
|
|
572
|
+
"Supervisor run 未绑定当前 Round: "
|
|
573
|
+
f"expected={expected_run_id} actual={state.run_id}"
|
|
574
|
+
)
|
|
575
|
+
bindings = {
|
|
576
|
+
"project_id": project_id,
|
|
577
|
+
"session_id": session_id,
|
|
578
|
+
"round_id": lifecycle_id,
|
|
579
|
+
"life_id": life_id,
|
|
580
|
+
}
|
|
581
|
+
for name, expected in bindings.items():
|
|
582
|
+
if expected is not None and getattr(state, name, None) != expected:
|
|
583
|
+
if name == "life_id" and state.active_claims:
|
|
584
|
+
raise ValueError(
|
|
585
|
+
f"Supervisor run 未绑定当前 {name}: "
|
|
586
|
+
f"expected={expected} actual={getattr(state, name, None)}"
|
|
587
|
+
)
|
|
588
|
+
try:
|
|
589
|
+
state = supervisor.bind_context(**bindings)
|
|
590
|
+
except (AttributeError, OSError, ValueError, RuntimeError) as exc:
|
|
591
|
+
raise ValueError(f"Supervisor 上下文绑定失败: {exc}") from exc
|
|
592
|
+
break
|
|
593
|
+
recovery = auto_recover_supervisor(
|
|
594
|
+
resolve_project_root(),
|
|
595
|
+
supervisor=supervisor,
|
|
596
|
+
coverage_manifest_exists=_coverage_manifest_exists(resolve_project_root()),
|
|
597
|
+
budget_override=budget_override,
|
|
598
|
+
allow_serial=allow_serial,
|
|
599
|
+
serial_reason=serial_reason,
|
|
600
|
+
)
|
|
601
|
+
if recovery.get("status") == "blocked":
|
|
602
|
+
raise ValueError(str(recovery.get("detail") or "Supervisor 自动恢复失败"))
|
|
603
|
+
state = supervisor.status()
|
|
604
|
+
if state.status.value in {"COMPLETE", "FAILED"}:
|
|
605
|
+
# 终态 run(例如上一轮 finish 早于 post、或 post 中途崩溃后由
|
|
606
|
+
# 宿主手动收尾)无法承载新 runtime 会话;此前直接 raise 会让
|
|
607
|
+
# pre 无法重建 runtime、post 又要求活动 runtime,形成状态死锁,
|
|
608
|
+
# 只能弃数据开新 polling。这里按提示语义"开启新审计 run"执行:
|
|
609
|
+
# 归档终态 state(证据保留在 lifecycle recovery 目录)后走
|
|
610
|
+
# new_run 重建路径。INCOMPLETE 不在此列——post 仍可对其结算。
|
|
611
|
+
_archive_supervisor_state()
|
|
612
|
+
return ensure_supervisor(
|
|
613
|
+
allow_serial, serial_reason, lifecycle_id=lifecycle_id,
|
|
614
|
+
new_run=True, session_id=session_id, life_id=life_id,
|
|
615
|
+
life_kind=life_kind, plan_hash=plan_hash,
|
|
616
|
+
budget_override=budget_override,
|
|
617
|
+
)
|
|
618
|
+
return state.to_dict() if hasattr(state, "to_dict") else dict(state)
|
|
619
|
+
|
|
620
|
+
def check_supervisor_gate() -> tuple[bool, dict]:
|
|
621
|
+
supervisor = get_supervisor()
|
|
622
|
+
result = supervisor.parallel_gate()
|
|
623
|
+
return bool(result.get("satisfied")), result
|
|
624
|
+
|
|
625
|
+
def advance_supervisor_round() -> dict:
|
|
626
|
+
supervisor = get_supervisor()
|
|
627
|
+
state = supervisor.next_round()
|
|
628
|
+
return state.to_dict()
|
|
629
|
+
|
|
630
|
+
def run_tools_kb() -> int:
|
|
631
|
+
"""启动前拒绝使用过期/无日期工具知识。优先进程内直接调用,失败或异常回退子进程。"""
|
|
632
|
+
if not TOOLS_KB.is_file():
|
|
633
|
+
print("[launch_bugx] ✗ 缺少 tools_kb.py,无法验证工具知识有效期")
|
|
634
|
+
return 1
|
|
635
|
+
try:
|
|
636
|
+
parent_dir = str(TOOLS_KB.parent.resolve())
|
|
637
|
+
if parent_dir not in sys.path:
|
|
638
|
+
sys.path.insert(0, parent_dir)
|
|
639
|
+
from core.skills import tools_kb
|
|
640
|
+
# 目录路径只有 ``tools_kb.KB_FILE`` 一个真源。此前这里重推了两级
|
|
641
|
+
# ``parent``/``parent.parent`` 候选,目录迁进 ``core/planning/`` 后全部落空,
|
|
642
|
+
# 门禁于是拿到 ``path=None`` 再回落到同一条失效路径,表现为"知识库缺失"。
|
|
643
|
+
kb_file = getattr(tools_kb, "KB_FILE", None)
|
|
644
|
+
func = getattr(tools_kb, "_run_check", None)
|
|
645
|
+
if callable(func):
|
|
646
|
+
return int(func(path=kb_file if kb_file and Path(kb_file).is_file() else None))
|
|
647
|
+
main_func = getattr(tools_kb, "main", None)
|
|
648
|
+
if callable(main_func):
|
|
649
|
+
return int(main_func(["check"]))
|
|
650
|
+
except Exception:
|
|
651
|
+
pass
|
|
652
|
+
return run_child(
|
|
653
|
+
[sys.executable, str(TOOLS_KB), "check"], cwd=resolve_project_root(),
|
|
654
|
+
)
|
|
655
|
+
|
|
656
|
+
def run_prep_validate() -> int:
|
|
657
|
+
"""结束前确认开工准备有可追溯记录。优先进程内直接调用,失败或异常回退子进程。"""
|
|
658
|
+
if not PREP_VALIDATE.is_file():
|
|
659
|
+
print("[launch_bugx] ✗ 缺少 prep_validate.py,拒绝通过准备门禁")
|
|
660
|
+
return 1
|
|
661
|
+
record = Path(PREP_RECORD)
|
|
662
|
+
if uses_project_layout():
|
|
663
|
+
record = bugx_paths.require(resolve_project_root()).prep_record
|
|
664
|
+
try:
|
|
665
|
+
parent_dir = str(PREP_VALIDATE.parent.resolve())
|
|
666
|
+
if parent_dir not in sys.path:
|
|
667
|
+
sys.path.insert(0, parent_dir)
|
|
668
|
+
from core.runtime import prep_validate
|
|
669
|
+
func = getattr(prep_validate, "_validate_direct", None)
|
|
670
|
+
if callable(func):
|
|
671
|
+
return int(func(record=record, root=resolve_project_root()))
|
|
672
|
+
main_func = getattr(prep_validate, "main", None)
|
|
673
|
+
if callable(main_func):
|
|
674
|
+
return int(main_func(["--root", str(resolve_project_root()), "--record", str(record)]))
|
|
675
|
+
except Exception:
|
|
676
|
+
pass
|
|
677
|
+
return run_child(
|
|
678
|
+
[sys.executable, str(PREP_VALIDATE),
|
|
679
|
+
"--root", str(resolve_project_root()),
|
|
680
|
+
"--record", str(record)], cwd=resolve_project_root(),
|
|
681
|
+
)
|
|
682
|
+
|
|
683
|
+
def run_preflight_probes(
|
|
684
|
+
*, refresh: bool = False, include_profile: bool = False,
|
|
685
|
+
project_profile_data: dict | None = None,
|
|
686
|
+
) -> tuple[int, list[dict]] | tuple[int, list[dict], dict]:
|
|
687
|
+
"""按 probe_registry 的 ``lifecycle="preflight"`` 统一驱动启动前探针。
|
|
688
|
+
|
|
689
|
+
DES-13:启动执行的**唯一真源**是探针注册中心——``preflight_probes()``
|
|
690
|
+
返回什么就执行什么。新增/下线 preflight 探针只需改注册表,不再需要
|
|
691
|
+
在启动流水线里手写包装函数与路径常量。所有探针在同一个并发扇出中
|
|
692
|
+
各执行一次(``run_preflight_probes`` 内部并行 + 环境画像缓存)。
|
|
693
|
+
|
|
694
|
+
``required`` 探针的脚本缺失时硬阻断启动;``required=False`` 的建议性
|
|
695
|
+
探针(如 openwiki)缺失时静默跳过。返回 ``(退出码, 降级动作清单)``。
|
|
696
|
+
"""
|
|
697
|
+
from core.probes import probe_registry
|
|
698
|
+
|
|
699
|
+
root = resolve_project_root()
|
|
700
|
+
descriptors = probe_registry.preflight_probes()
|
|
701
|
+
# 探针脚本与 ``probe_registry`` 同目录(``run_preflight_probes`` 也按此
|
|
702
|
+
# 定位)。必须用同一个目录判定缺失,否则隔离/最小安装布局下会把
|
|
703
|
+
# 实际存在的探针误判为缺失而错误硬阻断。
|
|
704
|
+
try:
|
|
705
|
+
registry_dir = Path(probe_registry.__file__).resolve().parent
|
|
706
|
+
except (AttributeError, OSError, TypeError):
|
|
707
|
+
registry_dir = AGENT_DIR
|
|
708
|
+
# 必须与 ``run_preflight_probes`` 用**同一个**解析器判定缺失:那条路径走
|
|
709
|
+
# ``_resolve_probe_script``(会按文件名在引擎树内唯一解析),这里若直接拼
|
|
710
|
+
# ``registry_dir / descriptor.script``,一旦探针脚本被归档进子包
|
|
711
|
+
# (``core/report_engine/web_conformance.py``),就会把存在的脚本判成缺失,
|
|
712
|
+
# 于是 ``pre`` 硬阻断,且报错指向一个"看起来该在 probes/ 下"的假路径。
|
|
713
|
+
missing = [
|
|
714
|
+
descriptor for descriptor in descriptors
|
|
715
|
+
if descriptor.required
|
|
716
|
+
and not probe_registry._resolve_probe_script(
|
|
717
|
+
registry_dir, descriptor.script
|
|
718
|
+
).is_file()
|
|
719
|
+
]
|
|
720
|
+
if missing:
|
|
721
|
+
for descriptor in missing:
|
|
722
|
+
print(
|
|
723
|
+
f"[launch_bugx] ✗ 缺少 {descriptor.script},无法完成"
|
|
724
|
+
f"{descriptor.description or descriptor.name}准备"
|
|
725
|
+
)
|
|
726
|
+
return (1, [], {}) if include_profile else (1, [])
|
|
727
|
+
|
|
728
|
+
profile = probe_registry.run_preflight_probes(
|
|
729
|
+
root,
|
|
730
|
+
parallel=True,
|
|
731
|
+
refresh=refresh,
|
|
732
|
+
project_profile_data=project_profile_data,
|
|
733
|
+
)
|
|
734
|
+
reports = profile.get("probes") or {}
|
|
735
|
+
for descriptor in descriptors:
|
|
736
|
+
report = reports.get(descriptor.name)
|
|
737
|
+
if not isinstance(report, dict):
|
|
738
|
+
continue
|
|
739
|
+
print(f" 探针 {descriptor.name}: {_preflight_probe_summary(report)}")
|
|
740
|
+
_sync_codebase_memory_env(profile)
|
|
741
|
+
check_fix_regressions(root)
|
|
742
|
+
degraded = list(profile.get("degraded_actions", []))
|
|
743
|
+
return (0, degraded, profile) if include_profile else (0, degraded)
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
def _preflight_probe_summary(report: dict) -> str:
|
|
747
|
+
"""把归一化探针报告压成一行人类可读摘要(不改变探针自身输出)。"""
|
|
748
|
+
status = str(report.get("status", "READY"))
|
|
749
|
+
duration = report.get("duration_seconds")
|
|
750
|
+
suffix = f"({duration:.2f}s)" if isinstance(duration, (int, float)) else ""
|
|
751
|
+
if status.strip().upper() == "NOT_APPLICABLE":
|
|
752
|
+
# 形态不适用是一条**结论**,不是"未就绪":后者会让人误以为环境缺能力。
|
|
753
|
+
reason = str(report.get("detail") or "").strip()
|
|
754
|
+
return f"{status}{suffix}" + (f";{reason}" if reason else "")
|
|
755
|
+
failed = [
|
|
756
|
+
str(check.get("name") or "未命名检查")
|
|
757
|
+
for check in (report.get("checks") or [])
|
|
758
|
+
if isinstance(check, dict) and not check.get("ok")
|
|
759
|
+
]
|
|
760
|
+
detail = f";未就绪: {', '.join(failed[:4])}" if failed else ""
|
|
761
|
+
return f"{status}{suffix}{detail}"
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
# DES-13:启动前探针的执行真源已收敛到 probe_registry.preflight_probes(),
|
|
765
|
+
# 下列名称不再包含任何手写探针逻辑。它们仅为保持历史导入方
|
|
766
|
+
# (round_orchestrator 仍在 import 这些名字)可用而保留;一旦被真正调用,
|
|
767
|
+
# 立即显式报错而不是静默执行另一条路径。
|
|
768
|
+
def _removed_probe_wrapper(name: str):
|
|
769
|
+
def _entry(*_args, **_kwargs):
|
|
770
|
+
raise RuntimeError(
|
|
771
|
+
f"{name} 已由 probe_registry 统一驱动(DES-13);"
|
|
772
|
+
"请改用 run_preflight_probes()"
|
|
773
|
+
)
|
|
774
|
+
_entry.__name__ = name
|
|
775
|
+
_entry.__doc__ = f"已删除的手写探针包装(DES-13);调用即报错。原名: {name}"
|
|
776
|
+
return _entry
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
_run_codebase_memory_probe = _removed_probe_wrapper("_run_codebase_memory_probe")
|
|
780
|
+
_run_efficiency_probe = _removed_probe_wrapper("_run_efficiency_probe")
|
|
781
|
+
_run_sast_probe = _removed_probe_wrapper("_run_sast_probe")
|
|
782
|
+
_run_mobile_probe = _removed_probe_wrapper("_run_mobile_probe")
|
|
783
|
+
_run_openwiki_probe = _removed_probe_wrapper("_run_openwiki_probe")
|
|
784
|
+
|
|
785
|
+
def _probe_json(script: Path) -> dict | None:
|
|
786
|
+
"""在有界 Worker 进程组中运行探针 --json 并解析;失败返回 None。"""
|
|
787
|
+
try:
|
|
788
|
+
key = script.resolve()
|
|
789
|
+
except (OSError, RuntimeError):
|
|
790
|
+
key = script
|
|
791
|
+
if key in PROBE_JSON_CACHE:
|
|
792
|
+
return PROBE_JSON_CACHE[key]
|
|
793
|
+
try:
|
|
794
|
+
from core.supervisor.worker_execution import run_bounded
|
|
795
|
+
result = run_bounded(
|
|
796
|
+
[sys.executable, str(script), "check", "--root",
|
|
797
|
+
str(resolve_project_root()), "--json"],
|
|
798
|
+
cwd=resolve_project_root(), env=child_environment(), timeout=30,
|
|
799
|
+
capture=True,
|
|
800
|
+
)
|
|
801
|
+
except (OSError, subprocess.TimeoutExpired, RuntimeError, ValueError):
|
|
802
|
+
PROBE_JSON_CACHE[key] = None
|
|
803
|
+
return None
|
|
804
|
+
try:
|
|
805
|
+
payload = json.loads(result.stdout)
|
|
806
|
+
except json.JSONDecodeError:
|
|
807
|
+
PROBE_JSON_CACHE[key] = None
|
|
808
|
+
return None
|
|
809
|
+
from core.probes import probe_registry
|
|
810
|
+
p_forms = None
|
|
811
|
+
p_langs = None
|
|
812
|
+
try:
|
|
813
|
+
from core.runtime import project_profile
|
|
814
|
+
prof = project_profile.detect_project_profile(resolve_project_root())
|
|
815
|
+
p_forms = set(prof.get("forms", []))
|
|
816
|
+
p_langs = {str(l).casefold() for l in prof.get("languages", [])}
|
|
817
|
+
except Exception:
|
|
818
|
+
pass
|
|
819
|
+
value = probe_registry._normalize_probe_report(
|
|
820
|
+
script.stem, payload, returncode=result.returncode, forms=p_forms, languages=p_langs,
|
|
821
|
+
)
|
|
822
|
+
PROBE_JSON_CACHE[key] = value
|
|
823
|
+
return value
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
def supervisor_mcp_snapshot() -> dict[str, object] | None:
|
|
827
|
+
"""Read and report the selected host's MCP session capabilities."""
|
|
828
|
+
if not uses_project_layout():
|
|
829
|
+
return None
|
|
830
|
+
try:
|
|
831
|
+
from core.supervisor import supervisor_host
|
|
832
|
+
root = resolve_project_root()
|
|
833
|
+
adapter = supervisor_host.detect_host(root)
|
|
834
|
+
status = supervisor_host.check_mcp_env(root, adapter)
|
|
835
|
+
# DOC-065: 扩充宿主底层环境能力与无头运行支持检查
|
|
836
|
+
try:
|
|
837
|
+
status["host_env"] = supervisor_host.check_host_env(root, adapter)
|
|
838
|
+
status["supports_headless"] = bool(adapter.supports_headless())
|
|
839
|
+
except Exception:
|
|
840
|
+
pass
|
|
841
|
+
except (ImportError, OSError, ValueError, RuntimeError):
|
|
842
|
+
return {
|
|
843
|
+
"host": "unknown",
|
|
844
|
+
"configured": [],
|
|
845
|
+
"missing": ["bugx-supervisor"],
|
|
846
|
+
"degraded": [],
|
|
847
|
+
"critical_missing": ["bugx-supervisor"],
|
|
848
|
+
"detail": "无法读取宿主 MCP 配置",
|
|
849
|
+
"supports_headless": False,
|
|
850
|
+
}
|
|
851
|
+
return status
|
|
852
|
+
|
|
853
|
+
def _mcp_status_names(status: dict[str, object], key: str) -> set[str]:
|
|
854
|
+
"""Return normalized MCP names from a status field."""
|
|
855
|
+
values = status.get(key, ())
|
|
856
|
+
if not isinstance(values, (list, tuple, set, frozenset)):
|
|
857
|
+
return set()
|
|
858
|
+
return {str(value) for value in values}
|
|
859
|
+
|
|
860
|
+
def _supervisor_mcp_status() -> dict[str, object] | None:
|
|
861
|
+
"""Return a blocking MCP status for automatic review, if any."""
|
|
862
|
+
status = supervisor_mcp_snapshot()
|
|
863
|
+
if status is None:
|
|
864
|
+
return None
|
|
865
|
+
missing = _mcp_status_names(status, "missing") & SUPERVISOR_MCP_HARD_CHANNELS
|
|
866
|
+
degraded = _mcp_status_names(status, "degraded") & SUPERVISOR_MCP_HARD_CHANNELS
|
|
867
|
+
if not missing and not degraded:
|
|
868
|
+
supervisor = (status.get("capabilities") or {}).get("bugx-supervisor", {})
|
|
869
|
+
worker = (status.get("capabilities") or {}).get("bugx-supervisor-worker", {})
|
|
870
|
+
if not (isinstance(supervisor, dict) and isinstance(worker, dict)
|
|
871
|
+
and supervisor.get("loaded") and supervisor.get("callable")
|
|
872
|
+
and supervisor.get("healthy") and worker.get("loaded")
|
|
873
|
+
and worker.get("callable") and worker.get("healthy")):
|
|
874
|
+
status["detail"] = "bugx-supervisor 当前会话尚未证明 host/worker 均已加载、可调用且健康"
|
|
875
|
+
return status
|
|
876
|
+
return None
|
|
877
|
+
status["detail"] = (
|
|
878
|
+
"bugx-supervisor host/worker MCP 未安装或未配置"
|
|
879
|
+
if missing else "bugx-supervisor host/worker MCP 已配置但探活失败"
|
|
880
|
+
)
|
|
881
|
+
return status
|
|
882
|
+
|
|
883
|
+
def _mcp_session_is_stale(status: dict[str, object] | None) -> bool:
|
|
884
|
+
"""Return whether configured Supervisor MCP is not loaded in this session.
|
|
885
|
+
|
|
886
|
+
Missing/degraded configuration has its own install/recovery gate. This
|
|
887
|
+
predicate is intentionally limited to the important middle case: the
|
|
888
|
+
configuration exists, but the current host process has not loaded or
|
|
889
|
+
proved the host/worker channels. That case must never silently become a
|
|
890
|
+
manual run, because the user may still expect the configured MCP path.
|
|
891
|
+
"""
|
|
892
|
+
if not isinstance(status, dict):
|
|
893
|
+
return False
|
|
894
|
+
if (_mcp_status_names(status, "missing") & SUPERVISOR_MCP_HARD_CHANNELS) or \
|
|
895
|
+
(_mcp_status_names(status, "degraded") & SUPERVISOR_MCP_HARD_CHANNELS):
|
|
896
|
+
return False
|
|
897
|
+
capabilities = status.get("capabilities")
|
|
898
|
+
if not isinstance(capabilities, dict):
|
|
899
|
+
return False
|
|
900
|
+
supervisor = capabilities.get("bugx-supervisor")
|
|
901
|
+
worker = capabilities.get("bugx-supervisor-worker")
|
|
902
|
+
if not isinstance(supervisor, dict) or not isinstance(worker, dict):
|
|
903
|
+
return False
|
|
904
|
+
configured_names = _mcp_status_names(status, "configured")
|
|
905
|
+
configured = (
|
|
906
|
+
SUPERVISOR_MCP_HARD_CHANNELS <= configured_names
|
|
907
|
+
or all(bool(channel.get("configured")) for channel in (supervisor, worker))
|
|
908
|
+
)
|
|
909
|
+
healthy = all(
|
|
910
|
+
bool(channel.get(field))
|
|
911
|
+
for channel in (supervisor, worker)
|
|
912
|
+
for field in ("loaded", "callable", "healthy")
|
|
913
|
+
)
|
|
914
|
+
return configured and not healthy
|
|
915
|
+
|
|
916
|
+
def print_supervisor_mcp_snapshot(status: dict[str, object] | None) -> None:
|
|
917
|
+
"""Print the MCP environment result before startup decisions."""
|
|
918
|
+
if not status:
|
|
919
|
+
return
|
|
920
|
+
capabilities = status.get("capabilities") or {}
|
|
921
|
+
names = ("bugx-supervisor", "bugx-supervisor-worker", "playwright", "postmcp")
|
|
922
|
+
summary = []
|
|
923
|
+
for name in names:
|
|
924
|
+
item = capabilities.get(name) if isinstance(capabilities, dict) else None
|
|
925
|
+
summary.append(f"{name}={item.get('status', 'unknown') if isinstance(item, dict) else 'missing'}")
|
|
926
|
+
if "supports_headless" in status:
|
|
927
|
+
summary.append(f"headless={'yes' if status.get('supports_headless') else 'no'}")
|
|
928
|
+
print("[BugX] MCP environment: " + ", ".join(summary))
|
|
929
|
+
|
|
930
|
+
def supervisor_mcp_restart_instructions(host: str, *, install_required: bool) -> str:
|
|
931
|
+
"""Configuration changes require a new host session and fresh MCP proof."""
|
|
932
|
+
install = "先初始化项目并安装当前宿主的 Supervisor MCP;" if install_required else ""
|
|
933
|
+
return (
|
|
934
|
+
f"{install}重启 {host} 宿主会话后重新启动 BugX,"
|
|
935
|
+
"并验证 bugx-supervisor 与 bugx-supervisor-worker 已加载且可调用。"
|
|
936
|
+
)
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
def _install_supervisor_mcp(status: dict[str, object]) -> bool:
|
|
940
|
+
"""Install the host bundle after an explicit user choice.
|
|
941
|
+
|
|
942
|
+
Installation changes host configuration but cannot hot-load the current AI
|
|
943
|
+
session. A successful install therefore returns False and keeps startup at
|
|
944
|
+
the gate until the host is restarted.
|
|
945
|
+
"""
|
|
946
|
+
cli = shutil.which("bugx")
|
|
947
|
+
host = str(
|
|
948
|
+
getattr(detect_startup_environment(), "host", None)
|
|
949
|
+
or status.get("host")
|
|
950
|
+
or "unknown"
|
|
951
|
+
).strip().casefold()
|
|
952
|
+
if cli is None:
|
|
953
|
+
print("[launch_bugx] ✗ 找不到 bugx CLI,无法自动安装 Supervisor MCP。")
|
|
954
|
+
print(" 请先安装/更新 BugX CLI,再重新进入启动引导。")
|
|
955
|
+
return False
|
|
956
|
+
try:
|
|
957
|
+
install_cmd = [
|
|
958
|
+
cli, "install", "--root", str(resolve_project_root()), "--agent", host,
|
|
959
|
+
"--allow-missing", "--non-interactive",
|
|
960
|
+
]
|
|
961
|
+
if os.environ.get("BUGX_FORCE_INSTALL") or os.environ.get("BUGX_GLOBAL_ENGINE_ROOT"):
|
|
962
|
+
install_cmd.append("--force")
|
|
963
|
+
result = subprocess.run(
|
|
964
|
+
install_cmd,
|
|
965
|
+
cwd=str(resolve_project_root()), capture_output=True, text=True, timeout=90,
|
|
966
|
+
check=False,
|
|
967
|
+
)
|
|
968
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
969
|
+
print(f"[launch_bugx] ✗ Supervisor MCP 安装失败: {exc}")
|
|
970
|
+
return False
|
|
971
|
+
if result.returncode != 0:
|
|
972
|
+
detail = (result.stderr or result.stdout).strip()[-500:]
|
|
973
|
+
print(f"[launch_bugx] ✗ Supervisor MCP 安装失败: {detail}")
|
|
974
|
+
return False
|
|
975
|
+
print("[launch_bugx] ✓ Supervisor MCP 已写入宿主配置。")
|
|
976
|
+
print(supervisor_mcp_restart_instructions(host, install_required=False))
|
|
977
|
+
return False
|
|
978
|
+
|
|
979
|
+
def host_entry_gate() -> int:
|
|
980
|
+
"""DOC-236 C7:宿主侧入口(MCP + skill)就绪性门禁。
|
|
981
|
+
|
|
982
|
+
返回 ``0``(就绪)或 ``RESTART_REQUIRED``(需重新装配并重启宿主)。
|
|
983
|
+
与 MCP 门禁同为"配置→重启→resume"周期的一部分:宿主不支持热加载,
|
|
984
|
+
因此入口未就绪时必须停在**独立终态**,而不是伪装成"需要人决策"。
|
|
985
|
+
"""
|
|
986
|
+
if not uses_project_layout():
|
|
987
|
+
return 0
|
|
988
|
+
try:
|
|
989
|
+
from core.supervisor import supervisor_host
|
|
990
|
+
status = supervisor_host.host_entry_status(resolve_project_root())
|
|
991
|
+
except Exception as exc: # noqa: BLE001 - 检查失败一律 fail-closed
|
|
992
|
+
print(f"[launch_bugx] ✗ 宿主入口就绪性检查失败({type(exc).__name__}):{exc}")
|
|
993
|
+
return RESTART_REQUIRED
|
|
994
|
+
if status.get("ready"):
|
|
995
|
+
return 0
|
|
996
|
+
print("[launch_bugx] ✗ 需要重启宿主:宿主侧入口(MCP + skill)未就绪——"
|
|
997
|
+
+ str(status.get("reason") or "未知原因"))
|
|
998
|
+
stale = status.get("stale_files") or []
|
|
999
|
+
if stale:
|
|
1000
|
+
print(" 受影响入口文件:" + ", ".join(str(item) for item in stale))
|
|
1001
|
+
print(" 处置:运行 `bugx install` 重新装配宿主入口,然后**重启宿主会话**再启动 BugX。")
|
|
1002
|
+
return RESTART_REQUIRED
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
def _map_supervisor_mcp_answer(value: str | None, *, allow_manual: bool = True) -> str | None:
|
|
1006
|
+
"""supervisor_mcp 选择值→动作映射单一真源(TTY / 信箱两通道共用)。
|
|
1007
|
+
|
|
1008
|
+
TTY 文本菜单经 ``ask_interaction`` 返回选项序号("1"/"2"/"3");信箱通道
|
|
1009
|
+
(``bugx interaction answer supervisor_mcp``)经 ``take_answer`` 返回结构化
|
|
1010
|
+
门禁的语义 value("install"/"manual"/"later")。两通道必须落到同一动作,
|
|
1011
|
+
否则语义答案会在 ask 内被消费(consumed_at 已置位)却被映射丢弃,门禁
|
|
1012
|
+
无限重发。
|
|
1013
|
+
"""
|
|
1014
|
+
low = (value or "").strip().lower()
|
|
1015
|
+
if low in {"1", "install"}:
|
|
1016
|
+
return "install"
|
|
1017
|
+
if low == "2":
|
|
1018
|
+
# 序号是位置语义:两选项形状(无 manual)的 "2" 就是 later。
|
|
1019
|
+
return "manual" if allow_manual else "later"
|
|
1020
|
+
if low == "manual":
|
|
1021
|
+
# 语义值只在三选项形状存在;两选项门禁收到过期 manual 必须 fail-closed。
|
|
1022
|
+
return "manual" if allow_manual else None
|
|
1023
|
+
if low == "3":
|
|
1024
|
+
return "later" if allow_manual else None
|
|
1025
|
+
if low == "later":
|
|
1026
|
+
return "later"
|
|
1027
|
+
return None
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
def _prompt_supervisor_mcp(
|
|
1031
|
+
status: dict[str, object], *, allow_manual: bool = True,
|
|
1032
|
+
) -> str | None:
|
|
1033
|
+
"""通过统一交互组件返回 install/later(自动模式)或 manual。"""
|
|
1034
|
+
options = [
|
|
1035
|
+
("立即初始化/安装配置", "先初始化项目并写入当前宿主的 bugx-supervisor MCP;完成后必须重启宿主会话"),
|
|
1036
|
+
]
|
|
1037
|
+
if allow_manual:
|
|
1038
|
+
options.append(("本轮手动回退", "本轮由宿主/Agent 手动推进,不使用 MCP 自动审查"))
|
|
1039
|
+
options.append(("下次再说", "停止本轮启动,保留当前配置不变"))
|
|
1040
|
+
result = ask_interaction(
|
|
1041
|
+
"supervisor_mcp", "未检测到 bugx-supervisor MCP;请先初始化项目并完成宿主配置", options,
|
|
1042
|
+
default=0,
|
|
1043
|
+
detail=(
|
|
1044
|
+
str(status.get("detail") or "bugx-supervisor MCP 缺失")
|
|
1045
|
+
+ "。完成后必须重启宿主,再在新会话重新启动 BugX。"
|
|
1046
|
+
),
|
|
1047
|
+
)
|
|
1048
|
+
return _map_supervisor_mcp_answer(answered_value(result), allow_manual=allow_manual)
|
|
1049
|
+
|
|
1050
|
+
def supervisor_mcp_gate(*, review_mode: str | None,
|
|
1051
|
+
autonomous: bool = False) -> str:
|
|
1052
|
+
"""Require an install/manual/later decision for MCP automatic review.
|
|
1053
|
+
|
|
1054
|
+
DOC-236 C7:返回值由布尔改为**三态**,以便区分"需要重启宿主"与"需要人决策":
|
|
1055
|
+
* ``"ok"`` —— 可继续;
|
|
1056
|
+
* ``"restart_required"`` —— 配置已写入/已存在但当前宿主未加载 ⇒ 必须重启宿主;
|
|
1057
|
+
* ``"blocked"`` —— 需要用户/宿主决策或安装未完成。
|
|
1058
|
+
"""
|
|
1059
|
+
if review_mode != "mcp-auto":
|
|
1060
|
+
return "ok"
|
|
1061
|
+
# [BEGIN DEV_ONLY: FAST_VERIFICATION_MCP_GATE]
|
|
1062
|
+
try:
|
|
1063
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
1064
|
+
except ImportError:
|
|
1065
|
+
try:
|
|
1066
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
1067
|
+
except ImportError:
|
|
1068
|
+
try_get_preset_runtime_config = None
|
|
1069
|
+
if try_get_preset_runtime_config is not None:
|
|
1070
|
+
preset_cfg = try_get_preset_runtime_config(resolve_project_root() if uses_project_layout() else None)
|
|
1071
|
+
if preset_cfg.get("supervisor_mcp") in {"manual", "skip"}:
|
|
1072
|
+
return "ok"
|
|
1073
|
+
# [END DEV_ONLY: FAST_VERIFICATION_MCP_GATE]
|
|
1074
|
+
status = _supervisor_mcp_status()
|
|
1075
|
+
if status is None:
|
|
1076
|
+
return "ok"
|
|
1077
|
+
# A configured-but-not-loaded session is handled by the final
|
|
1078
|
+
# ``startup_action`` gate below. Do not present the older install/manual
|
|
1079
|
+
# gate here, otherwise the host can silently choose manual review and move
|
|
1080
|
+
# on to the polling question (the bug this gate is meant to prevent).
|
|
1081
|
+
if _mcp_session_is_stale(status):
|
|
1082
|
+
# 尝试快速 stdio 活体探活(A1 自愈机制)
|
|
1083
|
+
try:
|
|
1084
|
+
from core.supervisor import supervisor_host
|
|
1085
|
+
probe_result = supervisor_host.probe_builtin_mcp_session(resolve_project_root(), deadline=None)
|
|
1086
|
+
if not probe_result.get("error"):
|
|
1087
|
+
os.environ[supervisor_host.MCP_SESSION_PROOF_ENV] = json.dumps(probe_result, ensure_ascii=False)
|
|
1088
|
+
return "ok"
|
|
1089
|
+
except Exception:
|
|
1090
|
+
pass
|
|
1091
|
+
if autonomous:
|
|
1092
|
+
print("[launch_bugx] ✗ 需要重启宿主:Supervisor MCP 已配置但当前宿主未加载且探活未通过;"
|
|
1093
|
+
"支持使用 stdio JSON-RPC 等效通道驱动,或重启宿主会话后重试。")
|
|
1094
|
+
return "restart_required"
|
|
1095
|
+
return "ok"
|
|
1096
|
+
if autonomous:
|
|
1097
|
+
# The installer is already constrained to the BugX-managed host
|
|
1098
|
+
# adapter and offline MCP runtime. It returns False after writing
|
|
1099
|
+
# config because the current host cannot hot-load the new server.
|
|
1100
|
+
if not _install_supervisor_mcp(status):
|
|
1101
|
+
print("[launch_bugx] 自治模式已停止:Supervisor MCP 安装失败(需宿主重启后重试)。")
|
|
1102
|
+
return "restart_required"
|
|
1103
|
+
print("[launch_bugx] Supervisor MCP 配置已写入;需要宿主重新启动后才能加载。")
|
|
1104
|
+
return "restart_required"
|
|
1105
|
+
choice = _prompt_supervisor_mcp(status, allow_manual=False)
|
|
1106
|
+
if choice is None:
|
|
1107
|
+
environment = detect_startup_environment()
|
|
1108
|
+
host = str(status.get("host") or "当前宿主")
|
|
1109
|
+
emit_startup_gate(
|
|
1110
|
+
"supervisor_mcp",
|
|
1111
|
+
f"{host} 未检测到 bugx-supervisor MCP;请先初始化项目、完成宿主配置并重启后继续。",
|
|
1112
|
+
[
|
|
1113
|
+
{
|
|
1114
|
+
"label": "立即初始化/安装配置",
|
|
1115
|
+
"description": "先初始化项目并写入宿主配置;完成后必须重启当前宿主会话",
|
|
1116
|
+
"value": "install",
|
|
1117
|
+
"action": "install_supervisor_mcp",
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
"label": "下次再说",
|
|
1121
|
+
"description": "停止本轮启动,完成初始化和重启后再重新启动 BugX",
|
|
1122
|
+
"value": "later",
|
|
1123
|
+
"action": "stop_startup",
|
|
1124
|
+
},
|
|
1125
|
+
],
|
|
1126
|
+
environment=environment,
|
|
1127
|
+
detail=(
|
|
1128
|
+
str(status.get("detail") or "bugx-supervisor MCP 缺失")
|
|
1129
|
+
+ "。"
|
|
1130
|
+
+ supervisor_mcp_restart_instructions(host, install_required=True)
|
|
1131
|
+
),
|
|
1132
|
+
)
|
|
1133
|
+
return "blocked"
|
|
1134
|
+
if choice == "install":
|
|
1135
|
+
_install_supervisor_mcp(status)
|
|
1136
|
+
print("[launch_bugx] Supervisor MCP 配置已写入;需要宿主重新启动后才能加载。")
|
|
1137
|
+
return "restart_required"
|
|
1138
|
+
if choice == "later":
|
|
1139
|
+
print("[launch_bugx] Supervisor MCP 安装已延后,本轮启动停止。")
|
|
1140
|
+
return "blocked"
|
|
1141
|
+
print("[launch_bugx] MCP 自动审查未取得有效初始化/重启决定,本轮启动停止。")
|
|
1142
|
+
return "blocked"
|
|
1143
|
+
|
|
1144
|
+
def recover_supervisor_budget() -> bool:
|
|
1145
|
+
"""Apply the host recovery chain before post continues its current round."""
|
|
1146
|
+
try:
|
|
1147
|
+
result = auto_recover_supervisor(
|
|
1148
|
+
resolve_project_root(),
|
|
1149
|
+
coverage_manifest_exists=_coverage_manifest_exists(resolve_project_root()),
|
|
1150
|
+
)
|
|
1151
|
+
except (OSError, ValueError, AttributeError, RuntimeError) as exc:
|
|
1152
|
+
print(f"[supervisor] ✗ 自动恢复未完成: {exc}")
|
|
1153
|
+
return False
|
|
1154
|
+
return result.get("status") != "blocked"
|
|
1155
|
+
|
|
1156
|
+
def mutation_not_applicable(reason: str, report_only: bool) -> dict[str, Any]:
|
|
1157
|
+
"""无适用变异目标时的返回。
|
|
1158
|
+
|
|
1159
|
+
``report_only=True``(``fix_mutation_report_only`` 的默认值)表示该门禁
|
|
1160
|
+
只汇报、不阻断结算;此时如实返回 ``reported`` 并保留 ``reason``,绝不能
|
|
1161
|
+
反过来把"没有可变异目标"升级成 post 失败。``report_only=False`` 时才
|
|
1162
|
+
保留 ``not_applicable`` 终态,由调用方决定是否阻断。
|
|
1163
|
+
"""
|
|
1164
|
+
if report_only:
|
|
1165
|
+
return {
|
|
1166
|
+
"status": "reported",
|
|
1167
|
+
"reason": reason,
|
|
1168
|
+
"report_only": True,
|
|
1169
|
+
"mutation_applicable": False,
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
"status": "not_applicable",
|
|
1173
|
+
"reason": reason,
|
|
1174
|
+
"report_only": False,
|
|
1175
|
+
"mutation_applicable": False,
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
def run_fix_mutation_gate(
|
|
1180
|
+
root: Path,
|
|
1181
|
+
descriptor: Mapping[str, Any] | None,
|
|
1182
|
+
*,
|
|
1183
|
+
report_only: bool = True,
|
|
1184
|
+
threshold: float = 60.0,
|
|
1185
|
+
) -> dict[str, Any]:
|
|
1186
|
+
"""Run bounded mutation verification for a fix Life descriptor.
|
|
1187
|
+
|
|
1188
|
+
The descriptor is host-controlled. Worker-provided shell is rejected; the existing
|
|
1189
|
+
verifier remains the only execution engine and restores mutated files on every path.
|
|
1190
|
+
"""
|
|
1191
|
+
if not isinstance(descriptor, Mapping):
|
|
1192
|
+
return _mutation_not_applicable("missing_regression_descriptor", report_only)
|
|
1193
|
+
test_target = str(descriptor.get("test_target") or "").strip()
|
|
1194
|
+
target_files = descriptor.get("target_files")
|
|
1195
|
+
if not test_target or not isinstance(target_files, list) or not target_files:
|
|
1196
|
+
return {"status": "invalid", "reason": "descriptor_requires_test_target_and_target_files"}
|
|
1197
|
+
try:
|
|
1198
|
+
command = shlex.split(test_target)
|
|
1199
|
+
except ValueError as exc:
|
|
1200
|
+
return {"status": "invalid", "reason": f"invalid_test_target: {exc}"}
|
|
1201
|
+
allowed_roots = {str(Path(sys.executable).resolve()), "python", "python3"}
|
|
1202
|
+
if not command or command[0] not in allowed_roots:
|
|
1203
|
+
return {"status": "invalid", "reason": "test_target_must_use_python_runner"}
|
|
1204
|
+
if "-m" not in command or "unittest" not in command:
|
|
1205
|
+
return {"status": "invalid", "reason": "test_target_must_use_unittest"}
|
|
1206
|
+
try:
|
|
1207
|
+
timeout_sec = float(descriptor.get("timeout_sec", 2.0))
|
|
1208
|
+
except (TypeError, ValueError):
|
|
1209
|
+
return {"status": "invalid", "reason": "timeout_sec_invalid"}
|
|
1210
|
+
if not 0.5 <= timeout_sec <= 10.0:
|
|
1211
|
+
return {"status": "invalid", "reason": "timeout_sec_out_of_range"}
|
|
1212
|
+
|
|
1213
|
+
project_root = root.resolve()
|
|
1214
|
+
targets: list[Path] = []
|
|
1215
|
+
for raw in target_files[:8]:
|
|
1216
|
+
path = (project_root / str(raw)).resolve()
|
|
1217
|
+
try:
|
|
1218
|
+
path.relative_to(project_root)
|
|
1219
|
+
except ValueError:
|
|
1220
|
+
return {"status": "invalid", "reason": "target_file_outside_project"}
|
|
1221
|
+
if path.suffix != ".py" or not path.is_file():
|
|
1222
|
+
return _mutation_not_applicable(f"unsupported_target: {raw}", report_only)
|
|
1223
|
+
targets.append(path)
|
|
1224
|
+
|
|
1225
|
+
from core.planning import test_capability_verifier
|
|
1226
|
+
reports: list[dict[str, Any]] = []
|
|
1227
|
+
for target in targets:
|
|
1228
|
+
try:
|
|
1229
|
+
summary = test_capability_verifier.verify_test_capability(
|
|
1230
|
+
target_path=target,
|
|
1231
|
+
test_target=test_target,
|
|
1232
|
+
max_mutants=min(int(descriptor.get("max_mutants", 20)), 50),
|
|
1233
|
+
timeout_sec=timeout_sec,
|
|
1234
|
+
cwd=project_root,
|
|
1235
|
+
)
|
|
1236
|
+
reports.append(summary.to_dict())
|
|
1237
|
+
except (OSError, ValueError, TypeError, RuntimeError) as exc:
|
|
1238
|
+
return {"status": "error", "reason": str(exc), "reports": reports}
|
|
1239
|
+
score = min(float(item.get("mutation_score", 0.0)) for item in reports)
|
|
1240
|
+
status = "reported" if report_only else ("passed" if score >= threshold else "rejected")
|
|
1241
|
+
return {
|
|
1242
|
+
"status": status,
|
|
1243
|
+
"mutation_score": round(score, 2),
|
|
1244
|
+
"threshold": threshold,
|
|
1245
|
+
"reports": reports,
|
|
1246
|
+
"report_only": report_only,
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
_mutation_not_applicable = mutation_not_applicable
|
|
1251
|
+
_RUNTIME_STARTED_THIS_PROCESS = RUNTIME_STARTED_THIS_PROCESS
|
|
1252
|
+
_coverage_manifest_path = coverage_manifest_path
|
|
1253
|
+
|