sandbox 3.4.1 → 3.5.0-beta.0

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.
@@ -19,7 +19,7 @@ import { EOL } from "os";
19
19
  import { z } from "zod/v4";
20
20
  import { z as z$1 } from "zod";
21
21
  import retry from "async-retry";
22
- import { APIError, Sandbox, Snapshot, StreamError } from "@vercel/sandbox";
22
+ import { APIError, Drive, Sandbox, Snapshot, StreamError } from "@vercel/sandbox";
23
23
  import { WebSocket } from "ws";
24
24
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
25
25
  import * as tty$1 from "tty";
@@ -475,7 +475,7 @@ var init_source = __esm({ "../../node_modules/.pnpm/chalk@5.6.0/node_modules/cha
475
475
  var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/didyoumean@1.2.2/node_modules/didyoumean/didYouMean-1.2.1.js": ((exports, module) => {
476
476
  (function() {
477
477
  "use strict";
478
- function didYouMean(str, list$3, key) {
478
+ function didYouMean(str, list$4, key) {
479
479
  if (!str) return null;
480
480
  if (!didYouMean.caseSensitive) str = str.toLowerCase();
481
481
  var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length, thresholdAbsolute = didYouMean.thresholdAbsolute, winningVal;
@@ -483,9 +483,9 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/
483
483
  else if (thresholdRelative !== null) winningVal = thresholdRelative;
484
484
  else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute;
485
485
  else winningVal = null;
486
- var winner, candidate, testCandidate, val, i, len = list$3.length;
486
+ var winner, candidate, testCandidate, val, i, len = list$4.length;
487
487
  for (i = 0; i < len; i++) {
488
- candidate = list$3[i];
488
+ candidate = list$4[i];
489
489
  if (key) candidate = candidate[key];
490
490
  if (!candidate) continue;
491
491
  if (!didYouMean.caseSensitive) testCandidate = candidate.toLowerCase();
@@ -493,7 +493,7 @@ var require_didYouMean_1_2_1 = /* @__PURE__ */ __commonJS({ "../../node_modules/
493
493
  val = getEditDistance(str, testCandidate, winningVal);
494
494
  if (winningVal === null || val < winningVal) {
495
495
  winningVal = val;
496
- if (key && didYouMean.returnWinningObject) winner = list$3[i];
496
+ if (key && didYouMean.returnWinningObject) winner = list$4[i];
497
497
  else winner = candidate;
498
498
  if (didYouMean.returnFirstMatch) return winner;
499
499
  }
@@ -1443,7 +1443,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
1443
1443
  return mod && mod.__esModule ? mod : { "default": mod };
1444
1444
  };
1445
1445
  Object.defineProperty(exports, "__esModule", { value: true });
1446
- exports.subcommands = subcommands$3;
1446
+ exports.subcommands = subcommands$4;
1447
1447
  const chalk_1$3 = __importDefault$4((init_source(), __toCommonJS$3(source_exports)));
1448
1448
  const didyoumean_1 = __importDefault$4(require_didYouMean_1_2_1());
1449
1449
  const Result$7 = __importStar$7(require_Result());
@@ -1453,7 +1453,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
1453
1453
  /**
1454
1454
  * Combine multiple `command`s into one
1455
1455
  */
1456
- function subcommands$3(config$1) {
1456
+ function subcommands$4(config$1) {
1457
1457
  const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config$1.version);
1458
1458
  const subcommand = (0, positional_1$1.positional)({
1459
1459
  displayName: "subcommand",
@@ -2994,9 +2994,9 @@ var require_cjs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/cmd-ts@
2994
2994
 
2995
2995
  //#endregion
2996
2996
  //#region src/args/runtime.ts
2997
- var import_cjs$31 = /* @__PURE__ */ __toESM(require_cjs());
2997
+ var import_cjs$34 = /* @__PURE__ */ __toESM(require_cjs());
2998
2998
  const runtimeType = {
2999
- ...import_cjs$31.oneOf([
2999
+ ...import_cjs$34.oneOf([
3000
3000
  "node22",
3001
3001
  "node24",
3002
3002
  "node26",
@@ -3004,9 +3004,9 @@ const runtimeType = {
3004
3004
  ]),
3005
3005
  displayName: "runtime"
3006
3006
  };
3007
- const runtime = import_cjs$31.option({
3007
+ const runtime = import_cjs$34.option({
3008
3008
  long: "runtime",
3009
- type: import_cjs$31.optional(runtimeType)
3009
+ type: import_cjs$34.optional(runtimeType)
3010
3010
  });
3011
3011
 
3012
3012
  //#endregion
@@ -3130,9 +3130,9 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ms@2.1.3
3130
3130
 
3131
3131
  //#endregion
3132
3132
  //#region src/types/duration.ts
3133
- var import_cjs$30 = require_cjs();
3133
+ var import_cjs$33 = require_cjs();
3134
3134
  init_source();
3135
- const Duration = (0, import_cjs$30.extendType)(import_cjs$30.string, {
3135
+ const Duration = (0, import_cjs$33.extendType)(import_cjs$33.string, {
3136
3136
  displayName: "num UNIT",
3137
3137
  description: "A duration, e.g. 5m, 10s, 1h",
3138
3138
  async from(string$2) {
@@ -3148,8 +3148,8 @@ const Duration = (0, import_cjs$30.extendType)(import_cjs$30.string, {
3148
3148
 
3149
3149
  //#endregion
3150
3150
  //#region src/args/timeout.ts
3151
- var import_cjs$29 = /* @__PURE__ */ __toESM(require_cjs());
3152
- const timeout = import_cjs$29.option({
3151
+ var import_cjs$32 = /* @__PURE__ */ __toESM(require_cjs());
3152
+ const timeout = import_cjs$32.option({
3153
3153
  long: "timeout",
3154
3154
  type: Duration,
3155
3155
  description: "The maximum duration a sandbox can run for. Example: 5m, 30m",
@@ -3159,17 +3159,17 @@ const timeout = import_cjs$29.option({
3159
3159
 
3160
3160
  //#endregion
3161
3161
  //#region src/args/vcpus.ts
3162
- var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
3163
- const vcpusType = import_cjs$28.extendType(import_cjs$28.number, {
3162
+ var import_cjs$31 = /* @__PURE__ */ __toESM(require_cjs());
3163
+ const vcpusType = import_cjs$31.extendType(import_cjs$31.number, {
3164
3164
  displayName: "COUNT",
3165
3165
  async from(n) {
3166
3166
  if (!Number.isInteger(n) || n < 1) throw new Error(`Invalid vCPU count: ${n}. Must be a positive integer.`);
3167
3167
  return n;
3168
3168
  }
3169
3169
  });
3170
- const vcpus = import_cjs$28.option({
3170
+ const vcpus = import_cjs$31.option({
3171
3171
  long: "vcpus",
3172
- type: import_cjs$28.optional(vcpusType),
3172
+ type: import_cjs$31.optional(vcpusType),
3173
3173
  description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
3174
3174
  });
3175
3175
 
@@ -6748,10 +6748,10 @@ function _usingCtx() {
6748
6748
 
6749
6749
  //#endregion
6750
6750
  //#region src/commands/login.ts
6751
- var import_cjs$27 = /* @__PURE__ */ __toESM(require_cjs());
6751
+ var import_cjs$30 = /* @__PURE__ */ __toESM(require_cjs());
6752
6752
  init_source();
6753
6753
  const debug$8 = createDebugger("sandbox:login");
6754
- const login = import_cjs$27.command({
6754
+ const login = import_cjs$30.command({
6755
6755
  name: "login",
6756
6756
  description: "Log in to the Sandbox CLI",
6757
6757
  args: {},
@@ -6969,7 +6969,7 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@verce
6969
6969
 
6970
6970
  //#endregion
6971
6971
  //#region src/args/auth.ts
6972
- var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
6972
+ var import_cjs$29 = /* @__PURE__ */ __toESM(require_cjs());
6973
6973
  init_source();
6974
6974
  var import_dist = require_dist();
6975
6975
  const debug$7 = createDebugger("sandbox:args:auth");
@@ -6986,11 +6986,11 @@ function isTokenFresh() {
6986
6986
  function markTokenAsFresh() {
6987
6987
  freshTokenAcquiredAt = Date.now();
6988
6988
  }
6989
- const token = import_cjs$26.option({
6989
+ const token = import_cjs$29.option({
6990
6990
  long: "token",
6991
6991
  description: "A Vercel authentication token. If not provided, will use the token stored in your system from `VERCEL_AUTH_TOKEN` or will start a log in process.",
6992
6992
  type: {
6993
- ...import_cjs$26.string,
6993
+ ...import_cjs$29.string,
6994
6994
  displayName: "pat_or_oidc",
6995
6995
  defaultValueIsSerializable: false,
6996
6996
  onMissing: async () => {
@@ -7173,30 +7173,30 @@ function getAuthFailureStatus(error) {
7173
7173
 
7174
7174
  //#endregion
7175
7175
  //#region src/args/scope.ts
7176
- var import_cjs$25 = /* @__PURE__ */ __toESM(require_cjs());
7176
+ var import_cjs$28 = /* @__PURE__ */ __toESM(require_cjs());
7177
7177
  init_source();
7178
7178
  const debug$4 = createDebugger("sandbox:scope");
7179
- const project = import_cjs$25.option({
7179
+ const project = import_cjs$28.option({
7180
7180
  long: "project",
7181
7181
  type: {
7182
- ...import_cjs$25.optional(import_cjs$25.string),
7182
+ ...import_cjs$28.optional(import_cjs$28.string),
7183
7183
  displayName: "my-project"
7184
7184
  },
7185
7185
  description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
7186
7186
  });
7187
7187
  /** Parser for the `--team` option. */
7188
- const teamParser = import_cjs$25.option({
7188
+ const teamParser = import_cjs$28.option({
7189
7189
  long: "team",
7190
7190
  type: {
7191
- ...import_cjs$25.optional(import_cjs$25.string),
7191
+ ...import_cjs$28.optional(import_cjs$28.string),
7192
7192
  displayName: "my-team"
7193
7193
  }
7194
7194
  });
7195
7195
  /** Parser for the `--scope` option. */
7196
- const scopeParser = import_cjs$25.option({
7196
+ const scopeParser = import_cjs$28.option({
7197
7197
  long: "scope",
7198
7198
  type: {
7199
- ...import_cjs$25.optional(import_cjs$25.string),
7199
+ ...import_cjs$28.optional(import_cjs$28.string),
7200
7200
  displayName: "my-team"
7201
7201
  },
7202
7202
  description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
@@ -7286,7 +7286,7 @@ const scope = {
7286
7286
 
7287
7287
  //#endregion
7288
7288
  //#region package.json
7289
- var version = "3.4.1";
7289
+ var version = "3.5.0-beta.0";
7290
7290
 
7291
7291
  //#endregion
7292
7292
  //#region src/error.ts
@@ -7416,6 +7416,17 @@ const snapshotClient = {
7416
7416
  ...params
7417
7417
  }))
7418
7418
  };
7419
+ const driveClient = {
7420
+ getOrCreate: (params) => withErrorHandling(() => Drive.getOrCreate({
7421
+ fetch: fetchWithUserAgent,
7422
+ ...params
7423
+ })),
7424
+ list: (params) => withErrorHandling(() => Drive.list({
7425
+ fetch: fetchWithUserAgent,
7426
+ ...params
7427
+ })),
7428
+ delete: (drive) => withErrorHandling(() => drive.delete())
7429
+ };
7419
7430
  const fetchWithUserAgent = (input, init$1) => {
7420
7431
  const headers = new Headers(init$1?.headers ?? (input && typeof input === "object" && "headers" in input ? input?.headers : {}));
7421
7432
  let agent = `vercel/sandbox-cli/${version}`;
@@ -7438,9 +7449,9 @@ async function withErrorHandling(factory) {
7438
7449
 
7439
7450
  //#endregion
7440
7451
  //#region src/args/snapshot-id.ts
7441
- var import_cjs$24 = /* @__PURE__ */ __toESM(require_cjs());
7452
+ var import_cjs$27 = /* @__PURE__ */ __toESM(require_cjs());
7442
7453
  init_source();
7443
- const snapshotId = import_cjs$24.extendType(import_cjs$24.string, {
7454
+ const snapshotId = import_cjs$27.extendType(import_cjs$27.string, {
7444
7455
  displayName: "snapshot_id",
7445
7456
  description: "The ID of the snapshot",
7446
7457
  async from(s$1) {
@@ -7451,13 +7462,13 @@ const snapshotId = import_cjs$24.extendType(import_cjs$24.string, {
7451
7462
 
7452
7463
  //#endregion
7453
7464
  //#region src/args/ports.ts
7454
- var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
7465
+ var import_cjs$26 = /* @__PURE__ */ __toESM(require_cjs());
7455
7466
  init_source();
7456
- const publishPorts = import_cjs$23.multioption({
7467
+ const publishPorts = import_cjs$26.multioption({
7457
7468
  long: "publish-port",
7458
7469
  short: "p",
7459
7470
  description: "Publish sandbox port(s) to DOMAIN.vercel.run",
7460
- type: import_cjs$23.array(import_cjs$23.extendType(import_cjs$23.number, {
7471
+ type: import_cjs$26.array(import_cjs$26.extendType(import_cjs$26.number, {
7461
7472
  displayName: "PORT",
7462
7473
  async from(number) {
7463
7474
  if (!Number.isInteger(number) || number < 1024 || number > 65535) throw new Error([
@@ -7472,8 +7483,8 @@ const publishPorts = import_cjs$23.multioption({
7472
7483
 
7473
7484
  //#endregion
7474
7485
  //#region src/types/snapshot-expiration.ts
7475
- var import_cjs$22 = require_cjs();
7476
- const SnapshotExpiration = (0, import_cjs$22.extendType)(import_cjs$22.string, {
7486
+ var import_cjs$25 = require_cjs();
7487
+ const SnapshotExpiration = (0, import_cjs$25.extendType)(import_cjs$25.string, {
7477
7488
  displayName: "DURATION|none",
7478
7489
  description: "A duration (e.g. 7d, 30d) or \"none\" for no expiration",
7479
7490
  async from(value) {
@@ -7484,15 +7495,15 @@ const SnapshotExpiration = (0, import_cjs$22.extendType)(import_cjs$22.string, {
7484
7495
 
7485
7496
  //#endregion
7486
7497
  //#region src/args/snapshot-retention.ts
7487
- var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
7488
- const snapshotExpiration = import_cjs$21.option({
7498
+ var import_cjs$24 = /* @__PURE__ */ __toESM(require_cjs());
7499
+ const snapshotExpiration = import_cjs$24.option({
7489
7500
  long: "snapshot-expiration",
7490
- type: import_cjs$21.optional(SnapshotExpiration),
7501
+ type: import_cjs$24.optional(SnapshotExpiration),
7491
7502
  description: "Default snapshot expiration. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
7492
7503
  });
7493
- const keepLastSnapshots = import_cjs$21.option({
7504
+ const keepLastSnapshots = import_cjs$24.option({
7494
7505
  long: "keep-last-snapshots",
7495
- type: import_cjs$21.optional(import_cjs$21.extendType(import_cjs$21.number, {
7506
+ type: import_cjs$24.optional(import_cjs$24.extendType(import_cjs$24.number, {
7496
7507
  displayName: "COUNT",
7497
7508
  async from(n) {
7498
7509
  if (!Number.isInteger(n) || n < 1 || n > 10) throw new Error(`Invalid --keep-last-snapshots value: ${n}. Must be an integer between 1 and 10.`);
@@ -7501,15 +7512,15 @@ const keepLastSnapshots = import_cjs$21.option({
7501
7512
  })),
7502
7513
  description: "Keep only the N most recent snapshots of this sandbox (1-10)."
7503
7514
  });
7504
- const keepLastSnapshotsFor = import_cjs$21.option({
7515
+ const keepLastSnapshotsFor = import_cjs$24.option({
7505
7516
  long: "keep-last-snapshots-for",
7506
- type: import_cjs$21.optional(SnapshotExpiration),
7517
+ type: import_cjs$24.optional(SnapshotExpiration),
7507
7518
  description: "Expiration applied to kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
7508
7519
  });
7509
- const deleteEvictedSnapshots = import_cjs$21.option({
7520
+ const deleteEvictedSnapshots = import_cjs$24.option({
7510
7521
  long: "delete-evicted-snapshots",
7511
- type: import_cjs$21.optional({
7512
- ...import_cjs$21.oneOf(["true", "false"]),
7522
+ type: import_cjs$24.optional({
7523
+ ...import_cjs$24.oneOf(["true", "false"]),
7513
7524
  displayName: "true|false"
7514
7525
  }),
7515
7526
  description: "When \"true\" (the default), evicted snapshots are deleted immediately; when \"false\", they keep the default expiration."
@@ -7523,9 +7534,9 @@ const snapshotRetentionArgs = {
7523
7534
 
7524
7535
  //#endregion
7525
7536
  //#region src/args/sandbox-name.ts
7526
- var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
7537
+ var import_cjs$23 = /* @__PURE__ */ __toESM(require_cjs());
7527
7538
  init_source();
7528
- const sandboxName = import_cjs$20.extendType(import_cjs$20.string, {
7539
+ const sandboxName = import_cjs$23.extendType(import_cjs$23.string, {
7529
7540
  displayName: "name",
7530
7541
  description: "The name of the sandbox",
7531
7542
  async from(s$1) {
@@ -7702,9 +7713,9 @@ function toEnvArray(env$2) {
7702
7713
 
7703
7714
  //#endregion
7704
7715
  //#region src/args/key-value-pair.ts
7705
- var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
7716
+ var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
7706
7717
  init_source();
7707
- const KeyValuePair = import_cjs$19.extendType(import_cjs$19.string, {
7718
+ const KeyValuePair = import_cjs$22.extendType(import_cjs$22.string, {
7708
7719
  displayName: "key=value",
7709
7720
  async from(input) {
7710
7721
  if (!input.includes("=")) return {
@@ -7718,7 +7729,7 @@ const KeyValuePair = import_cjs$19.extendType(import_cjs$19.string, {
7718
7729
  };
7719
7730
  }
7720
7731
  });
7721
- const ObjectFromKeyValue = import_cjs$19.extendType(import_cjs$19.array(KeyValuePair), { async from(input) {
7732
+ const ObjectFromKeyValue = import_cjs$22.extendType(import_cjs$22.array(KeyValuePair), { async from(input) {
7722
7733
  const obj = Object.create(null);
7723
7734
  const missingVars = [];
7724
7735
  for (const { key, value } of input) if (value === void 0) missingVars.push(key);
@@ -7732,28 +7743,28 @@ const ObjectFromKeyValue = import_cjs$19.extendType(import_cjs$19.array(KeyValue
7732
7743
 
7733
7744
  //#endregion
7734
7745
  //#region src/commands/exec.ts
7735
- var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
7746
+ var import_cjs$21 = /* @__PURE__ */ __toESM(require_cjs());
7736
7747
  var import_ms$5 = /* @__PURE__ */ __toESM(require_ms());
7737
7748
  init_source();
7738
7749
  const args$4 = {
7739
- sandbox: import_cjs$18.positional({ type: sandboxName }),
7740
- command: import_cjs$18.positional({
7750
+ sandbox: import_cjs$21.positional({ type: sandboxName }),
7751
+ command: import_cjs$21.positional({
7741
7752
  displayName: "command",
7742
7753
  description: "The executable to invoke"
7743
7754
  }),
7744
- args: import_cjs$18.rest({
7755
+ args: import_cjs$21.rest({
7745
7756
  displayName: "args",
7746
7757
  description: "arguments to pass to the command"
7747
7758
  }),
7748
- asSudo: import_cjs$18.flag({
7759
+ asSudo: import_cjs$21.flag({
7749
7760
  long: "sudo",
7750
7761
  description: "Give extended privileges to the command."
7751
7762
  }),
7752
- interactive: import_cjs$18.flag({
7763
+ interactive: import_cjs$21.flag({
7753
7764
  long: "interactive",
7754
7765
  short: "i",
7755
7766
  description: "Run the command in a secure interactive shell",
7756
- type: import_cjs$18.extendType(import_cjs$18.boolean, {
7767
+ type: import_cjs$21.extendType(import_cjs$21.boolean, {
7757
7768
  defaultValue() {
7758
7769
  return false;
7759
7770
  },
@@ -7763,35 +7774,35 @@ const args$4 = {
7763
7774
  }
7764
7775
  })
7765
7776
  }),
7766
- skipExtendingTimeout: import_cjs$18.flag({
7777
+ skipExtendingTimeout: import_cjs$21.flag({
7767
7778
  long: "no-extend-timeout",
7768
7779
  description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
7769
7780
  }),
7770
- tty: import_cjs$18.flag({
7781
+ tty: import_cjs$21.flag({
7771
7782
  long: "tty",
7772
7783
  short: "t",
7773
7784
  description: "Allocate a tty for an interactive command. This is a no-op."
7774
7785
  }),
7775
- cwd: import_cjs$18.option({
7786
+ cwd: import_cjs$21.option({
7776
7787
  long: "workdir",
7777
7788
  short: "w",
7778
7789
  description: "The working directory to run the command in",
7779
- type: import_cjs$18.optional(import_cjs$18.string)
7790
+ type: import_cjs$21.optional(import_cjs$21.string)
7780
7791
  }),
7781
- envVars: import_cjs$18.multioption({
7792
+ envVars: import_cjs$21.multioption({
7782
7793
  long: "env",
7783
7794
  short: "e",
7784
7795
  type: ObjectFromKeyValue,
7785
7796
  description: "Environment variables to set for the command"
7786
7797
  }),
7787
- timeout: import_cjs$18.option({
7798
+ timeout: import_cjs$21.option({
7788
7799
  long: "timeout",
7789
- type: import_cjs$18.optional(Duration),
7800
+ type: import_cjs$21.optional(Duration),
7790
7801
  description: "Maximum duration to wait for the command (e.g. 30s, 5m). On expiry the process is killed with SIGKILL. Cannot be combined with --interactive."
7791
7802
  }),
7792
7803
  scope
7793
7804
  };
7794
- const exec = import_cjs$18.command({
7805
+ const exec = import_cjs$21.command({
7795
7806
  name: "exec",
7796
7807
  description: "Execute a command in an existing sandbox",
7797
7808
  args: args$4,
@@ -7832,9 +7843,9 @@ const exec = import_cjs$18.command({
7832
7843
 
7833
7844
  //#endregion
7834
7845
  //#region src/args/network-policy.ts
7835
- var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
7846
+ var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
7836
7847
  init_source();
7837
- const networkPolicyMode = import_cjs$17.extendType(import_cjs$17.string, {
7848
+ const networkPolicyMode = import_cjs$20.extendType(import_cjs$20.string, {
7838
7849
  displayName: "MODE",
7839
7850
  async from(value) {
7840
7851
  const validModes = ["allow-all", "deny-all"];
@@ -7842,28 +7853,28 @@ const networkPolicyMode = import_cjs$17.extendType(import_cjs$17.string, {
7842
7853
  return value;
7843
7854
  }
7844
7855
  });
7845
- const networkPolicy = import_cjs$17.option({
7856
+ const networkPolicy = import_cjs$20.option({
7846
7857
  long: "network-policy",
7847
7858
  description: `Network policy mode: "allow-all" or "deny-all"
7848
7859
  - allow-all: sandbox can access any website/domain
7849
7860
  - deny-all: sandbox has no network access
7850
7861
  Omit this option and use --allowed-domain / --allowed-cidr / --denied-cidr for custom policies.`,
7851
- type: import_cjs$17.optional(networkPolicyMode)
7862
+ type: import_cjs$20.optional(networkPolicyMode)
7852
7863
  });
7853
- const allowedDomains = import_cjs$17.multioption({
7864
+ const allowedDomains = import_cjs$20.multioption({
7854
7865
  long: "allowed-domain",
7855
7866
  description: `Domain to allow traffic to (creates a custom network policy). Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com'). If used as the first segment, will match any subdomain.`,
7856
- type: import_cjs$17.array(import_cjs$17.string)
7867
+ type: import_cjs$20.array(import_cjs$20.string)
7857
7868
  });
7858
- const allowedCIDRs = import_cjs$17.multioption({
7869
+ const allowedCIDRs = import_cjs$20.multioption({
7859
7870
  long: "allowed-cidr",
7860
7871
  description: `CIDR to allow traffic to (creates a custom network policy). Takes precedence over 'allowed-domain'.`,
7861
- type: import_cjs$17.array(import_cjs$17.string)
7872
+ type: import_cjs$20.array(import_cjs$20.string)
7862
7873
  });
7863
- const deniedCIDRs = import_cjs$17.multioption({
7874
+ const deniedCIDRs = import_cjs$20.multioption({
7864
7875
  long: "denied-cidr",
7865
7876
  description: `CIDR to deny traffic to (creates a custom network policy). Takes precedence over allowed domains/CIDRs.`,
7866
- type: import_cjs$17.array(import_cjs$17.string)
7877
+ type: import_cjs$20.array(import_cjs$20.string)
7867
7878
  });
7868
7879
  const networkPolicyArgs = {
7869
7880
  networkPolicy,
@@ -7957,61 +7968,114 @@ function printSandboxSummary(opts) {
7957
7968
  } else process.stderr.write(source_default.dim(" ╰ ") + "project: " + source_default.cyan(projectDisplay) + "\n");
7958
7969
  }
7959
7970
 
7971
+ //#endregion
7972
+ //#region src/args/drive.ts
7973
+ var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
7974
+ init_source();
7975
+ const driveName = import_cjs$19.extendType(import_cjs$19.string, {
7976
+ displayName: "name",
7977
+ description: "The name of the drive",
7978
+ async from(input) {
7979
+ const value = input.trim();
7980
+ if (value.length === 0) throw new Error("Drive name cannot be empty.");
7981
+ return value;
7982
+ }
7983
+ });
7984
+ const driveMount = import_cjs$19.extendType(import_cjs$19.string, {
7985
+ displayName: "drive:path[:mode]",
7986
+ description: "Drive mount in the format \"drive:/path[:read-only|read-write]\".",
7987
+ async from(input) {
7988
+ return parseDriveMount(input);
7989
+ }
7990
+ });
7991
+ const driveMounts = import_cjs$19.extendType(import_cjs$19.array(driveMount), { async from(input) {
7992
+ const mounts$1 = Object.create(null);
7993
+ for (const mount of input) mounts$1[mount.path] = {
7994
+ drive: mount.drive,
7995
+ mode: mount.mode
7996
+ };
7997
+ return mounts$1;
7998
+ } });
7999
+ const mounts = import_cjs$19.multioption({
8000
+ long: "mount",
8001
+ type: driveMounts,
8002
+ description: "Attach a drive to the sandbox. Format: \"drive:/path[:read-only|read-write]\"."
8003
+ });
8004
+ const driveMaxSize = import_cjs$19.extendType(import_cjs$19.number, {
8005
+ displayName: "BYTES",
8006
+ async from(input) {
8007
+ if (!Number.isInteger(input) || input < 1) throw new Error(`Invalid max size: ${input}. Must be a positive integer number of bytes.`);
8008
+ return input;
8009
+ }
8010
+ });
8011
+ function parseDriveMount(input) {
8012
+ const [drive, path, mode, ...rest$1] = input.split(":");
8013
+ const validModes = ["read-only", "read-write"];
8014
+ if (rest$1.length > 0 || !drive || path === void 0) throw new Error([`Invalid drive mount: ${input}.`, `${source_default.bold("hint:")} Use "drive:/path" or "drive:/path:read-only".`].join("\n"));
8015
+ if (mode !== void 0 && !validModes.includes(mode)) throw new Error([`Invalid drive mount mode: ${mode}.`, `${source_default.bold("hint:")} Valid modes are: ${validModes.join(", ")}`].join("\n"));
8016
+ return {
8017
+ drive,
8018
+ path,
8019
+ mode
8020
+ };
8021
+ }
8022
+
7960
8023
  //#endregion
7961
8024
  //#region src/commands/create.ts
7962
- var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
8025
+ var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
7963
8026
  var import_ms$3 = /* @__PURE__ */ __toESM(require_ms());
7964
8027
  init_source();
7965
8028
  const args$3 = {
7966
- name: import_cjs$16.option({
8029
+ name: import_cjs$18.option({
7967
8030
  long: "name",
7968
8031
  description: "A user-chosen name for the sandbox. It must be unique per project.",
7969
- type: import_cjs$16.optional(import_cjs$16.string)
8032
+ type: import_cjs$18.optional(import_cjs$18.string)
7970
8033
  }),
7971
- nonPersistent: import_cjs$16.flag({
8034
+ nonPersistent: import_cjs$18.flag({
7972
8035
  long: "non-persistent",
7973
8036
  description: "Disable automatic restore of the filesystem between sessions."
7974
8037
  }),
7975
8038
  runtime,
7976
- image: import_cjs$16.option({
8039
+ image: import_cjs$18.option({
7977
8040
  long: "image",
7978
8041
  description: "A Vercel Container Registry (VCR) image name and optional tag or sha to start the sandbox from (e.g. my-repo, my-repo:v1).",
7979
- type: import_cjs$16.optional(import_cjs$16.string)
8042
+ type: import_cjs$18.optional(import_cjs$18.string)
7980
8043
  }),
7981
8044
  timeout,
7982
8045
  vcpus,
7983
8046
  ports: publishPorts,
7984
- silent: import_cjs$16.flag({
8047
+ silent: import_cjs$18.flag({
7985
8048
  long: "silent",
7986
8049
  description: "Don't write sandbox name to stdout"
7987
8050
  }),
7988
- snapshot: import_cjs$16.option({
8051
+ snapshot: import_cjs$18.option({
7989
8052
  long: "snapshot",
7990
8053
  short: "s",
7991
8054
  description: "Start the sandbox from a snapshot ID",
7992
- type: import_cjs$16.optional(snapshotId)
8055
+ type: import_cjs$18.optional(snapshotId)
7993
8056
  }),
7994
- connect: import_cjs$16.flag({
8057
+ connect: import_cjs$18.flag({
7995
8058
  long: "connect",
7996
8059
  description: "Start an interactive shell session after creating the sandbox"
7997
8060
  }),
7998
- envVars: import_cjs$16.multioption({
8061
+ envVars: import_cjs$18.multioption({
7999
8062
  long: "env",
8000
8063
  short: "e",
8001
8064
  type: ObjectFromKeyValue,
8002
8065
  description: "Default environment variables for sandbox commands"
8003
8066
  }),
8004
- tags: import_cjs$16.multioption({
8067
+ tags: import_cjs$18.multioption({
8005
8068
  long: "tag",
8006
8069
  short: "t",
8007
8070
  type: ObjectFromKeyValue,
8008
8071
  description: "Key-value tags to associate with the sandbox (e.g. --tag env=staging)"
8009
8072
  }),
8073
+ mounts,
8010
8074
  ...snapshotRetentionArgs,
8011
8075
  ...networkPolicyArgs,
8012
8076
  scope
8013
8077
  };
8014
- const create = import_cjs$16.command({
8078
+ const create = import_cjs$18.command({
8015
8079
  name: "create",
8016
8080
  description: "Create a sandbox in the specified account and project.",
8017
8081
  args: args$3,
@@ -8019,7 +8083,7 @@ const create = import_cjs$16.command({
8019
8083
  description: "Create and connect to a sandbox without a network access",
8020
8084
  command: `sandbox run --network-policy=none --connect`
8021
8085
  }],
8022
- async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, image, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$1, envVars, tags, snapshotExpiration: snapshotExpiration$1, keepLastSnapshots: keepLastSnapshots$1, keepLastSnapshotsFor: keepLastSnapshotsFor$1, deleteEvictedSnapshots: deleteEvictedSnapshots$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
8086
+ async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, image, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$1, envVars, tags, mounts: mounts$1, snapshotExpiration: snapshotExpiration$1, keepLastSnapshots: keepLastSnapshots$1, keepLastSnapshotsFor: keepLastSnapshotsFor$1, deleteEvictedSnapshots: deleteEvictedSnapshots$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
8023
8087
  if (image && runtime$1) throw new Error("--image and --runtime cannot be used together.");
8024
8088
  const networkPolicy$1 = buildNetworkPolicy({
8025
8089
  networkPolicy: networkPolicyMode$1,
@@ -8035,6 +8099,7 @@ const create = import_cjs$16.command({
8035
8099
  const persistent = !nonPersistent;
8036
8100
  const resources = vcpus$1 ? { vcpus: vcpus$1 } : void 0;
8037
8101
  const tagsObj = Object.keys(tags).length > 0 ? tags : void 0;
8102
+ const mountsObj = Object.keys(mounts$1).length > 0 ? mounts$1 : void 0;
8038
8103
  const spinner = silent ? void 0 : ora("Creating sandbox...").start();
8039
8104
  const sandbox = snapshot$1 ? await sandboxClient.create({
8040
8105
  name,
@@ -8051,6 +8116,7 @@ const create = import_cjs$16.command({
8051
8116
  networkPolicy: networkPolicy$1,
8052
8117
  env: envVars,
8053
8118
  tags: tagsObj,
8119
+ mounts: mountsObj,
8054
8120
  persistent,
8055
8121
  snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
8056
8122
  keepLastSnapshots: keepLastSnapshotsPayload,
@@ -8067,6 +8133,7 @@ const create = import_cjs$16.command({
8067
8133
  networkPolicy: networkPolicy$1,
8068
8134
  env: envVars,
8069
8135
  tags: tagsObj,
8136
+ mounts: mountsObj,
8070
8137
  persistent,
8071
8138
  snapshotExpiration: snapshotExpiration$1 ? (0, import_ms$3.default)(snapshotExpiration$1) : void 0,
8072
8139
  keepLastSnapshots: keepLastSnapshotsPayload,
@@ -8110,8 +8177,8 @@ function omit(obj, ...keys) {
8110
8177
 
8111
8178
  //#endregion
8112
8179
  //#region src/commands/sh.ts
8113
- var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
8114
- const sh = import_cjs$15.command({
8180
+ var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
8181
+ const sh = import_cjs$17.command({
8115
8182
  name: "sh",
8116
8183
  description: "Create a sandbox and start an interactive shell",
8117
8184
  args: omit(args$3, "connect"),
@@ -8125,46 +8192,46 @@ const sh = import_cjs$15.command({
8125
8192
 
8126
8193
  //#endregion
8127
8194
  //#region src/commands/fork.ts
8128
- var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
8195
+ var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
8129
8196
  var import_ms$2 = /* @__PURE__ */ __toESM(require_ms());
8130
8197
  init_source();
8131
8198
  const args$2 = {
8132
- source: import_cjs$14.positional({
8199
+ source: import_cjs$16.positional({
8133
8200
  displayName: "source",
8134
8201
  description: "Name of the source sandbox to fork from.",
8135
8202
  type: sandboxName
8136
8203
  }),
8137
- name: import_cjs$14.option({
8204
+ name: import_cjs$16.option({
8138
8205
  long: "name",
8139
8206
  description: "A user-chosen name for the forked sandbox. Must be unique per project.",
8140
- type: import_cjs$14.optional(import_cjs$14.string)
8207
+ type: import_cjs$16.optional(import_cjs$16.string)
8141
8208
  }),
8142
- nonPersistent: import_cjs$14.flag({
8209
+ nonPersistent: import_cjs$16.flag({
8143
8210
  long: "non-persistent",
8144
8211
  description: "Disable automatic restore of the filesystem between sessions."
8145
8212
  }),
8146
- timeout: import_cjs$14.option({
8213
+ timeout: import_cjs$16.option({
8147
8214
  long: "timeout",
8148
- type: import_cjs$14.optional(Duration),
8215
+ type: import_cjs$16.optional(Duration),
8149
8216
  description: "Override the maximum sandbox runtime (inherited from source if omitted). Example: 5m, 30m"
8150
8217
  }),
8151
8218
  vcpus,
8152
8219
  ports: publishPorts,
8153
- silent: import_cjs$14.flag({
8220
+ silent: import_cjs$16.flag({
8154
8221
  long: "silent",
8155
8222
  description: "Don't write sandbox name to stdout"
8156
8223
  }),
8157
- connect: import_cjs$14.flag({
8224
+ connect: import_cjs$16.flag({
8158
8225
  long: "connect",
8159
8226
  description: "Start an interactive shell session after creating the forked sandbox"
8160
8227
  }),
8161
- envVars: import_cjs$14.multioption({
8228
+ envVars: import_cjs$16.multioption({
8162
8229
  long: "env",
8163
8230
  short: "e",
8164
8231
  type: ObjectFromKeyValue,
8165
8232
  description: "Environment variables to set on the fork. Env vars from the source sandbox are not copied (encrypted server-side)."
8166
8233
  }),
8167
- tags: import_cjs$14.multioption({
8234
+ tags: import_cjs$16.multioption({
8168
8235
  long: "tag",
8169
8236
  short: "t",
8170
8237
  type: ObjectFromKeyValue,
@@ -8174,7 +8241,7 @@ const args$2 = {
8174
8241
  ...networkPolicyArgs,
8175
8242
  scope
8176
8243
  };
8177
- const fork = import_cjs$14.command({
8244
+ const fork = import_cjs$16.command({
8178
8245
  name: "fork",
8179
8246
  description: "Fork an existing sandbox into a new one. Copies config (cpu, timeout, network policy, tags, etc.) from the source sandbox; env vars are NOT copied and must be re-supplied via --env.",
8180
8247
  args: args$2,
@@ -8247,20 +8314,20 @@ const fork = import_cjs$14.command({
8247
8314
 
8248
8315
  //#endregion
8249
8316
  //#region src/commands/run.ts
8250
- var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
8317
+ var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
8251
8318
  const args$1 = {
8252
8319
  ...args$3,
8253
8320
  ...omit(args$4, "sandbox", "timeout"),
8254
- removeAfterUse: import_cjs$13.flag({
8321
+ removeAfterUse: import_cjs$15.flag({
8255
8322
  long: "rm",
8256
8323
  description: "Automatically remove the sandbox when the command exits."
8257
8324
  }),
8258
- stopAfterUse: import_cjs$13.flag({
8325
+ stopAfterUse: import_cjs$15.flag({
8259
8326
  long: "stop",
8260
8327
  description: "Stop the sandbox when the command exits."
8261
8328
  })
8262
8329
  };
8263
- const run = import_cjs$13.command({
8330
+ const run = import_cjs$15.command({
8264
8331
  name: "run",
8265
8332
  description: "Create and run a command in a sandbox",
8266
8333
  args: args$1,
@@ -8302,51 +8369,51 @@ const run = import_cjs$13.command({
8302
8369
 
8303
8370
  //#endregion
8304
8371
  //#region src/commands/list.ts
8305
- var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
8372
+ var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
8306
8373
  init_source();
8307
- const list = import_cjs$12.command({
8374
+ const list = import_cjs$14.command({
8308
8375
  name: "list",
8309
8376
  aliases: ["ls"],
8310
8377
  description: "List all sandboxes for the specified account and project.",
8311
8378
  args: {
8312
- all: import_cjs$12.flag({
8379
+ all: import_cjs$14.flag({
8313
8380
  long: "all",
8314
8381
  short: "a",
8315
8382
  description: "Show all sandboxes (default shows just running)"
8316
8383
  }),
8317
- namePrefix: import_cjs$12.option({
8384
+ namePrefix: import_cjs$14.option({
8318
8385
  long: "name-prefix",
8319
8386
  description: "Filter sandboxes by name prefix",
8320
- type: import_cjs$12.optional(import_cjs$12.string)
8387
+ type: import_cjs$14.optional(import_cjs$14.string)
8321
8388
  }),
8322
- sortBy: import_cjs$12.option({
8389
+ sortBy: import_cjs$14.option({
8323
8390
  long: "sort-by",
8324
8391
  description: "Sort sandboxes by field. Options: createdAt (default), name, statusUpdatedAt",
8325
- type: import_cjs$12.optional(import_cjs$12.oneOf([
8392
+ type: import_cjs$14.optional(import_cjs$14.oneOf([
8326
8393
  "createdAt",
8327
8394
  "name",
8328
8395
  "statusUpdatedAt"
8329
8396
  ]))
8330
8397
  }),
8331
- sortOrder: import_cjs$12.option({
8398
+ sortOrder: import_cjs$14.option({
8332
8399
  long: "sort-order",
8333
8400
  description: "Sort order. Options: asc, desc (default)",
8334
- type: import_cjs$12.optional(import_cjs$12.oneOf(["asc", "desc"]))
8401
+ type: import_cjs$14.optional(import_cjs$14.oneOf(["asc", "desc"]))
8335
8402
  }),
8336
- tags: import_cjs$12.multioption({
8403
+ tags: import_cjs$14.multioption({
8337
8404
  long: "tag",
8338
8405
  description: "Filter sandboxes by tag. Format: \"key=value\"",
8339
8406
  type: ObjectFromKeyValue
8340
8407
  }),
8341
- limit: import_cjs$12.option({
8408
+ limit: import_cjs$14.option({
8342
8409
  long: "limit",
8343
8410
  description: "Maximum number of sandboxes per page (default 50).",
8344
- type: import_cjs$12.optional(import_cjs$12.number)
8411
+ type: import_cjs$14.optional(import_cjs$14.number)
8345
8412
  }),
8346
- cursor: import_cjs$12.option({
8413
+ cursor: import_cjs$14.option({
8347
8414
  long: "cursor",
8348
8415
  description: "Pagination cursor from a previous 'More results' hint.",
8349
- type: import_cjs$12.optional(import_cjs$12.string)
8416
+ type: import_cjs$14.optional(import_cjs$14.string)
8350
8417
  }),
8351
8418
  scope
8352
8419
  },
@@ -8400,6 +8467,7 @@ const list = import_cjs$12.command({
8400
8467
  return "-";
8401
8468
  } },
8402
8469
  SNAPSHOT: { value: (s$1) => s$1.currentSnapshotId ?? "-" },
8470
+ MOUNTS: { value: (s$1) => formatMounts(s$1.mounts) },
8403
8471
  TAGS: { value: (s$1) => s$1.tags && Object.keys(s$1.tags).length > 0 ? Object.entries(s$1.tags).map(([k, v]) => `${k}:${v}`).join(", ") : "-" }
8404
8472
  };
8405
8473
  if (all) {
@@ -8422,11 +8490,15 @@ const SandboxStatusColor = {
8422
8490
  snapshotting: source_default.blue,
8423
8491
  aborted: source_default.gray.dim
8424
8492
  };
8493
+ function formatMounts(mounts$1) {
8494
+ if (!mounts$1 || Object.keys(mounts$1).length === 0) return "-";
8495
+ return Object.entries(mounts$1).map(([path, mount]) => `${mount.drive}:${path}:${mount.mode ?? "read-write"}`).join(", ");
8496
+ }
8425
8497
 
8426
8498
  //#endregion
8427
8499
  //#region src/commands/connect.ts
8428
- var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
8429
- const connect = import_cjs$11.command({
8500
+ var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
8501
+ const connect = import_cjs$13.command({
8430
8502
  name: "connect",
8431
8503
  aliases: ["ssh", "shell"],
8432
8504
  description: "Start an interactive shell in an existing sandbox",
@@ -8444,7 +8516,7 @@ const connect = import_cjs$11.command({
8444
8516
 
8445
8517
  //#endregion
8446
8518
  //#region src/commands/stop.ts
8447
- var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
8519
+ var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
8448
8520
  init_source();
8449
8521
  function c(label, value) {
8450
8522
  return {
@@ -8497,15 +8569,15 @@ function printStopResult(name, sandbox, sessionSnapshot) {
8497
8569
  ]] : []
8498
8570
  ]);
8499
8571
  }
8500
- const stop = import_cjs$10.command({
8572
+ const stop = import_cjs$12.command({
8501
8573
  name: "stop",
8502
8574
  description: "Stop the current session of one or more sandboxes",
8503
8575
  args: {
8504
- sandboxName: import_cjs$10.positional({
8576
+ sandboxName: import_cjs$12.positional({
8505
8577
  type: sandboxName,
8506
8578
  description: "A sandbox name to stop"
8507
8579
  }),
8508
- sandboxNames: import_cjs$10.restPositionals({
8580
+ sandboxNames: import_cjs$12.restPositionals({
8509
8581
  type: sandboxName,
8510
8582
  description: "More sandboxes to stop"
8511
8583
  }),
@@ -10827,17 +10899,17 @@ var Listr = class {
10827
10899
 
10828
10900
  //#endregion
10829
10901
  //#region src/commands/remove.ts
10830
- var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
10831
- const remove = import_cjs$9.command({
10902
+ var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
10903
+ const remove = import_cjs$11.command({
10832
10904
  name: "remove",
10833
10905
  aliases: ["rm"],
10834
10906
  description: "Permanently remove one or more sandboxes",
10835
10907
  args: {
10836
- sandboxName: import_cjs$9.positional({
10908
+ sandboxName: import_cjs$11.positional({
10837
10909
  type: sandboxName,
10838
10910
  description: "a sandbox name to remove"
10839
10911
  }),
10840
- sandboxNames: import_cjs$9.restPositionals({
10912
+ sandboxNames: import_cjs$11.restPositionals({
10841
10913
  type: sandboxName,
10842
10914
  description: "more sandboxes to remove"
10843
10915
  }),
@@ -10865,7 +10937,7 @@ const remove = import_cjs$9.command({
10865
10937
 
10866
10938
  //#endregion
10867
10939
  //#region src/commands/cp.ts
10868
- var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
10940
+ var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
10869
10941
  init_source();
10870
10942
  const parseLocalOrRemotePath = async (input) => {
10871
10943
  const parts = input.split(":");
@@ -10887,18 +10959,18 @@ const parseLocalOrRemotePath = async (input) => {
10887
10959
  path: input
10888
10960
  };
10889
10961
  };
10890
- const localOrRemote = import_cjs$8.extendType(import_cjs$8.string, { from: parseLocalOrRemotePath });
10891
- const cp = import_cjs$8.command({
10962
+ const localOrRemote = import_cjs$10.extendType(import_cjs$10.string, { from: parseLocalOrRemotePath });
10963
+ const cp = import_cjs$10.command({
10892
10964
  name: "copy",
10893
10965
  description: "Copy files between your local filesystem and a remote sandbox",
10894
10966
  aliases: ["cp"],
10895
10967
  args: {
10896
- source: import_cjs$8.positional({
10968
+ source: import_cjs$10.positional({
10897
10969
  displayName: `src`,
10898
10970
  description: `The source file to copy from local file system, or a sandbox_name:path from a remote sandbox`,
10899
10971
  type: localOrRemote
10900
10972
  }),
10901
- dest: import_cjs$8.positional({
10973
+ dest: import_cjs$10.positional({
10902
10974
  displayName: `dst`,
10903
10975
  description: `The destination file to copy to local file system, or a sandbox_name:path to a remote sandbox`,
10904
10976
  type: localOrRemote
@@ -10945,10 +11017,10 @@ const cp = import_cjs$8.command({
10945
11017
 
10946
11018
  //#endregion
10947
11019
  //#region src/commands/logout.ts
10948
- var import_cjs$7 = /* @__PURE__ */ __toESM(require_cjs());
11020
+ var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
10949
11021
  init_source();
10950
11022
  const debug = createDebugger("sandbox:logout");
10951
- const logout = import_cjs$7.command({
11023
+ const logout = import_cjs$9.command({
10952
11024
  name: "logout",
10953
11025
  description: "Log out of the Sandbox CLI",
10954
11026
  args: {},
@@ -10967,27 +11039,27 @@ const logout = import_cjs$7.command({
10967
11039
 
10968
11040
  //#endregion
10969
11041
  //#region src/commands/snapshot.ts
10970
- var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
11042
+ var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
10971
11043
  init_source();
10972
11044
  var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
10973
11045
  const args = {
10974
- stop: import_cjs$6.flag({
11046
+ stop: import_cjs$8.flag({
10975
11047
  long: "stop",
10976
11048
  description: "Confirm that the sandbox will be stopped when snapshotting"
10977
11049
  }),
10978
- silent: import_cjs$6.flag({
11050
+ silent: import_cjs$8.flag({
10979
11051
  long: "silent",
10980
11052
  description: "Don't write snapshot ID to stdout"
10981
11053
  }),
10982
- expiration: import_cjs$6.option({
11054
+ expiration: import_cjs$8.option({
10983
11055
  long: "expiration",
10984
- type: import_cjs$6.optional(Duration),
11056
+ type: import_cjs$8.optional(Duration),
10985
11057
  description: "The expiration time of the snapshot. Use 0 for no expiration."
10986
11058
  }),
10987
- sandbox: import_cjs$6.positional({ type: sandboxName }),
11059
+ sandbox: import_cjs$8.positional({ type: sandboxName }),
10988
11060
  scope
10989
11061
  };
10990
- const snapshot = import_cjs$6.command({
11062
+ const snapshot = import_cjs$8.command({
10991
11063
  name: "snapshot",
10992
11064
  description: "Take a snapshot of the filesystem of a sandbox",
10993
11065
  args,
@@ -11090,34 +11162,34 @@ function renderSnapshotTree(params) {
11090
11162
 
11091
11163
  //#endregion
11092
11164
  //#region src/commands/snapshots.ts
11093
- var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
11094
- var import_cjs$5 = require_cjs();
11165
+ var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
11166
+ var import_cjs$7 = require_cjs();
11095
11167
  init_source();
11096
- const list$2 = import_cjs$4.command({
11168
+ const list$3 = import_cjs$6.command({
11097
11169
  name: "list",
11098
11170
  aliases: ["ls"],
11099
11171
  description: "List snapshots for the specified account and project.",
11100
11172
  args: {
11101
11173
  scope,
11102
- name: import_cjs$4.option({
11103
- type: import_cjs$4.optional(sandboxName),
11174
+ name: import_cjs$6.option({
11175
+ type: import_cjs$6.optional(sandboxName),
11104
11176
  long: "name",
11105
11177
  description: "Filter snapshots by sandbox."
11106
11178
  }),
11107
- sortOrder: import_cjs$4.option({
11179
+ sortOrder: import_cjs$6.option({
11108
11180
  long: "sort-order",
11109
11181
  description: "Sort order. Options: asc, desc (default)",
11110
- type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
11182
+ type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
11111
11183
  }),
11112
- limit: import_cjs$4.option({
11184
+ limit: import_cjs$6.option({
11113
11185
  long: "limit",
11114
11186
  description: "Maximum number of snapshots per page (default 50).",
11115
- type: import_cjs$4.optional(import_cjs$4.number)
11187
+ type: import_cjs$6.optional(import_cjs$6.number)
11116
11188
  }),
11117
- cursor: import_cjs$4.option({
11189
+ cursor: import_cjs$6.option({
11118
11190
  long: "cursor",
11119
11191
  description: "Pagination cursor from a previous 'More results' hint.",
11120
- type: import_cjs$4.optional(import_cjs$4.string)
11192
+ type: import_cjs$6.optional(import_cjs$6.string)
11121
11193
  })
11122
11194
  },
11123
11195
  async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, sortOrder, limit, cursor }) {
@@ -11157,12 +11229,12 @@ const list$2 = import_cjs$4.command({
11157
11229
  if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
11158
11230
  }
11159
11231
  });
11160
- const get = import_cjs$4.command({
11232
+ const get = import_cjs$6.command({
11161
11233
  name: "get",
11162
11234
  description: "Get details of a snapshot.",
11163
11235
  args: {
11164
11236
  scope,
11165
- snapshotId: import_cjs$4.positional({
11237
+ snapshotId: import_cjs$6.positional({
11166
11238
  type: snapshotId,
11167
11239
  description: "Snapshot ID to retrieve"
11168
11240
  })
@@ -11200,16 +11272,16 @@ const get = import_cjs$4.command({
11200
11272
  }));
11201
11273
  }
11202
11274
  });
11203
- const remove$1 = import_cjs$4.command({
11275
+ const remove$2 = import_cjs$6.command({
11204
11276
  name: "delete",
11205
11277
  aliases: ["rm", "remove"],
11206
11278
  description: "Delete one or more snapshots.",
11207
11279
  args: {
11208
- snapshotId: import_cjs$4.positional({
11280
+ snapshotId: import_cjs$6.positional({
11209
11281
  type: snapshotId,
11210
11282
  description: "Snapshot ID to delete"
11211
11283
  }),
11212
- snapshotIds: import_cjs$4.restPositionals({
11284
+ snapshotIds: import_cjs$6.restPositionals({
11213
11285
  type: snapshotId,
11214
11286
  description: "More snapshots IDs to delete"
11215
11287
  }),
@@ -11238,29 +11310,29 @@ const remove$1 = import_cjs$4.command({
11238
11310
  }
11239
11311
  }
11240
11312
  });
11241
- const tree = import_cjs$4.command({
11313
+ const tree = import_cjs$6.command({
11242
11314
  name: "tree",
11243
11315
  description: "Show the snapshot ancestry tree for a sandbox.",
11244
11316
  args: {
11245
11317
  scope,
11246
- sandboxName: import_cjs$4.positional({
11318
+ sandboxName: import_cjs$6.positional({
11247
11319
  type: sandboxName,
11248
11320
  description: "Sandbox name"
11249
11321
  }),
11250
- sortOrder: import_cjs$4.option({
11322
+ sortOrder: import_cjs$6.option({
11251
11323
  long: "sort-order",
11252
11324
  description: "Sort order. Options: asc, desc (default). 'desc' walks ancestors, 'asc' walks descendants. Requires --cursor.",
11253
- type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
11325
+ type: import_cjs$6.optional(import_cjs$6.oneOf(["asc", "desc"]))
11254
11326
  }),
11255
- limit: import_cjs$4.option({
11327
+ limit: import_cjs$6.option({
11256
11328
  long: "limit",
11257
11329
  description: "Maximum number of snapshots per page (1–10, default 10).",
11258
- type: import_cjs$4.optional(import_cjs$4.number)
11330
+ type: import_cjs$6.optional(import_cjs$6.number)
11259
11331
  }),
11260
- cursor: import_cjs$4.option({
11332
+ cursor: import_cjs$6.option({
11261
11333
  long: "cursor",
11262
11334
  description: "Pagination cursor from a previous 'More ancestors' or 'More descendants' hint.",
11263
- type: import_cjs$4.optional(import_cjs$4.string)
11335
+ type: import_cjs$6.optional(import_cjs$6.string)
11264
11336
  })
11265
11337
  },
11266
11338
  async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: name, sortOrder, limit, cursor }) {
@@ -11381,14 +11453,14 @@ const tree = import_cjs$4.command({
11381
11453
  if (result.descendants.pagination.next !== null) console.log(`More descendants: sandbox snapshots tree ${name} --sort-order asc${limitArg} --cursor ${result.descendants.pagination.next}`);
11382
11454
  }
11383
11455
  });
11384
- const snapshots = (0, import_cjs$5.subcommands)({
11456
+ const snapshots = (0, import_cjs$7.subcommands)({
11385
11457
  name: "snapshots",
11386
11458
  description: "Manage sandbox snapshots",
11387
11459
  cmds: {
11388
- list: list$2,
11460
+ list: list$3,
11389
11461
  get,
11390
11462
  tree,
11391
- delete: remove$1
11463
+ delete: remove$2
11392
11464
  }
11393
11465
  });
11394
11466
  const SnapshotStatusColor = new Map([
@@ -11399,37 +11471,37 @@ const SnapshotStatusColor = new Map([
11399
11471
 
11400
11472
  //#endregion
11401
11473
  //#region src/commands/sessions.ts
11402
- var import_cjs$2 = /* @__PURE__ */ __toESM(require_cjs());
11403
- var import_cjs$3 = require_cjs();
11474
+ var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
11475
+ var import_cjs$5 = require_cjs();
11404
11476
  init_source();
11405
- const list$1 = import_cjs$2.command({
11477
+ const list$2 = import_cjs$4.command({
11406
11478
  name: "list",
11407
11479
  aliases: ["ls"],
11408
11480
  description: "List sessions from a sandbox",
11409
11481
  args: {
11410
- all: import_cjs$2.flag({
11482
+ all: import_cjs$4.flag({
11411
11483
  long: "all",
11412
11484
  short: "a",
11413
11485
  description: "Show all sessions (default shows just running)"
11414
11486
  }),
11415
- sandbox: import_cjs$2.positional({
11487
+ sandbox: import_cjs$4.positional({
11416
11488
  type: sandboxName,
11417
11489
  description: "Sandbox name to list sessions for"
11418
11490
  }),
11419
- sortOrder: import_cjs$2.option({
11491
+ sortOrder: import_cjs$4.option({
11420
11492
  long: "sort-order",
11421
11493
  description: "Sort order. Options: asc, desc (default)",
11422
- type: import_cjs$2.optional(import_cjs$2.oneOf(["asc", "desc"]))
11494
+ type: import_cjs$4.optional(import_cjs$4.oneOf(["asc", "desc"]))
11423
11495
  }),
11424
- limit: import_cjs$2.option({
11496
+ limit: import_cjs$4.option({
11425
11497
  long: "limit",
11426
11498
  description: "Maximum number of sessions per page (default 50).",
11427
- type: import_cjs$2.optional(import_cjs$2.number)
11499
+ type: import_cjs$4.optional(import_cjs$4.number)
11428
11500
  }),
11429
- cursor: import_cjs$2.option({
11501
+ cursor: import_cjs$4.option({
11430
11502
  long: "cursor",
11431
11503
  description: "Pagination cursor from a previous 'More results' hint.",
11432
- type: import_cjs$2.optional(import_cjs$2.string)
11504
+ type: import_cjs$4.optional(import_cjs$4.string)
11433
11505
  }),
11434
11506
  scope
11435
11507
  },
@@ -11485,10 +11557,10 @@ const list$1 = import_cjs$2.command({
11485
11557
  if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
11486
11558
  }
11487
11559
  });
11488
- const sessions = (0, import_cjs$3.subcommands)({
11560
+ const sessions = (0, import_cjs$5.subcommands)({
11489
11561
  name: "sessions",
11490
11562
  description: "Manage sandbox sessions",
11491
- cmds: { list: list$1 }
11563
+ cmds: { list: list$2 }
11492
11564
  });
11493
11565
  const SessionStatusColor = {
11494
11566
  running: source_default.cyan,
@@ -11502,18 +11574,18 @@ const SessionStatusColor = {
11502
11574
 
11503
11575
  //#endregion
11504
11576
  //#region src/commands/config.ts
11505
- var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
11577
+ var import_cjs$3 = /* @__PURE__ */ __toESM(require_cjs());
11506
11578
  init_source();
11507
11579
  var import_ms = /* @__PURE__ */ __toESM(require_ms());
11508
- const vcpusCommand = import_cjs$1.command({
11580
+ const vcpusCommand = import_cjs$3.command({
11509
11581
  name: "vcpus",
11510
11582
  description: "Update the vCPU count of a sandbox",
11511
11583
  args: {
11512
- sandbox: import_cjs$1.positional({
11584
+ sandbox: import_cjs$3.positional({
11513
11585
  type: sandboxName,
11514
11586
  description: "Sandbox name to update"
11515
11587
  }),
11516
- count: import_cjs$1.positional({
11588
+ count: import_cjs$3.positional({
11517
11589
  type: vcpusType,
11518
11590
  description: "Number of vCPUs to allocate (each vCPU includes 2048 MB of memory)"
11519
11591
  }),
@@ -11538,15 +11610,15 @@ const vcpusCommand = import_cjs$1.command({
11538
11610
  }
11539
11611
  }
11540
11612
  });
11541
- const timeoutCommand = import_cjs$1.command({
11613
+ const timeoutCommand = import_cjs$3.command({
11542
11614
  name: "timeout",
11543
11615
  description: "Update the timeout of a sandbox (will be applied to all new sessions)",
11544
11616
  args: {
11545
- sandbox: import_cjs$1.positional({
11617
+ sandbox: import_cjs$3.positional({
11546
11618
  type: sandboxName,
11547
11619
  description: "Sandbox name to update"
11548
11620
  }),
11549
- duration: import_cjs$1.positional({
11621
+ duration: import_cjs$3.positional({
11550
11622
  type: Duration,
11551
11623
  description: "The maximum duration a sandbox can run for. Example: 5m, 1h"
11552
11624
  }),
@@ -11571,17 +11643,17 @@ const timeoutCommand = import_cjs$1.command({
11571
11643
  }
11572
11644
  }
11573
11645
  });
11574
- const persistentCommand = import_cjs$1.command({
11646
+ const persistentCommand = import_cjs$3.command({
11575
11647
  name: "persistent",
11576
11648
  description: "Enable or disable automatic restore of the filesystem between sessions",
11577
11649
  args: {
11578
- sandbox: import_cjs$1.positional({
11650
+ sandbox: import_cjs$3.positional({
11579
11651
  type: sandboxName,
11580
11652
  description: "Sandbox name to update"
11581
11653
  }),
11582
- value: import_cjs$1.positional({
11654
+ value: import_cjs$3.positional({
11583
11655
  type: {
11584
- ...import_cjs$1.oneOf(["true", "false"]),
11656
+ ...import_cjs$3.oneOf(["true", "false"]),
11585
11657
  displayName: "true|false"
11586
11658
  },
11587
11659
  description: "Enable or disable automatic restore of the filesystem between sessions"
@@ -11607,15 +11679,15 @@ const persistentCommand = import_cjs$1.command({
11607
11679
  }
11608
11680
  }
11609
11681
  });
11610
- const snapshotExpirationCommand = import_cjs$1.command({
11682
+ const snapshotExpirationCommand = import_cjs$3.command({
11611
11683
  name: "snapshot-expiration",
11612
11684
  description: "Update the default snapshot expiration of a sandbox",
11613
11685
  args: {
11614
- sandbox: import_cjs$1.positional({
11686
+ sandbox: import_cjs$3.positional({
11615
11687
  type: sandboxName,
11616
11688
  description: "Sandbox name to update"
11617
11689
  }),
11618
- duration: import_cjs$1.positional({
11690
+ duration: import_cjs$3.positional({
11619
11691
  type: SnapshotExpiration,
11620
11692
  description: "Snapshot expiration duration (e.g. 7d, 30d) or \"none\" for no expiration"
11621
11693
  }),
@@ -11641,22 +11713,22 @@ const snapshotExpirationCommand = import_cjs$1.command({
11641
11713
  }
11642
11714
  }
11643
11715
  });
11644
- const keepLastCountType = import_cjs$1.extendType(import_cjs$1.number, {
11716
+ const keepLastCountType = import_cjs$3.extendType(import_cjs$3.number, {
11645
11717
  displayName: "COUNT",
11646
11718
  async from(n) {
11647
11719
  if (!Number.isInteger(n) || n < 0 || n > 10) throw new Error(`Invalid count: ${n}. Must be an integer between 0 and 10 (0 removes the policy).`);
11648
11720
  return n;
11649
11721
  }
11650
11722
  });
11651
- const keepLastSnapshotsCommand = import_cjs$1.command({
11723
+ const keepLastSnapshotsCommand = import_cjs$3.command({
11652
11724
  name: "keep-last-snapshots",
11653
11725
  description: "Update the snapshot retention policy (keep only the N most recent snapshots) of a sandbox",
11654
11726
  args: {
11655
- sandbox: import_cjs$1.positional({
11727
+ sandbox: import_cjs$3.positional({
11656
11728
  type: sandboxName,
11657
11729
  description: "Sandbox name to update"
11658
11730
  }),
11659
- count: import_cjs$1.positional({
11731
+ count: import_cjs$3.positional({
11660
11732
  type: keepLastCountType,
11661
11733
  description: "Number of most recent snapshots to keep (1-10). Pass 0 to remove the policy."
11662
11734
  }),
@@ -11689,15 +11761,15 @@ const keepLastSnapshotsCommand = import_cjs$1.command({
11689
11761
  }
11690
11762
  }
11691
11763
  });
11692
- const keepLastSnapshotsForCommand = import_cjs$1.command({
11764
+ const keepLastSnapshotsForCommand = import_cjs$3.command({
11693
11765
  name: "keep-last-snapshots-for",
11694
11766
  description: "Update the expiration applied to snapshots kept by the retention policy",
11695
11767
  args: {
11696
- sandbox: import_cjs$1.positional({
11768
+ sandbox: import_cjs$3.positional({
11697
11769
  type: sandboxName,
11698
11770
  description: "Sandbox name to update"
11699
11771
  }),
11700
- duration: import_cjs$1.positional({
11772
+ duration: import_cjs$3.positional({
11701
11773
  type: SnapshotExpiration,
11702
11774
  description: "Expiration for kept snapshots. Use \"none\" or 0 for no expiration. Example: 7d, 30d"
11703
11775
  }),
@@ -11729,17 +11801,17 @@ const keepLastSnapshotsForCommand = import_cjs$1.command({
11729
11801
  }
11730
11802
  }
11731
11803
  });
11732
- const deleteEvictedSnapshotsCommand = import_cjs$1.command({
11804
+ const deleteEvictedSnapshotsCommand = import_cjs$3.command({
11733
11805
  name: "delete-evicted-snapshots",
11734
11806
  description: "When \"true\" (the default), snapshots evicted by the keep-last-snapshots policy are deleted immediately; when \"false\", they keep the default expiration.",
11735
11807
  args: {
11736
- sandbox: import_cjs$1.positional({
11808
+ sandbox: import_cjs$3.positional({
11737
11809
  type: sandboxName,
11738
11810
  description: "Sandbox name to update"
11739
11811
  }),
11740
- value: import_cjs$1.positional({
11812
+ value: import_cjs$3.positional({
11741
11813
  type: {
11742
- ...import_cjs$1.oneOf(["true", "false"]),
11814
+ ...import_cjs$3.oneOf(["true", "false"]),
11743
11815
  displayName: "true|false"
11744
11816
  },
11745
11817
  description: "Whether to delete evicted snapshots immediately (\"true\") or let them keep the default expiration (\"false\")."
@@ -11771,15 +11843,15 @@ const deleteEvictedSnapshotsCommand = import_cjs$1.command({
11771
11843
  }
11772
11844
  }
11773
11845
  });
11774
- const currentSnapshotCommand = import_cjs$1.command({
11846
+ const currentSnapshotCommand = import_cjs$3.command({
11775
11847
  name: "current-snapshot",
11776
11848
  description: "Update the current snapshot of a sandbox",
11777
11849
  args: {
11778
- sandbox: import_cjs$1.positional({
11850
+ sandbox: import_cjs$3.positional({
11779
11851
  type: sandboxName,
11780
11852
  description: "Sandbox name to update"
11781
11853
  }),
11782
- snapshotId: import_cjs$1.positional({
11854
+ snapshotId: import_cjs$3.positional({
11783
11855
  type: snapshotId,
11784
11856
  description: "Snapshot ID to set as the current snapshot"
11785
11857
  }),
@@ -11805,11 +11877,11 @@ const currentSnapshotCommand = import_cjs$1.command({
11805
11877
  }
11806
11878
  }
11807
11879
  });
11808
- const portsCommand = import_cjs$1.command({
11880
+ const portsCommand = import_cjs$3.command({
11809
11881
  name: "ports",
11810
11882
  description: "Update the published ports of a sandbox. Replaces all existing published ports.",
11811
11883
  args: {
11812
- sandbox: import_cjs$1.positional({
11884
+ sandbox: import_cjs$3.positional({
11813
11885
  type: sandboxName,
11814
11886
  description: "Sandbox name to update"
11815
11887
  }),
@@ -11846,11 +11918,11 @@ const portsCommand = import_cjs$1.command({
11846
11918
  }
11847
11919
  }
11848
11920
  });
11849
- const listCommand = import_cjs$1.command({
11921
+ const listCommand = import_cjs$3.command({
11850
11922
  name: "list",
11851
11923
  description: "Display the current configuration of a sandbox",
11852
11924
  args: {
11853
- sandbox: import_cjs$1.positional({
11925
+ sandbox: import_cjs$3.positional({
11854
11926
  type: sandboxName,
11855
11927
  description: "Sandbox name to inspect"
11856
11928
  }),
@@ -11925,16 +11997,16 @@ const listCommand = import_cjs$1.command({
11925
11997
  }));
11926
11998
  }
11927
11999
  });
11928
- const networkPolicyCommand = import_cjs$1.command({
12000
+ const networkPolicyCommand = import_cjs$3.command({
11929
12001
  name: "network-policy",
11930
12002
  description: `Update the network policy of a sandbox`,
11931
12003
  args: {
11932
- sandbox: import_cjs$1.positional({ type: sandboxName }),
12004
+ sandbox: import_cjs$3.positional({ type: sandboxName }),
11933
12005
  ...networkPolicyArgs,
11934
- mode: import_cjs$1.option({
12006
+ mode: import_cjs$3.option({
11935
12007
  long: "mode",
11936
12008
  description: `Alias for --network-policy.`,
11937
- type: import_cjs$1.optional(networkPolicyMode)
12009
+ type: import_cjs$3.optional(networkPolicyMode)
11938
12010
  }),
11939
12011
  scope
11940
12012
  },
@@ -11966,15 +12038,15 @@ const networkPolicyCommand = import_cjs$1.command({
11966
12038
  }
11967
12039
  }
11968
12040
  });
11969
- const tagsCommand = import_cjs$1.command({
12041
+ const tagsCommand = import_cjs$3.command({
11970
12042
  name: "tags",
11971
12043
  description: "Update the tags of a sandbox. Replaces all existing tags with the provided tags.",
11972
12044
  args: {
11973
- sandbox: import_cjs$1.positional({
12045
+ sandbox: import_cjs$3.positional({
11974
12046
  type: sandboxName,
11975
12047
  description: "Sandbox name to update"
11976
12048
  }),
11977
- tags: import_cjs$1.multioption({
12049
+ tags: import_cjs$3.multioption({
11978
12050
  long: "tag",
11979
12051
  short: "t",
11980
12052
  type: ObjectFromKeyValue,
@@ -12023,7 +12095,7 @@ function formatPorts(sandbox) {
12023
12095
  function getPublishedRoutes(sandbox) {
12024
12096
  return sandbox.routes.filter((route) => route.port !== sandbox.interactivePort);
12025
12097
  }
12026
- const config = import_cjs$1.subcommands({
12098
+ const config = import_cjs$3.subcommands({
12027
12099
  name: "config",
12028
12100
  description: "View and update sandbox configuration",
12029
12101
  cmds: {
@@ -12042,6 +12114,181 @@ const config = import_cjs$1.subcommands({
12042
12114
  }
12043
12115
  });
12044
12116
 
12117
+ //#endregion
12118
+ //#region src/commands/drives.ts
12119
+ var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
12120
+ var import_cjs$2 = require_cjs();
12121
+ init_source();
12122
+ const list$1 = import_cjs$1.command({
12123
+ name: "list",
12124
+ aliases: ["ls"],
12125
+ description: "List drives for the specified account and project.",
12126
+ args: {
12127
+ scope,
12128
+ namePrefix: import_cjs$1.option({
12129
+ long: "name-prefix",
12130
+ description: "Filter drives by name prefix.",
12131
+ type: import_cjs$1.optional(import_cjs$1.string)
12132
+ }),
12133
+ sortOrder: import_cjs$1.option({
12134
+ long: "sort-order",
12135
+ description: "Sort order. Options: asc, desc (default).",
12136
+ type: import_cjs$1.optional(import_cjs$1.oneOf(["asc", "desc"]))
12137
+ }),
12138
+ limit: import_cjs$1.option({
12139
+ long: "limit",
12140
+ description: "Maximum number of drives per page (default 50).",
12141
+ type: import_cjs$1.optional(import_cjs$1.number)
12142
+ }),
12143
+ cursor: import_cjs$1.option({
12144
+ long: "cursor",
12145
+ description: "Pagination cursor from a previous 'More results' hint.",
12146
+ type: import_cjs$1.optional(import_cjs$1.string)
12147
+ })
12148
+ },
12149
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, namePrefix, sortOrder, limit, cursor }) {
12150
+ const { drives: drives$1, pagination } = await (async () => {
12151
+ try {
12152
+ var _usingCtx$1 = _usingCtx();
12153
+ const _spinner$1 = _usingCtx$1.u(acquireRelease(() => ora("Fetching drives...").start(), (s$1) => s$1.stop()));
12154
+ return driveClient.list({
12155
+ token: token$1,
12156
+ teamId: team$1,
12157
+ projectId: project$1,
12158
+ limit: limit ?? 50,
12159
+ ...cursor && { cursor },
12160
+ ...namePrefix && {
12161
+ namePrefix,
12162
+ sortBy: "name"
12163
+ },
12164
+ ...sortOrder && { sortOrder }
12165
+ });
12166
+ } catch (_) {
12167
+ _usingCtx$1.e = _;
12168
+ } finally {
12169
+ _usingCtx$1.d();
12170
+ }
12171
+ })();
12172
+ printDrives(drives$1);
12173
+ if (pagination.next !== null) console.log(formatNextCursorHint(pagination.next));
12174
+ }
12175
+ });
12176
+ const getOrCreate = import_cjs$1.command({
12177
+ name: "get-or-create",
12178
+ description: "Create a drive if it does not already exist, or retrieve it.",
12179
+ args: {
12180
+ name: import_cjs$1.positional({
12181
+ type: driveName,
12182
+ description: "Drive name to create or retrieve"
12183
+ }),
12184
+ maxSize: import_cjs$1.option({
12185
+ long: "max-size",
12186
+ description: "Maximum drive size in bytes. If omitted, a default of 100 GiB is used.",
12187
+ type: import_cjs$1.optional(driveMaxSize)
12188
+ }),
12189
+ scope
12190
+ },
12191
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, maxSize }) {
12192
+ const drive = await (async () => {
12193
+ try {
12194
+ var _usingCtx3 = _usingCtx();
12195
+ const _spinner$1 = _usingCtx3.u(acquireRelease(() => ora("Creating drive...").start(), (s$1) => s$1.stop()));
12196
+ return driveClient.getOrCreate({
12197
+ token: token$1,
12198
+ teamId: team$1,
12199
+ projectId: project$1,
12200
+ name,
12201
+ maxSize
12202
+ });
12203
+ } catch (_) {
12204
+ _usingCtx3.e = _;
12205
+ } finally {
12206
+ _usingCtx3.d();
12207
+ }
12208
+ })();
12209
+ process.stderr.write("✅ Drive " + source_default.cyan(drive.name) + " ready.\n");
12210
+ process.stderr.write(source_default.dim(" │ ") + "max size: " + source_default.cyan(formatDriveSize(drive)) + "\n");
12211
+ process.stderr.write(source_default.dim(" ╰ ") + "created: " + source_default.cyan(timeAgo(drive.createdAt)) + "\n");
12212
+ }
12213
+ });
12214
+ const remove$1 = import_cjs$1.command({
12215
+ name: "delete",
12216
+ aliases: ["rm", "remove"],
12217
+ description: "Delete one or more drives.",
12218
+ args: {
12219
+ name: import_cjs$1.positional({
12220
+ type: driveName,
12221
+ description: "Drive name to delete"
12222
+ }),
12223
+ names: import_cjs$1.restPositionals({
12224
+ type: driveName,
12225
+ description: "More drive names to delete"
12226
+ }),
12227
+ scope
12228
+ },
12229
+ async handler({ scope: { token: token$1, team: team$1, project: project$1 }, name, names }) {
12230
+ const tasks = Array.from(new Set([name, ...names]), (driveName$1) => {
12231
+ return {
12232
+ title: `Deleting drive ${driveName$1}`,
12233
+ async task() {
12234
+ const drive = await getDriveByName({
12235
+ token: token$1,
12236
+ teamId: team$1,
12237
+ projectId: project$1,
12238
+ name: driveName$1
12239
+ });
12240
+ if (drive.currentSandboxName || drive.currentSessionId) throw new Error(`Drive ${driveName$1} is attached to a sandbox and cannot be deleted.`);
12241
+ await driveClient.delete(drive);
12242
+ }
12243
+ };
12244
+ });
12245
+ try {
12246
+ await new Listr(tasks, { concurrent: true }).run();
12247
+ } catch {
12248
+ process.exitCode = 1;
12249
+ }
12250
+ }
12251
+ });
12252
+ const drives = (0, import_cjs$2.subcommands)({
12253
+ name: "drives",
12254
+ description: "Manage sandbox drives",
12255
+ cmds: {
12256
+ list: list$1,
12257
+ "get-or-create": getOrCreate,
12258
+ delete: remove$1
12259
+ }
12260
+ });
12261
+ function printDrives(drives$1) {
12262
+ console.log(table({
12263
+ rows: drives$1,
12264
+ columns: {
12265
+ NAME: { value: (v) => v.name },
12266
+ CREATED: { value: (v) => timeAgo(v.createdAt) },
12267
+ UPDATED: { value: (v) => timeAgo(v.updatedAt) },
12268
+ SIZE: { value: formatDriveSize },
12269
+ ["ATTACHED SANDBOX"]: { value: (v) => v.currentSandboxName ?? "-" },
12270
+ ["ATTACHED SESSION"]: { value: (v) => v.currentSessionId ?? "-" }
12271
+ }
12272
+ }));
12273
+ }
12274
+ function formatDriveSize(drive) {
12275
+ return drive.maxSize === void 0 ? "-" : formatBytes(drive.maxSize);
12276
+ }
12277
+ async function getDriveByName({ token: token$1, teamId, projectId, name }) {
12278
+ const { drives: drives$1 } = await driveClient.list({
12279
+ token: token$1,
12280
+ teamId,
12281
+ projectId,
12282
+ namePrefix: name,
12283
+ sortBy: "name",
12284
+ sortOrder: "asc",
12285
+ limit: 50
12286
+ });
12287
+ const drive = drives$1.find((drive$1) => drive$1.name === name);
12288
+ if (!drive) throw new Error([`Drive ${name} was not found.`, `${source_default.bold("hint:")} Create it with: sandbox drives get-or-create ${name}`].join("\n"));
12289
+ return drive;
12290
+ }
12291
+
12045
12292
  //#endregion
12046
12293
  //#region src/app.ts
12047
12294
  var import_cjs = require_cjs();
@@ -12064,6 +12311,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
12064
12311
  snapshot,
12065
12312
  snapshots,
12066
12313
  sessions,
12314
+ drives,
12067
12315
  ...!opts?.withoutAuth && {
12068
12316
  login,
12069
12317
  logout
@@ -12087,4 +12335,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
12087
12335
 
12088
12336
  //#endregion
12089
12337
  export { source_exports as a, init_source as i, printTopLevelError as n, require_cjs as r, app as t };
12090
- //# sourceMappingURL=app-nsazwNvd.mjs.map
12338
+ //# sourceMappingURL=app-CFX0H5jm.mjs.map