@nylorun/cli 0.7.0-beta → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @nylorun/cli
2
2
 
3
+ ## 0.8.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 4b9906f: **Breaking: "Tenant" replaces "stack", and `nylorun start` works anywhere.** Each local installation holds one Tenant, and its name is the Tenant's name, so help, output, errors and docs say Tenant. See MIGRATION.md.
8
+
9
+ - **Breaking (`nylorun`): selection.** Every command acts on the Tenant `--tenant <name>` names (replaces `--name`, which is removed), else `NYLORUN_TENANT` (replaces `NYLORUN_STACK`), else the Project link's `tenant`; `start` in a project names a new one after the project directory. Outside a project, or with `start --no-link`, commands act on the Tenant `default`. In a project without a link, commands other than `start` exit 2 and list the machine's Tenants. A name starting with `tn_` (a Tenant id) is refused.
10
+ - **Breaking (`nylorun`): files.** Host roots are under `~/.nylorun/tenants/<name>/` (was `~/.nylorun/stacks/<name>/`) with `tenant.json` (was `stack.json`); the `.env` key is `NYLORUN_TENANT_NAME` (was `NYLORUN_STACK_NAME`); `NYLORUN_COMPOSE_PROJECT` replaces `NYLORUN_STACK_PROJECT`. Compose projects stay `nylorun-<name>`. Every command first moves 0.4 Host roots from `~/.nylorun/stacks/` to `~/.nylorun/tenants/` (renaming `stack.json` and the `.env` key), so they keep their volumes and keys. `nylorun ls` lists only directories with `tenant.json`.
11
+ - **Breaking (`nylorun`): removed.** `nylorun legacy` and all handling of the single stack of releases before 0.4; the hidden `nylorun stack <cmd>` alias; `nylorun doctor stack|runtime`. Output says Tenant: `ls` prints `TENANT` and JSON `{ "tenants": [...] }`, `status` prints the Tenant id on its own line, and `doctor`'s row is `tenant`.
12
+ - **Breaking: Project link format 3.** `.nylorun/link.json` is `{ "format": 3, "tenant", "tenantId", "hostUrl", "hostId" }`; `tenant` replaces `stack`. `@nylorun/agents`, `@nylorun/cli` and `@nylorun/admin` refuse an older link and name `npx nylorun start`, which rewrites it. `@nylorun/core`'s `ProjectLinkFileSchema` parses formats 0–3 with `tenant`.
13
+ - **Breaking (`@nylorun/admin`):** `createAdmin({ tenant })` replaces `{ stack }`, `tenantHostRoot(name)` replaces `stackHostRoot(name)`, and local resolution reads `NYLORUN_TENANT` and the link's `tenant`.
14
+ - `@nylorun/cli`: `status` and `endpoints` drop the `stack` line and JSON key; messages say Tenant. `@nylorun/agents`: a Runtime too old for the client says "update the Runtime (npx nylorun@latest start)". `@nylorun/studio`: setup hints say Tenant. `@nylorun/create-agent`: the next steps describe `npx nylorun@beta start` as this project's Tenant and its link.
15
+
16
+ ### Patch Changes
17
+
18
+ - Pin agents to the tested release.
19
+ - Pin admin to the tested release.
20
+ - Updated dependencies [4b9906f]
21
+ - Updated dependencies
22
+ - Updated dependencies
23
+ - @nylorun/agents@0.12.0-beta
24
+ - @nylorun/admin@0.8.0-beta
25
+
3
26
  ## 0.7.0-beta
4
27
 
5
28
  ### Major Changes
package/README.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # @nylorun/cli
2
2
 
3
3
  The Runtime client, command `nylo`: it acts on the one Tenant of an
4
- installation, a local stack or any Runtime reachable by URL and key. Setting up
5
- and running the local stack is [`nylorun`](../nylorun/README.md)'s job; the two
4
+ installation, a local Tenant or any Runtime reachable by URL and key. Setting up
5
+ and running local Tenants is [`nylorun`](../nylorun/README.md)'s job; the two
6
6
  packages are independent and never call each other. Depends on
7
7
  `@nylorun/agents` and `@nylorun/admin` only among Nylorun packages. Vocabulary:
8
8
  [runtime/src/CONTEXT.md](../runtime/src/CONTEXT.md).
9
9
 
