feat: add archived run timeline

Squash merge PR #113 after resolving the project changelog conflict with current dev. Local checks passed: Go store/http/gateway/agent/pipeline tests, SQLite-tagged tests, both Go builds, web Vitest, and web build. PR CI run 26705098712 passed release-versioning, go, and web.
This commit is contained in:
Duy /zuey/ authored and GitHub committed 2026-05-31 13:22:07 +07:00
1 parent 990fabf94b
commit 269e2618ae
49 files changed
+2791 -145

No files matched your search

+36
View File
@@ -591,6 +591,42 @@ CREATE INDEX IF NOT EXISTS idx_traces_team ON traces(team_id, created_at DESC) W
CREATE INDEX IF NOT EXISTS idx_traces_tenant ON traces(tenant_id);
CREATE INDEX IF NOT EXISTS idx_traces_tenant_time ON traces(tenant_id, created_at DESC);
-- ============================================================
-- Table: run_timeline_items
-- ============================================================
CREATE TABLE IF NOT EXISTS run_timeline_items (
id TEXT NOT NULL PRIMARY KEY,
tenant_id TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
run_id TEXT NOT NULL,
session_key TEXT NOT NULL,
agent_id TEXT REFERENCES agents(id) ON DELETE SET NULL,
user_id TEXT,
channel TEXT,
chat_id TEXT,
seq INTEGER NOT NULL,
item_type TEXT NOT NULL,
status TEXT,
title TEXT,
preview TEXT,
content TEXT NOT NULL DEFAULT '',
tool_name TEXT,
tool_call_id TEXT,
trace_id TEXT REFERENCES traces(id) ON DELETE SET NULL,
span_id TEXT REFERENCES spans(id) ON DELETE SET NULL,
metadata TEXT NOT NULL DEFAULT '{}',
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
UNIQUE (tenant_id, run_id, seq)
);
CREATE INDEX IF NOT EXISTS idx_run_timeline_run_seq
ON run_timeline_items (tenant_id, run_id, seq);
CREATE INDEX IF NOT EXISTS idx_run_timeline_session_time
ON run_timeline_items (tenant_id, session_key, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_run_timeline_trace
ON run_timeline_items (tenant_id, trace_id)
WHERE trace_id IS NOT NULL;
-- ============================================================
-- Table: spans
-- ============================================================