@mastra/docker 0.12.0 → 0.12.1-alpha.0

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.js CHANGED
@@ -8,7 +8,7 @@ import posixPath from "path/posix";
8
8
  import { Server, ServerCredentials } from "@grpc/grpc-js";
9
9
  import { createHash } from "crypto";
10
10
  import { execFile } from "child_process";
11
- //#region src/abort.ts
11
+ // src/abort.ts
12
12
  function createAbortError(signal, operation) {
13
13
  return new SandboxAbortError(operation, signal.reason);
14
14
  }
@@ -39,8 +39,7 @@ function waitForAbortable(promise, signal, operation, onAbort) {
39
39
  });
40
40
  });
41
41
  }
42
- //#endregion
43
- //#region src/sandbox/process-manager.ts
42
+ // src/sandbox/process-manager.ts
44
43
  /**
45
44
  * Directory (inside the container) where each spawned process records the PGID
46
45
  * of its process group. Created with mode 700 so only the (root) exec user can
@@ -524,8 +523,7 @@ var DockerProcessManager = class extends SandboxProcessManager {
524
523
  return results;
525
524
  }
526
525
  };
527
- //#endregion
528
- //#region src/sandbox/index.ts
526
+ // src/sandbox/index.ts
529
527
  /**
530
528
  * Docker Sandbox Provider
531
529
  *
@@ -1145,8 +1143,7 @@ function toDockerSandboxOptionName(field) {
1145
1143
  Mounts: "mounts"
1146
1144
  }[field] ?? String(field);
1147
1145
  }
1148
- //#endregion
1149
- //#region src/provider.ts
1146
+ // src/provider.ts
1150
1147
  const dockerSandboxProvider = {
1151
1148
  id: "docker",
1152
1149
  name: "Docker Sandbox",
@@ -1339,8 +1336,7 @@ const dockerSandboxProvider = {
1339
1336
  },
1340
1337
  createSandbox: (config) => new DockerSandbox(config)
1341
1338
  };
1342
- //#endregion
1343
- //#region src/template/build-progress.ts
1339
+ // src/template/build-progress.ts
1344
1340
  /**
1345
1341
  * Build progress for `DockerTemplate.build()`.
1346
1342
  *
@@ -1620,8 +1616,7 @@ function createBuildEventNormalizer(emit, tail) {
1620
1616
  failure: () => failure
1621
1617
  };
1622
1618
  }
1623
- //#endregion
1624
- //#region src/template/build-session.ts
1619
+ // src/template/build-session.ts
1625
1620
  /**
1626
1621
  * BuildKit session that serves build secrets to the daemon.
1627
1622
  *
@@ -1786,8 +1781,7 @@ const authService = { Credentials: {
1786
1781
  throw new Error("server does not deserialize responses");
1787
1782
  }
1788
1783
  } };
1789
- //#endregion
1790
- //#region src/template/dockerfile.ts
1784
+ // src/template/dockerfile.ts
1791
1785
  /**
1792
1786
  * Pure Dockerfile synthesis and content-addressed identity for DockerTemplate.
1793
1787
  *
@@ -1953,8 +1947,7 @@ function templateIdentity(definition) {
1953
1947
  function templateImageTag(definition) {
1954
1948
  return `${TEMPLATE_IMAGE_REPO}:${templateIdentity(definition)}`;
1955
1949
  }
1956
- //#endregion
1957
- //#region src/template/template.ts
1950
+ // src/template/template.ts
1958
1951
  /**
1959
1952
  * DockerTemplate — a reusable prepared baseline for the local Docker sandbox.
1960
1953
  *
@@ -2227,6 +2220,7 @@ var DockerTemplate = class DockerTemplate {
2227
2220
  const context = pack();
2228
2221
  context.entry({ name: "Dockerfile" }, this.dockerfile);
2229
2222
  context.finalize();
2223
+ const contextStream = context;
2230
2224
  const tail = new BoundedTail(maxOutputBytes);
2231
2225
  const normalizer = createBuildEventNormalizer(emit, tail);
2232
2226
  emit({
@@ -2237,14 +2231,14 @@ var DockerTemplate = class DockerTemplate {
2237
2231
  try {
2238
2232
  const nocache = options.force === true;
2239
2233
  if (secrets) {
2240
- const { stream, session } = await this.#buildWithSecrets(docker, context, tag, secrets, nocache, abortSignal);
2234
+ const { stream, session } = await this.#buildWithSecrets(docker, contextStream, tag, secrets, nocache, abortSignal);
2241
2235
  try {
2242
2236
  await this.#followBuild(docker, stream, normalizer, abortSignal);
2243
2237
  } finally {
2244
2238
  session.close();
2245
2239
  }
2246
2240
  } else {
2247
- const stream = await waitForAbortable(docker.buildImage(context, {
2241
+ const stream = await waitForAbortable(docker.buildImage(contextStream, {
2248
2242
  t: tag,
2249
2243
  nocache,
2250
2244
  forcerm: true
@@ -2255,7 +2249,7 @@ var DockerTemplate = class DockerTemplate {
2255
2249
  }
2256
2250
  return stream;
2257
2251
  }), abortSignal, "build Docker template", () => {
2258
- context.destroy?.();
2252
+ context.destroy();
2259
2253
  });
2260
2254
  await this.#followBuild(docker, stream, normalizer, abortSignal);
2261
2255
  }
@@ -2473,8 +2467,7 @@ function isImageNotFoundError(error) {
2473
2467
  }
2474
2468
  return false;
2475
2469
  }
2476
- //#endregion
2477
- //#region ../../packages/_internals/workspace/dist/index.js
2470
+ // ../../packages/_internals/workspace/dist/index.js
2478
2471
  /** Directory, relative to the template's build cwd, that holds every marker below. */
2479
2472
  const SETUP_MARKER_DIR = ".mastra-sandbox";
2480
2473
  /**
@@ -2546,8 +2539,7 @@ const { notFound, isDirectory, exists, notDirectory, destIsDirectory } = {
2546
2539
  notDirectory: 23,
2547
2540
  destIsDirectory: 24
2548
2541
  };
2549
- //#endregion
2550
- //#region src/template/repo-template.ts
2542
+ // src/template/repo-template.ts
2551
2543
  /**
2552
2544
  * createDockerRepoTemplate — a repo checkout plus setup commands as a
2553
2545
  * reusable, content-addressed local image, with the same contract as the
@@ -2819,8 +2811,7 @@ function trimTrailingSlashes(path) {
2819
2811
  function shellQuote(value) {
2820
2812
  return `'${value.replace(/'/g, `'\\''`)}'`;
2821
2813
  }
2822
- //#endregion
2823
- //#region src/factory-sandbox.ts
2814
+ // src/factory-sandbox.ts
2824
2815
  const SETTINGS_SCHEMA = {
2825
2816
  type: "object",
2826
2817
  properties: {
@@ -2931,7 +2922,6 @@ var DockerFactorySandbox = class extends FactorySandbox {
2931
2922
  });
2932
2923
  }
2933
2924
  };
2934
- //#endregion
2935
2925
  export { DockerFactorySandbox, DockerProcessManager, DockerSandbox, DockerTemplate, TEMPLATE_IMAGE_REPO, createDockerRepoTemplate, dockerSandboxProvider, secretNames, synthesizeDockerfile, templateIdentity, templateImageTag };
2936
2926
 
2937
2927
  //# sourceMappingURL=index.js.map