dbq

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivateConnectionWithCredentialsParams added in v0.4.0

type ActivateConnectionWithCredentialsParams struct {
	AccessTokenRef        string             `json:"access_token_ref"`
	TokenExpiresAt        pgtype.Timestamptz `json:"token_expires_at"`
	RefreshToken          string             `json:"refresh_token"`
	GrantedScopes         string             `json:"granted_scopes"`
	UsesPendingClient     bool               `json:"uses_pending_client"`
	ID                    pgtype.UUID        `json:"id"`
	AuthorizationRevision int64              `json:"authorization_revision"`
}

type ActivateMCPActiveRequestParams added in v0.4.0

type ActivateMCPActiveRequestParams struct {
	RunID             pgtype.UUID `json:"run_id"`
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
}

type ActivateMCPServerWithCredentialsParams added in v0.4.0

type ActivateMCPServerWithCredentialsParams struct {
	AccessTokenRef        string             `json:"access_token_ref"`
	TokenExpiresAt        pgtype.Timestamptz `json:"token_expires_at"`
	RefreshToken          string             `json:"refresh_token"`
	GrantedScopes         string             `json:"granted_scopes"`
	UsesPendingClient     bool               `json:"uses_pending_client"`
	ID                    pgtype.UUID        `json:"id"`
	AuthorizationRevision int64              `json:"authorization_revision"`
}

type AddSiblingParams added in v0.4.0

type AddSiblingParams struct {
	ParentAgentID        pgtype.UUID `json:"parent_agent_id"`
	SiblingAgentID       pgtype.UUID `json:"sibling_agent_id"`
	MaxAccess            string      `json:"max_access"`
	AuthorizingGranteeID pgtype.UUID `json:"authorizing_grantee_id"`
}

type AdvanceUserAuthEpochAndRevokeSessionsParams added in v0.4.0

type AdvanceUserAuthEpochAndRevokeSessionsParams struct {
	ID                pgtype.UUID `json:"id"`
	PreserveSessionID pgtype.UUID `json:"preserve_session_id"`
}

type Agent

type Agent struct {
	ID                   pgtype.UUID        `json:"id"`
	OwnerPrincipalID     pgtype.UUID        `json:"owner_principal_id"`
	Slug                 string             `json:"slug"`
	Name                 string             `json:"name"`
	Description          string             `json:"description"`
	Status               string             `json:"status"`
	UpgradeStatus        string             `json:"upgrade_status"`
	AutoFix              bool               `json:"auto_fix"`
	BuildProviderID      pgtype.UUID        `json:"build_provider_id"`
	BuildModel           string             `json:"build_model"`
	ExecProviderID       pgtype.UUID        `json:"exec_provider_id"`
	ExecModel            string             `json:"exec_model"`
	SttProviderID        pgtype.UUID        `json:"stt_provider_id"`
	SttModel             string             `json:"stt_model"`
	VisionProviderID     pgtype.UUID        `json:"vision_provider_id"`
	VisionModel          string             `json:"vision_model"`
	TtsProviderID        pgtype.UUID        `json:"tts_provider_id"`
	TtsModel             string             `json:"tts_model"`
	ImageGenProviderID   pgtype.UUID        `json:"image_gen_provider_id"`
	ImageGenModel        string             `json:"image_gen_model"`
	EmbeddingProviderID  pgtype.UUID        `json:"embedding_provider_id"`
	EmbeddingModel       string             `json:"embedding_model"`
	SearchProviderID     pgtype.UUID        `json:"search_provider_id"`
	SearchModel          string             `json:"search_model"`
	SourceRef            string             `json:"source_ref"`
	ImageRef             string             `json:"image_ref"`
	DbSchema             string             `json:"db_schema"`
	DbPassword           string             `json:"db_password"`
	SdkVersion           string             `json:"sdk_version"`
	Config               []byte             `json:"config"`
	Instructions         []byte             `json:"instructions"`
	ErrorMessage         string             `json:"error_message"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	McpEnabled           bool               `json:"mcp_enabled"`
	AllowPublicMcp       bool               `json:"allow_public_mcp"`
	AllowPublicRoutes    bool               `json:"allow_public_routes"`
	ToolsHash            []byte             `json:"tools_hash"`
	Emoji                string             `json:"emoji"`
	AllowOauthMcpPrompt  bool               `json:"allow_oauth_mcp_prompt"`
	AllowPublicMcpPrompt bool               `json:"allow_public_mcp_prompt"`
	GitRemoteUrl         string             `json:"git_remote_url"`
	GitMode              string             `json:"git_mode"`
	GitCredentialID      pgtype.UUID        `json:"git_credential_id"`
	GitDefaultBranch     string             `json:"git_default_branch"`
	GitWebhookSecret     string             `json:"git_webhook_secret"`
	GitLastSyncedRef     string             `json:"git_last_synced_ref"`
	AgentTokenVersion    int64              `json:"agent_token_version"`
}

type AgentBuild

type AgentBuild struct {
	ID                        pgtype.UUID        `json:"id"`
	AgentID                   pgtype.UUID        `json:"agent_id"`
	Type                      string             `json:"type"`
	Status                    string             `json:"status"`
	Instructions              string             `json:"instructions"`
	SourceRef                 string             `json:"source_ref"`
	ImageRef                  string             `json:"image_ref"`
	SolLog                    string             `json:"sol_log"`
	DockerLog                 string             `json:"docker_log"`
	LogSeq                    int64              `json:"log_seq"`
	ErrorMessage              string             `json:"error_message"`
	StartedAt                 pgtype.Timestamptz `json:"started_at"`
	FinishedAt                pgtype.Timestamptz `json:"finished_at"`
	LlmCalls                  int32              `json:"llm_calls"`
	LlmTokensIn               int32              `json:"llm_tokens_in"`
	LlmTokensOut              int32              `json:"llm_tokens_out"`
	LlmTokensCached           int32              `json:"llm_tokens_cached"`
	LlmCostEstimate           float64            `json:"llm_cost_estimate"`
	RollbackTargetID          pgtype.UUID        `json:"rollback_target_id"`
	SdkVersion                string             `json:"sdk_version"`
	Todos                     []byte             `json:"todos"`
	ExitStatus                string             `json:"exit_status"`
	ExitMessage               string             `json:"exit_message"`
	FailureKind               string             `json:"failure_kind"`
	BuildModel                string             `json:"build_model"`
	IntegrationTokenHash      []byte             `json:"integration_token_hash"`
	IntegrationTokenExpiresAt pgtype.Timestamptz `json:"integration_token_expires_at"`
}

type AgentBuildIntegrationActiveParams added in v0.4.0

type AgentBuildIntegrationActiveParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type AgentConversation

type AgentConversation struct {
	ID                         pgtype.UUID        `json:"id"`
	AgentID                    pgtype.UUID        `json:"agent_id"`
	BridgeID                   pgtype.UUID        `json:"bridge_id"`
	UserID                     pgtype.UUID        `json:"user_id"`
	Source                     string             `json:"source"`
	ExternalID                 pgtype.Text        `json:"external_id"`
	Title                      string             `json:"title"`
	Metadata                   []byte             `json:"metadata"`
	Settings                   []byte             `json:"settings"`
	ContextCheckpointMessageID pgtype.UUID        `json:"context_checkpoint_message_id"`
	CreatedAt                  pgtype.Timestamptz `json:"created_at"`
	UpdatedAt                  pgtype.Timestamptz `json:"updated_at"`
}

type AgentDirectory added in v0.2.0

type AgentDirectory struct {
	ID             pgtype.UUID        `json:"id"`
	AgentID        pgtype.UUID        `json:"agent_id"`
	Path           string             `json:"path"`
	ReadAccess     string             `json:"read_access"`
	WriteAccess    string             `json:"write_access"`
	ListAccess     string             `json:"list_access"`
	Description    string             `json:"description"`
	LlmHint        string             `json:"llm_hint"`
	RetentionHours int32              `json:"retention_hours"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
	UpdatedAt      pgtype.Timestamptz `json:"updated_at"`
	Scope          string             `json:"scope"`
}

type AgentEnvVar added in v0.2.12

type AgentEnvVar struct {
	ID           pgtype.UUID        `json:"id"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	Slug         string             `json:"slug"`
	Description  string             `json:"description"`
	IsSecret     bool               `json:"is_secret"`
	ValueRef     string             `json:"value_ref"`
	DefaultValue string             `json:"default_value"`
	Pattern      string             `json:"pattern"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
}

type AgentExecEndpoint added in v0.4.0

type AgentExecEndpoint struct {
	ID               pgtype.UUID        `json:"id"`
	Slug             string             `json:"slug"`
	DisplayName      string             `json:"display_name"`
	Description      string             `json:"description"`
	LlmHint          string             `json:"llm_hint"`
	Access           string             `json:"access"`
	Transport        pgtype.Text        `json:"transport"`
	Host             pgtype.Text        `json:"host"`
	Port             pgtype.Int4        `json:"port"`
	SshUser          pgtype.Text        `json:"ssh_user"`
	PrivateKeyRef    pgtype.Text        `json:"private_key_ref"`
	PublicKeyOpenssh pgtype.Text        `json:"public_key_openssh"`
	PublicKeyComment pgtype.Text        `json:"public_key_comment"`
	HostKeyOpenssh   pgtype.Text        `json:"host_key_openssh"`
	HostKeyPinnedAt  pgtype.Timestamptz `json:"host_key_pinned_at"`
	LastUsedAt       pgtype.Timestamptz `json:"last_used_at"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	UpdatedAt        pgtype.Timestamptz `json:"updated_at"`
	OwnerPrincipalID pgtype.UUID        `json:"owner_principal_id"`
}

type AgentGrant added in v0.4.0

type AgentGrant struct {
	AgentID   pgtype.UUID        `json:"agent_id"`
	GranteeID pgtype.UUID        `json:"grantee_id"`
	Role      string             `json:"role"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type AgentMcpServer

type AgentMcpServer struct {
	ID                    pgtype.UUID        `json:"id"`
	Slug                  string             `json:"slug"`
	Name                  string             `json:"name"`
	DisplayName           string             `json:"display_name"`
	Access                string             `json:"access"`
	Url                   string             `json:"url"`
	AuthMode              string             `json:"auth_mode"`
	AuthUrl               string             `json:"auth_url"`
	TokenUrl              string             `json:"token_url"`
	RegistrationEndpoint  string             `json:"registration_endpoint"`
	Scopes                string             `json:"scopes"`
	AuthInjection         []byte             `json:"auth_injection"`
	ToolSchemas           []byte             `json:"tool_schemas"`
	ClientID              string             `json:"client_id"`
	ClientSecret          string             `json:"client_secret"`
	AccessTokenRef        string             `json:"access_token_ref"`
	RefreshToken          string             `json:"refresh_token"`
	TokenExpiresAt        pgtype.Timestamptz `json:"token_expires_at"`
	LastSyncedAt          pgtype.Timestamptz `json:"last_synced_at"`
	CreatedAt             pgtype.Timestamptz `json:"created_at"`
	UpdatedAt             pgtype.Timestamptz `json:"updated_at"`
	ServerInstructions    string             `json:"server_instructions"`
	OwnerPrincipalID      pgtype.UUID        `json:"owner_principal_id"`
	Lifecycle             string             `json:"lifecycle"`
	GrantedScopes         string             `json:"granted_scopes"`
	ScopesVerified        bool               `json:"scopes_verified"`
	AuthorizationRevision int64              `json:"authorization_revision"`
	ProvisionalNeedID     pgtype.UUID        `json:"provisional_need_id"`
	PendingClientID       string             `json:"pending_client_id"`
	PendingClientSecret   string             `json:"pending_client_secret"`
}

type AgentMessage

type AgentMessage struct {
	ID             pgtype.UUID        `json:"id"`
	Seq            int64              `json:"seq"`
	ConversationID pgtype.UUID        `json:"conversation_id"`
	RunID          pgtype.UUID        `json:"run_id"`
	Role           string             `json:"role"`
	Source         string             `json:"source"`
	Content        string             `json:"content"`
	Parts          []byte             `json:"parts"`
	FileKeys       []string           `json:"file_keys"`
	CostEstimate   pgtype.Numeric     `json:"cost_estimate"`
	Ephemeral      bool               `json:"ephemeral"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type AgentModelSlot

type AgentModelSlot struct {
	AgentID            pgtype.UUID `json:"agent_id"`
	Slug               string      `json:"slug"`
	Capability         string      `json:"capability"`
	Description        string      `json:"description"`
	AssignedProviderID pgtype.UUID `json:"assigned_provider_id"`
	AssignedModel      string      `json:"assigned_model"`
}

type AgentResourceNeed added in v0.4.0

type AgentResourceNeed struct {
	ID                pgtype.UUID        `json:"id"`
	AgentID           pgtype.UUID        `json:"agent_id"`
	Type              string             `json:"type"`
	Slug              string             `json:"slug"`
	Description       string             `json:"description"`
	SetupInstructions string             `json:"setup_instructions"`
	ExpectedUrl       string             `json:"expected_url"`
	ExpectedScopes    string             `json:"expected_scopes"`
	Spec              []byte             `json:"spec"`
	Required          bool               `json:"required"`
	BoundConnectionID pgtype.UUID        `json:"bound_connection_id"`
	BoundMcpID        pgtype.UUID        `json:"bound_mcp_id"`
	BoundExecID       pgtype.UUID        `json:"bound_exec_id"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
}

type AgentRoute

type AgentRoute struct {
	ID          pgtype.UUID        `json:"id"`
	AgentID     pgtype.UUID        `json:"agent_id"`
	Path        string             `json:"path"`
	Method      string             `json:"method"`
	Access      string             `json:"access"`
	Description string             `json:"description"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
}

type AgentScheduleHandler added in v0.4.0

type AgentScheduleHandler struct {
	ID          pgtype.UUID        `json:"id"`
	AgentID     pgtype.UUID        `json:"agent_id"`
	Slug        string             `json:"slug"`
	Kind        string             `json:"kind"`
	Recurrence  string             `json:"recurrence"`
	Enabled     bool               `json:"enabled"`
	TimeoutMs   int64              `json:"timeout_ms"`
	Description string             `json:"description"`
	LastFiredAt pgtype.Timestamptz `json:"last_fired_at"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
}

type AgentScheduledFire added in v0.4.0

type AgentScheduledFire struct {
	ID             pgtype.UUID        `json:"id"`
	AgentID        pgtype.UUID        `json:"agent_id"`
	Source         string             `json:"source"`
	Slug           string             `json:"slug"`
	FireAt         pgtype.Timestamptz `json:"fire_at"`
	Recurrence     string             `json:"recurrence"`
	TimeoutMs      int64              `json:"timeout_ms"`
	Status         string             `json:"status"`
	Attempt        int32              `json:"attempt"`
	MaxAttempts    int32              `json:"max_attempts"`
	LeaseOwner     pgtype.UUID        `json:"lease_owner"`
	LeaseToken     pgtype.UUID        `json:"lease_token"`
	LeaseExpiresAt pgtype.Timestamptz `json:"lease_expires_at"`
	NextAttemptAt  pgtype.Timestamptz `json:"next_attempt_at"`
	StartedAt      pgtype.Timestamptz `json:"started_at"`
	CompletedAt    pgtype.Timestamptz `json:"completed_at"`
	LastError      string             `json:"last_error"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
	UpdatedAt      pgtype.Timestamptz `json:"updated_at"`
}

type AgentSetupStatusRow added in v0.2.12

type AgentSetupStatusRow struct {
	Connections   int32 `json:"connections"`
	McpServers    int32 `json:"mcp_servers"`
	EnvVars       int32 `json:"env_vars"`
	ExecEndpoints int32 `json:"exec_endpoints"`
}

type AgentSibling added in v0.4.0

type AgentSibling struct {
	ParentAgentID        pgtype.UUID        `json:"parent_agent_id"`
	SiblingAgentID       pgtype.UUID        `json:"sibling_agent_id"`
	MaxAccess            string             `json:"max_access"`
	AuthorizingGranteeID pgtype.UUID        `json:"authorizing_grantee_id"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
}

type AgentTool

type AgentTool struct {
	ID           pgtype.UUID        `json:"id"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	Name         string             `json:"name"`
	Description  string             `json:"description"`
	LlmHint      string             `json:"llm_hint"`
	Access       string             `json:"access"`
	InputSchema  []byte             `json:"input_schema"`
	OutputSchema []byte             `json:"output_schema"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
}

type AgentTopic

type AgentTopic struct {
	ID          pgtype.UUID        `json:"id"`
	AgentID     pgtype.UUID        `json:"agent_id"`
	Slug        string             `json:"slug"`
	Description string             `json:"description"`
	LlmHint     string             `json:"llm_hint"`
	Access      string             `json:"access"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
	PerUser     bool               `json:"per_user"`
}

type AgentWebhook

type AgentWebhook struct {
	ID             pgtype.UUID        `json:"id"`
	AgentID        pgtype.UUID        `json:"agent_id"`
	Path           string             `json:"path"`
	VerifyMode     string             `json:"verify_mode"`
	VerifyHeader   string             `json:"verify_header"`
	TimeoutMs      int32              `json:"timeout_ms"`
	Description    string             `json:"description"`
	Secret         string             `json:"secret"`
	LastReceivedAt pgtype.Timestamptz `json:"last_received_at"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
	UpdatedAt      pgtype.Timestamptz `json:"updated_at"`
}

type AppendSystemMessageParams added in v0.4.0

type AppendSystemMessageParams struct {
	ConversationID pgtype.UUID    `json:"conversation_id"`
	Role           string         `json:"role"`
	Source         string         `json:"source"`
	Content        string         `json:"content"`
	Parts          []byte         `json:"parts"`
	RunID          pgtype.UUID    `json:"run_id"`
	TokensIn       int32          `json:"tokens_in"`
	TokensOut      int32          `json:"tokens_out"`
	CostEstimate   pgtype.Numeric `json:"cost_estimate"`
}

type ApproveDeviceLoginParams added in v0.4.0

type ApproveDeviceLoginParams struct {
	UserID       pgtype.UUID `json:"user_id"`
	UserCodeHash string      `json:"user_code_hash"`
}

type AttachmentUrlCache

type AttachmentUrlCache struct {
	CanonicalKey string             `json:"canonical_key"`
	Url          string             `json:"url"`
	ExpiresAt    pgtype.Timestamptz `json:"expires_at"`
}

type AuthFailure

type AuthFailure struct {
	Email       string             `json:"email"`
	Ip          string             `json:"ip"`
	AttemptedAt pgtype.Timestamptz `json:"attempted_at"`
}

type AuthLockout

type AuthLockout struct {
	Email        string             `json:"email"`
	Ip           string             `json:"ip"`
	LockedUntil  pgtype.Timestamptz `json:"locked_until"`
	Tier         int32              `json:"tier"`
	LastLockedAt pgtype.Timestamptz `json:"last_locked_at"`
}

type BindConnectionNeedParams added in v0.4.0

type BindConnectionNeedParams struct {
	ResourceID pgtype.UUID `json:"resource_id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	Slug       string      `json:"slug"`
}

type BindExecEndpointNeedParams added in v0.4.0

type BindExecEndpointNeedParams struct {
	ResourceID pgtype.UUID `json:"resource_id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	Slug       string      `json:"slug"`
}

type BindMCPServerNeedParams added in v0.4.0

type BindMCPServerNeedParams struct {
	ResourceID pgtype.UUID `json:"resource_id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	Slug       string      `json:"slug"`
}

type Bridge

type Bridge struct {
	ID                pgtype.UUID        `json:"id"`
	AgentID           pgtype.UUID        `json:"agent_id"`
	OwnerPrincipalID  pgtype.UUID        `json:"owner_principal_id"`
	Type              string             `json:"type"`
	Name              string             `json:"name"`
	BotUsername       string             `json:"bot_username"`
	Status            string             `json:"status"`
	IsSystem          bool               `json:"is_system"`
	Config            []byte             `json:"config"`
	Settings          []byte             `json:"settings"`
	BotTokenRef       string             `json:"bot_token_ref"`
	LastPolledAt      pgtype.Timestamptz `json:"last_polled_at"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	Managed           bool               `json:"managed"`
	TelegramBotUserID pgtype.Int8        `json:"telegram_bot_user_id"`
	IsManager         bool               `json:"is_manager"`
	ManagerError      string             `json:"manager_error"`
}

type CancelScheduledFireParams added in v0.4.0

type CancelScheduledFireParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type ClaimDueScheduledFiresParams added in v0.4.0

type ClaimDueScheduledFiresParams struct {
	LeaseOwner pgtype.UUID `json:"lease_owner"`
	BatchSize  int32       `json:"batch_size"`
}

type ClaimMCPTaskResumeParams added in v0.4.0

type ClaimMCPTaskResumeParams struct {
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	TriggerRef string      `json:"trigger_ref"`
}

type ClaimSystemConversationCheckpointParams added in v0.4.0

type ClaimSystemConversationCheckpointParams struct {
	ID             pgtype.UUID `json:"id"`
	SuspendedRunID pgtype.UUID `json:"suspended_run_id"`
}

type ClearAgentBuildModelParams added in v0.4.0

type ClearAgentBuildModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentEmbeddingModelParams added in v0.4.0

type ClearAgentEmbeddingModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentEnvVarValueParams added in v0.2.12

type ClearAgentEnvVarValueParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ClearAgentExecModelParams added in v0.4.0

type ClearAgentExecModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentImageGenModelParams added in v0.4.0

type ClearAgentImageGenModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentModelSlotsForModelParams added in v0.4.0

type ClearAgentModelSlotsForModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentSearchModelParams added in v0.4.0

type ClearAgentSearchModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentSttModelParams added in v0.4.0

type ClearAgentSttModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentTtsModelParams added in v0.4.0

type ClearAgentTtsModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAgentVisionModelParams added in v0.4.0

type ClearAgentVisionModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ClearAuthFailuresParams

type ClearAuthFailuresParams struct {
	Email string `json:"email"`
	Ip    string `json:"ip"`
}

type ClearAuthLockoutParams

type ClearAuthLockoutParams struct {
	Email string `json:"email"`
	Ip    string `json:"ip"`
}

type ClearPendingConnectionOAuthAppParams added in v0.4.0

type ClearPendingConnectionOAuthAppParams struct {
	ID                    pgtype.UUID `json:"id"`
	AuthorizationRevision int64       `json:"authorization_revision"`
}

type ClearPendingMCPServerOAuthAppParams added in v0.4.0

type ClearPendingMCPServerOAuthAppParams struct {
	ID                    pgtype.UUID `json:"id"`
	AuthorizationRevision int64       `json:"authorization_revision"`
}

type ClearUserPasswordAndRevokeSessionsParams added in v0.4.0

type ClearUserPasswordAndRevokeSessionsParams struct {
	ID                pgtype.UUID `json:"id"`
	PreserveSessionID pgtype.UUID `json:"preserve_session_id"`
}

type CompleteScheduledFireParams added in v0.4.0

type CompleteScheduledFireParams struct {
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	LeaseToken pgtype.UUID `json:"lease_token"`
}

type ConfigureExecEndpointSSHByIDParams added in v0.4.0

type ConfigureExecEndpointSSHByIDParams struct {
	Host    pgtype.Text `json:"host"`
	Port    pgtype.Int4 `json:"port"`
	SshUser pgtype.Text `json:"ssh_user"`
	ID      pgtype.UUID `json:"id"`
}

type ConnectAgentGitParams added in v0.4.0

type ConnectAgentGitParams struct {
	GitRemoteUrl     string      `json:"git_remote_url"`
	GitCredentialID  pgtype.UUID `json:"git_credential_id"`
	GitDefaultBranch string      `json:"git_default_branch"`
	GitWebhookSecret string      `json:"git_webhook_secret"`
	GitMode          string      `json:"git_mode"`
	ID               pgtype.UUID `json:"id"`
}

type Connection

type Connection struct {
	ID                    pgtype.UUID        `json:"id"`
	Slug                  string             `json:"slug"`
	Name                  string             `json:"name"`
	DisplayName           string             `json:"display_name"`
	Description           string             `json:"description"`
	LlmHint               string             `json:"llm_hint"`
	Access                string             `json:"access"`
	AuthMode              string             `json:"auth_mode"`
	AuthUrl               string             `json:"auth_url"`
	TokenUrl              string             `json:"token_url"`
	BaseUrl               string             `json:"base_url"`
	Scopes                string             `json:"scopes"`
	AuthInjection         []byte             `json:"auth_injection"`
	TestPath              string             `json:"test_path"`
	SetupInstructions     string             `json:"setup_instructions"`
	Config                []byte             `json:"config"`
	ClientID              string             `json:"client_id"`
	ClientSecret          string             `json:"client_secret"`
	AccessTokenRef        string             `json:"access_token_ref"`
	RefreshToken          string             `json:"refresh_token"`
	TokenExpiresAt        pgtype.Timestamptz `json:"token_expires_at"`
	CreatedAt             pgtype.Timestamptz `json:"created_at"`
	UpdatedAt             pgtype.Timestamptz `json:"updated_at"`
	AuthParams            []byte             `json:"auth_params"`
	Headers               []byte             `json:"headers"`
	OwnerPrincipalID      pgtype.UUID        `json:"owner_principal_id"`
	Lifecycle             string             `json:"lifecycle"`
	GrantedScopes         string             `json:"granted_scopes"`
	ScopesVerified        bool               `json:"scopes_verified"`
	AuthorizationRevision int64              `json:"authorization_revision"`
	ProvisionalNeedID     pgtype.UUID        `json:"provisional_need_id"`
	PendingClientID       string             `json:"pending_client_id"`
	PendingClientSecret   string             `json:"pending_client_secret"`
}

type ConsumeIdentityLinkChallengeParams added in v0.4.0

type ConsumeIdentityLinkChallengeParams struct {
	TokenHash      string      `json:"token_hash"`
	UserID         pgtype.UUID `json:"user_id"`
	Platform       string      `json:"platform"`
	BridgeID       pgtype.UUID `json:"bridge_id"`
	PlatformUserID string      `json:"platform_user_id"`
}

type ConsumeMCPActiveRequestParams added in v0.4.0

type ConsumeMCPActiveRequestParams struct {
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
}

type ConsumeOAuthConsentTransactionParams added in v0.4.0

type ConsumeOAuthConsentTransactionParams struct {
	TransactionID pgtype.UUID `json:"transaction_id"`
	BindingHash   []byte      `json:"binding_hash"`
	UserID        pgtype.UUID `json:"user_id"`
	ClientID      string      `json:"client_id"`
	AgentID       pgtype.UUID `json:"agent_id"`
}

type ConsumeRelayCodeRow added in v0.4.0

type ConsumeRelayCodeRow struct {
	CodeHash     []byte             `json:"code_hash"`
	NonceHash    []byte             `json:"nonce_hash"`
	UserID       pgtype.UUID        `json:"user_id"`
	Email        string             `json:"email"`
	TenantRole   string             `json:"tenant_role"`
	AuthEpoch    int64              `json:"auth_epoch"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	TargetOrigin string             `json:"target_origin"`
	ReturnPath   string             `json:"return_path"`
	ExpiresAt    pgtype.Timestamptz `json:"expires_at"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	SessionID    pgtype.UUID        `json:"session_id"`
}

type ConversationHasToolCallParams added in v0.4.0

type ConversationHasToolCallParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	ToolCallID     string      `json:"tool_call_id"`
}

type CountAgentsUsingModelParams added in v0.4.0

type CountAgentsUsingModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type CountMatchingModelGrantsParams added in v0.4.0

type CountMatchingModelGrantsParams struct {
	CatalogID  pgtype.UUID   `json:"provider_id"`
	Model      string        `json:"model"`
	GranteeIds []pgtype.UUID `json:"grantee_ids"`
}

type CountRecentFailuresParams

type CountRecentFailuresParams struct {
	Email         string `json:"email"`
	Ip            string `json:"ip"`
	WindowMinutes int32  `json:"window_minutes"`
}

type CreateA2AConversationParams added in v0.4.0

type CreateA2AConversationParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	UserID  pgtype.UUID `json:"user_id"`
	Title   string      `json:"title"`
}

type CreateAgentBuildParams

type CreateAgentBuildParams struct {
	AgentID          pgtype.UUID `json:"agent_id"`
	Type             string      `json:"type"`
	Instructions     string      `json:"instructions"`
	RollbackTargetID pgtype.UUID `json:"rollback_target_id"`
}

type CreateAgentParams

type CreateAgentParams struct {
	Name             string      `json:"name"`
	Slug             string      `json:"slug"`
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	Description      string      `json:"description"`
	Config           []byte      `json:"config"`
}

type CreateAuthzCodeParams added in v0.4.0

type CreateAuthzCodeParams struct {
	Code          string             `json:"code"`
	UserID        pgtype.UUID        `json:"user_id"`
	ClientID      string             `json:"client_id"`
	AgentID       pgtype.UUID        `json:"agent_id"`
	RedirectUri   string             `json:"redirect_uri"`
	CodeChallenge string             `json:"code_challenge"`
	Scope         string             `json:"scope"`
	Resource      string             `json:"resource"`
	ExpiresAt     pgtype.Timestamptz `json:"expires_at"`
}

type CreateBridgeParams

type CreateBridgeParams struct {
	ID                pgtype.UUID `json:"id"`
	Type              string      `json:"type"`
	Name              string      `json:"name"`
	BotTokenRef       string      `json:"bot_token_ref"`
	BotUsername       string      `json:"bot_username"`
	AgentID           pgtype.UUID `json:"agent_id"`
	OwnerPrincipalID  pgtype.UUID `json:"owner_principal_id"`
	IsSystem          bool        `json:"is_system"`
	IsManager         bool        `json:"is_manager"`
	Managed           bool        `json:"managed"`
	TelegramBotUserID pgtype.Int8 `json:"telegram_bot_user_id"`
}

type CreateCeremonyParams added in v0.4.0

type CreateCeremonyParams struct {
	UserID      pgtype.UUID `json:"user_id"`
	Kind        string      `json:"kind"`
	SessionData []byte      `json:"session_data"`
}

type CreateConnectionParams added in v0.4.0

type CreateConnectionParams struct {
	ID                pgtype.UUID `json:"id"`
	OwnerPrincipalID  pgtype.UUID `json:"owner_principal_id"`
	Slug              string      `json:"slug"`
	Name              string      `json:"name"`
	DisplayName       string      `json:"display_name"`
	Description       string      `json:"description"`
	LlmHint           string      `json:"llm_hint"`
	AuthMode          string      `json:"auth_mode"`
	AuthUrl           string      `json:"auth_url"`
	TokenUrl          string      `json:"token_url"`
	BaseUrl           string      `json:"base_url"`
	Scopes            string      `json:"scopes"`
	AuthInjection     []byte      `json:"auth_injection"`
	SetupInstructions string      `json:"setup_instructions"`
	TestPath          string      `json:"test_path"`
	Config            []byte      `json:"config"`
	AuthParams        []byte      `json:"auth_params"`
	Headers           []byte      `json:"headers"`
	Access            string      `json:"access"`
	Lifecycle         string      `json:"lifecycle"`
	ProvisionalNeedID pgtype.UUID `json:"provisional_need_id"`
}

type CreateCredentialParams added in v0.4.0

type CreateCredentialParams struct {
	UserID          pgtype.UUID `json:"user_id"`
	CredentialID    []byte      `json:"credential_id"`
	PublicKey       []byte      `json:"public_key"`
	AttestationType string      `json:"attestation_type"`
	Aaguid          []byte      `json:"aaguid"`
	SignCount       int64       `json:"sign_count"`
	Transports      []string    `json:"transports"`
	BackupEligible  bool        `json:"backup_eligible"`
	BackupState     bool        `json:"backup_state"`
	CloneWarning    bool        `json:"clone_warning"`
	FriendlyName    string      `json:"friendly_name"`
}

type CreateDeviceLoginSessionParams added in v0.4.0

type CreateDeviceLoginSessionParams struct {
	DeviceCodeHash      string             `json:"device_code_hash"`
	UserCodeHash        string             `json:"user_code_hash"`
	UserCodeDisplay     string             `json:"user_code_display"`
	ClientName          string             `json:"client_name"`
	DeviceName          string             `json:"device_name"`
	ExpiresAt           pgtype.Timestamptz `json:"expires_at"`
	PollIntervalSeconds int32              `json:"poll_interval_seconds"`
}

type CreateExecEndpointParams added in v0.4.0

type CreateExecEndpointParams struct {
	ID               pgtype.UUID `json:"id"`
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	Slug             string      `json:"slug"`
	DisplayName      string      `json:"display_name"`
	Description      string      `json:"description"`
	LlmHint          string      `json:"llm_hint"`
	Access           string      `json:"access"`
}

type CreateGitCredentialParams added in v0.4.0

