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,1116 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""launch_phases/round_orchestrator.py - Round 推进调度、测试执行、发现标定与终局 post 报告结算。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import contextlib
|
|
7
|
+
import difflib
|
|
8
|
+
import hashlib
|
|
9
|
+
import io
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
import shlex
|
|
14
|
+
import shutil
|
|
15
|
+
import subprocess
|
|
16
|
+
import sys
|
|
17
|
+
import time
|
|
18
|
+
from dataclasses import dataclass
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
from core.launch_phases.worker_orchestrator import workers
|
|
23
|
+
# DES-06:本模块对 pre_phase 的依赖是**真实存在**的(不是死导入),见下方说明。
|
|
24
|
+
from core.launch_phases.pre_phase import ( # noqa: E402
|
|
25
|
+
pre,
|
|
26
|
+
coverage_status,
|
|
27
|
+
attach_coverage,
|
|
28
|
+
print_coverage,
|
|
29
|
+
)
|
|
30
|
+
# 修正说明(重要):此前这里曾以「零使用」为由删掉整条 import,导致
|
|
31
|
+
# ``bugx pre`` / ``bugx audit`` 报 ``NameError: name 'pre' is not defined`` ——
|
|
32
|
+
# 这是一次由**错误的依赖核查**引入的回归(当时用 grep 判定"零使用",
|
|
33
|
+
# 而该 grep 的 `\|` 交替在本机 shell 下静默失效,实际漏掉了 4 处真实调用)。
|
|
34
|
+
# 实测仍在使用:pre(:1360 分发 pre/audit)、coverage_status(:938)、
|
|
35
|
+
# attach_coverage(:939)、print_coverage(:994)。
|
|
36
|
+
# 只有 ``_prepare_project_profile`` 确实无人使用,故未回补。
|
|
37
|
+
# 方向说明:这条边是 round -> pre(与声明的 PRE -> ROUND 相反),但它不构成环
|
|
38
|
+
# (pre_phase 不反向 import round_orchestrator),且是分发所必需,故保留。
|
|
39
|
+
from core.launch_phases.post_phase import (
|
|
40
|
+
post,
|
|
41
|
+
get_last_post_failure,
|
|
42
|
+
continue_after_death,
|
|
43
|
+
close_session,
|
|
44
|
+
life_summary,
|
|
45
|
+
retry_pending_commit,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
from core.launch_phases.common import (
|
|
49
|
+
AGENT_DIR,
|
|
50
|
+
IN_PROCESS_SCOPE,
|
|
51
|
+
VERIFY,
|
|
52
|
+
SUPERVISOR_STATE,
|
|
53
|
+
LESSON_LEDGER_FILE,
|
|
54
|
+
POLLING_POLICIES,
|
|
55
|
+
POLLING_DECISION_REQUIRED,
|
|
56
|
+
get_last_child_failure,
|
|
57
|
+
resolve_project_root,
|
|
58
|
+
uses_project_layout,
|
|
59
|
+
child_environment,
|
|
60
|
+
diagnostic_logger,
|
|
61
|
+
run_verify_life,
|
|
62
|
+
format_duration,
|
|
63
|
+
option_value as _option_value,
|
|
64
|
+
require_project_layout as _require_project_layout,
|
|
65
|
+
isolated_runtime_scope,
|
|
66
|
+
bugx_paths,
|
|
67
|
+
bugx_logging,
|
|
68
|
+
dependency_lock,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
import core.i18n as i18n
|
|
73
|
+
except ImportError:
|
|
74
|
+
try:
|
|
75
|
+
from core import i18n
|
|
76
|
+
except ImportError:
|
|
77
|
+
i18n = None # type: ignore[assignment]
|
|
78
|
+
|
|
79
|
+
from core.launch_phases.session_runtime import (
|
|
80
|
+
refresh_runtime_paths,
|
|
81
|
+
audit_todo_path,
|
|
82
|
+
refresh_audit_todo,
|
|
83
|
+
load_runtime,
|
|
84
|
+
runtime_lock,
|
|
85
|
+
save_runtime,
|
|
86
|
+
diagnostic_context,
|
|
87
|
+
append_runtime_event,
|
|
88
|
+
runtime_summary,
|
|
89
|
+
close_runtime,
|
|
90
|
+
pause_runtime,
|
|
91
|
+
resume_runtime,
|
|
92
|
+
heartbeat_runtime,
|
|
93
|
+
print_runtime,
|
|
94
|
+
set_polling_policy,
|
|
95
|
+
)
|
|
96
|
+
from core.launch_phases.startup_gates import (
|
|
97
|
+
startup_todo_path,
|
|
98
|
+
startup_todo_content,
|
|
99
|
+
refresh_startup_todo,
|
|
100
|
+
detect_startup_environment,
|
|
101
|
+
startup_environment_line,
|
|
102
|
+
git_startup_gate,
|
|
103
|
+
emit_startup_gate,
|
|
104
|
+
pre_has_explicit_startup_choices,
|
|
105
|
+
project_layout_present,
|
|
106
|
+
startup_version_banner,
|
|
107
|
+
startup_cloud_onboarding,
|
|
108
|
+
startup_version_gate,
|
|
109
|
+
schedule_startup_remote_version_check,
|
|
110
|
+
emit_version_contract_gate,
|
|
111
|
+
emit_project_layout_gate,
|
|
112
|
+
)
|
|
113
|
+
from core.launch_phases.supervisor_bridge import (
|
|
114
|
+
get_supervisor,
|
|
115
|
+
supervisor_mcp_snapshot,
|
|
116
|
+
print_supervisor_mcp_snapshot,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
from core.governance.token_budget import estimate_tokens
|
|
120
|
+
import core.secure_atomic as secure_atomic
|
|
121
|
+
import tempfile
|
|
122
|
+
|
|
123
|
+
from core.supervisor.supervisor_models import BudgetExhausted
|
|
124
|
+
|
|
125
|
+
try:
|
|
126
|
+
from core.runtime import project_profile
|
|
127
|
+
except ImportError:
|
|
128
|
+
project_profile = None
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
from core.ledger import lesson_ledger
|
|
132
|
+
except ImportError:
|
|
133
|
+
lesson_ledger = None
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
_STATEFUL_COMMANDS = frozenset({
|
|
137
|
+
"pre", "audit", "post", "polling", "heartbeat", "pause", "resume",
|
|
138
|
+
"abort", "bootstrap-coverage", "fix-review", "revalidate-candidates",
|
|
139
|
+
"control", "workers", "daemon",
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
@dataclass(frozen=True)
|
|
143
|
+
class RunResult:
|
|
144
|
+
"""Subprocess-compatible result returned by :func:`run_in_process`.
|
|
145
|
+
|
|
146
|
+
``stdout``, ``stderr`` and ``returncode`` intentionally mirror
|
|
147
|
+
``subprocess.CompletedProcess`` so existing protocol fixtures can switch
|
|
148
|
+
execution lanes without changing their assertions. ``exception`` is only
|
|
149
|
+
populated when a library call raises outside the launcher's normal error
|
|
150
|
+
handling; it is diagnostic metadata, never a second status channel.
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
args: tuple[str, ...]
|
|
154
|
+
returncode: int
|
|
155
|
+
stdout: str = ""
|
|
156
|
+
stderr: str = ""
|
|
157
|
+
exception: BaseException | None = None
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _normalise_in_process_argv(argv: list[str] | tuple[str, ...]) -> list[str]:
|
|
161
|
+
"""Accept both ``["pre", ...]`` and ``["launch_bugx.py", "pre", ...]``."""
|
|
162
|
+
values = [str(value) for value in argv]
|
|
163
|
+
if values and Path(values[0]).name == "launch_bugx.py":
|
|
164
|
+
return values
|
|
165
|
+
return ["launch_bugx.py", *values]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _launcher_path(root: Path) -> Path:
|
|
169
|
+
"""返回给定项目根下真实存在的启动器路径(无布局假设)。
|
|
170
|
+
|
|
171
|
+
两种受支持布局:``<root>/core/launch_bugx.py``(自包含引擎副本)与
|
|
172
|
+
``<root>/launch_bugx.py``(归档扁平副本)。都不存在时回退到
|
|
173
|
+
``common.AGENT_DIR``(全局引擎),仍不存在则返回扁平候选——让错误在
|
|
174
|
+
调用方以"文件不存在"暴露,而不是在这里静默造一个假路径。
|
|
175
|
+
"""
|
|
176
|
+
for candidate in (
|
|
177
|
+
root / "core" / "launch_bugx.py",
|
|
178
|
+
root / "launch_bugx.py",
|
|
179
|
+
AGENT_DIR / "launch_bugx.py",
|
|
180
|
+
):
|
|
181
|
+
if candidate.is_file():
|
|
182
|
+
return candidate
|
|
183
|
+
return root / "launch_bugx.py"
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def run_in_process(
|
|
187
|
+
argv: list[str] | tuple[str, ...],
|
|
188
|
+
*,
|
|
189
|
+
project_root: Path,
|
|
190
|
+
stdin_content: str | None = None,
|
|
191
|
+
capture_output: bool = True,
|
|
192
|
+
env: dict[str, str] | None = None,
|
|
193
|
+
) -> RunResult:
|
|
194
|
+
"""Dispatch one ``launch_bugx`` command inside a recoverable sandbox.
|
|
195
|
+
|
|
196
|
+
This is the library counterpart to ``python launch_bugx.py ...``. It does
|
|
197
|
+
not fake a command by printing a prompt: the real ``main`` dispatcher and
|
|
198
|
+
all phase functions run, while :func:`isolated_runtime_scope` binds the
|
|
199
|
+
sandbox paths and restores process state on every exit path. Calls are
|
|
200
|
+
serialized by the scope because the legacy phases still use process-global
|
|
201
|
+
cwd/environment/module aliases; independent OS subprocesses remain the
|
|
202
|
+
correct lane for signal, orphan-reaping and process-group tests.
|
|
203
|
+
"""
|
|
204
|
+
command_argv = _normalise_in_process_argv(argv)
|
|
205
|
+
if command_argv[1:2] == ["daemon"] and "--help" not in command_argv[2:]:
|
|
206
|
+
message = "[launch_bugx] daemon 需要独立 OS 进程及信号生命周期,请通过 CLI/subprocess 执行。\n"
|
|
207
|
+
if not capture_output:
|
|
208
|
+
print(message, end="", file=sys.stderr)
|
|
209
|
+
return RunResult(
|
|
210
|
+
args=tuple(command_argv), returncode=2,
|
|
211
|
+
stderr=message if capture_output else "",
|
|
212
|
+
)
|
|
213
|
+
stdout_buffer = io.StringIO()
|
|
214
|
+
stderr_buffer = io.StringIO()
|
|
215
|
+
stdin = io.StringIO("" if stdin_content is None else str(stdin_content))
|
|
216
|
+
returncode = 1
|
|
217
|
+
captured_exception: BaseException | None = None
|
|
218
|
+
|
|
219
|
+
# ``redirect_stdin`` is not present on every supported Python minor. A
|
|
220
|
+
# tiny local context manager keeps the harness compatible without changing
|
|
221
|
+
# the production interaction layer.
|
|
222
|
+
@contextlib.contextmanager
|
|
223
|
+
def _redirect_stdin(stream):
|
|
224
|
+
previous = sys.stdin
|
|
225
|
+
sys.stdin = stream
|
|
226
|
+
try:
|
|
227
|
+
yield
|
|
228
|
+
finally:
|
|
229
|
+
sys.stdin = previous
|
|
230
|
+
|
|
231
|
+
with isolated_runtime_scope(project_root, env=env) as root:
|
|
232
|
+
previous_argv = list(sys.argv)
|
|
233
|
+
# ``sys.argv[0]`` 必须是**真实启动器路径**,不能假设扁平的
|
|
234
|
+
# ``<root>/launch_bugx.py``:自包含引擎副本布局是
|
|
235
|
+
# ``<root>/core/launch_bugx.py``,硬编码扁平路径会让
|
|
236
|
+
# ``bugx_paths.project_root()`` 与 ``resolve_project_root()``
|
|
237
|
+
# 拿到一个不存在的脚本位置(并让下游以它为"仓库根"拼路径)。
|
|
238
|
+
sys.argv = [str(_launcher_path(root)), *command_argv[1:]]
|
|
239
|
+
try:
|
|
240
|
+
output_context = (
|
|
241
|
+
contextlib.ExitStack()
|
|
242
|
+
if capture_output else contextlib.nullcontext()
|
|
243
|
+
)
|
|
244
|
+
with output_context as stack:
|
|
245
|
+
if capture_output:
|
|
246
|
+
stack.enter_context(contextlib.redirect_stdout(stdout_buffer))
|
|
247
|
+
stack.enter_context(contextlib.redirect_stderr(stderr_buffer))
|
|
248
|
+
with _redirect_stdin(stdin):
|
|
249
|
+
try:
|
|
250
|
+
value = main(command_argv)
|
|
251
|
+
returncode = int(value) if value is not None else 0
|
|
252
|
+
except SystemExit as exc:
|
|
253
|
+
captured_exception = exc
|
|
254
|
+
code = exc.code
|
|
255
|
+
returncode = int(code) if isinstance(code, int) else (
|
|
256
|
+
0 if code is None else 1
|
|
257
|
+
)
|
|
258
|
+
if code is not None and not isinstance(code, int):
|
|
259
|
+
print(code, file=sys.stderr)
|
|
260
|
+
except KeyboardInterrupt as exc:
|
|
261
|
+
captured_exception = exc
|
|
262
|
+
returncode = 130
|
|
263
|
+
except Exception as exc: # pragma: no cover - defensive boundary
|
|
264
|
+
captured_exception = exc
|
|
265
|
+
returncode = 1
|
|
266
|
+
print(
|
|
267
|
+
f"[launch_bugx] ✗ 进程内分发异常: {type(exc).__name__}: {exc}",
|
|
268
|
+
file=sys.stderr,
|
|
269
|
+
)
|
|
270
|
+
finally:
|
|
271
|
+
sys.argv = previous_argv
|
|
272
|
+
|
|
273
|
+
return RunResult(
|
|
274
|
+
args=tuple(command_argv),
|
|
275
|
+
returncode=returncode,
|
|
276
|
+
stdout=stdout_buffer.getvalue() if capture_output else "",
|
|
277
|
+
stderr=stderr_buffer.getvalue() if capture_output else "",
|
|
278
|
+
exception=captured_exception,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _resume_ticket_handoff(
|
|
283
|
+
project_root: Path, resume_ticket_module, ticket: dict[str, Any],
|
|
284
|
+
) -> int | None:
|
|
285
|
+
"""Handle one resume ticket without duplicating host/CLI handoff logic."""
|
|
286
|
+
startup_env = detect_startup_environment()
|
|
287
|
+
gui_hosts = {"workbuddy", "qoder", "trea", "zcode"}
|
|
288
|
+
if (getattr(startup_env, "interface", None) != "acp"
|
|
289
|
+
and getattr(startup_env, "host", None) in gui_hosts):
|
|
290
|
+
print("BUGX_RESUME_TICKET " + json.dumps(
|
|
291
|
+
resume_ticket_module.resume_card(ticket), ensure_ascii=False,
|
|
292
|
+
))
|
|
293
|
+
return POLLING_DECISION_REQUIRED
|
|
294
|
+
if resume_ticket_module.consume_resume_ticket(project_root) is not None:
|
|
295
|
+
# ``os.execv`` 只在**真实 OS 进程**车道成立:它把当前进程整块替换成
|
|
296
|
+
# 新解释器。进程内车道(``run_in_process`` / 嵌入式宿主 / 测试进程)
|
|
297
|
+
# 里执行它等于把宿主进程杀掉——实测整个 pytest 会话在一次 pre 之后
|
|
298
|
+
# 静默退出(exit 0、零输出、后续用例全部消失),看起来像"全绿"。
|
|
299
|
+
# 进程内车道改为就地继续:resume ticket 已经被消费,重启语义由
|
|
300
|
+
# 调用方决定,绝不能劫持宿主进程。
|
|
301
|
+
if not IN_PROCESS_SCOPE.get():
|
|
302
|
+
os.execv(sys.executable, [sys.executable, *sys.argv])
|
|
303
|
+
return None
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def _peek_pending_resume_ticket(project_root: Path) -> dict[str, Any] | None:
|
|
307
|
+
"""Read-only peek used only for an incomplete GUI handoff.
|
|
308
|
+
|
|
309
|
+
``resume_ticket.consume_resume_ticket`` remains the authority for all
|
|
310
|
+
mutation and claim semantics. The peek exists because a GUI must display
|
|
311
|
+
its card without deleting the ticket, and is limited to a layout already
|
|
312
|
+
validated by ``prepare_project``.
|
|
313
|
+
"""
|
|
314
|
+
target = project_root / ".bugx" / "resume_ticket.json"
|
|
315
|
+
# 路径必须**归一化后**比较:macOS 上 ``tempfile`` 给出 ``/var/...`` 而
|
|
316
|
+
# ``Path.resolve()`` 给出 ``/private/var/...``,直接用字符串比对会让同一目录
|
|
317
|
+
# 判成不同项目 → GUI resume 卡片永远不显示(build 286 全量验证发现)。
|
|
318
|
+
resolved_root = project_root.resolve()
|
|
319
|
+
try:
|
|
320
|
+
if target.is_symlink() or not target.is_file():
|
|
321
|
+
return None
|
|
322
|
+
payload = json.loads(target.read_text(encoding="utf-8"))
|
|
323
|
+
except (OSError, UnicodeError, ValueError, TypeError):
|
|
324
|
+
return None
|
|
325
|
+
if not isinstance(payload, dict) or payload.get("schema_version") != 1:
|
|
326
|
+
return None
|
|
327
|
+
recorded_root = str(payload.get("project_root") or "")
|
|
328
|
+
if not recorded_root or Path(recorded_root).resolve() != resolved_root:
|
|
329
|
+
return None
|
|
330
|
+
expires_at = payload.get("expires_at")
|
|
331
|
+
if not isinstance(expires_at, (int, float)) or float(expires_at) <= time.time():
|
|
332
|
+
return None
|
|
333
|
+
return payload
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def _emit_post_attempt_event(
|
|
337
|
+
event: str, *, level: int = 20, **fields: object,
|
|
338
|
+
) -> bool:
|
|
339
|
+
"""Write a post command event through the acknowledged local JSONL path."""
|
|
340
|
+
try:
|
|
341
|
+
from core.launch_phases.post_observability import emit_attempt_event
|
|
342
|
+
return emit_attempt_event(event, level=level, **fields)
|
|
343
|
+
except Exception:
|
|
344
|
+
return False
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def _log_early_post_failure(
|
|
348
|
+
exit_code: int, reason: str, *, gate_name: str = "dispatch_runtime_paths",
|
|
349
|
+
gate_status: str = "blocked",
|
|
350
|
+
) -> None:
|
|
351
|
+
"""Keep post failures structured even when startup gates return early."""
|
|
352
|
+
try:
|
|
353
|
+
from core.launch_phases.post_observability import (
|
|
354
|
+
attempt_scope, current_attempt, log_attempt_finished,
|
|
355
|
+
record_dispatch_failure,
|
|
356
|
+
)
|
|
357
|
+
if current_attempt() is None:
|
|
358
|
+
with attempt_scope("dispatcher"):
|
|
359
|
+
_emit_post_attempt_event("core_command_started")
|
|
360
|
+
record_dispatch_failure(
|
|
361
|
+
gate_name, reason, exit_code=exit_code,
|
|
362
|
+
gate_status=gate_status,
|
|
363
|
+
)
|
|
364
|
+
_emit_post_attempt_event(
|
|
365
|
+
"core_command_finished", level=40,
|
|
366
|
+
exit_code=exit_code, status="failed",
|
|
367
|
+
)
|
|
368
|
+
log_attempt_finished(exit_code)
|
|
369
|
+
else:
|
|
370
|
+
_emit_post_attempt_event("core_command_started")
|
|
371
|
+
record_dispatch_failure(
|
|
372
|
+
gate_name, reason, exit_code=exit_code,
|
|
373
|
+
gate_status=gate_status,
|
|
374
|
+
)
|
|
375
|
+
_emit_post_attempt_event(
|
|
376
|
+
"core_command_finished", level=40,
|
|
377
|
+
exit_code=exit_code, status="failed",
|
|
378
|
+
)
|
|
379
|
+
except Exception:
|
|
380
|
+
# Telemetry cannot change the early gate's business verdict.
|
|
381
|
+
pass
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def _post_dry_run_cli() -> int:
|
|
385
|
+
"""Print a read-only frozen-snapshot report without entering post dispatch."""
|
|
386
|
+
from core.launch_phases import post_dry_run
|
|
387
|
+
|
|
388
|
+
try:
|
|
389
|
+
snapshot = post_dry_run.capture_snapshot(resolve_project_root())
|
|
390
|
+
report = post_dry_run.evaluate_snapshot(snapshot)
|
|
391
|
+
except post_dry_run.SnapshotInvalid as exc:
|
|
392
|
+
report = post_dry_run.blocked_report(exc.reason_code)
|
|
393
|
+
except Exception:
|
|
394
|
+
# Dry-run failures are structured and fail-closed. Never leak arbitrary
|
|
395
|
+
# exception detail into the machine-readable report.
|
|
396
|
+
report = post_dry_run.blocked_report("snapshot_capture_error")
|
|
397
|
+
report = dict(report)
|
|
398
|
+
report["mode"] = "post_dry_run"
|
|
399
|
+
print(json.dumps(report, ensure_ascii=False, sort_keys=True))
|
|
400
|
+
return 0 if report.get("status") == "passed" and report.get("coherence") == "proven" else 1
|
|
401
|
+
|
|
402
|
+
try:
|
|
403
|
+
from core.coverage import coverage_bootstrap
|
|
404
|
+
except ImportError:
|
|
405
|
+
coverage_bootstrap = None
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
from core.launch_phases.orchestrator_controls import (
|
|
410
|
+
abort,
|
|
411
|
+
bootstrap_coverage,
|
|
412
|
+
cmd_prompt,
|
|
413
|
+
fix_review,
|
|
414
|
+
heartbeat,
|
|
415
|
+
legacy_supervisor_state,
|
|
416
|
+
lesson_module,
|
|
417
|
+
pause,
|
|
418
|
+
polling,
|
|
419
|
+
print_help,
|
|
420
|
+
resume,
|
|
421
|
+
status,
|
|
422
|
+
)
|
|
423
|
+
from core.launch_phases.candidate_revalidation import (
|
|
424
|
+
candidate_dependencies,
|
|
425
|
+
candidate_inventory,
|
|
426
|
+
changed_test_files,
|
|
427
|
+
ci_detection_report,
|
|
428
|
+
declared_dependencies,
|
|
429
|
+
inside_project,
|
|
430
|
+
revalidate_candidates,
|
|
431
|
+
safe_reproduction_command,
|
|
432
|
+
verify_candidate_assets,
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
# Compatibility aliases
|
|
436
|
+
_lesson_module = lesson_module
|
|
437
|
+
_inside_project = inside_project
|
|
438
|
+
_candidate_inventory = candidate_inventory
|
|
439
|
+
_candidate_dependencies = candidate_dependencies
|
|
440
|
+
_declared_dependencies = declared_dependencies
|
|
441
|
+
_verify_candidate_assets = verify_candidate_assets
|
|
442
|
+
_safe_reproduction_command = safe_reproduction_command
|
|
443
|
+
_changed_test_files = changed_test_files
|
|
444
|
+
_ci_detection_report = ci_detection_report
|
|
445
|
+
_legacy_supervisor_state = legacy_supervisor_state
|
|
446
|
+
_print_help = print_help
|
|
447
|
+
|
|
448
|
+
#: engine 子命令单一真值源(F-RSI-20261112-083):main() 的 argv 归一化与
|
|
449
|
+
#: _main_impl() 的重复归一化共用同一清单——历史双份手抄已漂移一次(F-020
|
|
450
|
+
#: 只补了 main() 侧的 coverage)。dispatch 链新增子命令时只改这里。
|
|
451
|
+
_KNOWN_CMDS = frozenset({
|
|
452
|
+
"pre", "post", "status", "polling", "heartbeat", "pause", "resume",
|
|
453
|
+
"abort", "bootstrap-coverage", "fix-review", "audit", "control",
|
|
454
|
+
"workers", "judge", "findings-confirm", "revalidate-candidates", "prompt", "daemon", "help", "--help", "-h",
|
|
455
|
+
"coverage",
|
|
456
|
+
})
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
def _reject_legacy_share_policy(argv: list[str]) -> int | None:
|
|
460
|
+
"""Reject the removed pre flag before any project/runtime side effect."""
|
|
461
|
+
if any(
|
|
462
|
+
arg == "--share-policy" or arg.startswith("--share-policy=")
|
|
463
|
+
for arg in argv[1:]
|
|
464
|
+
):
|
|
465
|
+
print(
|
|
466
|
+
"[launch_bugx] ✗ --share-policy 已移除;请使用 "
|
|
467
|
+
"`pre --report-policy none|local|submit`。"
|
|
468
|
+
)
|
|
469
|
+
return 2
|
|
470
|
+
return None
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def main(argv: list[str]) -> int:
|
|
474
|
+
"""Bind one context-local attempt around CLI post dispatch."""
|
|
475
|
+
values = list(argv)
|
|
476
|
+
known = _KNOWN_CMDS
|
|
477
|
+
if values and (values[0] in known or values[0].startswith("-")):
|
|
478
|
+
values = ["launch_bugx.py", *values]
|
|
479
|
+
legacy_share_policy = _reject_legacy_share_policy(values)
|
|
480
|
+
if legacy_share_policy is not None:
|
|
481
|
+
return legacy_share_policy
|
|
482
|
+
command = values[1] if len(values) > 1 else "status"
|
|
483
|
+
if command != "post" or "--dry-run" in values[2:]:
|
|
484
|
+
return _main_impl(values)
|
|
485
|
+
from core.launch_phases.post_observability import (
|
|
486
|
+
attempt_scope, current_attempt, log_attempt_finished,
|
|
487
|
+
record_unhandled_exception,
|
|
488
|
+
)
|
|
489
|
+
with attempt_scope("dispatcher") as attempt:
|
|
490
|
+
try:
|
|
491
|
+
result = _main_impl(
|
|
492
|
+
values, _post_attempt_token=attempt.attempt_token,
|
|
493
|
+
)
|
|
494
|
+
except BaseException as exc:
|
|
495
|
+
exit_code = 130 if isinstance(exc, KeyboardInterrupt) else 1
|
|
496
|
+
if isinstance(exc, SystemExit):
|
|
497
|
+
code = exc.code
|
|
498
|
+
exit_code = code if isinstance(code, int) and code != 0 else 1
|
|
499
|
+
active = current_attempt()
|
|
500
|
+
if active is not None and not active.failure_recorded:
|
|
501
|
+
record_unhandled_exception(exc, exit_code=exit_code)
|
|
502
|
+
_emit_post_attempt_event(
|
|
503
|
+
"core_command_finished", level=40,
|
|
504
|
+
exit_code=exit_code, status="failed",
|
|
505
|
+
)
|
|
506
|
+
log_attempt_finished(exit_code)
|
|
507
|
+
raise
|
|
508
|
+
log_attempt_finished(result)
|
|
509
|
+
return result
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def _main_impl(
|
|
513
|
+
argv: list[str], *, _post_attempt_token: object | None = None,
|
|
514
|
+
) -> int:
|
|
515
|
+
if argv and (argv[0] in _KNOWN_CMDS or argv[0].startswith("-")):
|
|
516
|
+
argv = ["launch_bugx.py"] + list(argv)
|
|
517
|
+
cmd = argv[1] if len(argv) > 1 else "status"
|
|
518
|
+
legacy_share_policy = _reject_legacy_share_policy(argv)
|
|
519
|
+
if legacy_share_policy is not None:
|
|
520
|
+
return legacy_share_policy
|
|
521
|
+
_HELP_TOKENS = {"help", "--help", "-h"}
|
|
522
|
+
if cmd in _HELP_TOKENS or any(token in _HELP_TOKENS for token in argv[2:]):
|
|
523
|
+
# 帮助契约要求三种写法都只读:`pre help` / `pre -h` 若不在这里截住,
|
|
524
|
+
# 会落进真实 pre 相位并写启动态,违反文档承诺。
|
|
525
|
+
return _print_help()
|
|
526
|
+
if cmd == "status" and os.environ.get("BUGX_PROJECT_ROOT"):
|
|
527
|
+
# Querying a fresh project must not require the layout that only pre
|
|
528
|
+
# creates. Keep this path read-only and recheck inside status().
|
|
529
|
+
try:
|
|
530
|
+
from core.runtime import project_init
|
|
531
|
+
|
|
532
|
+
if project_init.is_uninitialized_project(resolve_project_root()):
|
|
533
|
+
return status(as_json="--json" in argv[2:])
|
|
534
|
+
except (OSError, ValueError, RuntimeError) as exc:
|
|
535
|
+
if "--json" in argv[2:]:
|
|
536
|
+
print(json.dumps({"status": "BLOCKED", "reason": str(exc)}, ensure_ascii=False))
|
|
537
|
+
else:
|
|
538
|
+
print(f"[launch_bugx] ✗ 项目状态检查失败:{exc}")
|
|
539
|
+
return 1
|
|
540
|
+
if cmd in {"pre", "audit"} and "--allow-degraded" in argv[2:]:
|
|
541
|
+
# DOC-236 C1(A4):降级放行已废除。守卫必须位于**所有** pre/audit 出口
|
|
542
|
+
# 之前——放在尾部 dispatch 会被前置硬门禁(交互/版本/云/策略门禁)提前
|
|
543
|
+
# 返回绕过,从而变成"静默忽略"而不是"显式拒绝"。
|
|
544
|
+
print("[launch_bugx] ✗ --allow-degraded 已废除(DOC-236 C1 不允许降级):"
|
|
545
|
+
"请先自愈安装/配置;确无自动安装器的专有工具,"
|
|
546
|
+
"在 .bugx/config.json 的 tooling_exemptions 中显式豁免。")
|
|
547
|
+
return 1
|
|
548
|
+
# DOC-236 C5:只做轻量布局/config/fingerprint 准备;宿主、交互、Git、
|
|
549
|
+
# 版本与云门禁全部通过后才进入完整画像/探针/coverage pipeline。
|
|
550
|
+
# DOC-174 的 pending ticket 只做一次廉价恢复,不重新启动昂贵初始化。
|
|
551
|
+
project_root: Path | None = None
|
|
552
|
+
project_init_module = None
|
|
553
|
+
resume_ticket_module = None
|
|
554
|
+
if cmd in {"pre", "audit"} and os.environ.get("BUGX_PROJECT_ROOT"):
|
|
555
|
+
try:
|
|
556
|
+
from core.runtime import project_init as project_init_module
|
|
557
|
+
from core.runtime import resume_ticket as resume_ticket_module
|
|
558
|
+
|
|
559
|
+
project_root = Path(os.environ["BUGX_PROJECT_ROOT"]).expanduser().resolve()
|
|
560
|
+
project_init_module.prepare_project(project_root, AGENT_DIR)
|
|
561
|
+
# A headless/ACP restart can safely consume its one-use ticket and
|
|
562
|
+
# re-exec before gates, preserving the historical CLI handoff.
|
|
563
|
+
# GUI hosts must keep the ticket until the reload has passed all
|
|
564
|
+
# hard gates; otherwise the card would point at a deleted ticket.
|
|
565
|
+
startup_env = detect_startup_environment()
|
|
566
|
+
gui_hosts = {"workbuddy", "qoder", "trea", "zcode"}
|
|
567
|
+
is_gui_resume = (
|
|
568
|
+
getattr(startup_env, "interface", None) != "acp"
|
|
569
|
+
and getattr(startup_env, "host", None) in gui_hosts
|
|
570
|
+
)
|
|
571
|
+
if is_gui_resume:
|
|
572
|
+
pending_ticket = _peek_pending_resume_ticket(project_root)
|
|
573
|
+
config = project_init_module._read_config(
|
|
574
|
+
project_root / ".bugx" / "config.json",
|
|
575
|
+
)
|
|
576
|
+
if (isinstance(pending_ticket, dict)
|
|
577
|
+
and config.get("status") != "ready"):
|
|
578
|
+
print("BUGX_RESUME_TICKET " + json.dumps(
|
|
579
|
+
resume_ticket_module.resume_card(pending_ticket),
|
|
580
|
+
ensure_ascii=False,
|
|
581
|
+
))
|
|
582
|
+
return POLLING_DECISION_REQUIRED
|
|
583
|
+
else:
|
|
584
|
+
pending_ticket = resume_ticket_module.consume_resume_ticket(project_root)
|
|
585
|
+
if isinstance(pending_ticket, dict):
|
|
586
|
+
os.execv(sys.executable, [sys.executable, *sys.argv])
|
|
587
|
+
except (OSError, ValueError, RuntimeError, subprocess.SubprocessError) as exc:
|
|
588
|
+
print(f"[launch_bugx] ✗ 项目初始化/续做失败:{exc}")
|
|
589
|
+
return 1
|
|
590
|
+
if cmd == "post" and "--dry-run" in argv[2:]:
|
|
591
|
+
return _post_dry_run_cli()
|
|
592
|
+
logger = None
|
|
593
|
+
if cmd == "post":
|
|
594
|
+
# Set up diagnostics before layout/version/runtime-path gates can reject.
|
|
595
|
+
logger = diagnostic_logger(cmd)
|
|
596
|
+
from core.launch_phases.common import set_diagnostic_logger
|
|
597
|
+
set_diagnostic_logger(logger)
|
|
598
|
+
if cmd in _STATEFUL_COMMANDS and not _require_project_layout():
|
|
599
|
+
if cmd == "post":
|
|
600
|
+
_log_early_post_failure(
|
|
601
|
+
1, "project_layout_unavailable", gate_name="dispatch_layout",
|
|
602
|
+
)
|
|
603
|
+
return 1
|
|
604
|
+
startup_version_banner(
|
|
605
|
+
stream=sys.stderr if "--json" in argv[2:] else sys.stdout
|
|
606
|
+
)
|
|
607
|
+
if logger is None:
|
|
608
|
+
logger = diagnostic_logger(cmd)
|
|
609
|
+
from core.launch_phases.common import set_diagnostic_logger
|
|
610
|
+
set_diagnostic_logger(logger)
|
|
611
|
+
environment = detect_startup_environment()
|
|
612
|
+
# Stable 剥离下方 DEV_ONLY 块后开发模式参数不存在,哨兵值让下游全部回落到生产缺省。
|
|
613
|
+
dev_mode_requested = False
|
|
614
|
+
# [BEGIN DEV_ONLY: DEV_MODE_ARG]
|
|
615
|
+
dev_mode_requested = "--dev" in argv[2:]
|
|
616
|
+
# [END DEV_ONLY: DEV_MODE_ARG]
|
|
617
|
+
autonomous_requested = "--autonomous" in argv[2:] or dev_mode_requested
|
|
618
|
+
if not autonomous_requested and cmd in {"pre", "audit"}:
|
|
619
|
+
try:
|
|
620
|
+
from core.runtime import session_profile
|
|
621
|
+
early_profile = session_profile.load_profile(root=resolve_project_root()) or {}
|
|
622
|
+
autonomous_requested = (
|
|
623
|
+
str(early_profile.get("mode", "")).strip().lower() == "autonomous"
|
|
624
|
+
)
|
|
625
|
+
except Exception:
|
|
626
|
+
autonomous_requested = False
|
|
627
|
+
startup_todo_path = None
|
|
628
|
+
if cmd in {"pre", "audit"} and project_layout_present():
|
|
629
|
+
startup_todo_path = refresh_startup_todo(
|
|
630
|
+
"environment",
|
|
631
|
+
reason="启动入口已进入,正在收集并校验环境信息",
|
|
632
|
+
environment=environment,
|
|
633
|
+
)
|
|
634
|
+
if startup_todo_path:
|
|
635
|
+
print(f"[BugX] 启动总览 TODO:{startup_todo_path}")
|
|
636
|
+
print(startup_todo_content(
|
|
637
|
+
"environment",
|
|
638
|
+
reason="启动入口已进入,正在收集并校验环境信息",
|
|
639
|
+
environment=environment,
|
|
640
|
+
).rstrip())
|
|
641
|
+
if cmd in {"pre", "audit"} and environment is not None:
|
|
642
|
+
# 诊断行必须走 **stderr**:stdout 是机读协议通道(`BUGX_RESUME_TICKET <json>`
|
|
643
|
+
# 等标记要求独占可解析)。此前打到 stdout,导致宿主侧按「第一行」解析时
|
|
644
|
+
# 拿到 `[BugX] Startup environment: ...`(build 276 全量验证发现)。
|
|
645
|
+
print(
|
|
646
|
+
f"[BugX] Startup environment: {startup_environment_line(environment)}",
|
|
647
|
+
file=sys.stderr,
|
|
648
|
+
)
|
|
649
|
+
if uses_project_layout():
|
|
650
|
+
print_supervisor_mcp_snapshot(supervisor_mcp_snapshot())
|
|
651
|
+
# 哨兵必须在 DEV_ONLY 块之外:Stable 剥离后下方条件仍会读取该名字。
|
|
652
|
+
bypass_headless_gate = False
|
|
653
|
+
# [BEGIN DEV_ONLY: FAST_VERIFICATION_HEADLESS_BYPASS]
|
|
654
|
+
try:
|
|
655
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
656
|
+
except ImportError:
|
|
657
|
+
try:
|
|
658
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
659
|
+
except ImportError:
|
|
660
|
+
try_get_preset_runtime_config = None
|
|
661
|
+
if try_get_preset_runtime_config is not None:
|
|
662
|
+
if try_get_preset_runtime_config(resolve_project_root() if uses_project_layout() else None):
|
|
663
|
+
bypass_headless_gate = True
|
|
664
|
+
# [END DEV_ONLY: FAST_VERIFICATION_HEADLESS_BYPASS]
|
|
665
|
+
if (uses_project_layout()
|
|
666
|
+
# 缺字段(最小化 mock 环境)不得让启动流程崩:诊断/门禁按「未知」
|
|
667
|
+
# 处理,不等于 blocked,因此不额外拦截。
|
|
668
|
+
and getattr(environment, "interaction", None) == "blocked"
|
|
669
|
+
and not autonomous_requested
|
|
670
|
+
and not bypass_headless_gate
|
|
671
|
+
and not pre_has_explicit_startup_choices(argv[2:])):
|
|
672
|
+
emit_startup_gate(
|
|
673
|
+
"startup_interaction",
|
|
674
|
+
"当前宿主没有可用的原生单选控件或真实 TTY",
|
|
675
|
+
[
|
|
676
|
+
{
|
|
677
|
+
"label": "重启宿主并使用原生单选",
|
|
678
|
+
"description": "重启当前已识别的交互宿主后继续",
|
|
679
|
+
"value": "restart_host",
|
|
680
|
+
"action": "restart_host",
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
"label": "在真实 TTY 中运行",
|
|
684
|
+
"description": "通过方向键单选菜单继续",
|
|
685
|
+
"value": "run_tty",
|
|
686
|
+
"action": "run_in_tty",
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"label": "下次再说",
|
|
690
|
+
"description": "停止本轮启动",
|
|
691
|
+
"value": "later",
|
|
692
|
+
"action": "stop_startup",
|
|
693
|
+
},
|
|
694
|
+
],
|
|
695
|
+
environment=environment,
|
|
696
|
+
detail=environment.reason,
|
|
697
|
+
)
|
|
698
|
+
return POLLING_DECISION_REQUIRED
|
|
699
|
+
# Git is an environment hard prerequisite, not a later tool preference.
|
|
700
|
+
# Check it before version, cloud, MCP and coverage gates so no Session or
|
|
701
|
+
# other runtime state can be created without a reproducible code baseline.
|
|
702
|
+
if cmd in {"pre", "audit"} and project_layout_present():
|
|
703
|
+
if not git_startup_gate(environment, auto_init=dev_mode_requested):
|
|
704
|
+
return POLLING_DECISION_REQUIRED
|
|
705
|
+
if project_layout_present():
|
|
706
|
+
version_ok, version_detail, gate_kind = startup_version_gate()
|
|
707
|
+
if not version_ok:
|
|
708
|
+
if gate_kind == "project_layout":
|
|
709
|
+
print(f"[launch_bugx] ✗ 项目状态检查失败:{version_detail}")
|
|
710
|
+
emit_project_layout_gate(version_detail, environment)
|
|
711
|
+
else:
|
|
712
|
+
print(f"[launch_bugx] ✗ 启动版本门禁失败:{version_detail}")
|
|
713
|
+
emit_version_contract_gate(version_detail, environment)
|
|
714
|
+
if cmd == "post":
|
|
715
|
+
_log_early_post_failure(
|
|
716
|
+
POLLING_DECISION_REQUIRED,
|
|
717
|
+
"startup_version_gate_failed",
|
|
718
|
+
gate_name="dispatch_version",
|
|
719
|
+
)
|
|
720
|
+
return POLLING_DECISION_REQUIRED
|
|
721
|
+
if cmd in {"pre", "audit"}:
|
|
722
|
+
refresh_startup_todo(
|
|
723
|
+
"startup",
|
|
724
|
+
reason="环境与版本门禁通过,准备执行串行启动配置",
|
|
725
|
+
environment=environment,
|
|
726
|
+
)
|
|
727
|
+
# 非阻断版本检查:向服务端查询是否有新版本(air-gap / 网络不可达时静默跳过)。
|
|
728
|
+
# PERF-07:调度到守护线程执行,绝不在启动关键路径上同步等待。
|
|
729
|
+
if cmd in {"pre", "audit"}:
|
|
730
|
+
schedule_startup_remote_version_check(
|
|
731
|
+
stream=sys.stderr if "--json" in argv[2:] else sys.stdout,
|
|
732
|
+
)
|
|
733
|
+
if uses_project_layout():
|
|
734
|
+
try:
|
|
735
|
+
refresh_runtime_paths()
|
|
736
|
+
except (OSError, ValueError, RuntimeError) as exc:
|
|
737
|
+
if logger is not None and cmd != "post":
|
|
738
|
+
bugx_logging.log_event(
|
|
739
|
+
logger, "core_command_failed", str(exc), level=40,
|
|
740
|
+
command=cmd, exception_type=type(exc).__name__, exc_info=True,
|
|
741
|
+
)
|
|
742
|
+
if cmd == "post":
|
|
743
|
+
_log_early_post_failure(
|
|
744
|
+
1, "runtime_paths_unavailable",
|
|
745
|
+
gate_name="dispatch_runtime_paths",
|
|
746
|
+
gate_status="error",
|
|
747
|
+
)
|
|
748
|
+
print(f"[launch_bugx] ✗ .bugx 运行布局不可用: {exc}")
|
|
749
|
+
return 1
|
|
750
|
+
if cmd in {"pre", "audit"} and uses_project_layout():
|
|
751
|
+
try:
|
|
752
|
+
retry_pending_commit()
|
|
753
|
+
except (OSError, ValueError, RuntimeError) as exc:
|
|
754
|
+
if logger is not None:
|
|
755
|
+
bugx_logging.log_event(
|
|
756
|
+
logger, "git_recovery_failed", str(exc), level=40,
|
|
757
|
+
command=cmd, exception_type=type(exc).__name__, exc_info=True,
|
|
758
|
+
)
|
|
759
|
+
if cmd in {"pre", "audit"}:
|
|
760
|
+
profile_cfg = {}
|
|
761
|
+
try:
|
|
762
|
+
from core.runtime import session_profile
|
|
763
|
+
profile_cfg = session_profile.load_profile(
|
|
764
|
+
_option_value(argv[2:], "--profile"), root=resolve_project_root(),
|
|
765
|
+
) or {}
|
|
766
|
+
except Exception:
|
|
767
|
+
profile_cfg = {}
|
|
768
|
+
autonomous_mode = (
|
|
769
|
+
"--autonomous" in argv[2:]
|
|
770
|
+
or dev_mode_requested
|
|
771
|
+
or str(profile_cfg.get("mode", "")).strip().lower() == "autonomous"
|
|
772
|
+
)
|
|
773
|
+
cloud_policy = _option_value(argv[2:], "--cloud-sync") or profile_cfg.get("cloud_sync")
|
|
774
|
+
# [BEGIN DEV_ONLY: DEV_MODE_CLOUD_LOCAL]
|
|
775
|
+
if dev_mode_requested and not cloud_policy:
|
|
776
|
+
# 开发模式默认本地:无登录态的新机器上强制 sync 会被云端门禁判成
|
|
777
|
+
# BLOCKED(绝对阻断),"极速"反而起不来。显式 --cloud-sync sync
|
|
778
|
+
# 或项目/全局配置仍是同步的唯一入口,与 --dev 帮助文案
|
|
779
|
+
# 「使用本地/显式云同步」保持一致。
|
|
780
|
+
cloud_policy = "local"
|
|
781
|
+
# [END DEV_ONLY: DEV_MODE_CLOUD_LOCAL]
|
|
782
|
+
onboarding_result = startup_cloud_onboarding(
|
|
783
|
+
cloud_policy, autonomous=autonomous_mode,
|
|
784
|
+
)
|
|
785
|
+
if onboarding_result != 0:
|
|
786
|
+
return onboarding_result
|
|
787
|
+
refresh_startup_todo(
|
|
788
|
+
"startup",
|
|
789
|
+
reason="云端同步门禁已处理,等待其余启动配置和恢复决策",
|
|
790
|
+
environment=environment,
|
|
791
|
+
)
|
|
792
|
+
# DOC-236 C5:完整项目画像、可选 MCP 探针、prep/coverage bootstrap
|
|
793
|
+
# 必须位于宿主/交互/Git/版本硬门禁和云决策之后,且早于 pre() 的
|
|
794
|
+
# 策略门禁与探针剪枝。保持 report_policy 的 C6 参数转发不变。
|
|
795
|
+
if project_root is not None and project_init_module is not None:
|
|
796
|
+
try:
|
|
797
|
+
init_state = project_init_module.run_init_pipeline(
|
|
798
|
+
project_root, AGENT_DIR,
|
|
799
|
+
)
|
|
800
|
+
except (OSError, ValueError, RuntimeError, subprocess.SubprocessError) as exc:
|
|
801
|
+
print(f"[launch_bugx] ✗ 项目初始化/续做失败:{exc}")
|
|
802
|
+
return 1
|
|
803
|
+
ticket = init_state.get("resume_ticket")
|
|
804
|
+
if isinstance(ticket, dict) and resume_ticket_module is not None:
|
|
805
|
+
handoff = _resume_ticket_handoff(
|
|
806
|
+
project_root, resume_ticket_module, ticket,
|
|
807
|
+
)
|
|
808
|
+
if handoff is not None:
|
|
809
|
+
return handoff
|
|
810
|
+
elif resume_ticket_module is not None:
|
|
811
|
+
# A GUI host leaves the ticket on disk while it reloads the
|
|
812
|
+
# workspace. On re-entry the fast path has no new ticket;
|
|
813
|
+
# consume the old one only after every startup gate passed.
|
|
814
|
+
resume_ticket_module.consume_resume_ticket(project_root)
|
|
815
|
+
diag_ctx = diagnostic_context()
|
|
816
|
+
cmd_started = time.monotonic()
|
|
817
|
+
if cmd == "post":
|
|
818
|
+
_emit_post_attempt_event("core_command_started")
|
|
819
|
+
elif logger is not None:
|
|
820
|
+
bugx_logging.log_event(
|
|
821
|
+
logger, "core_command_started", command=cmd,
|
|
822
|
+
**diag_ctx,
|
|
823
|
+
)
|
|
824
|
+
try:
|
|
825
|
+
result: int
|
|
826
|
+
if cmd == "post":
|
|
827
|
+
_share = "share" if "--share" in argv[2:] else (
|
|
828
|
+
"no-share" if "--no-share" in argv[2:] else None)
|
|
829
|
+
post_started = time.monotonic()
|
|
830
|
+
phase_status = "failed"
|
|
831
|
+
try:
|
|
832
|
+
from core.launch_phases.post_observability import current_attempt
|
|
833
|
+
attempt = current_attempt()
|
|
834
|
+
with bugx_logging.timed_phase(
|
|
835
|
+
logger, "post_settlement", post_event_schema=1,
|
|
836
|
+
post_attempt_id=(attempt.post_attempt_id if attempt else None),
|
|
837
|
+
) as tracker:
|
|
838
|
+
try:
|
|
839
|
+
result = post(
|
|
840
|
+
final="--final" in argv[2:], share=_share,
|
|
841
|
+
allow_incomplete="--allow-incomplete" in argv[2:],
|
|
842
|
+
allow_serial="--allow-serial" in argv[2:],
|
|
843
|
+
_post_attempt_token=_post_attempt_token,
|
|
844
|
+
)
|
|
845
|
+
phase_status = "ok" if result == 0 else "failed"
|
|
846
|
+
if result != 0:
|
|
847
|
+
tracker.mark_failed(
|
|
848
|
+
get_last_post_failure() or "post_return_nonzero",
|
|
849
|
+
)
|
|
850
|
+
except BaseException:
|
|
851
|
+
tracker.mark_failed(
|
|
852
|
+
get_last_post_failure() or "post_exception",
|
|
853
|
+
)
|
|
854
|
+
raise
|
|
855
|
+
finally:
|
|
856
|
+
phase_duration = max(0.0, time.monotonic() - post_started)
|
|
857
|
+
_emit_post_attempt_event(
|
|
858
|
+
"phase.post_settlement.finished",
|
|
859
|
+
level=20 if phase_status == "ok" else 40,
|
|
860
|
+
phase="post_settlement", status=phase_status,
|
|
861
|
+
duration_seconds=round(phase_duration, 3),
|
|
862
|
+
)
|
|
863
|
+
threshold = bugx_logging.DEFAULT_SLOW_THRESHOLD_SECONDS
|
|
864
|
+
configured_threshold = os.environ.get("BUGX_SLOW_THRESHOLD_SECONDS")
|
|
865
|
+
if configured_threshold:
|
|
866
|
+
try:
|
|
867
|
+
threshold = float(configured_threshold)
|
|
868
|
+
except ValueError:
|
|
869
|
+
pass
|
|
870
|
+
if threshold > 0 and phase_duration >= threshold:
|
|
871
|
+
_emit_post_attempt_event(
|
|
872
|
+
"slow_operation_warning", level=30,
|
|
873
|
+
phase="post_settlement", status=phase_status,
|
|
874
|
+
duration_seconds=round(phase_duration, 3),
|
|
875
|
+
)
|
|
876
|
+
elif cmd == "status":
|
|
877
|
+
result = status(as_json="--json" in argv[2:])
|
|
878
|
+
elif cmd == "polling":
|
|
879
|
+
value = argv[2] if len(argv) > 2 else None
|
|
880
|
+
result = polling(value)
|
|
881
|
+
elif cmd == "heartbeat":
|
|
882
|
+
result = heartbeat()
|
|
883
|
+
elif cmd == "pause":
|
|
884
|
+
result = pause()
|
|
885
|
+
elif cmd == "resume":
|
|
886
|
+
result = resume()
|
|
887
|
+
elif cmd == "abort":
|
|
888
|
+
result = abort(_option_value(argv[2:], "--reason"))
|
|
889
|
+
elif cmd == "bootstrap-coverage":
|
|
890
|
+
result = bootstrap_coverage(
|
|
891
|
+
confirmed="--confirm" in argv[2:],
|
|
892
|
+
fresh_coverage="--fresh-coverage" in argv[2:],
|
|
893
|
+
)
|
|
894
|
+
elif cmd in {"pre", "audit"}:
|
|
895
|
+
# `--allow-degraded` 已在 `_main_impl` 入口统一拒绝(A4),此处不再重复判定。
|
|
896
|
+
pre_args = argv[2:]
|
|
897
|
+
is_dev = dev_mode_requested
|
|
898
|
+
strategy_plan_val = None
|
|
899
|
+
if "--approve-strategy" in pre_args or is_dev:
|
|
900
|
+
strategy_plan_val = "approve"
|
|
901
|
+
else:
|
|
902
|
+
strategy_plan_val = _option_value(pre_args, "--strategy-plan")
|
|
903
|
+
tooling_choices: dict[str, str] = {}
|
|
904
|
+
for i, arg in enumerate(pre_args):
|
|
905
|
+
if arg == "--tooling-choice" and i + 1 < len(pre_args):
|
|
906
|
+
val = pre_args[i + 1]
|
|
907
|
+
if "=" in val:
|
|
908
|
+
t, a = val.split("=", 1)
|
|
909
|
+
tooling_choices[t.strip()] = a.strip()
|
|
910
|
+
elif arg.startswith("--tooling-choice="):
|
|
911
|
+
val = arg.split("=", 1)[1]
|
|
912
|
+
if "=" in val:
|
|
913
|
+
t, a = val.split("=", 1)
|
|
914
|
+
tooling_choices[t.strip()] = a.strip()
|
|
915
|
+
with bugx_logging.timed_phase(logger, "pre_flight_gates"):
|
|
916
|
+
result = pre(
|
|
917
|
+
_option_value(pre_args, "--polling") or ("auto" if is_dev else None),
|
|
918
|
+
allow_serial="--allow-serial" in pre_args,
|
|
919
|
+
serial_reason=_option_value(pre_args, "--serial-reason"),
|
|
920
|
+
lesson_query=_option_value(pre_args, "--lesson-query") or "",
|
|
921
|
+
lesson_category=_option_value(pre_args, "--lesson-category"),
|
|
922
|
+
review_mode=_option_value(pre_args, "--review-mode") or ("mcp-auto" if is_dev else None),
|
|
923
|
+
fix_mode=_option_value(pre_args, "--fix-mode") or ("auto" if is_dev else None),
|
|
924
|
+
life_kind=_option_value(pre_args, "--life-kind") or "mine",
|
|
925
|
+
commit_policy=_option_value(pre_args, "--commit-policy") or ("round" if is_dev else None),
|
|
926
|
+
session_recovery=_option_value(pre_args, "--session-recovery") or ("resume" if is_dev else None),
|
|
927
|
+
startup_action=_option_value(pre_args, "--startup-action") or ("start" if is_dev else None),
|
|
928
|
+
strategy_plan=strategy_plan_val,
|
|
929
|
+
tooling_choices=tooling_choices or None,
|
|
930
|
+
report_policy=_option_value(pre_args, "--report-policy"),
|
|
931
|
+
replay_share_pending_force="--replay-share-pending" in pre_args,
|
|
932
|
+
startup_interaction=_option_value(pre_args, "--startup-interaction"),
|
|
933
|
+
bootstrap_coverage="--bootstrap-coverage" in pre_args,
|
|
934
|
+
profile=_option_value(pre_args, "--profile"),
|
|
935
|
+
ignore_global_budget="--ignore-global-budget" in pre_args,
|
|
936
|
+
refresh_probes="--refresh-probes" in pre_args,
|
|
937
|
+
autonomous="--autonomous" in pre_args or is_dev,
|
|
938
|
+
max_round_wall_seconds=_option_value(
|
|
939
|
+
pre_args, "--max-round-wall-seconds",
|
|
940
|
+
),
|
|
941
|
+
host=_option_value(pre_args, "--host"),
|
|
942
|
+
)
|
|
943
|
+
elif cmd == "control":
|
|
944
|
+
sub = argv[2] if len(argv) > 2 else "status"
|
|
945
|
+
if sub == "pause":
|
|
946
|
+
result = pause()
|
|
947
|
+
elif sub == "resume":
|
|
948
|
+
result = resume()
|
|
949
|
+
elif sub == "abort":
|
|
950
|
+
result = abort(_option_value(argv[3:], "--reason"))
|
|
951
|
+
else:
|
|
952
|
+
result = status(as_json="--json" in argv[2:])
|
|
953
|
+
elif cmd == "findings-confirm":
|
|
954
|
+
from core.launch_phases import finding_confirm_phase
|
|
955
|
+
result = finding_confirm_phase.main(argv[2:])
|
|
956
|
+
elif cmd == "judge":
|
|
957
|
+
from core.launch_phases import judge_phase
|
|
958
|
+
result = judge_phase.main(argv[2:])
|
|
959
|
+
elif cmd == "coverage":
|
|
960
|
+
# F-RSI-20261110-020:coverage_cli 此前是孤儿模块——
|
|
961
|
+
# AI_REFERENCE §六·五 记载的 `bugx engine coverage
|
|
962
|
+
# review-packages/review-apply` 无任何接线(顶层/engine 均不可达)。
|
|
963
|
+
from core.coverage import coverage_cli
|
|
964
|
+
result = coverage_cli.main(argv[2:])
|
|
965
|
+
elif cmd == "workers":
|
|
966
|
+
raw_count = _option_value(argv[2:], "--count")
|
|
967
|
+
strategy = _option_value(argv[2:], "--strategy") or "risk"
|
|
968
|
+
execute = "--execute" in argv[2:]
|
|
969
|
+
dry_run = "--dry-run" in argv[2:]
|
|
970
|
+
brief = "--brief" in argv[2:]
|
|
971
|
+
provider_arg = _option_value(argv[2:], "--provider")
|
|
972
|
+
model_arg = _option_value(argv[2:], "--model")
|
|
973
|
+
executable_arg = _option_value(argv[2:], "--executable")
|
|
974
|
+
host_arg = _option_value(argv[2:], "--host")
|
|
975
|
+
subagent_type_arg = _option_value(argv[2:], "--subagent-type")
|
|
976
|
+
max_workers_raw = _option_value(argv[2:], "--max-workers")
|
|
977
|
+
stagger_raw = _option_value(argv[2:], "--stagger-seconds")
|
|
978
|
+
try:
|
|
979
|
+
parsed_count = int(raw_count) if raw_count else None
|
|
980
|
+
except ValueError:
|
|
981
|
+
parsed_count = None
|
|
982
|
+
try:
|
|
983
|
+
parsed_max_workers = int(max_workers_raw) if max_workers_raw else None
|
|
984
|
+
except ValueError:
|
|
985
|
+
parsed_max_workers = None
|
|
986
|
+
try:
|
|
987
|
+
parsed_stagger = float(stagger_raw) if stagger_raw else None
|
|
988
|
+
except ValueError:
|
|
989
|
+
parsed_stagger = None
|
|
990
|
+
with bugx_logging.timed_phase(logger, "worker_execution", worker_count=parsed_count):
|
|
991
|
+
result = workers(
|
|
992
|
+
parsed_count,
|
|
993
|
+
strategy=strategy,
|
|
994
|
+
execute=execute,
|
|
995
|
+
host=host_arg,
|
|
996
|
+
max_workers=parsed_max_workers,
|
|
997
|
+
subagent_type=subagent_type_arg,
|
|
998
|
+
stagger_seconds=parsed_stagger,
|
|
999
|
+
model=model_arg,
|
|
1000
|
+
provider=provider_arg,
|
|
1001
|
+
executable=executable_arg,
|
|
1002
|
+
dry_run=dry_run,
|
|
1003
|
+
brief=brief,
|
|
1004
|
+
)
|
|
1005
|
+
elif cmd == "fix-review":
|
|
1006
|
+
result = fix_review(argv[2:])
|
|
1007
|
+
elif cmd == "revalidate-candidates":
|
|
1008
|
+
result = revalidate_candidates(argv[2:])
|
|
1009
|
+
elif cmd == "prompt":
|
|
1010
|
+
stage_val = _option_value(argv[2:], "--stage")
|
|
1011
|
+
result = cmd_prompt(stage_val)
|
|
1012
|
+
elif cmd == "daemon":
|
|
1013
|
+
from core.runtime import daemon_runner
|
|
1014
|
+
result = daemon_runner.main(argv[2:])
|
|
1015
|
+
else:
|
|
1016
|
+
print(
|
|
1017
|
+
f"[launch_bugx] 未知命令: {cmd}"
|
|
1018
|
+
"(可选 pre/post/status/polling/heartbeat/pause/resume/abort/"
|
|
1019
|
+
"bootstrap-coverage/fix-review/revalidate-candidates/audit/control/workers/"
|
|
1020
|
+
"judge/findings-confirm/coverage/prompt/daemon)"
|
|
1021
|
+
)
|
|
1022
|
+
result = 2
|
|
1023
|
+
except BudgetExhausted as exc:
|
|
1024
|
+
cmd_duration = round(max(0.0, time.monotonic() - cmd_started), 3)
|
|
1025
|
+
if cmd == "post":
|
|
1026
|
+
try:
|
|
1027
|
+
from core.launch_phases.post_observability import (
|
|
1028
|
+
current_attempt, record_unhandled_exception,
|
|
1029
|
+
)
|
|
1030
|
+
active = current_attempt()
|
|
1031
|
+
if active is not None and not active.failure_recorded:
|
|
1032
|
+
record_unhandled_exception(exc, exit_code=1)
|
|
1033
|
+
except Exception:
|
|
1034
|
+
pass
|
|
1035
|
+
_emit_post_attempt_event(
|
|
1036
|
+
"core_command_finished", level=40,
|
|
1037
|
+
exit_code=1, status="failed", duration_seconds=cmd_duration,
|
|
1038
|
+
)
|
|
1039
|
+
elif logger is not None:
|
|
1040
|
+
bugx_logging.log_event(
|
|
1041
|
+
logger, "budget_exhausted", str(exc), level=40,
|
|
1042
|
+
command=cmd, exception_type=type(exc).__name__,
|
|
1043
|
+
duration_seconds=cmd_duration,
|
|
1044
|
+
**diag_ctx,
|
|
1045
|
+
)
|
|
1046
|
+
print(json.dumps({
|
|
1047
|
+
"status": "BUDGET_EXHAUSTED",
|
|
1048
|
+
"error_type": type(exc).__name__,
|
|
1049
|
+
"reason": str(exc),
|
|
1050
|
+
"recovery": [
|
|
1051
|
+
"读取 bugx engine --root . status 确认 budget_reasons",
|
|
1052
|
+
"必要时执行 audit_supervisor.py reset-budget --force 开启新的预算 epoch",
|
|
1053
|
+
],
|
|
1054
|
+
}, ensure_ascii=False))
|
|
1055
|
+
return 1
|
|
1056
|
+
except Exception as exc: # pragma: no cover - exercised by integration failures.
|
|
1057
|
+
cmd_duration = round(max(0.0, time.monotonic() - cmd_started), 3)
|
|
1058
|
+
if cmd == "post":
|
|
1059
|
+
try:
|
|
1060
|
+
from core.launch_phases.post_observability import (
|
|
1061
|
+
current_attempt, record_unhandled_exception,
|
|
1062
|
+
)
|
|
1063
|
+
active = current_attempt()
|
|
1064
|
+
if active is not None and not active.failure_recorded:
|
|
1065
|
+
record_unhandled_exception(exc, exit_code=1)
|
|
1066
|
+
except Exception:
|
|
1067
|
+
pass
|
|
1068
|
+
_emit_post_attempt_event(
|
|
1069
|
+
"core_command_finished", level=40,
|
|
1070
|
+
exit_code=1, status="failed", duration_seconds=cmd_duration,
|
|
1071
|
+
)
|
|
1072
|
+
elif logger is not None:
|
|
1073
|
+
bugx_logging.log_event(
|
|
1074
|
+
logger, "core_command_crashed", str(exc), level=40,
|
|
1075
|
+
command=cmd, exception_type=type(exc).__name__,
|
|
1076
|
+
duration_seconds=cmd_duration,
|
|
1077
|
+
**diag_ctx, exc_info=True,
|
|
1078
|
+
)
|
|
1079
|
+
err = f"[launch_bugx] ✗ 未处理异常: {type(exc).__name__}: {exc}"
|
|
1080
|
+
if i18n is not None:
|
|
1081
|
+
err = i18n.exception_text("orchestrator.unhandled", fallback=err, exc_type=type(exc).__name__, exc=exc)
|
|
1082
|
+
print(err)
|
|
1083
|
+
return 1
|
|
1084
|
+
|
|
1085
|
+
cmd_duration = round(max(0.0, time.monotonic() - cmd_started), 3)
|
|
1086
|
+
if cmd == "post":
|
|
1087
|
+
_emit_post_attempt_event(
|
|
1088
|
+
"core_command_finished", level=40 if result != 0 else 20,
|
|
1089
|
+
exit_code=result,
|
|
1090
|
+
status="failed" if result != 0 else "ok",
|
|
1091
|
+
duration_seconds=cmd_duration,
|
|
1092
|
+
)
|
|
1093
|
+
elif logger is not None:
|
|
1094
|
+
if cmd in {"pre", "audit"} and result != 0 and bugx_logging is not None:
|
|
1095
|
+
bugx_logging.log_event(
|
|
1096
|
+
logger, "pre_failed", "pre 门禁失败;已记录最近失败详情",
|
|
1097
|
+
level=40, exit_code=result,
|
|
1098
|
+
duration_seconds=cmd_duration,
|
|
1099
|
+
failure_detail=get_last_child_failure() or "pre 返回非零,但未产生子命令输出",
|
|
1100
|
+
)
|
|
1101
|
+
if result != 0:
|
|
1102
|
+
err_detail = (get_last_post_failure() if cmd == "post" else "") or (get_last_child_failure() if cmd in {"pre", "audit"} else "")
|
|
1103
|
+
err_msg = f"{cmd} 命令执行失败 (exit_code={result})" + (f": {err_detail}" if err_detail else "")
|
|
1104
|
+
bugx_logging.log_event(
|
|
1105
|
+
logger, "core_command_finished", err_msg,
|
|
1106
|
+
level=40, command=cmd, exit_code=result,
|
|
1107
|
+
duration_seconds=cmd_duration,
|
|
1108
|
+
error=err_detail or f"exit_code={result}",
|
|
1109
|
+
**diag_ctx,
|
|
1110
|
+
)
|
|
1111
|
+
else:
|
|
1112
|
+
bugx_logging.log_event(
|
|
1113
|
+
logger, "core_command_finished", command=cmd,
|
|
1114
|
+
exit_code=result, duration_seconds=cmd_duration, **diag_ctx,
|
|
1115
|
+
)
|
|
1116
|
+
return result
|