NDJSON events

When you pass --headless (or --json to streaming commands), sunscreen emits one JSON object per line on stdout. Use this for editor integrations, CI parsers, and dashboards.

Event envelope

Every event has at least:

{
  "event": "<name>",
  "ts": "2026-06-02T14:33:12.412Z"
}

Plus event-specific fields.

Build pipeline events

Emitted by chain build and the build phase of chain serve.

EventWhenFields
build_startpipeline startsframework, programs[]
build_progressstep transitionstep (anchor_build / cargo_build_sbf / codama)
build_okpipeline succeededprograms[], duration_ms
build_failpipeline failedstep, exit_code, stderr_tail

Codama events

EventWhenFields
codama_startCodama invocation beginsfrontend
codama_okclients writtenfiles_written (int), duration_ms
codama_failCodama failedexit_code, stderr_tail

Frontend notify

EventWhenFields
frontend_notifiedreload file touchedpath

Serve / watcher events

Emitted by chain serve --headless.

EventWhenFields
serve_startserver readyrpc_url, ws_url, validator
validator_logvalidator wrote a lineline (string)
watcher_batchfile changes debouncedpaths[] (relative), kind (save/delete)
pipeline_triggeredwatcher kicked a buildpaths[]
serve_stopshutdown completereason (ctrl_c/error)

Toolchain events

Emitted by any command that reaches a missing toolchain.

EventFields
toolchain_missingtool, next_step

Stability

The set of events listed here is part of sunscreen's stable API. Adding new events is non-breaking. Removing or renaming events is a breaking change handled via the SemVer policy in Roadmap.

Parsing tips

  • Treat unknown events as informational. Do not fail on new event names.
  • event is always a stable string. Use it as the discriminator.
  • Stdout is line-buffered; partial lines mean the process is still writing — wait for \n.
  • Human messages may still hit stderr — don't merge stderr into your parser.