Skip to content

feat(hub): expose terminal session output events - #301

Closed
dvcolomban wants to merge 1 commit into
devframes:mainfrom
dvcolomban:codex/feat-terminal-output-event
Closed

feat(hub): expose terminal session output events#301
dvcolomban wants to merge 1 commit into
devframes:mainfrom
dvcolomban:codex/feat-terminal-output-event

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add a local terminals:session:output event carrying the session id and each consumed output chunk
  • emit from the terminal host's existing stream reader, covering registered streams, child processes, and PTYs without attaching another reader
  • document the event and update the public API snapshots
  • cover direct registered streams and spawned child-process output

Why

Hub hosts sometimes need to observe terminal output on the server side to relay selected sessions into another logging or observability system, or to derive diagnostics and application state. The existing terminal streaming channel is designed for connected RPC clients, not code already running inside the host process.

session.buffer cannot provide an exact live feed. It retains only the latest 1,000 chunks, exposes no output notification or public sequence cursor, and mutates as older chunks are removed. A polling observer can therefore miss output when the buffer rotates and cannot reliably distinguish repeated chunks from chunks it already forwarded.

The terminal host must remain the only reader of a ReadableStream. Creating an RPC client that connects back to the same Hub would add transport, authentication, replay, and reconnect behavior just to observe data already in the process. A local event provides an opt-in observation point without competing for the stream, changing buffering, or introducing that loopback connection.

Contract

The event is live-only and local to the node process. It does not replay buffered output or cross the client protocol. Every chunk already consumed by the terminal host is emitted once as (sessionId, chunk) before the existing buffer and client-stream fan-out.

Validation

  • Hub terminal host tests: 25 passed, including child-process and native PTY coverage
  • Hub public API snapshot tests
  • Hub typecheck
  • ESLint on changed TypeScript files
  • Hub build

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@dvcolomban

Copy link
Copy Markdown
Contributor Author

Closing after narrowing the requirement. Existing client streaming covers the live terminal UI, and the bounded session buffer is sufficient for any later on-demand tail reader. There is no current server-side live observer, so this public event would have no active consumer.

@dvcolomban dvcolomban closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant