fix(cli): elect managed service by port bind (#37572)

Co-authored-by: Dax Raad <thdxr@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot] 2026-07-17 23:12:36 +00:00 committed by GitHub
commit 6ea8247e0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 232 additions and 39 deletions

View file

@ -30,6 +30,12 @@ export function filename(channel = InstallationChannel) {
return `service-${Hash.fast(channel)}.json`
}
export function defaultPort(channel = InstallationChannel) {
if (channel === "latest") return 0xc0de
if (channel === "local") return 0xc0df
return 10_000 + (Number.parseInt(Hash.fast(channel).slice(0, 8), 16) % 50_000)
}
export function versionBelongsToChannel(
version: string | undefined,
channel = InstallationChannel,