agent

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 6 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
	DisplayName() string
	Binary() string

	BuildCmd(opts CmdOpts) string
	ResumeKey() string
	ResumeFileName() string
	EnvVar() string
	MasterPrompt() string
	StandalonePrompt() string
	WorkerPrompt() string

	FilterPaneLines(raw string, max int) []string

	PreLaunchSetup(ctx context.Context, client TmuxClient, session string) error
	BinaryEnvVar() string
	FallbackPath() string
}

Agent represents any CLI coding agent that can run in a tmux pane.

func Resolve

func Resolve(name string, registry *Registry) (Agent, error)

Resolve returns an agent by name, preferring the configured registry and falling back to built-in providers when the current config does not bind it.

type AgentConfig

type AgentConfig struct {
	CLI string `toml:"cli"`
}

AgentConfig describes one configured agent provider.

type Claude

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

Claude implements the built-in Claude provider.

func NewClaude

func NewClaude(cfg AgentConfig) *Claude

NewClaude constructs a Claude provider from config.

func (*Claude) Binary

func (c *Claude) Binary() string

func (*Claude) BinaryEnvVar

func (c *Claude) BinaryEnvVar() string

func (*Claude) BuildCmd

func (c *Claude) BuildCmd(opts CmdOpts) string

func (*Claude) DisplayName

func (c *Claude) DisplayName() string

func (*Claude) EnvVar

func (c *Claude) EnvVar() string

func (*Claude) FallbackPath

func (c *Claude) FallbackPath() string

func (*Claude) FilterPaneLines

func (c *Claude) FilterPaneLines(raw string, max int) []string

func (*Claude) MasterPrompt

func (c *Claude) MasterPrompt() string

func (*Claude) Name

func (c *Claude) Name() string

func (*Claude) PreLaunchSetup

func (c *Claude) PreLaunchSetup(ctx context.Context, client TmuxClient, session string) error

func (*Claude) ResumeFileName

func (c *Claude) ResumeFileName() string

func (*Claude) ResumeKey

func (c *Claude) ResumeKey() string

func (*Claude) StandalonePrompt

func (c *Claude) StandalonePrompt() string

func (*Claude) WorkerPrompt

func (c *Claude) WorkerPrompt() string

type CmdOpts

type CmdOpts struct {
	Binary      string
	AgentPath   string
	ResumeID    string
	Prompt      string
	SystemBrief string
	Title       string
	Role        SessionRole
}

CmdOpts controls agent launch command construction.

Prompt is an initial user-turn message injected after launch (what the user would type first). SystemBrief is appended after the standalone or worker system prompt so rare session-specific overrides still load as persistent identity rather than conversational input.

type Codex

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

Codex implements the built-in Codex provider.

func NewCodex

func NewCodex(cfg AgentConfig) *Codex

NewCodex constructs a Codex provider from config.

func (*Codex) Binary

func (c *Codex) Binary() string

func (*Codex) BinaryEnvVar

func (c *Codex) BinaryEnvVar() string

func (*Codex) BuildCmd

func (c *Codex) BuildCmd(opts CmdOpts) string

func (*Codex) DisplayName

func (c *Codex) DisplayName() string

func (*Codex) EnvVar

func (c *Codex) EnvVar() string

func (*Codex) FallbackPath

func (c *Codex) FallbackPath() string

func (*Codex) FilterPaneLines

func (c *Codex) FilterPaneLines(raw string, max int) []string

func (*Codex) MasterPrompt

func (c *Codex) MasterPrompt() string

func (*Codex) Name

func (c *Codex) Name() string

func (*Codex) PreLaunchSetup

func (c *Codex) PreLaunchSetup(_ context.Context, _ TmuxClient, _ string) error

func (*Codex) ResumeFileName

func (c *Codex) ResumeFileName() string

func (*Codex) ResumeKey

func (c *Codex) ResumeKey() string

func (*Codex) StandalonePrompt

func (c *Codex) StandalonePrompt() string

func (*Codex) WorkerPrompt

func (c *Codex) WorkerPrompt() string

type Config

type Config struct {
	Agents map[string]AgentConfig `toml:"agents"`
	Roles  RolesConfig            `toml:"roles"`
}

Config is the resolved questmaster agent configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the built-in Claude primary layout.

func LoadConfig

func LoadConfig(overrides *ConfigOverrides) (*Config, error)

LoadConfig returns the built-in config with optional per-session role overrides applied.

type ConfigOverrides

type ConfigOverrides struct {
	Primary string
}

ConfigOverrides are per-session role overrides.

type Pi

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

