Files
orca/src/relay/opencode-plugin-selection.ts
T
NeilandBrennan Benson 5a2aa87f1c Select OpenCode plugin exports from the execution host version (#24662)
* fix: wait for OpenCode worker composer before first dispatch

Reuse captured composer readiness on local and paired execution hosts and revoke launching-shell paste anchors.

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* feat(opencode): probe execution-host CLI capabilities

* fix(opencode): select plugin default for execution host loader

* fix(opencode): limit prompt prefill capability to verified release

* feat(opencode): probe launch capabilities on the execution host

* fix(opencode): select plugin loader for the launched host binary

* fix(opencode): match WSL probe cwd and declared guest environment

* fix(opencode): preserve launch environment deletion boundaries

* STRICT launch CI contract correction

* CAPS launch CI contract correction

* test: initialize Claude prompt state in output retention fixture

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-10-03 23:13:06 -07:00

40 lines
1.1 KiB
TypeScript

import {
getOpenCodeCliCapabilities,
type OpenCodeCliCapabilities
} from '../shared/opencode-cli-version'
import { addWslEnvKeys } from '../shared/wsl-env'
export function restoreOpenCodeCapabilities(value: unknown): OpenCodeCliCapabilities | undefined {
if (
!value ||
typeof value !== 'object' ||
!('version' in value) ||
typeof value.version !== 'string'
) {
return undefined
}
const capabilities = getOpenCodeCliCapabilities(value.version)
return capabilities.pluginApi === 'unknown' ? undefined : capabilities
}
export function applyOpenCodePluginSelection(
env: Record<string, string>,
envToDelete: string[],
capabilities: OpenCodeCliCapabilities | null | undefined,
wsl: boolean
): void {
delete env.ORCA_OPENCODE_PLUGIN_API
if (!capabilities || capabilities.pluginApi === 'unknown') {
return
}
env.ORCA_OPENCODE_PLUGIN_API = capabilities.pluginApi
for (let index = envToDelete.length - 1; index >= 0; index -= 1) {
if (envToDelete[index] === 'ORCA_OPENCODE_PLUGIN_API') {
envToDelete.splice(index, 1)
}
}
if (wsl) {
addWslEnvKeys(env, ['ORCA_OPENCODE_PLUGIN_API'])
}
}