controllers

package
v1.347.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const BaseSettingsName = "base"

BaseSettingsName is the reserved name for global base settings (admin-only)

Variables

This section is empty.

Functions

func IsSessionLimitError added in v1.234.0

func IsSessionLimitError(err error) bool

IsSessionLimitError checks whether an error represents a session limit being reached.

func MergeSessionConfigs added in v1.234.0

func MergeSessionConfigs(base, override *entities.WebhookSessionConfig) *entities.WebhookSessionConfig

MergeSessionConfigs merges two session configs, with override taking precedence over base.

func RenderSessionParams added in v1.234.0

func RenderSessionParams(sessionConfig *entities.WebhookSessionConfig, payload map[string]interface{}) (*entities.SessionParams, error)

RenderSessionParams renders all template fields in session params.

func RenderTemplate added in v1.234.0

func RenderTemplate(tmplStr string, payload map[string]interface{}) (string, error)

RenderTemplate renders a Go template with a payload data map.

func RenderTemplateMap added in v1.234.0

func RenderTemplateMap(templates map[string]string, payload map[string]interface{}) (map[string]string, error)

RenderTemplateMap renders all template values in a map.

func SortTriggersByPriority added in v1.234.0

func SortTriggersByPriority(triggers []entities.WebhookTrigger) []entities.WebhookTrigger

SortTriggersByPriority returns a copy of triggers sorted by priority (lower number = higher priority).

Types

type AuthController

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

AuthController handles HTTP requests for authentication operations

func NewAuthController

func NewAuthController(
	authenticateUserUC *auth.AuthenticateUserUseCase,
	validateAPIKeyUC *auth.ValidateAPIKeyUseCase,
	githubAuthenticateUC *auth.GitHubAuthenticateUseCase,
	validatePermissionUC *auth.ValidatePermissionUseCase,
	authPresenter presenters.AuthPresenter,
) *AuthController

NewAuthController creates a new AuthController

func (*AuthController) GitHubLogin

func (c *AuthController) GitHubLogin(w http.ResponseWriter, r *http.Request)

GitHubLogin handles POST /auth/github

func (*AuthController) Login

func (c *AuthController) Login(w http.ResponseWriter, r *http.Request)

Login handles POST /auth/login

func (*AuthController) Logout

func (c *AuthController) Logout(w http.ResponseWriter, r *http.Request)

Logout handles POST /auth/logout

func (*AuthController) ValidateAPIKey

func (c *AuthController) ValidateAPIKey(w http.ResponseWriter, r *http.Request)

ValidateAPIKey handles POST /auth/validate

type AuthInfoController added in v1.148.0

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

AuthInfoController handles auth info-related HTTP requests

func NewAuthInfoController added in v1.148.0

func NewAuthInfoController(cfg *config.Config) *AuthInfoController

NewAuthInfoController creates a new AuthInfoController

func (*AuthInfoController) GetAuthStatus added in v1.148.0

func (c *AuthInfoController) GetAuthStatus(ctx echo.Context) error

GetAuthStatus returns current authentication status

type AuthMiddleware

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

AuthMiddleware provides authentication middleware

func NewAuthMiddleware

func NewAuthMiddleware(
	validateAPIKeyUC *auth.ValidateAPIKeyUseCase,
	authPresenter presenters.AuthPresenter,
) *AuthMiddleware

NewAuthMiddleware creates a new AuthMiddleware

func (*AuthMiddleware) Authenticate

func (m *AuthMiddleware) Authenticate(next http.Handler) http.Handler

Authenticate is a middleware that validates API keys and sets user context

type AuthServiceForPersonalAPIKey added in v1.219.0

type AuthServiceForPersonalAPIKey interface {
	LoadPersonalAPIKey(ctx context.Context, apiKey *entities.PersonalAPIKey) error
}

AuthServiceForPersonalAPIKey defines the interface for auth service methods needed by this controller

type AuthStatusResponse added in v1.148.0

type AuthStatusResponse struct {
	Authenticated bool                 `json:"authenticated"`
	AuthType      string               `json:"auth_type,omitempty"`
	UserID        string               `json:"user_id,omitempty"`
	Role          string               `json:"role,omitempty"`
	Permissions   []string             `json:"permissions,omitempty"`
	GitHubUser    *auth.GitHubUserInfo `json:"github_user,omitempty"`
}

AuthStatusResponse represents the response for auth status

type BedrockSettingsRequest added in v1.148.0

type BedrockSettingsRequest struct {
	Enabled         bool   `json:"enabled"`
	Model           string `json:"model,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
	RoleARN         string `json:"role_arn,omitempty"`
	Profile         string `json:"profile,omitempty"`
}

BedrockSettingsRequest is the request body for Bedrock settings

type BedrockSettingsResponse added in v1.148.0

type BedrockSettingsResponse struct {
	Enabled         bool   `json:"enabled"`
	Model           string `json:"model,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
	RoleARN         string `json:"role_arn,omitempty"`
	Profile         string `json:"profile,omitempty"`
}

BedrockSettingsResponse is the response body for Bedrock settings

type CreateMemoryRequest added in v1.242.0

type CreateMemoryRequest struct {
	Title   string            `json:"title"`
	Content string            `json:"content"`
	Scope   string            `json:"scope"`             // "user" or "team"
	TeamID  string            `json:"team_id,omitempty"` // required when scope=="team"
	Tags    map[string]string `json:"tags,omitempty"`
}

CreateMemoryRequest is the JSON body for POST /memories

type CreateSlackBotRequest added in v1.261.0

type CreateSlackBotRequest struct {
	Name   string                 `json:"name"`
	Scope  entities.ResourceScope `json:"scope,omitempty"`
	TeamID string                 `json:"team_id,omitempty"`
	// Teams is an explicit list of team IDs (e.g. ["org/team-slug"]) whose settings
	// (MCP servers, env vars, Bedrock config, etc.) will be merged into sessions
	// created by this bot. When omitted, the server falls back to the authenticated
	// user's team memberships at creation time.
	Teams               []string               `json:"teams,omitempty"`
	BotTokenSecretName  string                 `json:"bot_token_secret_name,omitempty"`
	BotTokenSecretKey   string                 `json:"bot_token_secret_key,omitempty"`
	AllowedEventTypes   []string               `json:"allowed_event_types,omitempty"`
	AllowedChannelNames []string               `json:"allowed_channel_names,omitempty"`
	SessionConfig       *SlackBotSessionConfig `json:"session_config,omitempty"`
	MaxSessions         int                    `json:"max_sessions,omitempty"`
	// NotifyOnSessionCreated controls whether the bot posts a Slack message with
	// the session URL when a new session is created. Defaults to true.
	NotifyOnSessionCreated *bool `json:"notify_on_session_created,omitempty"`
	// AllowBotMessages controls whether the bot processes messages posted by other bots.
	// Defaults to false to prevent recursive session creation.
	AllowBotMessages *bool `json:"allow_bot_messages,omitempty"`
	// BotToken is the Slack bot token (xoxb-...). Write-only: stored in K8s Secret, never returned.
	BotToken string `json:"bot_token,omitempty"`
	// AppToken is the Slack app-level token (xapp-...). Write-only: stored in K8s Secret, never returned.
	AppToken string `json:"app_token,omitempty"`
}

CreateSlackBotRequest is the request body for creating a SlackBot

type CreateSubscriptionRequest

type CreateSubscriptionRequest struct {
	Type     string            `json:"type"`
	Endpoint string            `json:"endpoint"`
	Keys     map[string]string `json:"keys,omitempty"`
}

CreateSubscriptionRequest represents the HTTP request for creating a subscription

type CreateTaskGroupRequest added in v1.246.0

type CreateTaskGroupRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Scope       string `json:"scope"`             // "user" or "team"
	TeamID      string `json:"team_id,omitempty"` // required when scope=="team"
}

CreateTaskGroupRequest is the JSON body for POST /task-groups

type CreateTaskRequest added in v1.246.0

type CreateTaskRequest struct {
	Title       string            `json:"title"`
	Description string            `json:"description,omitempty"`
	TaskType    string            `json:"task_type"`            // "user" or "agent"
	Scope       string            `json:"scope"`                // "user" or "team"
	TeamID      string            `json:"team_id,omitempty"`    // required when scope=="team"
	GroupID     string            `json:"group_id,omitempty"`   // optional
	SessionID   string            `json:"session_id,omitempty"` // optional, for agent tasks
	Links       []TaskLinkRequest `json:"links,omitempty"`
}

CreateTaskRequest is the JSON body for POST /tasks

type CreateWebhookRequest added in v1.155.0

type CreateWebhookRequest struct {
	Name            string                        `json:"name"`
	Scope           entities.ResourceScope        `json:"scope,omitempty"`
	TeamID          string                        `json:"team_id,omitempty"`
	Type            entities.WebhookType          `json:"type"`
	Secret          string                        `json:"secret,omitempty"`
	SignatureHeader string                        `json:"signature_header,omitempty"`
	SignatureType   entities.WebhookSignatureType `json:"signature_type,omitempty"`
	SignaturePrefix string                        `json:"signature_prefix,omitempty"`
	GitHub          *GitHubConfigRequest          `json:"github,omitempty"`
	Triggers        []TriggerRequest              `json:"triggers"`
	SessionConfig   *SessionConfigRequest         `json:"session_config,omitempty"`
	MaxSessions     int                           `json:"max_sessions,omitempty"`
}

CreateWebhookRequest represents the request body for creating a webhook

type DeliveryRecordResponse added in v1.155.0

type DeliveryRecordResponse struct {
	ID             string `json:"id"`
	ReceivedAt     string `json:"received_at"`
	Status         string `json:"status"`
	MatchedTrigger string `json:"matched_trigger,omitempty"`
	SessionID      string `json:"session_id,omitempty"`
	Error          string `json:"error,omitempty"`
}

DeliveryRecordResponse represents a delivery record in responses

type DryRunResult added in v1.235.0

type DryRunResult struct {
	InitialMessage string
	Tags           map[string]string
	Environment    map[string]string
	Error          string
}

DryRunResult holds the computed configuration from a dry-run test.

type ExternalSessionManagerRequest added in v1.347.0

type ExternalSessionManagerRequest struct {
	ID         string `json:"id,omitempty"`          // Auto-generated if empty
	Name       string `json:"name"`                  // Human-readable name
	URL        string `json:"url"`                   // Proxy B URL
	HMACSecret string `json:"hmac_secret,omitempty"` // Auto-generated if empty; omit to keep existing
}

ExternalSessionManagerRequest represents a single external session manager registration

type ExternalSessionManagerResponse added in v1.347.0

type ExternalSessionManagerResponse struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	HMACSecret string `json:"hmac_secret,omitempty"`
}

ExternalSessionManagerResponse represents a single external session manager in responses

type GetOrCreatePersonalAPIKeyUseCase added in v1.218.0

type GetOrCreatePersonalAPIKeyUseCase interface {
	Execute(ctx context.Context, userID entities.UserID) (*entities.PersonalAPIKey, error)
}

GetOrCreatePersonalAPIKeyUseCase defines the interface for personal API key use case

type GitHubCommit added in v1.155.0

type GitHubCommit struct {
	ID       string              `json:"id"`
	Message  string              `json:"message"`
	Author   *GitHubCommitAuthor `json:"author,omitempty"`
	Added    []string            `json:"added,omitempty"`
	Removed  []string            `json:"removed,omitempty"`
	Modified []string            `json:"modified,omitempty"`
}

GitHubCommit represents a GitHub commit

type GitHubCommitAuthor added in v1.155.0

type GitHubCommitAuthor struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username,omitempty"`
}

GitHubCommitAuthor represents a commit author

type GitHubConditionsRequest added in v1.155.0

type GitHubConditionsRequest struct {
	Events       []string `json:"events,omitempty"`
	Actions      []string `json:"actions,omitempty"`
	Branches     []string `json:"branches,omitempty"`
	Repositories []string `json:"repositories,omitempty"`
	Labels       []string `json:"labels,omitempty"`
	Paths        []string `json:"paths,omitempty"`
	BaseBranches []string `json:"base_branches,omitempty"`
	Draft        *bool    `json:"draft,omitempty"`
	Sender       []string `json:"sender,omitempty"`
}

GitHubConditionsRequest represents GitHub-specific conditions in requests

type GitHubConditionsResponse added in v1.155.0

type GitHubConditionsResponse struct {
	Events       []string `json:"events,omitempty"`
	Actions      []string `json:"actions,omitempty"`
	Branches     []string `json:"branches,omitempty"`
	Repositories []string `json:"repositories,omitempty"`
	Labels       []string `json:"labels,omitempty"`
	Paths        []string `json:"paths,omitempty"`
	BaseBranches []string `json:"base_branches,omitempty"`
	Draft        *bool    `json:"draft,omitempty"`
	Sender       []string `json:"sender,omitempty"`
}

GitHubConditionsResponse represents GitHub-specific conditions in responses

type GitHubConfigRequest added in v1.155.0

type GitHubConfigRequest struct {
	EnterpriseURL       string   `json:"enterprise_url,omitempty"`
	AllowedEvents       []string `json:"allowed_events,omitempty"`
	AllowedRepositories []string `json:"allowed_repositories,omitempty"`
}

GitHubConfigRequest represents GitHub-specific configuration in requests

type GitHubConfigResponse added in v1.155.0

type GitHubConfigResponse struct {
	EnterpriseURL       string   `json:"enterprise_url,omitempty"`
	AllowedEvents       []string `json:"allowed_events,omitempty"`
	AllowedRepositories []string `json:"allowed_repositories,omitempty"`
}

GitHubConfigResponse represents GitHub-specific configuration in responses

type GitHubIssue added in v1.155.0

type GitHubIssue struct {
	Number  int           `json:"number"`
	Title   string        `json:"title"`
	Body    string        `json:"body,omitempty"`
	State   string        `json:"state"`
	HTMLURL string        `json:"html_url"`
	User    *GitHubUser   `json:"user,omitempty"`
	Labels  []GitHubLabel `json:"labels,omitempty"`
}

GitHubIssue represents a GitHub issue

type GitHubLabel added in v1.155.0

type GitHubLabel struct {
	Name  string `json:"name"`
	Color string `json:"color,omitempty"`
}

GitHubLabel represents a GitHub label

type GitHubLoginRequest

type GitHubLoginRequest struct {
	Token string `json:"token"`
}

GitHubLoginRequest represents the HTTP request for GitHub login

type GitHubPayload added in v1.155.0

type GitHubPayload struct {
	Action     string            `json:"action,omitempty"`
	Ref        string            `json:"ref,omitempty"`
	Repository *GitHubRepository `json:"repository,omitempty"`
	Sender     *GitHubUser       `json:"sender,omitempty"`

	// Pull request specific
	PullRequest *GitHubPullRequest `json:"pull_request,omitempty"`

	// Issue specific
	Issue *GitHubIssue `json:"issue,omitempty"`

	// Push specific
	Commits    []GitHubCommit `json:"commits,omitempty"`
	HeadCommit *GitHubCommit  `json:"head_commit,omitempty"`

	// Raw payload for template rendering
	Raw map[string]interface{} `json:"-"`
}

