{"_id":"@cemoody/pi-crust-ext-terminal","_rev":"4-be10bca5b3d8584a744105777bc5c7d3","name":"@cemoody/pi-crust-ext-terminal","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@cemoody/pi-crust-ext-terminal","version":"0.1.0","keywords":["pi-crust","pi-crust-extension","pi.dev","terminal","pty"],"author":{"name":"cemoody"},"license":"MIT","_id":"@cemoody/pi-crust-ext-terminal@0.1.0","maintainers":[{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"}],"homepage":"https://github.com/cemoody/pi-crust-ext-terminal#readme","bugs":{"url":"https://github.com/cemoody/pi-crust-ext-terminal/issues"},"dist":{"shasum":"c0b10772200d91836431b44e11f5c5141cf7d4dc","tarball":"https://registry.npmjs.org/@cemoody/pi-crust-ext-terminal/-/pi-crust-ext-terminal-0.1.0.tgz","fileCount":5,"integrity":"sha512-PSaZSINAdu8MBQ1nVRrNWnLdPiA1KVQPnhNJnGcfjEpXSPOGjz4V+aNJQFnTUqn4ZvN0eEBrO3F4LcHEyzlZfg==","signatures":[{"sig":"MEQCIBJSsnfFos0b64bAZWIlfb8tmpiBzhyT6dTQL2SX5U18AiAdQWtZ84t9M7gN7/j5NUMf+ORUcJwQKA3KwxwBvW3z7g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97454},"main":"./server.mjs","type":"module","engines":{"node":">=22"},"exports":{".":"./server.mjs","./package.json":"./package.json"},"gitHead":"9bad866b43bc3a3e7601de878df4b272b98ec991","piCrust":{"web":"./web.mjs","extension":"./server.mjs"},"scripts":{"test":"vitest run","build":"node scripts/build-web.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"},"repository":{"url":"git+https://github.com/cemoody/pi-crust-ext-terminal.git","type":"git"},"_npmVersion":"10.9.7","description":"Browser terminal (PTY) for pi-crust, as a sidebar activity view. Streams a real shell over the realtime gateway.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"node-pty":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","esbuild":"^0.24.0","@wterm/dom":"^0.1.9","socket.io-client":"^4.7.5"},"piRemoteControl":{"web":"./web.mjs","extension":"./server.mjs"},"_npmOperationalInternal":{"tmp":"tmp/pi-crust-ext-terminal_0.1.0_1780239735389_0.3872987612538077","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cemoody/pi-crust-ext-terminal","version":"0.1.1","keywords":["pi-crust","pi-crust-extension","pi.dev","terminal","pty"],"author":{"name":"cemoody"},"license":"MIT","_id":"@cemoody/pi-crust-ext-terminal@0.1.1","maintainers":[{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"}],"homepage":"https://github.com/cemoody/pi-crust-ext-terminal#readme","bugs":{"url":"https://github.com/cemoody/pi-crust-ext-terminal/issues"},"dist":{"shasum":"a53ca9e35bdb3a49b0af6a98f3ff80e7b2b7994c","tarball":"https://registry.npmjs.org/@cemoody/pi-crust-ext-terminal/-/pi-crust-ext-terminal-0.1.1.tgz","fileCount":5,"integrity":"sha512-pBgyeuL7+qF2qoRdlMuXUJEJSzB5JEHUMQGb1xy9vSvsN3/J9WbdbF2zuLYqEKDBfOLNPx0xVkc9YbOaacCagw==","signatures":[{"sig":"MEYCIQCpdB9Mc3LKXDUBRQ+YaI3kH4Rjd3jErMZWFgzwsvss5QIhALVJd5qiCtbIdXCQFPiAXyGOBH9YOBW3C6i6rZPswM2A","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98264},"main":"./server.mjs","type":"module","engines":{"node":">=22"},"exports":{".":"./server.mjs","./package.json":"./package.json"},"gitHead":"45c0764c4deb660eb1cd9b0fe765d2d85c04f920","piCrust":{"web":"./web.mjs","extension":"./server.mjs"},"scripts":{"test":"vitest run","build":"node scripts/build-web.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"},"repository":{"url":"git+https://github.com/cemoody/pi-crust-ext-terminal.git","type":"git"},"_npmVersion":"10.9.7","description":"Browser terminal (PTY) for pi-crust, as a sidebar activity view. Streams a real shell over the realtime gateway.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"node-pty":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","esbuild":"^0.24.0","@wterm/dom":"^0.1.9","socket.io-client":"^4.7.5"},"piRemoteControl":{"web":"./web.mjs","extension":"./server.mjs"},"_npmOperationalInternal":{"tmp":"tmp/pi-crust-ext-terminal_0.1.1_1780240072533_0.723388123325174","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cemoody/pi-crust-ext-terminal","version":"0.1.2","keywords":["pi-crust","pi-crust-extension","pi.dev","terminal","pty"],"author":{"name":"cemoody"},"license":"MIT","_id":"@cemoody/pi-crust-ext-terminal@0.1.2","maintainers":[{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"}],"homepage":"https://github.com/cemoody/pi-crust-ext-terminal#readme","bugs":{"url":"https://github.com/cemoody/pi-crust-ext-terminal/issues"},"dist":{"shasum":"362a10977371ac6a8ef66ce00682a73489da66a9","tarball":"https://registry.npmjs.org/@cemoody/pi-crust-ext-terminal/-/pi-crust-ext-terminal-0.1.2.tgz","fileCount":5,"integrity":"sha512-DVC5zXSX1Cmd0Aa7qe2Zd474LwZSlCKkXk0h3Ih4CAyycL71tklLRvZpcW0WV8woRp5bvIMp439EW3uFUo7W4g==","signatures":[{"sig":"MEUCIQChSpGWWpvumzIZhC0pAhR+tZbaqIWfTjaio7Rgd19qlgIgRKA8YEuvnGS49g9yHzlyb0wpb3dq7mcitIuduWQlShU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102184},"main":"./server.mjs","type":"module","engines":{"node":">=22"},"exports":{".":"./server.mjs","./package.json":"./package.json"},"gitHead":"47c391f59862b006e4a9b2f3bd02069fe5b0814c","piCrust":{"web":"./web.mjs","extension":"./server.mjs"},"scripts":{"test":"vitest run","build":"node scripts/build-web.mjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"},"repository":{"url":"git+https://github.com/cemoody/pi-crust-ext-terminal.git","type":"git"},"_npmVersion":"10.9.7","description":"Browser terminal (PTY) for pi-crust, as a sidebar activity view. Streams a real shell over the realtime gateway.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"node-pty":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","esbuild":"^0.24.0","@wterm/dom":"^0.1.9","socket.io-client":"^4.7.5"},"piRemoteControl":{"web":"./web.mjs","extension":"./server.mjs"},"_npmOperationalInternal":{"tmp":"tmp/pi-crust-ext-terminal_0.1.2_1780279879049_0.034522986417728996","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@cemoody/pi-crust-ext-terminal","version":"0.1.3","description":"Browser terminal (PTY) for pi-crust, as a sidebar activity view. Streams a real shell over the realtime gateway.","license":"MIT","author":{"name":"cemoody"},"type":"module","main":"./server.mjs","exports":{".":"./server.mjs","./package.json":"./package.json"},"repository":{"type":"git","url":"git+https://github.com/cemoody/pi-crust-ext-terminal.git"},"homepage":"https://github.com/cemoody/pi-crust-ext-terminal#readme","bugs":{"url":"https://github.com/cemoody/pi-crust-ext-terminal/issues"},"keywords":["pi-crust","pi-crust-extension","pi.dev","terminal","pty"],"engines":{"node":">=22"},"piRemoteControl":{"extension":"./server.mjs","web":"./web.mjs"},"piCrust":{"extension":"./server.mjs","web":"./web.mjs"},"dependencies":{"node-pty":"^1.0.0"},"devDependencies":{"@wterm/dom":"^0.1.9","esbuild":"^0.24.0","socket.io-client":"^4.7.5","vitest":"^2.1.0"},"scripts":{"build":"node scripts/build-web.mjs","test":"vitest run","prepublishOnly":"npm run build"},"_id":"@cemoody/pi-crust-ext-terminal@0.1.3","gitHead":"3ebafff56aec35dcf891dc9a17358b2bd6604ddb","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-K6WiOjPx9hqsOfbKzsOn/ta5JU6oS7KvFNPHETR3Ou8QCDISgT6+Z1UtLQAjI0XYVzaJCOqHlbBVHyOB4/6ryw==","shasum":"4a1ef310f15e69989601195014e333909229d42c","tarball":"https://registry.npmjs.org/@cemoody/pi-crust-ext-terminal/-/pi-crust-ext-terminal-0.1.3.tgz","fileCount":5,"unpackedSize":107874,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB5EIAaMTbdYnuK4IsJVnkrQxqyZ5w9WRHE9vAfPzf0BAiEAs8v2GpamDdHAn/tDe3jXi85kKROydZf/421+RnTi7+c="}]},"_npmUser":{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"},"directories":{},"maintainers":[{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-crust-ext-terminal_0.1.3_1780286693851_0.16690389910143533"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-31T15:02:15.246Z","modified":"2026-06-01T04:04:54.115Z","0.1.0":"2026-05-31T15:02:15.565Z","0.1.1":"2026-05-31T15:07:52.656Z","0.1.2":"2026-06-01T02:11:19.189Z","0.1.3":"2026-06-01T04:04:53.997Z"},"bugs":{"url":"https://github.com/cemoody/pi-crust-ext-terminal/issues"},"author":{"name":"cemoody"},"license":"MIT","homepage":"https://github.com/cemoody/pi-crust-ext-terminal#readme","keywords":["pi-crust","pi-crust-extension","pi.dev","terminal","pty"],"repository":{"type":"git","url":"git+https://github.com/cemoody/pi-crust-ext-terminal.git"},"description":"Browser terminal (PTY) for pi-crust, as a sidebar activity view. Streams a real shell over the realtime gateway.","maintainers":[{"name":"chrisemoodynpm","email":"chrisemoody@gmail.com"}],"readme":"# @cemoody/pi-crust-ext-terminal\n\nA **browser terminal** for [pi-crust](https://github.com/cemoody/pi-crust), packaged as an extension. It adds a **Terminal** item to the sidebar that streams a real shell (PTY) for the active session over pi-crust's realtime gateway.\n\n- **Server** (`server.mjs`): registers the `pty:*` protocol on the shared Socket.IO gateway via `ctx.server.realtime.onConnection`, spawning a real shell with [`node-pty`](https://github.com/microsoft/node-pty). The shell's working directory is the session's `cwd` — it can never escape the session root.\n- **Web** (`web.mjs`): a self-contained ESM module that renders a [wterm](https://www.npmjs.com/package/@wterm/dom) DOM terminal and connects a dedicated socket to the page origin. React is provided by the host.\n\n## Requirements\n\n- **pi-crust with the `ctx.server.realtime` extension API.** This shipped in core via PR #219 — you need a pi-crust release **newer than `0.2.2`**. On an older host the extension refuses to activate with a clear error (and the Settings \"Add a source\" install returns a 400 with that message), rather than half-loading.\n- **Recommended: pi-crust ≥ `0.3.2`.** Earlier releases work, but:\n  - `≥ 0.3.0` is needed to install via Settings without a server restart (older hosts require a restart after install).\n  - `≥ 0.3.2` renders the dedicated **terminal** sidebar glyph; older hosts fall back to the generic extension icon (the terminal still works).\n- Node ≥ 22 (for `node-pty`'s prebuilt binaries / native build).\n\n## Install\n\nIn pi-crust, open **Settings → Extensions → Add a source** and enter:\n\n```\nnpm:@cemoody/pi-crust-ext-terminal\n```\n\nOr add it to your pi-crust `settings.json`:\n\n```json\n{\n  \"packages\": [\n    { \"source\": \"npm:@cemoody/pi-crust-ext-terminal\", \"kind\": \"npm\" }\n  ]\n}\n```\n\nYou can also install from a git URL (`git:https://github.com/cemoody/pi-crust-ext-terminal`) or a local checkout path.\n\n## Usage\n\nAfter installing, a **Terminal** entry appears in the sidebar. Click it to open a shell bound to the active session's working directory. Closing the tab (or disconnecting) tears the shell down — no orphan processes.\n\nA small toolbar (top-right, styled like the host's action buttons) offers:\n\n- **Copy** — copy the visible terminal buffer to the clipboard.\n- **Clear** — send `Ctrl+L` to redraw a clean screen.\n- **Restart** — tear down and relaunch the shell in place.\n- **Maximize / Restore** — resize the terminal to fill the viewport; press **Esc** or the Restore button to return to the inline panel.\n\n## How it works\n\n```\nclient ─ pty:open  { sessionId, cols, rows } ─► server ─ ack { ok, ptyId }\n       ─ pty:input { ptyId, data }           ─►        ─ ack { ok }\n       ─ pty:resize{ ptyId, cols, rows }     ─►        ─ ack { ok }\n       ─ pty:close { ptyId }                 ─►        ─ ack { ok }\n       ◄─ pty:data { ptyId, seq, data }\n       ◄─ pty:exit { ptyId, exitCode, signal? }\n```\n\nEach browser connection owns only the PTYs it opened (per-connection scope), so there is zero cross-talk between terminals and a disconnect always cleans up.\n\n## Development\n\n```sh\nnpm install\nnpm run build   # bundles src/web.src.mjs -> web.mjs (wterm + socket.io-client inlined; React external)\nnpm test        # vitest unit tests for the PtyManager + realtime protocol\n```\n\n`web.mjs` is a generated artifact (committed for convenience and published) — edit `src/web.src.mjs` and re-run `npm run build`.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}