Repository navigation
feat: OSC 7501 program status - #405
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Programs running in a Programa terminal can now tell us what they are doing (working, done, waiting on you, failed) with the OSC 7501 Program Status Protocol. Programa shows it in the sidebar and notifies you when a pane you aren't looking at finishes, fails or needs you. Because the report travels inside the terminal output, it also works over SSH and in containers, where our socket hooks can't reach. Our own Claude Code, Codex and OpenCode hooks send it too.
Summary
Review in this order:
ghosttybump (fork branchosc7501-program-status): backport of libghostty-vt: program status protocol (OSC 7501) ghostty-org/ghostty#14560 plus aGHOSTTY_ACTION_PROGRAM_STATUSaction. The fork also clears records on RIS, signals the OSC 133;A prompt, and answers theOSC 7501 ; ?query, which upstream's full-app path does not.Sources/ProgramStatus.swift: report parser and per-terminal record store (256 records, clear-subtree, prompt dropsworking/blocked,done/errorsurvive).Sources/GhosttyApp+ProgramStatus.swift: callback copies the bytes, hops to main, projects the root record into agent presence as sourceprogram, notifies waiters and posts notifications per state transition.Sources/Workspace+SidebarTelemetry.swift: authority. Program beats hooks beats screen inference, but only while the program isworkingorblocked; a restingdone/errorrecord yields to a hook that reports activity.program_statusonsurface.list/system.tree(state, kind, progress, app, has_message, updated_at),surface.waitgainsprogram_state.agent_statekeeps its values (done/error read as idle). Recordmsg/titlenever go over the socket, including through notification text, per the spec.CLI/CLI+ProgramStatusEmitter.swift: hooks write one ≤512-byte sequence to the tty, only whenPROGRAMA_SURFACE_IDis set and not inside tmux.docs/program-status.mdanddocs/socket-api.md.f41dfac312pins the GhosttyKit checksum. The release token got a 403 on the fork, so that framework was built locally with CI's flags and published by hand.Not in this PR: OSC 9;4 progress is not mapped into 7501 records; child records are stored but not shown.
Test Plan
zig build test -Dtest-filter=OSCpasses (parser and header-sync tests)9d4167a2b3, includingtests_v2/test_program_status_osc7501.py(10 cases) in socket-integration-testsprintf '\e]7501;state=done:msg=SGVsbG8=\e\\'; expect a check icon in the sidebar and one "Done" notification