handlers

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: AGPL-3.0 Imports: 139 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeBotAccess

func AuthorizeBotAccess(ctx context.Context, botService *bots.Service, accountService *accounts.Service, channelIdentityID, botID string) (bots.Bot, error)

AuthorizeBotAccess validates that the given identity has manage-level access to the specified bot (owner, workspace admin, or a user grant carrying manage).

func AuthorizeBotAccessWithPermission

func AuthorizeBotAccessWithPermission(ctx context.Context, botService *bots.Service, accountService *accounts.Service, channelIdentityID, botID, requiredPermission string) (bots.Bot, error)

AuthorizeBotAccessWithPermission validates that the given identity holds the required permission scope on the specified bot.

func RequireChannelIdentityID

func RequireChannelIdentityID(c echo.Context) (string, error)

RequireChannelIdentityID extracts and validates the channel identity ID from the request context.

Types

type ACLHandler

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

func NewACLHandler

func NewACLHandler(service *acl.Service, botService *bots.Service, accountService *accounts.Service, identityService *identities.Service) *ACLHandler

func (*ACLHandler) CreateRule

func (h *ACLHandler) CreateRule(c echo.Context) error

CreateRule godoc @Summary Create ACL rule @Description Create a new ACL rule for chat.trigger @Tags bots @Param bot_id path string true "Bot ID" @Param payload body acl.CreateRuleRequest true "Rule payload" @Success 201 {object} acl.Rule @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/rules [post].

func (*ACLHandler) DeleteRule

func (h *ACLHandler) DeleteRule(c echo.Context) error

DeleteRule godoc @Summary Delete ACL rule @Description Delete an ACL rule by ID @Tags bots @Param bot_id path string true "Bot ID" @Param rule_id path string true "Rule ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/rules/{rule_id} [delete].

func (*ACLHandler) GetDefaultEffect

func (h *ACLHandler) GetDefaultEffect(c echo.Context) error

GetDefaultEffect godoc @Summary Get bot ACL default effect @Description Get the fallback effect when no rule matches @Tags bots @Param bot_id path string true "Bot ID" @Success 200 {object} acl.DefaultEffectResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/default-effect [get].

func (*ACLHandler) ListObservedConversations

func (h *ACLHandler) ListObservedConversations(c echo.Context) error

ListObservedConversations godoc @Summary List observed conversations for a channel identity @Description List previously observed conversation candidates for a channel identity, for scoped rule building @Tags bots @Param bot_id path string true "Bot ID" @Param channel_identity_id path string true "Channel Identity ID" @Success 200 {object} acl.ObservedConversationCandidateListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/channel-identities/{channel_identity_id}/conversations [get].

func (*ACLHandler) ListObservedConversationsByChannelType

func (h *ACLHandler) ListObservedConversationsByChannelType(c echo.Context) error

ListObservedConversationsByChannelType godoc @Summary List observed conversations for a platform type @Description List previously observed group/thread conversation candidates for a channel type under this bot @Tags bots @Param bot_id path string true "Bot ID" @Param channel_type path string true "Channel type (e.g. telegram, discord)" @Success 200 {object} acl.ObservedConversationCandidateListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/channel-types/{channel_type}/conversations [get].

func (*ACLHandler) ListRules

func (h *ACLHandler) ListRules(c echo.Context) error

ListRules godoc @Summary List bot ACL rules @Description List all ACL rules for a bot @Tags bots @Param bot_id path string true "Bot ID" @Success 200 {object} acl.ListRulesResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/rules [get].

func (*ACLHandler) Register

func (h *ACLHandler) Register(e *echo.Echo)

func (*ACLHandler) SearchChannelIdentities

func (h *ACLHandler) SearchChannelIdentities(c echo.Context) error

SearchChannelIdentities godoc @Summary Search ACL channel identity candidates @Description Search locally observed channel identities for building ACL rules @Tags bots @Param bot_id path string true "Bot ID" @Param q query string false "Search query" @Param limit query int false "Max results" @Success 200 {object} acl.ChannelIdentityCandidateListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/channel-identities [get].

func (*ACLHandler) SetDefaultEffect

func (h *ACLHandler) SetDefaultEffect(c echo.Context) error

SetDefaultEffect godoc @Summary Set bot ACL default effect @Description Set the fallback effect when no rule matches (allow or deny) @Tags bots @Param bot_id path string true "Bot ID" @Param payload body acl.DefaultEffectResponse true "Default effect payload" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/default-effect [put].

func (*ACLHandler) UpdateRule

func (h *ACLHandler) UpdateRule(c echo.Context) error

UpdateRule godoc @Summary Update ACL rule @Description Update an existing ACL rule @Tags bots @Param bot_id path string true "Bot ID" @Param rule_id path string true "Rule ID" @Param payload body acl.UpdateRuleRequest true "Rule payload" @Success 200 {object} acl.Rule @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/acl/rules/{rule_id} [put].

type ACPHandler

type ACPHandler struct{}

func NewACPHandler

func NewACPHandler() *ACPHandler

func (*ACPHandler) ListProfiles

func (*ACPHandler) ListProfiles(c echo.Context) error

ListProfiles godoc @Summary List ACP profiles @Description List safe ACP profile metadata used by the frontend to render agent configuration UI @Tags acp @Success 200 {object} acpprofile.ProfilesResponse @Router /acp/profiles [get].

func (*ACPHandler) Register

func (h *ACPHandler) Register(e *echo.Echo)

type ACPRuntimeHandler

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

func NewACPRuntimeHandler

func NewACPRuntimeHandler(pool *acpagent.SessionPool, sessionService *session.Service, botService *bots.Service, accountService *accounts.Service) *ACPRuntimeHandler

func (*ACPRuntimeHandler) CloseRuntime

func (h *ACPRuntimeHandler) CloseRuntime(c echo.Context) error

CloseRuntime godoc @Summary Close an ACP runtime @Tags acp @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes/{runtime_id} [delete].

func (*ACPRuntimeHandler) CreateRuntime

func (h *ACPRuntimeHandler) CreateRuntime(c echo.Context) error

CreateRuntime godoc @Summary Create an unbound ACP runtime (pre-session model picker) @Description Starts an agent runtime before any session exists. The runtime ID is server generated; bind it to a session at creation time via acp_runtime_id. @Tags acp @Param bot_id path string true "Bot ID" @Param body body acpRuntimeCreateRequest true "Runtime spec" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 429 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes [post].

func (*ACPRuntimeHandler) EnsureRuntime

func (h *ACPRuntimeHandler) EnsureRuntime(c echo.Context) error

EnsureRuntime godoc @Summary Ensure ACP session runtime is started @Tags acp @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/acp-runtime [post].

func (*ACPRuntimeHandler) GetRuntime

func (h *ACPRuntimeHandler) GetRuntime(c echo.Context) error

GetRuntime godoc @Summary Get ACP session runtime state @Tags acp @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/acp-runtime [get].

func (*ACPRuntimeHandler) GetRuntimeByID

func (h *ACPRuntimeHandler) GetRuntimeByID(c echo.Context) error

GetRuntimeByID godoc @Summary Get ACP runtime state by runtime ID @Tags acp @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes/{runtime_id} [get].

func (*ACPRuntimeHandler) Register

func (h *ACPRuntimeHandler) Register(e *echo.Echo)

func (*ACPRuntimeHandler) SetMode

func (h *ACPRuntimeHandler) SetMode(c echo.Context) error

SetMode godoc @Summary Set ACP session runtime mode @Description Sends the selected agent-declared mode ID unchanged to session/set_mode. The selection applies only to this live session. @Tags acp @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body acpRuntimeModeRequest true "ACP session mode selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/acp-runtime/mode [patch].

func (*ACPRuntimeHandler) SetModel

func (h *ACPRuntimeHandler) SetModel(c echo.Context) error

SetModel godoc @Summary Set ACP session runtime model @Tags acp @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body acpRuntimeModelRequest true "ACP model selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/acp-runtime/model [patch].

func (*ACPRuntimeHandler) SetReasoning

func (h *ACPRuntimeHandler) SetReasoning(c echo.Context) error

SetReasoning godoc @Summary Set ACP session runtime reasoning effort @Tags acp @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body acpRuntimeReasoningRequest true "Reasoning effort selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/acp-runtime/reasoning [patch].

func (*ACPRuntimeHandler) SetRuntimeMode

func (h *ACPRuntimeHandler) SetRuntimeMode(c echo.Context) error

SetRuntimeMode godoc @Summary Set an unbound ACP runtime's mode @Description Sends the selected agent-declared mode ID unchanged to session/set_mode before the first chat message binds this runtime to a Session. @Tags acp @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Param body body acpRuntimeModeRequest true "Mode selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes/{runtime_id}/mode [patch].

func (*ACPRuntimeHandler) SetRuntimeModel

func (h *ACPRuntimeHandler) SetRuntimeModel(c echo.Context) error

SetRuntimeModel godoc @Summary Set (or reset) an ACP runtime's model @Description An empty model_id resets the runtime to the agent default model. @Tags acp @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Param body body acpRuntimeModelRequest true "Model selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes/{runtime_id}/model [patch].

func (*ACPRuntimeHandler) SetRuntimeReasoning

func (h *ACPRuntimeHandler) SetRuntimeReasoning(c echo.Context) error

SetRuntimeReasoning godoc @Summary Set an ACP runtime's reasoning effort @Tags acp @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Param body body acpRuntimeReasoningRequest true "Reasoning effort selection" @Success 200 {object} acpagent.RuntimeStatus @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/acp-runtimes/{runtime_id}/reasoning [patch].

type AgentAuthorizationClaimRequest added in v0.20.0

type AgentAuthorizationClaimRequest struct {
	AuthorizationID string `json:"authorization_id" validate:"required"`
}

type AgentAuthorizationExchangeRequest added in v0.20.0

type AgentAuthorizationExchangeRequest struct {
	Code string `json:"code" validate:"required"`
}

type AgentAuthorizationHandler added in v0.20.0

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

func NewAgentAuthorizationHandler added in v0.20.0

func NewAgentAuthorizationHandler(service *agentcredential.AuthorizationService, agents *botagents.Service, bots *bots.Service, accounts *accounts.Service) *AgentAuthorizationHandler

func (*AgentAuthorizationHandler) Cancel added in v0.20.0

Cancel godoc @Summary Discard a temporary authorization without disconnecting an already-created Agent @Tags agent-authorizations @Param id path string true "Authorization ID" @Success 204 @Failure 400,403,503 {object} apperror.Problem @Router /agent-authorizations/{id} [delete].

func (*AgentAuthorizationHandler) Claim added in v0.20.0

Claim godoc @Summary Bind a completed temporary authorization to a Bot Agent @Description Requires Bot management access and ownership of the authorization. Retrying for the same Agent is safe; an authorization cannot be bound to another Agent. Credentials are attached atomically and removed from the temporary session. @Tags agent-authorizations @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Param payload body AgentAuthorizationClaimRequest true "Authorization reference" @Success 200 {object} agentcredential.PublicCredential @Failure 400,403,404,409,410,503 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/credential/claim [post].

func (*AgentAuthorizationHandler) Create added in v0.20.0

Create godoc @Summary Authorize an Agent account before creating a Bot @Description Starts Codex device authorization or Claude browser authorization, or encrypts a supplied API key or Claude OAuth token. No Bot or workspace is created. Ready means the credential has been staged; API keys and manually supplied tokens are not probed against the provider. @Tags agent-authorizations @Accept json @Produce json @Param payload body agentcredential.AuthorizationRequest true "Authorization request" @Success 201 {object} agentcredential.Authorization @Failure 400,403,409,429,503 {object} apperror.Problem @Router /agent-authorizations [post].

func (*AgentAuthorizationHandler) Exchange added in v0.20.0

Exchange godoc @Summary Complete Claude browser authorization with the returned authorization code @Tags agent-authorizations @Accept json @Produce json @Param id path string true "Authorization ID" @Param payload body AgentAuthorizationExchangeRequest true "Authorization code" @Success 200 {object} agentcredential.Authorization @Failure 400,403,410,503 {object} apperror.Problem @Router /agent-authorizations/{id}/exchange [post].

func (*AgentAuthorizationHandler) Get added in v0.20.0

Get godoc @Summary Read an authorization session owned by the current user @Tags agent-authorizations @Param id path string true "Authorization ID" @Success 200 {object} agentcredential.Authorization @Failure 403,410,503 {object} apperror.Problem @Router /agent-authorizations/{id} [get].

func (*AgentAuthorizationHandler) Poll added in v0.20.0

Poll godoc @Summary Poll a pending Agent device authorization @Tags agent-authorizations @Param id path string true "Authorization ID" @Success 200 {object} agentcredential.Authorization @Failure 403,410,503 {object} apperror.Problem @Router /agent-authorizations/{id}/poll [post].

func (*AgentAuthorizationHandler) Register added in v0.20.0

func (h *AgentAuthorizationHandler) Register(e *echo.Echo)

type AgentCredentialHandler added in v0.20.0

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

AgentCredentialHandler manages the single credential attached to a Bot Agent instance. There is no credential picking: PUT replaces, DELETE disconnects, GET reports the redacted state.

func NewAgentCredentialHandler added in v0.20.0

func NewAgentCredentialHandler(service *agentcredential.Service, agents *botagents.Service, botService *bots.Service, accountService *accounts.Service, runtimes external.Drivers) *AgentCredentialHandler

func (*AgentCredentialHandler) Delete added in v0.20.0

Delete godoc @Summary Disconnect a Bot Agent's credential @Tags agent-credentials @Param bot_id path string true "Bot ID" @Param id path string true "Bot Agent ID" @Success 204 @Failure 404 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/credential [delete].

func (*AgentCredentialHandler) Get added in v0.20.0

Get godoc @Summary Get the credential attached to a Bot Agent @Tags agent-credentials @Param bot_id path string true "Bot ID" @Param id path string true "Bot Agent ID" @Success 200 {object} agentcredential.PublicCredential @Failure 404 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/credential [get].

func (*AgentCredentialHandler) Put added in v0.20.0

Put godoc @Summary Attach a credential to a Bot Agent, replacing any previous one @Description Creates an encrypted credential from the submitted secret and points the Agent instance at it. The replaced credential is revoked once no other instance references it. The Agent's warm runtimes are shut down so the next session starts with the new credential. @Tags agent-credentials @Param bot_id path string true "Bot ID" @Param id path string true "Bot Agent ID" @Param payload body agentCredentialPutRequest true "Secret" @Success 200 {object} agentcredential.PublicCredential @Failure 400 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/credential [put].

func (*AgentCredentialHandler) Register added in v0.20.0

func (h *AgentCredentialHandler) Register(e *echo.Echo)

type AppConnectorCredentialRequest added in v0.20.0

type AppConnectorCredentialRequest struct {
	AuthMethod string            `json:"auth_method" validate:"required"`
	Fields     map[string]string `json:"fields"`
}

AppConnectorCredentialRequest connects a referenced API-key connector.

type AppConnectorItem added in v0.20.0

type AppConnectorItem struct {
	Type         string `json:"type"`
	Required     bool   `json:"required"`
	ConnectionID string `json:"connection_id,omitempty"`
	// Status is linked once a connection is bound, otherwise needs_auth.
	Status    string                `json:"status" enums:"linked,needs_auth"`
	Connector *connectors.Connector `json:"connector,omitempty"`
}

AppConnectorItem is one Connect-It connector an App references.

type AppConnectorOAuthRequest added in v0.20.0

type AppConnectorOAuthRequest struct {
	AuthMethod string `json:"auth_method" validate:"required"`
}

AppConnectorOAuthRequest starts OAuth for a referenced connector.

type AppDependencyItem added in v0.20.0

type AppDependencyItem struct {
	ID string `json:"id"`
	// Shared is set when another installed App references the same
	// dependency on this bot workspace.
	Shared     bool                     `json:"shared"`
	Dependency *WorkspaceDependencyItem `json:"dependency,omitempty"`
}

AppDependencyItem is one workspace dependency an App references, with the reconciled dependency state when the catalog knows it.

type AppInstallRequest added in v0.20.0

type AppInstallRequest struct {
	RegistryID string `json:"registry_id" validate:"required"`
	AppID      string `json:"app_id" validate:"required"`
	Revision   string `json:"revision" validate:"required"`
}

AppInstallRequest names one immutable App release to install.

type AppItem added in v0.20.0

type AppItem struct {
	// InstallationID is empty for a discovered App: a dependency the
	// workspace carries that no installed App references, shown through
	// its canonical App.
	InstallationID string `json:"installation_id,omitempty"`
	RegistryID     string `json:"registry_id"`
	AppID          string `json:"app_id"`
	Revision       string `json:"revision,omitempty"`
	Version        string `json:"version,omitempty"`
	Name           string `json:"name"`
	Description    string `json:"description,omitempty"`
	// Status is discovered for Apps without an installation record.
	Status string `json:"status" enums:"installed,partial,installing,updating,removing,failed,discovered"`
	Reason string `json:"reason,omitempty" enums:"user,required"`
	// AvailableRevision and AvailableVersion name the registry's newer
	// release after a check found one.
	AvailableRevision string                                      `json:"available_revision,omitempty"`
	AvailableVersion  string                                      `json:"available_version,omitempty"`
	LastCheckedAt     *time.Time                                  `json:"last_checked_at,omitempty"`
	LastError         string                                      `json:"last_error,omitempty"`
	Icon              *supermarketclient.SkillIcon                `json:"icon,omitempty"`
	Category          string                                      `json:"category,omitempty"`
	CategoryName      string                                      `json:"category_name,omitempty"`
	Author            *supermarketclient.Author                   `json:"author,omitempty"`
	Homepage          string                                      `json:"homepage,omitempty"`
	Repository        string                                      `json:"repository,omitempty"`
	License           string                                      `json:"license,omitempty"`
	Tags              []string                                    `json:"tags"`
	Translations      map[string]supermarketclient.AppTranslation `json:"translations,omitempty"`
	Skills            []AppSkillItem                              `json:"skills"`
	Dependencies      []AppDependencyItem                         `json:"dependencies"`
	Connectors        []AppConnectorItem                          `json:"connectors"`
	InstalledAt       *time.Time                                  `json:"installed_at,omitempty"`
	UpdatedAt         *time.Time                                  `json:"updated_at,omitempty"`
}

AppItem is one App on a bot workspace.

type AppListResponse added in v0.20.0

type AppListResponse struct {
	WorkspaceState         string    `json:"workspace_state,omitempty" enums:"running,not_running,missing"`
	DependencyCatalogStale bool      `json:"dependency_catalog_stale"`
	Items                  []AppItem `json:"items"`
}

AppListResponse is the App view of one bot workspace.

type AppRemovalPreviewApp added in v0.20.0

type AppRemovalPreviewApp struct {
	InstallationID string `json:"installation_id"`
	RegistryID     string `json:"registry_id"`
	AppID          string `json:"app_id"`
	Version        string `json:"version,omitempty"`
}

AppRemovalPreviewApp is an auto-installed App that would lose its last reference.

type AppRemovalPreviewConnector added in v0.20.0

type AppRemovalPreviewConnector struct {
	Type         string `json:"type"`
	ConnectionID string `json:"connection_id,omitempty"`
	Action       string `json:"action" enums:"disconnect,keep,none"`
	Reason       string `json:"reason,omitempty" enums:"shared"`
}

AppRemovalPreviewConnector says what removing an App does to one connector reference.

type AppRemovalPreviewDependency added in v0.20.0

type AppRemovalPreviewDependency struct {
	ID     string `json:"id"`
	Action string `json:"action" enums:"remove,keep"`
	Reason string `json:"reason,omitempty" enums:"shared,image,absent"`
}

AppRemovalPreviewDependency says what removing an App does to one dependency reference.

type AppRemovalPreviewResponse added in v0.20.0

type AppRemovalPreviewResponse struct {
	InstallationID string                        `json:"installation_id"`
	Dependencies   []AppRemovalPreviewDependency `json:"dependencies"`
	Connectors     []AppRemovalPreviewConnector  `json:"connectors"`
	RequiredApps   []AppRemovalPreviewApp        `json:"required_apps"`
}

AppRemovalPreviewResponse is the plan of an App removal.

type AppSkillItem added in v0.20.0

type AppSkillItem struct {
	SkillID     string                       `json:"skill_id"`
	InstallID   string                       `json:"install_id"`
	Name        string                       `json:"name"`
	Description string                       `json:"description,omitempty"`
	Icon        *supermarketclient.SkillIcon `json:"icon,omitempty"`
}

AppSkillItem is one Skill an App materializes.

type AppStreamEvent added in v0.20.0

type AppStreamEvent struct {
	Type      string            `json:"type" enums:"started,step,log,step_done,done,error"`
	Kind      string            `json:"kind,omitempty" enums:"app,dependency,skills,connector"`
	ID        string            `json:"id,omitempty"`
	Stream    string            `json:"stream,omitempty" enums:"stdout,stderr"`
	Data      string            `json:"data,omitempty"`
	Status    string            `json:"status,omitempty"`
	Version   string            `json:"version,omitempty"`
	Message   string            `json:"message,omitempty"`
	Code      string            `json:"code,omitempty"`
	Args      map[string]string `json:"args,omitempty"`
	Detail    string            `json:"detail,omitempty"`
	RequestID string            `json:"request_id,omitempty"`
}

AppStreamEvent documents the SSE frames of install, resume, update and remove. Type selects which fields are present: started and done carry the app id and status; step and step_done carry kind and id; log carries stream and data; error carries the Problem fields.

codesync(app-stream): keep in sync with apps/web/src/composables/api/useAppStream.ts.

type AppUpdateRequest added in v0.20.0

type AppUpdateRequest struct {
	RegistryID string `json:"registry_id" validate:"required"`
	AppID      string `json:"app_id" validate:"required"`

	// Release moves the installation to the registry's current release.
	Release bool `json:"release"`
	// Dependencies are updated to their latest version.
	Dependencies []string `json:"dependencies,omitempty"`
}

AppUpdateRequest selects what to update for one App on a workspace target: its dependencies, its release, or both.

type AppsHandler added in v0.20.0

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

AppsHandler serves the Apps a bot has installed from the Supermarket and runs their lifecycle operations.

func NewAppsHandler added in v0.20.0

func NewAppsHandler(log *slog.Logger, service *apps.Service, botService *bots.Service, accountService *accounts.Service) *AppsHandler

func (*AppsHandler) BeginConnectorOAuth added in v0.20.0

func (h *AppsHandler) BeginConnectorOAuth(c echo.Context) error

BeginConnectorOAuth godoc @Summary Authorize a connector an App references @Description Starts OAuth for the connector type and links the resulting Connect-It connection to the App installation. @Tags apps @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Param connector_type path string true "Connector type" @Param payload body AppConnectorOAuthRequest true "OAuth request" @Success 201 {object} connectsdk.OAuthAuthorization @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id}/connectors/{connector_type}/oauth [post].

func (*AppsHandler) CheckUpdates added in v0.20.0

func (h *AppsHandler) CheckUpdates(c echo.Context) error

CheckUpdates godoc @Summary Check installed Apps for newer releases @Description Compares every installed App with the registry's current release, runs the dependency update checks, and returns the refreshed list. @Tags apps @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} AppListResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/apps/check-updates [post].

func (*AppsHandler) CreateConnectorCredential added in v0.20.0

func (h *AppsHandler) CreateConnectorCredential(c echo.Context) error

CreateConnectorCredential godoc @Summary Connect an API-key connector an App references @Description Sends the credential fields to Connect-It and links the resulting connection to the App installation. @Tags apps @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Param connector_type path string true "Connector type" @Param payload body AppConnectorCredentialRequest true "Credential request" @Success 201 {object} connectors.Connector @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id}/connectors/{connector_type}/api-key [post].

func (*AppsHandler) Get added in v0.20.0

func (h *AppsHandler) Get(c echo.Context) error

Get godoc @Summary Get one installed App @Tags apps @Produce json @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Success 200 {object} AppItem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id} [get].

func (*AppsHandler) Install added in v0.20.0

func (h *AppsHandler) Install(c echo.Context) error

Install godoc @Summary Install an App release into a bot workspace @Description Installs missing dependencies, publishes the Skills and links connectors, streaming progress. A dependency failure or an unauthorized required connector leaves the installation partial. Events: started, step, log, step_done, done, error. @Tags apps @Accept json @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param payload body AppInstallRequest true "App release to install" @Success 200 {object} AppStreamEvent "SSE stream of operation events" @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/apps [post].

func (*AppsHandler) List added in v0.20.0

func (h *AppsHandler) List(c echo.Context) error

List godoc @Summary List the Apps installed for a bot @Description Every App installed on the bot workspace with its Skills, dependency references and connector references, plus the canonical Apps of dependencies the workspace carries that no App references. @Tags apps @Produce json @Param bot_id path string true "Bot ID" @Param refresh query bool false "Refresh workspace discovery" @Success 200 {object} AppListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/apps [get].

func (*AppsHandler) Register added in v0.20.0

func (h *AppsHandler) Register(e *echo.Echo)

func (*AppsHandler) RemovalPreview added in v0.20.0

func (h *AppsHandler) RemovalPreview(c echo.Context) error

RemovalPreview godoc @Summary Preview what removing an App would do @Tags apps @Produce json @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Success 200 {object} AppRemovalPreviewResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id}/removal-preview [get].

func (*AppsHandler) Remove added in v0.20.0

func (h *AppsHandler) Remove(c echo.Context) error

Remove godoc @Summary Remove an App from a bot workspace @Description Removes the Skills, the dependencies no other App references and the connections no other App references, streaming progress. Events: started, step, log, step_done, done, error. @Tags apps @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Param remove_unreferenced_required query bool false "Also remove auto-installed Apps that lose their last reference" @Success 200 {object} AppStreamEvent "SSE stream of operation events" @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id} [delete].

func (*AppsHandler) Resume added in v0.20.0

func (h *AppsHandler) Resume(c echo.Context) error

