@ornncompute/cli 1.0.141 → 1.0.143

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 CHANGED
@@ -5,7 +5,7 @@ client for customer compute journeys and the explicit staff namespace. It
5
5
  sends browser and CLI traffic only through the API gateway.
6
6
 
7
7
  For the customer install and usage guide, see [`docs/cli.md`](../../docs/cli.md).
8
- The shared capability catalog in `packages/capabilities` is the authority for
8
+ The [shared capability catalog](../../packages/capabilities/README.md) is the authority for
9
9
  command identity, role visibility, input schemas, help, and resource discovery.
10
10
  The CLI imports `@ornn/capabilities/cli`; packaging includes its dependencies,
11
11
  including `@ornn/api-client`, and excludes MCP-only catalog handlers. These
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.141",
3
+ "version": "1.0.143",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,9 @@
1
1
  import {
2
+ sshKeyListCapability,
3
+ sshKeyAddCapability,
4
+ sshKeyDeleteCapability,
5
+ sshKeyAssignmentListCapability,
6
+ sshKeyAssignmentAssignCapability,
2
7
  sshKeyAssignmentStatusCapability,
3
8
  sshKeyDeliveryStatus,
4
9
  } from "../vendor/capabilities/cli.js";
@@ -533,7 +538,7 @@ async function fetchOrganizationKeys(context) {
533
538
  const seen = new Set();
534
539
  let cursor = null;
535
540
  do {
536
- const page = await gatewayApi.listAccountSshKeys(context.fetch, {
541
+ const page = await sshKeyListCapability.execute(context, {
537
542
  status: "active",
538
543
  limit: 500,
539
544
  ...(cursor ? { cursor } : {}),
@@ -668,11 +673,11 @@ export async function materializeKey(context, plan, interaction, idempotencyKey)
668
673
  const replay = keys.find((key) => text(key.public_key) === publicKey);
669
674
  if (replay) return replay;
670
675
  const created = record(
671
- await gatewayApi.createAccountSshKey(
672
- context.fetch,
673
- { label: text(plan.key.label), public_key: publicKey },
674
- { headers: { "Idempotency-Key": idempotencyKey } }
675
- )
676
+ await sshKeyAddCapability.execute(context, {
677
+ publicKey,
678
+ label: text(plan.key.label),
679
+ idempotencyKey,
680
+ })
676
681
  );
677
682
  if (!resourceId(created) || text(created.public_key) !== publicKey) {
678
683
  interaction.error("The saved SSH key did not match the reviewed public key.", {
@@ -684,7 +689,7 @@ export async function materializeKey(context, plan, interaction, idempotencyKey)
684
689
 
685
690
  async function fetchAssignedKeys(context, reservationId) {
686
691
  return activeKeys(
687
- keysFromPayload(await orchestrator.listReservationSshKeys(context.fetch, reservationId))
692
+ keysFromPayload(await sshKeyAssignmentListCapability.execute(context, { reservationId }))
688
693
  );
689
694
  }
690
695
 
@@ -694,12 +699,11 @@ async function ensureAssignment(context, reservationId, key, idempotencyKey, int
694
699
  const existing = assigned.find((candidate) => resourceId(candidate) === keyId);
695
700
  if (existing) return { created: false, key: existing };
696
701
  const created = record(
697
- await orchestrator.addReservationSshKey(
698
- context.fetch,
702
+ await sshKeyAssignmentAssignCapability.execute(context, {
699
703
  reservationId,
700
- { ssh_key_id: keyId },
701
- { headers: { "Idempotency-Key": idempotencyKey } }
702
- )
704
+ keyId,
705
+ idempotencyKey,
706
+ })
703
707
  );
704
708
  if (resourceId(created) !== keyId) {
705
709
  interaction.error("The SSH-key assignment did not match the reviewed key.", {
@@ -1665,7 +1669,7 @@ async function executeWorkspaceCapability(
1665
1669
  code: "workspace_capability_unavailable",
1666
1670
  });
1667
1671
  }
1668
- const execution = await capability.execute(
1672
+ const execution = await (capability.cli?.execute ?? capability.execute)(
1669
1673
  workspaceStepContext(context, interaction, signal),
1670
1674
  input
1671
1675
  );
@@ -4302,7 +4306,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4302
4306
  if (command === "list") {
4303
4307
  positional(input, 0, "ornn ssh-keys list [--limit <1-500>] [--cursor <cursor>]", interaction);
4304
4308
  const limit = input.limit ?? 50;
4305
- const payload = await gatewayApi.listAccountSshKeys(context.fetch, {
4309
+ const payload = await sshKeyListCapability.execute(context, {
4306
4310
  status: "active",
4307
4311
  limit,
4308
4312
  ...(text(input.cursor) ? { cursor: input.cursor } : {}),
@@ -4396,8 +4400,9 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4396
4400
  presentation: { lines: ["SSH-key deletion declined."] },
4397
4401
  });
4398
4402
  }
4399
- await gatewayApi.deleteAccountSshKey(context.fetch, resourceId(key), {
4400
- headers: { "Idempotency-Key": text(input.idempotencyKey) ?? interaction.idempotencyKey() },
4403
+ await sshKeyDeleteCapability.execute(context, {
4404
+ keyId: resourceId(key),
4405
+ idempotencyKey: text(input.idempotencyKey) ?? interaction.idempotencyKey(),
4401
4406
  });
4402
4407
  return interaction.result({
4403
4408
  data: { ssh_key: projectKey(key) },
@@ -231,19 +231,6 @@ function deleteAccountSshKey(request, id, options) {
231
231
  method: "DELETE"
232
232
  });
233
233
  }
234
- function listClusterUserKeys(request, input) {
235
- return request(`${compute}/nodes/organizations/me/cluster-users${query2(input)}`, {
236
- method: "GET"
237
- });
238
- }
239
- function createClusterUserKey(request, body) {
240
- return request(`${compute}/nodes/organizations/me/cluster-users`, { method: "POST", body });
241
- }
242
- function deleteClusterUserKey(request, id) {
243
- return request(`${compute}/nodes/organizations/me/cluster-users/${encodeURIComponent(id)}`, {
244
- method: "DELETE"
245
- });
246
- }
247
234
 
248
235
  // ../../packages/api-client/dist/gateway/staff.js
249
236
  function addStaffReservationKey(request, id, body) {
@@ -307,12 +294,10 @@ export {
307
294
  claimSupplierIntakeEditor,
308
295
  consoleMcpPath,
309
296
  createAccountSshKey,
310
- createClusterUserKey,
311
297
  createPylonIssue,
312
298
  createStaffTestMember,
313
299
  createSupportThread,
314
300
  deleteAccountSshKey,
315
- deleteClusterUserKey,
316
301
  deleteSupplierIntakeDocument,
317
302
  deployReservationStorage,
318
303
  deployStaffNode,
@@ -338,7 +323,6 @@ export {
338
323
  linkPylonAccount,
339
324
  linkPylonIssue,
340
325
  listAccountSshKeys,
341
- listClusterUserKeys,
342
326
  listClusters,
343
327
  listGithubCommitPulls,
344
328
  listGithubCommits,
@@ -3359,19 +3359,6 @@ function deleteAccountSshKey(request, id, options) {
3359
3359
  method: "DELETE"
3360
3360
  });
3361
3361
  }
3362
- function listClusterUserKeys(request, input) {
3363
- return request(`${compute}/nodes/organizations/me/cluster-users${query2(input)}`, {
3364
- method: "GET"
3365
- });
3366
- }
3367
- function createClusterUserKey(request, body2) {
3368
- return request(`${compute}/nodes/organizations/me/cluster-users`, { method: "POST", body: body2 });
3369
- }
3370
- function deleteClusterUserKey(request, id) {
3371
- return request(`${compute}/nodes/organizations/me/cluster-users/${encodeURIComponent(id)}`, {
3372
- method: "DELETE"
3373
- });
3374
- }
3375
3362
 
3376
3363
  // ../../packages/api-client/dist/gateway/index.js
3377
3364
  function getCliStatus(request) {
@@ -3464,6 +3451,18 @@ var launchInput = z18.object({
3464
3451
  yes: z18.boolean().optional(),
3465
3452
  volume: z18.string().optional()
3466
3453
  }).strict();
3454
+ var pageInput = z18.object({
3455
+ limit: z18.number().int().min(1).max(500).optional(),
3456
+ cursor: z18.string().optional()
3457
+ });
3458
+ var publicKeyInput = z18.object({
3459
+ publicKey: z18.string(),
3460
+ label: z18.string().optional(),
3461
+ confirm: z18.boolean().optional()
3462
+ });
3463
+ var keyIdInput = z18.object({ keyId: z18.string(), confirm: z18.boolean().optional() });
3464
+ var reservationKeyInput = publicKeyInput.extend({ reservationId: z18.string() });
3465
+ var ADDED_KEY_OUTCOME = "The response's outcome field says whether the key was created, was already_registered (returned unchanged, so the submitted label is not applied), or was reactivated from a revoked key.";
3467
3466
  var keyListInput = z18.object({
3468
3467
  $positionals: positionals2,
3469
3468
  cursor: z18.string().optional(),
@@ -3750,15 +3749,19 @@ var machineResetCapability = cliOnly({
3750
3749
  },
3751
3750
  execute: executeMachines("reset")
3752
3751
  });
3753
- var sshKeyListCapability = cliOnly({
3752
+ var sshKeyListCapability = defineCapability({
3754
3753
  id: "access.ssh_keys.list",
3755
3754
  domain: "access",
3756
3755
  roles: ["user"],
3757
3756
  mutation: "read",
3758
- input: keyListInput,
3759
- description: "List organization SSH keys in a bounded page.",
3757
+ input: pageInput.extend({ status: z18.enum(["active", "all"]).optional() }),
3758
+ description: "List a page of account SSH keys. Pass next_cursor as cursor to continue.",
3759
+ mcp: { name: "ssh_keys_list", aliases: ["cluster_users_list"], input: pageInput },
3760
+ slack: false,
3760
3761
  cli: {
3761
3762
  command: ["ssh-keys", "list"],
3763
+ input: keyListInput,
3764
+ execute: executeSshKeys("list"),
3762
3765
  vnext: {
3763
3766
  arguments: "semantic",
3764
3767
  audience: "customer",
@@ -3771,17 +3774,28 @@ var sshKeyListCapability = cliOnly({
3771
3774
  related: ["ssh-keys add", "ssh-keys assignments list"]
3772
3775
  }
3773
3776
  },
3774
- execute: executeSshKeys("list")
3777
+ execute: (context, input) => listAccountSshKeys(context.fetch, {
3778
+ status: input.status ?? "all",
3779
+ limit: input.limit ?? 25,
3780
+ ...input.cursor ? { cursor: input.cursor } : {}
3781
+ })
3775
3782
  });
3776
- var sshKeyAddCapability = cliOnly({
3783
+ var sshKeyAddCapability = defineCapability({
3777
3784
  id: "access.ssh_keys.add",
3778
3785
  domain: "access",
3779
3786
  roles: ["user"],
3780
3787
  mutation: "preview-confirm",
3781
- input: keyMutationInput,
3782
- description: "Add or replay one organization SSH public key.",
3788
+ input: publicKeyInput.extend({
3789
+ label: z18.string().nullable().optional(),
3790
+ idempotencyKey: z18.string().optional()
3791
+ }),
3792
+ description: `Add an SSH public key to the account. ${ADDED_KEY_OUTCOME}`,
3793
+ mcp: { name: "ssh_keys_add", aliases: ["cluster_users_add"], input: publicKeyInput },
3794
+ slack: false,
3783
3795
  cli: {
3784
3796
  command: ["ssh-keys", "add"],
3797
+ input: keyMutationInput,
3798
+ execute: executeSshKeys("add"),
3785
3799
  vnext: {
3786
3800
  arguments: "semantic",
3787
3801
  audience: "customer",
@@ -3795,17 +3809,21 @@ var sshKeyAddCapability = cliOnly({
3795
3809
  related: ["ssh-keys list", "ssh-keys assignments assign"]
3796
3810
  }
3797
3811
  },
3798
- execute: executeSshKeys("add")
3812
+ execute: (context, input) => createAccountSshKey(context.fetch, { public_key: input.publicKey, label: input.label }, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0)
3799
3813
  });
3800
- var sshKeyDeleteCapability = cliOnly({
3814
+ var sshKeyDeleteCapability = defineCapability({
3801
3815
  id: "access.ssh_keys.delete",
3802
3816
  domain: "access",
3803
3817
  roles: ["user"],
3804
3818
  mutation: "preview-confirm",
3805
- input: keyMutationInput,
3806
- description: "Delete one exact organization SSH key after review.",
3819
+ input: keyIdInput.extend({ idempotencyKey: z18.string().optional() }),
3820
+ description: "Delete an SSH key from the account.",
3821
+ mcp: { name: "ssh_keys_delete", aliases: ["cluster_users_revoke"], input: keyIdInput },
3822
+ slack: false,
3807
3823
  cli: {
3808
3824
  command: ["ssh-keys", "delete"],
3825
+ input: keyMutationInput,
3826
+ execute: executeSshKeys("delete"),
3809
3827
  vnext: {
3810
3828
  arguments: "semantic",
3811
3829
  audience: "customer",
@@ -3823,17 +3841,21 @@ var sshKeyDeleteCapability = cliOnly({
3823
3841
  related: ["ssh-keys list"]
3824
3842
  }
3825
3843
  },
3826
- execute: executeSshKeys("delete")
3844
+ execute: async (context, input) => await deleteAccountSshKey(context.fetch, input.keyId, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0) ?? { deleted: true }
3827
3845
  });
3828
- var sshKeyAssignmentListCapability = cliOnly({
3846
+ var sshKeyAssignmentListCapability = defineCapability({
3829
3847
  id: "access.ssh_key_assignments.list",
3830
3848
  domain: "access",
3831
3849
  roles: ["user"],
3832
3850
  mutation: "read",
3833
- input: keyListInput,
3834
- description: "List SSH keys assigned to one capacity reservation.",
3851
+ input: z18.object({ reservationId: z18.string() }),
3852
+ description: "List SSH keys registered for a reservation.",
3853
+ mcp: { name: "access_keys_list" },
3854
+ slack: false,
3835
3855
  cli: {
3836
3856
  command: ["ssh-keys", "assignments", "list"],
3857
+ input: keyListInput,
3858
+ execute: executeSshKeys("assignments.list"),
3837
3859
  vnext: {
3838
3860
  arguments: "semantic",
3839
3861
  audience: "customer",
@@ -3846,17 +3868,24 @@ var sshKeyAssignmentListCapability = cliOnly({
3846
3868
  related: ["ssh-keys assignments status"]
3847
3869
  }
3848
3870
  },
3849
- execute: executeSshKeys("assignments.list")
3871
+ execute: (context, input) => listReservationSshKeys(context.fetch, input.reservationId)
3850
3872
  });
3851
- var sshKeyAssignmentAssignCapability = cliOnly({
3873
+ var sshKeyAssignmentAssignCapability = defineCapability({
3852
3874
  id: "access.ssh_key_assignments.assign",
3853
3875
  domain: "access",
3854
3876
  roles: ["user"],
3855
3877
  mutation: "preview-confirm",
3856
- input: keyMutationInput,
3857
- description: "Assign one existing organization SSH key to one capacity reservation.",
3878
+ input: z18.union([
3879
+ reservationKeyInput.extend({ idempotencyKey: z18.string().optional() }),
3880
+ keyIdInput.extend({ reservationId: z18.string(), idempotencyKey: z18.string().optional() })
3881
+ ]),
3882
+ description: `Add an SSH key to a reservation. ${ADDED_KEY_OUTCOME}`,
3883
+ mcp: { name: "access_keys_add", input: reservationKeyInput },
3884
+ slack: false,
3858
3885
  cli: {
3859
3886
  command: ["ssh-keys", "assignments", "assign"],
3887
+ input: keyMutationInput,
3888
+ execute: executeSshKeys("assignments.assign"),
3860
3889
  vnext: {
3861
3890
  arguments: "semantic",
3862
3891
  audience: "customer",
@@ -3875,7 +3904,7 @@ var sshKeyAssignmentAssignCapability = cliOnly({
3875
3904
  related: ["ssh-keys assignments status"]
3876
3905
  }
3877
3906
  },
3878
- execute: executeSshKeys("assignments.assign")
3907
+ execute: (context, input) => addReservationSshKey(context.fetch, input.reservationId, "keyId" in input ? { ssh_key_id: input.keyId } : { public_key: input.publicKey, label: input.label ?? null }, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0)
3879
3908
  });
3880
3909
  var sshKeyAssignmentSyncCapability = cliOnly({
3881
3910
  id: "access.ssh_key_assignments.sync",
@@ -3946,18 +3975,7 @@ var computeCapabilities = [
3946
3975
  sshKeyAssignmentSyncCapability,
3947
3976
  sshKeyAssignmentStatusCapability
3948
3977
  ];
3949
- var pageInput = z18.object({
3950
- limit: z18.number().int().min(1).max(500).optional(),
3951
- cursor: z18.string().optional()
3952
- });
3953
- var publicKeyInput = z18.object({
3954
- publicKey: z18.string(),
3955
- label: z18.string().optional(),
3956
- confirm: z18.boolean().optional()
3957
- });
3958
- var keyIdInput = z18.object({ keyId: z18.string(), confirm: z18.boolean().optional() });
3959
3978
  var nodeIdInput = z18.object({ nodeId: z18.string(), confirm: z18.boolean().optional() });
3960
- var ADDED_KEY_OUTCOME = "The response's outcome field says whether the key was created, was already_registered (returned unchanged, so the submitted label is not applied), or was reactivated from a revoked key.";
3961
3979
  function rebootMachine(mode) {
3962
3980
  return (ctx, input) => rebootNode(ctx.fetch, input.nodeId, { mode });
3963
3981
  }
@@ -4028,29 +4046,6 @@ var accessVerbCapabilities = [
4028
4046
  ssh_key_ids: input.sshKeyIds
4029
4047
  })
4030
4048
  }),
4031
- defineCapability({
4032
- id: "access.keys.list",
4033
- domain: "access",
4034
- roles: ["user"],
4035
- description: "List SSH keys registered for a reservation.",
4036
- mutation: "read",
4037
- input: z18.object({ reservationId: z18.string() }),
4038
- slack: false,
4039
- execute: (ctx, input) => listReservationSshKeys(ctx.fetch, input.reservationId)
4040
- }),
4041
- defineCapability({
4042
- id: "access.keys.add",
4043
- domain: "access",
4044
- roles: ["user"],
4045
- description: `Add an SSH key to a reservation. ${ADDED_KEY_OUTCOME}`,
4046
- mutation: "preview-confirm",
4047
- input: publicKeyInput.extend({ reservationId: z18.string() }),
4048
- slack: false,
4049
- execute: (ctx, input) => addReservationSshKey(ctx.fetch, input.reservationId, {
4050
- label: input.label ?? null,
4051
- public_key: input.publicKey
4052
- })
4053
- }),
4054
4049
  defineCapability({
4055
4050
  id: "machine.reboot",
4056
4051
  domain: "access",
@@ -4072,80 +4067,6 @@ var accessVerbCapabilities = [
4072
4067
  mcp: { name: "nodes_hard_reset" },
4073
4068
  slack: false,
4074
4069
  execute: rebootMachine("hard_reset")
4075
- }),
4076
- defineCapability({
4077
- id: "ssh_keys.list",
4078
- domain: "access",
4079
- roles: ["user"],
4080
- description: "List a page of account SSH keys. Pass next_cursor as cursor to continue.",
4081
- mutation: "read",
4082
- input: pageInput,
4083
- slack: false,
4084
- execute: (ctx, input) => listAccountSshKeys(ctx.fetch, {
4085
- status: "all",
4086
- limit: input.limit ?? 25,
4087
- ...input.cursor ? { cursor: input.cursor } : {}
4088
- })
4089
- }),
4090
- defineCapability({
4091
- id: "ssh_keys.add",
4092
- domain: "access",
4093
- roles: ["user"],
4094
- description: `Add an SSH public key to the account. ${ADDED_KEY_OUTCOME}`,
4095
- mutation: "preview-confirm",
4096
- input: publicKeyInput,
4097
- slack: false,
4098
- execute: (ctx, input) => createAccountSshKey(ctx.fetch, {
4099
- public_key: input.publicKey,
4100
- label: input.label
4101
- })
4102
- }),
4103
- defineCapability({
4104
- id: "ssh_keys.delete",
4105
- domain: "access",
4106
- roles: ["user"],
4107
- description: "Delete an SSH key from the account.",
4108
- mutation: "preview-confirm",
4109
- input: keyIdInput,
4110
- slack: false,
4111
- execute: async (ctx, input) => await deleteAccountSshKey(ctx.fetch, input.keyId) ?? { deleted: true }
4112
- }),
4113
- defineCapability({
4114
- id: "cluster_users.list",
4115
- domain: "access",
4116
- roles: ["user"],
4117
- description: "List a page of organization cluster-user SSH keys. Pass next_cursor as cursor to continue.",
4118
- mutation: "read",
4119
- input: pageInput,
4120
- slack: false,
4121
- execute: (ctx, input) => listClusterUserKeys(ctx.fetch, {
4122
- status: "all",
4123
- limit: input.limit ?? 25,
4124
- ...input.cursor ? { cursor: input.cursor } : {}
4125
- })
4126
- }),
4127
- defineCapability({
4128
- id: "cluster_users.add",
4129
- domain: "access",
4130
- roles: ["user"],
4131
- description: "Add a cluster-user SSH public key to the organization. Registers the same organization key as ssh_keys_add; a key already registered is returned as-is with its existing label.",
4132
- mutation: "preview-confirm",
4133
- input: publicKeyInput,
4134
- slack: false,
4135
- execute: (ctx, input) => createClusterUserKey(ctx.fetch, {
4136
- public_key: input.publicKey,
4137
- label: input.label
4138
- })
4139
- }),
4140
- defineCapability({
4141
- id: "cluster_users.revoke",
4142
- domain: "access",
4143
- roles: ["user"],
4144
- description: "Revoke a cluster-user SSH key from the organization.",
4145
- mutation: "preview-confirm",
4146
- input: keyIdInput,
4147
- slack: false,
4148
- execute: async (ctx, input) => await deleteClusterUserKey(ctx.fetch, input.keyId) ?? { deleted: true }
4149
4070
  })
4150
4071
  ];
4151
4072
 
@@ -7281,7 +7202,12 @@ export {
7281
7202
  metricsHistoryCapability,
7282
7203
  metricsSnapshotCapability,
7283
7204
  parseHardwareCatalog,
7205
+ sshKeyAddCapability,
7206
+ sshKeyAssignmentAssignCapability,
7207
+ sshKeyAssignmentListCapability,
7284
7208
  sshKeyAssignmentStatusCapability,
7209
+ sshKeyDeleteCapability,
7285
7210
  sshKeyDeliveryStatus,
7211
+ sshKeyListCapability,
7286
7212
  volumeFilesListCapability
7287
7213
  };