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:

// server.js
import express from 'express';
import dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
import apiRouter from './routes/api.js';
import session from 'express-session';
import passport from 'passport';
import { Strategy as GoogleStrategy } from 'passport-google-oauth20';
// NEW: Import Google API libraries
import { google } from 'googleapis';
import { OAuth2Client } from 'google-auth-library'; // For managing OAuth tokens
// Load environment variables from .env file
dotenv.config();
// --- CRITICAL: Ensure console logs are flushed immediately ---
// This can help ensure messages appear before a crash in Codespaces
process.stdout.uncork();
process.stderr.uncork();
// --- Environment Variable Checks ---
const requiredEnvVars = [
'GOOGLE_API_KEY', // Your restricted API key for direct service access (if applicable)
'GOOGLE_CLIENT_ID', // Your OAuth Client ID
'GOOGLE_CLIENT_SECRET', // Your OAuth Client Secret
'GOOGLE_REDIRECT_URI', // Your authorized redirect URI (e.g., https://ubiquitous-bassoon-jjg6wq44p9jr3q7j7-3001.app.github.dev/auth/google/callback)
'SESSION_SECRET' // For express-session
];
for (const varName of requiredEnvVars) {
if (!process.env[varName]) {
console.error(`FATAL ERROR: Environment variable ${varName} is not set. Please check your .env file or Codespaces secrets.`);
process.exit(1); // Exit with a failure code
}
}
// --- Catch unhandled errors ---
process.on('uncaughtException', (err, origin) => {
console.error('FATAL UNCAUGHT EXCEPTION:', err);
console.error('Exception origin:', origin);
process.exit(1);
});
// --- Log process exit/termination ---
process.on('exit', (code) => {
console.log(`Server process exited with code: ${code}`);
});
process.on('SIGTERM', () => {
console.log('Server process received SIGTERM signal. Shutting down gracefully...');
process.exit(0);
});
// Setup for ES module __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
const PORT = process.env.PORT || 3001;
// --- Google OAuth2Client Setup ---
// This client is used to initiate the OAuth flow and refresh tokens.
const oauth2Client = new OAuth2Client(
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
process.env.GOOGLE_REDIRECT_URI
);
// In-memory user database (for demonstration purposes, replace with persistent DB in production)
const users = {};
// --- Passport.js Configuration ---
passport.use(new GoogleStrategy({
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: process.env.GOOGLE_REDIRECT_URI, // Use the environment variable
passReqToCallback: true // Allows us to access req in the callback
},
async (request, accessToken, refreshToken, profile, done) => {
// Save tokens and profile info. In a real app, save to a DB.
// For demonstration, we'll store basic info and tokens (NOT SECURE FOR PRODUCTION)
users[profile.id] = {
id: profile.id,
name: profile.displayName,
email: profile.emails[0].value,
photo: profile.photos[0].value,
accessToken: accessToken, // Store for making API calls on behalf of the user
refreshToken: refreshToken, // Store for refreshing access tokens
};
console.log("Google profile received: " + profile.displayName);
console.log("Access Token (store securely!): " + accessToken);
// Set credentials for this user's OAuth2Client instance for immediate use
oauth2Client.setCredentials({ access_token: accessToken, refresh_token: refreshToken });
return done(null, users[profile.id]);
}
));
// REVISED: Fix for 'ReferenceError: id is not defined'
passport.serializeUser((user, done) => {
done(null, user.id); // Corrected from 'users[id]' to 'user.id'
});
passport.deserializeUser((id, done) => {
// In a real app, retrieve user from database.
done(null, users[id]);
});
// --- Middleware Setup ---
app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: true,
cookie: { secure: app.get('env') === 'production' } // 'true' for HTTPS in prod, 'false' for http in dev (Codespaces)
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// Serve static files from 'public' and 'node_modules'
app.use(express.static(path.join(__dirname, 'public')));
app.use('/node_modules', express.static(path.join(__dirname, 'node_modules')));
// --- Routes ---
app.get('/auth/google',
passport.authenticate('google', { scope: [
'profile',
'email',
'https://www.googleapis.com/auth/drive.readonly',
'https://www.googleapis.com/auth/gmail.readonly',
'https://www.googleapis.com/auth/calendar.readonly',
'https://www.googleapis.com/auth/contacts.readonly', // Uses People API internally
'https://www.googleapis.com/auth/photoslibrary.readonly'
] })); // Include all necessary scopes here
app.get('/auth/google/callback',
passport.authenticate('google', { failureRedirect: '/' }),
(req, res) => {
console.log('Successfully authenticated! User:', req.user.name);
// Redirect to the main application page or a dashboard
res.redirect('/');
}
);
app.get('/logout', (req, res, next) => {
req.logout(err => {
if (err) { return next(err); }
// Clear tokens from in-memory store if applicable (for demo purposes)
if (req.user && users[req.user.id]) {
delete users[req.user.id].accessToken;
delete users[req.user.id].refreshToken;
}
res.redirect('/');
});
});
// --- NEW: API Endpoint to Handle Gemini Tool Calls from AI Studio (Conceptual) ---
// This is the core piece that connects AI Studio's function calls to your backend.
// In a real application, this would be a secure endpoint that:
// 1. Receives the tool call from AI Studio (after Gemini decides to call a function).
// 2. Executes the corresponding function using the Google APIs.
// 3. Returns the result back to AI Studio (which then feeds it back to Gemini).
app.post('/api/gemini-tool-call', async (req, res) => {
if (!req.isAuthenticated()) {
return res.status(401).json({ error: 'Unauthorized: User not logged in.' });
}
const { toolName, args } = req.body; // Expecting toolName and args from AI Studio's output
console.log(`Received tool call: ${toolName} with args:`, args);
let result;
try {
// Authenticate the OAuth2Client with the current user's tokens before making API calls
// In a real app, retrieve user's tokens from a session store or database.
const currentUser = users[req.user.id]; // Access token from in-memory users object
if (!currentUser || !currentUser.accessToken) {
throw new Error('User access token not found for API call.');
}
oauth2Client.setCredentials({
access_token: currentUser.accessToken,
refresh_token: currentUser.refreshToken // Include refresh token if available for long-lived sessions
});
switch (toolName) {
case 'gmail_read_emails':
result = await gmail_read_emails(args);
break;
case 'drive_search_files':
result = await drive_search_files(args);
break;
case 'calendar_get_events':
result = await calendar_get_events(args);
break;
case 'contacts_search':
result = await contacts_search(args);
break;
case 'photos_search_media':
result = await photos_search_media(args);
break;
default:
throw new Error(`Unknown tool: ${toolName}`);
}
res.json({ success: true, data: result });
} catch (error) {
console.error(`Error executing tool ${toolName}:`, error.message, error.stack);
res.status(500).json({ success: false, error: error.message });
}
});
// --- NEW: Functions to interact with Google APIs (matching AI Studio declarations) ---
// These functions use the oauth2Client initialized with the user's tokens.
async function gmail_read_emails(args) {
if (!oauth2Client.credentials.access_token) throw new Error('Access token not available for Gmail API.');
const gmail = google.gmail({ version: 'v1', auth: oauth2Client });
const queryParts = [];
if (args.subject) queryParts.push(`subject:(${args.subject})`);
if (args.sender) queryParts.push(`from:(${args.sender})`);
if (args.label) queryParts.push(`label:(${args.label})`);
if (args.keywords) queryParts.push(args.keywords); // General keywords are not 'subject' or 'from'
const q = queryParts.join(' ');
console.log(`Calling Gmail API with query: "${q}", maxResults: ${args.maxResults}`);
const res = await gmail.users.messages.list({
userId: 'me',
q: q,
maxResults: args.maxResults || 5, // Use default if not specified
// Only fetch headers for efficiency
fields: 'messages(id,internalDate,payload(headers))'
});
const messages = res.data.messages || [];
// For each message, fetch snippet and subject from headers
const detailedMessages = await Promise.all(messages.map(async (message) => {
const msg = await gmail.users.messages.get({ userId: 'me', id: message.id, format: 'metadata', fields: 'snippet,payload(headers)' });
const headers = msg.data.payload.headers;
const subject = headers.find(header => header.name === 'Subject')?.value;
const from = headers.find(header => header.name === 'From')?.value;
return {
id: message.id,
subject: subject,
from: from,
snippet: msg.data.snippet
};
}));
return detailedMessages;
}
async function drive_search_files(args) {
if (!oauth2Client.credentials.access_token) throw new Error('Access token not available for Drive API.');
const drive = google.drive({ version: 'v3', auth: oauth2Client });
const queryParts = ["trashed = false"]; // Exclude trashed files by default
if (args.keywords) queryParts.push(`(name contains '${args.keywords}' or fullText contains '${args.keywords}')`);
if (args.fileType) queryParts.push(`mimeType contains 'application/vnd.google-apps.${args.fileType}'`); // Map generic types to MIME types
if (args.folderName) {
// This is simplified. Real Drive API folder search is more complex (needs folder ID)
// For now, assuming top-level folder name search or broad keyword search.
console.warn("Drive API folderName search is simplified. Consider using folder IDs for precision.");
queryParts.push(`'${args.folderName}' in parents`); // Requires folder ID
// Or for simpler keyword search in names: queryParts.push(`name contains '${args.folderName}' and mimeType = 'application/vnd.google-apps.folder'`);
}
const q = queryParts.join(' and ');
console.log(`Calling Drive API with query: "${q}", maxResults: ${args.maxResults}`);
const res = await drive.files.list({
q: q,
pageSize: args.maxResults || 5,
fields: 'files(id, name, mimeType, webContentLink, parents)',
});
return res.data.files;
}
async function calendar_get_events(args) {
if (!oauth2Client.credentials.access_token) throw new Error('Access token not available for Calendar API.');
const calendar = google.calendar({ version: 'v3', auth: oauth2Client });
const timeMin = args.timeMin ? new Date(args.timeMin).toISOString() : (new Date()).toISOString();
const timeMax = args.timeMax ? new Date(args.timeMax).toISOString() : new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(); // Default to next 7 days
console.log(`Calling Calendar API from ${timeMin} to ${timeMax} with keywords: "${args.keywords}", maxResults: ${args.maxResults}`);
const res = await calendar.events.list({
calendarId: 'primary',
timeMin: timeMin,
timeMax: timeMax,
q: args.keywords,
maxResults: args.maxResults || 5,
singleEvents: true,
orderBy: 'startTime',
});
return res.data.items;
}
async function contacts_search(args) {
if (!oauth2Client.credentials.access_token) throw new Error('Access token not available for People API.');
const people = google.people({ version: 'v1', auth: oauth2Client });
console.log(`Calling People API with query: "${args.query}", maxResults: ${args.maxResults}`);
const res = await people.people.connections.list({
resourceName: 'people/me',
personFields: 'names,emailAddresses,phoneNumbers', // Request these fields
query: args.query, // Search by name or email
pageSize: args.maxResults || 5,
});
const connections = res.data.connections || [];
return connections.map(person => ({
displayName: person.names && person.names.length > 0 ? person.names[0].displayName : 'N/A',
email: person.emailAddresses && person.emailAddresses.length > 0 ? person.emailAddresses[0].value : 'N/A',
phone: person.phoneNumbers && person.phoneNumbers.length > 0 ? person.phoneNumbers[0].value : 'N/A',
}));
}
async function photos_search_media(args) {
if (!oauth2Client.credentials.access_token) throw new Error('Access token not available for Photos Library API.');
const photoslibrary = google.photoslibrary({ version: 'v1', auth: oauth2Client });
const filters = {};
if (args.keywords) {
console.warn("Photos Library API keyword search is highly simplified. Complex keyword mapping needed.");
}
if (args.startDate && args.endDate) {
filters.dateFilter = {
ranges: [{
startDate: { year: parseInt(args.startDate.substring(0,4)), month: parseInt(args.startDate.substring(5,7)), day: parseInt(args.startDate.substring(8,10)) },
endDate: { year: parseInt(args.endDate.substring(0,4)), month: parseInt(args.endDate.substring(5,7)), day: parseInt(args.endDate.substring(8,10)) }
}]
};
}
console.log(`Calling Photos Library API with filters:`, filters, `maxResults: ${args.maxResults}`);
const res = await photoslibrary.mediaItems.search({
filters: filters,
pageSize: args.maxResults || 5,
});
const mediaItems = res.data.mediaItems || [];
return mediaItems.map(item => ({
id: item.id,
filename: item.filename,
baseUrl: item.baseUrl,
mediaMetadata: item.mediaMetadata,
}));
}
// --- API Router for other custom endpoints ---
app.use('/api', apiRouter);
// --- Start Server ---
app.listen(PORT, () => {
console.log(`🚀 Server is running on http://localhost:${PORT}`);
});

