controllers

package
v1.238.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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 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"`
	SignatureHeader string                        `json:"signature_header,omitempty"`
	SignatureType   entities.WebhookSignatureType `json:"signature_type,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 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 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) *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) 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,
) *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 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) *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) SetCredentialsSecretSyncer added in v1.148.0

func (c *SettingsController) SetCredentialsSecretSyncer(syncer services.CredentialsSecretSyncer)

SetCredentialsSecretSyncer sets the credentials secret syncer

func (*SettingsController) SetMCPSecretSyncer added in v1.148.0

func (c *SettingsController) SetMCPSecretSyncer(syncer services.MCPSecretSyncer)

SetMCPSecretSyncer sets the MCP secret syncer

func (*SettingsController) SetMarketplaceSecretSyncer added in v1.148.0

func (c *SettingsController) SetMarketplaceSecretSyncer(syncer services.MarketplaceSecretSyncer)

SetMarketplaceSecretSyncer sets the marketplace secret syncer

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
	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 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 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
}

UpdateSettingsRequest is the request body for updating settings

type UpdateWebhookRequest added in v1.155.0

type UpdateWebhookRequest struct {
	Name            *string                        `json:"name,omitempty"`
	Status          *entities.WebhookStatus        `json:"status,omitempty"`
	SignatureHeader *string                        `json:"signature_header,omitempty"`
	SignatureType   *entities.WebhookSignatureType `json:"signature_type,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 {
	Username string   `json:"username"`
	Teams    []string `json:"teams"`
}

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,
) *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) *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"`
	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) *WebhookSessionService

NewWebhookSessionService creates a new WebhookSessionService.

func (*WebhookSessionService) CreateSessionFromWebhook added in v1.234.0

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

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

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