type CreateGitCredentialParams struct {
	ID              pgtype.UUID `json:"id"`
	UserID          pgtype.UUID `json:"user_id"`
	Type            string      `json:"type"`
	Name            string      `json:"name"`
	TokenRef        string      `json:"token_ref"`
	GithubInstallID string      `json:"github_install_id"`
}

type CreateIdentityLinkChallengeParams added in v0.4.0

type CreateIdentityLinkChallengeParams struct {
	TokenHash      string             `json:"token_hash"`
	UserID         pgtype.UUID        `json:"user_id"`
	Platform       string             `json:"platform"`
	BridgeID       pgtype.UUID        `json:"bridge_id"`
	PlatformUserID string             `json:"platform_user_id"`
	ExpiresAt      pgtype.Timestamptz `json:"expires_at"`
}

type CreateMCPA2AConversationParams added in v0.4.0

type CreateMCPA2AConversationParams struct {
	AgentID  pgtype.UUID `json:"agent_id"`
	UserID   pgtype.UUID `json:"user_id"`
	Title    string      `json:"title"`
	Metadata []byte      `json:"metadata"`
}

type CreateMCPServerParams added in v0.4.0

type CreateMCPServerParams struct {
	ID                   pgtype.UUID `json:"id"`
	OwnerPrincipalID     pgtype.UUID `json:"owner_principal_id"`
	Slug                 string      `json:"slug"`
	Name                 string      `json:"name"`
	DisplayName          string      `json:"display_name"`
	Url                  string      `json:"url"`
	AuthMode             string      `json:"auth_mode"`
	AuthUrl              string      `json:"auth_url"`
	TokenUrl             string      `json:"token_url"`
	RegistrationEndpoint string      `json:"registration_endpoint"`
	Scopes               string      `json:"scopes"`
	Access               string      `json:"access"`
	AuthInjection        []byte      `json:"auth_injection"`
	Lifecycle            string      `json:"lifecycle"`
	ProvisionalNeedID    pgtype.UUID `json:"provisional_need_id"`
}

type CreateManagedBotSessionParams added in v0.4.0

type CreateManagedBotSessionParams struct {
	OwnerID              pgtype.UUID        `json:"owner_id"`
	AgentID              pgtype.UUID        `json:"agent_id"`
	IsSystem             bool               `json:"is_system"`
	Nonce                string             `json:"nonce"`
	BridgeName           string             `json:"bridge_name"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	SystemConversationID pgtype.UUID        `json:"system_conversation_id"`
}

type CreateMessageParams

type CreateMessageParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	Role           string      `json:"role"`
	Content        string      `json:"content"`
	Parts          []byte      `json:"parts"`
	CostEstimate   interface{} `json:"cost_estimate"`
	RunID          pgtype.UUID `json:"run_id"`
	Source         interface{} `json:"source"`
	Ephemeral      bool        `json:"ephemeral"`
}

type CreateModelGrantParams added in v0.4.0

type CreateModelGrantParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
	GranteeID pgtype.UUID `json:"grantee_id"`
}

type CreateOAuthClientParams added in v0.4.0

type CreateOAuthClientParams struct {
	ClientID                string   `json:"client_id"`
	ClientName              string   `json:"client_name"`
	RedirectUris            []string `json:"redirect_uris"`
	GrantTypes              []string `json:"grant_types"`
	ResponseTypes           []string `json:"response_types"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method"`
	Scope                   string   `json:"scope"`
}

type CreateOAuthConsentTransactionParams added in v0.4.0

type CreateOAuthConsentTransactionParams struct {
	TransactionID pgtype.UUID        `json:"transaction_id"`
	BindingHash   []byte             `json:"binding_hash"`
	UserID        pgtype.UUID        `json:"user_id"`
	ClientID      string             `json:"client_id"`
	AgentID       pgtype.UUID        `json:"agent_id"`
	ExpiresAt     pgtype.Timestamptz `json:"expires_at"`
}

type CreateOAuthStateParams

type CreateOAuthStateParams struct {
	State                   string             `json:"state"`
	AgentID                 pgtype.UUID        `json:"agent_id"`
	UserID                  pgtype.UUID        `json:"user_id"`
	ResourceID              pgtype.UUID        `json:"resource_id"`
	NeedID                  pgtype.UUID        `json:"need_id"`
	Slug                    string             `json:"slug"`
	CodeVerifier            string             `json:"code_verifier"`
	RedirectUri             string             `json:"redirect_uri"`
	ExpiresAt               pgtype.Timestamptz `json:"expires_at"`
	SourceType              string             `json:"source_type"`
	RequestedScopes         string             `json:"requested_scopes"`
	AuthorizationRevision   int64              `json:"authorization_revision"`
	ExpectedPriorResourceID pgtype.UUID        `json:"expected_prior_resource_id"`
	UsesPendingClient       bool               `json:"uses_pending_client"`
}

type CreatePlatformIdentityIfUnlinkedParams added in v0.4.0

type CreatePlatformIdentityIfUnlinkedParams struct {
	UserID         pgtype.UUID `json:"user_id"`
	Platform       string      `json:"platform"`
	PlatformUserID string      `json:"platform_user_id"`
}

type CreatePlatformIdentityParams

type CreatePlatformIdentityParams struct {
	UserID         pgtype.UUID `json:"user_id"`
	Platform       string      `json:"platform"`
	PlatformUserID string      `json:"platform_user_id"`
}

type CreateProviderModelParams added in v0.4.1

type CreateProviderModelParams struct {
	ConfiguredProviderID pgtype.UUID `json:"configured_provider_id"`
	ModelID              string      `json:"model_id"`
	DisplayName          string      `json:"display_name"`
	ToolCall             bool        `json:"tool_call"`
	Reasoning            bool        `json:"reasoning"`
	Vision               bool        `json:"vision"`
	ContextLimit         int32       `json:"context_limit"`
	OutputLimit          int32       `json:"output_limit"`
	StructuredOutputs    bool        `json:"structured_outputs"`
	IncludeUsage         bool        `json:"include_usage"`
}

type CreateProviderParams

type CreateProviderParams struct {
	ID          pgtype.UUID `json:"id"`
	CatalogID   string      `json:"provider_id"`
	Slug        string      `json:"slug"`
	DisplayName string      `json:"display_name"`
	ApiKey      string      `json:"api_key"`
	BaseUrl     string      `json:"base_url"`
	IsEnabled   bool        `json:"is_enabled"`
}

type CreateRefreshTokenParams added in v0.4.0

type CreateRefreshTokenParams struct {
	TokenHash       []byte             `json:"token_hash"`
	UserID          pgtype.UUID        `json:"user_id"`
	ClientID        string             `json:"client_id"`
	AgentID         pgtype.UUID        `json:"agent_id"`
	Scope           string             `json:"scope"`
	FamilyID        pgtype.UUID        `json:"family_id"`
	ParentTokenHash []byte             `json:"parent_token_hash"`
	ExpiresAt       pgtype.Timestamptz `json:"expires_at"`
}

type CreateRelayCodeParams added in v0.4.0

type CreateRelayCodeParams struct {
	CodeHash     []byte             `json:"code_hash"`
	NonceHash    []byte             `json:"nonce_hash"`
	UserID       pgtype.UUID        `json:"user_id"`
	SessionID    pgtype.UUID        `json:"session_id"`
	Email        string             `json:"email"`
	TenantRole   string             `json:"tenant_role"`
	AuthEpoch    int64              `json:"auth_epoch"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	TargetOrigin string             `json:"target_origin"`
	ReturnPath   string             `json:"return_path"`
	ExpiresAt    pgtype.Timestamptz `json:"expires_at"`
}

type CreateRunParams

type CreateRunParams struct {
	AgentID              pgtype.UUID `json:"agent_id"`
	BridgeID             pgtype.UUID `json:"bridge_id"`
	ParentRunID          pgtype.UUID `json:"parent_run_id"`
	InputPayload         []byte      `json:"input_payload"`
	SourceRef            string      `json:"source_ref"`
	TriggerType          string      `json:"trigger_type"`
	TriggerRef           string      `json:"trigger_ref"`
	CallerUserID         pgtype.UUID `json:"caller_user_id"`
	CallerConversationID pgtype.UUID `json:"caller_conversation_id"`
	CallerAccess         string      `json:"caller_access"`
}

type CreateSystemConversationParams added in v0.4.0

type CreateSystemConversationParams struct {
	UserID pgtype.UUID `json:"user_id"`
	Title  string      `json:"title"`
}

type CreateSystemRunParams added in v0.4.0

type CreateSystemRunParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	UserID         pgtype.UUID `json:"user_id"`
	TriggerType    string      `json:"trigger_type"`
}

type CreateTenantParams

type CreateTenantParams struct {
	Name     string `json:"name"`
	Slug     string `json:"slug"`
	Settings []byte `json:"settings"`
}

type CreateUserParams

type CreateUserParams struct {
	Email              string      `json:"email"`
	DisplayName        string      `json:"display_name"`
	PasswordHash       pgtype.Text `json:"password_hash"`
	TenantRole         string      `json:"tenant_role"`
	OidcSub            string      `json:"oidc_sub"`
	MustChangePassword bool        `json:"must_change_password"`
}

type CreateUserSessionParams added in v0.4.0

type CreateUserSessionParams struct {
	UserID           pgtype.UUID        `json:"user_id"`
	Kind             string             `json:"kind"`
	ClientName       string             `json:"client_name"`
	DeviceName       string             `json:"device_name"`
	RefreshTokenHash []byte             `json:"refresh_token_hash"`
	AuthenticatedAt  pgtype.Timestamptz `json:"authenticated_at"`
	ExpiresAt        pgtype.Timestamptz `json:"expires_at"`
}

type CreateWebConversationParams added in v0.4.0

type CreateWebConversationParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	UserID  pgtype.UUID `json:"user_id"`
	Title   string      `json:"title"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteAgentEnvVarParams added in v0.2.12

type DeleteAgentEnvVarParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type DeleteAgentGrantParams added in v0.4.0

type DeleteAgentGrantParams struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	GranteeID pgtype.UUID `json:"grantee_id"`
}

type DeleteCredentialParams added in v0.4.0

type DeleteCredentialParams struct {
	ID     pgtype.UUID `json:"id"`
	UserID pgtype.UUID `json:"user_id"`
}

type DeleteDirectoriesByAgentExceptParams added in v0.2.0

type DeleteDirectoriesByAgentExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Paths   []string    `json:"paths"`
}

type DeleteGitCredentialParams added in v0.4.0

type DeleteGitCredentialParams struct {
	ID     pgtype.UUID `json:"id"`
	UserID pgtype.UUID `json:"user_id"`
}

type DeleteMCPActiveRequestParams added in v0.4.0

type DeleteMCPActiveRequestParams struct {
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
	RunID             pgtype.UUID `json:"run_id"`
}

type DeleteOAuthConsentTransactionsForGrantParams added in v0.4.0

type DeleteOAuthConsentTransactionsForGrantParams struct {
	UserID   pgtype.UUID `json:"user_id"`
	ClientID string      `json:"client_id"`
	AgentID  pgtype.UUID `json:"agent_id"`
}

type DeleteProvisionalConnectionParams added in v0.4.0

type DeleteProvisionalConnectionParams struct {
	ID                    pgtype.UUID `json:"id"`
	AuthorizationRevision int64       `json:"authorization_revision"`
}

type DeleteProvisionalMCPServerParams added in v0.4.0

type DeleteProvisionalMCPServerParams struct {
	ID                    pgtype.UUID `json:"id"`
	AuthorizationRevision int64       `json:"authorization_revision"`
}

type DeleteResourceNeedsByAgentTypeExceptParams added in v0.4.0

type DeleteResourceNeedsByAgentTypeExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Type    string      `json:"type"`
	Slugs   []string    `json:"slugs"`
}

type DeleteRoutesByAgentExceptParams

type DeleteRoutesByAgentExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Keys    []string    `json:"keys"`
}

type DeleteScheduleHandlersByAgentExceptParams added in v0.4.0

type DeleteScheduleHandlersByAgentExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slugs   []string    `json:"slugs"`
}

type DeleteStaleAgentModelSlotsParams

type DeleteStaleAgentModelSlotsParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slugs   []string    `json:"slugs"`
}

type DeleteStaleAgentToolsParams

type DeleteStaleAgentToolsParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Names   []string    `json:"names"`
}

type DeleteSystemConversationParams added in v0.4.0

type DeleteSystemConversationParams struct {
	ID     pgtype.UUID `json:"id"`
	UserID pgtype.UUID `json:"user_id"`
}

type DeleteTopicsByAgentExceptParams

type DeleteTopicsByAgentExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slugs   []string    `json:"slugs"`
}

type DeleteWebhooksByAgentExceptParams

type DeleteWebhooksByAgentExceptParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Paths   []string    `json:"paths"`
}

type DeviceLoginSession added in v0.4.0

type DeviceLoginSession struct {
	ID                  pgtype.UUID        `json:"id"`
	DeviceCodeHash      string             `json:"device_code_hash"`
	UserCodeHash        string             `json:"user_code_hash"`
	UserCodeDisplay     string             `json:"user_code_display"`
	ClientName          string             `json:"client_name"`
	DeviceName          string             `json:"device_name"`
	Status              string             `json:"status"`
	UserID              pgtype.UUID        `json:"user_id"`
	CreatedAt           pgtype.Timestamptz `json:"created_at"`
	ExpiresAt           pgtype.Timestamptz `json:"expires_at"`
	ApprovedAt          pgtype.Timestamptz `json:"approved_at"`
	DeniedAt            pgtype.Timestamptz `json:"denied_at"`
	ConsumedAt          pgtype.Timestamptz `json:"consumed_at"`
	LastPolledAt        pgtype.Timestamptz `json:"last_polled_at"`
	PollIntervalSeconds int32              `json:"poll_interval_seconds"`
	ApprovedAuthEpoch   pgtype.Int8        `json:"approved_auth_epoch"`
}

type EnsureSystemConversationForBridgeParams added in v0.4.0

type EnsureSystemConversationForBridgeParams struct {
	UserID     pgtype.UUID `json:"user_id"`
	BridgeID   pgtype.UUID `json:"bridge_id"`
	Title      string      `json:"title"`
	ExternalID pgtype.Text `json:"external_id"`
}

type FailInitialAgentBuildParams added in v0.4.0

type FailInitialAgentBuildParams struct {
	ErrorMessage      string      `json:"error_message"`
	ID                pgtype.UUID `json:"id"`
	AgentTokenVersion int64       `json:"agent_token_version"`
}

type FailScheduledFireParams added in v0.4.0

type FailScheduledFireParams struct {
	LastError  string      `json:"last_error"`
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	LeaseToken pgtype.UUID `json:"lease_token"`
}

type FinalizeAgentDeploymentParams added in v0.4.0

type FinalizeAgentDeploymentParams struct {
	SourceRef         string      `json:"source_ref"`
	ImageRef          string      `json:"image_ref"`
	NextStatus        string      `json:"next_status"`
	ID                pgtype.UUID `json:"id"`
	AgentTokenVersion int64       `json:"agent_token_version"`
	ExpectedStatus    string      `json:"expected_status"`
}

type GetActiveGrantParams added in v0.4.0

type GetActiveGrantParams struct {
	UserID   pgtype.UUID `json:"user_id"`
	ClientID string      `json:"client_id"`
	AgentID  pgtype.UUID `json:"agent_id"`
}

type GetActiveLockoutParams

type GetActiveLockoutParams struct {
	Email string `json:"email"`
	Ip    string `json:"ip"`
}

type GetActiveLockoutRow

type GetActiveLockoutRow struct {
	LockedUntil pgtype.Timestamptz `json:"locked_until"`
	Tier        int32              `json:"tier"`
}

type GetAgentBuildByIntegrationTokenRow added in v0.4.0

type GetAgentBuildByIntegrationTokenRow struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetAgentEnvVarBySlugParams added in v0.2.12

type GetAgentEnvVarBySlugParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type GetAgentForUpgradeRow

type GetAgentForUpgradeRow struct {
	ID            pgtype.UUID `json:"id"`
	UpgradeStatus string      `json:"upgrade_status"`
}

type GetAgentGitConfigRow added in v0.4.0

type GetAgentGitConfigRow struct {
	ID               pgtype.UUID `json:"id"`
	GitRemoteUrl     string      `json:"git_remote_url"`
	GitCredentialID  pgtype.UUID `json:"git_credential_id"`
	GitDefaultBranch string      `json:"git_default_branch"`
	GitWebhookSecret string      `json:"git_webhook_secret"`
	GitLastSyncedRef string      `json:"git_last_synced_ref"`
	GitMode          string      `json:"git_mode"`
	CredentialName   pgtype.Text `json:"credential_name"`
}

type GetAgentGrantParams added in v0.4.0

type GetAgentGrantParams struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	GranteeID pgtype.UUID `json:"grantee_id"`
}

type GetAgentModelSlotParams

type GetAgentModelSlotParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type GetAgentTokenAuthRow added in v0.4.0

type GetAgentTokenAuthRow struct {
	Status            string `json:"status"`
	AgentTokenVersion int64  `json:"agent_token_version"`
}

type GetCachedAttachmentURLParams

type GetCachedAttachmentURLParams struct {
	CanonicalKey string          `json:"canonical_key"`
	MinRemaining pgtype.Interval `json:"min_remaining"`
}

type GetCachedAttachmentURLRow

type GetCachedAttachmentURLRow struct {
	Url       string             `json:"url"`
	ExpiresAt pgtype.Timestamptz `json:"expires_at"`
}

type GetConversationByIDAndAgentForUpdateParams added in v0.4.0

type GetConversationByIDAndAgentForUpdateParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetConversationByIDAndAgentParams added in v0.4.0

type GetConversationByIDAndAgentParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetConversationBySourceParams

type GetConversationBySourceParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	UserID  pgtype.UUID `json:"user_id"`
	Source  string      `json:"source"`
}

type GetDescendantRunsRow added in v0.4.0

type GetDescendantRunsRow struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
	Status  string      `json:"status"`
}

type GetDirectoryByPathParams added in v0.2.0

type GetDirectoryByPathParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Path    string      `json:"path"`
}

type GetLiveUserForSessionParams added in v0.4.0

type GetLiveUserForSessionParams struct {
	SessionID pgtype.UUID `json:"session_id"`
	UserID    pgtype.UUID `json:"user_id"`
}

type GetLiveUserForSessionRow added in v0.4.0

type GetLiveUserForSessionRow struct {
	User User `json:"user"`
}

type GetLockoutForUpdateParams

type GetLockoutForUpdateParams struct {
	Email string `json:"email"`
	Ip    string `json:"ip"`
}

type GetLockoutForUpdateRow

type GetLockoutForUpdateRow struct {
	Tier         int32              `json:"tier"`
	LastLockedAt pgtype.Timestamptz `json:"last_locked_at"`
}

type GetMCPActiveRequestParams added in v0.4.0

type GetMCPActiveRequestParams struct {
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
	RunID             pgtype.UUID `json:"run_id"`
}

type GetModelGrantRow added in v0.4.0

type GetModelGrantRow struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type GetOrCreateBridgeAuthedConversationParams added in v0.4.0

type GetOrCreateBridgeAuthedConversationParams struct {
	AgentID    pgtype.UUID `json:"agent_id"`
	UserID     pgtype.UUID `json:"user_id"`
	Title      string      `json:"title"`
	BridgeID   pgtype.UUID `json:"bridge_id"`
	ExternalID pgtype.Text `json:"external_id"`
}

type GetPlatformIdentityParams

type GetPlatformIdentityParams struct {
	Platform       string `json:"platform"`
	PlatformUserID string `json:"platform_user_id"`
}

type GetProviderModelParams added in v0.4.1

type GetProviderModelParams struct {
	ConfiguredProviderID pgtype.UUID `json:"configured_provider_id"`
	ModelID              string      `json:"model_id"`
}

type GetProvisionalConnectionForNeedOwnerParams added in v0.4.0

type GetProvisionalConnectionForNeedOwnerParams struct {
	NeedID           pgtype.UUID `json:"need_id"`
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
}

type GetProvisionalMCPServerForNeedOwnerParams added in v0.4.0

type GetProvisionalMCPServerForNeedOwnerParams struct {
	NeedID           pgtype.UUID `json:"need_id"`
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
}

type GetResourceNeedForUpdateParams added in v0.4.0

type GetResourceNeedForUpdateParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Type    string      `json:"type"`
	Slug    string      `json:"slug"`
}

type GetResourceNeedParams added in v0.4.0

type GetResourceNeedParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Type    string      `json:"type"`
	Slug    string      `json:"slug"`
}

type GetRunByIDAndAgentParams added in v0.4.0

type GetRunByIDAndAgentParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetRunCheckpointParams added in v0.4.0

type GetRunCheckpointParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetScheduleHandlerParams added in v0.4.0

type GetScheduleHandlerParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type GetScheduledFireParams added in v0.4.0

type GetScheduledFireParams struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type GetSiblingMaxAccessParams added in v0.4.0

type GetSiblingMaxAccessParams struct {
	ParentAgentID  pgtype.UUID `json:"parent_agent_id"`
	SiblingAgentID pgtype.UUID `json:"sibling_agent_id"`
}

type GetTopicBySlugParams

type GetTopicBySlugParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type GetWebhookByAgentAndPathParams

type GetWebhookByAgentAndPathParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Path    string      `json:"path"`
}

type GitCredential added in v0.4.0

type GitCredential struct {
	ID              pgtype.UUID        `json:"id"`
	UserID          pgtype.UUID        `json:"user_id"`
	Type            string             `json:"type"`
	Name            string             `json:"name"`
	TokenRef        string             `json:"token_ref"`
	GithubInstallID string             `json:"github_install_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	LastUsedAt      pgtype.Timestamptz `json:"last_used_at"`
}

type Group added in v0.4.0

type Group struct {
	ID          pgtype.UUID `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Builtin     bool        `json:"builtin"`
}

type HasUserAgentGrantParams added in v0.4.0

type HasUserAgentGrantParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	UserID  pgtype.UUID `json:"user_id"`
}

type IdentityLinkChallenge added in v0.4.0

type IdentityLinkChallenge struct {
	TokenHash      string             `json:"token_hash"`
	UserID         pgtype.UUID        `json:"user_id"`
	Platform       string             `json:"platform"`
	BridgeID       pgtype.UUID        `json:"bridge_id"`
	PlatformUserID string             `json:"platform_user_id"`
	ExpiresAt      pgtype.Timestamptz `json:"expires_at"`
	ConsumedAt     pgtype.Timestamptz `json:"consumed_at"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type InsertLLMUsageParams added in v0.4.0

type InsertLLMUsageParams struct {
	AgentID           pgtype.UUID `json:"agent_id"`
	RunID             pgtype.UUID `json:"run_id"`
	BuildID           pgtype.UUID `json:"build_id"`
	SystemRunID       pgtype.UUID `json:"system_run_id"`
	UserID            pgtype.UUID `json:"user_id"`
	ConversationID    pgtype.UUID `json:"conversation_id"`
	ProviderCatalogID string      `json:"provider_catalog_id"`
	ProviderSlug      string      `json:"provider_slug"`
	Model             string      `json:"model"`
	Capability        string      `json:"capability"`
	CallKind          string      `json:"call_kind"`
	Slug              string      `json:"slug"`
	TokensIn          int64       `json:"tokens_in"`
	TokensOut         int64       `json:"tokens_out"`
	TokensCached      int64       `json:"tokens_cached"`
	TokensReasoning   int64       `json:"tokens_reasoning"`
	Units             float64     `json:"units"`
	UnitKind          string      `json:"unit_kind"`
	CostInput         float64     `json:"cost_input"`
	CostOutput        float64     `json:"cost_output"`
	CostTotal         float64     `json:"cost_total"`
	FinishReason      string      `json:"finish_reason"`
	Errored           bool        `json:"errored"`
	LatencyMs         int32       `json:"latency_ms"`
}

type InsertScheduledFireParams added in v0.4.0

type InsertScheduledFireParams struct {
	ID          pgtype.UUID        `json:"id"`
	AgentID     pgtype.UUID        `json:"agent_id"`
	Source      string             `json:"source"`
	Slug        string             `json:"slug"`
	FireAt      pgtype.Timestamptz `json:"fire_at"`
	Recurrence  string             `json:"recurrence"`
	TimeoutMs   int64              `json:"timeout_ms"`
	MaxAttempts int32              `json:"max_attempts"`
}

type InsertSystemAuditPendingParams added in v0.4.0

type InsertSystemAuditPendingParams struct {
	UserID         pgtype.UUID `json:"user_id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
	Tool           string      `json:"tool"`
	Args           []byte      `json:"args"`
}

type IsProviderModelReferencedParams added in v0.4.1

type IsProviderModelReferencedParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type IsSystemDefaultModelParams added in v0.4.0

type IsSystemDefaultModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ListAddableSiblingsParams added in v0.4.0

type ListAddableSiblingsParams struct {
	ParentAgentID   pgtype.UUID   `json:"parent_agent_id"`
	OwnerGranteeIds []pgtype.UUID `json:"owner_grantee_ids"`
}

type ListAddableSiblingsRow added in v0.4.0

type ListAddableSiblingsRow struct {
	ID          pgtype.UUID `json:"id"`
	Slug        string      `json:"slug"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	OwnerName   string      `json:"owner_name"`
}

type ListAgentBuildsByAgentRow

type ListAgentBuildsByAgentRow struct {
	ID               pgtype.UUID        `json:"id"`
	AgentID          pgtype.UUID        `json:"agent_id"`
	Type             string             `json:"type"`
	Status           string             `json:"status"`
	Instructions     string             `json:"instructions"`
	ErrorMessage     string             `json:"error_message"`
	SourceRef        string             `json:"source_ref"`
	ImageRef         string             `json:"image_ref"`
	StartedAt        pgtype.Timestamptz `json:"started_at"`
	FinishedAt       pgtype.Timestamptz `json:"finished_at"`
	LlmCalls         int32              `json:"llm_calls"`
	LlmTokensIn      int32              `json:"llm_tokens_in"`
	LlmTokensOut     int32              `json:"llm_tokens_out"`
	LlmTokensCached  int32              `json:"llm_tokens_cached"`
	LlmCostEstimate  float64            `json:"llm_cost_estimate"`
	RollbackTargetID pgtype.UUID        `json:"rollback_target_id"`
	SdkVersion       string             `json:"sdk_version"`
	ExitStatus       string             `json:"exit_status"`
	ExitMessage      string             `json:"exit_message"`
	FailureKind      string             `json:"failure_kind"`
	BuildModel       string             `json:"build_model"`
}

type ListAgentEnvVarsRow added in v0.2.12

type ListAgentEnvVarsRow struct {
	ID           pgtype.UUID        `json:"id"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	Slug         string             `json:"slug"`
	Description  string             `json:"description"`
	IsSecret     bool               `json:"is_secret"`
	DefaultValue string             `json:"default_value"`
	Pattern      string             `json:"pattern"`
	Configured   bool               `json:"configured"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
}

type ListAgentGrantRowsForGranteesParams added in v0.4.0

type ListAgentGrantRowsForGranteesParams struct {
	AgentID    pgtype.UUID   `json:"agent_id"`
	GranteeIds []pgtype.UUID `json:"grantee_ids"`
}

type ListAgentGrantRowsForGranteesRow added in v0.4.0

type ListAgentGrantRowsForGranteesRow struct {
	GranteeID pgtype.UUID `json:"grantee_id"`
	Role      string      `json:"role"`
}

type ListAgentGrantsForGranteesParams added in v0.4.0

type ListAgentGrantsForGranteesParams struct {
	AgentID    pgtype.UUID   `json:"agent_id"`
	GranteeIds []pgtype.UUID `json:"grantee_ids"`
}

type ListAgentGrantsRow added in v0.4.0

type ListAgentGrantsRow struct {
	AgentID     pgtype.UUID        `json:"agent_id"`
	GranteeID   pgtype.UUID        `json:"grantee_id"`
	Role        string             `json:"role"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	Kind        string             `json:"kind"`
	Email       string             `json:"email"`
	DisplayName string             `json:"display_name"`
}

type ListAgentIDsUsingModelParams added in v0.4.1

type ListAgentIDsUsingModelParams struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ListAgentsForGitPollingRow added in v0.4.0

type ListAgentsForGitPollingRow struct {
	ID               pgtype.UUID `json:"id"`
	GitRemoteUrl     string      `json:"git_remote_url"`
	GitDefaultBranch string      `json:"git_default_branch"`
	GitLastSyncedRef string      `json:"git_last_synced_ref"`
	GitCredentialID  pgtype.UUID `json:"git_credential_id"`
	GitMode          string      `json:"git_mode"`
}

type ListAvailableConnectionsRow added in v0.4.0

type ListAvailableConnectionsRow struct {
	ID           pgtype.UUID        `json:"id"`
	Slug         string             `json:"slug"`
	Name         string             `json:"name"`
	DisplayName  string             `json:"display_name"`
	AuthMode     string             `json:"auth_mode"`
	Authorized   bool               `json:"authorized"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	AgentCount   int32              `json:"agent_count"`
	Capabilities []string           `json:"capabilities"`
}

type ListAvailableExecEndpointsRow added in v0.4.0

type ListAvailableExecEndpointsRow struct {
	ID           pgtype.UUID        `json:"id"`
	Slug         string             `json:"slug"`
	DisplayName  string             `json:"display_name"`
	Configured   bool               `json:"configured"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	LastUsedAt   pgtype.Timestamptz `json:"last_used_at"`
	AgentCount   int32              `json:"agent_count"`
	Capabilities []string           `json:"capabilities"`
}

type ListAvailableMCPServersRow added in v0.4.0

type ListAvailableMCPServersRow struct {
	ID           pgtype.UUID        `json:"id"`
	Slug         string             `json:"slug"`
	Name         string             `json:"name"`
	DisplayName  string             `json:"display_name"`
	AuthMode     string             `json:"auth_mode"`
	Authorized   bool               `json:"authorized"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	AgentCount   int32              `json:"agent_count"`
	Capabilities []string           `json:"capabilities"`
}

type ListBoundMCPServersByAgentRow added in v0.4.0

type ListBoundMCPServersByAgentRow struct {
	Slug           string      `json:"slug"`
	ID             pgtype.UUID `json:"id"`
	Name           string      `json:"name"`
	Url            string      `json:"url"`
	AuthMode       string      `json:"auth_mode"`
	AuthInjection  []byte      `json:"auth_injection"`
	AccessTokenRef string      `json:"access_token_ref"`
	ToolSchemas    []byte      `json:"tool_schemas"`
}

type ListBridgesAccessibleRow

type ListBridgesAccessibleRow struct {
	ID                pgtype.UUID        `json:"id"`
	AgentID           pgtype.UUID        `json:"agent_id"`
	OwnerPrincipalID  pgtype.UUID        `json:"owner_principal_id"`
	Type              string             `json:"type"`
	Name              string             `json:"name"`
	BotUsername       string             `json:"bot_username"`
	Status            string             `json:"status"`
	IsSystem          bool               `json:"is_system"`
	Config            []byte             `json:"config"`
	Settings          []byte             `json:"settings"`
	BotTokenRef       string             `json:"bot_token_ref"`
	LastPolledAt      pgtype.Timestamptz `json:"last_polled_at"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	Managed           bool               `json:"managed"`
	TelegramBotUserID pgtype.Int8        `json:"telegram_bot_user_id"`
	IsManager         bool               `json:"is_manager"`
	ManagerError      string             `json:"manager_error"`
	OwnerEmail        pgtype.Text        `json:"owner_email"`
	OwnerDisplayName  pgtype.Text        `json:"owner_display_name"`
}

type ListBridgesAdminRow

