| 1 | -- Personal agents (docs.g1t.sh/guides/agents/, "Personal agents"): any |
| 2 | -- member may create an agent of their own, which only they talk to, in |
| 3 | -- their direct message with it, and whose spend counts against their |
| 4 | -- budget. Owners keep the workspace's agents, and promote a personal one |
| 5 | -- to a workspace agent. |
| 6 | |
| 7 | -- `workspace` or `personal`. Every agent so far is the workspace's. |
| 8 | ALTER TABLE agents ADD COLUMN scope TEXT NOT NULL DEFAULT 'workspace'; |
| 9 | -- For a personal agent: the member it belongs to, by user id (what chat |
| 10 | -- names the asker by) and username (what lists show). |
| 11 | ALTER TABLE agents ADD COLUMN owner_id TEXT; |
| 12 | ALTER TABLE agents ADD COLUMN owner_username TEXT; |
| 13 | |
| 14 | CREATE INDEX agents_personal ON agents (workspace_id, owner_id, archived_at) WHERE owner_id IS NOT NULL; |
| 15 | |
| 16 | -- Whether members who aren't owners may create personal agents: on unless |
| 17 | -- an owner turns it off. |
| 18 | ALTER TABLE agent_policies ADD COLUMN members_create_agents INTEGER NOT NULL DEFAULT 1; |