Commit 8fec7cd
committed
🤖 refactor: migrate IPC layer to ORPC for type-safe RPC
Replace Electron's loosely-typed ipcMain/ipcRenderer with ORPC, providing
end-to-end type safety between frontend and backend.
Key changes:
- Add @orpc/client, @orpc/server, @orpc/zod dependencies
- Create ORPC router (src/node/orpc/router.ts) with typed procedures
- Add React ORPC provider and useORPC hook (src/browser/orpc/react.tsx)
- Extract services: WorkspaceService, ProjectService, ProviderService,
TokenizerService, TerminalService, WindowService, UpdateService
- Replace window.api.* calls with typed client.* calls throughout frontend
- Update test infrastructure to use ORPC test client (orpcTestClient.ts)
- Switch Jest transform from ts-jest to babel-jest for ESM compatibility
Breaking: Removes src/common/types/ipc.ts and src/common/constants/ipc-constants.ts
in favor of src/common/orpc/types.ts and src/common/orpc/schemas.ts
_Generated with mux_
Change-Id: Ibfeb8345e27baf663ca53ae04e4906621fda3b62
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 refactor: complete ORPC migration Phase 5 cleanup
- Delete obsolete src/browser/api.test.ts (tested legacy invokeIPC pattern)
- Update src/desktop/preload.ts comment to reflect ORPC architecture
- Remove unused StreamErrorType re-export from src/common/orpc/types.ts
_Generated with mux_
Change-Id: I27a79252ee4256558f4aab8a3c4d60d7820d6599
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: fix E2E test failures after ORPC migration
1. Fix ORPCProvider platform detection: check for window.api existence
instead of window.api.platform === 'electron' (preload exposes
process.platform which is 'darwin'/'win32'/'linux', not 'electron')
2. Fix E2E stream capture: replace assert() with inline throw since
page.evaluate() stringifies code and loses import references
_Generated with mux_
Change-Id: I9e4b35b830cea0d689845c2f4f2e68653f756e3d
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 test: fix E2E /compact test expectation
Remove outdated '📦 compacted' expectation - the compaction feature
now shows only summary text without the label marker.
_Generated with mux_
Change-Id: Ic43a3dd9d099545a58832ebf60183775843f697f
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: migrate WorkspaceConsumerManager to use ORPC client for tokenization
The tokenizer was still using the old window.api.tokenizer bridge which no longer
exists after the ORPC migration. Updated to use window.__ORPC_CLIENT__.tokenizer
instead.
This fixes the repeated 'Tokenizer IPC bridge unavailable' assertion errors
during E2E tests.
Change-Id: I43820079337ca98e0dc97e863cde9414536d107f
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: fix flaky E2E toast tests with longer duration in E2E mode
Changes:
- Expose isE2E flag via preload to renderer for E2E-specific behavior
- Increase toast auto-dismiss duration from 3s to 10s in E2E mode
- Add sendCommandAndExpectStatus helper that waits for toast concurrently
- Disable fullyParallel for Electron tests to avoid timing issues
- Update tests to use new helper for reliable toast assertions
The root cause was that toasts auto-dismiss after 3 seconds, but under
parallel test execution the timing variance meant assertions could miss
observing the toast before it disappeared.
Change-Id: I
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: fix StreamCollector race condition in integration tests
The StreamCollector was marking the subscription as ready immediately after
getting the async iterator, but the ORPC generator body (which sets up the
actual subscription) doesn't run until iteration starts.
Changes:
- Add waitForSubscription() method that waits for first event
- Mark subscription as ready after receiving first event (from history replay)
- Add small delay after subscription ready to stabilize under load
- Update sendMessageAndWait to use the new synchronization
This fixes flaky integration tests in runtimeFileEditing.test.ts where
streaming events were sometimes missed due to the race condition.
Change-Id: I1f697dbf9486a45c9335fd00c42fb54853715ed3
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: restore native terminal opening for Electron desktop mode
The ORPC migration inadvertently changed the terminal opening behavior:
- Before: Clicking terminal button opened the user's native terminal app
(Ghostty, Terminal.app, etc.) with cwd set to workspace path
- After: It opened an xterm.js web terminal in an Electron popup window
This restores the original behavior by:
1. Adding TerminalService.openNative() method with platform-specific logic:
- macOS: Ghostty (if available) or Terminal.app
- Windows: cmd.exe
- Linux: x-terminal-emulator, ghostty, alacritty, kitty, etc.
2. Adding ORPC endpoint terminal.openNative for the new method
3. Updating useOpenTerminal hook to call openNative for Electron mode
The web terminal (openWindow) is still available for browser mode.
Added comprehensive unit tests to prevent this regression:
- Tests for macOS Terminal.app and Ghostty detection
- Tests for Windows cmd opening
- Tests for Linux terminal emulator discovery
- Tests for SSH workspace handling
- Tests for error conditions
Change-Id: Ib01af78cab49cb6ed3486eaaee85277f4b3daa15
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: guard against undefined event.key in matchesKeybind
Certain keyboard events (dead keys for accents, modifier-only events, etc.)
can have event.key as undefined, causing a TypeError when calling toLowerCase().
Added defensive check to return false early when event.key is falsy.
Added unit tests for the keybinds utility.
Change-Id: I3784275ea2f0bd1206c548e3014854f259bc7a3e
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 refactor: rename IpcMain to ServiceContainer and fix review issues
- Rename IpcMain class to ServiceContainer to reflect its actual purpose
as a dependency container for ORPC services
- Move tests/ipcMain/ to tests/integration/ for clarity
- Fix provider config: empty string values now delete keys (allows clearing API keys)
- Fix WorkspaceContext: add missing `client` dependency in createWorkspace
- Fix schemas: add missing compacted/cmuxMetadata fields, remove stale entries
- Fix updater: remove unused mainWindow field and setMainWindow method
Change-Id: Iea939ecdcbb986f5a4f38a8cd2d7f250e8497dcf
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 fix: guard TitleBar against missing window.api in browser mode
Change-Id: Ic6d1ddef2d3a9e3b047d1d6598e583d4ca345c57
Signed-off-by: Thomas Kosiewski <tk@coder.com>
cleanup
Change-Id: Ia6374d2f4e3696709536c93b2488d4bf0f3fda0f
Signed-off-by: Thomas Kosiewski <tk@coder.com>
🤖 feat: add auth middleware to oRPC router
Add bearer token authentication for HTTP and WebSocket endpoints using
oRPC's native middleware pattern. Headers are injected into context at
the transport layer, allowing a unified middleware to handle both.
- Create authMiddleware.ts with createAuthMiddleware and extractWsHeaders
- Update ORPCContext to include optional headers field
- Apply auth middleware to router via t.use()
- Inject headers into context in orpcServer.ts for HTTP and WS
- Support WS auth fallbacks: query param, Authorization header, protocol
Change-Id: Ief9b8b6d03d1f0161b996ac5d88ce2807e910c94
Signed-off-by: Thomas Kosiewski <tk@coder.com>
fix: return actual path from listDirectory, not empty string
The listDirectory function was using buildFileTree() which creates a
synthetic root with name: '' and path: ''. This broke DirectoryPickerModal
which relies on root.path for:
- Displaying the current directory path in the UI
- Computing parent directory via ${root.path}/..
- Returning the selected path to the caller
Fixed by returning a FileTreeNode with the resolved absolute path as both
name and path, matching the original IPC handler behavior.
Added regression tests to prevent this from happening again.
Change-Id: Iaddcbc3982c4f2440bcd92420e295881bf4fe90c
Signed-off-by: Thomas Kosiewski <tk@coder.com>1 parent 80cecf2 commit 8fec7cd
File tree
174 files changed
+12276
-12130
lines changed- .github
- actions/setup-mux
- workflows
- .storybook
- mocks
- docs
- theme
- scripts
- src
- browser
- components
- ChatInput
- RightSidebar/CodeReview
- Settings
- sections
- hooks
- contexts
- hooks
- orpc
- stores
- styles
- utils
- commands
- compaction
- messages
- tokenizer
- ui
- cli
- debug
- common
- constants
- orpc
- telemetry
- types
- utils/tools
- desktop
- node
- bench
- orpc
- services
- tools
- server
- tests
- __mocks__
- e2e
- scenarios
- utils
- integration
- ipcMain
- vscode
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
174 files changed
+12276
-12130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments