Documentation
¶
Index ¶
- type AggregateCacheMetricsSinceRow
- type AuraAgentJobRuns
- type AuraCacheMetrics
- type AuraCapabilityGrants
- type AuraContextRotEvents
- type AuraConversationTurns
- type AuraConversations
- type AuraDocumentIngestJobs
- type AuraIdentities
- type AuraKnowledgeMigrations
- type AuraPausedStates
- type AuraPendingNotifications
- type AuraSchedulerTasks
- type AuraSkillAudit
- type AuraTelegramAccounts
- type AuraTelegramSetupPending
- type AuraToolInvocations
- type AutoResolvePendingForConversationParams
- type CompleteRunParams
- type CreateConversationParams
- type CreateDocumentIngestJobParams
- type CreateIdentityParams
- type CreateTaskParams
- type DBTX
- type GrantCapabilityParams
- type HasCapabilityParams
- type InsertCacheMetricParams
- type InsertContextRotEventParams
- type InsertConversationTurnParams
- type InsertPausedStateParams
- type InsertPendingNotificationParams
- type InsertRunParams
- type InsertSkillAuditParams
- type InsertTelegramAccountParams
- type InsertTelegramSetupPendingParams
- type InsertToolInvocationParams
- type ListSkillAuditParams
- type MarkNotificationFailedParams
- type MarkPausedStateResumedParams
- 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) 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) 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) 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) GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
- func (q *Queries) HasCapability(ctx context.Context, arg HasCapabilityParams) (bool, 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) 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) ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, 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) 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) 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) ListTurnsBySeq(ctx context.Context, conversationID pgtype.UUID) ([]AuraConversationTurns, 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) NextConversationTurnSeq(ctx context.Context, conversationID pgtype.UUID) (int32, 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) SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
- func (q *Queries) TouchTelegramLastSeen(ctx context.Context, telegramUserID int64) 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 SweepDueNotificationsParams
- 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 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"`
}
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 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"`
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 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 GrantCapabilityParams ¶
type HasCapabilityParams ¶
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 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 ListSkillAuditParams ¶
type ListSkillAuditParams struct {
Limit int32 `json:"limit"`
SkillName pgtype.Text `json:"skill_name"`
Since pgtype.Timestamptz `json:"since"`
}
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
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)
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)
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)
GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
HasCapability(ctx context.Context, arg HasCapabilityParams) (bool, 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
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)
ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, 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)
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)
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)
ListTurnsBySeq(ctx context.Context, conversationID pgtype.UUID) ([]AuraConversationTurns, 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
NextConversationTurnSeq(ctx context.Context, conversationID pgtype.UUID) (int32, 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
SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
TouchTelegramLastSeen(ctx context.Context, telegramUserID int64) 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) 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) 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) 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) GrantCapability ¶
func (q *Queries) GrantCapability(ctx context.Context, arg GrantCapabilityParams) error
func (*Queries) HasCapability ¶
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) 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) ListAppliedKnowledgeMigrations ¶
func (q *Queries) ListAppliedKnowledgeMigrations(ctx context.Context) ([]AuraKnowledgeMigrations, error)
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) ListPendingPausedStates ¶
func (*Queries) ListRecentDocumentIngestJobs ¶
func (*Queries) ListRecentPausedStates ¶
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) 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) NextConversationTurnSeq ¶
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) SweepDueNotifications ¶
func (q *Queries) SweepDueNotifications(ctx context.Context, arg SweepDueNotificationsParams) ([]AuraPendingNotifications, error)
func (*Queries) TouchTelegramLastSeen ¶
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 UpdateNextRunAtParams ¶
type UpdateNextRunAtParams struct {
ID pgtype.UUID `json:"id"`
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
}
Source Files
¶
- agent_job_runs.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
- 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