nylorun 0.14.0-beta → 0.15.0-beta

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 (71) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +226 -144
  3. package/dist/cli.js +141 -47
  4. package/dist/client/agents.d.ts +6 -0
  5. package/dist/client/agents.js +148 -0
  6. package/dist/client/artifacts.d.ts +4 -0
  7. package/dist/client/artifacts.js +210 -0
  8. package/dist/client/doctor.d.ts +7 -2
  9. package/dist/client/doctor.js +14 -13
  10. package/dist/client/environment-manifests.d.ts +10 -0
  11. package/dist/client/environment-manifests.js +173 -0
  12. package/dist/client/environments.d.ts +4 -0
  13. package/dist/client/environments.js +295 -0
  14. package/dist/client/io.d.ts +31 -0
  15. package/dist/client/io.js +72 -0
  16. package/dist/{stack → client}/mcp.d.ts +2 -2
  17. package/dist/{stack → client}/mcp.js +14 -12
  18. package/dist/client/model/pi-ai.d.ts +3 -3
  19. package/dist/client/model/pi-ai.js +4 -4
  20. package/dist/client/models.d.ts +13 -0
  21. package/dist/client/models.js +203 -0
  22. package/dist/client/runtime.d.ts +40 -0
  23. package/dist/client/runtime.js +134 -0
  24. package/dist/client/sessions.d.ts +4 -0
  25. package/dist/client/sessions.js +295 -0
  26. package/dist/client/settings.d.ts +12 -0
  27. package/dist/client/settings.js +103 -0
  28. package/dist/client/signing-keys.d.ts +3 -0
  29. package/dist/client/signing-keys.js +32 -0
  30. package/dist/client/target.d.ts +33 -0
  31. package/dist/client/target.js +65 -0
  32. package/dist/client/tenant.d.ts +22 -0
  33. package/dist/client/tenant.js +176 -0
  34. package/dist/doctor.js +3 -3
  35. package/dist/nylo.js +20 -4
  36. package/dist/sandbox/cluster-file.d.ts +1 -1
  37. package/dist/sandbox/commands.d.ts +1 -1
  38. package/dist/sandbox/commands.js +7 -7
  39. package/dist/sandbox/manifests.d.ts +1 -1
  40. package/dist/sandbox/manifests.js +1 -1
  41. package/dist/sandbox/probe.d.ts +1 -1
  42. package/dist/stack/commands.d.ts +9 -4
  43. package/dist/stack/commands.js +22 -26
  44. package/dist/stack/compose-file.d.ts +1 -1
  45. package/dist/stack/compose-file.js +12 -12
  46. package/dist/stack/env-file.d.ts +2 -2
  47. package/dist/stack/env-file.js +2 -2
  48. package/dist/stack/images.d.ts +1 -1
  49. package/dist/stack/images.js +1 -1
  50. package/dist/stack/index.d.ts +1 -10
  51. package/dist/stack/index.js +3 -19
  52. package/dist/stack/keys.d.ts +2 -2
  53. package/dist/stack/keys.js +14 -11
  54. package/dist/stack/paths.d.ts +1 -1
  55. package/dist/stack/prepare.d.ts +1 -1
  56. package/dist/stack/stacks.js +1 -1
  57. package/dist/telemetry.d.ts +2 -2
  58. package/dist/telemetry.js +4 -4
  59. package/package.json +6 -5
  60. package/dist/client/access/commands.d.ts +0 -8
  61. package/dist/client/access/commands.js +0 -33
  62. package/dist/client/cli.d.ts +0 -2
  63. package/dist/client/cli.js +0 -106
  64. package/dist/client/installation/commands.d.ts +0 -7
  65. package/dist/client/installation/commands.js +0 -82
  66. package/dist/client/project/connection.d.ts +0 -36
  67. package/dist/client/project/connection.js +0 -80
  68. package/dist/client/project/env.d.ts +0 -3
  69. package/dist/client/project/env.js +0 -19
  70. package/dist/stack/sandbox.d.ts +0 -4
  71. package/dist/stack/sandbox.js +0 -107
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # nylorun
2
2
 
3
- Sets up and runs local Nylorun Tenants: the Runtime and Studio, in Docker
4
- Compose, one Tenant per project. Its second command, `nylo`, is the Runtime
5
- client of the linked installation. It needs nothing in your project; run it with
6
- `npx` in the project's directory:
3
+ Sets up and runs local Nylorun Tenants (the Runtime and Studio, in Docker
4
+ Compose, one Tenant per project), and is the client of a Tenant's APIs, local or
5
+ remote. It needs nothing in your project; run it with `npx` in the project's
6
+ directory:
7
7
 
8
8
  ```sh
9
9
  npx nylorun start # create (first run) and start this project's Tenant, and the Project link
@@ -15,12 +15,12 @@ and S2, serving exactly that Tenant, and its name is the Tenant's name.
15
15
  `nylorun start` in a project creates the project's Tenant (the Runtime creates
16
16
  it on its first start) and links the project to it; anywhere else, it starts
17
17
  the Tenant `default`. Projects that must not share agents, credentials or
18
- history run separate Tenants. The Tenant's status, data, signing keys and model
19
- provider over its APIs belong to the Runtime client, `nylo`
20
- ([below](#the-runtime-client-nylo)), which works on a remote installation too.
21
- Depends on `@nylorun/core` and `@nylorun/admin` (for `nylo`) among Nylorun
22
- packages and never imports `@nylorun/runtime`; the `nylorun` command loads
23
- neither `nylo` nor `@nylorun/admin`. Vocabulary:
18
+ history run separate Tenants. The `tenant` and `environments` groups act on a
19
+ Tenant over its APIs, so they work on a remote installation too
20
+ ([below](#remote-installations)). Depends on `@nylorun/core` and
21
+ `@nylorun/admin` among Nylorun packages and never imports `@nylorun/runtime`;
22
+ `start`, `stop` and the `local` commands load neither the API client nor
23
+ `@nylorun/admin`. Vocabulary:
24
24
  [runtime/server/src/CONTEXT.md](../../runtime/server/src/CONTEXT.md).
25
25
 
26
26
  Prerequisites, installed by the developer (nylorun never downloads them): Node
@@ -37,41 +37,102 @@ npx nylorun doctor # Node 24+, Docker, Compose v2, and the Tenan
37
37
 
38
38
  ## Commands
39
39
 
40
+ The installation's lifecycle is a handful of top-level commands; everything else
41
+ is in a group that follows the API it uses, and each group has its own `--help`.
42
+
40
43
  ```sh
41
44
  nylorun up|start [--tenant <name>] [--no-link] [--no-studio] [--allow-downgrade] [--studio-embed-origin <origin>]... [--studio-embed-origin-reset] [--restate-ui]
42
45
  # create (first run) and start the Tenant; link the project; print the URLs
43
46
  # --restate-ui (or NYLORUN_RESTATE_UI=1): publish Restate's UI on loopback for this start
44
47
  nylorun down|stop [--tenant <name> | --all] # stop the containers (--all: every Tenant's); keep volumes
45
48
  nylorun status [--tenant <name>] [--json] # the Tenant, its Host root and id, services, endpoints, Runtime health
46
- nylorun logs [service] [--tenant <name>] [-f] [--tail <n>] # postgres, restate, s2-lite, rustfs, gateway, runtime, harness, studio, sandboxes
47
49
  nylorun studio [--tenant <name>] [--no-open] # sign a browser in to Studio on the Tenant; starts it if needed
48
- nylorun reset [--tenant <name>] [--yes] # delete the Tenant's volumes, Tenant directory and vault key; the next start creates it anew
49
- nylorun ls [--json] # the Tenants on this machine, with their state, memory and URLs
50
- nylorun delete <tenant> --yes # remove a Tenant: containers, volumes, Host root and vault key
51
- nylorun sandbox ls [--tenant <name>] [--label <key=value>]... [--json] # the running Tenant's Environments
52
- nylorun sandbox rm <id> [--tenant <name>] # delete an Environment: its sandbox, files and vault
53
- nylorun key put <id> [--management] [--tenant <name>] # create or rotate the Tenant's application key <id> (--management: a management key); prints it once
54
- nylorun key list [--tenant <name>] [--json] # the Tenant's keys: id, role, when issued
55
- nylorun key rm <id> [--tenant <name>] # delete a key: it stops working at once
56
- nylorun mcp inspect <url> [--server <name>] [--environment <id>] [--sse] [--tenant <name>] [--json] # a remote MCP server's tools, with an Environment's credential
57
50
  nylorun doctor [--json] # prerequisites and the Tenant's health
58
- nylorun telemetry [status|enable|disable] # Studio's anonymous usage analytics
59
- nylorun sandbox enable --context <name> [--tenant <name>] [--host-address <ip>] [--bind-address <ip>] [--no-pull]
60
- nylorun sandbox disable [--tenant <name>] [--delete-namespace]
61
- nylorun sandbox status [--tenant <name>] [--json] # pods on a Kubernetes context (see Sandboxes)
51
+ nylorun doctor sandbox [--tenant <name>] [--json] # the sandbox backend the Tenant's Host offers
52
+
53
+ # agents, sessions, environments, artifacts: the Runtime API (an application key, or NYLORUN_TOKEN)
54
+ # every one takes --tenant <name>, and --as <subject> [--scope <scope>]... to act for a person
55
+ nylorun agents list [--json]
56
+ nylorun agents get <id> # its manifest
57
+ nylorun agents save <manifest.json|-> [--files <dir>]... [--implementation-version <v>] [--dry-run]
58
+ nylorun sessions list [--agent <id>] [--status <s>] [--environment <id>] [--owner <user>] [--limit <n>] [--cursor <c>] [--json]
59
+ nylorun sessions create --agent <id> --owner <user> [--environment <id>] [--id <id>] [--info <json>]
60
+ nylorun sessions get <id>
61
+ nylorun sessions send <id> [<text>] [--data <json>] [--file <artifact>[@<version>]]... [--idempotency-key <k>]
62
+ nylorun sessions approve <id> <interaction> [--deny]
63
+ nylorun sessions respond <id> <interaction> <json>
64
+ nylorun sessions cancel <id> [--reason <text>]
65
+ nylorun sessions watch <id> [--follow] [--cursor <c>] # events as JSON lines until interrupted
66
+ nylorun sessions history|usage|calls [--tool]|trace <id> …
67
+ nylorun sessions exec <id> [--timeout <s>] -- <command>... # bash in the session's sandbox
68
+ nylorun environments list [--label <key=value>]... [--behind] [--limit <n>] [--cursor <c>] [--json] # --behind: made from an older manifest version
69
+ nylorun environments get|stop|reset|delete|snapshot|versions <id>
70
+ nylorun environments put <id> --manifest <name[@n]> [--label <key=value>]... # made from a manifest version; what it runs never changes
71
+ nylorun environments put <id> [<inline.json|->] [--kind <virtual|pod|none>] [--label <key=value>]...
72
+ nylorun environments fork <id> <new-id> [--manifest <name[@n]>] [--disk <latest|n|empty>] [--secrets <copy|none>] [--dry-run] # onto a new manifest version
73
+ nylorun environments restore <id> <version|latest>
74
+ nylorun environments delete-version <id> <version>
75
+ nylorun environments events <id> [--from <n>] [--types <type,…>] [--since <time>] [--until <time>]
76
+ nylorun environments secrets list|get|put|rm <id> [<name>] [<secret.json|->] # put without a file: a slot's value on stdin
77
+ nylorun environments manifests list [--json] | get <name> [--version <n>] | versions <name> | rm <name>
78
+ nylorun environments manifests save <manifest.json>... [--if-match <n>] [--dry-run] # files with "from": a folder, uploaded by hash
79
+ nylorun artifacts list [--session <id>] [--label <key=value>]... [--limit <n>] [--cursor <c>] [--json]
80
+ nylorun artifacts get|tree|diff|link|rm <id> …
81
+ nylorun artifacts upload <file|-> [--name <name>] [--content-type <type>] [--session <id>] [--label <key=value>]... [--to <id>]
82
+ nylorun artifacts download <id> [--version <n>] [--output <file>]
83
+ nylorun artifacts zip <id> [--version <n>] --output <file>
84
+
85
+ # tenant: the Tenant's settings (Management API, a management key)
86
+ nylorun tenant reset [--sessions|--environments|--all] [--yes] [--tenant <name>]
87
+ nylorun tenant keys put <id> [--management] [--tenant <name>] # create or rotate key <id>; prints it once
88
+ nylorun tenant keys list [--tenant <name>] [--json] # id, role, when issued
89
+ nylorun tenant keys rm <id> [--tenant <name>] # it stops working at once
90
+ nylorun tenant signing-keys list|rotate [--force]|revoke <kid> [--tenant <name>]
91
+ nylorun tenant models catalog|providers|get [--tenant <name>] [--json] # the models the Runtime knows, the providers with a credential, the Tenant's model
92
+ nylorun tenant models set [--tenant <name>] # sign in to a model provider and set the Tenant's model
93
+ nylorun tenant models set --provider <id> --model <id> [--base-url <url>] [--tenant <name>] # the same, with an API key piped in on stdin (CI)
94
+ nylorun tenant models select <provider> [--model <id>] [--tenant <name>] # use another provider that has a credential
95
+ nylorun tenant usage [--scope tenant|agent|turn] [--id <id>] [--period day|month|total] [--tenant <name>] # calls, tokens and cost (JSON)
96
+ nylorun tenant calls [--after <cursor>] [--limit <n>] [--tenant <name>] # every recorded model call as NDJSON, until caught up
97
+ nylorun tenant budgets [get | put <file|->] [--tenant <name>] # the model spend caps
98
+ nylorun tenant tool-policy [get | put <file|->] [--tenant <name>] # the Tool Gate's rules
99
+ nylorun tenant settings sandbox|artifacts [get | put <file|->] [--tenant <name>] # Environment and artifact store settings
100
+ nylorun tenant coverage --agent <id> [--environment <id>] [--tenant <name>] [--json] # which secret each MCP server and HTTP tool would get
101
+ nylorun tenant mcp inspect <url> [--server <name>] [--environment <id>] [--sse] [--tenant <name>] [--json]
102
+
103
+ # local: the Tenants on this machine (Docker and kubectl)
104
+ nylorun local ls [--json] # the Tenants on this machine, with their state, memory and URLs
105
+ nylorun local delete <tenant> --yes # remove a Tenant: containers, volumes, Host root and vault key
106
+ nylorun local logs [service] [--tenant <name>] [-f] [--tail <n>] # postgres, restate, s2-lite, rustfs, gateway, runtime, harness, studio, sandboxes
107
+ nylorun local reset [--tenant <name>] [--yes] # delete the Tenant's volumes, Tenant directory and vault key; the next start creates it anew
108
+ nylorun local sandbox enable --context <name> [--tenant <name>] [--host-address <ip>] [--bind-address <ip>] [--no-pull]
109
+ nylorun local sandbox disable [--tenant <name>] [--delete-namespace]
110
+ nylorun local sandbox status [--tenant <name>] [--json] # pods on a Kubernetes context (see Sandboxes)
111
+ nylorun local telemetry [status|enable|disable] # Studio's anonymous usage analytics
62
112
  ```
63
113
 
64
114
  `up` and `down` are the Docker Compose spellings of `start` and `stop`: `down`
65
- stops the containers and keeps the volumes, so no Tenant data is lost. Removed
66
- commands exit 2 naming the replacement: `nylorun dev` and the MCP OAuth `connect`
67
- subcommand of `nylorun mcp` (protocol 10: write a key or a gateway credential as
68
- an Environment's secret instead, and preview the server with
69
- `nylorun mcp inspect --environment <id>`), and `--vault` of `nylorun mcp inspect`
70
- (protocol 11: `--environment <id>`).
71
- `nylorun configure`, `nylorun status --env` and `nylorun doctor sandbox` exit 2
72
- naming `nylo configure`, `nylo env` and `nylo doctor sandbox`.
73
- `nylorun status` and `nylorun reset` are not `nylo status` and `nylo reset`: see
74
- [`status` and `reset`](#status-and-reset-nylorun-or-nylo).
115
+ stops the containers and keeps the volumes, so no Tenant data is lost. A command
116
+ that moved into a group, or was removed, exits 2 naming its replacement:
117
+ `nylorun logs`, `ls`, `delete`, `reset` and `telemetry` are under `local` (and
118
+ `sandbox enable|disable|status`); `nylorun key` and `mcp` are under `tenant`;
119
+ `nylorun sandbox ls|rm` is `nylorun environments list|delete`; `nylorun
120
+ configure` is `nylorun tenant models set`. `nylorun dev`, `nylorun env` and the
121
+ MCP OAuth `connect` subcommand of `nylorun tenant mcp` (protocol 10: write a key
122
+ or a gateway credential as an Environment's secret instead) are gone.
123
+
124
+ The package's second command, `nylo`, was the Runtime client until nylorun took
125
+ its commands. For one release it names the `nylorun` command that replaced each
126
+ of its own and exits 2:
127
+
128
+ | `nylo` | `nylorun` |
129
+ | --- | --- |
130
+ | `nylo status` | `nylorun status` |
131
+ | `nylo reset [--sessions\|--environments\|--all]` | `nylorun tenant reset …` |
132
+ | `nylo access signing-keys …` | `nylorun tenant signing-keys …` |
133
+ | `nylo configure` | `nylorun tenant models set` |
134
+ | `nylo doctor sandbox` | `nylorun doctor sandbox` |
135
+ | `nylo env` | none: the SDKs read the Project link themselves |
75
136
 
76
137
  ## Tenants
77
138
 
@@ -88,7 +149,7 @@ Every command acts on one Tenant, chosen in this order:
88
149
 
89
150
  In a project without a link, the commands other than `start` exit 2 and list
90
151
  the Tenants on this machine. A name is lowercase letters, digits, `-` and `_`;
91
- a Tenant id (`tn_…`) is refused: pass the Tenant's name (`nylorun ls` lists
152
+ a Tenant id (`tn_…`) is refused: pass the Tenant's name (`nylorun local ls` lists
92
153
  them).
93
154
 
94
155
  Each Tenant has its own Host root `~/.nylorun/tenants/<name>/`, Compose project
@@ -105,7 +166,7 @@ Tenants run side by side, each on its own ports, containers, network and
105
166
  volumes ([The containers](#the-containers)); a running Tenant uses about
106
167
  1.2 GB. Each Studio is on its own port, `http://localhost:<port>`, with its own
107
168
  session cookie, so two Studios in one browser stay signed in;
108
- `nylorun studio --tenant <name>` opens any Tenant's Studio signed in. `nylorun ls`
169
+ `nylorun studio --tenant <name>` opens any Tenant's Studio signed in. `nylorun local ls`
109
170
  lists them with their state, the memory their containers use (`MEMORY`: the sum
110
171
  of `docker stats` over the containers labelled `dev.nylorun.tenant=<name>`, `-`
111
172
  when stopped; `memoryBytes` in `--json`, `null` when stopped or unknown), the
@@ -131,7 +192,7 @@ A Tenant created by nylorun 0.5 keeps its data in volumes Compose named
131
192
  `<project>_postgres`, `<project>_restate`, `<project>_s2` and
132
193
  `<project>_workspaces`; this release names them `<project>-postgres`, … (see
133
194
  [The containers](#the-containers)). `start` on such a Tenant exits 3 without
134
- starting it, naming the old volumes: run `nylorun reset --tenant <name>` to
195
+ starting it, naming the old volumes: run `nylorun local reset --tenant <name>` to
135
196
  start it fresh. `reset` and `delete` also remove the old volumes (and the old
136
197
  network `<project>_default`).
137
198
 
@@ -164,7 +225,7 @@ its own `.gitignore` of `*`):
164
225
  application key, keeps it and gains the management key.
165
226
 
166
227
  Later starts reuse the Tenant and rewrite the link only when the Tenant's name,
167
- URL, Host or id changed (after `nylorun reset`, for example). When it writes a
228
+ URL, Host or id changed (after `nylorun local reset`, for example). When it writes a
168
229
  new link, `start` seeds the Tenant from the project's `.env`: the sandbox
169
230
  backend (`NYLORUN_SANDBOX=auto|virtual`) and the model credential
170
231
  (`MODEL_PROVIDER`, `MODEL`, `MODEL_PROVIDER_API_KEY`, `MODEL_PROVIDER_BASE_URL`,
@@ -186,20 +247,22 @@ replaced by the application key otherwise.
186
247
 
187
248
  Every Tenant serves the Runtime API, which takes **application keys**, and the
188
249
  Management API (`/v1/tenant/*`), which takes **management keys**
189
- ([SELF_HOSTING.md](../../guides/SELF_HOSTING.md#keys)). `nylorun key` manages both on the
190
- running Tenant through `nylorun-operate` in its runtime container, so only this
191
- machine can issue a management key.
192
-
193
- `nylorun key put <id>` creates the application key `<id>` (or rotates it: the
194
- previous key stops working at once) and prints it once on stdout; with
195
- `--management` it puts a management key. `nylorun key list [--json]` shows each
196
- key's id, role and when it was issued, never the keys; `nylorun key rm <id>`
197
- deletes one. Ids match `^[a-z][a-z0-9-]{0,31}$`; `studio` belongs to Studio and
198
- `bootstrap` to `NYLORUN_MANAGEMENT_KEY_FILE`, and both are refused. Putting an
199
- id that holds the other role is refused. Give each app server its own
200
- application key. `nylorun sandbox` and `nylorun mcp` use the linked project's keys, or the keys
201
- `cli` and `cli-management` they put once and keep in
202
- `<Host root>/cli-credentials.json` (mode 0600).
250
+ ([SELF_HOSTING.md](../../guides/SELF_HOSTING.md#keys)). On a local Tenant,
251
+ `nylorun tenant keys` manages both through `nylorun-operate` in its runtime
252
+ container, so only this machine can issue a management key. On a remote
253
+ installation ([below](#remote-installations)) it manages application keys
254
+ through the Management API, and refuses `--management`.
255
+
256
+ `nylorun tenant keys put <id>` creates the application key `<id>` (or rotates it:
257
+ the previous key stops working at once) and prints it once on stdout; with
258
+ `--management` it puts a management key. `nylorun tenant keys list [--json]`
259
+ shows each key's id, role and when it was issued, never the keys; `nylorun
260
+ tenant keys rm <id>` deletes one. Ids match `^[a-z][a-z0-9-]{0,31}$`; `studio`
261
+ belongs to Studio and `bootstrap` to `NYLORUN_MANAGEMENT_KEY_FILE`, and both are
262
+ refused. Putting an id that holds the other role is refused. Give each app server
263
+ its own application key. On a local Tenant, the `tenant` and `environments`
264
+ commands use the linked project's keys, or the keys `cli` and `cli-management`
265
+ they put once and keep in `<Host root>/cli-credentials.json` (mode 0600).
203
266
 
204
267
  ## MCP servers
205
268
 
@@ -207,13 +270,15 @@ An agent names its MCP servers by URL; a session gets a credential for a URL fro
207
270
  the Environment it is opened on (`createSession({ environment })`): a secret of that
208
271
  Environment, a `bearer` token or a `headers` map, with `via` and an identity
209
272
  header when an MCP gateway holds each person's sign-in. Write it with
273
+ `nylorun environments secrets put <id> <name> <secret.json|->` (the secret's JSON
274
+ comes from a file or standard input, never the command line),
210
275
  `client.environments.secrets.put(id, name, secret)` of `@nylorun/agents` (the
211
- Runtime API, an application key) or in Studio; no `nylorun` command writes one.
276
+ Runtime API, an application key) or in Studio.
212
277
  The whole flow, with gateway recipes, is in
213
278
  [DEPLOYMENT.md](../../guides/DEPLOYMENT.md#mcp-servers-and-http-tools).
214
279
 
215
- `nylorun mcp inspect <url>` shows what a remote MCP server offers before an
216
- agent names it, through the running Tenant's Management API
280
+ `nylorun tenant mcp inspect <url>` shows what a remote MCP server offers before an
281
+ agent names it, through the Tenant's Management API
217
282
  (`POST /v1/tenant/mcp/preview`, with the management key). The Runtime connects
218
283
  with Environment `<id>`'s credential for `<url>` when `--environment <id>` names one
219
284
  (without it, no credential is sent), lists the tools within 15 s and calls none. It
@@ -309,11 +374,11 @@ loads no analytics inside an embedding app, or when the browser sends Do Not
309
374
  Track or Global Privacy Control.
310
375
 
311
376
  It is on by default, and `nylorun start` says so the first time. Turn it off on
312
- this machine with `nylorun telemetry disable` (kept in
377
+ this machine with `nylorun local telemetry disable` (kept in
313
378
  `~/.nylorun/telemetry.json`), or for one start with `NYLORUN_TELEMETRY_DISABLED=1`
314
379
  or `DO_NOT_TRACK=1`. It is always off when `CI` is set. `nylorun start` decides
315
380
  on every start and writes the result to `NYLORUN_STUDIO_ANALYTICS_ID` in
316
- `docker/.env` (empty when off); `nylorun telemetry` reports the current choice.
381
+ `docker/.env` (empty when off); `nylorun local telemetry` reports the current choice.
317
382
 
318
383
  ## Sandboxes
319
384
 
@@ -326,15 +391,15 @@ opened on none has no sandbox. Kind `virtual` (the default) runs on the Runtime'
326
391
  containers. It is not a VM or container boundary. Kind `pod` runs in a pod on a
327
392
  cluster (below).
328
393
 
329
- `nylorun sandbox ls` lists the running Tenant's Environments with their kind,
330
- state, sessions and labels; `nylorun sandbox rm <id>` deletes one, with its files
394
+ `nylorun environments list` lists the Tenant's Environments with their kind,
395
+ state, sessions and labels; `nylorun environments delete <id>` deletes one, with its files
331
396
  and vault (refused while a turn runs in it). Neither starts a stopped Tenant
332
397
  (exit 3). The Tenant's limits for Environments (`limits.environments`, `idle`,
333
398
  resources, network) are `PUT /v1/tenant/sandbox` on the Management API.
334
399
 
335
400
  ### Pods on a cluster (preview)
336
401
 
337
- `nylorun sandbox enable --context <name>` prepares a Kubernetes context for the
402
+ `nylorun local sandbox enable --context <name>` prepares a Kubernetes context for the
338
403
  Tenant's sandboxes as pods ([agent-sandbox](https://github.com/kubernetes-sigs/agent-sandbox)
339
404
  v1.0.5): Docker Desktop's cluster (`--context docker-desktop`) or kind. It only
340
405
  touches the context you name. It installs the pinned agent-sandbox controller
@@ -344,7 +409,7 @@ with a probe that the cluster enforces NetworkPolicy (and refuses it otherwise),
344
409
  lets pods reach only three ports on the Docker host, and adds the `sandboxes`
345
410
  service to the Tenant: the one container holding the cluster credentials
346
411
  (`<Host root>/sandboxes/`). On kind under Linux, pass `--host-address 172.17.0.1`.
347
- `nylorun sandbox disable` removes the service (`--delete-namespace` also deletes
412
+ `nylorun local sandbox disable` removes the service (`--delete-namespace` also deletes
348
413
  the namespace and every sandbox in it). Sessions run in a pod when their
349
414
  Environment has kind `pod` (`client.environments.put(id, { kind: "pod" })`).
350
415
 
@@ -359,110 +424,127 @@ and `cli-credentials.json` (the keys `project` and `project-management`, `cli`
359
424
  and `cli-management`, mode 0600, when they were put), the Docker Compose files in `docker/`, the Tenant directory `tenant/` (homes, logs) and `keys/vault-kek`,
360
425
  the Tenant's vault key, which only the gateway container mounts. The Tenant's data lives in its Postgres, Restate and S2 volumes.
361
426
 
362
- `nylorun reset` deletes the selected Tenant's volumes, `tenant/` and `keys/`, and keeps
427
+ `nylorun local reset` deletes the selected Tenant's volumes, `tenant/` and `keys/`, and keeps
363
428
  its files and ports; the next start creates the Tenant anew (with a new id) and
364
- relinks the project. `nylorun delete <tenant> --yes` removes the Tenant's
429
+ relinks the project. `nylorun local delete <tenant> --yes` removes the Tenant's
365
430
  containers, volumes and Host root: the vault key (KEK) and all its data go with it.
366
431
 
367
- ## The Runtime client: `nylo`
368
-
369
- `nylo` acts on the one Tenant of the linked installation: a local Tenant or any
370
- Runtime reachable by URL and key. Run it without installing, or in a project
371
- that has `nylorun` as a devDependency:
372
-
373
- ```sh
374
- npx -p nylorun nylo status # anywhere
375
- npx nylo status # in a project with nylorun installed
376
- ```
377
-
378
- Outside such a project, `npx nylo` looks for an npm package named `nylo`, which
379
- is not this one: use `npx -p nylorun nylo`. The deprecated
380
- [`@nylorun/cli`](../legacy/README.md) runs this `nylo` for one more release.
381
-
382
- ```sh
383
- nylo status [--json] # the Tenant, its checks and counts
384
- nylo reset [--sessions|--environments|--all] [--yes]
385
- nylo access signing-keys … # the Tenant's signing keys: list, rotate, revoke
386
- nylo configure # set or replace the Tenant's model provider
387
- nylo env # export lines for the linked Project
388
- nylo doctor sandbox [--json] # sandbox backend via the Management API
389
- ```
390
-
391
- Every command acts on the linked installation: the [Project link and
392
- credentials](#the-project-link), or `NYLORUN_RUNTIME_URL` and
393
- `NYLORUN_SERVER_KEY` when the Project has no link. An installation serves one
394
- Tenant, so nothing selects it. `status`, `reset`, `access`, `configure` and
395
- `doctor` use the Management API with the Project's management key, or
396
- `NYLORUN_MANAGEMENT_KEY` (with `NYLORUN_RUNTIME_URL` when there is no link);
397
- `env` prints the Runtime URL and the application key, for the Runtime API:
398
-
399
- ```sh
400
- eval "$(npx -p nylorun nylo env)"
401
- # → NYLORUN_RUNTIME_URL, NYLORUN_SERVER_KEY
402
- ```
403
-
404
- `nylo` only reads the link, with `@nylorun/core/project`'s reader. It refuses a
405
- link from an older nylorun (format 0 to 2) and says to run `npx nylorun start`,
406
- which links the project again. `createClient` in `@nylorun/agents` reads the
407
- link (or the two variables) too, so the project's `npm run dev` and `npm start`
408
- need no Nylorun tool.
409
-
410
- Local Tenant commands (`up`, `down`, `start`, `stop`, `logs`, `studio`) exit 2
411
- naming `npx nylorun <command>`. `nylo tenant …` exits 2: `npx nylorun start`
412
- creates the project's Tenant and the link, and `nylo status|reset` replace
413
- `nylo tenant status|reset`. `nylo endpoints` was removed with Action endpoints
414
- (protocol 8: the Runtime runs agents from their manifests alone) and exits 2.
432
+ ## Remote installations
415
433
 
416
- ### `status` and `reset`: `nylorun` or `nylo`
434
+ The `agents`, `sessions`, `environments`, `artifacts` and `tenant` groups,
435
+ `status` and `doctor sandbox` act on a Tenant over its APIs. Without `--tenant`, they act on the installation the
436
+ environment names, when it names one for their API:
417
437
 
418
- Both commands have a `status` and a `reset`, which act on different things:
419
-
420
- | | `nylorun` | `nylo` |
438
+ | Variables | Acts on |
439
+ | --- | --- |
440
+ | `NYLORUN_RUNTIME_URL` and `NYLORUN_MANAGEMENT_KEY` | `status`, `doctor sandbox` and `tenant` (the Management API) |
441
+ | `NYLORUN_RUNTIME_URL` and `NYLORUN_SERVER_KEY` | `agents`, `sessions`, `environments` and `artifacts` (the Runtime API) |
442
+ | `NYLORUN_RUNTIME_URL` and `NYLORUN_TOKEN` | the same, with an identity provider's token in place of the key: the person it names, with the scopes it grants |
443
+
444
+ `NYLORUN_RUNTIME_URL` alone is an app's and names nothing, as for
445
+ `createAdmin` in `@nylorun/admin`. Otherwise they act on the local Tenant
446
+ `--tenant` names, else the linked project's, else the default one, while it runs;
447
+ they never start it. An installation serves one Tenant, so nothing else selects
448
+ it. The SDKs read the [Project link](#the-project-link) (or the two variables)
449
+ themselves, so the project's `npm run dev` and `npm start` need no Nylorun tool.
450
+ For a process outside the project, give it a key of its own (`nylorun tenant
451
+ keys put <id>`) and the Runtime URL that `nylorun status` prints.
452
+
453
+ ### Acting for a person
454
+
455
+ An application key acts for the whole Tenant. `--as <subject>` on a Runtime API
456
+ command sends `Nylorun-Subject` and `Nylorun-Scopes`, as `client.as(subject)` of
457
+ `@nylorun/agents` does, so the Runtime limits the command to that person's own
458
+ sessions and to the scopes given (`--scope`, repeatable; default
459
+ `sessions:own`). Use it to see what one person sees, or to act on their sessions
460
+ from a terminal.
461
+
462
+ ### Saving an agent from its manifest
463
+
464
+ `nylorun agents save agent.json --files skills/` saves the agent a manifest
465
+ describes, as `saveAgent` does from code. A manifest names each definition file
466
+ (a skill folder's files) by the SHA-256 of its bytes, so the files under the
467
+ `--files` folders are matched by content, whatever their paths; the ones the
468
+ Runtime does not hold are uploaded first (`PUT /v1/files/sha256:…`). A file the
469
+ manifest names but no folder holds stops the save before any request, naming
470
+ where the manifest names it. `nylorun agents get <id>` prints a saved agent's
471
+ manifest; the Runtime does not hand files back, so keep them with the manifest.
472
+
473
+ ### `local reset` or `tenant reset`
474
+
475
+ Both reset a Tenant, in different ways:
476
+
477
+ | | `nylorun local reset` | `nylorun tenant reset` |
421
478
  | --- | --- | --- |
422
- | Acts on | the local Tenant on this machine (`--tenant`, `NYLORUN_TENANT` or the link), through Docker and `nylorun-operate` in its runtime container | the linked installation, local or remote, through the Management API with a management key |
423
- | `status` | the containers, endpoints and Runtime health, and the Tenant's state: it answers when the Tenant is stopped or not open, and says why | the open Tenant's checks, counts and sandbox backend (`GET /v1/tenant`); when the Tenant does not answer it fails and points at `nylorun status` |
424
- | `reset` | deletes all the Tenant's data: volumes, `tenant/` and the vault key; the next `start` creates it anew, with a new id, and relinks the project | clears the sessions (the default), the Environments (`--environments`) or all the data (`--all`) after draining work in flight; the Tenant, its keys and the Project link are kept |
479
+ | Acts on | the local Tenant on this machine, through Docker | the Tenant, local or remote, through the Management API with a management key |
480
+ | Deletes | all the Tenant's data: volumes, `tenant/` and the vault key; the next `start` creates it anew, with a new id, and relinks the project | the sessions (the default), the Environments (`--environments`) or all the data (`--all`) after draining work in flight; the Tenant, its keys and the Project link are kept |
425
481
 
426
- `nylo reset --all` asks first; pass `--yes` when not in a terminal.
427
- `nylorun reset` asks too, or takes `--yes`.
482
+ `nylorun tenant reset --all` asks first; pass `--yes` when not in a terminal.
483
+ `nylorun local reset` asks too, or takes `--yes`.
428
484
 
429
- ### `nylo configure`
485
+ ### `nylorun tenant models set`
430
486
 
431
487
  Lists the Tenant's model catalog (`GET /v1/tenant/models`), asks for a provider,
432
488
  a model and its sign-in (an API key, or the provider's OAuth), and sets the
433
489
  Tenant's model provider (`PUT /v1/tenant/model`). The sign-in flows come from
434
490
  `@earendil-works/pi-ai`, about 100 MB with its provider SDKs, which no other
435
491
  command needs, so it is not a dependency of nylorun and `npx nylorun` stays
436
- small. When it does not resolve beside nylorun, the first `nylo configure`
437
- installs the version nylorun was tested with, with npm and without install
492
+ small. When it does not resolve beside nylorun, the first `nylorun tenant models
493
+ set` installs the version nylorun was tested with, with npm and without install
438
494
  scripts, into `~/.nylorun/lib/pi-ai-<version>/` (under `NYLORUN_HOME` when that
439
495
  is set), and later runs reuse it. Studio's model settings, and `.env` at
440
496
  `nylorun start`, set the provider without it.
441
497
 
442
- ### `nylo` exit codes
498
+ For CI, `--provider` and `--model` (and `--base-url` for an OpenAI-compatible
499
+ endpoint, provider `custom`) set an API key without prompts or pi-ai. The key is
500
+ read from stdin, never from the arguments, so it stays out of the shell's
501
+ history and the process list; a terminal on stdin is refused (exit 2). OAuth
502
+ providers need the prompts.
443
503
 
444
- | Code | Meaning |
445
- | --- | --- |
446
- | 0 | Success |
447
- | 1 | Generic failure |
448
- | 2 | Usage error, or a moved or removed command |
449
- | 6 | No Runtime at the linked or local URL |
450
- | 130 / 143 | SIGINT / SIGTERM |
504
+ ```sh
505
+ printenv OPENAI_API_KEY | nylorun tenant models set --provider openai --model gpt-5
506
+ ```
451
507
 
452
- ## Exit codes
508
+ `nylorun tenant models select <provider>` switches to another provider that
509
+ already has a credential, keeping its model (or `--model`) and endpoint.
453
510
 
454
- These are `nylorun`'s; [`nylo`'s](#nylo-exit-codes) are above.
511
+ ### Files in, files out
512
+
513
+ `budgets`, `tool-policy`, `settings sandbox` and `settings artifacts` are
514
+ documents: `get` (the default) prints one as JSON, and `put <file>` (or `put -`
515
+ for stdin) replaces the whole document with the JSON body in the file, the
516
+ Management API's request body (`PUT /v1/tenant/budgets`, `/tool-policy`,
517
+ `/sandbox`, `/artifacts`). The body is checked against its schema before
518
+ anything is sent; one that does not parse exits 2. What `budgets`, `tool-policy`
519
+ and `settings artifacts` print, `put` takes back (their `updatedAt` and
520
+ `usedBytes` are dropped), so they can be kept in a repository and applied from
521
+ CI:
522
+
523
+ ```sh
524
+ nylorun tenant tool-policy get > tool-policy.json # edit it, then
525
+ nylorun tenant tool-policy put tool-policy.json
526
+ ```
527
+
528
+ `settings sandbox get` prints the effective settings and what the Host offers;
529
+ its `put` takes the settings alone (`limits`, `lifecycle`, `placement`).
530
+
531
+ `nylorun tenant calls` prints each recorded model call as one JSON line, page
532
+ after page, until it is caught up, then the cursor on stderr: pass it as
533
+ `--after` to read only the newer calls. A call may come twice across runs;
534
+ deduplicate by `id`.
535
+
536
+ ## Exit codes
455
537
 
456
538
  | Code | Meaning |
457
539
  | --- | --- |
458
540
  | 0 | Success |
459
541
  | 1 | Generic failure, including a missing Docker or Compose v2 |
460
- | 2 | Usage error (including no Tenant selected, or `delete` without `--yes`), or a removed or moved command |
461
- | 3 | `status`: the Runtime is not answering; `sandbox`: the Tenant is not running; `stop`/`logs`: no Tenant yet; `delete`: no such Tenant; `start`: a Tenant created by nylorun 0.5 (reset it) |
542
+ | 2 | Usage error (including no Tenant selected, or `local delete` without `--yes`), or a removed or moved command |
543
+ | 3 | `status`: the Runtime is not answering; `tenant`, `environments`, `local sandbox`: the local Tenant is not running; `stop`/`local logs`: no Tenant yet; `local delete`: no such Tenant; `start`: a Tenant created by nylorun 0.5 (reset it) |
462
544
  | 4 | The Runtime port is held by another Host |
463
545
  | 5 | `up`/`start`/`studio`: this nylorun pins a Runtime older than the one that last ran the Tenant; update nylorun, or `start --allow-downgrade` |
464
546
  | 7 | The containers, the Tenant or Studio did not become ready (an unavailable Tenant's cause is printed) |
465
- | 130 / 143 | SIGINT / SIGTERM |
547
+ | 130 / 143 | SIGINT / SIGTERM (also `tenant models set` cancelled) |
466
548
 
467
549
  ## Troubleshooting
468
550
 
@@ -471,15 +553,15 @@ These are `nylorun`'s; [`nylo`'s](#nylo-exit-codes) are above.
471
553
  | Docker missing or not running | Install or start Docker Desktop, OrbStack or Colima; `nylorun doctor` checks |
472
554
  | `426` from the Runtime | Upgrade nylorun (`npx nylorun@latest start`), or pin a matching older set |
473
555
  | `Refusing to start Runtime …` (exit 5) | Upgrade nylorun (`npx nylorun@latest start`); `--allow-downgrade` only when both Runtimes share the database schema |
474
- | `Tenant … is unavailable` (exit 7) | Follow the repair it names; `nylorun logs runtime` |
556
+ | `Tenant … is unavailable` (exit 7) | Follow the repair it names; `nylorun local logs runtime` |
475
557
  | Port conflict | Change `NYLORUN_PORT` / `NYLORUN_STUDIO_PORT` in `~/.nylorun/tenants/<name>/docker/.env` |
476
- | Logs | `nylorun logs runtime -f` |
558
+ | Logs | `nylorun local logs runtime -f` |
477
559
  | Studio login expired | `nylorun studio` |
478
- | Which Studio is which | `nylorun ls` lists each Tenant's Studio URL; `nylorun studio --tenant <name>` opens one signed in |
479
- | `Tenant … was created by nylorun 0.5` (exit 3) | `nylorun reset --tenant <name>` (its data starts fresh) |
480
- | `nylo`: no Runtime answers, or the Tenant is not open | `npx nylorun start`, then `npx nylorun status`, which shows the cause and its `repair` |
481
- | `nylo`: no management key | `npx nylorun start` in the project writes one; elsewhere set `NYLORUN_MANAGEMENT_KEY` |
482
- | `nylo`: `403 key_role_mismatch` | The key belongs to the other API: a management key for the Management API, an application key for the Runtime API |
483
- | `nylo`: old Project link refused | `npx nylorun start` in the project |
560
+ | Which Studio is which | `nylorun local ls` lists each Tenant's Studio URL; `nylorun studio --tenant <name>` opens one signed in |
561
+ | `Tenant … was created by nylorun 0.5` (exit 3) | `nylorun local reset --tenant <name>` (its data starts fresh) |
562
+ | `tenant` or `environments`: the Tenant is not running or not open | `npx nylorun start`, then `npx nylorun status`, which shows the cause and its `repair` |
563
+ | No management key for a remote installation | Set `NYLORUN_MANAGEMENT_KEY`; on the Runtime's machine `nylorun tenant keys put <id> --management` issues one |
564
+ | `403 key_role_mismatch` | The key belongs to the other API: a management key for the Management API, an application key for the Runtime API |
565
+ | Old Project link refused | `npx nylorun start` in the project |
484
566
 
485
567
  See [MIGRATION.md](../../guides/MIGRATION.md).