loomrail 0.1.0 → 0.1.3

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,36 @@
1
+ -- Level 1 Agent Run Activity: prunable, non-authoritative diagnostic record of what a provider
2
+ -- reported doing. Unlike `events` and `workspace_tool_calls` this table is deliberately mutable and
3
+ -- prunable: a terminal report updates the row its start created, and the oldest rows are evicted
4
+ -- once a run passes its bound. Nothing here is evidence.
5
+ CREATE TABLE agent_run_activity (
6
+ id TEXT PRIMARY KEY,
7
+ schema_version INTEGER NOT NULL CHECK (schema_version = 1),
8
+ project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE RESTRICT,
9
+ work_item_id TEXT NOT NULL REFERENCES work_items(id) ON DELETE RESTRICT,
10
+ agent_run_id TEXT NOT NULL REFERENCES agent_runs(id) ON DELETE RESTRICT,
11
+ provider_session_id TEXT NOT NULL REFERENCES provider_sessions(id) ON DELETE RESTRICT,
12
+ seq INTEGER NOT NULL CHECK (seq > 0),
13
+ action_key TEXT NOT NULL CHECK (length(action_key) BETWEEN 1 AND 200),
14
+ provider TEXT NOT NULL CHECK (provider IN ('CODEX', 'CLAUDE_CODE')),
15
+ kind TEXT NOT NULL CHECK (kind IN ('TOOL_CALL', 'AGENT_TEXT', 'FILE_CHANGE', 'PROVIDER_ERROR')),
16
+ label TEXT CHECK (label IS NULL OR length(label) BETWEEN 1 AND 500),
17
+ detail TEXT CHECK (detail IS NULL OR length(detail) BETWEEN 1 AND 2000),
18
+ status TEXT CHECK (status IS NULL OR length(status) BETWEEN 1 AND 120),
19
+ truncated INTEGER NOT NULL CHECK (truncated IN (0, 1)),
20
+ observed_at TEXT NOT NULL,
21
+ UNIQUE (provider_session_id, action_key),
22
+ UNIQUE (agent_run_id, seq)
23
+ ) STRICT;
24
+
25
+ CREATE INDEX agent_run_activity_run_idx
26
+ ON agent_run_activity(agent_run_id, observed_at, id);
27
+
28
+ -- Per-run counters the entries themselves cannot carry: how many were evicted, and whether the
29
+ -- recorder ever failed to write. Both are shown to the owner rather than hidden.
30
+ CREATE TABLE agent_run_activity_state (
31
+ agent_run_id TEXT PRIMARY KEY REFERENCES agent_runs(id) ON DELETE RESTRICT,
32
+ schema_version INTEGER NOT NULL CHECK (schema_version = 1),
33
+ next_seq INTEGER NOT NULL CHECK (next_seq > 0),
34
+ omitted_count INTEGER NOT NULL CHECK (omitted_count >= 0),
35
+ degraded INTEGER NOT NULL CHECK (degraded IN (0, 1))
36
+ ) STRICT;