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,1211 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""launch_phases/supervisor_degraded.py - 降级探针治理、自愈修复、突变门禁与工具链豁免。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import shlex
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import re
|
|
11
|
+
import sys
|
|
12
|
+
import time
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from collections.abc import Mapping
|
|
17
|
+
from core.launch_phases.common import (
|
|
18
|
+
resolve_project_root,
|
|
19
|
+
uses_project_layout,
|
|
20
|
+
supervisor_state_path,
|
|
21
|
+
child_environment,
|
|
22
|
+
run_child,
|
|
23
|
+
sync_codebase_memory_env as _sync_codebase_memory_env,
|
|
24
|
+
bugx_paths,
|
|
25
|
+
)
|
|
26
|
+
from core.launch_phases.session_runtime import (
|
|
27
|
+
load_runtime,
|
|
28
|
+
save_runtime,
|
|
29
|
+
iso_time,
|
|
30
|
+
runtime_lock,
|
|
31
|
+
)
|
|
32
|
+
from core.repair import self_heal
|
|
33
|
+
from core.host_runtime import host_registry
|
|
34
|
+
from core.runtime.tool_install_targets import PROBE_REPAIR_TARGETS
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def ask_interaction(*args, **kwargs):
|
|
39
|
+
sb = _sb()
|
|
40
|
+
if sb and hasattr(sb, "ask_interaction"):
|
|
41
|
+
fn = getattr(sb, "ask_interaction")
|
|
42
|
+
if fn is not ask_interaction:
|
|
43
|
+
return fn(*args, **kwargs)
|
|
44
|
+
from core.launch_phases.startup_interaction import ask_interaction as real
|
|
45
|
+
return real(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
def answered_values(*args, **kwargs):
|
|
48
|
+
sb = _sb()
|
|
49
|
+
if sb and hasattr(sb, "answered_values"):
|
|
50
|
+
fn = getattr(sb, "answered_values")
|
|
51
|
+
if fn is not answered_values:
|
|
52
|
+
return fn(*args, **kwargs)
|
|
53
|
+
from core.launch_phases.startup_interaction import answered_values as real
|
|
54
|
+
return real(*args, **kwargs)
|
|
55
|
+
|
|
56
|
+
def answered_value(*args, **kwargs):
|
|
57
|
+
sb = _sb()
|
|
58
|
+
if sb and hasattr(sb, "answered_value"):
|
|
59
|
+
fn = getattr(sb, "answered_value")
|
|
60
|
+
if fn is not answered_value:
|
|
61
|
+
return fn(*args, **kwargs)
|
|
62
|
+
from core.launch_phases.startup_interaction import answered_value as real
|
|
63
|
+
return real(*args, **kwargs)
|
|
64
|
+
|
|
65
|
+
def _degraded_install(*args, **kwargs):
|
|
66
|
+
sb = _sb()
|
|
67
|
+
if sb and hasattr(sb, "_degraded_install"):
|
|
68
|
+
fn = getattr(sb, "_degraded_install")
|
|
69
|
+
if fn is not _degraded_install:
|
|
70
|
+
return fn(*args, **kwargs)
|
|
71
|
+
return degraded_install(*args, **kwargs)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def run_preflight_probes(*args, **kwargs):
|
|
75
|
+
sb = _sb()
|
|
76
|
+
if sb and hasattr(sb, "run_preflight_probes"):
|
|
77
|
+
return sb.run_preflight_probes(*args, **kwargs)
|
|
78
|
+
raise RuntimeError("supervisor_bridge.run_preflight_probes not available")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class _AgentDirProxy:
|
|
82
|
+
def _target(self):
|
|
83
|
+
sb = _sb()
|
|
84
|
+
if sb and hasattr(sb, "AGENT_DIR"):
|
|
85
|
+
return getattr(sb, "AGENT_DIR")
|
|
86
|
+
from core.launch_phases.common import AGENT_DIR as real
|
|
87
|
+
return real
|
|
88
|
+
def resolve(self):
|
|
89
|
+
return self._target().resolve()
|
|
90
|
+
def __getattr__(self, name):
|
|
91
|
+
return getattr(self._target(), name)
|
|
92
|
+
|
|
93
|
+
AGENT_DIR = _AgentDirProxy()
|
|
94
|
+
|
|
95
|
+
def _sb():
|
|
96
|
+
return sys.modules.get("core.launch_phases.supervisor_bridge") or sys.modules.get("launch_phases.supervisor_bridge")
|
|
97
|
+
|
|
98
|
+
def _get_sb_attr(name: str, fallback=None):
|
|
99
|
+
sb = _sb()
|
|
100
|
+
if sb and hasattr(sb, name):
|
|
101
|
+
return getattr(sb, name)
|
|
102
|
+
return fallback
|
|
103
|
+
|
|
104
|
+
def _resolve_project_root(*args, **kwargs):
|
|
105
|
+
fn = _get_sb_attr("resolve_project_root", resolve_project_root)
|
|
106
|
+
return fn(*args, **kwargs)
|
|
107
|
+
|
|
108
|
+
def degraded_actions(report: dict, *, probe_name: str = "") -> list[dict]:
|
|
109
|
+
"""从探针 JSON 报告提取降级项与对应处置选项。
|
|
110
|
+
|
|
111
|
+
MCP 缺失/未配置必须进入专用交互菜单。``probe_name`` 用来保留探针
|
|
112
|
+
的组件语义:codebase-memory-mcp 的子检查名称是 binary/cli,单看子
|
|
113
|
+
检查名无法识别它属于 MCP。
|
|
114
|
+
"""
|
|
115
|
+
from core.probes import probe_registry
|
|
116
|
+
return probe_registry.extract_degraded_actions(report, probe_name=probe_name)
|
|
117
|
+
|
|
118
|
+
_LAST_SELF_HEAL_REPORT: self_heal.HealReport | None = None
|
|
119
|
+
|
|
120
|
+
# C1 decisions are deliberately separate from their human-readable labels.
|
|
121
|
+
# A display string can be copied from a prompt or supplied by a host; it must
|
|
122
|
+
# never be able to manufacture a successful gate result.
|
|
123
|
+
DEGRADED_HEALED = "healed"
|
|
124
|
+
DEGRADED_NOT_APPLICABLE = "not_applicable"
|
|
125
|
+
DEGRADED_EXEMPTED = "exempted"
|
|
126
|
+
DEGRADED_BLOCKED = "blocked"
|
|
127
|
+
DEGRADED_DEFERRED = "deferred"
|
|
128
|
+
DEGRADED_TRANSIENT = "transient"
|
|
129
|
+
DEGRADED_PASSING_STATUSES = frozenset({
|
|
130
|
+
DEGRADED_HEALED, DEGRADED_NOT_APPLICABLE, DEGRADED_TRANSIENT,
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
_DEGRADED_HEALED = DEGRADED_HEALED
|
|
134
|
+
_DEGRADED_NOT_APPLICABLE = DEGRADED_NOT_APPLICABLE
|
|
135
|
+
_DEGRADED_EXEMPTED = DEGRADED_EXEMPTED
|
|
136
|
+
_DEGRADED_BLOCKED = DEGRADED_BLOCKED
|
|
137
|
+
_DEGRADED_DEFERRED = DEGRADED_DEFERRED
|
|
138
|
+
_DEGRADED_TRANSIENT = DEGRADED_TRANSIENT
|
|
139
|
+
_DEGRADED_PASSING_STATUSES = DEGRADED_PASSING_STATUSES
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class DegradedDecision(str):
|
|
143
|
+
"""String-compatible display value carrying an internal typed C1 status."""
|
|
144
|
+
|
|
145
|
+
__slots__ = ("status", "receipt")
|
|
146
|
+
|
|
147
|
+
def __new__(
|
|
148
|
+
cls, status: str, display: str, receipt: Mapping[str, Any] | None = None,
|
|
149
|
+
):
|
|
150
|
+
value = str.__new__(cls, display)
|
|
151
|
+
value.status = status
|
|
152
|
+
value.receipt = dict(receipt or {})
|
|
153
|
+
return value
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def degraded_decision(
|
|
157
|
+
status: str, display: str, receipt: Mapping[str, Any] | None = None,
|
|
158
|
+
) -> _DegradedDecision:
|
|
159
|
+
return _DegradedDecision(status, display, receipt)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def degraded_item_not_applicable(item: Mapping[str, Any]) -> bool:
|
|
163
|
+
"""Return True only for an explicit machine-level applicability result."""
|
|
164
|
+
status = str(item.get("status", "")).strip().casefold()
|
|
165
|
+
applicability = str(item.get("applicability", "")).strip().casefold()
|
|
166
|
+
return bool(
|
|
167
|
+
item.get("not_applicable") is True
|
|
168
|
+
or status == _DEGRADED_NOT_APPLICABLE
|
|
169
|
+
or applicability == _DEGRADED_NOT_APPLICABLE
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def degraded_item_advisory(item: Mapping[str, Any]) -> bool:
|
|
174
|
+
"""描述符声明 ``required=False`` 的建议性探针(如 openwiki)。
|
|
175
|
+
|
|
176
|
+
注册表已判定"缺失不阻断启动",门禁必须尊重同一份机器声明;否则
|
|
177
|
+
advisory 探针会从降级通道反向变成硬阻断,与它自己的注册契约冲突。
|
|
178
|
+
"""
|
|
179
|
+
return item.get("advisory") is True
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def degraded_item_transient(item: Mapping[str, Any]) -> bool:
|
|
183
|
+
"""二进制/插件**存在**但本次调用超时或异常(``transient`` 由注册中心置位)。"""
|
|
184
|
+
return item.get("transient") is True
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def degraded_item_critical(item: Mapping[str, Any]) -> bool:
|
|
188
|
+
"""能力是否 critical:以描述符机器声明为准,缺失时才回落到 ``kind=mcp`` 猜测。"""
|
|
189
|
+
declared = item.get("critical")
|
|
190
|
+
if isinstance(declared, bool):
|
|
191
|
+
return declared
|
|
192
|
+
name = str(item.get("name", "")).casefold()
|
|
193
|
+
return bool(item.get("kind") == "mcp" or "mcp" in name)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def degraded_exemption_hit(name: str, exemptions: set[str]) -> bool:
|
|
197
|
+
"""豁免名匹配:支持完整条目名与探针级前缀(``codebase-memory-mcp/cli`` ← ``codebase-memory-mcp``)。"""
|
|
198
|
+
lowered = name.casefold()
|
|
199
|
+
if lowered in exemptions:
|
|
200
|
+
return True
|
|
201
|
+
probe = lowered.split("/", 1)[0].strip()
|
|
202
|
+
return bool(probe) and probe in exemptions
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def degraded_decision_for_policy(item: Mapping[str, Any]) -> _DegradedDecision | None:
|
|
206
|
+
"""按注册表机器语义给出**非阻断**决策;返回 None 表示仍需人工/自愈决策。
|
|
207
|
+
|
|
208
|
+
顺序即优先级:显式不适用 → 建议性探针 → 瞬态降级。三者都必须留痕,
|
|
209
|
+
且都不得借此启用任何能力(例如 codebase-memory 仍会被强制降级模式)。
|
|
210
|
+
"""
|
|
211
|
+
name = str(item.get("name", "unknown"))
|
|
212
|
+
detail = str(item.get("detail", ""))
|
|
213
|
+
if _degraded_item_not_applicable(item):
|
|
214
|
+
return _degraded_decision(
|
|
215
|
+
_DEGRADED_NOT_APPLICABLE,
|
|
216
|
+
f"不适用:{detail or '探针已按项目形态剪枝'}",
|
|
217
|
+
{
|
|
218
|
+
"source": "probe_applicability",
|
|
219
|
+
"name": name,
|
|
220
|
+
"status": _DEGRADED_NOT_APPLICABLE,
|
|
221
|
+
},
|
|
222
|
+
)
|
|
223
|
+
if _degraded_item_advisory(item):
|
|
224
|
+
return _degraded_decision(
|
|
225
|
+
_DEGRADED_NOT_APPLICABLE,
|
|
226
|
+
f"不阻断:建议性探针未就绪({detail or '无详情'})",
|
|
227
|
+
{
|
|
228
|
+
"source": "probe_advisory",
|
|
229
|
+
"name": name,
|
|
230
|
+
"status": _DEGRADED_NOT_APPLICABLE,
|
|
231
|
+
"probe": item.get("probe", ""),
|
|
232
|
+
},
|
|
233
|
+
)
|
|
234
|
+
if _degraded_item_transient(item) and not _degraded_item_critical(item):
|
|
235
|
+
return _degraded_decision(
|
|
236
|
+
_DEGRADED_TRANSIENT,
|
|
237
|
+
f"瞬态降级:本次探测超时({detail or '无详情'})",
|
|
238
|
+
{
|
|
239
|
+
"source": "probe_transient",
|
|
240
|
+
"name": name,
|
|
241
|
+
"status": _DEGRADED_TRANSIENT,
|
|
242
|
+
"probe": item.get("probe", ""),
|
|
243
|
+
},
|
|
244
|
+
)
|
|
245
|
+
return None
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def degraded_receipt_for_report(report: self_heal.HealReport | None) -> dict[str, Any] | None:
|
|
249
|
+
if report is None:
|
|
250
|
+
return None
|
|
251
|
+
try:
|
|
252
|
+
return report.as_dict()
|
|
253
|
+
except (AttributeError, TypeError, ValueError):
|
|
254
|
+
return {"status": "unserializable", "attempts": len(report.attempts)}
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def report_self_heal(report: self_heal.HealReport) -> None:
|
|
258
|
+
"""打印穷尽自愈的处置清单,并留存供门禁在阻断时一并展示(DOC-236 C2)。"""
|
|
259
|
+
global _LAST_SELF_HEAL_REPORT
|
|
260
|
+
_LAST_SELF_HEAL_REPORT = report
|
|
261
|
+
print(f"[launch_bugx] 穷尽自愈未能补齐(已试 {len(report.attempts)} 个方案):")
|
|
262
|
+
for line in self_heal.escalation_lines(report):
|
|
263
|
+
print(f"[launch_bugx] {line}")
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def emit_self_heal_evidence() -> None:
|
|
267
|
+
"""阻断时向人展示本轮已试过的自愈方案与失败原因(穷尽后上报)。"""
|
|
268
|
+
report = _LAST_SELF_HEAL_REPORT
|
|
269
|
+
if report is None or not report.attempts:
|
|
270
|
+
return
|
|
271
|
+
print(" 已尝试的自愈方案(穷尽后上报):")
|
|
272
|
+
for line in self_heal.escalation_lines(report):
|
|
273
|
+
print(f" {line}")
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def preflight_probe_id(item: dict) -> str:
|
|
277
|
+
raw = str(item.get("name", "")).strip().casefold().split("/", 1)[0]
|
|
278
|
+
normalized = raw.replace("_", "-")
|
|
279
|
+
return "codebase-memory" if normalized == "codebase-memory-mcp" else normalized
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def auto_provision_accelerators(
|
|
283
|
+
root: Path,
|
|
284
|
+
degraded: list[dict],
|
|
285
|
+
*,
|
|
286
|
+
required_tools: set[str] | None = None,
|
|
287
|
+
) -> tuple[list[dict], list[str]]:
|
|
288
|
+
"""尝试自动装配/就绪缺失的环境加速器(DOC-155 满血自治就绪)。
|
|
289
|
+
|
|
290
|
+
针对未建立索引的 codebase-memory-mcp 等本地已安装工具,在自治启动前
|
|
291
|
+
自动触发就绪命令,而不是消极降级关闭。返回 (未能自动补齐的剩余降级项, 已成功就绪说明列表)。
|
|
292
|
+
"""
|
|
293
|
+
if os.environ.get("BUGX_AUTO_PROVISION", "1").strip() in ("0", "false", "no"):
|
|
294
|
+
return degraded, []
|
|
295
|
+
|
|
296
|
+
remaining: list[dict] = []
|
|
297
|
+
provisioned: list[str] = []
|
|
298
|
+
|
|
299
|
+
selected_tools = {
|
|
300
|
+
"codebase-memory" if str(value).strip().casefold().replace("_", "-")
|
|
301
|
+
== "codebase-memory-mcp" else str(value).strip().casefold().replace("_", "-")
|
|
302
|
+
for value in (required_tools or set())
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
for item in degraded:
|
|
306
|
+
name = str(item.get("name", "")).strip().casefold()
|
|
307
|
+
detail = str(item.get("detail", ""))
|
|
308
|
+
probe_id = _preflight_probe_id(item)
|
|
309
|
+
if required_tools is not None and probe_id not in selected_tools \
|
|
310
|
+
and "supervisor" not in probe_id:
|
|
311
|
+
remaining.append(item)
|
|
312
|
+
continue
|
|
313
|
+
|
|
314
|
+
# 1. codebase-memory-mcp 自动安装与自动建索引
|
|
315
|
+
if probe_id == "codebase-memory":
|
|
316
|
+
try:
|
|
317
|
+
from core.probes import codebase_memory_probe
|
|
318
|
+
|
|
319
|
+
probe_report = codebase_memory_probe.inspect(root)
|
|
320
|
+
failed_checks = [
|
|
321
|
+
check for check in probe_report.get("checks", [])
|
|
322
|
+
if isinstance(check, dict) and check.get("ok") is False
|
|
323
|
+
] if isinstance(probe_report, dict) else []
|
|
324
|
+
runtime_mismatch = any(
|
|
325
|
+
check.get("name") in {"binary", "validated_version", "supported_version"}
|
|
326
|
+
for check in failed_checks
|
|
327
|
+
)
|
|
328
|
+
if isinstance(probe_report, dict) and probe_report.get("status") == "READY":
|
|
329
|
+
msg = f"✓ {item.get('name')} 已由统一探针复核就绪"
|
|
330
|
+
print(f"[launch_bugx] {msg}")
|
|
331
|
+
provisioned.append(msg)
|
|
332
|
+
os.environ["BUGX_USE_CODEBASE_MEMORY"] = "1"
|
|
333
|
+
continue
|
|
334
|
+
|
|
335
|
+
if runtime_mismatch:
|
|
336
|
+
print(
|
|
337
|
+
f"[launch_bugx] {item.get('name')} 缺少固定版本,"
|
|
338
|
+
"启动隔离安装自愈并按固定版本复核..."
|
|
339
|
+
)
|
|
340
|
+
healed, heal_report = self_heal.heal_tool(
|
|
341
|
+
"codebase-memory", detail=detail, root=root,
|
|
342
|
+
)
|
|
343
|
+
if not healed:
|
|
344
|
+
_report_self_heal(heal_report)
|
|
345
|
+
else:
|
|
346
|
+
# Installation success is not accelerator readiness: run
|
|
347
|
+
# the full version and project-index probe again.
|
|
348
|
+
probe_report = codebase_memory_probe.inspect(root)
|
|
349
|
+
if isinstance(probe_report, dict) \
|
|
350
|
+
and probe_report.get("status") == "READY":
|
|
351
|
+
msg = f"✓ {item.get('name')} 自愈后由统一探针复核就绪"
|
|
352
|
+
print(f"[launch_bugx] {msg}")
|
|
353
|
+
provisioned.append(msg)
|
|
354
|
+
os.environ["BUGX_USE_CODEBASE_MEMORY"] = "1"
|
|
355
|
+
continue
|
|
356
|
+
failed_checks = [
|
|
357
|
+
check for check in probe_report.get("checks", [])
|
|
358
|
+
if isinstance(check, dict) and check.get("ok") is False
|
|
359
|
+
] if isinstance(probe_report, dict) else []
|
|
360
|
+
|
|
361
|
+
check_names = [str(check.get("name", "unknown")) for check in failed_checks]
|
|
362
|
+
if not runtime_mismatch:
|
|
363
|
+
check_names.extend(
|
|
364
|
+
str(check.get("name", "unknown"))
|
|
365
|
+
for check in probe_report.get("checks", [])
|
|
366
|
+
if isinstance(check, dict) and check.get("ok") is False
|
|
367
|
+
)
|
|
368
|
+
failed = ", ".join(list(dict.fromkeys(check_names))[:4]) or str(
|
|
369
|
+
probe_report.get("status", "invalid-report")
|
|
370
|
+
if isinstance(probe_report, dict) else "invalid-report"
|
|
371
|
+
)
|
|
372
|
+
print(
|
|
373
|
+
f"[launch_bugx] Codebase Memory 复核未 READY({failed}),保留降级选项"
|
|
374
|
+
)
|
|
375
|
+
except Exception as exc:
|
|
376
|
+
print(
|
|
377
|
+
"[launch_bugx] Codebase Memory 自愈/复核异常 "
|
|
378
|
+
f"({type(exc).__name__}),保留降级选项"
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
# 2. bugx-supervisor / 宿主 MCP 自动就地配置注入
|
|
382
|
+
if "supervisor" in probe_id or "bugx-supervisor" in probe_id:
|
|
383
|
+
try:
|
|
384
|
+
from bugx_cli.commands.plugin import write_host_mcp_config
|
|
385
|
+
from core.supervisor import supervisor_host
|
|
386
|
+
adapter = supervisor_host.detect_host(root)
|
|
387
|
+
if adapter and host_registry.host_mcp_writable(adapter.name):
|
|
388
|
+
print(f"[launch_bugx] 发现宿主 {adapter.name} 缺失 supervisor MCP 配置,正在就地自愈注入...")
|
|
389
|
+
st, _, _, _ = write_host_mcp_config(root, adapter.name)
|
|
390
|
+
if st in {"configured", "created", "updated", "unchanged"}:
|
|
391
|
+
msg = f"✓ 宿主 {adapter.name} supervisor MCP 配置已自动就地自愈注入"
|
|
392
|
+
print(f"[launch_bugx] {msg}")
|
|
393
|
+
provisioned.append(msg)
|
|
394
|
+
continue
|
|
395
|
+
except Exception as exc:
|
|
396
|
+
print(f"[launch_bugx] 自动注入 supervisor MCP 配置异常: {exc}")
|
|
397
|
+
|
|
398
|
+
# 3. 修复 SAST 工具只通过 self_heal 的固定 package spec 与复核器。
|
|
399
|
+
if probe_id in {"sast", "bandit", "semgrep"}:
|
|
400
|
+
try:
|
|
401
|
+
from core.runtime import project_profile
|
|
402
|
+
from core.probes import sast_probe
|
|
403
|
+
profile = project_profile.detect_project_profile(root)
|
|
404
|
+
languages = {str(lang).casefold() for lang in profile.get("languages", [])}
|
|
405
|
+
targets = list(PROBE_REPAIR_TARGETS.get(probe_id, ()))
|
|
406
|
+
if probe_id == "sast" and "python" not in languages:
|
|
407
|
+
targets = [tool for tool in targets if tool != "bandit"]
|
|
408
|
+
|
|
409
|
+
satisfied = False
|
|
410
|
+
for target in targets:
|
|
411
|
+
status = sast_probe.check_tool(target)
|
|
412
|
+
if status.get("ok"):
|
|
413
|
+
satisfied = True
|
|
414
|
+
if probe_id != "sast":
|
|
415
|
+
break
|
|
416
|
+
continue
|
|
417
|
+
healed, heal_report = self_heal.heal_tool(
|
|
418
|
+
target, detail=detail, root=root,
|
|
419
|
+
)
|
|
420
|
+
sast_probe.clear_tool_probe_cache()
|
|
421
|
+
status = sast_probe.check_tool(target)
|
|
422
|
+
if healed and status.get("ok"):
|
|
423
|
+
msg = (
|
|
424
|
+
f"✓ {target} 已由受信隔离配方安装并通过精确版本复核"
|
|
425
|
+
)
|
|
426
|
+
print(f"[launch_bugx] {msg}")
|
|
427
|
+
provisioned.append(msg)
|
|
428
|
+
satisfied = True
|
|
429
|
+
if probe_id != "sast":
|
|
430
|
+
break
|
|
431
|
+
else:
|
|
432
|
+
_report_self_heal(heal_report)
|
|
433
|
+
|
|
434
|
+
if probe_id == "sast" and not satisfied:
|
|
435
|
+
satisfied = sast_probe.inspect(root).get("status") == "READY"
|
|
436
|
+
if satisfied:
|
|
437
|
+
continue
|
|
438
|
+
except Exception as exc:
|
|
439
|
+
print(f"[launch_bugx] SAST 外部工具自愈/复核异常 ({type(exc).__name__})")
|
|
440
|
+
|
|
441
|
+
# 4. 效率探针仅对已登记的 ast-grep 加速器运行隔离自愈。
|
|
442
|
+
if probe_id in {"efficiency", "ast-grep"}:
|
|
443
|
+
from core.probes import efficiency_probe
|
|
444
|
+
status = efficiency_probe._command(("ast-grep", "sg"), "ast-grep")
|
|
445
|
+
if not status.get("ok"):
|
|
446
|
+
healed, heal_report = self_heal.heal_tool(
|
|
447
|
+
"ast-grep", detail=detail, root=root,
|
|
448
|
+
)
|
|
449
|
+
status = efficiency_probe._command(("ast-grep", "sg"), "ast-grep")
|
|
450
|
+
if healed and status.get("ok"):
|
|
451
|
+
provisioned.extend(heal_report.healed)
|
|
452
|
+
else:
|
|
453
|
+
_report_self_heal(heal_report)
|
|
454
|
+
if probe_id == "ast-grep" and status.get("ok"):
|
|
455
|
+
continue
|
|
456
|
+
if probe_id == "efficiency" and efficiency_probe.inspect(root).get("status") == "READY":
|
|
457
|
+
continue
|
|
458
|
+
|
|
459
|
+
remaining.append(item)
|
|
460
|
+
|
|
461
|
+
return remaining, provisioned
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def autonomous_degraded_choices(
|
|
465
|
+
degraded: list[dict],
|
|
466
|
+
) -> dict[str, _DegradedDecision]:
|
|
467
|
+
"""Classify every autonomous item before the shared gate.
|
|
468
|
+
|
|
469
|
+
Autonomous mode has no user to authorize a missing capability. A fallback
|
|
470
|
+
option in a probe's display text is therefore never sufficient; only an
|
|
471
|
+
explicit probe applicability result or a non-critical project exemption
|
|
472
|
+
may produce an allowed decision. Every other item receives an explicit
|
|
473
|
+
blocked decision so the caller must route the complete set through the
|
|
474
|
+
shared gate and cannot accidentally record part of it and continue.
|
|
475
|
+
"""
|
|
476
|
+
choices: dict[str, _DegradedDecision] = {}
|
|
477
|
+
exemptions = _tooling_exemptions()
|
|
478
|
+
for item in degraded:
|
|
479
|
+
name = str(item.get("name", "unknown"))
|
|
480
|
+
policy_decision = _degraded_decision_for_policy(item)
|
|
481
|
+
if policy_decision is not None:
|
|
482
|
+
# 形态不适用 / 建议性探针 / 瞬态超时:注册表机器结论已足够,
|
|
483
|
+
# 但决策与收据必须留痕(不得静默放行)。
|
|
484
|
+
choices[name] = policy_decision
|
|
485
|
+
continue
|
|
486
|
+
is_critical = _degraded_item_critical(item)
|
|
487
|
+
exempted = _degraded_exemption_hit(name, exemptions)
|
|
488
|
+
if exempted and not is_critical:
|
|
489
|
+
choices[name] = _degraded_decision(
|
|
490
|
+
_DEGRADED_EXEMPTED,
|
|
491
|
+
"显式豁免(config.json tooling_exemptions)",
|
|
492
|
+
{
|
|
493
|
+
"source": "project_config",
|
|
494
|
+
"name": name,
|
|
495
|
+
"status": _DEGRADED_EXEMPTED,
|
|
496
|
+
},
|
|
497
|
+
)
|
|
498
|
+
continue
|
|
499
|
+
# No fallback option, display text, or critical exemption is enough
|
|
500
|
+
# to let autonomous startup proceed; classify it for the shared gate.
|
|
501
|
+
if is_critical and exempted:
|
|
502
|
+
print(f"[launch_bugx] ✗ critical MCP/工具 {name} 不得豁免,自治启动阻断")
|
|
503
|
+
reason = "critical_capability_cannot_be_exempted"
|
|
504
|
+
else:
|
|
505
|
+
reason = "autonomous_decision_required"
|
|
506
|
+
choices[name] = _degraded_decision(
|
|
507
|
+
_DEGRADED_BLOCKED,
|
|
508
|
+
"阻断:自治模式未取得真实自愈/非适用/豁免结论",
|
|
509
|
+
{
|
|
510
|
+
"source": "autonomous_classification",
|
|
511
|
+
"name": name,
|
|
512
|
+
"attempted": False,
|
|
513
|
+
"reason": reason,
|
|
514
|
+
},
|
|
515
|
+
)
|
|
516
|
+
return choices
|
|
517
|
+
|
|
518
|
+
def watchlist_error_report(exc: Exception) -> dict[str, Any]:
|
|
519
|
+
"""Return and report a sanitized Watchlist failure without hiding its state."""
|
|
520
|
+
error_type = type(exc).__name__
|
|
521
|
+
if not error_type.isascii() or not error_type.isidentifier() or len(error_type) > 64:
|
|
522
|
+
error_type = "Exception"
|
|
523
|
+
print(
|
|
524
|
+
"⚠ [BugX 回归看护] 巡查不可用 "
|
|
525
|
+
f"(status=ERROR, error_type={error_type});可检查账本后运行 "
|
|
526
|
+
"fix_watchlist.py check --root <项目根> --json。"
|
|
527
|
+
)
|
|
528
|
+
return {
|
|
529
|
+
"status": "ERROR",
|
|
530
|
+
"possible_regressions": 0,
|
|
531
|
+
"inconclusive": 0,
|
|
532
|
+
"error_type": error_type,
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
def safe_watchlist_incident_id(value: object) -> str:
|
|
537
|
+
text = str(value or "")
|
|
538
|
+
if (
|
|
539
|
+
len(text) == 14 and text.startswith("I-")
|
|
540
|
+
and all(char in "0123456789abcdef" for char in text[2:])
|
|
541
|
+
):
|
|
542
|
+
return text
|
|
543
|
+
return "invalid-id"
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def check_fix_regressions(root: Path | None = None) -> dict:
|
|
547
|
+
"""巡查近期已修复代码片段,并显式报告回归、不可判定和巡查错误。"""
|
|
548
|
+
try:
|
|
549
|
+
proj_root = (root or resolve_project_root()).resolve()
|
|
550
|
+
ledger_file = proj_root / ".bugx" / "knowledge" / "lesson-ledger.json"
|
|
551
|
+
if not ledger_file.is_file():
|
|
552
|
+
return {"status": "NO_LEDGER", "possible_regressions": 0, "inconclusive": 0}
|
|
553
|
+
|
|
554
|
+
from core.repair import fix_watchlist
|
|
555
|
+
report = fix_watchlist.check(ledger_file, proj_root, limit=20)
|
|
556
|
+
if not isinstance(report, dict):
|
|
557
|
+
raise TypeError("Watchlist report must be an object")
|
|
558
|
+
report = dict(report)
|
|
559
|
+
report["status"] = "COMPLETED"
|
|
560
|
+
possible = report.get("possible_regressions", 0)
|
|
561
|
+
inconclusive = report.get("inconclusive", 0)
|
|
562
|
+
possible = possible if isinstance(possible, int) and not isinstance(possible, bool) else 0
|
|
563
|
+
inconclusive = (
|
|
564
|
+
inconclusive
|
|
565
|
+
if isinstance(inconclusive, int) and not isinstance(inconclusive, bool)
|
|
566
|
+
else 0
|
|
567
|
+
)
|
|
568
|
+
if possible > 0 or inconclusive > 0:
|
|
569
|
+
print(
|
|
570
|
+
"[BugX 回归看护] 巡查完成:"
|
|
571
|
+
f"incidents={report.get('incidents_watched', 0)},"
|
|
572
|
+
f"intact={report.get('intact', 0)},"
|
|
573
|
+
f"possible-regression={possible},inconclusive={inconclusive}。"
|
|
574
|
+
)
|
|
575
|
+
for entry in report.get("entries", []):
|
|
576
|
+
if not isinstance(entry, dict):
|
|
577
|
+
continue
|
|
578
|
+
status = entry.get("status")
|
|
579
|
+
if status not in {"possible-regression", "inconclusive", "skipped"}:
|
|
580
|
+
continue
|
|
581
|
+
incident_id = _safe_watchlist_incident_id(entry.get("incident_id"))
|
|
582
|
+
reason_code = entry.get("reason_code")
|
|
583
|
+
if not isinstance(reason_code, str) or not reason_code.isascii() \
|
|
584
|
+
or not reason_code.replace("_", "").isalnum():
|
|
585
|
+
reason_code = "none"
|
|
586
|
+
print(
|
|
587
|
+
f" • Incident {incident_id}: {status}, "
|
|
588
|
+
f"reason_code={reason_code}"
|
|
589
|
+
)
|
|
590
|
+
if possible > 0:
|
|
591
|
+
print(" → possible-regression 是片段级 advisory,需按 Incident 核验;不会自动阻断 post。")
|
|
592
|
+
if inconclusive > 0:
|
|
593
|
+
print(" → inconclusive 表示证据不足;先处理原因码,再重新巡查。")
|
|
594
|
+
return report
|
|
595
|
+
except Exception as exc:
|
|
596
|
+
return _watchlist_error_report(exc)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def report_degraded_probes(*, refresh: bool = False,
|
|
600
|
+
degraded: list[dict] | None = None) -> list[dict]:
|
|
601
|
+
"""收集并显式汇报探针 DEGRADED 项;返回降级动作清单供写入准备记录。
|
|
602
|
+
|
|
603
|
+
``degraded`` 允许由 :func:`run_preflight_probes` 预计算后传入,这样同一
|
|
604
|
+
次 ``pre()`` 只需执行一轮探针(PERF-09/DES-13),不会重复扇出子进程。
|
|
605
|
+
"""
|
|
606
|
+
if degraded is None:
|
|
607
|
+
from core.probes import probe_registry
|
|
608
|
+
profile = probe_registry.run_preflight_probes(
|
|
609
|
+
resolve_project_root(), parallel=True, refresh=refresh,
|
|
610
|
+
)
|
|
611
|
+
degraded = list(profile.get("degraded_actions", []))
|
|
612
|
+
|
|
613
|
+
# 同步环境变量
|
|
614
|
+
_sync_codebase_memory_env(profile)
|
|
615
|
+
|
|
616
|
+
# 启动前主动触发修复代码看护巡查
|
|
617
|
+
check_fix_regressions(resolve_project_root())
|
|
618
|
+
|
|
619
|
+
if not degraded:
|
|
620
|
+
return []
|
|
621
|
+
print()
|
|
622
|
+
print("⚠ 环境加速器降级告警(启动前必须取得用户处置决定)")
|
|
623
|
+
for item in degraded:
|
|
624
|
+
print(f" ✗ {item['name']}: {item['detail']}")
|
|
625
|
+
for option in item.get("options", []):
|
|
626
|
+
print(f" · {option}")
|
|
627
|
+
print(" → 发现 MCP 未安装/未配置时,下一步立即弹出交互选择;无终端时停止启动,"
|
|
628
|
+
"不会静默进入后续审计。")
|
|
629
|
+
print()
|
|
630
|
+
return degraded
|
|
631
|
+
|
|
632
|
+
def record_degraded_choices(
|
|
633
|
+
degraded: list[dict], choices: Mapping[str, object],
|
|
634
|
+
) -> None:
|
|
635
|
+
"""把降级项与用户选择追加写入准备记录(存在才写,不代用户创建)。
|
|
636
|
+
|
|
637
|
+
**DOC-004 Engine-State Separation**:运行时记录**绝不**写进引擎目录。
|
|
638
|
+
实测污染:旧实现回落到 ``AGENT_DIR / "prep-record.md"``,导致运行/测试把
|
|
639
|
+
"环境加速器降级处置" 段追加进引擎自带的协议资产(``core/prep-record.md``)。
|
|
640
|
+
现在只写项目态记录;解析失败或目标落在引擎目录内 ⇒ 直接跳过(不创建、不改写)。
|
|
641
|
+
"""
|
|
642
|
+
if not degraded:
|
|
643
|
+
return
|
|
644
|
+
try:
|
|
645
|
+
record = bugx_paths.require(resolve_project_root()).prep_record
|
|
646
|
+
except (OSError, ValueError, RuntimeError):
|
|
647
|
+
# 项目布局缺失/不安全(LayoutError 继承 RuntimeError)⇒ 不写、不创建。
|
|
648
|
+
return
|
|
649
|
+
try:
|
|
650
|
+
record.resolve().relative_to(AGENT_DIR.resolve())
|
|
651
|
+
except ValueError:
|
|
652
|
+
pass
|
|
653
|
+
else:
|
|
654
|
+
print("[pre] 跳过降级记录写入:目标位于引擎目录(Engine-State Separation)")
|
|
655
|
+
return
|
|
656
|
+
if not record.is_file():
|
|
657
|
+
return
|
|
658
|
+
heading = "## 环境加速器降级处置(pre 自动记录)"
|
|
659
|
+
lines = [heading]
|
|
660
|
+
for item in degraded:
|
|
661
|
+
choice = choices.get(item["name"], "未选择")
|
|
662
|
+
if isinstance(choice, _DegradedDecision):
|
|
663
|
+
receipt = json.dumps(
|
|
664
|
+
choice.receipt, ensure_ascii=False, sort_keys=True, default=str,
|
|
665
|
+
)
|
|
666
|
+
rendered = f"{choice} [status={choice.status}; receipt={receipt}]"
|
|
667
|
+
else:
|
|
668
|
+
rendered = str(choice)
|
|
669
|
+
lines.append(f"- {item['name']}: {item['detail']} → 用户选择:{rendered}")
|
|
670
|
+
try:
|
|
671
|
+
existing = record.read_text(encoding="utf-8")
|
|
672
|
+
block = "\n".join(lines)
|
|
673
|
+
if heading in existing:
|
|
674
|
+
start = existing.index(heading)
|
|
675
|
+
end = existing.find("\n## ", start + len(heading))
|
|
676
|
+
if end < 0:
|
|
677
|
+
end = len(existing)
|
|
678
|
+
existing = existing[:start].rstrip() + "\n\n" + block + existing[end:]
|
|
679
|
+
else:
|
|
680
|
+
existing = existing.rstrip() + "\n\n" + block + "\n"
|
|
681
|
+
record.write_text(existing, encoding="utf-8")
|
|
682
|
+
except OSError:
|
|
683
|
+
pass
|
|
684
|
+
|
|
685
|
+
def degraded_install(item: dict) -> _DegradedDecision:
|
|
686
|
+
"""Attempt one bounded provisioning action and fail closed on uncertainty.
|
|
687
|
+
|
|
688
|
+
A missing unified installer, a failed installer, or an unverified result is
|
|
689
|
+
a blocked decision. The returned receipt carries the actual attempt and
|
|
690
|
+
any self-heal report; it is never converted into a fallback success.
|
|
691
|
+
"""
|
|
692
|
+
global _LAST_SELF_HEAL_REPORT
|
|
693
|
+
previous_report = _LAST_SELF_HEAL_REPORT
|
|
694
|
+
name = str(item.get("name", "未命名工具"))
|
|
695
|
+
receipt: dict[str, Any] = {
|
|
696
|
+
"action": "auto_provision_accelerators",
|
|
697
|
+
"name": name,
|
|
698
|
+
"attempted": True,
|
|
699
|
+
"provisioned": [],
|
|
700
|
+
"remaining": [name],
|
|
701
|
+
}
|
|
702
|
+
try:
|
|
703
|
+
remaining, provisioned = _auto_provision_accelerators(resolve_project_root(), [item])
|
|
704
|
+
receipt["provisioned"] = list(provisioned)
|
|
705
|
+
receipt["remaining"] = [
|
|
706
|
+
str(entry.get("name", "unknown"))
|
|
707
|
+
for entry in remaining
|
|
708
|
+
if isinstance(entry, Mapping)
|
|
709
|
+
]
|
|
710
|
+
current_report = _LAST_SELF_HEAL_REPORT
|
|
711
|
+
if provisioned and not remaining:
|
|
712
|
+
return _degraded_decision(
|
|
713
|
+
_DEGRADED_HEALED,
|
|
714
|
+
"✓ 自动就地自愈安装就绪",
|
|
715
|
+
receipt,
|
|
716
|
+
)
|
|
717
|
+
if current_report is not None and current_report is not previous_report:
|
|
718
|
+
receipt["self_heal"] = _degraded_receipt_for_report(current_report)
|
|
719
|
+
except Exception as exc:
|
|
720
|
+
receipt["exception"] = f"{type(exc).__name__}: {exc}"
|
|
721
|
+
print(f" [launch_bugx] 自动装配尝试异常: {exc}")
|
|
722
|
+
|
|
723
|
+
print(
|
|
724
|
+
f" [launch_bugx] ✗ 工具 {name} 未完成自动装配;本轮启动阻断,"
|
|
725
|
+
"请完成配置后重试。"
|
|
726
|
+
)
|
|
727
|
+
return _degraded_decision(
|
|
728
|
+
_DEGRADED_BLOCKED,
|
|
729
|
+
"阻断:自动装配未完成(真实尝试收据已记录)",
|
|
730
|
+
receipt,
|
|
731
|
+
)
|
|
732
|
+
|
|
733
|
+
def prompt_degraded_choices(
|
|
734
|
+
degraded: list[dict],
|
|
735
|
+
explicit_choices: dict[str, str] | None = None,
|
|
736
|
+
) -> dict[str, _DegradedDecision]:
|
|
737
|
+
"""Ask for a bounded action; skip/defer always remains blocked."""
|
|
738
|
+
choices: dict[str, _DegradedDecision] = {}
|
|
739
|
+
if not degraded:
|
|
740
|
+
return choices
|
|
741
|
+
|
|
742
|
+
combined_explicit: dict[str, str] = dict(explicit_choices or {})
|
|
743
|
+
# [BEGIN DEV_ONLY: FAST_VERIFICATION_TOOLING]
|
|
744
|
+
from core.runtime.interaction import try_get_preset_runtime_config
|
|
745
|
+
if try_get_preset_runtime_config is not None:
|
|
746
|
+
preset_cfg = try_get_preset_runtime_config(resolve_project_root() if uses_project_layout() else None)
|
|
747
|
+
if preset_cfg.get("auto_install_tools") or preset_cfg.get("missing_tools_action") == "install":
|
|
748
|
+
for item in degraded:
|
|
749
|
+
name = str(item.get("name", "unknown"))
|
|
750
|
+
if name not in combined_explicit:
|
|
751
|
+
combined_explicit[name] = "install"
|
|
752
|
+
elif preset_cfg.get("missing_tools_action") in {"skip", "fallback"}:
|
|
753
|
+
for item in degraded:
|
|
754
|
+
name = str(item.get("name", "unknown"))
|
|
755
|
+
if name not in combined_explicit:
|
|
756
|
+
combined_explicit[name] = "defer"
|
|
757
|
+
# [END DEV_ONLY: FAST_VERIFICATION_TOOLING]
|
|
758
|
+
env_choices = os.environ.get("BUGX_TOOLING_CHOICES", "")
|
|
759
|
+
if env_choices:
|
|
760
|
+
for part in env_choices.split(","):
|
|
761
|
+
if "=" in part:
|
|
762
|
+
k, v = part.split("=", 1)
|
|
763
|
+
if k.strip() not in combined_explicit:
|
|
764
|
+
combined_explicit[k.strip()] = v.strip()
|
|
765
|
+
|
|
766
|
+
# A non-interactive host cannot silently authorize a missing capability.
|
|
767
|
+
# It receives a durable blocked decision instead of an implicit fallback.
|
|
768
|
+
is_interactive = False
|
|
769
|
+
try:
|
|
770
|
+
is_interactive = bool(sys.stdin.isatty())
|
|
771
|
+
except (OSError, AttributeError):
|
|
772
|
+
pass
|
|
773
|
+
|
|
774
|
+
exemptions = _tooling_exemptions()
|
|
775
|
+
|
|
776
|
+
pending: list[dict] = []
|
|
777
|
+
for item in degraded:
|
|
778
|
+
name = str(item.get("name", "unknown"))
|
|
779
|
+
detail = str(item.get("detail", ""))
|
|
780
|
+
is_mcp = item.get("kind") == "mcp" or "mcp" in name.casefold()
|
|
781
|
+
|
|
782
|
+
# DOC-236 C1:项目 ``config.json`` 的显式豁免是唯一放行通道,且必须与
|
|
783
|
+
# 自治路径同源生效。非 critical 能力被显式豁免 ⇒ 留痕放行,
|
|
784
|
+
# 不再落进「非交互环境未取得决策」的阻断分支。
|
|
785
|
+
if _degraded_exemption_hit(name, exemptions) and not _degraded_item_critical(item):
|
|
786
|
+
choices[name] = _degraded_decision(
|
|
787
|
+
_DEGRADED_EXEMPTED,
|
|
788
|
+
"显式豁免(config.json tooling_exemptions)",
|
|
789
|
+
{
|
|
790
|
+
"source": "project_config",
|
|
791
|
+
"name": name,
|
|
792
|
+
"status": _DEGRADED_EXEMPTED,
|
|
793
|
+
"probe": item.get("probe", ""),
|
|
794
|
+
},
|
|
795
|
+
)
|
|
796
|
+
continue
|
|
797
|
+
|
|
798
|
+
if _degraded_item_not_applicable(item):
|
|
799
|
+
choices[name] = _degraded_decision(
|
|
800
|
+
_DEGRADED_NOT_APPLICABLE,
|
|
801
|
+
f"不适用:{detail or '探针已按项目形态剪枝'}",
|
|
802
|
+
{
|
|
803
|
+
"source": "probe_applicability",
|
|
804
|
+
"name": name,
|
|
805
|
+
"status": _DEGRADED_NOT_APPLICABLE,
|
|
806
|
+
},
|
|
807
|
+
)
|
|
808
|
+
continue
|
|
809
|
+
|
|
810
|
+
# 建议性探针 / 瞬态超时:注册表已机器判定这两种情形不构成启动阻断。
|
|
811
|
+
# 它们仍然留痕(决策 + 收据 + 控制台告警),不是静默降级。
|
|
812
|
+
if _degraded_item_advisory(item):
|
|
813
|
+
choices[name] = _degraded_decision(
|
|
814
|
+
_DEGRADED_NOT_APPLICABLE,
|
|
815
|
+
f"不阻断:建议性探针未就绪({detail or '无详情'})",
|
|
816
|
+
{
|
|
817
|
+
"source": "probe_advisory",
|
|
818
|
+
"name": name,
|
|
819
|
+
"status": _DEGRADED_NOT_APPLICABLE,
|
|
820
|
+
"probe": item.get("probe", ""),
|
|
821
|
+
},
|
|
822
|
+
)
|
|
823
|
+
print(
|
|
824
|
+
f"[launch_bugx] ⚠ 建议性探针 {name} 未就绪,按注册表策略不阻断启动(已记录)"
|
|
825
|
+
)
|
|
826
|
+
continue
|
|
827
|
+
if _degraded_item_transient(item) and not _degraded_item_critical(item):
|
|
828
|
+
choices[name] = _degraded_decision(
|
|
829
|
+
_DEGRADED_TRANSIENT,
|
|
830
|
+
f"瞬态降级:本次探测超时({detail or '无详情'})",
|
|
831
|
+
{
|
|
832
|
+
"source": "probe_transient",
|
|
833
|
+
"name": name,
|
|
834
|
+
"status": _DEGRADED_TRANSIENT,
|
|
835
|
+
"probe": item.get("probe", ""),
|
|
836
|
+
},
|
|
837
|
+
)
|
|
838
|
+
print(
|
|
839
|
+
f"[launch_bugx] ⚠ {name} 本次探测超时(非未安装),"
|
|
840
|
+
"按瞬态降级继续,本轮走内置回退(已记录)"
|
|
841
|
+
)
|
|
842
|
+
continue
|
|
843
|
+
|
|
844
|
+
# 非交互环境且未显式指定选择时,明确阻断而不是自动采纳回退
|
|
845
|
+
if not is_interactive and name not in combined_explicit and not any(k.casefold() == name.casefold() for k in combined_explicit):
|
|
846
|
+
choices[name] = _degraded_decision(
|
|
847
|
+
_DEGRADED_BLOCKED,
|
|
848
|
+
"阻断:非交互环境未取得安装/配置决策",
|
|
849
|
+
{
|
|
850
|
+
"source": "noninteractive",
|
|
851
|
+
"name": name,
|
|
852
|
+
"attempted": False,
|
|
853
|
+
"reason": "decision_required",
|
|
854
|
+
},
|
|
855
|
+
)
|
|
856
|
+
print(f"[launch_bugx] ✗ 非交互环境未取得加速器 {name} 的安装/配置决策,启动阻断")
|
|
857
|
+
continue
|
|
858
|
+
|
|
859
|
+
explicit_action = None
|
|
860
|
+
for k, v in combined_explicit.items():
|
|
861
|
+
if k.casefold() == name.casefold():
|
|
862
|
+
explicit_action = v.strip().lower()
|
|
863
|
+
break
|
|
864
|
+
if explicit_action is not None:
|
|
865
|
+
if explicit_action in {"skip", "fallback", "2"}:
|
|
866
|
+
choices[name] = _degraded_decision(
|
|
867
|
+
_DEGRADED_BLOCKED,
|
|
868
|
+
"阻断:跳过/回退不会放行本轮启动",
|
|
869
|
+
{
|
|
870
|
+
"source": "explicit_choice",
|
|
871
|
+
"name": name,
|
|
872
|
+
"attempted": False,
|
|
873
|
+
"reason": "fallback_not_authorized",
|
|
874
|
+
},
|
|
875
|
+
)
|
|
876
|
+
elif explicit_action in {"defer", "later", "next", "3"}:
|
|
877
|
+
choices[name] = _degraded_decision(
|
|
878
|
+
_DEGRADED_DEFERRED,
|
|
879
|
+
"下次再说(停止本轮启动)",
|
|
880
|
+
{
|
|
881
|
+
"source": "explicit_choice",
|
|
882
|
+
"name": name,
|
|
883
|
+
"attempted": False,
|
|
884
|
+
"reason": "deferred_by_user",
|
|
885
|
+
},
|
|
886
|
+
)
|
|
887
|
+
elif explicit_action in {"install", "config", "1"}:
|
|
888
|
+
choices[name] = _degraded_install(item)
|
|
889
|
+
else:
|
|
890
|
+
choices[name] = _degraded_decision(
|
|
891
|
+
_DEGRADED_BLOCKED,
|
|
892
|
+
f"阻断:未知降级处置 {explicit_action}",
|
|
893
|
+
{
|
|
894
|
+
"source": "explicit_choice",
|
|
895
|
+
"name": name,
|
|
896
|
+
"attempted": False,
|
|
897
|
+
"reason": "unknown_choice",
|
|
898
|
+
},
|
|
899
|
+
)
|
|
900
|
+
continue
|
|
901
|
+
|
|
902
|
+
pending.append(item)
|
|
903
|
+
|
|
904
|
+
if not pending:
|
|
905
|
+
return choices
|
|
906
|
+
|
|
907
|
+
if len(pending) > 1:
|
|
908
|
+
# 同名多实例合并:同一探针名可能产出多条降级项(如 web_conformance
|
|
909
|
+
# 的 5 个实例),若逐条出选项会出现完全同名同描述、用户无法区分的
|
|
910
|
+
# 重复项。按名称去重成组,单条选项代表该名称的全部实例,并标注计数。
|
|
911
|
+
groups: dict[str, list[dict]] = {}
|
|
912
|
+
for item in pending:
|
|
913
|
+
groups.setdefault(str(item.get("name", "unknown")), []).append(item)
|
|
914
|
+
options = []
|
|
915
|
+
for group_name, instances in groups.items():
|
|
916
|
+
label = (
|
|
917
|
+
group_name if len(instances) == 1
|
|
918
|
+
else f"{group_name}({len(instances)} 个探针实例)"
|
|
919
|
+
)
|
|
920
|
+
is_auto = any(
|
|
921
|
+
any(k in str(item.get("name", "")).casefold() for k in ("codebase-memory", "supervisor", "sast", "bandit", "semgrep", "ast-grep"))
|
|
922
|
+
for item in instances
|
|
923
|
+
)
|
|
924
|
+
tag = "[支持自动装配]" if is_auto else "[无自动安装器,选择将启用内置回退]"
|
|
925
|
+
details: list[str] = []
|
|
926
|
+
for item in instances:
|
|
927
|
+
detail = str(item.get("detail") or "").strip()
|
|
928
|
+
if detail and detail not in details:
|
|
929
|
+
details.append(detail)
|
|
930
|
+
desc = ";".join(details) if details else "本轮选择安装/配置该工具"
|
|
931
|
+
options.append((
|
|
932
|
+
label,
|
|
933
|
+
f"{tag} {desc}",
|
|
934
|
+
))
|
|
935
|
+
result = ask_interaction(
|
|
936
|
+
"tooling:batch",
|
|
937
|
+
"请勾选本轮要安装/配置的工具(留空表示全部阻断本轮启动;"
|
|
938
|
+
"同名多个探针实例已合并为一条,勾选即对该名称的全部实例生效)。"
|
|
939
|
+
"也可不经交互:设置环境变量 BUGX_TOOLING_CHOICES=name=install|defer",
|
|
940
|
+
options,
|
|
941
|
+
phase="tooling", detail="未勾选的工具本轮阻断启动",
|
|
942
|
+
default=0, multiple=True, emit_request=True,
|
|
943
|
+
)
|
|
944
|
+
values = answered_values(result)
|
|
945
|
+
if values is None:
|
|
946
|
+
return choices
|
|
947
|
+
selected = set(values)
|
|
948
|
+
for index, (group_name, instances) in enumerate(groups.items(), 1):
|
|
949
|
+
chosen = (
|
|
950
|
+
_degraded_install(instances[0]) if str(index) in selected
|
|
951
|
+
else _degraded_decision(
|
|
952
|
+
_DEGRADED_BLOCKED,
|
|
953
|
+
"阻断:批量未勾选,不会启用回退方案",
|
|
954
|
+
{
|
|
955
|
+
"source": "batch_selection",
|
|
956
|
+
"name": group_name,
|
|
957
|
+
"attempted": False,
|
|
958
|
+
"reason": "not_selected",
|
|
959
|
+
},
|
|
960
|
+
)
|
|
961
|
+
)
|
|
962
|
+
choices[group_name] = chosen
|
|
963
|
+
return choices
|
|
964
|
+
|
|
965
|
+
for item in pending:
|
|
966
|
+
name = str(item.get("name", "unknown"))
|
|
967
|
+
detail = str(item.get("detail", ""))
|
|
968
|
+
is_mcp = item.get("kind") == "mcp" or "mcp" in name.casefold()
|
|
969
|
+
|
|
970
|
+
options = [
|
|
971
|
+
("立即安装/配置", "完成该工具配置后重新探测"),
|
|
972
|
+
("停止本轮启动", "未完成配置不得以回退方案放行"),
|
|
973
|
+
]
|
|
974
|
+
if is_mcp:
|
|
975
|
+
options.append(("下次再说", "停止本轮启动,稍后重新处理该 MCP"))
|
|
976
|
+
result = ask_interaction(
|
|
977
|
+
f"tooling:{name}", f"工具 {name} 未就绪,选择本轮处置方式", options,
|
|
978
|
+
phase="tooling", detail=detail, default=0, emit_request=True,
|
|
979
|
+
)
|
|
980
|
+
value = answered_value(result)
|
|
981
|
+
if value is None:
|
|
982
|
+
return choices
|
|
983
|
+
if value == "2":
|
|
984
|
+
choices[name] = _degraded_decision(
|
|
985
|
+
_DEGRADED_DEFERRED,
|
|
986
|
+
"下次再说(停止本轮启动)",
|
|
987
|
+
{
|
|
988
|
+
"source": "interactive_choice",
|
|
989
|
+
"name": name,
|
|
990
|
+
"attempted": False,
|
|
991
|
+
"reason": "deferred_by_user",
|
|
992
|
+
},
|
|
993
|
+
)
|
|
994
|
+
elif value == "3" and is_mcp:
|
|
995
|
+
choices[name] = _degraded_decision(
|
|
996
|
+
_DEGRADED_DEFERRED,
|
|
997
|
+
"下次再说(停止本轮启动)",
|
|
998
|
+
{
|
|
999
|
+
"source": "interactive_choice",
|
|
1000
|
+
"name": name,
|
|
1001
|
+
"attempted": False,
|
|
1002
|
+
"reason": "deferred_by_user",
|
|
1003
|
+
},
|
|
1004
|
+
)
|
|
1005
|
+
elif value == "1":
|
|
1006
|
+
choices[name] = _degraded_install(item)
|
|
1007
|
+
else:
|
|
1008
|
+
return choices
|
|
1009
|
+
return choices
|
|
1010
|
+
|
|
1011
|
+
def tooling_exemptions() -> set[str]:
|
|
1012
|
+
"""DOC-236 C1:显式豁免通道(``config.json`` 的 ``tooling_exemptions``)。
|
|
1013
|
+
|
|
1014
|
+
取消"可选件自动回退放行"后,无安装器的专有工具会阻断启动;唯一放行方式是
|
|
1015
|
+
**项目配置里显式列出名称**(可审计、可追溯),而不是命令行开关或静默降级。
|
|
1016
|
+
读取失败/类型不符一律返回空集(fail-closed)。
|
|
1017
|
+
|
|
1018
|
+
注意:这里**只**要求 ``<root>/.bugx/config.json`` 这个普通文件本身可读,
|
|
1019
|
+
不再要求完整的 lifecycle 布局(``bugx_paths.require``)。否则在尚未
|
|
1020
|
+
``init`` 完整布局的工作区里,阻断提示让用户去写 ``tooling_exemptions``,
|
|
1021
|
+
而读取端却拒绝读同一份文件——形成无法自救的死锁。
|
|
1022
|
+
"""
|
|
1023
|
+
names: set[str] = set()
|
|
1024
|
+
try:
|
|
1025
|
+
cfg = _resolve_project_root() / ".bugx" / "config.json"
|
|
1026
|
+
if not cfg.is_file() or cfg.is_symlink() or cfg.stat().st_size > 64 * 1024:
|
|
1027
|
+
return names
|
|
1028
|
+
payload = json.loads(cfg.read_text(encoding="utf-8"))
|
|
1029
|
+
except (OSError, ValueError):
|
|
1030
|
+
return names
|
|
1031
|
+
raw = payload.get("tooling_exemptions") if isinstance(payload, dict) else None
|
|
1032
|
+
if isinstance(raw, list):
|
|
1033
|
+
names = {
|
|
1034
|
+
str(item).strip().casefold()
|
|
1035
|
+
for item in raw
|
|
1036
|
+
if isinstance(item, str) and str(item).strip()
|
|
1037
|
+
}
|
|
1038
|
+
return names
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
def degraded_gate(
|
|
1042
|
+
degraded: list[dict],
|
|
1043
|
+
explicit_choices: Mapping[str, object] | None = None,
|
|
1044
|
+
) -> bool:
|
|
1045
|
+
"""Require a machine-valid disposition for every degraded item.
|
|
1046
|
+
|
|
1047
|
+
Human-readable choice text is intentionally never parsed here. Values
|
|
1048
|
+
returned by older callers or test doubles are treated as blocked unless a
|
|
1049
|
+
non-critical item is explicitly exempted in project configuration.
|
|
1050
|
+
"""
|
|
1051
|
+
if not degraded:
|
|
1052
|
+
return True
|
|
1053
|
+
try:
|
|
1054
|
+
structured = bool(explicit_choices) and all(
|
|
1055
|
+
isinstance(value, _DegradedDecision)
|
|
1056
|
+
for value in explicit_choices.values()
|
|
1057
|
+
)
|
|
1058
|
+
if structured:
|
|
1059
|
+
choices: Mapping[str, object] = dict(explicit_choices)
|
|
1060
|
+
else:
|
|
1061
|
+
raw_choices = (
|
|
1062
|
+
{str(key): str(value) for key, value in explicit_choices.items()}
|
|
1063
|
+
if explicit_choices is not None else None
|
|
1064
|
+
)
|
|
1065
|
+
choices = _prompt_degraded_choices(degraded, explicit_choices=raw_choices)
|
|
1066
|
+
except Exception as exc: # noqa: BLE001
|
|
1067
|
+
print(f"启动前降级项询问失败,不能自动继续: {exc}")
|
|
1068
|
+
return False
|
|
1069
|
+
names = {str(item.get("name", "unknown")) for item in degraded}
|
|
1070
|
+
missing = sorted(names - set(choices))
|
|
1071
|
+
if missing:
|
|
1072
|
+
print("启动前仍有降级项未取得用户决策,不能自动继续: " + ", ".join(missing))
|
|
1073
|
+
_record_degraded_choices(degraded, choices)
|
|
1074
|
+
return False
|
|
1075
|
+
exemptions = _tooling_exemptions()
|
|
1076
|
+
normalized: dict[str, object] = dict(choices)
|
|
1077
|
+
real_blockers: list[str] = []
|
|
1078
|
+
deferred: list[str] = []
|
|
1079
|
+
for item in degraded:
|
|
1080
|
+
name = str(item.get("name", ""))
|
|
1081
|
+
choice = choices.get(name)
|
|
1082
|
+
is_typed_decision = (
|
|
1083
|
+
isinstance(choice, _DegradedDecision)
|
|
1084
|
+
and choice.status in {
|
|
1085
|
+
_DEGRADED_HEALED,
|
|
1086
|
+
_DEGRADED_NOT_APPLICABLE,
|
|
1087
|
+
_DEGRADED_EXEMPTED,
|
|
1088
|
+
_DEGRADED_BLOCKED,
|
|
1089
|
+
_DEGRADED_DEFERRED,
|
|
1090
|
+
_DEGRADED_TRANSIENT,
|
|
1091
|
+
}
|
|
1092
|
+
and isinstance(choice.receipt, dict)
|
|
1093
|
+
)
|
|
1094
|
+
status = choice.status if is_typed_decision else None
|
|
1095
|
+
is_critical = _degraded_item_critical(item)
|
|
1096
|
+
exempted = _degraded_exemption_hit(name, exemptions)
|
|
1097
|
+
if "codebase-memory" in name.casefold() and status != _DEGRADED_HEALED:
|
|
1098
|
+
# A degraded choice is never allowed to enable the bridge. The
|
|
1099
|
+
# successful probe path above is the only automatic enable path.
|
|
1100
|
+
os.environ["BUGX_USE_CODEBASE_MEMORY"] = "0"
|
|
1101
|
+
if status in _DEGRADED_PASSING_STATUSES:
|
|
1102
|
+
continue
|
|
1103
|
+
if exempted and not is_critical:
|
|
1104
|
+
# Explicit project policy is the only non-success release valve.
|
|
1105
|
+
print(
|
|
1106
|
+
f" ⚠ [launch_bugx] {name} 未完成,但已在 config.json "
|
|
1107
|
+
"tooling_exemptions 中显式豁免(已记录)"
|
|
1108
|
+
)
|
|
1109
|
+
receipt = choice.receipt if is_typed_decision else {}
|
|
1110
|
+
normalized[name] = _degraded_decision(
|
|
1111
|
+
_DEGRADED_EXEMPTED,
|
|
1112
|
+
"显式豁免(config.json tooling_exemptions)",
|
|
1113
|
+
{
|
|
1114
|
+
"source": "project_config",
|
|
1115
|
+
"name": name,
|
|
1116
|
+
"status": _DEGRADED_EXEMPTED,
|
|
1117
|
+
"original_status": status or "unstructured",
|
|
1118
|
+
"original_receipt": receipt,
|
|
1119
|
+
},
|
|
1120
|
+
)
|
|
1121
|
+
continue
|
|
1122
|
+
if is_critical and exempted:
|
|
1123
|
+
normalized[name] = _degraded_decision(
|
|
1124
|
+
_DEGRADED_BLOCKED,
|
|
1125
|
+
"阻断:critical MCP/工具不得豁免",
|
|
1126
|
+
{
|
|
1127
|
+
"source": "project_config",
|
|
1128
|
+
"name": name,
|
|
1129
|
+
"reason": "critical_capability_cannot_be_exempted",
|
|
1130
|
+
},
|
|
1131
|
+
)
|
|
1132
|
+
real_blockers.append(name)
|
|
1133
|
+
continue
|
|
1134
|
+
if status == _DEGRADED_DEFERRED:
|
|
1135
|
+
deferred.append(name)
|
|
1136
|
+
continue
|
|
1137
|
+
real_blockers.append(name)
|
|
1138
|
+
|
|
1139
|
+
# Persist the normalized final decision before returning either success or
|
|
1140
|
+
# failure, so explicit exemptions and real failed attempts cannot vanish
|
|
1141
|
+
# on a sibling blocker.
|
|
1142
|
+
_record_degraded_choices(degraded, normalized)
|
|
1143
|
+
if real_blockers:
|
|
1144
|
+
print("MCP/环境工具安装或配置尚未完成,本轮启动已停止:" + ", ".join(real_blockers))
|
|
1145
|
+
print(
|
|
1146
|
+
" DOC-236 C1:本轮不允许降级放行——请先自愈安装/配置后重跑;"
|
|
1147
|
+
"确无自动安装器的专有工具,可在项目 .bugx/config.json 的 "
|
|
1148
|
+
"tooling_exemptions 中显式列出(会留痕,不影响 critical 结论)。"
|
|
1149
|
+
)
|
|
1150
|
+
_emit_self_heal_evidence()
|
|
1151
|
+
return False
|
|
1152
|
+
if deferred:
|
|
1153
|
+
print("MCP/环境工具处置选择为“下次再说”,本轮启动已停止:"
|
|
1154
|
+
+ ", ".join(deferred))
|
|
1155
|
+
print(" 处理完成后重新运行启动流程,不会自动绕过该 MCP 决策。")
|
|
1156
|
+
return False
|
|
1157
|
+
return True
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
_degraded_actions = degraded_actions
|
|
1162
|
+
_DegradedDecision = DegradedDecision
|
|
1163
|
+
_degraded_decision = degraded_decision
|
|
1164
|
+
_degraded_item_not_applicable = degraded_item_not_applicable
|
|
1165
|
+
_degraded_item_advisory = degraded_item_advisory
|
|
1166
|
+
_degraded_item_transient = degraded_item_transient
|
|
1167
|
+
_degraded_item_critical = degraded_item_critical
|
|
1168
|
+
_degraded_exemption_hit = degraded_exemption_hit
|
|
1169
|
+
_degraded_decision_for_policy = degraded_decision_for_policy
|
|
1170
|
+
_degraded_receipt_for_report = degraded_receipt_for_report
|
|
1171
|
+
_report_self_heal = report_self_heal
|
|
1172
|
+
_emit_self_heal_evidence = emit_self_heal_evidence
|
|
1173
|
+
_preflight_probe_id = preflight_probe_id
|
|
1174
|
+
_watchlist_error_report = watchlist_error_report
|
|
1175
|
+
_safe_watchlist_incident_id = safe_watchlist_incident_id
|
|
1176
|
+
def _record_degraded_choices(*args, **kwargs):
|
|
1177
|
+
sb = _sb()
|
|
1178
|
+
if sb and hasattr(sb, "_record_degraded_choices"):
|
|
1179
|
+
fn = getattr(sb, "_record_degraded_choices")
|
|
1180
|
+
if fn is not _record_degraded_choices:
|
|
1181
|
+
return fn(*args, **kwargs)
|
|
1182
|
+
return record_degraded_choices(*args, **kwargs)
|
|
1183
|
+
def _auto_provision_accelerators(*args, **kwargs):
|
|
1184
|
+
sb = _sb()
|
|
1185
|
+
if sb and hasattr(sb, "auto_provision_accelerators"):
|
|
1186
|
+
fn = getattr(sb, "auto_provision_accelerators")
|
|
1187
|
+
if fn is not _auto_provision_accelerators and fn is not auto_provision_accelerators:
|
|
1188
|
+
return fn(*args, **kwargs)
|
|
1189
|
+
return auto_provision_accelerators(*args, **kwargs)
|
|
1190
|
+
|
|
1191
|
+
def _degraded_install(item):
|
|
1192
|
+
sb = _sb()
|
|
1193
|
+
if sb and hasattr(sb, "_degraded_install"):
|
|
1194
|
+
fn = getattr(sb, "_degraded_install")
|
|
1195
|
+
if fn is not _degraded_install:
|
|
1196
|
+
return fn(item)
|
|
1197
|
+
return degraded_install(item)
|
|
1198
|
+
def _prompt_degraded_choices(*args, **kwargs):
|
|
1199
|
+
sb = _sb()
|
|
1200
|
+
if sb and hasattr(sb, "_prompt_degraded_choices"):
|
|
1201
|
+
fn = getattr(sb, "_prompt_degraded_choices")
|
|
1202
|
+
if fn is not _prompt_degraded_choices:
|
|
1203
|
+
return fn(*args, **kwargs)
|
|
1204
|
+
return prompt_degraded_choices(*args, **kwargs)
|
|
1205
|
+
def _tooling_exemptions(*args, **kwargs):
|
|
1206
|
+
sb = _sb()
|
|
1207
|
+
if sb and hasattr(sb, "_tooling_exemptions"):
|
|
1208
|
+
fn = getattr(sb, "_tooling_exemptions")
|
|
1209
|
+
if fn is not _tooling_exemptions:
|
|
1210
|
+
return fn(*args, **kwargs)
|
|
1211
|
+
return tooling_exemptions(*args, **kwargs)
|