@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.
Files changed (96) hide show
  1. package/README.md +2 -37
  2. package/dist/cjs/.tsbuildinfo +1 -1
  3. package/dist/cjs/client/sdk.gen.js +12 -63
  4. package/dist/cjs/common/autoload.js +3 -0
  5. package/dist/cjs/common/controlPlaneFetch.js +57 -0
  6. package/dist/cjs/common/h2fetch.js +1 -1
  7. package/dist/cjs/common/lazyInit.js +5 -4
  8. package/dist/cjs/common/settings.js +28 -3
  9. package/dist/cjs/common/settings.test.js +3 -3
  10. package/dist/cjs/drive/index.js +3 -39
  11. package/dist/cjs/index.js +0 -1
  12. package/dist/cjs/jobs/jobs.js +9 -42
  13. package/dist/cjs/sandbox/client/sdk.gen.js +1 -1
  14. package/dist/cjs/sandbox/preview.js +3 -8
  15. package/dist/cjs/sandbox/sandbox.js +4 -41
  16. package/dist/cjs/types/client/sdk.gen.d.ts +19 -34
  17. package/dist/cjs/types/client/types.gen.d.ts +22 -704
  18. package/dist/cjs/types/common/controlPlaneFetch.d.ts +4 -0
  19. package/dist/cjs/types/common/settings.d.ts +18 -0
  20. package/dist/cjs/types/drive/index.d.ts +4 -35
  21. package/dist/cjs/types/index.d.ts +0 -1
  22. package/dist/cjs/types/jobs/jobs.d.ts +3 -33
  23. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
  24. package/dist/cjs/types/sandbox/client/types.gen.d.ts +0 -24
  25. package/dist/cjs/types/sandbox/preview.d.ts +2 -2
  26. package/dist/cjs/types/sandbox/sandbox.d.ts +2 -36
  27. package/dist/cjs/types/volume/index.d.ts +4 -37
  28. package/dist/cjs/volume/index.js +3 -41
  29. package/dist/cjs-browser/.tsbuildinfo +1 -1
  30. package/dist/cjs-browser/client/sdk.gen.js +12 -63
  31. package/dist/cjs-browser/common/autoload.js +3 -0
  32. package/dist/cjs-browser/common/controlPlaneFetch.js +57 -0
  33. package/dist/cjs-browser/common/lazyInit.js +5 -4
  34. package/dist/cjs-browser/common/settings.js +28 -3
  35. package/dist/cjs-browser/common/settings.test.js +3 -3
  36. package/dist/cjs-browser/drive/index.js +3 -39
  37. package/dist/cjs-browser/index.js +0 -1
  38. package/dist/cjs-browser/jobs/jobs.js +9 -42
  39. package/dist/cjs-browser/sandbox/client/sdk.gen.js +1 -1
  40. package/dist/cjs-browser/sandbox/preview.js +3 -8
  41. package/dist/cjs-browser/sandbox/sandbox.js +4 -41
  42. package/dist/cjs-browser/types/client/sdk.gen.d.ts +19 -34
  43. package/dist/cjs-browser/types/client/types.gen.d.ts +22 -704
  44. package/dist/cjs-browser/types/common/controlPlaneFetch.d.ts +4 -0
  45. package/dist/cjs-browser/types/common/settings.d.ts +18 -0
  46. package/dist/cjs-browser/types/drive/index.d.ts +4 -35
  47. package/dist/cjs-browser/types/index.d.ts +0 -1
  48. package/dist/cjs-browser/types/jobs/jobs.d.ts +3 -33
  49. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
  50. package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +0 -24
  51. package/dist/cjs-browser/types/sandbox/preview.d.ts +2 -2
  52. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -36
  53. package/dist/cjs-browser/types/volume/index.d.ts +4 -37
  54. package/dist/cjs-browser/volume/index.js +3 -41
  55. package/dist/esm/.tsbuildinfo +1 -1
  56. package/dist/esm/client/sdk.gen.js +9 -57
  57. package/dist/esm/common/autoload.js +3 -0
  58. package/dist/esm/common/controlPlaneFetch.js +51 -0
  59. package/dist/esm/common/h2fetch.js +1 -1
  60. package/dist/esm/common/lazyInit.js +5 -4
  61. package/dist/esm/common/settings.js +28 -3
  62. package/dist/esm/common/settings.test.js +3 -3
  63. package/dist/esm/drive/index.js +3 -39
  64. package/dist/esm/index.js +0 -1
  65. package/dist/esm/jobs/jobs.js +9 -42
  66. package/dist/esm/sandbox/client/sdk.gen.js +1 -1
  67. package/dist/esm/sandbox/preview.js +3 -8
  68. package/dist/esm/sandbox/sandbox.js +4 -41
  69. package/dist/esm/volume/index.js +3 -41
  70. package/dist/esm-browser/.tsbuildinfo +1 -1
  71. package/dist/esm-browser/client/sdk.gen.js +9 -57
  72. package/dist/esm-browser/common/autoload.js +3 -0
  73. package/dist/esm-browser/common/controlPlaneFetch.js +51 -0
  74. package/dist/esm-browser/common/lazyInit.js +5 -4
  75. package/dist/esm-browser/common/settings.js +28 -3
  76. package/dist/esm-browser/common/settings.test.js +3 -3
  77. package/dist/esm-browser/drive/index.js +3 -39
  78. package/dist/esm-browser/index.js +0 -1
  79. package/dist/esm-browser/jobs/jobs.js +9 -42
  80. package/dist/esm-browser/sandbox/client/sdk.gen.js +1 -1
  81. package/dist/esm-browser/sandbox/preview.js +3 -8
  82. package/dist/esm-browser/sandbox/sandbox.js +4 -41
  83. package/dist/esm-browser/volume/index.js +3 -41
  84. package/package.json +1 -1
  85. package/dist/cjs/common/pagination.js +0 -87
  86. package/dist/cjs/common/pagination.test.js +0 -62
  87. package/dist/cjs/types/common/pagination.d.ts +0 -35
  88. package/dist/cjs/types/common/pagination.test.d.ts +0 -1
  89. package/dist/cjs-browser/common/pagination.js +0 -87
  90. package/dist/cjs-browser/common/pagination.test.js +0 -62
  91. package/dist/cjs-browser/types/common/pagination.d.ts +0 -35
  92. package/dist/cjs-browser/types/common/pagination.test.d.ts +0 -1
  93. package/dist/esm/common/pagination.js +0 -83
  94. package/dist/esm/common/pagination.test.js +0 -60
  95. package/dist/esm-browser/common/pagination.js +0 -83
  96. package/dist/esm-browser/common/pagination.test.js +0 -60
@@ -0,0 +1,4 @@
1
+ export declare function undiciSupportsNativeH2(undiciVersion: string | undefined): boolean;
2
+ export declare const nativeFetchSupportsH2: boolean;
3
+ export declare function shouldUseControlPlaneH2(url: URL, h2Disabled: boolean, proxyConfigured?: boolean, nativeH2?: boolean, forceWrapper?: boolean): boolean;
4
+ export declare function controlPlaneFetch(input: Request): Promise<Response>;
@@ -12,6 +12,22 @@ export type Config = {
12
12
  apikey?: string;
13
13
  workspace?: string;
14
14
  disableH2?: boolean;
15
+ /**
16
+ * Disables only the control-plane HTTP/2 wrapper, leaving data-plane (edge)
17
+ * H2 untouched. Use this to route control-plane calls (api.blaxel.{ai,dev})
18
+ * over native fetch while keeping sandbox/data-plane traffic on the H2 pool.
19
+ * The global `disableH2` flag still wins: when it is true, both planes use
20
+ * native fetch regardless of this value. Defaults to `false` (wrapper on).
21
+ */
22
+ disableControlPlaneH2?: boolean;
23
+ /**
24
+ * Forces the control-plane HTTP/2 wrapper on even when the runtime's native
25
+ * fetch already negotiates HTTP/2 (undici >= 8 / Node 26+), where it is
26
+ * otherwise skipped as redundant. Mainly for exercising the pooled path on a
27
+ * modern runtime. `disableH2` and `disableControlPlaneH2` still win.
28
+ * Defaults to `false`.
29
+ */
30
+ forceControlPlaneH2?: boolean;
15
31
  /**
16
32
  * Maximum number of concurrent in-flight HTTP/2 requests across the shared
17
33
  * H2 session pool. `0` or `undefined` means unlimited (current behavior).
@@ -93,6 +109,8 @@ declare class Settings {
93
109
  get tracking(): boolean;
94
110
  get region(): string | undefined;
95
111
  get disableH2(): boolean;
112
+ get disableControlPlaneH2(): boolean;
113
+ get forceControlPlaneH2(): boolean;
96
114
  get maxConcurrentH2Requests(): number;
97
115
  get maxConcurrentUploadH2Requests(): number;
98
116
  get h2StreamWindowSize(): number;
@@ -1,12 +1,11 @@
1
- import { type Drive, type ListDrivesData } from "../client/index.js";
2
- export type DriveListQuery = NonNullable<ListDrivesData["query"]>;
3
- export type DriveCreateConfiguration = {
1
+ import { Drive } from "../client/index.js";
2
+ export interface DriveCreateConfiguration {
4
3
  name?: string;
5
4
  displayName?: string;
6
5
  labels?: Record<string, string>;
7
6
  size?: number;
8
7
  region?: string;
9
- };
8
+ }
10
9
  export declare class DriveInstance {
11
10
  private drive;
12
11
  constructor(drive: Drive);
@@ -20,37 +19,7 @@ export declare class DriveInstance {
20
19
  get region(): string | undefined;
21
20
  static create(config: DriveCreateConfiguration | Drive): Promise<DriveInstance>;
22
21
  static get(driveName: string): Promise<DriveInstance>;
23
- /**
24
- * List one page of drives.
25
- *
26
- * The returned page exposes `data` for the current page, `meta` for cursor
27
- * metadata, and helpers to fetch more pages only when you need them.
28
- *
29
- * @example
30
- * ```ts
31
- * const page = await DriveInstance.list({ limit: 50 });
32
- *
33
- * for (const drive of page.data) {
34
- * console.log(drive.name);
35
- * }
36
- *
37
- * const nextPage = await page.nextPage();
38
- * ```
39
- *
40
- * @example
41
- * ```ts
42
- * const allDrives = await (await DriveInstance.list()).autoPagingToArray({
43
- * limit: 1000,
44
- * });
45
- * ```
46
- */
47
- static list(query?: DriveListQuery): Promise<import("../common/pagination.js").PaginatedList<DriveInstance, {
48
- cursor?: string;
49
- limit?: number;
50
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
51
- q?: string;
52
- anchor?: "end";
53
- }>>;
22
+ static list(): Promise<DriveInstance[]>;
54
23
  static delete(driveName: string): Promise<{
55
24
  message?: string;
56
25
  name?: string;
@@ -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,5 +1,4 @@
1
- import { type CreateJobExecutionRequest, type JobExecution, type ListJobExecutionsData } from "../client/index.js";
2
- export type JobExecutionListQuery = NonNullable<ListJobExecutionsData["query"]>;
1
+ import { CreateJobExecutionRequest, JobExecution } from "../client/index.js";
3
2
  declare class BlJob {
4
3
  jobName: string;
5
4
  constructor(jobName: string);
@@ -17,38 +16,9 @@ declare class BlJob {
17
16
  */
18
17
  getExecution(executionId: string): Promise<JobExecution>;
19
18
  /**
20
- * List one page of executions for this job.
21
- *
22
- * The returned page exposes `data` for the current page, `meta` for cursor
23
- * metadata, and helpers to fetch more pages only when you need them.
24
- *
25
- * @example
26
- * ```ts
27
- * const job = blJob("daily-import");
28
- * const page = await job.listExecutions({ limit: 50 });
29
- *
30
- * for (const execution of page.data) {
31
- * console.log(execution.status);
32
- * }
33
- *
34
- * const nextPage = await page.nextPage();
35
- * ```
36
- *
37
- * @example
38
- * ```ts
39
- * const job = blJob("daily-import");
40
- * const executions = await (await job.listExecutions()).autoPagingToArray({
41
- * limit: 1000,
42
- * });
43
- * ```
19
+ * List all executions for this job
44
20
  */
45
- listExecutions(query?: JobExecutionListQuery): Promise<import("../common/pagination.js").PaginatedList<JobExecution, {
46
- limit?: number;
47
- offset?: number;
48
- cursor?: string;
49
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
50
- q?: string;
51
- }>>;
21
+ listExecutions(): Promise<JobExecution[]>;
52
22
  /**
53
23
  * Get the status of a specific execution
54
24
  */
@@ -61,7 +61,7 @@ export declare const getCodegenRerankingByPath: <ThrowOnError extends boolean =
61
61
  export declare const getDrivesMount: <ThrowOnError extends boolean = false>(options?: Options<GetDrivesMountData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").DriveListResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
62
62
  /**
63
63
  * Attach a drive to a local path
64
- * Mounts an agent drive using the blfs binary to a local path, optionally mounting a subpath within the drive. Supports optional UID/GID mapping to remap file ownership between the local sandbox and the filer (always mapped to filer UID/GID 0). Mapping values can be set per-request via uidMap/gidMap fields, or globally via BLFS_UID_MAP/BLFS_GID_MAP environment variables (request values take precedence).
64
+ * Mounts an agent drive using the blfs binary to a local path, optionally mounting a subpath within the drive
65
65
  */
66
66
  export declare const postDrivesMount: <ThrowOnError extends boolean = false>(options: Options<PostDrivesMountData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").DriveMountResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
67
67
  /**
@@ -37,16 +37,8 @@ export type DriveListResponse = {
37
37
  export type DriveMountInfo = {
38
38
  driveName?: string;
39
39
  drivePath?: string;
40
- /**
41
- * The local GID used for this mount
42
- */
43
- gidMap?: string;
44
40
  mountPath?: string;
45
41
  readOnly?: boolean;
46
- /**
47
- * The local UID used for this mount
48
- */
49
- uidMap?: string;
50
42
  };
51
43
  export type DriveMountRequest = {
52
44
  driveName: string;
@@ -54,35 +46,19 @@ export type DriveMountRequest = {
54
46
  * Optional, defaults to "/"
55
47
  */
56
48
  drivePath?: string;
57
- /**
58
- * Optional, local GID to map (filer GID is always 0)
59
- */
60
- gidMap?: string;
61
49
  mountPath: string;
62
50
  /**
63
51
  * Optional, defaults to false
64
52
  */
65
53
  readOnly?: boolean;
66
- /**
67
- * Optional, local UID to map (filer UID is always 0)
68
- */
69
- uidMap?: string;
70
54
  };
71
55
  export type DriveMountResponse = {
72
56
  driveName?: string;
73
57
  drivePath?: string;
74
- /**
75
- * The local GID used for this mount
76
- */
77
- gidMap?: string;
78
58
  message?: string;
79
59
  mountPath?: string;
80
60
  readOnly?: boolean;
81
61
  success?: boolean;
82
- /**
83
- * The local UID used for this mount
84
- */
85
- uidMap?: string;
86
62
  };
87
63
  export type DriveUnmountResponse = {
88
64
  message?: string;
@@ -30,8 +30,8 @@ export declare class SandboxPreviews {
30
30
  constructor(sandbox: Sandbox);
31
31
  get sandboxName(): string;
32
32
  list(): Promise<SandboxPreview[]>;
33
- create(preview: Preview, force?: boolean): Promise<SandboxPreview>;
34
- createIfNotExists(preview: Preview, force?: boolean): Promise<SandboxPreview>;
33
+ create(preview: Preview): Promise<SandboxPreview>;
34
+ createIfNotExists(preview: Preview): Promise<SandboxPreview>;
35
35
  get(previewName: string): Promise<SandboxPreview>;
36
36
  delete(previewName: string): Promise<Preview>;
37
37
  private waitForDeletion;
@@ -1,5 +1,5 @@
1
1
  import type http2 from "http2";
2
- import { type ListSandboxesData, type SandboxLifecycle, type Sandbox as SandboxModel } from "../client/index.js";
2
+ import { SandboxLifecycle, Sandbox as SandboxModel } from "../client/index.js";
3
3
  import { SandboxCodegen } from "./codegen/index.js";
4
4
  import { SandboxDrive } from "./drive/index.js";
5
5
  import { SandboxFileSystem } from "./filesystem/index.js";
@@ -9,7 +9,6 @@ import { SandboxProcess } from "./process/index.js";
9
9
  import { SandboxSessions } from "./session.js";
10
10
  import { SandboxSystem } from "./system.js";
11
11
  import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SandboxUpdateNetwork, SessionWithToken } from "./types.js";
12
- export type SandboxListQuery = NonNullable<ListSandboxesData["query"]>;
13
12
  export declare class SandboxInstance {
14
13
  private sandbox;
15
14
  fs: SandboxFileSystem;
@@ -52,40 +51,7 @@ export declare class SandboxInstance {
52
51
  createIfNotExist?: boolean;
53
52
  }): Promise<SandboxInstance>;
54
53
  static get(sandboxName: string): Promise<SandboxInstance>;
55
- /**
56
- * List one page of sandboxes.
57
- *
58
- * The returned page exposes `data` for the current page, `meta` for cursor
59
- * metadata, and helpers to fetch more pages only when you need them.
60
- *
61
- * @example
62
- * ```ts
63
- * const page = await SandboxInstance.list({ limit: 50 });
64
- *
65
- * for (const sandbox of page.data) {
66
- * console.log(sandbox.metadata.name);
67
- * }
68
- *
69
- * const nextPage = await page.nextPage();
70
- * ```
71
- *
72
- * @example
73
- * ```ts
74
- * const page = await SandboxInstance.list({ limit: 100 });
75
- *
76
- * for await (const sandbox of page) {
77
- * console.log(sandbox.metadata.name);
78
- * }
79
- * ```
80
- */
81
- static list(query?: SandboxListQuery): Promise<import("../common/pagination.js").PaginatedList<SandboxInstance, {
82
- showTerminated?: boolean;
83
- cursor?: string;
84
- limit?: number;
85
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
86
- q?: string;
87
- anchor?: "end";
88
- }>>;
54
+ static list(): Promise<SandboxInstance[]>;
89
55
  static delete(sandboxName: string): Promise<SandboxModel>;
90
56
  delete(): Promise<SandboxModel>;
91
57
  static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
@@ -1,13 +1,12 @@
1
- import { type ListVolumesData, type Volume } from "../client/index.js";
2
- export type VolumeListQuery = NonNullable<ListVolumesData["query"]>;
3
- export type VolumeCreateConfiguration = {
1
+ import { Volume } from "../client/index.js";
2
+ export interface VolumeCreateConfiguration {
4
3
  name?: string;
5
4
  displayName?: string;
6
5
  labels?: Record<string, string>;
7
6
  size?: number;
8
7
  region?: string;
9
8
  template?: string;
10
- };
9
+ }
11
10
  export declare class VolumeInstance {
12
11
  private volume;
13
12
  constructor(volume: Volume);
@@ -20,39 +19,7 @@ export declare class VolumeInstance {
20
19
  get region(): string | undefined;
21
20
  static create(config: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
22
21
  static get(volumeName: string): Promise<VolumeInstance>;
23
- /**
24
- * List one page of volumes.
25
- *
26
- * The returned page exposes `data` for the current page, `meta` for cursor
27
- * metadata, and helpers to fetch more pages only when you need them.
28
- *
29
- * @example
30
- * ```ts
31
- * const page = await VolumeInstance.list({ limit: 50 });
32
- *
33
- * for (const volume of page.data) {
34
- * console.log(volume.name);
35
- * }
36
- *
37
- * const nextPage = await page.nextPage();
38
- * ```
39
- *
40
- * @example
41
- * ```ts
42
- * const page = await VolumeInstance.list({ limit: 100 });
43
- *
44
- * for await (const volume of page) {
45
- * console.log(volume.name);
46
- * }
47
- * ```
48
- */
49
- static list(query?: VolumeListQuery): Promise<import("../common/pagination.js").PaginatedList<VolumeInstance, {
50
- cursor?: string;
51
- limit?: number;
52
- sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
53
- q?: string;
54
- anchor?: "end";
55
- }>>;
22
+ static list(): Promise<VolumeInstance[]>;
56
23
  static delete(volumeName: string): Promise<Volume>;
57
24
  delete(): Promise<Volume>;
58
25
  static update(volumeName: string, updates: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VolumeInstance = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const index_js_1 = require("../client/index.js");
6
- const pagination_js_1 = require("../common/pagination.js");
7
6
  const settings_js_1 = require("../common/settings.js");
8
7
  class VolumeInstance {
9
8
  volume;
@@ -89,46 +88,9 @@ class VolumeInstance {
89
88
  });
90
89
  return new VolumeInstance(data);
91
90
  }
92
- /**
93
- * List one page of volumes.
94
- *
95
- * The returned page exposes `data` for the current page, `meta` for cursor
96
- * metadata, and helpers to fetch more pages only when you need them.
97
- *
98
- * @example
99
- * ```ts
100
- * const page = await VolumeInstance.list({ limit: 50 });
101
- *
102
- * for (const volume of page.data) {
103
- * console.log(volume.name);
104
- * }
105
- *
106
- * const nextPage = await page.nextPage();
107
- * ```
108
- *
109
- * @example
110
- * ```ts
111
- * const page = await VolumeInstance.list({ limit: 100 });
112
- *
113
- * for await (const volume of page) {
114
- * console.log(volume.name);
115
- * }
116
- * ```
117
- */
118
- static async list(query) {
119
- const fetchPage = async (pageQuery) => {
120
- const { data } = await (0, index_js_1.listVolumes)({
121
- query: pageQuery,
122
- throwOnError: true,
123
- });
124
- return data;
125
- };
126
- return (0, pagination_js_1.createPaginatedList)({
127
- response: await fetchPage(query),
128
- fetchPage,
129
- mapItem: (volume) => new VolumeInstance(volume),
130
- query,
131
- });
91
+ static async list() {
92
+ const { data } = await (0, index_js_1.listVolumes)({ throwOnError: true });
93
+ return data.map((volume) => new VolumeInstance(volume));
132
94
  }
133
95
  static async delete(volumeName) {
134
96
  const { data } = await (0, index_js_1.deleteVolume)({