@blaxel/core 0.2.96-preview.203 → 0.2.96-preview.205

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 (90) hide show
  1. package/README.md +37 -2
  2. package/dist/cjs/.tsbuildinfo +1 -1
  3. package/dist/cjs/client/sdk.gen.js +113 -2
  4. package/dist/cjs/common/pagination.js +92 -0
  5. package/dist/cjs/common/pagination.test.js +81 -0
  6. package/dist/cjs/common/settings.js +3 -3
  7. package/dist/cjs/common/settings.test.js +3 -3
  8. package/dist/cjs/drive/index.js +39 -4
  9. package/dist/cjs/index.js +1 -0
  10. package/dist/cjs/jobs/jobs.js +42 -10
  11. package/dist/cjs/sandbox/client/sdk.gen.js +2 -2
  12. package/dist/cjs/sandbox/index.js +1 -0
  13. package/dist/cjs/sandbox/preview.js +8 -3
  14. package/dist/cjs/sandbox/sandbox.js +43 -33
  15. package/dist/cjs/sandbox/schedule.js +91 -0
  16. package/dist/cjs/types/client/sdk.gen.d.ts +31 -1
  17. package/dist/cjs/types/client/types.gen.d.ts +347 -0
  18. package/dist/cjs/types/common/pagination.d.ts +35 -0
  19. package/dist/cjs/types/common/pagination.test.d.ts +1 -0
  20. package/dist/cjs/types/drive/index.d.ts +35 -5
  21. package/dist/cjs/types/index.d.ts +1 -0
  22. package/dist/cjs/types/jobs/jobs.d.ts +33 -3
  23. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +2 -2
  24. package/dist/cjs/types/sandbox/client/types.gen.d.ts +28 -1
  25. package/dist/cjs/types/sandbox/index.d.ts +1 -0
  26. package/dist/cjs/types/sandbox/preview.d.ts +2 -2
  27. package/dist/cjs/types/sandbox/sandbox.d.ts +38 -3
  28. package/dist/cjs/types/sandbox/schedule.d.ts +16 -0
  29. package/dist/cjs/types/volume/index.d.ts +37 -4
  30. package/dist/cjs/volume/index.js +41 -4
  31. package/dist/cjs-browser/.tsbuildinfo +1 -1
  32. package/dist/cjs-browser/client/sdk.gen.js +113 -2
  33. package/dist/cjs-browser/common/pagination.js +92 -0
  34. package/dist/cjs-browser/common/pagination.test.js +81 -0
  35. package/dist/cjs-browser/common/settings.js +3 -3
  36. package/dist/cjs-browser/common/settings.test.js +3 -3
  37. package/dist/cjs-browser/drive/index.js +39 -4
  38. package/dist/cjs-browser/index.js +1 -0
  39. package/dist/cjs-browser/jobs/jobs.js +42 -10
  40. package/dist/cjs-browser/sandbox/client/sdk.gen.js +2 -2
  41. package/dist/cjs-browser/sandbox/index.js +1 -0
  42. package/dist/cjs-browser/sandbox/preview.js +8 -3
  43. package/dist/cjs-browser/sandbox/sandbox.js +43 -33
  44. package/dist/cjs-browser/sandbox/schedule.js +91 -0
  45. package/dist/cjs-browser/types/client/sdk.gen.d.ts +31 -1
  46. package/dist/cjs-browser/types/client/types.gen.d.ts +347 -0
  47. package/dist/cjs-browser/types/common/pagination.d.ts +35 -0
  48. package/dist/cjs-browser/types/common/pagination.test.d.ts +1 -0
  49. package/dist/cjs-browser/types/drive/index.d.ts +35 -5
  50. package/dist/cjs-browser/types/index.d.ts +1 -0
  51. package/dist/cjs-browser/types/jobs/jobs.d.ts +33 -3
  52. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +2 -2
  53. package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +28 -1
  54. package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
  55. package/dist/cjs-browser/types/sandbox/preview.d.ts +2 -2
  56. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +38 -3
  57. package/dist/cjs-browser/types/sandbox/schedule.d.ts +16 -0
  58. package/dist/cjs-browser/types/volume/index.d.ts +37 -4
  59. package/dist/cjs-browser/volume/index.js +41 -4
  60. package/dist/esm/.tsbuildinfo +1 -1
  61. package/dist/esm/client/sdk.gen.js +104 -0
  62. package/dist/esm/common/pagination.js +88 -0
  63. package/dist/esm/common/pagination.test.js +79 -0
  64. package/dist/esm/common/settings.js +3 -3
  65. package/dist/esm/common/settings.test.js +3 -3
  66. package/dist/esm/drive/index.js +39 -4
  67. package/dist/esm/index.js +1 -0
  68. package/dist/esm/jobs/jobs.js +42 -10
  69. package/dist/esm/sandbox/client/sdk.gen.js +2 -2
  70. package/dist/esm/sandbox/index.js +1 -0
  71. package/dist/esm/sandbox/preview.js +8 -3
  72. package/dist/esm/sandbox/sandbox.js +43 -33
  73. package/dist/esm/sandbox/schedule.js +87 -0
  74. package/dist/esm/volume/index.js +41 -4
  75. package/dist/esm-browser/.tsbuildinfo +1 -1
  76. package/dist/esm-browser/client/sdk.gen.js +104 -0
  77. package/dist/esm-browser/common/pagination.js +88 -0
  78. package/dist/esm-browser/common/pagination.test.js +79 -0
  79. package/dist/esm-browser/common/settings.js +3 -3
  80. package/dist/esm-browser/common/settings.test.js +3 -3
  81. package/dist/esm-browser/drive/index.js +39 -4
  82. package/dist/esm-browser/index.js +1 -0
  83. package/dist/esm-browser/jobs/jobs.js +42 -10
  84. package/dist/esm-browser/sandbox/client/sdk.gen.js +2 -2
  85. package/dist/esm-browser/sandbox/index.js +1 -0
  86. package/dist/esm-browser/sandbox/preview.js +8 -3
  87. package/dist/esm-browser/sandbox/sandbox.js +43 -33
  88. package/dist/esm-browser/sandbox/schedule.js +87 -0
  89. package/dist/esm-browser/volume/index.js +41 -4
  90. package/package.json +1 -1
