Documentation
¶
Overview ¶
Package services provides the server-side service implementations.
Package services provides the server-side service implementations.
Index ¶
- Variables
- func ExpandPath(arg string) string
- func ExtractDomainsFromCommand(cmd string) []string
- func FormatSecretDenyMessage(patternName string) string
- func InjectHookConfig(rootDir, sessionTitle string) error
- func InjectHooksConfig(rootDir, sessionTitle string, hooks []HookName) error
- func InjectMCPConfig(rootDir, binaryPath string) error
- func LoadClaudeSettingsRules(projectDir string) []classifier.Rule
- func RemoveMCPConfig(rootDir string) error
- func StartExpirationCleanup(ctx context.Context, store *ApprovalStore)
- func WriteSnapshot(snap *DebugSnapshot, dir string) (string, error)
- type AnalyticsEntry
- type AnalyticsStore
- func (s *AnalyticsStore) DroppedCount() int64
- func (s *AnalyticsStore) LoadWindow(since time.Time) ([]AnalyticsEntry, error)
- func (s *AnalyticsStore) Record(entry AnalyticsEntry)
- func (s *AnalyticsStore) RecordFromResult(payload classifier.PermissionRequestPayload, ...)
- func (s *AnalyticsStore) RecordManualDecision(approvalID, sessionID, toolName, cwd, decision string)
- func (s *AnalyticsStore) Start(ctx interface{ ... })
- type AnalyticsSummary
- type ApprovalDecision
- type ApprovalDetail
- type ApprovalHandler
- func (h *ApprovalHandler) HandlePermissionRequest(w http.ResponseWriter, r *http.Request)
- func (h *ApprovalHandler) SetAnalyticsStore(a *AnalyticsStore)
- func (h *ApprovalHandler) SetClassifier(c classifier.Classifier)
- func (h *ApprovalHandler) SetDomainChecker(d *DomainAgeChecker)
- func (h *ApprovalHandler) SetNotificationStamper(s approvalNotificationStamper)
- func (h *ApprovalHandler) SetQueueChecker(checker ReviewQueueChecker)
- type ApprovalService
- func (as *ApprovalService) ListPendingApprovals(ctx context.Context, ...) (*connect.Response[sessionv1.ListPendingApprovalsResponse], error)
- func (as *ApprovalService) ResolveApproval(ctx context.Context, req *connect.Request[sessionv1.ResolveApprovalRequest]) (*connect.Response[sessionv1.ResolveApprovalResponse], error)
- func (as *ApprovalService) SetNotificationStore(store notificationMetadataStore)
- type ApprovalSnapshot
- type ApprovalStore
- func (s *ApprovalStore) CancelSession(sessionID string) []string
- func (s *ApprovalStore) CleanupExpired() []string
- func (s *ApprovalStore) Create(a *PendingApproval) error
- func (s *ApprovalStore) Get(id string) (*PendingApproval, bool)
- func (s *ApprovalStore) GetApprovalMetadataBySession(sessionID string) []session.ApprovalMetadata
- func (s *ApprovalStore) GetBySession(sessionID string) []*PendingApproval
- func (s *ApprovalStore) GetFilePath() string
- func (s *ApprovalStore) ListAll() []*PendingApproval
- func (s *ApprovalStore) Remove(id string)
- func (s *ApprovalStore) Resolve(id string, decision ApprovalDecision) error
- type CircuitBreakerHandler
- type ClaudePermissions
- type CommandStat
- type ConfigService
- func (cs *ConfigService) GetClaudeConfig(ctx context.Context, req *connect.Request[sessionv1.GetClaudeConfigRequest]) (*connect.Response[sessionv1.GetClaudeConfigResponse], error)
- func (cs *ConfigService) ListClaudeConfigs(ctx context.Context, req *connect.Request[sessionv1.ListClaudeConfigsRequest]) (*connect.Response[sessionv1.ListClaudeConfigsResponse], error)
- func (cs *ConfigService) UpdateClaudeConfig(ctx context.Context, req *connect.Request[sessionv1.UpdateClaudeConfigRequest]) (*connect.Response[sessionv1.UpdateClaudeConfigResponse], error)
- type ConnectRPCWebSocketHandler
- type DailyBucket
- type DatabaseService
- func (ds *DatabaseService) GetCurrentDatabase(ctx context.Context, req *connect.Request[sessionv1.GetCurrentDatabaseRequest]) (*connect.Response[sessionv1.GetCurrentDatabaseResponse], error)
- func (ds *DatabaseService) ListDatabases(ctx context.Context, req *connect.Request[sessionv1.ListDatabasesRequest]) (*connect.Response[sessionv1.ListDatabasesResponse], error)
- func (ds *DatabaseService) MergeDatabase(ctx context.Context, req *connect.Request[sessionv1.MergeDatabaseRequest]) (*connect.Response[sessionv1.MergeDatabaseResponse], error)
- func (ds *DatabaseService) SwitchDatabase(ctx context.Context, req *connect.Request[sessionv1.SwitchDatabaseRequest]) (*connect.Response[sessionv1.SwitchDatabaseResponse], error)
- type DebugSnapshot
- type DefaultsService
- func (d *DefaultsService) DeleteDirectoryRule(ctx context.Context, ...) (*connect.Response[sessionv1.DeleteDirectoryRuleResponse], error)
- func (d *DefaultsService) DeleteProfile(ctx context.Context, req *connect.Request[sessionv1.DeleteProfileRequest]) (*connect.Response[sessionv1.DeleteProfileResponse], error)
- func (d *DefaultsService) GetSessionDefaults(ctx context.Context, req *connect.Request[sessionv1.GetSessionDefaultsRequest]) (*connect.Response[sessionv1.GetSessionDefaultsResponse], error)
- func (d *DefaultsService) ResolveDefaults(ctx context.Context, req *connect.Request[sessionv1.ResolveDefaultsRequest]) (*connect.Response[sessionv1.ResolveDefaultsResponse], error)
- func (d *DefaultsService) UpdateGlobalDefaults(ctx context.Context, ...) (*connect.Response[sessionv1.UpdateGlobalDefaultsResponse], error)
- func (d *DefaultsService) UpsertDirectoryRule(ctx context.Context, ...) (*connect.Response[sessionv1.UpsertDirectoryRuleResponse], error)
- func (d *DefaultsService) UpsertProfile(ctx context.Context, req *connect.Request[sessionv1.UpsertProfileRequest]) (*connect.Response[sessionv1.UpsertProfileResponse], error)
- type DirCache
- type DomainAgeChecker
- type EscapeCodeHandler
- func (h *EscapeCodeHandler) HandleClear(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleExport(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleGetAll(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleGetByCategory(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleGetBySession(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleGetStats(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleStatus(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) HandleToggle(w http.ResponseWriter, r *http.Request)
- func (h *EscapeCodeHandler) RegisterRoutes(mux *http.ServeMux)
- type ExternalWebSocketHandler
- type FileService
- func (fs *FileService) GetFileContent(ctx context.Context, req *connect.Request[sessionv1.GetFileContentRequest]) (*connect.Response[sessionv1.GetFileContentResponse], error)
- func (fs *FileService) ListFiles(ctx context.Context, req *connect.Request[sessionv1.ListFilesRequest]) (*connect.Response[sessionv1.ListFilesResponse], error)
- func (fs *FileService) SearchFiles(ctx context.Context, req *connect.Request[sessionv1.SearchFilesRequest]) (*connect.Response[sessionv1.SearchFilesResponse], error)
- type GitHubService
- func (gs *GitHubService) ClosePR(ctx context.Context, req *connect.Request[sessionv1.ClosePRRequest]) (*connect.Response[sessionv1.ClosePRResponse], error)
- func (gs *GitHubService) GetPRComments(ctx context.Context, req *connect.Request[sessionv1.GetPRCommentsRequest]) (*connect.Response[sessionv1.GetPRCommentsResponse], error)
- func (gs *GitHubService) GetPRInfo(ctx context.Context, req *connect.Request[sessionv1.GetPRInfoRequest]) (*connect.Response[sessionv1.GetPRInfoResponse], error)
- func (gs *GitHubService) MergePR(ctx context.Context, req *connect.Request[sessionv1.MergePRRequest]) (*connect.Response[sessionv1.MergePRResponse], error)
- func (gs *GitHubService) PostPRComment(ctx context.Context, req *connect.Request[sessionv1.PostPRCommentRequest]) (*connect.Response[sessionv1.PostPRCommentResponse], error)
- type HookName
- type HookReceiver
- func (h *HookReceiver) HandlePostToolUse(w http.ResponseWriter, r *http.Request)
- func (h *HookReceiver) HandlePreToolUse(w http.ResponseWriter, r *http.Request)
- func (h *HookReceiver) HandlePromptSubmit(w http.ResponseWriter, r *http.Request)
- func (h *HookReceiver) HandleStop(w http.ResponseWriter, r *http.Request)
- func (h *HookReceiver) RegisterRoutes(mux *http.ServeMux)
- type ImageUploadHandler
- type ImportStat
- type NotificationRateLimiter
- type NotificationService
- func (ns *NotificationService) ClearNotificationHistory(ctx context.Context, ...) (*connect.Response[sessionv1.ClearNotificationHistoryResponse], error)
- func (ns *NotificationService) GetNotificationHistory(ctx context.Context, ...) (*connect.Response[sessionv1.GetNotificationHistoryResponse], error)
- func (ns *NotificationService) GetNotificationStore() *notifications.NotificationHistoryStore
- func (ns *NotificationService) MarkNotificationRead(ctx context.Context, ...) (*connect.Response[sessionv1.MarkNotificationReadResponse], error)
- func (ns *NotificationService) SendNotification(ctx context.Context, req *connect.Request[sessionv1.SendNotificationRequest]) (*connect.Response[sessionv1.SendNotificationResponse], error)
- func (ns *NotificationService) SetNotificationStore(store *notifications.NotificationHistoryStore)
- func (ns *NotificationService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
- type PathClassification
- type PathCompletionService
- func (p *PathCompletionService) ListPathCompletions(ctx context.Context, ...) (*connect.Response[sessionv1.ListPathCompletionsResponse], error)
- func (p *PathCompletionService) ListWorktrees(ctx context.Context, req *connect.Request[sessionv1.ListWorktreesRequest]) (*connect.Response[sessionv1.ListWorktreesResponse], error)
- type PathMatcher
- type PendingApproval
- type PersistedApproval
- type ProgramStat
- type ProjectService
- func (s *ProjectService) AssignSessionsToProject(ctx context.Context, ...) (*connect.Response[sessionv1.AssignSessionsToProjectResponse], error)
- func (s *ProjectService) CreateProject(ctx context.Context, req *connect.Request[sessionv1.CreateProjectRequest]) (*connect.Response[sessionv1.CreateProjectResponse], error)
- func (s *ProjectService) DeleteProject(ctx context.Context, req *connect.Request[sessionv1.DeleteProjectRequest]) (*connect.Response[sessionv1.DeleteProjectResponse], error)
- func (s *ProjectService) ListProjects(ctx context.Context, req *connect.Request[sessionv1.ListProjectsRequest]) (*connect.Response[sessionv1.ListProjectsResponse], error)
- func (s *ProjectService) UpdateProject(ctx context.Context, req *connect.Request[sessionv1.UpdateProjectRequest]) (*connect.Response[sessionv1.UpdateProjectResponse], error)
- type PushHandler
- type PushNotification
- type PushService
- type PushSubscription
- type ReactiveQueueManager
- type RecentLogsSnapshot
- type ReviewQueueChecker
- type ReviewQueueService
- func (rqs *ReviewQueueService) AcknowledgeSession(ctx context.Context, req *connect.Request[sessionv1.AcknowledgeSessionRequest]) (*connect.Response[sessionv1.AcknowledgeSessionResponse], error)
- func (rqs *ReviewQueueService) GetQueue() *session.ReviewQueue
- func (rqs *ReviewQueueService) GetReviewQueue(ctx context.Context, req *connect.Request[sessionv1.GetReviewQueueRequest]) (*connect.Response[sessionv1.GetReviewQueueResponse], error)
- func (rqs *ReviewQueueService) LogUserInteraction(ctx context.Context, req *connect.Request[sessionv1.LogUserInteractionRequest]) (*connect.Response[sessionv1.LogUserInteractionResponse], error)
- func (rqs *ReviewQueueService) SetApprovalStore(store *ApprovalStore)
- func (rqs *ReviewQueueService) SetReactiveQueueManager(mgr ReactiveQueueManager)
- func (rqs *ReviewQueueService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
- func (rqs *ReviewQueueService) WatchReviewQueue(ctx context.Context, req *connect.Request[sessionv1.WatchReviewQueueRequest], ...) error
- type RuleSpec
- type RuleStat
- type RulesFile
- type RulesService
- func (rs *RulesService) DeleteApprovalRule(ctx context.Context, req *connect.Request[sessionv1.DeleteApprovalRuleRequest]) (*connect.Response[sessionv1.DeleteApprovalRuleResponse], error)
- func (rs *RulesService) GetApprovalAnalytics(ctx context.Context, ...) (*connect.Response[sessionv1.GetApprovalAnalyticsResponse], error)
- func (rs *RulesService) ListApprovalRules(ctx context.Context, req *connect.Request[sessionv1.ListApprovalRulesRequest]) (*connect.Response[sessionv1.ListApprovalRulesResponse], error)
- func (rs *RulesService) UpsertApprovalRule(ctx context.Context, req *connect.Request[sessionv1.UpsertApprovalRuleRequest]) (*connect.Response[sessionv1.UpsertApprovalRuleResponse], error)
- type RulesStore
- type SearchService
- func (ss *SearchService) GetClaudeHistoryDetail(ctx context.Context, ...) (*connect.Response[sessionv1.GetClaudeHistoryDetailResponse], error)
- func (ss *SearchService) GetClaudeHistoryMessages(ctx context.Context, ...) (*connect.Response[sessionv1.GetClaudeHistoryMessagesResponse], error)
- func (ss *SearchService) ListClaudeHistory(ctx context.Context, req *connect.Request[sessionv1.ListClaudeHistoryRequest]) (*connect.Response[sessionv1.ListClaudeHistoryResponse], error)
- func (ss *SearchService) SearchClaudeHistory(ctx context.Context, ...) (*connect.Response[sessionv1.SearchClaudeHistoryResponse], error)
- type SecretScanResult
- type ServerInfo
- type SessionService
- func (s *SessionService) AcknowledgeSession(ctx context.Context, req *connect.Request[sessionv1.AcknowledgeSessionRequest]) (*connect.Response[sessionv1.AcknowledgeSessionResponse], error)
- func (s *SessionService) AssignSessionsToProject(ctx context.Context, ...) (*connect.Response[sessionv1.AssignSessionsToProjectResponse], error)
- func (s *SessionService) BatchCreateSessions(ctx context.Context, ...) (*connect.Response[sessionv1.BatchCreateSessionsResponse], error)
- func (s *SessionService) ClearNotificationHistory(ctx context.Context, ...) (*connect.Response[sessionv1.ClearNotificationHistoryResponse], error)
- func (s *SessionService) ClosePR(ctx context.Context, req *connect.Request[sessionv1.ClosePRRequest]) (*connect.Response[sessionv1.ClosePRResponse], error)
- func (s *SessionService) CreateCheckpoint(ctx context.Context, req *connect.Request[sessionv1.CreateCheckpointRequest]) (*connect.Response[sessionv1.CreateCheckpointResponse], error)
- func (s *SessionService) CreateDebugSnapshot(ctx context.Context, ...) (*connect.Response[sessionv1.CreateDebugSnapshotResponse], error)
- func (s *SessionService) CreateProject(ctx context.Context, req *connect.Request[sessionv1.CreateProjectRequest]) (*connect.Response[sessionv1.CreateProjectResponse], error)
- func (s *SessionService) CreateSession(ctx context.Context, req *connect.Request[sessionv1.CreateSessionRequest]) (*connect.Response[sessionv1.CreateSessionResponse], error)
- func (s *SessionService) DeleteApprovalRule(ctx context.Context, req *connect.Request[sessionv1.DeleteApprovalRuleRequest]) (*connect.Response[sessionv1.DeleteApprovalRuleResponse], error)
- func (s *SessionService) DeleteDirectoryRule(ctx context.Context, ...) (*connect.Response[sessionv1.DeleteDirectoryRuleResponse], error)
- func (s *SessionService) DeleteProfile(ctx context.Context, req *connect.Request[sessionv1.DeleteProfileRequest]) (*connect.Response[sessionv1.DeleteProfileResponse], error)
- func (s *SessionService) DeleteProject(ctx context.Context, req *connect.Request[sessionv1.DeleteProjectRequest]) (*connect.Response[sessionv1.DeleteProjectResponse], error)
- func (s *SessionService) DeletePromptHistory(ctx context.Context, ...) (*connect.Response[sessionv1.DeletePromptHistoryResponse], error)
- func (s *SessionService) DeleteSession(ctx context.Context, req *connect.Request[sessionv1.DeleteSessionRequest]) (*connect.Response[sessionv1.DeleteSessionResponse], error)
- func (s *SessionService) FindLiveInstance(id string) *session.Instance
- func (s *SessionService) FocusWindow(ctx context.Context, req *connect.Request[sessionv1.FocusWindowRequest]) (*connect.Response[sessionv1.FocusWindowResponse], error)
- func (s *SessionService) ForkSession(ctx context.Context, req *connect.Request[sessionv1.ForkSessionRequest]) (*connect.Response[sessionv1.ForkSessionResponse], error)
- func (s *SessionService) GetAnalyticsStore() *AnalyticsStore
- func (s *SessionService) GetApprovalAnalytics(ctx context.Context, ...) (*connect.Response[sessionv1.GetApprovalAnalyticsResponse], error)
- func (s *SessionService) GetApprovalStore() *ApprovalStore
- func (s *SessionService) GetClassifier() *classifier.RuleBasedClassifier
- func (s *SessionService) GetClaudeConfig(ctx context.Context, req *connect.Request[sessionv1.GetClaudeConfigRequest]) (*connect.Response[sessionv1.GetClaudeConfigResponse], error)
- func (s *SessionService) GetClaudeHistoryDetail(ctx context.Context, ...) (*connect.Response[sessionv1.GetClaudeHistoryDetailResponse], error)
- func (s *SessionService) GetClaudeHistoryMessages(ctx context.Context, ...) (*connect.Response[sessionv1.GetClaudeHistoryMessagesResponse], error)
- func (s *SessionService) GetCurrentDatabase(ctx context.Context, req *connect.Request[sessionv1.GetCurrentDatabaseRequest]) (*connect.Response[sessionv1.GetCurrentDatabaseResponse], error)
- func (s *SessionService) GetEventBus() *events.EventBus
- func (s *SessionService) GetFileContent(ctx context.Context, req *connect.Request[sessionv1.GetFileContentRequest]) (*connect.Response[sessionv1.GetFileContentResponse], error)
- func (s *SessionService) GetInstanceStore() session.InstanceStore
- func (s *SessionService) GetLogs(ctx context.Context, req *connect.Request[sessionv1.GetLogsRequest]) (*connect.Response[sessionv1.GetLogsResponse], error)
- func (s *SessionService) GetNotificationHistory(ctx context.Context, ...) (*connect.Response[sessionv1.GetNotificationHistoryResponse], error)
- func (s *SessionService) GetNotificationStore() *notifications.NotificationHistoryStore
- func (s *SessionService) GetPRComments(ctx context.Context, req *connect.Request[sessionv1.GetPRCommentsRequest]) (*connect.Response[sessionv1.GetPRCommentsResponse], error)
- func (s *SessionService) GetPRInfo(ctx context.Context, req *connect.Request[sessionv1.GetPRInfoRequest]) (*connect.Response[sessionv1.GetPRInfoResponse], error)
- func (s *SessionService) GetReviewQueue(ctx context.Context, req *connect.Request[sessionv1.GetReviewQueueRequest]) (*connect.Response[sessionv1.GetReviewQueueResponse], error)
- func (s *SessionService) GetReviewQueueInstance() *session.ReviewQueue
- func (s *SessionService) GetSession(ctx context.Context, req *connect.Request[sessionv1.GetSessionRequest]) (*connect.Response[sessionv1.GetSessionResponse], error)
- func (s *SessionService) GetSessionDefaults(ctx context.Context, req *connect.Request[sessionv1.GetSessionDefaultsRequest]) (*connect.Response[sessionv1.GetSessionDefaultsResponse], error)
- func (s *SessionService) GetSessionDiff(ctx context.Context, req *connect.Request[sessionv1.GetSessionDiffRequest]) (*connect.Response[sessionv1.GetSessionDiffResponse], error)
- func (s *SessionService) GetStorage() *session.Storage
- func (s *SessionService) GetTerminalSnapshot(ctx context.Context, ...) (*connect.Response[sessionv1.GetTerminalSnapshotResponse], error)
- func (s *SessionService) GetVCSStatus(ctx context.Context, req *connect.Request[sessionv1.GetVCSStatusRequest]) (*connect.Response[sessionv1.GetVCSStatusResponse], error)
- func (s *SessionService) GetWorkspaceInfo(ctx context.Context, req *connect.Request[sessionv1.GetWorkspaceInfoRequest]) (*connect.Response[sessionv1.GetWorkspaceInfoResponse], error)
- func (s *SessionService) ListApprovalRules(ctx context.Context, req *connect.Request[sessionv1.ListApprovalRulesRequest]) (*connect.Response[sessionv1.ListApprovalRulesResponse], error)
- func (s *SessionService) ListBranches(ctx context.Context, req *connect.Request[sessionv1.ListBranchesRequest]) (*connect.Response[sessionv1.ListBranchesResponse], error)
- func (s *SessionService) ListCheckpoints(ctx context.Context, req *connect.Request[sessionv1.ListCheckpointsRequest]) (*connect.Response[sessionv1.ListCheckpointsResponse], error)
- func (s *SessionService) ListClaudeConfigs(ctx context.Context, req *connect.Request[sessionv1.ListClaudeConfigsRequest]) (*connect.Response[sessionv1.ListClaudeConfigsResponse], error)
- func (s *SessionService) ListClaudeHistory(ctx context.Context, req *connect.Request[sessionv1.ListClaudeHistoryRequest]) (*connect.Response[sessionv1.ListClaudeHistoryResponse], error)
- func (s *SessionService) ListDatabases(ctx context.Context, req *connect.Request[sessionv1.ListDatabasesRequest]) (*connect.Response[sessionv1.ListDatabasesResponse], error)
- func (s *SessionService) ListFiles(ctx context.Context, req *connect.Request[sessionv1.ListFilesRequest]) (*connect.Response[sessionv1.ListFilesResponse], error)
- func (s *SessionService) ListPathCompletions(ctx context.Context, ...) (*connect.Response[sessionv1.ListPathCompletionsResponse], error)
- func (s *SessionService) ListPendingApprovals(ctx context.Context, ...) (*connect.Response[sessionv1.ListPendingApprovalsResponse], error)
- func (s *SessionService) ListProjects(ctx context.Context, req *connect.Request[sessionv1.ListProjectsRequest]) (*connect.Response[sessionv1.ListProjectsResponse], error)
- func (s *SessionService) ListPromptHistory(ctx context.Context, req *connect.Request[sessionv1.ListPromptHistoryRequest]) (*connect.Response[sessionv1.ListPromptHistoryResponse], error)
- func (s *SessionService) ListSessions(ctx context.Context, req *connect.Request[sessionv1.ListSessionsRequest]) (*connect.Response[sessionv1.ListSessionsResponse], error)
- func (s *SessionService) ListWorkspaceTargets(ctx context.Context, ...) (*connect.Response[sessionv1.ListWorkspaceTargetsResponse], error)
- func (s *SessionService) ListWorktrees(ctx context.Context, req *connect.Request[sessionv1.ListWorktreesRequest]) (*connect.Response[sessionv1.ListWorktreesResponse], error)
- func (s *SessionService) LogUserInteraction(ctx context.Context, req *connect.Request[sessionv1.LogUserInteractionRequest]) (*connect.Response[sessionv1.LogUserInteractionResponse], error)
- func (s *SessionService) MarkNotificationRead(ctx context.Context, ...) (*connect.Response[sessionv1.MarkNotificationReadResponse], error)
- func (s *SessionService) MergeDatabase(ctx context.Context, req *connect.Request[sessionv1.MergeDatabaseRequest]) (*connect.Response[sessionv1.MergeDatabaseResponse], error)
- func (s *SessionService) MergePR(ctx context.Context, req *connect.Request[sessionv1.MergePRRequest]) (*connect.Response[sessionv1.MergePRResponse], error)
- func (s *SessionService) PostPRComment(ctx context.Context, req *connect.Request[sessionv1.PostPRCommentRequest]) (*connect.Response[sessionv1.PostPRCommentResponse], error)
- func (s *SessionService) RemoveFromAllPollers(id string)
- func (s *SessionService) RenameSession(ctx context.Context, req *connect.Request[sessionv1.RenameSessionRequest]) (*connect.Response[sessionv1.RenameSessionResponse], error)
- func (s *SessionService) ResolveApproval(ctx context.Context, req *connect.Request[sessionv1.ResolveApprovalRequest]) (*connect.Response[sessionv1.ResolveApprovalResponse], error)
- func (s *SessionService) ResolveDefaults(ctx context.Context, req *connect.Request[sessionv1.ResolveDefaultsRequest]) (*connect.Response[sessionv1.ResolveDefaultsResponse], error)
- func (s *SessionService) RestartSession(ctx context.Context, req *connect.Request[sessionv1.RestartSessionRequest]) (*connect.Response[sessionv1.RestartSessionResponse], error)
- func (s *SessionService) RunOneShot(ctx context.Context, req *connect.Request[sessionv1.RunOneShotRequest]) (*connect.Response[sessionv1.RunOneShotResponse], error)
- func (s *SessionService) SearchClaudeHistory(ctx context.Context, ...) (*connect.Response[sessionv1.SearchClaudeHistoryResponse], error)
- func (s *SessionService) SearchFiles(ctx context.Context, req *connect.Request[sessionv1.SearchFilesRequest]) (*connect.Response[sessionv1.SearchFilesResponse], error)
- func (s *SessionService) SendNotification(ctx context.Context, req *connect.Request[sessionv1.SendNotificationRequest]) (*connect.Response[sessionv1.SendNotificationResponse], error)
- func (s *SessionService) SetConfigService(svc *ConfigService)
- func (s *SessionService) SetExternalDiscovery(discovery *session.ExternalSessionDiscovery)
- func (s *SessionService) SetHistoryLinker(hl *session.HistoryLinker)
- func (s *SessionService) SetMCPServerURL(url string)
- func (s *SessionService) SetNotificationStore(store *notifications.NotificationHistoryStore)
- func (s *SessionService) SetReactiveQueueManager(mgr ReactiveQueueManager)
- func (s *SessionService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
- func (s *SessionService) SetScrollbackManager(mgr scrollbackSequencer)
- func (s *SessionService) SetStatusManager(mgr *session.InstanceStatusManager)
- func (s *SessionService) StreamTerminal(ctx context.Context, ...) error
- func (s *SessionService) SwitchDatabase(ctx context.Context, req *connect.Request[sessionv1.SwitchDatabaseRequest]) (*connect.Response[sessionv1.SwitchDatabaseResponse], error)
- func (s *SessionService) SwitchWorkspace(ctx context.Context, req *connect.Request[sessionv1.SwitchWorkspaceRequest]) (*connect.Response[sessionv1.SwitchWorkspaceResponse], error)
- func (s *SessionService) UpdateClaudeConfig(ctx context.Context, req *connect.Request[sessionv1.UpdateClaudeConfigRequest]) (*connect.Response[sessionv1.UpdateClaudeConfigResponse], error)
- func (s *SessionService) UpdateGlobalDefaults(ctx context.Context, ...) (*connect.Response[sessionv1.UpdateGlobalDefaultsResponse], error)
- func (s *SessionService) UpdateProject(ctx context.Context, req *connect.Request[sessionv1.UpdateProjectRequest]) (*connect.Response[sessionv1.UpdateProjectResponse], error)
- func (s *SessionService) UpdateSession(ctx context.Context, req *connect.Request[sessionv1.UpdateSessionRequest]) (*connect.Response[sessionv1.UpdateSessionResponse], error)
- func (s *SessionService) UpsertApprovalRule(ctx context.Context, req *connect.Request[sessionv1.UpsertApprovalRuleRequest]) (*connect.Response[sessionv1.UpsertApprovalRuleResponse], error)
- func (s *SessionService) UpsertDirectoryRule(ctx context.Context, ...) (*connect.Response[sessionv1.UpsertDirectoryRuleResponse], error)
- func (s *SessionService) UpsertProfile(ctx context.Context, req *connect.Request[sessionv1.UpsertProfileRequest]) (*connect.Response[sessionv1.UpsertProfileResponse], error)
- func (s *SessionService) WatchReviewQueue(ctx context.Context, req *connect.Request[sessionv1.WatchReviewQueueRequest], ...) error
- func (s *SessionService) WatchSessions(ctx context.Context, req *connect.Request[sessionv1.WatchSessionsRequest], ...) error
- type SessionSnapshot
- type SessionStreamer
- type SubcommandStat
- type TerminalWebSocketHandler
- type TmuxSessionDetail
- type TmuxSnapshot
- type ToolStat
- type UnfinishedWorkService
- func (s *UnfinishedWorkService) DismissWorktree(_ context.Context, req *connect.Request[sessionv1.DismissWorktreeRequest]) (*connect.Response[sessionv1.DismissWorktreeResponse], error)
- func (s *UnfinishedWorkService) GetUnfinishedWorkConfig(_ context.Context, ...) (*connect.Response[sessionv1.GetUnfinishedWorkConfigResponse], error)
- func (s *UnfinishedWorkService) GetWorktreeAISummary(ctx context.Context, ...) (*connect.Response[sessionv1.GetWorktreeAISummaryResponse], error)
- func (s *UnfinishedWorkService) ListUnfinishedWork(_ context.Context, _ *connect.Request[sessionv1.ListUnfinishedWorkRequest]) (*connect.Response[sessionv1.ListUnfinishedWorkResponse], error)
- func (s *UnfinishedWorkService) QuickCommitPush(_ context.Context, req *connect.Request[sessionv1.QuickCommitPushRequest]) (*connect.Response[sessionv1.QuickCommitPushResponse], error)
- func (s *UnfinishedWorkService) ScanUnfinishedWork(_ context.Context, _ *connect.Request[sessionv1.ScanUnfinishedWorkRequest]) (*connect.Response[sessionv1.ScanUnfinishedWorkResponse], error)
- func (s *UnfinishedWorkService) SnoozeWorktree(_ context.Context, req *connect.Request[sessionv1.SnoozeWorktreeRequest]) (*connect.Response[sessionv1.SnoozeWorktreeResponse], error)
- func (s *UnfinishedWorkService) UndismissWorktree(_ context.Context, req *connect.Request[sessionv1.UndismissWorktreeRequest]) (*connect.Response[sessionv1.UndismissWorktreeResponse], error)
- func (s *UnfinishedWorkService) UpdateUnfinishedWorkConfig(_ context.Context, ...) (*connect.Response[sessionv1.UpdateUnfinishedWorkConfigResponse], error)
- func (s *UnfinishedWorkService) WatchUnfinishedWork(ctx context.Context, _ *connect.Request[sessionv1.WatchUnfinishedWorkRequest], ...) error
- type UtilityService
- func (us *UtilityService) CreateDebugSnapshot(ctx context.Context, ...) (*connect.Response[sessionv1.CreateDebugSnapshotResponse], error)
- func (us *UtilityService) FocusWindow(ctx context.Context, req *connect.Request[sessionv1.FocusWindowRequest]) (*connect.Response[sessionv1.FocusWindowResponse], error)
- func (us *UtilityService) GetLogs(ctx context.Context, req *connect.Request[sessionv1.GetLogsRequest]) (*connect.Response[sessionv1.GetLogsResponse], error)
- func (us *UtilityService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
- type WatchReviewQueueFilters
- func (f *WatchReviewQueueFilters) GetIncludeStatistics() bool
- func (f *WatchReviewQueueFilters) GetInitialSnapshot() bool
- func (f *WatchReviewQueueFilters) GetPriorityFilter() []session.Priority
- func (f *WatchReviewQueueFilters) GetReasonFilter() []session.AttentionReason
- func (f *WatchReviewQueueFilters) GetSessionIDs() []string
- type WorkspaceProvider
- type WorkspaceService
- func (ws *WorkspaceService) GetVCSStatus(ctx context.Context, req *connect.Request[sessionv1.GetVCSStatusRequest]) (*connect.Response[sessionv1.GetVCSStatusResponse], error)
- func (ws *WorkspaceService) GetWorkspace(sessionID string) (session.Workspace, error)
- func (ws *WorkspaceService) GetWorkspaceInfo(ctx context.Context, req *connect.Request[sessionv1.GetWorkspaceInfoRequest]) (*connect.Response[sessionv1.GetWorkspaceInfoResponse], error)
- func (ws *WorkspaceService) ListWorkspaceTargets(ctx context.Context, ...) (*connect.Response[sessionv1.ListWorkspaceTargetsResponse], error)
- func (ws *WorkspaceService) SwitchWorkspace(ctx context.Context, req *connect.Request[sessionv1.SwitchWorkspaceRequest]) (*connect.Response[sessionv1.SwitchWorkspaceResponse], error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSettingsNotFound is returned when the Claude settings file is not found. ErrSettingsNotFound = fmt.Errorf("settings file not found") )
Functions ¶
func ExpandPath ¶ added in v1.1.2
ExpandPath expands tilde and environment variables in a single path token and normalises absolute paths with filepath.Clean.
- "~" → home directory
- "~/foo" → filepath.Join(home, "foo")
- anything else → os.ExpandEnv (handles $HOME, $TMPDIR, $VAR, …)
After expansion, absolute paths are passed through filepath.Clean to remove redundant separators and ".." components (e.g. "/foo/../bar" → "/bar").
func ExtractDomainsFromCommand ¶
ExtractDomainsFromCommand parses network-relevant Bash commands and returns the eTLD+1 (registered domain) for each URL found, deduplicated.
func FormatSecretDenyMessage ¶
FormatSecretDenyMessage returns a user-facing denial message for a secret scan hit.
func InjectHookConfig ¶
InjectHookConfig writes (or merges) the stapler-squad PermissionRequest HTTP hook into <rootDir>/.claude/settings.local.json.
If the file already contains a hook pointing to hookApprovalURL, it is left unchanged. If the file exists but lacks our hook, the hook is prepended to PermissionRequest. If the file does not exist, it is created with just our hook config.
func InjectHooksConfig ¶ added in v1.17.0
InjectHooksConfig writes (or merges) hook entries into <rootDir>/.claude/settings.local.json.
- HookPermissionApproval is always injected regardless of the hooks slice.
- Each hook entry is a curl command POSTing to the server endpoint with X-CS-Session-ID set to sessionTitle.
- The write is atomic (temp file + rename).
- Idempotent: existing entries pointing to our URL are preserved.
func InjectMCPConfig ¶ added in v1.17.0
InjectMCPConfig writes (or merges) the stapler-squad MCP server entry into <rootDir>/.claude/settings.local.json.
Behavior:
- If the file already contains our entry pointing to the same binary, it is a no-op.
- If the file exists without our entry, the entry is merged in.
- If the file does not exist, it is created.
- The write is atomic (temp file + rename).
binaryPath should be the absolute path to the stapler-squad binary (use os.Executable()).
func LoadClaudeSettingsRules ¶
func LoadClaudeSettingsRules(projectDir string) []classifier.Rule
LoadClaudeSettingsRules parses both the global and project-level Claude settings and returns AutoAllow rules derived from their permissions.allow lists.
Search order:
- ~/.claude/settings.json (global)
- ~/.claude/settings.local.json (global local overrides)
- <projectDir>/.claude/settings.json (project)
- <projectDir>/.claude/settings.local.json (project local)
Project settings take precedence: if both define the same tool pattern, the project rule will be checked first due to higher priority.
func RemoveMCPConfig ¶ added in v1.17.0
RemoveMCPConfig removes the stapler-squad entry from <rootDir>/.claude/settings.local.json. If the file is missing, it is a no-op.
func StartExpirationCleanup ¶
func StartExpirationCleanup(ctx context.Context, store *ApprovalStore)
StartExpirationCleanup starts a background goroutine that periodically removes expired approvals. The goroutine stops when ctx is canceled.
func WriteSnapshot ¶
func WriteSnapshot(snap *DebugSnapshot, dir string) (string, error)
WriteSnapshot serializes the snapshot to a JSON file in the given directory. Returns the absolute path of the written file.
Types ¶
type AnalyticsEntry ¶
type AnalyticsEntry struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
SessionID string `json:"session_id"`
ToolName string `json:"tool_name"`
CommandPreview string `json:"command_preview"` // first 200 chars
Cwd string `json:"cwd"`
// Decision: "auto_allow" | "auto_deny" | "escalate" | "manual_allow" | "manual_deny"
Decision string `json:"decision"`
RiskLevel string `json:"risk_level"`
RuleID string `json:"rule_id,omitempty"`
RuleName string `json:"rule_name,omitempty"`
Reason string `json:"reason,omitempty"`
Alternative string `json:"alternative,omitempty"`
DurationMs int64 `json:"duration_ms"`
ApprovalID string `json:"approval_id,omitempty"`
// AST-derived command categorization (Bash tool only).
// CommandProgram is the primary executable being called (e.g., "git", "npm").
CommandProgram string `json:"command_program,omitempty"`
// CommandCategory groups CommandProgram into a high-level category (e.g., "vcs", "node").
CommandCategory string `json:"command_category,omitempty"`
// CommandSubcategory is the first positional subcommand (e.g., "commit" for "git commit").
CommandSubcategory string `json:"command_subcommand,omitempty"`
// PythonImports lists top-level module names imported in inline Python (-c) invocations.
PythonImports []string `json:"python_imports,omitempty"`
}
AnalyticsEntry records a single classification decision.
func ReclassifyGaps ¶
func ReclassifyGaps(entries []AnalyticsEntry, c classifier.Classifier) []AnalyticsEntry
ReclassifyGaps re-runs the current classifier against entries that were previously escalated with no matching rule (coverage gaps). Any entry that the current rules would now auto-allow or auto-deny has its Decision and RuleID updated in the returned copy — the underlying JSONL file is unchanged.
Call this before ComputeSummary when you want coverage-gap metrics to reflect the CURRENT rule set rather than the rules that were active when the entry was recorded. This prevents historical gaps from artificially inflating the gap rate after new rules are added.
type AnalyticsStore ¶
type AnalyticsStore struct {
// contains filtered or unexported fields
}
AnalyticsStore writes AnalyticsEntry records asynchronously to SQLite via session.Storage and provides aggregations.
func NewAnalyticsStore ¶
func NewAnalyticsStore(storage *session.Storage) *AnalyticsStore
NewAnalyticsStore creates an AnalyticsStore backed by the given storage. Call Start() to begin the background flush goroutine.
func (*AnalyticsStore) DroppedCount ¶
func (s *AnalyticsStore) DroppedCount() int64
DroppedCount returns the number of entries dropped due to buffer overflow.
func (*AnalyticsStore) LoadWindow ¶
func (s *AnalyticsStore) LoadWindow(since time.Time) ([]AnalyticsEntry, error)
LoadWindow reads entries from DB with timestamps >= since. TODO: Add a timestamp-filtered query to the repository layer to avoid loading all rows into memory as the analytics table grows.
func (*AnalyticsStore) Record ¶
func (s *AnalyticsStore) Record(entry AnalyticsEntry)
Record enqueues an analytics entry for async write. Non-blocking. If the buffer is full, the entry is dropped and the dropped counter incremented.
func (*AnalyticsStore) RecordFromResult ¶
func (s *AnalyticsStore) RecordFromResult(payload classifier.PermissionRequestPayload, result classifier.ClassificationResult, sessionID, approvalID string, durationMs int64)
RecordFromResult builds and records an AnalyticsEntry from classification output.
func (*AnalyticsStore) RecordManualDecision ¶
func (s *AnalyticsStore) RecordManualDecision(approvalID, sessionID, toolName, cwd, decision string)
RecordManualDecision records a manual approve/deny decision for an approval.
func (*AnalyticsStore) Start ¶
func (s *AnalyticsStore) Start(ctx interface{ Done() <-chan struct{} })
Start launches the background goroutine that flushes entries to disk. It stops when ctx is canceled.
type AnalyticsSummary ¶
type AnalyticsSummary struct {
TotalDecisions int `json:"total_decisions"`
DecisionCounts map[string]int `json:"decision_counts"`
TopTools []ToolStat `json:"top_tools"`
TopDeniedCommands []CommandStat `json:"top_denied_commands"`
TopTriggeredRules []RuleStat `json:"top_triggered_rules"`
// TopCommandPrograms lists the most frequently invoked programs via the Bash tool.
TopCommandPrograms []ProgramStat `json:"top_command_programs"`
// TopPythonImports lists the most frequently imported Python modules from inline (-c) invocations.
TopPythonImports []ImportStat `json:"top_python_imports"`
AutoApproveRate float64 `json:"auto_approve_rate"`
ManualReviewRate float64 `json:"manual_review_rate"`
WindowStart time.Time `json:"window_start"`
WindowEnd time.Time `json:"window_end"`
// Coverage gap: decisions that escaped all rules (escalated with no rule_id).
// These are prime candidates for new rules to reduce manual review.
CoverageGapCount int `json:"coverage_gap_count"`
CoverageGapRate float64 `json:"coverage_gap_rate"` // percentage 0–100
TopUncoveredTools []ToolStat `json:"top_uncovered_tools"`
TopUncoveredPrograms []ProgramStat `json:"top_uncovered_programs"`
// CommandSubcommandStats is the complete (program, subcommand) distribution — not
// truncated to top-N. Use this for drill-down analysis such as "which gh subcommands
// does Claude use most?" or "what sed patterns need rules?".
CommandSubcommandStats []SubcommandStat `json:"command_subcommand_stats"`
}
AnalyticsSummary aggregates decisions over a time window.
func ComputeSummary ¶
func ComputeSummary(entries []AnalyticsEntry) AnalyticsSummary
ComputeSummary aggregates a slice of entries into an AnalyticsSummary. Pure function -- no I/O.
type ApprovalDecision ¶
type ApprovalDecision struct {
Behavior string // "allow" or "deny"
Message string // Optional reason shown to Claude on deny
}
ApprovalDecision is the user's response to a pending approval.
type ApprovalDetail ¶
type ApprovalDetail struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
ClaudeSessionID string `json:"claude_session_id"`
ToolName string `json:"tool_name"`
ToolInput map[string]interface{} `json:"tool_input,omitempty"`
Cwd string `json:"cwd"`
PermissionMode string `json:"permission_mode"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
}
ApprovalDetail captures the fields of a single pending approval.
type ApprovalHandler ¶
type ApprovalHandler struct {
// contains filtered or unexported fields
}
ApprovalHandler handles Claude Code HTTP hooks for PermissionRequest events. It blocks the HTTP connection open while waiting for the user's decision, then returns the decision in the hookSpecificOutput JSON format.
func NewApprovalHandler ¶
func NewApprovalHandler(store *ApprovalStore, storage *session.Storage, eventBus *events.EventBus) *ApprovalHandler
NewApprovalHandler creates a new ApprovalHandler.
func (*ApprovalHandler) HandlePermissionRequest ¶
func (h *ApprovalHandler) HandlePermissionRequest(w http.ResponseWriter, r *http.Request)
HandlePermissionRequest handles POST /api/hooks/permission-request. This endpoint is configured as an HTTP hook in Claude Code's settings. It blocks until the user approves/denies or the context is canceled.
func (*ApprovalHandler) SetAnalyticsStore ¶
func (h *ApprovalHandler) SetAnalyticsStore(a *AnalyticsStore)
SetAnalyticsStore injects an AnalyticsStore for recording classification decisions.
func (*ApprovalHandler) SetClassifier ¶
func (h *ApprovalHandler) SetClassifier(c classifier.Classifier)
SetClassifier injects a Classifier for auto-approving/denying tool use requests before they reach the manual review queue.
func (*ApprovalHandler) SetDomainChecker ¶
func (h *ApprovalHandler) SetDomainChecker(d *DomainAgeChecker)
SetDomainChecker injects a DomainAgeChecker for escalating requests to newly-registered domains.
func (*ApprovalHandler) SetNotificationStamper ¶
func (h *ApprovalHandler) SetNotificationStamper(s approvalNotificationStamper)
SetNotificationStamper injects a stamper for persisting approval outcomes on notification records. When set, resolved and timed-out approvals are stamped with approval_decision in their metadata so the notification panel can show a persistent badge after page refresh.
func (*ApprovalHandler) SetQueueChecker ¶
func (h *ApprovalHandler) SetQueueChecker(checker ReviewQueueChecker)
SetQueueChecker injects a ReviewQueueChecker for triggering immediate review queue updates when a new approval is created. This provides <100ms feedback instead of waiting for the next 2-second poll cycle.
type ApprovalService ¶
type ApprovalService struct {
// contains filtered or unexported fields
}
ApprovalService handles Claude Code hook approval RPCs.
func NewApprovalService ¶
func NewApprovalService(store *ApprovalStore) *ApprovalService
NewApprovalService creates an ApprovalService with the given ApprovalStore.
func (*ApprovalService) ListPendingApprovals ¶
func (as *ApprovalService) ListPendingApprovals( ctx context.Context, req *connect.Request[sessionv1.ListPendingApprovalsRequest], ) (*connect.Response[sessionv1.ListPendingApprovalsResponse], error)
ListPendingApprovals returns all pending approval requests, optionally filtered by session ID.
func (*ApprovalService) ResolveApproval ¶
func (as *ApprovalService) ResolveApproval( ctx context.Context, req *connect.Request[sessionv1.ResolveApprovalRequest], ) (*connect.Response[sessionv1.ResolveApprovalResponse], error)
ResolveApproval sends the user's decision to the blocked HTTP hook handler.
func (*ApprovalService) SetNotificationStore ¶
func (as *ApprovalService) SetNotificationStore(store notificationMetadataStore)
SetNotificationStore wires in the notification history store so that resolved approvals are stamped with their decision in the notification metadata.
type ApprovalSnapshot ¶
type ApprovalSnapshot struct {
PendingCount int `json:"pending_count"`
Pending []ApprovalDetail `json:"pending,omitempty"`
}
ApprovalSnapshot captures the pending approvals state.
type ApprovalStore ¶
type ApprovalStore struct {
// contains filtered or unexported fields
}
ApprovalStore manages pending approval requests with thread-safe access.
func NewApprovalStore ¶
func NewApprovalStore(filePath string) *ApprovalStore
NewApprovalStore creates a new ApprovalStore. If filePath is non-empty, persisted approvals are loaded from disk and marked as orphaned.
func (*ApprovalStore) CancelSession ¶
func (s *ApprovalStore) CancelSession(sessionID string) []string
CancelSession denies all pending approvals for a session (e.g., on restart).
func (*ApprovalStore) CleanupExpired ¶
func (s *ApprovalStore) CleanupExpired() []string
CleanupExpired removes approvals past their ExpiresAt and denies them with a timeout message. Also removes orphaned approvals older than orphanedCleanupThreshold (4 hours). Returns the IDs of cleaned-up approvals.
func (*ApprovalStore) Create ¶
func (s *ApprovalStore) Create(a *PendingApproval) error
Create adds a new pending approval to the store and initializes its decision channel.
func (*ApprovalStore) Get ¶
func (s *ApprovalStore) Get(id string) (*PendingApproval, bool)
Get retrieves a pending approval by ID.
func (*ApprovalStore) GetApprovalMetadataBySession ¶
func (s *ApprovalStore) GetApprovalMetadataBySession(sessionID string) []session.ApprovalMetadata
GetApprovalMetadataBySession implements session.ApprovalMetadataProvider. Returns approval metadata for all pending approvals matching the given session ID.
func (*ApprovalStore) GetBySession ¶
func (s *ApprovalStore) GetBySession(sessionID string) []*PendingApproval
GetBySession returns all pending approvals for a given session.
func (*ApprovalStore) GetFilePath ¶
func (s *ApprovalStore) GetFilePath() string
GetFilePath returns the file path used for persistence (for testing/wiring).
func (*ApprovalStore) ListAll ¶
func (s *ApprovalStore) ListAll() []*PendingApproval
ListAll returns all currently pending approvals.
func (*ApprovalStore) Remove ¶
func (s *ApprovalStore) Remove(id string)
Remove removes an approval from the store without sending a decision. The pending HTTP handler will detect context cancellation or its own timeout.
func (*ApprovalStore) Resolve ¶
func (s *ApprovalStore) Resolve(id string, decision ApprovalDecision) error
Resolve sends a decision to the pending approval and removes it from the store. Returns an error if the approval doesn't exist or was already resolved. For orphaned approvals (loaded from disk after restart), the record is simply removed since there is no live HTTP connection to send the decision to.
type CircuitBreakerHandler ¶
type CircuitBreakerHandler struct {
// contains filtered or unexported fields
}
CircuitBreakerHandler provides a debug endpoint to inspect circuit breaker state.
func NewCircuitBreakerHandler ¶
func NewCircuitBreakerHandler() *CircuitBreakerHandler
NewCircuitBreakerHandler creates a new handler using the global registry.
func (*CircuitBreakerHandler) HandleCircuitBreakers ¶
func (h *CircuitBreakerHandler) HandleCircuitBreakers(w http.ResponseWriter, r *http.Request)
HandleCircuitBreakers returns the current state of all circuit breakers. GET /api/debug/circuit-breakers
func (*CircuitBreakerHandler) RegisterRoutes ¶
func (h *CircuitBreakerHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers the circuit breaker debug routes on the given mux.
type ClaudePermissions ¶
type ClaudePermissions struct {
Allow []string `json:"allow"` // tool patterns, e.g. "Bash(git log*)"
Deny []string `json:"deny,omitempty"`
}
ClaudePermissions mirrors the "permissions" key in ~/.claude/settings.json.
func ParseClaudeSettings ¶
func ParseClaudeSettings(path string) (*ClaudePermissions, error)
ParseClaudeSettings reads a Claude settings.json file and extracts permissions. Returns nil permissions (no error) if the file does not exist or has no permissions key.
type CommandStat ¶
type CommandStat struct {
Preview string `json:"preview"`
ToolName string `json:"tool_name"`
Count int `json:"count"`
}
CommandStat is a command preview with a count.
type ConfigService ¶
type ConfigService struct{}
ConfigService handles Claude configuration file RPC methods.
It is dependency-light: each call creates a fresh ClaudeConfigManager so there is no shared state to synchronise.
func NewConfigService ¶
func NewConfigService() *ConfigService
NewConfigService creates a ConfigService.
func (*ConfigService) GetClaudeConfig ¶
func (cs *ConfigService) GetClaudeConfig( ctx context.Context, req *connect.Request[sessionv1.GetClaudeConfigRequest], ) (*connect.Response[sessionv1.GetClaudeConfigResponse], error)
GetClaudeConfig retrieves a Claude configuration file by name.
func (*ConfigService) ListClaudeConfigs ¶
func (cs *ConfigService) ListClaudeConfigs( ctx context.Context, req *connect.Request[sessionv1.ListClaudeConfigsRequest], ) (*connect.Response[sessionv1.ListClaudeConfigsResponse], error)
ListClaudeConfigs returns all configuration files in the ~/.claude directory.
func (*ConfigService) UpdateClaudeConfig ¶
func (cs *ConfigService) UpdateClaudeConfig( ctx context.Context, req *connect.Request[sessionv1.UpdateClaudeConfigRequest], ) (*connect.Response[sessionv1.UpdateClaudeConfigResponse], error)
UpdateClaudeConfig updates a Claude configuration file with atomic write and backup.
type ConnectRPCWebSocketHandler ¶
type ConnectRPCWebSocketHandler struct {
// contains filtered or unexported fields
}
func NewConnectRPCWebSocketHandler ¶
func NewConnectRPCWebSocketHandler(sessionService *SessionService, scrollbackManager *scrollback.ScrollbackManager, tmuxStreamerManager *session.ExternalTmuxStreamerManager, streamingMode string) *ConnectRPCWebSocketHandler
NewConnectRPCWebSocketHandler creates a new ConnectRPC WebSocket handler tmuxStreamerManager is required for ALL sessions (managed and external) since they all use tmux capture-pane polling
func (*ConnectRPCWebSocketHandler) HandleWebSocket ¶
func (h *ConnectRPCWebSocketHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket upgrades HTTP connection to WebSocket and handles ConnectRPC protocol
func (*ConnectRPCWebSocketHandler) SetExternalSessionSupport ¶
func (h *ConnectRPCWebSocketHandler) SetExternalSessionSupport( discovery *session.ExternalSessionDiscovery, )
SetExternalSessionSupport configures external session discovery support This enables the handler to discover and stream external sessions (via mux socket monitoring) Note: tmuxStreamerManager is already set in constructor since ALL sessions use it
type DailyBucket ¶
type DailyBucket struct {
Date string `json:"date"` // "2006-01-02" in local time
AutoAllow int `json:"auto_allow"`
AutoDeny int `json:"auto_deny"`
Escalate int `json:"escalate"`
ManualAllow int `json:"manual_allow"`
ManualDeny int `json:"manual_deny"`
Total int `json:"total"`
}
DailyBucket aggregates classification decisions for a single calendar day.
func ComputeDailyBuckets ¶
func ComputeDailyBuckets(entries []AnalyticsEntry) []DailyBucket
ComputeDailyBuckets groups entries by calendar day (local time) sorted ascending. Pure function — no I/O.
func (DailyBucket) AutoApproveRate ¶
func (b DailyBucket) AutoApproveRate() float64
AutoApproveRate returns the fraction of decisions that were auto-allowed.
type DatabaseService ¶
type DatabaseService struct{}
DatabaseService implements the database/workspace switcher RPC methods. It is stateless: each call reads the filesystem directly.
func NewDatabaseService ¶
func NewDatabaseService() *DatabaseService
NewDatabaseService creates a DatabaseService.
func (*DatabaseService) GetCurrentDatabase ¶
func (ds *DatabaseService) GetCurrentDatabase( ctx context.Context, req *connect.Request[sessionv1.GetCurrentDatabaseRequest], ) (*connect.Response[sessionv1.GetCurrentDatabaseResponse], error)
GetCurrentDatabase returns metadata for the currently active workspace database.
func (*DatabaseService) ListDatabases ¶
func (ds *DatabaseService) ListDatabases( ctx context.Context, req *connect.Request[sessionv1.ListDatabasesRequest], ) (*connect.Response[sessionv1.ListDatabasesResponse], error)
ListDatabases returns all discovered workspace databases with metadata.
func (*DatabaseService) MergeDatabase ¶
func (ds *DatabaseService) MergeDatabase( ctx context.Context, req *connect.Request[sessionv1.MergeDatabaseRequest], ) (*connect.Response[sessionv1.MergeDatabaseResponse], error)
MergeDatabase copies sessions from a source workspace into the current one. Uses INSERT OR IGNORE so existing sessions (matched by title) are never overwritten.
func (*DatabaseService) SwitchDatabase ¶
func (ds *DatabaseService) SwitchDatabase( ctx context.Context, req *connect.Request[sessionv1.SwitchDatabaseRequest], ) (*connect.Response[sessionv1.SwitchDatabaseResponse], error)
SwitchDatabase writes a preference file and triggers an exec-based server self-restart. The client should poll until the server is back up, then reload the page.
type DebugSnapshot ¶
type DebugSnapshot struct {
Version int `json:"version"`
Timestamp time.Time `json:"timestamp"`
Note string `json:"note,omitempty"`
Server ServerInfo `json:"server"`
Sessions []SessionSnapshot `json:"sessions"`
Tmux TmuxSnapshot `json:"tmux"`
Approvals ApprovalSnapshot `json:"approvals"`
RecentLogs RecentLogsSnapshot `json:"recent_logs"`
Errors []string `json:"errors,omitempty"`
}
DebugSnapshot is the top-level JSON structure written to disk.
func CollectSnapshot ¶
func CollectSnapshot(ctx context.Context, note string, instances []*session.Instance, approvalStore *ApprovalStore, logLines int) *DebugSnapshot
CollectSnapshot gathers all diagnostic data into a DebugSnapshot. Individual subsystem failures are recorded in Errors and do not abort the collection.
type DefaultsService ¶ added in v1.12.0
type DefaultsService struct{}
DefaultsService handles session defaults RPC methods.
func NewDefaultsService ¶ added in v1.12.0
func NewDefaultsService() *DefaultsService
NewDefaultsService creates a DefaultsService.
func (*DefaultsService) DeleteDirectoryRule ¶ added in v1.12.0
func (d *DefaultsService) DeleteDirectoryRule( ctx context.Context, req *connect.Request[sessionv1.DeleteDirectoryRuleRequest], ) (*connect.Response[sessionv1.DeleteDirectoryRuleResponse], error)
DeleteDirectoryRule removes a directory rule by path.
func (*DefaultsService) DeleteProfile ¶ added in v1.12.0
func (d *DefaultsService) DeleteProfile( ctx context.Context, req *connect.Request[sessionv1.DeleteProfileRequest], ) (*connect.Response[sessionv1.DeleteProfileResponse], error)
DeleteProfile removes a named profile by name.
func (*DefaultsService) GetSessionDefaults ¶ added in v1.12.0
func (d *DefaultsService) GetSessionDefaults( ctx context.Context, req *connect.Request[sessionv1.GetSessionDefaultsRequest], ) (*connect.Response[sessionv1.GetSessionDefaultsResponse], error)
GetSessionDefaults returns the full session defaults configuration.
func (*DefaultsService) ResolveDefaults ¶ added in v1.12.0
func (d *DefaultsService) ResolveDefaults( ctx context.Context, req *connect.Request[sessionv1.ResolveDefaultsRequest], ) (*connect.Response[sessionv1.ResolveDefaultsResponse], error)
ResolveDefaults merges all default layers for the given working directory and profile.
func (*DefaultsService) UpdateGlobalDefaults ¶ added in v1.12.0
func (d *DefaultsService) UpdateGlobalDefaults( ctx context.Context, req *connect.Request[sessionv1.UpdateGlobalDefaultsRequest], ) (*connect.Response[sessionv1.UpdateGlobalDefaultsResponse], error)
UpdateGlobalDefaults replaces the global default fields and persists them.
func (*DefaultsService) UpsertDirectoryRule ¶ added in v1.12.0
func (d *DefaultsService) UpsertDirectoryRule( ctx context.Context, req *connect.Request[sessionv1.UpsertDirectoryRuleRequest], ) (*connect.Response[sessionv1.UpsertDirectoryRuleResponse], error)
UpsertDirectoryRule creates or updates a directory rule (matched by path).
func (*DefaultsService) UpsertProfile ¶ added in v1.12.0
func (d *DefaultsService) UpsertProfile( ctx context.Context, req *connect.Request[sessionv1.UpsertProfileRequest], ) (*connect.Response[sessionv1.UpsertProfileResponse], error)
UpsertProfile creates or updates a named profile.
type DirCache ¶ added in v1.13.0
type DirCache struct {
// contains filtered or unexported fields
}
DirCache is a thread-safe, mtime+TTL-invalidated cache of os.DirEntry slices keyed by directory path. It is intended to reduce repeated os.ReadDir calls for the same directory within a short window (e.g., repeated Omnibar opens).
Invalidation policy:
- An entry is stale if time.Since(cachedAt) > ttl.
- An entry is stale if the directory's mtime has advanced since the entry was stored.
- Eviction is LRU by insertion order: when len(entries) >= maxSize, the oldest entry (earliest cachedAt) is removed before storing a new one.
No background goroutines are used; all operations are on-demand.
func NewDirCache ¶ added in v1.13.0
NewDirCache creates a DirCache with the given capacity and TTL.
func (*DirCache) Get ¶ added in v1.13.0
Get returns the cached DirEntry slice for path if the entry is still valid.
Validity requires both:
- time.Since(entry.cachedAt) <= c.ttl (TTL not expired)
- os.Stat(path).ModTime() == entry.dirMtime (directory unchanged)
Returns (nil, false) on any miss: entry absent, TTL expired, or mtime changed. A stale-mtime entry is removed from the cache under a write lock so the next Put does not exceed maxSize unnecessarily.
type DomainAgeChecker ¶
type DomainAgeChecker struct {
// contains filtered or unexported fields
}
DomainAgeChecker extracts domains from Bash commands and checks their registration age using RDAP (Registration Data Access Protocol). Results are cached for 24h.
A domain is considered "new" if its registration date is within the configured threshold (default 30 days). New domains from network-oriented commands are escalated for review.
func NewDomainAgeChecker ¶
func NewDomainAgeChecker(enabled bool) *DomainAgeChecker
NewDomainAgeChecker creates a DomainAgeChecker with sensible defaults. Set enabled=false to disable RDAP lookups (no-op mode).
func (*DomainAgeChecker) IsNewlyRegistered ¶
IsNewlyRegistered returns true if the domain was registered within the threshold and the check is enabled. Returns (false, nil) for any lookup failure, to avoid blocking legitimate operations on RDAP outages.
func (*DomainAgeChecker) NewDomainThreshold ¶
func (d *DomainAgeChecker) NewDomainThreshold() time.Duration
NewDomainThreshold returns how old a domain must be to be considered "established".
type EscapeCodeHandler ¶
type EscapeCodeHandler struct {
// contains filtered or unexported fields
}
EscapeCodeHandler provides REST endpoints for escape code analytics
func NewEscapeCodeHandler ¶
func NewEscapeCodeHandler() *EscapeCodeHandler
NewEscapeCodeHandler creates a new handler using the global store
func (*EscapeCodeHandler) HandleClear ¶
func (h *EscapeCodeHandler) HandleClear(w http.ResponseWriter, r *http.Request)
HandleClear clears all recorded escape codes DELETE /api/debug/escape-codes
func (*EscapeCodeHandler) HandleExport ¶
func (h *EscapeCodeHandler) HandleExport(w http.ResponseWriter, r *http.Request)
HandleExport exports all data as JSON GET /api/debug/escape-codes/export
func (*EscapeCodeHandler) HandleGetAll ¶
func (h *EscapeCodeHandler) HandleGetAll(w http.ResponseWriter, r *http.Request)
HandleGetAll returns all escape code entries GET /api/debug/escape-codes
func (*EscapeCodeHandler) HandleGetByCategory ¶
func (h *EscapeCodeHandler) HandleGetByCategory(w http.ResponseWriter, r *http.Request)
HandleGetByCategory returns entries for a specific category GET /api/debug/escape-codes/category/{category}
func (*EscapeCodeHandler) HandleGetBySession ¶
func (h *EscapeCodeHandler) HandleGetBySession(w http.ResponseWriter, r *http.Request)
HandleGetBySession returns entries for a specific session GET /api/debug/escape-codes/session/{sessionId}
func (*EscapeCodeHandler) HandleGetStats ¶
func (h *EscapeCodeHandler) HandleGetStats(w http.ResponseWriter, r *http.Request)
HandleGetStats returns aggregated statistics GET /api/debug/escape-codes/stats
func (*EscapeCodeHandler) HandleStatus ¶
func (h *EscapeCodeHandler) HandleStatus(w http.ResponseWriter, r *http.Request)
HandleStatus returns the current tracking status GET /api/debug/escape-codes/status
func (*EscapeCodeHandler) HandleToggle ¶
func (h *EscapeCodeHandler) HandleToggle(w http.ResponseWriter, r *http.Request)
HandleToggle enables or disables escape code tracking POST /api/debug/escape-codes/toggle Body: {"enabled": true/false}
func (*EscapeCodeHandler) RegisterRoutes ¶
func (h *EscapeCodeHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers all escape code handler routes on the given mux
type ExternalWebSocketHandler ¶
type ExternalWebSocketHandler struct {
// contains filtered or unexported fields
}
ExternalWebSocketHandler handles approval monitoring for external mux sessions. Terminal streaming has been migrated to the unified ConnectRPC WebSocket handler.
func NewExternalWebSocketHandler ¶
func NewExternalWebSocketHandler( discovery *session.ExternalSessionDiscovery, tmuxStreamerManager *session.ExternalTmuxStreamerManager, approvalMonitor *session.ExternalApprovalMonitor, eventBus *events.EventBus, ) *ExternalWebSocketHandler
NewExternalWebSocketHandler creates a new handler for external session approval monitoring. Note: tmuxStreamerManager parameter is kept for backward compatibility but is no longer used since terminal streaming has been migrated to the unified ConnectRPC WebSocket handler.
func (*ExternalWebSocketHandler) HandleApprovalResponse ¶
func (h *ExternalWebSocketHandler) HandleApprovalResponse(w http.ResponseWriter, r *http.Request)
HandleApprovalResponse handles user response to an approval request
func (*ExternalWebSocketHandler) HandleApprovals ¶
func (h *ExternalWebSocketHandler) HandleApprovals(w http.ResponseWriter, r *http.Request)
HandleApprovals returns pending approvals for an external session
type FileService ¶ added in v1.11.0
type FileService struct {
// contains filtered or unexported fields
}
FileService handles ListFiles and GetFileContent RPCs.
func NewFileService ¶ added in v1.11.0
func NewFileService(workspace WorkspaceProvider) *FileService
NewFileService creates a FileService with the given workspace provider.
func (*FileService) GetFileContent ¶ added in v1.11.0
func (fs *FileService) GetFileContent( ctx context.Context, req *connect.Request[sessionv1.GetFileContentRequest], ) (*connect.Response[sessionv1.GetFileContentResponse], error)
GetFileContent retrieves the content of a file in the session's worktree.
func (*FileService) ListFiles ¶ added in v1.11.0
func (fs *FileService) ListFiles( ctx context.Context, req *connect.Request[sessionv1.ListFilesRequest], ) (*connect.Response[sessionv1.ListFilesResponse], error)
ListFiles returns the immediate children of the given directory in the session's worktree.
func (*FileService) SearchFiles ¶ added in v1.12.0
func (fs *FileService) SearchFiles( ctx context.Context, req *connect.Request[sessionv1.SearchFilesRequest], ) (*connect.Response[sessionv1.SearchFilesResponse], error)
SearchFiles performs a recursive name-substring search in the session's worktree.
type GitHubService ¶
type GitHubService struct {
// contains filtered or unexported fields
}
GitHubService handles all GitHub PR RPC methods.
These methods shell out to the `gh` CLI and have no dependency on review queue, terminal streaming, or search. They only need to look up a session by ID and call PR operations on it.
func NewGitHubService ¶
func NewGitHubService(storage *session.Storage) *GitHubService
NewGitHubService creates a GitHubService backed by the given storage.
func (*GitHubService) ClosePR ¶
func (gs *GitHubService) ClosePR( ctx context.Context, req *connect.Request[sessionv1.ClosePRRequest], ) (*connect.Response[sessionv1.ClosePRResponse], error)
ClosePR closes the PR without merging for a session.
func (*GitHubService) GetPRComments ¶
func (gs *GitHubService) GetPRComments( ctx context.Context, req *connect.Request[sessionv1.GetPRCommentsRequest], ) (*connect.Response[sessionv1.GetPRCommentsResponse], error)
GetPRComments retrieves all comments on the PR for a session.
func (*GitHubService) GetPRInfo ¶
func (gs *GitHubService) GetPRInfo( ctx context.Context, req *connect.Request[sessionv1.GetPRInfoRequest], ) (*connect.Response[sessionv1.GetPRInfoResponse], error)
GetPRInfo retrieves the latest PR information for a session.
func (*GitHubService) MergePR ¶
func (gs *GitHubService) MergePR( ctx context.Context, req *connect.Request[sessionv1.MergePRRequest], ) (*connect.Response[sessionv1.MergePRResponse], error)
MergePR merges the PR for a session using the specified merge method.
func (*GitHubService) PostPRComment ¶
func (gs *GitHubService) PostPRComment( ctx context.Context, req *connect.Request[sessionv1.PostPRCommentRequest], ) (*connect.Response[sessionv1.PostPRCommentResponse], error)
PostPRComment posts a new comment to the PR for a session.
type HookName ¶ added in v1.17.0
type HookName string
HookName is a typed constant for the built-in hooks that can be injected.
const ( HookPermissionApproval HookName = "permission_approval" // maps to PermissionRequest event HookStopNotification HookName = "stop_notification" // maps to Stop event HookPreToolLogging HookName = "pre_tool_logging" // maps to PreToolUse event HookPostToolLogging HookName = "post_tool_logging" // maps to PostToolUse event HookPromptSubmit HookName = "prompt_submit" // maps to UserPromptSubmit event )
type HookReceiver ¶ added in v1.17.0
type HookReceiver struct{}
HookReceiver handles inbound Claude Code hook callbacks for non-approval events. These are fire-and-forget: Claude does not block on the response.
func NewHookReceiver ¶ added in v1.17.0
func NewHookReceiver() *HookReceiver
NewHookReceiver creates a HookReceiver.
func (*HookReceiver) HandlePostToolUse ¶ added in v1.17.0
func (h *HookReceiver) HandlePostToolUse(w http.ResponseWriter, r *http.Request)
HandlePostToolUse receives the Claude Code PostToolUse hook.
func (*HookReceiver) HandlePreToolUse ¶ added in v1.17.0
func (h *HookReceiver) HandlePreToolUse(w http.ResponseWriter, r *http.Request)
HandlePreToolUse receives the Claude Code PreToolUse hook.
func (*HookReceiver) HandlePromptSubmit ¶ added in v1.17.0
func (h *HookReceiver) HandlePromptSubmit(w http.ResponseWriter, r *http.Request)
HandlePromptSubmit receives the Claude Code UserPromptSubmit hook.
func (*HookReceiver) HandleStop ¶ added in v1.17.0
func (h *HookReceiver) HandleStop(w http.ResponseWriter, r *http.Request)
HandleStop receives the Claude Code Stop hook.
func (*HookReceiver) RegisterRoutes ¶ added in v1.17.0
func (h *HookReceiver) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers the four non-approval hook endpoints on mux.
type ImageUploadHandler ¶ added in v1.17.0
type ImageUploadHandler struct {
// contains filtered or unexported fields
}
ImageUploadHandler saves clipboard images to a temp directory and returns the absolute path so the terminal process can reference the file.
func NewImageUploadHandler ¶ added in v1.17.0
func NewImageUploadHandler(dir string) *ImageUploadHandler
func (*ImageUploadHandler) HandleUpload ¶ added in v1.17.0
func (h *ImageUploadHandler) HandleUpload(w http.ResponseWriter, r *http.Request)
type ImportStat ¶
ImportStat is a Python module import with its usage count.
type NotificationRateLimiter ¶
type NotificationRateLimiter struct {
// contains filtered or unexported fields
}
NotificationRateLimiter provides per-session rate limiting for notifications. Prevents notification flooding from individual sessions while allowing legitimate notification volumes across all sessions.
func NewNotificationRateLimiter ¶
func NewNotificationRateLimiter(r float64, b int) *NotificationRateLimiter
NewNotificationRateLimiter creates a rate limiter. rate: notifications per second (e.g., 10) burst: max burst size (e.g., 20)
func (*NotificationRateLimiter) Allow ¶
func (rl *NotificationRateLimiter) Allow(sessionID string) bool
Allow checks if a notification is allowed for the given session. Returns true if the notification should be processed, false if rate limited.
func (*NotificationRateLimiter) Cleanup ¶
func (rl *NotificationRateLimiter) Cleanup(activeSessions []string)
Cleanup removes rate limiters for sessions that are no longer active. Should be called periodically to prevent memory leaks.
func (*NotificationRateLimiter) Count ¶
func (rl *NotificationRateLimiter) Count() int
Count returns the number of active rate limiters (for monitoring).
func (*NotificationRateLimiter) Reset ¶
func (rl *NotificationRateLimiter) Reset(sessionID string)
Reset removes the rate limiter for a specific session. Useful for testing or when a session is recreated.
type NotificationService ¶
type NotificationService struct {
// contains filtered or unexported fields
}
NotificationService handles notification sending and history RPCs.
Dependencies:
- notificationStore: persists notification history
- notificationRateLimiter: rate-limits per-session notification sends
- eventBus: broadcasts notification events to connected clients
- reviewQueuePoller: late-wired; used to resolve session names
func NewNotificationService ¶
func NewNotificationService( rateLimiter *NotificationRateLimiter, eventBus *events.EventBus, ) *NotificationService
NewNotificationService creates a NotificationService with the given dependencies.
func (*NotificationService) ClearNotificationHistory ¶
func (ns *NotificationService) ClearNotificationHistory( ctx context.Context, req *connect.Request[sessionv1.ClearNotificationHistoryRequest], ) (*connect.Response[sessionv1.ClearNotificationHistoryResponse], error)
ClearNotificationHistory removes notifications from the history.
func (*NotificationService) GetNotificationHistory ¶
func (ns *NotificationService) GetNotificationHistory( ctx context.Context, req *connect.Request[sessionv1.GetNotificationHistoryRequest], ) (*connect.Response[sessionv1.GetNotificationHistoryResponse], error)
GetNotificationHistory returns persisted notification history with optional filtering.
func (*NotificationService) GetNotificationStore ¶
func (ns *NotificationService) GetNotificationStore() *notifications.NotificationHistoryStore
GetNotificationStore returns the notification history store.
func (*NotificationService) MarkNotificationRead ¶
func (ns *NotificationService) MarkNotificationRead( ctx context.Context, req *connect.Request[sessionv1.MarkNotificationReadRequest], ) (*connect.Response[sessionv1.MarkNotificationReadResponse], error)
MarkNotificationRead marks specific notifications as read. If notification_ids is empty, marks all notifications as read.
func (*NotificationService) SendNotification ¶
func (ns *NotificationService) SendNotification( ctx context.Context, req *connect.Request[sessionv1.SendNotificationRequest], ) (*connect.Response[sessionv1.SendNotificationResponse], error)
SendNotification allows tmux sessions and external Claude processes to send notifications. Enforces localhost-only restriction and rate limiting. Accepts both managed sessions and external sessions (e.g., Claude running in IntelliJ, VS Code, or other terminals).
func (*NotificationService) SetNotificationStore ¶
func (ns *NotificationService) SetNotificationStore(store *notifications.NotificationHistoryStore)
SetNotificationStore sets the notification history store (late-wired).
func (*NotificationService) SetReviewQueuePoller ¶
func (ns *NotificationService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
SetReviewQueuePoller sets the review queue poller for resolving session names.
type PathClassification ¶ added in v1.1.2
type PathClassification uint
PathClassification is a bitmask that categorises a resolved filesystem path. Multiple bits may be set simultaneously (e.g. a path can be both PathSystemDir and PathGitRepo if the repository lives under /usr/local/src).
const ( // PathRoot matches a path that is exactly the filesystem root ("/"). PathRoot PathClassification = 1 << iota // PathHome matches a path that is exactly the current user's home directory. PathHome // PathSystemDir matches a path that is, or is inside, one of the conventional // Unix system directories: /etc, /usr, /bin, /sbin, /lib, /lib64, /boot, // /dev, /sys, /proc, /run. PathSystemDir // PathTempDir matches a path that is, or is inside, a temporary directory // (/tmp, /var/tmp, or the value of $TMPDIR). PathTempDir // PathCwd matches a path that is, or is inside, the current working directory // as reported by classifier.ClassificationContext.Cwd. PathCwd // PathGitRepo matches a path that is, or is inside, the git repository root // as reported by classifier.ClassificationContext.RepoRoot. PathGitRepo )
func ClassifyPath ¶ added in v1.1.2
func ClassifyPath(path string, ctx classifier.ClassificationContext) PathClassification
ClassifyPath returns a PathClassification bitmask for path. path should already be expanded (via ExpandPath) before calling this function.
type PathCompletionService ¶ added in v1.10.0
type PathCompletionService struct {
// contains filtered or unexported fields
}
PathCompletionService handles RPC methods for filesystem path completion. It caches directory listings in a DirCache to avoid repeated os.ReadDir calls.
func NewPathCompletionService ¶ added in v1.10.0
func NewPathCompletionService() *PathCompletionService
NewPathCompletionService creates a PathCompletionService with a DirCache.
func (*PathCompletionService) ListPathCompletions ¶ added in v1.10.0
func (p *PathCompletionService) ListPathCompletions( ctx context.Context, req *connect.Request[sessionv1.ListPathCompletionsRequest], ) (*connect.Response[sessionv1.ListPathCompletionsResponse], error)
ListPathCompletions returns filesystem entries matching the given path prefix.
func (*PathCompletionService) ListWorktrees ¶ added in v1.12.0
func (p *PathCompletionService) ListWorktrees( ctx context.Context, req *connect.Request[sessionv1.ListWorktreesRequest], ) (*connect.Response[sessionv1.ListWorktreesResponse], error)
ListWorktrees returns the git worktrees for a given repository path.
type PathMatcher ¶ added in v1.1.2
type PathMatcher struct {
// ArgIndex selects which non-flag argument to evaluate.
// -1 (the default) means any non-flag argument may satisfy the match.
// 0 means the first non-flag argument, 1 the second, and so on.
ArgIndex int
// MatchIf: at least one selected argument must match one of these
// classifications for Matches to return true.
// Zero means this check is skipped (always passes).
MatchIf PathClassification
// RejectIf: if any selected argument matches any of these classifications,
// Matches returns false immediately regardless of MatchIf.
// Zero means this check is skipped (never rejects).
RejectIf PathClassification
}
PathMatcher provides structured path-based matching for Bash command arguments. It operates on the expanded (tilde/env-resolved) arguments of a parsed command and can be used alongside CommandPattern and Criteria on a Rule — all set fields must match (AND semantics).
Example — block rm on root or home:
PathMatcher: &PathMatcher{ArgIndex: -1, MatchIf: PathRoot | PathHome}
Example — reject if path is inside /tmp (allow-list inversion):
PathMatcher: &PathMatcher{ArgIndex: 0, RejectIf: PathTempDir}
func (*PathMatcher) Matches ¶ added in v1.1.2
func (pm *PathMatcher) Matches(expandedArgs []string, ctx classifier.ClassificationContext) bool
Matches returns true when the path arguments in expandedArgs satisfy the PathMatcher criteria against ctx.
type PendingApproval ¶
type PendingApproval struct {
ID string
SessionID string // stapler-squad session title (mapped from hook)
ClaudeSessionID string // Claude Code's internal session_id
ToolName string
ToolInput map[string]interface{}
Cwd string
PermissionMode string
CreatedAt time.Time
ExpiresAt time.Time
// Orphaned is true for approvals loaded from disk after a server restart.
// These have no live HTTP connection, so they cannot be resolved via the decision channel.
Orphaned bool
// contains filtered or unexported fields
}
PendingApproval represents an in-flight hook approval waiting for a user decision.
type PersistedApproval ¶
type PersistedApproval struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
ClaudeSessionID string `json:"claude_session_id"`
ToolName string `json:"tool_name"`
ToolInput map[string]interface{} `json:"tool_input"`
Cwd string `json:"cwd"`
PermissionMode string `json:"permission_mode"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
Orphaned bool `json:"orphaned"`
}
PersistedApproval is the JSON-serializable representation of a PendingApproval for disk storage.
type ProgramStat ¶
type ProgramStat struct {
Program string `json:"program"`
Category string `json:"category"`
Count int `json:"count"`
}
ProgramStat is a command program with its category and usage count.
type ProjectService ¶ added in v1.23.0
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService handles Project CRUD RPCs.
func NewProjectService ¶ added in v1.23.0
func NewProjectService(storage *session.Storage) *ProjectService
NewProjectService creates a ProjectService backed by Storage. Returns nil if storage is nil (test environments).
func (*ProjectService) AssignSessionsToProject ¶ added in v1.23.0
func (s *ProjectService) AssignSessionsToProject( ctx context.Context, req *connect.Request[sessionv1.AssignSessionsToProjectRequest], ) (*connect.Response[sessionv1.AssignSessionsToProjectResponse], error)
AssignSessionsToProject links sessions to a project.
func (*ProjectService) CreateProject ¶ added in v1.23.0
func (s *ProjectService) CreateProject( ctx context.Context, req *connect.Request[sessionv1.CreateProjectRequest], ) (*connect.Response[sessionv1.CreateProjectResponse], error)
CreateProject creates a new project.
func (*ProjectService) DeleteProject ¶ added in v1.23.0
func (s *ProjectService) DeleteProject( ctx context.Context, req *connect.Request[sessionv1.DeleteProjectRequest], ) (*connect.Response[sessionv1.DeleteProjectResponse], error)
DeleteProject removes a project; sessions are unassigned.
func (*ProjectService) ListProjects ¶ added in v1.23.0
func (s *ProjectService) ListProjects( ctx context.Context, req *connect.Request[sessionv1.ListProjectsRequest], ) (*connect.Response[sessionv1.ListProjectsResponse], error)
ListProjects returns all projects.
func (*ProjectService) UpdateProject ¶ added in v1.23.0
func (s *ProjectService) UpdateProject( ctx context.Context, req *connect.Request[sessionv1.UpdateProjectRequest], ) (*connect.Response[sessionv1.UpdateProjectResponse], error)
UpdateProject modifies an existing project.
type PushHandler ¶ added in v1.12.0
type PushHandler struct {
// contains filtered or unexported fields
}
PushHandler handles HTTP endpoints for push notifications
func NewPushHandler ¶ added in v1.12.0
func NewPushHandler(pushService *PushService) *PushHandler
NewPushHandler creates a new push notification handler
func (*PushHandler) RegisterRoutes ¶ added in v1.12.0
func (h *PushHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers the HTTP endpoints for push notifications
type PushNotification ¶ added in v1.12.0
type PushNotification struct {
Title string `json:"title"`
Body string `json:"body"`
Icon string `json:"icon,omitempty"`
Tag string `json:"tag,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
RequireInteraction bool `json:"requireInteraction,omitempty"`
Renotify bool `json:"renotify,omitempty"`
}
type PushService ¶ added in v1.12.0
type PushService struct {
// contains filtered or unexported fields
}
func NewPushService ¶ added in v1.12.0
func NewPushService(configDir string) *PushService
func (*PushService) GetSubscriptions ¶ added in v1.12.0
func (ps *PushService) GetSubscriptions() []PushSubscription
func (*PushService) GetVapidPublicKey ¶ added in v1.12.0
func (ps *PushService) GetVapidPublicKey() string
func (*PushService) SendNotification ¶ added in v1.12.0
func (ps *PushService) SendNotification(notif PushNotification) int
func (*PushService) Subscribe ¶ added in v1.12.0
func (ps *PushService) Subscribe(sub PushSubscription) string
func (*PushService) Unsubscribe ¶ added in v1.12.0
func (ps *PushService) Unsubscribe(endpoint string) bool
type PushSubscription ¶ added in v1.12.0
type ReactiveQueueManager ¶
type ReactiveQueueManager interface {
AddStreamClient(ctx context.Context, filters interface{}) (<-chan *sessionv1.ReviewQueueEvent, string)
RemoveStreamClient(clientID string)
}
ReactiveQueueManager is an interface to avoid circular dependencies. The actual implementation is in server/review_queue_manager.go
type RecentLogsSnapshot ¶
type RecentLogsSnapshot struct {
LogFilePath string `json:"log_file_path"`
LineCount int `json:"line_count"`
Lines []string `json:"lines"`
}
RecentLogsSnapshot contains the most recent log lines.
type ReviewQueueChecker ¶
type ReviewQueueChecker interface {
FindInstance(sessionID string) *session.Instance
CheckSession(inst *session.Instance)
}
ReviewQueueChecker is an interface for triggering immediate review queue checks. This avoids importing the session package's concrete ReviewQueuePoller type directly.
type ReviewQueueService ¶
type ReviewQueueService struct {
// contains filtered or unexported fields
}
ReviewQueueService handles all review-queue-related RPC methods, extracted from the monolithic SessionService for separation of concerns.
Dependencies it owns (moved out of SessionService):
- reviewQueue: stateful queue managed by ReviewQueuePoller
- reactiveQueueMgr: streams live review queue events to clients
Dependencies it borrows (still on SessionService, passed via setters):
- storage: needed by AcknowledgeSession to persist ack timestamps
- reviewQueuePoller: needed by AcknowledgeSession to refresh poller refs
- eventBus: needed by AcknowledgeSession and LogUserInteraction
func NewReviewQueueService ¶
func NewReviewQueueService( reviewQueue *session.ReviewQueue, storage *session.Storage, eventBus *events.EventBus, ) *ReviewQueueService
NewReviewQueueService creates a ReviewQueueService with the required state.
func (*ReviewQueueService) AcknowledgeSession ¶
func (rqs *ReviewQueueService) AcknowledgeSession( ctx context.Context, req *connect.Request[sessionv1.AcknowledgeSessionRequest], ) (*connect.Response[sessionv1.AcknowledgeSessionResponse], error)
AcknowledgeSession marks a session as acknowledged in the review queue. The session won't reappear in the queue until it receives an update.
func (*ReviewQueueService) GetQueue ¶
func (rqs *ReviewQueueService) GetQueue() *session.ReviewQueue
GetQueue returns the underlying ReviewQueue for wiring reactive components.
func (*ReviewQueueService) GetReviewQueue ¶
func (rqs *ReviewQueueService) GetReviewQueue( ctx context.Context, req *connect.Request[sessionv1.GetReviewQueueRequest], ) (*connect.Response[sessionv1.GetReviewQueueResponse], error)
GetReviewQueue returns sessions needing user attention with priority ordering. Uses the global stateful queue managed by ReviewQueuePoller, with optional filtering.
func (*ReviewQueueService) LogUserInteraction ¶
func (rqs *ReviewQueueService) LogUserInteraction( ctx context.Context, req *connect.Request[sessionv1.LogUserInteractionRequest], ) (*connect.Response[sessionv1.LogUserInteractionResponse], error)
LogUserInteraction logs a user interaction event for audit trail and analytics.
func (*ReviewQueueService) SetApprovalStore ¶
func (rqs *ReviewQueueService) SetApprovalStore(store *ApprovalStore)
SetApprovalStore injects the ApprovalStore for enriching APPROVAL_PENDING items with their pending_approval_id metadata.
func (*ReviewQueueService) SetReactiveQueueManager ¶
func (rqs *ReviewQueueService) SetReactiveQueueManager(mgr ReactiveQueueManager)
SetReactiveQueueManager injects the ReactiveQueueManager (dependency injection). Must be called before WatchReviewQueue is used.
func (*ReviewQueueService) SetReviewQueuePoller ¶
func (rqs *ReviewQueueService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
SetReviewQueuePoller injects the ReviewQueuePoller used to refresh instance references after acknowledgement.
func (*ReviewQueueService) WatchReviewQueue ¶
func (rqs *ReviewQueueService) WatchReviewQueue( ctx context.Context, req *connect.Request[sessionv1.WatchReviewQueueRequest], stream *connect.ServerStream[sessionv1.ReviewQueueEvent], ) error
WatchReviewQueue streams real-time review queue events.
type RuleSpec ¶
type RuleSpec struct {
ID string `json:"id"`
Name string `json:"name"`
ToolName string `json:"tool_name,omitempty"`
ToolPattern string `json:"tool_pattern,omitempty"`
ToolCategory string `json:"tool_category,omitempty"`
CommandPattern string `json:"command_pattern,omitempty"`
FilePattern string `json:"file_pattern,omitempty"`
Decision string `json:"decision"` // "auto_allow" | "auto_deny" | "escalate"
RiskLevel string `json:"risk_level"` // "low" | "medium" | "high" | "critical"
Reason string `json:"reason,omitempty"`
Alternative string `json:"alternative,omitempty"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
Source string `json:"source"` // "user" | "seed" | "claude-settings"
CreatedAt time.Time `json:"created_at"`
}
RuleSpec is the JSON-serializable form of a Rule. CommandPattern and FilePattern are stored as strings (compiled on load).
type RuleStat ¶
type RuleStat struct {
RuleID string `json:"rule_id"`
RuleName string `json:"rule_name"`
Count int `json:"count"`
}
RuleStat is a rule with its trigger count.
type RulesService ¶
type RulesService struct {
// contains filtered or unexported fields
}
RulesService handles auto-approval rule management and analytics RPCs.
func NewRulesService ¶
func NewRulesService(rulesStore *RulesStore, analyticsStore *AnalyticsStore, classifier *classifier.RuleBasedClassifier) *RulesService
NewRulesService creates a RulesService.
func (*RulesService) DeleteApprovalRule ¶
func (rs *RulesService) DeleteApprovalRule( ctx context.Context, req *connect.Request[sessionv1.DeleteApprovalRuleRequest], ) (*connect.Response[sessionv1.DeleteApprovalRuleResponse], error)
DeleteApprovalRule removes a user rule by ID.
func (*RulesService) GetApprovalAnalytics ¶
func (rs *RulesService) GetApprovalAnalytics( ctx context.Context, req *connect.Request[sessionv1.GetApprovalAnalyticsRequest], ) (*connect.Response[sessionv1.GetApprovalAnalyticsResponse], error)
GetApprovalAnalytics returns aggregated analytics for the requested time window.
func (*RulesService) ListApprovalRules ¶
func (rs *RulesService) ListApprovalRules( ctx context.Context, req *connect.Request[sessionv1.ListApprovalRulesRequest], ) (*connect.Response[sessionv1.ListApprovalRulesResponse], error)
ListApprovalRules returns all rules: user + seed + claude-settings.
func (*RulesService) UpsertApprovalRule ¶
func (rs *RulesService) UpsertApprovalRule( ctx context.Context, req *connect.Request[sessionv1.UpsertApprovalRuleRequest], ) (*connect.Response[sessionv1.UpsertApprovalRuleResponse], error)
UpsertApprovalRule creates or updates a user rule.
type RulesStore ¶
type RulesStore struct {
// contains filtered or unexported fields
}
RulesStore manages user-defined rules persisted to SQLite. Thread-safe for concurrent reads.
func NewRulesStore ¶
func NewRulesStore(storage *session.Storage) (*RulesStore, error)
NewRulesStore creates a RulesStore backed by the given storage.
func (*RulesStore) All ¶
func (s *RulesStore) All() []RuleSpec
All returns user rules as compiled Rules (source="user" only).
func (*RulesStore) Delete ¶
func (s *RulesStore) Delete(id string) error
Delete removes a user rule by ID. Returns error if not found or not a user rule.
func (*RulesStore) ToRules ¶
func (s *RulesStore) ToRules() []classifier.Rule
ToRules converts specs to compiled Rules, skipping specs with invalid regex.
func (*RulesStore) Upsert ¶
func (s *RulesStore) Upsert(spec RuleSpec) (RuleSpec, error)
Upsert creates or updates a user rule. Source must be "user". Returns the upserted spec.
func (*RulesStore) WatchAndReload ¶
func (s *RulesStore) WatchAndReload(ctx context.Context)
WatchAndReload is now a no-op as we use shared DB.
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
SearchService handles all Claude history and full-text search RPC methods.
It owns the history cache and search engine state that were previously scattered across SessionService.
Bug note: historyCacheMu protects the history cache fields from concurrent access. Without this, concurrent ListClaudeHistory calls would race on cache refresh (previously unprotected on SessionService).
func NewSearchService ¶
func NewSearchService( searchEngine *search.SearchEngine, snippetGenerator *search.SnippetGenerator, historyCacheTTL time.Duration, ) *SearchService
NewSearchService creates a SearchService with the given search components.
func (*SearchService) GetClaudeHistoryDetail ¶
func (ss *SearchService) GetClaudeHistoryDetail( ctx context.Context, req *connect.Request[sessionv1.GetClaudeHistoryDetailRequest], ) (*connect.Response[sessionv1.GetClaudeHistoryDetailResponse], error)
GetClaudeHistoryDetail retrieves detailed information for a specific history entry, including lazily-fetched VCS status for the project directory.
VCS status reuses the same vc.VCSProvider + vcsStatusToProto path that GetVCSStatus uses for running sessions, so the logic is not duplicated.
func (*SearchService) GetClaudeHistoryMessages ¶
func (ss *SearchService) GetClaudeHistoryMessages( ctx context.Context, req *connect.Request[sessionv1.GetClaudeHistoryMessagesRequest], ) (*connect.Response[sessionv1.GetClaudeHistoryMessagesResponse], error)
GetClaudeHistoryMessages retrieves messages from a specific conversation.
func (*SearchService) ListClaudeHistory ¶
func (ss *SearchService) ListClaudeHistory( ctx context.Context, req *connect.Request[sessionv1.ListClaudeHistoryRequest], ) (*connect.Response[sessionv1.ListClaudeHistoryResponse], error)
ListClaudeHistory returns Claude session history entries with optional filtering and cursor-based pagination.
Pagination rules:
- page_size controls how many entries are returned per page (default 100, max 500).
- page_token, when set, resumes from the position after the last entry on the previous page. Leave it empty for the first page.
- next_page_token in the response is non-empty when more pages exist; pass it as page_token in the next request.
- The legacy limit field is honoured when page_size is zero.
- Filters (project, search_query) must be identical across all pages of a paginated sequence.
func (*SearchService) SearchClaudeHistory ¶
func (ss *SearchService) SearchClaudeHistory( ctx context.Context, req *connect.Request[sessionv1.SearchClaudeHistoryRequest], ) (*connect.Response[sessionv1.SearchClaudeHistoryResponse], error)
SearchClaudeHistory performs full-text search across Claude conversation history.
type SecretScanResult ¶
type SecretScanResult struct {
Found bool
PatternName string // name of the first matching pattern
}
SecretScanResult holds the result of scanning for secrets.
func ScanForSecrets ¶
func ScanForSecrets(text string) SecretScanResult
ScanForSecrets checks text for known secret patterns. Returns the first match found, or an empty result if none. Only the first 4096 bytes are scanned to bound performance on very long commands.
type ServerInfo ¶
type ServerInfo struct {
PID int `json:"pid"`
UptimeSeconds int64 `json:"uptime_seconds"`
GoVersion string `json:"go_version"`
OS string `json:"os"`
Arch string `json:"arch"`
}
ServerInfo contains runtime metadata for the server process.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService implements the SessionServiceHandler interface for ConnectRPC.
func NewSessionService ¶
func NewSessionService(storage session.InstanceStore, eventBus *events.EventBus) *SessionService
NewSessionService creates a new SessionService with the given storage and event bus. NOTE: Instances are NOT loaded here to prevent double-loading and initialization timing issues. Instances will be loaded in server.go after dependencies (statusManager, reviewQueue) are wired.
func NewSessionServiceFromConfig ¶
func NewSessionServiceFromConfig() (*SessionService, error)
NewSessionServiceFromConfig creates a SessionService using EntRepository as storage backend. On first startup, if the legacy state.json exists and Ent DB is empty, sessions are auto-migrated from JSON to Ent.
func (*SessionService) AcknowledgeSession ¶
func (s *SessionService) AcknowledgeSession( ctx context.Context, req *connect.Request[sessionv1.AcknowledgeSessionRequest], ) (*connect.Response[sessionv1.AcknowledgeSessionResponse], error)
AcknowledgeSession marks a session as acknowledged in the review queue. The session won't reappear in the queue until it receives an update.
func (*SessionService) AssignSessionsToProject ¶ added in v1.23.0
func (s *SessionService) AssignSessionsToProject( ctx context.Context, req *connect.Request[sessionv1.AssignSessionsToProjectRequest], ) (*connect.Response[sessionv1.AssignSessionsToProjectResponse], error)
+api: project:assign-sessions AssignSessionsToProject assigns one or more sessions to a project.
func (*SessionService) BatchCreateSessions ¶ added in v1.23.0
func (s *SessionService) BatchCreateSessions( ctx context.Context, req *connect.Request[sessionv1.BatchCreateSessionsRequest], ) (*connect.Response[sessionv1.BatchCreateSessionsResponse], error)
+api: session:batch-create BatchCreateSessions creates multiple sessions with bounded concurrency (max 3) and per-repo serialization to prevent git worktree races.
func (*SessionService) ClearNotificationHistory ¶
func (s *SessionService) ClearNotificationHistory( ctx context.Context, req *connect.Request[sessionv1.ClearNotificationHistoryRequest], ) (*connect.Response[sessionv1.ClearNotificationHistoryResponse], error)
ClearNotificationHistory removes notifications from the history.
func (*SessionService) ClosePR ¶
func (s *SessionService) ClosePR( ctx context.Context, req *connect.Request[sessionv1.ClosePRRequest], ) (*connect.Response[sessionv1.ClosePRResponse], error)
ClosePR closes the PR without merging for a session.
func (*SessionService) CreateCheckpoint ¶
func (s *SessionService) CreateCheckpoint( ctx context.Context, req *connect.Request[sessionv1.CreateCheckpointRequest], ) (*connect.Response[sessionv1.CreateCheckpointResponse], error)
CreateCheckpoint captures the current state of a session as a named bookmark.
func (*SessionService) CreateDebugSnapshot ¶
func (s *SessionService) CreateDebugSnapshot( ctx context.Context, req *connect.Request[sessionv1.CreateDebugSnapshotRequest], ) (*connect.Response[sessionv1.CreateDebugSnapshotResponse], error)
CreateDebugSnapshot captures diagnostic information and writes a JSON file to the log directory.
func (*SessionService) CreateProject ¶ added in v1.23.0
func (s *SessionService) CreateProject( ctx context.Context, req *connect.Request[sessionv1.CreateProjectRequest], ) (*connect.Response[sessionv1.CreateProjectResponse], error)
+api: project:create CreateProject creates a new project for grouping sessions.
func (*SessionService) CreateSession ¶
func (s *SessionService) CreateSession( ctx context.Context, req *connect.Request[sessionv1.CreateSessionRequest], ) (*connect.Response[sessionv1.CreateSessionResponse], error)
CreateSession initializes a new AI agent session with tmux and git worktree. +api: session:create
func (*SessionService) DeleteApprovalRule ¶
func (s *SessionService) DeleteApprovalRule( ctx context.Context, req *connect.Request[sessionv1.DeleteApprovalRuleRequest], ) (*connect.Response[sessionv1.DeleteApprovalRuleResponse], error)
DeleteApprovalRule removes a user-defined auto-approval rule by ID.
func (*SessionService) DeleteDirectoryRule ¶ added in v1.12.0
func (s *SessionService) DeleteDirectoryRule(ctx context.Context, req *connect.Request[sessionv1.DeleteDirectoryRuleRequest]) (*connect.Response[sessionv1.DeleteDirectoryRuleResponse], error)
DeleteDirectoryRule removes a directory rule by path.
func (*SessionService) DeleteProfile ¶ added in v1.12.0
func (s *SessionService) DeleteProfile(ctx context.Context, req *connect.Request[sessionv1.DeleteProfileRequest]) (*connect.Response[sessionv1.DeleteProfileResponse], error)
DeleteProfile removes a named profile by name.
func (*SessionService) DeleteProject ¶ added in v1.23.0
func (s *SessionService) DeleteProject( ctx context.Context, req *connect.Request[sessionv1.DeleteProjectRequest], ) (*connect.Response[sessionv1.DeleteProjectResponse], error)
+api: project:delete DeleteProject removes a project (sessions are unassigned, not deleted).
func (*SessionService) DeletePromptHistory ¶ added in v1.23.0
func (s *SessionService) DeletePromptHistory( ctx context.Context, req *connect.Request[sessionv1.DeletePromptHistoryRequest], ) (*connect.Response[sessionv1.DeletePromptHistoryResponse], error)
+api: session:delete-prompt-history DeletePromptHistory removes a saved prompt from history.
func (*SessionService) DeleteSession ¶
func (s *SessionService) DeleteSession( ctx context.Context, req *connect.Request[sessionv1.DeleteSessionRequest], ) (*connect.Response[sessionv1.DeleteSessionResponse], error)
DeleteSession stops and removes a session, cleaning up resources. +api: session:delete
func (*SessionService) FindLiveInstance ¶ added in v1.18.0
func (s *SessionService) FindLiveInstance(id string) *session.Instance
FindLiveInstance returns the live in-memory instance held by the ReviewQueuePoller, or nil if the poller is not wired or the session is not found. Use this instead of LoadInstances() for read-only and mutation operations that need the live instance (with its PTY handles and controller state).
func (*SessionService) FocusWindow ¶
func (s *SessionService) FocusWindow( ctx context.Context, req *connect.Request[sessionv1.FocusWindowRequest], ) (*connect.Response[sessionv1.FocusWindowResponse], error)
FocusWindow activates a window for the specified application.
func (*SessionService) ForkSession ¶
func (s *SessionService) ForkSession( ctx context.Context, req *connect.Request[sessionv1.ForkSessionRequest], ) (*connect.Response[sessionv1.ForkSessionResponse], error)
ForkSession creates a new independent session branched from a checkpoint on an existing session.
func (*SessionService) GetAnalyticsStore ¶
func (s *SessionService) GetAnalyticsStore() *AnalyticsStore
GetAnalyticsStore returns the analytics store for wiring up the ApprovalHandler.
func (*SessionService) GetApprovalAnalytics ¶
func (s *SessionService) GetApprovalAnalytics( ctx context.Context, req *connect.Request[sessionv1.GetApprovalAnalyticsRequest], ) (*connect.Response[sessionv1.GetApprovalAnalyticsResponse], error)
GetApprovalAnalytics returns aggregated analytics for classification decisions.
func (*SessionService) GetApprovalStore ¶
func (s *SessionService) GetApprovalStore() *ApprovalStore
GetApprovalStore returns the approval store for wiring up the HTTP hook handler.
func (*SessionService) GetClassifier ¶
func (s *SessionService) GetClassifier() *classifier.RuleBasedClassifier
GetClassifier returns the rule-based classifier for wiring up the ApprovalHandler.
func (*SessionService) GetClaudeConfig ¶
func (s *SessionService) GetClaudeConfig( ctx context.Context, req *connect.Request[sessionv1.GetClaudeConfigRequest], ) (*connect.Response[sessionv1.GetClaudeConfigResponse], error)
GetClaudeConfig retrieves a Claude configuration file by name.
func (*SessionService) GetClaudeHistoryDetail ¶
func (s *SessionService) GetClaudeHistoryDetail( ctx context.Context, req *connect.Request[sessionv1.GetClaudeHistoryDetailRequest], ) (*connect.Response[sessionv1.GetClaudeHistoryDetailResponse], error)
GetClaudeHistoryDetail retrieves detailed information for a specific history entry.
func (*SessionService) GetClaudeHistoryMessages ¶
func (s *SessionService) GetClaudeHistoryMessages( ctx context.Context, req *connect.Request[sessionv1.GetClaudeHistoryMessagesRequest], ) (*connect.Response[sessionv1.GetClaudeHistoryMessagesResponse], error)
GetClaudeHistoryMessages retrieves messages from a specific conversation.
func (*SessionService) GetCurrentDatabase ¶
func (s *SessionService) GetCurrentDatabase( ctx context.Context, req *connect.Request[sessionv1.GetCurrentDatabaseRequest], ) (*connect.Response[sessionv1.GetCurrentDatabaseResponse], error)
GetCurrentDatabase returns metadata for the currently active workspace database.
func (*SessionService) GetEventBus ¶
func (s *SessionService) GetEventBus() *events.EventBus
GetEventBus returns the event bus instance for wiring up reactive components.
func (*SessionService) GetFileContent ¶ added in v1.11.0
func (s *SessionService) GetFileContent( ctx context.Context, req *connect.Request[sessionv1.GetFileContentRequest], ) (*connect.Response[sessionv1.GetFileContentResponse], error)
GetFileContent retrieves the text content of a file in a session's worktree.
func (*SessionService) GetInstanceStore ¶ added in v1.1.0
func (s *SessionService) GetInstanceStore() session.InstanceStore
GetInstanceStore returns the InstanceStore interface, suitable for both production and test code.
func (*SessionService) GetLogs ¶
func (s *SessionService) GetLogs( ctx context.Context, req *connect.Request[sessionv1.GetLogsRequest], ) (*connect.Response[sessionv1.GetLogsResponse], error)
GetLogs retrieves application logs with optional filtering and search.
func (*SessionService) GetNotificationHistory ¶
func (s *SessionService) GetNotificationHistory( ctx context.Context, req *connect.Request[sessionv1.GetNotificationHistoryRequest], ) (*connect.Response[sessionv1.GetNotificationHistoryResponse], error)
GetNotificationHistory returns persisted notification history with optional filtering.
func (*SessionService) GetNotificationStore ¶
func (s *SessionService) GetNotificationStore() *notifications.NotificationHistoryStore
GetNotificationStore returns the notification history store.
func (*SessionService) GetPRComments ¶
func (s *SessionService) GetPRComments( ctx context.Context, req *connect.Request[sessionv1.GetPRCommentsRequest], ) (*connect.Response[sessionv1.GetPRCommentsResponse], error)
GetPRComments retrieves all comments on the PR for a session.
func (*SessionService) GetPRInfo ¶
func (s *SessionService) GetPRInfo( ctx context.Context, req *connect.Request[sessionv1.GetPRInfoRequest], ) (*connect.Response[sessionv1.GetPRInfoResponse], error)
GetPRInfo retrieves the latest PR information for a session.
func (*SessionService) GetReviewQueue ¶
func (s *SessionService) GetReviewQueue( ctx context.Context, req *connect.Request[sessionv1.GetReviewQueueRequest], ) (*connect.Response[sessionv1.GetReviewQueueResponse], error)
GetReviewQueue returns sessions needing user attention with priority ordering.
func (*SessionService) GetReviewQueueInstance ¶
func (s *SessionService) GetReviewQueueInstance() *session.ReviewQueue
GetReviewQueueInstance returns the review queue instance for wiring up reactive components.
func (*SessionService) GetSession ¶
func (s *SessionService) GetSession( ctx context.Context, req *connect.Request[sessionv1.GetSessionRequest], ) (*connect.Response[sessionv1.GetSessionResponse], error)
GetSession retrieves a specific session by ID (Title).
func (*SessionService) GetSessionDefaults ¶ added in v1.12.0
func (s *SessionService) GetSessionDefaults(ctx context.Context, req *connect.Request[sessionv1.GetSessionDefaultsRequest]) (*connect.Response[sessionv1.GetSessionDefaultsResponse], error)
GetSessionDefaults returns the full session defaults configuration.
func (*SessionService) GetSessionDiff ¶
func (s *SessionService) GetSessionDiff( ctx context.Context, req *connect.Request[sessionv1.GetSessionDiffRequest], ) (*connect.Response[sessionv1.GetSessionDiffResponse], error)
GetSessionDiff retrieves the current git diff for a session.
func (*SessionService) GetStorage ¶
func (s *SessionService) GetStorage() *session.Storage
GetStorage returns the concrete *session.Storage for components that haven't migrated to InstanceStore yet. Returns nil when SessionService was constructed with a fake InstanceStore (e.g., in unit tests). Prefer using the session.InstanceStore interface via GetInstanceStore() for new code.
func (*SessionService) GetTerminalSnapshot ¶ added in v1.14.0
func (s *SessionService) GetTerminalSnapshot( ctx context.Context, req *connect.Request[sessionv1.GetTerminalSnapshotRequest], ) (*connect.Response[sessionv1.GetTerminalSnapshotResponse], error)
GetTerminalSnapshot returns the last N lines of terminal output for a session. Uses inst.Preview() for a read-only snapshot without requiring an active stream.
func (*SessionService) GetVCSStatus ¶
func (s *SessionService) GetVCSStatus( ctx context.Context, req *connect.Request[sessionv1.GetVCSStatusRequest], ) (*connect.Response[sessionv1.GetVCSStatusResponse], error)
GetVCSStatus retrieves the current version control status for a session.
func (*SessionService) GetWorkspaceInfo ¶
func (s *SessionService) GetWorkspaceInfo( ctx context.Context, req *connect.Request[sessionv1.GetWorkspaceInfoRequest], ) (*connect.Response[sessionv1.GetWorkspaceInfoResponse], error)
GetWorkspaceInfo retrieves VCS and workspace information for a session.
func (*SessionService) ListApprovalRules ¶
func (s *SessionService) ListApprovalRules( ctx context.Context, req *connect.Request[sessionv1.ListApprovalRulesRequest], ) (*connect.Response[sessionv1.ListApprovalRulesResponse], error)
ListApprovalRules returns all auto-approval rules (user, seed, and claude-settings).
func (*SessionService) ListBranches ¶ added in v1.17.0
func (s *SessionService) ListBranches( ctx context.Context, req *connect.Request[sessionv1.ListBranchesRequest], ) (*connect.Response[sessionv1.ListBranchesResponse], error)
ListBranches returns the git branches for a given repository path. Results are cached per repo path with a 5-minute TTL. ADR-002.
func (*SessionService) ListCheckpoints ¶
func (s *SessionService) ListCheckpoints( ctx context.Context, req *connect.Request[sessionv1.ListCheckpointsRequest], ) (*connect.Response[sessionv1.ListCheckpointsResponse], error)
ListCheckpoints returns all checkpoints for the specified session.
func (*SessionService) ListClaudeConfigs ¶
func (s *SessionService) ListClaudeConfigs( ctx context.Context, req *connect.Request[sessionv1.ListClaudeConfigsRequest], ) (*connect.Response[sessionv1.ListClaudeConfigsResponse], error)
ListClaudeConfigs returns all configuration files in the ~/.claude directory.
func (*SessionService) ListClaudeHistory ¶
func (s *SessionService) ListClaudeHistory( ctx context.Context, req *connect.Request[sessionv1.ListClaudeHistoryRequest], ) (*connect.Response[sessionv1.ListClaudeHistoryResponse], error)
ListClaudeHistory returns Claude session history entries with optional filtering.
func (*SessionService) ListDatabases ¶
func (s *SessionService) ListDatabases( ctx context.Context, req *connect.Request[sessionv1.ListDatabasesRequest], ) (*connect.Response[sessionv1.ListDatabasesResponse], error)
ListDatabases returns all discovered workspace databases with metadata.
func (*SessionService) ListFiles ¶ added in v1.11.0
func (s *SessionService) ListFiles( ctx context.Context, req *connect.Request[sessionv1.ListFilesRequest], ) (*connect.Response[sessionv1.ListFilesResponse], error)
ListFiles returns the immediate children of a directory in a session's worktree.
func (*SessionService) ListPathCompletions ¶ added in v1.10.0
func (s *SessionService) ListPathCompletions( ctx context.Context, req *connect.Request[sessionv1.ListPathCompletionsRequest], ) (*connect.Response[sessionv1.ListPathCompletionsResponse], error)
ListPathCompletions returns filesystem entries matching the given path prefix.
func (*SessionService) ListPendingApprovals ¶
func (s *SessionService) ListPendingApprovals( ctx context.Context, req *connect.Request[sessionv1.ListPendingApprovalsRequest], ) (*connect.Response[sessionv1.ListPendingApprovalsResponse], error)
ListPendingApprovals returns all pending Claude Code tool approval requests.
func (*SessionService) ListProjects ¶ added in v1.23.0
func (s *SessionService) ListProjects( ctx context.Context, req *connect.Request[sessionv1.ListProjectsRequest], ) (*connect.Response[sessionv1.ListProjectsResponse], error)
+api: project:list ListProjects returns all projects.
func (*SessionService) ListPromptHistory ¶ added in v1.23.0
func (s *SessionService) ListPromptHistory( ctx context.Context, req *connect.Request[sessionv1.ListPromptHistoryRequest], ) (*connect.Response[sessionv1.ListPromptHistoryResponse], error)
+api: session:list-prompt-history ListPromptHistory returns saved prompt history entries.
func (*SessionService) ListSessions ¶
func (s *SessionService) ListSessions( ctx context.Context, req *connect.Request[sessionv1.ListSessionsRequest], ) (*connect.Response[sessionv1.ListSessionsResponse], error)
ListSessions returns all sessions with optional filtering. This includes both managed sessions and external mux-enabled sessions. +api: session:list
func (*SessionService) ListWorkspaceTargets ¶
func (s *SessionService) ListWorkspaceTargets( ctx context.Context, req *connect.Request[sessionv1.ListWorkspaceTargetsRequest], ) (*connect.Response[sessionv1.ListWorkspaceTargetsResponse], error)
ListWorkspaceTargets returns available switch targets for a session. +api: workspace:list-targets
func (*SessionService) ListWorktrees ¶ added in v1.12.0
func (s *SessionService) ListWorktrees( ctx context.Context, req *connect.Request[sessionv1.ListWorktreesRequest], ) (*connect.Response[sessionv1.ListWorktreesResponse], error)
ListWorktrees returns the git worktrees for a given repository path.
func (*SessionService) LogUserInteraction ¶
func (s *SessionService) LogUserInteraction( ctx context.Context, req *connect.Request[sessionv1.LogUserInteractionRequest], ) (*connect.Response[sessionv1.LogUserInteractionResponse], error)
LogUserInteraction logs a user interaction event for audit trail and analytics.
func (*SessionService) MarkNotificationRead ¶
func (s *SessionService) MarkNotificationRead( ctx context.Context, req *connect.Request[sessionv1.MarkNotificationReadRequest], ) (*connect.Response[sessionv1.MarkNotificationReadResponse], error)
MarkNotificationRead marks specific notifications as read.
func (*SessionService) MergeDatabase ¶
func (s *SessionService) MergeDatabase( ctx context.Context, req *connect.Request[sessionv1.MergeDatabaseRequest], ) (*connect.Response[sessionv1.MergeDatabaseResponse], error)
MergeDatabase copies sessions from a source workspace into the current database.
func (*SessionService) MergePR ¶
func (s *SessionService) MergePR( ctx context.Context, req *connect.Request[sessionv1.MergePRRequest], ) (*connect.Response[sessionv1.MergePRResponse], error)
MergePR merges the PR for a session using the specified merge method.
func (*SessionService) PostPRComment ¶
func (s *SessionService) PostPRComment( ctx context.Context, req *connect.Request[sessionv1.PostPRCommentRequest], ) (*connect.Response[sessionv1.PostPRCommentResponse], error)
PostPRComment posts a new comment to the PR for a session.
func (*SessionService) RemoveFromAllPollers ¶ added in v1.18.0
func (s *SessionService) RemoveFromAllPollers(id string)
RemoveFromAllPollers is the exported version for use by MCP tools and other callers outside the services package that need to clean up after deletion.
func (*SessionService) RenameSession ¶
func (s *SessionService) RenameSession( ctx context.Context, req *connect.Request[sessionv1.RenameSessionRequest], ) (*connect.Response[sessionv1.RenameSessionResponse], error)
RenameSession changes the title of an existing session. Validates that the new title doesn't conflict with existing sessions.
func (*SessionService) ResolveApproval ¶
func (s *SessionService) ResolveApproval( ctx context.Context, req *connect.Request[sessionv1.ResolveApprovalRequest], ) (*connect.Response[sessionv1.ResolveApprovalResponse], error)
ResolveApproval allows the web UI to approve or deny a pending Claude Code tool use request.
func (*SessionService) ResolveDefaults ¶ added in v1.12.0
func (s *SessionService) ResolveDefaults(ctx context.Context, req *connect.Request[sessionv1.ResolveDefaultsRequest]) (*connect.Response[sessionv1.ResolveDefaultsResponse], error)
ResolveDefaults merges all default layers for the given working directory and profile.
func (*SessionService) RestartSession ¶
func (s *SessionService) RestartSession( ctx context.Context, req *connect.Request[sessionv1.RestartSessionRequest], ) (*connect.Response[sessionv1.RestartSessionResponse], error)
RestartSession restarts a session by killing and recreating the tmux session. Optionally preserves terminal output for debugging purposes.
func (*SessionService) RunOneShot ¶ added in v1.23.0
func (s *SessionService) RunOneShot( ctx context.Context, req *connect.Request[sessionv1.RunOneShotRequest], ) (*connect.Response[sessionv1.RunOneShotResponse], error)
+api: session:run-one-shot RunOneShot executes `claude -p <prompt>` in the session's worktree and returns the combined output along with an extracted PR URL and branch divergence status.
func (*SessionService) SearchClaudeHistory ¶
func (s *SessionService) SearchClaudeHistory( ctx context.Context, req *connect.Request[sessionv1.SearchClaudeHistoryRequest], ) (*connect.Response[sessionv1.SearchClaudeHistoryResponse], error)
SearchClaudeHistory performs full-text search across Claude conversation history. +api: history:search
func (*SessionService) SearchFiles ¶ added in v1.12.0
func (s *SessionService) SearchFiles( ctx context.Context, req *connect.Request[sessionv1.SearchFilesRequest], ) (*connect.Response[sessionv1.SearchFilesResponse], error)
SearchFiles performs a recursive name-substring search in a session's worktree.
func (*SessionService) SendNotification ¶
func (s *SessionService) SendNotification( ctx context.Context, req *connect.Request[sessionv1.SendNotificationRequest], ) (*connect.Response[sessionv1.SendNotificationResponse], error)
SendNotification allows tmux sessions and external Claude processes to send notifications.
func (*SessionService) SetConfigService ¶
func (s *SessionService) SetConfigService(svc *ConfigService)
SetConfigService wires the ConfigService for delegating config RPCs.
func (*SessionService) SetExternalDiscovery ¶
func (s *SessionService) SetExternalDiscovery(discovery *session.ExternalSessionDiscovery)
SetExternalDiscovery sets the external session discovery for accessing mux-enabled sessions.
func (*SessionService) SetHistoryLinker ¶ added in v1.23.1
func (s *SessionService) SetHistoryLinker(hl *session.HistoryLinker)
SetHistoryLinker wires the HistoryLinker so deleted sessions are also removed from it and cannot be re-persisted by the shutdown hook.
func (*SessionService) SetMCPServerURL ¶ added in v1.17.0
func (s *SessionService) SetMCPServerURL(url string)
SetMCPServerURL configures the HTTP MCP endpoint URL passed to new sessions. Call this during server startup after the listen address is known.
func (*SessionService) SetNotificationStore ¶
func (s *SessionService) SetNotificationStore(store *notifications.NotificationHistoryStore)
SetNotificationStore sets the notification history store for the notification history RPCs and wires it into the approval service so resolved approvals are stamped with their decision.
func (*SessionService) SetReactiveQueueManager ¶
func (s *SessionService) SetReactiveQueueManager(mgr ReactiveQueueManager)
SetReactiveQueueManager sets the ReactiveQueueManager (dependency injection). This must be called before WatchReviewQueue is used.
func (*SessionService) SetReviewQueuePoller ¶
func (s *SessionService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
SetReviewQueuePoller wires the ReviewQueuePoller so new/deleted sessions are added/removed from the poller and AcknowledgeSession updates poller references. Must be called during server startup before any session mutation RPCs are used.
func (*SessionService) SetScrollbackManager ¶
func (s *SessionService) SetScrollbackManager(mgr scrollbackSequencer)
SetScrollbackManager wires a scrollback sequence provider for checkpoint creation.
func (*SessionService) SetStatusManager ¶
func (s *SessionService) SetStatusManager(mgr *session.InstanceStatusManager)
SetStatusManager wires the InstanceStatusManager so that instances loaded via loadInstancesWithWiring (e.g., fallback path in ListSessions) receive status tracking. Must be called during server startup.
func (*SessionService) StreamTerminal ¶
func (s *SessionService) StreamTerminal( ctx context.Context, stream *connect.BidiStream[sessionv1.TerminalData, sessionv1.TerminalData], ) error
StreamTerminal provides bidirectional streaming for terminal I/O with delta compression. Implements bidirectional streaming where: - Client sends: terminal input and resize events - Server sends: terminal deltas (compressed output) or raw output (fallback)
func (*SessionService) SwitchDatabase ¶
func (s *SessionService) SwitchDatabase( ctx context.Context, req *connect.Request[sessionv1.SwitchDatabaseRequest], ) (*connect.Response[sessionv1.SwitchDatabaseResponse], error)
SwitchDatabase switches to a different workspace database and restarts the server.
func (*SessionService) SwitchWorkspace ¶
func (s *SessionService) SwitchWorkspace( ctx context.Context, req *connect.Request[sessionv1.SwitchWorkspaceRequest], ) (*connect.Response[sessionv1.SwitchWorkspaceResponse], error)
SwitchWorkspace switches a session's workspace to a different branch, revision, or worktree. +api: workspace:switch
func (*SessionService) UpdateClaudeConfig ¶
func (s *SessionService) UpdateClaudeConfig( ctx context.Context, req *connect.Request[sessionv1.UpdateClaudeConfigRequest], ) (*connect.Response[sessionv1.UpdateClaudeConfigResponse], error)
UpdateClaudeConfig updates a Claude configuration file with atomic write and backup.
func (*SessionService) UpdateGlobalDefaults ¶ added in v1.12.0
func (s *SessionService) UpdateGlobalDefaults(ctx context.Context, req *connect.Request[sessionv1.UpdateGlobalDefaultsRequest]) (*connect.Response[sessionv1.UpdateGlobalDefaultsResponse], error)
UpdateGlobalDefaults replaces the global default fields.
func (*SessionService) UpdateProject ¶ added in v1.23.0
func (s *SessionService) UpdateProject( ctx context.Context, req *connect.Request[sessionv1.UpdateProjectRequest], ) (*connect.Response[sessionv1.UpdateProjectResponse], error)
+api: project:update UpdateProject updates an existing project's metadata.
func (*SessionService) UpdateSession ¶
func (s *SessionService) UpdateSession( ctx context.Context, req *connect.Request[sessionv1.UpdateSessionRequest], ) (*connect.Response[sessionv1.UpdateSessionResponse], error)
UpdateSession modifies session properties (pause/resume, category, title). +api: session:update
func (*SessionService) UpsertApprovalRule ¶
func (s *SessionService) UpsertApprovalRule( ctx context.Context, req *connect.Request[sessionv1.UpsertApprovalRuleRequest], ) (*connect.Response[sessionv1.UpsertApprovalRuleResponse], error)
UpsertApprovalRule creates or updates a user-defined auto-approval rule.
func (*SessionService) UpsertDirectoryRule ¶ added in v1.12.0
func (s *SessionService) UpsertDirectoryRule(ctx context.Context, req *connect.Request[sessionv1.UpsertDirectoryRuleRequest]) (*connect.Response[sessionv1.UpsertDirectoryRuleResponse], error)
UpsertDirectoryRule creates or updates a directory rule.
func (*SessionService) UpsertProfile ¶ added in v1.12.0
func (s *SessionService) UpsertProfile(ctx context.Context, req *connect.Request[sessionv1.UpsertProfileRequest]) (*connect.Response[sessionv1.UpsertProfileResponse], error)
UpsertProfile creates or updates a named profile.
func (*SessionService) WatchReviewQueue ¶
func (s *SessionService) WatchReviewQueue( ctx context.Context, req *connect.Request[sessionv1.WatchReviewQueueRequest], stream *connect.ServerStream[sessionv1.ReviewQueueEvent], ) error
WatchReviewQueue streams real-time review queue events.
func (*SessionService) WatchSessions ¶
func (s *SessionService) WatchSessions( ctx context.Context, req *connect.Request[sessionv1.WatchSessionsRequest], stream *connect.ServerStream[sessionv1.SessionEvent], ) error
WatchSessions streams real-time session events (created/updated/deleted). Sends initial snapshot of all sessions, then subscribes to real-time updates. +api: session:watch
type SessionSnapshot ¶
type SessionSnapshot struct {
Title string `json:"title"`
Status string `json:"status"`
Program string `json:"program"`
Path string `json:"path"`
Branch string `json:"branch"`
SessionType string `json:"session_type"`
Category string `json:"category"`
Tags []string `json:"tags"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastTerminalUpdate time.Time `json:"last_terminal_update,omitempty"`
LastMeaningfulOutput time.Time `json:"last_meaningful_output,omitempty"`
LastOutputSignature string `json:"last_output_signature,omitempty"`
PaneContent string `json:"pane_content,omitempty"`
PaneContentRaw string `json:"pane_content_raw,omitempty"`
PaneContentTruncated bool `json:"pane_content_truncated,omitempty"`
InstanceType string `json:"instance_type"`
GitHubPRNumber int `json:"github_pr_number,omitempty"`
}
SessionSnapshot captures the state of a single session at snapshot time.
type SessionStreamer ¶ added in v1.15.0
type SessionStreamer interface {
StartControlMode() error
StopControlMode() error
SubscribeControlModeUpdates() (string, <-chan []byte)
UnsubscribeControlModeUpdates(id string)
}
SessionStreamer is the interface the WebSocket streaming handler requires from a session. Defined in the consumer package (server/services) to prevent import cycles and to keep the interface minimal — only what this package legitimately needs for terminal streaming.
*session.Instance satisfies this interface via delegation methods.
type SubcommandStat ¶
type SubcommandStat struct {
Program string `json:"program"`
Subcommand string `json:"subcommand"`
Category string `json:"category"`
Count int `json:"count"`
}
SubcommandStat is a (program, subcommand) pair with its usage count. Subcommand may contain a space for two-level CLIs (e.g., "pr create" for gh).
type TerminalWebSocketHandler ¶
type TerminalWebSocketHandler struct {
// contains filtered or unexported fields
}
TerminalWebSocketHandler handles WebSocket connections for terminal streaming
func NewTerminalWebSocketHandler ¶
func NewTerminalWebSocketHandler(storage session.Storage, eventBus *events.EventBus) *TerminalWebSocketHandler
NewTerminalWebSocketHandler creates a new WebSocket handler for terminal streaming
func (*TerminalWebSocketHandler) HandleWebSocket ¶
func (h *TerminalWebSocketHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket upgrades HTTP connection to WebSocket and handles terminal streaming
type TmuxSessionDetail ¶
type TmuxSessionDetail struct {
TmuxSessionName string `json:"tmux_session_name"`
ListPanesOutput string `json:"list_panes_output,omitempty"`
PaneContent string `json:"pane_content,omitempty"`
}
TmuxSessionDetail captures per-tmux-session diagnostic info.
type TmuxSnapshot ¶
type TmuxSnapshot struct {
ListSessionsOutput string `json:"list_sessions_output"`
PerSession []TmuxSessionDetail `json:"per_session"`
}
TmuxSnapshot captures global tmux state.
type UnfinishedWorkService ¶ added in v1.22.0
type UnfinishedWorkService struct {
// contains filtered or unexported fields
}
UnfinishedWorkService implements the ConnectRPC UnfinishedWorkServiceHandler.
func NewUnfinishedWorkService ¶ added in v1.22.0
func NewUnfinishedWorkService( scanner *unfinished.Scanner, stateStore *unfinished.StateStore, eventBus *events.EventBus, storage *session.Storage, ) *UnfinishedWorkService
NewUnfinishedWorkService creates a new service instance.
func (*UnfinishedWorkService) DismissWorktree ¶ added in v1.22.0
func (s *UnfinishedWorkService) DismissWorktree( _ context.Context, req *connect.Request[sessionv1.DismissWorktreeRequest], ) (*connect.Response[sessionv1.DismissWorktreeResponse], error)
DismissWorktree permanently hides a worktree from results.
func (*UnfinishedWorkService) GetUnfinishedWorkConfig ¶ added in v1.22.0
func (s *UnfinishedWorkService) GetUnfinishedWorkConfig( _ context.Context, _ *connect.Request[sessionv1.GetUnfinishedWorkConfigRequest], ) (*connect.Response[sessionv1.GetUnfinishedWorkConfigResponse], error)
GetUnfinishedWorkConfig returns the current source configuration.
func (*UnfinishedWorkService) GetWorktreeAISummary ¶ added in v1.22.0
func (s *UnfinishedWorkService) GetWorktreeAISummary( ctx context.Context, req *connect.Request[sessionv1.GetWorktreeAISummaryRequest], ) (*connect.Response[sessionv1.GetWorktreeAISummaryResponse], error)
GetWorktreeAISummary generates or returns a cached AI summary.
func (*UnfinishedWorkService) ListUnfinishedWork ¶ added in v1.22.0
func (s *UnfinishedWorkService) ListUnfinishedWork( _ context.Context, _ *connect.Request[sessionv1.ListUnfinishedWorkRequest], ) (*connect.Response[sessionv1.ListUnfinishedWorkResponse], error)
ListUnfinishedWork returns the current snapshot of all unfinished worktrees.
func (*UnfinishedWorkService) QuickCommitPush ¶ added in v1.22.0
func (s *UnfinishedWorkService) QuickCommitPush( _ context.Context, req *connect.Request[sessionv1.QuickCommitPushRequest], ) (*connect.Response[sessionv1.QuickCommitPushResponse], error)
QuickCommitPush stages all changes, commits, and pushes.
func (*UnfinishedWorkService) ScanUnfinishedWork ¶ added in v1.22.0
func (s *UnfinishedWorkService) ScanUnfinishedWork( _ context.Context, _ *connect.Request[sessionv1.ScanUnfinishedWorkRequest], ) (*connect.Response[sessionv1.ScanUnfinishedWorkResponse], error)
ScanUnfinishedWork triggers an immediate scan.
func (*UnfinishedWorkService) SnoozeWorktree ¶ added in v1.22.0
func (s *UnfinishedWorkService) SnoozeWorktree( _ context.Context, req *connect.Request[sessionv1.SnoozeWorktreeRequest], ) (*connect.Response[sessionv1.SnoozeWorktreeResponse], error)
SnoozeWorktree hides a worktree until the next HEAD SHA change.
func (*UnfinishedWorkService) UndismissWorktree ¶ added in v1.22.0
func (s *UnfinishedWorkService) UndismissWorktree( _ context.Context, req *connect.Request[sessionv1.UndismissWorktreeRequest], ) (*connect.Response[sessionv1.UndismissWorktreeResponse], error)
UndismissWorktree removes the dismiss record.
func (*UnfinishedWorkService) UpdateUnfinishedWorkConfig ¶ added in v1.22.0
func (s *UnfinishedWorkService) UpdateUnfinishedWorkConfig( _ context.Context, req *connect.Request[sessionv1.UpdateUnfinishedWorkConfigRequest], ) (*connect.Response[sessionv1.UpdateUnfinishedWorkConfigResponse], error)
UpdateUnfinishedWorkConfig replaces the source configuration.
func (*UnfinishedWorkService) WatchUnfinishedWork ¶ added in v1.22.0
func (s *UnfinishedWorkService) WatchUnfinishedWork( ctx context.Context, _ *connect.Request[sessionv1.WatchUnfinishedWorkRequest], stream *connect.ServerStream[sessionv1.UnfinishedWorkEvent], ) error
WatchUnfinishedWork streams real-time updates to connected clients. Pattern: send initial snapshot → subscribe to EventBus → forward events until disconnect.
type UtilityService ¶
type UtilityService struct {
// contains filtered or unexported fields
}
UtilityService handles miscellaneous utility RPCs: GetLogs, FocusWindow, and CreateDebugSnapshot.
Dependencies:
- approvalStore: needed by CreateDebugSnapshot to capture pending approvals
- reviewQueuePoller: late-wired; needed by CreateDebugSnapshot for live instances
func NewUtilityService ¶
func NewUtilityService(approvalStore *ApprovalStore) *UtilityService
NewUtilityService creates a UtilityService with the given dependencies.
func (*UtilityService) CreateDebugSnapshot ¶
func (us *UtilityService) CreateDebugSnapshot( ctx context.Context, req *connect.Request[sessionv1.CreateDebugSnapshotRequest], ) (*connect.Response[sessionv1.CreateDebugSnapshotResponse], error)
CreateDebugSnapshot captures diagnostic information and writes a JSON file to the log directory.
func (*UtilityService) FocusWindow ¶
func (us *UtilityService) FocusWindow( ctx context.Context, req *connect.Request[sessionv1.FocusWindowRequest], ) (*connect.Response[sessionv1.FocusWindowResponse], error)
FocusWindow activates a window for the specified application. Uses AppleScript on macOS to bring the application to front.
func (*UtilityService) GetLogs ¶
func (us *UtilityService) GetLogs( ctx context.Context, req *connect.Request[sessionv1.GetLogsRequest], ) (*connect.Response[sessionv1.GetLogsResponse], error)
GetLogs retrieves application logs with optional filtering and search.
func (*UtilityService) SetReviewQueuePoller ¶
func (us *UtilityService) SetReviewQueuePoller(poller *session.ReviewQueuePoller)
SetReviewQueuePoller sets the review queue poller (late-wired).
type WatchReviewQueueFilters ¶
type WatchReviewQueueFilters struct {
PriorityFilter []session.Priority
ReasonFilter []session.AttentionReason
SessionIDs []string
IncludeStatistics bool
InitialSnapshot bool
}
WatchReviewQueueFilters contains filters for review queue event streaming.
func (*WatchReviewQueueFilters) GetIncludeStatistics ¶
func (f *WatchReviewQueueFilters) GetIncludeStatistics() bool
func (*WatchReviewQueueFilters) GetInitialSnapshot ¶
func (f *WatchReviewQueueFilters) GetInitialSnapshot() bool
func (*WatchReviewQueueFilters) GetPriorityFilter ¶
func (f *WatchReviewQueueFilters) GetPriorityFilter() []session.Priority
Implement FilterProvider interface for type-safe conversion.
func (*WatchReviewQueueFilters) GetReasonFilter ¶
func (f *WatchReviewQueueFilters) GetReasonFilter() []session.AttentionReason
func (*WatchReviewQueueFilters) GetSessionIDs ¶
func (f *WatchReviewQueueFilters) GetSessionIDs() []string
type WorkspaceProvider ¶ added in v1.12.0
WorkspaceProvider resolves workspace path information for a session. Inject this interface into services that need path resolution instead of accessing session.Instance.Path directly.
type WorkspaceService ¶
type WorkspaceService struct {
// contains filtered or unexported fields
}
WorkspaceService handles all VCS/workspace RPC methods.
These methods operate on session workspace state (git/jj status, branch switching, worktrees) and may emit events after state-modifying operations.
func NewWorkspaceService ¶
func NewWorkspaceService(storage *session.Storage, eventBus *events.EventBus) *WorkspaceService
NewWorkspaceService creates a WorkspaceService with the given dependencies.
func (*WorkspaceService) GetVCSStatus ¶
func (ws *WorkspaceService) GetVCSStatus( ctx context.Context, req *connect.Request[sessionv1.GetVCSStatusRequest], ) (*connect.Response[sessionv1.GetVCSStatusResponse], error)
GetVCSStatus retrieves the current version control status for a session.
func (*WorkspaceService) GetWorkspace ¶ added in v1.12.0
func (ws *WorkspaceService) GetWorkspace(sessionID string) (session.Workspace, error)
GetWorkspace implements WorkspaceProvider.
func (*WorkspaceService) GetWorkspaceInfo ¶
func (ws *WorkspaceService) GetWorkspaceInfo( ctx context.Context, req *connect.Request[sessionv1.GetWorkspaceInfoRequest], ) (*connect.Response[sessionv1.GetWorkspaceInfoResponse], error)
GetWorkspaceInfo retrieves VCS and workspace information for a session.
func (*WorkspaceService) ListWorkspaceTargets ¶
func (ws *WorkspaceService) ListWorkspaceTargets( ctx context.Context, req *connect.Request[sessionv1.ListWorkspaceTargetsRequest], ) (*connect.Response[sessionv1.ListWorkspaceTargetsResponse], error)
ListWorkspaceTargets returns available switch targets for a session.
func (*WorkspaceService) SwitchWorkspace ¶
func (ws *WorkspaceService) SwitchWorkspace( ctx context.Context, req *connect.Request[sessionv1.SwitchWorkspaceRequest], ) (*connect.Response[sessionv1.SwitchWorkspaceResponse], error)
SwitchWorkspace switches a session's workspace to a different branch, revision, or worktree.
Source Files
¶
- analytics_store.go
- approval_handler.go
- approval_service.go
- approval_store.go
- circuit_breaker_handler.go
- claude_settings_parser.go
- config_service.go
- connectrpc_websocket.go
- database_service.go
- debug_snapshot.go
- defaults_service.go
- dir_cache.go
- domain_checker.go
- escape_code_handler.go
- event_converter.go
- exec_unix.go
- external_websocket.go
- file_service.go
- github_service.go
- hook_injector.go
- hook_receivers.go
- image_upload_handler.go
- mcp_injector.go
- notification_service.go
- path_completion_service.go
- path_matcher.go
- project_service.go
- push_handler.go
- push_service.go
- rate_limiter.go
- review_queue_service.go
- rules_service.go
- rules_store.go
- search_service.go
- secret_scanner.go
- session_service.go
- session_streamer.go
- terminal_websocket.go
- unfinished_work_service.go
- utility_service.go
- workspace_service.go