GitHubPayload represents relevant fields from a GitHub webhook payload

type GitHubPullRequest added in v1.155.0

type GitHubPullRequest struct {
	Number   int           `json:"number"`
	Title    string        `json:"title"`
	Body     string        `json:"body,omitempty"`
	State    string        `json:"state"`
	Draft    bool          `json:"draft"`
	HTMLURL  string        `json:"html_url"`
	User     *GitHubUser   `json:"user,omitempty"`
	Head     *GitHubRef    `json:"head,omitempty"`
	Base     *GitHubRef    `json:"base,omitempty"`
	Labels   []GitHubLabel `json:"labels,omitempty"`
	Merged   bool          `json:"merged"`
	MergedAt string        `json:"merged_at,omitempty"`
}

GitHubPullRequest represents a GitHub pull request

type GitHubRef added in v1.155.0

type GitHubRef struct {
	Ref  string            `json:"ref"`
	SHA  string            `json:"sha"`
	Repo *GitHubRepository `json:"repo,omitempty"`
}

GitHubRef represents a git reference

type GitHubRepository added in v1.155.0

type GitHubRepository struct {
	FullName      string      `json:"full_name"`
	Name          string      `json:"name"`
	Owner         *GitHubUser `json:"owner,omitempty"`
	DefaultBranch string      `json:"default_branch,omitempty"`
	HTMLURL       string      `json:"html_url,omitempty"`
	CloneURL      string      `json:"clone_url,omitempty"`
}

GitHubRepository represents a GitHub repository

type GitHubUser added in v1.155.0

type GitHubUser struct {
	Login     string `json:"login"`
	ID        int64  `json:"id"`
	AvatarURL string `json:"avatar_url,omitempty"`
	HTMLURL   string `json:"html_url,omitempty"`
}

GitHubUser represents a GitHub user

type HealthController added in v1.148.0

type HealthController struct{}

HealthController handles health check endpoints

func NewHealthController added in v1.148.0

func NewHealthController() *HealthController

NewHealthController creates a new HealthController instance

func (*HealthController) GetName added in v1.148.0

func (c *HealthController) GetName() string

GetName returns the name of this controller for logging

func (*HealthController) HealthCheck added in v1.148.0

func (c *HealthController) HealthCheck(ctx echo.Context) error

HealthCheck handles GET /health requests to check server health

type LoginRequest

type LoginRequest struct {
	Type     string `json:"type"` // "password", "token", "api_key"
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
	APIKey   string `json:"api_key,omitempty"`
}

LoginRequest represents the HTTP request for user login

type MCPServerRequest added in v1.148.0

type MCPServerRequest struct {
	Type    string            `json:"type"`              // "stdio", "http", "sse"
	URL     string            `json:"url,omitempty"`     // for http/sse
	Command string            `json:"command,omitempty"` // for stdio
	Args    []string          `json:"args,omitempty"`    // for stdio
	Env     map[string]string `json:"env,omitempty"`     // environment variables
	Headers map[string]string `json:"headers,omitempty"` // for http/sse
}

MCPServerRequest is the request body for a single MCP server

type MCPServerResponse added in v1.148.0

type MCPServerResponse struct {
	Type       string   `json:"type"`
	URL        string   `json:"url,omitempty"`
	Command    string   `json:"command,omitempty"`
	Args       []string `json:"args,omitempty"`
	EnvKeys    []string `json:"env_keys,omitempty"`    // only keys, not values
	HeaderKeys []string `json:"header_keys,omitempty"` // only keys, not values
}

MCPServerResponse is the response body for a single MCP server

type MarketplaceRequest added in v1.148.0

type MarketplaceRequest struct {
	URL string `json:"url"`
}

MarketplaceRequest is the request body for a single marketplace

type MarketplaceResponse added in v1.148.0

type MarketplaceResponse struct {
	URL string `json:"url"`
}

MarketplaceResponse is the response body for a single marketplace

type MemoryController added in v1.242.0

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

MemoryController handles memory entry HTTP requests

func NewMemoryController added in v1.242.0

func NewMemoryController(repo portrepos.MemoryRepository) *MemoryController

NewMemoryController creates a new MemoryController

func (*MemoryController) CreateMemory added in v1.242.0

func (c *MemoryController) CreateMemory(ctx echo.Context) error

CreateMemory handles POST /memories

func (*MemoryController) DeleteMemory added in v1.242.0

func (c *MemoryController) DeleteMemory(ctx echo.Context) error

DeleteMemory handles DELETE /memories/:memoryId

func (*MemoryController) GetMemory added in v1.242.0

func (c *MemoryController) GetMemory(ctx echo.Context) error

GetMemory handles GET /memories/:memoryId

func (*MemoryController) GetName added in v1.242.0

func (c *MemoryController) GetName() string

GetName returns the name of this controller for logging

func (*MemoryController) ListMemories added in v1.242.0

func (c *MemoryController) ListMemories(ctx echo.Context) error

ListMemories handles GET /memories Query params: scope, team_id, include_tag.*, exclude_tag.*, q

func (*MemoryController) UpdateMemory added in v1.242.0

func (c *MemoryController) UpdateMemory(ctx echo.Context) error

UpdateMemory handles PUT /memories/:memoryId

type MemoryListResponse added in v1.242.0

type MemoryListResponse struct {
	Memories []*MemoryResponse `json:"memories"`
	Total    int               `json:"total"`
}

MemoryListResponse wraps a list of memory entries

type MemoryResponse added in v1.242.0

type MemoryResponse struct {
	ID        string            `json:"id"`
	Title     string            `json:"title"`
	Content   string            `json:"content"`
	Scope     string            `json:"scope"`
	OwnerID   string            `json:"owner_id"`
	TeamID    string            `json:"team_id,omitempty"`
	Tags      map[string]string `json:"tags,omitempty"`
	CreatedAt string            `json:"created_at"`
	UpdatedAt string            `json:"updated_at"`
}

MemoryResponse is the response for a single memory entry

type NotificationController

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

NotificationController handles HTTP requests for notification operations

func NewNotificationController

func NewNotificationController(
	sendNotificationUC *notification.SendNotificationUseCase,
	manageSubscriptionUC *notification.ManageSubscriptionUseCase,
	notificationPresenter presenters.NotificationPresenter,
) *NotificationController

NewNotificationController creates a new NotificationController

func (*NotificationController) CreateSubscription

func (c *NotificationController) CreateSubscription(w http.ResponseWriter, r *http.Request)

CreateSubscription handles POST /subscriptions

func (*NotificationController) DeleteSubscription

func (c *NotificationController) DeleteSubscription(w http.ResponseWriter, r *http.Request)

DeleteSubscription handles DELETE /subscriptions/{id}

func (*NotificationController) SendNotification

func (c *NotificationController) SendNotification(w http.ResponseWriter, r *http.Request)

SendNotification handles POST /notifications

type NotificationHandlers added in v1.148.0

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

NotificationHandlers handles notification-related HTTP requests This is a simpler handler that uses the notification.Service directly

func NewNotificationHandlers added in v1.148.0

func NewNotificationHandlers(service *notification.Service, sessionManager portrepos.SessionManager) *NotificationHandlers

NewNotificationHandlers creates new notification handlers

func (*NotificationHandlers) DeleteSubscription added in v1.148.0

func (h *NotificationHandlers) DeleteSubscription(c echo.Context) error

DeleteSubscription handles DELETE /notification/subscribe

func (*NotificationHandlers) GetHistory added in v1.148.0

func (h *NotificationHandlers) GetHistory(c echo.Context) error

GetHistory handles GET /notifications/history

