Documentation
¶
Index ¶
- Variables
- type ArtifactSyncRow
- type EventAuditStats
- type EventListResult
- type HookRunRecord
- type JobStateRow
- type RunDB
- func (r *RunDB) AppendSyntheticEvent(ctx context.Context, kind events.EventKind, payload any) (events.Event, error)
- func (r *RunDB) Close() error
- func (r *RunDB) CloseContext(ctx context.Context) error
- func (r *RunDB) CurrentMaxSequence(ctx context.Context) (uint64, error)
- func (r *RunDB) EventAuditStats(ctx context.Context) (EventAuditStats, error)
- func (r *RunDB) GetIntegrity(ctx context.Context) (RunIntegrityState, error)
- func (r *RunDB) LastEvent(ctx context.Context) (*events.Event, error)
- func (r *RunDB) ListArtifactSyncLog(ctx context.Context) ([]ArtifactSyncRow, error)
- func (r *RunDB) ListCompactedSessionUpdateEvents(ctx context.Context) ([]events.Event, error)
- func (r *RunDB) ListEvents(ctx context.Context, fromSeq uint64, limit int) (EventListResult, error)
- func (r *RunDB) ListEventsByKind(ctx context.Context, eventKinds []events.EventKind) ([]events.Event, error)
- func (r *RunDB) ListHookRuns(ctx context.Context) ([]HookRunRecord, error)
- func (r *RunDB) ListJobState(ctx context.Context) ([]JobStateRow, error)
- func (r *RunDB) ListTokenUsage(ctx context.Context) ([]TokenUsageRow, error)
- func (r *RunDB) ListTranscriptMessages(ctx context.Context) ([]TranscriptMessageRow, error)
- func (r *RunDB) ListTranscriptMessagesTail(ctx context.Context, limit int, maxBytes int) ([]TranscriptMessageRow, error)
- func (r *RunDB) Path() string
- func (r *RunDB) RecordHookRun(ctx context.Context, record HookRunRecord) error
- func (r *RunDB) StoreEventBatch(ctx context.Context, items []events.Event) (retErr error)
- func (r *RunDB) UpsertIntegrity(ctx context.Context, update RunIntegrityUpdate) (RunIntegrityState, error)
- type RunIntegrityState
- type RunIntegrityUpdate
- type SchemaTooNewError
- type TokenUsageRow
- type TranscriptMessageRow
Constants ¶
This section is empty.
Variables ¶
var ErrSchemaTooNew = errors.New("rundb: schema too new")
ErrSchemaTooNew reports that a database carries a migration newer than this binary understands.
Functions ¶
This section is empty.
Types ¶
type ArtifactSyncRow ¶
type ArtifactSyncRow struct {
Sequence uint64
RelativePath string
ChangeKind string
Checksum string
SyncedAt time.Time
}
ArtifactSyncRow is the persisted artifact sync history row.
type EventAuditStats ¶
type EventAuditStats struct {
EventCount uint64
MaxSequence uint64
SessionUpdateCount uint64
TranscriptMessageCount uint64
}
EventAuditStats summarizes persisted event/projection counts without loading event payloads.
type EventListResult ¶
EventListResult captures one ordered event window from the canonical log.
type HookRunRecord ¶
type HookRunRecord struct {
ID string
HookName string
Source string
Outcome string
DurationNS int64
PayloadJSON string
RecordedAt time.Time
}
HookRunRecord captures one hook audit row persisted independently of the canonical event stream.
type JobStateRow ¶
type JobStateRow struct {
JobID string
TaskID string
Status string
AgentName string
SummaryJSON string
UpdatedAt time.Time
}
JobStateRow is the latest projected state for one job.
type RunDB ¶
type RunDB struct {
// contains filtered or unexported fields
}
RunDB owns one per-run SQLite store.
func (*RunDB) AppendSyntheticEvent ¶
func (r *RunDB) AppendSyntheticEvent( ctx context.Context, kind events.EventKind, payload any, ) (events.Event, error)
AppendSyntheticEvent appends one synthetic canonical event with the next available sequence. It is intended for daemon-owned recovery flows that need to persist a terminal event after the original writer loop is gone.
func (*RunDB) CloseContext ¶
CloseContext checkpoints the SQLite WAL and closes the underlying handle.
func (*RunDB) CurrentMaxSequence ¶
CurrentMaxSequence returns the latest stored event sequence.
func (*RunDB) EventAuditStats ¶
func (r *RunDB) EventAuditStats(ctx context.Context) (EventAuditStats, error)
EventAuditStats returns cheap integrity counters without event payload reads.
func (*RunDB) GetIntegrity ¶
func (r *RunDB) GetIntegrity(ctx context.Context) (RunIntegrityState, error)
GetIntegrity returns the durable sticky integrity state for this run.
func (*RunDB) ListArtifactSyncLog ¶
func (r *RunDB) ListArtifactSyncLog(ctx context.Context) ([]ArtifactSyncRow, error)
ListArtifactSyncLog returns artifact sync rows in sequence order.
func (*RunDB) ListCompactedSessionUpdateEvents ¶
ListCompactedSessionUpdateEvents returns the session updates needed to rebuild a compact transcript: every non-tool update plus the first and latest update for each tool call.
func (*RunDB) ListEvents ¶
ListEvents returns persisted events at or after fromSeq in sequence order. When limit is greater than zero, it returns at most limit+1 rows so callers can detect a following page without a second query.
func (*RunDB) ListEventsByKind ¶
func (r *RunDB) ListEventsByKind(ctx context.Context, eventKinds []events.EventKind) ([]events.Event, error)
ListEventsByKind returns requested event kinds in sequence order.
func (*RunDB) ListHookRuns ¶
func (r *RunDB) ListHookRuns(ctx context.Context) ([]HookRunRecord, error)
ListHookRuns returns persisted hook audit rows in recorded order.
func (*RunDB) ListJobState ¶
func (r *RunDB) ListJobState(ctx context.Context) ([]JobStateRow, error)
ListJobState returns projected job rows ordered by job id.
func (*RunDB) ListTokenUsage ¶
func (r *RunDB) ListTokenUsage(ctx context.Context) ([]TokenUsageRow, error)
ListTokenUsage returns token-usage rows ordered by timestamp.
func (*RunDB) ListTranscriptMessages ¶
func (r *RunDB) ListTranscriptMessages(ctx context.Context) ([]TranscriptMessageRow, error)
ListTranscriptMessages returns projected transcript rows in sequence order.
func (*RunDB) ListTranscriptMessagesTail ¶
func (r *RunDB) ListTranscriptMessagesTail( ctx context.Context, limit int, maxBytes int, ) ([]TranscriptMessageRow, error)
ListTranscriptMessagesTail returns a bounded transcript tail in sequence order.
func (*RunDB) RecordHookRun ¶
func (r *RunDB) RecordHookRun(ctx context.Context, record HookRunRecord) error
RecordHookRun persists one hook audit row.
func (*RunDB) StoreEventBatch ¶
StoreEventBatch persists canonical events and projection rows in one transaction.
func (*RunDB) UpsertIntegrity ¶
func (r *RunDB) UpsertIntegrity(ctx context.Context, update RunIntegrityUpdate) (RunIntegrityState, error)
UpsertIntegrity merges the supplied integrity update into the sticky durable run-integrity row and returns the merged result.
type RunIntegrityState ¶
type RunIntegrityState struct {
Incomplete bool
Reasons []string
JournalTerminalDrops uint64
JournalNonTerminalDrops uint64
FirstDetectedAt time.Time
UpdatedAt time.Time
}
RunIntegrityState is the durable sticky integrity state for one run.
type RunIntegrityUpdate ¶
type RunIntegrityUpdate struct {
Incomplete bool
Reasons []string
JournalTerminalDrops uint64
JournalNonTerminalDrops uint64
}
RunIntegrityUpdate captures one integrity-state update that should merge with any existing sticky run-integrity row.
type SchemaTooNewError ¶
SchemaTooNewError carries the current database and binary migration versions.
func (SchemaTooNewError) Error ¶
func (e SchemaTooNewError) Error() string
func (SchemaTooNewError) Is ¶
func (e SchemaTooNewError) Is(target error) bool
type TokenUsageRow ¶
type TokenUsageRow struct {
TurnID string
InputTokens int
OutputTokens int
TotalTokens int
CostAmount *float64
Timestamp time.Time
}
TokenUsageRow is the persisted token usage projection for one turn or aggregate record.
type TranscriptMessageRow ¶
type TranscriptMessageRow struct {
Sequence uint64
Stream string
Role string
Content string
MetadataJSON string
MessageID string
Timestamp time.Time
}
TranscriptMessageRow is the projected transcript row for one event sequence.
func ProjectTranscriptMessage ¶
func ProjectTranscriptMessage(item events.Event) (TranscriptMessageRow, bool, error)
ProjectTranscriptMessage projects one canonical event into the persisted transcript read model used for cold snapshots and replay.