goal

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BudgetLimitPrompt

func BudgetLimitPrompt(state State) string

func ContinuationPrompt

func ContinuationPrompt(state State) string

func StartPrompt

func StartPrompt(state State) string

func ValidateStatus

func ValidateStatus(status Status) error

Types

type Change

type Change struct {
	Previous State
	Current  State
}

type ChangeReceiver

type ChangeReceiver interface {
	HandleGoalChange(Change)
}

type Manager

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

func NewManager

func NewManager(receiver SignalReceiver, stateAppender StateAppender) *Manager

func (*Manager) Block

func (m *Manager) Block(reason string) (State, error)

func (*Manager) Clear

func (m *Manager) Clear() (State, error)

func (*Manager) Complete

func (m *Manager) Complete(reason string) (State, error)

func (*Manager) Create

func (m *Manager) Create(objective string) (State, error)

func (*Manager) CreateWithBudget

func (m *Manager) CreateWithBudget(objective string, tokenBudget int) (State, error)

func (*Manager) Pause

func (m *Manager) Pause() (State, error)

func (*Manager) Restore

func (m *Manager) Restore(state State) error

func (*Manager) Resume

func (m *Manager) Resume() (State, error)

func (*Manager) ResumeWithBudget

func (m *Manager) ResumeWithBudget(tokenBudget int) (State, error)

func (*Manager) SetChangeHandler

func (m *Manager) SetChangeHandler(fn func(Change))

func (*Manager) SetSuspender

func (m *Manager) SetSuspender(fn func() bool)

func (*Manager) SetTokenCounter

func (m *Manager) SetTokenCounter(fn func() int)

func (*Manager) Snapshot

func (m *Manager) Snapshot() State

func (*Manager) UsageLimit

func (m *Manager) UsageLimit(reason string) (State, error)

type Signal

type Signal struct {
	Active   bool
	Key      string
	Reminder string
	Err      error
}

Signal is the narrow runtime contract consumed by agent.Session. Keeping it in this package lets Manager wire continuation without importing agent.

type SignalReceiver

type SignalReceiver interface {
	SetGoalSignal(func() Signal)
}

type State

type State struct {
	ID                       string
	Objective                string
	Status                   Status
	CreatedAt                time.Time
	UpdatedAt                time.Time
	CompletedAt              time.Time
	BlockedAt                time.Time
	BudgetLimitedAt          time.Time
	UsageLimitedAt           time.Time
	Reason                   string
	BlockedReason            string
	BlockedCount             int
	BlockedAttemptTokenTotal int
	BudgetLimitReported      bool
	TokenBudget              int
	TokensUsed               int
	TokenTotalAtLastAccount  int
}

func StateFromEntry

func StateFromEntry(entry storage.GoalStateEntry) State

StateFromEntry converts a persisted goal entry back into runtime state. Inverse of the mapping in replaceAndPersist.

func (State) Active

func (s State) Active() bool

func (State) Empty

func (s State) Empty() bool

func (State) Normalize

func (s State) Normalize() State

type StateAppender

type StateAppender interface {
	AppendGoalState(storage.GoalStateEntry) error
}

type Status

type Status string
const (
	StatusOff           Status = "off"
	StatusActive        Status = "active"
	StatusPaused        Status = "paused"
	StatusComplete      Status = "complete"
	StatusBlocked       Status = "blocked"
	StatusBudgetLimited Status = "budget_limited"
	StatusUsageLimited  Status = "usage_limited"
)

type Store

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

func NewStore

func NewStore() *Store

func (*Store) Replace

func (s *Store) Replace(state State)

func (*Store) Snapshot

func (s *Store) Snapshot() State

type TokenCounter

type TokenCounter interface {
	TotalTokens() int
}

Jump to

Keyboard shortcuts

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