externalagents

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupBinary added in v0.2.0

func LookupBinary(name string, path string) (string, error)

LookupBinary resolves an agent CLI from a configured path or name, then from the usual global npm, nvm, asdf and Homebrew locations.

Types

type AttachmentStore

type AttachmentStore interface {
	SaveExternalAgentSession(ctx context.Context, attachment SessionAttachment) error
	GetExternalAgentSession(ctx context.Context, sessionID string) (SessionAttachment, error)
	// ListExternalAgentSessions returns the attachments of those sessions
	// that have one.
	ListExternalAgentSessions(ctx context.Context, sessionIDs []string) ([]SessionAttachment, error)
	DeleteExternalAgentSession(ctx context.Context, sessionID string) error
}

type Availability

type Availability struct {
	Installed bool
	Enabled   bool
	Mode      string
	Path      string
	Version   string
	Detail    string
}

type BinaryProbe added in v0.2.0

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

BinaryProbe remembers where an agent CLI was found and its version, so listing agents spawns `--version` once rather than on every prompt build.

func NewBinaryProbe added in v0.2.0

func NewBinaryProbe(name string, path string) *BinaryProbe

func (*BinaryProbe) Probe added in v0.2.0

func (p *BinaryProbe) Probe(ctx context.Context) (string, string, error)

Probe returns the resolved binary and its version; a binary that is not found yet is looked up again on the next call.

type Descriptor

type Descriptor struct {
	ID          string
	Aliases     []string
	DisplayName string
	Installed   bool
	Enabled     bool
	Mode        string
	Path        string
	Version     string
	Detail      string
}

type Event

type Event struct {
	Kind              EventKind `json:"kind"`
	AgentID           string    `json:"agent_id"`
	ExternalThreadID  string    `json:"external_thread_id,omitempty"`
	ExternalSessionID string    `json:"external_session_id,omitempty"`
	ExternalTurnID    string    `json:"external_turn_id,omitempty"`
	ItemID            string    `json:"item_id,omitempty"`
	ToolName          string    `json:"tool_name,omitempty"`
	ToolInput         string    `json:"tool_input,omitempty"`
	Text              string    `json:"text,omitempty"`
	Error             string    `json:"error,omitempty"`
	At                time.Time `json:"at"`
}

type EventKind

type EventKind string
const (
	EventTurnStarted     EventKind = "turn.started"
	EventHeartbeat       EventKind = "turn.heartbeat"
	EventMessageDelta    EventKind = "message.delta"
	EventReasoningDelta  EventKind = "reasoning.delta"
	EventToolStarted     EventKind = "tool.started"
	EventToolOutputDelta EventKind = "tool.output.delta"
	EventToolCompleted   EventKind = "tool.completed"
	EventDiffUpdated     EventKind = "diff.updated"
	EventTurnCompleted   EventKind = "turn.completed"
	EventTurnFailed      EventKind = "turn.failed"
)

type ExternalSession

type ExternalSession struct {
	AgentID           string
	ExternalThreadID  string
	ExternalSessionID string
	CWD               string
	Model             string
	// Permissions are the session's now; core fills them before every turn.
	Permissions Permissions
	Metadata    map[string]any
}

type Input

type Input struct {
	Text string
}

type Permissions added in v0.2.1

type Permissions struct {
	// Mode is a permission mode (permission.ModeDefault, ...).
	Mode string
	// Readonly refuses every change without asking, whatever the mode.
	Readonly bool
}

Permissions are what the agent may do unasked; each adapter maps them to its own terms.

type Registry

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

func NewRegistry

func NewRegistry(agents ...RuntimeAgent) (*Registry, error)

func (*Registry) CanonicalID added in v0.1.9

func (r *Registry) CanonicalID(id string) (string, bool)

func (*Registry) Get

func (r *Registry) Get(id string) (RuntimeAgent, bool)

func (*Registry) List

func (r *Registry) List(ctx context.Context) []Descriptor

func (*Registry) Register

func (r *Registry) Register(agent RuntimeAgent, aliases ...string) error

Register adds agent under its ID and any extra names it answers to.

type RuntimeAgent

type RuntimeAgent interface {
	ID() string
	DisplayName() string
	// Models are the models the agent suggests to pick from, default first.
	Models(ctx context.Context) []string
	Available(ctx context.Context) Availability
	StartSession(ctx context.Context, req StartSessionRequest) (ExternalSession, error)
	ResumeSession(ctx context.Context, session ExternalSession) (ExternalSession, error)
	Send(ctx context.Context, session ExternalSession, input Input) (<-chan Event, error)
	Interrupt(ctx context.Context, session ExternalSession) error
	Close() error
}

type SessionAttachment

type SessionAttachment struct {
	SessionID         string
	AgentID           string
	ExternalThreadID  string
	ExternalSessionID string
	CWD               string
	Model             string
	MetadataJSON      string
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

func (SessionAttachment) ExternalSession added in v0.1.5

func (a SessionAttachment) ExternalSession() ExternalSession

type StartSessionRequest

type StartSessionRequest struct {
	CWD         string
	Model       string
	Permissions Permissions
}

Directories

Path Synopsis
Package reply builds the transcript reply of an external agent's turn from its events, with bounded tool input, output and reasoning.
Package reply builds the transcript reply of an external agent's turn from its events, with bounded tool input, output and reasoning.

Jump to

Keyboard shortcuts

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