INNER CODE UNIT · TypeScript
rpc
Hmbown/CodeWhale · crates/tui/extension-host/src/main.ts:97
const rpc = new RpcPeer((message: Message) => {
channelWrite(encodeFrame(message))
})
const host = new HostRoot(rpc)
let initialized = false
rpc.onRequest('host/initialize', (params: any) => {
if (params.protocol !== PROTOCOL_VERSION) {
stderrWrite(`codewhale-extension-host: core speaks protocol ${params.protocol}, host speaks ${PROTOCOL_VERSION}\n`)
setImmediate(() => realExit(78))
throw new RpcError(ErrorCode.InvalidParams, `unsupported protocol ${params.protocol}`)
}
initialized = true
setImmediate(() => rpc.notify('host/ready', {}))
return {}
})
function requireInitialized() {