-- Per-user saved terminal tab layout for an agent: the named tabs and the tmux -- session each maps to, so a user can restore "their" terminal — the same tabs -- and sessions — after logging out and back in (even on another device). The -- live shell state resumes only while the agent's terminal container is alive; -- this preserves the tab/session mapping regardless. CREATE TABLE terminal_tabs ( user_id UUID NOT NULL REFERENCES users (id) ON DELETE CASCADE, agent_id UUID NOT NULL REFERENCES agents (id) ON DELETE CASCADE, workspace_id UUID NOT NULL REFERENCES workspaces (id) ON DELETE CASCADE, layout JSONB NOT NULL, updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), PRIMARY KEY (user_id, agent_id) );