shellpuppet 0.0.1 → 0.2.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 (137) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +499 -8
  4. package/dist/cli/desktopShortcut.d.ts +22 -0
  5. package/dist/cli/desktopShortcut.js +157 -0
  6. package/dist/cli/desktopShortcut.js.map +1 -0
  7. package/dist/cli/index.d.ts +13 -0
  8. package/dist/cli/index.js +846 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/client/http.d.ts +143 -0
  11. package/dist/client/http.js +581 -0
  12. package/dist/client/http.js.map +1 -0
  13. package/dist/core/dialogs.d.ts +96 -0
  14. package/dist/core/dialogs.js +226 -0
  15. package/dist/core/dialogs.js.map +1 -0
  16. package/dist/core/echo.d.ts +71 -0
  17. package/dist/core/echo.js +249 -0
  18. package/dist/core/echo.js.map +1 -0
  19. package/dist/core/find.d.ts +34 -0
  20. package/dist/core/find.js +41 -0
  21. package/dist/core/find.js.map +1 -0
  22. package/dist/core/keys.d.ts +22 -0
  23. package/dist/core/keys.js +80 -0
  24. package/dist/core/keys.js.map +1 -0
  25. package/dist/core/manager.d.ts +96 -0
  26. package/dist/core/manager.js +271 -0
  27. package/dist/core/manager.js.map +1 -0
  28. package/dist/core/nativePty.d.ts +73 -0
  29. package/dist/core/nativePty.js +161 -0
  30. package/dist/core/nativePty.js.map +1 -0
  31. package/dist/core/policy.d.ts +61 -0
  32. package/dist/core/policy.js +143 -0
  33. package/dist/core/policy.js.map +1 -0
  34. package/dist/core/promptDetector.d.ts +109 -0
  35. package/dist/core/promptDetector.js +897 -0
  36. package/dist/core/promptDetector.js.map +1 -0
  37. package/dist/core/reasoning.d.ts +265 -0
  38. package/dist/core/reasoning.js +933 -0
  39. package/dist/core/reasoning.js.map +1 -0
  40. package/dist/core/regexBudget.d.ts +64 -0
  41. package/dist/core/regexBudget.js +103 -0
  42. package/dist/core/regexBudget.js.map +1 -0
  43. package/dist/core/renderer.d.ts +127 -0
  44. package/dist/core/renderer.js +316 -0
  45. package/dist/core/renderer.js.map +1 -0
  46. package/dist/core/selection.d.ts +6 -0
  47. package/dist/core/selection.js +48 -0
  48. package/dist/core/selection.js.map +1 -0
  49. package/dist/core/session.d.ts +565 -0
  50. package/dist/core/session.js +1450 -0
  51. package/dist/core/session.js.map +1 -0
  52. package/dist/core/types.d.ts +316 -0
  53. package/dist/core/types.js +71 -0
  54. package/dist/core/types.js.map +1 -0
  55. package/dist/core/waiter.d.ts +94 -0
  56. package/dist/core/waiter.js +310 -0
  57. package/dist/core/waiter.js.map +1 -0
  58. package/dist/core/windowsConsoleHost.d.ts +147 -0
  59. package/dist/core/windowsConsoleHost.js +588 -0
  60. package/dist/core/windowsConsoleHost.js.map +1 -0
  61. package/dist/core/windowsPtyStart.d.ts +161 -0
  62. package/dist/core/windowsPtyStart.js +236 -0
  63. package/dist/core/windowsPtyStart.js.map +1 -0
  64. package/dist/daemon/audit.d.ts +23 -0
  65. package/dist/daemon/audit.js +51 -0
  66. package/dist/daemon/audit.js.map +1 -0
  67. package/dist/daemon/auth.d.ts +197 -0
  68. package/dist/daemon/auth.js +366 -0
  69. package/dist/daemon/auth.js.map +1 -0
  70. package/dist/daemon/config.d.ts +119 -0
  71. package/dist/daemon/config.js +568 -0
  72. package/dist/daemon/config.js.map +1 -0
  73. package/dist/daemon/folderPicker.d.ts +27 -0
  74. package/dist/daemon/folderPicker.js +115 -0
  75. package/dist/daemon/folderPicker.js.map +1 -0
  76. package/dist/daemon/index.d.ts +7 -0
  77. package/dist/daemon/index.js +88 -0
  78. package/dist/daemon/index.js.map +1 -0
  79. package/dist/daemon/launchProfiles.d.ts +155 -0
  80. package/dist/daemon/launchProfiles.js +554 -0
  81. package/dist/daemon/launchProfiles.js.map +1 -0
  82. package/dist/daemon/liveness.d.ts +36 -0
  83. package/dist/daemon/liveness.js +71 -0
  84. package/dist/daemon/liveness.js.map +1 -0
  85. package/dist/daemon/logger.d.ts +7 -0
  86. package/dist/daemon/logger.js +29 -0
  87. package/dist/daemon/logger.js.map +1 -0
  88. package/dist/daemon/meta.d.ts +9 -0
  89. package/dist/daemon/meta.js +24 -0
  90. package/dist/daemon/meta.js.map +1 -0
  91. package/dist/daemon/paths.d.ts +85 -0
  92. package/dist/daemon/paths.js +154 -0
  93. package/dist/daemon/paths.js.map +1 -0
  94. package/dist/daemon/screenshot.d.ts +144 -0
  95. package/dist/daemon/screenshot.js +402 -0
  96. package/dist/daemon/screenshot.js.map +1 -0
  97. package/dist/daemon/server.d.ts +453 -0
  98. package/dist/daemon/server.js +3954 -0
  99. package/dist/daemon/server.js.map +1 -0
  100. package/dist/daemon/sessionFeed.d.ts +48 -0
  101. package/dist/daemon/sessionFeed.js +101 -0
  102. package/dist/daemon/sessionFeed.js.map +1 -0
  103. package/dist/daemon/terminalReports.d.ts +38 -0
  104. package/dist/daemon/terminalReports.js +84 -0
  105. package/dist/daemon/terminalReports.js.map +1 -0
  106. package/dist/daemon/viewerLauncher.d.ts +226 -0
  107. package/dist/daemon/viewerLauncher.js +562 -0
  108. package/dist/daemon/viewerLauncher.js.map +1 -0
  109. package/dist/daemon/viewerSync.d.ts +38 -0
  110. package/dist/daemon/viewerSync.js +83 -0
  111. package/dist/daemon/viewerSync.js.map +1 -0
  112. package/dist/mcp/config.d.ts +50 -0
  113. package/dist/mcp/config.js +95 -0
  114. package/dist/mcp/config.js.map +1 -0
  115. package/dist/mcp/index.d.ts +10 -0
  116. package/dist/mcp/index.js +78 -0
  117. package/dist/mcp/index.js.map +1 -0
  118. package/dist/mcp/tools.d.ts +66 -0
  119. package/dist/mcp/tools.js +638 -0
  120. package/dist/mcp/tools.js.map +1 -0
  121. package/dist/viewer/dashboard-folders.js +20 -0
  122. package/dist/viewer/dashboard-layout.js +52 -0
  123. package/dist/viewer/dashboard.css +67 -0
  124. package/dist/viewer/dashboard.html +44 -0
  125. package/dist/viewer/dashboard.js +1518 -0
  126. package/dist/viewer/icon-16.png +0 -0
  127. package/dist/viewer/icon-180.png +0 -0
  128. package/dist/viewer/icon-32.png +0 -0
  129. package/dist/viewer/icon-512.png +0 -0
  130. package/dist/viewer/icon.ico +0 -0
  131. package/dist/viewer/icon.svg +66 -0
  132. package/dist/viewer/index.html +61 -0
  133. package/dist/viewer/pane.js +736 -0
  134. package/dist/viewer/viewer.css +95 -0
  135. package/dist/viewer/viewer.js +84 -0
  136. package/package.json +66 -7
  137. package/index.js +0 -4
