-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathinit-db.sql
More file actions
202 lines (189 loc) · 9.13 KB
/
Copy pathinit-db.sql
File metadata and controls
202 lines (189 loc) · 9.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
-- Set max_connections for proper connection pool management
-- This ensures 150 connections for Python pool + 50 for buffer/overhead
SET GLOBAL max_connections=200;
-- Emotion State Table for Centralized Emotion Management
-- Stores emotional state with timestamps for decay calculation
CREATE TABLE IF NOT EXISTS emotion_state (
id INT AUTO_INCREMENT PRIMARY KEY,
emotion_name VARCHAR(100) NOT NULL,
intensity FLOAT NOT NULL DEFAULT 5.0,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_emotion_name (emotion_name),
INDEX idx_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- G.R.I.L.L.O. Beat Tracking Table
-- Generator for Reflective Inner Loop & Logical Observation
-- Stores autonomous "beat" events for SyntH's internal conscience system
CREATE TABLE IF NOT EXISTS grillo_beats (
id INT AUTO_INCREMENT PRIMARY KEY,
beat_type VARCHAR(50) NOT NULL,
next_beat DATETIME NOT NULL,
metadata JSON,
enabled BOOLEAN DEFAULT 1,
plugin_enabled BOOLEAN DEFAULT 1,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_next_beat (next_beat, enabled, plugin_enabled),
INDEX idx_beat_type (beat_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- G.R.I.L.L.O. Activity Log Table
-- Tracks execution history of all grillo beats for WebUI display
CREATE TABLE IF NOT EXISTS grillo_activity_log (
id INT AUTO_INCREMENT PRIMARY KEY,
beat_type VARCHAR(50) NOT NULL,
prompt_text TEXT NOT NULL,
response_text LONGTEXT,
diary_entry_id INT,
executed_at DATETIME DEFAULT CURRENT_TIMESTAMP,
metadata JSON,
-- Persistent counter for how many times an outbound beat was suppressed
suppressed_count INT DEFAULT 0,
INDEX idx_executed_at (executed_at DESC),
INDEX idx_beat_type (beat_type),
INDEX idx_diary_entry (diary_entry_id),
FOREIGN KEY (diary_entry_id) REFERENCES ai_diary(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Tracks action-level executions proposed/executed by Grillo (linked to grillo_activity_log)
CREATE TABLE IF NOT EXISTS grillo_action_execs (
id INT AUTO_INCREMENT PRIMARY KEY,
activity_log_id INT NOT NULL,
action_index INT NOT NULL,
action_type VARCHAR(150) NOT NULL,
payload JSON,
status ENUM('pending','processed','failed') NOT NULL DEFAULT 'pending',
error_text TEXT,
result JSON,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_activity_log_id (activity_log_id),
FOREIGN KEY (activity_log_id) REFERENCES grillo_activity_log(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- G.R.I.L.L.O. Self-Growth States Table
-- Rolling history (max 10 rows) of SyntH's evolving self-growth reflection.
-- Exactly one row has is_current = 1. Older rows beyond the newest 10 are pruned.
CREATE TABLE IF NOT EXISTS growth_states (
id INT AUTO_INCREMENT PRIMARY KEY,
content LONGTEXT NOT NULL,
created_by VARCHAR(64) NOT NULL DEFAULT 'grillo_growth',
source VARCHAR(64) NOT NULL DEFAULT 'weekly',
is_current BOOLEAN NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX idx_growth_current (is_current),
INDEX idx_growth_created_at (created_at DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Karada Touch Events Table
-- Records WebUI 3D-interaction events (environment/window taps and touches on
-- the Synth avatar) so Synth is aware of physical interaction with her Karada.
-- Environment/window rows are transient (~10 min TTL); synth_touch rows are
-- retained for a sliding 24h window for later reflection.
CREATE TABLE IF NOT EXISTS karada_touch_events (
id INT AUTO_INCREMENT PRIMARY KEY,
interface_path VARCHAR(255) NOT NULL,
session_id VARCHAR(255),
event_type VARCHAR(50) NOT NULL,
body_part VARCHAR(100),
raw_part VARCHAR(100),
username VARCHAR(255),
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
expires_at DATETIME NOT NULL,
flushed BOOLEAN NOT NULL DEFAULT 0,
attached BOOLEAN NOT NULL DEFAULT 0,
INDEX idx_kte_expires (expires_at),
INDEX idx_kte_flushed (flushed, event_type),
INDEX idx_kte_iface (interface_path)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Agent tasks table: persistent record of Agentic Runtime turns and their iterations
CREATE TABLE IF NOT EXISTS agent_tasks (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
engine VARCHAR(64),
status ENUM('pending','running','waiting_for_approval','paused','completed','failed','cancelled') NOT NULL DEFAULT 'pending',
input JSON,
iterations_meta JSON,
output JSON,
trainer_id VARCHAR(64),
metadata JSON,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_agent_status (status),
INDEX idx_agent_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Web Search Tasks: decoupled background web-search jobs triggered by the
-- recon web-search plugin. Recon fires a search and returns immediately; the
-- orchestrator runs the searches off the message pipeline, synthesises an
-- aseptic result via the cortex, and delivers it back as a second turn.
CREATE TABLE IF NOT EXISTS web_search_tasks (
id VARCHAR(64) PRIMARY KEY,
interface_path TEXT,
queries TEXT,
search_context TEXT,
status VARCHAR(16) NOT NULL DEFAULT 'pending',
result_text LONGTEXT,
error TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_web_search_status (status),
INDEX idx_web_search_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- External Endpoints: user-defined external AI service endpoints
-- (OpenAI-compatible, Gemini, Anthropic, custom)
CREATE TABLE IF NOT EXISTS external_endpoints (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
display_label VARCHAR(255) NOT NULL DEFAULT '',
protocol VARCHAR(50) NOT NULL DEFAULT 'openai',
base_url VARCHAR(1024) NOT NULL DEFAULT '',
api_key_enc TEXT,
enabled BOOLEAN NOT NULL DEFAULT 1,
capabilities JSON,
subsystem_map JSON,
available_models JSON,
models_metadata JSON,
default_model VARCHAR(255),
probe_status VARCHAR(50) NOT NULL DEFAULT 'never',
last_probe_at DATETIME,
extra_config JSON,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_enabled (enabled),
INDEX idx_protocol (protocol)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Default external endpoint: Selenium LLM Engine
INSERT IGNORE INTO external_endpoints
(name, display_label, protocol, base_url, enabled, capabilities, subsystem_map, default_model, probe_status, extra_config)
VALUES
(
'selenium-llm-engine',
'Selenium LLM Engine',
'openai',
'http://synth-selenium-llm-engine:8000',
1,
'{"llm": true, "tts": false, "stt": false}',
'{"cortex": true, "vox": false, "auris": false, "live": false}',
'gemini',
'never',
'{"timeout": 300}'
);
-- Core config table (authoritative for config_registry)
CREATE TABLE IF NOT EXISTS config (
`config_key` VARCHAR(255) PRIMARY KEY,
`value` TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('BASE_CORTEX', 'selenium-llm-engine');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('GRILLO_CORTEX', 'Default');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('TRAINER_CORTEX', 'Default');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('ACTIVE_IRIS_ENGINE', 'selenium-llm-engine');
-- Enable vision support for selenium-llm-engine which supports image uploads
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('OPENAPI_SUPPORTS_VISION', 'true');
-- Allow enough time for selenium-llm-engine queue processing
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('RESPONSE_TIMEOUT', '600');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('SOUL_PLUGIN_ENABLED', '1');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('SOUL_COMPILE_IDLE_SECONDS', '300');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('SOUL_SCHEDULER_INTERVAL_SECONDS', '60');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('SOUL_REPOSITORY_BACKEND', 'memory');
INSERT IGNORE INTO config (`config_key`, `value`) VALUES ('SOUL_POSTGRES_DSN', '');
-- Grant privileges to synth user from any host
GRANT ALL PRIVILEGES ON synth.* TO 'synth'@'%' IDENTIFIED BY 'synth';
FLUSH PRIVILEGES;