@logicseek/hello-cc 1.0.0 → 1.0.2-dsh.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +36 -0
  3. package/README.zh-CN.md +35 -0
  4. package/docs/README.md +9 -0
  5. package/docs/README.zh-CN.md +9 -0
  6. package/docs/commands.md +53 -0
  7. package/docs/commands.zh-CN.md +48 -0
  8. package/docs/dsh.md +137 -0
  9. package/docs/dsh.zh-CN.md +139 -0
  10. package/docs/guide.md +58 -0
  11. package/docs/guide.zh-CN.md +55 -0
  12. package/docs/mcp.md +9 -0
  13. package/docs/mcp.zh-CN.md +23 -0
  14. package/docs/native.md +295 -0
  15. package/docs/native.zh-CN.md +253 -0
  16. package/docs/web-handoff.zh-CN.md +53 -0
  17. package/lib/cli/app.mjs +27 -6
  18. package/lib/cli/commands/coordination.mjs +3 -1
  19. package/lib/cli/commands/doctor.mjs +17 -2
  20. package/lib/cli/commands/dsh.mjs +79 -0
  21. package/lib/cli/commands/gc.mjs +182 -32
  22. package/lib/cli/commands/hook.mjs +241 -90
  23. package/lib/cli/commands/lock.mjs +34 -19
  24. package/lib/cli/commands/mcp.mjs +28 -0
  25. package/lib/cli/commands/misc.mjs +15 -0
  26. package/lib/cli/commands/native.mjs +130 -0
  27. package/lib/cli/commands/peer.mjs +21 -5
  28. package/lib/cli/commands/run.mjs +66 -21
  29. package/lib/cli/commands/task.mjs +6 -3
  30. package/lib/cli-args.mjs +4 -0
  31. package/lib/coordination-state.mjs +15 -1
  32. package/lib/core/coordination/event-retention.mjs +14 -2
  33. package/lib/core/coordination/gc-plan.mjs +3 -13
  34. package/lib/core/coordination/locks.mjs +45 -0
  35. package/lib/core/coordination/results.mjs +79 -0
  36. package/lib/core/peers/bindings.mjs +9 -3
  37. package/lib/diagnostics/codex.mjs +121 -0
  38. package/lib/integrations/codex-interactions.mjs +114 -0
  39. package/lib/integrations/dsh-collaboration.mjs +170 -0
  40. package/lib/integrations/dsh-cordis.d.ts +19 -0
  41. package/lib/integrations/dsh-cordis.mjs +177 -0
  42. package/lib/integrations/dsh.bundle.yml +7 -0
  43. package/lib/integrations/dsh.mjs +287 -0
  44. package/lib/integrations/native/claude.mjs +451 -0
  45. package/lib/integrations/native/codex.mjs +242 -0
  46. package/lib/integrations/native/dsh-acp.mjs +343 -0
  47. package/lib/integrations/native/index.mjs +19 -0
  48. package/lib/integrations/native/interactions.mjs +53 -0
  49. package/lib/integrations/native/jsonrpc.mjs +185 -0
  50. package/lib/integrations/peers/identity.mjs +36 -10
  51. package/lib/integrations/peers/processes.mjs +22 -8
  52. package/lib/integrations/providers.mjs +6 -2
  53. package/lib/mcp/scope.mjs +104 -0
  54. package/lib/mcp/stdio.mjs +80 -0
  55. package/lib/mcp/tools.mjs +197 -0
  56. package/lib/process/identity.mjs +33 -1
  57. package/lib/release/release-notes.mjs +9 -0
  58. package/lib/runtime/buffer-directory-lease.mjs +2 -1
  59. package/lib/runtime/client.mjs +3 -0
  60. package/lib/runtime/native/client.mjs +38 -0
  61. package/lib/runtime/native/service.mjs +511 -0
  62. package/lib/runtime/native/store.mjs +121 -0
  63. package/lib/shared/file-lock.mjs +11 -4
  64. package/lib/shared/socket-lock-worker.mjs +73 -24
  65. package/lib/terminal/tmux.mjs +53 -23
  66. package/lib/ui/help.mjs +5 -2
  67. package/lib/web/adoption-state.mjs +55 -0
  68. package/lib/web/auto-attach.mjs +18 -2
  69. package/lib/web/buffer-gc-runtime.mjs +2 -2
  70. package/lib/web/codex-app-server.mjs +557 -0
  71. package/lib/web/codex-sessions.mjs +287 -0
  72. package/lib/web/control-lease.mjs +204 -0
  73. package/lib/web/http-routes.mjs +197 -15
  74. package/lib/web/http.mjs +5 -4
  75. package/lib/web/native-sessions.mjs +286 -0
  76. package/lib/web/project-contexts.mjs +8 -2
  77. package/lib/web/pty-sessions.mjs +60 -33
  78. package/lib/web/runtime-main.mjs +101 -6
  79. package/lib/web/session-serialize.mjs +0 -0
  80. package/lib/web/startup.mjs +4 -2
  81. package/lib/web/task-results.mjs +76 -0
  82. package/lib/web/tmux-sessions.mjs +92 -11
  83. package/lib/web/tmux-stream.mjs +2 -2
  84. package/lib/web/ui-codex.mjs +550 -0
  85. package/lib/web/ui-command-palette.mjs +119 -0
  86. package/lib/web/ui-handoff.mjs +102 -0
  87. package/lib/web/ui-history.mjs +118 -0
  88. package/lib/web/ui-i18n.mjs +841 -0
  89. package/lib/web/ui-interactions.mjs +78 -0
  90. package/lib/web/ui-login.mjs +101 -0
  91. package/lib/web/ui-native.mjs +165 -0
  92. package/lib/web/ui-preferences.mjs +278 -0
  93. package/lib/web/ui-review.mjs +132 -0
  94. package/lib/web/ui-template.mjs +1106 -576
  95. package/lib/web/ui-terminal-find.mjs +98 -0
  96. package/lib/web/ui-workbench.mjs +94 -0
  97. package/lib/web/ui-workspace.mjs +222 -0
  98. package/package.json +12 -4
  99. package/scripts/check-free-identifiers.mjs +67 -8
  100. package/scripts/codex-diagnostics-installed-acceptance.mjs +72 -0
  101. package/scripts/dsh-cordis-acceptance.mjs +200 -0
  102. package/scripts/dsh-installed-acceptance.mjs +247 -0
  103. package/scripts/dsh-official-acceptance.mjs +180 -0
  104. package/scripts/dsh-web-startup-acceptance.mjs +87 -0
  105. package/scripts/github-release.mjs +3 -1
  106. package/scripts/native-live-acceptance.mjs +369 -0
  107. package/scripts/regression.mjs +338 -187
  108. package/scripts/web-handoff-installed-acceptance.mjs +98 -0
  109. package/scripts/web-native-interaction-acceptance.mjs +204 -0
  110. package/scripts/web-native-model-acceptance.mjs +138 -0
  111. package/docs/architecture-split-review.md +0 -217
  112. package/docs/current-state-review-2026-08.md +0 -341
  113. package/docs/defect-review-2026-07.md +0 -382
  114. package/docs/layout-split-stack-audit.md +0 -298
  115. package/docs/superpowers/plans/2026-08-03-runtime-safety-plan.md +0 -294
  116. package/docs/superpowers/plans/2026-08-03-v1-data-identity-plan.md +0 -400
  117. package/docs/superpowers/plans/2026-08-03-v1-release-verification-plan.md +0 -284
  118. package/docs/superpowers/plans/2026-08-03-web-api-hardening-plan.md +0 -303
  119. package/docs/superpowers/plans/2026-08-04-runtime-buffer-gc-two-phase.md +0 -71
  120. package/docs/superpowers/specs/2026-08-03-runtime-safety-design.md +0 -117
  121. package/docs/superpowers/specs/2026-08-03-v1-data-identity-design.md +0 -120
  122. package/docs/superpowers/specs/2026-08-03-v1-release-verification-design.md +0 -117
  123. package/docs/superpowers/specs/2026-08-03-web-api-hardening-design.md +0 -104
