@@ -360,10 +360,10 @@ Events are JSON objects with this shape:
360360
361361``` json
362362{
363- "type" : " iteration_start " ,
363+ "type" : " iteration_started " ,
364364 "run_id" : " a1b2c3d4" ,
365365 "timestamp" : " 2026-03-11T14:23:01.123456" ,
366- "data" : { }
366+ "data" : { "iteration" : 1 }
367367}
368368```
369369
@@ -375,3 +375,55 @@ ws.send(JSON.stringify({ "action": "subscribe", "run_id": "a1b2c3d4" }));
375375
376376Send ` {"action": "subscribe", "run_id": "*"} ` to receive events from all runs
377377(this is the default on connect).
378+
379+ To unsubscribe from a specific run:
380+
381+ ``` javascript
382+ ws .send (JSON .stringify ({ " action" : " unsubscribe" , " run_id" : " a1b2c3d4" }));
383+ ```
384+
385+ #### Event types
386+
387+ Every event has ` type ` , ` run_id ` , ` timestamp ` , and ` data ` . The table below lists all event types and their ` data ` fields.
388+
389+ ** Run lifecycle**
390+
391+ | Event type | When | Data fields |
392+ | ---| ---| ---|
393+ | ` run_started ` | Run begins | ` checks ` , ` contexts ` , ` instructions ` (int counts), ` max_iterations ` , ` timeout ` , ` delay ` , ` prompt_name ` |
394+ | ` run_stopped ` | Run ends for any reason | ` reason ` (` "completed" ` , ` "user_requested" ` ), ` total ` , ` completed ` , ` failed ` , ` timed_out ` |
395+ | ` run_paused ` | Run is paused | — |
396+ | ` run_resumed ` | Run is resumed | — |
397+
398+ ** Iteration lifecycle**
399+
400+ | Event type | When | Data fields |
401+ | ---| ---| ---|
402+ | ` iteration_started ` | Iteration begins | ` iteration ` |
403+ | ` iteration_completed ` | Agent exits with code 0 | ` iteration ` , ` returncode ` , ` duration ` (seconds), ` duration_formatted ` , ` detail ` , ` log_file ` |
404+ | ` iteration_failed ` | Agent exits non-zero | ` iteration ` , ` returncode ` , ` duration ` , ` duration_formatted ` , ` detail ` , ` log_file ` |
405+ | ` iteration_timed_out ` | Agent exceeds timeout | ` iteration ` , ` returncode ` (null), ` duration ` , ` duration_formatted ` , ` detail ` , ` log_file ` |
406+
407+ ** Checks**
408+
409+ | Event type | When | Data fields |
410+ | ---| ---| ---|
411+ | ` checks_started ` | Check phase begins | ` iteration ` , ` count ` |
412+ | ` check_passed ` | A single check passes | ` iteration ` , ` check_name ` , ` exit_code ` , ` timed_out ` |
413+ | ` check_failed ` | A single check fails | ` iteration ` , ` check_name ` , ` exit_code ` , ` timed_out ` |
414+ | ` checks_completed ` | All checks finish | ` iteration ` , ` passed ` , ` failed ` , ` results ` (array of ` {name, passed, exit_code, timed_out} ` ) |
415+
416+ ** Prompt assembly**
417+
418+ | Event type | When | Data fields |
419+ | ---| ---| ---|
420+ | ` contexts_resolved ` | Contexts injected into prompt | ` iteration ` , ` count ` |
421+ | ` prompt_assembled ` | Full prompt built | ` iteration ` , ` prompt_length ` |
422+
423+ ** Other**
424+
425+ | Event type | When | Data fields |
426+ | ---| ---| ---|
427+ | ` primitives_reloaded ` | Primitives re-discovered mid-run | ` checks ` , ` contexts ` , ` instructions ` (int counts) |
428+ | ` settings_changed ` | Reserved for future use | — |
429+ | ` log_message ` | General log from the engine | ` message ` , ` level ` (` "info" ` , ` "error" ` ) |
0 commit comments