@ornncompute/cli 1.0.72 → 1.0.97
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 +55 -24
- package/package.json +4 -2
- package/src/admin-capacity-reservations.mjs +6 -13
- package/src/admin-command-handlers.mjs +2 -1
- package/src/admin-credits.mjs +1 -2
- package/src/admin-enrollment.mjs +22 -30
- package/src/admin-mutations.mjs +6 -56
- package/src/admin-node-diagnostics.mjs +3 -41
- package/src/admin-node-lifecycle.mjs +40 -160
- package/src/admin-node-sanitize.mjs +243 -0
- package/src/admin-shell.mjs +39 -32
- package/src/catalog-shell.mjs +6 -6
- package/src/evidence-commands.mjs +4 -6
- package/src/external-bucket-commands.mjs +76 -96
- package/src/interaction-runtime.mjs +5 -37
- package/src/kubernetes-commands.mjs +25 -183
- package/src/launch-mode-handlers.mjs +0 -1
- package/src/machine-reference.mjs +33 -56
- package/src/mount-commands.mjs +25 -131
- package/src/slurm-commands.mjs +13 -2
- package/src/storage-commands.mjs +2 -87
- package/src/vm-commands.mjs +48 -101
- package/vendor/api-client/commerce.js +743 -0
- package/vendor/capabilities/cli.js +7688 -7
- package/vendor/capabilities/capabilities/admin-capacity-reservations.js +0 -101
- package/vendor/capabilities/capabilities/admin-enrollment.js +0 -321
- package/vendor/capabilities/capabilities/admin-node-diagnostics.js +0 -88
- package/vendor/capabilities/capabilities/admin-nodes-lifecycle.js +0 -235
- package/vendor/capabilities/capabilities/admin.js +0 -91
- package/vendor/capabilities/capabilities/cli.js +0 -156
- package/vendor/capabilities/capabilities/clusters.js +0 -248
- package/vendor/capabilities/capabilities/commerce-market.js +0 -405
- package/vendor/capabilities/capabilities/compute.js +0 -523
- package/vendor/capabilities/capabilities/credits.js +0 -78
- package/vendor/capabilities/capabilities/evidence.js +0 -145
- package/vendor/capabilities/capabilities/external-buckets.js +0 -191
- package/vendor/capabilities/capabilities/fleet.js +0 -306
- package/vendor/capabilities/capabilities/identity.js +0 -129
- package/vendor/capabilities/capabilities/listings.js +0 -398
- package/vendor/capabilities/capabilities/locality.js +0 -42
- package/vendor/capabilities/capabilities/market-shared.js +0 -46
- package/vendor/capabilities/capabilities/markets.js +0 -482
- package/vendor/capabilities/capabilities/mounts.js +0 -176
- package/vendor/capabilities/capabilities/native-listing.js +0 -99
- package/vendor/capabilities/capabilities/networks.js +0 -1264
- package/vendor/capabilities/capabilities/observability.js +0 -218
- package/vendor/capabilities/capabilities/organization-invites.js +0 -53
- package/vendor/capabilities/capabilities/reservation-list.js +0 -68
- package/vendor/capabilities/capabilities/staff-shared.js +0 -64
- package/vendor/capabilities/capabilities/tokens.js +0 -165
- package/vendor/capabilities/capabilities/users.js +0 -159
- package/vendor/capabilities/capabilities/volumes.js +0 -178
- package/vendor/capabilities/capability.js +0 -99
- package/vendor/capabilities/cli-catalog.js +0 -73
- package/vendor/capabilities/cli-migrations.js +0 -264
- package/vendor/capabilities/names.js +0 -6
- package/vendor/capabilities/software-catalog.js +0 -82
- package/vendor/capabilities/spec-catalog.js +0 -151
- package/vendor/capabilities/supplier-directory.js +0 -20
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { defineCapability } from "../capability.js";
|
|
3
|
-
const nodeReference = z.string().trim().min(1);
|
|
4
|
-
const optionalText = z.string().trim().min(1).optional();
|
|
5
|
-
const commonInput = {
|
|
6
|
-
node_ref: nodeReference,
|
|
7
|
-
node_id: optionalText,
|
|
8
|
-
idempotency_key: optionalText,
|
|
9
|
-
reason: optionalText,
|
|
10
|
-
yes: z.boolean().optional(),
|
|
11
|
-
wait: z.boolean().optional(),
|
|
12
|
-
timeout_seconds: z.number().positive().optional(),
|
|
13
|
-
};
|
|
14
|
-
const rebootInput = z.object({
|
|
15
|
-
...commonInput,
|
|
16
|
-
machine_id: optionalText,
|
|
17
|
-
});
|
|
18
|
-
const hardResetInput = rebootInput.extend({
|
|
19
|
-
erase_local_data: z.literal(true),
|
|
20
|
-
});
|
|
21
|
-
const terminationInput = z.object({
|
|
22
|
-
...commonInput,
|
|
23
|
-
delete_node_record: z.literal(true),
|
|
24
|
-
skip_cleanup: z.boolean().optional(),
|
|
25
|
-
});
|
|
26
|
-
const assignmentInput = z.object({
|
|
27
|
-
...commonInput,
|
|
28
|
-
reservation_id: z.string().trim().min(1),
|
|
29
|
-
});
|
|
30
|
-
const managementInput = z.object(commonInput);
|
|
31
|
-
function adminLifecycleHelp(command, outcome, human, automation, review) {
|
|
32
|
-
return {
|
|
33
|
-
audience: "admin",
|
|
34
|
-
category: "resource",
|
|
35
|
-
command,
|
|
36
|
-
outcome,
|
|
37
|
-
human,
|
|
38
|
-
automation,
|
|
39
|
-
acceptedReferences: ["canonical node ID", "exact unique node hostname in an eligible terminal"],
|
|
40
|
-
review,
|
|
41
|
-
resumableStates: ["accepted", "pending", "timed out", "interrupted"],
|
|
42
|
-
related: ["admin nodes health", "admin nodes list"],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function nodeId(input) {
|
|
46
|
-
if (!input.node_id)
|
|
47
|
-
throw new Error("The lifecycle target must be resolved before execution.");
|
|
48
|
-
return input.node_id;
|
|
49
|
-
}
|
|
50
|
-
function requestHeaders(idempotencyKey) {
|
|
51
|
-
return idempotencyKey ? { "Idempotency-Key": idempotencyKey } : undefined;
|
|
52
|
-
}
|
|
53
|
-
function preview(action, payload) {
|
|
54
|
-
return { ok: true, action, payload };
|
|
55
|
-
}
|
|
56
|
-
async function reboot(ctx, input, mode) {
|
|
57
|
-
const parsed = mode === "hard_reset" ? hardResetInput.parse(input) : rebootInput.parse(input);
|
|
58
|
-
const payload = {
|
|
59
|
-
node_id: parsed.node_id,
|
|
60
|
-
machine_id: parsed.machine_id,
|
|
61
|
-
mode,
|
|
62
|
-
...(mode === "hard_reset" ? { erase_local_data: true } : {}),
|
|
63
|
-
};
|
|
64
|
-
if (!ctx.confirmed)
|
|
65
|
-
return preview(`nodes.${mode}`, payload);
|
|
66
|
-
if (!parsed.machine_id)
|
|
67
|
-
throw new Error("The live machine target must be resolved before reboot.");
|
|
68
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(parsed.machine_id)}/reboot`, {
|
|
69
|
-
method: "POST",
|
|
70
|
-
body: {
|
|
71
|
-
mode,
|
|
72
|
-
...(parsed.idempotency_key ? { request_id: parsed.idempotency_key } : {}),
|
|
73
|
-
},
|
|
74
|
-
headers: requestHeaders(parsed.idempotency_key),
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
export const adminNodeRebootCapability = defineCapability({
|
|
78
|
-
id: "nodes.reboot",
|
|
79
|
-
domain: "fleet",
|
|
80
|
-
roles: ["admin"],
|
|
81
|
-
description: "Reboot the exact live machine backing one managed node after a normalized review.",
|
|
82
|
-
mutation: "preview-confirm",
|
|
83
|
-
http: { method: "POST", path: "/nodes/{id}/reboot" },
|
|
84
|
-
cli: {
|
|
85
|
-
command: ["admin", "nodes", "reboot"],
|
|
86
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "reboot"], "Reboot one exact live machine while preserving local data and access configuration.", "ornn admin nodes reboot <node-ref> [--yes] [--no-wait] [--timeout SECONDS]", "Unsupported: reboot requires an eligible human terminal.", "Node and live-machine identities, supplier, facility, capacity assignment, and preserved access."),
|
|
87
|
-
},
|
|
88
|
-
mcp: false,
|
|
89
|
-
slack: false,
|
|
90
|
-
input: rebootInput,
|
|
91
|
-
execute: (ctx, input) => reboot(ctx, input, "reboot"),
|
|
92
|
-
});
|
|
93
|
-
export const adminNodeHardResetCapability = defineCapability({
|
|
94
|
-
id: "nodes.hard_reset",
|
|
95
|
-
domain: "fleet",
|
|
96
|
-
roles: ["admin"],
|
|
97
|
-
description: "Hard reset the exact live machine backing one node with explicit local-data erasure scope.",
|
|
98
|
-
mutation: "preview-confirm",
|
|
99
|
-
http: { method: "POST", path: "/nodes/{id}/reboot" },
|
|
100
|
-
cli: {
|
|
101
|
-
command: ["admin", "nodes", "hard-reset"],
|
|
102
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "hard-reset"], "Erase local tenant data and hard reset one exact live machine.", "ornn admin nodes hard-reset <node-ref> --erase-local-data [--yes] [--no-wait] [--timeout SECONDS]", "Unsupported: hard reset requires an eligible human terminal.", "Node and live-machine identities, supplier, facility, capacity assignment, erased local data, and restored keys."),
|
|
103
|
-
},
|
|
104
|
-
mcp: false,
|
|
105
|
-
slack: false,
|
|
106
|
-
input: hardResetInput,
|
|
107
|
-
execute: (ctx, input) => reboot(ctx, input, "hard_reset"),
|
|
108
|
-
});
|
|
109
|
-
export const adminNodeSuspendManagementCapability = defineCapability({
|
|
110
|
-
id: "nodes.suspend_management",
|
|
111
|
-
domain: "fleet",
|
|
112
|
-
roles: ["admin"],
|
|
113
|
-
description: "Suspend Ornn management while leaving the exact host powered on.",
|
|
114
|
-
mutation: "preview-confirm",
|
|
115
|
-
http: { method: "POST", path: "/nodes/{id}/off-grid" },
|
|
116
|
-
cli: {
|
|
117
|
-
command: ["admin", "nodes", "suspend-management"],
|
|
118
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "suspend-management"], "Remove Ornn management and managed access from one powered-on node.", "ornn admin nodes suspend-management <node-ref> [--reason TEXT] [--yes] [--no-wait]", "ornn admin nodes suspend-management <node-id> --yes --idempotency-key KEY --format json", "Node, supplier, facility, capacity assignment, management removal, and managed-access loss."),
|
|
119
|
-
},
|
|
120
|
-
mcp: false,
|
|
121
|
-
slack: false,
|
|
122
|
-
input: managementInput,
|
|
123
|
-
execute: async (ctx, input) => {
|
|
124
|
-
const parsed = managementInput.parse(input);
|
|
125
|
-
const id = nodeId(parsed);
|
|
126
|
-
const body = {
|
|
127
|
-
...(parsed.idempotency_key ? { request_id: parsed.idempotency_key } : {}),
|
|
128
|
-
...(parsed.reason ? { reason: parsed.reason } : {}),
|
|
129
|
-
};
|
|
130
|
-
if (!ctx.confirmed)
|
|
131
|
-
return preview("nodes.suspend_management", { node_id: id, ...body });
|
|
132
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(id)}/off-grid`, {
|
|
133
|
-
method: "POST",
|
|
134
|
-
body,
|
|
135
|
-
headers: requestHeaders(parsed.idempotency_key),
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
export const adminNodeResumeManagementCapability = defineCapability({
|
|
140
|
-
id: "nodes.resume_management",
|
|
141
|
-
domain: "fleet",
|
|
142
|
-
roles: ["admin"],
|
|
143
|
-
description: "Resume Ornn management for one exact off-grid node.",
|
|
144
|
-
mutation: "preview-confirm",
|
|
145
|
-
http: { method: "POST", path: "/nodes/{id}/on-grid" },
|
|
146
|
-
cli: {
|
|
147
|
-
command: ["admin", "nodes", "resume-management"],
|
|
148
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "resume-management"], "Restore Ornn management and managed access on one off-grid node.", "ornn admin nodes resume-management <node-ref> [--yes] [--no-wait]", "ornn admin nodes resume-management <node-id> --yes --idempotency-key KEY --format json", "Node, supplier, facility, capacity assignment, remote re-enrollment, and restored managed access."),
|
|
149
|
-
},
|
|
150
|
-
mcp: false,
|
|
151
|
-
slack: false,
|
|
152
|
-
input: managementInput,
|
|
153
|
-
execute: async (ctx, input) => {
|
|
154
|
-
const parsed = managementInput.parse(input);
|
|
155
|
-
const id = nodeId(parsed);
|
|
156
|
-
if (!ctx.confirmed)
|
|
157
|
-
return preview("nodes.resume_management", { node_id: id });
|
|
158
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(id)}/on-grid`, {
|
|
159
|
-
method: "POST",
|
|
160
|
-
body: {
|
|
161
|
-
...(parsed.idempotency_key ? { request_id: parsed.idempotency_key } : {}),
|
|
162
|
-
},
|
|
163
|
-
headers: requestHeaders(parsed.idempotency_key),
|
|
164
|
-
});
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
export const adminNodeTerminateCapability = defineCapability({
|
|
168
|
-
id: "nodes.terminate",
|
|
169
|
-
domain: "fleet",
|
|
170
|
-
roles: ["admin"],
|
|
171
|
-
description: "Delete one exact node record with explicit cleanup scope and consequence review.",
|
|
172
|
-
mutation: "preview-confirm",
|
|
173
|
-
http: { method: "POST", path: "/nodes/{id}/terminate" },
|
|
174
|
-
cli: {
|
|
175
|
-
command: ["admin", "nodes", "terminate"],
|
|
176
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "terminate"], "End managed access and permanently delete one exact node record.", "ornn admin nodes terminate <node-ref> --delete-node-record [--skip-cleanup] [--reason TEXT] [--yes]", "ornn admin nodes terminate <node-id> --delete-node-record --yes --idempotency-key KEY --format json", "Node, supplier, facility, reservation/capacity, host cleanup, node-record deletion, and access loss."),
|
|
177
|
-
},
|
|
178
|
-
mcp: false,
|
|
179
|
-
slack: false,
|
|
180
|
-
input: terminationInput,
|
|
181
|
-
execute: async (ctx, input) => {
|
|
182
|
-
const parsed = terminationInput.parse(input);
|
|
183
|
-
const id = nodeId(parsed);
|
|
184
|
-
const body = {
|
|
185
|
-
force: parsed.skip_cleanup === true,
|
|
186
|
-
...(parsed.idempotency_key ? { request_id: parsed.idempotency_key } : {}),
|
|
187
|
-
...(parsed.reason ? { reason: parsed.reason } : {}),
|
|
188
|
-
};
|
|
189
|
-
if (!ctx.confirmed)
|
|
190
|
-
return preview("nodes.terminate", { node_id: id, ...body });
|
|
191
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(id)}/terminate`, {
|
|
192
|
-
method: "POST",
|
|
193
|
-
body,
|
|
194
|
-
headers: requestHeaders(parsed.idempotency_key),
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
export const adminNodeAssignCapability = defineCapability({
|
|
199
|
-
id: "nodes.assign",
|
|
200
|
-
domain: "fleet",
|
|
201
|
-
roles: ["admin"],
|
|
202
|
-
description: "Assign one exact node to one exact capacity reservation after consequence review.",
|
|
203
|
-
mutation: "preview-confirm",
|
|
204
|
-
http: { method: "POST", path: "/nodes/{id}/assign" },
|
|
205
|
-
cli: {
|
|
206
|
-
command: ["admin", "nodes", "assign"],
|
|
207
|
-
vnext: adminLifecycleHelp(["admin", "nodes", "assign"], "Assign one exact node to one exact capacity reservation.", "ornn admin nodes assign <node-ref> --reservation <reservation-id> [--yes] [--no-wait]", "ornn admin nodes assign <node-id> --reservation <reservation-id> --yes --idempotency-key KEY --format json", "Node, supplier, facility, previous and requested capacity assignments, and tenant access change."),
|
|
208
|
-
},
|
|
209
|
-
mcp: false,
|
|
210
|
-
slack: false,
|
|
211
|
-
input: assignmentInput,
|
|
212
|
-
execute: async (ctx, input) => {
|
|
213
|
-
const parsed = assignmentInput.parse(input);
|
|
214
|
-
const id = nodeId(parsed);
|
|
215
|
-
const body = {
|
|
216
|
-
reservation_id: parsed.reservation_id,
|
|
217
|
-
...(parsed.idempotency_key ? { request_id: parsed.idempotency_key } : {}),
|
|
218
|
-
};
|
|
219
|
-
if (!ctx.confirmed)
|
|
220
|
-
return preview("nodes.assign", { node_id: id, ...body });
|
|
221
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(id)}/assign`, {
|
|
222
|
-
method: "POST",
|
|
223
|
-
body,
|
|
224
|
-
headers: requestHeaders(parsed.idempotency_key),
|
|
225
|
-
});
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
export const adminNodeLifecycleCapabilities = [
|
|
229
|
-
adminNodeRebootCapability,
|
|
230
|
-
adminNodeHardResetCapability,
|
|
231
|
-
adminNodeSuspendManagementCapability,
|
|
232
|
-
adminNodeResumeManagementCapability,
|
|
233
|
-
adminNodeTerminateCapability,
|
|
234
|
-
adminNodeAssignCapability,
|
|
235
|
-
];
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { defineCapability } from "../capability.js";
|
|
3
|
-
import { listFacilitiesCapability, listNodesCapability, listSuppliersCapability } from "./fleet.js";
|
|
4
|
-
import { logsLatestCapability, telemetryLatestCapability } from "./observability.js";
|
|
5
|
-
import { tokensListCapability } from "./tokens.js";
|
|
6
|
-
import { organizationListCapability, usersListCapability } from "./users.js";
|
|
7
|
-
export const ADMIN_CLI_ROOTS = [
|
|
8
|
-
{ name: "users" },
|
|
9
|
-
{ name: "organizations" },
|
|
10
|
-
{ name: "suppliers" },
|
|
11
|
-
{ name: "facilities" },
|
|
12
|
-
{ name: "nodes" },
|
|
13
|
-
{ name: "enrollment-tokens" },
|
|
14
|
-
{ name: "capacity-offers" },
|
|
15
|
-
{ name: "reservations" },
|
|
16
|
-
];
|
|
17
|
-
function adminHelp(command, outcome, human, automation, acceptedReferences = []) {
|
|
18
|
-
return {
|
|
19
|
-
audience: "admin",
|
|
20
|
-
category: "resource",
|
|
21
|
-
command,
|
|
22
|
-
outcome,
|
|
23
|
-
human,
|
|
24
|
-
automation,
|
|
25
|
-
acceptedReferences,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function withAdminBinding(capability, help) {
|
|
29
|
-
if (!help.command)
|
|
30
|
-
throw new Error(`${capability.id} requires a canonical CLI command`);
|
|
31
|
-
return {
|
|
32
|
-
...capability,
|
|
33
|
-
cli: {
|
|
34
|
-
command: [...help.command],
|
|
35
|
-
vnext: help,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export const adminUsersListCapability = withAdminBinding(usersListCapability, adminHelp(["admin", "users", "list"], "List users belonging to organizations in the Authorization directory.", "ornn admin users list [--query QUERY] [--organization UUID] [--limit 25] [--offset OFFSET] [--cursor CURSOR]", "ornn admin users list --query QUERY --limit 25 [--cursor CURSOR] --format json"));
|
|
40
|
-
export const adminOrganizationsListCapability = withAdminBinding(organizationListCapability, adminHelp(["admin", "organizations", "list"], "List organizations in the Authorization directory.", "ornn admin organizations list [--query QUERY] [--role consumer|supplier] [--approved true|false] [--ids UUID,...] [--limit 25] [--offset OFFSET] [--cursor CURSOR]", "ornn admin organizations list --query QUERY --limit 25 [--cursor CURSOR] --format json"));
|
|
41
|
-
export const adminSuppliersListCapability = withAdminBinding(listSuppliersCapability, adminHelp(["admin", "suppliers", "list"], "List supplier organizations visible to staff.", "ornn admin suppliers list [--limit 50] [--cursor CURSOR]", "ornn admin suppliers list --limit 50 --format json"));
|
|
42
|
-
export const adminFacilitiesListCapability = withAdminBinding(listFacilitiesCapability, adminHelp(["admin", "facilities", "list"], "List facilities visible to staff.", "ornn admin facilities list [--supplier UUID] [--limit 50] [--cursor CURSOR]", "ornn admin facilities list --limit 50 --format json"));
|
|
43
|
-
export const adminNodesListCapability = withAdminBinding(listNodesCapability, adminHelp(["admin", "nodes", "list"], "List enrolled, ghost, and off-grid nodes.", "ornn admin nodes list [--supplier UUID] [--facility FACILITY] [--status STATUS] [--reservation UUID] [--limit 50] [--cursor CURSOR]", "ornn admin nodes list --limit 50 [--cursor CURSOR] --format json"));
|
|
44
|
-
const nodeInput = z.object({ node_id: z.string().min(1) });
|
|
45
|
-
export const adminNodeHealthCapability = defineCapability({
|
|
46
|
-
id: "nodes.health",
|
|
47
|
-
domain: "fleet",
|
|
48
|
-
roles: ["admin"],
|
|
49
|
-
description: "Read lifecycle and readiness facts for one enrolled node.",
|
|
50
|
-
mutation: "read",
|
|
51
|
-
http: { method: "GET", path: "/nodes/{id}" },
|
|
52
|
-
cli: {
|
|
53
|
-
command: ["admin", "nodes", "health"],
|
|
54
|
-
vnext: adminHelp(["admin", "nodes", "health"], "Inspect lifecycle and readiness facts for one node.", "ornn admin nodes health <node-id>", "ornn admin nodes health <node-id> --format json", ["canonical node ID"]),
|
|
55
|
-
},
|
|
56
|
-
mcp: false,
|
|
57
|
-
slack: false,
|
|
58
|
-
input: nodeInput,
|
|
59
|
-
execute: async (ctx, input) => {
|
|
60
|
-
const parsed = nodeInput.parse(input);
|
|
61
|
-
return ctx.fetch(`/nodes/${encodeURIComponent(parsed.node_id)}`, { method: "GET" });
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
export const adminNodeMetricsCapability = withAdminBinding(telemetryLatestCapability, adminHelp(["admin", "nodes", "metrics"], "Read a bounded telemetry window for one node.", "ornn admin nodes metrics <node-id> [--span 15m] [--start TIME --end TIME] [--max-points 240]", "ornn admin nodes metrics <node-id> --span 15m [--start TIME --end TIME] --max-points 240 --format json", ["canonical node ID"]));
|
|
65
|
-
export const adminNodeLogsCapability = withAdminBinding(logsLatestCapability, adminHelp(["admin", "nodes", "logs"], "Read one bounded node log page.", "ornn admin nodes logs <node-id> [--stream kernel|serial] [--count 200] [--before TIME] [--cursor CURSOR]", "ornn admin nodes logs <node-id> --stream kernel --count 200 [--before TIME] [--cursor CURSOR] --format json", ["canonical node ID"]));
|
|
66
|
-
export const adminEnrollmentTokensListCapability = withAdminBinding(tokensListCapability, adminHelp(["admin", "enrollment-tokens", "list"], "List enrollment-token metadata without token bytes.", "ornn admin enrollment-tokens list [--limit 50] [--cursor CURSOR]", "ornn admin enrollment-tokens list --limit 50 --format json"));
|
|
67
|
-
export const adminCapabilities = [
|
|
68
|
-
adminUsersListCapability,
|
|
69
|
-
adminOrganizationsListCapability,
|
|
70
|
-
adminSuppliersListCapability,
|
|
71
|
-
adminFacilitiesListCapability,
|
|
72
|
-
adminNodesListCapability,
|
|
73
|
-
adminNodeHealthCapability,
|
|
74
|
-
adminNodeMetricsCapability,
|
|
75
|
-
adminNodeLogsCapability,
|
|
76
|
-
adminEnrollmentTokensListCapability,
|
|
77
|
-
];
|
|
78
|
-
const replacements = {
|
|
79
|
-
"facilities.list": adminFacilitiesListCapability,
|
|
80
|
-
"logs.latest": adminNodeLogsCapability,
|
|
81
|
-
"nodes.list": adminNodesListCapability,
|
|
82
|
-
"supplier.list": adminSuppliersListCapability,
|
|
83
|
-
"telemetry.latest": adminNodeMetricsCapability,
|
|
84
|
-
"tokens.list": adminEnrollmentTokensListCapability,
|
|
85
|
-
"users.list": adminUsersListCapability,
|
|
86
|
-
"organization.list": adminOrganizationsListCapability,
|
|
87
|
-
};
|
|
88
|
-
/** Applies canonical admin CLI bindings without changing MCP or Slack identities. */
|
|
89
|
-
export function bindAdminCapabilities(capabilities) {
|
|
90
|
-
return capabilities.map((capability) => replacements[capability.id] ?? capability);
|
|
91
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { defineCapability } from "../capability.js";
|
|
3
|
-
export const CLI_MACHINE_SCHEMA = "ornn.cli/v1";
|
|
4
|
-
const emptyInput = z.object({});
|
|
5
|
-
function requireCliRuntime(context) {
|
|
6
|
-
if (!context.cli) {
|
|
7
|
-
throw new Error("This capability must execute through the Ornn CLI runtime.");
|
|
8
|
-
}
|
|
9
|
-
return context.cli;
|
|
10
|
-
}
|
|
11
|
-
const updateInput = z.object({
|
|
12
|
-
$positionals: z.array(z.string()).max(0).default([]),
|
|
13
|
-
major: z.boolean().optional(),
|
|
14
|
-
});
|
|
15
|
-
const completionInput = z
|
|
16
|
-
.object({
|
|
17
|
-
$positionals: z.tuple([z.enum(["bash", "fish", "zsh"])]),
|
|
18
|
-
})
|
|
19
|
-
.transform(({ $positionals }) => ({ shell: $positionals[0] }));
|
|
20
|
-
export const versionCapability = defineCapability({
|
|
21
|
-
id: "cli.version",
|
|
22
|
-
domain: "cli",
|
|
23
|
-
roles: ["user"],
|
|
24
|
-
description: "Show the CLI version and machine-output contract.",
|
|
25
|
-
mutation: "local",
|
|
26
|
-
input: emptyInput,
|
|
27
|
-
cli: {
|
|
28
|
-
command: ["version"],
|
|
29
|
-
vnext: {
|
|
30
|
-
audience: "customer",
|
|
31
|
-
category: "platform",
|
|
32
|
-
outcome: "Identify the installed CLI and its machine-output contract.",
|
|
33
|
-
human: "ornn version",
|
|
34
|
-
automation: "ornn version --format json",
|
|
35
|
-
related: ["status", "resources"],
|
|
36
|
-
order: 20,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
mcp: false,
|
|
40
|
-
slack: false,
|
|
41
|
-
execute: async (context) => {
|
|
42
|
-
const runtime = requireCliRuntime(context);
|
|
43
|
-
return {
|
|
44
|
-
version: runtime.version,
|
|
45
|
-
machine_schema: runtime.machineSchema,
|
|
46
|
-
update_channel: runtime.updateChannel,
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
export const updateCapability = defineCapability({
|
|
51
|
-
id: "cli.update",
|
|
52
|
-
domain: "cli",
|
|
53
|
-
roles: ["user"],
|
|
54
|
-
description: "Update the installed CLI through its detected package manager.",
|
|
55
|
-
mutation: "local",
|
|
56
|
-
input: updateInput,
|
|
57
|
-
cli: {
|
|
58
|
-
command: ["update"],
|
|
59
|
-
vnext: {
|
|
60
|
-
arguments: "semantic",
|
|
61
|
-
audience: "customer",
|
|
62
|
-
category: "platform",
|
|
63
|
-
outcome: "Update the installed CLI with explicit acknowledgement for a major crossing.",
|
|
64
|
-
human: "ornn update [--major]",
|
|
65
|
-
automation: "ornn update --format human [--major]",
|
|
66
|
-
related: ["version"],
|
|
67
|
-
order: 25,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
mcp: false,
|
|
71
|
-
slack: false,
|
|
72
|
-
execute: async (context, input) => {
|
|
73
|
-
const runtime = requireCliRuntime(context);
|
|
74
|
-
if (!runtime.update) {
|
|
75
|
-
throw new Error("This capability must execute through the Ornn CLI update runtime.");
|
|
76
|
-
}
|
|
77
|
-
return runtime.update(input);
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
export const completionCapability = defineCapability({
|
|
81
|
-
id: "cli.completion",
|
|
82
|
-
domain: "cli",
|
|
83
|
-
roles: ["user"],
|
|
84
|
-
description: "Generate shell completion from canonical catalog commands.",
|
|
85
|
-
mutation: "local",
|
|
86
|
-
input: completionInput,
|
|
87
|
-
cli: {
|
|
88
|
-
command: ["completion"],
|
|
89
|
-
vnext: {
|
|
90
|
-
arguments: "semantic",
|
|
91
|
-
audience: "customer",
|
|
92
|
-
category: "platform",
|
|
93
|
-
outcome: "Generate bash, fish, or zsh completion from the canonical command catalog.",
|
|
94
|
-
human: "ornn completion <bash|fish|zsh> --format human",
|
|
95
|
-
automation: "ornn completion <bash|fish|zsh> --format json",
|
|
96
|
-
related: ["resources"],
|
|
97
|
-
order: 27,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
mcp: false,
|
|
101
|
-
slack: false,
|
|
102
|
-
execute: async (context, input) => {
|
|
103
|
-
const runtime = requireCliRuntime(context);
|
|
104
|
-
if (!runtime.completion) {
|
|
105
|
-
throw new Error("This capability must execute through the Ornn CLI completion runtime.");
|
|
106
|
-
}
|
|
107
|
-
return runtime.completion(input);
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
export const resourcesCapability = defineCapability({
|
|
111
|
-
id: "cli.resources",
|
|
112
|
-
domain: "cli",
|
|
113
|
-
roles: ["user"],
|
|
114
|
-
description: "List registered advanced customer resource commands.",
|
|
115
|
-
mutation: "local",
|
|
116
|
-
input: emptyInput,
|
|
117
|
-
cli: {
|
|
118
|
-
command: ["resources"],
|
|
119
|
-
vnext: {
|
|
120
|
-
audience: "customer",
|
|
121
|
-
category: "platform",
|
|
122
|
-
outcome: "Discover advanced customer resource commands without dispatching a generic request.",
|
|
123
|
-
human: "ornn resources",
|
|
124
|
-
automation: "ornn resources --format json",
|
|
125
|
-
related: ["status", "version"],
|
|
126
|
-
order: 30,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
mcp: false,
|
|
130
|
-
slack: false,
|
|
131
|
-
execute: async (context) => {
|
|
132
|
-
const runtime = requireCliRuntime(context);
|
|
133
|
-
const resources = [];
|
|
134
|
-
for (const capability of runtime.catalog) {
|
|
135
|
-
const binding = capability.cli;
|
|
136
|
-
const help = binding?.vnext;
|
|
137
|
-
if (!binding || help?.audience !== "customer" || help.category !== "resource") {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
resources.push({
|
|
141
|
-
command: binding.command.join(" "),
|
|
142
|
-
outcome: help.outcome,
|
|
143
|
-
human: help.human,
|
|
144
|
-
automation: help.automation,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
resources.sort((left, right) => left.command.localeCompare(right.command));
|
|
148
|
-
return { resources };
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
export const cliShellCapabilities = [
|
|
152
|
-
versionCapability,
|
|
153
|
-
updateCapability,
|
|
154
|
-
completionCapability,
|
|
155
|
-
resourcesCapability,
|
|
156
|
-
];
|