Skip to content

[FEATURE]: Support OSC 7501 Program Status Protocol in the TUI #54179

Closed

Description

@maxffarrell

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Please add Program Status Protocol (OSC 7501) reports to OpenCode's interactive terminal UI.

When running several agents in background terminal tabs, it is useful to know which is working, which needs approval or an answer, and which has finished. OSC 7501 gives supporting terminals structured state directly from the program, so they can choose how to display it without parsing screen contents or title glyphs.

Suggested state mapping, with app=opencode in each report:

  • idle: waiting for the next user prompt, including after a user cancellation.
  • working: generating a response or executing tools.
  • blocked:kind=permission: waiting for tool approval.
  • blocked:kind=question: waiting for an answer to an interactive question.
  • blocked:kind=auth: waiting for an interactive authentication step, where applicable.
  • done: the turn completed and the result is ready to look at.
  • error: the turn failed and stopped.

For example, with ESC/ST shown symbolically:

OSC 7501 ; state=working:app=opencode ST
OSC 7501 ; state=blocked:kind=permission:app=opencode ST
OSC 7501 ; state=done:app=opencode ST

Implementation details worth covering:

  • Return to working after an approval or answer when execution resumes. Preserve done/error until the result is acknowledged or the user starts another turn, rather than immediately overwriting them with idle.
  • Optional msg values must use base64 UTF-8 and respect the specification's length and control-character restrictions; avoid including credentials or sensitive prompt/tool content.
  • Keep reporting confined to terminal output; do not inject escape sequences into ACP, JSON, or other machine-readable output.
  • Follow the protocol's cleanup semantics so a terminal is not left showing a stale active task after quitting.
  • Feature detection is optional in revision 0.3: applications may send reports directly, and well-behaved terminals ignore unknown OSC sequences. No terminal-brand allowlist is needed.

Related requests: #43904 and #48482 ask for working/waiting state in OSC 0/2 terminal titles. OSC 7501 addresses the same workflow with structured states and blocking reasons, and can coexist with title updates and desktop notifications.

For a concrete implementation reference, Crush has already merged charmbracelet/crush#4041.

Activity

  1. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed proposal, @maxffarrell. You're asking for the TUI to send structured OSC 7501 Program Status reports (working, blocked:kind=permission|question|auth, done, error, idle, all with app=opencode). That would let supporting terminals show which background tab needs attention, without parsing titles or screen contents.

    I didn't find an existing request for OSC 7501. These related issues cover the same workflow through terminal titles or status indicators:

    The maintainers will consider it.

  2. hackrdotsh commented on Oct 10, 2026

    @hackrdotsh

    I attempted an implementation for this for v2 specifically in #54402

    nevermind, implementation in #54560 now 😅

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