package/README.md CHANGED
@@ -1,12 +1,503 @@
1
1
  # ShellPuppet
2
2
 
3
- **Supervised terminal sessions for AI agents** — an agent drives a real terminal
4
- (an agent CLI, or any TUI) while a human watches and types into the very same live
5
- session from a browser. Because your AI agents need adult supervision.
3
+ ![Screen recording: Claude Code runs four other coding agents (Codex, Antigravity, Grok and Qoder) side by side, each in its own ShellPuppet terminal. Codex's window lights up amber when it asks permission to run a command; the person answers in that window, declining with a reason, and Codex carries on with its review.](docs/media/demo.gif)
6
4
 
7
- This is a placeholder release reserving the package name ahead of ShellPuppet's
8
- first public release, which is in active development by
9
- [Red Eagle Tech](https://redeagle.tech). The first release will ship as open
10
- source under an OSI-approved licence, announced alongside it.
5
+ ▶ [Watch the full demo](https://github.com/intermeld/shellpuppet/releases/download/v0.1.0/shellpuppet-demo.mp4)
6
+ (67 seconds, MP4)
11
7
 
12
- Watch https://redeagle.tech for the launch.
8
+ **Supervised terminal sessions for AI agents.** An agent drives a real terminal
9
+ while a human watches, and types into, the same live session from a
10
+ browser. The terminal runs whatever you point it at: an agent CLI such as
11
+ Claude Code, Codex, Antigravity, OpenCode, MiMo Code, Qoder, Goose or Grok,
12
+ or any other TUI.
13
+
14
+ ShellPuppet is to the terminal what Playwright is to the browser. Playwright
15
+ gives a program a real browser: the program clicks, reads the page, waits and
16
+ works on pages only a person could use. ShellPuppet gives an agent a real
17
+ terminal the same way.
18
+
19
+ Without ShellPuppet, an agent runs a program the way you might shout through a
20
+ closed door: one instruction goes in, one note comes back, and if the program
21
+ asks a question, nobody is there to answer it. ShellPuppet opens the door. The
22
+ agent sits at the keyboard: it types, looks at the screen, waits and types
23
+ again. And there's a window on your screen, so you can pull up a chair,
24
+ watch what it's doing and take the keyboard yourself whenever you like. Some
25
+ programs only work if someone is sitting there: menus, wizards, chat-style
26
+ tools, other AI assistants. An agent couldn't use those at all. Now it can.
27
+
28
+ ShellPuppet is the open-source terminal layer of **Intermeld**, the agent
29
+ governance platform by [Red Eagle Tech](https://redeagle.tech). Everything in
30
+ this repository runs on your machine and needs nothing we operate.
31
+
32
+ > **Status: 0.2.0, with the dashboard.** The daemon, CLI, MCP server, viewer
33
+ > and dashboard install from npm (below). Watch the repository's Releases for what comes
34
+ > next, and bring questions, ideas and what you build with it to
35
+ > [Discussions](https://github.com/intermeld/shellpuppet/discussions). 🦅
36
+
37
+ ## What you get
38
+
39
+ - **Real terminals, driven by tools.** Sessions run in a real PTY (ConPTY on
40
+ Windows), rendered through a real terminal emulator and exposed as twelve
41
+ small MCP tools: start, snapshot, type, key, wait, find, result, list,
42
+ resize, screenshot, viewer-url, kill. The CLI has a verb for each, spelled
43
+ `snap` for the snapshot.
44
+ - **An agent's answer without its reasoning.** Several agent CLIs draw the
45
+ model's reasoning on screen as they work. A supervising agent can read a
46
+ session with that left out (snapshot, find and wait take `hideReasoning`),
47
+ or take just the answer that ended the latest turn, and so keep another
48
+ model's reasoning out of its own context. A screenshot shows the whole
49
+ screen.
50
+ - **A human in the same session.** When the first session starts, the dashboard
51
+ opens on your machine. Later sessions appear there. You see what the agent sees, live, and you can type
52
+ into it: to answer a prompt, to correct course or to take over. Your window
53
+ sets the size: the terminal reshapes itself to fill it, as a terminal
54
+ should. To watch from another device, or to let someone else watch, ask the
55
+ agent for a link or run `shellpuppet viewer-url <id>`. A fresh link is live
56
+ until it's opened, so hand it over as you would a key; it works once and for
57
+ a few minutes, so a link in an old transcript is spent. `--read-only` gives
58
+ one that can watch but never type.
59
+ - **Waits instead of sleeps, and prompts you're told about.** `wait` blocks on
60
+ text, a regex, quiescence or "the program is asking a question". The daemon
61
+ spots permission prompts in driven agent CLIs, flags sessions that sit on
62
+ one and badges the viewer so the human knows they are needed.
63
+ - **Nothing leaves your machine unless you send it or switch it on.** Today
64
+ the tool has no outbound path at all: no telemetry, no crash reporting, no
65
+ update checks, and the daemon listens on `127.0.0.1` only. Diagnostics, when
66
+ it comes, stays off until you switch it on, carries no session content and no
67
+ identifiers, and writes every payload to a local file before it leaves. That
68
+ rule, nothing leaves unless you send it or switch it on, is a permanent
69
+ property of the tool rather than a default. [VISION.md](VISION.md) and
70
+ [SECURITY.md](SECURITY.md) say why.
71
+
72
+ ## Quickstart
73
+
74
+ Install, then wire it into your agent and ask it for something; or run the
75
+ five commands under *Check the install from any shell*.
76
+
77
+ You need Node.js 22 or later. On Windows you need Windows 10 version 1809
78
+ (build 18309) or later: the sessions run on ConPTY, which node-pty 1.2.0
79
+ requires (it removed its winpty fallback); a start on an older build is
80
+ refused with the minimum named. `node-pty` ships prebuilt binaries for
81
+ Windows and macOS and, in the 1.2.0 beta ShellPuppet pins, for mainstream
82
+ Linux too (glibc, x64 and arm64), so no compiler is needed there. Where no
83
+ prebuilt matches (another architecture, or musl in place of glibc), npm
84
+ builds it with node-gyp, which needs Python 3, make and a C++ compiler (on
85
+ Debian and Ubuntu: `sudo apt-get install -y python3 make g++`).
86
+
87
+ **Install:**
88
+
89
+ ```sh
90
+ npm install -g shellpuppet # Windows and macOS
91
+ npm install -g --allow-scripts=node-pty shellpuppet # Linux
92
+ ```
93
+
94
+ On Windows, npm installs `shellpuppet` as a PowerShell script as well as a
95
+ `.cmd`, and PowerShell's default execution policy refuses the script. Run
96
+ `Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned` in that
97
+ window first, or run ShellPuppet from Command Prompt.
98
+
99
+ npm 12 runs a dependency's install script only when you allow it. On Linux,
100
+ node-pty's install script is what builds it where no prebuilt binary matches
101
+ the machine. Without the flag the install still completes; where a prebuilt
102
+ binary is present it loads that, and otherwise `shellpuppet start` refuses and
103
+ names the flag.
104
+
105
+ Recent npm 11 releases and npm 12 print a warning that node-pty has install
106
+ scripts. On Windows and macOS ShellPuppet needs none of them, so there the
107
+ warning is safe to ignore. npm 10 ignores the flag, and early npm 11 releases
108
+ warn that it is an unknown option; both run the install scripts anyway.
109
+
110
+ On macOS, ShellPuppet makes node-pty's `spawn-helper` executable itself on
111
+ the first start. If you installed with `sudo`, it can't, and that first start
112
+ tells you the `sudo chmod +x` to run once.
113
+
114
+ **From source** (the same thing, plus a build):
115
+
116
+ ```sh
117
+ git clone https://github.com/intermeld/shellpuppet.git
118
+ cd shellpuppet
119
+ npm ci
120
+ npm run build
121
+ npm link # puts `shellpuppet` on your PATH; or use `node dist/cli/index.js`
122
+ ```
123
+
124
+ On Windows the shim `npm link` makes meets the same execution policy; set it
125
+ as above, or use the `node dist/cli/index.js` form instead.
126
+
127
+ **Wire it into your agent.** ShellPuppet is an MCP server. With `shellpuppet`
128
+ on your PATH, Claude Code is one command:
129
+
130
+ ```sh
131
+ claude mcp add shellpuppet -- shellpuppet mcp
132
+ ```
133
+
134
+ For any other MCP client, the equivalent entry:
135
+
136
+ ```json
137
+ {
138
+ "mcpServers": {
139
+ "shellpuppet": { "command": "shellpuppet", "args": ["mcp"] }
140
+ }
141
+ }
142
+ ```
143
+
144
+ That shape works for Claude Code, Cursor, Gemini CLI and the desktop apps.
145
+ Codex reads `~/.codex/config.toml` instead:
146
+
147
+ ```toml
148
+ [mcp_servers.shellpuppet]
149
+ command = "shellpuppet"
150
+ args = ["mcp"]
151
+ ```
152
+
153
+ Without `npm link`, use `node` with the absolute path to `dist/cli/index.js`
154
+ and the argument `mcp`.
155
+
156
+ **Then ask your agent for something.** Tell it to run a program in a
157
+ ShellPuppet session. A window opens on your screen as the session starts: you
158
+ watch, and when the program asks a question, you click into the window and
159
+ answer it. A good first ask: *"Run `npm create vite@latest` in a ShellPuppet
160
+ session, in an empty folder, and let me choose the options."* npm first asks
161
+ whether to install the wizard: answer y, and the wizard's menus appear in the
162
+ window as they come, each one flagged for you; pick with the arrow keys and
163
+ Enter. In the recording at the top, four agents do this at once, and the
164
+ person answers Codex's permission prompt in its window.
165
+
166
+ **Check the install from any shell.** The CLI has a verb for every tool, so
167
+ you can drive a session by hand:
168
+
169
+ ```sh
170
+ # 1. Start a Node REPL in a real PTY. The daemon starts itself, you get a
171
+ # session id (s1) and the dashboard opens (or a viewer link, if no window can).
172
+ # s1 is the first session on a fresh daemon: use whatever id start printed.
173
+ shellpuppet start --label demo --no-shell node
174
+
175
+ # 2. Wait for the REPL to paint and settle, instead of guessing at a sleep.
176
+ shellpuppet wait s1 --quiet 1000
177
+
178
+ # 3. Type as an agent would, and confirm the keystrokes landed.
179
+ shellpuppet type s1 '6 * 7' --enter --verify
180
+
181
+ # 4. Read the screen back as plain text.
182
+ shellpuppet snap s1
183
+
184
+ # 5. Kill the session: the whole process tree, not just the PTY child.
185
+ shellpuppet kill s1
186
+ ```
187
+
188
+ Step 2 prints the REPL banner and prompt, step 3 says `typed 6 bytes (verified
189
+ on screen).` and step 4 shows `42` under your input. That exercises daemon
190
+ auto-start, the PTY, the renderer, waiting, input verification and tree-kill.
191
+
192
+ **No window?** By default a session start opens the dashboard in ShellPuppet's
193
+ own isolated browser profile. If that window cannot open, `start` prints a
194
+ single-session viewer link. On a headless machine, or if you'd rather have a
195
+ link, set `viewer.launchMode` to `"no-window"` in `~/.shellpuppet/config.json`:
196
+ `start` then prints a viewer link,
197
+ and an agent is given one to pass to you. Whatever the setting, `shellpuppet
198
+ viewer-url <id>` mints a fresh link whenever you want one, and `--read-only`
199
+ makes it a link that can watch but never type. The options are in
200
+ [`docs/reference/configuration.md`](docs/reference/configuration.md).
201
+
202
+ In the viewer, on Windows and Linux, Ctrl+V pastes; to send a literal Ctrl+V
203
+ to the program, there is no in-pane shortcut. Ctrl+C copies selected terminal
204
+ text, and sends `^C` when nothing is selected. On macOS, Cmd+V pastes and
205
+ Ctrl+V still sends `^V`.
206
+
207
+ **How long it takes.** On clean machines:
208
+
209
+ - **Windows 11** (a fresh Windows Sandbox, Node 24): installing ShellPuppet with
210
+ npm took 22 to 26 s from a cold npm cache, and the five steps above 3.6 s end
211
+ to end.
212
+ - **Linux** (a clean container, Node 22): the install took 29 s, including
213
+ npm building node-pty, and the five steps about 2 s.
214
+
215
+ The first viewer window on a fresh machine takes longer, about 13 s in that
216
+ sandbox, because the browser is starting for the first time.
217
+
218
+ ## Working with an agent
219
+
220
+ Twelve tools appear once the server is wired in: `terminal_start`,
221
+ `terminal_snapshot`, `terminal_type`, `terminal_key`, `terminal_wait`,
222
+ `terminal_find`, `terminal_result`, `terminal_list`, `terminal_resize`,
223
+ `terminal_screenshot`, `terminal_viewer_url` and `terminal_kill`.
224
+
225
+ | Tool | Prompt supervision |
226
+ | --- | --- |
227
+ | `terminal_wait` | `prompt: true` with no session or an array of ids waits for any prompt. `now: true` polls once. Both return compact details without a screen. |
228
+ | `terminal_list` | `waitingOnly: true` returns only sessions waiting on a prompt. |
229
+
230
+ `terminal_wait` with `prompt: true` can omit `session` to wait for a prompt in
231
+ any live session, or take an array of session ids to watch only those. It
232
+ returns compact waiting sessions without screens; `now: true` polls once.
233
+ `terminal_list` with `waitingOnly: true` returns the same compact view. The
234
+ CLI forms are `shellpuppet wait --prompt [id ...] [--now]` and
235
+ `shellpuppet list --waiting`. A wait with one string session id keeps its
236
+ usual screen response.
237
+
238
+ The HTTP `GET /sessions/wait?prompt=true` response is compact, including on a
239
+ timeout or an immediate `now=true` poll:
240
+
241
+ ```json
242
+ {
243
+ "matched": true,
244
+ "reason": "prompt",
245
+ "waitedMs": 80,
246
+ "sessions": [
247
+ {
248
+ "id": "s2",
249
+ "label": "build delegate",
250
+ "question": "Allow this command to run?",
251
+ "options": ["Allow once", "Deny"],
252
+ "selectedOption": 0,
253
+ "waitingMs": 4200
254
+ }
255
+ ]
256
+ }
257
+ ```
258
+
259
+ `reason` is `prompt` or `timeout`. A timeout has `matched: false` and an empty
260
+ `sessions` array. Each row always has `id`, `label` and `waitingMs` in
261
+ milliseconds; `question`, `options` and `selectedOption` are optional.
262
+ `hideReasoning=true` removes `question` and `options`. `GET
263
+ /sessions?waitingOnly=true` returns the same rows in its `sessions` array,
264
+ alongside the usual `version` field. MCP tool results frame prompt text as
265
+ untrusted terminal data, including the full `terminal_list` result. Each result
266
+ uses one matching pair of delimiter lines with a fresh random nonce. Terminal
267
+ output cannot predict the closing delimiter or end its own frame.
268
+
269
+ Text snapshots (`terminal_snapshot`, `terminal_wait`, `shellpuppet snap` and
270
+ `lastLines`) prefix a uniquely styled menu choice with `⟦SP:selected⟧ `. This
271
+ text annotation is never sent to the terminal or viewer. A detected prompt
272
+ keeps its option labels unchanged and reports `selectedOption` separately as
273
+ their zero-based index, when inverse video or a background colour identifies
274
+ one choice. Ordinary highlighting adds neither field nor marker.
275
+
276
+ When the session runs another agent CLI, `terminal_result` returns the answer
277
+ that ended its latest turn and nothing else, and `terminal_snapshot`,
278
+ `terminal_find`, `terminal_wait` and `terminal_screenshot` take `hideReasoning`
279
+ to leave out the reasoning it draws. A filtered `terminal_list` omits every
280
+ waiting prompt's question and options, whether or not the session has a
281
+ signature. Each CLI's screen is read by a signature: Claude Code,
282
+ Codex, Qoder, OpenCode, MiMo Code, Grok and Antigravity are built in. A
283
+ session started through a shell or a launcher script says which CLI it runs
284
+ with `terminal_start`'s `agent`. Snapshot, find, wait, screenshot and
285
+ `terminal_result` refuse a session with no signature rather than show it
286
+ unfiltered.
287
+
288
+ **Important:** A session whose model is a Claude model should **ALWAYS** pass
289
+ `hideReasoning: true` on every call that reads a screen: `terminal_snapshot`,
290
+ `terminal_wait`, `terminal_find`, `terminal_screenshot`, `terminal_list`, and
291
+ `--hide-reasoning` with their CLI equivalents. Claude models' safety checks can
292
+ flag another model's reasoning read off a screen as an attempt to extract
293
+ reasoning and stop the session. Leaving the reasoning out avoids that;
294
+ `terminal_result` gives the agent's answer. With the flag, a Claude model can
295
+ use every ShellPuppet tool freely. Other models can leave the flag off when
296
+ they need the full screen.
297
+
298
+ In a filtered screenshot, hidden rows are blurred and dimmed before capture;
299
+ its returned row text is filtered too. A filtered session list reports that a
300
+ prompt is waiting and for how long without its question.
301
+
302
+ `terminal_start` opens the dashboard for you when needed and tells the agent
303
+ what happened. It gives the agent a viewer link when no window could open, and
304
+ `terminal_viewer_url` mints one whenever you ask: for a
305
+ second device, a closed window or someone who should watch without typing.
306
+ Links work once and for a few minutes. An agent CLI that needs a key held only in the
307
+ client's environment gets the names you list for it in `agents.passEnv`, and any
308
+ other program the names you list in config `envNames` and ask for at start
309
+ (`docs/reference/configuration.md`). Sessions
310
+ otherwise start with a clean environment, not the daemon's, so a key in the
311
+ daemon's environment doesn't reach them. `terminal_screenshot` returns a PNG of the viewer as a
312
+ browser draws it. Use it to illustrate documentation with real screens, and to
313
+ check what is *actually* on screen when the text looks right and something
314
+ still seems wrong. A capture has 45 s to start a browser, draw the page and
315
+ take the picture; `shellpuppet screenshot --timeout <ms>` moves that budget
316
+ for a machine that is slower or in more of a hurry.
317
+
318
+ The tool descriptions carry the lessons that cost real time to learn: first
319
+ paint is not readiness; a wait for text you just typed matches your own echo;
320
+ `escape` resets a TUI that has stopped listening. The measured behaviour of
321
+ each agent CLI, with ready-text regexes and timeout budgets, is in
322
+ [`docs/reference/agent-profiles.md`](docs/reference/agent-profiles.md).
323
+
324
+ ## The CLI
325
+
326
+ ```
327
+ shellpuppet start [options] <command> [args...] # options BEFORE the command
328
+ shellpuppet list | snap | type | key | wait | find | resize | kill
329
+ shellpuppet screenshot <id> [--out <file>] # the viewer, as a browser draws it
330
+ shellpuppet viewer-url <id> [--read-only] # a fresh single-use viewer link
331
+ shellpuppet dashboard # the dashboard, in its own isolated window
332
+ shellpuppet desktop # start or reuse ShellPuppet's dashboard
333
+ shellpuppet desktop --install # add or update your application shortcut
334
+ shellpuppet desktop --uninstall # remove that shortcut
335
+ shellpuppet daemon status|start|stop|restart # status and stop never start one
336
+ shellpuppet mcp
337
+ ```
338
+
339
+ On Windows, `start` uses `cmd.exe /d /s /c` by default. ShellPuppet joins the
340
+ command and arguments with spaces; `cmd.exe` then parses that line. A value
341
+ containing spaces needs quotes *inside the argument sent to ShellPuppet*. For
342
+ example, from Git Bash:
343
+
344
+ ```sh
345
+ shellpuppet start --agent codex node.exe codex-seat.js personal -c 'mcp_servers.x.command="C:/Program Files/nodejs/node.exe"'
346
+ ```
347
+
348
+ Git Bash removes the single quotes. ShellPuppet receives one argument with
349
+ double quotes around the path; `cmd.exe` and the program's argument parser
350
+ use those quotes to retain the space. Quoting only the whole value for Git
351
+ Bash, as in `'mcp_servers.x.command=C:/Program Files/nodejs/node.exe'`, does
352
+ not protect the space from `cmd.exe`. The shell also interprets `^`, `&`,
353
+ `|`, `<`, `>` and expands `%NAME%`, even inside double quotes. For literal
354
+ arguments to an `.exe` or `.com`, use `--no-shell`; the same choice is
355
+ `shell: false` in `terminal_start` and launch profiles. On other platforms,
356
+ starts run directly by default; an explicit `shell: true` uses `/bin/sh -c`
357
+ and its shell syntax.
358
+
359
+ `shellpuppet dashboard` opens a window with a pane for every session in ShellPuppet's
360
+ isolated browser profile and prints only whether a window opened. It never
361
+ prints the link, and it never uses your default browser: if the isolated
362
+ window cannot open, the command fails rather than hand the grant to a profile
363
+ with extensions.
364
+
365
+ To share sessions across screens, use **Open on screen** in the dashboard
366
+ toolbar, or open another dashboard window and move it yourself. Each session
367
+ appears in one window. Windows fill their readable grid capacity in order;
368
+ when every window is full, extra sessions are shared according to each
369
+ window's capacity. The toolbar shows the number of sessions in this window
370
+ and the number of sharing windows. The screen buttons follow windows moved
371
+ between screens. Closing a window returns its sessions to the others. Auto fit
372
+ refits a session in the window that receives it.
373
+
374
+ In Focus, drag the boundary between the large pane and its strip. In Grid,
375
+ drag a boundary between columns or rows. Focus a boundary and use the arrow
376
+ keys for small steps, Shift with an arrow for larger steps, or Home to reset
377
+ that direction. A drag stops at the readable pane size, or at the strip's
378
+ minimum width. On release, a pane that grew fits its real terminal, respecting
379
+ Auto fit's rules when it is on; one that shrank keeps its grid and scales or
380
+ scrolls. With Auto fit off, release keeps the real terminal size until Fit is
381
+ pressed. The boundary announces its position in pixels. Sizes stay
382
+ in this window for the session and survive a reload. Choose Auto or Grid
383
+ again to reset them.
384
+
385
+ Double-click a pane's title bar to Enlarge or Restore it. Escape restores an
386
+ enlarged pane in navigation mode or when focus is outside the terminal;
387
+ inside the terminal, Escape goes to the program. Double-clicking inside the
388
+ terminal still selects text.
389
+ In dashboard panes, on Windows and Linux, Ctrl+V pastes; to send a literal
390
+ Ctrl+V to the program, there is no in-pane shortcut. Ctrl+C copies selected
391
+ terminal text, and sends `^C` when nothing is selected. On macOS, Cmd+V
392
+ pastes and Ctrl+V still sends `^V`.
393
+
394
+ `shellpuppet --help` documents every flag. Exit codes: 0 ok · 1 the operation
395
+ failed, such as typing into a session that has exited · 2 the request itself
396
+ was wrong, whether the CLI caught it or the daemon refused it with a 400, such
397
+ as an invalid `--regex` · 3 wait did not match, or find found nothing, so
398
+ scripts can branch on either. `find` prints each matching line as
399
+ `<row>: <text>` and nothing else on stdout; with no match it prints the fixed
400
+ line `No matches.` on stderr, never the pattern, as the MCP tool does. With
401
+ `--json` it prints the response, an empty `matches` list included, and still
402
+ exits 3 when nothing matched.
403
+
404
+ ### Start ShellPuppet from the Start menu
405
+
406
+ On Windows, run `shellpuppet desktop --install` once. The per-user ShellPuppet
407
+ shortcut starts the daemon using your configured [`daemon.startWith`](docs/reference/configuration.md#daemon-start-wrapper)
408
+ when needed, then opens the dashboard. Pin the shortcut to Start or the taskbar
409
+ to start ShellPuppet with one click. You can pin the dashboard window to keep
410
+ its place, but use the shortcut to start ShellPuppet. A second click while a
411
+ dashboard page is connected reports that ShellPuppet is already open. The
412
+ shortcut starts minimised, so the console should only blink. Its target is
413
+ Node and the installed package's `dist/cli/index.js` at the package's stable
414
+ global location, which an npm update replaces in place. Run `--install` again
415
+ if you move the package to a different prefix or move or replace Node at a
416
+ different path. `--uninstall` removes only ShellPuppet's shortcut.
417
+
418
+ On Linux, `--install` writes a per-user `shellpuppet.desktop` application
419
+ launcher. On macOS, shortcut installation is not available yet. You can run
420
+ `shellpuppet desktop` from a terminal on any platform. `shellpuppet dashboard`
421
+ still opens a new isolated window on every call.
422
+
423
+ ## How it works
424
+
425
+ One per-user **daemon** owns every PTY and serves the browser viewer, on
426
+ loopback only, with a token on every request bar `/health`, the viewer page
427
+ and its static assets. The MCP server and the CLI start the daemon if it isn't
428
+ running. Every CLI verb is a one-shot HTTP client that returns promptly,
429
+ except `mcp`, which stays up for the stdio transport, and `wait`, which blocks
430
+ until its condition holds or its timeout runs out (300 s at most). Because
431
+ every client talks to the one daemon, two agents' MCP servers share one set of
432
+ sessions, and so does the human at the viewer. That is the point: sessions are
433
+ shared or they are nothing.
434
+
435
+ The build specification is
436
+ [`docs/architecture/design.md`](docs/architecture/design.md). It is
437
+ self-contained. It records what was considered and rejected, and the code
438
+ follows it.
439
+
440
+ ## Day one
441
+
442
+ ShellPuppet 0.2.0 adds the dashboard. Here is what to expect from it, as of
443
+ November 2026. The [roadmap](ROADMAP.md) says what comes next, and your ideas
444
+ shape it: tell us what you'd like, and where it trips you up, in
445
+ [Discussions](https://github.com/intermeld/shellpuppet/discussions), and
446
+ report bugs in the [issues](https://github.com/intermeld/shellpuppet/issues).
447
+
448
+ - **The dashboard is new.** It holds every session as a pane, across more
449
+ than one screen, and fits the panes to the window. Its layout has been
450
+ driven hard on Windows with real agent CLIs; tell us where it lets you
451
+ down on your screens.
452
+ - **Prompt detection is pattern-based.** It recognises the numbered,
453
+ pointer-only and letter-keyed choosers and the confirmation prompts real
454
+ agent CLIs draw, and the select, multi-select and confirm steps of
455
+ scaffolding wizards built on `@clack/prompts`, each pinned by a fixture from
456
+ a real screen. A shape it has not seen it will miss, and output that
457
+ imitates one can fool it. If it misses a real prompt you meet, tell us, or
458
+ better still, send a pull request with the fix.
459
+ - **Readiness is heuristic.** "First paint is not readiness" is in the tools
460
+ themselves, and quiet-based waits need a first paint before silence counts;
461
+ but a program can paint and still discard input while it finishes loading.
462
+ Wait for its own ready text.
463
+ - **Killing can take seconds on Windows.** A Windows `kill` waits for
464
+ `taskkill` to end the whole process tree. On the clean Windows 11 machine
465
+ behind the install timings above it took under a second; on a busy
466
+ development workstation it took up to about nine seconds.
467
+ - **Your MCP client may have a shorter patience than the daemon.** Waits go
468
+ up to 300 s, but some clients background a tool call after two minutes.
469
+ Keep long waits under your client's limit and poll.
470
+ - **Linux and macOS testers wanted.** Windows has had the most real-world
471
+ driving so far. Linux and macOS run the full test suite on every change,
472
+ and we'd welcome people who drive agents on them to try ShellPuppet and
473
+ tell us how it goes.
474
+
475
+ ## Documentation
476
+
477
+ | Read | For |
478
+ |---|---|
479
+ | [VISION.md](VISION.md) | What the project is for, what is open and stays open, the principles it won't trade away and where Intermeld begins. **Start here.** |
480
+ | [ROADMAP.md](ROADMAP.md) | What is being worked on now, what comes next and what is further off, without dates. |
481
+ | [`docs/architecture/design.md`](docs/architecture/design.md) | The build specification. |
482
+ | [`docs/reference/security-model.md`](docs/reference/security-model.md) | What running this grants, the token model, the limits that remain and the recorded prompt-injection drill. |
483
+ | [`docs/reference/configuration.md`](docs/reference/configuration.md) | Every `config.json` option: command policy, environment hygiene, audit, viewer launch. |
484
+ | [`docs/reference/agent-profiles.md`](docs/reference/agent-profiles.md) | Measured agent-CLI behaviour, ready-text regexes, timeout budgets, recipes. |
485
+ | [`docs/decisions/`](docs/decisions/) | Decision records: [ADR-001 naming](docs/decisions/ADR-001-two-brand-open-core-naming.md), [ADR-002 licence](docs/decisions/ADR-002-apache-2-licence.md), [ADR-003 TypeScript](docs/decisions/ADR-003-typescript-implementation.md), [ADR-004 contribution policy](docs/decisions/ADR-004-contribution-policy.md), [ADR-005 diagnostics and feedback](docs/decisions/ADR-005-diagnostics-and-feedback.md), [ADR-006 agent modules](docs/decisions/ADR-006-per-agent-modules.md), [ADR-007 connected features](docs/decisions/ADR-007-connected-features.md), [ADR-008 clean session environment](docs/decisions/ADR-008-clean-session-environment-by-default.md), [ADR-009 dashboard](docs/decisions/ADR-009-dashboard-and-sessions-you-start-yourself.md). |
486
+ | [SECURITY.md](SECURITY.md) · [SUPPORT.md](SUPPORT.md) · [CONTRIBUTING.md](CONTRIBUTING.md) | Reporting a vulnerability · getting help · building, testing and sending changes. |
487
+
488
+ ## Contributing
489
+
490
+ Contributions are accepted under the Developer Certificate of Origin: sign off
491
+ each commit (`git commit -s`), and there's no contributor licence agreement,
492
+ ever ([ADR-004](docs/decisions/ADR-004-contribution-policy.md)). The sign-off
493
+ check runs on every pull request. Bug reports are welcome in the issues, and
494
+ questions, ideas and any other feedback in
495
+ [Discussions](https://github.com/intermeld/shellpuppet/discussions);
496
+ [SUPPORT.md](SUPPORT.md) says where everything goes.
497
+
498
+ ## Licence
499
+
500
+ [Apache-2.0](LICENSE). See also [NOTICE](NOTICE). Code released under
501
+ Apache-2.0 stays Apache-2.0; the pledge is in
502
+ [VISION.md](VISION.md#licensing-and-contributions). The names are trademarks:
503
+ see [TRADEMARKS.md](TRADEMARKS.md).
@@ -0,0 +1,22 @@
1
+ export interface ShortcutFields {
2
+ target: string;
3
+ arguments: string;
4
+ workingDirectory: string;
5
+ icon: string;
6
+ description: string;
7
+ showCommand: number;
8
+ }
9
+ interface ShortcutOptions {
10
+ platform: NodeJS.Platform;
11
+ applicationsDir: string;
12
+ fields?: ShortcutFields;
13
+ }
14
+ /** MS-SHLLINK: header, target ID list, local LinkInfo, Unicode StringData and terminal block. */
15
+ export declare function shellLink(fields: ShortcutFields): Buffer;
16
+ /** Read the fields back for format regression tests. */
17
+ export declare function parseShellLink(bytes: Buffer): ShortcutFields;
18
+ export declare function desktopEntry(fields: ShortcutFields): string;
19
+ export declare function installDesktopShortcut(options: ShortcutOptions): string;
20
+ export declare function uninstallDesktopShortcut(options: Omit<ShortcutOptions, 'fields'>): string;
21
+ export declare function userShortcutOptions(platform?: NodeJS.Platform): ShortcutOptions;
22
+ export {};