Skip to content

feat(ai-autopilot): surfaces (terminal / in-page / background)#104

Merged
suleimansh merged 1 commit into
mainfrom
suleimansh/feat/ai-autopilot-surfaces
Jul 2, 2026
Merged

feat(ai-autopilot): surfaces (terminal / in-page / background)#104
suleimansh merged 1 commit into
mainfrom
suleimansh/feat/ai-autopilot-surfaces

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #100. Third child of epic #97.

What

Run the same autopilot in three places. The Supervisor already emits progress via onEvent; surfaces adapt that one stream to each environment — they differ only in rendering and whether the run blocks.

  • TerminalterminalSink() prints each event inline (formatEvent() renders one event as a line).
  • BackgroundlaunchAutopilot(start) runs a Supervisor detached and returns an AutopilotHandle: status() ('running' → 'done' | 'error'), events(offset) history replay, and result(). start is caller-provided (onEvent => new Supervisor({ ...opts, onEvent }).run(task)), so the surface knows nothing about how the Supervisor is built.
  • In-page — the same handle exposes a live async stream() to push over SSE: it replays history, then goes live, then ends.

EventStream is the underlying replayable, multi-consumer transport with offset/tail replay — borrowed from Flue's Durable-Streams tail=N (per the #101 teardown). A late subscriber still sees the full history.

Test

16 new tests (history/tail replay, async iteration incl. multiple concurrent iterators, every formatEvent variant, terminal sink, and the full launchAutopilot lifecycle incl. error path). Full suite 63/63 green.

Verified end-to-end against a real Supervisor + AiFake: terminal prints the event tree; the background handle goes running→done; the live stream yields all six events in order; tail-replay from an offset works; result() resolves with the synthesized text.

Scope

Surfaces over the event stream. No infra. This is the last of the four epic children buildable without a real sandbox; the remaining epic work is the real runner adapters (FlueRunner/WebContainer/Docker) on #99.

Run the same autopilot in three places, all over the Supervisor's onEvent
stream:

- terminalSink() / formatEvent(): print events inline (terminal surface)
- EventStream: a replayable, multi-consumer event transport with offset/tail
  replay (borrows Flue's Durable-Streams tail=N); a late subscriber still sees
  full history
- launchAutopilot(start): run a Supervisor detached, return an AutopilotHandle
  (status/events/stream/result) backing the background + in-page (SSE) surfaces

Verified end-to-end against a real Supervisor (terminal tree, background
status running->done, live stream ordering, tail replay). Closes #100.
@suleimansh suleimansh added enhancement New feature or request priority: medium Worth doing, not urgent labels Jul 2, 2026
@suleimansh suleimansh self-assigned this Jul 2, 2026
@suleimansh suleimansh merged commit d261873 into main Jul 2, 2026
2 checks passed
@suleimansh suleimansh deleted the suleimansh/feat/ai-autopilot-surfaces branch July 2, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Worth doing, not urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ai-autopilot: surfaces (terminal / in-page / background)

1 participant