@blaxel/core 0.2.60 → 0.2.61-dev.59
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/client/sdk.gen.js +22 -18
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/sandbox.js +22 -0
- package/dist/cjs/types/client/sdk.gen.d.ts +6 -6
- package/dist/cjs/types/client/types.gen.d.ts +41 -39
- package/dist/cjs/types/sandbox/sandbox.d.ts +3 -1
- package/dist/cjs/types/volume/index.d.ts +2 -0
- package/dist/cjs/volume/index.js +63 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/client/sdk.gen.js +22 -18
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/sandbox.js +22 -0
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +6 -6
- package/dist/cjs-browser/types/client/types.gen.d.ts +41 -39
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +3 -1
- package/dist/cjs-browser/types/volume/index.d.ts +2 -0
- package/dist/cjs-browser/volume/index.js +63 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/client/sdk.gen.js +20 -16
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/sandbox.js +22 -0
- package/dist/esm/volume/index.js +64 -1
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/client/sdk.gen.js +20 -16
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/sandbox.js +22 -0
- package/dist/esm-browser/volume/index.js +64 -1
- package/package.json +89 -89
- package/LICENSE +0 -21
|
@@ -951,22 +951,6 @@ export const updatePolicy = (options) => {
|
|
|
951
951
|
}
|
|
952
952
|
});
|
|
953
953
|
};
|
|
954
|
-
/**
|
|
955
|
-
* List pending invitations
|
|
956
|
-
* Returns a list of all pending invitations in the workspace.
|
|
957
|
-
*/
|
|
958
|
-
export const listAllPendingInvitations = (options) => {
|
|
959
|
-
return (options?.client ?? _heyApiClient).get({
|
|
960
|
-
security: [
|
|
961
|
-
{
|
|
962
|
-
scheme: 'bearer',
|
|
963
|
-
type: 'http'
|
|
964
|
-
}
|
|
965
|
-
],
|
|
966
|
-
url: '/profile/invitations',
|
|
967
|
-
...options
|
|
968
|
-
});
|
|
969
|
-
};
|
|
970
954
|
/**
|
|
971
955
|
* List public ips
|
|
972
956
|
* Returns a list of all public ips used in Blaxel..
|
|
@@ -1627,6 +1611,26 @@ export const getVolume = (options) => {
|
|
|
1627
1611
|
...options
|
|
1628
1612
|
});
|
|
1629
1613
|
};
|
|
1614
|
+
/**
|
|
1615
|
+
* Update volume
|
|
1616
|
+
* Updates a volume.
|
|
1617
|
+
*/
|
|
1618
|
+
export const updateVolume = (options) => {
|
|
1619
|
+
return (options.client ?? _heyApiClient).put({
|
|
1620
|
+
security: [
|
|
1621
|
+
{
|
|
1622
|
+
scheme: 'bearer',
|
|
1623
|
+
type: 'http'
|
|
1624
|
+
}
|
|
1625
|
+
],
|
|
1626
|
+
url: '/volumes/{volumeName}',
|
|
1627
|
+
...options,
|
|
1628
|
+
headers: {
|
|
1629
|
+
'Content-Type': 'application/json',
|
|
1630
|
+
...options?.headers
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
};
|
|
1630
1634
|
/**
|
|
1631
1635
|
* List accessible workspaces
|
|
1632
1636
|
* Returns all workspaces the authenticated user has access to. Each workspace is a separate tenant with its own resources, team members, and billing.
|
|
@@ -3,8 +3,8 @@ import { authentication } from "../authentication/index.js";
|
|
|
3
3
|
import { env } from "../common/env.js";
|
|
4
4
|
import { fs, os, path } from "../common/node.js";
|
|
5
5
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
6
|
-
const BUILD_VERSION = "0.2.
|
|
7
|
-
const BUILD_COMMIT = "
|
|
6
|
+
const BUILD_VERSION = "0.2.61-dev.59";
|
|
7
|
+
const BUILD_COMMIT = "b31b3a72e9e909957f7eddddd81cff16cccddb26";
|
|
8
8
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
9
9
|
// Cache for config.yaml tracking value
|
|
10
10
|
let configTrackingValue = null;
|
|
@@ -158,6 +158,28 @@ export class SandboxInstance {
|
|
|
158
158
|
const instance = new SandboxInstance(data);
|
|
159
159
|
return instance;
|
|
160
160
|
}
|
|
161
|
+
static async updateTtl(sandboxName, ttl) {
|
|
162
|
+
const sandbox = await SandboxInstance.get(sandboxName);
|
|
163
|
+
const body = { ...sandbox.sandbox, spec: { ...sandbox.spec, runtime: { ...sandbox.spec.runtime, ttl } } };
|
|
164
|
+
const { data } = await updateSandbox({
|
|
165
|
+
path: { sandboxName },
|
|
166
|
+
body,
|
|
167
|
+
throwOnError: true,
|
|
168
|
+
});
|
|
169
|
+
const instance = new SandboxInstance(data);
|
|
170
|
+
return instance;
|
|
171
|
+
}
|
|
172
|
+
static async updateLifecycle(sandboxName, lifecycle) {
|
|
173
|
+
const sandbox = await SandboxInstance.get(sandboxName);
|
|
174
|
+
const body = { ...sandbox.sandbox, spec: { ...sandbox.spec, lifecycle } };
|
|
175
|
+
const { data } = await updateSandbox({
|
|
176
|
+
path: { sandboxName },
|
|
177
|
+
body,
|
|
178
|
+
throwOnError: true,
|
|
179
|
+
});
|
|
180
|
+
const instance = new SandboxInstance(data);
|
|
181
|
+
return instance;
|
|
182
|
+
}
|
|
161
183
|
static async createIfNotExists(sandbox) {
|
|
162
184
|
try {
|
|
163
185
|
return await SandboxInstance.create(sandbox);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid";
|
|
2
|
-
import { createVolume, deleteVolume, getVolume, listVolumes } from "../client/index.js";
|
|
2
|
+
import { createVolume, deleteVolume, getVolume, listVolumes, updateVolume } from "../client/index.js";
|
|
3
3
|
export class VolumeInstance {
|
|
4
4
|
volume;
|
|
5
5
|
constructor(volume) {
|
|
@@ -93,6 +93,69 @@ export class VolumeInstance {
|
|
|
93
93
|
async delete() {
|
|
94
94
|
return await VolumeInstance.delete(this.metadata.name);
|
|
95
95
|
}
|
|
96
|
+
static async update(volumeName, updates) {
|
|
97
|
+
const volume = await VolumeInstance.get(volumeName);
|
|
98
|
+
let metadataUpdates = {};
|
|
99
|
+
let specUpdates = {};
|
|
100
|
+
if ('spec' in updates && 'metadata' in updates) {
|
|
101
|
+
// It's a Volume object - only include defined fields
|
|
102
|
+
if (updates.metadata) {
|
|
103
|
+
if (updates.metadata.displayName !== undefined)
|
|
104
|
+
metadataUpdates.displayName = updates.metadata.displayName;
|
|
105
|
+
if (updates.metadata.labels !== undefined)
|
|
106
|
+
metadataUpdates.labels = updates.metadata.labels;
|
|
107
|
+
}
|
|
108
|
+
if (updates.spec) {
|
|
109
|
+
if (updates.spec.size !== undefined)
|
|
110
|
+
specUpdates.size = updates.spec.size;
|
|
111
|
+
if (updates.spec.region !== undefined)
|
|
112
|
+
specUpdates.region = updates.spec.region;
|
|
113
|
+
if (updates.spec.template !== undefined)
|
|
114
|
+
specUpdates.template = updates.spec.template;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// It's a VolumeCreateConfiguration - only include defined fields
|
|
119
|
+
if (updates.displayName !== undefined)
|
|
120
|
+
metadataUpdates.displayName = updates.displayName;
|
|
121
|
+
if (updates.labels !== undefined)
|
|
122
|
+
metadataUpdates.labels = updates.labels;
|
|
123
|
+
if (updates.size !== undefined)
|
|
124
|
+
specUpdates.size = updates.size;
|
|
125
|
+
if (updates.region !== undefined)
|
|
126
|
+
specUpdates.region = updates.region;
|
|
127
|
+
if (updates.template !== undefined)
|
|
128
|
+
specUpdates.template = updates.template;
|
|
129
|
+
}
|
|
130
|
+
const body = {
|
|
131
|
+
metadata: {
|
|
132
|
+
...volume.metadata,
|
|
133
|
+
...metadataUpdates,
|
|
134
|
+
},
|
|
135
|
+
spec: {
|
|
136
|
+
...volume.spec,
|
|
137
|
+
...specUpdates,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const { data } = await updateVolume({
|
|
141
|
+
path: { volumeName },
|
|
142
|
+
body,
|
|
143
|
+
throwOnError: true,
|
|
144
|
+
});
|
|
145
|
+
const newVolume = {
|
|
146
|
+
metadata: data.metadata,
|
|
147
|
+
spec: data.spec,
|
|
148
|
+
events: data.events,
|
|
149
|
+
state: data.state,
|
|
150
|
+
status: data.status,
|
|
151
|
+
terminatedAt: data.terminatedAt,
|
|
152
|
+
};
|
|
153
|
+
return new VolumeInstance(newVolume);
|
|
154
|
+
}
|
|
155
|
+
async update(updates) {
|
|
156
|
+
const updated = await VolumeInstance.update(this.metadata.name, updates);
|
|
157
|
+
return updated;
|
|
158
|
+
}
|
|
96
159
|
static async createIfNotExists(config) {
|
|
97
160
|
try {
|
|
98
161
|
return await VolumeInstance.create(config);
|
package/package.json
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
2
|
+
"name": "@blaxel/core",
|
|
3
|
+
"version": "0.2.61-dev.59",
|
|
4
|
+
"description": "Blaxel Core SDK for TypeScript",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
7
|
+
"homepage": "https://blaxel.ai",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"lint": "eslint src/",
|
|
10
|
+
"dev": "tsc --watch",
|
|
11
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:fix-esm && npm run build:esm-package && npm run build:replace-imports && npm run build:browser",
|
|
12
|
+
"build:cjs": "NODE_OPTIONS='--max-old-space-size=8192' tsc -p tsconfig.cjs.json",
|
|
13
|
+
"build:esm": "NODE_OPTIONS='--max-old-space-size=8192' tsc -p tsconfig.esm.json",
|
|
14
|
+
"build:fix-esm": "node fix-esm-imports.js",
|
|
15
|
+
"build:esm-package": "echo '{\"type\":\"module\"}' > dist/esm/package.json",
|
|
16
|
+
"build:browser": "node fix-browser-imports.js",
|
|
17
|
+
"build:replace-imports": "node -e \"const fs=require('fs'),{execSync}=require('child_process'),pkg=require('./package.json');let commit='unknown';try{commit=execSync('git rev-parse HEAD',{encoding:'utf8'}).trim()}catch(e){console.log('⚠️ Could not get commit:',e.message)}const sentryDsn=process.env.SENTRY_DSN||'';const paths=['dist/cjs/common/settings.js','dist/esm/common/settings.js','dist/cjs-browser/common/settings.js','dist/esm-browser/common/settings.js'];paths.forEach(p=>{if(fs.existsSync(p)){let c=fs.readFileSync(p,'utf8');c=c.replace(/__BUILD_VERSION__/g,pkg.version);c=c.replace(/__BUILD_COMMIT__/g,commit);c=c.replace(/__BUILD_SENTRY_DSN__/g,sentryDsn);fs.writeFileSync(p,c);console.log('✅ Injected build info in',p,'(v'+pkg.version+', commit:'+commit.substring(0,7)+')');}});\"",
|
|
18
|
+
"test": "vitest --run",
|
|
19
|
+
"test:watch": "vitest --watch"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/blaxel-ai/sdk-typescript"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"blaxel",
|
|
30
|
+
"agent",
|
|
31
|
+
"mcp"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/cjs/index.js",
|
|
34
|
+
"module": "./dist/esm/index.js",
|
|
35
|
+
"browser": "./dist/esm-browser/index.js",
|
|
36
|
+
"types": "./dist/cjs/types/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/cjs/types/index.d.ts",
|
|
40
|
+
"browser": {
|
|
41
|
+
"import": "./dist/esm-browser/index.js",
|
|
42
|
+
"require": "./dist/cjs-browser/index.js",
|
|
43
|
+
"default": "./dist/esm-browser/index.js"
|
|
44
|
+
},
|
|
45
|
+
"node": {
|
|
46
|
+
"import": "./dist/esm/index.js",
|
|
47
|
+
"require": "./dist/cjs/index.js",
|
|
48
|
+
"default": "./dist/cjs/index.js"
|
|
49
|
+
},
|
|
50
|
+
"import": "./dist/esm/index.js",
|
|
51
|
+
"require": "./dist/cjs/index.js",
|
|
52
|
+
"default": "./dist/cjs/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"typesVersions": {
|
|
57
|
+
"*": {
|
|
58
|
+
".": [
|
|
59
|
+
"./dist/cjs/types/index.d.ts"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist"
|
|
65
|
+
],
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@hey-api/client-fetch": "^0.10.0",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
69
|
+
"axios": "^1.9.0",
|
|
70
|
+
"dotenv": "^16.5.0",
|
|
71
|
+
"form-data": "^4.0.2",
|
|
72
|
+
"jwt-decode": "^4.0.0",
|
|
73
|
+
"toml": "^3.0.0",
|
|
74
|
+
"uuid": "^11.1.0",
|
|
75
|
+
"ws": "^8.18.2",
|
|
76
|
+
"yaml": "^2.7.1",
|
|
77
|
+
"zod": "^3.24.3"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@eslint/js": "^9.26.0",
|
|
81
|
+
"@testing-library/dom": "^9.3.0",
|
|
82
|
+
"@types/ws": "^8.18.1",
|
|
83
|
+
"eslint": "^9.27.0",
|
|
84
|
+
"jsdom": "^26.1.0",
|
|
85
|
+
"typescript": "^5.0.0",
|
|
86
|
+
"typescript-eslint": "^8.31.1",
|
|
87
|
+
"vite": "^5.2.0",
|
|
88
|
+
"vitest": "^1.5.0"
|
|
89
|
+
}
|
|
90
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Beamlit, Inc
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|