10
10
  ```sh
11
- npx nylorun start # in the project: its stack, its Tenant and the Project link
11
+ npx nylorun start # in the project: its Tenant and the Project link
12
12
  npx @nylorun/cli status # the linked Tenant
13
13
  ```
14
14
 
15
15
  ## Commands
16
16
 
17
17
  ```sh
18
- nylo status [--json] # the Tenant, its checks and counts, and the link's stack
18
+ nylo status [--json] # the Tenant, its checks and counts
19
19
  nylo reset [--sessions|--sandboxes|--all] [--yes]
20
20
  nylo endpoints [--json]|ping <agent> # the registered Action endpoints and their health
21
21
  nylo access … # access policy, publishable and signing keys, subject tokens
@@ -28,9 +28,9 @@ Every command acts on the linked installation: the Project link and
28
28
  credentials (below), or `NYLORUN_RUNTIME_URL` and `NYLORUN_SERVER_KEY` when the
29
29
  Project has no link. An installation serves one Tenant, so nothing selects it.
30
30
 
31
- Local stack commands (`up`, `down`, `start`, `stop`, `logs`, `studio`) exit 2
31
+ Local Tenant commands (`up`, `down`, `start`, `stop`, `logs`, `studio`) exit 2
32
32
  naming `npx nylorun <command>`. `nylo tenant …` exits 2: `npx nylorun start`
33
- creates the stack, its Tenant and the link, and `nylo status|reset|endpoints`
33
+ creates the project's Tenant and the link, and `nylo status|reset|endpoints`
34
34
  replace `nylo tenant status|reset|endpoints`. `nylorun dev` was removed: run
35
35
  `npx nylorun start` once, then the project's own `npm run dev`
36
36
  (`tsx watch src/main.ts`).
@@ -38,9 +38,9 @@ replace `nylo tenant status|reset|endpoints`. `nylorun dev` was removed: run
38
38
  ## `nylo status`
39
39
 
40
40
  Reads the Tenant API status (`GET /v1/tenant`) and prints the Tenant, the
41
- stack the link names, the Runtime URL, the checks, the counts and the sandbox
41
+ Runtime URL, the checks, the counts and the sandbox
42
42
  backend. When the Tenant is not open it does not answer; `nylo status` then
43
- asks the Admin API (`/v1/admin/status`, through the local stack's Host root or
43
+ asks the Admin API (`/v1/admin/status`, through the local Tenant's Host root or
44
44
  `NYLORUN_ADMIN_URL` and `NYLORUN_ADMIN_KEY`) and prints why, with the repair.
45
45
 
46
46
  ## `nylo reset`
@@ -53,15 +53,14 @@ not in a terminal. The Project link and credentials are kept.
53
53
 
54
54
  `npx nylorun start` writes it; `nylo` only reads it. A **Project** stores only:
55
55
 
56
- - `.nylorun/link.json`: `{ format: 2, stack, hostUrl, hostId, tenantId }`
57
- (`tenantId` is information)
56
+ - `.nylorun/link.json`: `{ format: 3, tenant, hostUrl, hostId, tenantId }`
57
+ (`tenant` is the local Tenant's name; `tenantId` is information)
58
58
  - `.nylorun/credentials.json`: the key of the derived principal `project` and
59
59
  its id (0600)
60
60
  - `.nylorun/.gitignore` containing `*`
61
61
 
62
- A format 0 or 1 link named a Tenant on an older multi-Tenant Host: `nylo`
63
- refuses it and says to run `npx nylorun start`, which starts the project's own
64
- stack and links it again.
62
+ A link from an older nylorun (format 0 to 2): `nylo` refuses it and says to run
63
+ `npx nylorun start`, which links the project again.
65
64
 
66
65
  `createActionHandler` and `createClient` in `@nylorun/agents` read the link (or
67
66
  the two variables), so the project's `npm run dev` and `npm start` need no
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ const usage = `nylo <status|reset|endpoints|access|configure|env|doctor>
12
12
 
13
13
  Runtime client for the linked installation and its one Tenant (the Project link that
14
14
  npx nylorun start writes, or NYLORUN_RUNTIME_URL and NYLORUN_SERVER_KEY):
15
- status [--json] the Tenant, its checks and counts, and the stack
15
+ status [--json] the Tenant, its checks and counts
16
16
  reset [--sessions|--sandboxes|--all] [--yes]
17
17
  clear the Tenant's sessions, sandboxes or all its data
