agent

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	Name() string
	Available() (bool, error)
	StartSession(ctx context.Context, opts SessionOpts) (Session, error)
	ResumeSession(ctx context.Context, sessionID string) (Session, error)
}

type AgentEvent

type AgentEvent struct {
	Type    EventType
	Content string
	Tool    *ToolUse
	Meta    EventMeta
}

type AiderAgent

type AiderAgent struct {
	BaseAgent
}

func NewAiderAgent

func NewAiderAgent(command string) *AiderAgent

func (*AiderAgent) StartSession

func (a *AiderAgent) StartSession(ctx context.Context, opts SessionOpts) (Session, error)

type BaseAgent

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

func (*BaseAgent) Available

func (a *BaseAgent) Available() (bool, error)

func (*BaseAgent) Name

func (a *BaseAgent) Name() string

func (*BaseAgent) ResumeSession

func (a *BaseAgent) ResumeSession(ctx context.Context, sessionID string) (Session, error)

func (*BaseAgent) StartPTYSession

func (a *BaseAgent) StartPTYSession(ctx context.Context, opts SessionOpts, exitInput string) (Session, error)

type ClaudeAgent

type ClaudeAgent struct {
	BaseAgent
}

func NewClaudeAgent

func NewClaudeAgent(command string) *ClaudeAgent

func (*ClaudeAgent) StartSession

func (a *ClaudeAgent) StartSession(ctx context.Context, opts SessionOpts) (Session, error)

type CodexAgent

type CodexAgent struct {
	BaseAgent
}

func NewCodexAgent

func NewCodexAgent(command string) *CodexAgent

func (*CodexAgent) StartSession

func (a *CodexAgent) StartSession(ctx context.Context, opts SessionOpts) (Session, error)

type EventMeta

type EventMeta struct {
	Cost     float64
	Tokens   int
	Duration time.Duration
}

type EventType

type EventType int
const (
	EventInit EventType = iota
	EventText
	EventTextDone
	EventToolStart
	EventToolResult
	EventComplete
	EventError
)

type OpenCodeAgent

type OpenCodeAgent struct {
	BaseAgent
}

func NewOpenCodeAgent

func NewOpenCodeAgent(command string) *OpenCodeAgent

func (*OpenCodeAgent) StartSession

func (a *OpenCodeAgent) StartSession(ctx context.Context, opts SessionOpts) (Session, error)

type PTYProvider

type PTYProvider interface {
	PTY() *os.File
}

type PTYSession

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

func NewPTYSession

func NewPTYSession(pty *terminal.PTYHandle, agentName, label, id, exitInput string) *PTYSession

func (*PTYSession) AgentName

func (s *PTYSession) AgentName() string

func (*PTYSession) Cancel

func (s *PTYSession) Cancel()

func (*PTYSession) Close

func (s *PTYSession) Close() error

func (*PTYSession) Events

func (s *PTYSession) Events() <-chan AgentEvent

func (*PTYSession) ID

func (s *PTYSession) ID() string

func (*PTYSession) Label

func (s *PTYSession) Label() string

func (*PTYSession) PTY

func (s *PTYSession) PTY() *os.File

func (*PTYSession) Send

func (s *PTYSession) Send(ctx context.Context, prompt string) error

func (*PTYSession) SetLabel

func (s *PTYSession) SetLabel(l string)

func (*PTYSession) State

func (s *PTYSession) State() SessionState

type Registry

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

func NewDefaultRegistry

func NewDefaultRegistry(cfg *config.Config) *Registry

func NewRegistry

func NewRegistry() *Registry

func (*Registry) All

func (r *Registry) All() []Agent

func (*Registry) Available

func (r *Registry) Available() []Agent

func (*Registry) Get

func (r *Registry) Get(name string) (Agent, error)

func (*Registry) Register

func (r *Registry) Register(a Agent)

type Session

type Session interface {
	ID() string
	Label() string
	SetLabel(string)
	AgentName() string
	Send(ctx context.Context, prompt string) error
	Events() <-chan AgentEvent
	Cancel()
	Close() error
	State() SessionState
}

type SessionOpts

type SessionOpts struct {
	Model     string
	WorkDir   string
	ExtraArgs []string
}

type SessionState

type SessionState int
const (
	StateIdle SessionState = iota
	StateRunning
	StateError
	StateClosed
)

func (SessionState) String

func (s SessionState) String() string

type ToolUse

type ToolUse struct {
	ID     string
	Name   string
	Input  string
	Output string
}

Jump to

Keyboard shortcuts

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