Documentation
¶
Index ¶
- Constants
- Variables
- func AdminOperationsUserSearch(filter OperationsFilter) string
- func AuditTimeWhere(alias string, filter OperationsFilter, args *[]any) string
- func GenerateAgentID() (string, error)
- func NewAgentID(now time.Time, entropy []byte) (string, error)
- func NormalizeAgentName(name string) (string, string, error)
- func NormalizeTeamSlug(raw string) string
- func UserActivityWhere(filter OperationsFilter) (string, []any)
- func ValidateTeamNamespace(namespace string) error
- func ValidateTeamSlug(slug string) error
- type APIKeySummary
- type Agent
- type AgentListFilter
- type AgentPage
- type AuditEvent
- type AuditLog
- type ImageActivity
- type OperationsFilter
- type OperationsFilterResponse
- type OperationsSnapshot
- type Principal
- type PrincipalTeam
- type RegistryPullCredential
- type Store
- func (s *Store) AbortImagePublication(ctx context.Context, publicationID string, ...) (apikit.ImagePublicationIntent, error)
- func (s *Store) AcceptTeamCreate(ctx context.Context, request TeamCreateAcceptanceRequest) (TeamOperationAcceptance, error)
- func (s *Store) ActivateEnrollmentIntent(ctx context.Context, opID string, req apikit.EnrollmentIntentActivateRequest) (apikit.EnrollmentIntent, error)
- func (s *Store) AgentCertificates(ctx context.Context, agentID, humanID string) (apikit.CertificateActivity, error)
- func (s *Store) AuthenticateJWT(token string) (Principal, bool)
- func (s *Store) AuthenticatePassword(ctx context.Context, email, password string) (User, bool, error)
- func (s *Store) AuthenticateRegistryCredential(ctx context.Context, username, password string) (Principal, bool, error)
- func (s *Store) AuthenticateRegistryPullCredential(ctx context.Context, username, password string) (registryauth.PullScope, bool, error)
- func (s *Store) AuthenticateUserAPIKey(ctx context.Context, rawKey string) (Principal, bool, error)
- func (s *Store) BeginImagePublication(ctx context.Context, req apikit.ImagePublicationBeginRequest) (apikit.ImagePublicationIntent, error)
- func (s *Store) ClaimAccessIntentObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.AccessIntentObserverLeaseResponse, error)
- func (s *Store) ClaimAgentCleanupIntentFence(ctx context.Context, agentID, workerID string) (apikit.AgentCleanupFenceResponse, error)
- func (s *Store) ClaimDeploymentIntentFence(ctx context.Context, deploymentID, workerID string) (apikit.DeploymentIntentFenceResponse, error)
- func (s *Store) ClaimEnrollmentIntentFence(ctx context.Context, opID, workerID string) (apikit.EnrollmentIntentFenceResponse, error)
- func (s *Store) ClaimGrantIntentFence(ctx context.Context, grantID, workerID string) (apikit.GrantIntentFenceResponse, error)
- func (s *Store) ClaimImagePublicationFence(ctx context.Context, publicationID, workerID string) (apikit.ImagePublicationFenceResponse, error)
- func (s *Store) ClaimRestartOperationFence(ctx context.Context, operationID, workerID string) (apikit.RestartOperationFenceResponse, error)
- func (s *Store) ClaimServerIntentFence(ctx context.Context, serverID, workerID string) (apikit.ServerIntentFenceResponse, error)
- func (s *Store) ClaimTeamIntentFence(ctx context.Context, teamID, workerID string) (apikit.TeamIntentFenceResponse, error)
- func (s *Store) ClaimTeamIntentObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.TeamIntentObserverLeaseResponse, error)
- func (s *Store) ClaimWorkloadObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.WorkloadObserverLeaseResponse, error)
- func (s *Store) Close() error
- func (s *Store) CompleteSessionEnrollment(ctx context.Context, namespace, name, uid string) error
- func (s *Store) CreateAccessToken(u User, ttl time.Duration) (string, error)
- func (s *Store) CreateAgent(ctx context.Context, teamSlug, name, createdBy string) (Agent, error)
- func (s *Store) CreateEnrollmentIntent(ctx context.Context, req apikit.EnrollmentIntentCreateRequest) (apikit.EnrollmentIntent, bool, error)
- func (s *Store) CreatePasswordUser(ctx context.Context, email, password, role string) (User, error)
- func (s *Store) CreateRegistryCredential(ctx context.Context, userID, name string) (APIKeySummary, string, error)
- func (s *Store) CreateRegistryPullCredential(ctx context.Context, scope registryauth.PullScope) (RegistryPullCredential, error)
- func (s *Store) CreateRestartOperation(ctx context.Context, req apikit.RestartOperationCreateRequest) (apikit.RestartOperationIntent, error)
- func (s *Store) CreateTeam(ctx context.Context, slug, name, createdByUserID string) (Team, error)
- func (s *Store) CreateTeamUser(ctx context.Context, teamSlug, email, password, role string) (User, TeamMembership, error)
- func (s *Store) CreateUserAPIKey(ctx context.Context, userID, name string) (APIKeySummary, string, error)
- func (s *Store) DeactivateUser(ctx context.Context, userID, actorID string, event AuditEvent) (apikit.UserDeactivationResult, error)
- func (s *Store) DeleteCredential(ctx context.Context, p passport.Principal, ns, kind, name string, ...) error
- func (s *Store) DeleteDeploymentIntent(ctx context.Context, deploymentID string, ...) (apikit.DeploymentIntent, error)
- func (s *Store) DeletePendingSession(ctx context.Context, namespace, name, uid, humanID string) error
- func (s *Store) DeleteSession(ctx context.Context, namespace, name string) error
- func (s *Store) DeleteSessionVersioned(ctx context.Context, namespace, name, uid string) error
- func (s *Store) DeleteTeamBySlug(ctx context.Context, slug string) error
- func (s *Store) DeleteTeamMembership(ctx context.Context, teamSlug, userID string) error
- func (s *Store) DeleteUser(ctx context.Context, userID string) error
- func (s *Store) EnsureOIDCUser(ctx context.Context, provider, subject, email, role string) (User, error)
- func (s *Store) EnsurePasswordUser(ctx context.Context, email, password string, role string) (User, error)
- func (s *Store) EnsureTeamPasswordUser(ctx context.Context, email, password string) (User, error)
- func (s *Store) FinalizeImagePublication(ctx context.Context, publicationID string, ...) (apikit.ImagePublicationIntent, error)
- func (s *Store) GetAgent(ctx context.Context, id string) (Agent, bool, error)
- func (s *Store) GetAgentCleanupIntent(ctx context.Context, agentID string) (apikit.AgentCleanupIntent, bool, error)
- func (s *Store) GetDeploymentIntent(ctx context.Context, deploymentID string) (apikit.DeploymentIntent, bool, error)
- func (s *Store) GetEnrollmentIntent(ctx context.Context, opID string) (apikit.EnrollmentIntent, bool, error)
- func (s *Store) GetGrantIntent(ctx context.Context, grantID string) (apikit.GrantIntent, bool, error)
- func (s *Store) GetImagePublicationIntent(ctx context.Context, publicationID string) (apikit.ImagePublicationIntent, bool, error)
- func (s *Store) GetNamespace(ctx context.Context, namespace string) (map[string]any, bool, error)
- func (s *Store) GetRestartOperationIntent(ctx context.Context, operationID string) (apikit.RestartOperationIntent, bool, error)
- func (s *Store) GetServerIntent(ctx context.Context, serverID string) (apikit.ServerIntent, bool, error)
- func (s *Store) GetSession(ctx context.Context, namespace, name string) (sessionstate.Session, bool, error)
- func (s *Store) GetTeamBySlug(ctx context.Context, slug string) (Team, bool, error)
- func (s *Store) GetTeamIntent(ctx context.Context, teamID string) (apikit.TeamNamespaceIntent, bool, error)
- func (s *Store) GetTeamOperation(ctx context.Context, operationID, actorID string) (TeamOperationAcceptance, bool, error)
- func (s *Store) GetUser(ctx context.Context, userID string) (User, bool, error)
- func (s *Store) ListAgents(ctx context.Context, filter AgentListFilter) (AgentPage, error)
- func (s *Store) ListAuditLogs(ctx context.Context, filter OperationsFilter) ([]AuditLog, error)
- func (s *Store) ListCredentials(ctx context.Context, p passport.Principal, ns, kind string) ([]json.RawMessage, error)
- func (s *Store) ListDeploymentIntents(ctx context.Context) ([]apikit.DeploymentIntent, error)
- func (s *Store) ListEnrollmentIntents(ctx context.Context) ([]apikit.EnrollmentIntent, error)
- func (s *Store) ListGrantIntents(ctx context.Context) ([]apikit.GrantIntent, error)
- func (s *Store) ListImageActivity(ctx context.Context, filter OperationsFilter) ([]ImageActivity, error)
- func (s *Store) ListImagePublicationIntents(ctx context.Context) ([]apikit.ImagePublicationIntent, error)
- func (s *Store) ListNamespaces(ctx context.Context) ([]map[string]any, error)
- func (s *Store) ListRegistryCredentials(ctx context.Context, userID string) ([]APIKeySummary, error)
- func (s *Store) ListRestartOperationIntents(ctx context.Context) ([]apikit.RestartOperationIntent, error)
- func (s *Store) ListServerIntents(ctx context.Context) ([]apikit.ServerIntent, error)
- func (s *Store) ListSessions(ctx context.Context, filter sessionstate.Filter) (sessionstate.Page, error)
- func (s *Store) ListTeamIntents(ctx context.Context) ([]apikit.TeamNamespaceIntent, error)
- func (s *Store) ListTeamMemberships(ctx context.Context, teamSlug string) ([]TeamMembership, error)
- func (s *Store) ListTeams(ctx context.Context) ([]Team, error)
- func (s *Store) ListUserAPIKeys(ctx context.Context, userID string) ([]APIKeySummary, error)
- func (s *Store) ListUserActivity(ctx context.Context, filter OperationsFilter) ([]UserActivity, error)
- func (s *Store) ListUserTeams(ctx context.Context, userID string) ([]TeamMembership, error)
- func (s *Store) OperationsSnapshot(ctx context.Context, filter OperationsFilter) (OperationsSnapshot, error)
- func (s *Store) OverviewCounts(ctx context.Context) (apikit.OverviewCounts, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) PrincipalForUserID(ctx context.Context, userID string) (Principal, error)
- func (s *Store) PutCredential(ctx context.Context, p passport.Principal, source *cb.Source, ...) (json.RawMessage, error)
- func (s *Store) PutSession(ctx context.Context, item sessionstate.Session) (sessionstate.Session, error)
- func (s *Store) RecordAgentCleanupIntentReceipt(ctx context.Context, agentID string, req apikit.AgentCleanupReceiptRequest) (apikit.AgentCleanupReceipt, error)
- func (s *Store) RecordDeploymentIntentObservation(ctx context.Context, deploymentID string, ...) (apikit.WorkloadStatusObservation, error)
- func (s *Store) RecordDeploymentIntentReceipt(ctx context.Context, deploymentID string, ...) (apikit.WorkloadExecutionReceipt, error)
- func (s *Store) RecordEnrollmentIntentReceipt(ctx context.Context, opID string, req apikit.EnrollmentIntentReceiptRequest) (apikit.EnrollmentReceipt, error)
- func (s *Store) RecordGrantIntentObservation(ctx context.Context, grantID string, req apikit.GrantIntentObservationRequest) (apikit.GrantObservation, error)
- func (s *Store) RecordGrantIntentReceipt(ctx context.Context, grantID string, req apikit.GrantIntentReceiptRequest) (apikit.GrantReceipt, error)
- func (s *Store) RecordImagePublicationReceipt(ctx context.Context, publicationID string, ...) (apikit.WorkloadExecutionReceipt, error)
- func (s *Store) RecordRestartComponentCheckpoint(ctx context.Context, operationID string, ...) (apikit.RestartOperationIntent, error)
- func (s *Store) RecordRestartOperationReceipt(ctx context.Context, operationID string, ...) (apikit.WorkloadExecutionReceipt, error)
- func (s *Store) RecordServerIntentObservation(ctx context.Context, serverID string, ...) (apikit.WorkloadStatusObservation, error)
- func (s *Store) RecordServerIntentReceipt(ctx context.Context, serverID string, req apikit.ServerIntentReceiptRequest) (apikit.WorkloadExecutionReceipt, error)
- func (s *Store) RecordServerRetirementCheckpoint(ctx context.Context, serverID string, ...) (apikit.ServerIntent, error)
- func (s *Store) RecordTeamIntentObservation(ctx context.Context, teamID string, req apikit.TeamIntentObservationRequest) (apikit.TeamNamespaceObservation, error)
- func (s *Store) RecordTeamIntentReceipt(ctx context.Context, teamID string, req apikit.TeamIntentReceiptRequest) (apikit.TeamNamespaceReceipt, error)
- func (s *Store) RenameAgent(ctx context.Context, id, name string) (Agent, error)
- func (s *Store) ResolveTeamIDs(ctx context.Context, ids []string) (map[string]string, error)
- func (s *Store) ResolveUserIDs(ctx context.Context, ids []string) (map[string]string, error)
- func (s *Store) RetireServerIntent(ctx context.Context, serverID string, req apikit.ServerIntentRetireRequest) (apikit.ServerIntent, error)
- func (s *Store) RevokeGrantIntent(ctx context.Context, grantID string, deleteGrant bool) (apikit.GrantIntent, error)
- func (s *Store) RevokeRegistryCredential(ctx context.Context, userID, id string) (APIKeySummary, error)
- func (s *Store) RevokeRegistryPullCredential(ctx context.Context, id string) error
- func (s *Store) RevokeSessions(ctx context.Context, filter sessionstate.Filter, cause string) (int64, error)
- func (s *Store) RevokeUserAPIKey(ctx context.Context, userID, id string) (APIKeySummary, error)
- func (s *Store) SessionChanges(ctx context.Context, server sessionstate.Server, epoch string, after int64) (sessionstate.Changes, error)
- func (s *Store) SessionSnapshot(ctx context.Context, server sessionstate.Server) (sessionstate.Snapshot, error)
- func (s *Store) SetAgentStatus(ctx context.Context, id, status, actorID string) (Agent, error)
- func (s *Store) SetSessionRevoked(ctx context.Context, namespace, name string, revoked bool, cause string) error
- func (s *Store) UpsertDeploymentIntent(ctx context.Context, req apikit.DeploymentIntentUpsertRequest) (apikit.DeploymentIntent, error)
- func (s *Store) UpsertGrantIntent(ctx context.Context, req apikit.GrantIntentUpsertRequest) (apikit.GrantIntent, error)
- func (s *Store) UpsertServerIntent(ctx context.Context, req apikit.ServerIntentUpsertRequest) (apikit.ServerIntent, error)
- func (s *Store) UpsertTeamMembership(ctx context.Context, teamSlug, userID, role string) (TeamMembership, error)
- func (s *Store) UseCredentials(ctx context.Context, server sessionstate.Server, request cb.ResolutionRequest, ...) (cb.Delivery, error)
- func (s *Store) WriteAudit(ctx context.Context, ev AuditEvent)
- type Team
- type TeamCreateAcceptanceRequest
- type TeamMembership
- type TeamOperationAcceptance
- type User
- type UserActivity
- type UserInputError
Constants ¶
const ( // RoleAdmin is the platform-wide administrator role. RoleAdmin = "admin" // RoleUser is the regular signed-in platform user role. RoleUser = "user" )
const ( // TeamNamespacePrefix is prepended to normalized team slugs for managed namespaces. TeamNamespacePrefix = "mcp-team-" // TeamRoleOwner grants team administration privileges. TeamRoleOwner = "owner" // TeamRoleMember grants regular team membership privileges. TeamRoleMember = "member" // NamespaceScopeUser marks a namespace owned by a single platform user. NamespaceScopeUser = "user" // NamespaceScopeTeam marks a namespace owned by a platform team. NamespaceScopeTeam = "team" )
const OIDCProviderPrefix = "oidc:"
OIDCProviderPrefix prefixes provider names stored for OIDC identities.
Variables ¶
var ( ErrAgentNotFound = errors.New("agent not found") ErrAgentNameTaken = errors.New("agent name already exists in team") ErrInvalidAgentName = errors.New("agent name must contain 1 to 64 characters") )
var ( ErrSelfDeactivation = errors.New("cannot deactivate the signed-in administrator") ErrLastAdministrator = errors.New("cannot deactivate the last active administrator; create another administrator first") ErrLastTeamOwner = errors.New("cannot deactivate a team's last active owner; transfer team ownership first") ErrAccountInactive = errors.New("platform account is deactivated") ErrActorInactive = errors.New("administrator account is no longer active") )
var ErrEmailAlreadyRegistered = errors.New("a user with this email already exists; add them as a member instead")
ErrEmailAlreadyRegistered is safe to report without exposing SQL or user data.
Functions ¶
func AdminOperationsUserSearch ¶
func AdminOperationsUserSearch(filter OperationsFilter) string
AdminOperationsUserSearch returns a normalized user search string for operations filters.
func AuditTimeWhere ¶
func AuditTimeWhere(alias string, filter OperationsFilter, args *[]any) string
AuditTimeWhere adds audit timestamp predicates to an existing argument list.
func GenerateAgentID ¶
func NewAgentID ¶
NewAgentID returns a platform-generated ID with a lowercase ULID suffix.
func NormalizeAgentName ¶
NormalizeAgentName applies the directory's stable whitespace and case rule.
func NormalizeTeamSlug ¶
NormalizeTeamSlug trims and lowercases a team slug.
func UserActivityWhere ¶
func UserActivityWhere(filter OperationsFilter) (string, []any)
UserActivityWhere builds the SQL WHERE clause and arguments for user activity queries.
func ValidateTeamNamespace ¶
ValidateTeamNamespace validates a managed team namespace name.
func ValidateTeamSlug ¶
ValidateTeamSlug validates the normalized slug used for team URLs and names.
Types ¶
type APIKeySummary ¶
type APIKeySummary struct {
ID string `json:"id"`
Name string `json:"name"`
Prefix string `json:"prefix"`
CreatedAt time.Time `json:"created_at"`
Revoked bool `json:"revoked"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
}
APIKeySummary is the non-secret metadata for a user API key or registry credential.
type Agent ¶
type Agent struct {
ID string `json:"id"`
TeamID string `json:"team_id"`
TeamSlug string `json:"team_slug"`
Name string `json:"name"`
Status string `json:"status"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeactivatedAt *time.Time `json:"deactivated_at,omitempty"`
DeactivatedBy string `json:"deactivated_by,omitempty"`
}
Agent is a team-owned governance record for attributing MCP actions.
type AgentListFilter ¶
AgentListFilter bounds and filters an agent directory query.
type AgentPage ¶
type AgentPage struct {
Agents []Agent `json:"agents"`
NextCursor string `json:"next_cursor,omitempty"`
}
AgentPage is a bounded page of agent records.
type AuditEvent ¶
type AuditEvent struct {
UserID string `json:"user_id,omitempty"`
Action string `json:"action"`
Resource string `json:"resource"`
Namespace string `json:"namespace,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
ActorIP string `json:"actor_ip,omitempty"`
RequestID string `json:"request_id,omitempty"`
Source string `json:"source,omitempty"`
AuthIdentity string `json:"auth_identity,omitempty"`
ImageRef string `json:"image_ref,omitempty"`
ServerName string `json:"server_name,omitempty"`
DeploymentTarget string `json:"deployment_target,omitempty"`
AgentID string `json:"agent_id,omitempty"`
TeamID string `json:"team_id,omitempty"`
}
AuditEvent is the write-side platform audit envelope.
type AuditLog ¶
type AuditLog struct {
ID int64 `json:"id"`
UserID string `json:"user_id,omitempty"`
Email string `json:"email,omitempty"`
Action string `json:"action"`
Resource string `json:"resource"`
Namespace string `json:"namespace,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
ActorIP string `json:"actor_ip,omitempty"`
RequestID string `json:"request_id,omitempty"`
Source string `json:"source,omitempty"`
AuthIdentity string `json:"auth_identity,omitempty"`
ImageRef string `json:"image_ref,omitempty"`
ServerName string `json:"server_name,omitempty"`
DeploymentTarget string `json:"deployment_target,omitempty"`
AgentID string `json:"agent_id,omitempty"`
TeamID string `json:"team_id,omitempty"`
TraceID string `json:"trace_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
AuditLog is the read-side platform audit record returned to administrators.
type ImageActivity ¶
type ImageActivity struct {
UserID string `json:"user_id,omitempty"`
Email string `json:"email,omitempty"`
Namespace string `json:"namespace,omitempty"`
ImageRef string `json:"image_ref"`
SourceImage string `json:"source_image,omitempty"`
ServerName string `json:"server_name,omitempty"`
DeploymentTarget string `json:"deployment_target,omitempty"`
Action string `json:"action"`
Status string `json:"status"`
Source string `json:"source,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
ImageActivity describes an image publish or deploy-related audit entry.
type OperationsFilter ¶
type OperationsFilter struct {
User string
UserSearch string
// TraceID limits audit entries to one W3C trace (32 lowercase hex digits).
TraceID string
Since time.Time
Until time.Time
Limit int
}
OperationsFilter constrains platform operations and activity queries.
type OperationsFilterResponse ¶
type OperationsFilterResponse struct {
User string `json:"user,omitempty"`
Since string `json:"since,omitempty"`
Until string `json:"until,omitempty"`
Limit int `json:"limit"`
}
OperationsFilterResponse is the API echo of an operations filter.
type OperationsSnapshot ¶
type OperationsSnapshot struct {
Users []UserActivity `json:"users"`
AuditLogs []AuditLog `json:"audit_logs"`
Images []ImageActivity `json:"images"`
}
OperationsSnapshot bundles platform activity for internal operations queries.
type PrincipalTeam ¶
type PrincipalTeam = passport.PrincipalTeam
type RegistryPullCredential ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns platform identity, API key, team, namespace, and audit persistence.
func NewForTest ¶
NewForTest returns an in-memory Store shell for tests that stub persistence.
func NewStoreWithDB ¶
NewStoreWithDB binds a Store to an existing database. Tests use it to observe SQL without opening Postgres.
func Open ¶
func Open(ctx context.Context, dsn string, signer passport.Signer, verifier passport.Verifier) (*Store, error)
Open connects to Postgres, applies schema migrations, and returns a Store.
func (*Store) AbortImagePublication ¶
func (s *Store) AbortImagePublication(ctx context.Context, publicationID string, req apikit.ImagePublicationAbortRequest) (apikit.ImagePublicationIntent, error)
func (*Store) AcceptTeamCreate ¶
func (s *Store) AcceptTeamCreate(ctx context.Context, request TeamCreateAcceptanceRequest) (TeamOperationAcceptance, error)
AcceptTeamCreate commits a team, owner membership, namespace intent, operation, and River job together. A replay never changes the accepted contents or IDs.
func (*Store) ActivateEnrollmentIntent ¶
func (s *Store) ActivateEnrollmentIntent(ctx context.Context, opID string, req apikit.EnrollmentIntentActivateRequest) (apikit.EnrollmentIntent, error)
ActivateEnrollmentIntent atomically re-verifies session/agent/server authority before activating an issued enrollment.
func (*Store) AgentCertificates ¶
func (s *Store) AgentCertificates(ctx context.Context, agentID, humanID string) (apikit.CertificateActivity, error)
AgentCertificates reads recorded issuance independently of directory/session data. humanID is an exact visibility constraint, not a search expression.
func (*Store) AuthenticateJWT ¶
AuthenticateJWT validates a platform JWT and resolves it to the current principal.
func (*Store) AuthenticatePassword ¶
func (s *Store) AuthenticatePassword(ctx context.Context, email, password string) (User, bool, error)
AuthenticatePassword validates password-login credentials and returns the matching user.
func (*Store) AuthenticateRegistryCredential ¶
func (s *Store) AuthenticateRegistryCredential(ctx context.Context, username, password string) (Principal, bool, error)
AuthenticateRegistryCredential validates Docker registry basic-auth credentials. It supports both registry-specific API keys (mcpr_ prefix) and regular platform passwords.
func (*Store) AuthenticateRegistryPullCredential ¶
func (*Store) AuthenticateUserAPIKey ¶
AuthenticateUserAPIKey validates a user API key and resolves its principal.
func (*Store) BeginImagePublication ¶
func (s *Store) BeginImagePublication(ctx context.Context, req apikit.ImagePublicationBeginRequest) (apikit.ImagePublicationIntent, error)
func (*Store) ClaimAccessIntentObserverLease ¶
func (s *Store) ClaimAccessIntentObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.AccessIntentObserverLeaseResponse, error)
ClaimAccessIntentObserverLease increments the monotonic observer epoch for access intent status observation.
func (*Store) ClaimAgentCleanupIntentFence ¶
func (s *Store) ClaimAgentCleanupIntentFence(ctx context.Context, agentID, workerID string) (apikit.AgentCleanupFenceResponse, error)
ClaimAgentCleanupIntentFence increments the agent cleanup execution fence.
func (*Store) ClaimDeploymentIntentFence ¶
func (*Store) ClaimEnrollmentIntentFence ¶
func (s *Store) ClaimEnrollmentIntentFence(ctx context.Context, opID, workerID string) (apikit.EnrollmentIntentFenceResponse, error)
ClaimEnrollmentIntentFence increments the enrollment operation's execution fence and returns authoritative operation state.
func (*Store) ClaimGrantIntentFence ¶
func (s *Store) ClaimGrantIntentFence(ctx context.Context, grantID, workerID string) (apikit.GrantIntentFenceResponse, error)
ClaimGrantIntentFence increments the grant's worker execution fence and returns its authoritative desired state.
func (*Store) ClaimImagePublicationFence ¶
func (*Store) ClaimRestartOperationFence ¶
func (*Store) ClaimServerIntentFence ¶
func (*Store) ClaimTeamIntentFence ¶
func (s *Store) ClaimTeamIntentFence(ctx context.Context, teamID, workerID string) (apikit.TeamIntentFenceResponse, error)
ClaimTeamIntentFence increments the team's worker execution fence and returns its authoritative desired state.
func (*Store) ClaimTeamIntentObserverLease ¶
func (s *Store) ClaimTeamIntentObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.TeamIntentObserverLeaseResponse, error)
ClaimTeamIntentObserverLease increments the monotonic status observer epoch.
func (*Store) ClaimWorkloadObserverLease ¶
func (s *Store) ClaimWorkloadObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.WorkloadObserverLeaseResponse, error)
ClaimWorkloadObserverLease increments the monotonic workload status observer epoch.
func (*Store) CompleteSessionEnrollment ¶
CompleteSessionEnrollment updates metadata under the same lock as revocation and deletion. Authorization fields always come from the current stored row.
func (*Store) CreateAccessToken ¶
CreateAccessToken signs a short-lived platform JWT for a user.
func (*Store) CreateAgent ¶
CreateAgent creates an active, team-owned agent with an immutable platform ID.
func (*Store) CreateEnrollmentIntent ¶
func (s *Store) CreateEnrollmentIntent(ctx context.Context, req apikit.EnrollmentIntentCreateRequest) (apikit.EnrollmentIntent, bool, error)
CreateEnrollmentIntent idempotently records a durable adapter enrollment operation keyed to (session_uid, server_uid, csr_sha256).
func (*Store) CreatePasswordUser ¶
CreatePasswordUser creates a password-login platform account with the requested role.
func (*Store) CreateRegistryCredential ¶
func (s *Store) CreateRegistryCredential(ctx context.Context, userID, name string) (APIKeySummary, string, error)
CreateRegistryCredential creates a registry credential and returns its one-time raw value.
func (*Store) CreateRegistryPullCredential ¶
func (s *Store) CreateRegistryPullCredential(ctx context.Context, scope registryauth.PullScope) (RegistryPullCredential, error)
func (*Store) CreateRestartOperation ¶
func (s *Store) CreateRestartOperation(ctx context.Context, req apikit.RestartOperationCreateRequest) (apikit.RestartOperationIntent, error)
func (*Store) CreateTeam ¶
CreateTeam creates a team, its namespace record, and an owner membership.
func (*Store) CreateTeamUser ¶
func (s *Store) CreateTeamUser(ctx context.Context, teamSlug, email, password, role string) (User, TeamMembership, error)
CreateTeamUser atomically creates a password account and its team membership.
func (*Store) CreateUserAPIKey ¶
func (s *Store) CreateUserAPIKey(ctx context.Context, userID, name string) (APIKeySummary, string, error)
CreateUserAPIKey creates a user API key and returns its one-time raw value.
func (*Store) DeactivateUser ¶
func (s *Store) DeactivateUser(ctx context.Context, userID, actorID string, event AuditEvent) (apikit.UserDeactivationResult, error)
DeactivateUser irreversibly disables an account, preserving its identity and audit tombstone. Session revocations use the normal versioned change log. Lock order is session state, users, memberships, then individual session rows.
func (*Store) DeleteCredential ¶
func (*Store) DeleteDeploymentIntent ¶
func (s *Store) DeleteDeploymentIntent(ctx context.Context, deploymentID string, req apikit.DeploymentIntentDeleteRequest) (apikit.DeploymentIntent, error)
func (*Store) DeletePendingSession ¶
func (*Store) DeleteSession ¶
func (*Store) DeleteSessionVersioned ¶
DeleteSessionVersioned protects retirement snapshots from deleting a newer session that was recreated with the same namespace/name after the scan.
func (*Store) DeleteTeamBySlug ¶
DeleteTeamBySlug soft-deletes a team and its derived namespace/membership records.
func (*Store) DeleteTeamMembership ¶
DeleteTeamMembership soft-deletes a user's active team membership.
func (*Store) DeleteUser ¶
DeleteUser deletes a platform user by id.
func (*Store) EnsureOIDCUser ¶
func (s *Store) EnsureOIDCUser(ctx context.Context, provider, subject, email, role string) (User, error)
EnsureOIDCUser binds an OIDC subject to a platform account, creating it when needed.
func (*Store) EnsurePasswordUser ¶
func (s *Store) EnsurePasswordUser(ctx context.Context, email, password string, role string) (User, error)
EnsurePasswordUser creates or updates a password-login account for a fixed role.
func (*Store) EnsureTeamPasswordUser ¶
EnsureTeamPasswordUser ensures a regular password-login account exists for team membership flows. Existing platform roles are preserved so an admin is not accidentally demoted when they are added to a team.
func (*Store) FinalizeImagePublication ¶
func (s *Store) FinalizeImagePublication(ctx context.Context, publicationID string, req apikit.ImagePublicationFinalizeRequest) (apikit.ImagePublicationIntent, error)
func (*Store) GetAgentCleanupIntent ¶
func (s *Store) GetAgentCleanupIntent(ctx context.Context, agentID string) (apikit.AgentCleanupIntent, bool, error)
GetAgentCleanupIntent returns durable post-deactivation cleanup state for an agent.
func (*Store) GetDeploymentIntent ¶
func (*Store) GetEnrollmentIntent ¶
func (s *Store) GetEnrollmentIntent(ctx context.Context, opID string) (apikit.EnrollmentIntent, bool, error)
GetEnrollmentIntent returns one durable adapter enrollment operation.
func (*Store) GetGrantIntent ¶
func (s *Store) GetGrantIntent(ctx context.Context, grantID string) (apikit.GrantIntent, bool, error)
GetGrantIntent returns one durable grant intent by grant incarnation ID.
func (*Store) GetImagePublicationIntent ¶
func (*Store) GetNamespace ¶
GetNamespace returns one platform-managed namespace record by Kubernetes namespace.
func (*Store) GetRestartOperationIntent ¶
func (*Store) GetServerIntent ¶
func (*Store) GetSession ¶
func (*Store) GetTeamBySlug ¶
GetTeamBySlug returns one non-deleted team by normalized slug.
func (*Store) GetTeamIntent ¶
func (s *Store) GetTeamIntent(ctx context.Context, teamID string) (apikit.TeamNamespaceIntent, bool, error)
GetTeamIntent returns the authoritative durable intent for one team incarnation.
func (*Store) GetTeamOperation ¶
func (s *Store) GetTeamOperation(ctx context.Context, operationID, actorID string) (TeamOperationAcceptance, bool, error)
GetTeamOperation reads the actor-scoped acceptance without deriving execution success from the resource's current health or current desired revision.
func (*Store) ListAgents ¶
ListAgents returns a stable, bounded page of team agents.
func (*Store) ListAuditLogs ¶
ListAuditLogs returns platform audit records matching an operations filter.
func (*Store) ListCredentials ¶
func (*Store) ListDeploymentIntents ¶
func (*Store) ListEnrollmentIntents ¶
ListEnrollmentIntents returns all durable adapter enrollment operations.
func (*Store) ListGrantIntents ¶
ListGrantIntents returns all durable grant intents when the opt-in access intent journal is enabled.
func (*Store) ListImageActivity ¶
func (s *Store) ListImageActivity(ctx context.Context, filter OperationsFilter) ([]ImageActivity, error)
ListImageActivity returns audit-derived image publish and deploy activity.
func (*Store) ListImagePublicationIntents ¶
func (*Store) ListNamespaces ¶
ListNamespaces returns platform-managed namespace records for admin views.
func (*Store) ListRegistryCredentials ¶
func (s *Store) ListRegistryCredentials(ctx context.Context, userID string) ([]APIKeySummary, error)
ListRegistryCredentials returns non-secret registry credential metadata for a user.
func (*Store) ListRestartOperationIntents ¶
func (*Store) ListServerIntents ¶
func (*Store) ListSessions ¶
func (s *Store) ListSessions(ctx context.Context, filter sessionstate.Filter) (sessionstate.Page, error)
func (*Store) ListTeamIntents ¶
ListTeamIntents returns all recorded durable team namespace intents.
func (*Store) ListTeamMemberships ¶
ListTeamMemberships returns active memberships for a team slug.
func (*Store) ListUserAPIKeys ¶
ListUserAPIKeys returns non-secret API key metadata for a user.
func (*Store) ListUserActivity ¶
func (s *Store) ListUserActivity(ctx context.Context, filter OperationsFilter) ([]UserActivity, error)
ListUserActivity returns user accounts with login, failure, key, and credential counters.
func (*Store) ListUserTeams ¶
ListUserTeams returns active team memberships for a user.
func (*Store) OperationsSnapshot ¶
func (s *Store) OperationsSnapshot(ctx context.Context, filter OperationsFilter) (OperationsSnapshot, error)
OperationsSnapshot returns user, audit, and image activity for internal consumers.
func (*Store) OverviewCounts ¶
OverviewCounts reads all totals in one database snapshot. Deleted teams/users, retired server sessions, expired sessions and sessions of inactive agents do not count as active resources.
func (*Store) PrincipalForUserID ¶
PrincipalForUserID returns the platform principal for a non-deleted user.
func (*Store) PutCredential ¶
func (s *Store) PutCredential(ctx context.Context, p passport.Principal, source *cb.Source, binding *cb.Binding) (json.RawMessage, error)
PutCredential persists only validated typed metadata. Revision zero creates; updates require the exact existing revision, preventing stale policy writes.
func (*Store) PutSession ¶
func (s *Store) PutSession(ctx context.Context, item sessionstate.Session) (sessionstate.Session, error)
PutSession validates active directory membership inside the same transaction as persistence. The state lock is acquired before the agent lock everywhere.
func (*Store) RecordAgentCleanupIntentReceipt ¶
func (s *Store) RecordAgentCleanupIntentReceipt(ctx context.Context, agentID string, req apikit.AgentCleanupReceiptRequest) (apikit.AgentCleanupReceipt, error)
RecordAgentCleanupIntentReceipt persists a fenced post-deactivation cleanup receipt.
func (*Store) RecordDeploymentIntentObservation ¶
func (s *Store) RecordDeploymentIntentObservation(ctx context.Context, deploymentID string, req apikit.DeploymentIntentObservationRequest) (apikit.WorkloadStatusObservation, error)
func (*Store) RecordDeploymentIntentReceipt ¶
func (s *Store) RecordDeploymentIntentReceipt(ctx context.Context, deploymentID string, req apikit.DeploymentIntentReceiptRequest) (apikit.WorkloadExecutionReceipt, error)
func (*Store) RecordEnrollmentIntentReceipt ¶
func (s *Store) RecordEnrollmentIntentReceipt(ctx context.Context, opID string, req apikit.EnrollmentIntentReceiptRequest) (apikit.EnrollmentReceipt, error)
RecordEnrollmentIntentReceipt persists a fenced enrollment execution receipt.
func (*Store) RecordGrantIntentObservation ¶
func (s *Store) RecordGrantIntentObservation(ctx context.Context, grantID string, req apikit.GrantIntentObservationRequest) (apikit.GrantObservation, error)
RecordGrantIntentObservation persists an independently observed CR and gateway replica propagation update.
func (*Store) RecordGrantIntentReceipt ¶
func (s *Store) RecordGrantIntentReceipt(ctx context.Context, grantID string, req apikit.GrantIntentReceiptRequest) (apikit.GrantReceipt, error)
RecordGrantIntentReceipt persists a fenced grant execution receipt.
func (*Store) RecordImagePublicationReceipt ¶
func (s *Store) RecordImagePublicationReceipt(ctx context.Context, publicationID string, req apikit.ImagePublicationReceiptRequest) (apikit.WorkloadExecutionReceipt, error)
func (*Store) RecordRestartComponentCheckpoint ¶
func (s *Store) RecordRestartComponentCheckpoint(ctx context.Context, operationID string, req apikit.RestartComponentCheckpointRequest) (apikit.RestartOperationIntent, error)
func (*Store) RecordRestartOperationReceipt ¶
func (s *Store) RecordRestartOperationReceipt(ctx context.Context, operationID string, req apikit.RestartOperationReceiptRequest) (apikit.WorkloadExecutionReceipt, error)
func (*Store) RecordServerIntentObservation ¶
func (s *Store) RecordServerIntentObservation(ctx context.Context, serverID string, req apikit.ServerIntentObservationRequest) (apikit.WorkloadStatusObservation, error)
func (*Store) RecordServerIntentReceipt ¶
func (s *Store) RecordServerIntentReceipt(ctx context.Context, serverID string, req apikit.ServerIntentReceiptRequest) (apikit.WorkloadExecutionReceipt, error)
func (*Store) RecordServerRetirementCheckpoint ¶
func (s *Store) RecordServerRetirementCheckpoint(ctx context.Context, serverID string, req apikit.ServerRetirementCheckpointRequest) (apikit.ServerIntent, error)
func (*Store) RecordTeamIntentObservation ¶
func (s *Store) RecordTeamIntentObservation(ctx context.Context, teamID string, req apikit.TeamIntentObservationRequest) (apikit.TeamNamespaceObservation, error)
RecordTeamIntentObservation persists a fenced independent status observation.
func (*Store) RecordTeamIntentReceipt ¶
func (s *Store) RecordTeamIntentReceipt(ctx context.Context, teamID string, req apikit.TeamIntentReceiptRequest) (apikit.TeamNamespaceReceipt, error)
RecordTeamIntentReceipt persists a fenced worker execution receipt.
func (*Store) RenameAgent ¶
func (*Store) ResolveTeamIDs ¶
ResolveTeamIDs returns a map of team UUID → slug for the given IDs. Unknown or deleted team IDs are silently omitted.
func (*Store) ResolveUserIDs ¶
ResolveUserIDs returns a map of user UUID → email for the given IDs. Unknown or deleted user IDs are silently omitted.
func (*Store) RetireServerIntent ¶
func (s *Store) RetireServerIntent(ctx context.Context, serverID string, req apikit.ServerIntentRetireRequest) (apikit.ServerIntent, error)
func (*Store) RevokeGrantIntent ¶
func (s *Store) RevokeGrantIntent(ctx context.Context, grantID string, deleteGrant bool) (apikit.GrantIntent, error)
RevokeGrantIntent commits authoritative grant revocation/deletion in Postgres FIRST and enqueues Kubernetes projection cleanup in the same transaction.
func (*Store) RevokeRegistryCredential ¶
func (s *Store) RevokeRegistryCredential(ctx context.Context, userID, id string) (APIKeySummary, error)
RevokeRegistryCredential marks a registry credential as revoked.
func (*Store) RevokeRegistryPullCredential ¶
func (*Store) RevokeSessions ¶
func (*Store) RevokeUserAPIKey ¶
RevokeUserAPIKey marks a user API key as revoked.
func (*Store) SessionChanges ¶
func (s *Store) SessionChanges(ctx context.Context, server sessionstate.Server, epoch string, after int64) (sessionstate.Changes, error)
func (*Store) SessionSnapshot ¶
func (s *Store) SessionSnapshot(ctx context.Context, server sessionstate.Server) (sessionstate.Snapshot, error)
func (*Store) SetAgentStatus ¶
func (*Store) SetSessionRevoked ¶
func (*Store) UpsertDeploymentIntent ¶
func (s *Store) UpsertDeploymentIntent(ctx context.Context, req apikit.DeploymentIntentUpsertRequest) (apikit.DeploymentIntent, error)
func (*Store) UpsertGrantIntent ¶
func (s *Store) UpsertGrantIntent(ctx context.Context, req apikit.GrantIntentUpsertRequest) (apikit.GrantIntent, error)
UpsertGrantIntent atomically persists desired grant intent and schedules reconciliation.
func (*Store) UpsertServerIntent ¶
func (s *Store) UpsertServerIntent(ctx context.Context, req apikit.ServerIntentUpsertRequest) (apikit.ServerIntent, error)
func (*Store) UpsertTeamMembership ¶
func (s *Store) UpsertTeamMembership(ctx context.Context, teamSlug, userID, role string) (TeamMembership, error)
UpsertTeamMembership creates or updates a user's role in a team.
func (*Store) UseCredentials ¶
func (s *Store) UseCredentials(ctx context.Context, server sessionstate.Server, request cb.ResolutionRequest, authorize func(sessionstate.Session, []cb.Binding, []cb.Source) error, fetch func(sessionstate.Session, []cb.Binding, []cb.Source) (cb.Delivery, error)) (cb.Delivery, error)
UseCredentials resolves in three phases so the slow provider read never holds the platform-wide session_sync_state row lock:
- an unlocked snapshot of session, subjects, bindings and sources, plus a first authorize pre-check;
- fetch (provider I/O) with no transaction and no lock;
- under lockSessionState, re-read everything, require unchanged binding and source revisions, run authorize again, durably audit, then commit.
A value is returned only if phase 3 succeeds; any change or error fails closed with no value.
func (*Store) WriteAudit ¶
func (s *Store) WriteAudit(ctx context.Context, ev AuditEvent)
WriteAudit records a platform audit event and logs failures without interrupting callers.
type Team ¶
type Team struct {
ID string `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Namespace string `json:"namespace"`
CreatedAt time.Time `json:"created_at"`
}
Team is a managed platform team and its Kubernetes namespace.
type TeamCreateAcceptanceRequest ¶
type TeamCreateAcceptanceRequest struct {
Slug string
Name string
CreatedByUserID string
ActorID string
IdempotencyKey string
}
TeamCreateAcceptanceRequest contains normalized public team-create input and the authenticated actor's replay key. ActorID is supplied by the server.
type TeamMembership ¶
type TeamMembership = apikit.TeamMembership
TeamMembership is the platform team membership API contract.
type TeamOperationAcceptance ¶
type TeamOperationAcceptance struct {
Team Team `json:"team"`
Operation apikit.Operation `json:"operation"`
Replayed bool `json:"-"`
}
TeamOperationAcceptance preserves the accepted resource and operation across response loss. Current resource health is read independently.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Role string `json:"role"`
Namespace string `json:"namespace"`
}
User is the persisted platform account shape returned by identity operations.
type UserActivity ¶
type UserActivity struct {
ID string `json:"id"`
Email string `json:"email"`
Role string `json:"role"`
Namespace string `json:"namespace,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
LoginCount int64 `json:"login_count"`
FailedActionCount int64 `json:"failed_action_count"`
RegistryCredentials int64 `json:"registry_credentials"`
APIKeys int64 `json:"api_keys"`
}
UserActivity summarizes recent platform activity for a user account.
type UserInputError ¶
type UserInputError string
UserInputError identifies safe account validation messages.
func (UserInputError) Error ¶
func (e UserInputError) Error() string