plan

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package plan implements plan mode: the agent first explores read-only and drafts a plan, then calls ExitPlanMode to present it for approval. On approval the session transitions out of the read-only "plan" permission mode so the agent can implement. A Controller holds the current mode; the harness reads it via QueryInput.PermissionModeFunc so the change takes effect mid-loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnterTool

func EnterTool(c *Controller) tool.CoreTool

EnterTool lets the agent switch itself into plan mode mid-session.

func ExitTool

func ExitTool(c *Controller, approve Approver) tool.CoreTool

ExitTool presents the agent's plan for approval and, on approval, exits plan mode so implementation can begin.

func Tools

func Tools(c *Controller, approve Approver) []tool.CoreTool

Tools returns the EnterPlanMode and ExitPlanMode tools bound to this controller and approver.

Types

type Approver

type Approver func(ctx context.Context, plan string) (approved bool, feedback string)

Approver is the host's plan-approval callback (a CLI prompt, a GUI, or an automated policy). It returns whether the plan is approved and, if not, optional feedback for the agent to revise against.

type Controller

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

Controller tracks the live permission mode for a planning session.

func NewController

func NewController(start, target permission.Mode) *Controller

NewController starts in `start` mode; on approval the mode becomes `target` (defaulting to acceptEdits when empty).

func (*Controller) Enter

func (c *Controller) Enter()

Enter transitions into plan mode, remembering the mode to restore.

func (*Controller) InPlan

func (c *Controller) InPlan() bool

InPlan reports whether the controller is currently in plan mode.

func (*Controller) Mode

func (c *Controller) Mode() permission.Mode

Mode returns the current permission mode (thread-safe; read by the harness).

Jump to

Keyboard shortcuts

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