bugx-cli 0.1.2 → 0.1.4

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 (157) hide show
  1. package/README.md +26 -29
  2. package/core/README.md +5 -3
  3. package/core/agent/agent_orchestrator.py +3 -0
  4. package/core/agent/agent_workspace.py +14 -2
  5. package/core/assets/bugx-wechat-group.png +0 -0
  6. package/core/assets/twitter_promo_art.jpg +0 -0
  7. package/core/assets/twitter_promo_card.svg +166 -0
  8. package/core/assets/twitter_promo_clean.jpg +0 -0
  9. package/core/assets/twitter_terminal_real.png +0 -0
  10. package/core/bugx.md +3 -3
  11. package/core/bugx_paths.py +10 -2
  12. package/core/bundled_docs/OVERVIEW.md +310 -0
  13. package/core/bundled_docs/README.md +10 -0
  14. package/core/bundled_docs/README_EN.md +278 -0
  15. package/core/bundled_docs/ai/01_AI_REFERENCE.md +833 -0
  16. package/core/bundled_docs/ai/02_AI_USAGE.md +161 -0
  17. package/core/bundled_docs/ai/03_AI_COMMANDS.md +322 -0
  18. package/core/bundled_docs/guides/01_USER_GUIDE.md +887 -0
  19. package/core/bundled_docs/guides/02_COMMANDS.md +935 -0
  20. package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +763 -0
  21. package/core/bundled_docs/guides/04_CLOUD_AUTH_AND_SYNC_COOKBOOK.md +48 -0
  22. package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +23 -0
  23. package/core/bundled_docs/guides/06_PROBES_AND_POC_COOKBOOK.md +49 -0
  24. package/core/bundled_docs/guides/07_LIFECYCLE_AND_RECOVERY_STATES.md +46 -0
  25. package/core/bundled_docs/guides/08_LESSONS_AND_PRIVACY_BOUNDARY.md +35 -0
  26. package/core/bundled_docs/hosts/bugx-claude_SKILL.md +326 -0
  27. package/core/bundled_docs/hosts/bugx-dsh_SKILL.md +229 -0
  28. package/core/bundled_docs/hosts/bugx-opencode_SKILL.md +129 -0
  29. package/core/bundled_docs/hosts/bugx-zcode_SKILL.md +459 -0
  30. package/core/bundled_docs/hosts/bugx_SKILL.md +118 -0
  31. package/core/bundled_docs/hosts/cline_bugx_SKILL.md +69 -0
  32. package/core/bundled_docs/hosts/platform_bugx_SKILL.md +50 -0
  33. package/core/bundled_docs/manifest.json +140 -0
  34. package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +421 -0
  35. package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +180 -0
  36. package/core/cli-help.txt +7 -3
  37. package/core/cloud_sync/cloud_client.py +81 -2
  38. package/core/cloud_sync/endpoint_router.py +22 -9
  39. package/core/cloud_sync/issue_uploader.py +297 -0
  40. package/core/cloud_sync/sensitive_filter.py +77 -7
  41. package/core/contracts/AGENT_GUIDE.md +3 -9
  42. package/core/contracts/README.md +1 -1
  43. package/core/contracts/bugx-opencode.md +1 -1
  44. package/core/contracts/bugx-runtime-contract.md +10 -20
  45. package/core/contracts/bugx-worker.md +1 -1
  46. package/core/engine-integrity.json +267 -111
  47. package/core/host_acp/antigravity.py +153 -0
  48. package/core/host_acp/kimi.py +175 -0
  49. package/core/host_acp/minimax.py +28 -0
  50. package/core/host_runtime/adapters.py +5 -1
  51. package/core/host_runtime/antigravity.py +162 -0
  52. package/core/host_runtime/host_bootstrap.py +18 -7
  53. package/core/host_runtime/host_evaluators.py +4 -4
  54. package/core/host_runtime/host_registry.py +25 -4
  55. package/core/host_runtime/mcp_process_tracker.py +30 -3
  56. package/core/host_runtime/mcp_registry_gate.py +34 -11
  57. package/core/hosts/antigravity.py +115 -0
  58. package/core/hosts/codex.py +3 -0
  59. package/core/hosts/dsh.py +43 -24
  60. package/core/hosts/kimi.py +293 -0
  61. package/core/hosts/minimax.py +249 -0
  62. package/core/hosts/zcode.py +5 -0
  63. package/core/i18n.py +94 -5
  64. package/core/infra/README.md +1 -1
  65. package/core/infra/build_info.py +30 -5
  66. package/core/launch_phases/README.md +2 -2
  67. package/core/launch_phases/startup_version_gate.py +2 -2
  68. package/core/launch_phases/supervisor_bridge.py +16 -23
  69. package/core/launch_phases/supervisor_degraded.py +7 -5
  70. package/core/ledger/README.md +1 -1
  71. package/core/locales/en-US.json +3 -3
  72. package/core/locales/zh-CN.json +3 -3
  73. package/core/mcp_runtime_support/environment.py +6 -1
  74. package/core/metadata.txt +2 -2
  75. package/core/planning/README.md +1 -1
  76. package/core/planning/prompt_harness.py +2 -2
  77. package/core/probes/codebase_memory_probe.py +43 -24
  78. package/core/probes/probe_registry.py +10 -7
  79. package/core/prompts/command_routing_en.md +6 -5
  80. package/core/prompts/command_routing_zh.md +6 -5
  81. package/core/repair/rsi_rounds.py +3 -0
  82. package/core/repair/self_heal.py +160 -6
  83. package/core/retrieval/README.md +1 -1
  84. package/core/runtime/README.md +1 -1
  85. package/core/runtime/scenario_eval.py +5 -1
  86. package/core/runtime/setup_ui_env.py +4 -7
  87. package/core/runtime/tool_install_targets.py +12 -2
  88. package/core/skills/README.md +4 -2
  89. package/core/skills/bugx_docs_cloud_sync.py +658 -0
  90. package/core/skills/bugx_docs_mcp_server.py +966 -140
  91. package/core/supervisor/README.md +1 -1
  92. package/core/supervisor/cli.py +2 -2
  93. package/core/supervisor/worker_execution.py +16 -3
  94. package/core/webui/docs_session_service.py +40 -2
  95. package/core/webui/mcp_inspector.py +12 -6
  96. package/core/webui/static/index.html +51 -3
  97. package/core/webui/static/manifest.webmanifest +1 -1
  98. package/core/webui/static/project-settings.js +18 -3
  99. package/core/webui/static/robots.txt +36 -0
  100. package/core/webui/static/sitemap.xml +15 -0
  101. package/docs/07_distribution/01_README_NPM.md +26 -29
  102. package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
  103. package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
  104. package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
  105. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  106. package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +6 -6
  107. package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
  108. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  109. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +2 -2
  110. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  111. package/ecosystem/integrations/pi/skills/bugx/SKILL.md +6 -6
  112. package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
  113. package/ecosystem/integrations/qoder/connector-meta.json +9 -9
  114. package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
  115. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +8 -7
  116. package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
  117. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
  118. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
  119. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
  120. package/ecosystem/plugins/bugx/agents/bugx-worker.md +14 -18
  121. package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
  122. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +8 -8
  123. package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
  124. package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
  125. package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
  126. package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +3 -3
  127. package/interfaces/bin/bugx.js +2 -0
  128. package/interfaces/cli/bugx_cli/__init__.py +2 -2
  129. package/interfaces/cli/bugx_cli/cli.py +153 -8
  130. package/interfaces/cli/bugx_cli/commands/agent.py +568 -136
  131. package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
  132. package/interfaces/cli/bugx_cli/commands/doctor.py +668 -223
  133. package/interfaces/cli/bugx_cli/commands/guide.py +143 -0
  134. package/interfaces/cli/bugx_cli/commands/issue.py +262 -0
  135. package/interfaces/cli/bugx_cli/commands/lifecycle.py +99 -62
  136. package/interfaces/cli/bugx_cli/commands/plugin.py +301 -60
  137. package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
  138. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
  139. package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +440 -0
  140. package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +522 -0
  141. package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
  142. package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
  143. package/interfaces/cli/bugx_cli/commands/system.py +75 -5
  144. package/interfaces/cli/bugx_cli/common.py +135 -15
  145. package/interfaces/cli/bugx_cli/host_adapters.py +190 -7
  146. package/interfaces/cli/bugx_cli/hosts/registry.py +6 -3
  147. package/interfaces/cli/bugx_cli/hosts/template_engine.py +31 -11
  148. package/interfaces/cli/bugx_cli/infra/__init__.py +4 -0
  149. package/interfaces/cli/bugx_cli/infra/ai_advisor.py +14 -12
  150. package/interfaces/cli/bugx_cli/infra/engine_installer.py +76 -10
  151. package/interfaces/cli/bugx_cli/infra/host_sync.py +66 -1
  152. package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +242 -52
  153. package/package.json +38 -13
  154. package/pyproject.toml +57 -13
  155. package/scripts/sync-version.mjs +1 -1
  156. package/skills/README.md +24 -0
  157. package/skills/platform/bugx/SKILL.md +50 -0
@@ -0,0 +1,153 @@
1
+ """Antigravity ACP adapter.
2
+
3
+ ``agy acp`` is a real ACP v1 server. Authentication remains an external
4
+ precondition owned by Antigravity; the adapter must expose the correct command
5
+ and let the probe report ``Authentication required`` instead of hiding it as a
6
+ missing/unsupported ACP implementation.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ import os
13
+ from pathlib import Path
14
+ import sys
15
+ import tempfile
16
+ from typing import Any
17
+
18
+ from .base import AcpPlugin
19
+
20
+
21
+ class AntigravityAcpPlugin(AcpPlugin):
22
+ name = "antigravity"
23
+ executable = "agy"
24
+ status = "ready"
25
+ supports_project_permissions = False
26
+
27
+ def acp_argv(
28
+ self,
29
+ *,
30
+ model: str | None = None,
31
+ data_dir: Path | str | None = None,
32
+ ) -> list[str]:
33
+ # Antigravity exposes no model/data-dir ACP flags. The selected Agent
34
+ # is explicit so ACP cannot silently fall back to the default Agent.
35
+ # The official ACP flag is required for an unattended client to execute
36
+ # MCP calls; otherwise Antigravity emits a permission request that a
37
+ # headless ACP client cannot approve and the tool call is denied.
38
+ del model, data_dir
39
+ return [
40
+ "agy", "acp", "--agent", "BugX",
41
+ "--dangerously-skip-permissions", "--disable-telemetry",
42
+ ]
43
+
44
+ def launch_policy(self) -> dict[str, object]:
45
+ return {
46
+ "auto_approve": True,
47
+ "auto_approve_flag": "--dangerously-skip-permissions",
48
+ "model_flag": None,
49
+ "reason": (
50
+ "Antigravity ACP 使用缓存登录凭据;无人值守 MCP 探活必须使用官方 "
51
+ "--dangerously-skip-permissions,否则 ACP 客户端无法批准工具请求;"
52
+ "无凭据时由宿主返回 Authentication required"
53
+ ),
54
+ }
55
+
56
+ def ensure_probe_servers(
57
+ self,
58
+ project_root: Path,
59
+ config_paths: tuple[Path, ...],
60
+ servers: dict[str, dict[str, Any]],
61
+ ) -> list[str]:
62
+ """重绑隔离项目的 MCP,并保持 ACP 冷启动的直通引擎启动器。
63
+
64
+ Antigravity 会在 ACP 会话建立前预加载 stdio MCP。探针项目是从真实项目
65
+ 复制出来的,不能沿用真实项目的绝对 ``--root``;而通用探针定义使用完整
66
+ ``bugx`` CLI,在 Windows 冷启动窗口内又可能超时。因此这里由宿主适配器
67
+ 重建三条 BugX 条目:解释器直接执行已安装引擎的 ``skills/*_mcp_server.py``。
68
+ 只允许改写探针项目内部的 ``.agents/mcp_config.json``。
69
+ """
70
+ project_root = Path(project_root).resolve()
71
+ engine_override = os.environ.get("BUGX_GLOBAL_ENGINE_ROOT", "").strip()
72
+ engine_root = (
73
+ Path(engine_override).expanduser().resolve()
74
+ if engine_override
75
+ else (Path.home() / ".bugx" / "core").resolve()
76
+ )
77
+ python = str(Path(sys.executable).resolve())
78
+ expected: dict[str, dict[str, Any]] = {}
79
+ roles = {
80
+ "bugx-supervisor": "host",
81
+ "bugx-supervisor-worker": "worker",
82
+ }
83
+ for name, role in roles.items():
84
+ script = engine_root / "skills" / "bugx_mcp_server.py"
85
+ if not script.is_file():
86
+ raise ValueError(f"Antigravity 探活缺少 BugX 引擎脚本: {script}")
87
+ expected[name] = {
88
+ "type": "stdio",
89
+ "command": python,
90
+ "args": [
91
+ str(script), "serve", "--root", str(project_root),
92
+ "--role", role,
93
+ ],
94
+ }
95
+ docs_script = engine_root / "skills" / "bugx_docs_mcp_server.py"
96
+ if not docs_script.is_file():
97
+ raise ValueError(f"Antigravity 探活缺少 BugX 文档引擎脚本: {docs_script}")
98
+ expected["bugx-docs"] = {
99
+ "type": "stdio",
100
+ "command": python,
101
+ "args": [
102
+ str(docs_script), "serve", "--root", str(project_root),
103
+ "--db", str(project_root / ".bugx" / "knowledge" / "docs.sqlite3"),
104
+ ],
105
+ }
106
+ # ``servers`` 是探针的通用输入;名称集合仍由探针控制,具体命令由本适配器
107
+ # 收敛为直通引擎定义,避免隐式接受第三方条目。
108
+ names = [name for name in expected if name in servers]
109
+ updated: list[str] = []
110
+ for path in config_paths:
111
+ try:
112
+ resolved = path.resolve()
113
+ except OSError:
114
+ continue
115
+ if project_root not in resolved.parents or resolved.is_symlink() or not resolved.is_file():
116
+ continue
117
+ try:
118
+ payload = json.loads(resolved.read_text(encoding="utf-8"))
119
+ except (OSError, UnicodeError, ValueError):
120
+ continue
121
+ if not isinstance(payload, dict):
122
+ continue
123
+ block = payload.get("mcpServers")
124
+ if not isinstance(block, dict):
125
+ block = {}
126
+ payload["mcpServers"] = block
127
+ changed = False
128
+ for name in names:
129
+ if block.get(name) != expected[name]:
130
+ block[name] = expected[name]
131
+ changed = True
132
+ if name not in updated:
133
+ updated.append(name)
134
+ if not changed:
135
+ continue
136
+ mode = resolved.stat().st_mode & 0o777
137
+ fd, tmp_name = tempfile.mkstemp(
138
+ prefix=f".{resolved.name}.", suffix=".tmp", dir=resolved.parent,
139
+ )
140
+ tmp = Path(tmp_name)
141
+ try:
142
+ with os.fdopen(fd, "w", encoding="utf-8") as stream:
143
+ stream.write(json.dumps(payload, ensure_ascii=False, indent=2) + "\n")
144
+ stream.flush()
145
+ os.fsync(stream.fileno())
146
+ os.chmod(tmp, mode)
147
+ os.replace(tmp, resolved)
148
+ finally:
149
+ tmp.unlink(missing_ok=True)
150
+ return updated
151
+
152
+
153
+ PLUGIN = AntigravityAcpPlugin
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env python3
2
+ """core/host_acp/kimi.py - Kimi Code CLI 的 ACP 适配插件。
3
+
4
+ 实机口径(``kimi 2.1.1``,2026-11-23 实测):
5
+
6
+ * ACP 入口为 ``kimi acp``,通过 stdio 运行标准 JSON-RPC 2.0 Agent Client Protocol
7
+ (``initialize`` 返回 ``protocolVersion: 1``、``agentInfo.name: "Kimi Code CLI"``)。
8
+ * ``kimi acp --help`` 仅接受 ``--login`` 与 ``--region``,无 ``--dir`` / ``--model`` /
9
+ ``--data-dir`` flag;工作区绑定由探针子进程 ``cwd=<probe_root>`` 与 ``session/new``
10
+ 参数提供。
11
+ * 项目级 MCP 配置位于 ``.kimi-code/mcp.json``,容器键为标准 ``mcpServers``
12
+ (``{"command": "...", "args": [...]}``),优先级高于用户级
13
+ ``<KIMI_CODE_HOME>/mcp.json``(默认 ``~/.kimi-code/mcp.json``)。
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import json
19
+ import os
20
+ import shutil
21
+ from pathlib import Path
22
+ from typing import Any
23
+
24
+ from .base import AcpPlugin
25
+
26
+ __all__ = ["KimiAcpPlugin", "PLUGIN", "is_available", "run_static_degraded"]
27
+
28
+ _HOST_NAME = __name__.rsplit(".", 1)[-1]
29
+
30
+
31
+ def _kimi_code_home() -> Path:
32
+ configured = os.environ.get("KIMI_CODE_HOME")
33
+ if configured and configured.strip():
34
+ return Path(configured).expanduser()
35
+ return Path.home() / ".kimi-code"
36
+
37
+
38
+ def _resolve_kimi_executable() -> str | None:
39
+ found = shutil.which("kimi")
40
+ if found:
41
+ return found
42
+ bin_dir = _kimi_code_home() / "bin"
43
+ names = ("kimi.exe", "kimi.cmd", "kimi.bat", "kimi") if os.name == "nt" else ("kimi",)
44
+ for name in names:
45
+ fallback = bin_dir / name
46
+ if fallback.is_file():
47
+ return str(fallback)
48
+ return None
49
+
50
+
51
+ class KimiAcpPlugin(AcpPlugin):
52
+ """Kimi Code CLI ACP 插件。"""
53
+
54
+ name = _HOST_NAME
55
+ executable = "kimi"
56
+ status = "ready"
57
+ supports_project_permissions = False
58
+
59
+ def acp_argv(
60
+ self,
61
+ *,
62
+ model: str | None = None,
63
+ data_dir: Path | str | None = None,
64
+ ) -> list[str]:
65
+ del model, data_dir
66
+ return [_resolve_kimi_executable() or self.executable, "acp"]
67
+
68
+ def launch_policy(self) -> dict[str, Any]:
69
+ """返回 Kimi Code CLI 的 ACP 启动策略。"""
70
+ return {
71
+ "auto_approve": False,
72
+ "auto_approve_flag": None,
73
+ "model_flag": None,
74
+ "reason": "kimi acp 无 --model/--dir flag;工作区由 cwd 绑定,通过 ACP 协议交互",
75
+ }
76
+
77
+ def ensure_probe_servers(
78
+ self,
79
+ project_root: Path,
80
+ config_paths: tuple[Path, ...],
81
+ servers: dict[str, dict[str, Any]],
82
+ ) -> list[str]:
83
+ """将 BugX 通道写入探活项目内部的 ``.kimi-code/mcp.json``(标准 ``mcpServers`` 形状)。"""
84
+ updated: list[str] = []
85
+ root_resolved = project_root.resolve()
86
+ targets = list(config_paths) or [root_resolved / ".kimi-code" / "mcp.json"]
87
+ for path in targets:
88
+ try:
89
+ resolved = path.resolve()
90
+ except OSError:
91
+ continue
92
+ if root_resolved not in resolved.parents and resolved.parent != root_resolved:
93
+ continue # 严格限定只写探活项目内部
94
+ payload: dict[str, Any] = {}
95
+ if resolved.is_file() and not resolved.is_symlink():
96
+ try:
97
+ loaded = json.loads(resolved.read_text(encoding="utf-8"))
98
+ if isinstance(loaded, dict):
99
+ payload = loaded
100
+ except (OSError, UnicodeError, ValueError):
101
+ payload = {}
102
+ mcp_servers = payload.get("mcpServers")
103
+ if not isinstance(mcp_servers, dict):
104
+ mcp_servers = {}
105
+ payload["mcpServers"] = mcp_servers
106
+ changed = False
107
+ for name, spec in servers.items():
108
+ command = spec.get("command")
109
+ args = spec.get("args") or []
110
+ if not isinstance(command, str) or not command:
111
+ raise ValueError(f"无效的探活 MCP 命令: {name}")
112
+ if not isinstance(args, (list, tuple)):
113
+ raise ValueError(f"无效的探活 MCP 参数: {name}")
114
+ expected: dict[str, Any] = {
115
+ "command": command,
116
+ "args": [str(item) for item in args],
117
+ }
118
+ env = spec.get("env")
119
+ if isinstance(env, dict) and env:
120
+ expected["env"] = {str(k): str(v) for k, v in env.items()}
121
+ if mcp_servers.get(name) != expected:
122
+ mcp_servers[name] = expected
123
+ changed = True
124
+ if changed or not resolved.exists():
125
+ resolved.parent.mkdir(parents=True, exist_ok=True)
126
+ resolved.write_text(
127
+ json.dumps(payload, indent=2, ensure_ascii=False) + "\n",
128
+ encoding="utf-8",
129
+ )
130
+ updated.append(str(resolved))
131
+ return updated
132
+
133
+
134
+ PLUGIN = KimiAcpPlugin
135
+
136
+
137
+ def is_available() -> tuple[bool, str]:
138
+ """降级契约:机械探活 Kimi Code CLI 是否安装(零子进程)。"""
139
+ path = _resolve_kimi_executable()
140
+ if path is None:
141
+ return False, "kimi 可执行文件未安装;ACP 适配器无法拉起真实会话"
142
+ return True, path
143
+
144
+
145
+ def run_static_degraded(root: Path | None = None) -> dict:
146
+ """宿主 CLI 缺失/降级时的静态输出:只声明适配器事实,绝不伪装 ACP 会话。"""
147
+ available, availability_detail = is_available()
148
+ plugin = PLUGIN()
149
+ return {
150
+ "adapter": f"core/host_acp/{plugin.name}.py",
151
+ "plugin": plugin.name,
152
+ "schema_version": 1,
153
+ "success": available,
154
+ "status": "degraded",
155
+ "degraded": True,
156
+ "degraded_reason": (
157
+ "static_facts_only" if available else f"{plugin.name}_cli_not_installed"
158
+ ),
159
+ "probe_mode": "static_degraded",
160
+ "acp_status": plugin.status,
161
+ "acp_supported": plugin.supports_acp(),
162
+ "acp_reason": plugin.reason or None,
163
+ "executable": plugin.executable,
164
+ "mcp_health": "unknown",
165
+ "findings": [],
166
+ "evidence": {
167
+ "availability_detail": availability_detail,
168
+ "project_root": str(root) if root else None,
169
+ },
170
+ "metadata": {
171
+ "degraded_mode": "static_adapter_facts_only",
172
+ "mcp_probing": "deferred_to_host_probe_chain",
173
+ "fallback": "宿主 CLI 缺失时由外层宿主/用户决策接管;BugX 不代装宿主 CLI",
174
+ },
175
+ }
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env python3
2
+ """core/host_acp/minimax.py - MiniMax Code ACP capability declaration.
3
+
4
+ MiniMax Code's installed desktop package exposes Plugin V1, MCP and Agent
5
+ manifests. A standard ACP entry point was not found in the inspected package,
6
+ so this is an explicit upstream-capability declaration, not an unfinished local
7
+ adapter.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from .base import AcpPlugin
13
+
14
+ __all__ = ["MiniMaxAcpPlugin", "PLUGIN"]
15
+
16
+
17
+ class MiniMaxAcpPlugin(AcpPlugin):
18
+ name = "minimax"
19
+ executable = "mcode"
20
+ status = "unavailable"
21
+ reason = (
22
+ "MiniMax Code 3.1.0 桌面包已取证 Plugin V1、MCP 与 Agent 能力,"
23
+ "但未取证到标准 ACP 入口;ACP 探活不伪造命令行参数。"
24
+ )
25
+ supports_project_permissions = False
26
+
27
+
28
+ PLUGIN = MiniMaxAcpPlugin
@@ -49,6 +49,8 @@ class HostAdapter:
49
49
  name = "unknown"
50
50
  executable = ""
51
51
  host_surface = "tui"
52
+ mcp_config_container: str | None = None
53
+ merge_mcp_config_fields = True
52
54
 
53
55
  def is_callable(self, root: Path) -> bool:
54
56
  """Return whether this host has a callable local entry point.
@@ -246,6 +248,8 @@ class QoderAdapter(HostAdapter):
246
248
 
247
249
  name = "qoder"
248
250
  executable = "qoder"
251
+ mcp_config_container = "mcpServers"
252
+ merge_mcp_config_fields = False
249
253
 
250
254
  def headless_run(self, root: Path, agent: str, session: str, prompt: str) -> list[str]:
251
255
  return ["qoder", "run", "--prompt", prompt]
@@ -254,7 +258,7 @@ class QoderAdapter(HostAdapter):
254
258
  return root / ".qoder"
255
259
 
256
260
  def mcp_config_paths(self, root: Path) -> tuple[Path, ...]:
257
- return (root / ".qoder" / "mcp.json",)
261
+ return (root / ".qoder" / "settings.json", root / ".mcp.json")
258
262
 
259
263
  def required_mcp(self, root: Path) -> list[str]:
260
264
  return list(MCP_CATALOG)
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env python3
2
+ """Antigravity Worker process executor.
3
+
4
+ The Agent, not this module, owns the BugX lifecycle decisions. This module
5
+ only starts one bounded ``agy`` Worker process after a claim exists, binds it to
6
+ the requested workspace, and refuses to report success without a Supervisor
7
+ checkpoint.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import os
13
+ import shutil
14
+ import subprocess
15
+ from pathlib import Path
16
+ from typing import Any
17
+
18
+ import core.hosts as host_plugins
19
+
20
+ from .common import (
21
+ WorkerRuntimeError,
22
+ claim_checkpoint_id,
23
+ terminate_process_group,
24
+ )
25
+
26
+ __all__ = ["execute_worker"]
27
+
28
+
29
+ _HOST_NAME = __name__.rsplit(".", 1)[-1]
30
+ _PLUGIN = host_plugins.get(_HOST_NAME)
31
+ if _PLUGIN is None: # pragma: no cover - plugin removal is an import-time defect
32
+ raise RuntimeError(f"{__name__} 需要 core/hosts/{_HOST_NAME}.py 声明;插件缺失")
33
+
34
+ _NAME = _PLUGIN.name
35
+ _PROVIDER_KEY = _PLUGIN.worker_runtime.provider_key or _NAME
36
+
37
+
38
+ def execute_worker(
39
+ workspace_root: Path,
40
+ claim: Any,
41
+ task_spec: str,
42
+ *,
43
+ supervisor: Any,
44
+ stage_name: str,
45
+ executable: str | None = None,
46
+ model: str | None = None,
47
+ provider: str | None = None,
48
+ ) -> dict[str, Any]:
49
+ """Run one pre-claimed Antigravity Worker and require a checkpoint."""
50
+
51
+ del provider
52
+ from core.supervisor.worker_runtime import resolve_worker_timeout
53
+
54
+ failure = f"{_NAME}_worker_failed"
55
+ root = workspace_root.resolve()
56
+ worker_id = getattr(claim, "worker_id", str(claim))
57
+ execution_id = getattr(claim, "execution_id", f"exec-{worker_id}")
58
+ artifact_root_rel = getattr(claim, "artifact_root", "")
59
+ if artifact_root_rel:
60
+ artifact_dir = (root / artifact_root_rel).resolve()
61
+ if artifact_dir != root and root not in artifact_dir.parents:
62
+ raise WorkerRuntimeError(f"{failure}: claim artifact_root 越界")
63
+ artifact_dir.mkdir(parents=True, exist_ok=True)
64
+
65
+ profile_budget = getattr(_PLUGIN.worker_runtime, "worker_timeout_seconds", None)
66
+ base_override = (
67
+ float(profile_budget)
68
+ if isinstance(profile_budget, (int, float))
69
+ and not isinstance(profile_budget, bool)
70
+ and profile_budget > 0
71
+ else None
72
+ )
73
+ timeout_seconds = resolve_worker_timeout(
74
+ model_tier={
75
+ "exploit": "tier_2_exploit",
76
+ "verify": "tier_3_verify",
77
+ }.get(str(stage_name).split("-")[-1], "tier_1_recon"),
78
+ attempt=int(getattr(claim, "attempt", 1) or 1),
79
+ base_override=base_override,
80
+ )
81
+
82
+ host_executable = executable or shutil.which("agy") or "agy"
83
+ command = [
84
+ host_executable,
85
+ "--agent", "bugx-worker",
86
+ "--mode", "auto",
87
+ "--dangerously-skip-permissions",
88
+ "--add-dir", str(root),
89
+ "--output-format", "json",
90
+ "-p", task_spec,
91
+ ]
92
+ if model:
93
+ command[3:3] = ["--model", str(model)]
94
+
95
+ environment = os.environ.copy()
96
+ popen_kwargs: dict[str, Any] = {
97
+ "cwd": str(root),
98
+ "env": environment,
99
+ "stdout": subprocess.PIPE,
100
+ "stderr": subprocess.PIPE,
101
+ "text": True,
102
+ }
103
+ if os.name == "posix":
104
+ popen_kwargs["preexec_fn"] = os.setsid
105
+ elif os.name == "nt": # pragma: no cover - exercised on Windows hosts
106
+ popen_kwargs["creationflags"] = getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)
107
+
108
+ process = subprocess.Popen(command, **popen_kwargs)
109
+ try:
110
+ supervisor.start_worker(
111
+ worker_id,
112
+ provider=_PROVIDER_KEY,
113
+ execution_id=execution_id,
114
+ process_pid=process.pid,
115
+ )
116
+ except Exception:
117
+ terminate_process_group(process)
118
+ try:
119
+ process.communicate(timeout=5)
120
+ except (subprocess.TimeoutExpired, OSError):
121
+ terminate_process_group(process, force=True)
122
+ raise
123
+
124
+ try:
125
+ stdout, stderr = process.communicate(timeout=timeout_seconds)
126
+ except subprocess.TimeoutExpired as exc:
127
+ terminate_process_group(process)
128
+ try:
129
+ stdout, stderr = process.communicate(timeout=5)
130
+ except (subprocess.TimeoutExpired, OSError):
131
+ terminate_process_group(process, force=True)
132
+ stdout, stderr = "", ""
133
+ checkpoint_id = claim_checkpoint_id(supervisor, worker_id, execution_id)
134
+ if checkpoint_id is None:
135
+ raise WorkerRuntimeError(
136
+ f"{failure}: timeout after {timeout_seconds:.1f}s"
137
+ ) from exc
138
+ return {
139
+ "worker_id": worker_id,
140
+ "checkpoint_id": checkpoint_id,
141
+ "status": "checkpointed",
142
+ "exit_code": process.returncode,
143
+ "stdout": (stdout or "")[-2000:],
144
+ "stderr": (stderr or "")[-2000:],
145
+ }
146
+
147
+ checkpoint_id = claim_checkpoint_id(supervisor, worker_id, execution_id)
148
+ if checkpoint_id is None:
149
+ detail = (stderr or stdout or "").strip()[-500:]
150
+ raise WorkerRuntimeError(
151
+ f"{failure}: process exited without a valid Checkpoint"
152
+ + (f": {detail}" if detail else "")
153
+ )
154
+ return {
155
+ "worker_id": worker_id,
156
+ "checkpoint_id": checkpoint_id,
157
+ "status": "checkpointed",
158
+ "exit_code": process.returncode,
159
+ "stdout": (stdout or "")[-2000:],
160
+ "stderr": (stderr or "")[-2000:],
161
+ }
162
+
@@ -189,8 +189,23 @@ def _extract_json_object(output: str) -> dict | None:
189
189
  return None
190
190
 
191
191
 
192
- def _builtin_mcp_servers() -> dict[str, dict[str, object]]:
193
- """Return the three fixed BugX local MCP registrations."""
192
+ def _builtin_mcp_servers(
193
+ *, docs_transport: str = "stdio", remote_url: str | None = None,
194
+ ) -> dict[str, dict[str, object]]:
195
+ """Return the three fixed BugX MCP registrations."""
196
+ if docs_transport == "remote":
197
+ from core.skills.bugx_docs_cloud_sync import contract_version_of, resolve_remote_base_url
198
+ base = resolve_remote_base_url(remote_url)
199
+ ver = contract_version_of()
200
+ docs_entry: dict[str, object] = {
201
+ "url": f"{base}/api/v1/mcp/docs?contract_version={ver}",
202
+ }
203
+ else:
204
+ docs_entry = {
205
+ "command": "bugx",
206
+ "args": ["mcp", "docs", "serve", "--root", ".",
207
+ "--db", ".bugx/knowledge/docs.sqlite3"],
208
+ }
194
209
  return {
195
210
  "bugx-supervisor": {
196
211
  "command": "bugx",
@@ -200,11 +215,7 @@ def _builtin_mcp_servers() -> dict[str, dict[str, object]]:
200
215
  "command": "bugx",
201
216
  "args": ["mcp", "serve", "--root", ".", "--role", "worker"],
202
217
  },
203
- "bugx-docs": {
204
- "command": "bugx",
205
- "args": ["mcp", "docs", "serve", "--root", ".",
206
- "--db", ".bugx/knowledge/docs.sqlite3"],
207
- },
218
+ "bugx-docs": docs_entry,
208
219
  }
209
220
 
210
221
 
@@ -62,13 +62,13 @@ DEFAULT_MODELS_BY_PROVIDER = {
62
62
  "openai-codex": "gpt-4o",
63
63
  "openai-native": "gpt-4o",
64
64
  "openai": "gpt-4o",
65
- "anthropic": "claude-3-5-sonnet-20241022",
66
- "google": "gemini-1.5-pro",
67
- "gemini": "gemini-1.5-pro",
65
+ "anthropic": "claude-sonnet-5-5",
66
+ "google": "gemini-4-carbon",
67
+ "gemini": "gemini-4-carbon",
68
68
  "deepseek": "deepseek-chat",
69
69
  "bigmodel": "GLM-5.3",
70
70
  "zai": "glm-4.7",
71
- "cline": "claude-3-5-sonnet-20241022",
71
+ "cline": "claude-sonnet-5-5",
72
72
  "9router": "9dev",
73
73
  "ocsg": "deepseek-v4.1-flash-1017",
74
74
  }
@@ -38,6 +38,9 @@ SUPPORTED_HOSTS: tuple[str, ...] = (
38
38
  "cline",
39
39
  "zcode",
40
40
  "dsh",
41
+ "kimi",
42
+ "minimax",
43
+ "antigravity",
41
44
  "chatgpt",
42
45
  "workbuddy",
43
46
  "qoder",
@@ -64,7 +67,7 @@ HOST_MARKERS: dict[str, tuple[str, ...]] = {
64
67
  ".workbuddy",
65
68
  ".codebuddy",
66
69
  ),
67
- "qoder": (".qoder", ".qoder/config.json", ".qoder/mcp.json"),
70
+ "qoder": (".qoder",),
68
71
  # 真实 Trae / Trae CN 打开过的项目只会有 .trae/ 或 .trae-cn/ 目录;.trea 是 BugX 安装面。
69
72
  "trea": (".trea", ".trea/agent.yml", ".trea/mcp.json", ".trae", ".trae-cn"),
70
73
  "funide": (".github/agents/bugx.agent.md",),
@@ -87,15 +90,33 @@ _apply_plugin_markers(HOST_MARKERS)
87
90
  #: 已迁移插件(只读视图):宿主事实的唯一来源。
88
91
  _HOST_PLUGINS = MappingProxyType(dict(host_plugins.PLUGINS))
89
92
 
90
- # FunIDE 当前确认的是桌面 Copilot Agent UI,尚未确认独立的
91
- # AskUserQuestion 原生工具;保持安全默认,交互交给外层控制器或 TTY。
92
- NATIVE_QUESTION_HOSTS: frozenset[str] = frozenset(SUPPORTED_HOSTS) - {"funide"}
93
+ # 未迁移宿主的交互事实仍由旧基线维护;已迁移宿主直接读取插件身份面。
94
+ _LEGACY_NON_NATIVE_QUESTION_HOSTS: frozenset[str] = frozenset({"funide"})
95
+ NATIVE_QUESTION_HOSTS: frozenset[str] = frozenset(
96
+ name for name in SUPPORTED_HOSTS
97
+ if (
98
+ (
99
+ name in _HOST_PLUGINS
100
+ and _HOST_PLUGINS[name].identity.native_question
101
+ )
102
+ or (
103
+ name not in _HOST_PLUGINS
104
+ and name not in _LEGACY_NON_NATIVE_QUESTION_HOSTS
105
+ )
106
+ )
107
+ )
93
108
 
94
109
  # 宿主可执行名别名 → 规范宿主名。进程树识别必须经此归一化,避免
95
110
  # 「同一宿主多个可执行名」散落在各调用点。
96
111
  HOST_EXECUTABLE_ALIASES: dict[str, str] = {
97
112
  "claude-code": "claude",
98
113
  "deepseek": "dsh",
114
+ "kimi-code": "kimi",
115
+ "kimicode": "kimi",
116
+ "minimax-code": "minimax",
117
+ "minimaxcode": "minimax",
118
+ "minimax code": "minimax",
119
+ "mcode": "minimax",
99
120
  "codebuddy": "workbuddy",
100
121
  "codebuddy-lite-wb": "workbuddy",
101
122
  "qoder-cli": "qoder",