Claude approval refactor (#1080)

* WIP claude approvals

* Use canusetool

* Remove old exitplanmode approvals

* WIP approvals

* types

* Remove bloat

* Cleanup, exit on finish

* Approval messages, cleanup

* Cleanup

* Fix msg types

* Lint fmt

* Cleanup

* Send deny

* add missing timeout to hooks

* FIx timeout issue

* Cleanup

* Error handling, log writer bugs

* Remove deprecated approbal endpoints

* Remove tool matching strategies in favour of only id based matching

* remove register session, parse result at protocol level

* Remove circular peer, remove unneeded trait

* Types
This commit is contained in:
Alex Netsch
2025-10-28 15:36:47 +00:00
committed by GitHub
parent a70a7bfbad
commit e06dd1f6dc
13 changed files with 845 additions and 781 deletions

View File

@@ -4,15 +4,13 @@ use ts_rs::TS;
use uuid::Uuid;
pub const APPROVAL_TIMEOUT_SECONDS: i64 = 3600; // 1 hour
pub const EXIT_PLAN_MODE_TOOL_NAME: &str = "ExitPlanMode";
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
pub struct ApprovalRequest {
pub id: String,
pub tool_name: String,
pub tool_input: serde_json::Value,
pub session_id: String,
pub tool_call_id: Option<String>,
pub tool_call_id: String,
pub execution_process_id: Uuid,
pub created_at: DateTime<Utc>,
pub timeout_at: DateTime<Utc>,
@@ -25,7 +23,6 @@ impl ApprovalRequest {
id: Uuid::new_v4().to_string(),
tool_name: request.tool_name,
tool_input: request.tool_input,
session_id: request.session_id,
tool_call_id: request.tool_call_id,
execution_process_id,
created_at: now,
@@ -39,8 +36,7 @@ impl ApprovalRequest {
pub struct CreateApprovalRequest {
pub tool_name: String,
pub tool_input: serde_json::Value,
pub session_id: String,
pub tool_call_id: Option<String>,
pub tool_call_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
@@ -62,13 +58,3 @@ pub struct ApprovalResponse {
pub execution_process_id: Uuid,
pub status: ApprovalStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct ApprovalPendingInfo {
pub approval_id: String,
pub execution_process_id: Uuid,
pub tool_name: String,
pub requested_at: DateTime<Utc>,
pub timeout_at: DateTime<Utc>,
}