plugins

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package plugins contains pigo's bundled, default-off first-party extensions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catalog

func Catalog(option ...Options) map[string]extensions.Factory

Catalog returns fresh extension factories. Embedders can register any chosen subset in an extensions.Registry and pass it through AgentSessionOptions.

func Control

func Control(settings *config.SettingsManager) extensions.Factory

Control registers /plugins independently of the default-off plugin catalog.

func Description

func Description(name string) string

Description returns the one-line description used by the CLI and TUI.

func Names

func Names() []string

Names returns the stable first-party plugin order.

Types

type Action

type Action string

Action is the ecosystem-standard three-state permission result.

const (
	Allow Action = "allow"
	Deny  Action = "deny"
	Ask   Action = "ask"
)

type Decision

type Decision struct {
	Time       int64  `json:"time"`
	Tool       string `json:"tool"`
	Action     Action `json:"action"`
	Resolved   Action `json:"resolved"`
	Mode       string `json:"mode"`
	Rule       int    `json:"rule,omitempty"`
	Matcher    string `json:"matcher,omitempty"`
	Input      string `json:"input,omitempty"`
	Resolution string `json:"resolution,omitempty"`
}

Decision records the matched policy and its runtime resolution.

type Options

type Options struct {
	StreamFn   agent.StreamFn
	HTTPClient *http.Client
	Settings   *config.SettingsManager
	Policy     *Policy
}

Options supplies runtime seams used by bundled plugins. StreamFn keeps subagent tests and embedders independent from real providers.

type Policy

type Policy struct {
	Mode        string `json:"mode,omitempty"`
	AskFallback Action `json:"askFallback,omitempty"`
	Rules       []Rule `json:"rules,omitempty"`

	// ponytail: single hook, chain when demanded.
	Authorizer func(context.Context, ToolCallInfo) (Action, error) `json:"-"`
	// contains filtered or unexported fields
}

Policy is constructible by SDK embedders and shared with in-process children.

func (*Policy) Evaluate

func (policy *Policy) Evaluate(ctx context.Context, info ToolCallInfo) Decision

Evaluate applies the authorizer first, then ordered last-match-wins rules.

func (*Policy) SetMode

func (policy *Policy) SetMode(mode string)

type Rule

type Rule struct {
	Tool    string `json:"tool,omitempty"`
	Command string `json:"command,omitempty"`
	Path    string `json:"path,omitempty"`
	Action  Action `json:"action"`
}

Rule is one ordered permission rule. Empty Tool means "*".

type ToolCallInfo

type ToolCallInfo struct {
	Tool      string
	Args      any
	CWD       string
	SessionID string
}

ToolCallInfo is the low-level SDK authorization input.

Jump to

Keyboard shortcuts

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