Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveTeams ¶ added in v1.292.0
func ResolveTeams(scope entities.ResourceScope, teamID string, userTeams []string) []string
ResolveTeams returns the GitHub team slugs to inject into a session's settings.
The rule mirrors what session_controller.go does for direct API requests:
- team-scoped: exactly the designated team's settings apply → [teamID]
- user-scoped: the user's full team membership list applies → userTeams
Every trigger source (schedule, webhook, slackbot) must call this function when building a LaunchRequest so that team-level settings (Bedrock, MCP servers, etc.) are always injected correctly.
Types ¶
type CreateSessionUseCase ¶
type CreateSessionUseCase struct {
// contains filtered or unexported fields
}
CreateSessionUseCase handles session creation
func NewCreateSessionUseCase ¶
func NewCreateSessionUseCase( sessionManager repositories.SessionManager, shareRepo repositories.ShareRepository, ) *CreateSessionUseCase
NewCreateSessionUseCase creates a new CreateSessionUseCase
type DeleteSessionUseCase ¶
type DeleteSessionUseCase struct {
// contains filtered or unexported fields
}
DeleteSessionUseCase handles session deletion
func NewDeleteSessionUseCase ¶
func NewDeleteSessionUseCase( sessionManager repositories.SessionManager, shareRepo repositories.ShareRepository, ) *DeleteSessionUseCase
NewDeleteSessionUseCase creates a new DeleteSessionUseCase
func (*DeleteSessionUseCase) Execute ¶
func (uc *DeleteSessionUseCase) Execute(sessionID string) error
Execute deletes a session by ID
type GetSessionUseCase ¶ added in v1.148.0
type GetSessionUseCase struct {
// contains filtered or unexported fields
}
GetSessionUseCase handles getting a single session
func NewGetSessionUseCase ¶ added in v1.148.0
func NewGetSessionUseCase(sessionManager repositories.SessionManager) *GetSessionUseCase
NewGetSessionUseCase creates a new GetSessionUseCase
type LaunchRequest ¶ added in v1.292.0
type LaunchRequest struct {
// Identity
UserID string
Scope entities.ResourceScope
TeamID string
// Teams is the list of GitHub team slugs for settings injection.
// MUST be populated via ResolveTeams() — never leave empty for team-scoped sessions.
Teams []string
// Session configuration
Environment map[string]string
Tags map[string]string
InitialMessage string
GithubToken string
AgentType string
SlackParams *entities.SlackParams
Oneshot bool
RepoInfo *entities.RepositoryInfo
InitialMessageWaitSecond *int
// Webhook payload to mount in the session filesystem (optional)
WebhookPayload []byte
// MemoryKey is an optional tag map used to identify memories for this session.
// When non-empty, memories matching these tags are injected into CLAUDE.md at startup.
// When empty, memory integration is disabled.
MemoryKey map[string]string
// Session reuse: when ReuseSession is true and ReuseMatchTags is non-empty,
// an existing active session matching those tags is sent ReuseMessage instead
// of creating a new session.
ReuseSession bool
ReuseMatchTags map[string]string
// ReuseMessage is sent to the reused session. Falls back to InitialMessage when empty.
ReuseMessage string
// Session limit: when MaxSessions > 0, launch fails if the number of sessions
// matching LimitMatchTags already equals or exceeds MaxSessions.
MaxSessions int
LimitMatchTags map[string]string
}
LaunchRequest contains all parameters needed to create a session from any external trigger source (schedule, webhook, slackbot, etc.). Callers should use ResolveTeams() to populate the Teams field correctly.
type LaunchResult ¶ added in v1.292.0
LaunchResult is returned by LaunchUseCase.Launch.
type LaunchUseCase ¶ added in v1.292.0
type LaunchUseCase struct {
// contains filtered or unexported fields
}
LaunchUseCase creates sessions from external triggers. It centralises the concerns shared by all trigger sources:
- session-reuse check
- session-limit enforcement
- RunServerRequest construction (Teams is always set via the caller's ResolveTeams call)
- auto-creation of missing memories when MemoryKey is set (requires memoryRepo)
func NewLaunchUseCase ¶ added in v1.292.0
func NewLaunchUseCase(sessionManager repositories.SessionManager) *LaunchUseCase
NewLaunchUseCase creates a new LaunchUseCase.
func (*LaunchUseCase) Launch ¶ added in v1.292.0
func (uc *LaunchUseCase) Launch(ctx context.Context, sessionID string, req LaunchRequest) (LaunchResult, error)
Launch creates or reuses a session according to the LaunchRequest.
Execution order:
- Try to reuse an existing active session (when ReuseSession is true).
- Check the session limit (when MaxSessions > 0).
- Create a new session.
func (*LaunchUseCase) WithMemoryRepository ¶ added in v1.323.0
func (uc *LaunchUseCase) WithMemoryRepository(repo repositories.MemoryRepository) *LaunchUseCase
WithMemoryRepository configures the memory repository used to auto-create memory entries when a session is launched with a MemoryKey that has no matching memory. Calling this is optional; if not called, memory auto-creation is disabled.
type ListSessionsUseCase ¶
type ListSessionsUseCase struct {
// contains filtered or unexported fields
}
ListSessionsUseCase handles session listing
func NewListSessionsUseCase ¶
func NewListSessionsUseCase(sessionManager repositories.SessionManager) *ListSessionsUseCase
NewListSessionsUseCase creates a new ListSessionsUseCase
func (*ListSessionsUseCase) Execute ¶
func (uc *ListSessionsUseCase) Execute(filter entities.SessionFilter) []entities.Session
Execute lists sessions matching the filter
type ValidateTeamAccessUseCase ¶ added in v1.148.0
type ValidateTeamAccessUseCase struct{}
ValidateTeamAccessUseCase validates team access for session operations
func NewValidateTeamAccessUseCase ¶ added in v1.148.0
func NewValidateTeamAccessUseCase() *ValidateTeamAccessUseCase
NewValidateTeamAccessUseCase creates a new ValidateTeamAccessUseCase
func (*ValidateTeamAccessUseCase) ValidateTeamScope ¶ added in v1.148.0
func (uc *ValidateTeamAccessUseCase) ValidateTeamScope( scope entities.ResourceScope, teamID string, userTeams []string, isAuthenticated bool, ) error
ValidateTeamScope validates that user can create team-scoped sessions