subagenttool

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const ToolName = "general_agent"

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Home          string
	LaunchDir     string
	ProjectRoot   string
	Snapshot      func(context.Context) (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 general_agent 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 general_agent 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) InvokeWithPreparedGeneralAgent added in v0.4.7

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

func (*Tool) Name

func (t *Tool) Name() string

func (*Tool) PrepareGeneralAgent added in v0.4.7

func (t *Tool) PrepareGeneralAgent(args map[string]any) (string, map[string]bool, map[string]bool, map[permissions.MovePair]bool, map[string]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