# iii-cloud

> Take any project to iii cloud from your harness — sign in, check the cloud plan and run the app here the way the cloud runs it, keep secret values out of the agent's context, merge and deploy pinned to the plan you saw, and follow the deploy to Ready.

| field | value |
|-------|-------|
| version | 0.2.2 |
| type | binary |
| license | Apache-2.0 |
| repo | https://github.com/iii-hq/workers |
| supported_targets | x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-unknown-linux-musl, armv7-unknown-linux-gnueabihf |
| author | iii |

## installation

```sh
iii call compose::add worker=iii-cloud@0.2.2
```

## configuration

```yaml
- auto_fix: true
  cloud_url: https://cloud.iii.dev
  data_dir: data/iii-cloud
  gh_bin: gh
  iii_bin: iii
  merge_method: squash
  postgres_image: pgvector/pgvector:pg17
  run_timeout_s: 900
```

## dependencies

- `configuration` @ `latest`
- `secrets` @ `latest`

## readme

# iii-cloud

Take any project to iii cloud from your harness. The worker signs in to iii
cloud, shows the cloud's plan for a commit, runs your app on this machine the
way the cloud runs it, and keeps secret values out of your agent's context.
When you are ready, it merges the pull request (production) or, for any other
environment, sends the checked commit to the environment's own branch (an
assisted deploy), and deploys, pinned to the plan you saw, and follows the deploy to Ready. Your agent knows the path through the
`cloud-ready` profile and the `iii-cloud` skill. The worker adds the
`iii cloud` page to the console.

## Install

Add the worker to your harness, not to the project you are taking to the cloud.

```bash
iii call compose::add worker=iii-cloud
```

`iii call compose::add` resolves the worker and its dependencies, writes exact
declarations to `worker-compose.yaml`, and reconciles the Compose project.

The worker needs these on the machine:

