@promigence/sdk 0.1.0-beta.15 → 0.1.0-beta.17

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.
@@ -358,7 +358,9 @@ export interface BillingCredits {
358
358
  */
359
359
  balance_usd: number;
360
360
  /**
361
- * Available credits cannot start new work.
361
+ * Available credits cannot pay for new work. That stops new work only where credits pay for
362
+ * it (`model` `credits`, or the trial); a `postpaid` organization's new work is billed after
363
+ * use.
362
364
  */
363
365
  exhausted: boolean;
364
366
  /**
@@ -739,6 +741,11 @@ export interface BuildQueued {
739
741
  * True when a verification command was given.
740
742
  */
741
743
  verified: boolean;
744
+ /**
745
+ * What to know before the build ends: with `move_alias`, which snapshot gives up the alias
746
+ * to it once it is stored.
747
+ */
748
+ warnings?: Array<string>;
742
749
  }
743
750
  /**
744
751
  * Builds in the period.
@@ -964,6 +971,24 @@ export interface CaptureView {
964
971
  */
965
972
  snapshot_id: string;
966
973
  }
974
+ /**
975
+ * What applies to a failed run's sandboxes when the run does not say (`capture`).
976
+ */
977
+ export interface CapturesEffective {
978
+ /**
979
+ * Which choice decided it: `project`, `org`, or `default` (neither chose, so the default
980
+ * applies).
981
+ */
982
+ from: CapturesFrom;
983
+ /**
984
+ * Whether a failed sandbox is kept so you can reopen it where it broke.
985
+ */
986
+ kept: boolean;
987
+ }
988
+ /**
989
+ * Which choice decides whether a failed run's sandboxes are kept, when the run does not say.
990
+ */
991
+ export type CapturesFrom = "project" | "org" | "default";
967
992
  /**
968
993
  * The card on file, enough to recognise it.
969
994
  */
@@ -1503,6 +1528,45 @@ export interface ErrorBody {
1503
1528
  * Every error code the API returns. `category` decides whether the failure is billed: `env` is ours (not billed before hand-over; after it, the time since the sandbox's last snapshot is credited back, up to 24 hours, when our side shows the cause), `task` is your command and is billed. The full table is `x-promigence-error-codes` at the document root.
1504
1529
  */
1505
1530
  export type ErrorCode = "fork_failed" | "start_timeout" | "readiness_failed" | "verify_too_slow" | "verify_each_failed" | "toolchain_mismatch" | "sandbox_unresponsive" | "oom_within_tier" | "disk_full_within_tier" | "sandbox_interrupted" | "integrity_mismatch" | "egress_unavailable" | "service_timeout" | "preempted" | "verify_did_not_cover" | "grader_failed" | "nonzero_exit" | "grade_not_passed" | "task_timeout" | "oom_over_tier" | "disk_over_tier" | "shutdown_by_task" | "modified_by_task" | "cap_killed" | "cap_exceeded" | "cap_paused" | "credits_paused" | "aborted_by_client" | "stopped_by_support" | "expired" | "not_started" | "superseded" | "usage" | "internal" | "auth" | "forbidden" | "not_found" | "unreachable" | "rate_limited" | "timeout" | "not_verified" | "snapshot_incompatible" | "storage_limit_reached" | "resume_unavailable" | "sandbox_unreachable" | "capacity_busy" | "region_at_capacity" | "builder_unavailable" | "builder_busy" | "overloaded" | "tier_unavailable" | "snapshot_unavailable" | "capacity_limit" | "build_timeout" | "dockerfile_build_failed" | "image_unresolvable" | "registry_unavailable" | "enoent" | "trial_credits_exhausted" | "credits_exhausted" | "credit_unclaimed" | "setup_required" | "card_required" | "billing_unavailable" | "purchase_limit" | "card_needed" | "auto_reload_unavailable" | "purchases_blocked" | "concurrency_limit" | "egress_cap_reached" | "project_cap_reached" | "spend_limit_reached" | "billing_hold" | "tier_over_plan" | "network_host_refused" | "network_policy_unsupported" | "secrets_in_snapshot" | "secrets_unavailable" | "secret_binding_unsupported" | "idempotency_key_reused" | "idempotency_key_in_use" | "repo_credentials_not_supported" | "account_exists" | "invite_invalid" | "invite_required" | "key_expired" | "account_blocked";
1531
+ /**
1532
+ * `POST /v1/sandboxes/{id}/execs/attach`: pick up a command whose connection dropped, by the key
1533
+ * it was started with (the `Promigence-Exec-Key` header).
1534
+ */
1535
+ export interface ExecAttach {
1536
+ /**
1537
+ * The key the command was started with.
1538
+ */
1539
+ key: string;
1540
+ /**
1541
+ * A stream only: the same for standard error.
1542
+ */
1543
+ stderr_offset?: number | null;
1544
+ /**
1545
+ * A stream only: how many bytes of standard output you already have; you are sent what
1546
+ * follows. Default 0.
1547
+ */
1548
+ stdout_offset?: number | null;
1549
+ }
1550
+ /**
1551
+ * `POST /v1/sandboxes/{id}/execs/cancel`: stop a command started with a key, now.
1552
+ */
1553
+ export interface ExecCancel {
1554
+ /**
1555
+ * The key the command was started with.
1556
+ */
1557
+ key: string;
1558
+ }
1559
+ /**
1560
+ * `POST /v1/sandboxes/{id}/execs/cancel`.
1561
+ */
1562
+ export interface ExecCancelled {
1563
+ /**
1564
+ * True when the command was still running and is being stopped; false when it had already
1565
+ * ended, which is not a failure.
1566
+ */
1567
+ cancelled: boolean;
1568
+ sandbox_id: string;
1569
+ }
1506
1570
  /**
1507
1571
  * `POST /v1/sandboxes/{id}/execs`, and the `exec` of `POST /v1/runs`: one command. `argv` (a
1508
1572
  * non-empty list) or `sh` (a shell line) is required.
@@ -1609,8 +1673,9 @@ export interface ExecResult {
1609
1673
  */
1610
1674
  oom_killed?: boolean;
1611
1675
  /**
1612
- * Why the command ended without an exit code: `timeout`, `out_of_memory` or `signal`.
1613
- * Absent when it exited on its own.
1676
+ * Why the command ended without an exit code: `timeout`, `out_of_memory`, `signal`, or
1677
+ * `not_reattached` (it was started with a `Promigence-Exec-Key`, its connection dropped, and
1678
+ * nobody picked it up again in time, so it was stopped). Absent when it exited on its own.
1614
1679
  */
1615
1680
  reason?: string | null;
1616
1681
  sandbox_id: string;
@@ -1791,7 +1856,8 @@ export interface Failure {
1791
1856
  }
1792
1857
  export type FailureCategory = "env" | "snapshot" | "task" | "cap" | "grader" | "preempt" | "other";
1793
1858
  /**
1794
- * `POST /v1/sandboxes/{id}/files/archive`: pack a path into a `.tar.gz` inside the sandbox.
1859
+ * `POST /v1/sandboxes/{id}/files/archive`: pack a path into a `.tar.gz` inside the sandbox. A path
1860
+ * is absolute, or relative to the sandbox's working directory.
1795
1861
  */
1796
1862
  export interface FileArchive {
1797
1863
  /**
@@ -1799,13 +1865,15 @@ export interface FileArchive {
1799
1865
  */
1800
1866
  exclude?: Array<string>;
1801
1867
  /**
1802
- * Where the archive is written (absolute). Default: beside the source.
1868
+ * Where the archive is written: absolute, or relative to the sandbox's working directory.
1869
+ * Default: beside the source.
1803
1870
  */
1804
1871
  out?: string | null;
1805
1872
  path: string;
1806
1873
  }
1807
1874
  /**
1808
- * `POST /v1/sandboxes/{id}/files/chmod`: at least one of `mode`, `uid`, `gid`.
1875
+ * `POST /v1/sandboxes/{id}/files/chmod`: at least one of `mode`, `uid`, `gid`. The path is absolute,
1876
+ * or relative to the sandbox's working directory.
1809
1877
  */
1810
1878
  export interface FileChmod {
1811
1879
  gid?: number | null;
@@ -1815,7 +1883,8 @@ export interface FileChmod {
1815
1883
  uid?: number | null;
1816
1884
  }
1817
1885
  /**
1818
- * `POST /v1/sandboxes/{id}/files/copy`.
1886
+ * `POST /v1/sandboxes/{id}/files/copy`. A path is absolute, or relative to the sandbox's working
1887
+ * directory.
1819
1888
  */
1820
1889
  export interface FileCopy {
1821
1890
  from: string;
@@ -1824,7 +1893,8 @@ export interface FileCopy {
1824
1893
  to: string;
1825
1894
  }
1826
1895
  /**
1827
- * `DELETE /v1/sandboxes/{id}/files`: a path, and `recursive` for a directory with something in it.
1896
+ * `DELETE /v1/sandboxes/{id}/files`: a path (absolute, or relative to the sandbox's working
1897
+ * directory), and `recursive` for a directory with something in it.
1828
1898
  */
1829
1899
  export interface FileDeleteRequest {
1830
1900
  path: string;
@@ -1845,7 +1915,8 @@ export interface FileDeleted {
1845
1915
  sandbox_id: string;
1846
1916
  }
1847
1917
  /**
1848
- * `POST /v1/sandboxes/{id}/files/extract`.
1918
+ * `POST /v1/sandboxes/{id}/files/extract`. A path is absolute, or relative to the sandbox's
1919
+ * working directory.
1849
1920
  */
1850
1921
  export interface FileExtract {
1851
1922
  archive: string;
@@ -1885,7 +1956,7 @@ export interface FileListRequest {
1885
1956
  */
1886
1957
  limit?: number | null;
1887
1958
  /**
1888
- * The directory (absolute). Default: `/`.
1959
+ * The directory: absolute, or relative to the sandbox's working directory. Default: `/`.
1889
1960
  */
1890
1961
  path?: string | null;
1891
1962
  /**
@@ -1909,7 +1980,8 @@ export interface FileListing {
1909
1980
  truncated: boolean;
1910
1981
  }
1911
1982
  /**
1912
- * `POST /v1/sandboxes/{id}/files/mkdir`. Paths are absolute.
1983
+ * `POST /v1/sandboxes/{id}/files/mkdir`. A path is absolute, or relative to the sandbox's working
1984
+ * directory (where its commands start).
1913
1985
  */
1914
1986
  export interface FileMkdir {
1915
1987
  mode?: FileMode | null;
@@ -1924,7 +1996,8 @@ export interface FileMkdir {
1924
1996
  */
1925
1997
  export type FileMode = number | string;
1926
1998
  /**
1927
- * `POST /v1/sandboxes/{id}/files/move`.
1999
+ * `POST /v1/sandboxes/{id}/files/move`. A path is absolute, or relative to the sandbox's working
2000
+ * directory.
1928
2001
  */
1929
2002
  export interface FileMove {
1930
2003
  from: string;
@@ -1932,8 +2005,8 @@ export interface FileMove {
1932
2005
  to: string;
1933
2006
  }
1934
2007
  /**
1935
- * `POST /v1/sandboxes/{id}/files/read` and `POST /v1/sandboxes/{id}/files/stat`: one path,
1936
- * absolute, inside the sandbox.
2008
+ * `POST /v1/sandboxes/{id}/files/read` and `POST /v1/sandboxes/{id}/files/stat`: one path inside
2009
+ * the sandbox, absolute or relative to its working directory (where its commands start).
1937
2010
  */
1938
2011
  export interface FilePathRequest {
1939
2012
  path: string;
@@ -1959,7 +2032,8 @@ export interface FileSearchRequest {
1959
2032
  */
1960
2033
  limit?: number | null;
1961
2034
  /**
1962
- * The directory to search (absolute). Default: `/`.
2035
+ * The directory to search: absolute, or relative to the sandbox's working directory.
2036
+ * Default: `/`.
1963
2037
  */
1964
2038
  path?: string | null;
1965
2039
  /**
@@ -2953,6 +3027,11 @@ export interface Me {
2953
3027
  */
2954
3028
  spend?: number | null;
2955
3029
  spend_detail?: SpendDetail | null;
3030
+ /**
3031
+ * What the organisation stores now, against `limits.max_storage_gb` and
3032
+ * `limits.max_capture_storage_gb`. Absent from a server before it.
3033
+ */
3034
+ storage?: MeStorage | null;
2956
3035
  /**
2957
3036
  * The organisation's trial credit. Absent for a key that may not see the organisation's
2958
3037
  * money: only an owner's key of the default project does.
@@ -2977,6 +3056,11 @@ export interface MeConcurrency {
2977
3056
  * The limits in force for an organisation.
2978
3057
  */
2979
3058
  export interface MeLimits {
3059
+ /**
3060
+ * The storage saved failures may use, in GB: when a new one would pass it, the oldest are
3061
+ * removed to make room; `null` for no limit.
3062
+ */
3063
+ max_capture_storage_gb?: number | null;
2980
3064
  /**
2981
3065
  * Sandboxes that may be live at once.
2982
3066
  */
@@ -2985,6 +3069,10 @@ export interface MeLimits {
2985
3069
  * Sandboxes that may be starting at once.
2986
3070
  */
2987
3071
  max_inflight: number;
3072
+ /**
3073
+ * Paused sandboxes that may be kept; `null` for no limit.
3074
+ */
3075
+ max_paused?: number | null;
2988
3076
  /**
2989
3077
  * The largest sandbox shape, in vCPU; `null` for no limit.
2990
3078
  */
@@ -2993,6 +3081,41 @@ export interface MeLimits {
2993
3081
  * The longest a sandbox may live, in seconds; `null` for no limit.
2994
3082
  */
2995
3083
  max_session_s?: number | null;
3084
+ /**
3085
+ * Snapshots that may be kept; `null` for no limit.
3086
+ */
3087
+ max_snapshots?: number | null;
3088
+ /**
3089
+ * Everything stored together, in GB: snapshots, paused sandboxes and saved failures; `null`
3090
+ * for no limit.
3091
+ */
3092
+ max_storage_gb?: number | null;
3093
+ }
3094
+ /**
3095
+ * What an organisation stores now (`GET /v1/me` `storage`).
3096
+ */
3097
+ export interface MeStorage {
3098
+ /**
3099
+ * Saved failures kept now.
3100
+ */
3101
+ captures: number;
3102
+ /**
3103
+ * Of that, what saved failures use, in bytes (what `limits.max_capture_storage_gb` holds).
3104
+ */
3105
+ captures_bytes: number;
3106
+ /**
3107
+ * Paused sandboxes kept now.
3108
+ */
3109
+ paused: number;
3110
+ /**
3111
+ * Snapshots kept now.
3112
+ */
3113
+ snapshots: number;
3114
+ /**
3115
+ * Everything stored together, in bytes: snapshots, paused sandboxes and saved failures (what
3116
+ * `limits.max_storage_gb` holds; a GB there is 2^30 bytes).
3117
+ */
3118
+ used_bytes: number;
2996
3119
  }
2997
3120
  /**
2998
3121
  * `GET /v1/orgs/{org_id}/members`.
@@ -3074,7 +3197,7 @@ export interface NameCreate {
3074
3197
  */
3075
3198
  name: string;
3076
3199
  }
3077
- export type Network = "none" | "egress";
3200
+ export type Network = "none" | "egress" | "allow";
3078
3201
  /**
3079
3202
  * An allowlist: the only hosts the sandbox may reach.
3080
3203
  */
@@ -3224,8 +3347,9 @@ export interface OrgList {
3224
3347
  export interface OrgPatch {
3225
3348
  /**
3226
3349
  * Keep a failed sandbox so it can be reopened where it broke, when a run does not say
3227
- * (`capture`): `true` or `false`; `null` = the next level's setting. Set by an owner, on its
3228
- * own (no other field in the same request).
3350
+ * (`capture`): `true` or `false`; `null` = not chosen, so the default applies: not kept unless
3351
+ * the organization or project chose to keep them. A project may choose its own. Set by an
3352
+ * owner, on its own (no other field in the same request).
3229
3353
  */
3230
3354
  failure_captures?: boolean | null;
3231
3355
  /**
@@ -3238,6 +3362,13 @@ export interface OrgPatch {
3238
3362
  * owner.
3239
3363
  */
3240
3364
  output_retention_days?: number | null;
3365
+ /**
3366
+ * The length of new preview URLs when a request does not say: `short` or `long` (a longer,
3367
+ * harder-to-guess URL, for apps with sensitive data); `null` = the default, `short`. A
3368
+ * project may name its own. Set by an owner, on its own (no other field in the same
3369
+ * request). Custom domains are coming soon.
3370
+ */
3371
+ preview_link_length?: PreviewLinkLength | null;
3241
3372
  }
3242
3373
  /**
3243
3374
  * One organization you belong to. Billing, members and credits belong to it.
@@ -3256,10 +3387,18 @@ export interface OrgView {
3256
3387
  */
3257
3388
  default: boolean;
3258
3389
  /**
3259
- * Whether a failed sandbox is kept so you can reopen it where it broke, when a run does not
3260
- * say (`capture`); `null` = the default. A project may name its own.
3390
+ * This organization's choice: whether a failed sandbox is kept so you can reopen it where it
3391
+ * broke, when a run does not say (`capture`); `null` = not chosen, so the default applies:
3392
+ * not kept unless the organization or project chose to keep them. A project may choose its
3393
+ * own. What applies is `failure_captures_effective`.
3261
3394
  */
3262
3395
  failure_captures?: boolean | null;
3396
+ /**
3397
+ * What applies to a failed run of this organization when neither the run (`capture`) nor
3398
+ * its project says: kept or not, and which choice decided it. A run's own `capture` is
3399
+ * followed either way.
3400
+ */
3401
+ failure_captures_effective?: CapturesEffective | null;
3263
3402
  members: number;
3264
3403
  name: string;
3265
3404
  org_id: string;
@@ -3268,6 +3407,11 @@ export interface OrgView {
3268
3407
  * name its own.
3269
3408
  */
3270
3409
  output_retention_days?: number | null;
3410
+ /**
3411
+ * The length of new preview URLs when a request does not say (`length`): `short` or `long`;
3412
+ * `null` = the default, `short`. A project may name its own.
3413
+ */
3414
+ preview_link_length?: PreviewLinkLength | null;
3271
3415
  projects: number;
3272
3416
  /**
3273
3417
  * Your role in it: `owner` or `member`.
@@ -3528,19 +3672,30 @@ export interface Port {
3528
3672
  * Unix nanoseconds.
3529
3673
  */
3530
3674
  created_unix_ns?: number | null;
3675
+ /**
3676
+ * When the URL stops working on its own, Unix nanoseconds; `null` when it works until it is
3677
+ * revoked or the sandbox ends.
3678
+ */
3679
+ expires_unix_ns?: number | null;
3531
3680
  /**
3532
3681
  * The same publication addressed by name rather than by path. Apps that emit absolute paths
3533
3682
  * need this form.
3534
3683
  */
3535
3684
  host_url_label?: string | null;
3685
+ /**
3686
+ * `short` (`https://brave-otter-48213.<domain>/`) or `long` (a longer, harder-to-guess
3687
+ * URL). Which one a new URL gets: the request's `length`, else its project's setting, else
3688
+ * its organization's, else `short`.
3689
+ */
3690
+ length?: PreviewLinkLength | null;
3536
3691
  /**
3537
3692
  * The port inside the sandbox.
3538
3693
  */
3539
3694
  port?: number | null;
3540
3695
  sandbox_id: string;
3541
3696
  /**
3542
- * The token the URL carries. Pass it to `DELETE /v1/sandboxes/{id}/ports/{token_or_port}` to
3543
- * revoke this one URL.
3697
+ * The token the URL carries. Pass it in the body of `POST /v1/sandboxes/{id}/ports/revoke`
3698
+ * (`{"token": …}`) to revoke this one URL.
3544
3699
  */
3545
3700
  token?: string | null;
3546
3701
  /**
@@ -3559,10 +3714,35 @@ export interface PortList {
3559
3714
  * `POST /v1/sandboxes/{id}/ports`.
3560
3715
  */
3561
3716
  export interface PortOpen {
3717
+ /**
3718
+ * `short` (`https://brave-otter-48213.<domain>/`) or `long` (a longer, harder-to-guess URL,
3719
+ * for apps with sensitive data). Absent: the project's setting, else the organization's,
3720
+ * else `short`. Custom domains are coming soon.
3721
+ */
3722
+ length?: PreviewLinkLength | null;
3562
3723
  /**
3563
3724
  * 1–65535.
3564
3725
  */
3565
3726
  port: number;
3727
+ /**
3728
+ * Seconds until the URL stops working on its own, 1 to 2592000 (30 days). Absent: it works
3729
+ * until it is revoked or the sandbox ends.
3730
+ */
3731
+ ttl_s?: number | null;
3732
+ }
3733
+ /**
3734
+ * `POST /v1/sandboxes/{id}/ports/revoke`: revoke one URL by its token, or every URL of a port,
3735
+ * with what it names in the body. The token never travels in a URL.
3736
+ */
3737
+ export interface PortRevoke {
3738
+ /**
3739
+ * A port: every URL minted for it is revoked. Exactly one of `token` and `port`.
3740
+ */
3741
+ port?: number | null;
3742
+ /**
3743
+ * The token of the one URL to revoke.
3744
+ */
3745
+ token?: string | null;
3566
3746
  }
3567
3747
  /**
3568
3748
  * `POST /v1/billing/portal` — a link to the billing portal.
@@ -3571,7 +3751,7 @@ export interface PortalSession {
3571
3751
  url: string;
3572
3752
  }
3573
3753
  /**
3574
- * `DELETE /v1/sandboxes/{id}/ports/{token_or_port}`.
3754
+ * `POST /v1/sandboxes/{id}/ports/revoke` and `DELETE /v1/sandboxes/{id}/ports/{token_or_port}`.
3575
3755
  */
3576
3756
  export interface PortsRevoked {
3577
3757
  ok: boolean;
@@ -3582,6 +3762,10 @@ export interface PortsRevoked {
3582
3762
  revoked: Array<string>;
3583
3763
  sandbox_id: string;
3584
3764
  }
3765
+ /**
3766
+ * How long a preview URL is. Custom domains are coming soon.
3767
+ */
3768
+ export type PreviewLinkLength = "short" | "long";
3585
3769
  /**
3586
3770
  * The free credit a new account gets. An account's own credit, and whether it can still claim
3587
3771
  * it, is `GET /v1/credits/offer`.
@@ -3855,8 +4039,9 @@ export interface ProjectMoved {
3855
4039
  export interface ProjectPatch {
3856
4040
  /**
3857
4041
  * Keep a failed sandbox so it can be reopened where it broke, when a run does not say
3858
- * (`capture`): `true` or `false`; `null` = the next level's setting. Set by an owner, on its
3859
- * own (no other field in the same request).
4042
+ * (`capture`): `true` or `false`; `null` = not chosen, so the organization's choice applies,
4043
+ * and where neither chose, the default: not kept unless the organization or project chose to
4044
+ * keep them. Set by an owner, on its own (no other field in the same request).
3860
4045
  */
3861
4046
  failure_captures?: boolean | null;
3862
4047
  /**
@@ -3869,6 +4054,13 @@ export interface ProjectPatch {
3869
4054
  * sandbox ends, 1–30; `null` = the organization's setting. Set by an owner.
3870
4055
  */
3871
4056
  output_retention_days?: number | null;
4057
+ /**
4058
+ * The length of this project's new preview URLs when a request does not say: `short` or
4059
+ * `long` (a longer, harder-to-guess URL, for apps with sensitive data); `null` = the
4060
+ * organization's setting. Set by an owner, on its own (no other field in the same request).
4061
+ * Custom domains are coming soon.
4062
+ */
4063
+ preview_link_length?: PreviewLinkLength | null;
3872
4064
  }
3873
4065
  /**
3874
4066
  * One project. API keys belong to a project; a project holds any number of repositories.
@@ -3883,10 +4075,18 @@ export interface ProjectView {
3883
4075
  */
3884
4076
  default: boolean;
3885
4077
  /**
3886
- * Whether this project's failed sandboxes are kept to reopen, when a run does not say
3887
- * (`capture`); `null` = the organization's setting. Set by an owner.
4078
+ * This project's choice: whether its failed sandboxes are kept to reopen, when a run does not
4079
+ * say (`capture`); `null` = not chosen, so the organization's choice applies, and where
4080
+ * neither chose, the default: not kept unless the organization or project chose to keep
4081
+ * them. Set by an owner. What applies is `failure_captures_effective`.
3888
4082
  */
3889
4083
  failure_captures?: boolean | null;
4084
+ /**
4085
+ * What applies to this project's failed runs when the run does not say (`capture`): kept or
4086
+ * not, and which choice decided it (this project's, its organization's, or the default). A
4087
+ * run's own `capture` is followed either way.
4088
+ */
4089
+ failure_captures_effective?: CapturesEffective | null;
3890
4090
  /**
3891
4091
  * Keys that still work.
3892
4092
  */
@@ -3913,6 +4113,11 @@ export interface ProjectView {
3913
4113
  * organization's setting. Set by an owner.
3914
4114
  */
3915
4115
  output_retention_days?: number | null;
4116
+ /**
4117
+ * The length of this project's new preview URLs when a request does not say (`length`):
4118
+ * `short` or `long`; `null` = the organization's setting. Set by an owner.
4119
+ */
4120
+ preview_link_length?: PreviewLinkLength | null;
3916
4121
  project_id: string;
3917
4122
  }
3918
4123
  export interface Provenance {
@@ -4158,6 +4363,11 @@ export interface ReplayStats {
4158
4363
  success_pct: number;
4159
4364
  }
4160
4365
  export interface Requested {
4366
+ /**
4367
+ * With `network: "allow"`: the only destinations the run's sandboxes may reach, as the run
4368
+ * named them. Absent for the other modes.
4369
+ */
4370
+ allow?: Array<string>;
4161
4371
  allow_partial: boolean;
4162
4372
  count: number;
4163
4373
  /**
@@ -4736,6 +4946,12 @@ export interface Sandbox {
4736
4946
  */
4737
4947
  holdout_passed?: boolean | null;
4738
4948
  holdout_score?: number | null;
4949
+ /**
4950
+ * `PROMIGENCE_INDEX`: this sandbox's place in its run, from 0. A retry, a replay or a
4951
+ * reopened failure keeps its original's. Absent when the run's command set the variable
4952
+ * itself.
4953
+ */
4954
+ index?: number | null;
4739
4955
  /**
4740
4956
  * True when this is a one-time wait: once the waiting sandboxes can start, the rest of the
4741
4957
  * run starts at once too. False otherwise.
@@ -4763,6 +4979,12 @@ export interface Sandbox {
4763
4979
  retry_of?: string | null;
4764
4980
  sandbox_id: string;
4765
4981
  score?: number | null;
4982
+ /**
4983
+ * `PROMIGENCE_SEED`: the number this sandbox's commands were given in that variable. A
4984
+ * retry, a replay or a reopened failure keeps its original's. Absent when the run's command
4985
+ * set the variable itself.
4986
+ */
4987
+ seed?: number | null;
4766
4988
  state: SandboxState;
4767
4989
  t_end?: string | null;
4768
4990
  t_handoff?: string | null;
@@ -5513,6 +5735,12 @@ export interface SecretStored {
5513
5735
  * of the `*`. Present when `hosts` is.
5514
5736
  */
5515
5737
  urls?: Array<string>;
5738
+ /**
5739
+ * Things to know about the value just stored, one `code: sentence` per line; absent when
5740
+ * there are none. `api_key_value`: the value holds an API key of this service, which any
5741
+ * command in a sandbox given this secret can use.
5742
+ */
5743
+ warnings?: Array<string>;
5516
5744
  }
5517
5745
  /**
5518
5746
  * One stored secret, without its value.
@@ -5692,6 +5920,11 @@ export interface SessionTrial {
5692
5920
  */
5693
5921
  export interface SnapshotAliasSet {
5694
5922
  alias: string | null;
5923
+ /**
5924
+ * Take the name from the snapshot of the project that has it, which stays, unnamed. Without
5925
+ * it, a name another snapshot has is refused.
5926
+ */
5927
+ move_alias?: boolean;
5695
5928
  }
5696
5929
  /**
5697
5930
  * What an image occupies in storage: `allocated`, which can be less than its size.
@@ -5745,6 +5978,11 @@ export interface SnapshotCreate {
5745
5978
  * A container image, `REF@sha256:<digest>`; a tag is resolved to its digest first.
5746
5979
  */
5747
5980
  image?: string | null;
5981
+ /**
5982
+ * With `alias`: take the name from the snapshot of the project that has it, which stays,
5983
+ * unnamed. Without it, an `alias` another snapshot has is refused and nothing is built.
5984
+ */
5985
+ move_alias?: boolean;
5748
5986
  /**
5749
5987
  * `github:` repositories: a branch, a tag or a commit sha, resolved to the commit it names
5750
5988
  * when the build is accepted. Default: the repository's default branch.
@@ -5815,9 +6053,10 @@ export interface SnapshotDeduped {
5815
6053
  alias_applied?: boolean | null;
5816
6054
  /**
5817
6055
  * The alias that was asked for, when the snapshot did not hold it. The snapshot takes it
5818
- * (`alias_applied: true`) as a new build would: another snapshot of the project that had it
5819
- * keeps its row, without a name. A snapshot has one alias, so a name it had before gives
5820
- * way, and `warnings` says which.
6056
+ * (`alias_applied: true`) as a new build would: a name another snapshot of the project has
6057
+ * is taken only with `move_alias`, and that snapshot keeps its row, without a name. A
6058
+ * snapshot has one alias, so a name it had before gives way. `warnings` says which names
6059
+ * moved.
5821
6060
  */
5822
6061
  alias_requested?: string | null;
5823
6062
  /**
package/dist/cjs/proxy.js CHANGED
@@ -10,6 +10,7 @@ const node_http_1 = require("node:http");
10
10
  const node_https_1 = require("node:https");
11
11
  const node_tls_1 = require("node:tls");
12
12
  const node_stream_1 = require("node:stream");
13
+ const node_zlib_1 = require("node:zlib");
13
14
  const ca_guard_js_1 = require("./ca-guard.js");
14
15
  function withCertGuard(existing) {
15
16
  return existing === undefined ? ca_guard_js_1.guardCertChain : (0, ca_guard_js_1.makeCertChainGuard)(existing);
@@ -138,7 +139,32 @@ async function bodyOf(init) {
138
139
  return Buffer.from(b);
139
140
  return Buffer.from(await new Response(b).arrayBuffer());
140
141
  }
141
- function toResponse(res) {
142
+ const ACCEPT_ENCODING = "br, gzip";
143
+ function decoded(res) {
144
+ const enc = res.headers["content-encoding"];
145
+ if (typeof enc !== "string")
146
+ return res;
147
+ const steps = [];
148
+ for (const c of enc.toLowerCase().split(",").map((s) => s.trim()).reverse()) {
149
+ if (c === "" || c === "identity")
150
+ continue;
151
+ if (c === "gzip" || c === "x-gzip") {
152
+ steps.push((0, node_zlib_1.createGunzip)({ flush: node_zlib_1.constants.Z_SYNC_FLUSH, finishFlush: node_zlib_1.constants.Z_SYNC_FLUSH }));
153
+ }
154
+ else if (c === "br") {
155
+ steps.push((0, node_zlib_1.createBrotliDecompress)({
156
+ flush: node_zlib_1.constants.BROTLI_OPERATION_FLUSH, finishFlush: node_zlib_1.constants.BROTLI_OPERATION_FLUSH,
157
+ }));
158
+ }
159
+ else {
160
+ return res;
161
+ }
162
+ }
163
+ if (steps.length === 0)
164
+ return res;
165
+ return (0, node_stream_1.pipeline)([res, ...steps], () => { });
166
+ }
167
+ function toResponse(res, head) {
142
168
  const headers = new Headers();
143
169
  for (const [k, v] of Object.entries(res.headers)) {
144
170
  if (v === undefined)
@@ -151,7 +177,8 @@ function toResponse(res) {
151
177
  }
152
178
  const status = res.statusCode ?? 502;
153
179
  const noBody = status === 204 || status === 304;
154
- return new Response(noBody ? null : node_stream_1.Readable.toWeb(res), {
180
+ const body = head ? res : decoded(res);
181
+ return new Response(noBody ? null : node_stream_1.Readable.toWeb(body), {
155
182
  status, statusText: res.statusMessage ?? "", headers,
156
183
  });
157
184
  }
@@ -164,6 +191,8 @@ function proxyFetch(proxy) {
164
191
  const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url);
165
192
  const method = (init?.method ?? "GET").toUpperCase();
166
193
  const headers = headersOf(init);
194
+ if (headers["accept-encoding"] === undefined)
195
+ headers["accept-encoding"] = ACCEPT_ENCODING;
167
196
  const body = await bodyOf(init);
168
197
  if (body)
169
198
  headers["content-length"] = String(body.length);
@@ -186,7 +215,7 @@ function proxyFetch(proxy) {
186
215
  const done = (res) => {
187
216
  settled = true;
188
217
  signal?.removeEventListener("abort", onAbort);
189
- resolve(toResponse(res));
218
+ resolve(toResponse(res, method === "HEAD"));
190
219
  };
191
220
  if (url.protocol === "http:") {
192
221
  const req = proxyRequest({