ohwow 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-- Conversation persistence: store every message permanently (local SQLite)
|
|
2
|
+
-- Replaces the JSON blob approach in orchestrator_chat_sessions
|
|
3
|
+
|
|
4
|
+
CREATE TABLE IF NOT EXISTS orchestrator_conversations (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
workspace_id TEXT NOT NULL,
|
|
7
|
+
title TEXT,
|
|
8
|
+
source TEXT NOT NULL DEFAULT 'ohwow',
|
|
9
|
+
source_conversation_id TEXT,
|
|
10
|
+
channel TEXT, -- 'tui' | 'whatsapp' | 'telegram' | 'voice'
|
|
11
|
+
started_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
12
|
+
last_message_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
13
|
+
message_count INTEGER NOT NULL DEFAULT 0,
|
|
14
|
+
is_archived INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
last_extracted_at TEXT,
|
|
16
|
+
extraction_count INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
metadata TEXT DEFAULT '{}',
|
|
18
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CREATE INDEX IF NOT EXISTS idx_conv_workspace
|
|
22
|
+
ON orchestrator_conversations(workspace_id, last_message_at DESC);
|
|
23
|
+
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_conv_source
|
|
25
|
+
ON orchestrator_conversations(workspace_id, source);
|
|
26
|
+
|
|
27
|
+
CREATE TABLE IF NOT EXISTS orchestrator_messages (
|
|
28
|
+
id TEXT PRIMARY KEY,
|
|
29
|
+
conversation_id TEXT NOT NULL REFERENCES orchestrator_conversations(id),
|
|
30
|
+
workspace_id TEXT NOT NULL,
|
|
31
|
+
role TEXT NOT NULL,
|
|
32
|
+
content TEXT NOT NULL,
|
|
33
|
+
model TEXT,
|
|
34
|
+
token_count INTEGER,
|
|
35
|
+
metadata TEXT DEFAULT '{}',
|
|
36
|
+
source_message_id TEXT,
|
|
37
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE INDEX IF NOT EXISTS idx_msg_conversation
|
|
41
|
+
ON orchestrator_messages(conversation_id, created_at);
|
|
42
|
+
|
|
43
|
+
CREATE INDEX IF NOT EXISTS idx_msg_workspace
|
|
44
|
+
ON orchestrator_messages(workspace_id, created_at DESC);
|
|
45
|
+
|
|
46
|
+
-- FTS5 standalone table (not content-sync, since orchestrator_messages uses TEXT PK)
|
|
47
|
+
-- Manually populated via application-level inserts after message creation
|
|
48
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS orchestrator_messages_fts USING fts5(
|
|
49
|
+
message_id,
|
|
50
|
+
content
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
-- Provenance: link memories back to conversations
|
|
54
|
+
ALTER TABLE agent_workforce_agent_memory
|
|
55
|
+
ADD COLUMN source_conversation_id TEXT REFERENCES orchestrator_conversations(id);
|
|
56
|
+
|
|
57
|
+
ALTER TABLE agent_workforce_agent_memory
|
|
58
|
+
ADD COLUMN source_message_index INTEGER;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
-- Device-pinned data: manifest of what data each device holds exclusively.
|
|
2
|
+
-- Syncs metadata everywhere; actual data stays on the owning device.
|
|
3
|
+
|
|
4
|
+
CREATE TABLE IF NOT EXISTS device_data_manifest (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
workspace_id TEXT NOT NULL,
|
|
7
|
+
device_id TEXT NOT NULL,
|
|
8
|
+
data_type TEXT NOT NULL, -- 'memory' | 'conversation' | 'knowledge_doc' | 'file' | 'credential'
|
|
9
|
+
data_id TEXT NOT NULL, -- FK to the actual data row
|
|
10
|
+
title TEXT NOT NULL, -- searchable summary (never the actual content)
|
|
11
|
+
tags TEXT DEFAULT '[]', -- JSON array of keyword tags
|
|
12
|
+
size_bytes INTEGER DEFAULT 0,
|
|
13
|
+
access_policy TEXT NOT NULL DEFAULT 'ephemeral', -- 'ephemeral' | 'cached_1h' | 'cached_24h' | 'never_cache'
|
|
14
|
+
requires_approval INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
owner_user_id TEXT,
|
|
16
|
+
pinned_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
17
|
+
last_fetched_at TEXT,
|
|
18
|
+
fetch_count INTEGER NOT NULL DEFAULT 0,
|
|
19
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_manifest_data
|
|
23
|
+
ON device_data_manifest(workspace_id, data_id, device_id);
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_manifest_workspace
|
|
25
|
+
ON device_data_manifest(workspace_id);
|
|
26
|
+
CREATE INDEX IF NOT EXISTS idx_manifest_type
|
|
27
|
+
ON device_data_manifest(data_type, workspace_id);
|
|
28
|
+
|
|
29
|
+
-- Locality policy on existing tables
|
|
30
|
+
ALTER TABLE agent_workforce_agent_memory
|
|
31
|
+
ADD COLUMN locality_policy TEXT NOT NULL DEFAULT 'sync';
|
|
32
|
+
|
|
33
|
+
ALTER TABLE orchestrator_conversations
|
|
34
|
+
ADD COLUMN locality_policy TEXT NOT NULL DEFAULT 'sync';
|
|
35
|
+
|
|
36
|
+
-- Fetch approval queue
|
|
37
|
+
CREATE TABLE IF NOT EXISTS data_fetch_approvals (
|
|
38
|
+
id TEXT PRIMARY KEY,
|
|
39
|
+
manifest_entry_id TEXT NOT NULL REFERENCES device_data_manifest(id),
|
|
40
|
+
requesting_device_id TEXT NOT NULL,
|
|
41
|
+
requesting_device_name TEXT,
|
|
42
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
43
|
+
responded_at TEXT,
|
|
44
|
+
expires_at TEXT NOT NULL,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
46
|
+
);
|