opencode

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package opencode implements ACP sessions with shared directional metadata and task-scoped MCP. ACP (Agent Client Protocol) uses JSON-RPC 2.0 over stdin/stdout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	agent.Base
}

Backend implements agent.Backend for OpenCode using the ACP JSON-RPC 2.0 protocol.

func New

func New(cacheDir string, envVars []string) *Backend

New creates an OpenCode backend with parser configured.

func (*Backend) AgentArgs added in v0.9.1

func (*Backend) AgentArgs(_ agent.HarnessArgs) []string

AgentArgs implements agent.Backend.

func (*Backend) AttachRelay

func (*Backend) AttachRelay(ctx context.Context, opts *agent.Options) (*agent.Session, error)

AttachRelay connects after the owning record processor has replayed history.

func (*Backend) FetchModelInventory added in v0.11.3

func (*Backend) FetchModelInventory(ctx context.Context, target runtime.ConnectionTarget, extraEnv []string) (agent.ModelInventory, error)

FetchModelInventory implements agent.ModelFetcher.

func (*Backend) NewMetadataParser added in v0.15.0

func (*Backend) NewMetadataParser() agent.MessageParser

NewMetadataParser implements agent.Backend with an independent metadata projection.

func (*Backend) NewWire added in v0.9.1

func (*Backend) NewWire() agent.WireFormat

NewWire implements agent.Backend.

func (*Backend) RecordHandshake added in v0.9.1

func (*Backend) RecordHandshake(ctx context.Context, stdin io.Writer, stdout io.ReadCloser, opts *agent.Options) (io.Reader, error)

RecordHandshake performs ACP setup using the recording's continuous decoder.

func (*Backend) SetModelInventory added in v0.11.3

func (b *Backend) SetModelInventory(inventory agent.ModelInventory)

SetModelInventory implements agent.Backend, normalizing model names before storing them via the embedded Base (which owns the concurrency-safe storage).

func (*Backend) Start

func (b *Backend) Start(ctx context.Context, opts *agent.Options) (session *agent.Session, err error)

Start launches an OpenCode ACP process via the relay daemon in the given container. It performs the JSON-RPC handshake (initialize → session/new) before returning a Session.

Jump to

Keyboard shortcuts

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