MCPcopy Create free account
hub / github.com/GCWing/BitFun / initialize_global_state_impl

Function initialize_global_state_impl

src/apps/desktop/src/api/commands.rs:1021–1065  ·  view source on GitHub ↗
(
    state: &State<'_, AppState>,
    app: &tauri::AppHandle,
    trace: &DesktopStartupTrace,
)

Source from the content-addressed store, hash-verified

1019}
1020
1021async 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]
1068pub async fn get_available_tools(state: State<'_, AppState>) -> Result<Vec<String>, String> {

Calls 4

record_elapsed_stepMethod · 0.80
get_current_workspaceMethod · 0.45

Tested by

no test coverage detected