store

package
v0.139.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 8 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 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) 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) 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) 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) SetTaskError

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

func (*Store) SetTaskOutput

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

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
	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
}

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