@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.
- package/README.md +406 -16
- package/dist/main.mjs +6563 -8427
- package/dist/main.mjs.map +1 -1
- package/dist/{mcp-B2KBWNOU.mjs → mcp-CJWQm-yd.mjs} +147 -190
- package/dist/mcp-CJWQm-yd.mjs.map +1 -0
- package/json-schemas/config.json +26 -45
- package/json-schemas/workflow.json +0 -17
- package/package.json +6 -5
- 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 +91 -4
- package/skills/oxy-custom-apps/SKILL.md +233 -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
|
@@ -42,14 +42,6 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"definitions": {
|
|
45
|
-
"AppTaskMode": {
|
|
46
|
-
"description": "Where a task is executed when used inside an app with interactive controls. `client` (default) — the frontend re-runs the SQL directly in DuckDB WASM on every control change; no server round-trip required. `server` — the server executes the task on every control change (required for tasks that query external databases like Snowflake or BigQuery).",
|
|
47
|
-
"type": "string",
|
|
48
|
-
"enum": [
|
|
49
|
-
"client",
|
|
50
|
-
"server"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
45
|
"Condition": {
|
|
54
46
|
"type": "object",
|
|
55
47
|
"required": [
|
|
@@ -1820,15 +1812,6 @@
|
|
|
1820
1812
|
}
|
|
1821
1813
|
]
|
|
1822
1814
|
},
|
|
1823
|
-
"mode": {
|
|
1824
|
-
"description": "Execution mode when this task is used inside a data app. Defaults to `client`.",
|
|
1825
|
-
"default": "client",
|
|
1826
|
-
"allOf": [
|
|
1827
|
-
{
|
|
1828
|
-
"$ref": "#/definitions/AppTaskMode"
|
|
1829
|
-
}
|
|
1830
|
-
]
|
|
1831
|
-
},
|
|
1832
1815
|
"name": {
|
|
1833
1816
|
"description": "Unique name for the task within the workflow. Format: alphanumeric and underscores only, starting with a letter.",
|
|
1834
1817
|
"type": "string"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy-hq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
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,20 +45,21 @@
|
|
|
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"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@oxy-hq/sdk": "workspace:*",
|
|
58
|
-
"@types/node": "^26.6.
|
|
59
|
-
"tsdown": "^0.23.
|
|
59
|
+
"@types/node": "^26.6.6",
|
|
60
|
+
"tsdown": "^0.23.7",
|
|
60
61
|
"typescript": "^7.0.2",
|
|
61
|
-
"vitest": "^5.0
|
|
62
|
+
"vitest": "^5.1.0"
|
|
62
63
|
},
|
|
63
64
|
"engines": {
|
|
64
65
|
"node": ">=20"
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: oxy-cli
|
|
3
|
-
description: Use when you need data out of an Oxy deployment — querying a customer's warehouse or semantic layer, reading threads/runs/apps/orgs, checking why an endpoint 4xxs, or reproducing a customer-reported bug against real data. Also when you need to know which endpoints exist or what body one takes. Triggers on "query the customer's data", "what does this API return", "debug this in production/dev", "which endpoint", "check the thread/run/app", "oxyc", "oxy api".
|
|
3
|
+
description: Use when you need data out of an Oxy deployment — querying a customer's warehouse or semantic layer, reading threads/runs/apps/orgs, checking why an endpoint 4xxs, or reproducing a customer-reported bug against real data. Also when you need to know which endpoints exist or what body one takes, and (staff) when standing a new customer account up or checking which of its steps have landed. Triggers on "query the customer's data", "what does this API return", "debug this in production/dev", "which endpoint", "check the thread/run/app", "oxyc", "oxy api", "stand up a new customer", "new account setup", "oxyc bootstrap".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Getting data out of Oxy with `oxyc`
|
|
@@ -10,7 +10,10 @@ resolves the token, picks the right credential for the surface, and can tell
|
|
|
10
10
|
you what endpoints exist.
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
|
|
13
|
+
npm i -g @oxy-hq/cli # or: npx @oxy-hq/cli <command>
|
|
14
|
+
oxyc <command>
|
|
15
|
+
|
|
16
|
+
# From a checkout instead, when you want the build in your working tree:
|
|
14
17
|
node <repo>/sdk/cli/dist/main.mjs <command>
|
|
15
18
|
```
|
|
16
19
|
|
|
@@ -57,6 +60,7 @@ never sent to the server as a literal.
|
|
|
57
60
|
|
|
58
61
|
- `--jq '<expr>'` on the server-side shape, **always**, before you look at a
|
|
59
62
|
large response. Dumping a full thread list into context is the common waste.
|
|
63
|
+
It needs no `jq` on PATH (oxyc embeds jq), so use it in CI and cloud VMs too.
|
|
60
64
|
- `--md` turns an array of objects into a markdown table — far fewer tokens
|
|
61
65
|
than the same rows as JSON, which repeats every field name per row.
|
|
62
66
|
- `--cache 5m` when you are walking the same endpoints repeatedly.
|
|
@@ -68,13 +72,26 @@ never sent to the server as a literal.
|
|
|
68
72
|
|
|
69
73
|
oxyc validate # check the workspace YAML — no network, no token
|
|
70
74
|
oxyc proxy --env dev # local app dev against cloud data
|
|
75
|
+
oxyc experiments list # experiments: draft, price, register, status, interim, abort, result
|
|
76
|
+
oxyc flags list # feature flags: kill switch, per-org overrides, A/B splits (staff)
|
|
71
77
|
oxyc login-link --next /ide # one-time URL that signs a browser in as your token
|
|
78
|
+
oxyc workspace clone <id> # clone the workspace's repository to edit locally; push to deploy
|
|
72
79
|
oxyc guide # this page, to paste into a context file
|
|
73
80
|
|
|
81
|
+
`oxyc workspace clone <workspace-id>` is how you change a workspace: authoring
|
|
82
|
+
happens in its repository, not in the product. It runs your own `git clone` (no
|
|
83
|
+
token injected), prints the path of the workspace folder (the repository's
|
|
84
|
+
subdirectory when the workspace lives in one), and opens it in VS Code or Cursor
|
|
85
|
+
only from an interactive terminal (`--open code|cursor|none`; an agent gets the
|
|
86
|
+
command printed instead). Edit, commit, push: **a push to the default branch
|
|
87
|
+
compiles and deploys**; to try a branch first, `oxyc preview create <branch>
|
|
88
|
+
--workspace <id> --wait` (staff). Exit `5` means the workspace has no repository
|
|
89
|
+
yet (connect one in Settings), `6` a failed `git clone`, `8` a non-empty `--dir`.
|
|
90
|
+
|
|
74
91
|
`oxyc validate` is the one command that works entirely offline. It checks
|
|
75
|
-
`config.yml`, `.automation.yml`, `.agentic.yml
|
|
92
|
+
`config.yml`, `.automation.yml`, `.agentic.yml` and
|
|
76
93
|
`.agent.test.yml` against the schemas the Rust config types generate. It is
|
|
77
|
-
STRUCTURAL only — `oxy validate` additionally checks an automation's
|
|
94
|
+
STRUCTURAL only — `oxy validate` additionally checks an automation's
|
|
78
95
|
`database:` names against `config.yml`, but it too is structural for
|
|
79
96
|
`.agentic.yml` (`databases:` and `llm.ref` are not resolved), so an agent both
|
|
80
97
|
accept can still fail at run time.
|
|
@@ -90,6 +107,63 @@ reads its credential from `OXY_TOKEN` only — with the variable unset it exits
|
|
|
90
107
|
`4` rather than using the machine's `oxyc login`; `oxyc mcp --login` opts
|
|
91
108
|
into that. The same holds for any command given `--token-env <VAR>`.
|
|
92
109
|
|
|
110
|
+
## Feature flags (staff)
|
|
111
|
+
|
|
112
|
+
Use `oxyc flags` to turn an Oxy product change on for named orgs, run an A/B split, or
|
|
113
|
+
see what a flag serves an org — instead of the admin page or hand-written PATCHes.
|
|
114
|
+
Flags are declared in code; you change the kill switch and the targeting rules, never
|
|
115
|
+
create a flag. **Every write is prod-affecting** (`--env` defaults to production) and
|
|
116
|
+
asks first; pass `--yes` when there is no terminal, after `--dry-run` shows the rules.
|
|
117
|
+
|
|
118
|
+
oxyc flags list | show <key> # read: rules, unit, scope
|
|
119
|
+
oxyc flags eval --org acme [--user <uuid>] # preview what each flag serves them
|
|
120
|
+
oxyc flags set <key> --off --yes # kill switch: off = every org gets the first variant
|
|
121
|
+
oxyc flags rules <key> --set-org acme=treatment --yes # add one override, keep the rest
|
|
122
|
+
oxyc flags rules <key> --split control=50,treatment=50 --yes # percent, must total 100
|
|
123
|
+
oxyc flags rules <key> --file rules.json | --clear --yes
|
|
124
|
+
|
|
125
|
+
Orgs take a slug or UUID, users a UUID. Rules on a flag with `per_org: false` are refused
|
|
126
|
+
(422, exit 6), and rules saved behind an off kill switch do not apply until `set --on`.
|
|
127
|
+
Treat a running split as immutable. `oxyc flags org <org>` is what a member of that org
|
|
128
|
+
sees.
|
|
129
|
+
|
|
130
|
+
## Standing a customer up (staff)
|
|
131
|
+
|
|
132
|
+
`oxyc bootstrap` is the sequence a new customer account goes through, and the part of
|
|
133
|
+
it a command can do. **Staff only, and it says so rather than failing oddly:** most
|
|
134
|
+
phases read or write the admin surface, creating the organization needs the
|
|
135
|
+
org-creation capability, and the subscription phase is the Global Owner's alone. A
|
|
136
|
+
customer's own agent cannot run this and should not try.
|
|
137
|
+
|
|
138
|
+
oxyc bootstrap plan <customer> [--crews] # the whole sequence; reads nothing, writes nothing
|
|
139
|
+
oxyc bootstrap run <customer> --owner <email> # do the phases oxyc can, print the rest
|
|
140
|
+
oxyc bootstrap verify <customer> [--json] # which phases have landed
|
|
141
|
+
|
|
142
|
+
Shared flags: `--name <display>`, `--repo <owner/repo>`, `--app <slug>`, `--writer
|
|
143
|
+
app:<slug>|pipeline:<source>` (repeatable), `--crews`, `--phase <id>` (repeatable).
|
|
144
|
+
`run` also takes `--owner`, `--dry-run` and `--yes`. The phases are `repo`, `org`,
|
|
145
|
+
`billing`, `oltp`, `git-link`, `workspace`, `airhouse`, `app`, `secrets` and — with
|
|
146
|
+
`--crews` — `frontline`.
|
|
147
|
+
|
|
148
|
+
**`run` is safe to re-run**, which is the whole point: a half-finished standup is the
|
|
149
|
+
common case. It reads every phase before it writes, and writes only what is missing —
|
|
150
|
+
exactly two things, the organization and the workspace's Airhouse tenant — then prints
|
|
151
|
+
a checklist for the rest. It never buys the OLTP store (a billable project at a paid
|
|
152
|
+
provider), never provisions a subscription, never sets a secret's value and never
|
|
153
|
+
enrols a worker.
|
|
154
|
+
|
|
155
|
+
**It works one surface at a time.** The admin surface is refused while an
|
|
156
|
+
`oxyc assume` session is live, and the import that gives a workspace its git remote is
|
|
157
|
+
org-scoped — so a standup crosses between staff and tenant credentials twice. `plan`
|
|
158
|
+
prints the stage boundaries; `run` refuses before writing anything rather than
|
|
159
|
+
half-writing.
|
|
160
|
+
|
|
161
|
+
`verify` distinguishes **`unknown` from `no`**: a phase it could not read — an expired
|
|
162
|
+
token, or an assume session closing the admin surface — is not a phase that has not
|
|
163
|
+
happened, and only `no` fails. Exit `9` means a phase has not landed, `8` that a live
|
|
164
|
+
assume session blocked the attempt. `--json` gives `{id, landed, detail, next}` per
|
|
165
|
+
phase, which is the form to branch on.
|
|
166
|
+
|
|
93
167
|
## An agent's own credential
|
|
94
168
|
|
|
95
169
|
If you are an agent, run on your own token — never on the person's
|
|
@@ -187,6 +261,19 @@ oxyc assume end # or --all
|
|
|
187
261
|
oxyc login --login-env dev,staging # log into several at once
|
|
188
262
|
```
|
|
189
263
|
|
|
264
|
+
**No browser on this machine** (a Claude Code remote session, SSH, a
|
|
265
|
+
Codespace): `oxyc login` notices and prints a URL and a code to open on any
|
|
266
|
+
device, like `gh auth login`. An agent asked to log a person in there cannot
|
|
267
|
+
show a URL from a command that is still waiting, so split it:
|
|
268
|
+
`oxyc login --env <env> --no-wait` prints the URL on stdout and exits — hand
|
|
269
|
+
it to the person — and once they say it is approved, `oxyc login --env <env>`
|
|
270
|
+
finishes. This is the person's login, run because they asked; it is still
|
|
271
|
+
never your own credential (see "An agent's own credential").
|
|
272
|
+
|
|
273
|
+
**In CI** nobody can approve, so `oxyc login` and `tokens create --agent` exit
|
|
274
|
+
`4` at once. Use `OXY_TOKEN` from a secret, or `--service-account` under GitHub
|
|
275
|
+
Actions OIDC. `-q` works there too: oxyc embeds jq when the runner has none.
|
|
276
|
+
|
|
190
277
|
The session hangs off your **account**, not this terminal — your browser is in
|
|
191
278
|
there too, and `end` gets you out of both.
|
|
192
279
|
|
|
@@ -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
|
|
|
@@ -182,6 +187,16 @@ what changed). **Is it already in the customer's warehouse?** → read it there.
|
|
|
182
187
|
with `_` can't back a schema. Both stores are written **as the app**, whoever
|
|
183
188
|
invoked the function, so a scheduled run writes like a click.
|
|
184
189
|
|
|
190
|
+
**A store has to exist before your schema can.** The org's OLTP Postgres is bought
|
|
191
|
+
and provisioned for the account, not created by publishing, so on a new or
|
|
192
|
+
part-provisioned account `ctx.oltp` fails for a reason that is nothing to do with your
|
|
193
|
+
code — and the same is true of a secret that was set in staging but never in
|
|
194
|
+
production. You cannot provision it yourself. What to ask for by name: Oxy staff run
|
|
195
|
+
`oxyc bootstrap verify <org>`, which reports every account-level step as landed,
|
|
196
|
+
missing or unreadable and names the command that fixes each one. Quote the phase it
|
|
197
|
+
reports (`oltp`, `secrets`, `airhouse`) and you will get a straight answer instead of
|
|
198
|
+
a round trip.
|
|
199
|
+
|
|
185
200
|
**Facts, in practice.** Airhouse is DuckLake: no `PRIMARY KEY`, `UNIQUE`,
|
|
186
201
|
indexes or foreign keys — publish refuses a migration carrying one. So:
|
|
187
202
|
|
|
@@ -277,8 +292,42 @@ by, so declare it with the first `ctx.notify`, not later:
|
|
|
277
292
|
undeclared function, a misspelt field and any `oxy.` kind — every problem at
|
|
278
293
|
once; a catalogue kind no function sends is a warning.
|
|
279
294
|
|
|
280
|
-
The
|
|
281
|
-
|
|
295
|
+
**The dock.** Wrap the app in `<OxyShell>` (every `create-oxy-app` template
|
|
296
|
+
does) so it shows Oxygen's rail: HQ, Chat and the viewer's other apps, each
|
|
297
|
+
opening in this tab and warmed on hover. Pass `hideTopBar` if the app draws its
|
|
298
|
+
own header. Link to another app with a plain `<a href>`, never `target="_blank"`;
|
|
299
|
+
moving between apps is meant to feel like one product.
|
|
300
|
+
|
|
301
|
+
**Motion.** `shell.css` loads `@oxy-hq/sdk/motion.css` (SDK ≥ 2.24), Oxygen's
|
|
302
|
+
own motion language, so shadcn dialogs, menus and tooltips already open and
|
|
303
|
+
close like Oxygen's. Time your own transitions with its tokens
|
|
304
|
+
(`var(--oxy-duration-fast)`, `var(--oxy-ease-out)`; the templates map them into
|
|
305
|
+
Tailwind's `@theme`) rather than inventing durations, keep them short (most
|
|
306
|
+
are 120–240 ms), and give every slide or zoom a `motion-reduce:` counterpart.
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
import { OxyShell } from "@oxy-hq/sdk/shell";
|
|
310
|
+
import "@oxy-hq/sdk/shell.css";
|
|
311
|
+
|
|
312
|
+
<OxyAppProvider>
|
|
313
|
+
<OxyShell hideTopBar>
|
|
314
|
+
<App />
|
|
315
|
+
</OxyShell>
|
|
316
|
+
</OxyAppProvider>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
A `pushState` before the person has touched the page (a default redirect,
|
|
320
|
+
filters written to the query string on mount) is turned into a replace by the
|
|
321
|
+
platform, so Back still leaves the app; write such URL syncs as replaces anyway. An app that pushes on
|
|
322
|
+
purpose before any interaction (a dialog route opened on load and closed with
|
|
323
|
+
`history.back()`, a kiosk's Back trap) adds
|
|
324
|
+
`<meta name="oxy-history" content="native">` to its `index.html`, and its pushes
|
|
325
|
+
are left alone.
|
|
326
|
+
`PhoneSheet` and the shell's drawer hold their own entries this way and need nothing
|
|
327
|
+
from the app.
|
|
328
|
+
|
|
329
|
+
The app is its own page, outside Oxygen's shell, so show the inbox **in the
|
|
330
|
+
app** — people who live in it (crew on a kiosk) never see Oxygen's bell:
|
|
282
331
|
|
|
283
332
|
```tsx
|
|
284
333
|
import { NotificationsBell } from "@oxy-hq/sdk";
|
|
@@ -299,6 +348,153 @@ Oxygen's Settings → Notifications — don't build them. In tests,
|
|
|
299
348
|
`createTestInbox({ manifest })` from `@oxy-hq/sdk/testing` is a fake inbox to pass as
|
|
300
349
|
`<OxyAppProvider fetcher={inbox.fetcher}>`.
|
|
301
350
|
|
|
351
|
+
## Home widgets (a live card on the Oxygen home)
|
|
352
|
+
|
|
353
|
+
A widget puts what needs doing in your app on the Oxygen home, with the button
|
|
354
|
+
that does it ("19 stores ready to post" and **Post 19 ready**). It is **data, not
|
|
355
|
+
a page**: a function of yours returns a small JSON view and the home draws it. The
|
|
356
|
+
function runs as the person looking, so app access and rate limits apply.
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
"widgets": {
|
|
360
|
+
"close": {
|
|
361
|
+
"title": "Month-end close", // ≤ 40 characters
|
|
362
|
+
"function": "close-widget", // declared under functions; returns the view
|
|
363
|
+
"size": "wide", // default size: "regular" (default), "wide" or "full"
|
|
364
|
+
"sizes": ["regular", "wide", "full"], // sizes a layout may pick; default [size]; must include size
|
|
365
|
+
"params": { "type": "object", "required": ["store"], "properties": { // settings per copy
|
|
366
|
+
"store": { "type": "string", "title": "Store", "description": "A store slug" } } },
|
|
367
|
+
"actions": {
|
|
368
|
+
"post-ready": { "function": "post-ready-jes", "confirm": true } // destructive: true for red
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
At most **6 widgets** per app and **3 actions** per widget; ids are lowercase
|
|
375
|
+
letters, digits, `-` and `_`. `params` is a flat JSON Schema: up to 8 properties, each
|
|
376
|
+
`string`, `integer`, `number` or `boolean` with optional `title`, `description`, `default`,
|
|
377
|
+
`enum`, `minimum`/`maximum` (numbers), `minLength`/`maxLength` (strings), plus `required`;
|
|
378
|
+
no nesting, no `$ref`. `oxyc validate` and `oxyc publish` refuse an unknown key, a bad id,
|
|
379
|
+
a bad `size`/`sizes` (`widget_size_invalid`), a bad `params` (`widget_params_invalid`) and an
|
|
380
|
+
undeclared `function`.
|
|
381
|
+
|
|
382
|
+
The function is called with `{ widget, size, params }` (`WidgetInput`; `size` is how wide
|
|
383
|
+
it is drawn, so say more when `wide` or `full`; `params` are this copy's settings with
|
|
384
|
+
defaults filled in, `{}` if it declares none) and returns a `WidgetView`:
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
import type { WidgetInput, WidgetView } from "@oxy-hq/sdk";
|
|
388
|
+
|
|
389
|
+
export default async (req, ctx) => {
|
|
390
|
+
const { widget, size, params } = JSON.parse(req.body || "{}") as WidgetInput; // params.store
|
|
391
|
+
const view: WidgetView = {
|
|
392
|
+
headline: "19 stores ready to post", // required, ≤ 80; none = "nothing to show"
|
|
393
|
+
detail: "September · 61 of 84 posted", // ≤ 120
|
|
394
|
+
level: "attention", // ok | info | attention | critical
|
|
395
|
+
progress: { done: 61, total: 84 },
|
|
396
|
+
metric: { value: "$48,210", label: "Posted", delta: "+12%", trend: "up", spark: [31, 35, 41, 48] },
|
|
397
|
+
rows: [{ title: "Valencia", detail: "Not mapped", state: "blocked" }], // ≤ 8
|
|
398
|
+
buttons: [{ // ≤ 2, each naming a declared action
|
|
399
|
+
action: "post-ready", label: "Post 19 ready", input: { period: "2026-09" },
|
|
400
|
+
key: "2026-09", confirm: "Post 19 journal entries to QuickBooks?"
|
|
401
|
+
}],
|
|
402
|
+
link: "/?month=2026-09", badge: 19, // "Open" (app-relative: / or ?), and a count
|
|
403
|
+
refresh_after: 300, // read again after N seconds (60–86400)
|
|
404
|
+
};
|
|
405
|
+
return Response.json(view);
|
|
406
|
+
};
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
A widget's kind is what its view carries: `metric` makes a **KPI card** (`value` ≤ 24,
|
|
410
|
+
`label` ≤ 40, `delta` ≤ 24, `trend` up/down/flat, `spark` ≤ 30 points), `progress` a
|
|
411
|
+
progress card, rows with buttons a to-do. Text and lists past their limits are cut, and a
|
|
412
|
+
non-app-relative link or a button naming an undeclared action is dropped.
|
|
413
|
+
|
|
414
|
+
**`level` decides the room a card gets.** Widgets live in the home's Today area (a rail
|
|
415
|
+
beside the apps on a wide screen, under them on a phone), one column wide. An `ok` or `info`
|
|
416
|
+
view with no button folds to one line (its headline) in an "All clear" list after every card
|
|
417
|
+
that needs someone; `attention` and `critical` keep the full card. So say all-is-well in the
|
|
418
|
+
headline alone, and raise the level when the rows matter. `progress` is always a ring beside
|
|
419
|
+
the headline holding `done/total`, so don't repeat the count in `detail`. A `regular` card
|
|
420
|
+
shows three rows, `wide` and `full` all of them: size is how much a card shows, not its width.
|
|
421
|
+
|
|
422
|
+
**Pressing a button** calls the action's function with `{ widget, action, input }` and
|
|
423
|
+
an `Idempotency-Key` built from widget, action and the button's `key` (none: a hash of
|
|
424
|
+
`input`), so a double click or stale card replays the first answer. **Give every button
|
|
425
|
+
a `key` that names the thing done** (`"2026-09"`), not a timestamp. The action's return
|
|
426
|
+
decides the card: `{ view }` re-renders, `{ message }` shows a line, anything else
|
|
427
|
+
re-reads the widget; a throw or non-2xx leaves it as it was, with the reason shown.
|
|
428
|
+
Widgets show **in production only**, on the apps-first home. One that should not run on every home load declares
|
|
429
|
+
`cache: { ttlSeconds }` on its function.
|
|
430
|
+
|
|
431
|
+
### Laying out the home
|
|
432
|
+
|
|
433
|
+
The org's home is one layout document, written by an org owner or admin (not by an
|
|
434
|
+
app): the widget groups of Today in order, and the widgets as `<app>/<widget>` at a size
|
|
435
|
+
from that widget's `sizes`. The apps always come first and are always drawn; `apps` and
|
|
436
|
+
`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,
|
|
437
|
+
each a group with an optional `title` (≤ 40); `others` goes on the first only. An item
|
|
438
|
+
may add `params`, a `title` and an `id`, so one widget can appear as several copies
|
|
439
|
+
(one per store), each with its own `id`.
|
|
440
|
+
|
|
441
|
+
**Who a widget is for.** A group or an item may add `for`:
|
|
442
|
+
`{ "people": ["scott@acme.com"], "teams": ["Office"] }` (emails, and org team names; at
|
|
443
|
+
least one list non-empty, at most 50 each, matched case-insensitively). Only those people
|
|
444
|
+
see it. It only narrows: app access applies first, and an item's `for` narrows its
|
|
445
|
+
group's. Use it when someone may open the app but its widget is noise to them ("show
|
|
446
|
+
Bookkeeping's cards only to Scott and Dylan"), rather than changing who can open the app.
|
|
447
|
+
Widgets the layout does not list stay everyone's. Each person can also hide a widget or
|
|
448
|
+
turn Today off on their own home; a layout cannot undo that.
|
|
449
|
+
|
|
450
|
+
```json
|
|
451
|
+
{ "version": 1, "sections": [
|
|
452
|
+
{ "kind": "apps" },
|
|
453
|
+
{ "kind": "widgets", "items": [ { "widget": "warehouse/receiving", "hidden": true } ],
|
|
454
|
+
"others": "show" },
|
|
455
|
+
{ "kind": "widgets", "title": "Back office",
|
|
456
|
+
"for": { "people": ["scott@acme.com", "dylan@acme.com"] },
|
|
457
|
+
"items": [ { "widget": "bookkeeping/close", "size": "full" } ] },
|
|
458
|
+
{ "kind": "widgets", "title": "Stores", "items": [
|
|
459
|
+
{ "widget": "store-ops/today", "id": "mission", "title": "Mission St",
|
|
460
|
+
"params": { "store": "mission" } } ] },
|
|
461
|
+
{ "kind": "insights" } ] }
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Get, edit, preview, then apply:
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
oxyc home show --org acme # what a person sees: widgets, sizes, headlines
|
|
468
|
+
oxyc home get --org acme > layout.json # { revision, layout }: edit the layout
|
|
469
|
+
oxyc home apply --org acme -f layout.json --dry-run # resulting home as text, nothing saved
|
|
470
|
+
oxyc home apply --org acme -f layout.json # save (sends the file's revision)
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
A refused layout (exit 6) lists every problem as `path: message (fix)`; fix them all.
|
|
474
|
+
Exit 8 means someone saved since your `get`: `home get` again and redo the edit
|
|
475
|
+
(`--force` overwrites). `oxyc home reset` restores the default. A widget not listed
|
|
476
|
+
still shows after the first group's items unless `others` is `"hide"`, except one with a
|
|
477
|
+
required setting and no default: it needs an entry that sets `params`.
|
|
478
|
+
|
|
479
|
+
## Phone layout
|
|
480
|
+
|
|
481
|
+
People open these apps on their phones. A desktop layout squeezed into one column
|
|
482
|
+
is not a phone layout: tables scroll sideways, tabs get cut, the answer sits under a
|
|
483
|
+
map. Give each screen people use on a phone a **phone view** built from the phone
|
|
484
|
+
kit in `@oxy-hq/sdk/shell`, beside the desktop component, from the same hooks:
|
|
485
|
+
|
|
486
|
+
```tsx
|
|
487
|
+
const phone = usePhoneLayout();
|
|
488
|
+
return phone ? <OrdersPhone {...data} /> : <OrdersDesktop {...data} />;
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The desktop layout stays exactly as it is. On the phone: a `PhoneTabBar` for
|
|
492
|
+
sections, the answer first (`PhoneKpiStrip`, "needs you" `PhoneRow`s), table rows
|
|
493
|
+
as `PhoneCard`s (**never a sideways-scrolling table**), details in a `PhoneSheet`,
|
|
494
|
+
maps as their own tab, `PhoneHint` instead of hover tooltips. The mapping from each
|
|
495
|
+
desktop part, the type and touch floor, and how to check it at 390×844 and 844×390:
|
|
496
|
+
[references/phone-layout.md](references/phone-layout.md).
|
|
497
|
+
|
|
302
498
|
## Four pitfalls
|
|
303
499
|
|
|
304
500
|
- **CORS errors are usually wrong-URL errors in disguise.** The SDK's
|
|
@@ -547,10 +743,10 @@ If a command fails with `fetch failed` (exit `7`) while `HTTPS_PROXY` is set,
|
|
|
547
743
|
|
|
548
744
|
A sandbox (`dev-<handle>`, 1-12 lowercase letters/digits/hyphens, no leading,
|
|
549
745
|
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
|
-
|
|
746
|
+
own build pointer, storage silo, secrets and Airhouse sibling schema. By
|
|
747
|
+
default reads hit production and writes are isolated or *held* (recorded, not
|
|
748
|
+
performed: a held write's `note` in `invocations held` names what would make it
|
|
749
|
+
land). Each part can be isolated further: see **Branch it** below.
|
|
554
750
|
A sandbox's schedules are **off by default** (staging's too): staff turn them
|
|
555
751
|
on per environment with `oxyc env schedules <app> dev-x --on`, and a scheduled
|
|
556
752
|
fire is not activity. To test a scheduled function without that, run it once
|
|
@@ -576,6 +772,26 @@ oxyc logs acme/store --app-env dev-x --env dev --follow --timeout 300 --json #
|
|
|
576
772
|
oxyc env delete acme/store dev-x --env dev --yes --wait --json # done; tears its homes down
|
|
577
773
|
```
|
|
578
774
|
|
|
775
|
+
**Branch it: isolate exactly the parts you are testing.** A sandbox is a
|
|
776
|
+
branch of the app, with a parent (`--from`, for the build), a fork point
|
|
777
|
+
(`--at`, for production's data) and a mode per plane of app state. The defaults
|
|
778
|
+
keep the behaviour above. Turn on isolation only for what you are testing:
|
|
779
|
+
|
|
780
|
+
```bash
|
|
781
|
+
oxyc env create acme/store dev-x --from staging --preset full --env dev --json # most isolation in one flag
|
|
782
|
+
oxyc env update acme/store dev-x --plane oltp=branch --env dev # its own copy of production's rows
|
|
783
|
+
oxyc env update acme/store dev-x --fetch-host api.stripe.com --env dev # real writes to a provider sandbox
|
|
784
|
+
oxyc env outbox acme/store dev-x --env dev --json # what messages=capture kept
|
|
785
|
+
oxyc env reset acme/store dev-x --plane storage,secrets,messages --env dev # start those planes over
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
Which mode tests what, every plane and its modes, the `full` preset, reset,
|
|
789
|
+
expiry, the caps and each refusal with its fix are in
|
|
790
|
+
[references/environment-branches.md](references/environment-branches.md). Read
|
|
791
|
+
it before setting any plane. Three rules hold whatever you choose: production
|
|
792
|
+
has no planes; `oltp=branch|empty` and `airhouse=branch|snapshot` are
|
|
793
|
+
sandbox-only; `ctx.airway.run` is refused outside production.
|
|
794
|
+
|
|
579
795
|
(`--data` has no short form — don't write `-d`.)
|
|
580
796
|
|
|
581
797
|
Iterate from `publish` as the code changes — each publish is a new build, and
|
|
@@ -588,23 +804,27 @@ such staff approved; a publish token is refused on every sandbox operation,
|
|
|
588
804
|
so CI cannot use one.
|
|
589
805
|
|
|
590
806
|
**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
|
-
|
|
807
|
+
login, with `--token-env OXY_TOKEN` on every command — up to the page:
|
|
808
|
+
`checks run --browser` and `oxyc proxy --app <org>/<app> --app-env dev-x` let
|
|
809
|
+
it check what a person sees in its own sandbox. The loop at a glance, the
|
|
810
|
+
mint, exit codes, rules and what to hand back are in
|
|
593
811
|
[references/sandbox-agent-loop.md](references/sandbox-agent-loop.md). Read it
|
|
594
812
|
before an agent runs any `oxyc` command against a deployment.
|
|
595
813
|
|
|
596
814
|
**A sandbox isolates the app, not the workspace.** The semantic model,
|
|
597
815
|
automations and Airway pipelines it reads are `main`'s. To try a workspace
|
|
598
816
|
branch, open a workspace preview (staff only, `oxyc preview …`), or publish to
|
|
599
|
-
the sandbox with `--semantic-branch <branch
|
|
817
|
+
the sandbox with `--semantic-branch <branch>`, or set the planes above — see
|
|
600
818
|
[references/sandbox-agent-loop.md](references/sandbox-agent-loop.md#a-sandbox-isolates-the-app-not-the-workspace).
|
|
601
819
|
|
|
602
820
|
## Read next
|
|
603
821
|
|
|
604
822
|
| File | Read it when |
|
|
605
823
|
| --- | --- |
|
|
606
|
-
| [references/
|
|
824
|
+
| [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. |
|
|
825
|
+
| [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
826
|
| [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
827
|
| [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
828
|
| [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. |
|
|
829
|
+
| [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
830
|
| [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. |
|