@logicseek/hello-cc 1.0.0 → 1.0.1
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/CHANGELOG.md +77 -0
- package/README.md +32 -0
- package/README.zh-CN.md +31 -0
- package/docs/guide.md +58 -0
- package/docs/guide.zh-CN.md +55 -0
- package/lib/cli/app.mjs +2 -0
- package/lib/cli/commands/coordination.mjs +3 -1
- package/lib/cli/commands/gc.mjs +182 -32
- package/lib/cli/commands/misc.mjs +15 -0
- package/lib/cli/commands/peer.mjs +21 -5
- package/lib/process/identity.mjs +30 -0
- package/lib/runtime/buffer-directory-lease.mjs +2 -1
- package/lib/runtime/client.mjs +3 -0
- package/lib/shared/file-lock.mjs +11 -4
- package/lib/shared/socket-lock-worker.mjs +73 -24
- package/lib/terminal/tmux.mjs +53 -23
- package/lib/web/buffer-gc-runtime.mjs +2 -2
- package/lib/web/project-contexts.mjs +6 -1
- package/lib/web/runtime-main.mjs +3 -0
- package/lib/web/startup.mjs +4 -2
- package/package.json +2 -2
- package/scripts/regression.mjs +95 -98
- package/docs/architecture-split-review.md +0 -217
- package/docs/current-state-review-2026-08.md +0 -341
- package/docs/defect-review-2026-07.md +0 -382
- package/docs/layout-split-stack-audit.md +0 -298
- package/docs/superpowers/plans/2026-08-03-runtime-safety-plan.md +0 -294
- package/docs/superpowers/plans/2026-08-03-v1-data-identity-plan.md +0 -400
- package/docs/superpowers/plans/2026-08-03-v1-release-verification-plan.md +0 -284
- package/docs/superpowers/plans/2026-08-03-web-api-hardening-plan.md +0 -303
- package/docs/superpowers/plans/2026-08-04-runtime-buffer-gc-two-phase.md +0 -71
- package/docs/superpowers/specs/2026-08-03-runtime-safety-design.md +0 -117
- package/docs/superpowers/specs/2026-08-03-v1-data-identity-design.md +0 -120
- package/docs/superpowers/specs/2026-08-03-v1-release-verification-design.md +0 -117
- package/docs/superpowers/specs/2026-08-03-web-api-hardening-design.md +0 -104
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# hello-cc v1 Release and Verification Design
|
|
2
|
-
|
|
3
|
-
Status: approved in conversation on 2026-08-03.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
Define code ownership boundaries, fatal error behavior, packaging, documentation,
|
|
8
|
-
and evidence required before the remaining hardening work can be called complete.
|
|
9
|
-
|
|
10
|
-
## Module Boundaries
|
|
11
|
-
|
|
12
|
-
New focused modules own these policies:
|
|
13
|
-
|
|
14
|
-
- process identity inspection and comparison;
|
|
15
|
-
- clock observation and liveness resolution;
|
|
16
|
-
- project registry locking;
|
|
17
|
-
- buffer GC planning and arbitration;
|
|
18
|
-
- Runtime API version negotiation;
|
|
19
|
-
- secret redaction.
|
|
20
|
-
|
|
21
|
-
`bin/hcc.mjs` remains the command and runtime orchestrator. It calls these
|
|
22
|
-
modules but does not duplicate their decision logic. Existing repository
|
|
23
|
-
patterns are retained; unrelated restructuring is out of scope.
|
|
24
|
-
|
|
25
|
-
Every imported production module must be tracked and included by the package
|
|
26
|
-
`files` contract. Docker test files are tracked but remain outside the npm
|
|
27
|
-
package.
|
|
28
|
-
|
|
29
|
-
## Fatal Error Behavior
|
|
30
|
-
|
|
31
|
-
Expected poller, watcher, sibling-project, and transient runtime failures are
|
|
32
|
-
caught at their ownership boundary, logged with redaction, and isolated.
|
|
33
|
-
|
|
34
|
-
An uncaught exception or unhandled rejection initiates one idempotent fatal
|
|
35
|
-
shutdown. Shutdown stops timers and watchers, closes sessions and sockets using
|
|
36
|
-
the documented detach/exit semantics, clears only runtime pointers owned by the
|
|
37
|
-
current process identity, closes the server and database resources, then exits
|
|
38
|
-
nonzero. The runtime must not continue after an unknown exception.
|
|
39
|
-
|
|
40
|
-
A second fatal signal during shutdown forces termination without attempting a
|
|
41
|
-
second cleanup pass.
|
|
42
|
-
|
|
43
|
-
## Release Contract
|
|
44
|
-
|
|
45
|
-
The package version becomes `1.0.0`. Changelog, README files, bilingual command
|
|
46
|
-
documentation, help output, and the defect review describe:
|
|
47
|
-
|
|
48
|
-
- schema v7 and no downgrade support;
|
|
49
|
-
- the pre-migration backup;
|
|
50
|
-
- provider peer ID changes;
|
|
51
|
-
- Runtime API v2 and session token delivery changes;
|
|
52
|
-
- safe GC defaults and `--history`;
|
|
53
|
-
- process-evidence-first liveness and unknown-only grace;
|
|
54
|
-
- optional TLS and trusted proxy usage;
|
|
55
|
-
- accepted plaintext LAN and arbitrary-root risks.
|
|
56
|
-
|
|
57
|
-
The defect report uses evidence-backed status counts and the actual branch. It
|
|
58
|
-
must not label accepted risks or partial controls as completely fixed.
|
|
59
|
-
|
|
60
|
-
The Dockerfile uses `npm ci`, records Node and tmux versions in test output, and
|
|
61
|
-
builds from the complete current source tree. `.dockerignore` excludes host
|
|
62
|
-
runtime state and secrets without excluding production source.
|
|
63
|
-
|
|
64
|
-
## Test Architecture
|
|
65
|
-
|
|
66
|
-
Pure policies use Node's built-in test runner in focused test files. Real CLI,
|
|
67
|
-
SQLite, tmux, HTTP, HTTPS, and WebSocket boundaries remain integration tests.
|
|
68
|
-
Tests do not add production-only backdoors or test-only public APIs.
|
|
69
|
-
|
|
70
|
-
Each behavior change follows red-green-refactor:
|
|
71
|
-
|
|
72
|
-
1. add the smallest regression that demonstrates the missing invariant;
|
|
73
|
-
2. run it and record the expected failure;
|
|
74
|
-
3. implement the minimum production change;
|
|
75
|
-
4. rerun the focused test and relevant neighboring tests;
|
|
76
|
-
5. refactor only while green.
|
|
77
|
-
|
|
78
|
-
Required regressions cover:
|
|
79
|
-
|
|
80
|
-
- v5/v6 backup and migration failure atomicity;
|
|
81
|
-
- PID reuse and platform process inspection;
|
|
82
|
-
- live, dead, and unknown tmux/external peers;
|
|
83
|
-
- CLI-only sleep-sized gaps and concurrent grace writers;
|
|
84
|
-
- manual/automatic GC, negative retention, history opt-in, and runtime failure;
|
|
85
|
-
- concurrent registry writers and same-root DB changes;
|
|
86
|
-
- API v2, cookie lifecycle, action-token scope, CSP, and redaction;
|
|
87
|
-
- realpath and symlink containment;
|
|
88
|
-
- fatal shutdown cleanup;
|
|
89
|
-
- package content and tracked-file completeness.
|
|
90
|
-
|
|
91
|
-
TTL renewal tests use the renewal operation's recorded timestamp rather than
|
|
92
|
-
assuming wall-clock readings in separate processes are monotonic. This retains
|
|
93
|
-
strict TTL inflation checks without the observed one-second container flake.
|
|
94
|
-
|
|
95
|
-
## Verification Gates
|
|
96
|
-
|
|
97
|
-
Completion requires fresh evidence, in this order:
|
|
98
|
-
|
|
99
|
-
1. final diff and tracked production import audit;
|
|
100
|
-
2. syntax/import/package-content checks;
|
|
101
|
-
3. focused unit and security regression tests;
|
|
102
|
-
4. original vulnerable-path reproductions and alternate bypass inputs;
|
|
103
|
-
5. preserved legitimate behavior tests;
|
|
104
|
-
6. complete local regression;
|
|
105
|
-
7. a freshly built Node 24/Linux image;
|
|
106
|
-
8. three consecutive complete container regressions;
|
|
107
|
-
9. final `origin/master..worktree` review and documentation consistency check.
|
|
108
|
-
|
|
109
|
-
A failed gate blocks a completion claim. Accepted risks are reported separately
|
|
110
|
-
and are not represented as test gaps or fixed findings.
|
|
111
|
-
|
|
112
|
-
## Definition of Done
|
|
113
|
-
|
|
114
|
-
The work is complete only when every approved non-accepted-risk requirement in
|
|
115
|
-
the four v1 design specifications has a passing test or a documented reason the
|
|
116
|
-
check is inapplicable, all required verification gates pass, and the final
|
|
117
|
-
working tree contains no untracked production dependency.
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# Web and Runtime API v2 Hardening Design
|
|
2
|
-
|
|
3
|
-
Status: approved in conversation on 2026-08-03.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
Define the v1 Web authentication, Runtime API v2, browser policy, path safety,
|
|
8
|
-
and log-redaction contract while preserving two explicitly accepted risks.
|
|
9
|
-
|
|
10
|
-
## Accepted Risks
|
|
11
|
-
|
|
12
|
-
- The default Web listener remains `0.0.0.0` over HTTP for LAN access.
|
|
13
|
-
- An authenticated administrator may select any existing server project root.
|
|
14
|
-
|
|
15
|
-
These choices permit passive LAN observation of HTTP traffic and broad access
|
|
16
|
-
to server project directories by anyone holding the administrator credential.
|
|
17
|
-
Documentation must state these risks and must not mark transport confidentiality
|
|
18
|
-
or project scoping as fully remediated.
|
|
19
|
-
|
|
20
|
-
## Authentication Roles
|
|
21
|
-
|
|
22
|
-
The stable runtime token is the administrator credential. An HttpOnly browser
|
|
23
|
-
cookie issued after successful token login represents the same administrator
|
|
24
|
-
role. Both may create, stop, attach, and inject managed sessions.
|
|
25
|
-
|
|
26
|
-
A session action token is narrower. It authorizes terminal WebSocket input for
|
|
27
|
-
one managed session and is delivered only in that session's terminal snapshot.
|
|
28
|
-
It is never returned by the session list. Session action token comparisons use
|
|
29
|
-
the shared constant-time token helper.
|
|
30
|
-
|
|
31
|
-
Cookie sessions have a server-side expiry, a bounded count, explicit logout,
|
|
32
|
-
and tracked WebSocket membership. Expiry, eviction, or logout closes associated
|
|
33
|
-
WebSockets immediately. Cookie-authenticated mutations require a same-origin
|
|
34
|
-
request.
|
|
35
|
-
|
|
36
|
-
Non-loopback listeners require a non-empty administrator token. Tokenless mode
|
|
37
|
-
is accepted only from a loopback socket.
|
|
38
|
-
|
|
39
|
-
## Runtime API v2
|
|
40
|
-
|
|
41
|
-
Runtime metadata advertises API version 2. CLI and browser HTTP requests send
|
|
42
|
-
`X-HCC-API-Version: 2`. Browser WebSocket handshakes send `api_version=2` in the
|
|
43
|
-
query because the WebSocket browser API cannot set an arbitrary request header.
|
|
44
|
-
Protected API requests with a missing or unsupported version receive HTTP 426
|
|
45
|
-
with `API_VERSION_UNSUPPORTED` and the supported version.
|
|
46
|
-
|
|
47
|
-
Public login and static bootstrap routes remain reachable without the API
|
|
48
|
-
version header. The v1 release notes identify removal of `action_token` from
|
|
49
|
-
`GET /api/sessions` as a breaking API change.
|
|
50
|
-
|
|
51
|
-
## Browser Policy
|
|
52
|
-
|
|
53
|
-
HTML responses use a per-response nonce. The Content Security Policy permits
|
|
54
|
-
scripts only from self and the response nonce, denies objects and framing,
|
|
55
|
-
restricts base URIs, and permits only the same-origin HTTP/WebSocket connections
|
|
56
|
-
needed by the console. Styles allow the current xterm and inline-style contract;
|
|
57
|
-
script policy must not require `unsafe-inline`.
|
|
58
|
-
|
|
59
|
-
Responses retain no-store, no-referrer, and nosniff headers. Secure requests may
|
|
60
|
-
add transport-only headers without applying HSTS to accepted plaintext mode.
|
|
61
|
-
|
|
62
|
-
## Path Safety
|
|
63
|
-
|
|
64
|
-
Arbitrary existing roots remain supported, but lexical containment is not
|
|
65
|
-
enough. The selected root is canonicalized with `realpath`. The `.hello-cc`
|
|
66
|
-
directory is created with owner-only permissions when absent and canonicalized
|
|
67
|
-
when present. A symlinked `.hello-cc` or DB parent that resolves outside the
|
|
68
|
-
canonical state directory is rejected.
|
|
69
|
-
|
|
70
|
-
The selected database must resolve to `mesh.db` or another path below the real
|
|
71
|
-
`.hello-cc` directory. Pseudo-files, non-regular database targets, and symlink
|
|
72
|
-
escapes are rejected before SQLite opens the target.
|
|
73
|
-
|
|
74
|
-
## TLS and Proxy Modes
|
|
75
|
-
|
|
76
|
-
Direct `--tls` mode validates certificate dates, SAN coverage, key pairing, file
|
|
77
|
-
permissions, and generation publication before listening. CLI requests trust
|
|
78
|
-
only the runtime's stored self-signed certificate.
|
|
79
|
-
|
|
80
|
-
`--trust-proxy --proxy-origin https://host[:port]` accepts forwarded host/proto
|
|
81
|
-
only from a loopback peer and only when both exactly match the pinned public
|
|
82
|
-
origin. Either option without the other is rejected. Forwarded headers from any
|
|
83
|
-
non-loopback peer are ignored. Cookie `Secure` state and origin checks consume
|
|
84
|
-
the same trusted-proxy decision.
|
|
85
|
-
|
|
86
|
-
## Secret Redaction
|
|
87
|
-
|
|
88
|
-
All startup and error logging passes through one redactor. It removes or replaces
|
|
89
|
-
values for `--token`, Authorization, cookies, session action tokens, runtime
|
|
90
|
-
tokens, and URL `token` query parameters. The redactor handles both structured
|
|
91
|
-
objects and command-line strings. Runtime pointer files remain owner-readable
|
|
92
|
-
only because local CLI operation requires the administrator token.
|
|
93
|
-
|
|
94
|
-
## Acceptance Criteria
|
|
95
|
-
|
|
96
|
-
- Old or missing API versions receive 426 on protected API routes.
|
|
97
|
-
- Admin token and admin cookie retain documented management behavior.
|
|
98
|
-
- Session action tokens are absent from lists and required for WS input.
|
|
99
|
-
- Logout and expiry close existing cookie-authenticated WebSockets.
|
|
100
|
-
- CSP blocks an injected inline script without the nonce.
|
|
101
|
-
- Logs contain no supplied administrator, cookie, or session token value.
|
|
102
|
-
- Symlink DB escape is rejected while a normal arbitrary project root works.
|
|
103
|
-
- Direct TLS, loopback trusted proxy, and accepted plaintext LAN modes pass
|
|
104
|
-
independent integration tests.
|