synaps_cli/runtime/
types.rs1use serde_json::Value;
2use serde::Deserialize;
3
4#[derive(Debug, Clone)]
6pub enum StreamEvent {
7 Llm(LlmEvent),
8 Session(SessionEvent),
9 Agent(AgentEvent),
10}
11
12#[derive(Debug, Clone)]
13pub enum LlmEvent {
14 Thinking(String),
15 Text(String),
16 ToolUseStart {
22 tool_name: String,
23 tool_id: String,
24 },
25 ToolUseDelta {
29 tool_id: String,
30 delta: String,
31 },
32 ToolUse {
33 tool_name: String,
34 tool_id: String,
35 input: Value,
36 },
37 ToolResult {
38 tool_id: String,
39 result: String,
40 },
41 ToolResultDelta {
42 tool_id: String,
43 delta: String,
44 },
45}
46
47#[derive(Debug, Clone)]
48pub enum SessionEvent {
49 MessageHistory(Vec<Value>),
50 Usage {
51 input_tokens: u64,
52 output_tokens: u64,
53 cache_read_input_tokens: u64,
54 cache_creation_input_tokens: u64,
55 model: Option<String>,
56 },
57 Done,
58 Error(String),
59}
60
61#[derive(Debug, Clone)]
62pub enum AgentEvent {
63 SubagentStart {
64 subagent_id: u64,
65 agent_name: String,
66 task_preview: String,
67 },
68 SubagentUpdate {
69 subagent_id: u64,
70 agent_name: String,
71 status: String,
72 },
73 SubagentDone {
74 subagent_id: u64,
75 agent_name: String,
76 result_preview: String,
77 duration_secs: f64,
78 },
79 SteeringDelivered {
80 message: String,
81 },
82}
83
84#[derive(Debug, Clone)]
87pub(super) struct AuthState {
88 pub(super) auth_token: String,
89 pub(super) auth_type: String,
90 pub(super) refresh_token: Option<String>,
91 pub(super) token_expires: Option<u64>,
92}
93
94#[derive(Debug, Deserialize)]
95pub(super) struct PiAuth {
96 pub(super) anthropic: AnthropicAuth,
97}
98
99#[allow(dead_code)]
100#[derive(Debug, Deserialize)]
101pub(super) struct AnthropicAuth {
102 #[serde(rename = "type")]
103 pub(super) auth_type: String,
104 pub(super) refresh: Option<String>,
105 pub(super) access: Option<String>,
106 pub(super) expires: Option<u64>,
107 pub(super) key: Option<String>,
108}