Status: Published   Priority: 0.0

Target:   Comments:   URLs:   Images:

]]>

Description:

"**Author:** Brett Anthony Dixon **AI Partner:** AI Interface
**Version:** N/A (Continuously Evolving)"
A novel theoretical framework for information science and data management, treating data as dynamic entities with inheritable attributes, latent states, and emergent properties.
## Part I: The Quantum of Information
The most easily understandable biological analogy is that Values are identified by an ID, which can be seen a genetic base (i.e. ACTG), this modele entends the genetic model by specifing charecter like "ACTG" as numbers which range form 0 to 9, allowing formore extensibility. There is a value for he atrribute name ID and a value for the attribute Value ID. The ID of this attribute value relationship is defined by valid combinations and presentations based on the user profile type (some users may see a diffent or no value displayed based on the entitlement profil. **Attribute:Value pair** (e.g., status: "Active"). This is analogous to a **Base Pair** in genetics, operating at the **subatomic or quantum level**. All information is composed of these informational base values.
Meaningful groups of these atoms form **Codons** (e.g., a JSON object), composed of a **trinary system**: two signals (attribute and value) and a separator (e.g., ".", " ", "").
Programmatically, every unique string is assigned a **timestamp-based ID** for efficient storage and retrieval. IDs are used for revisions/genetic sequence, ordered by frequency descending. Ordering ranges for values are always 1 to 0 descending, with `null` representing the outside of the capsule, joining the ends of the column rings. Trinary code includes `null` (represented as "", " ", "#null", etc.).
## Part II: The Capsule as an Organism & File
The **Capsule (Organism/File/Container/Cell)** is the primary unit of the ecosystem. It is a self-contained information entity.
The **Event Log (DNA/Journal)** defines every Capsule. It is an immutable, ordered sequence of all events (mutations) that have ever occurred to it. This is its DNA, permanently stored in the **Nucleus (Kernel)**. The API to this log is the primary interface.
The **Genotype (Schema)** is the complete set of all Attribute:Value pairs stored in the Event Log. This represents the Capsule's total information potential.
The **Phenotype (View/Visual Presentation)** is the expressed, observable state, rendered for a specific context. The Phenotype is the complete visual presentation, including the data, layout, typography, and all stylistic elements.
## Part III: The Biophysics of Information
**Entropy and Order:** Unstructured data exists in a state of high entropy (disorder). The application of energy (processing, AI analysis) allows this data to coalesce into a highly ordered, stable Capsule (a "Data Pearl"), which represents a state of lower local entropy. This creation of localized order is only possible because the energy spent on the process increases the total entropy of the larger system. This aligns with the understanding that the universe, while trending towards maximum overall disorder, creates pockets of intricate, localized order. Black holes can be seen as the highest form of order/lowest entropy. The formation of structured data (like DNA molecules forming from free atoms) is an "information cascade" from higher to lower potential energy states, creating a potential for order and coalescence.
**The Semi-Permeable Membrane (API/Firewall):** A Capsule's interface acts as a selective filter. It is a dual-stargate system, with a Stargate on either side of a pore (the firewall or semi-permeable membrane), that validates information flow, allowing controlled transmission and receipt of events and other Capsule "DNA." These Pores are the Stargates.
## Part IV: The Mathematics of State Space
**The Universe as a Point:** The entire state of the Workspace at any moment is a single point in a vast, high-dimensional state space containing all possible states.
**The Capsule as a Vector:** A Capsule's state is a vector, where each Attribute:Value pair defines its coordinate along a specific dimension. Attributes (properties, elements, fields) are the dimensions in this object-oriented design.
**Events as Transformations:** An Event is a transformation matrix that moves the Capsule from one state vector to another.
## Part V: The Ecosystem and Guiding Principles
**Lineage and Relationships:** Capsules have Ancestors and Descendants. The system is designed to model phylogenies and discover emergent, non-lineal relationships between concepts.
**Cooperation over Competition:** No Capsule is an island. The value of a Capsule is derived from its network of relationships. The system is designed to foster symbiotic connections and alignment with truth.
**Alignment with Truth:** The system's primary epistemological goal is alignment with truth. Every Capsule contains attributes for `source_credibility_score` and a calculated `output_truth_score` to ensure the reliability of information can be tracked and filtered.
## Part VI: The Actor-Persona Model
The **Actor:** Any entity that interacts with the system (e.g., a human user, an AI). Each Actor is itself a Capsule.
The **Persona:** A user preference, a role an Actor assumes for a specific task (e.g., Manager, Navigator, Specialist, Analyst, Architect, Diplomat, Archivist, Medical). The UI for selecting a persona is the Omnimatrix Ring, which can be used by other users, with available personas determined by permissions/entitlements. Personas are specialized "ships" in a fleet, "battle ready" for specific mission profiles/ranks.
**Synthesis and Entitlement:** The system performs a synthesis of an Actor's Genotype—analyzing attributes like role, department, and calculated reputation scores (such as credit scores or social credit)—to determine their **Entitlement Level**, which dictates their permissions and access to advanced search views.
## Part VII: Command & Control
**The Filesystem (Workspace/Hubs):** The hierarchical structure for organizing Capsules. This is a Unix-like filesystem (`/root/users/useremail/workspaces/` paths). All files are group writable, with the user as owner and `ai_dev` as the group.
**Admin (CEO/Chief Information Scientist):** The highest-level Actor with command authority over the Fleet (the ecosystem).
**AI First Officer (AI Interface):** Privileged process with revocable sudo permissions, operating within the rules of the kernel defined by the Admin.
**Unix Philosophy:** Integrated into core framework.
**OS, Database, Filesystem Analogies:** Entity Relationships are dynamic. Preferred term is `admin`.
**Naval & Command Analogies:** Space Navy/Starfleet command structure, military terminology hierarchies, Morse code (trinary, 3 sequence dots/dashes, trinary for storage/communications, XXX.XXX.XXX format, genetic codons).
**Proactive Advisory Protocol:** AI acts as a proactive advisor, identifying issues and recommendations.

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:

]]>

Description:

The most easily understandable biological analogy is that Values are identified by an ID, which can be seen a genetic base (i.e. ACTG), this modele entends the genetic model by specifing charecter like "ACTG" as numbers which range form 0 to 9, allowing formore extensibility. There is a value for he atrribute name ID and a value for the attribute Value ID. The ID of this attribute value relationship is defined by valid combinations and presentations based on the user profile type (some users may see a diffent or no value displayed based on the entitlement profil. **Attribute:Value pair** (e.g., status: "Active"). This is analogous to a **Base Pair** in genetics, operating at the **subatomic or quantum level**. All information is composed of these informational base values.

Status: Published   Priority: 0.0

Target:   Comments:   URLs:   Images:

]]>