@mastra/daytona 0.4.0 → 0.4.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/CHANGELOG.md +11 -0
- package/dist/index.cjs +15 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/sandbox/process-manager.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -572,7 +572,9 @@ var DaytonaProcessHandle = class extends ProcessHandle {
|
|
|
572
572
|
exitCode: 124,
|
|
573
573
|
stdout: this.stdout,
|
|
574
574
|
stderr: this.stderr || error.message,
|
|
575
|
-
executionTimeMs: Date.now() - this._startTime
|
|
575
|
+
executionTimeMs: Date.now() - this._startTime,
|
|
576
|
+
killed: true,
|
|
577
|
+
timedOut: true
|
|
576
578
|
};
|
|
577
579
|
}
|
|
578
580
|
throw error;
|
|
@@ -589,7 +591,9 @@ var DaytonaProcessHandle = class extends ProcessHandle {
|
|
|
589
591
|
exitCode: this._exitCode ?? 137,
|
|
590
592
|
stdout: this.stdout,
|
|
591
593
|
stderr: this.stderr,
|
|
592
|
-
executionTimeMs: Date.now() - this._startTime
|
|
594
|
+
executionTimeMs: Date.now() - this._startTime,
|
|
595
|
+
killed: true,
|
|
596
|
+
timedOut: false
|
|
593
597
|
};
|
|
594
598
|
}
|
|
595
599
|
await this._resolveExitCode();
|
|
@@ -630,13 +634,13 @@ var DaytonaProcessManager = class extends SandboxProcessManager {
|
|
|
630
634
|
...options,
|
|
631
635
|
timeout: options.timeout ?? this._defaultTimeout
|
|
632
636
|
};
|
|
637
|
+
const mergedEnv = { ...this.env, ...effectiveOptions.env };
|
|
638
|
+
const envs = Object.fromEntries(
|
|
639
|
+
Object.entries(mergedEnv).filter((entry) => entry[1] !== void 0)
|
|
640
|
+
);
|
|
641
|
+
const sessionCommand = buildSpawnCommand(command, effectiveOptions.cwd, envs);
|
|
633
642
|
return this.sandbox.retryOnDead(async () => {
|
|
634
643
|
const sandbox = this.sandbox.daytona;
|
|
635
|
-
const mergedEnv = { ...this.env, ...effectiveOptions.env };
|
|
636
|
-
const envs = Object.fromEntries(
|
|
637
|
-
Object.entries(mergedEnv).filter((entry) => entry[1] !== void 0)
|
|
638
|
-
);
|
|
639
|
-
const sessionCommand = buildSpawnCommand(command, effectiveOptions.cwd, envs);
|
|
640
644
|
const sessionId = `mastra-proc-${Date.now().toString(36)}-${++this._spawnCounter}`;
|
|
641
645
|
await sandbox.process.createSession(sessionId);
|
|
642
646
|
const { cmdId } = await sandbox.process.executeSessionCommand(sessionId, {
|
|
@@ -669,9 +673,13 @@ var DaytonaProcessManager = class extends SandboxProcessManager {
|
|
|
669
673
|
return result;
|
|
670
674
|
}
|
|
671
675
|
};
|
|
676
|
+
var SHELL_IDENTIFIER_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
672
677
|
function buildSpawnCommand(command, cwd, envs) {
|
|
673
678
|
const parts = [];
|
|
674
679
|
for (const [k, v] of Object.entries(envs)) {
|
|
680
|
+
if (!SHELL_IDENTIFIER_PATTERN.test(k)) {
|
|
681
|
+
throw new Error(`Invalid environment variable name: ${JSON.stringify(k)}`);
|
|
682
|
+
}
|
|
675
683
|
parts.push(`export ${k}=${shellQuote(v)}`);
|
|
676
684
|
}
|
|
677
685
|
if (cwd) {
|