Expand description
The team stop (kill switch) as the Cloud reports it to an engine
(GET /v1/stop, acting as the person the instance is linked to).
A stopped team’s engines get 423 team_stopped from the Cloud on its
writes, landings and Code sessions. Nothing here gates anything on this
machine: local agent tools keep working (owner decision 19.11.). This
module only reads the state for cloud status and the cloud stop
commands, and keeps the last answer of the enrolled server in
<data>/team-stop.json with the time it was read. cloud status reads
only that file (never the Cloud): the scheduler tick and the cloud stop
commands refresh it, and status names its age (age_s) and whether it is
older than two pull intervals (stale).
The Cloud answers 200 {team, stopped, since, by: {id, name}, reason, generation, role, may_stop, may_release, company?: {admin}, step_up_url?};
the instance credential names the team (no org in the route). Before any
call of /v1/stop the engine reads GET /v1/capabilities: a Cloud that
does not announce team_stop is “not offered” and hears nothing of it;
a 404 from the route reads the same (Ok(None)).
Structs§
- Team
Stop - The team stop as one answer of the Cloud, checked.
- Team
Stop Read - A kept answer of the Cloud and how old it is.
Enums§
- Cached
- What
cloud statusknows of the team stop, from the kept answer only.
Constants§
- FEATURE
- The
featuresentry of a Cloud that offers the team stop. - MAX_
ANSWER_ BYTES - Largest answer read.
- MAX_
REASON_ CHARS - Longest reason the Cloud keeps (and this engine sends).
- PATH
- The Cloud route (under
/v1):GETthe state,POST {reason}stops,DELETE {confirm, note?}releases.
Functions§
- apply
- Fill the team-stop members of
cloud status --jsonfromcached(web_origin: the web app’s origin, for the release link). Nothing for a Cloud that does not offer the stop. - below_
origin - Whether
urlis a plain link beloworigin(same scheme, host and port; no whitespace or control characters). - classify
- The state of a
GET /v1/stopanswer;Nonefrom a Cloud without the route. - decode
- The checked state of a
200answer.teamandstoppedare required; other members that are malformed are left out, never repaired. - fetch
GET /v1/stopwithclient. A401is an error, so the session mints a new token once and then reports it.- is_slug
- Whether
slughas the Cloud’s slug shape ([a-z0-9-], 1–64). - keep
- Keep
stopas the answer of the enrolled server just read (None: it does not offer the team stop). Fail-safe: a Cloud that stops offering it does not clear a kept stop of the team; that stop stays, of unknown age (sostale), until the Cloud answers the state again. - offered
- Whether the Cloud
clienttalks to offers the team stop: asksGET /v1/capabilitiesand records the answer forserver(the enrolled origin), as every feature check does. - read
- The team stop for
cloud status: the kept answer of the enrolled server, never a call of the Cloud.Nonewhen not enrolled. - refresh_
with - Ask the Cloud with
sessionand keep its answer (the tick, and thecloud stopcommands throughkeep). A failure keeps the last answer; a Cloud that does not announceFEATUREis asked nothing else. - refused
- A refusal of
/v1/stopthe team stop does not name itself, in the shared mapping of every cloud call. - safe_
text - The Cloud’s words, safe for a terminal: control characters become
spaces, at most
maxcharacters;Nonewhen nothing is left. - session
- The Cloud session of this machine for the team stop: none when
[cloud] enabled = false, not connected, or the lease lapsed (as every other cloud call off the tick).