(
state: &State<'_, AppState>,
app: &tauri::AppHandle,
trace: &DesktopStartupTrace,
)
| 1019 | } |
| 1020 | |
| 1021 | async fn initialize_global_state_impl( |
| 1022 | state: &State<'_, AppState>, |
| 1023 | app: &tauri::AppHandle, |
| 1024 | trace: &DesktopStartupTrace, |
| 1025 | ) { |
| 1026 | let total_started = Instant::now(); |
| 1027 | let step_started = Instant::now(); |
| 1028 | let current_workspace = state.workspace_service.get_current_workspace().await; |
| 1029 | trace.record_elapsed_step( |
| 1030 | "tauri_command", |
| 1031 | "initialize_global_state.get_current_workspace", |
| 1032 | step_started, |
| 1033 | ); |
| 1034 | |
| 1035 | if let Some(workspace_info) = current_workspace { |
| 1036 | let step_started = Instant::now(); |
| 1037 | apply_active_workspace_context(&state, &app, &workspace_info, Some(trace)).await; |
| 1038 | trace.record_elapsed_step( |
| 1039 | "tauri_command", |
| 1040 | "initialize_global_state.apply_active_workspace_context", |
| 1041 | step_started, |
| 1042 | ); |
| 1043 | |
| 1044 | info!( |
| 1045 | "Global state initialized with active workspace: workspace_id={}, path={}", |
| 1046 | workspace_info.id, |
| 1047 | workspace_info.root_path.display() |
| 1048 | ); |
| 1049 | } else { |
| 1050 | let step_started = Instant::now(); |
| 1051 | clear_active_workspace_context(&state, &app, Some(trace)).await; |
| 1052 | trace.record_elapsed_step( |
| 1053 | "tauri_command", |
| 1054 | "initialize_global_state.clear_active_workspace_context", |
| 1055 | step_started, |
| 1056 | ); |
| 1057 | info!("Global state initialized without active workspace"); |
| 1058 | } |
| 1059 | |
| 1060 | trace.record_elapsed_step( |
| 1061 | "tauri_command", |
| 1062 | "initialize_global_state.total", |
| 1063 | total_started, |
| 1064 | ); |
| 1065 | } |
| 1066 | |
| 1067 | #[tauri::command] |
| 1068 | pub async fn get_available_tools(state: State<'_, AppState>) -> Result<Vec<String>, String> { |
no test coverage detected