Resume godoc @Summary Continue a partial App installation @Description Installs dependencies that are still missing, reconciles the Skills and links connectors that were authorized since. Events: started, step, log, step_done, done, error. @Tags apps @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param installation_id path string true "App installation ID" @Success 200 {object} AppStreamEvent "SSE stream of operation events" @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Router /bots/{bot_id}/apps/{installation_id}/resume [post].

func (*AppsHandler) UpdateSelection added in v0.20.0

func (h *AppsHandler) UpdateSelection(c echo.Context) error

UpdateSelection godoc @Summary Update parts of an App on a bot workspace @Description Updates the selected dependencies to their latest version and, when release is set, moves the installation to the registry's current release, streaming progress. A discovered App may update its own dependency. Events: started, step, log, step_done, done, error. @Tags apps @Accept json @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param payload body AppUpdateRequest true "What to update" @Success 200 {object} AppStreamEvent "SSE stream of operation events" @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Router /bots/{bot_id}/apps/update [post].

type AudioHandler

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

func NewAudioHandler

func NewAudioHandler(log *slog.Logger, service *audiopkg.Service, modelsService *models.Service) *AudioHandler

func (*AudioHandler) GetModel

func (h *AudioHandler) GetModel(c echo.Context) error

GetModel godoc @Summary Get a speech model @Tags speech-models @Produce json @Param id path string true "Model ID" @Success 200 {object} audiopkg.SpeechModelResponse @Failure 404 {object} ErrorResponse @Router /speech-models/{id} [get].

func (*AudioHandler) GetModelCapabilities

func (h *AudioHandler) GetModelCapabilities(c echo.Context) error

GetModelCapabilities godoc @Summary Get speech model capabilities @Tags speech-models @Produce json @Param id path string true "Model ID" @Success 200 {object} audiopkg.ModelCapabilities @Failure 404 {object} ErrorResponse @Router /speech-models/{id}/capabilities [get].

func (*AudioHandler) GetProvider

func (h *AudioHandler) GetProvider(c echo.Context) error

GetProvider godoc @Summary Get speech provider @Description Get a speech provider with masked config values @Tags speech-providers @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} audiopkg.SpeechProviderResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /speech-providers/{id} [get]. @Router /transcription-providers/{id} [get].

func (*AudioHandler) GetTranscriptionModel

func (h *AudioHandler) GetTranscriptionModel(c echo.Context) error

GetTranscriptionModel godoc @Summary Get a transcription model @Tags transcription-models @Produce json @Param id path string true "Model ID" @Success 200 {object} audiopkg.TranscriptionModelResponse @Failure 404 {object} ErrorResponse @Router /transcription-models/{id} [get].

func (*AudioHandler) GetTranscriptionModelCapabilities

func (h *AudioHandler) GetTranscriptionModelCapabilities(c echo.Context) error

GetTranscriptionModelCapabilities godoc @Summary Get transcription model capabilities @Tags transcription-models @Produce json @Param id path string true "Model ID" @Success 200 {object} audiopkg.ModelCapabilities @Failure 404 {object} ErrorResponse @Router /transcription-models/{id}/capabilities [get].

func (*AudioHandler) ImportModels

func (h *AudioHandler) ImportModels(c echo.Context) error

ImportModels godoc @Summary Import speech models from provider @Description Fetch models using the configured speech provider and import them into the unified models table @Tags speech-providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} audiopkg.ImportModelsResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /speech-providers/{id}/import-models [post].

func (*AudioHandler) ImportTranscriptionModels

func (h *AudioHandler) ImportTranscriptionModels(c echo.Context) error

ImportTranscriptionModels godoc @Summary Import transcription models from provider @Description Fetch models using the configured transcription provider and import them into the unified models table @Tags transcription-providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} audiopkg.ImportModelsResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /transcription-providers/{id}/import-models [post].

func (*AudioHandler) ListModels

func (h *AudioHandler) ListModels(c echo.Context) error

ListModels godoc @Summary List all speech models @Description List all models of type 'speech' (filtered view of unified models table) @Tags speech-models @Produce json @Success 200 {array} audiopkg.SpeechModelResponse @Failure 500 {object} ErrorResponse @Router /speech-models [get].

func (*AudioHandler) ListModelsByProvider

func (h *AudioHandler) ListModelsByProvider(c echo.Context) error

ListModelsByProvider godoc @Summary List speech models by provider @Description List models of type 'speech' for a specific speech provider @Tags speech-providers @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {array} audiopkg.SpeechModelResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /speech-providers/{id}/models [get].

func (*AudioHandler) ListProviders

func (h *AudioHandler) ListProviders(c echo.Context) error

ListProviders godoc @Summary List speech providers @Description List providers that support speech (filtered view of unified providers table) @Tags speech-providers @Produce json @Success 200 {array} audiopkg.SpeechProviderResponse @Failure 500 {object} ErrorResponse @Router /speech-providers [get].

func (*AudioHandler) ListSpeechMeta

func (h *AudioHandler) ListSpeechMeta(c echo.Context) error

ListMeta godoc @Summary List speech provider metadata @Description List available speech provider types with their models and capabilities @Tags speech-providers @Success 200 {array} audiopkg.ProviderMetaResponse @Router /speech-providers/meta [get].

func (*AudioHandler) ListTranscriptionMeta

func (h *AudioHandler) ListTranscriptionMeta(c echo.Context) error

ListTranscriptionMeta godoc @Summary List transcription provider metadata @Description List available transcription provider types with their models and capabilities @Tags transcription-providers @Success 200 {array} audiopkg.ProviderMetaResponse @Router /transcription-providers/meta [get].

func (*AudioHandler) ListTranscriptionModels

func (h *AudioHandler) ListTranscriptionModels(c echo.Context) error

ListTranscriptionModels godoc @Summary List all transcription models @Description List all models of type 'transcription' (filtered view of unified models table) @Tags transcription-models @Produce json @Success 200 {array} audiopkg.TranscriptionModelResponse @Failure 500 {object} ErrorResponse @Router /transcription-models [get].

func (*AudioHandler) ListTranscriptionModelsByProvider

func (h *AudioHandler) ListTranscriptionModelsByProvider(c echo.Context) error

ListTranscriptionModelsByProvider godoc @Summary List transcription models by provider @Description List models of type 'transcription' for a specific transcription provider @Tags transcription-providers @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {array} audiopkg.TranscriptionModelResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /transcription-providers/{id}/models [get].

func (*AudioHandler) ListTranscriptionProviders

func (h *AudioHandler) ListTranscriptionProviders(c echo.Context) error

ListTranscriptionProviders godoc @Summary List transcription providers @Description List providers that support transcription (filtered view of unified providers table) @Tags transcription-providers @Produce json @Success 200 {array} audiopkg.SpeechProviderResponse @Failure 500 {object} ErrorResponse @Router /transcription-providers [get].

func (*AudioHandler) Register

func (h *AudioHandler) Register(e *echo.Echo)

func (*AudioHandler) TestModel

func (h *AudioHandler) TestModel(c echo.Context) error

TestModel godoc @Summary Test speech model synthesis @Description Synthesize text using a specific model's config and return audio @Tags speech-models @Accept json @Produce application/octet-stream @Param id path string true "Model ID" @Param request body audiopkg.TestSynthesizeRequest true "Text to synthesize" @Success 200 {file} binary "Audio data" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /speech-models/{id}/test [post].

func (*AudioHandler) TestTranscriptionModel

func (h *AudioHandler) TestTranscriptionModel(c echo.Context) error

TestTranscriptionModel godoc @Summary Test transcription model recognition @Description Transcribe uploaded audio using a specific model's config and return structured text output @Tags transcription-models @Accept mpfd @Produce json @Param id path string true "Model ID" @Param file formData file true "Audio file" @Param config formData string false "Optional JSON config" @Success 200 {object} audiopkg.TestTranscriptionResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /transcription-models/{id}/test [post].

func (*AudioHandler) UpdateModel

func (h *AudioHandler) UpdateModel(c echo.Context) error

UpdateModel godoc @Summary Update a speech model @Tags speech-models @Accept json @Produce json @Param id path string true "Model ID" @Param request body audiopkg.UpdateSpeechModelRequest true "Model update payload" @Success 200 {object} audiopkg.SpeechModelResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /speech-models/{id} [put].

func (*AudioHandler) UpdateTranscriptionModel

func (h *AudioHandler) UpdateTranscriptionModel(c echo.Context) error

UpdateTranscriptionModel godoc @Summary Update a transcription model @Tags transcription-models @Accept json @Produce json @Param id path string true "Model ID" @Param request body audiopkg.UpdateSpeechModelRequest true "Model update payload" @Success 200 {object} audiopkg.TranscriptionModelResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /transcription-models/{id} [put].

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(log *slog.Logger, accountService *accounts.Service, jwtSecret string, expiresIn time.Duration) *AuthHandler

func (*AuthHandler) Login

func (h *AuthHandler) Login(c echo.Context) error

Login godoc @Summary Login @Description Validate user credentials and issue a JWT @Tags auth @Param payload body LoginRequest true "Login request" @Success 200 {object} LoginResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /auth/login [post].

func (*AuthHandler) Refresh

func (h *AuthHandler) Refresh(c echo.Context) error

Refresh godoc @Summary Refresh Token @Description Issue a new JWT using the existing claims with updated expiration @Tags auth @Security BearerAuth @Success 200 {object} RefreshResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /auth/refresh [post].

func (*AuthHandler) Register

func (h *AuthHandler) Register(e *echo.Echo)

type BatchDeleteRequest

type BatchDeleteRequest struct {
	IDs []string `json:"ids"`
}

BatchDeleteRequest is the body for batch delete.

type BotAgentsHandler

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

func NewBotAgentsHandler

func NewBotAgentsHandler(log *slog.Logger, service *botagents.Service, botService *bots.Service, accountService *accounts.Service, runtimes external.Drivers) *BotAgentsHandler

func (*BotAgentsHandler) Create

func (h *BotAgentsHandler) Create(c echo.Context) error

Create godoc @Summary Add an Agent to a bot @Description Add a named Agent backed by a runtime descriptor. Omit enabled to create it enabled; pass enabled=false to hold a direct-runtime Agent back until its workspace dependency preflight passes. The response reports that dependency (dependency_id) when the runtime declares one. @Tags bot-agents @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body botagents.CreateRequest true "Agent payload" @Success 201 {object} botagents.BotAgent @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/agents [post].

func (*BotAgentsHandler) Delete

func (h *BotAgentsHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete a bot Agent @Description Soft-delete an Agent while preserving existing session bindings @Tags bot-agents @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Success 204 "No Content" @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id} [delete].

func (*BotAgentsHandler) Get

func (h *BotAgentsHandler) Get(c echo.Context) error

Get godoc @Summary Get a bot Agent @Description Get one Agent attached to a bot, including the workspace dependency its runtime declares (omitted for runtimes without one). @Tags bot-agents @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Success 200 {object} botagents.BotAgent @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id} [get].

func (*BotAgentsHandler) List

func (h *BotAgentsHandler) List(c echo.Context) error

List godoc @Summary List a bot's Agents @Description List active and disabled non-deleted Agents attached to a bot. Direct-runtime Agents carry the workspace dependency their runtime declares. @Tags bot-agents @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} botagents.ListResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/agents [get].

func (*BotAgentsHandler) ListModels added in v0.20.0

func (h *BotAgentsHandler) ListModels(c echo.Context) error

ListModels godoc @Summary List models available to a bot Agent @Tags bot-agents @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Param model_id query string false "Model whose effective defaults should be displayed" @Param project_path query string false "Workspace project path for runtime model settings" @Success 200 {object} external.ModelCatalog @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/models [get].

func (*BotAgentsHandler) Register

func (h *BotAgentsHandler) Register(e *echo.Echo)

func (*BotAgentsHandler) RuntimeControls added in v0.20.0

func (h *BotAgentsHandler) RuntimeControls(c echo.Context) error

RuntimeControls godoc @Summary Get bot Agent default runtime controls @Tags bot-agents @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Success 200 {object} external.Controls @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id}/runtime-controls [get].

func (*BotAgentsHandler) Update

func (h *BotAgentsHandler) Update(c echo.Context) error

Update godoc @Summary Update a bot Agent @Description Update an Agent's name, availability, or runtime configuration @Tags bot-agents @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Agent ID" @Param payload body botagents.UpdateRequest true "Agent changes" @Success 200 {object} botagents.BotAgent @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/agents/{id} [patch].

type BotAudioHandler

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

BotAudioHandler handles per-bot speech synthesis requests from the agent tool.

func NewBotAudioHandler

func NewBotAudioHandler(log *slog.Logger, audioService *audiopkg.Service, settingsService *settings.Service, tempStore *audiopkg.TempStore) *BotAudioHandler

func (*BotAudioHandler) Register

func (h *BotAudioHandler) Register(e *echo.Echo)

func (*BotAudioHandler) Synthesize

func (h *BotAudioHandler) Synthesize(c echo.Context) error

Synthesize godoc @Summary Synthesize speech for a bot @Description Stream-synthesize text using the bot's configured TTS model, write to temp file @Tags bots @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param request body synthesizeRequest true "Text to synthesize" @Success 200 {object} synthesizeResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/tts/synthesize [post].

type BotBackupHandler

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

func NewBotBackupHandler

func NewBotBackupHandler(service *botbackup.Service, botService *bots.Service, accountService *accounts.Service) *BotBackupHandler

func (*BotBackupHandler) Export

func (h *BotBackupHandler) Export(c echo.Context) error

Export godoc @Summary Export a full bot backup @Tags bots @Accept json @Produce application/zip @Param bot_id path string true "Bot ID" @Param payload body botbackup.ExportRequest true "Export options" @Success 200 {file} file @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/backup/export [post].

func (*BotBackupHandler) Import

func (h *BotBackupHandler) Import(c echo.Context) error

Import godoc @Summary Import a bot backup @Tags bots @Accept multipart/form-data @Produce json @Param file formData file true "Bot backup zip" @Param mode formData string false "Import mode" @Param target_bot_id formData string false "Target bot ID for overwrite mode" @Param sections formData string false "JSON object mapping section to strategy (skip|merge|replace), e.g. {\"settings\":\"replace\"}; omit to import all" @Param passphrase formData string false "Passphrase to decrypt an encrypted backup" @Success 200 {object} botbackup.ImportResult @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/backup/import [post].

func (*BotBackupHandler) PreviewImport

func (h *BotBackupHandler) PreviewImport(c echo.Context) error

PreviewImport godoc @Summary Preview a bot backup import @Tags bots @Accept multipart/form-data @Produce json @Param file formData file true "Bot backup zip" @Param mode formData string false "Import mode" @Param target_bot_id formData string false "Target bot ID for overwrite mode" @Param sections formData string false "JSON object mapping section to strategy (skip|merge|replace), e.g. {\"settings\":\"replace\"}; omit to import all" @Param passphrase formData string false "Passphrase to decrypt an encrypted backup" @Success 200 {object} botbackup.PreviewResult @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/backup/import/preview [post].

func (*BotBackupHandler) Register

func (h *BotBackupHandler) Register(e *echo.Echo)

func (*BotBackupHandler) Summary

func (h *BotBackupHandler) Summary(c echo.Context) error

Summary godoc @Summary Summarize what a bot would export @Tags bots @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} botbackup.SummaryResult @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/backup/summary [get].

type BotRemoteRuntimeHandler

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

func NewBotRemoteRuntimeHandler

func NewBotRemoteRuntimeHandler(
	log *slog.Logger,
	service *workspace.RemoteWorkspaceService,
	manager *workspace.Manager,
	settingsService *settings.Service,
	botService *bots.Service,
	accountService *accounts.Service,
) *BotRemoteRuntimeHandler

func (*BotRemoteRuntimeHandler) Delete

Delete godoc @Summary Delete a Remote Runtime workspace target @Description Remote files and the Native workspace are not deleted. @Tags workspace-targets @Param bot_id path string true "Bot ID" @Param target_id path string true "Workspace target ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workspace-targets/{target_id} [delete].

func (*BotRemoteRuntimeHandler) List

List godoc @Summary List a Bot's workspace targets @Tags workspace-targets @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} workspace.WorkspaceTargetsResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/workspace-targets [get].

func (*BotRemoteRuntimeHandler) Mount

Mount godoc @Summary Add or update a Remote Runtime workspace target @Tags workspace-targets @Produce json @Param bot_id path string true "Bot ID" @Param runtime_id path string true "Runtime ID" @Success 200 {object} workspace.WorkspaceTarget @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workspace-targets/remotes/{runtime_id} [put].

func (*BotRemoteRuntimeHandler) Register

func (h *BotRemoteRuntimeHandler) Register(e *echo.Echo)

func (*BotRemoteRuntimeHandler) SetPrimary

func (h *BotRemoteRuntimeHandler) SetPrimary(c echo.Context) error

SetPrimary godoc @Summary Set a Bot's Primary workspace target @Tags workspace-targets @Accept json @Param bot_id path string true "Bot ID" @Param request body workspace.SetPrimaryWorkspaceTargetRequest true "Primary target" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workspace-targets/primary [put].

func (*BotRemoteRuntimeHandler) UpdateToolApproval

func (h *BotRemoteRuntimeHandler) UpdateToolApproval(c echo.Context) error

UpdateToolApproval godoc @Summary Update tool approval for one workspace target @Description The read/write/exec fields are mode shortcuts. tool_approval_config preserves and updates advanced bypass/force rules. @Tags workspace-targets @Accept json @Param bot_id path string true "Bot ID" @Param target_id path string true "Workspace target ID" @Param request body workspace.UpdateWorkspaceTargetToolApprovalRequest true "Target tool approval" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workspace-targets/{target_id}/tool-approval [put].

type BotUserAccessHandler

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

BotUserAccessHandler exposes CRUD for workspace user access grants on a bot.

func NewBotUserAccessHandler

func NewBotUserAccessHandler(botService *bots.Service, accountService *accounts.Service) *BotUserAccessHandler

NewBotUserAccessHandler constructs a BotUserAccessHandler.

func (*BotUserAccessHandler) CreateGrant

func (h *BotUserAccessHandler) CreateGrant(c echo.Context) error

CreateGrant godoc @Summary Create bot user access grant @Description Grant a workspace user (or everyone) access to a bot with a permission set @Tags bots @Param bot_id path string true "Bot ID" @Param payload body bots.CreateUserGrantRequest true "Grant payload" @Success 201 {object} bots.UserGrant @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/user-access [post].

func (*BotUserAccessHandler) DeleteGrant

func (h *BotUserAccessHandler) DeleteGrant(c echo.Context) error

DeleteGrant godoc @Summary Delete bot user access grant @Description Remove a workspace user access grant from a bot @Tags bots @Param bot_id path string true "Bot ID" @Param grant_id path string true "Grant ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/user-access/{grant_id} [delete].

func (*BotUserAccessHandler) ListCandidates

func (h *BotUserAccessHandler) ListCandidates(c echo.Context) error

ListCandidates godoc @Summary List grantable workspace members @Description List workspace members that can be granted access to a bot @Tags bots @Param bot_id path string true "Bot ID" @Param q query string false "Search query" @Param limit query int false "Max results" @Success 200 {object} BotUserCandidateListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/user-access/candidates [get].

func (*BotUserAccessHandler) ListGrants

func (h *BotUserAccessHandler) ListGrants(c echo.Context) error

ListGrants godoc @Summary List bot user access grants @Description List workspace user access grants for a bot, including the owner entry @Tags bots @Param bot_id path string true "Bot ID" @Success 200 {object} BotUserGrantListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/user-access [get].

func (*BotUserAccessHandler) ListNewBotCandidates added in v0.20.0

func (h *BotUserAccessHandler) ListNewBotCandidates(c echo.Context) error

ListNewBotCandidates godoc @Summary Search workspace member candidates for a bot being created @Description List grantable workspace members before the bot exists, for the create form @Tags bots @Param q query string false "Search query" @Param limit query int false "Max results" @Success 200 {object} BotUserCandidateListResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/user-access/candidates [get].

func (*BotUserAccessHandler) Register

func (h *BotUserAccessHandler) Register(e *echo.Echo)

func (*BotUserAccessHandler) UpdateGrant

func (h *BotUserAccessHandler) UpdateGrant(c echo.Context) error

UpdateGrant godoc @Summary Update bot user access grant @Description Update the permission set of a grant @Tags bots @Param bot_id path string true "Bot ID" @Param grant_id path string true "Grant ID" @Param payload body bots.UpdateUserGrantRequest true "Grant payload" @Success 200 {object} bots.UserGrant @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/user-access/{grant_id} [put].

type BotUserCandidate

type BotUserCandidate struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	AvatarURL   string `json:"avatar_url,omitempty"`
}

BotUserCandidate is a workspace member eligible to be granted bot access.

type BotUserCandidateListResponse

type BotUserCandidateListResponse struct {
	Items []BotUserCandidate `json:"items"`
}

BotUserCandidateListResponse wraps the list of grantable workspace members.

type BotUserGrantListResponse

type BotUserGrantListResponse struct {
	Items []bots.UserGrant `json:"items"`
}

BotUserGrantListResponse wraps the list of workspace user access grants for a bot.

type CacheStats

type CacheStats struct {
	CacheReadTokens  int64   `json:"cache_read_tokens"`
	TotalInputTokens int64   `json:"total_input_tokens"`
	CacheHitRate     float64 `json:"cache_hit_rate"`
}

type ChannelAccessHandler

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

ChannelAccessHandler exposes the per-bot Manage capability (Channel Access managers) and the global account-binding flow (Connected Accounts).

func NewChannelAccessHandler

func NewChannelAccessHandler(service *channelaccess.Service, botService *bots.Service, accountService *accounts.Service) *ChannelAccessHandler

NewChannelAccessHandler constructs a ChannelAccessHandler.

func (*ChannelAccessHandler) ClearManagerOverride

func (h *ChannelAccessHandler) ClearManagerOverride(c echo.Context) error

ClearManagerOverride godoc @Summary Clear a channel manage override @Description Remove the local Manage override so the channel identity falls back to inheritance @Tags bots @Param bot_id path string true "Bot ID" @Param channel_identity_id path string true "Channel Identity ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/channel-managers/{channel_identity_id} [delete].

func (*ChannelAccessHandler) IssueLinkCode

func (h *ChannelAccessHandler) IssueLinkCode(c echo.Context) error

IssueLinkCode godoc @Summary Issue an account link code @Description Generate a one-time code to send as /link <code> in IM to bind that channel identity to your account @Tags users @Param payload body channelaccess.IssueLinkCodeRequest false "Link code options" @Success 201 {object} channelaccess.LinkCode @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/channel-links [post].

func (*ChannelAccessHandler) ListBindings

func (h *ChannelAccessHandler) ListBindings(c echo.Context) error

ListBindings godoc @Summary List connected channel identities @Description List the IM channel identities bound to the current user's account @Tags users @Success 200 {object} channelaccess.ListBindingsResponse @Failure 500 {object} ErrorResponse @Router /users/me/channel-identities [get].

func (*ChannelAccessHandler) ListManagers

func (h *ChannelAccessHandler) ListManagers(c echo.Context) error

ListManagers godoc @Summary List channel managers @Description List effective Manage state per channel identity on a bot (inherited + local overrides) @Tags bots @Param bot_id path string true "Bot ID" @Success 200 {object} channelaccess.ListManagersResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/channel-managers [get].

func (*ChannelAccessHandler) Register

func (h *ChannelAccessHandler) Register(e *echo.Echo)

func (*ChannelAccessHandler) SetManager

func (h *ChannelAccessHandler) SetManager(c echo.Context) error

SetManager godoc @Summary Set a channel manage override @Description Force the Manage capability ON or OFF for a channel identity on a bot @Tags bots @Param bot_id path string true "Bot ID" @Param payload body channelaccess.SetManagerRequest true "Override payload" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/channel-managers [post].

func (*ChannelAccessHandler) Unbind

func (h *ChannelAccessHandler) Unbind(c echo.Context) error

Unbind godoc @Summary Disconnect a channel identity @Description Remove a channel identity binding from the current user's account @Tags users @Param channel_identity_id path string true "Channel Identity ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/channel-identities/{channel_identity_id} [delete].

type ChannelHandler

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

func NewChannelHandler

func NewChannelHandler(store *channel.Store, registry *channel.Registry) *ChannelHandler

func (*ChannelHandler) GetChannel

func (h *ChannelHandler) GetChannel(c echo.Context) error

GetChannel godoc @Summary Get channel capabilities and schemas @Description Get channel meta information including capabilities and schemas @Tags channel @Param platform path string true "Channel platform" @Success 200 {object} ChannelMeta @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /channels/{platform} [get].

func (*ChannelHandler) GetChannelIdentityConfig

func (h *ChannelHandler) GetChannelIdentityConfig(c echo.Context) error

GetChannelIdentityConfig godoc @Summary Get channel user config @Description Get channel binding configuration for current user @Tags channel @Param platform path string true "Channel platform" @Success 200 {object} channel.ChannelIdentityBinding @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/channels/{platform} [get].

func (*ChannelHandler) ListChannels

func (h *ChannelHandler) ListChannels(c echo.Context) error

ListChannels godoc @Summary List channel capabilities and schemas @Description List channel meta information including capabilities and schemas @Tags channel @Success 200 {array} ChannelMeta @Failure 500 {object} ErrorResponse @Router /channels [get].

func (*ChannelHandler) Register

func (h *ChannelHandler) Register(e *echo.Echo)

func (*ChannelHandler) UpsertChannelIdentityConfig

func (h *ChannelHandler) UpsertChannelIdentityConfig(c echo.Context) error

UpsertChannelIdentityConfig godoc @Summary Update channel user config @Description Update channel binding configuration for current user @Tags channel @Param platform path string true "Channel platform" @Param payload body channel.UpsertChannelIdentityConfigRequest true "Channel user config payload" @Success 200 {object} channel.ChannelIdentityBinding @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/channels/{platform} [put].

type ChannelMeta

