@blaxel/core 0.2.79 → 0.2.80-preview.135

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 (37) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/client/sdk.gen.js +79 -3
  3. package/dist/cjs/common/settings.js +2 -2
  4. package/dist/cjs/sandbox/client/sdk.gen.js +56 -1
  5. package/dist/cjs/sandbox/drive/drive.js +22 -51
  6. package/dist/cjs/sandbox/index.js +5 -1
  7. package/dist/cjs/types/client/sdk.gen.d.ts +26 -1
  8. package/dist/cjs/types/client/types.gen.d.ts +225 -6
  9. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +16 -1
  10. package/dist/cjs/types/sandbox/client/types.gen.d.ts +104 -0
  11. package/dist/cjs/types/sandbox/drive/drive.d.ts +2 -25
  12. package/dist/cjs/types/sandbox/index.d.ts +3 -0
  13. package/dist/cjs-browser/.tsbuildinfo +1 -1
  14. package/dist/cjs-browser/client/sdk.gen.js +79 -3
  15. package/dist/cjs-browser/common/settings.js +2 -2
  16. package/dist/cjs-browser/sandbox/client/sdk.gen.js +56 -1
  17. package/dist/cjs-browser/sandbox/drive/drive.js +22 -51
  18. package/dist/cjs-browser/sandbox/index.js +5 -1
  19. package/dist/cjs-browser/types/client/sdk.gen.d.ts +26 -1
  20. package/dist/cjs-browser/types/client/types.gen.d.ts +225 -6
  21. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +16 -1
  22. package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +104 -0
  23. package/dist/cjs-browser/types/sandbox/drive/drive.d.ts +2 -25
  24. package/dist/cjs-browser/types/sandbox/index.d.ts +3 -0
  25. package/dist/esm/.tsbuildinfo +1 -1
  26. package/dist/esm/client/sdk.gen.js +72 -0
  27. package/dist/esm/common/settings.js +2 -2
  28. package/dist/esm/sandbox/client/sdk.gen.js +52 -0
  29. package/dist/esm/sandbox/drive/drive.js +22 -51
  30. package/dist/esm/sandbox/index.js +3 -0
  31. package/dist/esm-browser/.tsbuildinfo +1 -1
  32. package/dist/esm-browser/client/sdk.gen.js +72 -0
  33. package/dist/esm-browser/common/settings.js +2 -2
  34. package/dist/esm-browser/sandbox/client/sdk.gen.js +52 -0
  35. package/dist/esm-browser/sandbox/drive/drive.js +22 -51
  36. package/dist/esm-browser/sandbox/index.js +3 -0
  37. package/package.json +1 -1
@@ -531,6 +531,26 @@ export const listImages = (options) => {
531
531
  ...options
532
532
  });
533
533
  };
