1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use crate::tools::ToolChunk;
/// Streaming events from `RuntimeRunner` and `ExecutionPlane`.
#[derive(Debug, Clone)]
pub enum RunEvent {
TextDelta(String),
ThinkingDelta(String),
ToolCall {
id: String,
name: String,
},
ToolDelta {
call_id: String,
name: String,
chunk: ToolChunk,
},
ToolSuspend {
call_id: String,
name: String,
suspension_id: String,
payload: Option<serde_json::Value>,
},
ToolResult {
call_id: String,
content: String,
is_error: bool,
is_fatal: bool,
error_kind: Option<deepstrike_core::types::message::ToolErrorKind>,
},
ToolArgumentRepaired {
call_id: String,
name: String,
original_arguments: String,
repaired_arguments: String,
},
/// Governance pipeline denied a tool call before execution.
/// Emitted alongside `ToolResult { is_error: true }` so callers can
/// distinguish policy denials from tool-side errors and write the correct
/// `SessionEvent::ToolDenied` audit record.
ToolDenied {
call_id: String,
tool_name: String,
reason: String,
},
/// Governance pipeline requires user approval (ask_user verdict).
/// Emitted before `ToolResult { is_error: true }` so runners can write
/// `SessionEvent::PermissionRequested` + `SessionEvent::PermissionResolved`.
PermissionRequest {
call_id: String,
tool_name: String,
arguments: String,
reason: String,
},
PermissionResolved {
call_id: String,
tool_name: String,
approved: bool,
responder: String,
reason: Option<String>,
},
Done {
iterations: u32,
total_tokens: u64,
status: String,
},
Error(String),
}