bugx-cli 0.1.3 → 0.1.5
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/core/README.md +5 -3
- package/core/agent/agent_execution.py +7 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +10 -2
- package/core/bundled_docs/OVERVIEW.md +311 -0
- package/core/bundled_docs/README.md +10 -0
- package/core/bundled_docs/README_EN.md +278 -0
- package/core/bundled_docs/ai/01_AI_REFERENCE.md +838 -0
- package/core/bundled_docs/ai/02_AI_USAGE.md +161 -0
- package/core/bundled_docs/ai/03_AI_COMMANDS.md +322 -0
- package/core/bundled_docs/guides/01_USER_GUIDE.md +887 -0
- package/core/bundled_docs/guides/02_COMMANDS.md +935 -0
- package/core/bundled_docs/guides/03_TROUBLESHOOTING.md +763 -0
- package/core/bundled_docs/guides/04_CLOUD_AUTH_AND_SYNC_COOKBOOK.md +48 -0
- package/core/bundled_docs/guides/05_HOST_MATRIX_AND_DISPATCH.md +25 -0
- package/core/bundled_docs/guides/06_PROBES_AND_POC_COOKBOOK.md +49 -0
- package/core/bundled_docs/guides/07_LIFECYCLE_AND_RECOVERY_STATES.md +46 -0
- package/core/bundled_docs/guides/08_LESSONS_AND_PRIVACY_BOUNDARY.md +35 -0
- package/core/bundled_docs/hosts/bugx-claude_SKILL.md +326 -0
- package/core/bundled_docs/hosts/bugx-dsh_SKILL.md +229 -0
- package/core/bundled_docs/hosts/bugx-opencode_SKILL.md +129 -0
- package/core/bundled_docs/hosts/bugx-zcode_SKILL.md +459 -0
- package/core/bundled_docs/hosts/bugx_SKILL.md +118 -0
- package/core/bundled_docs/hosts/cline_bugx_SKILL.md +69 -0
- package/core/bundled_docs/hosts/platform_bugx_SKILL.md +50 -0
- package/core/bundled_docs/manifest.json +140 -0
- package/core/bundled_docs/reference/01_ENVIRONMENT_VARIABLES.md +422 -0
- package/core/bundled_docs/reference/04_REPOSITORY_TOPOLOGY.md +180 -0
- package/core/cli-help.txt +7 -3
- package/core/cloud_sync/cloud_client.py +81 -2
- package/core/cloud_sync/endpoint_router.py +22 -9
- package/core/cloud_sync/issue_uploader.py +297 -0
- package/core/cloud_sync/sensitive_filter.py +77 -7
- package/core/contracts/AGENT_GUIDE.md +3 -9
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +10 -20
- package/core/contracts/bugx-worker.md +1 -1
- package/core/coverage/coverage_ai_review.py +15 -11
- package/core/coverage/coverage_bootstrap.py +18 -13
- package/core/coverage/coverage_discovery.py +1 -1
- package/core/dev_harness/interaction_preset.py +1 -1
- package/core/engine-integrity.json +283 -159
- package/core/host_acp/README.md +4 -0
- package/core/host_acp/agnescode.py +128 -0
- package/core/host_acp/antigravity.py +153 -0
- package/core/host_runtime/README.md +3 -0
- package/core/host_runtime/adapters.py +5 -1
- package/core/host_runtime/antigravity.py +162 -0
- package/core/host_runtime/host_bootstrap.py +18 -7
- package/core/host_runtime/host_evaluators.py +4 -4
- package/core/host_runtime/host_registry.py +3 -1
- package/core/host_runtime/mcp_process_tracker.py +30 -3
- package/core/host_runtime/mcp_registry_gate.py +34 -11
- package/core/hosts/README.md +4 -0
- package/core/hosts/agnescode.py +415 -0
- package/core/hosts/antigravity.py +115 -0
- package/core/hosts/codex.py +3 -0
- package/core/hosts/dsh.py +42 -23
- package/core/hosts/minimax.py +5 -4
- package/core/hosts/opencode.py +11 -3
- package/core/i18n.py +94 -5
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- package/core/infra/python_runtime.py +4 -1
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/finding_confirm_phase.py +1 -1
- package/core/launch_phases/semantic_recon.py +3 -19
- package/core/launch_phases/startup_version_gate.py +2 -2
- package/core/launch_phases/supervisor_bridge.py +2 -0
- package/core/launch_phases/supervisor_degraded.py +7 -5
- package/core/launch_phases/verify_loop.py +3 -19
- package/core/ledger/README.md +1 -1
- package/core/ledger/finding_confirmation.py +1 -1
- package/core/ledger/finding_verification.py +2 -20
- package/core/ledger/fp_ledger.py +3 -19
- package/core/ledger/life_ledger.py +7 -33
- package/core/ledger/schema.py +1 -1
- package/core/locales/en-US.json +3 -3
- package/core/locales/zh-CN.json +3 -3
- package/core/mcp_handlers/supervisor_handlers.py +1 -1
- package/core/mcp_runtime_support/common.py +6 -0
- package/core/mcp_runtime_support/environment.py +88 -24
- package/core/metadata.txt +1 -1
- package/core/planning/README.md +1 -1
- package/core/planning/prompt_harness.py +2 -2
- package/core/planning/target_sandbox_manager.py +2 -0
- package/core/probes/codebase_memory_probe.py +43 -24
- package/core/probes/mobile_probe.py +1 -0
- package/core/probes/probe_registry.py +10 -7
- package/core/probes/sast_probe.py +1 -1
- package/core/probes/sca_scanner.py +1 -1
- package/core/project_profiler/constants.py +1 -1
- package/core/prompts/command_routing_en.md +6 -5
- package/core/prompts/command_routing_zh.md +6 -5
- package/core/repair/rsi_rounds.py +3 -0
- package/core/repair/self_heal.py +160 -6
- package/core/retrieval/README.md +1 -1
- package/core/retrieval/symbol_index.py +227 -52
- package/core/runtime/README.md +1 -1
- package/core/runtime/daemon_runner.py +3 -2
- package/core/runtime/project_init.py +1 -1
- package/core/runtime/scenario_eval.py +5 -1
- package/core/runtime/tool_install_targets.py +12 -2
- package/core/skills/README.md +4 -2
- package/core/skills/bugx_docs_cloud_sync.py +658 -0
- package/core/skills/bugx_docs_mcp_server.py +966 -140
- package/core/skills/bugx_mcp_server.py +9 -0
- package/core/skills/mcp_session_proof.py +3 -31
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/finding_commit.py +3 -24
- package/core/supervisor/task_scheduler.py +5 -2
- package/core/supervisor/worker_execution.py +16 -3
- package/core/supervisor/worker_handoff.py +2 -2
- package/core/webui/docs_session_service.py +40 -2
- package/core/webui/mcp_inspector.py +6 -6
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +46 -46
- package/ecosystem/integrations/dsh/agents/bugx.md +2 -1
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +5 -5
- package/ecosystem/integrations/qoder/CONNECTORS.md +11 -23
- 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 +8 -7
- 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/agents/bugx-worker.md +14 -18
- package/ecosystem/plugins/bugx/agents/bugx.md +45 -49
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +7 -7
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +2 -2
- package/interfaces/cli/bugx_cli/__init__.py +1 -1
- package/interfaces/cli/bugx_cli/cli.py +153 -8
- package/interfaces/cli/bugx_cli/commands/agent.py +376 -69
- package/interfaces/cli/bugx_cli/commands/audit.py +2 -1
- package/interfaces/cli/bugx_cli/commands/cloud.py +42 -1
- package/interfaces/cli/bugx_cli/commands/doctor.py +650 -223
- package/interfaces/cli/bugx_cli/commands/guide.py +143 -0
- package/interfaces/cli/bugx_cli/commands/issue.py +262 -0
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +56 -26
- package/interfaces/cli/bugx_cli/commands/patch.py +5 -1
- package/interfaces/cli/bugx_cli/commands/plugin.py +306 -56
- package/interfaces/cli/bugx_cli/commands/plugin_antigravity.py +350 -0
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +154 -62
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +308 -108
- package/interfaces/cli/bugx_cli/commands/system.py +11 -1
- package/interfaces/cli/bugx_cli/common.py +39 -8
- package/interfaces/cli/bugx_cli/host_adapters.py +46 -3
- package/interfaces/cli/bugx_cli/hosts/registry.py +3 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +21 -2
- package/interfaces/cli/bugx_cli/infra/__init__.py +4 -0
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +14 -12
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +76 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +66 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +240 -50
- package/package.json +3 -2
- package/pyproject.toml +22 -2
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +1 -2
- package/skills/platform/bugx/SKILL.md +50 -0
- package/skills/platform/bugx-user/SKILL.md +0 -92
|
@@ -0,0 +1,838 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: BugX AI Host and Worker Reference
|
|
3
|
+
audience: AI hosts and native agents
|
|
4
|
+
status: DOCUMENTATION_UNVERIFIED
|
|
5
|
+
version: 0.1.5
|
|
6
|
+
protocol: MCP 2024-11-05
|
|
7
|
+
server: bugx-supervisor 0.1.5
|
|
8
|
+
last-verified: 2026-11-17
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BugX AI Reference
|
|
12
|
+
|
|
13
|
+
本文件是给 Host、Native Agent、Worker 编排器和 MCP 客户端使用的机器契约,不是用户教程。实现存在不等于真实宿主已经验收;没有 session proof、真实工具调用、checkpoint 和 receipt 时,AI 必须返回 UNVERIFIED 或 BLOCKED,不得返回 COMPLETE。
|
|
14
|
+
|
|
15
|
+
## 1. Runtime identity
|
|
16
|
+
|
|
17
|
+
### 1.1 Project and scope
|
|
18
|
+
|
|
19
|
+
project_root = BUGX_PROJECT_ROOT if it is an existing directory else cwd
|
|
20
|
+
project_state = project_root/.bugx
|
|
21
|
+
global_engine = user BugX global engine root
|
|
22
|
+
|
|
23
|
+
项目状态绑定绝对 root。manifest identity mismatch、unsafe symlink、缺少 lifecycle/state 或布局不存在时 fail-closed;MCP server 不隐式创建项目布局。需要先由用户或 CLI 执行 init/install。
|
|
24
|
+
|
|
25
|
+
常用路径:
|
|
26
|
+
|
|
27
|
+
.bugx/manifest.json
|
|
28
|
+
.bugx/pollings/<polling-id>/state.json
|
|
29
|
+
.bugx/pollings/<polling-id>/lifecycles/<lifecycle-id>/
|
|
30
|
+
.bugx/state/life.json
|
|
31
|
+
.bugx/state/runtime.json
|
|
32
|
+
.bugx/state/supervisor.json
|
|
33
|
+
.bugx/state/coverage-evidence.json
|
|
34
|
+
.bugx/state/prep-record.md
|
|
35
|
+
.bugx/logs/bugx.jsonl
|
|
36
|
+
.bugx/artifacts/
|
|
37
|
+
|
|
38
|
+
生命周期目录的权威产物包括 events.jsonl、conclusion.json、report.md、integrity.json。不要把完整 artifact、credential、wire log 或未脱敏源码放入模型上下文或云端 payload。
|
|
39
|
+
|
|
40
|
+
### 1.2 CLI 版本检查与更新契约
|
|
41
|
+
|
|
42
|
+
公共入口只有:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
bugx --version
|
|
46
|
+
bugx update --check --root <ROOT>
|
|
47
|
+
bugx update --root <ROOT> [--channel stable|alpha] [--allow-downgrade]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
不要生成 `bugx version --check`。`--check` 是只读联网检查:退出码 `0` 表示当前无需更新,`1` 表示有更新/必须更新,`2` 表示网络、服务端元数据或安装来源检查失败。`bugx update` 具有全局写入副作用:它识别当前 pip/npm 安装来源,按服务端返回的 `channel + artifact_kind + release_id + checksum_sha256` 下载制品,随后刷新全局 engine、已登记 Host 和目标 root 的 installation-only doctor。
|
|
51
|
+
|
|
52
|
+
AI 必须按以下证据门判断:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
version response with update_available -> 只说明存在候选更新
|
|
56
|
+
release_id/checksum/artifact missing -> STOP, report BLOCKED or UNVERIFIED
|
|
57
|
+
source/editable installation -> STOP, do not overwrite source
|
|
58
|
+
pip/npm installer exit 0 -> 仍未完成,继续读取 installed version
|
|
59
|
+
engine/host/doctor failure after install -> RECOVERY_REQUIRED
|
|
60
|
+
receipt final_state=COMPLETE + doctor success -> update COMPLETE
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Windows 上若用户级 wheel 与旧系统级 `share/bugx-agent` 并存,`asset_root()` 必须先解析当前
|
|
64
|
+
`bugx-cli` distribution 的资源,再回退系统 data-files;看到旧 Build ID 时不得把它当成当前
|
|
65
|
+
CLI 的安装源,也不得用它覆盖更高的全局引擎。
|
|
66
|
+
|
|
67
|
+
更新收据位于用户级 `~/.bugx/update/receipts/<operation_id>.json`,成功状态必须为 `COMPLETE`;安装器之后任一阶段失败时状态为 `RECOVERY_REQUIRED`。没有真实 receipt、版本核对、引擎 integrity 和 doctor 结果时,不得把 CLI 返回 0、模型文本、Task 打印、服务端配置写入或工具列表当作更新完成。启动阶段的版本检查是后台提示,`BUGX_DISABLE_VERSION_CHECK=1` 或 cloud-config 的 `disable_version_check=true` 只禁用启动提示,不禁用显式命令。
|
|
68
|
+
|
|
69
|
+
### 1.3 Host capability sets
|
|
70
|
+
|
|
71
|
+
install_adapters =
|
|
72
|
+
agnescode, antigravity, chatgpt, claude, cline, codex, dsh, funide, kimi,
|
|
73
|
+
minimax, opencode, pi, qoder, trea, workbuddy, zcode
|
|
74
|
+
|
|
75
|
+
ready_engine_plugins =
|
|
76
|
+
opencode, codex, cline, dsh, claude, pi, zcode, kimi, minimax, antigravity, agnescode
|
|
77
|
+
|
|
78
|
+
acp_ready = agnescode, antigravity, cline, kimi, opencode
|
|
79
|
+
acp_todo = chatgpt, workbuddy, qoder, trea, funide
|
|
80
|
+
acp_unavailable = claude, codex, dsh, pi, zcode, minimax
|
|
81
|
+
|
|
82
|
+
autonomous_cli_choices =
|
|
83
|
+
claude, codex, opencode, dsh, pi, kimi, cline, zcode
|
|
84
|
+
|
|
85
|
+
desktop_registration =
|
|
86
|
+
claude, kimi, zcode, qoder, minimax
|
|
87
|
+
|
|
88
|
+
autonomous host 选取不是独立事实表:baseline 五宿主来自 `AUTONOMOUS_HOST_BASELINE`
|
|
89
|
+
(`interfaces/cli/bugx_cli/hosts/registry.py`),并自动追加声明了
|
|
90
|
+
`worker_runtime.autonomous_cli` 的插件(cline、zcode)。`bugx autonomous --host` 与
|
|
91
|
+
`bugx goal --host` 的 choices 均由 `autonomous_host_names()` 动态派生。pi 无原生 Task
|
|
92
|
+
(native_task=False),自治走无头通道 `pi --approve -p <prompt> --mode json`
|
|
93
|
+
(`core/hosts/pi.py` engine_run.autonomous_argv)。
|
|
94
|
+
|
|
95
|
+
`desktop_registration` 宿主(claude、kimi、zcode、qoder、minimax)在执行 `bugx install` 时自动完成各自当前契约要求的用户级注册,无需用户在应用内手动点击安装。Kimi Code 1.4.x 的唯一注册面是
|
|
96
|
+
`<KIMI_CODE_HOME>/plugins/managed/<id>` 与 `<KIMI_CODE_HOME>/plugins/installed.json`
|
|
97
|
+
(未设置 `KIMI_CODE_HOME` 时为 `~/.kimi-code`);旧 `daimon-share`、`plugin-meta.json` 和
|
|
98
|
+
个人市场文件不是当前 Kimi Code 读取路径,安装器不再写入。Kimi 注册通过
|
|
99
|
+
`interfaces/cli/bugx_cli/commands/plugin_kimi.py::_ensure_kimi_plugin` 实现,能力声明为
|
|
100
|
+
`user-agent-registration`;Kimi 的 managed 插件注册由该宿主专用注册器完成,不能落入
|
|
101
|
+
ZCode 专用的 `distribution-plugin` 分支(`core/hosts/kimi.py`)。
|
|
102
|
+
|
|
103
|
+
Qoder `install --agent qoder` 合并根 `.mcp.json:mcpServers`,以项目绝对 `--root` 登记 `bugx-supervisor`、`bugx-supervisor-worker`、`bugx-docs`。Windows 使用安装进程的绝对 Python `.exe` 与 `-P -m bugx_cli.cli`,npm 额外传递该安装的 `PYTHONPATH`、`BUGX_ASSET_ROOT`、`BUGX_CLI_SOURCE`。Doctor 和运行时读取项目级 `.qoder/settings.json` 与根 `.mcp.json`,根定义覆盖同名 server。Doctor 将相对 `--root` 或过期 Windows 启动器判为过期。工具调用需要 Qoder 新会话加载配置并完成项目级批准。卸载依据 Claude / FunIDE / Qoder 的剩余登记决定是否保留根配置中的共享条目。
|
|
104
|
+
|
|
105
|
+
MiniMax Code 3.1.17 使用 `<DATA_DIR>/agents/bugx/agent.md` 注册 `BugX` 自定义 Agent。
|
|
106
|
+
`<DATA_DIR>/plugins/bugx/.minimax-plugin/plugin.json` 的 `author` 为字符串,
|
|
107
|
+
`servers.mcp.json` 用 `schemaVersion: 1` 和 `mcpServers` 声明插件 MCP。插件提供
|
|
108
|
+
`bugx:bugx-worker` 和 `bugx` Skill。默认 `<DATA_DIR>` 为 `~/.minimax`,可用
|
|
109
|
+
`MINIMAX_DATA_DIR` 隔离。主 Agent 的 `x-mavis.avatar` 相对引用同目录的 `bugx-avatar-512.png`。
|
|
110
|
+
`minimax_user_agents` 回执含主 Agent、头像、Worker 与 MCP 路径。
|
|
111
|
+
注册验证覆盖两个入口,实际 MCP 调用、headless 和标准 ACP 尚未验证。
|
|
112
|
+
|
|
113
|
+
`bugx install --agent antigravity` 安装用户级 `~/.gemini/config/plugins/bugx-review`。
|
|
114
|
+
原生主 Agent 为 `BugX`(插件内部 slug 为 `bugx-review`),同一插件还包含 `bugx-worker`、审查 Skill 和官方
|
|
115
|
+
`assets/bugx-avatar.svg`;插件级
|
|
116
|
+
`mcp_config.json` 保持空容器,项目级 `.agents/mcp_config.json` 承载
|
|
117
|
+
`bugx-supervisor`、`bugx-supervisor-worker` 与 `bugx-docs`。安装回执键为
|
|
118
|
+
`antigravity_user_agents`,`doctor` 必须调用 Antigravity 专用校验读取用户级受管文件,不能
|
|
119
|
+
把 `.gemini/config/plugins` 拼成项目相对路径。Windows `agy 1.5.16` 已由真实
|
|
120
|
+
headless Agent 调用 docs MCP 并返回隔离 README 的引用哈希;错误项目作用域被拒绝。
|
|
121
|
+
ACP `initialize → session/new` 已用直通引擎启动器真实建立会话;本轮没有得到可解析的
|
|
122
|
+
Supervisor/Worker `tool_call` 完成证据,日志出现 `AgentBasePath is not set` 与
|
|
123
|
+
`unsupported_tool: call_mcp_tool`。真实 headless Agent 的 docs MCP 调用已通过,但这
|
|
124
|
+
不能替代 ACP 工具级证据。完整 claim→worker-start→checkpoint→post 生命周期仍为
|
|
125
|
+
`UNVERIFIED`,不得标记为 `COMPLETE`。
|
|
126
|
+
|
|
127
|
+
### 1.4 宿主逐平台路径审计(2026-11-24)
|
|
128
|
+
|
|
129
|
+
本轮按宿主逐一检查 Windows、macOS、Linux 的用户级注册根、桌面应用候选和失败语义:
|
|
130
|
+
|
|
131
|
+
| 宿主 | Windows | macOS | Linux | 结论 |
|
|
132
|
+
| --- | --- | --- | --- | --- |
|
|
133
|
+
| MiniMax Code | `~/.minimax/agents/bugx/agent.md` 和 `~/.minimax/plugins/bugx`;MiniMax Code.exe 与逻辑盘 Program Files 候选 | 同布局,应用包候选 | 同布局,XDG/PATH 候选 | Windows 3.1.17 包解析与注册验证通过,其他平台未取证 |
|
|
134
|
+
| Kimi Code | `KIMI_CODE_HOME`/`%USERPROFILE%\\.kimi-code`;补齐 `Kimi Code.exe`、非系统盘逻辑驱动器与 `.exe/.cmd/.bat` CLI | `KIMI_CODE_HOME`/`~/.kimi-code`;补齐 `Kimi Code.app` 候选 | `KIMI_CODE_HOME`/`~/.kimi-code`;补齐 `kimi-code` 桌面候选 | `AUDITED_OK`(当前协议) |
|
|
135
|
+
| Claude Code | `~/.claude`;补齐逻辑盘 `Program Files` 候选 | `~/.claude` + `~/Library/Application Support/Claude` | `~/.claude` + XDG/Claude 候选 | `AUDITED_OK` |
|
|
136
|
+
| ZCode | `storage.dir` 现在接受 Windows 绝对路径;逻辑盘候选补齐 | `~/.zcode`/`storage.dir` | `~/.zcode`/`storage.dir` | `AUDITED_OK` |
|
|
137
|
+
| Trae | 补齐 Trae/Trae CN 的逻辑盘 `Program Files` 候选与变体识别 | 应用包与 `~/Library/Application Support` | XDG 桌面入口与 PATH | `AUDITED_OK`(发现层) |
|
|
138
|
+
| Cline / Qoder | 用户根 `~/.cline` / `~/.qoder`,不依赖盘符 | 同一用户根契约 | 同一用户根契约 | `AUDITED_OK` |
|
|
139
|
+
| WorkBuddy / FunIDE | `APPDATA`、`LOCALAPPDATA`、数据目录覆盖和有界进程反查 | 应用包/用户数据目录 | XDG/`/proc` 受控反查 | `AUDITED_OK`(发现层) |
|
|
140
|
+
| OpenCode / Codex / Pi / ChatGPT / DSH | 各自项目或受控用户配置;MSIX/DSH 候选不做全盘扫描 | 原生应用/用户配置候选 | PATH/XDG/桌面入口 | `AUDITED_OK`(路径静态审计) |
|
|
141
|
+
|
|
142
|
+
所有声明 `user-agent-registration` 的适配器都必须返回结构化注册回执;返回空值会被安装事务直接阻断,不得再出现“命令成功但用户级插件未注册”的静默结果。当前轮实际运行环境为 Windows;Kimi Code 已完成实际 managed/installed 注册与项目 MCP 验收,macOS/Linux 的宿主真机闭环仍需各自宿主现场证据,不能由本表静态审计替代。
|
|
143
|
+
|
|
144
|
+
DSH 安装契约补充:`ecosystem/integrations/dsh/ui` 始终先发布到
|
|
145
|
+
`DSH_HOME/plugins/bugx-ui`。仅当 `dsh` launcher 位于已探测的 DSH Desktop 安装根下时,
|
|
146
|
+
安装器才调用 `dsh plugin --profile web add`;普通 npm/Python launcher 的插件管理请求
|
|
147
|
+
不得执行,失败时保持 `staged`,不影响 DSH Agent、Skill、MCP 或 preset。Windows Desktop
|
|
148
|
+
运行时的 preset 名称优先从固定候选路径下的 `resources/app.asar` 头部读取;候选只包括
|
|
149
|
+
`%LOCALAPPDATA%\Programs`、`%LOCALAPPDATA%`、`%PROGRAMFILES%`、`%PROGRAMFILES(X86)%`
|
|
150
|
+
和 `%PROGRAMW6432%` 下的 `DeepSeek Harness` 目录,不做全盘扫描。
|
|
151
|
+
ASAR 包名探测递归读取其 `files` 文件树,匹配任意层级的
|
|
152
|
+
`node_modules/@deepseek-ai/<package>`,覆盖 Desktop 当前 `files/dsh/files/node_modules`
|
|
153
|
+
布局;不能确认包名时不得猜测,回退到 profile 实际目录。
|
|
154
|
+
|
|
155
|
+
这些集合不可互换。install adapter 不代表 engine plugin、ACP 或 autonomous CLI 可用。插件 ready 需要六面契约:identity、install、engine_run、worker_runtime、mcp_write、acp。ACP 状态含义:
|
|
156
|
+
|
|
157
|
+
- ready:实现了 ACP argv/启动契约;
|
|
158
|
+
- todo:仓库尚未适配,probe 必须 BLOCKED;
|
|
159
|
+
- unavailable:Host 产品没有 ACP entry,probe 不适用。
|
|
160
|
+
|
|
161
|
+
宿主注册表 schema 版本 `REGISTRY_VERSION = 4`(`core/hosts/__init__.py`):v3 新增
|
|
162
|
+
`WorkerRuntimeFacet.worker_timeout_seconds`,v4 新增 `McpWriteFacet.config_format` 取值
|
|
163
|
+
`yaml_patch`(`core/hosts/base.py`)。
|
|
164
|
+
|
|
165
|
+
- `worker_timeout_seconds`:单 claim 墙钟预算基数,`float | None`,导入期 validate_plugin
|
|
166
|
+
强阻断非正数。当前 cline 与 pi 均声明 `600.0`(`core/hosts/cline.py`、
|
|
167
|
+
`core/hosts/pi.py`):cline 作为 `resolve_worker_timeout` 的 `base_override`,pi 经
|
|
168
|
+
`core/host_runtime/pi.py` 预算透传执行器注入(见下);未声明宿主为 None,tier 阶梯
|
|
169
|
+
行为不变(`core/supervisor/worker_runtime.py`:recon 180 / exploit 600 / verify 300 秒,
|
|
170
|
+
重试退避 `1.5**(attempt-1)`,钳制 10–1800 秒,exploit 保底 ≥600)。
|
|
171
|
+
- `config_format ∈ {json, toml, yaml_patch}`(`core/hosts/base.py` 导入期 validate_plugin
|
|
172
|
+
强校验):`json` 走通用 JSON 骨架;`toml`/`yaml_patch` 是非 JSON 形态,通用 JSON
|
|
173
|
+
骨架不得接管,导入期强制 bootstrap/remove/inspect 三件套由插件自有,否则导入即阻断。
|
|
174
|
+
dsh 用户级 cordis patch(`container_key="insert"` 顶层列表,无「名字→条目」映射形态)
|
|
175
|
+
声明 `config_format="yaml_patch"`(`core/hosts/dsh.py`):探针/诊断按声明分派
|
|
176
|
+
`yaml.safe_load`——没有该声明时 YAML 被当 JSON 解析失败,会结构性误判「未配置」。
|
|
177
|
+
- `requires_absolutize` 声明性过期(`interfaces/cli/bugx_cli/commands/plugin.py`):声明
|
|
178
|
+
该 facet 的宿主(pi/claude 等,stdio MCP server 由宿主进程 spawn,cwd 不是工作区),
|
|
179
|
+
磁盘条目 argv 携带相对 `--root`/`--db` 即判声明性过期并重写为绝对根;绝对形态按
|
|
180
|
+
root 感知 pinned 语义比对,同根重跑逐字段相等 ⇒ unchanged(幂等,不依赖 CLI 进程
|
|
181
|
+
cwd)。
|
|
182
|
+
- pi 执行器 `core/host_runtime/pi.py`:预算透传执行器,不复制审计逻辑(心跳、artifact、
|
|
183
|
+
差分验证、checkpoint、UCB1 记账仍由 `worker_runtime._execute_autonomous_worker`
|
|
184
|
+
独家承载)。注入通道是 `resolve_worker_timeout` 的设计扩展点 `BUGX_WORKER_TIMEOUT`
|
|
185
|
+
环境变量(`core/supervisor/worker_runtime.py`):预算只在委托调用窗口内生效,入口
|
|
186
|
+
保存、`finally` 恢复,异常路径同样恢复,窗口外进程 env 与调用前逐字节一致;窗口内
|
|
187
|
+
profile 预算优先于用户全局 `BUGX_WORKER_TIMEOUT`(宿主事实比全局 env 更具体)。
|
|
188
|
+
语义与 cline `base_override` 一致(退避、钳制、exploit 保底同公式)。
|
|
189
|
+
|
|
190
|
+
### 1.4 Optional code-index MCP
|
|
191
|
+
|
|
192
|
+
项目需要结构化代码导航时使用已锁定的 `codindex` server:
|
|
193
|
+
|
|
194
|
+
bugx mcp-runtime install --timeout 30
|
|
195
|
+
bugx mcp-runtime start --server codindex
|
|
196
|
+
|
|
197
|
+
它通过本地 stdio 提供代码索引、调用图和影响面查询。要求 Node.js >=22.5;保持默认
|
|
198
|
+
`node:sqlite` 驱动,不设置 `CODINDEX_SQLITE=better-sqlite3`。MCP 配置不得改成运行时
|
|
199
|
+
`npx` 或未固定版本的包命令;缺少 lock runtime 时返回 BLOCKED/UNVERIFIED,不把配置存在
|
|
200
|
+
误报为服务已加载。
|
|
201
|
+
|
|
202
|
+
### 1.5 ACP probe status vocabulary
|
|
203
|
+
|
|
204
|
+
`scripts/smoke/smoke_host_acp.py` 的宿主探活只有四个机读状态;词值是下游
|
|
205
|
+
(adversarial_matrix_verify / layer_ceiling_probe)按值比对的契约,禁止改名或新增同义词:
|
|
206
|
+
|
|
207
|
+
VERIFIED 探活通过:本次在带真实运行证据——host/worker 双通道结构化 MCP 工具调用,
|
|
208
|
+
或由本次探活刷新的双通道 Session Proof。唯一代表「探活通过」。
|
|
209
|
+
CONFIGURED 仅 dry-run 配置体检通过:宿主配置里 host/worker 双通道 MCP 注册齐备,
|
|
210
|
+
未拉起宿主进程;不冒充 VERIFIED。
|
|
211
|
+
UNVERIFIED 已登记环境类成因(AUTH_REQUIRED、PROVIDER_CREDITS_EXHAUSTED、
|
|
212
|
+
MODEL_UNAVAILABLE、PROVIDER_RATE_LIMITED、PROBE_BUDGET_EXHAUSTED、
|
|
213
|
+
MODEL_NOT_PINNABLE / MODEL_NOT_OFFERED 等登记项),或探活跑完但无本次
|
|
214
|
+
在带证据;修复环境或补齐证据后可重跑。
|
|
215
|
+
BLOCKED 可执行阻断:参数非法、宿主 CLI 不可用、探针锁冲突、进程/协议层失败、
|
|
216
|
+
探活项目构建失败。
|
|
217
|
+
|
|
218
|
+
exit gate:`_EXIT_OK_STATUSES = {VERIFIED, CONFIGURED}` 返回 0,其余一律 1。失败码处置表
|
|
219
|
+
`_ACP_FAILURE_DISPOSITION` 必须完备,未登记失败码 fail-closed 到 BLOCKED,禁止静默降级。
|
|
220
|
+
|
|
221
|
+
MCP 配置判定按宿主 mcp_write 契约面分支(A1):`_probe_mcp_write_facet` 读取宿主 MCP
|
|
222
|
+
写入面;用户级作用域宿主(`project_relpath=None`)走 `_user_scope_mcp_containers` /
|
|
223
|
+
`_verify_user_scope_mcp_config` 的用户级容器探查,project 级宿主走项目级注册检查。
|
|
224
|
+
`mcp_configured` 判定与 A1 装配门同一事实源,禁止跨作用域误报。
|
|
225
|
+
|
|
226
|
+
容器解析按 `mcp_write.config_format` 声明分派(`scripts/smoke/smoke_host_acp.py`):
|
|
227
|
+
`json` 走 JSON 容器解析,`yaml_patch` 走 `_yaml_patch_container`。解析工具缺口(如
|
|
228
|
+
PyYAML 缺失)抛 `_UserScopeParseUnavailable`,调用方如实降级 UNVERIFIED/BLOCKED,
|
|
229
|
+
不得把工具缺口当成「未配置」的结构性假阴性。dsh 的用户级 YAML patch 含 bugx
|
|
230
|
+
host/worker 双通道条目 ⇒ `mcp_configured=True`,同样经该事实源判定。
|
|
231
|
+
|
|
232
|
+
### 1.6 Provider availability facts
|
|
233
|
+
|
|
234
|
+
宿主通道可用性事实共享提取:`core/host_runtime/provider_facts.py`(依赖图叶子,仅标准库,
|
|
235
|
+
可被上下游同时导入)。受控事实库路径:
|
|
236
|
+
|
|
237
|
+
~/.bugx/facts/cline_provider_facts.json PROVIDER_FACTS_FILE,存储侧 0600 落盘
|
|
238
|
+
|
|
239
|
+
- `load_provider_availability_facts`:读取 providers 事实;缺失/损坏 fail-open 返回空,不阻断裁决。
|
|
240
|
+
- `credits_exhausted`:判定通道 0 余额/credits 耗尽。优先级:通道条目显式声明(facts/条目/
|
|
241
|
+
settings 下的 `credits_exhausted` 布尔值或 `balance`/`credits` 数值)> 事实库声明 >
|
|
242
|
+
无事实(False,行为不变)。
|
|
243
|
+
- 消费方:`host_provider_arbitrator`(聚合层守卫:携带耗尽事实的通道整体降级到健康通道之后,
|
|
244
|
+
healthy + degraded 分区排序,不剔除——仅剩耗尽通道时仍可作为兜底返回);
|
|
245
|
+
`host_evaluators` 评估层守卫(`is_free_model` 命名短路前查事实,耗尽通道跳过
|
|
246
|
+
TIER_1_FREE 短路,按常规梯队参与排序):`evaluate_cline_provider` 之外,
|
|
247
|
+
`evaluate_zcode_candidates` / `evaluate_opencode_candidates` / `evaluate_pi_candidates`
|
|
248
|
+
均接受 `external_facts` 注入(None 时回 `load_provider_availability_facts()`),
|
|
249
|
+
四宿主评估共用同一受控事实库,缺失/损坏 fail-open。
|
|
250
|
+
- 派发层 fail-closed(`core/launch_phases/worker_orchestrator.py`):
|
|
251
|
+
`FAIL_CLOSED_PROVIDER_HOSTS`(当前仅 pi)在 `workers --execute` 无任何显式 provider
|
|
252
|
+
时走 `arbitrate_host_provider` 仲裁取最优真实通道;仲裁为空或 mock-only 时
|
|
253
|
+
`_resolve_fail_closed_provider` 返回显式错误终止派发,绝不静默落 mock。显式
|
|
254
|
+
`--provider` 或 runtime provider 100% 尊重,不仲裁;非在册宿主与提示词模式
|
|
255
|
+
(execute=False)行为不变。新宿主加入前必须完成同型集成取证,不得凭宿主名猜测。
|
|
256
|
+
- 用户充值或事实变化后,删除或改写该文件即恢复通道优先级;显式通道声明优先于事实库。
|
|
257
|
+
|
|
258
|
+
## 2. CLI contract
|
|
259
|
+
|
|
260
|
+
### 2.1 Public entry
|
|
261
|
+
|
|
262
|
+
项目生命周期必须使用:
|
|
263
|
+
|
|
264
|
+
bugx engine --root <project> pre
|
|
265
|
+
bugx engine --root <project> status [--json]
|
|
266
|
+
bugx engine --root <project> workers ...
|
|
267
|
+
bugx engine --root <project> post ...
|
|
268
|
+
|
|
269
|
+
顶层 bugx pre、bugx status、bugx workers、bugx post 等旧入口不执行,会返回迁移错误。bugx engine 不带 engine args 时默认为 status。engine CLI 为全局 engine 进程设置 project root、global engine root 和 CLI version 环境。
|
|
270
|
+
|
|
271
|
+
CLI 的布尔选项统一按开关解析:`--force`、`--json`、`--execute` 等选项直接出现即为
|
|
272
|
+
启用,省略即为关闭,不生成 `--force=True`、`--json=False` 或 `force=True`。MCP/内部
|
|
273
|
+
Python API 的布尔字段仍按各自协议传递,不能把协议字段拼接到 CLI 参数后。
|
|
274
|
+
|
|
275
|
+
帮助可通过 `bugx help <COMMAND> [ACTION]` 查询。显式项目根在业务分发前解析,重复的 `--root` 会拒绝。引擎先校验结算参数,快照预览不创建 CLI 日志,报告共享策略由启动时的 `--report-policy` 决定。在用户主目录(`~`)不带 `--root` 执行 `bugx install` / `bugx doctor` 时进入用户全局模式:仅装配/校验 `~/.bugx/core`、`~/.bugx/knowledge/global.sqlite3`、全局核心依赖(`codebase-memory-mcp==0.12.1` 与 `tree-sitter-language-pack==1.14.3`,二者在 `install` 与 `doctor --repair` 直接安装、绝不降级放行)及宿主用户级资产(DSH 全局 `cordis.patch.yml` 写入动态无 `--root` 参数),绝不将 `~` 初始化为项目或删除 `~/.bugx/core`;项目级 `hosts.json` + `startup-todo.md` 就绪后即允许等待首次 `pre` 确认云端模式。可选能力(`playwright`/`postmcp`/`codindex`/UI/TUI/效率工具/`MCP 离线 runtime`)延迟至实际进入项目审计时按技术栈由 AI 与用户共同决策启用;修复 MCP 离线 runtime 使用 `bugx mcp-runtime install`,清理遗留 MCP 会话使用 `bugx mcp prune --root <ROOT> --yes`。安装载荷缺失时通过显式的 `bugx update --repair-assets` 恢复,CLI 输出端默认强制 UTF-8 编码与替代码保护,确保在 Windows GBK 及无终端管道下稳定运行;UI 视觉挖掘环境要求 Node >= 20。
|
|
276
|
+
|
|
277
|
+
帮助调用 help、--help、-h 必须只读。pre/audit 明确拒绝 --allow-degraded;不要通过该参数请求静默降级。
|
|
278
|
+
|
|
279
|
+
### 2.1.1 Dev mode contract
|
|
280
|
+
|
|
281
|
+
Dev mode has two independent layers:
|
|
282
|
+
|
|
283
|
+
| Input | Contract | Required guard |
|
|
284
|
+
|---|---|---|
|
|
285
|
+
| `BUGX_DEV_MODE=1` | When the current process is a real BugX source checkout, resolve the engine root to `<checkout>/core` so source edits are used without reinstalling | Checkout must have `.git` and `scripts/bump_version.py`; `core/bugx.md` and `core/launch_bugx.py` must exist |
|
|
286
|
+
| `BUGX_DEV_ASSET_ROOT=1` | Compatibility alias for `BUGX_DEV_MODE=1` | Prefer `BUGX_DEV_MODE`; exact value is `1` |
|
|
287
|
+
| `BUGX_GLOBAL_ENGINE_ROOT=<path>` | Explicit global engine override | Takes precedence over Dev engine; if present, do not claim source checkout is active |
|
|
288
|
+
| `BUGX_ASSET_ROOT=<path>` | Explicit asset candidate override | Not equivalent to Dev mode; validate source/installed asset provenance before use |
|
|
289
|
+
| `pre --dev` / `audit --dev` | Lifecycle shortcut, not engine-source selection | Defaults `autonomous=true`, `review-mode=mcp-auto`, `fix-mode=auto`, `polling=auto`, `commit-policy=round`, `session-recovery=resume`, `startup-action=start`, `strategy-plan=approve`; it skips strategy questions |
|
|
290
|
+
|
|
291
|
+
The first read-only proof for source Dev mode is:
|
|
292
|
+
|
|
293
|
+
env -u BUGX_GLOBAL_ENGINE_ROOT BUGX_DEV_MODE=1 \
|
|
294
|
+
bugx engine --root <project> path --name launch_bugx.py
|
|
295
|
+
|
|
296
|
+
The result must resolve to `<source-checkout>/core/launch_bugx.py`. A result under `~/.bugx/core`, a wheel, an npm package, or another directory means source Dev mode is not active. Do not continue to `pre` until the provenance is corrected.
|
|
297
|
+
|
|
298
|
+
Safe source verification keeps lifecycle mutation explicit:
|
|
299
|
+
|
|
300
|
+
env -u BUGX_GLOBAL_ENGINE_ROOT BUGX_DEV_MODE=1 \
|
|
301
|
+
bugx engine --root <project> pre \
|
|
302
|
+
--fix-mode log-only --commit-policy manual --cloud-sync local
|
|
303
|
+
|
|
304
|
+
Only use `pre --dev` when the target is isolated, reversible, and the user explicitly authorized automatic repair and round commits. Explicit `--cloud-sync` or a saved profile overrides Dev's local cloud default. `--cloud-sync` is accepted through the engine argument passthrough and is also an `init` option; the two calls have different persistence semantics.
|
|
305
|
+
|
|
306
|
+
Dev mode does not bypass Git, version, MCP, credential, budget, evidence, or Host gates. The next action is determined as follows:
|
|
307
|
+
|
|
308
|
+
engine path mismatch -> STOP, inspect process source and override variables
|
|
309
|
+
pre exit 2 -> read BUGX_INTERACTION_REQUEST, wait for real choice
|
|
310
|
+
pre exit 3 -> reinstall/load Host entry, restart Host, rerun pre once
|
|
311
|
+
other non-zero -> collect stderr/status/log, classify BLOCKED or RECOVERY_REQUIRED
|
|
312
|
+
pre exit 0 -> startup gate only; continue lifecycle, not completion
|
|
313
|
+
|
|
314
|
+
No model text, Task print, `ready`, `claim`, or `pre` exit 0 can be reported as lifecycle completion. Completion still requires real Worker receipts, checkpoint, coverage/evidence, Finding verification, post and settlement.
|
|
315
|
+
|
|
316
|
+
### 2.2 Autonomous and goal
|
|
317
|
+
|
|
318
|
+
autonomous contract:
|
|
319
|
+
|
|
320
|
+
bugx autonomous --root <project>
|
|
321
|
+
--host {claude,codex,opencode,dsh,pi,kimi,cline,zcode}
|
|
322
|
+
[--workers N] [--model MODEL] [--provider PROVIDER]
|
|
323
|
+
[--max-turns N] [--max-wall-time SECONDS]
|
|
324
|
+
[--agent-timeout SECONDS] [--coverage-manifest PATH]
|
|
325
|
+
[--no-adaptive-wall-time] [--adaptive-baseline VALUE] [--json]
|
|
326
|
+
|
|
327
|
+
workers=0 means host-derived adaptive capacity. Explicit workers must satisfy the selected WorkerRuntimeFacet bounds. The command may run host installation first. model is not a credential; the current implementation uses a run-time OpenCode model override when applicable. Provider rate-limit is a persistent gate; do not delete provider-window state to bypass it. Successful exit requires result status complete; aborted, blocked, budget, timeout, or incomplete results are not success.
|
|
328
|
+
|
|
329
|
+
goal contract:
|
|
330
|
+
|
|
331
|
+
bugx goal [TARGET_DESCRIPTION] [--root <project>]
|
|
332
|
+
[--host HOST] [--target-coverage PERCENT]
|
|
333
|
+
[--allow-open-findings] [--disallow-quarantine]
|
|
334
|
+
[--max-turns N] [--max-wall-time SECONDS]
|
|
335
|
+
[--agent-timeout SECONDS]
|
|
336
|
+
[--max-unit-retries N] [--max-transient-retries N] [--json]
|
|
337
|
+
|
|
338
|
+
默认 host=claude、target-coverage=100.0、max-wall-time=14400.0、agent-timeout=600.0、unit-retries=3、transient-retries=5;默认要求无 open findings,quarantine 默认允许。任何放宽参数都必须出现在最终报告。
|
|
339
|
+
|
|
340
|
+
### 2.3 Audit and report
|
|
341
|
+
|
|
342
|
+
audit graph 可以返回 ready 与 awaiting_native_agent;awaiting_native_agent 表示等待真实 Native Agent,不是完成。audit deep 是一次性深度流程;报告仍以 receipt、Finding、coverage 和 gate 为权威。
|
|
343
|
+
|
|
344
|
+
report source 语义:
|
|
345
|
+
|
|
346
|
+
project = authoritative project Supervisor state
|
|
347
|
+
eval = evaluation receipt directory
|
|
348
|
+
auto = eval fallback only when project source is blocked and eval exists
|
|
349
|
+
|
|
350
|
+
缺少项目 state 时,报告必须保留 NOT ATTESTED,不得制造 Finding、coverage 或 attestation。
|
|
351
|
+
|
|
352
|
+
## 3. MCP server contract
|
|
353
|
+
|
|
354
|
+
### 3.1 Server identity
|
|
355
|
+
|
|
356
|
+
protocolVersion: 2024-11-05
|
|
357
|
+
serverName: bugx-supervisor
|
|
358
|
+
serverVersion: 0.1.5
|
|
359
|
+
hostHeartbeatIntervalSeconds: 5.0
|
|
360
|
+
transport: local stdio
|
|
361
|
+
|
|
362
|
+
Server 是有限请求处理器,不替 Host 长轮询,不自行启动 Worker,不进行隐式项目初始化。tools/list 的真实握手后写入 session proof;proof 必须绑定 scope、lifecycle、run 和实际会话身份。
|
|
363
|
+
|
|
364
|
+
### 3.2 Roles
|
|
365
|
+
|
|
366
|
+
host:
|
|
367
|
+
|
|
368
|
+
- Supervisor control plane;
|
|
369
|
+
- start、gate、finish、fail、recover、next-round;
|
|
370
|
+
- Finding verify/confirm;
|
|
371
|
+
- target rebinding、budget reset、checkpoint salvage;
|
|
372
|
+
- graph orchestration。
|
|
373
|
+
|
|
374
|
+
worker:
|
|
375
|
+
|
|
376
|
+
- claim、worker-start;
|
|
377
|
+
- tool-call、heartbeat;
|
|
378
|
+
- checkpoint、submit-finding;
|
|
379
|
+
- 受控 probe 和 worker graph checks。
|
|
380
|
+
|
|
381
|
+
shared:
|
|
382
|
+
|
|
383
|
+
- status、gate、coverage 和只读知识/观测工具;
|
|
384
|
+
- shared 不表示任意角色都可以执行所有副作用参数,仍按工具表 role gate。
|
|
385
|
+
|
|
386
|
+
Worker 必须通过 BUGX_NATIVE_AGENT_ID 或宿主等价机制传递真实身份。一个固定字符串不能代表多个 Worker。
|
|
387
|
+
|
|
388
|
+
### 3.3 Resources and prompts
|
|
389
|
+
|
|
390
|
+
Resources:
|
|
391
|
+
|
|
392
|
+
bugx://state/status
|
|
393
|
+
bugx://state/coverage
|
|
394
|
+
bugx://state/coverage?offset=<n>&limit=<n>
|
|
395
|
+
bugx://findings/recent
|
|
396
|
+
bugx://knowledge/mistakes
|
|
397
|
+
bugx://profile/target
|
|
398
|
+
|
|
399
|
+
Prompts:
|
|
400
|
+
|
|
401
|
+
bugx-audit-explore
|
|
402
|
+
bugx-fuzz-mutate
|
|
403
|
+
bugx-repro-verify
|
|
404
|
+
bugx-gate-decision
|
|
405
|
+
|
|
406
|
+
Prompt、resource 和 tools/list 只能提供上下文或协议事实;它们不构成生命周期完成证据。
|
|
407
|
+
|
|
408
|
+
### 3.4 Tool inventory by role
|
|
409
|
+
|
|
410
|
+
Host-only tools:
|
|
411
|
+
|
|
412
|
+
bugx_supervisor_start
|
|
413
|
+
bugx_supervisor_findings
|
|
414
|
+
bugx_supervisor_reset_budget
|
|
415
|
+
bugx_supervisor_rebind_target
|
|
416
|
+
bugx_supervisor_sync_finding_decisions
|
|
417
|
+
bugx_supervisor_verify_finding
|
|
418
|
+
bugx_supervisor_confirm_finding
|
|
419
|
+
bugx_supervisor_bootstrap_coverage
|
|
420
|
+
bugx_supervisor_reopen_finding
|
|
421
|
+
bugx_supervisor_admit_business
|
|
422
|
+
bugx_supervisor_salvage_checkpoint
|
|
423
|
+
bugx_supervisor_next_round
|
|
424
|
+
bugx_supervisor_bind_context
|
|
425
|
+
bugx_supervisor_finish
|
|
426
|
+
bugx_supervisor_fail
|
|
427
|
+
bugx_supervisor_recover
|
|
428
|
+
graph_start
|
|
429
|
+
graph_next
|
|
430
|
+
graph_bind_agent
|
|
431
|
+
graph_cancel
|
|
432
|
+
graph_finalize
|
|
433
|
+
bugx_mining_harden
|
|
434
|
+
|
|
435
|
+
Worker-only tools:
|
|
436
|
+
|
|
437
|
+
bugx_supervisor_claim
|
|
438
|
+
bugx_supervisor_worker_start
|
|
439
|
+
bugx_supervisor_tool_call
|
|
440
|
+
bugx_supervisor_heartbeat
|
|
441
|
+
bugx_supervisor_checkpoint
|
|
442
|
+
bugx_supervisor_begin_long_call
|
|
443
|
+
bugx_supervisor_run_sandboxed_probe
|
|
444
|
+
bugx_supervisor_submit_finding
|
|
445
|
+
graph_context
|
|
446
|
+
graph_run_check
|
|
447
|
+
graph_checkpoint
|
|
448
|
+
bugx_fuzz_concurrency
|
|
449
|
+
bugx_fuzz_stateful
|
|
450
|
+
bugx_verify_differential_poc
|
|
451
|
+
bugx_ingest_coverage
|
|
452
|
+
bugx_inspect_mobile_ui
|
|
453
|
+
bugx_fuzz_input
|
|
454
|
+
bugx_minimize_repro
|
|
455
|
+
bugx_query_behavior_graph
|
|
456
|
+
bugx_audit_web_conformance
|
|
457
|
+
bugx_test_verify
|
|
458
|
+
|
|
459
|
+
Shared tools:
|
|
460
|
+
|
|
461
|
+
bugx_supervisor_status
|
|
462
|
+
bugx_supervisor_gate
|
|
463
|
+
bugx_supervisor_coverage
|
|
464
|
+
bugx_knowledge_route
|
|
465
|
+
bugx_harness_status
|
|
466
|
+
bugx_oracle_suggest
|
|
467
|
+
bugx_lesson_retrieve
|
|
468
|
+
bugx_tool_matrix
|
|
469
|
+
bugx_incident_hints
|
|
470
|
+
bugx_request_token_renewal
|
|
471
|
+
bugx_efficiency_card
|
|
472
|
+
bugx_get_stage_harness
|
|
473
|
+
bugx_distill_evidence
|
|
474
|
+
bugx_inspect_source
|
|
475
|
+
bugx_scheduling_telemetry
|
|
476
|
+
bugx_global_telemetry
|
|
477
|
+
bugx_retrieval_metrics
|
|
478
|
+
bugx_mining_explore
|
|
479
|
+
bugx_mining_audit
|
|
480
|
+
bugx_test_mutate
|
|
481
|
+
bugx_retrieve_slice
|
|
482
|
+
bugx_extract_ego_subgraph
|
|
483
|
+
bugx_memory_query
|
|
484
|
+
|
|
485
|
+
总工具数为 66。工具名存在不代表当前 role、Host、scope 或生命周期允许调用;role gate 和 claim epoch 始终优先。
|
|
486
|
+
|
|
487
|
+
Web/UI 入口为 `bugx probe [--timeout-seconds <秒>] ui --root <项目> --url <URL>`。
|
|
488
|
+
外层看护默认 120 秒,允许显式设置到 1800 秒以内;它不替代页面/动作自己的超时。
|
|
489
|
+
`manifest.json` 绑定项目根、
|
|
490
|
+
run ID、Chromium、视口、原生缩放、截图哈希、axe-core 和场景结果。`dynamic-evidence.json`
|
|
491
|
+
是版本化清单引用。Web 标准检查器回读哈希、截图和观测结果。`DESIGN.md` 的 `bugx-ui`
|
|
492
|
+
提供 token、组件、对比度、重排、`journeys` 与 `keyboard`。`--journeys` 执行两类场景。
|
|
493
|
+
`--reference-url` 使用同配置的浏览器对照截图。`--repair-css` 默认预览,`--apply` 需要
|
|
494
|
+
回环目标,验证 `repair.json` 和二次收据,新增视觉退化会回滚。模型 `ADVISORY` 独立保存。
|
|
495
|
+
|
|
496
|
+
### 3.5 bugx-docs dual-scope server contract
|
|
497
|
+
|
|
498
|
+
- **Transport & Channels**:默认采用「远程优先(Remote-First)」策略直连只读官方官档端点 `/api/v1/mcp/docs?contract_version=<X.Y.Z>`;网络不可达或传入 `--docs-transport stdio` / `BUGX_DOCS_OFFLINE=1` 时自动无感降级为本地 `stdio` 网关 (`bugx mcp docs serve --root . --db .bugx/knowledge/docs.sqlite3`)。项目私有文档(`project:<id>`)严格本地隔离,永不上云。
|
|
499
|
+
- **Dual-Scope Isolation**:
|
|
500
|
+
- `bugx:official`:优先读取 `~/.bugx/cache/docs/<contract_version>/<sha256>.sqlite3`(经 `sync.lock` 单飞锁、1.5s manifest 超时、`contract_version` 前缀校验、SHA-256 + `PRAGMA quick_check` 验签并原子切换 `current.json`,旧文件即时或 `.gc-pending` 延迟物理删除);离线、未配置或服务端未就绪时自动回退至随包基线 `core/bundled_docs/`。
|
|
501
|
+
- `project:<id>`:仅扫描当前工作区可控 Markdown(`README*`、`docs/**/*.md`、`core/**/*.md`),严格落盘在 `<ROOT>/.bugx/knowledge/docs.sqlite3`,绝不上云。
|
|
502
|
+
- **Section-Chunked Schema & Tools**:索引层采用 `document_sections` + `sections_fts (tokenize='trigram')`,提供 `resolve_library`、`search_docs`、`list_sections`、`fetch_doc`(按标题路径切分且保留嵌套 `###` 子标题,匹配失败返回规范 TOC 清单)。
|
|
503
|
+
- **Airgap & Orthogonality**:`BUGX_DOCS_OFFLINE=1`、`cloud.docs_remote_enabled=false` 或 `--mode local-only` 下保证 `bugx-docs` 零出网;`bugx-docs` 只做无状态只读操作指导 RAG,与 18 张表的结构化错题/经验台账 `lesson-ledger.sqlite3` 及语言数据集 `seed_corpus` 严格正交分离、互不合并。
|
|
504
|
+
|
|
505
|
+
Storybook 使用 `--storybook <base> --list-stories` 或 `--story <id>`,从 v4/v5 index 取证,
|
|
506
|
+
绑定 story ID、预览路径及 index 哈希。场景通过 `story` 选组件画布,`--reference-url`
|
|
507
|
+
指向参考 Storybook 基地址。`token_source` 将项目内 DTCG 或 Style Dictionary JSON 映射到
|
|
508
|
+
根 CSS 变量,收据保留文件哈希。失效引用、循环和越界路径都在采集前阻断。
|
|
509
|
+
|
|
510
|
+
## 4. Mandatory lifecycle algorithm
|
|
511
|
+
|
|
512
|
+
Host/Worker 编排必须实现以下顺序:
|
|
513
|
+
|
|
514
|
+
1. Host runs pre and obtains project/polling/lifecycle/run context.
|
|
515
|
+
2. Host calls bugx_supervisor_start.
|
|
516
|
+
3. Worker calls bugx_supervisor_claim for one unit.
|
|
517
|
+
4. Worker immediately calls bugx_supervisor_worker_start.
|
|
518
|
+
5. Worker records every tool use with bugx_supervisor_tool_call.
|
|
519
|
+
6. Worker renews lease with heartbeat during long work.
|
|
520
|
+
7. Worker calls checkpoint with a stable checkpoint_id.
|
|
521
|
+
8. Worker may submit candidate Finding; it cannot confirm it.
|
|
522
|
+
9. Host independently verifies and then confirms/rejects the Finding.
|
|
523
|
+
10. Host reads gate, coverage, findings and report state.
|
|
524
|
+
11. Host calls next_round only when gate is unsatisfied and recovery/next work is valid.
|
|
525
|
+
12. Host calls finish/post only after finish policy is satisfied.
|
|
526
|
+
|
|
527
|
+
要求:
|
|
528
|
+
|
|
529
|
+
- claim response execution_state=claimed,不是 running;
|
|
530
|
+
- claim/start 是两个独立证据;
|
|
531
|
+
- 单次 claim 默认一个 work unit;bundle allowance 只能来自本地 orchestrator 的明确契约;
|
|
532
|
+
- checkpoint retry 复用同一个 checkpoint_id,避免重复事实;
|
|
533
|
+
- lease epoch/claim epoch 不匹配时 fail-closed;
|
|
534
|
+
- Host 是 controller lease 的唯一控制方;
|
|
535
|
+
- next_round 返回 GATE_UNSATISFIED 时不得当作成功;
|
|
536
|
+
- 没有人工补写状态、补发命令或替 Agent 决策时,自治流程才可能进入终态。
|
|
537
|
+
|
|
538
|
+
## 5. Evidence and checkpoint contract
|
|
539
|
+
|
|
540
|
+
checkpoint payload 应绑定:
|
|
541
|
+
|
|
542
|
+
checkpoint_id
|
|
543
|
+
project_id / project_root identity
|
|
544
|
+
polling_id
|
|
545
|
+
lifecycle_id
|
|
546
|
+
run_id
|
|
547
|
+
round
|
|
548
|
+
worker_id
|
|
549
|
+
claim_epoch / lease
|
|
550
|
+
findings
|
|
551
|
+
coverage
|
|
552
|
+
evidence
|
|
553
|
+
notes
|
|
554
|
+
|
|
555
|
+
每个 evidence receipt 的最小可验证字段:
|
|
556
|
+
|
|
557
|
+
command
|
|
558
|
+
exit_code
|
|
559
|
+
artifact_path
|
|
560
|
+
artifact_sha256
|
|
561
|
+
target_fingerprint
|
|
562
|
+
timestamp
|
|
563
|
+
worker_id
|
|
564
|
+
run_id
|
|
565
|
+
round
|
|
566
|
+
lease
|
|
567
|
+
status
|
|
568
|
+
|
|
569
|
+
evidence status 只有:
|
|
570
|
+
|
|
571
|
+
passed, failed, error, skipped, blocked
|
|
572
|
+
|
|
573
|
+
Coverage status 是另一套枚举:
|
|
574
|
+
|
|
575
|
+
pending, covered, blocked, unverified, partial,
|
|
576
|
+
not_applicable, stale, removed, superseded, corrupted
|
|
577
|
+
|
|
578
|
+
covered 是 coverage value,不是 evidence status。pending、partial、unverified、stale、blocked 是 coverage debt;corrupted 是全局阻塞。缺少 artifact hash、target fingerprint、exit code 或身份绑定时,不能填 passed。
|
|
579
|
+
|
|
580
|
+
覆盖继承沿链溯源(`core/coverage/coverage_discovery.py`):covered 判定带 `inherited_from`
|
|
581
|
+
备注时沿备注继续向祖先溯源。单跳直接采纳;多跳成功返回 `chain=<polling-id>/<lifecycle-id> -> ...`
|
|
582
|
+
供结算日志留痕。fail-closed 条件(不随链条放宽):任一跳清单缺失/无法解析/scope 无 covered
|
|
583
|
+
判定;任一跳存在矛盾的本地非 passed 记录(自报 covered 却有 failed/error);链条成环或深度超过
|
|
584
|
+
`MAX_INHERITED_CHAIN_DEPTH = 32`;链条终点自称本地产出却没有本地 passed 记录。继承绝不复制
|
|
585
|
+
证据文件、绝不改写字段,源记录 `target_fingerprint` 漂移与 `observed_at` 年龄信号原样保留。
|
|
586
|
+
|
|
587
|
+
双轨目录排除与渐进式发现(DOC-AIREV):
|
|
588
|
+
- **Track 1(静态白名单)**:`symbol_index` 与探针层自动硬排除 `.git`、`node_modules`、`.tools`、`artifacts` 等已知通用依赖/构建产物;
|
|
589
|
+
- **Track 2(AI 语义扫尾)**:白名单不是万能的,白名单放行后的剩余顶层目录须通过 `coverage review-packages` / `review-apply` 由宿主 AI 基于证据逐一复审并移出非产品目录(持久化于 `.bugx/knowledge/coverage-review.json`);
|
|
590
|
+
- **Tier-1 初始化骨架**:`bugx init` 默认以 `files` 模式建立轻量骨架避免大仓启动挂死;`symbol_index.audit_units` 采用 `.bugx/cache/symbol_cache.db` 持久化缓存与多核并发解析支持大仓全量运行。
|
|
591
|
+
|
|
592
|
+
run_sandboxed_probe 的边界是 argv-only、禁止 shell launcher/operators、timeout 0.5–60 秒和 artifact/evidence 记录;它不是 OS 文件系统 sandbox。AI 不得向用户宣称更强隔离。
|
|
593
|
+
|
|
594
|
+
探针包 `core/probes/__init__.py` 按 PEP 562 模块级 `__getattr__` 惰性加载
|
|
595
|
+
(`_LAZY_MEMBERS`):BaseProbe 保持 eager(probe_registry 注册面依赖),其余探针成员
|
|
596
|
+
首次属性访问才 import;`from core.probes import X` / `from core.probes.X import Y` /
|
|
597
|
+
子模块直 import 三种消费形态语义不变。引擎门禁链不再为重型探针依赖支付 eager
|
|
598
|
+
import 税。
|
|
599
|
+
|
|
600
|
+
## 6. Finding verification and finish policy
|
|
601
|
+
|
|
602
|
+
Finding state machine:
|
|
603
|
+
|
|
604
|
+
candidate -> verify -> confirmed
|
|
605
|
+
\-> rejected
|
|
606
|
+
|
|
607
|
+
submit_finding 只产生 candidate。verify_finding 由 Host 执行两条独立 positive cases 加固定 negative control,并记录 receipt/hash。confirm_finding 必须绑定 verify receipt;Worker 自报、模型判断或单个正例不够。
|
|
608
|
+
|
|
609
|
+
REFUTED 是结构性证伪终态,schema 强约束(`core/ledger/finding_lifecycle.py`,NR-5 fail-closed):
|
|
610
|
+
|
|
611
|
+
block_reason ∈ REFUTED_BLOCK_REASONS
|
|
612
|
+
= non_reproducible | by_design | fixed_upstream
|
|
613
|
+
| evidence_insufficient | dynamic_probe_cleared
|
|
614
|
+
|
|
615
|
+
并要求 `refuted_by` / `refuted_evidence` / `original_severity` 结构化字段。理由只允许取自
|
|
616
|
+
枚举,自由文本敷衍视为未提供;违规写入直接抛 `LifecycleError` 强阻断。旧格式(字符串
|
|
617
|
+
confirmation、空 block_reason、severity 塌缩 info)明确拒绝,补齐结构化字段后重判。
|
|
618
|
+
|
|
619
|
+
历史台账的原级已丢失时禁止补写合法枚举:`original_severity="unknown"` 必须同时携带
|
|
620
|
+
`severity_unknown_reason`,`refuted_strength()` 与 `refuted_validation_status="legacy"`
|
|
621
|
+
会把这类记录标为不可按证伪强度消费。`retriage-legacy` 只处理裁决文件中逐条给出证据引用的
|
|
622
|
+
记录(填合法原级还必须有 `severity_evidence`),未裁决记录保持 legacy 原样;
|
|
623
|
+
`reconcile()` 亦不再把历史 REFUTED 回补成 `unverified`。
|
|
624
|
+
|
|
625
|
+
Finding 定位按四键唯一匹配(`core/supervisor/finding_workflow.py`):verify 预检、验证
|
|
626
|
+
落账与 `confirm_finding` 都把传入 key 与每条 finding 的 `fingerprint` / `id` /
|
|
627
|
+
`finding_id` / `_finding_key` 四键比对,唯一命中才通过;零命中或多命中一律
|
|
628
|
+
`InvalidCheckpoint` fail-closed。只放宽到唯一匹配,不放宽到模糊匹配。
|
|
629
|
+
|
|
630
|
+
派生 findings.json 结算前置校验(`core/launch_phases/finding_settlement.py`):
|
|
631
|
+
`findings_json_stale_vs_authority` 对派生视图与 Supervisor 权威态做两条从严信号——
|
|
632
|
+
`supervisor_binding.findings_revision` 落后于权威 revision;权威终态(confirmed/rejected)
|
|
633
|
+
未在派生视图同态出现(落后或反向篡改)。命中即 stale:`refresh_stale_findings_json`
|
|
634
|
+
把旧文件改名为 `.stale-backup`(冲突追加时间戳,绝不覆盖)并放行 post auto_build 从
|
|
635
|
+
权威态重建;一致文件幂等不动。检查自身失败不放大阻断,交由快照校验兜底。
|
|
636
|
+
|
|
637
|
+
finish gate 需要同时检查:
|
|
638
|
+
|
|
639
|
+
- coverage 不是 false,且所需 coverage gate 已满足;
|
|
640
|
+
- 没有 open findings;
|
|
641
|
+
- Finding confirmation ready;
|
|
642
|
+
- 需要并发的 life 满足并发要求;
|
|
643
|
+
- 没有 budget/deadline blocker;
|
|
644
|
+
- 报告已经持久化;
|
|
645
|
+
- graph flow 的 recon、repro、review 有 digest,且没有 candidate bugs;
|
|
646
|
+
- repair_preview 还有 confirmed bug、patch/check 完成和 regression observation passed。
|
|
647
|
+
|
|
648
|
+
典型状态:
|
|
649
|
+
|
|
650
|
+
RUNNING
|
|
651
|
+
CHECKPOINT
|
|
652
|
+
NEXT_ROUND
|
|
653
|
+
STALLED
|
|
654
|
+
INCOMPLETE
|
|
655
|
+
COMPLETE
|
|
656
|
+
BUDGET_EXHAUSTED
|
|
657
|
+
FAILED
|
|
658
|
+
|
|
659
|
+
开放 Finding、confirmation pending、并发不足或 coverage debt 通常只能是 INCOMPLETE;预算或期限原因是 BUDGET_EXHAUSTED。不要通过 allow-incomplete 把 INCOMPLETE 改名为 COMPLETE。
|
|
660
|
+
|
|
661
|
+
## 7. Failure and recovery contract
|
|
662
|
+
|
|
663
|
+
| 观察 | 必须返回或保留 | Host 下一步 |
|
|
664
|
+
|---|---|---|
|
|
665
|
+
| ACP 未适配 | BLOCKED 或 UNAVAILABLE | 不伪造 ACP session;换 ready Host 或报告阻塞 |
|
|
666
|
+
| MCP role 错误 | FAILED/BLOCKED | 重新以正确 role 建立 session;不调用越权工具 |
|
|
667
|
+
| claim 后未 start | STALLED/INCOMPLETE | 重新派发或回收 claim;不要声称 Worker running |
|
|
668
|
+
| heartbeat/lease 丢失 | RECOVERY_REQUIRED 或 STALLED | Host salvage/recover;校验 epoch |
|
|
669
|
+
| checkpoint 失败 | CHECKPOINT/RECOVERY_REQUIRED | 用同 checkpoint_id 重试或 Host salvage |
|
|
670
|
+
| MCP/tool error | FAILED 或可观测重试状态 | 记录错误与退出码;超过 retry 转 ABORTED/BLOCKED |
|
|
671
|
+
| provider rate limit | BLOCKED | 等待持久化窗口或按明确输出恢复;不删 window |
|
|
672
|
+
| 预算耗尽 | BUDGET_EXHAUSTED | 由 Host/用户确认后 reset-budget 或结束 |
|
|
673
|
+
| coverage debt/open Finding | INCOMPLETE | 新轮次、verify/confirm 或明确报告债务 |
|
|
674
|
+
| 宿主输出截断 | UNVERIFIED/ERROR | 缺失 receipt 字段不能补写 passed |
|
|
675
|
+
| post/share 失败 | RECOVERY_REQUIRED | 读取 report-consumption 和 post receipt,走 recovery |
|
|
676
|
+
| owner 进程死亡后跨会话 --final | aborted + successor_closeout_admitted 留痕 | 证据齐全才 admit(见下);无死亡证明 fail-closed 拒绝 |
|
|
677
|
+
| serial_authorization 身份漂移 | BLOCKED | runtime_run_uuid 必须是 canonical UUID 或引擎 lifecycle run_id 形态 |
|
|
678
|
+
|
|
679
|
+
跨会话 owner_cancelled 收口(E1 观察 #3,`core/launch_phases/post_phase.py`
|
|
680
|
+
`_supervisor_owner_cancelled_proof`):owner 进程死亡后 runtime 被孤儿裁决收敛为
|
|
681
|
+
aborted,「本会话 pre 授权」跨会话不可达,诚实 INCOMPLETE 收口永久不可达。合法接手 =
|
|
682
|
+
以下证据全部在场,任一缺失 fail-closed:1) runtime 为 aborted 终态;2) 项目布局下
|
|
683
|
+
runtime 的 lifecycle_id 等于 current.json 当前绑定;3) Supervisor 权威链在场
|
|
684
|
+
`operation=lifecycle` / `gate=owner_cancelled` 阻断事件(D27 宿主取消回传,即 owner
|
|
685
|
+
死亡证明);4) 链身份绑定同一 lifecycle(round_id 相等且 run_id 在允许形态集合内)且
|
|
686
|
+
会话代际一致。admit 后向 runtime 追加 `successor_closeout_admitted` 事件留痕。
|
|
687
|
+
|
|
688
|
+
serial_authorization lifecycle run_id 形态:引擎 lifecycle run_id 由
|
|
689
|
+
`_expected_supervisor_run_id`(`core/launch_phases/supervisor_bridge.py`)派生为
|
|
690
|
+
`lifecycle-<session_id>-<lifecycle_id>`(session_id 即 polling_id,消除跨 polling 撞键;
|
|
691
|
+
无 polling 上下文的遗留单轮布局回退裸 `lifecycle-<lifecycle_id>`)。
|
|
692
|
+
`core/supervisor/serial_authorization.py` 强制 runtime_run_uuid 为 canonical UUID 或该
|
|
693
|
+
形态;Supervisor run_id 与 runtime 采纳形态必须一致,身份映射不清时不得宣称完成。
|
|
694
|
+
|
|
695
|
+
恢复会话结算语义(`core/supervisor/budget_governor.py`,三维度):维度 1 在把 expired
|
|
696
|
+
报成重试债前,先检查各 expired claim 的单元是否 100% 沿链继承覆盖(manifest 行带
|
|
697
|
+
`inherited_from` 备注 + 溯源可达 passed);全继承的 claim 标记
|
|
698
|
+
`superseded_by_inheritance`(hash-chain 事件 `expired_claim_superseded_by_inheritance`
|
|
699
|
+
留痕)并移出 expired 集合不再重派,任一单元未覆盖/伪造/溯源失败则整包保留进重派
|
|
700
|
+
路径。维度 2 只豁免 `require_parallel` 的并发证明债(`_RECOVERY_PARALLEL_PROOF_REASONS`):
|
|
701
|
+
`_recovery_closeout_exemption` 三条件全真才豁免并落 `parallel_gate_inherited_closeout`
|
|
702
|
+
留痕——① Supervisor 权威链在场 `operation=lifecycle` / `gate=owner_cancelled` 死亡
|
|
703
|
+
证明;② 覆盖普查全部清单行沿链继承覆盖或历史 covered,且本轮无新增 passed 证据;
|
|
704
|
+
③ owner 死亡锚点后 `found_total` 增量为 0(finding 无 `origin_receipt.sealed_at`
|
|
705
|
+
不可归属时同样不成立)。fail-closed 红线:三条件缺一即拒绝;探针/清单/证据基础设施
|
|
706
|
+
故障一律维持原门禁(legacy 行为),只在快照留诊断字段,绝不借故障放宽。
|
|
707
|
+
|
|
708
|
+
report consumption phase:
|
|
709
|
+
|
|
710
|
+
OPEN -> POSTING -> SETTLED
|
|
711
|
+
\-> RECOVERY_REQUIRED
|
|
712
|
+
|
|
713
|
+
普通 status、claim 不会默默恢复损坏状态;recover 是 Host 显式动作。任何失败必须进入 COMPLETE、ABORTED、BLOCKED、RECOVERY_REQUIRED、INCOMPLETE、BUDGET_EXHAUSTED 或 FAILED 等可观察状态,不得无限等待。
|
|
714
|
+
|
|
715
|
+
## 8. RSI autonomous loop ledgers
|
|
716
|
+
|
|
717
|
+
`scripts/verification/rsi_self_reflection.py` 的自治循环按 `DIMENSION_PIPELINE` 顺序流转:
|
|
718
|
+
static_scan → runtime_e2e → capability_audit → performance_baseline → pain_mining →
|
|
719
|
+
capability_expansion → 回到 static_scan。循环由以下台账驱动(路径相对仓库根):
|
|
720
|
+
|
|
721
|
+
state/rsi-loop/task_ledger.json TASK_LEDGER 能力工作台账
|
|
722
|
+
state/rsi-loop/pain_signals.json PAIN_SIGNALS_LEDGER 痛点信号
|
|
723
|
+
state/rsi-loop/upgrade_plan.json UPGRADE_PLAN_LEDGER 升级方案
|
|
724
|
+
.bugx/rsi-loop/question_stats.json QUESTION_STATS_LEDGER 题目退役统计
|
|
725
|
+
.bugx/rsi-loop/time_ledger.json TIME_LEDGER 耗时账本
|
|
726
|
+
.bugx/rsi-loop/startup_baseline.json time_model 性能基线(within_budget 判定)
|
|
727
|
+
|
|
728
|
+
TASK_LEDGER 双动作 `_TASK_LEDGER_ACTIONS`(只此两个):`degrade_contract` = 契约存在
|
|
729
|
+
(expansion 面);`verify_pass` = 真机验证闭环(audit 面,桥接进 `_verified_capabilities`)。
|
|
730
|
+
`_record_task_done` 幂等:同 module+action+status=done 不重复写。契约存在不等于验证通过,
|
|
731
|
+
两个动作不互相替代(F-328 防重复触发的单一真源)。
|
|
732
|
+
|
|
733
|
+
耗时预算按场景分档(F-P3):`TIME_PROFILES` = interactive 0.5h / ci 8h / overnight 24h /
|
|
734
|
+
weekly 168h,`ACTIVE_TIME_PROFILE = "ci"`。派生规则:大型 = 档位×7,小型 = 档位÷8(下限
|
|
735
|
+
0.1h);权威判定走 `_budget_hours_for()`(读激活场景档)。`PRODUCT_IDENTITY.time_budget`
|
|
736
|
+
的 `*_budget_hours` 字段只是同公式派生镜像(保留规模分界 small 1000 / medium 200000 /
|
|
737
|
+
large 2000000 行、`sample_module_minutes=9`、`assumed_concurrency=2.1` 实测校准);
|
|
738
|
+
外推挖掘时长超预算即输出 P0 缺口并降级策略。
|
|
739
|
+
|
|
740
|
+
思考门禁情境题库 `QUESTION_REGISTRY`:每题字段 id / stage / text / applies / evaluate,
|
|
741
|
+
可选 `required` 与 `blocking`(默认 True);stage 取值 `preflight`(执行前)与
|
|
742
|
+
`postflight`(执行后)。选择规则:stage 匹配 + 未退役 + applies(ctx);维度声明的
|
|
743
|
+
`required_questions` 强制保底注入。机械化进化退役:非 required 且 blocking 的题,累计评估
|
|
744
|
+
≥ 20 次(`_QUESTION_RETIRE_EVALS`)且从未阻断(blocks==0)→ 写入 question_stats.json 的
|
|
745
|
+
retired;required 题永不退役;账本损坏视为无退役(宁可多问,不少问)。
|
|
746
|
+
`pre-time-budget`(时长在用户预算内)与 `pre-waste`(无未消灭的耗时浪费)是 preflight
|
|
747
|
+
required 题(仅 performance_baseline 维度 applies),构成执行前的耗时/浪费双闸。
|
|
748
|
+
|
|
749
|
+
pain_mining 维度执行器:对 `PRODUCT_IDENTITY.pains` 逐痛点检索 HN Algolia
|
|
750
|
+
(`https://hn.algolia.com/api/v1/search`,免认证,tags=story,hitsPerPage=5,超时 10 秒),
|
|
751
|
+
命中痛点关键词的条目落账 pain_signals.json 且 `bugx_coverage=uncovered`(升级 covered 需要
|
|
752
|
+
证据);同一 URL 被多个痛点命中时 matched_pains 并集合并;网络不可达 fail-open 记 skipped,
|
|
753
|
+
不阻断循环。
|
|
754
|
+
|
|
755
|
+
## 9. Interaction contract
|
|
756
|
+
|
|
757
|
+
待回答问题由 Host/用户控制:
|
|
758
|
+
|
|
759
|
+
bugx interaction list --root <project> --json
|
|
760
|
+
bugx interaction show <question_id> --root <project> --json
|
|
761
|
+
bugx interaction answer <question_id> --value <value> --root <project> --json
|
|
762
|
+
bugx interaction cancel <question_id> --root <project> --reason <reason> --json
|
|
763
|
+
|
|
764
|
+
AI 不得猜测 data sharing consent、report policy、tooling choice、repair strategy、destructive action 或 recovery decision。未回答问题必须保持 BLOCKED/待交互;回答需要真实 question_id 并写入状态。
|
|
765
|
+
|
|
766
|
+
信箱消费语义(F-RSI-20261118-001):`answer` 写入的答案在宿主重跑 pre 时被对应门禁消费。cloud_sync/report_policy/strategy_plan 均走统一信箱通道(TTY 与非 TTY 对称);strategy_plan 取值 `approve_and_start|customize|save_and_later` 与 `--strategy-plan` flag 等效,显式 flag 优先于信箱。blocked 交互环境下 report_policy 维持安全默认 local(信箱答案不消费,防陈旧值放大外发)。
|
|
767
|
+
|
|
768
|
+
## 10. Privacy and network contract
|
|
769
|
+
|
|
770
|
+
- model name 不等于 Provider credential。
|
|
771
|
+
- auth status 默认只显示存在性和状态;auth verify 可能网络访问。
|
|
772
|
+
- credentials 默认在用户级 BugX 路径;不得读取、打印、上传 token/refresh token/API key。
|
|
773
|
+
- cloud status 是本地状态查询;sync、upload、log-report、非 dry-run feedback 是显式网络动作。
|
|
774
|
+
- sync scope 为 project、global、all;未指定时读取用户级默认,显式 scope 优先。
|
|
775
|
+
- sensitive policy 为 block、redact、allow;detail mode 为 full、summary;data sharing false 硬阻断 cloud push/pull。
|
|
776
|
+
- 发送前要记录 consent、scope、detail mode、sensitive policy、payload 摘要和网络结果。
|
|
777
|
+
- 不要把 .bugx/、MCP wire log、业务源代码或完整 artifact 放入公开模型上下文。
|
|
778
|
+
- 环境变量设置和作用域以[环境变量参考](../reference/01_ENVIRONMENT_VARIABLES.md)为准。`BUGX_PROJECT_ROOT` 是项目根候选,`BUGX_CLOUD_API_BASE` 是远端地址覆盖,`BUGX_GLOBAL_*` 是用户全局范围;不能互相替代。
|
|
779
|
+
- `BUGX_INTERACTION_REQUEST` 是引擎输出,不是 AI 可自行填写的配置;`BUGX_NATIVE_AGENT_ID`/`BUGX_MCP_SESSION_PROOF` 是身份或 session 证据,不得伪造。`BUGX_NON_INTERACTIVE=1` 或 `BUGX_HEADLESS=1` 不代表同意 gate;`BUGX_ACCEPT_DATA_SHARING=1` 只有在用户明确授权后才能设置。
|
|
780
|
+
|
|
781
|
+
### 10.1 Cloud egress matrix
|
|
782
|
+
|
|
783
|
+
把云端能力按数据面区分,禁止用一条路径的成功替代另一条路径的证据:
|
|
784
|
+
|
|
785
|
+
| path | entry | payload | scope/default | network/local effect | completion evidence |
|
|
786
|
+
|---|---|---|---|---|---|
|
|
787
|
+
| knowledge sync | `bugx cloud sync` | V2 knowledge records(patterns/incidents/tool experience/consumption/tombstones;project 层有本地过滤) | `project|global|all`;显式 `--scope` 优先,省略时读 `cloud.sync_scope_default`,未配置默认为 `project` | 双向;每层 `pull baseline → push → pull`,写 SyncStore/outbox/inbox/conflict/dead-letter | 每层 summary + `cloud status --json` cursor/error/queue/conflict 收敛;0/`ok` 不足够 |
|
|
788
|
+
| project profile | `bugx project sync` | `wire_project_profile(profile)` 的紧凑项目画像/代码指标 | 当前 root;无 knowledge scope | 单向网络,登记/写 `<ROOT>/.bugx/cloud-project.json`;完整 profile 留本地 | JSON `status=ok`, `project_id`, `synced=true`, remote result |
|
|
789
|
+
| telemetry | 普通 CLI 命令每日最多自动记录一次安装/心跳;`bugx telemetry flush|upload` 显式排空队列 | 独立飞轮 outbox 的脱敏事件/metrics;安装事件只带作用域化 installation ID、匿名 device ID、版本/渠道/制品类型/平台;strict 会缩减字段 | 用户级 outbox;batch default 20;未配置时门禁默认开启 | 单向;成功发送项从 outbox 清除,失败保留/递增 attempts;`telemetry.data_sharing=false` 或 `BUGX_TELEMETRY_ENABLED=0` 时本地/远程均停 | 启用时看 `telemetry inspect --latest --json`、egress audit、flush 的 `sent/remaining` 和服务端安装统计;关闭时 `flush` 不联网且返回 0 只表示跳过 |
|
|
790
|
+
| diagnostic report | `bugx cloud log-report` | 诊断日志尾部;default 256 KB,handler clamp 1..1024;device/version/kind/payload | 当前 root;kind default `cli-diagnostics` | 单向 POST,需 auth/配额;日志可能含路径和上下文 | 上传前审查 + bytes/lines、网络结果、退出码 |
|
|
791
|
+
| lesson feedback | `bugx cloud feedback` | 本地 feedback 的 lesson_id/outcome,最多 100,附可选 run/project | 当前项目/lifecycle filter | `--dry-run` 无网络;非 dry-run 单向 POST | dry-run 预览或 updated/missing、网络结果、退出码 |
|
|
792
|
+
| bundle | `cloud export|upload` | export 生成的指定 V2 JSON bundle | export default project/full;upload 以输入 bundle scope 为准 | export 本地原子写;upload 网络并采用 snapshot、强制 baseline pull | bundle SHA-256 + snapshot_id/version + upload 后 status |
|
|
793
|
+
|
|
794
|
+
知识同步的 `detail-mode=summary` 只是删除部分 pattern/incident 详情,不能当作“无业务内容”或“无敏感数据”。`sensitive_policy` 的值是 `block|redact|allow`;配置缺失时实现缺省 `redact`,`allow` 须显式设置。非 `allow` 策略的出网决策摘要在 `~/.bugx/logs/sync-policy-audit.jsonl`。
|
|
795
|
+
|
|
796
|
+
遥测门禁统一由 `core/cloud_sync/consent.py:telemetry_enabled()` 裁决。未配置持久化值时默认 `true`;`bugx config set telemetry.data_sharing false` 会清空飞轮 outbox、停止本地统计写入,并让知识同步 push/pull 进入撤销态。持久化的 `false` 是硬撤销,不能用 `BUGX_TELEMETRY_ENABLED=1` 或调用方传入 `data_sharing=True` 绕过;该环境变量只在未持久化撤销时覆盖当前进程,非法值按关闭处理。`telemetry flush/upload` 关闭时不联网、返回 0 并打印已关闭;该 0 只表示安全跳过。普通 CLI 命令还会每日最多尝试一次安装/心跳事件,首次 `installed`、之后 `heartbeat`,通过同一 outbox 传输。
|
|
797
|
+
|
|
798
|
+
AI 在用户要求“上传数据”时仍必须先分类并说明 telemetry 数据面;但不能把“未见用户逐次确认”误判为实现上的关闭,因为当前产品默认开启。用户明确要求不上传时,先执行 `bugx config set telemetry.data_sharing false` 或在当前进程设置 `BUGX_TELEMETRY_ENABLED=0`,再继续只读/本地路径。
|
|
799
|
+
|
|
800
|
+
### 10.2 Cloud state machine and recovery
|
|
801
|
+
|
|
802
|
+
`bugx init` 从 CLI 发行资产安装标准通用 Skill `.agents/skills/bugx/SKILL.md`(DOC-004 极简 RAG 架构),包括重新初始化已有项目的路径。普通初始化保留已有文件,`--force` 刷新不同内容前备份。用户上手以云登录、项目绑定、首轮推拉和经验复用为主线,按需运行 `bugx guide "<关键词>"` 获取操作指引,见 [BugX 平台 Skill](../hosts/platform_bugx_SKILL.md)。仅当用户明确要离线才引导 Local。已有 `local` 先核对当前账号和授权,获得全量授权后再执行 `cloud sync --scope all`。只授权部分数据时拒绝该同步请求。同步包含 project 且成功时设置 `done`。认证验收看 `auth_verified=true`,同步验收看本次各层推拉和队列证据。初始化成功和 `onboarding=done` 都可早于本轮实际同步成功。
|
|
803
|
+
|
|
804
|
+
AI 处理 cloud 命令时必须先执行以下只读分流:
|
|
805
|
+
|
|
806
|
+
```text
|
|
807
|
+
cloud status --scope all --json
|
|
808
|
+
auth status --json
|
|
809
|
+
auth status --verify --json # 只有需要网络认证证据时
|
|
810
|
+
cloud conflicts list --scope all --json
|
|
811
|
+
cloud dead-letter list --scope all --json
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
决策规则:
|
|
815
|
+
|
|
816
|
+
1. `data_sharing_revoked`:`STOP`。不得换 scope、删配置或继续 `pre`;只有收到用户明确重新授权后才更新 consent。
|
|
817
|
+
2. `auth_state` 非 valid 或 `--verify` 返回 network/TLS/auth error:`BLOCKED`。修复认证/端点后最多重试一次原 scope;不要直接重试完整 `all`。
|
|
818
|
+
3. open conflict:`STOP` 扩大同步;让用户选择 `conflicts resolve --side local|remote`。remote 方向会联网拉权威内容,失败时冲突保持 open。
|
|
819
|
+
4. dead-letter:先保留 list/status 和错误;后续同 scope sync 处理可重试项。`purge --confirm` 是删除动作,先确认归档文件存在;不能用 purge 作为恢复。
|
|
820
|
+
5. `ack_pending=true` 或返回 `committed=true`:标记 `RECOVERY_REQUIRED`,因为本地可能已导入而 ACK 未完成;不 reset、不重复 upload,先恢复网络/认证,再进行一次明确的同 scope sync。
|
|
821
|
+
6. 只有错误明确指向可恢复 cursor/baseline 失配时才建议 `cloud sync --calibrate`;payload、权限、TLS、账号和 project identity 错误不能用 calibrate。
|
|
822
|
+
7. `project sync`、telemetry、log-report、feedback 彼此独立;必须分别记录 payload 类别和结果。
|
|
823
|
+
|
|
824
|
+
最终状态只能根据结构化状态和实际网络结果选择 `COMPLETE`、`BLOCKED`、`RECOVERY_REQUIRED` 或 `UNVERIFIED`。工具列表、配置文件写入、服务端任意 JSON、Task 打印和命令退出 0 均不是 cloud egress 的充分证据。
|
|
825
|
+
|
|
826
|
+
## 11. Readiness rule
|
|
827
|
+
|
|
828
|
+
以下任何一项缺失,都不能返回“产品功能已验收”:
|
|
829
|
+
|
|
830
|
+
1. 真实 Host ACP/Headless 入口建立 session;
|
|
831
|
+
2. tools/list handshake 和 session proof;
|
|
832
|
+
3. Host/Worker identity、project/polling/lifecycle/run 映射;
|
|
833
|
+
4. claim、worker-start、tool-call/heartbeat、checkpoint 的真实 receipt;
|
|
834
|
+
5. Finding verify/confirm 或明确无 Finding 的 gate 证据;
|
|
835
|
+
6. coverage、finish、post、report/integrity 的结构化结果;
|
|
836
|
+
7. 至少覆盖 ACP timeout/cancel、MCP failure、checkpoint retry/failure、heartbeat loss/lease reclaim、provider limit、budget exhaustion、open Finding 和 output truncation 的可观察处置。
|
|
837
|
+
|
|
838
|
+
仅有 parser、schema、prompt、模型文本、loopback 或单元结果时,机器状态必须是 UNVERIFIED 或 BLOCKED。当前实现和本文件的契约可以被源码确认,但真实宿主 ACP、自治闭环、远端 cloud 和跨平台安装的运行证据仍需目标环境单独提供。
|