subagents

package module
v0.0.0-...-2c6db52 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ToolName is the name of the SubAgent tool.
	ToolName = "subagent"

	// Description is shown to the LLM.
	Description = `` /* 492-byte string literal not displayed */

)
View Source
const (
	// DetailsDialogID is the identifier for the sub-agent details dialog.
	DetailsDialogID = "subagents-details"
)
View Source
const (
	// ListDialogID is the identifier for the sub-agents list dialog.
	ListDialogID = "subagents-list"
)

Variables

View Source
var DefaultDirs = []string{".crush/agents", "~/.crush/agents"}

DefaultDirs are searched when no dirs are configured.

Functions

func DiscoverAgentFiles

func DiscoverAgentFiles(dirs []string, workingDir string) []string

DiscoverAgentFiles finds all .md files in the given directories.

func ExpandPath

func ExpandPath(path, workingDir string) string

ExpandPath expands ~ to home directory and resolves relative paths.

func NewDetailsDialog

func NewDetailsDialog(app *plugin.App) (plugin.PluginDialog, error)

NewDetailsDialog creates a new sub-agent details dialog.

func NewListDialog

func NewListDialog(app *plugin.App) (plugin.PluginDialog, error)

NewListDialog creates a new sub-agents list dialog.

func NewSubAgentTool

func NewSubAgentTool(registry *Registry) fantasy.AgentTool

NewSubAgentTool creates the SubAgent tool.

func SetSelectedAgent

func SetSelectedAgent(name string)

SetSelectedAgent sets the agent to show in the details dialog.

Types

type Config

type Config struct {
	Dirs []string `json:"dirs,omitempty"`
}

Config defines configuration options for this plugin.

type DetailsDialog

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

DetailsDialog shows details for a specific sub-agent.

func (*DetailsDialog) ID

func (d *DetailsDialog) ID() string

func (*DetailsDialog) Init

func (d *DetailsDialog) Init() error

func (*DetailsDialog) Size

func (d *DetailsDialog) Size() (width, height int)

func (*DetailsDialog) Title

func (d *DetailsDialog) Title() string

func (*DetailsDialog) Update

func (d *DetailsDialog) Update(event plugin.DialogEvent) (done bool, action plugin.PluginAction, err error)

func (*DetailsDialog) View

func (d *DetailsDialog) View() string

type ListDialog

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

ListDialog shows all available sub-agents.

func (*ListDialog) GetSelectedAgent

func (d *ListDialog) GetSelectedAgent() string

GetSelectedAgent returns the currently selected agent name. Used by the details dialog to know which agent to show.

func (*ListDialog) ID

func (d *ListDialog) ID() string

func (*ListDialog) Init

func (d *ListDialog) Init() error

func (*ListDialog) Size

func (d *ListDialog) Size() (width, height int)

func (*ListDialog) Title

func (d *ListDialog) Title() string

func (*ListDialog) Update

func (d *ListDialog) Update(event plugin.DialogEvent) (done bool, action plugin.PluginAction, err error)

func (*ListDialog) View

func (d *ListDialog) View() string

type Registry

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

Registry manages loaded sub-agents.

func (*Registry) Get

func (r *Registry) Get(name string) (*SubAgent, bool)

Get returns a sub-agent by name.

func (*Registry) List

func (r *Registry) List() []*SubAgent

List returns all loaded sub-agents.

func (*Registry) LoadAgents

func (r *Registry) LoadAgents()

LoadAgents discovers and loads all sub-agent files.

func (*Registry) ReloadAgent

func (r *Registry) ReloadAgent(name string) error

ReloadAgent reloads a specific agent from disk.

func (*Registry) ReloadAll

func (r *Registry) ReloadAll()

ReloadAll reloads all agents from disk.

func (*Registry) SetEnabled

func (r *Registry) SetEnabled(name string, enabled bool)

SetEnabled enables or disables a sub-agent.

type SubAgent

type SubAgent struct {
	Name            string   `yaml:"name"`
	Description     string   `yaml:"description"`
	Tools           []string `yaml:"-"`     // Parsed from comma-separated string
	ToolsRaw        string   `yaml:"tools"` // Raw YAML field
	DisallowedTools []string `yaml:"-"`     // Parsed from comma-separated string
	DisallowedRaw   string   `yaml:"disallowedTools"`
	Model           string   `yaml:"model"`
	PermissionMode  string   `yaml:"permissionMode"`
	SystemPrompt    string   `yaml:"-"` // Markdown body
	FilePath        string   `yaml:"-"` // Source file path
	Enabled         bool     `yaml:"-"` // Runtime state
}

SubAgent represents a loaded sub-agent configuration.

func LoadAgentFile

func LoadAgentFile(path string) (*SubAgent, error)

LoadAgentFile parses a sub-agent YAML+Markdown file.

type SubAgentParams

type SubAgentParams struct {
	Agent  string `json:"agent" jsonschema:"description=The sub-agent name to invoke"`
	Prompt string `json:"prompt" jsonschema:"description=The task for the sub-agent to perform"`
}

SubAgentParams defines the parameters the LLM can pass.

Jump to

Keyboard shortcuts

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