plan

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusOpen   = "open"
	StatusLocked = "locked"
)

Plan statuses

View Source
const (
	BreakdownNone       = ""
	BreakdownInProgress = "in_progress"
	BreakdownCompleted  = "completed"
	BreakdownFailed     = "failed"
)

Breakdown statuses

Variables

This section is empty.

Functions

func Now

func Now() int64

Now returns the current Unix millisecond timestamp.

Types

type Plan

type Plan struct {
	ID                string `json:"id"`
	SessionID         string `json:"sessionId"`
	ProjectID         string `json:"projectId"`
	Directory         string `json:"directory"`
	Title             string `json:"title"`
	Status            string `json:"status"` // "open" | "locked"
	Model             string `json:"model,omitempty"`
	CompactionSummary string `json:"compactionSummary,omitempty"`
	BreakdownStatus   string `json:"breakdownStatus,omitempty"`   // "" | "in_progress" | "completed" | "failed"
	BreakdownWarnings string `json:"breakdownWarnings,omitempty"` // non-empty when some tasks failed to create
	AllTasksCompleted bool   `json:"allTasksCompleted,omitempty"` // true when locked and all tasks done
	Archived          bool   `json:"archived,omitempty"`          // true when ArchivedAt > 0
	CreatedAt         int64  `json:"createdAt"`
	UpdatedAt         int64  `json:"updatedAt"`
	ArchivedAt        int64  `json:"archivedAt,omitempty"`
}

Plan represents a planning session — a collaborative conversation between the user and the PlanAgent. Once locked, no further messages can be added. The plan serves as the reference point for all derived tasks.

type Store

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

Store provides persistence operations for Plan entities.

func NewStore

func NewStore(database *db.DB) *Store

NewStore creates a new Plan store backed by the given database.

func (*Store) Archive added in v0.2.5

func (s *Store) Archive(id string) error

Archive marks a plan as archived by setting archived_at and time_updated to the current timestamp.

func (*Store) Create

func (s *Store) Create(plan *Plan) error

Create inserts a new plan into the database.

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete removes a plan by ID.

func (*Store) Get

func (s *Store) Get(id string) (*Plan, error)

Get retrieves a plan by ID. Returns nil if not found.

func (*Store) List

func (s *Store) List(directory string) ([]*Plan, error)

List returns all plans for a given directory, ordered by most recently updated.

func (*Store) ListArchived added in v0.2.5

func (s *Store) ListArchived(directory string) ([]*Plan, error)

ListArchived returns all archived plans for a given directory (status = locked AND archived_at > 0).

func (*Store) Lock

func (s *Store) Lock(id string) error

Lock sets a plan's status to "locked", preventing further modifications. Returns an error if the plan is already locked.

func (*Store) Update

func (s *Store) Update(plan *Plan) error

Update modifies a plan's mutable fields (title, model, status, compaction_summary, breakdown_status, breakdown_warnings, archived_at).

Jump to

Keyboard shortcuts

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