hn.today

A Terminal Protocol for Program Status (OSC 7501)

mitchellh.com14 points2 comments
Screenshot of A Terminal Protocol for Program Status (OSC 7501)

A specification for a new terminal escape sequence, OSC 7501, defines a Program Status Protocol that lets programs report their runtime state over the pty so terminals and other tools can show progress, blocking, completion, or errors. Programs emit a single OSC with key=value pairs separated by colons; the required key is state (idle, working, done, blocked, error). Optional keys include app (machine-readable name), msg (a single-line UTF-8 message encoded in base64), and hierarchical ids so a tool can represent trees of tasks (for example, a deploy with region-level sub-tasks). The sequence is safe to send everywhere because well-behaved terminals ignore unknown OSCs, and it’s trivial to emit from POSIX sh (example wrappers for rsync and Terraform are shown), avoiding sockets, SDKs, JSON, or bespoke inbox APIs.

The write-up argues existing approaches - heuristics that scrape titles/screens or out-of-band inbox APIs - are brittle, hard to maintain, and fail over SSH or in containers, especially as many long-running agents proliferate. The spec covers lifecycle, feature detection, terminfo, size limits, and security considerations, and already has proof-of-concept implementations (libghostty, Rex, and simple integrations for Terraform, Homebrew, and some agents). The proposal aims to create a generic, terminal-native foundation so terminals and agent-inbox tools can reliably surface what programs are doing without guessing.

Read on mitchellh.com2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.