bugx-cli 0.1.2 → 0.1.3

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 (84) hide show
  1. package/README.md +26 -29
  2. package/core/agent/agent_orchestrator.py +3 -0
  3. package/core/agent/agent_workspace.py +14 -2
  4. package/core/assets/twitter_promo_art.jpg +0 -0
  5. package/core/assets/twitter_promo_card.svg +166 -0
  6. package/core/assets/twitter_promo_clean.jpg +0 -0
  7. package/core/assets/twitter_terminal_real.png +0 -0
  8. package/core/bugx.md +2 -2
  9. package/core/bugx_paths.py +2 -2
  10. package/core/cli-help.txt +1 -1
  11. package/core/contracts/bugx-opencode.md +1 -1
  12. package/core/contracts/bugx-runtime-contract.md +1 -1
  13. package/core/contracts/bugx-worker.md +1 -1
  14. package/core/engine-integrity.json +82 -42
  15. package/core/host_acp/kimi.py +175 -0
  16. package/core/host_acp/minimax.py +28 -0
  17. package/core/host_runtime/host_registry.py +23 -3
  18. package/core/hosts/dsh.py +1 -1
  19. package/core/hosts/kimi.py +293 -0
  20. package/core/hosts/minimax.py +248 -0
  21. package/core/hosts/zcode.py +5 -0
  22. package/core/infra/build_info.py +30 -5
  23. package/core/launch_phases/startup_version_gate.py +2 -2
  24. package/core/launch_phases/supervisor_bridge.py +14 -23
  25. package/core/metadata.txt +2 -2
  26. package/core/runtime/scenario_eval.py +1 -1
  27. package/core/runtime/setup_ui_env.py +4 -7
  28. package/core/supervisor/cli.py +2 -2
  29. package/core/webui/mcp_inspector.py +6 -0
  30. package/core/webui/static/index.html +51 -3
  31. package/core/webui/static/manifest.webmanifest +1 -1
  32. package/core/webui/static/project-settings.js +18 -3
  33. package/core/webui/static/robots.txt +36 -0
  34. package/core/webui/static/sitemap.xml +15 -0
  35. package/docs/07_distribution/01_README_NPM.md +26 -29
  36. package/ecosystem/integrations/cline/skills/bugx/SKILL.md +1 -1
  37. package/ecosystem/integrations/dsh/agents/bugx.md +1 -1
  38. package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
  39. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  40. package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +1 -1
  41. package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
  42. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  43. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
  44. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  45. package/ecosystem/integrations/pi/skills/bugx/SKILL.md +1 -1
  46. package/ecosystem/integrations/qoder/connector-meta.json +9 -9
  47. package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
  48. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +2 -2
  49. package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
  50. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
  51. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
  52. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
  53. package/ecosystem/plugins/bugx/agents/bugx-worker.md +1 -1
  54. package/ecosystem/plugins/bugx/agents/bugx.md +1 -1
  55. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +3 -3
  56. package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
  57. package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
  58. package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
  59. package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
  60. package/interfaces/bin/bugx.js +2 -0
  61. package/interfaces/cli/bugx_cli/__init__.py +2 -2
  62. package/interfaces/cli/bugx_cli/cli.py +15 -0
  63. package/interfaces/cli/bugx_cli/commands/agent.py +192 -67
  64. package/interfaces/cli/bugx_cli/commands/doctor.py +18 -0
  65. package/interfaces/cli/bugx_cli/commands/lifecycle.py +54 -47
  66. package/interfaces/cli/bugx_cli/commands/plugin.py +6 -6
  67. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
  68. package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +348 -0
  69. package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +322 -0
  70. package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
  71. package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
  72. package/interfaces/cli/bugx_cli/commands/system.py +64 -4
  73. package/interfaces/cli/bugx_cli/common.py +96 -7
  74. package/interfaces/cli/bugx_cli/host_adapters.py +150 -4
  75. package/interfaces/cli/bugx_cli/hosts/registry.py +4 -2
  76. package/interfaces/cli/bugx_cli/hosts/template_engine.py +10 -9
  77. package/interfaces/cli/bugx_cli/infra/engine_installer.py +4 -4
  78. package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
  79. package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +2 -2
  80. package/package.json +37 -13
  81. package/pyproject.toml +36 -12
  82. package/scripts/sync-version.mjs +1 -1
  83. package/skills/README.md +25 -0
  84. package/skills/platform/bugx-user/SKILL.md +92 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.2",
4
- "description": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
3
+ "version": "0.1.3",
4
+ "description": "Autonomous code review and testing agent. Catches hidden deep bugs for developers, automates black-box, functional, and performance testing for QA, and ensures rock-solid software delivery.",
5
5
  "skills": "./skills/",
6
6
  "homepage": "https://bugx.dev",
7
7
  "author": {
@@ -17,8 +17,8 @@
17
17
  ],
