refactor(features,service): an agent's status is read by one pure rule the desktop can run

Merged
CH
5d ago
+355-116

Stack 2 · Task list and automations, piece 1 (bottom, base main).

What: the service's agent status rule moves to @luke/features/coding-agent-status as a pure function of the newest turn and the instant read at, so a desktop reading an agent's live rows can apply the same rule. The rule covers:

  • the starting grace;
  • the line grace;
  • the opener a turn took;
  • a session ended for good;
  • an agent started blank (completed, with no clock edge).

statusClockEdge gives the next instant the clock alone moves a status. The service's codingAgentStatusOf, lineAwaitsTurn and statusClockEdge now read through it, with no behaviour change, and CODER.STARTING_GRACE/LINE_GRACE derive from its constants.

Tests: coding-agent-status.test.ts covers both graces and their edges, a Stop stamp, an awaiting line, an opener, a session ended for good, and an agent started blank.