app

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package app provides adapters that wrap existing components to implement RPC method interfaces.

Package app orchestrates all components of cdev.

Index

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 New

func New(cfg *config.Config, version string) (*App, error)

New creates a new App instance.

func (*App) ClaudeState

func (a *App) ClaudeState() string

ClaudeState returns the current Claude state.

func (*App) ConnectedClients

func (a *App) ConnectedClients() int

ConnectedClients returns the number of connected clients.

func (*App) GetAgentStatus

func (a *App) GetAgentStatus() string

GetAgentStatus returns the current agent status for heartbeats. Implements common.StatusProvider.

func (*App) GetConfig

func (a *App) GetConfig() *config.Config

GetConfig returns the configuration.

func (*App) GetHub

func (a *App) GetHub() *hub.Hub

GetHub returns the event hub.

func (*App) GetSessionID

func (a *App) GetSessionID() string

GetSessionID returns the current session ID.

func (*App) GetTerminalRunner

func (a *App) GetTerminalRunner() *terminal.Runner

GetTerminalRunner returns the terminal runner (nil if in headless mode).

func (*App) GetUptimeSeconds

func (a *App) GetUptimeSeconds() int64

GetUptimeSeconds returns the server uptime in seconds. Implements common.StatusProvider.

func (*App) GitEnabled

func (a *App) GitEnabled() bool

GitEnabled returns whether git integration is enabled.

func (*App) IsTerminalMode

func (a *App) IsTerminalMode() bool

IsTerminalMode returns whether the app is running in terminal mode.

func (*App) RepoPath

func (a *App) RepoPath() string

RepoPath returns the repository path.

func (*App) RunTerminalSession

func (a *App) RunTerminalSession(ctx context.Context, prompt string) error

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

func (a *App) SendTerminalInput(data []byte) error

SendTerminalInput sends input to the terminal session from WebSocket.

func (*App) Start

func (a *App) Start(ctx context.Context) error

Start starts the application and blocks until context is cancelled.

func (*App) UptimeSeconds

func (a *App) UptimeSeconds() int64

UptimeSeconds returns how long the app has been running.

func (*App) Version

func (a *App) Version() string

Version returns the server version.

func (*App) WatcherEnabled

func (a *App) WatcherEnabled() bool

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

State returns the current agent state.

func (*ClaudeAgentAdapter) Stop

func (a *ClaudeAgentAdapter) Stop(ctx context.Context) error

Stop stops the running agent process.

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

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) Diff

func (a *GitProviderAdapter) Diff(ctx context.Context, path string) (string, bool, bool, error)

Diff returns the diff for a file.

func (*GitProviderAdapter) Discard

func (a *GitProviderAdapter) Discard(ctx context.Context, paths []string) error

Discard discards changes to files.

func (*GitProviderAdapter) Pull

Pull pulls from remote.

func (*GitProviderAdapter) Push

Push pushes to remote.

func (*GitProviderAdapter) Stage

func (a *GitProviderAdapter) Stage(ctx context.Context, paths []string) error

Stage stages files.

func (*GitProviderAdapter) Status

Status returns the git status matching HTTP API format.

func (*GitProviderAdapter) Unstage

func (a *GitProviderAdapter) Unstage(ctx context.Context, paths []string) error

Unstage unstages files.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL