planmodetool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package planmodetool implements the EnterPlanMode and ExitPlanMode tools.

These tools let the model request permission to enter/exit plan mode. Entering requires user consent (the TUI shows a prompt); exiting presents the plan and asks the user to approve before implementation begins.

Port of src/tools/EnterPlanModeTool/ and src/tools/ExitPlanModeTool/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnterPlanMode

type EnterPlanMode struct {
	// SetMode changes the active permission mode (nil = no-op).
	SetMode func(permissions.Mode)
	// AskEnter, when non-nil, prompts the user for approval before entering.
	// Returns true if the user consents.
	AskEnter func(ctx context.Context) bool
}

EnterPlanMode is the tool the model calls to request plan mode entry. The TUI must install SetMode and AskEnter callbacks before use.

func (*EnterPlanMode) Description

func (t *EnterPlanMode) Description() string

func (*EnterPlanMode) Execute

func (t *EnterPlanMode) Execute(ctx context.Context, _ json.RawMessage) (tool.Result, error)

func (*EnterPlanMode) InputSchema

func (t *EnterPlanMode) InputSchema() json.RawMessage

func (*EnterPlanMode) IsConcurrencySafe

func (t *EnterPlanMode) IsConcurrencySafe(_ json.RawMessage) bool

func (*EnterPlanMode) IsReadOnly

func (t *EnterPlanMode) IsReadOnly(_ json.RawMessage) bool

func (*EnterPlanMode) Name

func (t *EnterPlanMode) Name() string

type ExitPlanMode

type ExitPlanMode struct {
	// SetMode changes the active permission mode (nil = no-op).
	SetMode func(permissions.Mode)
	// AskApprove, when non-nil, shows the plan to the user and returns true if
	// they approve. When nil, the plan is auto-approved.
	AskApprove func(ctx context.Context, plan string) bool
}

ExitPlanMode is the tool the model calls to present a plan and ask for approval. The user is shown the plan text and either approves or rejects.

func (*ExitPlanMode) Description

func (t *ExitPlanMode) Description() string

func (*ExitPlanMode) Execute

func (t *ExitPlanMode) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

func (*ExitPlanMode) InputSchema

func (t *ExitPlanMode) InputSchema() json.RawMessage

func (*ExitPlanMode) IsConcurrencySafe

func (t *ExitPlanMode) IsConcurrencySafe(_ json.RawMessage) bool

func (*ExitPlanMode) IsReadOnly

func (t *ExitPlanMode) IsReadOnly(_ json.RawMessage) bool

func (*ExitPlanMode) Name

func (t *ExitPlanMode) Name() string

Jump to

Keyboard shortcuts

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