@bulletproof-sh/ctrl-daemon 0.4.0-beta.11 → 0.4.0-beta.35

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 (2) hide show
  1. package/README.md +35 -10
  2. package/package.json +10 -8
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bulletproof-sh/ctrl-daemon
2
2
 
3
- WebSocket daemon for [Ctrl / Cubicles](https://ctrl.bulletproof.sh) — auto-discovers AI coding agent sessions (Claude Code, OpenAI Codex, Augment Code) and broadcasts live agent state to connected web clients. Features a full-screen animated TUI with a centered log panel showing daemon events in real time.
3
+ WebSocket daemon for [Ctrl](https://ctrl.bulletproof.sh) — auto-discovers AI coding agent sessions (Claude Code, OpenAI Codex, Augment Code) and broadcasts live agent state to connected web clients. Supports relay sharing with end-to-end encryption for remote spectators. Features a full-screen animated TUI with a centered log panel.
4
4
 
5
5
  ## Requirements
6
6
 
@@ -39,6 +39,10 @@ npx @bulletproof-sh/ctrl-daemon --no-open
39
39
  | `--animation, -a <name>` | `random` | Background animation: matrix, starfield, aurora, fireflies, life, pipes, dvd, starwars, none |
40
40
  | `--no-tui` | — | Disable TUI (also auto-disabled when not a TTY) |
41
41
  | `--no-open` | — | Don't auto-open the browser on startup |
42
+ | `--share` | — | Enable relay sharing (env: `CTRL_SHARE=1`) |
43
+ | `--relay-url <url>` | channel-aware | Custom relay URL (env: `CTRL_RELAY_URL`) |
44
+ | `--no-encrypt` | — | Disable end-to-end encryption for relay |
45
+ | `--relay-only` | — | Relay only, no local server (implies `--share`) |
42
46
  | `--help`, `-h` | — | Print usage |
43
47
 
44
48
  Without `--project-dir`, the daemon auto-discovers all installed AI coding tools and watches their session directories.
@@ -53,19 +57,21 @@ The TUI handles terminal resize and restores the terminal cleanly on exit. The T
53
57
 
54
58
  ## Sharing your office
55
59
 
56
- Run the daemon and an [ngrok](https://ngrok.com) tunnel in parallel to share a live view with anyone:
60
+ Share a live view of your office with anyone:
57
61
 
58
62
  ```sh
59
- # Terminal 1 — start the daemon
60
- npx @bulletproof-sh/ctrl-daemon
61
-
62
- # Terminal 2 — expose it publicly
63
- ngrok http 3001
63
+ npx @bulletproof-sh/ctrl-daemon --share
64
64
  ```
65
65
 
66
- Then open [ctrl.bulletproof.sh](https://ctrl.bulletproof.sh), go to **Settings Share Office** and copy the generated link. Anyone who opens it will see your agents in real time — no auth or setup required on their end.
66
+ The daemon connects to the relay server, generates a share URL with an embedded encryption key, and prints it to the TUI. Anyone who opens the link sees your agents in real time — end-to-end encrypted, no auth required.
67
+
68
+ For relay-only mode (no local server):
69
+
70
+ ```sh
71
+ npx @bulletproof-sh/ctrl-daemon --relay-only
72
+ ```
67
73
 
68
- > **Note:** Free ngrok URLs rotate each time you restart the tunnel. A paid ngrok plan gives you a stable domain.
74
+ > **Legacy:** You can still use [ngrok](https://ngrok.com) to tunnel the local server if you prefer: `ngrok http 3001`
69
75
 
70
76
  ## WebSocket API
71
77
 
@@ -78,9 +84,28 @@ The [Ctrl web app](https://ctrl.bulletproof.sh) connects here by default. You ca
78
84
  `GET /health` returns JSON with daemon status, agent count, and version:
79
85
 
80
86
  ```json
81
- { "status": "ok", "agents": 3, "version": "0.0.18" }
87
+ { "status": "ok", "agents": 3, "version": "0.4.0" }
82
88
  ```
83
89
 
90
+ ### Message protocol
91
+
92
+ The daemon broadcasts JSON messages over WebSocket. Key message types:
93
+
94
+ | Direction | Type | Description |
95
+ |---|---|---|
96
+ | daemon→client | `existingAgents` | Initial state snapshot (agents, layout, version, share URL) |
97
+ | daemon→client | `agentCreated` | New agent session detected |
98
+ | daemon→client | `agentClosed` | Agent session ended |
99
+ | daemon→client | `agentStatus` | Agent idle/waiting/working state change |
100
+ | daemon→client | `agentToolStart` | Agent started using a tool |
101
+ | daemon→client | `agentToolDone` | Agent finished using a tool |
102
+ | daemon→client | `agentCostUpdate` | Token usage update |
103
+ | daemon→client | `agentSessionResult` | Session completed with success/failure + cost |
104
+ | client→daemon | `clientVersion` | Client identifies itself (triggers state snapshot for relay subscribers) |
105
+ | client→daemon | `clientLayout` | Client sends its office layout (cached by daemon for spectators) |
106
+
107
+ When relay sharing is enabled, messages are wrapped in a relay envelope (`{ v: 1, src, type, payload }`) and optionally encrypted with AES-GCM.
108
+
84
109
  ## Environment Variables
85
110
 
86
111
  | Variable | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bulletproof-sh/ctrl-daemon",
3
- "version": "0.4.0-beta.11",
3
+ "version": "0.4.0-beta.35",
4
4
  "description": "WebSocket daemon for ctrl — watches Claude Code sessions and broadcasts agent state",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -17,22 +17,24 @@
17
17
  "build": "bun build src/index.ts --outdir dist --target bun --minify",
18
18
  "build:binaries": "bun scripts/build-binaries.ts",
19
19
  "check": "biome check .",
20
- "verify": "bunx tsc --noEmit && biome check . && vitest run",
20
+ "verify": "bunx tsc --noEmit && biome check . && vitest run --coverage && bun test src/relay.e2e.test.ts",
21
21
  "test": "vitest run",
22
- "test:watch": "vitest"
22
+ "test:watch": "vitest",
23
+ "test:coverage": "vitest run --coverage"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@biomejs/biome": "^2.4.4",
26
27
  "@types/bun": "latest",
28
+ "@vitest/coverage-v8": "^4.0.18",
27
29
  "typescript": "~5.9.3",
28
30
  "vitest": "^4.0.18"
29
31
  },
30
32
  "optionalDependencies": {
31
- "@bulletproof-sh/ctrl-daemon-darwin-arm64": "0.4.0-beta.11",
32
- "@bulletproof-sh/ctrl-daemon-darwin-x64": "0.4.0-beta.11",
33
- "@bulletproof-sh/ctrl-daemon-linux-arm64": "0.4.0-beta.11",
34
- "@bulletproof-sh/ctrl-daemon-linux-x64": "0.4.0-beta.11",
35
- "@bulletproof-sh/ctrl-daemon-windows-x64": "0.4.0-beta.11"
33
+ "@bulletproof-sh/ctrl-daemon-darwin-arm64": "0.4.0-beta.35",
34
+ "@bulletproof-sh/ctrl-daemon-darwin-x64": "0.4.0-beta.35",
35
+ "@bulletproof-sh/ctrl-daemon-linux-arm64": "0.4.0-beta.35",
36
+ "@bulletproof-sh/ctrl-daemon-linux-x64": "0.4.0-beta.35",
37
+ "@bulletproof-sh/ctrl-daemon-windows-x64": "0.4.0-beta.35"
36
38
  },
37
39
  "dependencies": {
38
40
  "posthog-node": "^5.26.0"