@mastra/platform-workspace 1.14.0-alpha.1 → 1.14.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.
@@ -1,4 +1,4 @@
1
- import type { CommandsApi } from './_types/@internal_workspace@0.0.23/dist/index.js';
1
+ import type { CommandsApi } from './_types/@internal_workspace@0.0.24/dist/index.js';
2
2
  import type { EntryInfo } from 'e2b';
3
3
  import type { DirectExecOptions, DirectExecResult, ExecLease } from './direct-exec.js';
4
4
  export interface E2BExecLease extends ExecLease {
package/dist/index.cjs CHANGED
@@ -3445,6 +3445,22 @@ const platformFilesystemProvider = {
3445
3445
  createFilesystem: (config) => new PlatformFilesystem(config)
3446
3446
  };
3447
3447
  // src/factory-sandbox.ts
3448
+ /** vCPU counts a sandbox can be created with: one, or an even number up to 8. Any other count fails at creation. */
3449
+ const CPU_COUNTS = [
3450
+ 1,
3451
+ 2,
3452
+ 4,
3453
+ 6,
3454
+ 8
3455
+ ];
3456
+ /**
3457
+ * The first of `counts` that is offered, else the built-in default. A count saved
3458
+ * before the list existed, or passed as a default, may not be on it; a saved one
3459
+ * falls back to the configured default, the same as once Factory drops it.
3460
+ */
3461
+ function offeredCpuCount(...counts) {
3462
+ return counts.find((count) => count !== void 0 && CPU_COUNTS.includes(count)) ?? DEFAULT_SETTINGS.cpuCount;
3463
+ }
3448
3464
  /** Applied when neither the environment setting nor a host default is set. */
3449
3465
  const DEFAULT_SETTINGS = {
3450
3466
  cpuCount: 2,
@@ -3461,8 +3477,7 @@ const SETTINGS_SCHEMA = {
3461
3477
  title: "CPU",
3462
3478
  description: "vCPUs for the sandbox template",
3463
3479
  default: DEFAULT_SETTINGS.cpuCount,
3464
- minimum: 1,
3465
- maximum: 64
3480
+ oneOf: CPU_COUNTS.map((count) => ({ const: count }))
3466
3481
  },
3467
3482
  memoryMb: {
3468
3483
  type: "integer",
@@ -3527,6 +3542,7 @@ function settingsSchema(defaults) {
3527
3542
  ...DEFAULT_SETTINGS,
3528
3543
  ...defaults
3529
3544
  };
3545
+ effective.cpuCount = offeredCpuCount(effective.cpuCount);
3530
3546
  const properties = Object.fromEntries(Object.entries(SETTINGS_SCHEMA.properties).map(([key, property]) => [key, {
3531
3547
  ...property,
3532
3548
  default: effective[key]
@@ -3579,7 +3595,7 @@ var PlatformFactorySandbox = class extends _mastra_core_workspace.FactorySandbox
3579
3595
  ...rest,
3580
3596
  ...Object.keys(mergedBuildEnv).length > 0 ? { buildEnv: mergedBuildEnv } : {},
3581
3597
  ...buildEnvRevision ? { buildEnvRevision } : {},
3582
- cpuCount: settings.cpuCount ?? defaults?.cpuCount ?? DEFAULT_SETTINGS.cpuCount,
3598
+ cpuCount: offeredCpuCount(settings.cpuCount, defaults?.cpuCount),
3583
3599
  memoryMB: settings.memoryMb ?? defaults?.memoryMb ?? DEFAULT_SETTINGS.memoryMb,
3584
3600
  docker: settings.docker ?? defaults?.docker ?? DEFAULT_SETTINGS.docker
3585
3601
  });
package/dist/index.js CHANGED
@@ -3422,6 +3422,22 @@ const platformFilesystemProvider = {
3422
3422
  createFilesystem: (config) => new PlatformFilesystem(config)
3423
3423
  };
3424
3424
  // src/factory-sandbox.ts
3425
+ /** vCPU counts a sandbox can be created with: one, or an even number up to 8. Any other count fails at creation. */
3426
+ const CPU_COUNTS = [
3427
+ 1,
3428
+ 2,
3429
+ 4,
3430
+ 6,
3431
+ 8
3432
+ ];
3433
+ /**
3434
+ * The first of `counts` that is offered, else the built-in default. A count saved
3435
+ * before the list existed, or passed as a default, may not be on it; a saved one
3436
+ * falls back to the configured default, the same as once Factory drops it.
3437
+ */
3438
+ function offeredCpuCount(...counts) {
3439
+ return counts.find((count) => count !== void 0 && CPU_COUNTS.includes(count)) ?? DEFAULT_SETTINGS.cpuCount;
3440
+ }
3425
3441
  /** Applied when neither the environment setting nor a host default is set. */
3426
3442
  const DEFAULT_SETTINGS = {
3427
3443
  cpuCount: 2,
@@ -3438,8 +3454,7 @@ const SETTINGS_SCHEMA = {
3438
3454
  title: "CPU",
3439
3455
  description: "vCPUs for the sandbox template",
3440
3456
  default: DEFAULT_SETTINGS.cpuCount,
3441
- minimum: 1,
3442
- maximum: 64
3457
+ oneOf: CPU_COUNTS.map((count) => ({ const: count }))
3443
3458
  },
3444
3459
  memoryMb: {
3445
3460
  type: "integer",
@@ -3504,6 +3519,7 @@ function settingsSchema(defaults) {
3504
3519
  ...DEFAULT_SETTINGS,
3505
3520
  ...defaults
3506
3521
  };
3522
+ effective.cpuCount = offeredCpuCount(effective.cpuCount);
3507
3523
  const properties = Object.fromEntries(Object.entries(SETTINGS_SCHEMA.properties).map(([key, property]) => [key, {
3508
3524
  ...property,
3509
3525
  default: effective[key]
@@ -3556,7 +3572,7 @@ var PlatformFactorySandbox = class extends FactorySandbox {
3556
3572
  ...rest,
3557
3573
  ...Object.keys(mergedBuildEnv).length > 0 ? { buildEnv: mergedBuildEnv } : {},
3558
3574
  ...buildEnvRevision ? { buildEnvRevision } : {},
3559
- cpuCount: settings.cpuCount ?? defaults?.cpuCount ?? DEFAULT_SETTINGS.cpuCount,
3575
+ cpuCount: offeredCpuCount(settings.cpuCount, defaults?.cpuCount),
3560
3576
  memoryMB: settings.memoryMb ?? defaults?.memoryMb ?? DEFAULT_SETTINGS.memoryMb,
3561
3577
  docker: settings.docker ?? defaults?.docker ?? DEFAULT_SETTINGS.docker
3562
3578
  });
@@ -1,5 +1,5 @@
1
- import { FilesApiFilesystem } from './_types/@internal_workspace@0.0.23/dist/index.js';
2
- import type { FilesApi, FilesApiErrorKind, FilesCommandResult } from './_types/@internal_workspace@0.0.23/dist/index.js';
1
+ import { FilesApiFilesystem } from './_types/@internal_workspace@0.0.24/dist/index.js';
2
+ import type { FilesApi, FilesApiErrorKind, FilesCommandResult } from './_types/@internal_workspace@0.0.24/dist/index.js';
3
3
  import type { ProviderStatus } from '@mastra/core/workspace';
4
4
  import type { E2BFiles } from './e2b-exec.js';
5
5
  /** How `PlatformSandbox` lends its files API and shell to the filesystem. */
package/dist/sandbox.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CommandsApi, CommandsApiOperation } from './_types/@internal_workspace@0.0.23/dist/index.js';
1
+ import type { CommandsApi, CommandsApiOperation } from './_types/@internal_workspace@0.0.24/dist/index.js';
2
2
  import type { RequestContext } from '@mastra/core/di';
3
3
  import type { CommandResult, ExecuteCommandOptions, InstructionsOption, MastraSandboxOptions, ProviderStatus, SandboxCloneOptions, SandboxInfo, SandboxNetworking, SandboxStartResult } from '@mastra/core/workspace';
4
4
  import { MastraSandbox, SandboxProcessManager } from '@mastra/core/workspace';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/platform-workspace",
3
- "version": "1.14.0-alpha.1",
3
+ "version": "1.14.1-alpha.0",
4
4
  "description": "Mastra Platform workspace sandbox and filesystem providers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,10 +26,10 @@
26
26
  "tsdown": "0.23.1",
27
27
  "typescript": "^7.0.2",
28
28
  "vitest": "5.1.0",
29
- "@internal/types-builder": "0.0.126",
30
- "@internal/lint": "0.0.151",
31
- "@internal/workspace": "0.0.23",
32
- "@mastra/core": "1.86.0-alpha.9"
29
+ "@internal/lint": "0.0.152",
30
+ "@internal/types-builder": "0.0.127",
31
+ "@internal/workspace": "0.0.24",
32
+ "@mastra/core": "1.87.0-alpha.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@mastra/core": ">=1.80.0-0 <2.0.0-0"