type ChannelMeta struct {
	Type             string                      `json:"type"`
	DisplayName      string                      `json:"display_name"`
	Configless       bool                        `json:"configless"`
	Capabilities     channel.ChannelCapabilities `json:"capabilities"`
	ConfigSchema     channel.ConfigSchema        `json:"config_schema"`
	UserConfigSchema channel.ConfigSchema        `json:"user_config_schema"`
	TargetSpec       channel.TargetSpec          `json:"target_spec"`
}

type CodexDeviceLoginAuthorizeResponse added in v0.20.0

type CodexDeviceLoginAuthorizeResponse struct {
	LoginID         string `json:"login_id" validate:"required"`
	UserCode        string `json:"user_code" validate:"required"`
	VerificationURL string `json:"verification_url" validate:"required"`

} // @name externalagent.CodexDeviceLoginAuthorizeResponse

CodexDeviceLoginAuthorizeResponse starts a device-code login.

type CodexDeviceLoginPollRequest added in v0.20.0

type CodexDeviceLoginPollRequest struct {
	LoginID string `json:"login_id" validate:"required"`

} // @name externalagent.CodexDeviceLoginPollRequest

CodexDeviceLoginPollRequest identifies the login being polled or cancelled.

type CodexDeviceLoginPollResponse added in v0.20.0

type CodexDeviceLoginPollResponse struct {
	Status string `json:"status" validate:"required" enums:"pending,success,error,unknown"`

} // @name externalagent.CodexDeviceLoginPollResponse

CodexDeviceLoginPollResponse reports the login state.

type CommandActionError

type CommandActionError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type CommandActionListItem

