@@ -5,59 +5,23 @@ import "time"
55// ActivityState is how busy the agent is, derived from its output/JSONL.
66type ActivityState string
77
8- // Activity states. WaitingInput and Blocked are sticky (see IsSticky).
8+ // Activity states. WaitingInput is sticky (see IsSticky).
99const (
1010 ActivityActive ActivityState = "active"
1111 ActivityIdle ActivityState = "idle"
1212 ActivityWaitingInput ActivityState = "waiting_input"
13- ActivityBlocked ActivityState = "blocked"
1413 ActivityExited ActivityState = "exited"
1514)
1615
1716// IsSticky reports whether an activity state must NOT be aged/demoted by the
1817// passage of time (a paused agent is still paused until a new signal says so).
1918func (a ActivityState ) IsSticky () bool {
20- return a == ActivityWaitingInput || a == ActivityBlocked
19+ return a == ActivityWaitingInput
2120}
2221
23- // ActivitySource records where an activity reading came from, so a weaker
24- // source can't override a stronger one.
25- type ActivitySource string
26-
27- // Activity signal sources, strongest first.
28- const (
29- SourceNative ActivitySource = "native"
30- SourceTerminal ActivitySource = "terminal"
31- SourceHook ActivitySource = "hook"
32- SourceRuntime ActivitySource = "runtime"
33- SourceNone ActivitySource = "none"
34- )
35-
36- // CanOverride reports whether a reading from source a may replace a current
37- // reading from source current. Unknown sources are treated as weakest.
38- func (a ActivitySource ) CanOverride (current ActivitySource ) bool {
39- return activitySourceRank (a ) <= activitySourceRank (current )
40- }
41-
42- func activitySourceRank (s ActivitySource ) int {
43- switch s {
44- case SourceNative :
45- return 0
46- case SourceTerminal :
47- return 1
48- case SourceHook :
49- return 2
50- case SourceRuntime :
51- return 3
52- default :
53- return 4
54- }
55- }
56-
57- // ActivitySubstate is the persisted activity reading: the state, when it was
58- // last observed, and which source reported it.
59- type ActivitySubstate struct {
60- State ActivityState `json:"state"`
61- LastActivityAt time.Time `json:"lastActivityAt"`
62- Source ActivitySource `json:"source"`
22+ // Activity captures the persisted activity reading: the state and when it was
23+ // last observed.
24+ type Activity struct {
25+ State ActivityState `json:"state"`
26+ LastActivityAt time.Time `json:"lastActivityAt"`
6327}
0 commit comments