Couple LongRunningCommandAgentInteractionState with block id (#27)

Roland Huang committed Jun 8, 2026 at 17:04 UTC b30fdd06379a3d073b398eabd106abed5b443aae
1 file changed +28 -1
src/common/ui_state.rs
+28 -1
@@ -1,6 +1,6 @@
1 use serde::{Deserialize, Serialize};
2
3 -use crate::common::ServerConversationToken;
3 +use crate::common::{BlockId, ServerConversationToken};
4
5 /// The active base model selection for agent mode.
6 /// This represents the UI state of which model is selected in the model picker chip.
@@ -112,6 +112,13 @@ pub enum LongRunningCommandAgentInteractionState {
112 InControl,
113 }
114
115 +/// How the agent is interacting with a specific long running command block.
116 +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
117 +pub struct LongRunningCommandAgentInteraction {
118 + pub block_id: BlockId,
119 + pub state: LongRunningCommandAgentInteractionState,
120 +}
121 +
122 /// The combined state container for universal developer input context.
123 /// This includes model selection, input mode, and selected conversation.
124 #[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, Eq)]
@@ -126,9 +133,15 @@ pub struct UniversalDeveloperInputContext {
133 pub selected_conversation: Option<SelectedConversation>,
134
135 /// How the agent is interacting with the current long running command (if at all).
136 + /// Deprecated in favor of long_running_command_agent_interaction.
137 + #[serde(default, skip_serializing_if = "Option::is_none")]
138 pub long_running_command_agent_interaction_state:
139 Option<LongRunningCommandAgentInteractionState>,
140
141 + /// How the agent is interacting with a specific long running command block, if any.
142 + #[serde(default, skip_serializing_if = "Option::is_none")]
143 + pub long_running_command_agent_interaction: Option<LongRunningCommandAgentInteraction>,
144 +
145 /// Whether auto-approve is enabled for agent actions.
146 pub auto_approve_agent_actions: Option<bool>,
147
@@ -154,6 +167,10 @@ pub struct UniversalDeveloperInputContextUpdate {
167 pub long_running_command_agent_interaction_state:
168 Option<LongRunningCommandAgentInteractionState>,
169
170 + /// How the agent is interacting with a specific long running command block, if any.
171 + #[serde(skip_serializing_if = "Option::is_none")]
172 + pub long_running_command_agent_interaction: Option<LongRunningCommandAgentInteraction>,
173 +
174 #[serde(skip_serializing_if = "Option::is_none")]
175 pub auto_approve_agent_actions: Option<bool>,
176
@@ -173,6 +190,7 @@ impl UniversalDeveloperInputContextUpdate {
190 auto_approve_agent_actions: updated_auto_approve_agent_actions,
191 long_running_command_agent_interaction_state:
192 updated_long_running_command_agent_interaction_state,
193 + long_running_command_agent_interaction: updated_long_running_command_agent_interaction,
194 cli_agent_session: updated_cli_agent_session,
195 } = self;
196 let UniversalDeveloperInputContext {
@@ -182,6 +200,7 @@ impl UniversalDeveloperInputContextUpdate {
200 auto_approve_agent_actions: cached_auto_approve_agent_actions,
201 long_running_command_agent_interaction_state:
202 cached_long_running_command_agent_interaction_state,
203 + long_running_command_agent_interaction: cached_long_running_command_agent_interaction,
204 cli_agent_session: cached_cli_agent_session,
205 } = cached;
206
@@ -198,6 +217,9 @@ impl UniversalDeveloperInputContextUpdate {
217 || (updated_long_running_command_agent_interaction_state.is_some()
218 && updated_long_running_command_agent_interaction_state
219 != cached_long_running_command_agent_interaction_state)
220 + || (updated_long_running_command_agent_interaction.is_some()
221 + && updated_long_running_command_agent_interaction.as_ref()
222 + != cached_long_running_command_agent_interaction.as_ref())
223 || (updated_cli_agent_session.is_some()
224 && updated_cli_agent_session.as_ref() != Some(cached_cli_agent_session))
225 }
@@ -214,6 +236,7 @@ impl UniversalDeveloperInputContextUpdate {
236 auto_approve_agent_actions: updated_auto_approve_agent_actions,
237 long_running_command_agent_interaction_state:
238 updated_long_running_command_agent_interaction_state,
239 + long_running_command_agent_interaction: updated_long_running_command_agent_interaction,
240 cli_agent_session: updated_cli_agent_session,
241 } = self;
242 let UniversalDeveloperInputContext {
@@ -223,6 +246,7 @@ impl UniversalDeveloperInputContextUpdate {
246 auto_approve_agent_actions: current_auto_approve_agent_actions,
247 long_running_command_agent_interaction_state:
248 current_long_running_command_agent_interaction_state,
249 + long_running_command_agent_interaction: current_long_running_command_agent_interaction,
250 cli_agent_session: current_cli_agent_session,
251 } = current;
252
@@ -235,6 +259,8 @@ impl UniversalDeveloperInputContextUpdate {
259 long_running_command_agent_interaction_state:
260 updated_long_running_command_agent_interaction_state
261 .or(current_long_running_command_agent_interaction_state),
262 + long_running_command_agent_interaction: updated_long_running_command_agent_interaction
263 + .or(current_long_running_command_agent_interaction),
264 cli_agent_session: updated_cli_agent_session.unwrap_or(current_cli_agent_session),
265 }
266 }
@@ -249,6 +275,7 @@ impl From<UniversalDeveloperInputContext> for UniversalDeveloperInputContextUpda
275 auto_approve_agent_actions: context.auto_approve_agent_actions,
276 long_running_command_agent_interaction_state: context
277 .long_running_command_agent_interaction_state,
278 + long_running_command_agent_interaction: context.long_running_command_agent_interaction,
279 cli_agent_session: Some(context.cli_agent_session),
280 }
281 }