Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSource = errors.New("not a valid Source")
var ErrInvalidStatus = errors.New("not a valid Status")
Functions ¶
func ValidateTransition ¶
ValidateTransition checks whether a status change is allowed.
Types ¶
type ListFilter ¶
ListFilter controls which todo items are returned by List.
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
Ref is a typed URI reference for a todo item. Format: "scheme://value" where scheme identifies the action type. Fields are unexported; use Scheme() and Value() getters.
func MustParseRef ¶
MustParseRef is like ParseRef but panics on error. Use only in tests and initialization code.
func ParseRef ¶
ParseRef parses a URI string into scheme and value. Schemes are normalized to lowercase. Returns an error if the string is non-empty but has no "://" separator.
func (Ref) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Ref) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Source ¶
type Source string
Source identifies who created the todo.
ENUM(
agent human system
)
func ParseSource ¶
ParseSource attempts to convert a string to a Source.
type Status ¶
type Status string
Status tracks the lifecycle of a todo item.
ENUM(
pending acknowledged completed dismissed
)
const ( // StatusPending is a Status of type pending. StatusPending Status = "pending" // StatusAcknowledged is a Status of type acknowledged. StatusAcknowledged Status = "acknowledged" // StatusCompleted is a Status of type completed. StatusCompleted Status = "completed" // StatusDismissed is a Status of type dismissed. StatusDismissed Status = "dismissed" )
func ParseStatus ¶
ParseStatus attempts to convert a string to a Status.
type Store ¶
type Store interface {
Create(ctx context.Context, t Todo) error
Get(ctx context.Context, id string) (Todo, error)
Update(ctx context.Context, id string, status Status) error
List(ctx context.Context, filter ListFilter) ([]Todo, error)
CountPending(ctx context.Context) (int, error)
CountOpen(ctx context.Context) (int, error)
CountRecentBySession(ctx context.Context, sessionID string, since time.Time) (int, error)
Delete(ctx context.Context, id string) error
}
Store persists todo items to durable storage.
type Todo ¶
type Todo struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Source Source `json:"source"`
Title string `json:"title"`
URI Ref `json:"uri"`
Status Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt time.Time `json:"completed_at,omitzero"`
}
Todo represents a single todo item created by an agent or human.
func NewAgentTodo ¶
NewAgentTodo creates an agent-sourced todo and requires SessionID.
func NewHumanTodo ¶
NewHumanTodo creates a human-sourced todo.
func NewSystemTodo ¶
NewSystemTodo creates a system-sourced todo.