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,851 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""src/bugx_cli/infra/ai_advisor.py - AI 辅助意图理解、智能排障与确定性自愈协同引擎。
|
|
3
|
+
|
|
4
|
+
设计原则:
|
|
5
|
+
- AI 负责:理解非结构化报错、补充根因分析与语义模糊匹配;
|
|
6
|
+
- 程序负责:选择已实现的修复路径、原子操作执行、文件沙箱隔离与确定性验活门禁;
|
|
7
|
+
- 双轨协同:在线/宿主可用时唤起宿主 AI 动态推断,离线/受限环境平滑退守本地确定性专家基线。
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import difflib
|
|
13
|
+
import errno
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import re
|
|
17
|
+
import shutil
|
|
18
|
+
import subprocess
|
|
19
|
+
import sys
|
|
20
|
+
import time
|
|
21
|
+
from dataclasses import dataclass, field
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from typing import Any, Iterable, Mapping
|
|
24
|
+
|
|
25
|
+
from .. import __version__
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
COMMAND_CAPABILITIES: dict[str, dict[str, Any]] = {
|
|
29
|
+
"init": {
|
|
30
|
+
"description": "初始化项目 BugX 核心环境与运行态",
|
|
31
|
+
"keywords": ["初始化", "建仓", "开始", "创建", "setup", "start", "initialize", "new"],
|
|
32
|
+
},
|
|
33
|
+
"doctor": {
|
|
34
|
+
"description": "环境健康度诊断、依赖检测与一键自愈",
|
|
35
|
+
"keywords": ["体检", "健康", "诊断", "排查", "修复", "自愈", "检查", "环境", "check", "fix", "health", "doctor"],
|
|
36
|
+
},
|
|
37
|
+
"hosts": {
|
|
38
|
+
"description": "发现系统中已安装的可接入 AI 宿主 Agent",
|
|
39
|
+
"keywords": ["宿主", "智能体", "接入", "agent", "hosts", "discover"],
|
|
40
|
+
},
|
|
41
|
+
"install": {
|
|
42
|
+
"description": "安装 BugX MCP / Skill 至已发现的 AI 宿主",
|
|
43
|
+
"keywords": ["安装", "集成", "配置宿主", "install", "setup", "integrate"],
|
|
44
|
+
},
|
|
45
|
+
"uninstall": {
|
|
46
|
+
"description": "从指定 AI 宿主卸载 BugX 集成",
|
|
47
|
+
"keywords": ["卸载", "清理", "移除", "uninstall", "remove"],
|
|
48
|
+
},
|
|
49
|
+
"audit": {
|
|
50
|
+
"description": "项目级漏洞渗透挖掘与代码安全审计",
|
|
51
|
+
"keywords": ["审计", "漏洞", "扫描", "找洞", "安全", "渗透", "audit", "scan", "security", "vulnerability"],
|
|
52
|
+
},
|
|
53
|
+
"autonomous": {
|
|
54
|
+
"description": "启动全自动无人值守 BugX 漏洞挖掘",
|
|
55
|
+
"keywords": ["自主", "无人值守", "自动挖掘", "挂机", "探索", "autonomous", "mine", "auto"],
|
|
56
|
+
},
|
|
57
|
+
"project": {
|
|
58
|
+
"description": "项目元数据管理、画像展示与云端同步",
|
|
59
|
+
"keywords": ["项目", "元数据", "云同步", "project", "sync",
|
|
60
|
+
"画像", "分析", "覆盖度", "项目全景", "技术栈",
|
|
61
|
+
"analyze", "profile", "coverage"],
|
|
62
|
+
},
|
|
63
|
+
"patch-forge": {
|
|
64
|
+
"description": "生成或静态校验补丁包(不执行包内代码、不提交远端)",
|
|
65
|
+
"keywords": ["补丁", "补丁包", "修复代码", "修bug", "合成", "patch", "patch-forge", "repair-code"],
|
|
66
|
+
},
|
|
67
|
+
"skill": {
|
|
68
|
+
"description": "BugX 动态扩展 Skill 市场管理与挂载",
|
|
69
|
+
"keywords": ["技能", "插件", "skill", "plugins"],
|
|
70
|
+
},
|
|
71
|
+
"cloud": {
|
|
72
|
+
"description": "BugX 云端多设备协同、同步与设备认证",
|
|
73
|
+
"keywords": ["云端", "多设备", "同步", "协同", "cloud", "sync"],
|
|
74
|
+
},
|
|
75
|
+
"auth": {
|
|
76
|
+
"description": "云端登录、凭据管理与设备配对",
|
|
77
|
+
"keywords": ["登录", "认证", "token", "凭证", "auth", "login"],
|
|
78
|
+
},
|
|
79
|
+
"stats": {
|
|
80
|
+
"description": "代码漏洞挖掘统计指标与 ROI 分析",
|
|
81
|
+
"keywords": ["统计", "度量", "指标", "投入产出", "stats", "metrics"],
|
|
82
|
+
},
|
|
83
|
+
"report": {
|
|
84
|
+
"description": "本地 Web 控制台与审计报告预览",
|
|
85
|
+
"keywords": ["报告", "控制台", "预览", "看板", "report", "console", "dashboard", "web"],
|
|
86
|
+
},
|
|
87
|
+
"engine": {
|
|
88
|
+
"description": "全局引擎核心管理与状态查询",
|
|
89
|
+
"keywords": ["引擎", "核心", "版本", "engine", "core"],
|
|
90
|
+
},
|
|
91
|
+
"daemon": {
|
|
92
|
+
"description": "BugX 后台常驻守护进程管理",
|
|
93
|
+
"keywords": ["守护", "后台", "常驻", "daemon", "service"],
|
|
94
|
+
},
|
|
95
|
+
"reset": {
|
|
96
|
+
"description": "重置项目运行态或全局错题集缓存",
|
|
97
|
+
"keywords": ["重置", "清空", "还原", "reset", "clear"],
|
|
98
|
+
},
|
|
99
|
+
"completion": {
|
|
100
|
+
"description": "输出 Bash、Zsh 或 Fish 的 Tab 补全脚本",
|
|
101
|
+
"keywords": ["补全", "tab补全", "shell补全", "completion", "bash", "zsh", "fish"],
|
|
102
|
+
},
|
|
103
|
+
"dsh": {
|
|
104
|
+
"description": "兼容启动器:为首个 Web Session 绑定项目并启动 DeepSeek Harness",
|
|
105
|
+
"keywords": ["deepseek", "harness", "web-session", "绑定项目"],
|
|
106
|
+
},
|
|
107
|
+
"mcp": {
|
|
108
|
+
"description": "启动本地 MCP Supervisor(不执行 worker 命令)",
|
|
109
|
+
"keywords": ["mcp", "本地mcp", "mcp supervisor"],
|
|
110
|
+
},
|
|
111
|
+
"capability": {
|
|
112
|
+
"description": "探查项目形态并装配能力:plan(只读)/ install(装齐所需 MCP 运行时)",
|
|
113
|
+
"keywords": ["能力", "装配", "探查形态", "capability"],
|
|
114
|
+
},
|
|
115
|
+
"mcp-runtime": {
|
|
116
|
+
"description": "lock-hash 专用离线 MCP runtime:install/verify/start/rollback",
|
|
117
|
+
"keywords": ["mcp-runtime", "runtime", "离线mcp", "lock-hash"],
|
|
118
|
+
},
|
|
119
|
+
"lesson": {
|
|
120
|
+
"description": "管理项目级结构化错题集",
|
|
121
|
+
"keywords": ["错题", "错题集", "lesson", "教训"],
|
|
122
|
+
},
|
|
123
|
+
"logic-analysis": {
|
|
124
|
+
"description": "校验或绑定意图、逻辑链、Oracle 与证据包",
|
|
125
|
+
"keywords": ["逻辑链", "oracle", "证据包", "logic-analysis"],
|
|
126
|
+
},
|
|
127
|
+
"probe": {
|
|
128
|
+
"description": "运行 core 探针(efficiency/sast/mobile 等),透传其参数",
|
|
129
|
+
"keywords": ["探针", "probe", "efficiency", "sast", "mobile"],
|
|
130
|
+
},
|
|
131
|
+
"knowledge": {
|
|
132
|
+
"description": "治理项目候选与用户全局错题集(不自动同步)",
|
|
133
|
+
"keywords": ["知识", "知识库", "knowledge", "候选"],
|
|
134
|
+
},
|
|
135
|
+
"self-audit": {
|
|
136
|
+
"description": "对 BugX 本地 CLI/MCP 只读入口做自举动态审计",
|
|
137
|
+
"keywords": ["自审", "自举", "self-audit", "元审计"],
|
|
138
|
+
},
|
|
139
|
+
"telemetry": {
|
|
140
|
+
"description": "查看或导出单向飞轮取证数据",
|
|
141
|
+
"keywords": ["遥测", "飞轮", "telemetry", "取证数据"],
|
|
142
|
+
},
|
|
143
|
+
"config": {
|
|
144
|
+
"description": "设置本地 BugX 隐私与遥测配置",
|
|
145
|
+
"keywords": ["配置", "设置", "config", "隐私"],
|
|
146
|
+
},
|
|
147
|
+
"goal": {
|
|
148
|
+
"description": "目标导向无人值守自治挖掘与长程自愈循环",
|
|
149
|
+
"keywords": ["目标", "goal", "长程", "自愈循环"],
|
|
150
|
+
},
|
|
151
|
+
"supervisor": {
|
|
152
|
+
"description": "本地监督 MCP:install / status / rpc;带外动作:reset-budget / recover / rebind-target / gate / findings",
|
|
153
|
+
"keywords": ["监督", "监工", "supervisor", "监督mcp"],
|
|
154
|
+
},
|
|
155
|
+
"plugin": {
|
|
156
|
+
"description": "安装、校验或查看私有 BugX 插件(不执行插件)",
|
|
157
|
+
"keywords": ["插件", "plugin", "私有插件"],
|
|
158
|
+
},
|
|
159
|
+
"update": {
|
|
160
|
+
"description": "检查并安装最新 BugX CLI 版本",
|
|
161
|
+
"keywords": ["升级", "更新", "update", "新版本"],
|
|
162
|
+
},
|
|
163
|
+
"log": {
|
|
164
|
+
"description": "查看诊断日志、错误排查、链路追踪与耗时瀑布图",
|
|
165
|
+
"keywords": ["日志", "排查日志", "链路追踪", "瀑布图"],
|
|
166
|
+
},
|
|
167
|
+
"view": {
|
|
168
|
+
"description": "安全查看源文件切片与视窗(具备越界自愈与沙箱隔离)",
|
|
169
|
+
"keywords": ["查看源文件", "切片", "视窗", "view"],
|
|
170
|
+
},
|
|
171
|
+
"test-generate": {
|
|
172
|
+
"description": "为指定单元自动生成标准化 AAA 测试用例或自包含 PoC",
|
|
173
|
+
"keywords": ["生成测试", "测试用例", "test-generate", "poc"],
|
|
174
|
+
},
|
|
175
|
+
"test-audit": {
|
|
176
|
+
"description": "对测试用例进行四维(准确、完整、有效、全面)量化质量审计",
|
|
177
|
+
"keywords": ["测试审计", "测试质量", "test-audit"],
|
|
178
|
+
},
|
|
179
|
+
"mining-audit": {
|
|
180
|
+
"description": "对漏洞挖掘方案与用例进行四维(准确、完整、有效、全面)质量量化审计与加固",
|
|
181
|
+
"keywords": ["挖掘审计", "方案审计", "mining-audit", "加固"],
|
|
182
|
+
},
|
|
183
|
+
"test-verify": {
|
|
184
|
+
"description": "基于 AST 语义变异与沙箱隔离动态验证测试用例的抓 Bug 杀伤能力",
|
|
185
|
+
"keywords": ["测试验证", "变异", "杀伤", "test-verify"],
|
|
186
|
+
},
|
|
187
|
+
"interaction": {
|
|
188
|
+
"description": "查看/回答 BugX 抛出的结构化交互问题(非交互宿主的答案回灌通道)",
|
|
189
|
+
"keywords": ["交互问题", "回答", "回灌", "interaction"],
|
|
190
|
+
},
|
|
191
|
+
"advisory": {
|
|
192
|
+
"description": "GitHub Security Advisory (GHSA) 标准安全公告与 PR 修复草案管理",
|
|
193
|
+
"keywords": ["安全公告", "ghsa", "advisory", "修复草案"],
|
|
194
|
+
},
|
|
195
|
+
"help": {
|
|
196
|
+
"description": "查看 BugX 命令使用说明",
|
|
197
|
+
"keywords": ["帮助", "说明", "手册", "help", "usage"],
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@dataclass
|
|
203
|
+
class IntentArbitrationResult:
|
|
204
|
+
matched_command: str | None
|
|
205
|
+
suggestions: list[tuple[str, str]]
|
|
206
|
+
source: str # "ai_dynamic", "heuristic_synonym", "fuzzy_match", "none"
|
|
207
|
+
reasoning: str = ""
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class CommandIntentArbitrator:
|
|
211
|
+
"""AI 与程序协同的命令意图理解与纠错仲裁器。"""
|
|
212
|
+
|
|
213
|
+
def __init__(self, root: Path | None = None,
|
|
214
|
+
known_commands: Iterable[str] | None = None) -> None:
|
|
215
|
+
self.root = (root or Path.cwd()).resolve()
|
|
216
|
+
# 解析器真实命令面:建议永不指向不存在的命令;None 时退回能力表全量。
|
|
217
|
+
self.known_commands = frozenset(known_commands) if known_commands else None
|
|
218
|
+
|
|
219
|
+
def _capabilities(self) -> dict[str, dict[str, Any]]:
|
|
220
|
+
"""按真实命令面过滤能力表;幽灵键(历史漂移残留)不参与匹配与建议。"""
|
|
221
|
+
if not self.known_commands:
|
|
222
|
+
return COMMAND_CAPABILITIES
|
|
223
|
+
filtered = {k: v for k, v in COMMAND_CAPABILITIES.items() if k in self.known_commands}
|
|
224
|
+
ghosts = sorted(set(COMMAND_CAPABILITIES) - set(filtered))
|
|
225
|
+
if ghosts:
|
|
226
|
+
# 控制面闸门(过滤)已在上行生效;漂移必须留痕可观测,禁止静默吞掉。
|
|
227
|
+
print(
|
|
228
|
+
"[bugx] ⚠️ 意图能力表存在非真实命令键(已过滤,不参与建议): "
|
|
229
|
+
+ ", ".join(ghosts),
|
|
230
|
+
file=sys.stderr,
|
|
231
|
+
)
|
|
232
|
+
return filtered
|
|
233
|
+
|
|
234
|
+
def infer_intent(self, raw_input: str) -> IntentArbitrationResult:
|
|
235
|
+
cleaned = str(raw_input or "").strip()
|
|
236
|
+
if not cleaned:
|
|
237
|
+
return IntentArbitrationResult(None, [], "none", "输入为空")
|
|
238
|
+
|
|
239
|
+
caps = self._capabilities()
|
|
240
|
+
|
|
241
|
+
# 1. 本地快速同义词与关键词精确初筛
|
|
242
|
+
low = cleaned.casefold()
|
|
243
|
+
for cmd, meta in caps.items():
|
|
244
|
+
if low == cmd or low in meta["keywords"]:
|
|
245
|
+
return IntentArbitrationResult(
|
|
246
|
+
matched_command=cmd,
|
|
247
|
+
suggestions=[(cmd, meta["description"])],
|
|
248
|
+
source="heuristic_synonym",
|
|
249
|
+
reasoning=f"输入精确匹配命令或同义词: '{cleaned}'",
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
# 2. 本地语义关键词多路打分启发式匹配(程序优先:零成本答案不烧 AI 调用)
|
|
253
|
+
scored: dict[str, int] = {}
|
|
254
|
+
for cmd, meta in caps.items():
|
|
255
|
+
score = 0
|
|
256
|
+
for kw in meta["keywords"]:
|
|
257
|
+
kw_low = kw.casefold()
|
|
258
|
+
if len(kw_low) >= 2 and kw_low in low:
|
|
259
|
+
score += len(kw_low) * 10
|
|
260
|
+
if score > 0:
|
|
261
|
+
scored[cmd] = score
|
|
262
|
+
|
|
263
|
+
if scored:
|
|
264
|
+
ranked = sorted(scored.items(), key=lambda x: x[1], reverse=True)
|
|
265
|
+
top_cmd = ranked[0][0]
|
|
266
|
+
suggestions = [
|
|
267
|
+
(c, caps[c]["description"])
|
|
268
|
+
for c, _ in ranked[:2]
|
|
269
|
+
]
|
|
270
|
+
return IntentArbitrationResult(
|
|
271
|
+
matched_command=top_cmd,
|
|
272
|
+
suggestions=suggestions,
|
|
273
|
+
source="heuristic_synonym",
|
|
274
|
+
reasoning=f"根据语义关键词匹配推荐: '{cleaned}'",
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
# 3. 兜底编辑距离模糊匹配 (difflib)
|
|
278
|
+
candidates = list(caps.keys())
|
|
279
|
+
close = difflib.get_close_matches(low, candidates, n=2, cutoff=0.35)
|
|
280
|
+
if close:
|
|
281
|
+
return IntentArbitrationResult(
|
|
282
|
+
matched_command=close[0],
|
|
283
|
+
suggestions=[(c, caps[c]["description"]) for c in close],
|
|
284
|
+
source="fuzzy_match",
|
|
285
|
+
reasoning="编辑距离近似推荐",
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
# 4. 宿主 AI 动态语义意图推断——本地全部未命中时的最后兜底(仅限已初始化项目)
|
|
289
|
+
ai_result = self._try_ai_dynamic_inference(cleaned)
|
|
290
|
+
if ai_result:
|
|
291
|
+
return ai_result
|
|
292
|
+
|
|
293
|
+
return IntentArbitrationResult(None, [], "none", "未匹配到有效意图")
|
|
294
|
+
|
|
295
|
+
def _try_ai_dynamic_inference(self, raw_input: str) -> IntentArbitrationResult | None:
|
|
296
|
+
"""调用宿主 AI 理解复杂自然语言或未知拼写意图。"""
|
|
297
|
+
if os.environ.get("BUGX_OFFLINE") == "1" or os.environ.get("BUGX_INTENT_NO_LLM") == "1":
|
|
298
|
+
return None
|
|
299
|
+
|
|
300
|
+
# 项目门控:仅在已初始化的 BugX 项目内允许宿主 AI 侦察——
|
|
301
|
+
# 任意目录打错命令不应拉起宿主 AI 烧 token,更不应在用户工作区落盘。
|
|
302
|
+
if not (self.root / ".bugx").is_dir():
|
|
303
|
+
return None
|
|
304
|
+
|
|
305
|
+
active_host = ""
|
|
306
|
+
try:
|
|
307
|
+
from core.host_runtime import host_registry
|
|
308
|
+
active_host = host_registry.resolve_scout_host(self.root)
|
|
309
|
+
except Exception:
|
|
310
|
+
return None
|
|
311
|
+
|
|
312
|
+
if not active_host:
|
|
313
|
+
return None
|
|
314
|
+
|
|
315
|
+
tmp_prompt = self.root / ".bugx" / "run" / "intent_prompt.txt"
|
|
316
|
+
try:
|
|
317
|
+
from core.host_runtime import host_registry
|
|
318
|
+
|
|
319
|
+
prompt_payload = {
|
|
320
|
+
"user_input": raw_input,
|
|
321
|
+
"supported_commands": {k: v["description"] for k, v in COMMAND_CAPABILITIES.items()},
|
|
322
|
+
}
|
|
323
|
+
prompt_content = (
|
|
324
|
+
"<system_rules>\n"
|
|
325
|
+
"You are the BugX CLI Intent Parser.\n"
|
|
326
|
+
"Understand user's input (Chinese or English, possibly with typos or natural language) and map to the most accurate BugX command.\n"
|
|
327
|
+
"Output STRICTLY a JSON object with this exact schema (no markdown, no other text):\n"
|
|
328
|
+
"{\n"
|
|
329
|
+
' "matched_command": "one of supported_commands or null",\n'
|
|
330
|
+
' "confidence": "high|medium|low",\n'
|
|
331
|
+
' "reasoning": "brief explanation in Chinese"\n'
|
|
332
|
+
"}\n"
|
|
333
|
+
"</system_rules>\n"
|
|
334
|
+
"<context>\n"
|
|
335
|
+
f"{json.dumps(prompt_payload, ensure_ascii=False, indent=2)}\n"
|
|
336
|
+
"</context>\n"
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
tmp_prompt.parent.mkdir(parents=True, exist_ok=True)
|
|
340
|
+
tmp_prompt.write_text(prompt_content, encoding="utf-8")
|
|
341
|
+
|
|
342
|
+
cmd = host_registry.build_recon_scout_command(active_host, self.root, tmp_prompt)
|
|
343
|
+
if not cmd:
|
|
344
|
+
return None
|
|
345
|
+
child_env = os.environ.copy()
|
|
346
|
+
child_env["BUGX_RECON_SCOUT_ACTIVE"] = "1"
|
|
347
|
+
|
|
348
|
+
res = subprocess.run(
|
|
349
|
+
cmd, cwd=self.root, capture_output=True, text=True,
|
|
350
|
+
timeout=10, env=child_env, check=False,
|
|
351
|
+
)
|
|
352
|
+
raw_out = (res.stdout or "").strip()
|
|
353
|
+
# 提取 JSON 对象
|
|
354
|
+
m = re.search(r"\{[\s\S]*\}", raw_out)
|
|
355
|
+
if not m:
|
|
356
|
+
return None
|
|
357
|
+
data = json.loads(m.group(0))
|
|
358
|
+
matched = data.get("matched_command")
|
|
359
|
+
if matched and matched in COMMAND_CAPABILITIES:
|
|
360
|
+
return IntentArbitrationResult(
|
|
361
|
+
matched_command=matched,
|
|
362
|
+
suggestions=[(matched, COMMAND_CAPABILITIES[matched]["description"])],
|
|
363
|
+
source="ai_dynamic",
|
|
364
|
+
reasoning=data.get("reasoning", "AI 语义意图理解推荐"),
|
|
365
|
+
)
|
|
366
|
+
except Exception:
|
|
367
|
+
return None
|
|
368
|
+
finally:
|
|
369
|
+
try:
|
|
370
|
+
tmp_prompt.unlink(missing_ok=True)
|
|
371
|
+
except OSError:
|
|
372
|
+
pass # 清理尽力而为,失败不掩盖主流程结果
|
|
373
|
+
return None
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
@dataclass
|
|
377
|
+
class DiagnosticItem:
|
|
378
|
+
name: str
|
|
379
|
+
detail: str
|
|
380
|
+
required: bool
|
|
381
|
+
root_cause: str
|
|
382
|
+
prescription: str
|
|
383
|
+
auto_repairable: bool
|
|
384
|
+
confidence: str = "high"
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
@dataclass
|
|
388
|
+
class DiagnosticsResult:
|
|
389
|
+
summary: str
|
|
390
|
+
can_auto_repair: bool
|
|
391
|
+
auto_repair_command: str | None
|
|
392
|
+
items: list[DiagnosticItem] = field(default_factory=list)
|
|
393
|
+
ai_arbitrated: bool = False
|
|
394
|
+
|
|
395
|
+
def as_dict(self) -> dict[str, Any]:
|
|
396
|
+
return {
|
|
397
|
+
"summary": self.summary,
|
|
398
|
+
"can_auto_repair": self.can_auto_repair,
|
|
399
|
+
"auto_repair_command": self.auto_repair_command,
|
|
400
|
+
"ai_arbitrated": self.ai_arbitrated,
|
|
401
|
+
"items": [
|
|
402
|
+
{
|
|
403
|
+
"name": item.name,
|
|
404
|
+
"detail": item.detail,
|
|
405
|
+
"required": item.required,
|
|
406
|
+
"root_cause": item.root_cause,
|
|
407
|
+
"prescription": item.prescription,
|
|
408
|
+
"auto_repairable": item.auto_repairable,
|
|
409
|
+
"confidence": item.confidence,
|
|
410
|
+
}
|
|
411
|
+
for item in self.items
|
|
412
|
+
],
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
class DiagnosticAIArbitrator:
|
|
417
|
+
"""AI 根因分析与程序确定性修复提示仲裁器。"""
|
|
418
|
+
|
|
419
|
+
# 本地确定性诊断知识。模式必须完整匹配检查项名称,未知检查不得继承修复能力。
|
|
420
|
+
BASELINE_KNOWLEDGE = [
|
|
421
|
+
(
|
|
422
|
+
r"Python >= 3\.11",
|
|
423
|
+
"当前 Python 解释器版本低于 3.11 或运行态环境不满足要求,缺少异步上下文与现代类型特性。",
|
|
424
|
+
"请升级 Python 至 >= 3.11,或激活符合要求的虚拟环境 (例如: conda activate py311 或 pyenv shell 3.11)。",
|
|
425
|
+
),
|
|
426
|
+
(
|
|
427
|
+
r"安装资源",
|
|
428
|
+
"核心静态资源或模板文件缺失,可能由于打包解压损坏或安装目录被意外清理。",
|
|
429
|
+
"检查报错中的安装资源目录;使用 `bugx update --repair-assets` 修复当前 Python 安装资源,或重装经校验的 BugX wheel。",
|
|
430
|
+
),
|
|
431
|
+
(
|
|
432
|
+
r"(?:全局引擎完整性|引擎副本一致性)",
|
|
433
|
+
"全局引擎代码清单 (engine-integrity.json) 哈希不匹配或文件缺失,存在版本漂移或代码被意外修改。",
|
|
434
|
+
"`bugx doctor --repair` 在两种情况下会重放安装资源修好引擎:(1) 安装资源 Build ID 严格高于全局引擎;(2) 同 Build ID 且安装资源自身完好。仅当资源自身也损坏(或需要降级)时才会拒绝,此时请重装 CLI。",
|
|
435
|
+
),
|
|
436
|
+
(
|
|
437
|
+
r"BugX 版本一致性",
|
|
438
|
+
"CLI 命令入口与全局引擎、镜像清单版本声明不一致,存在环境版本漂移。",
|
|
439
|
+
"运行 `bugx doctor --repair` 前先确认安装资源 Build ID 严格高于全局引擎;不满足时升级 CLI wheel 后重试。",
|
|
440
|
+
),
|
|
441
|
+
(
|
|
442
|
+
r"项目初始化状态",
|
|
443
|
+
# 旧文案硬编码"manifest.json 缺失",但 initialized 实际由
|
|
444
|
+
# manifest_ok ∧ layout ∧ init_issues 三者合取判定,最常见的
|
|
445
|
+
# 实因是缺 .bugx/cloud-onboard.json。模板不得覆盖真实 detail,
|
|
446
|
+
# 否则用户按"manifest 缺失"排查会走进死胡同(实测该文件存在
|
|
447
|
+
# 且 project_id 完全匹配,诊断仍报缺失)。
|
|
448
|
+
"项目初始化未通过完整性判定(manifest 存在不代表就绪:还需 .bugx 布局可加载、"
|
|
449
|
+
"云端 onboarding 记录与启动视图齐备);具体缺口见本项 detail。",
|
|
450
|
+
"先只读运行 `bugx engine --root <ROOT> status --json`;只有状态精确为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre`。若返回 `FATAL_BLOCKED`、其他状态或检查失败,保留现场并停止;不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。",
|
|
451
|
+
),
|
|
452
|
+
(
|
|
453
|
+
r"工作树卫生与嵌套隔离",
|
|
454
|
+
"当前工作树存在未跟踪改动或存在嵌套 Git 仓库冲突,可能导致自动化漏洞验证隔离失效。",
|
|
455
|
+
"检查 git status,将未跟踪的临时产物加入 .gitignore,或提交当前未保存的代码。",
|
|
456
|
+
),
|
|
457
|
+
(
|
|
458
|
+
r"云端端点连通性",
|
|
459
|
+
"与 BugX 云端服务协同端点通信失败,可能由于未登录鉴权、网络代理阻塞或端点不可达。",
|
|
460
|
+
"若需鉴权请运行 bugx auth login;若为网络问题请检查系统网络与 BUGX_CLOUD_API_BASE 设置。",
|
|
461
|
+
),
|
|
462
|
+
(
|
|
463
|
+
r"项目资产修复",
|
|
464
|
+
"项目 .bugx 目录中的运行态快照、current.json 或历史记录链存在断裂或文件损坏。",
|
|
465
|
+
"查看 Doctor 列出的具体修复错误;缺少可信备份或校验失败时,从可信备份恢复,不能凭空重建运行态数据。",
|
|
466
|
+
),
|
|
467
|
+
(
|
|
468
|
+
r"MCP 离线 runtime",
|
|
469
|
+
"本地离线 MCP 运行时沙箱未建立或环境依赖缺失,导致离线代码工具链不可用。",
|
|
470
|
+
"按需运行 `bugx system mcp-runtime install` 建立隔离运行时;这不是 `bugx doctor --repair` 的修复项。",
|
|
471
|
+
),
|
|
472
|
+
(
|
|
473
|
+
r"MCP 会话进程卫生",
|
|
474
|
+
"检测到系统中存在失控或遗留的 MCP 僵尸进程,可能持续占用端口与系统句柄。",
|
|
475
|
+
"运行 bugx system mcp-runtime clean 清理遗留僵尸进程。",
|
|
476
|
+
),
|
|
477
|
+
(
|
|
478
|
+
r"BugX CLI 路径",
|
|
479
|
+
"PATH 环境变量中同时存在多个不同包管理器安装的 bugx 入口(例如 npm 与 pip 冲突)。",
|
|
480
|
+
"建议卸载冲突的多余版本(npm: npm uninstall -g bugx-cli,pip: pip uninstall bugx-cli)。",
|
|
481
|
+
),
|
|
482
|
+
(
|
|
483
|
+
r"基础效率工具",
|
|
484
|
+
"系统缺失部分提速工具(如 ast-grep, ripgrep 等),当前已平滑降级至内置 Python 解析引擎。",
|
|
485
|
+
"可使用包管理器安装对应外部工具(如 brew install ast-grep ripgrep)提升大规模审计速度。",
|
|
486
|
+
),
|
|
487
|
+
(
|
|
488
|
+
r"Tree-sitter 多语言增强",
|
|
489
|
+
"未检测到 tree-sitter-language-pack 库,跨语言语法树深度解析回退至词法模式。",
|
|
490
|
+
"运行 `bugx doctor --repair` 可尝试安装 `tree-sitter-language-pack`;安装失败时请按错误详情检查 Python 环境和网络。",
|
|
491
|
+
),
|
|
492
|
+
(
|
|
493
|
+
r"codebase-memory 推荐加速",
|
|
494
|
+
"知识图谱组件 codebase-memory 未就绪或未启动,当前运行于基础模式。",
|
|
495
|
+
"这是可选加速组件;检查插件安装与索引状态,基础模式仍可运行。",
|
|
496
|
+
),
|
|
497
|
+
(
|
|
498
|
+
r"UI 视觉与浏览器挖掘环境(?:(可选))?",
|
|
499
|
+
"Playwright 浏览器驱动或系统渲染依赖未就绪,UI 自动化挖掘功能受限。",
|
|
500
|
+
"按需运行 `python3 setup_ui_env.py install` 安装 Chromium 浏览器驱动及依赖。",
|
|
501
|
+
),
|
|
502
|
+
(
|
|
503
|
+
r".+ (?:完整适配包|MCP 配置|全局入口完整性|全局 Skill 完整性)",
|
|
504
|
+
"宿主配置或适配资产与 BugX 当前模板不一致;本地文件可能包含用户自定义内容。",
|
|
505
|
+
"先检查并保存目标配置中的本地修改,再按单个宿主执行 `bugx install --root <ROOT> --agent <HOST>`;不要用 Doctor 批量强制覆盖宿主资产。",
|
|
506
|
+
),
|
|
507
|
+
]
|
|
508
|
+
|
|
509
|
+
# 只有这些修复路径由 Doctor 当前控制流直接实现;调用方还必须证明本次
|
|
510
|
+
# 检查满足运行时前置条件。模型输出和静态知识均不能自行扩大这个集合。
|
|
511
|
+
AUTO_REPAIRABLE_CHECKS = frozenset({
|
|
512
|
+
"全局引擎完整性",
|
|
513
|
+
"BugX 版本一致性",
|
|
514
|
+
"Tree-sitter 多语言增强",
|
|
515
|
+
})
|
|
516
|
+
|
|
517
|
+
def __init__(self, root: Path) -> None:
|
|
518
|
+
self.root = root.resolve()
|
|
519
|
+
|
|
520
|
+
def _baseline_for_name(self, name: str) -> tuple[str, str] | None:
|
|
521
|
+
for pattern, cause, prescription in self.BASELINE_KNOWLEDGE:
|
|
522
|
+
if re.fullmatch(pattern, name, re.IGNORECASE):
|
|
523
|
+
return cause, prescription
|
|
524
|
+
return None
|
|
525
|
+
|
|
526
|
+
def diagnose(
|
|
527
|
+
self,
|
|
528
|
+
checks: list[tuple[str, bool, str]],
|
|
529
|
+
installation_required: set[str],
|
|
530
|
+
strict: bool = False,
|
|
531
|
+
auto_repairable_checks: set[str] | None = None,
|
|
532
|
+
use_ai: bool = False,
|
|
533
|
+
) -> DiagnosticsResult:
|
|
534
|
+
eligible_repairs = set(auto_repairable_checks or ()) & self.AUTO_REPAIRABLE_CHECKS
|
|
535
|
+
failed_raw = [(n, d, n in installation_required) for n, ok, d in checks if not ok]
|
|
536
|
+
if not failed_raw:
|
|
537
|
+
return DiagnosticsResult(
|
|
538
|
+
summary="🎉 所有环境检测项与就绪门禁全部通过,BugX 处于最优运行状态!",
|
|
539
|
+
can_auto_repair=False,
|
|
540
|
+
auto_repair_command=None,
|
|
541
|
+
items=[],
|
|
542
|
+
ai_arbitrated=False,
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
# 1. 显式 --ai 时才唤起宿主 AI 生成动态深入诊断分析。
|
|
546
|
+
# F-327 耗时账目 W-002:AI 宿主子进程串行阻塞 ~12s(timeout=12),
|
|
547
|
+
# 占 doctor 全程 21.8s 的 55%;默认改为本地确定性专家基线(毫秒级),
|
|
548
|
+
# 需要深度根因分析时用 `bugx doctor --ai` 显式开启。
|
|
549
|
+
ai_items = (
|
|
550
|
+
self._try_ai_deep_diagnosis(failed_raw) if use_ai else None
|
|
551
|
+
)
|
|
552
|
+
if ai_items:
|
|
553
|
+
for item in ai_items:
|
|
554
|
+
baseline = self._baseline_for_name(item.name)
|
|
555
|
+
item.prescription = baseline[1] if baseline else (
|
|
556
|
+
"该检查项没有经过本地规则验证的修复路径;请根据失败详情先做只读排查,勿运行批量修复。"
|
|
557
|
+
)
|
|
558
|
+
item.auto_repairable = item.name in eligible_repairs
|
|
559
|
+
item.confidence = "medium" if baseline else "low"
|
|
560
|
+
repairable_count = sum(1 for item in ai_items if item.auto_repairable)
|
|
561
|
+
can_auto_repair = repairable_count > 0
|
|
562
|
+
return DiagnosticsResult(
|
|
563
|
+
summary=self._build_summary(len(ai_items), repairable_count),
|
|
564
|
+
can_auto_repair=can_auto_repair,
|
|
565
|
+
auto_repair_command="bugx doctor --repair" if can_auto_repair else None,
|
|
566
|
+
items=ai_items,
|
|
567
|
+
ai_arbitrated=True,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
# 2. 回退到本地高可靠专家知识库
|
|
571
|
+
baseline_items: list[DiagnosticItem] = []
|
|
572
|
+
for name, detail, is_req in failed_raw:
|
|
573
|
+
baseline = self._baseline_for_name(name)
|
|
574
|
+
if baseline:
|
|
575
|
+
canned_cause, prescription = baseline
|
|
576
|
+
# 模板给出的是"可能的根因族",detail 才是本机实测事实。
|
|
577
|
+
# 两者必须同时呈现:只给模板会把用户引向错误的排查方向。
|
|
578
|
+
cause = f"{canned_cause} 实测详情:{detail}" if detail else canned_cause
|
|
579
|
+
confidence = "high"
|
|
580
|
+
else:
|
|
581
|
+
cause = f"检查项 '{name}' 返回未就绪状态:{detail}"
|
|
582
|
+
prescription = "该检查项没有经过本地规则验证的修复路径;请根据失败详情先做只读排查,勿运行批量修复。"
|
|
583
|
+
confidence = "low"
|
|
584
|
+
baseline_items.append(DiagnosticItem(
|
|
585
|
+
name=name,
|
|
586
|
+
detail=detail,
|
|
587
|
+
required=is_req,
|
|
588
|
+
root_cause=cause,
|
|
589
|
+
prescription=prescription,
|
|
590
|
+
auto_repairable=name in eligible_repairs,
|
|
591
|
+
confidence=confidence,
|
|
592
|
+
))
|
|
593
|
+
|
|
594
|
+
repairable_count = sum(1 for item in baseline_items if item.auto_repairable)
|
|
595
|
+
can_auto_repair = repairable_count > 0
|
|
596
|
+
return DiagnosticsResult(
|
|
597
|
+
summary=self._build_summary(len(baseline_items), repairable_count),
|
|
598
|
+
can_auto_repair=can_auto_repair,
|
|
599
|
+
auto_repair_command="bugx doctor --repair" if can_auto_repair else None,
|
|
600
|
+
items=baseline_items,
|
|
601
|
+
ai_arbitrated=False,
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
def _build_summary(self, total: int, repairable: int) -> str:
|
|
605
|
+
if repairable == total and total > 0:
|
|
606
|
+
return f"检测到 {total} 项环境异常,均有 Doctor 已实现的修复路径;可运行 `bugx doctor --repair` 尝试处理。"
|
|
607
|
+
if repairable > 0:
|
|
608
|
+
return f"检测到 {total} 项环境异常,其中 {repairable} 项有 Doctor 已实现的修复路径。"
|
|
609
|
+
return f"检测到 {total} 项环境异常,请参考下方诊断和对应处置指引。"
|
|
610
|
+
|
|
611
|
+
def _try_ai_deep_diagnosis(
|
|
612
|
+
self,
|
|
613
|
+
failed_raw: list[tuple[str, str, bool]],
|
|
614
|
+
) -> list[DiagnosticItem] | None:
|
|
615
|
+
"""调用宿主 AI 分析当前异常根因;修复权限由本地逻辑裁定。"""
|
|
616
|
+
if os.environ.get("BUGX_OFFLINE") == "1" or os.environ.get("BUGX_DOCTOR_NO_LLM") == "1":
|
|
617
|
+
return None
|
|
618
|
+
|
|
619
|
+
active_host = ""
|
|
620
|
+
try:
|
|
621
|
+
from core.host_runtime import host_registry
|
|
622
|
+
active_host = host_registry.resolve_scout_host(self.root)
|
|
623
|
+
except Exception:
|
|
624
|
+
return None
|
|
625
|
+
|
|
626
|
+
if not active_host:
|
|
627
|
+
return None
|
|
628
|
+
|
|
629
|
+
try:
|
|
630
|
+
from core.host_runtime import host_registry
|
|
631
|
+
|
|
632
|
+
prompt_payload = {
|
|
633
|
+
"os": sys.platform,
|
|
634
|
+
"python_version": sys.version,
|
|
635
|
+
"failed_checks": [
|
|
636
|
+
{"name": n, "detail": d, "is_required": r}
|
|
637
|
+
for n, d, r in failed_raw
|
|
638
|
+
],
|
|
639
|
+
}
|
|
640
|
+
prompt_content = (
|
|
641
|
+
"<system_rules>\n"
|
|
642
|
+
"You are the BugX System Diagnostic Expert.\n"
|
|
643
|
+
"Analyze the failed environment checks and explain a likely technical root cause for each item.\n"
|
|
644
|
+
"Do not prescribe commands or classify repairability; BugX will use locally verified repair rules for those decisions.\n"
|
|
645
|
+
"Output STRICTLY a JSON object with this exact schema (no markdown, no other text):\n"
|
|
646
|
+
"{\n"
|
|
647
|
+
' "diagnostics": [\n'
|
|
648
|
+
' {\n'
|
|
649
|
+
' "name": "check item name",\n'
|
|
650
|
+
' "root_cause": "likely technical root cause in Chinese"\n'
|
|
651
|
+
' }\n'
|
|
652
|
+
' ]\n'
|
|
653
|
+
"}\n"
|
|
654
|
+
"</system_rules>\n"
|
|
655
|
+
"<context>\n"
|
|
656
|
+
f"{json.dumps(prompt_payload, ensure_ascii=False, indent=2)}\n"
|
|
657
|
+
"</context>\n"
|
|
658
|
+
)
|
|
659
|
+
|
|
660
|
+
# 临时 prompt 必须落在**项目树之外**:``bugx doctor`` 对外承诺
|
|
661
|
+
# 「默认只读诊断」,此前写 ``<root>/.bugx/run/doctor_prompt.txt``
|
|
662
|
+
# 会连带创建 ``.bugx/run`` 等 23 个条目,直接违反零写盘契约
|
|
663
|
+
# (test_a1_doctor_is_read_only_by_default 实测失败)。改用系统临时目录,
|
|
664
|
+
# 用完即删。
|
|
665
|
+
import tempfile
|
|
666
|
+
|
|
667
|
+
tmp_fd, tmp_prompt_name = tempfile.mkstemp(
|
|
668
|
+
prefix="bugx-doctor-prompt-", suffix=".txt",
|
|
669
|
+
)
|
|
670
|
+
os.close(tmp_fd)
|
|
671
|
+
tmp_prompt = Path(tmp_prompt_name)
|
|
672
|
+
try:
|
|
673
|
+
tmp_prompt.write_text(prompt_content, encoding="utf-8")
|
|
674
|
+
except OSError:
|
|
675
|
+
tmp_prompt.unlink(missing_ok=True)
|
|
676
|
+
return None
|
|
677
|
+
|
|
678
|
+
cmd = host_registry.build_recon_scout_command(active_host, self.root, tmp_prompt)
|
|
679
|
+
if not cmd:
|
|
680
|
+
return None
|
|
681
|
+
child_env = os.environ.copy()
|
|
682
|
+
child_env["BUGX_RECON_SCOUT_ACTIVE"] = "1"
|
|
683
|
+
|
|
684
|
+
try:
|
|
685
|
+
res = subprocess.run(
|
|
686
|
+
cmd, cwd=self.root, capture_output=True, text=True,
|
|
687
|
+
timeout=12, env=child_env, check=False,
|
|
688
|
+
)
|
|
689
|
+
finally:
|
|
690
|
+
# 临时 prompt 已在子进程读取后被消费,立即清理避免 /tmp 泄漏。
|
|
691
|
+
tmp_prompt.unlink(missing_ok=True)
|
|
692
|
+
raw_out = (res.stdout or "").strip()
|
|
693
|
+
m = re.search(r"\{[\s\S]*\}", raw_out)
|
|
694
|
+
if not m:
|
|
695
|
+
return None
|
|
696
|
+
data = json.loads(m.group(0))
|
|
697
|
+
diag_list = data.get("diagnostics")
|
|
698
|
+
if not isinstance(diag_list, list) or len(diag_list) != len(failed_raw):
|
|
699
|
+
return None
|
|
700
|
+
|
|
701
|
+
items: list[DiagnosticItem] = []
|
|
702
|
+
expected_names = [name for name, _detail, _required in failed_raw]
|
|
703
|
+
if any(not isinstance(item, dict) for item in diag_list):
|
|
704
|
+
return None
|
|
705
|
+
returned_names = [item.get("name") for item in diag_list]
|
|
706
|
+
if (
|
|
707
|
+
any(not isinstance(name, str) for name in returned_names)
|
|
708
|
+
or len(set(returned_names)) != len(expected_names)
|
|
709
|
+
or set(returned_names) != set(expected_names)
|
|
710
|
+
):
|
|
711
|
+
return None
|
|
712
|
+
diag_map = {item["name"]: item for item in diag_list}
|
|
713
|
+
for n, d, r in failed_raw:
|
|
714
|
+
parsed = diag_map[n]
|
|
715
|
+
cause = parsed.get("root_cause")
|
|
716
|
+
if not isinstance(cause, str) or not cause.strip():
|
|
717
|
+
return None
|
|
718
|
+
items.append(DiagnosticItem(
|
|
719
|
+
name=n,
|
|
720
|
+
detail=d,
|
|
721
|
+
required=r,
|
|
722
|
+
root_cause=cause,
|
|
723
|
+
prescription="",
|
|
724
|
+
auto_repairable=False,
|
|
725
|
+
confidence="medium",
|
|
726
|
+
))
|
|
727
|
+
return items
|
|
728
|
+
except Exception:
|
|
729
|
+
return None
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def _is_pid_alive(pid: int) -> bool:
|
|
733
|
+
"""跨平台安全检测进程 PID 是否存活。"""
|
|
734
|
+
if pid <= 0:
|
|
735
|
+
return False
|
|
736
|
+
try:
|
|
737
|
+
os.kill(pid, 0)
|
|
738
|
+
return True
|
|
739
|
+
except OSError as err:
|
|
740
|
+
return err.errno == errno.EPERM
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
class DeterministicHealer:
|
|
744
|
+
"""只清理已确认失效的 BugX 锁;不创建或重建项目状态。"""
|
|
745
|
+
|
|
746
|
+
def __init__(self, root: Path) -> None:
|
|
747
|
+
self.root = root.resolve()
|
|
748
|
+
|
|
749
|
+
def heal_stale_locks(self) -> tuple[bool, str]:
|
|
750
|
+
"""扫描并解除残留的僵尸锁文件(PID 已消亡或锁文件过期)。"""
|
|
751
|
+
dot_bugx = self.root / ".bugx"
|
|
752
|
+
if dot_bugx.is_symlink() or not dot_bugx.is_dir():
|
|
753
|
+
return False, "锁目录不存在,未修改项目状态"
|
|
754
|
+
|
|
755
|
+
removed_locks: list[str] = []
|
|
756
|
+
lock_candidates = list(dot_bugx.rglob("*.lock"))
|
|
757
|
+
now = time.time()
|
|
758
|
+
|
|
759
|
+
for lock_file in lock_candidates:
|
|
760
|
+
if not lock_file.is_file():
|
|
761
|
+
continue
|
|
762
|
+
should_remove = False
|
|
763
|
+
reason = ""
|
|
764
|
+
|
|
765
|
+
try:
|
|
766
|
+
content = lock_file.read_text(encoding="utf-8").strip()
|
|
767
|
+
if not content:
|
|
768
|
+
if now - lock_file.stat().st_mtime > 5:
|
|
769
|
+
should_remove = True
|
|
770
|
+
reason = "空锁超时"
|
|
771
|
+
else:
|
|
772
|
+
pid = None
|
|
773
|
+
try:
|
|
774
|
+
data = json.loads(content)
|
|
775
|
+
if isinstance(data, dict):
|
|
776
|
+
pid = data.get("pid")
|
|
777
|
+
except Exception:
|
|
778
|
+
try:
|
|
779
|
+
pid = int(content)
|
|
780
|
+
except Exception:
|
|
781
|
+
pass
|
|
782
|
+
|
|
783
|
+
if pid is not None and isinstance(pid, int):
|
|
784
|
+
if not _is_pid_alive(pid):
|
|
785
|
+
should_remove = True
|
|
786
|
+
reason = f"持有锁的进程 PID {pid} 已消亡"
|
|
787
|
+
else:
|
|
788
|
+
if now - lock_file.stat().st_mtime > 60:
|
|
789
|
+
should_remove = True
|
|
790
|
+
reason = "锁文件超时残留"
|
|
791
|
+
except Exception:
|
|
792
|
+
pass
|
|
793
|
+
|
|
794
|
+
if should_remove:
|
|
795
|
+
try:
|
|
796
|
+
lock_file.unlink()
|
|
797
|
+
removed_locks.append(f"{lock_file.name} ({reason})")
|
|
798
|
+
except Exception:
|
|
799
|
+
pass
|
|
800
|
+
|
|
801
|
+
if removed_locks:
|
|
802
|
+
return True, f"已安全清除僵尸锁: {', '.join(removed_locks)}"
|
|
803
|
+
return False, "未发现可安全清除的僵尸锁"
|
|
804
|
+
|
|
805
|
+
class RuntimeSelfHealInterceptor:
|
|
806
|
+
"""运行时执行异常拦截与就地自愈恢复器。
|
|
807
|
+
|
|
808
|
+
只允许清理已确认失效的锁并最多重试一次。项目布局、身份、manifest、配置、
|
|
809
|
+
JSON 损坏和启动门禁错误均由调用方保留现场并 fail-closed。
|
|
810
|
+
"""
|
|
811
|
+
|
|
812
|
+
def __init__(self, root: Path) -> None:
|
|
813
|
+
self.root = root.resolve()
|
|
814
|
+
self._retried = False
|
|
815
|
+
|
|
816
|
+
def can_heal(self, exc: Exception, command: str | None = None) -> bool:
|
|
817
|
+
"""仅白名单内的锁故障可进入确定性修复。"""
|
|
818
|
+
if os.environ.get("BUGX_NO_AUTO_HEAL") == "1":
|
|
819
|
+
return False
|
|
820
|
+
if self._retried:
|
|
821
|
+
return False
|
|
822
|
+
|
|
823
|
+
text = str(exc).casefold()
|
|
824
|
+
if "fatal_blocked" in text or "project_layout=" in text:
|
|
825
|
+
return False
|
|
826
|
+
|
|
827
|
+
# 锁错误也可能出现在门禁或损坏状态的描述中;这些标记始终优先拒绝。
|
|
828
|
+
project_state_markers = (
|
|
829
|
+
"尚未初始化", "not initialized", "manifest.json", "current.json",
|
|
830
|
+
".bugx-project.json", "缺少项目身份", "身份文件损坏", "配置损坏",
|
|
831
|
+
"jsondecodeerror", "json.decoder", "expecting value", "unterminated string",
|
|
832
|
+
"破损", "格式错误", "版本漂移", "哈希不匹配",
|
|
833
|
+
)
|
|
834
|
+
if any(marker.casefold() in text for marker in project_state_markers):
|
|
835
|
+
return False
|
|
836
|
+
|
|
837
|
+
stale_lock_markers = (
|
|
838
|
+
"timeout waiting for lock", "lock acquisition exceeded",
|
|
839
|
+
"锁文件已存在", "supervisor lock",
|
|
840
|
+
)
|
|
841
|
+
return any(marker in text for marker in stale_lock_markers)
|
|
842
|
+
|
|
843
|
+
def try_heal(self, exc: Exception, command: str | None = None) -> tuple[bool, str]:
|
|
844
|
+
"""对已通过白名单的锁故障清理一次;其他异常保持现场。"""
|
|
845
|
+
if not self.can_heal(exc, command=command):
|
|
846
|
+
return False, "异常不在运行时安全修复白名单中;项目状态未修改"
|
|
847
|
+
|
|
848
|
+
self._retried = True
|
|
849
|
+
healer = DeterministicHealer(self.root)
|
|
850
|
+
return healer.heal_stale_locks()
|
|
851
|
+
|