disk 0.8.17 → 0.8.19

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.cts CHANGED
@@ -1,2150 +1,219 @@
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.
760
- * @example {
761
- * "data": "dsk-abc123",
762
- * "logs": {
763
- * "disk": "dsk-def456",
764
- * "subdirectory": "app/logs",
765
- * "readOnly": true
766
- * }
767
- * }
768
- */
769
- disks: {
770
- [key: string]: string | components["schemas"]["ExecMount"];
771
- };
772
- /**
773
- * @description Shell command to execute inside the container
774
- * @example ls -la /mnt/archil/data /mnt/archil/logs
775
- */
776
- command: string;
777
- };
778
- ExecMount: {
779
- /**
780
- * @description Disk ID to mount at this relative path
781
- * @example dsk-abc123
782
- */
783
- disk: string;
784
- /**
785
- * @description Subdirectory of the disk to expose at the mountpoint. Must be a
786
- * relative path with no `.` or `..` segments. When omitted, the
787
- * disk's root is exposed.
788
- * @example app/logs
789
- */
790
- subdirectory?: string;
791
- /**
792
- * @description When true, the disk is mounted read-only inside the container.
793
- * Writes against the mount fail with EROFS.
794
- * @default false
795
- */
796
- readOnly: boolean;
797
- };
798
- ApiResponse_Exec: {
799
- /** @example true */
800
- success: boolean;
801
- data: components["schemas"]["ExecDiskResult"];
802
- };
803
- GrepDiskRequest: {
804
- /**
805
- * @description Directory on the disk to search, relative to the disk root.
806
- * An empty string or "/" means the disk root.
807
- * @example data/logs
808
- */
809
- directory: string;
810
- /**
811
- * @description Extended regular expression (passed to `grep -E`)
812
- * @example ERROR|FATAL
813
- */
814
- pattern: string;
815
- /**
816
- * @description When true, walks subdirectories breadth-first.
817
- * @default false
818
- */
819
- recursive: boolean;
820
- /**
821
- * @description Wall-clock deadline for the entire request. Capped at 30
822
- * seconds because the runtime exec container itself is bounded
823
- * at ~30s; longer requests would have their workers killed
824
- * mid-scan.
825
- * @default 30
826
- */
827
- maxDurationSeconds: number;
828
- /**
829
- * @description Maximum number of parallel grep workers. Higher values finish
830
- * larger datasets within the deadline but consume more runtime
831
- * capacity. The controlplane clamps this to the fleet's
832
- * currently-available capacity.
833
- * @default 50
834
- */
835
- concurrency: number;
836
- /**
837
- * @description Stop scanning once the aggregator has this many matches.
838
- * Returned matches are a sample of whichever workers reported
839
- * first, not the lexicographically first N.
840
- * @default 1000
841
- */
842
- maxResults: number;
843
- };
844
- GrepMatch: {
845
- /**
846
- * @description Path to the file (relative to the disk root).
847
- * @example data/logs/2026-05-03.log
848
- */
849
- file: string;
850
- /**
851
- * @description 1-based line number where the match occurred.
852
- * @example 142
853
- */
854
- line: number;
855
- /** @description The matching line. */
856
- text: string;
857
- };
858
- /**
859
- * @description Why the search stopped.
860
- * - `completed`: every file under the directory was scanned successfully.
861
- * - `incomplete`: pipeline ran to its natural end but one or more
862
- * batches errored (invalid regex, unreadable file, runtime issue).
863
- * Results may be partial or wrong; do not rely on completeness.
864
- * - `max_results`: hit `maxResults` before scanning everything.
865
- * - `deadline`: hit `maxDurationSeconds`.
866
- * - `list_failed`: directory listing failed; partial results
867
- * may be present.
868
- * @enum {string}
869
- */
870
- GrepStoppedReason: "completed" | "incomplete" | "max_results" | "deadline" | "list_failed";
871
- GrepDiskResult: {
872
- matches: components["schemas"]["GrepMatch"][];
873
- stoppedReason: components["schemas"]["GrepStoppedReason"];
874
- /** @description Files actually fed to a grep container. */
875
- filesScanned: number;
876
- /** @description Number of grep containers started for this request. */
877
- containersDispatched: number;
878
- /**
879
- * Format: double
880
- * @description Sum of per-container execution time in seconds, measured by the
881
- * runtime. Approximates billable container-seconds.
882
- */
883
- computeSecondsUsed: number;
884
- /** @description End-to-end wall clock measured by the server. */
885
- durationMs: number;
886
- /**
887
- * @description Wall-clock time spent enumerating files via listObjects, from
888
- * the request's start to the moment listing fully drained (or
889
- * was canceled). Listing and matching overlap, so listingMs +
890
- * grepMs typically exceeds durationMs.
891
- */
892
- listingMs: number;
893
- /**
894
- * @description Wall-clock time spent matching, from the first grep container
895
- * being dispatched to the last container reporting results. 0 if
896
- * no batches ran.
897
- */
898
- grepMs: number;
899
- };
900
- ApiResponse_GrepDisk: {
901
- /** @example true */
902
- success: boolean;
903
- data: components["schemas"]["GrepDiskResult"];
904
- };
905
- };
906
- responses: {
907
- /** @description Invalid or missing authentication credentials */
908
- Unauthorized: {
909
- headers: {
910
- [name: string]: unknown;
911
- };
912
- content: {
913
- "application/json": components["schemas"]["ErrorResponse"];
914
- };
915
- };
916
- /** @description Validation error */
917
- ValidationError: {
918
- headers: {
919
- [name: string]: unknown;
920
- };
921
- content: {
922
- "application/json": components["schemas"]["ErrorResponse"];
923
- };
924
- };
925
- /** @description Resource not found */
926
- NotFound: {
927
- headers: {
928
- [name: string]: unknown;
929
- };
930
- content: {
931
- "application/json": components["schemas"]["ErrorResponse"];
932
- };
933
- };
934
- /** @description Internal server error */
935
- InternalError: {
936
- headers: {
937
- [name: string]: unknown;
938
- };
939
- content: {
940
- "application/json": components["schemas"]["ErrorResponse"];
941
- };
942
- };
943
- };
944
- parameters: {
945
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
946
- DiskId: string;
947
- /** @description Maximum number of items to return */
948
- Limit: number;
949
- /** @description Pagination cursor from a previous response */
950
- Cursor: string;
951
- };
952
- requestBodies: never;
953
- headers: never;
954
- pathItems: never;
955
- }
956
- interface operations {
957
- listDisks: {
958
- parameters: {
959
- query?: {
960
- /** @description Maximum number of items to return */
961
- limit?: components["parameters"]["Limit"];
962
- /** @description Pagination cursor from a previous response */
963
- cursor?: components["parameters"]["Cursor"];
964
- /** @description Filter disks by exact name match. */
965
- name?: string;
966
- };
967
- header?: never;
968
- path?: never;
969
- cookie?: never;
970
- };
971
- requestBody?: never;
972
- responses: {
973
- /** @description List of disks */
974
- 200: {
975
- headers: {
976
- [name: string]: unknown;
977
- };
978
- content: {
979
- "application/json": components["schemas"]["ApiResponse_DiskList"];
980
- };
981
- };
982
- 401: components["responses"]["Unauthorized"];
983
- 500: components["responses"]["InternalError"];
984
- };
985
- };
986
- createDisk: {
987
- parameters: {
988
- query?: never;
989
- header?: never;
990
- path?: never;
991
- cookie?: never;
992
- };
993
- requestBody: {
994
- content: {
995
- "application/json": components["schemas"]["CreateDiskRequest"];
996
- };
997
- };
998
- responses: {
999
- /** @description Disk with this name already exists and configuration matches (idempotent) */
1000
- 200: {
1001
- headers: {
1002
- [name: string]: unknown;
1003
- };
1004
- content: {
1005
- "application/json": components["schemas"]["ApiResponse_CreateDisk"];
1006
- };
1007
- };
1008
- /** @description Disk created successfully */
1009
- 201: {
1010
- headers: {
1011
- [name: string]: unknown;
1012
- };
1013
- content: {
1014
- "application/json": components["schemas"]["ApiResponse_CreateDisk"];
1015
- };
1016
- };
1017
- 400: components["responses"]["ValidationError"];
1018
- 401: components["responses"]["Unauthorized"];
1019
- /** @description Access denied (e.g., preview region not enabled) */
1020
- 403: {
1021
- headers: {
1022
- [name: string]: unknown;
1023
- };
1024
- content: {
1025
- "application/json": components["schemas"]["ErrorResponse"];
1026
- };
1027
- };
1028
- /** @description Disk with this name already exists but configuration differs */
1029
- 409: {
1030
- headers: {
1031
- [name: string]: unknown;
1032
- };
1033
- content: {
1034
- "application/json": components["schemas"]["ErrorResponse"];
1035
- };
1036
- };
1037
- 500: components["responses"]["InternalError"];
1038
- };
1039
- };
1040
- getDisk: {
1041
- parameters: {
1042
- query?: never;
1043
- header?: never;
1044
- path: {
1045
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1046
- id: components["parameters"]["DiskId"];
1047
- };
1048
- cookie?: never;
1049
- };
1050
- requestBody?: never;
1051
- responses: {
1052
- /** @description Disk details */
1053
- 200: {
1054
- headers: {
1055
- [name: string]: unknown;
1056
- };
1057
- content: {
1058
- "application/json": components["schemas"]["ApiResponse_Disk"];
1059
- };
1060
- };
1061
- 400: components["responses"]["ValidationError"];
1062
- 401: components["responses"]["Unauthorized"];
1063
- 404: components["responses"]["NotFound"];
1064
- 500: components["responses"]["InternalError"];
1065
- };
1066
- };
1067
- deleteDisk: {
1068
- parameters: {
1069
- query?: never;
1070
- header?: never;
1071
- path: {
1072
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1073
- id: components["parameters"]["DiskId"];
1074
- };
1075
- cookie?: never;
1076
- };
1077
- requestBody?: never;
1078
- responses: {
1079
- /** @description Disk deleted successfully */
1080
- 200: {
1081
- headers: {
1082
- [name: string]: unknown;
1083
- };
1084
- content: {
1085
- "application/json": components["schemas"]["ApiResponse_Empty"];
1086
- };
1087
- };
1088
- 400: components["responses"]["ValidationError"];
1089
- 401: components["responses"]["Unauthorized"];
1090
- 404: components["responses"]["NotFound"];
1091
- 500: components["responses"]["InternalError"];
1092
- };
1093
- };
1094
- addDiskUser: {
1095
- parameters: {
1096
- query?: never;
1097
- header?: never;
1098
- path: {
1099
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1100
- id: components["parameters"]["DiskId"];
1101
- };
1102
- cookie?: never;
1103
- };
1104
- requestBody: {
1105
- content: {
1106
- "application/json": components["schemas"]["DiskUser"];
1107
- };
1108
- };
1109
- responses: {
1110
- /** @description User added successfully */
1111
- 201: {
1112
- headers: {
1113
- [name: string]: unknown;
1114
- };
1115
- content: {
1116
- "application/json": components["schemas"]["ApiResponse_AuthorizedUser"];
1117
- };
1118
- };
1119
- 400: components["responses"]["ValidationError"];
1120
- 401: components["responses"]["Unauthorized"];
1121
- 500: components["responses"]["InternalError"];
1122
- };
1123
- };
1124
- removeDiskUser: {
1125
- parameters: {
1126
- query?: {
1127
- /** @description Identifier of the user to remove, as returned in the creation or list response. For awssts users, this is the IAM ARN. */
1128
- identifier?: string;
1129
- /**
1130
- * @deprecated
1131
- * @description Use identifier instead.
1132
- */
1133
- principal?: string;
1134
- };
1135
- header?: never;
1136
- path: {
1137
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1138
- id: components["parameters"]["DiskId"];
1139
- /** @description The type of user authentication */
1140
- userType: "token" | "awssts";
1141
- };
1142
- cookie?: never;
1143
- };
1144
- requestBody?: never;
1145
- responses: {
1146
- /** @description User removed successfully */
1147
- 200: {
1148
- headers: {
1149
- [name: string]: unknown;
1150
- };
1151
- content: {
1152
- "application/json": components["schemas"]["ApiResponse_Message"];
1153
- };
1154
- };
1155
- 400: components["responses"]["ValidationError"];
1156
- 401: components["responses"]["Unauthorized"];
1157
- 500: components["responses"]["InternalError"];
1158
- };
1159
- };
1160
- getAllowedIPs: {
1161
- parameters: {
1162
- query?: never;
1163
- header?: never;
1164
- path: {
1165
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1166
- id: components["parameters"]["DiskId"];
1167
- };
1168
- cookie?: never;
1169
- };
1170
- requestBody?: never;
1171
- responses: {
1172
- /** @description Current IP allowlist */
1173
- 200: {
1174
- headers: {
1175
- [name: string]: unknown;
1176
- };
1177
- content: {
1178
- "application/json": components["schemas"]["ApiResponse_AllowedIPs"];
1179
- };
1180
- };
1181
- 401: components["responses"]["Unauthorized"];
1182
- 404: components["responses"]["NotFound"];
1183
- 500: components["responses"]["InternalError"];
1184
- };
1185
- };
1186
- setAllowedIPs: {
1187
- parameters: {
1188
- query?: never;
1189
- header?: never;
1190
- path: {
1191
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1192
- id: components["parameters"]["DiskId"];
1193
- };
1194
- cookie?: never;
1195
- };
1196
- requestBody: {
1197
- content: {
1198
- "application/json": {
1199
- /**
1200
- * @description List of IPs or CIDR ranges. Empty array removes restrictions.
1201
- * @example [
1202
- * "203.0.113.0/24",
1203
- * "198.51.100.42"
1204
- * ]
1205
- */
1206
- allowedIps: string[];
1207
- };
1208
- };
1209
- };
1210
- responses: {
1211
- /** @description Allowlist updated */
1212
- 200: {
1213
- headers: {
1214
- [name: string]: unknown;
1215
- };
1216
- content: {
1217
- "application/json": components["schemas"]["ApiResponse_AllowedIPs"];
1218
- };
1219
- };
1220
- 400: components["responses"]["ValidationError"];
1221
- 401: components["responses"]["Unauthorized"];
1222
- 404: components["responses"]["NotFound"];
1223
- 500: components["responses"]["InternalError"];
1224
- };
1225
- };
1226
- execDisk: {
1227
- parameters: {
1228
- query?: never;
1229
- header?: never;
1230
- path: {
1231
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1232
- id: components["parameters"]["DiskId"];
1233
- };
1234
- cookie?: never;
1235
- };
1236
- requestBody: {
1237
- content: {
1238
- "application/json": components["schemas"]["ExecDiskRequest"];
1239
- };
1240
- };
1241
- responses: {
1242
- /** @description Command completed */
1243
- 200: {
1244
- headers: {
1245
- [name: string]: unknown;
1246
- };
1247
- content: {
1248
- "application/json": components["schemas"]["ApiResponse_ExecDisk"];
1249
- };
1250
- };
1251
- 400: components["responses"]["ValidationError"];
1252
- 401: components["responses"]["Unauthorized"];
1253
- 404: components["responses"]["NotFound"];
1254
- 500: components["responses"]["InternalError"];
1255
- /** @description Command timed out */
1256
- 504: {
1257
- headers: {
1258
- [name: string]: unknown;
1259
- };
1260
- content: {
1261
- "application/json": components["schemas"]["ErrorResponse"];
1262
- };
1263
- };
1264
- };
1265
- };
1266
- grepDisk: {
1267
- parameters: {
1268
- query?: never;
1269
- header?: never;
1270
- path: {
1271
- /** @description Disk ID (format `dsk-{16 hex chars}`) */
1272
- id: components["parameters"]["DiskId"];
1273
- };
1274
- cookie?: never;
1275
- };
1276
- requestBody: {
1277
- content: {
1278
- "application/json": components["schemas"]["GrepDiskRequest"];
1279
- };
1280
- };
1281
- responses: {
1282
- /** @description Grep completed (possibly stopped early) */
1283
- 200: {
1284
- headers: {
1285
- [name: string]: unknown;
1286
- };
1287
- content: {
1288
- "application/json": components["schemas"]["ApiResponse_GrepDisk"];
1289
- };
1290
- };
1291
- 400: components["responses"]["ValidationError"];
1292
- 401: components["responses"]["Unauthorized"];
1293
- 404: components["responses"]["NotFound"];
1294
- 500: components["responses"]["InternalError"];
1295
- };
1296
- };
1297
- exec: {
1298
- parameters: {
1299
- query?: never;
1300
- header?: never;
1301
- path?: never;
1302
- cookie?: never;
1303
- };
1304
- requestBody: {
1305
- content: {
1306
- "application/json": components["schemas"]["ExecRequest"];
1307
- };
1308
- };
1309
- responses: {
1310
- /** @description Command completed */
1311
- 200: {
1312
- headers: {
1313
- [name: string]: unknown;
1314
- };
1315
- content: {
1316
- "application/json": components["schemas"]["ApiResponse_Exec"];
1317
- };
1318
- };
1319
- 400: components["responses"]["ValidationError"];
1320
- 401: components["responses"]["Unauthorized"];
1321
- 404: components["responses"]["NotFound"];
1322
- 500: components["responses"]["InternalError"];
1323
- /** @description Command timed out */
1324
- 504: {
1325
- headers: {
1326
- [name: string]: unknown;
1327
- };
1328
- content: {
1329
- "application/json": components["schemas"]["ErrorResponse"];
1330
- };
1331
- };
1332
- };
1333
- };
1334
- listApiTokens: {
1335
- parameters: {
1336
- query?: {
1337
- /** @description Maximum number of items to return */
1338
- limit?: components["parameters"]["Limit"];
1339
- /** @description Pagination cursor from a previous response */
1340
- cursor?: components["parameters"]["Cursor"];
1341
- };
1342
- header?: never;
1343
- path?: never;
1344
- cookie?: never;
1345
- };
1346
- requestBody?: never;
1347
- responses: {
1348
- /** @description List of API tokens */
1349
- 200: {
1350
- headers: {
1351
- [name: string]: unknown;
1352
- };
1353
- content: {
1354
- "application/json": components["schemas"]["ApiResponse_TokenList"];
1355
- };
1356
- };
1357
- 401: components["responses"]["Unauthorized"];
1358
- 500: components["responses"]["InternalError"];
1359
- };
1360
- };
1361
- createApiToken: {
1362
- parameters: {
1363
- query?: never;
1364
- header?: never;
1365
- path?: never;
1366
- cookie?: never;
1367
- };
1368
- requestBody: {
1369
- content: {
1370
- "application/json": components["schemas"]["CreateApiTokenRequest"];
1371
- };
1372
- };
1373
- responses: {
1374
- /** @description Token created successfully */
1375
- 201: {
1376
- headers: {
1377
- [name: string]: unknown;
1378
- };
1379
- content: {
1380
- "application/json": components["schemas"]["ApiResponse_TokenCreated"];
1381
- };
1382
- };
1383
- 400: components["responses"]["ValidationError"];
1384
- 401: components["responses"]["Unauthorized"];
1385
- 500: components["responses"]["InternalError"];
1386
- };
1387
- };
1388
- deleteApiToken: {
1389
- parameters: {
1390
- query?: never;
1391
- header?: never;
1392
- path: {
1393
- /** @description The token ID (hash) */
1394
- id: string;
1395
- };
1396
- cookie?: never;
1397
- };
1398
- requestBody?: never;
1399
- responses: {
1400
- /** @description Token deleted successfully */
1401
- 200: {
1402
- headers: {
1403
- [name: string]: unknown;
1404
- };
1405
- content: {
1406
- "application/json": components["schemas"]["ApiResponse_Message"];
1407
- };
1408
- };
1409
- 401: components["responses"]["Unauthorized"];
1410
- 404: components["responses"]["NotFound"];
1411
- 500: components["responses"]["InternalError"];
1412
- };
1413
- };
1414
- }
1415
-
1416
- type ApiClient = Client<paths>;
1417
-
1418
- type DiskResponse = components["schemas"]["DiskResponse"];
1419
- type MountResponse = components["schemas"]["MountResponse"];
1420
- type MountConfigResponse = components["schemas"]["MountConfigResponse"];
1421
- type DiskMetrics = components["schemas"]["DiskMetrics"];
1422
- type ConnectedClient = components["schemas"]["ConnectedClient"];
1423
- type AuthorizedUser = components["schemas"]["AuthorizedUser"];
1424
- type CreateDiskRequest = components["schemas"]["CreateDiskRequest"];
1425
- type MountConfig = components["schemas"]["MountConfig"];
1426
- type S3Mount = components["schemas"]["S3Mount"];
1427
- type GCSMount = components["schemas"]["GCSMount"];
1428
- type R2Mount = components["schemas"]["R2Mount"];
1429
- type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
1430
- type AzureBlobMount = components["schemas"]["AzureBlobMount"];
1431
- type DiskUser = components["schemas"]["DiskUser"];
1432
- type TokenUser = components["schemas"]["TokenUser"];
1433
- type AwsStsUser = components["schemas"]["AwsStsUser"];
1434
- type CreateApiTokenRequest = components["schemas"]["CreateApiTokenRequest"];
1435
- type ApiTokenResponse = components["schemas"]["ApiTokenResponse"];
1436
- type ExecDiskResult = components["schemas"]["ExecDiskResult"];
1437
- type ExecRequest = components["schemas"]["ExecRequest"];
1438
- type GrepDiskResult = components["schemas"]["GrepDiskResult"];
1439
- type GrepMatch = components["schemas"]["GrepMatch"];
1440
- type GrepStoppedReason = components["schemas"]["GrepStoppedReason"];
1441
- type DiskStatus = DiskResponse["status"];
1442
-
1443
- interface MountOptions {
1444
- authToken?: string;
1445
- logLevel?: string;
1446
- serverAddress?: string;
1447
- insecure?: boolean;
1448
- }
1449
- type ExecResult = ExecDiskResult;
1450
- type GrepResult = GrepDiskResult;
1451
-
1452
- interface GrepOptions {
1453
- /**
1454
- * Directory on the disk to search, relative to the disk root. An empty
1455
- * string or "/" means the disk root.
1456
- */
1457
- directory: string;
1458
- /** Extended regular expression (passed to `grep -E`). */
1459
- pattern: string;
1460
- /** Walk subdirectories breadth-first. Defaults to false. */
1461
- recursive?: boolean;
1462
- /** Wall-clock deadline for the entire request. Defaults to 30s. */
1463
- maxDurationSeconds?: number;
1464
- /**
1465
- * Maximum number of parallel grep workers. Higher values finish larger
1466
- * datasets within the deadline but consume more runtime capacity. The
1467
- * controlplane clamps this to the fleet's currently-available capacity.
1468
- * Defaults to 50.
1469
- */
1470
- concurrency?: number;
1471
- /**
1472
- * Stop scanning once the aggregator has this many matches. Returned
1473
- * matches are a sample of whichever workers reported first, not the
1474
- * lexicographically first N. Defaults to 1000.
1475
- */
1476
- maxResults?: number;
1477
- }
1478
- interface ShareUrlOptions {
1479
- /**
1480
- * Lifetime of the URL in seconds — any positive integer, up to 604800
1481
- * (7 days). Defaults to 86400 (24 hours).
1482
- */
1483
- expiresIn?: number;
1484
- }
1485
- interface ShareUrlResult {
1486
- /** Public, signed, time-limited URL that downloads the file. */
1487
- url: string;
1488
- /** Lifetime of the URL in seconds. */
1489
- expiresIn: number;
1490
- }
1491
- interface ListObjectsOptions {
1492
- /**
1493
- * List the entire subtree under the prefix. When false (the default), only
1494
- * the immediate level is returned — direct objects in `objects` and
1495
- * subdirectory prefixes in `commonPrefixes`, like listing a single directory.
1496
- * When true, every key under the prefix is returned flat (and
1497
- * `commonPrefixes` is empty).
1498
- */
1499
- recursive?: boolean;
1500
- /**
1501
- * Return only the first page instead of auto-paginating. By default
1502
- * listObjects follows continuation tokens until the listing is exhausted and
1503
- * returns every matching key. With `singlePage: true` it makes one request
1504
- * and the result carries `isTruncated` / `nextContinuationToken` so you can
1505
- * page manually (pass the token back via `continuationToken`).
1506
- */
1507
- singlePage?: boolean;
1508
- /**
1509
- * Stop after this many objects total (only meaningful when auto-paginating).
1510
- * The result's `isTruncated` is true if the cap cut the listing short.
1511
- */
1512
- limit?: number;
1513
- /** Start listing from this continuation token (from a prior `nextContinuationToken`). */
1514
- continuationToken?: string;
1515
- /** Return keys lexicographically after this one. */
1516
- startAfter?: string;
1517
- }
1518
- interface S3Object {
1519
- /** Object key (path on the disk). */
1520
- key: string;
1521
- /** Size in bytes. */
1522
- size: number;
1523
- /** Entity tag (quoted MD5 for single-part objects). */
1524
- etag?: string;
1525
- /** Last-modified time, if reported by the server. */
1526
- lastModified?: Date;
1527
- }
1528
- interface PutObjectResult {
1529
- /** Entity tag the server assigned (quoted, per S3 — e.g. `"\"abc123\""`). */
1530
- etag?: string;
1531
- }
1532
- interface ObjectMetadata {
1533
- /** Size in bytes. */
1534
- size: number;
1535
- /** Entity tag (quoted MD5 for single-part objects). */
1536
- etag?: string;
1537
- /** MIME type the object was stored with, if any. */
1538
- contentType?: string;
1539
- /** Last-modified time, if reported by the server. */
1540
- lastModified?: Date;
1541
- }
1542
- interface ListObjectsResult {
1543
- /** Objects in this page. */
1544
- objects: S3Object[];
1545
- /** Directory-like prefixes rolled up by `delimiter` (empty if no delimiter). */
1546
- commonPrefixes: string[];
1547
- /** True if more keys exist beyond this page. */
1548
- isTruncated: boolean;
1549
- /** Token to pass as `continuationToken` to fetch the next page. */
1550
- nextContinuationToken?: string;
1551
- /** Number of keys returned in this page. */
1552
- keyCount: number;
1553
- /** The prefix the listing was filtered by, echoed back by the server. */
1554
- prefix?: string;
1555
- }
1556
- /** A part to list in {@link Disk.completeMultipartUpload}. */
1557
- interface UploadPart {
1558
- /** 1-based part number (1..=10000), strictly increasing across the list. */
1559
- partNumber: number;
1560
- /** Entity tag returned by {@link Disk.uploadPart} for this part. */
1561
- etag: string;
1562
- }
1563
- /** Handle to an in-progress multipart upload, returned by {@link Disk.createMultipartUpload}. */
1564
- interface MultipartUpload {
1565
- /** Server-assigned upload id; pass to uploadPart/complete/abort/listParts. */
1566
- uploadId: string;
1567
- /** The object key this upload targets. */
1568
- key: string;
1569
- /** The bucket (disk id) the upload lives in. */
1570
- bucket: string;
1571
- }
1572
- /** The assembled object, returned by {@link Disk.completeMultipartUpload}. */
1573
- interface CompletedMultipartUpload {
1574
- /** Multipart entity tag — S3's `md5(concat(partMd5s))-N` form. */
1575
- etag?: string;
1576
- /** Resource path of the completed object. */
1577
- location?: string;
1578
- /** The bucket (disk id). */
1579
- bucket?: string;
1580
- /** The object key. */
1581
- key?: string;
1582
- }
1583
- /** One part in a {@link Disk.listParts} listing. */
1584
- interface PartInfo {
1585
- /** 1-based part number. */
1586
- partNumber: number;
1587
- /** Entity tag the server assigned to this part. */
1588
- etag?: string;
1589
- /** Size in bytes. */
1590
- size: number;
1591
- /** Time the part was uploaded, if reported. */
1592
- lastModified?: Date;
1593
- }
1594
- interface ListPartsOptions {
1595
- /** Cap parts returned in one page (server clamps to 1000). */
1596
- maxParts?: number;
1597
- /** Return parts after this part number (for pagination). */
1598
- partNumberMarker?: number;
1599
- }
1600
- interface PartListing {
1601
- /** The bucket (disk id), echoed by the server. */
1602
- bucket?: string;
1603
- /** The object key, echoed by the server. */
1604
- key?: string;
1605
- /** The upload id, echoed by the server. */
1606
- uploadId?: string;
1607
- /** Parts in this page, ascending by part number. */
1608
- parts: PartInfo[];
1609
- /** True if more parts exist beyond this page. */
1610
- isTruncated: boolean;
1611
- /** The part-number marker this page started after. */
1612
- partNumberMarker: number;
1613
- /** Pass back as `partNumberMarker` to fetch the next page. */
1614
- nextPartNumberMarker?: number;
1615
- /** Max parts the server was asked to return. */
1616
- maxParts: number;
1617
- }
1618
- /** One in-progress upload in a {@link Disk.listMultipartUploads} listing. */
1619
- interface MultipartUploadSummary {
1620
- /** The object key the upload targets. */
1621
- key: string;
1622
- /** The upload id. */
1623
- uploadId: string;
1624
- /** When the upload was initiated, if reported. */
1625
- initiated?: Date;
1626
- }
1627
- interface ListMultipartUploadsOptions {
1628
- /** Only list uploads whose key begins with this prefix. */
1629
- prefix?: string;
1630
- /** Roll keys up to this delimiter into `commonPrefixes` (S3 supports "/"). */
1631
- delimiter?: string;
1632
- /** Resume listing keys after this one (with `uploadIdMarker`). */
1633
- keyMarker?: string;
1634
- /** Resume listing uploads after this upload id (requires `keyMarker`). */
1635
- uploadIdMarker?: string;
1636
- /** Cap uploads returned in one page (server clamps to 1000). */
1637
- maxUploads?: number;
1638
- }
1639
- interface MultipartUploadListing {
1640
- /** The bucket (disk id), echoed by the server. */
1641
- bucket?: string;
1642
- /** In-progress uploads in this page. */
1643
- uploads: MultipartUploadSummary[];
1644
- /** Key prefixes rolled up by `delimiter` (empty if no delimiter). */
1645
- commonPrefixes: string[];
1646
- /** True if more uploads exist beyond this page. */
1647
- isTruncated: boolean;
1648
- /** The key marker this page started after, echoed back. */
1649
- keyMarker?: string;
1650
- /** The upload-id marker this page started after, echoed back. */
1651
- uploadIdMarker?: string;
1652
- /** Pass back as `keyMarker` (with `nextUploadIdMarker`) for the next page. */
1653
- nextKeyMarker?: string;
1654
- /** Pass back as `uploadIdMarker` (with `nextKeyMarker`) for the next page. */
1655
- nextUploadIdMarker?: string;
1656
- /** The prefix the listing was filtered by, echoed back. */
1657
- prefix?: string;
1658
- /** The delimiter used, echoed back. */
1659
- delimiter?: string;
1660
- /** Max uploads the server was asked to return. */
1661
- maxUploads?: number;
1662
- }
1663
- interface DeleteObjectsOptions {
1664
- /**
1665
- * Quiet mode: the server omits the per-key success list and returns only
1666
- * failures, so the result's `deleted` array is empty. Cuts response size on
1667
- * large batches. Defaults to false.
1668
- */
1669
- quiet?: boolean;
1670
- }
1671
- /** A single per-key failure within a {@link Disk.deleteObjects} batch. */
1672
- interface DeleteObjectsError {
1673
- /** The key that failed to delete. */
1674
- key: string;
1675
- /** S3 error code (e.g. "AccessDenied", "OperationAborted"), if provided. */
1676
- code?: string;
1677
- /** Human-readable failure detail, if provided. */
1678
- message?: string;
1679
- }
1680
- interface DeleteObjectsResult {
1681
- /** Keys the server confirmed deleted (empty in quiet mode). */
1682
- deleted: string[];
1683
- /** Per-key failures; empty when every key was deleted. */
1684
- errors: DeleteObjectsError[];
1685
- }
1686
- interface PutObjectOptions {
1687
- /** MIME type to store the object with. Default "application/octet-stream". */
1688
- contentType?: string;
1689
- /**
1690
- * Bodies larger than this take the multipart path; bodies at or below it take
1691
- * a single PutObject. Defaults to `partSize` (16 MiB), so by default the
1692
- * switch happens at the part size. Set it lower (e.g. 5 MiB) to start using
1693
- * multipart sooner, or to `Infinity` to force a single PutObject.
1694
- */
1695
- multipartThreshold?: number;
1696
- /**
1697
- * Bytes per part on the multipart path. Clamped to a minimum of 5 MiB (the S3
1698
- * floor for every part but the last). Default 16 MiB.
1699
- */
1700
- partSize?: number;
1701
- /** Max parts uploaded in parallel on the multipart path. Default 4. */
1702
- concurrency?: number;
1703
- }
1704
- /**
1705
- * The S3 transport function {@link DiskMultipart} uses, supplied by the owning
1706
- * {@link Disk} so the namespace shares the disk's credential and endpoint.
1707
- * @internal
1708
- */
1709
- type S3RequestFn = (method: "GET" | "PUT" | "DELETE" | "HEAD" | "POST", key: string, opts?: {
1710
- body?: string | Uint8Array | ArrayBuffer;
1711
- contentType?: string;
1712
- query?: Record<string, string | number>;
1713
- retry?: boolean;
1714
- }) => Promise<{
1715
- ok: boolean;
1716
- status: number;
1717
- statusText: string;
1718
- headers: Headers;
1719
- body: Uint8Array;
1720
- }>;
1721
- declare class Disk {
1722
- readonly id: string;
1723
- readonly name: string;
1724
- readonly organization: string;
1725
- readonly status: DiskStatus;
1726
- readonly provider: string;
1727
- readonly region: string;
1728
- readonly createdAt: string;
1729
- readonly fsHandlerStatus?: string;
1730
- readonly lastAccessed?: string;
1731
- readonly dataSize?: number;
1732
- readonly monthlyUsage?: string;
1733
- readonly mounts?: MountResponse[];
1734
- readonly metrics?: DiskMetrics;
1735
- readonly connectedClients?: ConnectedClient[];
1736
- readonly authorizedUsers?: AuthorizedUser[];
1737
- readonly allowedIps?: string[];
1738
- /** @internal */
1739
- private readonly _client;
1740
- /** @internal */
1741
- private readonly _archilRegion;
1742
- /** Base URL for the S3-compatible API (port 9000 ingress). Empty if unset. */
1743
- private readonly _s3BaseUrl;
1744
- /** Lazily-constructed multipart namespace (see {@link multipart}). @internal */
1745
- private _multipart?;
1746
- /** @internal */
1747
- constructor(data: DiskResponse, client: ApiClient, archilRegion: string, s3BaseUrl?: string);
1748
- toJSON(): DiskResponse;
1749
- addUser(user: DiskUser): Promise<AuthorizedUser>;
1750
- removeUser(userType: "token" | "awssts", identifier: string): Promise<void>;
1751
- createToken(nickname: string): Promise<AuthorizedUser & {
1752
- token: string;
1753
- identifier: string;
1754
- }>;
1755
- removeTokenUser(identifier: string): Promise<void>;
1756
- getAllowedIPs(): Promise<string[]>;
1757
- setAllowedIPs(allowedIps: string[]): Promise<string[]>;
1758
- addAllowedIP(ip: string): Promise<string[]>;
1759
- removeAllowedIP(ip: string): Promise<string[]>;
1760
- delete(): Promise<void>;
1761
- /**
1762
- * Execute a command in a container with this disk mounted.
1763
- * Blocks until the command completes and returns stdout, stderr, and exit code.
1764
- */
1765
- exec(command: string): Promise<ExecResult>;
1766
- /**
1767
- * Constant-time parallel grep across files on this disk. Listing and
1768
- * matching are fanned out across ephemeral exec containers; the request
1769
- * finishes within the supplied time budget regardless of dataset size.
1770
- *
1771
- * The returned `stoppedReason` says whether the search ran to completion
1772
- * or short-circuited on `maxResults` / `maxDurationSeconds`. When
1773
- * stopping early, the matches returned are a sample (whichever workers
1774
- * reported first), not the lexicographically first N.
1775
- */
1776
- grep(opts: GrepOptions): Promise<GrepResult>;
1777
- /**
1778
- * Create a signed, time-limited URL that lets anyone download a single file
1779
- * from this disk without authentication. The returned URL embeds a
1780
- * cryptographically signed token carrying the disk, the file's key, and an
1781
- * expiry — share it directly; no API key is needed to redeem it.
1782
- *
1783
- * @param key Path to the file on the disk (e.g. "reports/2026-01/data.pdf").
1784
- * @param opts `expiresIn` sets the URL lifetime in seconds (any positive
1785
- * integer, max 604800 = 7 days). Defaults to 24h.
1786
- */
1787
- share(key: string, opts?: ShareUrlOptions): Promise<ShareUrlResult>;
1788
- /**
1789
- * Read an object from the disk via the S3-compatible GetObject API and return
1790
- * its full contents as bytes. Throws `ArchilS3Error` if the object does not
1791
- * exist (status 404, code "NoSuchKey") or the request is rejected; use
1792
- * `headObject`/`objectExists` to check existence without throwing.
1793
- *
1794
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1795
- */
1796
- getObject(key: string): Promise<Uint8Array>;
1797
- /**
1798
- * Fetch an object's metadata (size, etag, content type, last-modified) without
1799
- * downloading its contents, via the S3-compatible HeadObject API. Returns
1800
- * `null` if the object does not exist.
1801
- *
1802
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1803
- */
1804
- headObject(key: string): Promise<ObjectMetadata | null>;
1805
- /** Whether an object exists on the disk (a HeadObject that maps 404 → false). */
1806
- objectExists(key: string): Promise<boolean>;
1807
- /**
1808
- * Write an object to the disk via the S3-compatible API. Handles any size:
1809
- * bodies at or below `multipartThreshold` (defaults to `partSize`, i.e.
1810
- * 16 MiB) go through a single PutObject request; larger bodies are uploaded as
1811
- * a multipart upload — split into `partSize` parts, uploaded with bounded
1812
- * `concurrency` (default 4), and assembled. A failed part aborts the upload so
1813
- * nothing is left half-staged. For manual control over the multipart
1814
- * lifecycle, use the {@link multipart} namespace.
1815
- *
1816
- * Faster than exec for large files — no container overhead, no command-length
1817
- * limits. Returns the entity tag the server assigned (a multipart upload's tag
1818
- * is S3's `md5(concat(partMd5s))-N` form rather than a plain MD5).
1819
- *
1820
- * @param key Path on the disk (e.g. "reports/2026-01/data.json")
1821
- * @param body Contents as a string, Uint8Array/Buffer, or ArrayBuffer
1822
- * @param options Either a content-type string, or {@link PutObjectOptions}
1823
- * (`contentType`, `multipartThreshold`, `partSize`,
1824
- * `concurrency`). Content type defaults to
1825
- * "application/octet-stream".
1826
- */
1827
- putObject(key: string, body: string | Uint8Array | ArrayBuffer, options?: string | PutObjectOptions): Promise<PutObjectResult>;
1828
- /**
1829
- * Upload a large body through the multipart lifecycle: split into `partSize`
1830
- * parts, upload them with bounded concurrency, then complete — aborting the
1831
- * upload if any part fails so nothing is left half-staged. @internal
1832
- */
1833
- private _putMultipart;
1834
- /**
1835
- * Append bytes to an object via the S3-compatible PutObject append extension
1836
- * (`?append=true`). If the object already exists the bytes are appended to it;
1837
- * if it doesn't, it is created. Returns the entity tag of the full object
1838
- * after the append.
1839
- *
1840
- * Each call may append at most 1 MiB — the server rejects a larger body with
1841
- * `EntityTooLarge`. To grow an object past that, append in chunks (or use
1842
- * {@link putObject} for a one-shot large write).
1843
- *
1844
- * Unlike most operations this is NOT auto-retried on a transient error:
1845
- * append isn't idempotent, so retrying a succeeded-but-unacknowledged append
1846
- * would duplicate the bytes. On a transient failure, re-append yourself only
1847
- * after confirming the object's size.
1848
- *
1849
- * @param key Path on the disk (e.g. "logs/app.log")
1850
- * @param body Bytes to append (string, Uint8Array/Buffer, or ArrayBuffer)
1851
- * @param contentType MIME type, applied only when the object is newly created.
1852
- */
1853
- appendObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
1854
- /**
1855
- * Delete an object from the disk via the S3-compatible DeleteObject API.
1856
- * Idempotent: deleting a key that doesn't exist resolves successfully, per
1857
- * S3 semantics.
1858
- *
1859
- * @param key Path on the disk (e.g. "project/dist/server.cjs")
1860
- */
1861
- deleteObject(key: string): Promise<void>;
1862
- /**
1863
- * List objects on the disk via the S3-compatible ListObjectsV2 API. By
1864
- * default this follows continuation tokens until the listing is exhausted and
1865
- * returns every matching key. Use `limit` to cap the total, `singlePage` for a
1866
- * single request, or {@link listObjectsPages} to stream pages without loading
1867
- * everything into memory.
1868
- *
1869
- * @param prefix Only return keys beginning with this prefix (omit for all).
1870
- * @param opts Listing and pagination options.
1871
- */
1872
- listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
1873
- /**
1874
- * Yield ListObjectsV2 pages lazily, following continuation tokens. A
1875
- * memory-friendly way to process a large listing without materializing it:
1876
- *
1877
- * ```ts
1878
- * for await (const page of disk.listObjectsPages("logs/")) {
1879
- * for (const obj of page.objects) process(obj);
1880
- * }
1881
- * ```
1882
- *
1883
- * @param prefix Only return keys beginning with this prefix (omit for all).
1884
- * @param opts Listing options (`limit` / `singlePage` are ignored here —
1885
- * control your own loop).
1886
- */
1887
- listObjectsPages(prefix?: string, opts?: ListObjectsOptions): AsyncGenerator<ListObjectsResult>;
1888
- /** Fetch a single ListObjectsV2 page. @internal */
1889
- private _listObjectsPage;
1890
- /**
1891
- * Delete up to many objects in a single S3-compatible DeleteObjects request.
1892
- * Unlike {@link deleteObject}, failures are reported per key rather than
1893
- * thrown: the result's `deleted` lists the keys that were removed and
1894
- * `errors` lists the ones that weren't (with the server's code/message). A
1895
- * key that didn't exist still counts as deleted, per S3 semantics.
1896
- *
1897
- * The server caps a single request at 1000 keys; this method transparently
1898
- * splits larger inputs into 1000-key batches and merges the results.
1899
- *
1900
- * @param keys Object keys to delete.
1901
- * @param opts `quiet` suppresses the per-key success list server-side.
1902
- */
1903
- deleteObjects(keys: string[], opts?: DeleteObjectsOptions): Promise<DeleteObjectsResult>;
1904
- /**
1905
- * The advanced, opt-in multipart-upload API. Drive the raw lifecycle
1906
- * yourself — `create` → `uploadPart` → `complete` (or `abort`), plus
1907
- * `listParts` / `listUploads`. Most callers don't need this: {@link putObject}
1908
- * runs the whole lifecycle automatically for large bodies. Reach for it only
1909
- * when you need manual control (e.g. uploading parts from separate processes),
1910
- * and note you then own part-size, memory, and concurrency management.
1911
- */
1912
- get multipart(): DiskMultipart;
1913
- /**
1914
- * Send a single request to the disk's S3-compatible endpoint. This reuses the
1915
- * control-plane client purely for its credential and transport — the same
1916
- * `Authorization` header is sent and verified by the same code server-side —
1917
- * pointed at the S3 host. Returns the response status and fully-buffered body
1918
- * so callers can inspect both regardless of the verb used.
1919
- *
1920
- * The S3 routes (`/{diskId}/{key}` for objects, `/{diskId}` for the bucket)
1921
- * are not part of the typed control-plane API, so the path and per-request
1922
- * options are passed untyped. An empty `key` targets the bucket itself (used
1923
- * by listObjects).
1924
- *
1925
- * @internal
1926
- */
1927
- private _s3Request;
1928
- /**
1929
- * Connect to this disk's data plane via the native ArchilClient.
1930
- *
1931
- * Requires the native module to be available (platform-specific .node binary).
1932
- */
1933
- mount(opts?: MountOptions): Promise<unknown>;
1934
- }
1935
- /**
1936
- * The advanced, opt-in multipart-upload namespace, reached via {@link Disk.multipart}.
1937
- * Drives the raw S3 multipart lifecycle — `create` → `uploadPart` → `complete`
1938
- * (or `abort`), plus `listParts` / `listUploads`. Prefer {@link Disk.putObject},
1939
- * which runs this lifecycle automatically for large bodies; use this only when
1940
- * you need manual control, in which case you own part-size, memory, and
1941
- * concurrency management.
1942
- */
1943
- declare class DiskMultipart {
1944
- private readonly diskId;
1945
- private readonly s3Request;
1946
- /** @internal */
1947
- constructor(diskId: string, s3Request: S3RequestFn);
1948
- /**
1949
- * Start a multipart upload (CreateMultipartUpload) and return its `uploadId`.
1950
- *
1951
- * @param key Path on the disk the finished object will live at.
1952
- * @param contentType MIME type to store the object with.
1953
- */
1954
- create(key: string, contentType?: string): Promise<MultipartUpload>;
1955
- /**
1956
- * Upload one part (UploadPart) and return its entity tag, which you must
1957
- * collect (with its part number) and pass to {@link complete}. Every part
1958
- * except the last must be at least 5 MiB.
1959
- *
1960
- * @param key The upload's object key.
1961
- * @param uploadId The id from {@link create}.
1962
- * @param partNumber 1-based part number (1..=10000).
1963
- * @param body Part contents as a string, Uint8Array/Buffer, or ArrayBuffer.
1964
- */
1965
- uploadPart(key: string, uploadId: string, partNumber: number, body: string | Uint8Array | ArrayBuffer): Promise<UploadPart>;
1966
- /**
1967
- * Finish a multipart upload (CompleteMultipartUpload), assembling the listed
1968
- * parts into one object. Parts are sorted by part number before submission
1969
- * (the server requires strictly-increasing order).
1970
- *
1971
- * Unlike the other operations this is NOT auto-retried on a transient error:
1972
- * the gateway isn't idempotent for completion, so a retry after a
1973
- * successful-but-unacknowledged complete would return a spurious NoSuchUpload.
1974
- * On a transient failure, re-drive completion yourself only after confirming
1975
- * the object isn't already present.
1976
- *
1977
- * @param key The upload's object key.
1978
- * @param uploadId The id from {@link create}.
1979
- * @param parts The `{ partNumber, etag }` pairs from {@link uploadPart}.
1980
- */
1981
- complete(key: string, uploadId: string, parts: UploadPart[]): Promise<CompletedMultipartUpload>;
1982
- /**
1983
- * Abort a multipart upload (AbortMultipartUpload), discarding every staged
1984
- * part. Idempotent against an upload that's already gone (404 / NoSuchUpload
1985
- * resolves successfully).
1986
- *
1987
- * @param key The upload's object key.
1988
- * @param uploadId The id from {@link create}.
1989
- */
1990
- abort(key: string, uploadId: string): Promise<void>;
1991
- /**
1992
- * List the parts already uploaded for an in-progress upload (ListParts).
1993
- * Returns a single page; follow `nextPartNumberMarker` (when `isTruncated`)
1994
- * to page through the rest.
1995
- *
1996
- * @param key The upload's object key.
1997
- * @param uploadId The id from {@link create}.
1998
- * @param opts `maxParts` / `partNumberMarker` pagination controls.
1999
- */
2000
- listParts(key: string, uploadId: string, opts?: ListPartsOptions): Promise<PartListing>;
2001
- /**
2002
- * List in-progress multipart uploads on the disk (ListMultipartUploads).
2003
- * Returns a single page; follow `nextKeyMarker` / `nextUploadIdMarker` (when
2004
- * `isTruncated`) for the rest.
2005
- *
2006
- * @param opts Prefix/delimiter filter and pagination markers.
2007
- */
2008
- listUploads(opts?: ListMultipartUploadsOptions): Promise<MultipartUploadListing>;
2009
- }
2010
- /**
2011
- * Choose the part size for a `totalBytes` multipart upload. Returns
2012
- * `requestedPartSize` unless splitting at that size would exceed the server's
2013
- * 10,000-part cap, in which case it grows the part size (rounded up to a whole
2014
- * MiB) so the body fits in ≤ 10,000 parts — mirroring boto3's chunk-size
2015
- * adjustment. Parts only ever get larger, so they stay above the 5 MiB floor.
2016
- */
2017
- declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
1
+ import { A as AwsStsUser, B as ExecRequest, C as S3Object, D as effectiveUploadPartSize, E as UploadPart, F as DiskMetrics, G as MountConfigResponse, H as GrepMatch, I as DiskResponse, J as S3CompatibleMount, K as MountResponse, L as DiskStatus, M as ConnectedClient, N as CreateApiTokenRequest, O as ApiTokenResponse, P as CreateDiskRequest, Q as ApiClient, R as DiskUser, S as PutObjectResult, T as ShareUrlResult, U as GrepStoppedReason, V as GCSMount, W as MountConfig, X as TokenUser, Y as S3Mount, Z as FileSystem, _ as MultipartUploadSummary, a as Disk, b as PartListing, c as GrepOptions, d as ListObjectsOptions, f as ListObjectsResult, g as MultipartUploadListing, h as MultipartUpload, i as DeleteObjectsResult, j as AzureBlobMount, k as AuthorizedUser, l as GrepResult, m as MountOptions, n as DeleteObjectsError, o as DiskMultipart, p as ListPartsOptions, q as R2Mount, r as DeleteObjectsOptions, s as ExecResult, t as CompletedMultipartUpload, u as ListMultipartUploadsOptions, v as ObjectMetadata, w as ShareUrlOptions, x as PutObjectOptions, y as PartInfo, z as ExecDiskResult } from "./disk-BLF7FFqG.cjs";
2018
2
 
