disk 0.8.18 → 0.8.20

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.
package/dist/index.d.ts DELETED
@@ -1,2207 +0,0 @@
1
- import { Client } from 'openapi-fetch';
2
-
3
- /**
4
- * This file was auto-generated by openapi-typescript.
5
- * Do not make direct changes to the file.
6
- */
7
-
8
- interface paths {
9
- "/api/disks": {
10
- parameters: {
11
- query?: never;
12
- header?: never;
13
- path?: never;
14
- cookie?: never;
15
- };
16
- /**
17
- * List all disks
18
- * @description Returns all disks owned by the authenticated account.
19
- */
20
- get: operations["listDisks"];
21
- put?: never;
22
- /**
23
- * Create a new disk
24
- * @description Creates a new disk with the specified configuration. A default token
25
- * user is automatically generated and returned in the response, so the
26
- * disk is immediately mountable. The one-time token appears in
27
- * `authorizedUsers[].token` and cannot be retrieved again.
28
- *
29
- * To provide your own users instead, pass the deprecated `authMethods`
30
- * field or call AddDiskUser after creation.
31
- */
32
- post: operations["createDisk"];
33
- delete?: never;
34
- options?: never;
35
- head?: never;
36
- patch?: never;
37
- trace?: never;
38
- };
39
- "/api/disks/{id}": {
40
- parameters: {
41
- query?: never;
42
- header?: never;
43
- path?: never;
44
- cookie?: never;
45
- };
46
- /**
47
- * Get disk details
48
- * @description Returns detailed information about a specific disk.
49
- */
50
- get: operations["getDisk"];
51
- put?: never;
52
- post?: never;
53
- /**
54
- * Delete a disk
55
- * @description Deletes a disk and all associated resources.
56
- */
57
- delete: operations["deleteDisk"];
58
- options?: never;
59
- head?: never;
60
- patch?: never;
61
- trace?: never;
62
- };
63
- "/api/disks/{id}/users": {
64
- parameters: {
65
- query?: never;
66
- header?: never;
67
- path?: never;
68
- cookie?: never;
69
- };
70
- get?: never;
71
- put?: never;
72
- /**
73
- * Add user to disk
74
- * @description Adds an authorized user to a disk. Users can authenticate via:
75
- * - **token**: A shared token with a nickname and 4-character suffix
76
- * - **awssts**: AWS STS role assumption with an IAM principal ARN
77
- */
78
- post: operations["addDiskUser"];
79
- delete?: never;
80
- options?: never;
81
- head?: never;
82
- patch?: never;
83
- trace?: never;
84
- };
85
- "/api/disks/{id}/users/{userType}": {
86
- parameters: {
87
- query?: never;
88
- header?: never;
89
- path?: never;
90
- cookie?: never;
91
- };
92
- get?: never;
93
- put?: never;
94
- post?: never;
95
- /**
96
- * Remove user from disk
97
- * @description Removes an authorized user from a disk.
98
- */
99
- delete: operations["removeDiskUser"];
100
- options?: never;
101
- head?: never;
102
- patch?: never;
103
- trace?: never;
104
- };
105
- "/api/disks/{id}/allowed-ips": {
106
- parameters: {
107
- query?: never;
108
- header?: never;
109
- path?: never;
110
- cookie?: never;
111
- };
112
- /**
113
- * Get IP allowlist
114
- * @description Returns the current IP allowlist for a disk.
115
- */
116
- get: operations["getAllowedIPs"];
117
- /**
118
- * Set IP allowlist
119
- * @description Replaces the IP allowlist for a disk. When non-empty, only clients connecting from listed IPs or CIDR ranges can mount the disk. Pass an empty array to remove all restrictions.
120
- */
121
- put: operations["setAllowedIPs"];
122
- post?: never;
123
- delete?: never;
124
- options?: never;
125
- head?: never;
126
- patch?: never;
127
- trace?: never;
128
- };
129
- "/api/disks/{id}/exec": {
130
- parameters: {
131
- query?: never;
132
- header?: never;
133
- path?: never;
134
- cookie?: never;
135
- };
136
- get?: never;
137
- put?: never;
138
- /**
139
- * Execute a command on a disk
140
- * @description Launches a container with the specified disk mounted, runs the given
141
- * command to completion, and shuts down the container. Returns immediately
142
- * with the container info; poll the container endpoint for completion.
143
- */
144
- post: operations["execDisk"];
145
- delete?: never;
146
- options?: never;
147
- head?: never;
148
- patch?: never;
149
- trace?: never;
150
- };
151
- "/api/disks/{id}/grep": {
152
- parameters: {
153
- query?: never;
154
- header?: never;
155
- path?: never;
156
- cookie?: never;
157
- };
158
- get?: never;
159
- put?: never;
160
- /**
161
- * Constant-time parallel grep over a directory on a disk
162
- * @description Searches files under a directory on the disk for lines matching a
163
- * regular expression. Listing and matching are fanned out across
164
- * ephemeral exec containers, so the request finishes within the user's
165
- * time budget regardless of the size of the directory.
166
- *
167
- * The user controls cost and latency with three knobs:
168
- *
169
- * - `maxDurationSeconds` is the wall-clock deadline.
170
- * - `concurrency` is the maximum number of parallel grep workers.
171
- * Higher concurrency finishes larger datasets within the deadline;
172
- * the controlplane clamps to the runtime fleet's current capacity.
173
- * - `maxResults` causes the search to short-circuit after the
174
- * aggregator has collected this many matches.
175
- *
176
- * With `recursive: false` only files directly under `directory` are
177
- * searched. With `recursive: true` subdirectories are walked
178
- * breadth-first and grep workers are dispatched as soon as each level
179
- * finishes listing — listing and matching overlap.
180
- *
181
- * The matches returned when stopping early on `maxResults` are a sample
182
- * of whichever workers reported first, not the lexicographically first
183
- * N. The response surfaces `stoppedReason` so callers can distinguish
184
- * completion from early termination.
185
- */
186
- post: operations["grepDisk"];
187
- delete?: never;
188
- options?: never;
189
- head?: never;
190
- patch?: never;
191
- trace?: never;
192
- };
193
- "/api/exec": {
194
- parameters: {
195
- query?: never;
196
- header?: never;
197
- path?: never;
198
- cookie?: never;
199
- };
200
- get?: never;
201
- put?: never;
202
- /**
203
- * Execute a command with multiple disks mounted
204
- * @description Launches a container with the supplied set of disks each mounted at its
205
- * own relative path under `/mnt/archil`, runs the command to completion,
206
- * and shuts down the container. Activation is atomic: every disk mounts
207
- * or none of them do.
208
- *
209
- * Relative paths must be non-empty, non-absolute, and contain no `.` /
210
- * `..` segments. Mounting two disks at the same relative path is an
211
- * error.
212
- */
213
- post: operations["exec"];
214
- delete?: never;
215
- options?: never;
216
- head?: never;
217
- patch?: never;
218
- trace?: never;
219
- };
220
- "/api/tokens": {
221
- parameters: {
222
- query?: never;
223
- header?: never;
224
- path?: never;
225
- cookie?: never;
226
- };
227
- /**
228
- * List API tokens
229
- * @description Returns all API tokens for the authenticated account.
230
- */
231
- get: operations["listApiTokens"];
232
- put?: never;
233
- /**
234
- * Create API token
235
- * @description Creates a new API token for programmatic access. The full token value
236
- * is only returned once at creation time.
237
- */
238
- post: operations["createApiToken"];
239
- delete?: never;
240
- options?: never;
241
- head?: never;
242
- patch?: never;
243
- trace?: never;
244
- };
245
- "/api/tokens/{id}": {
246
- parameters: {
247
- query?: never;
248
- header?: never;
249
- path?: never;
250
- cookie?: never;
251
- };
252
- get?: never;
253
- put?: never;
254
- post?: never;
255
- /**
256
- * Delete API token
257
- * @description Revokes and deletes an API token.
258
- */
259
- delete: operations["deleteApiToken"];
260
- options?: never;
261
- head?: never;
262
- patch?: never;
263
- trace?: never;
264
- };
265
- }
266
- interface components {
267
- schemas: {
268
- ErrorResponse: {
269
- /** @example false */
270
- success: boolean;
271
- /** @example Invalid request parameters */
272
- error: string;
273
- };
274
- ApiResponse_Empty: {
275
- /** @example true */
276
- success: boolean;
277
- };
278
- ApiResponse_Message: {
279
- /** @example true */
280
- success: boolean;
281
- data: {
282
- message?: string;
283
- };
284
- };
285
- CreateDiskRequest: {
286
- /**
287
- * @description Disk name (alphanumeric, dashes, underscores)
288
- * @example my-data-disk
289
- */
290
- name: string;
291
- /** @description Storage mount to attach. Omit for archil-managed storage. */
292
- mounts?: components["schemas"]["MountConfig"][];
293
- /**
294
- * @description IP allowlist for mount access. When non-empty, only clients connecting from these IPs or CIDR ranges can mount the disk. An empty list (default) allows all IPs.
295
- * @example [
296
- * "203.0.113.0/24",
297
- * "198.51.100.42"
298
- * ]
299
- */
300
- allowedIps?: string[];
301
- /**
302
- * @deprecated
303
- * @description Deprecated. Use AddDiskUser after creation instead. When provided, suppresses the default auto-generated token user.
304
- */
305
- authMethods?: components["schemas"]["DiskUser"][];
306
- };
307
- MountConfig: components["schemas"]["S3Mount"] | components["schemas"]["GCSMount"] | components["schemas"]["R2Mount"] | components["schemas"]["S3CompatibleMount"] | components["schemas"]["AzureBlobMount"];
308
- /**
309
- * S3
310
- * @description Mount configuration for Amazon S3 buckets
311
- */
312
- S3Mount: {
313
- /**
314
- * @description Mount type identifier (enum property replaced by openapi-typescript)
315
- * @enum {string}
316
- */
317
- type: "s3";
318
- /**
319
- * @description S3 bucket name
320
- * @example my-bucket
321
- */
322
- bucketName: string;
323
- /** @description AWS access key ID (optional for public buckets or IAM role auth) */
324
- accessKeyId?: string;
325
- /**
326
- * Format: password
327
- * @description AWS secret access key
328
- */
329
- secretAccessKey?: string;
330
- /** @description Session token for temporary credentials */
331
- sessionToken?: string;
332
- /**
333
- * @description Prefix within the bucket
334
- * @example data/
335
- */
336
- bucketPrefix?: string;
337
- };
338
- /**
339
- * Google Cloud Storage
340
- * @description Mount configuration for Google Cloud Storage buckets
341
- */
342
- GCSMount: {
343
- /**
344
- * @description Mount type identifier (enum property replaced by openapi-typescript)
345
- * @enum {string}
346
- */
347
- type: "gcs";
348
- /**
349
- * @description GCS bucket name
350
- * @example my-gcs-bucket
351
- */
352
- bucketName: string;
353
- /** @description HMAC access key ID */
354
- accessKeyId: string;
355
- /**
356
- * Format: password
357
- * @description HMAC secret access key
358
- */
359
- secretAccessKey: string;
360
- /**
361
- * @description Prefix within the bucket (optional)
362
- * @example data/
363
- */
364
- bucketPrefix?: string;
365
- };
366
- /**
367
- * Cloudflare R2
368
- * @description Mount configuration for Cloudflare R2 buckets
369
- */
370
- R2Mount: {
371
- /**
372
- * @description Mount type identifier (enum property replaced by openapi-typescript)
373
- * @enum {string}
374
- */
375
- type: "r2";
376
- /**
377
- * @description R2 bucket name
378
- * @example my-r2-bucket
379
- */
380
- bucketName: string;
381
- /**
382
- * @description R2 endpoint URL
383
- * @example https://accountid.r2.cloudflarestorage.com
384
- */
385
- bucketEndpoint: string;
386
- /** @description R2 access key ID */
387
- accessKeyId: string;
388
- /**
389
- * Format: password
390
- * @description R2 secret access key
391
- */
392
- secretAccessKey: string;
393
- /**
394
- * @description Prefix within the bucket (optional)
395
- * @example data/
396
- */
397
- bucketPrefix?: string;
398
- };
399
- /**
400
- * S3-Compatible
401
- * @description Mount configuration for S3-compatible storage (MinIO, Backblaze B2, etc.)
402
- */
403
- S3CompatibleMount: {
404
- /**
405
- * @description Mount type identifier (enum property replaced by openapi-typescript)
406
- * @enum {string}
407
- */
408
- type: "s3-compatible";
409
- /**
410
- * @description Bucket name
411
- * @example my-bucket
412
- */
413
- bucketName: string;
414
- /**
415
- * @description S3-compatible endpoint URL
416
- * @example https://s3.us-west-001.backblazeb2.com
417
- */
418
- bucketEndpoint: string;
419
- /** @description Access key ID */
420
- accessKeyId: string;
421
- /**
422
- * Format: password
423
- * @description Secret access key
424
- */
425
- secretAccessKey: string;
426
- /**
427
- * @description Prefix within the bucket (optional)
428
- * @example data/
429
- */
430
- bucketPrefix?: string;
431
- };
432
- /**
433
- * Azure Blob Storage
434
- * @description Mount configuration for Azure Blob Storage containers
435
- */
436
- AzureBlobMount: {
437
- /**
438
- * @description Mount type identifier (enum property replaced by openapi-typescript)
439
- * @enum {string}
440
- */
441
- type: "azure-blob";
442
- /**
443
- * @description Azure blob container name
444
- * @example my-container
445
- */
446
- containerName: string;
447
- /**
448
- * @description Azure blob endpoint URL (optional if storageAccountName provided)
449
- * @example https://myaccount.blob.core.windows.net
450
- */
451
- endpoint?: string;
452
- /**
453
- * @description Azure storage account name (used to derive endpoint if not provided)
454
- * @example myaccount
455
- */
456
- storageAccountName?: string;
457
- /** @description Azure AD tenant ID */
458
- tenantId: string;
459
- /** @description Azure AD application client ID */
460
- clientId: string;
461
- /**
462
- * Format: password
463
- * @description Azure AD application client secret
464
- */
465
- clientSecret: string;
466
- /**
467
- * @description Prefix within the container
468
- * @example data/
469
- */
470
- bucketPrefix?: string;
471
- };
472
- TokenUser: {
473
- /**
474
- * @description discriminator enum property added by openapi-typescript
475
- * @enum {string}
476
- */
477
- type: "token";
478
- /**
479
- * @deprecated
480
- * @description Deprecated. Client-provided token. If omitted, the server generates a cryptographically secure token and returns it in the response.
481
- */
482
- principal?: string;
483
- nickname: string;
484
- /**
485
- * @deprecated
486
- * @description Deprecated. Last 4 characters of the token. Required when principal is provided; ignored when the server generates the token.
487
- */
488
- tokenSuffix?: string;
489
- };
490
- AwsStsUser: {
491
- /**
492
- * @description discriminator enum property added by openapi-typescript
493
- * @enum {string}
494
- */
495
- type: "awssts";
496
- /** @description IAM principal ARN */
497
- principal: string;
498
- };
499
- DiskUser: components["schemas"]["TokenUser"] | components["schemas"]["AwsStsUser"];
500
- DiskResponse: {
501
- /**
502
- * @description Disk ID
503
- * @example dsk-0123456789abcdef
504
- */
505
- id: string;
506
- /** @description Disk name */
507
- name: string;
508
- /** @description Owning organization ID */
509
- organization: string;
510
- /**
511
- * @description Disk status
512
- * @enum {string}
513
- */
514
- status: "available" | "creating" | "deleting" | "deleted" | "failed";
515
- /** @description Filesystem handler status */
516
- fsHandlerStatus?: string;
517
- /** @description Cloud provider */
518
- provider: string;
519
- /** @description Disk region (e.g., aws-us-east-1, gcp-us-central1) */
520
- region: string;
521
- /**
522
- * Format: date-time
523
- * @description Creation timestamp
524
- */
525
- createdAt: string;
526
- /**
527
- * Format: date-time
528
- * @description Last access timestamp
529
- */
530
- lastAccessed?: string;
531
- /**
532
- * Format: int64
533
- * @description Total data size in bytes
534
- */
535
- dataSize?: number;
536
- /** @description Monthly usage amount formatted as a currency string (e.g., "$1.23") */
537
- monthlyUsage?: string;
538
- mounts?: components["schemas"]["MountResponse"][];
539
- metrics?: components["schemas"]["DiskMetrics"];
540
- connectedClients?: components["schemas"]["ConnectedClient"][];
541
- authorizedUsers?: components["schemas"]["AuthorizedUser"][];
542
- /**
543
- * @description IP allowlist for mount access. Empty means all IPs are allowed.
544
- * @example [
545
- * "203.0.113.0/24"
546
- * ]
547
- */
548
- allowedIps?: string[];
549
- /**
550
- * @description Capabilities supported by this disk. Determined at creation
551
- * time and immutable thereafter. Defined values:
552
- *
553
- * * `checkpoints` — checkpoints can be created on this disk. Not
554
- * available for disks with bring-your-own buckets.
555
- * @example [
556
- * "checkpoints"
557
- * ]
558
- */
559
- capabilities?: "checkpoints"[];
560
- };
561
- MountResponse: {
562
- /** @description Mount identifier */
563
- id?: string;
564
- /**
565
- * @description Storage backend type
566
- * @enum {string}
567
- */
568
- type?: "s3" | "gcs" | "r2" | "s3-compatible" | "azure-blob";
569
- /** @description Mount path */
570
- path?: string;
571
- /** @description Bucket/container name */
572
- name?: string;
573
- /**
574
- * @description Access mode
575
- * @example rw
576
- * @enum {string}
577
- */
578
- accessMode?: "rw" | "ro";
579
- config?: components["schemas"]["MountConfigResponse"];
580
- /**
581
- * @description Current connection status
582
- * @enum {string}
583
- */
584
- connectionStatus?: "connected" | "disconnected";
585
- /** @description Authentication error message (if disconnected) */
586
- authError?: string;
587
- /**
588
- * @description How the mount authenticates to the storage backend
589
- * @enum {string}
590
- */
591
- authorizationType?: "iam" | "accessKeys" | "oauth";
592
- };
593
- /** @description Mount configuration details (secrets omitted) */
594
- MountConfigResponse: {
595
- /** @description Bucket name */
596
- bucketName?: string;
597
- /** @description Storage endpoint URL */
598
- bucketEndpoint?: string;
599
- /** @description Prefix within the bucket */
600
- bucketPrefix?: string;
601
- /** @description Session identifier for IAM-authorized mounts */
602
- sessionId?: string;
603
- };
604
- DiskMetrics: {
605
- /** @description Data transfer amount with unit (e.g., "1.5 GB") */
606
- dataTransfer?: string;
607
- /** @description Total request count as a formatted string (e.g., "1,234") */
608
- requests?: string;
609
- /** @description Average response time with unit (e.g., "45ms") */
610
- avgResponseTime?: string;
611
- };
612
- ConnectedClient: {
613
- id?: string;
614
- ipAddress?: string;
615
- /** Format: date-time */
616
- connectedAt?: string;
617
- };
618
- AuthorizedUser: {
619
- /** @enum {string} */
620
- type?: "token" | "awssts";
621
- /**
622
- * @deprecated
623
- * @description Use identifier instead. Only populated for awssts type (the IAM ARN).
624
- */
625
- principal?: string;
626
- nickname?: string;
627
- tokenSuffix?: string;
628
- /** @description The generated mount token. Only present in the response when the server generates the token (i.e. principal was not provided). This value is shown exactly once and cannot be retrieved again. */
629
- token?: string;
630
- /** @description Stable identifier for this user, returned in creation and list responses. Use this value with DELETE /api/disks/{id}/users/{type}?identifier={identifier} to remove the user. For awssts users, this is the IAM ARN. */
631
- identifier?: string;
632
- /** Format: date-time */
633
- createdAt?: string;
634
- };
635
- /** @description All API responses use a standard envelope with `success: boolean` and `data` (on success) or `error: string` (on failure). The ApiResponse_* schemas each define the specific `data` shape for their endpoint. */
636
- ApiResponse_DiskList: {
637
- /** @example true */
638
- success: boolean;
639
- data: components["schemas"]["DiskResponse"][];
640
- };
641
- ApiResponse_Disk: {
642
- /** @example true */
643
- success: boolean;
644
- data: components["schemas"]["DiskResponse"];
645
- };
646
- ApiResponse_CreateDisk: {
647
- /** @example true */
648
- success: boolean;
649
- data: {
650
- /** @example dsk-0123456789abcdef */
651
- diskId?: string;
652
- authorizedUsers?: components["schemas"]["AuthorizedUser"][];
653
- };
654
- };
655
- ApiResponse_AuthorizedUser: {
656
- /** @example true */
657
- success: boolean;
658
- data: components["schemas"]["AuthorizedUser"];
659
- };
660
- ApiResponse_AllowedIPs: {
661
- /** @example true */
662
- success: boolean;
663
- data: {
664
- /**
665
- * @example [
666
- * "203.0.113.0/24",
667
- * "198.51.100.42"
668
- * ]
669
- */
670
- allowedIps: string[];
671
- };
672
- };
673
- CreateApiTokenRequest: {
674
- /** @description Token name */
675
- name: string;
676
- /** @description Token description */
677
- description?: string;
678
- };
679
- ApiTokenResponse: {
680
- /** @description Token hash/ID */
681
- id?: string;
682
- name?: string;
683
- description?: string;
684
- /** @description Last 4 characters of the token */
685
- tokenSuffix?: string;
686
- /** Format: date-time */
687
- createdAt?: string;
688
- /** Format: date-time */
689
- lastUsedAt?: string;
690
- };
691
- ApiResponse_TokenList: {
692
- /** @example true */
693
- success: boolean;
694
- data: {
695
- tokens?: components["schemas"]["ApiTokenResponse"][];
696
- };
697
- };
698
- ApiResponse_TokenCreated: {
699
- /** @example true */
700
- success: boolean;
701
- data: components["schemas"]["ApiTokenResponse"] & {
702
- /**
703
- * @description Full token value (only shown at creation)
704
- * @example key-abc123...
705
- */
706
- token?: string;
707
- };
708
- };
709
- ExecDiskRequest: {
710
- /**
711
- * @description Shell command to execute inside the container
712
- * @example ls -la /mnt/archil
713
- */
714
- command: string;
715
- };
716
- ExecDiskResult: {
717
- /**
718
- * @description Exit code of the command (0 = success)
719
- * @example 0
720
- */
721
- exitCode: number;
722
- /** @description Standard output from the command */
723
- stdout: string;
724
- /** @description Standard error from the command */
725
- stderr: string;
726
- timing: components["schemas"]["ExecTiming"];
727
- };
728
- /** @description Server-measured timings for an exec request. */
729
- ExecTiming: {
730
- /**
731
- * @description End-to-end wall clock measured on the server, from request arrival to response.
732
- * @example 2450
733
- */
734
- totalMs: number;
735
- /**
736
- * @description Time spent queueing, scheduling, booting/claiming a VM, and mounting the filesystem before the command started running.
737
- * @example 150
738
- */
739
- queueMs: number;
740
- /**
741
- * @description Time the user's command itself ran, measured by the runtime.
742
- * @example 2300
743
- */
744
- executeMs: number;
745
- };
746
- ApiResponse_ExecDisk: {
747
- /** @example true */
748
- success: boolean;
749
- data: components["schemas"]["ExecDiskResult"];
750
- };
751
- ExecRequest: {
752
- /**
753
- * @description Map of relative path under `/mnt/archil` to the disk to mount
754
- * there. At least one entry is required. Relative paths must be
755
- * non-empty, non-absolute, and contain no `.` or `..` segments.
756
- *
757
- * Each value is either a plain disk ID string (mounts the disk's
758
- * root, read-write) or an object that additionally selects a
759
- * subdirectory of the disk and/or marks the mount as read-only or
760
- * conditional.
761
- * @example {
762
- * "data": "dsk-abc123",
763
- * "logs": {
764
- * "disk": "dsk-def456",
765
- * "subdirectory": "app/logs",
766
- * "readOnly": true
767
- * }
768
- * }
769
- */
770
- disks: {
771
- [key: string]: string | components["schemas"]["ExecMount"];
772
- };
773
- /**
774
- * @description Shell command to execute inside the container
775
- * @example ls -la /mnt/archil/data /mnt/archil/logs
776
- */
777
- command: string;
778
- };
779
- ExecMount: {
780
- /**
781
- * @description Disk ID to mount at this relative path
782
- * @example dsk-abc123
783
- */
784
- disk: string;
785
- /**
786
- * @description Subdirectory of the disk to expose at the mountpoint. Must be a
787
- * relative path with no `.` or `..` segments. When omitted, the
788
- * disk's root is exposed.
789
- * @example app/logs
790
- */
791
- subdirectory?: string;
792
- /**
793
- * @description When true, the disk is mounted read-only inside the container.
794
- * Writes against the mount fail with EROFS.
795
- * @default false
796
- */
797
- readOnly: boolean;
798
- /**
799
- * @description When true, the disk is mounted in conditional mode, where mutating
800
- * operations are sent directly to the server without a delegation
801
- * checkout. This enables concurrent writes from multiple clients to
802
- * the same disk.
803
- * @default false
804
- */
805
- conditional: boolean;
806
- };
807
- ApiResponse_Exec: {
808
- /** @example true */
809
- success: boolean;
810
- data: components["schemas"]["ExecDiskResult"];
811
- };
812
- GrepDiskRequest: {
813
- /**
814
- * @description Directory on the disk to search, relative to the disk root.
815
- * An empty string or "/" means the disk root.
816
- * @example data/logs
817
- */
818
- directory: string;
819
- /**
820
- * @description Extended regular expression (passed to `grep -E`)
821
- * @example ERROR|FATAL
822
- */
823
- pattern: string;
824
- /**
825
- * @description When true, walks subdirectories breadth-first.
826
- * @default false
827
- */
828
- recursive: boolean;
829
- /**
830
- * @description Wall-clock deadline for the entire request. Capped at 30
831
- * seconds because the runtime exec container itself is bounded
832
- * at ~30s; longer requests would have their workers killed
833
- * mid-scan.
834
- * @default 30
835
- */
836
- maxDurationSeconds: number;
837
- /**
838
- * @description Maximum number of parallel grep workers. Higher values finish
839
- * larger datasets within the deadline but consume more runtime
840
- * capacity. The controlplane clamps this to the fleet's
841
- * currently-available capacity.
842
- * @default 50
843
- */
844
- concurrency: number;
845
- /**
846
- * @description Stop scanning once the aggregator has this many matches.
847
- * Returned matches are a sample of whichever workers reported
848
- * first, not the lexicographically first N.
849
- * @default 1000
850
- */
851
- maxResults: number;
852
- };
853
- GrepMatch: {
854
- /**
855
- * @description Path to the file (relative to the disk root).
856
- * @example data/logs/2026-05-03.log
857
- */
858
- file: string;
859
- /**
860
- * @description 1-based line number where the match occurred.
861
- * @example 142
862
- */
863
- line: number;
864
- /** @description The matching line. */
865
- text: string;
866
- };
867
- /**
868
- * @description Why the search stopped.
869
- * - `completed`: every file under the directory was scanned successfully.
870
- * - `incomplete`: pipeline ran to its natural end but one or more
871
- * batches errored (invalid regex, unreadable file, runtime issue).
872
- * Results may be partial or wrong; do not rely on completeness.
873
- * - `max_results`: hit `maxResults` before scanning everything.
874
- * - `deadline`: hit `maxDurationSeconds`.
875
- * - `list_failed`: directory listing failed; partial results
876
- * may be present.
877
- * @enum {string}
878
- */
879
- GrepStoppedReason: "completed" | "incomplete" | "max_results" | "deadline" | "list_failed";
880
- GrepDiskResult: {
881
- matches: components["schemas"]["GrepMatch"][];
882
- stoppedReason: components["schemas"]["GrepStoppedReason"];
883
- /** @description Files actually fed to a grep container. */
884
- filesScanned: number;
885
- /** @description Number of grep containers started for this request. */
886
- containersDispatched: number;
887
- /**
888
- * Format: double
889
- * @description Sum of per-container execution time in seconds, measured by the
890
- * runtime. Approximates billable container-seconds.
891
- */
892
- computeSecondsUsed: number;
893
- /** @description End-to-end wall clock measured by the server. */
894
- durationMs: number;
895
- /**
896
- * @description Wall-clock time spent enumerating files via listObjects, from
897
- * the request's start to the moment listing fully drained (or
898
- * was canceled). Listing and matching overlap, so listingMs +
899
- * grepMs typically exceeds durationMs.
900
- */
901
- listingMs: number;
902
- /**
903
- * @description Wall-clock time spent matching, from the first grep container
904
- * being dispatched to the last container reporting results. 0 if
905
- * no batches ran.
906
- */
907
- grepMs: number;
908
- };
909
- ApiResponse_GrepDisk: {
910
- /** @example true */
911
- success: boolean;
912
- data: components["schemas"]["GrepDiskResult"];
913
- };
914
- };
915
- responses: {
916
- /** @description Invalid or missing authentication credentials */
917
- Unauthorized: {
918
- headers: {
919
- [name: string]: unknown;
920
- };
921
- content: {
922
- "application/json": components["schemas"]["ErrorResponse"];
923
- };
924
- };
925
- /** @description Validation error */
926
- ValidationError: {
927
- headers: {
928
- [name: string]: unknown;
929
- };
930
- content: {
931
- "application/json": components["schemas"]["ErrorResponse"];
932
- };
933
- };
934
- /** @description Resource not found */
935
- NotFound: {
936
- headers: {
937
- [name: string]: unknown;
938
- };
939
- content: {
940
- "application/json": components["schemas"]["ErrorResponse"];
941
- };
942
- };
943
- /** @description Internal server error */
944
- InternalError: {
945
- headers: {
946
- [name: string]: unknown;
947
- };
948
- content: {
949
- "application/json": components["schemas"]["ErrorResponse"];
950
- };
951
- };
952
- };
953
- parameters: {
954
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
955
- DiskId: string;
956
- /** @description Maximum number of items to return */
957
- Limit: number;
958
- /** @description Pagination cursor from a previous response */
959
- Cursor: string;
960
- };
961
- requestBodies: never;
962
- headers: never;
963
- pathItems: never;
964
- }
965
- interface operations {
966
- listDisks: {
967
- parameters: {
968
- query?: {
969
- /** @description Maximum number of items to return */
970
- limit?: components["parameters"]["Limit"];
971
- /** @description Pagination cursor from a previous response */
972
- cursor?: components["parameters"]["Cursor"];
973
- /** @description Filter disks by exact name match. */
974
- name?: string;
975
- };
976
- header?: never;
977
- path?: never;
978
- cookie?: never;
979
- };
980
- requestBody?: never;
981
- responses: {
982
- /** @description List of disks */
983
- 200: {
984
- headers: {
985
- [name: string]: unknown;
986
- };
987
- content: {
988
- "application/json": components["schemas"]["ApiResponse_DiskList"];
989
- };
990
- };
991
- 401: components["responses"]["Unauthorized"];
992
- 500: components["responses"]["InternalError"];
993
- };
994
- };
995
- createDisk: {
996
- parameters: {
997
- query?: never;
998
- header?: never;
999
- path?: never;
1000
- cookie?: never;
1001
- };
1002
- requestBody: {
1003
- content: {
1004
- "application/json": components["schemas"]["CreateDiskRequest"];
1005
- };
1006
- };
1007
- responses: {
1008
- /** @description Disk with this name already exists and configuration matches (idempotent) */
1009
- 200: {
1010
- headers: {
1011
- [name: string]: unknown;
1012
- };
1013
- content: {
1014
- "application/json": components["schemas"]["ApiResponse_CreateDisk"];
1015
- };
1016
- };
1017
- /** @description Disk created successfully */
1018
- 201: {
1019
- headers: {
1020
- [name: string]: unknown;
1021
- };
1022
- content: {
1023
- "application/json": components["schemas"]["ApiResponse_CreateDisk"];
1024
- };
1025
- };
1026
- 400: components["responses"]["ValidationError"];
1027
- 401: components["responses"]["Unauthorized"];
1028
- /** @description Access denied (e.g., preview region not enabled) */
1029
- 403: {
1030
- headers: {
1031
- [name: string]: unknown;
1032
- };
1033
- content: {
1034
- "application/json": components["schemas"]["ErrorResponse"];
1035
- };
1036
- };
1037
- /** @description Disk with this name already exists but configuration differs */
1038
- 409: {
1039
- headers: {
1040
- [name: string]: unknown;
1041
- };
1042
- content: {
1043
- "application/json": components["schemas"]["ErrorResponse"];
1044
- };
1045
- };
1046
- 500: components["responses"]["InternalError"];
1047
- };
1048
- };
1049
- getDisk: {
1050
- parameters: {
1051
- query?: never;
1052
- header?: never;
1053
- path: {
1054
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1055
- id: components["parameters"]["DiskId"];
1056
- };
1057
- cookie?: never;
1058
- };
1059
- requestBody?: never;
1060
- responses: {
1061
- /** @description Disk details */
1062
- 200: {
1063
- headers: {
1064
- [name: string]: unknown;
1065
- };
1066
- content: {
1067
- "application/json": components["schemas"]["ApiResponse_Disk"];
1068
- };
1069
- };
1070
- 400: components["responses"]["ValidationError"];
1071
- 401: components["responses"]["Unauthorized"];
1072
- 404: components["responses"]["NotFound"];
1073
- 500: components["responses"]["InternalError"];
1074
- };
1075
- };
1076
- deleteDisk: {
1077
- parameters: {
1078
- query?: never;
1079
- header?: never;
1080
- path: {
1081
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1082
- id: components["parameters"]["DiskId"];
1083
- };
1084
- cookie?: never;
1085
- };
1086
- requestBody?: never;
1087
- responses: {
1088
- /** @description Disk deleted successfully */
1089
- 200: {
1090
- headers: {
1091
- [name: string]: unknown;
1092
- };
1093
- content: {
1094
- "application/json": components["schemas"]["ApiResponse_Empty"];
1095
- };
1096
- };
1097
- 400: components["responses"]["ValidationError"];
1098
- 401: components["responses"]["Unauthorized"];
1099
- 404: components["responses"]["NotFound"];
1100
- 500: components["responses"]["InternalError"];
1101
- };
1102
- };
1103
- addDiskUser: {
1104
- parameters: {
1105
- query?: never;
1106
- header?: never;
1107
- path: {
1108
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1109
- id: components["parameters"]["DiskId"];
1110
- };
1111
- cookie?: never;
1112
- };
1113
- requestBody: {
1114
- content: {
1115
- "application/json": components["schemas"]["DiskUser"];
1116
- };
1117
- };
1118
- responses: {
1119
- /** @description User added successfully */
1120
- 201: {
1121
- headers: {
1122
- [name: string]: unknown;
1123
- };
1124
- content: {
1125
- "application/json": components["schemas"]["ApiResponse_AuthorizedUser"];
1126
- };
1127
- };
1128
- 400: components["responses"]["ValidationError"];
1129
- 401: components["responses"]["Unauthorized"];
1130
- 500: components["responses"]["InternalError"];
1131
- };
1132
- };
1133
- removeDiskUser: {
1134
- parameters: {
1135
- query?: {
1136
- /** @description Identifier of the user to remove, as returned in the creation or list response. For awssts users, this is the IAM ARN. */
1137
- identifier?: string;
1138
- /**
1139
- * @deprecated
1140
- * @description Use identifier instead.
1141
- */
1142
- principal?: string;
1143
- };
1144
- header?: never;
1145
- path: {
1146
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1147
- id: components["parameters"]["DiskId"];
1148
- /** @description The type of user authentication */
1149
- userType: "token" | "awssts";
1150
- };
1151
- cookie?: never;
1152
- };
1153
- requestBody?: never;
1154
- responses: {
1155
- /** @description User removed successfully */
1156
- 200: {
1157
- headers: {
1158
- [name: string]: unknown;
1159
- };
1160
- content: {
1161
- "application/json": components["schemas"]["ApiResponse_Message"];
1162
- };
1163
- };
1164
- 400: components["responses"]["ValidationError"];
1165
- 401: components["responses"]["Unauthorized"];
1166
- 500: components["responses"]["InternalError"];
1167
- };
1168
- };
1169
- getAllowedIPs: {
1170
- parameters: {
1171
- query?: never;
1172
- header?: never;
1173
- path: {
1174
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1175
- id: components["parameters"]["DiskId"];
1176
- };
1177
- cookie?: never;
1178
- };
1179
- requestBody?: never;
1180
- responses: {
1181
- /** @description Current IP allowlist */
1182
- 200: {
1183
- headers: {
1184
- [name: string]: unknown;
1185
- };
1186
- content: {
1187
- "application/json": components["schemas"]["ApiResponse_AllowedIPs"];
1188
- };
1189
- };
1190
- 401: components["responses"]["Unauthorized"];
1191
- 404: components["responses"]["NotFound"];
1192
- 500: components["responses"]["InternalError"];
1193
- };
1194
- };
1195
- setAllowedIPs: {
1196
- parameters: {
1197
- query?: never;
1198
- header?: never;
1199
- path: {
1200
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1201
- id: components["parameters"]["DiskId"];
1202
- };
1203
- cookie?: never;
1204
- };
1205
- requestBody: {
1206
- content: {
1207
- "application/json": {
1208
- /**
1209
- * @description List of IPs or CIDR ranges. Empty array removes restrictions.
1210
- * @example [
1211
- * "203.0.113.0/24",
1212
- * "198.51.100.42"
1213
- * ]
1214
- */
1215
- allowedIps: string[];
1216
- };
1217
- };
1218
- };
1219
- responses: {
1220
- /** @description Allowlist updated */
1221
- 200: {
1222
- headers: {
1223
- [name: string]: unknown;
1224
- };
1225
- content: {
1226
- "application/json": components["schemas"]["ApiResponse_AllowedIPs"];
1227
- };
1228
- };
1229
- 400: components["responses"]["ValidationError"];
1230
- 401: components["responses"]["Unauthorized"];
1231
- 404: components["responses"]["NotFound"];
1232
- 500: components["responses"]["InternalError"];
1233
- };
1234
- };
1235
- execDisk: {
1236
- parameters: {
1237
- query?: never;
1238
- header?: never;
1239
- path: {
1240
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1241
- id: components["parameters"]["DiskId"];
1242
- };
1243
- cookie?: never;
1244
- };
1245
- requestBody: {
1246
- content: {
1247
- "application/json": components["schemas"]["ExecDiskRequest"];
1248
- };
1249
- };
1250
- responses: {
1251
- /** @description Command completed */
1252
- 200: {
1253
- headers: {
1254
- [name: string]: unknown;
1255
- };
1256
- content: {
1257
- "application/json": components["schemas"]["ApiResponse_ExecDisk"];
1258
- };
1259
- };
1260
- 400: components["responses"]["ValidationError"];
1261
- 401: components["responses"]["Unauthorized"];
1262
- 404: components["responses"]["NotFound"];
1263
- 500: components["responses"]["InternalError"];
1264
- /** @description Command timed out */
1265
- 504: {
1266
- headers: {
1267
- [name: string]: unknown;
1268
- };
1269
- content: {
1270
- "application/json": components["schemas"]["ErrorResponse"];
1271
- };
1272
- };
1273
- };
1274
- };
1275
- grepDisk: {
1276
- parameters: {
1277
- query?: never;
1278
- header?: never;
1279
- path: {
1280
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1281
- id: components["parameters"]["DiskId"];
1282
- };
1283
- cookie?: never;
1284
- };
1285
- requestBody: {
1286
- content: {
1287
- "application/json": components["schemas"]["GrepDiskRequest"];
1288
- };
1289
- };
1290
- responses: {
1291
- /** @description Grep completed (possibly stopped early) */
1292
- 200: {
1293
- headers: {
1294
- [name: string]: unknown;
1295
- };
1296
- content: {
1297
- "application/json": components["schemas"]["ApiResponse_GrepDisk"];
1298
- };
1299
- };
1300
- 400: components["responses"]["ValidationError"];
1301
- 401: components["responses"]["Unauthorized"];
1302
- 404: components["responses"]["NotFound"];
1303
- 500: components["responses"]["InternalError"];
1304
- };
1305
- };
1306
- exec: {
1307
- parameters: {
1308
- query?: never;
1309
- header?: never;
1310
- path?: never;
1311
- cookie?: never;
1312
- };
1313
- requestBody: {
1314
- content: {
1315
- "application/json": components["schemas"]["ExecRequest"];
1316
- };
1317
- };
1318
- responses: {
1319
- /** @description Command completed */
1320
- 200: {
1321
- headers: {
1322
- [name: string]: unknown;
1323
- };
1324
- content: {
1325
- "application/json": components["schemas"]["ApiResponse_Exec"];
1326
- };
1327
- };
1328
- 400: components["responses"]["ValidationError"];
1329
- 401: components["responses"]["Unauthorized"];
1330
- 404: components["responses"]["NotFound"];
1331
- 500: components["responses"]["InternalError"];
1332
- /** @description Command timed out */
1333
- 504: {
1334
- headers: {
1335
- [name: string]: unknown;
1336
- };
1337
- content: {
1338
- "application/json": components["schemas"]["ErrorResponse"];
1339
- };
1340
- };
1341
- };
1342
- };
1343
- listApiTokens: {
1344
- parameters: {
1345
- query?: {
1346
- /** @description Maximum number of items to return */
1347
- limit?: components["parameters"]["Limit"];
1348
- /** @description Pagination cursor from a previous response */
1349
- cursor?: components["parameters"]["Cursor"];
1350
- };
1351
- header?: never;
1352
- path?: never;
1353
- cookie?: never;
1354
- };
1355
- requestBody?: never;
1356
- responses: {
1357
- /** @description List of API tokens */
1358
- 200: {
1359
- headers: {
1360
- [name: string]: unknown;
1361
- };
1362
- content: {
1363
- "application/json": components["schemas"]["ApiResponse_TokenList"];
1364
- };
1365
- };
1366
- 401: components["responses"]["Unauthorized"];
1367
- 500: components["responses"]["InternalError"];
1368
- };
1369
- };
1370
- createApiToken: {
1371
- parameters: {
1372
- query?: never;
1373
- header?: never;
1374
- path?: never;
1375
- cookie?: never;
1376
- };
1377
- requestBody: {
1378
- content: {
1379
- "application/json": components["schemas"]["CreateApiTokenRequest"];
1380
- };
1381
- };
1382
- responses: {
1383
- /** @description Token created successfully */
1384
- 201: {
1385
- headers: {
1386
- [name: string]: unknown;
1387
- };
1388
- content: {
1389
- "application/json": components["schemas"]["ApiResponse_TokenCreated"];
1390
- };
1391
- };
1392
- 400: components["responses"]["ValidationError"];
1393
- 401: components["responses"]["Unauthorized"];
1394
- 500: components["responses"]["InternalError"];
1395
- };
1396
- };
1397
- deleteApiToken: {
1398
- parameters: {
1399
- query?: never;
1400
- header?: never;
1401
- path: {
1402
- /** @description The token ID (hash) */
1403
- id: string;
1404
- };
1405
- cookie?: never;
1406
- };
1407
- requestBody?: never;
1408
- responses: {
1409
- /** @description Token deleted successfully */
1410
- 200: {
1411
- headers: {
1412
- [name: string]: unknown;
1413
- };
1414
- content: {
1415
- "application/json": components["schemas"]["ApiResponse_Message"];
1416
- };
1417
- };
1418
- 401: components["responses"]["Unauthorized"];
1419
- 404: components["responses"]["NotFound"];
1420
- 500: components["responses"]["InternalError"];
1421
- };
1422
- };
1423
- }
1424
-
1425
- type ApiClient = Client<paths>;
1426
-
1427
- type DiskResponse = components["schemas"]["DiskResponse"];
1428
- type MountResponse = components["schemas"]["MountResponse"];
1429
- type MountConfigResponse = components["schemas"]["MountConfigResponse"];
1430
- type DiskMetrics = components["schemas"]["DiskMetrics"];
1431
- type ConnectedClient = components["schemas"]["ConnectedClient"];
1432
- type AuthorizedUser = components["schemas"]["AuthorizedUser"];
1433
- type CreateDiskRequest = components["schemas"]["CreateDiskRequest"];
1434
- type MountConfig = components["schemas"]["MountConfig"];
1435
- type S3Mount = components["schemas"]["S3Mount"];
1436
- type GCSMount = components["schemas"]["GCSMount"];
1437
- type R2Mount = components["schemas"]["R2Mount"];
1438
- type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
1439
- type AzureBlobMount = components["schemas"]["AzureBlobMount"];
1440
- type DiskUser = components["schemas"]["DiskUser"];
1441
- type TokenUser = components["schemas"]["TokenUser"];
1442
- type AwsStsUser = components["schemas"]["AwsStsUser"];
1443
- type CreateApiTokenRequest = components["schemas"]["CreateApiTokenRequest"];
1444
- type ApiTokenResponse = components["schemas"]["ApiTokenResponse"];
1445
- type ExecDiskResult = components["schemas"]["ExecDiskResult"];
1446
- type ExecRequest = components["schemas"]["ExecRequest"];
1447
- type GrepDiskResult = components["schemas"]["GrepDiskResult"];
1448
- type GrepMatch = components["schemas"]["GrepMatch"];
1449
- type GrepStoppedReason = components["schemas"]["GrepStoppedReason"];
1450
- type DiskStatus = DiskResponse["status"];
1451
-
1452
- interface MountOptions {
1453
- authToken?: string;
1454
- logLevel?: string;
1455
- serverAddress?: string;
1456
- insecure?: boolean;
1457
- }
1458
- type ExecResult = ExecDiskResult;
1459
- type GrepResult = GrepDiskResult;
1460
-
1461
- interface GrepOptions {
1462
- /**
1463
- * Directory on the disk to search, relative to the disk root. An empty
1464
- * string or "/" means the disk root.
1465
- */
1466
- directory: string;
1467
- /** Extended regular expression (passed to `grep -E`). */
1468
- pattern: string;
1469
- /** Walk subdirectories breadth-first. Defaults to false. */
1470
- recursive?: boolean;
1471
- /** Wall-clock deadline for the entire request. Defaults to 30s. */
1472
- maxDurationSeconds?: number;
1473
- /**
1474
- * Maximum number of parallel grep workers. Higher values finish larger
1475
- * datasets within the deadline but consume more runtime capacity. The
1476
- * controlplane clamps this to the fleet's currently-available capacity.
1477
- * Defaults to 50.
1478
- */
1479
- concurrency?: number;
1480
- /**
1481
- * Stop scanning once the aggregator has this many matches. Returned
1482
- * matches are a sample of whichever workers reported first, not the
1483
- * lexicographically first N. Defaults to 1000.
1484
- */
1485
- maxResults?: number;
1486
- }
1487
- interface ShareUrlOptions {
1488
- /**
1489
- * Lifetime of the URL in seconds — any positive integer, up to 604800
1490
- * (7 days). Defaults to 86400 (24 hours).
1491
- */
1492
- expiresIn?: number;
1493
- }
1494
- interface ShareUrlResult {
1495
- /** Public, signed, time-limited URL that downloads the file. */
1496
- url: string;
1497
- /** Lifetime of the URL in seconds. */
1498
- expiresIn: number;
1499
- }
1500
- interface ListObjectsOptions {
1501
- /**
1502
- * List the entire subtree under the prefix. When false (the default), only
1503
- * the immediate level is returned — direct objects in `objects` and
1504
- * subdirectory prefixes in `commonPrefixes`, like listing a single directory.
1505
- * When true, every key under the prefix is returned flat (and
1506
- * `commonPrefixes` is empty).
1507
- */
1508
- recursive?: boolean;
1509
- /**
1510
- * Return only the first page instead of auto-paginating. By default
1511
- * listObjects follows continuation tokens until the listing is exhausted and
1512
- * returns every matching key. With `singlePage: true` it makes one request
1513
- * and the result carries `isTruncated` / `nextContinuationToken` so you can
1514
- * page manually (pass the token back via `continuationToken`).
1515
- */
1516
- singlePage?: boolean;
1517
- /**
1518
- * Stop after this many objects total (only meaningful when auto-paginating).
1519
- * The result's `isTruncated` is true if the cap cut the listing short.
1520
- */
1521
- limit?: number;
1522
- /** Start listing from this continuation token (from a prior `nextContinuationToken`). */
1523
- continuationToken?: string;
1524
- /** Return keys lexicographically after this one. */
1525
- startAfter?: string;
1526
- }
1527
- interface S3Object {
1528
- /** Object key (path on the disk). */
1529
- key: string;
1530
- /** Size in bytes. */
1531
- size: number;
1532
- /** Entity tag (quoted MD5 for single-part objects). */
1533
- etag?: string;
1534
- /** Last-modified time, if reported by the server. */
1535
- lastModified?: Date;
1536
- }
1537
- interface PutObjectResult {
1538
- /** Entity tag the server assigned (quoted, per S3 — e.g. `"\"abc123\""`). */
1539
- etag?: string;
1540
- }
1541
- interface ObjectMetadata {
1542
- /** Size in bytes. */
1543
- size: number;
1544
- /** Entity tag (quoted MD5 for single-part objects). */
1545
- etag?: string;
1546
- /** MIME type the object was stored with, if any. */
1547
- contentType?: string;
1548
- /** Last-modified time, if reported by the server. */
1549
- lastModified?: Date;
1550
- }
1551
- interface ListObjectsResult {
1552
- /** Objects in this page. */
1553
- objects: S3Object[];
1554
- /** Directory-like prefixes rolled up by `delimiter` (empty if no delimiter). */
1555
- commonPrefixes: string[];
1556
- /** True if more keys exist beyond this page. */
1557
- isTruncated: boolean;
1558
- /** Token to pass as `continuationToken` to fetch the next page. */
1559
- nextContinuationToken?: string;
1560
- /** Number of keys returned in this page. */
1561
- keyCount: number;
1562
- /** The prefix the listing was filtered by, echoed back by the server. */
1563
- prefix?: string;
1564
- }
1565
- /** A part to list in {@link Disk.completeMultipartUpload}. */
1566
- interface UploadPart {
1567
- /** 1-based part number (1..=10000), strictly increasing across the list. */
1568
- partNumber: number;
1569
- /** Entity tag returned by {@link Disk.uploadPart} for this part. */
1570
- etag: string;
1571
- }
1572
- /** Handle to an in-progress multipart upload, returned by {@link Disk.createMultipartUpload}. */
1573
- interface MultipartUpload {
1574
- /** Server-assigned upload id; pass to uploadPart/complete/abort/listParts. */
1575
- uploadId: string;
1576
- /** The object key this upload targets. */
1577
- key: string;
1578
- /** The bucket (disk id) the upload lives in. */
1579
- bucket: string;
1580
- }
1581
- /** The assembled object, returned by {@link Disk.completeMultipartUpload}. */
1582
- interface CompletedMultipartUpload {
1583
- /** Multipart entity tag — S3's `md5(concat(partMd5s))-N` form. */
1584
- etag?: string;
1585
- /** Resource path of the completed object. */
1586
- location?: string;
1587
- /** The bucket (disk id). */
1588
- bucket?: string;
1589
- /** The object key. */
1590
- key?: string;
1591
- }
1592
- /** One part in a {@link Disk.listParts} listing. */
1593
- interface PartInfo {
1594
- /** 1-based part number. */
1595
- partNumber: number;
1596
- /** Entity tag the server assigned to this part. */
1597
- etag?: string;
1598
- /** Size in bytes. */
1599
- size: number;
1600
- /** Time the part was uploaded, if reported. */
1601
- lastModified?: Date;
1602
- }
1603
- interface ListPartsOptions {
1604
- /** Cap parts returned in one page (server clamps to 1000). */
1605
- maxParts?: number;
1606
- /** Return parts after this part number (for pagination). */
1607
- partNumberMarker?: number;
1608
- }
1609
- interface PartListing {
1610
- /** The bucket (disk id), echoed by the server. */
1611
- bucket?: string;
1612
- /** The object key, echoed by the server. */
1613
- key?: string;
1614
- /** The upload id, echoed by the server. */
1615
- uploadId?: string;
1616
- /** Parts in this page, ascending by part number. */
1617
- parts: PartInfo[];
1618
- /** True if more parts exist beyond this page. */
1619
- isTruncated: boolean;
1620
- /** The part-number marker this page started after. */
1621
- partNumberMarker: number;
1622
- /** Pass back as `partNumberMarker` to fetch the next page. */
1623
- nextPartNumberMarker?: number;
1624
- /** Max parts the server was asked to return. */
1625
- maxParts: number;
1626
- }
1627
- /** One in-progress upload in a {@link Disk.listMultipartUploads} listing. */
1628
- interface MultipartUploadSummary {
1629
- /** The object key the upload targets. */
1630
- key: string;
1631
- /** The upload id. */
1632
- uploadId: string;
1633
- /** When the upload was initiated, if reported. */
1634
- initiated?: Date;
1635
- }
1636
- interface ListMultipartUploadsOptions {
1637
- /** Only list uploads whose key begins with this prefix. */
1638
- prefix?: string;
1639
- /** Roll keys up to this delimiter into `commonPrefixes` (S3 supports "/"). */
1640
- delimiter?: string;
1641
- /** Resume listing keys after this one (with `uploadIdMarker`). */
1642
- keyMarker?: string;
1643
- /** Resume listing uploads after this upload id (requires `keyMarker`). */
1644
- uploadIdMarker?: string;
1645
- /** Cap uploads returned in one page (server clamps to 1000). */
1646
- maxUploads?: number;
1647
- }
1648
- interface MultipartUploadListing {
1649
- /** The bucket (disk id), echoed by the server. */
1650
- bucket?: string;
1651
- /** In-progress uploads in this page. */
1652
- uploads: MultipartUploadSummary[];
1653
- /** Key prefixes rolled up by `delimiter` (empty if no delimiter). */
1654
- commonPrefixes: string[];
1655
- /** True if more uploads exist beyond this page. */
1656
- isTruncated: boolean;
1657
- /** The key marker this page started after, echoed back. */
1658
- keyMarker?: string;
1659
- /** The upload-id marker this page started after, echoed back. */
1660
- uploadIdMarker?: string;
1661
- /** Pass back as `keyMarker` (with `nextUploadIdMarker`) for the next page. */
1662
- nextKeyMarker?: string;
1663
- /** Pass back as `uploadIdMarker` (with `nextKeyMarker`) for the next page. */
1664
- nextUploadIdMarker?: string;
1665
- /** The prefix the listing was filtered by, echoed back. */
1666
- prefix?: string;
1667
- /** The delimiter used, echoed back. */
1668
- delimiter?: string;
1669
- /** Max uploads the server was asked to return. */
1670
- maxUploads?: number;
1671
- }
1672
- interface DeleteObjectsOptions {
1673
- /**
1674
- * Quiet mode: the server omits the per-key success list and returns only
1675
- * failures, so the result's `deleted` array is empty. Cuts response size on
1676
- * large batches. Defaults to false.
1677
- */
1678
- quiet?: boolean;
1679
- }
1680
- /** A single per-key failure within a {@link Disk.deleteObjects} batch. */
1681
- interface DeleteObjectsError {
1682
- /** The key that failed to delete. */
1683
- key: string;
1684
- /** S3 error code (e.g. "AccessDenied", "OperationAborted"), if provided. */
1685
- code?: string;
1686
- /** Human-readable failure detail, if provided. */
1687
- message?: string;
1688
- }
1689
- interface DeleteObjectsResult {
1690
- /** Keys the server confirmed deleted (empty in quiet mode). */
1691
- deleted: string[];
1692
- /** Per-key failures; empty when every key was deleted. */
1693
- errors: DeleteObjectsError[];
1694
- }
1695
- interface PutObjectOptions {
1696
- /** MIME type to store the object with. Default "application/octet-stream". */
1697
- contentType?: string;
1698
- /**
1699
- * Bodies larger than this take the multipart path; bodies at or below it take
1700
- * a single PutObject. Defaults to `partSize` (16 MiB), so by default the
1701
- * switch happens at the part size. Set it lower (e.g. 5 MiB) to start using
1702
- * multipart sooner, or to `Infinity` to force a single PutObject.
1703
- */
1704
- multipartThreshold?: number;
1705
- /**
1706
- * Bytes per part on the multipart path. Clamped to a minimum of 5 MiB (the S3
1707
- * floor for every part but the last). Default 16 MiB.
1708
- */
1709
- partSize?: number;
1710
- /** Max parts uploaded in parallel on the multipart path. Default 4. */
1711
- concurrency?: number;
1712
- }
1713
- /**
1714
- * The S3 transport function {@link DiskMultipart} uses, supplied by the owning
1715
- * {@link Disk} so the namespace shares the disk's credential and endpoint.
1716
- * @internal
1717
- */
1718
- type S3RequestFn = (method: "GET" | "PUT" | "DELETE" | "HEAD" | "POST", key: string, opts?: {
1719
- body?: string | Uint8Array | ArrayBuffer;
1720
- contentType?: string;
1721
- query?: Record<string, string | number>;
1722
- retry?: boolean;
1723
- }) => Promise<{
1724
- ok: boolean;
1725
- status: number;
1726
- statusText: string;
1727
- headers: Headers;
1728
- body: Uint8Array;
1729
- }>;
1730
- declare class Disk {
1731
- readonly id: string;
1732
- readonly name: string;
1733
- readonly organization: string;
1734
- readonly status: DiskStatus;
1735
- readonly provider: string;
1736
- readonly region: string;
1737
- readonly createdAt: string;
1738
- readonly fsHandlerStatus?: string;
1739
- readonly lastAccessed?: string;
1740
- readonly dataSize?: number;
1741
- readonly monthlyUsage?: string;
1742
- readonly mounts?: MountResponse[];
1743
- readonly metrics?: DiskMetrics;
1744
- readonly connectedClients?: ConnectedClient[];
1745
- readonly authorizedUsers?: AuthorizedUser[];
1746
- readonly allowedIps?: string[];
1747
- /** @internal */
1748
- private readonly _client;
1749
- /** @internal */
1750
- private readonly _archilRegion;
1751
- /** Base URL for the S3-compatible API (port 9000 ingress). Empty if unset. */
1752
- private readonly _s3BaseUrl;
1753
- /** Lazily-constructed multipart namespace (see {@link multipart}). @internal */
1754
- private _multipart?;
1755
- /** @internal */
1756
- constructor(data: DiskResponse, client: ApiClient, archilRegion: string, s3BaseUrl?: string);
1757
- toJSON(): DiskResponse;
1758
- addUser(user: DiskUser): Promise<AuthorizedUser>;
1759
- removeUser(userType: "token" | "awssts", identifier: string): Promise<void>;
1760
- createToken(nickname: string): Promise<AuthorizedUser & {
1761
- token: string;
1762
- identifier: string;
1763
- }>;
1764
- removeTokenUser(identifier: string): Promise<void>;
1765
- getAllowedIPs(): Promise<string[]>;
1766
- setAllowedIPs(allowedIps: string[]): Promise<string[]>;
1767
- addAllowedIP(ip: string): Promise<string[]>;
1768
- removeAllowedIP(ip: string): Promise<string[]>;
1769
- delete(): Promise<void>;
1770
- /**
1771
- * Execute a command in a container with this disk mounted.
1772
- * Blocks until the command completes and returns stdout, stderr, and exit code.
1773
- */
1774
- exec(command: string): Promise<ExecResult>;
1775
- /**
1776
- * Constant-time parallel grep across files on this disk. Listing and
1777
- * matching are fanned out across ephemeral exec containers; the request
1778
- * finishes within the supplied time budget regardless of dataset size.
1779
- *
1780
- * The returned `stoppedReason` says whether the search ran to completion
1781
- * or short-circuited on `maxResults` / `maxDurationSeconds`. When
1782
- * stopping early, the matches returned are a sample (whichever workers
1783
- * reported first), not the lexicographically first N.
1784
- */
1785
- grep(opts: GrepOptions): Promise<GrepResult>;
1786
- /**
1787
- * Create a signed, time-limited URL that lets anyone download a single file
1788
- * from this disk without authentication. The returned URL embeds a
1789
- * cryptographically signed token carrying the disk, the file's key, and an
1790
- * expiry — share it directly; no API key is needed to redeem it.
1791
- *
1792
- * @param key Path to the file on the disk (e.g. "reports/2026-01/data.pdf").
1793
- * @param opts `expiresIn` sets the URL lifetime in seconds (any positive
1794
- * integer, max 604800 = 7 days). Defaults to 24h.
1795
- */
1796
- share(key: string, opts?: ShareUrlOptions): Promise<ShareUrlResult>;
1797
- /**
1798
- * Read an object from the disk via the S3-compatible GetObject API and return
1799
- * its full contents as bytes. Throws `ArchilS3Error` if the object does not
1800
- * exist (status 404, code "NoSuchKey") or the request is rejected; use
1801
- * `headObject`/`objectExists` to check existence without throwing.
1802
- *
1803
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1804
- */
1805
- getObject(key: string): Promise<Uint8Array>;
1806
- /**
1807
- * Fetch an object's metadata (size, etag, content type, last-modified) without
1808
- * downloading its contents, via the S3-compatible HeadObject API. Returns
1809
- * `null` if the object does not exist.
1810
- *
1811
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1812
- */
1813
- headObject(key: string): Promise<ObjectMetadata | null>;
1814
- /** Whether an object exists on the disk (a HeadObject that maps 404 → false). */
1815
- objectExists(key: string): Promise<boolean>;
1816
- /**
1817
- * Write an object to the disk via the S3-compatible API. Handles any size:
1818
- * bodies at or below `multipartThreshold` (defaults to `partSize`, i.e.
1819
- * 16 MiB) go through a single PutObject request; larger bodies are uploaded as
1820
- * a multipart upload — split into `partSize` parts, uploaded with bounded
1821
- * `concurrency` (default 4), and assembled. A failed part aborts the upload so
1822
- * nothing is left half-staged. For manual control over the multipart
1823
- * lifecycle, use the {@link multipart} namespace.
1824
- *
1825
- * Faster than exec for large files — no container overhead, no command-length
1826
- * limits. Returns the entity tag the server assigned (a multipart upload's tag
1827
- * is S3's `md5(concat(partMd5s))-N` form rather than a plain MD5).
1828
- *
1829
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1830
- * @param body Contents as a string, Uint8Array/Buffer, or ArrayBuffer
1831
- * @param options Either a content-type string, or {@link PutObjectOptions}
1832
- * (`contentType`, `multipartThreshold`, `partSize`,
1833
- * `concurrency`). Content type defaults to
1834
- * "application/octet-stream".
1835
- */
1836
- putObject(key: string, body: string | Uint8Array | ArrayBuffer, options?: string | PutObjectOptions): Promise<PutObjectResult>;
1837
- /**
1838
- * Upload a large body through the multipart lifecycle: split into `partSize`
1839
- * parts, upload them with bounded concurrency, then complete — aborting the
1840
- * upload if any part fails so nothing is left half-staged. @internal
1841
- */
1842
- private _putMultipart;
1843
- /**
1844
- * Append bytes to an object via the S3-compatible PutObject append extension
1845
- * (`?append=true`). If the object already exists the bytes are appended to it;
1846
- * if it doesn't, it is created. Returns the entity tag of the full object
1847
- * after the append.
1848
- *
1849
- * Each call may append at most 1 MiB — the server rejects a larger body with
1850
- * `EntityTooLarge`. To grow an object past that, append in chunks (or use
1851
- * {@link putObject} for a one-shot large write).
1852
- *
1853
- * Unlike most operations this is NOT auto-retried on a transient error:
1854
- * append isn't idempotent, so retrying a succeeded-but-unacknowledged append
1855
- * would duplicate the bytes. On a transient failure, re-append yourself only
1856
- * after confirming the object's size.
1857
- *
1858
- * @param key Path on the disk (e.g. "logs/app.log")
1859
- * @param body Bytes to append (string, Uint8Array/Buffer, or ArrayBuffer)
1860
- * @param contentType MIME type, applied only when the object is newly created.
1861
- */
1862
- appendObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
1863
- /**
1864
- * Delete an object from the disk via the S3-compatible DeleteObject API.
1865
- * Idempotent: deleting a key that doesn't exist resolves successfully, per
1866
- * S3 semantics.
1867
- *
1868
- * @param key Path on the disk (e.g. "project/dist/server.cjs")
1869
- */
1870
- deleteObject(key: string): Promise<void>;
1871
- /**
1872
- * List objects on the disk via the S3-compatible ListObjectsV2 API. By
1873
- * default this follows continuation tokens until the listing is exhausted and
1874
- * returns every matching key. Use `limit` to cap the total, `singlePage` for a
1875
- * single request, or {@link listObjectsPages} to stream pages without loading
1876
- * everything into memory.
1877
- *
1878
- * @param prefix Only return keys beginning with this prefix (omit for all).
1879
- * @param opts Listing and pagination options.
1880
- */
1881
- listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
1882
- /**
1883
- * Yield ListObjectsV2 pages lazily, following continuation tokens. A
1884
- * memory-friendly way to process a large listing without materializing it:
1885
- *
1886
- * ```ts
1887
- * for await (const page of disk.listObjectsPages("logs/")) {
1888
- * for (const obj of page.objects) process(obj);
1889
- * }
1890
- * ```
1891
- *
1892
- * @param prefix Only return keys beginning with this prefix (omit for all).
1893
- * @param opts Listing options (`limit` / `singlePage` are ignored here —
1894
- * control your own loop).
1895
- */
1896
- listObjectsPages(prefix?: string, opts?: ListObjectsOptions): AsyncGenerator<ListObjectsResult>;
1897
- /** Fetch a single ListObjectsV2 page. @internal */
1898
- private _listObjectsPage;
1899
- /**
1900
- * Delete up to many objects in a single S3-compatible DeleteObjects request.
1901
- * Unlike {@link deleteObject}, failures are reported per key rather than
1902
- * thrown: the result's `deleted` lists the keys that were removed and
1903
- * `errors` lists the ones that weren't (with the server's code/message). A
1904
- * key that didn't exist still counts as deleted, per S3 semantics.
1905
- *
1906
- * The server caps a single request at 1000 keys; this method transparently
1907
- * splits larger inputs into 1000-key batches and merges the results.
1908
- *
1909
- * @param keys Object keys to delete.
1910
- * @param opts `quiet` suppresses the per-key success list server-side.
1911
- */
1912
- deleteObjects(keys: string[], opts?: DeleteObjectsOptions): Promise<DeleteObjectsResult>;
1913
- /**
1914
- * The advanced, opt-in multipart-upload API. Drive the raw lifecycle
1915
- * yourself — `create` → `uploadPart` → `complete` (or `abort`), plus
1916
- * `listParts` / `listUploads`. Most callers don't need this: {@link putObject}
1917
- * runs the whole lifecycle automatically for large bodies. Reach for it only
1918
- * when you need manual control (e.g. uploading parts from separate processes),
1919
- * and note you then own part-size, memory, and concurrency management.
1920
- */
1921
- get multipart(): DiskMultipart;
1922
- /**
1923
- * Send a single request to the disk's S3-compatible endpoint. This reuses the
1924
- * control-plane client purely for its credential and transport — the same
1925
- * `Authorization` header is sent and verified by the same code server-side —
1926
- * pointed at the S3 host. Returns the response status and fully-buffered body
1927
- * so callers can inspect both regardless of the verb used.
1928
- *
1929
- * The S3 routes (`/{diskId}/{key}` for objects, `/{diskId}` for the bucket)
1930
- * are not part of the typed control-plane API, so the path and per-request
1931
- * options are passed untyped. An empty `key` targets the bucket itself (used
1932
- * by listObjects).
1933
- *
1934
- * @internal
1935
- */
1936
- private _s3Request;
1937
- /**
1938
- * Connect to this disk's data plane via the native ArchilClient.
1939
- *
1940
- * Requires the native module to be available (platform-specific .node binary).
1941
- */
1942
- mount(opts?: MountOptions): Promise<unknown>;
1943
- }
1944
- /**
1945
- * The advanced, opt-in multipart-upload namespace, reached via {@link Disk.multipart}.
1946
- * Drives the raw S3 multipart lifecycle — `create` → `uploadPart` → `complete`
1947
- * (or `abort`), plus `listParts` / `listUploads`. Prefer {@link Disk.putObject},
1948
- * which runs this lifecycle automatically for large bodies; use this only when
1949
- * you need manual control, in which case you own part-size, memory, and
1950
- * concurrency management.
1951
- */
1952
- declare class DiskMultipart {
1953
- private readonly diskId;
1954
- private readonly s3Request;
1955
- /** @internal */
1956
- constructor(diskId: string, s3Request: S3RequestFn);
1957
- /**
1958
- * Start a multipart upload (CreateMultipartUpload) and return its `uploadId`.
1959
- *
1960
- * @param key Path on the disk the finished object will live at.
1961
- * @param contentType MIME type to store the object with.
1962
- */
1963
- create(key: string, contentType?: string): Promise<MultipartUpload>;
1964
- /**
1965
- * Upload one part (UploadPart) and return its entity tag, which you must
1966
- * collect (with its part number) and pass to {@link complete}. Every part
1967
- * except the last must be at least 5 MiB.
1968
- *
1969
- * @param key The upload's object key.
1970
- * @param uploadId The id from {@link create}.
1971
- * @param partNumber 1-based part number (1..=10000).
1972
- * @param body Part contents as a string, Uint8Array/Buffer, or ArrayBuffer.
1973
- */
1974
- uploadPart(key: string, uploadId: string, partNumber: number, body: string | Uint8Array | ArrayBuffer): Promise<UploadPart>;
1975
- /**
1976
- * Finish a multipart upload (CompleteMultipartUpload), assembling the listed
1977
- * parts into one object. Parts are sorted by part number before submission
1978
- * (the server requires strictly-increasing order).
1979
- *
1980
- * Unlike the other operations this is NOT auto-retried on a transient error:
1981
- * the gateway isn't idempotent for completion, so a retry after a
1982
- * successful-but-unacknowledged complete would return a spurious NoSuchUpload.
1983
- * On a transient failure, re-drive completion yourself only after confirming
1984
- * the object isn't already present.
1985
- *
1986
- * @param key The upload's object key.
1987
- * @param uploadId The id from {@link create}.
1988
- * @param parts The `{ partNumber, etag }` pairs from {@link uploadPart}.
1989
- */
1990
- complete(key: string, uploadId: string, parts: UploadPart[]): Promise<CompletedMultipartUpload>;
1991
- /**
1992
- * Abort a multipart upload (AbortMultipartUpload), discarding every staged
1993
- * part. Idempotent against an upload that's already gone (404 / NoSuchUpload
1994
- * resolves successfully).
1995
- *
1996
- * @param key The upload's object key.
1997
- * @param uploadId The id from {@link create}.
1998
- */
1999
- abort(key: string, uploadId: string): Promise<void>;
2000
- /**
2001
- * List the parts already uploaded for an in-progress upload (ListParts).
2002
- * Returns a single page; follow `nextPartNumberMarker` (when `isTruncated`)
2003
- * to page through the rest.
2004
- *
2005
- * @param key The upload's object key.
2006
- * @param uploadId The id from {@link create}.
2007
- * @param opts `maxParts` / `partNumberMarker` pagination controls.
2008
- */
2009
- listParts(key: string, uploadId: string, opts?: ListPartsOptions): Promise<PartListing>;
2010
- /**
2011
- * List in-progress multipart uploads on the disk (ListMultipartUploads).
2012
- * Returns a single page; follow `nextKeyMarker` / `nextUploadIdMarker` (when
2013
- * `isTruncated`) for the rest.
2014
- *
2015
- * @param opts Prefix/delimiter filter and pagination markers.
2016
- */
2017
- listUploads(opts?: ListMultipartUploadsOptions): Promise<MultipartUploadListing>;
2018
- }
2019
- /**
2020
- * Choose the part size for a `totalBytes` multipart upload. Returns
2021
- * `requestedPartSize` unless splitting at that size would exceed the server's
2022
- * 10,000-part cap, in which case it grows the part size (rounded up to a whole
2023
- * MiB) so the body fits in ≤ 10,000 parts — mirroring boto3's chunk-size
2024
- * adjustment. Parts only ever get larger, so they stay above the 5 MiB floor.
2025
- */
2026
- declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
2027
-
2028
- interface ListDisksOptions {
2029
- limit?: number;
2030
- cursor?: string;
2031
- name?: string;
2032
- }
2033
- interface CreateDiskResult {
2034
- disk: Disk;
2035
- token: string | null;
2036
- tokenIdentifier: string | null;
2037
- authorizedUsers: AuthorizedUser[];
2038
- }
2039
- declare class Disks {
2040
- /** @internal */
2041
- private readonly _client;
2042
- /** @internal */
2043
- private readonly _region;
2044
- /** @internal */
2045
- private readonly _s3BaseUrl?;
2046
- /** @internal */
2047
- constructor(client: ApiClient, region: string, s3BaseUrl?: string);
2048
- list(opts?: ListDisksOptions): Promise<Disk[]>;
2049
- get(id: string): Promise<Disk>;
2050
- /**
2051
- * Create a new disk with an auto-generated mount token.
2052
- *
2053
- * Returns the Disk, the one-time token (save it — it cannot be retrieved
2054
- * again), and the token identifier for later management.
2055
- */
2056
- create(req: CreateDiskRequest): Promise<CreateDiskResult>;
2057
- }
2058
-
2059
- interface ListTokensOptions {
2060
- limit?: number;
2061
- cursor?: string;
2062
- }
2063
- declare class Tokens {
2064
- /** @internal */
2065
- private readonly _client;
2066
- /** @internal */
2067
- constructor(client: ApiClient);
2068
- list(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
2069
- create(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
2070
- token?: string;
2071
- }>;
2072
- delete(id: string): Promise<void>;
2073
- }
2074
-
2075
- interface ArchilOptions {
2076
- /** API key. Falls back to ARCHIL_API_KEY env var if not provided. */
2077
- apiKey?: string;
2078
- /** Region. Falls back to ARCHIL_REGION env var if not provided. */
2079
- region?: string;
2080
- /** Override the control plane base URL (useful for testing). */
2081
- baseUrl?: string;
2082
- /**
2083
- * Override the S3-compatible API base URL used by Disk#getObject /
2084
- * putObject / deleteObject. Falls back to ARCHIL_S3_BASE_URL, then to the
2085
- * control plane URL with its `control.` hostname prefix swapped for `s3.`.
2086
- */
2087
- s3BaseUrl?: string;
2088
- }
2089
- /**
2090
- * Options that apply to a single mounted disk in an exec request.
2091
- * Use this object form when you need to pin the mount to a subdirectoryectory
2092
- * of the disk, mount it read-only, or mount it in conditional mode; for the
2093
- * default case (mount the disk's root, read-write), pass a `Disk` or disk-id
2094
- * string instead.
2095
- */
2096
- interface ExecMountSpec {
2097
- /** Disk to mount, by `Disk` instance or raw disk id string. */
2098
- disk: Disk | string;
2099
- /**
2100
- * Subdirectory of the disk to expose at the mountpoint. Must be a
2101
- * relative path with no `.` or `..` segments. When omitted, the disk's
2102
- * root is exposed.
2103
- */
2104
- subdirectory?: string;
2105
- /**
2106
- * When true, mount the disk read-only inside the container. Writes
2107
- * against the mount fail with EROFS. Defaults to false.
2108
- */
2109
- readOnly?: boolean;
2110
- /**
2111
- * When true, mount the disk in conditional mode, where mutating operations
2112
- * are sent directly to the server without a delegation checkout. This
2113
- * enables concurrent writes from multiple clients to the same disk.
2114
- * Defaults to false.
2115
- */
2116
- conditional?: boolean;
2117
- }
2118
- /**
2119
- * One disk to mount in an exec request. Either a `Disk`/disk-id string
2120
- * (mounts the disk's root, read-write) or an `ExecMountSpec` object that
2121
- * additionally selects a subdirectoryectory of the disk and/or marks the mount
2122
- * as read-only or conditional. Used by Archil#exec — the map key is the
2123
- * relative path under /mnt/archil at which to mount the disk.
2124
- */
2125
- type ExecMount = Disk | string | ExecMountSpec;
2126
- interface ExecOptions {
2127
- /**
2128
- * Disks to mount, keyed by the relative path under `/mnt/archil` at which
2129
- * to mount each one. At least one entry is required. Paths must be
2130
- * non-empty, non-absolute, and contain no `.` or `..` segments.
2131
- */
2132
- disks: Record<string, ExecMount>;
2133
- /** Shell command to run inside the container. */
2134
- command: string;
2135
- }
2136
- declare class Archil {
2137
- readonly disks: Disks;
2138
- readonly tokens: Tokens;
2139
- /** @internal */
2140
- private readonly _client;
2141
- constructor(opts?: ArchilOptions);
2142
- /**
2143
- * Run a command in a container with multiple disks mounted simultaneously,
2144
- * each at its own relative path under `/mnt/archil`. Blocks until the
2145
- * command completes and returns its stdout, stderr, exit code, and timing.
2146
- */
2147
- exec(opts: ExecOptions): Promise<ExecDiskResult>;
2148
- }
2149
-
2150
- /**
2151
- * Base class for every error the SDK throws. Catch with `instanceof ArchilError`
2152
- * to handle control-plane and S3 failures uniformly; `status` is the HTTP status
2153
- * code and `code` a machine-readable error code when the server provided one.
2154
- */
2155
- declare class ArchilError extends Error {
2156
- /** HTTP status code associated with the failure. */
2157
- readonly status: number;
2158
- /** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
2159
- readonly code?: string;
2160
- constructor(message: string, status: number, code?: string);
2161
- }
2162
- /** Error from the control-plane REST API. */
2163
- declare class ArchilApiError extends ArchilError {
2164
- constructor(message: string, status: number, code?: string);
2165
- }
2166
- /**
2167
- * Error from the S3-compatible object API (getObject/putObject/deleteObject/
2168
- * headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
2169
- * this surfaces its parts as structured fields (`status`, `code`, `requestId`)
2170
- * rather than a raw blob, while keeping the full body on `raw` for debugging.
2171
- */
2172
- declare class ArchilS3Error extends ArchilError {
2173
- /** S3 request id, if the gateway returned one. */
2174
- readonly requestId?: string;
2175
- /** Raw response body (the XML document), for debugging. */
2176
- readonly raw: string;
2177
- constructor(opts: {
2178
- operation: string;
2179
- statusCode: number;
2180
- statusText?: string;
2181
- code?: string;
2182
- message?: string;
2183
- requestId?: string;
2184
- raw: string;
2185
- });
2186
- }
2187
-
2188
- declare const VERSION: string;
2189
- declare const USER_AGENT: string;
2190
-
2191
- declare function configure(options: ArchilOptions): void;
2192
- declare function createDisk(req: CreateDiskRequest): Promise<CreateDiskResult>;
2193
- declare function listDisks(opts?: ListDisksOptions): Promise<Disk[]>;
2194
- declare function getDisk(id: string): Promise<Disk>;
2195
- declare function listApiKeys(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
2196
- declare function createApiKey(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
2197
- token?: string;
2198
- }>;
2199
- declare function deleteApiKey(id: string): Promise<void>;
2200
- /**
2201
- * Run a command in a container with multiple disks mounted simultaneously,
2202
- * each at its own relative path under `/mnt/archil`. Blocks until the
2203
- * command completes and returns its stdout, stderr, exit code, and timing.
2204
- */
2205
- declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
2206
-
2207
- export { type ApiTokenResponse, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks };