Help us shape the future of Go! Take the 2026 Go Developer Survey

subagenttool

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package subagenttool registers the delegate tool, the production caller that hands one bounded piece of work to a child agent confined to caller-declared write, delete, and move scopes.

Index

Constants

View Source
const ToolName = "delegate"

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Home          string
	LaunchDir     string
	ProjectRoot   string
	Snapshot      func() (Snapshot, bool)
	NewDispatcher func(permissions.ModeContext) turn.ToolDispatcher
	// Store is the parent's session store: a child records into it rather than one of its own.
	Store func() *sessions.Store
	// Activity is the optional live surface for the child lifecycle. It is display-only: the
	// durable record is the start/end pair below, and a nil sink changes nothing.
	Activity subagent.ActivitySink
}

Deps binds the tool to the run. NewDispatcher receives the child's authorization ceiling and returns a dispatcher bound to the parent's real file tools, so this package never assembles authority of its own.

type PreparationError

type PreparationError struct {
	Reason string
}

A caller that prepares separately from invocation must return Result in band; a delegate call rejected on its arguments was never a permission question and must not abort the turn.

func (*PreparationError) Error

func (e *PreparationError) Error() string

func (*PreparationError) Result

func (e *PreparationError) Result() tools.Result

type Snapshot

type Snapshot struct {
	Mode            string
	Model           model.Selection
	ModelSource     model.Source
	SupportedEffort func(providerID, modelID string) []string
	SystemPrompt    string
	Client          provider.Client
	Tools           []provider.ToolDefinition
	Registered      []tools.Tool
}

Snapshot is the parent state one delegate call inherits, read when that call starts rather than when the tool was registered.

type Tool

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

func New

func New(deps Deps) *Tool

func (*Tool) Advertise

func (t *Tool) Advertise() tools.Metadata

func (*Tool) Invoke

func (t *Tool) Invoke(ctx context.Context, args map[string]any) (tools.Result, error)

func (*Tool) InvokeWithPreparedDelegate

func (t *Tool) InvokeWithPreparedDelegate(ctx context.Context, instruction string, write, remove map[string]bool, moves map[permissions.MovePair]bool) (tools.Result, error)

func (*Tool) Name

func (t *Tool) Name() string

func (*Tool) PrepareDelegate

func (t *Tool) PrepareDelegate(args map[string]any) (string, map[string]bool, map[string]bool, map[permissions.MovePair]bool, []string, error)

func (*Tool) SubjectKind

func (t *Tool) SubjectKind() string

Jump to

Keyboard shortcuts

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