opencode

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package opencode implements adapters.HarnessAdapter for the opencode CLI.

Run() forks `opencode run` with signal forwarding and exit normalisation. Unlike the claude adapter, session persistence, payload-patch application, and boid task notify integration are not wired.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

Adapter implements adapters.HarnessAdapter for the opencode CLI.

func New

func New() *Adapter

New returns a new Adapter.

func (*Adapter) Bindings

func (a *Adapter) Bindings(homeDir string) []adapters.BindMount

Bindings declares the host bind-mounts opencode.Adapter.Run() needs inside the sandbox.

Returns nil: opencode CLI state and skills reach the sandbox via the workspace HOME volume (internal/dispatcher/workspace_home.go) and dispatcher-owned skill mounts (skills_overlay.go) instead of an adapter-declared bind. The opencode CLI binary itself is expected to be installed into that workspace home by the workspace's init.sh; a missing binary fails fast with an explicit message from Run() (run.go's missingCLIError).

Non-embedded host skills (bitbucket, jira, google-* etc.) have no adapter-side exposure path: a workspace that wants opencode to see them is the workspace author's responsibility, via the workspace's init.sh copying them into the workspace home (e.g. `cp -r ~/.claude/skills/<name> "$BOID_WORKSPACE_HOME/.claude/skills/"`).

func (*Adapter) Run

Run forks opencode. Interactive vs non-interactive is keyed off rc.TaskID: session jobs (JobKindSession) carry no task and are user-initiated, so they land in interactive TUI mode; hook jobs carry a BOID_TASK_ID and fall through to non-interactive `opencode run`. Mirrors the codex adapter and how the claude adapter discriminates JobKindSession from JobKindHook via rc.TaskID == "".

Other responsibilities mirror the claude / codex adapters: signal forwarding via sigutil, exit code normalisation for daemon-initiated stops, PWD strip on the child env, and cmd.Dir as the source of truth for the workdir.

Session persistence and payload-patch application are deliberately NOT wired here — interactive sessions are run-and-done, no resume yet.

func (*Adapter) Usage

func (a *Adapter) Usage(_ context.Context, _ string) (adapters.Usage, error)

Usage is not yet implemented (see codex.Adapter.Usage for the same rationale).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL