Documentation
¶
Index ¶
- Variables
- func GenerateToken(cfg JWTConfig, claims JWTClaims) (string, error)
- func SessionTenantCandidates(err error) []string
- type APIKey
- type APIKeyCreateResult
- type Agent
- type AgentBreakdownRow
- type AgentIntegration
- type AgentIntegrationRevision
- type AgentIntegrationTool
- type AgentIntegrationUpsertInput
- type AlertEvent
- type AlertRule
- type AnalyticsOverview
- type AuthSession
- type AuthSessionCreateInput
- type DecisionTotals
- type DecisionTrendBucket
- type EventDetail
- type EventListFilters
- type EventListItem
- type EventResult
- type Invite
- type InviteAcceptResult
- type JWTClaims
- type JWTConfig
- type OnboardingChecklist
- type OnboardingCreateStateInput
- type OnboardingCreateStateResult
- type PilotAction
- type PilotApprovalSummary
- type PilotConnectorFailure
- type PilotDenyReason
- type PilotEventSummary
- type PilotHealthSummary
- type PilotSessionSummary
- type PolicyVersion
- type RiskHeatmapRow
- type Session
- type SessionApprovalSummary
- type SessionExecutionSummary
- type SessionFilters
- type SessionTenantAmbiguityError
- type SessionTimelineEvent
- type Store
- func (s *Store) AlertEventExistsInWindow(ctx context.Context, tenantID, ruleID string, since time.Time) (bool, error)
- func (s *Store) AssignTenantRole(ctx context.Context, userID, tenantID, role string) error
- func (s *Store) AssignUserRole(ctx context.Context, userID string, tenantID *string, role string) error
- func (s *Store) AuthenticateUser(ctx context.Context, email, password string) (*User, []UserRole, error)
- func (s *Store) ClaimPendingAlertEventsDue(ctx context.Context, limit int) ([]AlertEvent, error)
- func (s *Store) ConsumeInviteAccept(ctx context.Context, token, password, name string) (*InviteAcceptResult, error)
- func (s *Store) ConsumePasswordReset(ctx context.Context, token, password string) error
- func (s *Store) CountDenyToolEventsInWindow(ctx context.Context, tenantID string, since time.Time) (int, error)
- func (s *Store) CountEventsInRange(ctx context.Context, tenantID string, since, until time.Time) (int, error)
- func (s *Store) CreateAPIKey(ctx context.Context, tenantID, name string, expiresAt *time.Time) (*APIKeyCreateResult, error)
- func (s *Store) CreateAgent(ctx context.Context, tenantID, name string) (*Agent, error)
- func (s *Store) CreateAgentWithLabels(ctx context.Context, tenantID, name string, labels json.RawMessage) (*Agent, error)
- func (s *Store) CreateAlertEvent(ctx context.Context, ruleID, tenantID, severity, message string, ...) (*AlertEvent, error)
- func (s *Store) CreateAlertRule(ctx context.Context, rule AlertRule) (*AlertRule, error)
- func (s *Store) CreateAuthSession(ctx context.Context, in AuthSessionCreateInput) (*AuthSession, error)
- func (s *Store) CreateInvite(ctx context.Context, token, email, tenantID, role, name string, ...) error
- func (s *Store) CreateOnboardingState(ctx context.Context, in OnboardingCreateStateInput) (*OnboardingCreateStateResult, error)
- func (s *Store) CreatePasswordReset(ctx context.Context, token, email string, expiresAt time.Time) error
- func (s *Store) CreatePolicyVersion(ctx context.Context, tenantID *string, ...) (*PolicyVersion, error)
- func (s *Store) CreateTenant(ctx context.Context, name string, config json.RawMessage) (*Tenant, error)
- func (s *Store) CreateUser(ctx context.Context, email, password, name, role string, tenantID *string, ...) (*User, error)
- func (s *Store) CreateUserBare(ctx context.Context, email string, password *string, name string, ...) (*User, error)
- func (s *Store) DeleteAlertRule(ctx context.Context, tenantID, ruleID string) error
- func (s *Store) ExportEventsCSV(ctx context.Context, tenantID string, since, until time.Time, w io.Writer) error
- func (s *Store) ExportSessionCSV(ctx context.Context, sessionID, tenantScope, tenantHint string, w io.Writer) error
- func (s *Store) GetAgentByTenantID(ctx context.Context, tenantID, agentID string) (*Agent, error)
- func (s *Store) GetAgentIntegration(ctx context.Context, tenantID, agentID string) (*AgentIntegration, error)
- func (s *Store) GetAlertRule(ctx context.Context, tenantID, ruleID string) (*AlertRule, error)
- func (s *Store) GetAnalyticsOverview(ctx context.Context, tenantID string, since time.Time) (*AnalyticsOverview, error)
- func (s *Store) GetDecisionTimeseries(ctx context.Context, tenantID string, since time.Time, bucketMinutes int) ([]map[string]any, error)
- func (s *Store) GetEventDetail(ctx context.Context, eventID string) (*EventDetail, error)
- func (s *Store) GetInvite(ctx context.Context, token string) (*Invite, error)
- func (s *Store) GetPolicyVersion(ctx context.Context, id int64) (*PolicyVersion, error)
- func (s *Store) GetSession(ctx context.Context, sessionID, tenantScope, tenantHint string) (*Session, error)
- func (s *Store) GetSessionTimeline(ctx context.Context, sessionID, tenantScope, tenantHint string) ([]SessionTimelineEvent, error)
- func (s *Store) GetTenant(ctx context.Context, id string) (*Tenant, error)
- func (s *Store) GetTenantAnalyticsSummary(ctx context.Context, tenantID string, since time.Time, bucketMinutes int, ...) (*TenantAnalyticsSummary, error)
- func (s *Store) GetTenantNotificationConfig(ctx context.Context, tenantID string) (*TenantNotificationConfig, bool, error)
- func (s *Store) GetTenantPolicyConfig(ctx context.Context, tenantID string) (*TenantPolicyConfig, bool, error)
- func (s *Store) GetUsageCounters(ctx context.Context, tenantID string, since time.Time) ([]UsageCounter, error)
- func (s *Store) GetUser(ctx context.Context, id string) (*User, error)
- func (s *Store) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (s *Store) GetUserBySlackUserID(ctx context.Context, slackUserID string) (*User, error)
- func (s *Store) GetUserRoleByID(ctx context.Context, userID, roleAssignmentID string) (*UserRole, error)
- func (s *Store) GetUserRoles(ctx context.Context, userID string) ([]UserRole, error)
- func (s *Store) IncrementUsageCounter(ctx context.Context, tenantID string, field string) error
- func (s *Store) ListAPIKeys(ctx context.Context, tenantID string) ([]APIKey, error)
- func (s *Store) ListActiveAuthSessionCounts(ctx context.Context, tenantID string) (map[string]int64, error)
- func (s *Store) ListAgentIntegrationRevisions(ctx context.Context, tenantID, agentID string, limit int) ([]AgentIntegrationRevision, error)
- func (s *Store) ListAgents(ctx context.Context, tenantID string, limit, offset int) ([]Agent, error)
- func (s *Store) ListAgentsFiltered(ctx context.Context, tenantID string, includeDisabled bool, limit, offset int) ([]Agent, error)
- func (s *Store) ListAlertEvents(ctx context.Context, tenantID string, limit, offset int) ([]AlertEvent, error)
- func (s *Store) ListAlertEventsSince(ctx context.Context, tenantID string, since time.Time, limit int) ([]AlertEvent, error)
- func (s *Store) ListAlertRules(ctx context.Context, tenantID string) ([]AlertRule, error)
- func (s *Store) ListAuthSessions(ctx context.Context, tenantID, userID string, limit, offset int) ([]AuthSession, error)
- func (s *Store) ListConnectors(ctx context.Context) ([]map[string]any, error)
- func (s *Store) ListEnabledDenySpikeRules(ctx context.Context) ([]AlertRule, error)
- func (s *Store) ListEventDetailsInRange(ctx context.Context, tenantID string, since, until time.Time, limit int) ([]EventDetail, error)
- func (s *Store) ListEvents(ctx context.Context, filters EventListFilters) ([]EventListItem, error)
- func (s *Store) ListEventsInRange(ctx context.Context, tenantID string, since, until time.Time, limit int) ([]EventListItem, error)
- func (s *Store) ListInvites(ctx context.Context, tenantID *string, limit, offset int) ([]Invite, error)
- func (s *Store) ListPolicyVersions(ctx context.Context, tenantID string, limit int) ([]PolicyVersion, error)
- func (s *Store) ListSessionTenantCandidates(ctx context.Context, sessionID string, limit int) ([]string, error)
- func (s *Store) ListSessions(ctx context.Context, filters SessionFilters) ([]Session, error)
- func (s *Store) ListTenantApprovers(ctx context.Context, tenantID string) ([]User, error)
- func (s *Store) ListTenants(ctx context.Context, limit, offset int) ([]Tenant, error)
- func (s *Store) ListUsers(ctx context.Context, tenantID *string, emailQuery string, limit, offset int) ([]User, error)
- func (s *Store) LookupAPIKey(ctx context.Context, rawKey string) (tenantID string, keyID string, err error)
- func (s *Store) MarkAlertEventPendingRetry(ctx context.Context, eventID string, attempts int, next time.Time, ...) error
- func (s *Store) MarkAlertEventSent(ctx context.Context, eventID string) error
- func (s *Store) PersistOnboardingIntegration(ctx context.Context, tenantID, agentID string, ...) (*AgentIntegration, error)
- func (s *Store) Pool() *pgxpool.Pool
- func (s *Store) RemoveTenantRole(ctx context.Context, userID, tenantID, role string) (bool, error)
- func (s *Store) RemoveUserRoleByID(ctx context.Context, userID, roleAssignmentID string) (bool, error)
- func (s *Store) RevokeAPIKeyForTenant(ctx context.Context, tenantID, keyID string) error
- func (s *Store) RevokeAuthSession(ctx context.Context, sessionID, tenantID, revokedBy string, now time.Time) (bool, error)
- func (s *Store) RotateAPIKeys(ctx context.Context, tenantID string) (*APIKeyCreateResult, error)
- func (s *Store) RotateAPIKeysPrimary(ctx context.Context, tenantID, name string, expiresAt *time.Time, ...) (*APIKeyCreateResult, error)
- func (s *Store) SetTenantNotificationConfig(ctx context.Context, tenantID string, cfg TenantNotificationConfig) error
- func (s *Store) SetTenantPolicyConfig(ctx context.Context, tenantID string, cfg TenantPolicyConfig) error
- func (s *Store) SetUserPassword(ctx context.Context, userID string, password string) error
- func (s *Store) SetUserSlackUserIDIfEmpty(ctx context.Context, userID string, slackUserID string) (bool, error)
- func (s *Store) TouchAuthSession(ctx context.Context, sessionID, userID string, seenAt time.Time) (bool, error)
- func (s *Store) UpdateAgentLabelsForTenant(ctx context.Context, tenantID, agentID string, labels json.RawMessage) error
- func (s *Store) UpdateAgentStatus(ctx context.Context, id, status string) error
- func (s *Store) UpdateAgentStatusForTenant(ctx context.Context, tenantID, agentID, status string) error
- func (s *Store) UpdateAlertRule(ctx context.Context, tenantID, id string, name string, ruleType string, ...) error
- func (s *Store) UpdateInviteEmailStatus(ctx context.Context, token, status string, sentAt *time.Time, ...) error
- func (s *Store) UpdateTenantStatus(ctx context.Context, id, status string) error
- func (s *Store) UpsertAgentIntegration(ctx context.Context, in AgentIntegrationUpsertInput) (*AgentIntegration, error)
- type Tenant
- type TenantAnalyticsSummary
- type TenantNotificationConfig
- type TenantPolicyConfig
- type UsageCounter
- type User
- type UserRole
Constants ¶
This section is empty.
Variables ¶
var ( ErrTenantNotFound = errors.New("tenant not found") ErrAgentNotFound = errors.New("agent not found") ErrAgentIntegrationNotFound = errors.New("agent integration not found") ErrAPIKeyNotFound = errors.New("api key not found") ErrAPIKeyAlreadyRevoked = errors.New("api key already revoked") ErrAlertRuleNotFound = errors.New("alert rule not found") ErrSessionTenantRequired = errors.New("tenant_id required for ambiguous session_id") ErrInviteTokenInvalid = errors.New("invalid or expired invite token") ErrResetTokenInvalid = errors.New("invalid or expired password reset token") ErrResetUserNotFound = errors.New("password reset token email does not map to a user") )
Functions ¶
func GenerateToken ¶
GenerateToken creates a new HS256 JWT token.
func SessionTenantCandidates ¶
Types ¶
type APIKey ¶
type APIKey struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
Name string `json:"name"`
KeyPrefix string `json:"key_prefix"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
IsPrimary bool `json:"is_primary"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
}
type APIKeyCreateResult ¶
type AgentBreakdownRow ¶
type AgentIntegration ¶
type AgentIntegration struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
AgentID string `json:"agent_id"`
Runtime string `json:"runtime"`
EnvironmentLabel string `json:"environment_label,omitempty"`
OwnerName string `json:"owner_name,omitempty"`
Description string `json:"description,omitempty"`
ApprovalPosture string `json:"approval_posture,omitempty"`
Tools []AgentIntegrationTool `json:"tools,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type AgentIntegrationRevision ¶
type AgentIntegrationRevision struct {
ID string `json:"id"`
IntegrationID string `json:"integration_id"`
TenantID string `json:"tenant_id"`
AgentID string `json:"agent_id"`
Mode string `json:"mode"`
Runtime string `json:"runtime"`
EnvironmentLabel string `json:"environment_label,omitempty"`
OwnerName string `json:"owner_name,omitempty"`
Description string `json:"description,omitempty"`
ApprovalPosture string `json:"approval_posture,omitempty"`
Tools []AgentIntegrationTool `json:"tools,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type AgentIntegrationTool ¶
type AlertEvent ¶
type AlertEvent struct {
ID string `json:"id"`
RuleID string `json:"rule_id"`
TenantID string `json:"tenant_id"`
Severity string `json:"severity"`
Message string `json:"message"`
ContextJSON json.RawMessage `json:"context_json,omitempty"`
Status string `json:"status"`
DeliveredAt *time.Time `json:"delivered_at,omitempty"`
AttemptCount int `json:"attempt_count"`
NextAttemptAt time.Time `json:"next_attempt_at,omitempty"`
LastError string `json:"last_error,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type AnalyticsOverview ¶
type AnalyticsOverview struct {
TotalEvents int64 `json:"total_events"`
AllowCount int64 `json:"allow_count"`
DenyCount int64 `json:"deny_count"`
ApproveCount int64 `json:"approve_count"`
PendingApprovals int64 `json:"pending_approvals"`
ActiveTenants int64 `json:"active_tenants"`
ActiveAgents int64 `json:"active_agents"`
}
type AuthSession ¶
type AuthSession struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Email string `json:"email"`
Name string `json:"name"`
TenantID string `json:"tenant_id,omitempty"`
Roles []string `json:"roles"`
UserAgent string `json:"user_agent,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastSeenAt time.Time `json:"last_seen_at"`
ExpiresAt time.Time `json:"expires_at"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
RevokedBy string `json:"revoked_by,omitempty"`
}
type AuthSessionCreateInput ¶
type DecisionTotals ¶
type DecisionTrendBucket ¶
type EventDetail ¶
type EventDetail struct {
EventListItem
PayloadJSON json.RawMessage `json:"payload_json"`
PolicyResult json.RawMessage `json:"policy_result,omitempty"`
Hash string `json:"hash"`
PrevHash string `json:"prev_hash"`
Result *EventResult `json:"result,omitempty"`
}
type EventListFilters ¶
type EventListItem ¶
type EventListItem struct {
EventID string `json:"event_id"`
TenantID string `json:"tenant_id"`
AgentID string `json:"agent_id"`
UserID string `json:"user_id,omitempty"`
UserName string `json:"user_name,omitempty"`
UserEmail string `json:"user_email,omitempty"`
Tool string `json:"tool"`
Action string `json:"action"`
Resource string `json:"resource"`
RiskScore int `json:"risk_score"`
Decision string `json:"decision"`
Reason string `json:"reason,omitempty"`
SessionID string `json:"session_id"`
TraceID string `json:"trace_id"`
ReceivedAt time.Time `json:"received_at"`
}
type EventResult ¶
type EventResult struct {
Status string `json:"status"`
OutputJSON json.RawMessage `json:"output_json,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
DurationMS int64 `json:"duration_ms"`
}
type Invite ¶
type Invite struct {
Token string `json:"token,omitempty"`
Email string `json:"email"`
TenantID string `json:"tenant_id"`
Role string `json:"role"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
EmailStatus string `json:"email_status,omitempty"`
EmailSentAt *time.Time `json:"email_sent_at,omitempty"`
EmailError string `json:"email_error,omitempty"`
}
type InviteAcceptResult ¶
type InviteAcceptResult struct {
User *User `json:"user"`
TenantID string `json:"tenant_id"`
Role string `json:"role"`
}
InviteAcceptResult is the structured response payload for the invite acceptance flow. It includes the created/updated user plus the assigned tenant-scoped role metadata.
type JWTClaims ¶
type JWTClaims struct {
Sub string `json:"sub"`
SID string `json:"sid,omitempty"`
Email string `json:"email"`
Name string `json:"name"`
Roles []string `json:"roles"`
Tenant string `json:"tenant,omitempty"`
Iss string `json:"iss"`
Iat int64 `json:"iat"`
Exp int64 `json:"exp"`
}
JWTClaims represents the claims in a JWT token.
type OnboardingChecklist ¶
type OnboardingCreateStateInput ¶
type OnboardingCreateStateInput struct {
ExistingTenantID string
NewTenantName string
AgentName string
APIKeyName string
APIKeyExpiresAt *time.Time
PolicyConfig *TenantPolicyConfig
Integration AgentIntegrationUpsertInput
}
type OnboardingCreateStateResult ¶
type OnboardingCreateStateResult struct {
Tenant *Tenant
CreatedTenant bool
Agent *Agent
APIKey *APIKeyCreateResult
Integration *AgentIntegration
}
type PilotAction ¶
type PilotApprovalSummary ¶
type PilotApprovalSummary struct {
RequestID string `json:"request_id"`
EventID string `json:"event_id"`
Tool string `json:"tool"`
Action string `json:"action"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
LatencyMS *int64 `json:"latency_ms,omitempty"`
}
type PilotConnectorFailure ¶
type PilotDenyReason ¶
type PilotEventSummary ¶
type PilotEventSummary struct {
EventID string `json:"event_id"`
AgentID string `json:"agent_id"`
Tool string `json:"tool"`
Action string `json:"action"`
Decision string `json:"decision"`
SessionID string `json:"session_id"`
TraceID string `json:"trace_id"`
ReceivedAt time.Time `json:"received_at"`
}
type PilotHealthSummary ¶
type PilotHealthSummary struct {
Status string `json:"status"`
StatusReason string `json:"status_reason"`
LastEvent *PilotEventSummary `json:"last_event,omitempty"`
LastSession *PilotSessionSummary `json:"last_session,omitempty"`
LastApproval *PilotApprovalSummary `json:"last_approval,omitempty"`
PendingApprovals int64 `json:"pending_approvals"`
OldestPendingApprovalAt *time.Time `json:"oldest_pending_approval_at,omitempty"`
ExecutionSuccessCount int64 `json:"execution_success_count"`
ExecutionTotal int64 `json:"execution_total"`
ExecutionSuccessRate float64 `json:"execution_success_rate"`
MissingSessionCount int64 `json:"missing_session_count"`
MissingTraceCount int64 `json:"missing_trace_count"`
MissingSessionRate float64 `json:"missing_session_rate"`
MissingTraceRate float64 `json:"missing_trace_rate"`
TopConnectorFailures []PilotConnectorFailure `json:"top_connector_failures"`
TopDenyReasons []PilotDenyReason `json:"top_deny_reasons"`
NextActions []PilotAction `json:"next_actions"`
}
type PilotSessionSummary ¶
type PolicyVersion ¶
type PolicyVersion struct {
ID int64 `json:"id"`
TenantID *string `json:"tenant_id,omitempty"`
BundleHash string `json:"bundle_hash"`
Version string `json:"version"`
PolicyData json.RawMessage `json:"policy_data,omitempty"`
DeployedBy string `json:"deployed_by,omitempty"`
DeployedAt time.Time `json:"deployed_at"`
Notes string `json:"notes,omitempty"`
}
type RiskHeatmapRow ¶
type Session ¶
type Session struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
AgentID string `json:"agent_id"`
UserID string `json:"user_id,omitempty"`
UserName string `json:"user_name,omitempty"`
UserEmail string `json:"user_email,omitempty"`
TraceID string `json:"trace_id,omitempty"`
StartedAt time.Time `json:"started_at"`
LastEventAt time.Time `json:"last_event_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
EventCount int64 `json:"event_count"`
AllowCount int64 `json:"allow_count"`
DenyCount int64 `json:"deny_count"`
ApproveCount int64 `json:"approve_count"`
LastEventID string `json:"last_event_id,omitempty"`
LastTool string `json:"last_tool,omitempty"`
LastAction string `json:"last_action,omitempty"`
LastDecision string `json:"last_decision,omitempty"`
LastResource string `json:"last_resource,omitempty"`
LastRiskScore int `json:"last_risk_score,omitempty"`
}
type SessionApprovalSummary ¶
type SessionExecutionSummary ¶
type SessionExecutionSummary struct {
EventID string `json:"event_id"`
ReceivedAt time.Time `json:"received_at"`
Status string `json:"status"`
OutputJSON json.RawMessage `json:"output_json,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
DurationMS int64 `json:"duration_ms"`
PolicyReason string `json:"policy_reason,omitempty"`
}
type SessionFilters ¶
type SessionTenantAmbiguityError ¶
type SessionTenantAmbiguityError struct {
Candidates []string
}
func (*SessionTenantAmbiguityError) Error ¶
func (e *SessionTenantAmbiguityError) Error() string
func (*SessionTenantAmbiguityError) Is ¶
func (e *SessionTenantAmbiguityError) Is(target error) bool
type SessionTimelineEvent ¶
type SessionTimelineEvent struct {
EventListItem
PolicyReason string `json:"policy_reason,omitempty"`
RiskFactors []string `json:"risk_factors,omitempty"`
Approval *SessionApprovalSummary `json:"approval,omitempty"`
Execution *SessionExecutionSummary `json:"execution,omitempty"`
Explain string `json:"explain"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AlertEventExistsInWindow ¶
func (*Store) AssignTenantRole ¶
AssignTenantRole inserts a role assignment into user_roles.
func (*Store) AssignUserRole ¶
func (s *Store) AssignUserRole(ctx context.Context, userID string, tenantID *string, role string) error
AssignUserRole assigns a user role for a tenant. For role='platform_admin', tenantID must be nil.
func (*Store) AuthenticateUser ¶
func (*Store) ClaimPendingAlertEventsDue ¶
func (*Store) ConsumeInviteAccept ¶
func (*Store) ConsumePasswordReset ¶
func (*Store) CountDenyToolEventsInWindow ¶
func (*Store) CountEventsInRange ¶
func (s *Store) CountEventsInRange(ctx context.Context, tenantID string, since, until time.Time) (int, error)
ListEventsInRange returns events for a tenant within a time range (for exports/bundles).
func (*Store) CreateAPIKey ¶
func (*Store) CreateAgent ¶
func (*Store) CreateAgentWithLabels ¶
func (*Store) CreateAlertEvent ¶
func (s *Store) CreateAlertEvent(ctx context.Context, ruleID, tenantID, severity, message string, contextJSON json.RawMessage) (*AlertEvent, error)
func (*Store) CreateAlertRule ¶
func (*Store) CreateAuthSession ¶
func (s *Store) CreateAuthSession(ctx context.Context, in AuthSessionCreateInput) (*AuthSession, error)
func (*Store) CreateInvite ¶
func (*Store) CreateOnboardingState ¶
func (s *Store) CreateOnboardingState(ctx context.Context, in OnboardingCreateStateInput) (*OnboardingCreateStateResult, error)
func (*Store) CreatePasswordReset ¶
func (*Store) CreatePolicyVersion ¶
func (s *Store) CreatePolicyVersion(ctx context.Context, tenantID *string, version, bundleHash, deployedBy, notes string, policyData json.RawMessage) (*PolicyVersion, error)
func (*Store) CreateTenant ¶
func (*Store) CreateUser ¶
func (*Store) CreateUserBare ¶
func (s *Store) CreateUserBare(ctx context.Context, email string, password *string, name string, slackUserID *string) (*User, error)
CreateUserBare creates a user record without assigning any roles. password may be nil to create a user without credentials (invite/reset flow).
func (*Store) DeleteAlertRule ¶
func (*Store) ExportEventsCSV ¶
func (*Store) ExportSessionCSV ¶
func (*Store) GetAgentByTenantID ¶
func (*Store) GetAgentIntegration ¶
func (*Store) GetAlertRule ¶
func (*Store) GetAnalyticsOverview ¶
func (*Store) GetDecisionTimeseries ¶
func (*Store) GetEventDetail ¶
func (*Store) GetPolicyVersion ¶
func (*Store) GetSession ¶
func (*Store) GetSessionTimeline ¶
func (*Store) GetTenantAnalyticsSummary ¶
func (*Store) GetTenantNotificationConfig ¶
func (*Store) GetTenantPolicyConfig ¶
func (*Store) GetUsageCounters ¶
func (s *Store) GetUsageCounters(ctx context.Context, tenantID string, since time.Time) ([]UsageCounter, error)
GetUsageCounters returns daily usage counters for a tenant since the given timestamp, ordered by date ascending.
func (*Store) GetUserByEmail ¶
GetUserByEmail returns the user for an email (case-insensitive).
func (*Store) GetUserBySlackUserID ¶
GetUserBySlackUserID returns the user linked to a Slack user id.
func (*Store) GetUserRoleByID ¶
func (s *Store) GetUserRoleByID(ctx context.Context, userID, roleAssignmentID string) (*UserRole, error)
GetUserRoleByID fetches a specific user_roles row by its assignment id.
func (*Store) GetUserRoles ¶
func (*Store) IncrementUsageCounter ¶
IncrementUsageCounter atomically increments a daily usage counter for the given tenant. Field must be one of: requests, approvals, executions, connector_calls.
func (*Store) ListAPIKeys ¶
func (*Store) ListActiveAuthSessionCounts ¶
func (*Store) ListAgentIntegrationRevisions ¶
func (*Store) ListAgents ¶
func (*Store) ListAgentsFiltered ¶
func (*Store) ListAlertEvents ¶
func (*Store) ListAlertEventsSince ¶
func (*Store) ListAlertRules ¶
func (*Store) ListAuthSessions ¶
func (*Store) ListConnectors ¶
func (*Store) ListEnabledDenySpikeRules ¶
func (*Store) ListEventDetailsInRange ¶
func (*Store) ListEvents ¶
func (s *Store) ListEvents(ctx context.Context, filters EventListFilters) ([]EventListItem, error)
func (*Store) ListEventsInRange ¶
func (s *Store) ListEventsInRange(ctx context.Context, tenantID string, since, until time.Time, limit int) ([]EventListItem, error)
ListEventsInRange returns events for a tenant within a time range (for exports/bundles).
func (*Store) ListInvites ¶
func (*Store) ListPolicyVersions ¶
func (*Store) ListSessionTenantCandidates ¶
func (*Store) ListSessions ¶
func (*Store) ListTenantApprovers ¶
ListTenantApprovers lists all users with role='approver' scoped to a tenant.
func (*Store) ListTenants ¶
func (*Store) LookupAPIKey ¶
func (*Store) MarkAlertEventPendingRetry ¶
func (*Store) MarkAlertEventSent ¶
func (*Store) PersistOnboardingIntegration ¶
func (s *Store) PersistOnboardingIntegration(ctx context.Context, tenantID, agentID string, integration AgentIntegrationUpsertInput) (*AgentIntegration, error)
func (*Store) Pool ¶
Pool exposes the underlying connection pool for ad-hoc queries (e.g., approval grant creation in the console-api).
func (*Store) RemoveTenantRole ¶
RemoveTenantRole removes a role assignment from user_roles.
func (*Store) RemoveUserRoleByID ¶
func (s *Store) RemoveUserRoleByID(ctx context.Context, userID, roleAssignmentID string) (bool, error)
RemoveUserRoleByID removes a user role assignment by its role assignment id.
func (*Store) RevokeAPIKeyForTenant ¶
func (*Store) RevokeAuthSession ¶
func (*Store) RotateAPIKeys ¶
func (*Store) RotateAPIKeysPrimary ¶
func (s *Store) RotateAPIKeysPrimary( ctx context.Context, tenantID, name string, expiresAt *time.Time, makePrimary bool, revokeOldPrimary bool, ) (*APIKeyCreateResult, error)
RotateAPIKeysPrimary implements the UX workflow: create new key -> (optionally) mark it as primary -> (optionally) revoke the previous active primary key.
func (*Store) SetTenantNotificationConfig ¶
func (*Store) SetTenantPolicyConfig ¶
func (*Store) SetUserPassword ¶
SetUserPassword updates the user's password (hashed) and ensures status is active.
func (*Store) SetUserSlackUserIDIfEmpty ¶
func (s *Store) SetUserSlackUserIDIfEmpty(ctx context.Context, userID string, slackUserID string) (bool, error)
SetUserSlackUserIDIfEmpty links a user to a Slack user id only if slack_user_id is currently NULL.
func (*Store) TouchAuthSession ¶
func (*Store) UpdateAgentLabelsForTenant ¶
func (*Store) UpdateAgentStatus ¶
func (*Store) UpdateAgentStatusForTenant ¶
func (*Store) UpdateAlertRule ¶
func (*Store) UpdateInviteEmailStatus ¶
func (*Store) UpdateTenantStatus ¶
func (*Store) UpsertAgentIntegration ¶
func (s *Store) UpsertAgentIntegration(ctx context.Context, in AgentIntegrationUpsertInput) (*AgentIntegration, error)
type TenantAnalyticsSummary ¶
type TenantAnalyticsSummary struct {
RangeStart time.Time `json:"range_start"`
RangeEnd time.Time `json:"range_end"`
Totals DecisionTotals `json:"totals"`
Trend []DecisionTrendBucket `json:"trend"`
RiskHeatmap []RiskHeatmapRow `json:"risk_heatmap"`
PerAgent []AgentBreakdownRow `json:"per_agent"`
OnboardingChecklist OnboardingChecklist `json:"onboarding_checklist"`
PilotHealth PilotHealthSummary `json:"pilot_health"`
}
type TenantNotificationConfig ¶
type TenantNotificationConfig struct {
ApproverGroup string `json:"approver_group,omitempty"`
Notify []types.PolicyNotify `json:"notify,omitempty"`
}
TenantNotificationConfig is the DB-persisted per-tenant routing config used to build approval notification outbox entries.
Stored inside tenants.config under `notification_config`.
type TenantPolicyConfig ¶
type TenantPolicyConfig struct {
MaxRiskAutoApprove int `json:"max_risk_auto_approve"`
ReadActions []string `json:"read_actions,omitempty"`
WriteActions []string `json:"write_actions,omitempty"`
DestructiveActions []string `json:"destructive_actions,omitempty"`
RequireDestructiveApproval bool `json:"require_destructive_approval"`
}
func (TenantPolicyConfig) ToPolicyInputMap ¶
func (c TenantPolicyConfig) ToPolicyInputMap() map[string]string