 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
nolint:revive
Index ¶
- Constants
- func ConvertAPIActivity(a APIActivity) types2.APIActivity
- func ConvertMCPAuditLog(a MCPAuditLog) types2.MCPAuditLog
- func ConvertMCPUsageStats(s MCPUsageStatItem) types2.MCPUsageStatItem
- func ConvertRemainingTokenUsage(userID string, r *RemainingTokenUsage) types2.RemainingTokenUsage
- func ConvertTokenActivity(a RunTokenActivity) types2.TokenUsage
- func ConvertUser(u *User, roleFixed bool, authProviderName string) *types2.User
- func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManifest
- func ValidateAndSetDefaultsOAuthAppManifest(r *types.OAuthAppManifest, create bool) error
- type APIActivity
- type AuthToken
- type FileScannerConfig
- type GoogleOAuthTokenResponse
- type Group
- type GroupMemberships
- type Identity
- type Image
- type LLMProxyActivity
- type MCPAuditLog
- type MCPOAuthToken
- type MCPPromptReadStats
- type MCPResourceReadStats
- type MCPToolCallStats
- type MCPToolCallStatsItem
- type MCPUsageStatItem
- type MCPUsageStatsList
- type MCPWebhookStatus
- type OAuthAppTypeConfig
- type OAuthTokenRequestChallenge
- type OAuthTokenResponse
- type RemainingTokenUsage
- type RunState
- type RunTokenActivity
- type SalesforceOAuthTokenResponse
- type SessionCookie
- type SlackOAuthTokenResponse
- type TokenRequest
- type User
- type UserQuery
Constants ¶
const ( AtlassianAuthorizeURL = "https://auth.atlassian.com/authorize" AtlassianTokenURL = "https://auth.atlassian.com/oauth/token" SlackAuthorizeURL = "https://slack.com/oauth/v2/authorize" SlackTokenURL = "https://slack.com/api/oauth.v2.access" NotionAuthorizeURL = "https://api.notion.com/v1/oauth/authorize" NotionTokenURL = "https://api.notion.com/v1/oauth/token" HubSpotAuthorizeURL = "https://app.hubspot.com/oauth/authorize" HubSpotTokenURL = "https://api.hubapi.com/oauth/v1/token" GoogleAuthorizeURL = "https://accounts.google.com/o/oauth2/v2/auth" GoogleTokenURL = "https://oauth2.googleapis.com/token" GitHubAuthorizeURL = "https://github.com/login/oauth/authorize" GitHubTokenURL = "https://github.com/login/oauth/access_token" ZoomAuthorizeURL = "https://zoom.us/oauth/authorize" ZoomTokenURL = "https://zoom.us/oauth/token" LinkedInAuthorizeURL = "https://www.linkedin.com/oauth/v2/authorization" LinkedInTokenURL = "https://www.linkedin.com/oauth/v2/accessToken" PagerDutyAuthorizeURL = "https://identity.pagerduty.com/oauth/authorize" PagerDutyTokenURL = "https://identity.pagerduty.com/oauth/token" SmartThingsAuthorizeURL = "https://api.smartthings.com/oauth/authorize" SmartThingsTokenURL = "https://auth-global.api.smartthings.com/oauth/token" GitLabAuthorizeURL = "https://gitlab.com/oauth/authorize" GitLabTokenURL = "https://gitlab.com/oauth/token" )
Variables ¶
This section is empty.
Functions ¶
func ConvertAPIActivity ¶ added in v0.7.1
func ConvertAPIActivity(a APIActivity) types2.APIActivity
func ConvertMCPAuditLog ¶ added in v0.8.0
func ConvertMCPAuditLog(a MCPAuditLog) types2.MCPAuditLog
ConvertMCPAuditLog converts internal MCPAuditLog to API type
func ConvertMCPUsageStats ¶ added in v0.8.0
func ConvertMCPUsageStats(s MCPUsageStatItem) types2.MCPUsageStatItem
ConvertMCPUsageStats converts internal MCPUsageStatItem to API type
func ConvertRemainingTokenUsage ¶ added in v0.8.0
func ConvertRemainingTokenUsage(userID string, r *RemainingTokenUsage) types2.RemainingTokenUsage
func ConvertTokenActivity ¶ added in v0.8.0
func ConvertTokenActivity(a RunTokenActivity) types2.TokenUsage
func MergeOAuthAppManifests ¶
func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManifest
func ValidateAndSetDefaultsOAuthAppManifest ¶
func ValidateAndSetDefaultsOAuthAppManifest(r *types.OAuthAppManifest, create bool) error
Types ¶
type AuthToken ¶
type AuthToken struct {
	ID                    string    `json:"id" gorm:"index:idx_id_hashed_token"`
	UserID                uint      `json:"-" gorm:"index"`
	AuthProviderNamespace string    `json:"-" gorm:"index"`
	AuthProviderName      string    `json:"-" gorm:"index"`
	AuthProviderUserID    string    `json:"-"`
	HashedToken           string    `json:"-" gorm:"index:idx_id_hashed_token"`
	HashedSessionID       string    `json:"-" gorm:"index"`
	CreatedAt             time.Time `json:"createdAt"`
	ExpiresAt             time.Time `json:"expiresAt"`
}
    type FileScannerConfig ¶ added in v0.8.0
