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,879 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""launch_phases/startup_version_gate.py - 启动版本一致性门禁与远端更新检查。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import datetime as dt
|
|
7
|
+
import functools
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import re
|
|
11
|
+
import sys
|
|
12
|
+
import threading
|
|
13
|
+
import time
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from core.launch_phases.common import (
|
|
18
|
+
AGENT_DIR,
|
|
19
|
+
HOST_DISPLAY_NAMES,
|
|
20
|
+
ISOLATED_REMOTE_VERSION_RESULT,
|
|
21
|
+
resolve_project_root,
|
|
22
|
+
uses_project_layout,
|
|
23
|
+
child_environment,
|
|
24
|
+
run_child,
|
|
25
|
+
POLLING_DECISION_REQUIRED,
|
|
26
|
+
bugx_paths,
|
|
27
|
+
bugx_logging,
|
|
28
|
+
)
|
|
29
|
+
import shutil
|
|
30
|
+
import subprocess
|
|
31
|
+
import core.secure_atomic as secure_atomic
|
|
32
|
+
from core.launch_phases.session_runtime import (
|
|
33
|
+
iso_time,
|
|
34
|
+
load_runtime,
|
|
35
|
+
save_runtime,
|
|
36
|
+
append_runtime_event,
|
|
37
|
+
runtime_lock,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
from core.launch_phases.common import resolve_project_root as _orig_resolve_project_root
|
|
44
|
+
from core.launch_phases.session_runtime import load_runtime as _orig_load_runtime, save_runtime as _orig_save_runtime
|
|
45
|
+
|
|
46
|
+
def _sg():
|
|
47
|
+
"""已加载的 ``startup_gates`` 模块(点分名优先,扁平名仅为归档布局兼容)。"""
|
|
48
|
+
return (sys.modules.get("core.launch_phases.startup_gates")
|
|
49
|
+
or sys.modules.get("launch_phases.startup_gates"))
|
|
50
|
+
|
|
51
|
+
def _sg_dispatch(name, fallback_fn=None):
|
|
52
|
+
def wrapper(*args, **kwargs):
|
|
53
|
+
sg = _sg()
|
|
54
|
+
if sg is not None and hasattr(sg, name):
|
|
55
|
+
target = getattr(sg, name)
|
|
56
|
+
if target is not wrapper:
|
|
57
|
+
return target(*args, **kwargs)
|
|
58
|
+
if fallback_fn is not None:
|
|
59
|
+
return fallback_fn(*args, **kwargs)
|
|
60
|
+
raise RuntimeError(f"{name} not available and no fallback provided")
|
|
61
|
+
wrapper.__name__ = name
|
|
62
|
+
return wrapper
|
|
63
|
+
|
|
64
|
+
def _orig_maybe_onboard(*args, **kwargs):
|
|
65
|
+
try:
|
|
66
|
+
from core.cloud_sync.onboard_wizard import maybe_onboard as fn
|
|
67
|
+
return fn(*args, **kwargs)
|
|
68
|
+
except Exception:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
def _orig_get_state(*args, **kwargs):
|
|
72
|
+
try:
|
|
73
|
+
from core.cloud_sync.cloud_onboard import get_state as fn
|
|
74
|
+
return fn(*args, **kwargs)
|
|
75
|
+
except Exception:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
def _orig_set_state(*args, **kwargs):
|
|
79
|
+
try:
|
|
80
|
+
from core.cloud_sync.cloud_onboard import set_state as fn
|
|
81
|
+
return fn(*args, **kwargs)
|
|
82
|
+
except Exception:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
def _orig_sync_layers(*args, **kwargs):
|
|
86
|
+
try:
|
|
87
|
+
from core.cloud_sync.cloud_onboard import sync_layers as fn
|
|
88
|
+
return fn(*args, **kwargs)
|
|
89
|
+
except Exception:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
def _orig_uses_project_layout(*args, **kwargs):
|
|
93
|
+
from core.launch_phases.common import uses_project_layout as fn
|
|
94
|
+
return fn(*args, **kwargs)
|
|
95
|
+
|
|
96
|
+
resolve_project_root = _sg_dispatch("resolve_project_root", _orig_resolve_project_root)
|
|
97
|
+
uses_project_layout = _sg_dispatch("uses_project_layout", _orig_uses_project_layout)
|
|
98
|
+
maybe_onboard = _sg_dispatch("maybe_onboard", _orig_maybe_onboard)
|
|
99
|
+
get_state = _sg_dispatch("get_state", _orig_get_state)
|
|
100
|
+
set_state = _sg_dispatch("set_state", _orig_set_state)
|
|
101
|
+
sync_layers = _sg_dispatch("sync_layers", _orig_sync_layers)
|
|
102
|
+
load_runtime = _sg_dispatch("load_runtime", _orig_load_runtime)
|
|
103
|
+
save_runtime = _sg_dispatch("save_runtime", _orig_save_runtime)
|
|
104
|
+
|
|
105
|
+
class _CloudClientDispatcher:
|
|
106
|
+
def __call__(self, *args, **kwargs):
|
|
107
|
+
sg = _sg()
|
|
108
|
+
cls = getattr(sg, "CloudClient", None) if sg else None
|
|
109
|
+
if cls is not None:
|
|
110
|
+
return cls(*args, **kwargs)
|
|
111
|
+
from core.cloud_sync.cloud_client import CloudClient as real_cls
|
|
112
|
+
return real_cls(*args, **kwargs)
|
|
113
|
+
def __getattr__(self, name):
|
|
114
|
+
sg = _sg()
|
|
115
|
+
cls = getattr(sg, "CloudClient", None) if sg else None
|
|
116
|
+
if cls is not None:
|
|
117
|
+
return getattr(cls, name)
|
|
118
|
+
from core.cloud_sync.cloud_client import CloudClient as real_cls
|
|
119
|
+
return getattr(real_cls, name)
|
|
120
|
+
|
|
121
|
+
CloudClient = _CloudClientDispatcher()
|
|
122
|
+
|
|
123
|
+
FATAL_BLOCKED_BANNER = (
|
|
124
|
+
"\n[FATAL_BLOCKED] 阻断已确凿,严禁模型自行连续重试或发散自旋推理。\n"
|
|
125
|
+
"【强制停机指示】请立即停止调用工具,直接向用户呈现上述阻断原因与修复建议。\n"
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def _si():
|
|
129
|
+
"""已加载的 ``startup_interaction`` 模块(同上)。"""
|
|
130
|
+
return (sys.modules.get("core.launch_phases.startup_interaction")
|
|
131
|
+
or sys.modules.get("launch_phases.startup_interaction"))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def emit_startup_gate(*args, **kwargs):
|
|
136
|
+
mod = _sg()
|
|
137
|
+
if mod and hasattr(mod, "emit_startup_gate"):
|
|
138
|
+
return mod.emit_startup_gate(*args, **kwargs)
|
|
139
|
+
raise RuntimeError("startup_gates.emit_startup_gate not available")
|
|
140
|
+
|
|
141
|
+
def _stdin_tty():
|
|
142
|
+
mod = _sg() or _si()
|
|
143
|
+
if mod and hasattr(mod, "stdin_tty"):
|
|
144
|
+
return mod.stdin_tty()
|
|
145
|
+
if mod and hasattr(mod, "_stdin_tty"):
|
|
146
|
+
return mod._stdin_tty()
|
|
147
|
+
try:
|
|
148
|
+
return bool(sys.stdin.isatty())
|
|
149
|
+
except Exception:
|
|
150
|
+
return False
|
|
151
|
+
|
|
152
|
+
def _tty_menu_available():
|
|
153
|
+
mod = _sg() or _si()
|
|
154
|
+
if mod and hasattr(mod, "tty_menu_available"):
|
|
155
|
+
return mod.tty_menu_available()
|
|
156
|
+
if mod and hasattr(mod, "_tty_menu_available"):
|
|
157
|
+
return mod._tty_menu_available()
|
|
158
|
+
return False
|
|
159
|
+
|
|
160
|
+
def detect_startup_environment():
|
|
161
|
+
mod = _sg()
|
|
162
|
+
if mod and hasattr(mod, "detect_startup_environment"):
|
|
163
|
+
return mod.detect_startup_environment()
|
|
164
|
+
return "terminal"
|
|
165
|
+
|
|
166
|
+
def normalize_cli_version(value: str) -> str | None:
|
|
167
|
+
"""Normalize a BugX/Python version to the compatibility contract version.
|
|
168
|
+
|
|
169
|
+
委托 :func:`bugx_paths.contract_version`(唯一实现)。历史缺陷:此处曾把
|
|
170
|
+
``+build`` 保留在 base 组里,于是 ``0.1.1+2`` 与 ``0.1.1`` 被判为不一致并
|
|
171
|
+
**拒绝启动**,而 ``bugx doctor`` 用另一套规则判为"一致"——同一份清单、两个
|
|
172
|
+
相反结论。归一化规则只能有一处,否则两边必然再次漂移。
|
|
173
|
+
"""
|
|
174
|
+
return bugx_paths.contract_version(value)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def installed_cli_version(root: Path) -> str | None:
|
|
178
|
+
"""Read the CLI version without letting an old PATH wrapper win.
|
|
179
|
+
|
|
180
|
+
Scheme 3 has one executable runtime: the global engine. When a launcher
|
|
181
|
+
is executed directly from that engine (for example via ``bugx engine path``)
|
|
182
|
+
there may be no CLI wrapper process to report its version, and probing an
|
|
183
|
+
unrelated ``bugx`` found on PATH can reintroduce the very drift this layout
|
|
184
|
+
removes. An explicit ``BUGX_CLI_VERSION`` still wins because the wrapper
|
|
185
|
+
uses it to prove that its own version matches the engine. Direct global
|
|
186
|
+
launcher execution falls back to the engine's own marker; source-tree
|
|
187
|
+
launchers keep the historical PATH probe for compatibility and tests.
|
|
188
|
+
"""
|
|
189
|
+
override = os.environ.get("BUGX_CLI_VERSION")
|
|
190
|
+
if override:
|
|
191
|
+
normalized = _normalize_cli_version(override)
|
|
192
|
+
if normalized:
|
|
193
|
+
return normalized
|
|
194
|
+
try:
|
|
195
|
+
runtime_root = Path(__file__).resolve().parent.parent
|
|
196
|
+
engine_root = _global_engine_root().resolve()
|
|
197
|
+
if runtime_root == engine_root:
|
|
198
|
+
engine_version = version_marker(engine_root / "metadata.txt")
|
|
199
|
+
if engine_version is None:
|
|
200
|
+
engine_version = version_marker(engine_root / "bugx.md")
|
|
201
|
+
if engine_version:
|
|
202
|
+
return engine_version
|
|
203
|
+
except (OSError, ValueError, RuntimeError):
|
|
204
|
+
pass
|
|
205
|
+
executable = shutil.which("bugx")
|
|
206
|
+
if not executable:
|
|
207
|
+
return None
|
|
208
|
+
try:
|
|
209
|
+
result = subprocess.run(
|
|
210
|
+
[executable, "--version"], cwd=root, capture_output=True,
|
|
211
|
+
text=True, check=False, timeout=5,
|
|
212
|
+
)
|
|
213
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
214
|
+
return None
|
|
215
|
+
match = re.search(
|
|
216
|
+
r"\bbugx(?:\s+cli)?(?:\s+version)?\s+v?"
|
|
217
|
+
r"(?P<base>\d+\.\d+\.\d+(?:\+[0-9A-Za-z.-]+)?)"
|
|
218
|
+
r"(?:[-.]?(?:alpha|a|beta|b|rc)[-.]?\d+)?\b",
|
|
219
|
+
result.stdout or "",
|
|
220
|
+
re.IGNORECASE,
|
|
221
|
+
)
|
|
222
|
+
return match.group("base") if result.returncode == 0 and match else None
|
|
223
|
+
|
|
224
|
+
def global_engine_root() -> Path:
|
|
225
|
+
return bugx_paths.global_engine_root()
|
|
226
|
+
|
|
227
|
+
_global_engine_root = _sg_dispatch("_global_engine_root", global_engine_root)
|
|
228
|
+
|
|
229
|
+
def version_marker(path: Path) -> str | None:
|
|
230
|
+
"""Read a human-readable BugX version marker without failing startup."""
|
|
231
|
+
try:
|
|
232
|
+
text = path.read_text(encoding="utf-8")
|
|
233
|
+
except (OSError, UnicodeError):
|
|
234
|
+
return None
|
|
235
|
+
match = re.search(
|
|
236
|
+
r"(?:bugx_version[\"']?\s*:\s*[\"']?|^version:\s*)"
|
|
237
|
+
r"([0-9]+\.[0-9]+\.[0-9]+(?:\+[0-9A-Za-z.-]+)?|\$\{BUGX_VERSION\})",
|
|
238
|
+
text, re.MULTILINE,
|
|
239
|
+
)
|
|
240
|
+
if not match:
|
|
241
|
+
return None
|
|
242
|
+
value = match.group(1)
|
|
243
|
+
if value == "0.1.1":
|
|
244
|
+
value = os.environ.get("BUGX_VERSION", "0.1.1")
|
|
245
|
+
return value
|
|
246
|
+
|
|
247
|
+
def startup_release_version(value: object) -> tuple[int, int, int] | None:
|
|
248
|
+
"""Parse the strict x.y.z release format used by the update endpoint."""
|
|
249
|
+
if not isinstance(value, str):
|
|
250
|
+
return None
|
|
251
|
+
value = value.strip()
|
|
252
|
+
if not re.fullmatch(r"\d+\.\d+\.\d+", value):
|
|
253
|
+
return None
|
|
254
|
+
major, minor, patch = (int(part) for part in value.split("."))
|
|
255
|
+
return major, minor, patch
|
|
256
|
+
|
|
257
|
+
def startup_version_banner(*, stream=None) -> None:
|
|
258
|
+
"""Always show the Agent version before dispatching a launch command."""
|
|
259
|
+
stream = stream or sys.stdout
|
|
260
|
+
root = resolve_project_root()
|
|
261
|
+
engine = _global_engine_root()
|
|
262
|
+
engine_version = version_marker(engine / "metadata.txt")
|
|
263
|
+
if engine_version is None:
|
|
264
|
+
engine_version = version_marker(engine / "bugx.md")
|
|
265
|
+
# The project manifest records layout/installation state; executable code
|
|
266
|
+
# has one version source: the global engine.
|
|
267
|
+
project_version = version_marker(root / ".bugx" / "manifest.json")
|
|
268
|
+
cli_version = _installed_cli_version(root)
|
|
269
|
+
display = engine_version or project_version or cli_version or "unknown"
|
|
270
|
+
print(f"[BugX] Agent version: {display}", file=stream)
|
|
271
|
+
print(
|
|
272
|
+
"[BugX] Version contract: "
|
|
273
|
+
f"cli={cli_version or 'unknown'} "
|
|
274
|
+
f"project_manifest={project_version or 'unknown'} "
|
|
275
|
+
f"engine={engine_version or 'unknown'}",
|
|
276
|
+
file=stream,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
def startup_cloud_onboarding(
|
|
280
|
+
cloud_sync_policy: str | None = None, *, autonomous: bool = False,
|
|
281
|
+
) -> int:
|
|
282
|
+
"""取得云端同步决定,并在经验上下文构建前完成一次正式同步。"""
|
|
283
|
+
if not uses_project_layout():
|
|
284
|
+
return 0
|
|
285
|
+
try:
|
|
286
|
+
from core.cloud_sync.cloud_onboard import get_state, set_state
|
|
287
|
+
state = get_state(resolve_project_root())
|
|
288
|
+
policy = cloud_sync_policy
|
|
289
|
+
if autonomous and policy is None and state == "pending":
|
|
290
|
+
# An undecided project is not consent to upload. Headless startup
|
|
291
|
+
# defaults only this pending state to local; persisted or explicit
|
|
292
|
+
# sync choices remain authoritative below.
|
|
293
|
+
policy = "local"
|
|
294
|
+
if policy in {"skip", "local"} and state == "pending":
|
|
295
|
+
# Profile 只补齐未决状态;已由用户选择的 done/local 不被覆盖。
|
|
296
|
+
set_state(resolve_project_root(), "local")
|
|
297
|
+
state = "local"
|
|
298
|
+
print("[launch_bugx] ✓ Profile 已选择本地云同步模式")
|
|
299
|
+
elif policy == "sync" or state in {"sync", "done"}:
|
|
300
|
+
# 云端同步模式:严禁擅自消极降级为 local!
|
|
301
|
+
# 未登录时必须直接跳转浏览器登录授权页面,授权完成后自动对齐并同步。
|
|
302
|
+
pass
|
|
303
|
+
elif state == "pending":
|
|
304
|
+
# 仅在调用方未显式指定云端策略、且当前处于完全无交互环境时,才临时以本地模式运行,避免无头 CI 挂起
|
|
305
|
+
if not _stdin_tty() and not _tty_menu_available():
|
|
306
|
+
try:
|
|
307
|
+
from core.cloud_sync.cloud_client import CloudClient
|
|
308
|
+
client = CloudClient()
|
|
309
|
+
is_auth = bool(client.cred.is_authenticated())
|
|
310
|
+
except Exception:
|
|
311
|
+
is_auth = False
|
|
312
|
+
if not is_auth:
|
|
313
|
+
set_state(resolve_project_root(), "local")
|
|
314
|
+
state = "local"
|
|
315
|
+
print("[launch_bugx] ✓ 无交互环境下未配置云端策略,已采用本地模式运行(不阻断启动)")
|
|
316
|
+
|
|
317
|
+
# 门禁重入去重(build 389):``pre`` 是无状态一次性进程,每道门禁应答后
|
|
318
|
+
# 都要重跑 pre,此前每次都全量推拉云同步(实测每轮 6 个网络往返、秒级开销×N)。
|
|
319
|
+
# 已 done/sync 且距本次启动上一次同步成功不足 900s 时直接复用结果;
|
|
320
|
+
# 显式 ``--cloud-sync sync`` 视为用户点名同步,不跳过。
|
|
321
|
+
marker_path = resolve_project_root() / ".bugx" / "state" / "cloud-sync-startup.json"
|
|
322
|
+
marker_age: float | None = None
|
|
323
|
+
if state in {"sync", "done"} and policy != "sync":
|
|
324
|
+
try:
|
|
325
|
+
marker_age = time.time() - float(
|
|
326
|
+
json.loads(marker_path.read_text(encoding="utf-8")).get("at") or 0.0
|
|
327
|
+
)
|
|
328
|
+
except (OSError, ValueError):
|
|
329
|
+
marker_age = None
|
|
330
|
+
if marker_age is not None and 0.0 <= marker_age <= 900.0:
|
|
331
|
+
print(
|
|
332
|
+
f"[launch_bugx] ✓ 门禁重入:{int(marker_age)} 秒前已完成本次启动云同步,"
|
|
333
|
+
"跳过重复推拉"
|
|
334
|
+
)
|
|
335
|
+
synced = True
|
|
336
|
+
else:
|
|
337
|
+
synced = maybe_onboard(
|
|
338
|
+
resolve_project_root(), require_interaction=not autonomous, perform_sync=True,
|
|
339
|
+
decision=("sync" if (policy == "sync" and state == "pending") else None),
|
|
340
|
+
allow_identity_create=autonomous,
|
|
341
|
+
)
|
|
342
|
+
if synced:
|
|
343
|
+
try:
|
|
344
|
+
marker_path.parent.mkdir(parents=True, exist_ok=True)
|
|
345
|
+
marker_path.write_text(
|
|
346
|
+
json.dumps({"at": time.time()}, ensure_ascii=False),
|
|
347
|
+
encoding="utf-8",
|
|
348
|
+
)
|
|
349
|
+
except (OSError, ValueError):
|
|
350
|
+
pass
|
|
351
|
+
state = get_state(resolve_project_root())
|
|
352
|
+
if state not in {"done", "local"}:
|
|
353
|
+
# ``sync`` = 用户**已显式选择**云端同步(`init --cloud-sync sync`),
|
|
354
|
+
# 但本轮同步没走到 ``done``(服务端/网络/身份失败)。此前它与
|
|
355
|
+
# 「从未选择」共用同一条「决策尚未完成」文案,导致用户被告知去做他
|
|
356
|
+
# 已经做过的事(build 288 实测)。两种情形必须分开报告。
|
|
357
|
+
if state == "sync":
|
|
358
|
+
reason = ""
|
|
359
|
+
try:
|
|
360
|
+
payload = json.loads(
|
|
361
|
+
(resolve_project_root() / ".bugx" / "cloud-last-error.json")
|
|
362
|
+
.read_text(encoding="utf-8")
|
|
363
|
+
)
|
|
364
|
+
reason = str(payload.get("error") or "")
|
|
365
|
+
except (OSError, ValueError):
|
|
366
|
+
reason = ""
|
|
367
|
+
print(
|
|
368
|
+
"[launch_bugx] ✗ 云端同步已获授权但本轮未完成;"
|
|
369
|
+
+ ("自治模式已 BLOCKED,不会等待交互。" if autonomous else "")
|
|
370
|
+
)
|
|
371
|
+
if reason == "data_sharing_revoked":
|
|
372
|
+
print(
|
|
373
|
+
" 原因:数据共享授权已被撤销(隐私门禁,不会绕过)。"
|
|
374
|
+
"如需云端同步请显式重新授权:"
|
|
375
|
+
"`bugx cloud config --root . --accept-data-sharing`;"
|
|
376
|
+
"本地开发可改用 `--cloud-sync local`。"
|
|
377
|
+
)
|
|
378
|
+
elif reason:
|
|
379
|
+
print(f" 原因:{reason};请检查 `bugx cloud status --root .`。")
|
|
380
|
+
else:
|
|
381
|
+
print(" 原因未记录;请检查 `bugx cloud status --root .` 后重试。")
|
|
382
|
+
return POLLING_DECISION_REQUIRED
|
|
383
|
+
print(
|
|
384
|
+
"[launch_bugx] ✗ 云端多设备同步决策尚未完成;"
|
|
385
|
+
+ ("自治模式已 BLOCKED,不会等待交互。" if autonomous else
|
|
386
|
+
"本轮不会进入审查方式、轮询策略或修复模式询问。")
|
|
387
|
+
)
|
|
388
|
+
print(" 请在当前云端菜单完成选择并成功登录/同步,或明确选择本地模式后重试。")
|
|
389
|
+
return POLLING_DECISION_REQUIRED
|
|
390
|
+
except Exception as exc:
|
|
391
|
+
# Import lazily so standalone protocol tests do not need cloud dependencies.
|
|
392
|
+
try:
|
|
393
|
+
from core.cloud_sync.cloud_onboard import CloudOnboardDecisionRequired
|
|
394
|
+
except Exception: # pragma: no cover - only malformed installations
|
|
395
|
+
CloudOnboardDecisionRequired = ()
|
|
396
|
+
if CloudOnboardDecisionRequired and isinstance(exc, CloudOnboardDecisionRequired):
|
|
397
|
+
if getattr(exc, "request_emitted", False):
|
|
398
|
+
if autonomous:
|
|
399
|
+
print("[launch_bugx] ✗ 自治模式需要云端登录/身份决策,已 BLOCKED,不等待交互。")
|
|
400
|
+
return POLLING_DECISION_REQUIRED
|
|
401
|
+
print("[launch_bugx] ✗ 云端同步/项目身份决策尚未完成;当前交互请求已交给宿主处理。")
|
|
402
|
+
return POLLING_DECISION_REQUIRED
|
|
403
|
+
if autonomous:
|
|
404
|
+
print("[launch_bugx] ✗ 自治模式需要云端登录/身份决策,已 BLOCKED,不发起交互。")
|
|
405
|
+
return POLLING_DECISION_REQUIRED
|
|
406
|
+
environment = detect_startup_environment()
|
|
407
|
+
print("[launch_bugx] ✗ 启动前需要云同步/登录决策。")
|
|
408
|
+
emit_startup_gate(
|
|
409
|
+
"cloud_sync",
|
|
410
|
+
"选择本项目的云端多设备同步模式",
|
|
411
|
+
[
|
|
412
|
+
{
|
|
413
|
+
"label": "立即登录并同步",
|
|
414
|
+
"description": "完成登录、设备登记并同步本项目",
|
|
415
|
+
"value": "sync",
|
|
416
|
+
"action": "cloud_sync_all",
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"label": "本地模式",
|
|
420
|
+
"description": "持久化本地模式,不自动同步",
|
|
421
|
+
"value": "local",
|
|
422
|
+
"action": "set_cloud_local",
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"label": "下次再说",
|
|
426
|
+
"description": "保持待决定并停止本轮启动",
|
|
427
|
+
"value": "later",
|
|
428
|
+
"action": "stop_startup",
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
environment=environment,
|
|
432
|
+
detail="选择后执行 bugx cloud sync 或 bugx cloud onboard off,再重新运行 pre",
|
|
433
|
+
)
|
|
434
|
+
try:
|
|
435
|
+
from core.cloud_sync.cloud_onboard import get_state
|
|
436
|
+
if get_state(resolve_project_root()) == "done":
|
|
437
|
+
print(f"[launch_bugx] ⚠ 云同步 onboarding 遇网络异常({exc}),自动降级为本地运行(不阻断启动)")
|
|
438
|
+
return 0
|
|
439
|
+
except Exception:
|
|
440
|
+
pass
|
|
441
|
+
print(f"[launch_bugx] ✗ 云同步 onboarding 检查失败:{exc}")
|
|
442
|
+
return 1
|
|
443
|
+
if state == "done" and not synced:
|
|
444
|
+
print(
|
|
445
|
+
"[launch_bugx] ⚠ 云端网络不可达或同步未完成,自动平滑降级为本地模式(已标记 sync_pending,不阻断启动)"
|
|
446
|
+
)
|
|
447
|
+
try:
|
|
448
|
+
from core.cloud_sync.auto_sync import schedule_recovery
|
|
449
|
+
for scope in ("global", "project"):
|
|
450
|
+
schedule_recovery(resolve_project_root(), scope)
|
|
451
|
+
except (ImportError, OSError, ValueError, RuntimeError):
|
|
452
|
+
pass
|
|
453
|
+
try:
|
|
454
|
+
with runtime_lock():
|
|
455
|
+
st = load_runtime()
|
|
456
|
+
st["sync_status"] = "sync_pending"
|
|
457
|
+
save_runtime(st)
|
|
458
|
+
except Exception:
|
|
459
|
+
pass
|
|
460
|
+
return 0
|
|
461
|
+
return 0
|
|
462
|
+
|
|
463
|
+
def run_cloud_boundary_sync(runtime: dict, scope: str) -> str:
|
|
464
|
+
"""在 Life/终局 Round 边界同步对应层,并把结果写回运行态。"""
|
|
465
|
+
if scope not in {"project", "global"}:
|
|
466
|
+
raise ValueError("同步边界只能是 project/global")
|
|
467
|
+
status = "local"
|
|
468
|
+
detail = "local mode"
|
|
469
|
+
consecutive_failures = int(runtime.get("cloud_sync_consecutive_failures") or 0)
|
|
470
|
+
# L5-OPT-4: 离线熔断断路器(连续失败达到 5 次以上转入休眠保护,消除每轮无意义子进程唤醒)
|
|
471
|
+
if consecutive_failures >= 5 and scope == "project":
|
|
472
|
+
status = "offline_dormant"
|
|
473
|
+
detail = f"连续 {consecutive_failures} 次网络同步失败,进入离线熔断保护(可运行 bugx cloud sync 重试)"
|
|
474
|
+
elif uses_project_layout():
|
|
475
|
+
try:
|
|
476
|
+
from core.cloud_sync.cloud_client import CloudClient
|
|
477
|
+
from core.cloud_sync.cloud_onboard import get_state, sync_layers
|
|
478
|
+
if get_state(resolve_project_root()) == "done":
|
|
479
|
+
summary = sync_layers(
|
|
480
|
+
CloudClient(), resolve_project_root(), scopes={scope},
|
|
481
|
+
)
|
|
482
|
+
status = "ready" if summary.get("ok") else "sync_pending"
|
|
483
|
+
detail = summary.get("error") or summary.get(f"{scope}_pull") or status
|
|
484
|
+
else:
|
|
485
|
+
detail = "cloud sync is not enabled"
|
|
486
|
+
except Exception as exc: # noqa: BLE001
|
|
487
|
+
status = "sync_pending"
|
|
488
|
+
detail = f"{type(exc).__name__}: {exc}"
|
|
489
|
+
if status == "ready":
|
|
490
|
+
consecutive_failures = 0
|
|
491
|
+
elif status == "sync_pending":
|
|
492
|
+
consecutive_failures += 1
|
|
493
|
+
try:
|
|
494
|
+
with runtime_lock():
|
|
495
|
+
state = load_runtime()
|
|
496
|
+
state["cloud_sync_consecutive_failures"] = consecutive_failures
|
|
497
|
+
boundaries = state.get("sync_boundaries")
|
|
498
|
+
if not isinstance(boundaries, dict):
|
|
499
|
+
boundaries = {}
|
|
500
|
+
boundaries[scope] = {
|
|
501
|
+
"status": status, "detail": str(detail),
|
|
502
|
+
"updated_at": iso_time(time.time()),
|
|
503
|
+
}
|
|
504
|
+
state["sync_boundaries"] = boundaries
|
|
505
|
+
statuses = [
|
|
506
|
+
item.get("status") for item in boundaries.values()
|
|
507
|
+
if isinstance(item, dict)
|
|
508
|
+
]
|
|
509
|
+
state["sync_status"] = (
|
|
510
|
+
"sync_pending" if "sync_pending" in statuses else
|
|
511
|
+
"ready" if "ready" in statuses else
|
|
512
|
+
"local"
|
|
513
|
+
)
|
|
514
|
+
append_runtime_event(
|
|
515
|
+
state, "cloud-boundary-sync", time.time(),
|
|
516
|
+
f"scope={scope} status={status}",
|
|
517
|
+
)
|
|
518
|
+
save_runtime(state)
|
|
519
|
+
except (OSError, ValueError):
|
|
520
|
+
print(f" ⚠ 无法写入 {scope} 云同步边界状态;后续启动将重新检查")
|
|
521
|
+
if status == "sync_pending":
|
|
522
|
+
print(f" ⚠ {scope} 边界同步未完成:已保留待重放状态({detail})")
|
|
523
|
+
try:
|
|
524
|
+
from core.cloud_sync.auto_sync import schedule_recovery
|
|
525
|
+
schedule_recovery(resolve_project_root(), scope)
|
|
526
|
+
except (ImportError, OSError, ValueError, RuntimeError):
|
|
527
|
+
pass
|
|
528
|
+
elif status == "offline_dormant":
|
|
529
|
+
print(f" ℹ {scope} 云端同步连续失败达到阈值,已转入离线静默状态(可通过 bugx cloud sync 手动重试)")
|
|
530
|
+
return status
|
|
531
|
+
|
|
532
|
+
def startup_version_gate() -> tuple[bool, str, str]:
|
|
533
|
+
"""Require CLI, project layout/manifest and global engine versions to agree."""
|
|
534
|
+
root = resolve_project_root()
|
|
535
|
+
cli_version = _installed_cli_version(root)
|
|
536
|
+
try:
|
|
537
|
+
status = bugx_paths.version_status(
|
|
538
|
+
root, _global_engine_root(), cli_version=cli_version,
|
|
539
|
+
)
|
|
540
|
+
except (OSError, ValueError, RuntimeError) as exc:
|
|
541
|
+
return False, f"版本清单无法读取:{exc}{FATAL_BLOCKED_BANNER}", "version_contract"
|
|
542
|
+
if status.get("consistent"):
|
|
543
|
+
return True, str(status.get("detail", "版本一致")), ""
|
|
544
|
+
versions = status.get("versions", {})
|
|
545
|
+
project_versions = status.get("legacy_versions")
|
|
546
|
+
project_integrity = status.get("project_core_integrity") or {}
|
|
547
|
+
layout_invalid = (
|
|
548
|
+
isinstance(project_versions, dict)
|
|
549
|
+
and "project_layout" in project_versions
|
|
550
|
+
and project_versions["project_layout"] != bugx_paths.LAYOUT_VERSION
|
|
551
|
+
) or (project_integrity.get("available") and not project_integrity.get("ok"))
|
|
552
|
+
if layout_invalid:
|
|
553
|
+
return False, (
|
|
554
|
+
f"项目 BugX 状态不完整或格式不受支持:{status.get('detail', '')};"
|
|
555
|
+
f"程序版本标记:{versions}。布局格式标记不是 BugX 程序版本;"
|
|
556
|
+
"已保留既有项目状态,请检查并恢复,不要直接重建或刷新全局引擎。"
|
|
557
|
+
f"{FATAL_BLOCKED_BANNER}"
|
|
558
|
+
), "project_layout"
|
|
559
|
+
return False, (
|
|
560
|
+
f"{status.get('detail', '版本标记不一致')};当前版本:{versions}。"
|
|
561
|
+
"本次启动不会自动重试;请检查实际不一致的程序版本或缺失的版本标记。"
|
|
562
|
+
"若仅是 CLI 版本识别失败,可临时设置 `BUGX_CLI_VERSION=X.Y.Z` 覆盖识别;"
|
|
563
|
+
"该覆盖不替代实际 CLI 升级,也不能掩盖项目/引擎版本漂移。"
|
|
564
|
+
f"{FATAL_BLOCKED_BANNER}"
|
|
565
|
+
), "version_contract"
|
|
566
|
+
|
|
567
|
+
# PERF-07:远端版本检查的硬超时与后台线程状态。
|
|
568
|
+
# 单次请求 timeout 压到 1 秒且不重试;此设置不是 DNS/配置读取的总墙钟保证。
|
|
569
|
+
# CLI 仍由后台线程检查;进程内 harness 必须在恢复全局环境前完成检查。
|
|
570
|
+
REMOTE_VERSION_CHECK_TIMEOUT_SECONDS = 1.0
|
|
571
|
+
|
|
572
|
+
REMOTE_VERSION_LOCK = threading.Lock()
|
|
573
|
+
REMOTE_VERSION_THREAD: threading.Thread | None = None
|
|
574
|
+
def pending_remote_version_result() -> dict[str, Any]:
|
|
575
|
+
return {
|
|
576
|
+
"status": "pending",
|
|
577
|
+
"detail": "",
|
|
578
|
+
"current_version": "",
|
|
579
|
+
"latest_version": "",
|
|
580
|
+
"checked_at": None,
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
_pending_remote_version_result = pending_remote_version_result
|
|
585
|
+
REMOTE_VERSION_RESULT: dict[str, Any] = _pending_remote_version_result()
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
def _active_remote_version_result() -> dict[str, Any]:
|
|
589
|
+
sg = _sg()
|
|
590
|
+
if sg and hasattr(sg, "_REMOTE_VERSION_RESULT"):
|
|
591
|
+
target = getattr(sg, "_REMOTE_VERSION_RESULT")
|
|
592
|
+
if target is not _REMOTE_VERSION_RESULT and isinstance(target, dict):
|
|
593
|
+
return target
|
|
594
|
+
return _REMOTE_VERSION_RESULT
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def remote_version_check_result() -> dict[str, Any]:
|
|
598
|
+
"""返回最近一次后台远端版本检查的快照(PERF-07)。
|
|
599
|
+
|
|
600
|
+
状态取值:``pending``(尚未运行/进行中)、``disabled``(显式关闭)、
|
|
601
|
+
``unavailable``(cloud_client 不可导入)、``network_error``(不可达)、
|
|
602
|
+
``invalid_metadata``(服务端元数据无效)、``up_to_date``、
|
|
603
|
+
``update_available``、``update_required``。
|
|
604
|
+
"""
|
|
605
|
+
scoped_result = ISOLATED_REMOTE_VERSION_RESULT.get()
|
|
606
|
+
if scoped_result is not None:
|
|
607
|
+
if not scoped_result:
|
|
608
|
+
scoped_result.update(_pending_remote_version_result())
|
|
609
|
+
return dict(scoped_result)
|
|
610
|
+
with REMOTE_VERSION_LOCK:
|
|
611
|
+
return dict(_active_remote_version_result())
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def clear_remote_version_check_cache() -> None:
|
|
615
|
+
"""清空后台版本检查的结果缓存(测试用;不影响已启动的线程)。"""
|
|
616
|
+
global _REMOTE_VERSION_THREAD
|
|
617
|
+
scoped_result = ISOLATED_REMOTE_VERSION_RESULT.get()
|
|
618
|
+
if scoped_result is not None:
|
|
619
|
+
scoped_result.clear()
|
|
620
|
+
scoped_result.update(_pending_remote_version_result())
|
|
621
|
+
return
|
|
622
|
+
with REMOTE_VERSION_LOCK:
|
|
623
|
+
REMOTE_VERSION_THREAD = None
|
|
624
|
+
target = _active_remote_version_result()
|
|
625
|
+
target.clear()
|
|
626
|
+
target.update(_pending_remote_version_result())
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
def record_remote_version_result(
|
|
630
|
+
*, status: str, detail: str = "",
|
|
631
|
+
current_version: str = "", latest_version: str = "",
|
|
632
|
+
) -> None:
|
|
633
|
+
"""记录后台版本检查结论,供 :func:`remote_version_check_result` 读取。"""
|
|
634
|
+
payload = {
|
|
635
|
+
"status": status,
|
|
636
|
+
"detail": detail,
|
|
637
|
+
"current_version": current_version,
|
|
638
|
+
"latest_version": latest_version,
|
|
639
|
+
"checked_at": time.time(),
|
|
640
|
+
}
|
|
641
|
+
scoped_result = ISOLATED_REMOTE_VERSION_RESULT.get()
|
|
642
|
+
if scoped_result is not None:
|
|
643
|
+
scoped_result.update(payload)
|
|
644
|
+
return
|
|
645
|
+
with REMOTE_VERSION_LOCK:
|
|
646
|
+
target = _active_remote_version_result()
|
|
647
|
+
target.update(payload)
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
def schedule_startup_remote_version_check(
|
|
651
|
+
*, stream=None,
|
|
652
|
+
) -> threading.Thread | None:
|
|
653
|
+
"""在守护线程中执行远端版本检查,立即返回、绝不阻塞启动(PERF-07)。
|
|
654
|
+
|
|
655
|
+
旧实现自称「非阻断」,实际是在 ``main()`` 中同步调用:黑洞网络下
|
|
656
|
+
``2 × 5s + sleep ≈ 10.5s`` 全部压在任何后续启动步骤之前。现在只负责
|
|
657
|
+
启动一个 daemon 线程;进程退出时线程自动终止,慢检查不可能拖慢
|
|
658
|
+
``bugx pre``。结果写入进程内缓存(:func:`remote_version_check_result`)。
|
|
659
|
+
|
|
660
|
+
进程内 harness 没有 OS 进程退出边界:检查在当前作用域同步完成,结果写入
|
|
661
|
+
ContextVar 容器,既不遗留后台线程也不覆盖宿主的线程/结果状态。
|
|
662
|
+
"""
|
|
663
|
+
global _REMOTE_VERSION_THREAD
|
|
664
|
+
if ISOLATED_REMOTE_VERSION_RESULT.get() is not None:
|
|
665
|
+
_startup_remote_version_check(stream=stream)
|
|
666
|
+
return None
|
|
667
|
+
with REMOTE_VERSION_LOCK:
|
|
668
|
+
sg = _sg()
|
|
669
|
+
sg_thread = getattr(sg, "_REMOTE_VERSION_THREAD", None) if sg else None
|
|
670
|
+
if sg_thread is not None and getattr(sg_thread, "is_alive", lambda: False)():
|
|
671
|
+
return sg_thread
|
|
672
|
+
if _REMOTE_VERSION_THREAD is not None and _REMOTE_VERSION_THREAD.is_alive():
|
|
673
|
+
return _REMOTE_VERSION_THREAD
|
|
674
|
+
thread_cls = getattr(getattr(sg, "threading", None), "Thread", threading.Thread)
|
|
675
|
+
thread = thread_cls(
|
|
676
|
+
target=_startup_remote_version_check,
|
|
677
|
+
kwargs={"stream": stream},
|
|
678
|
+
name="bugx-remote-version-check",
|
|
679
|
+
daemon=True,
|
|
680
|
+
)
|
|
681
|
+
REMOTE_VERSION_THREAD = thread
|
|
682
|
+
thread.start()
|
|
683
|
+
return thread
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
def startup_remote_version_check(*, stream=None) -> None:
|
|
687
|
+
"""远端版本检查体;经调度器选择 CLI 后台或 harness 同步边界。
|
|
688
|
+
|
|
689
|
+
Queries the BugX server for the latest CLI version. If a newer version
|
|
690
|
+
is available, prints a non-blocking hint. If the check fails (air-gap,
|
|
691
|
+
DNS, etc.), it is silently skipped.
|
|
692
|
+
|
|
693
|
+
直接调用本函数会阻塞当前线程;启动链路经
|
|
694
|
+
:func:`schedule_startup_remote_version_check` 决定执行边界。
|
|
695
|
+
|
|
696
|
+
Can be disabled with BUGX_DISABLE_VERSION_CHECK=1 env var or
|
|
697
|
+
disable_version_check=true in cloud-config.json.
|
|
698
|
+
"""
|
|
699
|
+
stream = stream or sys.stdout
|
|
700
|
+
if os.environ.get("BUGX_DISABLE_VERSION_CHECK", "").lower() in {"1", "true", "yes"}:
|
|
701
|
+
_record_remote_version_result(status="disabled", detail="BUGX_DISABLE_VERSION_CHECK")
|
|
702
|
+
return
|
|
703
|
+
cloud_client = getattr(_sg(), "_cloud_client_module", None)
|
|
704
|
+
client_metadata = getattr(_sg(), "_client_metadata_module", None)
|
|
705
|
+
if cloud_client is None or client_metadata is None:
|
|
706
|
+
_record_remote_version_result(status="unavailable", detail="cloud_client 不可导入")
|
|
707
|
+
return
|
|
708
|
+
|
|
709
|
+
# Check persisted config for disable_version_check.
|
|
710
|
+
try:
|
|
711
|
+
cfg = cloud_client.load_cloud_config()
|
|
712
|
+
if cfg.get("disable_version_check", False):
|
|
713
|
+
_record_remote_version_result(status="disabled", detail="cloud-config")
|
|
714
|
+
return
|
|
715
|
+
except Exception: # noqa: BLE001
|
|
716
|
+
pass # config read failure; continue with env check
|
|
717
|
+
|
|
718
|
+
try:
|
|
719
|
+
client = cloud_client.CloudClient()
|
|
720
|
+
# PERF-07: 单次短超时且不重试——后台线程也不应长期挂起。
|
|
721
|
+
try:
|
|
722
|
+
client.timeout = min(float(client.timeout), REMOTE_VERSION_CHECK_TIMEOUT_SECONDS)
|
|
723
|
+
except (TypeError, ValueError):
|
|
724
|
+
client.timeout = REMOTE_VERSION_CHECK_TIMEOUT_SECONDS
|
|
725
|
+
if hasattr(client, "retries"):
|
|
726
|
+
client.retries = 0
|
|
727
|
+
# Get current CLI version.
|
|
728
|
+
cli_ver = ""
|
|
729
|
+
if hasattr(cloud_client, "current_version_str"):
|
|
730
|
+
cli_ver = cloud_client.current_version_str()
|
|
731
|
+
elif hasattr(cloud_client, "__version__"):
|
|
732
|
+
cli_ver = cloud_client.__version__
|
|
733
|
+
if cli_ver == "unknown":
|
|
734
|
+
cli_ver = ""
|
|
735
|
+
result = client.check_version(
|
|
736
|
+
current_version=cli_ver,
|
|
737
|
+
channel=client_metadata.release_channel(),
|
|
738
|
+
)
|
|
739
|
+
if not result.ok:
|
|
740
|
+
_record_remote_version_result(
|
|
741
|
+
status="network_error", detail=str(result.error or ""),
|
|
742
|
+
current_version=str(cli_ver),
|
|
743
|
+
)
|
|
744
|
+
return # network unreachable; silently skip
|
|
745
|
+
data = result.data if isinstance(result.data, dict) else {}
|
|
746
|
+
info = data.get("data") if isinstance(data.get("data"), dict) else data
|
|
747
|
+
latest = str(info.get("latest_version") or "").strip()
|
|
748
|
+
min_client = str(info.get("min_client_version") or "").strip()
|
|
749
|
+
current_tuple = _startup_release_version(cli_ver)
|
|
750
|
+
latest_tuple = _startup_release_version(latest)
|
|
751
|
+
min_tuple = _startup_release_version(min_client) if min_client else None
|
|
752
|
+
if latest_tuple is None or (min_client and min_tuple is None):
|
|
753
|
+
print(
|
|
754
|
+
f"[version] 服务端版本元数据无效,已跳过启动提示: "
|
|
755
|
+
f"latest={latest!r} min_client={min_client!r}",
|
|
756
|
+
file=stream,
|
|
757
|
+
)
|
|
758
|
+
_record_remote_version_result(
|
|
759
|
+
status="invalid_metadata",
|
|
760
|
+
detail=f"latest={latest!r} min_client={min_client!r}",
|
|
761
|
+
current_version=str(cli_ver),
|
|
762
|
+
)
|
|
763
|
+
return
|
|
764
|
+
if current_tuple is None:
|
|
765
|
+
_record_remote_version_result(
|
|
766
|
+
status="invalid_metadata", detail=f"cli={cli_ver!r}",
|
|
767
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
768
|
+
)
|
|
769
|
+
return
|
|
770
|
+
if latest_tuple < current_tuple:
|
|
771
|
+
print(
|
|
772
|
+
f"[version] 服务端发布版本 {latest} 低于当前 CLI {cli_ver},"
|
|
773
|
+
"已跳过启动更新提示",
|
|
774
|
+
file=stream,
|
|
775
|
+
)
|
|
776
|
+
_record_remote_version_result(
|
|
777
|
+
status="up_to_date", detail="服务端发布版本低于当前 CLI",
|
|
778
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
779
|
+
)
|
|
780
|
+
return
|
|
781
|
+
if min_tuple is not None and min_tuple > latest_tuple:
|
|
782
|
+
print(
|
|
783
|
+
f"[version] 服务端版本元数据矛盾,已跳过启动提示:"
|
|
784
|
+
f"最低兼容版本 {min_client} 高于发布版本 {latest}",
|
|
785
|
+
file=stream,
|
|
786
|
+
)
|
|
787
|
+
_record_remote_version_result(
|
|
788
|
+
status="invalid_metadata", detail="min_client_version 高于 latest_version",
|
|
789
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
790
|
+
)
|
|
791
|
+
return
|
|
792
|
+
update_required = (info.get("update_required") is True
|
|
793
|
+
or (min_tuple is not None and current_tuple < min_tuple))
|
|
794
|
+
update_available = (info.get("update_available") is True
|
|
795
|
+
or latest_tuple > current_tuple)
|
|
796
|
+
if update_required:
|
|
797
|
+
print(
|
|
798
|
+
f"\n⚠ BugX CLI 版本 {cli_ver} 低于最低兼容版本 {min_client},"
|
|
799
|
+
"可能导致 Cloud Sync 协议不兼容。",
|
|
800
|
+
file=stream,
|
|
801
|
+
)
|
|
802
|
+
print(f" 最新版本: {latest}", file=stream)
|
|
803
|
+
print(" 请立即执行:bugx update\n", file=stream)
|
|
804
|
+
_record_remote_version_result(
|
|
805
|
+
status="update_required", detail=f"min_client={min_client}",
|
|
806
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
807
|
+
)
|
|
808
|
+
elif update_available and latest:
|
|
809
|
+
print(f"\n✦ BugX CLI 有新版本可用: {latest}(当前: {cli_ver})", file=stream)
|
|
810
|
+
print(" 建议执行:bugx update\n", file=stream)
|
|
811
|
+
_record_remote_version_result(
|
|
812
|
+
status="update_available", detail="",
|
|
813
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
814
|
+
)
|
|
815
|
+
else:
|
|
816
|
+
_record_remote_version_result(
|
|
817
|
+
status="up_to_date", detail="",
|
|
818
|
+
current_version=str(cli_ver), latest_version=latest,
|
|
819
|
+
)
|
|
820
|
+
except Exception as exc: # noqa: BLE001
|
|
821
|
+
_record_remote_version_result(
|
|
822
|
+
status="network_error", detail=f"{type(exc).__name__}: {exc}",
|
|
823
|
+
)
|
|
824
|
+
return
|
|
825
|
+
|
|
826
|
+
def emit_version_contract_gate(detail: str, environment=None) -> None:
|
|
827
|
+
"""Stop at one explicit version gate instead of feeding a retry loop.
|
|
828
|
+
|
|
829
|
+
Version repair can replace the global engine and host entrypoints. The
|
|
830
|
+
current process must therefore never repair and re-enter itself. The host
|
|
831
|
+
performs one explicit repair action, restarts, and only then retries.
|
|
832
|
+
"""
|
|
833
|
+
emit_startup_gate(
|
|
834
|
+
"version_contract",
|
|
835
|
+
"BugX CLI、项目核心和全局引擎版本契约不一致",
|
|
836
|
+
[
|
|
837
|
+
{
|
|
838
|
+
"label": "执行一次受控更新并重启宿主",
|
|
839
|
+
"description": "只执行一次更新;完成后重启宿主,再重试启动",
|
|
840
|
+
"value": "repair_once",
|
|
841
|
+
"action": "repair_version_contract",
|
|
842
|
+
"retry": "only_after_host_restart_once",
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
"label": "停止本轮",
|
|
846
|
+
"description": "保留当前状态,等待人工处理版本契约",
|
|
847
|
+
"value": "stop",
|
|
848
|
+
"action": "stop_startup",
|
|
849
|
+
},
|
|
850
|
+
],
|
|
851
|
+
environment=environment,
|
|
852
|
+
detail=detail + ";不得在同一会话中自动循环重试。",
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
def emit_project_layout_gate(detail: str, environment=None) -> None:
|
|
856
|
+
"""Keep existing project data intact when its layout cannot be trusted."""
|
|
857
|
+
emit_startup_gate(
|
|
858
|
+
"project_layout",
|
|
859
|
+
"项目 BugX 状态不完整或格式不受支持",
|
|
860
|
+
[{
|
|
861
|
+
"label": "停止本轮并检查项目状态",
|
|
862
|
+
"description": "保留已有状态,检查或恢复项目数据后继续",
|
|
863
|
+
"value": "stop",
|
|
864
|
+
"action": "stop_startup",
|
|
865
|
+
}],
|
|
866
|
+
environment=environment,
|
|
867
|
+
detail=detail,
|
|
868
|
+
)
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
_normalize_cli_version = normalize_cli_version
|
|
872
|
+
_installed_cli_version = installed_cli_version
|
|
873
|
+
_startup_release_version = startup_release_version
|
|
874
|
+
_pending_remote_version_result = pending_remote_version_result
|
|
875
|
+
_record_remote_version_result = record_remote_version_result
|
|
876
|
+
_startup_remote_version_check = startup_remote_version_check
|
|
877
|
+
_REMOTE_VERSION_LOCK = REMOTE_VERSION_LOCK
|
|
878
|
+
_REMOTE_VERSION_RESULT = REMOTE_VERSION_RESULT
|
|
879
|
+
_REMOTE_VERSION_THREAD = REMOTE_VERSION_THREAD
|