Documentation
¶
Overview ¶
Package sqlite implements the state.Store interface using embedded SQLite. This is the zero-dependency default backend -- no external DB needed.
Index ¶
- type SQLiteStore
- func (s *SQLiteStore) AckActionDelivery(ctx context.Context, id, token string) error
- func (s *SQLiteStore) BeginRunAttempt(ctx context.Context, id, incarnation string, generation int64) (bool, error)
- func (s *SQLiteStore) ClaimActionDeliveries(ctx context.Context, sinkID string, now, leaseUntil time.Time, limit int) ([]*state.ActionDelivery, error)
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CompleteRun(ctx context.Context, c *state.RunCompletion) (state.CompletionResult, error)
- func (s *SQLiteStore) ConsumeApprovedAction(ctx context.Context, tenantID, agentID, runID string, generation int64, ...) (string, error)
- func (s *SQLiteStore) CountActiveRuns(ctx context.Context, agentID string) (int, error)
- func (s *SQLiteStore) CountAgents(ctx context.Context) (int, error)
- func (s *SQLiteStore) CountRunsByStatus(ctx context.Context) (map[string]int, error)
- func (s *SQLiteStore) CountRunsCreatedSince(ctx context.Context, since time.Time, agentID string) (int, error)
- func (s *SQLiteStore) CountRunsSince(ctx context.Context, tenantID, agentID string, since time.Time) (int64, error)
- func (s *SQLiteStore) CountThreadsByStatus(ctx context.Context) (map[string]int, error)
- func (s *SQLiteStore) CreateBreakGlassWindow(ctx context.Context, w *models.BreakGlassWindow) error
- func (s *SQLiteStore) CreateCachedRun(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error
- func (s *SQLiteStore) CreateConnectorAction(ctx context.Context, a *models.ConnectorAction, mutation string) (*models.ConnectorAction, error)
- func (s *SQLiteStore) CreatePendingAction(ctx context.Context, a *models.PendingAction) error
- func (s *SQLiteStore) CreateRun(ctx context.Context, run *models.Run) error
- func (s *SQLiteStore) CreateRunAdmitted(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error
- func (s *SQLiteStore) CreateThread(ctx context.Context, thread *models.Thread) error
- func (s *SQLiteStore) CredentialLeaseStorage() (credentials.Store, error)
- func (s *SQLiteStore) DeleteBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string) error
- func (s *SQLiteStore) DeleteBreakGlassWindow(ctx context.Context, id string) error
- func (s *SQLiteStore) DeleteCronSchedule(ctx context.Context, name string) error
- func (s *SQLiteStore) DeleteFinOpsOverlay(ctx context.Context) error
- func (s *SQLiteStore) DeleteItem(ctx context.Context, namespace []string, key string) error
- func (s *SQLiteStore) DeleteKillSwitch(ctx context.Context, id string) error
- func (s *SQLiteStore) DeleteMandatoryHITLRule(ctx context.Context, id string) error
- func (s *SQLiteStore) DeleteOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) error
- func (s *SQLiteStore) DeletePolicyGrant(ctx context.Context, id string) error
- func (s *SQLiteStore) DeleteRegistryEntry(ctx context.Context, name string) error
- func (s *SQLiteStore) DeleteRun(ctx context.Context, runID string) error
- func (s *SQLiteStore) DeleteThread(ctx context.Context, threadID string) error
- func (s *SQLiteStore) Downgrade(ctx context.Context) error
- func (s *SQLiteStore) ExpireGovernancePending(ctx context.Context, now time.Time) error
- func (s *SQLiteStore) ExpireUsageHolds(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *SQLiteStore) FailActionDelivery(ctx context.Context, id, token string, nextAt time.Time, reason string, ...) error
- func (s *SQLiteStore) FindActiveBreakGlass(ctx context.Context, tenantID, agentID string) (*models.BreakGlassWindow, error)
- func (s *SQLiteStore) FindActiveKill(ctx context.Context, tenantID, agentID string) (*models.KillSwitch, error)
- func (s *SQLiteStore) FindOpenPendingAction(ctx context.Context, tenantID, agentID, runID string, generation int64, ...) (*models.PendingAction, error)
- func (s *SQLiteStore) FinishConnectorAction(ctx context.Context, id string, version int64, dispatch string, ...) (*models.ConnectorAction, error)
- func (s *SQLiteStore) GetAgent(ctx context.Context, agentID string) (*models.Agent, error)
- func (s *SQLiteStore) GetAgentSchema(ctx context.Context, agentID string) (*models.AgentSchema, error)
- func (s *SQLiteStore) GetAgentVersion(ctx context.Context, agentID string, version int) (*models.AgentVersion, error)
- func (s *SQLiteStore) GetBreakGlassWindow(ctx context.Context, id string) (*models.BreakGlassWindow, error)
- func (s *SQLiteStore) GetCachedRunResult(ctx context.Context, cacheKey string) (*models.CachedRunResult, error)
- func (s *SQLiteStore) GetConnectorAction(ctx context.Context, id string) (*models.ConnectorAction, error)
- func (s *SQLiteStore) GetFinOpsOverlay(ctx context.Context) (*models.FinOpsOverlay, error)
- func (s *SQLiteStore) GetItem(ctx context.Context, namespace []string, key string, refreshTTL bool) (*models.StoreItem, error)
- func (s *SQLiteStore) GetKillSwitch(ctx context.Context, id string) (*models.KillSwitch, error)
- func (s *SQLiteStore) GetLastCronFireTime(ctx context.Context, scheduleName string) (time.Time, bool, error)
- func (s *SQLiteStore) GetLatestCheckpoint(ctx context.Context, threadID string) (*models.ThreadState, error)
- func (s *SQLiteStore) GetLatestOpaqueCheckpoint(ctx context.Context, threadID, namespace string) (*models.OpaqueCheckpoint, error)
- func (s *SQLiteStore) GetMandatoryHITLRule(ctx context.Context, id string) (*models.MandatoryHITLRule, error)
- func (s *SQLiteStore) GetOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) (*models.OpaqueCheckpoint, error)
- func (s *SQLiteStore) GetPendingAction(ctx context.Context, id string) (*models.PendingAction, error)
- func (s *SQLiteStore) GetPolicyGrant(ctx context.Context, id string) (*models.PolicyGrant, error)
- func (s *SQLiteStore) GetRegistryEntry(ctx context.Context, name string) (*models.RegistryEntry, error)
- func (s *SQLiteStore) GetRegistryEntryVersion(ctx context.Context, name string, version int) (*models.RegistryEntryVersion, error)
- func (s *SQLiteStore) GetRun(ctx context.Context, runID string) (*models.Run, error)
- func (s *SQLiteStore) GetRunUsage(ctx context.Context, binding state.RunUsageBinding) (*models.RunUsageSnapshot, error)
- func (s *SQLiteStore) GetThread(ctx context.Context, threadID string) (*models.Thread, error)
- func (s *SQLiteStore) GetWebhookDeadLetter(ctx context.Context, id string) (*models.WebhookDeadLetter, error)
- func (s *SQLiteStore) Init(ctx context.Context) error
- func (s *SQLiteStore) ListActiveRunsCreatedBefore(ctx context.Context, before time.Time, limit int) ([]*models.Run, error)
- func (s *SQLiteStore) ListAgentVersions(ctx context.Context, agentID string) ([]*models.AgentVersion, error)
- func (s *SQLiteStore) ListBreakGlassWindows(ctx context.Context) ([]*models.BreakGlassWindow, error)
- func (s *SQLiteStore) ListCheckpoints(ctx context.Context, threadID string, limit int, before string) ([]*models.ThreadState, error)
- func (s *SQLiteStore) ListConnectorActionEvents(ctx context.Context, id string, after int64, limit int) ([]*models.ConnectorActionEvent, error)
- func (s *SQLiteStore) ListCronSchedules(ctx context.Context) ([]*models.CronSchedule, error)
- func (s *SQLiteStore) ListKillSwitches(ctx context.Context) ([]*models.KillSwitch, error)
- func (s *SQLiteStore) ListMandatoryHITLRules(ctx context.Context) ([]*models.MandatoryHITLRule, error)
- func (s *SQLiteStore) ListNamespaces(ctx context.Context, req *models.StoreListNamespacesRequest) ([][]string, error)
- func (s *SQLiteStore) ListOpaqueCheckpoints(ctx context.Context, threadID string, limit int) ([]models.OpaqueCheckpointMeta, error)
- func (s *SQLiteStore) ListPendingActionApprovals(ctx context.Context, id string) ([]models.PendingActionApproval, error)
- func (s *SQLiteStore) ListPolicyGrants(ctx context.Context) ([]*models.PolicyGrant, error)
- func (s *SQLiteStore) ListRegistryEntryVersions(ctx context.Context, name string) ([]*models.RegistryEntryVersion, error)
- func (s *SQLiteStore) ListWebhookDeadLetters(ctx context.Context, limit int) ([]*models.WebhookDeadLetter, error)
- func (s *SQLiteStore) MarkExpiredConnectorActionsUnknown(ctx context.Context, cutoff time.Time, limit int) (int, error)
- func (s *SQLiteStore) PeekApprovedConnectorAction(ctx context.Context, id string) (*models.PendingAction, error)
- func (s *SQLiteStore) Ping(ctx context.Context) error
- func (s *SQLiteStore) PrepareConnectorActionDispatch(ctx context.Context, id string, version int64, approval, source string, ...) (*state.ConnectorActionDispatch, error)
- func (s *SQLiteStore) PruneCheckpoints(ctx context.Context, keepLast int) (int64, error)
- func (s *SQLiteStore) PruneConnectorActions(ctx context.Context, cutoff time.Time, limit int) (int, error)
- func (s *SQLiteStore) PruneCronClaims(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *SQLiteStore) PruneExpiredStoreItems(ctx context.Context) (int64, error)
- func (s *SQLiteStore) PruneOpaqueCheckpoints(ctx context.Context, keepLast int) (int64, error)
- func (s *SQLiteStore) PruneRuns(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *SQLiteStore) PruneTerminalHookClaims(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *SQLiteStore) PruneWebhookDeadLetters(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *SQLiteStore) PublishRegistryEntry(ctx context.Context, entry *models.RegistryEntry) error
- func (s *SQLiteStore) PutBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string, ...) (int64, error)
- func (s *SQLiteStore) PutItem(ctx context.Context, item *models.StoreItem) error
- func (s *SQLiteStore) PutOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string, data []byte, ...) (int64, error)
- func (s *SQLiteStore) RecordConnectorActionDecision(ctx context.Context, id string, version int64, ...) (*models.ConnectorAction, error)
- func (s *SQLiteStore) RecoverAgentSchema(ctx context.Context, schema *models.AgentSchema) (bool, error)
- func (s *SQLiteStore) ReleaseCronClaim(ctx context.Context, scheduleName string, fireTime time.Time) error
- func (s *SQLiteStore) ReleaseRunUsageHold(ctx context.Context, id, inc string) error
- func (s *SQLiteStore) ReleaseThreadIfNoOtherActive(ctx context.Context, threadID, excludeRunID string, status models.ThreadStatus) (bool, error)
- func (s *SQLiteStore) ReleaseUsageHold(ctx context.Context, runID string) error
- func (s *SQLiteStore) ReportRunUsage(ctx context.Context, binding state.RunUsageBinding, ...) (*models.RunUsageSnapshot, bool, error)
- func (s *SQLiteStore) RetryActionDelivery(ctx context.Context, tenantID, id string) error
- func (s *SQLiteStore) SaveCachedRunResult(ctx context.Context, result *models.CachedRunResult) error
- func (s *SQLiteStore) SaveCheckpoint(ctx context.Context, threadID string, ts *models.ThreadState) error
- func (s *SQLiteStore) SaveWebhookDeadLetter(ctx context.Context, dl *models.WebhookDeadLetter) error
- func (s *SQLiteStore) SearchActionDeliveries(ctx context.Context, req *state.ActionDeliverySearchRequest) ([]*state.ActionDelivery, error)
- func (s *SQLiteStore) SearchAgents(ctx context.Context, req *models.AgentSearchRequest) ([]*models.Agent, error)
- func (s *SQLiteStore) SearchAuditEvents(ctx context.Context, req *models.AuditSearchRequest) ([]*models.AuditEvent, error)
- func (s *SQLiteStore) SearchBreakGlassWindows(ctx context.Context, req *models.BreakGlassSearchRequest) ([]*models.BreakGlassWindow, error)
- func (s *SQLiteStore) SearchConnectorActions(ctx context.Context, req *models.ConnectorActionSearchRequest) ([]*models.ConnectorAction, error)
- func (s *SQLiteStore) SearchItems(ctx context.Context, req *models.StoreSearchRequest) ([]*models.StoreItem, error)
- func (s *SQLiteStore) SearchKillSwitches(ctx context.Context, req *models.KillSwitchSearchRequest) ([]*models.KillSwitch, error)
- func (s *SQLiteStore) SearchMandatoryHITLRules(ctx context.Context, req *models.MandatoryHITLSearchRequest) ([]*models.MandatoryHITLRule, error)
- func (s *SQLiteStore) SearchPendingActions(ctx context.Context, req *models.PendingActionSearchRequest) ([]*models.PendingAction, error)
- func (s *SQLiteStore) SearchPolicyGrants(ctx context.Context, req *models.PolicyGrantSearchRequest) ([]*models.PolicyGrant, error)
- func (s *SQLiteStore) SearchRegistryEntries(ctx context.Context, req *models.RegistrySearchRequest) ([]*models.RegistryEntry, error)
- func (s *SQLiteStore) SearchRuns(ctx context.Context, req *models.RunSearchRequest) ([]*models.Run, error)
- func (s *SQLiteStore) SearchThreads(ctx context.Context, req *models.ThreadSearchRequest) ([]*models.Thread, error)
- func (s *SQLiteStore) SearchUsageSummary(ctx context.Context, req *models.UsageSummaryRequest) ([]models.UsageSummaryRow, error)
- func (s *SQLiteStore) SetPendingActionApproved(ctx context.Context, id, decidedBy string) error
- func (s *SQLiteStore) SetPendingActionStatus(ctx context.Context, id, fromStatus, toStatus string) error
- func (s *SQLiteStore) SetThreadStatus(ctx context.Context, threadID string, status models.ThreadStatus) error
- func (s *SQLiteStore) SumUsage(ctx context.Context, tenantID, agentID string, since, until time.Time) (tokensIn, tokensOut int64, usd float64, err error)
- func (s *SQLiteStore) SumUsageHolds(ctx context.Context, tenantID, agentID string, since, until time.Time) (usd float64, tokens int64, count int64, err error)
- func (*SQLiteStore) SupportsWorkloadIdentity() bool
- func (s *SQLiteStore) TryClaimCronFire(ctx context.Context, scheduleName string, fireTime time.Time) (bool, error)
- func (s *SQLiteStore) TryClaimRunTerminalHook(ctx context.Context, runID, incarnation string) (bool, error)
- func (s *SQLiteStore) TryClaimTerminalHook(ctx context.Context, runID string) (bool, error)
- func (s *SQLiteStore) TryClaimThread(ctx context.Context, threadID string) (bool, error)
- func (s *SQLiteStore) TryMarkRunTimeout(ctx context.Context, runID string, errMsg string) (bool, error)
- func (s *SQLiteStore) UpdateRunStatus(ctx context.Context, runID string, status models.RunStatus, output []byte, ...) error
- func (s *SQLiteStore) UpdateThread(ctx context.Context, threadID string, patch *models.ThreadPatch) (*models.Thread, error)
- func (s *SQLiteStore) UpsertAgent(ctx context.Context, agent *models.Agent) error
- func (s *SQLiteStore) UpsertAgentSchema(ctx context.Context, schema *models.AgentSchema) error
- func (s *SQLiteStore) UpsertCronSchedule(ctx context.Context, sched *models.CronSchedule) error
- func (s *SQLiteStore) UpsertFinOpsOverlay(ctx context.Context, o *models.FinOpsOverlay) error
- func (s *SQLiteStore) UpsertKillSwitch(ctx context.Context, k *models.KillSwitch) error
- func (s *SQLiteStore) UpsertMandatoryHITLRule(ctx context.Context, r *models.MandatoryHITLRule) error
- func (s *SQLiteStore) UpsertPolicyGrant(ctx context.Context, g *models.PolicyGrant) error
- func (s *SQLiteStore) UpsertRunUsageHold(ctx context.Context, inc string, hold *models.UsageHold) error
- func (s *SQLiteStore) UpsertUsageHold(ctx context.Context, h *models.UsageHold) error
- func (s *SQLiteStore) WriteAuditEvent(ctx context.Context, ev *models.AuditEvent) error
- func (s *SQLiteStore) WriteRunUsageEvent(ctx context.Context, inc string, event *models.UsageEvent) error
- func (s *SQLiteStore) WriteUsageEvent(ctx context.Context, ev *models.UsageEvent) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore implements state.Store with an embedded SQLite database.
func New ¶
func New(path string) (*SQLiteStore, error)
New creates a new SQLite store. If path is empty, uses an in-memory DB.
func (*SQLiteStore) AckActionDelivery ¶ added in v0.7.0
func (s *SQLiteStore) AckActionDelivery(ctx context.Context, id, token string) error
func (*SQLiteStore) BeginRunAttempt ¶
func (*SQLiteStore) ClaimActionDeliveries ¶ added in v0.7.0
func (s *SQLiteStore) ClaimActionDeliveries(ctx context.Context, sinkID string, now, leaseUntil time.Time, limit int) ([]*state.ActionDelivery, error)
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
Close closes the database connection.
func (*SQLiteStore) CompleteRun ¶
func (s *SQLiteStore) CompleteRun(ctx context.Context, c *state.RunCompletion) (state.CompletionResult, error)
func (*SQLiteStore) ConsumeApprovedAction ¶
func (s *SQLiteStore) ConsumeApprovedAction(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, argsDigest, targetRevision, policyRevision, toolRevision string) (string, error)
ConsumeApprovedAction atomically marks an approved action consumed.
func (*SQLiteStore) CountActiveRuns ¶
func (*SQLiteStore) CountAgents ¶
func (s *SQLiteStore) CountAgents(ctx context.Context) (int, error)
func (*SQLiteStore) CountRunsByStatus ¶
func (*SQLiteStore) CountRunsCreatedSince ¶
func (*SQLiteStore) CountRunsSince ¶
func (s *SQLiteStore) CountRunsSince(ctx context.Context, tenantID, agentID string, since time.Time) (int64, error)
CountRunsSince counts runs created at/after since for tenant (optional agent).
func (*SQLiteStore) CountThreadsByStatus ¶
func (*SQLiteStore) CreateBreakGlassWindow ¶
func (s *SQLiteStore) CreateBreakGlassWindow(ctx context.Context, w *models.BreakGlassWindow) error
func (*SQLiteStore) CreateCachedRun ¶
func (s *SQLiteStore) CreateCachedRun(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error
func (*SQLiteStore) CreateConnectorAction ¶ added in v0.7.0
func (s *SQLiteStore) CreateConnectorAction(ctx context.Context, a *models.ConnectorAction, mutation string) (*models.ConnectorAction, error)
func (*SQLiteStore) CreatePendingAction ¶
func (s *SQLiteStore) CreatePendingAction(ctx context.Context, a *models.PendingAction) error
CreatePendingAction inserts or reuses a scoped open approval. The canonical action ID is written back to a.ID. A nullable unique key arbitrates concurrent creates; legacy rows are reused without changing their stored history.
func (*SQLiteStore) CreateRunAdmitted ¶
func (s *SQLiteStore) CreateRunAdmitted(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error
CreateRunAdmitted runs COUNT + INSERT under BEGIN IMMEDIATE so concurrent writers serialize (SQLite write lock) before either observes the other.
func (*SQLiteStore) CreateThread ¶
func (*SQLiteStore) CredentialLeaseStorage ¶ added in v0.7.0
func (s *SQLiteStore) CredentialLeaseStorage() (credentials.Store, error)
func (*SQLiteStore) DeleteBoundOpaqueCheckpoint ¶
func (s *SQLiteStore) DeleteBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string) error
func (*SQLiteStore) DeleteBreakGlassWindow ¶
func (s *SQLiteStore) DeleteBreakGlassWindow(ctx context.Context, id string) error
func (*SQLiteStore) DeleteCronSchedule ¶
func (s *SQLiteStore) DeleteCronSchedule(ctx context.Context, name string) error
func (*SQLiteStore) DeleteFinOpsOverlay ¶
func (s *SQLiteStore) DeleteFinOpsOverlay(ctx context.Context) error
func (*SQLiteStore) DeleteItem ¶
func (*SQLiteStore) DeleteKillSwitch ¶
func (s *SQLiteStore) DeleteKillSwitch(ctx context.Context, id string) error
func (*SQLiteStore) DeleteMandatoryHITLRule ¶
func (s *SQLiteStore) DeleteMandatoryHITLRule(ctx context.Context, id string) error
DeleteMandatoryHITLRule removes a rule by id.
func (*SQLiteStore) DeleteOpaqueCheckpoint ¶
func (s *SQLiteStore) DeleteOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) error
func (*SQLiteStore) DeletePolicyGrant ¶
func (s *SQLiteStore) DeletePolicyGrant(ctx context.Context, id string) error
DeletePolicyGrant removes a grant by id.
func (*SQLiteStore) DeleteRegistryEntry ¶
func (s *SQLiteStore) DeleteRegistryEntry(ctx context.Context, name string) error
DeleteRegistryEntry also removes the entry's own version history -- see the Postgres backend's identical fix for the full rationale (delete-then-republish otherwise resurrects stale pre-delete version snapshots via ON CONFLICT DO NOTHING against orphaned rows).
func (*SQLiteStore) DeleteRun ¶
func (s *SQLiteStore) DeleteRun(ctx context.Context, runID string) error
func (*SQLiteStore) DeleteThread ¶
func (s *SQLiteStore) DeleteThread(ctx context.Context, threadID string) error
func (*SQLiteStore) Downgrade ¶
func (s *SQLiteStore) Downgrade(ctx context.Context) error
Downgrade rolls back the most recently applied migration.
func (*SQLiteStore) ExpireGovernancePending ¶
ExpireGovernancePending denies embedded rows past expires_at. ponytail: no index on expires_at. Upgrade path is an index on (status, expires_at) if this sweep shows up in traces.
func (*SQLiteStore) ExpireUsageHolds ¶
ExpireUsageHolds deletes open holds with created_at strictly before olderThan. Releases budget pin for abandoned runs that never reached a terminal status callback (crash, lost runner). Returns rows deleted.
func (*SQLiteStore) FailActionDelivery ¶ added in v0.7.0
func (*SQLiteStore) FindActiveBreakGlass ¶
func (s *SQLiteStore) FindActiveBreakGlass(ctx context.Context, tenantID, agentID string) (*models.BreakGlassWindow, error)
FindActiveBreakGlass returns the most specific active window: agent-scoped wins over tenant-wide (agent_id empty), then earliest expiry.
func (*SQLiteStore) FindActiveKill ¶
func (s *SQLiteStore) FindActiveKill(ctx context.Context, tenantID, agentID string) (*models.KillSwitch, error)
FindActiveKill returns the most specific active switch: agent-scoped wins over tenant-wide (agent_id empty).
func (*SQLiteStore) FindOpenPendingAction ¶
func (s *SQLiteStore) FindOpenPendingAction(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, argsDigest, targetRevision, policyRevision, toolRevision string, embedded bool) (*models.PendingAction, error)
FindOpenPendingAction returns the oldest still-pending row for this call tuple and argument digest.
func (*SQLiteStore) FinishConnectorAction ¶ added in v0.7.0
func (s *SQLiteStore) FinishConnectorAction(ctx context.Context, id string, version int64, dispatch string, obs models.ConnectorActionObservation, mutation string) (*models.ConnectorAction, error)
func (*SQLiteStore) GetAgentSchema ¶
func (s *SQLiteStore) GetAgentSchema(ctx context.Context, agentID string) (*models.AgentSchema, error)
func (*SQLiteStore) GetAgentVersion ¶
func (s *SQLiteStore) GetAgentVersion(ctx context.Context, agentID string, version int) (*models.AgentVersion, error)
func (*SQLiteStore) GetBreakGlassWindow ¶
func (s *SQLiteStore) GetBreakGlassWindow(ctx context.Context, id string) (*models.BreakGlassWindow, error)
func (*SQLiteStore) GetCachedRunResult ¶
func (s *SQLiteStore) GetCachedRunResult(ctx context.Context, cacheKey string) (*models.CachedRunResult, error)
func (*SQLiteStore) GetConnectorAction ¶ added in v0.7.0
func (s *SQLiteStore) GetConnectorAction(ctx context.Context, id string) (*models.ConnectorAction, error)
func (*SQLiteStore) GetFinOpsOverlay ¶
func (s *SQLiteStore) GetFinOpsOverlay(ctx context.Context) (*models.FinOpsOverlay, error)
func (*SQLiteStore) GetKillSwitch ¶
func (s *SQLiteStore) GetKillSwitch(ctx context.Context, id string) (*models.KillSwitch, error)
func (*SQLiteStore) GetLastCronFireTime ¶
func (*SQLiteStore) GetLatestCheckpoint ¶
func (s *SQLiteStore) GetLatestCheckpoint(ctx context.Context, threadID string) (*models.ThreadState, error)
func (*SQLiteStore) GetLatestOpaqueCheckpoint ¶
func (s *SQLiteStore) GetLatestOpaqueCheckpoint(ctx context.Context, threadID, namespace string) (*models.OpaqueCheckpoint, error)
GetLatestOpaqueCheckpoint returns the newest opaque blob for threadID. namespace "" = root graph keys (checkpoint_id with no "\x1f"); otherwise keys prefixed with namespace+"\x1f" (LangGraph folds checkpoint_ns into the opaque path key this way).
func (*SQLiteStore) GetMandatoryHITLRule ¶
func (s *SQLiteStore) GetMandatoryHITLRule(ctx context.Context, id string) (*models.MandatoryHITLRule, error)
GetMandatoryHITLRule returns one rule by id.
func (*SQLiteStore) GetOpaqueCheckpoint ¶
func (s *SQLiteStore) GetOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) (*models.OpaqueCheckpoint, error)
func (*SQLiteStore) GetPendingAction ¶
func (s *SQLiteStore) GetPendingAction(ctx context.Context, id string) (*models.PendingAction, error)
GetPendingAction returns one row by id.
func (*SQLiteStore) GetPolicyGrant ¶
func (s *SQLiteStore) GetPolicyGrant(ctx context.Context, id string) (*models.PolicyGrant, error)
GetPolicyGrant returns one grant by id.
func (*SQLiteStore) GetRegistryEntry ¶
func (s *SQLiteStore) GetRegistryEntry(ctx context.Context, name string) (*models.RegistryEntry, error)
func (*SQLiteStore) GetRegistryEntryVersion ¶
func (s *SQLiteStore) GetRegistryEntryVersion(ctx context.Context, name string, version int) (*models.RegistryEntryVersion, error)
func (*SQLiteStore) GetRunUsage ¶ added in v0.8.0
func (s *SQLiteStore) GetRunUsage(ctx context.Context, binding state.RunUsageBinding) (*models.RunUsageSnapshot, error)
func (*SQLiteStore) GetWebhookDeadLetter ¶
func (s *SQLiteStore) GetWebhookDeadLetter(ctx context.Context, id string) (*models.WebhookDeadLetter, error)
func (*SQLiteStore) Init ¶
func (s *SQLiteStore) Init(ctx context.Context) error
Init applies pending numbered schema migrations (baseline = full DDL).
func (*SQLiteStore) ListActiveRunsCreatedBefore ¶
func (*SQLiteStore) ListAgentVersions ¶
func (s *SQLiteStore) ListAgentVersions(ctx context.Context, agentID string) ([]*models.AgentVersion, error)
func (*SQLiteStore) ListBreakGlassWindows ¶
func (s *SQLiteStore) ListBreakGlassWindows(ctx context.Context) ([]*models.BreakGlassWindow, error)
func (*SQLiteStore) ListCheckpoints ¶
func (s *SQLiteStore) ListCheckpoints(ctx context.Context, threadID string, limit int, before string) ([]*models.ThreadState, error)
func (*SQLiteStore) ListConnectorActionEvents ¶ added in v0.7.0
func (s *SQLiteStore) ListConnectorActionEvents(ctx context.Context, id string, after int64, limit int) ([]*models.ConnectorActionEvent, error)
func (*SQLiteStore) ListCronSchedules ¶
func (s *SQLiteStore) ListCronSchedules(ctx context.Context) ([]*models.CronSchedule, error)
ListCronSchedules is always called from a system context in practice (the scheduler loop must see every tenant's schedules to service them all -- see cmd/cron.go), but honors a regular tenant context too for completeness/testability: TenantID is always populated on the returned rows either way, since the scheduler needs it to dispatch each fire under its own schedule's tenant, not whichever context listed it.
func (*SQLiteStore) ListKillSwitches ¶
func (s *SQLiteStore) ListKillSwitches(ctx context.Context) ([]*models.KillSwitch, error)
func (*SQLiteStore) ListMandatoryHITLRules ¶
func (s *SQLiteStore) ListMandatoryHITLRules(ctx context.Context) ([]*models.MandatoryHITLRule, error)
ListMandatoryHITLRules returns every durable mandatory-HITL rule.
func (*SQLiteStore) ListNamespaces ¶
func (s *SQLiteStore) ListNamespaces(ctx context.Context, req *models.StoreListNamespacesRequest) ([][]string, error)
func (*SQLiteStore) ListOpaqueCheckpoints ¶
func (s *SQLiteStore) ListOpaqueCheckpoints(ctx context.Context, threadID string, limit int) ([]models.OpaqueCheckpointMeta, error)
func (*SQLiteStore) ListPendingActionApprovals ¶ added in v0.7.0
func (s *SQLiteStore) ListPendingActionApprovals(ctx context.Context, id string) ([]models.PendingActionApproval, error)
func (*SQLiteStore) ListPolicyGrants ¶
func (s *SQLiteStore) ListPolicyGrants(ctx context.Context) ([]*models.PolicyGrant, error)
ListPolicyGrants returns every durable grant.
func (*SQLiteStore) ListRegistryEntryVersions ¶
func (s *SQLiteStore) ListRegistryEntryVersions(ctx context.Context, name string) ([]*models.RegistryEntryVersion, error)
func (*SQLiteStore) ListWebhookDeadLetters ¶
func (s *SQLiteStore) ListWebhookDeadLetters(ctx context.Context, limit int) ([]*models.WebhookDeadLetter, error)
func (*SQLiteStore) MarkExpiredConnectorActionsUnknown ¶ added in v0.7.0
func (*SQLiteStore) PeekApprovedConnectorAction ¶ added in v0.7.0
func (s *SQLiteStore) PeekApprovedConnectorAction(ctx context.Context, id string) (*models.PendingAction, error)
func (*SQLiteStore) Ping ¶
func (s *SQLiteStore) Ping(ctx context.Context) error
Ping verifies the database file is still reachable/openable. Mostly a formality for SQLite (an embedded file, not a network service that can go down independently of this process) but kept for interface symmetry with the network-backed stores, and it does catch a real failure mode: the file being deleted or its directory becoming unwritable out from under a running process.
func (*SQLiteStore) PrepareConnectorActionDispatch ¶ added in v0.7.0
func (*SQLiteStore) PruneCheckpoints ¶
func (*SQLiteStore) PruneConnectorActions ¶ added in v0.7.0
func (*SQLiteStore) PruneCronClaims ¶
func (*SQLiteStore) PruneExpiredStoreItems ¶
func (s *SQLiteStore) PruneExpiredStoreItems(ctx context.Context) (int64, error)
func (*SQLiteStore) PruneOpaqueCheckpoints ¶
func (*SQLiteStore) PruneTerminalHookClaims ¶
func (*SQLiteStore) PruneWebhookDeadLetters ¶
func (*SQLiteStore) PublishRegistryEntry ¶
func (s *SQLiteStore) PublishRegistryEntry(ctx context.Context, entry *models.RegistryEntry) error
func (*SQLiteStore) PutBoundOpaqueCheckpoint ¶
func (*SQLiteStore) PutOpaqueCheckpoint ¶
func (*SQLiteStore) RecordConnectorActionDecision ¶ added in v0.7.0
func (s *SQLiteStore) RecordConnectorActionDecision(ctx context.Context, id string, version int64, dec models.ConnectorActionDecision, mutation string) (*models.ConnectorAction, error)
func (*SQLiteStore) RecoverAgentSchema ¶ added in v0.10.0
func (s *SQLiteStore) RecoverAgentSchema(ctx context.Context, schema *models.AgentSchema) (bool, error)
RecoverAgentSchema replaces only the canonical bootstrap row in one update.
func (*SQLiteStore) ReleaseCronClaim ¶
func (*SQLiteStore) ReleaseRunUsageHold ¶ added in v0.10.0
func (s *SQLiteStore) ReleaseRunUsageHold(ctx context.Context, id, inc string) error
func (*SQLiteStore) ReleaseThreadIfNoOtherActive ¶
func (s *SQLiteStore) ReleaseThreadIfNoOtherActive(ctx context.Context, threadID, excludeRunID string, status models.ThreadStatus) (bool, error)
ReleaseThreadIfNoOtherActive is a single conditional UPDATE -- the inverse of TryClaimThread -- so a late StatusCallback cannot idle a thread that a newer run already claimed.
func (*SQLiteStore) ReleaseUsageHold ¶
func (s *SQLiteStore) ReleaseUsageHold(ctx context.Context, runID string) error
ReleaseUsageHold deletes the open hold for a run (no-op if missing).
func (*SQLiteStore) ReportRunUsage ¶ added in v0.8.0
func (s *SQLiteStore) ReportRunUsage(ctx context.Context, binding state.RunUsageBinding, report models.RunUsageReport) (*models.RunUsageSnapshot, bool, error)
func (*SQLiteStore) RetryActionDelivery ¶ added in v0.7.0
func (s *SQLiteStore) RetryActionDelivery(ctx context.Context, tenantID, id string) error
func (*SQLiteStore) SaveCachedRunResult ¶
func (s *SQLiteStore) SaveCachedRunResult(ctx context.Context, result *models.CachedRunResult) error
func (*SQLiteStore) SaveCheckpoint ¶
func (s *SQLiteStore) SaveCheckpoint(ctx context.Context, threadID string, ts *models.ThreadState) error
func (*SQLiteStore) SaveWebhookDeadLetter ¶
func (s *SQLiteStore) SaveWebhookDeadLetter(ctx context.Context, dl *models.WebhookDeadLetter) error
func (*SQLiteStore) SearchActionDeliveries ¶ added in v0.7.0
func (s *SQLiteStore) SearchActionDeliveries(ctx context.Context, req *state.ActionDeliverySearchRequest) ([]*state.ActionDelivery, error)
func (*SQLiteStore) SearchAgents ¶
func (s *SQLiteStore) SearchAgents(ctx context.Context, req *models.AgentSearchRequest) ([]*models.Agent, error)
func (*SQLiteStore) SearchAuditEvents ¶
func (s *SQLiteStore) SearchAuditEvents(ctx context.Context, req *models.AuditSearchRequest) ([]*models.AuditEvent, error)
SearchAuditEvents lists policy decisions newest-first.
func (*SQLiteStore) SearchBreakGlassWindows ¶
func (s *SQLiteStore) SearchBreakGlassWindows(ctx context.Context, req *models.BreakGlassSearchRequest) ([]*models.BreakGlassWindow, error)
func (*SQLiteStore) SearchConnectorActions ¶ added in v0.7.0
func (s *SQLiteStore) SearchConnectorActions(ctx context.Context, req *models.ConnectorActionSearchRequest) ([]*models.ConnectorAction, error)
func (*SQLiteStore) SearchItems ¶
func (s *SQLiteStore) SearchItems(ctx context.Context, req *models.StoreSearchRequest) ([]*models.StoreItem, error)
func (*SQLiteStore) SearchKillSwitches ¶
func (s *SQLiteStore) SearchKillSwitches(ctx context.Context, req *models.KillSwitchSearchRequest) ([]*models.KillSwitch, error)
func (*SQLiteStore) SearchMandatoryHITLRules ¶
func (s *SQLiteStore) SearchMandatoryHITLRules(ctx context.Context, req *models.MandatoryHITLSearchRequest) ([]*models.MandatoryHITLRule, error)
SearchMandatoryHITLRules lists rules with optional filters and keyset paging.
func (*SQLiteStore) SearchPendingActions ¶
func (s *SQLiteStore) SearchPendingActions(ctx context.Context, req *models.PendingActionSearchRequest) ([]*models.PendingAction, error)
SearchPendingActions lists pending actions with optional filters.
func (*SQLiteStore) SearchPolicyGrants ¶
func (s *SQLiteStore) SearchPolicyGrants(ctx context.Context, req *models.PolicyGrantSearchRequest) ([]*models.PolicyGrant, error)
SearchPolicyGrants lists grants with optional filters and keyset paging.
func (*SQLiteStore) SearchRegistryEntries ¶
func (s *SQLiteStore) SearchRegistryEntries(ctx context.Context, req *models.RegistrySearchRequest) ([]*models.RegistryEntry, error)
func (*SQLiteStore) SearchRuns ¶
func (s *SQLiteStore) SearchRuns(ctx context.Context, req *models.RunSearchRequest) ([]*models.Run, error)
func (*SQLiteStore) SearchThreads ¶
func (s *SQLiteStore) SearchThreads(ctx context.Context, req *models.ThreadSearchRequest) ([]*models.Thread, error)
func (*SQLiteStore) SearchUsageSummary ¶
func (s *SQLiteStore) SearchUsageSummary(ctx context.Context, req *models.UsageSummaryRequest) ([]models.UsageSummaryRow, error)
SearchUsageSummary groups usage_events by tenant/agent/UTC day.
func (*SQLiteStore) SetPendingActionApproved ¶
func (s *SQLiteStore) SetPendingActionApproved(ctx context.Context, id, decidedBy string) error
func (*SQLiteStore) SetPendingActionStatus ¶
func (s *SQLiteStore) SetPendingActionStatus(ctx context.Context, id, fromStatus, toStatus string) error
SetPendingActionStatus updates status if still in fromStatus.
func (*SQLiteStore) SetThreadStatus ¶
func (s *SQLiteStore) SetThreadStatus(ctx context.Context, threadID string, status models.ThreadStatus) error
func (*SQLiteStore) SumUsage ¶
func (s *SQLiteStore) SumUsage(ctx context.Context, tenantID, agentID string, since, until time.Time) (tokensIn, tokensOut int64, usd float64, err error)
SumUsage aggregates tokens and USD for a tenant (and optional agent) in [since, until).
func (*SQLiteStore) SumUsageHolds ¶
func (s *SQLiteStore) SumUsageHolds(ctx context.Context, tenantID, agentID string, since, until time.Time) (usd float64, tokens int64, count int64, err error)
SumUsageHolds totals open holds for tenant (and optional agent) in [since, until).
func (*SQLiteStore) SupportsWorkloadIdentity ¶ added in v0.8.0
func (*SQLiteStore) SupportsWorkloadIdentity() bool
func (*SQLiteStore) TryClaimCronFire ¶
func (*SQLiteStore) TryClaimRunTerminalHook ¶ added in v0.10.0
func (*SQLiteStore) TryClaimTerminalHook ¶
func (*SQLiteStore) TryClaimThread ¶
TryClaimThread does the busy-check and the busy-write as one atomic UPDATE ... WHERE status != 'busy', so two concurrent callers can never both see success -- exactly one wins the race, the other gets rowsAffected=0.
func (*SQLiteStore) TryMarkRunTimeout ¶
func (*SQLiteStore) UpdateRunStatus ¶
func (*SQLiteStore) UpdateThread ¶
func (s *SQLiteStore) UpdateThread(ctx context.Context, threadID string, patch *models.ThreadPatch) (*models.Thread, error)
func (*SQLiteStore) UpsertAgent ¶
func (*SQLiteStore) UpsertAgentSchema ¶
func (s *SQLiteStore) UpsertAgentSchema(ctx context.Context, schema *models.AgentSchema) error
func (*SQLiteStore) UpsertCronSchedule ¶
func (s *SQLiteStore) UpsertCronSchedule(ctx context.Context, sched *models.CronSchedule) error
func (*SQLiteStore) UpsertFinOpsOverlay ¶
func (s *SQLiteStore) UpsertFinOpsOverlay(ctx context.Context, o *models.FinOpsOverlay) error
func (*SQLiteStore) UpsertKillSwitch ¶
func (s *SQLiteStore) UpsertKillSwitch(ctx context.Context, k *models.KillSwitch) error
func (*SQLiteStore) UpsertMandatoryHITLRule ¶
func (s *SQLiteStore) UpsertMandatoryHITLRule(ctx context.Context, r *models.MandatoryHITLRule) error
UpsertMandatoryHITLRule inserts or replaces a rule by id.
func (*SQLiteStore) UpsertPolicyGrant ¶
func (s *SQLiteStore) UpsertPolicyGrant(ctx context.Context, g *models.PolicyGrant) error
UpsertPolicyGrant inserts or replaces a grant by id.
func (*SQLiteStore) UpsertRunUsageHold ¶ added in v0.10.0
func (*SQLiteStore) UpsertUsageHold ¶
UpsertUsageHold inserts or replaces the open hold for a run.
func (*SQLiteStore) WriteAuditEvent ¶
func (s *SQLiteStore) WriteAuditEvent(ctx context.Context, ev *models.AuditEvent) error
WriteAuditEvent persists one policy/security decision.
func (*SQLiteStore) WriteRunUsageEvent ¶ added in v0.10.0
func (s *SQLiteStore) WriteRunUsageEvent(ctx context.Context, inc string, event *models.UsageEvent) error
func (*SQLiteStore) WriteUsageEvent ¶
func (s *SQLiteStore) WriteUsageEvent(ctx context.Context, ev *models.UsageEvent) error
WriteUsageEvent upserts one usage row keyed by (run_id, source).
Source Files
¶
- action_delivery.go
- admission_create.go
- agent_schema_recovery.go
- break_glass.go
- checkpoint_time.go
- completion.go
- connector_action.go
- credential_leases.go
- finalization.go
- finalization_migration.go
- finops_overlay.go
- governance.go
- holds.go
- kill.go
- mandatory_hitl.go
- numeric_filter.go
- pending_review.go
- run_checkpoint.go
- run_usage.go
- sqlite.go
- target_revision.go
- terminal_hook.go
- usage.go
- webhook_lookup.go