@logicseek/hello-cc 0.1.8 → 1.0.0

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 (108) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +26 -4
  3. package/README.zh-CN.md +22 -3
  4. package/bin/hcc.mjs +3 -5622
  5. package/docs/README.md +8 -0
  6. package/docs/README.zh-CN.md +6 -0
  7. package/docs/architecture.md +29 -18
  8. package/docs/architecture.zh-CN.md +20 -10
  9. package/docs/commands.md +16 -5
  10. package/docs/commands.zh-CN.md +16 -5
  11. package/docs/current-state-review-2026-08.md +341 -0
  12. package/docs/defect-review-2026-07.md +382 -0
  13. package/docs/guide.md +53 -5
  14. package/docs/guide.zh-CN.md +46 -3
  15. package/docs/superpowers/plans/2026-08-03-runtime-safety-plan.md +294 -0
  16. package/docs/superpowers/plans/2026-08-03-v1-data-identity-plan.md +400 -0
  17. package/docs/superpowers/plans/2026-08-03-v1-release-verification-plan.md +284 -0
  18. package/docs/superpowers/plans/2026-08-03-web-api-hardening-plan.md +303 -0
  19. package/docs/superpowers/plans/2026-08-04-runtime-buffer-gc-two-phase.md +71 -0
  20. package/docs/superpowers/specs/2026-08-03-runtime-safety-design.md +117 -0
  21. package/docs/superpowers/specs/2026-08-03-v1-data-identity-design.md +120 -0
  22. package/docs/superpowers/specs/2026-08-03-v1-release-verification-design.md +117 -0
  23. package/docs/superpowers/specs/2026-08-03-web-api-hardening-design.md +104 -0
  24. package/lib/cli/app.mjs +642 -0
  25. package/lib/cli/commands/coordination.mjs +247 -0
  26. package/lib/cli/commands/doctor.mjs +81 -0
  27. package/lib/cli/commands/gc.mjs +852 -0
  28. package/lib/cli/commands/hook.mjs +205 -0
  29. package/lib/cli/commands/install.mjs +294 -0
  30. package/lib/cli/commands/lifecycle.mjs +101 -0
  31. package/lib/cli/commands/lock.mjs +197 -0
  32. package/lib/cli/commands/misc.mjs +61 -0
  33. package/lib/cli/commands/msg.mjs +152 -0
  34. package/lib/cli/commands/peer.mjs +233 -0
  35. package/lib/cli/commands/query.mjs +96 -0
  36. package/lib/cli/commands/run.mjs +463 -0
  37. package/lib/cli/commands/task.mjs +405 -0
  38. package/lib/cli/commands/team.mjs +131 -0
  39. package/lib/cli/commands/tmux.mjs +838 -0
  40. package/lib/cli/commands/up.mjs +135 -0
  41. package/lib/cli-args.mjs +16 -2
  42. package/lib/coordination-state.mjs +112 -51
  43. package/lib/core/coordination/automation.mjs +5 -8
  44. package/lib/core/coordination/clock-safety.mjs +323 -0
  45. package/lib/core/coordination/event-retention.mjs +17 -0
  46. package/lib/core/coordination/gc-plan.mjs +614 -0
  47. package/lib/core/coordination/lease-renewal.mjs +102 -0
  48. package/lib/core/coordination/lock-evidence.mjs +77 -0
  49. package/lib/core/coordination/optimistic-evidence.mjs +26 -0
  50. package/lib/core/coordination/tasks.mjs +156 -36
  51. package/lib/core/peers/evidence-runtime.mjs +312 -0
  52. package/lib/core/peers/evidence.mjs +103 -0
  53. package/lib/core/peers/hook-owner.mjs +32 -0
  54. package/lib/core/peers/liveness.mjs +44 -4
  55. package/lib/core/peers/peer-helpers.mjs +121 -0
  56. package/lib/core/peers/session.mjs +8 -2
  57. package/lib/core/peers/tmux-safety.mjs +290 -0
  58. package/lib/core/sessions/launch.mjs +15 -1
  59. package/lib/db/connection.mjs +104 -0
  60. package/lib/db/events.mjs +34 -0
  61. package/lib/db/migration-backup.mjs +225 -0
  62. package/lib/db/schema.mjs +102 -5
  63. package/lib/db/stores/peers.mjs +34 -0
  64. package/lib/integrations/peers/identity.mjs +62 -16
  65. package/lib/integrations/shims/script.mjs +139 -15
  66. package/lib/process/identity.mjs +192 -0
  67. package/lib/process/pty-lifecycle.mjs +149 -0
  68. package/lib/runtime/buffer-directory-lease.mjs +47 -0
  69. package/lib/runtime/buffer-evidence.mjs +336 -0
  70. package/lib/runtime/buffer-gc-protocol.mjs +167 -0
  71. package/lib/runtime/buffer-gc.mjs +270 -0
  72. package/lib/runtime/client.mjs +61 -8
  73. package/lib/runtime/fatal-shutdown.mjs +54 -0
  74. package/lib/runtime/project-path.mjs +139 -0
  75. package/lib/runtime/projects.mjs +320 -40
  76. package/lib/runtime/state.mjs +232 -29
  77. package/lib/shared/cleanup-error.mjs +54 -0
  78. package/lib/shared/clock-grace.mjs +106 -0
  79. package/lib/shared/errors.mjs +9 -0
  80. package/lib/shared/file-lock.mjs +370 -0
  81. package/lib/shared/json-file.mjs +6 -2
  82. package/lib/shared/redact.mjs +60 -0
  83. package/lib/shared/socket-lock-worker.mjs +201 -0
  84. package/lib/terminal/tmux.mjs +78 -4
  85. package/lib/tmux.mjs +4 -0
  86. package/lib/ui/help.mjs +53 -15
  87. package/lib/web/api-version.mjs +42 -0
  88. package/lib/web/auto-attach.mjs +185 -0
  89. package/lib/web/buffer-gc-runtime.mjs +175 -0
  90. package/lib/web/cookie-auth.mjs +119 -0
  91. package/lib/web/external-sessions.mjs +254 -0
  92. package/lib/web/http-routes.mjs +542 -0
  93. package/lib/web/http.mjs +143 -7
  94. package/lib/web/liveness-reaper.mjs +145 -0
  95. package/lib/web/peer-actions.mjs +132 -23
  96. package/lib/web/project-contexts.mjs +178 -0
  97. package/lib/web/pty-sessions.mjs +203 -0
  98. package/lib/web/runtime-main.mjs +714 -0
  99. package/lib/web/runtime.mjs +91 -36
  100. package/lib/web/session-serialize.mjs +0 -0
  101. package/lib/web/startup.mjs +333 -0
  102. package/lib/web/tls.mjs +365 -0
  103. package/lib/web/tmux-sessions.mjs +1361 -0
  104. package/lib/web/tmux-stream.mjs +166 -0
  105. package/lib/web/ui-template.mjs +152 -20
  106. package/package.json +5 -2
  107. package/scripts/check-free-identifiers.mjs +290 -0
  108. package/scripts/regression.mjs +5646 -262
