Skip to content

TUI: expose per-turn working/idle state in the terminal title (OSC 0/2) so terminal multiplexers and tabs can show a status dot #43904

Description

@PatrickLerner

Summary

The opencode TUI writes the terminal title exactly twice per session: OpenCode at startup and OC | <session title> once the session is named. It never repaints the title per turn, so a terminal tab / multiplexer / external observer cannot tell whether the agent is currently working or waiting for the user.

Why it matters

Tools that drive opencode in a pty (terminal multiplexers, orchestration daemons that show live session status, browser-based terminal tabs) already read OSC 0/2 title sequences as a zero-config status channel. Claude Code, for comparison, repaints its title with a spinner glyph while working and an idle glyph when it is the user's turn — which makes a terminal tab's status dot trivially derivable from the pty stream, with no API polling and no extra protocol.

For opencode today the honest answer is "unknown": opencode session list carries no live turn state, and the TUI emits no state-bearing title or private OSC.

Proposal

One (or both) of:

  1. Repaint the OSC 0/2 title with a turn-state glyph while a turn is running (e.g. a spinner phase while the model is working, a distinct glyph when the turn ends and it is the user's turn). A ~1s repaint cadence is plenty; the point is a derivable signal, not animation quality.
  2. Emit a private OSC sequence carrying the turn state (e.g. OSC 777 ; opencode ; <state> with working|idle), which external observers can subscribe to without it affecting the visible tab title.

Either keeps the integration surface to "read the pty output" — no sockets, no polling, nothing that breaks under --auto headless use.

Environment

Verified against opencode 1.18.18 (TUI under a real pty): titles observed at startup and once per session, never per turn.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions