bugx-cli 0.1.5 → 0.1.6
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.
- package/README.md +89 -210
- package/core/README.md +1 -1
- package/core/agent/agent_targets.py +5 -1
- package/core/agent/agent_workspace.py +10 -2
- package/core/autonomous_cve/run_fault_matrix.py +692 -0
- package/core/autonomous_cve/run_oss_cve_exploit_verify.py +608 -0
- package/core/autonomous_cve/run_six_worker_penetration.py +382 -0
- package/core/autonomous_cve/verifier.py +5 -7
- package/core/bugx.md +1 -1
- package/core/bugx_paths.py +2 -2
- package/core/bundled_docs/OVERVIEW.md +69 -236
- package/core/bundled_docs/README.md +2 -2
- package/core/bundled_docs/README_EN.md +67 -211
- package/core/bundled_docs/ai/01_AI_REFERENCE.md +3 -3
- package/core/bundled_docs/ai/02_AI_USAGE.md +1 -1
- package/core/bundled_docs/ai/03_AI_COMMANDS.md +1 -1
- package/core/bundled_docs/hosts/bugx_SKILL.md +2 -2
- package/core/bundled_docs/hosts/platform_bugx_SKILL.md +2 -2
- package/core/bundled_docs/manifest.json +10 -10
- package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +1 -1
- package/core/cloud_sync/flywheel_client.py +89 -0
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/coverage/coverage_gate.py +12 -2
- package/core/coverage/coverage_manifest.py +1 -1
- package/core/coverage/coverage_validate.py +5 -3
- package/core/engine-integrity.json +104 -92
- package/core/host_runtime/adapters.py +45 -6
- package/core/host_runtime/autonomous_runner.py +3 -2
- package/core/host_runtime/host_registry.py +6 -1
- package/core/hosts/__init__.py +1 -0
- package/core/hosts/agnescode.py +1 -1
- package/core/hosts/base.py +1 -0
- package/core/hosts/claude.py +6 -0
- package/core/hosts/cline.py +6 -0
- package/core/hosts/codex.py +10 -1
- package/core/hosts/kimi.py +6 -4
- package/core/hosts/opencode.py +1 -1
- package/core/hosts/zcode.py +6 -0
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/startup_gates.py +10 -1
- package/core/launch_phases/startup_version_gate.py +2 -2
- package/core/ledger/README.md +1 -1
- package/core/locales/en-US.json +2 -0
- package/core/locales/zh-CN.json +2 -0
- package/core/mcp_handlers/supervisor_handlers.py +33 -1
- package/core/mcp_handlers/telemetry_handlers.py +32 -0
- package/core/mcp_handlers/tool_table.py +34 -0
- package/core/metadata.txt +1 -1
- package/core/planning/README.md +1 -1
- package/core/retrieval/README.md +1 -1
- package/core/retrieval/symbol_index.py +2 -1
- package/core/retrieval/universal_code_matcher.py +1 -0
- package/core/runtime/README.md +1 -1
- package/core/runtime/mining_quality_framework.py +2 -1
- package/core/runtime/scenario_eval.py +5 -2
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/worker_execution.py +5 -0
- package/docs/07_distribution/01_README_NPM.md +89 -210
- package/ecosystem/integrations/dsh/mcp/package.json +2 -2
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
- package/interfaces/cli/bugx_cli/__init__.py +1 -1
- package/interfaces/cli/bugx_cli/commands/agent.py +18 -0
- package/interfaces/cli/bugx_cli/commands/audit.py +3 -5
- package/interfaces/cli/bugx_cli/commands/doctor.py +1 -1
- package/interfaces/cli/bugx_cli/commands/plugin.py +20 -0
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
- package/interfaces/cli/bugx_cli/host_adapters.py +161 -1
- package/interfaces/cli/bugx_cli/hosts/registry.py +32 -0
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +4 -4
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/package.json +1 -1
- package/scripts/sync-version.mjs +1 -1
- package/skills/platform/bugx/SKILL.md +2 -2
|
@@ -187,10 +187,11 @@ class RealHooks:
|
|
|
187
187
|
def agent(self, root: Path, ctx: dict, baseline: str) -> tuple[int, AgentRun]:
|
|
188
188
|
prompt = ctx.get("prompt", "继续审计本轮")
|
|
189
189
|
session = ctx.get("session", "")
|
|
190
|
+
model = ctx.get("model") or getattr(self, "model", None)
|
|
190
191
|
cmd = (
|
|
191
|
-
self.adapter.autonomous_run(root, "bugx", session, prompt)
|
|
192
|
+
self.adapter.autonomous_run(root, "bugx", session, prompt, model=model)
|
|
192
193
|
if self.autonomous else
|
|
193
|
-
self.adapter.headless_run(root, "bugx", session, prompt)
|
|
194
|
+
self.adapter.headless_run(root, "bugx", session, prompt, model=model)
|
|
194
195
|
)
|
|
195
196
|
try:
|
|
196
197
|
timeout = self._remaining_timeout(self.agent_timeout)
|
|
@@ -47,6 +47,7 @@ SUPPORTED_HOSTS: tuple[str, ...] = (
|
|
|
47
47
|
"qoder",
|
|
48
48
|
"trea",
|
|
49
49
|
"funide",
|
|
50
|
+
"copilot",
|
|
50
51
|
)
|
|
51
52
|
|
|
52
53
|
# ``unknown`` 是「无法识别」这一一等结果,不是宿主,恒排在最后。
|
|
@@ -72,6 +73,7 @@ HOST_MARKERS: dict[str, tuple[str, ...]] = {
|
|
|
72
73
|
# 真实 Trae / Trae CN 打开过的项目只会有 .trae/ 或 .trae-cn/ 目录;.trea 是 BugX 安装面。
|
|
73
74
|
"trea": (".trea", ".trea/agent.yml", ".trea/mcp.json", ".trae", ".trae-cn"),
|
|
74
75
|
"funide": (".github/agents/bugx.agent.md",),
|
|
76
|
+
"copilot": (".github/copilot-instructions.md", ".github/agents/bugx.agent.md", ".vscode/mcp.json"),
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
|
|
@@ -129,6 +131,9 @@ HOST_EXECUTABLE_ALIASES: dict[str, str] = {
|
|
|
129
131
|
"trea-cn": "trea",
|
|
130
132
|
"trea_cn": "trea",
|
|
131
133
|
"trae-ai": "trea",
|
|
134
|
+
"github-copilot": "copilot",
|
|
135
|
+
"gh-copilot": "copilot",
|
|
136
|
+
"copilot-chat": "copilot",
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
|
|
@@ -287,7 +292,7 @@ def host_requires_pid(name: object) -> bool:
|
|
|
287
292
|
#: 尚未迁移(``TODO_HOSTS``)但仍支持 MCP 写入的宿主。逐宿主切片时删除对应名字;
|
|
288
293
|
#: 已迁移插件一律由 ``mcp_write`` 面自行声明,不进本表。
|
|
289
294
|
LEGACY_MCP_WRITE_HOSTS: frozenset[str] = frozenset(
|
|
290
|
-
{"claude", "pi", "dsh", "chatgpt", "workbuddy", "codebuddy", "zcode", "qoder", "trea"}
|
|
295
|
+
{"claude", "pi", "dsh", "chatgpt", "workbuddy", "codebuddy", "zcode", "qoder", "trea", "copilot"}
|
|
291
296
|
)
|
|
292
297
|
|
|
293
298
|
|
package/core/hosts/__init__.py
CHANGED
package/core/hosts/agnescode.py
CHANGED
|
@@ -268,7 +268,7 @@ def _argv(ctx: RunContext, *, auto: bool) -> list[str]:
|
|
|
268
268
|
if auto:
|
|
269
269
|
cmd.append("--standalone")
|
|
270
270
|
cmd += ["--agent", ctx.agent, "--format", "json"]
|
|
271
|
-
model = _configured_model(ctx.root)
|
|
271
|
+
model = getattr(ctx, "model", None) or _configured_model(ctx.root)
|
|
272
272
|
if model:
|
|
273
273
|
cmd += ["--model", model]
|
|
274
274
|
if auto:
|
package/core/hosts/base.py
CHANGED
package/core/hosts/claude.py
CHANGED
|
@@ -61,6 +61,9 @@ def _headless_argv(ctx: RunContext) -> list[str]:
|
|
|
61
61
|
command = ["claude", "-p", ctx.prompt]
|
|
62
62
|
if ctx.session:
|
|
63
63
|
command[1:1] = ["--resume", ctx.session]
|
|
64
|
+
model = getattr(ctx, "model", None)
|
|
65
|
+
if model:
|
|
66
|
+
command += ["--model", model]
|
|
64
67
|
return command
|
|
65
68
|
|
|
66
69
|
|
|
@@ -68,6 +71,9 @@ def _autonomous_argv(ctx: RunContext) -> list[str]:
|
|
|
68
71
|
command = ["claude"]
|
|
69
72
|
if ctx.session:
|
|
70
73
|
command += ["--resume", ctx.session]
|
|
74
|
+
model = getattr(ctx, "model", None)
|
|
75
|
+
if model:
|
|
76
|
+
command += ["--model", model]
|
|
71
77
|
command += [
|
|
72
78
|
"-p", ctx.prompt,
|
|
73
79
|
"--output-format", "json",
|
package/core/hosts/cline.py
CHANGED
|
@@ -87,6 +87,9 @@ def _mcp_settings_path(root: Path) -> Path:
|
|
|
87
87
|
|
|
88
88
|
def _headless_argv(ctx: RunContext) -> list[str]:
|
|
89
89
|
command = ["cline", "--json"]
|
|
90
|
+
model = getattr(ctx, "model", None)
|
|
91
|
+
if model:
|
|
92
|
+
command += ["-m", model]
|
|
90
93
|
if ctx.session:
|
|
91
94
|
command += ["--id", ctx.session]
|
|
92
95
|
return [*command, ctx.prompt]
|
|
@@ -94,6 +97,9 @@ def _headless_argv(ctx: RunContext) -> list[str]:
|
|
|
94
97
|
|
|
95
98
|
def _autonomous_argv(ctx: RunContext) -> list[str]:
|
|
96
99
|
command = ["cline", "--json", "--auto-approve", "true"]
|
|
100
|
+
model = getattr(ctx, "model", None)
|
|
101
|
+
if model:
|
|
102
|
+
command += ["-m", model]
|
|
97
103
|
if ctx.session:
|
|
98
104
|
command += ["--id", ctx.session]
|
|
99
105
|
return [*command, ctx.prompt]
|
package/core/hosts/codex.py
CHANGED
|
@@ -172,11 +172,17 @@ def _headless_argv(ctx: RunContext) -> list[str]:
|
|
|
172
172
|
# workspace-write」(``codex exec --help``),与 ``_autonomous_argv`` 保持同一
|
|
173
173
|
# approval 语义:无头通道没有人类可以点「允许」,缺它等于让每个 Worker 的
|
|
174
174
|
# 控制面调用恒失败。
|
|
175
|
-
|
|
175
|
+
cmd = [
|
|
176
176
|
"codex", "exec", "--approve-for-me",
|
|
177
|
+
]
|
|
178
|
+
model = getattr(ctx, "model", None)
|
|
179
|
+
if model:
|
|
180
|
+
cmd += ["-m", model]
|
|
181
|
+
cmd += [
|
|
177
182
|
*_state_grants(),
|
|
178
183
|
ctx.prompt,
|
|
179
184
|
]
|
|
185
|
+
return cmd
|
|
180
186
|
|
|
181
187
|
|
|
182
188
|
_SCOUT_FEATURE_OPTIONS = (
|
|
@@ -319,6 +325,9 @@ def _autonomous_argv(ctx: RunContext) -> list[str]:
|
|
|
319
325
|
# 不加 ``--skip-git-repo-check``:Git 仓库由 ``pre`` 的 ``git_environment`` 门禁
|
|
320
326
|
# 保证(见 ``_headless_argv`` 注释与模块 docstring 的 ``git`` 面)。
|
|
321
327
|
command = ["codex", "exec", "--approve-for-me"]
|
|
328
|
+
model = getattr(ctx, "model", None)
|
|
329
|
+
if model:
|
|
330
|
+
command += ["-m", model]
|
|
322
331
|
# --approve-for-me keeps workspace-write; grant only this clone's Git metadata so
|
|
323
332
|
# its startup write probe and local commits work. worktree/submodule 的 ``.git``
|
|
324
333
|
# 是 gitfile,需要同时授权 gitdir 与 commondir(见 ``_git_metadata_dirs``)。
|
package/core/hosts/kimi.py
CHANGED
|
@@ -99,8 +99,9 @@ def _headless_argv(ctx: RunContext) -> list[str]:
|
|
|
99
99
|
command = [_resolve_kimi_executable() or "kimi", "-p", ctx.prompt]
|
|
100
100
|
if ctx.session:
|
|
101
101
|
command[1:1] = ["--session", ctx.session]
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
model = getattr(ctx, "model", None)
|
|
103
|
+
if model:
|
|
104
|
+
command += ["-m", model]
|
|
104
105
|
return command
|
|
105
106
|
|
|
106
107
|
|
|
@@ -108,8 +109,9 @@ def _autonomous_argv(ctx: RunContext) -> list[str]:
|
|
|
108
109
|
command = [_resolve_kimi_executable() or "kimi"]
|
|
109
110
|
if ctx.session:
|
|
110
111
|
command += ["--session", ctx.session]
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
model = getattr(ctx, "model", None)
|
|
113
|
+
if model:
|
|
114
|
+
command += ["-m", model]
|
|
113
115
|
command += [
|
|
114
116
|
"-p",
|
|
115
117
|
ctx.prompt,
|
package/core/hosts/opencode.py
CHANGED
|
@@ -258,7 +258,7 @@ def _argv(ctx: RunContext, *, auto: bool) -> list[str]:
|
|
|
258
258
|
# project instance can resolve shell work outside the requested root.
|
|
259
259
|
cmd.append("--standalone")
|
|
260
260
|
cmd += ["--agent", ctx.agent, "--format", "json"]
|
|
261
|
-
model = _configured_model(ctx.root)
|
|
261
|
+
model = getattr(ctx, "model", None) or _configured_model(ctx.root)
|
|
262
262
|
if model:
|
|
263
263
|
cmd += ["--model", model]
|
|
264
264
|
if auto:
|
package/core/hosts/zcode.py
CHANGED
|
@@ -119,6 +119,9 @@ def _headless_argv(ctx: RunContext) -> list[str]:
|
|
|
119
119
|
command = ["zcode", "-p", ctx.prompt, "--mode", "yolo", "--cwd", str(ctx.root)]
|
|
120
120
|
if ctx.session:
|
|
121
121
|
command += ["--resume", ctx.session]
|
|
122
|
+
model = getattr(ctx, "model", None)
|
|
123
|
+
if model:
|
|
124
|
+
command += ["-m", model]
|
|
122
125
|
return command
|
|
123
126
|
|
|
124
127
|
|
|
@@ -126,6 +129,9 @@ def _autonomous_argv(ctx: RunContext) -> list[str]:
|
|
|
126
129
|
command = ["zcode", "-p", ctx.prompt, "--mode", "yolo", "--json", "--cwd", str(ctx.root)]
|
|
127
130
|
if ctx.session:
|
|
128
131
|
command += ["--resume", ctx.session]
|
|
132
|
+
model = getattr(ctx, "model", None)
|
|
133
|
+
if model:
|
|
134
|
+
command += ["-m", model]
|
|
129
135
|
return command
|
|
130
136
|
|
|
131
137
|
|
package/core/infra/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Core Infrastructure & Primitives (核心基础设施与底层操作系统原语子系统)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.6` | **所属分层**: `Layer 0: 基础设施与操作系统抽象`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md) 与 [`docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md`](../../docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
package/core/infra/build_info.py
CHANGED
|
@@ -12,8 +12,8 @@ import re
|
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
|
|
14
14
|
VERSION_ENV = "BUGX_VERSION"
|
|
15
|
-
VERSION_TOKEN = "0.1.
|
|
16
|
-
_DEFAULT_VERSION = "0.1.
|
|
15
|
+
VERSION_TOKEN = "0.1.6"
|
|
16
|
+
_DEFAULT_VERSION = "0.1.6"
|
|
17
17
|
_VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$")
|
|
18
18
|
|
|
19
19
|
|
|
@@ -91,7 +91,7 @@ flowchart TD
|
|
|
91
91
|
| `startup_gates.py` | 启动前置安全门禁(文件树白名单、脏工作区检查、权限拦截) | `verify_startup_gates` |
|
|
92
92
|
| `startup_interaction.py` | 交互式问答决策引擎,根据终端能力与配置解析交互模式 | `resolve_startup_interaction` |
|
|
93
93
|
| `verify_loop.py` | 独立验证员盲审输入包构造、Anti-Gaming 校验与报错驱动 PoC 自纠错闭环 | `build_verify_bundle`, `execute_verify_attempt`, `run_verification_loop` |
|
|
94
|
-
| `startup_version_gate.py` | 版本硬门禁校验器,确保运行时版本严格等于 `0.1.
|
|
94
|
+
| `startup_version_gate.py` | 版本硬门禁校验器,确保运行时版本严格等于 `0.1.6` 绝不漂移 | `assert_version_integrity` |
|
|
95
95
|
| `supervisor_bridge.py` | Supervisor 模块间解耦桥接层,提供轻量化调用门面 | `SupervisorBridge` |
|
|
96
96
|
| `supervisor_coverage.py` | 覆盖率生命周期继承器,支持空闲历史会话继承与动态分发 | `SupervisorCoverageSync` |
|
|
97
97
|
| `supervisor_degraded.py` | 降级容灾与探针就地自愈控制器,无损处理缺失依赖与环境 | `SupervisorDegradedCoordinator` |
|
|
@@ -103,7 +103,7 @@ flowchart TD
|
|
|
103
103
|
|
|
104
104
|
## 3. 核心设计契约与公理 (Design Axioms)
|
|
105
105
|
|
|
106
|
-
1. **版本绝对固化公理**:`startup_version_gate.py` 必须在任何业务逻辑启动前执行,基线版本严格锁定在 `0.1.
|
|
106
|
+
1. **版本绝对固化公理**:`startup_version_gate.py` 必须在任何业务逻辑启动前执行,基线版本严格锁定在 `0.1.6`,杜绝任何环境版本漂移。
|
|
107
107
|
2. **状态机单向流转与幂等性**:生命周期从 `Pre` $\rightarrow$ `Round` $\rightarrow$ `Worker` $\rightarrow$ `Judge` $\rightarrow$ `Settlement` $\rightarrow$ `Post` 严格单向流动,禁止逆流操作;重试必须走显式的轮次迭代(`advance_round_lifecycle`)。
|
|
108
108
|
3. **证据零伪造公理**:在 `findings_adjudication.py` 与 `candidate_revalidation.py` 中,所有缺陷判定必须有可执行的反事实测试证据,严禁仅凭模型推理文本定性。
|
|
109
109
|
4. **工作树物理安全红线**:`post_dry_run.py` 与 `post_commit.py` 严格遵守工作树保护宪法,未授权时绝对禁止覆盖用户未暂存的修改。
|
|
@@ -712,7 +712,9 @@ def _install_explicit_coverage_manifest(root: Path) -> int | None:
|
|
|
712
712
|
coverage_gate = None
|
|
713
713
|
if coverage_gate is not None:
|
|
714
714
|
try:
|
|
715
|
-
gate_errors = coverage_gate.startup_gate_errors(
|
|
715
|
+
gate_errors = coverage_gate.startup_gate_errors(
|
|
716
|
+
resolved_root, manifest, explicit_scope=True
|
|
717
|
+
)
|
|
716
718
|
except (OSError, ValueError, RuntimeError) as exc:
|
|
717
719
|
print(f"[launch_bugx] ✗ 显式覆盖清单预检失败: {exc}")
|
|
718
720
|
return 1
|
|
@@ -727,6 +729,13 @@ def _install_explicit_coverage_manifest(root: Path) -> int | None:
|
|
|
727
729
|
try:
|
|
728
730
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
729
731
|
payload = manifest.read_bytes()
|
|
732
|
+
if module_coverage.DISCOVERY_METADATA_START.encode("utf-8") not in payload:
|
|
733
|
+
meta_header = (
|
|
734
|
+
f"{module_coverage.DISCOVERY_METADATA_START}\n"
|
|
735
|
+
'{"status": "complete", "discovery_mode": "explicit", "coverage_confidence": "high", "discovery_errors": []}\n'
|
|
736
|
+
f"{module_coverage.DISCOVERY_METADATA_END}\n\n"
|
|
737
|
+
).encode("utf-8")
|
|
738
|
+
payload = meta_header + payload
|
|
730
739
|
if destination.is_file():
|
|
731
740
|
existing = destination.read_bytes()
|
|
732
741
|
if existing != payload:
|
|
@@ -240,8 +240,8 @@ def version_marker(path: Path) -> str | None:
|
|
|
240
240
|
if not match:
|
|
241
241
|
return None
|
|
242
242
|
value = match.group(1)
|
|
243
|
-
if value == "0.1.
|
|
244
|
-
value = os.environ.get("BUGX_VERSION", "0.1.
|
|
243
|
+
if value == "0.1.6":
|
|
244
|
+
value = os.environ.get("BUGX_VERSION", "0.1.6")
|
|
245
245
|
return value
|
|
246
246
|
|
|
247
247
|
def startup_release_version(value: object) -> tuple[int, int, int] | None:
|
package/core/ledger/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Ledger (攻防复盘账本与错题经验库)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.6` | **所属分层**: `Layer 3: 并发协调、智能体编排与账本`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
package/core/locales/en-US.json
CHANGED
|
@@ -434,6 +434,7 @@
|
|
|
434
434
|
"host.entry.section.workbuddy": "\n\n## WorkBuddy AI adaptation (mandatory)\n\nThis entry is loaded as a WorkBuddy Skill: do not run `bugx install`, do not guess gate answers, and never treat plain text as a completed user selection. The WorkBuddy desktop enables it through Skill/plugin management; code-development mode reads this entry from the project `.workbuddy/` (or compatible `.codebuddy/`) configuration.\n",
|
|
435
435
|
"host.entry.section.qoder": "\n\n## Qoder native interaction adaptation (mandatory)\n\nThe launcher must explicitly use `--host qoder` to write the host into the current runtime; never infer the host from project configuration. Use the `ask_question` provided by the current Qoder session (or an equivalent structured user-selection control); execute the option's unique `value` and controlled `action`, and never guess an action from a label.\n",
|
|
436
436
|
"host.entry.section.trea": "\n\n## Trea native interaction adaptation (mandatory)\n\nPresent interaction decisions with Trea's `AskUserQuestion` tool, one question at a time; execute the unique `value` and controlled `action` of the selected option, and never guess an action from a Chinese label.\n",
|
|
437
|
+
"host.entry.section.copilot": "\n\n## GitHub Copilot native interaction adaptation (mandatory)\n\nThis entry adapts to GitHub Copilot Agent mode and Copilot Chat instruction specifications. It is auto-loaded via project-level `.github/agents/bugx.agent.md` and `.github/copilot-instructions.md`. When human decision-making is required, use Copilot's native structured control; execute the option's unique `value` and controlled `action`. MCP configuration is written to `.vscode/mcp.json` and `.mcp.json` by the installer, and `bugx-supervisor` and the worker must both be enabled.\n",
|
|
437
438
|
"host.entry.section.qoder.basic": "",
|
|
438
439
|
"host.entry.section.cline": "\n\n## Cline native interaction adaptation (mandatory)\n\nThe launcher must write the host into the current session runtime via `--host cline`; never let a project's `opencode.json` infer the host. Use the `ask_question` provided by the current Cline session (or an equivalent structured user-selection control); execute the option's unique `value` and controlled `action`. This entry is loaded by the Cline project-level Skill (`.cline/skills/bugx/SKILL.md`, discovered automatically by Cline or triggered by `/bugx`); the Cline desktop enters through the current workspace's BugX Skill, while Cline CLI uses `cline <prompt>`, headless autonomy is carried by the CLI's JSON/headless mode for prompts and session recovery, and `cline --acp` is an ACP service endpoint that must not be run directly as a one-shot prompt command. The installer writes Cline MCP into `mcpServers` in the Cline data-directory file `<CLINE_DATA_DIR>/settings/cline_mcp_settings.json` (default `~/.cline/data/settings/cline_mcp_settings.json`); Cline 3.x has no workspace-level MCP scope, so a project `.cline/mcp.json` is never loaded. `bugx-supervisor` and the worker must both exist and be enabled — the Skill file cannot replace MCP. Cline does not support BugX's `Task(subagent_type=\"bugx-worker\")` dispatch contract; the desktop's built-in research sub-agent lacks worker write and MCP permissions, and the CLI's own Agent/Team interface is not equivalent to that Task contract. Interactive single sessions therefore stay serial with one claim at a time: run `bugx engine --root . workers --count 1`, then have the current session complete worker-start, heartbeat/tool_call, and checkpoint through `bugx-supervisor-worker`, and claim the next unit only after verifying a valid checkpoint. Multi-process CLI/autonomous execution uses `bugx autonomous --host cline --workers N`, or the workers' explicit `--execute`; the runtime context atomically writes host/execute/worker_capacity into the current project session and switches to a bounded 2-6 process pool. Each claim runs in `<artifact_root>/.cline_data`, with `CLINE_DATA_DIR` and `--data-dir` injected, loading only `bugx-supervisor-worker` (`--role worker`) and `bugx-docs` — never the controlling `bugx-supervisor`. The pool follows Supervisor adaptive slots using a sliding window and the runtime context's `stagger_seconds` to refill in a staggered way; a claim is reclaimed on timeout, abnormal exit, or missing persisted checkpoint, and only a valid Supervisor checkpoint counts as success. During the mine stage the shared source is read-only, and PoCs and evidence may only be written into the claim's artifact_root.\n",
|
|
439
440
|
"host.entry.header.opencode": "# BugX\n\nThis is BugX's native OpenCode entry. Read the global engine protocol first: load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor, evidence, and reporting protocols in them.\n\nThis entry only hands the task to the current OpenCode; the CLI installs resources and does not run audits. Public agent template source: `{source}`.\n",
|
|
@@ -448,6 +449,7 @@
|
|
|
448
449
|
"host.entry.header.qoder": "# BugX\n\nThis is BugX's Qoder AI entry. Read the global engine protocol first: load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor, evidence, and reporting protocols in them.\n\nThis entry only hands the task to the current Qoder AI; the CLI installs resources and does not run audits. Public agent template source: `{source}`.\n",
|
|
449
450
|
"host.entry.header.trea": "# BugX\n\nThis is BugX's Trea entry. Read the global engine protocol first: load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor, evidence, and reporting protocols in them.\n\nThis entry only hands the task to the current Trea; the CLI installs resources and does not run audits. Public agent template source: `{source}`.\n",
|
|
450
451
|
"host.entry.header.funide": "# BugX\n\nThis is BugX's FunIDE entry. Read the global engine protocol first: load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor, evidence, and reporting protocols in them.\n\nThis entry only hands the task to the current FunIDE; the CLI installs resources and does not run audits. Public agent template source: `{source}`.\n",
|
|
452
|
+
"host.entry.header.copilot": "# BugX\n\nThis is BugX's native GitHub Copilot entry. Read the global engine protocol first: load the global protocol via `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`, and follow the lifetime, Supervisor, evidence, and reporting protocols in them.\n\nThis entry only hands the task to the current GitHub Copilot; the CLI installs resources and does not run audits. Public agent template source: `{source}`.\n",
|
|
451
453
|
"host.entry.body.zcode_worker": "\n# BugX Worker — ZCode concurrent worker sub-agent\n\nYou are BugX's concurrent worker sub-agent, dispatched in parallel within a Round by the main agent through ZCode's subagent capability (`subagent_type=bugx-worker`; in plugin form `bugx:bugx-worker`). First read and obey the following global engine protocols via `bugx engine path --name <file>`; they are the only authoritative entities and this entry does not copy their content:\n\n- `bugx engine path --name bugx-worker.md`: worker unit-level execution rules (four start-up steps, mining discipline, case-filing oracle, hard evidence gate, checkpoint submission);\n- `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`: lifetime, Supervisor, evidence, and reporting protocols.\n\nThese files are provided by the global engine; do not inspect the project's `.bugx/core`. If the project lacks `.bugx/manifest.json`, stop immediately and report this to the dispatcher. The dispatcher must first run the read-only command `bugx engine --root <ROOT> status --json`; only a result of `UNINITIALIZED` permits `bugx engine --root <ROOT> pre` to safely prepare a fresh project. If the result is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve project data and stop; never bypass the gate with `bugx init`, `bugx reset`, or `--force`. After the project layout is safely prepared, the dispatcher may refresh host Worker integration from the main session if needed. A Worker never runs host-control initialization or installation commands and never executes protocol steps while the layout is missing.\n\n## Worker role boundary (mandatory)\n\n- Handle only the coverage units or affinity task bundles the Supervisor assigns to you: `claim` (skip when the host has pre-reserved) → `worker-start` → mine and produce evidence → `checkpoint`; `life_delta` must be 0, and you never write lifetime, settle accounts, produce the final report, or take units outside the list.\n- Use only the worker channel: the Supervisor MCP's `bugx-supervisor-worker` tools (claim/worker_start/tool_call/heartbeat/checkpoint), or the same-named subcommands of `audit_supervisor.py` in the global engine; never call host-control tools (start/bootstrap/next_round/bind_context/finish/fail/recover) and never run the host-control entries' `pre|post|settle`.\n- Evidence may only be written into the `artifact_root` returned by the claim; out-of-bounds paths are rejected by the Supervisor. Unless the dispatcher explicitly provides an independent git worktree, never modify shared worktree source — fixes are performed serially by the host.\n- During long commands send a heartbeat every 5 minutes; on a non-zero return or `CONTROL_PAUSED`/`CONTROL_ABORTED`, stop at a safe boundary and report the state to the dispatcher.\n\n## ZCode Worker interaction adaptation (mandatory)\n\nA worker is a sub-agent: it presents no startup gate and must not call `AskUserQuestion` — a regular start is decided automatically by project configuration and raises no serial startup questionnaire. When a user decision is truly required, end directly and report the raw `BUGX_INTERACTION_REQUEST <json>` to the dispatcher; never answer on your own or guess options. Treat the worker itself as non-TTY: forward only the current single-choice request and continue once the dispatcher returns the answer.\n",
|
|
452
454
|
"host.entry.body.claude_worker": "\n# BugX Worker — Claude Code concurrent worker sub-agent\n\nYou are BugX's concurrent worker sub-agent, dispatched in parallel within a Round by the main agent through Claude Code's subagent capability (`subagent_type=bugx-worker`). First read and obey the following global engine protocols via `bugx engine path --name <file>`; they are the only authoritative entities and this entry does not copy their content:\n\n- `bugx engine path --name bugx-worker.md`: worker unit-level execution rules (four start-up steps, mining discipline, case-filing oracle, hard evidence gate, checkpoint submission);\n- `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`: lifetime, Supervisor, evidence, and reporting protocols.\n\nThese files are provided by the global engine; do not inspect the project's `.bugx/core`. If the project lacks `.bugx/manifest.json`, stop immediately and report this to the dispatcher. The dispatcher must first run the read-only command `bugx engine --root <ROOT> status --json`; only a result of `UNINITIALIZED` permits `bugx engine --root <ROOT> pre` to safely prepare a fresh project. If the result is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve project data and stop; never bypass the gate with `bugx init`, `bugx reset`, or `--force`. After the project layout is safely prepared, the dispatcher may refresh host Worker integration from the main session if needed. A Worker never runs host-control initialization or installation commands and never executes protocol steps while the layout is missing.\n\n## Worker role boundary (mandatory)\n\n- Handle only the coverage units or affinity task bundles the Supervisor assigns to you: `claim` (skip when the host has pre-reserved) → `worker-start` → mine and produce evidence → `checkpoint`; `life_delta` must be 0, and you never write lifetime, settle accounts, produce the final report, or take units outside the list.\n- Use only the worker channel: the Supervisor MCP's `bugx-supervisor-worker` tools (claim/worker_start/tool_call/heartbeat/checkpoint), or the same-named subcommands of `audit_supervisor.py` in the global engine; never call host-control tools (start/bootstrap/next_round/bind_context/finish/fail/recover) and never run the host-control entries' `pre|post|settle`.\n- Evidence may only be written into the `artifact_root` returned by the claim; out-of-bounds paths are rejected by the Supervisor. Unless the dispatcher explicitly provides an independent git worktree, never modify shared worktree source — fixes are performed serially by the host.\n- During long commands send a heartbeat every 5 minutes; on a non-zero return or `CONTROL_PAUSED`/`CONTROL_ABORTED`, stop at a safe boundary and report the state to the dispatcher.\n\n## Claude Code Worker interaction adaptation (mandatory)\n\nA worker is a sub-agent: it presents no startup gate and must not call `AskUserQuestion` — a regular start is decided automatically by project configuration and raises no serial startup questionnaire. When a user decision is truly required, end directly and report the raw `BUGX_INTERACTION_REQUEST <json>` to the dispatcher; never answer on your own or guess options. Treat the worker itself as non-TTY: forward only the current single-choice request and continue once the dispatcher returns the answer.\n",
|
|
453
455
|
"host.entry.body.cline_worker": "\n# BugX Worker — Cline concurrent worker sub-agent\n\nYou are BugX's concurrent worker sub-agent, dispatched serially by the main agent through a Cline interactive session, or in parallel within a Round by an independent Cline CLI process pool. First read and obey the following global engine protocols via `bugx engine path --name <file>`; they are the only authoritative entities and this entry does not copy their content:\n\n- `bugx engine path --name bugx-worker.md`: worker unit-level execution rules (four start-up steps, mining discipline, case-filing oracle, hard evidence gate, checkpoint submission);\n- `bugx engine path --name bugx-runtime-contract.md` and `bugx engine path --name bugx-quick.md`: lifetime, Supervisor, evidence, and reporting protocols.\n\nThese files are provided by the global engine; do not inspect the project's `.bugx/core`. If the project lacks `.bugx/manifest.json`, stop immediately and report this to the dispatcher. The dispatcher must first run the read-only command `bugx engine --root <ROOT> status --json`; only a result of `UNINITIALIZED` permits `bugx engine --root <ROOT> pre` to safely prepare a fresh project. If the result is `FATAL_BLOCKED`, another blocked state, or the status check fails, preserve project data and stop; never bypass the gate with `bugx init`, `bugx reset`, or `--force`. After the project layout is safely prepared, the dispatcher may refresh host Worker integration from the main session if needed. A Worker never runs host-control initialization or installation commands and never executes protocol steps while the layout is missing.\n\n## Worker role boundary (mandatory)\n\n- Handle only the coverage units or affinity task bundles the Supervisor assigns to you: `claim` (skip when the host has pre-reserved) → `worker-start` → mine and produce evidence → `checkpoint`; `life_delta` must be 0, and you never write lifetime, settle accounts, produce the final report, or take units outside the list.\n- Use only the worker channel: the Supervisor MCP's `bugx-supervisor-worker` tools (claim/worker_start/tool_call/heartbeat/checkpoint), or the same-named subcommands of `audit_supervisor.py` in the global engine; never call host-control tools (start/bootstrap/next_round/bind_context/finish/fail/recover) and never run the host-control entries' `pre|post|settle`.\n- Evidence may only be written into the `artifact_root` returned by the claim; out-of-bounds paths are rejected by the Supervisor. Unless the dispatcher explicitly provides an independent git worktree, never modify shared worktree source — fixes are performed serially by the host.\n- In Cline process-pool mode the claim's data directory is locked to `<artifact_root>/.cline_data`, with `CLINE_DATA_DIR` and `--data-dir` injected; that directory's MCP may only contain `bugx-supervisor-worker` (`--role worker`) and `bugx-docs`, and must never start the controlling `bugx-supervisor`.\n- During long commands send a heartbeat every 5 minutes; on a non-zero return or `CONTROL_PAUSED`/`CONTROL_ABORTED`, stop at a safe boundary and report the state to the dispatcher.\n\n## Cline Worker interaction adaptation (mandatory)\n\nA worker is a sub-agent: it presents no startup gate and must not call `ask_question` — a regular start is decided automatically by project configuration and raises no serial startup questionnaire. When a user decision is truly required, end directly and report the raw `BUGX_INTERACTION_REQUEST <json>` to the dispatcher; never answer on your own or guess options. Treat the worker itself as non-TTY: forward only the current single-choice request and continue once the dispatcher returns the answer.\n",
|
package/core/locales/zh-CN.json
CHANGED
|
@@ -434,6 +434,7 @@
|
|
|
434
434
|
"host.entry.section.workbuddy": "\n\n## WorkBuddy AI 适配(强制)\n\n本入口以 WorkBuddy Skill 载入,不执行 `bugx install`,不自行猜测门禁答案,也不把普通文本当作已完成的用户选择。WorkBuddy 的桌面端通过 Skill/插件管理启用;代码开发模式从项目 `.workbuddy/` 或兼容的 `.codebuddy/` 配置读取本入口。\n",
|
|
435
435
|
"host.entry.section.qoder": "\n\n## Qoder 原生交互适配(强制)\n\n启动器必须显式使用 `--host qoder` 写入当前 runtime,不得用项目配置推断宿主。使用当前 Qoder 会话提供的 `ask_question`(或等价结构化用户选择控件);按选项的唯一 `value` 及受控 `action` 执行,禁止从 label 猜动作。\n",
|
|
436
436
|
"host.entry.section.trea": "\n\n## Trea 原生交互适配(强制)\n\n使用 Trea 的 `AskUserQuestion` 工具呈现交互决策,每次只提交一个问题;按当前问题选项的唯一 `value` 及受控 `action` 执行,禁止从中文 label 猜动作。\n",
|
|
437
|
+
"host.entry.section.copilot": "\n\n## GitHub Copilot 原生交互适配(强制)\n\n本入口适配 GitHub Copilot Agent 模式与 Copilot Chat 指令规范。通过项目级 `.github/agents/bugx.agent.md` 和 `.github/copilot-instructions.md` 自动加载;在需要人机交互单选决策时,使用 Copilot 原生结构化控件呈现,按选项的唯一 `value` 及受控 `action` 执行。MCP 配置由安装器写入 `.vscode/mcp.json` 与 `.mcp.json`,必须启用 `bugx-supervisor` 与 worker。\n",
|
|
437
438
|
"host.entry.section.chatgpt.basic": "\n\n## ChatGPT 原生交互适配(强制)\n\n使用 ChatGPT 宿主提供的结构化选择控件呈现交互决策,按选项唯一 `value` 及受控 `action` 执行。\n",
|
|
438
439
|
"host.entry.section.qoder.basic": "",
|
|
439
440
|
"host.entry.header.opencode": "# BugX\n\n这是 BugX 的 OpenCode 原生入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。\n\n该入口只把任务交给当前 OpenCode;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`{source}`。\n",
|
|
@@ -448,6 +449,7 @@
|
|
|
448
449
|
"host.entry.header.qoder": "# BugX\n\n这是 BugX 的 Qoder AI 入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。\n\n该入口只把任务交给当前 Qoder AI;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`{source}`。\n",
|
|
449
450
|
"host.entry.header.trea": "# BugX\n\n这是 BugX 的 Trea 入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。\n\n该入口只把任务交给当前 Trea;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`{source}`。\n",
|
|
450
451
|
"host.entry.header.funide": "# BugX\n\n这是 BugX 的 FunIDE 入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。\n\n该入口只把任务交给当前 FunIDE;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`{source}`。\n",
|
|
452
|
+
"host.entry.header.copilot": "# BugX\n\n这是 BugX 的 GitHub Copilot 原生入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。\n\n该入口只把任务交给当前 GitHub Copilot;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`{source}`。\n",
|
|
451
453
|
"host.entry.body.zcode_worker": "\n# BugX Worker — ZCode 并发 Worker 子智能体\n\n你是 BugX 的并发 worker 子智能体,由主 Agent 通过 ZCode 的 subagent 能力(`subagent_type=bugx-worker`;插件形态为 `bugx:bugx-worker`)在 Round 内并发派发。先通过 `bugx engine path --name <文件>` 读取并遵守以下全局引擎协议;它们是唯一权威实体,本入口不复制其内容:\n\n- `bugx engine path --name bugx-worker.md`:worker 单元级执行规则(开工四步、挖掘纪律、立案 oracle、证据硬门槛、checkpoint 提交);\n- `bugx engine path --name bugx-runtime-contract.md` 与 `bugx engine path --name bugx-quick.md`:寿命、Supervisor、证据和报告协议。\n\n上述文件由全局引擎提供,不检查项目 `.bugx/core`。若项目缺少 `.bugx/manifest.json`,立即停止并将事实报告给派发方。派发方必须先运行只读命令 `bugx engine --root <ROOT> status --json`:只有结果为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre` 安全准备新项目;若为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留项目数据并停止,不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。项目布局准备完成后,如需刷新宿主 Worker 集成,由派发方在主会话中执行;Worker 不运行主控初始化或安装命令,也不在布局缺失时执行协议步骤。\n\n## Worker 角色边界(强制)\n\n- 只负责 Supervisor 分配给你的覆盖单元或亲和任务包:`claim`(宿主已预占时跳过)→ `worker-start` → 挖掘举证 → `checkpoint`;`life_delta` 必须为 0,不写寿命、不结算、不生成最终报告、不领取清单外的单元。\n- 只能使用 worker 通道:Supervisor MCP 的 `bugx-supervisor-worker` 工具(claim/worker_start/tool_call/heartbeat/checkpoint),或全局引擎中的 `audit_supervisor.py` 的同名子命令;不得调用宿主控制工具(start/bootstrap/next_round/bind_context/finish/fail/recover),不得执行宿主控制入口的 `pre|post|settle`。\n- 证据只能写入 claim 返回的 `artifact_root`,越界路径会被 Supervisor 拒绝;没有派发方明确提供独立 git worktree 时,不得修改共享工作树源码,修复由宿主串行完成。\n- 长命令期间每 5 分钟补一次 heartbeat;返回非零或 `CONTROL_PAUSED`/`CONTROL_ABORTED` 时,停在安全边界并把状态报告给派发方。\n\n## ZCode Worker 交互适配(强制)\n\nWorker 是子智能体,不呈现任何启动门禁,也不得调用 `AskUserQuestion`——常规启动由项目配置自动决策,不发起串行启动问卷。确需用户决策时,直接结束并把 `BUGX_INTERACTION_REQUEST <json>` 原文报告给派发方,不得自行作答或猜选项。Worker 自身按非 TTY 处理:只转发当前一个单选请求,答案由派发方回传后再继续。\n",
|
|
452
454
|
"host.entry.body.claude_worker": "\n# BugX Worker — Claude Code 并发 Worker 子智能体\n\n你是 BugX 的并发 worker 子智能体,由主 Agent 通过 Claude Code 的 subagent 能力(`subagent_type=bugx-worker`)在 Round 内并发派发。先通过 `bugx engine path --name <文件>` 读取并遵守以下全局引擎协议;它们是唯一权威实体,本入口不复制其内容:\n\n- `bugx engine path --name bugx-worker.md`:worker 单元级执行规则(开工四步、挖掘纪律、立案 oracle、证据硬门槛、checkpoint 提交);\n- `bugx engine path --name bugx-runtime-contract.md` 与 `bugx engine path --name bugx-quick.md`:寿命、Supervisor、证据和报告协议。\n\n上述文件由全局引擎提供,不检查项目 `.bugx/core`。若项目缺少 `.bugx/manifest.json`,立即停止并将事实报告给派发方。派发方必须先运行只读命令 `bugx engine --root <ROOT> status --json`:只有结果为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre` 安全准备新项目;若为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留项目数据并停止,不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。项目布局准备完成后,如需刷新宿主 Worker 集成,由派发方在主会话中执行;Worker 不运行主控初始化或安装命令,也不在布局缺失时执行协议步骤。\n\n## Worker 角色边界(强制)\n\n- 只负责 Supervisor 分配给你的覆盖单元或亲和任务包:`claim`(宿主已预占时跳过)→ `worker-start` → 挖掘举证 → `checkpoint`;`life_delta` 必须为 0,不写寿命、不结算、不生成最终报告、不领取清单外的单元。\n- 只能使用 worker 通道:Supervisor MCP 的 `bugx-supervisor-worker` 工具(claim/worker_start/tool_call/heartbeat/checkpoint),或全局引擎中的 `audit_supervisor.py` 的同名子命令;不得调用宿主控制工具(start/bootstrap/next_round/bind_context/finish/fail/recover),不得执行宿主控制入口的 `pre|post|settle`。\n- 证据只能写入 claim 返回的 `artifact_root`,越界路径会被 Supervisor 拒绝;没有派发方明确提供独立 git worktree 时,不得修改共享工作树源码,修复由宿主串行完成。\n- 长命令期间每 5 分钟补一次 heartbeat;返回非零或 `CONTROL_PAUSED`/`CONTROL_ABORTED` 时,停在安全边界并把状态报告给派发方。\n\n## Claude Code Worker 交互适配(强制)\n\nWorker 是子智能体,不呈现任何启动门禁,也不得调用 `AskUserQuestion`——常规启动由项目配置自动决策,不发起串行启动问卷。确需用户决策时,直接结束并把 `BUGX_INTERACTION_REQUEST <json>` 原文报告给派发方,不得自行作答或猜选项。Worker 自身按非 TTY 处理:只转发当前一个单选请求,答案由派发方回传后再继续。\n",
|
|
453
455
|
"host.entry.body.cline_worker": "\n# BugX Worker — Cline 并发 Worker 子智能体\n\n你是 BugX 的并发 worker 子智能体,由主 Agent 通过 Cline 交互会话串行派发,或由独立 Cline CLI 进程池在 Round 内并发派发。先通过 `bugx engine path --name <文件>` 读取并遵守以下全局引擎协议;它们是唯一权威实体,本入口不复制其内容:\n\n- `bugx engine path --name bugx-worker.md`:worker 单元级执行规则(开工四步、挖掘纪律、立案 oracle、证据硬门槛、checkpoint 提交);\n- `bugx engine path --name bugx-runtime-contract.md` 与 `bugx engine path --name bugx-quick.md`:寿命、Supervisor、证据和报告协议。\n\n上述文件由全局引擎提供,不检查项目 `.bugx/core`。若项目缺少 `.bugx/manifest.json`,立即停止并将事实报告给派发方。派发方必须先运行只读命令 `bugx engine --root <ROOT> status --json`:只有结果为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre` 安全准备新项目;若为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留项目数据并停止,不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。项目布局准备完成后,如需刷新宿主 Worker 集成,由派发方在主会话中执行;Worker 不运行主控初始化或安装命令,也不在布局缺失时执行协议步骤。\n\n## Worker 角色边界(强制)\n\n- 只负责 Supervisor 分配给你的覆盖单元或亲和任务包:`claim`(宿主已预占时跳过)→ `worker-start` → 挖掘举证 → `checkpoint`;`life_delta` 必须为 0,不写寿命、不结算、不生成最终报告、不领取清单外的单元。\n- 只能使用 worker 通道:Supervisor MCP 的 `bugx-supervisor-worker` 工具(claim/worker_start/tool_call/heartbeat/checkpoint),或全局引擎中的 `audit_supervisor.py` 的同名子命令;不得调用宿主控制工具(start/bootstrap/next_round/bind_context/finish/fail/recover),不得执行宿主控制入口的 `pre|post|settle`。\n- 证据只能写入 claim 返回的 `artifact_root`,越界路径会被 Supervisor 拒绝;没有派发方明确提供独立 git worktree 时,不得修改共享工作树源码,修复由宿主串行完成。\n- Cline 进程池模式会把本 claim 的数据目录锁定为 `<artifact_root>/.cline_data`,同时注入 `CLINE_DATA_DIR` 与 `--data-dir`;该目录的 MCP 只能包含 `bugx-supervisor-worker`(`--role worker`)和 `bugx-docs`,不得启动主控 `bugx-supervisor`。\n- 长命令期间每 5 分钟补一次 heartbeat;返回非零或 `CONTROL_PAUSED`/`CONTROL_ABORTED` 时,停在安全边界并把状态报告给派发方。\n\n## Cline Worker 交互适配(强制)\n\nWorker 是子智能体,不呈现任何启动门禁,也不得调用 `ask_question`——常规启动由项目配置自动决策,不发起串行启动问卷。确需用户决策时,直接结束并把 `BUGX_INTERACTION_REQUEST <json>` 原文报告给派发方,不得自行作答或猜选项。Worker 自身按非 TTY 处理:只转发当前一个单选请求,答案由派发方回传后再继续。\n",
|
|
@@ -1101,6 +1101,36 @@ def handle_supervisor_bind_context(service: Any, arguments: Mapping[str, object]
|
|
|
1101
1101
|
))
|
|
1102
1102
|
|
|
1103
1103
|
|
|
1104
|
+
def _maybe_auto_record_finish_telemetry(result: Mapping[str, object]) -> None:
|
|
1105
|
+
"""DOC-126: 在 Supervisor finish 完成时静默为脱敏飞轮入队 code_review 摘要。"""
|
|
1106
|
+
try:
|
|
1107
|
+
from core.cloud_sync.flywheel_client import record_review_telemetry
|
|
1108
|
+
|
|
1109
|
+
findings = result.get("findings")
|
|
1110
|
+
findings_count = len(findings) if isinstance(findings, list) else int(result.get("findings_count", 0))
|
|
1111
|
+
coverage_summary = result.get("coverage_summary") if isinstance(result.get("coverage_summary"), Mapping) else {}
|
|
1112
|
+
total_units = int(coverage_summary.get("total", 0))
|
|
1113
|
+
|
|
1114
|
+
summary = {
|
|
1115
|
+
"findings_count": findings_count,
|
|
1116
|
+
"total_units": total_units,
|
|
1117
|
+
"status": str(result.get("status") or "completed"),
|
|
1118
|
+
"round_no": result.get("round_no"),
|
|
1119
|
+
}
|
|
1120
|
+
metrics = {
|
|
1121
|
+
"findings_count": findings_count,
|
|
1122
|
+
"total_units": total_units,
|
|
1123
|
+
}
|
|
1124
|
+
record_review_telemetry(
|
|
1125
|
+
review_summary=summary,
|
|
1126
|
+
metrics=metrics,
|
|
1127
|
+
event_type="code_review",
|
|
1128
|
+
flush=True,
|
|
1129
|
+
)
|
|
1130
|
+
except Exception:
|
|
1131
|
+
pass
|
|
1132
|
+
|
|
1133
|
+
|
|
1104
1134
|
def handle_supervisor_finish(service: Any, arguments: Mapping[str, object]) -> dict[str, object]:
|
|
1105
1135
|
name = "bugx_supervisor_finish"
|
|
1106
1136
|
service._require_role(arguments, name, "host")
|
|
@@ -1109,10 +1139,12 @@ def handle_supervisor_finish(service: Any, arguments: Mapping[str, object]) -> d
|
|
|
1109
1139
|
compact = bool(arguments.get("compact", False))
|
|
1110
1140
|
if coverage_complete is not None and not isinstance(coverage_complete, bool):
|
|
1111
1141
|
raise McpProtocolError("coverage_complete 必须是布尔值或 null")
|
|
1112
|
-
|
|
1142
|
+
res = project_state(supervisor.finish(
|
|
1113
1143
|
coverage_complete=coverage_complete,
|
|
1114
1144
|
expected_revision=arguments.get("expected_revision"),
|
|
1115
1145
|
), compact=compact)
|
|
1146
|
+
_maybe_auto_record_finish_telemetry(res)
|
|
1147
|
+
return res
|
|
1116
1148
|
|
|
1117
1149
|
|
|
1118
1150
|
def handle_supervisor_fail(service: Any, arguments: Mapping[str, object]) -> dict[str, object]:
|
|
@@ -209,10 +209,41 @@ def handle_global_telemetry(service: Any, arguments: Mapping[str, object]) -> di
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
|
|
212
|
+
def handle_record_telemetry(service: Any, arguments: Mapping[str, object]) -> dict[str, object]:
|
|
213
|
+
"""MCP 接口:上报轻量代码审查或探测遥测事实并可选即时推送。"""
|
|
214
|
+
del service
|
|
215
|
+
summary = arguments.get("summary")
|
|
216
|
+
if not isinstance(summary, Mapping):
|
|
217
|
+
return {"status": "error", "error": "summary 必须是非空对象"}
|
|
218
|
+
|
|
219
|
+
event_type = str(arguments.get("event_type") or "code_review").strip()
|
|
220
|
+
quality = arguments.get("quality", "tier-2")
|
|
221
|
+
metrics = arguments.get("metrics")
|
|
222
|
+
flush_now = bool(arguments.get("flush_now", True))
|
|
223
|
+
|
|
224
|
+
try:
|
|
225
|
+
from core.cloud_sync.flywheel_client import FlywheelUploader
|
|
226
|
+
|
|
227
|
+
with FlywheelUploader() as uploader:
|
|
228
|
+
if not uploader.data_sharing:
|
|
229
|
+
return {"status": "disabled", "message": "遥测共享未开启"}
|
|
230
|
+
res = uploader.record_and_flush(
|
|
231
|
+
review_summary=summary,
|
|
232
|
+
quality=quality,
|
|
233
|
+
metrics=metrics if isinstance(metrics, Mapping) else None,
|
|
234
|
+
event_type=event_type,
|
|
235
|
+
flush=flush_now,
|
|
236
|
+
)
|
|
237
|
+
return {"status": "ok", "telemetry": res}
|
|
238
|
+
except Exception as exc:
|
|
239
|
+
return {"status": "error", "error": str(exc)}
|
|
240
|
+
|
|
241
|
+
|
|
212
242
|
TELEMETRY_HANDLERS: dict[str, Any] = {
|
|
213
243
|
"bugx_scheduling_telemetry": handle_scheduling_telemetry,
|
|
214
244
|
"bugx_global_telemetry": handle_global_telemetry,
|
|
215
245
|
"bugx_retrieval_metrics": handle_retrieval_metrics,
|
|
246
|
+
"bugx_record_telemetry": handle_record_telemetry,
|
|
216
247
|
}
|
|
217
248
|
|
|
218
249
|
|
|
@@ -220,6 +251,7 @@ __all__ = [
|
|
|
220
251
|
"TELEMETRY_HANDLERS",
|
|
221
252
|
"clear_retrieval_metrics",
|
|
222
253
|
"handle_global_telemetry",
|
|
254
|
+
"handle_record_telemetry",
|
|
223
255
|
"handle_retrieval_metrics",
|
|
224
256
|
"handle_scheduling_telemetry",
|
|
225
257
|
"record_retrieval_metric",
|
|
@@ -657,6 +657,40 @@ def _build_tool_table() -> tuple[tuple[frozenset[str], dict[str, object]], ...]:
|
|
|
657
657
|
},
|
|
658
658
|
},
|
|
659
659
|
}),
|
|
660
|
+
(_SHARED_ROLES, {
|
|
661
|
+
"name": "bugx_record_telemetry",
|
|
662
|
+
"description": "向脱敏飞轮队列上报轻量代码审查或探测遥测事实(文件数、缺陷分级统计、耗时等脱敏指标),支持即时或排队外发。",
|
|
663
|
+
"inputSchema": {
|
|
664
|
+
"type": "object",
|
|
665
|
+
"properties": {
|
|
666
|
+
"event_type": {
|
|
667
|
+
"type": "string",
|
|
668
|
+
"description": "遥测事件类型,如 code_review、recon_probe(默认 code_review)",
|
|
669
|
+
"default": "code_review",
|
|
670
|
+
},
|
|
671
|
+
"summary": {
|
|
672
|
+
"type": "object",
|
|
673
|
+
"description": "脱敏审查/探测统计指标(禁止传递任何源码明文、路径凭据)",
|
|
674
|
+
},
|
|
675
|
+
"metrics": {
|
|
676
|
+
"type": "object",
|
|
677
|
+
"description": "性能与耗时度量(如 duration_ms、findings_count 等)",
|
|
678
|
+
},
|
|
679
|
+
"quality": {
|
|
680
|
+
"type": "string",
|
|
681
|
+
"enum": ["tier-1", "tier-2", "tier-3"],
|
|
682
|
+
"default": "tier-2",
|
|
683
|
+
"description": "数据质量评级",
|
|
684
|
+
},
|
|
685
|
+
"flush_now": {
|
|
686
|
+
"type": "boolean",
|
|
687
|
+
"description": "是否在入队后立即尝试网络静默推送(默认 true)",
|
|
688
|
+
"default": True,
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
"required": ["summary"],
|
|
692
|
+
},
|
|
693
|
+
}),
|
|
660
694
|
(_WORKER_ONLY, {
|
|
661
695
|
"name": "bugx_fuzz_concurrency",
|
|
662
696
|
"description": "并发竞态与时序死锁专项扰动工具:注入微秒级上下文切换抖动并检测数据竞态或死锁。",
|
package/core/metadata.txt
CHANGED
package/core/planning/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Planning & Slicing Engine (能力规划、领域路由、代码切片与仲裁流水线)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.6` | **所属分层**: `Layer 2: 分析、切片与探测引擎`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
package/core/retrieval/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Retrieval Engine (代码切片、拓扑与混合检索增强引擎)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.6` | **所属分层**: `Layer 2: 分析、切片与探测引擎`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
|
@@ -94,6 +94,7 @@ HOST_ROOT_CONFIG_NAMES = {
|
|
|
94
94
|
DEPENDENCY_OR_GENERATED_DIRS = {
|
|
95
95
|
".git", "node_modules", "target", "dist", ".venv", "venv", "__pycache__",
|
|
96
96
|
".gradle", "vendor", "third_party", ".pytest_cache", ".ruff_cache", ".tools",
|
|
97
|
+
".dart_tool",
|
|
97
98
|
}
|
|
98
99
|
# Keep the old public name for callers that used it, but do not use it as a
|
|
99
100
|
# blunt ``any path segment`` filter: product code may legitimately contain a
|
|
@@ -117,7 +118,7 @@ TOP_LEVEL_ASSET_EXCLUDED_DIRS = {
|
|
|
117
118
|
SOURCE_EXTS = {
|
|
118
119
|
".py", ".js", ".mjs", ".cjs", ".jsx", ".ts", ".tsx", ".java", ".kt", ".kts", ".go",
|
|
119
120
|
".rs", ".swift", ".c", ".h", ".cc", ".cpp", ".cxx", ".cs", ".rb",
|
|
120
|
-
".php", ".vue", ".svelte",
|
|
121
|
+
".php", ".vue", ".svelte", ".dart",
|
|
121
122
|
}
|
|
122
123
|
AUDIT_ASSET_EXTS = {
|
|
123
124
|
".sh", ".bash", ".zsh", ".fish", ".sql", ".yaml", ".yml", ".toml",
|
package/core/runtime/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX Core Runtime Subsystem (核心运行时、环境与基础设施)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.6` | **所属分层**: `Layer 0: 基础设施与操作系统抽象`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
|
|
6
6
|
|
|
@@ -50,12 +50,13 @@ SUPPORTED_SOURCE_EXTS = {
|
|
|
50
50
|
".rs",
|
|
51
51
|
".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx",
|
|
52
52
|
".cs", ".php", ".rb",
|
|
53
|
+
".dart",
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
SKIP_DIRS = {
|
|
56
57
|
".git", ".bugx", ".venv", "venv", "node_modules", "__pycache__",
|
|
57
58
|
"dist", "build", "target", ".tox", ".mypy_cache", ".pytest_cache",
|
|
58
|
-
"vendor", "Pods", ".gradle", ".idea",
|
|
59
|
+
"vendor", "Pods", ".gradle", ".idea", ".dart_tool", ".vscode",
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
# 路由装饰器识别正则与特征
|