@mastra/platform-workspace 1.2.0-alpha.1 → 1.2.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 +106 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +149 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +149 -2
- package/dist/index.js.map +1 -1
- package/dist/sandbox.d.ts +57 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/sandbox.d.ts
CHANGED
|
@@ -227,6 +227,22 @@ export declare class PlatformSandbox extends MastraSandbox {
|
|
|
227
227
|
* Mirrors OSS `@mastra/railway` `RailwaySandbox._startInFlight`.
|
|
228
228
|
*/
|
|
229
229
|
private _startInFlight;
|
|
230
|
+
/**
|
|
231
|
+
* Generation token for the sidecar probe. Incremented on every `start()`
|
|
232
|
+
* and on teardown. The probe captures this value when it begins; if the
|
|
233
|
+
* generation has changed by the time the probe succeeds, the probe skips
|
|
234
|
+
* the `set()` to avoid re-populating a deleted or superseded sandbox entry.
|
|
235
|
+
*/
|
|
236
|
+
private _probeGeneration;
|
|
237
|
+
/**
|
|
238
|
+
* In-flight sidecar probe promise. Concurrent `executeCommand` callers that
|
|
239
|
+
* arrive before the registry is populated all await this single promise so
|
|
240
|
+
* we don't fire N independent lease requests during the sidecar boot window.
|
|
241
|
+
* Once the probe resolves (success or timeout), callers check the registry
|
|
242
|
+
* and proceed — either via private-net (probe succeeded) or via lease (probe
|
|
243
|
+
* failed/timed out, but now coalesced via `_leaseInFlight`).
|
|
244
|
+
*/
|
|
245
|
+
private _transportReadyPromise;
|
|
230
246
|
constructor(options?: PlatformSandboxOptions);
|
|
231
247
|
private generateId;
|
|
232
248
|
/**
|
|
@@ -253,6 +269,18 @@ export declare class PlatformSandbox extends MastraSandbox {
|
|
|
253
269
|
* awaiter.
|
|
254
270
|
*/
|
|
255
271
|
private _doStart;
|
|
272
|
+
/**
|
|
273
|
+
* One timing summary per completed `start()` — the whole
|
|
274
|
+
* `PlatformSandbox`-visible boot in a single greppable line.
|
|
275
|
+
*
|
|
276
|
+
* `requestMs` is the proxy round-trip (`GET /sandbox/:id` on reattach,
|
|
277
|
+
* `POST /sandbox` including transient-5xx retries on provision) — a black
|
|
278
|
+
* box from this side that rolls up Railway RPC, sidecar launch, and the
|
|
279
|
+
* proxy's discovery exec. Sidecar probe cost is intentionally NOT here: the
|
|
280
|
+
* probe is fire-and-forget and outlives `start()` by design, so its
|
|
281
|
+
* duration lands on the `platform-workspace probe ok` line instead.
|
|
282
|
+
*/
|
|
283
|
+
private _logStartComplete;
|
|
256
284
|
/**
|
|
257
285
|
* Copy `response.instanceUrl` into the injected {@link SandboxAddressRegistry}
|
|
258
286
|
* when both are present. Called from both {@link start} branches (fresh
|
|
@@ -270,6 +298,33 @@ export declare class PlatformSandbox extends MastraSandbox {
|
|
|
270
298
|
* through to the lease path with no branch here.
|
|
271
299
|
*/
|
|
272
300
|
private _populateAddressFromResponse;
|
|
301
|
+
/**
|
|
302
|
+
* Fire-and-forget probe that polls the sidecar's `/health` endpoint until
|
|
303
|
+
* it responds, then populates the address registry. Runs detached from
|
|
304
|
+
* `start()` so sandbox provision latency is unchanged; early execs simply
|
|
305
|
+
* fall back to the lease path until the probe succeeds.
|
|
306
|
+
*
|
|
307
|
+
* If the sidecar never comes up within {@link SIDECAR_PROBE_TIMEOUT_MS},
|
|
308
|
+
* the registry stays unpopulated and all execs go via lease for this
|
|
309
|
+
* sandbox's lifetime (or until a future `start()` re-runs the probe).
|
|
310
|
+
*
|
|
311
|
+
* @param generation - The probe generation captured at call time. If this
|
|
312
|
+
* no longer matches `_probeGeneration` when the probe succeeds, the probe
|
|
313
|
+
* was superseded by a teardown or a new `start()`, so we skip the `set()`.
|
|
314
|
+
*/
|
|
315
|
+
private _probeSidecarThenRegister;
|
|
316
|
+
/**
|
|
317
|
+
* Wait for the transport to become ready (sidecar probe succeeds) or time
|
|
318
|
+
* out. Concurrent callers all await the same probe promise, coalescing the
|
|
319
|
+
* cold-start storm into a single warmup attempt.
|
|
320
|
+
*
|
|
321
|
+
* If no probe is in flight (no registry, or registry already populated),
|
|
322
|
+
* this returns immediately. After the wait (success or timeout), callers
|
|
323
|
+
* check the registry and proceed — either via private-net or lease. The
|
|
324
|
+
* lease path is still coalesced via `_leaseInFlight`, so even if the probe
|
|
325
|
+
* times out, we only mint one lease for all concurrent execs.
|
|
326
|
+
*/
|
|
327
|
+
private _awaitTransportReady;
|
|
273
328
|
/**
|
|
274
329
|
* Stop the sandbox while **preserving its recovery checkpoint**.
|
|
275
330
|
*
|
|
@@ -311,6 +366,8 @@ export declare class PlatformSandbox extends MastraSandbox {
|
|
|
311
366
|
* before this call.
|
|
312
367
|
*/
|
|
313
368
|
private _teardownSandbox;
|
|
369
|
+
/** Persist the configured recovery checkpoint when available. */
|
|
370
|
+
snapshot(): Promise<void>;
|
|
314
371
|
/**
|
|
315
372
|
* Capture the sandbox's checkpoint on demand, outside any refresh timer the
|
|
316
373
|
* workspace-proxy owns internally.
|
package/dist/sandbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAwB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACnH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAE,0BAA0B,EAAa,MAAM,kBAAkB,CAAC;AAE9E,OAAO,K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,CAAC,aAAa,CAAC;IA0E/G;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,cAAc;IA+F5B;;;;;;;;;;;;OAYG;YACW,yBAAyB;IAgEvC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;;;;;OAMG;YACW,YAAY;IA0CpB,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAuDrC,eAAe,CAAC,IAAI,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE,GAAG,MAAM;CAQpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/platform-workspace",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Mastra Platform workspace sandbox and filesystem providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"tsdown": "0.22.9",
|
|
28
28
|
"typescript": "^6.0.3",
|
|
29
29
|
"vitest": "4.1.10",
|
|
30
|
-
"@internal/
|
|
31
|
-
"@internal/
|
|
32
|
-
"@mastra/core": "1.58.0
|
|
30
|
+
"@internal/types-builder": "0.0.97",
|
|
31
|
+
"@internal/lint": "0.0.122",
|
|
32
|
+
"@mastra/core": "1.58.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@mastra/core": ">=1.4.0-0 <2.0.0-0"
|