package/CHANGELOG.md CHANGED
@@ -16,6 +16,123 @@ the release description from the current changelog section. Use
16
16
  `npm run release:github` with `GH_TOKEN` or `GITHUB_TOKEN` only for local
17
17
  backfills.
18
18
 
19
+ ## 1.0.0
20
+
21
+ ### Summary
22
+
23
+ hello-cc 1.0.0 is a breaking data, identity, and Runtime API release. It makes
24
+ process identity the authority for session liveness, bounds unknown evidence,
25
+ and hardens browser terminal control and technical-state cleanup.
26
+
27
+ ### Highlights
28
+
29
+ - Process identity now controls live/dead decisions across tmux and ordinary
30
+ child processes, including sleep, detach, PID reuse, and stale status rows.
31
+ - Browser credentials, trusted proxy headers, Runtime API TLS, and buffer GC
32
+ all have narrower, tested authority boundaries.
33
+
34
+ ### Breaking Changes
35
+
36
+ - Databases upgrade to schema v7. Downgrading a migrated database is not
37
+ supported. Before migration, hello-cc creates a verified
38
+ `<db>.pre-v<from>-to-v7.<timestamp>.<suffix>.bak` snapshot; stop all hello-cc
39
+ processes and validate the backup with SQLite `quick_check` before any manual
40
+ recovery. At most five strictly named backups are retained per database; the
41
+ recovery procedure is documented in the user guide.
42
+ - Provider peer IDs now hash the complete provider session value. Existing
43
+ pre-v1 provider IDs and bindings are left unchanged: there is no automatic
44
+ alias, graph rewrite, or migration to the new ID.
45
+ - Protected HTTP and WebSocket operations require Runtime API v2. Browser
46
+ terminal write tokens are issued per WebSocket connection and revoked when
47
+ that connection closes.
48
+
49
+ ### Security And Reliability
50
+
51
+ - Live tmux and non-tmux sessions are decided from immutable process evidence;
52
+ sleep and tmux detachment do not mark a live process dead. Unknown evidence
53
+ receives at most 120 seconds of grace, while confirmed dead owners expire.
54
+ - Generated Web access tokens are scoped to one runtime and are not persisted.
55
+ HTTPS runtime overrides use normal certificate verification; set
56
+ `HCC_RUNTIME_CA` to a CA file for a private or self-signed endpoint.
57
+ - `--trust-proxy` now requires `--proxy-origin https://host[:port]`; forwarded
58
+ scheme and host must match that fixed origin and arrive from loopback.
59
+ - Garbage collection keeps task/message/event/handoff history unless
60
+ `hcc gc --history --yes` is explicitly requested. Buffer deletion rechecks
61
+ producer evidence and leases immediately before each bounded batch.
62
+
63
+ ### Accepted Risks
64
+
65
+ - The default Web listener remains `0.0.0.0` over plaintext HTTP for trusted
66
+ LAN use. The token controls access but does not provide transport encryption;
67
+ use `--tls` or a pinned TLS reverse proxy when the network is not trusted.
68
+ - An authenticated browser may select any existing server directory as a
69
+ project root. This is intentional for the operator console and is not a
70
+ project-root sandbox or tenant boundary.
71
+
72
+ ### Validation
73
+
74
+ The release gate requires Node 24 unit and full regression tests, package import
75
+ closure checks, a fresh Docker build, and three consecutive container runs that
76
+ end with `FULL_REGRESSION_OK`.
77
+
78
+ ## 0.1.9
79
+
80
+ ### Summary
81
+
82
+ hello-cc 0.1.9 publishes the post-0.1.8 Web runtime and provider shim
83
+ hardening work. It tightens Web peer action identity, makes runtime cleanup
84
+ safer, and keeps Claude/Codex shims from attaching unrelated projects to a
85
+ global Web runtime.
86
+
87
+ ### Highlights
88
+
89
+ - Hardened Web runtime cleanup so starting `hcc web` from a wrapper shell does
90
+ not terminate the current parent process chain while still removing stale
91
+ orphan runtimes for the same project.
92
+ - Returned structured `BAD_REQUEST` JSON for malformed Web API request bodies
93
+ instead of surfacing raw JSON parse failures.
94
+ - Replaced Web-runtime-token reuse for mutating peer actions with independent
95
+ per-session action tokens.
96
+ - Changed provider shims to fall back to the real Claude/Codex CLI when no
97
+ current-project Web runtime is available.
98
+ - Made provider shims use only the current project's `.hello-cc/runtime.json`
99
+ during managed launches, avoiding accidental attachment through a global Web
100
+ runtime from another project.
101
+ - Kept shim-only environment variables out of restarted provider sessions.
102
+
103
+ ### Compatibility Notes
104
+
105
+ - No breaking CLI command changes are intended in this release.
106
+ - `hcc web --local` is still Web mode; use `hcc up` when you only want local
107
+ coordination commands without the Web console or shims.
108
+ - Starting `claude` or `codex` in a directory without a local
109
+ `.hello-cc/runtime.json` now runs the real provider CLI instead of implicitly
110
+ using a global hello-cc Web runtime.
111
+
112
+ ### Validation
113
+
114
+ The 0.1.9 release should be validated with:
115
+
116
+ ```bash
117
+ git diff --check
118
+ node --check bin/hcc.mjs
119
+ find lib -name '*.mjs' -print0 | xargs -0 -n1 node --check
120
+ node --check scripts/github-release.mjs
121
+ node --check scripts/regression.mjs
122
+ node --check scripts/release-notes.mjs
123
+ npm run release:check
124
+ npm run release:github:dry-run -- --version 0.1.9
125
+ npm pack --dry-run --json
126
+ npm publish --dry-run --registry=https://registry.npmjs.org/ --access public
127
+ npm test
128
+ ```
129
+
130
+ The expected full regression marker is:
131
+
132
+ ```text
133
+ FULL_REGRESSION_OK
134
+ ```
135
+
19
136
  ## 0.1.8
