@mastra/docker 0.9.1 → 0.9.2-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
|
@@ -27,10 +27,10 @@ let _mastra_core_workspace = require("@mastra/core/workspace");
|
|
|
27
27
|
let dockerode = require("dockerode");
|
|
28
28
|
dockerode = __toESM(dockerode, 1);
|
|
29
29
|
let tar_stream = require("tar-stream");
|
|
30
|
-
let crypto = require("crypto");
|
|
31
30
|
let path_posix = require("path/posix");
|
|
32
31
|
path_posix = __toESM(path_posix, 1);
|
|
33
32
|
let _grpc_grpc_js = require("@grpc/grpc-js");
|
|
33
|
+
let crypto = require("crypto");
|
|
34
34
|
let child_process = require("child_process");
|
|
35
35
|
//#region src/abort.ts
|
|
36
36
|
function createAbortError(signal, operation) {
|
|
@@ -66,14 +66,6 @@ function waitForAbortable(promise, signal, operation, onAbort) {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/sandbox/process-manager.ts
|
|
68
68
|
/**
|
|
69
|
-
* Docker Process Manager
|
|
70
|
-
*
|
|
71
|
-
* Implements SandboxProcessManager for Docker containers.
|
|
72
|
-
* Uses `container.exec()` to run commands inside a long-lived container.
|
|
73
|
-
* Each spawned process gets a dedicated exec instance with separate
|
|
74
|
-
* stdout/stderr streams.
|
|
75
|
-
*/
|
|
76
|
-
/**
|
|
77
69
|
* Directory (inside the container) where each spawned process records the PGID
|
|
78
70
|
* of its process group. Created with mode 700 so only the (root) exec user can
|
|
79
71
|
* write the PGID files.
|
|
@@ -379,7 +371,7 @@ var DockerProcessManager = class extends _mastra_core_workspace.SandboxProcessMa
|
|
|
379
371
|
}
|
|
380
372
|
async spawn(command, options = {}) {
|
|
381
373
|
const container = this.container;
|
|
382
|
-
const pgidFile = `${PROC_DIR}/${
|
|
374
|
+
const pgidFile = `${PROC_DIR}/${globalThis.crypto.randomUUID()}`;
|
|
383
375
|
const envArray = Object.entries({ ...options.env }).filter((entry) => entry[1] !== void 0).map(([k, v]) => `${k}=${v}`);
|
|
384
376
|
const attachStdin = options.stdinMode !== "ignore";
|
|
385
377
|
const exec = await container.exec({
|
|
@@ -710,6 +702,7 @@ var DockerSandbox = class DockerSandbox extends _mastra_core_workspace.MastraSan
|
|
|
710
702
|
}
|
|
711
703
|
const reconnectedWorkingDir = info.Config?.WorkingDir;
|
|
712
704
|
if (!this._workingDirectoryWasSet && reconnectedWorkingDir) this.setWorkingDirectory(reconnectedWorkingDir);
|
|
705
|
+
if (info.Config?.Image) this._image = info.Config.Image;
|
|
713
706
|
this.processes.setContainer(this._container);
|
|
714
707
|
this.logger.debug(`${LOG_PREFIX} Reconnected to container ${existing.Id}`);
|
|
715
708
|
return;
|
|
@@ -1363,7 +1356,7 @@ const AUTH_CREDENTIALS_METHOD = "/moby.filesync.v1.Auth/Credentials";
|
|
|
1363
1356
|
*/
|
|
1364
1357
|
function openBuildSession(docker, secrets, abortSignal) {
|
|
1365
1358
|
throwIfAborted(abortSignal, "build Docker template");
|
|
1366
|
-
const id =
|
|
1359
|
+
const id = globalThis.crypto.randomUUID();
|
|
1367
1360
|
return new Promise((resolve, reject) => {
|
|
1368
1361
|
let settled = false;
|
|
1369
1362
|
const abort = () => {
|