shellpuppet 0.1.0 → 0.2.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.
Files changed (101) hide show
  1. package/README.md +210 -33
  2. package/dist/cli/desktopShortcut.d.ts +22 -0
  3. package/dist/cli/desktopShortcut.js +157 -0
  4. package/dist/cli/desktopShortcut.js.map +1 -0
  5. package/dist/cli/index.js +268 -59
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/client/http.d.ts +74 -3
  8. package/dist/client/http.js +560 -37
  9. package/dist/client/http.js.map +1 -1
  10. package/dist/core/dialogs.d.ts +20 -12
  11. package/dist/core/dialogs.js +31 -19
  12. package/dist/core/dialogs.js.map +1 -1
  13. package/dist/core/manager.d.ts +35 -5
  14. package/dist/core/manager.js +121 -8
  15. package/dist/core/manager.js.map +1 -1
  16. package/dist/core/nativePty.d.ts +9 -5
  17. package/dist/core/nativePty.js +11 -6
  18. package/dist/core/nativePty.js.map +1 -1
  19. package/dist/core/promptDetector.d.ts +37 -3
  20. package/dist/core/promptDetector.js +303 -12
  21. package/dist/core/promptDetector.js.map +1 -1
  22. package/dist/core/reasoning.d.ts +19 -6
  23. package/dist/core/reasoning.js +223 -30
  24. package/dist/core/reasoning.js.map +1 -1
  25. package/dist/core/regexBudget.d.ts +20 -0
  26. package/dist/core/regexBudget.js +25 -1
  27. package/dist/core/regexBudget.js.map +1 -1
  28. package/dist/core/renderer.d.ts +16 -1
  29. package/dist/core/renderer.js +97 -6
  30. package/dist/core/renderer.js.map +1 -1
  31. package/dist/core/selection.d.ts +6 -0
  32. package/dist/core/selection.js +48 -0
  33. package/dist/core/selection.js.map +1 -0
  34. package/dist/core/session.d.ts +267 -13
  35. package/dist/core/session.js +585 -101
  36. package/dist/core/session.js.map +1 -1
  37. package/dist/core/types.d.ts +53 -18
  38. package/dist/core/types.js +30 -6
  39. package/dist/core/types.js.map +1 -1
  40. package/dist/core/waiter.d.ts +12 -4
  41. package/dist/core/waiter.js +63 -70
  42. package/dist/core/waiter.js.map +1 -1
  43. package/dist/core/windowsConsoleHost.d.ts +147 -0
  44. package/dist/core/windowsConsoleHost.js +588 -0
  45. package/dist/core/windowsConsoleHost.js.map +1 -0
  46. package/dist/core/windowsPtyStart.d.ts +100 -29
  47. package/dist/core/windowsPtyStart.js +143 -36
  48. package/dist/core/windowsPtyStart.js.map +1 -1
  49. package/dist/daemon/auth.d.ts +72 -2
  50. package/dist/daemon/auth.js +128 -3
  51. package/dist/daemon/auth.js.map +1 -1
  52. package/dist/daemon/config.d.ts +44 -1
  53. package/dist/daemon/config.js +276 -9
  54. package/dist/daemon/config.js.map +1 -1
  55. package/dist/daemon/folderPicker.d.ts +27 -0
  56. package/dist/daemon/folderPicker.js +115 -0
  57. package/dist/daemon/folderPicker.js.map +1 -0
  58. package/dist/daemon/index.js +20 -19
  59. package/dist/daemon/index.js.map +1 -1
  60. package/dist/daemon/launchProfiles.d.ts +155 -0
  61. package/dist/daemon/launchProfiles.js +554 -0
  62. package/dist/daemon/launchProfiles.js.map +1 -0
  63. package/dist/daemon/liveness.d.ts +1 -1
  64. package/dist/daemon/liveness.js +2 -2
  65. package/dist/daemon/liveness.js.map +1 -1
  66. package/dist/daemon/paths.d.ts +4 -0
  67. package/dist/daemon/paths.js.map +1 -1
  68. package/dist/daemon/restartHold.d.ts +16 -0
  69. package/dist/daemon/restartHold.js +126 -0
  70. package/dist/daemon/restartHold.js.map +1 -0
  71. package/dist/daemon/screenshot.d.ts +58 -1
  72. package/dist/daemon/screenshot.js +172 -26
  73. package/dist/daemon/screenshot.js.map +1 -1
  74. package/dist/daemon/server.d.ts +220 -10
  75. package/dist/daemon/server.js +1975 -205
  76. package/dist/daemon/server.js.map +1 -1
  77. package/dist/daemon/sessionFeed.d.ts +48 -0
  78. package/dist/daemon/sessionFeed.js +101 -0
  79. package/dist/daemon/sessionFeed.js.map +1 -0
  80. package/dist/daemon/viewerLauncher.d.ts +100 -9
  81. package/dist/daemon/viewerLauncher.js +349 -67
  82. package/dist/daemon/viewerLauncher.js.map +1 -1
  83. package/dist/mcp/config.d.ts +7 -14
  84. package/dist/mcp/config.js +10 -21
  85. package/dist/mcp/config.js.map +1 -1
  86. package/dist/mcp/index.js +20 -11
  87. package/dist/mcp/index.js.map +1 -1
  88. package/dist/mcp/tools.d.ts +14 -7
  89. package/dist/mcp/tools.js +161 -60
  90. package/dist/mcp/tools.js.map +1 -1
  91. package/dist/viewer/dashboard-folders.js +20 -0
  92. package/dist/viewer/dashboard-layout.js +52 -0
  93. package/dist/viewer/dashboard.css +67 -0
  94. package/dist/viewer/dashboard.html +44 -0
  95. package/dist/viewer/dashboard.js +1523 -0
  96. package/dist/viewer/icon.ico +0 -0
  97. package/dist/viewer/index.html +12 -7
  98. package/dist/viewer/pane.js +736 -0
  99. package/dist/viewer/viewer.css +18 -7
  100. package/dist/viewer/viewer.js +47 -624
  101. package/package.json +13 -13
