@blaxel/core 0.2.49-dev.214 → 0.2.49-dev1
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/agents/index.d.ts +15 -0
- package/dist/agents/index.js +109 -0
- package/dist/authentication/apikey.d.ts +10 -0
- package/dist/authentication/apikey.js +24 -0
- package/dist/authentication/clientcredentials.d.ts +17 -0
- package/dist/authentication/clientcredentials.js +85 -0
- package/dist/authentication/credentials.d.ts +6 -0
- package/dist/authentication/credentials.js +17 -0
- package/dist/authentication/deviceMode.d.ts +15 -0
- package/dist/authentication/deviceMode.js +70 -0
- package/dist/authentication/index.d.ts +3 -0
- package/dist/authentication/index.js +62 -0
- package/dist/authentication/types.d.ts +9 -0
- package/dist/authentication/types.js +2 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +26 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agents/index.js +2 -2
- package/dist/cjs/authentication/clientcredentials.js +1 -4
- package/dist/cjs/client/responseInterceptor.js +53 -0
- package/dist/cjs/client/sdk.gen.js +143 -3
- package/dist/cjs/common/autoload.js +7 -0
- package/dist/cjs/common/env.js +3 -0
- package/dist/cjs/common/internal.js +0 -40
- package/dist/cjs/common/settings.js +2 -5
- package/dist/cjs/common/version.js +6 -0
- package/dist/cjs/common/webhook.js +101 -0
- package/dist/cjs/jobs/executions.js +119 -0
- package/dist/cjs/jobs/jobs.js +2 -2
- package/dist/cjs/jobs/start.js +1 -32
- package/dist/cjs/sandbox/action.js +2 -1
- package/dist/cjs/sandbox/index.js +1 -0
- package/dist/cjs/sandbox/interpreter.js +400 -0
- package/dist/cjs/sandbox/sandbox.js +10 -67
- package/dist/cjs/tools/mcpTool.js +2 -6
- package/dist/cjs/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs/types/client/types.gen.d.ts +599 -16
- package/dist/cjs/types/common/internal.d.ts +0 -2
- package/dist/cjs/types/common/settings.d.ts +0 -1
- package/dist/cjs/types/common/version.d.ts +2 -0
- package/dist/cjs/types/common/webhook.d.ts +89 -0
- package/dist/cjs/types/jobs/executions.d.ts +42 -0
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs/types/sandbox/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs/types/sandbox/types.d.ts +0 -3
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/agents/index.js +2 -2
- package/dist/cjs-browser/authentication/clientcredentials.js +1 -4
- package/dist/cjs-browser/client/responseInterceptor.js +53 -0
- package/dist/cjs-browser/client/sdk.gen.js +143 -3
- package/dist/cjs-browser/common/autoload.js +7 -0
- package/dist/cjs-browser/common/env.js +3 -0
- package/dist/cjs-browser/common/internal.js +0 -40
- package/dist/cjs-browser/common/settings.js +2 -5
- package/dist/cjs-browser/common/version.js +6 -0
- package/dist/cjs-browser/common/webhook.js +101 -0
- package/dist/cjs-browser/jobs/executions.js +119 -0
- package/dist/cjs-browser/jobs/jobs.js +2 -2
- package/dist/cjs-browser/jobs/start.js +1 -32
- package/dist/cjs-browser/sandbox/action.js +2 -1
- package/dist/cjs-browser/sandbox/index.js +1 -0
- package/dist/cjs-browser/sandbox/interpreter.js +400 -0
- package/dist/cjs-browser/sandbox/sandbox.js +10 -67
- package/dist/cjs-browser/tools/mcpTool.js +2 -6
- package/dist/cjs-browser/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +599 -16
- 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/common/version.d.ts +2 -0
- package/dist/cjs-browser/types/common/webhook.d.ts +89 -0
- package/dist/cjs-browser/types/jobs/executions.d.ts +42 -0
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs-browser/types/sandbox/types.d.ts +0 -3
- package/dist/client/authentication.d.ts +25 -0
- package/dist/client/authentication.js +15 -0
- package/dist/client/client.d.ts +2 -0
- package/dist/client/client.gen.d.ts +12 -0
- package/dist/client/client.gen.js +8 -0
- package/dist/{cjs/sandbox/websocket/index.js → client/client.js} +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +19 -0
- package/dist/client/interceptors.d.ts +3 -0
- package/dist/client/interceptors.js +17 -0
- package/dist/client/sdk.gen.d.ts +499 -0
- package/dist/client/sdk.gen.js +1751 -0
- package/dist/client/types.gen.d.ts +4546 -0
- package/dist/client/types.gen.js +4 -0
- package/dist/common/autoload.d.ts +3 -0
- package/dist/common/autoload.js +27 -0
- package/dist/common/env.d.ts +5 -0
- package/dist/common/env.js +42 -0
- package/dist/common/errors.d.ts +1 -0
- package/dist/common/errors.js +17 -0
- package/dist/common/internal.d.ts +4 -0
- package/dist/common/internal.js +188 -0
- package/dist/common/internal.test.d.ts +1 -0
- package/dist/common/internal.test.js +39 -0
- package/dist/common/logger.d.ts +25 -0
- package/dist/common/logger.js +69 -0
- package/dist/common/node.d.ts +5 -0
- package/dist/common/node.js +26 -0
- package/dist/common/settings.d.ts +31 -0
- package/dist/common/settings.js +170 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agents/index.js +3 -3
- package/dist/esm/authentication/clientcredentials.js +1 -4
- package/dist/esm/client/responseInterceptor.js +49 -0
- package/dist/esm/client/sdk.gen.js +132 -0
- package/dist/esm/common/autoload.js +7 -0
- package/dist/esm/common/env.js +3 -0
- package/dist/esm/common/internal.js +0 -38
- package/dist/esm/common/settings.js +2 -5
- package/dist/esm/common/version.js +3 -0
- package/dist/esm/common/webhook.js +97 -0
- package/dist/esm/jobs/executions.js +114 -0
- package/dist/esm/jobs/jobs.js +3 -3
- package/dist/esm/jobs/start.js +1 -32
- package/dist/esm/sandbox/action.js +3 -2
- package/dist/esm/sandbox/index.js +1 -0
- package/dist/esm/sandbox/interpreter.js +396 -0
- package/dist/esm/sandbox/sandbox.js +10 -67
- package/dist/esm/tools/mcpTool.js +3 -7
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/agents/index.js +3 -3
- package/dist/esm-browser/authentication/clientcredentials.js +1 -4
- package/dist/esm-browser/client/responseInterceptor.js +49 -0
- package/dist/esm-browser/client/sdk.gen.js +132 -0
- package/dist/esm-browser/common/autoload.js +7 -0
- package/dist/esm-browser/common/env.js +3 -0
- package/dist/esm-browser/common/internal.js +0 -38
- package/dist/esm-browser/common/settings.js +2 -5
- package/dist/esm-browser/common/version.js +3 -0
- package/dist/esm-browser/common/webhook.js +97 -0
- package/dist/esm-browser/jobs/executions.js +114 -0
- package/dist/esm-browser/jobs/jobs.js +3 -3
- package/dist/esm-browser/jobs/start.js +1 -32
- package/dist/esm-browser/sandbox/action.js +3 -2
- package/dist/esm-browser/sandbox/index.js +1 -0
- package/dist/esm-browser/sandbox/interpreter.js +396 -0
- package/dist/esm-browser/sandbox/sandbox.js +10 -67
- package/dist/esm-browser/tools/mcpTool.js +3 -7
- package/dist/index.browser.test.d.ts +1 -0
- package/dist/index.browser.test.js +45 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +33 -0
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +19 -0
- package/dist/jobs/jobs.d.ts +13 -0
- package/dist/jobs/jobs.js +90 -0
- package/dist/jobs/start.d.ts +1 -0
- package/dist/jobs/start.js +66 -0
- package/dist/jobs/types.d.ts +3 -0
- package/dist/jobs/types.js +2 -0
- package/dist/mcp/client.d.ts +28 -0
- package/dist/mcp/client.js +247 -0
- package/dist/{cjs-browser/types/sandbox/websocket → mcp}/index.d.ts +1 -0
- package/dist/{cjs-browser/sandbox/websocket → mcp}/index.js +1 -0
- package/dist/mcp/server.d.ts +24 -0
- package/dist/mcp/server.js +213 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +31 -0
- package/dist/sandbox/action.d.ts +19 -0
- package/dist/sandbox/action.js +84 -0
- package/dist/sandbox/client/client.gen.d.ts +12 -0
- package/dist/sandbox/client/client.gen.js +6 -0
- package/dist/sandbox/client/index.d.ts +2 -0
- package/dist/sandbox/client/index.js +19 -0
- package/dist/sandbox/client/sdk.gen.d.ts +101 -0
- package/dist/sandbox/client/sdk.gen.js +289 -0
- package/dist/sandbox/client/types.gen.d.ts +578 -0
- package/dist/sandbox/client/types.gen.js +3 -0
- package/dist/{cjs/types/sandbox/filesystem/filesystem-ws.d.ts → sandbox/filesystem/filesystem.d.ts} +6 -18
- package/dist/sandbox/filesystem/filesystem.js +276 -0
- package/dist/sandbox/filesystem/index.d.ts +2 -0
- package/dist/sandbox/filesystem/index.js +18 -0
- package/dist/sandbox/filesystem/types.d.ts +15 -0
- package/dist/sandbox/filesystem/types.js +2 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.js +36 -0
- package/dist/sandbox/network/index.d.ts +1 -0
- package/dist/sandbox/network/index.js +17 -0
- package/dist/sandbox/network/network.d.ts +5 -0
- package/dist/sandbox/network/network.js +10 -0
- package/dist/sandbox/preview.d.ts +37 -0
- package/dist/sandbox/preview.js +148 -0
- package/dist/sandbox/process/index.d.ts +1 -0
- package/dist/sandbox/process/index.js +17 -0
- package/dist/sandbox/process/process.d.ts +24 -0
- package/dist/sandbox/process/process.js +189 -0
- package/dist/sandbox/sandbox.d.ts +33 -0
- package/dist/sandbox/sandbox.js +178 -0
- package/dist/sandbox/session.d.ts +27 -0
- package/dist/sandbox/session.js +123 -0
- package/dist/sandbox/types.d.ts +51 -0
- package/dist/sandbox/types.js +81 -0
- package/dist/telemetry/telemetry.d.ts +62 -0
- package/dist/telemetry/telemetry.js +80 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.js +52 -0
- package/dist/tools/mcpTool.d.ts +28 -0
- package/dist/tools/mcpTool.js +218 -0
- package/dist/tools/types.d.ts +8 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/zodSchema.d.ts +9 -0
- package/dist/tools/zodSchema.js +50 -0
- package/dist/volume/index.d.ts +23 -0
- package/dist/volume/index.js +113 -0
- package/package.json +2 -2
- package/dist/cjs/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs/sandbox/network/network-ws.js +0 -12
- package/dist/cjs/sandbox/process/process-ws.js +0 -139
- package/dist/cjs/sandbox/websocket/client.js +0 -269
- package/dist/cjs/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/cjs/types/sandbox/websocket/index.d.ts +0 -1
- package/dist/cjs-browser/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs-browser/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs-browser/sandbox/network/network-ws.js +0 -12
- package/dist/cjs-browser/sandbox/process/process-ws.js +0 -139
- package/dist/cjs-browser/sandbox/websocket/client.js +0 -269
- package/dist/cjs-browser/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem-ws.d.ts +0 -35
- package/dist/cjs-browser/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs-browser/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs-browser/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/esm/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm/sandbox/network/network-ws.js +0 -8
- package/dist/esm/sandbox/process/process-ws.js +0 -135
- package/dist/esm/sandbox/websocket/client.js +0 -265
- package/dist/esm/sandbox/websocket/index.js +0 -1
- package/dist/esm-browser/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm-browser/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm-browser/sandbox/network/network-ws.js +0 -8
- package/dist/esm-browser/sandbox/process/process-ws.js +0 -135
- package/dist/esm-browser/sandbox/websocket/client.js +0 -265
- package/dist/esm-browser/sandbox/websocket/index.js +0 -1
|
@@ -36,4 +36,5 @@ __exportStar(require("./filesystem/index.js"), exports);
|
|
|
36
36
|
__exportStar(require("./codegen/index.js"), exports);
|
|
37
37
|
__exportStar(require("./sandbox.js"), exports);
|
|
38
38
|
__exportStar(require("./types.js"), exports);
|
|
39
|
+
__exportStar(require("./interpreter.js"), exports);
|
|
39
40
|
// Re-export everything from client except ClientOptions to avoid conflict
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeInterpreter = void 0;
|
|
4
|
+
const logger_js_1 = require("../common/logger.js");
|
|
5
|
+
const settings_js_1 = require("../common/settings.js");
|
|
6
|
+
const sandbox_js_1 = require("./sandbox.js");
|
|
7
|
+
class CodeInterpreter extends sandbox_js_1.SandboxInstance {
|
|
8
|
+
static DEFAULT_IMAGE = "blaxel/jupyter-server";
|
|
9
|
+
static DEFAULT_PORTS = [
|
|
10
|
+
{ name: "jupyter", target: 8888, protocol: "HTTP" },
|
|
11
|
+
];
|
|
12
|
+
static DEFAULT_LIFECYCLE = {
|
|
13
|
+
expirationPolicies: [{ type: "ttl-idle", value: "30m", action: "delete" }],
|
|
14
|
+
};
|
|
15
|
+
_sandboxConfig;
|
|
16
|
+
constructor(sandbox) {
|
|
17
|
+
super(sandbox);
|
|
18
|
+
this._sandboxConfig = sandbox;
|
|
19
|
+
}
|
|
20
|
+
static async get(sandboxName) {
|
|
21
|
+
const base = await sandbox_js_1.SandboxInstance.get(sandboxName);
|
|
22
|
+
// Create a minimal config - the base instance already has the sandbox data
|
|
23
|
+
// We'll rely on the process property for URL/headers access
|
|
24
|
+
const config = {
|
|
25
|
+
metadata: base.metadata,
|
|
26
|
+
spec: base.spec,
|
|
27
|
+
status: base.status,
|
|
28
|
+
events: base.events,
|
|
29
|
+
};
|
|
30
|
+
return new CodeInterpreter(config);
|
|
31
|
+
}
|
|
32
|
+
static async create(sandbox, { safe = true } = {}) {
|
|
33
|
+
const payload = {
|
|
34
|
+
image: CodeInterpreter.DEFAULT_IMAGE,
|
|
35
|
+
ports: CodeInterpreter.DEFAULT_PORTS,
|
|
36
|
+
lifecycle: CodeInterpreter.DEFAULT_LIFECYCLE,
|
|
37
|
+
};
|
|
38
|
+
const allowedCopyKeys = new Set(["name", "envs", "memory", "region", "headers"]);
|
|
39
|
+
if (sandbox && typeof sandbox === "object") {
|
|
40
|
+
if (Array.isArray(sandbox)) {
|
|
41
|
+
// Skip arrays
|
|
42
|
+
}
|
|
43
|
+
else if ("metadata" in sandbox || "spec" in sandbox) {
|
|
44
|
+
// It's a Sandbox object
|
|
45
|
+
const sandboxObj = sandbox;
|
|
46
|
+
if (sandboxObj.metadata?.name) {
|
|
47
|
+
payload["name"] = sandboxObj.metadata.name;
|
|
48
|
+
}
|
|
49
|
+
if (sandboxObj.spec?.runtime) {
|
|
50
|
+
if (sandboxObj.spec.runtime.envs) {
|
|
51
|
+
payload["envs"] = sandboxObj.spec.runtime.envs;
|
|
52
|
+
}
|
|
53
|
+
if (sandboxObj.spec.runtime.memory) {
|
|
54
|
+
payload["memory"] = sandboxObj.spec.runtime.memory;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (sandboxObj.spec?.region) {
|
|
58
|
+
payload["region"] = sandboxObj.spec.region;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if ("name" in sandbox || "image" in sandbox || "memory" in sandbox) {
|
|
62
|
+
// It's a SandboxCreateConfiguration or dict-like object
|
|
63
|
+
const sandboxDict = sandbox;
|
|
64
|
+
for (const k of allowedCopyKeys) {
|
|
65
|
+
const value = sandboxDict[k];
|
|
66
|
+
if (value !== null && value !== undefined) {
|
|
67
|
+
payload[k] = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const baseInstance = await sandbox_js_1.SandboxInstance.create(payload, { safe });
|
|
73
|
+
// Create config from the instance - preserve any forceUrl/headers if provided in input
|
|
74
|
+
const config = {
|
|
75
|
+
metadata: baseInstance.metadata,
|
|
76
|
+
spec: baseInstance.spec,
|
|
77
|
+
status: baseInstance.status,
|
|
78
|
+
events: baseInstance.events,
|
|
79
|
+
};
|
|
80
|
+
// Preserve forceUrl and headers from input if it was a dict-like object
|
|
81
|
+
if (sandbox && typeof sandbox === "object" && !Array.isArray(sandbox)) {
|
|
82
|
+
if ("forceUrl" in sandbox && typeof sandbox.forceUrl === "string") {
|
|
83
|
+
config.forceUrl = sandbox.forceUrl;
|
|
84
|
+
}
|
|
85
|
+
if ("headers" in sandbox && typeof sandbox.headers === "object") {
|
|
86
|
+
config.headers = sandbox.headers;
|
|
87
|
+
}
|
|
88
|
+
if ("params" in sandbox && typeof sandbox.params === "object") {
|
|
89
|
+
config.params = sandbox.params;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return new CodeInterpreter(config);
|
|
93
|
+
}
|
|
94
|
+
get _jupyterUrl() {
|
|
95
|
+
return this.process.url;
|
|
96
|
+
}
|
|
97
|
+
static OutputMessage = class {
|
|
98
|
+
text;
|
|
99
|
+
timestamp;
|
|
100
|
+
isStderr;
|
|
101
|
+
constructor(text, timestamp, isStderr) {
|
|
102
|
+
this.text = text;
|
|
103
|
+
this.timestamp = timestamp;
|
|
104
|
+
this.isStderr = isStderr;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
static Result = class {
|
|
108
|
+
constructor(kwargs = {}) {
|
|
109
|
+
for (const [k, v] of Object.entries(kwargs)) {
|
|
110
|
+
this[k] = v;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
static ExecutionError = class {
|
|
115
|
+
name;
|
|
116
|
+
value;
|
|
117
|
+
traceback;
|
|
118
|
+
constructor(name, value, traceback) {
|
|
119
|
+
this.name = name;
|
|
120
|
+
this.value = value;
|
|
121
|
+
this.traceback = traceback;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
static Logs = class {
|
|
125
|
+
stdout = [];
|
|
126
|
+
stderr = [];
|
|
127
|
+
};
|
|
128
|
+
static Execution = class {
|
|
129
|
+
results = [];
|
|
130
|
+
logs = new CodeInterpreter.Logs();
|
|
131
|
+
error = null;
|
|
132
|
+
executionCount = null;
|
|
133
|
+
};
|
|
134
|
+
static Context = class {
|
|
135
|
+
id;
|
|
136
|
+
constructor(id) {
|
|
137
|
+
this.id = id;
|
|
138
|
+
}
|
|
139
|
+
static fromJson(data) {
|
|
140
|
+
return new CodeInterpreter.Context(String(data.id || data.context_id || ""));
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
_parseOutput(execution, output, onStdout, onStderr, onResult, onError) {
|
|
144
|
+
let data;
|
|
145
|
+
try {
|
|
146
|
+
data = JSON.parse(output);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Fallback: treat as stdout text-only message
|
|
150
|
+
execution.logs.stdout.push(output);
|
|
151
|
+
if (onStdout) {
|
|
152
|
+
return onStdout(new CodeInterpreter.OutputMessage(output, null, false));
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
let dataType = "";
|
|
157
|
+
if (typeof data.type === "string") {
|
|
158
|
+
dataType = data.type;
|
|
159
|
+
}
|
|
160
|
+
else if (data.type !== null &&
|
|
161
|
+
data.type !== undefined &&
|
|
162
|
+
typeof data.type !== "object") {
|
|
163
|
+
const typeValue = data.type;
|
|
164
|
+
dataType = String(typeValue);
|
|
165
|
+
}
|
|
166
|
+
const restData = { ...data };
|
|
167
|
+
delete restData.type;
|
|
168
|
+
if (dataType === "result") {
|
|
169
|
+
const result = new CodeInterpreter.Result(restData);
|
|
170
|
+
execution.results.push(result);
|
|
171
|
+
if (onResult) {
|
|
172
|
+
return onResult(result);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (dataType === "stdout") {
|
|
176
|
+
let text = "";
|
|
177
|
+
if (typeof data.text === "string") {
|
|
178
|
+
text = data.text;
|
|
179
|
+
}
|
|
180
|
+
else if (data.text !== null &&
|
|
181
|
+
data.text !== undefined &&
|
|
182
|
+
typeof data.text !== "object") {
|
|
183
|
+
const textValue = data.text;
|
|
184
|
+
text = String(textValue);
|
|
185
|
+
}
|
|
186
|
+
execution.logs.stdout.push(text);
|
|
187
|
+
if (onStdout) {
|
|
188
|
+
return onStdout(new CodeInterpreter.OutputMessage(text, typeof data.timestamp === "number" ? data.timestamp : null, false));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else if (dataType === "stderr") {
|
|
192
|
+
let text = "";
|
|
193
|
+
if (typeof data.text === "string") {
|
|
194
|
+
text = data.text;
|
|
195
|
+
}
|
|
196
|
+
else if (data.text !== null &&
|
|
197
|
+
data.text !== undefined &&
|
|
198
|
+
typeof data.text !== "object") {
|
|
199
|
+
const textValue = data.text;
|
|
200
|
+
text = String(textValue);
|
|
201
|
+
}
|
|
202
|
+
execution.logs.stderr.push(text);
|
|
203
|
+
if (onStderr) {
|
|
204
|
+
return onStderr(new CodeInterpreter.OutputMessage(text, typeof data.timestamp === "number" ? data.timestamp : null, true));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (dataType === "error") {
|
|
208
|
+
let errorName = "";
|
|
209
|
+
if (typeof data.name === "string") {
|
|
210
|
+
errorName = data.name;
|
|
211
|
+
}
|
|
212
|
+
else if (data.name !== null &&
|
|
213
|
+
data.name !== undefined &&
|
|
214
|
+
typeof data.name !== "object") {
|
|
215
|
+
const nameValue = data.name;
|
|
216
|
+
errorName = String(nameValue);
|
|
217
|
+
}
|
|
218
|
+
execution.error = new CodeInterpreter.ExecutionError(errorName, data.value, data.traceback);
|
|
219
|
+
if (onError) {
|
|
220
|
+
return onError(execution.error);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (dataType === "number_of_executions") {
|
|
224
|
+
execution.executionCount =
|
|
225
|
+
typeof data.execution_count === "number" ? data.execution_count : null;
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
async runCode(code, options = {}) {
|
|
230
|
+
const { language = null, context = null, onStdout, onStderr, onResult, onError, envs = null, timeout = null, } = options;
|
|
231
|
+
const DEFAULT_TIMEOUT = 60.0;
|
|
232
|
+
if (language && context) {
|
|
233
|
+
throw new Error("You can provide context or language, but not both at the same time.");
|
|
234
|
+
}
|
|
235
|
+
const readTimeout = timeout === 0 ? null : timeout ?? DEFAULT_TIMEOUT;
|
|
236
|
+
const contextId = context?.id ?? null;
|
|
237
|
+
const body = {
|
|
238
|
+
code,
|
|
239
|
+
context_id: contextId,
|
|
240
|
+
language,
|
|
241
|
+
env_vars: envs,
|
|
242
|
+
};
|
|
243
|
+
const execution = new CodeInterpreter.Execution();
|
|
244
|
+
const headers = this._sandboxConfig.forceUrl
|
|
245
|
+
? this._sandboxConfig.headers
|
|
246
|
+
: settings_js_1.settings.headers;
|
|
247
|
+
const controller = new AbortController();
|
|
248
|
+
let timeoutId = null;
|
|
249
|
+
// Set up timeout
|
|
250
|
+
if (readTimeout !== null) {
|
|
251
|
+
timeoutId = setTimeout(() => {
|
|
252
|
+
controller.abort();
|
|
253
|
+
}, readTimeout * 1000);
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const response = await fetch(`${this._jupyterUrl}/port/8888/execute`, {
|
|
257
|
+
method: "POST",
|
|
258
|
+
headers: {
|
|
259
|
+
...headers,
|
|
260
|
+
"Content-Type": "application/json",
|
|
261
|
+
},
|
|
262
|
+
body: JSON.stringify(body),
|
|
263
|
+
signal: controller.signal,
|
|
264
|
+
});
|
|
265
|
+
if (response.status >= 400) {
|
|
266
|
+
let bodyText = "<unavailable>";
|
|
267
|
+
try {
|
|
268
|
+
bodyText = await response.text();
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
// Ignore errors
|
|
272
|
+
}
|
|
273
|
+
const method = "POST";
|
|
274
|
+
const url = `${this._jupyterUrl}/port/8888/execute`;
|
|
275
|
+
const reason = response.statusText;
|
|
276
|
+
const details = "Execution failed\n" +
|
|
277
|
+
`- method: ${method}\n- url: ${url}\n- status: ${response.status} ${reason}\n` +
|
|
278
|
+
`- response-headers: ${JSON.stringify(Object.fromEntries(response.headers.entries()))}\n- body:\n${bodyText}`;
|
|
279
|
+
logger_js_1.logger.debug(details);
|
|
280
|
+
throw new Error(details);
|
|
281
|
+
}
|
|
282
|
+
if (!response.body) {
|
|
283
|
+
throw new Error("No response body");
|
|
284
|
+
}
|
|
285
|
+
const reader = response.body.getReader();
|
|
286
|
+
const decoder = new TextDecoder();
|
|
287
|
+
let buffer = "";
|
|
288
|
+
try {
|
|
289
|
+
while (true) {
|
|
290
|
+
const result = await reader.read();
|
|
291
|
+
if (result.done)
|
|
292
|
+
break;
|
|
293
|
+
const value = result.value;
|
|
294
|
+
if (value instanceof Uint8Array) {
|
|
295
|
+
buffer += decoder.decode(value, { stream: true });
|
|
296
|
+
const lines = buffer.split(/\r?\n/);
|
|
297
|
+
buffer = lines.pop() || "";
|
|
298
|
+
for (const line of lines) {
|
|
299
|
+
if (!line)
|
|
300
|
+
continue;
|
|
301
|
+
try {
|
|
302
|
+
this._parseOutput(execution, line, onStdout, onStderr, onResult, onError);
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
// Fallback: treat as stdout text-only message
|
|
306
|
+
execution.logs.stdout.push(line);
|
|
307
|
+
if (onStdout) {
|
|
308
|
+
onStdout(new CodeInterpreter.OutputMessage(line, null, false));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
reader.releaseLock();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
if (error &&
|
|
321
|
+
typeof error === "object" &&
|
|
322
|
+
"name" in error &&
|
|
323
|
+
error.name === "AbortError") {
|
|
324
|
+
throw new Error("Request timeout");
|
|
325
|
+
}
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
finally {
|
|
329
|
+
if (timeoutId) {
|
|
330
|
+
clearTimeout(timeoutId);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return execution;
|
|
334
|
+
}
|
|
335
|
+
async createCodeContext(options = {}) {
|
|
336
|
+
const { cwd = null, language = null, requestTimeout = null } = options;
|
|
337
|
+
const data = {};
|
|
338
|
+
if (language) {
|
|
339
|
+
data.language = language;
|
|
340
|
+
}
|
|
341
|
+
if (cwd) {
|
|
342
|
+
data.cwd = cwd;
|
|
343
|
+
}
|
|
344
|
+
const headers = this._sandboxConfig.forceUrl
|
|
345
|
+
? this._sandboxConfig.headers
|
|
346
|
+
: settings_js_1.settings.headers;
|
|
347
|
+
const controller = new AbortController();
|
|
348
|
+
let timeoutId = null;
|
|
349
|
+
if (requestTimeout !== null) {
|
|
350
|
+
timeoutId = setTimeout(() => {
|
|
351
|
+
controller.abort();
|
|
352
|
+
}, requestTimeout * 1000);
|
|
353
|
+
}
|
|
354
|
+
try {
|
|
355
|
+
const response = await fetch(`${this._jupyterUrl}/port/8888/contexts`, {
|
|
356
|
+
method: "POST",
|
|
357
|
+
headers: {
|
|
358
|
+
...headers,
|
|
359
|
+
"Content-Type": "application/json",
|
|
360
|
+
},
|
|
361
|
+
body: JSON.stringify(data),
|
|
362
|
+
signal: controller.signal,
|
|
363
|
+
});
|
|
364
|
+
if (response.status >= 400) {
|
|
365
|
+
let bodyText = "<unavailable>";
|
|
366
|
+
try {
|
|
367
|
+
bodyText = await response.text();
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
// Ignore errors
|
|
371
|
+
}
|
|
372
|
+
const method = "POST";
|
|
373
|
+
const url = `${this._jupyterUrl}/port/8888/contexts`;
|
|
374
|
+
const reason = response.statusText;
|
|
375
|
+
const details = "Create context failed\n" +
|
|
376
|
+
`- method: ${method}\n- url: ${url}\n- status: ${response.status} ${reason}\n` +
|
|
377
|
+
`- response-headers: ${JSON.stringify(Object.fromEntries(response.headers.entries()))}\n- body:\n${bodyText}`;
|
|
378
|
+
logger_js_1.logger.debug(details);
|
|
379
|
+
throw new Error(details);
|
|
380
|
+
}
|
|
381
|
+
const responseData = (await response.json());
|
|
382
|
+
return CodeInterpreter.Context.fromJson(responseData);
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
if (error &&
|
|
386
|
+
typeof error === "object" &&
|
|
387
|
+
"name" in error &&
|
|
388
|
+
error.name === "AbortError") {
|
|
389
|
+
throw new Error("Request timeout");
|
|
390
|
+
}
|
|
391
|
+
throw error;
|
|
392
|
+
}
|
|
393
|
+
finally {
|
|
394
|
+
if (timeoutId) {
|
|
395
|
+
clearTimeout(timeoutId);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
exports.CodeInterpreter = CodeInterpreter;
|
|
@@ -5,16 +5,11 @@ const uuid_1 = require("uuid");
|
|
|
5
5
|
const index_js_1 = require("../client/index.js");
|
|
6
6
|
const logger_js_1 = require("../common/logger.js");
|
|
7
7
|
const index_js_2 = require("./filesystem/index.js");
|
|
8
|
-
const filesystem_ws_js_1 = require("./filesystem/filesystem-ws.js");
|
|
9
8
|
const index_js_3 = require("./network/index.js");
|
|
10
|
-
const network_ws_js_1 = require("./network/network-ws.js");
|
|
11
9
|
const preview_js_1 = require("./preview.js");
|
|
12
10
|
const index_js_4 = require("./process/index.js");
|
|
13
|
-
const process_ws_js_1 = require("./process/process-ws.js");
|
|
14
11
|
const index_js_5 = require("./codegen/index.js");
|
|
15
|
-
const codegen_ws_js_1 = require("./codegen/codegen-ws.js");
|
|
16
12
|
const session_js_1 = require("./session.js");
|
|
17
|
-
const index_js_6 = require("./websocket/index.js");
|
|
18
13
|
const types_js_1 = require("./types.js");
|
|
19
14
|
class SandboxInstance {
|
|
20
15
|
sandbox;
|
|
@@ -24,32 +19,14 @@ class SandboxInstance {
|
|
|
24
19
|
previews;
|
|
25
20
|
sessions;
|
|
26
21
|
codegen;
|
|
27
|
-
wsClient;
|
|
28
22
|
constructor(sandbox) {
|
|
29
23
|
this.sandbox = sandbox;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.wsClient = new index_js_6.WebSocketClient({
|
|
34
|
-
url,
|
|
35
|
-
headers: sandbox.headers,
|
|
36
|
-
});
|
|
37
|
-
// Initialize WebSocket-based action handlers
|
|
38
|
-
this.process = new process_ws_js_1.SandboxProcessWebSocket(sandbox, this.wsClient);
|
|
39
|
-
this.fs = new filesystem_ws_js_1.SandboxFileSystemWebSocket(sandbox, this.process, this.wsClient);
|
|
40
|
-
this.network = new network_ws_js_1.SandboxNetworkWebSocket(sandbox, this.wsClient);
|
|
41
|
-
this.codegen = new codegen_ws_js_1.SandboxCodegenWebSocket(sandbox, this.wsClient);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// Default to HTTP-based action handlers
|
|
45
|
-
this.process = new index_js_4.SandboxProcess(sandbox);
|
|
46
|
-
this.fs = new index_js_2.SandboxFileSystem(sandbox, this.process);
|
|
47
|
-
this.network = new index_js_3.SandboxNetwork(sandbox);
|
|
48
|
-
this.codegen = new index_js_5.SandboxCodegen(sandbox);
|
|
49
|
-
}
|
|
50
|
-
// These are always HTTP-based
|
|
24
|
+
this.process = new index_js_4.SandboxProcess(sandbox);
|
|
25
|
+
this.fs = new index_js_2.SandboxFileSystem(sandbox, this.process);
|
|
26
|
+
this.network = new index_js_3.SandboxNetwork(sandbox);
|
|
51
27
|
this.previews = new preview_js_1.SandboxPreviews(sandbox);
|
|
52
28
|
this.sessions = new session_js_1.SandboxSessions(sandbox);
|
|
29
|
+
this.codegen = new index_js_5.SandboxCodegen(sandbox);
|
|
53
30
|
}
|
|
54
31
|
get metadata() {
|
|
55
32
|
return this.sandbox.metadata;
|
|
@@ -68,17 +45,10 @@ class SandboxInstance {
|
|
|
68
45
|
logger_js_1.logger.warn("⚠️ Warning: sandbox.wait() is deprecated. You don't need to wait for the sandbox to be deployed anymore.");
|
|
69
46
|
return this;
|
|
70
47
|
}
|
|
71
|
-
closeConnection() {
|
|
72
|
-
if (this.wsClient) {
|
|
73
|
-
this.wsClient.close();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
48
|
static async create(sandbox, { safe = true } = {}) {
|
|
77
49
|
const defaultName = `sandbox-${(0, uuid_1.v4)().replace(/-/g, '').substring(0, 8)}`;
|
|
78
50
|
const defaultImage = `blaxel/base-image:latest`;
|
|
79
51
|
const defaultMemory = 4096;
|
|
80
|
-
// Store connection type if provided
|
|
81
|
-
let connectionType;
|
|
82
52
|
// Handle SandboxCreateConfiguration or simple dict with name/image/memory/ports/envs/volumes keys
|
|
83
53
|
if (!sandbox ||
|
|
84
54
|
'name' in sandbox ||
|
|
@@ -88,8 +58,7 @@ class SandboxInstance {
|
|
|
88
58
|
'envs' in sandbox ||
|
|
89
59
|
'volumes' in sandbox ||
|
|
90
60
|
'lifecycle' in sandbox ||
|
|
91
|
-
'snapshotEnabled' in sandbox
|
|
92
|
-
'connectionType' in sandbox) {
|
|
61
|
+
'snapshotEnabled' in sandbox) {
|
|
93
62
|
if (!sandbox)
|
|
94
63
|
sandbox = {};
|
|
95
64
|
if (!sandbox.name)
|
|
@@ -98,7 +67,6 @@ class SandboxInstance {
|
|
|
98
67
|
sandbox.image = defaultImage;
|
|
99
68
|
if (!sandbox.memory)
|
|
100
69
|
sandbox.memory = defaultMemory;
|
|
101
|
-
connectionType = sandbox.connectionType;
|
|
102
70
|
const ports = (0, types_js_1.normalizePorts)(sandbox.ports);
|
|
103
71
|
const envs = (0, types_js_1.normalizeEnvs)(sandbox.envs);
|
|
104
72
|
const volumes = (0, types_js_1.normalizeVolumes)(sandbox.volumes);
|
|
@@ -147,16 +115,7 @@ class SandboxInstance {
|
|
|
147
115
|
body: sandbox,
|
|
148
116
|
throwOnError: true,
|
|
149
117
|
});
|
|
150
|
-
|
|
151
|
-
const config = {
|
|
152
|
-
...data,
|
|
153
|
-
connectionType: connectionType || "http",
|
|
154
|
-
};
|
|
155
|
-
const instance = new SandboxInstance(config);
|
|
156
|
-
// Connect WebSocket if needed
|
|
157
|
-
if (connectionType === "websocket" && instance.wsClient) {
|
|
158
|
-
await instance.wsClient.connect();
|
|
159
|
-
}
|
|
118
|
+
const instance = new SandboxInstance(data);
|
|
160
119
|
// TODO remove this part once we have a better way to handle this
|
|
161
120
|
if (safe) {
|
|
162
121
|
try {
|
|
@@ -166,34 +125,20 @@ class SandboxInstance {
|
|
|
166
125
|
}
|
|
167
126
|
return instance;
|
|
168
127
|
}
|
|
169
|
-
static async get(sandboxName
|
|
128
|
+
static async get(sandboxName) {
|
|
170
129
|
const { data } = await (0, index_js_1.getSandbox)({
|
|
171
130
|
path: {
|
|
172
131
|
sandboxName,
|
|
173
132
|
},
|
|
174
133
|
throwOnError: true,
|
|
175
134
|
});
|
|
176
|
-
|
|
177
|
-
const config = {
|
|
178
|
-
...data,
|
|
179
|
-
connectionType: connectionType || "http",
|
|
180
|
-
};
|
|
181
|
-
const instance = new SandboxInstance(config);
|
|
182
|
-
// Connect WebSocket if needed
|
|
183
|
-
if (connectionType === "websocket" && instance.wsClient) {
|
|
184
|
-
await instance.wsClient.connect();
|
|
185
|
-
}
|
|
186
|
-
return instance;
|
|
135
|
+
return new SandboxInstance(data);
|
|
187
136
|
}
|
|
188
137
|
static async list() {
|
|
189
138
|
const { data } = await (0, index_js_1.listSandboxes)({ throwOnError: true });
|
|
190
139
|
return data.map((sandbox) => new SandboxInstance(sandbox));
|
|
191
140
|
}
|
|
192
|
-
static async delete(sandboxName
|
|
193
|
-
// Close WebSocket connection if instance is provided
|
|
194
|
-
if (instance && instance.wsClient) {
|
|
195
|
-
instance.closeConnection();
|
|
196
|
-
}
|
|
141
|
+
static async delete(sandboxName) {
|
|
197
142
|
const { data } = await (0, index_js_1.deleteSandbox)({
|
|
198
143
|
path: {
|
|
199
144
|
sandboxName,
|
|
@@ -223,10 +168,8 @@ class SandboxInstance {
|
|
|
223
168
|
if (!name) {
|
|
224
169
|
throw new Error("Sandbox name is required");
|
|
225
170
|
}
|
|
226
|
-
// Get connection type if specified
|
|
227
|
-
const connectionType = 'connectionType' in sandbox ? sandbox.connectionType : undefined;
|
|
228
171
|
// Get the existing sandbox to check its status
|
|
229
|
-
const sandboxInstance = await SandboxInstance.get(name
|
|
172
|
+
const sandboxInstance = await SandboxInstance.get(name);
|
|
230
173
|
// If the sandbox is TERMINATED, treat it as not existing
|
|
231
174
|
if (sandboxInstance.status === "TERMINATED") {
|
|
232
175
|
// Create a new sandbox - backend will handle cleanup of the terminated one
|
|
@@ -42,10 +42,6 @@ class McpTool {
|
|
|
42
42
|
this.client = new index_js_1.Client({
|
|
43
43
|
name: this.name,
|
|
44
44
|
version: "1.0.0",
|
|
45
|
-
}, {
|
|
46
|
-
capabilities: {
|
|
47
|
-
tools: {},
|
|
48
|
-
},
|
|
49
45
|
});
|
|
50
46
|
}
|
|
51
47
|
get fallbackUrl() {
|
|
@@ -58,8 +54,8 @@ class McpTool {
|
|
|
58
54
|
return new URL(`${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/${this.pluralType}/${this.name}`);
|
|
59
55
|
}
|
|
60
56
|
get internalUrl() {
|
|
61
|
-
const
|
|
62
|
-
return new URL(
|
|
57
|
+
const hash = (0, internal_js_1.getGlobalUniqueHash)(settings_js_1.settings.workspace, this.type, this.name);
|
|
58
|
+
return new URL(`${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`);
|
|
63
59
|
}
|
|
64
60
|
get forcedUrl() {
|
|
65
61
|
return (0, internal_js_1.getForcedUrl)(this.type, this.name);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response interceptor that enhances authentication error messages (401/403)
|
|
3
|
+
* with a link to the authentication documentation.
|
|
4
|
+
*/
|
|
5
|
+
type ResponseInterceptor = (response: Response) => Promise<Response>;
|
|
6
|
+
/**
|
|
7
|
+
* Intercepts HTTP responses and adds authentication documentation
|
|
8
|
+
* to 401/403 error responses
|
|
9
|
+
*/
|
|
10
|
+
export declare const authenticationErrorInterceptor: ResponseInterceptor;
|
|
11
|
+
export declare const responseInterceptors: ResponseInterceptor[];
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPrivateClustersData, CreatePrivateClusterData, DeletePrivateClusterData, GetPrivateClusterData, UpdatePrivateClusterData, GetPrivateClusterHealthData, UpdatePrivateClusterHealthData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, StartSandboxData, StopSandboxData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
2
|
+
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, ListImagesData, DeleteImageData, GetImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPrivateClustersData, CreatePrivateClusterData, DeletePrivateClusterData, GetPrivateClusterData, UpdatePrivateClusterData, GetPrivateClusterHealthData, UpdatePrivateClusterHealthData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, StartSandboxData, StopSandboxData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -90,6 +90,26 @@ export declare const updateFunction: <ThrowOnError extends boolean = false>(opti
|
|
|
90
90
|
* Returns revisions for a function by name.
|
|
91
91
|
*/
|
|
92
92
|
export declare const listFunctionRevisions: <ThrowOnError extends boolean = false>(options: Options<ListFunctionRevisionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").RevisionMetadata[], unknown, ThrowOnError>;
|
|
93
|
+
/**
|
|
94
|
+
* List images
|
|
95
|
+
* Returns a list of all images in the workspace grouped by repository with tags.
|
|
96
|
+
*/
|
|
97
|
+
export declare const listImages: <ThrowOnError extends boolean = false>(options?: Options<ListImagesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Image[], unknown, ThrowOnError>;
|
|
98
|
+
/**
|
|
99
|
+
* Delete image by name
|
|
100
|
+
* Deletes an image by name.
|
|
101
|
+
*/
|
|
102
|
+
export declare const deleteImage: <ThrowOnError extends boolean = false>(options: Options<DeleteImageData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Image, unknown, ThrowOnError>;
|
|
103
|
+
/**
|
|
104
|
+
* Get image by name
|
|
105
|
+
* Returns an image by name.
|
|
106
|
+
*/
|
|
107
|
+
export declare const getImage: <ThrowOnError extends boolean = false>(options: Options<GetImageData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Image, unknown, ThrowOnError>;
|
|
108
|
+
/**
|
|
109
|
+
* Delete image tag
|
|
110
|
+
* Deletes a specific tag from an image.
|
|
111
|
+
*/
|
|
112
|
+
export declare const deleteImageTag: <ThrowOnError extends boolean = false>(options: Options<DeleteImageTagData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Image, unknown, ThrowOnError>;
|
|
93
113
|
/**
|
|
94
114
|
* List integrations connections
|
|
95
115
|
* Returns integration information by name.
|
|
@@ -160,6 +180,26 @@ export declare const getJob: <ThrowOnError extends boolean = false>(options: Opt
|
|
|
160
180
|
* Update a job by name.
|
|
161
181
|
*/
|
|
162
182
|
export declare const updateJob: <ThrowOnError extends boolean = false>(options: Options<UpdateJobData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Job, unknown, ThrowOnError>;
|
|
183
|
+
/**
|
|
184
|
+
* List job executions
|
|
185
|
+
* Returns a list of all executions for a job by name.
|
|
186
|
+
*/
|
|
187
|
+
export declare const listJobExecutions: <ThrowOnError extends boolean = false>(options: Options<ListJobExecutionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").JobExecution[], unknown, ThrowOnError>;
|
|
188
|
+
/**
|
|
189
|
+
* Create job execution
|
|
190
|
+
* Creates a new execution for a job by name.
|
|
191
|
+
*/
|
|
192
|
+
export declare const createJobExecution: <ThrowOnError extends boolean = false>(options: Options<CreateJobExecutionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").JobExecution, unknown, ThrowOnError>;
|
|
193
|
+
/**
|
|
194
|
+
* Delete job execution
|
|
195
|
+
* Stop an execution for a job by name.
|
|
196
|
+
*/
|
|
197
|
+
export declare const deleteJobExecution: <ThrowOnError extends boolean = false>(options: Options<DeleteJobExecutionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").JobExecution, unknown, ThrowOnError>;
|
|
198
|
+
/**
|
|
199
|
+
* Get job execution
|
|
200
|
+
* Returns an execution for a job by name.
|
|
201
|
+
*/
|
|
202
|
+
export declare const getJobExecution: <ThrowOnError extends boolean = false>(options: Options<GetJobExecutionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").JobExecution, unknown, ThrowOnError>;
|
|
163
203
|
/**
|
|
164
204
|
* List job revisions
|
|
165
205
|
* Returns revisions for a job by name.
|