@ornncompute/cli 1.0.141 → 1.0.142

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,7 @@
1
1
  import {
2
+ sshKeyListCapability,
3
+ sshKeyAddCapability,
4
+ sshKeyDeleteCapability,
2
5
  sshKeyAssignmentStatusCapability,
3
6
  sshKeyDeliveryStatus,
4
7
  } from "../vendor/capabilities/cli.js";
@@ -533,7 +536,7 @@ async function fetchOrganizationKeys(context) {
533
536
  const seen = new Set();
534
537
  let cursor = null;
535
538
  do {
536
- const page = await gatewayApi.listAccountSshKeys(context.fetch, {
539
+ const page = await sshKeyListCapability.execute(context, {
537
540
  status: "active",
538
541
  limit: 500,
539
542
  ...(cursor ? { cursor } : {}),
@@ -668,11 +671,11 @@ export async function materializeKey(context, plan, interaction, idempotencyKey)
668
671
  const replay = keys.find((key) => text(key.public_key) === publicKey);
669
672
  if (replay) return replay;
670
673
  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
- )
674
+ await sshKeyAddCapability.execute(context, {
675
+ publicKey,
676
+ label: text(plan.key.label),
677
+ idempotencyKey,
678
+ })
676
679
  );
677
680
  if (!resourceId(created) || text(created.public_key) !== publicKey) {
678
681
  interaction.error("The saved SSH key did not match the reviewed public key.", {
@@ -4302,7 +4305,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4302
4305
  if (command === "list") {
4303
4306
  positional(input, 0, "ornn ssh-keys list [--limit <1-500>] [--cursor <cursor>]", interaction);
4304
4307
  const limit = input.limit ?? 50;
4305
- const payload = await gatewayApi.listAccountSshKeys(context.fetch, {
4308
+ const payload = await sshKeyListCapability.execute(context, {
4306
4309
  status: "active",
4307
4310
  limit,
4308
4311
  ...(text(input.cursor) ? { cursor: input.cursor } : {}),
@@ -4396,8 +4399,9 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4396
4399
  presentation: { lines: ["SSH-key deletion declined."] },
4397
4400
  });
4398
4401
  }
4399
- await gatewayApi.deleteAccountSshKey(context.fetch, resourceId(key), {
4400
- headers: { "Idempotency-Key": text(input.idempotencyKey) ?? interaction.idempotencyKey() },
4402
+ await sshKeyDeleteCapability.execute(context, {
4403
+ keyId: resourceId(key),
4404
+ idempotencyKey: text(input.idempotencyKey) ?? interaction.idempotencyKey(),
4401
4405
  });
4402
4406
  return interaction.result({
4403
4407
  data: { ssh_key: projectKey(key) },
@@ -3464,6 +3464,17 @@ var launchInput = z18.object({
3464
3464
  yes: z18.boolean().optional(),
3465
3465
  volume: z18.string().optional()
3466
3466
  }).strict();
3467
+ var pageInput = z18.object({
3468
+ limit: z18.number().int().min(1).max(500).optional(),
3469
+ cursor: z18.string().optional()
3470
+ });
3471
+ var publicKeyInput = z18.object({
3472
+ publicKey: z18.string(),
3473
+ label: z18.string().optional(),
3474
+ confirm: z18.boolean().optional()
3475
+ });
3476
+ var keyIdInput = z18.object({ keyId: z18.string(), confirm: z18.boolean().optional() });
3477
+ 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
3478
  var keyListInput = z18.object({
3468
3479
  $positionals: positionals2,
3469
3480
  cursor: z18.string().optional(),
@@ -3750,15 +3761,19 @@ var machineResetCapability = cliOnly({
3750
3761
  },
3751
3762
  execute: executeMachines("reset")
3752
3763
  });
3753
- var sshKeyListCapability = cliOnly({
3764
+ var sshKeyListCapability = defineCapability({
3754
3765
  id: "access.ssh_keys.list",
3755
3766
  domain: "access",
3756
3767
  roles: ["user"],
3757
3768
  mutation: "read",
3758
- input: keyListInput,
3759
- description: "List organization SSH keys in a bounded page.",
3769
+ input: pageInput.extend({ status: z18.enum(["active", "all"]).optional() }),
3770
+ description: "List a page of account SSH keys. Pass next_cursor as cursor to continue.",
3771
+ mcp: { name: "ssh_keys_list", input: pageInput },
3772
+ slack: false,
3760
3773
  cli: {
3761
3774
  command: ["ssh-keys", "list"],
3775
+ input: keyListInput,
3776
+ execute: executeSshKeys("list"),
3762
3777
  vnext: {
3763
3778
  arguments: "semantic",
3764
3779
  audience: "customer",
@@ -3771,17 +3786,28 @@ var sshKeyListCapability = cliOnly({
3771
3786
  related: ["ssh-keys add", "ssh-keys assignments list"]
3772
3787
  }
3773
3788
  },
3774
- execute: executeSshKeys("list")
3789
+ execute: (context, input) => listAccountSshKeys(context.fetch, {
3790
+ status: input.status ?? "all",
3791
+ limit: input.limit ?? 25,
3792
+ ...input.cursor ? { cursor: input.cursor } : {}
3793
+ })
3775
3794
  });
3776
- var sshKeyAddCapability = cliOnly({
3795
+ var sshKeyAddCapability = defineCapability({
3777
3796
  id: "access.ssh_keys.add",
3778
3797
  domain: "access",
3779
3798
  roles: ["user"],
3780
3799
  mutation: "preview-confirm",
3781
- input: keyMutationInput,
3782
- description: "Add or replay one organization SSH public key.",
3800
+ input: publicKeyInput.extend({
3801
+ label: z18.string().nullable().optional(),
3802
+ idempotencyKey: z18.string().optional()
3803
+ }),
3804
+ description: `Add an SSH public key to the account. ${ADDED_KEY_OUTCOME}`,
3805
+ mcp: { name: "ssh_keys_add", input: publicKeyInput },
3806
+ slack: false,
3783
3807
  cli: {
3784
3808
  command: ["ssh-keys", "add"],
3809
+ input: keyMutationInput,
3810
+ execute: executeSshKeys("add"),
3785
3811
  vnext: {
3786
3812
  arguments: "semantic",
3787
3813
  audience: "customer",
@@ -3795,17 +3821,21 @@ var sshKeyAddCapability = cliOnly({
3795
3821
  related: ["ssh-keys list", "ssh-keys assignments assign"]
3796
3822
  }
3797
3823
  },
3798
- execute: executeSshKeys("add")
3824
+ execute: (context, input) => createAccountSshKey(context.fetch, { public_key: input.publicKey, label: input.label }, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0)
3799
3825
  });
3800
- var sshKeyDeleteCapability = cliOnly({
3826
+ var sshKeyDeleteCapability = defineCapability({
3801
3827
  id: "access.ssh_keys.delete",
3802
3828
  domain: "access",
3803
3829
  roles: ["user"],
3804
3830
  mutation: "preview-confirm",
3805
- input: keyMutationInput,
3806
- description: "Delete one exact organization SSH key after review.",
3831
+ input: keyIdInput.extend({ idempotencyKey: z18.string().optional() }),
3832
+ description: "Delete an SSH key from the account.",
3833
+ mcp: { name: "ssh_keys_delete", input: keyIdInput },
3834
+ slack: false,
3807
3835
  cli: {
3808
3836
  command: ["ssh-keys", "delete"],
3837
+ input: keyMutationInput,
3838
+ execute: executeSshKeys("delete"),
3809
3839
  vnext: {
3810
3840
  arguments: "semantic",
3811
3841
  audience: "customer",
@@ -3823,7 +3853,7 @@ var sshKeyDeleteCapability = cliOnly({
3823
3853
  related: ["ssh-keys list"]
3824
3854
  }
3825
3855
  },
3826
- execute: executeSshKeys("delete")
3856
+ execute: async (context, input) => await deleteAccountSshKey(context.fetch, input.keyId, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0) ?? { deleted: true }
3827
3857
  });
3828
3858
  var sshKeyAssignmentListCapability = cliOnly({
3829
3859
  id: "access.ssh_key_assignments.list",
@@ -3946,18 +3976,7 @@ var computeCapabilities = [
3946
3976
  sshKeyAssignmentSyncCapability,
3947
3977
  sshKeyAssignmentStatusCapability
3948
3978
  ];
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
3979
  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
3980
  function rebootMachine(mode) {
3962
3981
  return (ctx, input) => rebootNode(ctx.fetch, input.nodeId, { mode });
3963
3982
  }
@@ -4073,43 +4092,6 @@ var accessVerbCapabilities = [
4073
4092
  slack: false,
4074
4093
  execute: rebootMachine("hard_reset")
4075
4094
  }),
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
4095
  defineCapability({
4114
4096
  id: "cluster_users.list",
4115
4097
  domain: "access",
@@ -7281,7 +7263,10 @@ export {
7281
7263
  metricsHistoryCapability,
7282
7264
  metricsSnapshotCapability,
7283
7265
  parseHardwareCatalog,
7266
+ sshKeyAddCapability,
7284
7267
  sshKeyAssignmentStatusCapability,
7268
+ sshKeyDeleteCapability,
7285
7269
  sshKeyDeliveryStatus,
7270
+ sshKeyListCapability,
7286
7271
  volumeFilesListCapability
7287
7272
  };