@distilled.cloud/archil 0.0.0 → 1.0.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts +29 -0
  3. package/lib/credentials.d.ts.map +1 -0
  4. package/lib/credentials.js +35 -0
  5. package/lib/credentials.js.map +1 -0
  6. package/lib/errors.d.ts +36 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +26 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/index.d.ts +24 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +28 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/pagination.d.ts +9 -0
  15. package/lib/pagination.d.ts.map +1 -0
  16. package/lib/pagination.js +9 -0
  17. package/lib/pagination.js.map +1 -0
  18. package/lib/protocol.d.ts +18 -0
  19. package/lib/protocol.d.ts.map +1 -0
  20. package/lib/protocol.js +51 -0
  21. package/lib/protocol.js.map +1 -0
  22. package/lib/retry.d.ts +32 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +32 -0
  25. package/lib/retry.js.map +1 -0
  26. package/lib/services/archil.d.ts +783 -0
  27. package/lib/services/archil.d.ts.map +1 -0
  28. package/lib/services/archil.js +719 -0
  29. package/lib/services/archil.js.map +1 -0
  30. package/lib/services/index.d.ts +2 -0
  31. package/lib/services/index.d.ts.map +1 -0
  32. package/lib/services/index.js +3 -0
  33. package/lib/services/index.js.map +1 -0
  34. package/lib/traits.d.ts +11 -0
  35. package/lib/traits.d.ts.map +1 -0
  36. package/lib/traits.js +11 -0
  37. package/lib/traits.js.map +1 -0
  38. package/package.json +77 -6
  39. package/src/credentials.ts +58 -0
  40. package/src/errors.ts +50 -0
  41. package/src/index.ts +36 -0
  42. package/src/pagination.ts +8 -0
  43. package/src/protocol.ts +75 -0
  44. package/src/retry.ts +54 -0
  45. package/src/services/archil.ts +1784 -0
  46. package/src/services/index.ts +2 -0
  47. package/src/traits.ts +44 -0