type CommandActionListItem struct {
	I18nKey     string `json:"i18n_key,omitempty"`
	ID          string `json:"id,omitempty"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Kind        string `json:"kind,omitempty"`
}

type CommandActionResult

type CommandActionResult struct {
	Data    any                     `json:"data,omitempty"`
	Notice  string                  `json:"notice,omitempty"`
	TextKey string                  `json:"text_key,omitempty"`
	Kind    string                  `json:"kind"`
	Title   string                  `json:"title,omitempty"`
	Text    string                  `json:"text,omitempty"`
	Items   []CommandActionListItem `json:"items,omitempty"`
}

type CommandEventResponse

type CommandEventResponse struct {
	Type          string               `json:"type"`
	InvocationID  string               `json:"invocation_id,omitempty"`
	ComposerScope string               `json:"composer_scope,omitempty"`
	SessionID     string               `json:"session_id,omitempty"`
	ActionID      string               `json:"action_id,omitempty"`
	Terminal      bool                 `json:"terminal"`
	Result        *CommandActionResult `json:"result,omitempty"`
	Error         *CommandActionError  `json:"error,omitempty"`
}

type CompactionHandler

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

func NewCompactionHandler

func NewCompactionHandler(
	log *slog.Logger,
	service *compaction.Service,
	botService *bots.Service,
	accountService *accounts.Service,
	settingsService *settings.Service,
	modelsService *models.Service,
	queries dbstore.Queries,
	providersService *providers.Service,
) *CompactionHandler

func (*CompactionHandler) DeleteLogs

func (h *CompactionHandler) DeleteLogs(c echo.Context) error

DeleteLogs godoc @Summary Delete compaction logs @Description Delete all compaction logs for a bot @Tags compaction @Param bot_id path string true "Bot ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/compaction/logs [delete].

func (*CompactionHandler) ListLogs

func (h *CompactionHandler) ListLogs(c echo.Context) error

ListLogs godoc @Summary List compaction logs @Description List compaction logs for a bot @Tags compaction @Param bot_id path string true "Bot ID" @Param limit query int false "Limit" default(50) @Param offset query int false "Offset" default(0) @Success 200 {object} compaction.ListLogsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/compaction/logs [get].

func (*CompactionHandler) Register

func (h *CompactionHandler) Register(e *echo.Echo)

func (*CompactionHandler) TriggerCompact

func (h *CompactionHandler) TriggerCompact(c echo.Context) error

TriggerCompact godoc @Summary Trigger immediate context compaction @Description Run context compaction synchronously for a session @Tags compaction @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} TriggerCompactResponse @Failure 400 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/sessions/{session_id}/compact [post].

type CompactionInfo added in v0.20.0

type CompactionInfo struct {
	Enabled    bool  `json:"enabled"`
	AutoTokens int64 `json:"auto_tokens,omitempty"`
}

CompactionInfo reports where automatic compaction fires for this session. It is omitted for runtimes Memoh never compacts, and the mark is omitted until a turn has persisted a budget plan, so the UI never draws a guess.

type ConnectorCredentialRequest

type ConnectorCredentialRequest struct {
	ConnectorType string            `json:"connector_type"`
	AuthMethod    string            `json:"auth_method"`
	Fields        map[string]string `json:"fields"`
}

type ConnectorEnabledRequest

type ConnectorEnabledRequest struct {
	// Pointer so an empty or mistyped body fails validation instead of
	// silently disabling the connector.
	Enabled *bool `json:"enabled" validate:"required"`
}

type ConnectorOAuthRequest

type ConnectorOAuthRequest struct {
	ConnectorType string `json:"connector_type"`
	AuthMethod    string `json:"auth_method"`
}

type ConnectorsHandler

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

func NewConnectorsHandler

func NewConnectorsHandler(
	service *connectors.Service,
	botService *bots.Service,
	accountService *accounts.Service,
) *ConnectorsHandler

func (*ConnectorsHandler) Delete

func (h *ConnectorsHandler) Delete(c echo.Context) error

Delete godoc @Summary Disconnect a connector @Description Delete the Connect-It credential, remove its bot binding and unlink it from every App that referenced it; those Apps ask for authorization again. @Tags connectors @Param bot_id path string true "Bot ID" @Param connection_id path string true "Connect-It connection ID" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/connectors/{connection_id} [delete].

func (*ConnectorsHandler) Get

func (h *ConnectorsHandler) Get(c echo.Context) error

Get godoc @Summary Get a bot connector @Description Get one Connect-It connection bound to a bot. @Tags connectors @Param bot_id path string true "Bot ID" @Param connection_id path string true "Connect-It connection ID" @Success 200 {object} connectors.Connector @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/connectors/{connection_id} [get].

func (*ConnectorsHandler) List

func (h *ConnectorsHandler) List(c echo.Context) error

List godoc @Summary List bot connectors @Description List Connect-It connections enabled or disabled for a bot. @Tags connectors @Param bot_id path string true "Bot ID" @Success 200 {object} connectors.ListResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/connectors [get].

func (*ConnectorsHandler) ListCatalog

func (h *ConnectorsHandler) ListCatalog(c echo.Context) error

ListCatalog godoc @Summary List connector catalog @Description List providers available from the configured Connect-It deployment. @Tags connectors @Success 200 {array} connectsdk.Connector @Failure 403 {object} ErrorResponse @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /connectors/catalog [get].

func (*ConnectorsHandler) Reauthorize

func (h *ConnectorsHandler) Reauthorize(c echo.Context) error

Reauthorize godoc @Summary Reauthorize a connector @Description Start OAuth again while preserving the same Connect-It connection ID. @Tags connectors @Param bot_id path string true "Bot ID" @Param connection_id path string true "Connect-It connection ID" @Success 200 {object} connectsdk.OAuthAuthorization @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/connectors/{connection_id}/reauth [post].

func (*ConnectorsHandler) Register

func (h *ConnectorsHandler) Register(e *echo.Echo)

func (*ConnectorsHandler) SetEnabled

func (h *ConnectorsHandler) SetEnabled(c echo.Context) error

SetEnabled godoc @Summary Enable or disable a connector @Description Disabled connectors are omitted when Memoh signs the bot's next aggregate MCP session. @Tags connectors @Param bot_id path string true "Bot ID" @Param connection_id path string true "Connect-It connection ID" @Param payload body ConnectorEnabledRequest true "Enabled state" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 502 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/connectors/{connection_id} [patch].

type ContainerCPUMetricsResponse

type ContainerCPUMetricsResponse struct {
	UsagePercent      float64 `json:"usage_percent"`
	UsageNanoseconds  uint64  `json:"usage_nanoseconds"`
	UsageNanocores    uint64  `json:"usage_nanocores"`
	UserNanoseconds   uint64  `json:"user_nanoseconds"`
	KernelNanoseconds uint64  `json:"kernel_nanoseconds"`
}

type ContainerGPURequest

type ContainerGPURequest struct {
	Devices []string `json:"devices,omitempty"`
}

type ContainerMemoryMetricsResponse

type ContainerMemoryMetricsResponse struct {
	UsageBytes   uint64  `json:"usage_bytes"`
	LimitBytes   uint64  `json:"limit_bytes"`
	UsagePercent float64 `json:"usage_percent"`
}

type ContainerMetricsPayloadResponse

type ContainerMetricsPayloadResponse struct {
	CPU     *ContainerCPUMetricsResponse     `json:"cpu,omitempty"`
	Memory  *ContainerMemoryMetricsResponse  `json:"memory,omitempty"`
	Storage *ContainerStorageMetricsResponse `json:"storage,omitempty"`
}

type ContainerMetricsStatusResponse

type ContainerMetricsStatusResponse struct {
	Exists      bool `json:"exists"`
	TaskRunning bool `json:"task_running"`
}

type ContainerResourceLimitCapabilitiesResponse

type ContainerResourceLimitCapabilitiesResponse struct {
	CPU     ContainerResourceLimitCapabilityResponse `json:"cpu"`
	Memory  ContainerResourceLimitCapabilityResponse `json:"memory"`
	Storage ContainerResourceLimitCapabilityResponse `json:"storage"`
}

type ContainerResourceLimitCapabilityResponse

type ContainerResourceLimitCapabilityResponse struct {
	HardLimitSupported bool `json:"hard_limit_supported"`
	SoftLimitSupported bool `json:"soft_limit_supported"`
}

type ContainerResourceLimitObservedResponse

type ContainerResourceLimitObservedResponse struct {
	CPUUsagePercent      float64 `json:"cpu_usage_percent"`
	MemoryUsageBytes     uint64  `json:"memory_usage_bytes"`
	MemoryLimitBytes     uint64  `json:"memory_limit_bytes"`
	StorageUsedBytes     uint64  `json:"storage_used_bytes"`
	StorageOverSoftLimit bool    `json:"storage_over_soft_limit"`
}

type ContainerResourceLimitValuesResponse

type ContainerResourceLimitValuesResponse struct {
	CPUMillicores int64 `json:"cpu_millicores"`
	MemoryBytes   int64 `json:"memory_bytes"`
	StorageBytes  int64 `json:"storage_bytes"`
}

type ContainerStorageMetricsResponse

type ContainerStorageMetricsResponse struct {
	Path      string `json:"path"`
	UsedBytes uint64 `json:"used_bytes"`
}

type ContainerdHandler

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

func NewContainerdHandler

func NewContainerdHandler(log *slog.Logger, manager containerWorkspace, cfg config.WorkspaceConfig, containerBackend string, displayService *displaypkg.Service, botService *bots.Service, accountService *accounts.Service, policyService *policy.Service) *ContainerdHandler

func (*ContainerdHandler) ApplySkillAction

func (h *ContainerdHandler) ApplySkillAction(c echo.Context) error

ApplySkillAction godoc @Summary Apply an action to a discovered or managed skill source @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body SkillsActionRequest true "Skill action payload" @Success 200 {object} skillsOpResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/skills/actions [post].

func (*ContainerdHandler) CheckWorkspaceDependencyUpdates added in v0.20.0

func (h *ContainerdHandler) CheckWorkspaceDependencyUpdates(c echo.Context) error

CheckWorkspaceDependencyUpdates godoc @Summary Check workspace dependencies for updates @Description Re-discovers the workspace and runs the upstream update check of every installed tool dependency, then returns the refreshed list. @Tags containerd @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} WorkspaceDependencyListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/check-updates [post].

func (*ContainerdHandler) CloseDisplaySession

func (h *ContainerdHandler) CloseDisplaySession(c echo.Context) error

CloseDisplaySession godoc @Summary Close a workspace display WebRTC session @Tags containerd @Param bot_id path string true "Bot ID" @Param session_id path string true "Display session ID" @Success 204 @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/display/sessions/{session_id} [delete].

func (*ContainerdHandler) CreateBrowserSession

func (h *ContainerdHandler) CreateBrowserSession(c echo.Context) error

CreateBrowserSession godoc @Summary Create browser proxy session for bot workspace @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body browserSessionCreateRequest true "Browser session request" @Success 200 {object} browserSessionCreateResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/browser/sessions [post].

func (*ContainerdHandler) CreateContainer

func (h *ContainerdHandler) CreateContainer(c echo.Context) error

CreateContainer godoc @Summary Create and start workspace for bot @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body CreateContainerRequest true "Create workspace payload" @Success 200 {object} CreateContainerResponse "SSE stream of workspace creation events" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container [post].

func (*ContainerdHandler) CreateMCPStdio

func (h *ContainerdHandler) CreateMCPStdio(c echo.Context) error

CreateMCPStdio godoc @Summary Create MCP stdio proxy @Description Start a stdio MCP process in the bot workspace and expose it as an MCP HTTP endpoint. @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body MCPStdioRequest true "Stdio MCP payload" @Success 200 {object} MCPStdioResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp-stdio [post].

func (*ContainerdHandler) CreateSnapshot

func (h *ContainerdHandler) CreateSnapshot(c echo.Context) error

CreateSnapshot godoc @Summary Create workspace snapshot for bot @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body CreateSnapshotRequest true "Create snapshot payload" @Success 200 {object} CreateSnapshotResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 501 {object} ErrorResponse "Snapshots currently not supported on this backend" @Router /bots/{bot_id}/container/snapshots [post].

func (*ContainerdHandler) DeleteBrowserSession

func (h *ContainerdHandler) DeleteBrowserSession(c echo.Context) error

DeleteBrowserSession godoc @Summary Delete browser proxy session @Tags containerd @Param bot_id path string true "Bot ID" @Param session_id path string true "Browser session ID" @Success 204 @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/container/browser/sessions/{session_id} [delete].

func (*ContainerdHandler) DeleteContainer

func (h *ContainerdHandler) DeleteContainer(c echo.Context) error

DeleteContainer godoc @Summary Delete workspace for bot @Tags containerd @Param bot_id path string true "Bot ID" @Param preserve_data query bool false "Export /data before deletion" @Success 204 @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container [delete].

func (*ContainerdHandler) DeleteSkills

func (h *ContainerdHandler) DeleteSkills(c echo.Context) error

DeleteSkills godoc @Summary Delete Memoh-managed skills @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body SkillsDeleteRequest true "Delete skills payload" @Success 200 {object} skillsOpResponse @Failure 400 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/skills [delete].

func (*ContainerdHandler) FSArchive

func (h *ContainerdHandler) FSArchive(c echo.Context) error

FSArchive godoc @Summary Download files and directories as tar.gz @Description Downloads selected files/directories from the workspace as a tar.gz archive @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSArchiveRequest true "Archive request" @Produce octet-stream @Success 200 {file} binary @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/archive [post].

func (*ContainerdHandler) FSDelete

func (h *ContainerdHandler) FSDelete(c echo.Context) error

FSDelete godoc @Summary Delete a file or directory @Description Deletes a file or directory at the given workspace path @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSDeleteRequest true "Delete request" @Success 200 {object} fsOpResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/delete [post].

func (*ContainerdHandler) FSDownload

func (h *ContainerdHandler) FSDownload(c echo.Context) error

FSDownload godoc @Summary Download a file as binary stream @Description Downloads a file from the workspace with appropriate Content-Type @Tags containerd @Param bot_id path string true "Bot ID" @Param path query string true "Workspace file path" @Produce octet-stream @Success 200 {file} binary @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/download [get].

func (*ContainerdHandler) FSExtract

func (h *ContainerdHandler) FSExtract(c echo.Context) error

FSExtract godoc @Summary Extract an archive file @Description Extracts a .zip, .tar.gz, or .tgz file into a sibling directory named after the archive @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSExtractRequest true "Extract request" @Success 200 {object} FSExtractResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/extract [post].

func (*ContainerdHandler) FSList

func (h *ContainerdHandler) FSList(c echo.Context) error

FSList godoc @Summary List directory contents @Description Lists files and directories at the given workspace path @Tags containerd @Param bot_id path string true "Bot ID" @Param path query string true "Workspace directory path" @Success 200 {object} FSListResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/list [get].

func (*ContainerdHandler) FSMkdir

func (h *ContainerdHandler) FSMkdir(c echo.Context) error

FSMkdir godoc @Summary Create a directory @Description Creates a directory (and parents) at the given workspace path @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSMkdirRequest true "Mkdir request" @Success 200 {object} fsOpResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/mkdir [post].

func (*ContainerdHandler) FSRead

func (h *ContainerdHandler) FSRead(c echo.Context) error

FSRead godoc @Summary Read file content as text @Description Reads the content of a file and returns it as a JSON string @Tags containerd @Param bot_id path string true "Bot ID" @Param path query string true "Workspace file path" @Success 200 {object} FSReadResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/read [get].

func (*ContainerdHandler) FSRename

func (h *ContainerdHandler) FSRename(c echo.Context) error

FSRename godoc @Summary Rename or move a file/directory @Description Renames or moves a file/directory from oldPath to newPath @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSRenameRequest true "Rename request" @Success 200 {object} fsOpResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/rename [post].

func (*ContainerdHandler) FSStat

func (h *ContainerdHandler) FSStat(c echo.Context) error

FSStat godoc @Summary Get file or directory info @Description Returns metadata about a file or directory at the given workspace path @Tags containerd @Param bot_id path string true "Bot ID" @Param path query string true "Workspace path" @Success 200 {object} FSFileInfo @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs [get].

func (*ContainerdHandler) FSUpload

func (h *ContainerdHandler) FSUpload(c echo.Context) error

FSUpload godoc @Summary Upload a file via multipart form @Description Uploads a binary file to the given workspace path @Tags containerd @Param bot_id path string true "Bot ID" @Param path formData string true "Destination workspace path" @Param file formData file true "File to upload" @Accept multipart/form-data @Success 200 {object} FSUploadResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/upload [post].

func (*ContainerdHandler) FSWrite

func (h *ContainerdHandler) FSWrite(c echo.Context) error

FSWrite godoc @Summary Write text content to a file @Description Creates or overwrites a file with the provided text content @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body FSWriteRequest true "Write request" @Success 200 {object} fsOpResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/fs/write [post].

func (*ContainerdHandler) GetContainer

func (h *ContainerdHandler) GetContainer(c echo.Context) error

GetContainer godoc @Summary Get workspace info for bot @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} GetContainerResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container [get].

func (*ContainerdHandler) GetContainerMetrics

func (h *ContainerdHandler) GetContainerMetrics(c echo.Context) error

GetContainerMetrics godoc @Summary Get current workspace metrics for bot @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} GetContainerMetricsResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/metrics [get].

func (*ContainerdHandler) GetDisplayInfo

func (h *ContainerdHandler) GetDisplayInfo(c echo.Context) error

GetDisplayInfo godoc @Summary Check workspace display availability for bot @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} displayInfoResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/display [get].

func (*ContainerdHandler) GetTerminalInfo

func (h *ContainerdHandler) GetTerminalInfo(c echo.Context) error

GetTerminalInfo godoc @Summary Check terminal availability for bot workspace @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} terminalInfoResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/terminal [get].

func (*ContainerdHandler) GetWorkspaceDependencyIcon added in v0.20.0

func (h *ContainerdHandler) GetWorkspaceDependencyIcon(c echo.Context) error

GetWorkspaceDependencyIcon godoc @Summary Read a cached verified dependency icon @Tags containerd @Produce image/svg+xml @Param digest path string true "SHA-256 digest" @Success 200 {file} binary @Failure 400 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Router /workspace-dependencies/icons/{digest} [get].

func (*ContainerdHandler) GetWorkspaceDependencyScript added in v0.20.0

func (h *ContainerdHandler) GetWorkspaceDependencyScript(c echo.Context) error

GetWorkspaceDependencyScript godoc @Summary Show the script a dependency action would run @Description The exact stdin text the workspace shell receives, prelude included, with the command, time budget, and environment the runner uses. Scripts never touch the workspace disk, so this is the only way to inspect them. @Tags containerd @Produce json @Param bot_id path string true "Bot ID" @Param dep_id path string true "Dependency ID" @Param action query string false "Action" Enums(install, update, remove, reinstall, rollback) default(install) @Success 200 {object} WorkspaceDependencyScriptResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Param definition_revision query string false "Keep a previously prepared definition revision" @Router /bots/{bot_id}/dependencies/{dep_id}/script [get].

func (*ContainerdHandler) HandleBrowserProxy

func (h *ContainerdHandler) HandleBrowserProxy(c echo.Context) error

func (*ContainerdHandler) HandleDisplayWebRTCOffer

func (h *ContainerdHandler) HandleDisplayWebRTCOffer(c echo.Context) error

HandleDisplayWebRTCOffer godoc @Summary Create a WebRTC answer for bot workspace display @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body displayWebRTCOfferRequest true "WebRTC offer payload" @Success 200 {object} displayWebRTCOfferResponse @Failure 400 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/container/display/webrtc/offer [post].

func (*ContainerdHandler) HandleMCPStdio

func (h *ContainerdHandler) HandleMCPStdio(c echo.Context) error

func (*ContainerdHandler) HandleMCPTools

func (h *ContainerdHandler) HandleMCPTools(c echo.Context) error

HandleMCPTools godoc @Summary Unified MCP tools gateway @Description MCP endpoint for tool discovery and invocation. @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body object true "JSON-RPC request" @Success 200 {object} object "JSON-RPC response: {jsonrpc,id,result|error}" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/tools [post].

func (*ContainerdHandler) HandleTerminalWS

func (h *ContainerdHandler) HandleTerminalWS(c echo.Context) error

HandleTerminalWS godoc @Summary Interactive WebSocket terminal for bot workspace @Tags containerd @Param bot_id path string true "Bot ID" @Param cols query int false "Initial terminal columns" default(80) @Param rows query int false "Initial terminal rows" default(24) @Param token query string false "Auth token" @Success 101 "WebSocket upgrade" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/terminal/ws [get].

func (*ContainerdHandler) InstallWorkspaceDependency added in v0.20.0

func (h *ContainerdHandler) InstallWorkspaceDependency(c echo.Context) error

InstallWorkspaceDependency godoc @Summary Install or reinstall a referenced workspace dependency @Description Runs the catalog install script for a dependency an App references and streams its output: a retry after a failed App step, or a managed overlay laid over the copy the workspace image ships. New dependencies reach a bot by installing the App that references them. Events: started, log, done, error. @Tags containerd @Accept json @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param dep_id path string true "Dependency ID" @Param payload body WorkspaceDependencyInstallRequest false "Version to install (optional)" @Success 200 {object} WorkspaceDependencyStreamEvent "SSE stream of operation events" @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/{dep_id}/install [post].

func (*ContainerdHandler) KeepAliveBrowserSession

func (h *ContainerdHandler) KeepAliveBrowserSession(c echo.Context) error

KeepAliveBrowserSession godoc @Summary Keep browser proxy session alive @Tags containerd @Param bot_id path string true "Bot ID" @Param session_id path string true "Browser session ID" @Success 200 {object} browserSessionKeepAliveResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/browser/sessions/{session_id}/keepalive [post].

func (*ContainerdHandler) ListDisplaySessions

func (h *ContainerdHandler) ListDisplaySessions(c echo.Context) error

ListDisplaySessions godoc @Summary List active workspace display WebRTC sessions @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} displaySessionListResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/display/sessions [get].

func (*ContainerdHandler) ListSafeSkillCatalog

func (h *ContainerdHandler) ListSafeSkillCatalog(ctx context.Context, botID string) ([]skillset.SafeCatalogItem, error)

func (*ContainerdHandler) ListSafeSkills

func (h *ContainerdHandler) ListSafeSkills(c echo.Context) error

ListSafeSkills godoc @Summary List runtime-safe skills for chat-time skill selection @Tags skills @Param bot_id path string true "Bot ID" @Success 200 {object} SafeSkillsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/skills/catalog [get].

func (*ContainerdHandler) ListSkills

func (h *ContainerdHandler) ListSkills(c echo.Context) error

ListSkills godoc @Summary List skills from the bot workspace @Tags containerd @Param bot_id path string true "Bot ID" @Param workspace_target_id query string false "Workspace target ID" @Success 200 {object} SkillsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/skills [get].

func (*ContainerdHandler) ListSnapshots

func (h *ContainerdHandler) ListSnapshots(c echo.Context) error

ListSnapshots godoc @Summary List snapshots @Tags containerd @Param bot_id path string true "Bot ID" @Param snapshotter query string false "Snapshotter name" @Success 200 {object} ListSnapshotsResponse @Failure 501 {object} ErrorResponse "Snapshots currently not supported on this backend" @Router /bots/{bot_id}/container/snapshots [get].

func (*ContainerdHandler) ListWorkspaceDependencies added in v0.20.0

func (h *ContainerdHandler) ListWorkspaceDependencies(c echo.Context) error

ListWorkspaceDependencies godoc @Summary List workspace dependencies @Description Every catalog dependency (image-provided runtimes, managed agent CLIs and tools) reconciled with its installation record and, when the workspace is running, with what is actually installed. @Tags containerd @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} WorkspaceDependencyListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Param refresh query bool false "Refresh definitions and workspace discovery" @Router /bots/{bot_id}/dependencies [get].

func (*ContainerdHandler) ListWorkspaceDependencyCatalog added in v0.20.0

func (h *ContainerdHandler) ListWorkspaceDependencyCatalog(c echo.Context) error

ListWorkspaceDependencyCatalog godoc @Summary List published workspace dependency metadata @Description Reads names, descriptions and verified icon URLs without inspecting or starting a bot workspace. @Tags containerd @Produce json @Success 200 {object} WorkspaceDependencyCatalogResponse @Failure 503 {object} apperror.Problem @Router /workspace-dependencies [get].

func (*ContainerdHandler) LoadSkills

func (h *ContainerdHandler) LoadSkills(ctx context.Context, botID string) ([]SkillItem, error)

LoadSkills loads the effective skills from the container for the given bot.

func (*ContainerdHandler) PreflightWorkspaceDependencies added in v0.20.0

func (h *ContainerdHandler) PreflightWorkspaceDependencies(c echo.Context) error

PreflightWorkspaceDependencies godoc @Summary Check whether dependencies are ready @Description Reports for each requested dependency whether a copy is installed, whatever its version. Never starts the workspace: when it is not running, items is empty and workspace_state says why. @Tags containerd @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body WorkspaceDependencyPreflightRequest true "Dependencies to check" @Success 200 {object} WorkspaceDependencyPreflightResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/preflight [post].

func (*ContainerdHandler) PrepareDisplay

func (h *ContainerdHandler) PrepareDisplay(c echo.Context) error

PrepareDisplay godoc @Summary Prepare workspace display dependencies @Description Validates the image-provided desktop/VNC/browser runtime, starts the display server, and launches the browser. @Tags containerd @Produce text/event-stream @Param bot_id path string true "Bot ID" @Success 200 {string} string "SSE stream of display preparation events" @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/container/display/prepare [post].

func (*ContainerdHandler) Register

func (h *ContainerdHandler) Register(e *echo.Echo)

func (*ContainerdHandler) ReinstallWorkspaceDependency added in v0.20.0

func (h *ContainerdHandler) ReinstallWorkspaceDependency(c echo.Context) error

ReinstallWorkspaceDependency godoc @Summary Reinstall a workspace dependency @Description Runs the catalog reinstall script, or remove followed by install, and streams the output. The optional body names the version to install; without one the script picks the latest version (or the manifest pin). @Tags containerd @Accept json @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param dep_id path string true "Dependency ID" @Param payload body WorkspaceDependencyInstallRequest false "Version to install (optional)" @Success 200 {object} WorkspaceDependencyStreamEvent "SSE stream of operation events" @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/{dep_id}/reinstall [post].

func (*ContainerdHandler) ResolveTextRequestedSkills

func (h *ContainerdHandler) ResolveTextRequestedSkills(ctx context.Context, botID string, names []string) ([]skillset.ResolvedSkill, error)

func (*ContainerdHandler) RestorePreservedData

func (h *ContainerdHandler) RestorePreservedData(c echo.Context) error

RestorePreservedData godoc @Summary Restore previously preserved data into workspace @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} object @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/data/restore [post].

func (*ContainerdHandler) RollbackSnapshot

func (h *ContainerdHandler) RollbackSnapshot(c echo.Context) error

RollbackSnapshot godoc @Summary Roll back workspace to a previous snapshot version @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body RollbackRequest true "Rollback payload" @Success 200 {object} object @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/snapshots/rollback [post].

func (*ContainerdHandler) RollbackWorkspaceDependency added in v0.20.0

func (h *ContainerdHandler) RollbackWorkspaceDependency(c echo.Context) error

RollbackWorkspaceDependency godoc @Summary Roll a workspace dependency back to its previous version @Description Switches the dependency back to the previous version kept in the workspace. A pure data operation: nothing is downloaded and no log is streamed. @Tags containerd @Produce json @Param bot_id path string true "Bot ID" @Param dep_id path string true "Dependency ID" @Success 200 {object} WorkspaceDependencyOperationResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/{dep_id}/rollback [post].

func (*ContainerdHandler) SetACPRuntimeResolver

func (h *ContainerdHandler) SetACPRuntimeResolver(resolver acpRuntimeContextResolver)

func (*ContainerdHandler) SetToolGatewayService

func (h *ContainerdHandler) SetToolGatewayService(service *mcpgw.ToolGatewayService)

func (*ContainerdHandler) SetToolSessionContextStore

func (h *ContainerdHandler) SetToolSessionContextStore(store *mcpgw.ToolSessionContextStore)

func (*ContainerdHandler) SetWorkspaceDependencyService added in v0.20.0

func (h *ContainerdHandler) SetWorkspaceDependencyService(svc workspaceDependencyService)

SetWorkspaceDependencyService installs the dependency service behind /bots/:bot_id/dependencies. Without it the routes answer 503.

func (*ContainerdHandler) StartContainer

func (h *ContainerdHandler) StartContainer(c echo.Context) error

StartContainer godoc @Summary Start workspace for bot @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} object @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/start [post].

func (*ContainerdHandler) StopContainer

func (h *ContainerdHandler) StopContainer(c echo.Context) error

StopContainer godoc @Summary Stop workspace for bot @Tags containerd @Param bot_id path string true "Bot ID" @Success 200 {object} object @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/stop [post].

func (*ContainerdHandler) UpdateContainerMetrics

func (h *ContainerdHandler) UpdateContainerMetrics(c echo.Context) error

UpdateContainerMetrics godoc @Summary Update workspace metrics settings for bot @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body UpdateContainerMetricsRequest true "Metrics settings payload" @Success 200 {object} GetContainerMetricsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/container/metrics [put].

func (*ContainerdHandler) UpdateWorkspaceDependency added in v0.20.0

func (h *ContainerdHandler) UpdateWorkspaceDependency(c echo.Context) error

UpdateWorkspaceDependency godoc @Summary Update a workspace dependency @Description Runs the catalog update script (or the install script when the manifest has none) and streams its output. The optional body names the version to update to; without one the script picks the latest version (or the manifest pin). The previous version is kept for rollback. @Tags containerd @Accept json @Produce text/event-stream @Param bot_id path string true "Bot ID" @Param dep_id path string true "Dependency ID" @Param payload body WorkspaceDependencyInstallRequest false "Version to update to (optional)" @Success 200 {object} WorkspaceDependencyStreamEvent "SSE stream of operation events" @Failure 400 {object} apperror.Problem @Failure 403 {object} ErrorResponse @Failure 404 {object} apperror.Problem @Failure 422 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/dependencies/{dep_id}/update [post].

func (*ContainerdHandler) UpsertSkills

func (h *ContainerdHandler) UpsertSkills(c echo.Context) error

UpsertSkills godoc @Summary Upload skills into Memoh-managed directory @Tags containerd @Param bot_id path string true "Bot ID" @Param payload body SkillsUpsertRequest true "Skills payload" @Success 200 {object} skillsOpResponse @Failure 400 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Failure 404 {object} ErrorResponse @Failure 500 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Router /bots/{bot_id}/container/skills [post].

type ContextLifecycleAggregates added in v0.20.0

type ContextLifecycleAggregates struct {
	Turns                 int            `json:"turns"`
	TotalCacheReadTokens  int            `json:"total_cache_read_tokens"`
	TotalCacheWriteTokens int            `json:"total_cache_write_tokens"`
	DropReasons           map[string]int `json:"drop_reasons,omitempty"`
	MutationKinds         map[string]int `json:"mutation_kinds,omitempty"`
}

ContextLifecycleAggregates sums facts observed on the returned page at Memoh's own boundary: native runs report SDK/provider usage, while ACP runs expose only protocol-level input, so an ACP zero means "not observable here", not "measured zero". Derived cache-comparison ratios and tool-roster churn are intentionally absent until a durable comparator exists.

type ContextLifecycleResponse

type ContextLifecycleResponse struct {
	Turns      []ContextLifecycleTurn     `json:"turns"`
	Aggregates ContextLifecycleAggregates `json:"aggregates"`
	// Limit is the page bound the turns and aggregates were computed over.
	Limit int `json:"limit"`
	// HasMore reports whether older lifecycle turns exist beyond this page.
	HasMore bool `json:"has_more"`
	// LegacySource reports that turns were recovered from pre-run-table
	// assistant metadata instead of the run-keyed lifecycle table.
	LegacySource bool `json:"legacy_source,omitempty"`
	// LegacyHistoryMayExist reports that pre-run-table assistant metadata also
	// exists for this session while the run-keyed table served the page, so
	// this response does not cover the session's full history era.
	LegacyHistoryMayExist bool `json:"legacy_history_may_exist,omitempty"`
	// AggregateScope is always "returned_page": aggregates cover the returned
	// turns, never the whole session.
	AggregateScope string `json:"aggregate_scope"`
}

type ContextLifecycleTurn

type ContextLifecycleTurn struct {
	RunID              string                        `json:"run_id"`
	Status             string                        `json:"status,omitempty"`
	ErrorCode          string                        `json:"error_code,omitempty"`
	AssistantMessageID string                        `json:"assistant_message_id,omitempty"`
	CreatedAt          time.Time                     `json:"created_at"`
	Snapshot           contextfrag.LifecycleSnapshot `json:"snapshot"`
}

ContextLifecycleTurn is one persisted lifecycle snapshot, newest first.

type ContextUsage

type ContextUsage struct {
	UsedTokens    int64                          `json:"used_tokens"`
	ContextWindow *int64                         `json:"context_window,omitempty"`
	Breakdown     []contextfrag.KindBreakdown    `json:"breakdown,omitempty"`
	ToolDefs      []ToolDefBucket                `json:"tool_defs,omitempty"`
	BudgetPlan    *contextfrag.ContextBudgetPlan `json:"budget_plan,omitempty"`
	Compaction    *CompactionInfo                `json:"compaction,omitempty"`
}

type CreateContainerRequest

type CreateContainerRequest struct {
	Snapshotter string               `json:"snapshotter,omitempty"`
	RestoreData bool                 `json:"restore_data,omitempty"`
	Image       string               `json:"image,omitempty"`
	GPU         *ContainerGPURequest `json:"gpu,omitempty"`
}

type CreateContainerResponse

type CreateContainerResponse struct {
	ContainerID      string   `json:"container_id"`
	WorkspaceBackend string   `json:"workspace_backend"`
	RuntimeBackend   string   `json:"runtime_backend,omitempty"`
	ContainerPath    string   `json:"container_path"`
	Image            string   `json:"image"`
	Snapshotter      string   `json:"snapshotter"`
	CDIDevices       []string `json:"cdi_devices,omitempty"`
	Started          bool     `json:"started"`
	DataRestored     bool     `json:"data_restored"`
	HasPreservedData bool     `json:"has_preserved_data"`
}

type CreateSnapshotRequest

type CreateSnapshotRequest struct {
	SnapshotName string `json:"snapshot_name"`
}

type CreateSnapshotResponse

type CreateSnapshotResponse struct {
	ContainerID         string `json:"container_id"`
	SnapshotName        string `json:"snapshot_name"`
	RuntimeSnapshotName string `json:"runtime_snapshot_name"`
	DisplayName         string `json:"display_name"`
	Snapshotter         string `json:"snapshotter"`
	Version             int    `json:"version"`
	Source              string `json:"source"`
}

type DailyTokenUsage

type DailyTokenUsage struct {
	Day             string `json:"day"`
	InputTokens     int64  `json:"input_tokens"`
	OutputTokens    int64  `json:"output_tokens"`
	CacheReadTokens int64  `json:"cache_read_tokens"`
	ReasoningTokens int64  `json:"reasoning_tokens"`
}

DailyTokenUsage represents aggregated token usage for a single day.

type EmailBindingsHandler

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

func NewEmailBindingsHandler

func NewEmailBindingsHandler(log *slog.Logger, service *email.Service, manager email.Runtime, botService *bots.Service, accountService *accounts.Service) *EmailBindingsHandler

func (*EmailBindingsHandler) Create

func (h *EmailBindingsHandler) Create(c echo.Context) error

Create godoc @Summary Bind an email provider to a bot @Tags email-bindings @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param request body email.CreateBindingRequest true "Binding configuration" @Success 201 {object} email.BindingResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/email-bindings [post].

func (*EmailBindingsHandler) Delete

func (h *EmailBindingsHandler) Delete(c echo.Context) error

Delete godoc @Summary Remove an email binding @Tags email-bindings @Param bot_id path string true "Bot ID" @Param id path string true "Binding ID" @Success 204 "No Content" @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/email-bindings/{id} [delete].

func (*EmailBindingsHandler) List

List godoc @Summary List email bindings for a bot @Tags email-bindings @Produce json @Param bot_id path string true "Bot ID" @Success 200 {array} email.BindingResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/email-bindings [get].

func (*EmailBindingsHandler) Register

func (h *EmailBindingsHandler) Register(e *echo.Echo)

func (*EmailBindingsHandler) Update

func (h *EmailBindingsHandler) Update(c echo.Context) error

Update godoc @Summary Update an email binding @Tags email-bindings @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Binding ID" @Param request body email.UpdateBindingRequest true "Updated binding" @Success 200 {object} email.BindingResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/email-bindings/{id} [put].

type EmailOAuthHandler

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

EmailOAuthHandler handles the OAuth2 authorization flow for Gmail providers.

func NewEmailOAuthHandler

func NewEmailOAuthHandler(log *slog.Logger, service *email.Service, tokenStore email.OAuthTokenStore, oauthClients oauthclients.Resolver, callbackURL string) *EmailOAuthHandler

func (*EmailOAuthHandler) Authorize

func (h *EmailOAuthHandler) Authorize(c echo.Context) error

Authorize godoc @Summary Start OAuth2 authorization for an email provider @Description Returns the authorization URL to redirect the user to @Tags email-oauth @Param id path string true "Email provider ID" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /email-providers/{id}/oauth/authorize [get].

func (*EmailOAuthHandler) Callback

func (h *EmailOAuthHandler) Callback(c echo.Context) error

Callback godoc @Summary OAuth2 callback for email providers @Description Handles the OAuth2 callback, exchanges the code for tokens @Tags email-oauth @Param code query string true "Authorization code" @Param state query string true "State parameter" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /email/oauth/callback [get].

func (*EmailOAuthHandler) Register

func (h *EmailOAuthHandler) Register(e *echo.Echo)

func (*EmailOAuthHandler) Revoke

func (h *EmailOAuthHandler) Revoke(c echo.Context) error

Revoke godoc @Summary Revoke stored OAuth2 tokens for an email provider @Tags email-oauth @Param id path string true "Email provider ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /email-providers/{id}/oauth/token [delete].

func (*EmailOAuthHandler) Status

func (h *EmailOAuthHandler) Status(c echo.Context) error

Status godoc @Summary Get OAuth2 status for an email provider @Tags email-oauth @Param id path string true "Email provider ID" @Success 200 {object} emailOAuthStatusResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /email-providers/{id}/oauth/status [get].

type EmailOutboxHandler

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

func NewEmailOutboxHandler

func NewEmailOutboxHandler(log *slog.Logger, outbox *email.OutboxService, botService *bots.Service, accountService *accounts.Service) *EmailOutboxHandler

func (*EmailOutboxHandler) Get

Get godoc @Summary Get outbox email detail @Tags email-outbox @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Email ID" @Success 200 {object} email.OutboxItemResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/email-outbox/{id} [get].

func (*EmailOutboxHandler) List

func (h *EmailOutboxHandler) List(c echo.Context) error

List godoc @Summary List outbox emails for a bot (audit) @Tags email-outbox @Produce json @Param bot_id path string true "Bot ID" @Param limit query int false "Limit" default(20) @Param offset query int false "Offset" default(0) @Success 200 {object} map[string]any @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/email-outbox [get].

func (*EmailOutboxHandler) Register

func (h *EmailOutboxHandler) Register(e *echo.Echo)

type EmailProvidersHandler

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

func NewEmailProvidersHandler

func NewEmailProvidersHandler(log *slog.Logger, service *email.Service) *EmailProvidersHandler

func (*EmailProvidersHandler) Create

func (h *EmailProvidersHandler) Create(c echo.Context) error

Create godoc @Summary Create an email provider @Tags email-providers @Accept json @Produce json @Param request body email.CreateProviderRequest true "Email provider configuration" @Success 201 {object} email.ProviderResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /email-providers [post].

func (*EmailProvidersHandler) Delete

func (h *EmailProvidersHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete an email provider @Tags email-providers @Param id path string true "Provider ID" @Success 204 "No Content" @Failure 500 {object} ErrorResponse @Router /email-providers/{id} [delete].

func (*EmailProvidersHandler) Get

Get godoc @Summary Get an email provider @Tags email-providers @Produce json @Param id path string true "Provider ID" @Success 200 {object} email.ProviderResponse @Failure 404 {object} ErrorResponse @Router /email-providers/{id} [get].

func (*EmailProvidersHandler) List

List godoc @Summary List email providers @Tags email-providers @Produce json @Param provider query string false "Provider type filter" @Success 200 {array} email.ProviderResponse @Failure 500 {object} ErrorResponse @Router /email-providers [get].

func (*EmailProvidersHandler) ListMeta

func (h *EmailProvidersHandler) ListMeta(c echo.Context) error

ListMeta godoc @Summary List email provider metadata @Description List available email provider types and config schemas @Tags email-providers @Success 200 {array} email.ProviderMeta @Router /email-providers/meta [get].

func (*EmailProvidersHandler) Register

func (h *EmailProvidersHandler) Register(e *echo.Echo)

func (*EmailProvidersHandler) Update

func (h *EmailProvidersHandler) Update(c echo.Context) error

Update godoc @Summary Update an email provider @Tags email-providers @Accept json @Produce json @Param id path string true "Provider ID" @Param request body email.UpdateProviderRequest true "Updated configuration" @Success 200 {object} email.ProviderResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /email-providers/{id} [put].

type EmailWebhookHandler

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

EmailWebhookHandler handles inbound email webhooks (Mailgun). Modeled after the Feishu WebhookHandler pattern.

func NewEmailWebhookHandler

func NewEmailWebhookHandler(log *slog.Logger, service *email.Service, manager *email.Manager, trigger *email.Trigger) *EmailWebhookHandler

func (*EmailWebhookHandler) HandleMailgun

func (h *EmailWebhookHandler) HandleMailgun(c echo.Context) error

HandleMailgun godoc @Summary Mailgun inbound email webhook @Description Receives inbound emails from Mailgun @Tags email-webhook @Param config_id path string true "Email provider config ID" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /email/mailgun/webhook/{config_id} [post].

func (*EmailWebhookHandler) Register

func (h *EmailWebhookHandler) Register(e *echo.Echo)

type EmbeddedWebHandler

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

func NewEmbeddedWebHandler

func NewEmbeddedWebHandler(log *slog.Logger) (*EmbeddedWebHandler, error)

func (*EmbeddedWebHandler) Register

func (h *EmbeddedWebHandler) Register(e *echo.Echo)

type ErrorResponse

type ErrorResponse struct {
	Message    string            `json:"message"`
	Code       string            `json:"code,omitempty"`
	Reason     string            `json:"reason,omitempty"`
	HTTPStatus int               `json:"http_status,omitempty"`
	I18nKey    string            `json:"i18n_key,omitempty"`
	Args       map[string]string `json:"args,omitempty"`
}

type ExternalAgentCodexHandler added in v0.20.0

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

ExternalAgentCodexHandler exposes the direct codex runtime's login flow: the ChatGPT subscription device-code login runs through the app-server protocol and its credentials are copied into the encrypted Agent credential store.

func NewExternalAgentCodexHandler added in v0.20.0

func NewExternalAgentCodexHandler(log *slog.Logger, driver codexService, agents *botagents.Service, botService *bots.Service, accountService *accounts.Service) *ExternalAgentCodexHandler

NewExternalAgentCodexHandler constructs the codex runtime handler.

func (*ExternalAgentCodexHandler) AuthorizeDevice added in v0.20.0

func (h *ExternalAgentCodexHandler) AuthorizeDevice(c echo.Context) error

AuthorizeDevice godoc @Summary Start a ChatGPT device-code login for the direct codex runtime @Tags external-agents @Param bot_id path string true "Bot ID" @Success 200 {object} CodexDeviceLoginAuthorizeResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Param id path string true "Bot Agent ID" @Router /bots/{bot_id}/agents/{id}/codex/login/device/authorize [post].

func (*ExternalAgentCodexHandler) CancelDevice added in v0.20.0

func (h *ExternalAgentCodexHandler) CancelDevice(c echo.Context) error

CancelDevice godoc @Summary Cancel a pending codex device-code login @Tags external-agents @Param bot_id path string true "Bot ID" @Param body body CodexDeviceLoginPollRequest true "Login reference" @Success 204 @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Param id path string true "Bot Agent ID" @Router /bots/{bot_id}/agents/{id}/codex/login/device/cancel [post].

func (*ExternalAgentCodexHandler) PollDevice added in v0.20.0

func (h *ExternalAgentCodexHandler) PollDevice(c echo.Context) error

PollDevice godoc @Summary Poll a pending codex device-code login @Tags external-agents @Param bot_id path string true "Bot ID" @Param body body CodexDeviceLoginPollRequest true "Login reference" @Success 200 {object} CodexDeviceLoginPollResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Param id path string true "Bot Agent ID" @Router /bots/{bot_id}/agents/{id}/codex/login/device/poll [post].

func (*ExternalAgentCodexHandler) Register added in v0.20.0

func (h *ExternalAgentCodexHandler) Register(e *echo.Echo)

Register registers codex runtime routes.

type FSArchiveRequest

type FSArchiveRequest struct {
	Paths []string `json:"paths"`
}

FSArchiveRequest is the body for downloading multiple files/directories as tar.gz.

type FSDeleteRequest

type FSDeleteRequest struct {
	Path      string `json:"path"`
	Recursive bool   `json:"recursive"`
}

FSDeleteRequest is the body for deleting a file or directory.

type FSExtractRequest

type FSExtractRequest struct {
	Path string `json:"path"`
}

FSExtractRequest is the body for extracting an archive in the workspace.

type FSExtractResponse

type FSExtractResponse struct {
	Destination string `json:"destination"`
	Files       int    `json:"files"`
	Directories int    `json:"directories"`
}

type FSFileInfo

type FSFileInfo struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	Mode    string `json:"mode"`
	ModTime string `json:"modTime"`
	IsDir   bool   `json:"isDir"`
}

type FSListResponse

type FSListResponse struct {
	Path    string       `json:"path"`
	Entries []FSFileInfo `json:"entries"`
}

type FSMkdirRequest

type FSMkdirRequest struct {
	Path string `json:"path"`
}

FSMkdirRequest is the body for creating a directory.

type FSReadResponse

type FSReadResponse struct {
	Path     string `json:"path"`
	Content  string `json:"content"`
	Size     int64  `json:"size"`
	Revision string `json:"revision"`
}

type FSRenameRequest

type FSRenameRequest struct {
	OldPath string `json:"oldPath"`
	NewPath string `json:"newPath"`
}

FSRenameRequest is the body for renaming / moving an entry.

type FSUploadResponse

type FSUploadResponse struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
}

type FSWriteRequest

type FSWriteRequest struct {
	Path             string  `json:"path"`
	Content          string  `json:"content"`
	ExpectedRevision *string `json:"expectedRevision,omitempty"`
}

FSWriteRequest is the body for creating / overwriting a file.

type FetchProvidersHandler

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

func NewFetchProvidersHandler

func NewFetchProvidersHandler(log *slog.Logger, service *fetchproviders.Service) *FetchProvidersHandler

func (*FetchProvidersHandler) Create

func (h *FetchProvidersHandler) Create(c echo.Context) error

Create godoc @Summary Create a fetch provider @Description Create a fetch provider configuration @Tags fetch-providers @Accept json @Produce json @Param request body fetchproviders.CreateRequest true "Fetch provider configuration" @Success 201 {object} fetchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /fetch-providers [post].

func (*FetchProvidersHandler) Delete

func (h *FetchProvidersHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete a fetch provider @Description Delete fetch provider by ID @Tags fetch-providers @Accept json @Produce json @Param id path string true "Provider ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /fetch-providers/{id} [delete].

func (*FetchProvidersHandler) Get

Get godoc @Summary Get a fetch provider @Description Get fetch provider by ID @Tags fetch-providers @Accept json @Produce json @Param id path string true "Provider ID" @Success 200 {object} fetchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /fetch-providers/{id} [get].

func (*FetchProvidersHandler) List

List godoc @Summary List fetch providers @Description List configured fetch providers @Tags fetch-providers @Accept json @Produce json @Param provider query string false "Provider filter (native)" @Success 200 {array} fetchproviders.GetResponse @Failure 500 {object} ErrorResponse @Router /fetch-providers [get].

func (*FetchProvidersHandler) ListMeta

func (h *FetchProvidersHandler) ListMeta(c echo.Context) error

ListMeta godoc @Summary List fetch provider metadata @Description List available fetch provider types and config schemas @Tags fetch-providers @Success 200 {array} fetchproviders.ProviderMeta @Router /fetch-providers/meta [get].

func (*FetchProvidersHandler) Register

func (h *FetchProvidersHandler) Register(e *echo.Echo)

func (*FetchProvidersHandler) Update

func (h *FetchProvidersHandler) Update(c echo.Context) error

Update godoc @Summary Update a fetch provider @Description Update fetch provider by ID @Tags fetch-providers @Accept json @Produce json @Param id path string true "Provider ID" @Param request body fetchproviders.UpdateRequest true "Updated configuration" @Success 200 {object} fetchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /fetch-providers/{id} [put].

type GetContainerMetricsResponse

type GetContainerMetricsResponse struct {
	Supported         bool                               `json:"supported"`
	Backend           string                             `json:"backend"`
	UnsupportedReason string                             `json:"unsupported_reason,omitempty"`
	Status            ContainerMetricsStatusResponse     `json:"status"`
	Metrics           ContainerMetricsPayloadResponse    `json:"metrics"`
	ResourceLimits    GetContainerResourceLimitsResponse `json:"resource_limits"`
	SampledAt         *time.Time                         `json:"sampled_at,omitempty"`
}

type GetContainerResourceLimitsResponse

type GetContainerResourceLimitsResponse struct {
	Desired          ContainerResourceLimitValuesResponse       `json:"desired"`
	Applied          ContainerResourceLimitValuesResponse       `json:"applied"`
	Capabilities     ContainerResourceLimitCapabilitiesResponse `json:"capabilities"`
	Observed         ContainerResourceLimitObservedResponse     `json:"observed"`
	Status           string                                     `json:"status"`
	RequiresRecreate bool                                       `json:"requires_recreate"`
	Backend          string                                     `json:"backend"`
	WorkspaceBackend string                                     `json:"workspace_backend"`
	RuntimeBackend   string                                     `json:"runtime_backend,omitempty"`
}

type GetContainerResponse

type GetContainerResponse struct {
	ContainerID      string    `json:"container_id"`
	WorkspaceBackend string    `json:"workspace_backend"`
	RuntimeBackend   string    `json:"runtime_backend,omitempty"`
	Image            string    `json:"image"`
	Status           string    `json:"status"`
	Namespace        string    `json:"namespace"`
	ContainerPath    string    `json:"container_path"`
	CDIDevices       []string  `json:"cdi_devices,omitempty"`
	TaskRunning      bool      `json:"task_running"`
	HasPreservedData bool      `json:"has_preserved_data"`
	Legacy           bool      `json:"legacy"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type HookEventInfo

type HookEventInfo struct {
	Name             string `json:"name"`
	RuntimeSupported bool   `json:"runtime_supported"`
}

type HookTestRequest

type HookTestRequest struct {
	Event     string             `json:"event"`
	SessionID string             `json:"session_id,omitempty"`
	ChatID    string             `json:"chat_id,omitempty"`
	Tool      *hooks.ToolPayload `json:"tool,omitempty"`
	Approval  map[string]any     `json:"approval,omitempty"`
	Turn      map[string]any     `json:"turn,omitempty"`
	Memory    map[string]any     `json:"memory,omitempty"`
	Channel   map[string]any     `json:"channel,omitempty"`
	Extra     map[string]any     `json:"extra,omitempty"`
	Error     string             `json:"error,omitempty"`
}

type HookTestResponse

type HookTestResponse struct {
	ConfigExists bool         `json:"config_exists"`
	Result       hooks.Result `json:"result"`
}

type HooksEventsResponse

type HooksEventsResponse struct {
	ConfigPath string          `json:"config_path"`
	Events     []HookEventInfo `json:"events"`
	Actions    []string        `json:"actions"`
	Decisions  []string        `json:"decisions"`
}

type HooksHandler

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

func NewHooksHandler

func NewHooksHandler(log *slog.Logger, botService *bots.Service, accountService *accounts.Service, service *hooks.Service, agent *native.Agent, provider bridge.Provider) *HooksHandler

func (*HooksHandler) Events

func (h *HooksHandler) Events(c echo.Context) error

Events godoc @Summary List supported bot hook events @Tags hooks @Param bot_id path string true "Bot ID" @Success 200 {object} HooksEventsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/hooks/events [get].

func (*HooksHandler) Register

func (h *HooksHandler) Register(e *echo.Echo)

func (*HooksHandler) Test

func (h *HooksHandler) Test(c echo.Context) error

Test godoc @Summary Run bot hooks for a synthetic event @Tags hooks @Param bot_id path string true "Bot ID" @Param payload body HookTestRequest true "Hook test payload" @Success 200 {object} HookTestResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/hooks/test [post].

type InstallRegistrySkillResponse

type InstallRegistrySkillResponse = supermarketclient.InstallSkillResponse

type ListSnapshotsResponse

type ListSnapshotsResponse struct {
	Snapshotter string         `json:"snapshotter"`
	Snapshots   []SnapshotInfo `json:"snapshots"`
}

type LocalChannelHandler

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

LocalChannelHandler handles local channel routes (WebUI / API) backed by bot history.

func NewLocalChannelHandler

func NewLocalChannelHandler(channelType channel.ChannelType, channelManager *channel.Manager, channelStore *channel.Store, routeHub *local.RouteHub, botService *bots.Service, accountService *accounts.Service, sessionService *sessionpkg.Service) *LocalChannelHandler

NewLocalChannelHandler creates a local channel handler.

func (*LocalChannelHandler) ExecuteQuickAction

func (h *LocalChannelHandler) ExecuteQuickAction(c echo.Context) error

ExecuteQuickAction godoc @Summary Execute a Web quick action @Description Runs a typed Web quick action such as help or skill.list and returns a command_result or command_error envelope. @Tags quick-actions @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body QuickActionExecuteRequest true "Quick action payload" @Success 200 {object} CommandEventResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/quick-actions/execute [post].

func (*LocalChannelHandler) HandleWebSocket

func (h *LocalChannelHandler) HandleWebSocket(c echo.Context) error

HandleWebSocket godoc @Summary WebSocket chat endpoint @Description Upgrade to WebSocket for bidirectional chat streaming with abort support. @Tags local-channel @Param bot_id path string true "Bot ID" @Success 101 {string} string "Switching Protocols" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/web/ws [get].

func (*LocalChannelHandler) PostMessage

func (h *LocalChannelHandler) PostMessage(c echo.Context) error

PostMessage godoc @Summary Send a message to a local channel @Description Post a user message (with optional attachments) through the local channel pipeline. @Tags local-channel @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body LocalChannelMessageRequest true "Message payload" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/web/messages [post].

func (*LocalChannelHandler) Register

func (h *LocalChannelHandler) Register(e *echo.Echo)

Register registers the local channel routes.

func (*LocalChannelHandler) SetAgentService

func (h *LocalChannelHandler) SetAgentService(service *application.Service)

SetAgentService configures the application service used for WebSocket turns.

func (*LocalChannelHandler) SetAuthTokenConfig

func (h *LocalChannelHandler) SetAuthTokenConfig(jwtSecret string, ttl time.Duration)

SetAuthTokenConfig configures runtime token minting for external-agent local WS streams.

func (*LocalChannelHandler) SetCommandHandler

func (h *LocalChannelHandler) SetCommandHandler(handler *command.Handler)

func (*LocalChannelHandler) SetMediaService

func (h *LocalChannelHandler) SetMediaService(svc *media.Service)

SetMediaService sets the media service for WebSocket attachment ingestion.

func (*LocalChannelHandler) SetRuntimeSkillResolver

func (h *LocalChannelHandler) SetRuntimeSkillResolver(resolver runtimeSkillResolver)

func (*LocalChannelHandler) SetSessionRuntime

func (h *LocalChannelHandler) SetSessionRuntime(admitter wsTurnAdmitter)

SetSessionRuntime installs the durable admission gate for turn-starting WebSocket messages.

func (*LocalChannelHandler) SetSpeechService

func (h *LocalChannelHandler) SetSpeechService(synth localSpeechSynthesizer, resolver localSpeechModelResolver)

SetSpeechService configures speech synthesis for handling speech_delta events.

func (*LocalChannelHandler) StreamMessages

func (h *LocalChannelHandler) StreamMessages(c echo.Context) error

StreamMessages godoc @Summary Subscribe to local channel events via SSE @Description Open a persistent SSE connection to receive real-time stream events for the given bot. @Tags local-channel @Produce text/event-stream @Param bot_id path string true "Bot ID" @Success 200 {string} string "SSE stream" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/web/stream [get].

type LocalChannelMessageRequest

type LocalChannelMessageRequest struct {
	Message           channel.Message `json:"message" validate:"required"`
	ModelID           string          `json:"model_id,omitempty"`
	ReasoningEffort   string          `json:"reasoning_effort,omitempty"`
	WorkspaceTargetID string          `json:"workspace_target_id,omitempty"`
}

LocalChannelMessageRequest is the request body for posting a local channel message.

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"` //nolint:gosec // intentional: JSON request field carrying a user-supplied credential
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"` //nolint:gosec // intentional: JWT is the purpose of this response field
	TokenType   string `json:"token_type"`
	ExpiresAt   string `json:"expires_at"`
	UserID      string `json:"user_id"`
	Role        string `json:"role"`
	DisplayName string `json:"display_name"`
	Username    string `json:"username"`
	Timezone    string `json:"timezone,omitempty"`
}