type Group ¶ added in v0.9.0
type Group struct {
	// ID is the globally unique identifier for the group.
	// Each auth provider should use a different prefix for their groups to avoid collisions with other providers.
	ID string `json:"id" gorm:"primaryKey;unique"`
	// AuthProviderName is the name of the auth provider that the group belongs to.
	// This is used to identify the auth provider that the group belongs to.
	AuthProviderName string `json:"authProviderName" gorm:"primaryKey;index:idx_group_auth_provider"`
	// AuthProviderNamespace is the namespace of the auth provider that the group belongs to.
	// Note: This is pretty much always "default", but we're keeping it here for parity with the Identity type.
	AuthProviderNamespace string `json:"authProviderNamespace" gorm:"primaryKey;index:idx_group_auth_provider"`
	// Name is the display name of the group.
	Name string `json:"name"`
	// IconURL is the URL of the group's icon.
	IconURL *string `json:"iconURL"`
	// CreatedAt is the time the group was created.
	CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime"`
}
    Group represents a group that users can belong to in an auth provider.
type GroupMemberships ¶ added in v0.9.0
type GroupMemberships struct {
	// UserID is the ID of the user that is a member of the group.
	UserID uint `json:"userID" gorm:"primaryKey"`
	// GroupID is the globally unique identifier for the group.
	GroupID string `json:"groupID" gorm:"primaryKey"`
	// CreatedAt is when the group membership was created.
	CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime"`
}
    GroupMemberships represents a user's membership in a group.
type Identity ¶
type Identity struct {
	AuthProviderName      string    `json:"authProviderName" gorm:"primaryKey;index:idx_user_auth_id"`
	AuthProviderNamespace string    `json:"authProviderNamespace" gorm:"primaryKey;index:idx_user_auth_id"`
	ProviderUsername      string    `json:"providerUsername"`
	ProviderUserID        string    `json:"providerUserID"`
	HashedProviderUserID  string    `json:"hashedProviderUserID" gorm:"primaryKey"`
	Email                 string    `json:"email"`
	HashedEmail           string    `json:"hashedEmail"`
	UserID                uint      `json:"userID" gorm:"index:idx_user_auth_id"`
	IconURL               string    `json:"iconURL"`
	IconLastChecked       time.Time `json:"iconLastChecked"`
	Encrypted             bool      `json:"encrypted"`
	// AuthProviderGroupsLastChecked is the last time the identity's auth provider groups were checked.
	AuthProviderGroupsLastChecked time.Time `json:"authProviderGroupsLastChecked"`
	// AuthProviderGroups is the set of auth provider groups that the identity is a member of.
	AuthProviderGroups []Group `json:"groups" gorm:"-"`
}
    func (Identity) GetAuthProviderGroupIDs ¶ added in v0.9.0
type Image ¶ added in v0.7.0
type LLMProxyActivity ¶
type MCPAuditLog ¶ added in v0.8.0
type MCPAuditLog struct {
	ID                        uint                                  `json:"id" gorm:"primaryKey"`
	CreatedAt                 time.Time                             `json:"createdAt" gorm:"index"`
	UserID                    string                                `json:"userID" gorm:"index"`
	MCPID                     string                                `json:"mcpID" gorm:"index"`
	MCPServerDisplayName      string                                `json:"mcpServerDisplayName" gorm:"index"`
	MCPServerCatalogEntryName string                                `json:"mcpServerCatalogEntryName" gorm:"index"`
	ClientName                string                                `json:"clientName" gorm:"index"`
	ClientVersion             string                                `json:"clientVersion" gorm:"index"`
	ClientIP                  string                                `json:"clientIP" gorm:"index"`
	CallType                  string                                `json:"callType" gorm:"index"`
	CallIdentifier            string                                `json:"callIdentifier,omitempty" gorm:"index"`
	RequestBody               json.RawMessage                       `json:"requestBody,omitempty"`
	ResponseBody              json.RawMessage                       `json:"responseBody,omitempty"`
	ResponseStatus            int                                   `json:"responseStatus" gorm:"index"`
	Error                     string                                `json:"error,omitempty"`
	ProcessingTimeMs          int64                                 `json:"processingTimeMs" gorm:"index"`
	SessionID                 string                                `json:"sessionID,omitempty" gorm:"index"`
	WebhookStatuses           datatypes.JSONSlice[MCPWebhookStatus] `json:"webhookStatuses,omitempty"`
	// Additional metadata
	RequestID       string          `json:"requestID,omitempty" gorm:"index"`
	UserAgent       string          `json:"userAgent,omitempty"`
	RequestHeaders  json.RawMessage `json:"requestHeaders,omitempty"`
	ResponseHeaders json.RawMessage `json:"responseHeaders,omitempty"`
	Encrypted       bool            `json:"encrypted"`
}
    MCPAuditLog represents an audit log entry for MCP API calls
type MCPOAuthToken ¶ added in v0.8.0
type MCPOAuthToken struct {
	oauth2.Endpoint
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       string
	State       string
	HashedState *string `gorm:"unique"`
	Verifier    string
	MCPID              string `gorm:"primaryKey"`
	UserID             string `gorm:"primaryKey"`
	OAuthAuthRequestID string `gorm:"index"`
	AccessToken        string
	TokenType          string
	RefreshToken       string
	Expiry             time.Time
	ExpiresIn          int64
	Encrypted bool
}
    type MCPPromptReadStats ¶ added in v0.8.0
type MCPPromptReadStats struct {
	PromptName string `json:"promptName"`
	ReadCount  int64  `json:"readCount"`
}
    MCPPromptReadStats represents statistics for individual prompt reads
type MCPResourceReadStats ¶ added in v0.8.0
type MCPResourceReadStats struct {
	ResourceURI string `json:"resourceUri"`
	ReadCount   int64  `json:"readCount"`
}
    MCPResourceReadStats represents statistics for individual resource reads
type MCPToolCallStats ¶ added in v0.8.0
type MCPToolCallStats struct {
	ToolName  string                 `json:"-"`
	CallCount int64                  `json:"callCount"`
	Items     []MCPToolCallStatsItem `json:"items"`
}
    MCPToolCallStats represents statistics for individual tool calls
type MCPToolCallStatsItem ¶ added in v0.8.0
type MCPUsageStatItem ¶ added in v0.8.0
type MCPUsageStatItem struct {
	MCPID                     string                 `json:"mcpID"`
	MCPServerDisplayName      string                 `json:"mcpServerDisplayName"`
	MCPServerCatalogEntryName string                 `json:"mcpServerCatalogEntryName"`
	ToolCalls                 []MCPToolCallStats     `json:"toolCalls,omitempty"`
	ResourceReads             []MCPResourceReadStats `json:"resourceReads,omitempty"`
	PromptReads               []MCPPromptReadStats   `json:"promptReads,omitempty"`
}
    MCPUsageStatItem represents usage statistics for MCP servers
