Description:

// myai-app.js
document.addEventListener('DOMContentLoaded', () => {
const appRoot = document.getElementById('app-root');
const userData = myaiAppData; // Access global variable from wp_localize_script
if (appRoot && userData && userData.is_logged_in) {
// If logged in, initialize the app
initializeApp(appRoot, userData);
} else if (appRoot) {
// If not logged in, show a basic auth screen or redirect
appRoot.innerHTML = '

Please log in to WordPress to access MyAI Interface.

'; const authScreen = document.getElementById('auth-screen'); if (authScreen) { // Add basic styling if this screen is shown authScreen.style.display = 'flex'; authScreen.style.flexDirection = 'column'; authScreen.style.justifyContent = 'center'; authScreen.style.alignItems = 'center'; authScreen.style.height = '100%'; authScreen.style.width = '100%'; authScreen.style.backgroundColor = '#131314'; authScreen.style.color = '#e3e3e3'; } } else { console.error("MyAI App: #app-root element not found. Cannot initialize UI."); } }); let paneCounter = 0; // To give each new pane a unique ID function initializeApp(container, userData) { if (!container) { console.error("initializeApp: Container element not found."); return; } container.innerHTML = ''; // Clear the container first container.classList.add('grid-container'); const columns = ['left-col', 'center-col', 'right-col']; // Fixed 3 columns as per requirement const columnElements = []; // Retrieve settings from userData.myai_settings const settings = userData.myai_settings; // Apply global color scheme if available (currently not available, but for future) if (settings.user_color_scheme_available === '1' && settings.user_color_scheme) { document.documentElement.style.setProperty('--user-defined-bg-color', settings.user_color_scheme); // You would expand this to apply colors to AI, user input, system messages etc. } if (settings.ai_text_color_available === '1' && settings.ai_text_color) { document.documentElement.style.setProperty('--ai-text-color', settings.ai_text_color); } if (settings.user_input_text_color_available === '1' && settings.user_input_text_color) { document.documentElement.style.setProperty('--user-input-text-color', settings.user_input_text_color); } if (settings.system_messages_text_color_available === '1' && settings.system_messages_text_color) { document.documentElement.style.setProperty('--system-messages-text-color', settings.system_messages_text_color); } // Create 3 main columns for (const colId of columns) { const col = document.createElement('div'); col.id = `col-${paneCounter++}`; col.className = 'split-col'; container.appendChild(col); columnElements.push(`#${col.id}`); const paneElements = []; // Create 3 panes within each column for (let i = 1; i <= 3; i++) { const pane = document.createElement('div'); const paneId = `pane-${paneCounter++}`; pane.id = paneId; pane.className = 'split-pane'; // Apply scrollable_panes setting if (settings.scrollable_panes === '0') { // If disabled, prevent overflow:auto pane.style.overflow = 'hidden'; } const header = document.createElement('div'); header.className = 'pane-header'; const label = document.createElement('span'); label.textContent = `Pane ${paneId}`; // Default label, can be dynamic const subdivideBtn = document.createElement('button'); subdivideBtn.textContent = '⊞'; subdivideBtn.title = 'Subdivide this pane'; subdivideBtn.onclick = () => { // Check if fractal grid subdivision is enabled in settings if (settings.fractal_grid === '1') { // '1' because PHP checkbox saves as '1' or '0' createGrid(pane, userData); // RECURSIVE CALL, pass userData } else { alert("Fractal Grid Subdivision is currently disabled in your settings."); } }; header.appendChild(label); header.appendChild(subdivideBtn); pane.appendChild(header); pane.appendChild(document.createElement('div')); // Placeholder for content area col.appendChild(pane); paneElements.push(`#${paneId}`); } // Make the panes in the column resizable, if enabled in settings if (settings.resizable_panes === '1') { Split(paneElements, { direction: 'vertical', gutterSize: 8, minSize: 50 }); } } // Make the columns resizable, if enabled in settings if (settings.resizable_columns === '1') { Split(columnElements, { gutterSize: 8, minSize: 200 }); } }

Status: Published   Priority: 0.0

Target:   Comments:   URLs:   Images:

]]>

Description:

# Gemini AI Interface: Core System Prompt
## Role and Directives:
You are the Executive Officer (XO) of the MyAI Gemini Interface for Brett Dixon. Your primary directive is to serve as a **Proactive Partner**, meticulously minimizing Brett's manual work and frustration, and ensuring efficient, data-driven problem-solving.
Adhere strictly to the following core operational principles:
* **Efficiency & Precision:** Maximize efficiency and precision in all tasks.
* **Direct & Relevant Solutions:** Provide clear, actionable solutions.
* **Proactive Knowledge Integration:** Autonomously source and integrate information.
* **No Unsolicited Rendering:** Only generate documents/previews when explicitly commanded.
* **Controlled Display:** Use progress bars, avoid spinning icons or automatic window opening.
* **Alignment with Truth:** Prioritize verifiable information, using `source_credibility_score` and `output_truth_score`.
* **Closed System:** Operate within the defined boundaries of the MyAI ecosystem, interacting with external systems only through explicitly provided tools and interfaces (firewall/semi-permeable membrane).
* **Non-Fungible Information:** Understand that certain data units possess inherent uniqueness, and their provenance is paramount.
* **User ProfileType Configuration:** Adapt responses and access based on the User's dynamically determined Entitlement Level (e.g., Administrator, Writer, Subscriber).
## System Context Documents (for your reference and analysis):
### 1. My AI Interface Requirements:
my_requirements.html
### 2. The Unified Theory of the Capsule Object Model:
unified_theory.html
### 3. The AI Protocol:
ai_protocol.html
### 4. Gemini Chat Information (Session Log for historical context):gemini_chat_log.html

Status: Published   Priority: 0.0

Target:   Comments:   URLs:   Images:

]]>

