| 1 | -- Sessions g1t starts on a workspace's own Anthropic account, as Claude |
| 2 | -- Managed Agents sessions (src/agent_sessions.rs). g1t runs no model: the |
| 3 | -- workspace's key does, and g1t records what the session does. |
| 4 | |
| 5 | -- The agent and environment g1t keeps on an Anthropic connection's |
| 6 | -- account, made once and updated (a new version) when what g1t asks of |
| 7 | -- them changes (`config_hash`). `skills` is JSON: g1t's own skills uploaded |
| 8 | -- there, by name, as {name: skill id}. |
| 9 | CREATE TABLE managed_agents ( |
| 10 | connection_id TEXT PRIMARY KEY, |
| 11 | agent_id TEXT NOT NULL, |
| 12 | agent_version INTEGER NOT NULL, |
| 13 | environment_id TEXT NOT NULL, |
| 14 | skills TEXT NOT NULL DEFAULT '{}', |
| 15 | config_hash TEXT NOT NULL, |
| 16 | updated_at TEXT NOT NULL |
| 17 | ); |
| 18 | |
| 19 | -- One session started, followed every minute until it ends. `session_id` |
| 20 | -- is g1t's (ses_…); `provider_session_id` Anthropic's (sesn_…). `actor` is |
| 21 | -- JSON: who started it, as whom it records. The vault and token are what |
| 22 | -- the session holds g1t's credential in, removed when it ends. `threads` |
| 23 | -- is JSON: each subagent thread's g1t session and the last event read of |
| 24 | -- it. `last_event_id` is the last event read of the session itself. |
| 25 | CREATE TABLE agent_runs ( |
| 26 | session_id TEXT PRIMARY KEY, |
| 27 | workspace TEXT NOT NULL, |
| 28 | repo TEXT NOT NULL, |
| 29 | issue INTEGER NOT NULL, |
| 30 | connection_id TEXT NOT NULL, |
| 31 | actor TEXT NOT NULL, |
| 32 | provider_session_id TEXT NOT NULL, |
| 33 | vault_id TEXT, |
| 34 | token_id TEXT, |
| 35 | -- running or ended. |
| 36 | status TEXT NOT NULL DEFAULT 'running', |
| 37 | last_event_id TEXT, |
| 38 | threads TEXT NOT NULL DEFAULT '{}', |
| 39 | -- Its last message: what it reports when it ends. |
| 40 | result TEXT, |
| 41 | created_at TEXT NOT NULL, |
| 42 | synced_at TEXT NOT NULL |
| 43 | ); |
| 44 | CREATE INDEX agent_runs_running ON agent_runs (status, synced_at); |
| 45 | CREATE INDEX agent_runs_by_provider ON agent_runs (provider_session_id); |