type MCPUsageStatsList ¶ added in v0.8.0
type MCPWebhookStatus ¶ added in v0.8.0
type OAuthAppTypeConfig ¶
type OAuthTokenResponse ¶
type OAuthTokenResponse struct {
	State        string `json:"state"`
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope"`
	ExpiresIn    int    `json:"expires_in"`
	ExtExpiresIn int    `json:"ext_expires_in"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	Ok           bool   `json:"ok"`
	Error        string `json:"error"`
	CreatedAt    time.Time
	Extras       map[string]string `json:"extras" gorm:"serializer:json"`
	Data         map[string]string `json:"data" gorm:"serializer:json"`
}
    OAuthTokenResponse represents a response from the /token endpoint on an OAuth server. These do not get stored in the database.
type RemainingTokenUsage ¶ added in v0.8.0
type RunState ¶ added in v0.7.0
type RunState struct {
	UserID     string    `json:"userID"`
	Name       string    `json:"name" gorm:"primaryKey"`
	Namespace  string    `json:"namespace" gorm:"primaryKey"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
	ThreadName string    `json:"threadName,omitempty"`
	Program    []byte    `json:"program,omitempty"`
	ChatState  []byte    `json:"chatState,omitempty"`
	CallFrame  []byte    `json:"callFrame,omitempty"`
	Output     []byte    `json:"output,omitempty"`
	Done       bool      `json:"done,omitempty"`
	Error      string    `json:"error,omitempty"`
}
    type RunTokenActivity ¶ added in v0.8.0
type SalesforceOAuthTokenResponse ¶ added in v0.5.0
type SalesforceOAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	Signature    string `json:"signature"`
	Scope        string `json:"scope"`
	IDToken      string `json:"id_token"`
	InstanceURL  string `json:"instance_url"`
	ID           string `json:"id"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	IssuedAt     string `json:"issued_at"`
}
    type SessionCookie ¶ added in v0.10.0
type SlackOAuthTokenResponse ¶
type SlackOAuthTokenResponse struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error"`
	AppID string `json:"app_id"`
	Team  struct {
		Name string `json:"name"`
		ID   string `json:"id"`
	} `json:"team"`
	AuthedUser struct {
		ID          string `json:"id"`
		Scope       string `json:"scope"`
		AccessToken string `json:"access_token"`
	} `json:"authed_user"`
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
}
    type TokenRequest ¶
type User ¶
type User struct {
	ID             uint        `json:"id" gorm:"primaryKey"`
	CreatedAt      time.Time   `json:"createdAt"`
	DisplayName    string      `json:"displayName"`
	Username       string      `json:"username"`
	HashedUsername string      `json:"-" gorm:"unique"`
	Email          string      `json:"email"`
	HashedEmail    string      `json:"-"`
	VerifiedEmail  *bool       `json:"verifiedEmail,omitempty"`
	Role           types2.Role `json:"role"`
	IconURL        string      `json:"iconURL"`
	Timezone       string      `json:"timezone"`
	// LastActiveDay is the time of the last request made by this user, currently at the 24 hour granularity.
	LastActiveDay              time.Time `json:"lastActiveDay"`
	Internal                   bool      `json:"internal" gorm:"default:false"`
	DailyPromptTokensLimit     int       `json:"dailyPromptTokensLimit"`
	DailyCompletionTokensLimit int       `json:"dailyCompletionTokensLimit"`
	Encrypted                  bool      `json:"encrypted"`
	// Soft delete fields
	DeletedAt        *time.Time `json:"deletedAt,omitempty"`
	OriginalEmail    string     `json:"-"`
	OriginalUsername string     `json:"-"`
}