Documentation
¶
Overview ¶
Package methods provides JSON-RPC method implementations.
Package methods provides JSON-RPC method implementations.
Package methods provides JSON-RPC method implementations.
Package methods provides JSON-RPC method implementations for the session-based architecture.
Package methods provides JSON-RPC method implementations.
Package methods provides JSON-RPC method implementations.
Index ¶
- type AgentCapabilities
- type AgentInputParams
- type AgentInputResult
- type AgentManager
- type AgentRespondParams
- type AgentRespondResult
- type AgentRunParams
- type AgentRunResult
- type AgentService
- func (s *AgentService) Input(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *AgentService) RegisterMethods(r *handler.Registry)
- func (s *AgentService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *AgentService) Run(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *AgentService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *AgentService) Stop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type AgentState
- type AgentStatusResult
- type AgentStopResult
- type BranchInfo
- type BranchesResult
- type CheckoutParams
- type CheckoutResult
- type ClaudeAdapter
- func (a *ClaudeAdapter) AgentType() string
- func (a *ClaudeAdapter) IsPTYMode() bool
- func (a *ClaudeAdapter) PID() int
- func (a *ClaudeAdapter) SendPTYInput(input string) error
- func (a *ClaudeAdapter) SendResponse(toolUseID, response string, isError bool) error
- func (a *ClaudeAdapter) SessionID() string
- func (a *ClaudeAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, ...) error
- func (a *ClaudeAdapter) State() AgentState
- func (a *ClaudeAdapter) Stop(ctx context.Context) error
- type ClaudeCapabilities
- type ClientCapabilities
- type ClientFocusProvider
- type ClientInfo
- type ClientService
- type CodexAdapter
- func (a *CodexAdapter) AgentType() string
- func (a *CodexAdapter) IsPTYMode() bool
- func (a *CodexAdapter) PID() int
- func (a *CodexAdapter) SendPTYInput(input string) error
- func (a *CodexAdapter) SendResponse(toolUseID, response string, isError bool) error
- func (a *CodexAdapter) SessionID() string
- func (a *CodexAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, ...) error
- func (a *CodexAdapter) State() AgentState
- func (a *CodexAdapter) Stop(ctx context.Context) error
- type CodexManager
- type CommitParams
- type CommitResult
- type DiffParams
- type DiffResult
- type DirStats
- type DirectoryInfo
- type DiscardResult
- type EventPublisher
- type FileCapabilities
- type FileContentProvider
- type FileEntry
- type FileInfo
- type FileListResult
- type FileService
- type FilteredSubscriberProvider
- type GeminiAdapter
- func (a *GeminiAdapter) AgentType() string
- func (a *GeminiAdapter) IsPTYMode() bool
- func (a *GeminiAdapter) PID() int
- func (a *GeminiAdapter) SendPTYInput(input string) error
- func (a *GeminiAdapter) SendResponse(toolUseID, response string, isError bool) error
- func (a *GeminiAdapter) SessionID() string
- func (a *GeminiAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, ...) error
- func (a *GeminiAdapter) State() AgentState
- func (a *GeminiAdapter) Stop(ctx context.Context) error
- type GeminiManager
- type GetFileParams
- type GetFileResult
- type GetSessionElementsParams
- type GetSessionElementsResult
- type GetSessionMessagesParams
- type GetSessionMessagesResult
- type GetSessionParams
- type GetStatusResult
- type GitCapabilities
- type GitFileStatus
- type GitProvider
- type GitService
- func (s *GitService) Branches(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Checkout(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Commit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Diff(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Discard(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Pull(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Push(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) RegisterMethods(r *handler.Registry)
- func (s *GitService) Stage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *GitService) Unstage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type GitStatusInfo
- type GitWatcherManager
- type HealthResult
- type InitializeParams
- type InitializeResult
- type LifecycleService
- func (s *LifecycleService) Initialize(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *LifecycleService) Initialized(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *LifecycleService) IsInitialized() bool
- func (s *LifecycleService) RegisterMethods(r *handler.Registry)
- func (s *LifecycleService) Shutdown(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *LifecycleService) ShutdownChannel() <-chan struct{}
- type ListDirectoryParams
- type ListDirectoryResult
- type ListSessionsParams
- type ListSessionsResult
- type PaginationInfo
- type PathsParams
- type PendingParams
- type PendingRequestInfo
- type PermissionManager
- type PermissionService
- func (s *PermissionService) Pending(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *PermissionService) RegisterMethods(r *handler.Registry)
- func (s *PermissionService) Request(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *PermissionService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *PermissionService) SetTimeout(timeout time.Duration)
- func (s *PermissionService) Stats(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type PullResult
- type PushResult
- type RepositoryCapabilities
- type RepositoryIndexer
- type RepositoryService
- func (s *RepositoryService) GetStats(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *RepositoryService) GetTree(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *RepositoryService) IndexStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *RepositoryService) ListFiles(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *RepositoryService) Rebuild(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *RepositoryService) RegisterMethods(registry *handler.Registry)
- func (s *RepositoryService) Search(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type RequestParams
- type RespondParams
- type RuntimeCapabilityRegistry
- type RuntimeDescriptor
- type RuntimeMethods
- type RuntimeRouting
- type ServerCapabilities
- type ServerInfo
- type SessionElement
- type SessionElementsPagination
- type SessionFocusParams
- type SessionFocusProvider
- type SessionInfo
- type SessionManagerService
- func (s *SessionManagerService) ActivateSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) Active(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) DeleteHistorySession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) FileGet(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) FilesList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GetSessionMessages(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitBranches(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitCheckout(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitCommit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitDeleteBranch(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitDiff(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitDiscard(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitFetch(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitGetStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitInit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitLog(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitMerge(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitMergeAbort(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitPull(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitPush(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitRemoteAdd(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitRemoteList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitRemoteRemove(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitSetUpstream(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStash(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStashApply(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStashDrop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStashList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStashPop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) GitUnstage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) History(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) Info(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) Input(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) RegisterMethods(registry *handler.Registry)
- func (s *SessionManagerService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) Send(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) SetFocusProvider(provider SessionFocusProvider)
- func (s *SessionManagerService) SetSessionService(sessionService *SessionService)
- func (s *SessionManagerService) Start(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) State(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) Stop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) UnwatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionManagerService) WatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type SessionMessage
- type SessionMode
- type SessionProvider
- type SessionService
- func (s *SessionService) GetSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionService) GetSessionElements(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionService) GetSessionMessages(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionService) ListSessions(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionService) RegisterMethods(r *handler.Registry)
- func (s *SessionService) RegisterProvider(provider SessionProvider)
- func (s *SessionService) RegisterStreamer(agentType string, streamer SessionStreamer)
- func (s *SessionService) SetWorkspaceResolver(resolver WorkspacePathResolver)
- func (s *SessionService) UnwatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SessionService) WatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type SessionStreamer
- type SessionViewerProvider
- type ShutdownResult
- type StageResult
- type StatusProvider
- type StatusService
- type SubscriptionService
- func (s *SubscriptionService) RegisterMethods(registry *handler.Registry)
- func (s *SubscriptionService) SetGitWatcherManager(manager GitWatcherManager)
- func (s *SubscriptionService) SetProvider(provider FilteredSubscriberProvider)
- func (s *SubscriptionService) Subscribe(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SubscriptionService) SubscribeAll(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SubscriptionService) Subscriptions(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *SubscriptionService) Unsubscribe(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type TokenUsage
- type ToolCall
- type UnstageResult
- type UnwatchSessionResult
- type WatchSessionParams
- type WatchSessionResult
- type WorkspaceConfigService
- func (s *WorkspaceConfigService) Add(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) Discover(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) Get(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) InvalidateCache(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) List(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) RegisterMethods(registry *handler.Registry)
- func (s *WorkspaceConfigService) Remove(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) SetViewerProvider(provider SessionViewerProvider)
- func (s *WorkspaceConfigService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- func (s *WorkspaceConfigService) Update(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
- type WorkspaceIDResolver
- type WorkspaceInfo
- type WorkspacePathResolver
- type WorkspaceResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentCapabilities ¶
type AgentCapabilities struct {
Run bool `json:"run"`
Stop bool `json:"stop"`
Respond bool `json:"respond"`
Sessions bool `json:"sessions"`
SessionWatch bool `json:"sessionWatch"`
}
AgentCapabilities describes AI agent-related capabilities. This is CLI-agnostic and applies to Claude, Gemini, Codex, etc.
type AgentInputParams ¶
type AgentInputParams struct {
// Input is the keyboard input to send.
Input string `json:"input"`
}
AgentInputParams for agent/input method.
type AgentInputResult ¶
type AgentInputResult struct {
Status string `json:"status"`
}
AgentInputResult for agent/input method.
type AgentManager ¶
type AgentManager interface {
// StartWithSession starts the agent with a prompt and session configuration.
StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, permissionMode string) error
// Stop stops the running agent process.
Stop(ctx context.Context) error
// SendResponse sends a response to an interactive prompt.
SendResponse(toolUseID, response string, isError bool) error
// SendPTYInput sends input to the PTY (for interactive responses).
SendPTYInput(input string) error
// IsPTYMode returns true if running in PTY mode.
IsPTYMode() bool
// State returns the current agent state.
State() AgentState
// PID returns the process ID of the running agent (0 if not running).
PID() int
// SessionID returns the current session ID.
SessionID() string
// AgentType returns the type of agent (e.g., "claude", "gemini", "codex").
AgentType() string
}
AgentManager defines the interface for managing AI CLI agents. This interface is CLI-agnostic and can be implemented by: - Claude Code adapter - Gemini CLI adapter - Codex CLI adapter - Any other AI coding assistant CLI
type AgentRespondParams ¶
type AgentRespondParams struct {
// ToolUseID is the ID of the tool use to respond to.
ToolUseID string `json:"tool_use_id"`
// Response is the response content.
Response string `json:"response"`
// IsError indicates if the response is an error.
IsError bool `json:"is_error,omitempty"`
}
AgentRespondParams for agent/respond method.
type AgentRespondResult ¶
type AgentRespondResult struct {
Status string `json:"status"`
ToolUseID string `json:"tool_use_id"`
}
AgentRespondResult for agent/respond method.
type AgentRunParams ¶
type AgentRunParams struct {
// Prompt is the prompt to send to the agent.
Prompt string `json:"prompt"`
// Mode is the session mode: "new" or "continue".
// Default is "new".
Mode string `json:"mode,omitempty"`
// SessionID is required when mode is "continue".
SessionID string `json:"session_id,omitempty"`
// PermissionMode controls how permissions are handled.
// "default" - standard permission prompts
// "acceptEdits" - auto-accept file edits
// "bypassPermissions" - skip all permission checks
// "plan" - plan mode
// "interactive" - PTY mode with terminal-like permission prompts
PermissionMode string `json:"permission_mode,omitempty"`
}
AgentRunParams for agent/run method.
type AgentRunResult ¶
type AgentRunResult struct {
// Status is "started" on success.
Status string `json:"status"`
// PID is the process ID of the agent CLI.
PID int `json:"pid"`
// SessionID is the agent session ID.
SessionID string `json:"session_id,omitempty"`
// Mode is the session mode used.
Mode string `json:"mode"`
// AgentType is the type of agent (e.g., "claude", "gemini", "codex").
AgentType string `json:"agent_type"`
}
AgentRunResult for agent/run method.
type AgentService ¶
type AgentService struct {
// contains filtered or unexported fields
}
AgentService provides agent-related RPC methods. This is CLI-agnostic and works with any AI agent that implements AgentManager.
DEPRECATED: This service operates on a single repository path from config.yaml. For multi-workspace support, use SessionManagerService instead:
- agent/run → session/start + session/send
- agent/stop → session/stop
- agent/respond → session/respond
- agent/status → session/state
func NewAgentService ¶
func NewAgentService(manager AgentManager) *AgentService
NewAgentService creates a new agent service.
func (*AgentService) Input ¶
func (s *AgentService) Input(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Input sends keyboard input to the agent's PTY (for interactive mode).
func (*AgentService) RegisterMethods ¶
func (s *AgentService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all agent methods with the registry.
func (*AgentService) Respond ¶
func (s *AgentService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Respond sends a response to the agent's interactive prompt.
func (*AgentService) Run ¶
func (s *AgentService) Run(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Run starts the agent with the given prompt.
func (*AgentService) Status ¶
func (s *AgentService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Status returns the current agent status.
func (*AgentService) Stop ¶
func (s *AgentService) Stop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Stop stops the running agent process.
type AgentState ¶
type AgentState string
AgentState represents the current state of an AI agent.
const ( AgentStateIdle AgentState = "idle" AgentStateRunning AgentState = "running" AgentStateWaiting AgentState = "waiting" AgentStateStopping AgentState = "stopping" )
type AgentStatusResult ¶
type AgentStatusResult struct {
// State is the current agent state.
State string `json:"state"`
// PID is the process ID if running.
PID int `json:"pid,omitempty"`
// SessionID is the current session ID.
SessionID string `json:"session_id,omitempty"`
// AgentType is the type of agent (e.g., "claude", "gemini", "codex").
AgentType string `json:"agent_type"`
// WaitingFor describes what the agent is waiting for (if any).
WaitingFor string `json:"waiting_for,omitempty"`
}
AgentStatusResult for agent/status method.
type AgentStopResult ¶
type AgentStopResult struct {
Status string `json:"status"`
}
AgentStopResult for agent/stop method.
type BranchInfo ¶
BranchInfo represents information about a git branch.
type BranchesResult ¶
type BranchesResult struct {
Current string `json:"current"`
Upstream string `json:"upstream,omitempty"`
Ahead int `json:"ahead"`
Behind int `json:"behind"`
Branches []BranchInfo `json:"branches"`
}
BranchesResult for git/branches method - matches HTTP API format.
type CheckoutParams ¶
CheckoutParams for git/checkout method.
type CheckoutResult ¶
type CheckoutResult struct {
Success bool `json:"success"`
Branch string `json:"branch,omitempty"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
}
CheckoutResult for git/checkout method - matches HTTP API format.
type ClaudeAdapter ¶
type ClaudeAdapter struct {
// contains filtered or unexported fields
}
ClaudeAdapter wraps the Claude CLI manager to implement AgentManager.
func NewClaudeAdapter ¶
func NewClaudeAdapter(manager *claude.Manager) *ClaudeAdapter
NewClaudeAdapter creates a new Claude adapter.
func (*ClaudeAdapter) AgentType ¶
func (a *ClaudeAdapter) AgentType() string
AgentType implements AgentManager.
func (*ClaudeAdapter) IsPTYMode ¶
func (a *ClaudeAdapter) IsPTYMode() bool
IsPTYMode implements AgentManager.
func (*ClaudeAdapter) SendPTYInput ¶
func (a *ClaudeAdapter) SendPTYInput(input string) error
SendPTYInput implements AgentManager.
func (*ClaudeAdapter) SendResponse ¶
func (a *ClaudeAdapter) SendResponse(toolUseID, response string, isError bool) error
SendResponse implements AgentManager.
func (*ClaudeAdapter) SessionID ¶
func (a *ClaudeAdapter) SessionID() string
SessionID implements AgentManager.
func (*ClaudeAdapter) StartWithSession ¶
func (a *ClaudeAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, permissionMode string) error
StartWithSession implements AgentManager.
func (*ClaudeAdapter) State ¶
func (a *ClaudeAdapter) State() AgentState
State implements AgentManager.
type ClaudeCapabilities ¶
type ClaudeCapabilities = AgentCapabilities
ClaudeCapabilities is an alias for backward compatibility. Deprecated: Use AgentCapabilities instead.
type ClientCapabilities ¶
type ClientCapabilities struct {
// Notifications the client can handle.
Notifications []string `json:"notifications,omitempty"`
}
ClientCapabilities describes what the client can handle.
type ClientFocusProvider ¶
type ClientFocusProvider interface {
// SetSessionFocus updates the session focus for a client.
// Returns focus change result with other viewers info and error.
SetSessionFocus(clientID, workspaceID, sessionID string) (interface{}, error)
}
ClientFocusProvider provides client focus management operations.
type ClientInfo ¶
ClientInfo describes the client.
type ClientService ¶
type ClientService struct {
// contains filtered or unexported fields
}
ClientService provides client-related RPC methods.
func NewClientService ¶
func NewClientService(provider ClientFocusProvider) *ClientService
NewClientService creates a new client service.
func (*ClientService) RegisterMethods ¶
func (s *ClientService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all client methods with the registry.
func (*ClientService) SessionFocus ¶
func (s *ClientService) SessionFocus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
SessionFocus updates the session focus for the current client. This notifies the server which session the client is currently viewing, enabling multi-device awareness and notifications when other devices join the same session.
func (*ClientService) SetProvider ¶
func (s *ClientService) SetProvider(provider ClientFocusProvider)
SetProvider sets the focus provider for the service. This allows the provider to be set after service initialization.
type CodexAdapter ¶
type CodexAdapter struct {
// contains filtered or unexported fields
}
CodexAdapter wraps a Codex CLI manager to implement AgentManager.
func NewCodexAdapter ¶
func NewCodexAdapter(manager CodexManager) *CodexAdapter
NewCodexAdapter creates a new Codex adapter.
func (*CodexAdapter) AgentType ¶
func (a *CodexAdapter) AgentType() string
AgentType implements AgentManager.
func (*CodexAdapter) IsPTYMode ¶
func (a *CodexAdapter) IsPTYMode() bool
IsPTYMode implements AgentManager. Codex doesn't support PTY mode, so this always returns false.
func (*CodexAdapter) SendPTYInput ¶
func (a *CodexAdapter) SendPTYInput(input string) error
SendPTYInput implements AgentManager. Codex doesn't support PTY mode, so this always returns an error.
func (*CodexAdapter) SendResponse ¶
func (a *CodexAdapter) SendResponse(toolUseID, response string, isError bool) error
SendResponse implements AgentManager. Codex has approval/denial semantics similar to Claude.
func (*CodexAdapter) SessionID ¶
func (a *CodexAdapter) SessionID() string
SessionID implements AgentManager.
func (*CodexAdapter) StartWithSession ¶
func (a *CodexAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, permissionMode string) error
StartWithSession implements AgentManager.
func (*CodexAdapter) State ¶
func (a *CodexAdapter) State() AgentState
State implements AgentManager.
type CodexManager ¶
type CodexManager interface {
// Start starts Codex with the given prompt.
Start(ctx context.Context, prompt string) error
// Stop stops the running Codex process.
Stop(ctx context.Context) error
// SendInput sends input to the Codex process.
SendInput(input string) error
// Approve approves a pending action.
Approve() error
// Deny denies a pending action.
Deny() error
// IsRunning returns true if Codex is running.
IsRunning() bool
// IsWaiting returns true if waiting for user input.
IsWaiting() bool
// PID returns the process ID.
PID() int
// SessionID returns the current session ID.
SessionID() string
}
CodexManager interface for OpenAI Codex CLI operations. This interface is designed to wrap a future Codex CLI adapter.
Codex CLI supports: - Code completion - Interactive coding sessions - Multi-file operations - OpenAI API integration
type CommitParams ¶
CommitParams for git/commit method.
type CommitResult ¶
type CommitResult struct {
Success bool `json:"success"`
SHA string `json:"sha,omitempty"`
Message string `json:"message,omitempty"`
FilesCommitted int `json:"files_committed,omitempty"`
Pushed bool `json:"pushed,omitempty"`
Error string `json:"error,omitempty"`
}
CommitResult for git/commit method - matches HTTP API format.
type DiffParams ¶
type DiffParams struct {
// Path is the file path. If empty, returns diff for all files.
Path string `json:"path,omitempty"`
}
DiffParams for git/diff method.
type DiffResult ¶
type DiffResult struct {
Path string `json:"path,omitempty"`
Diff string `json:"diff"`
IsStaged bool `json:"is_staged"`
IsNew bool `json:"is_new"`
IsTruncated bool `json:"is_truncated"`
}
DiffResult for git/diff method.
type DirStats ¶
type DirStats struct {
FolderCount int // Direct subdirectories
FileCount int // Recursive file count
TotalSize int64 // Total size in bytes
}
DirStats holds directory statistics.
type DirectoryInfo ¶
type DirectoryInfo struct {
Path string `json:"path"`
Name string `json:"name"`
FolderCount int `json:"folder_count"` // Direct subdirectories count
FileCount int `json:"file_count"` // Recursive file count
TotalSizeBytes int64 `json:"total_size_bytes"`
TotalSizeDisplay string `json:"total_size_display"` // Human readable: "35 KB"
LastModified time.Time `json:"last_modified,omitempty"`
ModifiedDisplay string `json:"modified_display,omitempty"` // Relative: "2 hours ago"
}
DirectoryInfo represents a directory in the listing (matches HTTP API format).
type DiscardResult ¶
DiscardResult for git/discard method - matches HTTP API format.
type EventPublisher ¶
type EventPublisher interface {
Publish(event events.Event)
// SubscriberCount returns the number of active subscribers.
SubscriberCount() int
}
EventPublisher defines the interface for publishing events.
type FileCapabilities ¶
type FileCapabilities struct {
Get bool `json:"get"`
List bool `json:"list"`
MaxFileSize int64 `json:"maxFileSize,omitempty"`
}
FileCapabilities describes file-related capabilities.
type FileContentProvider ¶
type FileContentProvider interface {
// GetFileContent returns the content of a file.
// Returns content, truncated flag, and error.
GetFileContent(ctx context.Context, path string, maxSizeKB int) (string, bool, error)
// ListDirectory returns entries in a directory.
// Returns entries, error.
ListDirectory(ctx context.Context, path string) ([]FileEntry, error)
}
FileContentProvider provides file content retrieval.
type FileEntry ¶
type FileEntry struct {
// Name is the file/directory name.
Name string `json:"name"`
// Type is either "file" or "directory".
Type string `json:"type"`
// Size is the file size in bytes (only for files).
Size *int64 `json:"size,omitempty"`
// Modified is the last modification time (only for files).
Modified *string `json:"modified,omitempty"`
// ChildrenCount is the number of children (only for directories).
ChildrenCount *int `json:"children_count,omitempty"`
}
FileEntry represents a file or directory entry.
type FileInfo ¶
type FileInfo struct {
Path string `json:"path"`
Name string `json:"name"`
Directory string `json:"directory"`
Extension string `json:"extension,omitempty"`
SizeBytes int64 `json:"size_bytes"`
ModifiedAt time.Time `json:"modified_at"`
IndexedAt time.Time `json:"indexed_at,omitempty"`
IsBinary bool `json:"is_binary"`
IsSymlink bool `json:"is_symlink"`
IsSensitive bool `json:"is_sensitive"`
GitTracked bool `json:"git_tracked"`
GitIgnored bool `json:"git_ignored"`
}
FileInfo represents a file in the listing (matches HTTP API format).
type FileListResult ¶
type FileListResult struct {
Directory string `json:"directory"`
Files []FileInfo `json:"files"`
Directories []DirectoryInfo `json:"directories"`
TotalFiles int `json:"total_files"`
TotalDirectories int `json:"total_directories"`
Pagination PaginationInfo `json:"pagination"`
}
FileListResult matches the HTTP API /api/repository/files/list response format.
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
FileService provides file-related RPC methods.
func NewFileService ¶
func NewFileService(provider FileContentProvider, maxSizeKB int) *FileService
NewFileService creates a new file service.
func (*FileService) GetFile ¶
func (s *FileService) GetFile(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetFile returns the content of a file. This consolidates logic from: - app.go:435-447 (WebSocket handler) - http/server.go:838-875 (HTTP handler)
func (*FileService) ListDirectory ¶
func (s *FileService) ListDirectory(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
ListDirectory returns the contents of a directory.
func (*FileService) RegisterMethods ¶
func (s *FileService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all file methods with the registry.
type FilteredSubscriberProvider ¶
type FilteredSubscriberProvider interface {
GetFilteredSubscriber(clientID string) *hub.FilteredSubscriber
}
FilteredSubscriberProvider provides access to filtered subscribers by client ID.
type GeminiAdapter ¶
type GeminiAdapter struct {
// contains filtered or unexported fields
}
GeminiAdapter wraps a Gemini CLI manager to implement AgentManager.
func NewGeminiAdapter ¶
func NewGeminiAdapter(manager GeminiManager) *GeminiAdapter
NewGeminiAdapter creates a new Gemini adapter.
func (*GeminiAdapter) AgentType ¶
func (a *GeminiAdapter) AgentType() string
AgentType implements AgentManager.
func (*GeminiAdapter) IsPTYMode ¶
func (a *GeminiAdapter) IsPTYMode() bool
IsPTYMode implements AgentManager. Gemini doesn't support PTY mode, so this always returns false.
func (*GeminiAdapter) SendPTYInput ¶
func (a *GeminiAdapter) SendPTYInput(input string) error
SendPTYInput implements AgentManager. Gemini doesn't support PTY mode, so this always returns an error.
func (*GeminiAdapter) SendResponse ¶
func (a *GeminiAdapter) SendResponse(toolUseID, response string, isError bool) error
SendResponse implements AgentManager. Gemini uses a simpler input model without tool IDs.
func (*GeminiAdapter) SessionID ¶
func (a *GeminiAdapter) SessionID() string
SessionID implements AgentManager.
func (*GeminiAdapter) StartWithSession ¶
func (a *GeminiAdapter) StartWithSession(ctx context.Context, prompt string, mode SessionMode, sessionID string, permissionMode string) error
StartWithSession implements AgentManager.
func (*GeminiAdapter) State ¶
func (a *GeminiAdapter) State() AgentState
State implements AgentManager.
type GeminiManager ¶
type GeminiManager interface {
// Start starts Gemini with the given prompt.
Start(ctx context.Context, prompt string) error
// Stop stops the running Gemini process.
Stop(ctx context.Context) error
// SendInput sends input to the Gemini process.
SendInput(input string) error
// IsRunning returns true if Gemini is running.
IsRunning() bool
// PID returns the process ID.
PID() int
// ConversationID returns the current conversation ID.
ConversationID() string
}
GeminiManager interface for Gemini CLI operations. This interface is designed to wrap a future Gemini CLI adapter.
Gemini CLI (https://github.com/google/gemini-cli) supports: - Interactive prompts - Code generation and editing - Multi-turn conversations - Various Gemini models
type GetFileParams ¶
type GetFileParams struct {
// Path is the file path relative to the repository root.
Path string `json:"path"`
}
GetFileParams for file/get method.
type GetFileResult ¶
type GetFileResult struct {
// Path is the file path.
Path string `json:"path"`
// Content is the file content.
Content string `json:"content"`
// Encoding is the content encoding (always "utf-8").
Encoding string `json:"encoding"`
// Truncated indicates if the content was truncated due to size limits.
Truncated bool `json:"truncated"`
// Size is the content size in bytes.
Size int `json:"size"`
}
GetFileResult for file/get method.
type GetSessionElementsParams ¶
type GetSessionElementsParams struct {
SessionID string `json:"session_id"`
AgentType string `json:"agent_type,omitempty"`
Limit int `json:"limit,omitempty"`
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
}
GetSessionElementsParams for session/elements method.
type GetSessionElementsResult ¶
type GetSessionElementsResult struct {
SessionID string `json:"session_id"`
Elements []SessionElement `json:"elements"`
Pagination SessionElementsPagination `json:"pagination"`
}
GetSessionElementsResult for session/elements method.
type GetSessionMessagesParams ¶
type GetSessionMessagesParams struct {
SessionID string `json:"session_id"`
AgentType string `json:"agent_type,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Order string `json:"order,omitempty"` // "asc" or "desc" (default: "asc")
}
GetSessionMessagesParams for session/messages method.
type GetSessionMessagesResult ¶
type GetSessionMessagesResult struct {
SessionID string `json:"session_id"`
Messages []SessionMessage `json:"messages"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
HasMore bool `json:"has_more"`
QueryTimeMs float64 `json:"query_time_ms"`
}
GetSessionMessagesResult for session/messages method.
type GetSessionParams ¶
type GetSessionParams struct {
SessionID string `json:"session_id"`
AgentType string `json:"agent_type,omitempty"`
}
GetSessionParams for session/get method.
type GetStatusResult ¶
type GetStatusResult struct {
// ClaudeState is the current Claude state.
ClaudeState string `json:"claude_state"`
// ConnectedClients is the number of connected clients.
ConnectedClients int `json:"connected_clients"`
// RepoPath is the repository path.
RepoPath string `json:"repo_path"`
// RepoName is the repository name (basename of path).
RepoName string `json:"repo_name"`
// UptimeSeconds is the server uptime in seconds.
UptimeSeconds int64 `json:"uptime_seconds"`
// AgentVersion is the server version.
AgentVersion string `json:"agent_version"`
// WatcherEnabled indicates if the file watcher is enabled.
WatcherEnabled bool `json:"watcher_enabled"`
// GitEnabled indicates if git integration is enabled.
GitEnabled bool `json:"git_enabled"`
}
GetStatusResult for status/get method.
type GitCapabilities ¶
type GitCapabilities struct {
Status bool `json:"status"`
Diff bool `json:"diff"`
Stage bool `json:"stage"`
Unstage bool `json:"unstage"`
Discard bool `json:"discard"`
Commit bool `json:"commit"`
Push bool `json:"push"`
Pull bool `json:"pull"`
Branches bool `json:"branches"`
Checkout bool `json:"checkout"`
}
GitCapabilities describes Git-related capabilities.
type GitFileStatus ¶
GitFileStatus represents a file in git status.
type GitProvider ¶
type GitProvider interface {
// Status returns the git status.
Status(ctx context.Context) (GitStatusInfo, error)
// Diff returns the diff for a file or all files.
Diff(ctx context.Context, path string) (string, bool, bool, error)
// Stage stages files.
Stage(ctx context.Context, paths []string) error
// Unstage unstages files.
Unstage(ctx context.Context, paths []string) error
// Discard discards changes to files.
Discard(ctx context.Context, paths []string) error
// Commit creates a commit and optionally pushes. Returns commit result.
Commit(ctx context.Context, message string, push bool) (*CommitResult, error)
// Push pushes to remote. Returns push result.
Push(ctx context.Context) (*PushResult, error)
// Pull pulls from remote. Returns pull result.
Pull(ctx context.Context) (*PullResult, error)
// Branches returns the list of branches with full info.
Branches(ctx context.Context) (*BranchesResult, error)
// Checkout checks out a branch. Returns checkout result.
Checkout(ctx context.Context, branch string) (*CheckoutResult, error)
}
GitProvider provides git operations.
type GitService ¶
type GitService struct {
// contains filtered or unexported fields
}
GitService provides git-related RPC methods.
func NewGitService ¶
func NewGitService(provider GitProvider, maxDiffSizeKB int) *GitService
NewGitService creates a new git service.
func (*GitService) Branches ¶
func (s *GitService) Branches(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Branches returns the list of branches.
func (*GitService) Checkout ¶
func (s *GitService) Checkout(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Checkout checks out a branch.
func (*GitService) Commit ¶
func (s *GitService) Commit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Commit creates a commit.
func (*GitService) Diff ¶
func (s *GitService) Diff(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Diff returns the diff for a file or all files.
func (*GitService) Discard ¶
func (s *GitService) Discard(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Discard discards changes to files.
func (*GitService) Pull ¶
func (s *GitService) Pull(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Pull pulls from remote.
func (*GitService) Push ¶
func (s *GitService) Push(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Push pushes to remote.
func (*GitService) RegisterMethods ¶
func (s *GitService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all git methods with the registry.
func (*GitService) Stage ¶
func (s *GitService) Stage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Stage stages files.
func (*GitService) Status ¶
func (s *GitService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Status returns the git status.
func (*GitService) Unstage ¶
func (s *GitService) Unstage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Unstage unstages files.
type GitStatusInfo ¶
type GitStatusInfo struct {
Branch string `json:"branch"`
Upstream string `json:"upstream,omitempty"`
Ahead int `json:"ahead"`
Behind int `json:"behind"`
Staged []GitFileStatus `json:"staged"`
Unstaged []GitFileStatus `json:"unstaged"`
Untracked []GitFileStatus `json:"untracked"`
Conflicted []GitFileStatus `json:"conflicted"`
RepoName string `json:"repo_name"`
RepoRoot string `json:"repo_root"`
}
GitStatusInfo represents git status information matching HTTP API format.
type GitWatcherManager ¶
type GitWatcherManager interface {
StartGitWatcher(workspaceID string) error
StopGitWatcher(workspaceID string)
}
GitWatcherManager provides the ability to start/stop git watchers for workspaces.
type HealthResult ¶
type HealthResult struct {
Status string `json:"status"`
UptimeSeconds int64 `json:"uptime_seconds"`
}
HealthResult for status/health method.
type InitializeParams ¶
type InitializeParams struct {
// ProtocolVersion is the protocol version the client supports.
ProtocolVersion string `json:"protocolVersion"`
// ClientInfo describes the client.
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
// Capabilities describes what the client can handle.
Capabilities *ClientCapabilities `json:"capabilities,omitempty"`
// RootPath is the root path of the workspace.
RootPath string `json:"rootPath,omitempty"`
}
InitializeParams from the client.
type InitializeResult ¶
type InitializeResult struct {
// ProtocolVersion is the protocol version the server uses.
ProtocolVersion string `json:"protocolVersion"`
// ServerInfo describes the server.
ServerInfo ServerInfo `json:"serverInfo"`
// Capabilities describes what the server can do.
Capabilities ServerCapabilities `json:"capabilities"`
// ClientID is the unique identifier assigned to this client connection.
// Use this to identify yourself in session events (e.g., session_joined, session_left).
ClientID string `json:"clientId"`
}
InitializeResult is returned to the client.
type LifecycleService ¶
type LifecycleService struct {
// contains filtered or unexported fields
}
LifecycleService handles initialization and shutdown.
func NewLifecycleService ¶
func NewLifecycleService(version string, caps ServerCapabilities) *LifecycleService
NewLifecycleService creates a new lifecycle service.
func (*LifecycleService) Initialize ¶
func (s *LifecycleService) Initialize(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Initialize handles the initialize request. This must be the first request sent by the client.
func (*LifecycleService) Initialized ¶
func (s *LifecycleService) Initialized(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Initialized is a notification from the client that initialization is complete. After this, the client can start sending other requests.
func (*LifecycleService) IsInitialized ¶
func (s *LifecycleService) IsInitialized() bool
IsInitialized returns true if the initialize handshake is complete.
func (*LifecycleService) RegisterMethods ¶
func (s *LifecycleService) RegisterMethods(r *handler.Registry)
RegisterMethods registers lifecycle methods with the registry.
func (*LifecycleService) Shutdown ¶
func (s *LifecycleService) Shutdown(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Shutdown handles the shutdown request. After this, the client should send an 'exit' notification.
func (*LifecycleService) ShutdownChannel ¶
func (s *LifecycleService) ShutdownChannel() <-chan struct{}
ShutdownChannel returns a channel that's closed when shutdown is requested.
type ListDirectoryParams ¶
type ListDirectoryParams struct {
// Path is the directory path relative to the repository root.
// If empty, lists the root directory.
Path string `json:"path,omitempty"`
}
ListDirectoryParams for file/list method.
type ListDirectoryResult ¶
type ListDirectoryResult struct {
// Path is the directory path.
Path string `json:"path"`
// Entries is the list of files and directories.
Entries []FileEntry `json:"entries"`
// TotalCount is the number of entries.
TotalCount int `json:"total_count"`
}
ListDirectoryResult for file/list method.
type ListSessionsParams ¶
type ListSessionsParams struct {
// AgentType filters by agent type (optional, empty = all).
AgentType string `json:"agent_type,omitempty"`
// WorkspaceID filters by workspace (server resolves path automatically).
WorkspaceID string `json:"workspace_id,omitempty"`
// Limit is the max number of sessions to return.
Limit int `json:"limit,omitempty"`
}
ListSessionsParams for session/list method.
type ListSessionsResult ¶
type ListSessionsResult struct {
Sessions []SessionInfo `json:"sessions"`
Total int `json:"total"`
}
ListSessionsResult for session/list method.
type PaginationInfo ¶
type PaginationInfo struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
HasMore bool `json:"has_more"`
}
PaginationInfo contains pagination metadata.
type PathsParams ¶
type PathsParams struct {
Paths []string `json:"paths"`
}
PathsParams for git operations that take paths.
type PendingParams ¶
type PendingParams struct {
SessionID string `json:"session_id,omitempty"`
}
PendingParams for permission/pending method.
type PendingRequestInfo ¶
type PendingRequestInfo struct {
ToolUseID string `json:"tool_use_id"`
SessionID string `json:"session_id"`
WorkspaceID string `json:"workspace_id"`
ToolName string `json:"tool_name"`
ToolInput map[string]interface{} `json:"tool_input"`
CreatedAt string `json:"created_at"`
}
PendingRequestInfo is the response format for pending permission requests.
type PermissionManager ¶
type PermissionManager interface {
// CheckMemory checks session memory for a matching pattern.
CheckMemory(sessionID, toolName string, toolInput map[string]interface{}) *permission.StoredDecision
// StoreDecision stores a permission decision in session memory.
StoreDecision(sessionID, workspaceID, pattern string, decision permission.Decision)
// AddPendingRequest adds a request waiting for mobile response.
AddPendingRequest(req *permission.Request)
// GetPendingRequest retrieves a pending request.
GetPendingRequest(toolUseID string) *permission.Request
// RemovePendingRequest removes a pending request.
RemovePendingRequest(toolUseID string)
// RespondToRequest sends a response to a pending request.
RespondToRequest(toolUseID string, response *permission.Response) bool
// GetAndRemovePendingRequest atomically gets and removes a pending request.
GetAndRemovePendingRequest(toolUseID string) *permission.Request
// ListPendingRequests returns all pending permission requests.
ListPendingRequests() []*permission.Request
// GetSessionStats returns statistics about session memory.
GetSessionStats() map[string]interface{}
}
PermissionManager defines the interface for managing permission requests.
type PermissionService ¶
type PermissionService struct {
// contains filtered or unexported fields
}
PermissionService provides permission-related RPC methods.
func NewPermissionService ¶
func NewPermissionService(manager PermissionManager, publisher EventPublisher, resolver WorkspaceResolver) *PermissionService
NewPermissionService creates a new permission service.
func (*PermissionService) Pending ¶
func (s *PermissionService) Pending(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Pending returns all pending permission requests. Call this on reconnect to catch any missed permissions.
func (*PermissionService) RegisterMethods ¶
func (s *PermissionService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all permission methods with the registry.
func (*PermissionService) Request ¶
func (s *PermissionService) Request(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Request handles a permission request from the hook CLI. This method blocks until a response is received from the mobile app or timeout.
func (*PermissionService) Respond ¶
func (s *PermissionService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Respond handles a response from the mobile app.
func (*PermissionService) SetTimeout ¶
func (s *PermissionService) SetTimeout(timeout time.Duration)
SetTimeout sets the timeout for waiting for mobile responses.
func (*PermissionService) Stats ¶
func (s *PermissionService) Stats(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Stats returns permission system statistics.
type PullResult ¶
type PullResult struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
CommitsPulled int `json:"commits_pulled,omitempty"`
FilesChanged int `json:"files_changed,omitempty"`
ConflictedFiles []string `json:"conflicted_files,omitempty"`
Error string `json:"error,omitempty"`
}
PullResult for git/pull method - matches HTTP API format.
type PushResult ¶
type PushResult struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
CommitsPushed int `json:"commits_pushed,omitempty"`
Error string `json:"error,omitempty"`
}
PushResult for git/push method - matches HTTP API format.
type RepositoryCapabilities ¶
type RepositoryCapabilities struct {
Index bool `json:"index"` // repository/index/status, repository/index/rebuild
Search bool `json:"search"` // repository/search
List bool `json:"list"` // repository/files/list
Tree bool `json:"tree"` // repository/files/tree
Stats bool `json:"stats"` // repository/stats
Rebuild bool `json:"rebuild"` // repository/index/rebuild
}
RepositoryCapabilities describes repository indexer capabilities.
type RepositoryIndexer ¶
type RepositoryIndexer interface {
GetStatus() repository.IndexStatus
Search(ctx context.Context, query repository.SearchQuery) (*repository.SearchResult, error)
ListFiles(ctx context.Context, opts repository.ListOptions) (*repository.FileList, error)
GetTree(ctx context.Context, rootPath string, depth int) (*repository.DirectoryTree, error)
GetStats(ctx context.Context) (*repository.RepositoryStats, error)
FullScan(ctx context.Context) error
}
RepositoryIndexer defines the interface for repository indexing operations.
type RepositoryService ¶
type RepositoryService struct {
// contains filtered or unexported fields
}
RepositoryService handles repository indexing and search operations via JSON-RPC.
func NewRepositoryService ¶
func NewRepositoryService(indexer RepositoryIndexer) *RepositoryService
NewRepositoryService creates a new repository service.
func (*RepositoryService) GetStats ¶
func (s *RepositoryService) GetStats(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetStats returns aggregate statistics about the repository.
func (*RepositoryService) GetTree ¶
func (s *RepositoryService) GetTree(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetTree returns a hierarchical directory tree.
func (*RepositoryService) IndexStatus ¶
func (s *RepositoryService) IndexStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
IndexStatus returns the current status of the repository index.
func (*RepositoryService) ListFiles ¶
func (s *RepositoryService) ListFiles(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
ListFiles returns a paginated list of files in a directory.
func (*RepositoryService) Rebuild ¶
func (s *RepositoryService) Rebuild(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Rebuild triggers a full re-index of the repository.
func (*RepositoryService) RegisterMethods ¶
func (s *RepositoryService) RegisterMethods(registry *handler.Registry)
RegisterMethods registers all repository methods with the handler.
func (*RepositoryService) Search ¶
func (s *RepositoryService) Search(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Search searches for files in the repository.
type RequestParams ¶
type RequestParams struct {
SessionID string `json:"session_id"`
ToolName string `json:"tool_name"`
ToolInput map[string]interface{} `json:"tool_input"`
ToolUseID string `json:"tool_use_id"`
Cwd string `json:"cwd"`
}
RequestParams for permission/request method.
type RespondParams ¶
type RespondParams struct {
ToolUseID string `json:"tool_use_id"`
Decision string `json:"decision"` // "allow" or "deny"
Scope string `json:"scope"` // "once" or "session"
}
RespondParams for permission/respond method.
type RuntimeCapabilityRegistry ¶
type RuntimeCapabilityRegistry struct {
SchemaVersion string `json:"schemaVersion"`
GeneratedAt string `json:"generatedAt,omitempty"`
DefaultRuntime string `json:"defaultRuntime"`
Routing RuntimeRouting `json:"routing"`
Runtimes []RuntimeDescriptor `json:"runtimes"`
}
RuntimeCapabilityRegistry describes server-driven runtime behavior.
func DefaultRuntimeRegistryWithAgents ¶
func DefaultRuntimeRegistryWithAgents(agents []string) *RuntimeCapabilityRegistry
DefaultRuntimeRegistryWithAgents builds the runtime capability registry for initialize.
type RuntimeDescriptor ¶
type RuntimeDescriptor struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Status string `json:"status"`
SessionListSource string `json:"sessionListSource"`
SessionMessagesSource string `json:"sessionMessagesSource"`
SessionWatchSource string `json:"sessionWatchSource"`
RequiresWorkspaceActivationOnResume bool `json:"requiresWorkspaceActivationOnResume"`
RequiresSessionResolutionOnNewSession bool `json:"requiresSessionResolutionOnNewSession"`
SupportsResume bool `json:"supportsResume"`
SupportsInteractiveQuestions bool `json:"supportsInteractiveQuestions"`
SupportsPermissions bool `json:"supportsPermissions"`
Methods RuntimeMethods `json:"methods"`
}
RuntimeDescriptor defines behavior for a specific runtime.
type RuntimeMethods ¶
type RuntimeMethods struct {
History string `json:"history"`
Messages string `json:"messages"`
Watch string `json:"watch"`
Unwatch string `json:"unwatch"`
Start string `json:"start"`
Send string `json:"send"`
Stop string `json:"stop"`
Input string `json:"input"`
Respond string `json:"respond"`
State string `json:"state,omitempty"`
}
RuntimeMethods maps runtime operations to RPC methods.
type RuntimeRouting ¶
type RuntimeRouting struct {
AgentTypeField string `json:"agentTypeField"`
DefaultAgentType string `json:"defaultAgentType"`
RequiredOnMethods []string `json:"requiredOnMethods,omitempty"`
}
RuntimeRouting defines global runtime-routing rules.
type ServerCapabilities ¶
type ServerCapabilities struct {
// Agent operations (generic for any AI CLI)
Agent *AgentCapabilities `json:"agent,omitempty"`
// Git operations
Git *GitCapabilities `json:"git,omitempty"`
// File operations
File *FileCapabilities `json:"file,omitempty"`
// Repository indexing
Repository *RepositoryCapabilities `json:"repository,omitempty"`
// Notifications the server can send
Notifications []string `json:"notifications,omitempty"`
// SupportedAgents lists the configured agent types (e.g., "claude", "gemini", "codex")
SupportedAgents []string `json:"supportedAgents,omitempty"`
// RuntimeRegistry describes per-runtime behavior so clients can route without hardcoded branches.
RuntimeRegistry *RuntimeCapabilityRegistry `json:"runtimeRegistry,omitempty"`
}
ServerCapabilities describes what the server can do.
func DefaultCapabilities ¶
func DefaultCapabilities() ServerCapabilities
DefaultCapabilities returns default server capabilities.
func DefaultCapabilitiesWithAgents ¶
func DefaultCapabilitiesWithAgents(agents []string) ServerCapabilities
DefaultCapabilitiesWithAgents returns capabilities with specific agents.
type ServerInfo ¶
ServerInfo describes the server.
type SessionElement ¶
type SessionElement struct {
// ID is the element identifier.
ID string `json:"id"`
// Type is the element type (user_input, assistant_text, tool_call, tool_result, diff, thinking, context_compaction, interrupted).
Type string `json:"type"`
// Timestamp is when the element was created.
Timestamp string `json:"timestamp"`
// Content is the type-specific content.
Content interface{} `json:"content"`
}
SessionElement represents a pre-parsed UI element for rendering.
type SessionElementsPagination ¶
type SessionElementsPagination struct {
Total int `json:"total"`
Returned int `json:"returned"`
HasMoreBefore bool `json:"has_more_before"`
HasMoreAfter bool `json:"has_more_after"`
OldestID string `json:"oldest_id,omitempty"`
NewestID string `json:"newest_id,omitempty"`
}
SessionElementsPagination represents pagination info for elements.
type SessionFocusParams ¶
type SessionFocusParams struct {
// WorkspaceID is the workspace ID.
WorkspaceID string `json:"workspace_id"`
// SessionID is the session ID being focused on.
SessionID string `json:"session_id"`
}
SessionFocusParams for client/session/focus method.
type SessionFocusProvider ¶
type SessionFocusProvider interface {
SetSessionFocus(clientID, workspaceID, sessionID string) (interface{}, error)
}
SessionFocusProvider handles session focus tracking for multi-device awareness.
type SessionInfo ¶
type SessionInfo struct {
// SessionID is the unique identifier.
SessionID string `json:"session_id"`
// AgentType is the type of agent (claude, gemini, codex).
AgentType string `json:"agent_type"`
// Summary is a brief description of the session.
Summary string `json:"summary,omitempty"`
// FirstPrompt is the first user message (for Codex sessions).
FirstPrompt string `json:"first_prompt,omitempty"`
// MessageCount is the number of messages in the session.
MessageCount int `json:"message_count"`
// StartTime is when the session started.
StartTime time.Time `json:"start_time"`
// LastUpdated is when the session was last updated.
LastUpdated time.Time `json:"last_updated"`
// Branch is the git branch (if available).
Branch string `json:"branch,omitempty"`
// GitCommit is the git commit hash (if available).
GitCommit string `json:"git_commit,omitempty"`
// GitRepo is the repository URL (if available).
GitRepo string `json:"git_repo,omitempty"`
// ProjectPath is the project this session belongs to.
ProjectPath string `json:"project_path,omitempty"`
// ModelProvider is the AI provider (openai, anthropic, etc.).
ModelProvider string `json:"model_provider,omitempty"`
// Model is the specific model used.
Model string `json:"model,omitempty"`
// CLIVersion is the CLI version that created the session.
CLIVersion string `json:"cli_version,omitempty"`
// FileSize is the session file size in bytes.
FileSize int64 `json:"file_size,omitempty"`
// FilePath is the full path to the session file.
FilePath string `json:"file_path,omitempty"`
}
SessionInfo represents a unified session from any AI CLI.
type SessionManagerService ¶
type SessionManagerService struct {
// contains filtered or unexported fields
}
SessionManagerService handles session-related JSON-RPC methods for the new architecture. This replaces the old workspace start/stop with session-based management.
func NewSessionManagerService ¶
func NewSessionManagerService(manager *session.Manager) *SessionManagerService
NewSessionManagerService creates a new session manager service.
func (*SessionManagerService) ActivateSession ¶
func (s *SessionManagerService) ActivateSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
ActivateSession sets the active session for a workspace. This allows iOS clients to switch which session they are viewing/interacting with.
func (*SessionManagerService) Active ¶
func (s *SessionManagerService) Active(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Active returns a list of active sessions.
func (*SessionManagerService) DeleteHistorySession ¶
func (s *SessionManagerService) DeleteHistorySession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
DeleteHistorySession deletes a historical session file.
func (*SessionManagerService) FileGet ¶
func (s *SessionManagerService) FileGet(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
FileGet returns the content of a file from a workspace.
func (*SessionManagerService) FilesList ¶
func (s *SessionManagerService) FilesList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
FilesList lists files and directories in a workspace. Response format matches /api/repository/files/list HTTP endpoint.
func (*SessionManagerService) GetSessionMessages ¶
func (s *SessionManagerService) GetSessionMessages(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetSessionMessages returns messages from a historical session.
func (*SessionManagerService) GitBranches ¶
func (s *SessionManagerService) GitBranches(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitBranches lists branches for a workspace.
func (*SessionManagerService) GitCheckout ¶
func (s *SessionManagerService) GitCheckout(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitCheckout checks out a branch for a workspace.
func (*SessionManagerService) GitCommit ¶
func (s *SessionManagerService) GitCommit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitCommit commits staged changes for a workspace.
func (*SessionManagerService) GitDeleteBranch ¶
func (s *SessionManagerService) GitDeleteBranch(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitDeleteBranch deletes a branch for a workspace.
func (*SessionManagerService) GitDiff ¶
func (s *SessionManagerService) GitDiff(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitDiff returns git diff for a workspace. Returns format consistent with git/diff: {path, diff, is_staged, is_new}
func (*SessionManagerService) GitDiscard ¶
func (s *SessionManagerService) GitDiscard(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitDiscard discards changes for a workspace.
func (*SessionManagerService) GitFetch ¶
func (s *SessionManagerService) GitFetch(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitFetch fetches from a remote for a workspace.
func (*SessionManagerService) GitGetStatus ¶
func (s *SessionManagerService) GitGetStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitGetStatus returns the comprehensive git status for a workspace.
func (*SessionManagerService) GitInit ¶
func (s *SessionManagerService) GitInit(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitInit initializes a git repository for a workspace.
func (*SessionManagerService) GitLog ¶
func (s *SessionManagerService) GitLog(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitLog returns the commit log for a workspace.
func (*SessionManagerService) GitMerge ¶
func (s *SessionManagerService) GitMerge(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitMerge merges a branch for a workspace.
func (*SessionManagerService) GitMergeAbort ¶
func (s *SessionManagerService) GitMergeAbort(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitMergeAbort aborts a merge for a workspace.
func (*SessionManagerService) GitPull ¶
func (s *SessionManagerService) GitPull(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitPull pulls changes for a workspace.
func (*SessionManagerService) GitPush ¶
func (s *SessionManagerService) GitPush(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitPush pushes commits for a workspace.
func (*SessionManagerService) GitRemoteAdd ¶
func (s *SessionManagerService) GitRemoteAdd(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitRemoteAdd adds a remote to a workspace.
func (*SessionManagerService) GitRemoteList ¶
func (s *SessionManagerService) GitRemoteList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitRemoteList lists remotes for a workspace.
func (*SessionManagerService) GitRemoteRemove ¶
func (s *SessionManagerService) GitRemoteRemove(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitRemoteRemove removes a remote from a workspace.
func (*SessionManagerService) GitSetUpstream ¶
func (s *SessionManagerService) GitSetUpstream(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitSetUpstream sets the upstream for a branch.
func (*SessionManagerService) GitStage ¶
func (s *SessionManagerService) GitStage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStage stages files for a workspace.
func (*SessionManagerService) GitStash ¶
func (s *SessionManagerService) GitStash(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStash creates a stash for a workspace.
func (*SessionManagerService) GitStashApply ¶
func (s *SessionManagerService) GitStashApply(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStashApply applies a stash for a workspace.
func (*SessionManagerService) GitStashDrop ¶
func (s *SessionManagerService) GitStashDrop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStashDrop drops a stash for a workspace.
func (*SessionManagerService) GitStashList ¶
func (s *SessionManagerService) GitStashList(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStashList lists stashes for a workspace.
func (*SessionManagerService) GitStashPop ¶
func (s *SessionManagerService) GitStashPop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStashPop pops a stash for a workspace.
func (*SessionManagerService) GitStatus ¶
func (s *SessionManagerService) GitStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitStatus returns git status for a workspace. Returns the same structured format as git/status with branch info and categorized files.
func (*SessionManagerService) GitUnstage ¶
func (s *SessionManagerService) GitUnstage(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GitUnstage unstages files for a workspace.
func (*SessionManagerService) History ¶
func (s *SessionManagerService) History(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
History returns historical sessions for a workspace.
func (*SessionManagerService) Info ¶
func (s *SessionManagerService) Info(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Info returns detailed information about a session.
func (*SessionManagerService) Input ¶
func (s *SessionManagerService) Input(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Input sends keyboard input to an interactive (PTY) session. Supports special key names: "enter", "escape", "up", "down", "left", "right", "tab", "backspace" For special keys, uses SendKey which handles platform-specific key codes for LIVE sessions. For text input, uses SendInput which sends raw text.
func (*SessionManagerService) RegisterMethods ¶
func (s *SessionManagerService) RegisterMethods(registry *handler.Registry)
RegisterMethods registers all session management methods with the handler.
func (*SessionManagerService) Respond ¶
func (s *SessionManagerService) Respond(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Respond responds to a permission or question.
func (*SessionManagerService) Send ¶
func (s *SessionManagerService) Send(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Send sends a prompt to a session. If session_id is empty but workspace_id is provided, auto-creates a new session. Runtime behavior is selected by agent_type (claude or codex).
func (*SessionManagerService) SetFocusProvider ¶
func (s *SessionManagerService) SetFocusProvider(provider SessionFocusProvider)
SetFocusProvider sets the session focus provider for multi-device awareness. This allows workspace/session/watch to also update focus tracking.
func (*SessionManagerService) SetSessionService ¶
func (s *SessionManagerService) SetSessionService(sessionService *SessionService)
SetSessionService sets the shared session service for runtime-scoped delegation.
func (*SessionManagerService) Start ¶
func (s *SessionManagerService) Start(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Start starts or attaches to a session for a workspace. Runtime behavior is selected by agent_type (claude or codex).
func (*SessionManagerService) State ¶
func (s *SessionManagerService) State(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
State returns the full runtime state of a session for reconnection sync.
func (*SessionManagerService) Stop ¶
func (s *SessionManagerService) Stop(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Stop stops a running session.
func (*SessionManagerService) UnwatchSession ¶
func (s *SessionManagerService) UnwatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
UnwatchSession stops watching a session. Returns the previous watch info.
func (*SessionManagerService) WatchSession ¶
func (s *SessionManagerService) WatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
WatchSession starts watching a session for real-time message updates. Returns watch info including the workspace_id, session_id, and watching status. Also updates session focus tracking so the client appears in the session's viewers list.
type SessionMessage ¶
type SessionMessage struct {
// ID is the database row ID.
ID int64 `json:"id"`
// SessionID is the parent session ID.
SessionID string `json:"session_id"`
// Type is the message type (user, assistant).
Type string `json:"type"`
// UUID is the unique message identifier.
UUID string `json:"uuid,omitempty"`
// Timestamp is when the message was created (ISO 8601 string).
Timestamp string `json:"timestamp,omitempty"`
// GitBranch is the git branch when message was created.
GitBranch string `json:"git_branch,omitempty"`
// Message is the raw Claude API message (content, role, model, usage, etc).
Message json.RawMessage `json:"message"`
// IsContextCompaction is true when this is an auto-generated message
// created by Claude Code when the context window was maxed out.
IsContextCompaction bool `json:"is_context_compaction,omitempty"`
// IsMeta is true for system-generated metadata messages (e.g., command caveats).
IsMeta bool `json:"is_meta,omitempty"`
}
SessionMessage represents a raw cached message matching the HTTP API format. This preserves the full Claude API response in the Message field. IMPORTANT: This struct must match CachedMessage in sessioncache/messages.go
type SessionMode ¶
type SessionMode string
SessionMode represents the mode for agent sessions.
const ( SessionModeNew SessionMode = "new" SessionModeContinue SessionMode = "continue" )
type SessionProvider ¶
type SessionProvider interface {
// ListSessions returns available sessions for the current project.
// If projectPath is provided, filters sessions to that project path.
ListSessions(ctx context.Context, projectPath string) ([]SessionInfo, error)
// GetSession returns detailed session info.
GetSession(ctx context.Context, sessionID string) (*SessionInfo, error)
// GetSessionMessages returns messages for a session.
// Order can be "asc" or "desc" (default: "asc").
GetSessionMessages(ctx context.Context, sessionID string, limit, offset int, order string) ([]SessionMessage, int, error)
// GetSessionElements returns pre-parsed UI elements for a session.
GetSessionElements(ctx context.Context, sessionID string, limit int, beforeID, afterID string) ([]SessionElement, int, error)
// DeleteSession deletes a specific session.
DeleteSession(ctx context.Context, sessionID string) error
// DeleteAllSessions deletes all sessions.
DeleteAllSessions(ctx context.Context) (int, error)
// AgentType returns the type of agent this provider is for.
AgentType() string
}
SessionProvider defines the interface for accessing sessions. This is CLI-agnostic and can be implemented for Claude, Gemini, Codex, etc.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService provides session-related RPC methods.
func NewSessionService ¶
func NewSessionService(streamer SessionStreamer) *SessionService
NewSessionService creates a new session service.
func (*SessionService) GetSession ¶
func (s *SessionService) GetSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetSession returns detailed session info.
func (*SessionService) GetSessionElements ¶
func (s *SessionService) GetSessionElements(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetSessionElements returns pre-parsed UI elements for a session.
func (*SessionService) GetSessionMessages ¶
func (s *SessionService) GetSessionMessages(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetSessionMessages returns messages for a session.
func (*SessionService) ListSessions ¶
func (s *SessionService) ListSessions(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
ListSessions returns available sessions.
func (*SessionService) RegisterMethods ¶
func (s *SessionService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all session methods with the registry.
func (*SessionService) RegisterProvider ¶
func (s *SessionService) RegisterProvider(provider SessionProvider)
RegisterProvider registers a session provider for an agent type.
func (*SessionService) RegisterStreamer ¶
func (s *SessionService) RegisterStreamer(agentType string, streamer SessionStreamer)
RegisterStreamer registers a streamer for a specific agent type.
func (*SessionService) SetWorkspaceResolver ¶
func (s *SessionService) SetWorkspaceResolver(resolver WorkspacePathResolver)
SetWorkspaceResolver sets the workspace path resolver.
func (*SessionService) UnwatchSession ¶
func (s *SessionService) UnwatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
UnwatchSession stops watching the current session.
func (*SessionService) WatchSession ¶
func (s *SessionService) WatchSession(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
WatchSession starts watching a session for real-time updates. This method validates the session exists and starts the file watcher.
type SessionStreamer ¶
type SessionStreamer interface {
// WatchSession starts watching a session for new messages.
WatchSession(sessionID string) error
// UnwatchSession stops watching the current session.
UnwatchSession()
// GetWatchedSession returns the currently watched session ID.
GetWatchedSession() string
}
SessionStreamer defines the interface for real-time session watching.
type SessionViewerProvider ¶
type SessionViewerProvider interface {
// GetSessionViewers returns a map of session ID to list of client IDs viewing that session.
GetSessionViewers(workspaceID string) map[string][]string
}
SessionViewerProvider provides session viewer information.
type ShutdownResult ¶
type ShutdownResult struct {
Success bool `json:"success"`
}
ShutdownResult is returned from shutdown.
type StageResult ¶
StageResult for git/stage method - matches HTTP API format.
type StatusProvider ¶
type StatusProvider interface {
// ClaudeState returns the current Claude state.
ClaudeState() string
// ConnectedClients returns the number of connected clients.
ConnectedClients() int
// RepoPath returns the repository path.
RepoPath() string
// UptimeSeconds returns the uptime in seconds.
UptimeSeconds() int64
// Version returns the server version.
Version() string
// WatcherEnabled returns whether the file watcher is enabled.
WatcherEnabled() bool
// GitEnabled returns whether git integration is enabled.
GitEnabled() bool
}
StatusProvider provides status information.
type StatusService ¶
type StatusService struct {
// contains filtered or unexported fields
}
StatusService provides status-related RPC methods.
func NewStatusService ¶
func NewStatusService(provider StatusProvider) *StatusService
NewStatusService creates a new status service.
func (*StatusService) GetStatus ¶
func (s *StatusService) GetStatus(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
GetStatus returns the current server status. This consolidates logic from: - app.go:421-433 (WebSocket handler) - http/server.go:264-272 (HTTP handler)
func (*StatusService) Health ¶
func (s *StatusService) Health(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Health returns a simple health check response.
func (*StatusService) RegisterMethods ¶
func (s *StatusService) RegisterMethods(r *handler.Registry)
RegisterMethods registers all status methods with the registry.
type SubscriptionService ¶
type SubscriptionService struct {
// contains filtered or unexported fields
}
SubscriptionService handles workspace subscription RPC methods.
func NewSubscriptionService ¶
func NewSubscriptionService() *SubscriptionService
NewSubscriptionService creates a new subscription service.
func (*SubscriptionService) RegisterMethods ¶
func (s *SubscriptionService) RegisterMethods(registry *handler.Registry)
RegisterMethods registers all subscription methods with the handler.
func (*SubscriptionService) SetGitWatcherManager ¶
func (s *SubscriptionService) SetGitWatcherManager(manager GitWatcherManager)
SetGitWatcherManager sets the git watcher manager (session manager). This is called to enable git_status_changed events on workspace subscription.
func (*SubscriptionService) SetProvider ¶
func (s *SubscriptionService) SetProvider(provider FilteredSubscriberProvider)
SetProvider sets the filtered subscriber provider. This is called after the server is created to avoid circular dependencies.
func (*SubscriptionService) Subscribe ¶
func (s *SubscriptionService) Subscribe(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Subscribe adds a workspace to the client's subscription filter.
func (*SubscriptionService) SubscribeAll ¶
func (s *SubscriptionService) SubscribeAll(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
SubscribeAll clears the workspace filter and receives all events.
func (*SubscriptionService) Subscriptions ¶
func (s *SubscriptionService) Subscriptions(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Subscriptions returns the client's current workspace subscriptions.
func (*SubscriptionService) Unsubscribe ¶
func (s *SubscriptionService) Unsubscribe(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Unsubscribe removes a workspace from the client's subscription filter.
type TokenUsage ¶
type TokenUsage struct {
Input int `json:"input,omitempty"`
Output int `json:"output,omitempty"`
Cached int `json:"cached,omitempty"`
Thinking int `json:"thinking,omitempty"`
Total int `json:"total,omitempty"`
}
TokenUsage represents token usage for a message.
type ToolCall ¶
type ToolCall struct {
// ID is the tool use ID.
ID string `json:"id"`
// Name is the tool name.
Name string `json:"name"`
// Input is the tool input arguments.
Input map[string]interface{} `json:"input,omitempty"`
// Result is the tool result (if completed).
Result string `json:"result,omitempty"`
// Status is the tool call status.
Status string `json:"status,omitempty"`
}
ToolCall represents a tool invocation.
type UnstageResult ¶
UnstageResult for git/unstage method - matches HTTP API format.
type UnwatchSessionResult ¶
UnwatchSessionResult for session/unwatch method.
type WatchSessionParams ¶
type WatchSessionParams struct {
SessionID string `json:"session_id"`
AgentType string `json:"agent_type,omitempty"`
}
WatchSessionParams for session/watch method.
type WatchSessionResult ¶
WatchSessionResult for session/watch method.
type WorkspaceConfigService ¶
type WorkspaceConfigService struct {
// contains filtered or unexported fields
}
WorkspaceConfigService handles workspace configuration CRUD operations. This is the simplified version that only manages workspace configs, not processes.
func NewWorkspaceConfigService ¶
func NewWorkspaceConfigService(sessionManager *session.Manager, configManager *workspace.ConfigManager, hub ports.EventHub, authRegistry *security.AuthRegistry) *WorkspaceConfigService
NewWorkspaceConfigService creates a new workspace config service.
func (*WorkspaceConfigService) Add ¶
func (s *WorkspaceConfigService) Add(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Add registers a new workspace.
func (*WorkspaceConfigService) Discover ¶
func (s *WorkspaceConfigService) Discover(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Discover scans for git repositories. Uses cache-first strategy: returns cached results immediately if available, triggers background refresh if cache is stale.
func (*WorkspaceConfigService) Get ¶
func (s *WorkspaceConfigService) Get(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Get returns details of a specific workspace.
func (*WorkspaceConfigService) InvalidateCache ¶
func (s *WorkspaceConfigService) InvalidateCache(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
InvalidateCache clears the discovery cache. This forces the next workspace/discover call to perform a fresh scan.
func (*WorkspaceConfigService) List ¶
func (s *WorkspaceConfigService) List(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
List returns all configured workspaces. Includes both running sessions and historical sessions from ~/.claude/projects/ Optional params:
- include_git: bool - include git status for each workspace (default: false)
- git_limit: int - limit git status fetching to first N workspaces (0 = all)
func (*WorkspaceConfigService) RegisterMethods ¶
func (s *WorkspaceConfigService) RegisterMethods(registry *handler.Registry)
RegisterMethods registers all workspace config methods with the handler.
func (*WorkspaceConfigService) Remove ¶
func (s *WorkspaceConfigService) Remove(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Remove unregisters a workspace.
func (*WorkspaceConfigService) SetViewerProvider ¶
func (s *WorkspaceConfigService) SetViewerProvider(provider SessionViewerProvider)
SetViewerProvider sets the session viewer provider. This allows the provider to be set after service initialization.
func (*WorkspaceConfigService) Status ¶
func (s *WorkspaceConfigService) Status(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Status returns detailed status for a specific workspace. Response format matches status/get but scoped to a workspace.
func (*WorkspaceConfigService) Update ¶
func (s *WorkspaceConfigService) Update(ctx context.Context, params json.RawMessage) (interface{}, *message.Error)
Update updates workspace settings.
type WorkspaceIDResolver ¶
type WorkspaceIDResolver struct {
}
WorkspaceIDResolver is a simple implementation that extracts workspace ID from path.
func NewWorkspaceIDResolver ¶
func NewWorkspaceIDResolver() *WorkspaceIDResolver
NewWorkspaceIDResolver creates a new workspace ID resolver.
func (*WorkspaceIDResolver) ResolveWorkspaceID ¶
func (r *WorkspaceIDResolver) ResolveWorkspaceID(path string) (string, error)
ResolveWorkspaceID resolves a workspace ID from a path. For now, it uses the directory name as the workspace ID.
type WorkspaceInfo ¶
type WorkspaceInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
AutoStart bool `json:"auto_start"`
CreatedAt string `json:"created_at"`
HasActiveSession bool `json:"has_active_session"`
Session *session.Info `json:"session,omitempty"`
}
WorkspaceInfo represents workspace information for API responses.
type WorkspacePathResolver ¶
WorkspacePathResolver resolves workspace path from workspace ID.
type WorkspaceResolver ¶
WorkspaceResolver resolves workspace ID from a path.