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,458 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""guide_budget.py — 指南上下文预算度量:每文档、每章节的 token 成本。
|
|
3
|
+
|
|
4
|
+
bugx.md 全文是每次会话的固定上下文地板(实测约 5 万 conservative token)。
|
|
5
|
+
本工具按 Markdown 标题切分统计各层/各章节成本,为「L0 常驻 + 章节按需
|
|
6
|
+
加载」的分层策略提供度量,防止指南回潮膨胀。
|
|
7
|
+
|
|
8
|
+
用法:
|
|
9
|
+
python3 guide_budget.py [--top 15] [--json]
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
# --- 引擎导入根(直接执行脚本时自举 core.* 命名空间)---
|
|
14
|
+
import sys as _sys
|
|
15
|
+
from pathlib import Path as _Path
|
|
16
|
+
|
|
17
|
+
for _p in _Path(__file__).resolve().parents:
|
|
18
|
+
if (_p / "core" / "bugx.md").is_file():
|
|
19
|
+
if str(_p) not in _sys.path:
|
|
20
|
+
_sys.path.insert(0, str(_p))
|
|
21
|
+
break
|
|
22
|
+
del _p
|
|
23
|
+
|
|
24
|
+
import argparse
|
|
25
|
+
import json
|
|
26
|
+
import math
|
|
27
|
+
import sys
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
from typing import Iterable, Mapping
|
|
30
|
+
|
|
31
|
+
SCRIPT_DIR = Path(__file__).resolve().parent.parent
|
|
32
|
+
if str(SCRIPT_DIR) not in sys.path:
|
|
33
|
+
# 幂等注入:本模块会被 `spec_from_file_location` 重复执行(预算门禁按仓库 core/
|
|
34
|
+
# 显式加载),无条件 insert 会让 sys.path 每次多一条,撞坏
|
|
35
|
+
# `test_spec_contracts::test_core_dir_is_added_to_sys_path_exactly_once`。
|
|
36
|
+
sys.path.insert(0, str(SCRIPT_DIR))
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
from .token_budget import estimate_tokens # noqa: E402
|
|
40
|
+
except ImportError:
|
|
41
|
+
from core.governance.token_budget import estimate_tokens # noqa: E402
|
|
42
|
+
|
|
43
|
+
SYSTEM_PROMPT_BUDGET_LIMITS = {
|
|
44
|
+
"L0_router": 1500, # L0 路由入口 (l0_router.md)
|
|
45
|
+
"L1_stage": 2500, # L1 各阶段卡 (stage_*.md)
|
|
46
|
+
"L2_rule": 1500, # L2 各专项规则 (rules/*.md)
|
|
47
|
+
"worker": 4000, # Worker 提示词 (bugx-worker.md)
|
|
48
|
+
"host_skill": 3600, # 宿主 Skill 入口 (SKILL.md) 承载 AI 执行元指南、决策树与紧凑命令雷达 (DOC-251)
|
|
49
|
+
"opencode_entry": 3500, # OpenCode 精简入口 (bugx-opencode.md)
|
|
50
|
+
"agent_guide_startup": 1800, # AGENT_GUIDE 启动协议单章 (DOC-034 验收判据)
|
|
51
|
+
"agent_guide_total": 8500, # AGENT_GUIDE 全文上限
|
|
52
|
+
"quick_card": 1000, # bugx-quick.md 极速卡上限
|
|
53
|
+
"bugx_full": 38000, # bugx.md 全文上限 (DOC-034 验收判据)
|
|
54
|
+
"l0_ratio_max": 0.10, # L0 常驻占比上限 (DOC-034 验收判据)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# 路径相对 ``core/``(``SCRIPT_DIR``)。契约类文档统一归档在 ``contracts/``、
|
|
58
|
+
# 账本与知识库分别归档在 ``ledger/`` 与 ``planning/``——迁移后旧的扁平名已不存在,
|
|
59
|
+
# 而 ``measure()`` 对缺失文件是**静默跳过**的,路径一漂就会少统计若干层且不报错。
|
|
60
|
+
# 因此每个条目都必须指向真实存在的文件,并由
|
|
61
|
+
# ``tests/governance/test_token_economy.py`` 的覆盖守卫钉住条数。
|
|
62
|
+
DOC_LAYERS = [
|
|
63
|
+
("L0", "prompts/l0_router.md"),
|
|
64
|
+
("L1", "contracts/bugx-quick.md"),
|
|
65
|
+
("L1", "contracts/bugx-opencode.md"),
|
|
66
|
+
("L1", "contracts/AGENT_GUIDE.md"),
|
|
67
|
+
("L1", "prompts/stages/stage_gate.md"),
|
|
68
|
+
("L1", "prompts/stages/stage_explore.md"),
|
|
69
|
+
("L1", "prompts/stages/stage_mutate.md"),
|
|
70
|
+
("L1", "prompts/stages/stage_repair.md"),
|
|
71
|
+
("L1", "bugx.md"),
|
|
72
|
+
("L2", "prompts/rules/anti_patterns.md"),
|
|
73
|
+
("L2", "prompts/rules/concurrency_rules.md"),
|
|
74
|
+
("L2", "prompts/rules/memory_leak_rules.md"),
|
|
75
|
+
("L2", "prompts/rules/prompt_injection_defense.md"),
|
|
76
|
+
("L2", "ledger/mistake-book.md"),
|
|
77
|
+
("L2", "planning/tools-kb.md"),
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _sections(text: str) -> list[tuple[str, str]]:
|
|
82
|
+
"""按 ##/### 标题切分;返回 (标题, 正文) 列表,首个无标题段记为 preamble。"""
|
|
83
|
+
parts: list[tuple[str, str]] = []
|
|
84
|
+
current_title = "(preamble)"
|
|
85
|
+
buffer: list[str] = []
|
|
86
|
+
for line in text.splitlines():
|
|
87
|
+
if line.lstrip().startswith(("# ", "## ", "### ")):
|
|
88
|
+
if buffer:
|
|
89
|
+
parts.append((current_title, "\n".join(buffer)))
|
|
90
|
+
buffer = []
|
|
91
|
+
current_title = line.lstrip().lstrip("#").strip() or "(untitled)"
|
|
92
|
+
buffer.append(line)
|
|
93
|
+
if buffer:
|
|
94
|
+
parts.append((current_title, "\n".join(buffer)))
|
|
95
|
+
return parts
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def slice_guide_context(
|
|
99
|
+
text: str,
|
|
100
|
+
sections: Iterable[str] | None = None,
|
|
101
|
+
*,
|
|
102
|
+
max_chars: int = 12000,
|
|
103
|
+
required_markers: Iterable[str] = (),
|
|
104
|
+
) -> str:
|
|
105
|
+
"""按标题白名单切片指南,返回可直接注入 Worker 的 bounded 文本。
|
|
106
|
+
|
|
107
|
+
``required_markers`` 用于调用方声明不可丢失的安全/证据短语;切片后缺失时
|
|
108
|
+
显式失败,避免为了节省上下文而静默移除门禁。未知标题也显式失败。
|
|
109
|
+
"""
|
|
110
|
+
if not isinstance(text, str):
|
|
111
|
+
raise ValueError("指南内容必须是字符串")
|
|
112
|
+
if not isinstance(max_chars, int) or isinstance(max_chars, bool) or max_chars < 1:
|
|
113
|
+
raise ValueError("max_chars 必须是正整数")
|
|
114
|
+
available = _sections(text)
|
|
115
|
+
by_title = {title.casefold(): body for title, body in available}
|
|
116
|
+
wanted = [str(item).strip() for item in (sections or []) if str(item).strip()]
|
|
117
|
+
unknown = [item for item in wanted if item.casefold() not in by_title]
|
|
118
|
+
if unknown:
|
|
119
|
+
raise ValueError(f"指南章节不存在: {', '.join(unknown)}")
|
|
120
|
+
selected = [by_title[item.casefold()] for item in wanted] if wanted else [body for _, body in available]
|
|
121
|
+
result = "\n\n".join(selected).strip()
|
|
122
|
+
if len(result) > max_chars:
|
|
123
|
+
marker = "\n...[BugX guide slice truncated]\n"
|
|
124
|
+
if max_chars <= len(marker):
|
|
125
|
+
raise ValueError("max_chars 太小,无法保留切片标记")
|
|
126
|
+
cut = result[:max_chars - len(marker)].rsplit("\n", 1)[0].rstrip()
|
|
127
|
+
result = cut + marker
|
|
128
|
+
missing = [marker for marker in required_markers if str(marker) not in result]
|
|
129
|
+
if missing:
|
|
130
|
+
raise ValueError(f"切片缺少必需规则: {', '.join(map(str, missing))}")
|
|
131
|
+
return result
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def recommend_budget(
|
|
135
|
+
units: Iterable[Mapping[str, object]],
|
|
136
|
+
*,
|
|
137
|
+
total_budget: int,
|
|
138
|
+
min_budget: int = 1,
|
|
139
|
+
) -> dict:
|
|
140
|
+
"""按已观测 Finding/新行为把预算倾斜到热点单元,只给建议不改调度状态。"""
|
|
141
|
+
records = [item for item in units if isinstance(item, Mapping)]
|
|
142
|
+
if not records:
|
|
143
|
+
raise ValueError("units 不能为空")
|
|
144
|
+
if not isinstance(total_budget, int) or isinstance(total_budget, bool) or total_budget < 1:
|
|
145
|
+
raise ValueError("total_budget 必须是正整数")
|
|
146
|
+
if not isinstance(min_budget, int) or isinstance(min_budget, bool) or min_budget < 1:
|
|
147
|
+
raise ValueError("min_budget 必须是正整数")
|
|
148
|
+
if total_budget < len(records) * min_budget:
|
|
149
|
+
raise ValueError("total_budget 不足以覆盖每个单元的最小预算")
|
|
150
|
+
weights: list[float] = []
|
|
151
|
+
normalized: list[dict] = []
|
|
152
|
+
for index, raw in enumerate(records):
|
|
153
|
+
unit_id = str(raw.get("unit_id") or raw.get("id") or f"unit-{index + 1}")
|
|
154
|
+
findings = max(0, int(raw.get("findings", 0) or 0))
|
|
155
|
+
new_behaviors = max(0, int(raw.get("new_behaviors", 0) or 0))
|
|
156
|
+
weight = 1.0 + findings * 4.0 + new_behaviors * 2.0
|
|
157
|
+
weights.append(weight)
|
|
158
|
+
normalized.append({
|
|
159
|
+
"unit_id": unit_id, "findings": findings,
|
|
160
|
+
"new_behaviors": new_behaviors, "weight": weight,
|
|
161
|
+
})
|
|
162
|
+
remaining = total_budget - len(records) * min_budget
|
|
163
|
+
weight_sum = sum(weights)
|
|
164
|
+
raw_extra = [remaining * weight / weight_sum for weight in weights]
|
|
165
|
+
extras = [int(value) for value in raw_extra]
|
|
166
|
+
remainder = remaining - sum(extras)
|
|
167
|
+
order = sorted(range(len(records)), key=lambda index: (-raw_extra[index] + extras[index], index))
|
|
168
|
+
for index in order[:remainder]:
|
|
169
|
+
extras[index] += 1
|
|
170
|
+
allocations = []
|
|
171
|
+
for index, item in enumerate(normalized):
|
|
172
|
+
budget = min_budget + extras[index]
|
|
173
|
+
reason = "baseline"
|
|
174
|
+
if item["findings"] or item["new_behaviors"]:
|
|
175
|
+
reason = "hot-streak" if item["findings"] else "new-behavior"
|
|
176
|
+
allocations.append({**item, "budget": budget, "reason": reason})
|
|
177
|
+
return {
|
|
178
|
+
"schema_version": 1,
|
|
179
|
+
"total_budget": total_budget,
|
|
180
|
+
"min_budget": min_budget,
|
|
181
|
+
"allocations": allocations,
|
|
182
|
+
"policy": "recommendation-only",
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# P4 规范语气度量词表:硬性措辞(红线词 + 强调词)。仅用于度量定位,不改写语义。
|
|
187
|
+
_MODAL_TERMS = ("必须", "禁止", "不得", "严禁", "绝对", "务必", "一定要")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def modal_density_report(threshold: float = 25.0) -> list[dict]:
|
|
191
|
+
"""输出规范密度超阈值的章节(降序),供语气治理定位。
|
|
192
|
+
|
|
193
|
+
threshold:每千 token 硬性措辞数;超过即视为密度异常。
|
|
194
|
+
"""
|
|
195
|
+
report: list[dict] = []
|
|
196
|
+
for document in measure()["documents"]:
|
|
197
|
+
for section in document["sections"]:
|
|
198
|
+
density = section.get("modal_density")
|
|
199
|
+
if density is not None and density >= threshold:
|
|
200
|
+
report.append({
|
|
201
|
+
"file": document["file"],
|
|
202
|
+
"title": section["title"],
|
|
203
|
+
"tokens": section["tokens"],
|
|
204
|
+
"modal_density": density,
|
|
205
|
+
})
|
|
206
|
+
return sorted(report, key=lambda item: -item["modal_density"])
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def measure() -> dict:
|
|
210
|
+
documents = []
|
|
211
|
+
missing: list[str] = []
|
|
212
|
+
for layer, name in DOC_LAYERS:
|
|
213
|
+
path = SCRIPT_DIR / name
|
|
214
|
+
if not path.is_file():
|
|
215
|
+
# 静默跳过会让"少统计 5 层"伪装成"预算达标"。缺失必须可见。
|
|
216
|
+
missing.append(name)
|
|
217
|
+
continue
|
|
218
|
+
raw = path.read_bytes()
|
|
219
|
+
total_tokens, method = estimate_tokens(raw)
|
|
220
|
+
text = raw.decode("utf-8", errors="replace")
|
|
221
|
+
sections = []
|
|
222
|
+
for title, body in _sections(text):
|
|
223
|
+
tokens, _ = estimate_tokens(body.encode("utf-8"))
|
|
224
|
+
section_entry = {"title": title, "tokens": tokens,
|
|
225
|
+
"lines": body.count("\n") + 1}
|
|
226
|
+
# P4 度量:规范语气密度(每千 token 的硬性措辞数)。
|
|
227
|
+
# 密度过高 = 重点稀释;用于定位需要语气治理的章节。
|
|
228
|
+
modal_count = sum(body.count(word) for word in _MODAL_TERMS)
|
|
229
|
+
if tokens:
|
|
230
|
+
section_entry["modal_density"] = round(
|
|
231
|
+
modal_count * 1000 / tokens, 1
|
|
232
|
+
)
|
|
233
|
+
sections.append(section_entry)
|
|
234
|
+
documents.append({
|
|
235
|
+
"layer": layer, "file": name, "bytes": len(raw),
|
|
236
|
+
"lines": text.count("\n") + 1, "tokens": total_tokens,
|
|
237
|
+
"token_method": method,
|
|
238
|
+
"sections": sorted(sections, key=lambda x: -x["tokens"]),
|
|
239
|
+
})
|
|
240
|
+
l0_total = sum(d["tokens"] for d in documents if d["layer"] == "L0")
|
|
241
|
+
l1_total = sum(d["tokens"] for d in documents if d["layer"] == "L1")
|
|
242
|
+
return {
|
|
243
|
+
"schema_version": 1,
|
|
244
|
+
"documents": documents,
|
|
245
|
+
"layers": {
|
|
246
|
+
"L0_quick_always": l0_total,
|
|
247
|
+
"L1_full_guide_on_demand": l1_total,
|
|
248
|
+
"L0_vs_L1_ratio": round(l0_total / l1_total, 4) if l1_total else None,
|
|
249
|
+
},
|
|
250
|
+
"missing": missing,
|
|
251
|
+
"guidance": (
|
|
252
|
+
"worker 常驻只加载 L0;L1 章节按需 sed 提取。"
|
|
253
|
+
"任何指南 PR 都应先跑本工具对比增量。"
|
|
254
|
+
),
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def _prompt_body(text: str) -> str:
|
|
259
|
+
"""剥掉 YAML frontmatter,只量模型实际读到的提示词正文。
|
|
260
|
+
|
|
261
|
+
宿主 agent 文档的 frontmatter(description/mode/permissions)是**宿主
|
|
262
|
+
解析的配置元数据**,不进入模型上下文;预算门禁约束的是系统提示词成本,
|
|
263
|
+
因此 worker/opencode 入口等 agent 文档按正文计量。无 frontmatter 时原样返回。
|
|
264
|
+
"""
|
|
265
|
+
if text.startswith("---"):
|
|
266
|
+
stripped = text[3:]
|
|
267
|
+
end = stripped.find("\n---")
|
|
268
|
+
if end != -1:
|
|
269
|
+
return stripped[end + 4:].lstrip("\n")
|
|
270
|
+
return text
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def check_budget_compliance() -> tuple[bool, list[str]]:
|
|
274
|
+
"""检查系统提示词 2.0 是否满足 Token 预算门禁。"""
|
|
275
|
+
errors: list[str] = []
|
|
276
|
+
# 1. 检查 L0 路由
|
|
277
|
+
l0_path = SCRIPT_DIR / "prompts" / "l0_router.md"
|
|
278
|
+
if l0_path.is_file():
|
|
279
|
+
tokens, _ = estimate_tokens(l0_path.read_bytes())
|
|
280
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["L0_router"]:
|
|
281
|
+
errors.append(f"L0 路由入口超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['L0_router']}")
|
|
282
|
+
|
|
283
|
+
# 2. 检查各 L1 阶段卡
|
|
284
|
+
stages_dir = SCRIPT_DIR / "prompts" / "stages"
|
|
285
|
+
if stages_dir.is_dir():
|
|
286
|
+
for p in stages_dir.glob("stage_*.md"):
|
|
287
|
+
tokens, _ = estimate_tokens(p.read_bytes())
|
|
288
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["L1_stage"]:
|
|
289
|
+
errors.append(f"L1 阶段卡 {p.name} 超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['L1_stage']}")
|
|
290
|
+
|
|
291
|
+
# 3. 检查各 L2 专项规则
|
|
292
|
+
rules_dir = SCRIPT_DIR / "prompts" / "rules"
|
|
293
|
+
if rules_dir.is_dir():
|
|
294
|
+
for p in rules_dir.glob("*.md"):
|
|
295
|
+
tokens, _ = estimate_tokens(p.read_bytes())
|
|
296
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["L2_rule"]:
|
|
297
|
+
errors.append(f"L2 专项规则 {p.name} 超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['L2_rule']}")
|
|
298
|
+
|
|
299
|
+
# 4. 检查 worker 提示词
|
|
300
|
+
worker_path = SCRIPT_DIR / "bugx-worker.md"
|
|
301
|
+
if worker_path.is_file():
|
|
302
|
+
tokens, _ = estimate_tokens(_prompt_body(worker_path.read_text(encoding="utf-8")).encode("utf-8"))
|
|
303
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["worker"]:
|
|
304
|
+
errors.append(f"Worker 提示词超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['worker']}")
|
|
305
|
+
|
|
306
|
+
# 5. 检查宿主 Skill 入口(**版本受控的源**,不是安装副本)
|
|
307
|
+
#
|
|
308
|
+
# 历史缺陷:这里读 ``plugins/bugx/skills/bugx/SKILL.md``,而 ``plugins/bugx/``
|
|
309
|
+
# 被 ``.gitignore`` 忽略——它是 ``bugx install`` 的产物。于是这个门禁有两个
|
|
310
|
+
# 反向失效:(a) 干净克隆里该文件不存在 → ``is_file()`` 跳过 → **静默通过**;
|
|
311
|
+
# (b) 开发机上它比源文件旧/新不一致 → 拿废弃副本报超标(实测 3643 > 3600,
|
|
312
|
+
# 而受控源只有 3397)。门禁必须盯住提交进仓库的那份。
|
|
313
|
+
repo_root = SCRIPT_DIR.parent
|
|
314
|
+
skill_path = repo_root / "ecosystem" / "plugins" / "bugx" / "skills" / "bugx" / "SKILL.md"
|
|
315
|
+
if not skill_path.is_file():
|
|
316
|
+
# fail-closed:源文件缺失说明契约被动过,不能当作「无需检查」。
|
|
317
|
+
errors.append(
|
|
318
|
+
f"宿主 Skill 源缺失: {skill_path.relative_to(repo_root).as_posix()}"
|
|
319
|
+
f"(预算门禁不能靠安装副本判定)"
|
|
320
|
+
)
|
|
321
|
+
else:
|
|
322
|
+
tokens, _ = estimate_tokens(_prompt_body(skill_path.read_text(encoding="utf-8")).encode("utf-8"))
|
|
323
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["host_skill"]:
|
|
324
|
+
errors.append(f"宿主 Skill 入口超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['host_skill']}")
|
|
325
|
+
|
|
326
|
+
# 6. 检查 OpenCode 精简入口
|
|
327
|
+
opencode_path = SCRIPT_DIR / "bugx-opencode.md"
|
|
328
|
+
if opencode_path.is_file():
|
|
329
|
+
tokens, _ = estimate_tokens(_prompt_body(opencode_path.read_text(encoding="utf-8")).encode("utf-8"))
|
|
330
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["opencode_entry"]:
|
|
331
|
+
errors.append(f"OpenCode 入口超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['opencode_entry']}")
|
|
332
|
+
|
|
333
|
+
# 7. 检查 AGENT_GUIDE.md 启动协议章节与全文 (DOC-034/DOC-039)
|
|
334
|
+
guide_path = SCRIPT_DIR / "AGENT_GUIDE.md"
|
|
335
|
+
if guide_path.is_file():
|
|
336
|
+
text = guide_path.read_text(encoding="utf-8")
|
|
337
|
+
total_tokens, _ = estimate_tokens(text.encode("utf-8"))
|
|
338
|
+
if total_tokens > SYSTEM_PROMPT_BUDGET_LIMITS["agent_guide_total"]:
|
|
339
|
+
errors.append(
|
|
340
|
+
f"AGENT_GUIDE.md 全文超标: {total_tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['agent_guide_total']}"
|
|
341
|
+
)
|
|
342
|
+
for title, body in _sections(text):
|
|
343
|
+
if "启动协议" in title:
|
|
344
|
+
sec_tokens, _ = estimate_tokens(body.encode("utf-8"))
|
|
345
|
+
if sec_tokens > SYSTEM_PROMPT_BUDGET_LIMITS["agent_guide_startup"]:
|
|
346
|
+
errors.append(
|
|
347
|
+
f"AGENT_GUIDE.md 启动协议章节超标: {sec_tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['agent_guide_startup']}"
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
# 8. 检查 bugx-quick.md 极速卡 (DOC-039)
|
|
351
|
+
quick_path = SCRIPT_DIR / "bugx-quick.md"
|
|
352
|
+
if quick_path.is_file():
|
|
353
|
+
tokens, _ = estimate_tokens(quick_path.read_bytes())
|
|
354
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["quick_card"]:
|
|
355
|
+
errors.append(f"bugx-quick.md 极速卡超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['quick_card']}")
|
|
356
|
+
|
|
357
|
+
# 9. 检查 bugx.md 全文 (DOC-034 阶段 2 验收判据)
|
|
358
|
+
bugx_path = SCRIPT_DIR / "bugx.md"
|
|
359
|
+
if bugx_path.is_file():
|
|
360
|
+
tokens, _ = estimate_tokens(bugx_path.read_bytes())
|
|
361
|
+
if tokens > SYSTEM_PROMPT_BUDGET_LIMITS["bugx_full"]:
|
|
362
|
+
errors.append(
|
|
363
|
+
f"bugx.md 全文超标: {tokens} > {SYSTEM_PROMPT_BUDGET_LIMITS['bugx_full']}"
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
# 10. 检查 L0 占比与 L0 常驻总额 (DOC-034 阶段 3 验收判据)
|
|
367
|
+
res = measure()
|
|
368
|
+
layers = res.get("layers", {})
|
|
369
|
+
l0_total = layers.get("L0_quick_always", 0)
|
|
370
|
+
if l0_total > SYSTEM_PROMPT_BUDGET_LIMITS["L0_router"]:
|
|
371
|
+
errors.append(
|
|
372
|
+
f"L0 常驻总额超标: {l0_total} > {SYSTEM_PROMPT_BUDGET_LIMITS['L0_router']}"
|
|
373
|
+
)
|
|
374
|
+
ratio = layers.get("L0_vs_L1_ratio")
|
|
375
|
+
if ratio is not None and ratio > SYSTEM_PROMPT_BUDGET_LIMITS["l0_ratio_max"]:
|
|
376
|
+
errors.append(
|
|
377
|
+
f"L0 常驻占比超标: {ratio:.4f} > {SYSTEM_PROMPT_BUDGET_LIMITS['l0_ratio_max']:.2f}"
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
return len(errors) == 0, errors
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def main(argv: list[str] | None = None) -> int:
|
|
384
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
385
|
+
parser.add_argument("--top", type=int, default=15, help="显示最重章节数")
|
|
386
|
+
parser.add_argument("--json", action="store_true")
|
|
387
|
+
parser.add_argument("--check", action="store_true", help="校验系统提示词 2.0 预算门禁")
|
|
388
|
+
parser.add_argument(
|
|
389
|
+
"--modal-density", action="store_true",
|
|
390
|
+
help="输出规范硬性措辞密度报告(默认阈值:每千 token 25)",
|
|
391
|
+
)
|
|
392
|
+
parser.add_argument(
|
|
393
|
+
"--modal-density-threshold", type=float, default=25.0,
|
|
394
|
+
help="规范密度报告阈值(每千 token,必须为非负有限数)",
|
|
395
|
+
)
|
|
396
|
+
args = parser.parse_args(argv)
|
|
397
|
+
|
|
398
|
+
if not math.isfinite(args.modal_density_threshold) or args.modal_density_threshold < 0:
|
|
399
|
+
print("[guide_budget] ✗ --modal-density-threshold 必须是非负有限数")
|
|
400
|
+
return 2
|
|
401
|
+
|
|
402
|
+
if args.check:
|
|
403
|
+
passed, errors = check_budget_compliance()
|
|
404
|
+
if not passed:
|
|
405
|
+
print("[guide_budget] ✗ 系统提示词 2.0 预算门禁失败:")
|
|
406
|
+
for err in errors:
|
|
407
|
+
print(f" - {err}")
|
|
408
|
+
return 1
|
|
409
|
+
print("[guide_budget] ✓ 系统提示词 2.0 预算门禁全部通过!")
|
|
410
|
+
return 0
|
|
411
|
+
|
|
412
|
+
if args.modal_density:
|
|
413
|
+
report = modal_density_report(args.modal_density_threshold)
|
|
414
|
+
if args.json:
|
|
415
|
+
print(json.dumps({
|
|
416
|
+
"threshold": args.modal_density_threshold,
|
|
417
|
+
"matches": report,
|
|
418
|
+
}, ensure_ascii=False, indent=2))
|
|
419
|
+
else:
|
|
420
|
+
print(
|
|
421
|
+
f"[guide_budget] 规范密度报告(阈值 "
|
|
422
|
+
f"{args.modal_density_threshold:g}/千 token):"
|
|
423
|
+
)
|
|
424
|
+
for item in report:
|
|
425
|
+
print(
|
|
426
|
+
f" {item['modal_density']:>5.1f}/千 "
|
|
427
|
+
f"{item['file']} :: {item['title']}"
|
|
428
|
+
)
|
|
429
|
+
print(f"[guide_budget] 命中 {len(report)} 个章节")
|
|
430
|
+
return 0
|
|
431
|
+
|
|
432
|
+
result = measure()
|
|
433
|
+
if args.json:
|
|
434
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
435
|
+
return 0
|
|
436
|
+
print("[guide_budget] 文档层成本:")
|
|
437
|
+
for doc in result["documents"]:
|
|
438
|
+
print(f" {doc['layer']} {doc['file']:<35} {doc['lines']:>5} 行 "
|
|
439
|
+
f"~{doc['tokens']:>6} tokens")
|
|
440
|
+
layers = result["layers"]
|
|
441
|
+
print(f"[guide_budget] L0 常驻 ~{layers['L0_quick_always']} tokens vs "
|
|
442
|
+
f"L1 全文 ~{layers['L1_full_guide_on_demand']} tokens "
|
|
443
|
+
f"(占比 {layers['L0_vs_L1_ratio']})")
|
|
444
|
+
print(f"[guide_budget] 最重章节 Top {args.top}:")
|
|
445
|
+
all_sections = [
|
|
446
|
+
(section, doc["file"])
|
|
447
|
+
for doc in result["documents"]
|
|
448
|
+
for section in doc["sections"]
|
|
449
|
+
]
|
|
450
|
+
for section, file_name in sorted(
|
|
451
|
+
all_sections, key=lambda item: -item[0]["tokens"],
|
|
452
|
+
)[:args.top]:
|
|
453
|
+
print(f" {section['tokens']:>6} tokens {file_name} :: {section['title'][:50]}")
|
|
454
|
+
return 0
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
if __name__ == "__main__":
|
|
458
|
+
sys.exit(main())
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# lockdown.sh — 加固 bugx 外部防线文件(同权限逃逸的 OS 层缓解)
|
|
3
|
+
#
|
|
4
|
+
# 背景:bugx 拥有完整 bash + 文件读权限,理论上可复制/篡改校验器
|
|
5
|
+
# 脚本(cp verify_life.py /tmp/x.py 修改后运行)或改写快照基线,从而绕过
|
|
6
|
+
# 外部防线。opencode 的 permission 挡「诚实越界」,但挡不住「恶意 + 全权限」。
|
|
7
|
+
#
|
|
8
|
+
# 与 opencode.json 的 deny 面保持镜像(本文件仅记录该面,不做执行):
|
|
9
|
+
# - read/grep/glob 目录级拒绝 ~/.bugx/**,并显式列出高价值单文件:
|
|
10
|
+
# ~/.bugx/cloud-credentials.json、~/.bugx/identity/installation-secret
|
|
11
|
+
# (32-hex 身份密钥,report_client.py)、~/.bugx/cloud-device-id、
|
|
12
|
+
# ~/.bugx/cloud-config.json(可改写 base_url 指向攻击者服务器)
|
|
13
|
+
# - bash 命令字符串 glob 覆盖上述全部文件名,而非只覆盖 credentials 文件
|
|
14
|
+
# 诚实声明:该 deny 面**不约束在 MCP server 进程内部发起的文件读取**
|
|
15
|
+
# (bugx_mcp_server.py 的工具直接调用 open()/read_text(),不经过宿主
|
|
16
|
+
# permission 层),因此它只是「威慑 + 防误操作」层,**不得被当作安全边界**;
|
|
17
|
+
# 真正的读取约束必须落在 Python 侧的统一敏感路径守卫上。
|
|
18
|
+
#
|
|
19
|
+
# 本脚本把校验器/启动器/覆盖门禁/准备门禁/快照设为「只读」,作为文件系统层防线:
|
|
20
|
+
# - verify_life.py / launch_bugx.py / module_coverage.py / tools_kb.py /
|
|
21
|
+
# prep_validate.py / symbol_index.py / project_graph.py / audit_campaign.py /
|
|
22
|
+
# agent_eval.py / model_runner.py / finding_report.py / finding_lifecycle.py /
|
|
23
|
+
# platform_adapter.py / codebase_memory_probe.py / codebase_memory_bridge.py /
|
|
24
|
+
# efficiency_probe.py /
|
|
25
|
+
# finding_confirmation.py / coverage_intelligence.py / behavior_graph.py /
|
|
26
|
+
# test_strategy.py
|
|
27
|
+
# lesson_ledger.py
|
|
28
|
+
# → chmod 444(只读)
|
|
29
|
+
# - bugx-life.json.snapshot(基线)→ chmod 444(只读,防改写基线)
|
|
30
|
+
# - bugx-life.json(agent 结算)→ 保持可写
|
|
31
|
+
#
|
|
32
|
+
# 注意:单用户环境(owner=运行者)下 chmod 可被同用户 chmod 回去,本脚本是
|
|
33
|
+
# 威慑+防误操作层;真正的硬隔离需要把 agent 跑在不同用户/容器/沙箱里,
|
|
34
|
+
# 此时本脚本 + 文件属主不同即构成真实防线。
|
|
35
|
+
set -euo pipefail
|
|
36
|
+
cd "$(dirname "$0")"
|
|
37
|
+
|
|
38
|
+
for f in verify_life.py launch_bugx.py module_coverage.py symbol_index.py project_graph.py audit_campaign.py tools_kb.py prep_validate.py agent_eval.py model_runner.py finding_report.py finding_confirmation.py coverage_intelligence.py behavior_graph.py test_strategy.py finding_lifecycle.py platform_adapter.py codebase_memory_probe.py codebase_memory_bridge.py efficiency_probe.py lesson_ledger.py; do
|
|
39
|
+
if [[ -f "$f" ]]; then
|
|
40
|
+
chmod a-w "$f"
|
|
41
|
+
echo " ✓ $f → 只读"
|
|
42
|
+
fi
|
|
43
|
+
done
|
|
44
|
+
if [[ -f bugx-life.json.snapshot ]]; then
|
|
45
|
+
chmod a-w bugx-life.json.snapshot
|
|
46
|
+
echo " ✓ bugx-life.json.snapshot → 只读(基线锁定)"
|
|
47
|
+
fi
|
|
48
|
+
echo
|
|
49
|
+
echo "外部防线文件已锁定为只读;bugx-life.json 保持可写(agent 结算用)。"
|
|
50
|
+
echo "解锁(后续维护):chmod u+w verify_life.py launch_bugx.py module_coverage.py symbol_index.py project_graph.py audit_campaign.py tools_kb.py prep_validate.py agent_eval.py model_runner.py finding_report.py finding_confirmation.py coverage_intelligence.py behavior_graph.py test_strategy.py finding_lifecycle.py platform_adapter.py codebase_memory_probe.py codebase_memory_bridge.py efficiency_probe.py lesson_ledger.py"
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""只读审计的**执行侧强制**与廉价校验(CORE-308 P2 收尾)。
|
|
3
|
+
|
|
4
|
+
**为什么需要它**:``write_access=False`` 会让 claim 层不派生 ``file:`` 互斥键,
|
|
5
|
+
同文件多个 worker 因此可并发。这个豁免只有在「worker 真的改不了源文件」时才安全。
|
|
6
|
+
|
|
7
|
+
历史教训(build 268):用 ``fix_mode == "auto"`` 推导写权限是**假前提**——
|
|
8
|
+
``fix_mode`` 只被 ``post_phase`` 消费,worker 执行侧从不读它,也没有只读沙箱。
|
|
9
|
+
于是「声明只读」只是纸面承诺,一旦模型自作主张改文件就是静默覆盖。
|
|
10
|
+
|
|
11
|
+
本模块提供两层:
|
|
12
|
+
|
|
13
|
+
1. **强制**(``prepare_readonly_view``):给只读 claim 一个独立只读视图
|
|
14
|
+
(``git worktree`` + ``chmod -R a-w``),worker 在那里读/跑,改不动真源;
|
|
15
|
+
2. **校验**(``snapshot_source_state`` / ``verify_untouched``):用
|
|
16
|
+
``git status --porcelain`` 做基线/复检,任何「声明只读却新增改动」都被拒绝。
|
|
17
|
+
校验是廉价的(无需全量 sha256 扫描),且跨平台。
|
|
18
|
+
|
|
19
|
+
**设计边界**:不猜测、不静默降级。git 不可用 → 返回 ``None`` 表示「无法强制」,
|
|
20
|
+
调用方必须据此**不授予**只读豁免(fail-closed),而不是乐观假设安全。
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import os
|
|
26
|
+
import shutil
|
|
27
|
+
import subprocess
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _git(root: Path, *args: str, timeout: float = 60.0) -> tuple[int, str]:
|
|
32
|
+
try:
|
|
33
|
+
proc = subprocess.run(
|
|
34
|
+
["git", "-C", str(root), *args],
|
|
35
|
+
capture_output=True, text=True, timeout=timeout, check=False,
|
|
36
|
+
)
|
|
37
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
38
|
+
return 127, ""
|
|
39
|
+
return proc.returncode, (proc.stdout or "")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def snapshot_source_state(root: Path) -> dict[str, object] | None:
|
|
43
|
+
"""记录源码基线:HEAD + 已改动文件集合。``None`` = 无法取证(git 不可用)。"""
|
|
44
|
+
|
|
45
|
+
code, head = _git(root, "rev-parse", "HEAD")
|
|
46
|
+
if code != 0 or not head.strip():
|
|
47
|
+
return None
|
|
48
|
+
code, status = _git(root, "status", "--porcelain")
|
|
49
|
+
if code != 0:
|
|
50
|
+
return None
|
|
51
|
+
dirty = sorted(
|
|
52
|
+
line[3:].strip() for line in status.splitlines() if len(line) > 3
|
|
53
|
+
)
|
|
54
|
+
return {"head": head.strip(), "dirty": dirty}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def verify_untouched(root: Path, baseline: dict[str, object] | None) -> str | None:
|
|
58
|
+
"""复检:返回**违规描述**(``None`` = 未越权)。
|
|
59
|
+
|
|
60
|
+
判定只针对「新增/变化的已改动文件」:基线里本来就 dirty 的文件(并行会话、
|
|
61
|
+
启动前脏工作树)不算这次 claim 的越权,避免把别人的改动栽给只读 worker。
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
if not baseline:
|
|
65
|
+
return None
|
|
66
|
+
current = snapshot_source_state(root)
|
|
67
|
+
if current is None:
|
|
68
|
+
return None
|
|
69
|
+
before = set(baseline.get("dirty") or ())
|
|
70
|
+
after = set(current.get("dirty") or ())
|
|
71
|
+
fresh = sorted(after - before)
|
|
72
|
+
if not fresh:
|
|
73
|
+
return None
|
|
74
|
+
preview = ", ".join(fresh[:5])
|
|
75
|
+
return f"声明只读却新增改动: {preview}(共 {len(fresh)} 个文件)"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def prepare_readonly_view(root: Path, target: Path) -> Path | None:
|
|
79
|
+
"""为只读 claim 建**独立只读视图**(git worktree + 去写权限)。
|
|
80
|
+
|
|
81
|
+
返回视图路径;``None`` 表示无法建立(git 不可用 / worktree 失败)——
|
|
82
|
+
调用方必须据此不授予只读豁免。
|
|
83
|
+
|
|
84
|
+
为什么用 worktree 而不是 chmod 真源:真源与写 worker 共享,chmod 会影响别人;
|
|
85
|
+
worktree 是独立工作树(共享 object db,零复制成本),清理即消失。
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
resolved_root = root.resolve()
|
|
89
|
+
view = target.resolve()
|
|
90
|
+
# F-RSI-20261110-016 防御加固(收窄版):view 即将对其子树 chmod
|
|
91
|
+
# 0o555/0o444——它绝不能与真源 root 本体重合(轮 22 实测:仓库 core
|
|
92
|
+
# 653 文件被 0444,bump 全链路 EPERM)。root 外的独立目录是合法姿势
|
|
93
|
+
# (worktree 可任意位置,既有测试依赖);同根内的子路径也合法
|
|
94
|
+
# (worktree 子目录)。仅拒绝 view==root 这一真正的灾难形态。
|
|
95
|
+
if view == resolved_root:
|
|
96
|
+
raise ValueError(
|
|
97
|
+
f"只读视图路径不安全:view 与真源 root 重合({view})——"
|
|
98
|
+
"chmod 0o444 会把共享真源整体只读(F-016:bump 全链路 EPERM);"
|
|
99
|
+
"请指定 root 之外的独立 worktree 目录。"
|
|
100
|
+
)
|
|
101
|
+
if view.exists():
|
|
102
|
+
shutil.rmtree(view, ignore_errors=True)
|
|
103
|
+
view.parent.mkdir(parents=True, exist_ok=True)
|
|
104
|
+
code, _ = _git(resolved_root, "worktree", "add", "--detach", str(view), "HEAD")
|
|
105
|
+
if code != 0:
|
|
106
|
+
return None
|
|
107
|
+
# 去写权限:worker 即使想改也改不动(文件系统层强制,不依赖模型自觉)。
|
|
108
|
+
# **fail-closed**:任何一处 chmod 失败都意味着「只读保证不完整」,此时必须
|
|
109
|
+
# 回滚并返回 None(调用方据此不授予只读豁免),绝不静默返回「部分只读」的视图
|
|
110
|
+
# ——那会让 claim 层误以为同文件并发安全。
|
|
111
|
+
failures: list[str] = []
|
|
112
|
+
targets: list[tuple[Path, int]] = []
|
|
113
|
+
for path in sorted(view.rglob("*"), reverse=True):
|
|
114
|
+
if path.is_symlink():
|
|
115
|
+
continue
|
|
116
|
+
targets.append((path, 0o555 if path.is_dir() else 0o444))
|
|
117
|
+
targets.append((view, 0o555))
|
|
118
|
+
for path, mode in targets:
|
|
119
|
+
try:
|
|
120
|
+
os.chmod(path, mode)
|
|
121
|
+
except OSError:
|
|
122
|
+
failures.append(str(path))
|
|
123
|
+
if failures:
|
|
124
|
+
_reset_permissions(view)
|
|
125
|
+
_git(resolved_root, "worktree", "remove", "--force", str(view))
|
|
126
|
+
shutil.rmtree(view, ignore_errors=True)
|
|
127
|
+
return None
|
|
128
|
+
return view
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _reset_permissions(view: Path) -> None:
|
|
132
|
+
"""恢复读写权限(回收/回滚前必须做,否则 remove 会失败)。"""
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
os.chmod(view, 0o755)
|
|
136
|
+
except OSError:
|
|
137
|
+
pass
|
|
138
|
+
for path in sorted(view.rglob("*"), reverse=True):
|
|
139
|
+
try:
|
|
140
|
+
if path.is_symlink():
|
|
141
|
+
continue
|
|
142
|
+
os.chmod(path, 0o755 if path.is_dir() else 0o644)
|
|
143
|
+
except OSError:
|
|
144
|
+
continue
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def release_readonly_view(root: Path, view: Path | None) -> None:
|
|
148
|
+
"""回收只读视图(先恢复写权限,否则 worktree remove 会失败)。"""
|
|
149
|
+
|
|
150
|
+
if view is None:
|
|
151
|
+
return
|
|
152
|
+
_reset_permissions(view)
|
|
153
|
+
_git(root.resolve(), "worktree", "remove", "--force", str(view))
|
|
154
|
+
shutil.rmtree(view, ignore_errors=True)
|