@blaxel/core 0.3.13 → 0.3.18-preview.281

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 (39) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/client/sdk.gen.js +105 -3
  3. package/dist/cjs/common/settings.js +2 -2
  4. package/dist/cjs/common/shell.js +18 -0
  5. package/dist/cjs/sandbox/filesystem/filesystem.js +31 -11
  6. package/dist/cjs/sandbox/filesystem/filesystem.test.js +207 -2
  7. package/dist/cjs/sandbox/sandbox.js +124 -0
  8. package/dist/cjs/types/client/sdk.gen.d.ts +31 -1
  9. package/dist/cjs/types/client/types.gen.d.ts +368 -7
  10. package/dist/cjs/types/common/shell.d.ts +13 -0
  11. package/dist/cjs/types/sandbox/sandbox.d.ts +56 -1
  12. package/dist/cjs/types/sandbox/schedule.d.ts +2 -2
  13. package/dist/cjs-browser/.tsbuildinfo +1 -1
  14. package/dist/cjs-browser/client/sdk.gen.js +105 -3
  15. package/dist/cjs-browser/common/settings.js +2 -2
  16. package/dist/cjs-browser/common/shell.js +18 -0
  17. package/dist/cjs-browser/sandbox/filesystem/filesystem.js +31 -11
  18. package/dist/cjs-browser/sandbox/filesystem/filesystem.test.js +207 -2
  19. package/dist/cjs-browser/sandbox/sandbox.js +124 -0
  20. package/dist/cjs-browser/types/client/sdk.gen.d.ts +31 -1
  21. package/dist/cjs-browser/types/client/types.gen.d.ts +368 -7
  22. package/dist/cjs-browser/types/common/shell.d.ts +13 -0
  23. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +56 -1
  24. package/dist/cjs-browser/types/sandbox/schedule.d.ts +2 -2
  25. package/dist/esm/.tsbuildinfo +1 -1
  26. package/dist/esm/client/sdk.gen.js +96 -0
  27. package/dist/esm/common/settings.js +2 -2
  28. package/dist/esm/common/shell.js +15 -0
  29. package/dist/esm/sandbox/filesystem/filesystem.js +31 -11
  30. package/dist/esm/sandbox/filesystem/filesystem.test.js +208 -3
  31. package/dist/esm/sandbox/sandbox.js +125 -1
  32. package/dist/esm-browser/.tsbuildinfo +1 -1
  33. package/dist/esm-browser/client/sdk.gen.js +96 -0
  34. package/dist/esm-browser/common/settings.js +2 -2
  35. package/dist/esm-browser/common/shell.js +15 -0
  36. package/dist/esm-browser/sandbox/filesystem/filesystem.js +31 -11
  37. package/dist/esm-browser/sandbox/filesystem/filesystem.test.js +208 -3
  38. package/dist/esm-browser/sandbox/sandbox.js +125 -1
  39. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
2
- import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, GetSandboxByExternalIdData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
2
+ import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ArchiveSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, RestoreSandboxSnapshotData, UnarchiveSandboxData, GetSandboxByExternalIdData, ListScheduleExecutionsData, ListSchedulesData, GetSandboxScheduleMetricsData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -516,6 +516,11 @@ export declare const getSandbox: <ThrowOnError extends boolean = false>(options:
516
516
  * Updates a sandbox's configuration. Note that certain changes (like image or memory) may reset the sandbox state. Use lifecycle policies to control automatic cleanup.
517
517
  */
518
518
  export declare const updateSandbox: <ThrowOnError extends boolean = false>(options: Options<UpdateSandboxData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Sandbox, import("./types.gen.js")._Error, ThrowOnError>;
519
+ /**
520
+ * Archive sandbox
521
+ * Archives a sandbox. The changes its filesystem accumulated over its image are exported to the archive store, then the sandbox is shut down while its definition is kept, so it can be recreated later with the same disk. Memory and running processes are not preserved, processes are started again from their configuration when the sandbox is unarchived.
522
+ */
523
+ export declare const archiveSandbox: <ThrowOnError extends boolean = false>(options: Options<ArchiveSandboxData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Sandbox, import("./types.gen.js")._Error, ThrowOnError>;
519
524
  /**
520
525
  * Fork sandbox
521
526
  * Forks a sandbox into a new sandbox or application. When forking to a sandbox, the target must not already exist (409 if it does). When forking to an application, a new revision is added if the app already exists, or a new application is created. This is a WIP endpoint — the full implementation depends on the execution plane.
@@ -608,11 +613,36 @@ export declare const createSandboxSnapshot: <ThrowOnError extends boolean = fals
608
613
  * Deletes a snapshot of a sandbox by its ID.
609
614
  */
610
615
  export declare const deleteSandboxSnapshot: <ThrowOnError extends boolean = false>(options: Options<DeleteSandboxSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, import("./types.gen.js")._Error, ThrowOnError>;
616
+ /**
617
+ * Restore sandbox from snapshot
618
+ * Restores a sandbox to one of its own snapshots. The running sandbox is torn down and rebuilt from the snapshot under the same name and URLs, so everything it held since the snapshot was taken is lost unless it was itself snapshotted.
619
+ */
620
+ export declare const restoreSandboxSnapshot: <ThrowOnError extends boolean = false>(options: Options<RestoreSandboxSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxRestoreResponse, import("./types.gen.js")._Error, ThrowOnError>;
621
+ /**
622
+ * Unarchive sandbox
623
+ * Recreates an archived sandbox from its archive. The recreated sandbox runs the current generation whatever generation it was archived from, restores the archived filesystem before anything starts, and starts the saved processes again with new process identifiers.
624
+ */
625
+ export declare const unarchiveSandbox: <ThrowOnError extends boolean = false>(options: Options<UnarchiveSandboxData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Sandbox, import("./types.gen.js")._Error, ThrowOnError>;
611
626
  /**
612
627
  * Get sandbox by external ID
613
628
  * Returns the most recent non-terminated sandbox matching the given external ID. If no active sandbox is found, returns 404.
614
629
  */
615
630
  export declare const getSandboxByExternalId: <ThrowOnError extends boolean = false>(options: Options<GetSandboxByExternalIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Sandbox, import("./types.gen.js")._Error, ThrowOnError>;
631
+ /**
632
+ * List Workspace Schedule Executions
633
+ * Returns schedule execution submissions across the workspace, newest first by default. Status describes submission acceptance, not process completion. since and until are inclusive RFC 3339 bounds on creation time.
634
+ */
635
+ export declare const listScheduleExecutions: <ThrowOnError extends boolean = false>(options?: Options<ListScheduleExecutionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxScheduleExecutionList, unknown, ThrowOnError>;
636
+ /**
637
+ * List Workspace Schedules
638
+ * Returns schedule definitions across the workspace, newest first by default.
639
+ */
640
+ export declare const listSchedules: <ThrowOnError extends boolean = false>(options?: Options<ListSchedulesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxScheduleEntryList, unknown, ThrowOnError>;
641
+ /**
642
+ * Get Sandbox Scheduling Metrics
643
+ * Returns active sandbox and scheduling metrics for a UTC minute window. since is inclusive and until is exclusive. The default window is the last 24 hours and the maximum is 7 days. Execution status describes submission acceptance, not process completion. Execution totals begin accumulating when metrics collection is enabled and can lag recent firings briefly.
644
+ */
645
+ export declare const getSandboxScheduleMetrics: <ThrowOnError extends boolean = false>(options?: Options<GetSandboxScheduleMetricsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxScheduleMetrics, unknown, ThrowOnError>;
616
646
  /**
617
647
  * List service accounts
618
648
  * Returns all service accounts in the workspace. Service accounts are machine identities for external systems to authenticate with Blaxel via OAuth or API keys.
@@ -3494,6 +3494,7 @@ export type SsoDomainSpecWritable = {
3494
3494
  * Lightweight virtual machine for secure AI code execution. Sandboxes resume from standby in under 25ms and automatically scale to zero after inactivity, preserving memory state including running processes and filesystem.
3495
3495
  */
3496
3496
  export type Sandbox = {
3497
+ archive?: SandboxArchive;
3497
3498
  /**
3498
3499
  * Infrastructure failures recorded on the sandbox, oldest first (read-only, managed by the system)
3499
3500
  */
@@ -3523,6 +3524,7 @@ export type Sandbox = {
3523
3524
  * Lightweight virtual machine for secure AI code execution. Sandboxes resume from standby in under 25ms and automatically scale to zero after inactivity, preserving memory state including running processes and filesystem.
3524
3525
  */
3525
3526
  export type SandboxWritable = {
3527
+ archive?: SandboxArchiveWritable;
3526
3528
  events?: CoreEventsWritable;
3527
3529
  metadata: MetadataWritable;
3528
3530
  spec: SandboxSpec;
@@ -3532,6 +3534,72 @@ export type SandboxWritable = {
3532
3534
  state?: 'RUNNING' | 'STANDBY';
3533
3535
  status?: Status;
3534
3536
  };
3537
+ /**
3538
+ * State of the filesystem archive of a sandbox. An archive holds the writable filesystem changes and the process configurations of the sandbox, not its memory, so restoring it produces a sandbox with the same disk state and freshly started processes.
3539
+ */
3540
+ export type SandboxArchive = {
3541
+ /**
3542
+ * When the archive was created (read-only)
3543
+ */
3544
+ readonly createdAt?: string;
3545
+ /**
3546
+ * Infrastructure generation the archive was taken from (read-only)
3547
+ */
3548
+ readonly generation?: string;
3549
+ /**
3550
+ * Storage key of the archive (read-only)
3551
+ */
3552
+ readonly key?: string;
3553
+ restore?: SandboxArchiveRestore;
3554
+ /**
3555
+ * When the restore of the archive started, while the sandbox is being unarchived (read-only)
3556
+ */
3557
+ readonly restoreStartedAt?: string;
3558
+ /**
3559
+ * Size of the archive in bytes (read-only)
3560
+ */
3561
+ readonly size?: number;
3562
+ /**
3563
+ * When the archive was started, while the filesystem of the sandbox is still being uploaded (read-only)
3564
+ */
3565
+ readonly startedAt?: string;
3566
+ };
3567
+ /**
3568
+ * State of the filesystem archive of a sandbox. An archive holds the writable filesystem changes and the process configurations of the sandbox, not its memory, so restoring it produces a sandbox with the same disk state and freshly started processes.
3569
+ */
3570
+ export type SandboxArchiveWritable = {
3571
+ restore?: SandboxArchiveRestoreWritable;
3572
+ };
3573
+ /**
3574
+ * Progress of the restore of a sandbox archive. A restore writes the archived filesystem over the image the sandbox booted from, which takes as long as the archive is big; the sandbox answers and its terminal is reachable throughout, but nothing may write to its filesystem until the restore is done.
3575
+ */
3576
+ export type SandboxArchiveRestore = {
3577
+ /**
3578
+ * Number of files restored so far (read-only)
3579
+ */
3580
+ readonly files?: number;
3581
+ /**
3582
+ * Bytes of the archive restored so far (read-only)
3583
+ */
3584
+ readonly restoredBytes?: number;
3585
+ /**
3586
+ * Phase of the restore (read-only)
3587
+ */
3588
+ state?: 'downloading' | 'extracting' | 'relaunching' | 'succeeded' | 'failed';
3589
+ /**
3590
+ * Total size of the archive being restored in bytes, absent when the store did not announce it (read-only)
3591
+ */
3592
+ readonly totalBytes?: number;
3593
+ };
3594
+ /**
3595
+ * Progress of the restore of a sandbox archive. A restore writes the archived filesystem over the image the sandbox booted from, which takes as long as the archive is big; the sandbox answers and its terminal is reachable throughout, but nothing may write to its filesystem until the restore is done.
3596
+ */
3597
+ export type SandboxArchiveRestoreWritable = {
3598
+ /**
3599
+ * Phase of the restore (read-only)
3600
+ */
3601
+ state?: 'downloading' | 'extracting' | 'relaunching' | 'succeeded' | 'failed';
3602
+ };
3535
3603
  /**
3536
3604
  * Pre-configured sandbox template available in the Sandbox Hub for quick deployment with predefined tools and configurations
3537
3605
  */
@@ -3759,6 +3827,19 @@ export type SandboxNetwork = {
3759
3827
  */
3760
3828
  subnet?: string;
3761
3829
  };
3830
+ /**
3831
+ * Result of restoring a sandbox to one of its snapshots. The sandbox keeps its name and URLs; everything it held since the snapshot was taken is gone.
3832
+ */
3833
+ export type SandboxRestoreResponse = {
3834
+ /**
3835
+ * Name of the restored sandbox
3836
+ */
3837
+ name: string;
3838
+ /**
3839
+ * Snapshot the sandbox was restored from
3840
+ */
3841
+ snapshotId: string;
3842
+ };
3762
3843
  /**
3763
3844
  * Runtime configuration defining how the sandbox VM is provisioned and its resource limits
3764
3845
  */
@@ -3812,6 +3893,10 @@ export type SandboxScheduleEntry = {
3812
3893
  * Maximum number of execution records kept for this schedule. Once reached, recording a new execution deletes the oldest. Defaults to 100.
3813
3894
  */
3814
3895
  maxExecutions?: number;
3896
+ /**
3897
+ * Name of the sandbox this schedule belongs to.
3898
+ */
3899
+ readonly sandbox?: string;
3815
3900
  /**
3816
3901
  * Type of schedule timing. 'cron' for recurring (5-field expression), 'at' for a specific RFC 3339 datetime, 'sleep' for a duration from now (resolved to 'at' on creation).
3817
3902
  */
@@ -3864,7 +3949,7 @@ export type SandboxScheduleEntryListWritable = {
3864
3949
  meta?: PaginationMeta;
3865
3950
  };
3866
3951
  /**
3867
- * One recorded execution of a sandbox schedule. statusCode is the HTTP status from submitting the command to the sandbox (the scheduler does not wait for the command to finish). Stored in the dedicated scheduleexecutions table.
3952
+ * One recorded execution of a sandbox schedule. status and statusCode describe whether the scheduler's process submission was accepted; the scheduler does not wait for the process to finish. Stored in the dedicated scheduleexecutions table.
3868
3953
  */
3869
3954
  export type SandboxScheduleExecution = {
3870
3955
  /**
@@ -3887,10 +3972,18 @@ export type SandboxScheduleExecution = {
3887
3972
  * Name of the process started in the sandbox for this execution, used to look up its logs.
3888
3973
  */
3889
3974
  processName?: string;
3975
+ /**
3976
+ * Name of the sandbox this execution belongs to.
3977
+ */
3978
+ readonly sandbox?: string;
3890
3979
  /**
3891
3980
  * Id of the schedule this execution belongs to.
3892
3981
  */
3893
3982
  scheduleId?: string;
3983
+ /**
3984
+ * Whether submitting the process request was accepted. This is not the process completion status.
3985
+ */
3986
+ status?: 'succeeded' | 'failed';
3894
3987
  /**
3895
3988
  * HTTP status code returned when the scheduled command was submitted to the sandbox (0 if the sandbox could not be reached). 2xx/3xx means the command was accepted.
3896
3989
  */
@@ -3901,7 +3994,7 @@ export type SandboxScheduleExecution = {
3901
3994
  timeout?: number;
3902
3995
  };
3903
3996
  /**
3904
- * One recorded execution of a sandbox schedule. statusCode is the HTTP status from submitting the command to the sandbox (the scheduler does not wait for the command to finish). Stored in the dedicated scheduleexecutions table.
3997
+ * One recorded execution of a sandbox schedule. status and statusCode describe whether the scheduler's process submission was accepted; the scheduler does not wait for the process to finish. Stored in the dedicated scheduleexecutions table.
3905
3998
  */
3906
3999
  export type SandboxScheduleExecutionWritable = {
3907
4000
  /**
@@ -3924,6 +4017,10 @@ export type SandboxScheduleExecutionWritable = {
3924
4017
  * Id of the schedule this execution belongs to.
3925
4018
  */
3926
4019
  scheduleId?: string;
4020
+ /**
4021
+ * Whether submitting the process request was accepted. This is not the process completion status.
4022
+ */
4023
+ status?: 'succeeded' | 'failed';
3927
4024
  /**
3928
4025
  * HTTP status code returned when the scheduled command was submitted to the sandbox (0 if the sandbox could not be reached). 2xx/3xx means the command was accepted.
3929
4026
  */
@@ -3953,6 +4050,19 @@ export type SandboxScheduleExecutionListWritable = {
3953
4050
  data?: Array<SandboxScheduleExecutionWritable>;
3954
4051
  meta?: PaginationMeta;
3955
4052
  };
4053
+ /**
4054
+ * Schedule execution counts grouped by submission acceptance status.
4055
+ */
4056
+ export type SandboxScheduleExecutionStatusMetrics = {
4057
+ /**
4058
+ * Number of process submissions that were not accepted.
4059
+ */
4060
+ failed?: number;
4061
+ /**
4062
+ * Number of process submissions accepted by the sandbox.
4063
+ */
4064
+ succeeded?: number;
4065
+ };
3956
4066
  /**
3957
4067
  * Process execution configuration for a scheduled sandbox task
3958
4068
  */
@@ -3984,6 +4094,32 @@ export type SandboxScheduleInput = {
3984
4094
  */
3985
4095
  workingDir?: string;
3986
4096
  };
4097
+ /**
4098
+ * Workspace sandbox scheduling metrics for a UTC minute window. since is inclusive and until is exclusive.
4099
+ */
4100
+ export type SandboxScheduleMetrics = {
4101
+ /**
4102
+ * Number of schedule execution submissions in the selected window.
4103
+ */
4104
+ executions?: number;
4105
+ executionsByStatus?: SandboxScheduleExecutionStatusMetrics;
4106
+ /**
4107
+ * Number of active sandboxes in the workspace.
4108
+ */
4109
+ sandboxes?: number;
4110
+ /**
4111
+ * Number of schedules in the workspace.
4112
+ */
4113
+ schedules?: number;
4114
+ /**
4115
+ * Inclusive beginning of the metrics window, normalized to a UTC minute.
4116
+ */
4117
+ since?: string;
4118
+ /**
4119
+ * Exclusive end of the metrics window, normalized to a UTC minute.
4120
+ */
4121
+ until?: string;
4122
+ };
3987
4123
  /**
3988
4124
  * A point-in-time snapshot of a sandbox that can be used for forking into a new sandbox or application.
3989
4125
  */
@@ -4051,7 +4187,7 @@ export type SandboxSpec = {
4051
4187
  /**
4052
4188
  * Deployment status of a resource deployed on Blaxel
4053
4189
  */
4054
- export type Status = 'DELETING' | 'TERMINATED' | 'FAILED' | 'DEACTIVATED' | 'DEACTIVATING' | 'UPLOADING' | 'BUILDING' | 'DEPLOYING' | 'DEPLOYED' | 'BUILT';
4190
+ export type Status = 'DELETING' | 'TERMINATED' | 'FAILED' | 'DEACTIVATED' | 'DEACTIVATING' | 'UPLOADING' | 'BUILDING' | 'DEPLOYING' | 'DEPLOYED' | 'BUILT' | 'ARCHIVING' | 'ARCHIVED' | 'UNARCHIVING';
4055
4191
  /**
4056
4192
  * Blaxel template
4057
4193
  */
@@ -7582,6 +7718,47 @@ export type UpdateSandboxResponses = {
7582
7718
  200: Sandbox;
7583
7719
  };
7584
7720
  export type UpdateSandboxResponse = UpdateSandboxResponses[keyof UpdateSandboxResponses];
7721
+ export type ArchiveSandboxData = {
7722
+ body?: never;
7723
+ path: {
7724
+ /**
7725
+ * Name of the sandbox to archive
7726
+ */
7727
+ sandboxName: string;
7728
+ };
7729
+ query?: never;
7730
+ url: '/sandboxes/{sandboxName}/archive';
7731
+ };
7732
+ export type ArchiveSandboxErrors = {
7733
+ /**
7734
+ * Unauthorized - Invalid or missing authentication credentials
7735
+ */
7736
+ 401: _Error;
7737
+ /**
7738
+ * Forbidden - Insufficient permissions to archive this sandbox
7739
+ */
7740
+ 403: _Error;
7741
+ /**
7742
+ * Not found - Sandbox does not exist
7743
+ */
7744
+ 404: _Error;
7745
+ /**
7746
+ * Conflict - The sandbox is already archived or is not running
7747
+ */
7748
+ 409: _Error;
7749
+ /**
7750
+ * Internal server error
7751
+ */
7752
+ 500: _Error;
7753
+ };
7754
+ export type ArchiveSandboxError = ArchiveSandboxErrors[keyof ArchiveSandboxErrors];
7755
+ export type ArchiveSandboxResponses = {
7756
+ /**
7757
+ * Sandbox archived successfully
7758
+ */
7759
+ 200: Sandbox;
7760
+ };
7761
+ export type ArchiveSandboxResponse = ArchiveSandboxResponses[keyof ArchiveSandboxResponses];
7585
7762
  export type ForkSandboxData = {
7586
7763
  body: SandboxForkRequest;
7587
7764
  path: {
@@ -7819,9 +7996,9 @@ export type ListSandboxScheduleExecutionsData = {
7819
7996
  */
7820
7997
  cursor?: string;
7821
7998
  /**
7822
- * Sort spec, formatted as `<key>:<direction>`. Allowed values are `createdAt:desc` (default), `createdAt:asc`, `name:asc`, `name:desc`. The cursor fingerprint is bound to the sort, so a cursor opened with one value cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
7999
+ * Sort by creation time. Defaults to newest first.
7823
8000
  */
7824
- sort?: 'createdAt:desc' | 'createdAt:asc' | 'name:asc' | 'name:desc';
8001
+ sort?: 'createdAt:desc' | 'createdAt:asc';
7825
8002
  /**
7826
8003
  * Substring search across `metadata.name`, `metadata.displayName` and labels (keys + values). Trimmed and lowercased server-side; queries shorter than 2 characters fall back to the unfiltered listing. Bound into the cursor fingerprint so a cursor opened with one query cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
7827
8004
  */
@@ -7854,9 +8031,9 @@ export type ListSandboxSchedulesData = {
7854
8031
  */
7855
8032
  cursor?: string;
7856
8033
  /**
7857
- * Sort spec, formatted as `<key>:<direction>`. Allowed values are `createdAt:desc` (default), `createdAt:asc`, `name:asc`, `name:desc`. The cursor fingerprint is bound to the sort, so a cursor opened with one value cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
8034
+ * Sort by creation time. Defaults to newest first.
7858
8035
  */
7859
- sort?: 'createdAt:desc' | 'createdAt:asc' | 'name:asc' | 'name:desc';
8036
+ sort?: 'createdAt:desc' | 'createdAt:asc';
7860
8037
  /**
7861
8038
  * Substring search across `metadata.name`, `metadata.displayName` and labels (keys + values). Trimmed and lowercased server-side; queries shorter than 2 characters fall back to the unfiltered listing. Bound into the cursor fingerprint so a cursor opened with one query cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
7862
8039
  */
@@ -8046,6 +8223,80 @@ export type DeleteSandboxSnapshotResponses = {
8046
8223
  204: void;
8047
8224
  };
8048
8225
  export type DeleteSandboxSnapshotResponse = DeleteSandboxSnapshotResponses[keyof DeleteSandboxSnapshotResponses];
8226
+ export type RestoreSandboxSnapshotData = {
8227
+ body?: never;
8228
+ path: {
8229
+ /**
8230
+ * Name of the sandbox to restore
8231
+ */
8232
+ sandboxName: string;
8233
+ /**
8234
+ * ID of the snapshot to restore the sandbox to
8235
+ */
8236
+ snapshotId: string;
8237
+ };
8238
+ query?: never;
8239
+ url: '/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore';
8240
+ };
8241
+ export type RestoreSandboxSnapshotErrors = {
8242
+ /**
8243
+ * Not found - Sandbox or snapshot does not exist
8244
+ */
8245
+ 404: _Error;
8246
+ /**
8247
+ * Internal server error
8248
+ */
8249
+ 500: _Error;
8250
+ };
8251
+ export type RestoreSandboxSnapshotError = RestoreSandboxSnapshotErrors[keyof RestoreSandboxSnapshotErrors];
8252
+ export type RestoreSandboxSnapshotResponses = {
8253
+ /**
8254
+ * Sandbox restored successfully
8255
+ */
8256
+ 200: SandboxRestoreResponse;
8257
+ };
8258
+ export type RestoreSandboxSnapshotResponse = RestoreSandboxSnapshotResponses[keyof RestoreSandboxSnapshotResponses];
8259
+ export type UnarchiveSandboxData = {
8260
+ body?: never;
8261
+ path: {
8262
+ /**
8263
+ * Name of the sandbox to unarchive
8264
+ */
8265
+ sandboxName: string;
8266
+ };
8267
+ query?: never;
8268
+ url: '/sandboxes/{sandboxName}/unarchive';
8269
+ };
8270
+ export type UnarchiveSandboxErrors = {
8271
+ /**
8272
+ * Unauthorized - Invalid or missing authentication credentials
8273
+ */
8274
+ 401: _Error;
8275
+ /**
8276
+ * Forbidden - Insufficient permissions to unarchive this sandbox
8277
+ */
8278
+ 403: _Error;
8279
+ /**
8280
+ * Not found - Sandbox does not exist
8281
+ */
8282
+ 404: _Error;
8283
+ /**
8284
+ * Conflict - The sandbox is not archived
8285
+ */
8286
+ 409: _Error;
8287
+ /**
8288
+ * Internal server error
8289
+ */
8290
+ 500: _Error;
8291
+ };
8292
+ export type UnarchiveSandboxError = UnarchiveSandboxErrors[keyof UnarchiveSandboxErrors];
8293
+ export type UnarchiveSandboxResponses = {
8294
+ /**
8295
+ * Sandbox recreated successfully
8296
+ */
8297
+ 200: Sandbox;
8298
+ };
8299
+ export type UnarchiveSandboxResponse = UnarchiveSandboxResponses[keyof UnarchiveSandboxResponses];
8049
8300
  export type GetSandboxByExternalIdData = {
8050
8301
  body?: never;
8051
8302
  path: {
@@ -8083,6 +8334,116 @@ export type GetSandboxByExternalIdResponses = {
8083
8334
  200: Sandbox;
8084
8335
  };
8085
8336
  export type GetSandboxByExternalIdResponse = GetSandboxByExternalIdResponses[keyof GetSandboxByExternalIdResponses];
8337
+ export type ListScheduleExecutionsData = {
8338
+ body?: never;
8339
+ path?: never;
8340
+ query?: {
8341
+ /**
8342
+ * Number of items per page
8343
+ */
8344
+ limit?: number;
8345
+ /**
8346
+ * Opaque cursor returned by a previous response's meta.nextCursor. Only valid for the same query (workspace + filters); the server rejects cursors bound to a different query or older than 24h. Omit on the first page.
8347
+ */
8348
+ cursor?: string;
8349
+ /**
8350
+ * Sort by creation time. Defaults to newest first.
8351
+ */
8352
+ sort?: 'createdAt:desc' | 'createdAt:asc';
8353
+ /**
8354
+ * Substring search across `metadata.name`, `metadata.displayName` and labels (keys + values). Trimmed and lowercased server-side; queries shorter than 2 characters fall back to the unfiltered listing. Bound into the cursor fingerprint so a cursor opened with one query cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
8355
+ */
8356
+ q?: string;
8357
+ /**
8358
+ * Filter by process submission acceptance status. Historical rows without status do not match this filter.
8359
+ */
8360
+ status?: 'succeeded' | 'failed';
8361
+ /**
8362
+ * Filter by sandbox name.
8363
+ */
8364
+ sandbox?: string;
8365
+ /**
8366
+ * Filter by schedule id.
8367
+ */
8368
+ schedule?: string;
8369
+ /**
8370
+ * Inclusive beginning of the createdAt window, as RFC 3339.
8371
+ */
8372
+ since?: string;
8373
+ /**
8374
+ * Inclusive end of the createdAt window, as RFC 3339.
8375
+ */
8376
+ until?: string;
8377
+ };
8378
+ url: '/schedule-executions';
8379
+ };
8380
+ export type ListScheduleExecutionsResponses = {
8381
+ /**
8382
+ * successful operation
8383
+ */
8384
+ 200: SandboxScheduleExecutionList;
8385
+ };
8386
+ export type ListScheduleExecutionsResponse = ListScheduleExecutionsResponses[keyof ListScheduleExecutionsResponses];
8387
+ export type ListSchedulesData = {
8388
+ body?: never;
8389
+ path?: never;
8390
+ query?: {
8391
+ /**
8392
+ * Number of items per page
8393
+ */
8394
+ limit?: number;
8395
+ /**
8396
+ * Opaque cursor returned by a previous response's meta.nextCursor. Only valid for the same query (workspace + filters); the server rejects cursors bound to a different query or older than 24h. Omit on the first page.
8397
+ */
8398
+ cursor?: string;
8399
+ /**
8400
+ * Sort by creation time. Defaults to newest first.
8401
+ */
8402
+ sort?: 'createdAt:desc' | 'createdAt:asc';
8403
+ /**
8404
+ * Substring search across `metadata.name`, `metadata.displayName` and labels (keys + values). Trimmed and lowercased server-side; queries shorter than 2 characters fall back to the unfiltered listing. Bound into the cursor fingerprint so a cursor opened with one query cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
8405
+ */
8406
+ q?: string;
8407
+ /**
8408
+ * Filter by sandbox name.
8409
+ */
8410
+ sandbox?: string;
8411
+ /**
8412
+ * Filter schedules by stored timing type. sleep resolves to at before persistence.
8413
+ */
8414
+ type?: 'cron' | 'at';
8415
+ };
8416
+ url: '/schedules';
8417
+ };
8418
+ export type ListSchedulesResponses = {
8419
+ /**
8420
+ * successful operation
8421
+ */
8422
+ 200: SandboxScheduleEntryList;
8423
+ };
8424
+ export type ListSchedulesResponse = ListSchedulesResponses[keyof ListSchedulesResponses];
8425
+ export type GetSandboxScheduleMetricsData = {
8426
+ body?: never;
8427
+ path?: never;
8428
+ query?: {
8429
+ /**
8430
+ * Inclusive beginning of the metrics window, as RFC 3339. Normalized down to a UTC minute, must be within the last 7 days, and defaults to 24 hours before until.
8431
+ */
8432
+ since?: string;
8433
+ /**
8434
+ * Exclusive end of the metrics window, as RFC 3339. Normalized down to a UTC minute and defaults to the current minute.
8435
+ */
8436
+ until?: string;
8437
+ };
8438
+ url: '/schedules/metrics';
8439
+ };
8440
+ export type GetSandboxScheduleMetricsResponses = {
8441
+ /**
8442
+ * successful operation
8443
+ */
8444
+ 200: SandboxScheduleMetrics;
8445
+ };
8446
+ export type GetSandboxScheduleMetricsResponse = GetSandboxScheduleMetricsResponses[keyof GetSandboxScheduleMetricsResponses];
8086
8447
  export type GetWorkspaceServiceAccountsData = {
8087
8448
  body?: never;
8088
8449
  path?: never;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Quote a string so a POSIX shell reads it as one literal argument.
3
+ *
4
+ * The sandbox process API accepts a single command string, which the server
5
+ * runs as `sh -c <command>`. Any value interpolated into that string is parsed
6
+ * by the shell, so an unquoted path containing `;`, `|`, `&&`, `$()`, backticks
7
+ * or `>` would execute as its own command. Single quotes suppress every form of
8
+ * shell expansion; the only character they cannot contain is a single quote
9
+ * itself, which is closed, escaped, and reopened.
10
+ *
11
+ * This is the TypeScript equivalent of Python's `shlex.quote`.
12
+ */
13
+ export declare function shellQuote(value: string): string;
@@ -1,5 +1,5 @@
1
1
  import type http2 from "http2";
2
- import { type ListSandboxesData, type SandboxForkResponse, type SandboxLifecycle, type Sandbox as SandboxModel, type SandboxSnapshot, type SandboxSnapshots } from "../client/index.js";
2
+ import { type ListSandboxesData, type SandboxForkResponse, type SandboxLifecycle, type Sandbox as SandboxModel, type SandboxRestoreResponse, type SandboxSnapshot, type SandboxSnapshots } 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";
@@ -29,6 +29,15 @@ export type SandboxForkOptions = {
29
29
  */
30
30
  snapshotId?: string;
31
31
  };
32
+ /** How long to wait for an archive, or its restore, to finish. */
33
+ export type SandboxArchiveOptions = {
34
+ /** Wait for the archive/restore to finish. Defaults to true. */
35
+ wait?: boolean;
36
+ /** Give up after this many milliseconds. Defaults to 30 minutes. */
37
+ maxWait?: number;
38
+ /** Milliseconds between two reads of the sandbox. Defaults to 2 seconds. */
39
+ interval?: number;
40
+ };
32
41
  export declare class SandboxInstance {
33
42
  private sandbox;
34
43
  fs: SandboxFileSystem;
@@ -85,6 +94,18 @@ export declare class SandboxInstance {
85
94
  * Delete a snapshot of this sandbox by its ID.
86
95
  */
87
96
  deleteSnapshot(snapshotId: string): Promise<void>;
97
+ /**
98
+ * Restore this sandbox to one of its own snapshots. The sandbox keeps its
99
+ * name, its URLs and its previews: the running instance is torn down and
100
+ * rebuilt from the snapshot, so everything written since it was taken is
101
+ * lost unless it was snapshotted too.
102
+ *
103
+ * The restore is asked for without waiting on the guest, the same way a fork
104
+ * is: connections to a sandbox still resuming are retried by the gateway.
105
+ *
106
+ * @param snapshotId - ID of the snapshot to restore this sandbox to.
107
+ */
108
+ restore(snapshotId: string): Promise<SandboxRestoreResponse>;
88
109
  /**
89
110
  * Fork this sandbox into a new sandbox or application.
90
111
  *
@@ -103,6 +124,40 @@ export declare class SandboxInstance {
103
124
  safe?: boolean;
104
125
  createIfNotExist?: boolean;
105
126
  }): Promise<SandboxInstance>;
127
+ /**
128
+ * Archive a sandbox: keep its filesystem, stop the sandbox.
129
+ *
130
+ * The filesystem changes made over the image are exported to the archive store
131
+ * and the sandbox is shut down; memory and running processes are lost, and the
132
+ * saved processes start again from their configuration when the sandbox is
133
+ * unarchived. The export runs in the background: this waits until the sandbox
134
+ * is ARCHIVED, pass `{ wait: false }` to return as soon as it is launched.
135
+ */
136
+ static archive(sandboxName: string, options?: SandboxArchiveOptions): Promise<SandboxInstance>;
137
+ /**
138
+ * Archive this sandbox: keep its filesystem, stop the sandbox.
139
+ *
140
+ * @see SandboxInstance.archive
141
+ */
142
+ archive(options?: SandboxArchiveOptions): Promise<this>;
143
+ /**
144
+ * Recreate an archived sandbox from its archive.
145
+ *
146
+ * The sandbox is started again from its image, and the archived filesystem is
147
+ * written back over it. The sandbox answers, and its terminal is reachable, while the archived
148
+ * filesystem is written back over its image. This waits until the restore is
149
+ * done and the saved processes are running again; pass `{ wait: false }` to
150
+ * return while the sandbox is still UNARCHIVING.
151
+ */
152
+ static unarchive(sandboxName: string, options?: SandboxArchiveOptions): Promise<SandboxInstance>;
153
+ /**
154
+ * Recreate this sandbox from its archive.
155
+ *
156
+ * @see SandboxInstance.unarchive
157
+ */
158
+ unarchive(options?: SandboxArchiveOptions): Promise<this>;
159
+ private refreshFrom;
160
+ private static waitForArchiveStatus;
106
161
  static get(sandboxName: string): Promise<SandboxInstance>;
107
162
  static getByExternalId(externalId: string): Promise<SandboxInstance>;
108
163
  /**