Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

19 linesCodeBlameRaw
1-- ?1 the repositories' ids as a JSON array. Each person's root sessions
2-- (a subagent is its parent's) in each repository over its whole history,
3-- by harness: when they first started one and how many, under the name on
4-- their latest session there. Agents and g1t are left out by the caller
5-- (signals.rs `is_person`).
6WITH r AS (
7 SELECT repo_id, actor_id, actor_name, harness, started_at FROM sessions
8 WHERE repo_id IN (SELECT value FROM json_each(?1)) AND parent_id IS NULL
9),
10-- The name on each one's latest session (SQLite takes the bare column from
11-- the row MAX picks).
12named AS (
13 SELECT repo_id, actor_id, actor_name, MAX(started_at) FROM r GROUP BY repo_id, actor_id
14)
15SELECT r.repo_id, r.actor_id AS owner_id, named.actor_name AS owner_name, r.harness,
16 MIN(r.started_at) AS first_at, COUNT(*) AS sessions
17FROM r JOIN named ON named.repo_id = r.repo_id AND named.actor_id = r.actor_id
18GROUP BY r.repo_id, r.actor_id, r.harness
19ORDER BY r.repo_id, first_at, r.harness