Classifies every running child as idle/working/thinking/permission/error using one of three pluggable strategies (output_activity, osc_title_stability, osc_title_status) plus optional regex promoters applied to the tail of recent output. State and last-match reason are exposed via MCP on ProcessInfo and get_process_status. Per-preset configuration lives on a new preset.IdleDetection block with bundled defaults for the first-party claude/codex/opencode presets. OSC title plumbing is exposed as Emulator.Title(), polled from the session pump after each emulator write so title-change activity feeds into the classifier without an extra cgo callback. The MCP timer surface expands to match Solo: timer_set, timer_fire_when_idle_any/all, timer_cancel, timer_pause, timer_resume, timer_list. timer_wait is now a thin wrapper that shares the same manager so it shows up in timer_list while pending. Timer bodies are delivered to the owner process through the existing InjectAsOrchestrator path. Top-level (non-agent) callers can attach timers to a specific process via owner_process_id; omitting it grants universal cancel/pause/resume/list privileges. The sidebar gains a state glyph per process row and appends a nearest-timer indicator when one is pending or paused. Tests: idle_test.go covers the classify() pure function across the three strategies and regex promotion; timers_test.go covers the manager. Harness scenarios cover output_activity, osc_title_stability, osc_title_status, and regex promotion, plus timer_set delivery, cancel, pause/resume, idle_any-on-transition, idle_all-pending, and idle_all-already-satisfied. A new wait_until_mcp harness step type polls an MCP method until an assertion holds.
49 lines
1.1 KiB
JSON
49 lines
1.1 KiB
JSON
{
|
|
"name": "timer_idle_all_already_satisfied",
|
|
"presets": {
|
|
"processes": [
|
|
{
|
|
"name": "quiet",
|
|
"argv": ["sh", "-lc", "echo ready; sleep 60"],
|
|
"idle_detection": {
|
|
"strategy": "output_activity",
|
|
"idle_threshold_ms": 500
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"trust": ["quiet"],
|
|
"steps": [
|
|
{
|
|
"type": "mcp_call",
|
|
"method": "spawn_process",
|
|
"params": {"kind": "command", "preset": "quiet", "name": "quiet"},
|
|
"save_as": "proc"
|
|
},
|
|
{
|
|
"type": "wait_until_mcp",
|
|
"method": "get_process_status",
|
|
"params": {"process_id": "{{proc.process_id}}"},
|
|
"path": "idle_state",
|
|
"equals": "idle",
|
|
"timeout_ms": 4000
|
|
},
|
|
{
|
|
"type": "mcp_call",
|
|
"method": "timer_fire_when_idle_all",
|
|
"params": {
|
|
"watched": ["{{proc.process_id}}"],
|
|
"body": "all-idle",
|
|
"owner_process_id": "{{proc.process_id}}"
|
|
},
|
|
"save_as": "resp"
|
|
},
|
|
{
|
|
"type": "assert_saved",
|
|
"from": "resp",
|
|
"path": "status",
|
|
"equals": "already_satisfied"
|
|
}
|
|
]
|
|
}
|