aether-wisp 0.7.0

A terminal UI for AI coding agents via the Agent Client Protocol (ACP)
Documentation
use crate::attachment::{AttachmentOutcome, PromptAttachment};
use crate::file_index::FileEntry;
use crate::conversation::ConversationId;
use crate::git_review::{DiffScope, GitDiffEvent, GitWatchEvent};
use crate::request::RequestId;
use crate::session::workspace_status::WorkspaceStatus;
use crate::settings::UiSettings;
use crate::theme::{Theme, ThemeApplicationError};
use acp_utils::notifications::{
    PromptSearchParams, PromptSearchResponse, SessionPreviewResponse, WorkspaceListResponse, WorkspaceMoveResponse,
    WorkspaceMoveTarget,
};
use agent_client_protocol::schema::v2::{
    ContentBlock, ListSessionsResponse, LoginAuthResponse, NewSessionResponse, PromptResponse,
    ResumeSessionResponse, SetSessionConfigOptionResponse, SessionConfigOptionValue, SessionId,
};
use clankerdiff_ratatui::diff::RepositoryAction;
use std::path::PathBuf;

#[derive(Debug, Clone)]
pub enum Command {
    Agent(AgentCommand),
    Filesystem(FilesystemCommand),
    Git(GitCommand),
    GitWatch(GitWatchCommand),
    ResolveWorkspace { cwd: PathBuf },
    Terminal(TerminalCommand),
}

#[derive(Debug, Clone)]
pub enum AgentCommand {
    Prompt { session_id: SessionId, text: String, content: Option<Vec<ContentBlock>> },
    Cancel { session_id: SessionId },
    SetConfigOption { conversation_id: ConversationId, session_id: SessionId, config_id: String, value: SessionConfigOptionValue },
    AuthenticateMcpServer { session_id: SessionId, server_name: String },
    Authenticate { method_id: String },
    ListSessions,
    ResumeSession { session_id: SessionId, cwd: PathBuf },
    NewSession { cwd: PathBuf },
    SearchPrompts(PromptSearchParams),
    SessionPreview { session_id: String },
    ListWorkspaces { session_id: String },
    MoveWorkspace { session_id: String, target: WorkspaceMoveTarget },
}

#[derive(Debug, Clone)]
pub enum FilesystemCommand {
    IndexFiles { request_id: RequestId, root: PathBuf },
    PrepareSubmission { attachments: Vec<PromptAttachment> },
    ListThemes,
    ListReviewThemes,
    ApplyTheme { settings: Box<UiSettings> },
}

#[derive(Debug, Clone)]
pub enum GitCommand {
    Apply { review_id: RequestId, action: RepositoryAction },
}

#[derive(Debug, Clone)]
pub enum GitWatchCommand {
    Open { review_id: RequestId, working_dir: PathBuf, scope: DiffScope },
    Refresh { review_id: RequestId, scope: DiffScope },
    Close { review_id: RequestId },
}

#[derive(Debug, Clone)]
pub enum TerminalCommand {
    RingBell,
}

pub enum CommandResult {
    Prompt(Result<PromptResponse, String>),
    Cancel(Result<(), String>),
    AuthenticateMcp(Result<(), String>),
    ConfigOptionsUpdated { conversation_id: ConversationId, result: Result<SetSessionConfigOptionResponse, String> },
    AuthenticationCompleted { method_id: String, result: Result<LoginAuthResponse, String> },
    NewSession(Result<NewSessionResponse, String>),
    ResumeSession { session_id: SessionId, result: Result<ResumeSessionResponse, String> },
    SessionsListed(Result<ListSessionsResponse, String>),
    PromptSearchResults { query: String, result: Result<PromptSearchResponse, String> },
    SessionPreviewLoaded { session_id: String, result: Result<SessionPreviewResponse, String> },
    WorkspacesListed(Result<WorkspaceListResponse, String>),
    WorkspaceMoved(Result<WorkspaceMoveResponse, String>),
    FilesIndexed { request_id: RequestId, files: Vec<FileEntry> },
    GitDiff(GitDiffEvent),
    GitWatch(GitWatchEvent),
    GitWatchStarted {
        review_id: RequestId,
        result: Result<Box<(clankerdiff_git::GitRepository, clankerdiff_watch::RepositoryWatcher)>, clankerdiff_watch::WatchError>,
    },
    SubmissionPrepared(AttachmentOutcome),
    ThemesListed(Vec<String>),
    ReviewThemesListed(Vec<clankerdiff_ratatui::ThemeChoice>),
    ThemeApplied(Result<(Box<UiSettings>, Theme), ThemeApplicationError>),
    WorkspaceResolved { cwd: PathBuf, status: WorkspaceStatus },
    BackgroundFailed(String),
    TerminalFailed(String),
}