@oxy-hq/cli 0.10.0 → 0.12.0
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.
- package/README.md +406 -16
- package/dist/main.mjs +8126 -3270
- package/dist/main.mjs.map +1 -1
- package/dist/{mcp-B2KBWNOU.mjs → mcp-WxYfGpMF.mjs} +149 -13
- package/dist/mcp-WxYfGpMF.mjs.map +1 -0
- package/json-schemas/config.json +26 -45
- package/json-schemas/workflow.json +0 -17
- package/package.json +3 -2
- package/skills/oxy-agents/SKILL.md +15 -4
- package/skills/oxy-agents/references/quick-reference.md +1 -1
- package/skills/oxy-automations/SKILL.md +1 -1
- package/skills/oxy-cli/SKILL.md +49 -2
- package/skills/oxy-custom-apps/SKILL.md +223 -13
- package/skills/oxy-custom-apps/references/environment-branches.md +172 -0
- package/skills/oxy-custom-apps/references/phone-layout.md +88 -0
- package/skills/oxy-custom-apps/references/reading-data.md +4 -6
- package/skills/oxy-custom-apps/references/sandbox-agent-loop.md +120 -17
- package/skills/oxy-custom-apps/references/verifying-in-the-browser.md +19 -9
- package/skills/oxy-evals/SKILL.md +1 -1
- package/skills/oxy-experiments/SKILL.md +245 -0
- package/skills/oxy-semantic-modeling/SKILL.md +2 -2
- package/template/.github/workflows/publish.yaml +1 -1
- package/dist/mcp-B2KBWNOU.mjs.map +0 -1
- package/json-schemas/app.json +0 -1884
- package/skills/oxy-data-apps/SKILL.md +0 -362
- package/skills/oxy-data-apps/references/examples.md +0 -263
- package/skills/oxy-data-apps/references/quick-reference.md +0 -171
- package/skills/oxy-data-apps/templates/dashboard-with-controls.app.yml +0 -128
- package/skills/oxy-data-apps/templates/simple-dashboard.app.yml +0 -102
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy-hq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "oxyc — the Oxy CLI: a gh-api-style client for the Oxy HTTP API, plus the customer-account tooling that scopes a session to one customer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@clack/prompts": "^1.8.1",
|
|
48
|
-
"@modelcontextprotocol/sdk": "^1.32.
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
49
49
|
"ajv": "^8.20.0",
|
|
50
50
|
"ajv-formats": "^3.0.1",
|
|
51
51
|
"commander": "^15.0.0",
|
|
52
|
+
"jq-wasm": "3.0.0-jq-1.8.2",
|
|
52
53
|
"picocolors": "^1.1.1",
|
|
53
54
|
"yaml": "^2.9.1",
|
|
54
55
|
"zod": "^4.6.7"
|
|
@@ -24,10 +24,22 @@ the pipeline. You do not define its states or its tools.
|
|
|
24
24
|
- **`.agentic.yml` is the agent.** The classic `.agent.yml` format (a single
|
|
25
25
|
LLM call with custom tools) has been removed. Do not create one, and do not
|
|
26
26
|
copy one from an old workspace.
|
|
27
|
+
- **Translating a workspace's classic agents: `oxy migrate-agents`.** Run it when a
|
|
28
|
+
compile warns `classic agent format (.agent.yml) is retired` (or, on a
|
|
29
|
+
deployment that has turned the refusal on, fails the revision with that message),
|
|
30
|
+
or when an automation's `agent_ref` still names a `.agent.yml`. Run
|
|
31
|
+
`oxy migrate-agents --dry-run --json <dir>` first: it writes nothing and lists
|
|
32
|
+
every classic file, what translates (and which fields it drops, such as
|
|
33
|
+
`tools: visualize` or inline `tests:`), what `cannot be mapped` (`omni_query`,
|
|
34
|
+
`anonymize`, `type: routing`; such files stay in place unless `--force` drops
|
|
35
|
+
the field), the `agent_ref`s and paths it would repoint, and collisions. Then run
|
|
36
|
+
it without `--dry-run`, and review each new file: classic `system_instructions`
|
|
37
|
+
Jinja (`{{ databases.x.dialect }}`) is passed to the model literally, and a
|
|
38
|
+
classic `name:` is dropped, so the agent's id becomes its file stem.
|
|
27
39
|
- **There is no `kind:` field.** Every `.agentic.yml` runs the same analytics
|
|
28
40
|
pipeline. A file named `app_builder.agentic.yml` is not special. Generating
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
views or agent files is the in-product **Builder Agent** (chat Build mode),
|
|
42
|
+
and no `.agentic.yml` configures it.
|
|
31
43
|
- **Automations are a different file.** Deterministic multi-step work is an
|
|
32
44
|
automation, `.automation.yml` (`.procedure.yml` still works). `.workflow.yml`
|
|
33
45
|
is no longer recognised at all. An agent can *run* an automation it finds in
|
|
@@ -275,8 +287,7 @@ oxy test agents/sales.agentic.test.yml # LLM-judged evals
|
|
|
275
287
|
usefully resumed from the CLI, because `oxy agentic answer` only marks the
|
|
276
288
|
run as running and does not deliver the text. Ask a more specific question,
|
|
277
289
|
or continue in the app.
|
|
278
|
-
- **`oxy build` does not check agents.** It
|
|
279
|
-
integrations.
|
|
290
|
+
- **`oxy build` does not check agents.** It does nothing any more.
|
|
280
291
|
- **`oxy test`** runs `.test.yml` evals against an agent and scores each case
|
|
281
292
|
with an LLM judge. The format and flags are in
|
|
282
293
|
[references/quick-reference.md](references/quick-reference.md).
|
|
@@ -184,7 +184,7 @@ or the engine is unreachable at run start, the run fails.
|
|
|
184
184
|
| `oxy validate --file <path>` | parses with the runtime's own parser. Structural only, with the same blind spots |
|
|
185
185
|
| `oxy agentic run <path> -q "<question>"` | the real build and run, streamed by state. `--json`, `--thinking-mode extended_thinking`. Needs Oxy's Postgres (`OXY_DATABASE_URL`) |
|
|
186
186
|
| `oxy test [<file>.test.yml]` | LLM-judged evals; with no file, every `*.test.yml` in the workspace |
|
|
187
|
-
| `oxy build` | not an agent check: it
|
|
187
|
+
| `oxy build` | not an agent check: it does nothing any more |
|
|
188
188
|
|
|
189
189
|
## `.test.yml` (evals)
|
|
190
190
|
|
|
@@ -100,7 +100,7 @@ Routes follow the same split: `/automations/:id` is canonical;
|
|
|
100
100
|
|
|
101
101
|
Check whether the work belongs in an automation at all. Scheduled data movement
|
|
102
102
|
is usually an Airway pipeline (`.airway.yml`); a question answered from the
|
|
103
|
-
semantic model is usually an agent
|
|
103
|
+
semantic model is usually an agent. Automations are for
|
|
104
104
|
multi-step orchestration you want to run on a schedule or trigger.
|
|
105
105
|
|
|
106
106
|
**But "usually a pipeline" is not "never an automation".** A `type: airway`
|
package/skills/oxy-cli/SKILL.md
CHANGED
|
@@ -57,6 +57,7 @@ never sent to the server as a literal.
|
|
|
57
57
|
|
|
58
58
|
- `--jq '<expr>'` on the server-side shape, **always**, before you look at a
|
|
59
59
|
large response. Dumping a full thread list into context is the common waste.
|
|
60
|
+
It needs no `jq` on PATH (oxyc embeds jq), so use it in CI and cloud VMs too.
|
|
60
61
|
- `--md` turns an array of objects into a markdown table — far fewer tokens
|
|
61
62
|
than the same rows as JSON, which repeats every field name per row.
|
|
62
63
|
- `--cache 5m` when you are walking the same endpoints repeatedly.
|
|
@@ -68,13 +69,26 @@ never sent to the server as a literal.
|
|
|
68
69
|
|
|
69
70
|
oxyc validate # check the workspace YAML — no network, no token
|
|
70
71
|
oxyc proxy --env dev # local app dev against cloud data
|
|
72
|
+
oxyc experiments list # experiments: draft, price, register, status, interim, abort, result
|
|
73
|
+
oxyc flags list # feature flags: kill switch, per-org overrides, A/B splits (staff)
|
|
71
74
|
oxyc login-link --next /ide # one-time URL that signs a browser in as your token
|
|
75
|
+
oxyc workspace clone <id> # clone the workspace's repository to edit locally; push to deploy
|
|
72
76
|
oxyc guide # this page, to paste into a context file
|
|
73
77
|
|
|
78
|
+
`oxyc workspace clone <workspace-id>` is how you change a workspace: authoring
|
|
79
|
+
happens in its repository, not in the product. It runs your own `git clone` (no
|
|
80
|
+
token injected), prints the path of the workspace folder (the repository's
|
|
81
|
+
subdirectory when the workspace lives in one), and opens it in VS Code or Cursor
|
|
82
|
+
only from an interactive terminal (`--open code|cursor|none`; an agent gets the
|
|
83
|
+
command printed instead). Edit, commit, push: **a push to the default branch
|
|
84
|
+
compiles and deploys**; to try a branch first, `oxyc preview create <branch>
|
|
85
|
+
--workspace <id> --wait` (staff). Exit `5` means the workspace has no repository
|
|
86
|
+
yet (connect one in Settings), `6` a failed `git clone`, `8` a non-empty `--dir`.
|
|
87
|
+
|
|
74
88
|
`oxyc validate` is the one command that works entirely offline. It checks
|
|
75
|
-
`config.yml`, `.automation.yml`, `.agentic.yml
|
|
89
|
+
`config.yml`, `.automation.yml`, `.agentic.yml` and
|
|
76
90
|
`.agent.test.yml` against the schemas the Rust config types generate. It is
|
|
77
|
-
STRUCTURAL only — `oxy validate` additionally checks an automation's
|
|
91
|
+
STRUCTURAL only — `oxy validate` additionally checks an automation's
|
|
78
92
|
`database:` names against `config.yml`, but it too is structural for
|
|
79
93
|
`.agentic.yml` (`databases:` and `llm.ref` are not resolved), so an agent both
|
|
80
94
|
accept can still fail at run time.
|
|
@@ -90,6 +104,26 @@ reads its credential from `OXY_TOKEN` only — with the variable unset it exits
|
|
|
90
104
|
`4` rather than using the machine's `oxyc login`; `oxyc mcp --login` opts
|
|
91
105
|
into that. The same holds for any command given `--token-env <VAR>`.
|
|
92
106
|
|
|
107
|
+
## Feature flags (staff)
|
|
108
|
+
|
|
109
|
+
Use `oxyc flags` to turn an Oxy product change on for named orgs, run an A/B split, or
|
|
110
|
+
see what a flag serves an org — instead of the admin page or hand-written PATCHes.
|
|
111
|
+
Flags are declared in code; you change the kill switch and the targeting rules, never
|
|
112
|
+
create a flag. **Every write is prod-affecting** (`--env` defaults to production) and
|
|
113
|
+
asks first; pass `--yes` when there is no terminal, after `--dry-run` shows the rules.
|
|
114
|
+
|
|
115
|
+
oxyc flags list | show <key> # read: rules, unit, scope
|
|
116
|
+
oxyc flags eval --org acme [--user <uuid>] # preview what each flag serves them
|
|
117
|
+
oxyc flags set <key> --off --yes # kill switch: off = every org gets the first variant
|
|
118
|
+
oxyc flags rules <key> --set-org acme=treatment --yes # add one override, keep the rest
|
|
119
|
+
oxyc flags rules <key> --split control=50,treatment=50 --yes # percent, must total 100
|
|
120
|
+
oxyc flags rules <key> --file rules.json | --clear --yes
|
|
121
|
+
|
|
122
|
+
Orgs take a slug or UUID, users a UUID. Rules on a flag with `per_org: false` are refused
|
|
123
|
+
(422, exit 6), and rules saved behind an off kill switch do not apply until `set --on`.
|
|
124
|
+
Treat a running split as immutable. `oxyc flags org <org>` is what a member of that org
|
|
125
|
+
sees.
|
|
126
|
+
|
|
93
127
|
## An agent's own credential
|
|
94
128
|
|
|
95
129
|
If you are an agent, run on your own token — never on the person's
|
|
@@ -187,6 +221,19 @@ oxyc assume end # or --all
|
|
|
187
221
|
oxyc login --login-env dev,staging # log into several at once
|
|
188
222
|
```
|
|
189
223
|
|
|
224
|
+
**No browser on this machine** (a Claude Code remote session, SSH, a
|
|
225
|
+
Codespace): `oxyc login` notices and prints a URL and a code to open on any
|
|
226
|
+
device, like `gh auth login`. An agent asked to log a person in there cannot
|
|
227
|
+
show a URL from a command that is still waiting, so split it:
|
|
228
|
+
`oxyc login --env <env> --no-wait` prints the URL on stdout and exits — hand
|
|
229
|
+
it to the person — and once they say it is approved, `oxyc login --env <env>`
|
|
230
|
+
finishes. This is the person's login, run because they asked; it is still
|
|
231
|
+
never your own credential (see "An agent's own credential").
|
|
232
|
+
|
|
233
|
+
**In CI** nobody can approve, so `oxyc login` and `tokens create --agent` exit
|
|
234
|
+
`4` at once. Use `OXY_TOKEN` from a secret, or `--service-account` under GitHub
|
|
235
|
+
Actions OIDC. `-q` works there too: oxyc embeds jq when the runner has none.
|
|
236
|
+
|
|
190
237
|
The session hangs off your **account**, not this terminal — your browser is in
|
|
191
238
|
there too, and `end` gets you out of both.
|
|
192
239
|
|
|
@@ -12,8 +12,8 @@ description: >-
|
|
|
12
12
|
self-serve oxyc publish ship flow, dev-<handle> sandboxes and workspace
|
|
13
13
|
previews, how an AI agent gets its own short-lived credential (oxyc tokens
|
|
14
14
|
create --sandbox-agent or --agent, never the engineer's oxyc login), and
|
|
15
|
-
reading a deployment's live data with oxyc api and oxyc proxy (
|
|
16
|
-
|
|
15
|
+
reading a deployment's live data with oxyc api and oxyc proxy (the oxy binary
|
|
16
|
+
has no HTTP-API commands; every one of them is oxyc).
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Custom-app development
|
|
@@ -69,7 +69,7 @@ works), but hand-rolling means owning the base-path + dev-proxy wiring yourself.
|
|
|
69
69
|
Optional: `name` (display), `description`, `icon`, `art`, `status`
|
|
70
70
|
(launcher card), `projectId` (dev-time hint), `build` (what `oxyc
|
|
71
71
|
publish` runs — `install`, `command`, `outDir`; the plugin reads
|
|
72
|
-
`outDir` too), `functions`, `env`, `storage`, `notifications`, …
|
|
72
|
+
`outDir` too), `functions`, `env`, `storage`, `notifications`, `widgets`, …
|
|
73
73
|
|
|
74
74
|
**One contract.** The file is validated against the JSON Schema
|
|
75
75
|
`@oxy-hq/sdk` ships (`schema/oxy-app.schema.json`, generated from the
|
|
@@ -105,6 +105,7 @@ works), but hand-rolling means owning the base-path + dev-proxy wiring yourself.
|
|
|
105
105
|
| `useQuery({sql})` | `POST /api/projects/:id/query` | Raw SQL, 10k row cap |
|
|
106
106
|
| `useSemanticQuery({topic, …})` | `POST /api/projects/:id/semantic-query` | Reference topics/measures by name |
|
|
107
107
|
| `useAgentRun({agentId})` | `POST /api/projects/:id/agents/:id/asks` + SSE | Streaming chat / Q&A |
|
|
108
|
+
| `useAskAgent()` | `POST /api/projects/:id/agents/:id/asks` with `wait_seconds` | One-call answer (≤45 s) for a button or a batch; `status: "running"` when the wait runs out |
|
|
108
109
|
| `useProcedureRun({procedureId})` | `POST /api/projects/:id/procedures/:id/runs` ⚠️ beta | Long-running batch |
|
|
109
110
|
| `useFunction(name)` | `POST /customer-apps/<org>/<slug>/fn/<name>` + SSE | Invoke a server-side **Oxy Function** (see below) |
|
|
110
111
|
| `<OxyChat agentId="…"/>` | wraps `useAgentRun` | Drop-in chat UI |
|
|
@@ -119,6 +120,10 @@ works), but hand-rolling means owning the base-path + dev-proxy wiring yourself.
|
|
|
119
120
|
<OxyChat agentId="analytics" />
|
|
120
121
|
```
|
|
121
122
|
|
|
123
|
+
To try an agent from a terminal the same way: `oxyc ask <workspace-id> <agent>
|
|
124
|
+
"<question>" --json` (one request, answer on stdout; `--thread <id>` to reply
|
|
125
|
+
to a clarifying question).
|
|
126
|
+
|
|
122
127
|
See the `@oxy-hq/sdk` README for the full reference, including
|
|
123
128
|
`OxyApiError` parsing and beta-surface caveats.
|
|
124
129
|
|
|
@@ -277,8 +282,42 @@ by, so declare it with the first `ctx.notify`, not later:
|
|
|
277
282
|
undeclared function, a misspelt field and any `oxy.` kind — every problem at
|
|
278
283
|
once; a catalogue kind no function sends is a warning.
|
|
279
284
|
|
|
280
|
-
The
|
|
281
|
-
|
|
285
|
+
**The dock.** Wrap the app in `<OxyShell>` (every `create-oxy-app` template
|
|
286
|
+
does) so it shows Oxygen's rail: HQ, Chat and the viewer's other apps, each
|
|
287
|
+
opening in this tab and warmed on hover. Pass `hideTopBar` if the app draws its
|
|
288
|
+
own header. Link to another app with a plain `<a href>`, never `target="_blank"`;
|
|
289
|
+
moving between apps is meant to feel like one product.
|
|
290
|
+
|
|
291
|
+
**Motion.** `shell.css` loads `@oxy-hq/sdk/motion.css` (SDK ≥ 2.24), Oxygen's
|
|
292
|
+
own motion language, so shadcn dialogs, menus and tooltips already open and
|
|
293
|
+
close like Oxygen's. Time your own transitions with its tokens
|
|
294
|
+
(`var(--oxy-duration-fast)`, `var(--oxy-ease-out)`; the templates map them into
|
|
295
|
+
Tailwind's `@theme`) rather than inventing durations, keep them short (most
|
|
296
|
+
are 120–240 ms), and give every slide or zoom a `motion-reduce:` counterpart.
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
import { OxyShell } from "@oxy-hq/sdk/shell";
|
|
300
|
+
import "@oxy-hq/sdk/shell.css";
|
|
301
|
+
|
|
302
|
+
<OxyAppProvider>
|
|
303
|
+
<OxyShell hideTopBar>
|
|
304
|
+
<App />
|
|
305
|
+
</OxyShell>
|
|
306
|
+
</OxyAppProvider>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
A `pushState` before the person has touched the page (a default redirect,
|
|
310
|
+
filters written to the query string on mount) is turned into a replace by the
|
|
311
|
+
platform, so Back still leaves the app; write such URL syncs as replaces anyway. An app that pushes on
|
|
312
|
+
purpose before any interaction (a dialog route opened on load and closed with
|
|
313
|
+
`history.back()`, a kiosk's Back trap) adds
|
|
314
|
+
`<meta name="oxy-history" content="native">` to its `index.html`, and its pushes
|
|
315
|
+
are left alone.
|
|
316
|
+
`PhoneSheet` and the shell's drawer hold their own entries this way and need nothing
|
|
317
|
+
from the app.
|
|
318
|
+
|
|
319
|
+
The app is its own page, outside Oxygen's shell, so show the inbox **in the
|
|
320
|
+
app** — people who live in it (crew on a kiosk) never see Oxygen's bell:
|
|
282
321
|
|
|
283
322
|
```tsx
|
|
284
323
|
import { NotificationsBell } from "@oxy-hq/sdk";
|
|
@@ -299,6 +338,153 @@ Oxygen's Settings → Notifications — don't build them. In tests,
|
|
|
299
338
|
`createTestInbox({ manifest })` from `@oxy-hq/sdk/testing` is a fake inbox to pass as
|
|
300
339
|
`<OxyAppProvider fetcher={inbox.fetcher}>`.
|
|
301
340
|
|
|
341
|
+
## Home widgets (a live card on the Oxygen home)
|
|
342
|
+
|
|
343
|
+
A widget puts what needs doing in your app on the Oxygen home, with the button
|
|
344
|
+
that does it ("19 stores ready to post" and **Post 19 ready**). It is **data, not
|
|
345
|
+
a page**: a function of yours returns a small JSON view and the home draws it. The
|
|
346
|
+
function runs as the person looking, so app access and rate limits apply.
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
"widgets": {
|
|
350
|
+
"close": {
|
|
351
|
+
"title": "Month-end close", // ≤ 40 characters
|
|
352
|
+
"function": "close-widget", // declared under functions; returns the view
|
|
353
|
+
"size": "wide", // default size: "regular" (default), "wide" or "full"
|
|
354
|
+
"sizes": ["regular", "wide", "full"], // sizes a layout may pick; default [size]; must include size
|
|
355
|
+
"params": { "type": "object", "required": ["store"], "properties": { // settings per copy
|
|
356
|
+
"store": { "type": "string", "title": "Store", "description": "A store slug" } } },
|
|
357
|
+
"actions": {
|
|
358
|
+
"post-ready": { "function": "post-ready-jes", "confirm": true } // destructive: true for red
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
At most **6 widgets** per app and **3 actions** per widget; ids are lowercase
|
|
365
|
+
letters, digits, `-` and `_`. `params` is a flat JSON Schema: up to 8 properties, each
|
|
366
|
+
`string`, `integer`, `number` or `boolean` with optional `title`, `description`, `default`,
|
|
367
|
+
`enum`, `minimum`/`maximum` (numbers), `minLength`/`maxLength` (strings), plus `required`;
|
|
368
|
+
no nesting, no `$ref`. `oxyc validate` and `oxyc publish` refuse an unknown key, a bad id,
|
|
369
|
+
a bad `size`/`sizes` (`widget_size_invalid`), a bad `params` (`widget_params_invalid`) and an
|
|
370
|
+
undeclared `function`.
|
|
371
|
+
|
|
372
|
+
The function is called with `{ widget, size, params }` (`WidgetInput`; `size` is how wide
|
|
373
|
+
it is drawn, so say more when `wide` or `full`; `params` are this copy's settings with
|
|
374
|
+
defaults filled in, `{}` if it declares none) and returns a `WidgetView`:
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
import type { WidgetInput, WidgetView } from "@oxy-hq/sdk";
|
|
378
|
+
|
|
379
|
+
export default async (req, ctx) => {
|
|
380
|
+
const { widget, size, params } = JSON.parse(req.body || "{}") as WidgetInput; // params.store
|
|
381
|
+
const view: WidgetView = {
|
|
382
|
+
headline: "19 stores ready to post", // required, ≤ 80; none = "nothing to show"
|
|
383
|
+
detail: "September · 61 of 84 posted", // ≤ 120
|
|
384
|
+
level: "attention", // ok | info | attention | critical
|
|
385
|
+
progress: { done: 61, total: 84 },
|
|
386
|
+
metric: { value: "$48,210", label: "Posted", delta: "+12%", trend: "up", spark: [31, 35, 41, 48] },
|
|
387
|
+
rows: [{ title: "Valencia", detail: "Not mapped", state: "blocked" }], // ≤ 8
|
|
388
|
+
buttons: [{ // ≤ 2, each naming a declared action
|
|
389
|
+
action: "post-ready", label: "Post 19 ready", input: { period: "2026-09" },
|
|
390
|
+
key: "2026-09", confirm: "Post 19 journal entries to QuickBooks?"
|
|
391
|
+
}],
|
|
392
|
+
link: "/?month=2026-09", badge: 19, // "Open" (app-relative: / or ?), and a count
|
|
393
|
+
refresh_after: 300, // read again after N seconds (60–86400)
|
|
394
|
+
};
|
|
395
|
+
return Response.json(view);
|
|
396
|
+
};
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
A widget's kind is what its view carries: `metric` makes a **KPI card** (`value` ≤ 24,
|
|
400
|
+
`label` ≤ 40, `delta` ≤ 24, `trend` up/down/flat, `spark` ≤ 30 points), `progress` a
|
|
401
|
+
progress card, rows with buttons a to-do. Text and lists past their limits are cut, and a
|
|
402
|
+
non-app-relative link or a button naming an undeclared action is dropped.
|
|
403
|
+
|
|
404
|
+
**`level` decides the room a card gets.** Widgets live in the home's Today area (a rail
|
|
405
|
+
beside the apps on a wide screen, under them on a phone), one column wide. An `ok` or `info`
|
|
406
|
+
view with no button folds to one line (its headline) in an "All clear" list after every card
|
|
407
|
+
that needs someone; `attention` and `critical` keep the full card. So say all-is-well in the
|
|
408
|
+
headline alone, and raise the level when the rows matter. `progress` is always a ring beside
|
|
409
|
+
the headline holding `done/total`, so don't repeat the count in `detail`. A `regular` card
|
|
410
|
+
shows three rows, `wide` and `full` all of them: size is how much a card shows, not its width.
|
|
411
|
+
|
|
412
|
+
**Pressing a button** calls the action's function with `{ widget, action, input }` and
|
|
413
|
+
an `Idempotency-Key` built from widget, action and the button's `key` (none: a hash of
|
|
414
|
+
`input`), so a double click or stale card replays the first answer. **Give every button
|
|
415
|
+
a `key` that names the thing done** (`"2026-09"`), not a timestamp. The action's return
|
|
416
|
+
decides the card: `{ view }` re-renders, `{ message }` shows a line, anything else
|
|
417
|
+
re-reads the widget; a throw or non-2xx leaves it as it was, with the reason shown.
|
|
418
|
+
Widgets show **in production only**, on the apps-first home. One that should not run on every home load declares
|
|
419
|
+
`cache: { ttlSeconds }` on its function.
|
|
420
|
+
|
|
421
|
+
### Laying out the home
|
|
422
|
+
|
|
423
|
+
The org's home is one layout document, written by an org owner or admin (not by an
|
|
424
|
+
app): the widget groups of Today in order, and the widgets as `<app>/<widget>` at a size
|
|
425
|
+
from that widget's `sizes`. The apps always come first and are always drawn; `apps` and
|
|
426
|
+
`insights` entries are accepted but place nothing, and leaving `insights` out hides it. No coordinates; an edit is a list move. `widgets` sections may repeat,
|
|
427
|
+
each a group with an optional `title` (≤ 40); `others` goes on the first only. An item
|
|
428
|
+
may add `params`, a `title` and an `id`, so one widget can appear as several copies
|
|
429
|
+
(one per store), each with its own `id`.
|
|
430
|
+
|
|
431
|
+
**Who a widget is for.** A group or an item may add `for`:
|
|
432
|
+
`{ "people": ["scott@acme.com"], "teams": ["Office"] }` (emails, and org team names; at
|
|
433
|
+
least one list non-empty, at most 50 each, matched case-insensitively). Only those people
|
|
434
|
+
see it. It only narrows: app access applies first, and an item's `for` narrows its
|
|
435
|
+
group's. Use it when someone may open the app but its widget is noise to them ("show
|
|
436
|
+
Bookkeeping's cards only to Scott and Dylan"), rather than changing who can open the app.
|
|
437
|
+
Widgets the layout does not list stay everyone's. Each person can also hide a widget or
|
|
438
|
+
turn Today off on their own home; a layout cannot undo that.
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{ "version": 1, "sections": [
|
|
442
|
+
{ "kind": "apps" },
|
|
443
|
+
{ "kind": "widgets", "items": [ { "widget": "warehouse/receiving", "hidden": true } ],
|
|
444
|
+
"others": "show" },
|
|
445
|
+
{ "kind": "widgets", "title": "Back office",
|
|
446
|
+
"for": { "people": ["scott@acme.com", "dylan@acme.com"] },
|
|
447
|
+
"items": [ { "widget": "bookkeeping/close", "size": "full" } ] },
|
|
448
|
+
{ "kind": "widgets", "title": "Stores", "items": [
|
|
449
|
+
{ "widget": "store-ops/today", "id": "mission", "title": "Mission St",
|
|
450
|
+
"params": { "store": "mission" } } ] },
|
|
451
|
+
{ "kind": "insights" } ] }
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Get, edit, preview, then apply:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
oxyc home show --org acme # what a person sees: widgets, sizes, headlines
|
|
458
|
+
oxyc home get --org acme > layout.json # { revision, layout }: edit the layout
|
|
459
|
+
oxyc home apply --org acme -f layout.json --dry-run # resulting home as text, nothing saved
|
|
460
|
+
oxyc home apply --org acme -f layout.json # save (sends the file's revision)
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
A refused layout (exit 6) lists every problem as `path: message (fix)`; fix them all.
|
|
464
|
+
Exit 8 means someone saved since your `get`: `home get` again and redo the edit
|
|
465
|
+
(`--force` overwrites). `oxyc home reset` restores the default. A widget not listed
|
|
466
|
+
still shows after the first group's items unless `others` is `"hide"`, except one with a
|
|
467
|
+
required setting and no default: it needs an entry that sets `params`.
|
|
468
|
+
|
|
469
|
+
## Phone layout
|
|
470
|
+
|
|
471
|
+
People open these apps on their phones. A desktop layout squeezed into one column
|
|
472
|
+
is not a phone layout: tables scroll sideways, tabs get cut, the answer sits under a
|
|
473
|
+
map. Give each screen people use on a phone a **phone view** built from the phone
|
|
474
|
+
kit in `@oxy-hq/sdk/shell`, beside the desktop component, from the same hooks:
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
const phone = usePhoneLayout();
|
|
478
|
+
return phone ? <OrdersPhone {...data} /> : <OrdersDesktop {...data} />;
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The desktop layout stays exactly as it is. On the phone: a `PhoneTabBar` for
|
|
482
|
+
sections, the answer first (`PhoneKpiStrip`, "needs you" `PhoneRow`s), table rows
|
|
483
|
+
as `PhoneCard`s (**never a sideways-scrolling table**), details in a `PhoneSheet`,
|
|
484
|
+
maps as their own tab, `PhoneHint` instead of hover tooltips. The mapping from each
|
|
485
|
+
desktop part, the type and touch floor, and how to check it at 390×844 and 844×390:
|
|
486
|
+
[references/phone-layout.md](references/phone-layout.md).
|
|
487
|
+
|
|
302
488
|
## Four pitfalls
|
|
303
489
|
|
|
304
490
|
- **CORS errors are usually wrong-URL errors in disguise.** The SDK's
|
|
@@ -547,10 +733,10 @@ If a command fails with `fetch failed` (exit `7`) while `HTTPS_PROXY` is set,
|
|
|
547
733
|
|
|
548
734
|
A sandbox (`dev-<handle>`, 1-12 lowercase letters/digits/hyphens, no leading,
|
|
549
735
|
trailing or double hyphen) is a named, short-lived environment of one app: its
|
|
550
|
-
own build pointer, storage silo, secrets and Airhouse sibling schema.
|
|
551
|
-
hit production
|
|
552
|
-
|
|
553
|
-
|
|
736
|
+
own build pointer, storage silo, secrets and Airhouse sibling schema. By
|
|
737
|
+
default reads hit production and writes are isolated or *held* (recorded, not
|
|
738
|
+
performed: a held write's `note` in `invocations held` names what would make it
|
|
739
|
+
land). Each part can be isolated further: see **Branch it** below.
|
|
554
740
|
A sandbox's schedules are **off by default** (staging's too): staff turn them
|
|
555
741
|
on per environment with `oxyc env schedules <app> dev-x --on`, and a scheduled
|
|
556
742
|
fire is not activity. To test a scheduled function without that, run it once
|
|
@@ -576,6 +762,26 @@ oxyc logs acme/store --app-env dev-x --env dev --follow --timeout 300 --json #
|
|
|
576
762
|
oxyc env delete acme/store dev-x --env dev --yes --wait --json # done; tears its homes down
|
|
577
763
|
```
|
|
578
764
|
|
|
765
|
+
**Branch it: isolate exactly the parts you are testing.** A sandbox is a
|
|
766
|
+
branch of the app, with a parent (`--from`, for the build), a fork point
|
|
767
|
+
(`--at`, for production's data) and a mode per plane of app state. The defaults
|
|
768
|
+
keep the behaviour above. Turn on isolation only for what you are testing:
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
oxyc env create acme/store dev-x --from staging --preset full --env dev --json # most isolation in one flag
|
|
772
|
+
oxyc env update acme/store dev-x --plane oltp=branch --env dev # its own copy of production's rows
|
|
773
|
+
oxyc env update acme/store dev-x --fetch-host api.stripe.com --env dev # real writes to a provider sandbox
|
|
774
|
+
oxyc env outbox acme/store dev-x --env dev --json # what messages=capture kept
|
|
775
|
+
oxyc env reset acme/store dev-x --plane storage,secrets,messages --env dev # start those planes over
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
Which mode tests what, every plane and its modes, the `full` preset, reset,
|
|
779
|
+
expiry, the caps and each refusal with its fix are in
|
|
780
|
+
[references/environment-branches.md](references/environment-branches.md). Read
|
|
781
|
+
it before setting any plane. Three rules hold whatever you choose: production
|
|
782
|
+
has no planes; `oltp=branch|empty` and `airhouse=branch|snapshot` are
|
|
783
|
+
sandbox-only; `ctx.airway.run` is refused outside production.
|
|
784
|
+
|
|
579
785
|
(`--data` has no short form — don't write `-d`.)
|
|
580
786
|
|
|
581
787
|
Iterate from `publish` as the code changes — each publish is a new build, and
|
|
@@ -588,23 +794,27 @@ such staff approved; a publish token is refused on every sandbox operation,
|
|
|
588
794
|
so CI cannot use one.
|
|
589
795
|
|
|
590
796
|
**An agent runs this loop on its own sandbox agent token**, never a person's
|
|
591
|
-
login, with `--token-env OXY_TOKEN` on every command —
|
|
592
|
-
|
|
797
|
+
login, with `--token-env OXY_TOKEN` on every command — up to the page:
|
|
798
|
+
`checks run --browser` and `oxyc proxy --app <org>/<app> --app-env dev-x` let
|
|
799
|
+
it check what a person sees in its own sandbox. The loop at a glance, the
|
|
800
|
+
mint, exit codes, rules and what to hand back are in
|
|
593
801
|
[references/sandbox-agent-loop.md](references/sandbox-agent-loop.md). Read it
|
|
594
802
|
before an agent runs any `oxyc` command against a deployment.
|
|
595
803
|
|
|
596
804
|
**A sandbox isolates the app, not the workspace.** The semantic model,
|
|
597
805
|
automations and Airway pipelines it reads are `main`'s. To try a workspace
|
|
598
806
|
branch, open a workspace preview (staff only, `oxyc preview …`), or publish to
|
|
599
|
-
the sandbox with `--semantic-branch <branch
|
|
807
|
+
the sandbox with `--semantic-branch <branch>`, or set the planes above — see
|
|
600
808
|
[references/sandbox-agent-loop.md](references/sandbox-agent-loop.md#a-sandbox-isolates-the-app-not-the-workspace).
|
|
601
809
|
|
|
602
810
|
## Read next
|
|
603
811
|
|
|
604
812
|
| File | Read it when |
|
|
605
813
|
| --- | --- |
|
|
606
|
-
| [references/
|
|
814
|
+
| [references/environment-branches.md](references/environment-branches.md) | You want a sandbox to isolate more than the defaults: its own copy of production's OLTP rows, an Airhouse overlay or snapshot, captured email, empty secrets or storage, real writes to a provider sandbox, a semantic branch, or preview automation runs. Which mode tests what, reset, expiry and every refusal. |
|
|
815
|
+
| [references/sandbox-agent-loop.md](references/sandbox-agent-loop.md) | You are an AI agent about to touch a deployment: the loop at a glance, minting the sandbox agent token, checking the sandbox's page, exit codes, rules, what to hand back, when you cannot get a token, the MCP tools, workspace previews. |
|
|
607
816
|
| [references/verifying-in-the-browser.md](references/verifying-in-the-browser.md) | You changed something a person sees (`src/**`, or a function a card calls) and need to prove it on the published page. |
|
|
608
817
|
| [references/reading-data.md](references/reading-data.md) | You need a deployment's live data while building: an agent's own `--agent` token, `oxyc api` / `routes` / `schema`, and `oxyc proxy` for `pnpm dev` against cloud data. |
|
|
609
818
|
| [references/performance-and-usage.md](references/performance-and-usage.md) | You write an Oxy Function, a bulk action, caching or idempotency keys — or need to know what Oxy does for load speed and usage tracking, and the opt-outs. |
|
|
819
|
+
| [references/phone-layout.md](references/phone-layout.md) | A screen people open on a phone: when to build a phone view, the `usePhoneLayout()` pattern, what each desktop part becomes, and how to check it. |
|
|
610
820
|
| [references/minimal-starter.md](references/minimal-starter.md) | You are writing an app by hand instead of scaffolding it, or need the smallest correct layout. |
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Environment branches: test any part of an app on its own copy
|
|
2
|
+
|
|
3
|
+
A non-production environment (`staging`, or a `dev-<handle>` sandbox) is a
|
|
4
|
+
**branch** of the app, the way a database branch is. It has:
|
|
5
|
+
|
|
6
|
+
- a **parent**: the environment it was created `--from`. Only the build comes
|
|
7
|
+
from the parent. Data planes always fork from **production**, never from
|
|
8
|
+
another sandbox;
|
|
9
|
+
- a **fork point** (`--at`): the moment production's data is copied from;
|
|
10
|
+
- a **mode per plane**: for each part of the app's state, how isolated this
|
|
11
|
+
environment is.
|
|
12
|
+
|
|
13
|
+
The defaults keep a sandbox's old behaviour: reads hit production, and writes
|
|
14
|
+
are isolated or held. Turn on more isolation only for the parts you are testing.
|
|
15
|
+
|
|
16
|
+
Every command below takes the usual `--env <deployment>` (and `--token-env
|
|
17
|
+
OXY_TOKEN` for an agent; see [sandbox-agent-loop.md](sandbox-agent-loop.md)).
|
|
18
|
+
|
|
19
|
+
## Pick the modes by what you are testing
|
|
20
|
+
|
|
21
|
+
| You want to test | Use |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| A migration, or a function that edits records, against production's real rows | `--plane oltp=branch` (add `--at <ts>` for an exact moment) |
|
|
24
|
+
| A migration against production's structure with no rows | `--plane oltp=empty` |
|
|
25
|
+
| A function that appends Airhouse facts and reads them back | `--plane airhouse=branch` |
|
|
26
|
+
| A test that must see the same Airhouse rows every run | `--plane airhouse=snapshot` |
|
|
27
|
+
| What an email or notification would say, without sending it | `--plane messages=capture`, then `oxyc env outbox` |
|
|
28
|
+
| That the app works with none of staging's or production's secrets | `--plane secrets=empty`, then `env secret set` what it needs |
|
|
29
|
+
| That the app copes with no files yet | `--plane storage=empty` |
|
|
30
|
+
| A real write to a third-party **sandbox** account (Stripe test keys, a QuickBooks sandbox company, Square sandbox …) | `--fetch-host <host>` (repeatable; implies `fetch=allow`) |
|
|
31
|
+
| Writes to a warehouse database of the sandbox's own | `--destination <db>=<mapped>` |
|
|
32
|
+
| A semantic-model change on a git branch | `--plane semantic=branch:<branch>` |
|
|
33
|
+
| An automation the bundle starts, without its side effects | `--plane workspace-actions=preview` |
|
|
34
|
+
| As much isolation as has shipped, in one flag | `--preset full` |
|
|
35
|
+
|
|
36
|
+
Combine as many as you need. A choice you name always wins over the preset.
|
|
37
|
+
|
|
38
|
+
## The planes
|
|
39
|
+
|
|
40
|
+
| Plane (`key`) | Default | Other modes |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `build` | `own`: what you publish to it; `--from` starts it on the parent's build | — |
|
|
43
|
+
| `semantic` | `build-pin`: the model the build was published with | `branch:<b>`: the head of a workspace git branch, re-pinned on every push |
|
|
44
|
+
| `reads` (`ctx.query`, `ctx.warehouse.query`) | `live`: production, read-only | — (customer warehouses are never copied) |
|
|
45
|
+
| `oltp` (`ctx.oltp`) | `schema`: the app's schema in the org's shared staging branch | `branch`: its own database branch, production's tables **and rows** at the fork point · `empty`: its own branch, structure only |
|
|
46
|
+
| `airhouse` (`ctx.airhouse`) | `write-only`: writes go to a sibling schema, queries read production | `branch`: queries see the sandbox's own writes first, then production live · `snapshot`: the same, with the rest pinned to the fork point |
|
|
47
|
+
| `warehouse` (`ctx.warehouse` writes) | `mapped`: the manifest's `nonProduction.destinations` | per-environment overrides with `--destination` |
|
|
48
|
+
| `storage` (`ctx.storage`) | `branch`: its own files, and reads fall back to production's same key | `empty`: its own files only |
|
|
49
|
+
| `secrets` (`ctx.env`) | `inherit`: its own value, then staging's, then production's `shared` | `empty`: its own value only |
|
|
50
|
+
| `messages` (`ctx.email.send`, `ctx.notify`) | `invoker`: sent to the caller only, subject prefixed with the environment | `capture`: sent to nobody, kept in the outbox |
|
|
51
|
+
| `fetch` (mutating `ctx.fetch`) | `held-writes`: recorded, not sent | `allow` + a host list of registered provider sandboxes |
|
|
52
|
+
| `schedules` | `switch`: off until `oxyc env schedules <app> <env> --on` | — |
|
|
53
|
+
| `workspace-actions` (agent asks, automation runs) | `held` | `refused`: `403` · `preview`: an automation run executes as a held dry run |
|
|
54
|
+
|
|
55
|
+
`--preset full` sets `oltp=branch`, `secrets=empty`, `messages=capture`,
|
|
56
|
+
`airhouse=branch` and `workspace-actions=preview`. It never sets `fetch`
|
|
57
|
+
(opening third-party writes is a per-host decision) or `semantic` (a preset
|
|
58
|
+
cannot pick your branch). `storage` stays `branch`; add `--plane storage=empty`
|
|
59
|
+
too if you want it.
|
|
60
|
+
|
|
61
|
+
Fixed, whatever the modes:
|
|
62
|
+
|
|
63
|
+
- **Production has no planes.** No mode, preset or override writes to production.
|
|
64
|
+
- `ctx.airway.run` is refused in every non-production environment.
|
|
65
|
+
- `oltp=branch|empty` and `airhouse=branch|snapshot` are **sandbox-only**.
|
|
66
|
+
Staging refuses them, so `--preset full` on staging is refused.
|
|
67
|
+
- `oltp=branch|empty` needs an org with an OLTP database. Without one, pass
|
|
68
|
+
`--plane oltp=schema` with `--preset full`.
|
|
69
|
+
|
|
70
|
+
## The lifecycle
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Create: a branch of production's data, as of an hour ago, on staging's build
|
|
74
|
+
oxyc env create acme/store dev-x --from staging --at 2026-11-03T08:00:00Z --preset full --json
|
|
75
|
+
oxyc env show acme/store dev-x # the planes line: each mode, and where it came from
|
|
76
|
+
oxyc publish --app-env dev-x --json # or skip it: --from already gave it staging's build
|
|
77
|
+
|
|
78
|
+
# Change one plane later (=default clears it; --replace sends exactly these flags)
|
|
79
|
+
oxyc env update acme/store dev-x --plane storage=empty
|
|
80
|
+
oxyc env update acme/store dev-x --plane fetch=allow --fetch-host connect.squareupsandbox.com
|
|
81
|
+
|
|
82
|
+
# Read what it did
|
|
83
|
+
oxyc env outbox acme/store dev-x --json # what a capture environment kept
|
|
84
|
+
oxyc invocations held acme/store <invocation-id> # what a call held, or sent under fetch=allow
|
|
85
|
+
oxyc env diff acme/store dev-x --json # its OLTP schema against production's
|
|
86
|
+
|
|
87
|
+
# Start a plane over
|
|
88
|
+
oxyc env reset acme/store dev-x --plane storage,secrets,messages # each answers done
|
|
89
|
+
oxyc env reset acme/store dev-x --plane oltp --at <ts> # re-cuts: queued, poll env show
|
|
90
|
+
oxyc env reset acme/store dev-x --plane airhouse # drops its copies, re-pins to now
|
|
91
|
+
|
|
92
|
+
oxyc env delete acme/store dev-x --yes --wait # tears its branches down
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **`--at`** is not in the future and is within the last 24 hours (the
|
|
96
|
+
database's history window; Airhouse keeps snapshots one day too).
|
|
97
|
+
- **An OLTP branch is cut in the background.** `env show` reports
|
|
98
|
+
`oltp_branch.status`: `cutting`, `migrating`, `ready`, `resetting` or `failed`.
|
|
99
|
+
A reset that is queued but not started still reads `ready`, with
|
|
100
|
+
`oltp_branch.recut_queued: true`, so wait for that to be `false` too.
|
|
101
|
+
`ctx.oltp` is refused, with the reason, until it is `ready`. It is never
|
|
102
|
+
routed to staging or production in the meantime, so poll before the first call.
|
|
103
|
+
- **Reset** puts a plane back to a clean copy of its source. A sandbox resets
|
|
104
|
+
`oltp`, `airhouse`, `storage`, `secrets` and `messages`. Staging resets
|
|
105
|
+
`messages` only, because the team shares the rest. A sandbox on
|
|
106
|
+
`oltp=schema` has nothing to reset: publish again to re-seed it.
|
|
107
|
+
- **Expiry.** A sandbox is deleted after 7 idle days. One holding a copy of
|
|
108
|
+
production's rows (`oltp=branch`, or `airhouse=branch|snapshot`) is also
|
|
109
|
+
deleted 30 days after its fork point, however busy it is; `env show` gives
|
|
110
|
+
the day as `copies_expire_at`. `env reset` of that plane starts the 30 days
|
|
111
|
+
again, and so does turning such a plane on for a sandbox that held no copy.
|
|
112
|
+
Moving `airhouse` back to `write-only` keeps the rows it copied, still on the
|
|
113
|
+
same clock: `env reset --plane airhouse` drops them. `oltp=empty` holds no
|
|
114
|
+
rows and is not deleted for age.
|
|
115
|
+
- **Entering `airhouse=snapshot`** on an existing sandbox pins the snapshot to
|
|
116
|
+
that moment.
|
|
117
|
+
- **Limits.** 20 sandboxes per app. A per-org cap on OLTP branches (8 by
|
|
118
|
+
default): delete sandboxes you are done with.
|
|
119
|
+
|
|
120
|
+
## The two workspace planes
|
|
121
|
+
|
|
122
|
+
- **`semantic=branch:<b>`**:
|
|
123
|
+
- The branch must exist on the workspace's remote.
|
|
124
|
+
- The write compiles the branch head and pins the environment to it, and a
|
|
125
|
+
later push recompiles and moves the pin. Until a compile is ready, data
|
|
126
|
+
requests answer `503 semantic_branch_not_ready` and functions are refused.
|
|
127
|
+
Retry; never fall back to production's model. Repointing to another branch
|
|
128
|
+
is `503` until the new one compiles.
|
|
129
|
+
- If the deployment does not follow pushes, run the same command again to
|
|
130
|
+
re-pin to the head.
|
|
131
|
+
- `--plane semantic=default` returns to the build's own pin, and a build
|
|
132
|
+
published with `--semantic-branch` wins over the plane.
|
|
133
|
+
- `semantic=release:staging` does not exist yet. Don't promise it.
|
|
134
|
+
- **`workspace-actions=preview`**:
|
|
135
|
+
- An automation run the bundle starts executes as a held dry run: writes are
|
|
136
|
+
held, Airhouse writes go to an overlay shared by that environment's runs,
|
|
137
|
+
and `http_request` is GET-only.
|
|
138
|
+
- It answers `202 {run_id, mode: "preview"}`; poll it like any run.
|
|
139
|
+
- An agent ask the bundle starts is still held.
|
|
140
|
+
|
|
141
|
+
## When it refuses
|
|
142
|
+
|
|
143
|
+
| Answer | Means | Do |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| `400 invalid_planes` | the choice cannot be stored. The message says why: unknown plane or mode, a sandbox-only mode on staging, no OLTP database, the branch cap, `fetch=allow` with no host or an unregistered one, a semantic branch that does not exist, a warehouse override naming production | fix what it names |
|
|
146
|
+
| `400 invalid_parent` | `--from` names an environment you may not fork, or one that does not exist | fork from a sandbox you created (or staging, if your token allows it) |
|
|
147
|
+
| `409 plane_not_resettable` | nothing to reset there (`oltp=schema`, or a shared plane on staging) | publish again, or reset a sandbox instead |
|
|
148
|
+
| `409 environment_busy` | a teardown or migration holds it | retry |
|
|
149
|
+
| `409 oltp_branch_unready` | `env diff` before the branch is `ready`, or cut in the other mode | wait for `ready` |
|
|
150
|
+
| `503 semantic_branch_not_ready` (`Retry-After: 5`) | the branch is still compiling | retry. It is never answered from production's model |
|
|
151
|
+
| `409 preview_runs_disabled` | the deployment has preview runs off | report it. No live run happened |
|
|
152
|
+
| a host call inside the function answers `409` (held) | the write was recorded, not performed. The function itself still runs | read `oxyc invocations held`. The `note` names the mode or host that would let it through |
|
|
153
|
+
|
|
154
|
+
## A worked example: a payment flow, end to end
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
oxyc env create acme/store dev-pay --from staging --preset full --json
|
|
158
|
+
oxyc env update acme/store dev-pay --fetch-host connect.squareupsandbox.com
|
|
159
|
+
oxyc env secret set acme/store SQUARE_TOKEN --app-env dev-pay --value-env SQUARE_SANDBOX_TOKEN
|
|
160
|
+
oxyc fn call acme/store checkout --app-env dev-pay --data '{"cart":"c1"}' --json
|
|
161
|
+
oxyc invocations list acme/store --app-env dev-pay --function checkout --limit 1 --json
|
|
162
|
+
oxyc invocations held acme/store <id> --json # fetch POST connect.squareupsandbox.com/v2/payments → 200 (sent)
|
|
163
|
+
oxyc env outbox acme/store dev-pay --json # the receipt email it would have sent
|
|
164
|
+
oxyc env diff acme/store dev-pay --json # what its migration changed, before promoting
|
|
165
|
+
oxyc env delete acme/store dev-pay --yes --wait
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The order rows land in the sandbox's own copy of production's database, and
|
|
169
|
+
the Airhouse facts in its overlay. The receipt email is kept, not sent. The
|
|
170
|
+
Square call goes to Square's sandbox, using the sandbox's own token. Nothing
|
|
171
|
+
reaches production. To ship, a person runs `oxyc promote <app> --from dev-pay`
|
|
172
|
+
(the build becomes staging's), checks it there, then promotes to production.
|