@mastra/platform-workspace 1.12.0 → 1.13.0-alpha.1
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/factory-sandbox.d.ts +2 -0
- package/dist/factory-sandbox.d.ts.map +1 -1
- package/dist/index.cjs +31 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -6
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/repo-template.d.ts +7 -0
- package/dist/repo-template.d.ts.map +1 -1
- package/dist/sandbox.d.ts +7 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1971,6 +1971,7 @@ var PlatformSandbox = class PlatformSandbox extends MastraSandbox {
|
|
|
1971
1971
|
_templateResolutionInFlight;
|
|
1972
1972
|
_idleTimeoutMinutes;
|
|
1973
1973
|
_networkIsolation;
|
|
1974
|
+
_publicPorts;
|
|
1974
1975
|
_env;
|
|
1975
1976
|
_timeout;
|
|
1976
1977
|
_instructionsOverride;
|
|
@@ -2069,6 +2070,7 @@ var PlatformSandbox = class PlatformSandbox extends MastraSandbox {
|
|
|
2069
2070
|
this._template = options.template;
|
|
2070
2071
|
this._idleTimeoutMinutes = options.idleTimeoutMinutes;
|
|
2071
2072
|
this._networkIsolation = options.networkIsolation;
|
|
2073
|
+
this._publicPorts = options.publicPorts;
|
|
2072
2074
|
this._env = options.env ?? {};
|
|
2073
2075
|
this._timeout = options.timeout;
|
|
2074
2076
|
this._instructionsOverride = options.instructions;
|
|
@@ -2126,6 +2128,7 @@ var PlatformSandbox = class PlatformSandbox extends MastraSandbox {
|
|
|
2126
2128
|
...this._template !== void 0 && { template: this._template },
|
|
2127
2129
|
idleTimeoutMinutes: options.idleTimeoutMinutes ?? this._idleTimeoutMinutes,
|
|
2128
2130
|
...this._networkIsolation !== void 0 && { networkIsolation: this._networkIsolation },
|
|
2131
|
+
...this._publicPorts !== void 0 && { publicPorts: this._publicPorts },
|
|
2129
2132
|
env: options.env ?? this._env,
|
|
2130
2133
|
...this._timeout !== void 0 && { timeout: this._timeout },
|
|
2131
2134
|
...this._instructionsOverride !== void 0 && { instructions: this._instructionsOverride },
|
|
@@ -2181,6 +2184,7 @@ var PlatformSandbox = class PlatformSandbox extends MastraSandbox {
|
|
|
2181
2184
|
environmentId: this._environmentId,
|
|
2182
2185
|
idleTimeoutMinutes: this._idleTimeoutMinutes,
|
|
2183
2186
|
networkIsolation: this._networkIsolation,
|
|
2187
|
+
publicPorts: this._publicPorts,
|
|
2184
2188
|
env: this._env
|
|
2185
2189
|
});
|
|
2186
2190
|
let response;
|
|
@@ -3122,6 +3126,7 @@ function createRepoTemplate(options) {
|
|
|
3122
3126
|
for (const repo of repos) if (repo.tokenEnv && repo.token) buildEnv[repo.tokenEnv] = repo.token;
|
|
3123
3127
|
if (Object.keys(buildEnv).length > 0) template = template.setEnvs(buildEnv, { ephemeral: true });
|
|
3124
3128
|
template = withResources(template, options);
|
|
3129
|
+
if (options.buildEnvRevision) template = template.setEnvs({ MASTRA_BUILD_ENV_REVISION: options.buildEnvRevision });
|
|
3125
3130
|
if (workingDirectory) template = template.runCmd(`mkdir -p "${workingDirectory}"`).setWorkdir(workingDirectory);
|
|
3126
3131
|
const ordered = [...repos.filter((repo) => !repo.token), ...repos.filter((repo) => repo.token)];
|
|
3127
3132
|
for (const repo of ordered) {
|
|
@@ -3320,6 +3325,11 @@ const platformSandboxProvider = {
|
|
|
3320
3325
|
enum: ["ISOLATED", "PRIVATE"],
|
|
3321
3326
|
default: "ISOLATED"
|
|
3322
3327
|
},
|
|
3328
|
+
publicPorts: {
|
|
3329
|
+
type: "boolean",
|
|
3330
|
+
description: "Let anyone with a port URL reach it without signing in",
|
|
3331
|
+
default: false
|
|
3332
|
+
},
|
|
3323
3333
|
env: {
|
|
3324
3334
|
type: "object",
|
|
3325
3335
|
description: "Environment variables",
|
|
@@ -3367,7 +3377,8 @@ const DEFAULT_SETTINGS = {
|
|
|
3367
3377
|
cpuCount: 2,
|
|
3368
3378
|
memoryMb: 1024,
|
|
3369
3379
|
docker: false,
|
|
3370
|
-
idleTimeoutMinutes: 5
|
|
3380
|
+
idleTimeoutMinutes: 5,
|
|
3381
|
+
publicPorts: false
|
|
3371
3382
|
};
|
|
3372
3383
|
const SETTINGS_SCHEMA = {
|
|
3373
3384
|
type: "object",
|
|
@@ -3421,14 +3432,20 @@ const SETTINGS_SCHEMA = {
|
|
|
3421
3432
|
default: DEFAULT_SETTINGS.idleTimeoutMinutes,
|
|
3422
3433
|
minimum: 1,
|
|
3423
3434
|
maximum: 1440
|
|
3435
|
+
},
|
|
3436
|
+
publicPorts: {
|
|
3437
|
+
type: "boolean",
|
|
3438
|
+
title: "Public preview links",
|
|
3439
|
+
description: "Anyone with a sandbox's preview link can open it without signing in. Applies to newly created sandboxes, not existing ones.",
|
|
3440
|
+
default: DEFAULT_SETTINGS.publicPorts
|
|
3424
3441
|
}
|
|
3425
3442
|
},
|
|
3426
3443
|
additionalProperties: false
|
|
3427
3444
|
};
|
|
3428
3445
|
/**
|
|
3429
3446
|
* The settings schema with the provider's effective defaults as `default`:
|
|
3430
|
-
* the built-in values, overridden by the host's `idleTimeoutMinutes`
|
|
3431
|
-
* then its `defaults` option. The schema
|
|
3447
|
+
* the built-in values, overridden by the host's `idleTimeoutMinutes` and
|
|
3448
|
+
* `publicPorts` options and then its `defaults` option. The schema
|
|
3432
3449
|
* is what clients show as placeholders, so it must match what the provider
|
|
3433
3450
|
* applies when a setting is unset.
|
|
3434
3451
|
*/
|
|
@@ -3474,14 +3491,21 @@ var PlatformFactorySandbox = class extends FactorySandbox {
|
|
|
3474
3491
|
this.#options = options;
|
|
3475
3492
|
this.settings = settingsSchema({
|
|
3476
3493
|
...options.idleTimeoutMinutes !== void 0 ? { idleTimeoutMinutes: options.idleTimeoutMinutes } : {},
|
|
3494
|
+
...options.publicPorts !== void 0 ? { publicPorts: options.publicPorts } : {},
|
|
3477
3495
|
...options.defaults
|
|
3478
3496
|
});
|
|
3479
3497
|
}
|
|
3480
3498
|
template(ctx, settings) {
|
|
3481
3499
|
const { defaults, template } = this.#options;
|
|
3500
|
+
const { buildEnv, buildEnvRevision, ...rest } = ctx;
|
|
3501
|
+
const mergedBuildEnv = {
|
|
3502
|
+
...template?.buildEnv,
|
|
3503
|
+
...buildEnv
|
|
3504
|
+
};
|
|
3482
3505
|
return createRepoTemplate({
|
|
3483
|
-
...
|
|
3484
|
-
...
|
|
3506
|
+
...rest,
|
|
3507
|
+
...Object.keys(mergedBuildEnv).length > 0 ? { buildEnv: mergedBuildEnv } : {},
|
|
3508
|
+
...buildEnvRevision ? { buildEnvRevision } : {},
|
|
3485
3509
|
cpuCount: settings.cpuCount ?? defaults?.cpuCount ?? DEFAULT_SETTINGS.cpuCount,
|
|
3486
3510
|
memoryMB: settings.memoryMb ?? defaults?.memoryMb ?? DEFAULT_SETTINGS.memoryMb,
|
|
3487
3511
|
docker: settings.docker ?? defaults?.docker ?? DEFAULT_SETTINGS.docker
|
|
@@ -3497,7 +3521,8 @@ var PlatformFactorySandbox = class extends FactorySandbox {
|
|
|
3497
3521
|
sandboxId: ctx.sandboxId,
|
|
3498
3522
|
template: this.template(ctx, settings),
|
|
3499
3523
|
...ctx.workingDirectory ? { workingDirectory: ctx.workingDirectory } : {},
|
|
3500
|
-
idleTimeoutMinutes: settings.idleTimeoutMinutes ?? defaults?.idleTimeoutMinutes ?? options.idleTimeoutMinutes ?? DEFAULT_SETTINGS.idleTimeoutMinutes
|
|
3524
|
+
idleTimeoutMinutes: settings.idleTimeoutMinutes ?? defaults?.idleTimeoutMinutes ?? options.idleTimeoutMinutes ?? DEFAULT_SETTINGS.idleTimeoutMinutes,
|
|
3525
|
+
publicPorts: settings.publicPorts ?? defaults?.publicPorts ?? options.publicPorts ?? DEFAULT_SETTINGS.publicPorts
|
|
3501
3526
|
});
|
|
3502
3527
|
}
|
|
3503
3528
|
async #startBuild(ctx, settings) {
|