1 · Derive the browser RPC client from the contract
Strong
in-process
- src/lib/frontend/transport/ws-rpc-client.ts · 1778 lines
- src/lib/contracts/ws-rpc.ts · WsRpcRequest :2616 · WsRpcGroup :3050
- src/lib/server/ws-rpc.ts · barrel :42-183 · DaemonRpcName :367-393
- src/lib/frontend/transport/ws-rpc.ts · src/lib/handlers/index.ts (barrels)
- test/e2e/helpers/rpc-mock.ts · test/unit/contracts/ws-rpc-contract.test.ts
Before · ws-rpc-client is shallow
interface
implementation
Touched per new RPC
classWsRpcRequestWsRpcGrouphandlerPick listfailure labelclient wrapper*RpcInputtest stubrpc-mock encoder
After · one deep client
interface
implementation
Touched per new RPC
class + group entryhandlertest stub
- Problem
- Each RPC's name and payload are restated in 7–8 places, and the client module is 98 wrappers whose interface is as large as their bodies.
- Solution
- One client derived from
WsRpcGroupowns the Promise edge, project routing and typed errors;WsRpcRequestderives from the group; the barrels go.
- Interface shrinks: 98 wrappers → 1
- Leverage: 122 RPCs, one call path
- Locality: typed errors handled once
- Delete 71 hand-copied input types
- Contract test stays the test surface