Add serial console with draggable windows and ZMK connection fallback#30
Open
Copilot wants to merge 8 commits into
Open
Add serial console with draggable windows and ZMK connection fallback#30Copilot wants to merge 8 commits into
Copilot wants to merge 8 commits into
Conversation
Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
- Created useSerialPort hook for Web Serial API integration - Created SerialConsole component with filtering and text replacement - Created DraggableWindow component for window management - Added ConsolePage with snap functionality - Added Console tab to main navigation Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
- Created ConsoleContext to manage console windows globally - Implemented tab state persistence for snap positions - Updated App.tsx to handle tab transitions - Updated ConsolePage to use context - Added automatic snap state restoration when switching tabs Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
- Modified DeviceConnection to support fallback to serial console - Added onConnectWithFallback method with timeout - Updated SplashScreen to use fallback connection - Created reusableSerial transport wrapper (not yet in use) - When ZMK connection fails, automatically opens serial console Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
- Created webserial.d.ts with Web Serial API type definitions - Fixed import type declarations - Fixed timeout type in reusableSerial - Added addConsoleFromPort to interface - Build now succeeds without errors Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
- Fix unsafe type casting in reusableSerial (use undefined instead of null) - Improve console ID display (show "#1" instead of "console-1") - All tests passing Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement serial console feature with custom baud rate
Add serial console with draggable windows and ZMK connection fallback
Feb 4, 2026
🚀 Cloudflare Workers PreviewPreview URL: https://e6c0676e-dya-studio.cormoran707.workers.dev Deployed from commit 60f3c83 |
cormoran
requested changes
Feb 4, 2026
cormoran
left a comment
Owner
There was a problem hiding this comment.
@copilot please check comments
| consoleId={console.id} | ||
| onClose={() => removeConsole(console.id)} | ||
| /> | ||
| </DraggableWindow> |
Owner
There was a problem hiding this comment.
DraggableWindow should be not in ConsolePage. It should be in global space (under body?) So that it's shown even if other tab is selected.
Contributor
Author
There was a problem hiding this comment.
Fixed in 472c779. DraggableWindow now renders at App.tsx level so floating consoles are visible across all tabs. Snapped consoles remain in ConsolePage.
- Move DraggableWindow to global space (App.tsx) so consoles visible across all tabs - Fix ZMK connection fallback to check zmkApp.state.error instead of timeout - Implement ReusableSerial to reuse connection when ZMK negotiation fails - Add connectWithPort to useSerialPort for existing ports - Update SerialConsole to accept existingPort prop - Remove floating console logic from ConsolePage (now in App.tsx) - Add ConsoleProvider to DeviceConnection tests - All tests passing Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
Contributor
Author
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Implements Web Serial API integration for monitoring serial devices alongside ZMK Studio connections. USB connections attempt ZMK protocol first, falling back to serial console on connection failure with seamless port reuse.
Architecture
Console Management
ConsoleContextprovides global state for multiple console instancesuseSerialPorthook wraps Web Serial API lifecycle (read/write streams, cleanup) with support for existing portsWindow System
DraggableWindowcomponent handles drag/resize with 8 resize handlesConsole Features
Connection Flow
The connection fallback checks
zmkApp.state.errorafter the connection attempt to reliably detect ZMK protocol failures. When ZMK negotiation fails, theReusableRpcTransportreleases the serial port without closing it, allowing the serial console to reuse the same connection without requiring the user to select the port again.Files
New:
src/hooks/useSerialPort.ts- Web Serial API wrapper with existing port supportsrc/components/SerialConsole.tsx- Console UI with filteringsrc/components/DraggableWindow.tsx- Window managementsrc/pages/ConsolePage.tsx- Multi-console orchestration (snapped consoles only)src/contexts/ConsoleContext.tsx- Global statesrc/types/webserial.d.ts- Type definitionssrc/lib/transport/reusableSerial.ts- Reusable transport wrapperModified:
src/App.tsx- Renders floating consoles globally, Console tab, tab transition handlingsrc/components/DeviceConnection.tsx- ReusableSerial integration, error-based fallback detectionsrc/components/SplashScreen.tsx- Fallback method bindingOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.