@mastra/daytona 0.9.1 → 0.10.0-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.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +8 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/process-manager.d.ts.map +1 -1
- package/package.json +9 -10
- package/CHANGELOG.md +0 -773
package/dist/index.js
CHANGED
|
@@ -531,7 +531,7 @@ var DaytonaProcessManager = class extends SandboxProcessManager {
|
|
|
531
531
|
const effectiveOptions = {
|
|
532
532
|
...options,
|
|
533
533
|
timeout: options.timeout ?? this._defaultTimeout,
|
|
534
|
-
cwd: options.cwd ?? this.sandbox.mounts?.entries?.keys().next().value
|
|
534
|
+
cwd: options.cwd ?? this.sandbox.explicitWorkingDirectory ?? this.sandbox.mounts?.entries?.keys().next().value
|
|
535
535
|
};
|
|
536
536
|
const envs = Object.fromEntries(Object.entries(effectiveOptions.env ?? {}).filter((entry) => entry[1] !== void 0));
|
|
537
537
|
const sessionCommand = buildSpawnCommand(command, effectiveOptions.cwd, envs);
|
|
@@ -689,7 +689,6 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
689
689
|
_daytona = null;
|
|
690
690
|
_sandbox = null;
|
|
691
691
|
_createdAt = null;
|
|
692
|
-
_workingDir = null;
|
|
693
692
|
_isRetrying = false;
|
|
694
693
|
_computerUseStarted = null;
|
|
695
694
|
computerUseAutoStart;
|
|
@@ -715,6 +714,14 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
715
714
|
secrets;
|
|
716
715
|
connectionOpts;
|
|
717
716
|
_constructorOptions;
|
|
717
|
+
/**
|
|
718
|
+
* The `workingDirectory` option as explicitly configured, as distinct from
|
|
719
|
+
* the probe-filled base field. The process manager's cwd fallback uses only
|
|
720
|
+
* this value so the runtime probe (which just reports the session home)
|
|
721
|
+
* never displaces the FUSE-mount default for relative paths.
|
|
722
|
+
* @internal
|
|
723
|
+
*/
|
|
724
|
+
explicitWorkingDirectory;
|
|
718
725
|
constructor(options = {}) {
|
|
719
726
|
super({
|
|
720
727
|
...options,
|
|
@@ -722,6 +729,7 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
722
729
|
processes: new DaytonaProcessManager({ defaultTimeout: options.timeout ?? 3e5 })
|
|
723
730
|
});
|
|
724
731
|
this.id = options.id ?? this.generateId();
|
|
732
|
+
this.explicitWorkingDirectory = options.workingDirectory;
|
|
725
733
|
this.timeout = options.timeout ?? 3e5;
|
|
726
734
|
this.language = options.language ?? "typescript";
|
|
727
735
|
this.resources = options.resources;
|
|
@@ -947,7 +955,7 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
947
955
|
const mountCount = this.mounts.entries.size;
|
|
948
956
|
const mountInfo = mountCount > 0 ? ` ${mountCount} filesystem(s) mounted via FUSE.` : "";
|
|
949
957
|
parts.push(`Cloud sandbox with isolated execution (${this.language} runtime).${mountInfo}`);
|
|
950
|
-
if (this.
|
|
958
|
+
if (this.workingDirectory) parts.push(`Default working directory: ${this.workingDirectory}.`);
|
|
951
959
|
parts.push(`Command timeout: ${Math.ceil(this.timeout / 1e3)}s.`);
|
|
952
960
|
parts.push(`Running as user: ${this.sandboxUser ?? "daytona"}.`);
|
|
953
961
|
if (this.volumeConfigs.length > 0) parts.push(`${this.volumeConfigs.length} volume(s) attached.`);
|
|
@@ -1362,10 +1370,11 @@ var DaytonaSandbox = class DaytonaSandbox extends MastraSandbox {
|
|
|
1362
1370
|
*/
|
|
1363
1371
|
async detectWorkingDir() {
|
|
1364
1372
|
if (!this._sandbox) return;
|
|
1373
|
+
if (this.explicitWorkingDirectory !== void 0) return;
|
|
1365
1374
|
try {
|
|
1366
1375
|
const dir = (await runCommand(this._sandbox, "pwd", { timeout: MOUNT_COMMAND_TIMEOUT_MS })).output?.trim();
|
|
1367
1376
|
if (dir) {
|
|
1368
|
-
this.
|
|
1377
|
+
this.setWorkingDirectory(dir);
|
|
1369
1378
|
this.logger.debug(`${LOG_PREFIX} Detected working directory: ${dir}`);
|
|
1370
1379
|
}
|
|
1371
1380
|
} catch {
|