(command: StartCommand)
| 49 | }) |
| 50 | |
| 51 | async function start(command: StartCommand) { |
| 52 | try { |
| 53 | prepareSidecarEnv(command.password, command.userDataPath) |
| 54 | ensureLoopbackNoProxy() |
| 55 | useSystemCertificates() |
| 56 | useEnvProxy() |
| 57 | const { Server } = await import("virtual:opencode-server") |
| 58 | |
| 59 | listener = await Server.listen({ |
| 60 | port: command.port, |
| 61 | hostname: command.hostname, |
| 62 | username: "opencode", |
| 63 | password: command.password, |
| 64 | cors: ["oc://renderer"], |
| 65 | }) |
| 66 | parentPort.postMessage({ type: "ready" }) |
| 67 | } catch (error) { |
| 68 | parentPort.postMessage({ type: "error", error: serializeError(error) }) |
| 69 | setImmediate(() => process.exit(1)) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | async function stop() { |
| 74 | try { |
no test coverage detected