plan

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const StructuredPlanReminder = "Plan mode requires a structured plan before finishing. Please restate the plan using update_plan."

Variables

This section is empty.

Functions

func CanStartExecution

func CanStartExecution(state State) bool

func CanTransition

func CanTransition(from, to Phase) bool

func CountByStatus

func CountByStatus(state State, status StepStatus) int

func DefaultNextAction

func DefaultNextAction(state State) string

func FinalizeAssistantAnswer

func FinalizeAssistantAnswer(mode AgentMode, state State, answer string) string

FinalizeAssistantAnswer enforces plan-mode completion policy on final text.

func HasActiveChoice

func HasActiveChoice(state State) bool

func HasDecisionGaps

func HasDecisionGaps(state State) bool

func HasExecutionReadiness

func HasExecutionReadiness(state State) bool

func HasStructuredPlan

func HasStructuredPlan(state State) bool

func RenderPromptStateBlock

func RenderPromptStateBlock(state State) string

func RenderStructuredPlanBlock

func RenderStructuredPlanBlock(state State) string

func SeedForRun

func SeedForRun(state *State, runMode AgentMode, userInput, fallbackUserText string)

SeedForRun initializes plan state when entering plan mode.

func ShouldRenderStructuredPlanBlock

func ShouldRenderStructuredPlanBlock(state State) bool

Types

type ActiveChoice

type ActiveChoice struct {
	ID       string         `json:"id,omitempty"`
	Kind     string         `json:"kind,omitempty"`
	Question string         `json:"question"`
	GapKey   string         `json:"gap_key,omitempty"`
	Options  []ChoiceOption `json:"options,omitempty"`
}

func CloneActiveChoice

func CloneActiveChoice(choice *ActiveChoice) *ActiveChoice

type AgentMode

type AgentMode = corepkg.SessionMode

func NormalizeMode

func NormalizeMode(raw string) AgentMode

type ChoiceOption

type ChoiceOption struct {
	ID          string `json:"id,omitempty"`
	Shortcut    string `json:"shortcut,omitempty"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Recommended bool   `json:"recommended,omitempty"`
	Freeform    bool   `json:"freeform,omitempty"`
}

type Decision

type Decision struct {
	Decision string `json:"decision"`
	Reason   string `json:"reason,omitempty"`
}

func CloneDecisionLog

func CloneDecisionLog(entries []Decision) []Decision

type Phase

type Phase string
const (
	PhaseNone            Phase = "none"
	PhaseExplore         Phase = "explore"
	PhaseClarify         Phase = "clarify"
	PhaseDraft           Phase = "draft"
	PhaseConvergeReady   Phase = "converge_ready"
	PhaseApprovedToBuild Phase = "approved_to_build"
	PhaseExecuting       Phase = "executing"
	PhaseBlocked         Phase = "blocked"
	PhaseCompleted       Phase = "completed"

	// Legacy aliases kept for persisted sessions and older callers.
	PhaseDrafting = PhaseDraft
	PhaseReady    = PhaseConvergeReady
	PhaseApproved = PhaseApprovedToBuild
)

func DerivePhase

func DerivePhase(mode AgentMode, state State) Phase

func NormalizePhase

func NormalizePhase(raw string) Phase

type RiskLevel

type RiskLevel = corepkg.RiskLevel
const (
	RiskLow    RiskLevel = corepkg.RiskLow
	RiskMedium RiskLevel = corepkg.RiskMedium
	RiskHigh   RiskLevel = corepkg.RiskHigh
)

func NormalizeRisk

func NormalizeRisk(raw string) RiskLevel

type State

type State struct {
	Goal                string        `json:"goal,omitempty"`
	Summary             string        `json:"summary,omitempty"`
	ImplementationBrief string        `json:"implementation_brief,omitempty"`
	Phase               Phase         `json:"phase,omitempty"`
	UpdatedAt           time.Time     `json:"updated_at,omitempty"`
	Steps               []Step        `json:"steps,omitempty"`
	Risks               []string      `json:"risks,omitempty"`
	Verification        []string      `json:"verification,omitempty"`
	DecisionLog         []Decision    `json:"decision_log,omitempty"`
	DecisionGaps        []string      `json:"decision_gaps,omitempty"`
	ActiveChoice        *ActiveChoice `json:"active_choice,omitempty"`
	ScopeDefined        bool          `json:"scope_defined,omitempty"`
	RiskRollbackDefined bool          `json:"risk_and_rollback_defined,omitempty"`
	VerificationDefined bool          `json:"verification_defined,omitempty"`
	NextAction          string        `json:"next_action,omitempty"`
	BlockReason         string        `json:"block_reason,omitempty"`
}

func CloneState

func CloneState(state State) State

func NormalizeState

func NormalizeState(state State) State

type Step

type Step struct {
	ID          string     `json:"id,omitempty"`
	Title       string     `json:"title"`
	Description string     `json:"description,omitempty"`
	Status      StepStatus `json:"status"`
	Files       []string   `json:"files,omitempty"`
	Verify      []string   `json:"verify,omitempty"`
	Risk        RiskLevel  `json:"risk,omitempty"`
}

func CloneSteps

func CloneSteps(steps []Step) []Step

func CurrentStep

func CurrentStep(state State) (Step, bool)

type StepStatus

type StepStatus string
const (
	StepPending    StepStatus = "pending"
	StepInProgress StepStatus = "in_progress"
	StepCompleted  StepStatus = "completed"
	StepBlocked    StepStatus = "blocked"
)

func NormalizeStepStatus

func NormalizeStepStatus(raw string) StepStatus

type ValidationResult

type ValidationResult struct {
	OK             bool
	Warnings       []string
	RequiresReplan bool
}

func ValidateState

func ValidateState(state State) ValidationResult

Jump to

Keyboard shortcuts

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