Repository: mastra-ai/mastra
File: packages/core/src/workspace/sandbox/local-sandbox.ts (TypeScript)

Code before:
      onStderr?.(errorMsg);
      reject(err);
    });

    proc.on('close', (code, signal) => {
      if (timeoutId) clearTimeout(timeoutId);
      if (killed) {
        const timeoutMsg = `\nProcess timed out after ${timeout}ms`;
        onStderr?.(timeoutMsg);
        resolve({ stdout, stderr: stderr + timeoutMsg, exitCode: 124 });
      } else if (signal) {
        // When terminated by signal, code is null but signal contains the signal name
        const signalMsg = `\nProcess terminated by ${signal}`;
        onStderr?.(signalMsg);
        resolve({ stdout, stderr: stderr + signalMsg, exitCode: 128 });
      } else {
        resolve({ stdout, stderr, exitCode: code ?? 0 });
      }
    });
  });
}

/**
 * Local sandbox provider configuration.
 */
export interface LocalSandboxOptions extends Omit<MastraSandboxOptions, 'name'> {
  /** Unique identifier for this sandbox instance */
  id?: string;
  /** Working directory for command execution */
  workingDirectory?: string;
  /**
   * Environment variables to set for command execution.
   * PATH is included by default unless overridden (needed for finding executables).
   * Other host environment variables are not inherited unless explicitly passed.
   *
   * @example
   * ```typescript
   * // Default - only PATH is available
   * env: undefined
   *
   * // Add specific variables
   * env: { NODE_ENV: 'production', HOME: process.env.HOME }
   *
   * // Full host environment (less secure)
   * env: process.env
   * ```
   */
  env?: NodeJS.ProcessEnv;
  /** Default timeout for operations in ms (default: 30000) */
  timeout?: number;
  /**

Review comment (suggestion):
```suggestion
export interface LocalSandboxOptions extends MastraSandboxOptions {
```

Code after:
      onStderr?.(errorMsg);
      reject(err);
    });

    proc.on('close', (code, signal) => {
      if (timeoutId) clearTimeout(timeoutId);
      if (killed) {
        const timeoutMsg = `\nProcess timed out after ${timeout}ms`;
        onStderr?.(timeoutMsg);
        resolve({ stdout, stderr: stderr + timeoutMsg, exitCode: 124 });
      } else if (signal) {
        // When terminated by signal, code is null but signal contains the signal name
        const signalMsg = `\nProcess terminated by ${signal}`;
        onStderr?.(signalMsg);
        resolve({ stdout, stderr: stderr + signalMsg, exitCode: 128 });
      } else {
        resolve({ stdout, stderr, exitCode: code ?? 0 });
      }
    });
  });
}

/**
 * Local sandbox provider configuration.
 */
export interface LocalSandboxOptions extends MastraSandboxOptions {
  /** Unique identifier for this sandbox instance */
  id?: string;
  /** Working directory for command execution */
  workingDirectory?: string;
  /**
   * Environment variables to set for command execution.
   * PATH is included by default unless overridden (needed for finding executables).
   * Other host environment variables are not inherited unless explicitly passed.
   *
   * @example
   * ```typescript
   * // Default - only PATH is available
   * env: undefined
   *
   * // Add specific variables
   * env: { NODE_ENV: 'production', HOME: process.env.HOME }
   *
   * // Full host environment (less secure)
   * env: process.env
   * ```
   */
  env?: NodeJS.ProcessEnv;
  /** Default timeout for operations in ms (default: 30000) */
  timeout?: number;
  /**