@blaxel/core 0.3.18 → 0.3.20-preview.286

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.
@@ -10,6 +10,45 @@ export type ApplyEditResponse = {
10
10
  success?: boolean;
11
11
  updatedContent?: string;
12
12
  };
13
+ export type ArchiveManifest = {
14
+ /**
15
+ * Added and Modified count the archive's payload members.
16
+ */
17
+ added?: number;
18
+ /**
19
+ * APIVersion is the sandbox-api build that produced the archive.
20
+ */
21
+ apiVersion?: string;
22
+ createdAt: string;
23
+ /**
24
+ * Deleted are paths the image has and the sandbox deleted. Tar cannot carry
25
+ * a deletion, so import applies these from the manifest.
26
+ */
27
+ deleted?: Array<string>;
28
+ /**
29
+ * Excludes are the paths left out of the comparison.
30
+ */
31
+ excludes?: Array<string>;
32
+ /**
33
+ * ImageDevice is the device the pristine image was read from, for the record:
34
+ * it says where the sandbox that exported the archive found its image.
35
+ */
36
+ imageDevice?: string;
37
+ modified?: number;
38
+ /**
39
+ * PayloadBytes is the total content size of the payload members.
40
+ */
41
+ payloadBytes?: number;
42
+ /**
43
+ * Processes tells whether ProcessesName is present.
44
+ */
45
+ processes?: boolean;
46
+ /**
47
+ * Root is the directory the paths are relative to.
48
+ */
49
+ root: string;
50
+ version: number;
51
+ };
13
52
  export type ContentSearchMatch = {
14
53
  column: number;
15
54
  context?: string;
@@ -92,6 +131,104 @@ export type DriveUnmountResponse = {
92
131
  export type ErrorResponse = {
93
132
  error: string;
94
133
  };
134
+ export type ExportOptions = {
135
+ /**
136
+ * Async starts the export and answers immediately, leaving it to run: an
137
+ * archive of a large filesystem takes longer than a request may be held
138
+ * open. Its progress is reported by /archive/status.
139
+ */
140
+ async?: boolean;
141
+ /**
142
+ * DryRun reports what would be archived, and its exact size, without
143
+ * stopping anything and without uploading.
144
+ */
145
+ dryRun?: boolean;
146
+ /**
147
+ * Excludes are added to the paths excluded by default.
148
+ */
149
+ excludes?: Array<string>;
150
+ /**
151
+ * Headers are sent with the upload request as given. A presigned URL only
152
+ * accepts the headers it was signed for, so these have to match what the
153
+ * caller signed: sending one that was not signed, or signing one that is not
154
+ * sent, is rejected as a signature mismatch. Typical use is a storage class,
155
+ * x-amz-storage-class: GLACIER_IR.
156
+ */
157
+ headers?: {
158
+ [key: string]: string;
159
+ };
160
+ /**
161
+ * ImageDevice is the device holding the pristine image. It is found on its
162
+ * own, wherever the sandbox booted from attached it, and naming one here
163
+ * only overrides that.
164
+ */
165
+ imageDevice?: string;
166
+ /**
167
+ * ImageMountPoint is a directory where the pristine image is already mounted.
168
+ * When set the image device is neither mounted nor unmounted.
169
+ */
170
+ imageMountPoint?: string;
171
+ /**
172
+ * Multipart uploads the archive part by part instead, which is how an
173
+ * archive larger than the 5 GB a single PUT accepts is stored. It takes
174
+ * precedence over URL.
175
+ */
176
+ multipart?: MultipartUpload;
177
+ /**
178
+ * SaveProcesses stores the process list in the archive so restore can
179
+ * relaunch the workload. Defaults to true; set it to false to archive
180
+ * storage only.
181
+ */
182
+ saveProcesses?: boolean;
183
+ /**
184
+ * StopTimeoutSeconds bounds the graceful stop of each process.
185
+ */
186
+ stopTimeoutSeconds?: number;
187
+ /**
188
+ * URL is a presigned S3 PUT URL the archive is streamed to. Empty is only
189
+ * valid with DryRun, or with Multipart.
190
+ */
191
+ url?: string;
192
+ };
193
+ export type ExportProgress = {
194
+ /**
195
+ * Error is why the export failed, without the presigned URL it used.
196
+ */
197
+ error?: string;
198
+ finishedAt?: string;
199
+ /**
200
+ * Size is the archive's exact size, known once the filesystem is scanned.
201
+ */
202
+ size?: number;
203
+ startedAt?: string;
204
+ state?: ArchiveExportState;
205
+ /**
206
+ * Uploaded reports whether the storage holds the archive.
207
+ */
208
+ uploaded?: boolean;
209
+ };
210
+ export type ExportResult = {
211
+ /**
212
+ * Changes lists every path in the archive. Only filled for a dry run,
213
+ * where it is the point of the call.
214
+ */
215
+ changes?: Array<ArchiveChange>;
216
+ duration?: string;
217
+ manifest: ArchiveManifest;
218
+ /**
219
+ * Size is the exact number of bytes uploaded, known before the upload
220
+ * starts since the archive is not compressed.
221
+ */
222
+ size?: number;
223
+ /**
224
+ * StoppedProcesses are the processes stopped to freeze the filesystem.
225
+ */
226
+ stoppedProcesses?: Array<string>;
227
+ /**
228
+ * Uploaded is false for a dry run.
229
+ */
230
+ uploaded?: boolean;
231
+ };
95
232
  export type File = {
96
233
  group: string;
97
234
  lastModified: string;
@@ -174,6 +311,27 @@ export type MultipartPartInfo = {
174
311
  etag?: string;
175
312
  partNumber?: number;
176
313
  };
314
+ export type MultipartUpload = {
315
+ /**
316
+ * AbortURL is a presigned DELETE URL that discards the parts already
317
+ * uploaded. Without it a failed export leaves them on the storage until a
318
+ * lifecycle rule removes them.
319
+ */
320
+ abortUrl?: string;
321
+ /**
322
+ * CompleteURL is a presigned POST URL that assembles the parts.
323
+ */
324
+ completeUrl?: string;
325
+ /**
326
+ * PartSize is the number of bytes sent to every part but the last.
327
+ */
328
+ partSize?: number;
329
+ /**
330
+ * PartURLs are presigned PUT URLs, one per part, in order. Extra ones are
331
+ * left unused.
332
+ */
333
+ partUrls?: Array<string>;
334
+ };
177
335
  export type MultipartUploadPartResponse = {
178
336
  etag?: string;
179
337
  partNumber?: number;
@@ -205,6 +363,10 @@ export type ProcessRequest = {
205
363
  maxRestarts?: number;
206
364
  name?: string;
207
365
  restartOnFailure?: boolean;
366
+ /**
367
+ * Open a writable stdin pipe, fed via POST /process/{identifier}/stdin and closed via DELETE. The pipe does not survive a sandbox-api restart: the process then sees EOF.
368
+ */
369
+ stdin?: boolean;
208
370
  /**
209
371
  * Timeout in seconds. When keepAlive is true, defaults to 600s (10 minutes). Set to 0 for infinite (no auto-kill).
210
372
  */
@@ -230,9 +392,45 @@ export type ProcessResponse = {
230
392
  startedAt: string;
231
393
  status: 'failed' | 'killed' | 'stopped' | 'running' | 'completed';
232
394
  stderr: string;
395
+ /**
396
+ * Whether the process was started with a writable stdin pipe
397
+ */
398
+ stdin?: boolean;
233
399
  stdout: string;
234
400
  workingDir: string;
235
401
  };
402
+ export type QuiesceStatus = {
403
+ /**
404
+ * Export reports the export started asynchronously, if there was one. It is
405
+ * how a caller that did not wait for the export learns that the archive is
406
+ * on the storage, or why it is not.
407
+ */
408
+ export?: ExportProgress;
409
+ /**
410
+ * ReadOnlyRoot reports whether the root mount was remounted read-only, which
411
+ * is what actually stops writes; false means the freeze relies only on the
412
+ * API refusing calls, and the reason says why.
413
+ */
414
+ readOnlyRoot?: boolean;
415
+ /**
416
+ * Reason is a human readable explanation of why the sandbox is frozen.
417
+ */
418
+ reason?: string;
419
+ /**
420
+ * Restore reports the archive this sandbox was started from, if it was
421
+ * started from one: how far its restore has got, and how it ended.
422
+ */
423
+ restore?: RestoreProgress;
424
+ /**
425
+ * Since is when the sandbox left StateActive.
426
+ */
427
+ since?: string;
428
+ state: ArchiveQuiesceState;
429
+ /**
430
+ * StoppedProcesses are the process identifiers stopped while quiescing.
431
+ */
432
+ stoppedProcesses?: Array<string>;
433
+ };
236
434
  export type RankedFile = {
237
435
  content?: string;
238
436
  path?: string;
@@ -243,6 +441,29 @@ export type RerankingResponse = {
243
441
  message?: string;
244
442
  success?: boolean;
245
443
  };
444
+ export type RestoreProgress = {
445
+ deleted?: number;
446
+ /**
447
+ * Downloaded is how much of the archive has been read so far.
448
+ */
449
+ downloaded?: number;
450
+ /**
451
+ * Error is why the restore failed, without the presigned URL it used.
452
+ */
453
+ error?: string;
454
+ finishedAt?: string;
455
+ /**
456
+ * Restored and Deleted count what the archive changed on the filesystem.
457
+ */
458
+ restored?: number;
459
+ /**
460
+ * Size is the archive's size as the storage announced it, and zero when it
461
+ * announced none - a client showing a percentage has to allow for that.
462
+ */
463
+ size?: number;
464
+ startedAt?: string;
465
+ state?: ArchiveRestoreState;
466
+ };
246
467
  export type Subdirectory = {
247
468
  name: string;
248
469
  path: string;
@@ -306,6 +527,21 @@ export type UpgradeStatus = {
306
527
  */
307
528
  version: string;
308
529
  };
530
+ export type ArchiveChange = {
531
+ kind: ArchiveChangeKind;
532
+ /**
533
+ * Path is relative to the root, without a leading slash.
534
+ */
535
+ path: string;
536
+ /**
537
+ * Size is the file content size in bytes, 0 for anything but a regular file.
538
+ */
539
+ size?: number;
540
+ };
541
+ export type ArchiveChangeKind = 'added' | 'modified' | 'deleted';
542
+ export type ArchiveExportState = 'running' | 'succeeded' | 'failed';
543
+ export type ArchiveQuiesceState = 'active' | 'quiescing' | 'quiesced' | 'restoring';
544
+ export type ArchiveRestoreState = 'downloading' | 'extracting' | 'relaunching' | 'succeeded' | 'failed';
309
545
  export type FilesystemMultipartUpload = {
310
546
  initiatedAt?: string;
311
547
  parts?: {
@@ -321,7 +557,84 @@ export type FilesystemUploadedPart = {
321
557
  size?: number;
322
558
  uploadedAt?: string;
323
559
  };
560
+ export type HandlerReloadResponse = {
561
+ applied?: number;
562
+ generation?: number;
563
+ removed?: number;
564
+ };
324
565
  export type ProcessUpgradeState = 'idle' | 'running' | 'completed' | 'failed';
566
+ export type PostArchiveExportData = {
567
+ /**
568
+ * Export options
569
+ */
570
+ body: ExportOptions;
571
+ path?: never;
572
+ query?: never;
573
+ url: '/archive/export';
574
+ };
575
+ export type PostArchiveExportErrors = {
576
+ /**
577
+ * Invalid request
578
+ */
579
+ 400: ErrorResponse;
580
+ /**
581
+ * An export is already in progress
582
+ */
583
+ 409: ErrorResponse;
584
+ /**
585
+ * Export failed
586
+ */
587
+ 500: ErrorResponse;
588
+ };
589
+ export type PostArchiveExportError = PostArchiveExportErrors[keyof PostArchiveExportErrors];
590
+ export type PostArchiveExportResponses = {
591
+ /**
592
+ * Export result
593
+ */
594
+ 200: ExportResult;
595
+ /**
596
+ * The export was started and runs in the background
597
+ */
598
+ 202: ExportProgress;
599
+ };
600
+ export type PostArchiveExportResponse = PostArchiveExportResponses[keyof PostArchiveExportResponses];
601
+ export type PostArchiveResumeData = {
602
+ body?: never;
603
+ path?: never;
604
+ query?: never;
605
+ url: '/archive/resume';
606
+ };
607
+ export type PostArchiveResumeErrors = {
608
+ /**
609
+ * An export or a restore is in progress
610
+ */
611
+ 409: ErrorResponse;
612
+ /**
613
+ * The root filesystem could not be made writable again
614
+ */
615
+ 500: ErrorResponse;
616
+ };
617
+ export type PostArchiveResumeError = PostArchiveResumeErrors[keyof PostArchiveResumeErrors];
618
+ export type PostArchiveResumeResponses = {
619
+ /**
620
+ * Archive status
621
+ */
622
+ 200: QuiesceStatus;
623
+ };
624
+ export type PostArchiveResumeResponse = PostArchiveResumeResponses[keyof PostArchiveResumeResponses];
625
+ export type GetArchiveStatusData = {
626
+ body?: never;
627
+ path?: never;
628
+ query?: never;
629
+ url: '/archive/status';
630
+ };
631
+ export type GetArchiveStatusResponses = {
632
+ /**
633
+ * Archive status
634
+ */
635
+ 200: QuiesceStatus;
636
+ };
637
+ export type GetArchiveStatusResponse = GetArchiveStatusResponses[keyof GetArchiveStatusResponses];
325
638
  export type PutCodegenFastapplyByPathData = {
326
639
  /**
327
640
  * Code edit request
@@ -442,6 +755,14 @@ export type PostDrivesMountErrors = {
442
755
  * Bad Request
443
756
  */
444
757
  400: ErrorResponse;
758
+ /**
759
+ * Forbidden
760
+ */
761
+ 403: ErrorResponse;
762
+ /**
763
+ * Conflict
764
+ */
765
+ 409: ErrorResponse;
445
766
  /**
446
767
  * Internal Server Error
447
768
  */
@@ -484,6 +805,30 @@ export type DeleteDrivesMountByMountPathResponses = {
484
805
  200: DriveUnmountResponse;
485
806
  };
486
807
  export type DeleteDrivesMountByMountPathResponse = DeleteDrivesMountByMountPathResponses[keyof DeleteDrivesMountByMountPathResponses];
808
+ export type PostEnvironmentReloadData = {
809
+ body?: never;
810
+ path?: never;
811
+ query?: never;
812
+ url: '/environment/reload';
813
+ };
814
+ export type PostEnvironmentReloadErrors = {
815
+ /**
816
+ * Not Found
817
+ */
818
+ 404: ErrorResponse;
819
+ /**
820
+ * Internal Server Error
821
+ */
822
+ 500: ErrorResponse;
823
+ };
824
+ export type PostEnvironmentReloadError = PostEnvironmentReloadErrors[keyof PostEnvironmentReloadErrors];
825
+ export type PostEnvironmentReloadResponses = {
826
+ /**
827
+ * OK
828
+ */
829
+ 200: HandlerReloadResponse;
830
+ };
831
+ export type PostEnvironmentReloadResponse = PostEnvironmentReloadResponses[keyof PostEnvironmentReloadResponses];
487
832
  export type GetFilesystemContentSearchByPathData = {
488
833
  body?: never;
489
834
  path: {
@@ -1435,6 +1780,79 @@ export type GetProcessByIdentifierLogsStreamResponses = {
1435
1780
  200: string;
1436
1781
  };
1437
1782
  export type GetProcessByIdentifierLogsStreamResponse = GetProcessByIdentifierLogsStreamResponses[keyof GetProcessByIdentifierLogsStreamResponses];
1783
+ export type DeleteProcessByIdentifierStdinData = {
1784
+ body?: never;
1785
+ path: {
1786
+ /**
1787
+ * Process identifier (PID or name)
1788
+ */
1789
+ identifier: string;
1790
+ };
1791
+ query?: never;
1792
+ url: '/process/{identifier}/stdin';
1793
+ };
1794
+ export type DeleteProcessByIdentifierStdinErrors = {
1795
+ /**
1796
+ * Process not found
1797
+ */
1798
+ 404: ErrorResponse;
1799
+ /**
1800
+ * Process has no stdin
1801
+ */
1802
+ 409: ErrorResponse;
1803
+ };
1804
+ export type DeleteProcessByIdentifierStdinError = DeleteProcessByIdentifierStdinErrors[keyof DeleteProcessByIdentifierStdinErrors];
1805
+ export type DeleteProcessByIdentifierStdinResponses = {
1806
+ /**
1807
+ * Stdin closed
1808
+ */
1809
+ 200: SuccessResponse;
1810
+ };
1811
+ export type DeleteProcessByIdentifierStdinResponse = DeleteProcessByIdentifierStdinResponses[keyof DeleteProcessByIdentifierStdinResponses];
1812
+ export type PostProcessByIdentifierStdinData = {
1813
+ /**
1814
+ * Raw bytes to write
1815
+ */
1816
+ body: string;
1817
+ path: {
1818
+ /**
1819
+ * Process identifier (PID or name)
1820
+ */
1821
+ identifier: string;
1822
+ };
1823
+ query?: never;
1824
+ url: '/process/{identifier}/stdin';
1825
+ };
1826
+ export type PostProcessByIdentifierStdinErrors = {
1827
+ /**
1828
+ * Process not found
1829
+ */
1830
+ 404: ErrorResponse;
1831
+ /**
1832
+ * Process has no stdin, or stdin is closed
1833
+ */
1834
+ 409: ErrorResponse;
1835
+ /**
1836
+ * Body over 8 MiB
1837
+ */
1838
+ 413: ErrorResponse;
1839
+ /**
1840
+ * Write failed
1841
+ */
1842
+ 500: ErrorResponse;
1843
+ /**
1844
+ * Process stopped reading its stdin
1845
+ */
1846
+ 503: ErrorResponse;
1847
+ };
1848
+ export type PostProcessByIdentifierStdinError = PostProcessByIdentifierStdinErrors[keyof PostProcessByIdentifierStdinErrors];
1849
+ export type PostProcessByIdentifierStdinResponses = {
1850
+ /**
1851
+ * Bytes written
1852
+ */
1853
+ 200: SuccessResponse;
1854
+ };
1855
+ export type PostProcessByIdentifierStdinResponse = PostProcessByIdentifierStdinResponses[keyof PostProcessByIdentifierStdinResponses];
1438
1856
  export type PostUpgradeData = {
1439
1857
  /**
1440
1858
  * Upgrade options
@@ -23,5 +23,17 @@ export declare class SandboxProcess extends SandboxAction {
23
23
  list(): Promise<GetProcessResponse>;
24
24
  stop(identifier: string): Promise<DeleteProcessByIdentifierResponse>;
25
25
  kill(identifier: string): Promise<DeleteProcessByIdentifierKillResponse>;
26
+ /**
27
+ * Write raw bytes to the stdin of a process started with `stdin: true`.
28
+ * Bytes go through verbatim, so include the trailing newline your protocol
29
+ * expects (one JSON-RPC message per call for an MCP stdio server). Not
30
+ * retried: a duplicate write would corrupt the stream.
31
+ */
32
+ writeStdin(identifier: string, data: string | Uint8Array): Promise<void>;
33
+ /**
34
+ * Close the process's stdin (EOF). Idempotent. For stdio protocols such as
35
+ * MCP this is the clean shutdown path.
36
+ */
37
+ closeStdin(identifier: string): Promise<void>;
26
38
  logs(identifier: string, type?: "stdout" | "stderr" | "all"): Promise<string>;
27
39
  }