Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/desktop/src/main/service/background-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const connect = Effect.fn("BackgroundService.connect")(function* (mode: "initial
const desktopCli = yield* DesktopCli.Service
const runFork = Effect.runForkWith(yield* Effect.context())
const isolated = !app.isPackaged && process.env.OPENCODE_DESKTOP_ISOLATED_SERVER === "1"
// Packaged builds and the isolated dev server both run a staged CLI copy under userData, so both
// should prune stale stages; a non-isolated dev app runs the repo binary in place.
const staged = app.isPackaged || isolated
const cli = yield* desktopCli.resolve
const version = mode === "initial" ? cli.version : undefined

Expand Down Expand Up @@ -76,7 +79,7 @@ const connect = Effect.fn("BackgroundService.connect")(function* (mode: "initial
...endpoint(url.origin),
})

if (mode === "initial" && isolated && cli.binary) yield* cleanStages(cli.binary).pipe(Effect.orDie)
if (mode === "initial" && staged && cli.binary) yield* cleanStages(cli.binary).pipe(Effect.orDie)
const ready = { url: url.origin, password: service.auth.password } satisfies SidecarCredentials.Data
SidecarCredentials.set(ready)

Expand Down
Loading