@@ -0,0 +1,139 @@
1
+ # DeepSeek Harness 接入
2
+
3
+ [English](dsh.md) | 中文
4
+
5
+ DeepSeek Harness(`dsh`)可以与 Claude Code、Codex 共用 hello-cc 的项目任务、消息、协作锁和交接。现在有三个入口:官方 hooks 兼容桥、原生 Cordis 协作插件,以及 hello-cc 持有的 ACP 后台 worker。
6
+
7
+ 运行时基线固定为 `@deepseek-ai/dsh@0.2.0-rc.2`,相关插件使用相同版本。需要 Node.js 24+,并确认 `PATH` 中的 `node` 也符合要求,因为 dsh 通过 `/usr/bin/env node` 启动。此版本提供 Web/headless/SDK/ACP profile,没有内置 TUI。
8
+
9
+ 支持 Linux 和 macOS;Windows 使用 WSL,不支持原生 Windows shell。容器验证与实际设备验收分别记录。
10
+
11
+ 代码已在本地实现并做真实 DeepSeek 模型验收,尚未发布新的 npm 版本。验证源码时,用本仓库的 CLI:
12
+
13
+ ```bash
14
+ node /absolute/path/to/hello-cc/bin/hcc.mjs --root /path/to/project dsh setup --mode cordis
15
+ node /absolute/path/to/hello-cc/bin/hcc.mjs --root /path/to/project dsh status
16
+ node /absolute/path/to/hello-cc/bin/hcc.mjs --root /path/to/project dsh web -- --port 8080
17
+ ```
18
+
19
+ 下文 `hcc` 指包含这些代码的 CLI。已有的全局 `hcc` 未必包含此接入。
20
+
21
+ ## 选择入口
22
+
23
+ | 入口 | 适用场景 | 会话由谁持有 |
24
+ | --- | --- | --- |
25
+ | `hcc dsh web --mode cordis` | 在 Harness Web 中对话,模型直接使用 `hcc_*` 协作工具 | Harness;一个服务可承载多个 Agent/工作区 |
26
+ | `hcc dsh web --mode hooks` | 保留官方 Claude hooks 兼容路线,模型用带身份的 hcc CLI 命令协作 | Harness;默认模式 |
27
+ | `hcc native start --provider dsh` | 从 hello-cc CLI/Web 管理提示、回执、中断和关闭 | hello-cc 专属 ACP worker;每个 worker 一个独立进程 |
28
+
29
+ Cordis 模式与 hooks 模式共用同一任务总线,但对同一个会话只允许一个注入器。ACP worker 使用自己的 native 生命周期与 scoped MCP 能力,不给它额外加载 Cordis/hooks 协作注入器。
30
+
31
+ ## Harness Web 与 Cordis 插件
32
+
33
+ 先配置 Harness 模型凭据。默认 DeepSeek provider 使用已有 `DEEPSEEK_API_KEY`,启动器保留凭据和 provider 路由环境变量。可以使用已有安装,或自行安装固定版本:
34
+
35
+ ```bash
36
+ npm install -g @deepseek-ai/dsh@0.2.0-rc.2
37
+ cd /path/to/project
38
+ hcc dsh setup --mode cordis
39
+ hcc dsh status
40
+ hcc dsh web -- --port 8080
41
+ ```
42
+
43
+ 打开 Harness 输出的 URL,创建真实会话,并将项目设为会话工作区。仅启动服务不会创建 Agent peer。需要 hello-cc 控制台时另开 `hcc web --local`;dsh 筛选显示原始会话 ID,可以查看状态和发送项目消息。
44
+
45
+ Cordis 插件使用 `agent/created` 的等待式初始化、`agent/pre-step` 的决定链、`agent/status`/`agent/disposed` 和工具事件。每次执行从 `exec.agent` 获取固定项目与 peer,不读取服务级 `HCC_PEER`。插件提供:
46
+
47
+ | 工具 | 用途 |
48
+ | --- | --- |
49
+ | `hcc_state` / `hcc_task_list` / `hcc_inbox` | 读取项目状态、任务和本会话收件箱 |
50
+ | `hcc_task_next` | 继续当前任务或认领待办,不自动完成任务 |
51
+ | `hcc_message_send` | 以本 Agent 身份发送项目协作消息 |
52
+ | `hcc_handoff` | 记录所持任务的交接内容 |
53
+ | `hcc_lock_acquire` / `hcc_lock_release` | 获取/释放本 peer 的作用域协作锁 |
54
+ | `hcc_result_list` / `hcc_result_record` | 读取/记录本地验证证据,不代表发布或业务验收 |
55
+
56
+ 底层复用 CLI/MCP 的事务、任务归属和锁规则。上下文与工具输出默认各限制 16,000 字符;过长输出明确标记截断,未完整投递的消息保留未读。工具参数的长度、数量和归属由服务再次验证。消息只在 Harness 提交对应 `user/message` 记录后 ACK;拒绝首轮、准备失败和取消不会提前 ACK。
57
+
58
+ 插件委托 `next()`,保留现有 deny/ask 权限决定。关闭 Agent 只更新其自身 peer;卸载时移除监听与工具注册,并使旧的执行权限失效。重新加载时,既有 Agent 在下一个等待式 pre-step 重新取得身份。异常退出后,只有核实原进程已退出或 PID 已被复用时,同一会话才能恢复 Cordis 归属;活跃或无法验证的 owner,以及 hooks/native 冲突绑定仍会被拒绝。发送项目消息本身不会唤醒持续空闲的 Harness 会话;它在下一步骤进入上下文,或在活动轮次的停止边界继续处理。
59
+
60
+ ## 配置模式与参数
61
+
62
+ ```text
63
+ hcc dsh setup [--mode hooks|cordis|off]
64
+ hcc dsh status [--dsh-bin PATH]
65
+ hcc dsh web [--mode hooks|cordis|off] [--dsh-bin PATH] [--dsh-home PATH] -- [dsh arguments]
66
+ ```
67
+
68
+ 首次默认 `hooks`,以后不带 `--mode` 时沿用托管配置记录的选择。`status` 校验内容与可执行文件,不发模型请求。
69
+
70
+ ```bash
71
+ hcc dsh setup --mode hooks # 官方兼容桥
72
+ hcc dsh setup --mode cordis # 原生协作插件
73
+ hcc dsh setup --mode off # 项目 overlay 不再加入协作插件
74
+ hcc dsh web --dsh-bin '/opt/harness/bin/dsh' --dsh-home '/path/to/dsh-home' -- --port 8080 --no-open
75
+ hcc dsh web --help # hello-cc 帮助
76
+ hcc dsh web -- --help # Harness Web 帮助
77
+ ```
78
+
79
+ `--dsh-bin` 是文件路径,`--dsh-home` 设置子进程 `DSH_HOME`;相对路径按执行目录解析。所有 Harness 参数放在 `--` 后,按原顺序传递,包括额外 `--patch`。模式变更影响后续启动,关闭当前自有 runtime 后重新启动才会生效。已有 hooks/native 会话不会被强行改绑为 Cordis;切换时使用新会话,保留旧会话的协作数据。
80
+
81
+ 托管文件如下:
82
+
83
+ | 文件 | 用途 |
84
+ | --- | --- |
85
+ | `.hello-cc/dsh/hooks.json` | hello-cc 专用 SessionStart/UserPromptSubmit/PreToolUse/PostToolUse/Stop hooks |
86
+ | `.hello-cc/dsh/cordis.patch.yml` | 只加载选定注入器;off 为无插件 overlay |
87
+ | `.hello-cc/dsh/managed.json` | 模式、归属、路径、基线版本与 SHA256 |
88
+
89
+ Setup/disable/re-enable 幂等。升级或移动源码后可再次 setup 刷新绝对路径;手工修改、外来内容、符号链接、硬链接或归属冲突会保留原文件并返回错误。定制配置放在独立 overlay。Setup 不安装 dsh,不改用户 home,不复制密钥,不导入整份 Claude/Codex hooks。
90
+
91
+ 每个 Agent 的真实 `session_id` 和绝对 `cwd` 路由到该工作区自己的 `.hello-cc/mesh.db`,不向父目录找项目。原始非 UUID ID 会保留,hash 碰撞、重复会话别名或其他 live transport 归属都会被拒绝。hooks 与 Cordis peer 禁止被 detected stop/restart 或 tmux attach 改成终端;服务日志面板仍可作为独立 shell peer。
92
+
93
+ hooks 基线 rc.2 会等待 SessionStart 返回后注入首轮,PreToolUse 用于活动跟踪,PostToolUse/Stop 用于消息投递;官方桥不消费 PreToolUse 的 `additionalContext`。这条兼容路线的 ACK 发生在 hook 输出成功后;Cordis 的 ACK 发生在对应上下文记录提交后。
94
+
95
+ ## ACP 后台 worker
96
+
97
+ ```bash
98
+ hcc native up
99
+ hcc native start --peer dsh-reviewer --provider dsh
100
+ hcc native send --peer dsh-reviewer --from coordinator --body '审查当前改动,报告验证结果'
101
+ hcc native deliveries --peer dsh-reviewer
102
+ hcc native events --peer dsh-reviewer
103
+ hcc native interrupt --peer dsh-reviewer
104
+ hcc native close --peer dsh-reviewer
105
+ hcc native start --peer dsh-reviewer --provider dsh --binary /absolute/path/to/dsh --resume last
106
+ ```
107
+
108
+ 默认从 PATH 查找官方 `dsh`;不在 PATH 时用 `--binary /absolute/path/to/dsh` 指定 launcher。worker 使用独立 `dsh --profile acp` 进程;send 返回入队回执,只有权威 prompt 完成事件才代表投递完成。恢复保留 provider session 身份和已有会话记忆;ACP 不回放整个 transcript,也不提供 fork/steer。Web 中使用 native 专属会话入口及审批响应,不能用 detected 注册状态操作代替 worker 生命周期。详见 [Native worker](native.zh-CN.md)。
109
+
110
+ ## 可安装 bundle 与验收
111
+
112
+ 包声明 `dsh.bundle`,overlay 位于 `lib/integrations/dsh.bundle.yml`,类型声明位于 `lib/integrations/dsh-cordis.d.ts`。元数据声明 `engines.dsh=0.2.0-rc.2`;插件还实际检查 agent/agent-loop/tools/session 包版本,遇到不匹配会在注册前拒绝启动。
113
+
114
+ 本地项目 overlay 已可用。setup 的 managed manifest 记录 Cordis 模块位置;从源码切换到 npm 安装目录时会校验并迁移未编辑的配置,保留用户编辑过的文件。需要 profile 级安装时,先生成包含最新源码的 tarball,再通过官方包管理入口安装:
115
+
116
+ ```bash
117
+ npm pack --ignore-scripts
118
+ dsh plugin --profile web add /absolute/path/to/logicseek-hello-cc-1.0.1.tgz
119
+ ```
120
+
121
+ Harness 的 pnpm 策略要求明确允许原生依赖构建。若首次 add 返回 `ERR_PNPM_IGNORED_BUILDS`,在所选 profile 的 `pnpm-workspace.yaml` 中合并以下配置,然后重跑同一 add 命令;默认位置是 `~/.dsh/profiles/web/pnpm-workspace.yaml`,自定义 DSH_HOME 时以该目录为准。保留文件中已有设置,只批准候选包使用的固定版本:
122
+
123
+ ```yaml
124
+ allowBuilds:
125
+ node-pty@1.2.0-beta.15: true
126
+ ```
127
+
128
+ 安装后由 Harness profile 的 `dsh.profile.bundles` 选择包;不要再同时加载项目 Cordis/hooks overlay。bundle 已通过实际 npm 安装、官方 add/重复 add/remove、隔离 profile 加载和真实模型工具调用。2026-10-02 已安装到本机真实 desktop profile 并热加载,配套 ACP 使用既有 DeepSeek 路由完成真实工具调用;初次桌面 sub2api 模型返回账户仅允许 Codex 官方客户端的 403;随后桌面默认模型已变为官方 DeepSeek,沿用当时配置的新建会话完成 hcc_state、hcc_message_send 和真实 completed 回合。原 sub2api 路由限制仍存在。npm 尚未发布。profile 插件安装/移除由 Harness 管理,项目 overlay 则使用 `setup --mode off` 关闭。
129
+
130
+ 验证记录见 Cordis/native 验收 (源码目录: `docs/verification/2026-10-02-dsh-cordis-native.md`)、兼容桥记录 (源码目录: `docs/verification/2026-10-02-dsh-official-bridge.md`) 和详细接入计划 (源码目录: `docs/plans/2026-10-02-dsh-integration.md`)。真实模型验收在临时项目和自有进程中完成;既有会话与模型凭据保留;本机实际安装记录见 Mac 接入验收 (源码目录: `docs/verification/2026-10-02-dsh-device-install.md`)。尚未发布/部署,也没有跨设备验收或真实业务签收;隔离订单样例已完成报告、证据、交接、解锁与任务结束验证。
131
+
132
+ 可用下面的安装验收脚本重现 npm 安装、官方 `plugin add` / 重复 add / remove,以及安装后的公共 CLI。`--run-live` 会沿用已有 DeepSeek 认证,验证 ACP 权限拒绝和一个隔离订单汇总任务;没有该参数时不调用真实模型。脚本只使用本次创建的 HOME、DSH_HOME、项目和进程。
133
+
134
+ ```bash
135
+ node scripts/dsh-installed-acceptance.mjs /absolute/path/to/isolated-dsh-install \
136
+ --run-live --output-dir /absolute/path/to/acceptance-output
137
+ ```
138
+
139
+ 输出包含候选 tarball、SHA256 与安装回执、脱敏命令日志和正确的订单报告。权限探针在私有 profile 中为一个测试文件设置 ask 策略,实际收到 ACP 请求后拒绝并检查文件未生成;订单样例证明本地协作闭环,不替代真实业务签收。
package/docs/guide.md CHANGED
@@ -40,12 +40,70 @@ the supported downgrade contract.
40
40
 
