store

package
v0.145.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Name             string
	Adapter          string
	Command          string
	ContextWindow    int
	DefaultIsolation string
	Healthy          bool
	HealthChecked    *time.Time
	ConfigJSON       *string
}

type ChatMsg

type ChatMsg struct {
	ID        int64
	SessionID string
	Role      string
	Content   string
	CreatedAt time.Time
}

type ChatSession

type ChatSession struct {
	ID        string
	Agent     string
	Title     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type LogEntry

type LogEntry struct {
	ID        int64
	TaskID    string
	Timestamp time.Time
	Event     string
	Detail    *string
}

type Message added in v0.144.0

type Message struct {
	ID             int64
	MessageID      string
	OwnerID        string
	SenderActor    string
	RecipientActor string
	Channel        string
	Kind           string
	ReplyTo        string
	Content        string
	CreatedAt      time.Time
	ExpiresAt      time.Time
}

type Store

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

func Open

func Open(dsn string) (*Store, error)

func (*Store) AppendChatMessage

func (s *Store) AppendChatMessage(sessionID, role, content string) error

func (*Store) AppendLog

func (s *Store) AppendLog(taskID, event string, detail *string) error

func (*Store) AppendThread

func (s *Store) AppendThread(e *ThreadEntry) error

func (*Store) AppendThreadAt

func (s *Store) AppendThreadAt(e *ThreadEntry, ts time.Time) error

func (*Store) ClearTaskCron

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

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateChatSession

func (s *Store) CreateChatSession(id, agent string) error

func (*Store) CreateMessage added in v0.144.0

func (s *Store) CreateMessage(message *Message) error

func (*Store) CreateTask

func (s *Store) CreateTask(t *Task) error

func (*Store) DB

func (s *Store) DB() *sql.DB

func (*Store) DeleteChatSession

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

func (*Store) DeleteThreadOlderThan

func (s *Store) DeleteThreadOlderThan(ts time.Time) (int64, error)

func (*Store) GetAgent

func (s *Store) GetAgent(name string) (*Agent, error)

func (*Store) GetChatSession

func (s *Store) GetChatSession(id string) (*ChatSession, error)

func (*Store) GetMessage added in v0.144.0

func (s *Store) GetMessage(ownerID, messageID string) (*Message, error)

func (*Store) GetTask

func (s *Store) GetTask(id string) (*Task, error)

func (*Store) IncrementRetryCount

func (s *Store) IncrementRetryCount(taskID string) error

func (*Store) ListAgents

func (s *Store) ListAgents() ([]*Agent, error)

func (*Store) ListChatMessages

func (s *Store) ListChatMessages(sessionID string) ([]*ChatMsg, error)

func (*Store) ListChatSessions

func (s *Store) ListChatSessions() ([]*ChatSession, error)

func (*Store) ListLogByTask

func (s *Store) ListLogByTask(taskID string) ([]*LogEntry, error)

func (*Store) ListMessages added in v0.144.0

func (s *Store) ListMessages(ownerID, actor, channel, afterMessageID string, limit int, includeSent bool) ([]*Message, error)

ListMessages returns messages visible to actor in ascending durable order. Broadcasts and messages addressed to actor are visible. Sent messages are omitted unless includeSent is requested.

func (*Store) ListPending

func (s *Store) ListPending(now time.Time) ([]*Task, error)

func (*Store) ListReady

func (s *Store) ListReady(now time.Time) ([]*Task, error)

ListReady returns pending tasks where all dependencies are done (or have no dependencies).

func (*Store) ListRecent

func (s *Store) ListRecent(n int) ([]*Task, error)

func (*Store) ListRecentThread

func (s *Store) ListRecentThread(n int) ([]*ThreadEntry, error)

func (*Store) ListRecurring

func (s *Store) ListRecurring() ([]*Task, error)

func (*Store) ListThreadByDate

func (s *Store) ListThreadByDate(date time.Time) ([]*ThreadEntry, error)

func (*Store) PurgeExpiredMessages added in v0.144.0

func (s *Store) PurgeExpiredMessages() error

func (*Store) SetTaskError

func (s *Store) SetTaskError(id, errMsg string) error

func (*Store) SetTaskOutput

func (s *Store) SetTaskOutput(id, output string) error

func (*Store) SetTaskResolved added in v0.144.0

func (s *Store) SetTaskResolved(id, agent, isolation string) error

SetTaskResolved records the runtime choices made by the orchestrator. Tasks may be submitted without either field, so the stored values must be updated after skill/config precedence has been resolved if API clients are to see what actually ran.

func (*Store) SetTaskWhat added in v0.145.0

func (s *Store) SetTaskWhat(id, what string) error

SetTaskWhat records the final prompt used to execute a task. Some task types, such as queued agent follow-ups, cannot assemble their complete prompt until a dependency has finished.

func (*Store) SumTokensByDateRange

func (s *Store) SumTokensByDateRange(start, end time.Time) (int, error)

func (*Store) ThreadEntryExists

func (s *Store) ThreadEntryExists(taskID *string, wingID string, timestamp time.Time) (bool, error)

ThreadEntryExists checks if a thread entry with the given task_id, wing_id, and timestamp exists.

func (*Store) ThreadEntryExistsBySummary

func (s *Store) ThreadEntryExistsBySummary(wingID string, timestamp time.Time, summary string) (bool, error)

ThreadEntryExistsBySummary checks if a thread entry with the given wing_id, timestamp, and summary exists.

func (*Store) UpdateAgentHealth

func (s *Store) UpdateAgentHealth(name string, healthy bool, checkedAt time.Time) error

func (*Store) UpdateTaskStatus

func (s *Store) UpdateTaskStatus(id, status string) error

func (*Store) UpsertAgent

func (s *Store) UpsertAgent(a *Agent) error

type Task

type Task struct {
	ID             string
	Type           string
	What           string
	RunAt          time.Time
	Agent          string
	Model          string
	TimeoutSeconds int
	Isolation      string
	Memory         *string
	ParentID       *string
	Status         string
	Cron           *string
	WingID         *string
	CreatedAt      time.Time
	StartedAt      *time.Time
	FinishedAt     *time.Time
	Output         *string
	Error          *string
	RetryCount     int
	MaxRetries     int
	DependsOn      *string
	CWD            string
	PromptName     string
	PromptRevision string
	Principal      string
	RunnerPID      int
	EggConfigYAML  string
}

type ThreadEntry

type ThreadEntry struct {
	ID         int64
	TaskID     *string
	Timestamp  time.Time
	WingID     string
	Agent      *string
	Skill      *string
	UserInput  *string
	Summary    string
	TokensUsed *int
}

Jump to

Keyboard shortcuts

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