(self, os: &Os, session: &mut ChatSession)
| 48 | } |
| 49 | |
| 50 | pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> { |
| 51 | // Check if tangent mode is enabled |
| 52 | if !ExperimentManager::is_enabled(os, ExperimentName::TangentMode) { |
| 53 | execute!( |
| 54 | session.stderr, |
| 55 | StyledText::error_fg(), |
| 56 | style::Print("\nTangent mode is disabled. Enable it with: q settings chat.enableTangentMode true\n"), |
| 57 | StyledText::reset(), |
| 58 | )?; |
| 59 | return Ok(ChatState::PromptUser { |
| 60 | skip_printing_tools: true, |
| 61 | }); |
| 62 | } |
| 63 | |
| 64 | match self.subcommand { |
| 65 | Some(TangentSubcommand::Tail) => { |
| 66 | // Check if checkpoint is enabled |
| 67 | if ExperimentManager::is_enabled(os, ExperimentName::Checkpoint) { |
| 68 | execute!( |
| 69 | session.stderr, |
| 70 | StyledText::warning_fg(), |
| 71 | style::Print( |
| 72 | "⚠️ Checkpoint is disabled while in tangent mode. Please exit tangent mode if you want to use checkpoint.\n" |
| 73 | ), |
| 74 | StyledText::reset(), |
| 75 | )?; |
| 76 | } |
| 77 | if session.conversation.is_in_tangent_mode() { |
| 78 | let duration_seconds = session.conversation.get_tangent_duration_seconds().unwrap_or(0); |
| 79 | session.conversation.exit_tangent_mode_with_tail(); |
| 80 | Self::send_tangent_telemetry(os, session, duration_seconds).await; |
| 81 | |
| 82 | execute!( |
| 83 | session.stderr, |
| 84 | StyledText::secondary_fg(), |
| 85 | style::Print("Restored conversation from checkpoint ("), |
| 86 | StyledText::warning_fg(), |
| 87 | style::Print("↯"), |
| 88 | StyledText::secondary_fg(), |
| 89 | style::Print(") with last conversation entry preserved.\n"), |
| 90 | StyledText::reset(), |
| 91 | )?; |
| 92 | } else { |
| 93 | execute!( |
| 94 | session.stderr, |
| 95 | StyledText::error_fg(), |
| 96 | style::Print("You need to be in tangent mode to use tail.\n"), |
| 97 | StyledText::reset(), |
| 98 | )?; |
| 99 | } |
| 100 | }, |
| 101 | None => { |
| 102 | if session.conversation.is_in_tangent_mode() { |
| 103 | let duration_seconds = session.conversation.get_tangent_duration_seconds().unwrap_or(0); |
| 104 | session.conversation.exit_tangent_mode(); |
| 105 | Self::send_tangent_telemetry(os, session, duration_seconds).await; |
| 106 | |
| 107 | execute!( |
nothing calls this directly
no test coverage detected