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.
Files changed (762) hide show
  1. bugx_cli/__init__.py +6 -0
  2. bugx_cli/cli.py +1685 -0
  3. bugx_cli/commands/__init__.py +1 -0
  4. bugx_cli/commands/advisory.py +94 -0
  5. bugx_cli/commands/agent.py +4210 -0
  6. bugx_cli/commands/audit.py +632 -0
  7. bugx_cli/commands/autonomous.py +260 -0
  8. bugx_cli/commands/cloud.py +1371 -0
  9. bugx_cli/commands/daemon.py +50 -0
  10. bugx_cli/commands/doctor.py +1590 -0
  11. bugx_cli/commands/goal.py +107 -0
  12. bugx_cli/commands/interaction.py +248 -0
  13. bugx_cli/commands/knowledge.py +619 -0
  14. bugx_cli/commands/lifecycle.py +2763 -0
  15. bugx_cli/commands/patch.py +1014 -0
  16. bugx_cli/commands/plugin.py +2749 -0
  17. bugx_cli/commands/plugin_claude.py +1446 -0
  18. bugx_cli/commands/plugin_cline.py +269 -0
  19. bugx_cli/commands/plugin_codex.py +74 -0
  20. bugx_cli/commands/plugin_funide.py +729 -0
  21. bugx_cli/commands/plugin_qoder.py +216 -0
  22. bugx_cli/commands/plugin_zcode.py +710 -0
  23. bugx_cli/commands/project.py +670 -0
  24. bugx_cli/commands/report.py +256 -0
  25. bugx_cli/commands/skill.py +251 -0
  26. bugx_cli/commands/stats.py +133 -0
  27. bugx_cli/commands/system.py +2567 -0
  28. bugx_cli/common.py +906 -0
  29. bugx_cli/host_adapters.py +1892 -0
  30. bugx_cli/hosts/__init__.py +80 -0
  31. bugx_cli/hosts/base.py +99 -0
  32. bugx_cli/hosts/registry.py +573 -0
  33. bugx_cli/hosts/template_engine.py +188 -0
  34. bugx_cli/infra/__init__.py +209 -0
  35. bugx_cli/infra/ai_advisor.py +851 -0
  36. bugx_cli/infra/engine_installer.py +1945 -0
  37. bugx_cli/infra/host_sync.py +548 -0
  38. bugx_cli/infra/mcp_advisor.py +826 -0
  39. bugx_cli/infra/security.py +339 -0
  40. bugx_cli-0.1.1.data/data/share/bugx-agent/bugx-mcp-manifest.json +53 -0
  41. bugx_cli-0.1.1.data/data/share/bugx-agent/core/CATALOG.json +141 -0
  42. bugx_cli-0.1.1.data/data/share/bugx-agent/core/README.md +254 -0
  43. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/README.md +35 -0
  44. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android-interaction.json +81 -0
  45. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/android.json +24 -0
  46. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/desktop-macos.json +20 -0
  47. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios-interaction.json +34 -0
  48. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/ios.json +23 -0
  49. bugx_cli-0.1.1.data/data/share/bugx-agent/core/adapters/memory-macos.json +24 -0
  50. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/README.md +51 -0
  51. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/__init__.py +146 -0
  52. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_artifacts.py +766 -0
  53. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_eval.py +1155 -0
  54. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_execution.py +718 -0
  55. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_orchestrator.py +1351 -0
  56. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_targets.py +877 -0
  57. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/agent_workspace.py +770 -0
  58. bugx_cli-0.1.1.data/data/share/bugx-agent/core/agent/feature_baseline.py +150 -0
  59. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/README.md +24 -0
  60. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
  61. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/LICENSE.txt +362 -0
  62. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/UPSTREAM.md +10 -0
  63. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/axe-core/axe.min.js +12 -0
  64. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-1024.png +0 -0
  65. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-512.png +0 -0
  66. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar-tight.svg +23 -0
  67. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-avatar.svg +28 -0
  68. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-cn.png +0 -0
  69. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.png +0 -0
  70. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-en.svg +74 -0
  71. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/bugx-hero-zh.svg +74 -0
  72. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/codex.png +0 -0
  73. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/dsh.png +0 -0
  74. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/project-layout.md +42 -0
  75. bugx_cli-0.1.1.data/data/share/bugx-agent/core/assets/zcode.png +0 -0
  76. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/README.md +37 -0
  77. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/manifest.json +94 -0
  78. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/00-scope.md +14 -0
  79. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/10-schema-inventory.md +14 -0
  80. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/20-query-and-integrity.md +14 -0
  81. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/data-audit/stages/80-evidence-regression.md +14 -0
  82. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/manifest.json +123 -0
  83. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/00-scope.md +15 -0
  84. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/10-process-model.md +14 -0
  85. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/20-package-integrity.md +15 -0
  86. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/30-ui-behavior.md +14 -0
  87. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/desktop-audit/stages/80-evidence-regression.md +15 -0
  88. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/memory-testing.md +227 -0
  89. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/manifest.json +155 -0
  90. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/android.md +19 -0
  91. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/h5.md +18 -0
  92. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/ios.md +25 -0
  93. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/miniprogram.md +26 -0
  94. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/modules/webview.md +18 -0
  95. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/00-scope.md +14 -0
  96. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/10-platform-inventory.md +14 -0
  97. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/20-masvs-static.md +20 -0
  98. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/30-component-exposure.md +14 -0
  99. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/40-device-behavior.md +14 -0
  100. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/mobile-audit/stages/80-evidence-regression.md +13 -0
  101. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/manifest.json +127 -0
  102. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/00-scope.md +14 -0
  103. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/10-static-white-box.md +14 -0
  104. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/20-memory-concurrency.md +15 -0
  105. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/30-behavior-black-box.md +39 -0
  106. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/native-audit/stages/80-evidence-regression.md +14 -0
  107. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/platform-testing.md +174 -0
  108. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/manifest.json +191 -0
  109. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/graphql.md +5 -0
  110. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/h5.md +18 -0
  111. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/multi-tenant.md +4 -0
  112. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/oauth.md +4 -0
  113. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/upload.md +4 -0
  114. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/modules/websocket.md +4 -0
  115. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/00-scope.md +13 -0
  116. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/10-discovery.md +13 -0
  117. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/20-auth-session.md +13 -0
  118. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/30-authz-business.md +13 -0
  119. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/40-input-output.md +13 -0
  120. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/50-state-async.md +13 -0
  121. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/60-file-ssrf-deser.md +12 -0
  122. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/70-config-dependency.md +12 -0
  123. bugx_cli-0.1.1.data/data/share/bugx-agent/core/audit_packs/web-audit/stages/80-evidence-regression.md +12 -0
  124. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/INTERFACE.md +61 -0
  125. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/README.md +58 -0
  126. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/SPEC.md +25 -0
  127. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/__init__.py +109 -0
  128. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph.py +1096 -0
  129. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/attack_graph_store.py +1868 -0
  130. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/audit_campaign.py +1232 -0
  131. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/behavior_graph.py +465 -0
  132. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/ghsa_advisories.py +174 -0
  133. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/models.py +93 -0
  134. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/mutator.py +87 -0
  135. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/patcher.py +126 -0
  136. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/scout.py +278 -0
  137. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/synthesizer.py +207 -0
  138. bugx_cli-0.1.1.data/data/share/bugx-agent/core/autonomous_cve/verifier.py +103 -0
  139. bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx.md +1299 -0
  140. bugx_cli-0.1.1.data/data/share/bugx-agent/core/bugx_paths.py +1881 -0
  141. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cli-help.txt +66 -0
  142. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/INTERFACE.md +32 -0
  143. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/README.md +62 -0
  144. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/SPEC.md +25 -0
  145. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/__init__.py +23 -0
  146. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/auto_sync.py +398 -0
  147. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_client.py +1218 -0
  148. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_onboard.py +743 -0
  149. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/cloud_schema.py +648 -0
  150. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/consent.py +81 -0
  151. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/device_identity.py +307 -0
  152. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/endpoint_router.py +415 -0
  153. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/flywheel_client.py +769 -0
  154. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/network_transport.py +296 -0
  155. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/onboard_wizard.py +493 -0
  156. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sensitive_filter.py +285 -0
  157. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_pull.py +695 -0
  158. bugx_cli-0.1.1.data/data/share/bugx-agent/core/cloud_sync/sync_push.py +723 -0
  159. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/AGENT_GUIDE.md +359 -0
  160. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/README.md +34 -0
  161. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-blackbox.md +541 -0
  162. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-opencode.md +469 -0
  163. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-quick.md +44 -0
  164. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-runtime-contract.md +353 -0
  165. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/bugx-worker.md +470 -0
  166. bugx_cli-0.1.1.data/data/share/bugx-agent/core/contracts/engine_gap_contracts.py +473 -0
  167. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/README.md +70 -0
  168. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/__init__.py +106 -0
  169. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_ai_review.py +185 -0
  170. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_backfill.py +54 -0
  171. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_bootstrap.py +713 -0
  172. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_business.py +36 -0
  173. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_cli.py +715 -0
  174. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_discovery.py +1429 -0
  175. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_evidence.py +1024 -0
  176. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_forensics.py +124 -0
  177. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_gate.py +277 -0
  178. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_intelligence.py +734 -0
  179. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_manifest.py +396 -0
  180. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_platform.py +77 -0
  181. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/coverage_validate.py +241 -0
  182. bugx_cli-0.1.1.data/data/share/bugx-agent/core/coverage/module_coverage.py +157 -0
  183. bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/INTERFACE.md +20 -0
  184. bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/README.md +21 -0
  185. bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/SPEC.md +25 -0
  186. bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/__init__.py +5 -0
  187. bugx_cli-0.1.1.data/data/share/bugx-agent/core/dev_harness/interaction_preset.py +408 -0
  188. bugx_cli-0.1.1.data/data/share/bugx-agent/core/engine-integrity.json +2797 -0
  189. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/README.md +49 -0
  190. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/__init__.py +82 -0
  191. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/concurrency_fuzzer.py +435 -0
  192. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/differential_oracle.py +1164 -0
  193. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/fuzz_input.py +1291 -0
  194. bugx_cli-0.1.1.data/data/share/bugx-agent/core/fuzzing/stateful_fuzzer.py +404 -0
  195. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/README.md +61 -0
  196. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/__init__.py +130 -0
  197. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/capacity_planner.py +124 -0
  198. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/dependency_lock.py +317 -0
  199. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/goal_governor.py +754 -0
  200. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/guide_budget.py +458 -0
  201. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/lockdown.sh +50 -0
  202. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/readonly_enforcer.py +154 -0
  203. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/runtime_tool_gate.py +373 -0
  204. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/secret_redactor.py +784 -0
  205. bugx_cli-0.1.1.data/data/share/bugx-agent/core/governance/token_budget.py +38 -0
  206. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/INTERFACE.md +36 -0
  207. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/README.md +51 -0
  208. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/SPEC.md +25 -0
  209. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/__init__.py +121 -0
  210. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/base.py +111 -0
  211. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/claude.py +99 -0
  212. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/cline.py +298 -0
  213. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/codex.py +300 -0
  214. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/dsh.py +106 -0
  215. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/opencode.py +209 -0
  216. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/pi.py +94 -0
  217. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_acp/zcode.py +99 -0
  218. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/INTERFACE.md +24 -0
  219. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/README.md +62 -0
  220. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/SPEC.md +25 -0
  221. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/__init__.py +21 -0
  222. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/adapters.py +412 -0
  223. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/autonomous_runner.py +1152 -0
  224. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/cline.py +448 -0
  225. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/common.py +103 -0
  226. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/free_models.py +786 -0
  227. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_bootstrap.py +389 -0
  228. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_evaluators.py +761 -0
  229. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_probe.py +41 -0
  230. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_provider_arbitrator.py +831 -0
  231. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_registry.py +662 -0
  232. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/host_usage.py +127 -0
  233. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_process_tracker.py +509 -0
  234. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/mcp_registry_gate.py +379 -0
  235. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/pi.py +102 -0
  236. bugx_cli-0.1.1.data/data/share/bugx-agent/core/host_runtime/provider_facts.py +66 -0
  237. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/INTERFACE.md +51 -0
  238. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/README.md +67 -0
  239. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/SPEC.md +25 -0
  240. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/__init__.py +140 -0
  241. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_base_usage.py +152 -0
  242. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_codex_usage.py +297 -0
  243. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_dsh_usage.py +184 -0
  244. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_mcp_toml.py +365 -0
  245. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/_zcode_usage.py +269 -0
  246. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/base.py +479 -0
  247. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/claude.py +212 -0
  248. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/cline.py +229 -0
  249. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/codex.py +1006 -0
  250. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/dsh.py +526 -0
  251. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/opencode.py +358 -0
  252. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/pi.py +308 -0
  253. bugx_cli-0.1.1.data/data/share/bugx-agent/core/hosts/zcode.py +219 -0
  254. bugx_cli-0.1.1.data/data/share/bugx-agent/core/i18n.py +252 -0
  255. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/README.md +41 -0
  256. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/__init__.py +17 -0
  257. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/build_info.py +105 -0
  258. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/client_metadata.py +185 -0
  259. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/json_utils.py +22 -0
  260. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/python_runtime.py +540 -0
  261. bugx_cli-0.1.1.data/data/share/bugx-agent/core/infra/safe_xml.py +221 -0
  262. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_bugx.py +118 -0
  263. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/INTERFACE.md +31 -0
  264. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/README.md +106 -0
  265. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/SPEC.md +25 -0
  266. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/__init__.py +29 -0
  267. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/candidate_revalidation.py +484 -0
  268. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/common.py +1060 -0
  269. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_confirm_phase.py +391 -0
  270. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/finding_settlement.py +1432 -0
  271. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_adjudication.py +666 -0
  272. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/findings_snapshot.py +357 -0
  273. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/judge_phase.py +848 -0
  274. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lesson_context.py +536 -0
  275. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/lifecycle_reporter.py +627 -0
  276. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/orchestrator_controls.py +686 -0
  277. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_commit.py +567 -0
  278. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_coverage_sync.py +598 -0
  279. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_dry_run.py +817 -0
  280. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_observability.py +367 -0
  281. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_phase.py +1223 -0
  282. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_receipt.py +373 -0
  283. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/post_round_lifecycle.py +786 -0
  284. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_phase.py +1029 -0
  285. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_recon_scout.py +879 -0
  286. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/pre_state_builder.py +1133 -0
  287. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/report_sharing.py +414 -0
  288. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/round_orchestrator.py +1116 -0
  289. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/session_runtime.py +1670 -0
  290. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_gates.py +1050 -0
  291. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_interaction.py +1003 -0
  292. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/startup_version_gate.py +879 -0
  293. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_bridge.py +1253 -0
  294. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_coverage.py +423 -0
  295. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/supervisor_degraded.py +1211 -0
  296. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_barriers.py +424 -0
  297. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_orchestrator.py +1246 -0
  298. bugx_cli-0.1.1.data/data/share/bugx-agent/core/launch_phases/worker_prior.py +749 -0
  299. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/INTERFACE.md +35 -0
  300. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/README.md +160 -0
  301. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/SPEC.md +25 -0
  302. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/__init__.py +67 -0
  303. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/_facade.py +227 -0
  304. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/archive_ops.py +630 -0
  305. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/auto_materialization.py +459 -0
  306. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/bug-log.md +22 -0
  307. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/cli.py +275 -0
  308. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/export_ops.py +554 -0
  309. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_confirmation.py +1316 -0
  310. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_io.py +299 -0
  311. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_lifecycle.py +730 -0
  312. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/finding_verification.py +405 -0
  313. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/incidents.py +1005 -0
  314. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson-replay-cases.json +20 -0
  315. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_ledger.py +241 -0
  316. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/lesson_replay.py +272 -0
  317. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/life_ledger.py +668 -0
  318. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/mistake-book.md +130 -0
  319. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/patterns.py +684 -0
  320. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/receipt_contract.py +269 -0
  321. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/schema.py +1192 -0
  322. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/sync_ops.py +940 -0
  323. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/tool_experience.py +683 -0
  324. bugx_cli-0.1.1.data/data/share/bugx-agent/core/ledger/verify_life.py +1597 -0
  325. bugx_cli-0.1.1.data/data/share/bugx-agent/core/lesson-ledger.json +275 -0
  326. bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/README.md +19 -0
  327. bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/en-US.json +462 -0
  328. bugx_cli-0.1.1.data/data/share/bugx-agent/core/locales/zh-CN.json +462 -0
  329. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/INTERFACE.md +75 -0
  330. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/README.md +62 -0
  331. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/SPEC.md +25 -0
  332. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/__init__.py +128 -0
  333. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/base.py +717 -0
  334. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/channel_lifecycle.py +751 -0
  335. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/graph_handlers.py +222 -0
  336. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/knowledge_handlers.py +536 -0
  337. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/mining_handlers.py +586 -0
  338. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/resource_prompt_table.py +116 -0
  339. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/retrieval_handlers.py +249 -0
  340. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/rpc_server.py +470 -0
  341. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/supervisor_handlers.py +1461 -0
  342. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/telemetry_handlers.py +227 -0
  343. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_handlers/tool_table.py +1030 -0
  344. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/README.md +21 -0
  345. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/__init__.py +1 -0
  346. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/common.py +363 -0
  347. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/environment.py +567 -0
  348. bugx_cli-0.1.1.data/data/share/bugx-agent/core/mcp_runtime_support/verifier.py +758 -0
  349. bugx_cli-0.1.1.data/data/share/bugx-agent/core/metadata.txt +4 -0
  350. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/README.md +157 -0
  351. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/__init__.py +242 -0
  352. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_plan.py +187 -0
  353. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/capability_planner.py +195 -0
  354. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_archetype.py +542 -0
  355. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/domain_router.py +269 -0
  356. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/dynamic_flow_analyzer.py +533 -0
  357. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/impact_pruner.py +435 -0
  358. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/intent_adjudicator.py +175 -0
  359. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/judge_pipeline.py +1246 -0
  360. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/logic_analysis.py +419 -0
  361. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/prompt_harness.py +1704 -0
  362. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/source_inspector.py +267 -0
  363. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/spec_harvester.py +449 -0
  364. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/target_sandbox_manager.py +573 -0
  365. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/test_capability_verifier.py +1364 -0
  366. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/tools-kb.md +38 -0
  367. bugx_cli-0.1.1.data/data/share/bugx-agent/core/planning/unit_kind.py +122 -0
  368. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/INTERFACE.md +83 -0
  369. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/README.md +51 -0
  370. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/SPEC.md +36 -0
  371. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/__init__.py +76 -0
  372. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/android_probe.py +552 -0
  373. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/base.py +147 -0
  374. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/codebase_memory_probe.py +647 -0
  375. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/desktop_probe.py +342 -0
  376. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/differential_probe.py +434 -0
  377. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/efficiency_probe.py +232 -0
  378. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ios_binary_probe.py +472 -0
  379. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/memory_probe.py +392 -0
  380. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/miniprogram_probe.py +385 -0
  381. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/mobile_probe.py +466 -0
  382. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/native_probe.py +302 -0
  383. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/openwiki_probe.py +263 -0
  384. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/pattern_probe.py +453 -0
  385. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/platform_probe.py +424 -0
  386. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/probe_registry.py +1770 -0
  387. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_fixture_corpus.py +340 -0
  388. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_probe.py +1510 -0
  389. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sast_rules.py +1481 -0
  390. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/sca_scanner.py +779 -0
  391. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_accessibility.py +149 -0
  392. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_audit.py +513 -0
  393. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_contract.py +273 -0
  394. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_evidence.py +212 -0
  395. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_measurements.py +314 -0
  396. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_repair.py +250 -0
  397. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_review.py +133 -0
  398. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_storybook.py +107 -0
  399. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_tokens.py +185 -0
  400. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/ui_visual_diff.py +131 -0
  401. bugx_cli-0.1.1.data/data/share/bugx-agent/core/probes/web_probe.py +714 -0
  402. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/INTERFACE.md +62 -0
  403. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/README.md +53 -0
  404. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/SPEC.md +28 -0
  405. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/__init__.py +201 -0
  406. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/arbitrator.py +316 -0
  407. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/constants.py +247 -0
  408. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/detector.py +399 -0
  409. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/extractors.py +836 -0
  410. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/fingerprint.py +116 -0
  411. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/storage.py +258 -0
  412. bugx_cli-0.1.1.data/data/share/bugx-agent/core/project_profiler/strategy.py +301 -0
  413. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/README.md +35 -0
  414. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/codex_dialog_dispatch.md +9 -0
  415. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_en.md +42 -0
  416. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/command_routing_zh.md +42 -0
  417. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/l0_router.md +47 -0
  418. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/anti_patterns.md +16 -0
  419. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/concurrency_rules.md +14 -0
  420. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/memory_leak_rules.md +13 -0
  421. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/rules/prompt_injection_defense.md +13 -0
  422. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_explore.md +31 -0
  423. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_gate.md +43 -0
  424. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_mutate.md +42 -0
  425. bugx_cli-0.1.1.data/data/share/bugx-agent/core/prompts/stages/stage_repair.md +85 -0
  426. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/README.md +74 -0
  427. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/__init__.py +169 -0
  428. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/fix_watchlist.py +391 -0
  429. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_dynamic.py +418 -0
  430. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_repair_loop.py +462 -0
  431. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/l7_selfcheck.py +862 -0
  432. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/minimize_repro.py +466 -0
  433. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/patch_synthesizer.py +617 -0
  434. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/regression_pack.py +379 -0
  435. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_fixer.py +910 -0
  436. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_loop.py +311 -0
  437. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_repair.py +348 -0
  438. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_rounds.py +212 -0
  439. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/rsi_scope.py +281 -0
  440. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/self_heal.py +604 -0
  441. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_generator.py +1108 -0
  442. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_quality_auditor.py +410 -0
  443. bugx_cli-0.1.1.data/data/share/bugx-agent/core/repair/test_strategy.py +511 -0
  444. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/INTERFACE.md +59 -0
  445. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/README.md +69 -0
  446. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/SPEC.md +28 -0
  447. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/__init__.py +47 -0
  448. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/attestation.py +228 -0
  449. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/authority.py +255 -0
  450. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/finding_report.py +418 -0
  451. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/formal_report_builder.py +924 -0
  452. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/html_renderers.py +696 -0
  453. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/models.py +759 -0
  454. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/pdf_exporter.py +231 -0
  455. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/projects_assets.py +730 -0
  456. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_client.py +743 -0
  457. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_data_builder.py +388 -0
  458. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/report_share.py +459 -0
  459. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/sast_bridge.py +116 -0
  460. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/server.py +832 -0
  461. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/visual_report_builder.py +796 -0
  462. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web-conformance.md +168 -0
  463. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/web_conformance.py +428 -0
  464. bugx_cli-0.1.1.data/data/share/bugx-agent/core/report_engine/workbench_assets.py +484 -0
  465. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/INTERFACE.md +20 -0
  466. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/README.md +161 -0
  467. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/SPEC.md +25 -0
  468. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/__init__.py +3 -0
  469. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/code_analyzer.py +1720 -0
  470. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/codebase_memory_bridge.py +337 -0
  471. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/context_assembler.py +240 -0
  472. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/corpus_fetch.py +369 -0
  473. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/graph_ego.py +597 -0
  474. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_auto.py +662 -0
  475. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sources.py +168 -0
  476. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/knowledge_sync.py +1003 -0
  477. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/memory_store.py +480 -0
  478. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/query_planner.py +1020 -0
  479. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/rrf_engine.py +137 -0
  480. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_extractor.py +1209 -0
  481. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_normalizer.py +373 -0
  482. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/slice_spec.py +357 -0
  483. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/symbol_index.py +1151 -0
  484. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/universal_code_matcher.py +622 -0
  485. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_bridge.py +476 -0
  486. bugx_cli-0.1.1.data/data/share/bugx-agent/core/retrieval/xerj_supervisor.py +362 -0
  487. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/README.md +33 -0
  488. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/PROVENANCE.json +30 -0
  489. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/crypto.yaml +36 -0
  490. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/network.yaml +20 -0
  491. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/resilience.yaml +47 -0
  492. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/ios/storage.yaml +48 -0
  493. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/LICENSE +173 -0
  494. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/PROVENANCE.json +270 -0
  495. 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
  496. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-backup-manifest.yml +24 -0
  497. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-event-bound.yml +49 -0
  498. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-invalidated-enrollment.yml +11 -0
  499. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-no-confirmation-required.yml +10 -0
  500. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-biometric-validity-duration.yml +24 -0
  501. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-algorithms.yaml +9 -0
  502. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-broken-encryption-modes.yaml +13 -0
  503. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-content-provider-exported.yml +35 -0
  504. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-custom-deeplink-scheme.yml +29 -0
  505. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-dangerous-app-permissions.yaml +65 -0
  506. 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
  507. 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
  508. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debuggable-flag.yml +10 -0
  509. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-debugger-checks.yml +12 -0
  510. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-autoverify-missing.yml +33 -0
  511. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-deeplink-unvalidated-parameter.yml +11 -0
  512. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-device-passcode-present.yml +17 -0
  513. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-fileprovider-broad-scope.yml +46 -0
  514. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-crypto-keys-usage.yml +14 -0
  515. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-hardcoded-security-provider.yaml +18 -0
  516. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-internal-communication.yml +30 -0
  517. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-implicit-intent-leaking-extras.yml +29 -0
  518. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-input-field-usage.yml +11 -0
  519. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-key-generation-with-insufficient-key-length.yml +21 -0
  520. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-keyboard-cache-input-types.yml +10 -0
  521. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-local-storage-input-validation.yml +48 -0
  522. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-native-debugger-checks.yml +12 -0
  523. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-checkservertrusted.yml +12 -0
  524. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-hostname-verification.yml +11 -0
  525. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-insecure-trust-anchors.yml +11 -0
  526. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-network-onreceivedsslerror.yml +12 -0
  527. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-non-random-use.yml +16 -0
  528. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-object-deserialization.yml +14 -0
  529. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-overlay-protection.yml +68 -0
  530. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-pendingintent-mutable.yml +39 -0
  531. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-random-apis-insufficient-entropy.yml +17 -0
  532. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-root-detection.yaml +59 -0
  533. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sdk-version.yml +10 -0
  534. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications-manifest.yml +17 -0
  535. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-notifications.yml +11 -0
  536. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sensitive-data-in-screenshot.yml +18 -0
  537. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-sql-injection-contentprovider.yml +17 -0
  538. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-ssl-socket-hostnameverifier.yml +15 -0
  539. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-strictmode.yml +10 -0
  540. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-system-alert-window.yml +9 -0
  541. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-allow-local-access.yml +15 -0
  542. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-bridges.yml +28 -0
  543. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-safebrowsing.yml +20 -0
  544. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mastg/mastg-android-webview-url-handlers.yml +41 -0
  545. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/PROVENANCE.json +26 -0
  546. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/network.yaml +37 -0
  547. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/platform.yaml +36 -0
  548. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/miniprogram/storage.yaml +48 -0
  549. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/LICENSE +165 -0
  550. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/PROVENANCE.json +58 -0
  551. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/auth.yaml +59 -0
  552. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/crypto.yaml +66 -0
  553. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/jailbreak.yaml +14 -0
  554. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/keyboard.yaml +34 -0
  555. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/logging.yaml +23 -0
  556. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/network.yaml +55 -0
  557. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/resilience.yaml +29 -0
  558. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/secrets.yaml +33 -0
  559. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/storage.yaml +29 -0
  560. bugx_cli-0.1.1.data/data/share/bugx-agent/core/rules/mobsfscan-swift/webview.yaml +32 -0
  561. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/README.md +198 -0
  562. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/__init__.py +3 -0
  563. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/bugx_logging.py +1464 -0
  564. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/daemon_runner.py +623 -0
  565. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/fixture_solidify.py +444 -0
  566. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/global_telemetry.py +549 -0
  567. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/incident_eval.py +148 -0
  568. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction.py +605 -0
  569. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interaction_store.py +435 -0
  570. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/interactive_menu.py +95 -0
  571. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/log_analytics.py +922 -0
  572. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/mining_quality_framework.py +1387 -0
  573. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/model_runner.py +732 -0
  574. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/platform_adapter.py +579 -0
  575. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/prep_validate.py +478 -0
  576. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_graph.py +827 -0
  577. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_init.py +481 -0
  578. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_profile.py +224 -0
  579. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/project_settings.py +964 -0
  580. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/provider_window.py +97 -0
  581. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/resume_ticket.py +115 -0
  582. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/scenario_eval.py +856 -0
  583. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/seed_drill.py +549 -0
  584. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/self_audit.py +550 -0
  585. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/session_profile.py +205 -0
  586. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/setup_ui_env.py +229 -0
  587. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/startup_environment.py +859 -0
  588. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/sync_store.py +1421 -0
  589. bugx_cli-0.1.1.data/data/share/bugx-agent/core/runtime/tool_install_targets.py +18 -0
  590. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/README.md +35 -0
  591. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/agent-graph.schema.json +368 -0
  592. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/attack-graph.schema.json +88 -0
  593. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/evidence-bundle.schema.json +33 -0
  594. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/skill-pack.schema.json +230 -0
  595. bugx_cli-0.1.1.data/data/share/bugx-agent/core/schemas/worker-checkpoint.schema.json +119 -0
  596. bugx_cli-0.1.1.data/data/share/bugx-agent/core/secure_atomic.py +289 -0
  597. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/README.md +55 -0
  598. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/c.txt +29 -0
  599. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/cpp.txt +32 -0
  600. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/css.txt +70 -0
  601. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/go.txt +46 -0
  602. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/java.txt +30 -0
  603. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/javascript.txt +55 -0
  604. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/kotlin.txt +28 -0
  605. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/python.txt +71 -0
  606. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/rust.txt +53 -0
  607. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/swift.txt +29 -0
  608. bugx_cli-0.1.1.data/data/share/bugx-agent/core/seed_corpus/typescript.txt +29 -0
  609. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/README.md +53 -0
  610. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/__init__.py +189 -0
  611. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_docs_mcp_server.py +418 -0
  612. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/bugx_mcp_server.py +1161 -0
  613. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_runtime.py +968 -0
  614. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mcp_session_proof.py +605 -0
  615. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/mobile_ui_inspector.py +405 -0
  616. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_pack.py +1214 -0
  617. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/skill_synthesizer.py +1153 -0
  618. bugx_cli-0.1.1.data/data/share/bugx-agent/core/skills/tools_kb.py +313 -0
  619. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/INTERFACE.md +121 -0
  620. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/README.md +209 -0
  621. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/SPEC.md +25 -0
  622. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/__init__.py +175 -0
  623. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/audit_supervisor.py +1015 -0
  624. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/budget_governor.py +1254 -0
  625. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_handler.py +368 -0
  626. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_pipeline.py +1564 -0
  627. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/checkpoint_sync.py +653 -0
  628. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_events.py +74 -0
  629. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/claim_sync.py +590 -0
  630. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/cli.py +812 -0
  631. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/context_sync.py +55 -0
  632. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/coverage_sync.py +115 -0
  633. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_commit.py +470 -0
  634. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_sync.py +688 -0
  635. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finding_workflow.py +676 -0
  636. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_policy.py +224 -0
  637. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/finish_sync.py +185 -0
  638. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/graph_sync.py +669 -0
  639. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lease_manager.py +788 -0
  640. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/lifecycle_blocks.py +129 -0
  641. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/next_round_sync.py +126 -0
  642. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/observability.py +140 -0
  643. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/recovery_sync.py +165 -0
  644. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/rejection_remedies.py +355 -0
  645. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/round_governor.py +306 -0
  646. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/serial_authorization.py +544 -0
  647. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/start_sync.py +87 -0
  648. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/state_store.py +249 -0
  649. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_host.py +511 -0
  650. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/supervisor_models.py +1143 -0
  651. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/systemic_failure.py +104 -0
  652. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/task_scheduler.py +1640 -0
  653. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_checkpoint.py +230 -0
  654. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_execution.py +265 -0
  655. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_handoff.py +192 -0
  656. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_lifecycle.py +396 -0
  657. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_runtime.py +1005 -0
  658. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor/worker_sync.py +89 -0
  659. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/README.md +36 -0
  660. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/__init__.py +0 -0
  661. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/exceptions.py +52 -0
  662. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/graph_models.py +357 -0
  663. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/path_containment.py +151 -0
  664. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/target_fingerprint.py +310 -0
  665. bugx_cli-0.1.1.data/data/share/bugx-agent/core/supervisor_types/worker_claim.py +411 -0
  666. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/INTERFACE.md +50 -0
  667. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/README.md +57 -0
  668. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/SPEC.md +26 -0
  669. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/__init__.py +11 -0
  670. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/__init__.py +27 -0
  671. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/base.py +87 -0
  672. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/bugx.py +102 -0
  673. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/claude.py +222 -0
  674. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/cline.py +407 -0
  675. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/codex.py +260 -0
  676. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/dsh.py +177 -0
  677. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/opencode.py +218 -0
  678. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/pi.py +272 -0
  679. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/registry.py +100 -0
  680. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/adapters/zcode.py +312 -0
  681. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/api_routes_post.py +668 -0
  682. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/dispatcher.py +1376 -0
  683. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/docs_session_service.py +473 -0
  684. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/handler.py +674 -0
  685. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/ide_cloud_service.py +526 -0
  686. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/mcp_inspector.py +1747 -0
  687. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/00-base.css +1060 -0
  688. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/01-monitoring.css +802 -0
  689. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/02-header-actions.css +321 -0
  690. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/03-trigger-popover.css +697 -0
  691. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/04-composer.css +628 -0
  692. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/05-skills-center.css +878 -0
  693. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/06-mcp-center.css +623 -0
  694. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/07-skill-detail.css +265 -0
  695. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/08-files-management.css +167 -0
  696. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/09-files-center.css +386 -0
  697. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/10-icons.css +105 -0
  698. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/11-project-options.css +185 -0
  699. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/12-profile-tab.css +383 -0
  700. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-CXAsl8mr.js +333 -0
  701. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/index-DHQUtWtx.css +1 -0
  702. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-B8Z6Jvzv.woff +0 -0
  703. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-400-normal-C44pakCn.woff2 +0 -0
  704. 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
  705. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-cyrillic-500-normal-BdVUvljg.woff2 +0 -0
  706. 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
  707. 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
  708. 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
  709. 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
  710. 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
  711. 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
  712. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-greek-500-normal-By8GFJzz.woff2 +0 -0
  713. 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
  714. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-400-normal-DJ5YJwmz.woff2 +0 -0
  715. 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
  716. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-CUHe9xxf.woff2 +0 -0
  717. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-latin-500-normal-DVVamBqs.woff +0 -0
  718. 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
  719. 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
  720. 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
  721. 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
  722. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-BbG3LG1A.woff2 +0 -0
  723. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-400-normal-DR1UuFon.woff +0 -0
  724. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-8N8MYVKB.woff +0 -0
  725. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/assets/source-serif-4-vietnamese-500-normal-Bi3OSTTW.woff2 +0 -0
  726. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/design-tokens.css +113 -0
  727. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/favicon.png +0 -0
  728. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/icon-192.png +0 -0
  729. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/index.html +55 -0
  730. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/manifest.webmanifest +19 -0
  731. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/project-settings.js +9602 -0
  732. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/static/sw.js +8 -0
  733. bugx_cli-0.1.1.data/data/share/bugx-agent/core/webui/workspace_service.py +218 -0
  734. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/agents/bugx.md +27 -0
  735. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/dsh-patch.yml +18 -0
  736. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/cordis.patch.yml +4 -0
  737. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/index.js +219 -0
  738. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/mcp/package.json +28 -0
  739. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx/SKILL.md +70 -0
  740. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/skills/bugx-dsh/SKILL.md +229 -0
  741. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/client.js +87 -0
  742. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/cordis.patch.yml +4 -0
  743. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/index.js +7 -0
  744. bugx_cli-0.1.1.data/data/share/bugx-agent/dsh/ui/package.json +27 -0
  745. bugx_cli-0.1.1.data/data/share/bugx-agent/mcp-lock.json +3075 -0
  746. bugx_cli-0.1.1.data/data/share/bugx-agent/opencode.json +129 -0
  747. bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/README.md +12 -0
  748. bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/index.ts +299 -0
  749. bugx_cli-0.1.1.data/data/share/bugx-agent/pi/extensions/bugx/manifest.json +11 -0
  750. bugx_cli-0.1.1.data/data/share/bugx-agent/pi/skills/bugx/SKILL.md +69 -0
  751. bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-claude/SKILL.md +326 -0
  752. bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-opencode/SKILL.md +129 -0
  753. bugx_cli-0.1.1.data/data/share/bugx-agent/plugins/bugx/skills/bugx-zcode/SKILL.md +459 -0
  754. bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/connector-meta.json +19 -0
  755. bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/icon.png +0 -0
  756. bugx_cli-0.1.1.data/data/share/bugx-agent/workbuddy/skills/bugx/SKILL.md +70 -0
  757. bugx_cli-0.1.1.dist-info/METADATA +335 -0
  758. bugx_cli-0.1.1.dist-info/RECORD +762 -0
  759. bugx_cli-0.1.1.dist-info/WHEEL +5 -0
  760. bugx_cli-0.1.1.dist-info/entry_points.txt +2 -0
  761. bugx_cli-0.1.1.dist-info/licenses/LICENSE +55 -0
  762. bugx_cli-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1030 @@
1
+ #!/usr/bin/env python3
2
+ """core/mcp_handlers/tool_table.py - MCP 工具元数据表与输入 Schema 声明。"""
3
+
4
+ from __future__ import annotations
5
+
6
+ import sys
7
+ from typing import Any
8
+ from core.planning import unit_kind
9
+ from core.mcp_handlers import (
10
+ HANDLER_REGISTRY,
11
+ MAX_ARTIFACT_PATH_LENGTH,
12
+ MAX_COMMAND_LENGTH,
13
+ MAX_COVERAGE_PER_CHECKPOINT,
14
+ MAX_EVIDENCE_PER_CHECKPOINT,
15
+ MAX_FINDING_FIELD_LENGTH,
16
+ MAX_FINDING_FINGERPRINT_LENGTH,
17
+ MAX_FINDINGS_PER_CHECKPOINT,
18
+ MAX_MCP_JSON_DEPTH,
19
+ MAX_MCP_JSON_KEYS,
20
+ MAX_MCP_REQUEST_BYTES,
21
+ MAX_UNITS_PER_CLAIM,
22
+ )
23
+ from core.supervisor import audit_supervisor
24
+ from core.supervisor.supervisor_models import (
25
+ VALID_COVERAGE_STATES,
26
+ VALID_EVIDENCE_STATES,
27
+ )
28
+ LEASE_SECONDS_MAX = audit_supervisor.MAX_LEASE_SECONDS
29
+
30
+ _HOST_ONLY = frozenset({"host"})
31
+ _WORKER_ONLY = frozenset({"worker"})
32
+ _SHARED_ROLES = frozenset({"host", "worker"})
33
+
34
+ UNIT_BUSINESS_PATTERN = f"^{unit_kind.UnitKind.BUSINESS.value}:.+"
35
+
36
+
37
+ def _finding_severity_levels() -> tuple[str, ...]:
38
+ """finding 严重度单一真源(BX-ENGINE-18);委托给唯一访问器。"""
39
+ try:
40
+ from core.supervisor.supervisor_models import finding_severity_levels
41
+
42
+ return finding_severity_levels()
43
+ except ImportError:
44
+ return ("info", "low", "medium", "high", "critical")
45
+
46
+
47
+ _FINDING_SEVERITY_LEVELS = _finding_severity_levels()
48
+
49
+ def _build_tool_table() -> tuple[tuple[frozenset[str], dict[str, object]], ...]:
50
+ """构建 MCP 工具元数据表 —— 角色归属与 JSON schema 的唯一声明处。
51
+
52
+ DES-08:每个工具的角色与其 ``inputSchema`` 在此同处声明,使「新增一个工具」
53
+ 只需改这一处;``HOST_TOOLS`` / ``WORKER_TOOLS`` / ``READ_ONLY_TOOLS``
54
+ 由本表派生,``HANDLER_REGISTRY`` 由 ``_assert_tool_registry_consistent()``
55
+ 在导入期强制校验。
56
+ """
57
+ string_array = {"type": "array", "items": {"type": "string"}}
58
+ finding_schema = {
59
+ "type": "array", "maxItems": 50,
60
+ "items": {
61
+ "type": "object", "required": ["fingerprint"],
62
+ "properties": {
63
+ "fingerprint": {"type": "string", "minLength": 1, "maxLength": 256},
64
+ "id": {"type": "string", "minLength": 1, "maxLength": 256},
65
+ "case_id": {"type": "string", "minLength": 1, "maxLength": 256},
66
+ "title": {"type": "string", "minLength": 1, "maxLength": 4096},
67
+ "root_cause": {"type": "string", "minLength": 1, "maxLength": 4096},
68
+ "severity": {
69
+ # BX-ENGINE-18:由 finding 严重度单一真源渲染 enum,
70
+ # 消除「schema 无 enum / 门禁有词表」的漂移面。
71
+ "type": "string", "maxLength": 32,
72
+ "enum": list(_FINDING_SEVERITY_LEVELS),
73
+ },
74
+ "confidence": {"type": "number", "minimum": 0, "maximum": 1},
75
+ "evidence": {
76
+ "type": "array", "minItems": 1, "maxItems": 50,
77
+ "items": {"type": "object", "required": ["path"],
78
+ "properties": {
79
+ "path": {"type": "string", "minLength": 1, "maxLength": 1024},
80
+ "line": {"type": "integer", "minimum": 1},
81
+ }, "additionalProperties": True},
82
+ },
83
+ "reproducible": {"type": "boolean"},
84
+ "reproduction": {"type": "string", "maxLength": 4096},
85
+ # PE-20261005-003 集成:结构化复现三件套(W3),自动裁决据此
86
+ # 认定"真实复现步骤";非空字符串才入 state。
87
+ "poc_cmd": {"type": "string", "minLength": 1, "maxLength": 4096},
88
+ "poc_input": {"type": "string", "minLength": 1, "maxLength": 4096},
89
+ "poc_negative_input": {"type": "string", "maxLength": 4096},
90
+ },
91
+ # Supervisor performs the shared bounded JSON validation; unknown
92
+ # finding fields remain forward-compatible with agent_eval.
93
+ "additionalProperties": True,
94
+ },
95
+ }
96
+ evidence_schema = {
97
+ "type": "object",
98
+ "maxProperties": MAX_EVIDENCE_PER_CHECKPOINT,
99
+ "additionalProperties": {
100
+ "type": "object",
101
+ "required": [
102
+ "command", "exit_code", "artifact_path", "artifact_sha256",
103
+ "target_fingerprint", "timestamp", "worker_id", "run_id",
104
+ "round_no", "lease_id", "status",
105
+ ],
106
+ "properties": {
107
+ "command": {
108
+ "type": "string", "minLength": 1,
109
+ "maxLength": MAX_COMMAND_LENGTH,
110
+ "description": "真实执行的验证命令,不是计划命令。",
111
+ },
112
+ "exit_code": {
113
+ "type": "integer",
114
+ "description": "真实验证命令退出码;status=passed 时必须为 0。",
115
+ },
116
+ "artifact_path": {
117
+ "type": "string", "minLength": 1,
118
+ "maxLength": MAX_ARTIFACT_PATH_LENGTH,
119
+ "description": "当前 claim artifact_root 内、相对仓库根的文件路径。",
120
+ },
121
+ "artifact_sha256": {
122
+ "type": "string", "pattern": "^[0-9a-fA-F]{64}$",
123
+ "description": "artifact 文件实际 SHA-256。",
124
+ },
125
+ "target_fingerprint": {"type": "string", "minLength": 1},
126
+ "timestamp": {"type": "number", "exclusiveMinimum": 0},
127
+ "worker_id": {"type": "string", "minLength": 1},
128
+ "run_id": {"type": "string", "minLength": 1},
129
+ "round_no": {"type": "integer", "minimum": 1},
130
+ "lease_id": {"type": "string", "minLength": 1},
131
+ "status": {
132
+ "type": "string", "enum": sorted(VALID_EVIDENCE_STATES),
133
+ "description": (
134
+ "证据状态。covered 是 coverage 值,不是 evidence 值;"
135
+ "覆盖通过时使用 passed。"
136
+ ),
137
+ },
138
+ "execution_receipt": {
139
+ "type": "object",
140
+ "required": [
141
+ "schema_version", "execution_id", "worker_id", "lease_id",
142
+ "command", "exit_code", "artifact_path", "artifact_sha256", "status",
143
+ ],
144
+ "properties": {
145
+ "schema_version": {"type": "integer", "const": 1},
146
+ "execution_id": {"type": "string", "minLength": 1},
147
+ "worker_id": {"type": "string", "minLength": 1},
148
+ "lease_id": {"type": "string", "minLength": 1},
149
+ "command": {"type": "string", "minLength": 1, "maxLength": MAX_COMMAND_LENGTH},
150
+ "exit_code": {"type": "integer"},
151
+ "artifact_path": {"type": "string", "minLength": 1, "maxLength": MAX_ARTIFACT_PATH_LENGTH},
152
+ "artifact_sha256": {"type": "string", "pattern": "^[0-9a-fA-F]{64}$"},
153
+ "status": {"type": "string", "enum": sorted(VALID_EVIDENCE_STATES)},
154
+ },
155
+ "additionalProperties": False,
156
+ },
157
+ },
158
+ },
159
+ }
160
+ table: tuple[tuple[frozenset[str], dict[str, object]], ...] = (
161
+ (_HOST_ONLY, {
162
+ "name": "bugx_supervisor_start",
163
+ "description": "启动或幂等复用当前 BugX Session 的本地 Supervisor。",
164
+ "inputSchema": {"type": "object", "properties": {
165
+ "caller_role": {"type": "string", "enum": ["host"]},
166
+ "run_id": {"type": "string"}, "life_score": {"type": "number"},
167
+ "max_rounds": {"type": "integer", "minimum": 1},
168
+ "max_wall_seconds": {"type": "number", "exclusiveMinimum": 0},
169
+ "max_round_wall_seconds": {"type": "number", "exclusiveMinimum": 0},
170
+ "max_tool_calls": {"type": "integer", "minimum": 0},
171
+ "max_cost_units": {"type": "number", "minimum": 0},
172
+ "max_concurrency": {
173
+ "type": "integer", "minimum": 1,
174
+ "description": "省略时按当前机器承载能力动态解析",
175
+ },
176
+ "allow_serial": {"type": "boolean"}, "serial_reason": {"type": "string"},
177
+ "require_confirmation": {"type": "boolean", "const": True, "default": True},
178
+ "project_id": {"type": "string"}, "session_id": {"type": "string"},
179
+ "round_id": {"type": "string"}, "life_id": {"type": "string"},
180
+ "plan_hash": {"type": "string"}, "life_kind": {"type": "string", "enum": ["mine", "fix"]},
181
+ "clean_aborted": {
182
+ "type": "boolean", "default": False,
183
+ "description": "无人值守清理 aborted runtime gate 后启动新 run;省略时保持交互阻断",
184
+ },
185
+ }, "required": ["caller_role"]},
186
+ }),
187
+ (_HOST_ONLY, {
188
+ "name": "bugx_supervisor_findings",
189
+ "description": "DOC-230 3.8 第 4 项:修复历史 finding 的 severity(脏数据出口)。只改 severity 字段,绝不改动确认状态;值必须命中写侧词表;真实变更写 finding_severity_repaired 审计事件;幂等调用不推进 revision。角色归属以工具表为单一真源(DOC-230 3.6):handler 与 schema 均为 host-only。",
190
+ "inputSchema": {"type": "object", "required": ["caller_role", "fix_severity", "finding", "severity"], "properties": {
191
+ "caller_role": {"type": "string", "enum": ["host"]},
192
+ "fix_severity": {"type": "boolean", "const": True, "description": "当前唯一支持的写操作;显式声明 type 让客户端拿到布尔类型信息(裸 const 会被部分宿主序列化成字符串后拒收,实测 2026-11-09)"},
193
+ "finding": {"type": "string", "minLength": 1, "maxLength": 512, "description": "finding_key / fingerprint / id / finding_id 任一"},
194
+ "severity": {"type": "string", "enum": list(_FINDING_SEVERITY_LEVELS)},
195
+ "reason": {"type": "string", "minLength": 1, "maxLength": 512, "description": "合法值之间改级的理由(C1/A12:severity 参与 Life 奖励与评分判定,静默改级会成为刷分/藏缺陷工具);修复非法值无需提供"},
196
+ "expected_revision": {"type": "integer", "minimum": 0},
197
+ }},
198
+ }),
199
+ (_HOST_ONLY, {
200
+ "name": "bugx_supervisor_reset_budget",
201
+ "description": "预算耗尽时开启新的预算 epoch;保留 findings、coverage 和 history,必要时 force 回收残留租约。角色归属以工具表为单一真源(DOC-230 3.6):handler 与 schema 均为 host-only。",
202
+ "inputSchema": {"type": "object", "properties": {
203
+ "caller_role": {"type": "string", "enum": ["host"]},
204
+ "expected_revision": {"type": "integer", "minimum": 0},
205
+ "force": {"type": "boolean", "default": False},
206
+ "renew_wall_clock": {"type": "boolean", "default": False},
207
+ "max_rounds": {"type": "integer", "minimum": 1},
208
+ "max_wall_seconds": {"type": "number", "exclusiveMinimum": 0},
209
+ "max_round_wall_seconds": {"type": "number", "exclusiveMinimum": 0},
210
+ "max_tool_calls": {"type": "integer", "minimum": 0},
211
+ "max_cost_units": {"type": "number", "minimum": 0},
212
+ "max_concurrency": {"type": "integer", "minimum": 1},
213
+ "allow_serial": {"type": "boolean"},
214
+ "serial_reason": {"type": "string"},
215
+ "require_confirmation": {"type": "boolean", "const": True, "default": True},
216
+ }, "required": ["caller_role"]},
217
+ }),
218
+ (_HOST_ONLY, {
219
+ "name": "bugx_supervisor_rebind_target",
220
+ "description": "覆盖计划已重建且 workspace fingerprint 发生变化时,显式重绑 Supervisor 目标并保留历史证据。角色归属以工具表为单一真源(DOC-230 3.6):handler 与 schema 均为 host-only。",
221
+ "inputSchema": {"type": "object", "required": ["caller_role", "reason"], "properties": {
222
+ "caller_role": {"type": "string", "enum": ["host"]},
223
+ "reason": {"type": "string", "minLength": 1, "maxLength": 512},
224
+ "expected_revision": {"type": "integer", "minimum": 0},
225
+ }},
226
+ }),
227
+ (_HOST_ONLY, {
228
+ "name": "bugx_supervisor_sync_finding_decisions",
229
+ "description": "校验活动 lifecycle 的 findings.json 绑定、现有候选 key、确认工件与 remediation 后,将审核决策同步到 Supervisor 权威状态。可显式请求把相同 key 候选的 title/root_cause/location/description 恢复为 Supervisor 原值;fingerprint/id 不匹配仍拒绝。",
230
+ "inputSchema": {"type": "object", "properties": {
231
+ "caller_role": {"type": "string", "enum": ["host"]},
232
+ "expected_revision": {"type": "integer", "minimum": 0},
233
+ "canonicalize_report_identity": {
234
+ "type": "boolean", "default": False,
235
+ "description": "仅修复相同 key 候选的非 key 身份字段;未知 key、fingerprint/id 不匹配仍拒绝。",
236
+ },
237
+ }, "required": ["caller_role"]},
238
+ }),
239
+ (_HOST_ONLY, {
240
+ "name": "bugx_supervisor_verify_finding",
241
+ "description": "宿主受控验证一条 Finding:引擎执行两次独立正例和固定负对照,记录原始输出与 hash;Worker 自报字段不具备确认资格。",
242
+ "inputSchema": {"type": "object", "required": ["caller_role", "finding", "recipe"], "properties": {
243
+ "caller_role": {"type": "string", "enum": ["host"]},
244
+ "finding": {"type": "string", "minLength": 1, "maxLength": 512},
245
+ "recipe": {"type": "object", "description": "预先固定的 positive/negative_control argv、cwd、oracle_reference、oracle_hash 与判据。"},
246
+ "request_id": {"type": "string", "minLength": 1, "maxLength": 128},
247
+ "expected_revision": {"type": "integer", "minimum": 0},
248
+ }},
249
+ }),
250
+ (_HOST_ONLY, {
251
+ "name": "bugx_supervisor_confirm_finding",
252
+ "description": (
253
+ "宿主原子确认或驳回一个 Finding:证据由引擎核验 receipt 派生并自检"
254
+ "(confirmed 必须已有 bugx_supervisor_verify_finding 的 CONFIRMED receipt),"
255
+ "缺料即拒绝,不再写入不可收敛的 confirmation。"
256
+ ),
257
+ "inputSchema": {"type": "object", "required": [
258
+ "caller_role", "finding_id", "decision", "reason",
259
+ ], "properties": {
260
+ "caller_role": {"type": "string", "enum": ["host"]},
261
+ "finding_id": {"type": "string", "minLength": 1},
262
+ "decision": {"type": "string", "enum": ["confirmed", "rejected"]},
263
+ "reason": {"type": "string", "minLength": 1, "maxLength": 2000},
264
+ "expected_revision": {"type": "integer", "minimum": 0},
265
+ "rejection_class": {
266
+ "type": "string", "description": "rejected 必填:expected_behavior/environment/tool_failure/duplicate/insufficient_evidence/flaky/not_reproducible。",
267
+ },
268
+ "root_cause_verified": {
269
+ "type": "boolean", "description": "confirmed 必填 true:宿主对根因的显式断言(引擎记录,不代为生成)。",
270
+ },
271
+ "oracle": {
272
+ "type": "object",
273
+ "description": "confirmed 需要 tier(requirement/contract/test/invariant/differential)与 provenance_kind(user-approved/repository-contract/external-spec/independent-implementation/runtime-invariant);verified 与 independent_from_change 由引擎按 oracle_hash 与证据文件核算,不接受声明。",
274
+ "properties": {
275
+ "tier": {"type": "string"},
276
+ "provenance_kind": {"type": "string"},
277
+ "reference": {"type": "string", "description": "可选断言:必须与核验 recipe 的 oracle_reference 一致。"},
278
+ },
279
+ },
280
+ "target_platform": {"type": "string", "description": "可选:目标平台标识,缺省 source。"},
281
+ "remediation": {
282
+ "type": "object",
283
+ "description": "可选修复记录:decision=fixed 需 fix_ref(commit_ref/test_ref)+ verification_passed=true;deferred 需 proposal/verification_plan/blast_radius。",
284
+ },
285
+ }},
286
+ }),
287
+ (_HOST_ONLY, {
288
+ "name": "bugx_supervisor_bootstrap_coverage",
289
+ "description": "在用户明确选择‘运行引导创建’后,安全创建当前生命周期覆盖清单;不改写活动 Supervisor。",
290
+ "inputSchema": {"type": "object", "required": ["caller_role", "confirmed"], "properties": {
291
+ "caller_role": {"type": "string", "enum": ["host"]},
292
+ "confirmed": {"type": "boolean", "description": "宿主原生单选已返回运行引导创建"},
293
+ }},
294
+ }),
295
+ (_SHARED_ROLES, {"name": "bugx_supervisor_status", "description": "读取状态、回收过期租约并返回下一动作;支持传入 since_revision 进行增量轮询。", "inputSchema": {"type": "object", "properties": {"since_revision": {"type": "integer", "minimum": 0, "description": "增量游标:若传入且与当前 revision 一致,返回最小未变更快照"}}}},),
296
+ (_SHARED_ROLES, {"name": "bugx_supervisor_gate", "description": "检查当前 Life 是否满足并发门禁;支持传入 since_revision 进行增量轮询。", "inputSchema": {"type": "object", "properties": {"since_revision": {"type": "integer", "minimum": 0, "description": "增量游标:若传入且与当前 revision 一致,返回最小未变更快照"}}}},),
297
+ (_SHARED_ROLES, {"name": "bugx_supervisor_coverage", "description": "按 unit_id、status_filter 或 revision 增量读取覆盖状态,避免传输全量 coverage。", "inputSchema": {"type": "object", "properties": {"unit_id": {"type": "string", "minLength": 1}, "status_filter": {"type": "string", "enum": sorted(VALID_COVERAGE_STATES)}, "since_revision": {"type": "integer", "minimum": 0}}}},),
298
+ (_HOST_ONLY, {
299
+ "name": "bugx_supervisor_reopen_finding",
300
+ "description": "宿主有审计理由地重开误报/拒绝记录;仅退回待验证,保留旧证据,不直接确认。",
301
+ "inputSchema": {"type": "object", "required": ["caller_role", "finding_id", "reason", "expected_revision"],
302
+ "properties": {"caller_role": {"type": "string", "enum": ["host"]},
303
+ "finding_id": {"type": "string", "minLength": 1},
304
+ "reason": {"type": "string", "minLength": 1, "maxLength": 2000},
305
+ "expected_revision": {"type": "integer", "minimum": 0}}},
306
+ }),
307
+ (_HOST_ONLY, {"name": "bugx_supervisor_admit_business", "description": "宿主显式授权高风险业务链路提前进入候选队列;不改变覆盖完成判定。", "inputSchema": {"type": "object", "required": ["caller_role", "unit_id", "risk_score", "reason"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "unit_id": {"type": "string", "pattern": UNIT_BUSINESS_PATTERN}, "risk_score": {"type": "number", "minimum": 70, "maximum": 100}, "reason": {"type": "string", "minLength": 1, "maxLength": 512}, "expected_revision": {"type": "integer"}}}},),
308
+ (_WORKER_ONLY, {"name": "bugx_supervisor_claim", "description": "为一个 Worker 领取独立覆盖单元/亲和任务包、资源租约和专属 artifact_root。提交后可用 continue_worker=true 由同一身份继续领取未完成单元,也可在同一 Round 接手 expired/released worker。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "lease_seconds": {"type": "number", "exclusiveMinimum": 0, "maximum": LEASE_SECONDS_MAX}, "unit_ids": {"type": "array", "minItems": 1, "maxItems": 1, "items": {"type": "string"}}, "allow_bundle": {"type": "boolean", "default": False}, "continue_worker": {"type": "boolean", "default": False}, "process_pid": {"type": "integer", "minimum": 1, "description": "真实 Worker/执行进程 PID;不能填 Supervisor、MCP 服务或时间戳等占位 PID,否则会被僵尸检测回收。"}, "resource_keys": string_array, "supersede_worker_id": {"type": "string", "minLength": 1}, "recover_expired": {"type": "boolean", "default": False, "description": "PE-20261005-003:同名单 worker 已终态(expired/released)时一键接手——继承 unit_ids/artifact_root 重新计时,返回 recovered_from;宿主随后走 worker_start(无 PID)+ checkpoint 代交成品。"}, "expected_revision": {"type": "integer"}, "worker_role": {"type": "string"}, "preferred_affinity": {"type": "string"}}}},),
309
+ (_WORKER_ONLY, {"name": "bugx_supervisor_worker_start", "description": "确认 Worker 已由宿主真实启动;只有确认后才计入并发重叠。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "provider": {"type": "string", "minLength": 1, "maxLength": 128}, "execution_id": {"type": "string"}, "process_pid": {"type": "integer", "minimum": 1, "description": "真实且当前存活的 Worker/执行进程 PID;不要传 MCP 服务进程或虚构 PID。"}, "expected_revision": {"type": "integer"}}}},),
310
+ (_WORKER_ONLY, {"name": "bugx_supervisor_tool_call", "description": "记录 Worker 已执行的一次工具调用及成本;不会执行命令。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "cost_units": {"type": "number", "minimum": 0}, "tool_name": {"type": "string"}, "expected_revision": {"type": "integer"}}}},),
311
+ (_WORKER_ONLY, {"name": "bugx_supervisor_heartbeat", "description": "续租 Worker lease;不会执行工具或改变生命值。带 PID 的租约必须回显 claim 返回的 heartbeat_nonce。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "lease_seconds": {"type": "number", "exclusiveMinimum": 0, "maximum": LEASE_SECONDS_MAX}, "heartbeat_nonce": {"type": "string", "minLength": 1, "maxLength": 128}, "expected_revision": {"type": "integer"}}}},),
312
+ (_WORKER_ONLY, {"name": "bugx_supervisor_checkpoint", "description": "提交 Worker 的发现、覆盖、证据、错误签名和断点手记;支持同任务包内最多 5 个亲和单元批量提交。coverage/evidence/notes 的 key 必须逐字来自本次 claim 的 unit_ids,禁止 summary/finding/knowledge 等自由 key;coverage 使用 covered/unverified 等覆盖状态;evidence.status 必须使用 passed/failed/error/skipped/blocked,不能填 covered。life_delta 必须是数字 0。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id", "checkpoint_id"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "checkpoint_id": {"type": "string", "minLength": 1, "description": "同一有效载荷重试必须复用同一个 checkpoint_id"}, "findings": finding_schema, "coverage": {"type": "object", "maxProperties": 5, "additionalProperties": {"type": "string", "enum": ["pending", "covered", "blocked", "unverified", "partial", "not_applicable", "stale", "removed", "superseded", "corrupted"]}}, "evidence": evidence_schema, "signatures": {"type": "array", "maxItems": 10, "items": {"type": "string", "minLength": 1, "maxLength": 512}}, "notes": {"type": "object", "maxProperties": 5, "description": "仅可写当前 claim 的精确 unit_id -> 单元断点手记;禁止 summary/finding/knowledge 等自由 key。", "additionalProperties": {"type": "string", "minLength": 1, "maxLength": 2000}}, "life_delta": {"type": "number", "const": 0, "default": 0, "description": "必须为 JSON 数字 0,不能写成字符串。"}, "expected_revision": {"type": "integer"}}}},),
313
+ (_HOST_ONLY, {"name": "bugx_supervisor_salvage_checkpoint", "description": "DOC-203 D2:宿主代交 state=expired 的 worker claim 已固化 checkpoint(PE-20261005-003 恢复闭环的落账通道)。与 worker 通道同强度校验:五元组绑定(worker_id/run_id/round_no/lease_id/target_fingerprint)+ 工件盘上 sha256 重算 + 工件 mtime 不早于本 claim 领取时刻 + findings 不得携带 confirmation 块 + 每 claim 一次性(salvaged_at)。熔断(worker_attempts_exhausted)不放宽:salvage 只落账已完成证据,不产生新 claim。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id", "checkpoint_id"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "worker_id": {"type": "string"}, "checkpoint_id": {"type": "string", "minLength": 1}, "findings": finding_schema, "coverage": {"type": "object", "maxProperties": 5, "additionalProperties": {"type": "string", "enum": ["pending", "covered", "blocked", "unverified", "partial", "not_applicable", "stale", "removed", "superseded", "corrupted"]}}, "evidence": evidence_schema, "signatures": {"type": "array", "maxItems": 10, "items": {"type": "string", "minLength": 1, "maxLength": 512}}, "notes": {"type": "object", "maxProperties": 5, "additionalProperties": {"type": "string", "minLength": 1, "maxLength": 2000}}, "life_delta": {"type": "number", "const": 0, "default": 0}, "expected_revision": {"type": "integer"}}}},),
314
+ (_WORKER_ONLY, {"name": "bugx_supervisor_begin_long_call", "description": "DOC-203 D3:为一次不可分的长工具调用(如 10-20 分钟探针)声明保活窗口。租约推进到 max(当前值, min(now+expected_seconds+60, total_lease_deadline))——绝不缩短现有租约;窗口内不回收,窗口结束照常回收(活性语义保留)。每 claim 最多 5 次;调用同时刷新心跳活性。", "inputSchema": {"type": "object", "required": ["caller_role", "worker_id", "expected_seconds"], "properties": {"caller_role": {"type": "string", "enum": ["worker"]}, "worker_id": {"type": "string"}, "expected_seconds": {"type": "number", "exclusiveMinimum": 0, "maximum": 1800}, "expected_revision": {"type": "integer"}}}},),
315
+ (_WORKER_ONLY, {
316
+ "name": "bugx_supervisor_run_sandboxed_probe",
317
+ "description": "按已启动 claim 的 lease_id/execution_id 以 shell=False 执行单条 argv,自动保存输出并返回 evidence(含 SHA-256 和 execution_receipt),可原样用于 checkpoint;不自动判定覆盖。这是有界执行,不是文件系统隔离沙箱。",
318
+ "inputSchema": {
319
+ "type": "object",
320
+ "required": ["caller_role", "worker_id", "lease_id", "execution_id", "command"],
321
+ "properties": {
322
+ "caller_role": {"type": "string", "enum": ["worker"]},
323
+ "worker_id": {"type": "string"},
324
+ "lease_id": {"type": "string", "minLength": 1},
325
+ "execution_id": {"type": "string", "minLength": 1},
326
+ "command": {
327
+ "description": "argv 参数数组;不启 shell。每次只执行一条命令,由 MCP 捕获 stdout/stderr。",
328
+ "type": "array",
329
+ "minItems": 1,
330
+ "maxItems": 64,
331
+ "items": {"type": "string", "minLength": 1, "maxLength": 4096},
332
+ },
333
+ "timeout_seconds": {"type": "number", "minimum": 0.5, "maximum": 60.0, "default": 10.0},
334
+ "env": {"type": "object"},
335
+ "expected_revision": {"type": "integer"},
336
+ },
337
+ },
338
+ }),
339
+ (_WORKER_ONLY, {
340
+ "name": "bugx_supervisor_submit_finding",
341
+ "description": "强类型提交漏洞发现与双向差分证据对;强校验 Epoch 租约代数与反事实双向证据。",
342
+ "inputSchema": {
343
+ "type": "object",
344
+ "required": ["caller_role", "worker_id", "finding", "differential_evidence"],
345
+ "properties": {
346
+ "caller_role": {"type": "string", "enum": ["worker"]},
347
+ "worker_id": {"type": "string"},
348
+ "epoch": {"type": "integer", "minimum": 1},
349
+ "finding": {
350
+ "type": "object",
351
+ "required": ["fingerprint", "title", "severity", "root_cause"],
352
+ "properties": {
353
+ "fingerprint": {"type": "string", "minLength": 1, "maxLength": 256},
354
+ "id": {"type": "string"},
355
+ "title": {"type": "string", "minLength": 1},
356
+ "severity": {"type": "string", "enum": list(_FINDING_SEVERITY_LEVELS)},
357
+ "cwe": {"type": "string"},
358
+ "cvss": {"type": "number", "minimum": 0, "maximum": 10},
359
+ "root_cause": {"type": "string", "minLength": 1},
360
+ "remediation": {"type": "string"},
361
+ },
362
+ "additionalProperties": True,
363
+ },
364
+ "differential_evidence": {
365
+ "type": "object",
366
+ "required": ["baseline_payload", "baseline_response", "exploit_payload", "exploit_response"],
367
+ "properties": {
368
+ "baseline_payload": {"type": "string"},
369
+ "baseline_response": {"type": "string"},
370
+ "exploit_payload": {"type": "string"},
371
+ "exploit_response": {"type": "string"},
372
+ "assertion_differential": {"type": "string"},
373
+ },
374
+ "additionalProperties": True,
375
+ },
376
+ "expected_revision": {"type": "integer"},
377
+ },
378
+ },
379
+ }),
380
+ (_HOST_ONLY, {"name": "bugx_supervisor_next_round", "description": "在所有 Worker 提交且并发门禁满足后推进下一 Round。gate_failure_mode=report 时门禁未满足返回结构化 GATE_UNSATISFIED(只读、无副作用),供自治宿主程序化决策;缺省使用 report,交互宿主可显式选择 prompt_user。", "inputSchema": {"type": "object", "required": ["caller_role"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "expected_revision": {"type": "integer"}, "gate_failure_mode": {"type": "string", "enum": ["prompt_user", "report"], "default": "report"}}}},),
381
+ (_HOST_ONLY, {"name": "bugx_supervisor_bind_context", "description": "由宿主把控制面绑定到下一 Life 的 Project/Session/Round/plan(不创建新 Round)。", "inputSchema": {"type": "object", "required": ["caller_role"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "project_id": {"type": "string"}, "session_id": {"type": "string"}, "round_id": {"type": "string"}, "life_id": {"type": "string"}, "plan_hash": {"type": "string"}}}},),
382
+ (_HOST_ONLY, {"name": "bugx_supervisor_finish", "description": "由宿主在覆盖、证据和并发门禁完成后结束 Supervisor run。", "inputSchema": {"type": "object", "required": ["caller_role"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "coverage_complete": {"type": ["boolean", "null"]}, "expected_revision": {"type": "integer"}}}},),
383
+ (_HOST_ONLY, {"name": "bugx_supervisor_fail", "description": "由宿主记录不可恢复的 Supervisor 失败并释放租约。", "inputSchema": {"type": "object", "required": ["caller_role", "reason"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "reason": {"type": "string"}, "expected_revision": {"type": "integer"}}}},),
384
+ (_HOST_ONLY, {"name": "bugx_supervisor_recover", "description": "由宿主从主状态或合法备份恢复并返回当前状态;可显式隔离历史 worker 尝试计数,损坏时明确失败。", "inputSchema": {"type": "object", "required": ["caller_role"], "properties": {"caller_role": {"type": "string", "enum": ["host"]}, "reset_worker_attempts": {"type": "boolean", "default": False, "description": "将 expired/released/submitted 历史 claim fence 到旧代际,解除全 Run 尝试硬顶"}}}},),
385
+ (_HOST_ONLY, {
386
+ "name": "graph_start",
387
+ "description": "建立私有项目快照和确定性 Recon→Repro→Review→(Patch)→Check→Report 图;由 Host 自行启动原生 Agent。",
388
+ "inputSchema": {
389
+ "type": "object",
390
+ "required": [
391
+ "caller_role", "target", "goal", "modifications", "invariants",
392
+ "ownership_boundaries", "acceptance_criteria", "target_files",
393
+ ],
394
+ "properties": {
395
+ "caller_role": {"type": "string", "enum": ["host"]},
396
+ "target": {"type": "string", "minLength": 1, "maxLength": 2048},
397
+ "goal": {"type": "string", "minLength": 1, "maxLength": 8192},
398
+ "modifications": {"type": "array", "minItems": 1, "maxItems": 64,
399
+ "items": {"type": "string", "minLength": 1, "maxLength": 8192}},
400
+ "invariants": {"type": "array", "minItems": 1, "maxItems": 64,
401
+ "items": {"type": "string", "minLength": 1, "maxLength": 8192}},
402
+ "ownership_boundaries": {"type": "array", "minItems": 1, "maxItems": 64,
403
+ "items": {"type": "string", "minLength": 1, "maxLength": 8192}},
404
+ "acceptance_criteria": {"type": "array", "minItems": 1, "maxItems": 64,
405
+ "items": {"type": "string", "minLength": 1, "maxLength": 8192}},
406
+ "target_files": {"type": "array", "minItems": 1, "maxItems": 100,
407
+ "items": {"type": "string", "minLength": 1, "maxLength": 512}},
408
+ "include_patch": {"type": "boolean", "default": False},
409
+ "max_concurrency": {"type": "integer", "minimum": 1, "maximum": 16, "default": 1},
410
+ },
411
+ },
412
+ }),
413
+ (_HOST_ONLY, {
414
+ "name": "graph_next",
415
+ "description": "返回依赖就绪且容量允许的下一 GraphTask,并保留该任务直至 Host 绑定 Agent。",
416
+ "inputSchema": {"type": "object", "required": ["caller_role", "graph_id"], "properties": {
417
+ "caller_role": {"type": "string", "enum": ["host"]},
418
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
419
+ }},
420
+ }),
421
+ (_HOST_ONLY, {
422
+ "name": "graph_bind_agent",
423
+ "description": "登记 Host 已启动的原生子 Agent 身份;Review 身份必须不同于 Recon/Repro 生产者。",
424
+ "inputSchema": {"type": "object", "required": [
425
+ "caller_role", "graph_id", "task_id", "native_agent_id",
426
+ ], "properties": {
427
+ "caller_role": {"type": "string", "enum": ["host"]},
428
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
429
+ "task_id": {"type": "string", "minLength": 1},
430
+ "native_agent_id": {"type": "string", "minLength": 1, "maxLength": 256},
431
+ }},
432
+ }),
433
+ (_HOST_ONLY, {
434
+ "name": "graph_cancel",
435
+ "description": "Fence 图中未终结任务并回收私有快照;不声称能从引擎直接停止宿主原生 Agent。",
436
+ "inputSchema": {"type": "object", "required": [
437
+ "caller_role", "graph_id", "reason",
438
+ ], "properties": {
439
+ "caller_role": {"type": "string", "enum": ["host"]},
440
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
441
+ "task_id": {"type": "string"},
442
+ "reason": {"type": "string", "minLength": 1, "maxLength": 2048},
443
+ }},
444
+ }),
445
+ (_HOST_ONLY, {
446
+ "name": "graph_finalize",
447
+ "description": "Host 对终态图收尾裁决并固化不可覆盖的最终报告账本。",
448
+ "inputSchema": {"type": "object", "required": [
449
+ "caller_role", "graph_id", "decision", "summary",
450
+ ], "properties": {
451
+ "caller_role": {"type": "string", "enum": ["host"]},
452
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
453
+ "decision": {"type": "string", "enum": ["accepted", "rejected", "inconclusive"]},
454
+ "summary": {"type": "string", "minLength": 1, "maxLength": 8192},
455
+ }},
456
+ }),
457
+ (_WORKER_ONLY, {
458
+ "name": "graph_context",
459
+ "description": "Worker 依绑定 Task 读取声明的快照文件和父工件;必须匹配 Host 注入的 BUGX_NATIVE_AGENT_ID 与 fencing token。",
460
+ "inputSchema": {"type": "object", "required": [
461
+ "caller_role", "graph_id", "task_id", "native_agent_id", "fencing_token",
462
+ ], "properties": {
463
+ "caller_role": {"type": "string", "enum": ["worker"]},
464
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
465
+ "task_id": {"type": "string", "minLength": 1},
466
+ "native_agent_id": {"type": "string", "minLength": 1, "maxLength": 256},
467
+ "fencing_token": {"type": "integer", "minimum": 1},
468
+ }},
469
+ }),
470
+ (_WORKER_ONLY, {
471
+ "name": "graph_run_check",
472
+ "description": "Worker 提交受限 CheckPlan;引擎只运行 tests/ 下的 test_*.py unittest 并返回 Observation。",
473
+ "inputSchema": {"type": "object", "required": [
474
+ "caller_role", "graph_id", "task_id", "native_agent_id", "fencing_token", "plan",
475
+ ], "properties": {
476
+ "caller_role": {"type": "string", "enum": ["worker"]},
477
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
478
+ "task_id": {"type": "string", "minLength": 1},
479
+ "native_agent_id": {"type": "string", "minLength": 1, "maxLength": 256},
480
+ "fencing_token": {"type": "integer", "minimum": 1},
481
+ "plan": {"type": "object", "required": ["test_files"], "additionalProperties": False,
482
+ "properties": {
483
+ "test_files": {"type": "array", "minItems": 1, "maxItems": 20,
484
+ "items": {"type": "string", "minLength": 1, "maxLength": 512}},
485
+ "timeout_seconds": {"type": "integer", "minimum": 1, "maximum": 300, "default": 60},
486
+ "plan_id": {"type": "string", "maxLength": 128},
487
+ }},
488
+ }},
489
+ }),
490
+ (_WORKER_ONLY, {
491
+ "name": "graph_checkpoint",
492
+ "description": "Worker 提交 bounded artifact envelope 与 SHA-256 内容寻址附件;每阶段最多 3 次 attempt。",
493
+ "inputSchema": {"type": "object", "required": [
494
+ "caller_role", "graph_id", "task_id", "native_agent_id", "fencing_token", "envelope",
495
+ ], "properties": {
496
+ "caller_role": {"type": "string", "enum": ["worker"]},
497
+ "graph_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
498
+ "task_id": {"type": "string", "minLength": 1},
499
+ "native_agent_id": {"type": "string", "minLength": 1, "maxLength": 256},
500
+ "fencing_token": {"type": "integer", "minimum": 1},
501
+ "envelope": {"type": "object", "required": ["outcome", "summary"],
502
+ "properties": {
503
+ "outcome": {"type": "string", "enum": ["complete", "needs_revision", "failed"]},
504
+ "summary": {"type": "string", "minLength": 1, "maxLength": 8192},
505
+ "reason": {"type": "string", "maxLength": 8192},
506
+ "context": {"type": "object", "maxProperties": 5000},
507
+ "retry_stage": {"type": "string", "enum": ["Recon", "Repro"]},
508
+ "result": {"type": "object"},
509
+ }},
510
+ "attachments": {"type": "array", "maxItems": 50, "items": {
511
+ "type": "object", "required": ["filename", "sha256", "content_base64"],
512
+ "properties": {
513
+ "filename": {"type": "string", "minLength": 1, "maxLength": 512},
514
+ "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
515
+ "content_base64": {"type": "string"},
516
+ },
517
+ }},
518
+ }},
519
+ }),
520
+ (_SHARED_ROLES, {"name": "bugx_knowledge_route", "description": "按项目分类、阶段和错误签名自动判断是否需要检索;高风险时复用有界错题/incident 检索,低风险不检索,不注入历史正文。", "inputSchema": {"type": "object", "properties": {"trigger": {"type": "string", "enum": ["preflight", "strategy", "finding", "failure"], "default": "preflight"}, "query": {"type": "string", "maxLength": 512}, "category": {"type": "string", "maxLength": 96}, "signatures": {"type": "array", "maxItems": 10, "items": {"type": "string", "minLength": 1, "maxLength": 512}}, "context": {"type": "object", "maxProperties": 12}}}},),
521
+ (_SHARED_ROLES, {"name": "bugx_harness_status", "description": "读取当前项目会话的共享验证 harness 注册表;只读,不安装依赖、不执行命令。", "inputSchema": {"type": "object", "properties": {}}},),
522
+ (_SHARED_ROLES, {"name": "bugx_oracle_suggest", "description": "按单元/分类读取或提取有界 repository-contract Oracle 候选;结果仅供参考,不能直接确认 Finding。", "inputSchema": {"type": "object", "properties": {"unit": {"type": "string", "maxLength": 512}, "query": {"type": "string", "maxLength": 512}, "limit": {"type": "integer", "minimum": 1, "maximum": 5, "default": 5}}}},),
523
+ (_SHARED_ROLES, {"name": "bugx_lesson_retrieve", "description": "按当前分类/查询按需检索最多 3 张错题经验卡(只读,600 token 上限);只用于快速碰撞,不是提示词注入。", "inputSchema": {"type": "object", "properties": {"query": {"type": "string"}, "category": {"type": "string"}, "limit": {"type": "integer", "minimum": 1, "maximum": 3}, "token_budget": {"type": "integer", "minimum": 100, "maximum": 600}}}},),
524
+ (_SHARED_ROLES, {"name": "bugx_tool_matrix", "description": "读取实测「问题类别 → 工具」命中矩阵,校正场景选型(只读)。", "inputSchema": {"type": "object", "properties": {}}},),
525
+ (_SHARED_ROLES, {"name": "bugx_incident_hints", "description": "有真实错误签名时按需检索最多 2 个 incident 做快速碰撞(只读、有界,不注入完整卡片)。", "inputSchema": {"type": "object", "properties": {"signatures": string_array, "limit": {"type": "integer", "minimum": 1, "maximum": 2}}}},),
526
+ (_SHARED_ROLES, {"name": "bugx_request_token_renewal", "description": "针对复杂长 PoC 或深度调用链申请动态 Token 续期(单次 +400 Tokens,单生命周期最多 2 次,上限 2400 Tokens)。", "inputSchema": {"type": "object", "required": ["reason"], "properties": {"reason": {"type": "string", "maxLength": 128}, "needed": {"type": "integer", "minimum": 100, "maximum": 800, "default": 400}}}},),
527
+ (_SHARED_ROLES, {"name": "bugx_efficiency_card", "description": "读取最近几轮的效率/校准卡片(time/credited、注入卡片利用率;只读)。", "inputSchema": {"type": "object", "properties": {}}},),
528
+ (_SHARED_ROLES, {
529
+ "name": "bugx_get_stage_harness",
530
+ "description": "获取 BugX 2.0 阶段专精系统提示词与规则切片(按阶段按需获取,支持 gate/explore/mutate/repair/l0 及规则切片)。",
531
+ "inputSchema": {
532
+ "type": "object",
533
+ "required": ["stage"],
534
+ "properties": {
535
+ "stage": {
536
+ "type": "string",
537
+ "description": "阶段标识符:gate / explore / mutate / repair / l0",
538
+ "enum": ["gate", "explore", "mutate", "repair", "l0"],
539
+ },
540
+ "unit_id": {
541
+ "type": "string",
542
+ "description": "可选:当前认领的覆盖单元 ID,用于自动提取匹配的 L2 规则片段",
543
+ },
544
+ "rule": {
545
+ "type": "string",
546
+ "description": "可选:按需加载的 L2 专项规则库 (concurrency / memory_leak / prompt_injection / anti_patterns)",
547
+ "enum": ["concurrency", "memory_leak", "prompt_injection", "anti_patterns"],
548
+ },
549
+ "context": {
550
+ "type": "object",
551
+ "description": "可选:动态注入的上下文事实键值对",
552
+ },
553
+ "source_code": {
554
+ "type": "string",
555
+ "description": "可选:单元源码片段,供 AST 静态推断更精准的 L2 专项规则切片",
556
+ },
557
+ },
558
+ },
559
+ }),
560
+ (_SHARED_ROLES, {
561
+ "name": "bugx_distill_evidence",
562
+ "description": "结构化长堆栈与 Fuzz 输出证据蒸馏器;抽取关键异常、行号定位与断言差异至 ≤15 行,支持文本或 JSON 格式(只读)。",
563
+ "inputSchema": {
564
+ "type": "object",
565
+ "required": ["raw_output"],
566
+ "properties": {
567
+ "raw_output": {
568
+ "type": "string",
569
+ "description": "待蒸馏的原始终端输出、Traceback 或 Fuzz 日志",
570
+ },
571
+ "max_lines": {
572
+ "type": "integer",
573
+ "minimum": 1,
574
+ "maximum": 50,
575
+ "default": 15,
576
+ "description": "最大输出行数,默认 15",
577
+ },
578
+ "format": {
579
+ "type": "string",
580
+ "enum": ["text", "json"],
581
+ "default": "text",
582
+ "description": "输出格式:text(纯文本提要)或 json(结构化字典)",
583
+ },
584
+ },
585
+ },
586
+ }),
587
+ (_SHARED_ROLES, {
588
+ "name": "bugx_inspect_source",
589
+ "description": "安全提取源文件切片与代码视窗(具备越界自愈、UTF-8 容错、沙箱防逃逸与透明符号自愈切片路由)。",
590
+ "inputSchema": {
591
+ "type": "object",
592
+ "required": ["path"],
593
+ "properties": {
594
+ "path": {"type": "string", "description": "目标文件相对或绝对路径"},
595
+ "symbol": {"type": "string", "description": "可选符号名,指定时自动路由至高密度语法自愈切片"},
596
+ "method": {"type": "string", "description": "可选方法名别名"},
597
+ "kind": {"type": "string", "description": "可选种类过滤 (function/method/class)"},
598
+ "start_line": {"type": "integer", "minimum": 1, "default": 1, "description": "起始行号(1-based)"},
599
+ "end_line": {"type": "integer", "minimum": 1, "default": 200, "description": "结束行号(1-based)"},
600
+ "numbered": {"type": "boolean", "default": True, "description": "是否返回带行号的文本"},
601
+ "max_lines": {"type": "integer", "minimum": 1, "maximum": 1000, "default": 500, "description": "单次最大行数上限"},
602
+ },
603
+ },
604
+ }),
605
+ (_SHARED_ROLES, {
606
+ "name": "bugx_scheduling_telemetry",
607
+ "description": "读取当前 Supervisor 调度遥测指标与并发利用率看板(AIMD 容量、排队/执行时延、抢占与活跃 Worker)。",
608
+ "inputSchema": {"type": "object", "properties": {}},
609
+ }),
610
+ (_SHARED_ROLES, {
611
+ "name": "bugx_global_telemetry",
612
+ "description": "查询跨项目的全局时间与 Token 计量治理看板、项目 ROI 排行及每日消耗趋势(DOC-049)。",
613
+ "inputSchema": {
614
+ "type": "object",
615
+ "properties": {
616
+ "days": {
617
+ "type": "integer",
618
+ "minimum": 1,
619
+ "maximum": 365,
620
+ "default": 30,
621
+ "description": "统计时间窗口天数(默认 30 天)",
622
+ },
623
+ "project_filter": {
624
+ "type": "string",
625
+ "description": "可选项目名称过滤关键词",
626
+ },
627
+ },
628
+ },
629
+ }),
630
+ (_SHARED_ROLES, {
631
+ "name": "bugx_retrieval_metrics",
632
+ "description": "查询与记录混合检索与结构化切片管线的 P50/P99 时延与 Token 密度遥测指标(DOC-234)。",
633
+ "inputSchema": {
634
+ "type": "object",
635
+ "properties": {
636
+ "operation": {
637
+ "type": "string",
638
+ "description": "可选待上报检索原语名称:rrf, slice, memory, ego",
639
+ },
640
+ "duration_ms": {
641
+ "type": "number",
642
+ "description": "执行耗时(毫秒)",
643
+ },
644
+ "tokens": {
645
+ "type": "number",
646
+ "description": "上下文估算 Token 数",
647
+ },
648
+ "output_bytes": {
649
+ "type": "number",
650
+ "description": "产物字节数",
651
+ },
652
+ "samples": {
653
+ "type": "array",
654
+ "description": "批量上报样本数组",
655
+ "items": {"type": "object"},
656
+ },
657
+ },
658
+ },
659
+ }),
660
+ (_WORKER_ONLY, {
661
+ "name": "bugx_fuzz_concurrency",
662
+ "description": "并发竞态与时序死锁专项扰动工具:注入微秒级上下文切换抖动并检测数据竞态或死锁。",
663
+ "inputSchema": {
664
+ "type": "object",
665
+ "required": ["target_cmd"],
666
+ "properties": {
667
+ "target_cmd": {
668
+ "type": "array",
669
+ "items": {"type": "string"},
670
+ "minItems": 1,
671
+ "description": "要并发压测的命令 argv 数组(如 [\"python3\",\"-m\",\"unittest\",\"tests/test_x.py\"]);不接受字符串命令",
672
+ },
673
+ "threads": {"type": "integer", "minimum": 1, "maximum": 32, "default": 8},
674
+ "iterations": {"type": "integer", "minimum": 1, "maximum": 200, "default": 30},
675
+ "timeout": {"type": "number", "minimum": 0.5, "maximum": 30.0, "default": 2.0},
676
+ },
677
+ },
678
+ }),
679
+ (_WORKER_ONLY, {
680
+ "name": "bugx_fuzz_stateful",
681
+ "description": "状态机反常序突变推演工具:自动生成跳步、重入、撤销后执行变异调用序列,用于挖掘业务逻辑漏洞。",
682
+ "inputSchema": {
683
+ "type": "object",
684
+ "required": ["transitions"],
685
+ "properties": {
686
+ "transitions": {
687
+ "type": "array",
688
+ "items": {
689
+ "type": "object",
690
+ "required": ["action", "from_state", "to_state"],
691
+ "properties": {
692
+ "action": {"type": "string"},
693
+ "from_state": {"type": "string"},
694
+ "to_state": {"type": "string"},
695
+ "requires_auth": {"type": "boolean"},
696
+ },
697
+ },
698
+ },
699
+ "max_length": {"type": "integer", "minimum": 2, "maximum": 6, "default": 4},
700
+ "max_sequences": {"type": "integer", "minimum": 1, "maximum": 50, "default": 20},
701
+ },
702
+ },
703
+ }),
704
+ (_WORKER_ONLY, {
705
+ "name": "bugx_verify_differential_poc",
706
+ "description": "确定性沙盒双跑差分验证器:在两个独立临时沙盒中双跑 PoC 并清洗地址/临时目录噪音,裁决 CONFIRMED_DETERMINISTIC / FLAKY_JITTER / FALSE_POSITIVE。",
707
+ "inputSchema": {
708
+ "type": "object",
709
+ "required": ["command_template", "poc_input"],
710
+ "properties": {
711
+ "command_template": {"type": "string", "description": "命令模板(含 {input} 占位符)"},
712
+ "poc_input": {
713
+ "description": "PoC 输入数据内容、项目内文件路径,或 JSON 对象/数组;结构化值按 JSON 文件传给命令",
714
+ "anyOf": [
715
+ {"type": "string", "minLength": 1},
716
+ {"type": "object"},
717
+ {"type": "array"},
718
+ ],
719
+ },
720
+ "timeout": {"type": "number", "minimum": 1.0, "maximum": 30.0, "default": 10.0},
721
+ },
722
+ },
723
+ }),
724
+ (_WORKER_ONLY, {
725
+ "name": "bugx_ingest_coverage",
726
+ "description": "真实测试覆盖率报告回填工具:解析测试套件生成的 lcov/cobertura/coveragepy 报告,自动将对应物理单元与端点标记为已覆盖。",
727
+ "inputSchema": {
728
+ "type": "object",
729
+ "required": ["report_path"],
730
+ "properties": {
731
+ "report_path": {"type": "string", "description": "测试覆盖报告文件相对或绝对路径"},
732
+ "format_hint": {"type": "string", "enum": ["lcov", "jacoco", "coveragepy", "generic"], "description": "可选指定格式"},
733
+ },
734
+ },
735
+ }),
736
+ (_WORKER_ONLY, {
737
+ "name": "bugx_inspect_mobile_ui",
738
+ "description": "移动端 UI 几何与无障碍 Oracle 质检工具:执行 Overlap、Clipping、Touch Target、Safe Area 等机械判定并产出 Failure Pack。",
739
+ "inputSchema": {
740
+ "type": "object",
741
+ "required": ["dump_path_or_content"],
742
+ "properties": {
743
+ "dump_path_or_content": {"type": "string", "description": "UI 视图树 XML 或 WDA JSON 路径/文本内容"},
744
+ "is_ios": {"type": "boolean", "default": False},
745
+ "density": {"type": "number", "default": 1.0},
746
+ },
747
+ },
748
+ }),
749
+ (_WORKER_ONLY, {
750
+ "name": "bugx_fuzz_input",
751
+ "description": "目标程序变异模糊测试工具:对 CLI、解析器、端点注入变异输入序列,并检测崩溃、挂起与异常签名。",
752
+ "inputSchema": {
753
+ "type": "object",
754
+ "required": ["cmd"],
755
+ "properties": {
756
+ "cmd": {"type": "string", "description": "目标执行命令(可含 {input} 占位符或作为 stdin 输入源)"},
757
+ "input_content": {"type": "string", "description": "初始变异种子内容(纯文本,不再被当作文件路径)"},
758
+ "input_path": {"type": "string", "description": "项目内的种子文件相对路径(必须位于项目根目录内,不含符号链接);与 input_content 互斥"},
759
+ "iterations": {"type": "integer", "minimum": 1, "maximum": 200, "default": 30},
760
+ "timeout": {"type": "number", "minimum": 0.1, "maximum": 30.0, "default": 2.0},
761
+ "language": {"type": "string", "enum": ["python", "go", "java", "generic"], "description": "语言异常规则调度"},
762
+ "seed": {"type": "integer", "description": "随机数种子(用于确定性重放)"},
763
+ },
764
+ },
765
+ }),
766
+ (_WORKER_ONLY, {
767
+ "name": "bugx_minimize_repro",
768
+ "description": "PoC 失败样本分层 delta-debugging 最小化工具:对崩溃触发样本做行级/语法/字节块切除,提取最小复现证据。",
769
+ "inputSchema": {
770
+ "type": "object",
771
+ "required": ["cmd"],
772
+ "properties": {
773
+ "cmd": {"type": "string", "description": "复现验证命令(含 {input} 占位符)"},
774
+ "input_data": {"type": "string", "description": "待切除最小化的崩溃输入文本(纯内容,不再被当作文件路径)"},
775
+ "input_path": {"type": "string", "description": "项目内的样本文件相对路径(必须位于项目根目录内,不含符号链接);与 input_data 二选一"},
776
+ "timeout": {"type": "number", "minimum": 0.5, "maximum": 30.0, "default": 5.0},
777
+ "hierarchical": {"type": "boolean", "default": True, "description": "是否开启行级优先两阶段分层切除"},
778
+ },
779
+ },
780
+ }),
781
+ (_WORKER_ONLY, {
782
+ "name": "bugx_query_behavior_graph",
783
+ "description": "行为图谱与逻辑异常推断工具:查询系统调用拓扑并自动推断无鉴权暴露端点、孤儿死事件与跨模块配置分歧。",
784
+ "inputSchema": {
785
+ "type": "object",
786
+ "properties": {
787
+ "file_filter": {"type": "string", "description": "按文件相对路径过滤图谱节点"},
788
+ "include_anomalies": {"type": "boolean", "default": True, "description": "是否同时执行行为异常拓扑推断"},
789
+ },
790
+ },
791
+ }),
792
+ (_WORKER_ONLY, {
793
+ "name": "bugx_audit_web_conformance",
794
+ "description": "Web 标准合规与契约质检工具:静态扫描项目前端与 API,检测 HTTP 动词安全、CORS/CSP 头、IDOR 边界与分页参数合规。",
795
+ "inputSchema": {
796
+ "type": "object",
797
+ "properties": {
798
+ "files": {"type": "array", "items": {"type": "string"}, "description": "指定扫描的目标文件相对路径列表"},
799
+ },
800
+ },
801
+ }),
802
+ (_SHARED_ROLES, {
803
+ "name": "bugx_mining_explore",
804
+ "description": "全息可挖掘功能主体勘测工具:AST 扫描代码库,自动识别 HTTP 路由、CLI 分支、并发临界区、反序列化与状态流转,映射威胁模型与推荐 Oracle。",
805
+ "inputSchema": {
806
+ "type": "object",
807
+ "properties": {
808
+ "subpath": {"type": "string", "description": "相对项目根目录的子路径或目标文件过滤"},
809
+ "risk_level": {
810
+ "type": "string",
811
+ "enum": ["ALL", "CRITICAL", "HIGH", "MEDIUM", "LOW"],
812
+ "default": "ALL",
813
+ "description": "过滤指定风险等级的功能主体",
814
+ },
815
+ },
816
+ },
817
+ }),
818
+ (_SHARED_ROLES, {
819
+ "name": "bugx_mining_audit",
820
+ "description": "漏洞挖掘方案与用例四维量化审计工具:从准确性、完整性、有效性、全面性四维度 100 分制量化评估挖掘规划,输出等级、门禁结论与违规清单。DEGRADED 不等于通过:返回 status=blocked 时必须先取得用户决策,再显式传 allow_degraded=true 重审。",
821
+ "inputSchema": {
822
+ "type": "object",
823
+ "properties": {
824
+ "plan": {"type": "object", "description": "内存中待审计的挖掘方案 JSON 对象"},
825
+ "plan_file": {"type": "string", "description": "相对项目根目录的方案文件路径(如 .bugx/campaign.json)"},
826
+ "min_score": {"type": "number", "minimum": 0, "maximum": 100, "default": 80.0, "description": "及格线分数"},
827
+ "strict": {"type": "boolean", "default": False, "description": "是否开启严格阻断模式(有任何硬违规即判定失败)"},
828
+ "allow_degraded": {"type": "boolean", "default": False, "description": "是否显式接受降级(DEGRADED)方案;默认 false,此时降级方案判为 blocked"},
829
+ },
830
+ },
831
+ }),
832
+ (_HOST_ONLY, {
833
+ "name": "bugx_mining_harden",
834
+ "description": "挖掘方案自动加固与 Oracle 强化工具:自动注入代码库中遗漏的高危功能主体,补全 DAG 依赖并将弱断言升级为深度状态不变式。",
835
+ "inputSchema": {
836
+ "type": "object",
837
+ "properties": {
838
+ "plan": {"type": "object", "description": "内存中待加固的原始方案 JSON 对象"},
839
+ "plan_file": {"type": "string", "description": "相对项目根目录的输入方案文件路径"},
840
+ "output_file": {"type": "string", "description": "加固后方案另存为的项目相对路径(可选)"},
841
+ },
842
+ },
843
+ }),
844
+ (_WORKER_ONLY, {
845
+ "name": "bugx_test_verify",
846
+ "description": "测试用例杀伤力变异沙箱验证工具:在受控隔离沙箱中对目标代码注入 6 类 AST 语义变异,实测测试用例真实击杀率 (Mutation Score) 并评级。",
847
+ "inputSchema": {
848
+ "type": "object",
849
+ "required": ["target_path", "test_target"],
850
+ "properties": {
851
+ "target_path": {"type": "string", "description": "被测 Python 源码文件相对路径"},
852
+ "test_target": {"type": "string", "description": "测试命令(如 python3 -m unittest tests/test_calc.py)或测试文件路径"},
853
+ "max_mutants": {"type": "integer", "minimum": 1, "maximum": 50, "default": 20, "description": "最大变异体评估上限"},
854
+ "timeout_sec": {"type": "number", "minimum": 0.5, "maximum": 10.0, "default": 2.0, "description": "单个变异体看门狗超时(秒)"},
855
+ "operators": {
856
+ "type": "array",
857
+ "items": {"type": "string", "enum": ["ROR", "AOR", "LCR", "BCR", "EOR", "SVR"]},
858
+ "description": "启用的变异算子白名单过滤",
859
+ },
860
+ },
861
+ },
862
+ }),
863
+ (_SHARED_ROLES, {
864
+ "name": "bugx_test_mutate",
865
+ "description": "AST 语义变异体只读预览工具:针对目标 Python 文件生成可能的微观逻辑变异列表,供编写高杀伤力断言参考(不执行测试命令)。",
866
+ "inputSchema": {
867
+ "type": "object",
868
+ "required": ["target_path"],
869
+ "properties": {
870
+ "target_path": {"type": "string", "description": "目标 Python 源码文件相对路径"},
871
+ "max_mutants": {"type": "integer", "minimum": 1, "maximum": 100, "default": 30, "description": "最大生成变异体上限"},
872
+ "operators": {
873
+ "type": "array",
874
+ "items": {"type": "string", "enum": ["ROR", "AOR", "LCR", "BCR", "EOR", "SVR"]},
875
+ "description": "启用的变异算子白名单过滤",
876
+ },
877
+ },
878
+ },
879
+ }),
880
+ (_SHARED_ROLES, {
881
+ "name": "bugx_retrieve_slice",
882
+ "description": "结构化检索代码块切片(支持按语言、符号名、种类有界提取与语法自愈)。",
883
+ "inputSchema": {
884
+ "type": "object",
885
+ "required": ["target"],
886
+ "properties": {
887
+ "target": {"type": "string", "description": "目标源文件相对路径"},
888
+ "symbol": {"type": "string", "description": "可选符号名过滤(如函数或类名)"},
889
+ "kind": {"type": "string", "enum": ["function", "method", "class", "type", "module", "fragment"], "description": "可选切片种类过滤"},
890
+ "to_executable": {"type": "boolean", "default": False, "description": "是否对切片生成自愈后的可直接解析执行视图"},
891
+ "include_context": {"type": "boolean", "default": False, "description": "是否附带文件导入头与局部拓扑的阶梯渐进上下文"},
892
+ "max_slices": {"type": "integer", "minimum": 1, "maximum": 20, "default": 5, "description": "最大返回切片数"},
893
+ },
894
+ },
895
+ }),
896
+ (_SHARED_ROLES, {
897
+ "name": "bugx_extract_ego_subgraph",
898
+ "description": "提取指定中心节点的 k-hop 局部有界调用/依赖拓扑子图(防上下文爆炸)。",
899
+ "inputSchema": {
900
+ "type": "object",
901
+ "required": ["center_node"],
902
+ "properties": {
903
+ "center_node": {"type": "string", "description": "中心节点标识(如符号名或节点 ID)"},
904
+ "depth": {"type": "integer", "minimum": 1, "maximum": 2, "default": 1, "description": "跳数深度(1 或 2)"},
905
+ "direction": {"type": "string", "enum": ["both", "inbound", "outbound"], "default": "both", "description": "遍历方向"},
906
+ "graph": {"type": "object", "description": "可选自定义子图映射"},
907
+ },
908
+ },
909
+ }),
910
+ (_SHARED_ROLES, {
911
+ "name": "bugx_memory_query",
912
+ "description": "在隔离命名空间内执行确定性记忆检索与经验知识召回(FTS5 BM25 排序与敏感凭据物理隔离)。",
913
+ "inputSchema": {
914
+ "type": "object",
915
+ "required": ["namespace", "query"],
916
+ "properties": {
917
+ "namespace": {"type": "string", "description": "记忆命名空间(如 repo:default 或 framework:lessons)"},
918
+ "query": {"type": "string", "description": "检索文本"},
919
+ "top_k": {"type": "integer", "minimum": 1, "maximum": 20, "default": 5, "description": "最大召回条目数"},
920
+ "db_path": {"type": "string", "description": "可选指定数据库路径,默认使用会话内 SQLite"},
921
+ },
922
+ },
923
+ }),
924
+ )
925
+ # Keep the large checkpoint schema readable above while making the
926
+ # transport retry contract explicit in one place. The engine accepts an
927
+ # omitted id for direct legacy callers; MCP does not, because a lost
928
+ # response must be replayable without duplicating findings.
929
+ # DES-08:该补丁在**建表时一次性应用**,故 ``_TOOL_TABLE`` 已是终态。
930
+ # 旧实现把 definitions 建在函数内、每次调用都重新追加一次描述后缀。
931
+ for _roles, definition in table:
932
+ if definition["name"] == "bugx_supervisor_checkpoint":
933
+ schema = definition["inputSchema"]
934
+ required = list(schema.get("required", []))
935
+ if "checkpoint_id" not in required:
936
+ required.append("checkpoint_id")
937
+ schema["required"] = required
938
+ schema["properties"]["checkpoint_id"] = {
939
+ "type": "string", "minLength": 1, "maxLength": 128,
940
+ }
941
+ definition["description"] = (
942
+ str(definition["description"])
943
+ + " 重试必须复用同一 checkpoint_id。"
944
+ )
945
+ break
946
+ # F-RSI-20261110-048:角色专属工具的 caller_role 声明由 roles 派生
947
+ # 补齐(构建期自愈)。此前 11 个 worker/host 专属工具的 inputSchema
948
+ # 缺 caller_role 属性——schema 不告诉调用方该显式声明角色,与
949
+ # submit_finding 范式(required + enum)漂移。共享工具免声明
950
+ # (通道缺省回退即正确语义)。
951
+ for roles, definition in table:
952
+ schema = definition.get("inputSchema")
953
+ if not isinstance(schema, dict):
954
+ continue
955
+ props = schema.setdefault("properties", {})
956
+ if roles != _SHARED_ROLES and "caller_role" not in props:
957
+ props["caller_role"] = {"type": "string", "enum": sorted(roles)}
958
+ required = schema.setdefault("required", [])
959
+ if "caller_role" not in required:
960
+ required.insert(0, "caller_role")
961
+ return table
962
+
963
+
964
+ _TOOL_TABLE = _build_tool_table()
965
+ _TOOL_ROLES = {definition["name"]: roles for roles, definition in _TOOL_TABLE}
966
+
967
+ # 三个角色集合由单一真源派生(原先为三份手工维护的字面量)。
968
+ HOST_TOOLS = frozenset(d["name"] for roles, d in _TOOL_TABLE if roles == _HOST_ONLY)
969
+ WORKER_TOOLS = frozenset(d["name"] for roles, d in _TOOL_TABLE if roles == _WORKER_ONLY)
970
+ READ_ONLY_TOOLS = frozenset(d["name"] for roles, d in _TOOL_TABLE if roles == _SHARED_ROLES)
971
+
972
+
973
+ def _get_active_tool_table() -> Any:
974
+ mod = sys.modules.get("core.skills.bugx_mcp_server")
975
+ table = getattr(mod, "_TOOL_TABLE", None) if mod is not None else None
976
+ if table is not None:
977
+ return table
978
+ return _TOOL_TABLE
979
+
980
+
981
+ def _assert_tool_registry_consistent() -> None:
982
+ """DES-08 漂移守卫:定义表与 handler 分发表必须**逐名一致**。
983
+
984
+ 导入期 fail-closed 校验:任一侧新增/改名而未同步另一侧时模块直接拒绝加载,
985
+ 而不是静默提供一个「被宣告但无法分发」或「能分发但未被宣告」的工具。
986
+ """
987
+ table = _get_active_tool_table()
988
+ defined = frozenset(definition["name"] for _roles, definition in table)
989
+ handlers = frozenset(HANDLER_REGISTRY)
990
+ if defined != handlers:
991
+ missing = sorted(defined - handlers)
992
+ orphan = sorted(handlers - defined)
993
+ raise RuntimeError(
994
+ "MCP 工具元数据与 handler 注册表不一致:"
995
+ f"缺少 handler 的定义={missing};缺少定义的 handler={orphan}"
996
+ )
997
+
998
+
999
+ _assert_tool_registry_consistent()
1000
+
1001
+
1002
+ _WORKER_CORE_TOOL_NAMES = frozenset({
1003
+ "bugx_supervisor_claim",
1004
+ "bugx_supervisor_worker_start",
1005
+ "bugx_supervisor_heartbeat",
1006
+ "bugx_supervisor_begin_long_call",
1007
+ "bugx_inspect_source",
1008
+ "bugx_supervisor_run_sandboxed_probe",
1009
+ "bugx_test_verify",
1010
+ "bugx_supervisor_submit_finding",
1011
+ "bugx_supervisor_checkpoint",
1012
+ "bugx_supervisor_status",
1013
+ })
1014
+
1015
+
1016
+ def _tool_definitions(role: str | None = None) -> list[dict[str, object]]:
1017
+ """返回 MCP 工具定义列表,可按角色过滤。
1018
+
1019
+ DES-08:本函数渲染 ``_TOOL_TABLE``。
1020
+ DOC-241 A5:Worker 角色严格仅暴露 9 个核心原子工具(<= 10),
1021
+ 消除 32 个冗余工具对大模型 Context 的浪费与幻觉。
1022
+ """
1023
+ table = _get_active_tool_table()
1024
+ if role is None:
1025
+ return [definition for _roles, definition in table]
1026
+ if role == "worker":
1027
+ return [definition for roles, definition in table if definition["name"] in _WORKER_CORE_TOOL_NAMES]
1028
+ return [definition for roles, definition in table if role in roles]
1029
+
1030
+