@ornncompute/cli 1.0.144 → 1.0.145

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
@@ -259,6 +259,8 @@ never contains admin children. There is no second parser or command registry.
259
259
  An eligible human context requires TTY stdin and TTY stdout and no JSON/NDJSON
260
260
  format. Human commands may guide selection and render a normalized summary;
261
261
  mutations execute immediately without a confirmation prompt.
262
+ This also applies to `volumes clear` when a noninteractive caller supplies an
263
+ explicit output format.
262
264
 
263
265
  Automation supplies complete semantic inputs and an explicit format:
264
266
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.144",
3
+ "version": "1.0.145",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,14 @@
1
1
  import * as storageApi from "../vendor/api-client/orchestrator.js";
2
- import { bucketListCapability, volumeFilesListCapability } from "../vendor/capabilities/cli.js";
2
+ import {
3
+ bucketListCapability,
4
+ volumeListCapability,
5
+ volumeShowCapability,
6
+ volumeCreateCapability,
7
+ volumeRefreshCapability,
8
+ volumeClearCapability,
9
+ volumeDeleteCapability,
10
+ volumeFilesListCapability,
11
+ } from "../vendor/capabilities/cli.js";
3
12
  import { createHash } from "node:crypto";
4
13
  import { createReadStream } from "node:fs";
5
14
  import { stat } from "node:fs/promises";
@@ -300,7 +309,10 @@ export async function fetchDrivePage(runtime, { limit = 25, cursor, scope = "all
300
309
  { actor: "", role: "user", fetch: runtime.fetch },
301
310
  input
302
311
  )
303
- : await storageApi.listDrives(runtime.fetch, { ...input, scope });
312
+ : await volumeListCapability.execute(
313
+ { actor: "", role: "user", fetch: runtime.fetch },
314
+ { ...input, scope }
315
+ );
304
316
  return { drives: volumeRows(payload), next_cursor: payload?.next_cursor ?? null };
305
317
  } catch (error) {
306
318
  throw safeStorageError(error, "Volumes could not be loaded safely.");
@@ -349,7 +361,10 @@ function resolveFromRows(rows, reference, { source = false } = {}) {
349
361
 
350
362
  export async function resolveVolume(runtime, reference) {
351
363
  if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(reference)) {
352
- const drive = await storageApi.getDrive(runtime.fetch, reference);
364
+ const drive = await volumeShowCapability.execute(
365
+ { actor: "", role: "user", fetch: runtime.fetch },
366
+ { driveId: reference }
367
+ );
353
368
  return resolveFromRows([drive], reference);
354
369
  }
355
370
  return resolveFromRows(await fetchDrives(runtime), reference);
@@ -395,11 +410,15 @@ async function createVolume(input, runtime) {
395
410
  });
396
411
  }
397
412
 
398
- const body = { name, source_drive_id: source ? String(source.id) : null };
399
413
  try {
400
- const created = await storageApi.createDrive(runtime.fetch, body, {
401
- headers: idempotencyHeaders(input),
402
- });
414
+ const created = await volumeCreateCapability.execute(
415
+ { actor: "", role: "user", fetch: runtime.fetch },
416
+ {
417
+ name,
418
+ sourceDriveId: source ? String(source.id) : undefined,
419
+ idempotencyKey: String(input.idempotencyKey ?? "").trim() || undefined,
420
+ }
421
+ );
403
422
  return runtime.interaction.result({
404
423
  data: { effective_input: effective, replayed: false, volume: safeVolume(created) },
405
424
  outcome: { class: "ready", phase: "created" },
@@ -454,7 +473,10 @@ async function showVolume(input, runtime, { refresh = false } = {}) {
454
473
  return runtime.interaction.result({ data: { volume: safeVolume(drive) } });
455
474
  }
456
475
  try {
457
- const refreshed = await storageApi.getDrive(runtime.fetch, String(drive.id), { refresh: true });
476
+ const refreshed = await volumeRefreshCapability.execute(
477
+ { actor: "", role: "user", fetch: runtime.fetch },
478
+ { driveId: String(drive.id) }
479
+ );
458
480
  return runtime.interaction.result({
459
481
  data: { volume: safeVolume(refreshed) },
460
482
  outcome: { class: "ready", phase: "refreshed" },
@@ -469,7 +491,10 @@ async function clearVolume(input, runtime) {
469
491
  const [reference] = positionals(input, 1, "Usage: ornn volumes clear <volume>");
470
492
  const drive = await resolveVolume(runtime, reference);
471
493
  try {
472
- const payload = await storageApi.clearDriveContents(runtime.fetch, String(drive.id));
494
+ const payload = await volumeClearCapability.execute(
495
+ { actor: "", role: "user", fetch: runtime.fetch },
496
+ { driveId: String(drive.id) }
497
+ );
473
498
  return runtime.interaction.result({
474
499
  data: {
475
500
  cleared: true,
@@ -504,11 +529,12 @@ async function deleteVolume(input, runtime) {
504
529
  requireMachineMutationKey(input, runtime);
505
530
  const drive = await resolveVolume(runtime, reference);
506
531
  try {
507
- await storageApi.deleteDrive(
508
- runtime.fetch,
509
- String(drive.id),
510
- {},
511
- { headers: idempotencyHeaders(input) }
532
+ await volumeDeleteCapability.execute(
533
+ { actor: "", role: "user", fetch: runtime.fetch },
534
+ {
535
+ driveId: String(drive.id),
536
+ idempotencyKey: String(input.idempotencyKey ?? "").trim() || undefined,
537
+ }
512
538
  );
513
539
  return runtime.interaction.result({
514
540
  data: { deleted: true, volume: safeVolume(drive) },
@@ -6492,74 +6492,188 @@ var volumeFilesListCapability = defineCapability({
6492
6492
  }
6493
6493
  }
6494
6494
  });
6495
- var volumeCapabilities = [
6496
- storageCapability({
6497
- id: "storage.volumes.list",
6498
- command: ["volumes", "list"],
6499
- description: "List managed volumes in one bounded page.",
6500
- mutation: "read",
6501
- outcome: "List durable managed volumes independently from their mounts.",
6502
- human: "ornn volumes list [--limit <1-100>] [--cursor <cursor>]",
6503
- automation: "ornn volumes list --limit 50 --format json",
6504
- related: ["volumes show", "volumes create"]
6495
+ var volumePageInput = z32.object({
6496
+ limit: z32.number().int().min(1).max(100).optional(),
6497
+ cursor: z32.string().optional()
6498
+ });
6499
+ var driveInput = z32.object({ driveId: z32.string() });
6500
+ var driveWrite = driveInput.extend({ confirm: z32.boolean().optional() });
6501
+ var volumeCreateInput = z32.object({
6502
+ name: z32.string(),
6503
+ sourceDriveId: z32.string().optional(),
6504
+ confirm: z32.boolean().optional()
6505
+ });
6506
+ var volumeListCapability = defineCapability({
6507
+ id: "storage.volumes.list",
6508
+ domain: "storage",
6509
+ roles: ["user"],
6510
+ description: "List a page of storage volumes, newest updated first. Pass next_cursor as cursor to continue.",
6511
+ mutation: "read",
6512
+ input: volumePageInput.extend({ scope: z32.enum(["all", "managed"]).optional() }),
6513
+ mcp: { name: "storage_volumes_list", input: volumePageInput },
6514
+ slack: false,
6515
+ execute: (context, input) => listDrives(context.fetch, {
6516
+ limit: input.limit ?? 25,
6517
+ ...input.cursor ? { cursor: input.cursor } : {},
6518
+ ...input.scope ? { scope: input.scope } : {}
6505
6519
  }),
6506
- storageCapability({
6507
- id: "storage.volumes.show",
6520
+ cli: {
6521
+ command: ["volumes", "list"],
6522
+ input: storageCliInput,
6523
+ execute: (context, input) => storageExecutor(context)("storage.volumes.list", input),
6524
+ vnext: {
6525
+ arguments: "semantic",
6526
+ audience: "customer",
6527
+ category: "resource",
6528
+ outcome: "List durable managed volumes independently from their mounts.",
6529
+ human: "ornn volumes list [--limit <1-100>] [--cursor <cursor>]",
6530
+ automation: "ornn volumes list --limit 50 --format json",
6531
+ related: ["volumes show", "volumes create"]
6532
+ }
6533
+ }
6534
+ });
6535
+ var volumeShowCapability = defineCapability({
6536
+ id: "storage.volumes.show",
6537
+ domain: "storage",
6538
+ roles: ["user"],
6539
+ description: "Show a single storage volume (drive) by id.",
6540
+ mutation: "read",
6541
+ input: driveInput,
6542
+ mcp: { name: "storage_volumes_show" },
6543
+ slack: false,
6544
+ execute: (context, input) => getDrive(context.fetch, input.driveId),
6545
+ cli: {
6508
6546
  command: ["volumes", "show"],
6509
- description: "Inspect one managed volume by canonical ID or exact unique name.",
6510
- mutation: "read",
6511
- outcome: "Inspect one durable volume without changing its lifecycle.",
6512
- human: "ornn volumes show <volume>",
6513
- automation: "ornn volumes show <volume-id> --format json",
6514
- acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6515
- related: ["volumes files list", "volume-mounts show"]
6516
- }),
6517
- storageCapability({
6518
- id: "storage.volumes.create",
6547
+ input: storageCliInput,
6548
+ execute: (context, input) => storageExecutor(context)("storage.volumes.show", input),
6549
+ vnext: {
6550
+ arguments: "semantic",
6551
+ audience: "customer",
6552
+ category: "resource",
6553
+ outcome: "Inspect one durable volume without changing its lifecycle.",
6554
+ human: "ornn volumes show <volume>",
6555
+ automation: "ornn volumes show <volume-id> --format json",
6556
+ acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6557
+ related: ["volumes files list", "volume-mounts show"]
6558
+ }
6559
+ }
6560
+ });
6561
+ var volumeCreateCapability = defineCapability({
6562
+ id: "storage.volumes.create",
6563
+ domain: "storage",
6564
+ roles: ["user"],
6565
+ description: "Create a storage volume (drive), optionally cloned from an existing source drive.",
6566
+ mutation: "preview-confirm",
6567
+ input: volumeCreateInput.extend({ idempotencyKey: z32.string().optional() }),
6568
+ mcp: { name: "storage_volumes_create", input: volumeCreateInput },
6569
+ slack: false,
6570
+ execute: (context, input) => createDrive(context.fetch, { name: input.name, source_drive_id: input.sourceDriveId ?? null }, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0),
6571
+ cli: {
6519
6572
  command: ["volumes", "create"],
6520
- description: "Create or rediscover a uniquely named managed volume.",
6521
- mutation: "preview-confirm",
6522
- outcome: "Create one durable volume or safely replay its normalized intent.",
6523
- human: "ornn volumes create --name <name> [--source <volume>] []",
6524
- automation: "ornn volumes create --name <name> [--source <volume-id>] --idempotency-key <key> --format json",
6525
- acceptedReferences: ["canonical source volume ID", "exact unique source volume name"],
6526
- related: ["volumes show", "volumes files upload"]
6527
- }),
6528
- storageCapability({
6529
- id: "storage.volumes.refresh",
6573
+ input: storageCliInput,
6574
+ execute: (context, input) => storageExecutor(context)("storage.volumes.create", input),
6575
+ vnext: {
6576
+ arguments: "semantic",
6577
+ audience: "customer",
6578
+ category: "resource",
6579
+ outcome: "Create one durable volume or safely replay its normalized intent.",
6580
+ human: "ornn volumes create --name <name> [--source <volume>] []",
6581
+ automation: "ornn volumes create --name <name> [--source <volume-id>] --idempotency-key <key> --format json",
6582
+ acceptedReferences: ["canonical source volume ID", "exact unique source volume name"],
6583
+ related: ["volumes show", "volumes files upload"]
6584
+ }
6585
+ }
6586
+ });
6587
+ var volumeRefreshCapability = defineCapability({
6588
+ id: "storage.volumes.refresh",
6589
+ domain: "storage",
6590
+ roles: ["user"],
6591
+ description: "Refresh a storage volume's (drive's) reported usage/state.",
6592
+ mutation: "preview-confirm",
6593
+ input: driveWrite,
6594
+ mcp: { name: "storage_volumes_refresh" },
6595
+ slack: false,
6596
+ execute: (context, input) => getDrive(context.fetch, input.driveId, { refresh: true }),
6597
+ cli: {
6530
6598
  command: ["volumes", "refresh"],
6531
- description: "Refresh the owner-backed view of one managed volume.",
6532
- mutation: "read",
6533
- outcome: "Refresh and inspect the current durable volume state.",
6534
- human: "ornn volumes refresh <volume>",
6535
- automation: "ornn volumes refresh <volume-id> --format json",
6536
- acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6537
- related: ["volumes show"]
6538
- }),
6539
- storageCapability({
6540
- id: "storage.volumes.clear",
6599
+ input: storageCliInput,
6600
+ execute: (context, input) => storageExecutor(context)("storage.volumes.refresh", input),
6601
+ vnext: {
6602
+ arguments: "semantic",
6603
+ audience: "customer",
6604
+ category: "resource",
6605
+ outcome: "Refresh and inspect the current durable volume state.",
6606
+ human: "ornn volumes refresh <volume>",
6607
+ automation: "ornn volumes refresh <volume-id> --format json",
6608
+ acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6609
+ related: ["volumes show"]
6610
+ }
6611
+ }
6612
+ });
6613
+ var volumeClearCapability = defineCapability({
6614
+ id: "storage.volumes.clear",
6615
+ domain: "storage",
6616
+ roles: ["user"],
6617
+ description: "Clear (empty) a storage volume's (drive's) contents without deleting the drive.",
6618
+ mutation: "preview-confirm",
6619
+ input: driveWrite,
6620
+ mcp: { name: "storage_volumes_clear" },
6621
+ slack: false,
6622
+ execute: (context, input) => clearDriveContents(context.fetch, input.driveId),
6623
+ cli: {
6541
6624
  command: ["volumes", "clear"],
6542
- description: "Erase every file in one volume after a live default-no confirmation.",
6543
- mutation: "preview-confirm",
6544
- outcome: "Permanently clear one volume only from a live interactive terminal.",
6545
- human: "ornn volumes clear <volume>",
6546
- automation: "Unsupported: this command requires a live interactive terminal.",
6547
- acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6548
- review: "Every file and folder in the volume is permanently deleted.",
6549
- related: ["volumes files list", "volume-mounts detach"]
6550
- }),
6551
- storageCapability({
6552
- id: "storage.volumes.delete",
6625
+ input: storageCliInput,
6626
+ execute: (context, input) => storageExecutor(context)("storage.volumes.clear", input),
6627
+ vnext: {
6628
+ arguments: "semantic",
6629
+ audience: "customer",
6630
+ category: "resource",
6631
+ outcome: "Permanently clear every file and folder from one volume.",
6632
+ human: "ornn volumes clear <volume>",
6633
+ automation: "ornn volumes clear <volume-id> --format json",
6634
+ acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6635
+ review: "Every file and folder in the volume is permanently deleted.",
6636
+ related: ["volumes files list", "volume-mounts detach"]
6637
+ }
6638
+ }
6639
+ });
6640
+ var volumeDeleteCapability = defineCapability({
6641
+ id: "storage.volumes.delete",
6642
+ domain: "storage",
6643
+ roles: ["user"],
6644
+ description: "Delete a storage volume (drive).",
6645
+ mutation: "preview-confirm",
6646
+ input: driveWrite.extend({ idempotencyKey: z32.string().optional() }),
6647
+ mcp: { name: "storage_volumes_delete", input: driveWrite },
6648
+ slack: false,
6649
+ execute: async (context, input) => {
6650
+ await deleteDrive(context.fetch, input.driveId, {}, input.idempotencyKey ? { headers: { "Idempotency-Key": input.idempotencyKey } } : void 0);
6651
+ return { deleted: true, drive_id: input.driveId };
6652
+ },
6653
+ cli: {
6553
6654
  command: ["volumes", "delete"],
6554
- description: "Delete an explicitly selected, relationship-free managed volume.",
6555
- mutation: "preview-confirm",
6556
- outcome: "Delete one detached volume after explicit consent.",
6557
- human: "ornn volumes delete <volume>",
6558
- automation: "ornn volumes delete <volume-id> --idempotency-key <key> --format json",
6559
- acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6560
- review: "The volume and all of its data are permanently deleted.",
6561
- related: ["volume-mounts detach", "volumes show"]
6562
- }),
6655
+ input: storageCliInput,
6656
+ execute: (context, input) => storageExecutor(context)("storage.volumes.delete", input),
6657
+ vnext: {
6658
+ arguments: "semantic",
6659
+ audience: "customer",
6660
+ category: "resource",
6661
+ outcome: "Delete one detached volume after explicit consent.",
6662
+ human: "ornn volumes delete <volume>",
6663
+ automation: "ornn volumes delete <volume-id> --idempotency-key <key> --format json",
6664
+ acceptedReferences: ["canonical volume ID", "exact unique volume name"],
6665
+ review: "The volume and all of its data are permanently deleted.",
6666
+ related: ["volume-mounts detach", "volumes show"]
6667
+ }
6668
+ }
6669
+ });
6670
+ var volumeCapabilities = [
6671
+ volumeListCapability,
6672
+ volumeShowCapability,
6673
+ volumeCreateCapability,
6674
+ volumeRefreshCapability,
6675
+ volumeClearCapability,
6676
+ volumeDeleteCapability,
6563
6677
  volumeFilesListCapability,
6564
6678
  storageCapability({
6565
6679
  id: "storage.volumes.files.upload",
@@ -6610,8 +6724,6 @@ var volumeCapabilities = [
6610
6724
  ];
6611
6725
  var reservationInput2 = z32.object({ reservationId: z32.string() });
6612
6726
  var reservationWrite = reservationInput2.extend({ confirm: z32.boolean().optional() });
6613
- var driveInput = z32.object({ driveId: z32.string() });
6614
- var driveWrite = driveInput.extend({ confirm: z32.boolean().optional() });
6615
6727
  var bucketConnectInput = z32.object({
6616
6728
  provider: z32.enum(["gcs", "s3", "r2"]),
6617
6729
  bucket: z32.string(),
@@ -6675,92 +6787,6 @@ var storageVerbCapabilities = [
6675
6787
  slack: false,
6676
6788
  execute: (ctx) => listStorageTargets(ctx.fetch)
6677
6789
  }),
6678
- defineCapability({
6679
- id: "volume.list",
6680
- domain: "storage",
6681
- roles: ["user"],
6682
- description: "List a page of storage volumes, newest updated first. Pass next_cursor as cursor to continue.",
6683
- mutation: "read",
6684
- input: z32.object({
6685
- limit: z32.number().int().min(1).max(100).optional(),
6686
- cursor: z32.string().optional()
6687
- }),
6688
- mcp: { name: "storage_volumes_list" },
6689
- slack: false,
6690
- execute: (ctx, input) => listDrives(ctx.fetch, {
6691
- limit: input.limit ?? 25,
6692
- ...input.cursor ? { cursor: input.cursor } : {}
6693
- })
6694
- }),
6695
- defineCapability({
6696
- id: "volume.show",
6697
- domain: "storage",
6698
- roles: ["user"],
6699
- description: "Show a single storage volume (drive) by id.",
6700
- mutation: "read",
6701
- input: driveInput,
6702
- mcp: { name: "storage_volumes_show" },
6703
- slack: false,
6704
- execute: (ctx, input) => getDrive(ctx.fetch, input.driveId)
6705
- }),
6706
- defineCapability({
6707
- id: "volume.create",
6708
- domain: "storage",
6709
- roles: ["user"],
6710
- description: "Create a storage volume (drive), optionally cloned from an existing source drive.",
6711
- mutation: "preview-confirm",
6712
- input: z32.object({
6713
- name: z32.string(),
6714
- sourceDriveId: z32.string().optional(),
6715
- confirm: z32.boolean().optional()
6716
- }),
6717
- mcp: { name: "storage_volumes_create" },
6718
- slack: false,
6719
- execute: (ctx, input) => createDrive(ctx.fetch, {
6720
- name: input.name,
6721
- source_drive_id: input.sourceDriveId ?? null
6722
- })
6723
- }),
6724
- defineCapability({
6725
- id: "volume.refresh",
6726
- domain: "storage",
6727
- roles: ["user"],
6728
- description: "Refresh a storage volume's (drive's) reported usage/state.",
6729
- mutation: "preview-confirm",
6730
- input: driveWrite,
6731
- mcp: { name: "storage_volumes_refresh" },
6732
- slack: false,
6733
- execute: (ctx, input) => getDrive(ctx.fetch, input.driveId, { refresh: true })
6734
- }),
6735
- defineCapability({
6736
- id: "volume.clear",
6737
- domain: "storage",
6738
- roles: ["user"],
6739
- description: "Clear (empty) a storage volume's (drive's) contents without deleting the drive.",
6740
- mutation: "preview-confirm",
6741
- input: driveWrite,
6742
- mcp: { name: "storage_volumes_clear" },
6743
- slack: false,
6744
- // The route answers 204, so report which volume was cleared.
6745
- execute: async (ctx, input) => {
6746
- await clearDriveContents(ctx.fetch, input.driveId);
6747
- return { cleared: true, drive_id: input.driveId };
6748
- }
6749
- }),
6750
- defineCapability({
6751
- id: "volume.delete",
6752
- domain: "storage",
6753
- roles: ["user"],
6754
- description: "Delete a storage volume (drive).",
6755
- mutation: "preview-confirm",
6756
- input: driveWrite,
6757
- mcp: { name: "storage_volumes_delete" },
6758
- slack: false,
6759
- execute: async (ctx, input) => {
6760
- await deleteDrive(ctx.fetch, input.driveId);
6761
- return { deleted: true, drive_id: input.driveId };
6762
- }
6763
- }),
6764
6790
  defineCapability({
6765
6791
  id: "bucket.connect",
6766
6792
  domain: "storage",
@@ -7158,7 +7184,13 @@ export {
7158
7184
  sshKeyDeleteCapability,
7159
7185
  sshKeyDeliveryStatus,
7160
7186
  sshKeyListCapability,
7187
+ volumeClearCapability,
7188
+ volumeCreateCapability,
7189
+ volumeDeleteCapability,
7161
7190
  volumeFilesListCapability,
7191
+ volumeListCapability,
7192
+ volumeRefreshCapability,
7193
+ volumeShowCapability,
7162
7194
  vpnConnectionConfigureCapability,
7163
7195
  vpnConnectionDisconnectCapability,
7164
7196
  vpnConnectionListCapability