type ListBridgesAdminRow struct {
	ID                pgtype.UUID        `json:"id"`
	AgentID           pgtype.UUID        `json:"agent_id"`
	OwnerPrincipalID  pgtype.UUID        `json:"owner_principal_id"`
	Type              string             `json:"type"`
	Name              string             `json:"name"`
	BotUsername       string             `json:"bot_username"`
	Status            string             `json:"status"`
	IsSystem          bool               `json:"is_system"`
	Config            []byte             `json:"config"`
	Settings          []byte             `json:"settings"`
	BotTokenRef       string             `json:"bot_token_ref"`
	LastPolledAt      pgtype.Timestamptz `json:"last_polled_at"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	Managed           bool               `json:"managed"`
	TelegramBotUserID pgtype.Int8        `json:"telegram_bot_user_id"`
	IsManager         bool               `json:"is_manager"`
	ManagerError      string             `json:"manager_error"`
	OwnerEmail        pgtype.Text        `json:"owner_email"`
	OwnerDisplayName  pgtype.Text        `json:"owner_display_name"`
}

type ListConnectionConsumersRow added in v0.4.0

type ListConnectionConsumersRow struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	AgentName string      `json:"agent_name"`
	AgentSlug string      `json:"agent_slug"`
	NeedType  string      `json:"need_type"`
	NeedSlug  string      `json:"need_slug"`
}

type ListConnectionGrantsRow added in v0.4.0

type ListConnectionGrantsRow struct {
	ID           pgtype.UUID `json:"id"`
	GranteeID    pgtype.UUID `json:"grantee_id"`
	Capabilities []string    `json:"capabilities"`
}

type ListConnectionNeedsByAgentRow added in v0.4.0

type ListConnectionNeedsByAgentRow struct {
	Slug              string             `json:"slug"`
	Description       string             `json:"description"`
	ConnectionID      pgtype.UUID        `json:"connection_id"`
	Name              string             `json:"name"`
	AuthMode          string             `json:"auth_mode"`
	AuthUrl           string             `json:"auth_url"`
	BaseUrl           string             `json:"base_url"`
	Scopes            string             `json:"scopes"`
	SetupInstructions string             `json:"setup_instructions"`
	Authorized        bool               `json:"authorized"`
	HasOauthApp       bool               `json:"has_oauth_app"`
	HasRefreshToken   bool               `json:"has_refresh_token"`
	Bound             bool               `json:"bound"`
	TokenExpiresAt    pgtype.Timestamptz `json:"token_expires_at"`
}

type ListConversationFeedParams added in v0.4.0

type ListConversationFeedParams struct {
	UserID        pgtype.UUID        `json:"user_id"`
	CursorUpdated pgtype.Timestamptz `json:"cursor_updated"`
	CursorID      pgtype.UUID        `json:"cursor_id"`
	Lim           int32              `json:"lim"`
}

type ListConversationFeedRow added in v0.4.0

type ListConversationFeedRow struct {
	Kind      string             `json:"kind"`
	ID        pgtype.UUID        `json:"id"`
	AgentID   pgtype.UUID        `json:"agent_id"`
	Title     string             `json:"title"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	Status    string             `json:"status"`
}

type ListConversationsByAgentParams

type ListConversationsByAgentParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	UserID  pgtype.UUID `json:"user_id"`
}

type ListDirectoriesWithRetentionRow added in v0.2.8

type ListDirectoriesWithRetentionRow struct {
	AgentID        pgtype.UUID `json:"agent_id"`
	Path           string      `json:"path"`
	RetentionHours int32       `json:"retention_hours"`
}

type ListEnabledProviderModelsRow added in v0.4.1

type ListEnabledProviderModelsRow struct {
	ConfiguredProviderID pgtype.UUID        `json:"configured_provider_id"`
	ModelID              string             `json:"model_id"`
	DisplayName          string             `json:"display_name"`
	ToolCall             bool               `json:"tool_call"`
	Reasoning            bool               `json:"reasoning"`
	Vision               bool               `json:"vision"`
	ContextLimit         int32              `json:"context_limit"`
	OutputLimit          int32              `json:"output_limit"`
	StructuredOutputs    bool               `json:"structured_outputs"`
	IncludeUsage         bool               `json:"include_usage"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	ProviderCatalogID    string             `json:"provider_catalog_id"`
}

type ListExecEndpointConsumersRow added in v0.4.0

type ListExecEndpointConsumersRow struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	AgentName string      `json:"agent_name"`
	AgentSlug string      `json:"agent_slug"`
	NeedType  string      `json:"need_type"`
	NeedSlug  string      `json:"need_slug"`
}

type ListExecEndpointGrantsRow added in v0.4.0

type ListExecEndpointGrantsRow struct {
	ID           pgtype.UUID `json:"id"`
	GranteeID    pgtype.UUID `json:"grantee_id"`
	Capabilities []string    `json:"capabilities"`
}

type ListExecNeedsByAgentRow added in v0.4.0

type ListExecNeedsByAgentRow struct {
	Slug             string             `json:"slug"`
	ExecID           pgtype.UUID        `json:"exec_id"`
	Description      string             `json:"description"`
	LlmHint          string             `json:"llm_hint"`
	Access           string             `json:"access"`
	Bound            bool               `json:"bound"`
	Transport        pgtype.Text        `json:"transport"`
	Host             pgtype.Text        `json:"host"`
	Port             pgtype.Int4        `json:"port"`
	SshUser          pgtype.Text        `json:"ssh_user"`
	PublicKeyOpenssh pgtype.Text        `json:"public_key_openssh"`
	PublicKeyComment pgtype.Text        `json:"public_key_comment"`
	HostKeyOpenssh   pgtype.Text        `json:"host_key_openssh"`
	HostKeyPinnedAt  pgtype.Timestamptz `json:"host_key_pinned_at"`
	LastUsedAt       pgtype.Timestamptz `json:"last_used_at"`
}

type ListExpiringConnectionsRow

type ListExpiringConnectionsRow struct {
	ID             pgtype.UUID        `json:"id"`
	Slug           string             `json:"slug"`
	Name           string             `json:"name"`
	AuthMode       string             `json:"auth_mode"`
	TokenUrl       string             `json:"token_url"`
	ClientID       string             `json:"client_id"`
	ClientSecret   string             `json:"client_secret"`
	AccessTokenRef string             `json:"access_token_ref"`
	RefreshToken   string             `json:"refresh_token"`
	TokenExpiresAt pgtype.Timestamptz `json:"token_expires_at"`
	Scopes         string             `json:"scopes"`
	GrantedScopes  string             `json:"granted_scopes"`
	ScopesVerified bool               `json:"scopes_verified"`
}

type ListExpiringMCPServersRow

type ListExpiringMCPServersRow struct {
	ID             pgtype.UUID        `json:"id"`
	Slug           string             `json:"slug"`
	Name           string             `json:"name"`
	AuthMode       string             `json:"auth_mode"`
	TokenUrl       string             `json:"token_url"`
	ClientID       string             `json:"client_id"`
	ClientSecret   string             `json:"client_secret"`
	AccessTokenRef string             `json:"access_token_ref"`
	RefreshToken   string             `json:"refresh_token"`
	TokenExpiresAt pgtype.Timestamptz `json:"token_expires_at"`
	Scopes         string             `json:"scopes"`
	GrantedScopes  string             `json:"granted_scopes"`
	ScopesVerified bool               `json:"scopes_verified"`
}

type ListGitCredentialGrantsRow added in v0.4.0

type ListGitCredentialGrantsRow struct {
	ID           pgtype.UUID `json:"id"`
	GranteeID    pgtype.UUID `json:"grantee_id"`
	Capabilities []string    `json:"capabilities"`
}

type ListGitCredentialsByUserRow added in v0.4.0

type ListGitCredentialsByUserRow struct {
	ID              pgtype.UUID        `json:"id"`
	UserID          pgtype.UUID        `json:"user_id"`
	Type            string             `json:"type"`
	Name            string             `json:"name"`
	GithubInstallID string             `json:"github_install_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	LastUsedAt      pgtype.Timestamptz `json:"last_used_at"`
}

type ListGrantsForUserRow added in v0.4.0

type ListGrantsForUserRow struct {
	UserID     pgtype.UUID        `json:"user_id"`
	ClientID   string             `json:"client_id"`
	AgentID    pgtype.UUID        `json:"agent_id"`
	Scope      string             `json:"scope"`
	GrantedAt  pgtype.Timestamptz `json:"granted_at"`
	ExpiresAt  pgtype.Timestamptz `json:"expires_at"`
	RevokedAt  pgtype.Timestamptz `json:"revoked_at"`
	ClientName string             `json:"client_name"`
	AgentSlug  string             `json:"agent_slug"`
	AgentName  string             `json:"agent_name"`
}

type ListInboundSiblingsRow added in v0.4.0

type ListInboundSiblingsRow struct {
	ID              pgtype.UUID        `json:"id"`
	Slug            string             `json:"slug"`
	Name            string             `json:"name"`
	Description     string             `json:"description"`
	MaxAccess       string             `json:"max_access"`
	AuthorizingRole string             `json:"authorizing_role"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	OwnerName       string             `json:"owner_name"`
}

type ListMCPNeedsByAgentRow added in v0.4.0

type ListMCPNeedsByAgentRow struct {
	Slug           string             `json:"slug"`
	McpID          pgtype.UUID        `json:"mcp_id"`
	Name           string             `json:"name"`
	Url            string             `json:"url"`
	AuthMode       string             `json:"auth_mode"`
	ToolSchemas    []byte             `json:"tool_schemas"`
	Authorized     bool               `json:"authorized"`
	HasOauthApp    bool               `json:"has_oauth_app"`
	Bound          bool               `json:"bound"`
	TokenExpiresAt pgtype.Timestamptz `json:"token_expires_at"`
	LastSyncedAt   pgtype.Timestamptz `json:"last_synced_at"`
}

type ListMCPServerConsumersRow added in v0.4.0

type ListMCPServerConsumersRow struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	AgentName string      `json:"agent_name"`
	AgentSlug string      `json:"agent_slug"`
	NeedType  string      `json:"need_type"`
	NeedSlug  string      `json:"need_slug"`
}

type ListMCPServerGrantsRow added in v0.4.0

type ListMCPServerGrantsRow struct {
	ID           pgtype.UUID `json:"id"`
	GranteeID    pgtype.UUID `json:"grantee_id"`
	Capabilities []string    `json:"capabilities"`
}

type ListMessagesBackwardParams

type ListMessagesBackwardParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	Before         int64       `json:"before"`
	Lim            int32       `json:"lim"`
}

type ListMessagesForwardParams

type ListMessagesForwardParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	After          int64       `json:"after"`
	Lim            int32       `json:"lim"`
}

type ListModelGrantsForGranteesRow added in v0.4.0

type ListModelGrantsForGranteesRow struct {
	CatalogID pgtype.UUID `json:"provider_id"`
	Model     string      `json:"model"`
}

type ListModelGrantsRow added in v0.4.0

type ListModelGrantsRow struct {
	ID              pgtype.UUID        `json:"id"`
	CatalogID       pgtype.UUID        `json:"provider_id"`
	Model           string             `json:"model"`
	GranteeID       pgtype.UUID        `json:"grantee_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	ProviderCatalog string             `json:"provider_catalog"`
	ProviderSlug    string             `json:"provider_slug"`
}

type ListOrphanToolCallsByRunRow added in v0.2.8

type ListOrphanToolCallsByRunRow struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	ToolCallID     string      `json:"tool_call_id"`
	ToolName       string      `json:"tool_name"`
}

type ListPlatformIdentitiesAllRow added in v0.4.0

type ListPlatformIdentitiesAllRow struct {
	ID              pgtype.UUID        `json:"id"`
	UserID          pgtype.UUID        `json:"user_id"`
	Platform        string             `json:"platform"`
	PlatformUserID  string             `json:"platform_user_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UserEmail       string             `json:"user_email"`
	UserDisplayName string             `json:"user_display_name"`
}

type ListRequiredConnectionScopesParams added in v0.4.0

type ListRequiredConnectionScopesParams struct {
	ResourceID   pgtype.UUID `json:"resource_id"`
	TargetNeedID pgtype.UUID `json:"target_need_id"`
}

type ListRequiredMCPScopesParams added in v0.4.0

type ListRequiredMCPScopesParams struct {
	ResourceID   pgtype.UUID `json:"resource_id"`
	TargetNeedID pgtype.UUID `json:"target_need_id"`
}

type ListRoutesByAgentAndMethodParams

type ListRoutesByAgentAndMethodParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Method  string      `json:"method"`
}

type ListRunsByAgentParams

type ListRunsByAgentParams struct {
	AgentID pgtype.UUID        `json:"agent_id"`
	Cursor  pgtype.Timestamptz `json:"cursor"`
	Lim     int32              `json:"lim"`
}

type ListScheduleHandlersByAgentKindParams added in v0.4.0

type ListScheduleHandlersByAgentKindParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Kind    string      `json:"kind"`
}

type ListScheduledFiresParams added in v0.4.0

type ListScheduledFiresParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ListSchedulesWithNextFireRow added in v0.4.0

type ListSchedulesWithNextFireRow struct {
	ID          pgtype.UUID        `json:"id"`
	AgentID     pgtype.UUID        `json:"agent_id"`
	Slug        string             `json:"slug"`
	Kind        string             `json:"kind"`
	Recurrence  string             `json:"recurrence"`
	Enabled     bool               `json:"enabled"`
	TimeoutMs   int64              `json:"timeout_ms"`
	Description string             `json:"description"`
	LastFiredAt pgtype.Timestamptz `json:"last_fired_at"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
	NextFireAt  pgtype.Timestamptz `json:"next_fire_at"`
}

type ListSiblingsRow added in v0.4.0

type ListSiblingsRow struct {
	ID              pgtype.UUID        `json:"id"`
	Slug            string             `json:"slug"`
	Name            string             `json:"name"`
	Description     string             `json:"description"`
	MaxAccess       string             `json:"max_access"`
	AuthorizingRole string             `json:"authorizing_role"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
}

type ListStoredSecretsRow added in v0.4.0

type ListStoredSecretsRow struct {
	Kind   string `json:"kind"`
	RowKey string `json:"row_key"`
	Field  string `json:"field"`
	Ref    string `json:"ref"`
	Stored string `json:"stored"`
}

type ListStuckRunsRow added in v0.2.8

type ListStuckRunsRow struct {
	ID      pgtype.UUID `json:"id"`
	AgentID pgtype.UUID `json:"agent_id"`
}

type ListSubscribedConversationsForUserParams added in v0.4.0

type ListSubscribedConversationsForUserParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
	UserID  pgtype.UUID `json:"user_id"`
}

type ListSubscribedConversationsParams

type ListSubscribedConversationsParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ListSystemMessagesByConversationAfterParams added in v0.4.0

type ListSystemMessagesByConversationAfterParams struct {
	ConversationID pgtype.UUID `json:"conversation_id"`
	AfterSeq       int64       `json:"after_seq"`
	MaxRows        int32       `json:"max_rows"`
}

type ListSystemRunsByUserParams added in v0.4.0

type ListSystemRunsByUserParams struct {
	UserID pgtype.UUID        `json:"user_id"`
	Cursor pgtype.Timestamptz `json:"cursor"`
	Lim    int32              `json:"lim"`
}

type ListSystemRunsByUserRow added in v0.4.0

type ListSystemRunsByUserRow struct {
	ID                pgtype.UUID        `json:"id"`
	ConversationID    pgtype.UUID        `json:"conversation_id"`
	UserID            pgtype.UUID        `json:"user_id"`
	Status            string             `json:"status"`
	TriggerType       string             `json:"trigger_type"`
	MessagePreview    string             `json:"message_preview"`
	ErrorMessage      string             `json:"error_message"`
	LlmCostEstimate   float64            `json:"llm_cost_estimate"`
	StartedAt         pgtype.Timestamptz `json:"started_at"`
	FinishedAt        pgtype.Timestamptz `json:"finished_at"`
	ConversationTitle string             `json:"conversation_title"`
}

type ListTopicSubscriptionsParams

type ListTopicSubscriptionsParams struct {
	AgentID        pgtype.UUID `json:"agent_id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
}

type ListTopicSubscriptionsRow