func (*NotificationHandlers) GetSubscriptions added in v1.148.0

func (h *NotificationHandlers) GetSubscriptions(c echo.Context) error

GetSubscriptions handles GET /notification/subscribe

func (*NotificationHandlers) SendNotification added in v1.336.0

func (h *NotificationHandlers) SendNotification(c echo.Context) error

SendNotification handles POST /notifications/send

Routing logic:

  • session_id provided: look up the session via SessionManager.
  • team-scoped session → no notification is sent (return success).
  • user-scoped session → resolve to the session owner's user_id and send.
  • user_id provided: send directly to that user.

func (*NotificationHandlers) Subscribe added in v1.148.0

func (h *NotificationHandlers) Subscribe(c echo.Context) error

Subscribe handles POST /notification/subscribe

func (*NotificationHandlers) Webhook added in v1.148.0

func (h *NotificationHandlers) Webhook(c echo.Context) error

Webhook handles POST /notifications/webhook

type PersonalAPIKeyController added in v1.218.0

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

PersonalAPIKeyController handles personal API key related requests

func NewPersonalAPIKeyController added in v1.218.0

func NewPersonalAPIKeyController(
	getOrCreateAPIKeyUC GetOrCreatePersonalAPIKeyUseCase,
	authService AuthServiceForPersonalAPIKey,
) *PersonalAPIKeyController

NewPersonalAPIKeyController creates a new PersonalAPIKeyController

func (*PersonalAPIKeyController) GetOrCreatePersonalAPIKey added in v1.218.0

func (c *PersonalAPIKeyController) GetOrCreatePersonalAPIKey(ctx echo.Context) error

GetOrCreatePersonalAPIKey handles GET /users/me/api-key and POST /users/me/api-key requests GET returns the existing API key (without revealing the key value for security) POST creates a new API key or regenerates if one already exists

type SendNotificationRequest

type SendNotificationRequest struct {
	Title   string            `json:"title"`
	Body    string            `json:"body"`
	URL     *string           `json:"url,omitempty"`
	Tags    map[string]string `json:"tags,omitempty"`
	IconURL *string           `json:"icon_url,omitempty"`
}

SendNotificationRequest represents the HTTP request for sending a notification

type SessionConfigRequest added in v1.155.0

type SessionConfigRequest struct {
	Environment            map[string]string       `json:"environment,omitempty"`
	Tags                   map[string]string       `json:"tags,omitempty"`
	InitialMessageTemplate string                  `json:"initial_message_template,omitempty"`
	ReuseMessageTemplate   string                  `json:"reuse_message_template,omitempty"`
	Params                 *entities.SessionParams `json:"params,omitempty"`
	ReuseSession           bool                    `json:"reuse_session,omitempty"`
	MountPayload           bool                    `json:"mount_payload,omitempty"`
}

SessionConfigRequest represents session configuration in requests

type SessionConfigResponse added in v1.155.0

type SessionConfigResponse struct {
	Environment            map[string]string      `json:"environment,omitempty"`
	Tags                   map[string]string      `json:"tags,omitempty"`
	InitialMessageTemplate string                 `json:"initial_message_template,omitempty"`
	ReuseMessageTemplate   string                 `json:"reuse_message_template,omitempty"`
	Params                 *SessionParamsResponse `json:"params,omitempty"`
	ReuseSession           bool                   `json:"reuse_session,omitempty"`
	MountPayload           bool                   `json:"mount_payload,omitempty"`
}

SessionConfigResponse represents session configuration in responses

type SessionController

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

SessionController handles session management endpoints

func NewSessionController

func NewSessionController(
	sessionManagerProvider SessionManagerProvider,
	sessionCreator SessionCreator,
	opts ...SessionControllerOption,
) *SessionController

NewSessionController creates a new SessionController instance

func (*SessionController) DeleteSession

func (c *SessionController) DeleteSession(ctx echo.Context) error

DeleteSession handles DELETE /sessions/:sessionId requests to terminate a session

func (*SessionController) GetName added in v1.148.0

func (c *SessionController) GetName() string

GetName returns the name of this handler for logging

func (*SessionController) RegisterRoutes added in v1.148.0

func (c *SessionController) RegisterRoutes(e *echo.Echo) error

RegisterRoutes registers session management routes

func (*SessionController) RouteToSession added in v1.148.0

func (c *SessionController) RouteToSession(ctx echo.Context) error

RouteToSession routes requests to the appropriate agentapi server instance

func (*SessionController) SearchSessions added in v1.148.0

func (c *SessionController) SearchSessions(ctx echo.Context) error

SearchSessions handles GET /search requests to list and filter active sessions

func (*SessionController) StartSession added in v1.148.0

func (c *SessionController) StartSession(ctx echo.Context) error

StartSession handles POST /start requests to start a new agentapi server

type SessionControllerOption added in v1.347.0

type SessionControllerOption func(*SessionController)

SessionControllerOption is a functional option for SessionController

func WithSessionRouteRepository added in v1.347.0

func WithSessionRouteRepository(repo repositories.SessionRouteRepository) SessionControllerOption

WithSessionRouteRepository sets the session route repository on the controller

func WithSettingsRepository added in v1.347.0

func WithSettingsRepository(repo repositories.SettingsRepository) SessionControllerOption

WithSettingsRepository sets the settings repository on the controller

type SessionCreationParams added in v1.234.0

type SessionCreationParams struct {
	Webhook        *entities.Webhook
	Trigger        *entities.WebhookTrigger
	Payload        map[string]interface{}
	RawPayload     []byte
	Tags           map[string]string
	DefaultMessage string
	MountPayload   bool
}

SessionCreationParams holds all parameters needed to create a session from a webhook delivery.

type SessionCreator added in v1.148.0

type SessionCreator interface {
	CreateSession(sessionID string, req entities.StartRequest, userID, userRole string, teams []string) (entities.Session, error)
	DeleteSessionByID(sessionID string) error
}

SessionCreator is an interface for creating sessions

type SessionManagerProvider added in v1.148.0

type SessionManagerProvider interface {
	GetSessionManager() repositories.SessionManager
}

SessionManagerProvider provides access to the session manager This allows the session manager to be swapped at runtime (e.g., for testing)

type SessionParamsResponse added in v1.155.0

type SessionParamsResponse struct {
	GithubToken string `json:"github_token,omitempty"`
	AgentType   string `json:"agent_type,omitempty"`
	Oneshot     bool   `json:"oneshot,omitempty"`
}

SessionParamsResponse represents session params in responses

type SettingsController added in v1.148.0

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

SettingsController handles settings-related HTTP requests

func NewSettingsController added in v1.148.0

func NewSettingsController(repo repositories.SettingsRepository, notificationSvc *notification.Service) *SettingsController

NewSettingsController creates new settings controller

func (*SettingsController) DeleteSettings added in v1.148.0

func (c *SettingsController) DeleteSettings(ctx echo.Context) error

DeleteSettings handles DELETE /settings/:name

func (*SettingsController) GetName added in v1.148.0

func (c *SettingsController) GetName() string

GetName returns the name of this controller for logging

func (*SettingsController) GetSettings added in v1.148.0

func (c *SettingsController) GetSettings(ctx echo.Context) error

GetSettings handles GET /settings/:name

func (*SettingsController) UpdateSettings added in v1.148.0

func (c *SettingsController) UpdateSettings(ctx echo.Context) error

UpdateSettings handles PUT /settings/:name

type SettingsResponse added in v1.148.0

