| 1 | // Package hostrpc is the Go side of the desktop host protocol |
| 2 | // (docs/DESKTOP_HOST_PROTOCOL.md): one JSON-RPC 2.0 connection over the |
| 3 | // service's stdio joining the Electron shell to the desktop App. |
| 4 | // |
| 5 | // Registry reflects over the exported methods of the bound App value the way |
| 6 | // the retired shell did, rejects any signature the shell could not call, and invokes a |
| 7 | // method from JSON arguments. Contract freezes the accepted commands, the |
| 8 | // event names and every DTO shape into canonical JSON whose SHA-256 digest |
| 9 | // both sides compare during the hello handshake; WriteTypeScript renders the |
| 10 | // same contract as the typed table the renderer compiles against. |
| 11 | // |
| 12 | // Server owns the wire: it gates every request behind desktop/hello, |
| 13 | // performs the protocol, contract, build and instance checks, routes |
| 14 | // lifecycle requests to Hooks, dispatches desktop/invoke through the |
| 15 | // registry, writes desktop/event notifications from one sequence, and issues |
| 16 | // host/* reverse requests. It imports no shell toolkit, so tests drive it |
| 17 | // through an in-memory rpcwire peer. |
| 18 | package hostrpc |
| 19 |