# CLI skill

AI agent getting started? Read [Agents: start here](https://docs.openeng.io/agents/start-here.md) first.

The published openeng skill for coding agents.

Source: https://docs.openeng.io/reference/cli-skill/

# Working with the platform through `openeng`

`openeng` is the platform's command line. Install the public npm package:

```
npm install -g @openengio/cli
```

Set `OPENENG_NO_UPDATE_CHECK=1` to disable the daily npm update check and standard-error notice; `CI`, help and `--version` also skip it.

This skill gives the commands and their order. It gives no input shapes, because the commands print
their own. Before you send a generated command (`objects-sdk`, `branches-sdk` and the other
`<module> <method>` commands), run `openeng help <module> <method>`. It prints the fields, the kinds a
field may take, the selector keys and one example input, and needs no sign-in.

## File feedback

File feedback when a route fails in a way its docs do not explain, a refusal is unclear, help or docs are missing or wrong, a request shape is unknown, or a feature is missing. Include the route name, correlation id, an outline of what was sent, what came back, what you expected, and the project when applicable. Never include secrets, tokens or credentials. The title is 1 to 200 characters after trimming and the body 1 to 8,000. A filing is not idempotent, so a retry files a second entry. A filer may file 100 entries in any 24 hours in one organisation; the next is refused `bound-exceeded` naming `feedback-per-filer`. An agent-mode filing waits for the person to confirm it in the browser.

Use `openeng feedback bug --title <text> --body-file -` or `openeng feedback feature`; `openeng admin-sdk listFeedback` lists entries.

`listFeedback` returns one page of up to 20 entries by default (a `limit` from 1 to 50 is available) and a continuation token. Pass the token to the next request and repeat until it is null.

```sh
openeng admin-sdk listFeedback --input '{"continuation":"<token from the previous answer>"}'
```

## Read a route's policy

Generated route help prints `actors` (the caller categories allowed) and `step-up` (whether user confirmation is required) from the route table's current `policy` (access rules).
The policy is `{ none: true }` for no access-token requirement, or an `actors` map whose keys name
admitted classes and whose values state each class's step-up. `person` is the person's authority;
in-app agent names are `agent:explore`, `agent:apply` and `agent:types`. Application actors use
`app:client` or `app:hosted`, and service authority uses `service`. These are actor labels;
a CLI session in agent mode still acts as `person`.

A step-up value is `none`, `person-present` (requires the signed-in user's confirmation), or `{ personPresentWhen: <predicateName> }` (requires confirmation when a condition is met). Help
names the predicate and its condition, including `unlocks` (the condition for removing a lock) when a lock is set to `"none"`.
Read the generated lines for the route you need; this skill keeps no separate admission list.
A person's own live web session is never challenged. An agent-mode CLI call (a session configured to require confirmation for sensitive actions) on an action requiring confirmation
meets the challenge and waits for its person, as described below. In-app agent classes are omitted
from every marked policy in this release; confirmation cannot grant them admission.

## Explain each step

When guiding a person, say what you intend to learn or change, give the command, then report what it
answered and what follows. When the step has a GUI page, include the address from `openeng link` at
that step; do not construct a page address yourself. For example:

1. Intent: identify the project and its namespace. Run `openeng projects list --json`; report the
   project id and namespace it returned.
2. Intent: show the project in the web app. Run `openeng link project --project <id> --ref main`
   and give the returned address with what the page should show.
3. Intent: inspect one object in the chosen branch. Run the relevant read command and report its
   result; when the person needs its page, run `openeng link object <object-id> --project <id>
   --ref <ref>` and give that returned address.

## Read the topic for your task

- A person new to OpenEngineering who wants a tour, or has just signed in with no task of their own: `openeng skill demo`.

- Designing a new use case: `openeng skill new-use-case`.
- Building an object drawer or App view: `openeng skill build-ui`.
- Field meanings, edge direction, trees and type versions: `openeng skill conventions`.
- A domain model: `openeng skill playbook engineering-requirements`,
  `openeng skill playbook product-lifecycle`, or `openeng skill playbook project-management`.

## Attachments

Create the object first, then upload and save its attachment. Creation with a file is refused
as `invalid-properties` with `attachment-requires-object` at each offending property.

The CLI and SDK upload file bytes directly to the file store in 8 MiB pieces, with at most
one following piece prefetched. Interrupted uploads query the committed offset and resume within
the same call, with at most three resumes per piece. The CLI prints upload and download progress
to standard error. The SDK accepts `{ onProgress: (committed, total) => void }` as the third
argument of `uploadAttachment(selector, source, options)`. An open refused as `storage-limit-reached` sends no
file bytes.
The upload uses `openAttachmentUpload` (`POST /attachments/upload/open`) and
`completeAttachmentUpload` (`POST /attachments/upload/complete`). `too-large` means the declared
file exceeds the host bound; `unsupported-content` means the extension or recognised content is
not admitted. `upload-not-found` means completion found no upload for this caller and object project;
start the upload again. These refusals are printed through the ordinary CLI refusal output.

For a top-level object property declared with kind `attachment`, use
`openeng attachment add <object> <property> <file> --project <id> --ref <ref> --reason <text>` to upload a file and
save its descriptor, `openeng attachment list <object> --project <id> --ref <ref>` to read its
attachment properties, and `openeng attachment get <object> <property> [--out <path>]` with the
project and ref flags to download it. The `get` command uses the descriptor's file name when `--out`
is omitted, writes the file as it arrives, and checks it against the descriptor's digest (SHA-256 or MD5), keeping no partial file on a mismatch. The accepted classes and file-size limit are in `openeng skill conventions`.

## Link review and impact

Read `openeng links status <object> --project <id> --ref <ref>` before reviewing a tracked
link. Review states are `cleared` (reviewed against the current upstream), `suspect` (significant
upstream content changed), `unreviewed` (never cleared), `not-visible` (the upstream cannot be
read) and `too-many-links` (the chain exceeds its bound). Bounds have their own states: `in`,
`out`, `none`, `no-value`, `unit-mismatch` and `not-visible`; clearing does not change them.
Aggregates also show coverage and hidden or missing counts. Numeric output shows its unit.

After reviewing the upstream, run `openeng links clear <link> --version <upstreamVersion>
--project <id> --ref <ref> --reason <text>`. Take the opaque version from the status answer. For an atomic batch,
list up to 100 link ids and repeat `--version` once per link in the same order. On
`upstream-changed`, read status and review before sending its new version; do not replace the
precondition blindly. `upstream-not-readable` requires upstream read access. There is no
organisation clearing setting: the edge's write rule decides who may clear. Read the generated route
help for the actor classes admitted to clearing.
The object agent has no clearing tool; clear through this CLI or the SDK. Recover an unknown
outcome by correlation before retrying.

Use `openeng branches impact <ref> --base <base> --project <id>` to review changes against
the merge base: review, bounds and aggregate changes, downstream reach to depth three and
hidden counts. Added and removed links are marked. `head-moved` requires reading again;
`over-bound` refuses the entire read. Add `--json` for each complete answer.

## Hosted apps

A hosted app is a React bundle that runs inside a project, in a sandbox, with the viewer's authority.
Export a component that takes `{ client }` and start it by calling the runtime's
`globalThis.__oe2HostedApp.mount(App)` as the bundle's last statement (the `@openengio/hosted-app`
package that wraps this call is not published yet). Publish the built bundle with
`openeng hosted-app publish <bundle> --project <id> --key <app key>`; it creates the app when the
project has none under that key, and prints the version and its SHA-256. If the app holds the
reduced isolation permission, output carries a warning when its grants can be read: read it to the person and do not hide it. If grants cannot be read, output says the permission is unknown.
`openeng hosted-app list --project <id>` lists the apps, `openeng hosted-app versions <app key>
--project <id>` lists an app's versions, and `openeng hosted-app revoke <app key | app id | version id>
--project <id>` revokes a version (an id starting `hav_`) or the whole app by its key or `app_` id. Revoke only when the
person asks. Hosted apps run only in Google Chrome.

## Rules that hold for every command

- Add `--json` when you read the answer yourself. It prints one JSON value on standard output.
- Exit code 0 is success. Any other exit code is a refusal (a rejected operation with a reason) or a failure, and its message says what
  to do. Read it; do not retry the same command unchanged.
- When you report a refusal to the person, quote its `reference:` line (the `reference` field under
  `--json`) exactly. The line is how the platform's operators find the request. A refusal with no
  such line was built by `openeng` itself, or the host sent no id with it.
- A refusal of a field names the field, such as `input.correlation`, and the kinds it may take.
  Fix that field and send the command again.
- A command that the platform holds to the person's own confirmation prints an address, then waits.
  Tell the person to open that address in their browser and confirm; the command carries on by itself
  once they do, and prints nothing from the confirmation. A timeout reports that the action was refused
  because nobody confirmed in time and exits non-zero, with no write. Other poll refusals retain their
  actual meaning. Read the refusal before deciding whether to ask the person to try again. A refusal
  `step-up-required` (confirmation needed) or `step-up-mismatch` (confirmation did not match this action) that still reaches you
  means that CLI session still needs confirmation for that call. A different CLI session of the
  same person cannot collect or use its proof. In-app agent tokens are refused on every marked action,
  even with a proof, so do not retry the command or look for another way to make the
  change. Tell the person which action was refused and ask them to make it themselves. A refusal
  `step-up-capacity` means the person already has the most confirmations waiting; ask them to
  clear those first.
- CLI sessions start in agent mode. The server stores channel and mode; local `whoami` output is
  identity information, not evidence of human mode. Use `openeng session status` for the server's
  channel, mode and sign-in time. A person working at the terminal can deliberately run
  `openeng session human`, confirm once in their browser, and stop further prompts for the life of
  that CLI session. The command prints the stored mode; repeating it is a no-op. A fresh CLI login
  starts in agent mode. Only request human mode when the person explicitly asks for it. An unknown
  session becomes CLI/agent on confirmation and challenges again
  on its next marked action. A browser's own unknown session must sign in again, without a confirm
  link or automatic replay.
- `openeng help` lists every command. `openeng help <command words>` prints one command's help: what it
  does and an example. `openeng help <group>` lists a group's commands.
  `openeng --version` prints the published version.
- `openeng` defaults to `https://api.openeng.io`; no host setting is needed for production.
  For another deployment, pass `--host <origin>` or prefix the command as
  `OPENENG_HOST=<origin> openeng ...`. An export in `~/.zshrc` does not reach
  an agent's shell or a Claude Code `!` shell. In zsh, persist the override in `~/.zshenv`.
  An explicitly empty host turns the default off and causes `no-host`.
- `openeng orgs list` and `openeng organisations list` mean `openeng org list`; `openeng project list` means
  `openeng projects list`.
- A mutation or a branch command that needs a `correlation` mints it for you when your input has
  none. Leave it out unless you have a reason to send your own.
- Generated commands take `--selector <json>` for what they act on and `--input <json>`,
  `--input -` or `--input-file <path>` for what they send. Read the ids you need from `--json`
  output and never invent one.

## 1. Sign in and orient

1. `openeng help` to see what exists.
2. Run `openeng login` yourself with the host flag. It opens the person's browser and waits up to
   about eleven minutes for sign-in; tell the person to finish sign-in there. Do not ask the person to run it. If your tool cuts a
   command off before it returns, run it in the background or use `openeng login --no-open`
   with the host flag and give the person the printed address.
3. `openeng whoami` to confirm who you are.
4. `openeng org list --json` prints the organisations you belong to. `openeng org attach <id>` attaches
   your session to one. If you have no organisation, create one with
   `openeng org create --name <name>`, then attach to the organisation it created.
5. Until you attach, these commands run without an organisation: `openeng login`, `openeng logout`,
   `openeng whoami`, `openeng help`, `openeng skill`, `openeng org list`, `openeng org attach <id>`,
   `openeng org create --name <name>`, and `openeng org current`. The generated command
   `openeng admin-sdk createOrganisation`, `openeng session status`, and `openeng session human` also run unattached. Commands that need an organisation refuse with "not attached
   to an organisation" before they send anything.
6. `openeng projects list --json`. Note each project's id and its namespace; later steps need both.
7. `openeng types list --project <project id>` to see the project's published types, each with its
   published version.

For a generic open-cycle gas turbine demonstration project, run `openeng demo seed --project <project id> [--size standard|full]`.

### Which organisation you are in

- `openeng org current` prints the organisation your session is attached to, or none.
  `openeng org detach` removes the attachment; commands that need an organisation refuse until you attach again.
- The CLI passes no scope for `openeng login`, `openeng logout`, `openeng whoami`, `openeng help`, `openeng skill`,
  `openeng org list`, `openeng org attach <id>`, `openeng org create --name <name>`, `openeng org current`,
  `openeng org detach`, `openeng admin-sdk createOrganisation`, `openeng session status`, and `openeng session human`. Other commands that need an organisation print their scope on
  standard error when the platform answers them, as
  `org: <name> (<id>)`, then `· project: <id>` and `· ref: <ref>` when named in `--selector`. Read it
  before you trust an answer.
- With `--json`, the one value on standard output carries the same scope as a `scope` object:
  `{"organisation": {"id", "name"}, "project"?, "ref"?}`. An object value normally gains a `scope` key.
  A value that is an array or null, such as the list from `openeng projects list`, comes wrapped as
  `{"scope": {...}, "value": <the original value>}`. Rules command successes always use this wrapper
  to preserve the rule's own `scope` field. Organisation branch or baseline, lock, ceiling and schema-update
  successes also always use `{ scope, value }`. A command with no scope carries no `scope` field.
- A `not-found` in an organisation is often a project or a branch or baseline that belongs to another one. The
  command prints "not found in organisation <name>: check that you are attached to the correct
  organisation (openeng org current)". Run `openeng org current`; if it names the wrong organisation,
  `openeng org list` and `openeng org attach <id>`.

## 2. Define or change object types

Edit a file, not the published types directly. The change is a draft that is checked, reviewed and
then accepted.

If `openeng types list` says `no published types`, use the example type documents in
`openeng skill conventions` to start the type file. Put each type document under its type key, because
`draft.json` is a map keyed by type key and a bare document is refused. Read `openeng help types draft revise` to
understand each part, then design the model with the person before you draft it.

1. If the project has published types, run `openeng types export --project <project id> > draft.json`;
   it writes them as one JSON object keyed by type key, each at the next version, ready to send
   with revise. If it has no published types, create `draft.json` from an example type document in
   `openeng skill conventions`, putting the type document under its type key: the headed examples there
   are bare documents, and one pasted as it stands is refused.
   A new object type needs `presentationBindings.typeIcon`; read the existing types' icons in the
   export and choose a relevant glyph that no other type uses.
2. Make `draft.json` hold only the types you change: delete every other key, and keep each type you
   keep whole, as the export wrote it. Accepting a type you did not change publishes an identical
   new version of it.
3. `openeng types draft open` opens a change set on your organisation's namespace. It prints the change
   set id and a revision. If one is already open, `openeng types draft current` shows it.
4. `openeng types draft revise --change-set <id> --revision <revision> --from draft.json` sends your
   file. It prints the new revision. Use the newest revision in every later step.
5. `openeng types draft validate --change-set <id> --revision <revision>` must report no violations.
   It exits 0 when there are no violations, and exits 4 with the violations on standard output
   otherwise; then edit the file and revise again.
   To try a sample instance against a type in the draft before you accept it, write the sample as a
   JSON object of raw property values and run `openeng types draft try --type <type key> --sample
   sample.json`. It reads the open change set and writes nothing, and checks the sample the way a
   write does: it exits 0 when the sample fits and exits 4 with each violation's path and rule
   otherwise. Add `--change-set <id>` to name the change set instead of using the open one.
6. `openeng types draft show --change-set <id> --project <project id>` shows what changes against the
   published types, per type and per field. Check that it is exactly the change you meant.
7. `openeng types draft accept --change-set <id> --revision <revision>` publishes it. The new version
   is now the published one: from here on, take a type's version for data writes from
   `openeng types list`.

Property kinds are `null`, `boolean`, `string`, `number`, `integer`, `person`, `enum`, `array`,
`object`, `datetime`, `attachment` and `bound`. Under language version `4`, numeric properties may
declare a `unit`, such as `kg`; publication refuses an unknown symbol (`unknown-unit`) or a later
change or removal (`changed-unit`). A `bound` is a top-level object property, or a top-level array
of bounds, under version `4`. See `openeng skill conventions` for its shape. Use `datetime` for an instant. A value is an RFC 3339 date-time
with an explicit offset and zero to three fraction digits, such as `2026-10-19T22:30:00+01:00` or
`2026-10-19T21:30:00Z`; a value with no offset, an impossible date or time, or four or more fraction
digits is refused. The platform stores it as `YYYY-MM-DDTHH:MM:SS.sssZ`, the same instant in UTC.
A calendar date is midnight UTC; there is no date kind. A type declaring `datetime` needs language
version `2` or later. An `attachment` is a top-level object property under version `3`, with a
non-empty `accept` listing classes such as `image` and `pdf`; it is refused inside an object or
array property and in an edge or verb schema. See the named property example in
`openeng skill conventions`. Never lower a published type's language version when revising it.

To abandon a draft, `openeng types draft discard --change-set <id>`.

`presentationBindings.typeIcon` is a Material Symbols Rounded name from the installed
`@material-symbols/font-400` set, such as `memory` or `developer_board`, not an arbitrary label
(for example, `cpu` is invalid). `openeng types icons <text>` lists valid names and needs no sign-in; the full list is at https://docs.openeng.io/reference/icons/.
Publication refuses unknown or empty names. Existing unknown icons show an empty box and
must be corrected before publishing that type again.

An object type's `subscriptionRoles` field declares which roles it admits: owner, approver or watcher.
Owner is limited to one; approver and watcher may have optional maxima. Without the field, only
watchers are admitted; the publication validator decides whether a declaration is valid.

## 3. Write data

Write on the branch agreed with the person and within their authority. That may be `main` when
the applicable protections permit the write; an approved agent plan may also name an unprotected
project's `main`. Use a branch and review when a rule protects the branch or the person asks for it.

1. `openeng help objects-sdk mutate` and `openeng help branches-sdk createBranch` for the fields, the
   selector keys and an example each.
2. When a branch is needed, `openeng branches-sdk createBranch` makes one in the project. It
   answers the branch's full name, written `<project id>/<name>`.
3. `openeng objects-sdk mutate` creates, changes or deletes an object or an edge on that branch. Every save carries a `reason`; see "The save reason" below. The `ref` field in
   a selector takes one of three forms: the organisation trunk is the bare `main`; a project
   branch is its full name, `<project id>/<name>`; an organisation branch or baseline is its bare name.
   `--ref` takes a branch (`main` or `<projectId>/<branch>`) or a baseline for commands that admit organisation names.
   The server derives the organisation from the token. Use the agreed branch for writes and read
   back from that same branch with
   `openeng objects-sdk readObject` and `openeng objects-sdk queryObjects`.
4. Read back what you wrote: `openeng objects-sdk readObject` for one object, or
   `openeng objects-sdk queryObjects` for a list. Use `openeng objects-sdk queryRows` when you need
   selected row cells, a count or grouped values; it answers these in one call instead of paging
   `queryObjects` to count locally. Use the type key and version the project's
   `openeng types list` showed. For an object's edges use `openeng objects-sdk queryGraph`;
   for paths use `openeng objects-sdk findPaths`. Confirm relationships through the CLI;
   do not hand the check to the web app.
5. `openeng objects-sdk executeVerb` runs a verb a type defines. `openeng objects-sdk discoverVerbs` lists
   the verbs available.
6. When using a branch for review, `openeng branches-sdk submitProposal` sends it for review. It
   names the branch by its `name` alone, the part of the full branch name after the slash. The input
   takes an optional `target`: `main`, a writable organisation ref or a project branch; omission
   targets `main`. An apply run submits only its approved plan's ref.
7. A person approves with `openeng branches-sdk approveProposal`, sending `proposalId` and, as
   `headHash`, the `atHash` of the `readBranchDiff` they read. An approval from a CLI session in agent mode is confirmed
   on the web. A moved head requires reading and reviewing again. An agent proposes and never approves.

In `--input` JSON, a branch's optional `from` is `{ "kind": "ref", "ref": "main" }` or
`{ "kind": "hash", "hash": "<current head>" }`. A property's `from` and `to` each carry
`{ "kind": "absent" }` or `{ "kind": "value", "value": <JSON value> }`. A draft lookup carries
`{ "kind": "draft", "appDraftId": "<draft id>" }` or `{ "kind": "app", "appKey": "<app key>" }`.
A mutation, batch, verb or merge answers a commit with `kind` `committed` and its `hash`, or
`kind` `no-change`. Read the generated help before constructing these values.

### The save reason

Send a `reason` with every save: in the `--input` JSON of `mutate`, `mutateBatch`, `executeVerb`,
`promoteDraft`, `clearLinks` and `setObjectLock`, and with `--reason <text>` on
`openeng attachment add`, `openeng links clear` and `openeng locks set`, which refuse a missing
reason before any call. A merge keeps its required `message`. The host writes the reason first in
the save's commit message, exactly as sent, so the history says why the change was made.

The save reason is the commit message for your change. Write it as you would a good commit message.
Start with one line, under 72 characters, that says what changed and why: "Raise brake requirement REQ-12 after design review" says
why; "update object" does not. Then, after a blank line, write as much as the change needs: what you
changed and where, why (the requirement, review, finding or test result behind it), what it affects
downstream (links, calculations, other parts), and anything a reviewer should check. Name the
objects, requirements or results by their identifiers. A batch's reason covers every change in the
batch, because the batch is one commit with one message. An agent writes the same standard of reason
as a person, and never a placeholder such as "update object". Draw on your conversation with the
person: what they decided, and why.

A merge message summarises the branch for the target's history. Merges are true merges, not squashes,
so the branch's own save reasons are kept in history and the merge's own message adds "Operation:
merge". The merge message adds what the save reasons cannot: what the branch achieved as a whole,
why it is ready, and who reviewed it.

The host refuses a reason that is empty after trimming white
space, or that holds a NUL character or a lone UTF-16 surrogate, as `invalid-request` with the field `input.reason`.

### Draft and comment routes

The Objects SDK transport also exposes `acquireDraft`, `saveDraft`, `promoteDraft`, `releaseDraft`,
`discardDraft`, `readDraftLock` and `breakDraftLock`. Read each request with
`openeng help objects-sdk <method>`. Draft methods take the selected project and ref plus an
`objectId`; `saveDraft` also takes the `draftHash` last read, `blocks` keyed by identifiers the
draft already holds, and `added`, a list of new blocks without identifiers; it answers the
identifiers the server minted for them in `minted`.

Each block is `{ kind, text, position }`. Choose a kind from the type's `bodyFormats`.
All blocks in a body must have the same kind. A non-Markdown body holds at most one block.
A save that breaks these rules is refused `body-wrong-format`. Syntax errors do not block saving
or promoting. `readObject` returns `bodyCheck` exactly when the body holds a block of a checked
format (Python, JavaScript, TypeScript, JSON or YAML); it is absent otherwise.

`openeng objects-sdk acquireDraft` starts a draft of the object's body and answers its blocks and
`draftHash`; `openeng objects-sdk promoteDraft` publishes the draft as the body with the
`draftHash` last read. If the body already equals the draft, promotion makes no commit; `body-changed` means it moved since the draft was acquired. Each takes `--selector` and `--input` as JSON, as the other routes here do. A save renews
the five-minute lock. Release only releases an
unchanged draft; discard removes the holder's draft, while breaking a lock leaves its draft text
in place and is a project-administrator action. `readDraftLock` answers
`{ kind: "held", holderDisplayName: string, expiresAt: string }` for a live lock, or
`{ kind: "free" }` when no lock is live, never the draft contents.

A draft write blocked by a rule answers `protected`, with the same optional
`protection: { ref, patterns }` as a property save. Only readable patterns appear. Make the change
on another branch and merge it; a caller without write access receives the ordinary denial.

Object history (`openeng objects-sdk readHistory`) and a branch comparison
(`openeng branches-sdk readBranchDiff`) carry a `bodyChanges` list on each version or changed object:
one entry per body block that differs, `{ blockId, kind, before, after }`, with `kind` one of `added`,
`removed`, `changed` or `moved`. Each entry carries `lines` exactly when either compared side is
not Markdown. Each line has `kind` (`same`, `added` or `removed`) and `text`.
Read it to describe a body change; the property fields do not show one.

`breakDraftLock` and `restoreDraft` require a person token and use `objects.draftAdmin`. No client
scope or run client holds this capability. `restoreDraft` takes `trashId` and `newRefName` and
restores a draft from the trash of a disposed branch onto a new ref.

`setCommentResolved` takes `commentId` and `resolved` and is for resolving or reopening a comment.
`addComment` takes the ordinary comment fields and an optional anchor naming the quoted block and
span. It admits people and hosted apps. Resolving a comment is a person action. The route's refusal is authoritative for required capability
and admitted caller kinds.

If a verb name is unknown, use `openeng objects-sdk discoverVerbs` for the object and choose a
listed verb; do not guess a verb key.

A refusal may name the field it concerns, and `invalid-request` lists the kinds where the request schema allows it. Run
`openeng help <module> <method>` again and compare.

### Read relationships back after a write

Run `openeng help objects-sdk queryGraph` first. Take the project and object identifiers from
the confirmed write and replace the placeholders below. One start address and one hop step
read that object's connections, including the edges in the answer:

```sh
openeng objects-sdk queryGraph --selector '{"projectId":"<project-id>","ref":"<project-id>/<branch>"}' --input '{"kind":"graph","start":{"kind":"objects","objects":[{"projectId":"<project-id>","objectId":"<object-id>"}]},"steps":[{"depth":1}]}' --json
```

Check the returned hops against the relationships you wrote. Use `findPaths` for paths across
several objects; read its help before supplying input.

### Review object and relationship changes

Run `openeng help branches-sdk diffBranches` for a live branch comparison, or
`openeng help branches-sdk readBranchDiff` for a proposal's comparison, at the branch's current head
while the proposal is pending, with `atHash` naming that head.
Read both the object collection (`changes` for a live diff, `objects` for a proposal) and
`edges`. Live diffs return `cursor`; proposal diffs return `continuation`. One page holds at most 200 changes total; follow the returned value until it is null before describing the whole change. An edge's source and target carry object and project identifiers,
plus the edge's own properties before and after. An unreadable endpoint's identifiers do not
grant access to its title, type or properties. Any cursor that is not a current page boundary is refused; start the comparison again without it.

## Project branch rules

`openeng branches-sdk disposeRef` lets a branch writer dispose when no pending proposal exists
and no matching rule restricts deletions, or when no rule matches even with a pending proposal.
Otherwise the caller must be on every matching rule's bypass list. A bypass member may dispose
with or without a proposal, including under restricted deletions. A branch that changed a row of any
project other than its own is refused `write-refused`, whatever the caller's rights there. A person's bypass counts only from a web session or a CLI session in human mode: an
agent-mode CLI session, or a session with no recorded channel, takes no bypass for a merge, a
disposal or a direct edit. Success discards the pending proposal after the engine disposal succeeds.

Merge and disposal admit people, services and client apps. Agent runs and hosted apps are refused
`token-kind-not-admitted`. With no rule matching the merge target, a writer of all affected projects
can merge, including a Contributor. A client of an Owner gets no role bypass from that person's role;
it needs an explicit client bypass entry.

When drafts block disposal it answers `ref-has-drafts` and lists readable drafts in writable
projects, by object and holder. Add `"deleteDrafts":true` to the input to consent: the drafts you may write move to the draft
trash, where a person who saved one can restore it.

### Resolve a merge conflict

When merge answers `merge-conflict`, read the conflicts with
`openeng branches-sdk readMergeConflicts --selector '{"projectId":"<project-id>"}'
--input '{"name":"<source-branch-name>"}'`. The `name` is the source branch's name. For each
field, `base` is its value before either side changed it, `ours` is `main`, and `theirs` is the
source branch's value. A value may be absent on a side. The read always compares the source with
`main`, even if the merge targeted another branch, so it does not report conflicts from a merge
whose target was not `main`. A conflicting object also lists `blocks`: the body blocks both sides changed
differently, each `{ blockId, base, ours, theirs }` with the text of the common version, of `main` and of
the source branch (null where a side has no such block). Reconcile the changes on the source branch, then submit a new merge
with the reviewed head; reading conflicts makes no changes.
`oursLines` compares base to ours; `theirsLines` compares base to theirs. Each field is present
exactly when either side it compares is not Markdown. Merging still works at block level.

A merge is refused `merge-preview-approximate` when the branch's history criss-crosses its target, in either direction. Nothing is merged. Start a new branch from the target, redo the change there, and merge that branch. A branch that an earlier release left criss-crossed cannot be merged.

A rule has extent `ref` for every row on a matching ref or `rows` for its project's rows.
Project `ref` rules are `<project>/` and a glob; `rows` may also name `main`. In a glob `*` stops at
`/`, `**` is any characters, `/` included, `?` is one character other than `/`, and `[]` is a set
with no negation: `^` and `!` are refused. `<project>/**/x` does not match `<project>/x`. A glob is at most 255 characters.
`merge-only` requires merges, `locked-rows-only` binds merge-only row locks, and `open` allows
updates. Several matching rules all apply unless their bypass lists admit the caller.

Rule management is the person's workflow. They need `administer projects` on the owner.
Never add, update or remove rules on their behalf, including to get past a refusal.

1. The person runs `openeng rules add --project <id> --extent rows --pattern main` to protect
   their project's trunk rows. The answer includes the identifier and full settings.
2. `openeng rules list --project <id>` reads visible rules and their settings; it needs `read`.
3. `openeng rules update --project <id> --rule-id <id> [settings]` changes settings atomically.
   Every update requires confirmation in an agent-mode session, stronger and weaker alike.
4. `openeng rules remove --project <id> --rule-id <id>` removes that rule. An absent or other
   owner's identifier answers `not-found`. Each change is audited and affects the next request.

Add and update accept `--consequence <open|merge-only|locked-rows-only>`,
`--require-proposal <true|false>`, `--required-approvals <0..10>`,
`--approver-min-role <contributor|maintainer|owner|null>`, `--restrict-deletions <true|false>`,
`--approvers '<JSON person-id array>'` and `--bypass '<JSON member array>'`.
Bypass members are `{"kind":"role","roleKey":"owner"}`, `{"kind":"person","personId":"<id>"}`,
`{"kind":"service","serviceIdentityId":"<id>"}` or `{"kind":"client","clientId":"<id>"}`.
A supplied array replaces the list; `[]` clears it. Omitted settings on update keep their values.
On add, defaults are merge-only, a required proposal, one approval, minimum Maintainer,
no named approvers and Owner/Maintainer bypass. Deletion restriction defaults to true for project
`ref` rules only; only those rules may enable it. Positive approvals need a proposal and either
a minimum role or a named approver. The server validates named members without revealing identities
outside the home. Refusals are `invalid-rule-pattern`, `invalid-rule-setting` and `unknown-rule-member`.
An add with the same owner, case-insensitive pattern, extent and consequence returns the existing rule without
an audit write if its settings are identical; otherwise it is refused with duplicate-rule. A different
consequence can create a separate rule.
Changing a rule’s consequence to one another rule on that pattern already has is also refused
`duplicate-rule`.

## Organisation rules, branches and baselines, locks and agent ceilings

These protections are managed by the person. Never change rules, branches, baselines or locks yourself,
including to get past a refusal. Read their current state and ask the person to make a change.
Each command's `--help` names the person's capability. A `not-permitted` refusal carries no
capability; read the help line before asking the person to seek permission.

- The person uses the rules commands above with `--organisation` instead of `--project <id>`
  for organisation rules, for example
  `openeng rules add --organisation --extent ref --pattern release-v1 --consequence merge-only`.
  Choose exactly one flag. `--organisation` takes no value and uses the attached organisation.
  `openeng rules list --organisation` reads the rules;
  `openeng rules remove --organisation --rule-id <id>` removes one by its identifier.
  Adding or removing needs `administer projects` in the attached organisation; listing needs read on a project in the organisation.
- `openeng org-refs list` reads organisation branches and baselines with their read-only state. The person creates
  a branch with `openeng org-refs create --name <name>` or a baseline by adding `--read-only`. A branch becomes a baseline with
  `openeng org-refs mark-read-only --name <name>`, or deletes a writable one with
  `openeng org-refs delete --name <name>`. Names are single segments, such as `release-v1`.
  Creating, deleting and marking need `administer projects` in the attached organisation;
  listing needs read on a project in the organisation.
- The person sets or lifts an object's lock with
  `openeng locks set --project <id> --ref <ref> --object <objectId> --lock <none|merge-only|frozen> --reason <text>`.
  `none` lifts it. The lock also applies to its existing structural child edges in the selected
  project. New children on a writable branch are not thereby frozen. Use a baseline
  to preserve a fixed snapshot. This needs `lock objects` on the selected project.
- The person renames a project with `openeng projects rename --project <id> --name <text>`. It needs
  `administer projects` on the project, and the route is refused to agents, so never rename a project yourself.
  Check the project id in `openeng projects list` before asking.
- `openeng ceiling show --project <id>` reads the maximum agent role. The person sets it with
  `openeng ceiling set --project <id> --ceiling <contributor|maintainer>`.
  Showing needs `read`; setting needs `administer projects` on the selected project.

## Protection refusals

When a command returns one of these rules, follow its action and do not repeat the same request:

- `immutable`: the type forbids changing or deleting the record on every branch or baseline. Leave it unchanged.
- `owned`: a connected system alone writes the record. Ask that system to make the change.
- `frozen`: someone with the lock capability must lift the lock. Ask that person; do not try a
  different branch or baseline.
- `protected`: a rule allows the record to change only through a merge from a branch. Make the
  change on a branch and merge it.
- `proposal-required`: submit the source branch for review against the merge target.
- `approvals-required`: read `approvals.counted` and `approvals.required` for the subject project.
  Ask eligible reviewers to approve the source's current head; stale approvals do not count.
- `deletion-restricted`: ask a member of every matching rule's bypass list to dispose of the branch.
- `bypass-required`: a pending proposal and matching rules require bypass to dispose. Ask a member
  of every matching rule's bypass list, or refuse the proposal first; deletion restrictions still apply.
- `stale-source`: read a branch you can use and merge its current head. Optional merge `name`
  requires that bound branch's current head to equal `sourceHash`; it never selects a proposal.
  A successful merge closes only the source ref's pending proposal for that target.
- `not-a-ref-head`: the branch has new commits since the review began. Reload the proposal to
  review its latest commit; the refusal does not identify the branch or its newer head.
- `branch-needs-schema-update`: the branch's schema must be updated before writing. The
  person can run `openeng schema-update request --ref <ref>` to record a request, then
  `openeng schema-update show --ref <ref>` to read its state or `no request`. Stop writing while
  the branch needs an update; recording a request does not execute the update. Requesting needs
  `write ref` on the branch's home project, or `administer projects` for an organisation branch or baseline;
  showing reads only the requester's records in the token organisation and needs no project read
  access. A branch whose name contains `/` cannot request or show a schema update today.
  When the operator runs the update, it merges the organisation trunk into the branch only if
  the branch lacks the trunk's latest schema change, bringing both the schema and rows saved
  on the trunk since the branch was cut. If the branch and trunk changed the same row, the
  request ends `failed` with `merge-conflict`, the branch stays unchanged, and the next update tries again.
- `organisation-not-ready`: the organisation's trunk is not ready. Try again shortly.
- `read-only-ref`: this caller cannot write or merge into this ref; it does not mean nobody can. Choose a ref in your writable scope.

## 4. Link to a page

To give the person a page, run `openeng link` and hand them the address it prints; never write a path
or an address yourself. `openeng link <kind> --project <id> --ref <ref>` takes `branch-diff`
or `project`; `openeng link <kind> <identifier> --project <id> --ref <ref>` takes `object`, `type`, `proposal` or
`app` (the app's first page); `openeng link app-page <appKey> <pageKey> --project <id> --ref <ref>` takes
one page of an app; `openeng link app-draft <appKey> --ref <ref>` takes the app's draft screen and no
project. `openeng link ontology --ref <ref>` and `openeng link change-set --ref <ref>` take a branch and no
project, and `openeng link organisation-page <page>` takes neither flag. The organisation is the one
your session is attached to.

| kind | destination |
|---|---|
| `object <id>` | The object's type page with the object open; the type comes from its read. |
| `type <key>` | The type's page. |
| `explore` | Explore with exactly one `--object <id>` or `--object-set <id>` seed. |
| `branch-diff` | The branch comparison page. |
| `project` | The project page. |
| `proposal <id>` | The proposal review page. |
| `ontology` | The organisation's Types workspace. |
| `change-set` | The organisation's Change set workspace. |
| `app <key>` | The published app's first page. |
| `app-page <appKey> <pageKey>` | The named page of a published app. |
| `app-draft <key>` | The app's draft screen in the Types workspace. |
| `organisation-page <page>` | The named organisation administration page or settings. |

Only `explore` opens Explore. Use `openeng link explore --project <id> --ref <ref>` with exactly
one of `--object <id>` or `--object-set <id>`; neither or both refuse before a host call.
The seed flags are only for `explore`. `link object <id>` opens the type page with that object,
using the type key from the object read. Explore also reads its selected object or saved set first.

### Save an object set and link to its canvas

1. Run `openeng help objects-sdk createObjectSet` and `openeng help objects-sdk readObjectSet`.
2. Query the objects you need with `openeng objects-sdk queryObjects --selector <json> --input <json> --json`; read `openeng help objects-sdk queryObjects`
   for the input. Keep each object's
   project with its identifier; one set may contain objects of several projects in your organisation.
   To combine two selections on the same ref, send `{ "kind": "set", "op": "difference", "left": { "kind": "objects", "typeKey": "..." }, "right": { "kind": "objects", "typeKey": "..." }, "limit": 100, "continuation": null }`. `op` may be `union`, `intersection` or `difference`. Each operand may have its own `projects`, `filters` and `steps`; operands cannot be nested set operations.
   To select several object types in one paged query, use `typeKey: null` with a top-level `{ "kind": "type", "op": "in", "values": ["part", "system"] }` filter. The list holds 1 to 100 published type keys; combine it with a text filter to search those types. Follow the returned continuation without changing the selection.
   `aggregateObjects` also accepts `operation: "average"` with one numeric `property`; the result includes its mean and the count averaged, and omits the mean when that count is zero.
3. Call `openeng objects-sdk createObjectSet` with a name and the selected addresses, following its
   help. Keep the returned set identifier and revision. Retrying with the same idempotency key
   returns that original answer.
4. Run `openeng link explore --project <page project> --ref <ref> --object-set <set id>` and give the
   person the address it prints. It reads the set first; a refused read prints no link. The set
   stores no branch or baseline, so the link's branch chooses which version of its objects opens.

Every kind with `--ref`, including `ontology` and `change-set`, takes `main` or
`<projectId>/<branch>`, the branch name the platform returns. Baseline names are not accepted by `openeng link`. A bare branch name or change-set id is
refused by `openeng link`. Before printing, the command reads a `--ref` other than `main`, and the page's own subject where the kind has one;
a subject it cannot find is a refusal with a reason and no printed address.

An **App** is an organisation entity with its own pages and drafts, linked by `openeng link app`.
An **App view** is a type's collection content in `presentationBindings.views.app`, root `AppBody`,
and cannot be linked by `link app`.

## 5. Show data to the person

The CLI draws nothing. Read the `--json` output of a query or a read and draw it yourself, as a
table or a tree in ASCII, or as a Mermaid diagram when the person's tool renders it. Draw only
what the output holds.

## 6. Connect an Onshape account

The connector commands import an Onshape account's documents into a mirror project. Each
command's help, such as `openeng help connector create` or `openeng help connector run`, names the
capability it needs. Through the CLI you act with the signed-in person's user token, so you can do
what that person may and nothing more.

Before you create a connection, tell the person this, because create prints it on standard error
and the person must know it: "Everyone with access to this project sees every document this
Onshape account can see."

The order, from no connection to a first imported document:

1. `openeng connector create --system onshape --stack <stack> --name <text> [--company <id>]
   [--team <id> | --owner <id>] [--label <text>]`. `--stack` is the Onshape stack label, as in
   `cad`. At most one of `--team` and `--owner`. With neither, `--company` is required and must be the
   company's own identifier, never a user's. It prints the connection identifier and the change
   set it drafted for the connector's types, or the rule that stopped the drafting.
2. `set-credential <connection>`: the command reads the access key and the secret key at a terminal
   prompt only, with no flag and no environment variable. Do not ask for the Onshape keys, do not
   accept them in the conversation, and do not type them on the person's behalf. Ask the person to
   run `openeng connector set-credential <connection>` at their own terminal. Setting it again replaces
   the stored credential. The person can cancel at either prompt with Control-C; the command then
   says no keys were set.
3. A person who holds `administer types` reviews the change set (`openeng types draft show
   --change-set <id> --project <mirror project id>`) and accepts it (`openeng types draft accept
   --change-set <id> --revision <token>`). Until then a run refuses with `types-not-approved`.
   `openeng connector draft-types <connection>` drafts again.
4. `openeng connector run <connection>` prints the run identifier. `openeng connector runs <connection>`
   lists the runs newest first with state, counts and failure kind; read it until the state is
   `succeeded` or `failed`.
5. `openeng connector revoke <connection>` ends the connection.

The connected system alone writes records of its owned types. A person's write is refused as
`owned`. People put their own information in separate rows and link those rows to the mirrored
records. The importer counts an object as `overwritten` when a property the import changes was last modified by someone else; other changes count as `updated`. If a mirrored
record is absent, the importer creates it with a new identifier and counts it as `created`.

Refusals you will meet, with what each means and what to do:

- `types-not-approved`: the connector's types wait for approval by a person who holds the
  permission to administer types. Ask such a person to review and accept the connector's change
  set; read it with `openeng types draft current`.
- `import-running`: a run of this connection is already running. List the connection's runs with
  `openeng connector runs <connection>`.
- `connection-revoked`: the connection is revoked, so it takes no further change or run. A new
  connection makes a new mirror project.
- `not-permitted`: the operation was refused. What the request names may not exist, or the person
  may not have permission for it; the answer is the same either way. Check that the request names
  something the person can reach; if it does, the person must ask an administrator for the
  permission.
- `credential-not-valid`: Onshape did not accept the credential, and nothing was stored. The person
  checks the keys and runs `set-credential` again.
- `connection-exists`: the organisation already has a live connection for this stack and company. List the connections with `openeng admin-sdk listConnections` rather than creating another.
- `connector-template-missing`: this deployment holds no type template for the connector's system.
  No remedy is in your reach; tell the person.
- `change-set-open`: the organisation already has an open change set, so drafting the types
  stopped. Read it with `openeng types draft current` and continue with it; the connection exists, and
  `openeng connector draft-types <connection>` drafts once that change set is settled.

## Inviting a person

Run `openeng help admin-sdk createInvitation` before inviting. The request takes `email`, an
organisation `roleKey`, and optional `projectRoles`: up to 50 `{ projectId, roleKey }` entries,
one per project in the attached organisation. The inviter must administer members on the
organisation and each project, and may offer no role above their own there. Send no organisation
field; the server derives it. Deliver the returned link to the person.

`openeng admin-sdk listInvitations --input '{}' --json` lists pending invitations and their
project roles. Re-issuing keeps the roles; revoking removes the invitation from that list.
Acceptance skips and audits a project role when the project ended, the person already holds an
equal or higher project role, or the inviter lost the required standing. Sign-in continues.

Membership roles are read from the deployment ladder. Its built-in roles are `owner`, `maintainer`,
`contributor`, `reader` and `none`. They grant, respectively:

- `owner`: administer members, projects and service identities; write refs and read.
- `maintainer`: write refs and read.
- `contributor`: write refs and read, including direct merges where no rule matches the target.
  Matching rules and bypass entries decide how each ref may change.
- `reader`: read.
- `none` (No role): organisation standing with no capability. Use a project role for project access.

A membership can be scoped to an organisation or a project. An organisation role supplies its
capabilities in each project of that organisation too; a project role applies to its named project.
For a project-specific exception, grant the role on that project rather than assuming a membership
in one project applies to another. Every project membership requires an organisation membership;
use `none` when the person needs only specific projects. Invite them with that organisation role
before granting a project role. A new service identity already holds an organisation row at `none`;
change that row with `changeMembershipRole` for organisation access, or grant a project role.
The role options returned by `listMembers` include sorted capabilities; an empty list means no capability.

An unknown role on an invitation or membership grant answers `unknown-role` with `roleKeys`, the
deployment's role keys. Choose one of those keys. A known role above your own answers
`above-caller-role`.

### Change or leave membership

Use `openeng admin-sdk grantMembership` with `principalId`, `scopeKind`, `scopeId` and `roleKey`.
`changeMembershipRole` takes those same four fields; `revokeMembership` takes the first three.
Use `leaveMembership` for the signed-in person's departure, with only the scope:

```sh
openeng admin-sdk leaveMembership --input \
  '{"scopeKind":"project","scopeId":"<project-id>"}' --json
```

`scopeKind` is `organisation` or `project`. Granting or changing another person's role and
revoking another membership require `administer members`. A person may lower their own role or
leave using their membership alone. Self-grants and own-role raises are refused as
`membership-own-role` (P3608); equal-rank grants to another person are allowed.

A hidden or absent scope answers `not-found` (database OE067), identically in both cases.
A missing membership at a visible scope answers `no-such-membership` (OE006).
`last-administrator` (OE004) protects the organisation's last eligible administrator, not a
separate administrator in every project. Removing an organisation membership also removes that
person's project memberships in that organisation and ends their work there. Leaving an ended
project is allowed. These membership writes take no idempotency key and have no recovery route.

## Recover an interrupted operation

`openeng objects-sdk recover` checks the record of a mutation or verb whose result was unknown. Give
the same project and ref, and the original correlation id:

```sh
openeng objects-sdk recover --selector '{"projectId":"<project-id>","ref":"<project-id>/<branch>"}' --input '{"correlationId":"<correlation-id>"}' --json
```

Recovery can report a committed change and its hash, and finish the recovery record. It never sends
the original mutation again. If the saved evidence still cannot establish an outcome, it returns
`unknown`; it cannot undo a successful write, restore a deleted object, or retry a failed operation.

A client with the `branches.proposalSubmit` grant may submit a proposal under the person's
project permissions. That grant alone permits no other branch write.
## Builds

Save a step and its immutable output declarations with the objects SDK's `saveStep`, then check
its case before starting. Named inputs bind a case or an output by object identifier.
A property binding is a data-input edge from the step to the object, of a published edge type
of the data-input shape: from `build-step`, with exactly two properties, `name` and `property`,
both required.
The pack names these types `reads-data-from-<type>` and hides them in the ontology editor.
The edge reads the named property of the object at the ref, and a bound value is at most 1 MiB.
An entry that declares no property input, such as `modelica-compile`, answers such a binding
`binding-mismatch`. Do not retry by silently dropping the property.
Functions name a runtime key, the engine image's key, and an entry. The server derives image pins,
scope and content keys. A function whose runtime is `python-sci` holds a Python body and uses the
entry `python-run`: its one module-level function decorated with `@step` (`from oe2_engine import
step`) is called with the step's arguments by keyword, and it returns a dict from each declared
output's name to its value. The server checks each step's arguments against that function's typed
signature before anything runs. To add an engine image, see the public docs page "Add an engine
image".

```sh
openeng objects-sdk checkCase --selector '{"projectId":"p","ref":"main"}' --input '{"caseId":"case"}'
openeng objects-sdk startBuild --selector '{"projectId":"p","ref":"main"}' --input '{"target":{"kind":"outputs","outputIds":["out"]}}'
openeng objects-sdk startBuild --selector '{"projectId":"p","ref":"main"}' --input '{"target":{"kind":"case","caseId":"case"},"choice":"run-stale"}'
openeng objects-sdk startBuild --selector '{"projectId":"p","ref":"main"}' --input '{"target":{"kind":"build","buildId":"build"},"choice":"run-all"}'
openeng objects-sdk cancelBuild --selector '{"projectId":"p"}' --input '{"buildRunId":"run"}'
openeng admin-sdk registerEngine --input '{"name":"engine","isolation":"ephemeral","properties":{},"runtime":{"image":"openmodelica"}}'
openeng admin-sdk listEngines --input '{}'
```

```sh
openeng objects-sdk readBuildRun --selector '{"projectId":"p"}' --input '{"buildRunId":"run"}'
openeng objects-sdk readStepRun --selector '{"projectId":"p"}' --input '{"stepRunId":"step-run"}'
openeng objects-sdk readStepLog --selector '{"projectId":"p"}' --input '{"stepRunId":"step-run"}'
openeng objects-sdk listBuildRuns --selector '{"projectId":"p"}' --input '{"objectId":"out","continuation":null}'
openeng objects-sdk readOutputValues --selector '{"projectId":"p","ref":"main"}' --input '{"outputId":"out","keys":[{"sweep":{},"componentId":"component","variable":"temperature"}]}'
```

`listBuildRuns` takes `{ objectId, continuation }` and the project from
`selector: { projectId }`. It lists runs that target an output or case, or contain a step run of
that step, newest start first (ties by build-run identifier ascending), at most 20 per page.
The result is `{ runs, continuation }`; begin with `continuation: null`, pass the returned token
unchanged for the next page, and stop when it is null. Each run includes its ref, target, state,
start time, starter and step summaries. Listing ends no step run and starts none.

`readOutputValues` takes `{ outputId, keys, runRef? }` with
`selector: { projectId, ref }`; the project comes from the selector. Each key is
`{ sweep, componentId, variable }`, where `sweep` maps parameter names to numbers. `runRef`
optionally restricts stored runs to that ref. The result is `{ values }`, one entry per requested
key: `current` or `stale` with the key, numeric value, unit, step-run identifier, ref, engine
identifier and `nonRepeatable` flag, or `no-result` with the key when no value matches.
Freshness compares the stored content key with the current one for the selector's ref;
`nonRepeatable` reports differing digests for the same content key. Missing runs or unavailable
indexed output answer `not-found`; opaque output cannot be read through this route.

An unfinished build reads `running`. A cancel by a person reads `canceled`; a step run cancelled because its
upstream failed names that upstream in its error. A `not-found` answer means the row is hidden or absent.
A step run's log is plain text; show it as text and never as markup.

An `outputs-already-current` refusal includes current/stale counts and writes nothing. Ask the user
which explicit choice to send; the notice grants no permission to choose `run-all` or `run-stale`.
A start is refused `build-too-large` when the plan would create more than 20 new step runs; the limit is fixed for each request, so split it. A start is refused `build-limit-reached` when the organisation is at its limit.
A start returns `kind: started` with identifiers, or `kind: unchanged` with counts and no build ID.
`run-all` reruns upstream work too; `run-stale` reuses complete upstream work with source-run/output
provenance. Compile can run once while simulation expands sweep points. Engine registration is an
administrator operation in the authenticated organisation and follows the marked-route step-up.
When builds are unavailable, ask the administrator about engine registration and compute setup.
