sandbox 3.0.0-beta.20 → 3.0.0-beta.22

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.
@@ -3002,6 +3002,7 @@ const runtimeType = {
3002
3002
  ...import_cjs$27.oneOf([
3003
3003
  "node22",
3004
3004
  "node24",
3005
+ "node26",
3005
3006
  "python3.13"
3006
3007
  ]),
3007
3008
  displayName: "runtime"
@@ -7235,7 +7236,7 @@ const scope = {
7235
7236
 
7236
7237
  //#endregion
7237
7238
  //#region package.json
7238
- var version = "3.0.0-beta.20";
7239
+ var version = "3.0.0-beta.22";
7239
7240
 
7240
7241
  //#endregion
7241
7242
  //#region src/error.ts
@@ -7273,7 +7274,11 @@ const snapshotClient = {
7273
7274
  fetch: fetchWithUserAgent,
7274
7275
  ...params
7275
7276
  })),
7276
- get: (params) => withErrorHandling(Snapshot.get({ ...params }))
7277
+ get: (params) => withErrorHandling(Snapshot.get({ ...params })),
7278
+ fromSandbox: (name, opts) => withErrorHandling(Snapshot.fromSandbox(name, {
7279
+ fetch: fetchWithUserAgent,
7280
+ ...opts
7281
+ }))
7277
7282
  };
7278
7283
  const fetchWithUserAgent = (input, init$1) => {
7279
7284
  const headers = new Headers(init$1?.headers ?? (input && typeof input === "object" && "headers" in input ? input?.headers : {}));
@@ -11590,6 +11595,11 @@ const args$2 = {
11590
11595
  description: "Start the sandbox from a snapshot ID",
11591
11596
  type: import_cjs$14.optional(snapshotId)
11592
11597
  }),
11598
+ sandboxSnapshot: import_cjs$14.option({
11599
+ long: "sandbox-snapshot",
11600
+ description: "Start the sandbox from another sandbox's current snapshot",
11601
+ type: import_cjs$14.optional(sandboxName)
11602
+ }),
11593
11603
  connect: import_cjs$14.flag({
11594
11604
  long: "connect",
11595
11605
  description: "Start an interactive shell session after creating the sandbox"
@@ -11622,7 +11632,8 @@ const create = import_cjs$14.command({
11622
11632
  description: "Create and connect to a sandbox without a network access",
11623
11633
  command: `sandbox run --network-policy=none --connect`
11624
11634
  }],
11625
- async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, connect: connect$2, envVars, tags, snapshotExpiration, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
11635
+ async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, vcpus: vcpus$1, silent, snapshot: snapshot$1, sandboxSnapshot, connect: connect$2, envVars, tags, snapshotExpiration, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
11636
+ if (snapshot$1 && sandboxSnapshot) throw new Error([`Cannot use --snapshot and --sandbox-snapshot together.`, `${source_default.bold("hint:")} Pick one source for the new sandbox.`].join("\n"));
11626
11637
  const networkPolicy$1 = buildNetworkPolicy({
11627
11638
  networkPolicy: networkPolicyMode$1,
11628
11639
  allowedDomains: allowedDomains$1,
@@ -11632,12 +11643,17 @@ const create = import_cjs$14.command({
11632
11643
  const persistent = !nonPersistent;
11633
11644
  const resources = vcpus$1 ? { vcpus: vcpus$1 } : void 0;
11634
11645
  const tagsObj = Object.keys(tags).length > 0 ? tags : void 0;
11646
+ const resolvedSnapshot = snapshot$1 ?? (sandboxSnapshot ? await snapshotClient.fromSandbox(sandboxSnapshot, {
11647
+ teamId: scope$1.team,
11648
+ projectId: scope$1.project,
11649
+ token: scope$1.token
11650
+ }) : void 0);
11635
11651
  const spinner = silent ? void 0 : ora("Creating sandbox...").start();
11636
- const sandbox = snapshot$1 ? await sandboxClient.create({
11652
+ const sandbox = resolvedSnapshot ? await sandboxClient.create({
11637
11653
  name,
11638
11654
  source: {
11639
11655
  type: "snapshot",
11640
- snapshotId: snapshot$1
11656
+ snapshotId: resolvedSnapshot
11641
11657
  },
11642
11658
  teamId: scope$1.team,
11643
11659
  projectId: scope$1.project,
@@ -15140,4 +15156,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
15140
15156
 
15141
15157
  //#endregion
15142
15158
  export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
15143
- //# sourceMappingURL=app-DfdLC3Kn.mjs.map
15159
+ //# sourceMappingURL=app-BvadkI4m.mjs.map