@nylorun/cli 0.10.0-beta → 0.12.1-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 +79 -0
- package/README.md +22 -13
- package/dist/access/commands.d.ts +6 -6
- package/dist/access/commands.js +6 -17
- package/dist/cli.js +13 -9
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +7 -6
- package/dist/installation/commands.d.ts +4 -17
- package/dist/installation/commands.js +21 -82
- package/dist/model/configure.d.ts +3 -6
- package/dist/model/configure.js +3 -16
- package/dist/model/host-model.d.ts +3 -17
- package/dist/model/host-model.js +10 -23
- package/dist/project/connection.d.ts +11 -4
- package/dist/project/connection.js +27 -7
- package/dist/project/credentials.d.ts +5 -2
- package/dist/project/credentials.js +5 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# @nylorun/cli
|
|
2
2
|
|
|
3
|
+
## 0.12.1-beta
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cb29dea: **READMEs for manifest-only agents.** Documentation only; no code changes.
|
|
8
|
+
|
|
9
|
+
- `@nylorun/agents`: the Flow agents example opens the PR with an `http()` tool stage instead of a code tool, and shows how to keep a person's approval: a flow stage cannot take `approval` yet (`flow.approval-unsupported`), so the HTTP tool goes to an agent stage with `approval: "always"`. Requests set `Nylorun-Protocol` 8. The subagents section says `ctx.state`, `ctx.agent` and `ctx.ask`/`ctx.approve` apply only to `tool({ run })` in the local engine.
|
|
10
|
+
- `@nylorun/cli`: no longer says `nylo endpoints` uses the Runtime API or replaces `nylo tenant endpoints`; it was removed with Action endpoints and exits 2.
|
|
11
|
+
|
|
12
|
+
- Pin agents to the tested release.
|
|
13
|
+
- Updated dependencies [cb29dea]
|
|
14
|
+
- @nylorun/agents@0.16.1-beta
|
|
15
|
+
|
|
16
|
+
## 0.12.0-beta
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- c135267: **Action endpoints are removed (manifest-only agents, M6).** The Runtime runs no code of yours during a session: an agent's tools are HTTP tools, remote MCP servers, agents used as tools and the Runtime's built-ins. Protocol stays 8; the `action-endpoints` feature is gone, so a client that requires it is refused. See MIGRATION.md, "Action endpoints are removed".
|
|
21
|
+
|
|
22
|
+
- **Breaking (`@nylorun/core`):** the `Action`, endpoint (`PutEndpointsRequest`, `Endpoint`, `EndpointHealth`, …) and delivery schemas, `SIGNATURE_HEADER`, `OUTCOME_HEADER`, `DELIVERY_TOKEN_TYPE` and the `action.*` events (`action.pending`, `.delivered`, `.delivery_failed`, `.completed`, `.uncertain`) are removed, and `ToolDefinition.background` with them. `ActionOutcome` is renamed `EffectOutcome`. Tenant status loses `checks.endpoints`, `agents[].registered` and `agents[].endpoint`, and `counts.pendingActions`; the session view loses `actions`. A `turn.paused` interaction carries the tool call's `callId`. New `codeToolsOf` and `codeToolRefusal` name a definition's tools that would run your code. The Harness API is v2 (`HARNESS_API_VERSION = 2`): `TurnStart.options.holdMs` and `effect.resolved` are removed.
|
|
23
|
+
- **Breaking (`@nylorun/harness`):** held runs are gone: `createHarness` loses `holdMs`, and `apiHost` its `hold` option.
|
|
24
|
+
- **Breaking (`@nylorun/agents`):** `createActionHandler`, `executeAction`, `createActionSandbox`, `definitionDeclaresSandbox`, `isActionSandboxTool` and the `Action`, `ActionOutcome`, `ActionHandler`, `ActionHandlerOptions`, `RegisterOptions`, `ExecuteActionOptions` and `ExecutableDefinition` types are removed. `saveAgent` refuses a code tool (`tool({ run })`) or a flow tool stage before sending; its `implementationVersion` is optional (`NYLORUN_IMPLEMENTATION_VERSION`, else `dev`).
|
|
25
|
+
- **Breaking (`@nylorun/runtime`):** `/v1/endpoints` and `/v1/actions/*` answer `404`; delivery tokens, the deliverer, background tools, held runs (`TenantConfig.actionHoldMs`), `DurableExecution.deliver`, the Restate `NylorunAction` object, the `action_result` wake and the gates service's `/nylorun/v1/deliveries` are removed, and a migration drops the `actions` and `endpoints` tables. `PUT /v1/agents/:id` refuses a definition with a code tool or a flow tool stage (`400`); a tool the Runtime cannot run fails with `tool.unavailable`. The fixture model answers in text when the agent offers no `lookup_order` tool.
|
|
26
|
+
- **Breaking (`@nylorun/cli`):** `nylo endpoints` is removed (a usage error that says why); `nylo status` shows uncertain effects instead of pending Actions.
|
|
27
|
+
- **Breaking (`@nylorun/create-agent`):** the starter saves its agent with `saveAgent` and runs no server: no Action endpoint, `PORT` or `NYLORUN_ACTIONS_URL`. Its assistant has no tools, with a commented `http()` tool to start from.
|
|
28
|
+
- `nylorun`: the local stack's comments speak of MCP servers and HTTP tools on this machine, not Action endpoints.
|
|
29
|
+
- `@nylorun/studio`: the `action.*` event views and delivery status are removed; the chat shows `tool.completed`, and the Agent Manifest tab lists tools without a target as code tools.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Pin agents to the tested release.
|
|
34
|
+
- Pin admin to the tested release.
|
|
35
|
+
- Updated dependencies [4bd2a0b]
|
|
36
|
+
- Updated dependencies [a64aaca]
|
|
37
|
+
- Updated dependencies [40b7648]
|
|
38
|
+
- Updated dependencies [713e676]
|
|
39
|
+
- Updated dependencies [c135267]
|
|
40
|
+
- Updated dependencies [d36f0d9]
|
|
41
|
+
- Updated dependencies [107b07d]
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- @nylorun/agents@0.16.0-beta
|
|
45
|
+
- @nylorun/admin@0.11.1-beta
|
|
46
|
+
|
|
47
|
+
## 0.11.0-beta
|
|
48
|
+
|
|
49
|
+
### Minor Changes
|
|
50
|
+
|
|
51
|
+
- 3b3bdc6: **The clients use management keys (Runtime and Management APIs, step A3).** The protocol stays at 7; every client keeps working against a protocol 7 Runtime's routes.
|
|
52
|
+
|
|
53
|
+
- `nylorun`: `nylorun start` keeps an application key (`project`) and a management key (`project-management`) for a Project, in `<Host root>/project-credentials.json` and the Project's `.nylorun/credentials.json` (still format 1, with new `managementKey` and `managementPrincipalId` fields). A credentials file holding only an application key gains a management key at the next start. Commands outside a project keep `cli` and `cli-management`. Keys are issued through `nylorun-operate` in the runtime container instead of the Admin API, and `nylorun key put <id> --management` puts a management key. Seeding the Tenant and `nylorun mcp connect` use the management key (`/v1/tenant/vaults`). Studio reaches the Runtime's public listener.
|
|
54
|
+
- `@nylorun/cli`: `status`, `reset`, `configure`, `doctor` and `access signing-keys` use the Management API through `@nylorun/admin` with the Project's management key, or `NYLORUN_MANAGEMENT_KEY`.
|
|
55
|
+
- `@nylorun/studio`: local Studio needs no login. A request on the published loopback address (`localhost` or `127.0.0.1` at Studio's port) acts as signed in; hosts behind a sign-in proxy and embedding keep their login, and state-changing requests still need Studio's own `Origin`. Studio learns its Tenant from `GET /v1/tenant` with its key instead of the Admin API, and its Connections page manages vaults through `@nylorun/admin/client` at `/v1/tenant/vaults`.
|
|
56
|
+
- **Breaking (`@nylorun/admin`, `@nylorun/runtime`): Studio's key is derived from the admin key alone.** `deriveStudioToken(adminKey)` takes no Tenant id (HMAC-SHA256 over `nylorun/studio/v2`). The Host registers the new key's hash at its next start, replacing the old one; an app that embeds Studio and derives its key must update.
|
|
57
|
+
- `@nylorun/core`: `ProjectCredentialsFileSchema` gains optional `managementKey` and `managementPrincipalId`.
|
|
58
|
+
|
|
59
|
+
- 7f763c3: **The Admin API and the operator listener are gone (Runtime and Management APIs, step A5).** Host work moves to the machine: `nylorun` runs `nylorun-operate` inside the runtime container, and every remote client uses the Runtime API or the Management API.
|
|
60
|
+
|
|
61
|
+
- **Breaking (`@nylorun/runtime`):** `/v1/admin/*` (status, host, shutdown, keys, openapi.json) is removed; it answers like any unknown route. The operator listener, `NYLORUN_ADMIN_LISTEN_PORT`, `NYLORUN_ADMIN_LISTEN_HOST`, `NYLORUN_ADMIN_ALLOWED_HOSTS` and `host.json`'s `adminPort` are gone, and so is the `admin-openapi.json` package file. Stop the Host with SIGTERM. `nylorun-operate status [--json]` reports the version, protocol and the Tenant's id, name, state and cause, exiting 2 when the Tenant is not open. `/ready` adds `harness: { mode, connected }` while the Tenant is open. `startEphemeralRuntime` loses `operatorListener` and `adminUrl`. The admin key stays: it derives Studio's key.
|
|
62
|
+
- **Breaking (`@nylorun/admin`):** `createAdmin()` is the Management API client (`tenant`, `keys`, `models`, `vaults`, `signingKeys`, `settings`) with a management key: explicit `{ url, key }`, else `NYLORUN_RUNTIME_URL` + `NYLORUN_MANAGEMENT_KEY`, else the Project link's or the local Host root's management key. `status()`, `adminUrl`, the Admin API keys, `NYLORUN_ADMIN_URL`/`NYLORUN_ADMIN_KEY` and `OPERATOR_KEYS_FEATURE` are removed; `deriveStudioToken` and `mintStudioLoginToken` stay.
|
|
63
|
+
- **Breaking (`@nylorun/core`):** `admin-status` leaves `PROTOCOL_FEATURES` (the Host still advertises it for protocol 5–7 clients) and `operator-keys` is removed; `AdminStatusSchema`, `AdminHostStatusSchema`, `HostAggregateSchema` and `HostShutdownResponseSchema` are removed.
|
|
64
|
+
- **Breaking (`nylorun`):** no admin port: `NYLORUN_ADMIN_PORT` is no longer written or published (an existing one is ignored). `nylorun start` waits for `/ready`, and `nylorun status` reads readiness from `/ready` and the Tenant from `nylorun-operate status`.
|
|
65
|
+
- `@nylorun/cli`: `nylo status` no longer falls back to the Admin API; when the Tenant does not answer it points to `npx nylorun status`.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Pin agents to the tested release.
|
|
70
|
+
- Pin admin to the tested release.
|
|
71
|
+
- Updated dependencies [3b3bdc6]
|
|
72
|
+
- Updated dependencies [a6108f4]
|
|
73
|
+
- Updated dependencies [b28bdd7]
|
|
74
|
+
- Updated dependencies [7f763c3]
|
|
75
|
+
- Updated dependencies [98b0d37]
|
|
76
|
+
- Updated dependencies [c66d8ed]
|
|
77
|
+
- Updated dependencies
|
|
78
|
+
- Updated dependencies
|
|
79
|
+
- @nylorun/agents@0.15.0-beta
|
|
80
|
+
- @nylorun/admin@0.11.0-beta
|
|
81
|
+
|
|
3
82
|
## 0.10.0-beta
|
|
4
83
|
|
|
5
84
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -17,31 +17,35 @@ npx @nylorun/cli status # the linked Tenant
|
|
|
17
17
|
```sh
|
|
18
18
|
nylo status [--json] # the Tenant, its checks and counts
|
|
19
19
|
nylo reset [--sessions|--sandboxes|--all] [--yes]
|
|
20
|
-
nylo endpoints [--json]|ping <agent> # the registered Action endpoints and their health
|
|
21
20
|
nylo access signing-keys … # the Tenant's signing keys: list, rotate, revoke
|
|
22
21
|
nylo configure # set or replace the Tenant's model provider
|
|
23
22
|
nylo env # export lines for the linked Project
|
|
24
|
-
nylo doctor sandbox [--json] # sandbox backend via the
|
|
23
|
+
nylo doctor sandbox [--json] # sandbox backend via the Management API
|
|
25
24
|
```
|
|
26
25
|
|
|
27
26
|
Every command acts on the linked installation: the Project link and
|
|
28
27
|
credentials (below), or `NYLORUN_RUNTIME_URL` and `NYLORUN_SERVER_KEY` when the
|
|
29
28
|
Project has no link. An installation serves one Tenant, so nothing selects it.
|
|
29
|
+
`status`, `reset`, `access`, `configure` and `doctor` use the Management API
|
|
30
|
+
with the Project's management key, or `NYLORUN_MANAGEMENT_KEY` (with
|
|
31
|
+
`NYLORUN_RUNTIME_URL` when there is no link); `env` prints the Runtime URL and
|
|
32
|
+
the application key, for the Runtime API.
|
|
30
33
|
|
|
31
34
|
Local Tenant commands (`up`, `down`, `start`, `stop`, `logs`, `studio`) exit 2
|
|
32
35
|
naming `npx nylorun <command>`. `nylo tenant …` exits 2: `npx nylorun start`
|
|
33
|
-
creates the project's Tenant and the link, and `nylo status|reset
|
|
34
|
-
|
|
36
|
+
creates the project's Tenant and the link, and `nylo status|reset` replace
|
|
37
|
+
`nylo tenant status|reset`. `nylo endpoints` was removed with Action endpoints
|
|
38
|
+
and exits 2. `nylorun dev` was removed: run
|
|
35
39
|
`npx nylorun start` once, then the project's own `npm run dev`
|
|
36
40
|
(`tsx watch src/main.ts`).
|
|
37
41
|
|
|
38
42
|
## `nylo status`
|
|
39
43
|
|
|
40
|
-
Reads the
|
|
41
|
-
Runtime URL, the checks, the counts and the sandbox
|
|
44
|
+
Reads the Management API's status (`GET /v1/tenant`, with a management key) and
|
|
45
|
+
prints the Tenant, the Runtime URL, the checks, the counts and the sandbox
|
|
42
46
|
backend. When the Tenant is not open it does not answer; `nylo status` then
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
fails and says to run `npx nylorun status`, which reports why from the
|
|
48
|
+
Runtime's container (`nylorun-operate status`).
|
|
45
49
|
|
|
46
50
|
## `nylo reset`
|
|
47
51
|
|
|
@@ -55,15 +59,18 @@ not in a terminal. The Project link and credentials are kept.
|
|
|
55
59
|
|
|
56
60
|
- `.nylorun/link.json`: `{ format: 3, tenant, hostUrl, hostId, tenantId }`
|
|
57
61
|
(`tenant` is the local Tenant's name; `tenantId` is information)
|
|
58
|
-
- `.nylorun/credentials.json
|
|
62
|
+
- `.nylorun/credentials.json` (0600): the application key `project` and the
|
|
63
|
+
management key `project-management`, with their ids (`applicationKey`,
|
|
64
|
+
`principalId`, `managementKey`, `managementPrincipalId`)
|
|
59
65
|
- `.nylorun/.gitignore` containing `*`
|
|
60
66
|
|
|
61
67
|
A link from an older nylorun (format 0 to 2): `nylo` refuses it and says to run
|
|
62
68
|
`npx nylorun start`, which links the project again.
|
|
63
69
|
|
|
64
|
-
`
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
`createClient` in `@nylorun/agents` reads the link (or the two variables), so the
|
|
71
|
+
project's `npm run dev` and `npm start`, which save its agents, need no Nylorun tool.
|
|
72
|
+
`nylo endpoints` was removed with Action endpoints (protocol 8): the Runtime runs no code
|
|
73
|
+
of yours during a session.
|
|
67
74
|
|
|
68
75
|
```sh
|
|
69
76
|
eval "$(npx @nylorun/cli env)"
|
|
@@ -85,7 +92,9 @@ eval "$(npx @nylorun/cli env)"
|
|
|
85
92
|
| Symptom | What to do |
|
|
86
93
|
| --- | --- |
|
|
87
94
|
| No Runtime answers | `npx nylorun start`, then `npx nylorun status` |
|
|
88
|
-
| Tenant not open | `
|
|
95
|
+
| Tenant not open | `npx nylorun status` shows the cause and its `repair` |
|
|
96
|
+
| No management key | `npx nylorun start` in the project writes one; elsewhere set `NYLORUN_MANAGEMENT_KEY` |
|
|
97
|
+
| `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 |
|
|
89
98
|
| Old Project link refused | `npx nylorun start` in the project |
|
|
90
99
|
| `426` from the Runtime | Upgrade the CLI, or pin a matching older set |
|
|
91
100
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nylo access`: the linked Tenant's signing keys, which sign
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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
5
|
*/
|
|
6
|
-
import {
|
|
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
|
|
8
|
-
export declare function accessCommand(input: readonly string[], client?: () => Promise<
|
|
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>;
|
package/dist/access/commands.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nylo access`: the linked Tenant's signing keys, which sign delivery tokens and capability
|
|
3
|
-
* links. Uses the Project's application key, like every other Tenant command. (Subject tokens,
|
|
4
|
-
* the access policy, browser keys and revocations left the Runtime in protocol 7.)
|
|
5
|
-
*/
|
|
6
|
-
import { createClient, resolveConnection, } from "@nylorun/agents";
|
|
7
1
|
import { CliError } from "../errors.js";
|
|
2
|
+
import { linkedConnection, managementClient } from "../project/connection.js";
|
|
3
|
+
import { findProjectRoot } from "../project/root.js";
|
|
8
4
|
export const accessUsage = `nylo access signing-keys <list|rotate|revoke>
|
|
9
5
|
|
|
10
6
|
signing-keys list list the signing keys
|
|
11
|
-
signing-keys rotate [--force] rotate; --force ends outstanding
|
|
7
|
+
signing-keys rotate [--force] rotate; --force ends outstanding links and run tokens
|
|
12
8
|
signing-keys revoke <kid> revoke a previous or standby key`;
|
|
13
9
|
const usageError = (message = accessUsage) => new CliError(message, 2);
|
|
14
10
|
async function linkedClient() {
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
connection = await resolveConnection();
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new CliError(error instanceof Error ? error.message : String(error), 1);
|
|
21
|
-
}
|
|
22
|
-
return createClient({ url: connection.url, key: connection.key });
|
|
11
|
+
return managementClient(await linkedConnection(findProjectRoot() ?? process.cwd()));
|
|
23
12
|
}
|
|
24
13
|
const print = (value) => console.log(JSON.stringify(value, null, 2));
|
|
25
14
|
export async function accessCommand(input, client = linkedClient) {
|
|
26
15
|
const [topic, action, ...args] = input;
|
|
27
16
|
if (topic === "signing-keys") {
|
|
28
|
-
const keys = async () => (await client()).
|
|
17
|
+
const keys = async () => (await client()).signingKeys;
|
|
29
18
|
if (action === "list" && args.length === 0)
|
|
30
19
|
return print(await (await keys()).list());
|
|
31
20
|
if (action === "rotate") {
|
|
@@ -39,6 +28,6 @@ export async function accessCommand(input, client = linkedClient) {
|
|
|
39
28
|
throw usageError();
|
|
40
29
|
}
|
|
41
30
|
if (topic === "policy" || topic === "keys" || topic === "revoke" || topic === "token")
|
|
42
|
-
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
|
|
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>).`);
|
|
43
32
|
throw usageError();
|
|
44
33
|
}
|
package/dist/cli.js
CHANGED
|
@@ -5,17 +5,17 @@ import { putHostModel } from "./model/host-model.js";
|
|
|
5
5
|
import { CliError } from "./errors.js";
|
|
6
6
|
import { findProjectRoot } from "./project/root.js";
|
|
7
7
|
import { printLinkedEnvExports } from "./project/env.js";
|
|
8
|
-
import { linkedConnection } from "./project/connection.js";
|
|
8
|
+
import { linkedConnection, managementClient } from "./project/connection.js";
|
|
9
9
|
import { accessCommand } from "./access/commands.js";
|
|
10
|
-
import {
|
|
11
|
-
const usage = `nylo <status|reset|
|
|
10
|
+
import { resetCommand, statusCommand } from "./installation/commands.js";
|
|
11
|
+
const usage = `nylo <status|reset|access|configure|env|doctor>
|
|
12
12
|
|
|
13
13
|
Runtime client for the linked installation and its one Tenant (the Project link that
|
|
14
|
-
npx nylorun start writes, or NYLORUN_RUNTIME_URL
|
|
14
|
+
npx nylorun start writes, or NYLORUN_RUNTIME_URL with NYLORUN_SERVER_KEY, and
|
|
15
|
+
NYLORUN_MANAGEMENT_KEY for status, reset, access, configure and doctor):
|
|
15
16
|
status [--json] the Tenant, its checks and counts
|
|
16
17
|
reset [--sessions|--sandboxes|--all] [--yes]
|
|
17
18
|
clear the Tenant's sessions, sandboxes or all its data
|
|
18
|
-
endpoints [--json]|ping <agent> the registered Action endpoints and their health
|
|
19
19
|
access signing-keys list|rotate|revoke the Tenant's token signing keys (nylo access --help)
|
|
20
20
|
configure set the linked Tenant's model provider
|
|
21
21
|
env print the linked Project's NYLORUN_* variables as exports
|
|
@@ -29,7 +29,10 @@ const LOCAL_COMMANDS = new Set([
|
|
|
29
29
|
]);
|
|
30
30
|
const TENANT_REMOVED = `nylo tenant was removed: an installation serves one Tenant.
|
|
31
31
|
Run "npx nylorun start" in your project to create its Tenant and the Project link.
|
|
32
|
-
Then use nylo status
|
|
32
|
+
Then use nylo status and nylo reset on the linked installation.`;
|
|
33
|
+
const ENDPOINTS_REMOVED = `nylo endpoints was removed: the Runtime runs no code of yours during a session,
|
|
34
|
+
so there are no Action endpoints. An agent's tools are http() tools and remote MCP servers
|
|
35
|
+
(see MIGRATION.md).`;
|
|
33
36
|
function parseFlags(args, allowed = {}) {
|
|
34
37
|
const booleans = new Set();
|
|
35
38
|
const values = new Map();
|
|
@@ -78,7 +81,7 @@ async function main() {
|
|
|
78
81
|
if (command === "reset")
|
|
79
82
|
return await resetCommand(args);
|
|
80
83
|
if (command === "endpoints")
|
|
81
|
-
|
|
84
|
+
throw usageError(ENDPOINTS_REMOVED);
|
|
82
85
|
if (command === "access") {
|
|
83
86
|
if (args[0] === "--help" || args[0] === "-h" || args.length === 0) {
|
|
84
87
|
const { accessUsage } = await import("./access/commands.js");
|
|
@@ -110,6 +113,7 @@ async function main() {
|
|
|
110
113
|
throw usageError(usage);
|
|
111
114
|
const projectRoot = findProjectRoot() ?? process.cwd();
|
|
112
115
|
const auth = await linkedConnection(projectRoot);
|
|
116
|
+
const admin = managementClient(auth);
|
|
113
117
|
const controller = new AbortController();
|
|
114
118
|
const cancel = (signal) => controller.abort(new ConfigurationCancelled(signal));
|
|
115
119
|
process.once("SIGINT", () => cancel("SIGINT"));
|
|
@@ -117,12 +121,12 @@ async function main() {
|
|
|
117
121
|
const health = await fetch(`${auth.url}/health`).catch(() => undefined);
|
|
118
122
|
if (!health?.ok)
|
|
119
123
|
throw new CliError(`No Runtime is listening at ${auth.url}. Start the local Tenant with "npx nylorun start".`, 6);
|
|
120
|
-
const catalog = await fetchModelCatalog(
|
|
124
|
+
const catalog = await fetchModelCatalog(admin);
|
|
121
125
|
const prompted = await configureProvider({
|
|
122
126
|
signal: controller.signal,
|
|
123
127
|
catalog,
|
|
124
128
|
});
|
|
125
|
-
await putHostModel(
|
|
129
|
+
await putHostModel(admin, prompted);
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
128
132
|
throw usageError(usage);
|
package/dist/doctor.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type SandboxReport = {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
/** `nylo doctor sandbox`: Tenant sandbox report via the
|
|
22
|
+
/** `nylo doctor sandbox`: Tenant sandbox report via the Management API (F2-4). */
|
|
23
23
|
export declare function doctorSandbox(options: {
|
|
24
24
|
json: boolean;
|
|
25
25
|
}): Promise<void>;
|
package/dist/doctor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { release } from "node:os";
|
|
2
|
-
import { createClient, resolveConnection } from "@nylorun/agents";
|
|
3
2
|
import { CliError } from "./errors.js";
|
|
3
|
+
import { linkedConnection, managementClient } from "./project/connection.js";
|
|
4
|
+
import { findProjectRoot } from "./project/root.js";
|
|
4
5
|
function platformLine() {
|
|
5
6
|
const os = process.platform === "darwin"
|
|
6
7
|
? "macOS"
|
|
@@ -9,12 +10,12 @@ function platformLine() {
|
|
|
9
10
|
: process.platform;
|
|
10
11
|
return `${os} (kernel ${release()}) · ${process.arch}`;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
return
|
|
13
|
+
/** The Tenant's sandbox report (`GET /v1/tenant/sandbox`, Management API). */
|
|
14
|
+
async function fetchSandboxReport() {
|
|
15
|
+
const connection = await linkedConnection(findProjectRoot() ?? process.cwd());
|
|
16
|
+
return (await managementClient(connection).settings.sandbox.get());
|
|
16
17
|
}
|
|
17
|
-
/** `nylo doctor sandbox`: Tenant sandbox report via the
|
|
18
|
+
/** `nylo doctor sandbox`: Tenant sandbox report via the Management API (F2-4). */
|
|
18
19
|
export async function doctorSandbox(options) {
|
|
19
20
|
let report;
|
|
20
21
|
try {
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
/**
|
|
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
|
+
*/
|
|
2
5
|
export declare function statusCommand(args: readonly string[]): Promise<void>;
|
|
3
6
|
/** `nylo reset [--sessions|--sandboxes|--all] [--yes]`; `--all` asks first. */
|
|
4
7
|
export declare function resetCommand(args: readonly string[]): Promise<void>;
|
|
5
|
-
/** `nylo endpoints [--json]` and `nylo endpoints ping <agent>`. */
|
|
6
|
-
export declare function endpointsCommand(args: readonly string[]): Promise<void>;
|
|
7
|
-
/** One line of `nylo endpoints`: the agent, its URL and version, and how it is doing. */
|
|
8
|
-
export declare function endpointLine(endpoint: {
|
|
9
|
-
agentId: string;
|
|
10
|
-
url: string;
|
|
11
|
-
implementationVersion: string;
|
|
12
|
-
health: {
|
|
13
|
-
consecutiveFailures: number;
|
|
14
|
-
lastSuccessAt?: string;
|
|
15
|
-
lastError?: {
|
|
16
|
-
code: string;
|
|
17
|
-
message: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}): string;
|
|
@@ -1,63 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nylo status
|
|
3
|
-
*
|
|
2
|
+
* `nylo status` and `nylo reset`: the linked installation's one Tenant, through the Management
|
|
3
|
+
* API (the Project's management key).
|
|
4
4
|
*/
|
|
5
5
|
import { createInterface } from "node:readline/promises";
|
|
6
|
-
import { randomUUID } from "node:crypto";
|
|
7
|
-
import { createAdmin } from "@nylorun/admin";
|
|
8
|
-
import { createClient } from "@nylorun/agents";
|
|
9
6
|
import { CliError } from "../errors.js";
|
|
10
|
-
import { linkedConnection } from "../project/connection.js";
|
|
7
|
+
import { linkedConnection, managementClient } from "../project/connection.js";
|
|
11
8
|
import { findProjectRoot } from "../project/root.js";
|
|
12
9
|
const projectRoot = () => findProjectRoot() ?? process.cwd();
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
*/
|
|
15
14
|
export async function statusCommand(args) {
|
|
16
15
|
const json = args.includes("--json");
|
|
17
16
|
if (args.some((a) => a !== "--json"))
|
|
18
17
|
throw new CliError("Usage: nylo status [--json]", 2);
|
|
19
18
|
const root = projectRoot();
|
|
20
19
|
const connection = await linkedConnection(root);
|
|
21
|
-
|
|
20
|
+
const admin = managementClient(connection);
|
|
21
|
+
let body;
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
if (json) {
|
|
25
|
-
console.log(JSON.stringify(body, null, 2));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
console.log(`${body.tenant.name} ${body.tenant.id}`);
|
|
29
|
-
console.log(`runtime ${connection.url}`);
|
|
30
|
-
console.log(`path ${body.path}`);
|
|
31
|
-
console.log(`checks ${Object.entries(body.checks)
|
|
32
|
-
.map(([k, v]) => `${k}=${v ? "ok" : "fail"}`)
|
|
33
|
-
.join(" ")}`);
|
|
34
|
-
console.log(`counts sessions=${body.counts.sessions} running=${body.counts.runningSessions} pending=${body.counts.pendingActions}`);
|
|
35
|
-
console.log(`sandbox ${body.sandbox.backend ?? "none"}`);
|
|
36
|
-
return;
|
|
23
|
+
body = await admin.tenant.status();
|
|
37
24
|
}
|
|
38
25
|
catch (error) {
|
|
39
|
-
|
|
40
|
-
reason = error;
|
|
41
|
-
}
|
|
42
|
-
let tenant;
|
|
43
|
-
try {
|
|
44
|
-
tenant = (await createAdmin({ cwd: root }).status()).tenant;
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
throw new CliError(reason instanceof Error
|
|
48
|
-
? reason.message
|
|
49
|
-
: `The Tenant at ${connection.url} is not reachable.`, 1);
|
|
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);
|
|
50
27
|
}
|
|
51
28
|
if (json) {
|
|
52
|
-
console.log(JSON.stringify(
|
|
29
|
+
console.log(JSON.stringify(body, null, 2));
|
|
53
30
|
return;
|
|
54
31
|
}
|
|
55
|
-
console.log(`${tenant.name
|
|
32
|
+
console.log(`${body.tenant.name} ${body.tenant.id}`);
|
|
56
33
|
console.log(`runtime ${connection.url}`);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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"}`);
|
|
61
40
|
}
|
|
62
41
|
const RESET_USAGE = "Usage: nylo reset [--sessions|--sandboxes|--all] [--yes]";
|
|
63
42
|
const SCOPES = { "--sessions": "sessions", "--sandboxes": "sandboxes", "--all": "all" };
|
|
@@ -73,14 +52,11 @@ export async function resetCommand(args) {
|
|
|
73
52
|
const connection = await linkedConnection(projectRoot());
|
|
74
53
|
const tenant = connection.link?.tenant;
|
|
75
54
|
const target = tenant ? `Tenant ${tenant} (${connection.url})` : `the Tenant on ${connection.url}`;
|
|
55
|
+
const admin = managementClient(connection);
|
|
76
56
|
if (scope === "all" && !yes)
|
|
77
57
|
await confirmOrThrow(`Reset ALL data of ${target}? The Project link and credentials are kept. [y/N] `);
|
|
78
58
|
try {
|
|
79
|
-
await
|
|
80
|
-
requestId: randomUUID(),
|
|
81
|
-
scope,
|
|
82
|
-
activeWork: "drain",
|
|
83
|
-
});
|
|
59
|
+
await admin.tenant.reset({ scope, activeWork: "drain" });
|
|
84
60
|
}
|
|
85
61
|
catch (error) {
|
|
86
62
|
throw new CliError(error instanceof Error ? error.message : `Tenant reset failed: ${String(error)}`, 1);
|
|
@@ -102,40 +78,3 @@ async function confirmOrThrow(prompt) {
|
|
|
102
78
|
rl.close();
|
|
103
79
|
}
|
|
104
80
|
}
|
|
105
|
-
/** `nylo endpoints [--json]` and `nylo endpoints ping <agent>`. */
|
|
106
|
-
export async function endpointsCommand(args) {
|
|
107
|
-
if (args[0] === "ping") {
|
|
108
|
-
const agentId = args[1];
|
|
109
|
-
if (!agentId || args.length > 2)
|
|
110
|
-
throw new CliError("Usage: nylo endpoints ping <agent>", 2);
|
|
111
|
-
const client = clientFor(await linkedConnection(projectRoot()));
|
|
112
|
-
const answer = await client.transport.json(`/v1/endpoints/${encodeURIComponent(agentId)}/ping`, "POST");
|
|
113
|
-
console.log(`${answer.agentId} serves ${answer.implementationVersion}${answer.manifestHash ? ` ${answer.manifestHash}` : ""}`);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const json = args.includes("--json");
|
|
117
|
-
if (args.some((a) => a !== "--json"))
|
|
118
|
-
throw new CliError("Usage: nylo endpoints [--json] | nylo endpoints ping <agent>", 2);
|
|
119
|
-
const client = clientFor(await linkedConnection(projectRoot()));
|
|
120
|
-
const body = await client.transport.json("/v1/endpoints", "GET");
|
|
121
|
-
if (json) {
|
|
122
|
-
console.log(JSON.stringify(body, null, 2));
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (body.endpoints.length === 0) {
|
|
126
|
-
console.log("No Action endpoints. Register one with createActionHandler(...).register({ url }).");
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
for (const endpoint of body.endpoints)
|
|
130
|
-
console.log(endpointLine(endpoint));
|
|
131
|
-
}
|
|
132
|
-
/** One line of `nylo endpoints`: the agent, its URL and version, and how it is doing. */
|
|
133
|
-
export function endpointLine(endpoint) {
|
|
134
|
-
const { health } = endpoint;
|
|
135
|
-
const state = health.consecutiveFailures > 0
|
|
136
|
-
? `failing (${health.consecutiveFailures}): ${health.lastError?.message || health.lastError?.code || "unknown"}`
|
|
137
|
-
: health.lastSuccessAt
|
|
138
|
-
? `ok (last ${health.lastSuccessAt})`
|
|
139
|
-
: "no deliveries yet";
|
|
140
|
-
return `${endpoint.agentId} ${endpoint.url} ${endpoint.implementationVersion} ${state}`;
|
|
141
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Readable, Writable } from "node:stream";
|
|
2
2
|
import type { Credential } from "@earendil-works/pi-ai";
|
|
3
|
+
import type { ManagementClient } from "@nylorun/admin";
|
|
3
4
|
export declare class ConfigurationCancelled extends Error {
|
|
4
5
|
readonly signal: "SIGINT" | "SIGTERM";
|
|
5
6
|
readonly exitCode: number;
|
|
@@ -37,12 +38,8 @@ export type Selection = Readonly<{
|
|
|
37
38
|
baseUrl: string;
|
|
38
39
|
}>;
|
|
39
40
|
}>;
|
|
40
|
-
/**
|
|
41
|
-
export declare function fetchModelCatalog(
|
|
42
|
-
url: string;
|
|
43
|
-
key: string;
|
|
44
|
-
fetchImpl?: typeof fetch;
|
|
45
|
-
}): Promise<ModelCatalog>;
|
|
41
|
+
/** The Tenant's model catalog (`GET /v1/tenant/models`, Management API). */
|
|
42
|
+
export declare function fetchModelCatalog(admin: ManagementClient): Promise<ModelCatalog>;
|
|
46
43
|
export declare function configureProvider(options?: {
|
|
47
44
|
signal?: AbortSignal;
|
|
48
45
|
root?: string;
|
package/dist/model/configure.js
CHANGED
|
@@ -109,22 +109,9 @@ function modelsFor(selection, credentials, catalog) {
|
|
|
109
109
|
},
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
export async function fetchModelCatalog(
|
|
114
|
-
|
|
115
|
-
const { PROTOCOL_HEADER, PROTOCOL_VERSION } = await import("@nylorun/agents");
|
|
116
|
-
const response = await fetchImpl(`${options.url.replace(/\/$/, "")}/v1/tenant/models`, {
|
|
117
|
-
headers: {
|
|
118
|
-
authorization: `Bearer ${options.key}`,
|
|
119
|
-
[PROTOCOL_HEADER]: String(PROTOCOL_VERSION),
|
|
120
|
-
Accept: "application/json",
|
|
121
|
-
},
|
|
122
|
-
signal: AbortSignal.timeout(10_000),
|
|
123
|
-
});
|
|
124
|
-
if (!response.ok) {
|
|
125
|
-
throw new Error(`Runtime model catalog returned ${response.status}`);
|
|
126
|
-
}
|
|
127
|
-
return (await response.json());
|
|
112
|
+
/** The Tenant's model catalog (`GET /v1/tenant/models`, Management API). */
|
|
113
|
+
export async function fetchModelCatalog(admin) {
|
|
114
|
+
return await admin.models.catalog();
|
|
128
115
|
}
|
|
129
116
|
// Internal options also allow isolated prompt tests without changing process globals.
|
|
130
117
|
export async function configureProvider(options = {}) {
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
+
import type { ManagementClient } from "@nylorun/admin";
|
|
1
2
|
import type { PromptedModel } from "./configure.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
readonly configured: false;
|
|
5
|
-
} | {
|
|
6
|
-
readonly configured: true;
|
|
7
|
-
readonly provider: string;
|
|
8
|
-
readonly model: string;
|
|
9
|
-
readonly authType: "api_key" | "oauth";
|
|
10
|
-
readonly baseUrl?: string;
|
|
11
|
-
readonly settings?: {
|
|
12
|
-
contextWindow?: number;
|
|
13
|
-
maxTokens?: number;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
/** Set the installation's Tenant model provider (`PUT /v1/tenant/model`). */
|
|
17
|
-
export declare function putHostModel(runtimeUrl: string, serverKey: string, model: PromptedModel, fetchImpl?: typeof fetch): Promise<HostModelView>;
|
|
18
|
-
export {};
|
|
3
|
+
/** Set the installation's Tenant model provider (`PUT /v1/tenant/model`, Management API). */
|
|
4
|
+
export declare function putHostModel(admin: ManagementClient, model: PromptedModel): ReturnType<ManagementClient["models"]["put"]>;
|
package/dist/model/host-model.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
body: JSON.stringify({
|
|
13
|
-
requestId: randomUUID(),
|
|
14
|
-
idempotencyKey: randomUUID(),
|
|
15
|
-
provider: model.provider,
|
|
16
|
-
model: model.model,
|
|
17
|
-
...(model.baseUrl ? { baseUrl: model.baseUrl } : {}),
|
|
18
|
-
...(model.settings ? { settings: model.settings } : {}),
|
|
19
|
-
auth: model.auth,
|
|
20
|
-
}),
|
|
2
|
+
/** Set the installation's Tenant model provider (`PUT /v1/tenant/model`, Management API). */
|
|
3
|
+
export async function putHostModel(admin, model) {
|
|
4
|
+
return await admin.models.put({
|
|
5
|
+
idempotencyKey: randomUUID(),
|
|
6
|
+
provider: model.provider,
|
|
7
|
+
model: model.model,
|
|
8
|
+
...(model.baseUrl ? { baseUrl: model.baseUrl } : {}),
|
|
9
|
+
...(model.settings ? { settings: model.settings } : {}),
|
|
10
|
+
// A prompted credential is complete: pi-ai's type leaves its fields optional.
|
|
11
|
+
auth: model.auth,
|
|
21
12
|
});
|
|
22
|
-
const body = (await response.json().catch(() => ({})));
|
|
23
|
-
if (!response.ok)
|
|
24
|
-
throw new Error(body.message ?? `Runtime rejected the model provider (${response.status})`);
|
|
25
|
-
return body;
|
|
26
13
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { type ManagementClient } from "@nylorun/admin";
|
|
1
2
|
import { type ProjectLink } from "./link.js";
|
|
2
|
-
/** The installation `nylo` acts on: a Runtime URL
|
|
3
|
+
/** The installation `nylo` acts on: a Runtime URL, an application key and a management key. */
|
|
3
4
|
export interface LinkedConnection {
|
|
4
5
|
url: string;
|
|
5
|
-
key
|
|
6
|
+
/** The application key (Runtime API); absent when only a management key is set. */
|
|
7
|
+
key?: string;
|
|
8
|
+
/** The management key (Management API), when there is one. */
|
|
9
|
+
managementKey?: string;
|
|
6
10
|
/** The Project link it came from, when it came from one. */
|
|
7
11
|
link?: ProjectLink;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
|
-
* The Project's link and credentials, else `NYLORUN_RUNTIME_URL`
|
|
11
|
-
*
|
|
14
|
+
* The Project's link and credentials, else `NYLORUN_RUNTIME_URL` with `NYLORUN_SERVER_KEY`, or
|
|
15
|
+
* `NYLORUN_MANAGEMENT_KEY`, or both; `NYLORUN_MANAGEMENT_KEY` also stands in for a Project
|
|
16
|
+
* credentials file without one. The installation serves one Tenant, so nothing names it.
|
|
12
17
|
*/
|
|
13
18
|
export declare function linkedConnection(projectRoot: string, env?: Readonly<Record<string, string | undefined>>): Promise<LinkedConnection>;
|
|
19
|
+
/** The Management API client of `connection`; refused without a management key. */
|
|
20
|
+
export declare function managementClient(connection: LinkedConnection): ManagementClient;
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
+
import { createManagementClient } from "@nylorun/admin";
|
|
1
2
|
import { CliError } from "../errors.js";
|
|
2
3
|
import { readCredentials } from "./credentials.js";
|
|
3
4
|
import { readLink } from "./link.js";
|
|
4
5
|
/**
|
|
5
|
-
* The Project's link and credentials, else `NYLORUN_RUNTIME_URL`
|
|
6
|
-
*
|
|
6
|
+
* The Project's link and credentials, else `NYLORUN_RUNTIME_URL` with `NYLORUN_SERVER_KEY`, or
|
|
7
|
+
* `NYLORUN_MANAGEMENT_KEY`, or both; `NYLORUN_MANAGEMENT_KEY` also stands in for a Project
|
|
8
|
+
* credentials file without one. The installation serves one Tenant, so nothing names it.
|
|
7
9
|
*/
|
|
8
10
|
export async function linkedConnection(projectRoot, env = process.env) {
|
|
9
11
|
const link = await readLink(projectRoot);
|
|
10
12
|
const credentials = await readCredentials(projectRoot);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const managementKey = env.NYLORUN_MANAGEMENT_KEY?.trim();
|
|
14
|
+
if (link && credentials) {
|
|
15
|
+
const management = credentials.managementKey ?? managementKey;
|
|
16
|
+
return {
|
|
17
|
+
url: link.hostUrl,
|
|
18
|
+
key: credentials.applicationKey,
|
|
19
|
+
...(management ? { managementKey: management } : {}),
|
|
20
|
+
link,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
13
23
|
const url = env.NYLORUN_RUNTIME_URL?.trim();
|
|
14
24
|
const key = env.NYLORUN_SERVER_KEY?.trim();
|
|
15
|
-
if (url && key)
|
|
16
|
-
return {
|
|
17
|
-
|
|
25
|
+
if (url && (key || managementKey))
|
|
26
|
+
return {
|
|
27
|
+
url: url.replace(/\/$/, ""),
|
|
28
|
+
...(key ? { key } : {}),
|
|
29
|
+
...(managementKey ? { managementKey } : {}),
|
|
30
|
+
};
|
|
31
|
+
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 (or NYLORUN_MANAGEMENT_KEY).`, 1);
|
|
32
|
+
}
|
|
33
|
+
/** The Management API client of `connection`; refused without a management key. */
|
|
34
|
+
export function managementClient(connection) {
|
|
35
|
+
if (!connection.managementKey)
|
|
36
|
+
throw new CliError(`No management key for the Tenant at ${connection.url}: run npx nylorun start, or set NYLORUN_MANAGEMENT_KEY.`, 1);
|
|
37
|
+
return createManagementClient({ url: connection.url, key: connection.managementKey });
|
|
18
38
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Project-local credentials (mode 0600): the application key and its principal
|
|
3
|
-
*
|
|
2
|
+
* Project-local credentials (mode 0600): the application key and its principal, and the
|
|
3
|
+
* management key and its principal when `nylorun start` issued one. A format 0 file may still
|
|
4
|
+
* carry a legacy `executors` map from before protocol 3; it is ignored.
|
|
4
5
|
*/
|
|
5
6
|
export interface ProjectCredentials {
|
|
6
7
|
format: 0 | 1;
|
|
7
8
|
applicationKey: string;
|
|
8
9
|
principalId: string;
|
|
10
|
+
managementKey?: string;
|
|
11
|
+
managementPrincipalId?: string;
|
|
9
12
|
}
|
|
10
13
|
/** The Project's credentials, which `nylorun start` writes beside the link. */
|
|
11
14
|
export declare function readCredentials(projectRoot: string): Promise<ProjectCredentials | undefined>;
|
|
@@ -25,6 +25,11 @@ export async function readCredentials(projectRoot) {
|
|
|
25
25
|
format,
|
|
26
26
|
applicationKey: value.applicationKey,
|
|
27
27
|
principalId: value.principalId,
|
|
28
|
+
...(typeof value.managementKey === "string" &&
|
|
29
|
+
/^[0-9a-f]{64}$/.test(value.managementKey) &&
|
|
30
|
+
typeof value.managementPrincipalId === "string"
|
|
31
|
+
? { managementKey: value.managementKey, managementPrincipalId: value.managementPrincipalId }
|
|
32
|
+
: {}),
|
|
28
33
|
};
|
|
29
34
|
}
|
|
30
35
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nylorun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1-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.
|
|
34
|
-
"@nylorun/admin": "0.
|
|
33
|
+
"@nylorun/agents": "0.16.1-beta",
|
|
34
|
+
"@nylorun/admin": "0.11.1-beta",
|
|
35
35
|
"@earendil-works/pi-ai": "0.99.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|