41
41
  ## Install, Update, And Uninstall
42
42
 
43
+ ### Prerequisites
44
+
45
+ Install Node.js 24 or newer from the official Node.js packages or a Node
46
+ version manager. Browser-controllable terminals also require `tmux`:
47
+
48
+ ```bash
49
+ # Debian / Ubuntu
50
+ sudo apt-get update
51
+ sudo apt-get install -y tmux
52
+ # Fedora / RHEL
53
+ sudo dnf install -y tmux
54
+ # Older RHEL / CentOS
55
+ sudo yum install -y tmux
56
+ # Alpine
57
+ sudo apk add tmux
58
+ # Arch Linux
59
+ sudo pacman -S --needed tmux
60
+ # openSUSE
61
+ sudo zypper install tmux
62
+ # macOS only
63
+ brew install tmux
64
+ ```
65
+
66
+ On Linux, use the distribution package manager, not Homebrew. A root shell can
67
+ omit `sudo`. WSL follows the matching Linux distribution instructions inside
68
+ WSL; native Windows shells are not supported.
69
+
70
+ `hcc web` can attempt to install tmux when a supported package manager and
71
+ sufficient privileges are available. Manual installation is the deterministic
72
+ choice for servers, containers, and non-interactive sudo configurations.
73
+
74
+ ### Install And Verify
75
+
43
76
  Install hello-cc globally:
