@mastra/e2b 0.15.1-alpha.0 → 0.15.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.
package/dist/index.cjs CHANGED
@@ -76,8 +76,7 @@ function createDefaultMountableTemplate(options) {
76
76
  }
77
77
  };
78
78
  }
79
- //#endregion
80
- //#region ../../packages/_internals/workspace/dist/index.js
79
+ // ../../packages/_internals/workspace/dist/index.js
81
80
  /** Directory, relative to the template's build cwd, that holds every marker below. */
82
81
  const SETUP_MARKER_DIR = ".mastra-sandbox";
83
82
  /**
@@ -477,7 +476,8 @@ var FilesApiFilesystem = class extends _mastra_core_workspace.MastraFilesystem {
477
476
  type: info.type === "dir" ? "directory" : "file",
478
477
  size: info.type === "dir" ? 0 : info.size,
479
478
  createdAt: modifiedAt,
480
- modifiedAt
479
+ modifiedAt,
480
+ ...info.type !== "dir" && { mimeType: (0, _mastra_core_workspace.getMimeType)(abs) }
481
481
  };
482
482
  });
483
483
  }
@@ -723,8 +723,7 @@ var CommandsApiProcessManager = class extends _mastra_core_workspace.SandboxProc
723
723
  }
724
724
  }
725
725
  };
726
- //#endregion
727
- //#region src/sandbox/filesystem.ts
726
+ // src/sandbox/filesystem.ts
728
727
  /**
729
728
  * envd's edge answers a paused or missing sandbox with a 404 that the SDK
730
729
  * reports as `FileNotFoundError`. Same pattern as `E2BSandbox`'s dead-sandbox
@@ -779,8 +778,7 @@ var E2BSandboxFilesystem = class extends FilesApiFilesystem {
779
778
  if (error instanceof e2b.InvalidArgumentError) return "invalid-argument";
780
779
  }
781
780
  };
782
- //#endregion
783
- //#region src/sandbox/mounts/types.ts
781
+ // src/sandbox/mounts/types.ts
784
782
  const LOG_PREFIX = "[@mastra/e2b]";
785
783
  const SAFE_S3_BUCKET_NAME = /^[a-z0-9][a-z0-9.\-]{1,61}[a-z0-9]$/;
786
784
  const SAFE_GCS_BUCKET_NAME = /^[a-z0-9][a-z0-9._-]{1,61}[a-z0-9]$/;
@@ -824,8 +822,7 @@ function validatePrefix(prefix) {
824
822
  if (/[\x00-\x1f\x7f]/.test(normalized)) throw new Error(`Invalid mount prefix: "${prefix}". Control characters are not allowed.`);
825
823
  return normalized;
826
824
  }
827
- //#endregion
828
- //#region src/utils/shell-quote.ts
825
+ // src/utils/shell-quote.ts
829
826
  /**
830
827
  * Shell-quote a single argument for safe use in a command string.
831
828
  *
@@ -836,8 +833,7 @@ function shellQuote(arg) {
836
833
  if (/^[a-zA-Z0-9._\-/@:=]+$/.test(arg)) return arg;
837
834
  return "'" + arg.replace(/'/g, "'\\''") + "'";
838
835
  }
839
- //#endregion
840
- //#region src/sandbox/mounts/s3.ts
836
+ // src/sandbox/mounts/s3.ts
841
837
  /**
842
838
  * Mount an S3 bucket using s3fs-fuse.
843
839
  */
