shellpuppet 0.0.1 → 0.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 (112) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +340 -8
  4. package/dist/cli/index.d.ts +13 -0
  5. package/dist/cli/index.js +693 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/client/http.d.ts +82 -0
  8. package/dist/client/http.js +225 -0
  9. package/dist/client/http.js.map +1 -0
  10. package/dist/core/dialogs.d.ts +88 -0
  11. package/dist/core/dialogs.js +214 -0
  12. package/dist/core/dialogs.js.map +1 -0
  13. package/dist/core/echo.d.ts +71 -0
  14. package/dist/core/echo.js +249 -0
  15. package/dist/core/echo.js.map +1 -0
  16. package/dist/core/find.d.ts +34 -0
  17. package/dist/core/find.js +41 -0
  18. package/dist/core/find.js.map +1 -0
  19. package/dist/core/keys.d.ts +22 -0
  20. package/dist/core/keys.js +80 -0
  21. package/dist/core/keys.js.map +1 -0
  22. package/dist/core/manager.d.ts +66 -0
  23. package/dist/core/manager.js +158 -0
  24. package/dist/core/manager.js.map +1 -0
  25. package/dist/core/nativePty.d.ts +69 -0
  26. package/dist/core/nativePty.js +156 -0
  27. package/dist/core/nativePty.js.map +1 -0
  28. package/dist/core/policy.d.ts +61 -0
  29. package/dist/core/policy.js +143 -0
  30. package/dist/core/policy.js.map +1 -0
  31. package/dist/core/promptDetector.d.ts +75 -0
  32. package/dist/core/promptDetector.js +606 -0
  33. package/dist/core/promptDetector.js.map +1 -0
  34. package/dist/core/reasoning.d.ts +252 -0
  35. package/dist/core/reasoning.js +740 -0
  36. package/dist/core/reasoning.js.map +1 -0
  37. package/dist/core/regexBudget.d.ts +44 -0
  38. package/dist/core/regexBudget.js +79 -0
  39. package/dist/core/regexBudget.js.map +1 -0
  40. package/dist/core/renderer.d.ts +112 -0
  41. package/dist/core/renderer.js +225 -0
  42. package/dist/core/renderer.js.map +1 -0
  43. package/dist/core/session.d.ts +311 -0
  44. package/dist/core/session.js +966 -0
  45. package/dist/core/session.js.map +1 -0
  46. package/dist/core/types.d.ts +281 -0
  47. package/dist/core/types.js +47 -0
  48. package/dist/core/types.js.map +1 -0
  49. package/dist/core/waiter.d.ts +86 -0
  50. package/dist/core/waiter.js +317 -0
  51. package/dist/core/waiter.js.map +1 -0
  52. package/dist/core/windowsPtyStart.d.ts +90 -0
  53. package/dist/core/windowsPtyStart.js +129 -0
  54. package/dist/core/windowsPtyStart.js.map +1 -0
  55. package/dist/daemon/audit.d.ts +23 -0
  56. package/dist/daemon/audit.js +51 -0
  57. package/dist/daemon/audit.js.map +1 -0
  58. package/dist/daemon/auth.d.ts +127 -0
  59. package/dist/daemon/auth.js +241 -0
  60. package/dist/daemon/auth.js.map +1 -0
  61. package/dist/daemon/config.d.ts +76 -0
  62. package/dist/daemon/config.js +301 -0
  63. package/dist/daemon/config.js.map +1 -0
  64. package/dist/daemon/index.d.ts +7 -0
  65. package/dist/daemon/index.js +87 -0
  66. package/dist/daemon/index.js.map +1 -0
  67. package/dist/daemon/liveness.d.ts +36 -0
  68. package/dist/daemon/liveness.js +71 -0
  69. package/dist/daemon/liveness.js.map +1 -0
  70. package/dist/daemon/logger.d.ts +7 -0
  71. package/dist/daemon/logger.js +29 -0
  72. package/dist/daemon/logger.js.map +1 -0
  73. package/dist/daemon/meta.d.ts +9 -0
  74. package/dist/daemon/meta.js +24 -0
  75. package/dist/daemon/meta.js.map +1 -0
  76. package/dist/daemon/paths.d.ts +83 -0
  77. package/dist/daemon/paths.js +154 -0
  78. package/dist/daemon/paths.js.map +1 -0
  79. package/dist/daemon/screenshot.d.ts +87 -0
  80. package/dist/daemon/screenshot.js +256 -0
  81. package/dist/daemon/screenshot.js.map +1 -0
  82. package/dist/daemon/server.d.ts +244 -0
  83. package/dist/daemon/server.js +2187 -0
  84. package/dist/daemon/server.js.map +1 -0
  85. package/dist/daemon/terminalReports.d.ts +38 -0
  86. package/dist/daemon/terminalReports.js +84 -0
  87. package/dist/daemon/terminalReports.js.map +1 -0
  88. package/dist/daemon/viewerLauncher.d.ts +135 -0
  89. package/dist/daemon/viewerLauncher.js +280 -0
  90. package/dist/daemon/viewerLauncher.js.map +1 -0
  91. package/dist/daemon/viewerSync.d.ts +38 -0
  92. package/dist/daemon/viewerSync.js +83 -0
  93. package/dist/daemon/viewerSync.js.map +1 -0
  94. package/dist/mcp/config.d.ts +57 -0
  95. package/dist/mcp/config.js +106 -0
  96. package/dist/mcp/config.js.map +1 -0
  97. package/dist/mcp/index.d.ts +10 -0
  98. package/dist/mcp/index.js +69 -0
  99. package/dist/mcp/index.js.map +1 -0
  100. package/dist/mcp/tools.d.ts +59 -0
  101. package/dist/mcp/tools.js +537 -0
  102. package/dist/mcp/tools.js.map +1 -0
  103. package/dist/viewer/icon-16.png +0 -0
  104. package/dist/viewer/icon-180.png +0 -0
  105. package/dist/viewer/icon-32.png +0 -0
  106. package/dist/viewer/icon-512.png +0 -0
  107. package/dist/viewer/icon.svg +66 -0
  108. package/dist/viewer/index.html +56 -0
  109. package/dist/viewer/viewer.css +84 -0
  110. package/dist/viewer/viewer.js +661 -0
  111. package/package.json +66 -7
  112. package/index.js +0 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,31 @@
