execution

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package execution provides execution mode state management.

Plan mode: the agent explores the codebase and writes a plan, which is then presented to the user for approval before any source files are modified.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlansDirectory = runtimepath.PlansDir("")

DefaultPlansDirectory is the default location for plan files (~/.config/seshat/plans/).

View Source
var WordList = []string{
	"algorithm", "cascade", "discovery", "element", "focus", "galaxy", "horizon", "insight",
	"journey", "kernel", "launch", "momentum", "seshat", "orbit", "prism", "quest",
	"resonance", "spectrum", "tempo", "unity", "vertex", "wavelength", "zenith", "apex",
	"bridge", "chronicle", "dynamics", "eclipse", "fusion", "genesis", "harmonic", "infinity",
	"junction", "kinesis", "lucid", "meridian", "novel", "origins", "paradigm", "quantum",
	"radian", "symmetry", "threshold", "unity", "vortex", "wanderer", "xenon", "yearning",
}

WordList is used to generate human-readable mode file slugs.

Functions

func ClearAllPlanSlugs

func ClearAllPlanSlugs()

ClearAllPlanSlugs removes all plan slugs (useful for testing).

func ClearAllStates

func ClearAllStates()

ClearAllStates removes all session states (useful for testing).

func EnterPlanMode

func EnterPlanMode(sessionID types.SessionID, agentID *types.AgentID)

EnterPlanMode initializes plan mode state for a session.

func ExitPlanMode

func ExitPlanMode(sessionID types.SessionID)

ExitPlanMode applies state changes when leaving plan mode.

func GetDisplayPath

func GetDisplayPath(planFilePath string) string

GetDisplayPath returns a user-friendly tilde-prefixed path to the plan file.

func GetPlan

func GetPlan(sessionID types.SessionID, agentID *types.AgentID) (string, error)

GetPlan reads the plan content from disk.

func GetPlanFilePath

func GetPlanFilePath(sessionID types.SessionID, agentID *types.AgentID) string

GetPlanFilePath returns the full path to the plan file for a session. Plans are stored under workspaces/{sessionID}/plans/ so that deleting a session directory removes all its plans in one shot. When agentID is non-nil the filename includes the agent identifier, allowing separate plan files per sub-agent within the same session.

func GetPlanSlug

func GetPlanSlug(sessionID types.SessionID) string

GetPlanSlug returns the slug for a session's plan file.

func PlanExists

func PlanExists(sessionID types.SessionID, agentID *types.AgentID) bool

PlanExists checks if a plan file exists for the session.

func SetHasPlanFile

func SetHasPlanFile(sessionID types.SessionID, v bool)

func SetPlan

func SetPlan(sessionID types.SessionID, agentID *types.AgentID, content string) error

SetPlan writes the plan content to disk.

func SetPlanSlug

func SetPlanSlug(sessionID types.SessionID, slug string)

SetPlanSlug sets the plan slug for a session (useful for testing).

Types

type ModeCache

type ModeCache[S any] struct {
	// contains filtered or unexported fields
}

ModeCache manages per-session state, slug, and file artifact for a single mode. S is the mode-specific state type.

func NewModeCache

func NewModeCache[S any](subDir string, newState func() *S) *ModeCache[S]

NewModeCache creates a new ModeCache. subDir is the path relative to cwd (e.g. ".seshat/plans"). newState returns a fresh zero state for new sessions.

func (*ModeCache[S]) ClearAllSlugs

func (c *ModeCache[S]) ClearAllSlugs()

ClearAllSlugs removes all slugs.

func (*ModeCache[S]) ClearAllStates

func (c *ModeCache[S]) ClearAllStates()

ClearAllStates removes all session states.

func (*ModeCache[S]) ClearSlug

func (c *ModeCache[S]) ClearSlug(sessionID types.SessionID)

ClearSlug removes the slug for a session.

func (*ModeCache[S]) GetSlug

func (c *ModeCache[S]) GetSlug(sessionID types.SessionID) string

GetSlug returns the slug for a session, generating one if it does not exist.

func (*ModeCache[S]) GetState

func (c *ModeCache[S]) GetState(sessionID types.SessionID) *S

GetState returns the state for a session, creating it if it does not exist.

func (*ModeCache[S]) SetSlug

func (c *ModeCache[S]) SetSlug(sessionID types.SessionID, slug string)

SetSlug sets the slug for a session.

type State

type State struct {
	HasExitedPlanMode           bool
	NeedsPlanModeExitAttachment bool
	HasPlanFile                 bool
}

State represents the current plan mode state for a session.

Jump to

Keyboard shortcuts

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