$svabg_model_now, 'label' => $svabg_model_now, ); } $svabg_setup = Softvolt_Ai_Bodyguard_Admin::setup_state(); // "OpenAI (GPT)" → "OpenAI" and "GPT"; one letter (or a fixed mark) for the provider's tile. $svabg_name_parts = static function ( $name ) { if ( preg_match( '/^(.*?)\s*\((.+)\)\s*$/', (string) $name, $m ) ) { return array( trim( $m[1] ), trim( $m[2] ) ); } return array( trim( (string) $name ), '' ); }; $svabg_tile = static function ( $id, $name ) use ( $svabg_name_parts ) { if ( 'custom' === $id ) { return '{}'; } return strtoupper( substr( $svabg_name_parts( $name )[0], 0, 1 ) ); }; // Every choice: the catalog's providers (an add-on may add its own) and any OpenAI-compatible service. $svabg_all = $svabg_providers; $svabg_all['custom'] = array( 'name' => __( 'Other (OpenAI-compatible)', 'ai-guardwall' ), 'group' => 'custom', 'summary' => __( 'Any service with an OpenAI-style API, or a model you run yourself with Ollama or LM Studio.', 'ai-guardwall' ), ); // Provider groups as tabs: what each holds, in order. Claude Desktop is a way to connect Claude. $svabg_ids_for = static function ( $group ) use ( $svabg_providers ) { $ids = array(); foreach ( $svabg_providers as $id => $p ) { if ( $group === $p['group'] ) { $ids[] = $id; } } return $ids; }; $svabg_ptabs = array( 'free' => array( __( 'Free to start', 'ai-guardwall' ), 'dashicons-unlock', $svabg_ids_for( 'free' ), __( 'Free models from providers with a free plan. Good for a first opinion on each finding.', 'ai-guardwall' ) ), 'paid' => array( __( 'Paid', 'ai-guardwall' ), 'dashicons-money-alt', $svabg_ids_for( 'pro' ), __( 'Pay as you go with your own key, for the sharpest verdicts and fewer false positives. Anthropic Claude also connects through Claude Desktop with your Claude Pro or Max plan, without a key.', 'ai-guardwall' ) ), 'other' => array( __( 'Other ways', 'ai-guardwall' ), 'dashicons-admin-plugins', array( 'custom' ), __( 'Any OpenAI-compatible service, or a model you run yourself.', 'ai-guardwall' ) ), ); $svabg_tab_of = $svabg_mcp ? 'anthropic' : $svabg_current; $svabg_ptab_now = 'free'; foreach ( $svabg_ptabs as $svabg_tid => $svabg_tdef ) { if ( in_array( $svabg_tab_of, $svabg_tdef[2], true ) ) { $svabg_ptab_now = $svabg_tid; } } // Whether a provider is ready to use (a key saved, or nothing to save). $svabg_has = static function ( $id ) use ( $svabg_settings ) { if ( 'custom' === $id ) { return '' !== (string) $svabg_settings['custom_base_url'] && ( empty( $svabg_settings['custom_needs_key'] ) || Softvolt_Ai_Bodyguard_Settings::has_secret( 'key_custom' ) ); } return Softvolt_Ai_Bodyguard_Settings::has_secret( 'key_' . $id ); }; // The summary at the top: the provider in use, the open findings the AI has read, where it works. if ( $svabg_mcp ) { $svabg_now = array( 'name' => __( 'Claude Desktop (MCP)', 'ai-guardwall' ), 'group' => 'claude', ); $svabg_now_name = array( __( 'Anthropic', 'ai-guardwall' ), __( 'Claude, through Claude Desktop', 'ai-guardwall' ) ); } else { $svabg_now = isset( $svabg_all[ $svabg_current ] ) ? $svabg_all[ $svabg_current ] : array( 'name' => $svabg_current, 'group' => '', ); $svabg_now_name = $svabg_name_parts( $svabg_now['name'] ); } $svabg_tiers = array( 'free' => array( __( 'Free', 'ai-guardwall' ), 'free' ), 'pro' => array( __( 'Paid', 'ai-guardwall' ), 'paid' ), 'custom' => array( __( 'Your own service', 'ai-guardwall' ), 'paid' ), 'claude' => array( __( 'Your Claude plan', 'ai-guardwall' ), 'pro' ), ); $svabg_tier = isset( $svabg_tiers[ $svabg_now['group'] ] ) ? $svabg_tiers[ $svabg_now['group'] ] : array( __( 'Paid', 'ai-guardwall' ), 'paid' ); $svabg_model_lb = 'custom' === $svabg_current ? (string) $svabg_settings['custom_model'] : Softvolt_Ai_Bodyguard_Settings::model(); foreach ( $svabg_model_list as $svabg_m ) { if ( $svabg_m['id'] === $svabg_model_lb && '' !== $svabg_m['id'] ) { $svabg_model_lb = $svabg_m['label']; } } $svabg_key_hint = Softvolt_Ai_Bodyguard_Settings::secret_hint( 'key_' . $svabg_current ); $svabg_no_key = $svabg_mcp || ( 'custom' === $svabg_current && empty( $svabg_settings['custom_needs_key'] ) ); $svabg_agreed = ! empty( $svabg_settings['ai_consent'] ); $svabg_on = $svabg_ready && $svabg_agreed; $svabg_state = $svabg_on && ( ! $svabg_mcp || Softvolt_Ai_Bodyguard_Claude::connected() ); $svabg_open = Softvolt_Ai_Bodyguard_Findings::counts(); $svabg_read = 0; foreach ( Softvolt_Ai_Bodyguard_Findings::count_by( 'ai_verdict' ) as $svabg_verdict => $svabg_count ) { if ( '' !== (string) $svabg_verdict ) { $svabg_read += (int) $svabg_count; } } $svabg_pct = $svabg_open['total'] ? min( 100, (int) round( 100 * $svabg_read / $svabg_open['total'] ) ) : 0; $svabg_seen = $svabg_mcp ? Softvolt_Ai_Bodyguard_Claude::last_seen() : 0; $svabg_jobs = array( array( __( 'Analyse findings', 'ai-guardwall' ), __( 'Reads each suspicious file or record, says whether it is malware and why, and what could break.', 'ai-guardwall' ), $svabg_on, $svabg_mcp ? __( 'Claude answers them as tasks', 'ai-guardwall' ) : __( 'Findings', 'ai-guardwall' ) ), array( __( 'Cleanup advice', 'ai-guardwall' ), __( 'Recommends the safest fix for each finding, with your cleanup instructions and knowledge files.', 'ai-guardwall' ), $svabg_on, __( 'Knowledge', 'ai-guardwall' ) ), array( __( 'Scans', 'ai-guardwall' ), __( 'Scheduled and manual scans find suspicious code by themselves, without AI.', 'ai-guardwall' ), false, __( 'No AI needed', 'ai-guardwall' ) ), ); if ( $svabg_state ) { $svabg_state_text = __( 'Connected', 'ai-guardwall' ); } elseif ( ! $svabg_ready ) { $svabg_state_text = __( 'Not connected yet', 'ai-guardwall' ); } elseif ( ! $svabg_agreed ) { $svabg_state_text = __( 'Waiting for your consent', 'ai-guardwall' ); } else { $svabg_state_text = __( 'Waiting for Claude Desktop', 'ai-guardwall' ); } ?>

→

Claude Opus 5.5

$svabg_tdef ) : ?>
$svabg_tdef ) : ?>
>

$svabg_p ) : ?>
>

hidden>
    >

>

>

>