type MCPFederationGateway

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

func NewMCPFederationGateway

func NewMCPFederationGateway(log *slog.Logger, handler *ContainerdHandler) *MCPFederationGateway

func (*MCPFederationGateway) CallHTTPConnectionTool

func (g *MCPFederationGateway) CallHTTPConnectionTool(ctx context.Context, connection mcpgw.Connection, toolName string, args map[string]any) (map[string]any, error)

func (*MCPFederationGateway) CallSSEConnectionTool

func (g *MCPFederationGateway) CallSSEConnectionTool(ctx context.Context, connection mcpgw.Connection, toolName string, args map[string]any) (map[string]any, error)

func (*MCPFederationGateway) CallStdioConnectionTool

func (g *MCPFederationGateway) CallStdioConnectionTool(ctx context.Context, botID string, connection mcpgw.Connection, toolName string, args map[string]any) (map[string]any, error)

func (*MCPFederationGateway) ListHTTPConnectionTools

func (g *MCPFederationGateway) ListHTTPConnectionTools(ctx context.Context, connection mcpgw.Connection) ([]mcpgw.ToolDescriptor, error)

func (*MCPFederationGateway) ListSSEConnectionTools

func (g *MCPFederationGateway) ListSSEConnectionTools(ctx context.Context, connection mcpgw.Connection) ([]mcpgw.ToolDescriptor, error)

func (*MCPFederationGateway) ListStdioConnectionTools

func (g *MCPFederationGateway) ListStdioConnectionTools(ctx context.Context, botID string, connection mcpgw.Connection) ([]mcpgw.ToolDescriptor, error)

func (*MCPFederationGateway) SetOAuthService

func (g *MCPFederationGateway) SetOAuthService(svc *mcpgw.OAuthService)

SetOAuthService injects the OAuth service for token-based authentication.

type MCPHandler

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

func NewMCPHandler

func NewMCPHandler(log *slog.Logger, service *mcp.ConnectionService, botService *bots.Service, accountService *accounts.Service, fedGateway *MCPFederationGateway) *MCPHandler

func (*MCPHandler) BatchDelete

func (h *MCPHandler) BatchDelete(c echo.Context) error

BatchDelete godoc @Summary Batch delete MCP connections @Description Delete multiple MCP connections by IDs. @Tags mcp @Param payload body BatchDeleteRequest true "IDs to delete" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp-ops/batch-delete [post].

func (*MCPHandler) Create

func (h *MCPHandler) Create(c echo.Context) error

Create godoc @Summary Create MCP connection @Description Create a MCP connection for a bot @Tags mcp @Param payload body mcp.UpsertRequest true "MCP payload" @Success 201 {object} mcp.Connection @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp [post].

func (*MCPHandler) Delete

func (h *MCPHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete MCP connection @Description Delete a MCP connection by ID @Tags mcp @Param id path string true "MCP ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id} [delete].

func (*MCPHandler) Export

func (h *MCPHandler) Export(c echo.Context) error

Export godoc @Summary Export MCP connections @Description Export all MCP connections for a bot in standard mcpServers format. @Tags mcp @Success 200 {object} mcp.ExportResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp-ops/export [get].

func (*MCPHandler) Get

func (h *MCPHandler) Get(c echo.Context) error

Get godoc @Summary Get MCP connection @Description Get a MCP connection by ID @Tags mcp @Param id path string true "MCP ID" @Success 200 {object} mcp.Connection @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id} [get].

func (*MCPHandler) Import

func (h *MCPHandler) Import(c echo.Context) error

Import godoc @Summary Import MCP connections @Description Batch import MCP connections from standard mcpServers format. Existing connections (matched by name) get config updated with is_active preserved. New connections are created as active. @Tags mcp @Param payload body mcp.ImportRequest true "mcpServers dict" @Success 200 {object} mcp.ListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp-ops/import [put].

func (*MCPHandler) List

func (h *MCPHandler) List(c echo.Context) error

List godoc @Summary List MCP connections @Description List MCP connections for a bot @Tags mcp @Success 200 {object} mcp.ListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp [get].

func (*MCPHandler) Probe

func (h *MCPHandler) Probe(c echo.Context) error

Probe godoc @Summary Probe MCP connection @Description Probe a MCP connection to discover tools and verify connectivity @Tags mcp @Param id path string true "MCP connection ID" @Success 200 {object} ProbeResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/probe [post].

func (*MCPHandler) Register

func (h *MCPHandler) Register(e *echo.Echo)

func (*MCPHandler) Update

func (h *MCPHandler) Update(c echo.Context) error

Update godoc @Summary Update MCP connection @Description Update a MCP connection by ID @Tags mcp @Param id path string true "MCP ID" @Param payload body mcp.UpsertRequest true "MCP payload" @Success 200 {object} mcp.Connection @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id} [put].

type MCPOAuthHandler

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

MCPOAuthHandler handles OAuth-related endpoints for MCP connections.

func NewMCPOAuthHandler

func NewMCPOAuthHandler(log *slog.Logger, oauthService *mcp.OAuthService, connService *mcp.ConnectionService, botService *bots.Service, accountService *accounts.Service) *MCPOAuthHandler

func (*MCPOAuthHandler) Authorize

func (h *MCPOAuthHandler) Authorize(c echo.Context) error

Authorize godoc @Summary Start OAuth authorization flow @Description Generate PKCE and return authorization URL for the user to authorize @Tags mcp @Param id path string true "MCP connection ID" @Param payload body oauthAuthorizeRequest false "Optional client_id" @Success 200 {object} mcp.AuthorizeResult @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/oauth/authorize [post].

func (*MCPOAuthHandler) Callback

func (h *MCPOAuthHandler) Callback(c echo.Context) error

Callback godoc @Summary OAuth callback for MCP connections @Description Exchanges the authorization code and renders a small completion page @Tags mcp @Param code query string false "Authorization code" @Param state query string false "State parameter" @Param error query string false "OAuth error" @Param error_description query string false "OAuth error description" @Success 200 {string} string "HTML result page" @Failure 400 {string} string "HTML error page" @Router /oauth/mcp/callback [get].

func (*MCPOAuthHandler) Discover

func (h *MCPOAuthHandler) Discover(c echo.Context) error

Discover godoc @Summary Discover OAuth configuration for MCP server @Description Probe MCP server URL for OAuth requirements and discover authorization server metadata @Tags mcp @Param id path string true "MCP connection ID" @Param payload body oauthDiscoverRequest false "Optional URL override" @Success 200 {object} mcp.DiscoveryResult @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/oauth/discover [post].

func (*MCPOAuthHandler) Exchange

func (h *MCPOAuthHandler) Exchange(c echo.Context) error

Exchange godoc @Summary Exchange OAuth authorization code for tokens @Description Frontend callback page calls this to exchange the authorization code for access/refresh tokens @Tags mcp @Param payload body oauthExchangeRequest true "Authorization code and state" @Success 200 {object} map[string]bool @Failure 400 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/oauth/exchange [post].

func (*MCPOAuthHandler) Register

func (h *MCPOAuthHandler) Register(e *echo.Echo)

func (*MCPOAuthHandler) RevokeToken

func (h *MCPOAuthHandler) RevokeToken(c echo.Context) error

RevokeToken godoc @Summary Revoke OAuth tokens for MCP connection @Description Clears stored OAuth tokens @Tags mcp @Param id path string true "MCP connection ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/oauth/token [delete].

func (*MCPOAuthHandler) Status

func (h *MCPOAuthHandler) Status(c echo.Context) error

Status godoc @Summary Get OAuth status for MCP connection @Description Returns the current OAuth status including whether tokens are available @Tags mcp @Param id path string true "MCP connection ID" @Success 200 {object} mcp.OAuthStatus @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/mcp/{id}/oauth/status [get].

type MCPStdioRequest

type MCPStdioRequest struct {
	Name    string            `json:"name"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`
	Cwd     string            `json:"cwd"`
}

MCPStdioRequest represents a request to create an MCP stdio session.

type MCPStdioResponse

type MCPStdioResponse struct {
	ConnectionID string   `json:"connection_id"`
	URL          string   `json:"url"`
	Tools        []string `json:"tools,omitempty"`
}

MCPStdioResponse represents the response from creating an MCP stdio session.

type MemoryHandler

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

MemoryHandler handles memory CRUD operations scoped by bot.

func NewMemoryHandler

func NewMemoryHandler(log *slog.Logger, botService *bots.Service, accountService *accounts.Service) *MemoryHandler

NewMemoryHandler creates a MemoryHandler.

func (*MemoryHandler) ChatAdd

func (h *MemoryHandler) ChatAdd(c echo.Context) error

ChatAdd godoc @Summary Add memory @Description Add memory into the bot-shared namespace @Tags memory @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body memoryAddPayload true "Memory add payload" @Success 200 {object} adapters.SearchResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory [post].

func (*MemoryHandler) ChatCompact

func (h *MemoryHandler) ChatCompact(c echo.Context) error

ChatCompact godoc @Summary Compact memories @Description Consolidate memories by merging similar/redundant entries using LLM. @Description @Description **ratio** (required, range (0,1]): @Description - 0.8 = light compression, mostly dedup, keep ~80% of entries @Description - 0.5 = moderate compression, merge similar facts, keep ~50% @Description - 0.3 = aggressive compression, heavily consolidate, keep ~30% @Description @Description **decay_days** (optional): enable time decay — memories older than N days are treated as low priority and more likely to be merged/dropped. @Tags memory @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body memoryCompactPayload true "ratio (0,1] required; decay_days optional" @Success 200 {object} adapters.CompactResult @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 501 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/compact [post].

func (*MemoryHandler) ChatDelete

func (h *MemoryHandler) ChatDelete(c echo.Context) error

@Summary Delete memories @Description Delete specific memories by IDs, or delete all memories if no IDs are provided @Tags memory @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body memoryDeletePayload false "Optional: specify memory_ids to delete; if omitted, deletes all" @Success 200 {object} adapters.DeleteResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory [delete].

func (*MemoryHandler) ChatDeleteOne

func (h *MemoryHandler) ChatDeleteOne(c echo.Context) error

ChatDeleteOne godoc @Summary Delete a single memory @Description Delete a single memory by its ID @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Param id path string true "Memory ID" @Success 200 {object} adapters.DeleteResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/{id} [delete].

func (*MemoryHandler) ChatGetAll

func (h *MemoryHandler) ChatGetAll(c echo.Context) error

ChatGetAll godoc @Summary Get all memories @Description List all memories in the bot-shared namespace @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Param no_stats query bool false "Skip optional stats in memory search response" @Success 200 {object} adapters.SearchResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory [get].

func (*MemoryHandler) ChatGraph

func (h *MemoryHandler) ChatGraph(c echo.Context) error

ChatGraph returns the memory graph (nodes + derived edges) for the wiki visualization. The edge derivation uses the same migrate.PlanFromNodes path as the graph runtime/store, so the API view and recall graph do not drift.

@Summary Get memory graph @Description Get derived memory graph nodes and edges for a bot. @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} graphResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/graph [get].

func (*MemoryHandler) ChatIngest

func (h *MemoryHandler) ChatIngest(c echo.Context) error

