Documentation
¶
Index ¶
- Constants
- type ABACStatusResponse
- type AIBotInfo
- type AIBotsResponse
- type API
- func (a *API) MattermostAuthorizationRequired(c *gin.Context)
- func (a *API) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) ServeMetrics(c *plugin.Context, w http.ResponseWriter, r *http.Request)
- func (a *API) SetConversationService(svc *conversation.Service)
- func (a *API) SetDictationService(svc *dictation.Service)
- func (a *API) SetExternalRebuilderForTest(rb externalServerRebuilder)
- type ActiveWaitResponse
- type AgentRequestFields
- type AgentStore
- type ChannelAutoReply
- type ChannelAutoReplyStore
- type ClearMCPToolsCacheResponse
- type ClusterAgentNotifier
- type ClusterNotifier
- type Config
- type ConfigStore
- type ConfigUpdater
- type ConversationResponse
- type ConversationStore
- type CreateAgentRequest
- type DeleteAgentVersionsRequest
- type FetchModelsForServiceRequest
- type FetchModelsRequest
- type MCPClientManager
- type MCPOAuthClusterNotifier
- type MCPServerInfo
- type MCPSuggestedDescriptionResponse
- type MCPToolInfo
- type MCPToolsResponse
- type RawFileContentRequest
- type RawFileContentResponse
- type RawSearchRequest
- type RawSearchResponse
- type RawSearchResult
- type ReindexRequest
- type RenderRequest
- type SearchRequest
- type ServiceInfo
- type SetPinRequest
- type StreamStopClusterNotifier
- type TurnResponse
- type UpdateAgentRequest
- type UpdatePluginServerRequest
- type UserMCPServerInfo
- type UserMCPToolInfo
- type UserMCPToolsResponse
Constants ¶
const ( ContextPostKey = "post" ContextChannelKey = "channel" ContextBotKey = "bot" )
const ( TitleSummarizeUnreads = "Summarize Unreads" TitleSummarizeChannel = "Summarize Channel" )
const ( TitleThreadSummary = "Thread Summary" TitleFindActionItems = "Action Items" TitleFindOpenQuestions = "Open Questions" )
const ( // Config. AuditEventSaveConfig = "saveConfig" AuditEventSaveSettingsAccess = "saveSettingsAccess" // Admin operations. AuditEventReindexPosts = "reindexPosts" AuditEventCancelReindexJob = "cancelReindexJob" AuditEventCatchUpReindex = "catchUpReindex" AuditEventRebuildVectorIndex = "rebuildVectorIndex" AuditEventClearMCPToolsCache = "clearMCPToolsCache" AuditEventUpdateMCPPluginServer = "updateMCPPluginServer" // Agent CRUD. AuditEventCreateAgent = "createAgent" AuditEventUpdateAgent = "updateAgent" AuditEventDeleteAgent = "deleteAgent" AuditEventUpdateAgentAvatar = "updateAgentAvatar" // Agent versioning. Listing and viewing versions are read-only and are not audited. AuditEventRestoreAgentVersion = "restoreAgentVersion" AuditEventDeleteAgentVersions = "deleteAgentVersions" // Custom prompts. AuditEventCreateCustomPrompt = "createCustomPrompt" AuditEventUpdateCustomPrompt = "updateCustomPrompt" AuditEventDeleteCustomPrompt = "deleteCustomPrompt" // Channel configuration. AuditEventUpdateChannelAutoReply = "updateChannelAutoReply" // Conversation management by its owner. AuditEventRenameConversation = "renameConversation" AuditEventArchiveConversation = "archiveConversation" // Credentials: third-party MCP OAuth grant/revocation and per-user tool // provider preferences. AuditEventMCPOAuthStart = "mcpOAuthStart" AuditEventMCPOAuthCallback = "mcpOAuthCallback" AuditEventMCPOAuthDisconnect = "mcpOAuthDisconnect" AuditEventUpdateMCPUserPreferences = "updateMCPUserPreferences" // Inter-plugin MCP server registration (bridge routes). AuditEventRegisterMCPPluginServer = "registerMCPPluginServer" AuditEventUnregisterMCPPluginServer = "unregisterMCPPluginServer" // In-channel tool approval: the human decision the server cannot see. AuditEventToolCallApproval = "toolCallApproval" AuditEventToolResultApproval = "toolResultApproval" // wait_for_async_work controls: the requester ending or canceling a pause. AuditEventWaitCheckNow = "waitCheckNow" AuditEventWaitCancel = "waitCancel" // MCP session grant: an external MCP client obtained a dedicated session // holding API access as the user. Not a gin route — emitted directly by // delegateToMCPHandler when a session is newly created, so it has no // registry entry below. AuditEventMCPSessionGrant = "mcpSessionGrant" // Access-policy authoring. GET is read-only and is not audited. AuditEventPutAgentPolicy = "putAgentAccessPolicy" AuditEventDeleteAgentPolicy = "deleteAgentAccessPolicy" AuditEventPutServicePolicy = "putServiceAccessPolicy" AuditEventDeleteServicePolicy = "deleteServiceAccessPolicy" AuditEventPutMCPPolicy = "putMCPAccessPolicy" AuditEventDeleteMCPPolicy = "deleteMCPAccessPolicy" // Dictation: minting a provider session billed to the organization. AuditEventCreateDictationSession = "createDictationSession" AuditEventEndDictationSession = "endDictationSession" )
Audit event names for every state-changing operation in the plugin: 38 routed events plus the non-gin MCP session grant. All are declared here, including ones whose instrumentation lands in later changes, so call sites never use inline string literals; new state-changing routes add their names here rather than inline.
The server stamps the plugin ID into every record's parameters when it is logged, so the names stay unprefixed.
const AgentActiveCountHeader = "X-Agent-Active-Count"
AgentActiveCountHeader is returned on GET /agents when agents are capped so the webapp can gate creation against the server-wide combined pool (not the access-filtered list).
const MaxAgentRequestBodyBytes = 2 << 20 // 2 MiB
MaxAgentRequestBodyBytes caps agent create/update JSON bodies. It must comfortably exceed the worst-case encoded size of llm.MaxCustomInstructionsRunes plus the remaining payload.
const MaxConversationTitleLength = 256
MaxConversationTitleLength bounds a user-set conversation title, in runes. Generated titles are capped at 25 tokens, far below this.
const WebsocketEventBotsInvalidate = "bots_invalidate"
WebsocketEventBotsInvalidate is the event name for PublishWebSocketEvent (webapp: custom_mattermost-ai_<name>).
const WebsocketEventChannelAutoReplyUpdated = "channel_autoreply_updated"
WebsocketEventChannelAutoReplyUpdated is the event name for PublishWebSocketEvent (webapp: custom_mattermost-ai_<name>).
const WebsocketEventDictationAvailabilityChanged = "dictation_availability_changed"
WebsocketEventDictationAvailabilityChanged tells clients to refetch GET /dictation/availability (webapp: custom_mattermost-ai_<name>).
const WebsocketEventDictationSessionEnded = "dictation_session_ended"
WebsocketEventDictationSessionEnded tells the user the server ended one of their dictation sessions (webapp: custom_mattermost-ai_<name>).
const WebsocketEventMCPConnectionUpdated = "mcp_connection_updated"
WebsocketEventMCPConnectionUpdated is the event name for user-scoped MCP OAuth connection updates (webapp: custom_mattermost-ai_<name>).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABACStatusResponse ¶ added in v2.8.0
type ABACStatusResponse struct {
Available bool `json:"available"`
}
type AIBotInfo ¶
type AIBotInfo struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Username string `json:"username"`
LastIconUpdate int64 `json:"lastIconUpdate"`
DMChannelID string `json:"dmChannelID"`
ChannelAccessLevel llm.ChannelAccessLevel `json:"channelAccessLevel"`
ChannelIDs []string `json:"channelIDs"`
UserAccessLevel llm.UserAccessLevel `json:"userAccessLevel"`
UserIDs []string `json:"userIDs"`
EnabledMCPTools []llm.EnabledMCPTool `json:"enabledMCPTools"`
AutoEnableNewMCPTools bool `json:"autoEnableNewMCPTools"`
// UseServiceAccountAuth is the effective mode, not the raw agent flag: it is
// false when the server is not licensed for remote MCP.
UseServiceAccountAuth bool `json:"useServiceAccountAuth"`
IsDefault bool `json:"isDefault,omitempty"`
// IsCreator reports whether the requesting user created the agent.
IsCreator bool `json:"isCreator"`
// HasChats reports whether the requesting user has a chat with the agent
// in their DM, regardless of how many other chats they have.
HasChats bool `json:"hasChats"`
}
type AIBotsResponse ¶
type AIBotsResponse struct {
Bots []AIBotInfo `json:"bots"`
SearchEnabled bool `json:"searchEnabled"`
AllowUnsafeLinks bool `json:"allowUnsafeLinks"`
// LinkPolicy is what the webapp enforces; AllowUnsafeLinks is kept for
// API compatibility.
LinkPolicy config.LinkPolicy `json:"linkPolicy"`
HTMLArtifactsEnabled bool `json:"htmlArtifactsEnabled"`
}
type API ¶
type API struct {
// contains filtered or unexported fields
}
API represents the HTTP API functionality for the plugin
func New ¶
func New( bots *bots.MMBots, conversationsService *conversations.Conversations, meetingsService *meetings.Service, indexerService *indexer.Indexer, searchService *search.Search, pluginAPI *pluginapi.Client, metricsService metrics.Metrics, llmContextBuilder *llmcontext.Builder, config Config, prompts *llm.Prompts, mmClient mmapi.Client, dbClient *mmapi.DBClient, licenseChecker *enterprise.LicenseChecker, streamingService streaming.Service, i18nBundle *i18n.Bundle, mcpClientManager MCPClientManager, mcpHandlers *mcpserver.PluginMCPHandlers, llmUpstreamHTTPClient *http.Client, configStore ConfigStore, agentStore AgentStore, configUpdater ConfigUpdater, clusterNotifier ClusterNotifier, clusterAgentNotifier ClusterAgentNotifier, mcpOAuthNotifier MCPOAuthClusterNotifier, streamStopNotifier StreamStopClusterNotifier, conversationStore ConversationStore, getSearchInitError func() string, customPromptsStore *customprompts.Store, autoReplyStore ChannelAutoReplyStore, accessChecker *accesscontrol.Checker, ) *API
New creates a new API instance
func (*API) MattermostAuthorizationRequired ¶
func (*API) ServeMetrics ¶
ServeMetrics serves the metrics endpoint
func (*API) SetConversationService ¶
func (a *API) SetConversationService(svc *conversation.Service)
SetConversationService sets the conversation entity service for channel analysis.
func (*API) SetDictationService ¶ added in v2.14.0
SetDictationService sets the service behind the /dictation routes. Without one, both routes report dictation as unavailable.
func (*API) SetExternalRebuilderForTest ¶
func (a *API) SetExternalRebuilderForTest(rb externalServerRebuilder)
SetExternalRebuilderForTest installs a test-only externalServerRebuilder.
type ActiveWaitResponse ¶ added in v2.12.0
type ActiveWaitResponse struct {
PostID string `json:"post_id"`
RequesterUserID string `json:"requester_user_id"`
ScheduledAt int64 `json:"scheduled_at"`
ResumeAt int64 `json:"resume_at"`
DurationMinutes int `json:"duration_minutes"`
}
ActiveWaitResponse describes a pending wait_for_async_work pause. Times are unix millis. RequesterUserID is the only user allowed to check-now or cancel the wait; the webapp also uses it to pick the owner vs onlooker rendering.
type AgentRequestFields ¶ added in v2.8.0
type AgentRequestFields struct {
DisplayName string `json:"displayName" binding:"required"`
ServiceID string `json:"serviceID" binding:"required"`
CustomInstructions string `json:"customInstructions"`
ChannelAccessLevel int `json:"channelAccessLevel"`
ChannelIDs []string `json:"channelIDs"`
UserAccessLevel int `json:"userAccessLevel"`
UserIDs []string `json:"userIDs"`
TeamIDs []string `json:"teamIDs"`
AdminUserIDs []string `json:"adminUserIDs"`
EnabledMCPTools []llm.EnabledMCPTool `json:"enabledMCPTools"`
AutoEnableNewMCPTools bool `json:"autoEnableNewMCPTools"`
MCPDynamicToolLoading bool `json:"mcpDynamicToolLoading"`
UseServiceAccountAuth bool `json:"useServiceAccountAuth"`
Model string `json:"model"`
EnableVision bool `json:"enableVision"`
DisableTools bool `json:"disableTools"`
EnabledNativeTools []string `json:"enabledNativeTools"`
ReasoningEnabled bool `json:"reasoningEnabled"`
ReasoningEffort string `json:"reasoningEffort"`
ThinkingBudget int `json:"thinkingBudget"`
// StructuredOutputEnabled is deprecated: it is accepted and persisted for
// compatibility with existing callers, but ignored at runtime. Structured
// output is a per-service policy (ServiceConfig.StructuredOutputPolicy).
StructuredOutputEnabled bool `json:"structuredOutputEnabled"`
MaxToolTurns int `json:"maxToolTurns"`
Skills llm.SkillsConfig `json:"skills"`
}
AgentRequestFields are the request fields common to agent create and update. Field values are stored as given (no server-side fill-in). MCP tool access is controlled by two independent fields:
- autoEnableNewMCPTools=true gives the agent every currently configured MCP tool and any added later.
- Otherwise, the agent gets only the tools listed in enabledMCPTools (empty/missing = no MCP tools).
type AgentStore ¶
type AgentStore interface {
// CreateAgent and UpdateAgent record every write as a new agent version.
CreateAgent(cfg *llm.BotConfig, meta store.AgentVersionMeta) error
GetAgent(id string) (*llm.BotConfig, error)
ListAgents() ([]*llm.BotConfig, error)
ListAgentsByCreator(creatorID string) ([]*llm.BotConfig, error)
CountActiveAgents() (int, error)
UpdateAgent(cfg *llm.BotConfig, meta store.AgentVersionMeta) error
DeleteAgent(id string) error
// ListAgentVersions returns up to limit versions older than before (no
// upper bound when before is 0), newest first.
ListAgentVersions(agentID string, before, limit int) (store.AgentVersionPage, error)
// GetAgentVersion returns nil, nil when the version does not exist.
GetAgentVersion(agentID string, version int) (*store.AgentVersionDetail, error)
// DeleteAgentVersions deletes the given versions; it returns
// store.ErrCurrentAgentVersion, deleting nothing, when they include the current one.
DeleteAgentVersions(agentID string, versions []int) (int64, error)
// DeletePreviousAgentVersions deletes every version but the current one.
DeletePreviousAgentVersions(agentID string) (int64, error)
}
AgentStore provides CRUD access to user-created agents in the database.
type ChannelAutoReply ¶ added in v2.6.0
type ChannelAutoReply struct {
BotID string `json:"bot_id"`
Mode string `json:"mode"`
Instructions string `json:"instructions,omitempty"`
}
ChannelAutoReply is the request and response payload for GET/PUT /channel/{channelid}/autoreply.
type ChannelAutoReplyStore ¶ added in v2.6.0
type ChannelAutoReplyStore interface {
Get(channelID string) (*autoreply.Setting, error)
Set(setting autoreply.Setting) (*autoreply.Setting, error)
Delete(channelID string) error
}
ChannelAutoReplyStore provides read/write access to per-channel auto-reply settings. Implemented by *autoreply.Service (Phase 1). Get reads the database so API reads are read-your-writes across cluster nodes; Set/Delete validate, persist, and handle cluster cache invalidation internally.
type ClearMCPToolsCacheResponse ¶
type ClearMCPToolsCacheResponse struct {
ClearedServers int `json:"cleared_servers"`
Message string `json:"message"`
}
ClearMCPToolsCacheResponse represents the response for clearing the cache
type ClusterAgentNotifier ¶
ClusterAgentNotifier broadcasts agent update events to other cluster nodes. agentID names a renamed agent that peers refresh individually first; it is empty when no single agent needs that.
type ClusterNotifier ¶
type ClusterNotifier interface {
PublishConfigUpdate() error
}
ClusterNotifier broadcasts config update events to other cluster nodes.
type Config ¶
type Config interface {
GetDefaultBotUserID() string
// GetDefaultBotName is the legacy username reference, used only when no
// default bot user ID is set.
GetDefaultBotName() string
MCP() mcp.Config
AllowUnsafeLinks() bool
LinkPolicy() config.LinkPolicy
EnableHTMLArtifacts() bool
EmbeddingSearchConfig() embeddings.EmbeddingSearchConfig
EnableChannelMentionToolCalling() bool
EnableAmbientAutoReply() bool
// GetServices returns a snapshot of the stored service configurations, in
// configuration order. The bridge service endpoints operate on this
// snapshot directly rather than going through an agent.
GetServices() []llm.ServiceConfig
// SettingsAccess returns the users delegated access to the plugin
// configuration besides system admins.
SettingsAccess() config.SettingsAccess
}
type ConfigStore ¶
type ConfigStore interface {
GetConfig() (*config.Config, error)
SaveConfig(cfg config.Config) error
// UpdateConfig atomically reads the active config, applies transform, and
// persists the result under the config advisory lock. A transform error
// aborts the update and is returned as-is.
UpdateConfig(transform func(prev *config.Config) (config.Config, error)) (config.Config, error)
// UpdateConfigWithOutcome is UpdateConfig returning the persisted config
// and any DB-backed agent IDs atomically remapped inside the transaction.
UpdateConfigWithOutcome(transform func(prev *config.Config) (config.Config, error)) (store.ConfigUpdateOutcome, error)
}
ConfigStore provides read/write access to the plugin configuration in the database.
type ConfigUpdater ¶
ConfigUpdater updates the in-memory plugin configuration.
type ConversationResponse ¶
type ConversationResponse struct {
ID string `json:"id"`
UserID string `json:"user_id"`
BotID string `json:"bot_id"`
ChannelID *string `json:"channel_id"`
RootPostID *string `json:"root_post_id"`
Title string `json:"title"`
Operation string `json:"operation"`
Turns []TurnResponse `json:"turns"`
// ActiveWait is set only while a wait_for_async_work pause is pending in
// this conversation's thread, so the webapp can render a live countdown.
ActiveWait *ActiveWaitResponse `json:"active_wait,omitempty"`
}
ConversationResponse is the JSON shape returned by GET /conversations/{id}.
type ConversationStore ¶
type ConversationStore interface {
GetConversation(id string) (*store.Conversation, error)
GetTurnsForConversation(conversationID string) ([]store.Turn, error)
GetTurnByPostID(postID string) (*store.Turn, error)
UpdateTurnContent(id string, content json.RawMessage) error
GetConversationIncludingArchived(id string) (*store.Conversation, error)
GetBotDMConversationSummariesForUser(userID string, limit, offset int) ([]store.ConversationSummary, error)
GetBotDMBotIDsForUser(userID string) ([]string, error)
RenameConversation(id, title string) (bool, error)
ArchiveConversation(id string, archivedAt int64) error
}
ConversationStore provides read/write access to conversation and turn data.
type CreateAgentRequest ¶
type CreateAgentRequest struct {
AgentRequestFields
Username string `json:"username" binding:"required"`
}
CreateAgentRequest is the JSON body for POST /agents.
type DeleteAgentVersionsRequest ¶ added in v2.11.0
DeleteAgentVersionsRequest is the JSON body for DELETE /agents/:agentid/versions: either the versions to delete, or all to delete every version but the current one.
type FetchModelsForServiceRequest ¶
type FetchModelsForServiceRequest struct {
ServiceID string `json:"serviceID" binding:"required"`
}
FetchModelsForServiceRequest is the JSON body for POST /agents/models/fetch.
type FetchModelsRequest ¶
type FetchModelsRequest struct {
ServiceType string `json:"serviceType"`
APIKey string `json:"apiKey"`
APIURL string `json:"apiURL"`
OrgID string `json:"orgID"`
// ServiceID names an already saved service whose credentials are read from
// the stored configuration. A service the admin is still entering has no
// stored counterpart and supplies its credentials in this request instead.
ServiceID string `json:"serviceID"`
// Region applies to providers that require it for model listing (Vertex AI).
Region string `json:"region"`
// Vertex AI credentials. VertexAuthCredentials may be empty to signal ADC.
VertexProjectID string `json:"vertexProjectID"`
VertexProjectNumber string `json:"vertexProjectNumber"`
VertexAuthCredentials string `json:"vertexAuthCredentials"`
}
type MCPClientManager ¶
type MCPClientManager interface {
GetOAuthManager() *mcp.OAuthManager
GetToolsCache() *mcp.ToolsCache
GetHTTPClient() *http.Client
ProcessOAuthCallback(ctx context.Context, loggedInUserID, state, code, iss string) (*mcp.OAuthSession, error)
DisconnectUserOAuth(ctx context.Context, userID, serverName string) error
MarkOAuthNeeded(userID, serverName, authURL string) error
GetEmbeddedServer() mcp.EmbeddedMCPServer
EnsureMCPSessionID(userID string) (sessionID string, created bool, err error)
GetCatalogAccess(ctx context.Context, req mcp.CatalogRequest) mcp.CatalogAccess
RefreshCatalogAccess(ctx context.Context, req mcp.CatalogRequest) (mcp.CatalogAccess, error)
GetConfig() mcp.Config
RegisterPluginServer(cfg mcp.PluginServerConfig)
UpdatePluginServerAdminFields(pluginID string, enabled bool, toolConfigs []mcp.ToolConfig) (mcp.PluginServerConfig, bool)
UnregisterPluginServer(pluginID string)
ListPluginServers() []mcp.PluginServerConfig
GetPluginServer(pluginID string) (mcp.PluginServerConfig, bool)
DiscoverPluginServerTools(ctx context.Context, userID string, cfg mcp.PluginServerConfig) ([]mcp.ToolInfo, error)
}
type MCPOAuthClusterNotifier ¶
MCPOAuthClusterNotifier broadcasts MCP OAuth updates to other cluster nodes.
type MCPServerInfo ¶
type MCPServerInfo struct {
Name string `json:"name"`
URL string `json:"url"`
Tools []MCPToolInfo `json:"tools"`
NeedsOAuth bool `json:"needsOAuth"`
OAuthURL string `json:"oauthURL,omitempty"` // URL to redirect for OAuth if needed
Error *string `json:"error"`
// ServerType is one of "embedded", "remote", or "plugin".
ServerType string `json:"serverType"`
Enabled bool `json:"enabled"`
// ToolConfigs is populated for plugin rows only.
ToolConfigs []mcp.ToolConfig `json:"toolConfigs,omitempty"`
// ID is the stable ABAC policy identity when present.
ID string `json:"id,omitempty"`
}
MCPServerInfo represents a server and its tools for API response
type MCPSuggestedDescriptionResponse ¶ added in v2.10.0
type MCPSuggestedDescriptionResponse struct {
Description string `json:"description"`
Source string `json:"source"`
NeedsOAuth bool `json:"needsOAuth"`
AuthURL string `json:"authURL,omitempty"`
}
MCPSuggestedDescriptionResponse is a draft description for a remote MCP server, taken from how the server describes itself to the requesting admin. When the admin must sign in to the server first, NeedsOAuth is set and AuthURL starts that flow.
type MCPToolInfo ¶
type MCPToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema any `json:"inputSchema"`
// ReadOnlyHint is the server's readOnlyHint annotation for the tool.
ReadOnlyHint bool `json:"readOnlyHint"`
// DefaultPolicy is the policy the tool runs with while it has no stored
// policy (mcp.EffectiveDefaultToolPolicy).
DefaultPolicy string `json:"defaultPolicy"`
// SuggestedPolicy is the policy the System Console pre-selects when an
// admin reviews the tool (mcp.SuggestedToolPolicy). It has no effect
// until the admin saves it.
SuggestedPolicy string `json:"suggestedPolicy"`
}
MCPToolInfo represents a tool from an MCP server for API response
type MCPToolsResponse ¶
type MCPToolsResponse struct {
Servers []MCPServerInfo `json:"servers"`
}
MCPToolsResponse represents the response structure for MCP tools endpoint
type RawFileContentRequest ¶
type RawFileContentRequest struct {
FileID string `json:"file_id"`
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
}
RawFileContentRequest is the request body for the raw file content endpoint.
type RawFileContentResponse ¶
type RawFileContentResponse struct {
Name string `json:"name"`
MimeType string `json:"mime_type"`
TotalRunes int `json:"total_runes"`
Offset int `json:"offset"`
Returned int `json:"returned"`
HasMore bool `json:"has_more"`
HasText bool `json:"has_text"`
Text string `json:"text"`
}
RawFileContentResponse is the response body for the raw file content endpoint.
type RawSearchRequest ¶
type RawSearchRequest struct {
Query string `json:"query"`
TeamID string `json:"team_id,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
RawSearchRequest represents the request body for the raw semantic search endpoint
type RawSearchResponse ¶
type RawSearchResponse struct {
Results []RawSearchResult `json:"results"`
}
RawSearchResponse represents the response body for the raw semantic search endpoint
type RawSearchResult ¶
type RawSearchResult struct {
PostID string `json:"post_id"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
UserID string `json:"user_id"`
Username string `json:"username"`
Content string `json:"content"`
Score float32 `json:"score"`
CreateAt int64 `json:"create_at"` // Post creation timestamp (Unix millis)
}
RawSearchResult represents a single raw semantic search result
type ReindexRequest ¶
type ReindexRequest struct {
ClearIndex *bool `json:"clearIndex"`
}
ReindexRequest represents the request body for reindexing
type RenderRequest ¶
type RenderRequest struct {
ChannelID string `json:"channel_id"`
// BotID is the agent's bot user ID; it takes precedence over BotUsername.
BotID string `json:"bot_id"`
// BotUsername is deprecated: it selects only the agent whose account
// currently holds the name.
BotUsername string `json:"bot_username"`
}
RenderRequest represents the request body for rendering a custom prompt template.
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
// TeamID is the user's current team, used for citation links.
TeamID string `json:"teamId"`
// ChannelID is the channel the agent searches first.
ChannelID string `json:"channelId"`
}
SearchRequest is a search started from the search bar or /ask-channel.
type ServiceInfo ¶
type ServiceInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
DefaultModel string `json:"defaultModel"`
OutputTokenLimit int `json:"outputTokenLimit"`
UseResponsesAPI bool `json:"useResponsesAPI"`
}
ServiceInfo is a client-safe view of an AI service (no secrets).
type SetPinRequest ¶
SetPinRequest represents the request body for pinning/unpinning a prompt.
type StreamStopClusterNotifier ¶
StreamStopClusterNotifier broadcasts a stop-streaming request to peer nodes so HA deployments without sticky sessions can cancel an in-flight LLM stream no matter which node handles the /stop request.
type TurnResponse ¶
type TurnResponse struct {
ID string `json:"id"`
PostID *string `json:"post_id"`
Role string `json:"role"`
Content json.RawMessage `json:"content"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
Sequence int `json:"sequence"`
// ApprovalState is set only on post-anchor assistant turns (those with
// a non-nil PostID). One of "call" | "result" | "done". Computed by the
// server so the webapp renders approval UI from a single source of truth.
ApprovalState string `json:"approval_state,omitempty"`
// Status is the turn lifecycle state: "streaming" while a response is
// being generated, then "complete" or "interrupted".
Status string `json:"status"`
// RunPostID is the response post whose run wrote a tool-round turn. While
// that response streams, its anchor sits before these turns, so the
// webapp matches them by this ID.
RunPostID *string `json:"run_post_id,omitempty"`
}
TurnResponse is the JSON shape for a single turn within a conversation response.
type UpdateAgentRequest ¶
type UpdateAgentRequest struct {
AgentRequestFields
Username string `json:"username"`
// contains filtered or unexported fields
}
UpdateAgentRequest is the JSON body for PUT /agents/:agentid (full document replace, same shape as create). Omitting username keeps the current one.
func (*UpdateAgentRequest) UnmarshalJSON ¶
func (r *UpdateAgentRequest) UnmarshalJSON(data []byte) error
type UpdatePluginServerRequest ¶
type UpdatePluginServerRequest struct {
Enabled *bool `json:"enabled,omitempty"`
ToolConfigs *[]mcp.ToolConfig `json:"tool_configs,omitempty"`
}
UpdatePluginServerRequest is the body shape for PUT /admin/mcp/plugin-servers/:pluginID. Pointer fields use partial-update semantics: nil means unchanged.
type UserMCPServerInfo ¶
type UserMCPServerInfo struct {
Name string `json:"name"`
ServerOrigin string `json:"serverOrigin"`
Kind string `json:"kind"`
Authenticated bool `json:"authenticated"`
NeedsOAuth bool `json:"needsOAuth"`
AuthEmail string `json:"authEmail,omitempty"`
AuthURL string `json:"authURL,omitempty"`
ServiceAccountConfigured bool `json:"serviceAccountConfigured"`
Tools []UserMCPToolInfo `json:"tools"`
}
UserMCPServerInfo describes a single MCP server and its visible tools.
type UserMCPToolInfo ¶
type UserMCPToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
Policy string `json:"policy"`
InputSchema any `json:"inputSchema,omitempty"`
ReadOnlyHint bool `json:"readOnlyHint,omitempty"`
}
UserMCPToolInfo describes a single tool within a server response.
type UserMCPToolsResponse ¶
type UserMCPToolsResponse struct {
Servers []UserMCPServerInfo `json:"servers"`
}
UserMCPToolsResponse is the top-level response for GET /mcp/tools.
Source Files
¶
- agent_acl.go
- api.go
- api_access_control.go
- api_admin.go
- api_agent_versions.go
- api_agents.go
- api_artifacts.go
- api_bridge_mcp.go
- api_channel.go
- api_channel_autoreply.go
- api_config.go
- api_conversation.go
- api_conversation_context.go
- api_conversation_manage.go
- api_custom_prompts.go
- api_custom_prompts_permissions.go
- api_dictation.go
- api_files.go
- api_llm_bridge.go
- api_mcp.go
- api_oauth.go
- api_post.go
- api_search.go
- api_settings_access.go
- audit_events.go
- audit_middleware.go
- license.go
- mcp_handlers.go
- middleware_mcp.go