11import { Config } from "effect"
2+ import { InstallationChannel } from "../installation/version"
23
34function truthy ( key : string ) {
45 const value = process . env [ key ] ?. toLowerCase ( )
@@ -10,6 +11,10 @@ function falsy(key: string) {
1011 return value === "false" || value === "0"
1112}
1213
14+ // Channels that default to the new effect-httpapi server backend. The legacy
15+ // hono backend remains the default for stable (`prod`/`latest`) installs.
16+ const HTTPAPI_DEFAULT_ON_CHANNELS = new Set ( [ "dev" , "beta" , "local" ] )
17+
1318function number ( key : string ) {
1419 const value = process . env [ key ]
1520 if ( ! value ) return undefined
@@ -81,7 +86,14 @@ export const Flag = {
8186 OPENCODE_STRICT_CONFIG_DEPS : truthy ( "OPENCODE_STRICT_CONFIG_DEPS" ) ,
8287
8388 OPENCODE_WORKSPACE_ID : process . env [ "OPENCODE_WORKSPACE_ID" ] ,
84- OPENCODE_EXPERIMENTAL_HTTPAPI : truthy ( "OPENCODE_EXPERIMENTAL_HTTPAPI" ) ,
89+ // Defaults to true on dev/beta/local channels so internal users exercise the
90+ // new effect-httpapi server backend. Stable (`prod`/`latest`) installs stay
91+ // on the legacy hono backend until the rollout is complete. An explicit env
92+ // var ("true"/"1" or "false"/"0") always wins, providing an opt-in for
93+ // stable users and an escape hatch for dev/beta users.
94+ OPENCODE_EXPERIMENTAL_HTTPAPI :
95+ truthy ( "OPENCODE_EXPERIMENTAL_HTTPAPI" ) ||
96+ ( ! falsy ( "OPENCODE_EXPERIMENTAL_HTTPAPI" ) && HTTPAPI_DEFAULT_ON_CHANNELS . has ( InstallationChannel ) ) ,
8597 OPENCODE_EXPERIMENTAL_WORKSPACES : OPENCODE_EXPERIMENTAL || truthy ( "OPENCODE_EXPERIMENTAL_WORKSPACES" ) ,
8698
8799 // Evaluated at access time (not module load) because tests, the CLI, and
0 commit comments