@blaxel/core 0.2.43-dev.199 → 0.2.43-preview.93
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agents/index.js +2 -2
- package/dist/cjs/common/internal.js +0 -40
- package/dist/cjs/common/settings.js +2 -5
- package/dist/cjs/jobs/jobs.js +2 -2
- package/dist/cjs/sandbox/action.js +2 -1
- package/dist/cjs/sandbox/filesystem/filesystem.js +13 -12
- package/dist/cjs/sandbox/sandbox.js +2 -2
- package/dist/cjs/tools/mcpTool.js +2 -2
- package/dist/cjs/types/common/internal.d.ts +0 -2
- package/dist/cjs/types/common/settings.d.ts +0 -1
- package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +2 -6
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/agents/index.js +2 -2
- package/dist/cjs-browser/common/internal.js +0 -40
- package/dist/cjs-browser/common/settings.js +2 -5
- package/dist/cjs-browser/jobs/jobs.js +2 -2
- package/dist/cjs-browser/sandbox/action.js +2 -1
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +13 -12
- package/dist/cjs-browser/sandbox/sandbox.js +2 -2
- package/dist/cjs-browser/tools/mcpTool.js +2 -2
- package/dist/cjs-browser/types/common/internal.d.ts +0 -2
- package/dist/cjs-browser/types/common/settings.d.ts +0 -1
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +2 -6
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agents/index.js +3 -3
- package/dist/esm/common/internal.js +0 -38
- package/dist/esm/common/settings.js +2 -5
- package/dist/esm/jobs/jobs.js +3 -3
- package/dist/esm/sandbox/action.js +3 -2
- package/dist/esm/sandbox/filesystem/filesystem.js +14 -13
- package/dist/esm/sandbox/sandbox.js +2 -2
- package/dist/esm/tools/mcpTool.js +3 -3
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/agents/index.js +3 -3
- package/dist/esm-browser/common/internal.js +0 -38
- package/dist/esm-browser/common/settings.js +2 -5
- package/dist/esm-browser/jobs/jobs.js +3 -3
- package/dist/esm-browser/sandbox/action.js +3 -2
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +14 -13
- package/dist/esm-browser/sandbox/sandbox.js +2 -2
- package/dist/esm-browser/tools/mcpTool.js +3 -3
- package/package.json +2 -2
package/dist/esm/jobs/jobs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
|
|
2
2
|
import { logger } from "../common/logger.js";
|
|
3
3
|
import { settings } from "../common/settings.js";
|
|
4
4
|
import { startSpan } from '../telemetry/telemetry.js';
|
|
@@ -17,8 +17,8 @@ class BlJob {
|
|
|
17
17
|
return new URL(`${settings.runUrl}/${settings.workspace}/jobs/${this.jobName}`);
|
|
18
18
|
}
|
|
19
19
|
get internalUrl() {
|
|
20
|
-
const
|
|
21
|
-
return new URL(
|
|
20
|
+
const hash = getGlobalUniqueHash(settings.workspace, "job", this.jobName);
|
|
21
|
+
return new URL(`${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`);
|
|
22
22
|
}
|
|
23
23
|
get forcedUrl() {
|
|
24
24
|
return getForcedUrl('job', this.jobName);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createClient } from "@hey-api/client-fetch";
|
|
2
|
-
import {
|
|
2
|
+
import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
|
|
3
3
|
import { settings } from "../common/settings.js";
|
|
4
4
|
import { client as defaultClient } from "./client/client.gen.js";
|
|
5
5
|
export class ResponseError extends Error {
|
|
@@ -44,7 +44,8 @@ export class SandboxAction {
|
|
|
44
44
|
return this.sandbox.metadata?.url ?? `${settings.runUrl}/${settings.workspace}/sandboxes/${this.name}`;
|
|
45
45
|
}
|
|
46
46
|
get internalUrl() {
|
|
47
|
-
|
|
47
|
+
const hash = getGlobalUniqueHash(settings.workspace, "sandbox", this.name);
|
|
48
|
+
return `${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`;
|
|
48
49
|
}
|
|
49
50
|
get client() {
|
|
50
51
|
if (this.sandbox.forceUrl) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { settings } from "../../common/settings.js";
|
|
2
2
|
import { SandboxAction } from "../action.js";
|
|
3
|
-
import { deleteFilesystemByPath, getFilesystemByPath, getWatchFilesystemByPath, putFilesystemByPath } from "../client/index.js";
|
|
3
|
+
import { deleteFilesystemByPath, getFilesystemByPath, getWatchFilesystemByPath, putFilesystemByPath, postProcess } from "../client/index.js";
|
|
4
4
|
export class SandboxFileSystem extends SandboxAction {
|
|
5
|
-
|
|
6
|
-
constructor(sandbox, process) {
|
|
5
|
+
constructor(sandbox) {
|
|
7
6
|
super(sandbox);
|
|
8
|
-
this.process = process;
|
|
9
|
-
this.process = process;
|
|
10
7
|
}
|
|
11
8
|
async mkdir(path, permissions = "0755") {
|
|
12
9
|
path = this.formatPath(path);
|
|
@@ -83,7 +80,7 @@ export class SandboxFileSystem extends SandboxAction {
|
|
|
83
80
|
baseUrl: this.url,
|
|
84
81
|
client: this.client,
|
|
85
82
|
};
|
|
86
|
-
const path =
|
|
83
|
+
const path = destinationPath ?? "";
|
|
87
84
|
const { response, data, error } = await this.client.put({
|
|
88
85
|
url: `/filesystem/tree/${path}`,
|
|
89
86
|
...options,
|
|
@@ -131,14 +128,18 @@ export class SandboxFileSystem extends SandboxAction {
|
|
|
131
128
|
}
|
|
132
129
|
return data;
|
|
133
130
|
}
|
|
134
|
-
async cp(source, destination
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
async cp(source, destination) {
|
|
132
|
+
source = this.formatPath(source);
|
|
133
|
+
destination = this.formatPath(destination);
|
|
134
|
+
const process = {
|
|
135
|
+
command: `cp -r ${source} ${destination}`
|
|
136
|
+
};
|
|
137
|
+
const { response, data, error } = await postProcess({
|
|
138
|
+
body: process,
|
|
139
|
+
baseUrl: this.url,
|
|
140
|
+
client: this.client,
|
|
137
141
|
});
|
|
138
|
-
|
|
139
|
-
if (process.status === "failed") {
|
|
140
|
-
throw new Error(`Could not copy ${source} to ${destination} cause: ${process.logs}`);
|
|
141
|
-
}
|
|
142
|
+
this.handleResponseError(response, data, error);
|
|
142
143
|
return {
|
|
143
144
|
message: "Files copied",
|
|
144
145
|
source,
|
|
@@ -17,9 +17,9 @@ export class SandboxInstance {
|
|
|
17
17
|
sessions;
|
|
18
18
|
constructor(sandbox) {
|
|
19
19
|
this.sandbox = sandbox;
|
|
20
|
-
this.
|
|
21
|
-
this.fs = new SandboxFileSystem(sandbox, this.process);
|
|
20
|
+
this.fs = new SandboxFileSystem(sandbox);
|
|
22
21
|
this.network = new SandboxNetwork(sandbox);
|
|
22
|
+
this.process = new SandboxProcess(sandbox);
|
|
23
23
|
this.previews = new SandboxPreviews(sandbox);
|
|
24
24
|
this.sessions = new SandboxSessions(sandbox);
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client as ModelContextProtocolClient } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
2
|
import { env } from "../common/env.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getForcedUrl, getGlobalUniqueHash } from "../common/internal.js";
|
|
4
4
|
import { logger } from "../common/logger.js";
|
|
5
5
|
import { settings } from "../common/settings.js";
|
|
6
6
|
import { authenticate } from "../index.js";
|
|
@@ -55,8 +55,8 @@ export class McpTool {
|
|
|
55
55
|
return new URL(`${settings.runUrl}/${settings.workspace}/${this.pluralType}/${this.name}`);
|
|
56
56
|
}
|
|
57
57
|
get internalUrl() {
|
|
58
|
-
const
|
|
59
|
-
return new URL(
|
|
58
|
+
const hash = getGlobalUniqueHash(settings.workspace, this.type, this.name);
|
|
59
|
+
return new URL(`${settings.runInternalProtocol}://bl-${settings.env}-${hash}.${settings.runInternalHostname}`);
|
|
60
60
|
}
|
|
61
61
|
get forcedUrl() {
|
|
62
62
|
return getForcedUrl(this.type, this.name);
|