Documentation
¶
Index ¶
- type AggregateCacheMetricsSinceRow
- type AuraAgentJobRuns
- type AuraAssetEvents
- type AuraAssets
- type AuraCacheMetrics
- type AuraCapabilityGrants
- type AuraContextRotEvents
- type AuraConversationTurns
- type AuraConversations
- type AuraDocumentIngestJobs
- type AuraIdentities
- type AuraIdentityAudit
- type AuraIdentityAuthLinks
- type AuraKnowledgeMigrations
- type AuraPausedStates
- type AuraPendingNotifications
- type AuraSchedulerTasks
- type AuraSkillAudit
- type AuraTelegramAccounts
- type AuraTelegramSetupPending
- type AuraToolInvocations
- type AutoResolvePendingForConversationParams
- type CompleteRunParams
- type CreateAssetParams
- type CreateConversationParams
- type CreateDocumentIngestJobParams
- type CreateIdentityParams
- type CreateTaskParams
- type DBTX
- type GetAssetForIdentityParams
- type GetTurnPointersParams
- type GetTurnPointersRow
- type GrantCapabilityParams
- type HasCapabilityParams
- type InsertAssetEventParams
- type InsertCacheMetricParams
- type InsertContextRotEventParams
- type InsertConversationTurnParams
- type InsertIdentityAuditParams
- type InsertPausedStateParams
- type InsertPendingNotificationParams
- type InsertRunParams
- type InsertSkillAuditParams
- type InsertTelegramAccountParams
- type InsertTelegramSetupPendingParams
- type InsertToolInvocationParams
- type ListAssetsForLibraryParams
- type ListAssetsForThreadParams
- type ListBranchLeavesRow
- type ListIdentityAuditParams
- type ListRunsForTaskParams
- type ListSkillAuditParams
- type ListTurnsByBranchPathParams
- type ListTurnsByBranchPathRow
- type ListTurnsBySeqRow
- type MarkNotificationFailedParams
- type MarkPausedStateResumedParams
- type PromoteAssetToLibraryParams
- type Querier
- type Queries
- func (q *Queries) AggregateCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) (AggregateCacheMetricsSinceRow, error)
- func (q *Queries) AutoResolvePendingForConversation(ctx context.Context, arg AutoResolvePendingForConversationParams) error
- func (q *Queries) CancelTask(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) CanonicalBranchLeafSeq(ctx context.Context, conversationID pgtype.UUID) (int32, error)
- func (q *Queries) CleanupResumedOlderThan(ctx context.Context, resumedAt pgtype.Timestamptz) error
- func (q *Queries) CompleteRun(ctx context.Context, arg CompleteRunParams) error
- func (q *Queries) ConsumeTelegramSetupPending(ctx context.Context, onboardingToken string) (AuraTelegramSetupPending, error)
- func (q *Queries) CountTelegramAccounts(ctx context.Context) (int64, error)
- func (q *Queries) CountTurns(ctx context.Context, conversationID pgtype.UUID) (int64, error)
- func (q *Queries) CreateAsset(ctx context.Context, arg CreateAssetParams) (AuraAssets, error)
- func (q *Queries) CreateConversation(ctx context.Context, arg CreateConversationParams) (AuraConversations, error)
- func (q *Queries) CreateDocumentIngestJob(ctx context.Context, arg CreateDocumentIngestJobParams) (AuraDocumentIngestJobs, error)
- func (q *Queries) CreateIdentity(ctx context.Context, arg CreateIdentityParams) (AuraIdentities, error)
- func (q *Queries) CreateTask(ctx context.Context, arg CreateTaskParams) (AuraSchedulerTasks, error)
- func (q *Queries) DeleteConversation(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) DeleteExpiredTelegramSetupPending(ctx context.Context) (int64, error)
- func (q *Queries) DeleteIdentity(ctx context.Context, name string) error
- func (q *Queries) DueTasks(ctx context.Context, limit int32) ([]AuraSchedulerTasks, error)
- func (q *Queries) GetAsset(ctx context.Context, id pgtype.UUID) (AuraAssets, error)
- func (q *Queries) GetAssetForIdentity(ctx context.Context, arg GetAssetForIdentityParams) (AuraAssets, error)
- func (q *Queries) GetConversation(ctx context.Context, id pgtype.UUID) (AuraConversations, error)
- func (q *Queries) GetDocumentIngestJob(ctx context.Context, id pgtype.UUID) (AuraDocumentIngestJobs, error)
- func (q *Queries) GetDocumentIngestJobByDocumentID(ctx context.Context, documentID string) (AuraDocumentIngestJobs, error)
- func (q *Queries) GetIdentityByID(ctx context.Context, id pgtype.UUID) (AuraIdentities, error)
- func (q *Queries) GetIdentityByName(ctx context.Context, name string) (AuraIdentities, error)
- func (q *Queries) GetPausedStateByToken(ctx context.Context, token pgtype.UUID) (AuraPausedStates, error)
- func (q *Queries) GetRun(ctx context.Context, id pgtype.UUID) (AuraAgentJobRuns, error)
- func (q *Queries) GetTask(ctx context.Context, id pgtype.UUID) (AuraSchedulerTasks, error)
- func (q *Queries) GetTelegramAccountByIdentity(ctx context.Context, identityID pgtype.UUID) (AuraTelegramAccounts, error)
- func (q *Queries) GetTelegramAccountByTelegramID(ctx context.Context, telegramUserID int64) (AuraTelegramAccounts, error)
- func (q *Queries) GetTelegramSetupPending(ctx context.Context, onboardingToken string) (AuraTelegramSetupPending, error)
- func (q *Queries) GetTurnPointers(ctx context.Context, arg GetTurnPointersParams) (GetTurnPointersRow, error)
- func (q *Queries) GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
- func (q *Queries) HasCapability(ctx context.Context, arg HasCapabilityParams) (bool, error)
- func (q *Queries) InsertAssetEvent(ctx context.Context, arg InsertAssetEventParams) error
- func (q *Queries) InsertCacheMetric(ctx context.Context, arg InsertCacheMetricParams) error
- func (q *Queries) InsertContextRotEvent(ctx context.Context, arg InsertContextRotEventParams) error
- func (q *Queries) InsertConversationTurn(ctx context.Context, arg InsertConversationTurnParams) error
- func (q *Queries) InsertIdentityAudit(ctx context.Context, arg InsertIdentityAuditParams) (AuraIdentityAudit, error)
- func (q *Queries) InsertPausedState(ctx context.Context, arg InsertPausedStateParams) error
- func (q *Queries) InsertPendingNotification(ctx context.Context, arg InsertPendingNotificationParams) (AuraPendingNotifications, error)
- func (q *Queries) InsertRun(ctx context.Context, arg InsertRunParams) (AuraAgentJobRuns, error)
- func (q *Queries) InsertSkillAudit(ctx context.Context, arg InsertSkillAuditParams) (AuraSkillAudit, error)
- func (q *Queries) InsertTelegramAccount(ctx context.Context, arg InsertTelegramAccountParams) (AuraTelegramAccounts, error)
- func (q *Queries) InsertTelegramSetupPending(ctx context.Context, arg InsertTelegramSetupPendingParams) error
- func (q *Queries) InsertToolInvocation(ctx context.Context, arg InsertToolInvocationParams) error
- func (q *Queries) ListActiveTasks(ctx context.Context) ([]AuraSchedulerTasks, error)
- func (q *Queries) ListAllPendingPausedStates(ctx context.Context, limit int32) ([]AuraPausedStates, error)
- func (q *Queries) ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, error)
- func (q *Queries) ListAssetsForLibrary(ctx context.Context, arg ListAssetsForLibraryParams) ([]AuraAssets, error)
- func (q *Queries) ListAssetsForThread(ctx context.Context, arg ListAssetsForThreadParams) ([]AuraAssets, error)
- func (q *Queries) ListBranchLeaves(ctx context.Context, conversationID pgtype.UUID) ([]ListBranchLeavesRow, error)
- func (q *Queries) ListCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) ([]AuraCacheMetrics, error)
- func (q *Queries) ListCapabilities(ctx context.Context, identityID pgtype.UUID) ([]AuraCapabilityGrants, error)
- func (q *Queries) ListContextRotEvents(ctx context.Context, conversationID pgtype.UUID) ([]AuraContextRotEvents, error)
- func (q *Queries) ListConversations(ctx context.Context, includeArchived bool) ([]AuraConversations, error)
- func (q *Queries) ListIdentities(ctx context.Context) ([]AuraIdentities, error)
- func (q *Queries) ListIdentityAudit(ctx context.Context, arg ListIdentityAuditParams) ([]AuraIdentityAudit, error)
- func (q *Queries) ListPendingPausedStates(ctx context.Context, conversationID pgtype.UUID) ([]AuraPausedStates, error)
- func (q *Queries) ListRecentDocumentIngestJobs(ctx context.Context, limit int32) ([]AuraDocumentIngestJobs, error)
- func (q *Queries) ListRecentPausedStates(ctx context.Context, limit int32) ([]AuraPausedStates, error)
- func (q *Queries) ListRunsForTask(ctx context.Context, arg ListRunsForTaskParams) ([]AuraAgentJobRuns, error)
- func (q *Queries) ListSkillAudit(ctx context.Context, arg ListSkillAuditParams) ([]AuraSkillAudit, error)
- func (q *Queries) ListSkillAuditByName(ctx context.Context, skillName string) ([]AuraSkillAudit, error)
- func (q *Queries) ListTelegramAccounts(ctx context.Context) ([]AuraTelegramAccounts, error)
- func (q *Queries) ListToolInvocationsByConversation(ctx context.Context, conversationID pgtype.UUID) ([]AuraToolInvocations, error)
- func (q *Queries) ListTurnsByBranchPath(ctx context.Context, arg ListTurnsByBranchPathParams) ([]ListTurnsByBranchPathRow, error)
- func (q *Queries) ListTurnsBySeq(ctx context.Context, conversationID pgtype.UUID) ([]ListTurnsBySeqRow, error)
- func (q *Queries) LockConversationForTurnAppend(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)
- func (q *Queries) MarkNotificationDelivered(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
- func (q *Queries) MarkPausedStateResumed(ctx context.Context, arg MarkPausedStateResumedParams) error
- func (q *Queries) MarkUnknownRecovery(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) NextAssetEventSeq(ctx context.Context, assetID pgtype.UUID) (int32, error)
- func (q *Queries) NextConversationTurnSeq(ctx context.Context, conversationID pgtype.UUID) (int32, error)
- func (q *Queries) PromoteAssetToLibrary(ctx context.Context, arg PromoteAssetToLibraryParams) (AuraAssets, error)
- func (q *Queries) RecordKnowledgeMigration(ctx context.Context, arg RecordKnowledgeMigrationParams) error
- func (q *Queries) RenameConversation(ctx context.Context, arg RenameConversationParams) error
- func (q *Queries) RevokeCapability(ctx context.Context, arg RevokeCapabilityParams) error
- func (q *Queries) ScanStaleRuns(ctx context.Context, secs float64) ([]ScanStaleRunsRow, error)
- func (q *Queries) SearchConversationTurns(ctx context.Context, arg SearchConversationTurnsParams) ([]SearchConversationTurnsRow, error)
- func (q *Queries) SetConversationTitleIfNull(ctx context.Context, arg SetConversationTitleIfNullParams) error
- func (q *Queries) SetTurnBranchPointers(ctx context.Context, arg SetTurnBranchPointersParams) error
- func (q *Queries) SoftDeleteAsset(ctx context.Context, arg SoftDeleteAssetParams) (AuraAssets, error)
- func (q *Queries) SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
- func (q *Queries) TouchTelegramLastSeen(ctx context.Context, telegramUserID int64) error
- func (q *Queries) UpdateAssetAccepted(ctx context.Context, arg UpdateAssetAcceptedParams) (AuraAssets, error)
- func (q *Queries) UpdateAssetResult(ctx context.Context, arg UpdateAssetResultParams) (AuraAssets, error)
- func (q *Queries) UpdateAssetStatus(ctx context.Context, arg UpdateAssetStatusParams) (AuraAssets, error)
- func (q *Queries) UpdateAssetUploaded(ctx context.Context, arg UpdateAssetUploadedParams) (AuraAssets, error)
- func (q *Queries) UpdateConversationAggregates(ctx context.Context, arg UpdateConversationAggregatesParams) error
- func (q *Queries) UpdateConversationStatus(ctx context.Context, arg UpdateConversationStatusParams) error
- func (q *Queries) UpdateDocumentIngestJobProgress(ctx context.Context, arg UpdateDocumentIngestJobProgressParams) (AuraDocumentIngestJobs, error)
- func (q *Queries) UpdateDocumentIngestJobStatus(ctx context.Context, arg UpdateDocumentIngestJobStatusParams) (AuraDocumentIngestJobs, error)
- func (q *Queries) UpdateHeartbeat(ctx context.Context, id pgtype.UUID) error
- func (q *Queries) UpdateNextRunAt(ctx context.Context, arg UpdateNextRunAtParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordKnowledgeMigrationParams
- type RenameConversationParams
- type RevokeCapabilityParams
- type ScanStaleRunsRow
- type SearchConversationTurnsParams
- type SearchConversationTurnsRow
- type SetConversationTitleIfNullParams
- type SetTurnBranchPointersParams
- type SoftDeleteAssetParams
- type SweepDueNotificationsParams
- type UpdateAssetAcceptedParams
- type UpdateAssetResultParams
- type UpdateAssetStatusParams
- type UpdateAssetUploadedParams
- type UpdateConversationAggregatesParams
- type UpdateConversationStatusParams
- type UpdateDocumentIngestJobProgressParams
- type UpdateDocumentIngestJobStatusParams
- type UpdateNextRunAtParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateCacheMetricsSinceRow ¶
type AggregateCacheMetricsSinceRow struct {
Turns int64 `json:"turns"`
TotalPromptTokens interface{} `json:"total_prompt_tokens"`
TotalCachedTokens interface{} `json:"total_cached_tokens"`
TotalCostUsd interface{} `json:"total_cost_usd"`
}
type AuraAgentJobRuns ¶
type AuraAgentJobRuns struct {
ID pgtype.UUID `json:"id"`
TaskID pgtype.UUID `json:"task_id"`
Status string `json:"status"`
StepBudget pgtype.Int4 `json:"step_budget"`
StartedAt pgtype.Timestamptz `json:"started_at"`
LastHeartbeatAt pgtype.Timestamptz `json:"last_heartbeat_at"`
CompletedWithHash pgtype.Text `json:"completed_with_hash"`
Summary pgtype.Text `json:"summary"`
LastError pgtype.Text `json:"last_error"`
MissedSince pgtype.Timestamptz `json:"missed_since"`
PausedStateToken pgtype.UUID `json:"paused_state_token"`
CompletedAt pgtype.Timestamptz `json:"completed_at"`
}
Per-run audit ledger (Slice 6 / Phase 10). Audit-forever (no aura_app DELETE, PRD OQ4). completed_with_hash is the SC#2 idempotency key (UNIQUE; a duplicate completion swallows 23505).
type AuraAssetEvents ¶ added in v1.0.0
type AuraAssets ¶ added in v1.0.0
type AuraAssets struct {
ID pgtype.UUID `json:"id"`
IdentityID pgtype.UUID `json:"identity_id"`
SourceKind string `json:"source_kind"`
SourceRef string `json:"source_ref"`
ThreadID string `json:"thread_id"`
Scope string `json:"scope"`
Modality string `json:"modality"`
Status string `json:"status"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
DeclaredSizeBytes int64 `json:"declared_size_bytes"`
SizeBytes int64 `json:"size_bytes"`
ContentHash string `json:"content_hash"`
ObjectBucket string `json:"object_bucket"`
ObjectKey string `json:"object_key"`
ObjectEtag string `json:"object_etag"`
DocumentID string `json:"document_id"`
Summary string `json:"summary"`
Metadata []byte `json:"metadata"`
ErrorCode string `json:"error_code"`
ErrorMessage string `json:"error_message"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UploadedAt pgtype.Timestamptz `json:"uploaded_at"`
AcceptedAt pgtype.Timestamptz `json:"accepted_at"`
ProcessedAt pgtype.Timestamptz `json:"processed_at"`
SearchableAt pgtype.Timestamptz `json:"searchable_at"`
CompletedAt pgtype.Timestamptz `json:"completed_at"`
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type AuraCacheMetrics ¶
type AuraCacheMetrics struct {
ConversationID pgtype.UUID `json:"conversation_id"`
Seq int32 `json:"seq"`
Ts pgtype.Timestamptz `json:"ts"`
PromptTokens int32 `json:"prompt_tokens"`
CachedTokens int32 `json:"cached_tokens"`
CostUsd pgtype.Numeric `json:"cost_usd"`
}
Per-turn KV-cache metrics (Slice 4 / Phase 6, D-02). Append-only: one row per completed assistant turn from llm.Usage (token counts + cost only, no message content).
type AuraCapabilityGrants ¶
type AuraCapabilityGrants struct {
IdentityID pgtype.UUID `json:"identity_id"`
Capability string `json:"capability"`
GrantedAt pgtype.Timestamptz `json:"granted_at"`
}
Per-identity capability grants. Wildcard `*` is system-managed (seeded, never grant/revoke via CLI).
type AuraContextRotEvents ¶
type AuraContextRotEvents struct {
Ts pgtype.Timestamptz `json:"ts"`
ConversationID pgtype.UUID `json:"conversation_id"`
Action string `json:"action"`
PairsDropped int32 `json:"pairs_dropped"`
TokensBefore int32 `json:"tokens_before"`
TokensAfter int32 `json:"tokens_after"`
}
L2.5 hard-rolling-buffer audit (amendment #22). One row per pair-drop; never written when L1 alone suffices (SC-1).
type AuraConversationTurns ¶
type AuraConversationTurns struct {
ConversationID pgtype.UUID `json:"conversation_id"`
Seq int32 `json:"seq"`
Role string `json:"role"`
Content pgtype.Text `json:"content"`
ContentSidecarPath pgtype.Text `json:"content_sidecar_path"`
ToolCallID pgtype.Text `json:"tool_call_id"`
ToolCalls []byte `json:"tool_calls"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
InputTokens int32 `json:"input_tokens"`
OutputTokens int32 `json:"output_tokens"`
CachedTokens int32 `json:"cached_tokens"`
// D-09 branch tree (CHAT-05): the branch a turn belongs to. All-zero UUID = the per-conversation canonical branch (pre-0017 backfill).
BranchID pgtype.UUID `json:"branch_id"`
// D-09 branch tree (CHAT-05): seq of the parent turn within the conversation; NULL at the root (seq=1). Canonical backfill: seq-1.
ParentSeq pgtype.Int4 `json:"parent_seq"`
}
Per-turn rows (Slice 1.8). content NULL + content_sidecar_path set when content > AURA_CONVERSATION_TURN_CAP_BYTES.
type AuraConversations ¶
type AuraConversations struct {
ID pgtype.UUID `json:"id"`
Title pgtype.Text `json:"title"`
IdentityID pgtype.UUID `json:"identity_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
LastActiveAt pgtype.Timestamptz `json:"last_active_at"`
Status string `json:"status"`
Model string `json:"model"`
TotalInputTokens int64 `json:"total_input_tokens"`
TotalOutputTokens int64 `json:"total_output_tokens"`
TotalCachedTokens int64 `json:"total_cached_tokens"`
TotalCostUsd pgtype.Numeric `json:"total_cost_usd"`
Metadata []byte `json:"metadata"`
}
Multi-thread persisted conversations (Slice 1.8). Aggregates token + USD totals per thread.
type AuraDocumentIngestJobs ¶
type AuraDocumentIngestJobs struct {
ID pgtype.UUID `json:"id"`
SourceID string `json:"source_id"`
SourceKind string `json:"source_kind"`
DocumentID string `json:"document_id"`
ContentHash string `json:"content_hash"`
OriginalPath string `json:"original_path"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
SizeBytes int64 `json:"size_bytes"`
Status string `json:"status"`
SparseChunks int32 `json:"sparse_chunks"`
EmbeddedChunks int32 `json:"embedded_chunks"`
Error pgtype.Text `json:"error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
SearchableAt pgtype.Timestamptz `json:"searchable_at"`
CompletedAt pgtype.Timestamptz `json:"completed_at"`
}
Durable document ingestion job state. Neo4j stores document/chunk graph data; Postgres tracks lifecycle and progress.
type AuraIdentities ¶
type AuraIdentities struct {
ID pgtype.UUID `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
Identity scaffolding (Slice 1.7). Single-user: one seeded `local`/system row with the fixed UUID ...001.
type AuraIdentityAudit ¶ added in v1.0.1
type AuraIdentityAudit struct {
ID pgtype.UUID `json:"id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
ActorIdentityID string `json:"actor_identity_id"`
NewIdentityID pgtype.UUID `json:"new_identity_id"`
NewIdentityName string `json:"new_identity_name"`
GrantedCapabilities []string `json:"granted_capabilities"`
AuthulaUserID string `json:"authula_user_id"`
}
Append-only identity-provisioning audit ledger (Phase 28, ONBD-01a). aura_app has SELECT+INSERT only; UPDATE/DELETE raise via a row trigger and TRUNCATE via a statement trigger (Pitfall 1/6). One immutable row per successful onboarding provision, written inside the provisioning db.WithTx.
type AuraIdentityAuthLinks ¶ added in v1.0.0
type AuraIdentityAuthLinks struct {
IdentityID pgtype.UUID `json:"identity_id"`
AuthulaUserID string `json:"authula_user_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
Maps an Authula user-id to a seeded aura.identities row (spec §5). Single-operator: the operator user pins to `local` (…0001). The A2 session-validate seam maps authula user-id -> this identity_id -> principalKey{}.
type AuraKnowledgeMigrations ¶
type AuraKnowledgeMigrations struct {
Version int32 `json:"version"`
Name string `json:"name"`
Checksum string `json:"checksum"`
AppliedAt pgtype.Timestamptz `json:"applied_at"`
}
Audit of applied Cypher migrations. Written by aura neo4j migrate; read by aura neo4j status.
type AuraPausedStates ¶
type AuraPausedStates struct {
Token pgtype.UUID `json:"token"`
ConversationID pgtype.UUID `json:"conversation_id"`
Kind string `json:"kind"`
Question string `json:"question"`
Options []byte `json:"options"`
Priority int32 `json:"priority"`
ResumeContext []byte `json:"resume_context"`
ToolCallID string `json:"tool_call_id"`
ProxiedFromChildID pgtype.Text `json:"proxied_from_child_id"`
ProxiedToolCallID pgtype.Text `json:"proxied_tool_call_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
ResumedAt pgtype.Timestamptz `json:"resumed_at"`
ResumedAnswer []byte `json:"resumed_answer"`
}
ask_user HITL pauses (Slice 1.5). Pending = resumed_at IS NULL. FIFO order: priority DESC, created_at ASC, token ASC.
type AuraPendingNotifications ¶
type AuraPendingNotifications struct {
ID pgtype.UUID `json:"id"`
RunID pgtype.UUID `json:"run_id"`
NotifyRoute pgtype.Text `json:"notify_route"`
Body string `json:"body"`
NotifyAfter pgtype.Timestamptz `json:"notify_after"`
Attempts int32 `json:"attempts"`
LastError pgtype.Text `json:"last_error"`
Status string `json:"status"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
// Stable owning identity snapshot (Phase 20, Fork 1): the channel-independent delivery key for the deferred/failed sweep route-back. Plain text, no FK — survives a deleted origin conversation. NULL for legacy/CLI rows → falls back to notify_route.
IdentityID pgtype.Text `json:"identity_id"`
}
Durable scheduler notification queue (Phase 19 H6/H7): quiet-hours deferred notifications and failed self-send retry state.
type AuraSchedulerTasks ¶
type AuraSchedulerTasks struct {
ID pgtype.UUID `json:"id"`
Kind string `json:"kind"`
ScheduleKind string `json:"schedule_kind"`
CronExpr pgtype.Text `json:"cron_expr"`
EveryMinutes pgtype.Int4 `json:"every_minutes"`
RunAt pgtype.Timestamptz `json:"run_at"`
Tz string `json:"tz"`
Payload []byte `json:"payload"`
StepBudget pgtype.Int4 `json:"step_budget"`
Status string `json:"status"`
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
NotifyRoute pgtype.Text `json:"notify_route"`
IdentityID string `json:"identity_id"`
OriginConversationID pgtype.UUID `json:"origin_conversation_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
Scheduler task definitions (Slice 6 / Phase 10, amendment #46). Grammar triad at|every|cron with per-task IANA tz; next_run_at is UTC, recomputed in-zone (D-06/D-07).
type AuraSkillAudit ¶
type AuraSkillAudit struct {
ID pgtype.UUID `json:"id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
ActorID string `json:"actor_id"`
IdentityID string `json:"identity_id"`
SkillName string `json:"skill_name"`
Action string `json:"action"`
ContentHash string `json:"content_hash"`
ApprovalSource pgtype.Text `json:"approval_source"`
// Historical ask_user pause token. Intentionally not a live FK: paused_states are ephemeral and may be cascade-deleted with their conversation while audit rows remain append-only.
PausedStateToken pgtype.UUID `json:"paused_state_token"`
GateRecommended bool `json:"gate_recommended"`
GateTaken bool `json:"gate_taken"`
BlocklistOverride bool `json:"blocklist_override"`
}
Append-only skill-mutation audit ledger (Slice 7c / Phase 11, D-29). aura_app has SELECT+INSERT only; UPDATE/DELETE raise via a row trigger and TRUNCATE via a statement trigger (Pitfall 1/6). The D-29 coherence CHECK constrains the approval tuple to five allowed events; content_hash is the D-23 recovery path on every row.
type AuraTelegramAccounts ¶
type AuraTelegramAccounts struct {
TelegramUserID int64 `json:"telegram_user_id"`
IdentityID pgtype.UUID `json:"identity_id"`
Username pgtype.Text `json:"username"`
FirstName pgtype.Text `json:"first_name"`
AddedAt pgtype.Timestamptz `json:"added_at"`
LastSeenAt pgtype.Timestamptz `json:"last_seen_at"`
}
Known Telegram accounts (Slice 9a / Phase 13, amendment #58). PK telegram_user_id; identity_id FKs aura.identities (single-user `local` this phase, D-07).
type AuraTelegramSetupPending ¶
type AuraTelegramSetupPending struct {
OnboardingToken string `json:"onboarding_token"`
IdentityID pgtype.UUID `json:"identity_id"`
GeneratedBy pgtype.Text `json:"generated_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
ConsumedAt pgtype.Timestamptz `json:"consumed_at"`
}
Single-use onboarding tokens (Slice 9a / Phase 13, amendment #58). consumed_at marks the token spent (T-13-01-TokenReplay); expires_at is a 1h TTL; the partial active index keys the cleanup scan.
type AuraToolInvocations ¶
type AuraToolInvocations struct {
ID pgtype.UUID `json:"id"`
ConversationID pgtype.UUID `json:"conversation_id"`
RequestID pgtype.UUID `json:"request_id"`
ToolCallID string `json:"tool_call_id"`
ToolName string `json:"tool_name"`
EventKind string `json:"event_kind"`
Seq int32 `json:"seq"`
Ts pgtype.Timestamptz `json:"ts"`
StartedAt pgtype.Timestamptz `json:"started_at"`
EndedAt pgtype.Timestamptz `json:"ended_at"`
DurationMs pgtype.Int8 `json:"duration_ms"`
ArgsRaw pgtype.Text `json:"args_raw"`
ArgsBytes pgtype.Int4 `json:"args_bytes"`
Status pgtype.Text `json:"status"`
Error pgtype.Text `json:"error"`
ResultPreview pgtype.Text `json:"result_preview"`
PreviewBytes pgtype.Int4 `json:"preview_bytes"`
ResultBytes pgtype.Int4 `json:"result_bytes"`
ResultTruncated pgtype.Bool `json:"result_truncated"`
ResultSidecarPath pgtype.Text `json:"result_sidecar_path"`
ExitCode pgtype.Int4 `json:"exit_code"`
Meta []byte `json:"meta"`
}
Append-only tool invocation ledger: start/end facts for dispatched tools with args, timestamps, status, bytes, sidecar path, exit code, and typed metadata.
type CompleteRunParams ¶
type CreateAssetParams ¶ added in v1.0.0
type CreateAssetParams struct {
IdentityID pgtype.UUID `json:"identity_id"`
SourceKind string `json:"source_kind"`
SourceRef string `json:"source_ref"`
ThreadID string `json:"thread_id"`
Scope string `json:"scope"`
Modality string `json:"modality"`
Status string `json:"status"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
DeclaredSizeBytes int64 `json:"declared_size_bytes"`
ObjectBucket string `json:"object_bucket"`
ObjectKey string `json:"object_key"`
Metadata []byte `json:"metadata"`
}
type CreateDocumentIngestJobParams ¶
type CreateDocumentIngestJobParams struct {
SourceID string `json:"source_id"`
SourceKind string `json:"source_kind"`
DocumentID string `json:"document_id"`
ContentHash string `json:"content_hash"`
OriginalPath string `json:"original_path"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
SizeBytes int64 `json:"size_bytes"`
Status string `json:"status"`
}
type CreateIdentityParams ¶
type CreateTaskParams ¶
type CreateTaskParams struct {
ID pgtype.UUID `json:"id"`
Kind string `json:"kind"`
ScheduleKind string `json:"schedule_kind"`
CronExpr pgtype.Text `json:"cron_expr"`
EveryMinutes pgtype.Int4 `json:"every_minutes"`
RunAt pgtype.Timestamptz `json:"run_at"`
Tz string `json:"tz"`
Payload []byte `json:"payload"`
StepBudget pgtype.Int4 `json:"step_budget"`
Status string `json:"status"`
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
NotifyRoute pgtype.Text `json:"notify_route"`
IdentityID string `json:"identity_id"`
OriginConversationID pgtype.UUID `json:"origin_conversation_id"`
}
type GetAssetForIdentityParams ¶ added in v1.0.0
type GetTurnPointersParams ¶ added in v1.0.0
type GetTurnPointersRow ¶ added in v1.0.0
type GrantCapabilityParams ¶
type HasCapabilityParams ¶
type InsertAssetEventParams ¶ added in v1.0.0
type InsertCacheMetricParams ¶
type InsertConversationTurnParams ¶
type InsertConversationTurnParams struct {
ConversationID pgtype.UUID `json:"conversation_id"`
Seq int32 `json:"seq"`
Role string `json:"role"`
Content pgtype.Text `json:"content"`
ContentSidecarPath pgtype.Text `json:"content_sidecar_path"`
ToolCallID pgtype.Text `json:"tool_call_id"`
ToolCalls []byte `json:"tool_calls"`
InputTokens int32 `json:"input_tokens"`
OutputTokens int32 `json:"output_tokens"`
CachedTokens int32 `json:"cached_tokens"`
}
type InsertIdentityAuditParams ¶ added in v1.0.1
type InsertPausedStateParams ¶
type InsertPausedStateParams struct {
Token pgtype.UUID `json:"token"`
ConversationID pgtype.UUID `json:"conversation_id"`
Kind string `json:"kind"`
Question string `json:"question"`
Options []byte `json:"options"`
Priority int32 `json:"priority"`
ResumeContext []byte `json:"resume_context"`
ToolCallID string `json:"tool_call_id"`
ProxiedFromChildID pgtype.Text `json:"proxied_from_child_id"`
ProxiedToolCallID pgtype.Text `json:"proxied_tool_call_id"`
}
type InsertPendingNotificationParams ¶
type InsertPendingNotificationParams struct {
ID pgtype.UUID `json:"id"`
RunID pgtype.UUID `json:"run_id"`
NotifyRoute pgtype.Text `json:"notify_route"`
Body string `json:"body"`
NotifyAfter pgtype.Timestamptz `json:"notify_after"`
Attempts int32 `json:"attempts"`
LastError pgtype.Text `json:"last_error"`
Status string `json:"status"`
IdentityID pgtype.Text `json:"identity_id"`
}
type InsertRunParams ¶
type InsertSkillAuditParams ¶
type InsertSkillAuditParams struct {
ActorID string `json:"actor_id"`
IdentityID string `json:"identity_id"`
SkillName string `json:"skill_name"`
Action string `json:"action"`
ContentHash string `json:"content_hash"`
ApprovalSource pgtype.Text `json:"approval_source"`
PausedStateToken pgtype.UUID `json:"paused_state_token"`
GateRecommended bool `json:"gate_recommended"`
GateTaken bool `json:"gate_taken"`
BlocklistOverride bool `json:"blocklist_override"`
}
type InsertToolInvocationParams ¶
type InsertToolInvocationParams struct {
ConversationID pgtype.UUID `json:"conversation_id"`
RequestID pgtype.UUID `json:"request_id"`
ToolCallID string `json:"tool_call_id"`
ToolName string `json:"tool_name"`
EventKind string `json:"event_kind"`
Seq int32 `json:"seq"`
Ts pgtype.Timestamptz `json:"ts"`
StartedAt pgtype.Timestamptz `json:"started_at"`
EndedAt pgtype.Timestamptz `json:"ended_at"`
DurationMs pgtype.Int8 `json:"duration_ms"`
ArgsRaw pgtype.Text `json:"args_raw"`
ArgsBytes pgtype.Int4 `json:"args_bytes"`
Status pgtype.Text `json:"status"`
Error pgtype.Text `json:"error"`
ResultPreview pgtype.Text `json:"result_preview"`
PreviewBytes pgtype.Int4 `json:"preview_bytes"`
ResultBytes pgtype.Int4 `json:"result_bytes"`
ResultTruncated pgtype.Bool `json:"result_truncated"`
ResultSidecarPath pgtype.Text `json:"result_sidecar_path"`
ExitCode pgtype.Int4 `json:"exit_code"`
Meta []byte `json:"meta"`
}
type ListAssetsForLibraryParams ¶ added in v1.0.0
type ListAssetsForThreadParams ¶ added in v1.0.0
type ListBranchLeavesRow ¶ added in v1.0.0
type ListIdentityAuditParams ¶ added in v1.0.1
type ListRunsForTaskParams ¶ added in v1.0.1
type ListSkillAuditParams ¶
type ListSkillAuditParams struct {
Limit int32 `json:"limit"`
SkillName pgtype.Text `json:"skill_name"`
Since pgtype.Timestamptz `json:"since"`
}
type ListTurnsByBranchPathParams ¶ added in v1.0.0
type ListTurnsByBranchPathRow ¶ added in v1.0.0
type ListTurnsByBranchPathRow struct {
ConversationID pgtype.UUID `json:"conversation_id"`
Seq int32 `json:"seq"`
Role string `json:"role"`
Content pgtype.Text `json:"content"`
ContentSidecarPath pgtype.Text `json:"content_sidecar_path"`
ToolCallID pgtype.Text `json:"tool_call_id"`
ToolCalls []byte `json:"tool_calls"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
InputTokens int32 `json:"input_tokens"`
OutputTokens int32 `json:"output_tokens"`
CachedTokens int32 `json:"cached_tokens"`
}
type ListTurnsBySeqRow ¶ added in v1.0.0
type ListTurnsBySeqRow struct {
ConversationID pgtype.UUID `json:"conversation_id"`
Seq int32 `json:"seq"`
Role string `json:"role"`
Content pgtype.Text `json:"content"`
ContentSidecarPath pgtype.Text `json:"content_sidecar_path"`
ToolCallID pgtype.Text `json:"tool_call_id"`
ToolCalls []byte `json:"tool_calls"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
InputTokens int32 `json:"input_tokens"`
OutputTokens int32 `json:"output_tokens"`
CachedTokens int32 `json:"cached_tokens"`
}
type PromoteAssetToLibraryParams ¶ added in v1.0.0
type Querier ¶
type Querier interface {
AggregateCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) (AggregateCacheMetricsSinceRow, error)
AutoResolvePendingForConversation(ctx context.Context, arg AutoResolvePendingForConversationParams) error
CancelTask(ctx context.Context, id pgtype.UUID) error
// D-09 (CHAT-05): the leaf (deepest) seq of a conversation's canonical branch — the
// all-zero sentinel branch every pre-0017 turn is backfilled onto. For a non-branched
// conversation this is just MAX(seq), so a branch-path walk from this leaf reconstructs
// the same linear history ListTurnsBySeq returns (byte-identity, store.go:250). Returns
// 0 when the conversation has no turns.
CanonicalBranchLeafSeq(ctx context.Context, conversationID pgtype.UUID) (int32, error)
CleanupResumedOlderThan(ctx context.Context, resumedAt pgtype.Timestamptz) error
CompleteRun(ctx context.Context, arg CompleteRunParams) error
// ConsumeTelegramSetupPending atomically marks an unconsumed, unexpired token as
// consumed and returns it. The consumed_at IS NULL guard makes the consume
// single-use: a second consume of the same token matches no row (RETURNING is
// empty → sql.ErrNoRows / pgx.ErrNoRows → ErrTokenConsumed). The expires_at guard
// rejects a stale token in the same statement.
ConsumeTelegramSetupPending(ctx context.Context, onboardingToken string) (AuraTelegramSetupPending, error)
CountTelegramAccounts(ctx context.Context) (int64, error)
CountTurns(ctx context.Context, conversationID pgtype.UUID) (int64, error)
CreateAsset(ctx context.Context, arg CreateAssetParams) (AuraAssets, error)
CreateConversation(ctx context.Context, arg CreateConversationParams) (AuraConversations, error)
CreateDocumentIngestJob(ctx context.Context, arg CreateDocumentIngestJobParams) (AuraDocumentIngestJobs, error)
CreateIdentity(ctx context.Context, arg CreateIdentityParams) (AuraIdentities, error)
CreateTask(ctx context.Context, arg CreateTaskParams) (AuraSchedulerTasks, error)
DeleteConversation(ctx context.Context, id pgtype.UUID) error
DeleteExpiredTelegramSetupPending(ctx context.Context) (int64, error)
DeleteIdentity(ctx context.Context, name string) error
// Claim correctness is held by the per-task pg_try_advisory_lock (claim.go), NOT a
// row lock here: this SELECT runs on the autocommit pool, so any FOR UPDATE SKIP
// LOCKED would release the instant the SELECT returns (inert, L5). The advisory lock
// is what makes each due task a singleton across concurrent workers.
DueTasks(ctx context.Context, limit int32) ([]AuraSchedulerTasks, error)
GetAsset(ctx context.Context, id pgtype.UUID) (AuraAssets, error)
GetAssetForIdentity(ctx context.Context, arg GetAssetForIdentityParams) (AuraAssets, error)
GetConversation(ctx context.Context, id pgtype.UUID) (AuraConversations, error)
GetDocumentIngestJob(ctx context.Context, id pgtype.UUID) (AuraDocumentIngestJobs, error)
GetDocumentIngestJobByDocumentID(ctx context.Context, documentID string) (AuraDocumentIngestJobs, error)
GetIdentityByID(ctx context.Context, id pgtype.UUID) (AuraIdentities, error)
GetIdentityByName(ctx context.Context, name string) (AuraIdentities, error)
GetPausedStateByToken(ctx context.Context, token pgtype.UUID) (AuraPausedStates, error)
GetRun(ctx context.Context, id pgtype.UUID) (AuraAgentJobRuns, error)
GetTask(ctx context.Context, id pgtype.UUID) (AuraSchedulerTasks, error)
GetTelegramAccountByIdentity(ctx context.Context, identityID pgtype.UUID) (AuraTelegramAccounts, error)
GetTelegramAccountByTelegramID(ctx context.Context, telegramUserID int64) (AuraTelegramAccounts, error)
GetTelegramSetupPending(ctx context.Context, onboardingToken string) (AuraTelegramSetupPending, error)
// D-09 (CHAT-05): a turn's own branch/parent pointers, used by the fork path to read the
// diverging turn's parent_seq (the new sibling chains off the SAME parent so it replaces
// the diverging turn rather than appending after it). Returns pgx.ErrNoRows when the seq
// is absent (mapped to a clean 404 at the boundary).
GetTurnPointers(ctx context.Context, arg GetTurnPointersParams) (GetTurnPointersRow, error)
GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
HasCapability(ctx context.Context, arg HasCapabilityParams) (bool, error)
InsertAssetEvent(ctx context.Context, arg InsertAssetEventParams) error
// Idempotent on (conversation_id, seq): the metric write is a separate, non-transactional
// observation following the assistant turn (runner_persist.go). ON CONFLICT DO NOTHING
// makes a re-run for an already-recorded turn a no-op rather than a PK violation or a
// duplicate, so a retry after a transient failure can never double-count the metric (WR-03).
InsertCacheMetric(ctx context.Context, arg InsertCacheMetricParams) error
InsertContextRotEvent(ctx context.Context, arg InsertContextRotEventParams) error
InsertConversationTurn(ctx context.Context, arg InsertConversationTurnParams) error
InsertIdentityAudit(ctx context.Context, arg InsertIdentityAuditParams) (AuraIdentityAudit, error)
InsertPausedState(ctx context.Context, arg InsertPausedStateParams) error
InsertPendingNotification(ctx context.Context, arg InsertPendingNotificationParams) (AuraPendingNotifications, error)
InsertRun(ctx context.Context, arg InsertRunParams) (AuraAgentJobRuns, error)
InsertSkillAudit(ctx context.Context, arg InsertSkillAuditParams) (AuraSkillAudit, error)
InsertTelegramAccount(ctx context.Context, arg InsertTelegramAccountParams) (AuraTelegramAccounts, error)
InsertTelegramSetupPending(ctx context.Context, arg InsertTelegramSetupPendingParams) error
InsertToolInvocation(ctx context.Context, arg InsertToolInvocationParams) error
ListActiveTasks(ctx context.Context) ([]AuraSchedulerTasks, error)
// Cross-thread pending list (APRV-01 / D-04): the same SELECT as
// ListPendingPausedStates with NO conversation_id filter, so the approval center
// can aggregate every still-pending pause across ALL conversations. KEEPS the
// mandatory total-order tiebreaker (priority DESC, created_at ASC, token ASC) —
// `token ASC` is non-negotiable because tx-batched rows share created_at = now()
// (RESEARCH Pitfall 4 / askuser/store.go:158-160), so without it the order would
// be non-deterministic. LIMIT $1 caps the scan (a single operator's pending set is
// tiny; no new index is warranted — RESEARCH A4).
ListAllPendingPausedStates(ctx context.Context, limit int32) ([]AuraPausedStates, error)
ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, error)
ListAssetsForLibrary(ctx context.Context, arg ListAssetsForLibraryParams) ([]AuraAssets, error)
ListAssetsForThread(ctx context.Context, arg ListAssetsForThreadParams) ([]AuraAssets, error)
// D-09 (CHAT-05): the navigable branch set. A leaf is a turn that is NOT the parent of
// any other turn (no row's parent_seq points at it) — i.e. the tip of a branch path. The
// BranchPicker navigates among these sibling leaves; a re-run continues over the selected
// leaf's path (ListTurnsByBranchPath). Ordered by branch_id then seq so the canonical
// (all-zero) branch sorts first and the order is stable across calls.
ListBranchLeaves(ctx context.Context, conversationID pgtype.UUID) ([]ListBranchLeavesRow, error)
ListCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) ([]AuraCacheMetrics, error)
ListCapabilities(ctx context.Context, identityID pgtype.UUID) ([]AuraCapabilityGrants, error)
ListContextRotEvents(ctx context.Context, conversationID pgtype.UUID) ([]AuraContextRotEvents, error)
ListConversations(ctx context.Context, includeArchived bool) ([]AuraConversations, error)
ListIdentities(ctx context.Context) ([]AuraIdentities, error)
ListIdentityAudit(ctx context.Context, arg ListIdentityAuditParams) ([]AuraIdentityAudit, error)
ListPendingPausedStates(ctx context.Context, conversationID pgtype.UUID) ([]AuraPausedStates, error)
ListRecentDocumentIngestJobs(ctx context.Context, limit int32) ([]AuraDocumentIngestJobs, error)
ListRecentPausedStates(ctx context.Context, limit int32) ([]AuraPausedStates, error)
ListRunsForTask(ctx context.Context, arg ListRunsForTaskParams) ([]AuraAgentJobRuns, error)
ListSkillAudit(ctx context.Context, arg ListSkillAuditParams) ([]AuraSkillAudit, error)
ListSkillAuditByName(ctx context.Context, skillName string) ([]AuraSkillAudit, error)
ListTelegramAccounts(ctx context.Context) ([]AuraTelegramAccounts, error)
ListToolInvocationsByConversation(ctx context.Context, conversationID pgtype.UUID) ([]AuraToolInvocations, error)
// D-09 (CHAT-05): the deterministic leaf->root path walk. Given a selected leaf seq,
// follow parent_seq up to the root, then return the turns in root->leaf (seq ASC) order
// so the head (system seq=1 + the always-block) is byte-identical to the linear case —
// only the body turns differ per branch (Pitfall 3 rule 1). The column list MIRRORS
// ListTurnsBySeq exactly so turnFromRow rehydrates it unchanged. A leaf seq of 0 (or one
// not present) yields an empty path. Walk terminates at parent_seq IS NULL (the root).
ListTurnsByBranchPath(ctx context.Context, arg ListTurnsByBranchPathParams) ([]ListTurnsByBranchPathRow, error)
ListTurnsBySeq(ctx context.Context, conversationID pgtype.UUID) ([]ListTurnsBySeqRow, error)
LockConversationForTurnAppend(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)
MarkNotificationDelivered(ctx context.Context, id pgtype.UUID) error
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
MarkPausedStateResumed(ctx context.Context, arg MarkPausedStateResumedParams) error
MarkUnknownRecovery(ctx context.Context, id pgtype.UUID) error
NextAssetEventSeq(ctx context.Context, assetID pgtype.UUID) (int32, error)
NextConversationTurnSeq(ctx context.Context, conversationID pgtype.UUID) (int32, error)
PromoteAssetToLibrary(ctx context.Context, arg PromoteAssetToLibraryParams) (AuraAssets, error)
RecordKnowledgeMigration(ctx context.Context, arg RecordKnowledgeMigrationParams) error
RenameConversation(ctx context.Context, arg RenameConversationParams) error
RevokeCapability(ctx context.Context, arg RevokeCapabilityParams) error
ScanStaleRuns(ctx context.Context, secs float64) ([]ScanStaleRunsRow, error)
// LOCKED cross-slice contract (D-A5-03 / SPEC Req#13). Telegram /search (Phase 13)
// reuses this EXACT query; only the excerpt rendering differs per channel.
SearchConversationTurns(ctx context.Context, arg SearchConversationTurnsParams) ([]SearchConversationTurnsRow, error)
SetConversationTitleIfNull(ctx context.Context, arg SetConversationTitleIfNullParams) error
// D-09 (CHAT-05): set a turn's branch/parent pointers. The branch-write seam plan 25-07
// uses when an edit/regenerate forks a new sibling branch off an existing parent turn.
SetTurnBranchPointers(ctx context.Context, arg SetTurnBranchPointersParams) error
SoftDeleteAsset(ctx context.Context, arg SoftDeleteAssetParams) (AuraAssets, error)
SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
TouchTelegramLastSeen(ctx context.Context, telegramUserID int64) error
UpdateAssetAccepted(ctx context.Context, arg UpdateAssetAcceptedParams) (AuraAssets, error)
UpdateAssetResult(ctx context.Context, arg UpdateAssetResultParams) (AuraAssets, error)
UpdateAssetStatus(ctx context.Context, arg UpdateAssetStatusParams) (AuraAssets, error)
UpdateAssetUploaded(ctx context.Context, arg UpdateAssetUploadedParams) (AuraAssets, error)
UpdateConversationAggregates(ctx context.Context, arg UpdateConversationAggregatesParams) error
UpdateConversationStatus(ctx context.Context, arg UpdateConversationStatusParams) error
UpdateDocumentIngestJobProgress(ctx context.Context, arg UpdateDocumentIngestJobProgressParams) (AuraDocumentIngestJobs, error)
UpdateDocumentIngestJobStatus(ctx context.Context, arg UpdateDocumentIngestJobStatusParams) (AuraDocumentIngestJobs, error)
UpdateHeartbeat(ctx context.Context, id pgtype.UUID) error
UpdateNextRunAt(ctx context.Context, arg UpdateNextRunAtParams) error
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AggregateCacheMetricsSince ¶
func (q *Queries) AggregateCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) (AggregateCacheMetricsSinceRow, error)
func (*Queries) AutoResolvePendingForConversation ¶
func (q *Queries) AutoResolvePendingForConversation(ctx context.Context, arg AutoResolvePendingForConversationParams) error
func (*Queries) CancelTask ¶
func (*Queries) CanonicalBranchLeafSeq ¶ added in v1.0.0
func (q *Queries) CanonicalBranchLeafSeq(ctx context.Context, conversationID pgtype.UUID) (int32, error)
D-09 (CHAT-05): the leaf (deepest) seq of a conversation's canonical branch — the all-zero sentinel branch every pre-0017 turn is backfilled onto. For a non-branched conversation this is just MAX(seq), so a branch-path walk from this leaf reconstructs the same linear history ListTurnsBySeq returns (byte-identity, store.go:250). Returns 0 when the conversation has no turns.
func (*Queries) CleanupResumedOlderThan ¶
func (*Queries) CompleteRun ¶
func (q *Queries) CompleteRun(ctx context.Context, arg CompleteRunParams) error
func (*Queries) ConsumeTelegramSetupPending ¶
func (q *Queries) ConsumeTelegramSetupPending(ctx context.Context, onboardingToken string) (AuraTelegramSetupPending, error)
ConsumeTelegramSetupPending atomically marks an unconsumed, unexpired token as consumed and returns it. The consumed_at IS NULL guard makes the consume single-use: a second consume of the same token matches no row (RETURNING is empty → sql.ErrNoRows / pgx.ErrNoRows → ErrTokenConsumed). The expires_at guard rejects a stale token in the same statement.
func (*Queries) CountTelegramAccounts ¶
func (*Queries) CountTurns ¶
func (*Queries) CreateAsset ¶ added in v1.0.0
func (q *Queries) CreateAsset(ctx context.Context, arg CreateAssetParams) (AuraAssets, error)
func (*Queries) CreateConversation ¶
func (q *Queries) CreateConversation(ctx context.Context, arg CreateConversationParams) (AuraConversations, error)
func (*Queries) CreateDocumentIngestJob ¶
func (q *Queries) CreateDocumentIngestJob(ctx context.Context, arg CreateDocumentIngestJobParams) (AuraDocumentIngestJobs, error)
func (*Queries) CreateIdentity ¶
func (q *Queries) CreateIdentity(ctx context.Context, arg CreateIdentityParams) (AuraIdentities, error)
func (*Queries) CreateTask ¶
func (q *Queries) CreateTask(ctx context.Context, arg CreateTaskParams) (AuraSchedulerTasks, error)
func (*Queries) DeleteConversation ¶
func (*Queries) DeleteExpiredTelegramSetupPending ¶
func (*Queries) DeleteIdentity ¶
func (*Queries) DueTasks ¶
Claim correctness is held by the per-task pg_try_advisory_lock (claim.go), NOT a row lock here: this SELECT runs on the autocommit pool, so any FOR UPDATE SKIP LOCKED would release the instant the SELECT returns (inert, L5). The advisory lock is what makes each due task a singleton across concurrent workers.
func (*Queries) GetAssetForIdentity ¶ added in v1.0.0
func (q *Queries) GetAssetForIdentity(ctx context.Context, arg GetAssetForIdentityParams) (AuraAssets, error)
func (*Queries) GetConversation ¶
func (*Queries) GetDocumentIngestJob ¶
func (*Queries) GetDocumentIngestJobByDocumentID ¶
func (*Queries) GetIdentityByID ¶
func (*Queries) GetIdentityByName ¶
func (*Queries) GetPausedStateByToken ¶
func (*Queries) GetTelegramAccountByIdentity ¶
func (*Queries) GetTelegramAccountByTelegramID ¶
func (*Queries) GetTelegramSetupPending ¶
func (*Queries) GetTurnPointers ¶ added in v1.0.0
func (q *Queries) GetTurnPointers(ctx context.Context, arg GetTurnPointersParams) (GetTurnPointersRow, error)
D-09 (CHAT-05): a turn's own branch/parent pointers, used by the fork path to read the diverging turn's parent_seq (the new sibling chains off the SAME parent so it replaces the diverging turn rather than appending after it). Returns pgx.ErrNoRows when the seq is absent (mapped to a clean 404 at the boundary).
func (*Queries) GrantCapability ¶
func (q *Queries) GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
func (*Queries) HasCapability ¶
func (*Queries) InsertAssetEvent ¶ added in v1.0.0
func (q *Queries) InsertAssetEvent(ctx context.Context, arg InsertAssetEventParams) error
func (*Queries) InsertCacheMetric ¶
func (q *Queries) InsertCacheMetric(ctx context.Context, arg InsertCacheMetricParams) error
Idempotent on (conversation_id, seq): the metric write is a separate, non-transactional observation following the assistant turn (runner_persist.go). ON CONFLICT DO NOTHING makes a re-run for an already-recorded turn a no-op rather than a PK violation or a duplicate, so a retry after a transient failure can never double-count the metric (WR-03).
func (*Queries) InsertContextRotEvent ¶
func (q *Queries) InsertContextRotEvent(ctx context.Context, arg InsertContextRotEventParams) error
func (*Queries) InsertConversationTurn ¶
func (q *Queries) InsertConversationTurn(ctx context.Context, arg InsertConversationTurnParams) error
func (*Queries) InsertIdentityAudit ¶ added in v1.0.1
func (q *Queries) InsertIdentityAudit(ctx context.Context, arg InsertIdentityAuditParams) (AuraIdentityAudit, error)
func (*Queries) InsertPausedState ¶
func (q *Queries) InsertPausedState(ctx context.Context, arg InsertPausedStateParams) error
func (*Queries) InsertPendingNotification ¶
func (q *Queries) InsertPendingNotification(ctx context.Context, arg InsertPendingNotificationParams) (AuraPendingNotifications, error)
func (*Queries) InsertRun ¶
func (q *Queries) InsertRun(ctx context.Context, arg InsertRunParams) (AuraAgentJobRuns, error)
func (*Queries) InsertSkillAudit ¶
func (q *Queries) InsertSkillAudit(ctx context.Context, arg InsertSkillAuditParams) (AuraSkillAudit, error)
func (*Queries) InsertTelegramAccount ¶
func (q *Queries) InsertTelegramAccount(ctx context.Context, arg InsertTelegramAccountParams) (AuraTelegramAccounts, error)
func (*Queries) InsertTelegramSetupPending ¶
func (q *Queries) InsertTelegramSetupPending(ctx context.Context, arg InsertTelegramSetupPendingParams) error
func (*Queries) InsertToolInvocation ¶
func (q *Queries) InsertToolInvocation(ctx context.Context, arg InsertToolInvocationParams) error
func (*Queries) ListActiveTasks ¶
func (q *Queries) ListActiveTasks(ctx context.Context) ([]AuraSchedulerTasks, error)
func (*Queries) ListAllPendingPausedStates ¶ added in v1.0.0
func (q *Queries) ListAllPendingPausedStates(ctx context.Context, limit int32) ([]AuraPausedStates, error)
Cross-thread pending list (APRV-01 / D-04): the same SELECT as ListPendingPausedStates with NO conversation_id filter, so the approval center can aggregate every still-pending pause across ALL conversations. KEEPS the mandatory total-order tiebreaker (priority DESC, created_at ASC, token ASC) — `token ASC` is non-negotiable because tx-batched rows share created_at = now() (RESEARCH Pitfall 4 / askuser/store.go:158-160), so without it the order would be non-deterministic. LIMIT $1 caps the scan (a single operator's pending set is tiny; no new index is warranted — RESEARCH A4).
func (*Queries) ListAppliedKnowledgeMigrations ¶
func (q *Queries) ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, error)
func (*Queries) ListAssetsForLibrary ¶ added in v1.0.0
func (q *Queries) ListAssetsForLibrary(ctx context.Context, arg ListAssetsForLibraryParams) ([]AuraAssets, error)
func (*Queries) ListAssetsForThread ¶ added in v1.0.0
func (q *Queries) ListAssetsForThread(ctx context.Context, arg ListAssetsForThreadParams) ([]AuraAssets, error)
func (*Queries) ListBranchLeaves ¶ added in v1.0.0
func (q *Queries) ListBranchLeaves(ctx context.Context, conversationID pgtype.UUID) ([]ListBranchLeavesRow, error)
D-09 (CHAT-05): the navigable branch set. A leaf is a turn that is NOT the parent of any other turn (no row's parent_seq points at it) — i.e. the tip of a branch path. The BranchPicker navigates among these sibling leaves; a re-run continues over the selected leaf's path (ListTurnsByBranchPath). Ordered by branch_id then seq so the canonical (all-zero) branch sorts first and the order is stable across calls.
func (*Queries) ListCacheMetricsSince ¶
func (q *Queries) ListCacheMetricsSince(ctx context.Context, since pgtype.Timestamptz) ([]AuraCacheMetrics, error)
func (*Queries) ListCapabilities ¶
func (*Queries) ListContextRotEvents ¶
func (*Queries) ListConversations ¶
func (*Queries) ListIdentities ¶
func (q *Queries) ListIdentities(ctx context.Context) ([]AuraIdentities, error)
func (*Queries) ListIdentityAudit ¶ added in v1.0.1
func (q *Queries) ListIdentityAudit(ctx context.Context, arg ListIdentityAuditParams) ([]AuraIdentityAudit, error)
func (*Queries) ListPendingPausedStates ¶
func (*Queries) ListRecentDocumentIngestJobs ¶
func (*Queries) ListRecentPausedStates ¶
func (*Queries) ListRunsForTask ¶ added in v1.0.1
func (q *Queries) ListRunsForTask(ctx context.Context, arg ListRunsForTaskParams) ([]AuraAgentJobRuns, error)
func (*Queries) ListSkillAudit ¶
func (q *Queries) ListSkillAudit(ctx context.Context, arg ListSkillAuditParams) ([]AuraSkillAudit, error)
func (*Queries) ListSkillAuditByName ¶
func (*Queries) ListTelegramAccounts ¶
func (q *Queries) ListTelegramAccounts(ctx context.Context) ([]AuraTelegramAccounts, error)
func (*Queries) ListToolInvocationsByConversation ¶
func (*Queries) ListTurnsByBranchPath ¶ added in v1.0.0
func (q *Queries) ListTurnsByBranchPath(ctx context.Context, arg ListTurnsByBranchPathParams) ([]ListTurnsByBranchPathRow, error)
D-09 (CHAT-05): the deterministic leaf->root path walk. Given a selected leaf seq, follow parent_seq up to the root, then return the turns in root->leaf (seq ASC) order so the head (system seq=1 + the always-block) is byte-identical to the linear case — only the body turns differ per branch (Pitfall 3 rule 1). The column list MIRRORS ListTurnsBySeq exactly so turnFromRow rehydrates it unchanged. A leaf seq of 0 (or one not present) yields an empty path. Walk terminates at parent_seq IS NULL (the root).
func (*Queries) ListTurnsBySeq ¶
func (*Queries) LockConversationForTurnAppend ¶
func (*Queries) MarkNotificationDelivered ¶
func (*Queries) MarkNotificationFailed ¶
func (q *Queries) MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
func (*Queries) MarkPausedStateResumed ¶
func (q *Queries) MarkPausedStateResumed(ctx context.Context, arg MarkPausedStateResumedParams) error
func (*Queries) MarkUnknownRecovery ¶
func (*Queries) NextAssetEventSeq ¶ added in v1.0.0
func (*Queries) NextConversationTurnSeq ¶
func (*Queries) PromoteAssetToLibrary ¶ added in v1.0.0
func (q *Queries) PromoteAssetToLibrary(ctx context.Context, arg PromoteAssetToLibraryParams) (AuraAssets, error)
func (*Queries) RecordKnowledgeMigration ¶
func (q *Queries) RecordKnowledgeMigration(ctx context.Context, arg RecordKnowledgeMigrationParams) error
func (*Queries) RenameConversation ¶
func (q *Queries) RenameConversation(ctx context.Context, arg RenameConversationParams) error
func (*Queries) RevokeCapability ¶
func (q *Queries) RevokeCapability(ctx context.Context, arg RevokeCapabilityParams) error
func (*Queries) ScanStaleRuns ¶
func (*Queries) SearchConversationTurns ¶
func (q *Queries) SearchConversationTurns(ctx context.Context, arg SearchConversationTurnsParams) ([]SearchConversationTurnsRow, error)
LOCKED cross-slice contract (D-A5-03 / SPEC Req#13). Telegram /search (Phase 13) reuses this EXACT query; only the excerpt rendering differs per channel.
func (*Queries) SetConversationTitleIfNull ¶
func (q *Queries) SetConversationTitleIfNull(ctx context.Context, arg SetConversationTitleIfNullParams) error
func (*Queries) SetTurnBranchPointers ¶ added in v1.0.0
func (q *Queries) SetTurnBranchPointers(ctx context.Context, arg SetTurnBranchPointersParams) error
D-09 (CHAT-05): set a turn's branch/parent pointers. The branch-write seam plan 25-07 uses when an edit/regenerate forks a new sibling branch off an existing parent turn.
func (*Queries) SoftDeleteAsset ¶ added in v1.0.0
func (q *Queries) SoftDeleteAsset(ctx context.Context, arg SoftDeleteAssetParams) (AuraAssets, error)
func (*Queries) SweepDueNotifications ¶
func (q *Queries) SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
func (*Queries) TouchTelegramLastSeen ¶
func (*Queries) UpdateAssetAccepted ¶ added in v1.0.0
func (q *Queries) UpdateAssetAccepted(ctx context.Context, arg UpdateAssetAcceptedParams) (AuraAssets, error)
func (*Queries) UpdateAssetResult ¶ added in v1.0.0
func (q *Queries) UpdateAssetResult(ctx context.Context, arg UpdateAssetResultParams) (AuraAssets, error)
func (*Queries) UpdateAssetStatus ¶ added in v1.0.0
func (q *Queries) UpdateAssetStatus(ctx context.Context, arg UpdateAssetStatusParams) (AuraAssets, error)
func (*Queries) UpdateAssetUploaded ¶ added in v1.0.0
func (q *Queries) UpdateAssetUploaded(ctx context.Context, arg UpdateAssetUploadedParams) (AuraAssets, error)
func (*Queries) UpdateConversationAggregates ¶
func (q *Queries) UpdateConversationAggregates(ctx context.Context, arg UpdateConversationAggregatesParams) error
func (*Queries) UpdateConversationStatus ¶
func (q *Queries) UpdateConversationStatus(ctx context.Context, arg UpdateConversationStatusParams) error
func (*Queries) UpdateDocumentIngestJobProgress ¶
func (q *Queries) UpdateDocumentIngestJobProgress(ctx context.Context, arg UpdateDocumentIngestJobProgressParams) (AuraDocumentIngestJobs, error)
func (*Queries) UpdateDocumentIngestJobStatus ¶
func (q *Queries) UpdateDocumentIngestJobStatus(ctx context.Context, arg UpdateDocumentIngestJobStatusParams) (AuraDocumentIngestJobs, error)
func (*Queries) UpdateHeartbeat ¶
func (*Queries) UpdateNextRunAt ¶
func (q *Queries) UpdateNextRunAt(ctx context.Context, arg UpdateNextRunAtParams) error
type RevokeCapabilityParams ¶
type ScanStaleRunsRow ¶
type SetTurnBranchPointersParams ¶ added in v1.0.0
type SoftDeleteAssetParams ¶ added in v1.0.0
type UpdateAssetAcceptedParams ¶ added in v1.0.0
type UpdateAssetResultParams ¶ added in v1.0.0
type UpdateAssetStatusParams ¶ added in v1.0.0
type UpdateAssetUploadedParams ¶ added in v1.0.0
type UpdateNextRunAtParams ¶
type UpdateNextRunAtParams struct {
ID pgtype.UUID `json:"id"`
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
}
Source Files
¶
- agent_job_runs.sql.go
- assets.sql.go
- cache_metrics.sql.go
- capability_grants.sql.go
- context_rot_events.sql.go
- conversation_turns.sql.go
- conversations.sql.go
- db.go
- document_ingest_jobs.sql.go
- identity.sql.go
- identity_audit.sql.go
- knowledge_migrations.sql.go
- models.go
- paused_states.sql.go
- pending_notifications.sql.go
- querier.go
- scheduler_tasks.sql.go
- skill_audit.sql.go
- telegram_accounts.sql.go
- telegram_setup_pending.sql.go
- tool_invocations.sql.go