Documentation
¶
Index ¶
- Constants
- type Agent
- type ChatMsg
- type ChatSession
- type Conversation
- type ConversationContinuation
- type ConversationEvent
- type ConversationWake
- type ConversationWakePolicy
- type LogEntry
- type Message
- type Store
- func (s *Store) AppendChatMessage(sessionID, role, content string) error
- func (s *Store) AppendLog(taskID, event string, detail *string) error
- func (s *Store) AppendThread(e *ThreadEntry) error
- func (s *Store) AppendThreadAt(e *ThreadEntry, ts time.Time) error
- func (s *Store) BindConversationWake(w *ConversationWake, session, provider, input string, now int64) error
- func (s *Store) CheckpointConversation(owner, id string, expected, after int64, checkpoint string) error
- func (s *Store) ClearTaskCron(id string) error
- func (s *Store) Close() error
- func (s *Store) ConversationEvents(owner, root string, after int64, limit int) ([]ConversationEvent, error)
- func (s *Store) ConversationExecutions(id string) ([]string, error)
- func (s *Store) ConversationForSession(session string) (*Conversation, error)
- func (s *Store) ConversationImportCursor(session string) (int64, error)
- func (s *Store) ConversationWakePolicy(root string) (ConversationWakePolicy, error)
- func (s *Store) ConversationWakeRoots(after string, limit int) ([]*Conversation, error)
- func (s *Store) CountConversationLaunchesSince(owner string, since time.Time) (int, error)
- func (s *Store) CreateChatSession(id, agent string) error
- func (s *Store) CreateMessage(message *Message) error
- func (s *Store) CreateTask(t *Task) error
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteChatSession(id string) error
- func (s *Store) DeleteThreadOlderThan(ts time.Time) (int64, error)
- func (s *Store) GetAgent(name string) (*Agent, error)
- func (s *Store) GetChatSession(id string) (*ChatSession, error)
- func (s *Store) GetConversation(owner, id string) (*Conversation, error)
- func (s *Store) GetConversationContinuation(owner, request string) (*ConversationContinuation, error)
- func (s *Store) GetMessage(ownerID, messageID string) (*Message, error)
- func (s *Store) GetTask(id string) (*Task, error)
- func (s *Store) ImportConversationStates(c *Conversation, events []ConversationEvent, cursor int64) error
- func (s *Store) IncrementRetryCount(taskID string) error
- func (s *Store) ListAgents() ([]*Agent, error)
- func (s *Store) ListChatMessages(sessionID string) ([]*ChatMsg, error)
- func (s *Store) ListChatSessions() ([]*ChatSession, error)
- func (s *Store) ListConversations(owner, root string) ([]*Conversation, error)
- func (s *Store) ListLogByTask(taskID string) ([]*LogEntry, error)
- func (s *Store) ListMessages(ownerID, actor, channel, afterMessageID string, limit int, includeSent bool) ([]*Message, error)
- func (s *Store) ListPending(now time.Time) ([]*Task, error)
- func (s *Store) ListReady(now time.Time) ([]*Task, error)
- func (s *Store) ListRecent(n int) ([]*Task, error)
- func (s *Store) ListRecentThread(n int) ([]*ThreadEntry, error)
- func (s *Store) ListRecurring() ([]*Task, error)
- func (s *Store) ListThreadByDate(date time.Time) ([]*ThreadEntry, error)
- func (s *Store) PendingConversationWake(root string) (*ConversationWake, error)
- func (s *Store) PurgeExpiredMessages() error
- func (s *Store) QueueConversationWake(root string) (*ConversationWake, error)
- func (s *Store) RecordConversationState(c *Conversation, cursor int64, state, source string) error
- func (s *Store) RecordConversationWake(w *ConversationWake, status, reason string, receipt, now int64) error
- func (s *Store) ReserveConversation(c Conversation) (*Conversation, bool, error)
- func (s *Store) ReserveConversationContinuation(c ConversationContinuation) (*ConversationContinuation, bool, error)
- func (s *Store) ResumeConversationExecution(source, target string) error
- func (s *Store) RetryNotSentConversationWake(owner, root string, now int64) error
- func (s *Store) SetConversationContinuationLaunch(c *ConversationContinuation, state, detail string) error
- func (s *Store) SetConversationLaunch(id, state, detail string) error
- func (s *Store) SetConversationWake(owner, root string, enabled bool) error
- func (s *Store) SetTaskError(id, errMsg string) error
- func (s *Store) SetTaskOutput(id, output string) error
- func (s *Store) SetTaskResolved(id, agent, isolation string) error
- func (s *Store) SetTaskWhat(id, what string) error
- func (s *Store) SumTokensByDateRange(start, end time.Time) (int, error)
- func (s *Store) ThreadEntryExists(taskID *string, wingID string, timestamp time.Time) (bool, error)
- func (s *Store) ThreadEntryExistsBySummary(wingID string, timestamp time.Time, summary string) (bool, error)
- func (s *Store) UpdateAgentHealth(name string, healthy bool, checkedAt time.Time) error
- func (s *Store) UpdateTaskStatus(id, status string) error
- func (s *Store) UpsertAgent(a *Agent) error
- type Task
- type ThreadEntry
Constants ¶
const MaxConversationWakeAttempts = 12
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatSession ¶
type Conversation ¶ added in v0.148.0
type Conversation struct {
ID string `json:"conversation_id"`
OwnerID string `json:"-"`
RootID string `json:"root_conversation_id"`
ParentID string `json:"parent_conversation_id,omitempty"`
Title string `json:"title"`
Agent string `json:"agent"`
CWD string `json:"cwd"`
WingID string `json:"wing_id"`
SessionID string `json:"session_id"`
LaunchKey string `json:"-"`
SpecDigest string `json:"-"`
LaunchState string `json:"launch_state"`
LaunchError string `json:"launch_error,omitempty"`
Checkpoint string `json:"checkpoint,omitempty"`
DeliveredCursor int64 `json:"delivered_cursor"`
Revision int64 `json:"revision"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Conversation is the durable personal task identity. SessionID identifies its latest execution; the execution table keeps earlier instances inspectable.
type ConversationContinuation ¶ added in v0.148.0
type ConversationEvent ¶ added in v0.148.0
type ConversationEvent struct {
Sequence int64 `json:"sequence"`
RootID string `json:"root_conversation_id"`
ConversationID string `json:"conversation_id"`
SessionID string `json:"session_id"`
SourceCursor int64 `json:"session_cursor"`
State string `json:"state"`
StateSource string `json:"state_source"`
Type string `json:"type"`
CreatedAt time.Time `json:"created_at"`
}
type ConversationWake ¶ added in v0.148.0
type ConversationWake struct {
RootID string `json:"root_conversation_id"`
EventSequence int64 `json:"event_cursor"`
Attempt int `json:"attempt"`
AttemptLimit int `json:"attempt_limit"`
RequestID string `json:"request_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
ProviderSessionID string `json:"provider_session_id,omitempty"`
Input string `json:"-"`
Status string `json:"status"`
ReceiptCursor int64 `json:"receipt_cursor,omitempty"`
RetryAfter int64 `json:"retry_after,omitempty"`
Reason string `json:"reason,omitempty"`
Event ConversationEvent `json:"event"`
}
type ConversationWakePolicy ¶ added in v0.148.0
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AppendChatMessage ¶
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) BindConversationWake ¶ added in v0.148.0
func (s *Store) BindConversationWake(w *ConversationWake, session, provider, input string, now int64) error
Only queued or explicitly proven-not-sent attempts may acquire a new ID or destination. Unknown delivery keeps its immutable request and provider binding.
func (*Store) CheckpointConversation ¶ added in v0.148.0
func (s *Store) CheckpointConversation(owner, id string, expected, after int64, checkpoint string) error
CheckpointConversation is compare-and-swap. A stale controller cannot overwrite newer intent or move a delivery cursor backwards or past evidence.
func (*Store) ClearTaskCron ¶
func (*Store) ConversationEvents ¶ added in v0.148.0
func (*Store) ConversationExecutions ¶ added in v0.148.0
func (*Store) ConversationForSession ¶ added in v0.148.0
func (s *Store) ConversationForSession(session string) (*Conversation, error)
func (*Store) ConversationImportCursor ¶ added in v0.148.0
func (*Store) ConversationWakePolicy ¶ added in v0.148.0
func (s *Store) ConversationWakePolicy(root string) (ConversationWakePolicy, error)
func (*Store) ConversationWakeRoots ¶ added in v0.148.0
func (s *Store) ConversationWakeRoots(after string, limit int) ([]*Conversation, error)
func (*Store) CountConversationLaunchesSince ¶ added in v0.148.0
CountConversationLaunchesSince counts an owner's linked launches reserved at or after since, excluding launches recorded as definitely failed. It gives host mailbox admission a spawn-rate bound that survives process restarts and is shared by every process using this state directory.
func (*Store) CreateChatSession ¶
func (*Store) CreateMessage ¶ added in v0.144.0
func (*Store) CreateTask ¶
func (*Store) DeleteChatSession ¶
func (*Store) DeleteThreadOlderThan ¶
func (*Store) GetChatSession ¶
func (s *Store) GetChatSession(id string) (*ChatSession, error)
func (*Store) GetConversation ¶ added in v0.148.0
func (s *Store) GetConversation(owner, id string) (*Conversation, error)
func (*Store) GetConversationContinuation ¶ added in v0.148.0
func (s *Store) GetConversationContinuation(owner, request string) (*ConversationContinuation, error)
func (*Store) GetMessage ¶ added in v0.144.0
func (*Store) ImportConversationStates ¶ added in v0.148.0
func (s *Store) ImportConversationStates(c *Conversation, events []ConversationEvent, cursor int64) error
ImportConversationStates commits event deliveries and the session read cursor together, so reconnect replay never drops an attention or completion event.
func (*Store) IncrementRetryCount ¶
func (*Store) ListAgents ¶
func (*Store) ListChatMessages ¶
func (*Store) ListChatSessions ¶
func (s *Store) ListChatSessions() ([]*ChatSession, error)
func (*Store) ListConversations ¶ added in v0.148.0
func (s *Store) ListConversations(owner, root string) ([]*Conversation, 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) ListReady ¶
ListReady returns pending tasks where all dependencies are done (or have no dependencies).
func (*Store) ListRecentThread ¶
func (s *Store) ListRecentThread(n int) ([]*ThreadEntry, error)
func (*Store) ListRecurring ¶
func (*Store) ListThreadByDate ¶
func (s *Store) ListThreadByDate(date time.Time) ([]*ThreadEntry, error)
func (*Store) PendingConversationWake ¶ added in v0.148.0
func (s *Store) PendingConversationWake(root string) (*ConversationWake, error)
func (*Store) PurgeExpiredMessages ¶ added in v0.144.0
func (*Store) QueueConversationWake ¶ added in v0.148.0
func (s *Store) QueueConversationWake(root string) (*ConversationWake, error)
At most one event is outstanding per root. Scanning and reservation commit together; reopening the store cannot create a second wake for that event.
func (*Store) RecordConversationState ¶ added in v0.148.0
func (s *Store) RecordConversationState(c *Conversation, cursor int64, state, source string) error
func (*Store) RecordConversationWake ¶ added in v0.148.0
func (s *Store) RecordConversationWake(w *ConversationWake, status, reason string, receipt, now int64) error
func (*Store) ReserveConversation ¶ added in v0.148.0
func (s *Store) ReserveConversation(c Conversation) (*Conversation, bool, error)
ReserveConversation atomically claims a caller-provided launch key before spawning. Replays return the same logical and execution IDs, even if a crash left the reservation in starting; callers must reconcile, never launch again.
func (*Store) ReserveConversationContinuation ¶ added in v0.148.0
func (s *Store) ReserveConversationContinuation(c ConversationContinuation) (*ConversationContinuation, bool, error)
ReserveConversationContinuation claims the retry key and links the execution before dispatch. A crash leaves starting evidence; replay never dispatches it.
func (*Store) ResumeConversationExecution ¶ added in v0.148.0
func (*Store) RetryNotSentConversationWake ¶ added in v0.148.0
Explicit recovery is permitted only by a retained known-no-input outcome. Attempt numbers and old request evidence never reset or become ambiguous.
func (*Store) SetConversationContinuationLaunch ¶ added in v0.148.0
func (s *Store) SetConversationContinuationLaunch(c *ConversationContinuation, state, detail string) error
func (*Store) SetConversationLaunch ¶ added in v0.148.0
func (*Store) SetConversationWake ¶ added in v0.148.0
func (*Store) SetTaskError ¶
func (*Store) SetTaskOutput ¶
func (*Store) SetTaskResolved ¶ added in v0.144.0
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
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 (*Store) ThreadEntryExists ¶
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 (*Store) UpdateTaskStatus ¶
func (*Store) UpsertAgent ¶
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
}