Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions app/src/ai/blocklist/context_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ pub enum AttachmentType {
File,
}

/// Lightweight metadata for rendering a pending attachment without cloning its payload.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PendingAttachmentSummary {
pub index: usize,
pub attachment_type: AttachmentType,
pub file_name: String,
}

/// A pending attachment — either an image (base64 in memory) or a file (path reference).
#[derive(Clone, Debug)]
pub enum PendingAttachment {
Expand Down Expand Up @@ -278,6 +286,19 @@ impl BlocklistAIContextModel {
&self.pending_attachments
}

/// Returns lightweight metadata for all pending attachments.
pub fn pending_attachment_summaries(&self) -> Vec<PendingAttachmentSummary> {
self.pending_attachments
.iter()
.enumerate()
.map(|(index, attachment)| PendingAttachmentSummary {
index,
attachment_type: attachment.attachment_type(),
file_name: attachment.file_name().to_owned(),
})
.collect()
}

/// Returns only the pending images for the next query.
pub fn pending_images(&self) -> Vec<&ImageContext> {
self.pending_attachments
Expand Down
8 changes: 4 additions & 4 deletions app/src/ai/blocklist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ pub use child_agent_launch::{
pub(crate) use context_model::block_context_from_terminal_model;
#[cfg(feature = "tui")]
pub use context_model::block_context_from_terminal_model;
pub use context_model::BlocklistAIContextModel;
pub(crate) use context_model::{
AttachmentType, BlocklistAIContextEvent, PendingAttachment, PendingFile,
};
#[cfg(feature = "tui")]
pub use context_model::PendingAttachmentSummary;
pub use context_model::{AttachmentType, BlocklistAIContextEvent, BlocklistAIContextModel};
pub(crate) use context_model::{PendingAttachment, PendingFile};
pub use controller::input_context::{
BLOCK_CONTEXT_ATTACHMENT_REGEX, DIFF_HUNK_ATTACHMENT_REGEX, DRIVE_OBJECT_ATTACHMENT_REGEX,
};
Expand Down
21 changes: 13 additions & 8 deletions app/src/tui_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub use crate::ai::agent::{
AIAgentOutputMessage, AIAgentOutputMessageType, AIAgentPtyWriteMode, AIAgentText,
AIAgentTextSection, AIAgentTodo, AIAgentTodoId, AgentOutputImage, AgentOutputImageLayout,
AgentOutputMermaidDiagram, AgentOutputTable, AskUserQuestionResult, CancellationReason,
FileGlobV2Result, GrepResult, MessageId, ReceivedMessageDisplay, RenderableAIError,
RequestCommandOutputResult, RunAgentsAgentOutcomeKind, RunAgentsResult,
FileGlobV2Result, GrepResult, ImageContext, MessageId, ReceivedMessageDisplay,
RenderableAIError, RequestCommandOutputResult, RunAgentsAgentOutcomeKind, RunAgentsResult,
SearchCodebaseFailureReason, SearchCodebaseResult, ServerOutputId, Shared, ShellCommandDelay,
StartAgentExecutionMode, SuggestNewConversationResult, SummarizationType, TodoOperation,
UserQueryMode,
Expand Down Expand Up @@ -78,12 +78,13 @@ pub use crate::ai::blocklist::{
};
pub use crate::ai::blocklist::{
block_context_from_terminal_model, inherit_child_agent_settings, AIActionStatus,
AskUserQuestionExecutor, BlocklistAIActionEvent, BlocklistAIActionModel,
BlocklistAIContextModel, BlocklistAIController, BlocklistAIInputModel, InputConfig,
InputModePolicy, InputModePolicyHandle, InputType, InputTypeAutoDetectionSource,
PolicyConfigUpdate, RequestFileEditsExecutor, RunAgentsExecutor, RunAgentsExecutorEvent,
RunAgentsSpawningSnapshot, ShellCommandExecutor, ShellCommandExecutorEvent, StartAgentExecutor,
StartAgentExecutorEvent, StartAgentOutcome, StartAgentRequest, StartAgentRequestId,
AskUserQuestionExecutor, AttachmentType, BlocklistAIActionEvent, BlocklistAIActionModel,
BlocklistAIContextEvent, BlocklistAIContextModel, BlocklistAIController, BlocklistAIInputModel,
InputConfig, InputModePolicy, InputModePolicyHandle, InputType, InputTypeAutoDetectionSource,
PendingAttachmentSummary, PolicyConfigUpdate, RequestFileEditsExecutor, RunAgentsExecutor,
RunAgentsExecutorEvent, RunAgentsSpawningSnapshot, ShellCommandExecutor,
ShellCommandExecutorEvent, StartAgentExecutor, StartAgentExecutorEvent, StartAgentOutcome,
StartAgentRequest, StartAgentRequestId,
};
pub use crate::ai::connected_self_hosted_workers::{
ConnectedSelfHostedWorkersEvent, ConnectedSelfHostedWorkersModel,
Expand Down Expand Up @@ -185,6 +186,10 @@ pub use crate::tui::{
};
#[cfg(any(test, feature = "test-util"))]
pub use crate::tui_test_support::register_tui_session_view_test_singletons;
pub use crate::util::image::{
infer_mime_type, is_supported_image_mime_type, process_image_for_agent, ProcessImageResult,
MAX_IMAGE_COUNT_FOR_QUERY, MAX_IMAGE_SIZE_BYTES, MIME_SNIFF_BYTES,
};
pub use crate::util::repo_detection::{detect_possible_git_repo, RepoDetectionSessionType};
pub use crate::util::time_format::format_elapsed_seconds;

Expand Down
4 changes: 3 additions & 1 deletion crates/warp_tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ anyhow.workspace = true
async-channel.workspace = true
async-fs.workspace = true
base64.workspace = true
blocking.workspace = true
channel_versions.workspace = true
clap.workspace = true
command.workspace = true
Expand All @@ -55,14 +56,15 @@ pathfinder_color.workspace = true
pathfinder_geometry.workspace = true
rangemap.workspace = true
serde_json.workspace = true
shell-words = "1.1.0"
similar.workspace = true
string-offset.workspace = true
strum.workspace = true
strum_macros.workspace = true
sum_tree.workspace = true
unicode-width.workspace = true
vec1.workspace = true
warp = { workspace = true, features = ["tui"] }
warp = { workspace = true, features = ["image_as_context", "tui"] }
warp_channel_config.workspace = true
warp_core.workspace = true
warp_errors.workspace = true
Expand Down
7 changes: 7 additions & 0 deletions crates/warp_tui/src/attachment_bar/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod model;
mod view;

pub(crate) use model::{TuiAttachmentModel, TuiAttachmentPasteDisposition};
pub(crate) use view::{
init, TuiAttachmentBar, TuiAttachmentBarEvent, FOCUS_ATTACHMENTS_BINDING_NAME,
};
Loading
Loading