This commit is contained in:
Cole Miller 2025-08-25 09:33:38 -04:00
parent db949546cf
commit 073227ec41
6 changed files with 50 additions and 10 deletions

View file

@ -2639,7 +2639,11 @@ mod tests {
}
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
_session: &acp::SessionId,
_cx: &mut App,
) -> acp::PromptCapabilities {
acp::PromptCapabilities {
image: true,
audio: true,

View file

@ -38,7 +38,11 @@ pub trait AgentConnection {
cx: &mut App,
) -> Task<Result<acp::PromptResponse>>;
fn prompt_capabilities(&self) -> acp::PromptCapabilities;
fn prompt_capabilities(
&self,
session: &acp::SessionId,
cx: &mut App,
) -> acp::PromptCapabilities;
fn resume(
&self,
@ -348,7 +352,11 @@ mod test_support {
Task::ready(Ok(thread))
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
_session: &acp::SessionId,
_cx: &mut App,
) -> acp::PromptCapabilities {
acp::PromptCapabilities {
image: true,
audio: true,

View file

@ -26,7 +26,7 @@ use std::collections::HashMap;
use std::path::Path;
use std::rc::Rc;
use std::sync::Arc;
use util::ResultExt;
use util::{ResultExt, maybe};
const RULES_FILE_NAMES: [&str; 9] = [
".rules",
@ -925,9 +925,23 @@ impl acp_thread::AgentConnection for NativeAgentConnection {
})
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
session: &acp::SessionId,
cx: &mut App,
) -> acp::PromptCapabilities {
let model = maybe!({
let thread = self
.0
.read(cx)
.sessions
.get(session)
.map(|session| session.thread.clone())?;
thread.read(cx).model().cloned()
});
let image = model.map_or(true, |model| model.supports_images());
acp::PromptCapabilities {
image: true,
image,
audio: false,
embedded_context: true,
}

View file

@ -279,7 +279,12 @@ impl AgentConnection for AcpConnection {
})
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
_session: &acp::SessionId,
_cx: &mut App,
) -> acp::PromptCapabilities {
// TODO: support ACP sending prompt capabilities per session?
self.prompt_capabilities
}

View file

@ -319,7 +319,11 @@ impl AgentConnection for ClaudeAgentConnection {
cx.foreground_executor().spawn(async move { end_rx.await? })
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
_session: &acp::SessionId,
_cx: &mut App,
) -> acp::PromptCapabilities {
acp::PromptCapabilities {
image: true,
audio: false,

View file

@ -471,8 +471,9 @@ impl AcpThreadView {
Ok(thread) => {
let action_log = thread.read(cx).action_log().clone();
let session = thread.read(cx).session_id().clone();
this.prompt_capabilities
.set(connection.prompt_capabilities());
.set(connection.prompt_capabilities(&session, cx));
let count = thread.read(cx).entries().len();
this.list_state.splice(0..0, count);
@ -5316,7 +5317,11 @@ pub(crate) mod tests {
&[]
}
fn prompt_capabilities(&self) -> acp::PromptCapabilities {
fn prompt_capabilities(
&self,
_session: &acp::SessionId,
_cx: &mut App,
) -> acp::PromptCapabilities {
acp::PromptCapabilities {
image: true,
audio: true,