@mastra/platform-workspace 1.12.0 → 1.13.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/factory-sandbox.d.ts +2 -0
- package/dist/factory-sandbox.d.ts.map +1 -1
- package/dist/index.cjs +22 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/provider.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
|
@@ -14,6 +14,8 @@ export interface PlatformFactorySandboxSettings extends Record<string, unknown>
|
|
|
14
14
|
docker?: boolean;
|
|
15
15
|
/** Minutes idle before the sandbox pauses. Runtime only. */
|
|
16
16
|
idleTimeoutMinutes?: number;
|
|
17
|
+
/** Let anyone with a port's URL open it without signing in. Fixed when a sandbox is created. */
|
|
18
|
+
publicPorts?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export interface PlatformFactorySandboxOptions extends Omit<PlatformSandboxOptions, 'id' | 'sandboxId' | 'sessionId' | 'template' | 'env'> {
|
|
19
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory-sandbox.d.ts","sourceRoot":"","sources":["../src/factory-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAIV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAG3D,uHAAuH;AACvH,MAAM,WAAW,8BAA+B,SAAQ,MAAM,CAA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C,CAAC,GAAG,EAAE,qBAAqB,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxF,mDAAmD;IACnD,QAAQ,CAAC,EAAE;QACT,qFAAqF;QACrF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC,CAAC;IACF,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,cAAc,CAAC,8BAA8B,CAAC;;IACxF,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,8BAA8B,CAAC,CAAC;IAehE,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,8BAA8B,CAAC,CAGnE;IAEF,YAAY,OAAO,GAAE,6BAAkC,EAQtD;IAED,QAAQ,CACN,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,8BAA8B,GACvC,4BAA4B,GAAG,SAAS,CAS1C;IAED,MAAM,CAAC,GAAG,EAAE,qBAAqB,EAAE,QAAQ,EAAE,8BAA8B,GAAG,eAAe,CAmB5F;CA4CF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1994,6 +1994,7 @@ var PlatformSandbox = class PlatformSandbox extends _mastra_core_workspace.Mastr
|
|
|
1994
1994
|
_templateResolutionInFlight;
|
|
1995
1995
|
_idleTimeoutMinutes;
|
|
1996
1996
|
_networkIsolation;
|
|
1997
|
+
_publicPorts;
|
|
1997
1998
|
_env;
|
|
1998
1999
|
_timeout;
|
|
1999
2000
|
_instructionsOverride;
|
|
@@ -2092,6 +2093,7 @@ var PlatformSandbox = class PlatformSandbox extends _mastra_core_workspace.Mastr
|
|
|
2092
2093
|
this._template = options.template;
|
|
2093
2094
|
this._idleTimeoutMinutes = options.idleTimeoutMinutes;
|
|
2094
2095
|
this._networkIsolation = options.networkIsolation;
|
|
2096
|
+
this._publicPorts = options.publicPorts;
|
|
2095
2097
|
this._env = options.env ?? {};
|
|
2096
2098
|
this._timeout = options.timeout;
|
|
2097
2099
|
this._instructionsOverride = options.instructions;
|
|
@@ -2149,6 +2151,7 @@ var PlatformSandbox = class PlatformSandbox extends _mastra_core_workspace.Mastr
|
|
|
2149
2151
|
...this._template !== void 0 && { template: this._template },
|
|
2150
2152
|
idleTimeoutMinutes: options.idleTimeoutMinutes ?? this._idleTimeoutMinutes,
|
|
2151
2153
|
...this._networkIsolation !== void 0 && { networkIsolation: this._networkIsolation },
|
|
2154
|
+
...this._publicPorts !== void 0 && { publicPorts: this._publicPorts },
|
|
2152
2155
|
env: options.env ?? this._env,
|
|
2153
2156
|
...this._timeout !== void 0 && { timeout: this._timeout },
|
|
2154
2157
|
...this._instructionsOverride !== void 0 && { instructions: this._instructionsOverride },
|
|
@@ -2204,6 +2207,7 @@ var PlatformSandbox = class PlatformSandbox extends _mastra_core_workspace.Mastr
|
|
|
2204
2207
|
environmentId: this._environmentId,
|
|
2205
2208
|
idleTimeoutMinutes: this._idleTimeoutMinutes,
|
|
2206
2209
|
networkIsolation: this._networkIsolation,
|
|
2210
|
+
publicPorts: this._publicPorts,
|
|
2207
2211
|
env: this._env
|
|
2208
2212
|
});
|
|
2209
2213
|
let response;
|
|
@@ -3343,6 +3347,11 @@ const platformSandboxProvider = {
|
|
|
3343
3347
|
enum: ["ISOLATED", "PRIVATE"],
|
|
3344
3348
|
default: "ISOLATED"
|
|
3345
3349
|
},
|
|
3350
|
+
publicPorts: {
|
|
3351
|
+
type: "boolean",
|
|
3352
|
+
description: "Let anyone with a port URL reach it without signing in",
|
|
3353
|
+
default: false
|
|
3354
|
+
},
|
|
3346
3355
|
env: {
|
|
3347
3356
|
type: "object",
|
|
3348
3357
|
description: "Environment variables",
|
|
@@ -3390,7 +3399,8 @@ const DEFAULT_SETTINGS = {
|
|
|
3390
3399
|
cpuCount: 2,
|
|
3391
3400
|
memoryMb: 1024,
|
|
3392
3401
|
docker: false,
|
|
3393
|
-
idleTimeoutMinutes: 5
|
|
3402
|
+
idleTimeoutMinutes: 5,
|
|
3403
|
+
publicPorts: false
|
|
3394
3404
|
};
|
|
3395
3405
|
const SETTINGS_SCHEMA = {
|
|
3396
3406
|
type: "object",
|
|
@@ -3444,14 +3454,20 @@ const SETTINGS_SCHEMA = {
|
|
|
3444
3454
|
default: DEFAULT_SETTINGS.idleTimeoutMinutes,
|
|
3445
3455
|
minimum: 1,
|
|
3446
3456
|
maximum: 1440
|
|
3457
|
+
},
|
|
3458
|
+
publicPorts: {
|
|
3459
|
+
type: "boolean",
|
|
3460
|
+
title: "Public preview links",
|
|
3461
|
+
description: "Anyone with a sandbox's preview link can open it without signing in. Applies to newly created sandboxes, not existing ones.",
|
|
3462
|
+
default: DEFAULT_SETTINGS.publicPorts
|
|
3447
3463
|
}
|
|
3448
3464
|
},
|
|
3449
3465
|
additionalProperties: false
|
|
3450
3466
|
};
|
|
3451
3467
|
/**
|
|
3452
3468
|
* The settings schema with the provider's effective defaults as `default`:
|
|
3453
|
-
* the built-in values, overridden by the host's `idleTimeoutMinutes`
|
|
3454
|
-
* then its `defaults` option. The schema
|
|
3469
|
+
* the built-in values, overridden by the host's `idleTimeoutMinutes` and
|
|
3470
|
+
* `publicPorts` options and then its `defaults` option. The schema
|
|
3455
3471
|
* is what clients show as placeholders, so it must match what the provider
|
|
3456
3472
|
* applies when a setting is unset.
|
|
3457
3473
|
*/
|
|
@@ -3497,6 +3513,7 @@ var PlatformFactorySandbox = class extends _mastra_core_workspace.FactorySandbox
|
|
|
3497
3513
|
this.#options = options;
|
|
3498
3514
|
this.settings = settingsSchema({
|
|
3499
3515
|
...options.idleTimeoutMinutes !== void 0 ? { idleTimeoutMinutes: options.idleTimeoutMinutes } : {},
|
|
3516
|
+
...options.publicPorts !== void 0 ? { publicPorts: options.publicPorts } : {},
|
|
3500
3517
|
...options.defaults
|
|
3501
3518
|
});
|
|
3502
3519
|
}
|
|
@@ -3520,7 +3537,8 @@ var PlatformFactorySandbox = class extends _mastra_core_workspace.FactorySandbox
|
|
|
3520
3537
|
sandboxId: ctx.sandboxId,
|
|
3521
3538
|
template: this.template(ctx, settings),
|
|
3522
3539
|
...ctx.workingDirectory ? { workingDirectory: ctx.workingDirectory } : {},
|
|
3523
|
-
idleTimeoutMinutes: settings.idleTimeoutMinutes ?? defaults?.idleTimeoutMinutes ?? options.idleTimeoutMinutes ?? DEFAULT_SETTINGS.idleTimeoutMinutes
|
|
3540
|
+
idleTimeoutMinutes: settings.idleTimeoutMinutes ?? defaults?.idleTimeoutMinutes ?? options.idleTimeoutMinutes ?? DEFAULT_SETTINGS.idleTimeoutMinutes,
|
|
3541
|
+
publicPorts: settings.publicPorts ?? defaults?.publicPorts ?? options.publicPorts ?? DEFAULT_SETTINGS.publicPorts
|
|
3524
3542
|
});
|
|
3525
3543
|
}
|
|
3526
3544
|
async #startBuild(ctx, settings) {
|