vv_agent/app_server/protocol/
approval.rs1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4use ts_rs::TS;
5
6use crate::types::Metadata;
7
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, TS)]
9#[serde(rename_all = "camelCase")]
10pub struct ApprovalRequestParams {
11 pub request_id: String,
12 pub thread_id: String,
13 pub turn_id: String,
14 pub tool_call_id: String,
15 pub tool_name: String,
16 pub preview: String,
17 #[serde(default)]
18 pub arguments: Value,
19}
20
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
22#[serde(rename_all = "camelCase")]
23pub struct ApprovalResolveParams {
24 pub thread_id: String,
25 pub turn_id: String,
26 pub request_id: String,
27 pub decision: ApprovalDecision,
28 #[serde(default, skip_serializing_if = "String::is_empty")]
29 pub reason: String,
30 #[serde(default, skip_serializing_if = "Metadata::is_empty")]
31 pub metadata: Metadata,
32}
33
34#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
35#[serde(rename_all = "snake_case")]
36pub enum ApprovalDecision {
37 Allow,
38 AllowSession,
39 Deny,
40 Timeout,
41}
42
43impl ApprovalDecision {
44 pub const fn as_wire(self) -> &'static str {
45 match self {
46 Self::Allow => "allow",
47 Self::AllowSession => "allow_session",
48 Self::Deny => "deny",
49 Self::Timeout => "timeout",
50 }
51 }
52}