(port: number, token: string)
| 89 | const manifestPath = join(serverControlDir, "server.json"); |
| 90 | |
| 91 | const writeSupervisedManifest = (port: number, token: string) => { |
| 92 | const connection = normalizeExecutorServerConnection({ |
| 93 | origin: `http://${hostname}:${port}`, |
| 94 | displayName: "Supervised daemon", |
| 95 | auth: { kind: "bearer" as const, token }, |
| 96 | }); |
| 97 | mkdirSync(serverControlDir, { recursive: true }); |
| 98 | writeFileSync( |
| 99 | manifestPath, |
| 100 | serializeExecutorLocalServerManifest({ |
| 101 | version: 1, |
| 102 | // "cli-daemon" marks an OS-supervised gateway that thin views (the |
| 103 | // desktop app, CLI) attach to rather than spawn — see the desktop's |
| 104 | // attachToSupervisedDaemon. |
| 105 | kind: "cli-daemon", |
| 106 | pid: process.pid, |
| 107 | startedAt: new Date().toISOString(), |
| 108 | dataDir, |
| 109 | scopeDir: process.env.EXECUTOR_SCOPE_DIR ?? dataDir, |
| 110 | connection, |
| 111 | owner: { |
| 112 | client: "desktop", |
| 113 | version: process.env.EXECUTOR_SERVICE_VERSION ?? null, |
| 114 | executablePath: process.execPath || null, |
| 115 | }, |
| 116 | }), |
| 117 | { mode: 0o600 }, |
| 118 | ); |
| 119 | chmodSync(manifestPath, 0o600); |
| 120 | }; |
| 121 | |
| 122 | const removeOwnManifest = () => { |
| 123 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: best-effort cleanup on shutdown |
no test coverage detected