@ornncompute/cli 1.0.259 → 1.0.261
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/README.md +32 -1
- package/package.json +1 -1
- package/src/admin-benchmark.mjs +292 -0
- package/src/admin-command-handlers.mjs +8 -2
- package/src/admin-fleet.mjs +458 -0
- package/src/admin-shell.mjs +15 -2
- package/src/catalog-shell.mjs +100 -13
- package/vendor/capabilities/cli.js +2013 -1006
package/README.md
CHANGED
|
@@ -195,7 +195,7 @@ duration bounds, nullable deposit, renewable flag and optional
|
|
|
195
195
|
editing remains staff-only. The old customer `capacity-offers update` is removed.
|
|
196
196
|
|
|
197
197
|
All staff discovery and execution starts at `ornn admin`. A fresh staff preflight
|
|
198
|
-
runs before the catalog is shown. The
|
|
198
|
+
runs before the catalog is shown. The staff roots are:
|
|
199
199
|
|
|
200
200
|
```text
|
|
201
201
|
ornn admin users
|
|
@@ -206,6 +206,10 @@ ornn admin nodes
|
|
|
206
206
|
ornn admin enrollment-tokens
|
|
207
207
|
ornn admin capacity-offers
|
|
208
208
|
ornn admin reservations
|
|
209
|
+
ornn admin ssh
|
|
210
|
+
ornn admin gifts
|
|
211
|
+
ornn admin inference
|
|
212
|
+
ornn admin downtime
|
|
209
213
|
```
|
|
210
214
|
|
|
211
215
|
Supplier networking is available under the existing supplier root:
|
|
@@ -285,6 +289,15 @@ timestamp is not the credential generation. `ornn admin nodes enroll` creates an
|
|
|
285
289
|
a configurable agent recovery run for the existing node. The former `--filter`
|
|
286
290
|
and `--verbose` compartment options are removed; inspect the saved run for step
|
|
287
291
|
progress. The gateway authoritatively enforces the admin role.
|
|
292
|
+
`ornn admin nodes benchmark <node-id>` reads benchmark job history from
|
|
293
|
+
`/v1/benchmark/jobs`. `ornn admin nodes test <node-id> [--burn-time MINUTES]`
|
|
294
|
+
queues a burn job, and `test-result <job-id>` reads it. Auto-diagnosis is
|
|
295
|
+
`ornn admin nodes diagnosis`: `eligibility`, `list`, and `show` are reads;
|
|
296
|
+
`start`, `cancel`, `policy update`, and `profile update` print a review and
|
|
297
|
+
then submit in an eligible human terminal. Omitted policy scopes are sent as
|
|
298
|
+
null, which keeps the owner's unrestricted scope. These calls use the staff
|
|
299
|
+
session on `/v1/benchmark/*`.
|
|
300
|
+
|
|
288
301
|
`ornn admin nodes sanitize`, `sanitize-status`, and `sanitize-decide` drive one
|
|
289
302
|
node's held sanitize job, sharing the capability with MCP
|
|
290
303
|
`admin_node_sanitize_*` and Slack `node_sanitize_*`. `sanitize` needs
|
|
@@ -296,6 +309,24 @@ node's held sanitize job, sharing the capability with MCP
|
|
|
296
309
|
flag: `--tenant-access-revoked`, `--data-drives-sanitized`, and
|
|
297
310
|
`--acknowledge-retained-os`. Sanitize writes run only in an eligible human
|
|
298
311
|
terminal. See [manual cleanup with the boot OS retained](../../docs/provisioning/dedicated-machine-runbook.md#manual-cleanup-with-the-boot-os-retained).
|
|
312
|
+
|
|
313
|
+
`ornn admin nodes deploy <node-id> --tenant UUID` deploys a free node to that
|
|
314
|
+
tenant. `ornn admin nodes update <node-id>` saves the host fields that were
|
|
315
|
+
supplied. `--gpu-count 0` records a CPU node and clears the GPU type. `--gpu-type ""`
|
|
316
|
+
clears the type without changing the count. A blank count is rejected.
|
|
317
|
+
`ornn admin nodes agent-update <node-id> --version VERSION` requests that agent
|
|
318
|
+
version. `ornn admin nodes maintenance` lists one maintenance-history page, and
|
|
319
|
+
`maintenance show <record-id>` reads one record. `ornn admin nodes test-pool`
|
|
320
|
+
reads the pool, `test-pool update` resizes it, and `test-pool runs`,
|
|
321
|
+
`runs create`, and `runs delete` list, create, and delete runs. These writes
|
|
322
|
+
print their review and then submit in an eligible human terminal.
|
|
323
|
+
|
|
324
|
+
`ornn admin downtime list` reads the customer downtime register. `downtime create`
|
|
325
|
+
records an incident. `downtime update <incident-id> --version N` replaces the
|
|
326
|
+
whole entry, so repeat every current field, including `--notes` and `--ended`.
|
|
327
|
+
`--notes ""` clears notes. `--ended null` leaves the incident open. Omitting
|
|
328
|
+
either flag is rejected before the write.
|
|
329
|
+
|
|
299
330
|
Suppliers are Authorization supplier organizations: `ornn admin suppliers list`
|
|
300
331
|
returns their `id` and `name`, and `--supplier UUID` on `facilities list`,
|
|
301
332
|
`nodes list`, `enrollment-tokens create`, and `nodes enroll` takes that
|
package/package.json
CHANGED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { ADMIN_MUTATION_SAFETY, AdminMutationError, runAdminMutation } from "./admin-mutations.mjs";
|
|
2
|
+
|
|
3
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4
|
+
|
|
5
|
+
function usageError(message, field) {
|
|
6
|
+
return new AdminMutationError(message, {
|
|
7
|
+
code: "usage_error",
|
|
8
|
+
...(field ? { field } : {}),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function parseOptions(argv, allowed, usage) {
|
|
13
|
+
const options = {};
|
|
14
|
+
const positionals = [];
|
|
15
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
16
|
+
const argument = argv[index];
|
|
17
|
+
if (!argument.startsWith("--")) {
|
|
18
|
+
positionals.push(argument);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const separator = argument.indexOf("=");
|
|
22
|
+
const name = argument.slice(2, separator === -1 ? undefined : separator);
|
|
23
|
+
if (!allowed.has(name)) throw usageError(`${usage}\nUnknown option: --${name}`, name);
|
|
24
|
+
if (options[name] !== undefined) {
|
|
25
|
+
throw usageError(`${usage}\n--${name} may be supplied only once.`, name);
|
|
26
|
+
}
|
|
27
|
+
const inline = separator !== -1;
|
|
28
|
+
const value = inline ? argument.slice(separator + 1) : argv[index + 1];
|
|
29
|
+
if (!value || (!inline && value.startsWith("--"))) {
|
|
30
|
+
throw usageError(`${usage}\n--${name} requires a value.`, name);
|
|
31
|
+
}
|
|
32
|
+
options[name] = value;
|
|
33
|
+
if (!inline) index += 1;
|
|
34
|
+
}
|
|
35
|
+
return { options, positionals };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function requireUuid(value, name, usage, { option = true } = {}) {
|
|
39
|
+
if (!value || !UUID.test(value)) {
|
|
40
|
+
const label = option ? `--${name}` : name;
|
|
41
|
+
throw usageError(`${usage}\n${label} must be a UUID.`, name);
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function wholeMinutes(value, name, usage) {
|
|
47
|
+
if (!/^\d+$/.test(value)) {
|
|
48
|
+
throw usageError(`${usage}\n--${name} must be a whole number of minutes.`, name);
|
|
49
|
+
}
|
|
50
|
+
const parsed = Number(value);
|
|
51
|
+
if (!Number.isSafeInteger(parsed) || parsed > 10080) {
|
|
52
|
+
throw usageError(`${usage}\n--${name} must be a whole number of minutes.`, name);
|
|
53
|
+
}
|
|
54
|
+
return parsed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function idList(value, name, usage) {
|
|
58
|
+
if (value === undefined) return null;
|
|
59
|
+
const ids = value
|
|
60
|
+
.split(",")
|
|
61
|
+
.map((id) => id.trim())
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
if (ids.length === 0 || ids.some((id) => !UUID.test(id))) {
|
|
64
|
+
throw usageError(`${usage}\n--${name} must be a comma-separated list of UUIDs.`, name);
|
|
65
|
+
}
|
|
66
|
+
return ids;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function booleanValue(value, name, usage) {
|
|
70
|
+
if (value === "true") return true;
|
|
71
|
+
if (value === "false") return false;
|
|
72
|
+
throw usageError(`${usage}\n--${name} must be true or false.`, name);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onePositional(positionals, usage, field) {
|
|
76
|
+
if (positionals.length !== 1 || !positionals[0]) throw usageError(usage, field);
|
|
77
|
+
return positionals[0];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const TEST_USAGE = "Usage: ornn admin nodes test <node-id> [--burn-time MINUTES]";
|
|
81
|
+
const START_USAGE =
|
|
82
|
+
"Usage: ornn admin nodes diagnosis start <node-id> --idempotency-key UUID [--symptom TEXT]";
|
|
83
|
+
const CANCEL_USAGE = "Usage: ornn admin nodes diagnosis cancel <diagnosis-id>";
|
|
84
|
+
const POLICY_USAGE =
|
|
85
|
+
"Usage: ornn admin nodes diagnosis policy update --expected-revision UUID --enabled true|false --managers IDS [--operators IDS] [--nodes IDS] [--suppliers IDS] [--customers IDS]";
|
|
86
|
+
const PROFILE_USAGE =
|
|
87
|
+
"Usage: ornn admin nodes diagnosis profile update --expected-revision UUID --instructions TEXT";
|
|
88
|
+
|
|
89
|
+
function parseTest(argv) {
|
|
90
|
+
const { options, positionals } = parseOptions(
|
|
91
|
+
argv,
|
|
92
|
+
new Set(["burn-time", "idempotency-key"]),
|
|
93
|
+
TEST_USAGE
|
|
94
|
+
);
|
|
95
|
+
const nodeId = requireUuid(onePositional(positionals, TEST_USAGE, "node-id"), "node-id", TEST_USAGE, {
|
|
96
|
+
option: false,
|
|
97
|
+
});
|
|
98
|
+
const burnTimeMinutes =
|
|
99
|
+
options["burn-time"] === undefined
|
|
100
|
+
? undefined
|
|
101
|
+
: wholeMinutes(options["burn-time"], "burn-time", TEST_USAGE);
|
|
102
|
+
return {
|
|
103
|
+
input: { nodeId, ...(burnTimeMinutes !== undefined ? { burnTimeMinutes } : {}) },
|
|
104
|
+
mutation: { idempotencyKey: options["idempotency-key"] },
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function parseStart(argv) {
|
|
109
|
+
const { options, positionals } = parseOptions(
|
|
110
|
+
argv,
|
|
111
|
+
new Set(["idempotency-key", "symptom"]),
|
|
112
|
+
START_USAGE
|
|
113
|
+
);
|
|
114
|
+
const nodeId = requireUuid(onePositional(positionals, START_USAGE, "node-id"), "node-id", START_USAGE, {
|
|
115
|
+
option: false,
|
|
116
|
+
});
|
|
117
|
+
const idempotencyKey = requireUuid(options["idempotency-key"], "idempotency-key", START_USAGE);
|
|
118
|
+
return {
|
|
119
|
+
input: {
|
|
120
|
+
node_id: nodeId,
|
|
121
|
+
idempotency_key: idempotencyKey,
|
|
122
|
+
...(options.symptom ? { symptom: options.symptom } : {}),
|
|
123
|
+
},
|
|
124
|
+
mutation: { idempotencyKey },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function parseCancel(argv) {
|
|
129
|
+
const { options, positionals } = parseOptions(argv, new Set(["idempotency-key"]), CANCEL_USAGE);
|
|
130
|
+
return {
|
|
131
|
+
input: {
|
|
132
|
+
id: requireUuid(
|
|
133
|
+
onePositional(positionals, CANCEL_USAGE, "diagnosis-id"),
|
|
134
|
+
"diagnosis-id",
|
|
135
|
+
CANCEL_USAGE,
|
|
136
|
+
{ option: false }
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
mutation: { idempotencyKey: options["idempotency-key"] },
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function parsePolicy(argv) {
|
|
144
|
+
const { options, positionals } = parseOptions(
|
|
145
|
+
argv,
|
|
146
|
+
new Set([
|
|
147
|
+
"expected-revision",
|
|
148
|
+
"enabled",
|
|
149
|
+
"managers",
|
|
150
|
+
"operators",
|
|
151
|
+
"nodes",
|
|
152
|
+
"suppliers",
|
|
153
|
+
"customers",
|
|
154
|
+
"idempotency-key",
|
|
155
|
+
]),
|
|
156
|
+
POLICY_USAGE
|
|
157
|
+
);
|
|
158
|
+
if (positionals.length !== 0) throw usageError(POLICY_USAGE);
|
|
159
|
+
if (!options.managers) throw usageError(`${POLICY_USAGE}\n--managers is required.`, "managers");
|
|
160
|
+
return {
|
|
161
|
+
input: {
|
|
162
|
+
expected_revision: requireUuid(options["expected-revision"], "expected-revision", POLICY_USAGE),
|
|
163
|
+
policy: {
|
|
164
|
+
enabled: booleanValue(options.enabled, "enabled", POLICY_USAGE),
|
|
165
|
+
manager_user_ids: idList(options.managers, "managers", POLICY_USAGE),
|
|
166
|
+
operator_user_ids: idList(options.operators, "operators", POLICY_USAGE),
|
|
167
|
+
node_ids: idList(options.nodes, "nodes", POLICY_USAGE),
|
|
168
|
+
supplier_organization_ids: idList(options.suppliers, "suppliers", POLICY_USAGE),
|
|
169
|
+
customer_organization_ids: idList(options.customers, "customers", POLICY_USAGE),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
mutation: { idempotencyKey: options["idempotency-key"] },
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function parseProfile(argv) {
|
|
177
|
+
const { options, positionals } = parseOptions(
|
|
178
|
+
argv,
|
|
179
|
+
new Set(["expected-revision", "instructions", "idempotency-key"]),
|
|
180
|
+
PROFILE_USAGE
|
|
181
|
+
);
|
|
182
|
+
if (positionals.length !== 0) throw usageError(PROFILE_USAGE);
|
|
183
|
+
if (!options.instructions) {
|
|
184
|
+
throw usageError(`${PROFILE_USAGE}\n--instructions is required.`, "instructions");
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
input: {
|
|
188
|
+
expected_revision: requireUuid(
|
|
189
|
+
options["expected-revision"],
|
|
190
|
+
"expected-revision",
|
|
191
|
+
PROFILE_USAGE
|
|
192
|
+
),
|
|
193
|
+
instructions: options.instructions,
|
|
194
|
+
},
|
|
195
|
+
mutation: { idempotencyKey: options["idempotency-key"] },
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function reviewFor(capabilityId, input) {
|
|
200
|
+
if (capabilityId === "node.test-trigger") {
|
|
201
|
+
return {
|
|
202
|
+
title: "Queue node burn job",
|
|
203
|
+
fields: [
|
|
204
|
+
{ label: "Node", value: input.nodeId },
|
|
205
|
+
{ label: "Burn minutes", value: input.burnTimeMinutes ?? 0 },
|
|
206
|
+
],
|
|
207
|
+
consequence: "A benchmark job will be queued for this node.",
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (capabilityId === "diagnosis.start") {
|
|
211
|
+
return {
|
|
212
|
+
title: "Start auto-diagnosis",
|
|
213
|
+
fields: [
|
|
214
|
+
{ label: "Node", value: input.node_id },
|
|
215
|
+
{ label: "Symptom", value: input.symptom ?? "—" },
|
|
216
|
+
{ label: "Idempotency key", value: input.idempotency_key },
|
|
217
|
+
],
|
|
218
|
+
consequence: "An auto-diagnosis run will start for this node.",
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (capabilityId === "diagnosis.cancel") {
|
|
222
|
+
return {
|
|
223
|
+
title: "Cancel auto-diagnosis",
|
|
224
|
+
fields: [{ label: "Diagnosis", value: input.id }],
|
|
225
|
+
consequence: "Cancellation will be requested for this auto-diagnosis run.",
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (capabilityId === "diagnosis.policy.update") {
|
|
229
|
+
const scope = (value) => (value === null ? "unrestricted" : value.join(", "));
|
|
230
|
+
return {
|
|
231
|
+
title: "Replace auto-diagnosis policy",
|
|
232
|
+
fields: [
|
|
233
|
+
{ label: "Expected revision", value: input.expected_revision },
|
|
234
|
+
{ label: "Enabled", value: input.policy.enabled },
|
|
235
|
+
{ label: "Managers", value: scope(input.policy.manager_user_ids) },
|
|
236
|
+
{ label: "Operators", value: scope(input.policy.operator_user_ids) },
|
|
237
|
+
{ label: "Nodes", value: scope(input.policy.node_ids) },
|
|
238
|
+
{ label: "Suppliers", value: scope(input.policy.supplier_organization_ids) },
|
|
239
|
+
{ label: "Customers", value: scope(input.policy.customer_organization_ids) },
|
|
240
|
+
],
|
|
241
|
+
consequence:
|
|
242
|
+
"The auto-diagnosis rollout policy will be replaced. Unrestricted scopes apply to every matching caller.",
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
title: "Replace auto-diagnosis instructions",
|
|
247
|
+
fields: [
|
|
248
|
+
{ label: "Expected revision", value: input.expected_revision },
|
|
249
|
+
{ label: "Instructions", value: input.instructions },
|
|
250
|
+
],
|
|
251
|
+
consequence: "The auto-diagnosis instructions will be replaced.",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function handler(capabilityId, parse) {
|
|
256
|
+
return {
|
|
257
|
+
capabilityId,
|
|
258
|
+
safety: ADMIN_MUTATION_SAFETY.eligibleHumanOnly,
|
|
259
|
+
parse: (argv) => {
|
|
260
|
+
const parsed = parse(argv);
|
|
261
|
+
return {
|
|
262
|
+
input: parsed.input,
|
|
263
|
+
mutation: {
|
|
264
|
+
idempotencyKey: parsed.mutation.idempotencyKey,
|
|
265
|
+
safety: ADMIN_MUTATION_SAFETY.eligibleHumanOnly,
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
run: async ({ input, runtime, execute }) => {
|
|
270
|
+
const result = await runAdminMutation({
|
|
271
|
+
...runtime,
|
|
272
|
+
safety: ADMIN_MUTATION_SAFETY.eligibleHumanOnly,
|
|
273
|
+
stdout: runtime.stderr,
|
|
274
|
+
prepare: async () => ({ review: reviewFor(capabilityId, input), value: input }),
|
|
275
|
+
execute: async () => execute(input, { confirmed: true }),
|
|
276
|
+
});
|
|
277
|
+
return {
|
|
278
|
+
data: result.data,
|
|
279
|
+
exitCode: 0,
|
|
280
|
+
outcome: result.outcome,
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export const adminBenchmarkHandlers = [
|
|
287
|
+
handler("node.test-trigger", parseTest),
|
|
288
|
+
handler("diagnosis.start", parseStart),
|
|
289
|
+
handler("diagnosis.cancel", parseCancel),
|
|
290
|
+
handler("diagnosis.policy.update", parsePolicy),
|
|
291
|
+
handler("diagnosis.profile.update", parseProfile),
|
|
292
|
+
];
|
|
@@ -5,6 +5,8 @@ import { adminCreditHandlers } from "./admin-credits.mjs";
|
|
|
5
5
|
import { adminGiftHandlers } from "./admin-gifts.mjs";
|
|
6
6
|
import { adminEnrollmentHandlers } from "./admin-enrollment.mjs";
|
|
7
7
|
import { adminNodeDiagnosticsHandlers } from "./admin-node-diagnostics.mjs";
|
|
8
|
+
import { adminBenchmarkHandlers } from "./admin-benchmark.mjs";
|
|
9
|
+
import { adminFleetHandlers } from "./admin-fleet.mjs";
|
|
8
10
|
import { adminNodeLifecycleHandlers } from "./admin-node-lifecycle.mjs";
|
|
9
11
|
import { adminNodeSanitizeHandlers } from "./admin-node-sanitize.mjs";
|
|
10
12
|
import { ADMIN_MUTATION_SAFETY, assertAdminMutationContext } from "./admin-mutations.mjs";
|
|
@@ -17,6 +19,8 @@ const handlers = [
|
|
|
17
19
|
...adminGiftHandlers,
|
|
18
20
|
...adminEnrollmentHandlers,
|
|
19
21
|
...adminNodeDiagnosticsHandlers,
|
|
22
|
+
...adminBenchmarkHandlers,
|
|
23
|
+
...adminFleetHandlers,
|
|
20
24
|
...adminNodeLifecycleHandlers,
|
|
21
25
|
...adminNodeSanitizeHandlers,
|
|
22
26
|
];
|
|
@@ -29,11 +33,13 @@ function commandParts(capability) {
|
|
|
29
33
|
return capability.cli?.command ?? [];
|
|
30
34
|
}
|
|
31
35
|
function matchedAdminCapability(catalog, argv) {
|
|
32
|
-
|
|
36
|
+
const matches = catalog.filter((candidate) => {
|
|
33
37
|
if (candidate.cli?.vnext?.audience !== "admin") return false;
|
|
34
38
|
const command = commandParts(candidate).slice(1);
|
|
35
|
-
return command.
|
|
39
|
+
return command.every((part, index) => argv[index] === part);
|
|
36
40
|
});
|
|
41
|
+
matches.sort((left, right) => commandParts(right).length - commandParts(left).length);
|
|
42
|
+
return matches[0];
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
export function adminCommandName(catalog, argv) {
|