Skip to content
GitHub (opens in a new tab)

TerminalStream

Shell commands an agent runs, one row each: prompt, command, status, duration and the exit code on failure. Output streams in below, folds after N lines, and can be stopped or copied.

stableOrganismcontracts/terminalstream.json

Preview

TerminalStream

Shell commands an agent runs, with output streaming in. Not ToolCallCard.

Master

Four commands play through: install and lint pass, the tests fail with exit 1, and the build runs long, so stop it. Scroll up in a running log to stop following it; scroll back down to follow again.

Terminal

  • ~/app npm ciQueued
  • ~/app npm run lintQueued
  • ~/app npm testQueued
  • ~/app npm run buildQueued

Usage

Append lines to a command's output as they arrive; strip ANSI codes first. Set status to done or failed (with exitCode) when it exits, and to stopped after onStop ends the process. Only status changes are announced to screen readers.

Do's

  • an agent runs shell commands and people watch the output come in
  • build, test or install output that can run long and fail
  • letting the person stop a command that is still running
  • copying a command or its whole output

Don'ts

  • a call to a non-shell tool — ToolCallCard
  • code or a command to copy, with no run behind it — CodeSnippet
  • the step list for a whole task — AgentTrail
  • what runs right now across agents — RunningNow
<TerminalStream
  commands={[
    { id: "install", command: "npm ci", status: "done", duration: "4.1s", output },
    { id: "test", command: "npm test", status: "running", startedAt, output },
  ]}
  onStop={stopCommand}
/>

When to use

  • an agent runs shell commands and people watch the output come in
  • build, test or install output that can run long and fail
  • letting the person stop a command that is still running
  • copying a command or its whole output

When not to use

  • a call to a non-shell tool — ToolCallCard
  • code or a command to copy, with no run behind it — CodeSnippet
  • the step list for a whole task — AgentTrail
  • what runs right now across agents — RunningNow

What an agent reads

import { TerminalStream } from "agentic-ds-kit";
must
  • a kit Card named by its title; commands are a list named like the Card
  • each row's output is a pre region named by its command; it takes focus (tabIndex 0) only when it scrolls
  • one polite live region announces status changes only ("npm test, Failed, Exit 1"); output lines and the live timer are never announced
  • status is an icon plus a word, never colour alone; the icon is aria-hidden
  • the prompt and cwd are not selectable; the prompt is aria-hidden
  • Stop, Copy command and Copy output are kit icon Buttons with a Tooltip, named by their action and described by their command (aria-describedby) (Stop shows SquareStop, Copy command a code mark, Copy output the copy mark), and Copied is announced politely
  • Show all is a Button with aria-expanded and aria-controls on the output
  • while running, output follows the newest line until the person scrolls up; scrolling back to the foot follows again
  • motion: new rows and new output lines rise in (a first load stays still), Running… shimmers, the status mark crossfades in a fixed cell and a check or cross draws in when a command ends live, the copy check draws in, and fold and unfold glide the box height on the enter and exit timings so the rows below move with it. All off under prefers-reduced-motion
defaults
  • foldAfter 12
  • prompt $
stops if
  • Do not invent a local Terminal, Console, LogView or CommandRow; this is the piece
  • Do not wrap it in another Card; it brings its own
  • Do not parse ANSI colour codes or add a highlighting dependency; strip codes before passing output
  • Do not announce output lines; only status changes are announced
  • Do not show Stop on a command that is not running
  • Do not use raw hex or a local monospace font; use type.family.code
  • Do not put secrets in output unmasked; mask them before passing lines

From contracts/terminalstream.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
commandsarrayYes—{ id, command, status, output?, duration?, startedAt?, exitCode?, cwd? }[], in run order. output is string[], oldest first; append lines to stream. duration is the final time ("4.2s"); a running command with startedAt (epoch ms) ticks a live timer instead. exitCode shows as "Exit N" on a failed command. cwd shows before the prompt in muted mono.
statusqueued | running | done | failed | stoppedNo—Per command, inside commands. queued waits its turn; running streams output (Running… shimmers); done exited 0; failed exited non-zero; stopped was stopped by the person. Each is an icon plus a word.
foldAfternumberNo12Output taller than this many lines folds to that height and shows "Show all N lines". A folded log renders only its newest 200 lines until opened; copy always takes all of it.
maxHeightstring | numberNo—Open output scrolls inside past this height (a CSS length, or px). Left out, open output grows to fit.
onStopfunctionNo—(id) => void. Shows a Stop icon Button (SquareStop mark, Tooltip "Stop") on running commands only, beside the copy buttons and the same size. Stop the process, then set the command to stopped.
promptstringNo$Mark before each command. Decorative: never copied, not read out.
labelstringNo—Card title and list name. Default KitLabels terminal ("Terminal").
  • Component
    →

    ToolCallCard

    One agent tool call on one line: status, mono name, summary and a live timer.

  • Component
    →

    CodeSnippet

    Read-only block of code with a copy button, optional title, language label, tabs, and line numbers.

  • Component
    →

    AgentTrail

    A vertical step list for a running agent task: done steps with durations, the current step with a live timer, then pending steps.

  • Component
    →

    RunningNow

    Many agents, small: a strip of what runs now for a header (row of chips) or a sidebar (stack), with status, activity and a clock.