@logicseek/hello-cc 1.1.0-rc.8 → 1.1.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 (74) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/README.md +2 -0
  3. package/README.zh-CN.md +2 -0
  4. package/docs/README.md +2 -0
  5. package/docs/README.zh-CN.md +2 -0
  6. package/docs/commands.md +16 -0
  7. package/docs/commands.zh-CN.md +14 -0
  8. package/docs/dsh.md +6 -0
  9. package/docs/dsh.zh-CN.md +5 -0
  10. package/docs/native.md +21 -1
  11. package/docs/native.zh-CN.md +19 -1
  12. package/docs/private-state.md +115 -0
  13. package/docs/private-state.zh-CN.md +92 -0
  14. package/lib/cli/app.mjs +46 -5
  15. package/lib/cli/commands/hook.mjs +31 -4
  16. package/lib/cli/commands/mcp.mjs +6 -0
  17. package/lib/cli/commands/native.mjs +17 -4
  18. package/lib/cli/commands/peer.mjs +3 -0
  19. package/lib/cli/commands/run.mjs +196 -62
  20. package/lib/cli/commands/tmux.mjs +28 -19
  21. package/lib/cli/commands/up.mjs +25 -17
  22. package/lib/cli-runtime.mjs +16 -1
  23. package/lib/core/coordination/event-retention.mjs +2 -0
  24. package/lib/core/sessions/codex-thread-root.mjs +144 -0
  25. package/lib/core/sessions/launch.mjs +4 -0
  26. package/lib/discover.mjs +95 -231
  27. package/lib/integrations/dsh-collaboration.mjs +9 -2
  28. package/lib/integrations/native/claude.mjs +6 -0
  29. package/lib/integrations/native/codex.mjs +4 -2
  30. package/lib/integrations/native/dsh-acp.mjs +1 -1
  31. package/lib/integrations/native/jsonrpc.mjs +2 -2
  32. package/lib/mcp/scope.mjs +50 -8
  33. package/lib/mcp/tools.mjs +15 -2
  34. package/lib/process/pinned-cwd.mjs +64 -0
  35. package/lib/process/pinned-guidance.mjs +1 -0
  36. package/lib/process/pinned-project-state.mjs +1 -0
  37. package/lib/process/tmux-cwd-handoff.mjs +277 -0
  38. package/lib/runtime/native/cli-submissions.mjs +220 -0
  39. package/lib/runtime/native/client.mjs +7 -1
  40. package/lib/runtime/native/launcher.mjs +20 -4
  41. package/lib/runtime/native/service.mjs +143 -50
  42. package/lib/runtime/native/store.mjs +303 -14
  43. package/lib/runtime/private-state.mjs +435 -24
  44. package/lib/runtime/project-path.mjs +53 -1
  45. package/lib/runtime/project-trust.mjs +6 -2
  46. package/lib/runtime/state-migration.mjs +66 -13
  47. package/lib/shared/redact.mjs +4 -1
  48. package/lib/terminal/tmux.mjs +13 -2
  49. package/lib/ui/help.mjs +1 -0
  50. package/lib/web/codex-app-server.mjs +3 -1
  51. package/lib/web/codex-sessions.mjs +68 -8
  52. package/lib/web/context-files.mjs +194 -41
  53. package/lib/web/http-routes.mjs +43 -12
  54. package/lib/web/native-sessions.mjs +3 -0
  55. package/lib/web/project-contexts.mjs +27 -5
  56. package/lib/web/project-files.mjs +108 -26
  57. package/lib/web/pty-sessions.mjs +15 -2
  58. package/lib/web/session-serialize.mjs +6 -1
  59. package/lib/web/startup.mjs +3 -1
  60. package/lib/web/tmux-sessions.mjs +153 -50
  61. package/lib/web/ui-interactions.mjs +7 -4
  62. package/native/bin/darwin-arm64/hcc-cwd-handoff +0 -0
  63. package/native/bin/darwin-x64/hcc-cwd-handoff +0 -0
  64. package/native/bin/linux-arm64/hcc-cwd-handoff +0 -0
  65. package/native/bin/linux-x64/hcc-cwd-handoff +0 -0
  66. package/native/cwd-handoff/README.md +45 -0
  67. package/native/cwd-handoff/hcc-cwd-handoff.c +693 -0
  68. package/package.json +8 -2
  69. package/scripts/build-cwd-handoff.mjs +47 -0
  70. package/scripts/pack-cwd-handoff.mjs +27 -0
  71. package/scripts/regression.mjs +113 -7
  72. package/scripts/verify-cwd-handoff-package.mjs +60 -0
  73. package/scripts/web-workbench-acceptance.mjs +79 -1
  74. package/scripts/web-workbench-installed-acceptance.mjs +11 -1
@@ -0,0 +1,45 @@
1
+ # Trusted tmux cwd handoff
2
+
3
+ `hcc-cwd-handoff` is a small native, one-shot broker/client pair. Its purpose is
4
+ to transfer an already-open directory descriptor from the hello-cc parent to a
5
+ specific tmux pane. The selected project pathname is never passed to tmux or
6
+ opened by the pane.
7
+
8
+ The parent launches `broker` with the selected directory as fd 3 and its
9
+ `fstat` device/inode. The broker verifies fd 3 and binds a socket in a private
10
+ 0700 directory, then prints `READY`. It does not send the descriptor until the
11
+ parent writes `ALLOW <pane-pid> <64-lowercase-hex-nonce>` to stdin. The broker
12
+ compares the connected peer's kernel-provided PID and UID with that authorized
13
+ PID and its own UID, checks `HELLO <nonce>`, and transfers exactly one directory
14
+ descriptor with `SCM_RIGHTS`. The client checks device/inode and directory type,
15
+ calls `fchdir`, checks `stat(".")`, sets `PWD` from `getcwd`, acknowledges
16
+ `BOUND <nonce>`, and only then calls `execvp`. After validating that acknowledgement,
17
+ the broker atomically publishes `${socket}.bound` in the same private directory:
18
+ one regular 0600 file containing the 64-character nonce followed by a newline.
19
+ It fsyncs the temporary file, renames it into place, and fsyncs the parent
20
+ directory before reporting `BOUND` on stdout. The parent synchronously validates
21
+ and removes this receipt before admitting the pane. Both sides have bounded
22
+ waits and fail closed on malformed messages,
23
+ peer credentials, directory identity, socket permissions, or missing helpers.
24
+
25
+ This pins the **initial process cwd inode**. It does not make later absolute
26
+ path strings or `PWD` immune to subsequent renames. Peer PID authenticity
27
+ depends on the tmux server truthfully reporting the pane process PID; an
28
+ attacker controlling that same-UID server is outside this boundary.
29
+
30
+ `npm run build:native:cwd-handoff` builds the current platform/architecture
31
+ into `native/bin/<platform>-<arch>/hcc-cwd-handoff`. Supported package targets
32
+ are darwin-arm64, darwin-x64, linux-arm64, and linux-x64. Linux helpers are
33
+ static so the same package works on glibc and musl systems. The dedicated CI
34
+ workflow builds each target, tests real FD transfer, assembles one npm tarball,
35
+ checks the four binary formats and executable modes, then installs that tarball
36
+ without lifecycle scripts and tests again on all four platforms. No compiler,
37
+ Homebrew, or helper build hook is required when installing the npm package.
38
+
39
+ `npm run release:native:verify` and `npm run release:native:pack` are release
40
+ gates. A normal `npm publish` directly from a source tree without all four
41
+ binaries fails the `prepublishOnly` check. Because `--ignore-scripts` can bypass
42
+ lifecycle checks, release CI also invokes the verifier explicitly. The helper
43
+ is optional at runtime: an absent or
44
+ unsupported-platform binary must cause the caller to reject trusted tmux
45
+ launches, never fall back to a pathname-based launch.