(input: {
readonly port: number;
readonly hostname: string;
readonly authToken: string;
})
| 167 | }; |
| 168 | |
| 169 | const resolveSidecarCommand = (input: { |
| 170 | readonly port: number; |
| 171 | readonly hostname: string; |
| 172 | readonly authToken: string; |
| 173 | }): { command: string; args: string[]; cwd: string; cliManagedManifest: boolean } => { |
| 174 | if (app.isPackaged) { |
| 175 | const binaryName = process.platform === "win32" ? "executor.exe" : "executor"; |
| 176 | const binaryPath = join(process.resourcesPath, "executor", binaryName); |
| 177 | return { |
| 178 | command: binaryPath, |
| 179 | args: [ |
| 180 | "daemon", |
| 181 | "run", |
| 182 | "--foreground", |
| 183 | "--port", |
| 184 | String(input.port), |
| 185 | "--hostname", |
| 186 | input.hostname, |
| 187 | // Combined `--flag=value` form: the auth token is base64url and can |
| 188 | // start with "-", which the space-separated form makes the CLI parser |
| 189 | // read as an unknown flag, so the daemon prints help and exits and the |
| 190 | // desktop reports a fatal "server crashed during startup". Persistent |
| 191 | // until the token rotates, and cross-platform (~1 in 64 fresh installs). |
| 192 | `--auth-token=${input.authToken}`, |
| 193 | ], |
| 194 | cwd: process.resourcesPath, |
| 195 | cliManagedManifest: true, |
| 196 | }; |
| 197 | } |
| 198 | // Dev: run the TS source directly via bun on PATH. |
| 199 | const repoRoot = resolve(import.meta.dirname, "..", "..", "..", ".."); |
| 200 | const sidecarSource = resolve(repoRoot, "apps/desktop/src/sidecar/server.ts"); |
| 201 | return { command: "bun", args: ["run", sidecarSource], cwd: repoRoot, cliManagedManifest: false }; |
| 202 | }; |
| 203 | |
| 204 | const resolveClientDir = (): string => { |
| 205 | const repoRoot = resolve(import.meta.dirname, "..", "..", "..", ".."); |
no test coverage detected