44
77
 
45
78
  ```bash
46
79
  npm install -g @logicseek/hello-cc
47
80
  ```
48
81
 
82
+ If npm reports `EACCES`, use a Node version manager or configure a user-owned
83
+ npm prefix. Do not use `sudo npm install -g`, because it can create root-owned
84
+ package and configuration files.
85
+
86
+ Verify every prerequisite and the installed CLI:
87
+
88
+ ```bash
89
+ node --version
90
+ npm --version
91
+ tmux -V
92
+ hcc --version
93
+ hcc --help
94
+ ```
95
+
96
+ The Node version must start with `v24` or a newer major. Every command above
97
+ must exit successfully before starting a managed terminal.
98
+
99
+ To avoid a global install, use:
100
+
101
+ ```bash
102
+ npx @logicseek/hello-cc web
103
+ ```
104
+
105
+ ### Update And Uninstall
106
+
49
107
  Update an existing global install:
50
108
 
51
109
  ```bash
@@ -36,12 +36,67 @@ v1 会把恢复的数据库重新迁移到 schema v7;用旧版本 hello-cc 打
36
36
 
37
37
  ## 安装、更新和卸载
38
38
 
39
+ ### 前置依赖
40
+
41
+ 通过 Node.js 官方软件包或 Node 版本管理器安装 Node.js 24 或更新版本。浏览器可
42
+ 控制的终端还需要 `tmux`:
43
+
44
+ ```bash
45
+ # Debian / Ubuntu
46
+ sudo apt-get update
47
+ sudo apt-get install -y tmux
48
+ # Fedora / RHEL
49
+ sudo dnf install -y tmux
50
+ # 旧版 RHEL / CentOS
51
+ sudo yum install -y tmux
52
+ # Alpine
53
+ sudo apk add tmux
54
+ # Arch Linux
55
+ sudo pacman -S --needed tmux
56
+ # openSUSE
57
+ sudo zypper install tmux
58
+ # 仅 macOS
59
+ brew install tmux
60
+ ```
61
+
62
+ Linux 必须使用当前发行版的系统包管理器,而不是 Homebrew。root shell 可以省略
63
+ `sudo`。WSL 用户应在 WSL 内部按对应 Linux 发行版安装;不支持原生 Windows
64
+ shell。
65
+
66
+ 当存在受支持的包管理器且权限足够时,`hcc web` 可以尝试自动安装 tmux。对于
67
+ 服务器、容器和非交互式 sudo 环境,手动安装是确定性更高的方式。
68
+
69
+ ### 安装和验证
70
+
39
71
  全局安装 hello-cc:
40
72
 
41
73
  ```bash
42
74
  npm install -g @logicseek/hello-cc
43
75
  ```
44
76
 
77
+ 如果 npm 报 `EACCES`,请使用 Node 版本管理器或配置用户自有的 npm prefix。
78
+ 不要使用 `sudo npm install -g`,否则可能产生 root 所有的包和配置文件。
79
+
80
+ 验证全部前置依赖和 CLI:
81
+
82
+ ```bash
83
+ node --version
84
+ npm --version
85
+ tmux -V
86
+ hcc --version
87
+ hcc --help
88
+ ```
89
+
90
+ Node 版本应为 `v24` 开头或更高主版本;启动托管终端前,上述命令都应成功退出。
91
+
92
+ 不全局安装时可以使用:
93
+
94
+ ```bash
95
+ npx @logicseek/hello-cc web
96
+ ```
97
+
98
+ ### 更新和卸载
99
+
45
100
  更新已有的全局安装:
46
101
 
47
102
  ```bash
package/docs/mcp.md ADDED
@@ -0,0 +1,9 @@
1
+ # Executor-scoped MCP coordination
2
+
3
+ Web-owned Codex App Server executors and HCC-hosted Codex/Claude/dsh native workers receive a dedicated stdio MCP server. Its temporary capability binds the project root, database, peer, worker owner and live runtime process identity. Configuration is passed through the provider session API; it does not modify global provider configuration, authentication or trust settings.
4
+
5
+ Tools expose coordination state, tasks, inbox, message sending, handoff, owned resource locks and local result records. They reuse the existing business commands. Model arguments cannot change the project/database/peer, force another peer's lock, or record publication/business acceptance. Task claiming, handoff and evidence recording never mark a task done automatically.
6
+
7
+ The internal entry point is `hcc --root PROJECT --db DATABASE mcp serve --peer PEER`. A private executor-issued capability is required; `--peer` alone grants no authority. Every call verifies the live executor and its database binding, and writes check ownership again in their business transaction. Closing the executor revokes and removes its capability. Unix permissions are 0700 for the temporary directory and 0600 for the capability file.
8
+
9
+ Native workers acquire the scoped capability before startup and revoke it before shutdown or failed-start cleanup. Codex uses thread config, Claude uses SDK mcpServers and dsh uses ACP session mcpServers. Arbitrary external CLI/TUI processes do not receive this capability automatically. See [the Chinese tool reference](mcp.zh-CN.md) for individual tools, [native workers](native.md) for provider approval behavior, and [Web handoff](web-handoff.zh-CN.md) for result review and lifecycle boundaries.
@@ -0,0 +1,23 @@
1
+ # 受执行器约束的 MCP 协作工具
2
+
3
+ Web 专用 Codex App Server,以及由 HCC 托管的 Codex/Claude/dsh native worker,都会获得专用 stdio MCP 配置。它固定项目 root、数据库、peer、worker owner 和活动 runtime 进程身份。配置通过 provider 会话 API 传入,不写用户的全局配置、账号或信任设置。
4
+
5
+ | 工具 | 作用 |
6
+ | --- | --- |
7
+ | `hcc_state` | 查询当前项目/peer 的协作状态 |
8
+ | `hcc_task_list` / `hcc_task_next` | 查询任务,返回已有任务或领取一个待办 |
9
+ | `hcc_inbox` | 读取当前 peer inbox,不自动确认消息已处理 |
10
+ | `hcc_message_send` | 以当前执行器 peer 身份写入项目消息总线 |
11
+ | `hcc_handoff` | 记录已归属任务的工作、测试和风险 |
12
+ | `hcc_lock_acquire` / `hcc_lock_release` | 获取或释放当前 peer 的资源锁 |
13
+ | `hcc_result_list` / `hcc_result_record` | 读取结果记录,写入已归属任务的本地证据 |
14
+
15
+ 模型不能通过工具参数更换项目、数据库、peer,不能强制夺取别人的锁。每次调用检查原执行器仍存活且数据库 binding 仍由它持有;写入还在业务事务内复核身份与任务归属。执行器关闭、peer 被替换或能力凭据被撤销后,旧 MCP 进程不能继续写入。
16
+
17
+ 内部入口为 `hcc --root PROJECT --db DATABASE mcp serve --peer PEER`。它需要执行器创建的临时私有 capability 文件及 token,单独填写 `--peer` 不授予身份。文件权限在 Unix 为目录 0700、文件 0600,执行器退出后删除。手工启动不会注册或覆盖已有 peer。
18
+
19
+ MCP 复用现有任务、消息、锁与 handoff 命令的业务规则。工具返回成功只说明对应协作操作完成;不会自动把任务改为 done。`hcc_result_record` 只报告本地证据,模型填写的记录会注明来源,不代替 Web 中人工记录的发布部署或业务验收。
20
+
21
+ native worker 在启动前建立受限 capability,关闭 worker 或启动失败清理前撤销。Codex 通过 thread config、Claude 通过 SDK mcpServers、dsh 通过 ACP session mcpServers 接入。任意外部 CLI/TUI 不会自动获得此权限。发信等写操作仍可能需要 provider 人工审批,处理方式见 [Native 指南](native.zh-CN.md)。
22
+
23
+ 三种模型使用 MCP 发送协作消息的真实回执见 跨 provider 通信验收 (源码目录: `docs/verification/2026-10-02-native-live-communication.json`)。模型发信、接收方回复、ACK 和无回复循环均有单独检查;这不代替发布安装或业务任务验收。
package/docs/native.md ADDED
@@ -0,0 +1,295 @@
1
+ # Native workers
2
+
3
+ Native mode runs background workers that HCC creates and owns. HCC keeps the
4
+ shared peer, task, message, lock, and handoff model; each provider adapter owns
5
+ its execution connection and reports structured lifecycle events.
6
+
7
+ | Provider | Connection | Session identity | Busy-worker input |
8
+ | --- | --- | --- | --- |
9
+ | Codex | Owned `codex app-server` over stdio JSON-RPC | Codex thread ID | Adapter supports `turn/steer` with the active turn precondition |
10
+ | Claude | Optional Claude Agent SDK, persistent streaming input | Claude session ID confirmed by SDK initialization | One submission at a time; steering is unsupported |
11
+ | DeepSeek Harness | Owned `dsh --profile acp` process | ACP session ID | One submission at a time; steering is unsupported |
12
+
13
+ The HCC host currently dispatches one inbox message at a time to each worker,
14
+ including for Codex. Adapter support for steering does not mean the host sends
15
+ multiple pending inbox messages into the same turn. ACP resume and session close
16
+ depend on the extensions the provider advertises. HCC does not claim that an ACP
17
+ resume replays the original conversation transcript.
18
+
19
+ ## Requirements
20
+
21
+ Use Node.js 24 or later and a provider installed and authenticated in the same
22
+ environment as HCC. Native mode preserves authentication configuration and does
23
+ not rewrite accounts, provider settings, or the user's home directory.
24
+
25
+ Codex needs an app-server-compatible CLI. DeepSeek Harness uses its ACP profile;
26
+ the implementation targets `@deepseek-ai/dsh-acp@0.2.0-rc.2`. This mode does not
27
+ connect to a running dsh Web service.
28
+
29
+ Claude's SDK remains optional and is loaded only when a Claude worker opens.
30
+ For a checkout of this repository, install the documented SDK version explicitly:
31
+
32
+ ```sh
33
+ npm install --no-save --package-lock=false @anthropic-ai/claude-agent-sdk@0.3.287
34
+ ```
35
+
36
+ For a global HCC installation, install that version into the same npm prefix:
37
+
38
+ ```sh
39
+ npm install -g @anthropic-ai/claude-agent-sdk@0.3.287
40
+ ```
41
+
42
+ Alternatively, install the optional SDK in the worker's project:
43
+
44
+ ```sh
45
+ cd /absolute/path/to/worker-project
46
+ npm install --no-save --package-lock=false @anthropic-ai/claude-agent-sdk@0.3.287
47
+ ```
48
+
49
+ The default loader first checks HCC's installation, then the worker project's
50
+ node_modules, so a global HCC can use a project-local SDK. HCC never installs
51
+ packages automatically. Missing SDKs produce installation guidance; errors from
52
+ a found SDK's exports or dependencies retain their original cause. A separate
53
+ real Web approval receipt (source checkout: `docs/verification/2026-10-02-native-web-claude-default-sdk.json`)
54
+ exercises this default project lookup without injecting a query function. It
55
+ does not verify a published package or an employee installation.
56
+
57
+ ## CLI
58
+
59
+ Run commands from the project you want the workers to share, or select it with
60
+ the existing global `--root` and `--db` options.
61
+
62
+ ```sh
63
+ hcc native up
64
+ hcc native start --peer codex-reviewer --provider codex
65
+ hcc native start --peer claude-reviewer --provider claude
66
+ hcc native start --peer dsh-reviewer --provider dsh
67
+ hcc native send --peer codex-reviewer --from coordinator --body "Review the current changes and report concrete findings."
68
+ hcc native status
69
+ hcc native deliveries --peer codex-reviewer
70
+ hcc native events --peer codex-reviewer --after 0
71
+ hcc native requests --peer codex-reviewer
72
+ hcc native respond --peer codex-reviewer --request REQUEST_ID --decision accept
73
+ hcc msg inbox --peer coordinator
74
+ ```
75
+
76
+ `start` starts the project's native runtime when needed. Workers share its HCC
77
+ message bus even when `--cwd DIR` selects another working directory. `--model
78
+ MODEL` selects a provider-supported model. `--binary PATH` overrides the Codex
79
+ or dsh executable. Claude uses the SDK and rejects `--binary`.
80
+
81
+ | Command | Options / behavior |
82
+ | --- | --- |
83
+ | `hcc native up` | Start or reuse the project's background runtime |
84
+ | `hcc native status` | Inspect persisted worker state and runtime identity |
85
+ | `hcc native start` | Required `--peer NAME --provider codex\|claude\|dsh`; optional `--cwd DIR --model MODEL --resume last`; `--binary PATH` is available only for Codex and dsh |
86
+ | `hcc native send` | Required `--peer NAME --body TEXT`; optional `--from NAME --task ID`; returns a durable message/submission receipt |
87
+ | `hcc native deliveries` | Optional `--peer NAME`; inspect delivery receipts |
88
+ | `hcc native events` | Required `--peer NAME`; optional `--after ID`; inspect a bounded event history |
89
+ | `hcc native requests` | Requires `--peer NAME`; inspect pending requests bound to this executor, session and turn |
90
+ | `hcc native respond` | Requires `--peer NAME --request ID --decision accept\|decline\|cancel`; use `--response-file JSON` for permission subsets or answers |
91
+ | `hcc native interrupt` | Required `--peer NAME`; optional `--turn ID`; request interruption of the active turn |
92
+ | `hcc native close` | Required `--peer NAME`; close that worker's owned connection/process |
93
+ | `hcc native down` | Request worker closure and runtime shutdown; returns a stop-request receipt |
94
+
95
+ The `native down` receipt confirms the stop request, not completed shutdown.
96
+ Inspect `native status` to check the outcome. If provider shutdown fails, HCC
97
+ retains runtime ownership and reports the error in `status.shutdown_error`;
98
+ resolve the reported problem and retry `native down`.
99
+
100
+ Worker events retain semantic output and completion evidence; token deltas are
101
+ not persisted as delivery receipts. The runtime keeps local state under
102
+ `<project>/.hello-cc/native/` and coordination records in the selected HCC
103
+ database. Runtime control is a local authenticated API, separate from the
104
+ browser terminal transport. Treat its local runtime pointer and log as private
105
+ project state.
106
+
107
+ ## Reading delivery receipts
108
+
109
+ A successful `native send` queues a message. It does not mean the provider has
110
+ read it, completed it, or returned a business result.
111
+
112
+ | State | Meaning |
113
+ | --- | --- |
114
+ | `queued` | Stored on HCC's message bus, waiting for dispatch |
115
+ | `dispatching` | HCC started handing the submission to its adapter; provider admission is still pending |
116
+ | `submitted` | The adapter queued/wrote the prompt, without a provider admission receipt |
117
+ | `accepted` | Provider-confirmed admission or matching provider output establishes that this submission/turn is being processed; work is still pending |
118
+ | `completed` | An authoritative matching main-turn result reports success; HCC acknowledges the message and can write an automatic reply for a non-reply message |
119
+ | `failed` | A definitive rejection or unsuccessful main-turn result; not a successful acknowledgement |
120
+ | `uncertain` | A timeout, lost process/connection, or runtime restart left the outcome unknown; automatic retry could duplicate work |
121
+
122
+ An SDK consuming an input iterator proves transport submission, not provider
123
+ acceptance or a completed model turn. Claude advances from `submitted` to
124
+ `accepted` after matching assistant output is observed. Claude reports its
125
+ actual session ID on initialization, so a freshly
126
+ opened worker can legitimately have a null session ID until its first prompt.
127
+ An interrupt request does not cancel an SDK input that is still queued and does
128
+ not itself complete a delivery. Only a matching main-turn result settles it.
129
+
130
+ An inbox message with `kind: 'reply'` is still delivered as context and
131
+ acknowledged after its main turn succeeds. Its output remains in `events`, but
132
+ HCC does not automatically generate another reply, preventing reply loops.
133
+ For other message kinds, a successful main turn with output writes an automatic
134
+ reply to the sender.
135
+
136
+ For an uncertain delivery, inspect `deliveries`, `events`, and provider state
137
+ before sending a replacement. HCC leaves uncertain deliveries out of automatic
138
+ retries. Runtime restart records in-flight work as uncertain rather than
139
+ pretending it failed or completed.
140
+
141
+ ## Ownership, hooks, and permissions
142
+
143
+ Resume an HCC-owned saved session with the same peer and provider:
144
+
145
+ ```sh
146
+ hcc native close --peer codex-reviewer
147
+ hcc native start --peer codex-reviewer --provider codex --resume last
148
+ ```
149
+
150
+ An explicit saved ID is accepted only when it matches HCC's record for that peer
151
+ and provider. Resume restores a conversation through a newly owned connection;
152
+ it does not attach to an existing live TUI or desktop instance. HCC cannot prove
153
+ that an external application has independently opened the same saved session,
154
+ so do not open the same conversation concurrently outside the owned runtime.
155
+
156
+ Native workers receive a worker-specific `HCC_ROOT`, `HCC_DB`, `HCC_PEER`, and
157
+ `HCC_NATIVE_OWNER`. A provider hook must match the peer's native transport owner.
158
+ Its native hook path only heartbeats that owner and renews its locks. It does
159
+ not change provider bindings or process identity, inject another copy of the
160
+ inbox, acknowledge messages, or block a Stop hook. Mismatched owner markers fail
161
+ without falling back to normal terminal-hook delivery.
162
+
163
+ Providers keep their permission checks. HCC-hosted workers wait for an explicit
164
+ response from the current Web controller or the local CLI when an operation
165
+ requires approval. Closing Web leaves both the worker and its pending requests
166
+ available to the local CLI. Requests expire when their turn ends, interruption
167
+ is accepted, the provider resolves them, or the worker closes. A late request
168
+ from an interrupted turn cannot reopen approval. Direct adapters without a
169
+ hosted responder retain conservative denial.
170
+
171
+ | Provider | Hosted interaction |
172
+ | --- | --- |
173
+ | Codex | Command/file approval, requested filesystem/network permission subsets with explicit turn/session duration, questions including freeform/secret input, and one-call empty-form MCP tool approvals |
174
+ | Claude | SDK tool permission callback; approval grants the original tool input once without rewriting it |
175
+ | dsh ACP | Offered permission choices; approval selects only `allow_once`, never `allow_always` |
176
+
177
+ rc.2 may send only a tool-call ID in an ACP approval request. The adapter correlates same-session/turn tool updates to show the operation input. Missing or truncated input still allows rejection; acceptance returns `NATIVE_APPROVAL_CONTEXT_MISSING`. See dsh installed acceptance (source checkout: `docs/verification/2026-10-02-dsh-cordis-native.md`).
178
+
179
+ Hosted interactive Codex threads explicitly enable
180
+ `features.default_mode_request_user_input` and `features.request_permissions_tool`
181
+ in their private start/resume configuration. Web-owned start/resume/fork uses
182
+ the same switches. These experimental capabilities were exercised in Codex
183
+ 0.144.6; they do not write global configuration or grant filesystem/network
184
+ permissions. Approval remains on-request with the user as reviewer.
185
+ Noninteractive direct adapters retain their defaults. The permission form
186
+ shows mirrored legacy and current path entries once, preserving distinct
187
+ access choices, original request indices and denial rules.
188
+
189
+ Claude keeps `permissionMode: 'default'`; tools already permitted by that mode
190
+ can run. Approval responses are fenced by the runtime generation, worker owner,
191
+ provider, session, turn and request ID. Web observers cannot submit responses;
192
+ a browser that loses control cannot answer with its old control epoch. Direct
193
+ answers, including secrets, are omitted from HCC snapshots, events, delivery
194
+ receipts and browser storage; form drafts remain in browser memory only.
195
+
196
+ For Codex permissions/questions, use a response file. These are separate
197
+ examples; paths, question IDs and answer labels must match the pending request:
198
+
199
+ ```json
200
+ {"permissions":{"fileSystem":{"read":["/requested/read/path"]}},"scope":"turn"}
201
+ ```
202
+
203
+ ```json
204
+ {"answers":{"question-id":{"answers":["An offered label or permitted freeform answer"]}}}
205
+ ```
206
+
207
+ ```sh
208
+ hcc native respond --peer codex-reviewer --request REQUEST_ID --decision accept --response-file ./response.json
209
+ hcc native respond --peer codex-reviewer --request REQUEST_ID --decision cancel
210
+ ```
211
+
212
+ Only `permissions`, `scope` and `answers` are accepted in that file. Permissions
213
+ can narrow the request but cannot add paths or network access; requested deny
214
+ entries must be retained when granting filesystem access. Answer every question
215
+ explicitly. Truncated requests can only be declined or cancelled. Arbitrary MCP
216
+ forms, URL authentication, dynamic tools and account-token refresh requests are
217
+ outside this responder's supported interaction set.
218
+
219
+ ## Current boundaries
220
+
221
+ - Existing Codex/Claude/dsh terminal sessions remain on their original transport;
222
+ attaching to or taking over an existing TUI/Desktop session is not implemented.
223
+ - Web discovers existing native workers in the same project and exposes messages,
224
+ delivery receipts, interruption, and explicit closure. Closing the page or Web
225
+ runtime preserves the independent native worker. Human responses are bound to
226
+ the current executor and turn. See the [Web handoff guide](web-handoff.zh-CN.md).
227
+ - Codex, Claude and dsh native workers receive project- and peer-scoped HCC MCP
228
+ configuration. Writes still require provider permission and HCC ownership checks.
229
+ - Provider-internal `SendMessage`, subagent/team discovery, and Codex delegation
230
+ tools are not exposed as one cross-vendor protocol. HCC routes cross-provider
231
+ messages through its own durable bus and adapters.
232
+ - Task claiming, file locks, handoffs, and completion checks remain explicit HCC
233
+ coordination operations; successful prompt execution alone does not prove a
234
+ task's business acceptance.
235
+ - Adapter tests cover protocol and interaction boundaries. The authenticated
236
+ checks below provide separate evidence for model execution and scoped MCP;
237
+ packaged-client installation and business acceptance remain unverified.
238
+
239
+
240
+ ## Authenticated acceptance on October 2, 2026
241
+
242
+ Independent temporary projects and provider state directories were used for real
243
+ model calls with Codex 0.144.6, Claude Agent SDK 0.3.287 and DSH 0.2.0-rc.2. The
244
+ session lifecycle receipt (source checkout: `docs/verification/2026-10-02-native-live-lifecycle.json`)
245
+ covers correlated replies and ACKs, idempotent queueing, continuing context,
246
+ owned close/resume and active interruption. A real Codex command approval was
247
+ declined, and its test write outside the allowed sandbox did not occur.
248
+
249
+ The cross-provider receipt (source checkout: `docs/verification/2026-10-02-native-live-communication.json`)
250
+ covers actual model calls to the scoped HCC MCP message tool along
251
+ `Codex → Claude → dsh → Codex`, receiver model replies, reply consumption and ACK,
252
+ and the absence of automatic reply loops. It also verifies discovery and sending
253
+ through the Web bridge, original provider binding preservation and worker
254
+ survival after closing that bridge. These receipts are separate source snapshots.
255
+
256
+ Codex MCP tool approvals use `mcpServer/elicitation/request`. HCC submits the
257
+ official action/content response for explicit tool confirmations without
258
+ persisting session/always authorization. Approving arbitrary form fields or URL
259
+ authentication is unsupported; decline and cancel remain available.
260
+
261
+ The local validation receipt (source checkout: `docs/verification/2026-10-02-native-live-validation.json`)
262
+ records the unit suite (785 passed, one platform-dependent skip), a 63-module
263
+ static audit, the 13-stage regression and offline harness failure cleanup.
264
+ Each check retains its own execution time and evidence digest.
265
+
266
+ The opt-in `scripts/native-live-acceptance.mjs` harness defaults to help. It calls
267
+ models and consumes the caller's provider quota only with `--run-live`:
268
+
269
+ ```sh
270
+ node scripts/native-live-acceptance.mjs --run-live --provider all \
271
+ --codex-bin /absolute/path/to/codex \
272
+ --dsh-bin /absolute/path/to/dsh \
273
+ --claude-sdk /absolute/path/to/claude-agent-sdk/sdk.mjs \
274
+ --permission-probe --cross-provider \
275
+ --output /absolute/path/to/receipt.json
276
+ ```
277
+
278
+ Use `--communication-only` for the cross-provider test alone. The explicit SDK
279
+ entry was used for Claude acceptance; this does not prove repository-default SDK
280
+ resolution or package installation. The script installs no dependencies, never
281
+ attaches to existing conversations, and closes owned test processes and removes
282
+ credential copies on exit. Web evidence covers its service/bridge control layer,
283
+ not a full browser interaction or published-client acceptance. Real business task
284
+ acceptance remains a separate check.
285
+
286
+
287
+ For real model and browser interactions, use
288
+ `scripts/web-native-interaction-acceptance.mjs`. It defaults to help; only
289
+ `--run-live --provider codex|claude|all` invokes models. Set
290
+ `HCC_ACCEPTANCE_PLAYWRIGHT` and optionally `HCC_ACCEPTANCE_CHROME`.
291
+ `--claude-package DIR` links an installed SDK package into the isolated worker
292
+ project for default resolution, without injecting its query function. The
293
+ harness checks explicit approval and rejection and continuing the original
294
+ session. It uses existing authentication/quota, cleans test provider homes and
295
+ processes, and never attaches to existing user conversations.