__( 'Agent chat', 'desktop-mode' ), 'icon' => openstation_agent_run_window_icon(), 'template' => 'openstation_agent_run_render_template', 'script' => 'desktop-mode-agent-run', 'styles' => array( 'desktop-mode-agent-run' ), 'width' => 760, 'height' => 620, 'min_width' => 540, 'min_height' => 380, 'placement' => 'none', // Chat invocations should always surface a visible window, // not race a focused window into the background. 'autofocus' => true, 'config' => array( 'restRoot' => esc_url_raw( rest_url() ), 'restNonce' => wp_create_nonce( 'wp_rest' ), 'canManage' => openstation_agents_user_can_manage(), // The viewer — the chat paints their avatar next to // their own messages, WhatsApp-style. 'currentUser' => array( 'id' => (int) get_current_user_id(), 'name' => (string) wp_get_current_user()->display_name, 'avatarUrl' => (string) get_avatar_url( get_current_user_id(), array( 'size' => 96 ) ), ), ), ) ); if ( is_wp_error( $registered ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log error_log( '[openstation] Agent chat window registration failed: ' . $registered->get_error_message() ); } } add_action( 'init', 'openstation_agent_run_window_register', 25 );