@mastra/e2b 0.12.1-alpha.0 → 0.12.1-alpha.2
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
|
@@ -539,11 +539,12 @@ var E2BProcessHandle = class extends ProcessHandle {
|
|
|
539
539
|
throw new UnsupportedStdinCloseError("E2B SDK does not expose a way to close stdin for a running command");
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
|
-
/**
|
|
543
|
-
* E2B implementation of SandboxProcessManager.
|
|
544
|
-
* Uses the E2B SDK's commands.run() with background: true.
|
|
545
|
-
*/
|
|
546
542
|
var E2BProcessManager = class extends SandboxProcessManager {
|
|
543
|
+
_defaultTimeout;
|
|
544
|
+
constructor(opts = {}) {
|
|
545
|
+
super();
|
|
546
|
+
this._defaultTimeout = opts.defaultTimeout;
|
|
547
|
+
}
|
|
547
548
|
async spawn(command, options = {}) {
|
|
548
549
|
return this.sandbox.retryOnDead(async () => {
|
|
549
550
|
const e2b = this.sandbox.e2b;
|
|
@@ -555,7 +556,7 @@ var E2BProcessManager = class extends SandboxProcessManager {
|
|
|
555
556
|
stdin: options.stdinMode !== "ignore",
|
|
556
557
|
cwd: options.cwd ?? this.sandbox.workingDirectory,
|
|
557
558
|
envs,
|
|
558
|
-
timeoutMs: options.timeout,
|
|
559
|
+
timeoutMs: options.timeout ?? this._defaultTimeout,
|
|
559
560
|
onStdout: (data) => handle.emitStdout(data),
|
|
560
561
|
onStderr: (data) => handle.emitStderr(data)
|
|
561
562
|
}), e2b, Date.now(), options);
|
|
@@ -709,7 +710,7 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
709
710
|
super({
|
|
710
711
|
...options,
|
|
711
712
|
name: "E2BSandbox",
|
|
712
|
-
processes: new E2BProcessManager()
|
|
713
|
+
processes: new E2BProcessManager({ defaultTimeout: options.timeout ?? 3e5 })
|
|
713
714
|
});
|
|
714
715
|
this.id = options.id ?? this.generateId();
|
|
715
716
|
this.timeout = options.timeout ?? 3e5;
|
|
@@ -1261,7 +1262,10 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
1261
1262
|
const owner = info.metadata?.["mastra-sandbox-id"];
|
|
1262
1263
|
if (owner !== void 0 && owner !== this.id) throw new Error(`${LOG_PREFIX} Provider sandbox ${preferredSandboxId} belongs to logical sandbox id "${owner}", refusing to attach it to "${this.id}"`);
|
|
1263
1264
|
try {
|
|
1264
|
-
return await Sandbox.connect(preferredSandboxId,
|
|
1265
|
+
return await Sandbox.connect(preferredSandboxId, {
|
|
1266
|
+
...this.connectionOpts,
|
|
1267
|
+
timeoutMs: this.timeout
|
|
1268
|
+
});
|
|
1265
1269
|
} catch (e) {
|
|
1266
1270
|
if (this.isSandboxDeadError(e)) {
|
|
1267
1271
|
this.logger.debug(`${LOG_PREFIX} Preferred sandbox ${preferredSandboxId} vanished before connect, falling back:`, e);
|
|
@@ -1279,7 +1283,10 @@ var E2BSandbox = class E2BSandbox extends MastraSandbox {
|
|
|
1279
1283
|
const info = await this.lookupExistingSandboxInfo();
|
|
1280
1284
|
if (!info) return null;
|
|
1281
1285
|
try {
|
|
1282
|
-
return await this.connectSdkSandbox(info.sandboxId,
|
|
1286
|
+
return await this.connectSdkSandbox(info.sandboxId, {
|
|
1287
|
+
...this.connectionOpts,
|
|
1288
|
+
timeoutMs: this.timeout
|
|
1289
|
+
});
|
|
1283
1290
|
} catch (e) {
|
|
1284
1291
|
this.logger.debug(`${LOG_PREFIX} Error connecting to existing sandbox:`, e);
|
|
1285
1292
|
return null;
|