| 1 | -- Web terminals (phase 4, agentic/terminals.ts): a sandbox one person opened to work in |
| 2 | -- interactively, for example signed in to their own Claude or ChatGPT subscription. The |
| 3 | -- sandbox itself (and anything typed or shown in it) lives only in its container; this is the |
| 4 | -- index for limits, the list and expiry. |
| 5 | CREATE TABLE agent_terminals ( |
| 6 | id TEXT PRIMARY KEY, |
| 7 | repo_id TEXT NOT NULL, |
| 8 | person_id TEXT NOT NULL, |
| 9 | agent_id TEXT NOT NULL, |
| 10 | ref TEXT NOT NULL, |
| 11 | status TEXT NOT NULL, |
| 12 | sandbox_id TEXT, |
| 13 | created_at TEXT NOT NULL, |
| 14 | started_at TEXT, |
| 15 | ended_at TEXT, |
| 16 | end_reason TEXT |
| 17 | ); |
| 18 | CREATE INDEX agent_terminals_person ON agent_terminals(person_id, status); |
| 19 | CREATE INDEX agent_terminals_repo ON agent_terminals(repo_id, status); |
| 20 | |
| 21 | -- A person's opt-in to using their own provider subscription in a terminal, with the notice's version. |
| 22 | CREATE TABLE terminal_terms ( |
| 23 | account_id TEXT PRIMARY KEY, |
| 24 | version INTEGER NOT NULL, |
| 25 | opted_in_at TEXT NOT NULL |
| 26 | ); |