type SettingsResponse struct {
	Name                    string                           `json:"name"`
	Bedrock                 *BedrockSettingsResponse         `json:"bedrock,omitempty"`
	MCPServers              map[string]*MCPServerResponse    `json:"mcp_servers,omitempty"`
	Marketplaces            map[string]*MarketplaceResponse  `json:"marketplaces,omitempty"`
	HasClaudeCodeOAuthToken bool                             `json:"has_claude_code_oauth_token"`
	AuthMode                string                           `json:"auth_mode,omitempty"`
	EnabledPlugins          []string                         `json:"enabled_plugins,omitempty"`           // plugin@marketplace format
	EnvVarKeys              []string                         `json:"env_var_keys,omitempty"`              // only keys, not values
	PreferredTeamID         string                           `json:"preferred_team_id,omitempty"`         // "org/team-slug" format
	SlackUserID             string                           `json:"slack_user_id,omitempty"`             // Slack DM notification user ID
	NotificationChannels    []string                         `json:"notification_channels,omitempty"`     // Active notification channels
	ExternalSessionManagers []ExternalSessionManagerResponse `json:"external_session_managers,omitempty"` // Registered external session managers
	CreatedAt               string                           `json:"created_at"`
	UpdatedAt               string                           `json:"updated_at"`
}

SettingsResponse is the response body for settings

type ShareController added in v1.148.0

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

ShareController handles session sharing endpoints

func NewShareController added in v1.148.0

func NewShareController(
	sessionManagerProvider SessionManagerProvider,
	shareRepo repositories.ShareRepository,
) *ShareController

NewShareController creates a new ShareController instance

func (*ShareController) CreateShare added in v1.148.0

func (c *ShareController) CreateShare(ctx echo.Context) error

CreateShare handles POST /sessions/:sessionId/share to create a share URL

func (*ShareController) DeleteShare added in v1.148.0

func (c *ShareController) DeleteShare(ctx echo.Context) error

DeleteShare handles DELETE /sessions/:sessionId/share to revoke share

func (*ShareController) GetName added in v1.148.0

func (c *ShareController) GetName() string

GetName returns the name of this handler for logging

func (*ShareController) GetShare added in v1.148.0

func (c *ShareController) GetShare(ctx echo.Context) error

GetShare handles GET /sessions/:sessionId/share to get share status

func (*ShareController) RouteToSharedSession added in v1.148.0

func (c *ShareController) RouteToSharedSession(ctx echo.Context) error

