fix(notify): cross-platform TTY write with CONOUT$/CON fallback for Windows (fixes #15)#16
Open
MoerAI wants to merge 1 commit intowarpdotdev:mainfrom
Open
fix(notify): cross-platform TTY write with CONOUT$/CON fallback for Windows (fixes #15)#16MoerAI wants to merge 1 commit intowarpdotdev:mainfrom
MoerAI wants to merge 1 commit intowarpdotdev:mainfrom
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.
Summary
/dev/ttywrite with a platform-aware cascade that works on WindowsWARP_CLIENT_VERSIONvalidation fromclaude-code-warpto skip broken Warp buildsProblem
warpNotify()writes OSC 777 viawriteFileSync("/dev/tty"), which is Unix-only. On Windows, this silently fails and no notifications ever reach Warp. PR #12'sprocess.stdout.write()fallback also doesn't work because OpenCode's plugin loader pipes stdout for RPC — it never reaches the terminal.Additionally, some Warp builds set
WARP_CLI_AGENT_PROTOCOL_VERSIONwithout actually supporting structured notifications, causing the plugin to send events that are silently dropped.Fix
src/notify.ts— NewwriteTty()function with ordered fallback:/dev/tty— standard Unix controlling terminal (also works in WSL)CONOUT$— Windows console output device (bypasses stdio redirection)CON— Windows console device (alternative path)process.stderr— last resort, only if stderr is still a TTYEach target is opened with
openSync/writeSync/closeSyncfor proper fd management.Added
WARP_CLIENT_VERSIONgating (ported fromclaude-code-warp'sshould-use-structured.sh) to avoid sending notifications to known-broken Warp builds.Changes
src/notify.tswriteFileSync("/dev/tty")with cross-platformwriteTty()cascade; addWARP_CLIENT_VERSIONchecktests/index.test.tswriteTtysmoke testHow to Test
/dev/ttyfirst)Fixes #15
Supersedes #12