Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Cargo.lock

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

19 changes: 9 additions & 10 deletions app/src/ai/blocklist/block/status_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use crate::ai::blocklist::summarization_cancel_dialog::{
use crate::ai::blocklist::{
ai_brand_color, BlocklistAIActionEvent, BlocklistAIActionModel, BlocklistAIContextEvent,
BlocklistAIContextModel, BlocklistAIController, BlocklistAIHistoryEvent, BlocklistAIInputEvent,
BlocklistAIInputModel, ResponseStreamId,
BlocklistAIInputModel, QueuedQueryEvent, QueuedQueryModel, ResponseStreamId,
};
use crate::ai::llms::LLMPreferences;
use crate::ai::AgentTip;
Expand Down Expand Up @@ -211,11 +211,12 @@ impl BlocklistAIStatusBar {
}
});
ctx.subscribe_to_model(&context_model, |_, _, event, ctx| {
if matches!(
event,
BlocklistAIContextEvent::PendingQueryStateUpdated
| BlocklistAIContextEvent::QueueNextPromptToggled
) {
if matches!(event, BlocklistAIContextEvent::PendingQueryStateUpdated) {
ctx.notify();
}
});
ctx.subscribe_to_model(&QueuedQueryModel::handle(ctx), |_, _, event, ctx| {
if matches!(event, QueuedQueryEvent::QueueNextPromptToggled { .. }) {
ctx.notify();
}
});
Expand Down Expand Up @@ -835,10 +836,8 @@ impl BlocklistAIStatusBar {
ButtonProps {
button_handle: &self.state_handles.queue_next_prompt_button,
keystroke: self.queue_next_prompt_keystroke.as_ref(),
is_active: self
.context_model
.as_ref(app)
.is_queue_next_prompt_enabled(),
is_active: QueuedQueryModel::as_ref(app)
.is_queue_next_prompt_enabled(conversation.id()),
},
),
stop_button: Some(ButtonProps {
Expand Down
17 changes: 0 additions & 17 deletions app/src/ai/blocklist/context_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ pub struct BlocklistAIContextModel {
/// When `AgentViewBlockContext` is enabled, completed user commands are tracked here
/// and automatically included as context with the next user query.
auto_attached_agent_view_user_block_ids: Vec<BlockId>,

/// When true, submitting a prompt while the agent is responding will queue it
/// instead of sending it immediately.
/// Persists across exchanges in the same conversation (like fast-forward).
queue_next_prompt_enabled: bool,
}

pub fn block_context_from_terminal_model(
Expand Down Expand Up @@ -291,7 +286,6 @@ impl BlocklistAIContextModel {
pending_inline_diff_hunk_attachments: Default::default(),
pending_document_id: None,
auto_attached_agent_view_user_block_ids: Vec::new(),
queue_next_prompt_enabled: false,
}
}

Expand Down Expand Up @@ -319,7 +313,6 @@ impl BlocklistAIContextModel {
pending_inline_diff_hunk_attachments: Default::default(),
pending_document_id: None,
auto_attached_agent_view_user_block_ids: Vec::new(),
queue_next_prompt_enabled: false,
}
}

Expand Down Expand Up @@ -851,15 +844,6 @@ impl BlocklistAIContextModel {
}
}

pub fn is_queue_next_prompt_enabled(&self) -> bool {
self.queue_next_prompt_enabled
}

pub fn toggle_queue_next_prompt(&mut self, ctx: &mut ModelContext<Self>) {
self.queue_next_prompt_enabled = !self.queue_next_prompt_enabled;
ctx.emit(BlocklistAIContextEvent::QueueNextPromptToggled);
}

pub fn toggle_pending_query_autoexecute(&mut self, ctx: &mut ModelContext<Self>) {
// When AgentView is enabled, the autoexecution toggle should apply to the active agent view
// conversation -- even when starting a new conversation, the agent view always has a conversation
Expand Down Expand Up @@ -1016,7 +1000,6 @@ pub enum BlocklistAIContextEvent {
},
/// Emitted whenever the value changes.
PendingQueryStateUpdated,
QueueNextPromptToggled,
}

impl Entity for BlocklistAIContextModel {
Expand Down
23 changes: 15 additions & 8 deletions app/src/ai/blocklist/history_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,28 +1692,32 @@ impl BlocklistAIHistoryModel {
let active_conversation_id = self
.active_conversation_for_terminal_view
.remove(&terminal_view_id);
if let Some(cleared_conversation_ids) = self
let mut cleared_conversation_ids: Vec<AIConversationId> = Vec::new();
if let Some(ids) = self
.live_conversation_ids_for_terminal_view
.remove(&terminal_view_id)
{
cleared_conversation_ids.extend(ids.iter().copied());
self.cleared_conversation_ids_for_terminal_view
.entry(terminal_view_id)
.and_modify(|existing| existing.extend(cleared_conversation_ids.clone()))
.or_insert(cleared_conversation_ids);
.and_modify(|existing| existing.extend(ids.clone()))
.or_insert(ids);
}
let cleared_conversation_ids = self
if let Some(ids) = self
.live_conversation_ids_for_terminal_view
.remove(&terminal_view_id);
if let Some(cleared_conversation_ids) = cleared_conversation_ids {
.remove(&terminal_view_id)
{
cleared_conversation_ids.extend(ids.iter().copied());
self.cleared_conversation_ids_for_terminal_view
.entry(terminal_view_id)
.and_modify(|existing| existing.extend(cleared_conversation_ids.clone()))
.or_insert(cleared_conversation_ids);
.and_modify(|existing| existing.extend(ids.clone()))
.or_insert(ids);
}
ctx.emit(
BlocklistAIHistoryEvent::ClearedConversationsInTerminalView {
terminal_view_id,
active_conversation_id,
cleared_conversation_ids,
},
);
}
Expand Down Expand Up @@ -2432,6 +2436,9 @@ pub enum BlocklistAIHistoryEvent {
ClearedConversationsInTerminalView {
terminal_view_id: EntityId,
active_conversation_id: Option<AIConversationId>,
/// All conversation ids that were live in `terminal_view_id` before the clear.
/// Subscribers (e.g. `QueuedQueryModel`) use this to drop per-conversation state.
cleared_conversation_ids: Vec<AIConversationId>,
},

UpdatedTodoList {
Expand Down
5 changes: 5 additions & 0 deletions app/src/ai/blocklist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub(crate) mod orchestration_event_streamer;
pub(crate) mod orchestration_events;
pub(crate) mod orchestration_topology;
mod passive_suggestions;
pub(crate) mod queued_query;
pub(super) use controller::RequestInput;
pub mod history_model;
pub mod inline_action;
Expand Down Expand Up @@ -69,6 +70,10 @@ pub use permissions::{BlocklistAIPermissions, CommandExecutionPermissionAllowedR
#[cfg_attr(target_family = "wasm", allow(unused))]
pub(crate) use persistence::PersistedAIInputType;
pub(crate) use persistence::{PersistedAIInput, SerializedBlockListItem};
pub(crate) use queued_query::{
AutofireAction, QueuedQuery, QueuedQueryEvent, QueuedQueryId, QueuedQueryModel,
QueuedQueryOrigin,
};
pub use suggestion_chip_view::*;
pub use view_util::error_color;
pub(crate) use view_util::{
Expand Down
Loading
Loading