@mastra/blaxel 0.1.1 → 0.2.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/CHANGELOG.md +28 -0
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +6 -2
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/process-manager.d.ts +0 -1
- package/dist/sandbox/process-manager.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/blaxel
|
|
2
2
|
|
|
3
|
+
## 0.2.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added provider-specific `blaxel` getter to access the underlying Blaxel `SandboxInstance` directly. Deprecated the generic `instance` getter in favor of the new `blaxel` getter for better IDE discoverability and consistency with other sandbox providers. ([#14166](https://github.com/mastra-ai/mastra/pull/14166))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// Before
|
|
11
|
+
const blaxelSandbox = sandbox.instance;
|
|
12
|
+
|
|
13
|
+
// After
|
|
14
|
+
const blaxelSandbox = sandbox.blaxel;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Use provider-native string process IDs directly as `ProcessHandle.pid`, removing the previous `parseInt()` workaround. ([#13591](https://github.com/mastra-ai/mastra/pull/13591))
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
const handle = await sandbox.processes.spawn('node server.js');
|
|
23
|
+
handle.pid; // string — the Blaxel SDK's native process ID
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- dependencies updates: ([#13591](https://github.com/mastra-ai/mastra/pull/13591))
|
|
27
|
+
- Updated peerDependency `@mastra/core` to `>=1.12.0-0 <2.0.0-0`
|
|
28
|
+
- Updated dependencies [[`9cede11`](https://github.com/mastra-ai/mastra/commit/9cede110abac9d93072e0521bb3c8bcafb9fdadf), [`a59f126`](https://github.com/mastra-ai/mastra/commit/a59f1269104f54726699c5cdb98c72c93606d2df), [`c510833`](https://github.com/mastra-ai/mastra/commit/c5108333e8cbc19dafee5f8bfefbcb5ee935335c), [`7296fcc`](https://github.com/mastra-ai/mastra/commit/7296fcc599c876a68699a71c7054a16d5aaf2337), [`00c27f9`](https://github.com/mastra-ai/mastra/commit/00c27f9080731433230a61be69c44e39a7a7b4c7), [`ee19c9b`](https://github.com/mastra-ai/mastra/commit/ee19c9ba3ec3ed91feb214ad539bdc766c53bb01)]:
|
|
29
|
+
- @mastra/core@1.12.0-alpha.1
|
|
30
|
+
|
|
3
31
|
## 0.1.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -261,7 +261,6 @@ ${installResult.stderr}`
|
|
|
261
261
|
}
|
|
262
262
|
var BlaxelProcessHandle = class extends workspace.ProcessHandle {
|
|
263
263
|
pid;
|
|
264
|
-
_identifier;
|
|
265
264
|
_sandbox;
|
|
266
265
|
_startTime;
|
|
267
266
|
_exitCode;
|
|
@@ -269,10 +268,9 @@ var BlaxelProcessHandle = class extends workspace.ProcessHandle {
|
|
|
269
268
|
_streamingDone = null;
|
|
270
269
|
_closeStream = null;
|
|
271
270
|
_killed = false;
|
|
272
|
-
constructor(pid,
|
|
271
|
+
constructor(pid, sandbox, startTime, options) {
|
|
273
272
|
super(options);
|
|
274
273
|
this.pid = pid;
|
|
275
|
-
this._identifier = identifier;
|
|
276
274
|
this._sandbox = sandbox;
|
|
277
275
|
this._startTime = startTime;
|
|
278
276
|
}
|
|
@@ -289,7 +287,7 @@ var BlaxelProcessHandle = class extends workspace.ProcessHandle {
|
|
|
289
287
|
async _resolveExitCode() {
|
|
290
288
|
if (this._exitCode !== void 0) return;
|
|
291
289
|
try {
|
|
292
|
-
const proc = await this._sandbox.process.get(this.
|
|
290
|
+
const proc = await this._sandbox.process.get(this.pid);
|
|
293
291
|
this._exitCode = proc.status === "completed" ? proc.exitCode ?? 0 : proc.exitCode ?? 1;
|
|
294
292
|
} catch {
|
|
295
293
|
if (this._exitCode === void 0) {
|
|
@@ -332,7 +330,7 @@ var BlaxelProcessHandle = class extends workspace.ProcessHandle {
|
|
|
332
330
|
this._exitCode = 137;
|
|
333
331
|
this._closeStream?.();
|
|
334
332
|
try {
|
|
335
|
-
await this._sandbox.process.kill(this.
|
|
333
|
+
await this._sandbox.process.kill(this.pid);
|
|
336
334
|
} catch {
|
|
337
335
|
}
|
|
338
336
|
return true;
|
|
@@ -347,7 +345,7 @@ var BlaxelProcessManager = class extends workspace.SandboxProcessManager {
|
|
|
347
345
|
}
|
|
348
346
|
async spawn(command, options = {}) {
|
|
349
347
|
return this.sandbox.retryOnDead(async () => {
|
|
350
|
-
const blaxel = this.sandbox.
|
|
348
|
+
const blaxel = this.sandbox.blaxel;
|
|
351
349
|
const mergedEnv = { ...this.env, ...options.env };
|
|
352
350
|
const envs = Object.fromEntries(
|
|
353
351
|
Object.entries(mergedEnv).filter((entry) => entry[1] !== void 0)
|
|
@@ -359,10 +357,9 @@ var BlaxelProcessManager = class extends workspace.SandboxProcessManager {
|
|
|
359
357
|
...Object.keys(envs).length > 0 && { env: envs },
|
|
360
358
|
...options.timeout && { timeout: Math.ceil(options.timeout / 1e3) }
|
|
361
359
|
});
|
|
362
|
-
const
|
|
363
|
-
const
|
|
364
|
-
const
|
|
365
|
-
const streamControl = blaxel.process.streamLogs(identifier, {
|
|
360
|
+
const pid = result.pid;
|
|
361
|
+
const handle = new BlaxelProcessHandle(pid, blaxel, Date.now(), options);
|
|
362
|
+
const streamControl = blaxel.process.streamLogs(pid, {
|
|
366
363
|
onStdout: (data) => handle.emitStdout(data),
|
|
367
364
|
onStderr: (data) => handle.emitStderr(data),
|
|
368
365
|
onError: (err) => {
|
|
@@ -387,9 +384,6 @@ var BlaxelProcessManager = class extends workspace.SandboxProcessManager {
|
|
|
387
384
|
}
|
|
388
385
|
return result;
|
|
389
386
|
}
|
|
390
|
-
async get(pid) {
|
|
391
|
-
return this._tracked.get(pid);
|
|
392
|
-
}
|
|
393
387
|
};
|
|
394
388
|
|
|
395
389
|
// src/sandbox/index.ts
|
|
@@ -465,7 +459,8 @@ var BlaxelSandbox = class extends workspace.MastraSandbox {
|
|
|
465
459
|
*
|
|
466
460
|
* @example Direct file operations
|
|
467
461
|
* ```typescript
|
|
468
|
-
*
|
|
462
|
+
* await sandbox.start();
|
|
463
|
+
* const blaxelSandbox = sandbox.blaxel;
|
|
469
464
|
* await blaxelSandbox.fs.write('/tmp/test.txt', 'Hello');
|
|
470
465
|
* const content = await blaxelSandbox.fs.read('/tmp/test.txt');
|
|
471
466
|
* const files = await blaxelSandbox.fs.ls('/tmp');
|
|
@@ -473,19 +468,24 @@ var BlaxelSandbox = class extends workspace.MastraSandbox {
|
|
|
473
468
|
*
|
|
474
469
|
* @example Process management
|
|
475
470
|
* ```typescript
|
|
476
|
-
*
|
|
471
|
+
* await sandbox.start();
|
|
472
|
+
* const blaxelSandbox = sandbox.blaxel;
|
|
477
473
|
* const proc = await blaxelSandbox.process.exec({
|
|
478
474
|
* command: 'node server.js',
|
|
479
475
|
* waitForCompletion: false,
|
|
480
476
|
* });
|
|
481
477
|
* ```
|
|
482
478
|
*/
|
|
483
|
-
get
|
|
479
|
+
get blaxel() {
|
|
484
480
|
if (!this._sandbox) {
|
|
485
481
|
throw new workspace.SandboxNotReadyError(this.id);
|
|
486
482
|
}
|
|
487
483
|
return this._sandbox;
|
|
488
484
|
}
|
|
485
|
+
/** @deprecated Use `blaxel` instead. */
|
|
486
|
+
get instance() {
|
|
487
|
+
return this.blaxel;
|
|
488
|
+
}
|
|
489
489
|
// ---------------------------------------------------------------------------
|
|
490
490
|
// Mount Support
|
|
491
491
|
// ---------------------------------------------------------------------------
|