RouteToSharedSession handles ANY /s/:shareToken/* to access shared session

type SlackBotController added in v1.261.0

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

SlackBotController handles SlackBot management API requests

func NewSlackBotController added in v1.261.0

func NewSlackBotController(repo repositories.SlackBotRepository) *SlackBotController

NewSlackBotController creates a new SlackBotController

func (*SlackBotController) CreateSlackBot added in v1.261.0

func (c *SlackBotController) CreateSlackBot(ctx echo.Context) error

CreateSlackBot handles POST /slackbots

func (*SlackBotController) DeleteSlackBot added in v1.261.0

func (c *SlackBotController) DeleteSlackBot(ctx echo.Context) error

DeleteSlackBot handles DELETE /slackbots/:id

func (*SlackBotController) GetSlackBot added in v1.261.0

func (c *SlackBotController) GetSlackBot(ctx echo.Context) error

GetSlackBot handles GET /slackbots/:id

func (*SlackBotController) ListSlackBots added in v1.261.0

func (c *SlackBotController) ListSlackBots(ctx echo.Context) error

ListSlackBots handles GET /slackbots

func (*SlackBotController) UpdateSlackBot added in v1.261.0

func (c *SlackBotController) UpdateSlackBot(ctx echo.Context) error

UpdateSlackBot handles PUT /slackbots/:id

type SlackBotEventHandler added in v1.261.0

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

SlackBotEventHandler handles incoming Slack events (via Socket Mode) and manages sessions

func NewSlackBotEventHandler added in v1.261.0

func NewSlackBotEventHandler(
	repo repositories.SlackBotRepository,
	sessionManager repositories.SessionManager,
	defaultBotTokenSecretName string,
	defaultBotTokenSecretKey string,
	channelResolver *services.SlackChannelResolver,
	baseURL string,
	dryRun bool,
	memoryRepo repositories.MemoryRepository,
) *SlackBotEventHandler

NewSlackBotEventHandler creates a new SlackBotEventHandler

func (*SlackBotEventHandler) ProcessEvent added in v1.271.0

func (h *SlackBotEventHandler) ProcessEvent(ctx context.Context, botID string, payload SlackPayload) error

ProcessEvent processes a parsed Slack event received via Socket Mode. botID should be the SlackBot entity ID or slackBotDefaultID ("default"). This method is called by SlackSocketWorker after acknowledging the event to Slack.

type SlackBotResponse added in v1.261.0

type SlackBotResponse struct {
	ID                     string                  `json:"id"`
	Name                   string                  `json:"name"`
	UserID                 string                  `json:"user_id"`
	Scope                  entities.ResourceScope  `json:"scope,omitempty"`
	TeamID                 string                  `json:"team_id,omitempty"`
	Teams                  []string                `json:"teams,omitempty"`
	Status                 entities.SlackBotStatus `json:"status"`
	BotTokenSecretName     string                  `json:"bot_token_secret_name,omitempty"`
	BotTokenSecretKey      string                  `json:"bot_token_secret_key,omitempty"`
	AllowedEventTypes      []string                `json:"allowed_event_types,omitempty"`
	AllowedChannelNames    []string                `json:"allowed_channel_names,omitempty"`
	SessionConfig          *SlackBotSessionConfig  `json:"session_config,omitempty"`
	MaxSessions            int                     `json:"max_sessions"`
	NotifyOnSessionCreated bool                    `json:"notify_on_session_created"`
	AllowBotMessages       bool                    `json:"allow_bot_messages"`
	CreatedAt              time.Time               `json:"created_at"`
	UpdatedAt              time.Time               `json:"updated_at"`
}

SlackBotResponse is the API response for a SlackBot

type SlackBotSessionConfig added in v1.261.0

type SlackBotSessionConfig struct {
	InitialMessageTemplate string                 `json:"initial_message_template,omitempty"`
	ReuseMessageTemplate   string                 `json:"reuse_message_template,omitempty"`
	Tags                   map[string]string      `json:"tags,omitempty"`
	Environment            map[string]string      `json:"environment,omitempty"`
	Params                 *SlackBotSessionParams `json:"params,omitempty"`
	MemoryKey              map[string]string      `json:"memory_key,omitempty"`
}

SlackBotSessionConfig is the session configuration for a SlackBot

type SlackBotSessionParams added in v1.261.0

type SlackBotSessionParams struct {
	AgentType string `json:"agent_type,omitempty"`
	Oneshot   bool   `json:"oneshot,omitempty"`
}

SlackBotSessionParams contains session parameters for SlackBot sessions

type SlackEvent added in v1.271.0

type SlackEvent struct {
	Type     string `json:"type"`
	SubType  string `json:"subtype,omitempty"`
	BotID    string `json:"bot_id,omitempty"`
	Text     string `json:"text"`
	User     string `json:"user"`
	Channel  string `json:"channel"`
	Ts       string `json:"ts"`
	ThreadTs string `json:"thread_ts,omitempty"`
}

SlackEvent represents the inner Slack event

type SlackPayload added in v1.271.0

type SlackPayload struct {
	Type      string      `json:"type"`
	Challenge string      `json:"challenge,omitempty"`
	TeamID    string      `json:"team_id,omitempty"`
	Event     *SlackEvent `json:"event,omitempty"`
}

SlackPayload represents the outer Slack event payload structure

type TaskController added in v1.246.0

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

TaskController handles task HTTP requests

func NewTaskController added in v1.246.0

func NewTaskController(repo portrepos.TaskRepository) *TaskController

NewTaskController creates a new TaskController

func (*TaskController) CreateTask added in v1.246.0

func (c *TaskController) CreateTask(ctx echo.Context) error

CreateTask handles POST /tasks

func (*TaskController) DeleteTask added in v1.246.0

func (c *TaskController) DeleteTask(ctx echo.Context) error

DeleteTask handles DELETE /tasks/:taskId

func (*TaskController) GetName added in v1.246.0

func (c *TaskController) GetName() string

GetName returns the name of this controller for logging

func (*TaskController) GetTask added in v1.246.0

func (c *TaskController) GetTask(ctx echo.Context) error

GetTask handles GET /tasks/:taskId

func (*TaskController) ListTasks added in v1.246.0

func (c *TaskController) ListTasks(ctx echo.Context) error

ListTasks handles GET /tasks Query params: scope, team_id, group_id, status, task_type

func (*TaskController) UpdateTask added in v1.246.0

func (c *TaskController) UpdateTask(ctx echo.Context) error

UpdateTask handles PUT /tasks/:taskId

type TaskGroupController added in v1.246.0

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

TaskGroupController handles task group HTTP requests

func NewTaskGroupController added in v1.246.0

func NewTaskGroupController(repo portrepos.TaskGroupRepository) *TaskGroupController

NewTaskGroupController creates a new TaskGroupController

func (*TaskGroupController) CreateTaskGroup added in v1.246.0

func (c *TaskGroupController) CreateTaskGroup(ctx echo.Context) error

CreateTaskGroup handles POST /task-groups

func (*TaskGroupController) DeleteTaskGroup added in v1.246.0

func (c *TaskGroupController) DeleteTaskGroup(ctx echo.Context) error

DeleteTaskGroup handles DELETE /task-groups/:groupId

func (*TaskGroupController) GetName added in v1.246.0

func (c *TaskGroupController) GetName() string

GetName returns the name of this controller for logging

func (*TaskGroupController) GetTaskGroup added in v1.246.0

func (c *TaskGroupController) GetTaskGroup(ctx echo.Context) error

GetTaskGroup handles GET /task-groups/:groupId

func (*TaskGroupController) ListTaskGroups added in v1.246.0

func (c *TaskGroupController) ListTaskGroups(ctx echo.Context) error

ListTaskGroups handles GET /task-groups Query params: scope, team_id

func (*TaskGroupController) UpdateTaskGroup added in v1.246.0

func (c *TaskGroupController) UpdateTaskGroup(ctx echo.Context) error

UpdateTaskGroup handles PUT /task-groups/:groupId

type TaskGroupListResponse added in v1.246.0

type TaskGroupListResponse struct {
	TaskGroups []*TaskGroupResponse `json:"task_groups"`
	Total      int                  `json:"total"`
}

TaskGroupListResponse wraps a list of task groups

type TaskGroupResponse added in v1.246.0

type TaskGroupResponse struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Scope       string `json:"scope"`
	OwnerID     string `json:"owner_id"`
	TeamID      string `json:"team_id,omitempty"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

TaskGroupResponse is the response for a single task group

type TaskLinkRequest added in v1.246.0

type TaskLinkRequest struct {
	URL   string `json:"url"`
	Title string `json:"title,omitempty"`
}

TaskLinkRequest is the JSON body for a task link

type TaskLinkResponse added in v1.246.0

type TaskLinkResponse struct {
	ID    string `json:"id"`
	URL   string `json:"url"`
	Title string `json:"title,omitempty"`
}

TaskLinkResponse is the response for a single task link

type TaskListResponse added in v1.246.0

type TaskListResponse struct {
	Tasks []*TaskResponse `json:"tasks"`
	Total int             `json:"total"`
}

TaskListResponse wraps a list of tasks

type TaskResponse added in v1.246.0

type TaskResponse struct {
	ID          string             `json:"id"`
	Title       string             `json:"title"`
	Description string             `json:"description,omitempty"`
	Status      string             `json:"status"`
	TaskType    string             `json:"task_type"`
	Scope       string             `json:"scope"`
	OwnerID     string             `json:"owner_id"`
	TeamID      string             `json:"team_id,omitempty"`
	GroupID     string             `json:"group_id,omitempty"`
	SessionID   string             `json:"session_id,omitempty"`
	Links       []TaskLinkResponse `json:"links"`
	CreatedAt   string             `json:"created_at"`
	UpdatedAt   string             `json:"updated_at"`
}

TaskResponse is the response for a single task

type TriggerConditionsRequest added in v1.155.0

type TriggerConditionsRequest struct {
	GitHub     *GitHubConditionsRequest `json:"github,omitempty"`
	GoTemplate string                   `json:"go_template,omitempty"`
}

TriggerConditionsRequest represents trigger conditions in requests

type TriggerConditionsResponse added in v1.155.0

type TriggerConditionsResponse struct {
	GitHub     *GitHubConditionsResponse `json:"github,omitempty"`
	GoTemplate string                    `json:"go_template,omitempty"`
}

TriggerConditionsResponse represents trigger conditions in responses

type TriggerMatchedTriggerInfo added in v1.235.0

type TriggerMatchedTriggerInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

TriggerMatchedTriggerInfo contains information about a matched trigger

type TriggerRequest added in v1.155.0

type TriggerRequest struct {
	ID            string                   `json:"id,omitempty"`
	Name          string                   `json:"name"`
	Priority      int                      `json:"priority"`
	Enabled       bool                     `json:"enabled"`
	Conditions    TriggerConditionsRequest `json:"conditions"`
	SessionConfig *SessionConfigRequest    `json:"session_config,omitempty"`
	StopOnMatch   bool                     `json:"stop_on_match"`
}

TriggerRequest represents a trigger in requests

type TriggerResponse added in v1.155.0

type TriggerResponse struct {
	ID            string                    `json:"id"`
	Name          string                    `json:"name"`
	Priority      int                       `json:"priority"`
	Enabled       bool                      `json:"enabled"`
	Conditions    TriggerConditionsResponse `json:"conditions"`
	SessionConfig *SessionConfigResponse    `json:"session_config,omitempty"`
	StopOnMatch   bool                      `json:"stop_on_match"`
}

TriggerResponse represents a trigger in responses

type TriggerWebhookRequest added in v1.235.0

type TriggerWebhookRequest struct {
	Payload map[string]interface{} `json:"payload"`         // The test payload JSON
	Event   string                 `json:"event,omitempty"` // For GitHub webhooks: the event type (e.g., "push", "pull_request")
	DryRun  bool                   `json:"dry_run"`         // If true, only evaluate triggers without creating a session
}

TriggerWebhookRequest represents the request body for triggering a webhook with a test payload

type TriggerWebhookResponse added in v1.235.0

type TriggerWebhookResponse struct {
	Matched        bool                       `json:"matched"`                   // Whether any trigger matched
	MatchedTrigger *TriggerMatchedTriggerInfo `json:"matched_trigger,omitempty"` // Info about the matched trigger
	SessionID      string                     `json:"session_id,omitempty"`      // Set when dry_run=false and session was created
	SessionReused  bool                       `json:"session_reused,omitempty"`  // Whether an existing session was reused
	DryRun         bool                       `json:"dry_run"`                   // Echoes back the dry_run flag
	InitialMessage string                     `json:"initial_message,omitempty"` // The rendered initial message (in dry_run mode)
	Tags           map[string]string          `json:"tags,omitempty"`            // The computed tags (in dry_run mode)
	Environment    map[string]string          `json:"environment,omitempty"`     // The computed environment (in dry_run mode)
	Error          string                     `json:"error,omitempty"`           // Any error encountered during evaluation
}

TriggerWebhookResponse represents the response for a webhook trigger test

type UpdateMemoryRequest added in v1.242.0

type UpdateMemoryRequest struct {
	Title   *string `json:"title,omitempty"`
	Content *string `json:"content,omitempty"`
	// Tags, when present (even as {}), replaces ALL existing tags.
	// When the field is absent from the JSON body, existing tags are preserved.
	Tags *map[string]string `json:"tags,omitempty"`
}

UpdateMemoryRequest is the JSON body for PUT /memories/:memoryId. All fields are optional; omitted/null fields are not changed.

type UpdateSettingsRequest added in v1.148.0

type UpdateSettingsRequest struct {
	Bedrock                 *BedrockSettingsRequest          `json:"bedrock"`
	MCPServers              map[string]*MCPServerRequest     `json:"mcp_servers,omitempty"`
	Marketplaces            map[string]*MarketplaceRequest   `json:"marketplaces,omitempty"`
	ClaudeCodeOAuthToken    *string                          `json:"claude_code_oauth_token,omitempty"`
	AuthMode                *string                          `json:"auth_mode,omitempty"`                 // "oauth" or "bedrock"
	EnabledPlugins          []string                         `json:"enabled_plugins,omitempty"`           // plugin@marketplace format
	EnvVars                 map[string]string                `json:"env_vars,omitempty"`                  // Custom environment variables
	PreferredTeamID         *string                          `json:"preferred_team_id,omitempty"`         // "org/team-slug" format; "" to clear
	SlackUserID             *string                          `json:"slack_user_id,omitempty"`             // Slack DM notification user ID
	NotificationChannels    *[]string                        `json:"notification_channels,omitempty"`     // Active notification channels (e.g. ["web", "slack"])
	ExternalSessionManagers *[]ExternalSessionManagerRequest `json:"external_session_managers,omitempty"` // External session managers (Proxy B registrations)
}

UpdateSettingsRequest is the request body for updating settings

type UpdateSlackBotRequest added in v1.261.0

type UpdateSlackBotRequest struct {
	Name   string                  `json:"name,omitempty"`
	Status entities.SlackBotStatus `json:"status,omitempty"`
	// Teams is an explicit list of team IDs (e.g. ["org/team-slug"]) whose settings
	// will be merged into sessions created by this bot. When omitted, the server
	// refreshes from the authenticated user's current team memberships.
	Teams []string `json:"teams,omitempty"`
	// BotTokenSecretName is a pointer to allow clearing the value by passing an empty string "".
	// nil means "not provided / do not change"; "" means "clear (revert to global default)".
	BotTokenSecretName  *string                `json:"bot_token_secret_name"`
	BotTokenSecretKey   *string                `json:"bot_token_secret_key"`
	AllowedEventTypes   []string               `json:"allowed_event_types,omitempty"`
	AllowedChannelNames []string               `json:"allowed_channel_names,omitempty"`
	SessionConfig       *SlackBotSessionConfig `json:"session_config,omitempty"`
	MaxSessions         int                    `json:"max_sessions,omitempty"`
	// NotifyOnSessionCreated controls whether the bot posts a Slack message with
	// the session URL when a new session is created. Defaults to true.
	NotifyOnSessionCreated *bool `json:"notify_on_session_created,omitempty"`
	// AllowBotMessages controls whether the bot processes messages posted by other bots.
	// Defaults to false to prevent recursive session creation.
	AllowBotMessages *bool `json:"allow_bot_messages,omitempty"`
	// BotToken is the Slack bot token (xoxb-...). Write-only: stored in K8s Secret, never returned.
	BotToken string `json:"bot_token,omitempty"`
	// AppToken is the Slack app-level token (xapp-...). Write-only: stored in K8s Secret, never returned.
	AppToken string `json:"app_token,omitempty"`
}

UpdateSlackBotRequest is the request body for updating a SlackBot

type UpdateTaskGroupRequest added in v1.246.0

type UpdateTaskGroupRequest struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

UpdateTaskGroupRequest is the JSON body for PUT /task-groups/:groupId

type UpdateTaskRequest added in v1.246.0

type UpdateTaskRequest struct {
	Title       *string            `json:"title,omitempty"`
	Description *string            `json:"description,omitempty"`
	Status      *string            `json:"status,omitempty"`
	GroupID     *string            `json:"group_id,omitempty"`
	SessionID   *string            `json:"session_id,omitempty"`
	Links       *[]TaskLinkRequest `json:"links,omitempty"`
}

UpdateTaskRequest is the JSON body for PUT /tasks/:taskId. All fields are optional; omitted/null fields are not changed.

type UpdateWebhookRequest added in v1.155.0

type UpdateWebhookRequest struct {
	Name            *string                        `json:"name,omitempty"`
	Status          *entities.WebhookStatus        `json:"status,omitempty"`
	Secret          *string                        `json:"secret,omitempty"`
	SignatureHeader *string                        `json:"signature_header,omitempty"`
	SignatureType   *entities.WebhookSignatureType `json:"signature_type,omitempty"`
	SignaturePrefix *string                        `json:"signature_prefix,omitempty"`
	GitHub          *GitHubConfigRequest           `json:"github,omitempty"`
	Triggers        []TriggerRequest               `json:"triggers,omitempty"`
	SessionConfig   *SessionConfigRequest          `json:"session_config,omitempty"`
	MaxSessions     *int                           `json:"max_sessions,omitempty"`
}

UpdateWebhookRequest represents the request body for updating a webhook

type UserController added in v1.148.0

type UserController struct{}

UserController handles user-related endpoints

func NewUserController added in v1.148.0

func NewUserController() *UserController

NewUserController creates a new UserController instance

func (*UserController) GetName added in v1.148.0

func (c *UserController) GetName() string

GetName returns the name of this controller for logging

func (*UserController) GetUserInfo added in v1.148.0

func (c *UserController) GetUserInfo(ctx echo.Context) error

GetUserInfo handles GET /user/info requests

type UserInfoResponse added in v1.148.0

type UserInfoResponse struct {
	UserID      string   `json:"user_id"`
	Username    string   `json:"username"`
	UserType    string   `json:"user_type"`
	Teams       []string `json:"teams"`
	TeamID      string   `json:"team_id,omitempty"`
	IsAdmin     bool     `json:"is_admin"`
	Permissions []string `json:"permissions"`
}

UserInfoResponse represents the response for /user/info endpoint

type WebhookController added in v1.155.0

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

WebhookController handles webhook management HTTP requests

func NewWebhookController added in v1.155.0

func NewWebhookController(repo repositories.WebhookRepository) *WebhookController

NewWebhookController creates a new webhook controller

func (*WebhookController) CreateWebhook added in v1.155.0

func (c *WebhookController) CreateWebhook(ctx echo.Context) error

CreateWebhook handles POST /webhooks

func (*WebhookController) DeleteWebhook added in v1.155.0

func (c *WebhookController) DeleteWebhook(ctx echo.Context) error

DeleteWebhook handles DELETE /webhooks/:id

func (*WebhookController) GetName added in v1.155.0

func (c *WebhookController) GetName() string

GetName returns the name of this controller for logging

func (*WebhookController) GetWebhook added in v1.155.0

func (c *WebhookController) GetWebhook(ctx echo.Context) error

GetWebhook handles GET /webhooks/:id

func (*WebhookController) ListWebhooks added in v1.155.0

func (c *WebhookController) ListWebhooks(ctx echo.Context) error

ListWebhooks handles GET /webhooks

func (*WebhookController) RegenerateSecret added in v1.155.0

func (c *WebhookController) RegenerateSecret(ctx echo.Context) error

RegenerateSecret handles POST /webhooks/:id/regenerate-secret

func (*WebhookController) Repo added in v1.235.0

Repo returns the webhook repository for external access.

func (*WebhookController) SetBaseURL added in v1.155.0

func (c *WebhookController) SetBaseURL(baseURL string)

SetBaseURL sets the base URL for webhook URLs

func (*WebhookController) UpdateWebhook added in v1.155.0

func (c *WebhookController) UpdateWebhook(ctx echo.Context) error

UpdateWebhook handles PUT /webhooks/:id

func (*WebhookController) UserCanAccessWebhook added in v1.235.0

func (c *WebhookController) UserCanAccessWebhook(ctx echo.Context, webhook *entities.Webhook) bool

UserCanAccessWebhook checks if the current user can access the webhook.

type WebhookCustomController added in v1.162.0

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

WebhookCustomController handles custom webhook reception

func NewWebhookCustomController added in v1.162.0

func NewWebhookCustomController(
	repo repositories.WebhookRepository,
	sessionManager repositories.SessionManager,
	memoryRepo repositories.MemoryRepository,
) *WebhookCustomController

NewWebhookCustomController creates a new custom webhook controller

func (*WebhookCustomController) BuildCustomTagsForTest added in v1.235.0

func (c *WebhookCustomController) BuildCustomTagsForTest(
	webhook *entities.Webhook,
	trigger *entities.WebhookTrigger,
) map[string]string

BuildCustomTagsForTest builds custom webhook metadata tags for a test payload.

func (*WebhookCustomController) BuildDefaultMessageForTest added in v1.235.0

func (c *WebhookCustomController) BuildDefaultMessageForTest(payload map[string]interface{}) string

BuildDefaultMessageForTest builds a default message for a test payload.

func (*WebhookCustomController) GetName added in v1.162.0

func (c *WebhookCustomController) GetName() string

GetName returns the name of this controller for logging

func (*WebhookCustomController) HandleCustomWebhook added in v1.162.0

func (c *WebhookCustomController) HandleCustomWebhook(ctx echo.Context) error

HandleCustomWebhook handles POST /hooks/custom/:id

func (*WebhookCustomController) MatchTriggersForTest added in v1.235.0

func (c *WebhookCustomController) MatchTriggersForTest(
	triggers []entities.WebhookTrigger,
	payload map[string]interface{},
) *entities.WebhookTrigger

MatchTriggersForTest evaluates triggers against a test payload.

func (*WebhookCustomController) SessionService added in v1.235.0

func (c *WebhookCustomController) SessionService() *WebhookSessionService

SessionService returns the session service for external access.

type WebhookGitHubController added in v1.155.0

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

WebhookGitHubController handles GitHub webhook reception

func NewWebhookGitHubController added in v1.155.0

func NewWebhookGitHubController(repo repositories.WebhookRepository, sessionManager repositories.SessionManager, memoryRepo repositories.MemoryRepository) *WebhookGitHubController

NewWebhookGitHubController creates a new GitHub webhook controller

func (*WebhookGitHubController) BuildDefaultInitialMessageForTest added in v1.235.0

func (c *WebhookGitHubController) BuildDefaultInitialMessageForTest(event string, payload *GitHubPayload) string

BuildDefaultInitialMessageForTest builds a default initial message for a test payload.

func (*WebhookGitHubController) BuildGitHubTagsForTest added in v1.235.0

func (c *WebhookGitHubController) BuildGitHubTagsForTest(
	webhook *entities.Webhook,
	trigger *entities.WebhookTrigger,
	event string,
	payload *GitHubPayload,
) map[string]string

BuildGitHubTagsForTest builds GitHub-specific metadata tags for a test payload.

func (*WebhookGitHubController) GetName added in v1.155.0

func (c *WebhookGitHubController) GetName() string

GetName returns the name of this controller for logging

func (*WebhookGitHubController) HandleGitHubWebhook added in v1.155.0

func (c *WebhookGitHubController) HandleGitHubWebhook(ctx echo.Context) error

HandleGitHubWebhook handles POST /hooks/github/:id

func (*WebhookGitHubController) MatchTriggersForTest added in v1.235.0

func (c *WebhookGitHubController) MatchTriggersForTest(
	triggers []entities.WebhookTrigger,
	event string,
	payload *GitHubPayload,
) *entities.WebhookTrigger

MatchTriggersForTest evaluates triggers against a test payload. This reuses the same matching logic as HandleGitHubWebhook but without signature verification or HTTP context dependency.

func (*WebhookGitHubController) SessionService added in v1.235.0

func (c *WebhookGitHubController) SessionService() *WebhookSessionService

SessionService returns the session service for external access.

type WebhookResponse added in v1.155.0

type WebhookResponse struct {
	ID              string                        `json:"id"`
	Name            string                        `json:"name"`
	UserID          string                        `json:"user_id"`
	Scope           entities.ResourceScope        `json:"scope,omitempty"`
	TeamID          string                        `json:"team_id,omitempty"`
	Status          entities.WebhookStatus        `json:"status"`
	Type            entities.WebhookType          `json:"type"`
	Secret          string                        `json:"secret"`
	SignatureHeader string                        `json:"signature_header,omitempty"`
	SignatureType   entities.WebhookSignatureType `json:"signature_type,omitempty"`
	SignaturePrefix string                        `json:"signature_prefix,omitempty"`
	WebhookURL      string                        `json:"webhook_url"`
	GitHub          *GitHubConfigResponse         `json:"github,omitempty"`
	Triggers        []TriggerResponse             `json:"triggers"`
	SessionConfig   *SessionConfigResponse        `json:"session_config,omitempty"`
	MaxSessions     int                           `json:"max_sessions"`
	CreatedAt       string                        `json:"created_at"`
	UpdatedAt       string                        `json:"updated_at"`
	LastDelivery    *DeliveryRecordResponse       `json:"last_delivery,omitempty"`
	DeliveryCount   int64                         `json:"delivery_count"`
}

WebhookResponse represents the response for a webhook

type WebhookSessionService added in v1.234.0

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

WebhookSessionService encapsulates common logic shared between GitHub and Custom webhook controllers: session creation, session reuse, template rendering, trigger sorting, session limits, and delivery recording.

func NewWebhookSessionService added in v1.234.0

func NewWebhookSessionService(repo repositories.WebhookRepository, sessionManager repositories.SessionManager, memoryRepo repositories.MemoryRepository) *WebhookSessionService

NewWebhookSessionService creates a new WebhookSessionService.

func (*WebhookSessionService) CreateSessionFromWebhook added in v1.234.0

func (s *WebhookSessionService) CreateSessionFromWebhook(ctx context.Context, params SessionCreationParams) (string, bool, error)

CreateSessionFromWebhook creates or reuses a session based on webhook and trigger configuration. Returns sessionID, sessionReused flag, and error.

The ctx parameter is a plain context.Context (not echo.Context) so that this method can be called from background goroutines or unit tests without an HTTP request.

func (*WebhookSessionService) DryRunSessionConfig added in v1.235.0

func (s *WebhookSessionService) DryRunSessionConfig(params SessionCreationParams) (*DryRunResult, error)

DryRunSessionConfig evaluates all template rendering and config merging without creating a session. Returns the computed configuration.

func (*WebhookSessionService) RecordDelivery added in v1.234.0

func (s *WebhookSessionService) RecordDelivery(ctx context.Context, webhookID, deliveryID string, status entities.DeliveryStatus, trigger *entities.WebhookTrigger, sessionID string, sessionReused bool, deliveryErr error)

RecordDelivery records a webhook delivery event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL