@blaxel/core 0.2.96-preview.202 → 0.2.96-preview.204

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 (35) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/client/sdk.gen.js +113 -2
  3. package/dist/cjs/common/settings.js +2 -2
  4. package/dist/cjs/sandbox/index.js +1 -0
  5. package/dist/cjs/sandbox/sandbox.js +3 -0
  6. package/dist/cjs/sandbox/schedule.js +91 -0
  7. package/dist/cjs/types/client/sdk.gen.d.ts +31 -1
  8. package/dist/cjs/types/client/types.gen.d.ts +347 -0
  9. package/dist/cjs/types/sandbox/index.d.ts +1 -0
  10. package/dist/cjs/types/sandbox/sandbox.d.ts +2 -0
  11. package/dist/cjs/types/sandbox/schedule.d.ts +16 -0
  12. package/dist/cjs-browser/.tsbuildinfo +1 -1
  13. package/dist/cjs-browser/client/sdk.gen.js +113 -2
  14. package/dist/cjs-browser/common/settings.js +2 -2
  15. package/dist/cjs-browser/sandbox/index.js +1 -0
  16. package/dist/cjs-browser/sandbox/sandbox.js +3 -0
  17. package/dist/cjs-browser/sandbox/schedule.js +91 -0
  18. package/dist/cjs-browser/types/client/sdk.gen.d.ts +31 -1
  19. package/dist/cjs-browser/types/client/types.gen.d.ts +347 -0
  20. package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
  21. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -0
  22. package/dist/cjs-browser/types/sandbox/schedule.d.ts +16 -0
  23. package/dist/esm/.tsbuildinfo +1 -1
  24. package/dist/esm/client/sdk.gen.js +104 -0
  25. package/dist/esm/common/settings.js +2 -2
  26. package/dist/esm/sandbox/index.js +1 -0
  27. package/dist/esm/sandbox/sandbox.js +3 -0
  28. package/dist/esm/sandbox/schedule.js +87 -0
  29. package/dist/esm-browser/.tsbuildinfo +1 -1
  30. package/dist/esm-browser/client/sdk.gen.js +104 -0
  31. package/dist/esm-browser/common/settings.js +2 -2
  32. package/dist/esm-browser/sandbox/index.js +1 -0
  33. package/dist/esm-browser/sandbox/sandbox.js +3 -0
  34. package/dist/esm-browser/sandbox/schedule.js +87 -0
  35. package/package.json +1 -1
@@ -1678,6 +1678,110 @@ export const deleteSandboxPreviewToken = (options) => {
1678
1678
  ...options
1679
1679
  });
1680
1680
  };
1681
+ /**
1682
+ * List Sandbox Schedule Executions
1683
+ * Returns the execution history of a Sandbox's schedules (across all schedules of the sandbox), newest first. Cursor-paginated via the `cursor` and `limit` query parameters. Each item records the HTTP status of submitting the scheduled command and the process name for log lookup.
1684
+ */
1685
+ export const listSandboxScheduleExecutions = (options) => {
1686
+ return (options.client ?? _heyApiClient).get({
1687
+ security: [
1688
+ {
1689
+ scheme: 'bearer',
1690
+ type: 'http'
1691
+ }
1692
+ ],
1693
+ url: '/sandboxes/{sandboxName}/schedule-executions',
1694
+ ...options
1695
+ });
1696
+ };
1697
+ /**
1698
+ * List Sandbox Schedules
1699
+ * Returns the schedules configured on a Sandbox. Starting with API version 2026-04-28 the response is wrapped in `{data, meta}` and supports cursor pagination via the `cursor` and `limit` query parameters; older versions return a bare array.
1700
+ */
1701
+ export const listSandboxSchedules = (options) => {
1702
+ return (options.client ?? _heyApiClient).get({
1703
+ security: [
1704
+ {
1705
+ scheme: 'bearer',
1706
+ type: 'http'
1707
+ }
1708
+ ],
1709
+ url: '/sandboxes/{sandboxName}/schedules',
1710
+ ...options
1711
+ });
1712
+ };
1713
+ /**
1714
+ * Create Sandbox Schedule
1715
+ * Adds a schedule to a Sandbox.
1716
+ */
1717
+ export const createSandboxSchedule = (options) => {
1718
+ return (options.client ?? _heyApiClient).post({
1719
+ security: [
1720
+ {
1721
+ scheme: 'bearer',
1722
+ type: 'http'
1723
+ }
1724
+ ],
1725
+ url: '/sandboxes/{sandboxName}/schedules',
1726
+ ...options,
1727
+ headers: {
1728
+ 'Content-Type': 'application/json',
1729
+ ...options?.headers
1730
+ }
1731
+ });
1732
+ };
1733
+ /**
1734
+ * Delete Sandbox Schedule
1735
+ * Deletes a Sandbox Schedule by id.
1736
+ */
1737
+ export const deleteSandboxSchedule = (options) => {
1738
+ return (options.client ?? _heyApiClient).delete({
1739
+ security: [
1740
+ {
1741
+ scheme: 'bearer',
1742
+ type: 'http'
1743
+ }
1744
+ ],
1745
+ url: '/sandboxes/{sandboxName}/schedules/{scheduleId}',
1746
+ ...options
1747
+ });
1748
+ };
1749
+ /**
1750
+ * Get Sandbox Schedule
1751
+ * Returns a Sandbox Schedule by id.
1752
+ */
1753
+ export const getSandboxSchedule = (options) => {
1754
+ return (options.client ?? _heyApiClient).get({
1755
+ security: [
1756
+ {
1757
+ scheme: 'bearer',
1758
+ type: 'http'
1759
+ }
1760
+ ],
1761
+ url: '/sandboxes/{sandboxName}/schedules/{scheduleId}',
1762
+ ...options
1763
+ });
1764
+ };
1765
+ /**
1766
+ * Update Sandbox Schedule
1767
+ * Updates a Sandbox Schedule by id.
1768
+ */
1769
+ export const updateSandboxSchedule = (options) => {
1770
+ return (options.client ?? _heyApiClient).put({
1771
+ security: [
1772
+ {
1773
+ scheme: 'bearer',
1774
+ type: 'http'
1775
+ }
1776
+ ],
1777
+ url: '/sandboxes/{sandboxName}/schedules/{scheduleId}',
1778
+ ...options,
1779
+ headers: {
1780
+ 'Content-Type': 'application/json',
1781
+ ...options?.headers
1782
+ }
1783
+ });
1784
+ };
1681
1785
  /**
1682
1786
  * Get sandbox by external ID
1683
1787
  * Returns the most recent non-terminated sandbox matching the given external ID. If no active sandbox is found, returns 404.
@@ -22,8 +22,8 @@ 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.96-preview.202";
26
- const BUILD_COMMIT = "015ed9018faffe130a42a6a8ca5b876ec2b363da";
25
+ const BUILD_VERSION = "0.2.96-preview.204";
26
+ const BUILD_COMMIT = "05c335edad327feae5ecd407b96b385a7662a701";
27
27
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
28
28
  const BLAXEL_API_VERSION = "2026-04-16";
29
29
  // Cache for config.yaml tracking value
@@ -5,6 +5,7 @@ export * from "./filesystem/index.js";
5
5
  export * from "./codegen/index.js";
6
6
  export { SandboxDrive } from "./drive/index.js";
7
7
  export * from "./preview.js";
8
+ export * from "./schedule.js";
8
9
  export * from "./session.js";
9
10
  export * from "./sandbox.js";
10
11
  export * from "./system.js";
@@ -8,6 +8,7 @@ import { SandboxFileSystem } from "./filesystem/index.js";
8
8
  import { SandboxNetwork } from "./network/index.js";
9
9
  import { SandboxPreviews } from "./preview.js";
10
10
  import { SandboxProcess } from "./process/index.js";
11
+ import { SandboxSchedules } from "./schedule.js";
11
12
  import { SandboxSessions } from "./session.js";
12
13
  import { SandboxSystem } from "./system.js";
13
14
  import { normalizeEnvs, normalizePorts, normalizeVolumes } from "./types.js";
@@ -41,6 +42,7 @@ export class SandboxInstance {
41
42
  network;
42
43
  process;
43
44
  previews;
45
+ schedules;
44
46
  sessions;
45
47
  codegen;
46
48
  system;
@@ -52,6 +54,7 @@ export class SandboxInstance {
52
54
  this.fs = new SandboxFileSystem(sandbox, this.process);
53
55
  this.network = new SandboxNetwork(sandbox);
54
56
  this.previews = new SandboxPreviews(sandbox);
57
+ this.schedules = new SandboxSchedules(sandbox);
55
58
  this.sessions = new SandboxSessions(sandbox);
56
59
  this.codegen = new SandboxCodegen(sandbox);
57
60
  this.system = new SandboxSystem(sandbox);
@@ -0,0 +1,87 @@
1
+ import { createSandboxSchedule, deleteSandboxSchedule, getSandboxSchedule, listSandboxScheduleExecutions, listSandboxSchedules, updateSandboxSchedule } from "../client/index.js";
2
+ // Schedule list endpoints return a bare array on older API versions and a
3
+ // cursor-paginated `{ data, meta }` envelope starting on Blaxel-Version
4
+ // 2026-04-28. Handle both so the wrapper works regardless of the SDK's default
5
+ // version.
6
+ function unwrapPage(data) {
7
+ if (Array.isArray(data))
8
+ return data;
9
+ return data?.data ?? [];
10
+ }
11
+ // SandboxSchedules manages a sandbox's schedules. A schedule entry is a flat
12
+ // record (id/type/value/input) with no sub-resource of its own, so methods
13
+ // return the raw SandboxScheduleEntry rather than a wrapper class (the generated
14
+ // `SandboxSchedule` type is the array form `SandboxScheduleEntry[]`).
15
+ export class SandboxSchedules {
16
+ sandbox;
17
+ constructor(sandbox) {
18
+ this.sandbox = sandbox;
19
+ }
20
+ get sandboxName() {
21
+ return this.sandbox.metadata.name;
22
+ }
23
+ async list(options = {}) {
24
+ const { data } = await listSandboxSchedules({
25
+ path: {
26
+ sandboxName: this.sandboxName,
27
+ },
28
+ query: options,
29
+ throwOnError: true,
30
+ });
31
+ return unwrapPage(data);
32
+ }
33
+ async create(schedule) {
34
+ const { data } = await createSandboxSchedule({
35
+ path: {
36
+ sandboxName: this.sandboxName,
37
+ },
38
+ body: schedule,
39
+ throwOnError: true,
40
+ });
41
+ return data;
42
+ }
43
+ async get(scheduleId) {
44
+ const { data } = await getSandboxSchedule({
45
+ path: {
46
+ sandboxName: this.sandboxName,
47
+ scheduleId,
48
+ },
49
+ throwOnError: true,
50
+ });
51
+ return data;
52
+ }
53
+ async update(scheduleId, schedule) {
54
+ const { data } = await updateSandboxSchedule({
55
+ path: {
56
+ sandboxName: this.sandboxName,
57
+ scheduleId,
58
+ },
59
+ body: schedule,
60
+ throwOnError: true,
61
+ });
62
+ return data;
63
+ }
64
+ async delete(scheduleId) {
65
+ const { data } = await deleteSandboxSchedule({
66
+ path: {
67
+ sandboxName: this.sandboxName,
68
+ scheduleId,
69
+ },
70
+ throwOnError: true,
71
+ });
72
+ return data;
73
+ }
74
+ // List the execution history of every schedule on the sandbox, newest first.
75
+ // Executions are sandbox-scoped, not per-schedule; filter by `scheduleId` on
76
+ // the returned records to isolate a single schedule's runs.
77
+ async executions(options = {}) {
78
+ const { data } = await listSandboxScheduleExecutions({
79
+ path: {
80
+ sandboxName: this.sandboxName,
81
+ },
82
+ query: options,
83
+ throwOnError: true,
84
+ });
85
+ return unwrapPage(data);
86
+ }
87
+ }