@mastra/docker 0.9.1-alpha.1 → 0.9.2-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
|
@@ -3,9 +3,9 @@ import { isDeepStrictEqual, promisify } from "util";
|
|
|
3
3
|
import { MastraSandbox, ProcessHandle, SandboxAbortError, SandboxError, SandboxNotReadyError, SandboxProcessManager, validateSandboxFileMode } from "@mastra/core/workspace";
|
|
4
4
|
import Docker from "dockerode";
|
|
5
5
|
import { pack } from "tar-stream";
|
|
6
|
-
import { createHash, randomUUID } from "crypto";
|
|
7
6
|
import posixPath from "path/posix";
|
|
8
7
|
import { Server, ServerCredentials } from "@grpc/grpc-js";
|
|
8
|
+
import { createHash } from "crypto";
|
|
9
9
|
import { execFile } from "child_process";
|
|
10
10
|
//#region src/abort.ts
|
|
11
11
|
function createAbortError(signal, operation) {
|
|
@@ -41,14 +41,6 @@ function waitForAbortable(promise, signal, operation, onAbort) {
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/sandbox/process-manager.ts
|
|
43
43
|
/**
|
|
44
|
-
* Docker Process Manager
|
|
45
|
-
*
|
|
46
|
-
* Implements SandboxProcessManager for Docker containers.
|
|
47
|
-
* Uses `container.exec()` to run commands inside a long-lived container.
|
|
48
|
-
* Each spawned process gets a dedicated exec instance with separate
|
|
49
|
-
* stdout/stderr streams.
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
44
|
* Directory (inside the container) where each spawned process records the PGID
|
|
53
45
|
* of its process group. Created with mode 700 so only the (root) exec user can
|
|
54
46
|
* write the PGID files.
|
|
@@ -354,7 +346,7 @@ var DockerProcessManager = class extends SandboxProcessManager {
|
|
|
354
346
|
}
|
|
355
347
|
async spawn(command, options = {}) {
|
|
356
348
|
const container = this.container;
|
|
357
|
-
const pgidFile = `${PROC_DIR}/${randomUUID()}`;
|
|
349
|
+
const pgidFile = `${PROC_DIR}/${globalThis.crypto.randomUUID()}`;
|
|
358
350
|
const envArray = Object.entries({ ...options.env }).filter((entry) => entry[1] !== void 0).map(([k, v]) => `${k}=${v}`);
|
|
359
351
|
const attachStdin = options.stdinMode !== "ignore";
|
|
360
352
|
const exec = await container.exec({
|
|
@@ -1338,7 +1330,7 @@ const AUTH_CREDENTIALS_METHOD = "/moby.filesync.v1.Auth/Credentials";
|
|
|
1338
1330
|
*/
|
|
1339
1331
|
function openBuildSession(docker, secrets, abortSignal) {
|
|
1340
1332
|
throwIfAborted(abortSignal, "build Docker template");
|
|
1341
|
-
const id = randomUUID();
|
|
1333
|
+
const id = globalThis.crypto.randomUUID();
|
|
1342
1334
|
return new Promise((resolve, reject) => {
|
|
1343
1335
|
let settled = false;
|
|
1344
1336
|
const abort = () => {
|