Lines 1-25javascript
2// Native-messaging host for the Lizard Studio "Claude Code chat" side panel.
4// It bridges the Chrome side panel and the real `claude` CLI. The panel speaks
5// Chrome native messaging (4-byte little-endian length prefix + JSON body) over
6// this process's stdin/stdout. We spawn `claude` in headless stream-json mode
7// (`claude -p --input-format stream-json --output-format stream-json`), keep it
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
src/host/claude-host.mjsView on unpkg · L5 8// alive across turns, and relay every line it emits back to the panel verbatim
9// (including the incremental `stream_event` objects from --include-partial-messages).
11// 100% local: no network of our own, no deps. `claude` does the real work in the
12// chosen working directory — real tools, real edits, real shell.
14// Every message carries an `id` naming the chat tab it belongs to, so the host
15// can run one independent `claude` process per tab and the panel can route each
16// stream back to the right conversation.
18// Protocol — panel -> host:
19// { type:"start", id, cwd, model?, effort?, permissionMode?, resume? } spawn (or respawn) claude
20// { type:"prompt", id, text, images? } send one user turn (images: [{mediaType,data}])
21// { type:"interrupt", id } hard-stop: kill + resume the session
22// { type:"killShell", id, taskId, shellId?, command?, port? } kill just one background shell / dev
23// server's process subtree (→ shellKilled)
24// { type:"probeShellPort", id, taskId, command } ask what TCP port a dev server listens