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.
- package/CHANGELOG.md +105 -0
- package/README.md +226 -144
- package/dist/cli.js +141 -47
- package/dist/client/agents.d.ts +6 -0
- package/dist/client/agents.js +148 -0
- package/dist/client/artifacts.d.ts +4 -0
- package/dist/client/artifacts.js +210 -0
- package/dist/client/doctor.d.ts +7 -2
- package/dist/client/doctor.js +14 -13
- package/dist/client/environment-manifests.d.ts +10 -0
- package/dist/client/environment-manifests.js +173 -0
- package/dist/client/environments.d.ts +4 -0
- package/dist/client/environments.js +295 -0
- package/dist/client/io.d.ts +31 -0
- package/dist/client/io.js +72 -0
- package/dist/{stack → client}/mcp.d.ts +2 -2
- package/dist/{stack → client}/mcp.js +14 -12
- package/dist/client/model/pi-ai.d.ts +3 -3
- package/dist/client/model/pi-ai.js +4 -4
- package/dist/client/models.d.ts +13 -0
- package/dist/client/models.js +203 -0
- package/dist/client/runtime.d.ts +40 -0
- package/dist/client/runtime.js +134 -0
- package/dist/client/sessions.d.ts +4 -0
- package/dist/client/sessions.js +295 -0
- package/dist/client/settings.d.ts +12 -0
- package/dist/client/settings.js +103 -0
- package/dist/client/signing-keys.d.ts +3 -0
- package/dist/client/signing-keys.js +32 -0
- package/dist/client/target.d.ts +33 -0
- package/dist/client/target.js +65 -0
- package/dist/client/tenant.d.ts +22 -0
- package/dist/client/tenant.js +176 -0
- package/dist/doctor.js +3 -3
- package/dist/nylo.js +20 -4
- package/dist/sandbox/cluster-file.d.ts +1 -1
- package/dist/sandbox/commands.d.ts +1 -1
- package/dist/sandbox/commands.js +7 -7
- package/dist/sandbox/manifests.d.ts +1 -1
- package/dist/sandbox/manifests.js +1 -1
- package/dist/sandbox/probe.d.ts +1 -1
- package/dist/stack/commands.d.ts +9 -4
- package/dist/stack/commands.js +22 -26
- package/dist/stack/compose-file.d.ts +1 -1
- package/dist/stack/compose-file.js +12 -12
- package/dist/stack/env-file.d.ts +2 -2
- package/dist/stack/env-file.js +2 -2
- package/dist/stack/images.d.ts +1 -1
- package/dist/stack/images.js +1 -1
- package/dist/stack/index.d.ts +1 -10
- package/dist/stack/index.js +3 -19
- package/dist/stack/keys.d.ts +2 -2
- package/dist/stack/keys.js +14 -11
- package/dist/stack/paths.d.ts +1 -1
- package/dist/stack/prepare.d.ts +1 -1
- package/dist/stack/stacks.js +1 -1
- package/dist/telemetry.d.ts +2 -2
- package/dist/telemetry.js +4 -4
- package/package.json +6 -5
- package/dist/client/access/commands.d.ts +0 -8
- package/dist/client/access/commands.js +0 -33
- package/dist/client/cli.d.ts +0 -2
- package/dist/client/cli.js +0 -106
- package/dist/client/installation/commands.d.ts +0 -7
- package/dist/client/installation/commands.js +0 -82
- package/dist/client/project/connection.d.ts +0 -36
- package/dist/client/project/connection.js +0 -80
- package/dist/client/project/env.d.ts +0 -3
- package/dist/client/project/env.js +0 -19
- package/dist/stack/sandbox.d.ts +0 -4
- package/dist/stack/sandbox.js +0 -107
|
@@ -42,7 +42,7 @@ import { PINNED_IMAGES } from "./images.js";
|
|
|
42
42
|
* gateway receive it (NYLORUN_OBJECT_STORE_*). The runtime creates the bucket at boot and
|
|
43
43
|
* reaches the store through its `s3` BlobStore.
|
|
44
44
|
*
|
|
45
|
-
* With `sandboxes` (after `nylorun sandbox enable`, F7.2) the `sandboxes` service runs the
|
|
45
|
+
* With `sandboxes` (after `nylorun local sandbox enable`, F7.2) the `sandboxes` service runs the
|
|
46
46
|
* agent-sandbox driver: the only container holding the cluster credentials
|
|
47
47
|
* (`<Host root>/sandboxes`, read-only), not published, reached by the runtime alone with
|
|
48
48
|
* NYLORUN_SANDBOXES_TOKEN. The runtime gets an empty read-only mount over that directory.
|
|
@@ -143,7 +143,7 @@ ${restateUi ? RESTATE_UI : RESTATE_CLOSED} healthcheck:
|
|
|
143
143
|
RUSTFS_ACCESS_KEY: nylorun
|
|
144
144
|
RUSTFS_SECRET_KEY: \${NYLORUN_OBJECT_STORE_SECRET_KEY:?run nylorun start}
|
|
145
145
|
RUSTFS_CONSOLE_ENABLE: "false" # no web console: clients go through the Runtime
|
|
146
|
-
RUSTFS_OBS_LOG_DIRECTORY: "" # log to stdout (nylorun logs rustfs)
|
|
146
|
+
RUSTFS_OBS_LOG_DIRECTORY: "" # log to stdout (nylorun local logs rustfs)
|
|
147
147
|
# The image runs as uid 10001 and owns /data, which Docker copies into the new volume.
|
|
148
148
|
volumes:
|
|
149
149
|
- rustfs:/data
|
|
@@ -378,21 +378,21 @@ const IDENTITY_RUNTIME_ENV = `
|
|
|
378
378
|
# Trusted issuers (<Host root>/identity.yaml): JWTs from the operator's identity provider.
|
|
379
379
|
NYLORUN_IDENTITY_FILE: /nylorun/identity.yaml`;
|
|
380
380
|
const SANDBOXES_RUNTIME_ENV = `
|
|
381
|
-
# The sandboxes service (nylorun sandbox enable): pods on the Tenant's cluster.
|
|
381
|
+
# The sandboxes service (nylorun local sandbox enable): pods on the Tenant's cluster.
|
|
382
382
|
NYLORUN_SANDBOXES_URL: http://sandboxes:4300
|
|
383
|
-
NYLORUN_SANDBOXES_TOKEN: \${NYLORUN_SANDBOXES_TOKEN:?run nylorun sandbox enable}
|
|
383
|
+
NYLORUN_SANDBOXES_TOKEN: \${NYLORUN_SANDBOXES_TOKEN:?run nylorun local sandbox enable}
|
|
384
384
|
NYLORUN_SANDBOX_HARNESS_IMAGE: \${NYLORUN_RUNTIME_IMAGE:?run nylorun start} # pods copy the engine from it`;
|
|
385
385
|
/** Pods join and connect to the Harness API at the Docker host's address. */
|
|
386
|
-
const SANDBOXES_HARNESS_HOST = ",\${NYLORUN_SANDBOX_HOST_ADDRESS:?run nylorun sandbox enable}:\${NYLORUN_SANDBOX_HARNESS_PORT:?run nylorun sandbox enable}";
|
|
386
|
+
const SANDBOXES_HARNESS_HOST = ",\${NYLORUN_SANDBOX_HOST_ADDRESS:?run nylorun local sandbox enable}:\${NYLORUN_SANDBOX_HARNESS_PORT:?run nylorun local sandbox enable}";
|
|
387
387
|
/** The Harness API, published for sandbox pods. */
|
|
388
388
|
const SANDBOXES_RUNTIME_PORT = `
|
|
389
|
-
- "\${NYLORUN_SANDBOX_BIND:?run nylorun sandbox enable}:\${NYLORUN_SANDBOX_HARNESS_PORT:?run nylorun sandbox enable}:4200" # Harness API, for sandbox pods`;
|
|
389
|
+
- "\${NYLORUN_SANDBOX_BIND:?run nylorun local sandbox enable}:\${NYLORUN_SANDBOX_HARNESS_PORT:?run nylorun local sandbox enable}:4200" # Harness API, for sandbox pods`;
|
|
390
390
|
/** The gates accept the pods' Host; their calls carry run tokens. */
|
|
391
|
-
const SANDBOXES_GATES_HOST = ",\${NYLORUN_SANDBOX_HOST_ADDRESS:?run nylorun sandbox enable}:\${NYLORUN_SANDBOX_GATES_PORT:?run nylorun sandbox enable}";
|
|
391
|
+
const SANDBOXES_GATES_HOST = ",\${NYLORUN_SANDBOX_HOST_ADDRESS:?run nylorun local sandbox enable}:\${NYLORUN_SANDBOX_GATES_PORT:?run nylorun local sandbox enable}";
|
|
392
392
|
/** The gates and egress-gate, published for sandbox pods. */
|
|
393
393
|
const SANDBOXES_GATES_PORT = ` ports:
|
|
394
|
-
- "\${NYLORUN_SANDBOX_BIND:?run nylorun sandbox enable}:\${NYLORUN_SANDBOX_GATES_PORT:?run nylorun sandbox enable}:4100" # gates, for sandbox pods (run tokens)
|
|
395
|
-
- "\${NYLORUN_SANDBOX_BIND:?run nylorun sandbox enable}:\${NYLORUN_SANDBOX_EGRESS_PORT:?run nylorun sandbox enable}:4200" # egress-gate, for sandbox pods (egress tokens)
|
|
394
|
+
- "\${NYLORUN_SANDBOX_BIND:?run nylorun local sandbox enable}:\${NYLORUN_SANDBOX_GATES_PORT:?run nylorun local sandbox enable}:4100" # gates, for sandbox pods (run tokens)
|
|
395
|
+
- "\${NYLORUN_SANDBOX_BIND:?run nylorun local sandbox enable}:\${NYLORUN_SANDBOX_EGRESS_PORT:?run nylorun local sandbox enable}:4200" # egress-gate, for sandbox pods (egress tokens)
|
|
396
396
|
`;
|
|
397
397
|
/** egress-gate (F7.2): pods' CONNECT proxy in the gateway. */
|
|
398
398
|
const SANDBOXES_GATEWAY_ENV = `
|
|
@@ -405,19 +405,19 @@ const SANDBOXES_RUNTIME_MOUNT = `
|
|
|
405
405
|
read_only: true
|
|
406
406
|
tmpfs: { size: 4096, mode: 0755 } # empty, and listable by the runtime user`;
|
|
407
407
|
/**
|
|
408
|
-
* The sandboxes service. The pod-facing ports `nylorun sandbox enable` records
|
|
408
|
+
* The sandboxes service. The pod-facing ports `nylorun local sandbox enable` records
|
|
409
409
|
* (NYLORUN_SANDBOX_*_PORT in .env), the Harness API's, the gates' and egress-gate's, are
|
|
410
410
|
* published by the runtime and the gateway (above).
|
|
411
411
|
*/
|
|
412
412
|
function sandboxesService(project) {
|
|
413
413
|
return `
|
|
414
414
|
sandboxes: # agent-sandbox driver; the only holder of the cluster credentials; not published
|
|
415
|
-
image: \${NYLORUN_SANDBOXES_IMAGE:?run nylorun sandbox enable}
|
|
415
|
+
image: \${NYLORUN_SANDBOXES_IMAGE:?run nylorun local sandbox enable}
|
|
416
416
|
container_name: ${project}-sandboxes
|
|
417
417
|
labels: *tenant
|
|
418
418
|
user: "\${NYLORUN_UID:?run nylorun start}:\${NYLORUN_GID:?run nylorun start}" # reads the 0600 token
|
|
419
419
|
environment:
|
|
420
|
-
NYLORUN_SANDBOXES_TOKEN: \${NYLORUN_SANDBOXES_TOKEN:?run nylorun sandbox enable}
|
|
420
|
+
NYLORUN_SANDBOXES_TOKEN: \${NYLORUN_SANDBOXES_TOKEN:?run nylorun local sandbox enable}
|
|
421
421
|
NYLORUN_SANDBOXES_DIR: /run/nylorun/sandboxes
|
|
422
422
|
NYLORUN_SANDBOXES_LISTEN: ":4300"
|
|
423
423
|
extra_hosts:
|
package/dist/stack/env-file.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ export interface StackEnv {
|
|
|
55
55
|
studioAnalyticsId: string;
|
|
56
56
|
/** The Tenant's name, which the Runtime gives the Tenant it creates. */
|
|
57
57
|
tenantName: string;
|
|
58
|
-
/** Present once `nylorun sandbox enable` ran for the Tenant (F7.2). */
|
|
58
|
+
/** Present once `nylorun local sandbox enable` ran for the Tenant (F7.2). */
|
|
59
59
|
sandboxes?: SandboxStackEnv;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* The sandboxes service's settings (`nylorun sandbox enable`): its bearer token (only the
|
|
62
|
+
* The sandboxes service's settings (`nylorun local sandbox enable`): its bearer token (only the
|
|
63
63
|
* runtime presents it), its image, and the host ports pods reach (Harness API, gates,
|
|
64
64
|
* egress) on the host address, published on the bind address. The ports persist.
|
|
65
65
|
*/
|
package/dist/stack/env-file.js
CHANGED
|
@@ -102,7 +102,7 @@ export function renderEnvFile(env) {
|
|
|
102
102
|
line("studioFrameAncestors"),
|
|
103
103
|
"",
|
|
104
104
|
"# Studio's anonymous usage analytics; empty when off. Set on every start: turn",
|
|
105
|
-
"# it off with nylorun telemetry disable or NYLORUN_TELEMETRY_DISABLED=1.",
|
|
105
|
+
"# it off with nylorun local telemetry disable or NYLORUN_TELEMETRY_DISABLED=1.",
|
|
106
106
|
line("studioAnalyticsId"),
|
|
107
107
|
"",
|
|
108
108
|
"# The Tenant's name, which the Runtime gives the Tenant it creates on the first",
|
|
@@ -111,7 +111,7 @@ export function renderEnvFile(env) {
|
|
|
111
111
|
"",
|
|
112
112
|
...(sandboxes
|
|
113
113
|
? [
|
|
114
|
-
"# Sandboxes (nylorun sandbox enable): the runtime's token for the sandboxes",
|
|
114
|
+
"# Sandboxes (nylorun local sandbox enable): the runtime's token for the sandboxes",
|
|
115
115
|
"# service, its image, and the host ports pods reach on the host address.",
|
|
116
116
|
sandboxLine("token"),
|
|
117
117
|
sandboxLine("image"),
|
package/dist/stack/images.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Images a local Tenant runs. The Runtime and Studio tags are pinned by this
|
|
3
3
|
* CLI release; `NYLORUN_RUNTIME_IMAGE` and `NYLORUN_STUDIO_IMAGE` override them
|
|
4
|
-
* (local builds, CI images). The sandboxes service (`nylorun sandbox enable`) is
|
|
4
|
+
* (local builds, CI images). The sandboxes service (`nylorun local sandbox enable`) is
|
|
5
5
|
* versioned with the Runtime: `ghcr.io/nylorun/sandboxes:<runtime pin>`, or
|
|
6
6
|
* `NYLORUN_SANDBOXES_IMAGE`. Postgres, Restate, s2-lite and RustFS are the
|
|
7
7
|
* official images, pinned here; RustFS (the Object store, D35) by digest as well, so
|
package/dist/stack/images.js
CHANGED
|
@@ -2,7 +2,7 @@ import { pinnedVersion } from "./versions.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Images a local Tenant runs. The Runtime and Studio tags are pinned by this
|
|
4
4
|
* CLI release; `NYLORUN_RUNTIME_IMAGE` and `NYLORUN_STUDIO_IMAGE` override them
|
|
5
|
-
* (local builds, CI images). The sandboxes service (`nylorun sandbox enable`) is
|
|
5
|
+
* (local builds, CI images). The sandboxes service (`nylorun local sandbox enable`) is
|
|
6
6
|
* versioned with the Runtime: `ghcr.io/nylorun/sandboxes:<runtime pin>`, or
|
|
7
7
|
* `NYLORUN_SANDBOXES_IMAGE`. Postgres, Restate, s2-lite and RustFS are the
|
|
8
8
|
* official images, pinned here; RustFS (the Object store, D35) by digest as well, so
|
package/dist/stack/index.d.ts
CHANGED
|
@@ -5,17 +5,8 @@ export { checkDocker } from "./docker.js";
|
|
|
5
5
|
export type { Check, DockerChecks } from "./docker.js";
|
|
6
6
|
/** Real dependencies: docker on PATH, global fetch, the terminal. */
|
|
7
7
|
export declare function defaultStackDeps(env: Readonly<Record<string, string | undefined>>): StackDeps;
|
|
8
|
-
/** Entry for `nylorun start|stop|status|logs|reset|
|
|
8
|
+
/** Entry for `nylorun start|stop|status|studio` and `nylorun local logs|reset|ls|delete`. */
|
|
9
9
|
export declare function stackCommand(name: string, args: readonly string[], env: Readonly<Record<string, string | undefined>>): Promise<number>;
|
|
10
|
-
/** Entry for `nylorun sandbox ls|rm`. */
|
|
11
|
-
export declare function sandboxCommand(args: readonly string[], env: Readonly<Record<string, string | undefined>>): Promise<number>;
|
|
12
|
-
export { sandboxUsage } from "./sandbox.js";
|
|
13
|
-
/** Entry for `nylorun key put|list|rm`. */
|
|
14
|
-
export declare function keyCommand(args: readonly string[], env: Readonly<Record<string, string | undefined>>): Promise<number>;
|
|
15
|
-
export { keyUsage } from "./keys.js";
|
|
16
|
-
/** Entry for `nylorun mcp inspect`. */
|
|
17
|
-
export declare function mcpCommand(args: readonly string[], env: Readonly<Record<string, string | undefined>>): Promise<number>;
|
|
18
|
-
export { mcpUsage } from "./mcp.js";
|
|
19
10
|
/** `nylorun studio`, landing on `next` when given, else on the Tenant's page. */
|
|
20
11
|
export declare function studioCommand(args: readonly string[], env: Readonly<Record<string, string | undefined>>, options?: {
|
|
21
12
|
next?: string;
|
package/dist/stack/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { createInterface } from "node:readline/promises";
|
|
3
|
+
import { text } from "node:stream/consumers";
|
|
3
4
|
import { runStackCommand, runStudioCommand } from "./commands.js";
|
|
4
5
|
import { spawnDocker } from "./docker.js";
|
|
5
|
-
import { keyCommand as runKeyCommand } from "./keys.js";
|
|
6
|
-
import { mcpCommand as runMcpCommand } from "./mcp.js";
|
|
7
|
-
import { sandboxCommand as runSandboxCommand } from "./sandbox.js";
|
|
8
6
|
import { pinnedVersion } from "./versions.js";
|
|
9
7
|
import { loopbackPorts } from "./ports.js";
|
|
10
8
|
export { ensureStack, isStackCommand, readStackStatus, stackUsage, studioLoginUrl, tenantStudioPath, STACK_SERVICES, } from "./commands.js";
|
|
@@ -52,6 +50,7 @@ export function defaultStackDeps(env) {
|
|
|
52
50
|
}
|
|
53
51
|
: {}),
|
|
54
52
|
interactive,
|
|
53
|
+
stdin: { isTTY: Boolean(process.stdin.isTTY), text: () => text(process.stdin) },
|
|
55
54
|
openBrowser: async (url) => {
|
|
56
55
|
const command = browserCommand(env);
|
|
57
56
|
return await new Promise((resolve) => {
|
|
@@ -77,25 +76,10 @@ export function defaultStackDeps(env) {
|
|
|
77
76
|
},
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
|
-
/** Entry for `nylorun start|stop|status|logs|reset|
|
|
79
|
+
/** Entry for `nylorun start|stop|status|studio` and `nylorun local logs|reset|ls|delete`. */
|
|
81
80
|
export async function stackCommand(name, args, env) {
|
|
82
81
|
return await runStackCommand(name, args, defaultStackDeps(env));
|
|
83
82
|
}
|
|
84
|
-
/** Entry for `nylorun sandbox ls|rm`. */
|
|
85
|
-
export async function sandboxCommand(args, env) {
|
|
86
|
-
return await runSandboxCommand(defaultStackDeps(env), args);
|
|
87
|
-
}
|
|
88
|
-
export { sandboxUsage } from "./sandbox.js";
|
|
89
|
-
/** Entry for `nylorun key put|list|rm`. */
|
|
90
|
-
export async function keyCommand(args, env) {
|
|
91
|
-
return await runKeyCommand(defaultStackDeps(env), args);
|
|
92
|
-
}
|
|
93
|
-
export { keyUsage } from "./keys.js";
|
|
94
|
-
/** Entry for `nylorun mcp inspect`. */
|
|
95
|
-
export async function mcpCommand(args, env) {
|
|
96
|
-
return await runMcpCommand(defaultStackDeps(env), args);
|
|
97
|
-
}
|
|
98
|
-
export { mcpUsage } from "./mcp.js";
|
|
99
83
|
/** `nylorun studio`, landing on `next` when given, else on the Tenant's page. */
|
|
100
84
|
export async function studioCommand(args, env, options = {}) {
|
|
101
85
|
return await runStudioCommand(args, defaultStackDeps(env), options);
|
package/dist/stack/keys.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type StackDeps } from "./commands.js";
|
|
2
|
-
export declare const keyUsage = "
|
|
3
|
-
/** `nylorun
|
|
2
|
+
export declare const keyUsage = " keys put <id> [--management] [--tenant <name>]\n create the Tenant's application key <id> (--management: a\n management key, on the Runtime's machine only), or rotate it\n (the old key stops working); prints the key once\n keys list [--tenant <name>] [--json]\n the Tenant's keys: id, role, when issued (never the keys)\n keys rm <id> [--tenant <name>] delete key <id>: it stops working at once";
|
|
3
|
+
/** `nylorun tenant keys <put|list|rm> ...` on a local Tenant. */
|
|
4
4
|
export declare function keyCommand(deps: StackDeps, args: readonly string[]): Promise<number>;
|
package/dist/stack/keys.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nylorun
|
|
3
|
-
* runtime container.
|
|
2
|
+
* `nylorun tenant keys put | list | rm` on a local Tenant: its keys, through `nylorun-operate` in
|
|
3
|
+
* its runtime container (`client/tenant.ts` takes a remote installation's application keys
|
|
4
|
+
* through the Management API). Revocable application keys by name, for app servers and other clients, and
|
|
4
5
|
* management keys (`--management`), which only this machine issues; none of these starts the
|
|
5
6
|
* Tenant.
|
|
6
7
|
*/
|
|
7
8
|
import { CliError } from "../errors.js";
|
|
8
9
|
import { parseStackFlags, runningOperate } from "./commands.js";
|
|
9
10
|
import { deleteOperatorKey, listOperatorKeys, putOperatorKey } from "./operator-keys.js";
|
|
10
|
-
export const keyUsage = `
|
|
11
|
-
create the Tenant's application key <id> (--management: a
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export const keyUsage = ` keys put <id> [--management] [--tenant <name>]
|
|
12
|
+
create the Tenant's application key <id> (--management: a
|
|
13
|
+
management key, on the Runtime's machine only), or rotate it
|
|
14
|
+
(the old key stops working); prints the key once
|
|
15
|
+
keys list [--tenant <name>] [--json]
|
|
16
|
+
the Tenant's keys: id, role, when issued (never the keys)
|
|
17
|
+
keys rm <id> [--tenant <name>] delete key <id>: it stops working at once`;
|
|
15
18
|
const usageError = (message) => new CliError(message, 2);
|
|
16
19
|
async function put(deps, args) {
|
|
17
|
-
const usage = "nylorun
|
|
20
|
+
const usage = "nylorun tenant keys put <id> [--management] [--tenant <name>]";
|
|
18
21
|
const flags = parseStackFlags(args, { booleans: ["--management"], values: ["--tenant"] }, usage);
|
|
19
22
|
if (flags.rest.length !== 1)
|
|
20
23
|
throw usageError(`Usage: ${usage}`);
|
|
@@ -28,7 +31,7 @@ async function put(deps, args) {
|
|
|
28
31
|
return 0;
|
|
29
32
|
}
|
|
30
33
|
async function list(deps, args) {
|
|
31
|
-
const usage = "nylorun
|
|
34
|
+
const usage = "nylorun tenant keys list [--tenant <name>] [--json]";
|
|
32
35
|
const flags = parseStackFlags(args, { booleans: ["--json"], values: ["--tenant"] }, usage);
|
|
33
36
|
if (flags.rest.length)
|
|
34
37
|
throw usageError(`Usage: ${usage}`);
|
|
@@ -47,7 +50,7 @@ async function list(deps, args) {
|
|
|
47
50
|
return 0;
|
|
48
51
|
}
|
|
49
52
|
async function rm(deps, args) {
|
|
50
|
-
const usage = "nylorun
|
|
53
|
+
const usage = "nylorun tenant keys rm <id> [--tenant <name>]";
|
|
51
54
|
const flags = parseStackFlags(args, { values: ["--tenant"] }, usage);
|
|
52
55
|
if (flags.rest.length !== 1)
|
|
53
56
|
throw usageError(`Usage: ${usage}`);
|
|
@@ -61,7 +64,7 @@ async function rm(deps, args) {
|
|
|
61
64
|
deps.out(`Deleted key ${id}: it no longer works.`);
|
|
62
65
|
return 0;
|
|
63
66
|
}
|
|
64
|
-
/** `nylorun
|
|
67
|
+
/** `nylorun tenant keys <put|list|rm> ...` on a local Tenant. */
|
|
65
68
|
export async function keyCommand(deps, args) {
|
|
66
69
|
const [sub, ...rest] = args;
|
|
67
70
|
if (sub === "put")
|
package/dist/stack/paths.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface StackPaths {
|
|
|
10
10
|
state: string;
|
|
11
11
|
/**
|
|
12
12
|
* cli-credentials.json: the operator key `cli` that `nylorun` commands use outside a linked
|
|
13
|
-
* project (`nylorun sandbox`), mode 0600.
|
|
13
|
+
* project (`nylorun local sandbox`), mode 0600.
|
|
14
14
|
*/
|
|
15
15
|
cliCredentials: string;
|
|
16
16
|
/**
|
package/dist/stack/prepare.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare function prepareStack(input: {
|
|
|
43
43
|
/** The measurement id Studio reports page views to; absent when telemetry is off. */
|
|
44
44
|
studioAnalyticsId?: string;
|
|
45
45
|
/**
|
|
46
|
-
* The sandboxes settings (`nylorun sandbox enable`); null removes them (`disable`).
|
|
46
|
+
* The sandboxes settings (`nylorun local sandbox enable`); null removes them (`disable`).
|
|
47
47
|
* Undefined keeps the persisted ones while `sandboxes/cluster.json` exists.
|
|
48
48
|
*/
|
|
49
49
|
sandboxes?: SandboxStackEnv | null;
|
package/dist/stack/stacks.js
CHANGED
|
@@ -25,7 +25,7 @@ export function tenantRoot(base, name) {
|
|
|
25
25
|
export function assertTenantName(name, source) {
|
|
26
26
|
// A Tenant id, such as a NYLORUN_TENANT kept from an older release.
|
|
27
27
|
if (/^tn_/i.test(name))
|
|
28
|
-
throw new CliError(`${source} must be a Tenant's name, not a Tenant id: ${name}. "nylorun ls" lists the Tenants on this machine.`, 2);
|
|
28
|
+
throw new CliError(`${source} must be a Tenant's name, not a Tenant id: ${name}. "nylorun local ls" lists the Tenants on this machine.`, 2);
|
|
29
29
|
if (!TENANT_NAME.test(name))
|
|
30
30
|
throw new CliError(`${source} must be lowercase letters, digits, "-" or "_", starting with a letter or digit: ${name}`, 2);
|
|
31
31
|
return name;
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const STUDIO_ANALYTICS_ID = "G-K6RPDFH6Q6";
|
|
|
8
8
|
/** `~/.nylorun/telemetry.json`: the developer's choice, for every Tenant on the machine. */
|
|
9
9
|
export interface TelemetryFile {
|
|
10
10
|
format: 1;
|
|
11
|
-
/** False after `nylorun telemetry disable`; absent until a choice is made. */
|
|
11
|
+
/** False after `nylorun local telemetry disable`; absent until a choice is made. */
|
|
12
12
|
enabled?: boolean;
|
|
13
13
|
/** When `nylorun start` showed the notice (ISO time); it is shown once. */
|
|
14
14
|
noticeShown?: string;
|
|
@@ -23,7 +23,7 @@ export declare function readTelemetry(nylorunRoot: string): Promise<TelemetryFil
|
|
|
23
23
|
export declare function writeTelemetry(nylorunRoot: string, file: TelemetryFile): Promise<void>;
|
|
24
24
|
/** On unless the environment or the developer's choice turns it off. */
|
|
25
25
|
export declare function telemetryDecision(env: Readonly<Record<string, string | undefined>>, file: TelemetryFile): TelemetryDecision;
|
|
26
|
-
/** `nylorun telemetry [status|enable|disable]`. */
|
|
26
|
+
/** `nylorun local telemetry [status|enable|disable]`. */
|
|
27
27
|
export declare function telemetryCommand(args: readonly string[], context: {
|
|
28
28
|
nylorunRoot: string;
|
|
29
29
|
env: Readonly<Record<string, string | undefined>>;
|
package/dist/telemetry.js
CHANGED
|
@@ -12,7 +12,7 @@ export const STUDIO_ANALYTICS_ID = "G-K6RPDFH6Q6";
|
|
|
12
12
|
export const TELEMETRY_NOTICE = [
|
|
13
13
|
"Studio collects anonymous usage data: which pages are opened, with every",
|
|
14
14
|
"Tenant, agent and session id removed. Nothing you send to agents is collected.",
|
|
15
|
-
'Turn it off with "nylorun telemetry disable" or NYLORUN_TELEMETRY_DISABLED=1.',
|
|
15
|
+
'Turn it off with "nylorun local telemetry disable" or NYLORUN_TELEMETRY_DISABLED=1.',
|
|
16
16
|
"Learn more: https://github.com/nylorun/agents/blob/main/nylorun/README.md#telemetry",
|
|
17
17
|
].join("\n");
|
|
18
18
|
export function telemetryPath(nylorunRoot) {
|
|
@@ -56,11 +56,11 @@ export function telemetryDecision(env, file) {
|
|
|
56
56
|
if (flag(env.CI))
|
|
57
57
|
return { enabled: false, reason: "CI is set" };
|
|
58
58
|
if (file.enabled === false)
|
|
59
|
-
return { enabled: false, reason: 'turned off with "nylorun telemetry disable"' };
|
|
59
|
+
return { enabled: false, reason: 'turned off with "nylorun local telemetry disable"' };
|
|
60
60
|
return { enabled: true, reason: "on by default" };
|
|
61
61
|
}
|
|
62
|
-
const USAGE = "Usage: nylorun telemetry [status|enable|disable]";
|
|
63
|
-
/** `nylorun telemetry [status|enable|disable]`. */
|
|
62
|
+
const USAGE = "Usage: nylorun local telemetry [status|enable|disable]";
|
|
63
|
+
/** `nylorun local telemetry [status|enable|disable]`. */
|
|
64
64
|
export async function telemetryCommand(args, context) {
|
|
65
65
|
const [action = "status", ...rest] = args;
|
|
66
66
|
if (rest.length || !["status", "enable", "disable"].includes(action))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nylorun",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0-beta",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Set up and run local Nylorun Tenants (Runtime and Studio) with Docker Compose (nylorun), and the Runtime client of the linked installation (nylo)",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"prepack": "npm run build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nylorun/
|
|
34
|
-
"@nylorun/
|
|
33
|
+
"@nylorun/admin": "0.17.0-beta",
|
|
34
|
+
"@nylorun/agents": "0.21.0-beta",
|
|
35
|
+
"@nylorun/core": "0.21.0-beta"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@earendil-works/pi-ai": "0.99.1",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"nylo": "dist/nylo.js"
|
|
46
47
|
},
|
|
47
48
|
"nylorun": {
|
|
48
|
-
"runtime": "0.
|
|
49
|
-
"studio": "0.
|
|
49
|
+
"runtime": "0.25.0-beta",
|
|
50
|
+
"studio": "0.25.0-beta"
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nylo access`: the linked Tenant's signing keys, which sign capability links and run tokens,
|
|
3
|
-
* through the Management API with the Project's management key. (Subject tokens, the
|
|
4
|
-
* access policy, browser keys and revocations left the Runtime in protocol 7.)
|
|
5
|
-
*/
|
|
6
|
-
import type { ManagementClient } from "@nylorun/admin";
|
|
7
|
-
export declare const accessUsage = "nylo access signing-keys <list|rotate|revoke>\n\n signing-keys list list the signing keys\n signing-keys rotate [--force] rotate; --force ends outstanding links and run tokens\n signing-keys revoke <kid> revoke a previous or standby key";
|
|
8
|
-
export declare function accessCommand(input: readonly string[], client?: () => Promise<ManagementClient>): Promise<void>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { findProjectRoot } from "@nylorun/core/project";
|
|
2
|
-
import { CliError } from "../../errors.js";
|
|
3
|
-
import { linkedConnection, managementClient } from "../project/connection.js";
|
|
4
|
-
export const accessUsage = `nylo access signing-keys <list|rotate|revoke>
|
|
5
|
-
|
|
6
|
-
signing-keys list list the signing keys
|
|
7
|
-
signing-keys rotate [--force] rotate; --force ends outstanding links and run tokens
|
|
8
|
-
signing-keys revoke <kid> revoke a previous or standby key`;
|
|
9
|
-
const usageError = (message = accessUsage) => new CliError(message, 2);
|
|
10
|
-
async function linkedClient() {
|
|
11
|
-
return managementClient(await linkedConnection(findProjectRoot() ?? process.cwd()));
|
|
12
|
-
}
|
|
13
|
-
const print = (value) => console.log(JSON.stringify(value, null, 2));
|
|
14
|
-
export async function accessCommand(input, client = linkedClient) {
|
|
15
|
-
const [topic, action, ...args] = input;
|
|
16
|
-
if (topic === "signing-keys") {
|
|
17
|
-
const keys = async () => (await client()).signingKeys;
|
|
18
|
-
if (action === "list" && args.length === 0)
|
|
19
|
-
return print(await (await keys()).list());
|
|
20
|
-
if (action === "rotate") {
|
|
21
|
-
const force = args[0] === "--force";
|
|
22
|
-
if (args.length > (force ? 1 : 0))
|
|
23
|
-
throw usageError();
|
|
24
|
-
return print(await (await keys()).rotate({ force }));
|
|
25
|
-
}
|
|
26
|
-
if (action === "revoke" && args.length === 1)
|
|
27
|
-
return print(await (await keys()).revoke(args[0]));
|
|
28
|
-
throw usageError();
|
|
29
|
-
}
|
|
30
|
-
if (topic === "policy" || topic === "keys" || topic === "revoke" || topic === "token")
|
|
31
|
-
throw usageError(`nylo access ${topic} was removed: the Runtime no longer mints subject tokens or keeps an access policy, browser keys or revocations (protocol 7). Trust your identity provider's tokens with an identity file, and give servers an application key (nylorun key put <id>).`);
|
|
32
|
-
throw usageError();
|
|
33
|
-
}
|
package/dist/client/cli.d.ts
DELETED
package/dist/client/cli.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { findProjectRoot } from "@nylorun/core/project";
|
|
2
|
-
import { CliError } from "../errors.js";
|
|
3
|
-
import { refuseNativeWindows } from "../command.js";
|
|
4
|
-
import { printLinkedEnvExports } from "./project/env.js";
|
|
5
|
-
import { linkedConnection, managementClient } from "./project/connection.js";
|
|
6
|
-
import { accessCommand } from "./access/commands.js";
|
|
7
|
-
import { resetCommand, statusCommand } from "./installation/commands.js";
|
|
8
|
-
const usage = `nylo <status|reset|access|configure|env|doctor>
|
|
9
|
-
|
|
10
|
-
Runtime client for the linked installation and its one Tenant (the Project link that
|
|
11
|
-
npx nylorun start writes, or NYLORUN_RUNTIME_URL with NYLORUN_SERVER_KEY, and
|
|
12
|
-
NYLORUN_MANAGEMENT_KEY for status, reset, access, configure and doctor):
|
|
13
|
-
status [--json] the Tenant, its checks and counts
|
|
14
|
-
reset [--sessions|--environments|--all] [--yes]
|
|
15
|
-
clear the Tenant's sessions, Environments or all its data
|
|
16
|
-
access signing-keys list|rotate|revoke the Tenant's token signing keys (nylo access --help)
|
|
17
|
-
configure set the linked Tenant's model provider
|
|
18
|
-
env print the linked Project's NYLORUN_* variables as exports
|
|
19
|
-
doctor sandbox [--json] show which sandbox backend this Tenant's Host offers
|
|
20
|
-
|
|
21
|
-
nylo status and reset go through the Management API, to a local or a remote installation.
|
|
22
|
-
Local Tenants are nylorun's, the other command of this package: npx nylorun start in a
|
|
23
|
-
project creates its Tenant and the Project link, and nylorun status and reset act on the
|
|
24
|
-
local Tenant's containers and volumes.`;
|
|
25
|
-
/** Local Tenant commands, which `nylorun` runs. */
|
|
26
|
-
const LOCAL_COMMANDS = new Set([
|
|
27
|
-
"up", "down", "start", "stop", "logs", "studio", "runtime", "restart", "run",
|
|
28
|
-
]);
|
|
29
|
-
const TENANT_REMOVED = `nylo tenant was removed: an installation serves one Tenant.
|
|
30
|
-
Run "npx nylorun start" in your project to create its Tenant and the Project link.
|
|
31
|
-
Then use nylo status and nylo reset on the linked installation.`;
|
|
32
|
-
const ENDPOINTS_REMOVED = `nylo endpoints was removed: the Runtime runs agents from their manifests alone,
|
|
33
|
-
so there are no Action endpoints. An agent's tools are http() tools and remote MCP servers
|
|
34
|
-
(see MIGRATION.md).`;
|
|
35
|
-
const usageError = (message) => new CliError(message, 2);
|
|
36
|
-
/** `nylo <command> [...args]`. */
|
|
37
|
-
export async function main(argv) {
|
|
38
|
-
const [command, ...args] = argv;
|
|
39
|
-
if (!command || command === "--help" || command === "-h")
|
|
40
|
-
return void console.log(usage);
|
|
41
|
-
refuseNativeWindows();
|
|
42
|
-
if (command === "tenant")
|
|
43
|
-
throw usageError(TENANT_REMOVED);
|
|
44
|
-
if (command === "status")
|
|
45
|
-
return await statusCommand(args);
|
|
46
|
-
if (command === "reset")
|
|
47
|
-
return await resetCommand(args);
|
|
48
|
-
if (command === "endpoints")
|
|
49
|
-
throw usageError(ENDPOINTS_REMOVED);
|
|
50
|
-
if (command === "access") {
|
|
51
|
-
if (args[0] === "--help" || args[0] === "-h" || args.length === 0) {
|
|
52
|
-
const { accessUsage } = await import("./access/commands.js");
|
|
53
|
-
return void console.log(accessUsage);
|
|
54
|
-
}
|
|
55
|
-
return await accessCommand(args);
|
|
56
|
-
}
|
|
57
|
-
if (command === "env") {
|
|
58
|
-
if (args.length)
|
|
59
|
-
throw usageError("Usage: nylo env");
|
|
60
|
-
await printLinkedEnvExports(findProjectRoot() ?? process.cwd());
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (command === "doctor") {
|
|
64
|
-
const [topic, ...options] = args;
|
|
65
|
-
if (topic !== "sandbox" || options.some((option) => option !== "--json"))
|
|
66
|
-
throw usageError("Usage: nylo doctor sandbox [--json]. Check the local Tenant with npx nylorun doctor.");
|
|
67
|
-
const { doctorSandbox } = await import("./doctor.js");
|
|
68
|
-
await doctorSandbox({ json: options.includes("--json") });
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (command === "dev")
|
|
72
|
-
throw usageError('nylorun dev was removed: run "npx nylorun start" once in your project, then your project\'s npm run dev.');
|
|
73
|
-
if (LOCAL_COMMANDS.has(command))
|
|
74
|
-
throw usageError(`Local Tenants are nylorun's: npx nylorun ${command}`);
|
|
75
|
-
if (command === "configure") {
|
|
76
|
-
for (const arg of args) {
|
|
77
|
-
if (arg === "--global" || arg === "--db")
|
|
78
|
-
throw usageError(`${arg} was removed. Use the Runtime Host root (NYLORUN_HOME) and a Project link instead.`);
|
|
79
|
-
if (arg.startsWith("-"))
|
|
80
|
-
throw usageError(usage);
|
|
81
|
-
}
|
|
82
|
-
if (args.length)
|
|
83
|
-
throw usageError(usage);
|
|
84
|
-
const projectRoot = findProjectRoot() ?? process.cwd();
|
|
85
|
-
const auth = await linkedConnection(projectRoot);
|
|
86
|
-
const admin = managementClient(auth);
|
|
87
|
-
// The provider login flows (pi-ai) load only here.
|
|
88
|
-
const { ConfigurationCancelled, configureProvider, fetchModelCatalog } = await import("./model/configure.js");
|
|
89
|
-
const { putHostModel } = await import("./model/host-model.js");
|
|
90
|
-
const controller = new AbortController();
|
|
91
|
-
const cancel = (signal) => controller.abort(new ConfigurationCancelled(signal));
|
|
92
|
-
process.once("SIGINT", () => cancel("SIGINT"));
|
|
93
|
-
process.once("SIGTERM", () => cancel("SIGTERM"));
|
|
94
|
-
const health = await fetch(`${auth.url}/health`).catch(() => undefined);
|
|
95
|
-
if (!health?.ok)
|
|
96
|
-
throw new CliError(`No Runtime is listening at ${auth.url}. Start the local Tenant with "npx nylorun start".`, 6);
|
|
97
|
-
const catalog = await fetchModelCatalog(admin);
|
|
98
|
-
const prompted = await configureProvider({
|
|
99
|
-
signal: controller.signal,
|
|
100
|
-
catalog,
|
|
101
|
-
});
|
|
102
|
-
await putHostModel(admin, prompted);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
throw usageError(usage);
|
|
106
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nylo status [--json]`: the Tenant, its checks and counts. A Tenant that is not open does not
|
|
3
|
-
* answer: `npx nylorun status` reports why.
|
|
4
|
-
*/
|
|
5
|
-
export declare function statusCommand(args: readonly string[]): Promise<void>;
|
|
6
|
-
/** `nylo reset [--sessions|--environments|--all] [--yes]`; `--all` asks first. */
|
|
7
|
-
export declare function resetCommand(args: readonly string[]): Promise<void>;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nylo status` and `nylo reset`: the linked installation's one Tenant, through the Management
|
|
3
|
-
* API (the Project's management key).
|
|
4
|
-
*/
|
|
5
|
-
import { createInterface } from "node:readline/promises";
|
|
6
|
-
import { findProjectRoot } from "@nylorun/core/project";
|
|
7
|
-
import { CliError } from "../../errors.js";
|
|
8
|
-
import { linkedConnection, managementClient } from "../project/connection.js";
|
|
9
|
-
const projectRoot = () => findProjectRoot() ?? process.cwd();
|
|
10
|
-
/**
|
|
11
|
-
* `nylo status [--json]`: the Tenant, its checks and counts. A Tenant that is not open does not
|
|
12
|
-
* answer: `npx nylorun status` reports why.
|
|
13
|
-
*/
|
|
14
|
-
export async function statusCommand(args) {
|
|
15
|
-
const json = args.includes("--json");
|
|
16
|
-
if (args.some((a) => a !== "--json"))
|
|
17
|
-
throw new CliError("Usage: nylo status [--json]", 2);
|
|
18
|
-
const root = projectRoot();
|
|
19
|
-
const connection = await linkedConnection(root);
|
|
20
|
-
const admin = managementClient(connection);
|
|
21
|
-
let body;
|
|
22
|
-
try {
|
|
23
|
-
body = await admin.tenant.status();
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new CliError(`${(error instanceof Error ? error.message : `The Tenant at ${connection.url} is not reachable`).replace(/\.?$/, ".")} Run "npx nylorun status" to see the Tenant's state and why it is not open.`, 1);
|
|
27
|
-
}
|
|
28
|
-
if (json) {
|
|
29
|
-
console.log(JSON.stringify(body, null, 2));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
console.log(`${body.tenant.name} ${body.tenant.id}`);
|
|
33
|
-
console.log(`runtime ${connection.url}`);
|
|
34
|
-
console.log(`path ${body.path}`);
|
|
35
|
-
console.log(`checks ${Object.entries(body.checks)
|
|
36
|
-
.map(([k, v]) => `${k}=${v ? "ok" : "fail"}`)
|
|
37
|
-
.join(" ")}`);
|
|
38
|
-
console.log(`counts sessions=${body.counts.sessions} running=${body.counts.runningSessions} uncertain=${body.counts.uncertainEffects}`);
|
|
39
|
-
console.log(`sandbox ${body.sandbox.backend ?? "none"}`);
|
|
40
|
-
}
|
|
41
|
-
const RESET_USAGE = "Usage: nylo reset [--sessions|--environments|--all] [--yes]";
|
|
42
|
-
const SCOPES = { "--sessions": "sessions", "--environments": "environments", "--all": "all" };
|
|
43
|
-
/** `nylo reset [--sessions|--environments|--all] [--yes]`; `--all` asks first. */
|
|
44
|
-
export async function resetCommand(args) {
|
|
45
|
-
const yes = args.includes("--yes");
|
|
46
|
-
const flags = args.filter((a) => a !== "--yes");
|
|
47
|
-
if (flags.includes("--sandboxes"))
|
|
48
|
-
throw new CliError("--sandboxes is now --environments (protocol 11): nylo reset --environments deletes the Tenant's Environments, their vaults and files.", 2);
|
|
49
|
-
if (flags.some((f) => !(f in SCOPES)) || args.filter((a) => a === "--yes").length > 1)
|
|
50
|
-
throw new CliError(RESET_USAGE, 2);
|
|
51
|
-
if (flags.length > 1)
|
|
52
|
-
throw new CliError("Pass only one of --sessions, --environments, --all.", 2);
|
|
53
|
-
const scope = flags.length ? SCOPES[flags[0]] : "sessions";
|
|
54
|
-
const connection = await linkedConnection(projectRoot());
|
|
55
|
-
const tenant = connection.link?.tenant;
|
|
56
|
-
const target = tenant ? `Tenant ${tenant} (${connection.url})` : `the Tenant on ${connection.url}`;
|
|
57
|
-
const admin = managementClient(connection);
|
|
58
|
-
if (scope === "all" && !yes)
|
|
59
|
-
await confirmOrThrow(`Reset ALL data of ${target}? The Project link and credentials are kept. [y/N] `);
|
|
60
|
-
try {
|
|
61
|
-
await admin.tenant.reset({ scope, activeWork: "drain" });
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
throw new CliError(error instanceof Error ? error.message : `Tenant reset failed: ${String(error)}`, 1);
|
|
65
|
-
}
|
|
66
|
-
console.log(`Reset ${target} (${scope}).`);
|
|
67
|
-
}
|
|
68
|
-
async function confirmOrThrow(prompt) {
|
|
69
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
70
|
-
throw new CliError("Confirmation required; pass --yes for non-interactive use.", 2);
|
|
71
|
-
}
|
|
72
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
73
|
-
try {
|
|
74
|
-
const answer = (await rl.question(prompt)).trim().toLowerCase();
|
|
75
|
-
if (answer !== "y" && answer !== "yes") {
|
|
76
|
-
throw new CliError("Cancelled.", 1);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
finally {
|
|
80
|
-
rl.close();
|
|
81
|
-
}
|
|
82
|
-
}
|