@@ -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
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).
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
  /**
@@ -221,7 +221,7 @@ export declare const getProcessByIdentifierLogsStream: <ThrowOnError extends boo
221
221
  * Triggers an upgrade of the sandbox-api process. Returns 200 immediately before upgrading.
222
222
  * The upgrade will: download the specified binary from GitHub releases, validate it, and restart.
223
223
  * All running processes will be preserved across the upgrade.
224
- * Available versions: "develop" (default), "main", "latest", or specific tag like "v1.0.0"
224
+ * Available versions: "latest" (default, most recent release), "develop", "main", or specific tag like "v1.0.0"
225
225
  * You can also specify a custom baseUrl for forks (defaults to https://github.com/blaxel-ai/sandbox/releases)
226
226
  */
227
227
  export declare const postUpgrade: <ThrowOnError extends boolean = false>(options?: Options<PostUpgradeData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
@@ -37,8 +37,16 @@ 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;
40
44
  mountPath?: string;
41
45
  readOnly?: boolean;
46
+ /**
47
+ * The local UID used for this mount
48
+ */
49
+ uidMap?: string;
42
50
  };
43
51
  export type DriveMountRequest = {
44
52
  driveName: string;
@@ -46,19 +54,35 @@ export type DriveMountRequest = {
46
54
  * Optional, defaults to "/"
47
55
  */
48
56
  drivePath?: string;
57
+ /**
58
+ * Optional, local GID to map (filer GID is always 0)
59
+ */
60
+ gidMap?: string;
49
61
  mountPath: string;
50
62
  /**
51
63
  * Optional, defaults to false
52
64
  */
53
65
  readOnly?: boolean;
66
+ /**
67
+ * Optional, local UID to map (filer UID is always 0)
68
+ */
69
+ uidMap?: string;
54
70
  };
55
71
  export type DriveMountResponse = {
56
72
  driveName?: string;
57
73
  drivePath?: string;
74
+ /**
75
+ * The local GID used for this mount
76
+ */
77
+ gidMap?: string;
58
78
  message?: string;
59
79
  mountPath?: string;
60
80
  readOnly?: boolean;
61
81
  success?: boolean;
82
+ /**
83
+ * The local UID used for this mount
84
+ */
85
+ uidMap?: string;
62
86
  };
63
87
  export type DriveUnmountResponse = {
64
88
  message?: string;
@@ -175,6 +199,9 @@ export type ProcessRequest = {
175
199
  * Disable scale-to-zero while process runs. Default timeout is 600s (10 minutes). Set timeout to 0 for infinite.
176
200
  */
177
201
  keepAlive?: boolean;
202
+ /**
203
+ * Maximum number of restarts on failure. Set to a negative value (e.g. -1) for unlimited restarts.
204
+ */
178
205
  maxRestarts?: number;
179
206
  name?: string;
180
207
  restartOnFailure?: boolean;
@@ -241,7 +268,7 @@ export type UpgradeRequest = {
241
268
  */
242
269
  baseUrl?: string;
243
270
  /**
244
- * Version to upgrade to: "develop", "main", "latest", or specific tag like "v1.0.0"
271
+ * Version to upgrade to: "latest" (default), "develop", "main", or specific tag like "v1.0.0"
245
272
  */
246
273
  version?: string;
247
274
  };
@@ -3,6 +3,7 @@ export * from "./filesystem/index.js";
3
3
  export * from "./codegen/index.js";
4
4
  export { SandboxDrive, type DriveMountRequest, type DriveMountResponse, type DriveMountInfo, type DriveUnmountResponse } from "./drive/index.js";
5
5
  export * from "./preview.js";
6
+ export * from "./schedule.js";
6
7
  export * from "./session.js";
7
8
  export * from "./sandbox.js";
8
9
  export * from "./system.js";
@@ -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): Promise<SandboxPreview>;
34
- createIfNotExists(preview: Preview): Promise<SandboxPreview>;
33
+ create(preview: Preview, force?: boolean): Promise<SandboxPreview>;
34
+ createIfNotExists(preview: Preview, force?: boolean): Promise<SandboxPreview>;
35
35
  get(previewName: string): Promise<SandboxPreview>;
36
36
  delete(previewName: string): Promise<Preview>;
37
37
  private waitForDeletion;
@@ -1,20 +1,23 @@
1
1
  import type http2 from "http2";
2
- import { SandboxLifecycle, Sandbox as SandboxModel } from "../client/index.js";
2
+ import { type ListSandboxesData, type SandboxLifecycle, type 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";
6
6
  import { SandboxNetwork } from "./network/index.js";
7
7
  import { SandboxPreviews } from "./preview.js";
8
8
  import { SandboxProcess } from "./process/index.js";
9
+ import { SandboxSchedules } from "./schedule.js";
9
10
  import { SandboxSessions } from "./session.js";
10
11
  import { SandboxSystem } from "./system.js";
11
12
  import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SandboxUpdateNetwork, SessionWithToken } from "./types.js";
13
+ export type SandboxListQuery = NonNullable<ListSandboxesData["query"]>;
12
14
  export declare class SandboxInstance {
13
15
  private sandbox;
14
16
  fs: SandboxFileSystem;
15
17
  network: SandboxNetwork;
16
18
  process: SandboxProcess;
17
19
  previews: SandboxPreviews;
20
+ schedules: SandboxSchedules;
18
21
  sessions: SandboxSessions;
19
22
  codegen: SandboxCodegen;
20
23
  system: SandboxSystem;
@@ -52,9 +55,41 @@ export declare class SandboxInstance {
52
55
  }): Promise<SandboxInstance>;
53
56
  static get(sandboxName: string): Promise<SandboxInstance>;
54
57
  static getByExternalId(externalId: string): Promise<SandboxInstance>;
55
- static list({ externalId }?: {
58
+ /**
59
+ * List one page of sandboxes.
60
+ *
61
+ * The returned page exposes `data` for the current page, `meta` for cursor
62
+ * metadata, and helpers to fetch more pages only when you need them.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const page = await SandboxInstance.list({ limit: 50 });
67
+ *
68
+ * for (const sandbox of page.data) {
69
+ * console.log(sandbox.metadata.name);
70
+ * }
71
+ *
72
+ * const nextPage = await page.nextPage();
73
+ * ```
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const page = await SandboxInstance.list({ limit: 100 });
78
+ *
79
+ * for await (const sandbox of page) {
80
+ * console.log(sandbox.metadata.name);
81
+ * }
82
+ * ```
83
+ */
84
+ static list(query?: SandboxListQuery): Promise<import("../common/pagination.js").PaginatedList<SandboxInstance, {
85
+ showTerminated?: boolean;
86
+ cursor?: string;
87
+ limit?: number;
88
+ sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
89
+ q?: string;
90
+ anchor?: "end";
56
91
  externalId?: string;
57
- }): Promise<SandboxInstance[]>;
92
+ }>>;
58
93
  static delete(sandboxName: string): Promise<SandboxModel>;
59
94
  delete(): Promise<SandboxModel>;
60
95
  static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
@@ -0,0 +1,16 @@
1
+ import type { ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, Sandbox, SandboxScheduleEntry, SandboxScheduleExecution } from "../client/index.js";
2
+ /** Optional filters for listing schedules (`type`, `q`, `limit`, `cursor`, `sort`). */
3
+ export type SandboxScheduleListOptions = NonNullable<ListSandboxSchedulesData["query"]>;
4
+ /** Optional filters for listing schedule executions (`q`, `limit`, `cursor`, `sort`). */
5
+ export type SandboxScheduleExecutionListOptions = NonNullable<ListSandboxScheduleExecutionsData["query"]>;
6
+ export declare class SandboxSchedules {
7
+ private sandbox;
8
+ constructor(sandbox: Sandbox);
9
+ get sandboxName(): string;
10
+ list(options?: SandboxScheduleListOptions): Promise<SandboxScheduleEntry[]>;
11
+ create(schedule: SandboxScheduleEntry): Promise<SandboxScheduleEntry>;
12
+ get(scheduleId: string): Promise<SandboxScheduleEntry>;
13
+ update(scheduleId: string, schedule: SandboxScheduleEntry): Promise<SandboxScheduleEntry>;
14
+ delete(scheduleId: string): Promise<SandboxScheduleEntry>;
15
+ executions(options?: SandboxScheduleExecutionListOptions): Promise<SandboxScheduleExecution[]>;
16
+ }
@@ -1,12 +1,13 @@
1
- import { Volume } from "../client/index.js";
2
- export interface VolumeCreateConfiguration {
1
+ import { type ListVolumesData, type Volume } from "../client/index.js";
2
+ export type VolumeListQuery = NonNullable<ListVolumesData["query"]>;
3
+ export type VolumeCreateConfiguration = {
3
4
  name?: string;
4
5
  displayName?: string;
5
6
  labels?: Record<string, string>;
6
7
  size?: number;
7
8
  region?: string;
8
9
  template?: string;
9
- }
10
+ };
10
11
  export declare class VolumeInstance {
11
12
  private volume;
12
13
  constructor(volume: Volume);
@@ -19,7 +20,39 @@ export declare class VolumeInstance {
19
20
  get region(): string | undefined;
20
21
  static create(config: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
21
22
  static get(volumeName: string): Promise<VolumeInstance>;
22
- static list(): 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
+ }>>;
23
56
  static delete(volumeName: string): Promise<Volume>;
24
57
  delete(): Promise<Volume>;
25
58
  static update(volumeName: string, updates: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
@@ -3,6 +3,7 @@ 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");
6
7
  const settings_js_1 = require("../common/settings.js");
7
8
  class VolumeInstance {
8
9
  volume;
@@ -88,10 +89,46 @@ class VolumeInstance {
88
89
  });
89
90
  return new VolumeInstance(data);
90
91
  }
91
- static async list() {
92
- const { data } = await (0, index_js_1.listVolumes)({ throwOnError: true });
93
- const items = Array.isArray(data) ? data : (data?.data ?? []);
94
- return items.map((volume) => new VolumeInstance(volume));
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
+ });
95
132
  }
96
133
  static async delete(volumeName) {
97
134
  const { data } = await (0, index_js_1.deleteVolume)({