18
18
  endpoints [--json]|ping <agent> the registered Action endpoints and their health
@@ -25,14 +25,14 @@ npx nylorun start writes, or NYLORUN_RUNTIME_URL and NYLORUN_SERVER_KEY):
25
25
  env print the linked Project's NYLORUN_* variables as exports
26
26
  doctor sandbox [--json] show which sandbox backend this Tenant's Host offers
27
27
 
28
- The local stack is managed by the nylorun package: npx nylorun start in a project creates
29
- its stack, its Tenant and the Project link.`;
30
- /** Local stack commands, which moved to the nylorun package. */
31
- const STACK_COMMANDS = new Set([
32
- "up", "down", "start", "stop", "logs", "studio", "stack", "runtime", "restart", "run",
28
+ Local Tenants are run by the nylorun package: npx nylorun start in a project creates its
29
+ Tenant and the Project link.`;
30
+ /** Local Tenant commands, which the nylorun package runs. */
31
+ const LOCAL_COMMANDS = new Set([
32
+ "up", "down", "start", "stop", "logs", "studio", "runtime", "restart", "run",
33
33
  ]);
34
34
  const TENANT_REMOVED = `nylo tenant was removed: an installation serves one Tenant.
35
- Run "npx nylorun start" in your project to create its stack, its Tenant and the Project link.
35
+ Run "npx nylorun start" in your project to create its Tenant and the Project link.
36
36
  Then use nylo status, nylo reset and nylo endpoints on the linked installation.`;
