Connection plane for the agent-execution platform: the FleetCrown-owned PTY now
reaches the UI with no zellij in the path.
- Renamed the module src/lib/executor -> src/lib/agent-execution to avoid
colliding with the pre-existing command-executor (src/lib/executor.ts:
direct-zellij vs cloud pending_commands), which was shadowing the dir import.
- API: POST /api/workspaces (provision, idempotent per user+project) + GET
(list); GET /api/workspaces/[id]/stream (SSE: replays retained history via
Last-Event-ID, then live output/status/exit); POST /api/workspaces/[id]
(input / resize / terminate). Auth by workspace-id prefix (userId:projectKey)
— multi-tenant safe, node runtime.
- WorkspaceTerminal.tsx: wraps the @xterm/xterm already shipped, fed by the SSE
stream, keystrokes -> POST. Drop-in replacement for the zellij screen-dump peek.
Executor test still 11/11 green. Next: wire Control's 'Open workspace' at this
+ provision-on-launch, then SandboxExecutor for multi-tenant prod.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
First step of the agent-execution-platform: FleetCrown owns each agent's PTY
instead of puppeting a zellij session by name. Terminal-agnostic by construction
— traffics in a stable workspace id, raw PTY bytes, and event-sourced status, not
session/tab names.
- src/lib/executor/types.ts — the Executor interface (the SSOT abstraction;
LocalPty now, SandboxExecutor later, same interface, no control-plane changes).
- src/lib/executor/local-pty.ts — node-pty implementation: spawn/write/resize/
subscribe/terminate, ring-buffered events with monotonic seq for reconnect
replay, and status derived from the owned process (output=running, quiet=idle,
exit=exited) — no /proc, no /tmp sentinel, no screen-scrape.
- src/lib/executor/index.ts — globalThis-pinned singleton (true process-wide
PTY registry across Next module re-eval).
- node-pty dep + serverExternalPackages (native addon, Node runtime only).
- scripts/test/executor.ts — 11 round-trip assertions, all green.
Next (Phase 2): stream the PTY to the @xterm/xterm already shipped + input path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>