534
+ /**
535
+ * Build a container image
536
+ * Builds a container image without creating a deployment. Returns a presigned URL for uploading source code. After upload, the image will be built and stored in the registry, but no agent, function, sandbox, or job will be created or updated.
537
+ */
538
+ export const createImage = (options) => {
539
+ return (options.client ?? _heyApiClient).post({
540
+ security: [
541
+ {
542
+ scheme: 'bearer',
543
+ type: 'http'
544
+ }
545
+ ],
546
+ url: '/images',
547
+ ...options,
548
+ headers: {
549
+ 'Content-Type': 'application/json',
550
+ ...options?.headers
551
+ }
552
+ });
553
+ };
534
554
  /**
535
555
  * Delete container image
536
556
  * Deletes a container image and all its tags from the workspace registry. Will fail if the image is currently in use by an active deployment.
@@ -563,6 +583,58 @@ export const getImage = (options) => {
563
583
  ...options
564
584
  });
565
585
  };
586
+ /**
587
+ * List image shares
588
+ * Returns the list of workspaces that a container image is currently shared with.
589
+ */
590
+ export const listImageShares = (options) => {
591
+ return (options.client ?? _heyApiClient).get({
592
+ security: [
593
+ {
594
+ scheme: 'bearer',
595
+ type: 'http'
596
+ }
597
+ ],
598
+ url: '/images/{resourceType}/{imageName}/share',
599
+ ...options
600
+ });
601
+ };
602
+ /**
603
+ * Share a container image
604
+ * Shares a container image with another workspace by copying the metadata record. The underlying storage (S3) data is not duplicated. The target workspace must belong to the same account.
605
+ */
606
+ export const shareImage = (options) => {
607
+ return (options.client ?? _heyApiClient).post({
608
+ security: [
609
+ {
610
+ scheme: 'bearer',
611
+ type: 'http'
612
+ }
613
+ ],
614
+ url: '/images/{resourceType}/{imageName}/share',
615
+ ...options,
616
+ headers: {
617
+ 'Content-Type': 'application/json',
618
+ ...options?.headers
619
+ }
620
+ });
621
+ };
622
+ /**
623
+ * Unshare a container image
624
+ * Revokes sharing of a container image with a target workspace. Removes the metadata copy from the target workspace. The source image is not affected.
625
+ */
626
+ export const unshareImage = (options) => {
627
+ return (options.client ?? _heyApiClient).delete({
628
+ security: [
629
+ {
630
+ scheme: 'bearer',
631
+ type: 'http'
632
+ }
633
+ ],
634
+ url: '/images/{resourceType}/{imageName}/share/{targetWorkspace}',
635
+ ...options
636
+ });
637
+ };
566
638
  /**
567
639
  * Delete container image tag
568
640
  * Deletes a specific tag from a container image. The underlying image layers are kept if other tags reference them. Will fail if the tag is currently in use.
@@ -5,8 +5,8 @@ import { authentication } from "../authentication/index.js";
5
5
  import { env } from "../common/env.js";
6
6
  import { fs, os, path } from "../common/node.js";
7
7
  // Build info - these placeholders are replaced at build time by build:replace-imports
8
- const BUILD_VERSION = "0.2.79";
9
- const BUILD_COMMIT = "5fb1f8667d2d0bc7b45ca640257677c647eb5e59";
8
+ const BUILD_VERSION = "0.2.80-preview.135";
9
+ const BUILD_COMMIT = "2f1b913a3fcc0bd3bc761b772bc156ef5a1feda6";
10
10
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
11
11
  // Cache for config.yaml tracking value
12
12
  let configTrackingValue = null;
@@ -68,6 +68,58 @@ export const getCodegenRerankingByPath = (options) => {
68
68
  ...options
69
69
  });
70
70
  };
71
+ /**
72
+ * List currently mounted drives
73
+ * Returns a list of all currently mounted drives managed by blfs
74
+ */
75
+ export const getDrivesMount = (options) => {
76
+ return (options?.client ?? _heyApiClient).get({
77
+ security: [
78
+ {
79
+ scheme: 'bearer',
80
+ type: 'http'
81
+ }
82
+ ],
83
+ url: '/drives/mount',
84
+ ...options
85
+ });
86
+ };
87
+ /**
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
90
+ */
91
+ export const postDrivesMount = (options) => {
92
+ return (options.client ?? _heyApiClient).post({
93
+ security: [
94
+ {
95
+ scheme: 'bearer',
96
+ type: 'http'
97
+ }
98
+ ],
99
+ url: '/drives/mount',
100
+ ...options,
101
+ headers: {
102
+ 'Content-Type': 'application/json',
103
+ ...options?.headers
104
+ }
105
+ });
106
+ };
107
+ /**
108
+ * Detach a drive from a local path
109
+ * Unmounts a previously mounted drive from the specified local path
110
+ */
111
+ export const deleteDrivesMountByMountPath = (options) => {
112
+ return (options.client ?? _heyApiClient).delete({
113
+ security: [
114
+ {
115
+ scheme: 'bearer',
116
+ type: 'http'
117
+ }
118
+ ],
119
+ url: '/drives/mount/{mountPath}',
120
+ ...options
121
+ });
122
+ };
71
123
  /**
72
124
  * Search for text content in files
73
125
  * Searches for text content inside files using ripgrep. Returns matching lines with context.
@@ -1,5 +1,5 @@
1
- import { settings } from "../../common/settings.js";
2
1
  import { SandboxAction } from "../action.js";
2
+ import { postDrivesMount, deleteDrivesMountByMountPath, getDrivesMount, } from "../client/index.js";
3
3
  export class SandboxDrive extends SandboxAction {
4
4
  constructor(sandbox) {
5
5
  super(sandbox);
@@ -8,68 +8,39 @@ export class SandboxDrive extends SandboxAction {
8
8
  * Mount a drive to the sandbox at a specific mount path
9
9
  */
10
10
  async mount(request) {
11
- const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings.headers;
12
- const body = {
13
- driveName: request.driveName,
14
- mountPath: request.mountPath,
15
- drivePath: request.drivePath || "/",
16
- };
17
- const response = await this.h2Fetch(`${this.url}/drives/mount`, {
18
- method: 'POST',
19
- headers: {
20
- ...headers,
21
- 'Content-Type': 'application/json',
22
- },
23
- body: JSON.stringify(body),
11
+ const { response, data, error } = await postDrivesMount({
12
+ baseUrl: this.url,
13
+ client: this.client,
14
+ body: request,
24
15
  });
25
- if (!response.ok) {
26
- const errorText = await response.text();
27
- throw new Error(`Failed to mount drive: ${errorText}`);
28
- }
29
- return await response.json();
16
+ this.handleResponseError(response, data, error);
17
+ return data;
30
18
  }
31
19
  /**
32
20
  * Unmount a drive from the sandbox by mount path
33
21
  */
34
22
  async unmount(mountPath) {
35
- const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings.headers;
36
- // Ensure mountPath starts with /
37
- const normalizedPath = mountPath.startsWith('/') ? mountPath : `/${mountPath}`;
38
- // Remove leading slash for URL (DELETE /drives/mnt/test not /drives//mnt/test)
39
- const urlPath = normalizedPath.substring(1);
40
- const response = await this.h2Fetch(`${this.url}/drives/mount/${urlPath}`, {
41
- method: 'DELETE',
42
- headers,
23
+ // Strip leading slash for the path parameter since the URL template
24
+ // already includes the slash: /drives/mount/{mountPath}
25
+ const paramPath = mountPath.startsWith("/") ? mountPath.substring(1) : mountPath;
26
+ const { response, data, error } = await deleteDrivesMountByMountPath({
27
+ baseUrl: this.url,
28
+ client: this.client,
29
+ path: { mountPath: paramPath },
43
30
  });
44
- if (!response.ok) {
45
- const errorText = await response.text();
46
- throw new Error(`Failed to unmount drive: ${errorText}`);
47
- }
48
- return await response.json();
31
+ this.handleResponseError(response, data, error);
32
+ return data;
49
33
  }
50
34
  /**
51
35
  * List all mounted drives in the sandbox
52
36
  */
53
37
  async list() {
54
- const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings.headers;
55
- const response = await this.h2Fetch(`${this.url}/drives/mount`, {
56
- method: 'GET',
57
- headers,
38
+ const { response, data, error } = await getDrivesMount({
39
+ baseUrl: this.url,
40
+ client: this.client,
58
41
  });
59
- if (!response.ok) {
60
- const errorText = await response.text();
61
- throw new Error(`Failed to list drives: ${errorText}`);
62
- }
63
- const data = await response.json();
64
- console.log("[drives.list] raw response:", JSON.stringify(data));
65
- // Normalise whichever shape the API returns
66
- const raw = Array.isArray(data)
67
- ? data
68
- : (data?.mounts ?? data?.drives ?? data?.data ?? []);
69
- return raw.map((m) => ({
70
- driveName: m.driveName ?? m.drive_name ?? m.name ?? "",
71
- mountPath: m.mountPath ?? m.mount_path ?? "",
72
- drivePath: m.drivePath ?? m.drive_path ?? "/",
73
- }));
42
+ this.handleResponseError(response, data, error);
43
+ const result = data;
44
+ return result.mounts ?? [];
74
45
  }
75
46
  }
@@ -3,6 +3,9 @@ export {
3
3
  deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, getFilesystemByPath, getNetworkProcessByPidPorts, putCodegenFastapplyByPath, getCodegenRerankingByPath, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, postNetworkProcessByPidMonitor, postProcess, putFilesystemByPath } from "./client/index.js";
4
4
  export * from "./filesystem/index.js";
5
5
  export * from "./codegen/index.js";
6
+ export { SandboxDrive } from "./drive/index.js";
7
+ export * from "./preview.js";
8
+ export * from "./session.js";
6
9
  export * from "./sandbox.js";
7
10
  export * from "./system.js";
8
11
  export * from "./types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.79",
3
+ "version": "0.2.80-preview.135",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",