@mastra/e2b 0.16.1-alpha.0 → 0.16.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 +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/sandbox/filesystem.d.ts +2 -2
- package/dist/sandbox/process-manager.d.ts +2 -2
- package/package.json +10 -10
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/commands-api-process-manager.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/file-commands.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/files-api-filesystem.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/index.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/repo-clone.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/setup-marker.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/package.json +0 -0
package/dist/index.cjs
CHANGED
|
@@ -528,6 +528,20 @@ var FilesApiFilesystem = class extends _mastra_core_workspace.MastraFilesystem {
|
|
|
528
528
|
throw new Error(`${operation} ${subject} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
+
const KILL_DESCENDANTS_TIMEOUT_MS = 1e4;
|
|
532
|
+
/**
|
|
533
|
+
* A shell command that kills every process `pid` started, at any depth, but
|
|
534
|
+
* not `pid` itself. It pauses `pid` first: a wrapper like npm exits on its own
|
|
535
|
+
* once its child dies, and `kill(pid)` would then report it wasn't running.
|
|
536
|
+
*/
|
|
537
|
+
function killDescendants(pid) {
|
|
538
|
+
return [
|
|
539
|
+
`kill -STOP ${pid}`,
|
|
540
|
+
"kill_children() { for child in $(pgrep -P \"$1\"); do kill -STOP \"$child\"; (kill_children \"$child\"); kill -KILL \"$child\"; done; }",
|
|
541
|
+
`kill_children ${pid}`,
|
|
542
|
+
"true"
|
|
543
|
+
].join("\n");
|
|
544
|
+
}
|
|
531
545
|
/**
|
|
532
546
|
* Output callbacks for `run`/`connect` that hold output until the handle
|
|
533
547
|
* exists. The SDK's handle reads events from construction, before `run()`
|
|
@@ -630,7 +644,16 @@ var CommandsApiProcessHandle = class extends _mastra_core_workspace.ProcessHandl
|
|
|
630
644
|
}
|
|
631
645
|
async kill() {
|
|
632
646
|
if (this.exitCode !== void 0) return false;
|
|
633
|
-
return this.manager.runCommands("kill", (commands) =>
|
|
647
|
+
return this.manager.runCommands("kill", async (commands) => {
|
|
648
|
+
try {
|
|
649
|
+
await (await commands.run(killDescendants(this.inner.pid), {
|
|
650
|
+
background: true,
|
|
651
|
+
stdin: false,
|
|
652
|
+
timeoutMs: KILL_DESCENDANTS_TIMEOUT_MS
|
|
653
|
+
})).wait();
|
|
654
|
+
} catch {}
|
|
655
|
+
return commands.kill(this.inner.pid);
|
|
656
|
+
});
|
|
634
657
|
}
|
|
635
658
|
async sendStdin(data) {
|
|
636
659
|
if (this.exitCode !== void 0) throw new Error(`Process ${this.pid} has already exited with code ${this.exitCode}`);
|