Pi implements the built-in Pi provider.

Structured Pi read output is handled by internal/message via hook state; FilterPaneLines remains the generic fallback for other callers.

func NewPi

func NewPi(cfg AgentConfig) *Pi

NewPi constructs a Pi provider from config.

func (*Pi) Binary

func (p *Pi) Binary() string

func (*Pi) BinaryEnvVar

func (p *Pi) BinaryEnvVar() string

func (*Pi) BuildCmd

func (p *Pi) BuildCmd(opts CmdOpts) string

func (*Pi) DisplayName

func (p *Pi) DisplayName() string

func (*Pi) EnvVar

func (p *Pi) EnvVar() string

func (*Pi) FallbackPath

func (p *Pi) FallbackPath() string

func (*Pi) FilterPaneLines

func (p *Pi) FilterPaneLines(raw string, max int) []string

func (*Pi) MasterPrompt

func (p *Pi) MasterPrompt() string

func (*Pi) Name

func (p *Pi) Name() string

func (*Pi) PreLaunchSetup

func (p *Pi) PreLaunchSetup(_ context.Context, _ TmuxClient, _ string) error

func (*Pi) ResumeFileName

func (p *Pi) ResumeFileName() string

func (*Pi) ResumeKey

func (p *Pi) ResumeKey() string

func (*Pi) StandalonePrompt

func (p *Pi) StandalonePrompt() string

func (*Pi) WorkerPrompt

func (p *Pi) WorkerPrompt() string

type Registry

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

Registry resolves configured role bindings to built-in agent providers.

func NewRegistry

func NewRegistry(cfg *Config) (*Registry, error)

NewRegistry builds a registry from a loaded config.

func (*Registry) Bindings

func (r *Registry) Bindings() []*RoleBinding

Bindings returns configured role bindings in primary-first order.

func (*Registry) ForRole

func (r *Registry) ForRole(role Role) (*RoleBinding, error)

ForRole returns the binding for a configured role.

func (*Registry) Get

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

Get returns a configured agent provider by name.

func (*Registry) HasRole

func (r *Registry) HasRole(role Role) bool

HasRole reports whether the given role is configured.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns configured agent definition names in sorted order.

type Role

type Role string

Role identifies a logical agent slot in a session.

const (
	RolePrimary Role = "primary"
)

type RoleBinding

type RoleBinding struct {
	Role     Role
	Agent    Agent
	PaneRole string
	Window   int
}

RoleBinding maps a role to an agent and tmux layout position.

type RoleConfig

type RoleConfig struct {
	Agent  string `toml:"agent"`
	Window int    `toml:"window"`
}

RoleConfig configures a single role binding.

type RolesConfig

type RolesConfig struct {
	Primary *RoleConfig `toml:"primary"`
}

RolesConfig maps abstract roles to concrete agents.

type SessionRole

type SessionRole int

SessionRole identifies the session type that determines the system prompt.

const (
	RoleStandalone SessionRole = iota
	RoleMaster
	RoleWorker
)

type Stub

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

Stub is a minimal reference provider for future agent adapters.

func NewStub

func NewStub(cfg AgentConfig) *Stub

NewStub constructs the example stub provider.

func (*Stub) Binary

func (s *Stub) Binary() string

func (*Stub) BinaryEnvVar

func (s *Stub) BinaryEnvVar() string

func (*Stub) BuildCmd

func (s *Stub) BuildCmd(CmdOpts) string

func (*Stub) DisplayName

func (s *Stub) DisplayName() string

func (*Stub) EnvVar

func (s *Stub) EnvVar() string

func (*Stub) FallbackPath

func (s *Stub) FallbackPath() string

func (*Stub) FilterPaneLines

func (s *Stub) FilterPaneLines(raw string, max int) []string

func (*Stub) MasterPrompt

func (s *Stub) MasterPrompt() string

func (*Stub) Name

func (s *Stub) Name() string

func (*Stub) PreLaunchSetup

func (s *Stub) PreLaunchSetup(context.Context, TmuxClient, string) error

func (*Stub) ResumeFileName

func (s *Stub) ResumeFileName() string

func (*Stub) ResumeKey

func (s *Stub) ResumeKey() string

func (*Stub) StandalonePrompt

func (s *Stub) StandalonePrompt() string

func (*Stub) WorkerPrompt

func (s *Stub) WorkerPrompt() string

type TmuxClient

type TmuxClient interface {
	UnsetEnvironment(ctx context.Context, session, key string) error
}

TmuxClient is the subset of tmux.Client used by agent providers.

Jump to

Keyboard shortcuts

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