20
137
 
21
138
  ### Summary
package/README.md CHANGED
@@ -30,6 +30,20 @@ It is built for developers who run multiple AI coding agents in the same repo
30
30
  and need them to coordinate instead of guessing what the other sessions are
31
31
  doing.
32
32
 
33
+ ## v1 Compatibility And Trust Model
34
+
35
+ Version 1.0.0 upgrades project databases to schema v7 after creating a verified
36
+ pre-migration backup; downgrading that database is unsupported. Provider peer
37
+ IDs now hash the full provider session value and old IDs are not remapped.
38
+ Runtime API v2 and per-connection terminal action tokens are required.
39
+
40
+ Liveness follows tmux/non-tmux process evidence: sleep or detachment does not
41
+ kill a live session, and only unknown evidence receives the bounded 120-second
42
+ grace. `hcc gc` retains history unless `--history` is explicit. `--tls` encrypts
43
+ the console; `--trust-proxy` requires a fixed `--proxy-origin`. Two risks remain
44
+ intentional: the default listener is plaintext HTTP on `0.0.0.0` for trusted
45
+ LANs, and an authenticated browser may select any existing server directory.
46
+
33
47
  ## Highlights
34
48
 
35
49
  - **Shared project memory**: peers, tasks, messages, locks, handoffs, and
@@ -94,19 +108,22 @@ hcc web
94
108
  ```
95
109
 
96
110
  Then open the printed URL. By default, `hcc web` listens on LAN interfaces and
97
- requests `0.0.0.0:8787`, using a saved URL token generated on first use. If
111
+ requests `0.0.0.0:8787`, using a token generated for that runtime. If
98
112
  port 8787 is already busy and you did not pass `--port`, it automatically tries
99
113
  the next available port. The command prints both the LAN login URL and the local
100
114
  loopback URL:
101
115
 
102
116
  ```text
103
- open: http://<machine-ip>:8787/?token=<saved-token>&project=/path/to/project
104
- local: http://127.0.0.1:8787/?token=<saved-token>&project=/path/to/project
117
+ open: http://<machine-ip>:8787/?token=<runtime-token>&project=/path/to/project
118
+ local: http://127.0.0.1:8787/?token=<runtime-token>&project=/path/to/project
105
119
  ```
106
120
 
107
121
  Use `--local` to bind only to `127.0.0.1`, or `--port N` to request a specific
108
122
  port. `hcc web` initializes the project bus, installs Claude/Codex hooks and
109
123
  shims, starts or reuses the Web console, and returns the terminal to you.
124
+ `hcc web --local` is still Web mode; it only limits the listener to loopback.
125
+ Use `hcc up` when you want local coordination commands without the Web console
126
+ or shims.
110
127
 
111
128
  After the first shim install, open a new terminal or reload the rc file for
112
129
  your shell:
@@ -125,13 +142,18 @@ codex resume <session-id>
125
142
  ```
126
143
 
127
144
  Those sessions become tmux-backed peers that can be seen and controlled from
128
- Web while remaining usable from the local terminal.
145
+ Web while remaining usable from the local terminal. The shims only use the
146
+ current project's runtime file. If you start `claude` or `codex` in a directory
147
+ where `hcc web` has not created `.hello-cc/runtime.json`, the shim falls back to
148
+ the real provider CLI instead of using the global Web runtime or creating a new
149
+ project database.
129
150
 
130
151
  ## Basic Workflow
131
152
 
132
153
  ```bash
133
154
  hcc task create --title "Review router changes" --priority 20
134
155
  hcc task next
156
+ hcc task running --id 1 --summary "Started"
135
157
  hcc lock acquire --resource src/router --ttl 900 --reason "edit router"
136
158
  hcc status
137
159
  hcc handoff create --summary "Router change ready for review" --tests "npm test"
package/README.zh-CN.md CHANGED
@@ -25,6 +25,19 @@
25
25
 
26
26
  它适合在同一个仓库里同时运行多个 AI 编程 agent 的场景:让它们知道彼此在做什么,而不是各自猜测。
27
27
 
28
+ ## v1 兼容性与信任边界
29
+
30
+ 1.0.0 会在生成并校验升级前备份后,把项目数据库升级到 schema v7;升级后的
31
+ 数据库不支持降级。provider peer ID 改为对完整 provider session 值做哈希,旧 ID
32
+ 不会自动映射或迁移。受保护的接口使用 Runtime API v2,终端 action token 按
33
+ WebSocket 连接签发和撤销。
34
+
35
+ 存活判断以 tmux/非 tmux 进程证据为准:休眠或 detach 不会把活进程判死,只有
36
+ unknown 证据获得最长 120 秒宽限。`hcc gc` 默认保留历史,必须显式使用
37
+ `--history`。`--tls` 提供传输加密;`--trust-proxy` 必须固定
38
+ `--proxy-origin`。两项风险是有意保留的:默认在可信内网以明文 HTTP 监听
39
+ `0.0.0.0`,且已认证浏览器可以选择服务器上任意已存在目录。
40
+
28
41
  ## 特色
29
42
 
30
43
  - **项目本地共享状态**:peers、tasks、messages、locks、handoffs 和 events 写入 `<project>/.hello-cc/mesh.db`。
@@ -82,18 +95,20 @@ hcc web
82
95
  ```
83
96
 
84
97
  然后打开命令输出里的 URL。默认情况下,`hcc web` 会监听内网地址,请求
85
- `0.0.0.0:8787`,并在 URL 里附带首次自动生成并保存的稳定 token。如果 8787
98
+ `0.0.0.0:8787`,并在 URL 里附带为本次 runtime 自动生成的 token。如果 8787
86
99
  端口已被占用,且你没有显式传 `--port`,它会自动尝试后续可用端口。启动时会同时
87
100
  打印内网登录地址和本机 loopback 地址:
88
101
 
89
102
  ```text
90
- open: http://<machine-ip>:8787/?token=<saved-token>&project=/path/to/project
91
- local: http://127.0.0.1:8787/?token=<saved-token>&project=/path/to/project
103
+ open: http://<machine-ip>:8787/?token=<runtime-token>&project=/path/to/project
104
+ local: http://127.0.0.1:8787/?token=<runtime-token>&project=/path/to/project
92
105
  ```
93
106
 
94
107
  使用 `--local` 可以只绑定 `127.0.0.1`,使用 `--port N` 可以指定请求端口。
95
108
  `hcc web` 会初始化项目总线,安装 Claude/Codex hooks 和 shims,启动或复用 Web
96
109
  控制台,然后把终端还给你。
110
+ `hcc web --local` 仍然是 Web 模式,只是限制监听在本机 loopback。只想使用本地
111
+ 协作命令、不启动 Web 控制台、不安装 shims 时,使用 `hcc up`。
97
112
 
98
113
  第一次安装 shim 后,打开新终端,或根据当前 shell 重新加载配置:
99
114
 
@@ -111,12 +126,16 @@ codex resume <session-id>
111
126
  ```
112
127
 
113
128
  这些会话会成为 tmux-backed peer,可以继续在本地终端里使用,也可以被 Web 控制台观察和操作。
129
+ shim 只使用当前项目自己的 runtime 文件。如果你在没有通过 `hcc web` 创建
130
+ `.hello-cc/runtime.json` 的目录里启动 `claude` 或 `codex`,shim 会回退到真实
131
+ provider CLI,不会使用全局 Web runtime,也不会为这个目录新建项目数据库。
114
132
 
115
133
  ## 基本流程
116
134
 
117
135
  ```bash
118
136
  hcc task create --title "Review router changes" --priority 20
119
137
  hcc task next
138
+ hcc task running --id 1 --summary "Started"
120
139
  hcc lock acquire --resource src/router --ttl 900 --reason "edit router"
121
140
  hcc status
122
141
  hcc handoff create --summary "Router change ready for review" --tests "npm test"