Documentation
¶
Overview ¶
Package app provides adapters that wrap existing components to implement RPC method interfaces.
Package app orchestrates all components of cdev.
Index ¶
- type App
- func (a *App) ClaudeState() string
- func (a *App) ConnectedClients() int
- func (a *App) GetAgentStatus() string
- func (a *App) GetConfig() *config.Config
- func (a *App) GetHub() *hub.Hub
- func (a *App) GetSessionID() string
- func (a *App) GetTerminalRunner() *terminal.Runner
- func (a *App) GetUptimeSeconds() int64
- func (a *App) GitEnabled() bool
- func (a *App) IsTerminalMode() bool
- func (a *App) RepoPath() string
- func (a *App) RunTerminalSession(ctx context.Context, prompt string) error
- func (a *App) SendTerminalInput(data []byte) error
- func (a *App) Start(ctx context.Context) error
- func (a *App) UptimeSeconds() int64
- func (a *App) Version() string
- func (a *App) WatcherEnabled() bool
- type ClaudeAgentAdapter
- func (a *ClaudeAgentAdapter) AgentType() string
- func (a *ClaudeAgentAdapter) IsPTYMode() bool
- func (a *ClaudeAgentAdapter) PID() int
- func (a *ClaudeAgentAdapter) SendPTYInput(input string) error
- func (a *ClaudeAgentAdapter) SendResponse(toolUseID, response string, isError bool) error
- func (a *ClaudeAgentAdapter) SessionID() string
- func (a *ClaudeAgentAdapter) StartWithSession(ctx context.Context, prompt string, mode methods.SessionMode, sessionID string, ...) error
- func (a *ClaudeAgentAdapter) State() methods.AgentState
- func (a *ClaudeAgentAdapter) Stop(ctx context.Context) error
- type ClaudeSessionAdapter
- func (a *ClaudeSessionAdapter) AgentType() string
- func (a *ClaudeSessionAdapter) DeleteAllSessions(ctx context.Context) (int, error)
- func (a *ClaudeSessionAdapter) DeleteSession(ctx context.Context, sessionID string) error
- func (a *ClaudeSessionAdapter) GetSession(ctx context.Context, sessionID string) (*methods.SessionInfo, error)
- func (a *ClaudeSessionAdapter) GetSessionElements(ctx context.Context, sessionID string, limit int, beforeID, afterID string) ([]methods.SessionElement, int, error)
- func (a *ClaudeSessionAdapter) GetSessionMessages(ctx context.Context, sessionID string, limit, offset int, order string) ([]methods.SessionMessage, int, error)
- func (a *ClaudeSessionAdapter) ListSessions(ctx context.Context, projectPath string) ([]methods.SessionInfo, error)
- type ClientFocusAdapter
- type ClientFocusServer
- type CodexSessionAdapter
- func (a *CodexSessionAdapter) AgentType() string
- func (a *CodexSessionAdapter) DeleteAllSessions(ctx context.Context) (int, error)
- func (a *CodexSessionAdapter) DeleteSession(ctx context.Context, sessionID string) error
- func (a *CodexSessionAdapter) GetSession(ctx context.Context, sessionID string) (*methods.SessionInfo, error)
- func (a *CodexSessionAdapter) GetSessionElements(ctx context.Context, sessionID string, limit int, beforeID, afterID string) ([]methods.SessionElement, int, error)
- func (a *CodexSessionAdapter) GetSessionMessages(ctx context.Context, sessionID string, limit, offset int, order string) ([]methods.SessionMessage, int, error)
- func (a *CodexSessionAdapter) ListSessions(ctx context.Context, projectPath string) ([]methods.SessionInfo, error)
- type FileProviderAdapter
- type GitProviderAdapter
- func (a *GitProviderAdapter) Branches(ctx context.Context) (*methods.BranchesResult, error)
- func (a *GitProviderAdapter) Checkout(ctx context.Context, branch string) (*methods.CheckoutResult, error)
- func (a *GitProviderAdapter) Commit(ctx context.Context, message string, push bool) (*methods.CommitResult, error)
- func (a *GitProviderAdapter) Diff(ctx context.Context, path string) (string, bool, bool, error)
- func (a *GitProviderAdapter) Discard(ctx context.Context, paths []string) error
- func (a *GitProviderAdapter) Pull(ctx context.Context) (*methods.PullResult, error)
- func (a *GitProviderAdapter) Push(ctx context.Context) (*methods.PushResult, error)
- func (a *GitProviderAdapter) Stage(ctx context.Context, paths []string) error
- func (a *GitProviderAdapter) Status(ctx context.Context) (methods.GitStatusInfo, error)
- func (a *GitProviderAdapter) Unstage(ctx context.Context, paths []string) error
- type WorkspaceConfigProvider
- type WorkspacePathResolverAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main application struct that orchestrates all components.
func (*App) ClaudeState ¶
ClaudeState returns the current Claude state.
func (*App) ConnectedClients ¶
ConnectedClients returns the number of connected clients.
func (*App) GetAgentStatus ¶
GetAgentStatus returns the current agent status for heartbeats. Implements common.StatusProvider.
func (*App) GetSessionID ¶
GetSessionID returns the current session ID.
func (*App) GetTerminalRunner ¶
GetTerminalRunner returns the terminal runner (nil if in headless mode).
func (*App) GetUptimeSeconds ¶
GetUptimeSeconds returns the server uptime in seconds. Implements common.StatusProvider.
func (*App) GitEnabled ¶
GitEnabled returns whether git integration is enabled.
func (*App) IsTerminalMode ¶
IsTerminalMode returns whether the app is running in terminal mode.
func (*App) RunTerminalSession ¶
RunTerminalSession runs Claude in terminal mode (blocking). This takes over the current terminal and runs Claude interactively. Output is sent to both the local terminal and WebSocket clients.
func (*App) SendTerminalInput ¶
SendTerminalInput sends input to the terminal session from WebSocket.
func (*App) UptimeSeconds ¶
UptimeSeconds returns how long the app has been running.
func (*App) WatcherEnabled ¶
WatcherEnabled returns whether the file watcher is enabled.
type ClaudeAgentAdapter ¶
type ClaudeAgentAdapter struct {
// contains filtered or unexported fields
}
ClaudeAgentAdapter wraps claude.Manager to implement methods.AgentManager.
func NewClaudeAgentAdapter ¶
func NewClaudeAgentAdapter(manager *claude.Manager) *ClaudeAgentAdapter
NewClaudeAgentAdapter creates a new Claude agent adapter.
func (*ClaudeAgentAdapter) AgentType ¶
func (a *ClaudeAgentAdapter) AgentType() string
AgentType returns the type of agent.
func (*ClaudeAgentAdapter) IsPTYMode ¶
func (a *ClaudeAgentAdapter) IsPTYMode() bool
IsPTYMode returns true if running in PTY mode.
func (*ClaudeAgentAdapter) PID ¶
func (a *ClaudeAgentAdapter) PID() int
PID returns the process ID of the running agent.
func (*ClaudeAgentAdapter) SendPTYInput ¶
func (a *ClaudeAgentAdapter) SendPTYInput(input string) error
SendPTYInput sends input to the PTY (for interactive responses).
func (*ClaudeAgentAdapter) SendResponse ¶
func (a *ClaudeAgentAdapter) SendResponse(toolUseID, response string, isError bool) error
SendResponse sends a response to an interactive prompt.
func (*ClaudeAgentAdapter) SessionID ¶
func (a *ClaudeAgentAdapter) SessionID() string
SessionID returns the current session ID.
func (*ClaudeAgentAdapter) StartWithSession ¶
func (a *ClaudeAgentAdapter) StartWithSession(ctx context.Context, prompt string, mode methods.SessionMode, sessionID string, permissionMode string) error
StartWithSession starts the agent with a prompt and session configuration.
func (*ClaudeAgentAdapter) State ¶
func (a *ClaudeAgentAdapter) State() methods.AgentState
State returns the current agent state.
type ClaudeSessionAdapter ¶
type ClaudeSessionAdapter struct {
// contains filtered or unexported fields
}
ClaudeSessionAdapter wraps sessioncache.Cache and MessageCache to implement methods.SessionProvider.
func NewClaudeSessionAdapter ¶
func NewClaudeSessionAdapter(cache *sessioncache.Cache, messageCache *sessioncache.MessageCache, repoPath string) *ClaudeSessionAdapter
NewClaudeSessionAdapter creates a new Claude session adapter.
func (*ClaudeSessionAdapter) AgentType ¶
func (a *ClaudeSessionAdapter) AgentType() string
AgentType returns the agent type.
func (*ClaudeSessionAdapter) DeleteAllSessions ¶
func (a *ClaudeSessionAdapter) DeleteAllSessions(ctx context.Context) (int, error)
DeleteAllSessions deletes all sessions.
func (*ClaudeSessionAdapter) DeleteSession ¶
func (a *ClaudeSessionAdapter) DeleteSession(ctx context.Context, sessionID string) error
DeleteSession deletes a specific session.
func (*ClaudeSessionAdapter) GetSession ¶
func (a *ClaudeSessionAdapter) GetSession(ctx context.Context, sessionID string) (*methods.SessionInfo, error)
GetSession returns detailed session info.
func (*ClaudeSessionAdapter) GetSessionElements ¶
func (a *ClaudeSessionAdapter) GetSessionElements(ctx context.Context, sessionID string, limit int, beforeID, afterID string) ([]methods.SessionElement, int, error)
GetSessionElements returns pre-parsed UI elements for a session.
func (*ClaudeSessionAdapter) GetSessionMessages ¶
func (a *ClaudeSessionAdapter) GetSessionMessages(ctx context.Context, sessionID string, limit, offset int, order string) ([]methods.SessionMessage, int, error)
GetSessionMessages returns messages for a session. Returns raw CachedMessage format matching the HTTP API. Order can be "asc" or "desc".
func (*ClaudeSessionAdapter) ListSessions ¶
func (a *ClaudeSessionAdapter) ListSessions(ctx context.Context, projectPath string) ([]methods.SessionInfo, error)
ListSessions returns available sessions. The projectPath parameter is ignored for Claude since it already operates on a single project.
type ClientFocusAdapter ¶
type ClientFocusAdapter struct {
// contains filtered or unexported fields
}
ClientFocusAdapter wraps the unified server to implement methods.ClientFocusProvider.
func NewClientFocusAdapter ¶
func NewClientFocusAdapter(server ClientFocusServer) *ClientFocusAdapter
NewClientFocusAdapter creates a new client focus adapter.
func (*ClientFocusAdapter) SetSessionFocus ¶
func (a *ClientFocusAdapter) SetSessionFocus(clientID, workspaceID, sessionID string) (interface{}, error)
SetSessionFocus updates the session focus for a client.
type ClientFocusServer ¶
type ClientFocusServer interface {
SetSessionFocus(clientID, workspaceID, sessionID string) (interface{}, error)
}
ClientFocusServer interface for server operations. Note: The actual implementation returns *unified.FocusChangeResult, but we use interface{} to avoid circular dependencies.
type CodexSessionAdapter ¶
type CodexSessionAdapter struct {
// contains filtered or unexported fields
}
CodexSessionAdapter implements methods.SessionProvider for Codex CLI sessions. It uses the IndexCache for efficient project-based session discovery with rich metadata.
func NewCodexSessionAdapter ¶
func NewCodexSessionAdapter(repoPath string) *CodexSessionAdapter
NewCodexSessionAdapter creates a new Codex session adapter.
func (*CodexSessionAdapter) AgentType ¶
func (a *CodexSessionAdapter) AgentType() string
AgentType returns the agent type.
func (*CodexSessionAdapter) DeleteAllSessions ¶
func (a *CodexSessionAdapter) DeleteAllSessions(ctx context.Context) (int, error)
DeleteAllSessions deletes all Codex sessions for the repo.
func (*CodexSessionAdapter) DeleteSession ¶
func (a *CodexSessionAdapter) DeleteSession(ctx context.Context, sessionID string) error
DeleteSession deletes a specific Codex session.
func (*CodexSessionAdapter) GetSession ¶
func (a *CodexSessionAdapter) GetSession(ctx context.Context, sessionID string) (*methods.SessionInfo, error)
GetSession returns detailed session info. Uses the index cache for richer metadata.
func (*CodexSessionAdapter) GetSessionElements ¶
func (a *CodexSessionAdapter) GetSessionElements(ctx context.Context, sessionID string, limit int, beforeID, afterID string) ([]methods.SessionElement, int, error)
GetSessionElements returns pre-parsed UI elements for Codex sessions.
func (*CodexSessionAdapter) GetSessionMessages ¶
func (a *CodexSessionAdapter) GetSessionMessages(ctx context.Context, sessionID string, limit, offset int, order string) ([]methods.SessionMessage, int, error)
GetSessionMessages returns messages for a Codex session.
func (*CodexSessionAdapter) ListSessions ¶
func (a *CodexSessionAdapter) ListSessions(ctx context.Context, projectPath string) ([]methods.SessionInfo, error)
ListSessions returns available Codex CLI sessions. If projectPath is provided, filters sessions to that project path. If projectPath is empty, returns ALL sessions from all projects (sorted by modification time). Note: Unlike Claude sessions which are stored per-project, Codex sessions are stored globally in ~/.codex/ so we can discover sessions from all projects regardless of repoPath.
type FileProviderAdapter ¶
type FileProviderAdapter struct {
// contains filtered or unexported fields
}
FileProviderAdapter wraps git.Tracker to implement methods.FileContentProvider.
func NewFileProviderAdapter ¶
func NewFileProviderAdapter(tracker *git.Tracker) *FileProviderAdapter
NewFileProviderAdapter creates a new file provider adapter.
func (*FileProviderAdapter) GetFileContent ¶
func (a *FileProviderAdapter) GetFileContent(ctx context.Context, path string, maxSizeKB int) (string, bool, error)
GetFileContent returns the content of a file.
func (*FileProviderAdapter) ListDirectory ¶
func (a *FileProviderAdapter) ListDirectory(ctx context.Context, path string) ([]methods.FileEntry, error)
ListDirectory returns entries in a directory.
type GitProviderAdapter ¶
type GitProviderAdapter struct {
// contains filtered or unexported fields
}
GitProviderAdapter wraps git.Tracker to implement methods.GitProvider.
func NewGitProviderAdapter ¶
func NewGitProviderAdapter(tracker *git.Tracker) *GitProviderAdapter
NewGitProviderAdapter creates a new Git provider adapter.
func (*GitProviderAdapter) Branches ¶
func (a *GitProviderAdapter) Branches(ctx context.Context) (*methods.BranchesResult, error)
Branches returns the list of branches with full info.
func (*GitProviderAdapter) Checkout ¶
func (a *GitProviderAdapter) Checkout(ctx context.Context, branch string) (*methods.CheckoutResult, error)
Checkout checks out a branch.
func (*GitProviderAdapter) Commit ¶
func (a *GitProviderAdapter) Commit(ctx context.Context, message string, push bool) (*methods.CommitResult, error)
Commit creates a commit and optionally pushes.
func (*GitProviderAdapter) Discard ¶
func (a *GitProviderAdapter) Discard(ctx context.Context, paths []string) error
Discard discards changes to files.
func (*GitProviderAdapter) Pull ¶
func (a *GitProviderAdapter) Pull(ctx context.Context) (*methods.PullResult, error)
Pull pulls from remote.
func (*GitProviderAdapter) Push ¶
func (a *GitProviderAdapter) Push(ctx context.Context) (*methods.PushResult, error)
Push pushes to remote.
func (*GitProviderAdapter) Stage ¶
func (a *GitProviderAdapter) Stage(ctx context.Context, paths []string) error
Stage stages files.
func (*GitProviderAdapter) Status ¶
func (a *GitProviderAdapter) Status(ctx context.Context) (methods.GitStatusInfo, error)
Status returns the git status matching HTTP API format.
type WorkspaceConfigProvider ¶
type WorkspaceConfigProvider interface {
GetWorkspace(id string) (interface{ GetPath() string }, error)
}
WorkspaceConfigProvider provides workspace configuration access.
type WorkspacePathResolverAdapter ¶
type WorkspacePathResolverAdapter struct {
// contains filtered or unexported fields
}
WorkspacePathResolverAdapter implements methods.WorkspacePathResolver.
func NewWorkspacePathResolverAdapter ¶
func NewWorkspacePathResolverAdapter(configManager *workspace.ConfigManager) *WorkspacePathResolverAdapter
NewWorkspacePathResolverAdapter creates a new workspace path resolver adapter.
func (*WorkspacePathResolverAdapter) GetWorkspacePath ¶
func (a *WorkspacePathResolverAdapter) GetWorkspacePath(workspaceID string) (string, error)
GetWorkspacePath resolves workspace ID to its path.