sandbox 3.2.2 → 3.3.1

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.
@@ -3006,9 +3006,7 @@ const runtimeType = {
3006
3006
  };
3007
3007
  const runtime = import_cjs$30.option({
3008
3008
  long: "runtime",
3009
- type: runtimeType,
3010
- defaultValue: () => "node24",
3011
- defaultValueIsSerializable: true
3009
+ type: import_cjs$30.optional(runtimeType)
3012
3010
  });
3013
3011
 
3014
3012
  //#endregion
@@ -7288,7 +7286,7 @@ const scope = {
7288
7286
 
7289
7287
  //#endregion
7290
7288
  //#region package.json
7291
- var version = "3.2.2";
7289
+ var version = "3.3.1";
7292
7290
 
7293
7291
  //#endregion
7294
7292
  //#region src/error.ts
@@ -7586,8 +7584,19 @@ const TERM = "xterm-256color";
7586
7584
  * A custom prompt so interactive sessions show the Vercel triangle and the
7587
7585
  * working directory (e.g. `▲ /vercel/sandbox/ `) instead of the shell's
7588
7586
  * default prompt. The server passes this through to the shell verbatim.
7587
+ *
7588
+ * This is built from primitives every POSIX shell honors so it renders the
7589
+ * same regardless of which shell a customer image ships as `/bin/sh`.
7590
+ *
7591
+ * The color escapes are wrapped in the raw readline "ignore" markers
7592
+ * `\x01` (RL_PROMPT_START_IGNORE) and `\x02` (RL_PROMPT_END_IGNORE) — the
7593
+ * same bytes that bash's `\[` / `\]` decode into. This lets bash's readline
7594
+ * exclude the (zero-width) escape sequences from its prompt-width calculation
7595
+ * so cursor positioning stays correct on long/wrapping lines and during line
7596
+ * editing. In non-bash shells these are C0 control bytes that terminals treat
7597
+ * as non-printing, so they don't affect rendering there.
7589
7598
  */
7590
- const PS1 = `▲ \\[\\e[2m\\]\\w/\\[\\e[0m\\] `;
7599
+ const PS1 = `▲ \x01\x1b[2m\x02$PWD/\x01\x1b[0m\x02 `;
7591
7600
  /**
7592
7601
  * Starts an interactive shell session with a sandbox. The API hands us a
7593
7602
  * WebSocket URL and token, and we tunnel stdin/stdout over it.
@@ -7964,6 +7973,11 @@ const args$3 = {
7964
7973
  description: "Disable automatic restore of the filesystem between sessions."
7965
7974
  }),
7966
7975
  runtime,
7976
+ image: import_cjs$15.option({
7977
+ long: "image",
7978
+ 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$15.optional(import_cjs$15.string)
7980
+ }),
7967
7981
  timeout,
7968
7982
  vcpus,
7969
7983
  ports: publishPorts,
@@ -8005,7 +8019,8 @@ const create = import_cjs$15.command({
8005
8019
  description: "Create and connect to a sandbox without a network access",
8006
8020
  command: `sandbox run --network-policy=none --connect`
8007
8021
  }],
8008
- async handler({ name, nonPersistent, ports, scope: scope$1, runtime: runtime$1, 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 }) {
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 }) {
8023
+ if (image && runtime$1) throw new Error("--image and --runtime cannot be used together.");
8009
8024
  const networkPolicy$1 = buildNetworkPolicy({
8010
8025
  networkPolicy: networkPolicyMode$1,
8011
8026
  allowedDomains: allowedDomains$1,
@@ -8046,7 +8061,7 @@ const create = import_cjs$15.command({
8046
8061
  projectId: scope$1.project,
8047
8062
  token: scope$1.token,
8048
8063
  ports,
8049
- runtime: runtime$1,
8064
+ ...image ? { image } : { runtime: runtime$1 ?? "node24" },
8050
8065
  timeout: (0, import_ms$3.default)(timeout$1),
8051
8066
  resources,
8052
8067
  networkPolicy: networkPolicy$1,
@@ -12052,4 +12067,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
12052
12067
 
12053
12068
  //#endregion
12054
12069
  export { source_exports as a, init_source as i, printTopLevelError as n, require_cjs as r, app as t };
12055
- //# sourceMappingURL=app-COo3Oifc.mjs.map
12070
+ //# sourceMappingURL=app-C0bIcnCg.mjs.map