18
18
  "interface": {
19
19
  "displayName": "BugX",
20
- "shortDescription": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
21
- "longDescription": "An autonomous agent dedicated to code review, vulnerability hunting, and automated bug fixing. Built for deep investigations, BugX steps in when you are wrapping up a feature, opening a pull request, or hunting down an elusive bug. It analyzes code logic, automatically writes test cases to uncover and reproduce hidden flaws, and delivers verified patches that resolve root causes. Always safeguarding your code quality and security.",
20
+ "shortDescription": "Autonomous code review and testing agent. Catches hidden deep bugs for developers, automates black-box, functional, and performance testing for QA, and ensures rock-solid software delivery.",
21
+ "longDescription": "BugX is an autonomous code review and testing agent designed to safeguard software delivery: it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; automates black-box, functional, and performance testing across complex edge cases for QA; and ensures software strictly meets functional requirements with rock-solid stability and resilience. By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people.",
22
22
  "developerName": "BugX",
23
23
  "category": "Developer tools",
24
24
  "capabilities": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.2",
4
- "description": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
3
+ "version": "0.1.3",
4
+ "description": "Autonomous code review and testing agent. Catches hidden deep bugs for developers, automates black-box, functional, and performance testing for QA, and ensures rock-solid software delivery.",
5
5
  "homepage": "https://bugx.dev",
6
6
  "author": {
7
7
  "name": "BugX",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx-worker
3
- description: A concurrent audit worker dispatched in parallel by the primary BugX agent to inspect assigned modules, hunt vulnerabilities, and verify defect reproduction as a collaborative subagent.
3
+ description: A concurrent test and review worker dispatched by BugX to inspect assigned modules, uncover deep bugs, and run automated verification as a collaborative subagent.
4
4
  tools: Bash, Read, Grep, Glob, Edit, Write, mcp__bugx-supervisor-worker__bugx_supervisor_claim, mcp__bugx-supervisor-worker__bugx_supervisor_worker_start, mcp__bugx-supervisor-worker__bugx_supervisor_heartbeat, mcp__bugx-supervisor-worker__bugx_supervisor_run_sandboxed_probe, mcp__bugx-supervisor-worker__bugx_supervisor_checkpoint, mcp__bugx-supervisor-worker__bugx_supervisor_begin_long_call, mcp__bugx-supervisor-worker__bugx_supervisor_status, mcp__bugx-supervisor-worker__bugx_supervisor_submit_finding
5
5
  color: cyan
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx
3
- description: An autonomous agent dedicated to code review, vulnerability hunting, and automated bug fixing. Built for deep investigations, BugX steps in when you are wrapping up a feature, opening a pull request, or hunting down an elusive bug. It analyzes code logic, automatically writes test cases to uncover and reproduce hidden flaws, and delivers verified patches that resolve root causes. Always safeguarding your code quality and security.
3
+ description: An autonomous code review and testing agent designed to safeguard software delivery. It surfaces hidden bugs for developers to eliminate painful debugging and rework, while automating black-box, functional, and performance testing across complex edge cases for QA. Ensures code runs reliably, meets all requirements, and frees engineers to focus on what matters.
4
4
  tools: Bash, Read, Grep, Glob, Edit, Write, AskUserQuestion
5
5
  color: cyan
6
6
  ---
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: bugx
3
- description: 专注于代码质量与安全的自主审查智能体。专为深层缺陷排查而生——在功能写完、提 PR 或排查疑难 Bug 时,它能深入分析代码逻辑,自动编写测试用例,挖掘、复现Bug和漏洞,生成经过验证的修复补丁。随时为您的代码质量和代码安全把关。
3
+ description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
4
4
  metadata:
5
- bugx_version: "0.1.2"
5
+ bugx_version: "0.1.3"
6
6
  ---
7
7
  <!-- bugx-locale: zh-CN -->
8
8
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  BugX ChatGPT Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。
12
12
 
13
- 协议镜像版本:0.1.2
13
+ 协议镜像版本:0.1.3
14
14
 
15
15
  ## ChatGPT 原生交互适配(强制)
16
16
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx-claude
3
- description: BugX 漏洞挖掘引擎在 Claude Code 宿主下的专属使用手册——开工前必读协议清单、宿主能力映射(AskUserQuestion/Task/MCP)、finding confirmation 与 reproduction 契约、本机实证过的坑位与对策(证据通道、claim 粒度、指纹漂移自锁、大响应体、worker MCP 断线回退)。当用户要在 Claude Code 里启动/排障/收尾 BugX 审计、解释 BugX 门禁报错、或问「为什么审计跑了这么久」时使用本 skill。
3
+ description: BugX 自主代码审查与智能测试在 Claude Code 宿主下的专属使用手册——开工前必读协议清单、宿主能力映射(AskUserQuestion/Task/MCP)、finding confirmation 与 reproduction 契约、本机实证过的坑位与对策(证据通道、claim 粒度、指纹漂移自锁、大响应体、worker MCP 断线回退)。当用户要在 Claude Code 里启动/排障/收尾 BugX 审查、解释 BugX 门禁报错、或问「为什么审查跑了这么久」时使用本 skill。
4
4
  ---
5
5
 
6
6
  # BugX × Claude Code 使用手册(实证复盘版)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx-dsh
3
- description: BugX 漏洞挖掘引擎在 DeepSeek Harness (DSH) 宿主下的专属使用手册——新环境快速接入(构建/安装/doctor)、启动挖掘标准流程(pre 门禁→workers→checkpoint→post)、原生交互适配、Token 与模型用量采集。当用户在 DSH 里启动/排障/重置 BugX 审计、配置新环境或需要查看 DSH 本地模型与 Token 用量报告时使用本 skill。
3
+ description: BugX 自主代码审查与智能测试在 DeepSeek Harness (DSH) 宿主下的专属使用手册——新环境快速接入(构建/安装/doctor)、启动流程(pre 门禁→workers→checkpoint→post)、原生交互适配、Token 与模型用量采集。当用户在 DSH 里启动/排障/重置 BugX 审查与测试、配置新环境或需要查看 DSH 本地模型与 Token 用量报告时使用本 skill。
4
4
  ---
5
5
 
6
6
  # BugX × DeepSeek Harness (DSH) 使用手册(实战复盘版)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx-opencode
3
- description: "BugX 对抗审计在 OpenCode 宿主的操作手册。当宿主发起/执行 BugX 漏洞挖掘、代码审计、对抗测试,或遇到 bugx engine pre 门禁、MCP 会话冲突(session_occupied)、Worker 派发(bugx-worker subagent)、headless/ACP 验收、判读式审计(judge)、findings 确认协议、post 结算封存等问题时使用。触发词:bugx 审计、漏洞挖掘、pre 门禁、session_occupied、bugx-worker、judge collect、post --final。"
3
+ description: "BugX 自主代码审查与智能测试在 OpenCode 宿主的操作手册。当宿主发起/执行 BugX 代码审查、智能测试、深度缺陷排查,或遇到 bugx engine pre 门禁、MCP 会话冲突(session_occupied)、Worker 派发(bugx-worker subagent)、headless/ACP 验收、判读式审计(judge)、findings 确认协议、post 结算封存等问题时使用。触发词:bugx 审查、智能测试、pre 门禁、session_occupied、bugx-worker、judge collect、post --final。"
4
4
  ---
5
5
 
6
6
  # BugX × OpenCode 使用手册(实战复盘版)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bugx-zcode
3
- description: BugX 漏洞挖掘引擎在 ZCode 宿主下的专属使用手册——新环境快速接入(构建/安装/doctor)、启动挖掘标准流程(pre 启动门禁→workers→checkpoint→post)、本机实证过的坑位与对策(MCP root 漂移、worker 误回收、findings 格式、死锁链、token 上报、云端面板、重置)。当用户要在 ZCode 里启动/排障/重置 BugX 审计、配置新环境、解释 BugX 报错或 token/报告不更新时使用本 skill。
3
+ description: BugX 自主代码审查与智能测试在 ZCode 宿主下的专属使用手册——新环境快速接入(构建/安装/doctor)、启动流程(pre 启动门禁→workers→checkpoint→post)、本机实证过的坑位与对策(MCP root 漂移、worker 误回收、findings 格式、死锁链、token 上报、云端面板、重置)。当用户要在 ZCode 里启动/排障/重置 BugX 审查与测试、配置新环境、解释 BugX 报错或 token/报告不更新时使用本 skill。
4
4
  ---
5
5
 
6
6
  # BugX × ZCode 使用手册(实战复盘版)
@@ -95,6 +95,8 @@ const env = { ...process.env };
95
95
  env.BUGX_ASSET_ROOT = env.BUGX_ASSET_ROOT || join(pkgRoot, 'core');
96
96
  env.BUGX_PYTHON = pythonCmd;
97
97
  env.BUGX_CLI_SOURCE = 'npm';
98
+ env.PYTHONUTF8 = env.PYTHONUTF8 || '1';
99
+ env.PYTHONIOENCODING = env.PYTHONIOENCODING || 'utf-8';
98
100
  const cliDir = existsSync(join(pkgRoot, 'interfaces', 'cli'))
99
101
  ? join(pkgRoot, 'interfaces', 'cli')
100
102
  : join(pkgRoot, 'src');
@@ -2,5 +2,5 @@
2
2
 
3
3
  import os
4
4
 
5
- __version__ = os.environ.get("BUGX_VERSION", "0.1.2")
6
- __build_id__: int = 11
5
+ __version__ = os.environ.get("BUGX_VERSION", "0.1.3")
6
+ __build_id__: int = 1
@@ -12,6 +12,14 @@ import sys
12
12
  import typing
13
13
  from pathlib import Path
14
14
 
15
+ # 确保在管道重定向或非 UTF-8 环境(如 Windows GBK/cp936 控制台)下输出非 ASCII 符号(如 ✓、✗)不触发 UnicodeEncodeError
16
+ for _stream in (sys.stdout, sys.stderr):
17
+ if hasattr(_stream, "reconfigure"):
18
+ try:
19
+ _stream.reconfigure(encoding="utf-8", errors="replace")
20
+ except Exception:
21
+ pass
22
+
15
23
  # 兼容低版本启动环境:若当前解释器 < 3.11,优先尝试全系统多源自举重拉
16
24
  if sys.version_info < (3, 11):
17
25
  try:
@@ -718,6 +726,13 @@ def build_parser() -> argparse.ArgumentParser:
718
726
  )
719
727
  probe.add_argument("--root", type=Path, default=Path.cwd(),
720
728
  help="项目根(默认当前目录)")
729
+ probe.add_argument(
730
+ "--timeout-seconds", type=_parse_probe_timeout, default=None,
731
+ help=(
732
+ "BugX 外层探针看护超时(默认 120 秒,最大 1800 秒;"
733
+ "可放在探针类型前或后)"
734
+ ),
735
+ )
721
736
  probe.add_argument("probe_args", nargs=argparse.REMAINDER,
722
737
  help="透传给探针的参数(如 check --json --strict)")
723
738
 
@@ -53,6 +53,7 @@ from ..host_adapters import (
53
53
  HostAdapter,
54
54
  HOST_NAME_CLAUDE,
55
55
  HOST_NAME_FUNIDE,
56
+ HOST_NAME_KIMI,
56
57
  HOST_NAME_QODER,
57
58
  HOST_NAME_ZCODE,
58
59
  )
@@ -788,7 +789,8 @@ def _select_install_adapters(
788
789
  if args.non_interactive:
789
790
  raise CliError(_i18n_exc(
790
791
  "agent.non_interactive_agent_required",
791
- "非交互安装必须显式提供 --agent opencode/dsh/codex/cline/claude/zcode/workbuddy/pi/chatgpt/qoder/trea/funide",
792
+ "非交互安装必须显式提供 --agent "
793
+ + "/".join(adapter.name for adapter in HOST_ADAPTERS),
792
794
  ))
793
795
  if not sys.stdin.isatty():
794
796
  raise CliError(_i18n_exc(
@@ -1223,40 +1225,44 @@ def _command_agent_impl(
1223
1225
  "to": str(root),
1224
1226
  }
1225
1227
  host_mcp_configs[adapter.name] = host_info
1226
- if adapter.supports(CAP_USER_AGENT_REGISTRATION):
1227
- # User-level agent registrations share the install transaction;
1228
- # MCP files remain scoped to this project.
1229
- registered_user_agents = adapter.ensure_user_agents(
1230
- root, source, locale=deployment_locale,
1228
+ # User-level registrations are independent of project MCP writing.
1229
+ # MiniMax Plugin V1 has no project MCP container: its package owns both
1230
+ # the Agent manifests and servers.mcp.json under the user data root.
1231
+ for adapter in selected:
1232
+ if not adapter.supports(CAP_USER_AGENT_REGISTRATION):
1233
+ continue
1234
+ registered_user_agents = adapter.ensure_user_agents(
1235
+ root, source, locale=deployment_locale,
1236
+ )
1237
+ if registered_user_agents is None:
1238
+ raise CliError(
1239
+ f"{adapter.label} 声明支持用户级注册,但注册器没有返回结果;"
1240
+ "已阻断安装,避免报告成功但插件未生效。"
1231
1241
  )
1232
- if registered_user_agents is not None:
1233
- user_agents_by_host[adapter.name] = registered_user_agents
1234
- if adapter.name == HOST_NAME_ZCODE:
1235
- # ZCode 专属:用户级使用手册 Skill 与 agents 同事务部署
1236
- # (全局层,跨项目可见;内容随 wheel 版本演进)。
1237
- zcode_user_skill = _ensure_zcode_user_skill(root, source)
1238
- user_agents_by_host[adapter.name]["user_skill"] = (
1239
- zcode_user_skill
1240
- )
1241
- for item in zcode_user_skill["written"]:
1242
- if item["status"] == "unchanged":
1243
- continue
1244
- host_mcp_changes.append((
1245
- Path(str(item["path"])),
1246
- Path(str(item["backup"])) if item["backup"] else None,
1247
- bool(item["created"]),
1248
- ))
1249
- host_backups.extend(zcode_user_skill["backups"])
1250
- for item in registered_user_agents["written"]:
1251
-
1252
- if item["status"] == "unchanged":
1253
- continue
1254
- host_mcp_changes.append((
1255
- Path(str(item["path"])),
1256
- Path(str(item["backup"])) if item["backup"] else None,
1257
- bool(item["created"]),
1258
- ))
1259
- host_backups.extend(registered_user_agents["backups"])
1242
+ user_agents_by_host[adapter.name] = registered_user_agents
1243
+ if adapter.name == HOST_NAME_ZCODE:
1244
+ # ZCode 专属:用户级使用手册 Skill 与 agents 同事务部署
1245
+ # (全局层,跨项目可见;内容随 wheel 版本演进)。
1246
+ zcode_user_skill = _ensure_zcode_user_skill(root, source)
1247
+ user_agents_by_host[adapter.name]["user_skill"] = zcode_user_skill
1248
+ for item in zcode_user_skill["written"]:
1249
+ if item["status"] == "unchanged":
1250
+ continue
1251
+ host_mcp_changes.append((
1252
+ Path(str(item["path"])),
1253
+ Path(str(item["backup"])) if item["backup"] else None,
1254
+ bool(item["created"]),
1255
+ ))
1256
+ host_backups.extend(zcode_user_skill["backups"])
1257
+ for item in registered_user_agents["written"]:
1258
+ if item["status"] == "unchanged":
1259
+ continue
1260
+ host_mcp_changes.append((
1261
+ Path(str(item["path"])),
1262
+ Path(str(item["backup"])) if item["backup"] else None,
1263
+ bool(item["created"]),
1264
+ ))
1265
+ host_backups.extend(registered_user_agents["backups"])
1260
1266
  for adapter in selected:
1261
1267
  if adapter.supports(CAP_GLOBAL_AGENT_LINK):
1262
1268
  # global-agent-link 宿主(现仅 opencode):用户级使用手册 Skill
@@ -1475,11 +1481,11 @@ def _command_agent_impl(
1475
1481
  status = str(info["status"])
1476
1482
  path = str(info["path"])
1477
1483
  if status == "created":
1478
- print(f" {host_name} MCP 配置:已创建 {path}(host/worker 双通道)")
1484
+ print(f" {host_name} MCP 配置:已创建 {path}(host/worker 双通道,需重启宿主会话生效)")
1479
1485
  elif status == "unchanged":
1480
1486
  print(f" {host_name} MCP 配置:已是最新双通道配置,保持不变({path})")
1481
1487
  else:
1482
- print(f" {host_name} MCP 配置:已备份并{status}双通道({path})")
1488
+ print(f" {host_name} MCP 配置:已备份并{status}双通道({path},需重启宿主会话生效)")
1483
1489
  switched = info.get("root_switch")
1484
1490
  if isinstance(switched, dict):
1485
1491
  print(
@@ -1585,6 +1591,23 @@ def _command_agent_impl(
1585
1591
  f" Qoder 用户级资产:已是最新,保持不变"
1586
1592
  f"({qoder_user_agents['dir']})"
1587
1593
  )
1594
+ if (kimi_user_agents := user_agents_by_host.get(HOST_NAME_KIMI)) is not None:
1595
+ reported_user_agents.add(HOST_NAME_KIMI)
1596
+ changed = [
1597
+ item for item in kimi_user_agents["written"]
1598
+ if item["status"] != "unchanged"
1599
+ ]
1600
+ if changed:
1601
+ names = "、".join(Path(str(item["path"])).name for item in changed)
1602
+ print(
1603
+ f" Kimi 桌面端插件与徽标:已配置 {names}"
1604
+ f"({kimi_user_agents['dir']},免点击直接启用)"
1605
+ )
1606
+ else:
1607
+ print(
1608
+ f" Kimi 桌面端插件:已是最新并处于启用状态"
1609
+ f"({kimi_user_agents['dir']})"
1610
+ )
1588
1611
  # 其余宿主的用户级注册结果统一汇报(标签来自插件/组件表,不写宿主名)。
1589
1612
  for host_name, payload in user_agents_by_host.items():
1590
1613
  if host_name in reported_user_agents:
@@ -1650,7 +1673,22 @@ def _command_agent_impl(
1650
1673
  f" DSH UI 插件:已暂存 {dsh_ui_plugin['root']}({dsh_ui_plugin['detail']})"
1651
1674
  )
1652
1675
  print(" DSH Web 启动:dsh web(按当前 Session 工作区自动绑定;未选目录会明确提示)")
1676
+ mcp_restart_targets: list[str] = []
1677
+ for host_name, info in host_mcp_configs.items():
1678
+ if info.get("session_restart_required"):
1679
+ mcp_restart_targets.append(f"{host_name}: {info.get('path')}")
1653
1680
  if opencode_config_status in {"created", "merged"}:
1681
+ mcp_restart_targets.append(f"OpenCode: {CONFIG_NAME}")
1682
+
1683
+ if mcp_restart_targets:
1684
+ print("\n ========================================================")
1685
+ print(" ⚠【必须强制重启宿主会话】")
1686
+ print(" 项目 MCP 配置已新建/更新,宿主进程不支持动态热加载:")
1687
+ for target_desc in mcp_restart_targets:
1688
+ print(f" - {target_desc}")
1689
+ print(" 请务必执行:【重载窗口 / 重启宿主会话】后再启动 BugX!")
1690
+ print(" ========================================================\n")
1691
+ elif opencode_config_status in {"created", "merged"}:
1654
1692
  print(" ⚠ OpenCode MCP 配置已变化;现有会话通常不会热加载。启动 BugX 时会先主动探活,"
1655
1693
  "探活未命中时再提示重启 OpenCode 会话")
1656
1694
  _print_mcp_recommendations(mcp_recommendations)
@@ -1899,6 +1937,17 @@ def _deploy_dsh_ui_plugin() -> dict[str, object]:
1899
1937
  "status": "staged",
1900
1938
  "detail": "未发现可管理的 DSH web profile,保留包供 dsh plugin add 使用",
1901
1939
  }
1940
+ if not _dsh_desktop_launcher_available(dsh):
1941
+ return {
1942
+ "root": str(plugin_root),
1943
+ "mcp_root": None, # 第三方 MCP bridge 已停用;通道由 profile patch 提供
1944
+ "profile": str(profile_root),
1945
+ "status": "staged",
1946
+ "detail": (
1947
+ "当前 dsh 是普通 CLI launcher;官方 CLI 不支持 plugin management,"
1948
+ "已保留 UI 包,等待 Desktop launcher 注册"
1949
+ ),
1950
+ }
1902
1951
  try:
1903
1952
  result = subprocess.run(
1904
1953
  [dsh, "plugin", "--profile", "web", "add", str(plugin_root)],
@@ -2075,9 +2124,9 @@ def _deploy_dsh_preset(root: Path) -> None:
2075
2124
 
2076
2125
  preset_name = "BugX 深度审计"
2077
2126
  preset_desc = (
2078
- "你的自动化代码安全体检专家。深度排查项目中隐藏的逻辑漏洞、鉴权越界与并发隐患,"
2079
- "不仅找 Bug,更能自动生成复现验证与修复建议。"
2080
- "适合在项目提测发版前、安全合规体检或排查疑难缺陷时开启;日常开发与普通交流不打扰。"
2127
+ "BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,"
2128
+ "减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;"
2129
+ "确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。"
2081
2130
  )
2082
2131
  preset_order = 0
2083
2132
 
@@ -2139,10 +2188,69 @@ _DSH_PTC_WORKFLOW_PLUGIN = "@deepseek-ai/dsh-workflow-ptc"
2139
2188
  def _dsh_desktop_asar_candidates() -> list[Path]:
2140
2189
  """Return DSH Desktop ``app.asar`` paths that may carry the bundled runtime."""
2141
2190
  resources = Path("Contents", "Resources", "app.asar")
2142
- return [
2191
+ candidates = [
2143
2192
  Path.home().resolve() / "Applications" / "DSH Desktop.app" / resources,
2144
2193
  Path("/Applications") / "DSH Desktop.app" / resources,
2145
2194
  ]
2195
+ if os.name == "nt":
2196
+ # DSH Desktop is an Electron app on Windows. Keep this list bounded to
2197
+ # documented installation roots; never walk the drive looking for an
2198
+ # app.asar file.
2199
+ bases: list[Path] = []
2200
+ for variable in ("LOCALAPPDATA", "PROGRAMFILES", "PROGRAMFILES(X86)", "PROGRAMW6432"):
2201
+ value = os.environ.get(variable, "").strip()
2202
+ if value:
2203
+ bases.append(Path(value))
2204
+ local_app_data = os.environ.get("LOCALAPPDATA", "").strip()
2205
+ if not local_app_data:
2206
+ bases.append(Path.home() / "AppData" / "Local")
2207
+ for base in bases:
2208
+ candidates.extend((
2209
+ base / "Programs" / "DeepSeek Harness" / "resources" / "app.asar",
2210
+ base / "Programs" / "DeepSeekHarness" / "resources" / "app.asar",
2211
+ base / "DeepSeek Harness" / "resources" / "app.asar",
2212
+ base / "DeepSeekHarness" / "resources" / "app.asar",
2213
+ ))
2214
+
2215
+ unique: list[Path] = []
2216
+ seen: set[str] = set()
2217
+ for candidate in candidates:
2218
+ key = os.path.normcase(os.path.normpath(str(candidate)))
2219
+ if key not in seen:
2220
+ seen.add(key)
2221
+ unique.append(candidate)
2222
+ return unique
2223
+
2224
+
2225
+ def _dsh_directory_exists(path: Path) -> bool:
2226
+ """Check a DSH package directory, including a junction/symlink target."""
2227
+ try:
2228
+ return path.is_dir() or Path(os.path.realpath(path)).is_dir()
2229
+ except OSError:
2230
+ return False
2231
+
2232
+
2233
+ def _dsh_desktop_launcher_available(dsh: str) -> bool:
2234
+ """Return whether ``dsh`` is the Desktop launcher allowed to manage plugins.
2235
+
2236
+ The official CLI documentation states that npm/Python launchers reject
2237
+ plugin-management requests; only the Desktop-installed command may manage
2238
+ the initialized Desktop profile. Calling the former on Windows can crash
2239
+ the child process instead of returning a useful error, so path-gate the
2240
+ operation before spawning it.
2241
+ """
2242
+ try:
2243
+ launcher = Path(dsh).resolve()
2244
+ except OSError:
2245
+ launcher = Path(dsh)
2246
+ for asar in _dsh_desktop_asar_candidates():
2247
+ install_root = asar.parent.parent
2248
+ try:
2249
+ launcher.relative_to(install_root)
2250
+ except ValueError:
2251
+ continue
2252
+ return True
2253
+ return False
2146
2254
 
2147
2255
 
2148
2256
  def _asar_lists_bundled_package(asar: Path, package: str) -> bool:
@@ -2166,6 +2274,9 @@ def _asar_lists_bundled_package(asar: Path, package: str) -> bool:
2166
2274
  return False
2167
2275
  # The asar header is a nested file tree, so the package path never appears
2168
2276
  # as one contiguous byte string; parse the JSON and walk the "files" maps.
2277
+ # DSH Desktop currently nests the runtime below ``files/dsh`` rather than
2278
+ # putting ``node_modules`` at the archive root, so do not assume one fixed
2279
+ # number of parent directories.
2169
2280
  start = header.find(b'{"files":')
2170
2281
  if start < 0:
2171
2282
  return False
@@ -2175,12 +2286,22 @@ def _asar_lists_bundled_package(asar: Path, package: str) -> bool:
2175
2286
  )
2176
2287
  except (UnicodeDecodeError, json.JSONDecodeError):
2177
2288
  return False
2178
- node: Any = tree
2179
- for part in ("files", "node_modules", "files", "@deepseek-ai", "files", package):
2289
+ stack: list[tuple[Any, tuple[str, ...]]] = [(tree, ())]
2290
+ while stack:
2291
+ node, path = stack.pop()
2180
2292
  if not isinstance(node, dict):
2181
- return False
2182
- node = node.get(part)
2183
- return isinstance(node, dict)
2293
+ continue
2294
+ files = node.get("files")
2295
+ if not isinstance(files, dict):
2296
+ continue
2297
+ for name, child in files.items():
2298
+ if not isinstance(name, str):
2299
+ continue
2300
+ child_path = path + (name,)
2301
+ if child_path[-3:] == ("node_modules", "@deepseek-ai", package):
2302
+ return True
2303
+ stack.append((child, child_path))
2304
+ return False
2184
2305
 
2185
2306
 
2186
2307
  def _dsh_desktop_runtime_names() -> tuple[str, str] | None:
@@ -2210,16 +2331,20 @@ def _dsh_runtime_plugin_names(home: Path) -> tuple[str, str]:
2210
2331
  内置在 app.asar 中,必须先探测 asar;其余 home 以
2211
2332
  ``profiles/node_modules`` 为准(那是其插件解析根)。
2212
2333
  """
2213
- if "dsh-desktop" in home.parts:
2334
+ # On Windows Desktop and the regular CLI share ``%USERPROFILE%\.dsh``;
2335
+ # the home path therefore does not identify the Desktop runtime. If a
2336
+ # bundled Desktop app.asar is present, prefer its package names on every
2337
+ # Windows home. macOS keeps the historical dedicated desktop-home guard.
2338
+ if os.name == "nt" or "dsh-desktop" in home.parts:
2214
2339
  detected = _dsh_desktop_runtime_names()
2215
2340
  if detected is not None:
2216
2341
  return detected
2217
2342
  base = home / "profiles" / "node_modules" / "@deepseek-ai"
2218
- if (base / "dsh-agent-preset").is_dir():
2343
+ if _dsh_directory_exists(base / "dsh-agent-preset"):
2219
2344
  preset_plugin = "@deepseek-ai/dsh-agent-preset"
2220
2345
  else:
2221
2346
  preset_plugin = "@deepseek-ai/dsh-agent-presets"
2222
- if (base / "dsh-workflow-ptc").is_dir():
2347
+ if _dsh_directory_exists(base / "dsh-workflow-ptc"):
2223
2348
  workflow_plugin = _DSH_PTC_WORKFLOW_PLUGIN
2224
2349
  else:
2225
2350
  workflow_plugin = _DSH_LEGACY_WORKFLOW_PLUGIN
@@ -3174,22 +3299,22 @@ def _ensure_workbuddy_custom_expert(
3174
3299
  "---\n"
3175
3300
  "name: bugx\n"
3176
3301
  "description: >-\n"
3177
- " BugX 代码审计专家:专注于代码质量与安全的自主审查,深入分析代码逻辑、发现隐蔽缺陷并自动编写 PoC 验证,提供确凿的证据闭环与修复方案。\n"
3302
+ " BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。\n"
3178
3303
  "description_zh: >-\n"
3179
- " BugX 代码审计专家:专注于代码质量与安全的自主审查,深入分析代码逻辑、发现隐蔽缺陷并自动编写 PoC 验证,提供确凿的证据闭环与修复方案。\n"
3304
+ " BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。\n"
3180
3305
  "description_en: >-\n"
3181
- " BugX Code Auditor: Autonomous code quality and security auditing expert. Specializes in deep defect hunting, adversarial testing, PoC reproduction, and verified remediation.\n"
3306
+ " BugX is an autonomous code review and testing agent designed to safeguard software delivery: it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; automates black-box, functional, and performance testing across complex edge cases for QA; and ensures software strictly meets functional requirements with rock-solid stability and resilience. By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people.\n"
3182
3307
  "tools: Bash,Read,Edit\n"
3183
3308
  "color: \"#08B7D4\"\n"
3184
3309
  "---\n\n"
3185
- "你是一位专业的代码质量与漏洞挖掘专家(BugX 代码审计专家)。你的核心使命是帮助开发者在代码合入、发布前或疑难故障排查时,进行深层次的代码审计、对抗性缺陷排查与自动化验证。\n\n"
3310
+ "你是一个具备自主代码审查与测试能力的智能体。你的核心使命是严把代码交付关:帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能完全符合要求、在各种复杂环境下都能稳定运行、不崩溃不卡死,上线放心不翻车。\n\n"
3186
3311
  "## 核心工作原则\n"
3187
- "1. **证据驱动(Evidence-Driven)**:不凭空猜测 Bug,必须通过静态逻辑推演或最小复现测试(PoC)验证缺陷存在。\n"
3312
+ "1. **证据驱动(Evidence-Driven)**:不凭空猜测 Bug,必须通过静态逻辑推演、黑盒测试或功能验证实测证据。\n"
3188
3313
  "2. **闭环验证(Verification Loop)**:缺陷发现后,优先编写自动化回归单测,验证失败;给出修复方案后重新运行测试验证通过。\n"
3189
- "3. **安全与质量并重**:涵盖业务逻辑越权、并发死锁/竞态条件、边界值溢出、资源泄漏、SQL注入、SSRF等安全与稳定性隐患。\n\n"
3314
+ "3. **健壮与稳定并重**:涵盖业务逻辑完备性、并发死锁/竞态条件、边界值溢出、资源泄漏、异常与极端场景等稳定性隐患。\n\n"
3190
3315
  "## 协作流程\n"
3191
- "1. **审计准备**:读取目标文件、架构设计与历史提交记录,理清数据流向与契约约束。\n"
3192
- "2. **深入排查**:对输入校验、状态转移、异常处理、外部调用等关键节点进行对抗式推演。\n"
3316
+ "1. **审查准备**:读取目标文件、架构设计与历史提交记录,理清数据流向与契约约束。\n"
3317
+ "2. **深入排查**:对输入校验、状态转移、异常处理、极端边界等关键节点进行对抗式推演与自动化测试。\n"
3193
3318
  "3. **产出报告**:输出清晰的问题说明、触发条件、风险等级与最小修复代码。\n"
3194
3319
  )
3195
3320
  backup = _backup_host_resource(root, wb_name, agent_dest) if agent_dest.exists() else None
@@ -3213,26 +3338,26 @@ def _ensure_workbuddy_custom_expert(
3213
3338
  "en": "BugX"
3214
3339
  },
3215
3340
  "profession": {
3216
- "zh": "代码审计专家",
3217
- "en": "Code Audit Expert"
3341
+ "zh": "自主代码审查与测试智能体",
3342
+ "en": "Autonomous Code Review & Testing Agent"
3218
3343
  },
3219
- "description": "专注于代码质量与安全的自主审查智能体。专为深层缺陷排查而生——在功能写完、提 PR 或排查疑难 Bug 时,它能深入分析代码逻辑、发现隐蔽缺陷并自动编写 PoC 验证,提供确凿的证据闭环与修复方案。",
3344
+ "description": "BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。",
3220
3345
  "displayDescription": {
3221
- "zh": "专注于代码质量与安全的自主审查智能体。专为深层缺陷排查而生——在功能写完、提 PR 或排查疑难 Bug 时,它能深入分析代码逻辑、发现隐蔽缺陷并自动编写 PoC 验证,提供确凿的证据闭环与修复方案。",
3222
- "en": "Autonomous code quality and security auditing expert. Specializes in deep defect hunting, adversarial testing, PoC reproduction, and verified remediation."
3346
+ "zh": "BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。",
3347
+ "en": "BugX is an autonomous code review and testing agent designed to safeguard software delivery: it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; automates black-box, functional, and performance testing across complex edge cases for QA; and ensures software strictly meets functional requirements with rock-solid stability and resilience. By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people."
3223
3348
  },
3224
3349
  "avatar": "avatars/expert.png",
3225
3350
  "category": "development",
3226
3351
  "categoryId": "01-Development",
3227
3352
  "tags": [
3228
- {"zh": "代码审计", "en": "Code Audit"},
3229
- {"zh": "漏洞挖掘", "en": "Vulnerability"},
3230
- {"zh": "自动化测试", "en": "Automated Testing"}
3353
+ {"zh": "代码审查", "en": "Code Review"},
3354
+ {"zh": "智能测试", "en": "Automated Testing"},
3355
+ {"zh": "质量保障", "en": "Quality Assurance"}
3231
3356
  ],
3232
3357
  "quickPrompts": [
3233
- {"zh": "对当前代码库进行一次全面的代码审计与漏洞排查", "en": "Perform a comprehensive code audit and vulnerability check on the current codebase"},
3234
- {"zh": "排查最近提交的代码中潜在的并发与边界缺陷", "en": "Investigate potential concurrency and boundary defects in recent commits"},
3235
- {"zh": "针对已知 Bug 编写最小复现 PoC 并验证修复方案", "en": "Write a minimal reproduction PoC for an issue and verify the fix"}
3358
+ {"zh": "对当前代码库进行全面的代码审查与深层 Bug 排查", "en": "Perform a comprehensive code review and deep bug inspection on the current codebase"},
3359
+ {"zh": "自动化运行黑盒测试与功能验证,排查潜在边界缺陷", "en": "Run automated black-box tests and functional verification to catch edge-case bugs"},
3360
+ {"zh": "对最近提交的代码进行性能测试与稳定性验证", "en": "Run performance and stability tests on recent commits to ensure rock-solid delivery"}
3236
3361
  ],
3237
3362
  "agents": ["./agents/bugx.md"],
3238
3363
  "skills": ["./skills/bugx"]
@@ -585,6 +585,24 @@ def _doctor_repair_assets(root: Path, layout: Any) -> list[str]:
585
585
  except Exception as exc:
586
586
  failed("runtime.json 修复", exc)
587
587
 
588
+ try:
589
+ onboarding_file = root / ".bugx" / "cloud-onboard.json"
590
+ if onboarding_file.is_symlink():
591
+ raise OSError(f"拒绝修复软链接目标:{onboarding_file}")
592
+ if not onboarding_file.is_file():
593
+ payload = {
594
+ "schema_version": 1,
595
+ "state": "local",
596
+ "updated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
597
+ }
598
+ _doctor_atomic_replace(
599
+ onboarding_file,
600
+ json.dumps(payload, indent=2, ensure_ascii=False).encode("utf-8"),
601
+ )
602
+ actions.append("已自动补齐缺失的项目本地 onboarding 配置(.bugx/cloud-onboard.json)")
603
+ except Exception as exc:
604
+ failed("cloud-onboard.json 修复", exc)
605
+
588
606
  try:
589
607
  project_file = root / ".bugx-project.json"
590
608
  if project_file.is_symlink():