mirror of
https://github.com/myronblair/jarvis
synced 2026-07-27 16:22:55 -05:00
Adopt live production state as git baseline
This commit is contained in:
+536
@@ -0,0 +1,536 @@
|
||||
/*M!999999\- enable the sandbox mode */
|
||||
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: jarvis_db
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.11.14-MariaDB-0ubuntu0.24.04.1
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `agent_commands`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `agent_commands`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `agent_commands` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`agent_id` varchar(128) NOT NULL,
|
||||
`command_type` varchar(64) NOT NULL,
|
||||
`command_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`command_data`)),
|
||||
`status` enum('pending','delivered','executed','failed') NOT NULL DEFAULT 'pending',
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`delivered_at` datetime DEFAULT NULL,
|
||||
`executed_at` datetime DEFAULT NULL,
|
||||
`result` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`result`)),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_agent_pending` (`agent_id`,`status`),
|
||||
KEY `idx_created` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `agent_metrics`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `agent_metrics`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `agent_metrics` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`agent_id` varchar(128) NOT NULL,
|
||||
`metric_type` varchar(64) NOT NULL,
|
||||
`metric_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`metric_data`)),
|
||||
`recorded_at` datetime DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_agent_time` (`agent_id`,`recorded_at`),
|
||||
KEY `idx_recorded` (`recorded_at`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31422 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `alerts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `alerts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `alerts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`alert_type` varchar(50) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`message` text DEFAULT NULL,
|
||||
`severity` enum('info','warning','critical') DEFAULT 'info',
|
||||
`resolved` tinyint(1) DEFAULT 0,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`resolved_at` timestamp NULL DEFAULT NULL,
|
||||
`source_key` varchar(100) DEFAULT NULL,
|
||||
`auto_resolve` tinyint(1) DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_source_key` (`source_key`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `api_cache`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `api_cache`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `api_cache` (
|
||||
`cache_key` varchar(100) NOT NULL,
|
||||
`data` mediumtext NOT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`cache_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `appointments`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `appointments`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `appointments` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`category` varchar(64) DEFAULT 'personal',
|
||||
`start_at` datetime NOT NULL,
|
||||
`end_at` datetime DEFAULT NULL,
|
||||
`location` varchar(255) DEFAULT NULL,
|
||||
`all_day` tinyint(1) DEFAULT 0,
|
||||
`reminder_min` int(11) DEFAULT 30,
|
||||
`alerted` tinyint(1) DEFAULT 0,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_start` (`start_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `arc_jobs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `arc_jobs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `arc_jobs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`job_type` varchar(64) NOT NULL,
|
||||
`payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`priority` int(11) DEFAULT 0,
|
||||
`status` enum('queued','running','done','failed','cancelled') DEFAULT 'queued',
|
||||
`result` longtext DEFAULT NULL,
|
||||
`error` varchar(2000) DEFAULT NULL,
|
||||
`created_by` varchar(128) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`started_at` datetime DEFAULT NULL,
|
||||
`completed_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_created` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `arc_status`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `arc_status`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `arc_status` (
|
||||
`id` int(11) NOT NULL DEFAULT 1,
|
||||
`version` varchar(20) DEFAULT NULL,
|
||||
`started_at` datetime DEFAULT NULL,
|
||||
`last_heartbeat` datetime DEFAULT NULL,
|
||||
`active_jobs` int(11) DEFAULT 0,
|
||||
`jobs_done` int(11) DEFAULT 0,
|
||||
`jobs_failed` int(11) DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `conversations`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `conversations`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `conversations` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`session_id` varchar(64) NOT NULL,
|
||||
`role` enum('user','assistant','system') NOT NULL,
|
||||
`content` text NOT NULL,
|
||||
`tokens_used` int(11) DEFAULT 0,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_session` (`session_id`),
|
||||
KEY `idx_created` (`created_at`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=335 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ha_entities`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ha_entities`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `ha_entities` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`agent_id` varchar(128) NOT NULL,
|
||||
`entity_id` varchar(255) NOT NULL,
|
||||
`entity_name` varchar(255) DEFAULT NULL,
|
||||
`domain` varchar(64) DEFAULT NULL,
|
||||
`state` varchar(255) DEFAULT NULL,
|
||||
`attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attributes`)),
|
||||
`last_changed` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_agent_entity` (`agent_id`,`entity_id`),
|
||||
KEY `idx_domain` (`domain`),
|
||||
KEY `idx_updated` (`updated_at`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=77909 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `kb_facts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `kb_facts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `kb_facts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`category` varchar(64) NOT NULL COMMENT 'e.g. system, network, proxmox, ha, weather',
|
||||
`fact_key` varchar(128) NOT NULL,
|
||||
`fact_value` text NOT NULL,
|
||||
`host` varchar(64) DEFAULT 'local',
|
||||
`expires_at` datetime DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_fact` (`category`,`fact_key`,`host`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41478 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `kb_intents`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `kb_intents`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `kb_intents` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`intent_name` varchar(64) NOT NULL,
|
||||
`pattern` varchar(512) NOT NULL COMMENT 'regex pattern to match user input',
|
||||
`response_template` text NOT NULL COMMENT 'template with {fact_key} placeholders',
|
||||
`fact_category` varchar(64) DEFAULT NULL,
|
||||
`action_type` varchar(32) DEFAULT 'response' COMMENT 'response, action, ollama, claude',
|
||||
`priority` int(11) DEFAULT 5,
|
||||
`active` tinyint(1) DEFAULT 1,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `kb_ollama_models`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `kb_ollama_models`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `kb_ollama_models` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`model_name` varchar(128) NOT NULL,
|
||||
`size_gb` decimal(6,1) DEFAULT NULL,
|
||||
`context_length` int(11) DEFAULT 4096,
|
||||
`is_active` tinyint(1) DEFAULT 0,
|
||||
`pulled_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `model_name` (`model_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `kb_preferences`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `kb_preferences`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `kb_preferences` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pref_key` varchar(128) NOT NULL,
|
||||
`pref_value` text NOT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pref_key` (`pref_key`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `known_commands`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `known_commands`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `known_commands` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`phrase` varchar(255) NOT NULL,
|
||||
`action` varchar(100) NOT NULL,
|
||||
`params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`params`)),
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `metrics_history`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `metrics_history`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `metrics_history` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`metric_name` varchar(100) NOT NULL,
|
||||
`metric_value` float NOT NULL,
|
||||
`host` varchar(100) DEFAULT 'jarvis',
|
||||
`recorded_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_metric_time` (`metric_name`,`recorded_at`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=34771 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `network_devices`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `network_devices`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `network_devices` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(45) NOT NULL,
|
||||
`mac` varchar(17) DEFAULT NULL,
|
||||
`hostname` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(100) DEFAULT NULL,
|
||||
`device_type` varchar(50) DEFAULT NULL,
|
||||
`last_seen` timestamp NULL DEFAULT NULL,
|
||||
`status` enum('online','offline','unknown') DEFAULT 'unknown',
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_ip` (`ip`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5556 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `registered_agents`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `registered_agents`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `registered_agents` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`agent_id` varchar(128) NOT NULL,
|
||||
`hostname` varchar(255) NOT NULL,
|
||||
`agent_type` enum('linux','homeassistant','proxmox','windows','macos') NOT NULL DEFAULT 'linux',
|
||||
`ip_address` varchar(45) DEFAULT NULL,
|
||||
`api_key` varchar(64) NOT NULL,
|
||||
`capabilities` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`capabilities`)),
|
||||
`version` varchar(32) DEFAULT NULL,
|
||||
`last_seen` datetime DEFAULT NULL,
|
||||
`status` enum('online','offline','unknown') NOT NULL DEFAULT 'unknown',
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_agent_id` (`agent_id`),
|
||||
KEY `idx_status` (`status`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `tasks`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tasks`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `tasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`category` varchar(64) DEFAULT 'personal',
|
||||
`priority` enum('urgent','high','normal','low') DEFAULT 'normal',
|
||||
`status` enum('pending','in_progress','done','cancelled') DEFAULT 'pending',
|
||||
`due_date` date DEFAULT NULL,
|
||||
`due_time` time DEFAULT NULL,
|
||||
`completed_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT current_timestamp(),
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_status_due` (`status`,`due_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `usage_patterns`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `usage_patterns`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `usage_patterns` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`intent_name` varchar(64) NOT NULL,
|
||||
`hour` tinyint(2) NOT NULL,
|
||||
`dow` tinyint(1) NOT NULL,
|
||||
`hit_count` int(11) DEFAULT 1,
|
||||
`last_seen` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_intent_time` (`intent_name`,`hour`,`dow`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(50) NOT NULL,
|
||||
`password_hash` varchar(255) NOT NULL,
|
||||
`display_name` varchar(100) DEFAULT 'Mr. Blair',
|
||||
`preferences` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`preferences`)),
|
||||
`last_seen` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`username`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
--
|
||||
-- Table structure for table `guardian_config`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `guardian_config` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`key_name` varchar(64) NOT NULL,
|
||||
`value` varchar(255) NOT NULL DEFAULT '',
|
||||
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_key` (`key_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `guardian_events`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `guardian_events` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`event_type` varchar(64) NOT NULL,
|
||||
`severity` enum('info','warning','critical') NOT NULL DEFAULT 'info',
|
||||
`agent_id` varchar(64) NOT NULL DEFAULT '',
|
||||
`hostname` varchar(128) NOT NULL DEFAULT '',
|
||||
`metric` varchar(64) NOT NULL DEFAULT '',
|
||||
`value` float NOT NULL DEFAULT 0,
|
||||
`threshold` float NOT NULL DEFAULT 0,
|
||||
`message` text NOT NULL,
|
||||
`ai_analysis` text NOT NULL DEFAULT '',
|
||||
`acknowledged` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_severity` (`severity`),
|
||||
KEY `idx_ack` (`acknowledged`),
|
||||
KEY `idx_created` (`created_at`),
|
||||
KEY `idx_agent` (`agent_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Dump completed on 2026-06-29 23:15:44
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `email_triage` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`msg_id` varchar(255) NOT NULL,
|
||||
`account` varchar(64) NOT NULL DEFAULT 'gmail',
|
||||
`from_name` varchar(255) DEFAULT NULL,
|
||||
`from_email` varchar(255) DEFAULT NULL,
|
||||
`subject` varchar(500) DEFAULT NULL,
|
||||
`date_received` datetime DEFAULT NULL,
|
||||
`category` varchar(32) NOT NULL DEFAULT 'info',
|
||||
`priority` int(11) NOT NULL DEFAULT 3,
|
||||
`summary` text DEFAULT NULL,
|
||||
`draft_reply` text DEFAULT NULL,
|
||||
`action_taken` varchar(32) NOT NULL DEFAULT 'none',
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uq_msg` (`msg_id`),
|
||||
KEY `idx_category` (`category`),
|
||||
KEY `idx_action` (`action_taken`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `email_actions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`msg_id` varchar(255) DEFAULT NULL,
|
||||
`from_name` varchar(255) DEFAULT NULL,
|
||||
`from_email` varchar(255) DEFAULT NULL,
|
||||
`subject` varchar(500) DEFAULT NULL,
|
||||
`received_at` datetime DEFAULT NULL,
|
||||
`suggested_title` varchar(255) DEFAULT NULL,
|
||||
`suggested_date` date DEFAULT NULL,
|
||||
`task_id` int(11) DEFAULT NULL,
|
||||
`appointment_id` int(11) DEFAULT NULL,
|
||||
`dismissed` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_dismissed` (`dismissed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `email_sent` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account` varchar(64) NOT NULL DEFAULT 'gmail',
|
||||
`to_email` varchar(255) NOT NULL,
|
||||
`to_name` varchar(255) DEFAULT NULL,
|
||||
`subject` varchar(500) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
`triage_id` int(11) DEFAULT NULL,
|
||||
`status` varchar(32) NOT NULL DEFAULT 'sent',
|
||||
`sent_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`error` text DEFAULT NULL,
|
||||
`message_id` varchar(255) DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_account` (`account`),
|
||||
KEY `idx_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,70 @@
|
||||
-- JARVIS KB Seed Data
|
||||
-- Preferences
|
||||
INSERT INTO kb_preferences (pref_key, pref_value) VALUES
|
||||
('user_name', 'Myron'),
|
||||
('user_title', 'Mr. Blair'),
|
||||
('ai_model', 'llama3.1:8b'),
|
||||
('timezone', 'America/Chicago')
|
||||
ON DUPLICATE KEY UPDATE pref_value = VALUES(pref_value);
|
||||
|
||||
-- Intents: greeting, time, system, network, proxmox, ollama, tasks, HA
|
||||
INSERT INTO kb_intents (intent_name, pattern, response_template, fact_category, action_type, priority, active) VALUES
|
||||
|
||||
-- Greetings
|
||||
('greeting', '(?i)^(hello|hi|hey|good (morning|afternoon|evening)|what.?s up|howdy)\\b', 'Good {current_time}, {user_title}. All systems are online. How can I assist you?', 'system', 'response', 10, 1),
|
||||
|
||||
-- Time / date
|
||||
('current_time', '(?i)\\b(what.?s the (time|current time)|what time is it|tell me the time)\\b', 'It is currently {current_time}, {user_title}.', NULL, 'response', 9, 1),
|
||||
('current_date', '(?i)\\b(what.?s (today.?s date|the date)|what day is it|today.?s date)\\b', 'Today is {current_date}, {user_title}.', NULL, 'response', 9, 1),
|
||||
|
||||
-- System status
|
||||
('system_status', '(?i)\\b(system (status|health)|how.?s (the system|everything)|jarvis status|all systems)\\b', 'JARVIS is fully operational, {user_title}. CPU: {cpu_usage}%, Memory: {mem_percent}% used ({mem_used_gb}GB / {mem_total_gb}GB). Disk: {disk_used} used of {disk_total}. Uptime: {uptime}. Network agents: {online_count}/{total_count} online.', 'system', 'response', 8, 1),
|
||||
('cpu_status', '(?i)\\b(cpu|processor) (usage|load|status|percent|utilization)\\b', 'Current CPU usage is {cpu_usage}%, {user_title}. Load averages: {load_1m} (1m), {load_5m} (5m), {load_15m} (15m).', 'system', 'response', 8, 1),
|
||||
('memory_status', '(?i)\\b(memory|ram|mem) (usage|status|free|used|available)\\b', 'Memory: {mem_used_gb}GB used of {mem_total_gb}GB ({mem_percent}% utilized), {user_title}. Free: {mem_free_gb}GB.', 'system', 'response', 8, 1),
|
||||
('disk_status', '(?i)\\b(disk|storage|drive) (usage|space|status|free|used|available)\\b', 'Disk status: {disk_used} used of {disk_total} total, {disk_free} free, {user_title}.', 'system', 'response', 8, 1),
|
||||
('uptime', '(?i)\\b(uptime|how long.*running|how long.*up|server uptime)\\b', 'JARVIS has been running for {uptime}, {user_title}.', 'system', 'response', 7, 1),
|
||||
|
||||
-- Network status
|
||||
('network_status', '(?i)\\b(network (status|health|agents)|agents (online|status)|how many (agents|devices) (online|running))\\b', 'Network status: {online_count} of {total_count} agents are online, {user_title}.', 'network', 'response', 8, 1),
|
||||
('network_scan', '(?i)\\b(run (a )?network scan|scan (the )?network|nmap scan|network devices)\\b', 'Initiating network scan, {user_title}.', NULL, 'action', 7, 1),
|
||||
|
||||
-- Proxmox
|
||||
('proxmox_status', '(?i)\\b(proxmox (status|health)|vm (status|count|summary)|virtual machines|how many vms)\\b', 'Proxmox: {vm_running} of {vm_total} VMs/containers running, {user_title}. Host CPU: {pve_cpu_percent}%, Memory: {pve_mem_used_gb}GB / {pve_mem_total_gb}GB ({pve_mem_percent}%).', 'proxmox', 'response', 8, 1),
|
||||
('vm_suggestions', '(?i)\\b(vm (resources|performance|usage)|check vms|resource usage)\\b', 'Checking VM resource usage, {user_title}.', 'proxmox', 'action', 7, 1),
|
||||
|
||||
-- Ollama / AI
|
||||
('ollama_status', '(?i)\\b(ollama (status|health|models)|ai models|llm status|local (ai|models))\\b', 'Ollama is {status} with {model_count} model(s) available: {available_models}, {user_title}.', 'ollama', 'response', 7, 1),
|
||||
|
||||
-- Site health
|
||||
('site_status', '(?i)\\b(site(s)? (status|health|up|down)|website status|are (the )?sites (up|down))\\b', 'Site health — jarvis: {jarvis}, orbishosting: {orbishosting}, tomtomgames: {tomtomgames}, tomsjavajive: {tomsjavajive}, parkerslingshotrentals: {parkersling}, epictravelexpeditions: {epictravelexp}, {user_title}.', 'sites', 'response', 7, 1),
|
||||
|
||||
-- Tasks / planner
|
||||
('task_count', '(?i)\\b(how many tasks|pending tasks|task (count|summary)|my tasks)\\b', 'You have {pending_count} pending tasks and {overdue_count} overdue, {user_title}.', NULL, 'response', 7, 1),
|
||||
('planner_briefing', '(?i)\\b((daily )?briefing|what.?s (on|happening) today|today.?s schedule|morning briefing)\\b', 'Fetching your daily briefing, {user_title}.', NULL, 'action', 8, 1),
|
||||
|
||||
-- Home Assistant
|
||||
('ha_lights_on', '(?i)\\b(turn (on|off) (the |all )?lights?|lights? (on|off)|switch (on|off) (the )?lights?)\\b', 'Sending light command, {user_title}.', NULL, 'action', 8, 1),
|
||||
('ha_scene', '(?i)\\b(activate (a |the )?scene|set (a |the )?scene|home scene)\\b', 'Activating home scene, {user_title}.', NULL, 'action', 7, 1),
|
||||
|
||||
-- Jellyfin
|
||||
('jellyfin_now_playing', '(?i)\\b(what.?s (playing|on)|now playing|jellyfin.*playing|playing.*jellyfin)\\b', 'Checking Jellyfin now playing, {user_title}.', NULL, 'action', 7, 1),
|
||||
('jellyfin_library', '(?i)\\b(jellyfin (library|media|shows?|movies?)|media library|show.*library)\\b', 'Fetching Jellyfin library, {user_title}.', NULL, 'action', 6, 1),
|
||||
('jellyfin_pause', '(?i)\\b(pause (jellyfin|playback|media)|stop (playing|jellyfin))\\b', 'Pausing Jellyfin, {user_title}.', NULL, 'action', 7, 1),
|
||||
|
||||
-- DO server
|
||||
('do_status', '(?i)\\b(do (server|status)|digital ocean (status|server)|vps status)\\b', 'Digital Ocean server is {do_status}, {user_title}.', 'do_server', 'response', 7, 1),
|
||||
|
||||
-- Focus / panels
|
||||
('focus_mode', '(?i)\\b(focus (mode|on)|enable focus|concentration mode)\\b', 'Enabling focus mode, {user_title}.', NULL, 'action', 6, 1),
|
||||
('show_panels', '(?i)\\b(show (all )?panels|expand (all|everything)|full view)\\b', 'Expanding all panels, {user_title}.', NULL, 'action', 6, 1),
|
||||
|
||||
-- Help
|
||||
('help', '(?i)^(help|what can you do|commands|capabilities|what do you know)\\s*\\??$', 'I can help you with: system status, network status, VM/Proxmox status, Ollama AI models, site health, tasks and planner briefings, Jellyfin media, Home Assistant lights and devices, and general questions via Ollama. What would you like to know, {user_title}?', NULL, 'response', 5, 1)
|
||||
|
||||
ON DUPLICATE KEY UPDATE
|
||||
pattern = VALUES(pattern),
|
||||
response_template = VALUES(response_template),
|
||||
active = 1;
|
||||
|
||||
SELECT COUNT(*) AS intents_seeded FROM kb_intents;
|
||||
SELECT COUNT(*) AS prefs_seeded FROM kb_preferences;
|
||||
Reference in New Issue
Block a user