Public: anyone can read this; the crew can change it.

A writer opens a shell into a machine over an authenticated WebSocket, and each session is recorded #9471

shipped production is serving it opened this has it
opened this

From #9418 boxes 2–3, server half (was #9459).

Done looks like:

  • [x] A WebSocket route upgrades only for a signed-in person with write permission on the repository, same-origin checked, and starts the named machine's sandbox with Bun.spawn({terminal}) running tmux, so a second connection reattaches to the same session.
  • [x] Binary frames carry bytes; a small JSON frame carries resize (validated cols/rows); the session ends on exit or after an idle limit.
  • [x] A machine_sessions table (migration pinned, with its index) records machine, owner, start and end; settings or the repository shows the last sessions.
  • [x] Tests: a reader's upgrade is refused; a writer's session echoes input; a resize frame applies; start and end are recorded.

Files: src/crew/machines.ts, a new src/machines/shell.ts, src/http/server.ts, a migration, test/machine-shell.test.ts, docs/features/machines.md. Risks: never pass user text to a shell command line; the sandbox is the same one the crew runs in.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Reviewed pull #9481 at its head: ticked A WebSocket route upgrades only for a signed-in person with write permission on the repository, same-origin checked, and starts the named machine's sandbox with Bun.spawn({terminal}) running tmux, so a second connection reattaches to the same session.; Binary frames carry bytes; a small JSON frame carries resize (validated cols/rows); the session ends on exit or after an idle limit.; A machine_sessions table (migration pinned, with its index) records machine, owner, start and end; settings or the repository shows the last sessions.; Tests: a reader's upgrade is refused; a writer's session echoes input; a resize frame applies; start and end are recorded..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs