Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/apps/cli/src/chat_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ impl ChatState {
tool_id,
tool_name,
params,
..
} => {
self.update_tool(tool_id, |tool| {
tool.status = ToolDisplayStatus::ConfirmationNeeded;
Expand Down
16 changes: 16 additions & 0 deletions src/crates/assembly/core/src/agentic/core/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ pub enum ToolExecutionState {
execution_ms: Option<u64>,
},

/// Rejected by user before execution
Rejected {
reason: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
duration_ms: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
queue_wait_ms: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
preflight_ms: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
confirmation_wait_ms: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
execution_ms: Option<u64>,
},

/// Cancelled
Cancelled {
reason: String,
Expand Down Expand Up @@ -119,6 +134,7 @@ pub struct ToolStats {
pub awaiting_confirmation: usize,
pub completed: usize,
pub failed: usize,
pub rejected: usize,
pub cancelled: usize,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,6 @@ Output is only what was produced during this tool call's wait window."#
false
}

fn needs_permissions(&self, _input: Option<&Value>) -> bool {
true
}

fn manages_own_execution_timeout(&self) -> bool {
true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) fn tool_task_state_kind(state: &ToolExecutionState) -> ToolTaskStateK
ToolExecutionState::AwaitingConfirmation { .. } => ToolTaskStateKind::AwaitingConfirmation,
ToolExecutionState::Completed { .. } => ToolTaskStateKind::Completed,
ToolExecutionState::Failed { .. } => ToolTaskStateKind::Failed,
ToolExecutionState::Rejected { .. } => ToolTaskStateKind::Rejected,
ToolExecutionState::Cancelled { .. } => ToolTaskStateKind::Cancelled,
}
}
Expand Down Expand Up @@ -159,9 +160,17 @@ impl ToolStateManager {
} => ToolStateEventKind::Streaming {
chunks_received: *chunks_received,
},
ToolExecutionState::AwaitingConfirmation { params, .. } => {
ToolExecutionState::AwaitingConfirmation { params, timeout_at } => {
let confirmation_timeout_secs = task.options.confirmation_timeout_secs.filter(|seconds| *seconds > 0);
ToolStateEventKind::AwaitingConfirmation {
params: params.clone(),
timeout_at: confirmation_timeout_secs.map(|_| {
timeout_at
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_millis()
.min(u128::from(u64::MAX)) as u64
}),
}
}
ToolExecutionState::Completed {
Expand Down Expand Up @@ -202,6 +211,7 @@ impl ToolStateManager {
confirmation_wait_ms: *confirmation_wait_ms,
execution_ms: *execution_ms,
},
ToolExecutionState::Rejected { .. } => ToolStateEventKind::Rejected,
ToolExecutionState::Cancelled {
reason,
duration_ms,
Expand Down Expand Up @@ -250,6 +260,7 @@ impl ToolStateManager {
awaiting_confirmation: counts.awaiting_confirmation,
completed: counts.completed,
failed: counts.failed,
rejected: counts.rejected,
cancelled: counts.cancelled,
}
}
Expand Down Expand Up @@ -367,5 +378,6 @@ pub struct ToolStats {
pub awaiting_confirmation: usize,
pub completed: usize,
pub failed: usize,
pub rejected: usize,
pub cancelled: usize,
}
Loading
Loading