parent
b3be6ccb0f
commit
c3574e6046
3 changed files with 20 additions and 20 deletions
|
@ -180,7 +180,7 @@ impl NativeAgent {
|
||||||
fs: Arc<dyn Fs>,
|
fs: Arc<dyn Fs>,
|
||||||
cx: &mut AsyncApp,
|
cx: &mut AsyncApp,
|
||||||
) -> Result<Entity<NativeAgent>> {
|
) -> Result<Entity<NativeAgent>> {
|
||||||
log::info!("Creating new NativeAgent");
|
log::debug!("Creating new NativeAgent");
|
||||||
|
|
||||||
let project_context = cx
|
let project_context = cx
|
||||||
.update(|cx| Self::build_project_context(&project, prompt_store.as_ref(), cx))?
|
.update(|cx| Self::build_project_context(&project, prompt_store.as_ref(), cx))?
|
||||||
|
@ -756,7 +756,7 @@ impl NativeAgentConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("Response stream completed");
|
log::debug!("Response stream completed");
|
||||||
anyhow::Ok(acp::PromptResponse {
|
anyhow::Ok(acp::PromptResponse {
|
||||||
stop_reason: acp::StopReason::EndTurn,
|
stop_reason: acp::StopReason::EndTurn,
|
||||||
})
|
})
|
||||||
|
@ -781,7 +781,7 @@ impl AgentModelSelector for NativeAgentConnection {
|
||||||
model_id: acp_thread::AgentModelId,
|
model_id: acp_thread::AgentModelId,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
log::info!("Setting model for session {}: {}", session_id, model_id);
|
log::debug!("Setting model for session {}: {}", session_id, model_id);
|
||||||
let Some(thread) = self
|
let Some(thread) = self
|
||||||
.0
|
.0
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
@ -852,7 +852,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Task<Result<Entity<acp_thread::AcpThread>>> {
|
) -> Task<Result<Entity<acp_thread::AcpThread>>> {
|
||||||
let agent = self.0.clone();
|
let agent = self.0.clone();
|
||||||
log::info!("Creating new thread for project at: {:?}", cwd);
|
log::debug!("Creating new thread for project at: {:?}", cwd);
|
||||||
|
|
||||||
cx.spawn(async move |cx| {
|
cx.spawn(async move |cx| {
|
||||||
log::debug!("Starting thread creation in async context");
|
log::debug!("Starting thread creation in async context");
|
||||||
|
@ -917,7 +917,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
log::info!("Converted prompt to message: {} chars", content.len());
|
log::debug!("Converted prompt to message: {} chars", content.len());
|
||||||
log::debug!("Message id: {:?}", id);
|
log::debug!("Message id: {:?}", id);
|
||||||
log::debug!("Message content: {:?}", content);
|
log::debug!("Message content: {:?}", content);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl AgentServer for NativeAgentServer {
|
||||||
project: &Entity<Project>,
|
project: &Entity<Project>,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Task<Result<Rc<dyn acp_thread::AgentConnection>>> {
|
) -> Task<Result<Rc<dyn acp_thread::AgentConnection>>> {
|
||||||
log::info!(
|
log::debug!(
|
||||||
"NativeAgentServer::connect called for path: {:?}",
|
"NativeAgentServer::connect called for path: {:?}",
|
||||||
_root_dir
|
_root_dir
|
||||||
);
|
);
|
||||||
|
@ -63,7 +63,7 @@ impl AgentServer for NativeAgentServer {
|
||||||
|
|
||||||
// Create the connection wrapper
|
// Create the connection wrapper
|
||||||
let connection = NativeAgentConnection(agent);
|
let connection = NativeAgentConnection(agent);
|
||||||
log::info!("NativeAgentServer connection established successfully");
|
log::debug!("NativeAgentServer connection established successfully");
|
||||||
|
|
||||||
Ok(Rc::new(connection) as Rc<dyn acp_thread::AgentConnection>)
|
Ok(Rc::new(connection) as Rc<dyn acp_thread::AgentConnection>)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ impl Thread {
|
||||||
self.messages.push(Message::Resume);
|
self.messages.push(Message::Resume);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
||||||
log::info!("Total messages in thread: {}", self.messages.len());
|
log::debug!("Total messages in thread: {}", self.messages.len());
|
||||||
self.run_turn(cx)
|
self.run_turn(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,7 +1106,7 @@ impl Thread {
|
||||||
{
|
{
|
||||||
let model = self.model().context("No language model configured")?;
|
let model = self.model().context("No language model configured")?;
|
||||||
|
|
||||||
log::info!("Thread::send called with model: {:?}", model.name());
|
log::info!("Thread::send called with model: {}", model.name().0);
|
||||||
self.advance_prompt_id();
|
self.advance_prompt_id();
|
||||||
|
|
||||||
let content = content.into_iter().map(Into::into).collect::<Vec<_>>();
|
let content = content.into_iter().map(Into::into).collect::<Vec<_>>();
|
||||||
|
@ -1116,7 +1116,7 @@ impl Thread {
|
||||||
.push(Message::User(UserMessage { id, content }));
|
.push(Message::User(UserMessage { id, content }));
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
||||||
log::info!("Total messages in thread: {}", self.messages.len());
|
log::debug!("Total messages in thread: {}", self.messages.len());
|
||||||
self.run_turn(cx)
|
self.run_turn(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,7 +1140,7 @@ impl Thread {
|
||||||
event_stream: event_stream.clone(),
|
event_stream: event_stream.clone(),
|
||||||
tools: self.enabled_tools(profile, &model, cx),
|
tools: self.enabled_tools(profile, &model, cx),
|
||||||
_task: cx.spawn(async move |this, cx| {
|
_task: cx.spawn(async move |this, cx| {
|
||||||
log::info!("Starting agent turn execution");
|
log::debug!("Starting agent turn execution");
|
||||||
|
|
||||||
let turn_result: Result<()> = async {
|
let turn_result: Result<()> = async {
|
||||||
let mut intent = CompletionIntent::UserPrompt;
|
let mut intent = CompletionIntent::UserPrompt;
|
||||||
|
@ -1165,7 +1165,7 @@ impl Thread {
|
||||||
log::info!("Tool use limit reached, completing turn");
|
log::info!("Tool use limit reached, completing turn");
|
||||||
return Err(language_model::ToolUseLimitReachedError.into());
|
return Err(language_model::ToolUseLimitReachedError.into());
|
||||||
} else if end_turn {
|
} else if end_turn {
|
||||||
log::info!("No tool uses found, completing turn");
|
log::debug!("No tool uses found, completing turn");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else {
|
} else {
|
||||||
intent = CompletionIntent::ToolResults;
|
intent = CompletionIntent::ToolResults;
|
||||||
|
@ -1177,7 +1177,7 @@ impl Thread {
|
||||||
|
|
||||||
match turn_result {
|
match turn_result {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
log::info!("Turn execution completed");
|
log::debug!("Turn execution completed");
|
||||||
event_stream.send_stop(acp::StopReason::EndTurn);
|
event_stream.send_stop(acp::StopReason::EndTurn);
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
@ -1227,7 +1227,7 @@ impl Thread {
|
||||||
attempt
|
attempt
|
||||||
);
|
);
|
||||||
|
|
||||||
log::info!(
|
log::debug!(
|
||||||
"Calling model.stream_completion, attempt {}",
|
"Calling model.stream_completion, attempt {}",
|
||||||
attempt.unwrap_or(0)
|
attempt.unwrap_or(0)
|
||||||
);
|
);
|
||||||
|
@ -1254,7 +1254,7 @@ impl Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(tool_result) = tool_results.next().await {
|
while let Some(tool_result) = tool_results.next().await {
|
||||||
log::info!("Tool finished {:?}", tool_result);
|
log::debug!("Tool finished {:?}", tool_result);
|
||||||
|
|
||||||
event_stream.update_tool_call_fields(
|
event_stream.update_tool_call_fields(
|
||||||
&tool_result.tool_use_id,
|
&tool_result.tool_use_id,
|
||||||
|
@ -1528,7 +1528,7 @@ impl Thread {
|
||||||
});
|
});
|
||||||
let supports_images = self.model().is_some_and(|model| model.supports_images());
|
let supports_images = self.model().is_some_and(|model| model.supports_images());
|
||||||
let tool_result = tool.run(tool_use.input, tool_event_stream, cx);
|
let tool_result = tool.run(tool_use.input, tool_event_stream, cx);
|
||||||
log::info!("Running tool {}", tool_use.name);
|
log::debug!("Running tool {}", tool_use.name);
|
||||||
Some(cx.foreground_executor().spawn(async move {
|
Some(cx.foreground_executor().spawn(async move {
|
||||||
let tool_result = tool_result.await.and_then(|output| {
|
let tool_result = tool_result.await.and_then(|output| {
|
||||||
if let LanguageModelToolResultContent::Image(_) = &output.llm_output
|
if let LanguageModelToolResultContent::Image(_) = &output.llm_output
|
||||||
|
@ -1640,7 +1640,7 @@ impl Thread {
|
||||||
summary.extend(lines.next());
|
summary.extend(lines.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("Setting summary: {}", summary);
|
log::debug!("Setting summary: {}", summary);
|
||||||
let summary = SharedString::from(summary);
|
let summary = SharedString::from(summary);
|
||||||
|
|
||||||
this.update(cx, |this, cx| {
|
this.update(cx, |this, cx| {
|
||||||
|
@ -1657,7 +1657,7 @@ impl Thread {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
log::info!(
|
log::debug!(
|
||||||
"Generating title with model: {:?}",
|
"Generating title with model: {:?}",
|
||||||
self.summarization_model.as_ref().map(|model| model.name())
|
self.summarization_model.as_ref().map(|model| model.name())
|
||||||
);
|
);
|
||||||
|
@ -1799,8 +1799,8 @@ impl Thread {
|
||||||
log::debug!("Completion mode: {:?}", self.completion_mode);
|
log::debug!("Completion mode: {:?}", self.completion_mode);
|
||||||
|
|
||||||
let messages = self.build_request_messages(cx);
|
let messages = self.build_request_messages(cx);
|
||||||
log::info!("Request will include {} messages", messages.len());
|
log::debug!("Request will include {} messages", messages.len());
|
||||||
log::info!("Request includes {} tools", tools.len());
|
log::debug!("Request includes {} tools", tools.len());
|
||||||
|
|
||||||
let request = LanguageModelRequest {
|
let request = LanguageModelRequest {
|
||||||
thread_id: Some(self.id.to_string()),
|
thread_id: Some(self.id.to_string()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue