Expand description
Long-running auto-update task + one-shot CLI helpers.
After the WS migration the runtime owns just two background
tasks: the WebSocket session (ws::session::spawn_ws_session,
which subsumes heartbeats, claim/accept/complete, fail, and log
shipping) and the auto-updater (spawn_auto_updater). Per-tick
helpers from the old polling loops are gone.
Structs§
- Current
Job - Job in flight right now. Populated by the WS session before dispatch, cleared once the job finishes (success or failure).
- Heartbeat
Status - Loop
Schedule - Schedule for the auto-updater loop. The WS session has its own
SessionSchedule(seews::session). - Recent
Job - One finished job, retained in the recent-jobs ring for the UI.
- Register
Args - Bundle of flags from
studio-worker register. - Worker
Observers - Bundle of in-process observation slots the WS session writes to and
the optional native UI reads from.
Defaultgives empty slots so existing (headless) call sites stay one-liners. Cheap to clone — every field is anArc.
Enums§
- Auto
Update Decision - What the auto-updater decided this tick.
- Heartbeat
Outcome - Result of the most recent heartbeat the WS session sent.
- JobOutcome
- Outcome a finished job ended with. Failures carry the human reason (already surfaced to logs + Sentry).
Constants§
- AUTO_
UPDATE_ TICK - HEARTBEAT_
INTERVAL - Default WS heartbeat interval, re-exported here so the native UI
(and any other downstream readers) get a stable constant without
reaching into
ws::session. - PROMPT_
PREVIEW_ CHARS - Prompt previews stored in
CurrentJob/RecentJobare clipped to this many chars so the in-memory state stays bounded even when LLM prompts are huge. - RECENT_
JOBS_ CAP - Maximum number of finished jobs kept in
WorkerObservers::recent_jobs. Older entries fall off the back of the ring.
Functions§
- auto_
update_ tick - build_
capabilities - check_
update - ensure_
registered - Loop auto_register::tick on a 30s cadence until
worker_id+auth_tokenare populated (Approved) or the operator rejects. - format_
check_ outcome - format_
status - is_
unsupported_ kind - log_
startup_ banner - Emit a one-shot startup banner so operators can confirm which
config the worker actually loaded. Without this the only thing in
journalctl -u studio-workeron a healthy boot is whatever the loops happen to log on their first tick. - prompt_
for - push_
log - record_
recent_ job - register
- Persist registration metadata for the next launch. No HTTP — the
auto-register orchestration inside
run/uiis the only thing that talks to the studio. - run
- run_
loops - Spawn the WS session + auto-updater, wait for them. Pulled out of
runso tests can drive with a different schedule. - set_
enabled - set_
threshold - show_
config - spawn_
auto_ updater - status
- truncate_
prompt