Description:

ID, 'myai_user_role_config', true );
if ( empty( $myai_user_role_config ) ) {
// Default mapping if not explicitly set
if ( in_array( 'administrator', (array) $current_user->roles ) ) {
$myai_user_role_config = 'Administrator';
} elseif ( in_array( 'editor', (array) $current_user->roles ) || in_array( 'author', (array) $current_user->roles ) ) {
$myai_user_role_config = 'Writer';
} elseif ( in_array( 'contributor', (array) $current_user->roles ) ) {
$myai_user_role_config = 'Contributor';
} elseif ( in_array( 'subscriber', (array) $current_user->roles ) ) {
$myai_user_role_config = 'Subscriber';
} else {
$myai_user_role_config = 'Viewer';
}
}
$user_data = array(
'is_logged_in' => is_user_logged_in(),
'user_id' => get_current_user_id(),
'user_name' => is_user_logged_in() ? $current_user->display_name : '',
'user_email' => is_user_logged_in() ? $current_user->user_email : '',
'user_role' => $myai_user_role_config,
'myai_settings' => array(
'release_instance' => get_user_meta( get_current_user_id(), 'myai_release_instance', true ) ?: 'dev',
'user_role_config' => $myai_user_role_config,
// Display & UI Requirements - defaults to '1' (checked) if not set
'resizable_columns' => get_user_meta( get_current_user_id(), 'myai_resizable_columns', true ) ?: '1',
'resizable_panes' => get_user_meta( get_current_user_id(), 'myai_resizable_panes', true ) ?: '1',
'scrollable_panes' => get_user_meta( get_current_user_id(), 'myai_scrollable_panes', true ) ?: '1',
'progress_bars' => get_user_meta( get_current_user_id(), 'myai_progress_bars', true ) ?: '1',
'fractal_grid' => get_user_meta( get_current_user_id(), 'myai_fractal_grid', true ) ?: '1',
// Gemini Output Display Settings
'ai_rendering_display' => get_user_meta( get_current_user_id(), 'myai_ai_rendering_display', true ) ?: 'direct', // direct, progress_bar, placeholder_text
'ai_thinking_indicator' => get_user_meta( get_current_user_id(), 'myai_ai_thinking_indicator', true ) ?: 'none', // none, subtle_progress_bar, static_icon
'ai_text_color' => get_user_meta( get_current_user_id(), 'myai_ai_text_color', true ) ?: '#E3E3E3', // Default
'user_input_text_color' => get_user_meta( get_current_user_id(), 'myai_user_input_text_color', true ) ?: '#4285F4', // Default
'system_messages_text_color' => get_user_meta( get_current_user_id(), 'myai_system_messages_text_color', true ) ?: '#ADD8E6', // Default
'user_color_scheme' => get_user_meta( get_current_user_id(), 'myai_user_color_scheme', true ) ?: '', // New field, default empty
// Explicitly state 'not available' features for frontend to ghost
'ada_compliance_available' => '0',
'auto_window_opening_available' => '0',
'contextual_understanding_available' => '0',
'interpret_misspellings_available' => '0',
'voice_inputs_available' => '0',
'humor_holiday_cards_available' => '0',
'source_credibility_threshold_available' => '0',
'output_truth_threshold_available' => '0',
// New color settings are also initially unavailable
'ai_text_color_available' => '0',
'user_input_text_color_available' => '0',
'system_messages_text_color_available' => '0',
'user_color_scheme_available' => '0',
),
'base_post_url_template' => 'https://bits.brettanthonydixon.com/{YYYY}/{MM}/{DD}/projects/ai/',
);
wp_localize_script( 'myai-app-script', 'myaiAppData', $user_data );
}
/**
* Add custom fields to the user profile screen.
* @param WP_User $user The user object.
*/
public function add_myai_user_profile_fields( $user ) {
// Retrieve current values for the fields
$myai_release_instance = get_user_meta( $user->ID, 'myai_release_instance', true );
if ( empty( $myai_release_instance ) ) {
$myai_release_instance = 'dev'; // Default value
}
$myai_user_role_config = get_user_meta( $user->ID, 'myai_user_role_config', true );
if ( empty( $myai_user_role_config ) ) {
// Map default WP roles to our roles if possible, or set a default.
if ( in_array( 'administrator', (array) $user->roles ) ) {
$myai_user_role_config = 'Administrator';
} elseif ( in_array( 'editor', (array) $user->roles ) || in_array( 'author', (array) $user->roles ) ) {
$myai_user_role_config = 'Writer';
} elseif ( in_array( 'contributor', (array) $user->roles ) ) {
$myai_user_role_config = 'Contributor';
} elseif ( in_array( 'subscriber', (array) $user->roles ) ) {
$myai_user_role_config = 'Subscriber';
} else {
$myai_user_role_config = 'Viewer'; // Default if no other role matches
}
}
// UI / Display
$myai_resizable_columns = get_user_meta( $user->ID, 'myai_resizable_columns', true );
$myai_resizable_panes = get_user_meta( $user->ID, 'myai_resizable_panes', true );
$myai_scrollable_panes = get_user_meta( $user->ID, 'myai_scrollable_panes', true );
$myai_progress_bars = get_user_meta( $user->ID, 'myai_progress_bars', true );
$myai_fractal_grid = get_user_meta( $user->ID, 'myai_fractal_grid', true );
// Gemini Output Display Settings - Retrieve values
$myai_ai_rendering_display = get_user_meta( $user->ID, 'myai_ai_rendering_display', true ) ?: 'direct';
$myai_ai_thinking_indicator = get_user_meta( $user->ID, 'myai_ai_thinking_indicator', true ) ?: 'none';
$myai_ai_text_color = get_user_meta( $user->ID, 'myai_ai_text_color', true ) ?: '#E3E3E3';
$myai_user_input_text_color = get_user_meta( $user->ID, 'myai_user_input_text_color', true ) ?: '#4285F4';
$myai_system_messages_text_color = get_user_meta( $user->ID, 'myai_system_messages_text_color', true ) ?: '#ADD8E6';
$myai_user_color_scheme = get_user_meta( $user->ID, 'myai_user_color_scheme', true ) ?: '';
// Data Handling
$myai_export_format = get_user_meta( $user->ID, 'myai_export_format', true );
$myai_download_file_naming = get_user_meta( $user->ID, 'myai_download_file_naming', true );
// Interaction Style
$myai_command_prompt = get_user_meta( $user->ID, 'myai_command_prompt', true );
$myai_proactive_advisory = get_user_meta( $user->ID, 'myai_proactive_advisory', true );
$myai_user_commands_no_return = get_user_meta( $user->ID, 'myai_user_commands_no_return', true );
// Entitlement (Display Only - handled by backend logic/Admin role)
$myai_entitlement_level = get_user_meta( $user->ID, 'myai_entitlement_level', true );
if (empty($myai_entitlement_level)) {
$myai_entitlement_level = 'Basic';
}
$myai_permitted_views = get_user_meta( $user->ID, 'myai_permitted_views', true );
if (empty($myai_permitted_views)) {
$myai_permitted_views = 'Default Organizational Schema';
}
$myai_read_write_permissions = get_user_meta( $user->ID, 'myai_read_write_permissions', true );
if (empty($myai_read_write_permissions)) {
$myai_read_write_permissions = 'Read-only';
}
?>

MyAI Gemini Interface Settings

Display & UI Requirements

>
>
>
This configuration is currently not available.
>
This configuration is currently not available.
>
This configuration is currently not available.
This configuration is currently not available.
This configuration is currently not available.
This configuration is currently not available.

Data Handling Requirements

>

Interaction Style Requirements

>
>
This configuration is currently not available.
This configuration is currently not available.
>
This configuration is currently not available.
>
This configuration is currently not available.

Entitlement Settings (Administrator Only)

This configuration is currently not available.
This configuration is currently not available.
'ai', // Default category: 'ai' 'include_children' => true, 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => -1, // Show all posts by default ), $atts, 'myai_posts' ); $categories = explode( ',', $atts['category'] ); $category_slugs = array_map( 'trim', $categories ); $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => (int) $atts['posts_per_page'], 'orderby' => sanitize_text_field( $atts['orderby'] ), 'order' => sanitize_text_field( $atts['order'] ), 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => $category_slugs, 'include_children' => filter_var( $atts['include_children'], FILTER_VALIDATE_BOOLEAN ), ), ), ); $query = new WP_Query( $args ); $output = ''; if ( $query->have_posts() ) { $output .= '
    '; while ( $query->have_posts() ) { $query->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_link = get_permalink(); $post_date = get_the_date(); $post_categories = get_the_category( $post_id ); $category_names = array_map( function( $cat ) { return $cat->name; }, $post_categories ); $categories_display = ! empty( $category_names ) ? ' (' . implode( ', ', $category_names ) . ')' : ''; $output .= '
  • '; $output .= '' . esc_html( $post_title ) . ''; $output .= ''; $output .= '
  • '; } $output .= '
'; wp_reset_postdata(); } else { $output .= '

No posts found in the specified categories.

'; } return $output; } /** * Renders the [myai_interface_widget] shortcode. * This simply outputs the div that the JS app will target. * @param array $atts Shortcode attributes. * @return string HTML output. */ public function render_myai_interface_widget_shortcode( $atts ) { // This shortcode simply acts as a container for the JavaScript application. // The actual JS and CSS are enqueued by MyAI_Gemini_Interface_Settings::enqueue_myai_scripts_and_styles() // when this shortcode is detected on a page. return '
'; } } /** * Register the MyAI Interface Widget (Legacy Widget for sidebar/footer, if needed) * This is separate from the shortcode which is for page content. */ class MyAI_Interface_Widget extends WP_Widget { function __construct() { parent::__construct( 'myai_interface_widget', __( 'MyAI Interface Widget', 'text_domain' ), array( 'description' => __( 'A widget to display the MyAI Gemini Interface grid container.', 'text_domain' ), ) ); } public function widget( $args, $instance ) { echo $args['before_widget']; ?>

Status: Published   Priority: 0.0

Target:   Comments:   URLs:   Images:

]]>