Update AI agent, settings, and terminal modules
- Update AI agent conversation, task, and prompt builder - Add notebooks execution module for blocklist actions - Update Bedrock and OpenAI response translators - Refactor settings modules across multiple subsystems - Update terminal settings and window settings - Update drive settings and search command settings
This commit is contained in:
@@ -613,12 +613,21 @@ impl ConvertAPIToolCallToAIAgentAction for api::message::ToolCall {
|
||||
return Err(ToolToAIAgentActionError::MissingTool);
|
||||
};
|
||||
|
||||
// Detect notebook tool name encoded in tool_call_id prefix.
|
||||
let (effective_tool_call_id, tool_name) =
|
||||
if let Some(stripped) = self.tool_call_id.strip_prefix("notebook::") {
|
||||
(stripped.to_string(), Some("notebook".to_string()))
|
||||
} else {
|
||||
(self.tool_call_id.clone(), None)
|
||||
};
|
||||
|
||||
let create_standard_action = |action: AIAgentActionType| {
|
||||
Ok(MaybeAIAgentAction::Action(AIAgentAction {
|
||||
id: self.tool_call_id.clone().into(),
|
||||
id: effective_tool_call_id.clone().into(),
|
||||
task_id: params.task_id.clone(),
|
||||
action,
|
||||
requires_result: true,
|
||||
tool_name: tool_name.clone(),
|
||||
}))
|
||||
};
|
||||
|
||||
|
||||
@@ -2109,7 +2109,12 @@ impl AIConversation {
|
||||
let streaming_exchange_ids: Vec<_> = self
|
||||
.task_store
|
||||
.all_exchanges()
|
||||
.filter(|exchange| matches!(exchange.output_status, AIAgentOutputStatus::Streaming { .. }))
|
||||
.filter(|exchange| {
|
||||
matches!(
|
||||
exchange.output_status,
|
||||
AIAgentOutputStatus::Streaming { .. }
|
||||
)
|
||||
})
|
||||
.map(|exchange| exchange.id)
|
||||
.collect();
|
||||
|
||||
|
||||
@@ -845,6 +845,10 @@ pub struct AIAgentAction {
|
||||
///
|
||||
/// If this is `true`, a corresponding result _must_ be included in the next query to the AI.
|
||||
pub requires_result: bool,
|
||||
|
||||
/// The original tool name as sent by the model (e.g. "create_plan", "create_notebook").
|
||||
/// Used to distinguish between tools that share the same `AIAgentActionType` variant.
|
||||
pub tool_name: Option<String>,
|
||||
}
|
||||
|
||||
impl Display for AIAgentAction {
|
||||
|
||||
@@ -138,7 +138,8 @@ mod optimistic {
|
||||
#[derive(Debug, Clone)]
|
||||
pub(super) enum Task {
|
||||
Root,
|
||||
#[allow(dead_code)] // Used in the server-mode path; Bedrock direct creates Server tasks directly
|
||||
#[allow(dead_code)]
|
||||
// Used in the server-mode path; Bedrock direct creates Server tasks directly
|
||||
CLIAgent(CLIAgentSubtask),
|
||||
}
|
||||
|
||||
@@ -185,7 +186,10 @@ impl Task {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn new_optimistic_cli_agent_subtask(block_id: BlockId, parent_task_id: Option<String>) -> Self {
|
||||
pub(super) fn new_optimistic_cli_agent_subtask(
|
||||
block_id: BlockId,
|
||||
parent_task_id: Option<String>,
|
||||
) -> Self {
|
||||
let task_id = Uuid::new_v4().to_string();
|
||||
Self {
|
||||
id: TaskId::new(task_id.clone()),
|
||||
|
||||
@@ -115,9 +115,9 @@ impl ToolExt for api::message::tool_call::Tool {
|
||||
Tool::ReadMcpResource(_) => "read_mcp_resource",
|
||||
Tool::CallMcpTool(_) => "call_mcp_tool",
|
||||
Tool::WriteToLongRunningShellCommand(_) => "write_to_lrc",
|
||||
Tool::ReadDocuments(_) => "read_documents",
|
||||
Tool::EditDocuments(_) => "edit_documents",
|
||||
Tool::CreateDocuments(_) => "create_documents",
|
||||
Tool::ReadDocuments(_) => "read_plan",
|
||||
Tool::EditDocuments(_) => "edit_plan",
|
||||
Tool::CreateDocuments(_) => "create_plan",
|
||||
Tool::ReadShellCommandOutput(_) => "read_shell_command_output",
|
||||
Tool::UseComputer(_) => "use_computer",
|
||||
Tool::RequestComputerUse(_) => "request_computer_use",
|
||||
|
||||
Reference in New Issue
Block a user