@nouter/platform-cli 0.5.0 → 0.6.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 (4) hide show
  1. package/CHANGELOG.md +445 -0
  2. package/README.md +183 -14
  3. package/dist/index.js +3936 -815
  4. package/package.json +6 -3
package/README.md CHANGED
@@ -63,6 +63,28 @@ nouter-platform agents get <agent-id>
63
63
  nouter-platform agents archive <agent-id> --yes
64
64
  nouter-platform environments list
65
65
  nouter-platform environments get <environment-id>
66
+ nouter-platform workspaces list
67
+ nouter-platform workspaces get <workspace-id>
68
+ nouter-platform workspaces archive <workspace-id> --yes
69
+ nouter-platform workspaces rate-limits <workspace-id>
70
+ nouter-platform workspaces rate-limits set <workspace-id> --model <model> --limiter <limiter> --value <n>
71
+ nouter-platform webhooks list
72
+ nouter-platform webhooks create --url <https-url> --event session.status_idled
73
+ nouter-platform webhooks get <webhook-id>
74
+ nouter-platform webhooks update <webhook-id> --status active
75
+ nouter-platform webhooks delete <webhook-id> --yes
76
+ nouter-platform webhooks deliveries <webhook-id>
77
+ nouter-platform webhooks regenerate-signing-secret <webhook-id> --yes
78
+ nouter-platform deployments list --agent <agent-id> --status active
79
+ nouter-platform deployments get <deployment-id>
80
+ nouter-platform deployments create -f deployment.yaml
81
+ nouter-platform deployments update <deployment-id> -f patch.yaml
82
+ nouter-platform deployments pause <deployment-id>
83
+ nouter-platform deployments unpause <deployment-id>
84
+ nouter-platform deployments archive <deployment-id> --yes
85
+ nouter-platform deployments run <deployment-id>
86
+ nouter-platform deployment-runs list --deployment <deployment-id>
87
+ nouter-platform deployment-runs get <run-id>
66
88
  nouter-platform apply -f ./resources --dry-run
67
89
  nouter-platform auth sessions list
68
90
  nouter-platform elevate
@@ -127,14 +149,85 @@ The two commands report cost in different units, and neither one converts:
127
149
  `sessions` shows `usage.list_cost.amount` in cents (`"4"` is `$0.04`), and
128
150
  `usage` shows `cost_micros` in micro-USD (`"3402110"` is `$3.402110`).
129
151
 
152
+ ## Deployments
153
+
154
+ ```bash
155
+ nouter-platform deployments create -f deployment.yaml
156
+ nouter-platform deployments list --agent <agent-id> --status active
157
+ nouter-platform deployments get <deployment-id>
158
+ nouter-platform deployments pause <deployment-id>
159
+ nouter-platform deployments run <deployment-id>
160
+ nouter-platform deployment-runs list --errors
161
+ ```
162
+
163
+ A deployment pins an agent version to an environment and fires it on a
164
+ schedule, on demand or on an event; each firing is a **deployment run**.
165
+ `create` and `update` read one YAML or JSON file with `-f`, and the file is the
166
+ request body of the API, with no wrapper; the server validates the schema, so
167
+ an unknown field is a `400`. `update` takes a partial document and `null`
168
+ clears the optional fields. A `github_repository` resource needs its
169
+ `authorization_token` as `${VAR}`: the CLI reads the variable from the
170
+ environment before the request, rejects a literal without printing it and does
171
+ not call the API when the variable is missing.
172
+
173
+ `pause`/`unpause` are reversible and ask no confirmation; `archive` asks
174
+ `--yes`, cannot be undone and is an elevated route. `run` fires the deployment
175
+ now with an `Idempotency-Key`, and a run with an `error` does not start a
176
+ session: the CLI prints the reason and exits 1, also with `--json`.
177
+
178
+ The ten commands need a **workspace** credential (a CLI session or a workspace
179
+ key); an organization key gets a 403 `workspace_required`. Reads need
180
+ `deployments:read`, create/update/pause/unpause/run need `deployments:write`
181
+ and archive needs `deployments:admin`. `deployment-runs list` filters by
182
+ `--deployment`, `--agent`, `--trigger schedule|manual|event`, `--errors` and
183
+ `--since`/`--until`; both lists read every page and accept `--json`.
184
+
185
+ ## Workspaces
186
+
187
+ ```bash
188
+ nouter-platform workspaces list --include-archived --json
189
+ nouter-platform workspaces get default
190
+ nouter-platform workspaces archive wrkspc_123 --yes
191
+ nouter-platform workspaces rate-limits wrkspc_123 --include-inherited
192
+ nouter-platform workspaces rate-limits set wrkspc_123 --model claude-sonnet-5-5 --limiter requests_per_minute --value 500
193
+ nouter-platform workspaces rate-limits set wrkspc_123 --model claude-sonnet-5-5 --limiter requests_per_minute --clear
194
+ ```
195
+
196
+ `list` follows the cursor and prints every page; `--json` prints the whole array.
197
+ `get` takes the id or `default` for the default workspace of the organization.
198
+
199
+ The family needs an **Admin API key** of the organization: `org_workspaces:read`
200
+ to read and `org_workspaces:admin` to archive or set a limit. A CLI session, or
201
+ a workspace key, gets a 403 `organization_required`.
202
+
203
+ Archiving can't be undone, so it asks for `--yes`; there is no prompt, and the
204
+ default workspace can't be archived (409 `default_workspace_immutable`). The
205
+ rate limits are `min(organization, workspace)`: `--include-inherited` shows the
206
+ organization value and the source of each row, `--value` sets the workspace
207
+ override and `--clear` removes it so the organization value applies again.
208
+
209
+ ## Webhooks
210
+
211
+ `webhooks` manages the webhook endpoints of the organization. Every command needs an Admin API key with
212
+ `webhooks:admin`, the reads included; a CLI session (`nps_`) gets a `403 organization_required` before the handler.
213
+ `create` and `regenerate-signing-secret` print the signing secret once on stdout and the metadata on stderr, so it can
214
+ be redirected to a secret store. The previous secret stops working as soon as a rotation returns: there is no grace
215
+ period. `delete` is hard and stops the deliveries, and both it and the rotation ask for `--yes`.
216
+
217
+ `create` sends the event types it receives and does not validate them: the server answers `400
218
+ webhook_event_type_invalid` and the CLI reports the status and the stable code. `update` sends only the fields given;
219
+ `--event` replaces the set, and `--status` takes `active` or `disabled`. `deliveries` reads one page, 20 by default and
220
+ up to 100, prints the next command on stderr when there is a cursor, and the record lives seven days. `--json` prints
221
+ the raw response: the array for `list` and the envelope with `has_more` and `next_page` for `deliveries`.
222
+
130
223
  ## Apply
