VS Code Extension
The sonny-vscode extension is a complete Sonny session surface for VS Code. It
reuses the same React session UI and daemon client as the desktop application
without starting a second agent runtime.
Runtime shape
Opening the Sonny Activity Bar view activates dist/extension.cjs. The
extension host then:
- resolves a trusted Sonny executable from
sonny.executable, an absoluteSONNY_BINdevelopment override, orbin/sonnyin the packaged extension; - runs
sonny supervisor ensureto start or attach to the local shared service and obtain its exact endpoint, executable, and tenant; - starts only
sonny editor-rpc --human-attachand bridges its NDJSON frames to the webview; and - exposes the supported VS Code host services — open and reveal files, safe external links, notifications, pickers, and theme updates — over the same message boundary.
Closing the view or deactivating the extension closes that editor connection. It deliberately does not stop the shared supervisor or any running session, so reopening the view reattaches to the existing service.
The browser-only Vite development entry still renders fixture data. That keeps component development deterministic, while the packaged extension always uses live daemon sources.
Commands
| Command | Default keybinding |
|---|---|
Sonny: Open Sessions | Ctrl+Alt+S (Cmd+Alt+S on macOS) |
Sonny: Reconnect to Local Service | — |
Sonny: Show Output | — |
Settings
| Setting | Behaviour |
|---|---|
sonny.executable | Must be an absolute path; the extension never searches PATH |
sonny.supervisorEndpoint | May override the platform socket or named pipe; normally empty |
sonny.tenant | May override the resolved local-profile tenant; normally empty |
The PATH rule is deliberate. An editor extension loads in whatever environment
your shell left behind, and silently picking up a different sonny than the
daemon is running is the exact failure the desktop avoids with its
digest-pinned sibling binary.
Building and verifying
From ui/:
pnpm --filter sonny-vscode typecheck
pnpm --filter sonny-vscode test
pnpm --filter sonny-vscode build
pnpm --filter sonny-vscode package
build emits dist/extension.cjs for the Node extension host and
dist/webview/ for the CSP-restricted webview. package creates
dist/sonny-vscode.vsix; the VSIX contains built output and the Activity Bar
icon — not source files, maps, or node_modules.
Development-host validation
- Set an absolute
SONNY_BIN. - Press
F5with this package as the extension development path. - Open the Sonny view, create or attach to a session, and complete a turn.
- Run Developer: Restart Extension Host and reopen the view.
The session remains available after step 4, because only the editor connection was released — the supervisor and the session were never owned by the extension host.
Source of truth
ui/apps/vscode/README.mdui/apps/vscode/package.jsondocs/config/supervisor-daemon-lifecycle.md