@nouter/platform-cli 0.3.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.
- package/README.md +211 -6
- package/dist/index.js +4804 -705
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,24 +55,77 @@ any URL. A config without a stored URL is not used either: run `login` again.
|
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
nouter-platform login --api-key # reads the key from stdin
|
|
58
|
-
nouter-platform login --browser # the console approves it
|
|
59
|
-
nouter-platform
|
|
58
|
+
nouter-platform login --browser # the console approves it; a loopback server gets the code
|
|
59
|
+
nouter-platform login --paste # paste code#state, for a remote session
|
|
60
|
+
nouter-platform whoami --json
|
|
60
61
|
nouter-platform agents list
|
|
61
62
|
nouter-platform agents get <agent-id>
|
|
63
|
+
nouter-platform agents archive <agent-id> --yes
|
|
62
64
|
nouter-platform environments list
|
|
63
65
|
nouter-platform environments get <environment-id>
|
|
64
66
|
nouter-platform apply -f ./resources --dry-run
|
|
67
|
+
nouter-platform auth sessions list
|
|
68
|
+
nouter-platform elevate
|
|
65
69
|
nouter-platform logout
|
|
66
70
|
```
|
|
67
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
|
+
|
|
68
75
|
`login --api-key` is the non-interactive path for CI and for terminals without
|
|
69
76
|
a browser. The key is read from stdin and never from `argv`.
|
|
70
77
|
|
|
71
|
-
`login --browser`
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
`login --browser` opens the console at `/cli/login` and waits for the approval
|
|
79
|
+
on a loopback server; the code never shows in the terminal. `login --paste`
|
|
80
|
+
prints the console URL and reads `code#state` from stdin without echo, for a
|
|
81
|
+
remote session (SSH, Codespaces or Linux without a display). With no flag the
|
|
82
|
+
CLI detects a remote session and picks paste mode, saying which signal it saw;
|
|
83
|
+
`--browser` and `--paste` win over the detection. The session is stored in
|
|
84
|
+
0600 inside a 0700 directory; a file another user can read is rejected with
|
|
85
|
+
`STORAGE_INSECURE` (exit 77).
|
|
86
|
+
|
|
87
|
+
`logout` revokes the session in the server and then removes the local
|
|
88
|
+
credential; if the server does not answer it removes the local one and exits 2.
|
|
89
|
+
`logout --all` revokes every session of the user. `auth sessions list` and
|
|
90
|
+
`auth sessions revoke <session-id>` manage the sessions, and `elevate` renews the
|
|
91
|
+
two-hour step-up that the destructive verbs ask for. With `--json`, errors
|
|
92
|
+
carry a stable `error.code` and the CLI exits 0, 2, 64, 75, 77 or 130.
|
|
93
|
+
|
|
94
|
+
## Sessions and usage
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
nouter-platform sessions list --agent <agent-id> --status idle --since 2026-11-01
|
|
98
|
+
nouter-platform sessions get <session-id>
|
|
99
|
+
nouter-platform sessions events <session-id> --type span.model_request_end
|
|
100
|
+
nouter-platform usage --days 7 --group-by day,model
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`sessions` reads agent sessions, not the login sessions of `auth sessions`.
|
|
104
|
+
`list` filters by `--agent`, `--agent-version`, `--user-profile`, `--status`,
|
|
105
|
+
`--since`/`--until` and `--order`, and `--include-archived` adds the archived
|
|
106
|
+
ones. `get` prints the detail, its stats and its cost, and `events` prints the
|
|
107
|
+
trace of the session, one line per event: a `span.model_request_end` shows the
|
|
108
|
+
tokens of that request, and the body of the model request is not in the API
|
|
109
|
+
yet. The three accept `--json` for the raw response.
|
|
110
|
+
|
|
111
|
+
`usage` reads the cost ledger in one page. `--days 7|30|90` sets the window
|
|
112
|
+
(default 30) or `--since`/`--until` give a range; `--group-by` takes up to five
|
|
113
|
+
of `day`, `model`, `agent`, `agent_version`, `user_profile` and `session`, with
|
|
114
|
+
`day` as the default, and `--user-profile` filters the rows. When the response
|
|
115
|
+
has a `next_page`, the command prints the full command that repeats the page on
|
|
116
|
+
stderr and exits 0; it repeats the `--group-by`, `--since`/`--until`,
|
|
117
|
+
`--user-profile` and `--limit` that were used, because the cursor alone does not
|
|
118
|
+
reproduce the query, and it quotes the cursor when the shell would interpret it.
|
|
119
|
+
`--json` prints the whole response, including `models`, `sessions` and
|
|
120
|
+
`line_items`, and the same warning goes to stderr.
|
|
121
|
+
|
|
122
|
+
`sessions` needs `sessions:read` on a **workspace** credential; an organization
|
|
123
|
+
key gets a 403 `workspace_required`. `usage` needs `usage:read`: an
|
|
124
|
+
organization key sees the whole organization and a workspace key only its own.
|
|
74
125
|
|
|
75
|
-
|
|
126
|
+
The two commands report cost in different units, and neither one converts:
|
|
127
|
+
`sessions` shows `usage.list_cost.amount` in cents (`"4"` is `$0.04`), and
|
|
128
|
+
`usage` shows `cost_micros` in micro-USD (`"3402110"` is `$3.402110`).
|
|
76
129
|
|
|
77
130
|
## Apply
|
|
78
131
|
|
|
@@ -115,6 +168,158 @@ change.
|
|
|
115
168
|
preset). A document with `_oma.retention` also needs `agents:admin`, which only
|
|
116
169
|
an `admin` or `owner` login has.
|
|
117
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
|
+
|
|
310
|
+
## Feedback
|
|
311
|
+
|
|
312
|
+
Report product bugs, feature requests and questions at
|
|
313
|
+
https://github.com/Nouter-ai/feedback. Use the "Bug report / Error", "Feature
|
|
314
|
+
request / Funcionalidad" or "Question / Pregunta" form. In the "Product /
|
|
315
|
+
Producto" field, "This feedback channel / Este canal de feedback" is for
|
|
316
|
+
feedback about the channel itself.
|
|
317
|
+
Only bugs and features of Nouter products.
|
|
318
|
+
What a single customer needs belongs to that customer's implementation, not to
|
|
319
|
+
an issue. Never include customer data. Agents: read
|
|
320
|
+
https://github.com/Nouter-ai/feedback/blob/main/AGENTS.md before opening one.
|
|
321
|
+
Security issues go through the repository's private vulnerability reporting.
|
|
322
|
+
|
|
118
323
|
## License
|
|
119
324
|
|
|
120
325
|
Apache-2.0. See `LICENSE` and `NOTICE`.
|