ChatIngest godoc @Summary Ingest agent-authored memory markdown into the wiki store @Description Read /data/memory/*.md the bot (or its agent) wrote directly and upsert them as DB memory nodes, so they become searchable and survive the next derived-view rebuild. Idempotent (ON CONFLICT id DO UPDATE). @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} adapters.IngestResult @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/ingest [post].

func (*MemoryHandler) ChatRebuild

func (h *MemoryHandler) ChatRebuild(c echo.Context) error

ChatRebuild godoc @Summary Rebuild memories from filesystem @Description Read memory files from the workspace filesystem (source of truth) and restore missing entries to memory storage @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} adapters.RebuildResult @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/rebuild [post].

func (*MemoryHandler) ChatSearch

func (h *MemoryHandler) ChatSearch(c echo.Context) error

ChatSearch godoc @Summary Search memory @Description Search memory in the bot-shared namespace @Tags memory @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param payload body memorySearchPayload true "Memory search payload" @Success 200 {object} adapters.SearchResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/search [post].

func (*MemoryHandler) ChatStatus

func (h *MemoryHandler) ChatStatus(c echo.Context) error

ChatStatus godoc @Summary Get memory runtime status @Description Get the resolved memory runtime status for a bot, including index health and source counts @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} adapters.MemoryStatusResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/status [get].

func (*MemoryHandler) ChatUpdate

func (h *MemoryHandler) ChatUpdate(c echo.Context) error

ChatUpdate godoc @Summary Update a single memory by id @Description Update the body of an existing memory entry in place (preserves id, layer, metadata). Replaces the legacy client-side delete-then-add edit emulation. @Tags memory @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param memory_id path string true "Memory ID" @Param payload body memoryUpdatePayload true "Update request" @Success 200 {object} adapters.MemoryItem @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/{memory_id} [put].

func (*MemoryHandler) ChatUsage

func (h *MemoryHandler) ChatUsage(c echo.Context) error

ChatUsage godoc @Summary Get memory usage @Description Query the estimated storage usage of current memories @Tags memory @Produce json @Param bot_id path string true "Bot ID" @Success 200 {object} adapters.UsageResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} ErrorResponse @Router /bots/{bot_id}/memory/usage [get].

func (*MemoryHandler) Register

func (h *MemoryHandler) Register(e *echo.Echo)

Register registers chat-level memory routes.

func (*MemoryHandler) SetMemoryRegistry

func (h *MemoryHandler) SetMemoryRegistry(registry *memprovider.Registry)

SetMemoryRegistry sets the provider registry for provider-based memory operations.

func (*MemoryHandler) SetSettingsService

func (h *MemoryHandler) SetSettingsService(svc *settings.Service)

SetSettingsService sets the settings service for provider resolution.

type MemoryProvidersHandler

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

func NewMemoryProvidersHandler

func NewMemoryProvidersHandler(log *slog.Logger, service *memprovider.Service) *MemoryProvidersHandler

func (*MemoryProvidersHandler) Create

Create godoc @Summary Create a memory provider @Description Create a memory provider configuration @Tags memory-providers @Accept json @Produce json @Param request body adapters.ProviderCreateRequest true "Memory provider configuration" @Success 201 {object} adapters.ProviderGetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /memory-providers [post].

func (*MemoryProvidersHandler) Delete

Delete godoc @Summary Delete a memory provider @Description Delete memory provider by ID @Tags memory-providers @Param id path string true "Provider ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /memory-providers/{id} [delete].

func (*MemoryProvidersHandler) Get

Get godoc @Summary Get a memory provider @Description Get memory provider by ID @Tags memory-providers @Produce json @Param id path string true "Provider ID" @Success 200 {object} adapters.ProviderGetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /memory-providers/{id} [get].

func (*MemoryProvidersHandler) List

List godoc @Summary List memory providers @Description List configured memory providers @Tags memory-providers @Produce json @Success 200 {array} adapters.ProviderGetResponse @Failure 500 {object} ErrorResponse @Router /memory-providers [get].

func (*MemoryProvidersHandler) ListMeta

func (h *MemoryProvidersHandler) ListMeta(c echo.Context) error

ListMeta godoc @Summary List memory provider metadata @Description List available memory provider types and config schemas @Tags memory-providers @Success 200 {array} adapters.ProviderMeta @Router /memory-providers/meta [get].

func (*MemoryProvidersHandler) Register

func (h *MemoryProvidersHandler) Register(e *echo.Echo)

func (*MemoryProvidersHandler) Status

Status godoc @Summary Get memory provider status @Description Get runtime status data for a memory provider @Tags memory-providers @Produce json @Param id path string true "Provider ID" @Success 200 {object} adapters.ProviderStatusResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /memory-providers/{id}/status [get].

func (*MemoryProvidersHandler) Update

Update godoc @Summary Update a memory provider @Description Update memory provider by ID @Tags memory-providers @Accept json @Produce json @Param id path string true "Provider ID" @Param request body adapters.ProviderUpdateRequest true "Updated configuration" @Success 200 {object} adapters.ProviderGetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /memory-providers/{id} [put].

type MessageHandler

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

MessageHandler handles bot-scoped messaging endpoints.

func NewMessageHandler

func NewMessageHandler(log *slog.Logger, messageService messagepkg.Service, sessionService *session.Service, botService *bots.Service, accountService *accounts.Service, eventSubscribers ...messageevent.Subscriber) *MessageHandler

NewMessageHandler creates a MessageHandler.

func (*MessageHandler) DeleteMessages

func (h *MessageHandler) DeleteMessages(c echo.Context) error

DeleteMessages godoc @Summary Delete all bot history messages @Description Clear all persisted bot-level history messages @Tags messages @Produce json @Param bot_id path string true "Bot ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/messages [delete].

func (*MessageHandler) ListMessages

func (h *MessageHandler) ListMessages(c echo.Context) error

ListMessages godoc @Summary List session history messages @Description List messages for one session with optional pagination @Tags messages @Produce json @Param bot_id path string true "Bot ID" format(uuid) @Param session_id query string true "Session ID" format(uuid) @Param limit query int false "Limit" default(30) minimum(1) maximum(100) @Param before query string false "Before" @Param before_message_id query string false "Message ID cursor before which to page" format(uuid) @Success 200 {object} UIMessageListResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/messages [get].

func (*MessageHandler) LocateMessage

func (h *MessageHandler) LocateMessage(c echo.Context) error

LocateMessage godoc @Summary Locate a bot history message @Description Locate a session message by external message ID and return nearby UI turns @Tags messages @Produce json @Param bot_id path string true "Bot ID" format(uuid) @Param session_id query string true "Session ID" format(uuid) @Param external_message_id query string true "External message ID" @Param before query int false "Messages before target" default(30) minimum(0) maximum(100) @Param after query int false "Messages after target" default(30) minimum(0) maximum(100) @Success 200 {object} UILocateMessageResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/messages/locate [get].

func (*MessageHandler) Register

func (h *MessageHandler) Register(e *echo.Echo)

Register registers all conversation routes.

func (*MessageHandler) ServeMedia

func (h *MessageHandler) ServeMedia(c echo.Context) error

ServeMedia streams a media asset by bot_id + content_hash with read-access authorization.

func (*MessageHandler) SetBackgroundManager

func (h *MessageHandler) SetBackgroundManager(mgr *background.Manager)

func (*MessageHandler) SetCompactionActivity added in v0.20.0

func (h *MessageHandler) SetCompactionActivity(activity interface{ ActiveSessions(string) []string })

func (*MessageHandler) SetMediaService

func (h *MessageHandler) SetMediaService(svc *media.Service)

SetMediaService sets the optional media service for asset serving.

func (*MessageHandler) SetProjectionCache added in v0.20.0

func (h *MessageHandler) SetProjectionCache(cache messageProjectionCache)

func (*MessageHandler) SetRuntimeResetService

func (h *MessageHandler) SetRuntimeResetService(resets messageRuntimeResetService)

func (*MessageHandler) SetSessionActivityInvalidationSupported added in v0.20.0

func (h *MessageHandler) SetSessionActivityInvalidationSupported(supported bool)

func (*MessageHandler) SetToolApprovalService

func (h *MessageHandler) SetToolApprovalService(svc *toolapproval.Service)

func (*MessageHandler) SetUserInputService

func (h *MessageHandler) SetUserInputService(svc *userinput.Service)

func (*MessageHandler) StreamSessionsActivityEvents

func (h *MessageHandler) StreamSessionsActivityEvents(c echo.Context) error

StreamSessionsActivityEvents godoc @Summary Stream bot-wide sessions activity @Description Lightweight SSE for sidebar live-sort. Carries only session @Description identifiers and minimal metadata (touched timestamps, titles). @Description Never includes message bodies. Filters out internal session @Description types such as schedule and subagent. @Tags messages @Produce text/event-stream @Param bot_id path string true "Bot ID" @Success 200 {string} string "SSE stream" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/sessions/events [get].

type ModelTokenUsage

type ModelTokenUsage struct {
	ModelID      string `json:"model_id"`
	ModelSlug    string `json:"model_slug"`
	ModelName    string `json:"model_name"`
	ProviderName string `json:"provider_name"`
	InputTokens  int64  `json:"input_tokens"`
	OutputTokens int64  `json:"output_tokens"`
}

ModelTokenUsage represents aggregated token usage for a single model.

type ModelsHandler

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

func NewModelsHandler

func NewModelsHandler(log *slog.Logger, service *models.Service, providerSvc *providers.Service) *ModelsHandler

func (*ModelsHandler) Count

func (h *ModelsHandler) Count(c echo.Context) error

Count godoc @Summary Get model count @Description Get the total count of models, optionally filtered by type @Tags models @Param type query string false "Model type (chat, embedding)" @Success 200 {object} models.CountResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/count [get].

func (*ModelsHandler) Create

func (h *ModelsHandler) Create(c echo.Context) error

Create godoc @Summary Create a new model @Description Create a new model configuration @Tags models @Param payload body models.AddRequest true "Model configuration" @Success 201 {object} models.AddResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models [post].

func (*ModelsHandler) DeleteByID

func (h *ModelsHandler) DeleteByID(c echo.Context) error

DeleteByID godoc @Summary Delete model by internal ID @Description Delete a model configuration by its internal UUID @Tags models @Param id path string true "Model internal ID (UUID)" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/{id} [delete].

func (*ModelsHandler) DeleteByModelID

func (h *ModelsHandler) DeleteByModelID(c echo.Context) error

DeleteByModelID godoc @Summary Delete model by model ID @Description Delete a model configuration by its model_id field (e.g., gpt-4) @Tags models @Param modelId path string true "Model ID (e.g., gpt-4)" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/model/{modelId} [delete].

func (*ModelsHandler) GetByID

func (h *ModelsHandler) GetByID(c echo.Context) error

GetByID godoc @Summary Get model by internal ID @Description Get a model configuration by its internal UUID @Tags models @Param id path string true "Model internal ID (UUID)" @Success 200 {object} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/{id} [get].

func (*ModelsHandler) GetByModelID

func (h *ModelsHandler) GetByModelID(c echo.Context) error

GetByModelID godoc @Summary Get model by model ID @Description Get a model configuration by its model_id field (e.g., gpt-4) @Tags models @Param modelId path string true "Model ID (e.g., gpt-4)" @Success 200 {object} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/model/{modelId} [get].

func (*ModelsHandler) List

func (h *ModelsHandler) List(c echo.Context) error

List godoc @Summary List all models @Description Get a list of all configured models, optionally filtered by type or provider client type @Tags models @Param type query string false "Model type (chat, embedding)" @Param client_type query string false "Provider client type (openai-responses, openai-completions, anthropic-messages, google-generative-ai)" @Success 200 {array} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models [get].

func (*ModelsHandler) Register

func (h *ModelsHandler) Register(e *echo.Echo)

func (*ModelsHandler) Test

func (h *ModelsHandler) Test(c echo.Context) error

Test godoc @Summary Test model connectivity @Description Probe a model's provider endpoint using the model's real model_id and client_type to verify configuration @Tags models @Accept json @Produce json @Param id path string true "Model internal ID (UUID)" @Success 200 {object} models.TestResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/{id}/test [post].

func (*ModelsHandler) UpdateByID

func (h *ModelsHandler) UpdateByID(c echo.Context) error

UpdateByID godoc @Summary Update model by internal ID @Description Update a model configuration by its internal UUID @Tags models @Param id path string true "Model internal ID (UUID)" @Param payload body models.UpdateRequest true "Updated model configuration" @Success 200 {object} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/{id} [put].

func (*ModelsHandler) UpdateByModelID

func (h *ModelsHandler) UpdateByModelID(c echo.Context) error

UpdateByModelID godoc @Summary Update model by model ID @Description Update a model configuration by its model_id field (e.g., gpt-4) @Tags models @Param modelId path string true "Model ID (e.g., gpt-4)" @Param payload body models.UpdateRequest true "Updated model configuration" @Success 200 {object} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /models/model/{modelId} [put].

type NetworkHandler

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

func NewNetworkHandler

func NewNetworkHandler(log *slog.Logger, service *netctl.Service, botService *bots.Service, accountService *accounts.Service) *NetworkHandler

func (*NetworkHandler) ExecuteAction

func (h *NetworkHandler) ExecuteAction(c echo.Context) error

func (*NetworkHandler) ListMeta

func (h *NetworkHandler) ListMeta(c echo.Context) error

func (*NetworkHandler) ListNodes

func (h *NetworkHandler) ListNodes(c echo.Context) error

func (*NetworkHandler) Register

func (h *NetworkHandler) Register(e *echo.Echo)

func (*NetworkHandler) Status

func (h *NetworkHandler) Status(c echo.Context) error

type PingHandler

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

func NewPingHandler

func NewPingHandler(log *slog.Logger, rc *boot.RuntimeConfig, cfg config.Config) *PingHandler

func (*PingHandler) Ping

func (h *PingHandler) Ping(c echo.Context) error

Ping godoc @Summary Health check with server capabilities @Tags system @Success 200 {object} PingResponse @Router /ping [get].

func (*PingHandler) PingHead

func (*PingHandler) PingHead(c echo.Context) error

func (*PingHandler) Register

func (h *PingHandler) Register(e *echo.Echo)

type PingResponse

type PingResponse struct {
	Status            string `json:"status"`
	ContainerBackend  string `json:"container_backend"`
	SnapshotSupported bool   `json:"snapshot_supported"`
	Connectors        bool   `json:"connectors"`
	Version           string `json:"version"`
	CommitHash        string `json:"commit_hash"`
}

type ProbeResponse

type ProbeResponse struct {
	Status       string               `json:"status"`
	Tools        []mcp.ToolDescriptor `json:"tools"`
	Error        string               `json:"error,omitempty"`
	AuthRequired bool                 `json:"auth_required,omitempty"`
}

ProbeResponse is the response for a probe operation.

type ProviderOAuthHandler

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

func NewProviderOAuthHandler

func NewProviderOAuthHandler(service *providers.Service) *ProviderOAuthHandler

func (*ProviderOAuthHandler) Authorize

func (h *ProviderOAuthHandler) Authorize(c echo.Context) error

Authorize godoc @Summary Start OAuth2 authorization for an LLM provider @Tags providers-oauth @Param id path string true "Provider ID (UUID)" @Success 200 {object} providers.OAuthAuthorizeResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /providers/{id}/oauth/authorize [get].

func (*ProviderOAuthHandler) Callback

func (h *ProviderOAuthHandler) Callback(c echo.Context) error

Callback godoc @Summary OAuth2 callback for LLM providers @Tags providers-oauth @Param code query string true "Authorization code" @Param state query string true "State parameter" @Success 200 {string} string "HTML success page" @Failure 400 {object} ErrorResponse @Router /providers/oauth/callback [get].

func (*ProviderOAuthHandler) Poll

Poll godoc @Summary Poll OAuth device authorization for an LLM provider @Tags providers-oauth @Param id path string true "Provider ID (UUID)" @Success 200 {object} providers.OAuthStatus @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /providers/{id}/oauth/poll [post].

func (*ProviderOAuthHandler) Register

func (h *ProviderOAuthHandler) Register(e *echo.Echo)

func (*ProviderOAuthHandler) Revoke

func (h *ProviderOAuthHandler) Revoke(c echo.Context) error

Revoke godoc @Summary Revoke stored OAuth2 tokens for an LLM provider @Tags providers-oauth @Param id path string true "Provider ID (UUID)" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /providers/{id}/oauth/token [delete].

func (*ProviderOAuthHandler) Status

func (h *ProviderOAuthHandler) Status(c echo.Context) error

Status godoc @Summary Get OAuth2 status for an LLM provider @Tags providers-oauth @Param id path string true "Provider ID (UUID)" @Success 200 {object} providers.OAuthStatus @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /providers/{id}/oauth/status [get].

type ProviderTemplatesHandler

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

func NewProviderTemplatesHandler

func NewProviderTemplatesHandler(service *providertemplates.Service) *ProviderTemplatesHandler

func (*ProviderTemplatesHandler) Get

Get godoc @Summary Get a provider template @Description Get an active global provider template and its model catalog @Tags provider-templates @Produce json @Param id path string true "Provider template ID" @Success 200 {object} providertemplates.GetResponse @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /provider-templates/{id} [get].

func (*ProviderTemplatesHandler) List

List godoc @Summary List provider templates @Description List active global provider templates and whether the current tenant has configured each template @Tags provider-templates @Produce json @Param domain query string false "Template domain (llm, speech, transcription, video)" @Success 200 {array} providertemplates.GetResponse @Failure 400 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /provider-templates [get].

func (*ProviderTemplatesHandler) Register

func (h *ProviderTemplatesHandler) Register(e *echo.Echo)

type ProvidersHandler

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

func NewProvidersHandler

func NewProvidersHandler(log *slog.Logger, service *providers.Service, modelsService *models.Service) *ProvidersHandler

func (*ProvidersHandler) Count

func (h *ProvidersHandler) Count(c echo.Context) error

Count godoc @Summary Count providers @Description Get the total count of providers @Tags providers @Accept json @Produce json @Success 200 {object} providers.CountResponse @Failure 500 {object} ErrorResponse @Router /providers/count [get].

func (*ProvidersHandler) Create

func (h *ProvidersHandler) Create(c echo.Context) error

Create godoc @Summary Create a new LLM provider @Description Create a new LLM provider configuration @Tags providers @Accept json @Produce json @Param request body providers.CreateRequest true "Provider configuration" @Success 201 {object} providers.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers [post].

func (*ProvidersHandler) CreateFromTemplate

func (h *ProvidersHandler) CreateFromTemplate(c echo.Context) error

CreateFromTemplate godoc @Summary Create a provider from a global template @Description Materialize a tenant-owned provider only when the user saves a template configuration @Tags providers @Accept json @Produce json @Param request body providers.CreateFromTemplateRequest true "Provider template configuration" @Success 201 {object} providers.GetResponse @Failure 400 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /providers/from-template [post].

func (*ProvidersHandler) Delete

func (h *ProvidersHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete provider @Description Delete a provider configuration @Tags providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id} [delete].

func (*ProvidersHandler) Get

func (h *ProvidersHandler) Get(c echo.Context) error

Get godoc @Summary Get provider by ID @Description Get a provider configuration by its ID @Tags providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} providers.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id} [get].

func (*ProvidersHandler) GetByName

func (h *ProvidersHandler) GetByName(c echo.Context) error

GetByName godoc @Summary Get provider by name @Description Get a provider configuration by its name @Tags providers @Accept json @Produce json @Param name path string true "Provider name" @Success 200 {object} providers.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/name/{name} [get].

func (*ProvidersHandler) ImportModels

func (h *ProvidersHandler) ImportModels(c echo.Context) error

ImportModels godoc @Summary Import models from provider @Description Fetch models from provider and import them @Tags providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Param request body providers.ImportModelsRequest false "Explicit defaults for unknown custom chat models" @Success 200 {object} providers.ImportModelsResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id}/import-models [post].

func (*ProvidersHandler) List

func (h *ProvidersHandler) List(c echo.Context) error

List godoc @Summary List all LLM providers @Description Get a list of all configured LLM providers @Tags providers @Accept json @Produce json @Success 200 {array} providers.GetResponse @Failure 500 {object} ErrorResponse @Router /providers [get].

func (*ProvidersHandler) ListModelsByProvider

func (h *ProvidersHandler) ListModelsByProvider(c echo.Context) error

ListModelsByProvider godoc @Summary List provider models @Description Get models for a provider by id, optionally filtered by type @Tags providers @Param id path string true "Provider ID (UUID)" @Param type query string false "Model type (chat, embedding)" @Success 200 {array} models.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id}/models [get].

func (*ProvidersHandler) Register

func (h *ProvidersHandler) Register(e *echo.Echo)

func (*ProvidersHandler) Test

func (h *ProvidersHandler) Test(c echo.Context) error

Test godoc @Summary Test provider connectivity @Description Probe a provider's base URL to check reachability, supported client types, and embedding support @Tags providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} providers.TestResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id}/test [post].

func (*ProvidersHandler) Update

func (h *ProvidersHandler) Update(c echo.Context) error

Update godoc @Summary Update provider @Description Update an existing provider configuration @Tags providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Param request body providers.UpdateRequest true "Updated provider configuration" @Success 200 {object} providers.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /providers/{id} [put].

type PublicMediaHandler

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

func NewConfiguredPublicMediaHandler

func NewConfiguredPublicMediaHandler(log *slog.Logger, cfg config.Config, mediaService *media.Service) *PublicMediaHandler

func NewPublicMediaHandler

func NewPublicMediaHandler(log *slog.Logger, mediaService *media.Service, signingSecret string) *PublicMediaHandler

func (*PublicMediaHandler) Register

func (h *PublicMediaHandler) Register(e *echo.Echo)

func (*PublicMediaHandler) ServeOriginal

func (h *PublicMediaHandler) ServeOriginal(c echo.Context) error

func (*PublicMediaHandler) ServePreview

func (h *PublicMediaHandler) ServePreview(c echo.Context) error

type QuickActionExecuteRequest

type QuickActionExecuteRequest struct {
	ActionID      string         `json:"action_id"`
	Params        map[string]any `json:"params,omitempty"`
	InvocationID  string         `json:"invocation_id,omitempty"`
	ComposerScope string         `json:"composer_scope,omitempty"`
	SessionID     string         `json:"session_id,omitempty"`
}

type RefreshResponse

type RefreshResponse struct {
	AccessToken string `json:"access_token"` //nolint:gosec // intentional: JWT is the purpose of this response field
	TokenType   string `json:"token_type"`
	ExpiresAt   string `json:"expires_at"`
}

type RollbackRequest

type RollbackRequest struct {
	Version int `json:"version"`
}

type RuntimeCommandRequest added in v0.20.0

type RuntimeCommandRequest struct {
	Command string `json:"command"`
}

type RuntimeCommandResponse added in v0.20.0

type RuntimeCommandResponse = turn.RuntimeCommandResult

type RuntimeConnectHandler

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

func NewRuntimeConnectHandler

func NewRuntimeConnectHandler(log *slog.Logger, service *userruntime.Service, pipe userruntime.Pipe) *RuntimeConnectHandler

func (*RuntimeConnectHandler) Connect

func (h *RuntimeConnectHandler) Connect(c echo.Context) error

func (*RuntimeConnectHandler) Register

func (h *RuntimeConnectHandler) Register(e *echo.Echo)

type RuntimeGoalRequest added in v0.20.0

type RuntimeGoalRequest struct {
	Action string `json:"action" enums:"pause,clear"`
}

type RuntimeGoalResponse added in v0.20.0

type RuntimeGoalResponse struct {
	Goal *external.Goal `json:"goal"`
}

RuntimeGoalResponse keeps an absent goal distinct from a failed query.

type RuntimeModeRequest added in v0.20.0

type RuntimeModeRequest struct {
	ModeID string `json:"mode_id"`
	// Omitted means permission; plan changes the independent planning mode.
	ModeKind string `json:"mode_kind,omitempty" enums:"permission,plan"`
}

type SafeSkillsResponse

type SafeSkillsResponse struct {
	Skills []skillset.SafeCatalogItem `json:"skills"`
}

type ScheduleHandler

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

func NewScheduleHandler

func NewScheduleHandler(log *slog.Logger, service *schedule.Service, botService *bots.Service, accountService *accounts.Service) *ScheduleHandler

func (*ScheduleHandler) Create

func (h *ScheduleHandler) Create(c echo.Context) error

Create godoc @Summary Create schedule @Description Create a schedule for current user @Tags schedule @Param bot_id path string true "Bot ID" @Param payload body schedule.CreateRequest true "Schedule payload" @Success 201 {object} schedule.Schedule @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule [post].

func (*ScheduleHandler) Delete

func (h *ScheduleHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete schedule @Description Delete a schedule by ID @Tags schedule @Param bot_id path string true "Bot ID" @Param id path string true "Schedule ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/{id} [delete].

func (*ScheduleHandler) DeleteLogs

func (h *ScheduleHandler) DeleteLogs(c echo.Context) error

DeleteLogs godoc @Summary Delete schedule logs @Description Delete all schedule execution logs for a bot @Tags schedule @Param bot_id path string true "Bot ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/logs [delete].

func (*ScheduleHandler) Get

func (h *ScheduleHandler) Get(c echo.Context) error

Get godoc @Summary Get schedule @Description Get a schedule by ID @Tags schedule @Param bot_id path string true "Bot ID" @Param id path string true "Schedule ID" @Success 200 {object} schedule.Schedule @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/{id} [get].

func (*ScheduleHandler) List

func (h *ScheduleHandler) List(c echo.Context) error

List godoc @Summary List schedules @Description List schedules for current user @Tags schedule @Param bot_id path string true "Bot ID" @Success 200 {object} schedule.ListResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule [get].

func (*ScheduleHandler) ListLogs

func (h *ScheduleHandler) ListLogs(c echo.Context) error

ListLogs godoc @Summary List schedule logs @Description List schedule execution logs for a bot @Tags schedule @Param bot_id path string true "Bot ID" @Param limit query int false "Limit" default(50) @Param offset query int false "Offset" default(0) @Success 200 {object} schedule.ListLogsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/logs [get].

func (*ScheduleHandler) ListLogsBySchedule

func (h *ScheduleHandler) ListLogsBySchedule(c echo.Context) error

ListLogsBySchedule godoc @Summary List schedule logs by schedule @Description List execution logs for a specific schedule @Tags schedule @Param bot_id path string true "Bot ID" @Param id path string true "Schedule ID" @Param limit query int false "Limit" default(50) @Param offset query int false "Offset" default(0) @Success 200 {object} schedule.ListLogsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/{id}/logs [get].

func (*ScheduleHandler) Register

func (h *ScheduleHandler) Register(e *echo.Echo)

func (*ScheduleHandler) Update

func (h *ScheduleHandler) Update(c echo.Context) error

Update godoc @Summary Update schedule @Description Update a schedule by ID @Tags schedule @Param bot_id path string true "Bot ID" @Param id path string true "Schedule ID" @Param payload body schedule.UpdateRequest true "Schedule payload" @Success 200 {object} schedule.Schedule @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/schedule/{id} [put].

type SearchProvidersHandler

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

func NewSearchProvidersHandler

func NewSearchProvidersHandler(log *slog.Logger, service *searchproviders.Service) *SearchProvidersHandler

func (*SearchProvidersHandler) Create

Create godoc @Summary Create a search provider @Description Create a search provider configuration @Tags search-providers @Accept json @Produce json @Param request body searchproviders.CreateRequest true "Search provider configuration" @Success 201 {object} searchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /search-providers [post].

func (*SearchProvidersHandler) Delete

Delete godoc @Summary Delete a search provider @Description Delete search provider by ID @Tags search-providers @Accept json @Produce json @Param id path string true "Provider ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /search-providers/{id} [delete].

func (*SearchProvidersHandler) Get

Get godoc @Summary Get a search provider @Description Get search provider by ID @Tags search-providers @Accept json @Produce json @Param id path string true "Provider ID" @Success 200 {object} searchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /search-providers/{id} [get].

func (*SearchProvidersHandler) List

List godoc @Summary List search providers @Description List configured search providers @Tags search-providers @Accept json @Produce json @Param provider query string false "Provider filter (brave)" @Success 200 {array} searchproviders.GetResponse @Failure 500 {object} ErrorResponse @Router /search-providers [get].

func (*SearchProvidersHandler) ListMeta

func (h *SearchProvidersHandler) ListMeta(c echo.Context) error

ListMeta godoc @Summary List search provider metadata @Description List available search provider types and config schemas @Tags search-providers @Success 200 {array} searchproviders.ProviderMeta @Router /search-providers/meta [get].

func (*SearchProvidersHandler) Register

func (h *SearchProvidersHandler) Register(e *echo.Echo)

func (*SearchProvidersHandler) Update

Update godoc @Summary Update a search provider @Description Update search provider by ID @Tags search-providers @Accept json @Produce json @Param id path string true "Provider ID" @Param request body searchproviders.UpdateRequest true "Updated configuration" @Success 200 {object} searchproviders.GetResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /search-providers/{id} [put].

type SessionHandler

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

SessionHandler handles bot session CRUD endpoints.

func NewSessionHandler

func NewSessionHandler(log *slog.Logger, sessionService *session.Service, runtimes sessionRuntimeServices, botService *bots.Service, accountService *accounts.Service) *SessionHandler

NewSessionHandler creates a SessionHandler.

func (*SessionHandler) ControlRuntimeGoal added in v0.20.0

func (h *SessionHandler) ControlRuntimeGoal(c echo.Context) error

ControlRuntimeGoal godoc @Summary Pause or clear a runtime-owned goal @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param payload body RuntimeGoalRequest true "Goal action" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/runtime-controls/goal [post].

func (*SessionHandler) CreateSession

func (h *SessionHandler) CreateSession(c echo.Context) error

CreateSession godoc @Summary Create a new chat session @Tags sessions @Param bot_id path string true "Bot ID" @Param body body createSessionRequest true "Session data" @Success 201 {object} session.Thread @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/sessions [post].

func (*SessionHandler) DeleteSession

func (h *SessionHandler) DeleteSession(c echo.Context) error

DeleteSession godoc @Summary Soft-delete a session @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 204 @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/sessions/{session_id} [delete].

func (*SessionHandler) ExecuteRuntimeCommand added in v0.20.0

func (h *SessionHandler) ExecuteRuntimeCommand(c echo.Context) error

ExecuteRuntimeCommand godoc @Summary Execute a read or operation runtime command @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param payload body RuntimeCommandRequest true "Runtime command" @Success 200 {object} RuntimeCommandResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/runtime-controls/commands [post].

func (*SessionHandler) ForkSession

func (h *SessionHandler) ForkSession(c echo.Context) error

ForkSession godoc @Summary Fork a chat session from an assistant reply @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Source session ID" @Param body body forkSessionRequest true "Fork source turn" @Success 201 {object} session.Thread @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Router /bots/{bot_id}/sessions/{session_id}/fork [post].

func (*SessionHandler) GetRuntimeControls added in v0.20.0

func (h *SessionHandler) GetRuntimeControls(c echo.Context) error

GetRuntimeControls godoc @Summary Get session runtime controls @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} external.Controls @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/runtime-controls [get].

func (*SessionHandler) GetRuntimeGoal added in v0.20.0

func (h *SessionHandler) GetRuntimeGoal(c echo.Context) error

GetRuntimeGoal godoc @Summary Get the runtime-owned goal @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} RuntimeGoalResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/runtime-controls/goal [get].

func (*SessionHandler) GetSession

func (h *SessionHandler) GetSession(c echo.Context) error

GetSession godoc @Summary Get a session by ID @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} session.Thread @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/sessions/{session_id} [get].

func (*SessionHandler) ListSessions

func (h *SessionHandler) ListSessions(c echo.Context) error

ListSessions godoc @Summary List bot sessions @Tags sessions @Param bot_id path string true "Bot ID" @Param types query string false "Comma-separated session types to include. Defaults to user-facing types (chat,discuss,acp_agent), or subagent when parent_session_id is set." @Param parent_session_id query string false "Only include child sessions under this parent session." @Param workdir_id query string false "Only include sessions bound to this workdir. The literal none selects sessions with no workdir." @Param limit query int false "Page size (1..200). Defaults to 50." @Param cursor query string false "Opaque cursor returned as next_cursor on a previous page." @Success 200 {object} listSessionsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/sessions [get].

func (*SessionHandler) ModelPreferenceSeed added in v0.20.0

func (h *SessionHandler) ModelPreferenceSeed(c echo.Context) error

ModelPreferenceSeed godoc @Summary Welcome composer model seed @Tags sessions @Param bot_id path string true "Bot ID" @Success 200 {object} modelPreferenceSeedResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /bots/{bot_id}/sessions/model-preference-seed [get].

func (*SessionHandler) Register

func (h *SessionHandler) Register(e *echo.Echo)

Register registers session routes.

func (*SessionHandler) SetAgentRuntimeService added in v0.20.0

func (h *SessionHandler) SetAgentRuntimeService(service sessionAgentRuntimeService)

SetAgentRuntimeService installs the agent application service used for external-runtime fork preparation and active-run shutdown.

func (*SessionHandler) SetBotAgents

func (h *SessionHandler) SetBotAgents(service *botagents.Service)

func (*SessionHandler) SetModelPreferenceService added in v0.20.0

func (h *SessionHandler) SetModelPreferenceService(svc modelPreferenceService)

SetModelPreferenceService installs the agent-side preference write path.

func (*SessionHandler) SetProjectionCache added in v0.20.0

func (h *SessionHandler) SetProjectionCache(cache sessionProjectionCache)

func (*SessionHandler) SetRuntimeMode added in v0.20.0

func (h *SessionHandler) SetRuntimeMode(c echo.Context) error

SetRuntimeMode godoc @Summary Set session runtime permission or planning mode @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param payload body RuntimeModeRequest true "Permission mode" @Success 200 {object} external.ModeState @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/runtime-controls/mode [patch].

func (*SessionHandler) SetThreadEnricher

func (h *SessionHandler) SetThreadEnricher(enricher threadEnricher)

SetThreadEnricher installs the Channel-owned route projection used by list responses. Thread persistence stays independent from the route table.

func (*SessionHandler) SetWorkdirService

func (h *SessionHandler) SetWorkdirService(workdirs sessionWorkdirService)

SetWorkdirService installs the workdir domain used to validate workdir bindings at session creation.

func (*SessionHandler) UpdateSession

func (h *SessionHandler) UpdateSession(c echo.Context) error

UpdateSession godoc @Summary Update a session @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body updateSessionRequest true "Fields to update" @Success 200 {object} session.Thread @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id} [patch].

type SessionInfoHandler

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

func NewSessionInfoHandler

func NewSessionInfoHandler(log *slog.Logger, queries dbstore.Queries, botService *bots.Service, accountService *accounts.Service, modelsService *models.Service, settingsService *settings.Service) *SessionInfoHandler

func (*SessionInfoHandler) GetSessionContextLifecycle

func (h *SessionInfoHandler) GetSessionContextLifecycle(c echo.Context) error

GetSessionContextLifecycle godoc @Summary Get session context lifecycle @Description List run-keyed context lifecycle snapshots for a chat session, newest first, with page-scoped aggregate totals (cache read/write tokens, drop reasons, mutation kinds). Aggregates cover only the returned page; has_more reports older turns. Sessions predating run lifecycle persistence fall back to legacy assistant metadata (legacy_source). Per-fragment selection_decisions are never returned; each turn's selection trace carries their rolled-up counts and token costs @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param limit query int false "Maximum number of turns to return (default 50, max 200)" @Success 200 {object} ContextLifecycleResponse @Failure 400 {object} apperror.Problem @Failure 401 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/context-lifecycle [get].

func (*SessionInfoHandler) GetSessionInfo

func (h *SessionInfoHandler) GetSessionInfo(c echo.Context) error

GetSessionInfo godoc @Summary Get session info @Description Get aggregated info for a chat session including message count, context usage, cache stats, and used skills @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param model_id query string false "Optional model UUID override for context window" @Success 200 {object} SessionInfoResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/sessions/{session_id}/status [get].

func (*SessionInfoHandler) Register

func (h *SessionInfoHandler) Register(e *echo.Echo)

type SessionInfoResponse

type SessionInfoResponse struct {
	MessageCount int64        `json:"message_count"`
	ContextUsage ContextUsage `json:"context_usage"`
	CacheStats   CacheStats   `json:"cache_stats"`
	Skills       []string     `json:"skills"`
}

type SessionQueueHandler added in v0.20.0

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

SessionQueueHandler exposes the live steer and follow-up queues. It owns authorization and request/response mapping only; transactions and queue semantics live in the application service.

func NewSessionQueueHandler added in v0.20.0

func NewSessionQueueHandler(queries dbstore.Queries, agentService *application.Service, botService *bots.Service, accountService *accounts.Service) *SessionQueueHandler

func (*SessionQueueHandler) CancelFollowUp added in v0.20.0

func (h *SessionQueueHandler) CancelFollowUp(c echo.Context) error

CancelFollowUp godoc @Summary Cancel an accepted follow-up input @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param item_id path string true "Queue item ID" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue/{item_id} [delete].

func (*SessionQueueHandler) CancelSteer added in v0.20.0

func (h *SessionQueueHandler) CancelSteer(c echo.Context) error

CancelSteer godoc @Summary Cancel an accepted steer input @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param item_id path string true "Queue item ID" @Success 204 @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/steer-queue/{item_id} [delete].

func (*SessionQueueHandler) EnqueueFollowUp added in v0.20.0

func (h *SessionQueueHandler) EnqueueFollowUp(c echo.Context) error

EnqueueFollowUp godoc @Summary Enqueue follow-up input for the active session run @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body enqueueQueueRequest true "Follow-up payload" @Success 202 {object} followUpQueueItemResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue [post].

func (*SessionQueueHandler) EnqueueSteer added in v0.20.0

func (h *SessionQueueHandler) EnqueueSteer(c echo.Context) error

EnqueueSteer godoc @Summary Enqueue steer input for the active session run @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body enqueueQueueRequest true "Steer payload" @Success 202 {object} steerQueueItemResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/steer-queue [post].

func (*SessionQueueHandler) ListFollowUp added in v0.20.0

func (h *SessionQueueHandler) ListFollowUp(c echo.Context) error

ListFollowUp godoc @Summary List pending follow-up inputs @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} followUpQueueResponse @Failure 403 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue [get].

func (*SessionQueueHandler) ListSessionQueue added in v0.20.0

func (h *SessionQueueHandler) ListSessionQueue(c echo.Context) error

ListSessionQueue godoc @Summary List pending steer and follow-up inputs in one response @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} sessionQueueResponse @Failure 403 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/queue [get].

func (*SessionQueueHandler) ListSteer added in v0.20.0

func (h *SessionQueueHandler) ListSteer(c echo.Context) error

ListSteer godoc @Summary List pending steer inputs @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Success 200 {object} steerQueueResponse @Failure 403 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/steer-queue [get].

func (*SessionQueueHandler) PromoteFollowUpToSteer added in v0.20.0

func (h *SessionQueueHandler) PromoteFollowUpToSteer(c echo.Context) error

PromoteFollowUpToSteer godoc @Summary Promote an accepted follow-up input to steer the active run @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param item_id path string true "Follow-up queue item ID" @Success 202 {object} steerQueueItemResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue/{item_id}/steer [post].

func (*SessionQueueHandler) Register added in v0.20.0

func (h *SessionQueueHandler) Register(e *echo.Echo)

func (*SessionQueueHandler) ReorderFollowUp added in v0.20.0

func (h *SessionQueueHandler) ReorderFollowUp(c echo.Context) error

ReorderFollowUp godoc @Summary Reorder accepted follow-up inputs @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body followUpQueueReorderRequest true "Typed follow-up queue references" @Success 200 {object} followUpQueueResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue/reorder [put].

func (*SessionQueueHandler) ReorderSteer added in v0.20.0

func (h *SessionQueueHandler) ReorderSteer(c echo.Context) error

ReorderSteer godoc @Summary Reorder accepted steer inputs @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param body body steerQueueReorderRequest true "Typed steer queue references" @Success 200 {object} steerQueueResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/steer-queue/reorder [put].

func (*SessionQueueHandler) UpdateFollowUp added in v0.20.0

func (h *SessionQueueHandler) UpdateFollowUp(c echo.Context) error

UpdateFollowUp godoc @Summary Edit an accepted follow-up input @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param item_id path string true "Queue item ID" @Param body body updateQueueRequest true "Updated follow-up payload" @Success 200 {object} followUpQueueItemResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/follow-up-queue/{item_id} [patch].

func (*SessionQueueHandler) UpdateSteer added in v0.20.0

func (h *SessionQueueHandler) UpdateSteer(c echo.Context) error

UpdateSteer godoc @Summary Edit an accepted steer input @Tags sessions @Param bot_id path string true "Bot ID" @Param session_id path string true "Session ID" @Param item_id path string true "Queue item ID" @Param body body updateQueueRequest true "Updated steer payload" @Success 200 {object} steerQueueItemResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Router /bots/{bot_id}/sessions/{session_id}/steer-queue/{item_id} [patch].

type SettingsHandler

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

func NewSettingsHandler

func NewSettingsHandler(log *slog.Logger, service *settings.Service, botService *bots.Service, accountService *accounts.Service) *SettingsHandler

func (*SettingsHandler) Delete

func (h *SettingsHandler) Delete(c echo.Context) error

Delete godoc @Summary Delete user settings @Description Remove agent settings for current user @Tags settings @Param bot_id path string true "Bot ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/settings [delete].

func (*SettingsHandler) Get

func (h *SettingsHandler) Get(c echo.Context) error

Get godoc @Summary Get user settings @Description Get agent settings for current user @Tags settings @Param bot_id path string true "Bot ID" @Success 200 {object} settings.Settings @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/settings [get].

func (*SettingsHandler) Register

func (h *SettingsHandler) Register(e *echo.Echo)

func (*SettingsHandler) Upsert

func (h *SettingsHandler) Upsert(c echo.Context) error

Upsert godoc @Summary Update user settings @Description Update or create agent settings for current user @Tags settings @Param bot_id path string true "Bot ID" @Param payload body settings.UpsertRequest true "Settings payload" @Success 200 {object} settings.Settings @Failure 400 {object} apperror.Problem @Failure 503 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/settings [put] @Router /bots/{bot_id}/settings [post].

type SkillItem

type SkillItem struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Content     string         `json:"content"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Raw         string         `json:"raw"`
	SourcePath  string         `json:"source_path,omitempty"`
	SourceRoot  string         `json:"source_root,omitempty"`
	SourceKind  string         `json:"source_kind,omitempty"`
	Managed     bool           `json:"managed,omitempty"`
	Editable    bool           `json:"editable"`
	Deletable   bool           `json:"deletable"`
	State       string         `json:"state,omitempty"`
	ShadowedBy  string         `json:"shadowed_by,omitempty"`
	RegistryID  string         `json:"registry_id,omitempty"`
	AppID       string         `json:"app_id,omitempty"`
	SkillID     string         `json:"skill_id,omitempty"`
}

type SkillsActionRequest

type SkillsActionRequest struct {
	Action     string `json:"action"`
	TargetPath string `json:"target_path"`
}

type SkillsDeleteRequest

type SkillsDeleteRequest struct {
	// SourcePaths are SKILL.md paths reported in the skill list. Deleting by name
	// cannot address registry skills, which are nested by registry and app.
	SourcePaths []string `json:"source_paths"`
}

type SkillsResponse

type SkillsResponse struct {
	Skills []SkillItem `json:"skills"`
}

type SkillsUpsertRequest

type SkillsUpsertRequest struct {
	Skills []string `json:"skills"`
	// SourcePath is the existing SKILL.md being edited when saving a single skill.
	// Empty means create (or overwrite by frontmatter name under
	// /data/skills/user/personal/<name>/).
	SourcePath string `json:"source_path,omitempty"`
}

type SnapshotInfo

type SnapshotInfo struct {
	Snapshotter string            `json:"snapshotter"`
	Name        string            `json:"name"`
	DisplayName string            `json:"display_name,omitempty"`
	RuntimeName string            `json:"runtime_snapshot_name"`
	Parent      string            `json:"parent,omitempty"`
	Kind        string            `json:"kind"`
	CreatedAt   time.Time         `json:"created_at,omitempty"`
	UpdatedAt   time.Time         `json:"updated_at,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Source      string            `json:"source"`
	Managed     bool              `json:"managed"`
	Version     *int              `json:"version,omitempty"`
}

type SupermarketAppCategory added in v0.20.0

type SupermarketAppCategory = supermarketclient.AppCategory

type SupermarketAppCategoryListResponse added in v0.20.0

type SupermarketAppCategoryListResponse = supermarketclient.AppCategoryListResponse

type SupermarketAppCategoryRegistry added in v0.20.0

type SupermarketAppCategoryRegistry = supermarketclient.AppCategoryRegistry

type SupermarketAppConnector added in v0.20.0

type SupermarketAppConnector = supermarketclient.AppConnectorReference

type SupermarketAppDescriptor added in v0.20.0

type SupermarketAppDescriptor = supermarketclient.AppDescriptor

type SupermarketAppListResponse added in v0.20.0

type SupermarketAppListResponse = supermarketclient.AppListResponse

type SupermarketAppMetadata added in v0.20.0

type SupermarketAppMetadata = supermarketclient.AppMetadata

type SupermarketAppRelease added in v0.20.0

type SupermarketAppRelease = supermarketclient.AppRelease

type SupermarketAppSkillCategory added in v0.20.0

type SupermarketAppSkillCategory = supermarketclient.AppSkillCategory

type SupermarketAppSummary added in v0.20.0

type SupermarketAppSummary = supermarketclient.AppSummary

type SupermarketAppTranslation added in v0.20.0

type SupermarketAppTranslation = supermarketclient.AppTranslation

type SupermarketAuthor

type SupermarketAuthor = supermarketclient.Author

type SupermarketCatalogSkill

type SupermarketCatalogSkill = supermarketclient.CatalogSkill

type SupermarketCatalogSkillListResponse

type SupermarketCatalogSkillListResponse = supermarketclient.CatalogSkillListResponse

type SupermarketHandler

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

SupermarketHandler proxies the read-only Supermarket catalog. Installing Apps into bots is the AppsHandler's job.

func NewSupermarketHandler

func NewSupermarketHandler(log *slog.Logger, cfg config.Config) *SupermarketHandler

func (*SupermarketHandler) GetRegistryApp added in v0.20.0

func (h *SupermarketHandler) GetRegistryApp(c echo.Context) error

GetRegistryApp godoc @Summary Get a namespaced Skill App @Tags supermarket @Param registry_id path string true "Registry ID" @Param app_id path string true "App ID" @Success 200 {object} SupermarketAppDescriptor @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/registries/{registry_id}/apps/{app_id} [get].

func (*SupermarketHandler) GetRegistryAppRelease added in v0.20.0

func (h *SupermarketHandler) GetRegistryAppRelease(c echo.Context) error

GetRegistryAppRelease godoc @Summary Get an immutable Skill App release @Tags supermarket @Param registry_id path string true "Registry ID" @Param app_id path string true "App ID" @Param revision path string true "App revision" @Success 200 {object} SupermarketAppDescriptor @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/registries/{registry_id}/apps/{app_id}/releases/{revision} [get].

func (*SupermarketHandler) GetRegistrySkill

func (h *SupermarketHandler) GetRegistrySkill(c echo.Context) error

GetRegistrySkill godoc @Summary Get a namespaced Registry Skill @Tags supermarket @Param registry_id path string true "Registry ID" @Param app_id path string true "App ID" @Param skill_id path string true "Skill ID" @Success 200 {object} SupermarketCatalogSkill @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/registries/{registry_id}/apps/{app_id}/skills/{skill_id} [get].

func (*SupermarketHandler) GetRegistrySkillIcon

func (h *SupermarketHandler) GetRegistrySkillIcon(c echo.Context) error

GetRegistrySkillIcon proxies an immutable Skill icon from Supermarket. @Summary Get a mirrored Skill icon @Tags supermarket @Param digest path string true "SHA-256 digest" @Success 200 {file} binary @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/artifacts/icon/{digest} [get].

func (*SupermarketHandler) ListApps added in v0.20.0

func (h *SupermarketHandler) ListApps(c echo.Context) error

ListApps godoc @Summary List Skill Apps across supermarket Registries @Tags supermarket @Param q query string false "Search query" @Param registry query string false "Registry ID" @Param category query string false "Category ID" @Param tag query string false "Exact tag" @Param component query string false "Component filter" Enums(skills, dependencies, connectors) @Param page query int false "Page number" @Param limit query int false "Items per page" @Param sort query string false "Sort order" @Success 200 {object} SupermarketAppListResponse @Failure 400 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/apps [get].

func (*SupermarketHandler) ListCategories added in v0.20.0

func (h *SupermarketHandler) ListCategories(c echo.Context) error

ListCategories godoc @Summary List App categories with localized names @Tags supermarket @Param registry query string false "Registry ID" @Success 200 {object} SupermarketAppCategoryListResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/categories [get].

func (*SupermarketHandler) ListRegistries

func (h *SupermarketHandler) ListRegistries(c echo.Context) error

ListRegistries godoc @Summary List Skill Registries from supermarket @Tags supermarket @Success 200 {object} SupermarketRegistryListResponse @Failure 502 {object} ErrorResponse @Router /supermarket/registries [get].

func (*SupermarketHandler) ListRegistryApps added in v0.20.0

func (h *SupermarketHandler) ListRegistryApps(c echo.Context) error

ListRegistryApps godoc @Summary List Skill Apps in one Registry @Tags supermarket @Param registry_id path string true "Registry ID" @Param q query string false "Search query" @Param category query string false "Category ID" @Param tag query string false "Exact tag" @Param page query int false "Page number" @Param limit query int false "Items per page" @Param sort query string false "Sort order" @Success 200 {object} SupermarketAppListResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/registries/{registry_id}/apps [get].

func (*SupermarketHandler) ListSkills

func (h *SupermarketHandler) ListSkills(c echo.Context) error

ListSkills godoc @Summary List Skills across supermarket Registries @Tags supermarket @Param q query string false "Search query" @Param registry query string false "Registry ID" @Param app query string false "App ID" @Param category query string false "Category ID" @Param tag query string false "Exact tag" @Param page query int false "Page number" @Param limit query int false "Items per page" @Param sort query string false "Sort order" @Success 200 {object} SupermarketCatalogSkillListResponse @Failure 400 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Router /supermarket/skills [get].

func (*SupermarketHandler) Register

func (h *SupermarketHandler) Register(e *echo.Echo)

type SupermarketRegistry

type SupermarketRegistry = supermarketclient.Registry

type SupermarketRegistryListResponse

type SupermarketRegistryListResponse = supermarketclient.RegistryListResponse

type SupermarketSkillArtifact

type SupermarketSkillArtifact = supermarketclient.SkillArtifact

type SupermarketSkillIcon

type SupermarketSkillIcon = supermarketclient.SkillIcon

type SupermarketSkillIconAsset

type SupermarketSkillIconAsset = supermarketclient.SkillIconAsset

type SupermarketSkillSource

type SupermarketSkillSource = supermarketclient.SkillSource

type SwaggerHandler

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

func NewSwaggerHandler

func NewSwaggerHandler(log *slog.Logger) *SwaggerHandler

func (*SwaggerHandler) Register

func (h *SwaggerHandler) Register(e *echo.Echo)

func (*SwaggerHandler) Spec

func (*SwaggerHandler) Spec(c echo.Context) error

func (*SwaggerHandler) UI

type TokenUsageHandler

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

func NewTokenUsageHandler

func NewTokenUsageHandler(log *slog.Logger, queries dbstore.Queries, botService *bots.Service, accountService *accounts.Service) *TokenUsageHandler

func (*TokenUsageHandler) GetTokenUsage

func (h *TokenUsageHandler) GetTokenUsage(c echo.Context) error

GetTokenUsage godoc @Summary Get token usage statistics @Description Get daily aggregated token usage for a bot, split by chat, discuss, and schedule session types, with optional model filter and per-model breakdown @Tags token-usage @Param bot_id path string true "Bot ID" @Param from query string true "Start date (YYYY-MM-DD)" @Param to query string true "End date exclusive (YYYY-MM-DD)" @Param model_id query string false "Optional model UUID to filter by" @Param session_type query string false "Optional session type: chat, discuss, schedule, or acp_agent. acp_agent filters by runtime." @Success 200 {object} TokenUsageResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/token-usage [get].

func (*TokenUsageHandler) ListTokenUsageRecords

func (h *TokenUsageHandler) ListTokenUsageRecords(c echo.Context) error

ListTokenUsageRecords godoc @Summary List per-call token usage records @Description Paginated list of individual LLM call records (assistant messages with usage) for a bot, with optional model and session type filters @Tags token-usage @Produce json @Param bot_id path string true "Bot ID" @Param from query string true "Start date (YYYY-MM-DD)" @Param to query string true "End date exclusive (YYYY-MM-DD)" @Param model_id query string false "Optional model UUID to filter by" @Param session_type query string false "Optional session type: chat, discuss, schedule, or acp_agent. acp_agent filters by runtime." @Param limit query int false "Page size (default 20, max 100)" @Param offset query int false "Offset" default(0) @Success 200 {object} TokenUsageRecordsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/token-usage/records [get].

func (*TokenUsageHandler) Register

func (h *TokenUsageHandler) Register(e *echo.Echo)

type TokenUsageRecord

type TokenUsageRecord struct {
	ID              string `json:"id"`
	CreatedAt       string `json:"created_at"`
	SessionID       string `json:"session_id"`
	SessionType     string `json:"session_type"`
	ModelID         string `json:"model_id"`
	ModelSlug       string `json:"model_slug"`
	ModelName       string `json:"model_name"`
	ProviderName    string `json:"provider_name"`
	InputTokens     int64  `json:"input_tokens"`
	OutputTokens    int64  `json:"output_tokens"`
	CacheReadTokens int64  `json:"cache_read_tokens"`
	ReasoningTokens int64  `json:"reasoning_tokens"`
}

TokenUsageRecord represents a single LLM call (one assistant message row) with its token usage.

type TokenUsageRecordsResponse

type TokenUsageRecordsResponse struct {
	Items []TokenUsageRecord `json:"items"`
	Total int64              `json:"total"`
}

TokenUsageRecordsResponse is the response body for GET /bots/:bot_id/token-usage/records.

type TokenUsageResponse

type TokenUsageResponse struct {
	Chat     []DailyTokenUsage `json:"chat"`
	Discuss  []DailyTokenUsage `json:"discuss"`
	ACPAgent []DailyTokenUsage `json:"acp_agent"`
	Schedule []DailyTokenUsage `json:"schedule"`
	ByModel  []ModelTokenUsage `json:"by_model"`
}

TokenUsageResponse is the response body for GET /bots/:bot_id/token-usage.

type ToolApprovalDecisionRequest

type ToolApprovalDecisionRequest struct {
	// ControlID is the stable identity of one client mutation. New clients send
	// it for exact retries; it remains optional for older Web/Desktop clients.
	ControlID string `json:"control_id,omitempty"`
	// OptionID selects one of the agent-provided permission options carried on
	// the approval request; empty keeps the plain binary decision.
	OptionID string `json:"option_id,omitempty"`
	Reason   string `json:"reason,omitempty"`
}

type ToolApprovalHandler

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

func NewToolApprovalHandler

func NewToolApprovalHandler(log *slog.Logger, botService *bots.Service, accountService *accounts.Service, turnService turn.Service) *ToolApprovalHandler

func (*ToolApprovalHandler) Approve

func (h *ToolApprovalHandler) Approve(c echo.Context) error

Approve godoc @Summary Approve a pending tool call @Tags tool-approvals @Param bot_id path string true "Bot ID" @Param approval_id path string true "Approval ID" @Param payload body ToolApprovalDecisionRequest false "Approval payload" @Success 200 {object} map[string]string @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/tool-approvals/{approval_id}/approve [post].

func (*ToolApprovalHandler) Register

func (h *ToolApprovalHandler) Register(e *echo.Echo)

func (*ToolApprovalHandler) Reject

func (h *ToolApprovalHandler) Reject(c echo.Context) error

Reject godoc @Summary Reject a pending tool call @Tags tool-approvals @Param bot_id path string true "Bot ID" @Param approval_id path string true "Approval ID" @Param payload body ToolApprovalDecisionRequest false "Rejection payload" @Success 200 {object} map[string]string @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/tool-approvals/{approval_id}/reject [post].

type ToolDefBucket added in v0.20.0

type ToolDefBucket struct {
	Provider      string `json:"provider"`
	Tools         int    `json:"tools"`
	TokenEstimate int    `json:"token_estimate"`
}

type TriggerCompactResponse

type TriggerCompactResponse struct {
	Status       string `json:"status"`
	Summary      string `json:"summary,omitempty"`
	MessageCount int    `json:"message_count"`
}

TriggerCompactResponse is the API response for triggering compaction.

type UILocateMessageResponse

type UILocateMessageResponse struct {
	Items                   []chatview.UITurn `json:"items" validate:"required"`
	TargetID                string            `json:"target_id" validate:"required" format:"uuid"`
	TargetExternalMessageID string            `json:"target_external_message_id" validate:"required"`
}

UILocateMessageResponse is a normalized history window around one external message.

type UIMessageListResponse

type UIMessageListResponse struct {
	Items []chatview.UITurn `json:"items" validate:"required"`
}

UIMessageListResponse is the normalized, authoritative session history read by Web.

type UpdateContainerMetricsRequest

type UpdateContainerMetricsRequest struct {
	ResourceLimits *UpdateContainerResourceLimitsRequest `json:"resource_limits"`
}

type UpdateContainerResourceLimitsRequest

type UpdateContainerResourceLimitsRequest struct {
	CPUMillicores int64 `json:"cpu_millicores"`
	MemoryBytes   int64 `json:"memory_bytes"`
	StorageBytes  int64 `json:"storage_bytes"`
}

type UserComputerAccessHandler

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

UserComputerAccessHandler serves the account-level Computer ACL view: which of the user's bots may use which of their Remote Runtimes. Writes still go through the bot-scoped workspace-targets endpoints (mount/unmount); this read model exists so the account page and its access dialog can render without one request per bot.

func NewUserComputerAccessHandler

func NewUserComputerAccessHandler(log *slog.Logger, service *workspace.RemoteWorkspaceService) *UserComputerAccessHandler

func (*UserComputerAccessHandler) List

List godoc @Summary List the caller's bot-to-Computer access grants @Description Every live Remote Runtime mount held by the caller's bots, across all of their runtimes. @Tags user-runtimes @Produce json @Success 200 {object} workspace.WorkspaceTargetGrantsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/computer-access [get].

func (*UserComputerAccessHandler) Register

func (h *UserComputerAccessHandler) Register(e *echo.Echo)

type UserRuntimeHandler

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

UserRuntimeHandler only manages the long-lived credential used by the reverse-RPC WebSocket. Runtime selection and bot bindings are separate product concerns and intentionally do not live here.

func NewUserRuntimeHandler

func NewUserRuntimeHandler(log *slog.Logger, service *userruntime.Service) *UserRuntimeHandler

func (*UserRuntimeHandler) Create

func (h *UserRuntimeHandler) Create(c echo.Context) error

Create godoc @Summary Create a Remote Runtime credential @Description Register a Remote Runtime and return its reusable API token. @Tags user-runtimes @Accept json @Produce json @Param request body userruntime.CreateRuntimeRequest true "Runtime configuration" @Success 201 {object} userruntime.Runtime @Failure 400 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/runtimes [post].

func (*UserRuntimeHandler) Delete

func (h *UserRuntimeHandler) Delete(c echo.Context) error

Delete godoc @Summary Revoke a Remote Runtime credential @Tags user-runtimes @Param id path string true "Runtime ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/runtimes/{id} [delete].

func (*UserRuntimeHandler) List

func (h *UserRuntimeHandler) List(c echo.Context) error

List godoc @Summary List Remote Runtime credentials @Tags user-runtimes @Produce json @Success 200 {array} userruntime.Runtime @Failure 500 {object} ErrorResponse @Router /users/me/runtimes [get].

func (*UserRuntimeHandler) Register

func (h *UserRuntimeHandler) Register(e *echo.Echo)

type UsersHandler

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

UsersHandler manages user/account CRUD and bot operations via REST API.

func NewUsersHandler

func NewUsersHandler(log *slog.Logger, service *accounts.Service, botService *bots.Service, routeService route.Service, channelStore *channel.Store, channelRuntime channel.Runtime, registry *channel.Registry, workspaceSetup botCreateWorkspace) *UsersHandler

NewUsersHandler creates a UsersHandler with channel identity support.

func (*UsersHandler) CheckBotName

func (h *UsersHandler) CheckBotName(c echo.Context) error

CheckBotName godoc @Summary Check bot name availability @Description Validate a candidate bot name and report whether it is available @Tags bots @Param name query string true "Candidate bot name" @Param exclude_bot_id query string false "Bot ID to exclude from the conflict check (used when renaming)" @Success 200 {object} bots.NameAvailability @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/name-availability [get].

func (*UsersHandler) CreateBot

func (h *UsersHandler) CreateBot(c echo.Context) error

CreateBot godoc @Summary Create bot user @Description Create a bot user owned by current user (or admin-specified owner) @Tags bots @Param payload body bots.CreateBotRequest true "Bot payload" @Success 201 {object} bots.Bot @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots [post].

func (*UsersHandler) CreateUser

func (h *UsersHandler) CreateUser(c echo.Context) error

CreateUser godoc @Summary Create human user (admin only) @Description Create a new human user account @Tags users @Param payload body accounts.CreateAccountRequest true "User payload" @Success 201 {object} accounts.Account @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users [post].

func (*UsersHandler) DeleteBot

func (h *UsersHandler) DeleteBot(c echo.Context) error

DeleteBot godoc @Summary Delete bot @Description Delete a bot user (owner/admin only) @Tags bots @Param id path string true "Bot ID" @Success 202 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{id} [delete].

func (*UsersHandler) DeleteBotChannelConfig

func (h *UsersHandler) DeleteBotChannelConfig(c echo.Context) error

DeleteBotChannelConfig godoc @Summary Delete bot channel config @Description Remove bot channel configuration @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{id}/channel/{platform} [delete].

func (*UsersHandler) GetBot

func (h *UsersHandler) GetBot(c echo.Context) error

GetBot godoc @Summary Get bot details @Description Get a bot by ID (owner/admin only) @Tags bots @Param id path string true "Bot ID" @Success 200 {object} bots.Bot @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{id} [get].

func (*UsersHandler) GetBotChannelConfig

func (h *UsersHandler) GetBotChannelConfig(c echo.Context) error

GetBotChannelConfig godoc @Summary Get bot channel config @Description Get bot channel configuration @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Success 200 {object} channel.ChannelConfig @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{id}/channel/{platform} [get].

func (*UsersHandler) GetMe

func (h *UsersHandler) GetMe(c echo.Context) error

GetMe godoc @Summary Get current user @Description Get current user profile @Tags users @Success 200 {object} accounts.Account @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me [get].

func (*UsersHandler) GetUser

func (h *UsersHandler) GetUser(c echo.Context) error

GetUser godoc @Summary Get user by ID @Description Get user details (self or admin only) @Tags users @Param id path string true "User ID" @Success 200 {object} accounts.Account @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{id} [get].

func (*UsersHandler) ListBotChecks

func (h *UsersHandler) ListBotChecks(c echo.Context) error

ListBotChecks godoc @Summary List bot runtime checks @Description Evaluate bot attached resource checks in runtime @Tags bots @Param id path string true "Bot ID" @Success 200 {object} bots.ListChecksResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{id}/checks [get].

func (*UsersHandler) ListBots

func (h *UsersHandler) ListBots(c echo.Context) error

ListBots godoc @Summary List bots @Description List bots accessible to current user (admin can specify owner_id) @Tags bots @Param owner_id query string false "Owner user ID (admin only)" @Success 200 {object} bots.ListBotsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots [get].

func (*UsersHandler) ListUsers

func (h *UsersHandler) ListUsers(c echo.Context) error

ListUsers godoc @Summary List users (admin only) @Description List users @Tags users @Success 200 {object} accounts.ListAccountsResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users [get].

func (*UsersHandler) Register

func (h *UsersHandler) Register(e *echo.Echo)

func (*UsersHandler) RemoveMember

func (h *UsersHandler) RemoveMember(c echo.Context) error

RemoveMember godoc @Summary Deactivate member (admin only) @Description Deactivate the member in the current workspace without changing global credentials @Tags users @Param id path string true "User ID" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{id} [delete].

func (*UsersHandler) SendBotMessage

func (h *UsersHandler) SendBotMessage(c echo.Context) error

SendBotMessage godoc @Summary Send message via bot channel @Description Send a message using bot channel configuration @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Param payload body channel.SendRequest true "Send payload" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{id}/channel/{platform}/send [post].

func (*UsersHandler) SendBotMessageSession

func (h *UsersHandler) SendBotMessageSession(c echo.Context) error

SendBotMessageSession godoc @Summary Send message via bot channel session token @Description Send a message using a session-scoped token (reply only) @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Param payload body channel.SendRequest true "Send payload" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{id}/channel/{platform}/send_chat [post].

func (*UsersHandler) SetBotChannelWebhookEndpoint

func (h *UsersHandler) SetBotChannelWebhookEndpoint(c echo.Context) error

SetBotChannelWebhookEndpoint godoc @Summary Set bot channel webhook endpoint @Description Set the platform-side webhook endpoint for a bot channel. @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Param payload body channel.SetWebhookEndpointRequest true "Webhook endpoint payload" @Success 200 {object} channel.SetWebhookEndpointResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Router /bots/{id}/channel/{platform}/webhook-endpoint [post].

func (*UsersHandler) SetCredentialService added in v0.20.0

func (h *UsersHandler) SetCredentialService(service *agentcredential.Service)

func (*UsersHandler) SetRuntimeResetService

func (h *UsersHandler) SetRuntimeResetService(closer runtimeResetService)

func (*UsersHandler) TransferBotOwner

func (h *UsersHandler) TransferBotOwner(c echo.Context) error

TransferBotOwner godoc @Summary Transfer bot owner (admin only) @Description Transfer bot ownership to another human user @Tags bots @Param id path string true "Bot ID" @Param payload body bots.TransferBotRequest true "Transfer payload" @Success 200 {object} bots.Bot @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{id}/owner [put].

func (*UsersHandler) UpdateBot

func (h *UsersHandler) UpdateBot(c echo.Context) error

UpdateBot godoc @Summary Update bot details @Description Update bot profile (owner/admin only) @Tags bots @Param id path string true "Bot ID" @Param payload body bots.UpdateBotRequest true "Bot update payload" @Success 200 {object} bots.Bot @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots/{id} [put].

func (*UsersHandler) UpdateBotChannelStatus

func (h *UsersHandler) UpdateBotChannelStatus(c echo.Context) error

UpdateBotChannelStatus godoc @Summary Update bot channel status @Description Update bot channel enabled/disabled status @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Param payload body channel.UpdateChannelStatusRequest true "Channel status payload" @Success 200 {object} channel.ChannelConfig @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots/{id}/channel/{platform}/status [patch].

func (*UsersHandler) UpdateMe

func (h *UsersHandler) UpdateMe(c echo.Context) error

UpdateMe godoc @Summary Update current user profile @Description Update current user profile and preferences @Tags users @Param payload body accounts.UpdateProfileRequest true "Profile payload" @Success 200 {object} accounts.Account @Failure 400 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /users/me [put].

func (*UsersHandler) UpdateMyPassword

func (h *UsersHandler) UpdateMyPassword(c echo.Context) error

UpdateMyPassword godoc @Summary Update current user password @Description Update current user password with current password check @Tags users @Param payload body accounts.UpdatePasswordRequest true "Password payload" @Success 204 "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/password [put].

func (*UsersHandler) UpdateUser

func (h *UsersHandler) UpdateUser(c echo.Context) error

UpdateUser godoc @Summary Update user (admin only) @Description Update the user's role or membership status in the current workspace @Tags users @Param id path string true "User ID" @Param payload body accounts.UpdateAccountRequest true "User update payload" @Success 200 {object} accounts.Account @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{id} [put].

func (*UsersHandler) UpsertBotChannelConfig

func (h *UsersHandler) UpsertBotChannelConfig(c echo.Context) error

UpsertBotChannelConfig godoc @Summary Update bot channel config @Description Update bot channel configuration @Tags bots @Param id path string true "Bot ID" @Param platform path string true "Channel platform" @Param payload body channel.UpsertConfigRequest true "Channel config payload" @Success 200 {object} channel.ChannelConfig @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 502 {object} ErrorResponse @Failure 503 {object} apperror.Problem @Failure 500 {object} ErrorResponse @Router /bots/{id}/channel/{platform} [put].

type VideoHandler

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

func NewVideoHandler

func NewVideoHandler(log *slog.Logger, service *videopkg.Service, modelsService *models.Service) *VideoHandler

func (*VideoHandler) GetModel

func (h *VideoHandler) GetModel(c echo.Context) error

GetModel godoc @Summary Get a video model @Tags video-models @Produce json @Param id path string true "Model ID (UUID)" @Success 200 {object} videopkg.ModelResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /video-models/{id} [get].

func (*VideoHandler) GetProvider

func (h *VideoHandler) GetProvider(c echo.Context) error

GetProvider godoc @Summary Get video provider @Tags video-providers @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} videopkg.ProviderResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /video-providers/{id} [get].

func (*VideoHandler) ImportModels

func (h *VideoHandler) ImportModels(c echo.Context) error

ImportModels godoc @Summary Import video models from provider @Tags video-providers @Accept json @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {object} videopkg.ImportModelsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /video-providers/{id}/import-models [post].

func (*VideoHandler) ListMeta

func (h *VideoHandler) ListMeta(c echo.Context) error

ListMeta godoc @Summary List video provider metadata @Description List available video provider types with their models and capabilities @Tags video-providers @Success 200 {array} videopkg.ProviderMetaResponse @Router /video-providers/meta [get].

func (*VideoHandler) ListModels

func (h *VideoHandler) ListModels(c echo.Context) error

ListModels godoc @Summary List all video models @Tags video-models @Produce json @Success 200 {array} videopkg.ModelResponse @Failure 500 {object} ErrorResponse @Router /video-models [get].

func (*VideoHandler) ListModelsByProvider

func (h *VideoHandler) ListModelsByProvider(c echo.Context) error

ListModelsByProvider godoc @Summary List video models by provider @Tags video-providers @Produce json @Param id path string true "Provider ID (UUID)" @Success 200 {array} videopkg.ModelResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /video-providers/{id}/models [get].

func (*VideoHandler) ListProviders

func (h *VideoHandler) ListProviders(c echo.Context) error

ListProviders godoc @Summary List video providers @Description List providers that support video generation @Tags video-providers @Produce json @Success 200 {array} videopkg.ProviderResponse @Failure 500 {object} ErrorResponse @Router /video-providers [get].

func (*VideoHandler) Register

func (h *VideoHandler) Register(e *echo.Echo)

func (*VideoHandler) UpdateModel

func (h *VideoHandler) UpdateModel(c echo.Context) error

UpdateModel godoc @Summary Update a video model @Tags video-models @Accept json @Produce json @Param id path string true "Model ID (UUID)" @Param request body videopkg.UpdateModelRequest true "Model update payload" @Success 200 {object} videopkg.ModelResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /video-models/{id} [put].

type WebhookTunnelHandler

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

func NewWebhookTunnelHandler

func NewWebhookTunnelHandler(manager interface{ Status() webhooktunnel.Status }) *WebhookTunnelHandler

func (*WebhookTunnelHandler) Register

func (h *WebhookTunnelHandler) Register(e *echo.Echo)

func (*WebhookTunnelHandler) Status

func (h *WebhookTunnelHandler) Status(c echo.Context) error

Status godoc @Summary Get webhook tunnel status @Tags system @Success 200 {object} webhooktunnel.Status @Router /webhook-tunnel/status [get].

type WorkdirHandler

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

WorkdirHandler manages a bot's working directories.

func NewWorkdirHandler

func NewWorkdirHandler(
	log *slog.Logger,
	service *workdir.Service,
	botService *bots.Service,
	accountService *accounts.Service,
) *WorkdirHandler

func (*WorkdirHandler) Archive

func (h *WorkdirHandler) Archive(c echo.Context) error

Archive godoc @Summary Archive a Bot workdir @Description Archiving refuses new session bindings but keeps existing sessions working: their directory never changes underneath them. @Tags workdirs @Param bot_id path string true "Bot ID" @Param workdir_id path string true "Workdir ID" @Success 204 "No Content" @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workdirs/{workdir_id} [delete].

func (*WorkdirHandler) Create

func (h *WorkdirHandler) Create(c echo.Context) error

Create godoc @Summary Create a Bot workdir @Description Registers a named working directory on a workspace target. The directory must already exist on that target. @Tags workdirs @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param request body workdir.CreateRequest true "Workdir" @Success 201 {object} workdir.Workdir @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Router /bots/{bot_id}/workdirs [post].

func (*WorkdirHandler) GitBranch added in v0.20.0

func (h *WorkdirHandler) GitBranch(c echo.Context) error

GitBranch godoc @Summary Read a workdir's current Git branch @Tags workdirs @Produce json @Param bot_id path string true "Bot ID" @Param workdir_id path string true "Workdir ID" @Success 200 {object} workdir.GitBranchResponse @Failure 403 {object} apperror.Problem @Failure 404 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/workdirs/{workdir_id}/git-branch [get].

func (*WorkdirHandler) List

func (h *WorkdirHandler) List(c echo.Context) error

List godoc @Summary List a Bot's workdirs @Tags workdirs @Produce json @Param bot_id path string true "Bot ID" @Param include_archived query bool false "Include archived workdirs" @Success 200 {object} workdir.WorkdirsResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /bots/{bot_id}/workdirs [get].

func (*WorkdirHandler) Register

func (h *WorkdirHandler) Register(e *echo.Echo)

func (*WorkdirHandler) Rename

func (h *WorkdirHandler) Rename(c echo.Context) error

Rename godoc @Summary Rename a Bot workdir @Description Only the name can change. The target and path are immutable: they are baked into the working directory of every session bound to this workdir. @Tags workdirs @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param workdir_id path string true "Workdir ID" @Param request body workdir.UpdateRequest true "New name" @Success 200 {object} workdir.Workdir @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /bots/{bot_id}/workdirs/{workdir_id} [patch].

func (*WorkdirHandler) SwitchGitBranch added in v0.20.0

func (h *WorkdirHandler) SwitchGitBranch(c echo.Context) error

SwitchGitBranch godoc @Summary Switch a workdir to an existing local Git branch @Tags workdirs @Accept json @Produce json @Param bot_id path string true "Bot ID" @Param workdir_id path string true "Workdir ID" @Param request body workdir.SwitchGitBranchRequest true "Local branch" @Success 200 {object} workdir.GitBranchResponse @Failure 400 {object} apperror.Problem @Failure 403 {object} apperror.Problem @Failure 409 {object} apperror.Problem @Failure 500 {object} apperror.Problem @Router /bots/{bot_id}/workdirs/{workdir_id}/git-branch [post].

type WorkspaceDependencyCatalogItem added in v0.20.0

type WorkspaceDependencyCatalogItem struct {
	ID           string                                    `json:"id"`
	Name         string                                    `json:"name"`
	Description  string                                    `json:"description"`
	IconURL      string                                    `json:"icon_url,omitempty"`
	Translations map[string]WorkspaceDependencyTranslation `json:"translations,omitempty"`
}

WorkspaceDependencyCatalogItem contains published metadata without workspace state.

type WorkspaceDependencyCatalogResponse added in v0.20.0

type WorkspaceDependencyCatalogResponse struct {
	Items        []WorkspaceDependencyCatalogItem `json:"items"`
	CatalogStale bool                             `json:"catalog_stale"`
}

type WorkspaceDependencyInstallRequest added in v0.20.0

type WorkspaceDependencyInstallRequest struct {
	// SessionID optionally routes operation progress to its originating conversation.
	SessionID          string `json:"session_id,omitempty"`
	DefinitionRevision string `json:"definition_revision,omitempty"`
	// Version to install. Empty (or no body) installs the latest version the
	// catalog script resolves, or the manifest pin when the dependency has
	// one. The version recorded afterwards is the one the script reports.
	Version string `json:"version,omitempty"`
}

WorkspaceDependencyInstallRequest is the optional body of install, update, and reinstall.

type WorkspaceDependencyItem added in v0.20.0

type WorkspaceDependencyItem struct {
	LastErrorCode      string                                    `json:"last_error_code,omitempty"`
	RegistryID         string                                    `json:"registry_id,omitempty"`
	DefinitionRevision string                                    `json:"definition_revision,omitempty"`
	IconURL            string                                    `json:"icon_url,omitempty"`
	Translations       map[string]WorkspaceDependencyTranslation `json:"translations,omitempty"`
	Retired            bool                                      `json:"retired,omitempty"`
	ID                 string                                    `json:"id"`
	Name               string                                    `json:"name"`
	Description        string                                    `json:"description,omitempty"`
	// Category is agent, runtime, or tool.
	Category string `json:"category" enums:"agent,runtime,tool"`
	// Source is image for dependencies shipped with the workspace image and
	// managed for dependencies installed by catalog scripts.
	Source string `json:"source" enums:"image,managed"`
	Icon   string `json:"icon,omitempty"`
	// Provides lists the commands the dependency makes available.
	Provides []string `json:"provides"`
	// PlatformSupported is false when the probed workspace platform is not
	// listed by the catalog manifest; PlatformReason then says why.
	PlatformSupported bool   `json:"platform_supported"`
	PlatformReason    string `json:"platform_reason,omitempty" enums:"unsupported_platform"`
	// Status is omitted when the dependency has no record and was not found
	// in the workspace.
	Status string `json:"status,omitempty" enums:"installed,installing,updating,removing,missing,failed"`
	// InstalledVersion is the version of the copy in effect: the one the
	// runtime launches and the one first on PATH (managed, then image, then
	// PATH).
	InstalledVersion string `json:"installed_version,omitempty"`
	// ImageVersion is the version of the workspace's toolkit copy, omitted
	// when no toolkit copy remains. Native removal clears it as well.
	ImageVersion string `json:"image_version,omitempty"`
	// Overlay is set when the copy in effect is a managed one installed over
	// an image copy.
	Overlay bool `json:"overlay,omitempty"`
	// LatestVersion is the last upstream check result, omitted until a check
	// ran.
	LatestVersion string `json:"latest_version,omitempty"`
	// UpdateAvailable is set for installed dependencies whose last upstream
	// check reported a version other than the one in effect.
	UpdateAvailable bool       `json:"update_available,omitempty"`
	LastCheckedAt   *time.Time `json:"last_checked_at,omitempty"`
	LastError       string     `json:"last_error,omitempty"`
	// PreviousVersion is the version rollback would switch back to.
	PreviousVersion string `json:"previous_version,omitempty"`
	// InstallPath is the dependency home when a managed copy is in effect or
	// can be installed, and the discovered command path when the image copy
	// is in effect.
	InstallPath string `json:"install_path,omitempty"`
	// Actions lists what may be requested right now.
	Actions []string `json:"actions" enums:"install,update,reinstall,remove,rollback,check_update"`
}

WorkspaceDependencyItem is one catalog dependency reconciled with its installation record and the workspace.

type WorkspaceDependencyListResponse added in v0.20.0

type WorkspaceDependencyListResponse struct {
	CatalogStale     bool                         `json:"catalog_stale"`
	CatalogFetchedAt *time.Time                   `json:"catalog_fetched_at,omitempty"`
	WorkspaceState   string                       `json:"workspace_state" enums:"running,not_running,missing"`
	Platform         *WorkspaceDependencyPlatform `json:"platform,omitempty"`
	Items            []WorkspaceDependencyItem    `json:"items"`
	// DiscoveryError is set when the workspace is running but could not be
	// inspected (the discovery command was killed or timed out). Items then
	// reflect the installation records alone, without workspace facts or
	// actions; a refresh retries discovery.
	DiscoveryError string `json:"discovery_error,omitempty"`
}

WorkspaceDependencyListResponse is the reconciled dependency view of one bot workspace.

type WorkspaceDependencyOperationResponse added in v0.20.0

type WorkspaceDependencyOperationResponse struct {
	DefinitionRevision string            `json:"definition_revision,omitempty"`
	DependencyID       string            `json:"dependency_id"`
	Action             string            `json:"action"`
	Version            string            `json:"version,omitempty"`
	Entrypoints        map[string]string `json:"entrypoints,omitempty"`
	Status             string            `json:"status,omitempty"`
}

WorkspaceDependencyOperationResponse is the receipt of a synchronous operation such as rollback.

type WorkspaceDependencyPlatform added in v0.20.0

type WorkspaceDependencyPlatform struct {
	OS   string `json:"os"`
	Arch string `json:"arch"`
	Libc string `json:"libc,omitempty"`
}

WorkspaceDependencyPlatform is the probed platform of the bot workspace.

type WorkspaceDependencyPreflightItem added in v0.20.0

type WorkspaceDependencyPreflightItem struct {
	DependencyID     string `json:"dependency_id"`
	Name             string `json:"name"`
	InstalledVersion string `json:"installed_version,omitempty"`
	State            string `json:"state" enums:"satisfied,missing,platform_unsupported,unknown_dependency"`
}

WorkspaceDependencyPreflightItem is the verdict for one dependency.

type WorkspaceDependencyPreflightRequest added in v0.20.0

type WorkspaceDependencyPreflightRequest struct {
	DependencyIDs []string `json:"dependency_ids"`
}

WorkspaceDependencyPreflightRequest names the dependencies an agent needs.

type WorkspaceDependencyPreflightResponse added in v0.20.0

type WorkspaceDependencyPreflightResponse struct {
	WorkspaceState string                             `json:"workspace_state" enums:"running,not_running,missing"`
	Items          []WorkspaceDependencyPreflightItem `json:"items"`
}

WorkspaceDependencyPreflightResponse reports whether the requested dependencies are ready. Items is empty unless the workspace is running.

type WorkspaceDependencyScriptEnv added in v0.20.0

type WorkspaceDependencyScriptEnv struct {
	Key string `json:"key"`
	// Value is empty when Secret is set.
	Value  string `json:"value"`
	Secret bool   `json:"secret"`
}

WorkspaceDependencyScriptEnv is one environment variable the script sees.

type WorkspaceDependencyScriptResponse added in v0.20.0

type WorkspaceDependencyScriptResponse struct {
	DefinitionRevision string                         `json:"definition_revision,omitempty"`
	DependencyID       string                         `json:"dependency_id"`
	Action             string                         `json:"action" enums:"install,update,remove,reinstall,rollback"`
	Digest             string                         `json:"digest"`
	Exec               string                         `json:"exec"`
	TimeoutSeconds     int                            `json:"timeout_seconds"`
	Env                []WorkspaceDependencyScriptEnv `json:"env"`
	Script             string                         `json:"script"`
}

WorkspaceDependencyScriptResponse is the exact script an action would run.

type WorkspaceDependencyStreamEvent added in v0.20.0

type WorkspaceDependencyStreamEvent struct {
	DefinitionRevision string            `json:"definition_revision,omitempty"`
	Type               string            `json:"type" enums:"started,log,done,error"`
	DependencyID       string            `json:"dependency_id,omitempty"`
	Version            string            `json:"version,omitempty"`
	Stream             string            `json:"stream,omitempty" enums:"stdout,stderr"`
	Data               string            `json:"data,omitempty"`
	Entrypoints        map[string]string `json:"entrypoints,omitempty"`
	Code               string            `json:"code,omitempty"`
	Args               map[string]string `json:"args,omitempty"`
	Detail             string            `json:"detail,omitempty"`
	Message            string            `json:"message,omitempty"`
	RequestID          string            `json:"request_id,omitempty"`
}

WorkspaceDependencyStreamEvent documents the SSE frames of install, update, reinstall, and remove. Type selects which fields are present: started carries dependency_id and the requested version (absent for latest); log carries stream and data; done carries the installed version and entrypoints; error carries the Problem fields.

codesync(workspace-dependency-stream): keep in sync with apps/web/src/composables/api/useWorkspaceDependencyStream.ts.

type WorkspaceDependencyTranslation added in v0.20.0

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

Jump to

Keyboard shortcuts

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