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,910 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""core/rsi_fixer.py - 派宿主 agent 修 BUGX 自身的缺陷,并当场验收。
|
|
3
|
+
|
|
4
|
+
## 它补的是哪一段
|
|
5
|
+
|
|
6
|
+
之前 ``rsi_repair`` 只能清残留:所有「要改 BUGX 源码」的缺陷都被归成
|
|
7
|
+
``product`` 然后原地不动,等人工。结果 RSI 对真正重要的问题什么都没做——
|
|
8
|
+
本轮修的三个 bug(node 重写缺失、doctor 死锁、dsh 未登记)全落在这一类。
|
|
9
|
+
|
|
10
|
+
本模块把这一段接上:
|
|
11
|
+
|
|
12
|
+
立案(含复现命令)→ 派 agent 改代码 → 双向门禁 → 退化即回滚
|
|
13
|
+
|
|
14
|
+
## 为什么回滚是必须的
|
|
15
|
+
|
|
16
|
+
agent 改代码会失败,而且**失败时常常看起来很成功**:它可能为了让复现用例
|
|
17
|
+
变绿而改坏了别处。所以每次修复尝试都在**隔离副本**里做:
|
|
18
|
+
|
|
19
|
+
1. 复制仓库到临时目录
|
|
20
|
+
2. 在副本里让 agent 改
|
|
21
|
+
3. 在副本里跑复现命令 + 全量回归
|
|
22
|
+
4. 两条都过,才把 diff 取回来
|
|
23
|
+
5. 任一不过,丢弃副本——原仓库从未被碰过
|
|
24
|
+
|
|
25
|
+
这与 ``patch_synthesizer.verify_patch_dual_gate`` 的思路一致:缺陷验证必须
|
|
26
|
+
在独立树上做,否则一次失败的命令就能留下用户状态。
|
|
27
|
+
|
|
28
|
+
## 验收不是「复现用例变绿」
|
|
29
|
+
|
|
30
|
+
复现用例变绿只说明「这一条好了」。必须同时满足:
|
|
31
|
+
|
|
32
|
+
* 修复前失败、修复后通过(双向差分)
|
|
33
|
+
* 既有测试全量不退化
|
|
34
|
+
|
|
35
|
+
第二条件才是关键——它拦的正是「为了让用例变绿而改坏别处」。
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
from __future__ import annotations
|
|
39
|
+
# --- 引擎导入根(直接执行脚本时自举 core.* 命名空间)---
|
|
40
|
+
import sys as _sys
|
|
41
|
+
from pathlib import Path as _Path
|
|
42
|
+
|
|
43
|
+
for _p in _Path(__file__).resolve().parents:
|
|
44
|
+
if (_p / "core" / "bugx.md").is_file():
|
|
45
|
+
if str(_p) not in _sys.path:
|
|
46
|
+
_sys.path.insert(0, str(_p))
|
|
47
|
+
break
|
|
48
|
+
del _p
|
|
49
|
+
|
|
50
|
+
import json
|
|
51
|
+
import os
|
|
52
|
+
import shutil
|
|
53
|
+
import subprocess
|
|
54
|
+
import sys
|
|
55
|
+
import tempfile
|
|
56
|
+
import time
|
|
57
|
+
from pathlib import Path
|
|
58
|
+
|
|
59
|
+
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
|
|
60
|
+
sys.path.insert(0, str(REPO_ROOT / "core"))
|
|
61
|
+
|
|
62
|
+
from core.repair import rsi_scope # noqa: E402
|
|
63
|
+
|
|
64
|
+
#: 修复尝试的默认超时。agent 改代码比跑评测慢得多。
|
|
65
|
+
DEFAULT_FIX_TIMEOUT = 900.0
|
|
66
|
+
#: 回归测试的默认超时。
|
|
67
|
+
DEFAULT_REGRESSION_TIMEOUT = 600.0
|
|
68
|
+
|
|
69
|
+
#: 「静默多久算卡死」——比超时更早、更准的判据。
|
|
70
|
+
#:
|
|
71
|
+
#: ## 为什么光有超时不够
|
|
72
|
+
#:
|
|
73
|
+
#: 实测事故:agent 接到「跑全量 pytest 验证不退化」的指令后,开始跑 3685 个
|
|
74
|
+
#: 测试(约 24 分钟)。attempt_fix 的超时是 450s,于是只能干等 450 秒,
|
|
75
|
+
#: 拿到 ``exit code 124`` + **空输出**,报告「未修复」——但 agent 根本没在修,
|
|
76
|
+
#: 它在跑测试。等满超时既浪费 8 分钟,又把「指令写错了」误诊成「agent 不行」。
|
|
77
|
+
#:
|
|
78
|
+
#: 卡死的信号不是「跑得久」,而是「**很久没有新输出**」。正常工作时 agent 会
|
|
79
|
+
#: 不断打印工具调用;真卡住时输出会彻底停住。所以按「最近一次输出的年龄」
|
|
80
|
+
#: 判断,能在 2 分钟内识别出死循环/等待输入/跑长测试,而不是等满超时。
|
|
81
|
+
#:
|
|
82
|
+
#: 取 120s:agent 单步(读文件、跑一次 l7_selfcheck)通常秒级,最慢的
|
|
83
|
+
#: 全量单测也就几十秒;连续 2 分钟一个字都不吐,几乎必然是卡住。
|
|
84
|
+
DEFAULT_IDLE_TIMEOUT = 120.0
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _idle_timeout() -> float:
|
|
88
|
+
"""允许用环境变量覆盖,便于慢机器/大仓库调整。"""
|
|
89
|
+
raw = (os.environ.get("RSI_AGENT_IDLE_TIMEOUT") or "").strip()
|
|
90
|
+
if not raw:
|
|
91
|
+
return DEFAULT_IDLE_TIMEOUT
|
|
92
|
+
try:
|
|
93
|
+
value = float(raw)
|
|
94
|
+
except ValueError:
|
|
95
|
+
return DEFAULT_IDLE_TIMEOUT
|
|
96
|
+
return value if value > 0 else DEFAULT_IDLE_TIMEOUT
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def build_fix_prompt(work_order: dict, *, mode: str, tree: Path | None = None) -> str:
|
|
100
|
+
"""把工作单转成给 agent 的修复指令。
|
|
101
|
+
|
|
102
|
+
指令必须自带三件事,缺一不可执行:
|
|
103
|
+
|
|
104
|
+
* 复现命令——让 agent 能自己确认缺陷存在
|
|
105
|
+
* 验收标准——让 agent 知道自己要满足什么,而不是猜
|
|
106
|
+
* 范围限制——明确告诉它不许动什么
|
|
107
|
+
"""
|
|
108
|
+
lines = [
|
|
109
|
+
"你是 BugX 引擎的维护者。下面是一份自回归评测发现的产品缺陷,请修复它。",
|
|
110
|
+
]
|
|
111
|
+
if tree is not None:
|
|
112
|
+
# ## 必须给出绝对路径,否则 agent 会去改「它自己认为的项目根」
|
|
113
|
+
#
|
|
114
|
+
# 实测事故:沙箱在 /var/folders/.../bugx-fix-xxx/tree,但 prompt 里只有
|
|
115
|
+
# 相对命令(`python3 core/l7_selfcheck.py`)。opencode 沿用自己的项目
|
|
116
|
+
# 索引,直接 `cd /private/tmp/e3`(**被修复的那个仓库本身**)开工,
|
|
117
|
+
# 把注入的缺陷改掉了——而 attempt_fix 的承诺是「原仓库不会被改动」。
|
|
118
|
+
#
|
|
119
|
+
# 更糟的是它改对之后,PoC 在真正的沙箱里跑,缺陷仍在,于是报告
|
|
120
|
+
# 「未能修复」。**原仓库被污染了,故障却记在 agent 头上。**
|
|
121
|
+
#
|
|
122
|
+
# 只设 cwd 不够:宿主 agent 有各自的项目发现机制,会绕过 cwd。
|
|
123
|
+
# 必须在指令里把工作目录钉死。
|
|
124
|
+
lines.extend([
|
|
125
|
+
"",
|
|
126
|
+
f"## 工作目录(绝对路径,只在此目录内改动)",
|
|
127
|
+
f" {tree}",
|
|
128
|
+
"",
|
|
129
|
+
"所有读写、所有命令都必须在这个目录内进行。"
|
|
130
|
+
"不要 cd 到其他目录,不要修改这个目录之外的文件——"
|
|
131
|
+
"那会污染真实仓库,而本次修复的隔离保证正是「原仓库不被改动」。",
|
|
132
|
+
"",
|
|
133
|
+
"下文出现的相对路径都相对于上述工作目录。",
|
|
134
|
+
])
|
|
135
|
+
lines.extend([
|
|
136
|
+
"",
|
|
137
|
+
"## 缺陷",
|
|
138
|
+
])
|
|
139
|
+
for diag in work_order.get("diagnoses", []):
|
|
140
|
+
lines.append(f"- [{diag.get('kind')}] {diag.get('level')} "
|
|
141
|
+
f"{diag.get('check')}:{diag.get('reason')}")
|
|
142
|
+
# ## 直接给落点,别让 agent 自己去搜
|
|
143
|
+
#
|
|
144
|
+
# 实测对比:同一处 L7-5 缺陷,
|
|
145
|
+
# 只给描述 → agent grep 全仓、读 installer/host_adapters,
|
|
146
|
+
# 180s 预算耗尽仍未改到点子上;
|
|
147
|
+
# 给出文件+符号+改法 → **几秒修完**。
|
|
148
|
+
#
|
|
149
|
+
# 所以把「去哪改」放在缺陷描述的紧后面,而不是让模型去推理。
|
|
150
|
+
# 这些信息本来就是检查函数的常量,白白丢掉只会浪费预算。
|
|
151
|
+
files = diag.get("files") or []
|
|
152
|
+
symbols = diag.get("symbols") or []
|
|
153
|
+
if files:
|
|
154
|
+
lines.append(f" - 相关文件:{', '.join(f'`{f}`' for f in files)}")
|
|
155
|
+
if symbols:
|
|
156
|
+
lines.append(f" - 相关符号:{', '.join(f'`{x}`' for x in symbols)}")
|
|
157
|
+
hint = str(diag.get("hint") or "").strip()
|
|
158
|
+
if hint:
|
|
159
|
+
lines.append(f" - 修改方向:{hint}")
|
|
160
|
+
notes = diag.get("notes") or []
|
|
161
|
+
if notes:
|
|
162
|
+
lines.append(" - 检查内部已知的参照信息(可直接对照):")
|
|
163
|
+
for note in notes:
|
|
164
|
+
lines.append(f" - {note}")
|
|
165
|
+
lines.extend(["", "## 复现方式(先运行确认缺陷存在)"])
|
|
166
|
+
for item in work_order.get("reproduce", []):
|
|
167
|
+
lines.append(f" {item.get('command')}")
|
|
168
|
+
lines.extend([
|
|
169
|
+
"",
|
|
170
|
+
"## 验收标准(必须全部满足,否则视为未修复)",
|
|
171
|
+
"1. 上述复现命令在修改后通过(这是硬性验收)",
|
|
172
|
+
"2. 改动聚焦于本缺陷,不做无关重构",
|
|
173
|
+
"",
|
|
174
|
+
"## 关于全量测试(重要:不要在本次修复里跑)",
|
|
175
|
+
"",
|
|
176
|
+
"**不要在仓库内保留或执行仓库级 `pytest tests/ -q`;验证只能使用目标项目或临时目录。**",
|
|
177
|
+
"",
|
|
178
|
+
"本仓库全量测试有 3600+ 条、约 24 分钟。修复 agent 的预算是分钟级,",
|
|
179
|
+
"一旦开始跑全量测试就会耗尽预算,最终超时被杀——**代码改对了也会被",
|
|
180
|
+
"判成未修复**。这不是推测:实测中 agent 接到「跑全量测试」指令后立刻",
|
|
181
|
+
"开始跑,450s 后超时、零输出,报告「未修复」,而缺陷其实一行就能改好。",
|
|
182
|
+
"",
|
|
183
|
+
"回归验证由调度侧在修复之后统一执行,不需要你跑。只需保证:",
|
|
184
|
+
"- 复现命令通过",
|
|
185
|
+
"- 改动面最小,不顺手改无关代码",
|
|
186
|
+
"- 不修改评测断言",
|
|
187
|
+
"",
|
|
188
|
+
"## 范围限制",
|
|
189
|
+
"禁止修改:",
|
|
190
|
+
"- `verification/evals/golden-findings.json`、`verification/evals/cases.json`(评测断言)",
|
|
191
|
+
"- `verification/evals/*baseline*.json`(基线/门槛)",
|
|
192
|
+
"- 任何以「让评测变绿」为目的的断言调整",
|
|
193
|
+
"",
|
|
194
|
+
f"当前修复模式:{mode}({rsi_scope.mode_description(mode)})",
|
|
195
|
+
"",
|
|
196
|
+
"## 输出",
|
|
197
|
+
"修完直接给出改动即可。不要修改评测断言来「通过」,那不算修复。",
|
|
198
|
+
])
|
|
199
|
+
return "\n".join(lines)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _summarize_stream_json(raw: str) -> str:
|
|
203
|
+
"""把 claude 的 stream-json 事件流压成人类可读的几行。
|
|
204
|
+
|
|
205
|
+
## 为什么要单独处理
|
|
206
|
+
|
|
207
|
+
claude 必须用 ``--output-format stream-json`` 才不挂起(见
|
|
208
|
+
``ONE_SHOT_INVOCATIONS`` 的说明)。但那种格式一次能吐 4000+ 行 JSON
|
|
209
|
+
事件,直接塞进 ``agent_output_tail`` 全是 ``thinking_tokens`` 之类的
|
|
210
|
+
噪声,**真正有用的"它最后说了什么、改了哪些文件"反而被挤没了**。
|
|
211
|
+
|
|
212
|
+
所以按事件类型挑出有信息量的部分:assistant 的文字、tool_use 的名字、
|
|
213
|
+
以及最终 result 的结论与成本。
|
|
214
|
+
"""
|
|
215
|
+
if '"type"' not in raw:
|
|
216
|
+
return raw
|
|
217
|
+
said: list[str] = []
|
|
218
|
+
tools: list[str] = []
|
|
219
|
+
result_note = ""
|
|
220
|
+
for line in raw.splitlines():
|
|
221
|
+
line = line.strip()
|
|
222
|
+
if not line.startswith("{"):
|
|
223
|
+
continue
|
|
224
|
+
try:
|
|
225
|
+
event = json.loads(line)
|
|
226
|
+
except ValueError:
|
|
227
|
+
continue
|
|
228
|
+
if not isinstance(event, dict):
|
|
229
|
+
continue
|
|
230
|
+
kind = event.get("type")
|
|
231
|
+
if kind == "assistant":
|
|
232
|
+
for block in (event.get("message") or {}).get("content") or []:
|
|
233
|
+
if not isinstance(block, dict):
|
|
234
|
+
continue
|
|
235
|
+
if block.get("type") == "text" and block.get("text"):
|
|
236
|
+
said.append(str(block["text"]).strip())
|
|
237
|
+
elif block.get("type") == "tool_use":
|
|
238
|
+
name = block.get("name") or "?"
|
|
239
|
+
tools.append(str(name))
|
|
240
|
+
elif kind == "result":
|
|
241
|
+
result_note = (
|
|
242
|
+
f"[result] stop={event.get('stop_reason')} "
|
|
243
|
+
f"cost=${event.get('total_cost_usd')} "
|
|
244
|
+
f"dur={round((event.get('duration_api_ms') or 0) / 1000)}s"
|
|
245
|
+
)
|
|
246
|
+
lines: list[str] = []
|
|
247
|
+
if tools:
|
|
248
|
+
lines.append("工具调用:" + ", ".join(tools[-12:]))
|
|
249
|
+
if said:
|
|
250
|
+
lines.append("结论:" + " ".join(said[-3:])[:900])
|
|
251
|
+
if result_note:
|
|
252
|
+
lines.append(result_note)
|
|
253
|
+
return "\n".join(lines) if lines else raw
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def _run(argv: list[str], *, cwd: Path, timeout: float,
|
|
257
|
+
env: dict[str, str] | None = None) -> tuple[int, str, str]:
|
|
258
|
+
"""执行命令并**保证失败时有话可说**。
|
|
259
|
+
|
|
260
|
+
实测问题:dsh 额度耗尽时退出码 1,但 stdout/stderr 都是空的(失败发生在
|
|
261
|
+
它自己的启动链路里,早于我们的 stdout 接管)。于是 report 里只剩
|
|
262
|
+
「agent 退出码 1」,空手排查。
|
|
263
|
+
|
|
264
|
+
对策:失败且两者皆空时,主动重跑一次最小探测命令,把宿主的真实状态
|
|
265
|
+
抓回来。这比让接手的人自己试要可靠——他未必知道该试什么。
|
|
266
|
+
"""
|
|
267
|
+
merged = {**os.environ, **(env or {})}
|
|
268
|
+
try:
|
|
269
|
+
proc, idle_killed = _run_with_idle_watchdog(
|
|
270
|
+
argv, cwd=cwd, timeout=timeout, env=merged)
|
|
271
|
+
out, err = proc.stdout or "", proc.stderr or ""
|
|
272
|
+
if idle_killed is not None:
|
|
273
|
+
return 124, out, (
|
|
274
|
+
f"{err}"
|
|
275
|
+
f"\n[卡死判定] agent 连续 {idle_killed:.0f}s 无任何输出,已主动终止"
|
|
276
|
+
f"(超时上限 {timeout:.0f}s,但等满它是浪费——没有输出通常意味着"
|
|
277
|
+
f"卡在等待输入、死循环,或被指令要求去跑一个远超预算的长任务)。"
|
|
278
|
+
f"最后输出:{out[-400:] if out.strip() else '(无)'}"
|
|
279
|
+
).strip()
|
|
280
|
+
if proc.returncode != 0:
|
|
281
|
+
combined = f"{out}\n{err}".strip()
|
|
282
|
+
# 判据不是「有没有字节」,而是「有没有**可诊断的原因**」。
|
|
283
|
+
# 实测两态:
|
|
284
|
+
# a) 沙箱内 dsh 静默失败 → 0 字节,完全无法排查
|
|
285
|
+
# b) 宿主打印了与本次修复无关的启动噪声(如 MCP 初始化失败、
|
|
286
|
+
# HMR 报错)→ 有几百字节,但没一句说明为什么这次调用失败
|
|
287
|
+
# 只看 strip() 为空会漏掉 b。所以用「是否命中已知失败特征,
|
|
288
|
+
# 或是否包含可读的错误语义」来判断,必要时补一次定向探测。
|
|
289
|
+
if not _diagnose_agent_failure(combined, argv[0]):
|
|
290
|
+
probe = _probe_host_banner(argv[0], cwd=cwd, env=merged)
|
|
291
|
+
if probe:
|
|
292
|
+
err = f"{err}\n[宿主状态探测] {probe}".strip()
|
|
293
|
+
return proc.returncode, out, err
|
|
294
|
+
except subprocess.TimeoutExpired as exc:
|
|
295
|
+
# 超时前收到的输出必须保留:它是唯一能说明「卡在哪」的证据。
|
|
296
|
+
partial_out = exc.output if isinstance(exc.output, str) else ""
|
|
297
|
+
partial_err = exc.stderr if isinstance(exc.stderr, str) else ""
|
|
298
|
+
# 取**最后几行**并压成单行,而不是"最后 500 字符"——后者跨行输出时
|
|
299
|
+
# 会把最早的一行显示在最前面,看的人以为 Agent 卡在第一步。
|
|
300
|
+
_raw_tail = (partial_out or partial_err).strip().splitlines()
|
|
301
|
+
tail = " ⏎ ".join(_raw_tail[-5:])
|
|
302
|
+
return 124, partial_out, (
|
|
303
|
+
(partial_err or "")
|
|
304
|
+
+ f"\n[硬超时] 超过 {timeout:.0f}s 上限被终止"
|
|
305
|
+
+ (f";最后输出:{tail[-500:]}" if tail else ";全程无输出")
|
|
306
|
+
).strip()
|
|
307
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
308
|
+
return 127, "", f"{type(exc).__name__}: {exc}"
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class _ProcResult:
|
|
312
|
+
"""子进程结果的最小结构(与 subprocess.CompletedProcess 同构)。"""
|
|
313
|
+
|
|
314
|
+
__slots__ = ("returncode", "stdout", "stderr")
|
|
315
|
+
|
|
316
|
+
def __init__(self, returncode: int, stdout: str, stderr: str) -> None:
|
|
317
|
+
self.returncode = returncode
|
|
318
|
+
self.stdout = stdout
|
|
319
|
+
self.stderr = stderr
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def _run_with_idle_watchdog(argv: list[str], *, cwd: Path, timeout: float,
|
|
323
|
+
env: dict[str, str]
|
|
324
|
+
) -> tuple[_ProcResult, float | None]:
|
|
325
|
+
"""跑子进程,**按「多久没新输出」而不是「总共多久」判卡死**。
|
|
326
|
+
|
|
327
|
+
## 为什么要这个
|
|
328
|
+
|
|
329
|
+
只靠 ``subprocess.run(timeout=...)`` 有两个问题:
|
|
330
|
+
|
|
331
|
+
1. **等满才报**:agent 卡住时我们白等 450~900 秒,然后只拿到
|
|
332
|
+
``exit code 124`` 和空输出,看不出卡在哪。
|
|
333
|
+
2. **把慢任务当卡死**:如果 agent 真的在正常跑一个 3 分钟的命令,
|
|
334
|
+
固定短超时会误杀;而固定长超时又让真卡死拖很久。
|
|
335
|
+
|
|
336
|
+
「输出年龄」同时解决这两点:正常工作会持续吐字,卡死则彻底静默。
|
|
337
|
+
实现上用非阻塞读 + 轮询,记录最后一次收到字节的时间;超过
|
|
338
|
+
``_idle_timeout()`` 没有任何新字节就主动 kill,并把「最后说了什么」
|
|
339
|
+
一并带回去——这比空手等超时有信息量得多。
|
|
340
|
+
|
|
341
|
+
返回 ``(proc, idle_killed_at)``;未被看门狗杀时第二项为 None,
|
|
342
|
+
此时就是普通执行,行为与 ``subprocess.run`` 一致。
|
|
343
|
+
"""
|
|
344
|
+
idle_limit = _idle_timeout()
|
|
345
|
+
started = time.monotonic()
|
|
346
|
+
last_byte = started
|
|
347
|
+
stdout_chunks: list[str] = []
|
|
348
|
+
stderr_chunks: list[str] = []
|
|
349
|
+
|
|
350
|
+
proc = subprocess.Popen(
|
|
351
|
+
argv, cwd=str(cwd), env=env,
|
|
352
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,
|
|
353
|
+
bufsize=1,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
# 用线程各读一路,主线程只负责计时与判死——避免 select 在管道上的平台差异。
|
|
357
|
+
import threading
|
|
358
|
+
|
|
359
|
+
def _reader(stream, sink: list[str]) -> None:
|
|
360
|
+
nonlocal last_byte
|
|
361
|
+
if stream is None:
|
|
362
|
+
return
|
|
363
|
+
try:
|
|
364
|
+
for line in iter(stream.readline, ""):
|
|
365
|
+
sink.append(line)
|
|
366
|
+
last_byte = time.monotonic()
|
|
367
|
+
except (ValueError, OSError):
|
|
368
|
+
return
|
|
369
|
+
|
|
370
|
+
threads = [
|
|
371
|
+
threading.Thread(target=_reader, args=(proc.stdout, stdout_chunks), daemon=True),
|
|
372
|
+
threading.Thread(target=_reader, args=(proc.stderr, stderr_chunks), daemon=True),
|
|
373
|
+
]
|
|
374
|
+
for thread in threads:
|
|
375
|
+
thread.start()
|
|
376
|
+
|
|
377
|
+
idle_killed: float | None = None
|
|
378
|
+
while True:
|
|
379
|
+
if proc.poll() is not None:
|
|
380
|
+
break
|
|
381
|
+
now = time.monotonic()
|
|
382
|
+
silent_for = now - last_byte
|
|
383
|
+
if silent_for >= idle_limit:
|
|
384
|
+
idle_killed = silent_for
|
|
385
|
+
proc.kill()
|
|
386
|
+
proc.wait(timeout=5)
|
|
387
|
+
break
|
|
388
|
+
if now - started >= timeout:
|
|
389
|
+
proc.kill()
|
|
390
|
+
proc.wait(timeout=5)
|
|
391
|
+
# ## 超时也必须把已收到的输出带回去
|
|
392
|
+
#
|
|
393
|
+
# 实测:agent 跑了 300 秒,期间打印了几十行,但超时分支只抛
|
|
394
|
+
# TimeoutExpired,调用方拿到 out="" err="timeout after 300s",
|
|
395
|
+
# 那些行全丢了——而它们正是判断「它到底卡在哪一步」的唯一线索。
|
|
396
|
+
#
|
|
397
|
+
# 所以先补线程、把缓冲拼好,随异常一起交出去。
|
|
398
|
+
for thread in threads:
|
|
399
|
+
thread.join(timeout=2)
|
|
400
|
+
raise subprocess.TimeoutExpired(
|
|
401
|
+
argv, timeout,
|
|
402
|
+
output="".join(stdout_chunks),
|
|
403
|
+
stderr="".join(stderr_chunks),
|
|
404
|
+
)
|
|
405
|
+
time.sleep(0.25)
|
|
406
|
+
|
|
407
|
+
for thread in threads:
|
|
408
|
+
thread.join(timeout=2)
|
|
409
|
+
|
|
410
|
+
return (
|
|
411
|
+
_ProcResult(proc.returncode or 0, "".join(stdout_chunks),
|
|
412
|
+
"".join(stderr_chunks)),
|
|
413
|
+
idle_killed,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def _probe_host_banner(executable: str, *, cwd: Path,
|
|
418
|
+
env: dict[str, str]) -> str:
|
|
419
|
+
"""宿主静默失败时,用一个最小调用把它的真实状态探回来。
|
|
420
|
+
|
|
421
|
+
只探一次、短超时、只要一次输出——目的是「有话可说」,不是完整诊断。
|
|
422
|
+
"""
|
|
423
|
+
try:
|
|
424
|
+
proc = subprocess.run(
|
|
425
|
+
[executable, "--profile", "headless", "reply with: OK"],
|
|
426
|
+
cwd=str(cwd), capture_output=True, text=True, timeout=60.0,
|
|
427
|
+
env=env, check=False,
|
|
428
|
+
)
|
|
429
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
430
|
+
return f"{type(exc).__name__}: {exc}"
|
|
431
|
+
text = ((proc.stdout or "") + (proc.stderr or "")).strip()
|
|
432
|
+
return text[-600:]
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
#: 已知的宿主外部失败特征。命中即点名,省去人工翻日志。
|
|
436
|
+
_AGENT_FAILURE_SIGNATURES: tuple[tuple[str, str], ...] = (
|
|
437
|
+
("insufficient balance", "宿主账户额度不足,非代码缺陷"),
|
|
438
|
+
("quota", "宿主账户额度不足,非代码缺陷"),
|
|
439
|
+
("rate limit", "宿主限流,稍后重试"),
|
|
440
|
+
("authentication", "宿主鉴权失败,检查登录状态"),
|
|
441
|
+
("unauthorized", "宿主鉴权失败,检查登录状态"),
|
|
442
|
+
("initialization_required", "宿主启动期初始化失败(工作目录缺少宿主所需状态)"),
|
|
443
|
+
("command not found", "宿主可执行文件不在 PATH"),
|
|
444
|
+
# 实测:claude 在收到较长提示词时只吐这一行就退出(exit 0),
|
|
445
|
+
# 没有任何实际工作。看起来像"成功",但什么都没改——必须点名,
|
|
446
|
+
# 否则会当成"agent 没能力修复"而反复重跑。
|
|
447
|
+
# 根因在宿主侧模型别名未注册(它仍会打印 PONG 之类简单回复,
|
|
448
|
+
# 所以"能跑通"不等于"能干活")。
|
|
449
|
+
("unrecognized_model",
|
|
450
|
+
"claude 的遥测警告(第三方 baseURL 下模型别名不在官方目录)。"
|
|
451
|
+
"**这行无害,能正常干活**——真正的静默挂起另有原因:"
|
|
452
|
+
"默认 --output-format text 在管道下攒输出不发,长任务会卡死。"
|
|
453
|
+
"已在 ONE_SHOT_INVOCATIONS 里改用 stream-json + --verbose"),
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def _diagnose_agent_failure(output: str, host: str) -> str:
|
|
458
|
+
"""把宿主失败输出映射成人话。命中不了就返回空串,不猜。"""
|
|
459
|
+
lowered = output.lower()
|
|
460
|
+
for needle, meaning in _AGENT_FAILURE_SIGNATURES:
|
|
461
|
+
if needle in lowered:
|
|
462
|
+
return f"{meaning}:{host}"
|
|
463
|
+
return ""
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
#: 计算原仓库指纹时跳过的目录:体积大、与修复无关、且每次运行都会变。
|
|
467
|
+
_FINGERPRINT_SKIP = frozenset({
|
|
468
|
+
".git", "__pycache__", "node_modules", ".venv", "dist", "build",
|
|
469
|
+
".bugx", ".mypy_cache", ".pytest_cache", ".ruff_cache",
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
#: 只对文本类源码取指纹。二进制/大文件既拖慢又无意义。
|
|
473
|
+
_FINGERPRINT_EXTS = frozenset({
|
|
474
|
+
".py", ".md", ".json", ".yaml", ".yml", ".toml", ".txt", ".sh",
|
|
475
|
+
".js", ".ts", ".jsx", ".tsx", ".cfg", ".ini",
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
def _tree_fingerprint(root: Path, *, limit: int = 4000) -> dict[str, str]:
|
|
480
|
+
"""整树的 ``相对路径 -> sha256`` 指纹,用于证明原仓库未被改动。
|
|
481
|
+
|
|
482
|
+
``limit`` 是防止在巨型仓库上把一次修复拖成几分钟的闸门;超过后
|
|
483
|
+
按路径排序截断——截断只会降低检测灵敏度,不会制造误报。
|
|
484
|
+
"""
|
|
485
|
+
import hashlib
|
|
486
|
+
result: dict[str, str] = {}
|
|
487
|
+
count = 0
|
|
488
|
+
for path in sorted(root.rglob("*")):
|
|
489
|
+
if len(result) >= limit or count > limit * 4:
|
|
490
|
+
break
|
|
491
|
+
count += 1
|
|
492
|
+
if not path.is_file() or path.is_symlink():
|
|
493
|
+
continue
|
|
494
|
+
if _FINGERPRINT_SKIP & set(path.relative_to(root).parts):
|
|
495
|
+
continue
|
|
496
|
+
if path.suffix not in _FINGERPRINT_EXTS:
|
|
497
|
+
continue
|
|
498
|
+
try:
|
|
499
|
+
result[str(path.relative_to(root))] = hashlib.sha256(
|
|
500
|
+
path.read_bytes()
|
|
501
|
+
).hexdigest()
|
|
502
|
+
except OSError:
|
|
503
|
+
continue
|
|
504
|
+
return result
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
def _agent_command(host: str, prompt: str) -> list[str]:
|
|
508
|
+
"""构造宿主 agent 的一次性调用命令。"""
|
|
509
|
+
from core.host_runtime import host_registry as hr
|
|
510
|
+
import shutil as _shutil
|
|
511
|
+
|
|
512
|
+
plugin = hr.host_plugin(host)
|
|
513
|
+
executable = _shutil.which(host)
|
|
514
|
+
if executable is None:
|
|
515
|
+
raise RuntimeError(f"宿主 {host} 不在 PATH 中")
|
|
516
|
+
argv = [executable]
|
|
517
|
+
if plugin is not None:
|
|
518
|
+
node_flags = getattr(plugin.engine_run, "engine_run_node_flags", ())
|
|
519
|
+
real = hr._real_node_binary() if node_flags else None
|
|
520
|
+
if real and node_flags:
|
|
521
|
+
argv = [str(real), *node_flags, executable]
|
|
522
|
+
return [*argv, *_one_shot_args(host, prompt)]
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
#: 各宿主的「一次性执行、打印结果后退出」参数。
|
|
526
|
+
#:
|
|
527
|
+
#: 这三个都不一样,硬编码其中任何一个都会让另外两个无法工作:
|
|
528
|
+
#:
|
|
529
|
+
#: dsh --profile headless <prompt> 需要 profile 栈
|
|
530
|
+
#: opencode run <prompt> 子命令形式
|
|
531
|
+
#: claude -p <prompt> 标志形式
|
|
532
|
+
#:
|
|
533
|
+
#: 早先只写了 dsh 的形式,于是「换宿主验证」这件事在代码层面就不可能——
|
|
534
|
+
#: 不是我找不到可用 provider,而是构造命令的那段只认 dsh。
|
|
535
|
+
ONE_SHOT_INVOCATIONS: dict[str, tuple[str, ...]] = {
|
|
536
|
+
"dsh": ("--profile", "headless"),
|
|
537
|
+
"opencode": ("run",),
|
|
538
|
+
# claude 需要三个参数配合,缺任一都不可用:
|
|
539
|
+
#
|
|
540
|
+
# 1. `--dangerously-skip-permissions`
|
|
541
|
+
# 默认每次写文件都弹权限确认。headless(-p)下没有 TTY 可确认,
|
|
542
|
+
# agent 会在「想改但改不了」上反复重试直到预算耗尽。沙箱本就是
|
|
543
|
+
# 隔离副本,放行安全。
|
|
544
|
+
#
|
|
545
|
+
# 2. `--output-format stream-json`
|
|
546
|
+
# **这是"静默挂起"的真凶。** 默认的 text 格式在管道下会把输出
|
|
547
|
+
# 攒着不发,长任务直接卡死:实测同一命令重复 5 次全部 0 字节并
|
|
548
|
+
# 挂到超时,而换成 stream-json 立刻正常——68s 完成、4412 行事件、
|
|
549
|
+
# stop_reason=end_turn、文件确实被改对。
|
|
550
|
+
#
|
|
551
|
+
# 3. `--verbose`
|
|
552
|
+
# stream-json 要求它,否则 claude 直接报错退出。
|
|
553
|
+
#
|
|
554
|
+
# 排查时被 `[claude-code:unrecognized_model]` 那行带偏过:它只是遥测
|
|
555
|
+
# 警告(第三方 baseURL 下模型别名不在官方目录),短提示词照样能答
|
|
556
|
+
# PONG——**能跑通不等于能干活**。
|
|
557
|
+
"claude": ("--dangerously-skip-permissions", "-p",
|
|
558
|
+
"--output-format", "stream-json", "--verbose"),
|
|
559
|
+
# codex 要求工作目录是 git 仓库。**不能**用 --skip-git-repo-check 绕过:
|
|
560
|
+
# 项目契约(core/hosts/codex.py、tests/test_host_plugins.py)明确禁止——
|
|
561
|
+
# 该 flag 会顺手放开宿主目录信任边界,把「前置门禁失效」伪装成「跑得通」。
|
|
562
|
+
#
|
|
563
|
+
# 正确做法是让候选树成为合规目标:见 attempt_fix 里给沙箱建的最小 .git。
|
|
564
|
+
# 真缺 .git 就让 codex 自己报 Not inside a trusted directory,不静默降级。
|
|
565
|
+
"codex": ("exec",),
|
|
566
|
+
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
def _host_key(host: str) -> str:
|
|
571
|
+
"""把宿主标识归一成 ``ONE_SHOT_INVOCATIONS`` 的键。
|
|
572
|
+
|
|
573
|
+
* 已知宿主名 → 原样返回
|
|
574
|
+
* 路径(含分隔符)→ 用可执行文件名匹配;仍不识别则按 ``dsh`` 处理
|
|
575
|
+
|
|
576
|
+
为什么路径默认 ``dsh``:测试用假宿主可执行文件模拟各种 agent 行为,
|
|
577
|
+
它们都遵循「在 cwd 里就地改文件」这一 dsh 语义。让假宿主必须伪造一个
|
|
578
|
+
已知宿主名,会把测试绑在实现细节上。
|
|
579
|
+
"""
|
|
580
|
+
if host in ONE_SHOT_INVOCATIONS:
|
|
581
|
+
return host
|
|
582
|
+
name = Path(host).name
|
|
583
|
+
if name in ONE_SHOT_INVOCATIONS:
|
|
584
|
+
return name
|
|
585
|
+
if os.sep in host or host.startswith("."):
|
|
586
|
+
return "dsh"
|
|
587
|
+
return host
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
def _one_shot_args(host: str, prompt: str) -> list[str]:
|
|
591
|
+
"""按宿主拼一次性执行参数。
|
|
592
|
+
|
|
593
|
+
未知宿主不做猜测——猜错的调用会静默跑成别的模式(例如 opencode 交互
|
|
594
|
+
模式会挂住等待输入)。宁可显式失败。
|
|
595
|
+
|
|
596
|
+
``host`` 可以是宿主名(``opencode``)也可以是可执行文件路径
|
|
597
|
+
(``/tmp/xxx/fakehost``)。后者用于测试里的假宿主:它没有名字,
|
|
598
|
+
但通常实现的是 dsh 风格(读 cwd、直接改文件)。判据放在
|
|
599
|
+
``_host_key`` 里,避免这里堆积特例。
|
|
600
|
+
"""
|
|
601
|
+
prefix = ONE_SHOT_INVOCATIONS.get(_host_key(host))
|
|
602
|
+
if prefix is None:
|
|
603
|
+
raise RuntimeError(
|
|
604
|
+
f"未知宿主 {host!r} 的一次性执行方式。已支持:"
|
|
605
|
+
f"{sorted(ONE_SHOT_INVOCATIONS)}。"
|
|
606
|
+
"新增宿主时请在 ONE_SHOT_INVOCATIONS 里登记其"
|
|
607
|
+
"「执行一次并退出」的参数形式。"
|
|
608
|
+
)
|
|
609
|
+
return [*prefix, prompt]
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
def attempt_fix(work_order: dict, *, host: str = "dsh", root: Path | None = None,
|
|
613
|
+
timeout: float = DEFAULT_FIX_TIMEOUT,
|
|
614
|
+
regression_timeout: float = DEFAULT_REGRESSION_TIMEOUT,
|
|
615
|
+
mode: str | None = None,
|
|
616
|
+
regression_commands: list[list[str]] | None = None
|
|
617
|
+
) -> dict[str, object]:
|
|
618
|
+
"""在隔离副本里尝试修复。原仓库不会被改动。
|
|
619
|
+
|
|
620
|
+
返回报告;``applied`` 为 True 时报告里带 ``diff``,由调用方决定是否落盘。
|
|
621
|
+
"""
|
|
622
|
+
root = (root or REPO_ROOT).resolve()
|
|
623
|
+
mode = mode or rsi_scope.current_mode()
|
|
624
|
+
started = time.monotonic()
|
|
625
|
+
report: dict[str, object] = {
|
|
626
|
+
"attempted": True, "host": host, "mode": mode, "applied": False,
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
sandbox = Path(tempfile.mkdtemp(prefix="bugx-fix-"))
|
|
630
|
+
tree = sandbox / "tree"
|
|
631
|
+
try:
|
|
632
|
+
# 只复制必要内容:整仓含 .git 会非常慢,且 agent 不需要历史。
|
|
633
|
+
shutil.copytree(
|
|
634
|
+
root, tree,
|
|
635
|
+
ignore=shutil.ignore_patterns(
|
|
636
|
+
".git", "__pycache__", "*.pyc", ".bugx", "dist", "build",
|
|
637
|
+
"node_modules", ".venv",
|
|
638
|
+
),
|
|
639
|
+
)
|
|
640
|
+
# ## 候选树必须是「合规的 Git 仓库」,否则 codex 拒绝启动
|
|
641
|
+
#
|
|
642
|
+
# 复制时剥掉 `.git` 是对的(整仓历史极慢,agent 也不需要),但
|
|
643
|
+
# ``codex exec`` 要求 cwd 在 Git 仓库内。第一版用
|
|
644
|
+
# ``--skip-git-repo-check`` 绕过——**那是错的**:该 flag 会顺手放开
|
|
645
|
+
# 宿主自己的目录信任边界,把「前置门禁失效」伪装成「跑得通」,
|
|
646
|
+
# 与 ``core/hosts/codex.py`` 的契约直接冲突(那边明文禁止)。
|
|
647
|
+
#
|
|
648
|
+
# 正确做法是让目标本身合规:给沙箱建一个**空的** ``.git``,
|
|
649
|
+
# 既满足 codex 的判据,又完整保留目录信任边界。不复制原仓库历史
|
|
650
|
+
# 是因为 agent 不需要,且会让沙箱准备慢一个数量级。
|
|
651
|
+
_ensure_scratch_git(tree)
|
|
652
|
+
before_snapshot = rsi_scope.snapshot(tree)
|
|
653
|
+
# 原仓库指纹:用来在事后证明「隔离真的隔离了」。
|
|
654
|
+
#
|
|
655
|
+
# 实测事故:opencode 无视 cwd,直接 cd 到被修复的仓库本身开工,
|
|
656
|
+
# 把注入的缺陷改好了。而 PoC 在真正的沙箱里跑(缺陷仍在),于是
|
|
657
|
+
# 报告「未能修复」——原仓库被静默污染,故障却记在 agent 头上。
|
|
658
|
+
#
|
|
659
|
+
# 提示词已钉死绝对路径,但不能只靠模型守规矩:这道断言让污染
|
|
660
|
+
# **可见**。宁可报告一次失败,也不接受"看起来修好了"。
|
|
661
|
+
#
|
|
662
|
+
# 判据用「整树文件指纹」而不是 rsi_scope.snapshot 的 content_digests:
|
|
663
|
+
# 后者只覆盖 evals 断言文件(实测 2 条),拿它查污染既漏报
|
|
664
|
+
# (源码被改看不见)又误报(假宿主合法改写 evals 就算"污染")。
|
|
665
|
+
origin_fingerprint = _tree_fingerprint(root)
|
|
666
|
+
|
|
667
|
+
prompt = build_fix_prompt(work_order, mode=mode, tree=tree)
|
|
668
|
+
try:
|
|
669
|
+
argv = _agent_command(host, prompt)
|
|
670
|
+
except RuntimeError as exc:
|
|
671
|
+
report["error"] = str(exc)
|
|
672
|
+
return report
|
|
673
|
+
|
|
674
|
+
rc, out, err = _run(argv, cwd=tree, timeout=timeout)
|
|
675
|
+
report["agent_exit_code"] = rc
|
|
676
|
+
combined = (out or "") + (("\n" + err) if err else "")
|
|
677
|
+
report["agent_output_tail"] = _summarize_stream_json(combined)[-1500:]
|
|
678
|
+
if rc != 0:
|
|
679
|
+
# 空输出是最难排查的失败:退出码 1 但什么都没说,接手的人只能
|
|
680
|
+
# 从头复现。实测:dsh 在额度耗尽时启动阶段就失败,stdout/stderr
|
|
681
|
+
# 均为空,report 里只剩 "agent 退出码 1"。
|
|
682
|
+
#
|
|
683
|
+
# 所以这里要做三件事:给出可执行的排查指令、附上实际命令、
|
|
684
|
+
# 并在能识别出已知外部原因时直接点名(额度/鉴权/网络)。
|
|
685
|
+
diagnosis = _diagnose_agent_failure(combined, host)
|
|
686
|
+
# ## 我们自己产生的诊断不能被当成"没有诊断"
|
|
687
|
+
#
|
|
688
|
+
# 实测:`_run` 在卡死/超时时会往 stderr 写 `[卡死判定] ...`
|
|
689
|
+
# `[硬超时] ... 最后输出:...`,但这里只问 `_diagnose_agent_failure`
|
|
690
|
+
# 认不认识这些外部宿主特征——它不认识,于是整段被丢掉,报告里
|
|
691
|
+
# 只剩「agent 退出码 124」。**采集到的证据在最后一米被扔了。**
|
|
692
|
+
#
|
|
693
|
+
# 判据要分开:外部特征用于「点名原因」,自产标记用于「保留证据」。
|
|
694
|
+
self_evident = (
|
|
695
|
+
"[卡死判定]" in combined or "[硬超时]" in combined
|
|
696
|
+
or "[宿主状态探测]" in combined
|
|
697
|
+
)
|
|
698
|
+
report["error"] = (
|
|
699
|
+
f"agent 退出码 {rc}"
|
|
700
|
+
+ (f"({diagnosis})" if diagnosis else "")
|
|
701
|
+
+ (";输出为空,可用同一命令手动复现:" if not combined.strip()
|
|
702
|
+
else "")
|
|
703
|
+
+ (f" {' '.join(argv[:3])} ..." if not combined.strip() else "")
|
|
704
|
+
)
|
|
705
|
+
if self_evident:
|
|
706
|
+
report["error"] += f";{combined.strip()[-700:]}"
|
|
707
|
+
report["command"] = argv
|
|
708
|
+
return report
|
|
709
|
+
|
|
710
|
+
# 断言守卫:agent 可能顺手改了评测断言
|
|
711
|
+
after_snapshot = rsi_scope.snapshot(tree)
|
|
712
|
+
violations = rsi_scope.check_assertion_change(
|
|
713
|
+
before_snapshot, after_snapshot, mode=mode,
|
|
714
|
+
)
|
|
715
|
+
report["assertion_violations"] = violations
|
|
716
|
+
if violations:
|
|
717
|
+
report["error"] = "改动越界,已丢弃"
|
|
718
|
+
return report
|
|
719
|
+
|
|
720
|
+
# 双向门禁之一:复现命令必须通过
|
|
721
|
+
poc_clean = 0
|
|
722
|
+
for item in work_order.get("reproduce", []):
|
|
723
|
+
command = str(item.get("command") or "")
|
|
724
|
+
if not command:
|
|
725
|
+
continue
|
|
726
|
+
poc_rc, poc_out, poc_err = _run(
|
|
727
|
+
command.split(), cwd=tree, timeout=regression_timeout,
|
|
728
|
+
)
|
|
729
|
+
report.setdefault("poc_results", []).append({
|
|
730
|
+
"command": command, "exit_code": poc_rc,
|
|
731
|
+
"tail": (poc_out or poc_err)[-500:],
|
|
732
|
+
})
|
|
733
|
+
if poc_rc != 0:
|
|
734
|
+
poc_clean += 1
|
|
735
|
+
# 原仓库未被改动?在判定 PoC 之前先查——污染是比"没修好"更严重的事。
|
|
736
|
+
after_origin = _tree_fingerprint(root)
|
|
737
|
+
touched = sorted(
|
|
738
|
+
name for name, digest in after_origin.items()
|
|
739
|
+
if name in origin_fingerprint and origin_fingerprint[name] != digest
|
|
740
|
+
)
|
|
741
|
+
if touched:
|
|
742
|
+
report["origin_modified"] = touched[:20]
|
|
743
|
+
report["error"] = (
|
|
744
|
+
"宿主 agent 改动了原仓库(隔离失效):" + "、".join(touched[:5])
|
|
745
|
+
+ "。本次修复结果不可信,已丢弃。"
|
|
746
|
+
)
|
|
747
|
+
report["applied"] = False
|
|
748
|
+
return report
|
|
749
|
+
|
|
750
|
+
report["poc_passed"] = poc_clean == 0
|
|
751
|
+
if poc_clean:
|
|
752
|
+
report["error"] = "复现命令仍未通过"
|
|
753
|
+
return report
|
|
754
|
+
|
|
755
|
+
# 双向门禁之二:既有测试不得退化。
|
|
756
|
+
#
|
|
757
|
+
# ``regression_commands`` 让调用方指定「对本缺陷有意义的回归集」。
|
|
758
|
+
# L7 的修复只需重跑 l7_selfcheck(0.00s),没必要跑全量 pytest
|
|
759
|
+
# (数分钟)——门禁要拦的是「改坏别处」,不是「必须跑全量」。
|
|
760
|
+
# 缺省仍在目标项目中运行其自身测试,仓库本身不提供 tests/ 目录。
|
|
761
|
+
if regression_commands:
|
|
762
|
+
for argv in regression_commands:
|
|
763
|
+
reg_rc, reg_out, reg_err = _run(
|
|
764
|
+
list(argv), cwd=tree, timeout=regression_timeout,
|
|
765
|
+
)
|
|
766
|
+
report.setdefault("regression_results", []).append({
|
|
767
|
+
"command": " ".join(str(a) for a in argv),
|
|
768
|
+
"exit_code": reg_rc,
|
|
769
|
+
"tail": (reg_out or reg_err)[-600:],
|
|
770
|
+
})
|
|
771
|
+
if reg_rc != 0:
|
|
772
|
+
report["regression_passed"] = False
|
|
773
|
+
report["error"] = "回归命令退化,已丢弃改动"
|
|
774
|
+
return report
|
|
775
|
+
report["regression_passed"] = True
|
|
776
|
+
test_dir = tree / "tests"
|
|
777
|
+
if not regression_commands and test_dir.is_dir():
|
|
778
|
+
reg_rc, reg_out, reg_err = _run(
|
|
779
|
+
[sys.executable, "-m", "pytest", "tests/", "-q", "-x",
|
|
780
|
+
"--timeout=120"],
|
|
781
|
+
cwd=tree, timeout=regression_timeout,
|
|
782
|
+
)
|
|
783
|
+
report["regression_exit_code"] = reg_rc
|
|
784
|
+
report["regression_tail"] = (reg_out or reg_err)[-1200:]
|
|
785
|
+
report["regression_passed"] = reg_rc == 0
|
|
786
|
+
if reg_rc != 0:
|
|
787
|
+
report["error"] = "回归测试退化,已丢弃改动"
|
|
788
|
+
return report
|
|
789
|
+
elif not regression_commands:
|
|
790
|
+
report["regression_passed"] = None
|
|
791
|
+
|
|
792
|
+
# 取回 diff(不含被禁文件)
|
|
793
|
+
diff_rc, diff_out, _ = _run(
|
|
794
|
+
["git", "diff", "--no-index", "--no-color", "--", "."],
|
|
795
|
+
cwd=tree, timeout=120.0,
|
|
796
|
+
)
|
|
797
|
+
# 没有 git 仓库,改用逐文件比对:这里只报告改动的文件清单即可,
|
|
798
|
+
# 真正的补丁由调用方在原仓库重放或人工审阅。
|
|
799
|
+
changed = _changed_files(root, tree)
|
|
800
|
+
report["changed_files"] = changed
|
|
801
|
+
blocked = [
|
|
802
|
+
path for path in changed
|
|
803
|
+
if path in rsi_scope.ASSERTION_FILES
|
|
804
|
+
or path in rsi_scope.FORBIDDEN_FILES
|
|
805
|
+
]
|
|
806
|
+
if blocked:
|
|
807
|
+
report["error"] = f"改动了被禁文件:{blocked}"
|
|
808
|
+
report["assertion_violations"] = [f"改动 {p}" for p in blocked]
|
|
809
|
+
return report
|
|
810
|
+
|
|
811
|
+
report["applied"] = False # 从不自动写入原仓库,只交回候选改动
|
|
812
|
+
report["candidate_tree"] = str(tree)
|
|
813
|
+
report["duration_seconds"] = round(time.monotonic() - started, 2)
|
|
814
|
+
report["verified"] = True
|
|
815
|
+
return report
|
|
816
|
+
except (OSError, shutil.Error) as exc:
|
|
817
|
+
report["error"] = f"{type(exc).__name__}: {exc}"
|
|
818
|
+
return report
|
|
819
|
+
finally:
|
|
820
|
+
# 保留候选树供人工取用;没有候选时立即删掉
|
|
821
|
+
if not report.get("candidate_tree"):
|
|
822
|
+
shutil.rmtree(sandbox, ignore_errors=True)
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
def _ensure_scratch_git(tree: Path) -> None:
|
|
826
|
+
"""给候选树建一个空的 Git 仓库(无历史、无提交)。
|
|
827
|
+
|
|
828
|
+
只为满足 ``codex exec`` 的「cwd 必须在 Git 仓库内」判据。**不**用
|
|
829
|
+
``--skip-git-repo-check`` 绕过,因为那个 flag 会放开宿主目录信任边界。
|
|
830
|
+
|
|
831
|
+
失败不致命:其它宿主(opencode/claude/dsh)不需要 .git。所以这里
|
|
832
|
+
只尽力而为,不抛异常——真要是 codex 用到又建不出来,它自己会报
|
|
833
|
+
``Not inside a trusted directory``,比静默降级清楚。
|
|
834
|
+
"""
|
|
835
|
+
git_dir = tree / ".git"
|
|
836
|
+
if git_dir.exists():
|
|
837
|
+
return
|
|
838
|
+
try:
|
|
839
|
+
subprocess.run(
|
|
840
|
+
["git", "init", "--quiet", "--initial-branch", "scratch"],
|
|
841
|
+
cwd=str(tree), capture_output=True, text=True, timeout=30,
|
|
842
|
+
check=False,
|
|
843
|
+
)
|
|
844
|
+
except (OSError, subprocess.SubprocessError):
|
|
845
|
+
pass
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
def _changed_files(original: Path, candidate: Path) -> list[str]:
|
|
849
|
+
"""比对两棵树,返回内容不同的相对路径。"""
|
|
850
|
+
changed: list[str] = []
|
|
851
|
+
skip = {".git", "__pycache__", ".bugx", "dist", "build", "node_modules"}
|
|
852
|
+
for path in candidate.rglob("*"):
|
|
853
|
+
if not path.is_file():
|
|
854
|
+
continue
|
|
855
|
+
rel = path.relative_to(candidate)
|
|
856
|
+
if any(part in skip for part in rel.parts):
|
|
857
|
+
continue
|
|
858
|
+
target = original / rel
|
|
859
|
+
if not target.is_file():
|
|
860
|
+
changed.append(str(rel))
|
|
861
|
+
continue
|
|
862
|
+
try:
|
|
863
|
+
if path.read_bytes() != target.read_bytes():
|
|
864
|
+
changed.append(str(rel))
|
|
865
|
+
except OSError:
|
|
866
|
+
continue
|
|
867
|
+
return sorted(changed)
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
def main(argv: list[str] | None = None) -> int:
|
|
871
|
+
import argparse
|
|
872
|
+
|
|
873
|
+
parser = argparse.ArgumentParser(description="派宿主 agent 修 BUGX 自身缺陷")
|
|
874
|
+
parser.add_argument("--work-order", required=True, help="work-order.json 路径")
|
|
875
|
+
parser.add_argument("--host", default="dsh")
|
|
876
|
+
parser.add_argument("--timeout", type=float, default=DEFAULT_FIX_TIMEOUT)
|
|
877
|
+
parser.add_argument("--json", action="store_true")
|
|
878
|
+
args = parser.parse_args(argv)
|
|
879
|
+
|
|
880
|
+
path = Path(args.work_order).expanduser()
|
|
881
|
+
if not path.is_file():
|
|
882
|
+
print(f"工作单不存在:{path}", file=sys.stderr)
|
|
883
|
+
return 2
|
|
884
|
+
try:
|
|
885
|
+
work_order = json.loads(path.read_text(encoding="utf-8"))
|
|
886
|
+
except (OSError, ValueError) as exc:
|
|
887
|
+
print(f"工作单无法解析:{exc}", file=sys.stderr)
|
|
888
|
+
return 2
|
|
889
|
+
|
|
890
|
+
report = attempt_fix(work_order, host=args.host, timeout=args.timeout)
|
|
891
|
+
if args.json:
|
|
892
|
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
|
893
|
+
else:
|
|
894
|
+
print(f"模式:{report.get('mode')} 宿主:{report.get('host')}")
|
|
895
|
+
if report.get("error"):
|
|
896
|
+
print(f"✗ {report['error']}")
|
|
897
|
+
elif report.get("verified"):
|
|
898
|
+
print("✓ 双向门禁通过")
|
|
899
|
+
for name in report.get("changed_files", []):
|
|
900
|
+
print(f" 改动:{name}")
|
|
901
|
+
print(f"候选树:{report.get('candidate_tree')}")
|
|
902
|
+
else:
|
|
903
|
+
print("未完成")
|
|
904
|
+
for violation in report.get("assertion_violations", []):
|
|
905
|
+
print(f" ! {violation[:120]}")
|
|
906
|
+
return 0 if report.get("verified") else 1
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
if __name__ == "__main__":
|
|
910
|
+
sys.exit(main())
|