@ornncompute/cli 1.0.214 → 1.0.216

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.214",
3
+ "version": "1.0.216",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,6 +26,7 @@ import { dirname, join } from "node:path";
26
26
  import { getAuthConfigDir, loadAuthSession } from "./auth-store.mjs";
27
27
  import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
28
28
  import { resolvedMountPath } from "./mount-commands.mjs";
29
+ import { codeOf, detailOf } from "./storage-commands.mjs";
29
30
  import {
30
31
  isReferenceMiss,
31
32
  listActiveDirectReservations,
@@ -757,6 +758,18 @@ function virtualMachineForNode(payload, node, interaction) {
757
758
  return matches[0] ?? null;
758
759
  }
759
760
 
761
+ function keyDeliveryFailure(error) {
762
+ const detail = detailOf(error);
763
+ return {
764
+ code: codeOf(error),
765
+ message:
766
+ typeof detail?.message === "string" && detail.message.trim()
767
+ ? detail.message
768
+ : "SSH-key delivery could not be queued.",
769
+ retryable: typeof detail?.retryable === "boolean" ? detail.retryable : true,
770
+ };
771
+ }
772
+
760
773
  function assignmentStatus(reservationId, keys, machines) {
761
774
  return {
762
775
  reservation_id: reservationId,
@@ -4814,6 +4827,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4814
4827
  });
4815
4828
  }
4816
4829
  const deliveries = new Map();
4830
+ const failures = new Map();
4817
4831
  for (const machine of machines) {
4818
4832
  const id = machineId(machine);
4819
4833
  const requestId = `${idempotencyKey}:${id}`;
@@ -4830,9 +4844,11 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4830
4844
  request_id: requestId,
4831
4845
  status: "queued",
4832
4846
  });
4833
- } catch {
4847
+ } catch (error) {
4848
+ const failure = keyDeliveryFailure(error);
4849
+ failures.set(failure.code ?? failure.message, failure);
4834
4850
  deliveries.set(id, {
4835
- failure_reason: "SSH-key delivery could not be queued.",
4851
+ failure_reason: failure.message,
4836
4852
  packet_id: null,
4837
4853
  request_id: requestId,
4838
4854
  status: "failed",
@@ -4855,8 +4871,11 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4855
4871
  {
4856
4872
  code: "ssh_key_delivery_partial",
4857
4873
  message: `SSH-key delivery could not be queued for ${failed} machine${failed === 1 ? "" : "s"}.`,
4858
- retryable: true,
4874
+ retryable: [...failures.values()].some((failure) => failure.retryable),
4859
4875
  },
4876
+ ...[...failures.values()]
4877
+ .filter((failure) => failure.code)
4878
+ .map(({ code, message, retryable }) => ({ code, message, retryable })),
4860
4879
  ]
4861
4880
  : [],
4862
4881
  exitCode: failed ? 4 : 0,
@@ -4872,6 +4891,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
4872
4891
  presentation: {
4873
4892
  lines: [
4874
4893
  `SSH-key synchronization queued for ${queued} machine${queued === 1 ? "" : "s"}${failed ? `; ${failed} failed` : ""}.`,
4894
+ ...[...failures.values()].map((failure) => failure.message),
4875
4895
  ],
4876
4896
  next: `ornn ssh-keys assignments status ${reservationId}`,
4877
4897
  },
@@ -1,12 +1,14 @@
1
1
  // ../../packages/api-client/dist/gateway/support.js
2
- function listSupportThreads(request, status) {
3
- return request(`/v1/support/threads?status=${encodeURIComponent(status)}`, {
4
- method: "GET"
2
+ function listSupportThreads(request, status, options) {
3
+ return request(`/v1/support/threads?status=${encodeURIComponent(status)}${options?.after ? `&after=${encodeURIComponent(options.after)}` : ""}`, {
4
+ method: "GET",
5
+ signal: options?.signal
5
6
  });
6
7
  }
7
- function getSupportThread(request, id) {
8
+ function getSupportThread(request, id, signal) {
8
9
  return request(`/v1/support/threads/${encodeURIComponent(id)}`, {
9
- method: "GET"
10
+ method: "GET",
11
+ signal
10
12
  });
11
13
  }
12
14
  function createSupportThread(request, body) {
@@ -45,6 +47,20 @@ function linkPylonIssue(request, id, body) {
45
47
  function createPylonIssue(request, body) {
46
48
  return request("/v1/staff/support/issues", { method: "POST", body });
47
49
  }
50
+ function resolveSupportThread(request, id) {
51
+ return request(`/v1/support/threads/${encodeURIComponent(id)}`, {
52
+ method: "PATCH",
53
+ body: { status: "done" }
54
+ });
55
+ }
56
+ function uploadSupportAttachment(request, file) {
57
+ const body = new FormData();
58
+ body.append("file", file);
59
+ return request("/v1/support/attachments", {
60
+ method: "POST",
61
+ body
62
+ });
63
+ }
48
64
 
49
65
  // ../../packages/api-client/dist/gateway/supplier-intake.js
50
66
  function exchangeSupplierIntakeAccess(fetcher, init = {}) {
@@ -250,11 +266,13 @@ export {
250
266
  releaseSupplierIntakeEditor,
251
267
  removeStaffReservationKey,
252
268
  replySupportThread,
269
+ resolveSupportThread,
253
270
  revokeStaffOrganizationKey,
254
271
  searchSupportIssues,
255
272
  submitSupplierIntake,
256
273
  teardownReservationCluster,
257
274
  transferStaffReservation,
258
275
  updateSupplierIntakeDraft,
259
- uploadSupplierIntakeDocument
276
+ uploadSupplierIntakeDocument,
277
+ uploadSupportAttachment
260
278
  };