infinity_agent_cli/display.rs
1//! The terminal's display-event vocabulary.
2//!
3//! [`DisplayEvent`] is what the TUI renders: [`daemon_client`](crate::daemon_client)
4//! converts each incoming [`DaemonMessage`](infinity_protocol::DaemonMessage)
5//! into one of these, and [`terminal::run`](crate::terminal::run) turns them
6//! into viewport updates.
7
8/// One renderable event in a conversation's display stream.
9pub enum DisplayEvent {
10 StartOutput,
11 TextChunk {
12 chunk: String,
13 },
14 ToolCall {
15 name: String,
16 args: serde_json::Value,
17 display_as: Option<String>,
18 },
19 ToolResult {
20 /// Prioritized display segments. The renderer uses the first type it
21 /// supports; the raw tool output is always included as a trailing
22 /// `Text` segment as a fallback.
23 segments: Vec<rap_protocol::DisplaySegment>,
24 },
25 Info(String),
26 /// A completion round finished. Carries the usage the daemon reported,
27 /// when any: a usage-less `ResponseDone` (e.g. the marker appended after
28 /// a session replay) must not reset the context indicator.
29 ResponseDone(Option<infinity_provider_protocol::Usage>),
30 UserInput(String),
31 SubscriptionEvent {
32 name: String,
33 text: String,
34 },
35 OAuthRequired {
36 auth_url: String,
37 },
38 UserChoiceRequired {
39 id: infinity_protocol::ChoiceId,
40 prompt: String,
41 choices: Vec<String>,
42 default: usize,
43 response_url: String,
44 },
45 UserChoiceComplete {
46 choice_id: infinity_protocol::ChoiceId,
47 },
48 ThinkingStart,
49 ThinkingEnd,
50 ThinkingChunk {
51 chunk: String,
52 },
53 CompactionApplied,
54}