@promigence/sdk 0.1.0-beta.16 → 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.
@@ -594,6 +594,11 @@ function packContext(dir, opts = {}) {
594
594
  const c = collect(dir, opts);
595
595
  for (const n of c.notes)
596
596
  opts.onNote?.(n);
597
+ const files = new Set(c.entries.filter((e) => e.kind !== "dir").map((e) => e.rel));
598
+ const unknown = [...new Set((opts.allowSecretFiles ?? []).map(insidePath))].filter((p) => !files.has(p));
599
+ if (unknown.length > 0) {
600
+ throw new core_js_1.InvalidArgumentError(`allowSecretFiles ${unknown.join(", ")}: no such file in this upload`, 'Name each file as listContext names it (its path inside the context sent), e.g. { allowSecretFiles: ["certs/test.pem"] }.');
601
+ }
597
602
  if (c.bytes > max) {
598
603
  const ig = c.ignore?.file;
599
604
  throw new core_js_1.InvalidArgumentError(`the build context is over ${max} bytes${ig ? ` even without what its ${ig} excludes` : ""}`, `${ig ? `Exclude more in ${ig}` : "Add a .dockerignore"}, point --context at a smaller directory, or pass a git URL pinned to a full 40-character sha.`);
@@ -1,5 +1,5 @@
1
1
  /** Promigence SDK — constants, error hierarchy and shared types. */
2
- export declare const VERSION = "0.1.0-beta.16";
2
+ export declare const VERSION = "0.1.0-beta.17";
3
3
  export declare const DOCS_URL = "https://promigence.ai";
4
4
  /** The error reference; each code is an anchor on it (the API's `docs` link has the same form). */
5
5
  export declare const ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
@@ -229,6 +229,20 @@ export declare class TimeoutError extends PromigenceError {
229
229
  export declare class ServiceRestartError extends PromigenceError {
230
230
  constructor(message: string, fix: string);
231
231
  }
232
+ /**
233
+ * The connection dropped while a command was running (`sandboxes.exec`, `execStream`,
234
+ * `commands.run`), and the command could not be picked up again: no client came back for it in
235
+ * time, or the service no longer keeps it. The sandbox keeps running. `retryable` is `false`: the
236
+ * command may have done part of its work before it stopped, so run it again only if that is safe.
237
+ * exit 3
238
+ */
239
+ export declare class ExecLostError extends PromigenceError {
240
+ /** The sandbox the command ran in. */
241
+ readonly sandboxId: string | undefined;
242
+ constructor(message: string, ids?: {
243
+ sandboxId?: string;
244
+ }, lost?: "gone" | "not_reattached" | "unreachable");
245
+ }
232
246
  /** An API error with no more specific class (5xx, unknown code). exit from the table. */
233
247
  export declare class ApiError extends PromigenceError {
234
248
  }
@@ -266,6 +280,12 @@ export interface CommandResult {
266
280
  truncated?: boolean;
267
281
  /** `exec_id`, for `promigence exec output <exec_id>` / `GET /sandboxes/:id/execs/:exec_id`. */
268
282
  execId?: string;
283
+ /**
284
+ * `true` when the command was killed at its own time bound (see `timeoutMs`), `false` for any
285
+ * other exit. With `throwOnExit: false` this is how a result tells a timeout from any other
286
+ * exit 137, such as an out-of-memory kill or a `kill -9`. Set on every result the SDK returns.
287
+ */
288
+ timedOut?: boolean;
269
289
  }
270
290
  export interface CommandRunOpts {
271
291
  cwd?: string;
@@ -277,7 +297,10 @@ export interface CommandRunOpts {
277
297
  * (or the default 15 minutes).
278
298
  */
279
299
  timeoutMs?: number;
280
- /** Throw `CommandExitError` on non-zero exit (default true). */
300
+ /**
301
+ * Throw `CommandExitError` on non-zero exit (default true). With `false`, a foreground command's
302
+ * result comes back instead, and its `timedOut` says whether it was killed at its time bound.
303
+ */
281
304
  throwOnExit?: boolean;
282
305
  /** Inline output budget; `truncated` beyond it (default 64 KiB). */
283
306
  maxOutputBytes?: number;
package/dist/cjs/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EXIT_BY_CODE = exports.NotReleasedError = exports.ApiError = exports.ServiceRestartError = exports.TimeoutError = exports.RateLimitError = exports.UnreachableError = exports.NotFoundError = exports.AuthError = exports.NotVerifiedError = exports.SpendCapError = exports.CommandExitError = exports.EnvFailedError = exports.SandboxEndedError = exports.SANDBOX_ENDED_FIX = exports.PreviewsUnavailableError = exports.UnsupportedError = exports.InvalidArgumentError = exports.PromigenceError = exports.PREVIEWS_UNAVAILABLE = exports.FILE_PUT_CHUNK_BYTES = exports.MAX_OUTPUT_BYTES_DEFAULT = exports.IMAGE_BUILD_LIST_PRICE = exports.IMAGE_BUILD_TIMEOUT_MS = exports.WAIT_TIMEOUT_MS = exports.KEY_CONTACT = exports.DEFAULT_API_URL = exports.ERRORS_DOCS_URL = exports.DOCS_URL = exports.VERSION = void 0;
3
+ exports.EXIT_BY_CODE = exports.NotReleasedError = exports.ApiError = exports.ExecLostError = exports.ServiceRestartError = exports.TimeoutError = exports.RateLimitError = exports.UnreachableError = exports.NotFoundError = exports.AuthError = exports.NotVerifiedError = exports.SpendCapError = exports.CommandExitError = exports.EnvFailedError = exports.SandboxEndedError = exports.SANDBOX_ENDED_FIX = exports.PreviewsUnavailableError = exports.UnsupportedError = exports.InvalidArgumentError = exports.PromigenceError = exports.PREVIEWS_UNAVAILABLE = exports.FILE_PUT_CHUNK_BYTES = exports.MAX_OUTPUT_BYTES_DEFAULT = exports.IMAGE_BUILD_LIST_PRICE = exports.IMAGE_BUILD_TIMEOUT_MS = exports.WAIT_TIMEOUT_MS = exports.KEY_CONTACT = exports.DEFAULT_API_URL = exports.ERRORS_DOCS_URL = exports.DOCS_URL = exports.VERSION = void 0;
4
4
  exports.errorsDocsFor = errorsDocsFor;
5
5
  exports.previewsFix = previewsFix;
6
6
  exports.withPreviewsFix = withPreviewsFix;
@@ -9,7 +9,7 @@ exports.previewsOff = previewsOff;
9
9
  exports.sandboxEndedIn = sandboxEndedIn;
10
10
  exports.exitForCode = exitForCode;
11
11
  const hint_js_1 = require("./hint.js");
12
- exports.VERSION = "0.1.0-beta.16";
12
+ exports.VERSION = "0.1.0-beta.17";
13
13
  exports.DOCS_URL = "https://promigence.ai";
14
14
  exports.ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
15
15
  function errorsDocsFor(code) {
@@ -118,9 +118,14 @@ class PreviewsUnavailableError extends InvalidArgumentError {
118
118
  }
119
119
  exports.PreviewsUnavailableError = PreviewsUnavailableError;
120
120
  const SANDBOX_ENDED = /^sandbox (\S+) has ended \(`([a-z_]+)`\)/;
121
+ const SANDBOX_EXPIRED = /^sandbox (\S+) reached its timeout and ended\b/;
121
122
  function sandboxEndedIn(message) {
122
- const m = SANDBOX_ENDED.exec(message.trim());
123
- return m ? { sandboxId: m[1], state: m[2] } : undefined;
123
+ const text = message.trim();
124
+ const m = SANDBOX_ENDED.exec(text);
125
+ if (m)
126
+ return { sandboxId: m[1], state: m[2] };
127
+ const x = SANDBOX_EXPIRED.exec(text);
128
+ return x ? { sandboxId: x[1], state: "ended" } : undefined;
124
129
  }
125
130
  exports.SANDBOX_ENDED_FIX = "Start a new sandbox: Sandbox.create(). This one's getInfo() says how it ended (`outcome`).";
126
131
  class SandboxEndedError extends InvalidArgumentError {
@@ -243,6 +248,21 @@ class ServiceRestartError extends PromigenceError {
243
248
  }
244
249
  }
245
250
  exports.ServiceRestartError = ServiceRestartError;
251
+ const EXEC_LOST_FIX = "The sandbox is still running; the command was stopped, maybe after part of its work: run it again if that is safe. " +
252
+ "Billed unless the drop was ours: then email support@promigence.ai with the sandbox id.";
253
+ class ExecLostError extends PromigenceError {
254
+ sandboxId;
255
+ lost;
256
+ constructor(message, ids = {}, lost = "gone") {
257
+ super({
258
+ code: "exec_lost", message, fix: EXEC_LOST_FIX, docs: `${exports.ERRORS_DOCS_URL}#exec_lost`,
259
+ exitCode: 3, category: "env", retryable: false,
260
+ });
261
+ this.sandboxId = ids.sandboxId;
262
+ this.lost = lost;
263
+ }
264
+ }
265
+ exports.ExecLostError = ExecLostError;
246
266
  class ApiError extends PromigenceError {
247
267
  }
248
268
  exports.ApiError = ApiError;
@@ -263,6 +283,7 @@ exports.EXIT_BY_CODE = {
263
283
  not_connected: 7,
264
284
  service_restart: 3,
265
285
  digest_mismatch: 4,
286
+ exec_lost: 3,
266
287
  fork_failed: 3, start_timeout: 3, readiness_failed: 3, verify_too_slow: 3,
267
288
  verify_each_failed: 3, toolchain_mismatch: 3, sandbox_unresponsive: 3, oom_within_tier: 3,
268
289
  disk_full_within_tier: 3, sandbox_interrupted: 3, integrity_mismatch: 3, egress_unavailable: 3,
@@ -114,9 +114,10 @@ class CommandHandle {
114
114
  stderr: this.stderr,
115
115
  truncated: Boolean(this.record.truncated),
116
116
  execId: this.pid,
117
+ timedOut: (0, command_errors_js_1.exitTimedOut)(this.record.exit, this.opts.timeoutMs),
117
118
  };
118
119
  if (result.exitCode !== 0) {
119
- if ((0, command_errors_js_1.exitTimedOut)(this.record.exit, this.opts.timeoutMs))
120
+ if (result.timedOut)
120
121
  throw new command_errors_js_1.CommandTimeoutError(result, this.opts.timeoutMs);
121
122
  throw new core_js_1.CommandExitError(result);
122
123
  }
package/dist/cjs/http2.js CHANGED
@@ -41,6 +41,7 @@ const FETCH_AT_LOAD = globalThis.fetch;
41
41
  const PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
42
42
  const OFF = new Set(["0", "false", "off", "no"]);
43
43
  const NOT_IN_H2 = new Set(["connection", "keep-alive", "proxy-connection", "transfer-encoding", "upgrade", "host", "te"]);
44
+ const ACCEPT_ENCODING = "br, gzip";
44
45
  function http2Allowed(opt, env = process.env) {
45
46
  try {
46
47
  const envFlag = env["PROMIGENCE_HTTP2"]?.trim().toLowerCase();
@@ -1100,6 +1101,8 @@ function exchange(pool, entry, target, init, deadline) {
1100
1101
  if (!NOT_IN_H2.has(name))
1101
1102
  headers[name] = init.headers[k];
1102
1103
  }
1104
+ if (headers["accept-encoding"] === undefined)
1105
+ headers["accept-encoding"] = ACCEPT_ENCODING;
1103
1106
  headers[http2.sensitiveHeaders] = ["authorization"];
1104
1107
  const body = init.body === undefined ? undefined : Buffer.from(init.body, "utf8");
1105
1108
  if (body !== undefined)
@@ -1663,6 +1666,8 @@ class TransportThread {
1663
1666
  if (!NOT_IN_H2.has(name))
1664
1667
  headers[name] = init.headers[k];
1665
1668
  }
1669
+ if (headers["accept-encoding"] === undefined)
1670
+ headers["accept-encoding"] = ACCEPT_ENCODING;
1666
1671
  if (init.body !== undefined)
1667
1672
  headers["content-length"] = Buffer.byteLength(init.body, "utf8");
1668
1673
  const id = this.nextId++;
@@ -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
  /**
@@ -969,6 +971,24 @@ export interface CaptureView {
969
971
  */
970
972
  snapshot_id: string;
971
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";
972
992
  /**
973
993
  * The card on file, enough to recognise it.
974
994
  */
@@ -1508,6 +1528,45 @@ export interface ErrorBody {
1508
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.
1509
1529
  */
1510
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
+ }
1511
1570
  /**
1512
1571
  * `POST /v1/sandboxes/{id}/execs`, and the `exec` of `POST /v1/runs`: one command. `argv` (a
1513
1572
  * non-empty list) or `sh` (a shell line) is required.
@@ -1614,8 +1673,9 @@ export interface ExecResult {
1614
1673
  */
1615
1674
  oom_killed?: boolean;
1616
1675
  /**
1617
- * Why the command ended without an exit code: `timeout`, `out_of_memory` or `signal`.
1618
- * 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.
1619
1679
  */
1620
1680
  reason?: string | null;
1621
1681
  sandbox_id: string;
@@ -1796,7 +1856,8 @@ export interface Failure {
1796
1856
  }
1797
1857
  export type FailureCategory = "env" | "snapshot" | "task" | "cap" | "grader" | "preempt" | "other";
1798
1858
  /**
1799
- * `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.
1800
1861
  */
1801
1862
  export interface FileArchive {
1802
1863
  /**
@@ -1804,13 +1865,15 @@ export interface FileArchive {
1804
1865
  */
1805
1866
  exclude?: Array<string>;
1806
1867
  /**
1807
- * 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.
1808
1870
  */
1809
1871
  out?: string | null;
1810
1872
  path: string;
1811
1873
  }
1812
1874
  /**
1813
- * `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.
1814
1877
  */
1815
1878
  export interface FileChmod {
1816
1879
  gid?: number | null;
@@ -1820,7 +1883,8 @@ export interface FileChmod {
1820
1883
  uid?: number | null;
1821
1884
  }
1822
1885
  /**
1823
- * `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.
1824
1888
  */
1825
1889
  export interface FileCopy {
1826
1890
  from: string;
@@ -1829,7 +1893,8 @@ export interface FileCopy {
1829
1893
  to: string;
1830
1894
  }
1831
1895
  /**
1832
- * `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.
1833
1898
  */
1834
1899
  export interface FileDeleteRequest {
1835
1900
  path: string;
@@ -1850,7 +1915,8 @@ export interface FileDeleted {
1850
1915
  sandbox_id: string;
1851
1916
  }
1852
1917
  /**
1853
- * `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.
1854
1920
  */
1855
1921
  export interface FileExtract {
1856
1922
  archive: string;
@@ -1890,7 +1956,7 @@ export interface FileListRequest {
1890
1956
  */
1891
1957
  limit?: number | null;
1892
1958
  /**
1893
- * The directory (absolute). Default: `/`.
1959
+ * The directory: absolute, or relative to the sandbox's working directory. Default: `/`.
1894
1960
  */
1895
1961
  path?: string | null;
1896
1962
  /**
@@ -1914,7 +1980,8 @@ export interface FileListing {
1914
1980
  truncated: boolean;
1915
1981
  }
1916
1982
  /**
1917
- * `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).
1918
1985
  */
1919
1986
  export interface FileMkdir {
1920
1987
  mode?: FileMode | null;
@@ -1929,7 +1996,8 @@ export interface FileMkdir {
1929
1996
  */
1930
1997
  export type FileMode = number | string;
1931
1998
  /**
1932
- * `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.
1933
2001
  */
1934
2002
  export interface FileMove {
1935
2003
  from: string;
@@ -1937,8 +2005,8 @@ export interface FileMove {
1937
2005
  to: string;
1938
2006
  }
1939
2007
  /**
1940
- * `POST /v1/sandboxes/{id}/files/read` and `POST /v1/sandboxes/{id}/files/stat`: one path,
1941
- * 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).
1942
2010
  */
1943
2011
  export interface FilePathRequest {
1944
2012
  path: string;
@@ -1964,7 +2032,8 @@ export interface FileSearchRequest {
1964
2032
  */
1965
2033
  limit?: number | null;
1966
2034
  /**
1967
- * The directory to search (absolute). Default: `/`.
2035
+ * The directory to search: absolute, or relative to the sandbox's working directory.
2036
+ * Default: `/`.
1968
2037
  */
1969
2038
  path?: string | null;
1970
2039
  /**
@@ -2958,6 +3027,11 @@ export interface Me {
2958
3027
  */
2959
3028
  spend?: number | null;
2960
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;
2961
3035
  /**
2962
3036
  * The organisation's trial credit. Absent for a key that may not see the organisation's
2963
3037
  * money: only an owner's key of the default project does.
@@ -2982,6 +3056,11 @@ export interface MeConcurrency {
2982
3056
  * The limits in force for an organisation.
2983
3057
  */
2984
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;
2985
3064
  /**
2986
3065
  * Sandboxes that may be live at once.
2987
3066
  */
@@ -2990,6 +3069,10 @@ export interface MeLimits {
2990
3069
  * Sandboxes that may be starting at once.
2991
3070
  */
2992
3071
  max_inflight: number;
3072
+ /**
3073
+ * Paused sandboxes that may be kept; `null` for no limit.
3074
+ */
3075
+ max_paused?: number | null;
2993
3076
  /**
2994
3077
  * The largest sandbox shape, in vCPU; `null` for no limit.
2995
3078
  */
@@ -2998,6 +3081,41 @@ export interface MeLimits {
2998
3081
  * The longest a sandbox may live, in seconds; `null` for no limit.
2999
3082
  */
3000
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;
3001
3119
  }
3002
3120
  /**
3003
3121
  * `GET /v1/orgs/{org_id}/members`.
@@ -3229,8 +3347,9 @@ export interface OrgList {
3229
3347
  export interface OrgPatch {
3230
3348
  /**
3231
3349
  * Keep a failed sandbox so it can be reopened where it broke, when a run does not say
3232
- * (`capture`): `true` or `false`; `null` = the next level's setting. Set by an owner, on its
3233
- * 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).
3234
3353
  */
3235
3354
  failure_captures?: boolean | null;
3236
3355
  /**
@@ -3243,6 +3362,13 @@ export interface OrgPatch {
3243
3362
  * owner.
3244
3363
  */
3245
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;
3246
3372
  }
3247
3373
  /**
3248
3374
  * One organization you belong to. Billing, members and credits belong to it.
@@ -3261,10 +3387,18 @@ export interface OrgView {
3261
3387
  */
3262
3388
  default: boolean;
3263
3389
  /**
3264
- * Whether a failed sandbox is kept so you can reopen it where it broke, when a run does not
3265
- * 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`.
3266
3394
  */
3267
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;
3268
3402
  members: number;
3269
3403
  name: string;
3270
3404
  org_id: string;
@@ -3273,6 +3407,11 @@ export interface OrgView {
3273
3407
  * name its own.
3274
3408
  */
3275
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;
3276
3415
  projects: number;
3277
3416
  /**
3278
3417
  * Your role in it: `owner` or `member`.
@@ -3543,6 +3682,12 @@ export interface Port {
3543
3682
  * need this form.
3544
3683
  */
3545
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;
3546
3691
  /**
3547
3692
  * The port inside the sandbox.
3548
3693
  */
@@ -3569,6 +3714,12 @@ export interface PortList {
3569
3714
  * `POST /v1/sandboxes/{id}/ports`.
3570
3715
  */
3571
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;
3572
3723
  /**
3573
3724
  * 1–65535.
3574
3725
  */
@@ -3611,6 +3762,10 @@ export interface PortsRevoked {
3611
3762
  revoked: Array<string>;
3612
3763
  sandbox_id: string;
3613
3764
  }
3765
+ /**
3766
+ * How long a preview URL is. Custom domains are coming soon.
3767
+ */
3768
+ export type PreviewLinkLength = "short" | "long";
3614
3769
  /**
3615
3770
  * The free credit a new account gets. An account's own credit, and whether it can still claim
3616
3771
  * it, is `GET /v1/credits/offer`.
@@ -3884,8 +4039,9 @@ export interface ProjectMoved {
3884
4039
  export interface ProjectPatch {
3885
4040
  /**
3886
4041
  * Keep a failed sandbox so it can be reopened where it broke, when a run does not say
3887
- * (`capture`): `true` or `false`; `null` = the next level's setting. Set by an owner, on its
3888
- * 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).
3889
4045
  */
3890
4046
  failure_captures?: boolean | null;
3891
4047
  /**
@@ -3898,6 +4054,13 @@ export interface ProjectPatch {
3898
4054
  * sandbox ends, 1–30; `null` = the organization's setting. Set by an owner.
3899
4055
  */
3900
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;
3901
4064
  }
3902
4065
  /**
3903
4066
  * One project. API keys belong to a project; a project holds any number of repositories.
@@ -3912,10 +4075,18 @@ export interface ProjectView {
3912
4075
  */
3913
4076
  default: boolean;
3914
4077
  /**
3915
- * Whether this project's failed sandboxes are kept to reopen, when a run does not say
3916
- * (`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`.
3917
4082
  */
3918
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;
3919
4090
  /**
3920
4091
  * Keys that still work.
3921
4092
  */
@@ -3942,6 +4113,11 @@ export interface ProjectView {
3942
4113
  * organization's setting. Set by an owner.
3943
4114
  */
3944
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;
3945
4121
  project_id: string;
3946
4122
  }
3947
4123
  export interface Provenance {
@@ -5559,6 +5735,12 @@ export interface SecretStored {
5559
5735
  * of the `*`. Present when `hosts` is.
5560
5736
  */
5561
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>;
5562
5744
  }
5563
5745
  /**
5564
5746
  * One stored secret, without its value.