@ornncompute/cli 1.0.137 → 1.0.138

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.
@@ -7,43 +7,60 @@ function getHardwareCatalog(request, signal) {
7
7
  });
8
8
  }
9
9
 
10
- // ../../packages/api-client/dist/orchestrator/locality.js
11
- var localityGeolocatePath = "/v1/orchestrator/locality/geolocate";
12
- function geolocate(request, query3, signal) {
13
- const target = query3.ip !== void 0 ? `ip=${encodeURIComponent(query3.ip)}` : `address=${encodeURIComponent(query3.address)}`;
14
- return request(`${localityGeolocatePath}?${target}`, {
15
- method: "GET",
16
- ...signal ? { signal } : {}
10
+ // ../../packages/api-client/dist/orchestrator/configurable-enrollment.js
11
+ var root = "/v1/orchestrator/enrollment/configurable";
12
+ function createEnrollmentRun(request, body2) {
13
+ return request(`${root}/runs`, { method: "POST", body: body2 });
14
+ }
15
+ function launchEnrollmentRun(request, id, body2) {
16
+ return request(`${root}/runs/${encodeURIComponent(id)}/launch`, {
17
+ method: "POST",
18
+ body: body2
17
19
  });
18
20
  }
19
21
 
20
- // ../../packages/api-client/dist/orchestrator/registry.js
21
- function getContainerRegistry(request) {
22
- return request("/v1/orchestrator/registry", { method: "GET" });
22
+ // ../../packages/api-client/dist/orchestrator/controllers.js
23
+ var controllersSocketPath = "/v1/orchestrator/controllers";
24
+ function controllerPath(id) {
25
+ return `${controllersSocketPath}/${encodeURIComponent(id)}`;
23
26
  }
24
- function listRegistryRepositories(request) {
25
- return request("/v1/orchestrator/registry/repositories", { method: "GET" });
27
+ function createController(request, body2, options) {
28
+ return request(controllersSocketPath, {
29
+ ...options,
30
+ method: "POST",
31
+ body: body2
32
+ });
26
33
  }
27
- function listRegistryTags(request, repository) {
28
- return request(`/v1/orchestrator/registry/tags?${new URLSearchParams({ repository })}`, {
29
- method: "GET"
34
+ function addControllerNode(request, id, nodeId3, options) {
35
+ return request(`${controllerPath(id)}/nodes/${encodeURIComponent(nodeId3)}`, {
36
+ ...options,
37
+ method: "POST"
30
38
  });
31
39
  }
32
- function getRegistryUsage(request) {
33
- return request("/v1/orchestrator/registry/usage", { method: "GET" });
40
+ function removeControllerNode(request, id, nodeId3, options) {
41
+ return request(`${controllerPath(id)}/nodes/${encodeURIComponent(nodeId3)}`, {
42
+ ...options,
43
+ method: "DELETE"
44
+ });
34
45
  }
35
- function listRegistryCaches(request, query3 = {}) {
46
+
47
+ // ../../packages/api-client/dist/orchestrator/drive-files.js
48
+ function drivePath(id) {
49
+ return `/v1/orchestrator/drives/${encodeURIComponent(id)}`;
50
+ }
51
+ function listDriveContents(request, id, query3 = {}, signal) {
36
52
  const params = new URLSearchParams();
37
- if (query3.controller_id !== void 0)
38
- params.set("controller_id", query3.controller_id);
39
- return request(`/v1/orchestrator/registry/caches${params.size ? `?${params}` : ""}`, {
40
- method: "GET"
53
+ for (const [key, value] of Object.entries(query3)) {
54
+ if (value !== void 0)
55
+ params.set(key, String(value));
56
+ }
57
+ return request(`${drivePath(id)}/contents${params.size ? `?${params}` : ""}`, {
58
+ method: "GET",
59
+ ...signal ? { signal } : {}
41
60
  });
42
61
  }
43
- function deleteRegistryTag(request, repository, tag) {
44
- return request(`/v1/orchestrator/registry/tags?${new URLSearchParams({ repository, tag })}`, {
45
- method: "DELETE"
46
- });
62
+ function clearDriveContents(request, id) {
63
+ return request(`${drivePath(id)}/contents`, { method: "DELETE" });
47
64
  }
48
65
 
49
66
  // ../../packages/api-client/dist/orchestrator/drives.js
@@ -94,82 +111,81 @@ function listStorageTargets(request, signal) {
94
111
  });
95
112
  }
96
113
 
97
- // ../../packages/api-client/dist/orchestrator/drive-files.js
98
- function drivePath(id) {
99
- return `/v1/orchestrator/drives/${encodeURIComponent(id)}`;
114
+ // ../../packages/api-client/dist/orchestrator/enrollment.js
115
+ var enrollmentTokensPath = "/v1/orchestrator/enrollment-tokens";
116
+ function listEnrollmentTokens(request, query3 = {}) {
117
+ return request(enrollmentTokensPath + (query3.id ? `?id=${encodeURIComponent(query3.id)}` : ""), {
118
+ method: "GET"
119
+ });
100
120
  }
101
- function listDriveContents(request, id, query3 = {}, signal) {
102
- const params = new URLSearchParams();
103
- for (const [key, value] of Object.entries(query3)) {
104
- if (value !== void 0)
105
- params.set(key, String(value));
106
- }
107
- return request(`${drivePath(id)}/contents${params.size ? `?${params}` : ""}`, {
108
- method: "GET",
109
- ...signal ? { signal } : {}
121
+ function revokeEnrollmentToken(request, id, idempotencyKey) {
122
+ return request(`${enrollmentTokensPath}/${encodeURIComponent(id)}`, {
123
+ method: "DELETE",
124
+ ...idempotencyKey ? { headers: { "Idempotency-Key": idempotencyKey } } : {}
110
125
  });
111
126
  }
112
- function clearDriveContents(request, id) {
113
- return request(`${drivePath(id)}/contents`, { method: "DELETE" });
127
+ function getEnrollmentAdminSshKey(request, nodeId3) {
128
+ return request(`/v1/orchestrator/enrollment/admin-ssh-key?node_id=${encodeURIComponent(nodeId3)}`, { method: "GET" });
114
129
  }
115
-
116
- // ../../packages/api-client/dist/orchestrator/nodes.js
117
- function nodeQuery(query3) {
118
- const params = new URLSearchParams();
119
- for (const [key, value] of Object.entries(query3)) {
120
- if (value !== void 0)
121
- params.set(key, String(value));
122
- }
123
- return params.size ? `?${params}` : "";
130
+ function rotateEnrollmentAdminSshKey(request, nodeId3) {
131
+ return request(`/v1/orchestrator/enrollment/admin-ssh-key?node_id=${encodeURIComponent(nodeId3)}`, { method: "POST" });
124
132
  }
125
- function listNodes(request, query3 = {}, signal) {
126
- return request(`/v1/orchestrator/nodes${nodeQuery(query3)}`, {
133
+
134
+ // ../../packages/api-client/dist/orchestrator/locality.js
135
+ var localityGeolocatePath = "/v1/orchestrator/locality/geolocate";
136
+ function geolocate(request, query3, signal) {
137
+ const target = query3.ip !== void 0 ? `ip=${encodeURIComponent(query3.ip)}` : `address=${encodeURIComponent(query3.address)}`;
138
+ return request(`${localityGeolocatePath}?${target}`, {
127
139
  method: "GET",
128
140
  ...signal ? { signal } : {}
129
141
  });
130
142
  }
131
- function listStaffNodes(request, query3 = {}, signal) {
132
- return request(`/v1/staff/nodes${nodeQuery(query3)}`, {
143
+
144
+ // ../../packages/api-client/dist/orchestrator/networks.js
145
+ var networks = "/v1/orchestrator/networks";
146
+ function networkPath(id) {
147
+ return `${networks}/${encodeURIComponent(id)}`;
148
+ }
149
+ function listNetworks(request, signal) {
150
+ return request(networks, { method: "GET", ...signal ? { signal } : {} });
151
+ }
152
+ function getNetwork(request, id, query3 = {}, signal) {
153
+ const params = new URLSearchParams();
154
+ if (query3.overlay !== void 0)
155
+ params.set("overlay", String(query3.overlay));
156
+ return request(`${networkPath(id)}${params.size ? `?${params}` : ""}`, {
133
157
  method: "GET",
134
158
  ...signal ? { signal } : {}
135
159
  });
136
160
  }
137
- function nodeResourcePath(id) {
138
- return `/v1/orchestrator/nodes/${encodeURIComponent(id)}`;
161
+ function createNetwork(request, body2, options = {}) {
162
+ return request(networks, { method: "POST", body: body2, ...options });
139
163
  }
140
- function getNode(request, id, signal) {
141
- return request(nodeResourcePath(id), {
164
+ function updateNetwork(request, id, body2, options = {}) {
165
+ return request(networkPath(id), { method: "PATCH", body: body2, ...options });
166
+ }
167
+ function deleteNetwork(request, id, options = {}) {
168
+ return request(networkPath(id), { method: "DELETE", ...options });
169
+ }
170
+ function listNetworkPeerConfigs(request, networkId, signal) {
171
+ return request(`${networkPath(networkId)}/peers`, {
142
172
  method: "GET",
143
173
  ...signal ? { signal } : {}
144
174
  });
145
175
  }
146
- function terminateNode(request, id, body2, headers) {
147
- return request(`${nodeResourcePath(id)}/terminate`, {
148
- method: "POST",
149
- body: body2,
150
- ...headers ? { headers } : {}
151
- });
152
- }
153
- function assignNode(request, id, body2, headers) {
154
- return request(`${nodeResourcePath(id)}/assign`, {
176
+ function createNetworkPeer(request, networkId, body2, options = {}) {
177
+ return request(`${networkPath(networkId)}/peers`, {
155
178
  method: "POST",
156
179
  body: body2,
157
- ...headers ? { headers } : {}
180
+ ...options
158
181
  });
159
182
  }
160
- function issueNodeSshCertificate(request, id, body2) {
161
- return request(`${nodeResourcePath(id)}/ssh-certificates`, { method: "POST", body: body2 });
162
- }
163
- function rebootNode(request, id, body2, headers) {
164
- return request(`${nodeResourcePath(id)}/reboot`, {
165
- method: "POST",
166
- body: body2,
167
- ...headers ? { headers } : {}
183
+ function deleteNetworkPeer(request, networkId, peerId, options = {}) {
184
+ return request(`${networkPath(networkId)}/peers/${encodeURIComponent(peerId)}`, {
185
+ method: "DELETE",
186
+ ...options
168
187
  });
169
188
  }
170
- function pushNodeKeys(request, id, body2 = {}) {
171
- return request(`${nodeResourcePath(id)}/push-keys`, { method: "POST", body: body2 });
172
- }
173
189
 
174
190
  // ../../packages/api-client/dist/orchestrator/node-access.js
175
191
  function launchReservation(request, reservationId, body2) {
@@ -203,106 +219,91 @@ function updateNodeSanitize(request, nodeId3, jobId, body2) {
203
219
  return request(sanitizePath(nodeId3, jobId), { method: "PATCH", body: body2 });
204
220
  }
205
221
 
206
- // ../../packages/api-client/dist/orchestrator/networks.js
207
- var networks = "/v1/orchestrator/networks";
208
- function networkPath(id) {
209
- return `${networks}/${encodeURIComponent(id)}`;
210
- }
211
- function listNetworks(request, signal) {
212
- return request(networks, { method: "GET", ...signal ? { signal } : {} });
213
- }
214
- function getNetwork(request, id, query3 = {}, signal) {
222
+ // ../../packages/api-client/dist/orchestrator/nodes.js
223
+ function nodeQuery(query3) {
215
224
  const params = new URLSearchParams();
216
- if (query3.overlay !== void 0)
217
- params.set("overlay", String(query3.overlay));
218
- return request(`${networkPath(id)}${params.size ? `?${params}` : ""}`, {
225
+ for (const [key, value] of Object.entries(query3)) {
226
+ if (value !== void 0)
227
+ params.set(key, String(value));
228
+ }
229
+ return params.size ? `?${params}` : "";
230
+ }
231
+ function listNodes(request, query3 = {}, signal) {
232
+ return request(`/v1/orchestrator/nodes${nodeQuery(query3)}`, {
219
233
  method: "GET",
220
234
  ...signal ? { signal } : {}
221
235
  });
222
236
  }
223
- function createNetwork(request, body2, options = {}) {
224
- return request(networks, { method: "POST", body: body2, ...options });
225
- }
226
- function updateNetwork(request, id, body2, options = {}) {
227
- return request(networkPath(id), { method: "PATCH", body: body2, ...options });
237
+ function listStaffNodes(request, query3 = {}, signal) {
238
+ return request(`/v1/staff/nodes${nodeQuery(query3)}`, {
239
+ method: "GET",
240
+ ...signal ? { signal } : {}
241
+ });
228
242
  }
229
- function deleteNetwork(request, id, options = {}) {
230
- return request(networkPath(id), { method: "DELETE", ...options });
243
+ function nodeResourcePath(id) {
244
+ return `/v1/orchestrator/nodes/${encodeURIComponent(id)}`;
231
245
  }
232
- function listNetworkPeerConfigs(request, networkId, signal) {
233
- return request(`${networkPath(networkId)}/peers`, {
246
+ function getNode(request, id, signal) {
247
+ return request(nodeResourcePath(id), {
234
248
  method: "GET",
235
249
  ...signal ? { signal } : {}
236
250
  });
237
251
  }
238
- function createNetworkPeer(request, networkId, body2, options = {}) {
239
- return request(`${networkPath(networkId)}/peers`, {
252
+ function terminateNode(request, id, body2, headers) {
253
+ return request(`${nodeResourcePath(id)}/terminate`, {
240
254
  method: "POST",
241
255
  body: body2,
242
- ...options
256
+ ...headers ? { headers } : {}
243
257
  });
244
258
  }
245
- function deleteNetworkPeer(request, networkId, peerId, options = {}) {
246
- return request(`${networkPath(networkId)}/peers/${encodeURIComponent(peerId)}`, {
247
- method: "DELETE",
248
- ...options
259
+ function assignNode(request, id, body2, headers) {
260
+ return request(`${nodeResourcePath(id)}/assign`, {
261
+ method: "POST",
262
+ body: body2,
263
+ ...headers ? { headers } : {}
249
264
  });
250
265
  }
251
-
252
- // ../../packages/api-client/dist/orchestrator/controllers.js
253
- var controllersSocketPath = "/v1/orchestrator/controllers";
254
- function controllerPath(id) {
255
- return `${controllersSocketPath}/${encodeURIComponent(id)}`;
266
+ function issueNodeSshCertificate(request, id, body2) {
267
+ return request(`${nodeResourcePath(id)}/ssh-certificates`, { method: "POST", body: body2 });
256
268
  }
257
- function createController(request, body2, options) {
258
- return request(controllersSocketPath, {
259
- ...options,
269
+ function rebootNode(request, id, body2, headers) {
270
+ return request(`${nodeResourcePath(id)}/reboot`, {
260
271
  method: "POST",
261
- body: body2
262
- });
263
- }
264
- function addControllerNode(request, id, nodeId3, options) {
265
- return request(`${controllerPath(id)}/nodes/${encodeURIComponent(nodeId3)}`, {
266
- ...options,
267
- method: "POST"
272
+ body: body2,
273
+ ...headers ? { headers } : {}
268
274
  });
269
275
  }
270
- function removeControllerNode(request, id, nodeId3, options) {
271
- return request(`${controllerPath(id)}/nodes/${encodeURIComponent(nodeId3)}`, {
272
- ...options,
273
- method: "DELETE"
274
- });
276
+ function pushNodeKeys(request, id, body2 = {}) {
277
+ return request(`${nodeResourcePath(id)}/push-keys`, { method: "POST", body: body2 });
275
278
  }
276
279
 
277
- // ../../packages/api-client/dist/orchestrator/enrollment.js
278
- var enrollmentTokensPath = "/v1/orchestrator/enrollment-tokens";
279
- function listEnrollmentTokens(request, query3 = {}) {
280
- return request(enrollmentTokensPath + (query3.id ? `?id=${encodeURIComponent(query3.id)}` : ""), {
281
- method: "GET"
282
- });
280
+ // ../../packages/api-client/dist/orchestrator/registry.js
281
+ function getContainerRegistry(request) {
282
+ return request("/v1/orchestrator/registry", { method: "GET" });
283
283
  }
284
- function createEnrollmentToken(request, body2) {
285
- return request(enrollmentTokensPath, { method: "POST", body: body2 });
284
+ function listRegistryRepositories(request) {
285
+ return request("/v1/orchestrator/registry/repositories", { method: "GET" });
286
286
  }
287
- function revokeEnrollmentToken(request, id, idempotencyKey) {
288
- return request(`${enrollmentTokensPath}/${encodeURIComponent(id)}`, {
289
- method: "DELETE",
290
- ...idempotencyKey ? { headers: { "Idempotency-Key": idempotencyKey } } : {}
287
+ function listRegistryTags(request, repository) {
288
+ return request(`/v1/orchestrator/registry/tags?${new URLSearchParams({ repository })}`, {
289
+ method: "GET"
291
290
  });
292
291
  }
293
- function getEnrollmentAdminSshKey(request, nodeId3) {
294
- return request(`/v1/orchestrator/enrollment/admin-ssh-key?node_id=${encodeURIComponent(nodeId3)}`, { method: "GET" });
295
- }
296
- function rotateEnrollmentAdminSshKey(request, nodeId3) {
297
- return request(`/v1/orchestrator/enrollment/admin-ssh-key?node_id=${encodeURIComponent(nodeId3)}`, { method: "POST" });
292
+ function getRegistryUsage(request) {
293
+ return request("/v1/orchestrator/registry/usage", { method: "GET" });
298
294
  }
299
- function enrollmentInstallPath(query3) {
295
+ function listRegistryCaches(request, query3 = {}) {
300
296
  const params = new URLSearchParams();
301
- for (const [key, value] of Object.entries(query3)) {
302
- if (value !== void 0 && value !== false)
303
- params.set(key, String(value));
304
- }
305
- return `/v1/orchestrator/enrollment/install?${params}`;
297
+ if (query3.controller_id !== void 0)
298
+ params.set("controller_id", query3.controller_id);
299
+ return request(`/v1/orchestrator/registry/caches${params.size ? `?${params}` : ""}`, {
300
+ method: "GET"
301
+ });
302
+ }
303
+ function deleteRegistryTag(request, repository, tag) {
304
+ return request(`/v1/orchestrator/registry/tags?${new URLSearchParams({ repository, tag })}`, {
305
+ method: "DELETE"
306
+ });
306
307
  }
307
308
 
308
309
  // ../../packages/api-client/dist/orchestrator/remote.js
@@ -1138,43 +1139,17 @@ var observabilityCapabilities = [
1138
1139
 
1139
1140
  // ../../packages/capabilities/dist/capabilities/tokens.js
1140
1141
  import { z as z4 } from "zod";
1141
- var optionalText = z4.string().nullish();
1142
+ var emptyInput = z4.object({});
1142
1143
  var tokenCreateInput = z4.object({
1143
- organization_id: z4.string().min(1),
1144
- facility_id: optionalText,
1145
- expires_in_seconds: z4.number().int().positive().nullish(),
1146
- filter: z4.string().nullish(),
1147
- ip: optionalText,
1148
- installer_base: optionalText,
1149
- host: optionalText,
1150
- hosts: z4.array(z4.string()).nullish(),
1151
- username: optionalText,
1144
+ organization_id: z4.string().uuid(),
1145
+ profile_id: z4.string().uuid().optional(),
1146
+ expires_in_seconds: z4.number().int().min(300).max(86400).nullish(),
1147
+ host: z4.string().min(1).nullish(),
1148
+ hosts: z4.array(z4.string().min(1)).max(64).nullish(),
1149
+ username: z4.string().min(1).nullish(),
1152
1150
  port: z4.number().int().min(1).max(65535).nullish(),
1153
- private_key: optionalText,
1154
- yes: z4.boolean().optional()
1151
+ private_key: z4.string().min(1).nullish()
1155
1152
  });
1156
- var emptyInput = z4.object({});
1157
- function buildEnrollmentInstallCommand(options) {
1158
- const base3 = (options.base ?? "https://api.ornn.com/v1/orchestrator").replace(/\/+$/, "");
1159
- const path = enrollmentInstallPath({
1160
- token: options.token,
1161
- facility_id: options.facilityId,
1162
- filter: options.filter,
1163
- ip: options.ip,
1164
- restore_node_id: options.restoreNodeId,
1165
- force: options.force
1166
- });
1167
- const href = `${base3}${path.replace(/^\/v1\/orchestrator/, "")}`;
1168
- return `set -o pipefail; curl -fsSL '${href.replace(/'/g, "'\\''")}' | sudo bash`;
1169
- }
1170
- function tokenString(row, keys) {
1171
- for (const key of keys) {
1172
- const value = row[key];
1173
- if (typeof value === "string" && value.trim())
1174
- return value.trim();
1175
- }
1176
- return void 0;
1177
- }
1178
1153
  var tokensListCapability = defineCapability({
1179
1154
  id: "tokens.list",
1180
1155
  domain: "fleet",
@@ -1189,34 +1164,25 @@ var tokensCreateCapability = defineCapability({
1189
1164
  id: "tokens.create",
1190
1165
  domain: "fleet",
1191
1166
  roles: ["admin"],
1192
- description: "Admin-only. Mint an enrollment token. Without a host this returns the curl installer. With host + private_key, orchestrator SSHs and runs that curl (same as Bulk Enroll). Never invent a command. Slack waits for a human confirm. ",
1167
+ description: "Create a configurable enrollment command. With SSH hosts and a private key, create and launch a configurable run. The command carries its credential; never construct an installer command yourself.",
1193
1168
  mutation: "preview-confirm",
1194
1169
  slack: {
1195
1170
  parameters: {
1196
1171
  type: "object",
1197
1172
  properties: {
1198
- organization_id: {
1173
+ organization_id: { type: "string", description: "Supplier organization UUID." },
1174
+ profile_id: {
1199
1175
  type: "string",
1200
- description: "Supplier organization UUID from supplier.list."
1176
+ description: "Optional saved enrollment profile; omission uses standard configurable settings."
1201
1177
  },
1202
- facility_id: { type: "string", description: "Optional facility UUID." },
1203
- expires_in_seconds: { type: "integer", description: "Token TTL in seconds." },
1204
- filter: {
1205
- type: "string",
1206
- description: "Optional comma-separated enrollment compartment ids. Omit to run every step."
1207
- },
1208
- ip: { type: "string", description: "Optional IP stamped into the installer URL." },
1209
- host: { type: "string", description: "SSH host/IP to enroll now." },
1210
- hosts: {
1211
- type: "array",
1212
- items: { type: "string" },
1213
- description: "Optional extra SSH hosts to enroll with the same key."
1214
- },
1215
- username: { type: "string", description: "SSH user. Default admin." },
1216
- port: { type: "integer", description: "SSH port. Default 22." },
1178
+ expires_in_seconds: { type: "integer", description: "Command lifetime in seconds." },
1179
+ host: { type: "string", description: "SSH host to enroll." },
1180
+ hosts: { type: "array", items: { type: "string" }, description: "SSH hosts to enroll." },
1181
+ username: { type: "string", description: "SSH login; default admin." },
1182
+ port: { type: "integer", description: "SSH port; default 22." },
1217
1183
  private_key: {
1218
1184
  type: "string",
1219
- description: "PEM private key. Required to enroll over SSH."
1185
+ description: "SSH private key, required when hosts are supplied."
1220
1186
  }
1221
1187
  },
1222
1188
  required: ["organization_id"]
@@ -1225,59 +1191,29 @@ var tokensCreateCapability = defineCapability({
1225
1191
  input: tokenCreateInput,
1226
1192
  execute: async (ctx, input) => {
1227
1193
  const parsed = tokenCreateInput.parse(input);
1228
- const organizationId = parsed.organization_id.trim();
1229
- const hosts = [
1230
- ...parsed.host?.trim() ? [parsed.host.trim()] : [],
1231
- ...(parsed.hosts ?? []).map((host) => host.trim()).filter(Boolean)
1232
- ];
1233
- const privateKey = parsed.private_key?.trim() || "";
1234
- const payload = {
1235
- organization_id: organizationId,
1236
- facility_id: parsed.facility_id,
1237
- expires_in_seconds: parsed.expires_in_seconds,
1238
- filter: parsed.filter,
1239
- ip: parsed.ip,
1240
- hosts,
1241
- username: parsed.username?.trim() || "admin",
1242
- port: parsed.port ?? 22,
1243
- remote: hosts.length > 0 && privateKey.length > 0
1244
- };
1245
- if (!ctx.confirmed) {
1246
- return preview("tokens.create", { ...payload, private_key: privateKey ? "[redacted]" : "" });
1194
+ const hosts = [...parsed.host ? [parsed.host] : [], ...parsed.hosts ?? []];
1195
+ if (hosts.length > 64 || hosts.length > 0 && !parsed.private_key) {
1196
+ throw new Error("Provide at most 64 SSH hosts and a private key, or omit hosts to create a manual command.");
1247
1197
  }
1248
- const minted = await createEnrollmentToken(ctx.fetch, {
1249
- organization_id: organizationId,
1250
- ...payload.facility_id ? { facility_id: payload.facility_id } : {},
1251
- ...payload.expires_in_seconds ? { expires_in_seconds: payload.expires_in_seconds } : {}
1252
- });
1253
- const token = tokenString(minted, ["token", "plaintext"]) ?? "";
1254
- const installCommand = token ? buildEnrollmentInstallCommand({
1255
- token,
1256
- base: parsed.installer_base ?? void 0,
1257
- ip: parsed.ip ?? void 0,
1258
- filter: parsed.filter ?? void 0,
1259
- force: payload.remote
1260
- }) : null;
1261
- if (!payload.remote || !installCommand) {
1262
- return { ...minted, install_command: installCommand };
1263
- }
1264
- const results = [];
1265
- for (const host of hosts) {
1266
- results.push(await runRemote(ctx.fetch, {
1267
- host,
1268
- username: payload.username,
1269
- port: payload.port,
1270
- private_key: privateKey,
1271
- command: installCommand,
1272
- timeout_seconds: 600
1273
- }));
1274
- }
1275
- return {
1276
- id: minted.id,
1277
- organization_id: minted.organization_id ?? organizationId,
1278
- expires_at: minted.expires_at,
1279
- hosts: results
1198
+ const body2 = {
1199
+ organization_id: parsed.organization_id,
1200
+ label: "Host enrollment",
1201
+ ...parsed.profile_id ? { profile_id: parsed.profile_id } : {},
1202
+ ...parsed.expires_in_seconds ? { expires_in_seconds: parsed.expires_in_seconds } : {},
1203
+ ...hosts.length ? {
1204
+ hosts: hosts.map((address) => ({ address, port: parsed.port ?? 22 })),
1205
+ discover_access: true
1206
+ } : { discover_host: true }
1280
1207
  };
1208
+ if (!ctx.confirmed)
1209
+ return preview("tokens.create", body2);
1210
+ const run = await createEnrollmentRun(ctx.fetch, body2);
1211
+ if (hosts.length)
1212
+ await launchEnrollmentRun(ctx.fetch, run.id, {
1213
+ username: parsed.username ?? "admin",
1214
+ private_key: parsed.private_key
1215
+ });
1216
+ return run;
1281
1217
  }
1282
1218
  });
1283
1219
  var tokenCapabilities = [tokensListCapability, tokensCreateCapability];
@@ -1553,7 +1489,8 @@ function quoteBid(request, bid) {
1553
1489
  orderType: bid.orderType,
1554
1490
  pricePerGpuHourMicroUsd: bid.pricePerGpuHourMicroUsd === void 0 ? null : String(bid.pricePerGpuHourMicroUsd),
1555
1491
  nodeSelections: bid.nodeSelections ? JSON.stringify(bid.nodeSelections) : null,
1556
- ...scope(bid)
1492
+ ...scope(bid),
1493
+ organizationId: bid.organizationId
1557
1494
  })}`, { method: "GET" });
1558
1495
  }
1559
1496
  function placeBid(request, bid, idempotencyKey) {
@@ -2737,7 +2674,7 @@ var adminEnrollmentTokensListCapability2 = {
2737
2674
  };
2738
2675
  }
2739
2676
  };
2740
- var adminEnrollmentTokenCreateCapability = withVnextBinding(tokensCreateCapability, adminHelp3(["admin", "enrollment-tokens", "create"], "Create one expiring enrollment token through an explicit secret export.", "ornn admin enrollment-tokens create --supplier UUID --expires-in SECONDS (--print | --output PATH) [--overwrite] []", "Unsupported: token creation requires an eligible human terminal.", ["canonical supplier organization UUID"], "Review the supplier, expiry, and secret destination before minting the token."));
2677
+ var adminEnrollmentTokenCreateCapability = withVnextBinding(tokensCreateCapability, adminHelp3(["admin", "enrollment-tokens", "create"], "Create an expiring configurable enrollment command through an explicit secret export.", "ornn admin enrollment-tokens create --supplier UUID --expires-in SECONDS (--print | --output PATH) [--overwrite]", "Unsupported: token creation requires an eligible human terminal.", ["canonical supplier organization UUID"], "Review the supplier, expiry, and secret destination before creating the command."));
2741
2678
  var tokenRevokeInput = z12.object({
2742
2679
  tokenId: z12.string().min(1),
2743
2680
  token_id: UUID.optional(),
@@ -2831,29 +2768,13 @@ var nodeEnrollInput = z12.object({
2831
2768
  host: nonEmpty,
2832
2769
  organization_id: UUID,
2833
2770
  facility_id: UUID,
2834
- filter: z12.string().optional(),
2835
2771
  identity_file: nonEmpty,
2836
2772
  private_key: z12.string().min(1).optional(),
2837
2773
  username: nonEmpty.default("root"),
2838
2774
  port: z12.number().int().min(1).max(65535).default(22),
2839
2775
  expires_in_seconds: tokenTtl,
2840
- installer_base: nonEmpty.optional(),
2841
- replace_existing_management: z12.literal(true),
2842
- verbose: z12.boolean().default(false)
2776
+ replace_existing_management: z12.literal(true)
2843
2777
  });
2844
- function safeRemoteResult(value) {
2845
- if (!value || typeof value !== "object")
2846
- return {};
2847
- const row = value;
2848
- const safe = {};
2849
- for (const key of ["id", "status", "state", "exit_code", "started_at", "completed_at"]) {
2850
- const field = row[key];
2851
- if (typeof field === "string" || typeof field === "number" || typeof field === "boolean") {
2852
- safe[key] = field;
2853
- }
2854
- }
2855
- return safe;
2856
- }
2857
2778
  var adminNodeEnrollCapability = defineCapability({
2858
2779
  id: "nodes.enroll",
2859
2780
  domain: "fleet",
@@ -2862,7 +2783,7 @@ var adminNodeEnrollCapability = defineCapability({
2862
2783
  mutation: "preview-confirm",
2863
2784
  cli: {
2864
2785
  command: ["admin", "nodes", "enroll"],
2865
- vnext: adminHelp3(["admin", "nodes", "enroll"], "Install Ornn management on one explicitly assigned node.", "ornn admin nodes enroll <node-id> --host HOST --supplier UUID --facility UUID [--filter COMPARTMENT_IDS] --identity-file PATH --token-ttl SECONDS --replace-existing-management [--verbose] []", "Unsupported: remote enrollment requires an eligible human terminal.", ["canonical node UUID", "canonical supplier organization UUID", "canonical facility UUID"], "Review node identity, SSH target, assignment, compartment filter, and replacement of existing management.")
2786
+ vnext: adminHelp3(["admin", "nodes", "enroll"], "Install Ornn management on one explicitly assigned node.", "ornn admin nodes enroll <node-id> --host HOST --supplier UUID --facility UUID --identity-file PATH --token-ttl SECONDS --replace-existing-management []", "Unsupported: remote enrollment requires an eligible human terminal.", ["canonical node UUID", "canonical supplier organization UUID", "canonical facility UUID"], "Review node identity, SSH target, assignment, and replacement of existing management.")
2866
2787
  },
2867
2788
  mcp: false,
2868
2789
  slack: false,
@@ -2875,7 +2796,6 @@ var adminNodeEnrollCapability = defineCapability({
2875
2796
  host: parsed.host,
2876
2797
  organization_id: parsed.organization_id,
2877
2798
  facility_id: parsed.facility_id,
2878
- filter: parsed.filter,
2879
2799
  expires_in_seconds: parsed.expires_in_seconds,
2880
2800
  replace_existing_management: true
2881
2801
  };
@@ -2883,43 +2803,22 @@ var adminNodeEnrollCapability = defineCapability({
2883
2803
  if (!parsed.private_key) {
2884
2804
  throw codedError("identity_file_unreadable", "The SSH identity file could not be read.");
2885
2805
  }
2886
- const minted = await createEnrollmentToken(ctx.fetch, {
2887
- organization_id: parsed.organization_id,
2888
- expires_in_seconds: parsed.expires_in_seconds
2889
- });
2890
- const token = typeof minted.token === "string" ? minted.token : typeof minted.plaintext === "string" ? minted.plaintext : "";
2891
- if (!token) {
2892
- throw codedError("token_material_unavailable", "The enrollment token was created without usable token material.");
2806
+ const node = await getNode(ctx.fetch, parsed.node_id);
2807
+ if (node.organization_id !== parsed.organization_id || node.facility_id !== parsed.facility_id) {
2808
+ throw codedError("node_assignment_changed", "The existing node supplier or facility does not match the requested assignment.");
2893
2809
  }
2894
- const command = buildEnrollmentInstallCommand({
2895
- token,
2896
- base: parsed.installer_base ?? ctx.installerBaseUrl,
2897
- facilityId: parsed.facility_id,
2898
- filter: parsed.filter,
2899
- restoreNodeId: parsed.node_id,
2900
- force: true
2810
+ const run = await createEnrollmentRun(ctx.fetch, {
2811
+ organization_id: parsed.organization_id,
2812
+ label: "Recover node agent",
2813
+ restore_node_id: parsed.node_id,
2814
+ expires_in_seconds: parsed.expires_in_seconds,
2815
+ hosts: [{ address: parsed.host, port: parsed.port }]
2901
2816
  });
2902
- const remote = await runRemote(ctx.fetch, {
2903
- host: parsed.host,
2817
+ await launchEnrollmentRun(ctx.fetch, run.id, {
2904
2818
  username: parsed.username,
2905
- port: parsed.port,
2906
- private_key: parsed.private_key,
2907
- command,
2908
- timeout_seconds: 600
2819
+ private_key: parsed.private_key
2909
2820
  });
2910
- return {
2911
- node_id: parsed.node_id,
2912
- host: parsed.host,
2913
- organization_id: parsed.organization_id,
2914
- facility_id: parsed.facility_id,
2915
- filter: parsed.filter,
2916
- management: "replaced",
2917
- token_metadata: {
2918
- id: typeof minted.id === "string" ? minted.id : null,
2919
- expires_at: typeof minted.expires_at === "string" ? minted.expires_at : null
2920
- },
2921
- remote: safeRemoteResult(remote)
2922
- };
2821
+ return run;
2923
2822
  }
2924
2823
  });
2925
2824
  var nodeKeyInput = z12.object({ node_id: UUID });
@@ -2949,7 +2848,7 @@ var adminNodeRotateKeyCapability = defineCapability({
2949
2848
  mutation: "preview-confirm",
2950
2849
  cli: {
2951
2850
  command: ["admin", "nodes", "rotate-key"],
2952
- vnext: adminHelp3(["admin", "nodes", "rotate-key"], "Rotate one node admin key and export the replacement deliberately.", "ornn admin nodes rotate-key <node-id> (--print | --output PATH) [--overwrite] []", "Unsupported: key rotation requires an eligible human terminal.", ["canonical node UUID"], "Review the node and loss of access through the previous private key.")
2851
+ vnext: adminHelp3(["admin", "nodes", "rotate-key"], "Rotate one node admin key and export the replacement deliberately.", "ornn admin nodes rotate-key <node-id> (--print | --output PATH) [--overwrite]", "Unsupported: key rotation requires an eligible human terminal.", ["canonical node UUID"], "Review the node and loss of access through the previous private key.")
2953
2852
  },
2954
2853
  mcp: false,
2955
2854
  slack: false,
@@ -3218,19 +3117,19 @@ var adminNodeSanitizeCapabilities = [
3218
3117
  // ../../packages/capabilities/dist/capabilities/admin-nodes-lifecycle.js
3219
3118
  import { z as z15 } from "zod";
3220
3119
  var nodeReference = z15.string().trim().min(1);
3221
- var optionalText2 = z15.string().trim().min(1).optional();
3120
+ var optionalText = z15.string().trim().min(1).optional();
3222
3121
  var commonInput = {
3223
3122
  node_ref: nodeReference,
3224
- node_id: optionalText2,
3225
- idempotency_key: optionalText2,
3226
- reason: optionalText2,
3123
+ node_id: optionalText,
3124
+ idempotency_key: optionalText,
3125
+ reason: optionalText,
3227
3126
  yes: z15.boolean().optional(),
3228
3127
  wait: z15.boolean().optional(),
3229
3128
  timeout_seconds: z15.number().positive().optional()
3230
3129
  };
3231
3130
  var rebootInput = z15.object({
3232
3131
  ...commonInput,
3233
- machine_id: optionalText2
3132
+ machine_id: optionalText
3234
3133
  });
3235
3134
  var hardResetInput = rebootInput.extend({
3236
3135
  erase_local_data: z15.literal(true)