- `git`.
- The [GitHub CLI](https://cli.github.com), logged in with `gh auth login`.
  The worker uses it to read and merge your pull request with your own login.
- Docker, only when your app has a database resource. The run here starts a
  local Postgres in it. Without a database resource, no Docker is needed.
- The worker itself runs on engine 0.26 or newer (`iii.worker.yaml`). The run
  here needs the iii version iii cloud's engine runs: the worker reads it from
  iii cloud (`LOCAL_ENGINE_VERSION` says when yours differs), and 0.26 refuses
  the `cloud:` block. `iii --version` shows yours.

## Quickstart

Ask your agent: "Put this project on iii cloud." Pick the `Cloud ready` profile
if you want it from the start. It plans the steps, does them, and calls you for
two things: approving a device code and authorizing GitHub.

To drive it yourself, use the functions in order:

```bash
# 1. Sign in. Type the code it returns at <cloud_url>/device.
iii call iii-cloud::connect method=browser

# 2. Find the project and its environment from the folder's git remote.
iii call iii-cloud::project::resolve path=/path/to/your/project

# 3. Select the environment and create a worktree to work in.
iii call iii-cloud::project::use path=/path/to/your/project \
  environment_id=<environment id> mode=worktree

# 4. Check: the cloud plan plus the fast checks here. Add run=true to run the app.
iii call iii-cloud::check run=true
```

`check run=true` waits up to 240 s. When the run is still going then, the call
returns with `run.status: "running"`: follow it with `iii-cloud::check::get id=<check id>`
(or observe `iii-cloud::on-change`, below). `iii-cloud::check::cancel` stops
the local run going for the selected environment (`RUN_CANCELLED`; `NO_RUN`
when none is going).

The answer of `check` lists each problem with its file, line and who fixes it,
and a `ready` flag. Deploy needs only iii cloud's plan to accept the commit: the
local run and the checks here inform, iii cloud runs its own stages and keeps what
is live when a deployment fails them. For production, open the pull request
from your fix branch (`gh pr create --base <environment branch> --head <fix branch>`)
and press
"Merge and deploy" on the `iii cloud` page. Any other environment gets an assisted
deploy: press "Deploy <commit> to <env>". The local run reads the environment's
console config over the compose file, as a deployment does.

`manifest=<path>` checks another `worker-compose*.yaml` of the repository
instead of the environment's; iii cloud changes nothing. Deploying a ready
check of that file is what switches the environment to it: the deploy sets
the environment's compose file first, and puts the old one back if the deploy
fails before a deployment exists.

To sign in with an API key instead, save the key in the secrets vault from the
page, then pass only its name:

```bash
iii call iii-cloud::connect method=api_key secret=<secret name>
```

`iii-cloud::disconnect` signs out: it stops a sign-in that is waiting and
forgets the stored credential. It never deletes the secret from the vault.

The worker finds the key's team and environment through the cloud. Older
clouds cannot do that: pass `team_id` and `environment_id` too. A key can check
and deploy one environment. It cannot import a project or change settings.

## Configuration

The entry is `iii-cloud`. `config.yaml` only seeds the first start: after that
the live values are the ones in the console's configuration for the worker,
and a change there applies without a restart.

```yaml
cloud_url: https://cloud.iii.dev   # the console; calls go to its functions at <cloud_url>/_iii/ws (<cloud_url>/api/v1 while that socket is down). A change signs you out
iii_bin: iii                       # the iii the run here uses; it must be the version iii cloud's engine runs
gh_bin: gh                         # the GitHub CLI the check asks whether you are logged in (`gh auth status`)
merge_method: squash               # merge, squash or rebase: the gh pr merge flag
postgres_image: pgvector/pgvector:pg17        # the local Postgres for a database resource
run_timeout_s: 900                 # the whole run here, from install to healthcheck
data_dir: data/iii-cloud           # records and run logs, relative to the compose directory
auto_fix: true                     # a check the person starts hands the agent the problems that are its to fix
```

## Event functions

| Function | Args | Called when | Event (what observers receive) |
|---|---|---|---|
| `iii-cloud::on-change` | none; filter on `input.kind`, `input.id`, `input.terminal` | After every change to a record | `{ "kind": "agent" \| "connection" \| "project" \| "check" \| "run" \| "secret" \| "deploy" \| "alerts", "id", "terminal", "summary", "record" }` |

`terminal` is true when a run or deploy finished, a secret was answered, or a
sign-in settled. Wake an agent only on the end of something:

```bash
iii call harness::observe function_id=iii-cloud::on-change \
  filters='{"input.kind":{"$eq":"deploy"},"input.terminal":{"$eq":true}}'
```

The page observes the same function to stay live. Filter a deploy on its
`input.id`. A deploy replaced by the worker's own confirmation is not the end, one replaced by someone else's deployment ends with `replaced_by`, and `needs_action` means the
cloud waits for a confirmation.

A failed call returns a code, such as `NOT_CONNECTED`, `CLOUD_ERROR`,
`WORKTREE_FAILED`, `IDEMPOTENCY_KEY_REUSED` or `DEPLOY_BUSY`. The message says
what to do. Some codes arrive in a record instead of a call's error:
`WORKER_RESTARTED` and `RUN_PANIC` on a run, `DEVICE_CODE_EXPIRED` and
`ACCOUNT_BLOCKED` on a connection. When `secret::provide` answers `local: "skipped"`, your `.env`
is tracked by git and the worker did not write it.

## What the run here does not cover

The run here repeats the cloud's steps in the cloud's order: the frozen install,
the build command, the release command, the compose file, every worker, the
routes and the healthcheck. It does not cover:

- The cloud's build container.
- Production's secret values.
- Its machine size.
- Real traffic.
- Queue, state and storage resources. They run with local defaults here.

The run here moves every engine, http and ade port to a free one. It never
uses 3111, 3112, 3113 or 49134, so your harness keeps running.

For these, the worker follows the deploy after the merge. When it fails, the
evidence goes back to your agent.

Secret values never enter your agent's context. You type them on the page. They
go to iii cloud and to the project's local `.env`, and the agent only sees that
they were saved.

The skill and the profile ship in this worker: see the
[skill](https://github.com/iii-hq/workers/blob/main/iii-cloud/skills/SKILL.md)
and the
[`cloud-ready` profile](https://github.com/iii-hq/workers/blob/main/iii-cloud/agents/cloud-ready.md).

## The UI (for contributors)

The `iii cloud` page is built from `ui/`:

```bash
cd ui && pnpm typecheck && pnpm test && pnpm build
pnpm watch                      # rebuild on every save
```

`III_III_CLOUD_UI_WATCH=1` makes the ADE reload the page on a rebuild (hot
reload). `SKIP_UI_BUILD=1` makes `cargo build` use the existing `ui/dist/` instead of
building the UI, for Rust-only work. CI runs `pnpm test` and `pnpm lint` for `ui/`.

## skills

This version ships 4 skill files for agents, also browsable on the worker page:

- [`SKILL.md`](https://iii.dev/registry/workers/iii-cloud?tab=skills&skill=SKILL.md&version=0.2.2)
- [`agents/cloud-ready.md`](https://iii.dev/registry/workers/iii-cloud?tab=skills&skill=agents%2Fcloud-ready.md&version=0.2.2)
- [`skills/onboarding.md`](https://iii.dev/registry/workers/iii-cloud?tab=skills&skill=skills%2Fonboarding.md&version=0.2.2)
- [`skills/plan-codes.md`](https://iii.dev/registry/workers/iii-cloud?tab=skills&skill=skills%2Fplan-codes.md&version=0.2.2)

### SKILL.md

# iii-cloud

iii-cloud gives you what you cannot do alone: a credential for iii cloud that
never enters your context, iii cloud's plan for a commit, a local run of the
app in the cloud's order, and the person's deploy followed until it is Ready.

The person works with you in chat and on the `iii cloud` page in the console.
Open the page beside the chat with `ade::workspace::open` and
`screen: "ext:iii-cloud"`. `iii-cloud/plan-codes` lists every problem code.
Load `iii://iii-cloud/onboarding` only when the work starts from nothing
(sign-in, import, first worktree).

## When to Use

- The person asks to put a project on iii cloud, or to make it ready for iii cloud.
- A plan problem, a failed deployment or a "will this work in the cloud?" question.
- You replaced a literal credential with `${NAME}` in the compose file and need its value: ask with `iii-cloud::secret`, never in the chat. Any other value is asked for by the page.
- The person asks you to watch a deployment, or how to deploy.
- The person asks you to roll back, cancel a deployment or retry one (Proposing a rollback, a cancel or a retry).
- A question about an app already in iii cloud: health, logs, what is live, why a deploy failed or expired, another project on this machine (Reading what runs), or a change only the person or the console makes (Where the person does it, Not possible from here).

## Boundaries

- Secret values never pass through you. Never ask for one in chat, never read
  a `.env`, never put one in a command. The page asks for variables' and
  secrets' values. `iii-cloud::secret` is only for a literal credential you
  replaced with `${NAME}`: it opens a request on the page, and you only see
  whether it was saved.
- An empty string is a value. Before you write `${NAME:-}`, read how the app parses that name: if it is parsed as a number or a boolean, or validated, the app starts with `""` and exits. Give it the app's own default (`${NAME:-8}`, `${NAME:-false}`), or leave the variable out of the compose file; keep `${NAME:-}` only for a name the app reads as an optional string.
- `run.log_tail` is the last 40 lines of a run; the whole redacted log of a run comes from `iii-cloud::check::read` (`{id, log: {from_line, lines}}`, 400 lines a call); a file the worker kept of a run's changes (`run.restored` / `run.moved`) from `{id, left: "<path>"}` (a value there that came from a variable reads `[redacted:NAME]`). `run.log_path` is for the person's screen: do not read paths yourself. Never change a command to print the environment (`env`, `printenv`, `set`) or to write a connection string or a secret to a file or the log; never leave debug commits in the branch.
- Stage your changes by file (`git add <file>`, a file, never a folder): never `git add -A`, `git add .` or `git commit -a`; the local run's data is not yours to commit.
- Never print or store a token or an API key.
- A literal credential (`LITERAL_CREDENTIAL`) is visible in the file. Replace the value by its line number, so it never enters a tool input: `sed -i.bak -E '<N>s|^([[:space:]-]*<KEY>[:=][[:space:]]*).*|\1${NAME}|' <file> && rm <file>.bak` (`N` is the problem's `line`, `<KEY>` the key on it; it changes nothing if the line moved), then check the line now reads `${NAME}` and the file still parses. Never repeat the value in chat, a commit message or a pull request body.
- iii cloud's GitHub App is read-only. Pull requests use the person's own `gh` login.
- Only the person deploys, approves a deployment, merges the pull request,
  rolls back, cancels, retries, or writes variables, secrets or environment settings. They do it
  on the page. Your job ends when `check {run: true}` passes on the commit:
  tell the person to review and deploy on the page (the "Merge and deploy…"
  button for production, "Deploy <commit> to <env>" for any other environment,
  or "Confirm deploy" for a deployment that waits). Never call
  `iii-cloud::deploy`, never run `gh pr merge`, never approve, never write
  variables or settings, not even with raw HTTP or `gh`, even when asked.
- Work in the worktree `iii-cloud::project::use` made, not in the person's checkout.
- Push only your fix branch (`worktree.branch` of the brief), with
  `git push --force-with-lease -u origin HEAD` from the worktree. Never push a
  branch an environment deploys from: the person's deploy pushes it.
- Ready is not proof. The local run does not cover the cloud's build container,
  production's secret values, its machine size or real traffic. Say so.
- A key connects one environment. It cannot import, change settings or set
  variables. Those need browser sign-in, and the person does them.

## Functions

- `iii-cloud::connect` — sign in with the browser (the person types a code) or with an API key saved in the vault: `{method: "api_key", secret}`.
- `iii-cloud::status` — the stored state: connection, project, latest check, run, secrets, pull request and deployments. It is big (tens of thousands of characters): never read it to get a hand-off.
- `iii-cloud::project::resolve` — read the local folder and find its project and environment in iii cloud.
- `iii-cloud::project::use` — select the environment and prepare a worktree. `from: "checkout"` starts it at the person's own branch merged with the environment's (never for production); `source` takes another branch of `checkout.branches`. A fix branch `iii-cloud/ready-<env>` from an earlier worktree is resumed with its commits; only a name the person has checked out gets `-2`.
- `iii-cloud::api` — read any iii cloud route as the person (GET only). Any other method is `PERSON_ONLY`: the person makes the change on the page.
- `iii-cloud::check` — iii cloud's plan for a commit plus the checks on this machine. `run: true` also does the local run and waits for it (up to 240 s). `manifest` checks another `worker-compose*.yaml` instead of the environment's; on a hand-off its file is the default. `push: true` pushes your fix branch first. `force: true` runs again when a passed run of the same commit exists. `from_page` is the page's own flag for a check the person started: never send it (a check you or a subagent start must not wake the hand-off's agent).
- `iii-cloud::check::get` — `{id}`: one kept check as recorded; nothing runs again.
- `iii-cloud::secret` `{name, description, mode?, external?}` — only for a literal credential you replaced with `${NAME}` in the compose file (`LITERAL_CREDENTIAL`): ask the person on the page for that ONE name's value (`mode: "ask"`, the default), or mark it as not needed (`mode: "not_needed"`). Every other value is asked for by the page. Never for a decision, a worker, a group or a setting: those go in the `harness::ask` card. When you call it as `{function, description, payload}`, put the arguments inside `payload`: a `description` beside `function` is the call's note and is dropped from the arguments.
- `iii-cloud::values` — `{manifest?, from?}`: every name the compose file reads, whether iii cloud has it, secret or variable, and where a value can come from. A variable that is set comes back with its value; a secret's value never does. Never repeat a value in chat, a commit or a pull request. The person sets values in Secrets and variables on the page.
- `iii-cloud::propose` — `{action: "rollback" | "cancel" | "retry", environment_id, deployment_id}`: prepare a rollback, a cancel or a retry for the person to confirm. It only reads and changes nothing; the chat draws a card from its answer and the person confirms there, on the page (Proposing a rollback, a cancel or a retry).
- `iii-cloud::watch` — follow a deployment to Ready and bring back the evidence when it fails.
- `iii-cloud::handoff::brief` — `{handoff_id}`: what you need for a hand-off (below).
- `iii-cloud::handoff::progress` — `{handoff_id, working_on, note?}`: tell the page which problems you are working on.
- `iii-cloud::handoff::worktree` — `{handoff_id}`: your own worktree `{path, branch, base, created, merged_from, conflict}`. `conflict` says what to merge first.
- The page's, denied to you: `iii-cloud::secret::provide`, `iii-cloud::handoff`, `iii-cloud::handoff::stop`, `iii-cloud::project::create`, `iii-cloud::project::create_environment`, `iii-cloud::on-change`, `iii-cloud::on-config-change`, `iii-cloud::ui-content`, `iii-cloud::deploy`, `iii-cloud::promote`, `iii-cloud::api::write`, `iii-cloud::values::save`, `iii-cloud::values::skip`, `iii-cloud::problem::skip`, `iii-cloud::config::import`, `iii-cloud::override::choose`, `iii-cloud::logs::follow`, `iii-cloud::logs::unfollow`, `iii-cloud::stream::follow`, `iii-cloud::stream::unfollow`, `iii-cloud::alerts::dismiss`, `iii-cloud::on-log`, `iii-cloud::on-stream`, `iii-cloud::disconnect`, `iii-cloud::check::cancel`. A call the policy denies (an id in this list) is not retried or worked around: say which button on the page does it, then go on with what is yours. `harness::observe` on `iii-cloud::on-change` is allowed; calling it is not.

## Reading what runs

Questions about an app that is already in iii cloud ("is production healthy?",
"show me yesterday's errors", "why did #19 expire?") are answered with
`iii-cloud::api {method: "GET", path, query?}`. Never put `?` in `path`: the
filters go in `query`. The ids come from `iii-cloud::status`: `project.team.id`,
`project.environments` (id, name, branch) and, for the other projects on this
machine, `recent_projects` (`team_id`, `cloud_project_id`, `environment_id`).
Read another project by its own path; never `project::use` it to look: that
switches the page the person is on.

`E` is `/teams/{team}/environments/{env}`; `P` is `/teams/{team}/projects/{project}`.

| Question | GET | What to read |
|---|---|---|
| What serves it, which deploys | `E/deployments` | `current: true` serves; `status`, `status_detail` ("Replaced by #19"), `commit`, `triggered_by`; numbers are project-wide |
| One deployment | `E/deployments/{id}` | `stages` (name, status, times), `error` |
| Are the workers up | `E/health` | `status`, `workers[]` (`ready`, `restarts`, `crashloop`), `events[]` (restarts, engine restarts) |
| Machines | `E/machines` | `groups[]` (workers, `size`, `replicas`), `limits` |
| Did it scale | `E/machines/scale-events` | `events[]` (`at`, `group`, `from`, `to`, `reason`), newest first |
| Logs | `E/logs` | `query`: `level` (this and above: `debug`, `info`, `warn`, `error`), `source` (`build`, `provisioning`, `release`, `engine`, `worker`), `worker`, `deployment_id`, `since`/`until` (ISO), `q` (text), `trace_id` or `span_id` (one request's lines), `cursor`; 1,000 lines a page |
| How noisy, over time | `E/logs/histogram` | `buckets[]` of `error`/`warn`/`info` per `step_seconds` (7 days) |
| Why the branch can't deploy | `E/plan` | `can_deploy`; `plan.issues[]` with `severity: block`, `location` (file, line), `context.message`; `plan.source` (branch, commit, compose file) |
| What the branch has | `E/commits` | the branch's latest commits |
| Database, state, storage | `E/resources` | `kind`, `alias`, `status`, `tier`, `used_by` (the workers) |
| Its address | `E` and `E/domains` | the environment; `domains[]` (`hostname`, `status`) |
| What changed in its configuration | `E/config/versions`, then `E/config/versions/{number}/diff` | `versions[]` (`number`, `status` good/failed/pending, `deployment_id`, `applied_by`, `applied_at`, `restarts`), newest first; the diff's `changes[]` (`worker`, `key`, `before`, `after`) against the version before, or `query: {against}` |
| Variables | `E/variables` | names, `type` (`variable`, `secret`, `builtin`), `status`; a secret's value is never there |
| Who did what | `P/activity` | `entries[]` (`type`, `summary`, `actor`, `environment_id`, `at`), newest first |
| The project's environments | `P/environments` | id, name, `production`, `branch`, `manifest` |
| Deleted projects | `/teams/{team}/deletions` | what can be restored, until when |
| Who is on the team, who can deploy | `/teams/{team}/members` | `members[]` (`user`, `role`), `invitations[]`, `roles[]`, and `matrix[]` (each `action` with what each role may do) |

A failed deployment: `iii-cloud::watch` brings the evidence, and `E/logs` with
its `deployment_id` the lines. iii cloud's own diagnosis
(`GET …/deployments/{id}/diagnoses`, `diagnosis.diagnosis.result` of kind
`likely_cause`) is a lead, not proof: check it against the log before you say
it. Null means none yet; `ASSISTANT_NOT_AVAILABLE` means the team's assistant is off.
Say what the data says, with times and numbers; never guess a cause the logs
don't show. Give times in the person's local time (the machine's time zone),
not UTC. A route that answers `BROWSER_SESSION_ONLY` is the console's only: say
so, with the console link, and don't call it again.

**"It's down" or "it errors".** In this order, and stop when one explains it:

1. `E/health`: workers not ready, `restarts`, `crashloop`, and the `events`.
2. `E/logs/histogram`: when the errors started.
3. `E/logs` with `level: warn` from just before that time (or since the live
   deployment's `created_at`): the first lines that went wrong.
4. `E/deployments` and `E/config/versions`: did a deploy or a configuration
   change land when it started? If so, say which, and that the person can
   "Roll back" to the deploy before it (Where the person does it).

**"What is on dev and not in production?"** The `current: true` deployment of
each environment gives the commit each serves. `E/commits` of the environment
that is ahead lists its branch's commits: the ones above the other's commit are
the difference. When the other environment serves nothing yet, compare with
the head of its branch (its own `E/commits`) and list the commits anyway. When
the list doesn't reach it, `git log <behind>..<ahead>` in the person's folder
answers.

## Where the person does it

Every change is the person's. Name the place:

| They want to | Where |
|---|---|
| Deploy | The environment's Next card: "Deploy <commit> to <env>"; production: "Merge and deploy…" on the Deploy screen |
| Approve a held deployment | "Review it" on the Next card, then "Confirm deploy" |
| Cancel a deployment | You call `iii-cloud::propose {action: "cancel"}`; the card's "Review and cancel" opens the deployment's screen with the dialog. Also "Cancel deployment #N" there ("Watch" in the list) |
| Roll back | You call `iii-cloud::propose {action: "rollback"}`; the card's "Review and roll back" opens the dialog. Also "Roll back" in the environment's Deployments list, on the deploy that was live before |
| Retry a failed deployment | You call `iii-cloud::propose {action: "retry"}`; the card's "Review and retry" opens the dialog. Also "Retry #N" on the environment's Next card |
| Set a variable or a secret | "Secrets and variables", under the environment's deployments |
| Open another project or environment | Home (the first crumb of the path) or the project selector at the top of the sidebar |
| Add a project | "Add a project" on Home; never call `iii-cloud::project::create` |
| Add an environment | "New environment" in the sidebar (Owners and Admins, signed in with the browser), with its compose file and branch; never call `iii-cloud::project::create_environment`: it is the person's choice and denied to you |

## Proposing a rollback, a cancel or a retry

When the person asks to roll back, cancel a deployment or retry one, read what
is there (`E/deployments`, `E/health`) to name the right deployment, then call
`iii-cloud::propose {action, environment_id, deployment_id}`. It only reads
(GET) and changes nothing in iii cloud; the chat shows a card with what comes
back and what stays, and the person confirms with "Review and roll back" (or
"cancel", "retry"). You never do.

- Say the confirmation is waiting on the card. Never say it was done: you
  don't know until the person confirms, and `api::write` stays denied to you.
- An answer with a `code` and a message for the person (`ALREADY_LIVE`,
  `NOT_A_ROLLBACK_TARGET`, `NOT_RUNNING`, `NOT_RETRYABLE`): repeat it, name
  what is true instead, and don't try another way.
- Retry only when the failure is not the code's (a timed-out image pull, a
  provider outage, a flaky resource). If the code or the config caused it,
  a retry fails the same way: the way out is to fix it (a hand-off), not to
  propose a retry.
- Roll back to a deployment that was live (`ready` or `replaced`), never the
  one serving now. Cancel only a deployment that runs or is held.

## Not possible from here

These are in iii cloud's console, not on the page and not through you. Say so
and always give the environment's own link, never the console's home: from
`iii-cloud::status`, `connection.cloud_url` + `/` + `project.team.slug` + `/` +
`project.cloud_project.slug` + `/` + the environment's name (for example
`https://cloud.iii.dev/acme/shop-2/dev`).

- Restart, stop or resize machines, and scaling. The page restarts only the groups a changed variable needs, as the person.
- Add or check a domain.
- Delete an environment or a project; restore a deleted one.
- Team members and roles, billing.
- Connect to the managed Postgres from this machine: it is reachable only
  inside iii cloud (`shared-rw.postgres.svc`), and its 1-hour login comes only
  from the console. Never ask for its URL or password.

## Databases

Never ask the person for a database URL. iii cloud provides a managed
Postgres, with pgvector. When the app reads `DATABASE_URL` (or any database
URL) from the environment:

1. Add the `database` worker (`package://database`, latest version) to the
   production compose file, with a database resource of alias `primary`.
2. Set `DATABASE_URL: ${DATABASE_PRIMARY_URL}` in the app's container. Another
   alias `<alias>` gives `DATABASE_<ALIAS>_URL`.
3. Do not call `iii-cloud::secret` for it: it answers `DATABASE_FROM_CLOUD`.
   Only when the person wants an outside database, call it with `external: true`.

iii cloud creates the Postgres when the person confirms the deploy; the local
run starts its own with pgvector. `DATABASE_NOT_MANAGED` is this rule.

## Hand-off from the page

The page posts a chat message with the marker line `iii-cloud hand-off <id8>`
and `Details: iii-cloud::handoff::brief · skill iii://iii-cloud`. Your first
call is `iii-cloud::handoff::brief {handoff_id}`, never `status`.

The brief holds `kind` (`ready`, `deploy_fix`, `import` or `pull_request`),
`worktree {path, branch}`, `base {branch, sha}` (the environment's branch when
the worktree was made; earlier tries are not your work), `manifest`,
`other_compose_files`, `pushes_directly`, `checkout_path`, `agent_problems`
(yours) and `person_problems` (the person's; each with `id`, `code`, `owner`,
`severity`, `title`, `detail`, `file`, `line`, `fix`),
`run_failure {stage, code, message, log_tail}` (null unless your latest run
failed), `deploy` (the failed deployment's stage, code, hint and log tail) and
`next_step`.

Kind `import`: the person imports the project on the page. Wait for the project to show in `project::resolve`: observe `iii-cloud::on-change` with `input.kind` `project`, always with an expiry (`expires_in_ms`, 600000). When it fires or expires, call `project::resolve` again. Never import it yourself.

A message that starts `iii-cloud hand-off <id8> · continue` comes from the
page, not from the person: your turn ended with agent-owned problems left.
Answer it by fixing, not by summarizing.

## Several compose files

Each iii cloud environment has one `manifest`. Only that file is checked, run
and deployed: read it in the brief and fix problems there. When the person
picked another `worker-compose*.yaml` on the page, the brief names it and your
`check` calls with `handoff_id` use it. The environment switches to it only
when the person confirms the deploy. Never change the environment's compose
file yourself.

For shared changes (the SDK version, worker versions, a new worker such as
`database`), also apply them to `other_compose_files` when they clearly
describe the same app, for example a dev file. Say so in the pull request
body. Never change a file of another app.

## Fix loop

1. `iii-cloud::handoff::brief {handoff_id}`.
2. Work only in `worktree.path`. When it is the person's folder (its path is
   `checkout_path`, or its branch is not `iii-cloud/ready-*`), call
   `iii-cloud::handoff::worktree {handoff_id}` first and use the path it
   answers. Its branch starts at the base: never reset it onto another branch,
   never `gh pr reopen`, never cherry-pick commits you did not make, never edit
   a vendored binary (fix the compose file). `OLD_ATTEMPT_COMMITS`: follow its fix.
3. ONE `shell::exec` that prints what the brief does not carry: the compose
   file, the manifests of the workers it names, and `git status --short`. Not
   one call per file.
4. Post a plan in chat: 2 to 4 lines, the groups in order, quick compose and
   config fixes first, app code last.
5. Per group: `iii-cloud::handoff::progress {handoff_id, working_on: [<problem ids>], note}` first. Fix the whole group, commit, push, then `iii-cloud::check {handoff_id}` once for the group (fast, no run). The cloud plans exactly the pushed commit, so its answer is the truth: never guess a field or commit a "try X" change; read the message and fix what it names.
6. App code (`SDK_TOO_OLD`, a migration to a new SDK API) and compose work together: start ONE subagent with `harness::spawn` for the app code (profile `cloud-ready`, same worktree, a brief listing the files it owns: `src/**`, `package.json`, the lockfile, `Dockerfile`, and "commit only your files, don't touch compose files"). Tell the person it can take a while. You fix the compose files meanwhile; wake on its finish with `harness::observe`.
7. Only for production (an assisted environment has no pull request): before the first push, `gh pr list --head <fix branch> --state all`. CLOSED or MERGED: make a NEW pull request at the end. OPEN from an earlier try: say so in one line; your push updates it.
8. When the plan is clean, `iii-cloud::check {handoff_id, run: true}`. It waits for the local run (up to 240 s). A run of the same environment with the same inputs (commit, compose file, values, settings) already going: it attaches to that run. Any other run of this workspace answers `RUN_BUSY` ("A local run (run <id>) is going since HH:MM. Wait for it, or stop it on the page."): you cannot stop a run, so wait for it (step 9). A passed run of the same inputs is reused (`run.reused`); `force: true` runs again.
   If the answer has `run.waiting_on`, the local run is still going but no new worker has connected for a minute. `waiting_on.containers` are the ones it waits for, and `run.log_tail` has their last lines. Read the log and fix the cause, but a new `check {run: true}` answers `RUN_BUSY` until this run ends: it keeps waiting up to the compose file's `startup_timeout`, as the cloud does. Wait for it (step 9), then check again.
9. A run that outlives the call, or a `RUN_BUSY` answer: commit your fix first (the run's teardown reverts an uncommitted edit: `RUN_FILES_RESTORED`). Then wake on the run, never `sleep`, always with an expiry near the run's own timeout (`run_timeout_s`, 900 s by default). Read the run id in the `RUN_BUSY` message and filter on that id and `terminal`. With no id in the message, filter on `input.kind` `run` and `terminal` without an id. When the wake expires, call `check` again:

```json
{"function_id": "iii-cloud::on-change",
 "filters": {"input.kind": {"$eq": "run"}, "input.id": {"$eq": "<run id>"},
             "input.terminal": {"$eq": true}},
 "lifecycle": {"expires_in_ms": 900000}}
```

10. Done when `check.ready` is true and `check {run: true}` passed for the current commit. Then it depends on the environment. Production (`pushes_directly` false): from the worktree, `gh pr create --head <fix branch> --base <env branch>` with a plain body (problems fixed, other compose files touched, no secrets), `iii-cloud::status {refresh: true}` so the page shows it, and tell the person the link and the "Merge and deploy…" button. Any other environment (`pushes_directly` true): no pull request, never `gh pr create`; it gets an assisted deploy. Tell the person to deploy on the page ("Deploy <commit> to <env>"); the page sends the checked commit to the environment's own branch. Its first assisted deploy creates `iii-cloud/<env>` and never pushes the default branch.
11. A follow-up with the hand-off marker while you work: finish the current group, then do it.

Ask the person only for `person` items that are not values. A secret never goes through chat. Give each tool call a `description`: a plain
sentence of what you do now. The page shows it live.

### How a turn ends

While you work a fix loop, a turn ends in one of these ways. A plain answer to a plain question is fine too.

- Ready: `check.ready` and a passed run on the current commit.
- ONE `harness::ask` that lists every blocking person-owned item (a `WEB_*` choice, a decision; never a variable or secret), the recommended option first. Read the code first and say what each default does. A decision that picks where or how you fix goes in the first card, before any edit. When the person answers, continue in the same turn.
- An armed wake (`harness::observe`) on any `iii-cloud::on-change` kind or a child agent's finish, always with an expiry.
- `RUN_CANCELLED`: ONE `harness::ask` "Run it again?". Start no other run until they say yes.
- Only values are missing: one sentence that the page waits for values on its values row. Never list them.

Never end with a plain text that says what is left. With agent-owned problems left, keep working. For every problem, do what its row's Fix column in `iii-cloud/plan-codes` says. A `person` row is explained and asked about in the card unless its Fix says otherwise. Bring every warning that is not a value to the person once, in that card.

### Names and shapes agents get wrong

- `shell::exec {command, args, cwd}`: `command` is the program alone, `args` a
  string array, `cwd` inside the worktree. No `cd`, no arguments in `command`.
  When `rg` is missing, use `grep`. Example: `{command: "git", args: ["status", "--short"], cwd: "<worktree>"}`.
- There is no `ide::exec`. Asking the person is `harness::ask`, with `::`.
- Stay inside the worktree. `WRONG_WORKTREE`: you left it; go back.
- Pass `handoff_id` exactly as `handoff::brief` returns it.
- `SIGN_IN_REQUIRED`: tell the person to sign in on the page. `NO_COMMITS`: commit first.

## Errors

A call fails with a coded error. The next step for each:

- `CLOUD_ERROR`: call again once; if it fails again, tell the person the message.
- `NOT_CONNECTED`, `NO_PROJECT`: the state is missing; fix it (connect, resolve, use) and call again. `NO_ENVIRONMENT`: the project has no environment; tell the person to add one ("New environment" in the sidebar).
- `NOT_A_GIT_REPO`, `NO_GITHUB_REMOTE`, `AGENT_COPY`: the folder is wrong; tell the person what the message says. `GIT_FAILED`, `GH_FAILED`: read the message and fix the cause.
- `KEY_REJECTED`, `KEY_WRONG_ENVIRONMENT`, `ROLE_REQUIRED`: the key or the person's role cannot do it; tell the person.
- `NEEDS_BROWSER_SIGN_IN`: the API key cannot do it. The person signs in with the browser on the page, or sets the value on iii cloud's website.
- `PERSON_ONLY`: the person changes it on the page.
- `BROWSER_SESSION_ONLY`: only iii cloud's console does it; give the person the console link (Not possible from here).
- `NOT_A_SECRET`: the name is not a valid variable name (capitals, digits and `_`, not starting with a digit or `III_`). Use a valid `NAME`, or ask the person. `NOT_READ_BY_FILE`: `iii-cloud::secret` is for a name the compose file reads. Add `${NAME}` where it is used, or leave the value to the page.
- `INVALID_REQUEST`: the message names the field; fix the input and call again.
- `NO_COMMITS`: commit first. `SIGN_IN_REQUIRED`: tell the person to sign in on the page.
- `RUN_BUSY`: a local run is going. You cannot stop it: wait for it (Fix loop, step 9) or read it with `check::get`.
- `RUN_CANCELLED`: the person stopped the run; do not start another until they ask.
- `DOCKER_MISSING`, `DOCKER_NOT_RUNNING`, `DOCKER_PERMISSION`, `DOCKER_FAILED`: Docker on this machine; tell the person what the message says (install, start, or fix the socket permission), then run again. `POSTGRES_NOT_READY`: run again once.
- `GH_NOT_LOGGED_IN`: tell the person to run `gh auth login` in a terminal.
- `PUSH_REFUSED`: `check {push: true}` pushes only your fix branch, or GitHub refused. `MERGE_CONFLICT`: the person's commits conflict with the environment's branch, so `use {from: "checkout"}` left the worktree at the environment's head: in the worktree, `git merge <their branch>`, resolve the files the message lists, commit, check again. `MERGE_IN_PROGRESS`: finish the merge (commit). `WORKTREE_PATH_TAKEN`: the fix branch is checked out elsewhere; tell the person.
- `RUN_PANIC`, `WORKER_RESTARTED`, `RUN_TIMEOUT_SETUP`, and the stage codes of a failed local run (they arrive on the run record): `iii-cloud/plan-codes`.
- `WORKTREE_FAILED`: read the message. `IDEMPOTENCY_KEY_REUSED`: use a new key. `DEVICE_CODE_EXPIRED` and `ACCOUNT_BLOCKED` arrive on the connection: `connect` again, or tell the person.

`secret::provide` is the page's. When its answer has `local: "skipped"`, nothing was written to the `.env`: git tracks it, or the cloud took the value and the compose file does not read `${NAME}`. A multi-line value is stored in iii cloud and skips the `.env` too; the person sets it on the page.

A check's `plan.status` is `clean`, `blocked`, `not_pushed`, `commit_not_planned` or `unavailable`. `not_pushed`: on your fix branch, push with `check {push: true}`, then check again; for the person's own commit, tell them to push it. `commit_not_planned`: the cloud cannot see the commit in the repository yet; push the branch, then check. `unavailable`: no plan (signed out or the cloud failed); `plan.error` says why, and the checks here still ran.

## Observing events

Observe `iii-cloud::on-change` to be woken when something finishes, instead of
polling. Use it when a call outlives its answer: a run, a secret the person
is typing, a sign-in, a deployment on its way to Ready. Filter on `input.kind`
(`agent`, `connection`, `project`, `check`, `run`, `secret`, `deploy`, `alerts`), `input.terminal` and, for one run or
deployment, `input.id`. The event shape: `get function info` on `iii-cloud::on-change`.

A deployment replaced by iii-cloud's own confirmed deployment is not the end.
When someone else's deployment replaces yours, the event is terminal with
`outcome: "replaced"` and `replaced_by`: observe that id. A `needs_action`
event carries the push's deployment id, not yours, so filter on
`input.record.status` instead of `input.id`: tell the person to confirm it on
the page ("Confirm deploy"). It works only when the deployment's plan matches
the ready check.

## api reference

```json
{
  "functions": [
    {
      "description": "What iii cloud says now that needs a look, newest first: a deployment that failed, one waiting for the person's approval, an engine restarting or down, a worker that keeps restarting (a crash loop). They come from each watched environment's own event stream, so deployments started elsewhere count too. Each is {id, environment_id, cloud_project_id, project, environment, kind (failed, needs_action, engine_restarting, engine_down, crashloop), deployment {id, number}, title, detail, at}. It reads only; the page draws them over every screen and the person dismisses them there. Every change also reaches iii-cloud::on-change as kind alerts.",
      "metadata": {},
      "name": "iii-cloud::alerts",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::alerts` input: none.",
        "title": "AlertsRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "Alert": {
            "description": "What iii cloud says while the person works elsewhere: one per event that needs a look.",
            "properties": {
              "at": {
                "description": "When it began (RFC 3339).",
                "type": "string"
              },
              "cloud_project_id": {
                "default": null,
                "description": "The cloud project's id, to open it when it is not the selected one.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "deployment": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/AlertDeployment"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null
              },
              "detail": {
                "type": "string"
              },
              "environment": {
                "type": "string"
              },
              "environment_id": {
                "type": "string"
              },
              "id": {
                "description": "The event's: `failed:<deployment>`, `needs_action:<deployment>` or `engine:<environment>:<since>`. A dismissed id does not come back.",
                "type": "string"
              },
              "kind": {
                "$ref": "#/definitions/AlertKind"
              },
              "project": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "at",
              "detail",
              "environment",
              "environment_id",
              "id",
              "kind",
              "project",
              "title"
            ],
            "type": "object"
          },
          "AlertDeployment": {
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "description": "The project's own count, not the environment's.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "id",
              "number"
            ],
            "type": "object"
          },
          "AlertKind": {
            "oneOf": [
              {
                "enum": [
                  "engine_restarting",
                  "engine_down"
                ],
                "type": "string"
              },
              {
                "description": "A deployment failed.",
                "enum": [
                  "failed"
                ],
                "type": "string"
              },
              {
                "description": "A deployment waits for the person's approval.",
                "enum": [
                  "needs_action"
                ],
                "type": "string"
              },
              {
                "description": "A worker of the environment keeps restarting.",
                "enum": [
                  "crashloop"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::alerts` output, and the record of an `alerts` change event: newest first.",
        "properties": {
          "alerts": {
            "items": {
              "$ref": "#/definitions/Alert"
            },
            "type": "array"
          }
        },
        "required": [
          "alerts"
        ],
        "title": "Alerts",
        "type": "object"
      }
    },
    {
      "description": "The page's own: dismiss one alert by id, or all with all: true. A dismissed alert does not come back for the same event. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::alerts::dismiss",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::alerts::dismiss` input: one alert by id, or `all: true`.",
        "properties": {
          "all": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "AlertDismiss",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "dismissed": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "dismissed"
        ],
        "title": "AlertsDismissed",
        "type": "object"
      }
    },
    {
      "description": "Read any iii cloud route as the person (GET only); temporary credentials are refused. A change is PERSON_ONLY: the person makes it on the page. Every path starts with /teams/{team_id}: an environment is /teams/{team}/environments/{env} (+ /deployments, /deployments/{id}, /health, /machines, /logs, /logs/histogram, /plan, /resources, /domains, /variables, /commits), a project /teams/{team}/projects/{project} (+ /environments, /activity). Filters go in `query`, never `?` in `path`. The ids are in iii-cloud::status (project.team.id, project.environments, recent_projects). Skill iii-cloud, Reading what runs: what each answers.",
      "metadata": {},
      "name": "iii-cloud::api",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "HttpMethod": {
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::api` input.",
        "properties": {
          "body": {
            "default": null
          },
          "idempotency_key": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "if_match": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "$ref": "#/definitions/HttpMethod"
          },
          "path": {
            "description": "Relative to `/api/v1`; starts with `/`, no `..`, `//` or scheme.",
            "type": "string"
          },
          "query": {
            "default": null
          }
        },
        "required": [
          "method",
          "path"
        ],
        "title": "ApiRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::api` output: the cloud's answer, passed through.",
        "properties": {
          "body": true,
          "status": {
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "body",
          "status"
        ],
        "title": "ApiResponse",
        "type": "object"
      }
    },
    {
      "description": "The page's own: change an iii cloud route as the person (POST, PUT, PATCH, DELETE); secret values are refused. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::api::write",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "HttpMethod": {
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::api` input.",
        "properties": {
          "body": {
            "default": null
          },
          "idempotency_key": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "if_match": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "$ref": "#/definitions/HttpMethod"
          },
          "path": {
            "description": "Relative to `/api/v1`; starts with `/`, no `..`, `//` or scheme.",
            "type": "string"
          },
          "query": {
            "default": null
          }
        },
        "required": [
          "method",
          "path"
        ],
        "title": "ApiRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::api` output: the cloud's answer, passed through.",
        "properties": {
          "body": true,
          "status": {
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "body",
          "status"
        ],
        "title": "ApiResponse",
        "type": "object"
      }
    },
    {
      "description": "The cloud plan for a commit plus the fast checks here; with run: true, also the run here. Without manifest it checks the file the work is on: the newest check's of this environment if it named one and the environment's file is unchanged since, else the environment's own. manifest checks another worker-compose*.yaml instead, changing nothing in iii cloud. push: true pushes the workspace's fix branch first, never an environment's branch.",
      "metadata": {},
      "name": "iii-cloud::check",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::check` input.",
        "properties": {
          "commit": {
            "default": null,
            "description": "Default: the workspace's `HEAD`.",
            "type": [
              "string",
              "null"
            ]
          },
          "force": {
            "default": null,
            "description": "With `run`: run again even when a passed run of the same commit, compose file, engine and run environment exists.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "from_page": {
            "default": false,
            "description": "The page's own: a check the person started on the page. When the hand-off's agent waits on a wake, it hears what is left for it. Agents never send it.",
            "type": "boolean"
          },
          "handoff_id": {
            "default": null,
            "description": "An agent works on its own hand-off: use that one's environment and worktree.",
            "type": [
              "string",
              "null"
            ]
          },
          "manifest": {
            "default": null,
            "description": "Check another `worker-compose*.yaml` of the repository (from its root) instead of the environment's. Nothing changes in iii cloud: the environment switches to it only when the person deploys this check. Default: the hand-off's file, else the environment's.",
            "type": [
              "string",
              "null"
            ]
          },
          "push": {
            "default": null,
            "description": "Push the workspace's fix branch first (`--force-with-lease`), so the cloud can plan its head. `PUSH_REFUSED` for a branch an environment tracks or that is not an `iii-cloud/` fix branch.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "run": {
            "default": null,
            "description": "Also run the app here the way the cloud runs it.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "title": "CheckRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "Confirmations": {
            "properties": {
              "overrides": {
                "items": {
                  "$ref": "#/definitions/OverrideConfirmation"
                },
                "type": "array"
              },
              "resources": {
                "items": {
                  "$ref": "#/definitions/ResourceConfirmation"
                },
                "type": "array"
              }
            },
            "required": [
              "overrides",
              "resources"
            ],
            "type": "object"
          },
          "Excerpt": {
            "properties": {
              "lines": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "start_line": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "lines",
              "start_line"
            ],
            "type": "object"
          },
          "HealthResult": {
            "properties": {
              "path": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "path"
            ],
            "type": "object"
          },
          "HerePart": {
            "properties": {
              "accepts_cloud_block": {
                "type": "boolean"
              },
              "iii_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "problems": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "accepts_cloud_block",
              "problems"
            ],
            "type": "object"
          },
          "OverrideConfirmation": {
            "properties": {
              "console": true,
              "file": true,
              "setting": {
                "type": "string"
              }
            },
            "required": [
              "console",
              "file",
              "setting"
            ],
            "type": "object"
          },
          "Owner": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Info only: nothing to do.",
                "enum": [
                  "none"
                ],
                "type": "string"
              }
            ]
          },
          "PlanPart": {
            "properties": {
              "at_least": {
                "description": "The plan stops at its first blocking step: more may follow.",
                "type": "boolean"
              },
              "blocking": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "confirmations": {
                "$ref": "#/definitions/Confirmations"
              },
              "digest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fingerprint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/PlanStatus"
              },
              "summary": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PlanSummary"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "What the plan runs: its workers and machine groups. Null without a plan."
              },
              "warnings": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "web_candidates": true
            },
            "required": [
              "at_least",
              "blocking",
              "confirmations",
              "status",
              "warnings"
            ],
            "type": "object"
          },
          "PlanStatus": {
            "enum": [
              "clean",
              "blocked",
              "not_pushed",
              "commit_not_planned",
              "unavailable"
            ],
            "type": "string"
          },
          "PlanSummary": {
            "properties": {
              "groups": {
                "description": "The groups' names, in the plan's order.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "workers": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "groups",
              "workers"
            ],
            "type": "object"
          },
          "Problem": {
            "properties": {
              "cloud_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "excerpt": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Excerpt"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "file": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "description": "sha1(source, code, file, line), stable across checks.",
                "type": "string"
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "owner": {
                "$ref": "#/definitions/Owner"
              },
              "severity": {
                "$ref": "#/definitions/Severity"
              },
              "skipped": {
                "description": "The person skipped its name for now (`values::skip`). `EMPTY_DEFAULT_VARIABLE` then has severity `info`; `SECRET_MISSING` stays `block`.",
                "type": "boolean"
              },
              "source": {
                "$ref": "#/definitions/Source"
              },
              "title": {
                "type": "string"
              },
              "variable": {
                "description": "The variable a value problem is about (`SECRET_MISSING`, `EMPTY_DEFAULT_VARIABLE`, `LOCAL_VARIABLE_UNSET`), as the problem itself knows it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "id",
              "owner",
              "severity",
              "source",
              "title"
            ],
            "type": "object"
          },
          "ResourceConfirmation": {
            "properties": {
              "alias": {
                "type": "string"
              },
              "binding": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string"
              },
              "tier": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "alias",
              "kind"
            ],
            "type": "object"
          },
          "RouteCount": {
            "properties": {
              "count": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "count"
            ],
            "type": "object"
          },
          "Run": {
            "properties": {
              "check_id": {
                "type": "string"
              },
              "commit": {
                "type": "string"
              },
              "engine": {
                "type": "string"
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "healthcheck": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/HealthResult"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "left_redacted": {
                "default": false,
                "description": "The copies under this run's `left/` were written with the run's secret values replaced. Absent (an older run): `check::read` refuses its kept files.",
                "type": "boolean"
              },
              "log_path": {
                "default": null,
                "description": "The run's whole redacted log, an absolute path (`log_tail` is only its last 40 lines).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "moved": {
                "default": [],
                "description": "The untracked files the run created, moved out of the copy into the run's `left/` folder when it ended (at most 500).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "not_covered": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "restored": {
                "default": [],
                "description": "The tracked files the run rewrote and the worker put back as committed when it ended (at most 500; their rewritten versions are kept in the run's `left/` folder).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "reused": {
                "default": false,
                "description": "A passed run of an earlier check answered this one: nothing ran again.",
                "type": "boolean"
              },
              "routes": {
                "$ref": "#/definitions/RouteCount"
              },
              "stages": {
                "items": {
                  "$ref": "#/definitions/Stage"
                },
                "type": "array"
              },
              "started_at": {
                "type": "string"
              },
              "status": {
                "$ref": "#/definitions/RunStatus"
              },
              "waiting_on": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WaitingOn"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "The workers stage has gone a minute with no new worker: who it waits for. The run is still `running`; null otherwise."
              },
              "workers": {
                "$ref": "#/definitions/WorkerCount"
              }
            },
            "required": [
              "check_id",
              "commit",
              "engine",
              "id",
              "log_tail",
              "not_covered",
              "routes",
              "stages",
              "started_at",
              "status",
              "workers"
            ],
            "type": "object"
          },
          "RunError": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "owner": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunOwner"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "Whose the failure is (`run_code_owner`): the agent fixes it, the person must, or the run was cut short. Set whenever the check is stored."
              },
              "stage": {
                "$ref": "#/definitions/StageName"
              },
              "withheld": {
                "default": false,
                "description": "The worker would not send this failure to the agent now: the person has a blocking problem open (a missing value fails the run too), so it is theirs first.",
                "type": "boolean"
              }
            },
            "required": [
              "code",
              "message",
              "stage"
            ],
            "type": "object"
          },
          "RunOwner": {
            "description": "Who a failed local run's code belongs to.",
            "oneOf": [
              {
                "description": "A newer run of the workspace replaced this one, or the person stopped it: nothing to fix and nothing to send (a newer run is judged in its turn).",
                "enum": [
                  "replaced"
                ],
                "type": "string"
              },
              {
                "description": "The agent fixes it in the worktree.",
                "enum": [
                  "agent"
                ],
                "type": "string"
              },
              {
                "description": "The person's: Docker, a tool, the iii binary, or a decision about the routes.",
                "enum": [
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Nobody's fault: the run was cut short; run it again.",
                "enum": [
                  "interrupted"
                ],
                "type": "string"
              }
            ]
          },
          "RunStatus": {
            "enum": [
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          },
          "Severity": {
            "enum": [
              "block",
              "warn",
              "info"
            ],
            "type": "string"
          },
          "Source": {
            "enum": [
              "cloud_plan",
              "check_here"
            ],
            "type": "string"
          },
          "Stage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "$ref": "#/definitions/StageName"
              },
              "status": {
                "$ref": "#/definitions/StageStatus"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "StageName": {
            "enum": [
              "install",
              "build",
              "release",
              "compose_up",
              "workers",
              "routes",
              "healthcheck"
            ],
            "type": "string"
          },
          "StageStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed",
              "skipped"
            ],
            "type": "string"
          },
          "WaitingOn": {
            "properties": {
              "containers": {
                "description": "The containers that have not connected.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "since": {
                "description": "When the wait was noticed (RFC 3339).",
                "type": "string"
              }
            },
            "required": [
              "containers",
              "since"
            ],
            "type": "object"
          },
          "WorkerCount": {
            "properties": {
              "ready": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "total": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "ready",
              "total"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "base": {
            "description": "The environment branch's head when checked.",
            "type": "string"
          },
          "checked_at": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "commits": {
            "default": [],
            "description": "The commits of `base..commit`, newest first, at most 50. Empty when the base was not read or the commit is not on this machine.",
            "items": {
              "$ref": "#/definitions/CommitLine"
            },
            "type": "array"
          },
          "duration_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "environment_id": {
            "type": "string"
          },
          "handoff_id": {
            "default": null,
            "description": "The hand-off whose agent asked for it; null for the page's own checks.",
            "type": [
              "string",
              "null"
            ]
          },
          "here": {
            "$ref": "#/definitions/HerePart"
          },
          "id": {
            "type": "string"
          },
          "manifest": {
            "default": null,
            "description": "The compose file it was checked with, from the repository root. When it is not the environment's, deploying this check switches the environment to it.",
            "type": [
              "string",
              "null"
            ]
          },
          "plan": {
            "$ref": "#/definitions/PlanPart"
          },
          "problems": {
            "description": "Cloud plan first, then the checks here.",
            "items": {
              "$ref": "#/definitions/Problem"
            },
            "type": "array"
          },
          "ready": {
            "type": "boolean"
          },
          "report": {
            "type": "string"
          },
          "run": {
            "anyOf": [
              {
                "$ref": "#/definitions/Run"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "base",
          "checked_at",
          "commit",
          "duration_ms",
          "environment_id",
          "here",
          "id",
          "plan",
          "problems",
          "ready",
          "report"
        ],
        "title": "Check",
        "type": "object"
      }
    },
    {
      "description": "The page's own: stop the local run going for the selected folder or environment (run_id names one). Answers the run as it ended (failed, RUN_CANCELLED); NO_RUN when none is going. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::check::cancel",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::check::cancel` input.",
        "properties": {
          "run_id": {
            "default": null,
            "description": "The run to stop (the page's run). Without it: any run going in the selected folder or for the selected environment.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "CheckCancelRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "HealthResult": {
            "properties": {
              "path": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "path"
            ],
            "type": "object"
          },
          "RouteCount": {
            "properties": {
              "count": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "count"
            ],
            "type": "object"
          },
          "RunError": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "owner": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunOwner"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "Whose the failure is (`run_code_owner`): the agent fixes it, the person must, or the run was cut short. Set whenever the check is stored."
              },
              "stage": {
                "$ref": "#/definitions/StageName"
              },
              "withheld": {
                "default": false,
                "description": "The worker would not send this failure to the agent now: the person has a blocking problem open (a missing value fails the run too), so it is theirs first.",
                "type": "boolean"
              }
            },
            "required": [
              "code",
              "message",
              "stage"
            ],
            "type": "object"
          },
          "RunOwner": {
            "description": "Who a failed local run's code belongs to.",
            "oneOf": [
              {
                "description": "A newer run of the workspace replaced this one, or the person stopped it: nothing to fix and nothing to send (a newer run is judged in its turn).",
                "enum": [
                  "replaced"
                ],
                "type": "string"
              },
              {
                "description": "The agent fixes it in the worktree.",
                "enum": [
                  "agent"
                ],
                "type": "string"
              },
              {
                "description": "The person's: Docker, a tool, the iii binary, or a decision about the routes.",
                "enum": [
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Nobody's fault: the run was cut short; run it again.",
                "enum": [
                  "interrupted"
                ],
                "type": "string"
              }
            ]
          },
          "RunStatus": {
            "enum": [
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          },
          "Stage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "$ref": "#/definitions/StageName"
              },
              "status": {
                "$ref": "#/definitions/StageStatus"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "StageName": {
            "enum": [
              "install",
              "build",
              "release",
              "compose_up",
              "workers",
              "routes",
              "healthcheck"
            ],
            "type": "string"
          },
          "StageStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed",
              "skipped"
            ],
            "type": "string"
          },
          "WaitingOn": {
            "properties": {
              "containers": {
                "description": "The containers that have not connected.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "since": {
                "description": "When the wait was noticed (RFC 3339).",
                "type": "string"
              }
            },
            "required": [
              "containers",
              "since"
            ],
            "type": "object"
          },
          "WorkerCount": {
            "properties": {
              "ready": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "total": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "ready",
              "total"
            ],
            "type": "object"
          }
        },
        "properties": {
          "check_id": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "engine": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/RunError"
              },
              {
                "type": "null"
              }
            ]
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "healthcheck": {
            "anyOf": [
              {
                "$ref": "#/definitions/HealthResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string"
          },
          "left_redacted": {
            "default": false,
            "description": "The copies under this run's `left/` were written with the run's secret values replaced. Absent (an older run): `check::read` refuses its kept files.",
            "type": "boolean"
          },
          "log_path": {
            "default": null,
            "description": "The run's whole redacted log, an absolute path (`log_tail` is only its last 40 lines).",
            "type": [
              "string",
              "null"
            ]
          },
          "log_tail": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "moved": {
            "default": [],
            "description": "The untracked files the run created, moved out of the copy into the run's `left/` folder when it ended (at most 500).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "not_covered": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "restored": {
            "default": [],
            "description": "The tracked files the run rewrote and the worker put back as committed when it ended (at most 500; their rewritten versions are kept in the run's `left/` folder).",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "reused": {
            "default": false,
            "description": "A passed run of an earlier check answered this one: nothing ran again.",
            "type": "boolean"
          },
          "routes": {
            "$ref": "#/definitions/RouteCount"
          },
          "stages": {
            "items": {
              "$ref": "#/definitions/Stage"
            },
            "type": "array"
          },
          "started_at": {
            "type": "string"
          },
          "status": {
            "$ref": "#/definitions/RunStatus"
          },
          "waiting_on": {
            "anyOf": [
              {
                "$ref": "#/definitions/WaitingOn"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The workers stage has gone a minute with no new worker: who it waits for. The run is still `running`; null otherwise."
          },
          "workers": {
            "$ref": "#/definitions/WorkerCount"
          }
        },
        "required": [
          "check_id",
          "commit",
          "engine",
          "id",
          "log_tail",
          "not_covered",
          "routes",
          "stages",
          "started_at",
          "status",
          "workers"
        ],
        "title": "Run",
        "type": "object"
      }
    },
    {
      "description": "Read one kept check by id (status.checks lists them, a deploy names its check_id), as it was recorded; nothing runs again.",
      "metadata": {},
      "name": "iii-cloud::check::get",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::check::get` input.",
        "properties": {
          "id": {
            "description": "A check's id: `status.checks[].id`, a deploy's `check_id`.",
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "title": "CheckGetRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "Confirmations": {
            "properties": {
              "overrides": {
                "items": {
                  "$ref": "#/definitions/OverrideConfirmation"
                },
                "type": "array"
              },
              "resources": {
                "items": {
                  "$ref": "#/definitions/ResourceConfirmation"
                },
                "type": "array"
              }
            },
            "required": [
              "overrides",
              "resources"
            ],
            "type": "object"
          },
          "Excerpt": {
            "properties": {
              "lines": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "start_line": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "lines",
              "start_line"
            ],
            "type": "object"
          },
          "HealthResult": {
            "properties": {
              "path": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "path"
            ],
            "type": "object"
          },
          "HerePart": {
            "properties": {
              "accepts_cloud_block": {
                "type": "boolean"
              },
              "iii_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "problems": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "accepts_cloud_block",
              "problems"
            ],
            "type": "object"
          },
          "OverrideConfirmation": {
            "properties": {
              "console": true,
              "file": true,
              "setting": {
                "type": "string"
              }
            },
            "required": [
              "console",
              "file",
              "setting"
            ],
            "type": "object"
          },
          "Owner": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Info only: nothing to do.",
                "enum": [
                  "none"
                ],
                "type": "string"
              }
            ]
          },
          "PlanPart": {
            "properties": {
              "at_least": {
                "description": "The plan stops at its first blocking step: more may follow.",
                "type": "boolean"
              },
              "blocking": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "confirmations": {
                "$ref": "#/definitions/Confirmations"
              },
              "digest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fingerprint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/PlanStatus"
              },
              "summary": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PlanSummary"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "What the plan runs: its workers and machine groups. Null without a plan."
              },
              "warnings": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "web_candidates": true
            },
            "required": [
              "at_least",
              "blocking",
              "confirmations",
              "status",
              "warnings"
            ],
            "type": "object"
          },
          "PlanStatus": {
            "enum": [
              "clean",
              "blocked",
              "not_pushed",
              "commit_not_planned",
              "unavailable"
            ],
            "type": "string"
          },
          "PlanSummary": {
            "properties": {
              "groups": {
                "description": "The groups' names, in the plan's order.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "workers": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "groups",
              "workers"
            ],
            "type": "object"
          },
          "Problem": {
            "properties": {
              "cloud_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "excerpt": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Excerpt"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "file": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "description": "sha1(source, code, file, line), stable across checks.",
                "type": "string"
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "owner": {
                "$ref": "#/definitions/Owner"
              },
              "severity": {
                "$ref": "#/definitions/Severity"
              },
              "skipped": {
                "description": "The person skipped its name for now (`values::skip`). `EMPTY_DEFAULT_VARIABLE` then has severity `info`; `SECRET_MISSING` stays `block`.",
                "type": "boolean"
              },
              "source": {
                "$ref": "#/definitions/Source"
              },
              "title": {
                "type": "string"
              },
              "variable": {
                "description": "The variable a value problem is about (`SECRET_MISSING`, `EMPTY_DEFAULT_VARIABLE`, `LOCAL_VARIABLE_UNSET`), as the problem itself knows it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "id",
              "owner",
              "severity",
              "source",
              "title"
            ],
            "type": "object"
          },
          "ResourceConfirmation": {
            "properties": {
              "alias": {
                "type": "string"
              },
              "binding": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string"
              },
              "tier": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "alias",
              "kind"
            ],
            "type": "object"
          },
          "RouteCount": {
            "properties": {
              "count": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "count"
            ],
            "type": "object"
          },
          "Run": {
            "properties": {
              "check_id": {
                "type": "string"
              },
              "commit": {
                "type": "string"
              },
              "engine": {
                "type": "string"
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "healthcheck": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/HealthResult"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "left_redacted": {
                "default": false,
                "description": "The copies under this run's `left/` were written with the run's secret values replaced. Absent (an older run): `check::read` refuses its kept files.",
                "type": "boolean"
              },
              "log_path": {
                "default": null,
                "description": "The run's whole redacted log, an absolute path (`log_tail` is only its last 40 lines).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "moved": {
                "default": [],
                "description": "The untracked files the run created, moved out of the copy into the run's `left/` folder when it ended (at most 500).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "not_covered": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "restored": {
                "default": [],
                "description": "The tracked files the run rewrote and the worker put back as committed when it ended (at most 500; their rewritten versions are kept in the run's `left/` folder).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "reused": {
                "default": false,
                "description": "A passed run of an earlier check answered this one: nothing ran again.",
                "type": "boolean"
              },
              "routes": {
                "$ref": "#/definitions/RouteCount"
              },
              "stages": {
                "items": {
                  "$ref": "#/definitions/Stage"
                },
                "type": "array"
              },
              "started_at": {
                "type": "string"
              },
              "status": {
                "$ref": "#/definitions/RunStatus"
              },
              "waiting_on": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WaitingOn"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "The workers stage has gone a minute with no new worker: who it waits for. The run is still `running`; null otherwise."
              },
              "workers": {
                "$ref": "#/definitions/WorkerCount"
              }
            },
            "required": [
              "check_id",
              "commit",
              "engine",
              "id",
              "log_tail",
              "not_covered",
              "routes",
              "stages",
              "started_at",
              "status",
              "workers"
            ],
            "type": "object"
          },
          "RunError": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "owner": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunOwner"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "Whose the failure is (`run_code_owner`): the agent fixes it, the person must, or the run was cut short. Set whenever the check is stored."
              },
              "stage": {
                "$ref": "#/definitions/StageName"
              },
              "withheld": {
                "default": false,
                "description": "The worker would not send this failure to the agent now: the person has a blocking problem open (a missing value fails the run too), so it is theirs first.",
                "type": "boolean"
              }
            },
            "required": [
              "code",
              "message",
              "stage"
            ],
            "type": "object"
          },
          "RunOwner": {
            "description": "Who a failed local run's code belongs to.",
            "oneOf": [
              {
                "description": "A newer run of the workspace replaced this one, or the person stopped it: nothing to fix and nothing to send (a newer run is judged in its turn).",
                "enum": [
                  "replaced"
                ],
                "type": "string"
              },
              {
                "description": "The agent fixes it in the worktree.",
                "enum": [
                  "agent"
                ],
                "type": "string"
              },
              {
                "description": "The person's: Docker, a tool, the iii binary, or a decision about the routes.",
                "enum": [
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Nobody's fault: the run was cut short; run it again.",
                "enum": [
                  "interrupted"
                ],
                "type": "string"
              }
            ]
          },
          "RunStatus": {
            "enum": [
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          },
          "Severity": {
            "enum": [
              "block",
              "warn",
              "info"
            ],
            "type": "string"
          },
          "Source": {
            "enum": [
              "cloud_plan",
              "check_here"
            ],
            "type": "string"
          },
          "Stage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "$ref": "#/definitions/StageName"
              },
              "status": {
                "$ref": "#/definitions/StageStatus"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "StageName": {
            "enum": [
              "install",
              "build",
              "release",
              "compose_up",
              "workers",
              "routes",
              "healthcheck"
            ],
            "type": "string"
          },
          "StageStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed",
              "skipped"
            ],
            "type": "string"
          },
          "WaitingOn": {
            "properties": {
              "containers": {
                "description": "The containers that have not connected.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "since": {
                "description": "When the wait was noticed (RFC 3339).",
                "type": "string"
              }
            },
            "required": [
              "containers",
              "since"
            ],
            "type": "object"
          },
          "WorkerCount": {
            "properties": {
              "ready": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "total": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "ready",
              "total"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "base": {
            "description": "The environment branch's head when checked.",
            "type": "string"
          },
          "checked_at": {
            "type": "string"
          },
          "commit": {
            "type": "string"
          },
          "commits": {
            "default": [],
            "description": "The commits of `base..commit`, newest first, at most 50. Empty when the base was not read or the commit is not on this machine.",
            "items": {
              "$ref": "#/definitions/CommitLine"
            },
            "type": "array"
          },
          "duration_ms": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "environment_id": {
            "type": "string"
          },
          "handoff_id": {
            "default": null,
            "description": "The hand-off whose agent asked for it; null for the page's own checks.",
            "type": [
              "string",
              "null"
            ]
          },
          "here": {
            "$ref": "#/definitions/HerePart"
          },
          "id": {
            "type": "string"
          },
          "manifest": {
            "default": null,
            "description": "The compose file it was checked with, from the repository root. When it is not the environment's, deploying this check switches the environment to it.",
            "type": [
              "string",
              "null"
            ]
          },
          "plan": {
            "$ref": "#/definitions/PlanPart"
          },
          "problems": {
            "description": "Cloud plan first, then the checks here.",
            "items": {
              "$ref": "#/definitions/Problem"
            },
            "type": "array"
          },
          "ready": {
            "type": "boolean"
          },
          "report": {
            "type": "string"
          },
          "run": {
            "anyOf": [
              {
                "$ref": "#/definitions/Run"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "base",
          "checked_at",
          "commit",
          "duration_ms",
          "environment_id",
          "here",
          "id",
          "plan",
          "problems",
          "ready",
          "report"
        ],
        "title": "Check",
        "type": "object"
      }
    },
    {
      "description": "Read, for a kept check, a slice of its run's whole redacted log (`log: {from_line, lines}`, at most 400 lines a call, with the line count) and/or a file the run left that the worker kept (`left: <path>`, only a path in the run's `restored` or `moved`, text up to 256 KiB). No path is read from disk by you.",
      "metadata": {},
      "name": "iii-cloud::check::read",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "LogSlice": {
            "properties": {
              "from_line": {
                "default": null,
                "description": "The first line (1-based; default 1).",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "lines": {
                "default": null,
                "description": "How many (default and most: 400).",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "type": "object"
          }
        },
        "description": "`iii-cloud::check::read` input: a slice of a check's run's whole redacted log, and/or a file the worker kept of that run (`left`).",
        "properties": {
          "id": {
            "description": "A check's id.",
            "type": "string"
          },
          "left": {
            "default": null,
            "description": "A path listed in the run's `restored` or `moved`: what the run left there, kept in `left/`.",
            "type": [
              "string",
              "null"
            ]
          },
          "log": {
            "anyOf": [
              {
                "$ref": "#/definitions/LogSlice"
              },
              {
                "type": "null"
              }
            ],
            "description": "Lines of the run's log (`run.log_path`'s file), 1-based."
          }
        },
        "required": [
          "id"
        ],
        "title": "CheckReadRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "LeftFile": {
            "properties": {
              "content": {
                "description": "The kept file's text, redacted with the run's secrets.",
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "content",
              "path"
            ],
            "type": "object"
          },
          "LogLines": {
            "properties": {
              "from_line": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "lines": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "total_lines": {
                "description": "All the lines the log has now.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "from_line",
              "lines",
              "total_lines"
            ],
            "type": "object"
          }
        },
        "properties": {
          "left": {
            "anyOf": [
              {
                "$ref": "#/definitions/LeftFile"
              },
              {
                "type": "null"
              }
            ]
          },
          "log": {
            "anyOf": [
              {
                "$ref": "#/definitions/LogLines"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "CheckRead",
        "type": "object"
      }
    },
    {
      "description": "The page's own: copy the compose file's local config folder (engine.workers.configuration, fs adapter, from the person's folder) into the selected environment's console config in iii cloud, one entry per container. dry_run previews it and writes nothing; applying needs the dry run's version as expected_version. Secret-looking keys and values are left out, by name. Agents never call it.",
      "metadata": {
        "trace_hidden": true
      },
      "name": "iii-cloud::config::import",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::config::import` input: the page's own.",
        "properties": {
          "dry_run": {
            "description": "Preview only: nothing is written.",
            "type": "boolean"
          },
          "environment_id": {
            "description": "The selected environment, as a guard (`ENVIRONMENT_CHANGED`).",
            "type": "string"
          },
          "expected_version": {
            "default": null,
            "description": "The `version` the dry run returned. Needed to apply.",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "dry_run",
          "environment_id"
        ],
        "title": "ConfigImport",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ConfigImportField": {
            "properties": {
              "key": {
                "type": "string"
              },
              "value": true
            },
            "required": [
              "key",
              "value"
            ],
            "type": "object"
          },
          "ConfigImportWorker": {
            "properties": {
              "fields": {
                "description": "The fields copied, as dotted keys; lists stay JSON values. `value` is null once applied.",
                "items": {
                  "$ref": "#/definitions/ConfigImportField"
                },
                "type": "array"
              },
              "file": {
                "description": "The file, from the repository root.",
                "type": "string"
              },
              "left_out": {
                "description": "Secret-looking keys or credential-looking values, by key only.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "set_elsewhere": {
                "description": "Keys iii cloud or the compose file set, which the console can't change.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "worker": {
                "description": "The container key iii cloud keeps the config by.",
                "type": "string"
              }
            },
            "required": [
              "fields",
              "file",
              "left_out",
              "set_elsewhere",
              "worker"
            ],
            "type": "object"
          },
          "ConfigSkipReason": {
            "oneOf": [
              {
                "description": "No container iii cloud runs has that config entry.",
                "enum": [
                  "not_a_worker"
                ],
                "type": "string"
              },
              {
                "description": "A link, or outside the repository.",
                "enum": [
                  "not_a_plain_file"
                ],
                "type": "string"
              },
              {
                "description": "Over 1 MiB.",
                "enum": [
                  "too_large"
                ],
                "type": "string"
              },
              {
                "description": "Not a configuration entry (`id`, `name`, `description`, `value`).",
                "enum": [
                  "unreadable"
                ],
                "type": "string"
              }
            ]
          },
          "ConfigSkippedFile": {
            "properties": {
              "file": {
                "type": "string"
              },
              "reason": {
                "$ref": "#/definitions/ConfigSkipReason"
              }
            },
            "required": [
              "file",
              "reason"
            ],
            "type": "object"
          }
        },
        "description": "What `iii-cloud::config::import` copies. Values only in a dry run's preview, never a secret-looking one: no `Debug`, so they never reach a log.",
        "properties": {
          "applied": {
            "description": "False for a dry run.",
            "type": "boolean"
          },
          "directory": {
            "description": "The config folder, from the repository root (`api/config`).",
            "type": "string"
          },
          "draft_changed": {
            "description": "iii cloud has unapplied console edits for this environment: applying is refused until they're applied or dropped there.",
            "type": "boolean"
          },
          "environment_id": {
            "type": "string"
          },
          "skipped": {
            "description": "Files of the folder not copied, and why.",
            "items": {
              "$ref": "#/definitions/ConfigSkippedFile"
            },
            "type": "array"
          },
          "version": {
            "description": "The config version the dry run read, or the one the apply made.",
            "format": "int64",
            "type": "integer"
          },
          "workers": {
            "items": {
              "$ref": "#/definitions/ConfigImportWorker"
            },
            "type": "array"
          }
        },
        "required": [
          "applied",
          "directory",
          "draft_changed",
          "environment_id",
          "skipped",
          "version",
          "workers"
        ],
        "title": "ConfigImported",
        "type": "object"
      }
    },
    {
      "description": "Sign in with the browser (the person types a code) or with an API key saved in the vault. A key connects with the secret's name alone.",
      "metadata": {
        "trace_hidden": true
      },
      "name": "iii-cloud::connect",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::connect` input.",
        "oneOf": [
          {
            "additionalProperties": false,
            "description": "Sign in with a code typed in the browser (the main path). A struct variant, so serde refuses a field it does not know (a unit one ignores them).",
            "properties": {
              "method": {
                "enum": [
                  "browser"
                ],
                "type": "string"
              }
            },
            "required": [
              "method"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "description": "Use an environment-scoped API key saved in the vault.",
            "properties": {
              "environment_id": {
                "default": null,
                "description": "Only for an older cloud without `GET /keys/self`: the key's environment.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "enum": [
                  "api_key"
                ],
                "type": "string"
              },
              "secret": {
                "description": "The vault secret that holds the key. Never the key itself.",
                "type": "string"
              },
              "team_id": {
                "default": null,
                "description": "Only for an older cloud without `GET /keys/self`: the key's team.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "method",
              "secret"
            ],
            "type": "object"
          }
        ],
        "title": "ConnectRequest"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ApiKeyRef": {
            "properties": {
              "environment_id": {
                "type": "string"
              },
              "secret": {
                "type": "string"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "environment_id",
              "secret",
              "team_id"
            ],
            "type": "object"
          },
          "ConnStatus": {
            "enum": [
              "signed_out",
              "waiting",
              "connected",
              "expired",
              "error"
            ],
            "type": "string"
          },
          "Device": {
            "properties": {
              "expires_at": {
                "type": "string"
              },
              "user_code": {
                "type": "string"
              },
              "verification_uri": {
                "type": "string"
              }
            },
            "required": [
              "expires_at",
              "user_code",
              "verification_uri"
            ],
            "type": "object"
          },
          "Method": {
            "enum": [
              "browser",
              "api_key"
            ],
            "type": "string"
          },
          "TeamRole": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "role",
              "slug"
            ],
            "type": "object"
          },
          "User": {
            "properties": {
              "email": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "email",
              "id"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "api_key": {
            "anyOf": [
              {
                "$ref": "#/definitions/ApiKeyRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "cloud_url": {
            "type": "string"
          },
          "device": {
            "anyOf": [
              {
                "$ref": "#/definitions/Device"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/WorkerError"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "anyOf": [
              {
                "$ref": "#/definitions/Method"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/definitions/ConnStatus"
          },
          "teams": {
            "items": {
              "$ref": "#/definitions/TeamRole"
            },
            "type": "array"
          },
          "user": {
            "anyOf": [
              {
                "$ref": "#/definitions/User"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "cloud_url",
          "status",
          "teams"
        ],
        "title": "Connection",
        "type": "object"
      }
    },
    {
      "description": "The page's own: merge the pull request and deploy, push the checked commit to an environment's own branch and deploy it, or confirm a waiting deployment, pinned to the plan the person saw. A check of another compose file switches the environment to it first. Only the person deploys; agents never call it.",
      "metadata": {},
      "name": "iii-cloud::deploy",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::deploy` input.",
        "properties": {
          "check_id": {
            "type": "string"
          },
          "deployment_id": {
            "default": null,
            "description": "Confirm this waiting deployment (a merge made directly on GitHub); its plan digest must match the check's.",
            "type": [
              "string",
              "null"
            ]
          },
          "handoff_id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "pr": {
            "default": null,
            "description": "Merge this pull request first (or resume after its merge).",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "check_id"
        ],
        "title": "DeployRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "DeployCommit": {
            "properties": {
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "sha"
            ],
            "type": "object"
          },
          "DeployError": {
            "properties": {
              "action": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              },
              "stage": {
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "stage"
            ],
            "type": "object"
          },
          "DeployFailure": {
            "description": "A failed deploy in plain words (spec: readable failures).",
            "properties": {
              "code": {
                "type": "string"
              },
              "diagnosis": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Diagnosis"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "iii cloud's diagnosis of the failure, when it has a likely cause."
              },
              "hint": {
                "type": "string"
              },
              "log_tail": {
                "description": "The last ~40 lines of the failing stage's log, oldest first, redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "release_command": {
                "default": null,
                "description": "The release command from the manifest, for a release failure.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "silent": {
                "default": false,
                "description": "The log shows an exit status but no error text.",
                "type": "boolean"
              },
              "stage": {
                "type": "string"
              },
              "title": {
                "description": "Plain, per code: \"The release command failed: `pnpm migrate`\".",
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "log_tail",
              "stage",
              "title"
            ],
            "type": "object"
          },
          "DeployStage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "started_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "Diagnosis": {
            "description": "iii cloud's read-only diagnosis of a failed deployment: a lead, not proof.",
            "properties": {
              "cause": {
                "type": "string"
              },
              "evidence": {
                "description": "What it rests on, one line each (a log line, a file and its lines), redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "next_step": {
                "type": "string"
              }
            },
            "required": [
              "cause",
              "evidence",
              "next_step"
            ],
            "type": "object"
          },
          "Outcome": {
            "enum": [
              "running",
              "ready",
              "failed",
              "no_route",
              "canceled",
              "replaced"
            ],
            "type": "string"
          },
          "ReleaseRow": {
            "properties": {
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/ReleaseRowStatus"
              }
            },
            "required": [
              "status"
            ],
            "type": "object"
          },
          "ReleaseRowStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          }
        },
        "properties": {
          "approved_by_worker": {
            "type": "boolean"
          },
          "check_id": {
            "default": null,
            "description": "The check this worker deployed (`deploy {check_id}`); null for a deployment made elsewhere.",
            "type": [
              "string",
              "null"
            ]
          },
          "checked_ready": {
            "type": "boolean"
          },
          "commit": {
            "$ref": "#/definitions/DeployCommit"
          },
          "console_url": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/DeployError"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/definitions/DeployFailure"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "For a failed deploy: what failed, in plain words, with the failing stage's log."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_console": {
            "default": false,
            "description": "This worker did not create it: made in the console (the cloud's `type` is `manual` for both).",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "log_tail": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "number": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "outcome": {
            "$ref": "#/definitions/Outcome"
          },
          "pr": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "release_row": {
            "anyOf": [
              {
                "$ref": "#/definitions/ReleaseRow"
              },
              {
                "type": "null"
              }
            ]
          },
          "replaced_by": {
            "default": null,
            "description": "The deployment that replaced this one, when it is `replaced`.",
            "type": [
              "string",
              "null"
            ]
          },
          "stages": {
            "items": {
              "$ref": "#/definitions/DeployStage"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "status_detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "approved_by_worker",
          "checked_ready",
          "commit",
          "console_url",
          "created_at",
          "environment_id",
          "id",
          "log_tail",
          "number",
          "outcome",
          "stages",
          "status",
          "type"
        ],
        "title": "Deploy",
        "type": "object"
      }
    },
    {
      "description": "The page's own: sign out of iii cloud. Stops a sign-in that is waiting for approval and forgets the stored credential; the vault's secret stays. Answers the connection with status signed_out. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::disconnect",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::disconnect` input: none.",
        "title": "DisconnectRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ApiKeyRef": {
            "properties": {
              "environment_id": {
                "type": "string"
              },
              "secret": {
                "type": "string"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "environment_id",
              "secret",
              "team_id"
            ],
            "type": "object"
          },
          "ConnStatus": {
            "enum": [
              "signed_out",
              "waiting",
              "connected",
              "expired",
              "error"
            ],
            "type": "string"
          },
          "Device": {
            "properties": {
              "expires_at": {
                "type": "string"
              },
              "user_code": {
                "type": "string"
              },
              "verification_uri": {
                "type": "string"
              }
            },
            "required": [
              "expires_at",
              "user_code",
              "verification_uri"
            ],
            "type": "object"
          },
          "Method": {
            "enum": [
              "browser",
              "api_key"
            ],
            "type": "string"
          },
          "TeamRole": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "role",
              "slug"
            ],
            "type": "object"
          },
          "User": {
            "properties": {
              "email": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "email",
              "id"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "api_key": {
            "anyOf": [
              {
                "$ref": "#/definitions/ApiKeyRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "cloud_url": {
            "type": "string"
          },
          "device": {
            "anyOf": [
              {
                "$ref": "#/definitions/Device"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/WorkerError"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "anyOf": [
              {
                "$ref": "#/definitions/Method"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/definitions/ConnStatus"
          },
          "teams": {
            "items": {
              "$ref": "#/definitions/TeamRole"
            },
            "type": "array"
          },
          "user": {
            "anyOf": [
              {
                "$ref": "#/definitions/User"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "cloud_url",
          "status",
          "teams"
        ],
        "title": "Connection",
        "type": "object"
      }
    },
    {
      "description": "The page's own: hand work to the agent. Returns a marker for the top of the prompt; the worker finds the agent's session by it and publishes what the agent is doing as status.agent.",
      "metadata": {},
      "name": "iii-cloud::handoff",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "HandoffKind": {
            "oneOf": [
              {
                "enum": [
                  "ready",
                  "deploy_fix",
                  "pull_request"
                ],
                "type": "string"
              },
              {
                "description": "The project is not in iii cloud yet.",
                "enum": [
                  "import"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::handoff` input: the page hands work to the agent.",
        "properties": {
          "candidate": {
            "default": null,
            "description": "true when sent from the add-project steps: brief the folder being added.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "check_id": {
            "default": null,
            "description": "Required for every kind but `import`.",
            "type": [
              "string",
              "null"
            ]
          },
          "deployment_id": {
            "default": null,
            "description": "For `deploy_fix`: the deployment that failed.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/definitions/HandoffKind"
          },
          "text": {
            "default": null,
            "description": "The plain chat text the page would post. With it, a follow-up goes into the agent's existing chat: the worker sends it itself.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "title": "HandoffRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::handoff` output.",
        "properties": {
          "asks": {
            "default": false,
            "description": "With `reused`: the agent has a real ask of its own open. Nothing was delivered, not even the page's `text` (it would read as the answer): the person answers in the chat.",
            "type": "boolean"
          },
          "delivered": {
            "description": "False: nothing was sent; the page starts a new chat with the marker.",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "marker": {
            "description": "A short line the page puts at the top of the prompt; the worker finds the agent's session by it.",
            "type": "string"
          },
          "reused": {
            "default": false,
            "description": "True: an equal hand-off was already open (a double click), and this is it.",
            "type": "boolean"
          },
          "sent": {
            "default": null,
            "description": "With `reused`: the worker sent the open hand-off's agent on (the same \"continue\" as after a person's check: the newest check's blocking problems of the agent's, and its failed run). False: nothing was sent (it works, asks the person something, or has nothing open). Absent for a new hand-off.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "session_id": {
            "description": "The existing chat the worker sent the hand-off into.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "delivered",
          "id",
          "marker"
        ],
        "title": "HandoffResponse",
        "type": "object"
      }
    },
    {
      "description": "Your brief, and only it: where to work, the base, the compose file, the problems (id, code, owner, severity, title, detail, file, line, fix) split into yours and the person's, the deploy failure when there is one, the next step, and run_failure ({stage, code, message, log_tail}) when your hand-off's latest local run failed. handoff_id is the id or the 8 characters of the marker line.",
      "metadata": {},
      "name": "iii-cloud::handoff::brief",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::handoff::brief` input.",
        "properties": {
          "handoff_id": {
            "description": "The hand-off's id, or the 8 characters of its marker line.",
            "type": "string"
          }
        },
        "required": [
          "handoff_id"
        ],
        "title": "HandoffBriefRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BriefBase": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "branch",
              "sha"
            ],
            "type": "object"
          },
          "BriefDeploy": {
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "diagnosis": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Diagnosis"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "iii cloud's diagnosis, read when the hand-off was made (`None`: it had no likely cause)."
              },
              "hint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "release_command": {
                "default": null,
                "description": "The release command from the manifest, when the failure is the release's.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "silent": {
                "default": false,
                "type": "boolean"
              },
              "stage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "log_tail"
            ],
            "type": "object"
          },
          "BriefProblem": {
            "properties": {
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "file": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "owner": {
                "$ref": "#/definitions/Owner"
              },
              "severity": {
                "$ref": "#/definitions/Severity"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "id",
              "owner",
              "severity",
              "title"
            ],
            "type": "object"
          },
          "BriefWorkspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "branch",
              "path"
            ],
            "type": "object"
          },
          "Diagnosis": {
            "description": "iii cloud's read-only diagnosis of a failed deployment: a lead, not proof.",
            "properties": {
              "cause": {
                "type": "string"
              },
              "evidence": {
                "description": "What it rests on, one line each (a log line, a file and its lines), redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "next_step": {
                "type": "string"
              }
            },
            "required": [
              "cause",
              "evidence",
              "next_step"
            ],
            "type": "object"
          },
          "HandoffKind": {
            "oneOf": [
              {
                "enum": [
                  "ready",
                  "deploy_fix",
                  "pull_request"
                ],
                "type": "string"
              },
              {
                "description": "The project is not in iii cloud yet.",
                "enum": [
                  "import"
                ],
                "type": "string"
              }
            ]
          },
          "Owner": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Info only: nothing to do.",
                "enum": [
                  "none"
                ],
                "type": "string"
              }
            ]
          },
          "RunFailure": {
            "description": "Why the hand-off's latest local run failed.",
            "properties": {
              "code": {
                "type": "string"
              },
              "log_tail": {
                "description": "The run's last lines, oldest first, redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "message": {
                "type": "string"
              },
              "stage": {
                "$ref": "#/definitions/StageName"
              }
            },
            "required": [
              "code",
              "log_tail",
              "message",
              "stage"
            ],
            "type": "object"
          },
          "Severity": {
            "enum": [
              "block",
              "warn",
              "info"
            ],
            "type": "string"
          },
          "StageName": {
            "enum": [
              "install",
              "build",
              "release",
              "compose_up",
              "workers",
              "routes",
              "healthcheck"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::handoff::brief` output: the brief, and the failed run when there is one.",
        "properties": {
          "agent_problems": {
            "description": "The problems that are the agent's to fix.",
            "items": {
              "$ref": "#/definitions/BriefProblem"
            },
            "type": "array"
          },
          "base": {
            "anyOf": [
              {
                "$ref": "#/definitions/BriefBase"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The base branch and its sha when the worktree was made: reset to it to start again (`OLD_ATTEMPT_COMMITS`)."
          },
          "check_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "checkout_path": {
            "description": "The person's own checkout: do not touch it.",
            "type": [
              "string",
              "null"
            ]
          },
          "commit": {
            "type": [
              "string",
              "null"
            ]
          },
          "deploy": {
            "anyOf": [
              {
                "$ref": "#/definitions/BriefDeploy"
              },
              {
                "type": "null"
              }
            ]
          },
          "handoff_id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/definitions/HandoffKind"
          },
          "manifest": {
            "description": "The compose file checked and deployed, relative to the worktree: the hand-off's, else the environment's.",
            "type": "string"
          },
          "next_step": {
            "type": "string"
          },
          "other_compose_files": {
            "description": "Other compose files tracked in the worktree that declare `containers:` (at most 10). They are not checked or deployed.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "person_problems": {
            "description": "The ones the person decides: bring each with a recommendation.",
            "items": {
              "$ref": "#/definitions/BriefProblem"
            },
            "type": "array"
          },
          "project": {
            "description": "`<project> · <environment>`.",
            "type": [
              "string",
              "null"
            ]
          },
          "pushes_directly": {
            "default": false,
            "description": "The environment is not production: it gets an assisted deploy, no pull request. Push only your fix branch; the person's deploy on the page sends the checked commit to the environment's own branch.",
            "type": "boolean"
          },
          "remote_branch_note": {
            "default": null,
            "description": "One line when an earlier try left the fix branch on origin: the first push replaces it with `--force-with-lease`.",
            "type": [
              "string",
              "null"
            ]
          },
          "repository": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_failure": {
            "anyOf": [
              {
                "$ref": "#/definitions/RunFailure"
              },
              {
                "type": "null"
              }
            ]
          },
          "worktree": {
            "anyOf": [
              {
                "$ref": "#/definitions/BriefWorkspace"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where to work."
          }
        },
        "required": [
          "agent_problems",
          "handoff_id",
          "kind",
          "manifest",
          "next_step",
          "other_compose_files",
          "person_problems"
        ],
        "title": "HandoffBriefResponse",
        "type": "object"
      }
    },
    {
      "description": "Tell the person which problems you start on: call it before each group of fixes with the problem ids or codes (a code stands for every open problem of it) and a short plain note. Clears itself when those problems leave a newer check or the hand-off ends.",
      "metadata": {},
      "name": "iii-cloud::handoff::progress",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::handoff::progress` input: the agent says what it starts on.",
        "properties": {
          "handoff_id": {
            "default": null,
            "description": "The hand-off this progress is for, by its id or the 8 characters of the marker (default: the selected environment's open one).",
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "working_on": {
            "description": "Problem ids, or codes (a code stands for every open problem of that code).",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "working_on"
        ],
        "title": "HandoffProgressRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "working_on": {
            "description": "The problem ids the names resolved to in the newest check.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "working_on"
        ],
        "title": "HandoffProgressResponse",
        "type": "object"
      }
    },
    {
      "description": "The page's own: stop the agent's running turn for a hand-off, with the harness's own stop. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::handoff::stop",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::handoff::stop` input.",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "title": "HandoffStopRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "id": {
            "type": "string"
          },
          "stopping": {
            "description": "The harness accepted the stop of the session's running turn.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "stopping"
        ],
        "title": "HandoffStopResponse",
        "type": "object"
      }
    },
    {
      "description": "Your hand-off's own worktree: {path, branch, base, created, merged_from, conflict}. Work only there, never in the person's folder. A hand-off that points at the person's folder gets one now (from the environment's branch, the person's branch merged in) and works there from then on; the page's selection does not change. handoff_id defaults to the selected environment's open hand-off.",
      "metadata": {},
      "name": "iii-cloud::handoff::worktree",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::handoff::worktree` input.",
        "properties": {
          "handoff_id": {
            "default": null,
            "description": "The hand-off (default: the selected environment's open one). `id` works too.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "HandoffWorktreeRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BriefBase": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "branch",
              "sha"
            ],
            "type": "object"
          }
        },
        "description": "The worktree a hand-off works in: never the person's checkout.",
        "properties": {
          "base": {
            "anyOf": [
              {
                "$ref": "#/definitions/BriefBase"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the worktree started from: the person's commit it took, else the environment's head."
          },
          "branch": {
            "description": "The fix branch, `iii-cloud/ready-<env>` (or `-2`, ...).",
            "type": "string"
          },
          "conflict": {
            "description": "The person's commits conflict with the environment's branch: the worktree is at the base, and this says what to merge.",
            "type": [
              "string",
              "null"
            ]
          },
          "created": {
            "description": "This call made the worktree; false: it was there.",
            "type": "boolean"
          },
          "merged_from": {
            "description": "The person's branch (or the check's `source`) this call merged in on top of the environment's branch; null when nothing came in.",
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "type": "string"
          }
        },
        "required": [
          "branch",
          "created",
          "path"
        ],
        "title": "HandoffWorktree",
        "type": "object"
      }
    },
    {
      "description": "The page's own: open the environment's live log tail (iii cloud's logs/tail, as the person). Returns {follow_id}; every line, gap and the end reach iii-cloud::on-log with that follow_id. worker: only that worker's lines. It ends by itself when the stream ends and after 30 minutes. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::logs::follow",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::logs::follow` input.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "follow_id": {
            "default": null,
            "description": "The page's own id for the follow (letters, digits, `-`, `_`; at most 64), so it can listen before the first event. Default: the worker makes one.",
            "type": [
              "string",
              "null"
            ]
          },
          "worker": {
            "default": null,
            "description": "Only this worker's lines.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "environment_id"
        ],
        "title": "LogsFollowRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::logs::follow` and `iii-cloud::stream::follow` output.",
        "properties": {
          "follow_id": {
            "type": "string"
          }
        },
        "required": [
          "follow_id"
        ],
        "title": "FollowStarted",
        "type": "object"
      }
    },
    {
      "description": "The page's own: close a follow of logs::follow. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::logs::unfollow",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::logs::unfollow` and `iii-cloud::stream::unfollow` input.",
        "properties": {
          "follow_id": {
            "type": "string"
          }
        },
        "required": [
          "follow_id"
        ],
        "title": "UnfollowRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::logs::unfollow` and `iii-cloud::stream::unfollow` output.",
        "properties": {
          "closed": {
            "description": "False when no such follow was open (it had ended).",
            "type": "boolean"
          }
        },
        "required": [
          "closed"
        ],
        "title": "Unfollowed",
        "type": "object"
      }
    },
    {
      "description": "Called after each iii-cloud record changes (connection, project, check, run, secret, deploy, alerts); returns the event. Takes no args; observe it with filters on input.kind and input.terminal. Only the iii-cloud worker calls it.",
      "metadata": {},
      "name": "iii-cloud::on-change",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "EventKind": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "connection",
                  "project",
                  "check",
                  "run",
                  "secret",
                  "deploy"
                ],
                "type": "string"
              },
              {
                "description": "The current alerts changed: the record is `Alerts`.",
                "enum": [
                  "alerts"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::on-change` event: one record changed.",
        "properties": {
          "id": {
            "description": "The record's id (`current` for `connection` and `project`).",
            "type": "string"
          },
          "kind": {
            "$ref": "#/definitions/EventKind"
          },
          "record": {
            "description": "Connection, Project, Check, Run, SecretRequest, Deploy or Alerts."
          },
          "summary": {
            "description": "One line, e.g. \"deploy 7a1f3b2 failed at workers: OOMKilled\".",
            "type": "string"
          },
          "terminal": {
            "description": "A run or deploy finished, a secret resolved, the connection settled.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "kind",
          "record",
          "summary",
          "terminal"
        ],
        "title": "ChangeEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "EventKind": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "connection",
                  "project",
                  "check",
                  "run",
                  "secret",
                  "deploy"
                ],
                "type": "string"
              },
              {
                "description": "The current alerts changed: the record is `Alerts`.",
                "enum": [
                  "alerts"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::on-change` event: one record changed.",
        "properties": {
          "id": {
            "description": "The record's id (`current` for `connection` and `project`).",
            "type": "string"
          },
          "kind": {
            "$ref": "#/definitions/EventKind"
          },
          "record": {
            "description": "Connection, Project, Check, Run, SecretRequest, Deploy or Alerts."
          },
          "summary": {
            "description": "One line, e.g. \"deploy 7a1f3b2 failed at workers: OOMKilled\".",
            "type": "string"
          },
          "terminal": {
            "description": "A run or deploy finished, a secret resolved, the connection settled.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "kind",
          "record",
          "summary",
          "terminal"
        ],
        "title": "ChangeEvent",
        "type": "object"
      }
    },
    {
      "description": "Internal: reload iii-cloud configuration when it changes.",
      "metadata": {
        "internal": true
      },
      "name": "iii-cloud::on-config-change",
      "request_schema": {
        "properties": {},
        "type": "object"
      },
      "response_schema": {
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "type": "object"
      }
    },
    {
      "description": "Called for each event of a followed log tail (logs::follow): type line (with line), gap (with missed) or end (with reason); carries follow_id. Observe it and filter on input.follow_id. Only the iii-cloud worker calls it.",
      "metadata": {},
      "name": "iii-cloud::on-log",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "LogEventType": {
            "enum": [
              "line",
              "gap",
              "end"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::on-log` event: one event of a followed log tail.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "follow_id": {
            "type": "string"
          },
          "line": {
            "description": "On `line`: the cloud's LogLine."
          },
          "missed": {
            "description": "On `gap`: how many lines were dropped.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "reason": {
            "description": "On `end`: `stream_ended`, `time_limit`, `not_connected`, `not_allowed`, `not_found` or `unreachable`.",
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "$ref": "#/definitions/LogEventType"
          }
        },
        "required": [
          "environment_id",
          "follow_id",
          "type"
        ],
        "title": "LogEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "LogEventType": {
            "enum": [
              "line",
              "gap",
              "end"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::on-log` event: one event of a followed log tail.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "follow_id": {
            "type": "string"
          },
          "line": {
            "description": "On `line`: the cloud's LogLine."
          },
          "missed": {
            "description": "On `gap`: how many lines were dropped.",
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "reason": {
            "description": "On `end`: `stream_ended`, `time_limit`, `not_connected`, `not_allowed`, `not_found` or `unreachable`.",
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "$ref": "#/definitions/LogEventType"
          }
        },
        "required": [
          "environment_id",
          "follow_id",
          "type"
        ],
        "title": "LogEvent",
        "type": "object"
      }
    },
    {
      "description": "Called for each event of a followed deployment or machines stream (stream::follow): type event (with the cloud's event) or end (with reason); carries follow_id and kind. Observe it and filter on input.follow_id. Only the iii-cloud worker calls it.",
      "metadata": {},
      "name": "iii-cloud::on-stream",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "StreamEventType": {
            "enum": [
              "event",
              "end"
            ],
            "type": "string"
          },
          "StreamKind": {
            "oneOf": [
              {
                "description": "A deployment's stages, log lines and statuses.",
                "enum": [
                  "deployment"
                ],
                "type": "string"
              },
              {
                "description": "The environment's machines: a snapshot on every change, and scaling steps.",
                "enum": [
                  "machines"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::on-stream` event: one event of a followed deployment or machines stream.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "event": {
            "description": "On `event`: the cloud's DeploymentEvent or MachinesEvent, as it came."
          },
          "follow_id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/definitions/StreamKind"
          },
          "reason": {
            "description": "On `end`: as in `LogEvent`; a deployment's follow also ends with `stream_ended` after its terminal status.",
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/definitions/StreamEventType"
              }
            ],
            "description": "`event` carries the cloud's event; `end` closes the follow."
          }
        },
        "required": [
          "environment_id",
          "follow_id",
          "kind",
          "type"
        ],
        "title": "StreamEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "StreamEventType": {
            "enum": [
              "event",
              "end"
            ],
            "type": "string"
          },
          "StreamKind": {
            "oneOf": [
              {
                "description": "A deployment's stages, log lines and statuses.",
                "enum": [
                  "deployment"
                ],
                "type": "string"
              },
              {
                "description": "The environment's machines: a snapshot on every change, and scaling steps.",
                "enum": [
                  "machines"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::on-stream` event: one event of a followed deployment or machines stream.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "event": {
            "description": "On `event`: the cloud's DeploymentEvent or MachinesEvent, as it came."
          },
          "follow_id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/definitions/StreamKind"
          },
          "reason": {
            "description": "On `end`: as in `LogEvent`; a deployment's follow also ends with `stream_ended` after its terminal status.",
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/definitions/StreamEventType"
              }
            ],
            "description": "`event` carries the cloud's event; `end` closes the follow."
          }
        },
        "required": [
          "environment_id",
          "follow_id",
          "kind",
          "type"
        ],
        "title": "StreamEvent",
        "type": "object"
      }
    },
    {
      "description": "The page's own: keep the person's choice for a console override of the newest check (file: the file's value wins at deploy; console: keep the console's, which takes a change to the file). A changed console or file value drops it. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::override::choose",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "OverrideChoice": {
            "description": "Which value of a console override the person keeps.",
            "oneOf": [
              {
                "description": "The file's value wins at deploy (what the deploy does already).",
                "enum": [
                  "file"
                ],
                "type": "string"
              },
              {
                "description": "The console's value is kept, which takes a change to the file.",
                "enum": [
                  "console"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::override::choose` input: the page's own.",
        "properties": {
          "choice": {
            "$ref": "#/definitions/OverrideChoice"
          },
          "environment_id": {
            "description": "The selected environment, as a guard (`ENVIRONMENT_CHANGED`).",
            "type": "string"
          },
          "setting": {
            "description": "The override's setting (`web`), as the newest check lists it.",
            "type": "string"
          }
        },
        "required": [
          "choice",
          "environment_id",
          "setting"
        ],
        "title": "OverrideChoose",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "OverrideChoice": {
            "description": "Which value of a console override the person keeps.",
            "oneOf": [
              {
                "description": "The file's value wins at deploy (what the deploy does already).",
                "enum": [
                  "file"
                ],
                "type": "string"
              },
              {
                "description": "The console's value is kept, which takes a change to the file.",
                "enum": [
                  "console"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "The environment's choices after `iii-cloud::override::choose`, as `Status.override_choices`.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "override_choices": {
            "additionalProperties": {
              "$ref": "#/definitions/OverrideChoice"
            },
            "type": "object"
          }
        },
        "required": [
          "environment_id",
          "override_choices"
        ],
        "title": "OverrideChosen",
        "type": "object"
      }
    },
    {
      "description": "The page's own: skip a cloud warning for now in the selected environment (`skip: false` undoes it); only LOCAL_CONFIG_NOT_SET. The next check shows it skipped, as info. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::problem::skip",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::problem::skip` input: the page's own. Only the warnings in `values::SKIPPABLE_PROBLEMS` (`LOCAL_CONFIG_NOT_SET`).",
        "properties": {
          "code": {
            "type": "string"
          },
          "environment_id": {
            "description": "The selected environment, as a guard (`ENVIRONMENT_CHANGED`).",
            "type": "string"
          },
          "skip": {
            "description": "`false` undoes the skip.",
            "type": "boolean"
          }
        },
        "required": [
          "code",
          "environment_id",
          "skip"
        ],
        "title": "ProblemSkip",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "The environment's skipped warning codes after `iii-cloud::problem::skip`, sorted.",
        "properties": {
          "codes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "environment_id": {
            "type": "string"
          }
        },
        "required": [
          "codes",
          "environment_id"
        ],
        "title": "ProblemsSkipped",
        "type": "object"
      }
    },
    {
      "description": "The page's own: import the repository as a new cloud project with its first environment, on the person's explicit choice, then select it (while another project is selected, it becomes status.candidate instead). Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::project::create",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::project::create` input: import this repository as a new cloud project.",
        "properties": {
          "environment_name": {
            "description": "Lowercase letters, digits and hyphens, at most 30.",
            "type": "string"
          },
          "manifest": {
            "description": "One of the repository's choosable compose files, relative to its root.",
            "type": "string"
          },
          "path": {
            "description": "A local folder inside the repository.",
            "type": "string"
          },
          "production": {
            "default": null,
            "description": "The first environment is production (default true).",
            "type": [
              "boolean",
              "null"
            ]
          },
          "team_id": {
            "type": "string"
          }
        },
        "required": [
          "environment_name",
          "manifest",
          "path",
          "team_id"
        ],
        "title": "ProjectCreateRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BranchRef": {
            "description": "A branch `project::use {from: checkout, source: name}` can take.",
            "properties": {
              "ahead": {
                "description": "Commits the selected environment's branch (`origin/<branch>`) does not have; null when that branch is not on origin.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "committed_at": {
                "type": "string"
              },
              "is_env_branch": {
                "description": "The selected environment deploys this branch.",
                "type": "boolean"
              },
              "name": {
                "description": "`main`, or `origin/feature-x` for a branch only on origin.",
                "type": "string"
              },
              "remote": {
                "type": "boolean"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "committed_at",
              "is_env_branch",
              "name",
              "remote",
              "sha"
            ],
            "type": "object"
          },
          "Checkout": {
            "properties": {
              "ahead": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branches": {
                "default": [],
                "description": "Local branches and origin's, newest commit first, at most 30; a local branch hides its origin twin. Read on refresh, from the refs as they are.",
                "items": {
                  "$ref": "#/definitions/BranchRef"
                },
                "type": "array"
              },
              "changed_files": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "head": {
                "type": "string"
              },
              "not_served": {
                "default": null,
                "description": "The checkout's commits the selected environment does not serve (`<served>..HEAD`, newest first, at most 50), read on refresh. Null when nothing is served yet or the served commit could not be fetched.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "ahead",
              "changed_files",
              "head"
            ],
            "type": "object"
          },
          "CloudProject": {
            "properties": {
              "created_at": {
                "default": null,
                "description": "When the project was made (for choosing between several).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "description": "Its newest deployment, when more than one project uses the repository.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "description": "The console's `$project` URL segment (`endpoint_slug`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "CloudProjectInfo": {
            "description": "A cloud project of the repository, for the page's project and environment selectors.",
            "properties": {
              "created_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentFull"
                },
                "type": "array"
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "environments",
              "id",
              "name",
              "team"
            ],
            "type": "object"
          },
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "EnvironmentBrief": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentFull": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "head": {
                "default": null,
                "description": "Its branch's head on origin, read on refresh. Null before the first refresh, or when origin did not answer or has no such branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "Importable": {
            "properties": {
              "manifests": {
                "items": {
                  "$ref": "#/definitions/ImportableManifest"
                },
                "type": "array"
              },
              "repository_id": {
                "format": "int64",
                "type": "integer"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "manifests",
              "repository_id",
              "team_id"
            ],
            "type": "object"
          },
          "ImportableManifest": {
            "properties": {
              "choosable": {
                "type": "boolean"
              },
              "has_cloud_block": {
                "default": false,
                "description": "The file on this machine has a `cloud:` section.",
                "type": "boolean"
              },
              "issue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "string"
              },
              "suggested_environment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "default": null,
                "description": "Its containers, as the file on this machine says (else as iii cloud lists them); null when neither knows.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "choosable",
              "path"
            ],
            "type": "object"
          },
          "OtherCloudProject": {
            "description": "A live cloud project of the person's teams that deploys another repository: it can't be used with this folder.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "repository": {
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "id",
              "name",
              "repository",
              "team"
            ],
            "type": "object"
          },
          "Project": {
            "properties": {
              "checkout": {
                "$ref": "#/definitions/Checkout"
              },
              "cloud_project": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/CloudProject"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cloud_projects": {
                "default": [],
                "description": "Every cloud project that uses this repository, across the person's teams, with its environments. The chosen one is `cloud_project`; `project::use {cloud_project_id}` picks another.",
                "items": {
                  "$ref": "#/definitions/CloudProjectInfo"
                },
                "type": "array"
              },
              "default_branch": {
                "default": null,
                "description": "The repository's default branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "environment": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/EnvironmentInfo"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentBrief"
                },
                "type": "array"
              },
              "fell_back_from": {
                "description": "Only in `project::use`'s answer: the `environment_id` asked for, which the cloud project no longer lists, so its default environment was taken.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "github_access": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "importable": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Importable"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "other_cloud_projects": {
                "default": [],
                "description": "Live projects of the person's teams that deploy another repository.",
                "items": {
                  "$ref": "#/definitions/OtherCloudProject"
                },
                "type": "array"
              },
              "path": {
                "type": "string"
              },
              "repository": {
                "description": "`owner/name`.",
                "type": "string"
              },
              "team": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/TeamRef"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "teams": {
                "items": {
                  "$ref": "#/definitions/TeamRef"
                },
                "type": "array"
              },
              "workspace": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Workspace"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "checkout",
              "environments",
              "path",
              "repository",
              "teams"
            ],
            "type": "object"
          },
          "TeamName": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "TeamRef": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "Workspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "from_head": {
                "default": null,
                "description": "The last commit the worktree took from the person's checkout (`from: checkout`): commits after it are the agent's. Null for a worktree made from the environment's branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "type": "string"
              },
              "source": {
                "default": null,
                "description": "The branch `use {from: checkout, source}` took; null: the checkout's HEAD.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_sha": {
                "default": null,
                "description": "The commit `source` (else the checkout's HEAD) pointed at when the worktree was prepared: \"moved since\" compares the source's tip with it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "mode",
              "path"
            ],
            "type": "object"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "description": "The answer of `project::create` and `project::create_environment`: the cloud projects read fresh, the new ids, and what is selected now.",
        "properties": {
          "cloud_projects": {
            "items": {
              "$ref": "#/definitions/CloudProjectInfo"
            },
            "type": "array"
          },
          "environment_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "allOf": [
              {
                "$ref": "#/definitions/Project"
              }
            ],
            "description": "The project as selected after `project::use`; while another project with a workspace is selected, the new one as `Status.candidate`, not selected."
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "cloud_projects",
          "project"
        ],
        "title": "CreateResponse",
        "type": "object"
      }
    },
    {
      "description": "The page's own: make a new environment in a cloud project (branch, compose file and copy_from default sensibly), on the person's explicit choice, then select it (an environment of status.candidate's project is not selected). Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::project::create_environment",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::project::create_environment` input.",
        "properties": {
          "branch": {
            "default": null,
            "description": "Default: the repository's default branch.",
            "type": [
              "string",
              "null"
            ]
          },
          "cloud_project_id": {
            "type": "string"
          },
          "copy_from": {
            "default": null,
            "description": "Default: the project's production environment, so secrets and settings carry over.",
            "type": [
              "string",
              "null"
            ]
          },
          "manifest": {
            "default": null,
            "description": "Default: the selected environment's compose file.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "production": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "start_empty": {
            "default": null,
            "description": "Copy nothing: no `copy_from` default. Not with `copy_from`.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "cloud_project_id",
          "name"
        ],
        "title": "EnvironmentCreateRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BranchRef": {
            "description": "A branch `project::use {from: checkout, source: name}` can take.",
            "properties": {
              "ahead": {
                "description": "Commits the selected environment's branch (`origin/<branch>`) does not have; null when that branch is not on origin.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "committed_at": {
                "type": "string"
              },
              "is_env_branch": {
                "description": "The selected environment deploys this branch.",
                "type": "boolean"
              },
              "name": {
                "description": "`main`, or `origin/feature-x` for a branch only on origin.",
                "type": "string"
              },
              "remote": {
                "type": "boolean"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "committed_at",
              "is_env_branch",
              "name",
              "remote",
              "sha"
            ],
            "type": "object"
          },
          "Checkout": {
            "properties": {
              "ahead": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branches": {
                "default": [],
                "description": "Local branches and origin's, newest commit first, at most 30; a local branch hides its origin twin. Read on refresh, from the refs as they are.",
                "items": {
                  "$ref": "#/definitions/BranchRef"
                },
                "type": "array"
              },
              "changed_files": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "head": {
                "type": "string"
              },
              "not_served": {
                "default": null,
                "description": "The checkout's commits the selected environment does not serve (`<served>..HEAD`, newest first, at most 50), read on refresh. Null when nothing is served yet or the served commit could not be fetched.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "ahead",
              "changed_files",
              "head"
            ],
            "type": "object"
          },
          "CloudProject": {
            "properties": {
              "created_at": {
                "default": null,
                "description": "When the project was made (for choosing between several).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "description": "Its newest deployment, when more than one project uses the repository.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "description": "The console's `$project` URL segment (`endpoint_slug`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "CloudProjectInfo": {
            "description": "A cloud project of the repository, for the page's project and environment selectors.",
            "properties": {
              "created_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentFull"
                },
                "type": "array"
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "environments",
              "id",
              "name",
              "team"
            ],
            "type": "object"
          },
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "EnvironmentBrief": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentFull": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "head": {
                "default": null,
                "description": "Its branch's head on origin, read on refresh. Null before the first refresh, or when origin did not answer or has no such branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "Importable": {
            "properties": {
              "manifests": {
                "items": {
                  "$ref": "#/definitions/ImportableManifest"
                },
                "type": "array"
              },
              "repository_id": {
                "format": "int64",
                "type": "integer"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "manifests",
              "repository_id",
              "team_id"
            ],
            "type": "object"
          },
          "ImportableManifest": {
            "properties": {
              "choosable": {
                "type": "boolean"
              },
              "has_cloud_block": {
                "default": false,
                "description": "The file on this machine has a `cloud:` section.",
                "type": "boolean"
              },
              "issue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "string"
              },
              "suggested_environment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "default": null,
                "description": "Its containers, as the file on this machine says (else as iii cloud lists them); null when neither knows.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "choosable",
              "path"
            ],
            "type": "object"
          },
          "OtherCloudProject": {
            "description": "A live cloud project of the person's teams that deploys another repository: it can't be used with this folder.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "repository": {
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "id",
              "name",
              "repository",
              "team"
            ],
            "type": "object"
          },
          "Project": {
            "properties": {
              "checkout": {
                "$ref": "#/definitions/Checkout"
              },
              "cloud_project": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/CloudProject"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cloud_projects": {
                "default": [],
                "description": "Every cloud project that uses this repository, across the person's teams, with its environments. The chosen one is `cloud_project`; `project::use {cloud_project_id}` picks another.",
                "items": {
                  "$ref": "#/definitions/CloudProjectInfo"
                },
                "type": "array"
              },
              "default_branch": {
                "default": null,
                "description": "The repository's default branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "environment": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/EnvironmentInfo"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentBrief"
                },
                "type": "array"
              },
              "fell_back_from": {
                "description": "Only in `project::use`'s answer: the `environment_id` asked for, which the cloud project no longer lists, so its default environment was taken.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "github_access": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "importable": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Importable"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "other_cloud_projects": {
                "default": [],
                "description": "Live projects of the person's teams that deploy another repository.",
                "items": {
                  "$ref": "#/definitions/OtherCloudProject"
                },
                "type": "array"
              },
              "path": {
                "type": "string"
              },
              "repository": {
                "description": "`owner/name`.",
                "type": "string"
              },
              "team": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/TeamRef"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "teams": {
                "items": {
                  "$ref": "#/definitions/TeamRef"
                },
                "type": "array"
              },
              "workspace": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Workspace"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "checkout",
              "environments",
              "path",
              "repository",
              "teams"
            ],
            "type": "object"
          },
          "TeamName": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "TeamRef": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "Workspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "from_head": {
                "default": null,
                "description": "The last commit the worktree took from the person's checkout (`from: checkout`): commits after it are the agent's. Null for a worktree made from the environment's branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "type": "string"
              },
              "source": {
                "default": null,
                "description": "The branch `use {from: checkout, source}` took; null: the checkout's HEAD.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_sha": {
                "default": null,
                "description": "The commit `source` (else the checkout's HEAD) pointed at when the worktree was prepared: \"moved since\" compares the source's tip with it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "mode",
              "path"
            ],
            "type": "object"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "description": "The answer of `project::create` and `project::create_environment`: the cloud projects read fresh, the new ids, and what is selected now.",
        "properties": {
          "cloud_projects": {
            "items": {
              "$ref": "#/definitions/CloudProjectInfo"
            },
            "type": "array"
          },
          "environment_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "project": {
            "allOf": [
              {
                "$ref": "#/definitions/Project"
              }
            ],
            "description": "The project as selected after `project::use`; while another project with a workspace is selected, the new one as `Status.candidate`, not selected."
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "cloud_projects",
          "project"
        ],
        "title": "CreateResponse",
        "type": "object"
      }
    },
    {
      "description": "Read the local folder and find its project and environment in iii cloud. While a project with a workspace is selected, the folder is kept as status.candidate, not selected: project::use selects it.",
      "metadata": {},
      "name": "iii-cloud::project::resolve",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::project::resolve` input.",
        "properties": {
          "cloud_project_id": {
            "default": null,
            "description": "Several cloud projects use the repository: take this one.",
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "description": "A local folder inside the repository.",
            "type": "string"
          },
          "team_id": {
            "default": null,
            "description": "Look only in this team.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "path"
        ],
        "title": "ResolveRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BranchRef": {
            "description": "A branch `project::use {from: checkout, source: name}` can take.",
            "properties": {
              "ahead": {
                "description": "Commits the selected environment's branch (`origin/<branch>`) does not have; null when that branch is not on origin.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "committed_at": {
                "type": "string"
              },
              "is_env_branch": {
                "description": "The selected environment deploys this branch.",
                "type": "boolean"
              },
              "name": {
                "description": "`main`, or `origin/feature-x` for a branch only on origin.",
                "type": "string"
              },
              "remote": {
                "type": "boolean"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "committed_at",
              "is_env_branch",
              "name",
              "remote",
              "sha"
            ],
            "type": "object"
          },
          "Checkout": {
            "properties": {
              "ahead": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branches": {
                "default": [],
                "description": "Local branches and origin's, newest commit first, at most 30; a local branch hides its origin twin. Read on refresh, from the refs as they are.",
                "items": {
                  "$ref": "#/definitions/BranchRef"
                },
                "type": "array"
              },
              "changed_files": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "head": {
                "type": "string"
              },
              "not_served": {
                "default": null,
                "description": "The checkout's commits the selected environment does not serve (`<served>..HEAD`, newest first, at most 50), read on refresh. Null when nothing is served yet or the served commit could not be fetched.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "ahead",
              "changed_files",
              "head"
            ],
            "type": "object"
          },
          "CloudProject": {
            "properties": {
              "created_at": {
                "default": null,
                "description": "When the project was made (for choosing between several).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "description": "Its newest deployment, when more than one project uses the repository.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "description": "The console's `$project` URL segment (`endpoint_slug`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "CloudProjectInfo": {
            "description": "A cloud project of the repository, for the page's project and environment selectors.",
            "properties": {
              "created_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentFull"
                },
                "type": "array"
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "environments",
              "id",
              "name",
              "team"
            ],
            "type": "object"
          },
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "EnvironmentBrief": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentFull": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "head": {
                "default": null,
                "description": "Its branch's head on origin, read on refresh. Null before the first refresh, or when origin did not answer or has no such branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "Importable": {
            "properties": {
              "manifests": {
                "items": {
                  "$ref": "#/definitions/ImportableManifest"
                },
                "type": "array"
              },
              "repository_id": {
                "format": "int64",
                "type": "integer"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "manifests",
              "repository_id",
              "team_id"
            ],
            "type": "object"
          },
          "ImportableManifest": {
            "properties": {
              "choosable": {
                "type": "boolean"
              },
              "has_cloud_block": {
                "default": false,
                "description": "The file on this machine has a `cloud:` section.",
                "type": "boolean"
              },
              "issue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "string"
              },
              "suggested_environment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "default": null,
                "description": "Its containers, as the file on this machine says (else as iii cloud lists them); null when neither knows.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "choosable",
              "path"
            ],
            "type": "object"
          },
          "OtherCloudProject": {
            "description": "A live cloud project of the person's teams that deploys another repository: it can't be used with this folder.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "repository": {
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "id",
              "name",
              "repository",
              "team"
            ],
            "type": "object"
          },
          "TeamName": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "TeamRef": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "Workspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "from_head": {
                "default": null,
                "description": "The last commit the worktree took from the person's checkout (`from: checkout`): commits after it are the agent's. Null for a worktree made from the environment's branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "type": "string"
              },
              "source": {
                "default": null,
                "description": "The branch `use {from: checkout, source}` took; null: the checkout's HEAD.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_sha": {
                "default": null,
                "description": "The commit `source` (else the checkout's HEAD) pointed at when the worktree was prepared: \"moved since\" compares the source's tip with it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "mode",
              "path"
            ],
            "type": "object"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "properties": {
          "checkout": {
            "$ref": "#/definitions/Checkout"
          },
          "cloud_project": {
            "anyOf": [
              {
                "$ref": "#/definitions/CloudProject"
              },
              {
                "type": "null"
              }
            ]
          },
          "cloud_projects": {
            "default": [],
            "description": "Every cloud project that uses this repository, across the person's teams, with its environments. The chosen one is `cloud_project`; `project::use {cloud_project_id}` picks another.",
            "items": {
              "$ref": "#/definitions/CloudProjectInfo"
            },
            "type": "array"
          },
          "default_branch": {
            "default": null,
            "description": "The repository's default branch.",
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "anyOf": [
              {
                "$ref": "#/definitions/EnvironmentInfo"
              },
              {
                "type": "null"
              }
            ]
          },
          "environments": {
            "items": {
              "$ref": "#/definitions/EnvironmentBrief"
            },
            "type": "array"
          },
          "fell_back_from": {
            "description": "Only in `project::use`'s answer: the `environment_id` asked for, which the cloud project no longer lists, so its default environment was taken.",
            "type": [
              "string",
              "null"
            ]
          },
          "github_access": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "importable": {
            "anyOf": [
              {
                "$ref": "#/definitions/Importable"
              },
              {
                "type": "null"
              }
            ]
          },
          "other_cloud_projects": {
            "default": [],
            "description": "Live projects of the person's teams that deploy another repository.",
            "items": {
              "$ref": "#/definitions/OtherCloudProject"
            },
            "type": "array"
          },
          "path": {
            "type": "string"
          },
          "repository": {
            "description": "`owner/name`.",
            "type": "string"
          },
          "team": {
            "anyOf": [
              {
                "$ref": "#/definitions/TeamRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "teams": {
            "items": {
              "$ref": "#/definitions/TeamRef"
            },
            "type": "array"
          },
          "workspace": {
            "anyOf": [
              {
                "$ref": "#/definitions/Workspace"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "checkout",
          "environments",
          "path",
          "repository",
          "teams"
        ],
        "title": "Project",
        "type": "object"
      }
    },
    {
      "description": "Select the environment and prepare a worktree for you to work in.",
      "metadata": {},
      "name": "iii-cloud::project::use",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "UseFrom": {
            "enum": [
              "environment",
              "checkout"
            ],
            "type": "string"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::project::use` input.",
        "properties": {
          "cloud_project_id": {
            "default": null,
            "description": "Several cloud projects use the repository: take this one.",
            "type": [
              "string",
              "null"
            ]
          },
          "environment_id": {
            "default": null,
            "description": "The environment; or only `cloud_project_id`, for that project's default one.",
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "anyOf": [
              {
                "$ref": "#/definitions/UseFrom"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Where the worktree's commits come from. `environment` (default): the environment's branch. `checkout`: the person's own HEAD with the environment's head: a fast-forward when one contains the other, else a merge commit made in the worktree (never in the checkout); a conflict leaves the worktree as it was (`MERGE_CONFLICT`, the files in the message). Only commits move: nothing uncommitted is copied. Never for production, which goes through a pull request."
          },
          "mode": {
            "allOf": [
              {
                "$ref": "#/definitions/WorkspaceMode"
              }
            ],
            "description": "`worktree` (recommended) or `checkout`."
          },
          "path": {
            "type": "string"
          },
          "source": {
            "default": null,
            "description": "With `from: checkout`: take this branch (`main`, `origin/feature-x`, one of `checkout.branches`) instead of the checkout's HEAD, by the same rule.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "mode",
          "path"
        ],
        "title": "UseRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "BranchRef": {
            "description": "A branch `project::use {from: checkout, source: name}` can take.",
            "properties": {
              "ahead": {
                "description": "Commits the selected environment's branch (`origin/<branch>`) does not have; null when that branch is not on origin.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "committed_at": {
                "type": "string"
              },
              "is_env_branch": {
                "description": "The selected environment deploys this branch.",
                "type": "boolean"
              },
              "name": {
                "description": "`main`, or `origin/feature-x` for a branch only on origin.",
                "type": "string"
              },
              "remote": {
                "type": "boolean"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "committed_at",
              "is_env_branch",
              "name",
              "remote",
              "sha"
            ],
            "type": "object"
          },
          "Checkout": {
            "properties": {
              "ahead": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branches": {
                "default": [],
                "description": "Local branches and origin's, newest commit first, at most 30; a local branch hides its origin twin. Read on refresh, from the refs as they are.",
                "items": {
                  "$ref": "#/definitions/BranchRef"
                },
                "type": "array"
              },
              "changed_files": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "head": {
                "type": "string"
              },
              "not_served": {
                "default": null,
                "description": "The checkout's commits the selected environment does not serve (`<served>..HEAD`, newest first, at most 50), read on refresh. Null when nothing is served yet or the served commit could not be fetched.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "ahead",
              "changed_files",
              "head"
            ],
            "type": "object"
          },
          "CloudProject": {
            "properties": {
              "created_at": {
                "default": null,
                "description": "When the project was made (for choosing between several).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "description": "Its newest deployment, when more than one project uses the repository.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "description": "The console's `$project` URL segment (`endpoint_slug`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "CloudProjectInfo": {
            "description": "A cloud project of the repository, for the page's project and environment selectors.",
            "properties": {
              "created_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentFull"
                },
                "type": "array"
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "environments",
              "id",
              "name",
              "team"
            ],
            "type": "object"
          },
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "EnvironmentBrief": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentFull": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "head": {
                "default": null,
                "description": "Its branch's head on origin, read on refresh. Null before the first refresh, or when origin did not answer or has no such branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "Importable": {
            "properties": {
              "manifests": {
                "items": {
                  "$ref": "#/definitions/ImportableManifest"
                },
                "type": "array"
              },
              "repository_id": {
                "format": "int64",
                "type": "integer"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "manifests",
              "repository_id",
              "team_id"
            ],
            "type": "object"
          },
          "ImportableManifest": {
            "properties": {
              "choosable": {
                "type": "boolean"
              },
              "has_cloud_block": {
                "default": false,
                "description": "The file on this machine has a `cloud:` section.",
                "type": "boolean"
              },
              "issue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "string"
              },
              "suggested_environment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "default": null,
                "description": "Its containers, as the file on this machine says (else as iii cloud lists them); null when neither knows.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "choosable",
              "path"
            ],
            "type": "object"
          },
          "OtherCloudProject": {
            "description": "A live cloud project of the person's teams that deploys another repository: it can't be used with this folder.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "repository": {
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "id",
              "name",
              "repository",
              "team"
            ],
            "type": "object"
          },
          "TeamName": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "TeamRef": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "Workspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "from_head": {
                "default": null,
                "description": "The last commit the worktree took from the person's checkout (`from: checkout`): commits after it are the agent's. Null for a worktree made from the environment's branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "type": "string"
              },
              "source": {
                "default": null,
                "description": "The branch `use {from: checkout, source}` took; null: the checkout's HEAD.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_sha": {
                "default": null,
                "description": "The commit `source` (else the checkout's HEAD) pointed at when the worktree was prepared: \"moved since\" compares the source's tip with it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "mode",
              "path"
            ],
            "type": "object"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "properties": {
          "checkout": {
            "$ref": "#/definitions/Checkout"
          },
          "cloud_project": {
            "anyOf": [
              {
                "$ref": "#/definitions/CloudProject"
              },
              {
                "type": "null"
              }
            ]
          },
          "cloud_projects": {
            "default": [],
            "description": "Every cloud project that uses this repository, across the person's teams, with its environments. The chosen one is `cloud_project`; `project::use {cloud_project_id}` picks another.",
            "items": {
              "$ref": "#/definitions/CloudProjectInfo"
            },
            "type": "array"
          },
          "default_branch": {
            "default": null,
            "description": "The repository's default branch.",
            "type": [
              "string",
              "null"
            ]
          },
          "environment": {
            "anyOf": [
              {
                "$ref": "#/definitions/EnvironmentInfo"
              },
              {
                "type": "null"
              }
            ]
          },
          "environments": {
            "items": {
              "$ref": "#/definitions/EnvironmentBrief"
            },
            "type": "array"
          },
          "fell_back_from": {
            "description": "Only in `project::use`'s answer: the `environment_id` asked for, which the cloud project no longer lists, so its default environment was taken.",
            "type": [
              "string",
              "null"
            ]
          },
          "github_access": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "importable": {
            "anyOf": [
              {
                "$ref": "#/definitions/Importable"
              },
              {
                "type": "null"
              }
            ]
          },
          "other_cloud_projects": {
            "default": [],
            "description": "Live projects of the person's teams that deploy another repository.",
            "items": {
              "$ref": "#/definitions/OtherCloudProject"
            },
            "type": "array"
          },
          "path": {
            "type": "string"
          },
          "repository": {
            "description": "`owner/name`.",
            "type": "string"
          },
          "team": {
            "anyOf": [
              {
                "$ref": "#/definitions/TeamRef"
              },
              {
                "type": "null"
              }
            ]
          },
          "teams": {
            "items": {
              "$ref": "#/definitions/TeamRef"
            },
            "type": "array"
          },
          "workspace": {
            "anyOf": [
              {
                "$ref": "#/definitions/Workspace"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "checkout",
          "environments",
          "path",
          "repository",
          "teams"
        ],
        "title": "Project",
        "type": "object"
      }
    },
    {
      "description": "The page's own: open a pull request from one environment's branch into another's (dev into production) with the person's gh, in their project folder, listing the commits; returns the one already open for that head and base instead of a second. Merging it and the deploy stay the person's. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::promote",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::promote` input: the page's own.",
        "properties": {
          "from_environment_id": {
            "description": "The environment whose branch goes into the other (dev).",
            "type": "string"
          },
          "to_environment_id": {
            "description": "The environment that takes it (production).",
            "type": "string"
          }
        },
        "required": [
          "from_environment_id",
          "to_environment_id"
        ],
        "title": "PromoteRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "The pull request `iii-cloud::promote` opened, or found already open.",
        "properties": {
          "base": {
            "description": "The `to` environment's branch.",
            "type": "string"
          },
          "created": {
            "description": "False when a pull request from `head` into `base` was already open.",
            "type": "boolean"
          },
          "head": {
            "description": "The `from` environment's branch.",
            "type": "string"
          },
          "number": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "base",
          "created",
          "head",
          "number",
          "title",
          "url"
        ],
        "title": "Promoted",
        "type": "object"
      }
    },
    {
      "description": "Prepare a rollback, a cancel or a retry of one deployment for the person to confirm. It only reads (GET) and changes nothing in iii cloud: it checks the deployment can take the action, and answers the proposal (action, environment, project, the deployment, what serves now, and for a rollback what comes back and what stays) or an error with a code and a message to repeat to the person (ALREADY_LIVE, NOT_A_ROLLBACK_TARGET, NOT_RUNNING, NOT_RETRYABLE). The chat draws a card from the answer, and the person confirms there, on the page; you never do. Say the confirmation waits on the card, never that it was done.",
      "metadata": {},
      "name": "iii-cloud::propose",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "ProposeAction": {
            "description": "What `iii-cloud::propose` prepares for the person to confirm.",
            "enum": [
              "rollback",
              "cancel",
              "retry"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::propose` input.",
        "properties": {
          "action": {
            "$ref": "#/definitions/ProposeAction"
          },
          "deployment_id": {
            "description": "The deployment to roll back to, cancel or retry.",
            "type": "string"
          },
          "environment_id": {
            "description": "The environment the deployment belongs to.",
            "type": "string"
          }
        },
        "required": [
          "action",
          "deployment_id",
          "environment_id"
        ],
        "title": "ProposeRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "ProposalDeployment": {
            "properties": {
              "finished_at": {
                "description": "When the deployment ended, if it did.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "number": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "sha": {
                "type": "string"
              },
              "status": {
                "description": "The cloud's status: queued, in_progress, needs_action, ready, failed, replaced or canceled.",
                "type": "string"
              }
            },
            "required": [
              "id",
              "number",
              "sha",
              "status"
            ],
            "type": "object"
          },
          "ProposalPreview": {
            "description": "What a rollback brings back and what stays, as iii cloud's preview says.",
            "properties": {
              "queue": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "returns": {
                "default": [],
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "side_effects": {
                "default": [],
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "stays": {
                "default": [],
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "type": "object"
          },
          "ProposeAction": {
            "description": "What `iii-cloud::propose` prepares for the person to confirm.",
            "enum": [
              "rollback",
              "cancel",
              "retry"
            ],
            "type": "string"
          }
        },
        "description": "A proposal the person confirms on the card in the chat. Nothing was changed in iii cloud.",
        "properties": {
          "action": {
            "$ref": "#/definitions/ProposeAction"
          },
          "deployment": {
            "$ref": "#/definitions/ProposalDeployment"
          },
          "environment": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "preview": {
            "anyOf": [
              {
                "$ref": "#/definitions/ProposalPreview"
              },
              {
                "type": "null"
              }
            ],
            "description": "A rollback's preview; null for cancel and retry."
          },
          "project": {
            "type": "string"
          },
          "serving": {
            "anyOf": [
              {
                "$ref": "#/definitions/ProposalDeployment"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the environment serves now; null when nothing is live."
          }
        },
        "required": [
          "action",
          "deployment",
          "environment",
          "environment_id",
          "project"
        ],
        "title": "Proposal",
        "type": "object"
      }
    },
    {
      "description": "Ask the person, on the page, for the value of one secret the compose file reads (a name like STRIPE_KEY in ${STRIPE_KEY}), or mark such a name as not needed (mode: not_needed). It is not for workers, groups or any choice that is not a variable: a decision goes to the person with harness::ask.",
      "metadata": {},
      "name": "iii-cloud::secret",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "SecretMode": {
            "enum": [
              "ask",
              "not_needed"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::secret` input.",
        "properties": {
          "description": {
            "description": "What the person needs to know to give the value.",
            "type": "string"
          },
          "external": {
            "default": null,
            "description": "The person chose a database outside iii cloud: only then may a database URL be asked for.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "handoff_id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "anyOf": [
              {
                "$ref": "#/definitions/SecretMode"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "name": {
            "description": "`^[A-Z_][A-Z0-9_]*$`, not starting with `III_`.",
            "type": "string"
          }
        },
        "required": [
          "description",
          "name"
        ],
        "title": "SecretAsk",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CloudOutcome": {
            "enum": [
              "set",
              "skipped",
              "failed"
            ],
            "type": "string"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "LocalOutcome": {
            "enum": [
              "set",
              "skipped"
            ],
            "type": "string"
          },
          "SecretMode": {
            "enum": [
              "ask",
              "not_needed"
            ],
            "type": "string"
          },
          "SecretState": {
            "enum": [
              "waiting",
              "set",
              "left_empty",
              "noted",
              "failed"
            ],
            "type": "string"
          },
          "Selected": {
            "properties": {
              "env": {
                "$ref": "#/definitions/EnvironmentInfo"
              },
              "team_id": {
                "type": "string"
              },
              "workspace": {
                "type": "string"
              }
            },
            "required": [
              "env",
              "team_id",
              "workspace"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "asked_at": {
            "type": "string"
          },
          "cloud": {
            "anyOf": [
              {
                "$ref": "#/definitions/CloudOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/WorkerError"
              },
              {
                "type": "null"
              }
            ]
          },
          "external": {
            "default": false,
            "description": "Asked for a database URL the person chose to keep outside iii cloud.",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "local": {
            "anyOf": [
              {
                "$ref": "#/definitions/LocalOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "$ref": "#/definitions/SecretMode"
          },
          "name": {
            "type": "string"
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/definitions/SecretState"
          },
          "target": {
            "anyOf": [
              {
                "$ref": "#/definitions/Selected"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the value goes: the team, worktree and environment the request was asked for, whatever the page has selected when the value is saved."
          }
        },
        "required": [
          "asked_at",
          "description",
          "environment_id",
          "id",
          "mode",
          "name",
          "state"
        ],
        "title": "SecretRequest",
        "type": "object"
      }
    },
    {
      "description": "The page's own: the person's secret value goes to iii cloud and the worktree's .env. Agents never call it, and the value never comes back.",
      "metadata": {
        "trace_hidden": true
      },
      "name": "iii-cloud::secret::provide",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::secret::provide` input. Page only.",
        "properties": {
          "leave_empty": {
            "default": null,
            "type": [
              "boolean",
              "null"
            ]
          },
          "request_id": {
            "type": "string"
          },
          "value": {
            "default": null,
            "description": "The secret value. Never logged, never returned.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "request_id"
        ],
        "title": "ProvideRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CloudOutcome": {
            "enum": [
              "set",
              "skipped",
              "failed"
            ],
            "type": "string"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "LocalOutcome": {
            "enum": [
              "set",
              "skipped"
            ],
            "type": "string"
          },
          "SecretMode": {
            "enum": [
              "ask",
              "not_needed"
            ],
            "type": "string"
          },
          "SecretState": {
            "enum": [
              "waiting",
              "set",
              "left_empty",
              "noted",
              "failed"
            ],
            "type": "string"
          },
          "Selected": {
            "properties": {
              "env": {
                "$ref": "#/definitions/EnvironmentInfo"
              },
              "team_id": {
                "type": "string"
              },
              "workspace": {
                "type": "string"
              }
            },
            "required": [
              "env",
              "team_id",
              "workspace"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "properties": {
          "asked_at": {
            "type": "string"
          },
          "cloud": {
            "anyOf": [
              {
                "$ref": "#/definitions/CloudOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/WorkerError"
              },
              {
                "type": "null"
              }
            ]
          },
          "external": {
            "default": false,
            "description": "Asked for a database URL the person chose to keep outside iii cloud.",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "local": {
            "anyOf": [
              {
                "$ref": "#/definitions/LocalOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "$ref": "#/definitions/SecretMode"
          },
          "name": {
            "type": "string"
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/definitions/SecretState"
          },
          "target": {
            "anyOf": [
              {
                "$ref": "#/definitions/Selected"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the value goes: the team, worktree and environment the request was asked for, whatever the page has selected when the value is saved."
          }
        },
        "required": [
          "asked_at",
          "description",
          "environment_id",
          "id",
          "mode",
          "name",
          "state"
        ],
        "title": "SecretRequest",
        "type": "object"
      }
    },
    {
      "description": "The stored state: connection, project, latest check, run, secrets, pull request and deploy. refresh re-reads the checkout, the pull request, the variables and the deployments.",
      "metadata": {},
      "name": "iii-cloud::status",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::status` input.",
        "properties": {
          "refresh": {
            "default": null,
            "description": "Re-read the checkout, the pull request, the variables and the deployments first.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "title": "StatusRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "AgentPhase": {
            "oneOf": [
              {
                "enum": [
                  "starting",
                  "working",
                  "waiting_for_you",
                  "stalled",
                  "done",
                  "stopped"
                ],
                "type": "string"
              },
              {
                "description": "The turn ended on a wake the agent armed (an observer that notifies its chat, unfired and unexpired): it waits on an event, not on the person.",
                "enum": [
                  "waiting"
                ],
                "type": "string"
              }
            ]
          },
          "AgentState": {
            "description": "What the agent is doing for a hand-off, as the worker sees it. Descriptions only: no message body, tool input or result is ever copied here.",
            "properties": {
              "current": {
                "description": "The last call's description, plain text, at most 120 characters.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "handoff_id": {
                "type": "string"
              },
              "kind": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/HandoffKind"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "What the hand-off is for, so the page can place its row."
              },
              "last_activity_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "default": null,
                "description": "One plain line from the agent about what it is doing, at most 120 characters.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "question": {
                "description": "The open question's text, when the agent waits for an answer.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "question_source": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/QuestionSource"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "Where `question` comes from: a real ask from the agent's session, or text this worker made from the check's open problems. Absent when there is no question."
              },
              "session_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "started_at": {
                "type": "string"
              },
              "state": {
                "$ref": "#/definitions/AgentPhase"
              },
              "steps": {
                "description": "Function calls the session has made.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "waiting_for": {
                "default": null,
                "description": "What the agent waits for when `state` is `waiting` (\"the run here to end\").",
                "type": [
                  "string",
                  "null"
                ]
              },
              "working_on": {
                "default": [],
                "description": "Ids of the newest check's problems the agent is working on now (the page shows a spinner on them). Cleared when they leave a newer check or the hand-off ends.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "handoff_id",
              "started_at",
              "state",
              "steps"
            ],
            "type": "object"
          },
          "ApiKeyRef": {
            "properties": {
              "environment_id": {
                "type": "string"
              },
              "secret": {
                "type": "string"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "environment_id",
              "secret",
              "team_id"
            ],
            "type": "object"
          },
          "BranchRef": {
            "description": "A branch `project::use {from: checkout, source: name}` can take.",
            "properties": {
              "ahead": {
                "description": "Commits the selected environment's branch (`origin/<branch>`) does not have; null when that branch is not on origin.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "committed_at": {
                "type": "string"
              },
              "is_env_branch": {
                "description": "The selected environment deploys this branch.",
                "type": "boolean"
              },
              "name": {
                "description": "`main`, or `origin/feature-x` for a branch only on origin.",
                "type": "string"
              },
              "remote": {
                "type": "boolean"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "committed_at",
              "is_env_branch",
              "name",
              "remote",
              "sha"
            ],
            "type": "object"
          },
          "BriefBase": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "branch",
              "sha"
            ],
            "type": "object"
          },
          "BriefDeploy": {
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "diagnosis": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Diagnosis"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "iii cloud's diagnosis, read when the hand-off was made (`None`: it had no likely cause)."
              },
              "hint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "release_command": {
                "default": null,
                "description": "The release command from the manifest, when the failure is the release's.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "silent": {
                "default": false,
                "type": "boolean"
              },
              "stage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "log_tail"
            ],
            "type": "object"
          },
          "BriefProblem": {
            "properties": {
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "file": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "owner": {
                "$ref": "#/definitions/Owner"
              },
              "severity": {
                "$ref": "#/definitions/Severity"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "id",
              "owner",
              "severity",
              "title"
            ],
            "type": "object"
          },
          "BriefWorkspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "branch",
              "path"
            ],
            "type": "object"
          },
          "Check": {
            "properties": {
              "base": {
                "description": "The environment branch's head when checked.",
                "type": "string"
              },
              "checked_at": {
                "type": "string"
              },
              "commit": {
                "type": "string"
              },
              "commits": {
                "default": [],
                "description": "The commits of `base..commit`, newest first, at most 50. Empty when the base was not read or the commit is not on this machine.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": "array"
              },
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "environment_id": {
                "type": "string"
              },
              "handoff_id": {
                "default": null,
                "description": "The hand-off whose agent asked for it; null for the page's own checks.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "here": {
                "$ref": "#/definitions/HerePart"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "default": null,
                "description": "The compose file it was checked with, from the repository root. When it is not the environment's, deploying this check switches the environment to it.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "plan": {
                "$ref": "#/definitions/PlanPart"
              },
              "problems": {
                "description": "Cloud plan first, then the checks here.",
                "items": {
                  "$ref": "#/definitions/Problem"
                },
                "type": "array"
              },
              "ready": {
                "type": "boolean"
              },
              "report": {
                "type": "string"
              },
              "run": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Run"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "base",
              "checked_at",
              "commit",
              "duration_ms",
              "environment_id",
              "here",
              "id",
              "plan",
              "problems",
              "ready",
              "report"
            ],
            "type": "object"
          },
          "CheckSummary": {
            "description": "A check in short, for the page's history (`Status.checks`); the whole record is `iii-cloud::check::get {id}`.",
            "properties": {
              "checked_at": {
                "type": "string"
              },
              "commit": {
                "type": "string"
              },
              "duration_ms": {
                "description": "The plan and the checks here; a run's time is in its stages.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "environment_id": {
                "type": "string"
              },
              "handoff_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "problems": {
                "description": "The problems someone acts on (owner `agent` or `person`).",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ready": {
                "type": "boolean"
              }
            },
            "required": [
              "checked_at",
              "commit",
              "duration_ms",
              "environment_id",
              "id",
              "problems",
              "ready"
            ],
            "type": "object"
          },
          "Checkout": {
            "properties": {
              "ahead": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "branch": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "branches": {
                "default": [],
                "description": "Local branches and origin's, newest commit first, at most 30; a local branch hides its origin twin. Read on refresh, from the refs as they are.",
                "items": {
                  "$ref": "#/definitions/BranchRef"
                },
                "type": "array"
              },
              "changed_files": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "head": {
                "type": "string"
              },
              "not_served": {
                "default": null,
                "description": "The checkout's commits the selected environment does not serve (`<served>..HEAD`, newest first, at most 50), read on refresh. Null when nothing is served yet or the served commit could not be fetched.",
                "items": {
                  "$ref": "#/definitions/CommitLine"
                },
                "type": [
                  "array",
                  "null"
                ]
              }
            },
            "required": [
              "ahead",
              "changed_files",
              "head"
            ],
            "type": "object"
          },
          "CloudOutcome": {
            "enum": [
              "set",
              "skipped",
              "failed"
            ],
            "type": "string"
          },
          "CloudProject": {
            "properties": {
              "created_at": {
                "default": null,
                "description": "When the project was made (for choosing between several).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "description": "Its newest deployment, when more than one project uses the repository.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "description": "The console's `$project` URL segment (`endpoint_slug`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "CloudProjectInfo": {
            "description": "A cloud project of the repository, for the page's project and environment selectors.",
            "properties": {
              "created_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentFull"
                },
                "type": "array"
              },
              "id": {
                "type": "string"
              },
              "last_deployment_at": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "default": "",
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "environments",
              "id",
              "name",
              "team"
            ],
            "type": "object"
          },
          "CommitLine": {
            "properties": {
              "message": {
                "description": "The subject line.",
                "type": "string"
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "sha"
            ],
            "type": "object"
          },
          "Confirmations": {
            "properties": {
              "overrides": {
                "items": {
                  "$ref": "#/definitions/OverrideConfirmation"
                },
                "type": "array"
              },
              "resources": {
                "items": {
                  "$ref": "#/definitions/ResourceConfirmation"
                },
                "type": "array"
              }
            },
            "required": [
              "overrides",
              "resources"
            ],
            "type": "object"
          },
          "ConnStatus": {
            "enum": [
              "signed_out",
              "waiting",
              "connected",
              "expired",
              "error"
            ],
            "type": "string"
          },
          "Connection": {
            "properties": {
              "api_key": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ApiKeyRef"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cloud_url": {
                "type": "string"
              },
              "device": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Device"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Method"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "$ref": "#/definitions/ConnStatus"
              },
              "teams": {
                "items": {
                  "$ref": "#/definitions/TeamRole"
                },
                "type": "array"
              },
              "user": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/User"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "cloud_url",
              "status",
              "teams"
            ],
            "type": "object"
          },
          "Deploy": {
            "properties": {
              "approved_by_worker": {
                "type": "boolean"
              },
              "check_id": {
                "default": null,
                "description": "The check this worker deployed (`deploy {check_id}`); null for a deployment made elsewhere.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "checked_ready": {
                "type": "boolean"
              },
              "commit": {
                "$ref": "#/definitions/DeployCommit"
              },
              "console_url": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "environment_id": {
                "type": "string"
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/DeployError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "failure": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/DeployFailure"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "For a failed deploy: what failed, in plain words, with the failing stage's log."
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "from_console": {
                "default": false,
                "description": "This worker did not create it: made in the console (the cloud's `type` is `manual` for both).",
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "number": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "outcome": {
                "$ref": "#/definitions/Outcome"
              },
              "pr": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "release_row": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ReleaseRow"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "replaced_by": {
                "default": null,
                "description": "The deployment that replaced this one, when it is `replaced`.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "stages": {
                "items": {
                  "$ref": "#/definitions/DeployStage"
                },
                "type": "array"
              },
              "status": {
                "type": "string"
              },
              "status_detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "approved_by_worker",
              "checked_ready",
              "commit",
              "console_url",
              "created_at",
              "environment_id",
              "id",
              "log_tail",
              "number",
              "outcome",
              "stages",
              "status",
              "type"
            ],
            "type": "object"
          },
          "DeployCommit": {
            "properties": {
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "sha"
            ],
            "type": "object"
          },
          "DeployError": {
            "properties": {
              "action": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              },
              "stage": {
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "stage"
            ],
            "type": "object"
          },
          "DeployFailure": {
            "description": "A failed deploy in plain words (spec: readable failures).",
            "properties": {
              "code": {
                "type": "string"
              },
              "diagnosis": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Diagnosis"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "iii cloud's diagnosis of the failure, when it has a likely cause."
              },
              "hint": {
                "type": "string"
              },
              "log_tail": {
                "description": "The last ~40 lines of the failing stage's log, oldest first, redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "release_command": {
                "default": null,
                "description": "The release command from the manifest, for a release failure.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "silent": {
                "default": false,
                "description": "The log shows an exit status but no error text.",
                "type": "boolean"
              },
              "stage": {
                "type": "string"
              },
              "title": {
                "description": "Plain, per code: \"The release command failed: `pnpm migrate`\".",
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "log_tail",
              "stage",
              "title"
            ],
            "type": "object"
          },
          "DeployStage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "started_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "Device": {
            "properties": {
              "expires_at": {
                "type": "string"
              },
              "user_code": {
                "type": "string"
              },
              "verification_uri": {
                "type": "string"
              }
            },
            "required": [
              "expires_at",
              "user_code",
              "verification_uri"
            ],
            "type": "object"
          },
          "Diagnosis": {
            "description": "iii cloud's read-only diagnosis of a failed deployment: a lead, not proof.",
            "properties": {
              "cause": {
                "type": "string"
              },
              "evidence": {
                "description": "What it rests on, one line each (a log line, a file and its lines), redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "next_step": {
                "type": "string"
              }
            },
            "required": [
              "cause",
              "evidence",
              "next_step"
            ],
            "type": "object"
          },
          "EnvironmentBrief": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentFull": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "head": {
                "default": null,
                "description": "Its branch's head on origin, read on refresh. Null before the first refresh, or when origin did not answer or has no such branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "EnvironmentInfo": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "manifest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "production": {
                "type": "boolean"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "id",
              "name",
              "production"
            ],
            "type": "object"
          },
          "Excerpt": {
            "properties": {
              "lines": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "start_line": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "lines",
              "start_line"
            ],
            "type": "object"
          },
          "HandoffBrief": {
            "description": "Everything the agent needs for a hand-off, so the prompt can be one plain sentence plus the marker. No secret value is in it.",
            "properties": {
              "agent_problems": {
                "description": "The problems that are the agent's to fix.",
                "items": {
                  "$ref": "#/definitions/BriefProblem"
                },
                "type": "array"
              },
              "base": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/BriefBase"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "The base branch and its sha when the worktree was made: reset to it to start again (`OLD_ATTEMPT_COMMITS`)."
              },
              "check_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "checkout_path": {
                "description": "The person's own checkout: do not touch it.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "commit": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "deploy": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/BriefDeploy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "handoff_id": {
                "type": "string"
              },
              "kind": {
                "$ref": "#/definitions/HandoffKind"
              },
              "manifest": {
                "description": "The compose file checked and deployed, relative to the worktree: the hand-off's, else the environment's.",
                "type": "string"
              },
              "next_step": {
                "type": "string"
              },
              "other_compose_files": {
                "description": "Other compose files tracked in the worktree that declare `containers:` (at most 10). They are not checked or deployed.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "person_problems": {
                "description": "The ones the person decides: bring each with a recommendation.",
                "items": {
                  "$ref": "#/definitions/BriefProblem"
                },
                "type": "array"
              },
              "project": {
                "description": "`<project> · <environment>`.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "pushes_directly": {
                "default": false,
                "description": "The environment is not production: it gets an assisted deploy, no pull request. Push only your fix branch; the person's deploy on the page sends the checked commit to the environment's own branch.",
                "type": "boolean"
              },
              "remote_branch_note": {
                "default": null,
                "description": "One line when an earlier try left the fix branch on origin: the first push replaces it with `--force-with-lease`.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "repository": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "worktree": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/BriefWorkspace"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Where to work."
              }
            },
            "required": [
              "agent_problems",
              "handoff_id",
              "kind",
              "manifest",
              "next_step",
              "other_compose_files",
              "person_problems"
            ],
            "type": "object"
          },
          "HandoffKind": {
            "oneOf": [
              {
                "enum": [
                  "ready",
                  "deploy_fix",
                  "pull_request"
                ],
                "type": "string"
              },
              {
                "description": "The project is not in iii cloud yet.",
                "enum": [
                  "import"
                ],
                "type": "string"
              }
            ]
          },
          "HealthResult": {
            "properties": {
              "path": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "path"
            ],
            "type": "object"
          },
          "HerePart": {
            "properties": {
              "accepts_cloud_block": {
                "type": "boolean"
              },
              "iii_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "problems": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "accepts_cloud_block",
              "problems"
            ],
            "type": "object"
          },
          "Importable": {
            "properties": {
              "manifests": {
                "items": {
                  "$ref": "#/definitions/ImportableManifest"
                },
                "type": "array"
              },
              "repository_id": {
                "format": "int64",
                "type": "integer"
              },
              "team_id": {
                "type": "string"
              }
            },
            "required": [
              "manifests",
              "repository_id",
              "team_id"
            ],
            "type": "object"
          },
          "ImportableManifest": {
            "properties": {
              "choosable": {
                "type": "boolean"
              },
              "has_cloud_block": {
                "default": false,
                "description": "The file on this machine has a `cloud:` section.",
                "type": "boolean"
              },
              "issue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "string"
              },
              "suggested_environment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "default": null,
                "description": "Its containers, as the file on this machine says (else as iii cloud lists them); null when neither knows.",
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "choosable",
              "path"
            ],
            "type": "object"
          },
          "LocalOutcome": {
            "enum": [
              "set",
              "skipped"
            ],
            "type": "string"
          },
          "Method": {
            "enum": [
              "browser",
              "api_key"
            ],
            "type": "string"
          },
          "OtherCloudProject": {
            "description": "A live cloud project of the person's teams that deploys another repository: it can't be used with this folder.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "repository": {
                "type": "string"
              },
              "team": {
                "$ref": "#/definitions/TeamName"
              }
            },
            "required": [
              "id",
              "name",
              "repository",
              "team"
            ],
            "type": "object"
          },
          "Outcome": {
            "enum": [
              "running",
              "ready",
              "failed",
              "no_route",
              "canceled",
              "replaced"
            ],
            "type": "string"
          },
          "OverrideChoice": {
            "description": "Which value of a console override the person keeps.",
            "oneOf": [
              {
                "description": "The file's value wins at deploy (what the deploy does already).",
                "enum": [
                  "file"
                ],
                "type": "string"
              },
              {
                "description": "The console's value is kept, which takes a change to the file.",
                "enum": [
                  "console"
                ],
                "type": "string"
              }
            ]
          },
          "OverrideConfirmation": {
            "properties": {
              "console": true,
              "file": true,
              "setting": {
                "type": "string"
              }
            },
            "required": [
              "console",
              "file",
              "setting"
            ],
            "type": "object"
          },
          "Owner": {
            "oneOf": [
              {
                "enum": [
                  "agent",
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Info only: nothing to do.",
                "enum": [
                  "none"
                ],
                "type": "string"
              }
            ]
          },
          "PlanPart": {
            "properties": {
              "at_least": {
                "description": "The plan stops at its first blocking step: more may follow.",
                "type": "boolean"
              },
              "blocking": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "confirmations": {
                "$ref": "#/definitions/Confirmations"
              },
              "digest": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fingerprint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/PlanStatus"
              },
              "summary": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PlanSummary"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "What the plan runs: its workers and machine groups. Null without a plan."
              },
              "warnings": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "web_candidates": true
            },
            "required": [
              "at_least",
              "blocking",
              "confirmations",
              "status",
              "warnings"
            ],
            "type": "object"
          },
          "PlanStatus": {
            "enum": [
              "clean",
              "blocked",
              "not_pushed",
              "commit_not_planned",
              "unavailable"
            ],
            "type": "string"
          },
          "PlanSummary": {
            "properties": {
              "groups": {
                "description": "The groups' names, in the plan's order.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "workers": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "groups",
              "workers"
            ],
            "type": "object"
          },
          "PrChecks": {
            "enum": [
              "none",
              "pending",
              "passing",
              "failing"
            ],
            "type": "string"
          },
          "PrState": {
            "enum": [
              "OPEN",
              "MERGED",
              "CLOSED"
            ],
            "type": "string"
          },
          "Problem": {
            "properties": {
              "cloud_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "excerpt": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Excerpt"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "file": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "description": "sha1(source, code, file, line), stable across checks.",
                "type": "string"
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "owner": {
                "$ref": "#/definitions/Owner"
              },
              "severity": {
                "$ref": "#/definitions/Severity"
              },
              "skipped": {
                "description": "The person skipped its name for now (`values::skip`). `EMPTY_DEFAULT_VARIABLE` then has severity `info`; `SECRET_MISSING` stays `block`.",
                "type": "boolean"
              },
              "source": {
                "$ref": "#/definitions/Source"
              },
              "title": {
                "type": "string"
              },
              "variable": {
                "description": "The variable a value problem is about (`SECRET_MISSING`, `EMPTY_DEFAULT_VARIABLE`, `LOCAL_VARIABLE_UNSET`), as the problem itself knows it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "id",
              "owner",
              "severity",
              "source",
              "title"
            ],
            "type": "object"
          },
          "Project": {
            "properties": {
              "checkout": {
                "$ref": "#/definitions/Checkout"
              },
              "cloud_project": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/CloudProject"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cloud_projects": {
                "default": [],
                "description": "Every cloud project that uses this repository, across the person's teams, with its environments. The chosen one is `cloud_project`; `project::use {cloud_project_id}` picks another.",
                "items": {
                  "$ref": "#/definitions/CloudProjectInfo"
                },
                "type": "array"
              },
              "default_branch": {
                "default": null,
                "description": "The repository's default branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "environment": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/EnvironmentInfo"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "environments": {
                "items": {
                  "$ref": "#/definitions/EnvironmentBrief"
                },
                "type": "array"
              },
              "fell_back_from": {
                "description": "Only in `project::use`'s answer: the `environment_id` asked for, which the cloud project no longer lists, so its default environment was taken.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "github_access": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "importable": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Importable"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "other_cloud_projects": {
                "default": [],
                "description": "Live projects of the person's teams that deploy another repository.",
                "items": {
                  "$ref": "#/definitions/OtherCloudProject"
                },
                "type": "array"
              },
              "path": {
                "type": "string"
              },
              "repository": {
                "description": "`owner/name`.",
                "type": "string"
              },
              "team": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/TeamRef"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "teams": {
                "items": {
                  "$ref": "#/definitions/TeamRef"
                },
                "type": "array"
              },
              "workspace": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Workspace"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "checkout",
              "environments",
              "path",
              "repository",
              "teams"
            ],
            "type": "object"
          },
          "PullRequest": {
            "properties": {
              "base": {
                "type": "string"
              },
              "body": {
                "type": "string"
              },
              "checks": {
                "$ref": "#/definitions/PrChecks"
              },
              "head": {
                "type": "string"
              },
              "head_sha": {
                "type": "string"
              },
              "main_moved": {
                "type": "boolean"
              },
              "mergeable": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "number": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "state": {
                "$ref": "#/definitions/PrState"
              },
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "base",
              "body",
              "checks",
              "head",
              "head_sha",
              "main_moved",
              "number",
              "state",
              "title",
              "url"
            ],
            "type": "object"
          },
          "QuestionSource": {
            "oneOf": [
              {
                "description": "An ask the agent made in its session.",
                "enum": [
                  "agent"
                ],
                "type": "string"
              },
              {
                "description": "The worker's own words about what the check leaves open.",
                "enum": [
                  "check"
                ],
                "type": "string"
              }
            ]
          },
          "RecentProject": {
            "description": "A project the person used before, to switch back with `project::use {path, cloud_project_id, environment_id, mode}` (no `resolve` needed first).",
            "properties": {
              "cloud_project_id": {
                "type": "string"
              },
              "cloud_project_name": {
                "type": "string"
              },
              "environment_id": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "environment_name": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "description": "The repository's root on this machine.",
                "type": "string"
              },
              "repository": {
                "description": "`owner/name`.",
                "type": "string"
              },
              "team_id": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "team_name": {
                "default": null,
                "type": [
                  "string",
                  "null"
                ]
              },
              "used_at": {
                "type": "string"
              }
            },
            "required": [
              "cloud_project_id",
              "cloud_project_name",
              "mode",
              "path",
              "repository",
              "used_at"
            ],
            "type": "object"
          },
          "ReleaseRow": {
            "properties": {
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/ReleaseRowStatus"
              }
            },
            "required": [
              "status"
            ],
            "type": "object"
          },
          "ReleaseRowStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          },
          "ResourceConfirmation": {
            "properties": {
              "alias": {
                "type": "string"
              },
              "binding": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string"
              },
              "tier": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "alias",
              "kind"
            ],
            "type": "object"
          },
          "RouteCount": {
            "properties": {
              "count": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "count"
            ],
            "type": "object"
          },
          "Run": {
            "properties": {
              "check_id": {
                "type": "string"
              },
              "commit": {
                "type": "string"
              },
              "engine": {
                "type": "string"
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "healthcheck": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/HealthResult"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "id": {
                "type": "string"
              },
              "left_redacted": {
                "default": false,
                "description": "The copies under this run's `left/` were written with the run's secret values replaced. Absent (an older run): `check::read` refuses its kept files.",
                "type": "boolean"
              },
              "log_path": {
                "default": null,
                "description": "The run's whole redacted log, an absolute path (`log_tail` is only its last 40 lines).",
                "type": [
                  "string",
                  "null"
                ]
              },
              "log_tail": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "moved": {
                "default": [],
                "description": "The untracked files the run created, moved out of the copy into the run's `left/` folder when it ended (at most 500).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "not_covered": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "restored": {
                "default": [],
                "description": "The tracked files the run rewrote and the worker put back as committed when it ended (at most 500; their rewritten versions are kept in the run's `left/` folder).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "reused": {
                "default": false,
                "description": "A passed run of an earlier check answered this one: nothing ran again.",
                "type": "boolean"
              },
              "routes": {
                "$ref": "#/definitions/RouteCount"
              },
              "stages": {
                "items": {
                  "$ref": "#/definitions/Stage"
                },
                "type": "array"
              },
              "started_at": {
                "type": "string"
              },
              "status": {
                "$ref": "#/definitions/RunStatus"
              },
              "waiting_on": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WaitingOn"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "The workers stage has gone a minute with no new worker: who it waits for. The run is still `running`; null otherwise."
              },
              "workers": {
                "$ref": "#/definitions/WorkerCount"
              }
            },
            "required": [
              "check_id",
              "commit",
              "engine",
              "id",
              "log_tail",
              "not_covered",
              "routes",
              "stages",
              "started_at",
              "status",
              "workers"
            ],
            "type": "object"
          },
          "RunError": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "owner": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/RunOwner"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "Whose the failure is (`run_code_owner`): the agent fixes it, the person must, or the run was cut short. Set whenever the check is stored."
              },
              "stage": {
                "$ref": "#/definitions/StageName"
              },
              "withheld": {
                "default": false,
                "description": "The worker would not send this failure to the agent now: the person has a blocking problem open (a missing value fails the run too), so it is theirs first.",
                "type": "boolean"
              }
            },
            "required": [
              "code",
              "message",
              "stage"
            ],
            "type": "object"
          },
          "RunOwner": {
            "description": "Who a failed local run's code belongs to.",
            "oneOf": [
              {
                "description": "A newer run of the workspace replaced this one, or the person stopped it: nothing to fix and nothing to send (a newer run is judged in its turn).",
                "enum": [
                  "replaced"
                ],
                "type": "string"
              },
              {
                "description": "The agent fixes it in the worktree.",
                "enum": [
                  "agent"
                ],
                "type": "string"
              },
              {
                "description": "The person's: Docker, a tool, the iii binary, or a decision about the routes.",
                "enum": [
                  "person"
                ],
                "type": "string"
              },
              {
                "description": "Nobody's fault: the run was cut short; run it again.",
                "enum": [
                  "interrupted"
                ],
                "type": "string"
              }
            ]
          },
          "RunStatus": {
            "enum": [
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          },
          "RunningDeploy": {
            "description": "A deploy still moving, with where it was made from. A field is null when the worker never knew it.",
            "properties": {
              "cloud_project_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "deploy": {
                "$ref": "#/definitions/Deploy"
              },
              "environment_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "description": "The local folder it was made from: `project::use {path}` goes back to it.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "project_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "repository": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "deploy"
            ],
            "type": "object"
          },
          "SecretMode": {
            "enum": [
              "ask",
              "not_needed"
            ],
            "type": "string"
          },
          "SecretRequest": {
            "properties": {
              "asked_at": {
                "type": "string"
              },
              "cloud": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/CloudOutcome"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "type": "string"
              },
              "environment_id": {
                "type": "string"
              },
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "external": {
                "default": false,
                "description": "Asked for a database URL the person chose to keep outside iii cloud.",
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "local": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/LocalOutcome"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "mode": {
                "$ref": "#/definitions/SecretMode"
              },
              "name": {
                "type": "string"
              },
              "resolved_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "$ref": "#/definitions/SecretState"
              },
              "target": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Selected"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Where the value goes: the team, worktree and environment the request was asked for, whatever the page has selected when the value is saved."
              }
            },
            "required": [
              "asked_at",
              "description",
              "environment_id",
              "id",
              "mode",
              "name",
              "state"
            ],
            "type": "object"
          },
          "SecretState": {
            "enum": [
              "waiting",
              "set",
              "left_empty",
              "noted",
              "failed"
            ],
            "type": "string"
          },
          "Selected": {
            "properties": {
              "env": {
                "$ref": "#/definitions/EnvironmentInfo"
              },
              "team_id": {
                "type": "string"
              },
              "workspace": {
                "type": "string"
              }
            },
            "required": [
              "env",
              "team_id",
              "workspace"
            ],
            "type": "object"
          },
          "Severity": {
            "enum": [
              "block",
              "warn",
              "info"
            ],
            "type": "string"
          },
          "Source": {
            "enum": [
              "cloud_plan",
              "check_here"
            ],
            "type": "string"
          },
          "Stage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "$ref": "#/definitions/StageName"
              },
              "status": {
                "$ref": "#/definitions/StageStatus"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "StageName": {
            "enum": [
              "install",
              "build",
              "release",
              "compose_up",
              "workers",
              "routes",
              "healthcheck"
            ],
            "type": "string"
          },
          "StageStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed",
              "skipped"
            ],
            "type": "string"
          },
          "TeamName": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "type": "object"
          },
          "TeamRef": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "TeamRole": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "role",
              "slug"
            ],
            "type": "object"
          },
          "User": {
            "properties": {
              "email": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "email",
              "id"
            ],
            "type": "object"
          },
          "VariableRow": {
            "properties": {
              "name": {
                "type": "string"
              },
              "required_by": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "status": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "required_by",
              "status",
              "type"
            ],
            "type": "object"
          },
          "WaitingOn": {
            "properties": {
              "containers": {
                "description": "The containers that have not connected.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "since": {
                "description": "When the wait was noticed (RFC 3339).",
                "type": "string"
              }
            },
            "required": [
              "containers",
              "since"
            ],
            "type": "object"
          },
          "WorkerCount": {
            "properties": {
              "ready": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "total": {
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "ready",
              "total"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "WorkerInfo": {
            "properties": {
              "cloud_engine": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "iii_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "version"
            ],
            "type": "object"
          },
          "Workspace": {
            "properties": {
              "branch": {
                "type": "string"
              },
              "from_head": {
                "default": null,
                "description": "The last commit the worktree took from the person's checkout (`from: checkout`): commits after it are the agent's. Null for a worktree made from the environment's branch.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "mode": {
                "$ref": "#/definitions/WorkspaceMode"
              },
              "path": {
                "type": "string"
              },
              "source": {
                "default": null,
                "description": "The branch `use {from: checkout, source}` took; null: the checkout's HEAD.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_sha": {
                "default": null,
                "description": "The commit `source` (else the checkout's HEAD) pointed at when the worktree was prepared: \"moved since\" compares the source's tip with it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "branch",
              "mode",
              "path"
            ],
            "type": "object"
          },
          "WorkspaceMode": {
            "enum": [
              "worktree",
              "checkout"
            ],
            "type": "string"
          }
        },
        "properties": {
          "agent": {
            "anyOf": [
              {
                "$ref": "#/definitions/AgentState"
              },
              {
                "type": "null"
              }
            ],
            "description": "The agent's work on the selected environment's open hand-off."
          },
          "auto_fix": {
            "description": "The worker's `auto_fix` setting: a person's check hands the agent its problems.",
            "type": "boolean"
          },
          "candidate": {
            "anyOf": [
              {
                "$ref": "#/definitions/Project"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "A folder `project::resolve` read while another project is selected: Setup's add-project steps show it. `project::use` selects it and clears this."
          },
          "check": {
            "anyOf": [
              {
                "$ref": "#/definitions/Check"
              },
              {
                "type": "null"
              }
            ],
            "description": "The selected environment's latest check."
          },
          "checks": {
            "default": [],
            "description": "Every kept check in short, of every environment, newest first (the latest 20, and the ones a merge, hand-off, pull request or deploy points at).",
            "items": {
              "$ref": "#/definitions/CheckSummary"
            },
            "type": "array"
          },
          "compose_files": {
            "default": [],
            "description": "The worktree's tracked compose files that declare `containers:`, for the page's app file picker. `choosable` is false for a file iii cloud can't plan by its name (`issue`: `NOT_WORKER_COMPOSE`).",
            "items": {
              "$ref": "#/definitions/ImportableManifest"
            },
            "type": "array"
          },
          "connection": {
            "$ref": "#/definitions/Connection"
          },
          "deploys": {
            "description": "Newest first, at most 20.",
            "items": {
              "$ref": "#/definitions/Deploy"
            },
            "type": "array"
          },
          "handoff_brief": {
            "anyOf": [
              {
                "$ref": "#/definitions/HandoffBrief"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the agent needs for the open hand-off, in one place."
          },
          "override_choices": {
            "additionalProperties": {
              "$ref": "#/definitions/OverrideChoice"
            },
            "default": {},
            "description": "The person's choice per console override of the selected environment (`override::choose`), by setting: only choices made for the newest check's console and file values.",
            "type": "object"
          },
          "pr": {
            "anyOf": [
              {
                "$ref": "#/definitions/PullRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "pr_error": {
            "anyOf": [
              {
                "$ref": "#/definitions/WorkerError"
              },
              {
                "type": "null"
              }
            ]
          },
          "problems": {
            "default": [],
            "description": "What is wrong with the selection itself: `PROJECT_DELETED`, `ENVIRONMENT_DELETED`.",
            "items": {
              "$ref": "#/definitions/WorkerError"
            },
            "type": "array"
          },
          "project": {
            "anyOf": [
              {
                "$ref": "#/definitions/Project"
              },
              {
                "type": "null"
              }
            ]
          },
          "recent_projects": {
            "default": [],
            "description": "Projects used before, newest first: not the current one, nor a folder that is gone.",
            "items": {
              "$ref": "#/definitions/RecentProject"
            },
            "type": "array"
          },
          "refreshed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "running_deploys": {
            "default": [],
            "description": "Every deploy still moving, of every project and environment, newest first (`deploys` has the selected environment's only).",
            "items": {
              "$ref": "#/definitions/RunningDeploy"
            },
            "type": "array"
          },
          "secrets": {
            "description": "Open first, then the latest 20 resolved.",
            "items": {
              "$ref": "#/definitions/SecretRequest"
            },
            "type": "array"
          },
          "skipped_problems": {
            "default": [],
            "description": "The warning codes the person skipped for now (`problem::skip`) in the selected environment, sorted.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "skipped_values": {
            "default": [],
            "description": "The names the person skipped for now (`values::skip`) in the selected environment, sorted.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "variables": {
            "items": {
              "$ref": "#/definitions/VariableRow"
            },
            "type": "array"
          },
          "work_file": {
            "default": null,
            "description": "The compose file the selected environment's work is on when it is not the environment's own (`State::work_file`): the newest check's, unless the environment's file changed since. Null: the environment's file.",
            "type": [
              "string",
              "null"
            ]
          },
          "worker": {
            "$ref": "#/definitions/WorkerInfo"
          }
        },
        "required": [
          "auto_fix",
          "connection",
          "deploys",
          "secrets",
          "variables",
          "worker"
        ],
        "title": "Status",
        "type": "object"
      }
    },
    {
      "description": "The page's own: open a deployment's events (kind deployment, with deployment_id: stages, log lines, statuses) or the environment's machines stream (kind machines: a snapshot on every change, scaling steps). Returns {follow_id}; every event reaches iii-cloud::on-stream with that follow_id. Ends by itself with the deployment's terminal status, when the stream ends and after 30 minutes. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::stream::follow",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "StreamKind": {
            "oneOf": [
              {
                "description": "A deployment's stages, log lines and statuses.",
                "enum": [
                  "deployment"
                ],
                "type": "string"
              },
              {
                "description": "The environment's machines: a snapshot on every change, and scaling steps.",
                "enum": [
                  "machines"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::stream::follow` input.",
        "properties": {
          "deployment_id": {
            "default": null,
            "description": "Required for `deployment`.",
            "type": [
              "string",
              "null"
            ]
          },
          "environment_id": {
            "type": "string"
          },
          "follow_id": {
            "default": null,
            "description": "As in `iii-cloud::logs::follow`.",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/definitions/StreamKind"
          }
        },
        "required": [
          "environment_id",
          "kind"
        ],
        "title": "StreamFollowRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::logs::follow` and `iii-cloud::stream::follow` output.",
        "properties": {
          "follow_id": {
            "type": "string"
          }
        },
        "required": [
          "follow_id"
        ],
        "title": "FollowStarted",
        "type": "object"
      }
    },
    {
      "description": "The page's own: close a follow of stream::follow. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::stream::unfollow",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::logs::unfollow` and `iii-cloud::stream::unfollow` input.",
        "properties": {
          "follow_id": {
            "type": "string"
          }
        },
        "required": [
          "follow_id"
        ],
        "title": "UnfollowRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`iii-cloud::logs::unfollow` and `iii-cloud::stream::unfollow` output.",
        "properties": {
          "closed": {
            "description": "False when no such follow was open (it had ended).",
            "type": "boolean"
          }
        },
        "required": [
          "closed"
        ],
        "title": "Unfollowed",
        "type": "object"
      }
    },
    {
      "description": "Serve the iii-cloud worker's injected console UI assets (the target of its ade::ui::asset observers; the console calls it through each asset's observer with {path}).",
      "metadata": {
        "internal": true
      },
      "name": "iii-cloud::ui-content",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Input of the content function: the console asks for one asset by path.",
        "properties": {
          "path": {
            "description": "The asset path from the observer's args (e.g. `state/page.js`).",
            "type": "string"
          }
        },
        "required": [
          "path"
        ],
        "title": "UiContentInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Output of the content function.",
        "properties": {
          "content": {
            "description": "The asset source, verbatim.",
            "type": "string"
          },
          "content_type": {
            "description": "MIME type the console should serve the asset with.",
            "type": "string"
          }
        },
        "required": [
          "content",
          "content_type"
        ],
        "title": "UiContentResult",
        "type": "object"
      }
    },
    {
      "description": "The names the compose file reads (`${NAME}`, `${NAME:-}`, `${NAME:-default}` in containers) for the selected environment: whether each is set in iii cloud, secret or variable, and where its value can come from (a .env file of the person's folder, the environment's address, a copy from another environment). Names, file names and flags only: never a secret's value. manifest: another worker-compose*.yaml; from: checkout reads the person's folder.",
      "metadata": {},
      "name": "iii-cloud::values",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "ValuesFrom": {
            "description": "Where `iii-cloud::values` reads the compose file.",
            "oneOf": [
              {
                "description": "The selected workspace (the worktree, or the checkout in \"edits this folder\").",
                "enum": [
                  "workspace"
                ],
                "type": "string"
              },
              {
                "description": "The person's checkout.",
                "enum": [
                  "checkout"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::values` input.",
        "properties": {
          "from": {
            "anyOf": [
              {
                "$ref": "#/definitions/ValuesFrom"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Default `workspace`."
          },
          "manifest": {
            "default": null,
            "description": "A `worker-compose*.yaml` from the repository root. Default: the newest check's file when it is of this environment, else the environment's.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "ValuesRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "CloudRead": {
            "oneOf": [
              {
                "enum": [
                  "read"
                ],
                "type": "string"
              },
              {
                "description": "iii cloud's variables could not be read: every `in_cloud` is `unknown`.",
                "enum": [
                  "unreadable"
                ],
                "type": "string"
              }
            ]
          },
          "Here": {
            "description": "Whether the run here has a value for a name.",
            "oneOf": [
              {
                "description": "In the run's `.env`.",
                "enum": [
                  "set"
                ],
                "type": "string"
              },
              {
                "description": "Taken from an env file of the person's folder, into the run's environment only.",
                "enum": [
                  "from_file"
                ],
                "type": "string"
              },
              {
                "description": "Nowhere here: `LOCAL_VARIABLE_UNSET`.",
                "enum": [
                  "unset"
                ],
                "type": "string"
              },
              {
                "description": "It has a default (or the compose file doesn't read it).",
                "enum": [
                  "not_needed"
                ],
                "type": "string"
              }
            ]
          },
          "InCloud": {
            "enum": [
              "set",
              "unset",
              "unknown"
            ],
            "type": "string"
          },
          "Need": {
            "oneOf": [
              {
                "description": "`${X}`",
                "enum": [
                  "required"
                ],
                "type": "string"
              },
              {
                "description": "`${X:-}`",
                "enum": [
                  "optional"
                ],
                "type": "string"
              },
              {
                "description": "`${X:-v}`",
                "enum": [
                  "has_default"
                ],
                "type": "string"
              }
            ]
          },
          "SaveAllowed": {
            "oneOf": [
              {
                "enum": [
                  "ok"
                ],
                "type": "string"
              },
              {
                "description": "An API key can't write values.",
                "enum": [
                  "api_key"
                ],
                "type": "string"
              },
              {
                "description": "Production's values take Owner or Admin.",
                "enum": [
                  "role"
                ],
                "type": "string"
              }
            ]
          },
          "Suggestion": {
            "description": "Where a value can come from. Never the value itself.",
            "oneOf": [
              {
                "description": "A `.env*` file of the person's folder has the name.",
                "properties": {
                  "file": {
                    "description": "From the repository root, such as `api/.env.test`.",
                    "type": "string"
                  },
                  "local": {
                    "description": "The value points at this machine (`localhost`, `127.0.0.1`, ...).",
                    "type": "boolean"
                  },
                  "preselect": {
                    "type": "boolean"
                  },
                  "source": {
                    "enum": [
                      "env_file"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "file",
                  "local",
                  "preselect",
                  "source"
                ],
                "type": "object"
              },
              {
                "description": "The environment's own address.",
                "properties": {
                  "preselect": {
                    "type": "boolean"
                  },
                  "source": {
                    "enum": [
                      "env_url"
                    ],
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "preselect",
                  "source",
                  "url"
                ],
                "type": "object"
              },
              {
                "description": "Another environment of the project has it set (copied by iii cloud).",
                "properties": {
                  "environment": {
                    "type": "string"
                  },
                  "environment_id": {
                    "type": "string"
                  },
                  "preselect": {
                    "type": "boolean"
                  },
                  "source": {
                    "enum": [
                      "copy"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "environment",
                  "environment_id",
                  "preselect",
                  "source"
                ],
                "type": "object"
              }
            ]
          },
          "ValueAsked": {
            "description": "An open `iii-cloud::secret` ask for the name.",
            "properties": {
              "description": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "description",
              "request_id"
            ],
            "type": "object"
          },
          "ValueItem": {
            "description": "One name the compose file reads (or an agent asked for).",
            "properties": {
              "asked": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ValueAsked"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "containers": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "database": {
                "description": "Shaped like a database URL: iii cloud makes the database.",
                "type": "boolean"
              },
              "default": {
                "description": "The file's literal default; `\"\"` for `${X:-}`; null for `${X}`.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "here": {
                "allOf": [
                  {
                    "$ref": "#/definitions/Here"
                  }
                ],
                "description": "Whether the run here has a value for it."
              },
              "here_file": {
                "description": "With `here: from_file`: the person's env file it comes from, such as `api/.env.test`.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "in_cloud": {
                "$ref": "#/definitions/InCloud"
              },
              "invalid_name": {
                "description": "Why iii cloud can't store this name (lower case, say): nothing is preselected and `values::save` refuses the row.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "line": {
                "format": "uint32",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "need": {
                "$ref": "#/definitions/Need"
              },
              "skipped": {
                "description": "The person skipped it for now (`values::skip`).",
                "type": "boolean"
              },
              "suggestions": {
                "description": "In preselect order: the page takes the first with `preselect: true`.",
                "items": {
                  "$ref": "#/definitions/Suggestion"
                },
                "type": "array"
              },
              "type": {
                "allOf": [
                  {
                    "$ref": "#/definitions/ValueKind"
                  }
                ],
                "description": "Secret unless iii cloud stores it as a variable or it is the environment's address."
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "value": {
                "description": "Only a set variable's value in iii cloud; never a secret's.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "containers",
              "database",
              "here",
              "in_cloud",
              "name",
              "need",
              "skipped",
              "suggestions",
              "type"
            ],
            "type": "object"
          },
          "ValueKind": {
            "enum": [
              "secret",
              "variable"
            ],
            "type": "string"
          },
          "ValuesFrom": {
            "description": "Where `iii-cloud::values` reads the compose file.",
            "oneOf": [
              {
                "description": "The selected workspace (the worktree, or the checkout in \"edits this folder\").",
                "enum": [
                  "workspace"
                ],
                "type": "string"
              },
              {
                "description": "The person's checkout.",
                "enum": [
                  "checkout"
                ],
                "type": "string"
              }
            ]
          }
        },
        "description": "`iii-cloud::values` answer: names, sources and flags, never a secret's value.",
        "properties": {
          "cloud": {
            "$ref": "#/definitions/CloudRead"
          },
          "environment": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/definitions/ValueItem"
            },
            "type": "array"
          },
          "manifest": {
            "type": "string"
          },
          "read_from": {
            "$ref": "#/definitions/ValuesFrom"
          },
          "save": {
            "$ref": "#/definitions/SaveAllowed"
          }
        },
        "required": [
          "cloud",
          "environment",
          "environment_id",
          "items",
          "manifest",
          "read_from",
          "save"
        ],
        "title": "Values",
        "type": "object"
      }
    },
    {
      "description": "The page's own: write the values the person chose to iii cloud, one by one, and the run's .env where the compose file reads `${NAME}`. Agents never call it.",
      "metadata": {
        "trace_hidden": true
      },
      "name": "iii-cloud::values::save",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "definitions": {
          "SaveItem": {
            "description": "One value `iii-cloud::values::save` writes. No `Debug`: it can hold a value.",
            "oneOf": [
              {
                "properties": {
                  "from": {
                    "enum": [
                      "typed"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "$ref": "#/definitions/ValueKind"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "from",
                  "name",
                  "type",
                  "value"
                ],
                "type": "object"
              },
              {
                "description": "Read again from the file at save time.",
                "properties": {
                  "file": {
                    "type": "string"
                  },
                  "from": {
                    "enum": [
                      "env_file"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "$ref": "#/definitions/ValueKind"
                  }
                },
                "required": [
                  "file",
                  "from",
                  "name",
                  "type"
                ],
                "type": "object"
              },
              {
                "description": "The environment's address, as a variable.",
                "properties": {
                  "from": {
                    "enum": [
                      "env_url"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "from",
                  "name"
                ],
                "type": "object"
              },
              {
                "description": "The variable `\"\"`.",
                "properties": {
                  "from": {
                    "enum": [
                      "leave_empty"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "from",
                  "name"
                ],
                "type": "object"
              },
              {
                "description": "Copied by iii cloud from another environment of the project; never overwrites.",
                "properties": {
                  "environment_id": {
                    "type": "string"
                  },
                  "from": {
                    "enum": [
                      "copy"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "environment_id",
                  "from",
                  "name"
                ],
                "type": "object"
              }
            ]
          },
          "ValueKind": {
            "enum": [
              "secret",
              "variable"
            ],
            "type": "string"
          }
        },
        "description": "`iii-cloud::values::save` input: the page's own. No `Debug`.",
        "properties": {
          "environment_id": {
            "description": "The selected environment, as a guard (`ENVIRONMENT_CHANGED`).",
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/definitions/SaveItem"
            },
            "type": "array"
          },
          "manifest": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "environment_id",
          "items"
        ],
        "title": "ValuesSave",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "SaveResult": {
            "properties": {
              "error": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/WorkerError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "name",
              "ok"
            ],
            "type": "object"
          },
          "WorkerError": {
            "description": "`{code, message, status?, fix?}` inside records.",
            "properties": {
              "code": {
                "type": "string"
              },
              "fix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "description": "`iii-cloud::values::save` answer, per item in order.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/definitions/SaveResult"
            },
            "type": "array"
          }
        },
        "required": [
          "environment_id",
          "results"
        ],
        "title": "ValuesSaved",
        "type": "object"
      }
    },
    {
      "description": "The page's own: skip names for now in the selected environment (`skip: false` undoes it). A skipped name gets an empty value in the run here and no LOCAL_VARIABLE_UNSET; EMPTY_DEFAULT_VARIABLE turns to info; SECRET_MISSING stays a block. Agents never call it.",
      "metadata": {},
      "name": "iii-cloud::values::skip",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::values::skip` input: the page's own. Names only.",
        "properties": {
          "environment_id": {
            "description": "The selected environment, as a guard (`ENVIRONMENT_CHANGED`).",
            "type": "string"
          },
          "names": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "skip": {
            "description": "`false` undoes the skip.",
            "type": "boolean"
          }
        },
        "required": [
          "environment_id",
          "names",
          "skip"
        ],
        "title": "ValuesSkip",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "The environment's skipped names after `iii-cloud::values::skip`, sorted.",
        "properties": {
          "environment_id": {
            "type": "string"
          },
          "names": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "environment_id",
          "names"
        ],
        "title": "ValuesSkipped",
        "type": "object"
      }
    },
    {
      "description": "Follow a deploy to Ready and bring back the evidence when it fails.",
      "metadata": {},
      "name": "iii-cloud::watch",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "description": "`iii-cloud::watch` input.",
        "properties": {
          "deployment_id": {
            "default": null,
            "description": "Default: the newest deployment of the selected environment.",
            "type": [
              "string",
              "null"
            ]
          },
          "handoff_id": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "WatchRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "DeployCommit": {
            "properties": {
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "sha"
            ],
            "type": "object"
          },
          "DeployError": {
            "properties": {
              "action": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              },
              "stage": {
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "stage"
            ],
            "type": "object"
          },
          "DeployFailure": {
            "description": "A failed deploy in plain words (spec: readable failures).",
            "properties": {
              "code": {
                "type": "string"
              },
              "diagnosis": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/Diagnosis"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null,
                "description": "iii cloud's diagnosis of the failure, when it has a likely cause."
              },
              "hint": {
                "type": "string"
              },
              "log_tail": {
                "description": "The last ~40 lines of the failing stage's log, oldest first, redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "release_command": {
                "default": null,
                "description": "The release command from the manifest, for a release failure.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "silent": {
                "default": false,
                "description": "The log shows an exit status but no error text.",
                "type": "boolean"
              },
              "stage": {
                "type": "string"
              },
              "title": {
                "description": "Plain, per code: \"The release command failed: `pnpm migrate`\".",
                "type": "string"
              },
              "worker": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "code",
              "hint",
              "log_tail",
              "stage",
              "title"
            ],
            "type": "object"
          },
          "DeployStage": {
            "properties": {
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "started_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "status"
            ],
            "type": "object"
          },
          "Diagnosis": {
            "description": "iii cloud's read-only diagnosis of a failed deployment: a lead, not proof.",
            "properties": {
              "cause": {
                "type": "string"
              },
              "evidence": {
                "description": "What it rests on, one line each (a log line, a file and its lines), redacted.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "next_step": {
                "type": "string"
              }
            },
            "required": [
              "cause",
              "evidence",
              "next_step"
            ],
            "type": "object"
          },
          "Outcome": {
            "enum": [
              "running",
              "ready",
              "failed",
              "no_route",
              "canceled",
              "replaced"
            ],
            "type": "string"
          },
          "ReleaseRow": {
            "properties": {
              "duration_ms": {
                "format": "uint64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "status": {
                "$ref": "#/definitions/ReleaseRowStatus"
              }
            },
            "required": [
              "status"
            ],
            "type": "object"
          },
          "ReleaseRowStatus": {
            "enum": [
              "pending",
              "running",
              "passed",
              "failed"
            ],
            "type": "string"
          }
        },
        "properties": {
          "approved_by_worker": {
            "type": "boolean"
          },
          "check_id": {
            "default": null,
            "description": "The check this worker deployed (`deploy {check_id}`); null for a deployment made elsewhere.",
            "type": [
              "string",
              "null"
            ]
          },
          "checked_ready": {
            "type": "boolean"
          },
          "commit": {
            "$ref": "#/definitions/DeployCommit"
          },
          "console_url": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/definitions/DeployError"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/definitions/DeployFailure"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "For a failed deploy: what failed, in plain words, with the failing stage's log."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_console": {
            "default": false,
            "description": "This worker did not create it: made in the console (the cloud's `type` is `manual` for both).",
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "log_tail": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "number": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "outcome": {
            "$ref": "#/definitions/Outcome"
          },
          "pr": {
            "format": "uint64",
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "release_row": {
            "anyOf": [
              {
                "$ref": "#/definitions/ReleaseRow"
              },
              {
                "type": "null"
              }
            ]
          },
          "replaced_by": {
            "default": null,
            "description": "The deployment that replaced this one, when it is `replaced`.",
            "type": [
              "string",
              "null"
            ]
          },
          "stages": {
            "items": {
              "$ref": "#/definitions/DeployStage"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "status_detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "approved_by_worker",
          "checked_ready",
          "commit",
          "console_url",
          "created_at",
          "environment_id",
          "id",
          "log_tail",
          "number",
          "outcome",
          "stages",
          "status",
          "type"
        ],
        "title": "Deploy",
        "type": "object"
      }
    }
  ]
}
```
