pub struct NotificationConverter { /* private fields */ }Expand description
Notification converter for transforming SDK messages to ACP notifications
Maintains a cache of tool uses to correlate tool_use blocks with their results.
Implementations§
Source§impl NotificationConverter
impl NotificationConverter
Sourcepub fn with_cwd(cwd: PathBuf) -> Self
pub fn with_cwd(cwd: PathBuf) -> Self
Create a new notification converter with working directory
§Arguments
cwd- The current working directory for computing relative paths
Sourcepub fn convert_message(
&self,
message: &Message,
session_id: &str,
) -> Vec<SessionNotification>
pub fn convert_message( &self, message: &Message, session_id: &str, ) -> Vec<SessionNotification>
Sourcepub fn get_tool_use(&self, tool_use_id: &str) -> Option<ToolUseEntry>
pub fn get_tool_use(&self, tool_use_id: &str) -> Option<ToolUseEntry>
Get a cached tool use entry
Sourcepub fn remove_tool_use(&self, tool_use_id: &str) -> Option<ToolUseEntry>
pub fn remove_tool_use(&self, tool_use_id: &str) -> Option<ToolUseEntry>
Remove a cached tool use entry
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all cached tool uses
Sourcepub fn build_terminal_content(terminal_id: impl Into<String>) -> ToolCallContent
pub fn build_terminal_content(terminal_id: impl Into<String>) -> ToolCallContent
Build Terminal content for embedding a terminal in tool result
This is used when a tool (like Bash) uses the Terminal API to execute commands.
The terminal_id is obtained from the terminal/create response.
§Arguments
terminal_id- The terminal ID from CreateTerminalResponse
§Returns
A ToolCallContent::Terminal that can be included in tool results
Sourcepub fn make_terminal_result(
&self,
session_id: &SessionId,
tool_use_id: &str,
terminal_id: impl Into<String>,
status: ToolCallStatus,
) -> SessionNotification
pub fn make_terminal_result( &self, session_id: &SessionId, tool_use_id: &str, terminal_id: impl Into<String>, status: ToolCallStatus, ) -> SessionNotification
Build a ToolCallUpdate notification with Terminal content
This is used when a Bash command is executed via the Terminal API. The client will embed the terminal output based on the terminal_id.
§Arguments
session_id- The session IDtool_use_id- The tool use ID for the Bash callterminal_id- The terminal ID from terminal/createstatus- The tool call status
§Returns
A SessionNotification with the ToolCallUpdate
Trait Implementations§
Source§impl Debug for NotificationConverter
impl Debug for NotificationConverter
Auto Trait Implementations§
impl Freeze for NotificationConverter
impl !RefUnwindSafe for NotificationConverter
impl Send for NotificationConverter
impl Sync for NotificationConverter
impl Unpin for NotificationConverter
impl UnwindSafe for NotificationConverter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request