-- Gateway event journal (§13 POST /gateway). Every stream event is persisted -- here BEFORE it is emitted, so live streaming and reconnect replay -- (`resumeFrom`) read the same data and the gateway stays the single audited -- channel (§15). CREATE TABLE run_events ( run_id UUID NOT NULL REFERENCES agent_runs (id), seq BIGINT NOT NULL, event_type TEXT NOT NULL, payload JSONB NOT NULL DEFAULT '{}', created_at TIMESTAMPTZ NOT NULL DEFAULT now(), PRIMARY KEY (run_id, seq) );