ACP work
This commit is contained in:
@@ -21,11 +21,12 @@ use crate::ai::agent::task::TaskId;
|
||||
use crate::ai::agent::todos::AIAgentTodoList;
|
||||
use crate::ai::agent::util::parse_markdown_into_text_and_code_sections;
|
||||
use crate::ai::agent::{
|
||||
AIAgentAction, AIAgentActionType, AIAgentAttachment, AIAgentCitation, AIAgentInput,
|
||||
AIAgentOutputMessage, AIAgentText, AIAgentTodo, ArtifactCreatedData, CloneRepositoryURL,
|
||||
MessageId, RunAgentsAgentRunConfig, RunAgentsExecutionMode, RunAgentsRequest,
|
||||
StartAgentExecutionMode, SubagentCall, SubagentType, SuggestedAgentModeWorkflow, SuggestedRule,
|
||||
Suggestions, SummarizationType, TodoOperation, UserQueryMode, WebFetchStatus, WebSearchStatus,
|
||||
runtime_activity, AIAgentAction, AIAgentActionType, AIAgentAttachment, AIAgentCitation,
|
||||
AIAgentInput, AIAgentOutputMessage, AIAgentText, AIAgentTodo, ArtifactCreatedData,
|
||||
CloneRepositoryURL, MessageId, RunAgentsAgentRunConfig, RunAgentsExecutionMode,
|
||||
RunAgentsRequest, StartAgentExecutionMode, SubagentCall, SubagentType,
|
||||
SuggestedAgentModeWorkflow, SuggestedRule, Suggestions, SummarizationType, TodoOperation,
|
||||
UserQueryMode, WebFetchStatus, WebSearchStatus,
|
||||
};
|
||||
use crate::ai::artifact_download::sanitized_basename;
|
||||
use crate::ai::document::ai_document_model::{AIDocumentId, AIDocumentVersion};
|
||||
@@ -272,10 +273,18 @@ impl ConvertAPIMessageToClientOutputMessage for api::Message {
|
||||
.collect::<Result<Vec<AIAgentCitation>, UnknownCitationTypeError>>()?;
|
||||
|
||||
match message {
|
||||
api::message::Message::AgentOutput(output) => Ok(MaybeAIAgentOutputMessage::Message(
|
||||
AIAgentOutputMessage::text(MessageId::new(self.id), output.into())
|
||||
.with_citations(citations),
|
||||
)),
|
||||
api::message::Message::AgentOutput(output) => {
|
||||
let message = if let Some(activity) =
|
||||
runtime_activity::decode(&self.server_message_data)
|
||||
{
|
||||
AIAgentOutputMessage::runtime_activity(MessageId::new(self.id), activity)
|
||||
} else {
|
||||
AIAgentOutputMessage::text(MessageId::new(self.id), output.into())
|
||||
};
|
||||
Ok(MaybeAIAgentOutputMessage::Message(
|
||||
message.with_citations(citations),
|
||||
))
|
||||
}
|
||||
api::message::Message::AgentReasoning(reasoning) => {
|
||||
let duration = reasoning
|
||||
.finished_duration
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
|
||||
use ai::agent::action::AskUserQuestionType;
|
||||
use ai::skills::{SkillPathOrigin, SkillReference};
|
||||
use galaxy_agent_core::{RuntimeActivity, RuntimeActivityStatus};
|
||||
use warp_multi_agent_api as api;
|
||||
use warp_util::local_or_remote_path::LocalOrRemotePath;
|
||||
|
||||
@@ -11,7 +12,8 @@ use super::{
|
||||
};
|
||||
use crate::ai::agent::task::TaskId;
|
||||
use crate::ai::agent::{
|
||||
AIAgentActionType, AIAgentOutputMessageType, LifecycleEventType, StartAgentExecutionMode,
|
||||
runtime_activity, AIAgentActionType, AIAgentOutputMessageType, LifecycleEventType,
|
||||
StartAgentExecutionMode,
|
||||
};
|
||||
|
||||
fn start_agent_tool_call_message(
|
||||
@@ -665,3 +667,45 @@ fn transfer_control_tool_call_converts_to_action_message() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn structured_runtime_activity_converts_to_display_only_output() {
|
||||
let activity = RuntimeActivity {
|
||||
id: "tool-1".to_owned(),
|
||||
title: "List directories".to_owned(),
|
||||
status: Some(RuntimeActivityStatus::Completed),
|
||||
output: Some("payments\nrecords_v2".to_owned()),
|
||||
};
|
||||
let task_id = TaskId::new("task".to_owned());
|
||||
let message = api::Message {
|
||||
fetched_memories: Vec::new(),
|
||||
id: "message".to_owned(),
|
||||
task_id: "task".to_owned(),
|
||||
server_message_data: runtime_activity::encode(&activity).expect("metadata"),
|
||||
citations: Vec::new(),
|
||||
message: Some(api::message::Message::AgentOutput(
|
||||
api::message::AgentOutput {
|
||||
text: "fallback text".to_owned(),
|
||||
},
|
||||
)),
|
||||
request_id: "request".to_owned(),
|
||||
timestamp: None,
|
||||
};
|
||||
|
||||
let converted = message
|
||||
.to_client_output_message(ConversionParams {
|
||||
task_id: &task_id,
|
||||
current_todo_list: None,
|
||||
active_code_review: None,
|
||||
skill_path_origin: &SkillPathOrigin::Local,
|
||||
})
|
||||
.expect("conversion");
|
||||
|
||||
let MaybeAIAgentOutputMessage::Message(output) = converted else {
|
||||
panic!("expected display output");
|
||||
};
|
||||
assert_eq!(
|
||||
output.message,
|
||||
AIAgentOutputMessageType::RuntimeActivity(activity)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ pub async fn generate_multi_agent_output(
|
||||
let err = Arc::new(crate::server::server_api::AIApiError::Stream {
|
||||
stream_type: "none",
|
||||
source: anyhow::anyhow!(
|
||||
"No AI provider configured. Enable Bedrock or OpenAI/LiteLLM in settings."
|
||||
"No AI runtime configured. Enable an agent runtime or model provider in settings."
|
||||
),
|
||||
});
|
||||
let (tx, rx) = async_channel::unbounded();
|
||||
|
||||
Reference in New Issue
Block a user