@mastra/docker 0.12.0 → 0.12.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 path = require("path");
25
24
  let util = require("util");
26
25
  let _mastra_core_workspace = require("@mastra/core/workspace");
@@ -33,7 +32,7 @@ path_posix = __toESM(path_posix, 1);
33
32
  let _grpc_grpc_js = require("@grpc/grpc-js");
34
33
  let crypto = require("crypto");
35
34
  let child_process = require("child_process");
36
- //#region src/abort.ts
35
+ // src/abort.ts
37
36
  function createAbortError(signal, operation) {
38
37
  return new _mastra_core_workspace.SandboxAbortError(operation, signal.reason);
39
38
  }
@@ -64,8 +63,7 @@ function waitForAbortable(promise, signal, operation, onAbort) {
64
63
  });
65
64
  });
66
65
  }
67
- //#endregion
68
- //#region src/sandbox/process-manager.ts
66
+ // src/sandbox/process-manager.ts
69
67
  /**
70
68
  * Directory (inside the container) where each spawned process records the PGID
71
69
  * of its process group. Created with mode 700 so only the (root) exec user can
@@ -549,8 +547,7 @@ var DockerProcessManager = class extends _mastra_core_workspace.SandboxProcessMa
549
547
  return results;
550
548
  }
551
549
  };
552
- //#endregion
553
- //#region src/sandbox/index.ts
550
+ // src/sandbox/index.ts
554
551
  /**
555
552
  * Docker Sandbox Provider
556
553
  *
@@ -1170,8 +1167,7 @@ function toDockerSandboxOptionName(field) {
1170
1167
  Mounts: "mounts"
1171
1168
  }[field] ?? String(field);
1172
1169
  }
1173
- //#endregion
1174
- //#region src/provider.ts
1170
+ // src/provider.ts
1175
1171
  const dockerSandboxProvider = {
1176
1172
  id: "docker",
1177
1173
  name: "Docker Sandbox",
@@ -1364,8 +1360,7 @@ const dockerSandboxProvider = {
1364
1360
  },
1365
1361
  createSandbox: (config) => new DockerSandbox(config)
1366
1362
  };
1367
- //#endregion
1368
- //#region src/template/build-progress.ts
1363
+ // src/template/build-progress.ts
1369
1364
  /**
1370
1365
  * Build progress for `DockerTemplate.build()`.
1371
1366
  *
@@ -1645,8 +1640,7 @@ function createBuildEventNormalizer(emit, tail) {
1645
1640
  failure: () => failure
1646
1641
  };
1647
1642
  }
1648
- //#endregion
1649
- //#region src/template/build-session.ts
1643
+ // src/template/build-session.ts
1650
1644
  /**
1651
1645
  * BuildKit session that serves build secrets to the daemon.
1652
1646
  *
@@ -1811,8 +1805,7 @@ const authService = { Credentials: {
1811
1805
  throw new Error("server does not deserialize responses");
1812
1806
  }
1813
1807
  } };
1814
- //#endregion
1815
- //#region src/template/dockerfile.ts
1808
+ // src/template/dockerfile.ts
1816
1809
  /**
1817
1810
  * Pure Dockerfile synthesis and content-addressed identity for DockerTemplate.
1818
1811
  *
@@ -1978,8 +1971,7 @@ function templateIdentity(definition) {
1978
1971
  function templateImageTag(definition) {
1979
1972
  return `${TEMPLATE_IMAGE_REPO}:${templateIdentity(definition)}`;
1980
1973
  }
1981
- //#endregion
1982
- //#region src/template/template.ts
1974
+ // src/template/template.ts
1983
1975
  /**
1984
1976
  * DockerTemplate — a reusable prepared baseline for the local Docker sandbox.
1985
1977
  *
@@ -2252,6 +2244,7 @@ var DockerTemplate = class DockerTemplate {
2252
2244
  const context = (0, tar_stream.pack)();
2253
2245
  context.entry({ name: "Dockerfile" }, this.dockerfile);
2254
2246
  context.finalize();
2247
+ const contextStream = context;
2255
2248
  const tail = new BoundedTail(maxOutputBytes);
2256
2249
  const normalizer = createBuildEventNormalizer(emit, tail);
2257
2250
  emit({
@@ -2262,14 +2255,14 @@ var DockerTemplate = class DockerTemplate {
2262
2255
  try {
2263
2256
  const nocache = options.force === true;
2264
2257
  if (secrets) {
2265
- const { stream, session } = await this.#buildWithSecrets(docker, context, tag, secrets, nocache, abortSignal);
2258
+ const { stream, session } = await this.#buildWithSecrets(docker, contextStream, tag, secrets, nocache, abortSignal);
2266
2259
  try {
2267
2260
  await this.#followBuild(docker, stream, normalizer, abortSignal);
2268
2261
  } finally {
2269
2262
  session.close();
2270
2263
  }
2271
2264
  } else {
2272
- const stream = await waitForAbortable(docker.buildImage(context, {
2265
+ const stream = await waitForAbortable(docker.buildImage(contextStream, {
2273
2266
  t: tag,
2274
2267
  nocache,
2275
2268
  forcerm: true
@@ -2280,7 +2273,7 @@ var DockerTemplate = class DockerTemplate {
2280
2273
  }
2281
2274
  return stream;
2282
2275
  }), abortSignal, "build Docker template", () => {
2283
- context.destroy?.();
2276
+ context.destroy();
2284
2277
  });
2285
2278
  await this.#followBuild(docker, stream, normalizer, abortSignal);
2286
2279
  }
@@ -2498,8 +2491,7 @@ function isImageNotFoundError(error) {
2498
2491
  }
2499
2492
  return false;
2500
2493
  }
2501
- //#endregion
2502
- //#region ../../packages/_internals/workspace/dist/index.js
2494
+ // ../../packages/_internals/workspace/dist/index.js
2503
2495
  /** Directory, relative to the template's build cwd, that holds every marker below. */
2504
2496
  const SETUP_MARKER_DIR = ".mastra-sandbox";
2505
2497
  /**
@@ -2571,8 +2563,7 @@ const { notFound, isDirectory, exists, notDirectory, destIsDirectory } = {
2571
2563
  notDirectory: 23,
2572
2564
  destIsDirectory: 24
2573
2565
  };
2574
- //#endregion
2575
- //#region src/template/repo-template.ts
2566
+ // src/template/repo-template.ts
2576
2567
  /**
2577
2568
  * createDockerRepoTemplate — a repo checkout plus setup commands as a
2578
2569
  * reusable, content-addressed local image, with the same contract as the
@@ -2844,8 +2835,7 @@ function trimTrailingSlashes(path) {
2844
2835
  function shellQuote(value) {
2845
2836
  return `'${value.replace(/'/g, `'\\''`)}'`;
2846
2837
  }
2847
- //#endregion
2848
- //#region src/factory-sandbox.ts
2838
+ // src/factory-sandbox.ts
2849
2839
  const SETTINGS_SCHEMA = {
2850
2840
  type: "object",
2851
2841
  properties: {
@@ -2956,7 +2946,6 @@ var DockerFactorySandbox = class extends _mastra_core_workspace.FactorySandbox {
2956
2946
  });
2957
2947
  }
2958
2948
  };
2959
- //#endregion
2960
2949
  exports.DockerFactorySandbox = DockerFactorySandbox;
2961
2950
  exports.DockerProcessManager = DockerProcessManager;
2962
2951
  exports.DockerSandbox = DockerSandbox;