@@ -0,0 +1,783 @@
1
+ import * as S from "@distilled.cloud/core/schema";
2
+ import * as Redacted from "effect/Redacted";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import { type ArchilOpError, type ArchilOpContext } from "../protocol.ts";
5
+ export type { ArchilOpError, ArchilOpContext };
6
+ declare const BadRequest_base: S.Class<BadRequest, S.TaggedStruct<"BadRequest", {
7
+ readonly code: any;
8
+ readonly message: any;
9
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
10
+ "@distilled.cloud/error/categories": {
11
+ BadRequestError: true;
12
+ };
13
+ });
14
+ export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
15
+ }
16
+ declare const Conflict_base: S.Class<Conflict, S.TaggedStruct<"Conflict", {
17
+ readonly code: any;
18
+ readonly message: any;
19
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
20
+ "@distilled.cloud/error/categories": {
21
+ ConflictError: true;
22
+ };
23
+ });
24
+ export declare class Conflict extends /*@__PURE__*/ Conflict_base {
25
+ }
26
+ declare const Forbidden_base: S.Class<Forbidden, S.TaggedStruct<"Forbidden", {
27
+ readonly code: any;
28
+ readonly message: any;
29
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
30
+ "@distilled.cloud/error/categories": {
31
+ AuthError: true;
32
+ };
33
+ });
34
+ export declare class Forbidden extends /*@__PURE__*/ Forbidden_base {
35
+ }
36
+ declare const NotFound_base: S.Class<NotFound, S.TaggedStruct<"NotFound", {
37
+ readonly code: any;
38
+ readonly message: any;
39
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
40
+ "@distilled.cloud/error/categories": {
41
+ BadRequestError: true;
42
+ };
43
+ });
44
+ export declare class NotFound extends /*@__PURE__*/ NotFound_base {
45
+ }
46
+ export type TokenUserType = "token";
47
+ export declare const TokenUserType: any;
48
+ export interface TokenUser {
49
+ type: TokenUserType;
50
+ /** Deprecated. Client-provided token. If omitted, the server generates a cryptographically secure token and returns it in the response. */
51
+ principal?: string;
52
+ nickname: string;
53
+ /** Deprecated. Last 4 characters of the token. Required when principal is provided; ignored when the server generates the token. */
54
+ tokenSuffix?: string;
55
+ }
56
+ export declare const TokenUser: S.Schema<TokenUser>;
57
+ export type AwsStsUserType = "awssts";
58
+ export declare const AwsStsUserType: any;
59
+ export interface AwsStsUser {
60
+ type: AwsStsUserType;
61
+ /** IAM principal ARN */
62
+ principal: string;
63
+ }
64
+ export declare const AwsStsUser: S.Schema<AwsStsUser>;
65
+ export type DiskUser = TokenUser | AwsStsUser;
66
+ export declare const DiskUser: S.Schema<DiskUser>;
67
+ export interface AddDiskUserRequest {
68
+ /** Disk ID (format `dsk-{16 hex chars}`) */
69
+ id: string;
70
+ body: DiskUser;
71
+ }
72
+ export declare const AddDiskUserRequest: S.Schema<AddDiskUserRequest>;
73
+ export type AuthorizedUserType = "token" | "awssts";
74
+ export declare const AuthorizedUserType: any;
75
+ export interface AuthorizedUser {
76
+ type?: AuthorizedUserType;
77
+ /** Use identifier instead. Only populated for awssts type (the IAM ARN). */
78
+ principal?: string;
79
+ nickname?: string;
80
+ tokenSuffix?: string;
81
+ /** The generated disk token (used by clients when mounting the disk). 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. */
82
+ token?: string;
83
+ /** 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. */
84
+ identifier?: string;
85
+ createdAt?: string;
86
+ }
87
+ export declare const AuthorizedUser: S.Schema<AuthorizedUser>;
88
+ export interface ApiResponseAuthorizedUser {
89
+ success: boolean;
90
+ data: AuthorizedUser;
91
+ }
92
+ export declare const ApiResponseAuthorizedUser: S.Schema<ApiResponseAuthorizedUser>;
93
+ export interface CreateApiTokenRequest {
94
+ /** Token name */
95
+ name: string;
96
+ /** Token description */
97
+ description?: string;
98
+ }
99
+ export declare const CreateApiTokenRequest: S.Schema<CreateApiTokenRequest>;
100
+ export interface ApiResponseTokenCreatedData {
101
+ /** Token hash/ID */
102
+ id?: string;
103
+ name?: string;
104
+ description?: string;
105
+ /** Last 4 characters of the token */
106
+ tokenSuffix?: string;
107
+ createdAt?: string;
108
+ lastUsedAt?: string;
109
+ /** Full token value (only shown at creation) */
110
+ token?: string;
111
+ }
112
+ export declare const ApiResponseTokenCreatedData: S.Schema<ApiResponseTokenCreatedData>;
113
+ export interface ApiResponseTokenCreated {
114
+ success: boolean;
115
+ data: ApiResponseTokenCreatedData;
116
+ }
117
+ export declare const ApiResponseTokenCreated: S.Schema<ApiResponseTokenCreated>;
118
+ /** Mount type identifier */
119
+ export type S3MountType = "s3";
120
+ export declare const S3MountType: any;
121
+ /** Mount configuration for Amazon S3 buckets */
122
+ export interface S3Mount {
123
+ /** Mount type identifier */
124
+ type: S3MountType;
125
+ /** S3 bucket name */
126
+ bucketName: string;
127
+ /** AWS access key ID (optional for public buckets or IAM role auth) */
128
+ accessKeyId?: string | Redacted.Redacted<string>;
129
+ /** AWS secret access key */
130
+ secretAccessKey?: string | Redacted.Redacted<string>;
131
+ /** Session token for temporary credentials */
132
+ sessionToken?: string | Redacted.Redacted<string>;
133
+ /** Prefix within the bucket */
134
+ bucketPrefix?: string;
135
+ }
136
+ export declare const S3Mount: S.Schema<S3Mount>;
137
+ /** Mount type identifier */
138
+ export type GCSMountType = "gcs";
139
+ export declare const GCSMountType: any;
140
+ /** Mount configuration for Google Cloud Storage buckets */
141
+ export interface GCSMount {
142
+ /** Mount type identifier */
143
+ type: GCSMountType;
144
+ /** GCS bucket name */
145
+ bucketName: string;
146
+ /** HMAC access key ID */
147
+ accessKeyId: string | Redacted.Redacted<string>;
148
+ /** HMAC secret access key */
149
+ secretAccessKey: string | Redacted.Redacted<string>;
150
+ /** Prefix within the bucket (optional) */
151
+ bucketPrefix?: string;
152
+ }
153
+ export declare const GCSMount: S.Schema<GCSMount>;
154
+ /** Mount type identifier */
155
+ export type R2MountType = "r2";
156
+ export declare const R2MountType: any;
157
+ /** Mount configuration for Cloudflare R2 buckets */
158
+ export interface R2Mount {
159
+ /** Mount type identifier */
160
+ type: R2MountType;
161
+ /** R2 bucket name */
162
+ bucketName: string;
163
+ /** R2 endpoint URL */
164
+ bucketEndpoint: string;
165
+ /** R2 access key ID */
166
+ accessKeyId: string | Redacted.Redacted<string>;
167
+ /** R2 secret access key */
168
+ secretAccessKey: string | Redacted.Redacted<string>;
169
+ /** Prefix within the bucket (optional) */
170
+ bucketPrefix?: string;
171
+ }
172
+ export declare const R2Mount: S.Schema<R2Mount>;
173
+ /** Mount type identifier */
174
+ export type S3CompatibleMountType = "s3-compatible";
175
+ export declare const S3CompatibleMountType: any;
176
+ /** Mount configuration for S3-compatible storage (MinIO, Backblaze B2, etc.) */
177
+ export interface S3CompatibleMount {
178
+ /** Mount type identifier */
179
+ type: S3CompatibleMountType;
180
+ /** Bucket name */
181
+ bucketName: string;
182
+ /** S3-compatible endpoint URL */
183
+ bucketEndpoint: string;
184
+ /** Access key ID */
185
+ accessKeyId: string | Redacted.Redacted<string>;
186
+ /** Secret access key */
187
+ secretAccessKey: string | Redacted.Redacted<string>;
188
+ /** Prefix within the bucket (optional) */
189
+ bucketPrefix?: string;
190
+ }
191
+ export declare const S3CompatibleMount: S.Schema<S3CompatibleMount>;
192
+ /** Mount type identifier */
193
+ export type AzureBlobMountType = "azure-blob";
194
+ export declare const AzureBlobMountType: any;
195
+ /** Mount configuration for Azure Blob Storage containers */
196
+ export interface AzureBlobMount {
197
+ /** Mount type identifier */
198
+ type: AzureBlobMountType;
199
+ /** Azure blob container name */
200
+ containerName: string;
201
+ /** Azure blob endpoint URL (optional if storageAccountName provided) */
202
+ endpoint?: string;
203
+ /** Azure storage account name (used to derive endpoint if not provided) */
204
+ storageAccountName?: string;
205
+ /** Azure AD tenant ID */
206
+ tenantId: string;
207
+ /** Azure AD application client ID */
208
+ clientId: string;
209
+ /** Azure AD application client secret */
210
+ clientSecret: string | Redacted.Redacted<string>;
211
+ /** Prefix within the container */
212
+ bucketPrefix?: string;
213
+ }
214
+ export declare const AzureBlobMount: S.Schema<AzureBlobMount>;
215
+ export type MountConfig = S3Mount | GCSMount | R2Mount | S3CompatibleMount | AzureBlobMount;
216
+ export declare const MountConfig: S.Schema<MountConfig>;
217
+ /** Storage mount to attach. Omit for archil-managed storage. */
218
+ export type CreateDiskRequestMountsList = Array<MountConfig>;
219
+ export declare const CreateDiskRequestMountsList: S.Schema<CreateDiskRequestMountsList>;
220
+ /** Deprecated. Use AddDiskUser after creation instead. When provided, suppresses the default auto-generated token user. */
221
+ export type CreateDiskRequestAuthMethodsList = Array<DiskUser>;
222
+ export declare const CreateDiskRequestAuthMethodsList: S.Schema<CreateDiskRequestAuthMethodsList>;
223
+ export interface CreateDiskRequest {
224
+ /** Disk name (alphanumeric, dashes, underscores) */
225
+ name: string;
226
+ /** Storage mount to attach. Omit for archil-managed storage. */
227
+ mounts?: CreateDiskRequestMountsList;
228
+ /** Deprecated. Use AddDiskUser after creation instead. When provided, suppresses the default auto-generated token user. */
229
+ authMethods?: CreateDiskRequestAuthMethodsList;
230
+ }
231
+ export declare const CreateDiskRequest: S.Schema<CreateDiskRequest>;
232
+ export type ApiResponseCreateDiskDataAuthorizedUsersList = Array<AuthorizedUser>;
233
+ export declare const ApiResponseCreateDiskDataAuthorizedUsersList: S.Schema<ApiResponseCreateDiskDataAuthorizedUsersList>;
234
+ export interface ApiResponseCreateDiskData {
235
+ diskId?: string;
236
+ authorizedUsers?: ApiResponseCreateDiskDataAuthorizedUsersList;
237
+ }
238
+ export declare const ApiResponseCreateDiskData: S.Schema<ApiResponseCreateDiskData>;
239
+ export interface ApiResponseCreateDisk {
240
+ success: boolean;
241
+ data: ApiResponseCreateDiskData;
242
+ }
243
+ export declare const ApiResponseCreateDisk: S.Schema<ApiResponseCreateDisk>;
244
+ /** Environment variables applied to every process */
245
+ export type CreateSandboxRequestEnvMap = {
246
+ [key: string]: string | undefined;
247
+ };
248
+ export declare const CreateSandboxRequestEnvMap: S.Schema<CreateSandboxRequestEnvMap>;
249
+ export interface CreateSandboxRequest {
250
+ /** Hold the request for a completed sandbox lifecycle transition */
251
+ wait?: boolean;
252
+ /** Sandbox name, unique within the account. A random word-list name is generated when omitted. */
253
+ name?: string;
254
+ vcpu_count?: number;
255
+ mem_size_mib?: number;
256
+ /** Public Linux OCI image reference. Docker shorthand and tags are accepted. */
257
+ base_image?: string;
258
+ /** Environment variables applied to every process */
259
+ env?: CreateSandboxRequestEnvMap;
260
+ /** Lifetime budget for each powered-on session. Activity does not extend the deadline; starting or resuming the sandbox begins a fresh session. */
261
+ max_ttl_seconds?: number;
262
+ /** Maximum concurrently attached process sessions */
263
+ max_concurrent_execs?: number;
264
+ }
265
+ export declare const CreateSandboxRequest: S.Schema<CreateSandboxRequest>;
266
+ export interface CreateSandboxResponse {
267
+ }
268
+ export declare const CreateSandboxResponse: S.Schema<CreateSandboxResponse>;
269
+ export interface CreateSandboxConnectionRequest {
270
+ /** Sandbox UUID */
271
+ sid: string;
272
+ }
273
+ export declare const CreateSandboxConnectionRequest: S.Schema<CreateSandboxConnectionRequest>;
274
+ export interface SandboxConnection {
275
+ url: string;
276
+ expires_at: string;
277
+ }
278
+ export declare const SandboxConnection: S.Schema<SandboxConnection>;
279
+ export interface ApiResponseSandboxConnection {
280
+ success: boolean;
281
+ data: SandboxConnection;
282
+ }
283
+ export declare const ApiResponseSandboxConnection: S.Schema<ApiResponseSandboxConnection>;
284
+ export interface CreateShareUrlRequest {
285
+ /** Disk ID (format `dsk-{16 hex chars}`) */
286
+ id: string;
287
+ /** File key (path) within the disk. */
288
+ key: string;
289
+ /** URL lifetime in seconds. Any integer from 1 to 604800 (7 days). Defaults to 86400 (24 hours). */
290
+ expiresIn?: number;
291
+ }
292
+ export declare const CreateShareUrlRequest: S.Schema<CreateShareUrlRequest>;
293
+ export interface ApiResponseShareUrlData {
294
+ /** The signed, public download URL. */
295
+ url: string;
296
+ /** URL lifetime in seconds. */
297
+ expiresIn: number;
298
+ }
299
+ export declare const ApiResponseShareUrlData: S.Schema<ApiResponseShareUrlData>;
300
+ export interface ApiResponseShareUrl {
301
+ success: boolean;
302
+ data: ApiResponseShareUrlData;
303
+ }
304
+ export declare const ApiResponseShareUrl: S.Schema<ApiResponseShareUrl>;
305
+ export interface DeleteDiskRequest {
306
+ /** Disk ID (format `dsk-{16 hex chars}`) */
307
+ id: string;
308
+ }
309
+ export declare const DeleteDiskRequest: S.Schema<DeleteDiskRequest>;
310
+ export interface ApiResponseEmpty {
311
+ success: boolean;
312
+ }
313
+ export declare const ApiResponseEmpty: S.Schema<ApiResponseEmpty>;
314
+ export interface DeleteSandboxRequest {
315
+ /** Sandbox UUID */
316
+ sid: string;
317
+ }
318
+ export declare const DeleteSandboxRequest: S.Schema<DeleteSandboxRequest>;
319
+ export interface DeleteSandboxResponse {
320
+ }
321
+ export declare const DeleteSandboxResponse: S.Schema<DeleteSandboxResponse>;
322
+ export interface DeleteTokenRequest {
323
+ /** The token ID (hash) */
324
+ id: string;
325
+ }
326
+ export declare const DeleteTokenRequest: S.Schema<DeleteTokenRequest>;
327
+ export interface ApiResponseMessageData {
328
+ message?: string;
329
+ }
330
+ export declare const ApiResponseMessageData: S.Schema<ApiResponseMessageData>;
331
+ export interface ApiResponseMessage {
332
+ success: boolean;
333
+ data: ApiResponseMessageData;
334
+ }
335
+ export declare const ApiResponseMessage: S.Schema<ApiResponseMessage>;
336
+ export interface ExecMount {
337
+ /** Disk ID to mount at this relative path */
338
+ disk: string;
339
+ /** Subdirectory of the disk to expose at the mountpoint. Must be a relative path with no `.` or `..` segments. When omitted, the disk's root is exposed. */
340
+ subdirectory?: string;
341
+ /** When true, the disk is mounted read-only inside the container. Writes against the mount fail with EROFS. */
342
+ readOnly?: boolean;
343
+ }
344
+ export declare const ExecMount: S.Schema<ExecMount>;
345
+ export type ExecRequestDisksValue = string | ExecMount;
346
+ export declare const ExecRequestDisksValue: S.Schema<ExecRequestDisksValue>;
347
+ /** Map of relative path under `/mnt/archil` to the disk to mount there. At least one entry is required. Relative paths must be non-empty, non-absolute, and contain no `.` or `..` segments. Each value is either a plain disk ID string (mounts the disk's root, read-write) or an object that additionally selects a subdirectory of the disk and/or marks the mount as read-only. */
348
+ export type ExecRequestDisksMap = {
349
+ [key: string]: ExecRequestDisksValue | undefined;
350
+ };
351
+ export declare const ExecRequestDisksMap: S.Schema<ExecRequestDisksMap>;
352
+ export interface ExecRequest {
353
+ /** Map of relative path under `/mnt/archil` to the disk to mount there. At least one entry is required. Relative paths must be non-empty, non-absolute, and contain no `.` or `..` segments. Each value is either a plain disk ID string (mounts the disk's root, read-write) or an object that additionally selects a subdirectory of the disk and/or marks the mount as read-only. */
354
+ disks: ExecRequestDisksMap;
355
+ /** Shell command to execute inside the container */
356
+ command: string;
357
+ }
358
+ export declare const ExecRequest: S.Schema<ExecRequest>;
359
+ /** Server-measured timings for an exec request. */
360
+ export interface ExecTiming {
361
+ /** End-to-end wall clock measured on the server, from request arrival to response. */
362
+ totalMs: number;
363
+ /** Time spent queueing, scheduling, booting/claiming a VM, and mounting the filesystem before the command started running. */
364
+ queueMs: number;
365
+ /** Time the user's command itself ran, measured by the runtime. */
366
+ executeMs: number;
367
+ }
368
+ export declare const ExecTiming: S.Schema<ExecTiming>;
369
+ export interface ExecDiskResult {
370
+ /** Exit code of the command (0 = success) */
371
+ exitCode: number;
372
+ /** Standard output from the command */
373
+ stdout: string;
374
+ /** Standard error from the command */
375
+ stderr: string;
376
+ timing: ExecTiming;
377
+ }
378
+ export declare const ExecDiskResult: S.Schema<ExecDiskResult>;
379
+ export interface ApiResponseExec {
380
+ success: boolean;
381
+ data: ExecDiskResult;
382
+ }
383
+ export declare const ApiResponseExec: S.Schema<ApiResponseExec>;
384
+ export interface ExecDiskRequest {
385
+ /** Disk ID (format `dsk-{16 hex chars}`) */
386
+ id: string;
387
+ /** Shell command to execute inside the container */
388
+ command: string;
389
+ }
390
+ export declare const ExecDiskRequest: S.Schema<ExecDiskRequest>;
391
+ export interface ApiResponseExecDisk {
392
+ success: boolean;
393
+ data: ExecDiskResult;
394
+ }
395
+ export declare const ApiResponseExecDisk: S.Schema<ApiResponseExecDisk>;
396
+ export interface ForkSandboxRequest {
397
+ /** Sandbox UUID */
398
+ sid: string;
399
+ /** Hold the request for a completed sandbox lifecycle transition */
400
+ wait?: boolean;
401
+ /** Name for the fork. A random word-list name is generated when omitted. */
402
+ name?: string;
403
+ }
404
+ export declare const ForkSandboxRequest: S.Schema<ForkSandboxRequest>;
405
+ export interface ForkSandboxResponse {
406
+ }
407
+ export declare const ForkSandboxResponse: S.Schema<ForkSandboxResponse>;
408
+ export interface GetDiskRequest {
409
+ /** Disk ID (format `dsk-{16 hex chars}`) */
410
+ id: string;
411
+ }
412
+ export declare const GetDiskRequest: S.Schema<GetDiskRequest>;
413
+ /** Disk status */
414
+ export type DiskResponseStatus = "available" | "creating" | "deleting" | "deleted" | "failed";
415
+ export declare const DiskResponseStatus: any;
416
+ /** Storage backend type */
417
+ export type MountResponseType = "s3" | "gcs" | "r2" | "s3-compatible" | "azure-blob";
418
+ export declare const MountResponseType: any;
419
+ /** Access mode */
420
+ export type MountResponseAccessMode = "rw" | "ro";
421
+ export declare const MountResponseAccessMode: any;
422
+ /** Mount configuration details (secrets omitted) */
423
+ export interface MountConfigResponse {
424
+ /** Bucket name */
425
+ bucketName?: string;
426
+ /** Storage endpoint URL */
427
+ bucketEndpoint?: string;
428
+ /** Prefix within the bucket */
429
+ bucketPrefix?: string;
430
+ /** Session identifier for IAM-authorized mounts */
431
+ sessionId?: string;
432
+ }
433
+ export declare const MountConfigResponse: S.Schema<MountConfigResponse>;
434
+ /** Current connection status */
435
+ export type MountResponseConnectionStatus = "connected" | "disconnected";
436
+ export declare const MountResponseConnectionStatus: any;
437
+ /** How the mount authenticates to the storage backend */
438
+ export type MountResponseAuthorizationType = "iam" | "accessKeys" | "oauth";
439
+ export declare const MountResponseAuthorizationType: any;
440
+ export interface MountResponse {
441
+ /** Mount identifier */
442
+ id?: string;
443
+ /** Storage backend type */
444
+ type?: MountResponseType;
445
+ /** Mount path */
446
+ path?: string;
447
+ /** Bucket/container name */
448
+ name?: string;
449
+ /** Access mode */
450
+ accessMode?: MountResponseAccessMode;
451
+ config?: MountConfigResponse;
452
+ /** Current connection status */
453
+ connectionStatus?: MountResponseConnectionStatus;
454
+ /** Authentication error message (if disconnected) */
455
+ authError?: string;
456
+ /** How the mount authenticates to the storage backend */
457
+ authorizationType?: MountResponseAuthorizationType;
458
+ }
459
+ export declare const MountResponse: S.Schema<MountResponse>;
460
+ export type DiskResponseMountsList = Array<MountResponse>;
461
+ export declare const DiskResponseMountsList: S.Schema<DiskResponseMountsList>;
462
+ export interface DiskMetrics {
463
+ /** Data transfer amount with unit (e.g., "1.5 GB") */
464
+ dataTransfer?: string;
465
+ /** Total request count as a formatted string (e.g., "1,234") */
466
+ requests?: string;
467
+ /** Average response time with unit (e.g., "45ms") */
468
+ avgResponseTime?: string;
469
+ }
470
+ export declare const DiskMetrics: S.Schema<DiskMetrics>;
471
+ export interface ConnectedClient {
472
+ id?: string;
473
+ ipAddress?: string;
474
+ connectedAt?: string;
475
+ }
476
+ export declare const ConnectedClient: S.Schema<ConnectedClient>;
477
+ export type DiskResponseConnectedClientsList = Array<ConnectedClient>;
478
+ export declare const DiskResponseConnectedClientsList: S.Schema<DiskResponseConnectedClientsList>;
479
+ export type DiskResponseAuthorizedUsersList = Array<AuthorizedUser>;
480
+ export declare const DiskResponseAuthorizedUsersList: S.Schema<DiskResponseAuthorizedUsersList>;
481
+ export interface DiskResponse {
482
+ /** Disk ID */
483
+ id: string;
484
+ /** Disk name */
485
+ name: string;
486
+ /** Owning organization ID */
487
+ organization: string;
488
+ /** Disk status */
489
+ status: DiskResponseStatus;
490
+ /** Filesystem handler status */
491
+ fsHandlerStatus?: string;
492
+ /** Cloud provider */
493
+ provider: string;
494
+ /** Disk region (e.g., aws-us-east-1, gcp-us-central1) */
495
+ region: string;
496
+ /** Creation timestamp */
497
+ createdAt: string;
498
+ /** Last access timestamp */
499
+ lastAccessed?: string;
500
+ /** Total data size in bytes */
501
+ dataSize?: number;
502
+ /** Monthly usage amount formatted as a currency string (e.g., "$1.23") */
503
+ monthlyUsage?: string;
504
+ mounts?: DiskResponseMountsList;
505
+ metrics?: DiskMetrics;
506
+ connectedClients?: DiskResponseConnectedClientsList;
507
+ authorizedUsers?: DiskResponseAuthorizedUsersList;
508
+ }
509
+ export declare const DiskResponse: S.Schema<DiskResponse>;
510
+ export interface ApiResponseDisk {
511
+ success: boolean;
512
+ data: DiskResponse;
513
+ }
514
+ export declare const ApiResponseDisk: S.Schema<ApiResponseDisk>;
515
+ export interface GetSandboxRequest {
516
+ /** Sandbox UUID */
517
+ sid: string;
518
+ }
519
+ export declare const GetSandboxRequest: S.Schema<GetSandboxRequest>;
520
+ export type SandboxState = "pending" | "running" | "pausing" | "paused" | "stopping" | "stopped" | "exited" | "failed" | "deleting" | "deleted";
521
+ export declare const SandboxState: any;
522
+ /** Sandbox CPU architecture. */
523
+ export type SandboxPlatform = "arm64" | "amd64";
524
+ export declare const SandboxPlatform: any;
525
+ export interface SandboxEndpoint {
526
+ port: number;
527
+ hostname: string;
528
+ }
529
+ export declare const SandboxEndpoint: S.Schema<SandboxEndpoint>;
530
+ export type SandboxEndpointsList = Array<SandboxEndpoint>;
531
+ export declare const SandboxEndpointsList: S.Schema<SandboxEndpointsList>;
532
+ export interface Sandbox {
533
+ sandbox_id: string;
534
+ /** Sandbox name. */
535
+ name: string;
536
+ status: SandboxState;
537
+ vcpu_count: number;
538
+ mem_size_mib: number;
539
+ /** Lifetime budget for each powered-on session. Activity does not extend the deadline; starting or resuming the sandbox begins a fresh session. */
540
+ max_ttl_seconds: number;
541
+ /** Maximum concurrently attached process sessions */
542
+ max_concurrent_execs: number;
543
+ /** OCI reference requested when the sandbox was created. */
544
+ base_image: string;
545
+ /** Sandbox CPU architecture. */
546
+ platform?: SandboxPlatform;
547
+ endpoints?: SandboxEndpointsList;
548
+ created_at: string;
549
+ running_at?: string;
550
+ finished_at?: string;
551
+ last_active_at: string;
552
+ /** Current powered-on session deadline; absent while inactive. */
553
+ expires_at?: string;
554
+ exit_reason?: string;
555
+ }
556
+ export declare const Sandbox: S.Schema<Sandbox>;
557
+ export interface ApiResponseSandbox {
558
+ success: boolean;
559
+ data: Sandbox;
560
+ }
561
+ export declare const ApiResponseSandbox: S.Schema<ApiResponseSandbox>;
562
+ export interface GrepDiskRequest {
563
+ /** Disk ID (format `dsk-{16 hex chars}`) */
564
+ id: string;
565
+ /** Directory on the disk to search, relative to the disk root. An empty string or "/" means the disk root. */
566
+ directory: string;
567
+ /** Extended regular expression (passed to `grep -E`) */
568
+ pattern: string;
569
+ /** When true, walks subdirectories breadth-first. */
570
+ recursive?: boolean;
571
+ /** Wall-clock deadline for the entire request. Capped at 30 seconds because the runtime exec container itself is bounded at ~30s; longer requests would have their workers killed mid-scan. */
572
+ maxDurationSeconds?: number;
573
+ /** Maximum number of parallel grep workers. Higher values finish larger datasets within the deadline but consume proportionally more runtime capacity. */
574
+ concurrency?: number;
575
+ /** Stop scanning once the aggregator has this many matches. Returned matches are a sample of whichever workers reported first, not the lexicographically first N. */
576
+ maxResults?: number;
577
+ }
578
+ export declare const GrepDiskRequest: S.Schema<GrepDiskRequest>;
579
+ export interface GrepMatch {
580
+ /** Path to the file (relative to the disk root). */
581
+ file: string;
582
+ /** 1-based line number where the match occurred. */
583
+ line: number;
584
+ /** The matching line. */
585
+ text: string;
586
+ }
587
+ export declare const GrepMatch: S.Schema<GrepMatch>;
588
+ export type GrepDiskResultMatchesList = Array<GrepMatch>;
589
+ export declare const GrepDiskResultMatchesList: S.Schema<GrepDiskResultMatchesList>;
590
+ /** Why the search stopped. - `completed`: every file under the directory was scanned successfully. - `incomplete`: pipeline ran to its natural end but one or more batches errored (invalid regex, unreadable file, runtime issue). Results may be partial or wrong; do not rely on completeness. - `max_results`: hit `maxResults` before scanning everything. - `deadline`: hit `maxDurationSeconds`. - `list_failed`: directory listing failed; partial results may be present. */
591
+ export type GrepStoppedReason = "completed" | "incomplete" | "max_results" | "deadline" | "list_failed";
592
+ export declare const GrepStoppedReason: any;
593
+ export interface GrepDiskResult {
594
+ matches: GrepDiskResultMatchesList;
595
+ stoppedReason: GrepStoppedReason;
596
+ /** Files actually fed to a grep container. */
597
+ filesScanned: number;
598
+ /** Number of grep containers started for this request. */
599
+ containersDispatched: number;
600
+ /** Sum of per-container execution time in seconds, measured by the runtime. Approximates billable container-seconds. */
601
+ computeSecondsUsed: number;
602
+ /** End-to-end wall clock measured by the server. */
603
+ durationMs: number;
604
+ /** Wall-clock time spent enumerating files via listObjects, from the request's start to the moment listing fully drained (or was canceled). Listing and matching overlap, so listingMs + grepMs typically exceeds durationMs. */
605
+ listingMs: number;
606
+ /** Wall-clock time spent matching, from the first grep container being dispatched to the last container reporting results. 0 if no batches ran. */
607
+ grepMs: number;
608
+ }
609
+ export declare const GrepDiskResult: S.Schema<GrepDiskResult>;
610
+ export interface ApiResponseGrepDisk {
611
+ success: boolean;
612
+ data: GrepDiskResult;
613
+ }
614
+ export declare const ApiResponseGrepDisk: S.Schema<ApiResponseGrepDisk>;
615
+ export interface ListApiTokensRequest {
616
+ /** Maximum number of items to return */
617
+ limit?: number;
618
+ /** Pagination cursor from a previous response */
619
+ cursor?: string;
620
+ }
621
+ export declare const ListApiTokensRequest: S.Schema<ListApiTokensRequest>;
622
+ export interface ApiTokenResponse {
623
+ /** Token hash/ID */
624
+ id?: string;
625
+ name?: string;
626
+ description?: string;
627
+ /** Last 4 characters of the token */
628
+ tokenSuffix?: string;
629
+ createdAt?: string;
630
+ lastUsedAt?: string;
631
+ }
632
+ export declare const ApiTokenResponse: S.Schema<ApiTokenResponse>;
633
+ export type ApiResponseTokenListDataTokensList = Array<ApiTokenResponse>;
634
+ export declare const ApiResponseTokenListDataTokensList: S.Schema<ApiResponseTokenListDataTokensList>;
635
+ export interface ApiResponseTokenListData {
636
+ tokens?: ApiResponseTokenListDataTokensList;
637
+ }
638
+ export declare const ApiResponseTokenListData: S.Schema<ApiResponseTokenListData>;
639
+ export interface ApiResponseTokenList {
640
+ success: boolean;
641
+ data: ApiResponseTokenListData;
642
+ }
643
+ export declare const ApiResponseTokenList: S.Schema<ApiResponseTokenList>;
644
+ export interface ListDisksRequest {
645
+ /** Maximum number of items to return */
646
+ limit?: number;
647
+ /** Pagination cursor from a previous response */
648
+ cursor?: string;
649
+ /** Filter disks by exact name match. */
650
+ name?: string;
651
+ }
652
+ export declare const ListDisksRequest: S.Schema<ListDisksRequest>;
653
+ export type ApiResponseDiskListDataList = Array<DiskResponse>;
654
+ export declare const ApiResponseDiskListDataList: S.Schema<ApiResponseDiskListDataList>;
655
+ /** 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. */
656
+ export interface ApiResponseDiskList {
657
+ success: boolean;
658
+ data: ApiResponseDiskListDataList;
659
+ }
660
+ export declare const ApiResponseDiskList: S.Schema<ApiResponseDiskList>;
661
+ export interface ListSandboxesRequest {
662
+ /** Only sandboxes that mount this disk */
663
+ filesystem?: string;
664
+ }
665
+ export declare const ListSandboxesRequest: S.Schema<ListSandboxesRequest>;
666
+ export type ApiResponseSandboxListDataSandboxesList = Array<Sandbox>;
667
+ export declare const ApiResponseSandboxListDataSandboxesList: S.Schema<ApiResponseSandboxListDataSandboxesList>;
668
+ export interface ApiResponseSandboxListData {
669
+ sandboxes?: ApiResponseSandboxListDataSandboxesList;
670
+ }
671
+ export declare const ApiResponseSandboxListData: S.Schema<ApiResponseSandboxListData>;
672
+ export interface ApiResponseSandboxList {
673
+ success: boolean;
674
+ data: ApiResponseSandboxListData;
675
+ }
676
+ export declare const ApiResponseSandboxList: S.Schema<ApiResponseSandboxList>;
677
+ export interface PauseSandboxRequest {
678
+ /** Sandbox UUID */
679
+ sid: string;
680
+ }
681
+ export declare const PauseSandboxRequest: S.Schema<PauseSandboxRequest>;
682
+ export type RemoveDiskUserRequestUserType = "token" | "awssts";
683
+ export declare const RemoveDiskUserRequestUserType: any;
684
+ export interface RemoveDiskUserRequest {
685
+ /** Disk ID (format `dsk-{16 hex chars}`) */
686
+ id: string;
687
+ /** The type of user authentication */
688
+ userType: RemoveDiskUserRequestUserType | (string & {});
689
+ /** Identifier of the user to remove, as returned in the creation or list response. For awssts users, this is the IAM ARN. */
690
+ identifier?: string;
691
+ /** Use identifier instead. */
692
+ principal?: string;
693
+ }
694
+ export declare const RemoveDiskUserRequest: S.Schema<RemoveDiskUserRequest>;
695
+ export interface ResumeSandboxRequest {
696
+ /** Sandbox UUID */
697
+ sid: string;
698
+ /** Hold the request for a completed sandbox lifecycle transition */
699
+ wait?: boolean;
700
+ }
701
+ export declare const ResumeSandboxRequest: S.Schema<ResumeSandboxRequest>;
702
+ export interface StartSandboxRequest {
703
+ /** Sandbox UUID */
704
+ sid: string;
705
+ /** Hold the request for a completed sandbox lifecycle transition */
706
+ wait?: boolean;
707
+ }
708
+ export declare const StartSandboxRequest: S.Schema<StartSandboxRequest>;
709
+ export interface StopSandboxRequest {
710
+ /** Sandbox UUID */
711
+ sid: string;
712
+ }
713
+ export declare const StopSandboxRequest: S.Schema<StopSandboxRequest>;
714
+ export type AddDiskUserError = BadRequest | ArchilOpError;
715
+ /** Add user to disk Adds an authorized user to a disk. Users can authenticate via: - **token**: A shared token with a nickname and 4-character suffix - **awssts**: AWS STS role assumption with an IAM principal ARN */
716
+ export declare const addDiskUser: API.OperationMethod<AddDiskUserRequest, ApiResponseAuthorizedUser, AddDiskUserError, ArchilOpContext>;
717
+ export type CreateApiTokenError = BadRequest | ArchilOpError;
718
+ /** Create API token Creates a new API token for programmatic access. The full token value is only returned once at creation time. */
719
+ export declare const createApiToken: API.OperationMethod<CreateApiTokenRequest, ApiResponseTokenCreated, CreateApiTokenError, ArchilOpContext>;
720
+ export type CreateDiskError = BadRequest | Forbidden | Conflict | ArchilOpError;
721
+ /** Create a new disk Creates a new disk with the specified configuration. A default disk token user is automatically generated and returned in the response, so the disk is immediately mountable. The one-time disk token appears in `authorizedUsers[].token` and cannot be retrieved again. (This disk token is scoped to the new disk and is separate from the API key you used to make this request.) To provide your own users instead, pass the deprecated `authMethods` field or call AddDiskUser after creation. */
722
+ export declare const createDisk: API.OperationMethod<CreateDiskRequest, ApiResponseCreateDisk, CreateDiskError, ArchilOpContext>;
723
+ export type CreateSandboxError = BadRequest | Conflict | ArchilOpError;
724
+ /** Create a sandbox Provisions a sandbox VM with the requested shape and a dedicated, persistent Archil disk. By default the response reports `pending` after the runtime accepts the start. Set `wait=true` to hold for `running`; if the wait budget expires, the response remains `pending` and startup continues. */
725
+ export declare const createSandbox: API.OperationMethod<CreateSandboxRequest, CreateSandboxResponse, CreateSandboxError, ArchilOpContext>;
726
+ export type CreateSandboxConnectionError = NotFound | Conflict | ArchilOpError;
727
+ /** Create a sandbox process connection Returns a short-lived WebSocket URL for the process API in a running sandbox. The URL contains a signed token that expires at `expires_at`. */
728
+ export declare const createSandboxConnection: API.OperationMethod<CreateSandboxConnectionRequest, ApiResponseSandboxConnection, CreateSandboxConnectionError, ArchilOpContext>;
729
+ export type CreateShareUrlError = BadRequest | NotFound | ArchilOpError;
730
+ /** Create a share URL for a file Creates a signed, time-limited URL for downloading a file without authentication. The URL expires after 24 hours by default; pass `expiresIn` to set a custom lifetime up to 7 days. The returned URL points to a public endpoint (`GET /api/shared/{token}`) that verifies the signature, checks expiry, and streams the file with a sensible `Content-Type` and `Content-Disposition`. Range requests are supported. No credentials are needed to open the URL. */
731
+ export declare const createShareUrl: API.OperationMethod<CreateShareUrlRequest, ApiResponseShareUrl, CreateShareUrlError, ArchilOpContext>;
732
+ export type DeleteDiskError = BadRequest | NotFound | ArchilOpError;
733
+ /** Delete a disk Deletes a disk and all associated resources. */
734
+ export declare const deleteDisk: API.OperationMethod<DeleteDiskRequest, ApiResponseEmpty, DeleteDiskError, ArchilOpContext>;
735
+ export type DeleteSandboxError = NotFound | Conflict | ArchilOpError;
736
+ /** Delete a sandbox Permanently deletes a stopped, exited, or failed sandbox and its backing disk. A sandbox with child forks cannot be deleted until those children are deleted, starting with the deepest ones. */
737
+ export declare const deleteSandbox: API.OperationMethod<DeleteSandboxRequest, DeleteSandboxResponse, DeleteSandboxError, ArchilOpContext>;
738
+ export type DeleteTokenError = NotFound | ArchilOpError;
739
+ /** Delete API token Revokes and deletes an API token. */
740
+ export declare const deleteToken: API.OperationMethod<DeleteTokenRequest, ApiResponseMessage, DeleteTokenError, ArchilOpContext>;
741
+ export type ExecError = BadRequest | NotFound | ArchilOpError;
742
+ /** Execute a command with multiple disks mounted Launches a container with the supplied set of disks each mounted at its own relative path under `/mnt/archil`, runs the command to completion, and shuts down the container. Activation is atomic: every disk mounts or none of them do. Relative paths must be non-empty, non-absolute, and contain no `.` / `..` segments. Mounting two disks at the same relative path is an error. */
743
+ export declare const exec: API.OperationMethod<ExecRequest, ApiResponseExec, ExecError, ArchilOpContext>;
744
+ export type ExecDiskError = BadRequest | NotFound | ArchilOpError;
745
+ /** Execute a command on a disk Launches a container with the specified disk mounted, runs the given command to completion, shuts down the container, and returns the command result. */
746
+ export declare const execDisk: API.OperationMethod<ExecDiskRequest, ApiResponseExecDisk, ExecDiskError, ArchilOpContext>;
747
+ export type ForkSandboxError = BadRequest | NotFound | Conflict | ArchilOpError;
748
+ /** Fork a sandbox Checkpoints a running source sandbox and creates an isolated writable disk branch. Forks from running or paused sources resume from the source's CPU, memory, and disk state. Forks from stopped sources cold-boot from the saved disk checkpoint. A running source is resumed after its checkpoint; paused and stopped sources remain inactive. Forked sandboxes may themselves be forked. */
749
+ export declare const forkSandbox: API.OperationMethod<ForkSandboxRequest, ForkSandboxResponse, ForkSandboxError, ArchilOpContext>;
750
+ export type GetDiskError = BadRequest | NotFound | ArchilOpError;
751
+ /** Get disk details Returns detailed information about a specific disk. */
752
+ export declare const getDisk: API.OperationMethod<GetDiskRequest, ApiResponseDisk, GetDiskError, ArchilOpContext>;
753
+ export type GetSandboxError = NotFound | ArchilOpError;
754
+ /** Get a sandbox */
755
+ export declare const getSandbox: API.OperationMethod<GetSandboxRequest, ApiResponseSandbox, GetSandboxError, ArchilOpContext>;
756
+ export type GrepDiskError = BadRequest | NotFound | ArchilOpError;
757
+ /** Parallel grep over a directory on a disk Searches files under a directory on the disk for lines matching a regular expression. Listing and matching are fanned out across ephemeral exec containers, so the request finishes within the user's time budget regardless of the size of the directory. The user controls cost and latency with three knobs: - `maxDurationSeconds` is the wall-clock deadline (capped at 30s). - `concurrency` is the maximum number of parallel grep workers. Higher concurrency finishes larger datasets within the deadline, at proportionally more compute. - `maxResults` causes the search to short-circuit after the aggregator has collected this many matches. With `recursive: false` only files directly under `directory` are searched. With `recursive: true` subdirectories are walked breadth-first and grep workers are dispatched as soon as each level finishes listing — listing and matching overlap. The matches returned when stopping early on `maxResults` are a sample of whichever workers reported first, not the lexicographically first N. The response surfaces `stoppedReason` so callers can distinguish completion from early termination. */
758
+ export declare const grepDisk: API.OperationMethod<GrepDiskRequest, ApiResponseGrepDisk, GrepDiskError, ArchilOpContext>;
759
+ export type ListApiTokensError = ArchilOpError;
760
+ /** List API tokens Returns all API tokens for the authenticated account. */
761
+ export declare const listApiTokens: API.OperationMethod<ListApiTokensRequest, ApiResponseTokenList, ListApiTokensError, ArchilOpContext>;
762
+ export type ListDisksError = ArchilOpError;
763
+ /** List all disks Returns all disks owned by the authenticated account. */
764
+ export declare const listDisks: API.OperationMethod<ListDisksRequest, ApiResponseDiskList, ListDisksError, ArchilOpContext>;
765
+ export type ListSandboxesError = BadRequest | ArchilOpError;
766
+ /** List sandboxes All the account's sandboxes, oldest first. */
767
+ export declare const listSandboxes: API.OperationMethod<ListSandboxesRequest, ApiResponseSandboxList, ListSandboxesError, ArchilOpContext>;
768
+ export type PauseSandboxError = BadRequest | NotFound | Conflict | ArchilOpError;
769
+ /** Pause a sandbox Snapshot the CPU & memory state, then stop the VM. The sandbox reports `pausing` until the snapshot commit marker is durable and the VM exits, then reports `paused`. Attached process connections close, while agent-owned processes remain available for reattachment after resume. A sandbox that is still `pending` must reach `running` before it can be paused. To restore the snapshot, call `/resume`. */
770
+ export declare const pauseSandbox: API.OperationMethod<PauseSandboxRequest, ApiResponseSandbox, PauseSandboxError, ArchilOpContext>;
771
+ export type RemoveDiskUserError = BadRequest | ArchilOpError;
772
+ /** Remove user from disk Removes an authorized user from a disk. */
773
+ export declare const removeDiskUser: API.OperationMethod<RemoveDiskUserRequest, ApiResponseMessage, RemoveDiskUserError, ArchilOpContext>;
774
+ export type ResumeSandboxError = BadRequest | NotFound | Conflict | ArchilOpError;
775
+ /** Resume a sandbox Restores a paused sandbox's committed CPU and memory snapshot. Resuming a running sandbox or a pending resume is idempotent. Only a `paused` sandbox can begin a new resume; `stopped`, `exited`, `failed`, `stopping`, `pausing`, or a pending cold start returns 409. */
776
+ export declare const resumeSandbox: API.OperationMethod<ResumeSandboxRequest, ApiResponseSandbox, ResumeSandboxError, ArchilOpContext>;
777
+ export type StartSandboxError = BadRequest | NotFound | Conflict | ArchilOpError;
778
+ /** Cold-start a sandbox Cold-boots from the persisted configuration and disks. If the sandbox was paused, its memory snapshot is consumed and discarded before the new VM runs; disk state remains. Starting a running sandbox or a pending cold start is idempotent. A sandbox that is stopping, pausing, or pending a resume returns 409. */
779
+ export declare const startSandbox: API.OperationMethod<StartSandboxRequest, ApiResponseSandbox, StartSandboxError, ArchilOpContext>;
780
+ export type StopSandboxError = BadRequest | NotFound | Conflict | ArchilOpError;
781
+ /** Stop a sandbox Gracefully shuts down the guest, then checkpoints its disk before entering `stopped`. The sandbox and any forks from it cold-boot from disk state. Stopping a paused sandbox reuses its existing disk checkpoint. In-flight processes receive the guest shutdown signal. */
782
+ export declare const stopSandbox: API.OperationMethod<StopSandboxRequest, ApiResponseSandbox, StopSandboxError, ArchilOpContext>;
783
+ //# sourceMappingURL=archil.d.ts.map