@oxy-hq/cli 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +406 -16
  2. package/dist/main.mjs +6563 -8427
  3. package/dist/main.mjs.map +1 -1
  4. package/dist/{mcp-B2KBWNOU.mjs → mcp-CJWQm-yd.mjs} +147 -190
  5. package/dist/mcp-CJWQm-yd.mjs.map +1 -0
  6. package/json-schemas/config.json +26 -45
  7. package/json-schemas/workflow.json +0 -17
  8. package/package.json +6 -5
  9. package/skills/oxy-agents/SKILL.md +15 -4
  10. package/skills/oxy-agents/references/quick-reference.md +1 -1
  11. package/skills/oxy-automations/SKILL.md +1 -1
  12. package/skills/oxy-cli/SKILL.md +91 -4
  13. package/skills/oxy-custom-apps/SKILL.md +233 -13
  14. package/skills/oxy-custom-apps/references/environment-branches.md +172 -0
  15. package/skills/oxy-custom-apps/references/phone-layout.md +88 -0
  16. package/skills/oxy-custom-apps/references/reading-data.md +4 -6
  17. package/skills/oxy-custom-apps/references/sandbox-agent-loop.md +120 -17
  18. package/skills/oxy-custom-apps/references/verifying-in-the-browser.md +19 -9
  19. package/skills/oxy-evals/SKILL.md +1 -1
  20. package/skills/oxy-experiments/SKILL.md +245 -0
  21. package/skills/oxy-semantic-modeling/SKILL.md +2 -2
  22. package/template/.github/workflows/publish.yaml +1 -1
  23. package/dist/mcp-B2KBWNOU.mjs.map +0 -1
  24. package/json-schemas/app.json +0 -1884
  25. package/skills/oxy-data-apps/SKILL.md +0 -362
  26. package/skills/oxy-data-apps/references/examples.md +0 -263
  27. package/skills/oxy-data-apps/references/quick-reference.md +0 -171
  28. package/skills/oxy-data-apps/templates/dashboard-with-controls.app.yml +0 -128
  29. package/skills/oxy-data-apps/templates/simple-dashboard.app.yml +0 -102
package/README.md CHANGED
@@ -3,8 +3,12 @@
3
3
  `oxyc` — a `gh api`-shaped client for the Oxy HTTP API, plus the tooling that
4
4
  manages customer workspace repos.
5
5
 
6
- - **API client** — `api`, `routes`, `schema`, `openapi`, `login`, `whoami`, `token`, `login-link`, `tokens`, `assume`, `oltp`
6
+ - **API client** — `api`, `routes`, `schema`, `openapi`, `login`, `whoami`, `token`, `login-link`, `tokens`, `assume`, `oltp`, `airhouse`
7
+ - **Experiments** — `experiments` (draft, price, register, status, interim, abort, result)
8
+ - **Feature flags** — `flags` (list, show, set, rules, eval, org)
9
+ - **Home layout** — `home` (show, get, apply, reset)
7
10
  - **Customer workspaces** — `list`, `new`, `import`, `doctor`, `update`, `adopt`, `launch`
11
+ - **Your workspace's repository** — `workspace clone`
8
12
  - **Custom apps** — `publish`, `init-ci`, `proxy`, `apps`
9
13
  - **Checks** — `checks run`
10
14
  - **Sandboxes** — `env`, `fn dev`, `fn call`, `invocations`, `logs`
@@ -27,13 +31,15 @@ pnpm link --global # or, for `oxyc` on PATH
27
31
  ```
28
32
 
29
33
  Requires `node >= 20`. `gh` (authenticated) is required for the customer
30
- commands, `jq` for `--jq`, `git` for the repo commands. Each is reported by
31
- name with its install line the first time a command needs it.
34
+ commands, `git` for the repo commands. Each is reported by name with its
35
+ install line the first time a command needs it. `--jq` needs nothing extra. It
36
+ uses `jq` when it is on PATH and an embedded copy of jq when it is not, as
37
+ `gh api -q` does.
32
38
 
33
39
  ## Quick start
34
40
 
35
41
  ```bash
36
- oxyc login --env dev # browser flow; stores a token
42
+ oxyc login --env dev # browser flow (a URL + code where there is no browser); stores a token
37
43
  oxyc whoami --env dev # verify it against the deployment
38
44
 
39
45
  oxyc routes threads # find the endpoint
@@ -92,7 +98,7 @@ is where an app's bundle is served. The app registry API is `api/customer-apps/
92
98
  | `-F, --field <k=v>` | typed parameter — `true`, `3`, `["a"]`, `@file`, `@-` |
93
99
  | `-H, --header <name:value>` | extra header (repeatable) |
94
100
  | `--input <file\|->` | raw request body from a file, or `-` for stdin |
95
- | `-q, --jq <expr>` | filter the response through `jq` |
101
+ | `-q, --jq <expr>` | filter the response through jq (the `jq` binary, else an embedded jq) |
96
102
  | `--md` | render the result as a markdown table |
97
103
  | `--paginate` | follow every page and return one document |
98
104
  | `--paginate-key <field>` | the field holding the rows, when the guess is wrong |
@@ -146,10 +152,27 @@ are talking to rather than a baked table. It is cached per host; `--refresh`
146
152
  re-asks. `--all` includes ide-only and worker-only mounts. `--json` adds each
