Significant progress. Performing cleanup now

This commit is contained in:
Ryan Ward
2026-05-11 14:31:02 -05:00
parent fe105e0369
commit 140da74f99
37 changed files with 843 additions and 1220 deletions
@@ -829,6 +829,9 @@ impl BlocklistAIActionExecutor {
}
fn should_autoexecute(&self, input: ExecuteActionInput, ctx: &mut ModelContext<Self>) -> bool {
if cfg!(feature = "bedrock_smoke_test") {
return true;
}
match input.action.action {
AIAgentActionType::RequestCommandOutput { .. }
| AIAgentActionType::WriteToLongRunningShellCommand { .. }
-21
View File
@@ -48,27 +48,6 @@ pub static ENTER_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE: LazyLock<Keystroke> = La
}
});
pub static ENTER_CLOUD_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE: LazyLock<Keystroke> =
LazyLock::new(|| {
cfg_if::cfg_if! {
if #[cfg(target_os = "macos")] {
Keystroke {
cmd: true,
alt: true,
key: "enter".to_owned(),
..Default::default()
}
} else {
Keystroke {
ctrl: true,
alt: true,
key: "enter".to_owned(),
..Default::default()
}
}
}
});
pub fn agent_view_bg_fill(app: &AppContext) -> Fill {
let appearance = Appearance::as_ref(app);
appearance.theme().surface_overlay_1()
@@ -13,7 +13,6 @@ use galaxyui::{
AppContext, Element, SingletonEntity,
};
use crate::ai::blocklist::agent_view::ENTER_CLOUD_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE;
use crate::{
ai::blocklist::agent_view::ENTER_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE,
cmd_or_ctrl_shift,
@@ -193,16 +192,9 @@ pub fn render_agent_shortcuts_view(
app,
));
// Use cloud keystroke (cmd+opt+enter) for cloud mode, regular keystroke (cmd+enter) otherwise.
let new_conversation_keystroke = if context.is_cloud_agent {
ENTER_CLOUD_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE.clone()
} else {
ENTER_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE.clone()
};
shortcuts.push(render_shortcut(
ShortcutProps {
keystroke: new_conversation_keystroke.clone(),
keystroke: ENTER_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE.clone(),
text: "start a new conversation".into(),
..Default::default()
},
@@ -25,7 +25,6 @@ use crate::{
agent_view::{
agent_view_bg_color, AgentViewController, AgentViewEntryOrigin,
ENTER_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE,
ENTER_CLOUD_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE,
},
history_model::{BlocklistAIHistoryEvent, BlocklistAIHistoryModel},
},
@@ -723,21 +722,6 @@ fn render_body(props: ZeroStateBodyProps<'_>, app: &AppContext) -> Vec<Box<dyn E
)]),
app,
),
render_standard_message(
Message::new(vec![MessageItem::clickable(
vec![
MessageItem::keystroke(
ENTER_CLOUD_AGENT_VIEW_NEW_CONVERSATION_KEYSTROKE.clone(),
),
MessageItem::text("start a new cloud agent conversation"),
],
|ctx| {
ctx.dispatch_typed_action(TerminalAction::EnterCloudAgentView);
},
state_handles.start_cloud_conversation.clone(),
)]),
app,
),
render_standard_message(
Message::new(vec![MessageItem::clickable(
vec![
+23
View File
@@ -1904,6 +1904,7 @@ impl BlocklistAIController {
active_tasks,
parent_agent_id,
agent_name,
bedrock_history,
) = {
let Some(conversation) = history_model
.as_ref(ctx)
@@ -1926,6 +1927,7 @@ impl BlocklistAIController {
active_tasks,
conversation.parent_agent_id().map(str::to_string),
conversation.agent_name().map(str::to_string),
conversation.bedrock_message_history().to_vec(),
)
};
@@ -1992,6 +1994,7 @@ impl BlocklistAIController {
);
request_params.parent_agent_id = parent_agent_id;
request_params.agent_name = agent_name;
request_params.bedrock_message_history = bedrock_history;
let server_conversation_token_for_identifiers =
conversation_data.server_conversation_token.clone();
@@ -2299,6 +2302,26 @@ impl BlocklistAIController {
did_input_contain_user_query,
ctx,
);
// After the stream finishes, persist the full message
// history (input + assistant response) from the Arc back
// into the conversation for the next request cycle.
let messages_sent_arc = response_stream.as_ref(ctx).bedrock_messages_sent().clone();
let new_history = messages_sent_arc.lock().ok().and_then(|sent| {
if sent.is_empty() { None } else { Some(sent.clone()) }
});
if let Some(new_history) = new_history {
let history_model = BlocklistAIHistoryModel::handle(ctx);
history_model.update(ctx, |history_model, _| {
if let Some(conversation) = history_model.conversation_mut(&conversation_id) {
*conversation.bedrock_message_history_mut() = new_history;
log::info!(
"[bedrock] Updated conversation bedrock history: {} messages",
conversation.bedrock_message_history().len()
);
}
});
}
}
warp_multi_agent_api::response_event::Type::ClientActions(actions) => {
let client_actions = actions.actions;
@@ -155,6 +155,10 @@ impl ResponseStream {
&self.id
}
pub fn bedrock_messages_sent(&self) -> &std::sync::Arc<std::sync::Mutex<Vec<crate::ai::bedrock::convert::ConversationMessage>>> {
&self.params.bedrock_messages_sent
}
/// Returns true if we should attempt to resume the conversation after the stream finishes.
pub fn should_resume_conversation_after_stream_finished(&self) -> bool {
self.should_resume_conversation_after_stream_finished