Helper function to generate a prompt based on the current context
(&mut self, os: &Os)
| 3592 | |
| 3593 | /// Helper function to generate a prompt based on the current context |
| 3594 | async fn generate_tool_trust_prompt(&mut self, os: &Os) -> String { |
| 3595 | let profile = self.conversation.current_profile().map(|s| s.to_string()); |
| 3596 | let all_trusted = self.all_tools_trusted(); |
| 3597 | let tangent_mode = self.conversation.is_in_tangent_mode(); |
| 3598 | |
| 3599 | // Check if context usage indicator is enabled |
| 3600 | let usage_percentage = if ExperimentManager::is_enabled(os, ExperimentName::ContextUsageIndicator) { |
| 3601 | use crate::cli::chat::cli::usage::usage_data_provider::get_total_usage_percentage; |
| 3602 | get_total_usage_percentage(self, os).await.ok() |
| 3603 | } else { |
| 3604 | None |
| 3605 | }; |
| 3606 | |
| 3607 | let mut generated_prompt = |
| 3608 | prompt::generate_prompt(profile.as_deref(), all_trusted, tangent_mode, usage_percentage); |
| 3609 | |
| 3610 | if ExperimentManager::is_enabled(os, ExperimentName::Delegate) { |
| 3611 | if let Ok(mut executions) = status_all_agents(os).await { |
| 3612 | if !executions.is_empty() { |
| 3613 | let rich_notification = format_rich_notification(&executions); |
| 3614 | generated_prompt = format!("{}\n{}", rich_notification, generated_prompt); |
| 3615 | |
| 3616 | // Use the notification text as context for the model (it's already plain text) |
| 3617 | self.pending_additional_context = Some(rich_notification.clone()); |
| 3618 | |
| 3619 | // Mark all shown tasks as user_notified |
| 3620 | for execution in &mut executions { |
| 3621 | execution.user_notified = true; |
| 3622 | if let Err(e) = save_agent_execution(os, execution).await { |
| 3623 | eprintln!("Failed to mark agent execution as notified: {}", e); |
| 3624 | } |
| 3625 | } |
| 3626 | } |
| 3627 | } |
| 3628 | } |
| 3629 | |
| 3630 | generated_prompt |
| 3631 | } |
| 3632 | |
| 3633 | async fn send_tool_use_telemetry(&mut self, os: &Os) { |
| 3634 | for (_, mut event) in self.tool_use_telemetry_events.drain() { |
no test coverage detected