1
+ ShellPuppet
2
+ Copyright 2026 Red Eagle Tech Ltd
3
+
4
+ This product includes software developed by third parties, listed below with
5
+ the attribution their licences require (ADR-002). Only dependencies whose
6
+ licence asks for a notice appear here; the full set, with versions, is in
7
+ package.json and package-lock.json.
8
+
9
+ ------------------------------------------------------------------------------
10
+ chrome-launcher (https://github.com/GoogleChrome/chrome-launcher)
11
+ Licensed under the Apache License, Version 2.0.
12
+
13
+ Copyright 2014 Google Inc.
14
+
15
+ ------------------------------------------------------------------------------
16
+ lighthouse-logger (https://github.com/GoogleChrome/lighthouse), a dependency of
17
+ chrome-launcher.
18
+ Licensed under the Apache License, Version 2.0.
19
+
20
+ Copyright 2014 Google Inc.
21
+
22
+ ------------------------------------------------------------------------------
23
+ marky (https://github.com/nolanlawson/marky), a dependency of
24
+ lighthouse-logger.
25
+ Licensed under the Apache License, Version 2.0.
26
+
27
+ Copyright 2016 Nolan Lawson
28
+
29
+ ------------------------------------------------------------------------------
30
+ A copy of the Apache License, Version 2.0 is in LICENSE, and at
31
+ http://www.apache.org/licenses/LICENSE-2.0
package/README.md CHANGED
@@ -1,12 +1,344 @@
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.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
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 a session starts, a viewer window
51
+ opens on your machine. 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. `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++`).
81
+
82
+ **Install:**
83
+
84
+ ```sh
85
+ npm install -g shellpuppet # Windows and macOS
86
+ npm install -g --allow-scripts=node-pty shellpuppet # Linux
87
+ ```
88
+
89
+ On Windows, npm installs `shellpuppet` as a PowerShell script as well as a
90
+ `.cmd`, and PowerShell's default execution policy refuses the script. Run
91
+ `Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned` in that
92
+ window first, or run ShellPuppet from Command Prompt.
93
+
94
+ 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.
97
+
98
+ Recent npm 11 releases and npm 12 print a warning that node-pty has install
99
+ scripts. On Windows and macOS ShellPuppet needs none of them, so there the
100
+ warning is safe to ignore. npm 10 ignores the flag, and early npm 11 releases
101
+ warn that it is an unknown option; both run the install scripts anyway.
102
+
103
+ On macOS, ShellPuppet makes node-pty's `spawn-helper` executable itself on
104
+ the first start. If you installed with `sudo`, it can't, and that first start
105
+ tells you the `sudo chmod +x` to run once.
106
+
107
+ **From source** (the same thing, plus a build):
108
+
109
+ ```sh
110
+ git clone https://github.com/intermeld/shellpuppet.git
111
+ cd shellpuppet
112
+ npm ci
113
+ npm run build
114
+ npm link # puts `shellpuppet` on your PATH; or use `node dist/cli/index.js`
115
+ ```
116
+
117
+ On Windows the shim `npm link` makes meets the same execution policy; set it
118
+ as above, or use the `node dist/cli/index.js` form instead.
119
+
120
+ **Wire it into your agent.** ShellPuppet is an MCP server. With `shellpuppet`
121
+ on your PATH, Claude Code is one command:
122
+
123
+ ```sh
124
+ claude mcp add shellpuppet -- shellpuppet mcp
125
+ ```
126
+
127
+ For any other MCP client, the equivalent entry:
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "shellpuppet": { "command": "shellpuppet", "args": ["mcp"] }
133
+ }
134
+ }
135
+ ```
136
+
137
+ That shape works for Claude Code, Cursor, Gemini CLI and the desktop apps.
138
+ Codex reads `~/.codex/config.toml` instead:
139
+
140
+ ```toml
141
+ [mcp_servers.shellpuppet]
142
+ command = "shellpuppet"
143
+ args = ["mcp"]
144
+ ```
145
+
146
+ Without `npm link`, use `node` with the absolute path to `dist/cli/index.js`
147
+ and the argument `mcp`.
148
+
149
+ **Then ask your agent for something.** Tell it to run a program in a
150
+ ShellPuppet session. A window opens on your screen as the session starts: you
151
+ watch, and when the program asks a question, you click into the window and
152
+ answer it. A good first ask: *"Run `npm create vite@latest` in a ShellPuppet
153
+ session, in an empty folder, and let me choose the options."* npm first asks
154
+ whether to install the wizard: answer y, and the wizard's menus appear in the
155
+ window as they come, each one flagged for you; pick with the arrow keys and
156
+ Enter. In the recording at the top, four agents do this at once, and the
157
+ person answers Codex's permission prompt in its window.
158
+
159
+ **Check the install from any shell.** The CLI has a verb for every tool, so
160
+ you can drive a session by hand:
161
+
162
+ ```sh
163
+ # 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).
165
+ # s1 is the first session on a fresh daemon: use whatever id start printed.
166
+ shellpuppet start --label demo --no-shell node
167
+
168
+ # 2. Wait for the REPL to paint and settle, instead of guessing at a sleep.
169
+ shellpuppet wait s1 --quiet 1000
170
+
171
+ # 3. Type as an agent would, and confirm the keystrokes landed.
172
+ shellpuppet type s1 '6 * 7' --enter --verify
173
+
174
+ # 4. Read the screen back as plain text.
175
+ shellpuppet snap s1
176
+
177
+ # 5. Kill the session: the whole process tree, not just the PTY child.
178
+ shellpuppet kill s1
179
+ ```
180
+
181
+ Step 2 prints the REPL banner and prompt, step 3 says `typed 6 bytes (verified
182
+ on screen).` and step 4 shows `42` under your input. That exercises daemon
183
+ auto-start, the PTY, the renderer, waiting, input verification and tree-kill.
184
+
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,
189
+ and an agent is given one to pass to you. Whatever the setting, `shellpuppet
190
+ viewer-url <id>` mints a fresh link whenever you want one, and `--read-only`
191
+ makes it a link that can watch but never type. The options are in
192
+ [`docs/reference/configuration.md`](docs/reference/configuration.md).
193
+
194
+ **How long it takes.** On clean machines:
195
+
196
+ - **Windows 11** (a fresh Windows Sandbox, Node 24): installing ShellPuppet with
197
+ npm took 22 to 26 s from a cold npm cache, and the five steps above 3.6 s end
198
+ to end.
199
+ - **Linux** (a clean container, Node 22): the install took 29 s, including
200
+ npm building node-pty, and the five steps about 2 s.
201
+
202
+ The first viewer window on a fresh machine takes longer, about 13 s in that
203
+ sandbox, because the browser is starting for the first time.
204
+
205
+ ## Working with an agent
206
+
207
+ Twelve tools appear once the server is wired in: `terminal_start`,
208
+ `terminal_snapshot`, `terminal_type`, `terminal_key`, `terminal_wait`,
209
+ `terminal_find`, `terminal_result`, `terminal_list`, `terminal_resize`,
210
+ `terminal_screenshot`, `terminal_viewer_url` and `terminal_kill`.
211
+
212
+ When the session runs another agent CLI, `terminal_result` returns the answer
213
+ 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,
216
+ Codex, Qoder, OpenCode, MiMo Code, Grok and Antigravity are built in. A
217
+ 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
224
+ second device, a closed window or someone who should watch without typing.
225
+ Links work once and for a few minutes. An agent CLI that needs a key held only in the
226
+ 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
228
+ (`docs/reference/configuration.md`). Sessions
229
+ otherwise start with a clean environment, not the daemon's, so a key in the
230
+ daemon's environment doesn't reach them. `terminal_screenshot` returns a PNG of the viewer as a
231
+ browser draws it. Use it to illustrate documentation with real screens, and to
232
+ check what is *actually* on screen when the text looks right and something
233
+ still seems wrong. A capture has 45 s to start a browser, draw the page and
234
+ take the picture; `shellpuppet screenshot --timeout <ms>` moves that budget
235
+ for a machine that is slower or in more of a hurry.
236
+
237
+ The tool descriptions carry the lessons that cost real time to learn: first
238
+ paint is not readiness; a wait for text you just typed matches your own echo;
239
+ `escape` resets a TUI that has stopped listening. The measured behaviour of
240
+ each agent CLI, with ready-text regexes and timeout budgets, is in
241
+ [`docs/reference/agent-profiles.md`](docs/reference/agent-profiles.md).
242
+
243
+ ## The CLI
244
+
245
+ ```
246
+ shellpuppet start [options] <command> [args...] # options BEFORE the command
247
+ shellpuppet list | snap | type | key | wait | find | resize | kill
248
+ shellpuppet screenshot <id> [--out <file>] # the viewer, as a browser draws it
249
+ shellpuppet viewer-url <id> [--read-only] # a fresh single-use viewer link
250
+ shellpuppet daemon status|start|stop|restart
251
+ shellpuppet mcp
252
+ ```
253
+
254
+ `shellpuppet --help` documents every flag. Exit codes: 0 ok · 1 the operation
255
+ failed, such as typing into a session that has exited · 2 the request itself
256
+ was wrong, whether the CLI caught it or the daemon refused it with a 400, such
257
+ as an invalid `--regex` · 3 wait did not match, or find found nothing, so
258
+ scripts can branch on either. `find` prints each matching line as
259
+ `<row>: <text>` and nothing else on stdout; with no match it prints the fixed
260
+ line `No matches.` on stderr, never the pattern, as the MCP tool does. With
261
+ `--json` it prints the response, an empty `matches` list included, and still
262
+ exits 3 when nothing matched.
263
+
264
+ ## How it works
265
+
266
+ One per-user **daemon** owns every PTY and serves the browser viewer, on
267
+ 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
269
+ running. Every CLI verb is a one-shot HTTP client that returns promptly,
270
+ except `mcp`, which stays up for the stdio transport, and `wait`, which blocks
271
+ until its condition holds or its timeout runs out (300 s at most). Because
272
+ every client talks to the one daemon, two agents' MCP servers share one set of
273
+ sessions, and so does the human at the viewer. That is the point: sessions are
274
+ shared or they are nothing.
275
+
276
+ The build specification is
277
+ [`docs/architecture/design.md`](docs/architecture/design.md). It is
278
+ self-contained. It records what was considered and rejected, and the code
279
+ follows it.
280
+
281
+ ## Day one
282
+
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
285
+ shape it: tell us what you'd like, and where it trips you up, in
286
+ [Discussions](https://github.com/intermeld/shellpuppet/discussions), and
287
+ report bugs in the [issues](https://github.com/intermeld/shellpuppet/issues).
288
+
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.
293
+ - **Prompt detection is pattern-based.** It recognises the numbered,
294
+ pointer-only and letter-keyed choosers and the confirmation prompts real
295
+ agent CLIs draw, and the select, multi-select and confirm steps of
296
+ scaffolding wizards built on `@clack/prompts`, each pinned by a fixture from
297
+ a real screen. A shape it has not seen it will miss, and output that
298
+ imitates one can fool it. If it misses a real prompt you meet, tell us, or
299
+ better still, send a pull request with the fix.
300
+ - **Readiness is heuristic.** "First paint is not readiness" is in the tools
301
+ themselves, and quiet-based waits need a first paint before silence counts;
302
+ but a program can paint and still discard input while it finishes loading.
303
+ Wait for its own ready text.
304
+ - **Killing can take seconds on Windows.** A Windows `kill` waits for
305
+ `taskkill` to end the whole process tree. On the clean Windows 11 machine
306
+ behind the install timings above it took under a second; on a busy
307
+ development workstation it took up to about nine seconds.
308
+ - **Your MCP client may have a shorter patience than the daemon.** Waits go
309
+ up to 300 s, but some clients background a tool call after two minutes.
310
+ Keep long waits under your client's limit and poll.
311
+ - **Linux and macOS testers wanted.** Windows has had the most real-world
312
+ driving so far. Linux and macOS run the full test suite on every change,
313
+ and we'd welcome people who drive agents on them to try ShellPuppet and
314
+ tell us how it goes.
315
+
316
+ ## Documentation
317
+
318
+ | Read | For |
319
+ |---|---|
320
+ | [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.** |
321
+ | [ROADMAP.md](ROADMAP.md) | What is being worked on now, what comes next and what is further off, without dates. |
322
+ | [`docs/architecture/design.md`](docs/architecture/design.md) | The build specification. |
323
+ | [`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
+ | [`docs/reference/configuration.md`](docs/reference/configuration.md) | Every `config.json` option: command policy, environment hygiene, audit, viewer launch. |
325
+ | [`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). |
327
+ | [SECURITY.md](SECURITY.md) · [SUPPORT.md](SUPPORT.md) · [CONTRIBUTING.md](CONTRIBUTING.md) | Reporting a vulnerability · getting help · building, testing and sending changes. |
328
+
329
+ ## Contributing
330
+
331
+ Contributions are accepted under the Developer Certificate of Origin: sign off
332
+ each commit (`git commit -s`), and there's no contributor licence agreement,
333
+ ever ([ADR-004](docs/decisions/ADR-004-contribution-policy.md)). The sign-off
334
+ check runs on every pull request. Bug reports are welcome in the issues, and
335
+ questions, ideas and any other feedback in
336
+ [Discussions](https://github.com/intermeld/shellpuppet/discussions);
337
+ [SUPPORT.md](SUPPORT.md) says where everything goes.
338
+
339
+ ## Licence
340
+
341
+ [Apache-2.0](LICENSE). See also [NOTICE](NOTICE). Code released under
342
+ Apache-2.0 stays Apache-2.0; the pledge is in
343
+ [VISION.md](VISION.md#licensing-and-contributions). The names are trademarks:
344
+ see [TRADEMARKS.md](TRADEMARKS.md).
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ShellPuppet CLI: a thin, one-shot client over the daemon HTTP API
4
+ * (design §2.4). Every invocation makes its request(s), prints and EXITS:
5
+ * it never spawns anything it stays attached to. That one property is why the
6
+ * CLI can never hang a calling shell (the inherited-stdio hang, §2.2).
7
+ *
8
+ * stdout carries results; warnings and errors go to stderr. Exit codes:
9
+ * 0 success · 1 the operation failed · 2 the request itself was wrong, whether
10
+ * this CLI caught it or the daemon refused it with a 400 · 3 wait did not
11
+ * match, or find found nothing.
12
+ */
13
+ export {};