plugins

package
v0.1.34 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ManifestFileName  = "whale-plugin.toml"
	InstalledFileName = "installed.toml"
)

Variables

This section is empty.

Functions

func InstalledCacheRoot added in v0.1.33

func InstalledCacheRoot(dataDir string) string

func InstalledIndexPath added in v0.1.33

func InstalledIndexPath(dataDir string) string

func IsBuiltinID added in v0.1.33

func IsBuiltinID(id string) bool

func LoadManifest added in v0.1.33

func LoadManifest(pluginDir string) (Manifest, []Diagnostic, error)

func NormalizePluginID added in v0.1.33

func NormalizePluginID(id string) string

func WorkspaceHash

func WorkspaceHash(workspaceRoot string) string

Types

type AgentDefinition added in v0.1.33

type AgentDefinition struct {
	Name            string
	Description     string
	SystemPrompt    string
	Model           string
	Effort          string
	MaxToolIters    int
	MaxToolCalls    int
	Capabilities    []string
	AllowedTools    []string
	DisallowedTools []string
	Source          string
	FilePath        string
}

type Capability

type Capability string
const (
	CapabilityTools          Capability = "tools"
	CapabilitySlashCommands  Capability = "slash_commands"
	CapabilityStartupContext Capability = "startup_context"
	CapabilityStorage        Capability = "storage"
	CapabilitySkills         Capability = "skills"
	CapabilityHooks          Capability = "hooks"
	CapabilityBackgroundJobs Capability = "background_jobs"
	CapabilityLocalModel     Capability = "local_model"
)

type CommandClass

type CommandClass string
const (
	CommandReadOnly     CommandClass = "read_only"
	CommandMutating     CommandClass = "mutating"
	CommandUI           CommandClass = "ui"
	CommandTurnStarting CommandClass = "turn"
)

func BuiltinSlashCommandClass

func BuiltinSlashCommandClass(line string) (CommandClass, bool)

type CommandHookProvider added in v0.1.33

type CommandHookProvider interface {
	CommandHooks(Context) []agent.ResolvedHook
}

type CommandResult

type CommandResult struct {
	Text    string
	Mutated bool
	Turn    *CommandTurn
}

type CommandTurn

type CommandTurn struct {
	Input               string
	Hidden              bool
	ReadOnly            bool
	GoalContinuation    bool
	SkipUserPromptHooks bool
	SkipSkillInjection  bool
	ShellAllowPrefixes  []string
}

type Components added in v0.1.33

type Components struct {
	Skills   string `toml:"skills,omitempty"`
	Commands string `toml:"commands,omitempty"`
	Hooks    string `toml:"hooks,omitempty"`
	MCP      string `toml:"mcp,omitempty"`
	Rules    string `toml:"rules,omitempty"`
	Agents   string `toml:"agents,omitempty"`
}

type Config added in v0.1.33

type Config struct {
	Enabled    *bool
	MCPServers map[string]MCPServerConfig
}

type ConfigMap added in v0.1.33

type ConfigMap map[string]Config

type Context

type Context struct {
	DataDir       string
	WorkspaceRoot string
}

func (Context) PluginCacheDir

func (c Context) PluginCacheDir(pluginID string) string

func (Context) PluginDataDir

func (c Context) PluginDataDir(pluginID string) string

func (Context) PluginProjectDir

func (c Context) PluginProjectDir(pluginID string) string

func (Context) PluginRoot

func (c Context) PluginRoot(pluginID string) string

type Diagnostic

type Diagnostic struct {
	PluginID string
	Level    DiagnosticLevel
	Label    string
	Detail   string
}

type DiagnosticLevel

type DiagnosticLevel string
const (
	DiagnosticOK   DiagnosticLevel = "ok"
	DiagnosticWarn DiagnosticLevel = "warn"
	DiagnosticFail DiagnosticLevel = "fail"
)

type Display added in v0.1.33

type Display struct {
	Category string `toml:"category,omitempty"`
	Icon     string `toml:"icon,omitempty"`
}

type DoctorProvider

type DoctorProvider interface {
	Doctor(context.Context, Context) []Diagnostic
}

type HookProvider

type HookProvider interface {
	Hooks(Context) []agent.HookHandler
}

type InstallResult added in v0.1.33

type InstallResult struct {
	Record InstalledRecord
}

func InstallLocal added in v0.1.33

func InstallLocal(dataDir, pluginDir string) (InstallResult, error)

type InstalledRecord added in v0.1.33

type InstalledRecord struct {
	ID          string       `toml:"id"`
	Name        string       `toml:"name,omitempty"`
	Version     string       `toml:"version,omitempty"`
	Description string       `toml:"description,omitempty"`
	Authors     []string     `toml:"authors,omitempty"`
	License     string       `toml:"license,omitempty"`
	Homepage    string       `toml:"homepage,omitempty"`
	Repository  string       `toml:"repository,omitempty"`
	Keywords    []string     `toml:"keywords,omitempty"`
	SourcePath  string       `toml:"source_path,omitempty"`
	InstallPath string       `toml:"install_path,omitempty"`
	InstalledAt string       `toml:"installed_at,omitempty"`
	Components  Components   `toml:"components,omitempty"`
	Display     Display      `toml:"display,omitempty"`
	Diagnostics []Diagnostic `toml:"diagnostics,omitempty"`
}

func FindInstalled added in v0.1.33

func FindInstalled(dataDir, id string) (InstalledRecord, bool, error)

func LoadInstalled added in v0.1.33

func LoadInstalled(dataDir string) ([]InstalledRecord, error)

func UninstallLocal added in v0.1.33

func UninstallLocal(dataDir, id string) (InstalledRecord, error)

func (InstalledRecord) Manifest added in v0.1.33

func (r InstalledRecord) Manifest() Manifest

type LoadOutcome added in v0.1.33

type LoadOutcome struct {
	Plugins      []LoadedPlugin
	Statuses     []PluginStatus
	Commands     []SlashCommand
	Tools        []core.Tool
	Skills       []*skills.Skill
	Agents       []AgentDefinition
	Rules        []RuleBlock
	MCPServers   map[string]whalemcp.ServerConfig
	CommandHooks []agent.ResolvedHook
	HookHandlers []agent.HookHandler
	Diagnostics  []Diagnostic
}

type LoadedPlugin added in v0.1.33

type LoadedPlugin struct {
	Manifest     Manifest
	Enabled      bool
	Paths        map[string]string
	Commands     []SlashCommand
	Tools        []core.Tool
	ToolNames    []string
	Skills       []*skills.Skill
	Agents       []AgentDefinition
	Rules        []RuleBlock
	MCPServers   map[string]whalemcp.ServerConfig
	CommandHooks []agent.ResolvedHook
	HookHandlers []agent.HookHandler
	Services     []ServiceStatus
	Diagnostics  []Diagnostic
}

type MCPProvider added in v0.1.33

type MCPProvider interface {
	MCPServers(Context) map[string]whalemcp.ServerConfig
}

type MCPServerConfig added in v0.1.33

type MCPServerConfig struct {
	Enabled       *bool    `toml:"enabled,omitempty"`
	DisabledTools []string `toml:"disabled_tools,omitempty"`
}

type Manager

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

func NewManager

func NewManager(ctx Context, config ConfigMap) *Manager

func (*Manager) Agents added in v0.1.33

func (m *Manager) Agents() []AgentDefinition

func (*Manager) CommandClass

func (m *Manager) CommandClass(name string) (CommandClass, bool)

func (*Manager) CommandClassForLine

func (m *Manager) CommandClassForLine(line string) (CommandClass, bool)

func (*Manager) CommandHooks added in v0.1.33

func (m *Manager) CommandHooks() []agent.ResolvedHook

func (*Manager) Diagnostics

func (m *Manager) Diagnostics(ctx context.Context) []Diagnostic

func (*Manager) EnabledIDs

func (m *Manager) EnabledIDs() []string

func (*Manager) HandleCommand

func (m *Manager) HandleCommand(ctx context.Context, line string) (CommandResult, bool, error)

func (*Manager) Hooks

func (m *Manager) Hooks() []agent.HookHandler

func (*Manager) MCPServers added in v0.1.33

func (m *Manager) MCPServers() map[string]whalemcp.ServerConfig

func (*Manager) Outcome added in v0.1.33

func (m *Manager) Outcome() LoadOutcome

func (*Manager) Rules added in v0.1.33

func (m *Manager) Rules() []RuleBlock

func (*Manager) Skills

func (m *Manager) Skills() []*skills.Skill

func (*Manager) SlashCommandNames

func (m *Manager) SlashCommandNames() []string

func (*Manager) SlashCommands

func (m *Manager) SlashCommands() []SlashCommand

func (*Manager) StartupBlocks

func (m *Manager) StartupBlocks(ctx context.Context) []string

func (*Manager) Status

func (m *Manager) Status(id string) (PluginStatus, bool)

func (*Manager) Statuses

func (m *Manager) Statuses() []PluginStatus

func (*Manager) Tools

func (m *Manager) Tools() []core.Tool

type Manifest

type Manifest struct {
	ID           string
	Name         string
	Version      string
	Description  string
	Official     bool
	Authors      []string
	License      string
	Homepage     string
	Repository   string
	Keywords     []string
	Components   Components
	Display      Display
	Capabilities []Capability
	Permissions  []Permission
	Status       string
}

type PathProvider added in v0.1.33

type PathProvider interface {
	Paths(Context) map[string]string
}

type Permission

type Permission string
const (
	PermissionReadPluginData  Permission = "read_plugin_data"
	PermissionWritePluginData Permission = "write_plugin_data"
	PermissionReadWorkspace   Permission = "read_workspace"
	PermissionWriteWorkspace  Permission = "write_workspace"
	PermissionBackgroundJobs  Permission = "background_jobs"
	PermissionLocalModel      Permission = "local_model"
)

type Plugin

type Plugin interface {
	Manifest() Manifest
}

type PluginStatus

type PluginStatus struct {
	Manifest    Manifest
	Enabled     bool
	Commands    []SlashCommand
	Tools       []string
	Skills      []string
	Agents      []string
	Rules       []string
	Hooks       []string
	Services    []ServiceStatus
	Diagnostics []Diagnostic
	Paths       map[string]string
}

type RuleBlock added in v0.1.33

type RuleBlock struct {
	Name     string
	Content  string
	Source   string
	FilePath string
}

type ServiceProvider

type ServiceProvider interface {
	Services(Context) []ServiceStatus
}

type ServiceStatus

type ServiceStatus struct {
	Name   string
	Status string
	Detail string
}

type SkillProvider

type SkillProvider interface {
	Skills(Context) []*skills.Skill
}

type SlashCommand

type SlashCommand struct {
	Name        string
	Usage       string
	Description string
	Class       CommandClass
	StartsTurn  bool
	Classify    func(line string) CommandClass
	Run         func(context.Context, Context, string) (CommandResult, error)
}

type SlashCommandProvider

type SlashCommandProvider interface {
	SlashCommands(Context) []SlashCommand
}

type StartupContextProvider

type StartupContextProvider interface {
	StartupContext(context.Context, Context) (string, error)
}

type ToolProvider

type ToolProvider interface {
	Tools(Context) []core.Tool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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