@mastra/platform-workspace 1.10.0-alpha.0 → 1.10.0-alpha.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
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
23
  let buffer = require("buffer");
25
24
  let path = require("path");
26
25
  path = __toESM(path, 1);
@@ -29,7 +28,7 @@ let crypto = require("crypto");
29
28
  let e2b = require("e2b");
30
29
  let child_process = require("child_process");
31
30
  let util = require("util");
32
- //#region src/client.ts
31
+ // src/client.ts
33
32
  const DEFAULT_PROXY_URL = "https://workspaces.mastra.ai";
34
33
  const REGIONAL_PROXY_URLS = {
35
34
  us: "https://workspaces.us.mastra.ai",
@@ -160,8 +159,7 @@ var PlatformClient = class {
160
159
  return response;
161
160
  }
162
161
  };
163
- //#endregion
164
- //#region src/filesystem.ts
162
+ // src/filesystem.ts
165
163
  function normalizePath(input) {
166
164
  if (!input || input === ".") return "/";
167
165
  let normalized = input.startsWith("/") ? input : `/${input}`;
@@ -420,8 +418,7 @@ var PlatformFilesystem = class extends _mastra_core_workspace.MastraFilesystem {
420
418
  function matchesExtension$1(name, extension) {
421
419
  return (Array.isArray(extension) ? extension : [extension]).some((ext) => name.endsWith(ext));
422
420
  }
423
- //#endregion
424
- //#region src/template.ts
421
+ // src/template.ts
425
422
  const SERIALIZE_TEMPLATE = Symbol("serializeTemplate");
426
423
  const GET_TEMPLATE_BUILD_ENVS = Symbol("getTemplateBuildEnvs");
427
424
  const MAX_OPERATIONS = 256;
@@ -599,8 +596,7 @@ function cloneJson(value) {
599
596
  if (typeof value === "number" && !Number.isFinite(value)) throw new TypeError("Sandbox template values must contain only finite numbers");
600
597
  return value;
601
598
  }
602
- //#endregion
603
- //#region ../../packages/_internals/workspace/dist/index.js
599
+ // ../../packages/_internals/workspace/dist/index.js
604
600
  /** Directory, relative to the template's build cwd, that holds every marker below. */
605
601
  const SETUP_MARKER_DIR = ".mastra-sandbox";
606
602
  /**
@@ -1000,7 +996,8 @@ var FilesApiFilesystem = class extends _mastra_core_workspace.MastraFilesystem {
1000
996
  type: info.type === "dir" ? "directory" : "file",
1001
997
  size: info.type === "dir" ? 0 : info.size,
1002
998
  createdAt: modifiedAt,
1003
- modifiedAt
999
+ modifiedAt,
1000
+ ...info.type !== "dir" && { mimeType: (0, _mastra_core_workspace.getMimeType)(abs) }
1004
1001
  };
1005
1002
  });
1006
1003
  }
@@ -1246,8 +1243,7 @@ var CommandsApiProcessManager = class extends _mastra_core_workspace.SandboxProc
1246
1243
  }
1247
1244
  }
1248
1245
  };
1249
- //#endregion
1250
- //#region src/direct-exec.ts
1246
+ // src/direct-exec.ts
1251
1247
  /**
1252
1248
  * Direct exec client — opens Railway's tcp-proxy exec WebSocket directly using
1253
1249
  * a short-lived JWT minted by the workspace proxy's exec-lease endpoint. This
@@ -1400,8 +1396,7 @@ function execViaLease(lease, options) {
1400
1396
  }
1401
1397
  });
1402
1398
  }
1403
- //#endregion
1404
- //#region src/e2b-exec.ts
1399
+ // src/e2b-exec.ts
1405
1400
  const E2B_ENVD_VERSION = "0.4.0";
1406
1401
  const execViaE2BLease = async (lease, options) => {
1407
1402
  const stdoutChunks = [];
@@ -1468,8 +1463,7 @@ const sandboxForLease = (lease) => new e2b.Sandbox({
1468
1463
  const e2bFilesForLease = (lease) => sandboxForLease(lease).files;
1469
1464
  /** Opens E2B's commands API directly against the VM, authenticated by the exec lease. */
1470
1465
  const commandsForLease = (lease) => sandboxForLease(lease).commands;
1471
- //#endregion
1472
- //#region src/private-net-exec.ts
1466
+ // src/private-net-exec.ts
1473
1467
  /**
1474
1468
  * Thrown by {@link execViaPrivateNetwork} when the sidecar returns a non-2xx
1475
1469
  * HTTP response. This is an *application* error, not a transport error — the
@@ -1637,8 +1631,7 @@ async function execViaPrivateNetwork(instanceUrl, options) {
1637
1631
  status: response.status
1638
1632
  };
1639
1633
  }
1640
- //#endregion
1641
- //#region src/sandbox-filesystem.ts
1634
+ // src/sandbox-filesystem.ts
1642
1635
  /**
1643
1636
  * envd's edge answers a paused or missing sandbox with a 404 or 502 that the
1644
1637
  * SDK reports as `FileNotFoundError` or `TimeoutError`. Same message pattern as
@@ -1678,8 +1671,7 @@ var PlatformSandboxFilesystem = class extends FilesApiFilesystem {
1678
1671
  if (error instanceof e2b.InvalidArgumentError) return "invalid-argument";
1679
1672
  }
1680
1673
  };
1681
- //#endregion
1682
- //#region src/sandbox.ts
1674
+ // src/sandbox.ts
1683
1675
  /**
1684
1676
  * How long before a lease's stated `expiresAt` we should treat it as
1685
1677
  * expired. Avoids a race where the JWT is valid at cache-hit time but the
@@ -2953,8 +2945,7 @@ function templateHash(definition) {
2953
2945
  const { family: _family, ...content } = definition;
2954
2946
  return (0, crypto.createHash)("sha256").update(JSON.stringify(content)).digest("hex").slice(0, 16);
2955
2947
  }
2956
- //#endregion
2957
- //#region src/repo-template.ts
2948
+ // src/repo-template.ts
2958
2949
  const execFileAsync = (0, util.promisify)(child_process.execFile);
2959
2950
  const SHA_PATTERN = /^[0-9a-f]{7,40}$/i;
2960
2951
  const BUILD_TOKEN_ENV = "MASTRA_REPOSITORY_ACCESS_TOKEN";
@@ -3243,8 +3234,7 @@ async function resolveDefaultBranchHead(cloneUrl, token, execute = execFileAsync
3243
3234
  throw new Error(`git ls-remote failed: ${detail}`);
3244
3235
  }
3245
3236
  }
3246
- //#endregion
3247
- //#region src/provider.ts
3237
+ // src/provider.ts
3248
3238
  const platformSandboxProvider = {
3249
3239
  id: "platform",
3250
3240
  name: "Mastra Platform Sandbox",
@@ -3329,8 +3319,7 @@ const platformFilesystemProvider = {
3329
3319
  },
3330
3320
  createFilesystem: (config) => new PlatformFilesystem(config)
3331
3321
  };
3332
- //#endregion
3333
- //#region src/factory-sandbox.ts
3322
+ // src/factory-sandbox.ts
3334
3323
  /** Applied when neither the environment setting nor a host default is set. */
3335
3324
  const DEFAULT_SETTINGS = {
3336
3325
  cpuCount: 2,
@@ -3500,8 +3489,7 @@ function toBuild(result) {
3500
3489
  ...result.error ? { error: result.error } : {}
3501
3490
  };
3502
3491
  }
3503
- //#endregion
3504
- //#region src/address-registry.ts
3492
+ // src/address-registry.ts
3505
3493
  /**
3506
3494
  * Concrete in-process {@link SandboxAddressRegistry}. Backed by a `Map`; no
3507
3495
  * eviction policy, no TTL — entries live until an observed transport failure
@@ -3533,7 +3521,6 @@ var InProcessSandboxAddressRegistry = class {
3533
3521
  return this.#map.size;
3534
3522
  }
3535
3523
  };
3536
- //#endregion
3537
3524
  exports.InProcessSandboxAddressRegistry = InProcessSandboxAddressRegistry;
3538
3525
  exports.PlatformApiError = PlatformApiError;
3539
3526
  exports.PlatformClient = PlatformClient;