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,968 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""BugX 离线 MCP runtime(DOC-008 §12 / TASK-008-015)。
|
|
3
|
+
|
|
4
|
+
from mcp-lock.json 安装锁定版本的 MCP 包到 ``~/.bugx/mcp-runtime/<lock-hash>/``,
|
|
5
|
+
启动时只执行通过完整性校验的本地入口,禁止运行时 npx/npm 下载(AD-008-06、
|
|
6
|
+
不变量 8)。只有安装阶段允许访问 npm registry,且以 ``--ignore-scripts``
|
|
7
|
+
运行——SPIKE-008-01 已确认三个上游包均无 install/postinstall 生命周期脚本;
|
|
8
|
+
同时以 ``--no-bin-links`` 安装,保证 runtime 树内不含任何符号链接。
|
|
9
|
+
|
|
10
|
+
布局:
|
|
11
|
+
~/.bugx/mcp-runtime/
|
|
12
|
+
<lock-hash>/ 完整 runtime(package.json、package-lock.json、
|
|
13
|
+
node_modules/、runtime-manifest.json、
|
|
14
|
+
file-hashes.json)
|
|
15
|
+
current -> <lock-hash> 已批准当前版本(原子切换)
|
|
16
|
+
history.json 批准顺序(回滚只在此列表内切换,不重新下载)
|
|
17
|
+
|
|
18
|
+
安全边界:本模块只启动 lock 中显式声明的 MCP 服务入口,不执行任意命令;
|
|
19
|
+
与 Supervisor MCP(bugx mcp serve)的职责互不重叠。
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
# --- 引擎导入根(直接执行脚本时自举 core.* 命名空间)---
|
|
24
|
+
import sys as _sys
|
|
25
|
+
from pathlib import Path as _Path
|
|
26
|
+
|
|
27
|
+
for _p in _Path(__file__).resolve().parents:
|
|
28
|
+
if (_p / "core" / "bugx.md").is_file():
|
|
29
|
+
if str(_p) not in _sys.path:
|
|
30
|
+
_sys.path.insert(0, str(_p))
|
|
31
|
+
break
|
|
32
|
+
del _p
|
|
33
|
+
|
|
34
|
+
import argparse
|
|
35
|
+
import base64
|
|
36
|
+
import contextlib
|
|
37
|
+
import errno
|
|
38
|
+
import hashlib
|
|
39
|
+
import json
|
|
40
|
+
import os
|
|
41
|
+
import re
|
|
42
|
+
import shutil
|
|
43
|
+
import stat
|
|
44
|
+
import subprocess
|
|
45
|
+
import sys
|
|
46
|
+
import time
|
|
47
|
+
import uuid
|
|
48
|
+
from pathlib import Path
|
|
49
|
+
|
|
50
|
+
try: # POSIX 进程锁;无 fcntl 的平台安装/回滚降级为无互斥(仅影响并发窗口)
|
|
51
|
+
import fcntl
|
|
52
|
+
except ImportError: # pragma: no cover - 平台差异
|
|
53
|
+
fcntl = None
|
|
54
|
+
|
|
55
|
+
# QUA-03:文件哈希只保留一份实现(``symbol_index.file_sha256``),公开名保持不变。
|
|
56
|
+
|
|
57
|
+
_CORE_DIR = Path(__file__).resolve().parent.parent if Path(__file__).resolve().parent.name == "skills" else Path(__file__).resolve().parent
|
|
58
|
+
if str(_CORE_DIR) not in sys.path:
|
|
59
|
+
sys.path.insert(0, str(_CORE_DIR))
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
import core.mcp_runtime_support.common as _c
|
|
63
|
+
import core.mcp_runtime_support.verifier as _v
|
|
64
|
+
import core.mcp_runtime_support.environment as _env
|
|
65
|
+
except ImportError:
|
|
66
|
+
import core.mcp_runtime_support.common as _c
|
|
67
|
+
import core.mcp_runtime_support.verifier as _v
|
|
68
|
+
import core.mcp_runtime_support.environment as _env
|
|
69
|
+
|
|
70
|
+
# Re-export common symbols
|
|
71
|
+
sha256_file = _c.sha256_file
|
|
72
|
+
LOCK_SCHEMA_VERSION = _c.LOCK_SCHEMA_VERSION
|
|
73
|
+
MANIFEST_SCHEMA_VERSION = _c.MANIFEST_SCHEMA_VERSION
|
|
74
|
+
MANIFEST_KIND = _c.MANIFEST_KIND
|
|
75
|
+
MANIFEST_NAME = _c.MANIFEST_NAME
|
|
76
|
+
FILEHASH_NAME = _c.FILEHASH_NAME
|
|
77
|
+
HISTORY_NAME = _c.HISTORY_NAME
|
|
78
|
+
CURRENT_LINK = _c.CURRENT_LINK
|
|
79
|
+
STAGING_PREFIX = _c.STAGING_PREFIX
|
|
80
|
+
DEFAULT_MIN_NODE = _c.DEFAULT_MIN_NODE
|
|
81
|
+
WORLD_WRITE_BITS = _c.WORLD_WRITE_BITS
|
|
82
|
+
HEX64_RE = _c.HEX64_RE
|
|
83
|
+
VERSION_RE = _c.VERSION_RE
|
|
84
|
+
BYTECODE_GUARD_NAME = _c.BYTECODE_GUARD_NAME
|
|
85
|
+
INTEGRITY_RE = _c.INTEGRITY_RE
|
|
86
|
+
SHA256_HASH_RE = _c.SHA256_HASH_RE
|
|
87
|
+
NODE_VERSION_RE = _c.NODE_VERSION_RE
|
|
88
|
+
TREE_HASH_EXCLUDE = _c.TREE_HASH_EXCLUDE
|
|
89
|
+
MAX_REPORTED_MISMATCHES = _c.MAX_REPORTED_MISMATCHES
|
|
90
|
+
HISTORY_LIMIT = _c.HISTORY_LIMIT
|
|
91
|
+
NPM_TIMEOUT_SECONDS = _c.NPM_TIMEOUT_SECONDS
|
|
92
|
+
INSTALL_LOCK_NAME = _c.INSTALL_LOCK_NAME
|
|
93
|
+
INSTALL_LOCK_TIMEOUT_SECONDS = _c.INSTALL_LOCK_TIMEOUT_SECONDS
|
|
94
|
+
INSTALL_LOCK_POLL_INTERVAL = _c.INSTALL_LOCK_POLL_INTERVAL
|
|
95
|
+
ECOSYSTEM_NPM = _c.ECOSYSTEM_NPM
|
|
96
|
+
ECOSYSTEM_PYPI = _c.ECOSYSTEM_PYPI
|
|
97
|
+
ECOSYSTEMS = _c.ECOSYSTEMS
|
|
98
|
+
PACKAGE_KEY_RE = _c.PACKAGE_KEY_RE
|
|
99
|
+
PYPI_SECTION = _c.PYPI_SECTION
|
|
100
|
+
PYPI_ENVIRONMENTS = _c.PYPI_ENVIRONMENTS
|
|
101
|
+
VENV_DIRNAME = _c.VENV_DIRNAME
|
|
102
|
+
PYPI_REQUIREMENTS_NAME = _c.PYPI_REQUIREMENTS_NAME
|
|
103
|
+
PYPI_INSTALL_FLAGS = _c.PYPI_INSTALL_FLAGS
|
|
104
|
+
PYTHON_REQUIRES_OPERATORS = _c.PYTHON_REQUIRES_OPERATORS
|
|
105
|
+
LAUNCH_ENV_OVERRIDES = _c.LAUNCH_ENV_OVERRIDES
|
|
106
|
+
McpRuntimeError = _c.McpRuntimeError
|
|
107
|
+
_is_world_writable = _c._is_world_writable
|
|
108
|
+
canonical_json_bytes = _c.canonical_json_bytes
|
|
109
|
+
sha256_hex = _c.sha256_hex
|
|
110
|
+
utc_now = _c.utc_now
|
|
111
|
+
reject_symlink_components = _c.reject_symlink_components
|
|
112
|
+
read_json_file = _c.read_json_file
|
|
113
|
+
_fsync_directory = _c._fsync_directory
|
|
114
|
+
write_json_atomic = _c.write_json_atomic
|
|
115
|
+
|
|
116
|
+
# Re-export verifier symbols
|
|
117
|
+
load_lock = _v.load_lock
|
|
118
|
+
parse_python_requires = _v.parse_python_requires
|
|
119
|
+
check_python_requires = _v.check_python_requires
|
|
120
|
+
lock_hash = _v.lock_hash
|
|
121
|
+
build_file_map = _v.build_file_map
|
|
122
|
+
compute_tree_hash = _v.compute_tree_hash
|
|
123
|
+
chmod_tree = _v.chmod_tree
|
|
124
|
+
find_node = _v.find_node
|
|
125
|
+
parse_node_version = _v.parse_node_version
|
|
126
|
+
node_version_tuple = _v.node_version_tuple
|
|
127
|
+
engines_requirement_floor = _v.engines_requirement_floor
|
|
128
|
+
check_node_compatibility = _v.check_node_compatibility
|
|
129
|
+
required_manifest_fields = _v.required_manifest_fields
|
|
130
|
+
load_manifest = _v.load_manifest
|
|
131
|
+
resolve_server_entry = _v.resolve_server_entry
|
|
132
|
+
verify_runtime = _v.verify_runtime
|
|
133
|
+
load_history = _v.load_history
|
|
134
|
+
update_history = _v.update_history
|
|
135
|
+
switch_current = _v.switch_current
|
|
136
|
+
read_current = _v.read_current
|
|
137
|
+
|
|
138
|
+
# Re-export environment symbols
|
|
139
|
+
_npm_executable = _env._npm_executable
|
|
140
|
+
_resolve_bins = _env._resolve_bins
|
|
141
|
+
_install_npm_packages = _env._install_npm_packages
|
|
142
|
+
_venv_dir = _env._venv_dir
|
|
143
|
+
_venv_bin_dir = _env._venv_bin_dir
|
|
144
|
+
_python_version_of = _env._python_version_of
|
|
145
|
+
_normalize_python_spec = _env._normalize_python_spec
|
|
146
|
+
_allowed_minors = _env._allowed_minors
|
|
147
|
+
_uv_managed_python = _env._uv_managed_python
|
|
148
|
+
_interpreter_candidates = _env._interpreter_candidates
|
|
149
|
+
_resolve_env_python = _env._resolve_env_python
|
|
150
|
+
_materialize_venv_links = _env._materialize_venv_links
|
|
151
|
+
_create_venv = _env._create_venv
|
|
152
|
+
_install_pypi_environment = _env._install_pypi_environment
|
|
153
|
+
_install_bytecode_guard = _env._install_bytecode_guard
|
|
154
|
+
_resolve_pypi_entry = _env._resolve_pypi_entry
|
|
155
|
+
_read_pyvenv_version = _env._read_pyvenv_version
|
|
156
|
+
_check_venv_shebang = _env._check_venv_shebang
|
|
157
|
+
_rewrite_venv_staging_paths = _env._rewrite_venv_staging_paths
|
|
158
|
+
|
|
159
|
+
@contextlib.contextmanager
|
|
160
|
+
def _install_lock(runtime_root: Path):
|
|
161
|
+
"""install/rollback 的跨进程互斥锁(runtime_root/.install.lock)。
|
|
162
|
+
|
|
163
|
+
并发安装会互相踩踏 staging/current/history;flock LOCK_EX|LOCK_NB
|
|
164
|
+
轮询等待至多 INSTALL_LOCK_TIMEOUT_SECONDS 秒,超时 fail-closed。
|
|
165
|
+
"""
|
|
166
|
+
lock_path = runtime_root / INSTALL_LOCK_NAME
|
|
167
|
+
if fcntl is None: # pragma: no cover - 平台差异
|
|
168
|
+
yield
|
|
169
|
+
return
|
|
170
|
+
descriptor = os.open(lock_path, os.O_RDWR | os.O_CREAT, 0o600)
|
|
171
|
+
lock_handle = os.fdopen(descriptor, "a+", encoding="utf-8")
|
|
172
|
+
deadline = time.monotonic() + INSTALL_LOCK_TIMEOUT_SECONDS
|
|
173
|
+
try:
|
|
174
|
+
while True:
|
|
175
|
+
try:
|
|
176
|
+
fcntl.flock(lock_handle.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
|
|
177
|
+
break
|
|
178
|
+
except OSError:
|
|
179
|
+
if time.monotonic() >= deadline:
|
|
180
|
+
raise McpRuntimeError(
|
|
181
|
+
f"等待 MCP runtime 安装锁超时"
|
|
182
|
+
f"({INSTALL_LOCK_TIMEOUT_SECONDS:.0f}s): {lock_path}"
|
|
183
|
+
) from None
|
|
184
|
+
time.sleep(INSTALL_LOCK_POLL_INTERVAL)
|
|
185
|
+
try:
|
|
186
|
+
yield
|
|
187
|
+
finally:
|
|
188
|
+
fcntl.flock(lock_handle.fileno(), fcntl.LOCK_UN)
|
|
189
|
+
finally:
|
|
190
|
+
lock_handle.close()
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def install_runtime(
|
|
194
|
+
lock_path: Path,
|
|
195
|
+
runtime_root: Path,
|
|
196
|
+
*,
|
|
197
|
+
npm_bin: str | None = None,
|
|
198
|
+
bugx_version: str = "unknown",
|
|
199
|
+
timeout: int = NPM_TIMEOUT_SECONDS,
|
|
200
|
+
) -> dict:
|
|
201
|
+
lock_path = Path(lock_path)
|
|
202
|
+
lock = load_lock(lock_path)
|
|
203
|
+
digest = lock_hash(lock)
|
|
204
|
+
runtime_root = reject_symlink_components(Path(runtime_root))
|
|
205
|
+
runtime_root.mkdir(parents=True, exist_ok=True)
|
|
206
|
+
with _install_lock(runtime_root):
|
|
207
|
+
return _install_runtime_locked(
|
|
208
|
+
lock, digest, runtime_root,
|
|
209
|
+
npm_bin=npm_bin, bugx_version=bugx_version, timeout=timeout,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _install_runtime_locked(
|
|
214
|
+
lock: dict,
|
|
215
|
+
digest: str,
|
|
216
|
+
runtime_root: Path,
|
|
217
|
+
*,
|
|
218
|
+
npm_bin: str | None = None,
|
|
219
|
+
bugx_version: str = "unknown",
|
|
220
|
+
timeout: int = NPM_TIMEOUT_SECONDS,
|
|
221
|
+
) -> dict:
|
|
222
|
+
final_dir = runtime_root / digest
|
|
223
|
+
|
|
224
|
+
if final_dir.exists():
|
|
225
|
+
if final_dir.is_symlink():
|
|
226
|
+
raise McpRuntimeError(f"runtime 目录被符号链接占用,拒绝处理: {final_dir}")
|
|
227
|
+
report = verify_runtime(final_dir, expect_hash=digest)
|
|
228
|
+
if not report["ok"]:
|
|
229
|
+
raise McpRuntimeError(
|
|
230
|
+
"已存在同 lock-hash 的 runtime 但完整性校验失败,拒绝覆盖;"
|
|
231
|
+
f"请人工检查后删除该目录: {final_dir};问题:"
|
|
232
|
+
+ ";".join(report["issues"][:5])
|
|
233
|
+
)
|
|
234
|
+
# 先记入批准历史再切 current:若中途失败,重跑 install 会走
|
|
235
|
+
# already-installed 路径自愈,不会出现"current 不在批准历史"粘死。
|
|
236
|
+
approved = update_history(runtime_root, digest)
|
|
237
|
+
switch_current(runtime_root, digest)
|
|
238
|
+
return {
|
|
239
|
+
"status": "already-installed",
|
|
240
|
+
"lock_hash": digest,
|
|
241
|
+
"dir": str(final_dir),
|
|
242
|
+
"approved_history": approved,
|
|
243
|
+
"npm_invoked": False,
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
staging = runtime_root / f"{STAGING_PREFIX}{digest[:12]}-{uuid.uuid4().hex[:8]}"
|
|
247
|
+
staging.mkdir()
|
|
248
|
+
npm_invoked = False
|
|
249
|
+
pypi_invoked = False
|
|
250
|
+
try:
|
|
251
|
+
all_npm = {
|
|
252
|
+
key: meta for key, meta in lock["packages"].items()
|
|
253
|
+
if meta["ecosystem"] == ECOSYSTEM_NPM
|
|
254
|
+
}
|
|
255
|
+
all_environments: dict = dict(
|
|
256
|
+
(lock.get(PYPI_SECTION) or {}).get(PYPI_ENVIRONMENTS) or {}
|
|
257
|
+
)
|
|
258
|
+
if not all_npm and not all_environments:
|
|
259
|
+
raise McpRuntimeError("lock 未声明任何可安装的包")
|
|
260
|
+
# **只安装会被启动的载荷**:lock 中 ``enabled: false`` 的 server 永不启动,
|
|
261
|
+
# 装它的载荷是纯浪费(启用必然改 lock ⇒ 换 hash ⇒ 照旧要重装,缓存零收益),
|
|
262
|
+
# 还会制造 "装了却不会启动" 的假装配状态。
|
|
263
|
+
enabled_servers = {
|
|
264
|
+
name for name, meta in lock["servers"].items()
|
|
265
|
+
if meta.get("enabled") is not False
|
|
266
|
+
}
|
|
267
|
+
enabled_npm: set[str] = set()
|
|
268
|
+
enabled_envs: set[str] = set()
|
|
269
|
+
for name in enabled_servers:
|
|
270
|
+
meta = lock["servers"][name]
|
|
271
|
+
package = str(meta.get("package") or "")
|
|
272
|
+
match = PACKAGE_KEY_RE.match(package)
|
|
273
|
+
if match is None:
|
|
274
|
+
continue
|
|
275
|
+
if match.group(1) == ECOSYSTEM_NPM:
|
|
276
|
+
enabled_npm.add(package)
|
|
277
|
+
else:
|
|
278
|
+
enabled_envs.add(str(meta.get("venv") or name))
|
|
279
|
+
npm_packages = {
|
|
280
|
+
key: meta for key, meta in all_npm.items() if key in enabled_npm
|
|
281
|
+
}
|
|
282
|
+
environments = {
|
|
283
|
+
env_id: spec for env_id, spec in all_environments.items()
|
|
284
|
+
if env_id in enabled_envs
|
|
285
|
+
}
|
|
286
|
+
skipped_payloads = {
|
|
287
|
+
"npm": sorted(set(all_npm) - set(npm_packages)),
|
|
288
|
+
"pypi": sorted(set(all_environments) - set(environments)),
|
|
289
|
+
}
|
|
290
|
+
if skipped_payloads["npm"] or skipped_payloads["pypi"]:
|
|
291
|
+
print(
|
|
292
|
+
"[mcp-runtime] 跳过 lock 禁用载荷(永不启动,不安装): "
|
|
293
|
+
+ ", ".join(skipped_payloads["npm"] + skipped_payloads["pypi"]),
|
|
294
|
+
file=sys.stderr,
|
|
295
|
+
)
|
|
296
|
+
env_pythons: dict[str, tuple[str, str, str]] = {}
|
|
297
|
+
if environments:
|
|
298
|
+
# 逐环境解析解释器 + 版本闸门,全部在**联网/建 venv 之前**完成(fail-fast)。
|
|
299
|
+
for env_id in sorted(environments):
|
|
300
|
+
env_spec = environments[env_id].get("python")
|
|
301
|
+
python_bin, python_version, python_source = _resolve_env_python(
|
|
302
|
+
env_id, env_spec,
|
|
303
|
+
)
|
|
304
|
+
if python_source == "uv-managed":
|
|
305
|
+
print(
|
|
306
|
+
f"[mcp-runtime] 自愈:pypi 环境 {env_id} 需要 Python {env_spec},"
|
|
307
|
+
f"已通过 uv 获取 {python_bin}({python_version})",
|
|
308
|
+
file=sys.stderr,
|
|
309
|
+
)
|
|
310
|
+
satisfied, detail = check_python_requires(
|
|
311
|
+
str(lock[PYPI_SECTION]["python_requires"]),
|
|
312
|
+
tuple(int(part) for part in python_version.split(".")),
|
|
313
|
+
)
|
|
314
|
+
if not satisfied:
|
|
315
|
+
raise McpRuntimeError(
|
|
316
|
+
f"pypi 环境 {env_id} 安装被拒绝:{detail}"
|
|
317
|
+
)
|
|
318
|
+
env_pythons[env_id] = (python_bin, python_version, python_source)
|
|
319
|
+
locked_packages: dict = {}
|
|
320
|
+
if npm_packages:
|
|
321
|
+
npm_invoked = True
|
|
322
|
+
locked_packages = _install_npm_packages(
|
|
323
|
+
staging, npm_packages, npm_bin=npm_bin, timeout=timeout,
|
|
324
|
+
)
|
|
325
|
+
pypi_executables: set[str] = set()
|
|
326
|
+
shebangs_rewritten = 0
|
|
327
|
+
for env_id in sorted(environments):
|
|
328
|
+
pypi_invoked = True
|
|
329
|
+
python_bin, python_version, _python_source = env_pythons[env_id]
|
|
330
|
+
pypi_executables |= _install_pypi_environment(
|
|
331
|
+
staging, lock, env_id, environments[env_id]["packages"],
|
|
332
|
+
timeout=timeout, python_bin=python_bin, python_spec=python_version,
|
|
333
|
+
)
|
|
334
|
+
# P0 修复:pip 写入的 shebang 指向 staging 路径,必须在**记录入口 hash
|
|
335
|
+
# 之前**改写到最终目录,否则 rename 后入口直接执行报 No such file。
|
|
336
|
+
shebangs_rewritten += _rewrite_venv_staging_paths(
|
|
337
|
+
staging, final_dir, env_id,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
engines: dict[str, str | None] = {}
|
|
341
|
+
servers_manifest: dict[str, dict[str, object]] = {}
|
|
342
|
+
executable_rels: set[str] = set(pypi_executables)
|
|
343
|
+
for server, server_meta in lock["servers"].items():
|
|
344
|
+
package = server_meta["package"]
|
|
345
|
+
ecosystem = PACKAGE_KEY_RE.match(package).group(1)
|
|
346
|
+
if server_meta.get("enabled") is False:
|
|
347
|
+
servers_manifest[server] = {
|
|
348
|
+
"package": package,
|
|
349
|
+
"ecosystem": ecosystem,
|
|
350
|
+
**(
|
|
351
|
+
{"venv": str(server_meta.get("venv") or server)}
|
|
352
|
+
if ecosystem == ECOSYSTEM_PYPI else {}
|
|
353
|
+
),
|
|
354
|
+
"enabled": False,
|
|
355
|
+
# 载荷**未安装**(禁用即永不启动,装它纯属浪费)。
|
|
356
|
+
"payload": "not-installed",
|
|
357
|
+
**(
|
|
358
|
+
{"disabled_reason": str(server_meta["disabled_reason"])}
|
|
359
|
+
if server_meta.get("disabled_reason") else {}
|
|
360
|
+
),
|
|
361
|
+
}
|
|
362
|
+
continue
|
|
363
|
+
if ecosystem == ECOSYSTEM_PYPI:
|
|
364
|
+
env_id = str(server_meta.get("venv") or server)
|
|
365
|
+
entry_rel = _resolve_pypi_entry(
|
|
366
|
+
staging, env_id, str(server_meta["entry"]),
|
|
367
|
+
)
|
|
368
|
+
servers_manifest[server] = {
|
|
369
|
+
"package": package,
|
|
370
|
+
"ecosystem": ecosystem,
|
|
371
|
+
"venv": env_id,
|
|
372
|
+
"entry": entry_rel,
|
|
373
|
+
"entry_sha256": sha256_file(staging / entry_rel),
|
|
374
|
+
"enabled": True,
|
|
375
|
+
**(
|
|
376
|
+
{"args": [str(item) for item in server_meta["args"]]}
|
|
377
|
+
if server_meta.get("args") else {}
|
|
378
|
+
),
|
|
379
|
+
}
|
|
380
|
+
continue
|
|
381
|
+
expected_meta = lock["packages"][package]
|
|
382
|
+
npm_name = package.split(":", 1)[1]
|
|
383
|
+
locked = locked_packages.get(f"node_modules/{npm_name}")
|
|
384
|
+
if not isinstance(locked, dict):
|
|
385
|
+
raise McpRuntimeError(
|
|
386
|
+
f"package-lock.json 缺少 {npm_name} 的顶层记录;安装树不完整"
|
|
387
|
+
)
|
|
388
|
+
actual_integrity = str(locked.get("integrity", "")).strip()
|
|
389
|
+
if actual_integrity != str(expected_meta["integrity"]).strip():
|
|
390
|
+
raise McpRuntimeError(
|
|
391
|
+
f"{npm_name} integrity 与批准 lock 不一致,疑似 registry 漂移:"
|
|
392
|
+
f"期望 {expected_meta['integrity'][:24]}… "
|
|
393
|
+
f"实际 {actual_integrity[:24]}…"
|
|
394
|
+
)
|
|
395
|
+
actual_version = str(locked.get("version", ""))
|
|
396
|
+
if actual_version != str(expected_meta["version"]):
|
|
397
|
+
raise McpRuntimeError(
|
|
398
|
+
f"{npm_name} 版本与批准 lock 不一致:期望 "
|
|
399
|
+
f"{expected_meta['version']} 实际 {actual_version}"
|
|
400
|
+
)
|
|
401
|
+
pkg_json_path = staging / "node_modules" / npm_name / "package.json"
|
|
402
|
+
package_meta = read_json_file(pkg_json_path, f"{npm_name}/package.json")
|
|
403
|
+
if not isinstance(package_meta, dict):
|
|
404
|
+
raise McpRuntimeError(f"{npm_name}/package.json 顶层必须是对象")
|
|
405
|
+
engines_field = package_meta.get("engines")
|
|
406
|
+
engines[npm_name] = (
|
|
407
|
+
engines_field.get("node") if isinstance(engines_field, dict) else None
|
|
408
|
+
)
|
|
409
|
+
bin_key, entry_rel = _resolve_bins(package_meta, npm_name, server)
|
|
410
|
+
entry_abs = staging / entry_rel
|
|
411
|
+
if entry_abs.is_symlink() or not entry_abs.is_file():
|
|
412
|
+
raise McpRuntimeError(f"{npm_name} 的入口文件不存在: {entry_rel}")
|
|
413
|
+
servers_manifest[server] = {
|
|
414
|
+
"package": package,
|
|
415
|
+
"ecosystem": ecosystem,
|
|
416
|
+
"bin_key": bin_key,
|
|
417
|
+
"entry": entry_rel,
|
|
418
|
+
"entry_sha256": sha256_file(entry_abs),
|
|
419
|
+
"enabled": True,
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
bins_by_package: dict[str, list[str]] = {}
|
|
423
|
+
for server_meta in servers_manifest.values():
|
|
424
|
+
if server_meta.get("enabled") is False:
|
|
425
|
+
continue
|
|
426
|
+
if server_meta.get("ecosystem") != ECOSYSTEM_NPM:
|
|
427
|
+
continue
|
|
428
|
+
npm_name = str(server_meta["package"]).split(":", 1)[1]
|
|
429
|
+
pkg_json_path = staging / "node_modules" / npm_name / "package.json"
|
|
430
|
+
package_meta = read_json_file(pkg_json_path, f"{npm_name}/package.json")
|
|
431
|
+
bin_field = package_meta.get("bin") if isinstance(package_meta, dict) else None
|
|
432
|
+
declared: list[str] = []
|
|
433
|
+
if isinstance(bin_field, str):
|
|
434
|
+
declared.append(bin_field)
|
|
435
|
+
elif isinstance(bin_field, dict):
|
|
436
|
+
declared.extend(
|
|
437
|
+
value for value in bin_field.values() if isinstance(value, str)
|
|
438
|
+
)
|
|
439
|
+
bins_by_package[npm_name] = declared
|
|
440
|
+
for directory, _dirnames, filenames in os.walk(staging):
|
|
441
|
+
dir_path = Path(directory)
|
|
442
|
+
for filename in filenames:
|
|
443
|
+
candidate = dir_path / filename
|
|
444
|
+
rel = candidate.relative_to(staging).as_posix()
|
|
445
|
+
for npm_name, declared in bins_by_package.items():
|
|
446
|
+
prefix = f"node_modules/{npm_name}/"
|
|
447
|
+
if rel.startswith(prefix) and rel[len(prefix):] in declared:
|
|
448
|
+
executable_rels.add(rel)
|
|
449
|
+
chmod_tree(staging, executable_rels)
|
|
450
|
+
|
|
451
|
+
files = build_file_map(staging)
|
|
452
|
+
tree = compute_tree_hash(files)
|
|
453
|
+
write_json_atomic(staging / FILEHASH_NAME, files, 0o644)
|
|
454
|
+
manifest: dict[str, object] = {
|
|
455
|
+
"schema_version": MANIFEST_SCHEMA_VERSION,
|
|
456
|
+
"kind": MANIFEST_KIND,
|
|
457
|
+
"lock_hash": digest,
|
|
458
|
+
"created_at": utc_now(),
|
|
459
|
+
"bugx_version": bugx_version,
|
|
460
|
+
"install_scripts_ignored": bool(npm_packages),
|
|
461
|
+
"pypi_only_binary": bool(environments),
|
|
462
|
+
# 因 ``enabled: false`` 而**完全未安装**的载荷(不是"装了不会启动")。
|
|
463
|
+
"skipped_payloads": skipped_payloads,
|
|
464
|
+
"venv_shebangs_rewritten": shebangs_rewritten,
|
|
465
|
+
"python_requires": (
|
|
466
|
+
str(lock[PYPI_SECTION]["python_requires"]) if environments else None
|
|
467
|
+
),
|
|
468
|
+
"pypi_environments": {
|
|
469
|
+
env_id: {
|
|
470
|
+
"python_version": env_pythons[env_id][1],
|
|
471
|
+
"python_source": env_pythons[env_id][2],
|
|
472
|
+
"python_requires": str(lock[PYPI_SECTION]["python_requires"]),
|
|
473
|
+
"package_count": len(environments[env_id]["packages"]),
|
|
474
|
+
}
|
|
475
|
+
for env_id in sorted(environments)
|
|
476
|
+
},
|
|
477
|
+
"packages": {
|
|
478
|
+
**{
|
|
479
|
+
key: {
|
|
480
|
+
"ecosystem": meta["ecosystem"],
|
|
481
|
+
"version": str(meta["version"]),
|
|
482
|
+
"engines_node": engines.get(key.split(":", 1)[1]),
|
|
483
|
+
"integrity": str(meta["integrity"]),
|
|
484
|
+
}
|
|
485
|
+
for key, meta in lock["packages"].items()
|
|
486
|
+
},
|
|
487
|
+
**{
|
|
488
|
+
f"pypi:{env_id}:{name}": {
|
|
489
|
+
"ecosystem": ECOSYSTEM_PYPI,
|
|
490
|
+
"version": str(meta["version"]),
|
|
491
|
+
"hashes": list(meta["hashes"]),
|
|
492
|
+
"venv": env_id,
|
|
493
|
+
"engines_node": None,
|
|
494
|
+
}
|
|
495
|
+
for env_id, env_meta in environments.items()
|
|
496
|
+
for name, meta in env_meta["packages"].items()
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
"servers": servers_manifest,
|
|
500
|
+
"tree_hash": tree,
|
|
501
|
+
"file_count": len(files),
|
|
502
|
+
"total_bytes": sum(int(meta["size"]) for meta in files.values()),
|
|
503
|
+
}
|
|
504
|
+
if npm_packages:
|
|
505
|
+
node_bin = find_node(None)
|
|
506
|
+
manifest["node_version_used"] = "v%d.%d.%d" % node_version_tuple(node_bin)
|
|
507
|
+
write_json_atomic(staging / MANIFEST_NAME, manifest, 0o644)
|
|
508
|
+
|
|
509
|
+
report = verify_runtime(
|
|
510
|
+
staging, expect_hash=digest, check_dirname=False,
|
|
511
|
+
published_dir=final_dir,
|
|
512
|
+
)
|
|
513
|
+
if not report["ok"]:
|
|
514
|
+
raise McpRuntimeError(
|
|
515
|
+
"安装后自检失败,未发布该 runtime:" +
|
|
516
|
+
";".join(report["issues"][:5])
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
try:
|
|
520
|
+
os.rename(staging, final_dir)
|
|
521
|
+
except OSError as exc:
|
|
522
|
+
if exc.errno in (errno.EEXIST, errno.ENOTEMPTY):
|
|
523
|
+
# 持锁后仍撞上同名目录:另一进程在我们 npm install 期间
|
|
524
|
+
# 抢先发布了同一 lock-hash(历史遗留无锁安装)。转为明确
|
|
525
|
+
# 的 already-installed 错误,绝不覆盖既有 runtime。
|
|
526
|
+
raise McpRuntimeError(
|
|
527
|
+
f"already-installed: runtime 目录已被并发安装发布: {final_dir};"
|
|
528
|
+
"请重跑 install 走 already-installed 校验路径"
|
|
529
|
+
) from exc
|
|
530
|
+
raise
|
|
531
|
+
os.chmod(final_dir, 0o755)
|
|
532
|
+
except BaseException:
|
|
533
|
+
shutil.rmtree(staging, ignore_errors=True)
|
|
534
|
+
raise
|
|
535
|
+
|
|
536
|
+
# 先记入批准历史再切 current:若切 current 中途失败,重跑 install
|
|
537
|
+
# 会走 already-installed 路径自愈,避免"current 不在批准历史"粘死。
|
|
538
|
+
approved = update_history(runtime_root, digest)
|
|
539
|
+
switch_current(runtime_root, digest)
|
|
540
|
+
return {
|
|
541
|
+
"status": "installed",
|
|
542
|
+
"lock_hash": digest,
|
|
543
|
+
"dir": str(final_dir),
|
|
544
|
+
"servers": servers_manifest,
|
|
545
|
+
"file_count": manifest["file_count"],
|
|
546
|
+
"total_bytes": manifest["total_bytes"],
|
|
547
|
+
"tree_hash": manifest["tree_hash"],
|
|
548
|
+
"approved_history": approved,
|
|
549
|
+
"npm_invoked": npm_invoked,
|
|
550
|
+
"pypi_invoked": pypi_invoked,
|
|
551
|
+
"install_scripts_ignored": bool(npm_packages),
|
|
552
|
+
"pypi_only_binary": bool(environments),
|
|
553
|
+
# 因 ``enabled: false`` 而**完全未安装**的载荷(不是"装了不会启动")。
|
|
554
|
+
"skipped_payloads": skipped_payloads,
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
# ---------------------------------------------------------------------------
|
|
559
|
+
# 回滚 / 启动
|
|
560
|
+
# ---------------------------------------------------------------------------
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
def rollback_runtime(runtime_root: Path, *, node_override: str | None = None) -> dict:
|
|
564
|
+
runtime_root = reject_symlink_components(Path(runtime_root))
|
|
565
|
+
if not runtime_root.is_dir():
|
|
566
|
+
raise McpRuntimeError("没有批准历史可回滚;请先执行 bugx mcp-runtime install")
|
|
567
|
+
with _install_lock(runtime_root):
|
|
568
|
+
return _rollback_runtime_locked(runtime_root, node_override=node_override)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def _rollback_runtime_locked(runtime_root: Path, *,
|
|
572
|
+
node_override: str | None = None) -> dict:
|
|
573
|
+
history = load_history(runtime_root)
|
|
574
|
+
if not history:
|
|
575
|
+
raise McpRuntimeError("没有批准历史可回滚;请先执行 bugx mcp-runtime install")
|
|
576
|
+
current = read_current(runtime_root)
|
|
577
|
+
if current is None:
|
|
578
|
+
raise McpRuntimeError(
|
|
579
|
+
"current 链接缺失或非法,无法定位当前位置;请重新执行 install 或 doctor 诊断"
|
|
580
|
+
)
|
|
581
|
+
if current not in history:
|
|
582
|
+
raise McpRuntimeError(
|
|
583
|
+
f"当前 hash {current[:12]}… 不在批准历史中,拒绝盲切;请人工核查"
|
|
584
|
+
)
|
|
585
|
+
index = history.index(current)
|
|
586
|
+
if index == 0:
|
|
587
|
+
raise McpRuntimeError("当前已是最早的批准版本,没有更早的可回滚目标")
|
|
588
|
+
previous = history[index - 1]
|
|
589
|
+
previous_dir = runtime_root / previous
|
|
590
|
+
if previous_dir.is_symlink() or not previous_dir.is_dir():
|
|
591
|
+
raise McpRuntimeError(
|
|
592
|
+
f"上一批准版本的 runtime 目录缺失: {previous_dir};不会重新下载"
|
|
593
|
+
)
|
|
594
|
+
report = verify_runtime(previous_dir, expect_hash=previous, node_override=node_override)
|
|
595
|
+
if not report["ok"]:
|
|
596
|
+
raise McpRuntimeError(
|
|
597
|
+
"上一批准版本完整性校验失败,拒绝切换:" +
|
|
598
|
+
";".join(report["issues"][:5])
|
|
599
|
+
)
|
|
600
|
+
switch_current(runtime_root, previous)
|
|
601
|
+
return {
|
|
602
|
+
"status": "rolled-back",
|
|
603
|
+
"rolled_back_to": previous,
|
|
604
|
+
"previous_current": current,
|
|
605
|
+
"approved_history": history,
|
|
606
|
+
"verification": report["checks"],
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def _pypi_launch_env(
|
|
611
|
+
runtime_dir: Path, server: str, server_meta: dict,
|
|
612
|
+
) -> dict[str, str]:
|
|
613
|
+
"""pypi server 的启动环境:**锁定载荷优先**。
|
|
614
|
+
|
|
615
|
+
实测:``semgrep-mcp`` 通过 PATH 解析 ``semgrep`` CLI;不把本 runtime 的 venv
|
|
616
|
+
放到最前,它会静默使用主机上任意版本的 semgrep(lock 钉 1.135.0,主机 1.176.0
|
|
617
|
+
被实际调用)——等于绕过 lock 完整性。
|
|
618
|
+
"""
|
|
619
|
+
env_id = str(server_meta.get("venv") or server)
|
|
620
|
+
venv_dir = runtime_dir / VENV_DIRNAME / env_id
|
|
621
|
+
venv_bin = venv_dir / ("Scripts" if os.name == "nt" else "bin")
|
|
622
|
+
inherited = [
|
|
623
|
+
item for item in os.environ.get("PATH", "").split(os.pathsep) if item
|
|
624
|
+
]
|
|
625
|
+
return {
|
|
626
|
+
"PATH": os.pathsep.join([str(venv_bin), *inherited]),
|
|
627
|
+
"VIRTUAL_ENV": str(venv_dir),
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def start_server(
|
|
632
|
+
runtime_root: Path,
|
|
633
|
+
server: str,
|
|
634
|
+
*,
|
|
635
|
+
print_command: bool = False,
|
|
636
|
+
node_override: str | None = None,
|
|
637
|
+
) -> int:
|
|
638
|
+
runtime_root = reject_symlink_components(Path(runtime_root))
|
|
639
|
+
current = read_current(runtime_root)
|
|
640
|
+
if current is None:
|
|
641
|
+
raise McpRuntimeError(
|
|
642
|
+
"离线 MCP runtime 尚未安装或 current 缺失;请运行 bugx mcp-runtime install"
|
|
643
|
+
)
|
|
644
|
+
runtime_dir = runtime_root / current
|
|
645
|
+
report = verify_runtime(runtime_dir, expect_hash=current, node_override=node_override)
|
|
646
|
+
if not report["ok"]:
|
|
647
|
+
raise McpRuntimeError(
|
|
648
|
+
f"MCP runtime 完整性校验失败,fail-closed 拒绝启动 {server}:" +
|
|
649
|
+
";".join(report["issues"][:5])
|
|
650
|
+
)
|
|
651
|
+
manifest = load_manifest(runtime_dir)
|
|
652
|
+
entry_rel, _expected = resolve_server_entry(manifest, server)
|
|
653
|
+
entry_abs = (runtime_dir / entry_rel).resolve(strict=True)
|
|
654
|
+
server_meta = manifest["servers"][server]
|
|
655
|
+
ecosystem = (
|
|
656
|
+
str(server_meta.get("ecosystem", ECOSYSTEM_NPM))
|
|
657
|
+
if isinstance(server_meta, dict) else ECOSYSTEM_NPM
|
|
658
|
+
)
|
|
659
|
+
if ecosystem == ECOSYSTEM_PYPI:
|
|
660
|
+
# pypi 服务:console script 自带 venv 解释器 shebang,直接 exec;
|
|
661
|
+
# 绝不调用 pip/uv(network_policy 不变量不变)。
|
|
662
|
+
# 部分包把 MCP 入口做成子命令(如 `semgrep mcp`),args 由 lock 显式声明,
|
|
663
|
+
# 不在代码里硬编码任何包名。
|
|
664
|
+
extra = server_meta.get("args") or []
|
|
665
|
+
if extra and not isinstance(extra, list):
|
|
666
|
+
raise McpRuntimeError(f"server {server} 的 manifest args 必须为数组")
|
|
667
|
+
argv = [str(entry_abs), *[str(item) for item in extra]]
|
|
668
|
+
else:
|
|
669
|
+
node_bin = find_node(node_override)
|
|
670
|
+
argv = [str(node_bin), str(entry_abs)]
|
|
671
|
+
if print_command:
|
|
672
|
+
print(json.dumps({
|
|
673
|
+
"server": server,
|
|
674
|
+
"ecosystem": ecosystem,
|
|
675
|
+
"argv": argv,
|
|
676
|
+
"env_overrides": LAUNCH_ENV_OVERRIDES,
|
|
677
|
+
"lock_hash": current,
|
|
678
|
+
"runtime_dir": str(runtime_dir),
|
|
679
|
+
"network_policy": "no-package-manager",
|
|
680
|
+
}, ensure_ascii=False))
|
|
681
|
+
return 0
|
|
682
|
+
print(
|
|
683
|
+
f"[bugx-mcp-runtime] server={server} entry={entry_abs} "
|
|
684
|
+
f"lock={current[:12]} policy=no-package-manager",
|
|
685
|
+
file=sys.stderr,
|
|
686
|
+
)
|
|
687
|
+
environment = dict(os.environ)
|
|
688
|
+
environment.update(LAUNCH_ENV_OVERRIDES)
|
|
689
|
+
if ecosystem == ECOSYSTEM_PYPI:
|
|
690
|
+
environment.update(_pypi_launch_env(runtime_dir, server, server_meta))
|
|
691
|
+
os.execve(argv[0], argv, environment)
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
# ---------------------------------------------------------------------------
|
|
695
|
+
# doctor
|
|
696
|
+
# ---------------------------------------------------------------------------
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
def doctor_runtime(
|
|
700
|
+
runtime_root: Path,
|
|
701
|
+
lock_path: Path | None = None,
|
|
702
|
+
*, node_override: str | None = None,
|
|
703
|
+
fast: bool = True,
|
|
704
|
+
) -> dict:
|
|
705
|
+
runtime_root = reject_symlink_components(Path(runtime_root))
|
|
706
|
+
checks: list[dict[str, object]] = []
|
|
707
|
+
available: list[str] = []
|
|
708
|
+
if runtime_root.is_dir() and not runtime_root.is_symlink():
|
|
709
|
+
for entry in sorted(runtime_root.iterdir()):
|
|
710
|
+
if entry.name.startswith(STAGING_PREFIX):
|
|
711
|
+
checks.append({
|
|
712
|
+
"name": "残留暂存目录", "ok": False,
|
|
713
|
+
"detail": f"安装中断残留 {entry.name};可安全删除后重试 install",
|
|
714
|
+
})
|
|
715
|
+
continue
|
|
716
|
+
if entry.is_symlink() or not entry.is_dir():
|
|
717
|
+
continue
|
|
718
|
+
if HEX64_RE.match(entry.name):
|
|
719
|
+
available.append(entry.name)
|
|
720
|
+
checks.insert(0, {
|
|
721
|
+
"name": "runtime 根目录",
|
|
722
|
+
"ok": runtime_root.is_dir() and not runtime_root.is_symlink(),
|
|
723
|
+
"detail": str(runtime_root),
|
|
724
|
+
})
|
|
725
|
+
|
|
726
|
+
lock_info: dict[str, object] | None = None
|
|
727
|
+
if lock_path is not None:
|
|
728
|
+
try:
|
|
729
|
+
lock = load_lock(Path(lock_path))
|
|
730
|
+
lock_info = {
|
|
731
|
+
"path": str(lock_path),
|
|
732
|
+
"hash": lock_hash(lock),
|
|
733
|
+
"packages": sorted(lock["packages"]),
|
|
734
|
+
"servers": sorted(lock["servers"]),
|
|
735
|
+
}
|
|
736
|
+
checks.append({
|
|
737
|
+
"name": "bundled lock", "ok": True,
|
|
738
|
+
"detail": f"hash={lock_info['hash'][:12]} 包数 {len(lock['packages'])}",
|
|
739
|
+
})
|
|
740
|
+
except McpRuntimeError as exc:
|
|
741
|
+
checks.append({"name": "bundled lock", "ok": False, "detail": str(exc)})
|
|
742
|
+
lock_info = {"path": str(lock_path), "error": str(exc)}
|
|
743
|
+
|
|
744
|
+
current = None
|
|
745
|
+
try:
|
|
746
|
+
current = read_current(runtime_root)
|
|
747
|
+
checks.append({
|
|
748
|
+
"name": "current 链接",
|
|
749
|
+
"ok": current is not None,
|
|
750
|
+
"detail": current or "未设置(尚未安装)",
|
|
751
|
+
})
|
|
752
|
+
except McpRuntimeError as exc:
|
|
753
|
+
checks.append({"name": "current 链接", "ok": False, "detail": str(exc)})
|
|
754
|
+
|
|
755
|
+
verification: dict[str, object] | None = None
|
|
756
|
+
if current is not None:
|
|
757
|
+
current_dir = runtime_root / current
|
|
758
|
+
verification = verify_runtime(current_dir, node_override=node_override, fast=fast)
|
|
759
|
+
for item in verification["checks"]:
|
|
760
|
+
label = {
|
|
761
|
+
"runtime 目录": "runtime 目录存在",
|
|
762
|
+
"runtime manifest": "runtime manifest",
|
|
763
|
+
}.get(str(item["name"]), str(item["name"]))
|
|
764
|
+
checks.append({
|
|
765
|
+
"name": f"当前 runtime:{label}",
|
|
766
|
+
"ok": bool(item["ok"]),
|
|
767
|
+
"detail": str(item["detail"]),
|
|
768
|
+
})
|
|
769
|
+
try:
|
|
770
|
+
manifest = load_manifest(current_dir)
|
|
771
|
+
except McpRuntimeError:
|
|
772
|
+
manifest = None
|
|
773
|
+
if isinstance(manifest, dict):
|
|
774
|
+
for server, meta in sorted(manifest["servers"].items()):
|
|
775
|
+
enabled = bool(meta.get("enabled", True)) \
|
|
776
|
+
if isinstance(meta, dict) else True
|
|
777
|
+
checks.append({
|
|
778
|
+
"name": f"server {server}",
|
|
779
|
+
"ok": True,
|
|
780
|
+
"detail": ("启用" if enabled else
|
|
781
|
+
"按 lock 停用(SPIKE-008-01 未通过)"),
|
|
782
|
+
})
|
|
783
|
+
|
|
784
|
+
node_ok = True
|
|
785
|
+
node_detail = "node 未找到"
|
|
786
|
+
try:
|
|
787
|
+
node_bin = find_node(node_override)
|
|
788
|
+
version = node_version_tuple(node_bin)
|
|
789
|
+
node_ok = True
|
|
790
|
+
node_detail = f"node {'v%d.%d.%d' % version} @ {node_bin}"
|
|
791
|
+
except McpRuntimeError as exc:
|
|
792
|
+
node_ok = False
|
|
793
|
+
node_detail = str(exc)
|
|
794
|
+
checks.append({"name": "Node 可用性", "ok": node_ok, "detail": node_detail})
|
|
795
|
+
|
|
796
|
+
ready = all(bool(item["ok"]) for item in checks)
|
|
797
|
+
payload = {
|
|
798
|
+
"schema_version": MANIFEST_SCHEMA_VERSION,
|
|
799
|
+
"target": "mcp-runtime",
|
|
800
|
+
"runtime_root": str(runtime_root),
|
|
801
|
+
"installed": bool(available),
|
|
802
|
+
"available_hashes": available,
|
|
803
|
+
"current": current,
|
|
804
|
+
"lock": lock_info,
|
|
805
|
+
"checks": checks,
|
|
806
|
+
"issues": [] if verification is None else list(verification["issues"]),
|
|
807
|
+
"ready": ready,
|
|
808
|
+
}
|
|
809
|
+
return payload
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
# ---------------------------------------------------------------------------
|
|
813
|
+
# CLI 入口
|
|
814
|
+
# ---------------------------------------------------------------------------
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
818
|
+
parser = argparse.ArgumentParser(
|
|
819
|
+
prog="mcp_runtime.py", description="BugX 离线 MCP runtime 管理(DOC-008 §12)",
|
|
820
|
+
)
|
|
821
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
822
|
+
|
|
823
|
+
lock_info = sub.add_parser("lock-info", help="读取并校验 mcp-lock.json")
|
|
824
|
+
lock_info.add_argument("--lock", type=Path, required=True)
|
|
825
|
+
lock_info.set_defaults(func=_cmd_lock_info)
|
|
826
|
+
|
|
827
|
+
install = sub.add_parser("install", help="按 lock 安装新 runtime 并原子发布")
|
|
828
|
+
install.add_argument("--lock", type=Path, required=True)
|
|
829
|
+
install.add_argument("--runtime-root", type=Path, required=True)
|
|
830
|
+
install.add_argument("--npm", default=None)
|
|
831
|
+
install.add_argument("--bugx-version", default="unknown")
|
|
832
|
+
install.add_argument("--timeout", type=int, default=NPM_TIMEOUT_SECONDS)
|
|
833
|
+
install.add_argument("--json", action="store_true")
|
|
834
|
+
install.set_defaults(func=_cmd_install)
|
|
835
|
+
|
|
836
|
+
verify = sub.add_parser("verify", help="深度校验当前 runtime 完整性")
|
|
837
|
+
verify.add_argument("--runtime-root", type=Path, required=True)
|
|
838
|
+
verify.add_argument("--expect-hash", default=None)
|
|
839
|
+
verify.add_argument("--node", default=None)
|
|
840
|
+
verify.add_argument("--json", action="store_true")
|
|
841
|
+
verify.set_defaults(func=_cmd_verify)
|
|
842
|
+
|
|
843
|
+
start = sub.add_parser("start", help="校验后以 node 直接启动 MCP 服务入口")
|
|
844
|
+
start.add_argument("--runtime-root", type=Path, required=True)
|
|
845
|
+
start.add_argument("--server", required=True)
|
|
846
|
+
start.add_argument("--print-command", action="store_true")
|
|
847
|
+
start.add_argument("--node", default=None)
|
|
848
|
+
start.set_defaults(func=_cmd_start)
|
|
849
|
+
|
|
850
|
+
rollback = sub.add_parser("rollback", help="切换回上一批准 lock-hash(不下载)")
|
|
851
|
+
rollback.add_argument("--runtime-root", type=Path, required=True)
|
|
852
|
+
rollback.add_argument("--node", default=None)
|
|
853
|
+
rollback.add_argument("--json", action="store_true")
|
|
854
|
+
rollback.set_defaults(func=_cmd_rollback)
|
|
855
|
+
|
|
856
|
+
doctor = sub.add_parser("doctor", help="机器可读的 runtime 诊断")
|
|
857
|
+
doctor.add_argument("--runtime-root", type=Path, required=True)
|
|
858
|
+
doctor.add_argument("--lock", type=Path, default=None)
|
|
859
|
+
doctor.add_argument("--node", default=None)
|
|
860
|
+
doctor.add_argument("--json", action="store_true")
|
|
861
|
+
doctor.add_argument("--fast", action="store_true", default=True, help="快速校验(默认启用)")
|
|
862
|
+
doctor.add_argument("--deep", action="store_false", dest="fast", help="深度全量哈希重算校验")
|
|
863
|
+
doctor.set_defaults(func=_cmd_doctor)
|
|
864
|
+
return parser
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
def _emit(payload: dict) -> None:
|
|
868
|
+
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def _cmd_lock_info(args: argparse.Namespace) -> int:
|
|
872
|
+
lock = load_lock(args.lock)
|
|
873
|
+
_emit({
|
|
874
|
+
"schema_version": lock["schema_version"],
|
|
875
|
+
"lock_hash": lock_hash(lock),
|
|
876
|
+
"packages": sorted(lock["packages"]),
|
|
877
|
+
"servers": sorted(lock["servers"]),
|
|
878
|
+
})
|
|
879
|
+
return 0
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
def _cmd_install(args: argparse.Namespace) -> int:
|
|
883
|
+
result = install_runtime(
|
|
884
|
+
args.lock, args.runtime_root, npm_bin=args.npm,
|
|
885
|
+
bugx_version=args.bugx_version, timeout=args.timeout,
|
|
886
|
+
)
|
|
887
|
+
if args.json or sys.stdout.isatty() is False:
|
|
888
|
+
_emit(result)
|
|
889
|
+
else:
|
|
890
|
+
print(f"已发布 {result['status']}: {result['dir']}")
|
|
891
|
+
return 0
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
def _cmd_verify(args: argparse.Namespace) -> int:
|
|
895
|
+
runtime_root = Path(args.runtime_root)
|
|
896
|
+
current = read_current(runtime_root)
|
|
897
|
+
expect = args.expect_hash or current
|
|
898
|
+
if expect is None:
|
|
899
|
+
raise McpRuntimeError("runtime 未安装(缺少 current),无可校验对象")
|
|
900
|
+
report = verify_runtime(
|
|
901
|
+
runtime_root / expect, expect_hash=expect, node_override=args.node,
|
|
902
|
+
)
|
|
903
|
+
if args.json:
|
|
904
|
+
_emit(report)
|
|
905
|
+
else:
|
|
906
|
+
for item in report["checks"]:
|
|
907
|
+
print(f" {'✓' if item['ok'] else '!'} {item['name']}: {item['detail']}")
|
|
908
|
+
return 0 if report["ok"] else 1
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
def _cmd_start(args: argparse.Namespace) -> int:
|
|
912
|
+
return start_server(
|
|
913
|
+
Path(args.runtime_root), args.server,
|
|
914
|
+
print_command=args.print_command, node_override=args.node,
|
|
915
|
+
)
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
def _cmd_rollback(args: argparse.Namespace) -> int:
|
|
919
|
+
result = rollback_runtime(Path(args.runtime_root), node_override=args.node)
|
|
920
|
+
if args.json:
|
|
921
|
+
_emit(result)
|
|
922
|
+
else:
|
|
923
|
+
print(f"已回滚到 {result['rolled_back_to'][:12]}(原 {result['previous_current'][:12]})")
|
|
924
|
+
return 0
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
def _cmd_doctor(args: argparse.Namespace) -> int:
|
|
928
|
+
fast = getattr(args, "fast", True)
|
|
929
|
+
payload = doctor_runtime(
|
|
930
|
+
Path(args.runtime_root), args.lock, node_override=args.node, fast=fast,
|
|
931
|
+
)
|
|
932
|
+
if args.json or not sys.stdout.isatty():
|
|
933
|
+
_emit(payload)
|
|
934
|
+
else:
|
|
935
|
+
print(f"MCP runtime @ {payload['runtime_root']}")
|
|
936
|
+
for item in payload["checks"]:
|
|
937
|
+
marker = "✓" if item["ok"] else "!"
|
|
938
|
+
print(f" {marker} {item['name']}: {item['detail']}")
|
|
939
|
+
for issue in payload["issues"]:
|
|
940
|
+
print(f" ! 不一致:{issue}")
|
|
941
|
+
print("结论:" + ("就绪" if payload["ready"] else "存在问题"))
|
|
942
|
+
return 0 if payload["ready"] else 1
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
def main(argv: list[str] | None = None) -> int:
|
|
946
|
+
parser = build_parser()
|
|
947
|
+
args = parser.parse_args(argv)
|
|
948
|
+
try:
|
|
949
|
+
return int(args.func(args))
|
|
950
|
+
except McpRuntimeError as exc:
|
|
951
|
+
wants_json = getattr(args, "json", False) or not sys.stdout.isatty()
|
|
952
|
+
if wants_json:
|
|
953
|
+
_emit({"ok": False, "error": str(exc)})
|
|
954
|
+
else:
|
|
955
|
+
print(f"错误:{exc}", file=sys.stderr)
|
|
956
|
+
return 1
|
|
957
|
+
except OSError as exc:
|
|
958
|
+
wants_json = getattr(args, "json", False) or not sys.stdout.isatty()
|
|
959
|
+
message = f"文件系统错误: {exc}"
|
|
960
|
+
if wants_json:
|
|
961
|
+
_emit({"ok": False, "error": message})
|
|
962
|
+
else:
|
|
963
|
+
print(f"错误:{message}", file=sys.stderr)
|
|
964
|
+
return 1
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
if __name__ == "__main__":
|
|
968
|
+
sys.exit(main())
|