Lightweight coding agent that runs in your terminal
Rust
CREATE TABLE thread_realtime_items (
thread_id TEXT NOT NULL,
item_id TEXT NOT NULL,
rollout_ordinal INTEGER NOT NULL,
created_at_ms INTEGER NOT NULL,
item_type TEXT NOT NULL,
item_json TEXT NOT NULL,
PRIMARY KEY (thread_id, item_id)
);
CREATE UNIQUE INDEX idx_thread_realtime_items_page
ON thread_realtime_items(thread_id, rollout_ordinal);
CREATE INDEX idx_thread_realtime_items_boundary
ON thread_realtime_items(thread_id, rollout_ordinal)
WHERE item_type IN ('realtime_session_started', 'realtime_session_closed');
CREATE TRIGGER thread_realtime_items_projection_cleanup
AFTER DELETE ON thread_history_projection_state
BEGIN
DELETE FROM thread_realtime_items WHERE thread_id = OLD.thread_id;
END;