Commit 201e2a6
Refactor echoform server, harden connections, and add wmux PWA (#22)
* Harden echoform connection safety: validation, auth, and bug fixes
- Flatten plugin dirs from plugins/echoform/* to plugins/*
- Update socket.io from 4.5.3 to 4.8.3, remove stale @types packages
- Make callback validation reject by default (validateSchemaStrict),
add skipCallbackValidation prop to opt out
- Add error field to EventResponseData for client-side error handling
- Add validateConnection hook to socket-server and bun-ws-server plugins
- Add auth prop to socket-client, authToken to bun-ws-client
- Implement per-client event authorization in singleInstance mode
- Fix setMaxListeners(Infinity) → configurable limit (default 100)
- Fix broken off() in socket-server (removeAllListeners → removeListener)
- Fix event handler cleanup on client disconnect
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix security and code quality issues from critic review
Critical bugs:
- Fix error field dropped in applyBrands (decompiled-transport.ts),
making client-side validation rejection actually work
- Wrap validateConnection in try/catch in both socket-server and
bun-ws-server to prevent process crashes
- Fix stale event handlers persisting after prop deletion on view
update (previously only deleteRunningView cleaned up)
- Fix off("connection") no-op in socket-server by tracking wrapper
references for proper removeListener matching
Security:
- Prevent prototype pollution in binary deserialization via
Object.create(null)
- Remove non-null assertion on error field in binary protocol write
- Sanitize error strings sent to client (no stack traces)
- Make ValidationResult a discriminated union (illegal states
impossible)
Code quality:
- Extract authorizeEventUidsForAllClients/deauthorizeEventUidsForAllClients
helpers (DRY)
- Extract removeEventHandlers helper
- Extract buildAuthenticatedUrl from bun-ws-client
- Replace 0xFF magic number with EVENT_FALLBACK constant
- Rename abbreviated variables (p→prop, v→view)
- Remove section divider comments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix listener leaks, missing cleanup, and token rotation bugs
- Move connectionWrappers Map to useRef in socket-server so wrapper
references persist across renders (fixes off() being a no-op)
- Fire disconnect handlers in bun-ws-server stop() before clearing
client map (fixes missed application cleanup on shutdown)
- Add options?.authToken to useEffect deps in bun-ws-client so token
rotation triggers reconnection
- Add cleanup function to Server.tsx useEffect that calls
transport.off on connection handler (fixes listener leak on
transport/prop changes)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix 24 code quality and security issues from round 3 critic review
Security: add depth limit and collection length cap to binary protocol
deserialization, narrow try/catch scope in respondToEventCodec, sanitize
validation errors sent to clients, fix error leaking in socket.io
validateConnection, add auth to socket-client useEffect deps.
Code quality: refactor App.tsx into small (<20 line) functions, eliminate
5x duplicated respond_to_event emit pattern, make auth map operations
immutable (return new Maps/Sets), flatten nested ifs in bun-ws-server
and socket-server, extract DRY validation error helper, fix asymmetric
off handler, rename vague variables.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Simplify binary-protocol.ts using typed-binary high-level API
Replace hand-rolled view/event codecs with typed-binary's object(),
dynamicArrayOf(), and concat() schemas. Eliminates 9 view helper
functions, 6 EventCodec objects, the EventCodec interface, and 3
dispatch functions. Wire format is byte-compatible (verified by
round-trip tests).
Custom codecs remain only where necessary: recursive SerializableValue
(depth guards), prop schema (wire order constraint), and
respond_to_event (backward-compat try/catch).
604 lines → 349 lines (42% reduction).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add PWA support and remove TabBar in favor of sidebar-only navigation
- Add PWA manifest, service worker, and SVG icons for installability
- Add capture-phase keyboard handler for PWA shortcuts (Cmd+T, Cmd+P, Ctrl+Tab)
- Remove TabBar component; all navigation now via sidebar
- Add inline process start/stop/restart buttons on sidebar tab items
- Add PWA install banner in sidebar footer
- Detect standalone mode for additional shortcut hints
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Refactor echoform server, binary protocol, and plugin improvements
- Extract ViewReconcileContext interface to reduce parameter passing
- Export AnyTransport from shared types
- Add depth tracking to binary protocol write/measure for nesting safety
- Fix unauthorized event access check (reject when auth set missing)
- Refactor decompiled-transport: discriminated union for UnbrandedProp, direct binary emit
- Add corsOrigin option to bun-ws-server
- Remove unused type parameters in socket-client
- Refactor socket-server to use useMemo for transport, inline ServerBase props
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat/connection-safety-hardening
* Make view() return usable React components, eliminate useViews hook
view() now returns an object that is both a ViewDef (for type inference
via InferClientProps/InferServerProps) and a React.FC (for direct JSX
usage on the server). Components read from a ViewFactoryContext provided
by <App>, keeping server rendering logic out of the shared module.
This removes useViews entirely — server code imports view definitions
directly and uses them as JSX components with zero setup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix listener cleanup in Server and App effects
Add proper disconnect handler tracking and cleanup in Server.tsx,
and fix registerSocketListener effect to return cleanup function.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix readonly name property error in view() builder
Object.assign(component, def) threw because function.name is
non-writable. Exclude name from the assign since it's already
set via Object.defineProperty.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix dev-server E2E tests for multi-terminal UI
Use .first() on .xterm locators since the sidebar layout now
renders multiple terminal instances simultaneously.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix initial tab visibility and update dev-server E2E tests
Initialize activeTabId from the first category's first tab instead
of empty string, so the active tab is visible on load. Update E2E
tests to use visibility-aware selectors and sidebar-based navigation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: shmuel hizmi <shmuel@tov.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d523ebf commit 201e2a6
61 files changed
Lines changed: 1511 additions & 1355 deletions
File tree
- .claude/skills/critic-review
- demo
- dev-server/test
- file-editor/server
- system-monitor/server
- todo-app/server
- packages
- echoform
- src
- client
- server
- wmux-client
- public
- icons
- src
- components
- utils
- wmux/src/components
- plugins
- bun-ws-client
- src
- bun-ws-server
- src
- echoform
- bun-ws-client
- socket-client
- socket-server
- src
- socket-client
- src
- socket-server
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
80 | | - | |
81 | 78 | | |
82 | 79 | | |
83 | | - | |
| 80 | + | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
88 | 85 | | |
89 | | - | |
| 86 | + | |
90 | 87 | | |
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
95 | 92 | | |
96 | 93 | | |
97 | | - | |
| 94 | + | |
98 | 95 | | |
99 | 96 | | |
100 | 97 | | |
| |||
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
155 | | - | |
| 152 | + | |
156 | 153 | | |
157 | 154 | | |
158 | | - | |
| 155 | + | |
159 | 156 | | |
160 | 157 | | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
164 | | - | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
| |||
0 commit comments