@blaxel/core 0.2.90-dev.181 → 0.2.90-preview.182
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/README.md +2 -37
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/client/sdk.gen.js +12 -63
- package/dist/cjs/common/autoload.js +3 -0
- package/dist/cjs/common/controlPlaneFetch.js +57 -0
- package/dist/cjs/common/h2fetch.js +1 -1
- package/dist/cjs/common/lazyInit.js +5 -4
- package/dist/cjs/common/settings.js +28 -3
- package/dist/cjs/common/settings.test.js +3 -3
- package/dist/cjs/drive/index.js +3 -39
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/jobs/jobs.js +9 -42
- package/dist/cjs/sandbox/client/sdk.gen.js +1 -1
- package/dist/cjs/sandbox/preview.js +3 -8
- package/dist/cjs/sandbox/sandbox.js +4 -41
- package/dist/cjs/types/client/sdk.gen.d.ts +19 -34
- package/dist/cjs/types/client/types.gen.d.ts +22 -704
- package/dist/cjs/types/common/controlPlaneFetch.d.ts +4 -0
- package/dist/cjs/types/common/settings.d.ts +18 -0
- package/dist/cjs/types/drive/index.d.ts +4 -35
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/cjs/types/jobs/jobs.d.ts +3 -33
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +0 -24
- package/dist/cjs/types/sandbox/preview.d.ts +2 -2
- package/dist/cjs/types/sandbox/sandbox.d.ts +2 -36
- package/dist/cjs/types/volume/index.d.ts +4 -37
- package/dist/cjs/volume/index.js +3 -41
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/client/sdk.gen.js +12 -63
- package/dist/cjs-browser/common/autoload.js +3 -0
- package/dist/cjs-browser/common/controlPlaneFetch.js +57 -0
- package/dist/cjs-browser/common/lazyInit.js +5 -4
- package/dist/cjs-browser/common/settings.js +28 -3
- package/dist/cjs-browser/common/settings.test.js +3 -3
- package/dist/cjs-browser/drive/index.js +3 -39
- package/dist/cjs-browser/index.js +0 -1
- package/dist/cjs-browser/jobs/jobs.js +9 -42
- package/dist/cjs-browser/sandbox/client/sdk.gen.js +1 -1
- package/dist/cjs-browser/sandbox/preview.js +3 -8
- package/dist/cjs-browser/sandbox/sandbox.js +4 -41
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +19 -34
- package/dist/cjs-browser/types/client/types.gen.d.ts +22 -704
- package/dist/cjs-browser/types/common/controlPlaneFetch.d.ts +4 -0
- package/dist/cjs-browser/types/common/settings.d.ts +18 -0
- package/dist/cjs-browser/types/drive/index.d.ts +4 -35
- package/dist/cjs-browser/types/index.d.ts +0 -1
- package/dist/cjs-browser/types/jobs/jobs.d.ts +3 -33
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +0 -24
- package/dist/cjs-browser/types/sandbox/preview.d.ts +2 -2
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -36
- package/dist/cjs-browser/types/volume/index.d.ts +4 -37
- package/dist/cjs-browser/volume/index.js +3 -41
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/client/sdk.gen.js +9 -57
- package/dist/esm/common/autoload.js +3 -0
- package/dist/esm/common/controlPlaneFetch.js +51 -0
- package/dist/esm/common/h2fetch.js +1 -1
- package/dist/esm/common/lazyInit.js +5 -4
- package/dist/esm/common/settings.js +28 -3
- package/dist/esm/common/settings.test.js +3 -3
- package/dist/esm/drive/index.js +3 -39
- package/dist/esm/index.js +0 -1
- package/dist/esm/jobs/jobs.js +9 -42
- package/dist/esm/sandbox/client/sdk.gen.js +1 -1
- package/dist/esm/sandbox/preview.js +3 -8
- package/dist/esm/sandbox/sandbox.js +4 -41
- package/dist/esm/volume/index.js +3 -41
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/client/sdk.gen.js +9 -57
- package/dist/esm-browser/common/autoload.js +3 -0
- package/dist/esm-browser/common/controlPlaneFetch.js +51 -0
- package/dist/esm-browser/common/lazyInit.js +5 -4
- package/dist/esm-browser/common/settings.js +28 -3
- package/dist/esm-browser/common/settings.test.js +3 -3
- package/dist/esm-browser/drive/index.js +3 -39
- package/dist/esm-browser/index.js +0 -1
- package/dist/esm-browser/jobs/jobs.js +9 -42
- package/dist/esm-browser/sandbox/client/sdk.gen.js +1 -1
- package/dist/esm-browser/sandbox/preview.js +3 -8
- package/dist/esm-browser/sandbox/sandbox.js +4 -41
- package/dist/esm-browser/volume/index.js +3 -41
- package/package.json +1 -1
- package/dist/cjs/common/pagination.js +0 -87
- package/dist/cjs/common/pagination.test.js +0 -62
- package/dist/cjs/types/common/pagination.d.ts +0 -35
- package/dist/cjs/types/common/pagination.test.d.ts +0 -1
- package/dist/cjs-browser/common/pagination.js +0 -87
- package/dist/cjs-browser/common/pagination.test.js +0 -62
- package/dist/cjs-browser/types/common/pagination.d.ts +0 -35
- package/dist/cjs-browser/types/common/pagination.test.d.ts +0 -1
- package/dist/esm/common/pagination.js +0 -83
- package/dist/esm/common/pagination.test.js +0 -60
- package/dist/esm-browser/common/pagination.js +0 -83
- package/dist/esm-browser/common/pagination.test.js +0 -60
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { client as _heyApiClient } from "./client.gen.js";
|
|
3
3
|
/**
|
|
4
4
|
* List all agents
|
|
5
|
-
* Returns AI agents deployed in the workspace. Each agent includes its deployment status, runtime configuration, and global inference endpoint URL.
|
|
5
|
+
* Returns all AI agents deployed in the workspace. Each agent includes its deployment status, runtime configuration, and global inference endpoint URL.
|
|
6
6
|
*/
|
|
7
7
|
export const listAgents = (options) => {
|
|
8
8
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -221,7 +221,7 @@ export const verifyCustomDomain = (options) => {
|
|
|
221
221
|
};
|
|
222
222
|
/**
|
|
223
223
|
* List drives
|
|
224
|
-
* Returns all drives in the workspace. Drives provide persistent storage that can be attached to agents, functions, and sandboxes.
|
|
224
|
+
* Returns all drives in the workspace. Drives provide persistent storage that can be attached to agents, functions, and sandboxes.
|
|
225
225
|
*/
|
|
226
226
|
export const listDrives = (options) => {
|
|
227
227
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -348,22 +348,6 @@ export const listAllEgressGateways = (options) => {
|
|
|
348
348
|
...options
|
|
349
349
|
});
|
|
350
350
|
};
|
|
351
|
-
/**
|
|
352
|
-
* Egress gateway sandbox attachments
|
|
353
|
-
* Returns the inverse map (gateway → sandbox names) for the workspace. Used by the egress-IPs UI to render attachment counts without fetching the sandboxes listing full client-side.
|
|
354
|
-
*/
|
|
355
|
-
export const getEgressGatewayUsage = (options) => {
|
|
356
|
-
return (options?.client ?? _heyApiClient).get({
|
|
357
|
-
security: [
|
|
358
|
-
{
|
|
359
|
-
scheme: 'bearer',
|
|
360
|
-
type: 'http'
|
|
361
|
-
}
|
|
362
|
-
],
|
|
363
|
-
url: '/egressgateways/usage',
|
|
364
|
-
...options
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
351
|
/**
|
|
368
352
|
* List all egress IPs across all VPCs and gateways in the workspace
|
|
369
353
|
*/
|
|
@@ -413,7 +397,7 @@ export const testFeatureFlag = (options) => {
|
|
|
413
397
|
};
|
|
414
398
|
/**
|
|
415
399
|
* List all MCP servers
|
|
416
|
-
* Returns MCP server functions deployed in the workspace. Each function includes its deployment status, transport protocol (websocket or http-stream), and endpoint URL.
|
|
400
|
+
* Returns all MCP server functions deployed in the workspace. Each function includes its deployment status, transport protocol (websocket or http-stream), and endpoint URL.
|
|
417
401
|
*/
|
|
418
402
|
export const listFunctions = (options) => {
|
|
419
403
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -821,7 +805,7 @@ export const getIntegrationConnectionModel = (options) => {
|
|
|
821
805
|
};
|
|
822
806
|
/**
|
|
823
807
|
* List batch jobs
|
|
824
|
-
* Returns batch job definitions in the workspace. Each job can be triggered to run multiple parallel tasks with configurable concurrency and retry settings.
|
|
808
|
+
* Returns all batch job definitions in the workspace. Each job can be triggered to run multiple parallel tasks with configurable concurrency and retry settings.
|
|
825
809
|
*/
|
|
826
810
|
export const listJobs = (options) => {
|
|
827
811
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -909,7 +893,7 @@ export const updateJob = (options) => {
|
|
|
909
893
|
};
|
|
910
894
|
/**
|
|
911
895
|
* List job executions
|
|
912
|
-
* Returns executions for a batch job
|
|
896
|
+
* Returns paginated list of executions for a batch job, sorted by creation time. Each execution contains status, task counts, and timing information.
|
|
913
897
|
*/
|
|
914
898
|
export const listJobExecutions = (options) => {
|
|
915
899
|
return (options.client ?? _heyApiClient).get({
|
|
@@ -975,22 +959,6 @@ export const getJobExecution = (options) => {
|
|
|
975
959
|
...options
|
|
976
960
|
});
|
|
977
961
|
};
|
|
978
|
-
/**
|
|
979
|
-
* List execution tasks
|
|
980
|
-
* Returns one cursor-paginated page of an execution's tasks. Tasks are derived from event history each request; only the in-memory slicing is paginated, the events scan still fetches the whole event log behind the scenes. Available starting with API version 2026-04-28.
|
|
981
|
-
*/
|
|
982
|
-
export const listJobExecutionTasks = (options) => {
|
|
983
|
-
return (options.client ?? _heyApiClient).get({
|
|
984
|
-
security: [
|
|
985
|
-
{
|
|
986
|
-
scheme: 'bearer',
|
|
987
|
-
type: 'http'
|
|
988
|
-
}
|
|
989
|
-
],
|
|
990
|
-
url: '/jobs/{jobId}/executions/{executionId}/tasks',
|
|
991
|
-
...options
|
|
992
|
-
});
|
|
993
|
-
};
|
|
994
962
|
/**
|
|
995
963
|
* List job revisions
|
|
996
964
|
* Returns revisions for a job by name.
|
|
@@ -1041,7 +1009,7 @@ export const listMcpHubDefinitions = (options) => {
|
|
|
1041
1009
|
};
|
|
1042
1010
|
/**
|
|
1043
1011
|
* List model endpoints
|
|
1044
|
-
* Returns model gateway endpoints configured in the workspace. Each model represents a proxy to an external LLM provider (OpenAI, Anthropic, etc.) with unified access control.
|
|
1012
|
+
* Returns all model gateway endpoints configured in the workspace. Each model represents a proxy to an external LLM provider (OpenAI, Anthropic, etc.) with unified access control.
|
|
1045
1013
|
*/
|
|
1046
1014
|
export const listModels = (options) => {
|
|
1047
1015
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -1193,7 +1161,7 @@ export const declineImageShare = (options) => {
|
|
|
1193
1161
|
};
|
|
1194
1162
|
/**
|
|
1195
1163
|
* List governance policies
|
|
1196
|
-
* Returns governance policies in the workspace. Policies control deployment locations, hardware flavors, and token limits for agents, functions, and models.
|
|
1164
|
+
* Returns all governance policies in the workspace. Policies control deployment locations, hardware flavors, and token limits for agents, functions, and models.
|
|
1197
1165
|
*/
|
|
1198
1166
|
export const listPolicies = (options) => {
|
|
1199
1167
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -1279,22 +1247,6 @@ export const updatePolicy = (options) => {
|
|
|
1279
1247
|
}
|
|
1280
1248
|
});
|
|
1281
1249
|
};
|
|
1282
|
-
/**
|
|
1283
|
-
* List resources using a policy
|
|
1284
|
-
* Returns the names of every resource (agent, function, model, sandbox, job) currently referencing the given policy. Replaces the client-side fan-out the policies UI used to do over the listings.
|
|
1285
|
-
*/
|
|
1286
|
-
export const getPolicyUsages = (options) => {
|
|
1287
|
-
return (options.client ?? _heyApiClient).get({
|
|
1288
|
-
security: [
|
|
1289
|
-
{
|
|
1290
|
-
scheme: 'bearer',
|
|
1291
|
-
type: 'http'
|
|
1292
|
-
}
|
|
1293
|
-
],
|
|
1294
|
-
url: '/policies/{policyName}/usages',
|
|
1295
|
-
...options
|
|
1296
|
-
});
|
|
1297
|
-
};
|
|
1298
1250
|
/**
|
|
1299
1251
|
* List public ips
|
|
1300
1252
|
* Returns a list of all public ips used in Blaxel..
|
|
@@ -1329,7 +1281,7 @@ export const listSandboxHubDefinitions = (options) => {
|
|
|
1329
1281
|
};
|
|
1330
1282
|
/**
|
|
1331
1283
|
* List sandboxes
|
|
1332
|
-
* Returns sandboxes in the workspace. Each sandbox includes its configuration, status, and endpoint URL.
|
|
1284
|
+
* Returns all sandboxes in the workspace. Each sandbox includes its configuration, status, and endpoint URL.
|
|
1333
1285
|
*/
|
|
1334
1286
|
export const listSandboxes = (options) => {
|
|
1335
1287
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -1889,7 +1841,7 @@ export const deleteVolumeTemplateVersion = (options) => {
|
|
|
1889
1841
|
};
|
|
1890
1842
|
/**
|
|
1891
1843
|
* List persistent volumes
|
|
1892
|
-
* Returns persistent storage volumes in the workspace. Volumes can be attached to sandboxes for durable file storage that persists across sessions and sandbox deletions.
|
|
1844
|
+
* Returns all persistent storage volumes in the workspace. Volumes can be attached to sandboxes for durable file storage that persists across sessions and sandbox deletions.
|
|
1893
1845
|
*/
|
|
1894
1846
|
export const listVolumes = (options) => {
|
|
1895
1847
|
return (options?.client ?? _heyApiClient).get({
|
|
@@ -2,10 +2,12 @@ import { client } from "../client/client.gen.js";
|
|
|
2
2
|
import { interceptors } from "../client/interceptors.js";
|
|
3
3
|
import { responseInterceptors } from "../client/responseInterceptor.js";
|
|
4
4
|
import { client as clientSandbox } from "../sandbox/client/client.gen.js";
|
|
5
|
+
import { controlPlaneFetch } from "./controlPlaneFetch.js";
|
|
5
6
|
import { settings } from "./settings.js";
|
|
6
7
|
export { ensureAutoloaded } from "./lazyInit.js";
|
|
7
8
|
client.setConfig({
|
|
8
9
|
baseUrl: settings.baseUrl,
|
|
10
|
+
fetch: controlPlaneFetch,
|
|
9
11
|
});
|
|
10
12
|
// Register request interceptors
|
|
11
13
|
for (const interceptor of interceptors) {
|
|
@@ -50,6 +52,7 @@ export function initialize(config) {
|
|
|
50
52
|
settings.setConfig(config);
|
|
51
53
|
client.setConfig({
|
|
52
54
|
baseUrl: settings.baseUrl,
|
|
55
|
+
fetch: controlPlaneFetch,
|
|
53
56
|
});
|
|
54
57
|
clientSandbox.setConfig({
|
|
55
58
|
baseUrl: settings.baseUrl,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createPoolBackedH2Fetch } from "./h2fetch.js";
|
|
2
|
+
import { h2Pool } from "./h2pool.js";
|
|
3
|
+
import { settings } from "./settings.js";
|
|
4
|
+
const h2FetchByHost = new Map();
|
|
5
|
+
// Node's global fetch dispatcher only negotiates HTTP/2 by default starting
|
|
6
|
+
// with undici 8 (Node 26+); undici 7 (Node 24) and undici 6 (Node 22) still
|
|
7
|
+
// ALPN to HTTP/1.1 for fetch, verified empirically against api.blaxel.ai. On
|
|
8
|
+
// undici >= 8 the pooled wrapper is redundant, so we prefer the native path.
|
|
9
|
+
export function undiciSupportsNativeH2(undiciVersion) {
|
|
10
|
+
const major = Number(undiciVersion?.split(".")[0] ?? 0);
|
|
11
|
+
return major >= 8;
|
|
12
|
+
}
|
|
13
|
+
// `process`/`process.versions` is absent on Cloudflare Workers and other
|
|
14
|
+
// non-Node runtimes, and `process.versions.undici` is undefined on Bun/Deno;
|
|
15
|
+
// all of those resolve to `false` and keep the wrapper as the fallback.
|
|
16
|
+
export const nativeFetchSupportsH2 = typeof process !== "undefined" && undiciSupportsNativeH2(process.versions?.undici);
|
|
17
|
+
export function shouldUseControlPlaneH2(url, h2Disabled, proxyConfigured = false, nativeH2 = false, forceWrapper = false) {
|
|
18
|
+
if (h2Disabled || proxyConfigured)
|
|
19
|
+
return false;
|
|
20
|
+
if (url.protocol !== "https:")
|
|
21
|
+
return false;
|
|
22
|
+
// Token refresh is sequential and unauthenticated; it cannot contribute to
|
|
23
|
+
// the create burst TLS storm, and device-mode refresh currently relies on the
|
|
24
|
+
// native fetch path.
|
|
25
|
+
if (url.pathname.endsWith("/oauth/token"))
|
|
26
|
+
return false;
|
|
27
|
+
if (!(url.hostname.endsWith("blaxel.ai") || url.hostname.endsWith("blaxel.dev"))) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
// Native fetch already negotiates HTTP/2: skip the redundant wrapper unless
|
|
31
|
+
// explicitly forced (e.g. to exercise the pooled path on a modern runtime).
|
|
32
|
+
if (nativeH2 && !forceWrapper)
|
|
33
|
+
return false;
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
export function controlPlaneFetch(input) {
|
|
37
|
+
const url = new URL(input.url);
|
|
38
|
+
const proxyConfigured = Boolean(settings.config.proxy);
|
|
39
|
+
// Global disableH2 still wins; disableControlPlaneH2 opts out of just the
|
|
40
|
+
// control-plane wrapper while leaving data-plane H2 in place.
|
|
41
|
+
const h2Disabled = settings.disableH2 || settings.disableControlPlaneH2;
|
|
42
|
+
if (!shouldUseControlPlaneH2(url, h2Disabled, proxyConfigured, nativeFetchSupportsH2, settings.forceControlPlaneH2)) {
|
|
43
|
+
return globalThis.fetch(input);
|
|
44
|
+
}
|
|
45
|
+
let h2Fetch = h2FetchByHost.get(url.hostname);
|
|
46
|
+
if (!h2Fetch) {
|
|
47
|
+
h2Fetch = createPoolBackedH2Fetch(h2Pool, url.hostname);
|
|
48
|
+
h2FetchByHost.set(url.hostname, h2Fetch);
|
|
49
|
+
}
|
|
50
|
+
return h2Fetch(input);
|
|
51
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { client } from "../client/client.gen.js";
|
|
2
2
|
import { client as clientSandbox } from "../sandbox/client/client.gen.js";
|
|
3
|
+
import { controlPlaneFetch } from "./controlPlaneFetch.js";
|
|
3
4
|
import { initSentry } from "./sentry.js";
|
|
4
5
|
import { settings } from "./settings.js";
|
|
5
6
|
let autoloaded = false;
|
|
@@ -33,7 +34,7 @@ export function ensureAutoloaded() {
|
|
|
33
34
|
// Keep the clients' baseUrl in sync with the now-resolved env. Without
|
|
34
35
|
// this, the module-load `client.setConfig({ baseUrl })` would be stuck on
|
|
35
36
|
// the prod default for users who rely on `config.yaml` (no env vars).
|
|
36
|
-
client.setConfig({ baseUrl: settings.baseUrl });
|
|
37
|
+
client.setConfig({ baseUrl: settings.baseUrl, fetch: controlPlaneFetch });
|
|
37
38
|
clientSandbox.setConfig({ baseUrl: settings.baseUrl });
|
|
38
39
|
// Initialize Sentry for SDK error tracking.
|
|
39
40
|
initSentry();
|
|
@@ -44,9 +45,9 @@ export function ensureAutoloaded() {
|
|
|
44
45
|
if (isNode && !isBrowser && !settings.disableH2) {
|
|
45
46
|
try {
|
|
46
47
|
// Pre-warm edge H2 for the configured region so the first
|
|
47
|
-
// SandboxInstance.create() gets an instant session via the
|
|
48
|
-
//
|
|
49
|
-
//
|
|
48
|
+
// SandboxInstance.create() gets an instant data-plane session via the
|
|
49
|
+
// pool. Control-plane H2 is intentionally not warmed; its cold burst
|
|
50
|
+
// relies on pool deduplication instead.
|
|
50
51
|
const region = settings.region;
|
|
51
52
|
if (region) {
|
|
52
53
|
import("./h2pool.js").then(({ h2Pool }) => {
|
|
@@ -22,10 +22,10 @@ function missingCredentialsMessage() {
|
|
|
22
22
|
return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
|
|
23
23
|
}
|
|
24
24
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
25
|
-
const BUILD_VERSION = "0.2.90-
|
|
26
|
-
const BUILD_COMMIT = "
|
|
25
|
+
const BUILD_VERSION = "0.2.90-preview.182";
|
|
26
|
+
const BUILD_COMMIT = "78dad6b3e2d47dcf5d8464b9688b0829ddc3369c";
|
|
27
27
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
28
|
-
const BLAXEL_API_VERSION = "2026-04-
|
|
28
|
+
const BLAXEL_API_VERSION = "2026-04-16";
|
|
29
29
|
// Cache for config.yaml tracking value
|
|
30
30
|
let configTrackingValue = null;
|
|
31
31
|
let configTrackingLoaded = false;
|
|
@@ -244,6 +244,31 @@ class Settings {
|
|
|
244
244
|
}
|
|
245
245
|
return isDenoRuntime();
|
|
246
246
|
}
|
|
247
|
+
// Control-plane-only escape hatch: disables the control-plane H2 wrapper
|
|
248
|
+
// without affecting data-plane (edge) H2. `disableH2` is the global override
|
|
249
|
+
// and is checked separately by callers, so it always wins.
|
|
250
|
+
get disableControlPlaneH2() {
|
|
251
|
+
if (typeof this.config.disableControlPlaneH2 === "boolean") {
|
|
252
|
+
return this.config.disableControlPlaneH2;
|
|
253
|
+
}
|
|
254
|
+
const value = env.BL_DISABLE_CONTROL_PLANE_H2;
|
|
255
|
+
if (value) {
|
|
256
|
+
return ["1", "true", "yes", "on"].includes(value.toLowerCase());
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
// Forces the control-plane H2 wrapper on even when native fetch already
|
|
261
|
+
// supports H2 (undici >= 7). `disableH2`/`disableControlPlaneH2` still win.
|
|
262
|
+
get forceControlPlaneH2() {
|
|
263
|
+
if (typeof this.config.forceControlPlaneH2 === "boolean") {
|
|
264
|
+
return this.config.forceControlPlaneH2;
|
|
265
|
+
}
|
|
266
|
+
const value = env.BL_FORCE_CONTROL_PLANE_H2;
|
|
267
|
+
if (value) {
|
|
268
|
+
return ["1", "true", "yes", "on"].includes(value.toLowerCase());
|
|
269
|
+
}
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
247
272
|
get maxConcurrentH2Requests() {
|
|
248
273
|
if (typeof this.config.maxConcurrentH2Requests === "number") {
|
|
249
274
|
return this.config.maxConcurrentH2Requests;
|
|
@@ -8,10 +8,10 @@ describe('Settings.apiVersion', () => {
|
|
|
8
8
|
afterEach(() => {
|
|
9
9
|
delete env.BL_API_VERSION;
|
|
10
10
|
});
|
|
11
|
-
it('defaults to 2026-04-
|
|
11
|
+
it('defaults to 2026-04-16 when BL_API_VERSION is not set', async () => {
|
|
12
12
|
delete env.BL_API_VERSION;
|
|
13
13
|
const { settings } = await import('./settings.js');
|
|
14
|
-
expect(settings.apiVersion).toBe('2026-04-
|
|
14
|
+
expect(settings.apiVersion).toBe('2026-04-16');
|
|
15
15
|
});
|
|
16
16
|
it('headers include Blaxel-Version set to the default', async () => {
|
|
17
17
|
delete env.BL_API_VERSION;
|
|
@@ -20,7 +20,7 @@ describe('Settings.apiVersion', () => {
|
|
|
20
20
|
const previous = settings.credentials;
|
|
21
21
|
settings.credentials = new ApiKey({ apiKey: 'test-key', workspace: 'test-ws' });
|
|
22
22
|
try {
|
|
23
|
-
expect(settings.headers['Blaxel-Version']).toBe('2026-04-
|
|
23
|
+
expect(settings.headers['Blaxel-Version']).toBe('2026-04-16');
|
|
24
24
|
}
|
|
25
25
|
finally {
|
|
26
26
|
settings.credentials = previous;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid";
|
|
2
2
|
import { createDrive, deleteDrive, getDrive, listDrives, updateDrive } from "../client/index.js";
|
|
3
|
-
import { createPaginatedList } from "../common/pagination.js";
|
|
4
3
|
import { settings } from "../common/settings.js";
|
|
5
4
|
export class DriveInstance {
|
|
6
5
|
drive;
|
|
@@ -84,44 +83,9 @@ export class DriveInstance {
|
|
|
84
83
|
});
|
|
85
84
|
return new DriveInstance(data);
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
91
|
-
* metadata, and helpers to fetch more pages only when you need them.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```ts
|
|
95
|
-
* const page = await DriveInstance.list({ limit: 50 });
|
|
96
|
-
*
|
|
97
|
-
* for (const drive of page.data) {
|
|
98
|
-
* console.log(drive.name);
|
|
99
|
-
* }
|
|
100
|
-
*
|
|
101
|
-
* const nextPage = await page.nextPage();
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts
|
|
106
|
-
* const allDrives = await (await DriveInstance.list()).autoPagingToArray({
|
|
107
|
-
* limit: 1000,
|
|
108
|
-
* });
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
static async list(query) {
|
|
112
|
-
const fetchPage = async (pageQuery) => {
|
|
113
|
-
const { data } = await listDrives({
|
|
114
|
-
query: pageQuery,
|
|
115
|
-
throwOnError: true,
|
|
116
|
-
});
|
|
117
|
-
return data;
|
|
118
|
-
};
|
|
119
|
-
return createPaginatedList({
|
|
120
|
-
response: await fetchPage(query),
|
|
121
|
-
fetchPage,
|
|
122
|
-
mapItem: (drive) => new DriveInstance(drive),
|
|
123
|
-
query,
|
|
124
|
-
});
|
|
86
|
+
static async list() {
|
|
87
|
+
const { data } = await listDrives({ throwOnError: true });
|
|
88
|
+
return data.map((drive) => new DriveInstance(drive));
|
|
125
89
|
}
|
|
126
90
|
static async delete(driveName) {
|
|
127
91
|
const { data } = await deleteDrive({
|
|
@@ -7,7 +7,6 @@ export * from "./common/node.js";
|
|
|
7
7
|
export * from "./common/errors.js";
|
|
8
8
|
export * from "./common/internal.js";
|
|
9
9
|
export * from "./common/logger.js";
|
|
10
|
-
export * from "./common/pagination.js";
|
|
11
10
|
export * from "./common/settings.js";
|
|
12
11
|
export * from "./common/webhook.js";
|
|
13
12
|
export * from "./drive/index.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createJobExecution, deleteJobExecution, getJobExecution, listJobExecutions, } from "../client/index.js";
|
|
2
2
|
import { logger } from "../common/logger.js";
|
|
3
|
-
import { createPaginatedList } from "../common/pagination.js";
|
|
4
3
|
import { settings } from "../common/settings.js";
|
|
5
4
|
import { startSpan } from "../telemetry/telemetry.js";
|
|
6
5
|
class BlJob {
|
|
@@ -76,50 +75,18 @@ class BlJob {
|
|
|
76
75
|
return data;
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
|
-
* List
|
|
80
|
-
*
|
|
81
|
-
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
82
|
-
* metadata, and helpers to fetch more pages only when you need them.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* const job = blJob("daily-import");
|
|
87
|
-
* const page = await job.listExecutions({ limit: 50 });
|
|
88
|
-
*
|
|
89
|
-
* for (const execution of page.data) {
|
|
90
|
-
* console.log(execution.status);
|
|
91
|
-
* }
|
|
92
|
-
*
|
|
93
|
-
* const nextPage = await page.nextPage();
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* const job = blJob("daily-import");
|
|
99
|
-
* const executions = await (await job.listExecutions()).autoPagingToArray({
|
|
100
|
-
* limit: 1000,
|
|
101
|
-
* });
|
|
102
|
-
* ```
|
|
78
|
+
* List all executions for this job
|
|
103
79
|
*/
|
|
104
|
-
async listExecutions(
|
|
80
|
+
async listExecutions() {
|
|
105
81
|
logger.debug(`Listing executions for job: ${this.jobName}`);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
headers: settings.headers,
|
|
113
|
-
throwOnError: true,
|
|
114
|
-
});
|
|
115
|
-
return data;
|
|
116
|
-
};
|
|
117
|
-
return createPaginatedList({
|
|
118
|
-
response: await fetchPage(query),
|
|
119
|
-
fetchPage,
|
|
120
|
-
mapItem: (execution) => execution,
|
|
121
|
-
query,
|
|
82
|
+
const { data } = await listJobExecutions({
|
|
83
|
+
path: {
|
|
84
|
+
jobId: this.jobName,
|
|
85
|
+
},
|
|
86
|
+
headers: settings.headers,
|
|
87
|
+
throwOnError: true,
|
|
122
88
|
});
|
|
89
|
+
return data ?? [];
|
|
123
90
|
}
|
|
124
91
|
/**
|
|
125
92
|
* Get the status of a specific execution
|
|
@@ -86,7 +86,7 @@ export const getDrivesMount = (options) => {
|
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
88
|
* Attach a drive to a local path
|
|
89
|
-
* Mounts an agent drive using the blfs binary to a local path, optionally mounting a subpath within the drive
|
|
89
|
+
* Mounts an agent drive using the blfs binary to a local path, optionally mounting a subpath within the drive
|
|
90
90
|
*/
|
|
91
91
|
export const postDrivesMount = (options) => {
|
|
92
92
|
return (options.client ?? _heyApiClient).post({
|
|
@@ -99,29 +99,24 @@ export class SandboxPreviews {
|
|
|
99
99
|
});
|
|
100
100
|
return data.map((preview) => new SandboxPreview(preview));
|
|
101
101
|
}
|
|
102
|
-
async create(preview
|
|
103
|
-
const query = {};
|
|
104
|
-
if (force) {
|
|
105
|
-
query['force'] = 'true';
|
|
106
|
-
}
|
|
102
|
+
async create(preview) {
|
|
107
103
|
const { data } = await createSandboxPreview({
|
|
108
104
|
path: {
|
|
109
105
|
sandboxName: this.sandboxName,
|
|
110
106
|
},
|
|
111
|
-
query,
|
|
112
107
|
body: preview,
|
|
113
108
|
throwOnError: true,
|
|
114
109
|
});
|
|
115
110
|
return new SandboxPreview(data);
|
|
116
111
|
}
|
|
117
|
-
async createIfNotExists(preview
|
|
112
|
+
async createIfNotExists(preview) {
|
|
118
113
|
try {
|
|
119
114
|
const previewInstance = await this.get(preview.metadata.name);
|
|
120
115
|
return previewInstance;
|
|
121
116
|
}
|
|
122
117
|
catch (e) {
|
|
123
118
|
if (typeof e === "object" && e !== null && "code" in e && e.code === 404) {
|
|
124
|
-
return this.create(preview
|
|
119
|
+
return this.create(preview);
|
|
125
120
|
}
|
|
126
121
|
throw e;
|
|
127
122
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid";
|
|
2
2
|
import { createSandbox, deleteSandbox, getSandbox, listSandboxes, updateSandbox } from "../client/index.js";
|
|
3
3
|
import { logger } from "../common/logger.js";
|
|
4
|
-
import { createPaginatedList } from "../common/pagination.js";
|
|
5
4
|
import { settings } from "../common/settings.js";
|
|
6
5
|
import { SandboxCodegen } from "./codegen/index.js";
|
|
7
6
|
import { SandboxDrive } from "./drive/index.js";
|
|
@@ -237,46 +236,10 @@ export class SandboxInstance {
|
|
|
237
236
|
const instance = new SandboxInstance(data);
|
|
238
237
|
return SandboxInstance.attachH2Session(instance);
|
|
239
238
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
* metadata, and helpers to fetch more pages only when you need them.
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```ts
|
|
248
|
-
* const page = await SandboxInstance.list({ limit: 50 });
|
|
249
|
-
*
|
|
250
|
-
* for (const sandbox of page.data) {
|
|
251
|
-
* console.log(sandbox.metadata.name);
|
|
252
|
-
* }
|
|
253
|
-
*
|
|
254
|
-
* const nextPage = await page.nextPage();
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```ts
|
|
259
|
-
* const page = await SandboxInstance.list({ limit: 100 });
|
|
260
|
-
*
|
|
261
|
-
* for await (const sandbox of page) {
|
|
262
|
-
* console.log(sandbox.metadata.name);
|
|
263
|
-
* }
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
static async list(query) {
|
|
267
|
-
const fetchPage = async (pageQuery) => {
|
|
268
|
-
const { data } = await listSandboxes({
|
|
269
|
-
query: pageQuery,
|
|
270
|
-
throwOnError: true,
|
|
271
|
-
});
|
|
272
|
-
return data;
|
|
273
|
-
};
|
|
274
|
-
return createPaginatedList({
|
|
275
|
-
response: await fetchPage(query),
|
|
276
|
-
fetchPage,
|
|
277
|
-
mapItem: (sandbox) => SandboxInstance.attachH2Session(new SandboxInstance(sandbox)),
|
|
278
|
-
query,
|
|
279
|
-
});
|
|
239
|
+
static async list() {
|
|
240
|
+
const { data } = await listSandboxes({ throwOnError: true });
|
|
241
|
+
const instances = data.map((sandbox) => new SandboxInstance(sandbox));
|
|
242
|
+
return Promise.all(instances.map((instance) => SandboxInstance.attachH2Session(instance)));
|
|
280
243
|
}
|
|
281
244
|
static async delete(sandboxName) {
|
|
282
245
|
const { data } = await deleteSandbox({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid";
|
|
2
2
|
import { createVolume, deleteVolume, getVolume, listVolumes, updateVolume } from "../client/index.js";
|
|
3
|
-
import { createPaginatedList } from "../common/pagination.js";
|
|
4
3
|
import { settings } from "../common/settings.js";
|
|
5
4
|
export class VolumeInstance {
|
|
6
5
|
volume;
|
|
@@ -86,46 +85,9 @@ export class VolumeInstance {
|
|
|
86
85
|
});
|
|
87
86
|
return new VolumeInstance(data);
|
|
88
87
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
93
|
-
* metadata, and helpers to fetch more pages only when you need them.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* const page = await VolumeInstance.list({ limit: 50 });
|
|
98
|
-
*
|
|
99
|
-
* for (const volume of page.data) {
|
|
100
|
-
* console.log(volume.name);
|
|
101
|
-
* }
|
|
102
|
-
*
|
|
103
|
-
* const nextPage = await page.nextPage();
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* const page = await VolumeInstance.list({ limit: 100 });
|
|
109
|
-
*
|
|
110
|
-
* for await (const volume of page) {
|
|
111
|
-
* console.log(volume.name);
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
static async list(query) {
|
|
116
|
-
const fetchPage = async (pageQuery) => {
|
|
117
|
-
const { data } = await listVolumes({
|
|
118
|
-
query: pageQuery,
|
|
119
|
-
throwOnError: true,
|
|
120
|
-
});
|
|
121
|
-
return data;
|
|
122
|
-
};
|
|
123
|
-
return createPaginatedList({
|
|
124
|
-
response: await fetchPage(query),
|
|
125
|
-
fetchPage,
|
|
126
|
-
mapItem: (volume) => new VolumeInstance(volume),
|
|
127
|
-
query,
|
|
128
|
-
});
|
|
88
|
+
static async list() {
|
|
89
|
+
const { data } = await listVolumes({ throwOnError: true });
|
|
90
|
+
return data.map((volume) => new VolumeInstance(volume));
|
|
129
91
|
}
|
|
130
92
|
static async delete(volumeName) {
|
|
131
93
|
const { data } = await deleteVolume({
|