refactor(desktop): inline v2 sidecar flag

This commit is contained in:
Brendan Allan 2026-07-28 17:01:20 +08:00
commit 6fb752ad69
No known key found for this signature in database
GPG key ID: 41E835AEA046A32E
3 changed files with 1 additions and 13 deletions

View file

@ -49,7 +49,6 @@ import { spawnWslSidecar } from "./wsl/sidecar"
import { migrate } from "./migrate"
import { cleanupStoreFiles } from "./store-cleanup"
import { startBackgroundCli } from "./background-cli"
import { resolveSidecarVersion } from "./sidecar-version"
const APP_NAMES: Record<string, string> = {
dev: "OpenCode Dev",
@ -62,7 +61,7 @@ const APP_IDS: Record<string, string> = {
prod: "ai.opencode.desktop",
}
const TEST_ONBOARDING = process.env.OPENCODE_TEST_ONBOARDING === "1"
const SIDECAR_VERSION = resolveSidecarVersion()
const SIDECAR_VERSION = process.env.OPENCODE_SIDECAR_V2 === "1" ? "v2" : "v1"
const jsCallStackFeature = "DocumentPolicyIncludeJSCallStacksInCrashReports"
let logger: ReturnType<typeof initLogging>

View file

@ -1,8 +0,0 @@
import { expect, test } from "bun:test"
import { resolveSidecarVersion } from "./sidecar-version"
test("enables the v2 sidecar only for OPENCODE_SIDECAR_V2=1", () => {
expect(resolveSidecarVersion("1")).toBe("v2")
expect(resolveSidecarVersion("0")).toBe("v1")
expect(resolveSidecarVersion(undefined)).toBe("v1")
})

View file

@ -1,3 +0,0 @@
export function resolveSidecarVersion(value = process.env.OPENCODE_SIDECAR_V2) {
return value === "1" ? "v2" : "v1"
}