Skip to main content

Module auto_register

Module auto_register 

Source
Expand description

Auto-register state machine — the only registration path.

On first launch the worker POSTs /workers/register-request to the studio with a self-generated install id + a registration secret (only its SHA-256 hash leaves the box), then polls /workers/register-requests/<id> every 30s for the operator’s decision. On Approved we persist worker_id + auth_token to config.toml and fall through to the normal heartbeat / claim loops. On Rejected we surface the reason; the user clears state with studio-worker register --reset to retry.

tick() does at most one HTTP round-trip per call so the outer orchestrator can sleep between polls. All persistence goes through config::save so a crash mid-flight leaves consistent on-disk state.

Enums§

RegistrationState
What tick() returns + what the UI Status tab reads. Distinct from the persisted config fields, which carry the raw building blocks (install_id, registration_request_id, …).

Functions§

shared_initial
tick
One iteration of the state machine.

Type Aliases§

SharedRegistration
Shared in-memory mirror of RegistrationState for the UI to read (the persisted source of truth is Config).