| 1 | -- Every workspace's built-in orchestrator, @g1t (docs/WORKSPACE.md, "g1t, |
| 2 | -- the orchestrator"): an ordinary agent row marked builtin, made the first |
| 3 | -- time the workspace's agents are asked for. One per workspace. |
| 4 | ALTER TABLE agents ADD COLUMN builtin INTEGER NOT NULL DEFAULT 0; |
| 5 | |
| 6 | CREATE UNIQUE INDEX agents_builtin ON agents (workspace_id) WHERE builtin = 1; |
| 7 | |
| 8 | -- Each agent's face: the seed its generated pixel avatar is drawn from, |
| 9 | -- set from the handle when it is made. Empty on older rows: the handle. |
| 10 | ALTER TABLE agents ADD COLUMN avatar_seed TEXT NOT NULL DEFAULT ''; |
| 11 | |
| 12 | -- Agents are hired into roles, not tasks (docs/WORKSPACE.md, "Roles, not |
| 13 | -- tasks"): a title, a team (by slug) or a department label, a list of |
| 14 | -- responsibilities and the subagents they keep (JSON lists), and whether |
| 15 | -- they face the workspace's own people or customers (only `internal` yet). |
| 16 | ALTER TABLE agents ADD COLUMN title TEXT NOT NULL DEFAULT ''; |
| 17 | ALTER TABLE agents ADD COLUMN team TEXT; |
| 18 | ALTER TABLE agents ADD COLUMN department TEXT NOT NULL DEFAULT ''; |
| 19 | ALTER TABLE agents ADD COLUMN responsibilities TEXT NOT NULL DEFAULT '[]'; |
| 20 | ALTER TABLE agents ADD COLUMN subagents TEXT NOT NULL DEFAULT '[]'; |
| 21 | ALTER TABLE agents ADD COLUMN faces TEXT NOT NULL DEFAULT 'internal'; |
| 22 | |
| 23 | -- Every read tool call a reply made (docs/WORKSPACE.md, "What an agent can |
| 24 | -- and can't know", rule 7): the agent, who asked, a fingerprint of the |
| 25 | -- audience, the tool and its arguments (long text cut), and whether it was |
| 26 | -- read or withheld, with how much came back. |
| 27 | CREATE TABLE agent_tool_calls ( |
| 28 | id TEXT PRIMARY KEY, |
| 29 | reply_id TEXT NOT NULL, |
| 30 | agent_id TEXT NOT NULL, |
| 31 | workspace_id TEXT NOT NULL, |
| 32 | asked_by TEXT, |
| 33 | tool TEXT NOT NULL, |
| 34 | args TEXT NOT NULL, |
| 35 | audience_hash TEXT NOT NULL, |
| 36 | -- allowed, withheld, refused (a rail: the call budget, the hop limit, no ping-pong) or error. |
| 37 | outcome TEXT NOT NULL, |
| 38 | bytes INTEGER NOT NULL DEFAULT 0, |
| 39 | created_at TEXT NOT NULL |
| 40 | ); |
| 41 | |
| 42 | CREATE INDEX agent_tool_calls_reply ON agent_tool_calls (reply_id); |
| 43 | CREATE INDEX agent_tool_calls_agent ON agent_tool_calls (agent_id, created_at); |