@oxy-hq/cli 0.12.1 → 0.13.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.
Files changed (33) hide show
  1. package/README.md +605 -68
  2. package/dist/main.mjs +12125 -3088
  3. package/dist/main.mjs.map +1 -1
  4. package/dist/{mcp-CJWQm-yd.mjs → mcp-vlYd5Bms.mjs} +2 -2
  5. package/dist/{mcp-CJWQm-yd.mjs.map → mcp-vlYd5Bms.mjs.map} +1 -1
  6. package/json-schemas/agent-test.json +47 -2
  7. package/json-schemas/agentic.json +77 -0
  8. package/json-schemas/config.json +2 -1
  9. package/json-schemas/topic.json +252 -0
  10. package/json-schemas/view.json +473 -0
  11. package/package.json +2 -2
  12. package/skills/oxy-agents/SKILL.md +29 -26
  13. package/skills/oxy-agents/references/quick-reference.md +4 -6
  14. package/skills/oxy-agents/templates/agentic-template.yml +2 -1
  15. package/skills/oxy-airway-pipelines/SKILL.md +27 -2
  16. package/skills/oxy-automations/SKILL.md +42 -28
  17. package/skills/oxy-cli/SKILL.md +15 -7
  18. package/skills/oxy-custom-apps/SKILL.md +293 -7
  19. package/skills/oxy-custom-apps/references/app-calls.md +98 -0
  20. package/skills/oxy-custom-apps/references/phone-layout.md +16 -2
  21. package/skills/oxy-custom-apps/references/sandbox-agent-loop.md +8 -8
  22. package/skills/oxy-evals/SKILL.md +60 -36
  23. package/skills/oxy-evals/references/diagnosis.md +7 -5
  24. package/skills/oxy-evals/references/results-json.md +23 -15
  25. package/skills/oxy-evals/references/writing-expected.md +3 -2
  26. package/skills/oxy-experiments/SKILL.md +4 -3
  27. package/skills/oxy-semantic-modeling/SKILL.md +14 -12
  28. package/template/.claude/hooks/oxyc-cloud-session.sh +40 -8
  29. package/template/.github/workflows/publish.yaml +5 -5
  30. package/template/.github/workflows/validate.yaml +125 -199
  31. package/template/README.md +50 -21
  32. package/template/_gitignore +4 -4
  33. package/template/config.yml +2 -2
@@ -44,8 +44,8 @@ with breakpoints until it "fits": the desktop and TV layout must not move.
44
44
  | --- | --- |
45
45
  | Tabs, a sidebar, a section switcher | `PhoneTabBar` at the bottom: up to five; past five it shows four and a More sheet |
46
46
  | The page | `PhonePage` with `tabBar` (and `stickyAction`); pass the tab id as `scrollKey` |
47
- | KPI cards | `PhoneKpiStrip`, two per row, first on the screen |
48
- | A table | `PhoneCardList` of `PhoneCard`s: the row's name, a status pill, two or three key figures; a `summary` line on top. **Never a sideways-scrolling table.** |
47
+ | KPI cards | `PhoneKpiStrip`, two per row, first on the screen (`oddLastAcross`, SDK ≥ 2.32: an odd last tile takes the row); a `StatGrid` of `Stat`s takes `phonePairs` for the same |
48
+ | A table | `PhoneCardList` of `PhoneCard`s: the row's name, a status pill, two or three key figures; a `summary` line on top. A desk `PanelTable` takes `phoneCard` instead (SDK ≥ 2.32): the same rows as cards, every figure kept. **Never a sideways-scrolling table.** |
49
49
  | A row's action button (Post, Approve) | the card's `trailing`, or `PhoneStickyAction` for the screen's one main action |
50
50
  | A detail panel, drawer or modal | `PhoneSheet` (full screen, Back). The phone's Back closes it through `onClose` and the page stays put; a sheet that opened by pushing its own entry (a route, `?item=`) passes `historyEntry={false}` |
51
51
  | A list of things that need someone | `PhoneSection` of `PhoneRow`s with a `tone` dot |
@@ -78,6 +78,20 @@ history and settings come after, or behind a tab.
78
78
  - Use the kit's colours (it follows your theme tokens and a `.dark` ancestor)
79
79
  rather than hard-coded ones, so light and dark both work. Its corners follow
80
80
  `--radius` (at `0`, square, with only status dots round) and its text `--font-sans`.
81
+ - **Take the look from `@oxy-hq/sdk/theme.css`** (SDK 2.29 and later), the reference
82
+ app's design and the standard for every custom app. Import it above your own CSS and
83
+ the kit and shell draw square corners, frame lines on the subtle line, 44px touch
84
+ targets and one font with the app, with no rules of your own. Don't restyle the kit
85
+ with `!important` corner rules or `--oxy-shell-*` overrides: delete them when you
86
+ import the theme, because the theme's names are read first and those rules only
87
+ fight it.
88
+ - Leave the kit's widths to it (SDK 2.29 and later). `PhoneSegmented` keeps every
89
+ label whole: a long label takes its width, and a row too wide scrolls with a fade,
90
+ the selected option in view. A `PhoneCard` figure's value wraps or ends in an
91
+ ellipsis, never cut through a glyph, and with the theme a card has one figure column
92
+ per figure. A rule of your own on `.oxy-phone-segmented` columns or option padding,
93
+ or on `.oxy-phone-card__figures` columns, outranks the kit and brings the cut back:
94
+ delete it.
81
95
 
82
96
  ## Checking it
83
97
 
@@ -43,18 +43,18 @@ oxyc tokens create --sandbox-agent --app <org>/<app> --env <deployment>
43
43
  - **Where no browser can reach your machine** (a cloud container, a CI job, a
44
44
  remote box), add `--no-browser`. `oxyc` prints a URL and an eight-letter
45
45
  code on stderr instead of opening a page, and waits up to ten minutes. Give
46
- your engineer both: they open the URL on any device where they are signed
47
- in, type the code the terminal shows, and approve. The token is printed
46
+ your engineer the URL: it carries the code, so opening it on any device
47
+ where they are signed in and approving is the whole step (the bare page plus
48
+ the code is the fallback for a device the link cannot reach). The token is printed
48
49
  exactly as above. The rule does not change: never open or approve that page
49
50
  yourself, with a browser tool or any other way.
50
51
  - **Name who approves with `--approver <email>`** (or `OXY_APPROVER`, which
51
52
  counts with `--no-browser`, `oxyc login --no-wait` or in a cloud session, never
52
- where oxyc only detected SSH or a Codespace), with the device code: the engineer is told by push, email and Slack; they type
53
- the code from your output on the page. Use the email your engineer gave you,
54
- and still show them the code `oxyc` printed, since the notice does not carry
55
- it. Only that person can open the request: if you were given no address, omit
56
- the flag and hand them the URL and the code as before. Never open or click
57
- the page yourself.
53
+ where oxyc only detected SSH or a Codespace), with the device code: the engineer is told by push, email and Slack. The notice has no
54
+ code, so still send them the URL from your output, which carries it. Use the
55
+ email your engineer gave you. Only that person can open the request: if you
56
+ were given no address, omit the flag and hand them the URL as before. Never
57
+ open or click the page yourself.
58
58
  - **Evaluate that line and work with the token.** In a shell that persists:
59
59
  `eval "$(oxyc tokens create --sandbox-agent --app <org>/<app> --env <deployment>)"`.
60
60
  In one that does not, such as an agent's shell tool, redirect it to
@@ -7,7 +7,8 @@ description: >-
7
7
  my agent", "bootstrap an eval suite", "fill in expected answers", "run the tests"; and the
8
8
  repair side: "tests are failing", "this test is flaky", "the agent's answer is wrong", "the
9
9
  answer should be X but the agent says Y", "debug this eval", "make this test pass", or pasted
10
- `oxy test --output-json` output or a prompt/response pair to diagnose. Drafts expected answers
10
+ `oxyc evals run --output-json` output (or an older `oxy test --output-json` file) or a
11
+ prompt/response pair to diagnose. Drafts expected answers
11
12
  from observed runs, then diagnoses failures and repairs the agent's semantic model, context and
12
13
  instructions — never the test.
13
14
  ---
@@ -15,8 +16,8 @@ description: >-
15
16
  # Oxy evals: draft, run, diagnose, repair
16
17
 
17
18
  An Oxy eval is a `.test.yml` file: a list of prompts, each with the answer a correct agent
18
- gives. `oxy test` runs the target agent on every prompt several times and asks an LLM judge
19
- whether each answer carries the expected facts.
19
+ gives. `oxyc evals run` has the Oxy deployment run the target agent on every prompt several
20
+ times and ask an LLM judge whether each answer carries the expected facts.
20
21
 
21
22
  Drafting the tests and repairing the agent are one loop:
22
23
 
@@ -35,7 +36,7 @@ Reference docs (field tables, CI usage):
35
36
 
36
37
  ## What can be tested
37
38
 
38
- - **Only `.agentic.yml` agents.** `oxy test` rejects any other target, including classic
39
+ - **Only `.agentic.yml` agents.** The eval engine rejects any other target, including classic
39
40
  `.agent.yml` agents (that runtime was removed). Inline `tests:` blocks inside agent or
40
41
  automation files are gone too. A `.test.yml` file is the only entry point.
41
42
  - **Only the final answer text is judged.** The judge sees the question, `expected`, and the
@@ -64,10 +65,12 @@ cases:
64
65
  Rules the parser enforces:
65
66
 
66
67
  - **Unknown keys are rejected at every level** (file, `settings`, each case). A typo such as
67
- `judge-model:` or `expect:` makes the file fail to parse. Run with an explicit file and you
68
- get `Failed to deserialize test config …`. **Run `oxy test` with no file and a broken file
69
- is skipped silently.** It just isn't in the run, with no error. After editing a test file,
70
- run it by path once.
68
+ `judge-model:` or `expect:` makes the file fail to parse. Run it by path and
69
+ `oxyc evals run` exits `6` with `Failed to deserialize test config …`. **Run with no file
70
+ and a broken file is skipped silently.** It just isn't in the run, with no error. A file
71
+ that isn't valid YAML, or has no `cases:` list, isn't compiled at all, so by path it answers
72
+ exit `5` (not in the served revision), as if it had never been pushed. After pushing a test
73
+ file, run it by path once.
71
74
  - **`prompt` and `expected` are required strings.** Everything else is optional.
72
75
  - **`target`** is resolved from the project root (the directory holding `config.yml`). If you
73
76
  omit it, it's inferred from the filename, in the same directory: `sales.agentic.test.yml`
@@ -80,8 +83,8 @@ Rules the parser enforces:
80
83
  different model family than the agent's, to avoid self-preference bias.
81
84
 
82
85
  Naming and placement: `<agent-stem>.<topic>.test.yml` (for example
83
- `sales.performance.test.yml`) in the folder the project already uses for tests. Discovery
84
- (`oxy test` with no file) finds every `*.test.yml` in the project, except under hidden
86
+ `sales.performance.test.yml`) in the folder the project already uses for tests. With no file,
87
+ `oxyc evals run` runs every `*.test.yml` the workspace compiled, except under hidden
85
88
  (dot-prefixed) directories and `target/`, `node_modules/`, `dist/` or `build/`.
86
89
 
87
90
  ## When to write evals
@@ -155,42 +158,59 @@ More worked examples, and the evidence rules for each kind of question:
155
158
 
156
159
  ## Running
157
160
 
158
- Run from the project root (the directory holding `config.yml`). The file argument is resolved
159
- from your current directory, and `target` from the project root.
161
+ Evals run on the Oxy deployment, on its worker fleet, with `oxyc evals run` (install with
162
+ `npm i -g @oxy-hq/cli`, sign in with `oxyc login`). The deployment runs the test files and
163
+ agents the workspace has **compiled**: its served revision, what was pushed, not the files in
164
+ your checkout. Push a new or edited `.test.yml` (and the agent change it tests) first; a test
165
+ file the deployment has not compiled answers exit `5`. The file argument is the test file's
166
+ path in the workspace, from the project root (the directory holding `config.yml`), and
167
+ `target` is resolved from the project root too.
160
168
 
161
169
  ```bash
162
- oxy test tests/sales.performance.test.yml # one file
163
- oxy test tests/sales.performance.test.yml --case total-revenue-2025 --output-json
164
- oxy test tests/sales.performance.test.yml --case 0 --output-json # by 0-based index
165
- oxy test tests/sales.performance.test.yml --tag critical --output-json # by tag
166
- oxy test # every *.test.yml
167
- oxy test --min-accuracy 0.8 --quiet # CI gate, exit 1 below
170
+ oxyc evals run tests/sales.performance.test.yml --workspace <id> # one file: wait, summarise
171
+ oxyc evals run tests/sales.performance.test.yml --workspace <id> --case total-revenue-2025 --output-json
172
+ oxyc evals run tests/sales.performance.test.yml --workspace <id> --case 0 --output-json # by 0-based index
173
+ oxyc evals run tests/sales.performance.test.yml --workspace <id> --tag critical --output-json
174
+ oxyc evals run --workspace <id> # every compiled *.test.yml
175
+ oxyc evals run --workspace <id> --min-accuracy 0.8 # CI gate, exit 9 below
176
+ oxyc evals run <file> --workspace <id> --detach # print the run id
177
+ oxyc evals wait <run-id> --workspace <id> --json # results on stdout
168
178
  ```
169
179
 
170
180
  - `--case` takes a 0-based index, a case `name`, or the exact prompt. It requires a file. With
171
181
  `--tag` as well, a case must match both. If two cases share a name, the first one runs.
172
182
  - `--tag` takes one tag.
173
- - `--output-json` writes the full results next to the test file, replacing `.yml` with
183
+ - `--output-json [file]` writes the full results document to the file you name or, with none,
184
+ to the test file's path (relative to your current directory) with `.yml` replaced by
174
185
  `.results.json` (`tests/sales.performance.test.results.json`). With no file argument it
175
- writes `test-results.json` in the current directory. `--format json` prints the same JSON
176
- to stdout instead of the pretty report.
177
- - `-v` adds each failing run's actual output to the pretty report. `-q` shows only the
186
+ writes `test-results.json`. `--json` prints the same document to stdout instead of the
178
187
  summary.
188
+ - The summary prints one line per test file (its Correctness score and how many runs
189
+ answered), then the prompt of every run that didn't pass. The judge's reasoning and the
190
+ actual answers are only in the results document.
191
+ - `--regrade <results.json>` grades a results file's recorded answers again, without running
192
+ the agent. It needs the test file the results came from, and can't be combined with
193
+ `--case` or `--tag`.
179
194
  - `--min-accuracy` compares **per-file** scores. `--threshold-mode average` (the default)
180
195
  checks the mean across files, and `all` checks every file. It doesn't check individual
181
196
  cases.
197
+ - Exit codes: `1` the run failed, was cancelled or timed out, `4` not signed in or not a
198
+ member of the workspace, `5` not found (or not compiled yet), `6` the test file does not
199
+ parse or `--case` matched nothing, `7` retryable (or `--wait <seconds>` ran out; the run
200
+ goes on), `9` below `--min-accuracy`.
182
201
  - **Cost:** every case runs `runs` times through the full agent, plus one judge call per run,
183
202
  with `concurrency` runs against the warehouse at once. When you iterate, run one case.
184
203
 
185
204
  ## Reading results
186
205
 
187
- The pretty report gives one line per case:
206
+ The summary names each file's score and the prompts that failed. For the rest, read the
207
+ results document (`--output-json`, or `--json`) and group its records by `prompt`:
188
208
 
189
- | Status | Meaning |
209
+ | A case's runs | Meaning |
190
210
  | --- | --- |
191
- | `PASS (3/3)` | every run passed |
192
- | `FLKY (1/3)` | some runs passed. The answer is unstable, which is a real defect |
193
- | `FAIL (0/3)` | no run passed |
211
+ | every run `PASS` | passing |
212
+ | some runs `PASS` | flaky. The answer is unstable, which is a real defect |
213
+ | no run `PASS` | failing |
194
214
 
195
215
  The file's **Correctness** score is the mean over every case × run. Each run scores 1 (PASS)
196
216
  or 0 (FAIL). There's no partial credit.
@@ -250,7 +270,7 @@ apart from mechanical edits such as adding a missing `name:`.
250
270
  ### 1. Reproduce
251
271
 
252
272
  ```bash
253
- oxy test <file> --case <name> --output-json
273
+ oxyc evals run <file> --workspace <id> --case <name> --output-json
254
274
  ```
255
275
 
256
276
  Read every run of that case: `expected`, `actual_output`, `cot`, `choice`.
@@ -261,10 +281,10 @@ The results JSON has only the final answer. To see the path, run the same prompt
261
281
  and read the events:
262
282
 
263
283
  ```bash
264
- oxy agentic run <path/to/agent.agentic.yml> -q "<the case's prompt>" --json
284
+ oxyc agentic run <path/to/agent.agentic.yml> -q "<the case's prompt>" --json --workspace <id>
265
285
  ```
266
286
 
267
- This streams the run's events as JSON lines and needs `OXY_DATABASE_URL`. Look at
287
+ This runs the deployed agent, as the evals do, and streams the run's events as JSON lines. Look at
268
288
  `query_executed`: its `query`, its `rows`, and its `source`. `source` is `semantic` (compiled
269
289
  by the semantic model), `llm` (SQL the model wrote), `verified_sql` (a Verified Query), or
270
290
  `vendor`. Also look at `analytics_validation_failed`, the checks that bounced the agent. If
@@ -314,16 +334,20 @@ all of them. Preserve the file's existing style. Explain the root cause alongsid
314
334
 
315
335
  ### 5. Validate
316
336
 
317
- There's no build step. `oxy test` reloads the agent file, its context and its semantic files
318
- from disk on every run, and `oxy build` (which does nothing any more) plays no part. Check
319
- the files you edited, then re-run:
337
+ Evals read the workspace's served revision, so a repair counts only once it is pushed and
338
+ compiled. Check the files you edited, push them to the branch the workspace serves, wait for
339
+ the deployment to compile it, then re-run:
320
340
 
321
341
  ```bash
322
- oxy validate agents/sales.agentic.yml
323
- oxy validate semantics/views/orders.view.yml
324
- oxy test <file> --case <name> --output-json
342
+ oxyc validate --file agents/sales.agentic.yml
343
+ oxyc validate --file semantics/views/orders.view.yml
344
+ oxyc evals run <file> --workspace <id> --case <name> --output-json # after the push compiled
325
345
  ```
326
346
 
347
+ A run started before the compile finished scores the previous revision. `oxyc compile
348
+ <branch> --wait` checks that a branch compiles before you merge it, but its staging revision
349
+ is never served, so evals don't see it.
350
+
327
351
  **One pass isn't proof.** A case needs `runs`/`runs` on at least two rounds. Then run the
328
352
  whole file to catch regressions in other cases. If the repair doesn't hold after three
329
353
  diagnose-edit-validate cycles, stop and report what you know.
@@ -4,8 +4,8 @@ Diagnose before editing. For every failing or flaky case, collect:
4
4
 
5
5
  1. Every run's `actual_output`, `cot` and `choice` from the results JSON
6
6
  ([results-json.md](results-json.md)).
7
- 2. The route the agent took, from `oxy agentic run <agent> -q "<prompt>" --json`. Run it two
8
- or three times if the case is flaky. Read `query_executed.source` and `query`, and any
7
+ 2. The route the agent took, from `oxyc agentic run <agent> -q "<prompt>" --json --workspace <id>`.
8
+ It runs the deployed (pushed) agent, as `oxyc evals run` does. Run it two or three times if the case is flaky. Read `query_executed.source` and `query`, and any
9
9
  `analytics_validation_failed` events.
10
10
  3. The files the agent actually loads: the `context:` globs in its `.agentic.yml`, resolved
11
11
  relative to that file's directory. A view, doc or SQL file outside those globs doesn't
@@ -238,6 +238,8 @@ that make the agent sound as if it can answer.
238
238
  3. Instructions: global first, then per-state.
239
239
  4. Validation tuning.
240
240
 
241
- After each change, `oxy validate <edited file>`, then re-run the case at least twice
242
- (`oxy test <file> --case <name> --output-json`), then the whole file. Nothing needs to be
243
- rebuilt between edits. Stop after three cycles that don't hold, and report.
241
+ After each change, `oxyc validate --file <edited file>`, push it, and once the deployment has
242
+ compiled it re-run the case at least twice
243
+ (`oxyc evals run <file> --workspace <id> --case <name> --output-json`), then the whole file.
244
+ Evals read the served revision, so an edit counts only once it is pushed and compiled. Stop
245
+ after three cycles that don't hold, and report.
@@ -1,13 +1,20 @@
1
- # Reading `oxy test` results
1
+ # Reading eval results
2
2
 
3
- `oxy test <file> --output-json` writes `<file without .yml>.results.json` next to the test
4
- file (`tests/sales.performance.test.yml` → `tests/sales.performance.test.results.json`).
5
- Without a file argument it writes `test-results.json` in the current directory.
6
- `--format json` prints the same document on stdout.
3
+ `oxyc evals run <file> --output-json` writes `<file without .yml>.results.json` at the test
4
+ file's path, relative to the current directory (`tests/sales.performance.test.yml` →
5
+ `tests/sales.performance.test.results.json`), or to the file you name after `--output-json`.
6
+ Without a file argument it writes `test-results.json`. `--json` prints the same document on
7
+ stdout.
8
+
9
+ It is the text the deployment's run produced, byte for byte the document the older local
10
+ `oxy test --output-json` wrote, so the shape below holds for both.
7
11
 
8
12
  ## Shape
9
13
 
10
- The file is a JSON array with **one element per test file**:
14
+ The file is a JSON array with **one element per test file**. Keys appear in the order below
15
+ except `test_name`, which is written last; every record also carries `llm_rounds`, and
16
+ optional fields (`final_sql`, `answer_text`, `timing`, `runtime`, `model`, …) appear only when
17
+ set:
11
18
 
12
19
  ```jsonc
13
20
  [
@@ -22,7 +29,7 @@ The file is a JSON array with **one element per test file**:
22
29
  },
23
30
  "metrics": [
24
31
  {
25
- "type": "Correctness", // the only metric `oxy test` produces
32
+ "type": "Correctness", // the only metric an eval produces
26
33
  "score": 0.6667, // mean of every record's score in this file
27
34
  "records": [
28
35
  {
@@ -119,11 +126,12 @@ jq -r '.[].errors[]' "$R"
119
126
  The results only show answers. To see the route an answer took, replay the prompt:
120
127
 
121
128
  ```bash
122
- oxy agentic run <path/to/agent.agentic.yml> -q "<prompt>" --json
129
+ oxyc agentic run <path/to/agent.agentic.yml> -q "<prompt>" --json --workspace <id>
123
130
  ```
124
131
 
125
- This needs `OXY_DATABASE_URL` (a Postgres URL; the command records the run there). It prints
126
- one JSON object per line, `{"seq", "event_type", "payload"}`. The events that matter for
132
+ It runs the agent the deployment has compiled (push first), as the evals do, and needs only an
133
+ `oxyc` login. It prints one JSON object per line, `{"seq", "event_type", "payload"}`; each
134
+ `payload` also carries the run's `attempt`. The events that matter for
127
135
  diagnosis:
128
136
 
129
137
  | `event_type` | What to read in `payload` |
@@ -137,9 +145,9 @@ diagnosis:
137
145
  Run it two or three times for a flaky case. Different `source` values or different SQL across
138
146
  runs is the flakiness, made visible.
139
147
 
140
- ## The pretty report
148
+ ## The summary
141
149
 
142
- Without `--format json`, each case prints as `PASS (n/n)`, `FLKY (k/n)` or `FAIL (0/n)`,
143
- followed by the file's Correctness score and a `Failures:` section with the judge's reasoning.
144
- `-v` adds each failing run's actual answer, and `-q` prints only the summary. The footer gives
145
- the overall `Tests: x/y passed`, the answer rate, the time taken and the token totals.
150
+ Without `--json`, `oxyc evals run` prints one line per test file (its name, the Correctness
151
+ score and `answered x/y`), then, indented, `FAIL` and the prompt of every run that didn't
152
+ pass. The judge's reasoning, the actual answers and the errors are only in the results
153
+ document.
@@ -108,5 +108,6 @@ resolves relative dates against today in its `timezone:` (UTC when unset).
108
108
  - [ ] No schema, view or column names the user wouldn't say.
109
109
  - [ ] No `expected` was copied from a single run without agreement or verification.
110
110
  - [ ] Uncertain cases carry a narrowed `DRAFT:` note, not an invented value.
111
- - [ ] The file parses: run it by path once (`oxy test <file> --case 0`). Discovery skips a
112
- broken file silently.
111
+ - [ ] The file parses: once it is pushed, run it by path
112
+ (`oxyc evals run <file> --workspace <id> --case 0`). A run with no file skips a broken
113
+ file silently.
@@ -232,9 +232,10 @@ before passing `--yes` — say which design (`design <name>` prints its hash).
232
232
  - A report: state its `verdict` (not a bare "significant"), and repeat every
233
233
  line under `assumptions` — a switchback's carryover and pull-forward
234
234
  assumptions are part of the result.
235
- - `write-back <name>` opens a branch writing the measured coefficient into the
236
- World Model file. It needs the deployment that holds the workspace's working
237
- copy (503 elsewhere); review the branch like any other change.
235
+ - A report may propose a measured coefficient for a World Model edge
236
+ (`write_back` in the result: the file, edge and value). Oxygen does not write
237
+ the repository: make that edit in the workspace's repository (`oxyc workspace
238
+ clone`) and push it like any other change.
238
239
 
239
240
  ## Branch on exit codes
240
241
 
@@ -311,22 +311,24 @@ pre_aggregations:
311
311
 
312
312
  ## Validating a change
313
313
 
314
- - **`oxy validate --file semantics/views/orders.view.yml`** parses one view or
315
- topic file and reports where it fails — a bare boolean in `samples`, a
316
- missing `entities:` or `dimensions:` list, a removed feature. Run it on every
317
- file you touch. It does **not** look inside `pre_aggregations:` or
314
+ - **`oxyc validate --file semantics/views/orders.view.yml`** checks one view or
315
+ topic file offline and reports where it fails — a bare boolean in `samples`,
316
+ a missing `entities:` or `dimensions:` list, a removed feature
317
+ (`inherits_from:`, `{{ globals.* }}`), a malformed `{{variables.x}}`. Run it
318
+ on every file you touch. It does **not** look inside `pre_aggregations:` or
318
319
  `refresh_key:`; mistakes there surface only when the model is loaded for a
319
- query.
320
- - Bare **`oxy validate`** (every file) only looks in `semantics/views/` and
321
- `semantics/topics/`, while views and topics anywhere in the workspace
322
- compile. A view kept elsewhere is only checked with `--file`.
320
+ query. (`oxy validate` is a stub now that prints this command.)
321
+ - Bare **`oxyc validate`** (every file) checks views and topics wherever they
322
+ are, as the compiler finds them — not only under `semantics/`. It exits `9`
323
+ when anything fails.
323
324
  - Neither checks **cross-file** wiring — an entity join that matches nothing,
324
325
  a topic naming a view that does not exist, a measure that a twin lacks. Run
325
326
  a real query through the topic before calling it done.
326
- - **`oxy build` does not validate the semantic model** — it does nothing any
327
- more. `oxy sync` writes table and column
328
- metadata to `.databases/`, which is the place to read real column names
329
- from.
327
+ - **`oxyc sync <database> --workspace <id>`** writes table and column metadata
328
+ to `.databases/`, which is the place to read real column names from. The
329
+ server introspects the warehouse from the DEPLOYED `config.yml` and `oxyc`
330
+ writes the files into the checkout (`-o` to replace existing ones). The old
331
+ `oxy sync` only prints this command now.
330
332
  - `inherits_from:` and `{{ globals.* }}` were removed from views; a file using
331
333
  either is refused at load. Inline the values.
332
334
 
@@ -27,9 +27,24 @@ case "$ENV" in
27
27
  *) HOST="" ;;
28
28
  esac
29
29
 
30
+ # Installed, and current. A cloud image can ship an oxyc older than the
31
+ # commands the docs and skills name (one shipped 0.11 when they named 0.12's
32
+ # `oxyc login --no-wait`), so an older one is upgraded, not only a missing one.
33
+ # A version this cannot read is left alone rather than replaced.
34
+ have=$(oxyc --version 2>/dev/null | tail -n 1)
30
35
  if ! command -v oxyc >/dev/null 2>&1; then
31
36
  npm install -g @oxy-hq/cli >/dev/null 2>&1 \
32
37
  || echo "oxyc: 'npm install -g @oxy-hq/cli' failed — run it before any oxyc command."
38
+ elif [[ $have =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
39
+ # A registry that does not answer costs 20 s at most, not the hook's budget.
40
+ limit=()
41
+ command -v timeout >/dev/null 2>&1 && limit=(timeout 20)
42
+ want=$("${limit[@]}" npm view @oxy-hq/cli version 2>/dev/null | tail -n 1)
43
+ if [[ $want =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [ "$want" != "$have" ] &&
44
+ [ "$(printf '%s\n%s\n' "$have" "$want" | sort -V | tail -n 1)" = "$want" ]; then
45
+ npm install -g "@oxy-hq/cli@$want" >/dev/null 2>&1 \
46
+ || echo "oxyc: $have is installed and 'npm install -g @oxy-hq/cli@$want' failed — commands newer than $have will not exist."
47
+ fi
33
48
  fi
34
49
 
35
50
  if [ -n "${CLAUDE_ENV_FILE:-}" ]; then
@@ -48,19 +63,36 @@ if [ -n "$HOST" ] && ! curl -fsS --max-time 10 -o /dev/null "https://$HOST/api/h
48
63
  echo " access must allow it (Custom: app.oxygen-hq.com, *.oxy.tech) — ask the user to add it."
49
64
  fi
50
65
 
51
- if [ -n "${OXY_TOKEN:-}" ]; then
66
+ if [ "${OXY_TOKEN:-}" = "from-proxy" ]; then
67
+ # The environment's network secret: its proxy adds Authorization on the way
68
+ # out, so no token is in this VM. A minted token file, sourced before every
69
+ # command, replaces the sentinel.
70
+ if [ -s "$TOKEN_FILE" ]; then
71
+ echo "oxyc: OXY_TOKEN=from-proxy, but the agent token in $TOKEN_FILE replaces it in every command."
72
+ elif command -v oxyc >/dev/null 2>&1 && ! oxyc whoami --env "$ENV" >/dev/null 2>&1; then
73
+ echo "oxyc: OXY_TOKEN=from-proxy (a network secret), but 'oxyc whoami --env $ENV' fails. Run it to"
74
+ echo " see why, and tell the user: the secret's Allowed websites must cover ${HOST:-the Oxy host}, with"
75
+ echo " header Authorization and prefix Bearer. Do not mint a token in its place without asking."
76
+ else
77
+ echo "oxyc: credential is the environment's network secret (OXY_TOKEN=from-proxy); no token is in this VM."
78
+ fi
79
+ elif [ -n "${OXY_TOKEN:-}" ]; then
52
80
  echo "oxyc: credential is OXY_TOKEN from the environment."
53
81
  elif [ -s "$TOKEN_FILE" ]; then
54
- echo "oxyc: credential is the agent token in $TOKEN_FILE (it expires: on exit 4, mint again)."
82
+ echo "oxyc: credential is the agent token in $TOKEN_FILE, good on the one deployment that minted it"
83
+ echo " (it expires: on exit 4, mint again)."
55
84
  else
56
85
  cat <<EOF
57
- oxyc: no Oxy credential yet. Before you publish or promote, mint an agent token — a person
58
- approves it once from any device, nothing opens here. Run this in the background:
86
+ oxyc: no Oxy credential yet. A token is good on one deployment (production, staging or dev), so
87
+ mint an agent token for the one the task uses. Start it with the Bash tool's run_in_background:
59
88
  mkdir -p ~/.config/oxy && (umask 077; oxyc tokens create --agent --no-browser --env $ENV >$TOKEN_FILE)
60
- and give the user the URL and code it prints. --approver <their email> (or OXY_APPROVER) also
61
- pushes the request to them. Once approved, every later command has OXY_TOKEN.
62
- It reaches what the approver's org memberships do, never staff access: staff shipping a
63
- customer's app need another path. See the oxy-custom-apps skill, "Headless and cloud sessions".
89
+ It ends only once a person approves, so do not wait for it: a few seconds in, Read the task's
90
+ output file for the approval URL and code (the token goes to the file, never to you) and give
91
+ both to the user. --approver <their email> (or OXY_APPROVER) also pushes the request to them.
92
+ Once approved, every later command has OXY_TOKEN. It reaches what the approver's org
93
+ memberships do, never staff access: no device-code approval grants that. To sign a browser in,
94
+ navigate to the one-time URL 'oxyc login-link --env $ENV --next <path>' prints, never to the
95
+ Google, GitHub or email sign-in. See the oxy-custom-apps skill, "Headless and cloud sessions".
64
96
  EOF
65
97
  fi
66
98
  exit 0
@@ -149,10 +149,10 @@ permissions:
149
149
  contents: read
150
150
 
151
151
  env:
152
- # The `@oxy-hq/cli` (`oxyc`) both jobs install, exactly. Its own pin, not
153
- # validate.yaml's `OXY_VERSION`: that one is the Rust `oxy` that validates the
154
- # workspace, a different tool on a different release line. `--build-only` and
155
- # `--prebuilt`, which the two jobs below depend on, arrived in 0.4.0.
152
+ # The `@oxy-hq/cli` (`oxyc`) both jobs install, exactly — the same pin as
153
+ # validate.yaml's `OXYC_VERSION`, raised together on every release.
154
+ # `--build-only` and `--prebuilt`, which the two jobs below depend on,
155
+ # arrived in 0.4.0.
156
156
  #
157
157
  # THE PIN DECIDES WHICH OIDC REGISTRATION THE PUBLISH JOB CAN USE. Through
158
158
  # 0.6.0, `oxyc publish` knows one exchange: the app's own registered
@@ -160,7 +160,7 @@ env:
160
160
  # service account are honoured from 0.7.0, which tries them first and falls
161
161
  # back to the publisher. A pin older than that still publishes, through the
162
162
  # publisher alone.
163
- OXYC_VERSION: "0.12.0"
163
+ OXYC_VERSION: "0.13.0"
164
164
 
165
165
  jobs:
166
166
  build: