Documentation
¶
Index ¶
- Constants
- func ExtractTeamEnvFile(tags map[string]string) string
- func MergeEnvironmentVariables(cfg EnvMergeConfig) (map[string]string, error)
- type AgentSession
- type AuthInfoHandlers
- type AuthStatusResponse
- type AuthType
- type AuthTypesResponse
- type CustomHandler
- type EnvMergeConfig
- type HandlerRegistry
- type HealthHandlers
- type NotificationHandlers
- func (h *NotificationHandlers) DeleteSubscription(c echo.Context) error
- func (h *NotificationHandlers) GetHistory(c echo.Context) error
- func (h *NotificationHandlers) GetSubscriptions(c echo.Context) error
- func (h *NotificationHandlers) Subscribe(c echo.Context) error
- func (h *NotificationHandlers) Webhook(c echo.Context) error
- type OAuthCallbackRequest
- type OAuthLoginRequest
- type OAuthLoginResponse
- type OAuthSession
- type OAuthSessionResponse
- type OAuthTokenResponse
- type Proxy
- func (p *Proxy) CreateSession(sessionID string, startReq StartRequest, userID, userRole string) (*AgentSession, error)
- func (p *Proxy) DeleteSessionByID(sessionID string) error
- func (p *Proxy) GetContainer() *di.Container
- func (p *Proxy) GetEcho() *echo.Echo
- func (p *Proxy) GetSessions() map[string]*AgentSession
- func (p *Proxy) GetSessionsMutex() *sync.RWMutex
- func (p *Proxy) Shutdown(timeout time.Duration) error
- func (p *Proxy) StartMonitoring()
- type RepositoryInfo
- type Router
- type ScriptTemplateData
- type SessionHandlers
- func (h *SessionHandlers) DeleteSession(c echo.Context) error
- func (h *SessionHandlers) GetName() string
- func (h *SessionHandlers) RegisterRoutes(e *echo.Echo, proxy *Proxy) error
- func (h *SessionHandlers) RouteToSession(c echo.Context) error
- func (h *SessionHandlers) SearchSessions(c echo.Context) error
- func (h *SessionHandlers) StartSession(c echo.Context) error
- type StartRequest
- type StartupConfig
- type StartupManager
Constants ¶
const ( ScriptWithGithub = "agentapi_with_github.sh" ScriptDefault = "agentapi_default.sh" )
Variables ¶
This section is empty.
Functions ¶
func ExtractTeamEnvFile ¶ added in v1.48.0
ExtractTeamEnvFile extracts the env_file value from tags
func MergeEnvironmentVariables ¶ added in v1.48.0
func MergeEnvironmentVariables(cfg EnvMergeConfig) (map[string]string, error)
MergeEnvironmentVariables merges environment variables from multiple sources with the following priority (highest to lowest): 1. Request environment variables 2. Team/organization specific environment file (from tags["env_file"]) 3. Auth team environment file (from team_role_mapping) 4. Role-based environment variables
Types ¶
type AgentSession ¶
type AgentSession struct {
ID string
Port int
Process *exec.Cmd
Cancel context.CancelFunc
StartedAt time.Time
UserID string
Status string
Environment map[string]string
Tags map[string]string
// contains filtered or unexported fields
}
AgentSession represents a running agentapi server instance
type AuthInfoHandlers ¶ added in v1.9.1
type AuthInfoHandlers struct {
// contains filtered or unexported fields
}
func NewAuthInfoHandlers ¶ added in v1.9.1
func NewAuthInfoHandlers(cfg *config.Config) *AuthInfoHandlers
func (*AuthInfoHandlers) GetAuthStatus ¶ added in v1.9.1
func (h *AuthInfoHandlers) GetAuthStatus(c echo.Context) error
func (*AuthInfoHandlers) GetAuthTypes ¶ added in v1.9.1
func (h *AuthInfoHandlers) GetAuthTypes(c echo.Context) error
type AuthStatusResponse ¶ added in v1.9.1
type AuthStatusResponse struct {
Authenticated bool `json:"authenticated"`
AuthType string `json:"auth_type,omitempty"`
UserID string `json:"user_id,omitempty"`
Role string `json:"role,omitempty"`
Permissions []string `json:"permissions,omitempty"`
GitHubUser *auth.GitHubUserInfo `json:"github_user,omitempty"`
}
type AuthTypesResponse ¶ added in v1.9.1
type CustomHandler ¶ added in v1.76.0
CustomHandler interface for adding custom routes
type EnvMergeConfig ¶ added in v1.48.0
type EnvMergeConfig struct {
RoleEnvFiles *config.RoleEnvFilesConfig
UserRole string
TeamEnvFile string // From tags["env_file"]
AuthTeamEnvFile string // From team_role_mapping
RequestEnv map[string]string
}
EnvMergeConfig contains configuration for environment variable merging
type HandlerRegistry ¶ added in v1.76.0
type HandlerRegistry struct {
// contains filtered or unexported fields
}
HandlerRegistry contains all handlers
type HealthHandlers ¶ added in v1.76.0
type HealthHandlers struct{}
HealthHandlers handles health check endpoints
func NewHealthHandlers ¶ added in v1.76.0
func NewHealthHandlers() *HealthHandlers
NewHealthHandlers creates a new HealthHandlers instance
func (*HealthHandlers) HealthCheck ¶ added in v1.76.0
func (h *HealthHandlers) HealthCheck(c echo.Context) error
HealthCheck handles GET /health requests to check server health
type NotificationHandlers ¶ added in v1.59.0
type NotificationHandlers struct {
// contains filtered or unexported fields
}
NotificationHandlers handles notification-related HTTP requests
func NewNotificationHandlers ¶ added in v1.59.0
func NewNotificationHandlers(service *notification.Service) *NotificationHandlers
NewNotificationHandlers creates new notification handlers
func (*NotificationHandlers) DeleteSubscription ¶ added in v1.59.0
func (h *NotificationHandlers) DeleteSubscription(c echo.Context) error
DeleteSubscription handles DELETE /notification/subscribe
func (*NotificationHandlers) GetHistory ¶ added in v1.59.0
func (h *NotificationHandlers) GetHistory(c echo.Context) error
GetHistory handles GET /notifications/history
func (*NotificationHandlers) GetSubscriptions ¶ added in v1.59.0
func (h *NotificationHandlers) GetSubscriptions(c echo.Context) error
GetSubscriptions handles GET /notification/subscribe
type OAuthCallbackRequest ¶ added in v1.9.1
OAuthCallbackRequest represents the OAuth callback parameters
type OAuthLoginRequest ¶ added in v1.9.1
type OAuthLoginRequest struct {
RedirectURI string `json:"redirect_uri"`
}
OAuthLoginRequest represents the request body for OAuth login
type OAuthLoginResponse ¶ added in v1.9.1
OAuthLoginResponse represents the response for OAuth login
type OAuthSession ¶ added in v1.9.1
type OAuthSession struct {
ID string
UserContext *auth.UserContext
CreatedAt time.Time
ExpiresAt time.Time
}
OAuthSession represents an authenticated OAuth session
type OAuthSessionResponse ¶ added in v1.9.1
type OAuthSessionResponse struct {
SessionID string `json:"session_id"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresAt time.Time `json:"expires_at"`
User *auth.UserContext `json:"user"`
}
OAuthSessionResponse represents the response with session information
type OAuthTokenResponse ¶ added in v1.9.1
type OAuthTokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresAt time.Time `json:"expires_at"`
User *auth.UserContext `json:"user"`
}
OAuthTokenResponse represents the response after successful OAuth
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy represents the HTTP proxy server
func (*Proxy) CreateSession ¶ added in v1.76.0
func (p *Proxy) CreateSession(sessionID string, startReq StartRequest, userID, userRole string) (*AgentSession, error)
CreateSession creates a new agent session
func (*Proxy) DeleteSessionByID ¶ added in v1.76.0
DeleteSessionByID deletes a session by ID
func (*Proxy) GetContainer ¶ added in v1.76.0
GetContainer returns the DI container
func (*Proxy) GetSessions ¶ added in v1.76.0
func (p *Proxy) GetSessions() map[string]*AgentSession
GetSessions returns the sessions map
func (*Proxy) GetSessionsMutex ¶ added in v1.76.0
GetSessionsMutex returns the sessions mutex
func (*Proxy) Shutdown ¶
Shutdown gracefully stops all running sessions and waits for them to terminate
func (*Proxy) StartMonitoring ¶ added in v1.62.0
func (p *Proxy) StartMonitoring()
StartMonitoring starts the session monitoring (called after proxy is fully initialized)
type RepositoryInfo ¶ added in v0.10.0
RepositoryInfo contains repository information extracted from tags
type Router ¶ added in v1.76.0
type Router struct {
// contains filtered or unexported fields
}
Router handles route registration and management
func (*Router) AddCustomHandler ¶ added in v1.76.0
func (r *Router) AddCustomHandler(handler CustomHandler)
AddCustomHandler adds a custom handler to the registry
func (*Router) RegisterRoutes ¶ added in v1.76.0
RegisterRoutes registers all routes
type ScriptTemplateData ¶ added in v0.10.0
type ScriptTemplateData struct {
AgentAPIArgs string
ClaudeArgs string
GitHubToken string
GitHubAppID string
GitHubInstallationID string
GitHubAppPEMPath string
GitHubAPI string
GitHubPersonalAccessToken string
RepoFullName string
CloneDir string
UserID string
MCPConfigs string
}
ScriptTemplateData holds data for script templates
type SessionHandlers ¶ added in v1.77.0
type SessionHandlers struct {
// contains filtered or unexported fields
}
SessionHandlers handles session management endpoints without persistence
func NewSessionHandlers ¶ added in v1.77.0
func NewSessionHandlers(proxy *Proxy) *SessionHandlers
NewSessionHandlers creates a new SessionHandlers instance
func (*SessionHandlers) DeleteSession ¶ added in v1.77.0
func (h *SessionHandlers) DeleteSession(c echo.Context) error
DeleteSession handles DELETE /sessions/:sessionId requests to terminate a session
func (*SessionHandlers) GetName ¶ added in v1.77.0
func (h *SessionHandlers) GetName() string
GetName returns the name of this handler for logging
func (*SessionHandlers) RegisterRoutes ¶ added in v1.77.0
func (h *SessionHandlers) RegisterRoutes(e *echo.Echo, proxy *Proxy) error
RegisterRoutes registers session management routes
func (*SessionHandlers) RouteToSession ¶ added in v1.77.0
func (h *SessionHandlers) RouteToSession(c echo.Context) error
RouteToSession routes requests to the appropriate agentapi server instance
func (*SessionHandlers) SearchSessions ¶ added in v1.77.0
func (h *SessionHandlers) SearchSessions(c echo.Context) error
SearchSessions handles GET /search requests to list and filter active sessions (memory only)
func (*SessionHandlers) StartSession ¶ added in v1.77.0
func (h *SessionHandlers) StartSession(c echo.Context) error
StartSession handles POST /start requests to start a new agentapi server
type StartRequest ¶
type StartRequest struct {
Environment map[string]string `json:"environment,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Message string `json:"message,omitempty"`
}
StartRequest represents the request body for starting a new agentapi server
type StartupConfig ¶ added in v1.41.3
type StartupConfig struct {
Port int
UserID string
RepoFullName string
CloneDir string
GitHubToken string
GitHubAppID string
GitHubInstallationID string
GitHubAppPEMPath string
GitHubAPI string
GitHubPersonalAccessToken string
MCPConfigs string
AgentAPIArgs string
ClaudeArgs string
Environment map[string]string
Config *config.Config
Verbose bool
IsRestore bool // Whether this is a restored session
}
StartupConfig holds configuration for session startup
type StartupManager ¶ added in v1.41.3
type StartupManager struct {
// contains filtered or unexported fields
}
StartupManager manages the startup process
func NewStartupManager ¶ added in v1.41.3
func NewStartupManager(config *config.Config, verbose bool) *StartupManager
NewStartupManager creates a new startup manager
func (*StartupManager) StartAgentAPISession ¶ added in v1.41.3
func (sm *StartupManager) StartAgentAPISession(ctx context.Context, cfg *StartupConfig) (*exec.Cmd, error)
StartAgentAPISession starts an AgentAPI session with the given configuration