Repository navigation
Rex support (experimental): host semantics and OSC 7501 program status - #543
Draft
raiseCatError wants to merge 3 commits into
Draft
raiseCatError wants to merge 3 commits into
raiseCatError wants to merge 3 commits into
Conversation
In Rex (TERM_PROGRAM=rex) NMSh now sends OSC 7 and OSC 133 as it does on Ghostty, names the host, and reports its state with Rex's documented OSC 7501 program status in a record of its own (id=nmsh): working while a command runs; blocked (auth/question) only when the shell confirms a program reads hidden input or a line; blocked (permission) while a held queued line waits for approval; error while the queue is paused after a failure; otherwise the record is cleared. Messages are fixed text; no command line or typing reaches the host. Reports are written on change, only while NMSh owns the screen (a command start at once, like OSC 133 C), and the record is cleared when NMSh stops or is suspended. Nothing is sent inside tmux or screen or to other hosts; NMSH_PROGRAM_STATUS turns it off or forces it on. NMSh never reads the status back, opens no Rex blocks or windows and does not change Rex's configuration.
…abnormal exit Zellij owns the real terminal like tmux and screen, and TERM_PROGRAM is inherited from the outer host, so neither OSC 7501 nor Rex's OSC 133/OSC 7 claim applies inside it (the rest of NMSh already treats ZELLIJ as nested). A frontend that ends without stop() (an uncaught error) now clears its OSC 7501 record on process exit, as SIGTERM, SIGHUP, /zsh and normal exit already did. Refs #473
This branch has not been deployed
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.
Rex support (experimental): host semantics and OSC 7501 program status.
What changed and why
Rex (Superlogical, built on Ghostty's terminal core) sets
TERM_PROGRAM=rex,REX_SESSION,REX_BLOCKandREX_SERVER. NMSh treated it as an unknown host and sent it nothing. This change is confined tosrc/host/, plus one per-frame call inTerminalApp. The core has no Rex dependency, and the existing "frontend does not branch on host products" architecture test still passes.OSC 7 and OSC 133 in Rex, as on Ghostty. Rex documents OSC 133 A as its prompt boundary and reports OSC 7 as the block's directory.
The host is named "Rex". NMSh opens no Rex blocks or windows, uses no Rex CLI, and never reads or writes Rex's configuration or key bindings.
OSC 7501 program status (
src/host/programStatus.ts) uses one record of NMSh's own (id=nmsh,app=nmsh). It never touches the root record or clears every record. States are reported only from NMSh's own evidence:workingblocked,kind=authblocked,kind=questionblocked,kind=permissionerrorC.TERM_PROGRAM=rexoutside tmux, screen and Zellij. There is no?query, so other hosts never see it.NMSH_PROGRAM_STATUS=0turns it off;=1forces it on.Review fixes (2026-11-11)
cece7ed9/dc3fe8bc: no OSC 7501, and no Rex OSC 133/OSC 7 claim, inside Zellij.TERM_PROGRAMis inherited from the outer host, and the rest of NMSh already treatsZELLIJas nested. The status record is now also cleared on an abnormal exit (processexitwithoutstop()). Tests were added toprogramStatus.test.ts.Automated verification
tests/programStatus.test.tscovers:TerminalApp, including the no-leak checkdc3fe8bc:programStatus,hostSemantics,hostProfiles,hostIntegration,muxInterop,startupLaunchandstartupRestoregive 54 of 55 passing. The failure is the GNU screen interop test, which also fails on pristinedev(being investigated separately).npm run verifyat the original head0530aa08: 4,571 of 4,589 tests pass. The full gate will be rerun once on the pinned integration candidate. The 4 failures also fail on pristineorigin/devon this Mac: GNU screen interop, live alias refresh, text editor panel, suite-runner tmpdir hygiene.Checked in Rex (scripted, isolated)
Rex Beta 0.1.0-preview.14 on macOS. The test used an isolated Rex session (killed afterwards) and an isolated NMSh HOME, config and runtime directory. Rex's own block API (
rex block call … pwd|program_status) showed:pwd= the shell's directory via OSC 7.sleep:nmsh working.sleep:nmsh blocked permission. After/queue clear: none.read -s:nmsh blocked auth. Answered: none. The secret was never in Rex's scrollback.false:nmsh error.Not verified:
rex keymaplists no bindings and~/.config/rex/init.luadoesn't exist; client defaults aren't listed.xterm-rexterminfo (not installed here; Rex fell back toxterm-256color).Needs human testing (Rex app)
sleep 10, asudo -k truepassword prompt, a held line, and a failed queue.Known limits / risks
working, because the command is still running.Refs #473. Integration order and the pinned candidate are tracked on #541.