3
+ //#region src/disks.d.ts
2019
4
  interface ListDisksOptions {
2020
- limit?: number;
2021
- cursor?: string;
2022
- name?: string;
5
+ limit?: number;
6
+ cursor?: string;
7
+ name?: string;
2023
8
  }
2024
9
  interface CreateDiskResult {
2025
- disk: Disk;
2026
- token: string | null;
2027
- tokenIdentifier: string | null;
2028
- authorizedUsers: AuthorizedUser[];
10
+ disk: Disk;
11
+ token: string | null;
12
+ tokenIdentifier: string | null;
13
+ authorizedUsers: AuthorizedUser[];
2029
14
  }
2030
15
  declare class Disks {
2031
- /** @internal */
2032
- private readonly _client;
2033
- /** @internal */
2034
- private readonly _region;
2035
- /** @internal */
2036
- private readonly _s3BaseUrl?;
2037
- /** @internal */
2038
- constructor(client: ApiClient, region: string, s3BaseUrl?: string);
2039
- list(opts?: ListDisksOptions): Promise<Disk[]>;
2040
- get(id: string): Promise<Disk>;
2041
- /**
2042
- * Create a new disk with an auto-generated mount token.
2043
- *
2044
- * Returns the Disk, the one-time token (save it — it cannot be retrieved
2045
- * again), and the token identifier for later management.
2046
- */
2047
- create(req: CreateDiskRequest): Promise<CreateDiskResult>;
2048
- }
2049
-
16
+ /** @internal */
17
+ private readonly _client;
18
+ /** @internal */
19
+ private readonly _region;
20
+ /** @internal */
21
+ private readonly _s3BaseUrl?;
22
+ /** @internal */
23
+ constructor(client: ApiClient, region: string, s3BaseUrl?: string);
24
+ list(opts?: ListDisksOptions): Promise<Disk[]>;
25
+ get(id: string): Promise<Disk>;
26
+ /**
27
+ * Create a new disk with an auto-generated mount token.
28
+ *
29
+ * Returns the Disk, the one-time token (save it — it cannot be retrieved
30
+ * again), and the token identifier for later management.
31
+ */
32
+ create(req: CreateDiskRequest): Promise<CreateDiskResult>;
33
+ }
34
+ //#endregion
35
+ //#region src/tokens.d.ts
2050
36
  interface ListTokensOptions {
2051
- limit?: number;
2052
- cursor?: string;
37
+ limit?: number;
38
+ cursor?: string;
2053
39
  }
2054
40
  declare class Tokens {
2055
- /** @internal */
2056
- private readonly _client;
2057
- /** @internal */
2058
- constructor(client: ApiClient);
2059
- list(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
2060
- create(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
2061
- token?: string;
2062
- }>;
2063
- delete(id: string): Promise<void>;
41
+ /** @internal */
42
+ private readonly _client;
43
+ /** @internal */
44
+ constructor(client: ApiClient);
45
+ list(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
46
+ create(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
47
+ token?: string;
48
+ }>;
49
+ delete(id: string): Promise<void>;
2064
50
  }
2065
-
51
+ //#endregion
52
+ //#region src/workspace.d.ts
53
+ /** Anything that can run a multi-disk exec — i.e. an `Archil` client. A narrow
54
+ * structural type so this module doesn't import the Archil class (avoiding a
55
+ * value-import cycle with archil.ts). */
56
+ interface WorkspaceExecCapable {
57
+ exec(opts: ExecOptions): Promise<ExecResult>;
58
+ }
59
+ /**
60
+ * A key-routed filesystem spanning several Archil disks. Each disk is mounted
61
+ * under a name and addressed as the first segment of a key (`<name>/...`);
62
+ * `getObject`, `putObject`, `deleteObject`, `listObjects`, and `grep` route to
63
+ * the right disk by that segment (and `listObjects` / `grep` fan out across all
64
+ * of them when the key/prefix doesn't name one). Implements the same
65
+ * {@link FileSystem} surface as a single {@link Disk}, so it works anywhere a
66
+ * disk does. Mounts can be changed at runtime with {@link addDisk} /
67
+ * {@link removeDisk}.
68
+ */
69
+ declare class Workspace implements FileSystem {
70
+ private readonly client;
71
+ private readonly mounts;
72
+ /** @internal Use `archil.workspace({ ... })`. */
73
+ constructor(client: WorkspaceExecCapable, mounts: Record<string, ExecMount>);
74
+ /** Mount (or replace) a disk at `name`; its objects are addressed as
75
+ * `<name>/...`. Accepts a `Disk` or a mount spec (read-only / subdirectory /
76
+ * conditional / delegation checkouts); a bare disk-id string is rejected —
77
+ * fetch the disk first. */
78
+ addDisk(name: string, disk: ExecMount): this;
79
+ /** Unmount the disk at `name`. Returns whether a disk was removed. Refuses to
80
+ * remove the last disk — a workspace must always have at least one (the same
81
+ * invariant the constructor enforces), else fan-out/exec would have nothing to
82
+ * route to. */
83
+ removeDisk(name: string): boolean;
84
+ /** The names of the currently-mounted disks. */
85
+ diskNames(): string[];
86
+ private unknownDisk;
87
+ /** Resolve a workspace key (`<name>/...`) to the disk and the disk-relative key. */
88
+ private route;
89
+ /** Mounts touched by a key prefix; an empty prefix fans out to all of them. */
90
+ private covered;
91
+ /** Map a workspace-relative key to the disk's key, applying the mount's subdirectory. */
92
+ private diskKey;
93
+ /** Map a disk key back to its workspace key (`<name>/...`), stripping the mount subdirectory. */
94
+ private abs;
95
+ getObject(key: string): Promise<Uint8Array>;
96
+ putObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
97
+ deleteObject(key: string): Promise<void>;
98
+ listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
99
+ grep(opts: GrepOptions): Promise<GrepResult>;
100
+ exec(command: string): Promise<ExecResult>;
101
+ }
102
+ //#endregion
103
+ //#region src/archil.d.ts
2066
104
  interface ArchilOptions {
2067
- /** API key. Falls back to ARCHIL_API_KEY env var if not provided. */
2068
- apiKey?: string;
2069
- /** Region. Falls back to ARCHIL_REGION env var if not provided. */
2070
- region?: string;
2071
- /** Override the control plane base URL (useful for testing). */
2072
- baseUrl?: string;
2073
- /**
2074
- * Override the S3-compatible API base URL used by Disk#getObject /
2075
- * putObject / deleteObject. Falls back to ARCHIL_S3_BASE_URL, then to the
2076
- * control plane URL with its `control.` hostname prefix swapped for `s3.`.
2077
- */
2078
- s3BaseUrl?: string;
105
+ /** API key. Falls back to ARCHIL_API_KEY env var if not provided. */
106
+ apiKey?: string;
107
+ /** Region. Falls back to ARCHIL_REGION env var if not provided. */
108
+ region?: string;
109
+ /** Override the control plane base URL (useful for testing). */
110
+ baseUrl?: string;
111
+ /**
112
+ * Override the S3-compatible API base URL used by Disk#getObject /
113
+ * putObject / deleteObject. Falls back to ARCHIL_S3_BASE_URL, then to the
114
+ * control plane URL with its `control.` hostname prefix swapped for `s3.`.
115
+ */
116
+ s3BaseUrl?: string;
2079
117
  }
2080
118
  /**
2081
119
  * Options that apply to a single mounted disk in an exec request.
2082
- * Use this object form when you need to pin the mount to a subdirectoryectory
2083
- * of the disk and/or mount it read-only; for the default case (mount
2084
- * the disk's root, read-write), pass a `Disk` or disk-id string instead.
120
+ * Use this object form when you need to pin the mount to a subdirectory
121
+ * of the disk, mount it read-only, mount it in conditional mode, or request
122
+ * delegation checkouts; for the default case (mount the disk's root,
123
+ * read-write with no checkout), pass a `Disk` or disk-id string instead.
2085
124
  */
2086
125
  interface ExecMountSpec {
2087
- /** Disk to mount, by `Disk` instance or raw disk id string. */
2088
- disk: Disk | string;
2089
- /**
2090
- * Subdirectory of the disk to expose at the mountpoint. Must be a
2091
- * relative path with no `.` or `..` segments. When omitted, the disk's
2092
- * root is exposed.
2093
- */
2094
- subdirectory?: string;
2095
- /**
2096
- * When true, mount the disk read-only inside the container. Writes
2097
- * against the mount fail with EROFS. Defaults to false.
2098
- */
2099
- readOnly?: boolean;
126
+ /** Disk to mount, by `Disk` instance or raw disk id string. */
127
+ disk: Disk | string;
128
+ /**
129
+ * Subdirectory of the disk to expose at the mountpoint. Must be a
130
+ * relative path with no `.` or `..` segments. When omitted, the disk's
131
+ * root is exposed.
132
+ */
133
+ subdirectory?: string;
134
+ /**
135
+ * When true, mount the disk read-only inside the container. Writes
136
+ * against the mount fail with EROFS. Defaults to false.
137
+ */
138
+ readOnly?: boolean;
139
+ /**
140
+ * When true, mount the disk in conditional mode, where mutating operations
141
+ * are sent directly to the server without a delegation checkout. This
142
+ * enables concurrent writes from multiple clients to the same disk.
143
+ * Defaults to false.
144
+ */
145
+ conditional?: boolean;
146
+ /**
147
+ * Milliseconds to wait in the delegation queue for each requested checkout.
148
+ * If set without `checkoutPaths`, the exposed mount root is acquired during
149
+ * mount setup. Cannot be combined with `readOnly: true`.
150
+ */
151
+ queueMs?: number;
152
+ /**
153
+ * Paths relative to this disk's exposed mount root to check out before the
154
+ * command starts. May be set without `queueMs`; those checkouts try
155
+ * immediately without waiting in the delegation queue. Cannot be combined
156
+ * with `readOnly: true`.
157
+ */
158
+ checkoutPaths?: string[];
2100
159
  }
2101
160
  /**
2102
161
  * One disk to mount in an exec request. Either a `Disk`/disk-id string
2103
162
  * (mounts the disk's root, read-write) or an `ExecMountSpec` object that
2104
- * additionally selects a subdirectoryectory of the disk and/or marks the mount
2105
- * as read-only. Used by Archil#exec the map key is the relative path
2106
- * under /mnt/archil at which to mount the disk.
163
+ * additionally selects a subdirectory of the disk and/or marks the mount as
164
+ * read-only, conditional, or requests delegation checkouts. Used
165
+ * by Archil#exec, where the map key is the relative path under /mnt/archil at
166
+ * which to mount the disk.
2107
167
  */
2108
168
  type ExecMount = Disk | string | ExecMountSpec;
2109
169
  interface ExecOptions {
2110
- /**
2111
- * Disks to mount, keyed by the relative path under `/mnt/archil` at which
2112
- * to mount each one. At least one entry is required. Paths must be
2113
- * non-empty, non-absolute, and contain no `.` or `..` segments.
2114
- */
2115
- disks: Record<string, ExecMount>;
2116
- /** Shell command to run inside the container. */
2117
- command: string;
170
+ /**
171
+ * Disks to mount, keyed by the relative path under `/mnt/archil` at which
172
+ * to mount each one. At least one entry is required. Paths must be
173
+ * non-empty, non-absolute, and contain no `.` or `..` segments.
174
+ */
175
+ disks: Record<string, ExecMount>;
176
+ /** Shell command to run inside the container. */
177
+ command: string;
2118
178
  }
2119
179
  declare class Archil {
2120
- readonly disks: Disks;
2121
- readonly tokens: Tokens;
2122
- /** @internal */
2123
- private readonly _client;
2124
- constructor(opts?: ArchilOptions);
2125
- /**
2126
- * Run a command in a container with multiple disks mounted simultaneously,
2127
- * each at its own relative path under `/mnt/archil`. Blocks until the
2128
- * command completes and returns its stdout, stderr, exit code, and timing.
2129
- */
2130
- exec(opts: ExecOptions): Promise<ExecDiskResult>;
2131
- }
2132
-
180
+ readonly disks: Disks;
181
+ readonly tokens: Tokens;
182
+ /** @internal */
183
+ private readonly _client;
184
+ constructor(opts?: ArchilOptions);
185
+ /**
186
+ * Run a command in a container with multiple disks mounted simultaneously,
187
+ * each at its own relative path under `/mnt/archil`. Blocks until the
188
+ * command completes and returns its stdout, stderr, exit code, and timing.
189
+ */
190
+ exec(opts: ExecOptions): Promise<ExecDiskResult>;
191
+ /**
192
+ * Build an agent filesystem toolset spanning several disks at once. `mounts`
193
+ * maps a relative path to a disk (or `ExecMountSpec`), exactly like
194
+ * {@link exec}; each disk appears under `/mnt/archil/<path>`. Hand the result
195
+ * to a framework adapter (`createDiskTools(workspace)`) to get tools that route
196
+ * file operations by path and fan `grep`/`list_files` out across the disks.
197
+ */
198
+ workspace(mounts: Record<string, ExecMount>): Workspace;
199
+ }
200
+ //#endregion
201
+ //#region src/errors.d.ts
2133
202
  /**
2134
203
  * Base class for every error the SDK throws. Catch with `instanceof ArchilError`
2135
204
  * to handle control-plane and S3 failures uniformly; `status` is the HTTP status
2136
205
  * code and `code` a machine-readable error code when the server provided one.
2137
206
  */
2138
207
  declare class ArchilError extends Error {
2139
- /** HTTP status code associated with the failure. */
2140
- readonly status: number;
2141
- /** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
2142
- readonly code?: string;
2143
- constructor(message: string, status: number, code?: string);
208
+ /** HTTP status code associated with the failure. */
209
+ readonly status: number;
210
+ /** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
211
+ readonly code?: string;
212
+ constructor(message: string, status: number, code?: string);
2144
213
  }
2145
214
  /** Error from the control-plane REST API. */
2146
215
  declare class ArchilApiError extends ArchilError {
2147
- constructor(message: string, status: number, code?: string);
216
+ constructor(message: string, status: number, code?: string);
2148
217
  }
2149
218
  /**
2150
219
  * Error from the S3-compatible object API (getObject/putObject/deleteObject/
@@ -2153,31 +222,33 @@ declare class ArchilApiError extends ArchilError {
2153
222
  * rather than a raw blob, while keeping the full body on `raw` for debugging.
2154
223
  */
2155
224
  declare class ArchilS3Error extends ArchilError {
2156
- /** S3 request id, if the gateway returned one. */
2157
- readonly requestId?: string;
2158
- /** Raw response body (the XML document), for debugging. */
2159
- readonly raw: string;
2160
- constructor(opts: {
2161
- operation: string;
2162
- statusCode: number;
2163
- statusText?: string;
2164
- code?: string;
2165
- message?: string;
2166
- requestId?: string;
2167
- raw: string;
2168
- });
225
+ /** S3 request id, if the gateway returned one. */
226
+ readonly requestId?: string;
227
+ /** Raw response body (the XML document), for debugging. */
228
+ readonly raw: string;
229
+ constructor(opts: {
230
+ operation: string;
231
+ statusCode: number;
232
+ statusText?: string;
233
+ code?: string;
234
+ message?: string;
235
+ requestId?: string;
236
+ raw: string;
237
+ });
2169
238
  }
2170
-
239
+ //#endregion
240
+ //#region src/version.d.ts
2171
241
  declare const VERSION: string;
2172
242
  declare const USER_AGENT: string;
2173
-
243
+ //#endregion
244
+ //#region src/index.d.ts
2174
245
  declare function configure(options: ArchilOptions): void;
2175
246
  declare function createDisk(req: CreateDiskRequest): Promise<CreateDiskResult>;
2176
247
  declare function listDisks(opts?: ListDisksOptions): Promise<Disk[]>;
2177
248
  declare function getDisk(id: string): Promise<Disk>;
2178
249
  declare function listApiKeys(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
2179
250
  declare function createApiKey(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
2180
- token?: string;
251
+ token?: string;
2181
252
  }>;
2182
253
  declare function deleteApiKey(id: string): Promise<void>;
2183
254
  /**
@@ -2186,5 +257,10 @@ declare function deleteApiKey(id: string): Promise<void>;
2186
257
  * command completes and returns its stdout, stderr, exit code, and timing.
2187
258
  */
2188
259
  declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
2189
-
2190
- 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 };
260
+ /**
261
+ * Build an agent filesystem toolset spanning several disks, using the
262
+ * module-level client. See {@link Archil.workspace}.
263
+ */
264
+ declare function workspace(mounts: Record<string, ExecMount>): Workspace;
265
+ //#endregion
266
+ 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 FileSystem, 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, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };