@nouter/platform-cli 0.4.0 → 0.5.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 (3) hide show
  1. package/README.md +143 -0
  2. package/dist/index.js +2497 -290
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -60,6 +60,7 @@ nouter-platform login --paste # paste code#state, for a remote session
60
60
  nouter-platform whoami --json
61
61
  nouter-platform agents list
62
62
  nouter-platform agents get <agent-id>
63
+ nouter-platform agents archive <agent-id> --yes
63
64
  nouter-platform environments list
64
65
  nouter-platform environments get <environment-id>
65
66
  nouter-platform apply -f ./resources --dry-run
@@ -68,6 +69,9 @@ nouter-platform elevate
68
69
  nouter-platform logout
69
70
  ```
70
71
 
72
+ Every command has its own help: `nouter-platform usage --help` prints its
73
+ usage, its flags and its examples; `nouter-platform help usage` does the same.
74
+
71
75
  `login --api-key` is the non-interactive path for CI and for terminals without
72
76
  a browser. The key is read from stdin and never from `argv`.
73
77
 
@@ -164,6 +168,145 @@ change.
164
168
  preset). A document with `_oma.retention` also needs `agents:admin`, which only
165
169
  an `admin` or `owner` login has.
166
170
 
171
+ ## Evals
172
+
173
+ `eval` runs an eval suite against an agent and scores what the suite declares. Each case is a conversation with
174
+ one or more graders; a case passes when its mean reaches the threshold. A suite is a directory of files kept in
175
+ the repo:
176
+
177
+ ```text
178
+ evals/
179
+ ├── suite.yaml # optional: agent, environment, threshold, runs, timeout, budget
180
+ └── refund-policy/
181
+ ├── prompt.md # frontmatter + body: the user message
182
+ ├── case.yaml # optional: several turns, setup, canary or budget
183
+ └── graders/
184
+ └── mentions-30-days.md # frontmatter: type and options; body: the pattern or script
185
+ ```
186
+
187
+ A minimal case is two files: `prompt.md` with the message and a grader under `graders/`. `suite.yaml` can set
188
+ `agent` and `environment`; `--agent` and `--environment` override them.
189
+
190
+ ```yaml
191
+ # evals/suite.yaml
192
+ schema_version: "1"
193
+ name: support-agent
194
+ agent: agent_...
195
+ environment: env_...
196
+ threshold: 0.8
197
+ runs: 3
198
+ budget_per_case: "50"
199
+ ```
200
+
201
+ ```markdown
202
+ <!-- evals/refund-policy/prompt.md -->
203
+ ---
204
+ tags: [smoke]
205
+ ---
206
+ Can I return an opened product?
207
+ ```
208
+
209
+ ```markdown
210
+ <!-- evals/refund-policy/graders/mentions-30-days.md -->
211
+ ---
212
+ type: regex
213
+ ---
214
+ 30 days
215
+ ```
216
+
217
+ ```bash
218
+ nouter-platform eval ./evals
219
+ nouter-platform eval ./evals --agent <agent-id> --environment <environment-id> --threshold 0.9 --runs 5
220
+ nouter-platform eval ./evals --case 'refund-*' --tag smoke --json > eval-results.json
221
+ ```
222
+
223
+ | Flag | What it does |
224
+ | --- | --- |
225
+ | `--agent <agent-id>` | The agent to evaluate; required when `suite.yaml` does not set it. |
226
+ | `--environment <environment-id>` | The environment for the Sessions; required when `suite.yaml` does not set it. |
227
+ | `--threshold <0..1>` | The minimum for each case; defaults to 1. Overrides the manifest. |
228
+ | `--runs <1..20>` | The trials per case; defaults to 3. Overrides the manifest. |
229
+ | `--concurrency <1..32>` | The trials at a time; defaults to 4. Overrides the manifest. |
230
+ | `--case <glob>` | Filters by name, with `*` and `?`; may be repeated. |
231
+ | `--tag <tag>` | Filters by tag; may be repeated. |
232
+ | `--agent-version <n>` | Pins the expected version: if the agent is on another one, it fails before running anything. |
233
+ | `--wait-timeout <seconds>` | The cap for polling the run; defaults to 3600. |
234
+ | `--keep` | Keeps the ephemeral benchmark and run and prints their ids, for debugging. |
235
+ | `--json` | Prints the versioned report on stdout, without the table. |
236
+
237
+ `[<dir>]` is the suite directory and defaults to `evals`. It must be relative and cannot contain `..`. The
238
+ `--case` and `--tag` filters apply before the run is created: a filter that leaves no cases is `NO_CASES`.
239
+
240
+ ### CI use
241
+
242
+ The command exits 0 only when every case reached the threshold and none ended with an error. In CI the exit code
243
+ is the gate, and the JSON is archived:
244
+
245
+ ```bash
246
+ nouter-platform eval ./evals --json > eval-results.json
247
+ ```
248
+
249
+ ```yaml
250
+ # GitHub Actions: the step fails only on a non-zero exit code
251
+ - run: nouter-platform eval ./evals --json > eval-results.json
252
+ ```
253
+
254
+ | Code | When |
255
+ | --- | --- |
256
+ | 0 | Every case scored at or above the threshold, with no errors. |
257
+ | 1 | A case below the threshold or with an error, the suite did not load, the run failed, or the API failed. |
258
+ | 64 | Invalid command usage: an unknown flag, an out-of-range value, or an absolute directory or one with `..`. |
259
+ | 130 | Interrupted with SIGINT (Ctrl-C) or SIGTERM. |
260
+
261
+ It also exits 1 when the agent version changed during the run: the report is not comparable.
262
+
263
+ A code 2 is not used: there is no partial run. The report (`--json` or the table) goes only to stdout; errors go
264
+ only to stderr, with the `{ "error": { "code": "..." } }` envelope. As soon as the run exists its id is printed
265
+ (`run <id> created; <n> cases`): on stdout without `--json`, and on stderr with `--json`, so stdout keeps a single
266
+ JSON document. With `--json`, stderr is therefore not pure JSON: the run id line comes before any error envelope.
267
+ If the process is interrupted it prints `interrupted; run <id> keeps running on the platform` on stderr and exits
268
+ 130 with no JSON: the run is not cancelled.
269
+
270
+ ### Cost
271
+
272
+ Each run pays for `cases × runs` managed Sessions plus sandbox. The CLI prints that number and the concurrency
273
+ before creating the run. `--runs 1` is for iterating; use 3 to trust a change. The only per-conversation cap is
274
+ the case `budget` (`budget` in `case.yaml` or `budget_per_case` in `suite.yaml`), in cents; the organization spend
275
+ caps are the overall ceiling. There is no per-run cost ceiling and no confirmation: review the size of the suite
276
+ and of each case before running it, because `cases × runs` is what you pay.
277
+
278
+ `apply --require-eval <suite>` pays for a full suite before applying and is opt-in: without the flag, `apply`
279
+ spends no model. The gate has no `--json`; it prints the human report and, if the run does not pass, writes
280
+ nothing and exits 1. Every `env` value of the document must come from `${VAR}`: a `"***"`, which `apply` accepts
281
+ to keep the stored secret, fails with this message and writes nothing:
282
+
283
+ ```text
284
+ --require-eval needs every env value via ${VAR}; nothing was written
285
+ ```
286
+
287
+ ### Security
288
+
289
+ Cases are repo files and get committed: they carry no secrets. The CLI does not interpolate `${VAR}` in the
290
+ suite, so a `${VAR}` in a case stays literal; there is no `.env` in messages, `setup_script` or `setup_files`. The
291
+ report carries ids, numbers, case and grader names and the server error, never the content of the cases or the
292
+ API key. Parse errors show path, line and column, not the text of the line.
293
+
294
+ The agent runs in a managed Session with the requested environment. `setup_script` and the `script` grader run in
295
+ the sandbox of that Session, not on the machine that launches the command; the network depends on what the
296
+ environment allows, and their stdout/stderr is not printed: only the verdict and the exit code. The Session does
297
+ not mount the repo.
298
+
299
+ The `apply --require-eval` candidate is a real agent of the organization and runs with the real environment and
300
+ MCP credentials of the document. A suite can have side effects (writing files, calling APIs): design the cases
301
+ with that in mind.
302
+
303
+ On SIGINT (Ctrl-C) or SIGTERM during a gate run, the CLI stops waiting for the run, archives the candidate agents that
304
+ run created (and waits for an archive already in progress), with a 10-second limit in total, and exits 130 without
305
+ applying anything, even if the run had just passed; a second signal exits at once. Whatever it could not archive is
306
+ listed on stderr (`warning: could not archive these eval agents: ...`). Find leftover agents named `*-eval-*` with
307
+ `nouter-platform agents list --json` and archive them with `nouter-platform agents archive <id> --yes`, which needs
308
+ `agents:admin` or an elevated session.
309
+
167
310
  ## Feedback
168
311
 
169
312
  Report product bugs, feature requests and questions at