@@ -944,8 +940,7 @@ Error details: ${installResult.stderr || installResult.stdout}`);
944
940
  }
945
941
  if ((await sandbox.commands.run(`mountpoint -q ${shellQuote(mountPath)}`)).exitCode !== 0) throw new Error(`s3fs returned exit 0 but ${mountPath} is not a mountpoint. The s3fs daemon likely failed during FUSE init (common causes: region mismatch, invalid credentials, or an S3-compatible endpoint that rejects the signature). Re-run inside the sandbox with '-f -o dbglevel=info' to see the underlying error.`);
946
942
  }
947
- //#endregion
948
- //#region src/sandbox/mounts/gcs.ts
943
+ // src/sandbox/mounts/gcs.ts
949
944
  /**
950
945
  * Mount a GCS bucket using gcsfuse.
951
946
  *
@@ -996,8 +991,7 @@ async function mountGCS(mountPath, config, ctx) {
996
991
  throw new Error(`Failed to mount GCS bucket: ${stderr || stdout || error}`);
997
992
  }
998
993
  }
999
- //#endregion
1000
- //#region src/sandbox/mounts/azure.ts
994
+ // src/sandbox/mounts/azure.ts
1001
995
  const SAFE_CONTAINER_NAME = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
1002
996
  const BLOBFUSE2_GITHUB_DEB = "https://github.com/Azure/azure-storage-fuse/releases/download/blobfuse2-2.5.1/blobfuse2-2.5.1-Ubuntu-22.04.x86_64.deb";
1003
997
  function validateContainerName(name) {
@@ -1194,8 +1188,7 @@ Error details: ${verifyResult.stderr || verifyResult.stdout || installResult?.st
1194
1188
  throw new Error(`Failed to mount Azure Blob container: ${stderr || stdout || error}`);
1195
1189
  }
1196
1190
  }
1197
- //#endregion
1198
- //#region src/sandbox/process-manager.ts
1191
+ // src/sandbox/process-manager.ts
1199
1192
  /**
1200
1193
  * E2B Process Manager
1201
1194
  *
@@ -1212,8 +1205,7 @@ var E2BProcessManager = class extends CommandsApiProcessManager {
1212
1205
  return fn(this.sandbox.e2b.commands);
1213
1206
  }
1214
1207
  };
1215
- //#endregion
1216
- //#region src/sandbox/index.ts
1208
+ // src/sandbox/index.ts
1217
1209
  /** Allowlist pattern for mount paths — absolute path with safe characters only. */
1218
1210
  const SAFE_MOUNT_PATH = /^\/[a-zA-Z0-9_.\-/]+$/;
1219
1211
  function validateMountPath(mountPath) {
@@ -2205,8 +2197,7 @@ var E2BSandbox = class E2BSandbox extends _mastra_core_workspace.MastraSandbox {
2205
2197
  }
2206
2198
  }
2207
2199
  };
2208
- //#endregion
2209
- //#region src/utils/repo-template.ts
2200
+ // src/utils/repo-template.ts
2210
2201
  /**
2211
2202
  * Sha-tagged repo templates.
2212
2203
  *
@@ -2619,8 +2610,7 @@ function assertWorkingDirectory(dir) {
2619
2610
  if (!(/^\/[A-Za-z0-9._/-]*$/.test(dir) && !dir.split("/").includes(".."))) throw new Error(`Repo template workingDirectory must be an absolute path of plain path characters (got ${JSON.stringify(dir)}); ~ and $HOME are not expanded.`);
2620
2611
  return dir;
2621
2612
  }
2622
- //#endregion
2623
- //#region src/provider.ts
2613
+ // src/provider.ts
2624
2614
  const e2bSandboxProvider = {
2625
2615
  id: "e2b",
2626
2616
  name: "E2B Sandbox",
@@ -2667,8 +2657,7 @@ const e2bSandboxProvider = {
2667
2657
  },
2668
2658
  createSandbox: (config) => new E2BSandbox(config)
2669
2659
  };
2670
- //#endregion
2671
- //#region src/factory-sandbox.ts
2660
+ // src/factory-sandbox.ts
2672
2661
  /** Applied when neither the environment setting nor a host default is set. */
2673
2662
  const DEFAULT_SETTINGS = {
2674
2663
  cpuCount: 2,
@@ -2903,8 +2892,7 @@ function mapStatus(status) {
2903
2892
  default: return "unknown";
2904
2893
  }
2905
2894
  }
2906
- //#endregion
2907
- //#region src/code-mode/transport.ts
2895
+ // src/code-mode/transport.ts
2908
2896
  /**
2909
2897
  * Code Mode — E2B transport
2910
2898
  *
@@ -3044,9 +3032,7 @@ var E2BCodeModeTransport = class {
3044
3032
  };
3045
3033
  resolveDone();
3046
3034
  return;
3047
- case "rpc":
3048
- serveRpc(frame.id, frame.tool, frame.args).catch(() => {});
3049
- return;
3035
+ case "rpc": serveRpc(frame.id, frame.tool, frame.args).catch(() => {});
3050
3036
  }
3051
3037
  };
3052
3038
  handle = await sandbox.processes.spawn(`node ${runnerPath}`, {
@@ -3108,7 +3094,6 @@ var E2BCodeModeTransport = class {
3108
3094
  }
3109
3095
  }
3110
3096
  };
3111
- //#endregion
3112
3097
  exports.DEFAULT_NODE_VERSION = DEFAULT_NODE_VERSION;
3113
3098
  exports.E2BCodeModeTransport = E2BCodeModeTransport;
3114
3099
  exports.E2BFactorySandbox = E2BFactorySandbox;