131
224
 
132
225
  `apply` reconciles agents and environments from YAML or JSON documents
133
- (`kind: agent` or `kind: environment`). A directory applies every `.yaml`,
134
- `.yml` and `.json` in name order, and repeating `-f` applies each file or
135
- directory in the order given. A directory with none of those extensions is an
136
- error, not a silent success. It matches by `name` inside the organization
137
- of the key and never deletes a resource the file does not name. Renaming a
226
+ (`kind: agent` or `kind: environment`), and publishes a skill from its
227
+ directory. A directory applies every `.yaml`, `.yml` and `.json` in name order,
228
+ and repeating `-f` applies each file or directory in the order given. A directory without `SKILL.md` and with none of
229
+ those extensions is an error, not a silent success. Agents and environments match by `name` inside the organization
230
+ of the key; a skill matches by `display_name`. It never deletes a resource the file does not name. Renaming a
138
231
  resource creates another one. Arrays such as `mcp_servers`, `tools` and
139
232
  `skills` are replaced whole, exactly like the API, and so are `model` and the
140
233
  `config` of an environment: what the file sends is the whole value, with the
@@ -155,6 +248,11 @@ Environments are applied before agents, and every document and variable is
155
248
  validated before the first write. A server failure stops there: the resources
156
249
  already applied keep their status, the rest are reported as `not applied`, and
157
250
  the command exits 1. Run it again to finish the job; it is idempotent by name.
251
+ Every failure that comes from the API starts with the HTTP status and the
252
+ stable `error_code`, never the response body, for agents, environments and
253
+ skills alike. A `validation_error` is caught before the request and carries no
254
+ status, and a skill 413 names the server's per-request limit with the request
255
+ id instead of leading with the number.
158
256
 
159
257
  Secrets do not belong in the files: `${NAME}` interpolation in
160
258
  `mcp_servers[].env` and `_oma.acp.agent.env` reads `NAME` from the process
@@ -166,7 +264,41 @@ change.
166
264
 
167
265
  `apply` needs the `agents:write` and `environments:write` scopes (the `ci` key
168
266
  preset). A document with `_oma.retention` also needs `agents:admin`, which only
169
- an `admin` or `owner` login has.
267
+ an `admin` or `owner` login has; a skill needs `skills:write`.
268
+
269
+ ### Skills
270
+
271
+ A directory with `SKILL.md` at its root is a skill, not a document: the
272
+ frontmatter carries its `name` (lowercase letters, digits and hyphens, up to 64
273
+ characters) and its `description`, and the supporting files go with their
274
+ relative paths, without a top-level folder.
275
+
276
+ ```bash
277
+ nouter-platform apply -f ./skills/summarize-reports --dry-run
278
+ nouter-platform apply -f ./skills/summarize-reports
279
+ ```
280
+
281
+ The CLI lists the `custom` skills of the organization, all pages, and matches
282
+ `display_name` against the frontmatter `name`. No match creates the skill and
283
+ prints `created skill "name"`; one match downloads its latest version and, if
284
+ the paths and bytes differ, creates a version and prints
285
+ `updated skill "name" (version <id>)`; equal files print `unchanged` with no
286
+ `POST`. More than one match is an error with the ids and no writes, because
287
+ `display_name` is not unique. A console skill whose `display_name` differs from
288
+ the frontmatter `name` is not recognized and gets a second skill.
289
+
290
+ A new version is a complete snapshot, not a delta. The exclusions are the
291
+ console's, with no opt-in: names and folders that usually hold secrets or tool
292
+ state, plus `.DS_Store` and symlinks, are skipped, and each skipped path and
293
+ its reason go to stderr. Exclusions run before the limits (500 files, 32 MB per
294
+ file and 100 MB in total), so a large `node_modules` does not fail the run. The
295
+ compiler's ceilings are not reachable over HTTP: each upload is one multipart
296
+ request and the edge accepts at most 25 MiB per request, so a bigger package
297
+ fails with a 413 `request_too_large`.
298
+ `--dry-run` prints the plan and sends only the reads. A failed skill prints the
299
+ HTTP status and the stable `error_code`, never the package body; a 413 says the
300
+ package exceeds the server's per-request limit, with the request id. `apply` has
301
+ no `--json`.
170
302
 
171
303
  ## Evals
172
304
 
@@ -196,6 +328,8 @@ environment: env_...
196
328
  threshold: 0.8
197
329
  runs: 3
198
330
  budget_per_case: "50"
331
+ vaults:
332
+ - vault_test
199
333
  ```
200
334
 
201
335
  ```markdown
@@ -218,6 +352,7 @@ type: regex
218
352
  nouter-platform eval ./evals
219
353
  nouter-platform eval ./evals --agent <agent-id> --environment <environment-id> --threshold 0.9 --runs 5
220
354
  nouter-platform eval ./evals --case 'refund-*' --tag smoke --json > eval-results.json
355
+ nouter-platform eval ./evals --max-cost-usd 1.50
221
356
  ```
222
357
 
223
358
  | Flag | What it does |
@@ -231,16 +366,30 @@ nouter-platform eval ./evals --case 'refund-*' --tag smoke --json > eval-results
231
366
  | `--tag <tag>` | Filters by tag; may be repeated. |
232
367
  | `--agent-version <n>` | Pins the expected version: if the agent is on another one, it fails before running anything. |
233
368
  | `--wait-timeout <seconds>` | The cap for polling the run; defaults to 3600. |
369
+ | `--max-cost-usd <usd>` | The run's list-price ceiling, in dollars, at most six decimals; without it there is none. |
370
+ | `--vault <vault-id>` | Attaches that vault to every Session; repeatable. Overrides the suite `vaults:`. |
234
371
  | `--keep` | Keeps the ephemeral benchmark and run and prints their ids, for debugging. |
235
372
  | `--json` | Prints the versioned report on stdout, without the table. |
236
373
 
237
374
  `[<dir>]` is the suite directory and defaults to `evals`. It must be relative and cannot contain `..`. The
238
375
  `--case` and `--tag` filters apply before the run is created: a filter that leaves no cases is `NO_CASES`.
239
376
 
377
+ A vault is passed to each Session of a case, so a case can carry its own credential. `--vault <vault-id>` may be
378
+ repeated and replaces the `vaults:` of the suite and of the cases. Without the flag, `vaults:` in `suite.yaml` is
379
+ the default and a case can override it with `vaults:` in its `case.yaml`; `vaults: []` in a case means no vault for
380
+ that case. An empty list in `suite.yaml` is an error; each id is a non-empty string, and repeats are sent as given.
381
+ A vault id that does not exist or is archived fails the run with 404 `Vault <id> was not found` before any trial
382
+ starts. The runner only passes the ids: it never creates a vault, reads a credential or sees a secret. A suite with
383
+ `vaults:` also applies through `apply --require-eval`; the gate has no `--vault`.
384
+
385
+ If the agent policy has `requires_user_profile`, the platform gives each trial a synthetic profile
386
+ (`eval:<run>:<task>:<n>`) and archives it when the run closes; the suite does not set a user profile.
387
+
240
388
  ### CI use
241
389
 
242
390
  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:
391
+ is the gate, and the JSON is archived; a partial run from `--max-cost-usd` is a 2 that the job can treat as a
392
+ failure or archive:
244
393
 
245
394
  ```bash
246
395
  nouter-platform eval ./evals --json > eval-results.json
@@ -255,13 +404,19 @@ nouter-platform eval ./evals --json > eval-results.json
255
404
  | --- | --- |
256
405
  | 0 | Every case scored at or above the threshold, with no errors. |
257
406
  | 1 | A case below the threshold or with an error, the suite did not load, the run failed, or the API failed. |
407
+ | 2 | Partial run: `--max-cost-usd` stopped trials before they started; the results are partial. |
258
408
  | 64 | Invalid command usage: an unknown flag, an out-of-range value, or an absolute directory or one with `..`. |
259
409
  | 130 | Interrupted with SIGINT (Ctrl-C) or SIGTERM. |
260
410
 
261
- It also exits 1 when the agent version changed during the run: the report is not comparable.
411
+ It also exits 1 when the agent version changed during the run: the report is not comparable. A run that does not
412
+ finish within `--wait-timeout` exits 1 too.
262
413
 
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
414
+ A code 2 wins over 0 and 1, but it does not mean the run passed: the trials that started are still scored and can
415
+ be below the threshold or in error. The report is written anyway and says why it is partial. `cost_ceiling` means
416
+ the ceiling stopped trials; `cost_unavailable` means the list cost could not be read and the run stopped starting
417
+ new trials to avoid spending blind. The JSON document carries `partial` and `partialReason`, and its `run` carries
418
+ `maxCostUsd` and `listCostCents`. The report (`--json` or the table) goes only to stdout; errors go only to stderr,
419
+ with the `{ "error": { "code": "..." } }` envelope. As soon as the run exists its id is printed
265
420
  (`run <id> created; <n> cases`): on stdout without `--json`, and on stderr with `--json`, so stdout keeps a single
266
421
  JSON document. With `--json`, stderr is therefore not pure JSON: the run id line comes before any error envelope.
267
422
  If the process is interrupted it prints `interrupted; run <id> keeps running on the platform` on stderr and exits
@@ -270,10 +425,20 @@ If the process is interrupted it prints `interrupted; run <id> keeps running on
270
425
  ### Cost
271
426
 
272
427
  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.
428
+ before creating the run; when every selected case has a budget it also prints their sum (`Σ budget × runs`), the
429
+ hard cap that already existed per case. `--runs 1` is for iterating; use 3 to trust a change.
430
+
431
+ `--max-cost-usd <usd>` caps the run's list-price cost estimate, not the bill: the ceiling is checked before each
432
+ trial starts, and once the known cost reaches it no further trial starts; trials already in flight finish, so the
433
+ spend can pass the ceiling by what they use. The known cost is the sum of the Sessions' `usage.list_cost`, a floor
434
+ of the bill; session hours and the sandbox are outside it, and the organization spend caps remain the overall
435
+ ceiling. Without the flag there is no ceiling, like the reference CLI. The run closes `completed` with `partial:
436
+ true` and `partialReason`; the CLI exits 2 with the partial results and prints the closing line
437
+ `partial: the cost ceiling stopped <n> trials; list cost $<x>`. There is no confirmation prompt: the printed plan,
438
+ the budget cap and the ceiling are what you review, and CI passes the flag explicitly. The case `budget` (`budget`
439
+ in `case.yaml` or `budget_per_case` in `suite.yaml`), in cents, stays the per-conversation cap. If the server does
440
+ not confirm the ceiling it was sent, the CLI cancels the run, deletes the ephemeral resources and exits 1: it never
441
+ shows a ceiling that the server did not apply.
277
442
 
278
443
  `apply --require-eval <suite>` pays for a full suite before applying and is opt-in: without the flag, `apply`
279
444
  spends no model. The gate has no `--json`; it prints the human report and, if the run does not pass, writes
@@ -296,6 +461,10 @@ the sandbox of that Session, not on the machine that launches the command; the n
296
461
  environment allows, and their stdout/stderr is not printed: only the verdict and the exit code. The Session does
297
462
  not mount the repo.
298
463
 
464
+ A vault credential of type `environment_variable` is exposed to the agent as an environment variable. If the agent
465
+ prints it, the value stays in the Session trajectory and can appear in the eval report: prefer `static_bearer` or
466
+ `mcp_oauth` credentials for the vaults an eval uses.
467
+
299
468
  The `apply --require-eval` candidate is a real agent of the organization and runs with the real environment and
300
469
  MCP credentials of the document. A suite can have side effects (writing files, calling APIs): design the cases
301
470
  with that in mind.