147
153
  route's surface and fleet role.
148
154
 
155
+ ## Asking an agent
156
+
157
+ ```bash
158
+ oxyc ask <workspace-id> <agent> "How many orders last week?" [--thread <id>] [--wait <s>] [--json]
159
+ ```
160
+
161
+ One request: the server waits up to `--wait` seconds (1 to 45, default 45) for the
162
+ answer, and the answer goes to stdout so it pipes. It is the route a custom app's
163
+ `useAskAgent` calls, as the person logged in.
164
+
165
+ - **The agent asked a clarifying question:** the question and its suggestions go to
166
+ stdout, exit `0`; answer with `oxyc ask … --thread <id> "<answer>"`.
167
+ - **Still running when the wait runs out:** exit `0`. The ask keeps running on the
168
+ fleet, and stderr names the run and the thread to read it in. `--json` carries
169
+ `status: "running"` for a caller that branches.
170
+ - **The ask failed, timed out or was cancelled:** exit `1`, with the error.
171
+
149
172
  ## Authentication
150
173
 
151
174
  ```bash
152
- oxyc login [--env <e>] [--login-env <e...>] [--assume <org> -r <why>] [--no-browser [--approver <email>]]
175
+ oxyc login [--env <e>] [--login-env <e...>] [--assume <org> -r <why>] [--browser | --no-browser [--approver <email>] [--no-wait]]
153
176
  oxyc whoami [--json] # who the credential is, and what it can reach
154
177
  oxyc token # print the bearer, for a raw curl
155
178
  oxyc login-link [--next <path>] [--json] [--open] # a one-time URL that signs a browser in
@@ -158,8 +181,8 @@ oxyc tokens list [--json] # your personal access tokens
158
181
  oxyc tokens revoke <id>
159
182
  oxyc tokens revoke --current # end the token in OXY_TOKEN
160
183
  oxyc tokens create # opens Account → Personal access tokens
161
- oxyc tokens create --sandbox-agent --app <org>/<app> [--app …] [--hours 8] [--name …] [--no-browser [--approver <email>]]
162
- oxyc tokens create --agent [--standing] [--hours 8] [--name …] [--no-browser [--approver <email>]]
184
+ oxyc tokens create --sandbox-agent --app <org>/<app> [--app …] [--hours 8] [--name …] [--browser | --no-browser [--approver <email>]]
185
+ oxyc tokens create --agent [--standing] [--hours 8] [--name …] [--browser | --no-browser [--approver <email>]]
163
186
  ```
164
187
 
165
188
  **An agent runs on its own token, never on the person's `oxyc login`.** Which
@@ -281,6 +304,37 @@ whoever started the request collects it and the approver cannot see who that
281
304
  is. `--standing --no-browser` is a usage error (exit `2`), and a login made
282
305
  this way reaches only what its approver's organization memberships do.
283
306
 
307
+ **`oxyc login` picks the device code itself where no browser can reach this
308
+ machine**, the way `gh auth login` prints a URL and a code: in a Claude Code
309
+ remote session (`CLAUDE_CODE_REMOTE`), a GitHub Codespace, over SSH (unless
310
+ `BROWSER` names an opener, as VS Code Remote-SSH does), and on Linux with no
311
+ `DISPLAY`/`WAYLAND_DISPLAY` (WSL excepted). It says which, on stderr.
312
+ `--browser` forces the loopback, `--no-browser` the device code, and
313
+ `OXYC_HEADLESS=1`/`0` does either without a flag. `tokens create --agent` and
314
+ `--sandbox-agent` decide the same way.
315
+
316
+ **On a CI runner** (`CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`) nobody can
317
+ approve anything, so `oxyc login` and `tokens create --agent|--sandbox-agent`
318
+ refuse at once with exit `4` instead of waiting ten minutes, and name what needs
319
+ no person: `OXY_TOKEN` from a CI secret, or a GitHub OIDC service account
320
+ (`--service-account`). Pass `--no-browser --approver <email>` to have a person
321
+ approve from their device anyway (an exported `OXY_APPROVER` counts with
322
+ `--no-browser`, `--no-wait` or in a Claude Code cloud session, never where oxyc
323
+ only detected SSH or a Codespace; on a runner only the flag lifts the refusal); `OXYC_HEADLESS` or `CLAUDE_CODE_REMOTE` also
324
+ lifts the refusal. The approval URL and code are printed even with `--quiet`.
325
+
326
+ **`oxyc login --no-wait`** is the device code for a caller that cannot watch a
327
+ command still running — an agent sees a command's output only when it ends.
328
+ It starts the request, prints the approval URL **alone on stdout** (the code
329
+ and the next step on stderr) and exits `0`. Once the person has approved,
330
+ **`oxyc login` again, with the same `--env`/`--target`**, collects that same
331
+ request in one poll and caches the token as any login does; before approval it
332
+ prints the URL again and waits. The request (device code and PKCE verifier) is
333
+ kept in `login-pending.json` beside the credentials file, owner-only, until it
334
+ is collected, refused or lapses (ten minutes). `--browser` skips it.
335
+ `--no-wait` is a usage error (exit `2`) with `--browser`, `--login-env` or
336
+ `--assume`; pass `--assume` to the `oxyc login` that finishes.
337
+
284
338
  **`--approver <email>`** (env `OXY_APPROVER`, valid only with `--no-browser`;
285
339
  anything else is a usage error, exit `2`) names who must approve, so nobody
286
340
  has to hand them a URL: the platform tells that person itself, by push,
@@ -543,6 +597,162 @@ shows its age and calls it stale past 30 days; nothing resets it on a timer.
543
597
  staging data in the org, so it lists those apps and asks first (`--yes`
544
598
  without a terminal).
545
599
 
600
+ ## Airhouse tenants
601
+
602
+ Staff can see a workspace's Airhouse tenant — the warehouse behind
603
+ `ctx.airhouse` and `type: airhouse_managed` — and repair it, without the admin
604
+ console. The server provisions a workspace's tenant itself; `provision` is the
605
+ repair and backfill tool, for a workspace that predates that or whose tenant or
606
+ service account did not come up.
607
+
608
+ ```bash
609
+ oxyc airhouse status [--workspace <id>] [--json]
610
+ oxyc airhouse provision --workspace <id> [--yes] [--json]
611
+ ```
612
+
613
+ `status` lists every workspace, with a tenant or without; with `--workspace` it
614
+ shows that workspace's tenant and whether its service account is bound. The
615
+ fleet read is capped, and the cap falls on workspaces without a tenant, so a
616
+ workspace missing from a capped page is reported as possibly cut rather than
617
+ nonexistent. No credential is ever printed.
618
+
619
+ `provision` prints what it will create and asks first, because the tenant name
620
+ (`oxy-ws-<workspace id>`) is global and cannot be reused; without a terminal it
621
+ refuses unless `--yes`. It is idempotent — an existing tenant is reconciled
622
+ (a missing service account is bound), not duplicated. `--workspace` takes the
623
+ workspace's UUID. A 404 can be a workspace outside your staff grant's scope, a
624
+ 503 is a deployment with no Airhouse configured, and an active `assume` session
625
+ closes `/admin`.
626
+
627
+ ## Feature flags
628
+
629
+ Staff-only control of the flags Oxy declares in code
630
+ (`crates/app/src/server/feature_flags/registry.rs`): the kill switch and the
631
+ targeting rules — per-org / per-user overrides plus a weighted fallthrough for
632
+ A/B splits. Flags are not created at runtime. **Every write hits the
633
+ deployment `--env` names (production by default) and takes effect for real
634
+ orgs**; it needs platform-operate standing (an `assume` session does not give
635
+ it).
636
+
637
+ ```bash
638
+ oxyc flags list # key, kill switch, rules summary, unit, scope
639
+ oxyc flags show <key> # rules in full, and any unreadable-rules error
640
+ oxyc flags set <key> --on|--off [--yes] # the kill switch only
641
+ oxyc flags rules <key> --set-org <org>=<variant> [--set-org …] [--yes] # slug or UUID; `org=` removes
642
+ oxyc flags rules <key> --set-user <uuid>=<variant>
643
+ oxyc flags rules <key> --remove-org <org> | --remove-user <uuid>
644
+ oxyc flags rules <key> --everyone <variant> # everyone not overridden
645
+ oxyc flags rules <key> --split control=50,treatment=50 # percent; must total exactly 100
646
+ oxyc flags rules <key> --file rules.json | --clear # replace wholesale | back to the plain switch
647
+ oxyc flags rules <key> … --dry-run # print the rules that would be sent
648
+ oxyc flags eval --org <org> [--user <uuid>] # what each flag serves them: variant, reason, bucket
649
+ oxyc flags org <org> # what a member of that org sees (client flags)
650
+ ```
651
+
652
+ `rules` reads the flag first and edits the rules it has, so adding one override
653
+ leaves the other overrides, the fallthrough and the salt as they were. A flag
654
+ with no rules starts from what it serves today (kill switch on is the second
655
+ variant, off the first). Percentages become basis points; a total other than
656
+ 100%, or a share finer than 0.01%, is a usage error (exit 2) rather than a
657
+ rounded split. The override flags are `--set-org` / `--set-user` because `--org`
658
+ is the global "which org" flag. `eval` is a preview and records nothing. Rules
659
+ saved behind an off kill switch do not apply until `set <key> --on`, and the
660
+ command says so.
661
+
662
+ Every write asks first and refuses without `--yes` when stdin is not a terminal
663
+ (exit 8). A rejected rule set (422: an unknown variant, a split that does not
664
+ total 100%, rules on a flag whose read sites do not pass the org) is printed in
665
+ the server's words and exits 6. A flag whose stored rules this build cannot
666
+ read (409) is edited only by `--file` or `--clear`. Guide:
667
+ `internal-docs/feature-flags.md`.
668
+
669
+ ## Experiments
670
+
671
+ An experiment's whole lifecycle, as records on the deployment: a draft design
672
+ edited in place, priced, registered (which freezes it and makes it the run),
673
+ watched, aborted or reported. Every verb takes `--workspace <id>` and `--json`.
674
+
675
+ ```bash
676
+ oxyc experiments list
677
+ oxyc experiments design <name> > promo.yml # the config, as YAML
678
+ oxyc experiments create --file promo.yml # a new draft
679
+ oxyc experiments edit <name> --file promo.yml # overwrite the draft
680
+ oxyc experiments duplicate <name> <new-name> # how a registered one is changed
681
+ oxyc experiments price <name> --candidate '<yaml|json|@file>' [--candidate …] [--wait]
682
+ oxyc experiments proposals <name>
683
+ oxyc experiments use <name> <proposal-id> # pricing's keys onto the draft
684
+ oxyc experiments register <name> [--yes] # freeze it; it becomes the run
685
+ oxyc experiments retrospective <name> [--yes] # past dates only: analyse as its one run
686
+ oxyc experiments status <name> # flips, guardrails, compliance, estimate
687
+ oxyc experiments abort <name> --reason <text> [--levers off|keep] [--yes]
688
+ oxyc experiments interim <name> [--refresh [--wait]] # the reading so far, badged not final
689
+ oxyc experiments result <name> # sealed until reported
690
+ oxyc experiments write-back <name> # branch writing the coefficient back
691
+ ```
692
+
693
+ A candidate is one design to price, tagged by `shape`:
694
+ `{shape: waves, wave_sizes: [20, 20], first_switch_on: 2026-11-02, spacing_days: 14}`
695
+ or `{shape: switchback, first_period_on: 2026-11-02, period_days: 7, pairs: 6}`
696
+ (`blocks`, `assign_by` and `alpha` are optional). One to six per request;
697
+ `--wait` polls until each is priced, refused or failed — a refusal is the
698
+ answer, not an error. Lengths count periods of the design's `grain` (day by
699
+ default; hour, week, month), and every date must start one: a Monday at week
700
+ grain, the 1st at month grain, a local whole hour at hour grain
701
+ (`first_period_on: 2026-10-26T14:00`).
702
+
703
+ `edit` sends the hash of the draft it read (or `--base-hash`), and `register` /
704
+ `retrospective` send the hash of the draft they just read, so an edit someone
705
+ made in between is a 409 rather than a silent overwrite or a design registered
706
+ unseen. `register`, `retrospective` and `abort` ask first, and refuse without
707
+ `--yes` when stdin is not a terminal. `result` on a run that is not reported
708
+ prints that it is sealed and exits 0: there is deliberately no effect number
709
+ before `reported`. `interim` is the registered analysis over the periods
710
+ finished so far on a live or closing run, labelled not final (its interval is
711
+ the fixed-horizon one, so reading it early overstates confidence); `--refresh`
712
+ asks for a fresh one and a run not in progress exits 0 with its state. `write-back` needs the deployment that holds the
713
+ workspace's working copy. Staff reach a tenant workspace only inside an
714
+ `oxyc assume` session.
715
+
716
+ ## Home layout
717
+
718
+ The org's home is laid out by one document: an ordered list of sections. A `widgets`
719
+ section is a group (it may repeat, each with an optional `title`) holding an ordered list
720
+ of the widgets custom apps declare, each at a named size. An item may carry `params` (the
721
+ widget's settings), a `title` and an `id`, so one widget can be placed as several copies,
722
+ one per store, named `app/widget#id`. A widget's view may ask to be re-read with
723
+ `refresh_after` (seconds). `oxyc home` lets an agent see what a person sees, then change it.
724
+
725
+ ```bash
726
+ oxyc home show --org <slug> [--json] # the home as text
727
+ oxyc home get --org <slug> > layout.json # { revision, layout }, to edit
728
+ oxyc home apply --org <slug> -f layout.json [--dry-run] [--revision N] [--force] [--json]
729
+ oxyc home reset --org <slug> # back to the default
730
+ ```
731
+
732
+ `--org` takes a slug, UUID or org URL, and is optional when `--env` is an org URL.
733
+
734
+ `show` combines `GET /orgs/{id}/home` and `GET /home/widgets?org=`: the sections in
735
+ order, each widgets group under its title (`Widgets` when untitled) and, for each
736
+ copy, `app/widget[#id] · Title · size`, a `params: store=mission` line when it has
737
+ settings, `refreshes every 5m` when its view sets `refresh_after`, its headline with the
738
+ level as a word (`[attention]`), detail, `progress 61/84` or the metric, up to three rows
739
+ and its button labels, then `not shown:` for every declared widget the layout leaves
740
+ out (`(Title, needs settings: store)` for one that needs settings a layout has not
741
+ given). `--json` prints both answers raw as `{ home, widgets }`. `get` prints
742
+ `{ "revision": N, "layout": … }`: the `effective_layout` (always a complete document)
743
+ and the revision it was read at, so `get`, edit the layout, `apply` round-trips.
744
+
745
+ `apply` reads that file (or a bare layout) from a path or `-` (JSON or YAML) and sends
746
+ the revision **your edit started from**: the file's, or `--revision N`. A layout someone
747
+ saved after your `get` is therefore **exit 8** ("the home layout changed since it was
748
+ read") rather than an overwrite. A bare layout with no revision is refused unless you
749
+ pass `--revision` or `--force`, which sends none and overwrites. A layout the server refuses is **exit 6**, with every problem listed at
750
+ once as `path: message (fix)`. `--dry-run` prints the home the layout would give, as
751
+ `show` does, and saves nothing (live views come from the saved layout, so a widget it
752
+ does not yet draw reads "no live view until it is saved"). Writing needs an org owner
753
+ or admin; staff need an `oxyc assume` session. Widget `sizes` and the view a widget
754
+ returns are in the `oxy-custom-apps` skill.
755
+
546
756
  ## Customer workspaces
547
757
 
548
758
  A customer **is** a GitHub repo carrying the `oxy-customer` topic. Tagging the
@@ -571,6 +781,86 @@ never touched.
571
781
  `launch` starts a Claude Code session scoped to one customer; `--here` runs in
572
782
  the current directory while granting access to the customer's repo.
573
783
 
784
+ ## Cloning a workspace's repository
785
+
786
+ ```bash
787
+ oxyc workspace clone <workspace> [--env dev|staging|production] [--dir <path>]
788
+ [--open code|cursor|none] [--branch <name>]
789
+ ```
790
+
791
+ Authoring happens in the workspace's repository, not in the product: clone it,
792
+ edit with VS Code, Cursor or an agent, and push. **A push to the default branch
793
+ compiles and deploys.** The in-app "work in your editor" panel prints exactly
794
+ this command.
795
+
796
+ `<workspace>` is the workspace's id (`oxyc api {org}/workspaces --jq '.[] |
797
+ [.id, .name]'`), or its name when `--org <slug>` says where to look. The command
798
+ reads `git_remote_url`, `default_branch` and `repo_subdir` from `GET
799
+ /api/{workspace}/meta`, prints the plan and runs plain `git clone --branch
800
+ <default branch> <url> <dir>` with **your** git and credentials: no token is
801
+ injected and the URL is not rewritten. `--dir` defaults to the repository's
802
+ name and must not exist or be empty; `--branch` checks out something other than
803
+ the default branch. A workspace that lives in a subdirectory of its repository
804
+ (`repo_subdir`) is opened at that subdirectory.
805
+
806
+ `--open code` runs `code <path>` (the default when `code` is on PATH),
807
+ `--open cursor` runs `cursor <path>`, `--open none` launches nothing. **An
808
+ editor is only launched from an interactive terminal**: in a pipe, a CI job or
809
+ an agent's shell the command is printed instead, whatever `--open` says.
810
+
811
+ It ends with three lines on stdout: the path to open, `push to <default branch>
812
+ to compile and deploy`, and how to preview a branch first (`oxyc preview
813
+ create <branch> --workspace <id> --wait`, staff only; see [Workspace
814
+ previews](#workspace-previews)).
815
+
816
+ Exit codes: `5` the workspace has no repository (connect one in its Settings) or
817
+ does not exist, `6` `git clone` failed (git's own message is printed above it),
818
+ `8` the target directory is not empty, `2` a bad flag.
819
+
820
+ ## Standing a customer up
821
+
822
+ Ten steps across three credentials. `bootstrap` is the runbook plus the part of
823
+ it `oxyc` can do; the whole sequence, with what each step is and how it fails,
824
+ is [`internal-docs/customer-bootstrap.md`](../../internal-docs/customer-bootstrap.md).
825
+
826
+ ```bash
827
+ oxyc bootstrap plan <customer> [--crews] # the sequence; reads nothing, writes nothing
828
+ oxyc bootstrap run <customer> --owner <email> # do what oxyc can, print the rest
829
+ oxyc bootstrap verify <customer> [--json] # did every step land?
830
+ ```
831
+
832
+ Shared flags: `--name <display>`, `--repo <owner/repo>`, `--app <slug>`,
833
+ `--writer app:<slug>|pipeline:<source>` (repeatable), `--crews`,
834
+ `--phase <id>` (repeatable). `run` also takes `--owner`, `--dry-run` and
835
+ `--yes`.
836
+
837
+ The phases are `repo`, `org`, `billing`, `oltp`, `git-link`, `workspace`,
838
+ `airhouse`, `app`, `secrets` and — with `--crews` — `frontline`.
839
+
840
+ **`run` is safe to re-run**, which is the point: a half-finished standup is the
841
+ common case. It reads each phase before it writes and writes only what is
842
+ missing. It performs exactly two things — creating the org
843
+ (`POST /api/admin/orgs`) and provisioning or reconciling the workspace's
844
+ Airhouse tenant — and prints a checklist for everything else. It never
845
+ provisions the OLTP store (a billable project at a paid provider), never
846
+ provisions a subscription (Global Owner only), never sets a secret's value and
847
+ never enrols a worker.
848
+
849
+ **It works one surface at a time.** `/api/admin` is refused while an
850
+ `oxyc assume` session is live, and the GitHub import that gives a workspace its
851
+ remote is an org-scoped route — so a standup crosses between staff and tenant
852
+ credentials twice. `plan` prints the stage boundaries; `run` refuses rather than
853
+ half-writing when an assume session is open.
854
+
855
+ **Exit codes:** `0` every phase looked at has landed, `9` one has not (as
856
+ `checks run` means it), `8` refused because an assume session is live, `2` the
857
+ invocation was wrong — checked before any request.
858
+
859
+ ```bash
860
+ oxyc bootstrap verify poke-house --env dev --json \
861
+ | jq -r '.phases[] | select(.landed=="no") | "\(.id)\t\(.next)"'
862
+ ```
863
+
574
864
  ## Custom apps
575
865
 
576
866
  ```bash
@@ -578,7 +868,7 @@ oxyc publish [--env <e>] [--dir <path>] [--promote] [--build-only | --prebuilt]
578
868
  oxyc promote <app> [--from staging|dev-<handle>] [--build <id>] [--remove-schedule <fn>]… [--dry-run] [--yes] [--json]
579
869
  oxyc rollback <app> --app-env staging|production [--to <build>] [--remove-schedule <fn>]… [--dry-run] [--yes] [--json]
580
870
  oxyc init-ci [--app <org>/<app>] [--environment <name>] [--promote] [--force] [--no-register] [--setup-action]
581
- oxyc proxy [--port <n>] [--allow-writes] [--allow-events] [--yes]
871
+ oxyc proxy [--app <org>/<app> --app-env staging|dev-<handle>] [--port <n>] [--allow-writes] [--allow-events] [--yes]
582
872
  ```
583
873
 
584
874
  **`publish`**, from an app directory, runs `oxy-app.json`'s build (default
@@ -903,8 +1193,12 @@ credential, as an anonymous visitor's would. The result is one more entry in `ch
903
1193
  the `/fn` calls the page made. Playwright is not a dependency: it is resolved
904
1194
  from the working directory (`playwright`, `playwright-core` or
905
1195
  `@playwright/test`), so run it where one is installed. The page loads as a
906
- user, so a publish, service-account, CI or sandbox agent token is refused
907
- before any request.
1196
+ user, so a publish, service-account or CI token is refused before any
1197
+ request. A **sandbox agent token** is the exception, in its own sandbox: the
1198
+ server lets it load that sandbox's page on this path URL, with the bearer and
1199
+ `X-Oxy-App-Env: dev-<handle>` and no cookie. It still needs `--app-env
1200
+ dev-<handle>`. `oxy_checks_run` takes the same two options as `browser` and
1201
+ `expectSelector`, and returns the same document.
908
1202
 
909
1203
  ```bash
910
1204
  oxyc checks run acme/store --app-env dev-a1 --browser --expect-selector 'main'
@@ -978,9 +1272,14 @@ predates trusted checks.
978
1272
  ## Sandboxes
979
1273
 
980
1274
  ```bash
981
- oxyc env create <app> <name> # name is dev-<handle>, 1-12 chars a-z0-9-
1275
+ oxyc env create <app> <name> [--from <env>] [--at <ts>] [--preset light|full] [--plane <key>=<mode> …] [--destination <db>=<mapped> …] [--fetch-host <host> …]
1276
+ # name is dev-<handle>, 1-12 chars a-z0-9-
982
1277
  oxyc env list <app>
983
1278
  oxyc env show <app> <name>
1279
+ oxyc env update <app> <name> --plane <key>=<mode> … [--destination <db>=<mapped> …] [--clear-destination <db> …] [--fetch-host <host> …] [--replace] # key=default clears a key
1280
+ oxyc env reset <app> <name> --plane <key>[,<key>…] [--at <ts>] # oltp, airhouse, storage, secrets, messages; --at: oltp branch, from production as of <ts>
1281
+ oxyc env diff <app> <name> [--plane oltp] [--json] # a branch sandbox's OLTP schema against production
1282
+ oxyc env outbox <app> <name> [--limit <n>] [--json] # email and notifications a `capture` environment kept
984
1283
  oxyc env delete <app> <name> [--yes] [--wait [seconds]]
985
1284
  oxyc env schedules <app> <name> [--on|--off] # staging's or a sandbox's switch; off by default
986
1285
 
@@ -1000,6 +1299,62 @@ oxyc env secret set <app> <key> --app-env <name> (--value <text> | --value-env <
1000
1299
  oxyc env secret delete <app> <key> --app-env <name>
1001
1300
  ```
1002
1301
 
1302
+ **`env create --from/--at/--preset/--plane`** branches a sandbox from production,
1303
+ staging or another sandbox, optionally as of a past time, with each plane's
1304
+ mode set (`--plane` repeats; it wins over `--preset`). With `--from`, the
1305
+ sandbox starts on the parent's build and that build's migrations are queued for
1306
+ it (a parent with no build gives a sandbox with none). You may fork only from an
1307
+ environment you may open, so a sandbox agent token can fork only from a sandbox
1308
+ it created, or from staging when it was minted with the staging option: `--from production`
1309
+ (and `--from staging` without that option) is `400 invalid_parent` for it.
1310
+ Plane keys and modes: `oltp` (`schema`, `branch`, `empty`), `airhouse`
1311
+ (`write-only`, `branch`, `snapshot`), `storage` (`branch`, `empty`), `secrets` (`inherit`,
1312
+ `empty`), `messages` (`invoker`, `capture`), `fetch` (`held-writes`, `allow`
1313
+ with `--fetch-host`), `workspace-actions` (`held`, `refused`). `--preset full` is
1314
+ `oltp=branch`, `secrets=empty`, `messages=capture` and `airhouse=branch`. **`env update`** reads
1315
+ the environment's `planes_set`, merges the flags into it (`--plane a=default`
1316
+ removes `a`) and PUTs the whole object; `--replace` sends exactly the flags.
1317
+ Staging can be updated too; production has no planes (`409
1318
+ production_has_no_planes`). **`--destination <db>=<mapped>`** makes this
1319
+ environment write `<mapped>` instead of production's `<db>` over the build's
1320
+ `nonProduction.destinations`, key by key; repeat it, and `env update` keeps the
1321
+ ones it is not told about. **`--clear-destination <db>`** removes one (an empty
1322
+ `--destination` value is a usage error). The mapped name is checked as at
1323
+ publish (`400 invalid_planes`). **`--fetch-host <host>`** (repeatable) sets
1324
+ the `fetch` plane to `allow` for exactly these registered provider sandboxes
1325
+ (`{"mode": "allow", "hosts": [...]}`), so mutating `ctx.fetch` calls to them are
1326
+ sent and listed as `(sent)` in `invocations held`; the list replaces the stored
1327
+ one, a host that is not a registered sandbox is `400 invalid_planes`, and
1328
+ `--plane fetch=default` turns it off. A bare `--plane fetch=allow` keeps the
1329
+ stored list, and with none stored is a usage error. **`env reset`** puts the
1330
+ named planes back to a clean copy of the parent's and prints each one's `done` /
1331
+ `queued` (with its `run_id`): it empties `storage`, `secrets` and `messages`,
1332
+ empties Airhouse's overlay, and re-cuts an `oltp=branch|empty` sandbox's own
1333
+ OLTP branch from production as a queued run (`--at <ts>` cuts it as of that
1334
+ time). On staging only `messages` resets (`409 plane_not_resettable` for the
1335
+ others, which the team shares); a held lock is `409 environment_busy`. **`env
1336
+ outbox`** lists what a `messages: capture` environment rendered and did not
1337
+ send, newest first (`--limit`, default 50, at most 200; `--json` prints
1338
+ `{messages, has_more}`; over MCP, `oxy_env_outbox`). A sandbox agent token sees
1339
+ only messages captured since its sandbox began. A sandbox agent token may
1340
+ update, reset or read the outbox of only a `dev-<handle>` sandbox it created.
1341
+ `env show` prints the explicitly set planes as `set:`. **`env diff`** lists the
1342
+ tables and columns a sandbox on its own OLTP branch (`oltp=branch|empty`) has
1343
+ added (`+`), removed (`-`) or changed (`~`) against production's; a sandbox
1344
+ without one has nothing to show, and a branch not yet cut or migrated is
1345
+ `409 oltp_branch_unready` with the fix in its message.
1346
+
1347
+ Two plane modes name more than a keyword. **`--plane semantic=branch:<git branch>`**
1348
+ pins the environment's semantic model to that branch of the app's workspace: the
1349
+ server checks the branch exists (`400 invalid_planes` naming it otherwise),
1350
+ compiles its head as a staging revision, and moves the pin when a later push to
1351
+ the branch compiles. The environment answers `503 semantic_branch_not_ready`
1352
+ until the first compile lands. `--plane semantic=default` (or `build-pin`)
1353
+ returns to the build's own pin and clears the environment's. **`--plane
1354
+ workspace-actions=preview`** runs an automation the app starts as a workspace
1355
+ preview dry run on the environment's semantic pin (else production's revision) instead of holding or refusing it;
1356
+ `--preset full` sets it.
1357
+
1003
1358
  `logs --follow` is the live tail: each line as a function prints it,
1004
1359
  wherever the function runs, with no observability capture needed (the polled
1005
1360
  `logs` reads ClickHouse and answers `501` without it). `--json` prints one
@@ -1026,6 +1381,12 @@ staging's tables (rows up to a size cap), then the build's OLTP migrations.
1026
1381
  `structure_only` lists the tables copied empty. Until it is `ready` a
1027
1382
  `ctx.oltp` call in the sandbox is refused with a message that says which.
1028
1383
 
1384
+ `env show` also prints one line with the environment's parent and each plane's
1385
+ mode (`from staging · build=own semantic=build-pin … workspace-actions=refused`).
1386
+ Those are today's behaviour for every environment, reported, not yet
1387
+ configurable; `--json` carries them as `parent`, `fork_at`, `planes` and
1388
+ `planes_error`.
1389
+
1029
1390
  The loop: `env create` → `publish --app-env` → `fn call` / `checks run
1030
1391
  --app-env` → `invocations list` / `held` to read back what ran → iterate from
1031
1392
  `publish` → `env delete --yes --wait` when done. `oxyc guide` has the same six
@@ -1188,9 +1549,8 @@ generated from the Rust config types. No network, no token.
1188
1549
  | File | Schema |
1189
1550
  | --- | --- |
1190
1551
  | `config.yml` / `config.yaml` | `config.json` |
1191
- | `*.automation.yml`, `*.procedure.yml`, `*.workflow.yml` | `workflow.json` |
1552
+ | `*.automation.yml`, `*.procedure.yml` (`*.workflow.yml` is not a recognised kind; `oxy migrate-automations` renames it) | `workflow.json` |
1192
1553
  | `*.agentic.yml` | `agentic.json` |
1193
- | `*.app.yml` | `app.json` |
1194
1554
  | `*.agent.test.yml` | `agent-test.json` |
1195
1555
 
1196
1556
  Structural checks only. `oxy validate` additionally resolves `databases:` and
@@ -1249,12 +1609,41 @@ production target (any host under `oxygen-hq.com`) is refused without `--yes`.
1249
1609
  Each Oxy Function call carries a W3C trace — the SDK's, or one minted here — and
1250
1610
  prints `↳ <status> fn <name> request_id=… trace_id=…`.
1251
1611
 
1612
+ `--app <org>/<app> --app-env <name>` also opens the app's own page in a
1613
+ non-production environment. Requests under `/customer-apps/<org>/<app>/` — the
1614
+ document, its assets, the beacon and `/fn` calls — are sent with
1615
+ `X-Oxy-App-Env: <name>` and **without the browser's cookie, `Origin` or
1616
+ `Referer`** (the server answers `400` to an environment beside a cookie, and
1617
+ its origin gate would refuse a loopback page at a cloud host; the token is the
1618
+ credential). Because the browser's origin no longer reaches the server, the
1619
+ proxy asks the origin gate's question itself: a request under the base must
1620
+ arrive at a loopback `Host`, and an `Origin` or `Referer` it sends must be a
1621
+ loopback page, and a browser request marked `Sec-Fetch-Site: cross-site` never passes, or it is refused `403 origin_not_local` before the token is
1622
+ added — another site open in the same browser cannot act with it. Every
1623
+ other path is forwarded as before. On start the proxy prints
1624
+ `open http://127.0.0.1:<port>/customer-apps/<org>/<app>/ — dev-x of <org>/<app> on <target>`.
1625
+ The name is `staging` or a `dev-<handle>` sandbox; `--app-env` alone is exit `2`,
1626
+ and so is `--app-env production` (reads already hit production — leave it out).
1627
+ In a **`dev-<handle>` sandbox** the app's own side-effecting calls are forwarded
1628
+ without `--allow-writes`, since a sandbox's writes land in its own homes or are
1629
+ held server-side; the hold applies to everything else, and to staging, as
1630
+ before. Events are still dropped. For the same reason a sandbox proxy needs no
1631
+ `--yes` against the product host; staging, or a sandbox with `--allow-writes`,
1632
+ still does.
1633
+
1634
+ A **sandbox agent token** must pass `--app <org>/<app> --app-env dev-<handle>`
1635
+ (exit `2` otherwise): everything else it could proxy, the server refuses.
1636
+
1637
+ ```bash
1638
+ oxyc proxy --app acme/store --app-env dev-a1 # then open the printed URL
1639
+ ```
1640
+
1252
1641
  **`mcp`** serves the API over stdio as four generic tools — `oxy_routes`,
1253
1642
  `oxy_schema`, `oxy_request`, `oxy_whoami` — rather than one per endpoint, so
1254
1643
  those schemas cost ~2 KB per turn and reach endpoints added after this
1255
1644
  package shipped. Two named exceptions trade that minimalism for validation an
1256
1645
  agent needs to drive a loop unsupervised: the **sandbox loop**
1257
- (`oxy_env_create`/`list`/`show`/`delete`, `oxy_publish_sandbox`,
1646
+ (`oxy_env_create`/`list`/`show`/`update`/`reset`/`outbox`/`delete`, `oxy_publish_sandbox`,
1258
1647
  `oxy_fn_call`, `oxy_checks_run`, `oxy_invocations_list`/`held`, `oxy_logs`)
1259
1648
  and **workspace previews** (`oxy_preview_create`/`list`/`show`/`delete`/
1260
1649
  `checks`/`run`/`runs_list`/`run_show`). Each tool calls its CLI verb's own
@@ -1280,7 +1669,7 @@ claude mcp add oxyc -- npx -y @oxy-hq/cli mcp --login --env production
1280
1669
  ```
1281
1670
 
1282
1671
  **A sandbox agent token (`oxy_sbx_…`) is served a different, smaller list**:
1283
- the ten sandbox-loop tools, `oxy_whoami` (the token's `kind`, `expires_at`,
1672
+ the fourteen sandbox-loop tools, `oxy_whoami` (the token's `kind`, `expires_at`,
1284
1673
  `apps` and `minter`), and four that exist only for it — `oxy_env_secret_list`,
1285
1674
  `oxy_env_secret_set` and `oxy_env_secret_delete`, which accept only a
1286
1675
  `dev-<handle>` `appEnv`, and `oxy_token_revoke`, which needs `confirm: true`.
@@ -1340,6 +1729,7 @@ its own token (`tokens create --agent` or `--sandbox-agent`) does not: there,
1340
1729
  | `OXYC_DIFF_LINES` | — | cap on diff lines printed by `update` |
1341
1730
  | `OXYC_DEBUG` | — | `1` keeps the stack on an unexpected throw |
1342
1731
  | `OXYC_QUIET` | — | `1` is `--quiet` |
1732
+ | `OXYC_POLL_MS` | `3000` | how often `experiments price --wait` polls |
1343
1733
  | `OXYC_DRY_RUN` | — | `1` makes `launch` print the command instead of running it |
1344
1734
  | `NO_COLOR` / `FORCE_COLOR` | — | force plain / coloured output |
1345
1735
  | `HTTPS_PROXY` / `HTTP_PROXY` | — | requests go through it. On Node 22.21+ and 24.5+, `oxyc` turns on Node's proxy support itself (`NODE_USE_ENV_PROXY`), re-running once if it has to. Older Node cannot proxy `fetch`, and the error says so |