|
@@ -1,4 +1,5 @@
|
|
|
import { Config } from "effect"
|
|
import { Config } from "effect"
|
|
|
|
|
+import { InstallationChannel } from "../installation/version"
|
|
|
|
|
|
|
|
function truthy(key: string) {
|
|
function truthy(key: string) {
|
|
|
const value = process.env[key]?.toLowerCase()
|
|
const value = process.env[key]?.toLowerCase()
|
|
@@ -10,6 +11,10 @@ function falsy(key: string) {
|
|
|
return value === "false" || value === "0"
|
|
return value === "false" || value === "0"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// Channels that default to the new effect-httpapi server backend. The legacy
|
|
|
|
|
+// hono backend remains the default for stable (`prod`/`latest`) installs.
|
|
|
|
|
+const HTTPAPI_DEFAULT_ON_CHANNELS = new Set(["dev", "beta", "local"])
|
|
|
|
|
+
|
|
|
function number(key: string) {
|
|
function number(key: string) {
|
|
|
const value = process.env[key]
|
|
const value = process.env[key]
|
|
|
if (!value) return undefined
|
|
if (!value) return undefined
|
|
@@ -81,7 +86,14 @@ export const Flag = {
|
|
|
OPENCODE_STRICT_CONFIG_DEPS: truthy("OPENCODE_STRICT_CONFIG_DEPS"),
|
|
OPENCODE_STRICT_CONFIG_DEPS: truthy("OPENCODE_STRICT_CONFIG_DEPS"),
|
|
|
|
|
|
|
|
OPENCODE_WORKSPACE_ID: process.env["OPENCODE_WORKSPACE_ID"],
|
|
OPENCODE_WORKSPACE_ID: process.env["OPENCODE_WORKSPACE_ID"],
|
|
|
- OPENCODE_EXPERIMENTAL_HTTPAPI: truthy("OPENCODE_EXPERIMENTAL_HTTPAPI"),
|
|
|
|
|
|
|
+ // Defaults to true on dev/beta/local channels so internal users exercise the
|
|
|
|
|
+ // new effect-httpapi server backend. Stable (`prod`/`latest`) installs stay
|
|
|
|
|
+ // on the legacy hono backend until the rollout is complete. An explicit env
|
|
|
|
|
+ // var ("true"/"1" or "false"/"0") always wins, providing an opt-in for
|
|
|
|
|
+ // stable users and an escape hatch for dev/beta users.
|
|
|
|
|
+ OPENCODE_EXPERIMENTAL_HTTPAPI:
|
|
|
|
|
+ truthy("OPENCODE_EXPERIMENTAL_HTTPAPI") ||
|
|
|
|
|
+ (!falsy("OPENCODE_EXPERIMENTAL_HTTPAPI") && HTTPAPI_DEFAULT_ON_CHANNELS.has(InstallationChannel)),
|
|
|
OPENCODE_EXPERIMENTAL_WORKSPACES: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES"),
|
|
OPENCODE_EXPERIMENTAL_WORKSPACES: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES"),
|
|
|
|
|
|
|
|
// Evaluated at access time (not module load) because tests, the CLI, and
|
|
// Evaluated at access time (not module load) because tests, the CLI, and
|