opencode

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAgentPath

func FindAgentPath() (string, error)

Types

type ACPAdapter

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

func NewACPAdapter

func NewACPAdapter(agent *OpencodeAgent) *ACPAdapter

func (*ACPAdapter) Authenticate

func (a *ACPAdapter) Authenticate(req agentacp.AuthenticateRequest) error

func (*ACPAdapter) CancelSession

func (a *ACPAdapter) CancelSession(req agentacp.CancelSessionRequest) error

func (*ACPAdapter) CloseSession

func (a *ACPAdapter) CloseSession(req agentacp.CloseSessionRequest) error

func (*ACPAdapter) Info

func (a *ACPAdapter) Info() agentacp.AgentInfo

func (*ACPAdapter) ListSessions

func (*ACPAdapter) NewSession

func (*ACPAdapter) Prompt

func (a *ACPAdapter) Prompt(req agentacp.PromptRequest, onUpdate func(agentacp.SessionUpdate)) error

func (*ACPAdapter) ResumeSession

func (a *ACPAdapter) ResumeSession(req agentacp.ResumeSessionRequest) error

type AgentOption

type AgentOption func(*OpencodeAgent)

func WithAgentPath

func WithAgentPath(path string) AgentOption

func WithDisableSubAgents

func WithDisableSubAgents() AgentOption

func WithEnv

func WithEnv(env []string) AgentOption

func WithWorkspace

func WithWorkspace(dir string) AgentOption

type FileChange

type FileChange = run.FileChange

type Model

type Model struct {
	ID         string `json:"id"`
	ProviderID string `json:"providerID,omitempty"`
	Name       string `json:"name,omitempty"`
}

type OpencodeAgent

type OpencodeAgent struct {
	AgentPath        string
	Workspace        string
	Env              []string
	DisableSubAgents bool
}

func NewAgent

func NewAgent(opts ...AgentOption) *OpencodeAgent

func (*OpencodeAgent) BuildEnv

func (a *OpencodeAgent) BuildEnv() []string

func (*OpencodeAgent) ListModels

func (a *OpencodeAgent) ListModels(ctx context.Context) ([]Model, error)

func (*OpencodeAgent) ListSessions

func (a *OpencodeAgent) ListSessions(ctx context.Context) ([]Session, error)

func (*OpencodeAgent) ResolvePath

func (a *OpencodeAgent) ResolvePath() (string, error)

func (*OpencodeAgent) ResumeSession

func (a *OpencodeAgent) ResumeSession(ctx context.Context, sessionID string, prompt string, opts *SessionOpts, onEvent StreamCallback) (string, error)

func (*OpencodeAgent) StartSession

func (a *OpencodeAgent) StartSession(ctx context.Context, prompt string, opts *SessionOpts, onEvent StreamCallback) (string, error)

type Session

type Session struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
	ProjectID string    `json:"projectId,omitempty"`
	Directory string    `json:"directory,omitempty"`
}

type SessionExport

type SessionExport struct {
	Messages []SessionExportMessage `json:"messages"`
}

type SessionExportCache

type SessionExportCache struct {
	Write int64 `json:"write"`
	Read  int64 `json:"read"`
}

type SessionExportMessage

type SessionExportMessage struct {
	Info  SessionExportMessageInfo `json:"info"`
	Parts []SessionExportPart      `json:"parts"`
}

type SessionExportMessageInfo

type SessionExportMessageInfo struct {
	Role string `json:"role"`
}

type SessionExportPart

type SessionExportPart struct {
	Type      string               `json:"type"`
	Text      string               `json:"text,omitempty"`
	Tool      string               `json:"tool,omitempty"`
	CallID    string               `json:"callID,omitempty"`
	ID        string               `json:"id,omitempty"`
	SessionID string               `json:"sessionID,omitempty"`
	MessageID string               `json:"messageID,omitempty"`
	State     *SessionExportState  `json:"state,omitempty"`
	Snapshot  string               `json:"snapshot,omitempty"`
	Reason    string               `json:"reason,omitempty"`
	Hash      string               `json:"hash,omitempty"`
	Files     []string             `json:"files,omitempty"`
	Time      *SessionExportTime   `json:"time,omitempty"`
	Tokens    *SessionExportTokens `json:"tokens,omitempty"`
	Cost      float64              `json:"cost,omitempty"`
}

type SessionExportState

type SessionExportState struct {
	Status   string             `json:"status,omitempty"`
	Title    string             `json:"title,omitempty"`
	Output   string             `json:"output,omitempty"`
	Input    json.RawMessage    `json:"input,omitempty"`
	Metadata json.RawMessage    `json:"metadata,omitempty"`
	Time     *SessionExportTime `json:"time,omitempty"`
}

type SessionExportTime

type SessionExportTime struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

type SessionExportTokens

type SessionExportTokens struct {
	Total     int64               `json:"total"`
	Input     int64               `json:"input"`
	Output    int64               `json:"output"`
	Reasoning int64               `json:"reasoning"`
	Cache     *SessionExportCache `json:"cache,omitempty"`
}

type SessionOpts

type SessionOpts = run.SessionOpts

type StreamCallback

type StreamCallback = run.StreamCallback

type StreamEvent

type StreamEvent = run.StreamEvent

type StreamEventTime

type StreamEventTime = run.StreamEventTime

type ToolUseEvent

type ToolUseEvent = run.ToolUseEvent

Directories

Path Synopsis
ai_critic

Jump to

Keyboard shortcuts

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