Skip to main content

Module opencode_runner

Module opencode_runner 

Source
Expand description

OpenCode headless runner for ingest and enrich pipelines (v1.0.90).

Symmetric to claude_runner.rs (claude -p) and codex_spawn.rs (codex exec). Builds the opencode run command, parses NDJSON output, and provides rate-limit backoff.

Functionsยง

build_opencode_command
Build the opencode run command with hardening flags.
build_opencode_command_sync
Build a sync std::process::Command for opencode.
call_opencode
Call opencode headless and return the parsed JSON response.
find_opencode_binary
find_opencode_binary_with_override
Resolve the opencode binary path.
parse_json_from_opencode_text
Parse a JSON value from opencode output text.
parse_opencode_output
Parse the NDJSON output from opencode run --format json.
propagate_opencode_env
Propagate opencode-relevant env vars into a subprocess.
propagate_opencode_env_sync
Propagate opencode-relevant env vars into a sync subprocess.
resolve_opencode_model
Resolve the opencode model name.
resolve_opencode_timeout
Resolve the opencode timeout in seconds.
spawn_opencode
Spawn opencode with setsid for process group isolation but WITHOUT RLIMIT_AS. The Bun runtime inside opencode uses aggressive virtual memory mappings that exceed the 4 GB limit applied to claude/codex.
validate_opencode_version
Validate the installed opencode version meets the minimum requirement.