@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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @mastra/daytona
2
2
 
3
+ ## 0.4.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed Daytona command execution to reject invalid environment variable names ([#17279](https://github.com/mastra-ai/mastra/pull/17279))
8
+
9
+ - Fixed sandbox execution results to report killed and timed out commands. ([#17281](https://github.com/mastra-ai/mastra/pull/17281))
10
+
11
+ - Updated dependencies [[`8ace89d`](https://github.com/mastra-ai/mastra/commit/8ace89df77f762e622d3b9f7f65ad7524350d050), [`fa63872`](https://github.com/mastra-ai/mastra/commit/fa6387280954e6b667bec5714b55ba082bc627ff), [`f07b646`](https://github.com/mastra-ai/mastra/commit/f07b64604ab7d25391179790b7fd4823df9e2dff), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`40f9297`](https://github.com/mastra-ai/mastra/commit/40f9297003b921c62373d3e8d3a4bda76c9f6de3), [`0f0d1ba`](https://github.com/mastra-ai/mastra/commit/0f0d1ba67bfcb2204e571401662f1eceefc03357), [`8c31bcd`](https://github.com/mastra-ai/mastra/commit/8c31bcdb00e597880d5939b1b7d7566fbe5dacae), [`95b14cd`](https://github.com/mastra-ai/mastra/commit/95b14cdd820e86d97ac05fe568424c513a252e31), [`aa36be2`](https://github.com/mastra-ai/mastra/commit/aa36be23aa513b7dc53cb8ca16b7fab8f20e43ad), [`212c635`](https://github.com/mastra-ai/mastra/commit/212c635203e61d036ab41db8ff86c3893dc795b3), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`9aa5a73`](https://github.com/mastra-ai/mastra/commit/9aa5a73e7e110f6e9365eec69364a33d5f03bb56), [`f73c789`](https://github.com/mastra-ai/mastra/commit/f73c789e8ef21561580395d2c410119cab5848c8), [`8bd16da`](https://github.com/mastra-ai/mastra/commit/8bd16da73a4cb874d739373643dbd6a6e7f88684), [`c8630f8`](https://github.com/mastra-ai/mastra/commit/c8630f80d4f40cb5d22e60ab162b618b1907167a), [`47f71dc`](https://github.com/mastra-ai/mastra/commit/47f71dc6fbcbd12d71e21a979e676e20a02bd77d), [`50ceae2`](https://github.com/mastra-ai/mastra/commit/50ceae270878e2f8fb2b2c6c2faab09df0007c8a), [`8cdde58`](https://github.com/mastra-ai/mastra/commit/8cdde5875bbba6702d9df226f2b20232b8d75d6c), [`847ff1e`](https://github.com/mastra-ai/mastra/commit/847ff1e0d94368d94b2e173e4e0908e115568ef3), [`259d409`](https://github.com/mastra-ai/mastra/commit/259d409a514174299dbde1ff5e1121209b3ba850), [`9e16c68`](https://github.com/mastra-ai/mastra/commit/9e16c6818b6485ccb43df28aba6f3a2219d28662), [`cefca33`](https://github.com/mastra-ai/mastra/commit/cefca33ae666e69810c935fedf95a929c173d1d7), [`d00e8c5`](https://github.com/mastra-ai/mastra/commit/d00e8c50daebe5bce5bf2f48bde39c86fc3d2fe4), [`36fa7e2`](https://github.com/mastra-ai/mastra/commit/36fa7e24d14e58a1eb46147097b32f583e5b8775), [`87e9774`](https://github.com/mastra-ai/mastra/commit/87e97741c1e493cd6d62f478eb810b49bda4d57c), [`65a72e7`](https://github.com/mastra-ai/mastra/commit/65a72e70c25eedea8ff985a6624b96be2850236b), [`0f77241`](https://github.com/mastra-ai/mastra/commit/0f7724108806703799a8ba80ad0f09414afd5066), [`92ff509`](https://github.com/mastra-ai/mastra/commit/92ff5098ef8a990438ca038077021a5f7541ec1d), [`3fce5e7`](https://github.com/mastra-ai/mastra/commit/3fce5e70d011d289043e75003ef3336ed4aa43c3), [`a763592`](https://github.com/mastra-ai/mastra/commit/a763592c3db46963ef1011cfe16fe372816e775e), [`80c7737`](https://github.com/mastra-ai/mastra/commit/80c7737e32d7917b5f356957d67c169d01744fd3), [`3f1cf47`](https://github.com/mastra-ai/mastra/commit/3f1cf476f74c1e4cc2df908837e05853a5347e31)]:
12
+ - @mastra/core@1.38.0-alpha.3
13
+
3
14
  ## 0.4.0
4
15
 
5
16
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -574,7 +574,9 @@ var DaytonaProcessHandle = class extends workspace.ProcessHandle {
574
574
  exitCode: 124,
575
575
  stdout: this.stdout,
576
576
  stderr: this.stderr || error.message,
577
- executionTimeMs: Date.now() - this._startTime
577
+ executionTimeMs: Date.now() - this._startTime,
578
+ killed: true,
579
+ timedOut: true
578
580
  };
579
581
  }
580
582
  throw error;
@@ -591,7 +593,9 @@ var DaytonaProcessHandle = class extends workspace.ProcessHandle {
591
593
  exitCode: this._exitCode ?? 137,
592
594
  stdout: this.stdout,
593
595
  stderr: this.stderr,
594
- executionTimeMs: Date.now() - this._startTime
596
+ executionTimeMs: Date.now() - this._startTime,
597
+ killed: true,
598
+ timedOut: false
595
599
  };
596
600
  }
597
601
  await this._resolveExitCode();
@@ -632,13 +636,13 @@ var DaytonaProcessManager = class extends workspace.SandboxProcessManager {
632
636
  ...options,
633
637
  timeout: options.timeout ?? this._defaultTimeout
634
638
  };
639
+ const mergedEnv = { ...this.env, ...effectiveOptions.env };
640
+ const envs = Object.fromEntries(
641
+ Object.entries(mergedEnv).filter((entry) => entry[1] !== void 0)
642
+ );
643
+ const sessionCommand = buildSpawnCommand(command, effectiveOptions.cwd, envs);
635
644
  return this.sandbox.retryOnDead(async () => {
636
645
  const sandbox = this.sandbox.daytona;
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);
642
646
  const sessionId = `mastra-proc-${Date.now().toString(36)}-${++this._spawnCounter}`;
643
647
  await sandbox.process.createSession(sessionId);
644
648
  const { cmdId } = await sandbox.process.executeSessionCommand(sessionId, {
@@ -671,9 +675,13 @@ var DaytonaProcessManager = class extends workspace.SandboxProcessManager {
671
675
  return result;
672
676
  }
673
677
  };
678
+ var SHELL_IDENTIFIER_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
674
679
  function buildSpawnCommand(command, cwd, envs) {
675
680
  const parts = [];
676
681
  for (const [k, v] of Object.entries(envs)) {
682
+ if (!SHELL_IDENTIFIER_PATTERN.test(k)) {
683
+ throw new Error(`Invalid environment variable name: ${JSON.stringify(k)}`);
684
+ }
677
685
  parts.push(`export ${k}=${shellQuote(v)}`);
678
686
  }
679
687
  if (cwd) {