37
37
  function parseFlags(args, allowed = {}) {
38
38
  const booleans = new Set();
@@ -99,15 +99,15 @@ async function main() {
99
99
  if (command === "doctor") {
100
100
  const [topic, ...options] = args;
101
101
  if (topic !== "sandbox" || options.some((option) => option !== "--json"))
102
- throw usageError("Usage: nylo doctor sandbox [--json]. Check the local stack with npx nylorun doctor.");
102
+ throw usageError("Usage: nylo doctor sandbox [--json]. Check the local Tenant with npx nylorun doctor.");
103
103
  const { doctorSandbox } = await import("./doctor.js");
104
104
  await doctorSandbox({ json: options.includes("--json") });
105
105
  return;
106
106
  }
107
107
  if (command === "dev")
108
108
  throw usageError('nylorun dev was removed: run "npx nylorun start" once in your project, then your project\'s npm run dev.');
109
- if (STACK_COMMANDS.has(command))
110
- throw usageError(`The local stack moved to the nylorun package: npx nylorun ${command}`);
109
+ if (LOCAL_COMMANDS.has(command))
110
+ throw usageError(`Local Tenants are run by the nylorun package: npx nylorun ${command}`);
111
111
  if (command === "configure") {
112
112
  const flags = parseFlags(args);
113
113
  if (flags.rest.length)
@@ -120,7 +120,7 @@ async function main() {
120
120
  process.once("SIGTERM", () => cancel("SIGTERM"));
121
121
  const health = await fetch(`${auth.url}/health`).catch(() => undefined);
122
122
  if (!health?.ok)
123
- throw new CliError(`No Runtime is listening at ${auth.url}. Start the local stack with "npx nylorun start".`, 6);
123
+ throw new CliError(`No Runtime is listening at ${auth.url}. Start the local Tenant with "npx nylorun start".`, 6);
124
124
  const catalog = await fetchModelCatalog({ url: auth.url, key: auth.key });
125
125
  const prompted = await configureProvider({
126
126
  signal: controller.signal,
package/dist/home.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Where `nylo` keeps its own files (the installation id): an explicit home,
3
- * `NYLORUN_HOME`, or `~/.nylorun`, which holds the local stacks' Host roots
4
- * (`stacks/<name>/`). `@nylorun/admin` resolves a stack's Host root itself.
3
+ * `NYLORUN_HOME`, or `~/.nylorun`, which holds the local Tenants' Host roots
4
+ * (`tenants/<name>/`). `@nylorun/admin` resolves a Tenant's Host root itself.
5
5
  */
6
6
  export declare function resolveHome(home?: string, env?: Readonly<Record<string, string | undefined>>): string;
package/dist/home.js CHANGED
@@ -2,8 +2,8 @@ import { homedir } from "node:os";
2
2
  import { join, resolve } from "node:path";
3
3
  /**
4
4
  * Where `nylo` keeps its own files (the installation id): an explicit home,
5
- * `NYLORUN_HOME`, or `~/.nylorun`, which holds the local stacks' Host roots
6
- * (`stacks/<name>/`). `@nylorun/admin` resolves a stack's Host root itself.
5
+ * `NYLORUN_HOME`, or `~/.nylorun`, which holds the local Tenants' Host roots
6
+ * (`tenants/<name>/`). `@nylorun/admin` resolves a Tenant's Host root itself.
7
7
  */
8
8
  export function resolveHome(home, env = process.env) {
9
9
  if (home !== undefined && home.trim() !== "")
@@ -18,17 +18,14 @@ export async function statusCommand(args) {
18
18
  throw new CliError("Usage: nylo status [--json]", 2);
19
19
  const root = projectRoot();
20
20
  const connection = await linkedConnection(root);
21
- const stack = connection.link?.stack;
22
21
  let reason;
23
22
  try {
24
23
  const body = await clientFor(connection).transport.json("/v1/tenant", "GET");
25
24
  if (json) {
26
- console.log(JSON.stringify({ ...(stack ? { stack } : {}), ...body }, null, 2));
25
+ console.log(JSON.stringify(body, null, 2));
27
26
  return;
28
27
  }
29
28
  console.log(`${body.tenant.name} ${body.tenant.id}`);
30
- if (stack)
31
- console.log(`stack ${stack}`);
32
29
  console.log(`runtime ${connection.url}`);
33
30
  console.log(`path ${body.path}`);
34
31
  console.log(`checks ${Object.entries(body.checks)
@@ -52,12 +49,10 @@ export async function statusCommand(args) {
52
49
  : `The Tenant at ${connection.url} is not reachable.`, 1);
53
50
  }
54
51
  if (json) {
55
- console.log(JSON.stringify({ ...(stack ? { stack } : {}), tenant }, null, 2));
52
+ console.log(JSON.stringify({ tenant }, null, 2));
56
53
  return;
57
54
  }
58
55
  console.log(`${tenant.name ?? "(unreadable)"} ${tenant.id ?? "(unknown)"} ${tenant.state}`);
59
- if (stack)
60
- console.log(`stack ${stack}`);
61
56
  console.log(`runtime ${connection.url}`);
62
57
  if (tenant.cause) {
63
58
  console.log(`reason ${tenant.cause.code}: ${tenant.cause.message}`);
@@ -76,10 +71,10 @@ export async function resetCommand(args) {
76
71
  throw new CliError("Pass only one of --sessions, --sandboxes, --all.", 2);
77
72
  const scope = flags.length ? SCOPES[flags[0]] : "sessions";
78
73
  const connection = await linkedConnection(projectRoot());
79
- const stack = connection.link?.stack;
80
- const where = stack ? `stack ${stack} (${connection.url})` : connection.url;
74
+ const tenant = connection.link?.tenant;
75
+ const target = tenant ? `Tenant ${tenant} (${connection.url})` : `the Tenant on ${connection.url}`;
81
76
  if (scope === "all" && !yes)
82
- await confirmOrThrow(`Reset ALL data of the Tenant on ${where}? The Project link and credentials are kept. [y/N] `);
77
+ await confirmOrThrow(`Reset ALL data of ${target}? The Project link and credentials are kept. [y/N] `);
83
78
  try {
84
79
  await clientFor(connection).transport.json("/v1/tenant/reset", "POST", {
85
80
  requestId: randomUUID(),
@@ -90,7 +85,7 @@ export async function resetCommand(args) {
90
85
  catch (error) {
91
86
  throw new CliError(error instanceof Error ? error.message : `Tenant reset failed: ${String(error)}`, 1);
92
87
  }
93
- console.log(`Reset the Tenant on ${where} (${scope}).`);
88
+ console.log(`Reset ${target} (${scope}).`);
94
89
  }
95
90
  async function confirmOrThrow(prompt) {
96
91
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
@@ -14,5 +14,5 @@ export async function linkedConnection(projectRoot, env = process.env) {
14
14
  const key = env.NYLORUN_SERVER_KEY?.trim();
15
15
  if (url && key)
16
16
  return { url: url.replace(/\/$/, ""), key };
17
- throw new CliError(`No Project link in ${projectRoot}. Run "npx nylorun start" in this project to start its stack and link it, or set NYLORUN_RUNTIME_URL and NYLORUN_SERVER_KEY.`, 1);
17
+ throw new CliError(`No Project link in ${projectRoot}. Run "npx nylorun start" in this project to start its Tenant and link it, or set NYLORUN_RUNTIME_URL and NYLORUN_SERVER_KEY.`, 1);
18
18
  }
@@ -7,7 +7,7 @@ export async function printLinkedEnvExports(projectRoot = process.cwd()) {
7
7
  const link = await readLink(root);
8
8
  const credentials = await readCredentials(root);
9
9
  if (!link || !credentials) {
10
- console.log('# No Project link in this directory. Run "npx nylorun start" in this project to start its stack and link it.');
10
+ console.log('# No Project link in this directory. Run "npx nylorun start" in this project to start its Tenant and link it.');
11
11
  return;
12
12
  }
13
13
  console.log(`export NYLORUN_RUNTIME_URL=${shellQuote(link.hostUrl)}`);
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Project-local link to an installation (format 2). `nylorun start` writes it; `nylo` only
2
+ * Project-local link to an installation (format 3). `nylorun start` writes it; `nylo` only
3
3
  * reads it. `tenantId` is information: the installation serves one Tenant, so nothing selects it.
4
4
  */
5
5
  export interface ProjectLink {
6
- format: 2;
7
- /** The local stack the link names (`~/.nylorun/stacks/<stack>/`). */
8
- stack?: string;
6
+ format: 3;
7
+ /** The local Tenant the link names (`~/.nylorun/tenants/<tenant>/`). */
8
+ tenant?: string;
9
9
  hostUrl: string;
10
10
  hostId: string;
11
11
  tenantId?: string;
@@ -29,19 +29,22 @@ export async function readLink(projectRoot) {
29
29
  catch {
30
30
  throw new CliError(`Invalid Project link at ${path}. Remove .nylorun/link.json and run "npx nylorun start".`, 1);
31
31
  }
32
- // Formats 0 and 1 named a Tenant on a multi-Tenant Host of an older Runtime.
33
- if (value?.format === undefined || value.format === 0 || value.format === 1)
34
- throw new CliError(`The Project link at ${path} is for a stack of an older Runtime, before one Tenant per installation. Run "npx nylorun start" in this project to start its own stack and link it again.`, 1);
35
- if (value.format !== 2)
32
+ // Formats 0 to 2 are from older releases.
33
+ if (value?.format === undefined ||
34
+ value.format === 0 ||
35
+ value.format === 1 ||
36
+ value.format === 2)
37
+ throw new CliError(`The Project link at ${path} is from an older nylorun. Run "npx nylorun start" in this project to link it again.`, 1);
38
+ if (value.format !== 3)
36
39
  throw new CliError(`Project link at ${path} has an unsupported format. Upgrade the CLI.`, 1);
37
40
  if (typeof value.hostUrl !== "string" ||
38
41
  typeof value.hostId !== "string" ||
39
- (value.stack !== undefined && typeof value.stack !== "string") ||
42
+ (value.tenant !== undefined && typeof value.tenant !== "string") ||
40
43
  (value.tenantId !== undefined && typeof value.tenantId !== "string"))
41
44
  throw new CliError(`Invalid Project link at ${path}. Remove .nylorun/link.json and run "npx nylorun start".`, 1);
42
45
  return {
43
- format: 2,
44
- ...(value.stack ? { stack: value.stack } : {}),
46
+ format: 3,
47
+ ...(value.tenant ? { tenant: value.tenant } : {}),
45
48
  hostUrl: value.hostUrl.replace(/\/$/, ""),
46
49
  hostId: value.hostId,
47
50
  ...(value.tenantId ? { tenantId: value.tenantId } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/cli",
3
- "version": "0.7.0-beta",
3
+ "version": "0.8.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Nylorun Runtime client: the linked installation's Tenant, its access and its model provider",
@@ -30,8 +30,8 @@
30
30
  "prepack": "npm run build"
31
31
  },
32
32
  "dependencies": {
33
- "@nylorun/agents": "0.11.0-beta",
34
- "@nylorun/admin": "0.7.0-beta",
33
+ "@nylorun/agents": "0.12.0-beta",
34
+ "@nylorun/admin": "0.8.0-beta",
35
35
  "@earendil-works/pi-ai": "0.99.1"
36
36
  },
37
37
  "devDependencies": {