-
Notifications
You must be signed in to change notification settings - Fork 5
Couple LongRunningCommandAgentInteractionState with block id #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use crate::common::ServerConversationToken; | ||
| use crate::common::{BlockId, ServerConversationToken}; | ||
|
|
||
| /// The active base model selection for agent mode. | ||
| /// This represents the UI state of which model is selected in the model picker chip. | ||
|
|
@@ -112,6 +112,13 @@ pub enum LongRunningCommandAgentInteractionState { | |
| InControl, | ||
| } | ||
|
|
||
| /// How the agent is interacting with a specific long running command block. | ||
| #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] | ||
| pub struct LongRunningCommandAgentInteraction { | ||
| pub block_id: BlockId, | ||
| pub state: LongRunningCommandAgentInteractionState, | ||
| } | ||
|
|
||
| /// The combined state container for universal developer input context. | ||
| /// This includes model selection, input mode, and selected conversation. | ||
| #[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, Eq)] | ||
|
|
@@ -126,9 +133,15 @@ pub struct UniversalDeveloperInputContext { | |
| pub selected_conversation: Option<SelectedConversation>, | ||
|
|
||
| /// How the agent is interacting with the current long running command (if at all). | ||
| /// Deprecated in favor of long_running_command_agent_interaction. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub long_running_command_agent_interaction_state: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should also skip serializing if this is None, no?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea might as well add it now. Technically just need |
||
| Option<LongRunningCommandAgentInteractionState>, | ||
|
|
||
| /// How the agent is interacting with a specific long running command block, if any. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub long_running_command_agent_interaction: Option<LongRunningCommandAgentInteraction>, | ||
|
|
||
| /// Whether auto-approve is enabled for agent actions. | ||
| pub auto_approve_agent_actions: Option<bool>, | ||
|
|
||
|
|
@@ -154,6 +167,10 @@ pub struct UniversalDeveloperInputContextUpdate { | |
| pub long_running_command_agent_interaction_state: | ||
| Option<LongRunningCommandAgentInteractionState>, | ||
|
|
||
| /// How the agent is interacting with a specific long running command block, if any. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub long_running_command_agent_interaction: Option<LongRunningCommandAgentInteraction>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub auto_approve_agent_actions: Option<bool>, | ||
|
|
||
|
|
@@ -173,6 +190,7 @@ impl UniversalDeveloperInputContextUpdate { | |
| auto_approve_agent_actions: updated_auto_approve_agent_actions, | ||
| long_running_command_agent_interaction_state: | ||
| updated_long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction: updated_long_running_command_agent_interaction, | ||
| cli_agent_session: updated_cli_agent_session, | ||
| } = self; | ||
| let UniversalDeveloperInputContext { | ||
|
|
@@ -182,6 +200,7 @@ impl UniversalDeveloperInputContextUpdate { | |
| auto_approve_agent_actions: cached_auto_approve_agent_actions, | ||
| long_running_command_agent_interaction_state: | ||
| cached_long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction: cached_long_running_command_agent_interaction, | ||
| cli_agent_session: cached_cli_agent_session, | ||
| } = cached; | ||
|
|
||
|
|
@@ -198,6 +217,9 @@ impl UniversalDeveloperInputContextUpdate { | |
| || (updated_long_running_command_agent_interaction_state.is_some() | ||
| && updated_long_running_command_agent_interaction_state | ||
| != cached_long_running_command_agent_interaction_state) | ||
| || (updated_long_running_command_agent_interaction.is_some() | ||
| && updated_long_running_command_agent_interaction.as_ref() | ||
| != cached_long_running_command_agent_interaction.as_ref()) | ||
| || (updated_cli_agent_session.is_some() | ||
| && updated_cli_agent_session.as_ref() != Some(cached_cli_agent_session)) | ||
| } | ||
|
|
@@ -214,6 +236,7 @@ impl UniversalDeveloperInputContextUpdate { | |
| auto_approve_agent_actions: updated_auto_approve_agent_actions, | ||
| long_running_command_agent_interaction_state: | ||
| updated_long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction: updated_long_running_command_agent_interaction, | ||
| cli_agent_session: updated_cli_agent_session, | ||
| } = self; | ||
| let UniversalDeveloperInputContext { | ||
|
|
@@ -223,6 +246,7 @@ impl UniversalDeveloperInputContextUpdate { | |
| auto_approve_agent_actions: current_auto_approve_agent_actions, | ||
| long_running_command_agent_interaction_state: | ||
| current_long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction: current_long_running_command_agent_interaction, | ||
| cli_agent_session: current_cli_agent_session, | ||
| } = current; | ||
|
|
||
|
|
@@ -235,6 +259,8 @@ impl UniversalDeveloperInputContextUpdate { | |
| long_running_command_agent_interaction_state: | ||
| updated_long_running_command_agent_interaction_state | ||
| .or(current_long_running_command_agent_interaction_state), | ||
| long_running_command_agent_interaction: updated_long_running_command_agent_interaction | ||
| .or(current_long_running_command_agent_interaction), | ||
| cli_agent_session: updated_cli_agent_session.unwrap_or(current_cli_agent_session), | ||
| } | ||
| } | ||
|
|
@@ -249,6 +275,7 @@ impl From<UniversalDeveloperInputContext> for UniversalDeveloperInputContextUpda | |
| auto_approve_agent_actions: context.auto_approve_agent_actions, | ||
| long_running_command_agent_interaction_state: context | ||
| .long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction: context.long_running_command_agent_interaction, | ||
| cli_agent_session: Some(context.cli_agent_session), | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding a separate type and having to deal with migrating from one LRC type to another, I actually think it could be ok to just add
active_block_idas a sibling field? Is that enough to determine if the update should be applied (wouldn't block_id as populated by the sharer always be the active block ID)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then you don't have to deal with a semantic either/or migration for the new field and old field, can just say there is a new field only supported by newer clients?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The complication with that is that
UniversalDeveloperInputContextis a merging of several sources of writes to a shared cache. If we put active block id on this, it would either need to be populated on every source (and probably all of these updates should be guarded on matching block id), or we say it's specifically for the LRC update which is weirder imo.I think coupling to LRC update is what I want. For this update we need the block id to come from the source of updating LRC state, not the active block id at time of sending
UniversalDeveloperInputContextThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see