Help us shape the future of Go! Take the 2026 Go Developer Survey

opencode

package
v0.1.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: CC0-1.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PinnedTag          = pin.EndpointVersion
	PinnedCommit       = pin.Source("opencode").Commit
	CapabilityRevision = pin.CapabilityRevision
	CorpusDirectory    = pin.Corpus
)
View Source
var (
	ErrNativeProtocol = errors.New("opencode adapter: invalid native protocol observation")
	ErrUnsupported    = errors.New("opencode adapter: unsupported input")
)

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Adapter, error)

func (*Adapter) Open

func (a *Adapter) Open(ctx context.Context, req base.OpenRequest) (base.Session, error)

func (*Adapter) Probe

func (a *Adapter) Probe(ctx context.Context) (base.Descriptor, error)

type Client

type Client interface {
	CreateSession(ctx context.Context, request httpapi.CreateSessionRequest) (native.SessionInfo, error)
	Session(ctx context.Context, session native.SessionID) (native.SessionInfo, error)
	SwitchModel(ctx context.Context, session native.SessionID, model native.ModelRef) error
	Prompt(ctx context.Context, session native.SessionID, request native.PromptRequest) (native.Admitted, error)
	Interrupt(ctx context.Context, session native.SessionID) error
	Active(ctx context.Context) (map[native.SessionID]bool, error)
	History(ctx context.Context, session native.SessionID, after int64, limit int) (native.HistoryPage, error)
	Subscribe(ctx context.Context, session native.SessionID, after int64) (Subscription, error)
	Close() error
}

type ClientFactory

type ClientFactory interface {
	Start(ctx context.Context) (Client, error)
}

type ClientFactoryFunc

type ClientFactoryFunc func(context.Context) (Client, error)

func (ClientFactoryFunc) Start

func (f ClientFactoryFunc) Start(ctx context.Context) (Client, error)

type Config

type Config struct {
	Factory         ClientFactory
	Endpoint        string
	Username        string
	Password        string
	HTTP            *http.Client
	Agent           string
	Model           *native.ModelRef
	Clock           base.Clock
	IDs             base.IDGenerator
	JournalCapacity int
	FrameLimit      int
	QueueCapacity   int
	HistoryLimit    int

	SettlePollMin time.Duration
	SettlePollMax time.Duration
}

type Subscription

type Subscription interface {
	Events() <-chan native.Event
	Done() <-chan struct{}
	Err() error
	Close() error
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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