@@ -556,41 +556,44 @@ pub async fn run() {
556556 startup_timings. record_elapsed ( "initialize_global_config" , step_started) ;
557557 startup_trace. record_elapsed_step ( "native_pre_tauri" , "initialize_global_config" , step_started) ;
558558
559- let step_started = Instant :: now ( ) ;
560- match openbitfun_core:: plugin_host:: initialize_configured_plugin_host_with_log_file (
561- PLUGIN_HOST_LAUNCH_POLICY ,
562- Some ( session_log_dir. join ( "plugin-host.log" ) ) ,
563- )
564- . await
565- {
566- Ok ( openbitfun_core:: plugin_host:: PluginHostStartup :: Disabled ) => { }
567- Ok ( status) => log:: info!( "Plugin host initialization completed: {:?}" , status) ,
568- Err ( error) => {
569- log:: error!( "Failed to initialize configured plugin host: {}" , error) ;
570- openbitfun_core:: plugin_host:: report_configured_plugin_activation_failure (
571- "Desktop startup" ,
572- None ,
573- error,
574- )
575- . await ;
576- }
577- }
578- startup_timings. record_elapsed ( "initialize_plugin_host" , step_started) ;
579- startup_trace. record_elapsed_step ( "native_pre_tauri" , "initialize_plugin_host" , step_started) ;
580-
581- // The three steps below only depend on the global config service (initialized
582- // above) and write to disjoint global singletons, so they can run concurrently:
559+ // The four steps below only depend on the global config service (initialized
560+ // above) and write to disjoint targets, so they can run concurrently:
561+ // - initialize_plugin_host: starts the plugin host process
583562 // - initialize_global_i18n_service: reads config, sets the global i18n singleton
584563 // - resolve_runtime_log_level: reads config, returns a value
585564 // - AIClientFactory::initialize_global: reads config, sets GLOBAL_AI_CLIENT_FACTORY
586565 let (
566+ plugin_host_duration_ms,
587567 i18n_duration_ms,
588568 ( startup_log_level, log_level_duration_ms) ,
589569 ( ai_factory_result, ai_factory_duration_ms) ,
590570 ) = {
591571 use openbitfun_core:: service:: config:: get_global_config_service;
592572 use openbitfun_core:: service:: i18n:: initialize_global_i18n_service;
593573
574+ let plugin_host_task = async {
575+ let step_started = Instant :: now ( ) ;
576+ match openbitfun_core:: plugin_host:: initialize_configured_plugin_host_with_log_file (
577+ PLUGIN_HOST_LAUNCH_POLICY ,
578+ Some ( session_log_dir. join ( "plugin-host.log" ) ) ,
579+ )
580+ . await
581+ {
582+ Ok ( openbitfun_core:: plugin_host:: PluginHostStartup :: Disabled ) => { }
583+ Ok ( status) => log:: info!( "Plugin host initialization completed: {:?}" , status) ,
584+ Err ( error) => {
585+ log:: error!( "Failed to initialize configured plugin host: {}" , error) ;
586+ openbitfun_core:: plugin_host:: report_configured_plugin_activation_failure (
587+ "Desktop startup" ,
588+ None ,
589+ error,
590+ )
591+ . await ;
592+ }
593+ }
594+ elapsed_ms ( step_started)
595+ } ;
596+
594597 // Initialize global I18nService so bot/remote-connect language is always in sync.
595598 let i18n_task = async {
596599 let step_started = Instant :: now ( ) ;
@@ -619,9 +622,16 @@ pub async fn run() {
619622 ( result, elapsed_ms ( step_started) )
620623 } ;
621624
622- tokio:: join!( i18n_task, log_level_task, ai_factory_task)
625+ tokio:: join!( plugin_host_task , i18n_task, log_level_task, ai_factory_task)
623626 } ;
624627
628+ startup_timings. push_duration ( "initialize_plugin_host" , plugin_host_duration_ms) ;
629+ startup_trace. record_step (
630+ "native_step_end" ,
631+ "native_pre_tauri" ,
632+ "initialize_plugin_host" ,
633+ plugin_host_duration_ms,
634+ ) ;
625635 startup_timings. push_duration ( "initialize_global_i18n_service" , i18n_duration_ms) ;
626636 startup_trace. record_step (
627637 "native_step_end" ,
@@ -1071,7 +1081,7 @@ pub async fn run() {
10711081 // on timeout the frontend falls back to the existing
10721082 // `initialize_workspace_startup_state` command path.
10731083 const WORKSPACE_STARTUP_SNAPSHOT_TIMEOUT : std:: time:: Duration =
1074- std:: time:: Duration :: from_secs ( 4 ) ;
1084+ std:: time:: Duration :: from_millis ( 150 ) ;
10751085 tokio:: task:: block_in_place ( || {
10761086 tokio:: runtime:: Handle :: current ( ) . block_on ( async {
10771087 match tokio:: time:: timeout (
@@ -2008,6 +2018,7 @@ pub async fn run() {
20082018 api:: browser_api:: browser_webview_capture_preview,
20092019 api:: browser_api:: browser_webview_set_agent_target_state,
20102020 api:: browser_api:: browser_get_url,
2021+ api:: browser_api:: browser_webview_close,
20112022 api:: html_preview_api:: html_preview_create,
20122023 api:: html_preview_api:: html_preview_read_resource,
20132024 api:: html_preview_api:: html_preview_release,
0 commit comments