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,627 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""launch_phases/lifecycle_reporter.py - 生命周期报告渲染、边际收益与情报分析 (DOC-036)。"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import hashlib
|
|
7
|
+
import json
|
|
8
|
+
import math
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
import tempfile
|
|
12
|
+
import time
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any, Mapping
|
|
15
|
+
|
|
16
|
+
from .common import (
|
|
17
|
+
AGENT_DIR,
|
|
18
|
+
LIFECYCLE_REPORT_NAME,
|
|
19
|
+
resolve_project_root,
|
|
20
|
+
uses_project_layout,
|
|
21
|
+
pollings_root as _pollings_root,
|
|
22
|
+
)
|
|
23
|
+
from .session_runtime import (
|
|
24
|
+
load_runtime,
|
|
25
|
+
save_runtime,
|
|
26
|
+
runtime_lock,
|
|
27
|
+
iso_time,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
import core.bugx_paths as bugx_paths
|
|
32
|
+
except ImportError:
|
|
33
|
+
bugx_paths = None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _findings_payload_path(runtime: dict | None = None) -> Path | None:
|
|
37
|
+
"""解析当前 Life 的 findings 落盘路径(0.6.109:实现下沉本模块)。
|
|
38
|
+
|
|
39
|
+
旧实现经软环委托 round_orchestrator 且异常时盲回退相对 cwd 的
|
|
40
|
+
``.bugx/findings.json``——会读错文件。现在按 DOC-031 H1 修复语义:
|
|
41
|
+
polling_id/session_id 候选链 → 目录存在性校验 → 最后候选
|
|
42
|
+
``findings.json``(存在与否由调用方校验)。
|
|
43
|
+
"""
|
|
44
|
+
pollings_root = _pollings_root(resolve_project_root())
|
|
45
|
+
lifecycle_id = str((runtime or {}).get("lifecycle_id") or "unknown")
|
|
46
|
+
candidates: list[Path] = []
|
|
47
|
+
for key in ("polling_id", "session_id"):
|
|
48
|
+
value = str((runtime or {}).get(key) or "")
|
|
49
|
+
if value.startswith("polling-") and value not in candidates:
|
|
50
|
+
candidates.append(value)
|
|
51
|
+
for candidate in candidates:
|
|
52
|
+
lifecycle_dir = pollings_root / candidate / "lifecycles" / lifecycle_id
|
|
53
|
+
findings = lifecycle_dir / "findings.json"
|
|
54
|
+
if findings.is_file():
|
|
55
|
+
return findings
|
|
56
|
+
target_dir = lifecycle_dir
|
|
57
|
+
if target_dir.is_dir():
|
|
58
|
+
return findings
|
|
59
|
+
fallback = pollings_root / "polling-000001" / "lifecycles" / lifecycle_id / "findings.json"
|
|
60
|
+
if fallback.is_file() and not fallback.is_symlink():
|
|
61
|
+
return fallback
|
|
62
|
+
# Standalone/legacy execution has no formal polling lifecycle yet. Keep
|
|
63
|
+
# the compatibility path used by the launcher and isolated tests, but only
|
|
64
|
+
# accept a regular file so a project-root symlink cannot redirect telemetry
|
|
65
|
+
# to another runtime.
|
|
66
|
+
if not uses_project_layout():
|
|
67
|
+
legacy = Path(".bugx/findings.json")
|
|
68
|
+
if legacy.is_file() and not legacy.is_symlink():
|
|
69
|
+
return legacy
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _verify_findings_list_binding(runtime: dict, path: Path | None = None) -> tuple[bool, str]:
|
|
74
|
+
"""fail-closed 版本(0.6.109):无路径/文件缺失 → 校验失败而非放行。
|
|
75
|
+
|
|
76
|
+
R5 复盘 D6:本模块语义是 **list** findings(findings.json 为数组、逐条
|
|
77
|
+
校验 lifecycle_id 绑定),与 finding_settlement 的 dict+run_binding 结算
|
|
78
|
+
门禁同名不同契约。改名 ``_verify_findings_list_binding`` 消除裸导入
|
|
79
|
+
混淆——import 错模块即静默错判。结算语义版本仍叫
|
|
80
|
+
``finding_settlement._verify_findings_binding``(post 主路径)。
|
|
81
|
+
"""
|
|
82
|
+
if path is None:
|
|
83
|
+
return False, "no-findings"
|
|
84
|
+
if not path.is_file():
|
|
85
|
+
return False, f"findings 文件不存在: {path}"
|
|
86
|
+
runtime = runtime or {}
|
|
87
|
+
lifecycle_id = str(runtime.get("lifecycle_id") or "")
|
|
88
|
+
current_round = runtime.get("round")
|
|
89
|
+
try:
|
|
90
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
91
|
+
except (OSError, UnicodeDecodeError, ValueError) as exc:
|
|
92
|
+
return False, f"findings 无法解析: {exc}"
|
|
93
|
+
if not isinstance(payload, list):
|
|
94
|
+
return False, "findings 不是数组"
|
|
95
|
+
recorded_round = runtime.get("round_at_start")
|
|
96
|
+
if (isinstance(current_round, int) and isinstance(recorded_round, int)
|
|
97
|
+
and current_round < recorded_round):
|
|
98
|
+
return False, "findings 轮号早于当前 Round"
|
|
99
|
+
if lifecycle_id and payload:
|
|
100
|
+
for item in payload:
|
|
101
|
+
if not isinstance(item, dict):
|
|
102
|
+
return False, "findings 条目结构无效"
|
|
103
|
+
if item.get("lifecycle_id") != lifecycle_id:
|
|
104
|
+
return False, "findings 存在未绑定当前生命周期的条目"
|
|
105
|
+
return True, "findings 已绑定当前生命周期"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _remediation_report(state: dict) -> list[dict[str, Any]]:
|
|
109
|
+
"""Return confirmed findings without a valid fix or deferred proposal."""
|
|
110
|
+
path = _findings_payload_path(state)
|
|
111
|
+
if path is None or not path.is_file():
|
|
112
|
+
return []
|
|
113
|
+
try:
|
|
114
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
115
|
+
except (OSError, UnicodeDecodeError, ValueError):
|
|
116
|
+
return []
|
|
117
|
+
findings = payload.get("findings") if isinstance(payload, dict) else None
|
|
118
|
+
if not isinstance(findings, list):
|
|
119
|
+
return []
|
|
120
|
+
try:
|
|
121
|
+
from core.ledger.finding_confirmation import validate_remediation
|
|
122
|
+
except ImportError:
|
|
123
|
+
return []
|
|
124
|
+
entries: list[dict[str, Any]] = []
|
|
125
|
+
for finding in findings:
|
|
126
|
+
if not isinstance(finding, dict):
|
|
127
|
+
continue
|
|
128
|
+
confirmation = finding.get("confirmation")
|
|
129
|
+
if not isinstance(confirmation, dict) or confirmation.get("state") != "confirmed":
|
|
130
|
+
continue
|
|
131
|
+
result = validate_remediation(finding, resolve_project_root())
|
|
132
|
+
if result.get("status") == "ok":
|
|
133
|
+
continue
|
|
134
|
+
remediation = finding.get("remediation")
|
|
135
|
+
entries.append({
|
|
136
|
+
"fingerprint": finding.get("fingerprint") or finding.get("id") or "unknown",
|
|
137
|
+
"severity": finding.get("severity") or "unknown",
|
|
138
|
+
"proposal": remediation.get("proposal") if isinstance(remediation, dict) else None,
|
|
139
|
+
"blocking_deps": remediation.get("blocking_deps", []) if isinstance(remediation, dict) else [],
|
|
140
|
+
"errors": result.get("errors", []),
|
|
141
|
+
})
|
|
142
|
+
return entries
|
|
143
|
+
|
|
144
|
+
def write_lifecycle_report(state: dict) -> str:
|
|
145
|
+
"""Write the authoritative report, conclusion and integrity records.
|
|
146
|
+
|
|
147
|
+
These files belong to the active lifecycle directory. A marker in an
|
|
148
|
+
arbitrary project-root report is not accepted as proof of completion:
|
|
149
|
+
every terminal lifecycle gets a fresh report and a machine-readable
|
|
150
|
+
conclusion whose digest is recorded in ``integrity.json``.
|
|
151
|
+
"""
|
|
152
|
+
if uses_project_layout():
|
|
153
|
+
active = bugx_paths.require(resolve_project_root())
|
|
154
|
+
report_path = active.report
|
|
155
|
+
conclusion_path = active.conclusion
|
|
156
|
+
integrity_path = active.integrity
|
|
157
|
+
life_path = active.life
|
|
158
|
+
events_path = active.events
|
|
159
|
+
else:
|
|
160
|
+
report_path = resolve_project_root() / LIFECYCLE_REPORT_NAME
|
|
161
|
+
conclusion_path = resolve_project_root() / "conclusion.json"
|
|
162
|
+
integrity_path = resolve_project_root() / "integrity.json"
|
|
163
|
+
life_path = AGENT_DIR / "bugx-life.json"
|
|
164
|
+
events_path = AGENT_DIR / "events.jsonl"
|
|
165
|
+
write_once = uses_project_layout()
|
|
166
|
+
if write_once:
|
|
167
|
+
for path in (report_path, conclusion_path, integrity_path):
|
|
168
|
+
if path.exists() or path.is_symlink():
|
|
169
|
+
raise OSError(f"终局报告已存在,拒绝覆盖: {path}")
|
|
170
|
+
lifecycle_id = state.get("lifecycle_id") or "unknown"
|
|
171
|
+
total_findings = state.get('lifecycle_findings_total', 0)
|
|
172
|
+
credited = state.get('lifecycle_credited_total', 0)
|
|
173
|
+
fraud = state.get('lifecycle_fraud_total', 0)
|
|
174
|
+
real_rate = (credited / total_findings * 100.0) if total_findings > 0 else 0.0
|
|
175
|
+
error_rate = (fraud / total_findings * 100.0) if total_findings > 0 else 0.0
|
|
176
|
+
remediation_gaps = _remediation_report(state)
|
|
177
|
+
remediation_lines = [
|
|
178
|
+
"- 无:每条 confirmed Finding 均有修复证据或合法 deferred 提案。"
|
|
179
|
+
] if not remediation_gaps else [
|
|
180
|
+
f"- `{item['fingerprint']}` [{item['severity']}] fix_gap:"
|
|
181
|
+
f"{item.get('proposal') or '未提供 remediation 提案'};"
|
|
182
|
+
f"blocking_deps={item.get('blocking_deps') or []};"
|
|
183
|
+
f"校验错误={item.get('errors') or []}"
|
|
184
|
+
for item in remediation_gaps
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
audit_units = len(state.get('coverage', {})) or state.get('audit_units_total', 0)
|
|
188
|
+
|
|
189
|
+
from core.host_runtime.host_usage import report_lines as host_usage_lines
|
|
190
|
+
|
|
191
|
+
# DOC-011 §10.2 结构化字段:session/round 标识、增量/累计、覆盖、同步、共享初始态等
|
|
192
|
+
session_id = state.get("session_id") or state.get("polling_id") or "unknown"
|
|
193
|
+
round_id = lifecycle_id
|
|
194
|
+
round_no = state.get("lifecycle_no", 1)
|
|
195
|
+
history = state.get("lifecycle_history") or []
|
|
196
|
+
previous_round_id = history[-1].get("lifecycle_id") if history else None
|
|
197
|
+
# 本 Round 为终局候选(报告封存即候选),后续共享通过 final_round_id 引用
|
|
198
|
+
final_round_candidate = True
|
|
199
|
+
# 累计汇总:从 Session 首个 Round 到本 Round
|
|
200
|
+
cumulative_findings = sum(int(h.get("findings_total", 0) or 0) for h in history) + total_findings
|
|
201
|
+
cumulative_credited = sum(int(h.get("credited_total", 0) or 0) for h in history) + credited
|
|
202
|
+
cumulative_fraud = sum(int(h.get("fraud_total", 0) or 0) for h in history) + fraud
|
|
203
|
+
# 覆盖维度(占位:真实维度由 coverage_status 驱动,此处至少保证结构化字段存在)
|
|
204
|
+
coverage = state.get("coverage") or {}
|
|
205
|
+
covered_cnt = sum(1 for v in coverage.values() if v in {"covered", "covered_with_findings", "covered_no_finding"}) if coverage else 0
|
|
206
|
+
pending_cnt = len(coverage) - covered_cnt if coverage else 0
|
|
207
|
+
# 同步状态(Life 项目级、Round 全局级);没有边界记录时才回退到
|
|
208
|
+
# 旧的总状态,避免把一次 project 同步误报为 global 已完成。
|
|
209
|
+
boundaries = state.get("sync_boundaries") or {}
|
|
210
|
+
project_boundary = boundaries.get("project") if isinstance(boundaries, dict) else None
|
|
211
|
+
global_boundary = boundaries.get("global") if isinstance(boundaries, dict) else None
|
|
212
|
+
sync_project = (
|
|
213
|
+
project_boundary.get("status") if isinstance(project_boundary, dict)
|
|
214
|
+
else state.get("sync_status", "local")
|
|
215
|
+
)
|
|
216
|
+
sync_global = (
|
|
217
|
+
global_boundary.get("status") if isinstance(global_boundary, dict)
|
|
218
|
+
else state.get("sync_status", "local")
|
|
219
|
+
)
|
|
220
|
+
# 共享初始态:自动续轮中间 Round 为 share_deferred,终局为 not_started
|
|
221
|
+
share_initial = "not_started"
|
|
222
|
+
try:
|
|
223
|
+
if state.get("polling_policy") == "auto" and not state.get("lifecycle_terminal"):
|
|
224
|
+
# 中间 Round 但尚未 terminal 的报告不会走到此函数;兜底仍置 not_started
|
|
225
|
+
share_initial = "share_deferred"
|
|
226
|
+
except Exception:
|
|
227
|
+
share_initial = "not_started"
|
|
228
|
+
section = "\n".join([
|
|
229
|
+
f"<!-- bugx-round:{lifecycle_id} -->",
|
|
230
|
+
f"<!-- bugx-session:{session_id} previous:{previous_round_id or 'none'} final_candidate:{str(final_round_candidate).lower()} -->",
|
|
231
|
+
f"## BugX Round {round_no} 结束报告",
|
|
232
|
+
"",
|
|
233
|
+
"### 核心执行指标",
|
|
234
|
+
f"- 开始时间: `{state.get('lifecycle_started_at') or 'N/A'}`",
|
|
235
|
+
f"- 结束时间: `{iso_time(time.time())}`",
|
|
236
|
+
f"- Session: `{session_id}` | Round: `No.{round_no}` (ID: `{round_id}`) | previous: `{previous_round_id or 'none'}` | final_candidate: `{str(final_round_candidate).lower()}`",
|
|
237
|
+
f"- 经历 Life: `{state.get('lifecycle_cycles_completed', 0)} 个`",
|
|
238
|
+
f"- 发现问题总数: `{total_findings}` (有效: `{credited}`, 拒绝: `{fraud}`)",
|
|
239
|
+
f"- 已确认修复数: `{len(state.get('realized_fix_incidents', []))}`",
|
|
240
|
+
f"- 审计模块数量: `{audit_units}` 个模块/单元",
|
|
241
|
+
f"- 真实 Bug 率: `{real_rate:.1f}%` | 误报扣分率: `{error_rate:.1f}%`",
|
|
242
|
+
f"- Worker 自报 Token: `{state.get('lifecycle_token_count', 0)}`",
|
|
243
|
+
*host_usage_lines(state.get("host_usage")),
|
|
244
|
+
f"- 错题集沉淀数: `{len(state.get('lifecycle_lesson_ids', []))}`",
|
|
245
|
+
f"- 终点 life: `{state.get('lifecycle_last_life')}` | 停止原因: `{state.get('lifecycle_stop_reason') or 'life_exhausted'}`",
|
|
246
|
+
f"- 结论状态: `{state.get('lifecycle_outcome') or 'COMPLETE'}`",
|
|
247
|
+
"",
|
|
248
|
+
"### 待决修复提案(P1-1)",
|
|
249
|
+
*remediation_lines,
|
|
250
|
+
"",
|
|
251
|
+
"### 结构化摘要(DOC-011 §10.2)",
|
|
252
|
+
f"- session_id: `{session_id}` | round_id: `{round_id}` | round_no: `{round_no}` | previous_round_id: `{previous_round_id or 'null'}` | final_round_candidate: `{str(final_round_candidate).lower()}`",
|
|
253
|
+
f"- 增量: findings={total_findings} credited={credited} fraud={fraud} | 累计: findings={cumulative_findings} credited={cumulative_credited} fraud={cumulative_fraud}",
|
|
254
|
+
f"- 覆盖: 单元总数 {len(coverage)} 已覆盖 {covered_cnt} 待处理 {pending_cnt} | 声明维度: 清单/静态/业务链路/动态/证据/修复验证/风险",
|
|
255
|
+
f"- 覆盖债务: pending={pending_cnt} | 停止推荐: {state.get('lifecycle_stop_reason') or 'none'}",
|
|
256
|
+
f"- 同步: Life项目级 {sync_project} | Round全局级 {sync_global} | receipt/outbox 见 lifecycle/sync",
|
|
257
|
+
f"- 共享初始态: `{share_initial}` | 实际共享选择、receipt 与 outbox 属于独立共享操作,不回写已封存报告",
|
|
258
|
+
f"- Worker: cycles={state.get('lifecycle_cycles_completed',0)} lesson_cards={len(state.get('lifecycle_lesson_ids',[]))}",
|
|
259
|
+
"",
|
|
260
|
+
"本报告由 BugX 外部启动协议生成;具体证据、复现、修复和覆盖债务"
|
|
261
|
+
"保存在当前生命周期目录的过程记录中。",
|
|
262
|
+
"",
|
|
263
|
+
])
|
|
264
|
+
|
|
265
|
+
def write_atomic(path: Path, content: str) -> None:
|
|
266
|
+
if path.is_symlink() or path.parent.is_symlink():
|
|
267
|
+
raise OSError(f"拒绝写入符号链接路径: {path}")
|
|
268
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
269
|
+
descriptor, temporary = tempfile.mkstemp(
|
|
270
|
+
dir=str(path.parent), prefix=f".{path.name}.", suffix=".tmp",
|
|
271
|
+
)
|
|
272
|
+
try:
|
|
273
|
+
with os.fdopen(descriptor, "w", encoding="utf-8") as handle:
|
|
274
|
+
handle.write(content)
|
|
275
|
+
handle.flush()
|
|
276
|
+
os.fsync(handle.fileno())
|
|
277
|
+
os.replace(temporary, path)
|
|
278
|
+
finally:
|
|
279
|
+
try:
|
|
280
|
+
os.unlink(temporary)
|
|
281
|
+
except OSError:
|
|
282
|
+
pass
|
|
283
|
+
|
|
284
|
+
def write_once_atomic(path: Path, content: str) -> None:
|
|
285
|
+
if path.is_symlink() or path.parent.is_symlink():
|
|
286
|
+
raise OSError(f"拒绝写入符号链接路径: {path}")
|
|
287
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
288
|
+
descriptor, temporary = tempfile.mkstemp(
|
|
289
|
+
dir=str(path.parent), prefix=f".{path.name}.", suffix=".tmp",
|
|
290
|
+
)
|
|
291
|
+
try:
|
|
292
|
+
with os.fdopen(descriptor, "w", encoding="utf-8") as handle:
|
|
293
|
+
handle.write(content)
|
|
294
|
+
handle.flush()
|
|
295
|
+
os.fsync(handle.fileno())
|
|
296
|
+
# Hard-link publication is atomic and never replaces an existing
|
|
297
|
+
# report. This closes the TOCTOU gap between existence checking
|
|
298
|
+
# and a concurrent duplicate post.
|
|
299
|
+
os.link(temporary, path)
|
|
300
|
+
finally:
|
|
301
|
+
try:
|
|
302
|
+
os.unlink(temporary)
|
|
303
|
+
except OSError:
|
|
304
|
+
pass
|
|
305
|
+
|
|
306
|
+
publish = write_once_atomic if write_once else write_atomic
|
|
307
|
+
|
|
308
|
+
publish(report_path, section)
|
|
309
|
+
report_digest = hashlib.sha256(report_path.read_bytes()).hexdigest()
|
|
310
|
+
# DOC-011 §10.2 要求的结构化结论字段,与报告互相校验
|
|
311
|
+
conclusion = {
|
|
312
|
+
"schema_version": 1,
|
|
313
|
+
"session_id": session_id,
|
|
314
|
+
"round_id": round_id,
|
|
315
|
+
"round_no": round_no,
|
|
316
|
+
"lifecycle_id": lifecycle_id,
|
|
317
|
+
"lifecycle_no": state.get("lifecycle_no"),
|
|
318
|
+
"previous_round_id": previous_round_id,
|
|
319
|
+
"final_round_candidate": final_round_candidate,
|
|
320
|
+
"report_hash": report_digest,
|
|
321
|
+
"state": state.get("lifecycle_outcome") or "completed",
|
|
322
|
+
"stop_reason": state.get("lifecycle_stop_reason") or "life_exhausted",
|
|
323
|
+
"cycles_completed": state.get("lifecycle_cycles_completed", 0),
|
|
324
|
+
"findings_total": total_findings,
|
|
325
|
+
"credited_total": credited,
|
|
326
|
+
"fraud_total": fraud,
|
|
327
|
+
"real_rate": round(real_rate, 1),
|
|
328
|
+
"error_rate": round(error_rate, 1),
|
|
329
|
+
"fix_count": len(state.get("realized_fix_incidents", [])),
|
|
330
|
+
"remediation": {
|
|
331
|
+
"fix_gap_count": len(remediation_gaps),
|
|
332
|
+
"fix_gaps": remediation_gaps,
|
|
333
|
+
},
|
|
334
|
+
"token_count": state.get("lifecycle_token_count", 0),
|
|
335
|
+
"lesson_count": len(state.get("lifecycle_lesson_ids", [])),
|
|
336
|
+
"life_after": state.get("lifecycle_last_life"),
|
|
337
|
+
"incremental": {
|
|
338
|
+
"findings": total_findings,
|
|
339
|
+
"credited": credited,
|
|
340
|
+
"fraud": fraud,
|
|
341
|
+
},
|
|
342
|
+
"cumulative": {
|
|
343
|
+
"findings": cumulative_findings,
|
|
344
|
+
"credited": cumulative_credited,
|
|
345
|
+
"fraud": cumulative_fraud,
|
|
346
|
+
},
|
|
347
|
+
"coverage": {
|
|
348
|
+
"total_units": len(coverage),
|
|
349
|
+
"covered": covered_cnt,
|
|
350
|
+
"pending": pending_cnt,
|
|
351
|
+
},
|
|
352
|
+
"sync": {
|
|
353
|
+
"project": sync_project,
|
|
354
|
+
"global": sync_global,
|
|
355
|
+
},
|
|
356
|
+
"share_initial_state": share_initial,
|
|
357
|
+
"report": report_path.name,
|
|
358
|
+
"report_sha256": report_digest,
|
|
359
|
+
"completed_at": iso_time(time.time()),
|
|
360
|
+
}
|
|
361
|
+
publish(conclusion_path, json.dumps(conclusion, ensure_ascii=False, indent=2) + "\n")
|
|
362
|
+
hashes = {"report.md": report_digest, "conclusion.json": hashlib.sha256(
|
|
363
|
+
conclusion_path.read_bytes()).hexdigest()}
|
|
364
|
+
for label, path in (("life.json", life_path), ("events.jsonl", events_path)):
|
|
365
|
+
if path.is_file() and not path.is_symlink():
|
|
366
|
+
hashes[label] = hashlib.sha256(path.read_bytes()).hexdigest()
|
|
367
|
+
# PE-20261005-006(B6 封章扩容):findings.json 与 supervisor.json 纳入
|
|
368
|
+
# 完整性封章——文件级拼接从此可检测。supervisor.json 用单次字节快照同时
|
|
369
|
+
# 记 sha256+revision+status:revision 相等而哈希不符=篡改(fail-closed),
|
|
370
|
+
# revision 增长=封章后合法演化(finish/next_round/迟到心跳)。缺失时写
|
|
371
|
+
# 显式 false 字段,不静默。时点在结算完成后(post 写报告处),不等宿主
|
|
372
|
+
# finish(真实运行可能从不 finish,且本文件 write-once)。
|
|
373
|
+
sealed_findings = False
|
|
374
|
+
sealed_supervisor = False
|
|
375
|
+
if uses_project_layout():
|
|
376
|
+
findings_path = active.lifecycle_root / "findings.json"
|
|
377
|
+
supervisor_path = active.supervisor
|
|
378
|
+
else:
|
|
379
|
+
findings_path = resolve_project_root() / "findings.json"
|
|
380
|
+
supervisor_path = resolve_project_root() / "supervisor.json"
|
|
381
|
+
if findings_path.is_file() and not findings_path.is_symlink():
|
|
382
|
+
hashes["findings.json"] = hashlib.sha256(
|
|
383
|
+
findings_path.read_bytes()).hexdigest()
|
|
384
|
+
sealed_findings = True
|
|
385
|
+
if supervisor_path.is_file() and not supervisor_path.is_symlink():
|
|
386
|
+
snapshot = supervisor_path.read_bytes()
|
|
387
|
+
hashes["supervisor.json"] = hashlib.sha256(snapshot).hexdigest()
|
|
388
|
+
try:
|
|
389
|
+
supervisor_snapshot = json.loads(snapshot)
|
|
390
|
+
hashes["supervisor_revision"] = supervisor_snapshot.get("revision")
|
|
391
|
+
hashes["supervisor_status"] = supervisor_snapshot.get("status")
|
|
392
|
+
except (json.JSONDecodeError, UnicodeDecodeError):
|
|
393
|
+
hashes["supervisor_revision"] = None
|
|
394
|
+
hashes["supervisor_status"] = None
|
|
395
|
+
sealed_supervisor = True
|
|
396
|
+
integrity = {
|
|
397
|
+
"schema_version": 2,
|
|
398
|
+
"lifecycle_id": lifecycle_id,
|
|
399
|
+
"algorithm": "sha256",
|
|
400
|
+
"files": hashes,
|
|
401
|
+
"sealed_findings": sealed_findings,
|
|
402
|
+
"sealed_supervisor": sealed_supervisor,
|
|
403
|
+
"generated_at": iso_time(time.time()),
|
|
404
|
+
}
|
|
405
|
+
publish(integrity_path, json.dumps(integrity, ensure_ascii=False, indent=2) + "\n")
|
|
406
|
+
return str(report_path)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
def confidence_calibration(runtime: dict | None = None) -> dict | None:
|
|
411
|
+
"""G6:本轮 confirmed/rejected 的置信度校准画像(自报 vs 结局)。"""
|
|
412
|
+
path = _findings_payload_path(runtime)
|
|
413
|
+
if path is None:
|
|
414
|
+
return None
|
|
415
|
+
try:
|
|
416
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
417
|
+
except (OSError, json.JSONDecodeError, UnicodeDecodeError):
|
|
418
|
+
return None
|
|
419
|
+
findings = payload.get("findings") if isinstance(payload, dict) else None
|
|
420
|
+
if not isinstance(findings, list) or not findings:
|
|
421
|
+
return None
|
|
422
|
+
buckets: dict[str, list[float]] = {"confirmed": [], "rejected": []}
|
|
423
|
+
artifact_bound = 0
|
|
424
|
+
for finding in findings:
|
|
425
|
+
if not isinstance(finding, dict):
|
|
426
|
+
continue
|
|
427
|
+
confirmation = finding.get("confirmation")
|
|
428
|
+
if not isinstance(confirmation, dict):
|
|
429
|
+
continue
|
|
430
|
+
state = confirmation.get("state")
|
|
431
|
+
if state not in buckets:
|
|
432
|
+
continue
|
|
433
|
+
confidence = finding.get("confidence")
|
|
434
|
+
if isinstance(confidence, (int, float)) and not isinstance(confidence, bool):
|
|
435
|
+
buckets[state].append(float(confidence))
|
|
436
|
+
for item in confirmation.get("observations", []):
|
|
437
|
+
if isinstance(item, dict) and item.get("artifact_path"):
|
|
438
|
+
artifact_bound += 1
|
|
439
|
+
break
|
|
440
|
+
confirmed_mean = (
|
|
441
|
+
sum(buckets["confirmed"]) / len(buckets["confirmed"])
|
|
442
|
+
if buckets["confirmed"] else None
|
|
443
|
+
)
|
|
444
|
+
rejected_mean = (
|
|
445
|
+
sum(buckets["rejected"]) / len(buckets["rejected"])
|
|
446
|
+
if buckets["rejected"] else None
|
|
447
|
+
)
|
|
448
|
+
total = len(buckets["confirmed"]) + len(buckets["rejected"])
|
|
449
|
+
overconfident = (
|
|
450
|
+
total >= 5
|
|
451
|
+
and rejected_mean is not None
|
|
452
|
+
and confirmed_mean is not None
|
|
453
|
+
and (confirmed_mean - rejected_mean) < 0.1
|
|
454
|
+
and len(buckets["rejected"]) / total > 0.3
|
|
455
|
+
)
|
|
456
|
+
return {
|
|
457
|
+
"confirmed": len(buckets["confirmed"]),
|
|
458
|
+
"rejected": len(buckets["rejected"]),
|
|
459
|
+
"confirmed_confidence_mean": (
|
|
460
|
+
round(confirmed_mean, 3) if confirmed_mean is not None else None
|
|
461
|
+
),
|
|
462
|
+
"rejected_confidence_mean": (
|
|
463
|
+
round(rejected_mean, 3) if rejected_mean is not None else None
|
|
464
|
+
),
|
|
465
|
+
"observation_artifact_bound_findings": artifact_bound,
|
|
466
|
+
"overconfident_warning": overconfident,
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
def efficiency_card(runtime: dict, round_result: dict) -> dict:
|
|
470
|
+
"""E3:轮级效率遥测——每命中耗时、token 成本与知识卡片利用率。"""
|
|
471
|
+
credited = int(round_result.get("credited", 0) or 0)
|
|
472
|
+
duration = float(runtime.get("effective_total_seconds", 0.0) or 0.0)
|
|
473
|
+
tokens = None
|
|
474
|
+
token_method = None
|
|
475
|
+
path = _findings_payload_path(runtime)
|
|
476
|
+
if path is not None:
|
|
477
|
+
try:
|
|
478
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
479
|
+
if isinstance(payload, dict):
|
|
480
|
+
value = payload.get("token_count")
|
|
481
|
+
if isinstance(value, int) and not isinstance(value, bool):
|
|
482
|
+
tokens = value
|
|
483
|
+
method = payload.get("token_method")
|
|
484
|
+
if isinstance(method, str) and method.strip():
|
|
485
|
+
token_method = method.strip()
|
|
486
|
+
except (OSError, json.JSONDecodeError, UnicodeDecodeError):
|
|
487
|
+
tokens = None
|
|
488
|
+
# runner 无法计量时(token_method=unmeasured)显式置空,防止 0 被当作
|
|
489
|
+
# 真实成本参与 tokens/credited 统计。
|
|
490
|
+
if token_method == "unmeasured":
|
|
491
|
+
tokens = None
|
|
492
|
+
context = runtime.get("lesson_context") or {}
|
|
493
|
+
card = {
|
|
494
|
+
"round": round_result.get("round"),
|
|
495
|
+
"credited": credited,
|
|
496
|
+
"findings": round_result.get("findings", 0),
|
|
497
|
+
"duration_seconds": round(duration, 3),
|
|
498
|
+
"seconds_per_credited": round(duration / credited, 3) if credited else None,
|
|
499
|
+
"token_count": tokens,
|
|
500
|
+
"token_method": token_method,
|
|
501
|
+
"tokens_per_credited": (
|
|
502
|
+
round(tokens / credited, 1) if tokens and credited else None
|
|
503
|
+
),
|
|
504
|
+
"lesson_cards_prefetched": len(context.get("recommendations") or []),
|
|
505
|
+
"tool_cards_prefetched": len(context.get("tool_cards") or []),
|
|
506
|
+
"incident_cards_prefetched": len(context.get("deep_cards") or []),
|
|
507
|
+
"fraud": round_result.get("fraud", 0),
|
|
508
|
+
}
|
|
509
|
+
return card
|
|
510
|
+
|
|
511
|
+
def print_post_intelligence(runtime: dict, round_result: dict) -> dict:
|
|
512
|
+
"""post 的效率/校准/绑定输出与持久化;失败只降级不阻断结算。"""
|
|
513
|
+
card = efficiency_card(runtime, round_result)
|
|
514
|
+
calibration = confidence_calibration(runtime)
|
|
515
|
+
binding_ok, binding_note = _verify_findings_list_binding(runtime)
|
|
516
|
+
print("-" * 56)
|
|
517
|
+
per_credited = (
|
|
518
|
+
f"{card['seconds_per_credited']}s/条" if card["seconds_per_credited"]
|
|
519
|
+
else "n/a(本轮无计命)"
|
|
520
|
+
)
|
|
521
|
+
tokens_note = (
|
|
522
|
+
f"{card['tokens_per_credited']} tok/条"
|
|
523
|
+
if card["tokens_per_credited"] else (
|
|
524
|
+
f"{card['token_count']} tok({card['token_method']})"
|
|
525
|
+
if card["token_count"] else "tokens 未计量"
|
|
526
|
+
)
|
|
527
|
+
)
|
|
528
|
+
print(
|
|
529
|
+
f"效率卡片:耗时 {card['duration_seconds']}s · 计命 {card['credited']}"
|
|
530
|
+
f" · {per_credited} · {tokens_note} · 预取候选 "
|
|
531
|
+
f"P{card['lesson_cards_prefetched']}+T{card['tool_cards_prefetched']}"
|
|
532
|
+
f"+I{card['incident_cards_prefetched']}"
|
|
533
|
+
)
|
|
534
|
+
if calibration:
|
|
535
|
+
print(
|
|
536
|
+
f"校准:confirmed {calibration['confirmed']}"
|
|
537
|
+
f"(均值置信 {calibration['confirmed_confidence_mean']})/"
|
|
538
|
+
f" rejected {calibration['rejected']}"
|
|
539
|
+
f"(均值 {calibration['rejected_confidence_mean']})"
|
|
540
|
+
f" · 工件绑定 finding {calibration['observation_artifact_bound_findings']}"
|
|
541
|
+
)
|
|
542
|
+
if calibration.get("overconfident_warning"):
|
|
543
|
+
print(" ⚠ 置信度失准:拒报率高但与确认组置信差距小——下调自报置信度")
|
|
544
|
+
if binding_note == "unbound":
|
|
545
|
+
print("⚠ findings.json 未盖 run_binding 章:报告可被拼接/重放而不被察觉;"
|
|
546
|
+
"导出时补 run_id/lifecycle_id/round")
|
|
547
|
+
elif not binding_ok:
|
|
548
|
+
print(f"✗ {binding_note}")
|
|
549
|
+
record = {
|
|
550
|
+
"efficiency": card,
|
|
551
|
+
"calibration": calibration,
|
|
552
|
+
"findings_binding": binding_note if binding_ok else f"invalid:{binding_note}",
|
|
553
|
+
}
|
|
554
|
+
try:
|
|
555
|
+
with runtime_lock():
|
|
556
|
+
state = load_runtime()
|
|
557
|
+
history = state.setdefault("intelligence_history", [])
|
|
558
|
+
if not isinstance(history, list):
|
|
559
|
+
history = []
|
|
560
|
+
history.append(record)
|
|
561
|
+
state["intelligence_history"] = history[-50:]
|
|
562
|
+
advisory = marginal_return_advisor(state)
|
|
563
|
+
record["marginal_return"] = advisory
|
|
564
|
+
state["intelligence_history"][-1] = record
|
|
565
|
+
save_runtime(state)
|
|
566
|
+
if advisory["recommendation"] != "continue":
|
|
567
|
+
print(f"边际收益顾问 [{advisory['status']}] → {advisory['recommendation']}:"
|
|
568
|
+
f"{advisory['reason']}")
|
|
569
|
+
else:
|
|
570
|
+
print(f"边际收益顾问:{advisory['reason']}")
|
|
571
|
+
except (OSError, ValueError):
|
|
572
|
+
print(" (效率卡片持久化失败,仅打印)")
|
|
573
|
+
advisory = marginal_return_advisor(
|
|
574
|
+
{"intelligence_history": [record]},
|
|
575
|
+
)
|
|
576
|
+
record["marginal_return"] = advisory
|
|
577
|
+
return record
|
|
578
|
+
|
|
579
|
+
def marginal_return_advisor(state: dict, *, window: int = 3) -> dict:
|
|
580
|
+
"""消费 intelligence_history 的边际收益顾问:继续 / 换接口面 / 建议停止。
|
|
581
|
+
|
|
582
|
+
固定阈值(50 轮/3 轮无进展/4h)不看成本趋势。本顾问按滚动窗口对比
|
|
583
|
+
计命产出:近窗归零 → 建议停止或换面;近窗显著衰减(≤前窗 1/2 且前窗
|
|
584
|
+
有产出)→ 建议换接口面;样本不足 → 观望。只输出建议,不做决策——
|
|
585
|
+
最终停止仍由固定阈值与人工把关。
|
|
586
|
+
"""
|
|
587
|
+
history = [
|
|
588
|
+
item for item in (state.get("intelligence_history") or [])
|
|
589
|
+
if isinstance(item, dict) and isinstance(item.get("efficiency"), dict)
|
|
590
|
+
]
|
|
591
|
+
credited_series = [int(item["efficiency"].get("credited", 0) or 0) for item in history]
|
|
592
|
+
seconds_series = [
|
|
593
|
+
float(item["efficiency"].get("duration_seconds", 0.0) or 0.0)
|
|
594
|
+
for item in history
|
|
595
|
+
]
|
|
596
|
+
if len(credited_series) < window:
|
|
597
|
+
return {"status": "insufficient-data", "rounds": len(credited_series),
|
|
598
|
+
"recommendation": "continue", "reason": f"样本不足(<{window} 轮)"}
|
|
599
|
+
recent = credited_series[-window:]
|
|
600
|
+
prior = credited_series[-2 * window:-window] or [0]
|
|
601
|
+
recent_sum = sum(recent)
|
|
602
|
+
prior_sum = sum(prior)
|
|
603
|
+
recent_seconds = sum(seconds_series[-window:])
|
|
604
|
+
if recent_sum == 0:
|
|
605
|
+
return {
|
|
606
|
+
"status": "low-yield", "rounds": len(credited_series),
|
|
607
|
+
"recommendation": "stop_or_switch_surface",
|
|
608
|
+
"reason": f"近 {window} 轮计命为 0(耗时 {round(recent_seconds, 1)}s)",
|
|
609
|
+
"recent_credited": recent_sum, "prior_credited": prior_sum,
|
|
610
|
+
}
|
|
611
|
+
if prior_sum > 0 and recent_sum * 2 <= prior_sum:
|
|
612
|
+
return {
|
|
613
|
+
"status": "declining", "rounds": len(credited_series),
|
|
614
|
+
"recommendation": "switch_surface",
|
|
615
|
+
"reason": f"边际收益衰减:近窗计命 {recent_sum} ≤ 前窗 {prior_sum} 的一半",
|
|
616
|
+
"recent_credited": recent_sum, "prior_credited": prior_sum,
|
|
617
|
+
}
|
|
618
|
+
per_credited = (
|
|
619
|
+
round(recent_seconds / recent_sum, 1) if recent_sum else None
|
|
620
|
+
)
|
|
621
|
+
return {
|
|
622
|
+
"status": "healthy", "rounds": len(credited_series),
|
|
623
|
+
"recommendation": "continue",
|
|
624
|
+
"reason": f"近 {window} 轮计命 {recent_sum}({per_credited}s/条)",
|
|
625
|
+
"recent_credited": recent_sum, "prior_credited": prior_sum,
|
|
626
|
+
"seconds_per_credited": per_credited,
|
|
627
|
+
}
|