Documentation
¶
Index ¶
- Variables
- type ReadOnlyOpenOption
- type ReadOnlySessionDB
- func (s *ReadOnlySessionDB) Close(ctx context.Context) error
- func (s *ReadOnlySessionDB) History(ctx context.Context, query store.EventQuery) ([]store.TurnHistory, error)
- func (s *ReadOnlySessionDB) Query(ctx context.Context, query store.EventQuery) (events []store.SessionEvent, err error)
- func (s *ReadOnlySessionDB) Record(context.Context, store.SessionEvent) error
- func (s *ReadOnlySessionDB) RecordTokenUsage(context.Context, store.TokenUsage) error
- type SessionDB
- func (s *SessionDB) Clear(ctx context.Context) error
- func (s *SessionDB) Close(ctx context.Context) error
- func (s *SessionDB) History(ctx context.Context, query store.EventQuery) ([]store.TurnHistory, error)
- func (s *SessionDB) Path() string
- func (s *SessionDB) Query(ctx context.Context, query store.EventQuery) ([]store.SessionEvent, error)
- func (s *SessionDB) QueryHookRuns(ctx context.Context, query store.HookRunQuery) ([]hookspkg.HookRunRecord, error)
- func (s *SessionDB) Record(ctx context.Context, event store.SessionEvent) error
- func (s *SessionDB) RecordHookRun(ctx context.Context, record hookspkg.HookRunRecord) error
- func (s *SessionDB) RecordPersisted(ctx context.Context, event store.SessionEvent) (store.SessionEvent, error)
- func (s *SessionDB) RecordTokenUsage(ctx context.Context, usage store.TokenUsage) error
- func (s *SessionDB) SessionID() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrReadOnlyRecordEvents reports a rejected event write against a read-only session database. ErrReadOnlyRecordEvents = errors.New("store: read-only session database cannot record events") // ErrReadOnlyRecordTokenUsage reports a rejected token-usage write against a read-only session database. ErrReadOnlyRecordTokenUsage = errors.New("store: read-only session database cannot record token usage") )
Functions ¶
This section is empty.
Types ¶
type ReadOnlyOpenOption ¶
type ReadOnlyOpenOption func(*readOnlyOpenConfig)
ReadOnlyOpenOption customizes read-only session database opening.
func WithReadOnlyOpenRetry ¶
func WithReadOnlyOpenRetry( maxAttempts int, minRetryDelay time.Duration, maxRetryDelay time.Duration, ) ReadOnlyOpenOption
WithReadOnlyOpenRetry configures retry behavior for read-only session database opens.
type ReadOnlySessionDB ¶
type ReadOnlySessionDB struct {
// contains filtered or unexported fields
}
ReadOnlySessionDB opens an existing per-session events database for queries without creating, migrating, checkpointing, or otherwise mutating it.
func OpenSessionDBReadOnly ¶
func OpenSessionDBReadOnly( ctx context.Context, sessionID string, path string, options ...ReadOnlyOpenOption, ) (*ReadOnlySessionDB, error)
OpenSessionDBReadOnly opens an existing per-session events database in SQLite read-only mode. It intentionally fails for missing paths instead of creating a fresh database during stale transcript/event reads.
func (*ReadOnlySessionDB) Close ¶
func (s *ReadOnlySessionDB) Close(ctx context.Context) error
Close closes the read-only database handle without checkpointing.
func (*ReadOnlySessionDB) History ¶
func (s *ReadOnlySessionDB) History(ctx context.Context, query store.EventQuery) ([]store.TurnHistory, error)
History returns ordered session events grouped by turn id.
func (*ReadOnlySessionDB) Query ¶
func (s *ReadOnlySessionDB) Query( ctx context.Context, query store.EventQuery, ) (events []store.SessionEvent, err error)
Query returns events filtered by the supplied options.
func (*ReadOnlySessionDB) Record ¶
func (s *ReadOnlySessionDB) Record(context.Context, store.SessionEvent) error
func (*ReadOnlySessionDB) RecordTokenUsage ¶
func (s *ReadOnlySessionDB) RecordTokenUsage(context.Context, store.TokenUsage) error
type SessionDB ¶
type SessionDB struct {
// contains filtered or unexported fields
}
SessionDB owns a per-session SQLite database and its dedicated writer loop.
func OpenSessionDB ¶
OpenSessionDB opens or creates the per-session events database at path.
func (*SessionDB) Clear ¶
Clear removes all persisted per-session runtime records while preserving the migrated database schema and the open writer. It is used by session reset flows before the recorder is exposed to any live session goroutine.
func (*SessionDB) History ¶
func (s *SessionDB) History(ctx context.Context, query store.EventQuery) ([]store.TurnHistory, error)
History returns ordered session events grouped by turn id.
func (*SessionDB) Query ¶
func (s *SessionDB) Query(ctx context.Context, query store.EventQuery) ([]store.SessionEvent, error)
Query returns events filtered by the supplied options.
func (*SessionDB) QueryHookRuns ¶
func (s *SessionDB) QueryHookRuns(ctx context.Context, query store.HookRunQuery) ([]hookspkg.HookRunRecord, error)
QueryHookRuns returns persisted hook execution records filtered by the supplied options.
func (*SessionDB) RecordHookRun ¶
RecordHookRun stores one hook execution audit record in the per-session store.
func (*SessionDB) RecordPersisted ¶
func (s *SessionDB) RecordPersisted(ctx context.Context, event store.SessionEvent) (store.SessionEvent, error)
RecordPersisted appends a session event and returns the stored row with sequence metadata.
func (*SessionDB) RecordTokenUsage ¶
RecordTokenUsage stores or merges per-turn usage data for the session.