refactor(opencode): consolidate v2 migration helpers and harden install, proxy, and session flows

- extract shared semver and model-ref utilities, reuse across version checks
- share the OpenCode release download script across Docker, entrypoint, dev setup
- unify install/upgrade failure recovery and guard externally managed OPENCODE_BIN
- scope the repo proxy location rewrite and surface ocm proxy errors
- rework frontend session projection, permission lookup, and cache invalidation
This commit is contained in:
Chris Scott committed 2026-09-25 18:07:30 -04:00
1 parent f5d0f0c27e
commit 5593163099
115 files changed
+3027 -1204

No files matched your search

+3 -2
View File
@@ -7,7 +7,7 @@ import { randomBytes } from 'crypto'
import os from 'os'
import path from 'path'
import { buildOpenCodeBasicAuth, isSupportedOpenCodeVersion } from '@opencode-manager/shared/opencode'
import { OPENCODE_SERVICE_SERVE_ARGS, prepareOpenCodeServiceLaunch } from '../../src/services/opencode-service-mode'
import { OPENCODE_SERVICE_SERVE_ARGS, getOpenCodeServiceRegistrationPath, writeOpenCodeServiceSettings } from '../../src/services/opencode-service-mode'
const VERSION_TIMEOUT_MS = 5000
const SERVE_READY_TIMEOUT_MS = 60000
@@ -169,7 +169,8 @@ export async function startOpenCodeServe(options: OpenCodeServeOptions = {}): Pr
OPENCODE_SERVER_PASSWORD: password,
}
if (options.service) {
await prepareOpenCodeServiceLaunch({ XDG_CONFIG_HOME: directories.configHome, XDG_STATE_HOME: directories.stateHome, OPENCODE_CONFIG_DIR: env.OPENCODE_CONFIG_DIR }, password)
await rm(getOpenCodeServiceRegistrationPath({ XDG_CONFIG_HOME: directories.configHome, XDG_STATE_HOME: directories.stateHome }), { force: true })
await writeOpenCodeServiceSettings(path.join(directories.configHome, 'opencode'), password)
}
const port = options.port ?? await getFreePort()