Every client exposes client.console, a store holding the running user program’s standard output. It is a separate store from the connection snapshot, so a console that redraws on every line does not re-render everything bound to connection state.

Snapshot

text is a plain string so it can be rendered straight into a <pre>. Use chunks as the change key when scrolling to the tail: after trimming, text can be unchanged even though new output arrived.

Actions

  • start() — begin streaming. Resolves false and publishes an error snapshot when no device is connected.
  • stop() — stop streaming and keep the buffered text.
  • clear() — empty the buffer without interrupting a running stream.
  • send(text) — write a line to the program’s standard input. Resolves false when nothing is streaming or the write is refused.
The console stops whenever the device detaches, including a disconnect, a lost link, or a refresh failure, so it never keeps polling a closed connection.

Buffer size

Output is capped so a long-running program cannot grow the page’s memory without bound. When the cap is exceeded, the oldest output is dropped a line at a time, and truncated becomes true.
terminal is forwarded to the underlying serial terminal session.

React

useV5Console() returns the snapshot fields spread together with the actions.

Svelte

v5.console has its own subscription, so reading it does not make a component re-run on every connection snapshot.

Solid