Optionaloptions: BaseAdapterOptionsReadonlynameCLI name
Protected ReadonlyparserProtected ReadonlytransientEnable transient-error retry for OpenCode (#1456).
Protected ReadonlyloggerProtectedcapacityProtectedinitializedProtected OptionallastProtected OptionalcachedReadonlytransportTransport type
Gets the capability profile for this CLI.
Gets OpenCode model information from canonical registry.
Initializes the adapter — probes available models. Warns if Anthropic provider is configured (#1429 — API key boundaries).
ProtectedgetGets CLI command and arguments for execution.
Uses opencode run with JSON format for stable parsing.
Omits --model when the requested model isn't available (#1402).
(#2540) Lists models the local OpenCode installation can route to.
Wraps the existing probeAvailableModels() (cached for the process
lifetime — see cachedModels at the top of this file) and reshapes
the result into the CliModelInfo schema. Splits provider/model ids
when present.
ProtectedinitInitializes the capacity tracker. Called by subclasses after name is set.
Executes a task with error handling and retries.
Timeout priority (highest to lowest):
Optionaloptions: CliExecutionOptionsPerforms a health check.
Gets CLI version.
Gets current capacity status based on tracked usage. Uses usage-based tracking since CLI subprocess execution doesn't expose HTTP rate limit headers.
ProtectedrecordProtectedparseParses version from CLI output.
ProtectedcheckProtectedgetGets version status message.
ProtectedcreateCreates a CLI error.
Optionalcause: ErrorProtectednormalizeNormalizes CLI response to common format.
Optionalusage: CliTokenUsageOptionalextra: Partial<CliResponse>ProtecteddelayDelays for the specified milliseconds.
Executes a task via subprocess, with optional transient-error retry.
When transientRetry.enabled is true, transient errors (timeout,
rate_limit, connection, parse) are retried with exponential backoff
(500ms, 1000ms). Parse errors get max 1 retry (#1533); others get 2.
Disposes the adapter (no-op for subprocess).
OpenCode CLI adapter using subprocess transport. Executes: opencode run --format json ""
Probes available models on first use and omits --model flag when the requested model isn't available (#1402).