type ListTopicSubscriptionsRow struct {
	ID               pgtype.UUID        `json:"id"`
	TopicID          pgtype.UUID        `json:"topic_id"`
	ConversationID   pgtype.UUID        `json:"conversation_id"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	TopicSlug        string             `json:"topic_slug"`
	TopicDescription string             `json:"topic_description"`
}

type ListUserAgentGrantsRow added in v0.4.0

type ListUserAgentGrantsRow struct {
	ID        pgtype.UUID        `json:"id"`
	Slug      string             `json:"slug"`
	Name      string             `json:"name"`
	Role      string             `json:"role"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type ListVisibleSiblingsParams added in v0.4.0

type ListVisibleSiblingsParams struct {
	ParentAgentID pgtype.UUID   `json:"parent_agent_id"`
	GranteeIds    []pgtype.UUID `json:"grantee_ids"`
}

type ListWebhooksByAgentWithStatusRow

type ListWebhooksByAgentWithStatusRow struct {
	ID             pgtype.UUID        `json:"id"`
	AgentID        pgtype.UUID        `json:"agent_id"`
	Path           string             `json:"path"`
	VerifyMode     string             `json:"verify_mode"`
	VerifyHeader   string             `json:"verify_header"`
	Secret         string             `json:"secret"`
	LastReceivedAt pgtype.Timestamptz `json:"last_received_at"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
	UpdatedAt      pgtype.Timestamptz `json:"updated_at"`
	Description    string             `json:"description"`
}

type LlmUsage added in v0.4.0

type LlmUsage struct {
	ID                pgtype.UUID        `json:"id"`
	AgentID           pgtype.UUID        `json:"agent_id"`
	AgentSlug         string             `json:"agent_slug"`
	AgentName         string             `json:"agent_name"`
	RunID             pgtype.UUID        `json:"run_id"`
	BuildID           pgtype.UUID        `json:"build_id"`
	SystemRunID       pgtype.UUID        `json:"system_run_id"`
	UserID            pgtype.UUID        `json:"user_id"`
	UserEmail         string             `json:"user_email"`
	ConversationID    pgtype.UUID        `json:"conversation_id"`
	ProviderCatalogID string             `json:"provider_catalog_id"`
	ProviderSlug      string             `json:"provider_slug"`
	Model             string             `json:"model"`
	Capability        string             `json:"capability"`
	CallKind          string             `json:"call_kind"`
	Slug              string             `json:"slug"`
	TokensIn          int64              `json:"tokens_in"`
	TokensOut         int64              `json:"tokens_out"`
	TokensCached      int64              `json:"tokens_cached"`
	TokensReasoning   int64              `json:"tokens_reasoning"`
	Units             float64            `json:"units"`
	UnitKind          string             `json:"unit_kind"`
	CostInput         float64            `json:"cost_input"`
	CostOutput        float64            `json:"cost_output"`
	CostTotal         float64            `json:"cost_total"`
	FinishReason      string             `json:"finish_reason"`
	Errored           bool               `json:"errored"`
	LatencyMs         int32              `json:"latency_ms"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
}

type LockConnectionAuthorizationNeedsParams added in v0.4.0

type LockConnectionAuthorizationNeedsParams struct {
	ResourceID   pgtype.UUID `json:"resource_id"`
	TargetNeedID pgtype.UUID `json:"target_need_id"`
}

type LockMCPAuthorizationNeedsParams added in v0.4.0

type LockMCPAuthorizationNeedsParams struct {
	ResourceID   pgtype.UUID `json:"resource_id"`
	TargetNeedID pgtype.UUID `json:"target_need_id"`
}

type LockOAuthGrantLifecycleParams added in v0.4.0

type LockOAuthGrantLifecycleParams struct {
	UserID   string `json:"user_id"`
	ClientID string `json:"client_id"`
	AgentID  string `json:"agent_id"`
}

type LockQualifyingConnectionBindingsParams added in v0.4.0

type LockQualifyingConnectionBindingsParams struct {
	ResourceID     pgtype.UUID `json:"resource_id"`
	ScopesVerified bool        `json:"scopes_verified"`
	GrantedScopes  string      `json:"granted_scopes"`
}

type LockQualifyingMCPBindingsParams added in v0.4.0

type LockQualifyingMCPBindingsParams struct {
	ResourceID     pgtype.UUID `json:"resource_id"`
	ScopesVerified bool        `json:"scopes_verified"`
	GrantedScopes  string      `json:"granted_scopes"`
}

type ManagedBotSession added in v0.4.0

type ManagedBotSession struct {
	ID                   pgtype.UUID        `json:"id"`
	OwnerID              pgtype.UUID        `json:"owner_id"`
	AgentID              pgtype.UUID        `json:"agent_id"`
	IsSystem             bool               `json:"is_system"`
	Nonce                string             `json:"nonce"`
	BridgeName           string             `json:"bridge_name"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	SystemConversationID pgtype.UUID        `json:"system_conversation_id"`
}

type McpActiveRequest added in v0.4.0

type McpActiveRequest struct {
	TargetAgentID     pgtype.UUID        `json:"target_agent_id"`
	PrincipalIdentity string             `json:"principal_identity"`
	RequestID         []byte             `json:"request_id"`
	RunID             pgtype.UUID        `json:"run_id"`
	ExpiresAt         pgtype.Timestamptz `json:"expires_at"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
}

type ModelGrant added in v0.4.0

type ModelGrant struct {
	ID        pgtype.UUID        `json:"id"`
	CatalogID pgtype.UUID        `json:"provider_id"`
	Model     string             `json:"model"`
	GranteeID pgtype.UUID        `json:"grantee_id"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type OauthAuthzCode added in v0.4.0

type OauthAuthzCode struct {
	Code          string             `json:"code"`
	UserID        pgtype.UUID        `json:"user_id"`
	ClientID      string             `json:"client_id"`
	AgentID       pgtype.UUID        `json:"agent_id"`
	RedirectUri   string             `json:"redirect_uri"`
	CodeChallenge string             `json:"code_challenge"`
	Scope         string             `json:"scope"`
	Resource      string             `json:"resource"`
	ExpiresAt     pgtype.Timestamptz `json:"expires_at"`
	CreatedAt     pgtype.Timestamptz `json:"created_at"`
}

type OauthClient added in v0.4.0

type OauthClient struct {
	ClientID                string             `json:"client_id"`
	ClientName              string             `json:"client_name"`
	RedirectUris            []string           `json:"redirect_uris"`
	GrantTypes              []string           `json:"grant_types"`
	ResponseTypes           []string           `json:"response_types"`
	TokenEndpointAuthMethod string             `json:"token_endpoint_auth_method"`
	Scope                   string             `json:"scope"`
	CreatedAt               pgtype.Timestamptz `json:"created_at"`
	LastUsedAt              pgtype.Timestamptz `json:"last_used_at"`
}

type OauthConsentTransaction added in v0.4.0

type OauthConsentTransaction struct {
	TransactionID pgtype.UUID        `json:"transaction_id"`
	BindingHash   []byte             `json:"binding_hash"`
	UserID        pgtype.UUID        `json:"user_id"`
	ClientID      string             `json:"client_id"`
	AgentID       pgtype.UUID        `json:"agent_id"`
	ExpiresAt     pgtype.Timestamptz `json:"expires_at"`
	CreatedAt     pgtype.Timestamptz `json:"created_at"`
}

type OauthDcrAttempt added in v0.4.0

type OauthDcrAttempt struct {
	IpAddress string             `json:"ip_address"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type OauthGrant added in v0.4.0

type OauthGrant struct {
	UserID    pgtype.UUID        `json:"user_id"`
	ClientID  string             `json:"client_id"`
	AgentID   pgtype.UUID        `json:"agent_id"`
	Scope     string             `json:"scope"`
	GrantedAt pgtype.Timestamptz `json:"granted_at"`
	ExpiresAt pgtype.Timestamptz `json:"expires_at"`
	RevokedAt pgtype.Timestamptz `json:"revoked_at"`
}

type OauthRefreshToken added in v0.4.0

type OauthRefreshToken struct {
	TokenHash       []byte             `json:"token_hash"`
	UserID          pgtype.UUID        `json:"user_id"`
	ClientID        string             `json:"client_id"`
	AgentID         pgtype.UUID        `json:"agent_id"`
	Scope           string             `json:"scope"`
	FamilyID        pgtype.UUID        `json:"family_id"`
	ParentTokenHash []byte             `json:"parent_token_hash"`
	ExpiresAt       pgtype.Timestamptz `json:"expires_at"`
	ConsumedAt      pgtype.Timestamptz `json:"consumed_at"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
}

type OauthState

type OauthState struct {
	State                   string             `json:"state"`
	AgentID                 pgtype.UUID        `json:"agent_id"`
	Slug                    string             `json:"slug"`
	SourceType              string             `json:"source_type"`
	CodeVerifier            string             `json:"code_verifier"`
	RedirectUri             string             `json:"redirect_uri"`
	ExpiresAt               pgtype.Timestamptz `json:"expires_at"`
	CreatedAt               pgtype.Timestamptz `json:"created_at"`
	UserID                  pgtype.UUID        `json:"user_id"`
	ResourceID              pgtype.UUID        `json:"resource_id"`
	NeedID                  pgtype.UUID        `json:"need_id"`
	RequestedScopes         string             `json:"requested_scopes"`
	AuthorizationRevision   int64              `json:"authorization_revision"`
	ExpectedPriorResourceID pgtype.UUID        `json:"expected_prior_resource_id"`
	UsesPendingClient       bool               `json:"uses_pending_client"`
}

type OrphanMissingScheduleFiresParams added in v0.4.0

type OrphanMissingScheduleFiresParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slugs   []string    `json:"slugs"`
}

type PlatformIdentity

type PlatformIdentity struct {
	ID             pgtype.UUID        `json:"id"`
	UserID         pgtype.UUID        `json:"user_id"`
	Platform       string             `json:"platform"`
	PlatformUserID string             `json:"platform_user_id"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type Principal added in v0.4.0

type Principal struct {
	ID        pgtype.UUID        `json:"id"`
	Kind      string             `json:"kind"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type Provider

type Provider struct {
	ID          pgtype.UUID        `json:"id"`
	CatalogID   string             `json:"provider_id"`
	Slug        string             `json:"slug"`
	DisplayName string             `json:"display_name"`
	IsEnabled   bool               `json:"is_enabled"`
	BaseUrl     string             `json:"base_url"`
	ApiKey      string             `json:"api_key"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
}

type ProviderModel added in v0.4.1

type ProviderModel struct {
	ConfiguredProviderID pgtype.UUID        `json:"configured_provider_id"`
	ModelID              string             `json:"model_id"`
	DisplayName          string             `json:"display_name"`
	ToolCall             bool               `json:"tool_call"`
	Reasoning            bool               `json:"reasoning"`
	Vision               bool               `json:"vision"`
	ContextLimit         int32              `json:"context_limit"`
	OutputLimit          int32              `json:"output_limit"`
	StructuredOutputs    bool               `json:"structured_outputs"`
	IncludeUsage         bool               `json:"include_usage"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) ActivateConnectionWithCredentials added in v0.4.0

func (q *Queries) ActivateConnectionWithCredentials(ctx context.Context, arg ActivateConnectionWithCredentialsParams) (int64, error)

func (*Queries) ActivateMCPActiveRequest added in v0.4.0

func (q *Queries) ActivateMCPActiveRequest(ctx context.Context, arg ActivateMCPActiveRequestParams) (int64, error)

A consumed reservation cannot be activated, so cancellation racing dispatch is observed by the request owner after ForwardA2APrompt returns.

func (*Queries) ActivateMCPServerWithCredentials added in v0.4.0

func (q *Queries) ActivateMCPServerWithCredentials(ctx context.Context, arg ActivateMCPServerWithCredentialsParams) (int64, error)

func (*Queries) AddSibling added in v0.4.0

func (q *Queries) AddSibling(ctx context.Context, arg AddSiblingParams) error

Insert one address-book edge. The add gate (the parent owner has access to the sibling) and the choice of authorizing_grantee_id live in the service; the composite FK to agent_grants(agent_id, grantee_id) makes the write atomic — if that grant vanished between check and insert, the FK rejects the row. A PK violation means it is already in the list (409).

func (*Queries) AdvanceConnectionAuthorizationRevision added in v0.4.0

func (q *Queries) AdvanceConnectionAuthorizationRevision(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) AdvanceMCPServerAuthorizationRevision added in v0.4.0

func (q *Queries) AdvanceMCPServerAuthorizationRevision(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) AdvanceUserAuthEpochAndRevokeSessions added in v0.4.0

func (q *Queries) AdvanceUserAuthEpochAndRevokeSessions(ctx context.Context, arg AdvanceUserAuthEpochAndRevokeSessionsParams) (int64, error)

func (*Queries) AgentBuildIntegrationActive added in v0.4.0

func (q *Queries) AgentBuildIntegrationActive(ctx context.Context, arg AgentBuildIntegrationActiveParams) (bool, error)

func (*Queries) AgentSetupStatus added in v0.2.12

func (q *Queries) AgentSetupStatus(ctx context.Context, agentID pgtype.UUID) (AgentSetupStatusRow, error)

Counts of registered slots that need operator action before the agent can run cleanly. "Needs setup" definitions:

resources: every required need must be bound and ready
env_vars: is_secret AND value_ref = ''  (no fallback)
        OR (NOT is_secret) AND value_ref = '' AND default_value = ''

Pattern mismatch on stored values is handled at sync time (UpsertAgentEnvVar clears value_ref when the pattern changes and the stored value no longer matches), so a non-empty value_ref means "configured + currently passes pattern".

func (*Queries) AllowOAuthClientRegistration added in v0.4.0

func (q *Queries) AllowOAuthClientRegistration(ctx context.Context, ipAddress string) (bool, error)

Serialize each normalized IP bucket across replicas, prune its expired entries, and admit at most ten registrations in the rolling hour.

func (*Queries) AppendSystemMessage added in v0.4.0

func (q *Queries) AppendSystemMessage(ctx context.Context, arg AppendSystemMessageParams) (SystemMessage, error)

Mirrors agent_messages' (content, parts) split: content is the plain-text display string; parts carries the goai multi-part Content shape only when there are tool calls / results / images / etc. (left NULL for plain text answers). source distinguishes operator prompts ("") from system-injected events ("upgrade", "error", ...).

func (*Queries) ApproveDeviceLogin added in v0.4.0

func (q *Queries) ApproveDeviceLogin(ctx context.Context, arg ApproveDeviceLoginParams) (DeviceLoginSession, error)

func (*Queries) BindConnectionNeed added in v0.4.0

func (q *Queries) BindConnectionNeed(ctx context.Context, arg BindConnectionNeedParams) (int64, error)

Binding management (operator selects/creates a resource for a need).

func (*Queries) BindExecEndpointNeed added in v0.4.0

func (q *Queries) BindExecEndpointNeed(ctx context.Context, arg BindExecEndpointNeedParams) (int64, error)

func (*Queries) BindMCPServerNeed added in v0.4.0

func (q *Queries) BindMCPServerNeed(ctx context.Context, arg BindMCPServerNeedParams) (int64, error)

func (*Queries) CancelScheduledFire added in v0.4.0

func (q *Queries) CancelScheduledFire(ctx context.Context, arg CancelScheduledFireParams) (int64, error)

func (*Queries) ClaimDeviceLoginPoll added in v0.4.0

func (q *Queries) ClaimDeviceLoginPoll(ctx context.Context, deviceCodeHash string) (DeviceLoginSession, error)

func (*Queries) ClaimDueScheduledFires added in v0.4.0

func (q *Queries) ClaimDueScheduledFires(ctx context.Context, arg ClaimDueScheduledFiresParams) ([]AgentScheduledFire, error)

func (*Queries) ClaimMCPTaskResume added in v0.4.0

func (q *Queries) ClaimMCPTaskResume(ctx context.Context, arg ClaimMCPTaskResumeParams) (int64, error)

A suspended MCP task is single-use. The conversation reference is part of the CAS so a stale or inconsistent context/task pair cannot consume it.

func (*Queries) ClaimSystemConversationCheckpoint added in v0.4.0

func (q *Queries) ClaimSystemConversationCheckpoint(ctx context.Context, arg ClaimSystemConversationCheckpointParams) (int64, error)

Clears only the checkpoint bound to the run the caller has already CASed. A replay or a reply to an older checkpoint affects no rows.

func (*Queries) CleanupAbandonedProvisionalConnections added in v0.4.0

func (q *Queries) CleanupAbandonedProvisionalConnections(ctx context.Context) error

func (*Queries) CleanupAbandonedProvisionalMCPServers added in v0.4.0

func (q *Queries) CleanupAbandonedProvisionalMCPServers(ctx context.Context) error

func (*Queries) CleanupExpiredAuthzCodes added in v0.4.0

func (q *Queries) CleanupExpiredAuthzCodes(ctx context.Context) (int64, error)

Hard delete expired rows. Called from InboundOAuthGC every 5 min.

func (*Queries) CleanupExpiredGrants added in v0.4.0

func (q *Queries) CleanupExpiredGrants(ctx context.Context) (int64, error)

GC: drop expired-or-revoked rows older than 1 year. Keeps audit trail for the typical compliance window.

func (*Queries) CleanupExpiredMCPActiveRequests added in v0.4.0

func (q *Queries) CleanupExpiredMCPActiveRequests(ctx context.Context) (int64, error)

func (*Queries) CleanupExpiredOAuthConsentTransactions added in v0.4.0

func (q *Queries) CleanupExpiredOAuthConsentTransactions(ctx context.Context) (int64, error)

func (*Queries) CleanupExpiredOAuthStates

func (q *Queries) CleanupExpiredOAuthStates(ctx context.Context) error

func (*Queries) CleanupExpiredRefreshTokens added in v0.4.0

func (q *Queries) CleanupExpiredRefreshTokens(ctx context.Context) (int64, error)

GC: drop expired tokens (passed their 30d hard limit) AND consumed tokens older than 7d. The 7d retention on consumed tokens preserves reuse-detection history; longer than that is forensic theater.

func (*Queries) CleanupExpiredUserSessions added in v0.4.0

func (q *Queries) CleanupExpiredUserSessions(ctx context.Context) (int64, error)

func (*Queries) CleanupInactiveOAuthClients added in v0.4.0

func (q *Queries) CleanupInactiveOAuthClients(ctx context.Context) (int64, error)

Never-used DCR registrations have a 24-hour lifetime. Used clients become eligible after 180 days without a successful token exchange. Active grants, codes, consent transactions, and any retained refresh material keep a client alive. SKIP LOCKED divides each bounded sweep safely across replicas.

func (*Queries) CleanupOAuthDCRAttempts added in v0.4.0

func (q *Queries) CleanupOAuthDCRAttempts(ctx context.Context) (int64, error)

func (*Queries) ClearActivationCode

func (q *Queries) ClearActivationCode(ctx context.Context) error

func (*Queries) ClearAgentBuildIntegrationToken added in v0.4.0

func (q *Queries) ClearAgentBuildIntegrationToken(ctx context.Context, id pgtype.UUID) error

func (*Queries) ClearAgentBuildModel added in v0.4.0

func (q *Queries) ClearAgentBuildModel(ctx context.Context, arg ClearAgentBuildModelParams) (int64, error)

Reset each capability override matching (provider, model) back to inherit (NULL provider + ” model → falls back to the workspace default). One statement per capability column keeps the named params unambiguous for the query generator; the revoke path runs all eight.

func (*Queries) ClearAgentEmbeddingModel added in v0.4.0

func (q *Queries) ClearAgentEmbeddingModel(ctx context.Context, arg ClearAgentEmbeddingModelParams) (int64, error)

func (*Queries) ClearAgentEnvVarValue added in v0.2.12

func (q *Queries) ClearAgentEnvVarValue(ctx context.Context, arg ClearAgentEnvVarValueParams) error

func (*Queries) ClearAgentExecModel added in v0.4.0

func (q *Queries) ClearAgentExecModel(ctx context.Context, arg ClearAgentExecModelParams) (int64, error)

func (*Queries) ClearAgentImageGenModel added in v0.4.0

func (q *Queries) ClearAgentImageGenModel(ctx context.Context, arg ClearAgentImageGenModelParams) (int64, error)

func (*Queries) ClearAgentModelSlotsForModel added in v0.4.0

func (q *Queries) ClearAgentModelSlotsForModel(ctx context.Context, arg ClearAgentModelSlotsForModelParams) (int64, error)

Reset declared model-slot assignments matching (provider, model) to inherit.

func (*Queries) ClearAgentSearchModel added in v0.4.0

func (q *Queries) ClearAgentSearchModel(ctx context.Context, arg ClearAgentSearchModelParams) (int64, error)

func (*Queries) ClearAgentSttModel added in v0.4.0

func (q *Queries) ClearAgentSttModel(ctx context.Context, arg ClearAgentSttModelParams) (int64, error)

func (*Queries) ClearAgentTtsModel added in v0.4.0

func (q *Queries) ClearAgentTtsModel(ctx context.Context, arg ClearAgentTtsModelParams) (int64, error)

func (*Queries) ClearAgentVisionModel added in v0.4.0

func (q *Queries) ClearAgentVisionModel(ctx context.Context, arg ClearAgentVisionModelParams) (int64, error)

func (*Queries) ClearAuthFailures

func (q *Queries) ClearAuthFailures(ctx context.Context, arg ClearAuthFailuresParams) error

func (*Queries) ClearAuthFailuresByEmail

func (q *Queries) ClearAuthFailuresByEmail(ctx context.Context, email string) (int64, error)

Used by the `airlock auth unlock <email>` CLI when no --ip is passed.

func (*Queries) ClearAuthLockout

func (q *Queries) ClearAuthLockout(ctx context.Context, arg ClearAuthLockoutParams) error

func (*Queries) ClearAuthLockoutsByEmail

func (q *Queries) ClearAuthLockoutsByEmail(ctx context.Context, email string) (int64, error)

Used by the `airlock auth unlock <email>` CLI when no --ip is passed.

func (*Queries) ClearConnectionCredentialsByID added in v0.4.0

func (q *Queries) ClearConnectionCredentialsByID(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) ClearExecEndpointHostKeyByID added in v0.4.0

func (q *Queries) ClearExecEndpointHostKeyByID(ctx context.Context, id pgtype.UUID) error

Operator "unpin & re-TOFU" — typically used after a known-good rotation on the target box. Next successful connect pins the new host key.

func (*Queries) ClearMCPServerCredentialsByID added in v0.4.0

func (q *Queries) ClearMCPServerCredentialsByID(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) ClearMCPServerOAuthAppByID added in v0.4.0

func (q *Queries) ClearMCPServerOAuthAppByID(ctx context.Context, id pgtype.UUID) error

Wipe the OAuth app config (client_id/secret) AND the access_token_ref that belong to it. Existing tokens MUST go too — they're tied to the old client_id at the OAuth provider and would 401 the moment they're used.

func (*Queries) ClearMustChangePassword added in v0.4.0

func (q *Queries) ClearMustChangePassword(ctx context.Context, id pgtype.UUID) error

Clears the forced-secure flag. Registering a passkey satisfies the "secure your account" requirement just as changing the password does.

func (*Queries) ClearPendingConnectionOAuthApp added in v0.4.0

func (q *Queries) ClearPendingConnectionOAuthApp(ctx context.Context, arg ClearPendingConnectionOAuthAppParams) (int64, error)

func (*Queries) ClearPendingMCPServerOAuthApp added in v0.4.0

func (q *Queries) ClearPendingMCPServerOAuthApp(ctx context.Context, arg ClearPendingMCPServerOAuthAppParams) (int64, error)

func (*Queries) ClearSystemConversationCheckpoint added in v0.4.0

func (q *Queries) ClearSystemConversationCheckpoint(ctx context.Context, id pgtype.UUID) error

func (*Queries) ClearUserPasswordAndRevokeSessions added in v0.4.0

func (q *Queries) ClearUserPasswordAndRevokeSessions(ctx context.Context, arg ClearUserPasswordAndRevokeSessionsParams) (int64, error)

Remove the password credential (passkey-only). Guarded by the last-credential check in service/passkeys.

func (*Queries) CompactOldRuns

func (q *Queries) CompactOldRuns(ctx context.Context, cutoff pgtype.Timestamptz) (int64, error)

Nullify verbose fields on completed runs older than the cutoff. Aggregates (token counts, cost, duration, timestamps, status, error) are preserved.

func (*Queries) CompleteScheduledFire added in v0.4.0

func (q *Queries) CompleteScheduledFire(ctx context.Context, arg CompleteScheduledFireParams) (int64, error)

func (*Queries) ConfigureExecEndpointSSHByID added in v0.4.0

func (q *Queries) ConfigureExecEndpointSSHByID(ctx context.Context, arg ConfigureExecEndpointSSHByIDParams) error

Operator sets transport=ssh and the connection target. Does NOT touch keypair or host_key — those are owned by the keypair / TOFU flows.

func (*Queries) ConnectAgentGit added in v0.4.0

func (q *Queries) ConnectAgentGit(ctx context.Context, arg ConnectAgentGitParams) error

func (*Queries) ConsumeApprovedDeviceLogin added in v0.4.0

func (q *Queries) ConsumeApprovedDeviceLogin(ctx context.Context, id pgtype.UUID) (DeviceLoginSession, error)

func (*Queries) ConsumeAuthzCode added in v0.4.0

func (q *Queries) ConsumeAuthzCode(ctx context.Context, code string) (OauthAuthzCode, error)

Single-use code exchange. The /token handler calls this inside a transaction; the DELETE ... RETURNING idiom guarantees the row (a) actually existed, (b) hadn't already been consumed (the row is gone after consumption, so a second attempt sees zero rows), (c) has the requested code-with-PK row locked-and-removed atomically. No SELECT FOR UPDATE needed — DELETE takes a row lock by itself, and concurrent attempts on the same code see zero rows because the first DELETE already removed it.

func (*Queries) ConsumeCeremony added in v0.4.0

func (q *Queries) ConsumeCeremony(ctx context.Context, id pgtype.UUID) (WebauthnCeremony, error)

func (*Queries) ConsumeIdentityLinkChallenge added in v0.4.0

func (q *Queries) ConsumeIdentityLinkChallenge(ctx context.Context, arg ConsumeIdentityLinkChallengeParams) (IdentityLinkChallenge, error)

func (*Queries) ConsumeMCPActiveRequest added in v0.4.0

func (q *Queries) ConsumeMCPActiveRequest(ctx context.Context, arg ConsumeMCPActiveRequestParams) (pgtype.UUID, error)

DELETE ... RETURNING makes notification handling single-use across replicas. run_id is NULL when cancellation wins before dispatch binds the reservation.

func (*Queries) ConsumeOAuthConsentTransaction added in v0.4.0

func (q *Queries) ConsumeOAuthConsentTransaction(ctx context.Context, arg ConsumeOAuthConsentTransactionParams) (OauthConsentTransaction, error)

Approve and deny both call this inside their response transaction. Deleting by transaction ID and signed-token hash gives every consent screen one successful decision across all replicas.

func (*Queries) ConsumeRelayCode added in v0.4.0

func (q *Queries) ConsumeRelayCode(ctx context.Context, codeHash []byte) (ConsumeRelayCodeRow, error)

func (*Queries) ConversationHasToolCall added in v0.4.0

func (q *Queries) ConversationHasToolCall(ctx context.Context, arg ConversationHasToolCallParams) (bool, error)

True if any assistant message in the conversation already carries a tool-call part with this id. SessionAppend uses it to tell a genuinely dangling tool-result (originating assistant turn never persisted) from the normal case where the call landed in a prior committed batch (e.g. the permission/question resume path) — only the former gets a synthetic assistant tool-call written ahead of it.

func (*Queries) CountAgentsUsingModel added in v0.4.0

func (q *Queries) CountAgentsUsingModel(ctx context.Context, arg CountAgentsUsingModelParams) (int64, error)

Number of agents that have (provider, model) configured as a capability override or a declared model-slot assignment. Drives the disable confirmation ("N agents will be reset to the default").

func (*Queries) CountCredentialsByUserID added in v0.4.0

func (q *Queries) CountCredentialsByUserID(ctx context.Context, userID pgtype.UUID) (int64, error)

func (*Queries) CountMatchingModelGrants added in v0.4.0

func (q *Queries) CountMatchingModelGrants(ctx context.Context, arg CountMatchingModelGrantsParams) (int64, error)

For the entitlement check: does any grant for this (provider, model) target a principal in the caller's grantee set?

func (*Queries) CountRecentFailures

func (q *Queries) CountRecentFailures(ctx context.Context, arg CountRecentFailuresParams) (int32, error)

Counts failures for (email, ip) within the policy's sliding window. The window length is passed in minutes from the caller so the policy lives in Go, not duplicated in SQL.

func (*Queries) CountRunsByAgent

func (q *Queries) CountRunsByAgent(ctx context.Context, agentID pgtype.UUID) (int64, error)

func (*Queries) CountTenantAdmins added in v0.4.0

func (q *Queries) CountTenantAdmins(ctx context.Context) (int64, error)

func (*Queries) CreateA2AConversation added in v0.4.0

func (q *Queries) CreateA2AConversation(ctx context.Context, arg CreateA2AConversationParams) (AgentConversation, error)

A2A: each new context (caller passed no contextId) is its own conversation on the *called* agent, owned by the original user (user_id may be NULL for anonymous external-MCP callers). source is always 'a2a' so the partial DM index never collapses these. Plain INSERT — no upsert, every call without a contextId is a fresh thread.

func (*Queries) CreateAgent

func (q *Queries) CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent, error)

Initial-row INSERT. All "starts empty" string fields are passed explicitly as ” rather than relying on column defaults (per AGENTS.md "no fake defaults" rule). Status starts 'draft', upgrade_status 'idle', auto_fix true, instructions empty array. The agent's id is derived from a freshly-seeded principal (one statement, one tx), so every agent is guaranteed a matching principals row of kind 'agent' — the FK on agents.id fails loud otherwise.

func (*Queries) CreateAgentBuild

func (q *Queries) CreateAgentBuild(ctx context.Context, arg CreateAgentBuildParams) (AgentBuild, error)

Initial-row INSERT. Status starts 'building'; output fields start empty and are filled by UpdateAgentBuildComplete / UpdateAgentBuildLogs. LLM telemetry starts at 0 (no codegen spend yet) — set explicitly per the "no fake defaults" rule, mirroring CreateRun; UpdateBuildLLMStats fills it from the llm_usage ledger when codegen finishes.

func (*Queries) CreateAuthzCode added in v0.4.0

func (q *Queries) CreateAuthzCode(ctx context.Context, arg CreateAuthzCodeParams) error

func (*Queries) CreateBridge

func (q *Queries) CreateBridge(ctx context.Context, arg CreateBridgeParams) (Bridge, error)

func (*Queries) CreateCeremony added in v0.4.0

func (q *Queries) CreateCeremony(ctx context.Context, arg CreateCeremonyParams) (pgtype.UUID, error)

func (*Queries) CreateConnection added in v0.4.0

func (q *Queries) CreateConnection(ctx context.Context, arg CreateConnectionParams) (Connection, error)

func (*Queries) CreateCredential added in v0.4.0

func (q *Queries) CreateCredential(ctx context.Context, arg CreateCredentialParams) (WebauthnCredential, error)

func (*Queries) CreateDeviceLoginSession added in v0.4.0

func (q *Queries) CreateDeviceLoginSession(ctx context.Context, arg CreateDeviceLoginSessionParams) (DeviceLoginSession, error)

func (*Queries) CreateExecEndpoint added in v0.4.0

func (q *Queries) CreateExecEndpoint(ctx context.Context, arg CreateExecEndpointParams) (AgentExecEndpoint, error)

func (*Queries) CreateGitCredential added in v0.4.0

func (q *Queries) CreateGitCredential(ctx context.Context, arg CreateGitCredentialParams) (GitCredential, error)

id is caller-supplied (uuid.New) so token_ref ciphertext can be bound to it via AAD before INSERT — same shape as CreateProvider.

func (*Queries) CreateIdentityLinkChallenge added in v0.4.0

func (q *Queries) CreateIdentityLinkChallenge(ctx context.Context, arg CreateIdentityLinkChallengeParams) (IdentityLinkChallenge, error)

func (*Queries) CreateMCPA2AConversation added in v0.4.0

func (q *Queries) CreateMCPA2AConversation(ctx context.Context, arg CreateMCPA2AConversationParams) (AgentConversation, error)

MCP continuations carry a server-generated principal binding in metadata. Callers cannot choose this value; subsequent context/task access must match it.

func (*Queries) CreateMCPServer added in v0.4.0

func (q *Queries) CreateMCPServer(ctx context.Context, arg CreateMCPServerParams) (AgentMcpServer, error)

func (*Queries) CreateManagedBotSession added in v0.4.0

func (q *Queries) CreateManagedBotSession(ctx context.Context, arg CreateManagedBotSessionParams) (ManagedBotSession, error)

managed_bot_sessions: per-create-flow correlation rows tying an airlock "Create new Telegram bot" click to the eventual ManagedBotCreated callback the manager bot receives.

func (*Queries) CreateMessage

func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (AgentMessage, error)

file_keys starts as an empty text[]; the chat upload path that needs attached file keys uses a separate UPDATE (or could be added explicitly via a follow-up insert path).

func (*Queries) CreateModelGrant added in v0.4.0

func (q *Queries) CreateModelGrant(ctx context.Context, arg CreateModelGrantParams) (ModelGrant, error)

Model entitlements: which (provider, model) a principal/group may be assigned. Deny-by-default — a model is allowed only if it is a system default or a grant matches the assigner's grantee set.

func (*Queries) CreateOAuthClient added in v0.4.0

func (q *Queries) CreateOAuthClient(ctx context.Context, arg CreateOAuthClientParams) (OauthClient, error)

func (*Queries) CreateOAuthConsentTransaction added in v0.4.0

func (q *Queries) CreateOAuthConsentTransaction(ctx context.Context, arg CreateOAuthConsentTransactionParams) error

func (*Queries) CreateOAuthState

func (q *Queries) CreateOAuthState(ctx context.Context, arg CreateOAuthStateParams) error

func (*Queries) CreatePlatformIdentity

func (q *Queries) CreatePlatformIdentity(ctx context.Context, arg CreatePlatformIdentityParams) (PlatformIdentity, error)

func (*Queries) CreatePlatformIdentityIfUnlinked added in v0.4.0

func (q *Queries) CreatePlatformIdentityIfUnlinked(ctx context.Context, arg CreatePlatformIdentityIfUnlinkedParams) (int64, error)

func (*Queries) CreateProvider

func (q *Queries) CreateProvider(ctx context.Context, arg CreateProviderParams) (Provider, error)

id is supplied by the caller (uuid.New) so the encryption ref path can be computed before the INSERT — every providers row's api_key ciphertext is bound to its own UUID via AAD.

func (*Queries) CreateProviderModel added in v0.4.1

func (q *Queries) CreateProviderModel(ctx context.Context, arg CreateProviderModelParams) (ProviderModel, error)

func (*Queries) CreateRefreshToken added in v0.4.0

func (q *Queries) CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) error

func (*Queries) CreateRelayCode added in v0.4.0

func (q *Queries) CreateRelayCode(ctx context.Context, arg CreateRelayCodeParams) error

func (*Queries) CreateRun

func (q *Queries) CreateRun(ctx context.Context, arg CreateRunParams) (Run, error)

All "starts at zero/empty" run fields passed explicitly per AGENTS.md "no fake defaults" rule. Counter fields start at 0 (no LLM calls / tokens / cost yet); buffered text fields start ”; actions starts []. parent_run_id is NULL for top-level (web/bridge/cron/webhook) runs and the caller's run id for A2A child runs.

func (*Queries) CreateSystemConversation added in v0.4.0

func (q *Queries) CreateSystemConversation(ctx context.Context, arg CreateSystemConversationParams) (SystemConversation, error)

system_agent: per-user chat conversations + messages + lightweight runs + audit log for the in-airlock system agent. Schema lives in migrations/002_a2a.sql.

func (*Queries) CreateSystemRun added in v0.4.0

func (q *Queries) CreateSystemRun(ctx context.Context, arg CreateSystemRunParams) (SystemRun, error)

Inserts a fresh run row at the start of a turn. The id becomes the run_id every WS event carries so the frontend can group text_delta/tool_call/tool_result events under one bubble — same contract as agent chat's runs.id.

func (*Queries) CreateTenant

func (q *Queries) CreateTenant(ctx context.Context, arg CreateTenantParams) (Tenant, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

Seed the principal supertype row and the user subtype atomically (one statement, one tx); the id is derived from the new principal so every user is guaranteed a matching principals row — the FK fails loud otherwise.

func (*Queries) CreateUserSession added in v0.4.0

func (q *Queries) CreateUserSession(ctx context.Context, arg CreateUserSessionParams) (UserSession, error)

func (*Queries) CreateWebConversation added in v0.4.0

func (q *Queries) CreateWebConversation(ctx context.Context, arg CreateWebConversationParams) (AgentConversation, error)

Web is multi-conversation: every call is a fresh thread owned by the user. Plain INSERT, no upsert — the row UUID is the identity and the client addresses one by id on each prompt.

func (*Queries) DeleteAgent

func (q *Queries) DeleteAgent(ctx context.Context, id pgtype.UUID) error

Delete through the principal: ON DELETE CASCADE removes the agents row and, via the agent's own FKs, all of its agent-scoped rows.

func (*Queries) DeleteAgentEnvVar added in v0.2.12

func (q *Queries) DeleteAgentEnvVar(ctx context.Context, arg DeleteAgentEnvVarParams) error

Removes the slot entirely. Used when the operator deletes a stale registration that the agent no longer declares.

func (*Queries) DeleteAgentGrant added in v0.4.0

func (q *Queries) DeleteAgentGrant(ctx context.Context, arg DeleteAgentGrantParams) error

func (*Queries) DeleteBridge

func (q *Queries) DeleteBridge(ctx context.Context, id pgtype.UUID) error

func (*Queries) DeleteConnectionByID added in v0.4.0

func (q *Queries) DeleteConnectionByID(ctx context.Context, id pgtype.UUID) (int64, error)

Grants cascade with a deleted resource and bindings become unbound through ON DELETE SET NULL.

func (*Queries) DeleteConversation

func (q *Queries) DeleteConversation(ctx context.Context, id pgtype.UUID) error

func (*Queries) DeleteCredential added in v0.4.0

func (q *Queries) DeleteCredential(ctx context.Context, arg DeleteCredentialParams) error

func (*Queries) DeleteDirectoriesByAgentExcept added in v0.2.0

func (q *Queries) DeleteDirectoriesByAgentExcept(ctx context.Context, arg DeleteDirectoriesByAgentExceptParams) error

func (*Queries) DeleteExecEndpointByID added in v0.4.0

func (q *Queries) DeleteExecEndpointByID(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) DeleteExpiredAnonA2AConversations added in v0.4.0

func (q *Queries) DeleteExpiredAnonA2AConversations(ctx context.Context, ttlSeconds int32) (int64, error)

Sweeper: anonymous A2A conversations (no owning user, minted for unauthenticated external-MCP callers) have no UI to resume them and would otherwise grow unbounded. Drop any idle past the TTL; the row delete cascades to agent_messages via FK. (user_id IS NULL AND source='a2a') is the precise anon-A2A key — authed A2A convs and bridge convs are untouched.

func (*Queries) DeleteExpiredCeremonies added in v0.4.0

func (q *Queries) DeleteExpiredCeremonies(ctx context.Context) error

func (*Queries) DeleteExpiredDeviceLoginSessions added in v0.4.0

func (q *Queries) DeleteExpiredDeviceLoginSessions(ctx context.Context) (int64, error)

func (*Queries) DeleteGitCredential added in v0.4.0

func (q *Queries) DeleteGitCredential(ctx context.Context, arg DeleteGitCredentialParams) error

Owner-scoped: a user can only delete their own credentials.

func (*Queries) DeleteMCPActiveRequest added in v0.4.0

func (q *Queries) DeleteMCPActiveRequest(ctx context.Context, arg DeleteMCPActiveRequestParams) error

Include run_id so an old request's completion cannot remove a replacement.

func (*Queries) DeleteMCPServerByID added in v0.4.0

func (q *Queries) DeleteMCPServerByID(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) DeleteManagedBotSessionByNonce added in v0.4.0

func (q *Queries) DeleteManagedBotSessionByNonce(ctx context.Context, nonce string) error

func (*Queries) DeleteMessagesByConversation

func (q *Queries) DeleteMessagesByConversation(ctx context.Context, conversationID pgtype.UUID) error

func (*Queries) DeleteOAuthConsentTransactionsForGrant added in v0.4.0

func (q *Queries) DeleteOAuthConsentTransactionsForGrant(ctx context.Context, arg DeleteOAuthConsentTransactionsForGrantParams) (int64, error)

Revocation invalidates consent screens issued before it commits, preventing a pending request from recreating the revoked grant.

func (*Queries) DeleteOAuthState

func (q *Queries) DeleteOAuthState(ctx context.Context, state string) (int64, error)

func (*Queries) DeletePlatformIdentityAny added in v0.4.0

func (q *Queries) DeletePlatformIdentityAny(ctx context.Context, id pgtype.UUID) error

Admin variant: delete any platform identity by id, without the caller's user_id constraint. Gated behind TenantIdentityManageAll.

func (*Queries) DeleteProvider

func (q *Queries) DeleteProvider(ctx context.Context, id pgtype.UUID) error

func (*Queries) DeleteProviderModels added in v0.4.1

func (q *Queries) DeleteProviderModels(ctx context.Context, configuredProviderID pgtype.UUID) error

func (*Queries) DeleteProvisionalConnection added in v0.4.0

func (q *Queries) DeleteProvisionalConnection(ctx context.Context, arg DeleteProvisionalConnectionParams) (int64, error)

func (*Queries) DeleteProvisionalMCPServer added in v0.4.0

func (q *Queries) DeleteProvisionalMCPServer(ctx context.Context, arg DeleteProvisionalMCPServerParams) (int64, error)

func (*Queries) DeleteResourceNeedsByAgentTypeExcept added in v0.4.0

func (q *Queries) DeleteResourceNeedsByAgentTypeExcept(ctx context.Context, arg DeleteResourceNeedsByAgentTypeExceptParams) error

func (*Queries) DeleteRoutesByAgentExcept

func (q *Queries) DeleteRoutesByAgentExcept(ctx context.Context, arg DeleteRoutesByAgentExceptParams) error

func (*Queries) DeleteScheduleHandlersByAgentExcept added in v0.4.0

func (q *Queries) DeleteScheduleHandlersByAgentExcept(ctx context.Context, arg DeleteScheduleHandlersByAgentExceptParams) error

func (*Queries) DeleteStaleAgentModelSlots

func (q *Queries) DeleteStaleAgentModelSlots(ctx context.Context, arg DeleteStaleAgentModelSlotsParams) error

func (*Queries) DeleteStaleAgentTools

func (q *Queries) DeleteStaleAgentTools(ctx context.Context, arg DeleteStaleAgentToolsParams) error

func (*Queries) DeleteSystemConversation added in v0.4.0

func (q *Queries) DeleteSystemConversation(ctx context.Context, arg DeleteSystemConversationParams) error

func (*Queries) DeleteTopicsByAgentExcept

func (q *Queries) DeleteTopicsByAgentExcept(ctx context.Context, arg DeleteTopicsByAgentExceptParams) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id pgtype.UUID) error

Delete through the principal: ON DELETE CASCADE removes the users row plus any grants/memberships keyed on this principal.

func (*Queries) DeleteWebhooksByAgentExcept

func (q *Queries) DeleteWebhooksByAgentExcept(ctx context.Context, arg DeleteWebhooksByAgentExceptParams) error

func (*Queries) DenyDeviceLogin added in v0.4.0

func (q *Queries) DenyDeviceLogin(ctx context.Context, userCodeHash string) (DeviceLoginSession, error)

func (*Queries) DisconnectAgentGit added in v0.4.0

func (q *Queries) DisconnectAgentGit(ctx context.Context, id pgtype.UUID) error

Empty strings + NULL credential signal "internal-only" mode again. git_last_synced_ref is also cleared so a future reconnect starts fresh rather than comparing against a stale remote tip.

func (*Queries) EnsureSystemConversationForBridge added in v0.4.0

func (q *Queries) EnsureSystemConversationForBridge(ctx context.Context, arg EnsureSystemConversationForBridgeParams) (SystemConversation, error)

Upsert one sticky thread per (user, bridge) on the partial unique index (user_id, bridge_id) WHERE bridge_id IS NOT NULL — every system bridge funnels that user's inbound DMs into the same row. The first INSERT for a pair returns the new row; subsequent calls hit the conflict and return the existing one, refreshing external_id (the platform chat id) so a server-initiated follow-up — e.g. a build / upgrade completion auto-resume, which has no live inbound update to read the chat id from — can deliver back to the right chat.

func (*Queries) FailExpiredScheduledFires added in v0.4.0

func (q *Queries) FailExpiredScheduledFires(ctx context.Context) (int64, error)

func (*Queries) FailInitialAgentBuild added in v0.4.0

func (q *Queries) FailInitialAgentBuild(ctx context.Context, arg FailInitialAgentBuildParams) (int64, error)

func (*Queries) FailScheduledFire added in v0.4.0

func (q *Queries) FailScheduledFire(ctx context.Context, arg FailScheduledFireParams) (int64, error)

func (*Queries) FinalizeAgentDeployment added in v0.4.0

func (q *Queries) FinalizeAgentDeployment(ctx context.Context, arg FinalizeAgentDeploymentParams) (int64, error)

func (*Queries) GetActiveGrant added in v0.4.0

func (q *Queries) GetActiveGrant(ctx context.Context, arg GetActiveGrantParams) (OauthGrant, error)

Looks up an active (non-revoked, non-expired) grant. /authorize uses this to decide whether to skip the consent screen.

func (*Queries) GetActiveLockout

func (q *Queries) GetActiveLockout(ctx context.Context, arg GetActiveLockoutParams) (GetActiveLockoutRow, error)

Returns the lockout row only if it is currently in effect (locked_until in the future). Caller treats "no rows" as "not locked".

func (*Queries) GetActiveUserSessionByRefreshHash added in v0.4.0

func (q *Queries) GetActiveUserSessionByRefreshHash(ctx context.Context, refreshTokenHash []byte) (UserSession, error)

func (*Queries) GetActiveUserSessionByRefreshHashForUpdate added in v0.4.0

func (q *Queries) GetActiveUserSessionByRefreshHashForUpdate(ctx context.Context, refreshTokenHash []byte) (UserSession, error)

func (*Queries) GetAgentBuild

func (q *Queries) GetAgentBuild(ctx context.Context, id pgtype.UUID) (AgentBuild, error)

func (*Queries) GetAgentBuildByIntegrationToken added in v0.4.0

func (q *Queries) GetAgentBuildByIntegrationToken(ctx context.Context, integrationTokenHash []byte) (GetAgentBuildByIntegrationTokenRow, error)

func (*Queries) GetAgentByID

func (q *Queries) GetAgentByID(ctx context.Context, id pgtype.UUID) (Agent, error)

func (*Queries) GetAgentByIDForUpdate added in v0.4.0

func (q *Queries) GetAgentByIDForUpdate(ctx context.Context, id pgtype.UUID) (Agent, error)

func (*Queries) GetAgentBySlug

func (q *Queries) GetAgentBySlug(ctx context.Context, slug string) (Agent, error)

func (*Queries) GetAgentEnvVarBySlug added in v0.2.12

func (q *Queries) GetAgentEnvVarBySlug(ctx context.Context, arg GetAgentEnvVarBySlugParams) (AgentEnvVar, error)

func (*Queries) GetAgentForUpgrade

func (q *Queries) GetAgentForUpgrade(ctx context.Context, id pgtype.UUID) (GetAgentForUpgradeRow, error)

func (*Queries) GetAgentGitConfig added in v0.4.0

func (q *Queries) GetAgentGitConfig(ctx context.Context, id pgtype.UUID) (GetAgentGitConfigRow, error)

Joined with git_credentials so the UI can show the credential's name without a second round-trip. Returns empty/NULL values when no remote is configured.

func (*Queries) GetAgentGrant added in v0.4.0

func (q *Queries) GetAgentGrant(ctx context.Context, arg GetAgentGrantParams) (AgentGrant, error)

func (*Queries) GetAgentModelSlot

func (q *Queries) GetAgentModelSlot(ctx context.Context, arg GetAgentModelSlotParams) (AgentModelSlot, error)

func (*Queries) GetAgentTokenAuth added in v0.4.0

func (q *Queries) GetAgentTokenAuth(ctx context.Context, id pgtype.UUID) (GetAgentTokenAuthRow, error)

func (*Queries) GetBridgeByAgentID

func (q *Queries) GetBridgeByAgentID(ctx context.Context, agentID pgtype.UUID) (Bridge, error)

Find the bridge bound to a specific agent

func (*Queries) GetBridgeByID

func (q *Queries) GetBridgeByID(ctx context.Context, id pgtype.UUID) (Bridge, error)

func (*Queries) GetBridgeByTelegramBotUserID added in v0.4.0

func (q *Queries) GetBridgeByTelegramBotUserID(ctx context.Context, telegramBotUserID pgtype.Int8) (Bridge, error)

Lookup a Telegram bridge by the bot's stable Telegram user_id. The manager-bot poller uses this for idempotency: a duplicate ManagedBotCreated for the same bot.id (paranoid backstop) no-ops instead of inserting a second row.

func (*Queries) GetCachedAttachmentURL

func (q *Queries) GetCachedAttachmentURL(ctx context.Context, arg GetCachedAttachmentURLParams) (GetCachedAttachmentURLRow, error)

Returns the cached presigned URL only if it has at least @min_remaining left before expiry. Caller treats "no rows" as cache miss → mint fresh.

func (*Queries) GetConnectionByID added in v0.4.0

func (q *Queries) GetConnectionByID(ctx context.Context, id pgtype.UUID) (Connection, error)

func (*Queries) GetConnectionByIDForUpdate added in v0.4.0

func (q *Queries) GetConnectionByIDForUpdate(ctx context.Context, id pgtype.UUID) (Connection, error)

The credential proxy and the operator credential ops key reads + write-backs on the resource id (one connection backs many agents' bindings), so the consuming agent is not a stable handle for the row. Callers resolve the binding to an id (ResolveBoundConnection / a freshly upserted row) first.

func (*Queries) GetConnectionOwner added in v0.4.0

func (q *Queries) GetConnectionOwner(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)

Resource owner lookups for the capability check (owner holds all caps).

func (*Queries) GetConversationByID

func (q *Queries) GetConversationByID(ctx context.Context, id pgtype.UUID) (AgentConversation, error)

func (*Queries) GetConversationByIDAndAgent added in v0.4.0

func (q *Queries) GetConversationByIDAndAgent(ctx context.Context, arg GetConversationByIDAndAgentParams) (AgentConversation, error)

func (*Queries) GetConversationByIDAndAgentForUpdate added in v0.4.0

func (q *Queries) GetConversationByIDAndAgentForUpdate(ctx context.Context, arg GetConversationByIDAndAgentForUpdateParams) (AgentConversation, error)

Session writes lock the parent row before inspecting context state. Child inserts take a foreign-key key-share lock, so this also orders every message insert against checkpoint advancement across replicas.

func (*Queries) GetConversationBySource

func (q *Queries) GetConversationBySource(ctx context.Context, arg GetConversationBySourceParams) (AgentConversation, error)

Non-creating lookup used by the bridge manager when it needs to read per-chat settings before any new conversation row would be created.

func (*Queries) GetConversationIDByRun

func (q *Queries) GetConversationIDByRun(ctx context.Context, runID pgtype.UUID) (pgtype.UUID, error)

Resolves the conversation a run is attached to via any message's run_id. Cron- or webhook-triggered runs that never wrote a message return no rows.

func (*Queries) GetDescendantRuns added in v0.4.0

func (q *Queries) GetDescendantRuns(ctx context.Context, rootRunID pgtype.UUID) ([]GetDescendantRunsRow, error)

Recursive descent through parent_run_id for cancel cascade. Returns every run reachable from @root_run_id via parent_run_id (excluding the root itself). Order is unspecified; callers fire cancel funcs independently per row.

func (*Queries) GetDeviceLoginByUserCodeHash added in v0.4.0

func (q *Queries) GetDeviceLoginByUserCodeHash(ctx context.Context, userCodeHash string) (DeviceLoginSession, error)

func (*Queries) GetDeviceLoginForPoll added in v0.4.0

func (q *Queries) GetDeviceLoginForPoll(ctx context.Context, deviceCodeHash string) (DeviceLoginSession, error)

func (*Queries) GetDirectoryByPath added in v0.2.0

func (q *Queries) GetDirectoryByPath(ctx context.Context, arg GetDirectoryByPathParams) (AgentDirectory, error)

Longest-prefix match for nested registrations. Returns the most-specific directory matching the requested path on an exact segment boundary.

func (*Queries) GetExecEndpointByID added in v0.4.0

func (q *Queries) GetExecEndpointByID(ctx context.Context, id pgtype.UUID) (AgentExecEndpoint, error)

func (*Queries) GetExecEndpointByIDForUpdate added in v0.4.0

func (q *Queries) GetExecEndpointByIDForUpdate(ctx context.Context, id pgtype.UUID) (AgentExecEndpoint, error)

func (*Queries) GetExecEndpointOwner added in v0.4.0

func (q *Queries) GetExecEndpointOwner(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)

func (*Queries) GetGitCredential added in v0.4.0

func (q *Queries) GetGitCredential(ctx context.Context, id pgtype.UUID) (GitCredential, error)

Runtime resolution path: caller fetches the encrypted token_ref to decrypt and use against the remote. NOT scoped by user_id — the caller (e.g. the codegen push) must enforce permission via the owning agent's user_id matching.

func (*Queries) GetGitCredentialOwner added in v0.4.0

func (q *Queries) GetGitCredentialOwner(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)

func (*Queries) GetLatestBuildForAgent added in v0.4.0

func (q *Queries) GetLatestBuildForAgent(ctx context.Context, agentID pgtype.UUID) (AgentBuild, error)

func (*Queries) GetLatestRunningPromptRun added in v0.2.11

func (q *Queries) GetLatestRunningPromptRun(ctx context.Context, triggerRef string) (pgtype.UUID, error)

Finds the most recent running prompt run for a conversation. Used by the /cancel slash command to discover which run to abort. Empty result means nothing's in flight (or it's already finished between the user typing /cancel and us querying).

func (*Queries) GetLatestRunningSystemRun added in v0.4.0

func (q *Queries) GetLatestRunningSystemRun(ctx context.Context, conversationID pgtype.UUID) (pgtype.UUID, error)

/cancel target: the most recent run on this conversation that hasn't terminated yet. Both 'running' and 'suspended' are cancellable — suspended runs that the user cancels via /cancel rather than via the confirmation dialog still need to be torn down.

func (*Queries) GetLatestSuspendedRun

func (q *Queries) GetLatestSuspendedRun(ctx context.Context, agentID pgtype.UUID) (Run, error)

func (*Queries) GetLatestSuspendedRunByConversation added in v0.4.0

func (q *Queries) GetLatestSuspendedRunByConversation(ctx context.Context, conversationID string) (Run, error)

Conversation-scoped suspended-run lookup. trigger_ref holds the conversation id for both web (trigger_type='prompt') and sibling (trigger_type='a2a') runs, and those live on distinct conversation rows — so scoping by trigger_ref keeps a web/bridge resume, the conversation view, and /clear from ever picking up an A2A delegated suspension that belongs to a different surface (the agent-wide GetLatestSuspendedRun cannot distinguish them).

func (*Queries) GetLatestSuspendedSystemRun added in v0.4.0

func (q *Queries) GetLatestSuspendedSystemRun(ctx context.Context, conversationID pgtype.UUID) (pgtype.UUID, error)

/clear target: a suspended run on this conversation belongs to the pending-confirmation UI; once the context is cleared the dialog is meaningless, so we cancel the run alongside the checkpoint advance.

func (*Queries) GetLiveUserForSession added in v0.4.0

func (q *Queries) GetLiveUserForSession(ctx context.Context, arg GetLiveUserForSessionParams) (GetLiveUserForSessionRow, error)

func (*Queries) GetLockoutForUpdate

func (q *Queries) GetLockoutForUpdate(ctx context.Context, arg GetLockoutForUpdateParams) (GetLockoutForUpdateRow, error)

Locks the row for the duration of the surrounding transaction so two concurrent failure paths agree on the next tier. Returns no rows on first-ever lockout for this (email, ip).

func (*Queries) GetMCPActiveRequest added in v0.4.0

func (q *Queries) GetMCPActiveRequest(ctx context.Context, arg GetMCPActiveRequestParams) (pgtype.UUID, error)

The run owner polls this shared row so a notification handled by another replica still reaches the process-local canonical run cancellation hook.

func (*Queries) GetMCPServerByID added in v0.4.0

func (q *Queries) GetMCPServerByID(ctx context.Context, id pgtype.UUID) (AgentMcpServer, error)

func (*Queries) GetMCPServerByIDForUpdate added in v0.4.0

func (q *Queries) GetMCPServerByIDForUpdate(ctx context.Context, id pgtype.UUID) (AgentMcpServer, error)

id-keyed credential proxy + operator ops (one server backs many bindings).

func (*Queries) GetMCPServerOwner added in v0.4.0

func (q *Queries) GetMCPServerOwner(ctx context.Context, id pgtype.UUID) (pgtype.UUID, error)

func (*Queries) GetManagedBotSessionByNonce added in v0.4.0

func (q *Queries) GetManagedBotSessionByNonce(ctx context.Context, nonce string) (ManagedBotSession, error)

func (*Queries) GetManagerBridge added in v0.4.0

func (q *Queries) GetManagerBridge(ctx context.Context) (Bridge, error)

The Telegram manager bridge (is_manager). A partial unique index caps it at one across the instance. Includes 'error' status so the deep-link flow and the periodic capability re-check can still find and reconcile it.

func (*Queries) GetModelGrant added in v0.4.0

func (q *Queries) GetModelGrant(ctx context.Context, id pgtype.UUID) (GetModelGrantRow, error)

Resolve a grant id to its (provider, model) so a revoke can find and reset the agent overrides that referenced the now-disallowed model.

func (*Queries) GetOAuthClient added in v0.4.0

func (q *Queries) GetOAuthClient(ctx context.Context, clientID string) (OauthClient, error)

func (*Queries) GetOAuthState

func (q *Queries) GetOAuthState(ctx context.Context, state string) (OauthState, error)

func (*Queries) GetOAuthStateForResource added in v0.4.0

func (q *Queries) GetOAuthStateForResource(ctx context.Context, resourceID pgtype.UUID) (OauthState, error)

func (*Queries) GetOAuthStateForUpdate added in v0.4.0

func (q *Queries) GetOAuthStateForUpdate(ctx context.Context, state string) (OauthState, error)

func (*Queries) GetOrCreateBridgeAuthedConversation added in v0.4.0

func (q *Queries) GetOrCreateBridgeAuthedConversation(ctx context.Context, arg GetOrCreateBridgeAuthedConversationParams) (AgentConversation, error)

Authed bridge: one thread per (agent, user, bridge, external_id) — the same user reaching the same agent through a different bridge is a different conversation, and the same user in a different chat is also a different conversation (external_id covers that axis). Upserts on idx_conversations_bridge_authed; conflict target must match the partial index's keys + predicate so Postgres infers it.

func (*Queries) GetPlatformIdentity

func (q *Queries) GetPlatformIdentity(ctx context.Context, arg GetPlatformIdentityParams) (PlatformIdentity, error)

Look up Airlock user by their platform identity

func (*Queries) GetPlatformIdentityByID added in v0.4.0

func (q *Queries) GetPlatformIdentityByID(ctx context.Context, id pgtype.UUID) (PlatformIdentity, error)

Fetch a single identity by its row id. Used by the Unlink service path to resolve the owner before authz.AuthorizeOwnedResource gates the delete.

func (*Queries) GetProviderByID

func (q *Queries) GetProviderByID(ctx context.Context, id pgtype.UUID) (Provider, error)

func (*Queries) GetProviderByIDForUpdate added in v0.4.1

func (q *Queries) GetProviderByIDForUpdate(ctx context.Context, id pgtype.UUID) (Provider, error)

func (*Queries) GetProviderModel added in v0.4.1

func (q *Queries) GetProviderModel(ctx context.Context, arg GetProviderModelParams) (ProviderModel, error)

func (*Queries) GetProvisionalConnectionForNeedOwner added in v0.4.0

func (q *Queries) GetProvisionalConnectionForNeedOwner(ctx context.Context, arg GetProvisionalConnectionForNeedOwnerParams) (Connection, error)

func (*Queries) GetProvisionalMCPServerForNeedOwner added in v0.4.0

func (q *Queries) GetProvisionalMCPServerForNeedOwner(ctx context.Context, arg GetProvisionalMCPServerForNeedOwnerParams) (AgentMcpServer, error)

func (*Queries) GetRefreshTokenByHash added in v0.4.0

func (q *Queries) GetRefreshTokenByHash(ctx context.Context, tokenHash []byte) (OauthRefreshToken, error)

func (*Queries) GetRefreshTokenByHashForUpdate added in v0.4.0

func (q *Queries) GetRefreshTokenByHashForUpdate(ctx context.Context, tokenHash []byte) (OauthRefreshToken, error)

func (*Queries) GetResourceNeed added in v0.4.0

func (q *Queries) GetResourceNeed(ctx context.Context, arg GetResourceNeedParams) (AgentResourceNeed, error)

func (*Queries) GetResourceNeedForUpdate added in v0.4.0

func (q *Queries) GetResourceNeedForUpdate(ctx context.Context, arg GetResourceNeedForUpdateParams) (AgentResourceNeed, error)

func (*Queries) GetRunByID

func (q *Queries) GetRunByID(ctx context.Context, id pgtype.UUID) (Run, error)

func (*Queries) GetRunByIDAndAgent added in v0.4.0

func (q *Queries) GetRunByIDAndAgent(ctx context.Context, arg GetRunByIDAndAgentParams) (Run, error)

func (*Queries) GetRunCheckpoint

func (q *Queries) GetRunCheckpoint(ctx context.Context, arg GetRunCheckpointParams) ([]byte, error)

func (*Queries) GetScheduleHandler added in v0.4.0

func (q *Queries) GetScheduleHandler(ctx context.Context, arg GetScheduleHandlerParams) (AgentScheduleHandler, error)

func (*Queries) GetScheduledFire added in v0.4.0

func (q *Queries) GetScheduledFire(ctx context.Context, arg GetScheduledFireParams) (AgentScheduledFire, error)

func (*Queries) GetSessionContextRevision added in v0.4.0

func (q *Queries) GetSessionContextRevision(ctx context.Context, id pgtype.UUID) (int64, error)

Opaque SessionStore revision. Including the active checkpoint seq prevents an empty post-clear context from reusing revision zero.

func (*Queries) GetSiblingMaxAccess added in v0.4.0

func (q *Queries) GetSiblingMaxAccess(ctx context.Context, arg GetSiblingMaxAccessParams) (string, error)

The per-edge max_access ceiling for a (parent → sibling) pair, read at A2A call time to admit the call and cap its effective access. No row means the target is not a declared sibling and the call is denied.

func (*Queries) GetSuspendedRunByID

func (q *Queries) GetSuspendedRunByID(ctx context.Context, id pgtype.UUID) (Run, error)

func (*Queries) GetSystemBridge

func (q *Queries) GetSystemBridge(ctx context.Context) (Bridge, error)

The system bridge — there should be at most one

func (*Queries) GetSystemConversationByID added in v0.4.0

func (q *Queries) GetSystemConversationByID(ctx context.Context, id pgtype.UUID) (SystemConversation, error)

func (*Queries) GetSystemConversationByIDForUpdate added in v0.4.0

func (q *Queries) GetSystemConversationByIDForUpdate(ctx context.Context, id pgtype.UUID) (SystemConversation, error)

Serializes checkpoint claims across replicas. The caller keeps the lock through the exact suspended-run CAS and successor insert.

func (*Queries) GetSystemRunByID added in v0.4.0

func (q *Queries) GetSystemRunByID(ctx context.Context, id pgtype.UUID) (SystemRun, error)

func (*Queries) GetSystemSettings

func (q *Queries) GetSystemSettings(ctx context.Context) (SystemSetting, error)

func (*Queries) GetSystemSettingsForActivation added in v0.4.0

func (q *Queries) GetSystemSettingsForActivation(ctx context.Context) (SystemSetting, error)

Serializes first-admin activation across replicas.

func (*Queries) GetTenantByID

func (q *Queries) GetTenantByID(ctx context.Context, id pgtype.UUID) (Tenant, error)

func (*Queries) GetTenantBySlug

func (q *Queries) GetTenantBySlug(ctx context.Context, slug string) (Tenant, error)

func (*Queries) GetTopicBySlug

func (q *Queries) GetTopicBySlug(ctx context.Context, arg GetTopicBySlugParams) (AgentTopic, error)

func (*Queries) GetUserByCredentialID added in v0.4.0

func (q *Queries) GetUserByCredentialID(ctx context.Context, credentialID []byte) (User, error)

Resolve the owning user from a credential id — used by discoverable login to fetch the live user row after the assertion verifies.

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (User, error)

func (*Queries) GetUserByIDForUpdate added in v0.4.0

func (q *Queries) GetUserByIDForUpdate(ctx context.Context, id pgtype.UUID) (User, error)

func (*Queries) GetUserByOIDCSub

func (q *Queries) GetUserByOIDCSub(ctx context.Context, oidcSub string) (User, error)

func (*Queries) GetWebhookByAgentAndPath

func (q *Queries) GetWebhookByAgentAndPath(ctx context.Context, arg GetWebhookByAgentAndPathParams) (AgentWebhook, error)

func (*Queries) HasProviderLiveAssignments added in v0.4.1

func (q *Queries) HasProviderLiveAssignments(ctx context.Context, providerID pgtype.UUID) (bool, error)

func (*Queries) HasUserAgentGrant added in v0.4.0

func (q *Queries) HasUserAgentGrant(ctx context.Context, arg HasUserAgentGrantParams) (bool, error)

func (*Queries) IncrementAgentTokenVersion added in v0.4.0

func (q *Queries) IncrementAgentTokenVersion(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) InsertLLMUsage added in v0.4.0

func (q *Queries) InsertLLMUsage(ctx context.Context, arg InsertLLMUsageParams) error

One append-only row per proxied model HTTP round-trip. Cost is computed at capture from the sol/provider token catalog; non-token units (image/audio/character) are recorded with cost 0 (not priced). Plain INSERT, no rate math here. run_id/user_id/conversation_id are nullable — an unattributed call still records its spend. id/created_at use defaults. agent_slug/agent_name/user_email are snapshotted from the referenced rows at write time (COALESCE to ” when absent) so the ledger row survives — and stays readable — after the agent or user is deleted. provider_slug is snapshotted by the caller (resolved from the providers row) for the same reason.

func (*Queries) InsertScheduledFire added in v0.4.0

func (q *Queries) InsertScheduledFire(ctx context.Context, arg InsertScheduledFireParams) (int64, error)

func (*Queries) InsertSystemAuditPending added in v0.4.0

func (q *Queries) InsertSystemAuditPending(ctx context.Context, arg InsertSystemAuditPendingParams) (int64, error)

Append an audit row BEFORE invoking the tool body. ok defaults to false / result_summary='pending' so a panic mid-tool leaves a visible trace. The follow-up UpdateSystemAudit flips ok + writes the real summary on completion.

func (*Queries) IsProviderModelReferenced added in v0.4.1

func (q *Queries) IsProviderModelReferenced(ctx context.Context, arg IsProviderModelReferencedParams) (bool, error)

func (*Queries) IsProviderReferenced added in v0.4.1

func (q *Queries) IsProviderReferenced(ctx context.Context, providerID pgtype.UUID) (bool, error)

func (*Queries) IsSystemDefaultModel added in v0.4.0

func (q *Queries) IsSystemDefaultModel(ctx context.Context, arg IsSystemDefaultModelParams) (bool, error)

Configured default models are always allowed (deny-by-default never locks out the baseline). True if (provider, model) matches any system_settings default capability pair.

func (*Queries) ListActiveAgentIDs added in v0.4.0

func (q *Queries) ListActiveAgentIDs(ctx context.Context) ([]pgtype.UUID, error)

All agents in 'active' status. Used by the sibling-update broadcaster to fan a /refresh out to every running agent (cold containers no-op).

func (*Queries) ListActiveBridges

func (q *Queries) ListActiveBridges(ctx context.Context) ([]Bridge, error)

All bridges to start polling on startup. Includes 'error' so a bridge that crashed during the previous run gets a fresh poll attempt — the next successful poll flips it back to 'active' via UpdateBridgeLastPolled.

func (*Queries) ListAddableSiblings added in v0.4.0

func (q *Queries) ListAddableSiblings(ctx context.Context, arg ListAddableSiblingsParams) ([]ListAddableSiblingsRow, error)

Agents the parent MAY add as siblings: any agent its OWNER holds a grant on (a direct grant or a group in @owner_grantee_ids — incl. the All-Users group), excluding the parent itself and already-added siblings. Carries the candidate's owner name (a user's display_name or a group's name) so the picker can disambiguate same-named agents.

func (*Queries) ListAgentBuildsByAgent

func (q *Queries) ListAgentBuildsByAgent(ctx context.Context, agentID pgtype.UUID) ([]ListAgentBuildsByAgentRow, error)

func (*Queries) ListAgentEnvVars added in v0.2.12

func (q *Queries) ListAgentEnvVars(ctx context.Context, agentID pgtype.UUID) ([]ListAgentEnvVarsRow, error)

For GET /api/v1/agents/{agentID}/env-vars (operator UI). Includes default_value so the UI can render it as a placeholder; secret rows always have default_value=” by RegisterEnvVar invariant.

func (*Queries) ListAgentGrantRowsForGrantees added in v0.4.0

func (q *Queries) ListAgentGrantRowsForGrantees(ctx context.Context, arg ListAgentGrantRowsForGranteesParams) ([]ListAgentGrantRowsForGranteesRow, error)

The (grantee_id, role) grants on @agent_id held by any grantee in @grantee_ids. The siblings service uses it to pick the authorizing grantee for a new edge — the highest-role grant in the parent owner's grantee-set.

func (*Queries) ListAgentGrants added in v0.4.0

func (q *Queries) ListAgentGrants(ctx context.Context, agentID pgtype.UUID) ([]ListAgentGrantsRow, error)

The members UI list. A grantee is a user (per-user member) or a group (e.g. the built-in `user` group = "All users"); kind disambiguates and the label resolves from whichever subtype the grantee is.

func (*Queries) ListAgentGrantsForGrantees added in v0.4.0

func (q *Queries) ListAgentGrantsForGrantees(ctx context.Context, arg ListAgentGrantsForGranteesParams) ([]string, error)

The agent-access resolver: the roles granted on an agent to any principal in the caller's grantee-set (their own user principal + the role-groups they belong to). EffectiveAgentAccess folds these to the max.

func (*Queries) ListAgentIDsByGrantee added in v0.4.0

func (q *Queries) ListAgentIDsByGrantee(ctx context.Context, userID pgtype.UUID) ([]pgtype.UUID, error)

Used by the WS upgrade handler to auto-subscribe a fresh connection to every agent the user holds an explicit per-user grant on. Group-derived access is not expanded, so a shared-with-everyone agent doesn't fan a user out to every topic; the client subscribes to those on demand.

func (*Queries) ListAgentIDsUsingModel added in v0.4.1

func (q *Queries) ListAgentIDsUsingModel(ctx context.Context, arg ListAgentIDsUsingModelParams) ([]pgtype.UUID, error)

Grant revocation locks every affected agent before it locks the provider. UNION removes agents referenced by more than one fixed override or slot; ORDER BY makes the subsequent LockAgentsByID call deterministic.

func (*Queries) ListAgentModelSlots

func (q *Queries) ListAgentModelSlots(ctx context.Context, agentID pgtype.UUID) ([]AgentModelSlot, error)

func (*Queries) ListAgentTools

func (q *Queries) ListAgentTools(ctx context.Context, agentID pgtype.UUID) ([]AgentTool, error)

func (*Queries) ListAgents

func (q *Queries) ListAgents(ctx context.Context) ([]Agent, error)

func (*Queries) ListAgentsForGitPolling added in v0.4.0

func (q *Queries) ListAgentsForGitPolling(ctx context.Context) ([]ListAgentsForGitPollingRow, error)

5-min polling fallback: returns agents with a remote + credential configured that are in a state where pulling makes sense (active or stopped — failed/draft agents shouldn't trigger rebuilds via webhook equivalent). Excludes agents currently in a build to avoid racing.

func (*Queries) ListAgentsVisibleToUser added in v0.4.0

func (q *Queries) ListAgentsVisibleToUser(ctx context.Context, granteeIds []pgtype.UUID) ([]Agent, error)

Agents the caller can see: any agent carrying a grant to a principal in the caller's grantee-set (their own user principal — owners/members — or a role-group like the built-in `user` group for shared-with-everyone). The owner is always included because CreateAgent seeds the creator's admin grant.

func (*Queries) ListAllMessagesByConversation

func (q *Queries) ListAllMessagesByConversation(ctx context.Context, conversationID pgtype.UUID) ([]AgentMessage, error)

Persistence scan including model-only and UI-only rows. Run-grouped rows stay together in the slot of the run's first message; tiebreak by ephemeral (non-ephemeral first) then seq.

func (*Queries) ListAllWebConversationsByUser added in v0.4.0

func (q *Queries) ListAllWebConversationsByUser(ctx context.Context, userID pgtype.UUID) ([]AgentConversation, error)

Every web conversation the user owns, across all agents — backs the global sidebar list. Only source='web' (bridge is delivered over the bridge, a2a is sibling transport); the row carries agent_id so the UI can label each entry with its agent's name.

func (*Queries) ListAvailableConnections added in v0.4.0

func (q *Queries) ListAvailableConnections(ctx context.Context, principalIds []pgtype.UUID) ([]ListAvailableConnectionsRow, error)

Inventory includes owned resources and resources shared with any principal in the caller's grantee set. Owners implicitly hold every capability.

func (*Queries) ListAvailableExecEndpoints added in v0.4.0

func (q *Queries) ListAvailableExecEndpoints(ctx context.Context, principalIds []pgtype.UUID) ([]ListAvailableExecEndpointsRow, error)

func (*Queries) ListAvailableMCPServers added in v0.4.0

func (q *Queries) ListAvailableMCPServers(ctx context.Context, principalIds []pgtype.UUID) ([]ListAvailableMCPServersRow, error)

func (*Queries) ListBoundMCPServersByAgent added in v0.4.0

func (q *Queries) ListBoundMCPServersByAgent(ctx context.Context, agentID pgtype.UUID) ([]ListBoundMCPServersByAgentRow, error)

The agent's bound MCP servers (resource rows), keyed by the NEED slug — for the sync-time tool-discovery sweep. Only bound needs have a server to probe.

func (*Queries) ListBridgesAccessible

func (q *Queries) ListBridgesAccessible(ctx context.Context, userID pgtype.UUID) ([]ListBridgesAccessibleRow, error)

Non-admin variant: system bridges plus bridges bound to agents the user has an explicit per-user grant on, plus bridges the user owns that have since been orphaned (agent deleted but bridge preserved). The agent's creator is granted admin at agent-create time, so the grant check also covers "agents I created."

func (*Queries) ListBridgesAdmin

func (q *Queries) ListBridgesAdmin(ctx context.Context) ([]ListBridgesAdminRow, error)

Admin variant: every bridge in the tenant with the owner joined for the Owner column in the UI. owner_principal_id is NULL for system bridges (and for owner-deleted orphans, though those CASCADE today), so LEFT JOIN keeps those rows.

func (*Queries) ListBridgesByAgentID added in v0.2.8

func (q *Queries) ListBridgesByAgentID(ctx context.Context, agentID pgtype.UUID) ([]pgtype.UUID, error)

All bridges bound to a specific agent. The schema doesn't unique-constrain bridges.agent_id, so use this to enumerate before tearing the agent down — the agent Delete handler must cancel each poller individually since CASCADE delete kills only the DB row, leaving the in-memory goroutine polling forever (and racing on the bot token if the bridge is re-added).

func (*Queries) ListBridgesByOwner added in v0.4.0

func (q *Queries) ListBridgesByOwner(ctx context.Context, ownerPrincipalID pgtype.UUID) ([]pgtype.UUID, error)

All bridges owned by a specific user. Used by service/users.Delete to pre-stop the BridgeManager pollers before the ON DELETE CASCADE wipes the rows — leaving a goroutine polling a deleted row would race on token re-encryption if the user is re-created with the same id.

func (*Queries) ListBridgesForAgent

func (q *Queries) ListBridgesForAgent(ctx context.Context, agentID pgtype.UUID) ([]Bridge, error)

Bridges relevant to a specific agent: its own bridge + system bridges.

func (*Queries) ListConnectionConsumers added in v0.4.0

func (q *Queries) ListConnectionConsumers(ctx context.Context, resourceID pgtype.UUID) ([]ListConnectionConsumersRow, error)

func (*Queries) ListConnectionGrants added in v0.4.0

func (q *Queries) ListConnectionGrants(ctx context.Context, connectionID pgtype.UUID) ([]ListConnectionGrantsRow, error)

Stored capability grants are read by resource authorization. The owner holds view/bind/manage implicitly (see authz.HasResourceCapability).

func (*Queries) ListConnectionNeedsByAgent added in v0.4.0

func (q *Queries) ListConnectionNeedsByAgent(ctx context.Context, agentID pgtype.UUID) ([]ListConnectionNeedsByAgentRow, error)

The agent's connection needs joined to their bound resource (if any). The agent's local handle is the NEED slug; an unconfigured need surfaces with its declared spec shape and authorized=false so the operator can set it up. Drives the operator connections tab, the agent-detail bundle, and the prompt's "needs setup" hints — none of which should see another agent's slug.

func (*Queries) ListConnectionsAvailableToPrincipal added in v0.4.0

func (q *Queries) ListConnectionsAvailableToPrincipal(ctx context.Context, principalIds []pgtype.UUID) ([]Connection, error)

Resource lookups for reusable resource inventory and binding.

func (*Queries) ListConversationFeed added in v0.4.0

func (q *Queries) ListConversationFeed(ctx context.Context, arg ListConversationFeedParams) ([]ListConversationFeedRow, error)

Merged sidebar feed: the user's web agent-conversations + system conversations as one stream, keyset-paginated by (updated_at, id) DESC so the windowed sidebar can page without loading everything. The first page passes cursor_updated='infinity' and cursor_id = the max uuid.

func (*Queries) ListConversationsByAgent

func (q *Queries) ListConversationsByAgent(ctx context.Context, arg ListConversationsByAgentParams) ([]AgentConversation, error)

Returns conversations for the given agent visible to the given user in the web UI. source='a2a' rows are a sibling-call transport detail (the called agent never "chats" them) and are excluded — surfacing them would also expose a delegated suspension as an actionable card here.

func (*Queries) ListCredentialsByUserID added in v0.4.0

func (q *Queries) ListCredentialsByUserID(ctx context.Context, userID pgtype.UUID) ([]WebauthnCredential, error)

func (*Queries) ListDirectoriesByAgent added in v0.2.0

func (q *Queries) ListDirectoriesByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentDirectory, error)

func (*Queries) ListDirectoriesWithRetention added in v0.2.8

func (q *Queries) ListDirectoriesWithRetention(ctx context.Context) ([]ListDirectoriesWithRetentionRow, error)

All directories opted into the storage sweep (retention_hours > 0). Per-agent so the sweeper can build "agents/{agent_id}{path}/" S3 prefixes to scan + delete from. Ordering is purely cosmetic for log readability.

func (*Queries) ListEnabledCronHandlers added in v0.4.0

func (q *Queries) ListEnabledCronHandlers(ctx context.Context) ([]AgentScheduleHandler, error)

func (*Queries) ListEnabledProviderModels added in v0.4.1

func (q *Queries) ListEnabledProviderModels(ctx context.Context) ([]ListEnabledProviderModelsRow, error)

func (*Queries) ListExecEndpointConsumers added in v0.4.0

func (q *Queries) ListExecEndpointConsumers(ctx context.Context, resourceID pgtype.UUID) ([]ListExecEndpointConsumersRow, error)

func (*Queries) ListExecEndpointGrants added in v0.4.0

func (q *Queries) ListExecEndpointGrants(ctx context.Context, execEndpointID pgtype.UUID) ([]ListExecEndpointGrantsRow, error)

func (*Queries) ListExecEndpointsAvailableToPrincipal added in v0.4.0

func (q *Queries) ListExecEndpointsAvailableToPrincipal(ctx context.Context, principalIds []pgtype.UUID) ([]AgentExecEndpoint, error)

func (*Queries) ListExecNeedsByAgent added in v0.4.0

func (q *Queries) ListExecNeedsByAgent(ctx context.Context, agentID pgtype.UUID) ([]ListExecNeedsByAgentRow, error)

The agent's exec-endpoint needs joined to their bound resource (if any), keyed by the NEED slug. Unconfigured needs surface with the declared spec shape and null operator columns. Drives the operator exec tab.

func (*Queries) ListExpiringConnections

func (q *Queries) ListExpiringConnections(ctx context.Context, expiryThreshold pgtype.Timestamptz) ([]ListExpiringConnectionsRow, error)

For the refresh job: OAuth tokens expiring within the buffer window that back at least one active agent's bound need (a connection bound only to suspended or stopped agents doesn't need a pre-warmed token).

func (*Queries) ListExpiringMCPServers

func (q *Queries) ListExpiringMCPServers(ctx context.Context, expiryThreshold pgtype.Timestamptz) ([]ListExpiringMCPServersRow, error)

For the refresh job: OAuth tokens expiring within the buffer window that back at least one active agent's bound need.

func (*Queries) ListGitCredentialGrants added in v0.4.0

func (q *Queries) ListGitCredentialGrants(ctx context.Context, gitCredentialID pgtype.UUID) ([]ListGitCredentialGrantsRow, error)

func (*Queries) ListGitCredentialsByUser added in v0.4.0

func (q *Queries) ListGitCredentialsByUser(ctx context.Context, userID pgtype.UUID) ([]ListGitCredentialsByUserRow, error)

Omits token_ref by design — listing should never need to read the encrypted blob. Defense in depth against accidental token leaks.

func (*Queries) ListGrantsForUser added in v0.4.0

func (q *Queries) ListGrantsForUser(ctx context.Context, userID pgtype.UUID) ([]ListGrantsForUserRow, error)

Drives the "Connected apps" section in Settings. Joins clients + agents so the UI can show "Claude → weather (granted 5 days ago)".

func (*Queries) ListInboundSiblings added in v0.4.0

func (q *Queries) ListInboundSiblings(ctx context.Context, siblingAgentID pgtype.UUID) ([]ListInboundSiblingsRow, error)

The reverse of ListSiblings: every agent that has added @sibling_agent_id to its address book, with the per-edge ceiling, the live authorizing-grant role on THIS agent, and the parent's owner name (a user's display_name or a group's name). Lets the target's admin see who can reach in, at what level. Inner join on the authorizing grant (guaranteed by the cascade FK).

func (*Queries) ListMCPNeedsByAgent added in v0.4.0

func (q *Queries) ListMCPNeedsByAgent(ctx context.Context, agentID pgtype.UUID) ([]ListMCPNeedsByAgentRow, error)

The agent's MCP needs joined to their bound server (if any), keyed by the NEED slug. Unconfigured needs surface with the declared spec shape and authorized=false. Drives the operator MCP tab.

func (*Queries) ListMCPServerConsumers added in v0.4.0

func (q *Queries) ListMCPServerConsumers(ctx context.Context, resourceID pgtype.UUID) ([]ListMCPServerConsumersRow, error)

func (*Queries) ListMCPServerGrants added in v0.4.0

func (q *Queries) ListMCPServerGrants(ctx context.Context, mcpServerID pgtype.UUID) ([]ListMCPServerGrantsRow, error)

func (*Queries) ListMCPServersAvailableToPrincipal added in v0.4.0

func (q *Queries) ListMCPServersAvailableToPrincipal(ctx context.Context, principalIds []pgtype.UUID) ([]AgentMcpServer, error)

func (*Queries) ListMessagesBackward

func (q *Queries) ListMessagesBackward(ctx context.Context, arg ListMessagesBackwardParams) ([]AgentMessage, error)

Older human transcript page for infinite-scroll-up. Returns up to @lim display messages with seq strictly less than @before, back in chronological order for easy prepend.

func (*Queries) ListMessagesByConversation

func (q *Queries) ListMessagesByConversation(ctx context.Context, conversationID pgtype.UUID) ([]AgentMessage, error)

Initial human transcript page: the 100 most recent display messages, returned in chronological order. Model-only compaction rows are projected out by source. The handler overfetches by one (LIMIT 101) so it can report has_older_messages without a second COUNT query; the extra row is trimmed before the response is built. Ordering is by seq (monotonic insertion order) — created_at alone ties when multiple rows are inserted in one transaction (assistant + tool batch).

func (*Queries) ListMessagesByRun

func (q *Queries) ListMessagesByRun(ctx context.Context, runID pgtype.UUID) ([]AgentMessage, error)

func (*Queries) ListMessagesForward

func (q *Queries) ListMessagesForward(ctx context.Context, arg ListMessagesForwardParams) ([]AgentMessage, error)

Newer human transcript page for scroll-down after eviction. Returns up to @lim display messages with seq strictly greater than @after, in chronological order.

func (*Queries) ListModelGrants added in v0.4.0

func (q *Queries) ListModelGrants(ctx context.Context) ([]ListModelGrantsRow, error)

func (*Queries) ListModelGrantsForGrantees added in v0.4.0

func (q *Queries) ListModelGrantsForGrantees(ctx context.Context, granteeIds []pgtype.UUID) ([]ListModelGrantsForGranteesRow, error)

The (provider row, model) pairs granted to any principal in the caller's grantee set — the models a non-admin caller may assign. Powers the model picker's allow-list (defaults aren't listed; the caller leaves a slot unset to fall back to the capability default).

func (*Queries) ListOrphanToolCallsByRun added in v0.2.8

func (q *Queries) ListOrphanToolCallsByRun(ctx context.Context, runID pgtype.UUID) ([]ListOrphanToolCallsByRunRow, error)

Returns tool-call parts emitted by this run that don't have a matching tool-result row in the same conversation. RunComplete and the sweeper iterate this and INSERT synthetic tool messages so the conversation's tool_use ↔ tool_result invariant holds for the next LLM turn (provider APIs 400 on unpaired tool_use). parts JSONB shape is the goai layout: {"type":"tool-call","toolCallId":...,"toolName":...,"args":...}.

func (*Queries) ListPendingCronFires added in v0.4.0

func (q *Queries) ListPendingCronFires(ctx context.Context, agentID pgtype.UUID) ([]AgentScheduledFire, error)

func (*Queries) ListPlatformIdentitiesAll added in v0.4.0

func (q *Queries) ListPlatformIdentitiesAll(ctx context.Context) ([]ListPlatformIdentitiesAllRow, error)

Admin variant: every platform identity in the tenant joined with the owning user's email + display_name for display in the admin UI. Gated behind authz.TenantIdentityManageAll; non-admin callers must use ListPlatformIdentitiesByUser.

func (*Queries) ListPlatformIdentitiesByUser

func (q *Queries) ListPlatformIdentitiesByUser(ctx context.Context, userID pgtype.UUID) ([]PlatformIdentity, error)

func (*Queries) ListProviderModels added in v0.4.1

func (q *Queries) ListProviderModels(ctx context.Context, configuredProviderID pgtype.UUID) ([]ProviderModel, error)

func (*Queries) ListProviders

func (q *Queries) ListProviders(ctx context.Context) ([]Provider, error)

func (*Queries) ListProvidersByCatalogID added in v0.2.15

func (q *Queries) ListProvidersByCatalogID(ctx context.Context, providerID string) ([]Provider, error)

All configured rows for a single catalog provider — used by the frontend to fan out picker entries (one per configured row × model).

func (*Queries) ListRebuildableAgents added in v0.4.0

func (q *Queries) ListRebuildableAgents(ctx context.Context) ([]Agent, error)

Agents the SDK-bump mass rebuild iterates over. An empty image_ref means no successful build yet (draft / failed initial build) — nothing to re-image. Status='stopped' agents are included: a fleet SDK bump should re-image them so they're ready when the operator starts them again. Order by created_at ASC for deterministic iteration order across replicas (advisory-locked single-runner per agent prevents real races, but predictable order eases debugging).

func (*Queries) ListRequiredConnectionScopes added in v0.4.0

func (q *Queries) ListRequiredConnectionScopes(ctx context.Context, arg ListRequiredConnectionScopesParams) ([]string, error)

func (*Queries) ListRequiredMCPScopes added in v0.4.0

func (q *Queries) ListRequiredMCPScopes(ctx context.Context, arg ListRequiredMCPScopesParams) ([]string, error)

func (*Queries) ListResourceNeedsByAgent added in v0.4.0

func (q *Queries) ListResourceNeedsByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentResourceNeed, error)

func (*Queries) ListRoutesByAgent

func (q *Queries) ListRoutesByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentRoute, error)

func (*Queries) ListRoutesByAgentAndMethod

func (q *Queries) ListRoutesByAgentAndMethod(ctx context.Context, arg ListRoutesByAgentAndMethodParams) ([]AgentRoute, error)

func (*Queries) ListRunningByAgent

func (q *Queries) ListRunningByAgent(ctx context.Context, agentID pgtype.UUID) ([]Run, error)

func (*Queries) ListRunsByAgent

func (q *Queries) ListRunsByAgent(ctx context.Context, arg ListRunsByAgentParams) ([]Run, error)

func (*Queries) ListScheduleHandlersByAgent added in v0.4.0

func (q *Queries) ListScheduleHandlersByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentScheduleHandler, error)

func (*Queries) ListScheduleHandlersByAgentKind added in v0.4.0

func (q *Queries) ListScheduleHandlersByAgentKind(ctx context.Context, arg ListScheduleHandlersByAgentKindParams) ([]AgentScheduleHandler, error)

func (*Queries) ListScheduledFires added in v0.4.0

func (q *Queries) ListScheduledFires(ctx context.Context, arg ListScheduledFiresParams) ([]AgentScheduledFire, error)

func (*Queries) ListSchedulesWithNextFire added in v0.4.0

func (q *Queries) ListSchedulesWithNextFire(ctx context.Context, agentID pgtype.UUID) ([]ListSchedulesWithNextFireRow, error)

One row per handler (cron + schedule) with the earliest pending fire time.

func (*Queries) ListSessionMessagesByConversation

func (q *Queries) ListSessionMessagesByConversation(ctx context.Context, conversationID pgtype.UUID) ([]AgentMessage, error)

Agent context loading — excludes ephemeral messages (output() / topic publish) and messages before the active context checkpoint. When no checkpoint is set, returns all non-ephemeral messages. Checkpoint-marker rows (source='checkpoint') are UI-only metadata and are never sent to the LLM.

func (*Queries) ListSiblings added in v0.4.0

func (q *Queries) ListSiblings(ctx context.Context, parentAgentID pgtype.UUID) ([]ListSiblingsRow, error)

The parent's address book with the data the prompt renderer needs (id, slug, name, description), the per-edge max_access ceiling, and the current role of the grant that authorizes the edge — so the service can show the live effective ceiling = min(max_access, authorizing role). The cascade FK guarantees the authorizing grant row exists, so the join is inner.

func (*Queries) ListStoredSecrets added in v0.4.0

func (q *Queries) ListStoredSecrets(ctx context.Context) ([]ListStoredSecretsRow, error)

func (*Queries) ListStuckRuns added in v0.2.8

func (q *Queries) ListStuckRuns(ctx context.Context, cutoff pgtype.Timestamptz) ([]ListStuckRunsRow, error)

Runs presumed dead because they haven't seen a terminal status update past the cutoff (started_at + outer dispatcher timeout + grace). The sweeper marks them error/agent-disconnected, synthesizes orphan tool-results, and publishes a synthetic run.complete WS event.

func (*Queries) ListSubscribedConversations

func (q *Queries) ListSubscribedConversations(ctx context.Context, arg ListSubscribedConversationsParams) ([]pgtype.UUID, error)

func (*Queries) ListSubscribedConversationsForUser added in v0.4.0

func (q *Queries) ListSubscribedConversationsForUser(ctx context.Context, arg ListSubscribedConversationsForUserParams) ([]pgtype.UUID, error)

func (*Queries) ListSystemConversationsByUser added in v0.4.0

func (q *Queries) ListSystemConversationsByUser(ctx context.Context, userID pgtype.UUID) ([]SystemConversation, error)

Web-UI sidebar. Bridge-routed threads (source='bridge') are intentionally hidden — they live on Telegram, the operator can't meaningfully resume them from the web, and surfacing them would leak bot-driven chat into the operator's conversation list. Ordered by updated_at DESC so the most-recently-active web conversation is first. Covered by (user_id, updated_at DESC).

func (*Queries) ListSystemMessagesByConversation added in v0.4.0

func (q *Queries) ListSystemMessagesByConversation(ctx context.Context, conversationID pgtype.UUID) ([]SystemMessage, error)

Used by sol.SessionStore.Load: returns post-checkpoint messages in canonical seq order, skipping checkpoint-marker rows (UI-only, never sent to the LLM). When no checkpoint is set, returns the full conversation history.

func (*Queries) ListSystemMessagesByConversationAfter added in v0.4.0

func (q *Queries) ListSystemMessagesByConversationAfter(ctx context.Context, arg ListSystemMessagesByConversationAfterParams) ([]SystemMessage, error)

Pagination cursor for the UI: rows with seq > the client's last known seq, capped at @max_rows. Used to backfill on reconnect.

func (*Queries) ListSystemMessagesByConversationAll added in v0.4.0

func (q *Queries) ListSystemMessagesByConversationAll(ctx context.Context, conversationID pgtype.UUID) ([]SystemMessage, error)

Returns every row including pre-checkpoint history + checkpoint markers. Used by the UI message list (so the operator still sees everything that happened in the conversation), separate from the LLM context load above.

func (*Queries) ListSystemRunsByUser added in v0.4.0

func (q *Queries) ListSystemRunsByUser(ctx context.Context, arg ListSystemRunsByUserParams) ([]ListSystemRunsByUserRow, error)

Caller's runs across all their conversations, paginated by started_at. JOINs system_conversations for the conversation title so the operator's activity view doesn't need a second per-row fetch.

func (*Queries) ListTopicSubscriptions

func (q *Queries) ListTopicSubscriptions(ctx context.Context, arg ListTopicSubscriptionsParams) ([]ListTopicSubscriptionsRow, error)

func (*Queries) ListTopicsByAgent

func (q *Queries) ListTopicsByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentTopic, error)

func (*Queries) ListUserAgentGrants added in v0.4.0

func (q *Queries) ListUserAgentGrants(ctx context.Context, userID pgtype.UUID) ([]ListUserAgentGrantsRow, error)

For sysagent's whoami tool: one row per agent the user holds an explicit per-user grant on, with role + the agent's slug/name. Group-derived access (shared-with-everyone) is intentionally not expanded here.

func (*Queries) ListUserSessionsByUser added in v0.4.0

func (q *Queries) ListUserSessionsByUser(ctx context.Context, userID pgtype.UUID) ([]UserSession, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context) ([]User, error)

func (*Queries) ListVisibleSiblings added in v0.4.0

func (q *Queries) ListVisibleSiblings(ctx context.Context, arg ListVisibleSiblingsParams) ([]pgtype.UUID, error)

Dispatch-time: the sibling agent IDs the run's user may A2A-call from the parent — those where the driving user (via @grantee_ids) holds a grant. Anonymous / cron / webhook runs pass an empty set and get nothing (they can't A2A in v1).

func (*Queries) ListWebhooksByAgent

func (q *Queries) ListWebhooksByAgent(ctx context.Context, agentID pgtype.UUID) ([]AgentWebhook, error)

func (*Queries) ListWebhooksByAgentWithStatus

func (q *Queries) ListWebhooksByAgentWithStatus(ctx context.Context, agentID pgtype.UUID) ([]ListWebhooksByAgentWithStatusRow, error)

func (*Queries) LockAgentsByID added in v0.4.0

func (q *Queries) LockAgentsByID(ctx context.Context, ids []pgtype.UUID) ([]pgtype.UUID, error)

func (*Queries) LockConnectionAuthorizationNeeds added in v0.4.0

func (q *Queries) LockConnectionAuthorizationNeeds(ctx context.Context, arg LockConnectionAuthorizationNeedsParams) ([]AgentResourceNeed, error)

OAuth transactions lock the target agent first, then these need rows by UUID, then the resource row, and finally the initiating user. The locked scope union cannot change underneath callback validation.

func (*Queries) LockConnectionBindings added in v0.4.0

func (q *Queries) LockConnectionBindings(ctx context.Context, resourceID pgtype.UUID) ([]pgtype.UUID, error)

Resource deletion takes bound need rows before the resource row so it uses the same need -> resource order as bind, callback, and token resolution.

func (*Queries) LockConnectionResource added in v0.4.0

func (q *Queries) LockConnectionResource(ctx context.Context, id pgtype.UUID) error

func (*Queries) LockExecBindings added in v0.4.0

func (q *Queries) LockExecBindings(ctx context.Context, resourceID pgtype.UUID) ([]pgtype.UUID, error)

func (*Queries) LockExecEndpointResource added in v0.4.0

func (q *Queries) LockExecEndpointResource(ctx context.Context, id pgtype.UUID) error

func (*Queries) LockGitCredentialResource added in v0.4.0

func (q *Queries) LockGitCredentialResource(ctx context.Context, id pgtype.UUID) error

func (*Queries) LockMCPAuthorizationNeeds added in v0.4.0

func (q *Queries) LockMCPAuthorizationNeeds(ctx context.Context, arg LockMCPAuthorizationNeedsParams) ([]AgentResourceNeed, error)

func (*Queries) LockMCPBindings added in v0.4.0

func (q *Queries) LockMCPBindings(ctx context.Context, resourceID pgtype.UUID) ([]pgtype.UUID, error)

func (*Queries) LockMCPServerResource added in v0.4.0

func (q *Queries) LockMCPServerResource(ctx context.Context, id pgtype.UUID) error

func (*Queries) LockOAuthGrantLifecycle added in v0.4.0

func (q *Queries) LockOAuthGrantLifecycle(ctx context.Context, arg LockOAuthGrantLifecycleParams) error

Serialize consent creation, consent decisions, and revocation for one grant identity. Hash collisions only serialize unrelated grants.

func (*Queries) LockProvidersByID added in v0.4.1

func (q *Queries) LockProvidersByID(ctx context.Context, ids []pgtype.UUID) ([]pgtype.UUID, error)

func (*Queries) LockQualifyingConnectionBindings added in v0.4.0

func (q *Queries) LockQualifyingConnectionBindings(ctx context.Context, arg LockQualifyingConnectionBindingsParams) ([]pgtype.UUID, error)

func (*Queries) LockQualifyingMCPBindings added in v0.4.0

func (q *Queries) LockQualifyingMCPBindings(ctx context.Context, arg LockQualifyingMCPBindingsParams) ([]pgtype.UUID, error)

func (*Queries) LockResourceNeedsByAgent added in v0.4.0

func (q *Queries) LockResourceNeedsByAgent(ctx context.Context, agentID pgtype.UUID) ([]pgtype.UUID, error)

func (*Queries) LockUsersForAdminMutation added in v0.4.0

func (q *Queries) LockUsersForAdminMutation(ctx context.Context) error

func (*Queries) MarkRefreshConsumed added in v0.4.0

func (q *Queries) MarkRefreshConsumed(ctx context.Context, tokenHash []byte) (OauthRefreshToken, error)

func (*Queries) OrphanMissingScheduleFires added in v0.4.0

func (q *Queries) OrphanMissingScheduleFires(ctx context.Context, arg OrphanMissingScheduleFiresParams) error

func (*Queries) PruneAuthFailures

func (q *Queries) PruneAuthFailures(ctx context.Context) (int64, error)

Background pruner: drop failure rows older than 24h.

func (*Queries) PruneExpiredAttachmentURLs

func (q *Queries) PruneExpiredAttachmentURLs(ctx context.Context) (int64, error)

Background pruner: delete URL cache rows that expired more than 24h ago. Stale rows aren't harmful (just unused) but bounded growth is nice.

func (*Queries) PruneStaleAuthLockouts

func (q *Queries) PruneStaleAuthLockouts(ctx context.Context) (int64, error)

Background pruner: drop expired lockout rows that haven't been touched in 24h so a fresh lockout starts at tier 0 again.

func (*Queries) ReconcileManagerBridge added in v0.4.0

func (q *Queries) ReconcileManagerBridge(ctx context.Context, arg ReconcileManagerBridgeParams) error

Refresh the manager bridge's live identity/capability from a getMe poll: bot_username (Telegram handles can change) + manager_error (” when the can_manage_bots capability is healthy).

func (*Queries) RecordAuthFailure

func (q *Queries) RecordAuthFailure(ctx context.Context, arg RecordAuthFailureParams) error

func (*Queries) ReleaseMCPActiveRequestReservation added in v0.4.0

func (q *Queries) ReleaseMCPActiveRequestReservation(ctx context.Context, arg ReleaseMCPActiveRequestReservationParams) error

Early validation or dispatch failures release only an unbound reservation.

func (*Queries) RemoveSibling added in v0.4.0

func (q *Queries) RemoveSibling(ctx context.Context, arg RemoveSiblingParams) error

func (*Queries) RenameConnection added in v0.4.0

func (q *Queries) RenameConnection(ctx context.Context, arg RenameConnectionParams) (int64, error)

func (*Queries) RenameCredential added in v0.4.0

func (q *Queries) RenameCredential(ctx context.Context, arg RenameCredentialParams) error

func (*Queries) RenameExecEndpoint added in v0.4.0

func (q *Queries) RenameExecEndpoint(ctx context.Context, arg RenameExecEndpointParams) (int64, error)

func (*Queries) RenameMCPServer added in v0.4.0

func (q *Queries) RenameMCPServer(ctx context.Context, arg RenameMCPServerParams) (int64, error)

func (*Queries) RenameSystemConversation added in v0.4.0

func (q *Queries) RenameSystemConversation(ctx context.Context, arg RenameSystemConversationParams) error

func (*Queries) RenewScheduledFireLease added in v0.4.0

func (q *Queries) RenewScheduledFireLease(ctx context.Context, arg RenewScheduledFireLeaseParams) (int64, error)

func (*Queries) ReplaceConnectionNeedBinding added in v0.4.0

func (q *Queries) ReplaceConnectionNeedBinding(ctx context.Context, arg ReplaceConnectionNeedBindingParams) (int64, error)

func (*Queries) ReplaceExecEndpointNeedBinding added in v0.4.0

func (q *Queries) ReplaceExecEndpointNeedBinding(ctx context.Context, arg ReplaceExecEndpointNeedBindingParams) (int64, error)

func (*Queries) ReplaceMCPServerNeedBinding added in v0.4.0

func (q *Queries) ReplaceMCPServerNeedBinding(ctx context.Context, arg ReplaceMCPServerNeedBindingParams) (int64, error)

func (*Queries) ReserveMCPActiveRequest added in v0.4.0

func (q *Queries) ReserveMCPActiveRequest(ctx context.Context, arg ReserveMCPActiveRequestParams) (int64, error)

JSON-RPC requires request IDs to remain unique while requests are active. Reserve before dispatch so cancellation can consume the request even before its run exists. An expired reservation may be replaced atomically.

func (*Queries) ResetStuckAgentBuilds

func (q *Queries) ResetStuckAgentBuilds(ctx context.Context) error

func (*Queries) ResetStuckBuilds

func (q *Queries) ResetStuckBuilds(ctx context.Context, errorMessage string) error

func (*Queries) ResetStuckRuns

func (q *Queries) ResetStuckRuns(ctx context.Context, errorMessage string) error

func (*Queries) ResetStuckUpgrades

func (q *Queries) ResetStuckUpgrades(ctx context.Context) error

func (*Queries) ResolveBoundConnection added in v0.4.0

func (q *Queries) ResolveBoundConnection(ctx context.Context, arg ResolveBoundConnectionParams) (Connection, error)

Runtime resolution: a need's slug resolves to its bound resource row. The credential proxy then keys off the resolved resource's own id/owner, never the calling agent — that is what lets one resource back many agents.

func (*Queries) ResolveBoundExecEndpoint added in v0.4.0

func (q *Queries) ResolveBoundExecEndpoint(ctx context.Context, arg ResolveBoundExecEndpointParams) (AgentExecEndpoint, error)

func (*Queries) ResolveBoundMCPServer added in v0.4.0

func (q *Queries) ResolveBoundMCPServer(ctx context.Context, arg ResolveBoundMCPServerParams) (AgentMcpServer, error)

func (*Queries) ResolvePrincipalNames added in v0.4.0

func (q *Queries) ResolvePrincipalNames(ctx context.Context, ids []pgtype.UUID) ([]ResolvePrincipalNamesRow, error)

Resolve principal ids to a display name: a user's display_name or a group's name (a principal is one or the other). Used to label an agent's owner.

func (*Queries) ResolveSuspendedRun

func (q *Queries) ResolveSuspendedRun(ctx context.Context, id pgtype.UUID) (int64, error)

func (*Queries) ResolveSuspendedSystemRun added in v0.4.0

func (q *Queries) ResolveSuspendedSystemRun(ctx context.Context, arg ResolveSuspendedSystemRunParams) (int64, error)

Confirmation checkpoints are single-use. The conversation id participates in the CAS so a run from another conversation cannot be consumed.

func (*Queries) RetryScheduledFire added in v0.4.0

func (q *Queries) RetryScheduledFire(ctx context.Context, arg RetryScheduledFireParams) (int64, error)

func (*Queries) RevokeGrant added in v0.4.0

func (q *Queries) RevokeGrant(ctx context.Context, arg RevokeGrantParams) (int64, error)

Marks a grant revoked. Caller also calls RevokeRefreshForGrant in the same handler so already-issued refresh tokens stop working.

func (*Queries) RevokeModelGrant added in v0.4.0

func (q *Queries) RevokeModelGrant(ctx context.Context, id pgtype.UUID) error

func (*Queries) RevokeRefreshFamily added in v0.4.0

func (q *Queries) RevokeRefreshFamily(ctx context.Context, familyID pgtype.UUID) (int64, error)

Reuse detection: nukes every still-rotatable token in the family. Already-consumed rows stay (we keep them for forensic 7d before GC) so we WHERE consumed_at IS NULL to avoid no-op updates.

func (*Queries) RevokeRefreshForGrant added in v0.4.0

func (q *Queries) RevokeRefreshForGrant(ctx context.Context, arg RevokeRefreshForGrantParams) (int64, error)

Called when a user revokes an oauth_grants row from the UI. Marks every still-active refresh in that (user, client, agent) as consumed, so the next refresh attempt fails. Already-issued access tokens (15min) survive until expiry — surfaced in the UI tooltip.

func (*Queries) RevokeUserSessionByID added in v0.4.0

func (q *Queries) RevokeUserSessionByID(ctx context.Context, arg RevokeUserSessionByIDParams) (int64, error)

func (*Queries) RevokeUserSessionByRefreshHash added in v0.4.0

func (q *Queries) RevokeUserSessionByRefreshHash(ctx context.Context, refreshTokenHash []byte) (int64, error)

func (*Queries) RewrapAgentSecret added in v0.4.0

func (q *Queries) RewrapAgentSecret(ctx context.Context, arg RewrapAgentSecretParams) (int64, error)

func (*Queries) RewrapBridgeSecret added in v0.4.0

func (q *Queries) RewrapBridgeSecret(ctx context.Context, arg RewrapBridgeSecretParams) (int64, error)

func (*Queries) RewrapConnectionSecret added in v0.4.0

func (q *Queries) RewrapConnectionSecret(ctx context.Context, arg RewrapConnectionSecretParams) (int64, error)

func (*Queries) RewrapEnvVarSecret added in v0.4.0

func (q *Queries) RewrapEnvVarSecret(ctx context.Context, arg RewrapEnvVarSecretParams) (int64, error)

func (*Queries) RewrapExecSecret added in v0.4.0

func (q *Queries) RewrapExecSecret(ctx context.Context, arg RewrapExecSecretParams) (int64, error)

func (*Queries) RewrapGitCredentialSecret added in v0.4.0

func (q *Queries) RewrapGitCredentialSecret(ctx context.Context, arg RewrapGitCredentialSecretParams) (int64, error)

func (*Queries) RewrapMCPSecret added in v0.4.0

func (q *Queries) RewrapMCPSecret(ctx context.Context, arg RewrapMCPSecretParams) (int64, error)

func (*Queries) RewrapOAuthStateSecret added in v0.4.0

func (q *Queries) RewrapOAuthStateSecret(ctx context.Context, arg RewrapOAuthStateSecretParams) (int64, error)

func (*Queries) RewrapProviderSecret added in v0.4.0

func (q *Queries) RewrapProviderSecret(ctx context.Context, arg RewrapProviderSecretParams) (int64, error)

func (*Queries) RewrapWebhookSecret added in v0.4.0

func (q *Queries) RewrapWebhookSecret(ctx context.Context, arg RewrapWebhookSecretParams) (int64, error)

func (*Queries) RollbackMCPTaskResume added in v0.4.0

func (q *Queries) RollbackMCPTaskResume(ctx context.Context, arg RollbackMCPTaskResumeParams) (int64, error)

Restore a claimed task only when dispatch did not create a successor. Once a successor row exists, that run owns the resume attempt even if forwarding it to the agent later fails.

func (*Queries) RollbackPromptRunResume added in v0.4.0

func (q *Queries) RollbackPromptRunResume(ctx context.Context, arg RollbackPromptRunResumeParams) (int64, error)

Restore a claimed prompt suspension only when dispatch did not create a successor. A successor carrying resumeRunId owns the attempt even if its subsequent container request fails.

func (*Queries) RotateUserSessionRefreshToken added in v0.4.0

func (q *Queries) RotateUserSessionRefreshToken(ctx context.Context, arg RotateUserSessionRefreshTokenParams) (int64, error)

func (*Queries) SetActivationCode

func (q *Queries) SetActivationCode(ctx context.Context, activationCode pgtype.Text) (int64, error)

Sets the activation code only if one hasn't been set yet. Returns rows affected: 0 means another writer already set it.

func (*Queries) SetAgentBuildIntegrationToken added in v0.4.0

func (q *Queries) SetAgentBuildIntegrationToken(ctx context.Context, arg SetAgentBuildIntegrationTokenParams) (int64, error)

func (*Queries) SetAgentBuildModel added in v0.4.0

func (q *Queries) SetAgentBuildModel(ctx context.Context, arg SetAgentBuildModelParams) error

Records the LLM model resolved for this build's codegen. Written once the model is resolved (before the run), so a build that later fails still shows which model produced it.

func (*Queries) SetAgentEnvVarValue added in v0.2.12

func (q *Queries) SetAgentEnvVarValue(ctx context.Context, arg SetAgentEnvVarValueParams) error

Updates only value_ref. Description / is_secret are managed by the agent's RegisterEnvVar declaration and shouldn't be mutated by the operator's value-setting flow.

func (*Queries) SetAgentModelSlotAssignment

func (q *Queries) SetAgentModelSlotAssignment(ctx context.Context, arg SetAgentModelSlotAssignmentParams) error

Both columns move together: empty model name means clear the FK too.

func (*Queries) SetConversationCheckpoint

func (q *Queries) SetConversationCheckpoint(ctx context.Context, arg SetConversationCheckpointParams) error

func (*Queries) SetExecEndpointHostKey added in v0.4.0

func (q *Queries) SetExecEndpointHostKey(ctx context.Context, arg SetExecEndpointHostKeyParams) error

TOFU pin: written the first time the dialer successfully connects to a target whose host_key_openssh is currently NULL.

func (*Queries) SetExecEndpointKeypairByID added in v0.4.0

func (q *Queries) SetExecEndpointKeypairByID(ctx context.Context, arg SetExecEndpointKeypairByIDParams) error

Stores a freshly generated keypair. Called at first configure (when no key exists yet) and on operator-triggered rotation.

func (*Queries) SetSystemConversationCheckpoint added in v0.4.0

func (q *Queries) SetSystemConversationCheckpoint(ctx context.Context, arg SetSystemConversationCheckpointParams) (int64, error)

Stash the sol SuspensionContext (pending tool calls + completed results), bind it to the run that produced it, and flip the conversation to 'awaiting_confirmation'. The caller holds the conversation row lock and commits this alongside SuspendSystemRun.

func (*Queries) SetSystemConversationContextCheckpoint added in v0.4.0

func (q *Queries) SetSystemConversationContextCheckpoint(ctx context.Context, arg SetSystemConversationContextCheckpointParams) error

Compaction pointer: advances the context window so subsequent Loads filter to messages with seq >= the checkpoint message's seq. See ListSystemMessagesByConversation.

func (*Queries) SetTempPassword added in v0.4.0

func (q *Queries) SetTempPassword(ctx context.Context, arg SetTempPasswordParams) error

Set a password and force a change on next login. Used by admin user creation and the `airlock auth reset` break-glass CLI.

func (*Queries) StageConnectionOAuthAppByID added in v0.4.0

func (q *Queries) StageConnectionOAuthAppByID(ctx context.Context, arg StageConnectionOAuthAppByIDParams) (int64, error)

func (*Queries) StageMCPServerOAuthAppByID added in v0.4.0

func (q *Queries) StageMCPServerOAuthAppByID(ctx context.Context, arg StageMCPServerOAuthAppByIDParams) (int64, error)

func (*Queries) StartInitialAgentBuild added in v0.4.0

func (q *Queries) StartInitialAgentBuild(ctx context.Context, arg StartInitialAgentBuildParams) (int64, error)

func (*Queries) StopAgentAndRotateToken added in v0.4.0

func (q *Queries) StopAgentAndRotateToken(ctx context.Context, arg StopAgentAndRotateTokenParams) (int64, error)

func (*Queries) SubscribeTopic

func (q *Queries) SubscribeTopic(ctx context.Context, arg SubscribeTopicParams) error

func (*Queries) SuspendSystemRun added in v0.4.0

func (q *Queries) SuspendSystemRun(ctx context.Context, arg SuspendSystemRunParams) (int64, error)

func (*Queries) SweepExpiredManagedBotSessions added in v0.4.0

func (q *Queries) SweepExpiredManagedBotSessions(ctx context.Context) error

Janitor: drop rows past their 15-minute TTL. Called on manager-bot Reload and as part of periodic cleanup. The CHECK constraint guarantees agent_id is valid (FK CASCADE handles agent deletion) so we can't leak rows pointing at deleted agents.

func (*Queries) TenantExists

func (q *Queries) TenantExists(ctx context.Context) (bool, error)

func (*Queries) TouchExecEndpointLastUsed added in v0.4.0

func (q *Queries) TouchExecEndpointLastUsed(ctx context.Context, id pgtype.UUID) error

func (*Queries) TouchGitCredentialUsage added in v0.4.0

func (q *Queries) TouchGitCredentialUsage(ctx context.Context, id pgtype.UUID) error

Stamped on successful clone/push/refresh — surfaces "is this credential actually being used?" without needing audit-log scrubbing.

func (*Queries) TouchOAuthClient added in v0.4.0

func (q *Queries) TouchOAuthClient(ctx context.Context, clientID string) error

Bump last_used_at on a successful /token exchange.

func (*Queries) TouchSystemConversation added in v0.4.0

func (q *Queries) TouchSystemConversation(ctx context.Context, id pgtype.UUID) error

Bumps updated_at after a new message lands so list order reflects recency. Separate from rename so a chat turn doesn't accidentally rewrite the title.

func (*Queries) TouchUserSession added in v0.4.0

func (q *Queries) TouchUserSession(ctx context.Context, id pgtype.UUID) error

func (*Queries) UnbindAllResourceNeedsByAgent added in v0.4.0

func (q *Queries) UnbindAllResourceNeedsByAgent(ctx context.Context, agentID pgtype.UUID) error

Clear every binding on an agent's needs (the need rows stay — they are the code-synced manifest). Used on ownership transfer: the bound connection/MCP/ exec resources are the OLD owner's, and the new owner has no access to them.

func (*Queries) UnbindBridgesByAgent added in v0.4.0

func (q *Queries) UnbindBridgesByAgent(ctx context.Context, agentID pgtype.UUID) error

Detach every bridge from an agent (leaves the bridge rows, owned by the old owner, with a NULL target). Used on ownership transfer: a bridge holds the old owner's bot token. Enumerate with ListBridgesByAgentID first and cancel each in-memory poller — this only clears the DB target.

func (*Queries) UnbindResourceNeed added in v0.4.0

func (q *Queries) UnbindResourceNeed(ctx context.Context, arg UnbindResourceNeedParams) (int64, error)

func (*Queries) UnsubscribeTopic

func (q *Queries) UnsubscribeTopic(ctx context.Context, arg UnsubscribeTopicParams) error

func (*Queries) UpdateAgentA2ASettings added in v0.4.0

func (q *Queries) UpdateAgentA2ASettings(ctx context.Context, arg UpdateAgentA2ASettingsParams) error

Updates the three protocol-surface toggles. The grant ladder governs who may make an authed MCP call; these are orthogonal (anonymous MCP, the MCP master switch, anonymous public web routes).

func (*Queries) UpdateAgentBuildComplete

func (q *Queries) UpdateAgentBuildComplete(ctx context.Context, arg UpdateAgentBuildCompleteParams) error

func (*Queries) UpdateAgentBuildLogs

func (q *Queries) UpdateAgentBuildLogs(ctx context.Context, arg UpdateAgentBuildLogsParams) error

func (*Queries) UpdateAgentBuildTodos added in v0.4.0

func (q *Queries) UpdateAgentBuildTodos(ctx context.Context, arg UpdateAgentBuildTodosParams) error

Persists the agent's current task list (jsonb) as it rewrites it during codegen. Separate from UpdateAgentBuildLogs so the todo write cadence is independent of the 1s log flush.

func (*Queries) UpdateAgentConfig

func (q *Queries) UpdateAgentConfig(ctx context.Context, arg UpdateAgentConfigParams) error

func (*Queries) UpdateAgentDBPassword added in v0.2.11

func (q *Queries) UpdateAgentDBPassword(ctx context.Context, arg UpdateAgentDBPasswordParams) error

Set the encrypted DB password for the agent's per-schema role. Written once on first creation; rebuilds reuse the stored value (the role password is never rotated) so a running container's creds can't be invalidated mid-build.

func (*Queries) UpdateAgentDescription

func (q *Queries) UpdateAgentDescription(ctx context.Context, arg UpdateAgentDescriptionParams) error

func (*Queries) UpdateAgentEmoji added in v0.4.0

func (q *Queries) UpdateAgentEmoji(ctx context.Context, arg UpdateAgentEmojiParams) error

func (*Queries) UpdateAgentErrorMessage

func (q *Queries) UpdateAgentErrorMessage(ctx context.Context, arg UpdateAgentErrorMessageParams) error

func (*Queries) UpdateAgentFields

func (q *Queries) UpdateAgentFields(ctx context.Context, arg UpdateAgentFieldsParams) (Agent, error)

Caller resolves each value (keep-existing when the request omits it) before calling, so this is an unconditional set. slug uniqueness is enforced by the agents.slug UNIQUE constraint — a collision surfaces as a duplicate-key error the handler maps to 409.

func (*Queries) UpdateAgentGitLastSyncedRef added in v0.4.0

func (q *Queries) UpdateAgentGitLastSyncedRef(ctx context.Context, arg UpdateAgentGitLastSyncedRefParams) error

func (*Queries) UpdateAgentInstructions added in v0.4.0

func (q *Queries) UpdateAgentInstructions(ctx context.Context, arg UpdateAgentInstructionsParams) error

func (*Queries) UpdateAgentModels

func (q *Queries) UpdateAgentModels(ctx context.Context, arg UpdateAgentModelsParams) error

Atomic replace of all eight per-agent model overrides. Each slot is two columns: a provider FK (nullable) and the bare model name string. Empty/NULL means "inherit the corresponding system default".

func (*Queries) UpdateAgentOwner added in v0.4.0

func (q *Queries) UpdateAgentOwner(ctx context.Context, arg UpdateAgentOwnerParams) error

Reassign the agent's owner (transfer ownership). The caller separately moves the agent_grants admin membership and clears owner-scoped bindings — ownership is the column here plus the grant, and they must move together.

func (*Queries) UpdateAgentRefs

func (q *Queries) UpdateAgentRefs(ctx context.Context, arg UpdateAgentRefsParams) error

func (*Queries) UpdateAgentSDKVersion

func (q *Queries) UpdateAgentSDKVersion(ctx context.Context, arg UpdateAgentSDKVersionParams) error

func (*Queries) UpdateAgentStatus

func (q *Queries) UpdateAgentStatus(ctx context.Context, arg UpdateAgentStatusParams) error

func (*Queries) UpdateAgentToolsHash added in v0.4.0

func (q *Queries) UpdateAgentToolsHash(ctx context.Context, arg UpdateAgentToolsHashParams) error

Stamp the synced tool-set hash on the agent. Sync handler compares before/after to decide whether to broadcast a sibling-update refresh.

func (*Queries) UpdateAgentUpgradeStatus

func (q *Queries) UpdateAgentUpgradeStatus(ctx context.Context, arg UpdateAgentUpgradeStatusParams) error

func (*Queries) UpdateBridgeBinding added in v0.4.0

func (q *Queries) UpdateBridgeBinding(ctx context.Context, arg UpdateBridgeBindingParams) (Bridge, error)

Rebind the bridge's target. Either is_system=true with NULL agent_id (operator surface — routes to the in-airlock sysagent) or is_system=false with a non-NULL agent_id (agent surface) — the XOR is enforced by the service layer, not the schema. The running poller must be reloaded via BridgeManager.AddBridge after this update — it holds AgentID in memory.

func (*Queries) UpdateBridgeIdentity added in v0.4.0

func (q *Queries) UpdateBridgeIdentity(ctx context.Context, arg UpdateBridgeIdentityParams) error

Refresh a bridge's bot-controlled identity from a getMe poll: the display name (the bridge name shown in the UI) + bot_username (the @handle, which can change). The operator never sets these — they mirror the bot.

func (*Queries) UpdateBridgeLastPolled

func (q *Queries) UpdateBridgeLastPolled(ctx context.Context, arg UpdateBridgeLastPolledParams) error

Status flips back to 'active' on every successful poll so a past transient failure (network blip, brief upstream hiccup) doesn't leave the row stuck at 'error' once the poller recovers.

func (*Queries) UpdateBridgeStatus

func (q *Queries) UpdateBridgeStatus(ctx context.Context, arg UpdateBridgeStatusParams) error

func (*Queries) UpdateBuildLLMStats added in v0.4.0

func (q *Queries) UpdateBuildLLMStats(ctx context.Context, buildID pgtype.UUID) error

Build-side parity with UpdateRunLLMStats: aggregates the build's token/call/cost totals from the llm_usage ledger (rows the build codegen runner wrote with build_id; cost already computed per-row). Idempotent — recomputes the SUM each call. A build with no ledger rows zeroes out (correct — no codegen spend recorded).

func (*Queries) UpdateConnectionCredentialsByID added in v0.4.0

func (q *Queries) UpdateConnectionCredentialsByID(ctx context.Context, arg UpdateConnectionCredentialsByIDParams) error

func (*Queries) UpdateConnectionOwnerByID added in v0.4.0

func (q *Queries) UpdateConnectionOwnerByID(ctx context.Context, arg UpdateConnectionOwnerByIDParams) error

Set the resource owner to the principal who created it (the configuring user), overriding the agent-owner default the upsert seeds.

func (*Queries) UpdateConversationSettings

func (q *Queries) UpdateConversationSettings(ctx context.Context, arg UpdateConversationSettingsParams) error

Merges a JSONB patch into agent_conversations.settings. Used by the /echo slash command and any future per-chat preferences.

func (*Queries) UpdateCredentialSignCount added in v0.4.0

func (q *Queries) UpdateCredentialSignCount(ctx context.Context, arg UpdateCredentialSignCountParams) error

func (*Queries) UpdateExecEndpointOwnerByID added in v0.4.0

func (q *Queries) UpdateExecEndpointOwnerByID(ctx context.Context, arg UpdateExecEndpointOwnerByIDParams) error

id-keyed operator ops (the service resolves the binding to an id first). Set the resource owner to the principal who created it (the configuring user), overriding the agent-owner default the declaration upsert seeds.

func (*Queries) UpdateLastSeenSDKVersion added in v0.4.0

func (q *Queries) UpdateLastSeenSDKVersion(ctx context.Context, lastSeenSdkVersion string) error

Stamp the bundled agentsdk version after a successful mass rebuild (or on first boot when there's nothing to rebuild). Compared against agentsdk.Version on the next airlock startup to detect SDK drift.

func (*Queries) UpdateMCPServerCredentialsByID added in v0.4.0

func (q *Queries) UpdateMCPServerCredentialsByID(ctx context.Context, arg UpdateMCPServerCredentialsByIDParams) error

func (*Queries) UpdateMCPServerDiscoveryByID added in v0.4.0

func (q *Queries) UpdateMCPServerDiscoveryByID(ctx context.Context, arg UpdateMCPServerDiscoveryByIDParams) error

Lazy re-discovery: refresh auth_url / token_url / registration_endpoint after a fresh RFC 8414 fetch. Does NOT touch access_token_ref — re-discovery never invalidates auth state by itself.

func (*Queries) UpdateMCPServerOwnerByID added in v0.4.0

func (q *Queries) UpdateMCPServerOwnerByID(ctx context.Context, arg UpdateMCPServerOwnerByIDParams) error

Set the resource owner to the principal who created it (the configuring user).

func (*Queries) UpdateMCPServerToolSchemasByID added in v0.4.0

func (q *Queries) UpdateMCPServerToolSchemasByID(ctx context.Context, arg UpdateMCPServerToolSchemasByIDParams) error

func (*Queries) UpdateProvider

func (q *Queries) UpdateProvider(ctx context.Context, arg UpdateProviderParams) (Provider, error)

func (*Queries) UpdateRunCheckpoint

func (q *Queries) UpdateRunCheckpoint(ctx context.Context, arg UpdateRunCheckpointParams) error

func (*Queries) UpdateRunComplete

func (q *Queries) UpdateRunComplete(ctx context.Context, arg UpdateRunCompleteParams) error

func (*Queries) UpdateRunLLMStats

func (q *Queries) UpdateRunLLMStats(ctx context.Context, runID pgtype.UUID) error

Aggregates the run's token/call/cost totals from the llm_usage ledger (the single source of truth — one row per proxied model round-trip, cost already computed per-row at capture). Idempotent: safe to invoke from the agent's RunComplete handler and again from any bg fallback; it recomputes the SUM each time. A run with no ledger rows zeroes out (correct — no model spend recorded).

func (*Queries) UpdateRunStatus

func (q *Queries) UpdateRunStatus(ctx context.Context, arg UpdateRunStatusParams) error

func (*Queries) UpdateScheduleHandlerLastFired added in v0.4.0

func (q *Queries) UpdateScheduleHandlerLastFired(ctx context.Context, arg UpdateScheduleHandlerLastFiredParams) error

func (*Queries) UpdateSiblingMaxAccess added in v0.4.0

func (q *Queries) UpdateSiblingMaxAccess(ctx context.Context, arg UpdateSiblingMaxAccessParams) (int64, error)

Change the per-edge ceiling (operator intent). Returns rows affected so the caller can distinguish a missing edge (0) from success (1).

func (*Queries) UpdateSystemAuditResult added in v0.4.0

func (q *Queries) UpdateSystemAuditResult(ctx context.Context, arg UpdateSystemAuditResultParams) error

func (*Queries) UpdateSystemConversationSettings added in v0.4.0

func (q *Queries) UpdateSystemConversationSettings(ctx context.Context, arg UpdateSystemConversationSettingsParams) error

JSONB shallow merge: caller passes a patch with only the keys to overwrite; existing keys not in the patch survive. Used by /echo to flip the echo setting without touching anything else.

func (*Queries) UpdateSystemRunLLMStats added in v0.4.0

func (q *Queries) UpdateSystemRunLLMStats(ctx context.Context, id pgtype.UUID) error

Refreshes the run's token/call/cost aggregate from the llm_usage ledger (rows the sysagent turn wrote under this system_run_id). Mirrors UpdateRunLLMStats / UpdateBuildLLMStats so the per-run cost surfaced in the activity view stays the ledger's sum, computed in exactly one place.

func (*Queries) UpdateSystemRunStatus added in v0.4.0

func (q *Queries) UpdateSystemRunStatus(ctx context.Context, arg UpdateSystemRunStatusParams) error

func (*Queries) UpdateSystemSettings

func (q *Queries) UpdateSystemSettings(ctx context.Context, arg UpdateSystemSettingsParams) (SystemSetting, error)

Each system default is a pair: a providers row FK (nullable) and the bare model name. NULL/empty ⇄ no default configured for that slot.

func (*Queries) UpdateUserDisplayName added in v0.4.0

func (q *Queries) UpdateUserDisplayName(ctx context.Context, arg UpdateUserDisplayNameParams) (int64, error)

func (*Queries) UpdateUserPasswordAndRevokeSessions added in v0.4.0

func (q *Queries) UpdateUserPasswordAndRevokeSessions(ctx context.Context, arg UpdateUserPasswordAndRevokeSessionsParams) (int64, error)

func (*Queries) UpdateUserRole

func (q *Queries) UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) error

func (*Queries) UpdateWebhookLastReceived

func (q *Queries) UpdateWebhookLastReceived(ctx context.Context, id pgtype.UUID) error

func (*Queries) UpdateWebhookSecret

func (q *Queries) UpdateWebhookSecret(ctx context.Context, arg UpdateWebhookSecretParams) error

func (*Queries) UpsertAgentEnvVar added in v0.2.12

func (q *Queries) UpsertAgentEnvVar(ctx context.Context, arg UpsertAgentEnvVarParams) (AgentEnvVar, error)

Called from the agent-internal sync to declare a slot. Operator supplies the value separately via SetAgentEnvVarValue. Preserves any existing value_ref when an agent re-syncs the same slug; description, is_secret, default_value, and pattern track the agent's declaration.

func (*Queries) UpsertAgentGrant added in v0.4.0

func (q *Queries) UpsertAgentGrant(ctx context.Context, arg UpsertAgentGrantParams) error

func (*Queries) UpsertAgentModelSlot

func (q *Queries) UpsertAgentModelSlot(ctx context.Context, arg UpsertAgentModelSlotParams) error

Reconciles slot declaration on every sync. capability and description come from the agent code; the assignment (assigned_provider_id + assigned_model) is admin-controlled and must survive re-syncs untouched. NULL provider FK ⇄ empty model name.

func (*Queries) UpsertAgentTool

func (q *Queries) UpsertAgentTool(ctx context.Context, arg UpsertAgentToolParams) error

func (*Queries) UpsertCachedAttachmentURL

func (q *Queries) UpsertCachedAttachmentURL(ctx context.Context, arg UpsertCachedAttachmentURLParams) error

func (*Queries) UpsertConnection

func (q *Queries) UpsertConnection(ctx context.Context, arg UpsertConnectionParams) (Connection, error)

Connections are principal-owned resources, identified by id or (owner_principal_id, slug). An agent reaches a connection only through a binding on agent_resource_needs, so credential-management queries address the resource by id (the service resolves the binding first) and listings join through the needs table, keyed by the agent's NEED slug. Create-or-refresh the owner's connection for @slug. The owner is the agent's user; @agent_id only resolves that owner — the row carries no agent_id. When scopes change, clear access_token_ref so the user must re-authorize with the new scopes. Credential fields are seeded empty on insert; ON CONFLICT preserves an existing access_token_ref unless scopes changed.

func (*Queries) UpsertDirectory added in v0.2.0

func (q *Queries) UpsertDirectory(ctx context.Context, arg UpsertDirectoryParams) error

func (*Queries) UpsertExecEndpointDeclaration added in v0.4.0

func (q *Queries) UpsertExecEndpointDeclaration(ctx context.Context, arg UpsertExecEndpointDeclarationParams) (AgentExecEndpoint, error)

Exec endpoints are principal-owned resources, identified by id or (owner_principal_id, slug). An agent reaches one only through a binding on agent_resource_needs, so operator ops address the resource by id (the service resolves the binding first) and the listing joins through needs, keyed by the agent's NEED slug. Create-or-refresh the owner's exec endpoint for @slug. The owner is the agent's user; @agent_id only resolves that owner — the row carries no agent_id. Only the agent-declared fields are touched; operator-configured columns (transport, host, port, ssh_user, private_key_ref, public_key_*, host_key_*) are left untouched so re-syncing a running agent does not nuke its operator config.

func (*Queries) UpsertGrant added in v0.4.0

func (q *Queries) UpsertGrant(ctx context.Context, arg UpsertGrantParams) error

Inserts or refreshes a consent record. Called from /oauth/consent on user approval. The 90-day window slides forward on every consent; revoked_at is cleared on re-grant (user explicitly approving wipes the revoke).

func (*Queries) UpsertLockout

func (q *Queries) UpsertLockout(ctx context.Context, arg UpsertLockoutParams) error

Set or update the lockout row with caller-computed tier + locked_until. The escalation policy is computed in Go (auth/lockout.Policy).

func (*Queries) UpsertMCPServer

func (q *Queries) UpsertMCPServer(ctx context.Context, arg UpsertMCPServerParams) (AgentMcpServer, error)

MCP servers are principal-owned resources, identified by id or (owner_principal_id, slug). An agent reaches a server only through a binding on agent_resource_needs, so credential ops address the resource by id and listings join through the needs table, keyed by the agent's NEED slug. Create-or-refresh the owner's MCP server for @slug. The owner is the agent's user; @agent_id only resolves that owner — the row carries no agent_id. When url or scopes change, clear access_token_ref so the user must re-authorize. registration_endpoint is taken from EXCLUDED only when newly populated, so a fresh discovery run that turned up empty doesn't blow away a known endpoint.

func (*Queries) UpsertResourceNeed added in v0.4.0

func (q *Queries) UpsertResourceNeed(ctx context.Context, arg UpsertResourceNeedParams) error

Agent resource needs (the manifest) + their bindings to concrete resources. Sync upserts the declarative fields and never touches the binding, so an operator-attached resource survives re-syncs.

func (*Queries) UpsertRoute

func (q *Queries) UpsertRoute(ctx context.Context, arg UpsertRouteParams) error

func (*Queries) UpsertRunComplete

func (q *Queries) UpsertRunComplete(ctx context.Context, arg UpsertRunCompleteParams) (int64, error)

Recovery path: row may not exist if CreateRun never landed. All "starts empty" fields (llm counters, compacted) passed explicitly. trigger_type/trigger_ref/source_ref placeholders apply only when the row is brand-new — the agent's r.Complete arrives without trigger context; the dispatcher's CreateRun would have set the real values.

func (*Queries) UpsertScheduleHandler added in v0.4.0

func (q *Queries) UpsertScheduleHandler(ctx context.Context, arg UpsertScheduleHandlerParams) error

enabled defaults true on insert, preserved on conflict (operator toggle). last_fired_at is preserved on conflict.

func (*Queries) UpsertTopic

func (q *Queries) UpsertTopic(ctx context.Context, arg UpsertTopicParams) error

func (*Queries) UpsertWebhook

func (q *Queries) UpsertWebhook(ctx context.Context, arg UpsertWebhookParams) error

secret is initially ” — populated later by UpdateWebhookSecret when the user generates an HMAC verification secret.

func (*Queries) UsageByAgent added in v0.4.0

func (q *Queries) UsageByAgent(ctx context.Context, since pgtype.Timestamptz) ([]UsageByAgentRow, error)

Owner (agents.owner_principal_id → users via the user-principal id) is joined live, so it's empty for rows whose agent (or whose agent's owner) is deleted.

func (*Queries) UsageByModel added in v0.4.0

func (q *Queries) UsageByModel(ctx context.Context, since pgtype.Timestamptz) ([]UsageByModelRow, error)

func (*Queries) UsageByUser added in v0.4.0

func (q *Queries) UsageByUser(ctx context.Context, since pgtype.Timestamptz) ([]UsageByUserRow, error)

Grouped by the triggering user's snapshot email. Spend with no user in the loop — agent HTTP route / scheduled "code" runs, or otherwise unattributed calls — carries an empty email snapshot; it is bucketed under its call_kind (e.g. "code") instead of shown as a phantom deleted user. deleted marks a real user whose row is gone (user_id SET NULL) but whose email snapshot survives — i.e. a non-empty email with no live user id.

func (*Queries) UsageSummary added in v0.4.0

func (q *Queries) UsageSummary(ctx context.Context, since pgtype.Timestamptz) (UsageSummaryRow, error)

Spend-ledger rollups for the admin Usage view. All read llm_usage (the durable, append-only ledger) over a created_at window. Rows for deleted agents survive with agent_id NULL but retain agent_slug/agent_name, so they still roll up under their original identity.

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type ReconcileManagerBridgeParams added in v0.4.0

type ReconcileManagerBridgeParams struct {
	BotUsername  string      `json:"bot_username"`
	ManagerError string      `json:"manager_error"`
	ID           pgtype.UUID `json:"id"`
}

type RecordAuthFailureParams

type RecordAuthFailureParams struct {
	Email string `json:"email"`
	Ip    string `json:"ip"`
}

type RelayCode added in v0.4.0

type RelayCode struct {
	CodeHash     []byte             `json:"code_hash"`
	NonceHash    []byte             `json:"nonce_hash"`
	UserID       pgtype.UUID        `json:"user_id"`
	Email        string             `json:"email"`
	TenantRole   string             `json:"tenant_role"`
	AuthEpoch    int64              `json:"auth_epoch"`
	AgentID      pgtype.UUID        `json:"agent_id"`
	TargetOrigin string             `json:"target_origin"`
	ReturnPath   string             `json:"return_path"`
	ExpiresAt    pgtype.Timestamptz `json:"expires_at"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	SessionID    pgtype.UUID        `json:"session_id"`
}

type ReleaseMCPActiveRequestReservationParams added in v0.4.0

type ReleaseMCPActiveRequestReservationParams struct {
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
}

type RemoveSiblingParams added in v0.4.0

type RemoveSiblingParams struct {
	ParentAgentID  pgtype.UUID `json:"parent_agent_id"`
	SiblingAgentID pgtype.UUID `json:"sibling_agent_id"`
}

type RenameConnectionParams added in v0.4.0

type RenameConnectionParams struct {
	DisplayName string      `json:"display_name"`
	ID          pgtype.UUID `json:"id"`
}

type RenameCredentialParams added in v0.4.0

type RenameCredentialParams struct {
	FriendlyName string      `json:"friendly_name"`
	ID           pgtype.UUID `json:"id"`
	UserID       pgtype.UUID `json:"user_id"`
}

type RenameExecEndpointParams added in v0.4.0

type RenameExecEndpointParams struct {
	DisplayName string      `json:"display_name"`
	ID          pgtype.UUID `json:"id"`
}

type RenameMCPServerParams added in v0.4.0

type RenameMCPServerParams struct {
	DisplayName string      `json:"display_name"`
	ID          pgtype.UUID `json:"id"`
}

type RenameSystemConversationParams added in v0.4.0

type RenameSystemConversationParams struct {
	Title  string      `json:"title"`
	ID     pgtype.UUID `json:"id"`
	UserID pgtype.UUID `json:"user_id"`
}

type RenewScheduledFireLeaseParams added in v0.4.0

type RenewScheduledFireLeaseParams struct {
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	LeaseToken pgtype.UUID `json:"lease_token"`
}

type ReplaceConnectionNeedBindingParams added in v0.4.0

type ReplaceConnectionNeedBindingParams struct {
	ResourceID         pgtype.UUID `json:"resource_id"`
	NeedID             pgtype.UUID `json:"need_id"`
	ExpectedResourceID pgtype.UUID `json:"expected_resource_id"`
}

type ReplaceExecEndpointNeedBindingParams added in v0.4.0

type ReplaceExecEndpointNeedBindingParams struct {
	ResourceID         pgtype.UUID `json:"resource_id"`
	NeedID             pgtype.UUID `json:"need_id"`
	ExpectedResourceID pgtype.UUID `json:"expected_resource_id"`
}

type ReplaceMCPServerNeedBindingParams added in v0.4.0

type ReplaceMCPServerNeedBindingParams struct {
	ResourceID         pgtype.UUID `json:"resource_id"`
	NeedID             pgtype.UUID `json:"need_id"`
	ExpectedResourceID pgtype.UUID `json:"expected_resource_id"`
}

type ReserveMCPActiveRequestParams added in v0.4.0

type ReserveMCPActiveRequestParams struct {
	TargetAgentID     pgtype.UUID `json:"target_agent_id"`
	PrincipalIdentity string      `json:"principal_identity"`
	RequestID         []byte      `json:"request_id"`
	TtlSeconds        int32       `json:"ttl_seconds"`
}

type ResolveBoundConnectionParams added in v0.4.0

type ResolveBoundConnectionParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ResolveBoundExecEndpointParams added in v0.4.0

type ResolveBoundExecEndpointParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ResolveBoundMCPServerParams added in v0.4.0

type ResolveBoundMCPServerParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type ResolvePrincipalNamesRow added in v0.4.0

type ResolvePrincipalNamesRow struct {
	ID   pgtype.UUID `json:"id"`
	Name string      `json:"name"`
}

type ResolveSuspendedSystemRunParams added in v0.4.0

type ResolveSuspendedSystemRunParams struct {
	ID             pgtype.UUID `json:"id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
}

type ResourceGrant added in v0.4.0

type ResourceGrant struct {
	ID              pgtype.UUID        `json:"id"`
	ConnectionID    pgtype.UUID        `json:"connection_id"`
	McpServerID     pgtype.UUID        `json:"mcp_server_id"`
	ExecEndpointID  pgtype.UUID        `json:"exec_endpoint_id"`
	GitCredentialID pgtype.UUID        `json:"git_credential_id"`
	GranteeID       pgtype.UUID        `json:"grantee_id"`
	Capabilities    []string           `json:"capabilities"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
}

type RetryScheduledFireParams added in v0.4.0

type RetryScheduledFireParams struct {
	BackoffSeconds int32       `json:"backoff_seconds"`
	LastError      string      `json:"last_error"`
	ID             pgtype.UUID `json:"id"`
	AgentID        pgtype.UUID `json:"agent_id"`
	LeaseToken     pgtype.UUID `json:"lease_token"`
}

type RevokeGrantParams added in v0.4.0

type RevokeGrantParams struct {
	UserID   pgtype.UUID `json:"user_id"`
	ClientID string      `json:"client_id"`
	AgentID  pgtype.UUID `json:"agent_id"`
}

type RevokeRefreshForGrantParams added in v0.4.0

type RevokeRefreshForGrantParams struct {
	UserID   pgtype.UUID `json:"user_id"`
	ClientID string      `json:"client_id"`
	AgentID  pgtype.UUID `json:"agent_id"`
}

type RevokeUserSessionByIDParams added in v0.4.0

type RevokeUserSessionByIDParams struct {
	ID     pgtype.UUID `json:"id"`
	UserID pgtype.UUID `json:"user_id"`
}

type RewrapAgentSecretParams added in v0.4.0

type RewrapAgentSecretParams struct {
	Field     string      `json:"field"`
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapBridgeSecretParams added in v0.4.0

type RewrapBridgeSecretParams struct {
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapConnectionSecretParams added in v0.4.0

type RewrapConnectionSecretParams struct {
	Field     string      `json:"field"`
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapEnvVarSecretParams added in v0.4.0

type RewrapEnvVarSecretParams struct {
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapExecSecretParams added in v0.4.0

type RewrapExecSecretParams struct {
	NewStored pgtype.Text `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored pgtype.Text `json:"old_stored"`
}

type RewrapGitCredentialSecretParams added in v0.4.0

type RewrapGitCredentialSecretParams struct {
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapMCPSecretParams added in v0.4.0

type RewrapMCPSecretParams struct {
	Field     string      `json:"field"`
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapOAuthStateSecretParams added in v0.4.0

type RewrapOAuthStateSecretParams struct {
	NewStored string `json:"new_stored"`
	RowKey    string `json:"row_key"`
	OldStored string `json:"old_stored"`
}

type RewrapProviderSecretParams added in v0.4.0

type RewrapProviderSecretParams struct {
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RewrapWebhookSecretParams added in v0.4.0

type RewrapWebhookSecretParams struct {
	NewStored string      `json:"new_stored"`
	RowKey    pgtype.UUID `json:"row_key"`
	OldStored string      `json:"old_stored"`
}

type RollbackMCPTaskResumeParams added in v0.4.0

type RollbackMCPTaskResumeParams struct {
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	TriggerRef string      `json:"trigger_ref"`
}

type RollbackPromptRunResumeParams added in v0.4.0

type RollbackPromptRunResumeParams struct {
	ID         pgtype.UUID `json:"id"`
	AgentID    pgtype.UUID `json:"agent_id"`
	TriggerRef string      `json:"trigger_ref"`
}

type RotateUserSessionRefreshTokenParams added in v0.4.0

type RotateUserSessionRefreshTokenParams struct {
	RefreshTokenHash []byte      `json:"refresh_token_hash"`
	ID               pgtype.UUID `json:"id"`
}

type Run

type Run struct {
	ID                   pgtype.UUID        `json:"id"`
	AgentID              pgtype.UUID        `json:"agent_id"`
	BridgeID             pgtype.UUID        `json:"bridge_id"`
	Status               string             `json:"status"`
	TriggerType          string             `json:"trigger_type"`
	TriggerRef           string             `json:"trigger_ref"`
	SourceRef            string             `json:"source_ref"`
	InputPayload         []byte             `json:"input_payload"`
	Actions              []byte             `json:"actions"`
	LlmCalls             int32              `json:"llm_calls"`
	LlmTokensIn          int32              `json:"llm_tokens_in"`
	LlmTokensOut         int32              `json:"llm_tokens_out"`
	LlmCostEstimate      pgtype.Numeric     `json:"llm_cost_estimate"`
	DurationMs           pgtype.Int4        `json:"duration_ms"`
	StdoutLog            string             `json:"stdout_log"`
	ErrorMessage         string             `json:"error_message"`
	ErrorKind            string             `json:"error_kind"`
	ExitCode             pgtype.Int4        `json:"exit_code"`
	PanicTrace           string             `json:"panic_trace"`
	Checkpoint           []byte             `json:"checkpoint"`
	Compacted            bool               `json:"compacted"`
	StartedAt            pgtype.Timestamptz `json:"started_at"`
	FinishedAt           pgtype.Timestamptz `json:"finished_at"`
	ParentRunID          pgtype.UUID        `json:"parent_run_id"`
	LlmTokensCached      int32              `json:"llm_tokens_cached"`
	CallerUserID         pgtype.UUID        `json:"caller_user_id"`
	CallerConversationID pgtype.UUID        `json:"caller_conversation_id"`
	CallerAccess         string             `json:"caller_access"`
}

type SetAgentBuildIntegrationTokenParams added in v0.4.0

type SetAgentBuildIntegrationTokenParams struct {
	IntegrationTokenHash      []byte             `json:"integration_token_hash"`
	IntegrationTokenExpiresAt pgtype.Timestamptz `json:"integration_token_expires_at"`
	ID                        pgtype.UUID        `json:"id"`
}

type SetAgentBuildModelParams added in v0.4.0

type SetAgentBuildModelParams struct {
	BuildModel string      `json:"build_model"`
	ID         pgtype.UUID `json:"id"`
}

type SetAgentEnvVarValueParams added in v0.2.12

type SetAgentEnvVarValueParams struct {
	ValueRef string      `json:"value_ref"`
	AgentID  pgtype.UUID `json:"agent_id"`
	Slug     string      `json:"slug"`
}

type SetAgentModelSlotAssignmentParams

type SetAgentModelSlotAssignmentParams struct {
	AssignedProviderID pgtype.UUID `json:"assigned_provider_id"`
	AssignedModel      string      `json:"assigned_model"`
	AgentID            pgtype.UUID `json:"agent_id"`
	Slug               string      `json:"slug"`
}

type SetConversationCheckpointParams

type SetConversationCheckpointParams struct {
	CheckpointMessageID pgtype.UUID `json:"checkpoint_message_id"`
	ConversationID      pgtype.UUID `json:"conversation_id"`
}

type SetExecEndpointHostKeyParams added in v0.4.0

type SetExecEndpointHostKeyParams struct {
	HostKeyOpenssh pgtype.Text `json:"host_key_openssh"`
	ID             pgtype.UUID `json:"id"`
}

type SetExecEndpointKeypairByIDParams added in v0.4.0

type SetExecEndpointKeypairByIDParams struct {
	PrivateKeyRef    pgtype.Text `json:"private_key_ref"`
	PublicKeyOpenssh pgtype.Text `json:"public_key_openssh"`
	PublicKeyComment pgtype.Text `json:"public_key_comment"`
	ID               pgtype.UUID `json:"id"`
}

type SetSystemConversationCheckpointParams added in v0.4.0

type SetSystemConversationCheckpointParams struct {
	Checkpoint     []byte      `json:"checkpoint"`
	SuspendedRunID pgtype.UUID `json:"suspended_run_id"`
	ID             pgtype.UUID `json:"id"`
}

type SetSystemConversationContextCheckpointParams added in v0.4.0

type SetSystemConversationContextCheckpointParams struct {
	CheckpointMessageID pgtype.UUID `json:"checkpoint_message_id"`
	ID                  pgtype.UUID `json:"id"`
}

type SetTempPasswordParams added in v0.4.0

type SetTempPasswordParams struct {
	PasswordHash pgtype.Text `json:"password_hash"`
	ID           pgtype.UUID `json:"id"`
}

type StageConnectionOAuthAppByIDParams added in v0.4.0

type StageConnectionOAuthAppByIDParams struct {
	ClientID     string      `json:"client_id"`
	ClientSecret string      `json:"client_secret"`
	ID           pgtype.UUID `json:"id"`
}

type StageMCPServerOAuthAppByIDParams added in v0.4.0

type StageMCPServerOAuthAppByIDParams struct {
	ClientID     string      `json:"client_id"`
	ClientSecret string      `json:"client_secret"`
	ID           pgtype.UUID `json:"id"`
}

type StartInitialAgentBuildParams added in v0.4.0

type StartInitialAgentBuildParams struct {
	ID                pgtype.UUID `json:"id"`
	AgentTokenVersion int64       `json:"agent_token_version"`
}

type StopAgentAndRotateTokenParams added in v0.4.0

type StopAgentAndRotateTokenParams struct {
	ID           pgtype.UUID `json:"id"`
	ErrorMessage string      `json:"error_message"`
}

type SubscribeTopicParams

type SubscribeTopicParams struct {
	TopicID        pgtype.UUID `json:"topic_id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
}

type SuspendSystemRunParams added in v0.4.0

type SuspendSystemRunParams struct {
	ID             pgtype.UUID `json:"id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
}

type SystemAudit added in v0.4.0

type SystemAudit struct {
	ID             int64              `json:"id"`
	UserID         pgtype.UUID        `json:"user_id"`
	ConversationID pgtype.UUID        `json:"conversation_id"`
	Tool           string             `json:"tool"`
	Args           []byte             `json:"args"`
	ResultSummary  string             `json:"result_summary"`
	Ok             bool               `json:"ok"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type SystemConversation added in v0.4.0

type SystemConversation struct {
	ID                         pgtype.UUID        `json:"id"`
	UserID                     pgtype.UUID        `json:"user_id"`
	Title                      string             `json:"title"`
	Status                     string             `json:"status"`
	Checkpoint                 []byte             `json:"checkpoint"`
	ContextCheckpointMessageID pgtype.UUID        `json:"context_checkpoint_message_id"`
	Settings                   []byte             `json:"settings"`
	CreatedAt                  pgtype.Timestamptz `json:"created_at"`
	UpdatedAt                  pgtype.Timestamptz `json:"updated_at"`
	Source                     string             `json:"source"`
	BridgeID                   pgtype.UUID        `json:"bridge_id"`
	ExternalID                 pgtype.Text        `json:"external_id"`
	SuspendedRunID             pgtype.UUID        `json:"suspended_run_id"`
}

type SystemMessage added in v0.4.0

type SystemMessage struct {
	ID             pgtype.UUID        `json:"id"`
	Seq            int64              `json:"seq"`
	ConversationID pgtype.UUID        `json:"conversation_id"`
	Role           string             `json:"role"`
	Source         string             `json:"source"`
	Content        string             `json:"content"`
	Parts          []byte             `json:"parts"`
	RunID          pgtype.UUID        `json:"run_id"`
	TokensIn       int32              `json:"tokens_in"`
	TokensOut      int32              `json:"tokens_out"`
	CostEstimate   pgtype.Numeric     `json:"cost_estimate"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type SystemRun added in v0.4.0

type SystemRun struct {
	ID              pgtype.UUID        `json:"id"`
	ConversationID  pgtype.UUID        `json:"conversation_id"`
	UserID          pgtype.UUID        `json:"user_id"`
	Status          string             `json:"status"`
	TriggerType     string             `json:"trigger_type"`
	ErrorMessage    string             `json:"error_message"`
	LlmCalls        int32              `json:"llm_calls"`
	LlmTokensIn     int64              `json:"llm_tokens_in"`
	LlmTokensOut    int64              `json:"llm_tokens_out"`
	LlmCostEstimate float64            `json:"llm_cost_estimate"`
	StartedAt       pgtype.Timestamptz `json:"started_at"`
	FinishedAt      pgtype.Timestamptz `json:"finished_at"`
}

type SystemSetting

type SystemSetting struct {
	ID                         bool               `json:"id"`
	DefaultBuildProviderID     pgtype.UUID        `json:"default_build_provider_id"`
	DefaultBuildModel          string             `json:"default_build_model"`
	DefaultExecProviderID      pgtype.UUID        `json:"default_exec_provider_id"`
	DefaultExecModel           string             `json:"default_exec_model"`
	DefaultSttProviderID       pgtype.UUID        `json:"default_stt_provider_id"`
	DefaultSttModel            string             `json:"default_stt_model"`
	DefaultVisionProviderID    pgtype.UUID        `json:"default_vision_provider_id"`
	DefaultVisionModel         string             `json:"default_vision_model"`
	DefaultTtsProviderID       pgtype.UUID        `json:"default_tts_provider_id"`
	DefaultTtsModel            string             `json:"default_tts_model"`
	DefaultImageGenProviderID  pgtype.UUID        `json:"default_image_gen_provider_id"`
	DefaultImageGenModel       string             `json:"default_image_gen_model"`
	DefaultEmbeddingProviderID pgtype.UUID        `json:"default_embedding_provider_id"`
	DefaultEmbeddingModel      string             `json:"default_embedding_model"`
	DefaultSearchProviderID    pgtype.UUID        `json:"default_search_provider_id"`
	DefaultSearchModel         string             `json:"default_search_model"`
	ActivationCode             pgtype.Text        `json:"activation_code"`
	CreatedAt                  pgtype.Timestamptz `json:"created_at"`
	UpdatedAt                  pgtype.Timestamptz `json:"updated_at"`
	LastSeenSdkVersion         string             `json:"last_seen_sdk_version"`
}

type Tenant

type Tenant struct {
	ID        pgtype.UUID        `json:"id"`
	Slug      string             `json:"slug"`
	Name      string             `json:"name"`
	Settings  []byte             `json:"settings"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type TopicSubscription

type TopicSubscription struct {
	ID             pgtype.UUID        `json:"id"`
	TopicID        pgtype.UUID        `json:"topic_id"`
	ConversationID pgtype.UUID        `json:"conversation_id"`
	CreatedAt      pgtype.Timestamptz `json:"created_at"`
}

type UnbindResourceNeedParams added in v0.4.0

type UnbindResourceNeedParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Type    string      `json:"type"`
	Slug    string      `json:"slug"`
}

type UnsubscribeTopicParams

type UnsubscribeTopicParams struct {
	TopicID        pgtype.UUID `json:"topic_id"`
	ConversationID pgtype.UUID `json:"conversation_id"`
}

type UpdateAgentA2ASettingsParams added in v0.4.0

type UpdateAgentA2ASettingsParams struct {
	McpEnabled        bool        `json:"mcp_enabled"`
	AllowPublicMcp    bool        `json:"allow_public_mcp"`
	AllowPublicRoutes bool        `json:"allow_public_routes"`
	ID                pgtype.UUID `json:"id"`
}

type UpdateAgentBuildCompleteParams

type UpdateAgentBuildCompleteParams struct {
	Status       string      `json:"status"`
	ErrorMessage string      `json:"error_message"`
	SourceRef    string      `json:"source_ref"`
	ImageRef     string      `json:"image_ref"`
	SdkVersion   string      `json:"sdk_version"`
	ExitStatus   string      `json:"exit_status"`
	ExitMessage  string      `json:"exit_message"`
	FailureKind  string      `json:"failure_kind"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateAgentBuildLogsParams

type UpdateAgentBuildLogsParams struct {
	SolLog    string      `json:"sol_log"`
	DockerLog string      `json:"docker_log"`
	LogSeq    int64       `json:"log_seq"`
	ID        pgtype.UUID `json:"id"`
}

type UpdateAgentBuildTodosParams added in v0.4.0

type UpdateAgentBuildTodosParams struct {
	Todos []byte      `json:"todos"`
	ID    pgtype.UUID `json:"id"`
}

type UpdateAgentConfigParams

type UpdateAgentConfigParams struct {
	Config []byte      `json:"config"`
	ID     pgtype.UUID `json:"id"`
}

type UpdateAgentDBPasswordParams added in v0.2.11

type UpdateAgentDBPasswordParams struct {
	DbPassword string      `json:"db_password"`
	ID         pgtype.UUID `json:"id"`
}

type UpdateAgentDescriptionParams

type UpdateAgentDescriptionParams struct {
	Description string      `json:"description"`
	ID          pgtype.UUID `json:"id"`
}

type UpdateAgentEmojiParams added in v0.4.0

type UpdateAgentEmojiParams struct {
	Emoji string      `json:"emoji"`
	ID    pgtype.UUID `json:"id"`
}

type UpdateAgentErrorMessageParams

type UpdateAgentErrorMessageParams struct {
	ErrorMessage string      `json:"error_message"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateAgentFieldsParams

type UpdateAgentFieldsParams struct {
	Name    string      `json:"name"`
	Slug    string      `json:"slug"`
	AutoFix bool        `json:"auto_fix"`
	ID      pgtype.UUID `json:"id"`
}

type UpdateAgentGitLastSyncedRefParams added in v0.4.0

type UpdateAgentGitLastSyncedRefParams struct {
	ID               pgtype.UUID `json:"id"`
	GitLastSyncedRef string      `json:"git_last_synced_ref"`
}

type UpdateAgentInstructionsParams added in v0.4.0

type UpdateAgentInstructionsParams struct {
	Instructions []byte      `json:"instructions"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateAgentModelsParams

type UpdateAgentModelsParams struct {
	BuildProviderID     pgtype.UUID `json:"build_provider_id"`
	BuildModel          string      `json:"build_model"`
	ExecProviderID      pgtype.UUID `json:"exec_provider_id"`
	ExecModel           string      `json:"exec_model"`
	SttProviderID       pgtype.UUID `json:"stt_provider_id"`
	SttModel            string      `json:"stt_model"`
	VisionProviderID    pgtype.UUID `json:"vision_provider_id"`
	VisionModel         string      `json:"vision_model"`
	TtsProviderID       pgtype.UUID `json:"tts_provider_id"`
	TtsModel            string      `json:"tts_model"`
	ImageGenProviderID  pgtype.UUID `json:"image_gen_provider_id"`
	ImageGenModel       string      `json:"image_gen_model"`
	EmbeddingProviderID pgtype.UUID `json:"embedding_provider_id"`
	EmbeddingModel      string      `json:"embedding_model"`
	SearchProviderID    pgtype.UUID `json:"search_provider_id"`
	SearchModel         string      `json:"search_model"`
	ID                  pgtype.UUID `json:"id"`
}

type UpdateAgentOwnerParams added in v0.4.0

type UpdateAgentOwnerParams struct {
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	ID               pgtype.UUID `json:"id"`
}

type UpdateAgentRefsParams

type UpdateAgentRefsParams struct {
	SourceRef string      `json:"source_ref"`
	ImageRef  string      `json:"image_ref"`
	ID        pgtype.UUID `json:"id"`
}

type UpdateAgentSDKVersionParams

type UpdateAgentSDKVersionParams struct {
	SdkVersion string      `json:"sdk_version"`
	ID         pgtype.UUID `json:"id"`
}

type UpdateAgentStatusParams

type UpdateAgentStatusParams struct {
	Status       string      `json:"status"`
	ErrorMessage string      `json:"error_message"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateAgentToolsHashParams added in v0.4.0

type UpdateAgentToolsHashParams struct {
	ToolsHash []byte      `json:"tools_hash"`
	ID        pgtype.UUID `json:"id"`
}

type UpdateAgentUpgradeStatusParams

type UpdateAgentUpgradeStatusParams struct {
	UpgradeStatus string      `json:"upgrade_status"`
	ErrorMessage  string      `json:"error_message"`
	ID            pgtype.UUID `json:"id"`
}

type UpdateBridgeBindingParams added in v0.4.0

type UpdateBridgeBindingParams struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	IsSystem  bool        `json:"is_system"`
	IsManager bool        `json:"is_manager"`
	ID        pgtype.UUID `json:"id"`
}

type UpdateBridgeIdentityParams added in v0.4.0

type UpdateBridgeIdentityParams struct {
	Name        string      `json:"name"`
	BotUsername string      `json:"bot_username"`
	ID          pgtype.UUID `json:"id"`
}

type UpdateBridgeLastPolledParams

type UpdateBridgeLastPolledParams struct {
	Config []byte      `json:"config"`
	ID     pgtype.UUID `json:"id"`
}

type UpdateBridgeStatusParams

type UpdateBridgeStatusParams struct {
	Status string      `json:"status"`
	ID     pgtype.UUID `json:"id"`
}

type UpdateConnectionCredentialsByIDParams added in v0.4.0

type UpdateConnectionCredentialsByIDParams struct {
	AccessTokenRef string             `json:"access_token_ref"`
	TokenExpiresAt pgtype.Timestamptz `json:"token_expires_at"`
	RefreshToken   string             `json:"refresh_token"`
	GrantedScopes  string             `json:"granted_scopes"`
	ScopesVerified bool               `json:"scopes_verified"`
	ID             pgtype.UUID        `json:"id"`
}

type UpdateConnectionOwnerByIDParams added in v0.4.0

type UpdateConnectionOwnerByIDParams struct {
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	ID               pgtype.UUID `json:"id"`
}

type UpdateConversationSettingsParams

type UpdateConversationSettingsParams struct {
	Patch []byte      `json:"patch"`
	ID    pgtype.UUID `json:"id"`
}

type UpdateCredentialSignCountParams added in v0.4.0

type UpdateCredentialSignCountParams struct {
	SignCount    int64  `json:"sign_count"`
	CloneWarning bool   `json:"clone_warning"`
	BackupState  bool   `json:"backup_state"`
	CredentialID []byte `json:"credential_id"`
}

type UpdateExecEndpointOwnerByIDParams added in v0.4.0

type UpdateExecEndpointOwnerByIDParams struct {
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	ID               pgtype.UUID `json:"id"`
}

type UpdateMCPServerCredentialsByIDParams added in v0.4.0

type UpdateMCPServerCredentialsByIDParams struct {
	AccessTokenRef string             `json:"access_token_ref"`
	TokenExpiresAt pgtype.Timestamptz `json:"token_expires_at"`
	RefreshToken   string             `json:"refresh_token"`
	GrantedScopes  string             `json:"granted_scopes"`
	ScopesVerified bool               `json:"scopes_verified"`
	ID             pgtype.UUID        `json:"id"`
}

type UpdateMCPServerDiscoveryByIDParams added in v0.4.0

type UpdateMCPServerDiscoveryByIDParams struct {
	AuthUrl              string      `json:"auth_url"`
	TokenUrl             string      `json:"token_url"`
	RegistrationEndpoint string      `json:"registration_endpoint"`
	ID                   pgtype.UUID `json:"id"`
}

type UpdateMCPServerOwnerByIDParams added in v0.4.0

type UpdateMCPServerOwnerByIDParams struct {
	OwnerPrincipalID pgtype.UUID `json:"owner_principal_id"`
	ID               pgtype.UUID `json:"id"`
}

type UpdateMCPServerToolSchemasByIDParams added in v0.4.0

type UpdateMCPServerToolSchemasByIDParams struct {
	ToolSchemas        []byte      `json:"tool_schemas"`
	ServerInstructions string      `json:"server_instructions"`
	ID                 pgtype.UUID `json:"id"`
}

type UpdateProviderParams

type UpdateProviderParams struct {
	DisplayName     string      `json:"display_name"`
	Slug            string      `json:"slug"`
	UpdateApiKey    bool        `json:"update_api_key"`
	ApiKey          string      `json:"api_key"`
	BaseUrl         string      `json:"base_url"`
	UpdateIsEnabled bool        `json:"update_is_enabled"`
	IsEnabled       bool        `json:"is_enabled"`
	ID              pgtype.UUID `json:"id"`
}

type UpdateRunCheckpointParams

type UpdateRunCheckpointParams struct {
	Checkpoint []byte      `json:"checkpoint"`
	ID         pgtype.UUID `json:"id"`
}

type UpdateRunCompleteParams

type UpdateRunCompleteParams struct {
	Status       string      `json:"status"`
	ErrorMessage string      `json:"error_message"`
	ErrorKind    string      `json:"error_kind"`
	Actions      []byte      `json:"actions"`
	StdoutLog    string      `json:"stdout_log"`
	PanicTrace   string      `json:"panic_trace"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateRunStatusParams

type UpdateRunStatusParams struct {
	Status string      `json:"status"`
	ID     pgtype.UUID `json:"id"`
}

type UpdateScheduleHandlerLastFiredParams added in v0.4.0

type UpdateScheduleHandlerLastFiredParams struct {
	AgentID pgtype.UUID `json:"agent_id"`
	Slug    string      `json:"slug"`
}

type UpdateSiblingMaxAccessParams added in v0.4.0

type UpdateSiblingMaxAccessParams struct {
	MaxAccess      string      `json:"max_access"`
	ParentAgentID  pgtype.UUID `json:"parent_agent_id"`
	SiblingAgentID pgtype.UUID `json:"sibling_agent_id"`
}

type UpdateSystemAuditResultParams added in v0.4.0

type UpdateSystemAuditResultParams struct {
	ResultSummary string `json:"result_summary"`
	Ok            bool   `json:"ok"`
	ID            int64  `json:"id"`
}

type UpdateSystemConversationSettingsParams added in v0.4.0

type UpdateSystemConversationSettingsParams struct {
	Patch []byte      `json:"patch"`
	ID    pgtype.UUID `json:"id"`
}

type UpdateSystemRunStatusParams added in v0.4.0

type UpdateSystemRunStatusParams struct {
	Status       string      `json:"status"`
	ErrorMessage string      `json:"error_message"`
	ID           pgtype.UUID `json:"id"`
}

type UpdateSystemSettingsParams

type UpdateSystemSettingsParams struct {
	DefaultBuildProviderID     pgtype.UUID `json:"default_build_provider_id"`
	DefaultBuildModel          string      `json:"default_build_model"`
	DefaultExecProviderID      pgtype.UUID `json:"default_exec_provider_id"`
	DefaultExecModel           string      `json:"default_exec_model"`
	DefaultSttProviderID       pgtype.UUID `json:"default_stt_provider_id"`
	DefaultSttModel            string      `json:"default_stt_model"`
	DefaultVisionProviderID    pgtype.UUID `json:"default_vision_provider_id"`
	DefaultVisionModel         string      `json:"default_vision_model"`
	DefaultTtsProviderID       pgtype.UUID `json:"default_tts_provider_id"`
	DefaultTtsModel            string      `json:"default_tts_model"`
	DefaultImageGenProviderID  pgtype.UUID `json:"default_image_gen_provider_id"`
	DefaultImageGenModel       string      `json:"default_image_gen_model"`
	DefaultEmbeddingProviderID pgtype.UUID `json:"default_embedding_provider_id"`
	DefaultEmbeddingModel      string      `json:"default_embedding_model"`
	DefaultSearchProviderID    pgtype.UUID `json:"default_search_provider_id"`
	DefaultSearchModel         string      `json:"default_search_model"`
}

type UpdateUserDisplayNameParams added in v0.4.0

type UpdateUserDisplayNameParams struct {
	DisplayName string      `json:"display_name"`
	ID          pgtype.UUID `json:"id"`
}

type UpdateUserPasswordAndRevokeSessionsParams added in v0.4.0

type UpdateUserPasswordAndRevokeSessionsParams struct {
	PasswordHash      pgtype.Text `json:"password_hash"`
	ID                pgtype.UUID `json:"id"`
	PreserveSessionID pgtype.UUID `json:"preserve_session_id"`
}

type UpdateUserRoleParams

type UpdateUserRoleParams struct {
	TenantRole string      `json:"tenant_role"`
	ID         pgtype.UUID `json:"id"`
}

type UpdateWebhookSecretParams

type UpdateWebhookSecretParams struct {
	Secret string      `json:"secret"`
	ID     pgtype.UUID `json:"id"`
}

type UpsertAgentEnvVarParams added in v0.2.12

type UpsertAgentEnvVarParams struct {
	AgentID      pgtype.UUID `json:"agent_id"`
	Slug         string      `json:"slug"`
	Description  string      `json:"description"`
	IsSecret     bool        `json:"is_secret"`
	DefaultValue string      `json:"default_value"`
	Pattern      string      `json:"pattern"`
}

type UpsertAgentGrantParams added in v0.4.0

type UpsertAgentGrantParams struct {
	AgentID   pgtype.UUID `json:"agent_id"`
	GranteeID pgtype.UUID `json:"grantee_id"`
	Role      string      `json:"role"`
}

type UpsertAgentModelSlotParams

type UpsertAgentModelSlotParams struct {
	AgentID     pgtype.UUID `json:"agent_id"`
	Slug        string      `json:"slug"`
	Capability  string      `json:"capability"`
	Description string      `json:"description"`
}

type UpsertAgentToolParams

type UpsertAgentToolParams struct {
	AgentID      pgtype.UUID `json:"agent_id"`
	Name         string      `json:"name"`
	Description  string      `json:"description"`
	LlmHint      string      `json:"llm_hint"`
	Access       string      `json:"access"`
	InputSchema  []byte      `json:"input_schema"`
	OutputSchema []byte      `json:"output_schema"`
}

type UpsertCachedAttachmentURLParams

type UpsertCachedAttachmentURLParams struct {
	CanonicalKey string             `json:"canonical_key"`
	Url          string             `json:"url"`
	ExpiresAt    pgtype.Timestamptz `json:"expires_at"`
}

type UpsertConnectionParams

type UpsertConnectionParams struct {
	AgentID           pgtype.UUID `json:"agent_id"`
	Slug              string      `json:"slug"`
	Name              string      `json:"name"`
	DisplayName       string      `json:"display_name"`
	Description       string      `json:"description"`
	LlmHint           string      `json:"llm_hint"`
	AuthMode          string      `json:"auth_mode"`
	AuthUrl           string      `json:"auth_url"`
	TokenUrl          string      `json:"token_url"`
	BaseUrl           string      `json:"base_url"`
	Scopes            string      `json:"scopes"`
	AuthInjection     []byte      `json:"auth_injection"`
	SetupInstructions string      `json:"setup_instructions"`
	TestPath          string      `json:"test_path"`
	Config            []byte      `json:"config"`
	AuthParams        []byte      `json:"auth_params"`
	Headers           []byte      `json:"headers"`
	Access            string      `json:"access"`
}

type UpsertDirectoryParams added in v0.2.0

type UpsertDirectoryParams struct {
	AgentID        pgtype.UUID `json:"agent_id"`
	Path           string      `json:"path"`
	ReadAccess     string      `json:"read_access"`
	WriteAccess    string      `json:"write_access"`
	ListAccess     string      `json:"list_access"`
	Description    string      `json:"description"`
	LlmHint        string      `json:"llm_hint"`
	RetentionHours int32       `json:"retention_hours"`
	Scope          string      `json:"scope"`
}

type UpsertExecEndpointDeclarationParams added in v0.4.0

type UpsertExecEndpointDeclarationParams struct {
	AgentID     pgtype.UUID `json:"agent_id"`
	Slug        string      `json:"slug"`
	DisplayName string      `json:"display_name"`
	Description string      `json:"description"`
	LlmHint     string      `json:"llm_hint"`
	Access      string      `json:"access"`
}

type UpsertGrantParams added in v0.4.0

type UpsertGrantParams struct {
	UserID    pgtype.UUID        `json:"user_id"`
	ClientID  string             `json:"client_id"`
	AgentID   pgtype.UUID        `json:"agent_id"`
	Scope     string             `json:"scope"`
	ExpiresAt pgtype.Timestamptz `json:"expires_at"`
}

type UpsertLockoutParams

type UpsertLockoutParams struct {
	Email       string             `json:"email"`
	Ip          string             `json:"ip"`
	LockedUntil pgtype.Timestamptz `json:"locked_until"`
	Tier        int32              `json:"tier"`
}

type UpsertMCPServerParams

type UpsertMCPServerParams struct {
	AgentID              pgtype.UUID `json:"agent_id"`
	Slug                 string      `json:"slug"`
	Name                 string      `json:"name"`
	DisplayName          string      `json:"display_name"`
	Url                  string      `json:"url"`
	AuthMode             string      `json:"auth_mode"`
	AuthUrl              string      `json:"auth_url"`
	TokenUrl             string      `json:"token_url"`
	RegistrationEndpoint string      `json:"registration_endpoint"`
	Scopes               string      `json:"scopes"`
	Access               string      `json:"access"`
	AuthInjection        []byte      `json:"auth_injection"`
}

type UpsertResourceNeedParams added in v0.4.0

type UpsertResourceNeedParams struct {
	AgentID           pgtype.UUID `json:"agent_id"`
	Type              string      `json:"type"`
	Slug              string      `json:"slug"`
	Description       string      `json:"description"`
	SetupInstructions string      `json:"setup_instructions"`
	ExpectedUrl       string      `json:"expected_url"`
	ExpectedScopes    string      `json:"expected_scopes"`
	Spec              []byte      `json:"spec"`
}

type UpsertRouteParams

type UpsertRouteParams struct {
	AgentID     pgtype.UUID `json:"agent_id"`
	Path        string      `json:"path"`
	Method      string      `json:"method"`
	Access      string      `json:"access"`
	Description string      `json:"description"`
}

type UpsertRunCompleteParams

type UpsertRunCompleteParams struct {
	ID           pgtype.UUID `json:"id"`
	AgentID      pgtype.UUID `json:"agent_id"`
	Status       string      `json:"status"`
	ErrorMessage string      `json:"error_message"`
	ErrorKind    string      `json:"error_kind"`
	Actions      []byte      `json:"actions"`
	StdoutLog    string      `json:"stdout_log"`
	PanicTrace   string      `json:"panic_trace"`
	Checkpoint   []byte      `json:"checkpoint"`
}

type UpsertScheduleHandlerParams added in v0.4.0

type UpsertScheduleHandlerParams struct {
	AgentID     pgtype.UUID `json:"agent_id"`
	Slug        string      `json:"slug"`
	Kind        string      `json:"kind"`
	Recurrence  string      `json:"recurrence"`
	TimeoutMs   int64       `json:"timeout_ms"`
	Description string      `json:"description"`
}

type UpsertTopicParams

type UpsertTopicParams struct {
	AgentID     pgtype.UUID `json:"agent_id"`
	Slug        string      `json:"slug"`
	Description string      `json:"description"`
	LlmHint     string      `json:"llm_hint"`
	Access      string      `json:"access"`
	PerUser     bool        `json:"per_user"`
}

type UpsertWebhookParams

type UpsertWebhookParams struct {
	AgentID      pgtype.UUID `json:"agent_id"`
	Path         string      `json:"path"`
	VerifyMode   string      `json:"verify_mode"`
	VerifyHeader string      `json:"verify_header"`
	TimeoutMs    int32       `json:"timeout_ms"`
	Description  string      `json:"description"`
}

type UsageByAgentRow added in v0.4.0

type UsageByAgentRow struct {
	AgentSlug    string  `json:"agent_slug"`
	AgentName    string  `json:"agent_name"`
	Deleted      bool    `json:"deleted"`
	OwnerEmail   string  `json:"owner_email"`
	OwnerName    string  `json:"owner_name"`
	Calls        int64   `json:"calls"`
	TokensIn     int64   `json:"tokens_in"`
	TokensOut    int64   `json:"tokens_out"`
	TokensCached int64   `json:"tokens_cached"`
	CostTotal    float64 `json:"cost_total"`
}

type UsageByModelRow added in v0.4.0

type UsageByModelRow struct {
	ProviderCatalogID string  `json:"provider_catalog_id"`
	ProviderSlug      string  `json:"provider_slug"`
	Model             string  `json:"model"`
	Calls             int64   `json:"calls"`
	TokensIn          int64   `json:"tokens_in"`
	TokensOut         int64   `json:"tokens_out"`
	CostTotal         float64 `json:"cost_total"`
}

type UsageByUserRow added in v0.4.0

type UsageByUserRow struct {
	UserEmail    string  `json:"user_email"`
	Deleted      bool    `json:"deleted"`
	Calls        int64   `json:"calls"`
	TokensIn     int64   `json:"tokens_in"`
	TokensOut    int64   `json:"tokens_out"`
	TokensCached int64   `json:"tokens_cached"`
	CostTotal    float64 `json:"cost_total"`
}

type UsageSummaryRow added in v0.4.0

type UsageSummaryRow struct {
	Calls        int64   `json:"calls"`
	TokensIn     int64   `json:"tokens_in"`
	TokensOut    int64   `json:"tokens_out"`
	TokensCached int64   `json:"tokens_cached"`
	CostTotal    float64 `json:"cost_total"`
}

type User

type User struct {
	ID                 pgtype.UUID        `json:"id"`
	Email              string             `json:"email"`
	DisplayName        string             `json:"display_name"`
	TenantRole         string             `json:"tenant_role"`
	PasswordHash       pgtype.Text        `json:"password_hash"`
	OidcSub            string             `json:"oidc_sub"`
	MustChangePassword bool               `json:"must_change_password"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	AuthEpoch          int64              `json:"auth_epoch"`
}

type UserSession added in v0.4.0

type UserSession struct {
	ID               pgtype.UUID        `json:"id"`
	UserID           pgtype.UUID        `json:"user_id"`
	Kind             string             `json:"kind"`
	ClientName       string             `json:"client_name"`
	DeviceName       string             `json:"device_name"`
	RefreshTokenHash []byte             `json:"refresh_token_hash"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	LastUsedAt       pgtype.Timestamptz `json:"last_used_at"`
	ExpiresAt        pgtype.Timestamptz `json:"expires_at"`
	RevokedAt        pgtype.Timestamptz `json:"revoked_at"`
	AuthenticatedAt  pgtype.Timestamptz `json:"authenticated_at"`
}

type WebauthnCeremony added in v0.4.0

type WebauthnCeremony struct {
	ID          pgtype.UUID        `json:"id"`
	UserID      pgtype.UUID        `json:"user_id"`
	Kind        string             `json:"kind"`
	SessionData []byte             `json:"session_data"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	ExpiresAt   pgtype.Timestamptz `json:"expires_at"`
}

type WebauthnCredential added in v0.4.0

type WebauthnCredential struct {
	ID              pgtype.UUID        `json:"id"`
	UserID          pgtype.UUID        `json:"user_id"`
	CredentialID    []byte             `json:"credential_id"`
	PublicKey       []byte             `json:"public_key"`
	AttestationType string             `json:"attestation_type"`
	Aaguid          []byte             `json:"aaguid"`
	SignCount       int64              `json:"sign_count"`
	Transports      []string           `json:"transports"`
	BackupEligible  bool               `json:"backup_eligible"`
	BackupState     bool               `json:"backup_state"`
	CloneWarning    bool               `json:"clone_warning"`
	FriendlyName    string             `json:"friendly_name"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	LastUsedAt      pgtype.Timestamptz `json:"last_used_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL