nylorun 0.13.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 (76) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +255 -166
  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 +10 -4
  9. package/dist/client/doctor.js +28 -20
  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/client/mcp.d.ts +11 -0
  17. package/dist/{stack → client}/mcp.js +40 -26
  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/errors.d.ts +1 -1
  36. package/dist/errors.js +1 -1
  37. package/dist/nylo.js +20 -4
  38. package/dist/sandbox/cluster-file.d.ts +1 -1
  39. package/dist/sandbox/commands.d.ts +1 -1
  40. package/dist/sandbox/commands.js +7 -7
  41. package/dist/sandbox/manifests.d.ts +1 -1
  42. package/dist/sandbox/manifests.js +1 -1
  43. package/dist/sandbox/probe.d.ts +1 -1
  44. package/dist/stack/commands.d.ts +9 -4
  45. package/dist/stack/commands.js +22 -26
  46. package/dist/stack/compose-file.d.ts +1 -1
  47. package/dist/stack/compose-file.js +22 -13
  48. package/dist/stack/env-file.d.ts +2 -2
  49. package/dist/stack/env-file.js +2 -2
  50. package/dist/stack/images.d.ts +1 -1
  51. package/dist/stack/images.js +1 -1
  52. package/dist/stack/index.d.ts +1 -10
  53. package/dist/stack/index.js +3 -19
  54. package/dist/stack/keys.d.ts +2 -2
  55. package/dist/stack/keys.js +14 -11
  56. package/dist/stack/paths.d.ts +1 -1
  57. package/dist/stack/prepare.d.ts +1 -1
  58. package/dist/stack/stacks.js +1 -1
  59. package/dist/stack/versions.d.ts +2 -2
  60. package/dist/stack/versions.js +3 -3
  61. package/dist/telemetry.d.ts +2 -2
  62. package/dist/telemetry.js +4 -4
  63. package/package.json +10 -9
  64. package/dist/client/access/commands.d.ts +0 -8
  65. package/dist/client/access/commands.js +0 -33
  66. package/dist/client/cli.d.ts +0 -2
  67. package/dist/client/cli.js +0 -106
  68. package/dist/client/installation/commands.d.ts +0 -7
  69. package/dist/client/installation/commands.js +0 -80
  70. package/dist/client/project/connection.d.ts +0 -36
  71. package/dist/client/project/connection.js +0 -80
  72. package/dist/client/project/env.d.ts +0 -3
  73. package/dist/client/project/env.js +0 -19
  74. package/dist/stack/mcp.d.ts +0 -9
  75. package/dist/stack/sandbox.d.ts +0 -4
  76. package/dist/stack/sandbox.js +0 -106
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,13 +15,13 @@ 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:
24
- [runtime/src/CONTEXT.md](../runtime/src/CONTEXT.md).
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
+ [runtime/server/src/CONTEXT.md](../../runtime/server/src/CONTEXT.md).
25
25
 
26
26
  Prerequisites, installed by the developer (nylorun never downloads them): Node
27
27
  24 or newer, and Docker with Compose v2 ([Docker
@@ -37,39 +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 sandboxes
52
- nylorun sandbox rm <id> [--tenant <name>] # delete a sandbox and its files
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>] [--vault <id>] [--sse] [--tenant <name>] [--json] # a remote MCP server's tools, with the installation vault'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: add a key or a gateway credential to a
68
- vault instead, and preview the server with `nylorun mcp inspect`).
69
- `nylorun configure`, `nylorun status --env` and `nylorun doctor sandbox` exit 2
70
- naming `nylo configure`, `nylo env` and `nylo doctor sandbox`.
71
- `nylorun status` and `nylorun reset` are not `nylo status` and `nylo reset`: see
72
- [`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 |
73
136
 
74
137
  ## Tenants
75
138
 
@@ -86,7 +149,7 @@ Every command acts on one Tenant, chosen in this order:
86
149
 
87
150
  In a project without a link, the commands other than `start` exit 2 and list
88
151
  the Tenants on this machine. A name is lowercase letters, digits, `-` and `_`;
89
- 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
90
153
  them).
91
154
 
92
155
  Each Tenant has its own Host root `~/.nylorun/tenants/<name>/`, Compose project
@@ -103,7 +166,7 @@ Tenants run side by side, each on its own ports, containers, network and
103
166
  volumes ([The containers](#the-containers)); a running Tenant uses about
104
167
  1.2 GB. Each Studio is on its own port, `http://localhost:<port>`, with its own
105
168
  session cookie, so two Studios in one browser stay signed in;
106
- `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`
107
170
  lists them with their state, the memory their containers use (`MEMORY`: the sum
108
171
  of `docker stats` over the containers labelled `dev.nylorun.tenant=<name>`, `-`
109
172
  when stopped; `memoryBytes` in `--json`, `null` when stopped or unknown), the
@@ -129,7 +192,7 @@ A Tenant created by nylorun 0.5 keeps its data in volumes Compose named
129
192
  `<project>_postgres`, `<project>_restate`, `<project>_s2` and
130
193
  `<project>_workspaces`; this release names them `<project>-postgres`, … (see
131
194
  [The containers](#the-containers)). `start` on such a Tenant exits 3 without
132
- 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
133
196
  start it fresh. `reset` and `delete` also remove the old volumes (and the old
134
197
  network `<project>_default`).
135
198
 
@@ -162,7 +225,7 @@ its own `.gitignore` of `*`):
162
225
  application key, keeps it and gains the management key.
163
226
 
164
227
  Later starts reuse the Tenant and rewrite the link only when the Tenant's name,
165
- 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
166
229
  new link, `start` seeds the Tenant from the project's `.env`: the sandbox
167
230
  backend (`NYLORUN_SANDBOX=auto|virtual`) and the model credential
168
231
  (`MODEL_PROVIDER`, `MODEL`, `MODEL_PROVIDER_API_KEY`, `MODEL_PROVIDER_BASE_URL`,
@@ -184,43 +247,49 @@ replaced by the application key otherwise.
184
247
 
185
248
  Every Tenant serves the Runtime API, which takes **application keys**, and the
186
249
  Management API (`/v1/tenant/*`), which takes **management keys**
187
- ([SELF_HOSTING.md](../SELF_HOSTING.md#keys)). `nylorun key` manages both on the
188
- running Tenant through `nylorun-operate` in its runtime container, so only this
189
- machine can issue a management key.
190
-
191
- `nylorun key put <id>` creates the application key `<id>` (or rotates it: the
192
- previous key stops working at once) and prints it once on stdout; with
193
- `--management` it puts a management key. `nylorun key list [--json]` shows each
194
- key's id, role and when it was issued, never the keys; `nylorun key rm <id>`
195
- deletes one. Ids match `^[a-z][a-z0-9-]{0,31}$`; `studio` belongs to Studio and
196
- `bootstrap` to `NYLORUN_MANAGEMENT_KEY_FILE`, and both are refused. Putting an
197
- id that holds the other role is refused. Give each app server its own
198
- application key. `nylorun sandbox` and `nylorun mcp` use the linked project's keys, or the keys
199
- `cli` and `cli-management` they put once and keep in
200
- `<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).
201
266
 
202
267
  ## MCP servers
203
268
 
204
- An agent names its MCP servers by URL; the operator gives each URL a vault
205
- credential, a `bearer` token or a `headers` map, with `via` and an identity
206
- header when an MCP gateway holds each person's sign-in. Add it on Studio's
207
- Credentials page or with `@nylorun/admin` (no `nylorun` command adds one); the
208
- whole flow, with gateway recipes, is in
209
- [DEPLOYMENT.md](../DEPLOYMENT.md#mcp-servers-and-http-tools).
210
-
211
- `nylorun mcp inspect <url>` shows what a remote MCP server offers before an
212
- agent names it, through the running Tenant's Management API
269
+ An agent names its MCP servers by URL; a session gets a credential for a URL from
270
+ the Environment it is opened on (`createSession({ environment })`): a secret of that
271
+ Environment, a `bearer` token or a `headers` map, with `via` and an identity
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),
275
+ `client.environments.secrets.put(id, name, secret)` of `@nylorun/agents` (the
276
+ Runtime API, an application key) or in Studio.
277
+ The whole flow, with gateway recipes, is in
278
+ [DEPLOYMENT.md](../../guides/DEPLOYMENT.md#mcp-servers-and-http-tools).
279
+
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
213
282
  (`POST /v1/tenant/mcp/preview`, with the management key). The Runtime connects
214
- with the installation vault's credential for `<url>` (`--vault <id>` picks the
215
- vault when several hold one), lists the tools within 15 s and calls none. It
283
+ with Environment `<id>`'s credential for `<url>` when `--environment <id>` names one
284
+ (without it, no credential is sent), lists the tools within 15 s and calls none. It
216
285
  prints a table of each tool's model name, input schema size, hints
217
286
  (`read-only`, `destructive`, `idempotent`) and description, then the tools
218
287
  renamed for the model. `--server` is the server name your manifest uses (default:
219
288
  the host's name, `linear` for `mcp.linear.app`); `--sse` speaks the older SSE
220
289
  transport; `--json` prints the Runtime's answer. A server that answers `401`
221
290
  needs a credential: it says so, and names the server's sign-in from its
222
- protected-resource metadata, since such a server needs a key in a vault or an
223
- MCP gateway that holds each person's sign-in. A server it cannot list exits 1 with
291
+ protected-resource metadata, since such a server needs a key in an Environment's
292
+ secrets or an MCP gateway that holds each person's sign-in. A server it cannot list exits 1 with
224
293
  the reason (`mcp.unreachable` for an address the Runtime refuses).
225
294
 
226
295
  ## The containers
@@ -305,29 +374,32 @@ loads no analytics inside an embedding app, or when the browser sends Do Not
305
374
  Track or Global Privacy Control.
306
375
 
307
376
  It is on by default, and `nylorun start` says so the first time. Turn it off on
308
- this machine with `nylorun telemetry disable` (kept in
377
+ this machine with `nylorun local telemetry disable` (kept in
309
378
  `~/.nylorun/telemetry.json`), or for one start with `NYLORUN_TELEMETRY_DISABLED=1`
310
379
  or `DO_NOT_TRACK=1`. It is always off when `CI` is set. `nylorun start` decides
311
380
  on every start and writes the result to `NYLORUN_STUDIO_ANALYTICS_ID` in
312
- `docker/.env` (empty when off); `nylorun telemetry` reports the current choice.
381
+ `docker/.env` (empty when off); `nylorun local telemetry` reports the current choice.
313
382
 
314
383
  ## Sandboxes
315
384
 
316
- A session gets a sandbox when it is opened with one, or when the Tenant's
317
- default names one (`PUT /v1/tenant/sandbox`). A local Tenant runs them on the
318
- Runtime's **virtual** backend: an emulated shell in the Runtime process, with no
319
- extra containers. It is not a VM or container boundary.
320
-
321
- A sandbox can also be a resource with its own id (`PUT /v1/sandboxes/{id}`,
322
- `client.sandboxes` in `@nylorun/agents`) that sessions attach to and that
323
- outlives them. `nylorun sandbox ls` lists the running Tenant's sandboxes with
324
- their state, attached sessions and labels; `nylorun sandbox rm <id>` deletes one
325
- and its files (refused while a turn runs in it). Neither starts a stopped Tenant
326
- (exit 3).
385
+ A session gets a sandbox from the Environment it is opened on
386
+ (`createSession({ environment: id })`; protocol 11): an Environment has its own id
387
+ (`PUT /v1/environments/{id}`, `client.environments` in `@nylorun/agents`), one
388
+ sandbox and one vault of secrets, and outlives the sessions that name it. A session
389
+ opened on none has no sandbox. Kind `virtual` (the default) runs on the Runtime's
390
+ **virtual** backend: an emulated shell in the Runtime process, with no extra
391
+ containers. It is not a VM or container boundary. Kind `pod` runs in a pod on a
392
+ cluster (below).
393
+
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
396
+ and vault (refused while a turn runs in it). Neither starts a stopped Tenant
397
+ (exit 3). The Tenant's limits for Environments (`limits.environments`, `idle`,
398
+ resources, network) are `PUT /v1/tenant/sandbox` on the Management API.
327
399
 
328
400
  ### Pods on a cluster (preview)
329
401
 
330
- `nylorun sandbox enable --context <name>` prepares a Kubernetes context for the
402
+ `nylorun local sandbox enable --context <name>` prepares a Kubernetes context for the
331
403
  Tenant's sandboxes as pods ([agent-sandbox](https://github.com/kubernetes-sigs/agent-sandbox)
332
404
  v1.0.5): Docker Desktop's cluster (`--context docker-desktop`) or kind. It only
333
405
  touches the context you name. It installs the pinned agent-sandbox controller
@@ -337,9 +409,9 @@ with a probe that the cluster enforces NetworkPolicy (and refuses it otherwise),
337
409
  lets pods reach only three ports on the Docker host, and adds the `sandboxes`
338
410
  service to the Tenant: the one container holding the cluster credentials
339
411
  (`<Host root>/sandboxes/`). On kind under Linux, pass `--host-address 172.17.0.1`.
340
- `nylorun sandbox disable` removes the service (`--delete-namespace` also deletes
341
- the namespace and every sandbox in it). Sessions keep using the virtual backend
342
- in this release.
412
+ `nylorun local sandbox disable` removes the service (`--delete-namespace` also deletes
413
+ the namespace and every sandbox in it). Sessions run in a pod when their
414
+ Environment has kind `pod` (`client.environments.put(id, { kind: "pod" })`).
343
415
 
344
416
  ## Host root
345
417
 
@@ -352,110 +424,127 @@ and `cli-credentials.json` (the keys `project` and `project-management`, `cli`
352
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`,
353
425
  the Tenant's vault key, which only the gateway container mounts. The Tenant's data lives in its Postgres, Restate and S2 volumes.
354
426
 
355
- `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
356
428
  its files and ports; the next start creates the Tenant anew (with a new id) and
357
- relinks the project. `nylorun delete <tenant> --yes` removes the Tenant's
429
+ relinks the project. `nylorun local delete <tenant> --yes` removes the Tenant's
358
430
  containers, volumes and Host root: the vault key (KEK) and all its data go with it.
359
431
 
360
- ## The Runtime client: `nylo`
361
-
362
- `nylo` acts on the one Tenant of the linked installation: a local Tenant or any
363
- Runtime reachable by URL and key. Run it without installing, or in a project
364
- that has `nylorun` as a devDependency:
365
-
366
- ```sh
367
- npx -p nylorun nylo status # anywhere
368
- npx nylo status # in a project with nylorun installed
369
- ```
370
-
371
- Outside such a project, `npx nylo` looks for an npm package named `nylo`, which
372
- is not this one: use `npx -p nylorun nylo`. The deprecated
373
- [`@nylorun/cli`](../cli/README.md) runs this `nylo` for one more release.
374
-
375
- ```sh
376
- nylo status [--json] # the Tenant, its checks and counts
377
- nylo reset [--sessions|--sandboxes|--all] [--yes]
378
- nylo access signing-keys … # the Tenant's signing keys: list, rotate, revoke
379
- nylo configure # set or replace the Tenant's model provider
380
- nylo env # export lines for the linked Project
381
- nylo doctor sandbox [--json] # sandbox backend via the Management API
382
- ```
383
-
384
- Every command acts on the linked installation: the [Project link and
385
- credentials](#the-project-link), or `NYLORUN_RUNTIME_URL` and
386
- `NYLORUN_SERVER_KEY` when the Project has no link. An installation serves one
387
- Tenant, so nothing selects it. `status`, `reset`, `access`, `configure` and
388
- `doctor` use the Management API with the Project's management key, or
389
- `NYLORUN_MANAGEMENT_KEY` (with `NYLORUN_RUNTIME_URL` when there is no link);
390
- `env` prints the Runtime URL and the application key, for the Runtime API:
391
-
392
- ```sh
393
- eval "$(npx -p nylorun nylo env)"
394
- # → NYLORUN_RUNTIME_URL, NYLORUN_SERVER_KEY
395
- ```
396
-
397
- `nylo` only reads the link, with `@nylorun/core/project`'s reader. It refuses a
398
- link from an older nylorun (format 0 to 2) and says to run `npx nylorun start`,
399
- which links the project again. `createClient` in `@nylorun/agents` reads the
400
- link (or the two variables) too, so the project's `npm run dev` and `npm start`
401
- need no Nylorun tool.
432
+ ## Remote installations
402
433
 
403
- Local Tenant commands (`up`, `down`, `start`, `stop`, `logs`, `studio`) exit 2
404
- naming `npx nylorun <command>`. `nylo tenant …` exits 2: `npx nylorun start`
405
- creates the project's Tenant and the link, and `nylo status|reset` replace
406
- `nylo tenant status|reset`. `nylo endpoints` was removed with Action endpoints
407
- (protocol 8: the Runtime runs no code of yours during a session) and exits 2.
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:
408
437
 
409
- ### `status` and `reset`: `nylorun` or `nylo`
410
-
411
- Both commands have a `status` and a `reset`, which act on different things:
412
-
413
- | | `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` |
414
478
  | --- | --- | --- |
415
- | 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 |
416
- | `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` |
417
- | `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 sandboxes 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 |
418
481
 
419
- `nylo reset --all` asks first; pass `--yes` when not in a terminal.
420
- `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`.
421
484
 
422
- ### `nylo configure`
485
+ ### `nylorun tenant models set`
423
486
 
424
487
  Lists the Tenant's model catalog (`GET /v1/tenant/models`), asks for a provider,
425
488
  a model and its sign-in (an API key, or the provider's OAuth), and sets the
426
489
  Tenant's model provider (`PUT /v1/tenant/model`). The sign-in flows come from
427
490
  `@earendil-works/pi-ai`, about 100 MB with its provider SDKs, which no other
428
491
  command needs, so it is not a dependency of nylorun and `npx nylorun` stays
429
- small. When it does not resolve beside nylorun, the first `nylo configure`
430
- 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
431
494
  scripts, into `~/.nylorun/lib/pi-ai-<version>/` (under `NYLORUN_HOME` when that
432
495
  is set), and later runs reuse it. Studio's model settings, and `.env` at
433
496
  `nylorun start`, set the provider without it.
434
497
 
435
- ### `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.
436
503
 
437
- | Code | Meaning |
438
- | --- | --- |
439
- | 0 | Success |
440
- | 1 | Generic failure |
441
- | 2 | Usage error, or a moved or removed command |
442
- | 6 | No Runtime at the linked or local URL |
443
- | 130 / 143 | SIGINT / SIGTERM |
504
+ ```sh
505
+ printenv OPENAI_API_KEY | nylorun tenant models set --provider openai --model gpt-5
506
+ ```
444
507
 
445
- ## 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.
446
510
 
447
- 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
448
537
 
449
538
  | Code | Meaning |
450
539
  | --- | --- |
451
540
  | 0 | Success |
452
541
  | 1 | Generic failure, including a missing Docker or Compose v2 |
453
- | 2 | Usage error (including no Tenant selected, or `delete` without `--yes`), or a removed or moved command |
454
- | 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) |
455
544
  | 4 | The Runtime port is held by another Host |
456
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` |
457
546
  | 7 | The containers, the Tenant or Studio did not become ready (an unavailable Tenant's cause is printed) |
458
- | 130 / 143 | SIGINT / SIGTERM |
547
+ | 130 / 143 | SIGINT / SIGTERM (also `tenant models set` cancelled) |
459
548
 
460
549
  ## Troubleshooting
461
550
 
@@ -464,15 +553,15 @@ These are `nylorun`'s; [`nylo`'s](#nylo-exit-codes) are above.
464
553
  | Docker missing or not running | Install or start Docker Desktop, OrbStack or Colima; `nylorun doctor` checks |
465
554
  | `426` from the Runtime | Upgrade nylorun (`npx nylorun@latest start`), or pin a matching older set |
466
555
  | `Refusing to start Runtime …` (exit 5) | Upgrade nylorun (`npx nylorun@latest start`); `--allow-downgrade` only when both Runtimes share the database schema |
467
- | `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` |
468
557
  | Port conflict | Change `NYLORUN_PORT` / `NYLORUN_STUDIO_PORT` in `~/.nylorun/tenants/<name>/docker/.env` |
469
- | Logs | `nylorun logs runtime -f` |
558
+ | Logs | `nylorun local logs runtime -f` |
470
559
  | Studio login expired | `nylorun studio` |
471
- | Which Studio is which | `nylorun ls` lists each Tenant's Studio URL; `nylorun studio --tenant <name>` opens one signed in |
472
- | `Tenant … was created by nylorun 0.5` (exit 3) | `nylorun reset --tenant <name>` (its data starts fresh) |
473
- | `nylo`: no Runtime answers, or the Tenant is not open | `npx nylorun start`, then `npx nylorun status`, which shows the cause and its `repair` |
474
- | `nylo`: no management key | `npx nylorun start` in the project writes one; elsewhere set `NYLORUN_MANAGEMENT_KEY` |
475
- | `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 |
476
- | `nylo`: old Project link refused | `npx nylorun start` in the project |
477
-
478
- See [MIGRATION.md](../MIGRATION.md).
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 |
566
+
567
+ See [MIGRATION.md](../../guides/MIGRATION.md).