| 1 | -- Agent setup (lib/agent-setup.ts): Settings → Agent setup gives each person, per repository, an agent |
| 2 | -- that can only ever reach that repository, and tokens for it to paste into a cloud agent environment. |
| 3 | -- One row per such agent. The agent itself is an ordinary agent account (accounts.kind = 'agent', owned |
| 4 | -- by the person); its policy names the repository, and lib/directory.ts roleFor refuses every other one. |
| 5 | CREATE TABLE IF NOT EXISTS agent_setups ( |
| 6 | agent_id TEXT PRIMARY KEY REFERENCES accounts(id), |
| 7 | repo_id TEXT NOT NULL REFERENCES repos(id), |
| 8 | person_id TEXT NOT NULL REFERENCES accounts(id), |
| 9 | created_at TEXT NOT NULL, |
| 10 | UNIQUE (repo_id, person_id) |
| 11 | ); |
| 12 | CREATE INDEX IF NOT EXISTS agent_setups_repo ON agent_setups(repo_id); |
| 13 | |
| 14 | -- The latest report from the hosted setup script's self-test (/<owner>/<repo>/agent-setup.sh), per |
| 15 | -- repository: what the page's Check shows. `checks` is the JSON list of { name, ok, message } lines. |
| 16 | -- `first_ok_at` is when a report first passed, and stays. |
| 17 | CREATE TABLE IF NOT EXISTS agent_setup_checks ( |
| 18 | repo_id TEXT PRIMARY KEY REFERENCES repos(id), |
| 19 | at TEXT NOT NULL, |
| 20 | ok INTEGER NOT NULL, |
| 21 | account_id TEXT NOT NULL, |
| 22 | token_id TEXT, |
| 23 | checks TEXT NOT NULL, |
| 24 | cli_version TEXT, |
| 25 | first_ok_at TEXT |
| 26 | ); |