package/README.md CHANGED
@@ -29,8 +29,8 @@ ShellPuppet is the open-source terminal layer of **Intermeld**, the agent
29
29
  governance platform by [Red Eagle Tech](https://redeagle.tech). Everything in
30
30
  this repository runs on your machine and needs nothing we operate.
31
31
 
32
- > **Status: 0.1.0, the first release.** The daemon, CLI, MCP server and viewer
33
- > install from npm (below). Watch the repository's Releases for what comes
32
+ > **Status: 0.2.1, 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
34
  > next, and bring questions, ideas and what you build with it to
35
35
  > [Discussions](https://github.com/intermeld/shellpuppet/discussions). 🦅
36
36
 
@@ -47,8 +47,8 @@ this repository runs on your machine and needs nothing we operate.
47
47
  or take just the answer that ended the latest turn, and so keep another
48
48
  model's reasoning out of its own context. A screenshot shows the whole
49
49
  screen.
50
- - **A human in the same session.** When a session starts, a viewer window
51
- opens on your machine. You see what the agent sees, live, and you can type
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
52
  into it: to answer a prompt, to correct course or to take over. Your window
53
53
  sets the size: the terminal reshapes itself to fill it, as a terminal
54
54
  should. To watch from another device, or to let someone else watch, ask the
@@ -74,10 +74,15 @@ this repository runs on your machine and needs nothing we operate.
74
74
  Install, then wire it into your agent and ask it for something; or run the
75
75
  five commands under *Check the install from any shell*.
76
76
 
77
- You need Node.js 22 or later. `node-pty` ships prebuilt binaries for Windows
78
- and macOS, so no compiler is needed there. On Linux npm builds it with
79
- node-gyp, which needs Python 3, make and a C++ compiler (on Debian and Ubuntu:
80
- `sudo apt-get install -y python3 make g++`).
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++`).
81
86
 
82
87
  **Install:**
83
88
 
@@ -92,8 +97,10 @@ On Windows, npm installs `shellpuppet` as a PowerShell script as well as a
92
97
  window first, or run ShellPuppet from Command Prompt.
93
98
 
94
99
  npm 12 runs a dependency's install script only when you allow it. On Linux,
95
- node-pty's install script is what builds it. Without the flag the install
96
- still completes, but `shellpuppet start` then refuses and names the flag.
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.
97
104
 
98
105
  Recent npm 11 releases and npm 12 print a warning that node-pty has install
99
106
  scripts. On Windows and macOS ShellPuppet needs none of them, so there the
@@ -161,7 +168,7 @@ you can drive a session by hand:
161
168
 
162
169
  ```sh
163
170
  # 1. Start a Node REPL in a real PTY. The daemon starts itself, you get a
164
- # session id (s1) and a viewer window opens (or a link, if no window can).
171
+ # session id (s1) and the dashboard opens (or a viewer link, if no window can).
165
172
  # s1 is the first session on a fresh daemon: use whatever id start printed.
166
173
  shellpuppet start --label demo --no-shell node
167
174
 
@@ -182,15 +189,21 @@ Step 2 prints the REPL banner and prompt, step 3 says `typed 6 bytes (verified
182
189
  on screen).` and step 4 shows `42` under your input. That exercises daemon
183
190
  auto-start, the PTY, the renderer, waiting, input verification and tree-kill.
184
191
 
185
- **No window?** By default a session start opens the viewer in ShellPuppet's
186
- own chromeless browser window, falling back to your default browser. On a
187
- headless machine, or if you'd rather have a link, set `viewer.launchMode` to
188
- `"none"` in `~/.shellpuppet/config.json`: `start` then prints a viewer link,
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,
189
197
  and an agent is given one to pass to you. Whatever the setting, `shellpuppet
190
198
  viewer-url <id>` mints a fresh link whenever you want one, and `--read-only`
191
199
  makes it a link that can watch but never type. The options are in
192
200
  [`docs/reference/configuration.md`](docs/reference/configuration.md).
193
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
+
194
207
  **How long it takes.** On clean machines:
195
208
 
196
209
  - **Windows 11** (a fresh Windows Sandbox, Node 24): installing ShellPuppet with
@@ -209,22 +222,90 @@ Twelve tools appear once the server is wired in: `terminal_start`,
209
222
  `terminal_find`, `terminal_result`, `terminal_list`, `terminal_resize`,
210
223
  `terminal_screenshot`, `terminal_viewer_url` and `terminal_kill`.
211
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
+
212
276
  When the session runs another agent CLI, `terminal_result` returns the answer
213
277
  that ended its latest turn and nothing else, and `terminal_snapshot`,
214
- `terminal_find` and `terminal_wait` take `hideReasoning` to leave out the
215
- reasoning it draws. Each CLI's screen is read by a signature: Claude Code,
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,
216
282
  Codex, Qoder, OpenCode, MiMo Code, Grok and Antigravity are built in. A
217
283
  session started through a shell or a launcher script says which CLI it runs
218
- with `terminal_start`'s `agent`. A session with no signature is refused
219
- rather than shown unfiltered.
220
-
221
- `terminal_start` opens the viewer
222
- window for you and tells the agent so. It gives the agent a link only when no
223
- window could open, and `terminal_viewer_url` mints one whenever you ask: for a
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
224
305
  second device, a closed window or someone who should watch without typing.
225
306
  Links work once and for a few minutes. An agent CLI that needs a key held only in the
226
307
  client's environment gets the names you list for it in `agents.passEnv`, and any
227
- other program the names you list in `mcp.passEnv` and ask for at start
308
+ other program the names you list in config `envNames` and ask for at start
228
309
  (`docs/reference/configuration.md`). Sessions
229
310
  otherwise start with a clean environment, not the daemon's, so a key in the
230
311
  daemon's environment doesn't reach them. `terminal_screenshot` returns a PNG of the viewer as a
@@ -247,10 +328,86 @@ shellpuppet start [options] <command> [args...] # options BEFORE the command
247
328
  shellpuppet list | snap | type | key | wait | find | resize | kill
248
329
  shellpuppet screenshot <id> [--out <file>] # the viewer, as a browser draws it
249
330
  shellpuppet viewer-url <id> [--read-only] # a fresh single-use viewer link
250
- shellpuppet daemon status|start|stop|restart
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 # manage the shared daemon
336
+ shellpuppet daemon stop --hold [seconds] # pause automatic starts (default 120 s)
251
337
  shellpuppet mcp
252
338
  ```
253
339
 
340
+ ### Restarting a shared daemon
341
+
342
+ Build first, then run `shellpuppet daemon restart` so other clients wait for
343
+ the replacement, including while the old daemon is stopping. A peer can wait
344
+ about 20 seconds for a direct restart or about 130 seconds when the restart
345
+ uses `startWith`. A failed wrapped start may add up to 15 seconds for cleanup,
346
+ so the caller's worst case is its fixed deadline plus 15 seconds, up to about
347
+ 145 seconds for a wrapped restart. The wait has a fixed deadline, and clients can resume starting
348
+ if the process performing the restart has gone. To stop before rebuilding, run `shellpuppet daemon stop
349
+ --hold`, rebuild, then run `shellpuppet daemon start`. The hold lasts 120
350
+ seconds by default (1 to 600 seconds with an explicit value), and `daemon
351
+ status` shows the time remaining. If `daemon restart` cannot read the daemon
352
+ record, wait about 15 seconds and run `daemon restart` again. If the record
353
+ is still missing, the daemon is usually stopped. Check that no ShellPuppet
354
+ daemon process is running before `daemon start`.
355
+
356
+ On Windows, `start` uses `cmd.exe /d /s /c` by default. ShellPuppet joins the
357
+ command and arguments with spaces; `cmd.exe` then parses that line. A value
358
+ containing spaces needs quotes *inside the argument sent to ShellPuppet*. For
359
+ example, from Git Bash:
360
+
361
+ ```sh
362
+ shellpuppet start --agent codex node.exe codex-seat.js personal -c 'mcp_servers.x.command="C:/Program Files/nodejs/node.exe"'
363
+ ```
364
+
365
+ Git Bash removes the single quotes. ShellPuppet receives one argument with
366
+ double quotes around the path; `cmd.exe` and the program's argument parser
367
+ use those quotes to retain the space. Quoting only the whole value for Git
368
+ Bash, as in `'mcp_servers.x.command=C:/Program Files/nodejs/node.exe'`, does
369
+ not protect the space from `cmd.exe`. The shell also interprets `^`, `&`,
370
+ `|`, `<`, `>` and expands `%NAME%`, even inside double quotes. For literal
371
+ arguments to an `.exe` or `.com`, use `--no-shell`; the same choice is
372
+ `shell: false` in `terminal_start` and launch profiles. On other platforms,
373
+ starts run directly by default; an explicit `shell: true` uses `/bin/sh -c`
374
+ and its shell syntax.
375
+
376
+ `shellpuppet dashboard` opens a window with a pane for every session in ShellPuppet's
377
+ isolated browser profile and prints only whether a window opened. It never
378
+ prints the link, and it never uses your default browser: if the isolated
379
+ window cannot open, the command fails rather than hand the grant to a profile
380
+ with extensions.
381
+
382
+ To share sessions across screens, use **Open on screen** in the dashboard
383
+ toolbar, or open another dashboard window and move it yourself. Each session
384
+ appears in one window. Windows fill their readable grid capacity in order;
385
+ when every window is full, extra sessions are shared according to each
386
+ window's capacity. The toolbar shows the number of sessions in this window
387
+ and the number of sharing windows. The screen buttons follow windows moved
388
+ between screens. Closing a window returns its sessions to the others. Auto fit
389
+ refits a session in the window that receives it.
390
+
391
+ In Focus, drag the boundary between the large pane and its strip. In Grid,
392
+ drag a boundary between columns or rows. Focus a boundary and use the arrow
393
+ keys for small steps, Shift with an arrow for larger steps, or Home to reset
394
+ that direction. A drag stops at the readable pane size, or at the strip's
395
+ minimum width. On release, a pane that grew fits its real terminal, respecting
396
+ Auto fit's rules when it is on; one that shrank keeps its grid and scales or
397
+ scrolls. With Auto fit off, release keeps the real terminal size until Fit is
398
+ pressed. The boundary announces its position in pixels. Sizes stay
399
+ in this window for the session and survive a reload. Choose Auto or Grid
400
+ again to reset them.
401
+
402
+ Double-click a pane's title bar to Enlarge or Restore it. Escape restores an
403
+ enlarged pane in navigation mode or when focus is outside the terminal;
404
+ inside the terminal, Escape goes to the program. Double-clicking inside the
405
+ terminal still selects text.
406
+ In dashboard panes, on Windows and Linux, Ctrl+V pastes; to send a literal
407
+ Ctrl+V to the program, there is no in-pane shortcut. Ctrl+C copies selected
408
+ terminal text, and sends `^C` when nothing is selected. On macOS, Cmd+V
409
+ pastes and Ctrl+V still sends `^V`.
410
+
254
411
  `shellpuppet --help` documents every flag. Exit codes: 0 ok · 1 the operation
255
412
  failed, such as typing into a session that has exited · 2 the request itself
256
413
  was wrong, whether the CLI caught it or the daemon refused it with a 400, such
@@ -261,11 +418,31 @@ line `No matches.` on stderr, never the pattern, as the MCP tool does. With
261
418
  `--json` it prints the response, an empty `matches` list included, and still
262
419
  exits 3 when nothing matched.
263
420
 
421
+ ### Start ShellPuppet from the Start menu
422
+
423
+ On Windows, run `shellpuppet desktop --install` once. The per-user ShellPuppet
424
+ shortcut starts the daemon using your configured [`daemon.startWith`](docs/reference/configuration.md#daemon-start-wrapper)
425
+ when needed, then opens the dashboard. Pin the shortcut to Start or the taskbar
426
+ to start ShellPuppet with one click. You can pin the dashboard window to keep
427
+ its place, but use the shortcut to start ShellPuppet. A second click while a
428
+ dashboard page is connected reports that ShellPuppet is already open. The
429
+ shortcut starts minimised, so the console should only blink. Its target is
430
+ Node and the installed package's `dist/cli/index.js` at the package's stable
431
+ global location, which an npm update replaces in place. Run `--install` again
432
+ if you move the package to a different prefix or move or replace Node at a
433
+ different path. `--uninstall` removes only ShellPuppet's shortcut.
434
+
435
+ On Linux, `--install` writes a per-user `shellpuppet.desktop` application
436
+ launcher. On macOS, shortcut installation is not available yet. You can run
437
+ `shellpuppet desktop` from a terminal on any platform. `shellpuppet dashboard`
438
+ still opens a new isolated window on every call.
439
+
264
440
  ## How it works
265
441
 
266
442
  One per-user **daemon** owns every PTY and serves the browser viewer, on
267
443
  loopback only, with a token on every request bar `/health`, the viewer page
268
- and its static assets. The MCP server and the CLI start the daemon if it isn't
444
+ and its static assets. `/health` reveals only ok, version, pid and the daemon
445
+ instance id. The MCP server and the CLI start the daemon if it isn't
269
446
  running. Every CLI verb is a one-shot HTTP client that returns promptly,
270
447
  except `mcp`, which stays up for the stdio transport, and `wait`, which blocks
271
448
  until its condition holds or its timeout runs out (300 s at most). Because
@@ -280,16 +457,16 @@ follows it.
280
457
 
281
458
  ## Day one
282
459
 
283
- ShellPuppet 0.1.0 is the first release. Here is what to expect from it, as of
284
- October 2026. The [roadmap](ROADMAP.md) says what comes next, and your ideas
460
+ ShellPuppet 0.2.0 adds the dashboard. Here is what to expect from it, as of
461
+ November 2026. The [roadmap](ROADMAP.md) says what comes next, and your ideas
285
462
  shape it: tell us what you'd like, and where it trips you up, in
286
463
  [Discussions](https://github.com/intermeld/shellpuppet/discussions), and
287
464
  report bugs in the [issues](https://github.com/intermeld/shellpuppet/issues).
288
465
 
289
- - **One window per session, for now.** Each session opens its own viewer
290
- window, and the windows don't arrange or size themselves yet. A dashboard
291
- that holds every session as a pane, across more than one screen, is what
292
- we're building now.
466
+ - **The dashboard is new.** It holds every session as a pane, across more
467
+ than one screen, and fits the panes to the window. Its layout has been
468
+ driven hard on Windows with real agent CLIs; tell us where it lets you
469
+ down on your screens.
293
470
  - **Prompt detection is pattern-based.** It recognises the numbered,
294
471
  pointer-only and letter-keyed choosers and the confirmation prompts real
295
472
  agent CLIs draw, and the select, multi-select and confirm steps of
@@ -323,7 +500,7 @@ report bugs in the [issues](https://github.com/intermeld/shellpuppet/issues).
323
500
  | [`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. |
324
501
  | [`docs/reference/configuration.md`](docs/reference/configuration.md) | Every `config.json` option: command policy, environment hygiene, audit, viewer launch. |
325
502
  | [`docs/reference/agent-profiles.md`](docs/reference/agent-profiles.md) | Measured agent-CLI behaviour, ready-text regexes, timeout budgets, recipes. |
326
- | [`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). |
503
+ | [`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). |
327
504
  | [SECURITY.md](SECURITY.md) · [SUPPORT.md](SUPPORT.md) · [CONTRIBUTING.md](CONTRIBUTING.md) | Reporting a vulnerability · getting help · building, testing and sending changes. |
328
505
 
329
506
  ## Contributing
@@ -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 {};
@@ -0,0 +1,157 @@
1
+ /** Per-user launchers written without a shell or script host. */
2
+ import * as fs from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ const LINK_CLSID = Buffer.from('0114020000000000c000000000000046', 'hex');
7
+ const FLAGS = 0x01 | 0x02 | 0x04 | 0x10 | 0x20 | 0x40 | 0x80;
8
+ const ansi = (value) => Buffer.from(`${value}\0`, 'latin1');
9
+ const wide = (value) => Buffer.from(`${value}\0`, 'utf16le');
10
+ function stringData(value) {
11
+ const body = Buffer.from(value, 'utf16le');
12
+ if (body.length / 2 > 0xffff)
13
+ throw new Error('Shortcut text is too long.');
14
+ const size = Buffer.alloc(2);
15
+ size.writeUInt16LE(body.length / 2);
16
+ return Buffer.concat([size, body]);
17
+ }
18
+ function fileItem(name, directory) {
19
+ const label = wide(name);
20
+ const size = 14 + label.length + 2;
21
+ const item = Buffer.alloc(size);
22
+ item.writeUInt16LE(size, 0);
23
+ item[2] = directory ? 0x35 : 0x34;
24
+ item.writeUInt16LE(directory ? 0x10 : 0x20, 12);
25
+ label.copy(item, 14);
26
+ return item;
27
+ }
28
+ function targetIdList(target) {
29
+ if (!/^[A-Za-z]:\\/.test(target)) {
30
+ throw new Error('A ShellPuppet shortcut needs Node on a local drive letter; start ShellPuppet with shellpuppet desktop instead.');
31
+ }
32
+ const root = Buffer.from('14001f50e04fd020ea3a6910a2d808002b30309d', 'hex');
33
+ const volume = Buffer.alloc(0x19);
34
+ volume.writeUInt16LE(volume.length);
35
+ volume[2] = 0x2f;
36
+ ansi(path.win32.parse(target).root).copy(volume, 3);
37
+ const parts = target.slice(path.win32.parse(target).root.length).split('\\');
38
+ const entries = parts.map((name, index) => fileItem(name, index < parts.length - 1));
39
+ const body = Buffer.concat([root, volume, ...entries, Buffer.alloc(2)]);
40
+ if (body.length > 0xffff)
41
+ throw new Error('The path to Node is too long for a Windows shortcut.');
42
+ const size = Buffer.alloc(2);
43
+ size.writeUInt16LE(body.length);
44
+ return Buffer.concat([size, body]);
45
+ }
46
+ /** MS-SHLLINK: header, target ID list, local LinkInfo, Unicode StringData and terminal block. */
47
+ export function shellLink(fields) {
48
+ if (!path.win32.isAbsolute(fields.target))
49
+ throw new Error('The shortcut target must be absolute.');
50
+ const header = Buffer.alloc(0x4c);
51
+ header.writeUInt32LE(0x4c, 0);
52
+ LINK_CLSID.copy(header, 4);
53
+ header.writeUInt32LE(FLAGS, 0x14);
54
+ header.writeUInt32LE(0x20, 0x18);
55
+ header.writeUInt32LE(fields.showCommand, 0x3c);
56
+ const volumeLabel = ansi('');
57
+ const volume = Buffer.alloc(0x10);
58
+ volume.writeUInt32LE(volume.length + volumeLabel.length, 0);
59
+ volume.writeUInt32LE(3, 4);
60
+ try {
61
+ volume.writeUInt32LE(Number(fs.statSync(path.win32.parse(fields.target).root, { bigint: true }).dev & 0xffffffffn), 8);
62
+ }
63
+ catch { /* Made-up targets in byte tests have no volume. */ }
64
+ volume.writeUInt32LE(0x10, 12);
65
+ const volumeData = Buffer.concat([volume, volumeLabel]);
66
+ const base = ansi(fields.target);
67
+ const suffix = ansi('');
68
+ const baseWide = wide(fields.target);
69
+ const suffixWide = wide('');
70
+ const info = Buffer.alloc(0x24);
71
+ info.writeUInt32LE(info.length + volumeData.length + base.length + suffix.length + baseWide.length + suffixWide.length, 0);
72
+ info.writeUInt32LE(0x24, 4);
73
+ info.writeUInt32LE(1, 8);
74
+ info.writeUInt32LE(0x24, 12);
75
+ info.writeUInt32LE(0x24 + volumeData.length, 16);
76
+ info.writeUInt32LE(0x24 + volumeData.length + base.length, 24);
77
+ info.writeUInt32LE(0x24 + volumeData.length + base.length + suffix.length, 28);
78
+ info.writeUInt32LE(0x24 + volumeData.length + base.length + suffix.length + baseWide.length, 32);
79
+ return Buffer.concat([header, targetIdList(fields.target), info, volumeData, base, suffix, baseWide, suffixWide,
80
+ stringData(fields.description), stringData(fields.workingDirectory),
81
+ stringData(fields.arguments), stringData(fields.icon), Buffer.alloc(4)]);
82
+ }
83
+ /** Read the fields back for format regression tests. */
84
+ export function parseShellLink(bytes) {
85
+ if (bytes.readUInt32LE(0) !== 0x4c || !bytes.subarray(4, 20).equals(LINK_CLSID))
86
+ throw new Error('Not a Shell Link.');
87
+ const linkInfo = 0x4c + 2 + bytes.readUInt16LE(0x4c);
88
+ const baseOffset = bytes.readUInt32LE(linkInfo + 28);
89
+ const start = linkInfo + baseOffset;
90
+ let end = start;
91
+ while (end + 1 < bytes.length && bytes.readUInt16LE(end) !== 0)
92
+ end += 2;
93
+ const target = bytes.subarray(start, end).toString('utf16le');
94
+ let cursor = linkInfo + bytes.readUInt32LE(linkInfo);
95
+ const read = () => {
96
+ const length = bytes.readUInt16LE(cursor);
97
+ cursor += 2;
98
+ const value = bytes.subarray(cursor, cursor + length * 2).toString('utf16le');
99
+ cursor += length * 2;
100
+ return value;
101
+ };
102
+ return { target, description: read(), workingDirectory: read(), arguments: read(), icon: read(), showCommand: bytes.readUInt32LE(0x3c) };
103
+ }
104
+ function desktopQuote(value) {
105
+ const escape = '\\';
106
+ return `"${value.replaceAll(escape, escape.repeat(4)).replaceAll('"', escape.repeat(2) + '"').replaceAll('$', escape.repeat(2) + '$').replaceAll('`', escape.repeat(2) + '`').replaceAll('\n', '\\n').replaceAll('\t', '\\t').replaceAll('\r', '\\r')}"`;
107
+ }
108
+ function desktopString(value) {
109
+ // Leading and trailing spaces are kept with the specification's \s escape.
110
+ return value.replaceAll('\\', '\\\\').replaceAll('\n', '\\n').replaceAll('\t', '\\t').replaceAll('\r', '\\r')
111
+ .replace(/^ /, '\\s').replace(/ $/, '\\s');
112
+ }
113
+ export function desktopEntry(fields) {
114
+ const target = /[\s"'\\><~|&;$*?#()`]/.test(fields.target) ? desktopQuote(fields.target) : fields.target;
115
+ const exec = `${target} ${fields.arguments}`.replaceAll('%', '%%').replaceAll('\n', '\\n').replaceAll('\t', '\\t').replaceAll('\r', '\\r');
116
+ return `[Desktop Entry]\nType=Application\nName=${desktopString('ShellPuppet')}\nComment=${desktopString(fields.description)}\nExec=${exec}\nPath=${desktopString(fields.workingDirectory)}\nIcon=${desktopString(fields.icon)}\nTerminal=false\nCategories=Utility;\n`;
117
+ }
118
+ export function installDesktopShortcut(options) {
119
+ if (options.platform === 'darwin')
120
+ return 'A shortcut is not available yet on macOS.';
121
+ if (options.fields === undefined)
122
+ throw new Error('Shortcut fields are required.');
123
+ fs.mkdirSync(options.applicationsDir, { recursive: true });
124
+ const name = options.platform === 'win32' ? 'ShellPuppet.lnk' : 'shellpuppet.desktop';
125
+ const destination = path.join(options.applicationsDir, name);
126
+ const temporary = path.join(options.applicationsDir, `.${name}.${String(process.pid)}.tmp`);
127
+ try {
128
+ fs.writeFileSync(temporary, options.platform === 'win32' ? shellLink(options.fields) : desktopEntry(options.fields));
129
+ fs.renameSync(temporary, destination);
130
+ }
131
+ finally {
132
+ if (fs.existsSync(temporary))
133
+ fs.unlinkSync(temporary);
134
+ }
135
+ return `ShellPuppet shortcut installed: ${destination}`;
136
+ }
137
+ export function uninstallDesktopShortcut(options) {
138
+ if (options.platform === 'darwin')
139
+ return 'A shortcut is not available yet on macOS.';
140
+ const name = options.platform === 'win32' ? 'ShellPuppet.lnk' : 'shellpuppet.desktop';
141
+ fs.rmSync(path.join(options.applicationsDir, name), { force: true });
142
+ return 'ShellPuppet shortcut removed.';
143
+ }
144
+ export function userShortcutOptions(platform = process.platform) {
145
+ const entry = fileURLToPath(new URL('./index.js', import.meta.url));
146
+ const viewer = fileURLToPath(new URL('../viewer/', import.meta.url));
147
+ const applicationsDir = platform === 'win32'
148
+ ? path.join(process.env['APPDATA'] ?? path.join(os.homedir(), 'AppData', 'Roaming'), 'Microsoft', 'Windows', 'Start Menu', 'Programs')
149
+ : path.join(process.env['XDG_DATA_HOME'] ?? path.join(os.homedir(), '.local', 'share'), 'applications');
150
+ return { platform, applicationsDir, fields: {
151
+ target: process.execPath, arguments: `${platform === 'win32' ? `"${entry}"` : desktopQuote(entry)} desktop`,
152
+ workingDirectory: os.homedir(),
153
+ icon: path.join(viewer, platform === 'win32' ? 'icon.ico' : 'icon-512.png'),
154
+ description: 'Start ShellPuppet', showCommand: 7,
155
+ } };
156
+ }
157
+ //# sourceMappingURL=desktopShortcut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desktopShortcut.js","sourceRoot":"","sources":["../../src/cli/desktopShortcut.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAiBzC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AAC1E,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7D,MAAM,IAAI,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC5E,MA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