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

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.
@@ -113,6 +113,108 @@ export interface AutoPauseSet {
113
113
  ok: boolean;
114
114
  sandbox_id: string;
115
115
  }
116
+ /**
117
+ * Auto-reload: when available credits fall below `threshold_usd`, `amount_usd` is charged to
118
+ * `card` and added as credits.
119
+ */
120
+ export interface AutoReload {
121
+ /**
122
+ * What each reload adds, whole USD.
123
+ */
124
+ amount_usd: number;
125
+ /**
126
+ * What turning auto-reload on asks the owner to accept.
127
+ */
128
+ authorization: AutoReloadAuthorization;
129
+ /**
130
+ * The payment method a reload charges.
131
+ */
132
+ card?: CardOnFile | null;
133
+ /**
134
+ * The latest reload; `null` before the first.
135
+ */
136
+ last?: AutoReloadLast | null;
137
+ /**
138
+ * Whether auto-reload is on.
139
+ */
140
+ on: boolean;
141
+ /**
142
+ * Why auto-reload is paused, or `null`: `declined`, `authentication_required`, `daily_limit`,
143
+ * `disputed`, `amount_over_limit` or `support`.
144
+ */
145
+ paused_reason?: string | null;
146
+ /**
147
+ * With `paused_reason` `daily_limit`, which limit of the day it reached: `count` (the most
148
+ * auto-reloads in a day) or `amount` (the most purchases and reloads can add in a day); `null`
149
+ * otherwise.
150
+ */
151
+ paused_why?: string | null;
152
+ /**
153
+ * The level that starts a reload, whole USD.
154
+ */
155
+ threshold_usd: number;
156
+ /**
157
+ * Why auto-reload cannot be turned on for this payment method, or `null`: `card_country`.
158
+ */
159
+ unavailable_reason?: string | null;
160
+ }
161
+ /**
162
+ * The authorization an owner accepts to turn auto-reload on.
163
+ */
164
+ export interface AutoReloadAuthorization {
165
+ /**
166
+ * Its words, with `{card}`, `{amount}`, `{threshold}`, `{n}` and `{day_max}` to fill in.
167
+ */
168
+ template: string;
169
+ /**
170
+ * Its version: turning auto-reload on sends it back, to say which words were accepted.
171
+ */
172
+ version: string;
173
+ }
174
+ /**
175
+ * The latest auto-reload.
176
+ */
177
+ export interface AutoReloadLast {
178
+ /**
179
+ * USD.
180
+ */
181
+ amount_usd: number;
182
+ /**
183
+ * When it was charged, RFC 3339.
184
+ */
185
+ at: string;
186
+ /**
187
+ * While it is unpaid, the page to pay it.
188
+ */
189
+ pay_url?: string | null;
190
+ /**
191
+ * `pending`, `paid`, `needs_action` (the bank asks you to confirm it) or `failed`.
192
+ */
193
+ state: string;
194
+ }
195
+ /**
196
+ * `PUT /v1/billing/auto-reload`.
197
+ */
198
+ export interface AutoReloadSet {
199
+ /**
200
+ * What each reload adds, whole USD; omitted: unchanged.
201
+ */
202
+ amount_usd?: number | null;
203
+ /**
204
+ * The version of the authorization the owner accepted (`auto_reload.authorization.version` of
205
+ * `GET /v1/billing`). Needed to turn auto-reload on, or to change the level, the amount or the
206
+ * card.
207
+ */
208
+ authorization_version?: string | null;
209
+ /**
210
+ * Whether auto-reload is on.
211
+ */
212
+ on: boolean;
213
+ /**
214
+ * The level that starts a reload, whole USD; omitted: unchanged.
215
+ */
216
+ threshold_usd?: number | null;
217
+ }
116
218
  /**
117
219
  * A background command, as `GET /v1/sandboxes/{id}/execs/{exec_id}` reports it, and as the
118
220
  * `202` from `POST /v1/sandboxes/{id}/execs` with `background: true` hands it over.
@@ -243,6 +345,37 @@ export interface BackgroundExecList {
243
345
  execs: Array<BackgroundExec>;
244
346
  sandbox_id: string;
245
347
  }
348
+ /**
349
+ * What the organization's credits can pay for.
350
+ */
351
+ export interface BillingCredits {
352
+ /**
353
+ * What new work can use: the balance less what is held, never below 0, USD.
354
+ */
355
+ available_usd: number;
356
+ /**
357
+ * Credits on the account, USD.
358
+ */
359
+ balance_usd: number;
360
+ /**
361
+ * Available credits cannot start new work.
362
+ */
363
+ exhausted: boolean;
364
+ /**
365
+ * Of the balance, what running and paused work may still use, plus data out sent and not yet
366
+ * charged and, once storage is priced, the next 7 days of storage, USD.
367
+ */
368
+ held_usd: number;
369
+ /**
370
+ * Available credits are below the low-balance level.
371
+ */
372
+ low: boolean;
373
+ /**
374
+ * The credits that expire next: how much and when; `null` when none expire in the next 30
375
+ * days.
376
+ */
377
+ next_expiry?: CreditsExpiry | null;
378
+ }
246
379
  /**
247
380
  * `GET /v1/billing/history` — your billing history, newest first: every credit you received and
248
381
  * every payment, one page at a time.
@@ -273,6 +406,32 @@ export interface BillingHistoryEntry {
273
406
  */
274
407
  payment?: Payment | null;
275
408
  }
409
+ /**
410
+ * A hold that refuses new work.
411
+ */
412
+ export interface BillingHold {
413
+ /**
414
+ * The disputed payment, or the unpaid invoice, USD.
415
+ */
416
+ amount_usd: number;
417
+ /**
418
+ * The disputed payment's id, for `POST /v1/billing/disputes/{dispute_id}/repay`; `null` for an
419
+ * invoice.
420
+ */
421
+ dispute_id?: string | null;
422
+ /**
423
+ * `dispute_open`, `dispute_lost`, `pre_move_unpaid` or `invoice_unpaid`.
424
+ */
425
+ kind: string;
426
+ /**
427
+ * Why, in words.
428
+ */
429
+ reason: string;
430
+ /**
431
+ * The page that lifts it: the invoice's page to pay it; `null` for a disputed payment.
432
+ */
433
+ url?: string | null;
434
+ }
276
435
  /**
277
436
  * The billing period `usage` covers.
278
437
  */
@@ -291,11 +450,16 @@ export interface BillingPeriod {
291
450
  start: string;
292
451
  }
293
452
  /**
294
- * `GET /v1/billing` — plan, card on file, this month's usage, and the upcoming invoice preview.
295
- * Never fails because the payment provider is slow: the estimate is the only part that asks it,
296
- * and its failure is a field, not a status.
453
+ * `GET /v1/billing` — plan, credits, auto-reload, card on file, this month's usage, and the next
454
+ * plan invoice. Never fails because the payment provider is slow: the estimate is the only part
455
+ * that asks it, and its failure is a field, not a status.
297
456
  */
298
457
  export interface BillingStatus {
458
+ /**
459
+ * Auto-reload: when available credits fall below `threshold_usd`, `amount_usd` is charged to
460
+ * `card` and added as credits.
461
+ */
462
+ auto_reload: AutoReload;
299
463
  /**
300
464
  * False while card billing is not available.
301
465
  */
@@ -311,30 +475,82 @@ export interface BillingStatus {
311
475
  */
312
476
  card_note?: string | null;
313
477
  card_on_file: boolean;
478
+ /**
479
+ * What the organization's credits can pay for.
480
+ */
481
+ credits: BillingCredits;
314
482
  /**
315
483
  * True once a billing customer exists for the organisation.
316
484
  */
317
485
  customer: boolean;
486
+ /**
487
+ * A hold that refuses new work, or `null`: `kind`, `reason`, `amount_usd`, `dispute_id` for a
488
+ * disputed payment, and `url`, the page that lifts it.
489
+ */
490
+ hold?: BillingHold | null;
318
491
  /**
319
492
  * The $1 that confirms the payment method on file when it has no stable payer (Apple Pay,
320
493
  * Google Pay, Amazon Pay); `null` when it needed none.
321
494
  */
322
495
  method_check?: MethodCheckView | null;
496
+ /**
497
+ * How usage is paid: `credits` (from credits bought in advance) or `postpaid` (billed after use,
498
+ * until `switch.at`).
499
+ */
500
+ model: string;
323
501
  notice?: TrialNotice | null;
324
502
  org_id: string;
325
503
  period: BillingPeriod;
326
504
  plan: string;
505
+ /**
506
+ * The plan in force: `id`, `name`, `renews_at`, and `renewal` while a renewal payment is in
507
+ * trouble.
508
+ */
509
+ plan_status: PlanStatus;
327
510
  suspend_reason?: string | null;
328
511
  suspended: boolean;
512
+ /**
513
+ * For a `postpaid` organization: `at`, when it moves to credits, and `credits_waiting_usd`, the
514
+ * credits bought before then, ready at the move.
515
+ */
516
+ switch?: BillingSwitch | null;
329
517
  trial: TrialStatus;
330
518
  /**
331
- * The payment provider's estimate of the next invoice; `null` when there is no
332
- * subscription, or when the estimate could not be fetched (see `upcoming_invoice_error`).
519
+ * The most this organization can buy now.
520
+ */
521
+ trust: TrustLimits;
522
+ /**
523
+ * The next invoice, estimated: a plan's fee, and for an organization not yet on credits, its
524
+ * usage. `null` when there is neither, or when the estimate could not be fetched (see
525
+ * `upcoming_invoice_error`).
333
526
  */
334
527
  upcoming_invoice?: UpcomingInvoice | null;
335
528
  upcoming_invoice_error?: string | null;
336
529
  usage: PeriodUsage;
337
530
  }
531
+ /**
532
+ * When a `postpaid` organization moves to credits.
533
+ */
534
+ export interface BillingSwitch {
535
+ /**
536
+ * When it moves to credits, RFC 3339.
537
+ */
538
+ at: string;
539
+ /**
540
+ * The credits bought before then, ready at the move, USD.
541
+ */
542
+ credits_waiting_usd: number;
543
+ }
544
+ /**
545
+ * What one build holds of the credits.
546
+ */
547
+ export interface BuildCreditHold {
548
+ build_id: string;
549
+ /**
550
+ * What it may still use, USD.
551
+ */
552
+ held_usd: number;
553
+ }
338
554
  /**
339
555
  * An identical build that was already in progress, answered as if it were the caller's own.
340
556
  */
@@ -829,7 +1045,7 @@ export interface CheckoutSession {
829
1045
  mode: string;
830
1046
  session_id?: string | null;
831
1047
  /**
832
- * Open this. Adding a card keeps any trial credit that is left.
1048
+ * Open this. Your credits are kept.
833
1049
  */
834
1050
  url: string;
835
1051
  }
@@ -925,7 +1141,7 @@ export interface CliTokenCreate {
925
1141
  /**
926
1142
  * Every error and failure code the API returns.
927
1143
  */
928
- export type Code = "fork_failed" | "start_timeout" | "readiness_failed" | "verify_too_slow" | "verify_each_failed" | "sandbox_unresponsive" | "oom_within_tier" | "disk_full_within_tier" | "sandbox_interrupted" | "integrity_mismatch" | "egress_unavailable" | "service_timeout" | "capacity_busy" | "verify_did_not_cover" | "nonzero_exit" | "task_timeout" | "oom_over_tier" | "disk_over_tier" | "cap_killed" | "cap_exceeded" | "aborted_by_client" | "expired" | "not_started" | "superseded" | "usage" | "internal" | "auth" | "not_found" | "unreachable" | "rate_limited" | "timeout" | "not_verified" | "enoent" | "trial_credits_exhausted" | "card_required" | "concurrency_limit" | "egress_cap_reached" | "network_policy_unsupported" | "network_host_refused" | "toolchain_mismatch" | "resume_unavailable" | "sandbox_unreachable" | "region_at_capacity" | "tier_unavailable" | "snapshot_unavailable" | "capacity_limit" | "build_timeout" | "builder_unavailable" | "builder_busy" | "overloaded" | "preempted" | "grader_failed" | "grade_not_passed" | "shutdown_by_task" | "modified_by_task" | "cap_paused" | "credits_paused" | "stopped_by_support" | "forbidden" | "snapshot_incompatible" | "storage_limit_reached" | "dockerfile_build_failed" | "image_unresolvable" | "registry_unavailable" | "credit_unclaimed" | "billing_unavailable" | "project_cap_reached" | "spend_limit_reached" | "billing_hold" | "tier_over_plan" | "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" | "setup_required";
1144
+ export type Code = "fork_failed" | "start_timeout" | "readiness_failed" | "verify_too_slow" | "verify_each_failed" | "sandbox_unresponsive" | "oom_within_tier" | "disk_full_within_tier" | "sandbox_interrupted" | "integrity_mismatch" | "egress_unavailable" | "service_timeout" | "capacity_busy" | "verify_did_not_cover" | "nonzero_exit" | "task_timeout" | "oom_over_tier" | "disk_over_tier" | "cap_killed" | "cap_exceeded" | "aborted_by_client" | "expired" | "not_started" | "superseded" | "usage" | "internal" | "auth" | "not_found" | "unreachable" | "rate_limited" | "timeout" | "not_verified" | "enoent" | "trial_credits_exhausted" | "credits_exhausted" | "card_required" | "purchase_limit" | "purchases_blocked" | "card_needed" | "auto_reload_unavailable" | "concurrency_limit" | "egress_cap_reached" | "network_policy_unsupported" | "network_host_refused" | "toolchain_mismatch" | "resume_unavailable" | "sandbox_unreachable" | "region_at_capacity" | "tier_unavailable" | "snapshot_unavailable" | "capacity_limit" | "build_timeout" | "builder_unavailable" | "builder_busy" | "overloaded" | "preempted" | "grader_failed" | "grade_not_passed" | "shutdown_by_task" | "modified_by_task" | "cap_paused" | "credits_paused" | "stopped_by_support" | "forbidden" | "snapshot_incompatible" | "storage_limit_reached" | "dockerfile_build_failed" | "image_unresolvable" | "registry_unavailable" | "credit_unclaimed" | "billing_unavailable" | "project_cap_reached" | "spend_limit_reached" | "billing_hold" | "tier_over_plan" | "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" | "setup_required";
929
1145
  export interface Concurrency {
930
1146
  }
931
1147
  /**
@@ -1024,7 +1240,7 @@ export interface CreditGrant {
1024
1240
  */
1025
1241
  granted_at: string;
1026
1242
  /**
1027
- * USD.
1243
+ * USD. For `credit_taken_back`, what was taken back.
1028
1244
  */
1029
1245
  granted_usd: number;
1030
1246
  /**
@@ -1032,7 +1248,10 @@ export interface CreditGrant {
1032
1248
  * `referral` (a referral reward), `plan` (usage included with a paid plan),
1033
1249
  * `from_promigence` (credit Promigence added to your account), `service_restart` (credit
1034
1250
  * for a command a service restart stopped), `confirmation_credit` (a $1 charge that
1035
- * confirmed a payment method, added back as credit), or `other`.
1251
+ * confirmed a payment method, added back as credit), `credits_bought` (credits bought on a
1252
+ * payment page), `auto_reload` (credits added by auto-reload), `credit_taken_back` (credits
1253
+ * taken back after a refund or a dispute), `credit_regranted` (credits given back after a
1254
+ * dispute was decided for you, withdrawn or closed), or `other`.
1036
1255
  */
1037
1256
  kind: string;
1038
1257
  /**
@@ -1046,6 +1265,33 @@ export interface CreditGrant {
1046
1265
  */
1047
1266
  status: string;
1048
1267
  }
1268
+ /**
1269
+ * `GET /v1/billing/holds` — What each running or paused sandbox holds of the organization's
1270
+ * credits.
1271
+ */
1272
+ export interface CreditHolds {
1273
+ /**
1274
+ * Each build still running, and what it holds.
1275
+ */
1276
+ builds: Array<BuildCreditHold>;
1277
+ /**
1278
+ * Data out sent and not yet charged, USD.
1279
+ */
1280
+ data_out_usd: number;
1281
+ /**
1282
+ * Of the balance, what running and paused work may still use, plus data out sent and not yet
1283
+ * charged and, once storage is priced, the next 7 days of storage, USD.
1284
+ */
1285
+ held_usd: number;
1286
+ /**
1287
+ * Each running or paused sandbox, and what it holds.
1288
+ */
1289
+ sandboxes: Array<SandboxCreditHold>;
1290
+ /**
1291
+ * The next 7 days of storage, once storage is priced, USD.
1292
+ */
1293
+ storage_usd: number;
1294
+ }
1049
1295
  /**
1050
1296
  * The account's free credit (`GET /v1/credits/offer`, and the answer to a claim). The credit is
1051
1297
  * claimed in the browser, where the terms are accepted: `POST /v1/credits/claim-link` makes the
@@ -1083,6 +1329,52 @@ export interface CreditOffer {
1083
1329
  */
1084
1330
  state: string;
1085
1331
  }
1332
+ /**
1333
+ * `POST /v1/billing/credits`.
1334
+ */
1335
+ export interface CreditsBuy {
1336
+ /**
1337
+ * What to buy, in whole dollars, from 5.
1338
+ */
1339
+ amount_usd: number;
1340
+ }
1341
+ /**
1342
+ * Credits that expire, and when.
1343
+ */
1344
+ export interface CreditsExpiry {
1345
+ /**
1346
+ * USD.
1347
+ */
1348
+ amount_usd: number;
1349
+ /**
1350
+ * RFC 3339.
1351
+ */
1352
+ at: string;
1353
+ }
1354
+ /**
1355
+ * `POST /v1/billing/credits/{session_id}/settle` — Check a credits payment and add its credits if it
1356
+ * went through. Safe to call more than once.
1357
+ */
1358
+ export interface CreditsSettled {
1359
+ /**
1360
+ * USD.
1361
+ */
1362
+ amount_usd: number;
1363
+ /**
1364
+ * With `paid`: what new work can use now, USD.
1365
+ */
1366
+ available_usd?: number | null;
1367
+ /**
1368
+ * `paid` (the credits were added), `paid_awaiting_switch` (paid; the credits are added at
1369
+ * `switch_at`), `open` (not paid yet), `processing` (paid; the payment is still being
1370
+ * confirmed), `expired` (no payment was made) or `failed` (the payment did not go through).
1371
+ */
1372
+ state: string;
1373
+ /**
1374
+ * With `paid_awaiting_switch`: when the credits are added, RFC 3339.
1375
+ */
1376
+ switch_at?: string | null;
1377
+ }
1086
1378
  /**
1087
1379
  * One entry of a directory listing.
1088
1380
  */
@@ -1106,7 +1398,7 @@ export interface DirEntry {
1106
1398
  /**
1107
1399
  * The exact bytes of `path`, base64, when the name is not UTF-8: `name` and `path` then show
1108
1400
  * U+FFFD where those bytes are, and name no file. A directory holding such names is fetched
1109
- * exactly as an archive (`GET …/files/archive`).
1401
+ * exactly as an archive (`POST …/files/archive`).
1110
1402
  */
1111
1403
  path_b64?: string | null;
1112
1404
  /**
@@ -1210,7 +1502,7 @@ export interface ErrorBody {
1210
1502
  /**
1211
1503
  * 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.
1212
1504
  */
1213
- 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" | "credit_unclaimed" | "setup_required" | "card_required" | "billing_unavailable" | "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";
1505
+ 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";
1214
1506
  /**
1215
1507
  * `POST /v1/sandboxes/{id}/execs`, and the `exec` of `POST /v1/runs`: one command. `argv` (a
1216
1508
  * non-empty list) or `sh` (a shell line) is required.
@@ -1531,6 +1823,13 @@ export interface FileCopy {
1531
1823
  recursive?: boolean | null;
1532
1824
  to: string;
1533
1825
  }
1826
+ /**
1827
+ * `DELETE /v1/sandboxes/{id}/files`: a path, and `recursive` for a directory with something in it.
1828
+ */
1829
+ export interface FileDeleteRequest {
1830
+ path: string;
1831
+ recursive?: boolean | null;
1832
+ }
1534
1833
  /**
1535
1834
  * `DELETE /v1/sandboxes/{id}/files`. Idempotent: a path that was not there is a 200 with
1536
1835
  * `existed: false`, not a 404.
@@ -1570,7 +1869,32 @@ export interface FileInfo {
1570
1869
  size: number;
1571
1870
  }
1572
1871
  /**
1573
- * The reply to `GET /v1/sandboxes/:id/files/list`.
1872
+ * `POST /v1/sandboxes/{id}/files/list`: one directory, or a walk below it.
1873
+ */
1874
+ export interface FileListRequest {
1875
+ /**
1876
+ * How many levels a recursive walk goes down.
1877
+ */
1878
+ depth?: number | null;
1879
+ /**
1880
+ * `false` leaves out names starting with `.`; they are listed by default.
1881
+ */
1882
+ hidden?: boolean | null;
1883
+ /**
1884
+ * At most this many entries; past it the answer says `truncated: true`.
1885
+ */
1886
+ limit?: number | null;
1887
+ /**
1888
+ * The directory (absolute). Default: `/`.
1889
+ */
1890
+ path?: string | null;
1891
+ /**
1892
+ * Walk below the directory too.
1893
+ */
1894
+ recursive?: boolean | null;
1895
+ }
1896
+ /**
1897
+ * The reply to `POST /v1/sandboxes/:id/files/list`.
1574
1898
  */
1575
1899
  export interface FileListing {
1576
1900
  entries: Array<DirEntry>;
@@ -1607,6 +1931,42 @@ export interface FileMove {
1607
1931
  overwrite?: boolean | null;
1608
1932
  to: string;
1609
1933
  }
1934
+ /**
1935
+ * `POST /v1/sandboxes/{id}/files/read` and `POST /v1/sandboxes/{id}/files/stat`: one path,
1936
+ * absolute, inside the sandbox.
1937
+ */
1938
+ export interface FilePathRequest {
1939
+ path: string;
1940
+ }
1941
+ /**
1942
+ * `POST /v1/sandboxes/{id}/files/search`: `pattern`, `contains`, or both.
1943
+ */
1944
+ export interface FileSearchRequest {
1945
+ /**
1946
+ * Literal text to find inside the files that match; a match carries its line.
1947
+ */
1948
+ contains?: string | null;
1949
+ /**
1950
+ * `false` leaves out names starting with `.`; they are searched by default.
1951
+ */
1952
+ hidden?: boolean | null;
1953
+ /**
1954
+ * Match `contains` without regard to case.
1955
+ */
1956
+ ignore_case?: boolean | null;
1957
+ /**
1958
+ * At most this many matches; past it the answer says `truncated: true`.
1959
+ */
1960
+ limit?: number | null;
1961
+ /**
1962
+ * The directory to search (absolute). Default: `/`.
1963
+ */
1964
+ path?: string | null;
1965
+ /**
1966
+ * A glob over the file name, e.g. `*.py`.
1967
+ */
1968
+ pattern?: string | null;
1969
+ }
1610
1970
  /**
1611
1971
  * Size, mode, modification time and kind for one path, as the sandbox reports them.
1612
1972
  */
@@ -1625,7 +1985,7 @@ export interface FileStat {
1625
1985
  size?: number | null;
1626
1986
  }
1627
1987
  /**
1628
- * `GET /v1/sandboxes/{id}/files/stat`.
1988
+ * `POST /v1/sandboxes/{id}/files/stat`.
1629
1989
  */
1630
1990
  export interface FileStatView {
1631
1991
  path: string;
@@ -1633,7 +1993,7 @@ export interface FileStatView {
1633
1993
  stat: FileStat;
1634
1994
  }
1635
1995
  /**
1636
- * The answer to `PUT /v1/sandboxes/{id}/files` (the request body is the file's bytes).
1996
+ * The answer to `PUT /v1/sandboxes/{id}/files` (a form: `path`, `mode`, `offset` and the `file`).
1637
1997
  */
1638
1998
  export interface FileWritten {
1639
1999
  /**
@@ -1645,12 +2005,12 @@ export interface FileWritten {
1645
2005
  */
1646
2006
  chunks: number;
1647
2007
  /**
1648
- * The file's permission bits after the write, octal (`644`). Without `?mode=` a file that
2008
+ * The file's permission bits after the write, octal (`644`). Without `mode` a file that
1649
2009
  * already existed keeps its own, and a new file is `644`.
1650
2010
  */
1651
2011
  mode: string;
1652
2012
  /**
1653
- * Where this request's bytes start in the file (`?offset=`, else 0).
2013
+ * Where this request's bytes start in the file (`offset`, else 0).
1654
2014
  */
1655
2015
  offset: number;
1656
2016
  ok: boolean;
@@ -2857,14 +3217,27 @@ export interface OrgList {
2857
3217
  orgs: Array<OrgView>;
2858
3218
  }
2859
3219
  /**
2860
- * `PATCH /v1/orgs/{org}`: rename the organization. Its id never changes; anything that names
2861
- * it by the old name (a script, `--org`, a saved URL) must use the new one.
3220
+ * `PATCH /v1/orgs/{org}`: rename the organization, set how long its command output is kept, or
3221
+ * both: at least one field. Its id never changes; anything that names it by the old name (a
3222
+ * script, `--org`, a saved URL) must use the new one.
2862
3223
  */
2863
3224
  export interface OrgPatch {
3225
+ /**
3226
+ * 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).
3229
+ */
3230
+ failure_captures?: boolean | null;
2864
3231
  /**
2865
3232
  * 1–40 lowercase letters, digits and dashes.
2866
3233
  */
2867
- name: string;
3234
+ name?: string | null;
3235
+ /**
3236
+ * Days the organization's command output (what its commands ran and printed) is kept after
3237
+ * its sandbox ends, 1–30; `null` = the default, 7. A project may name its own. Set by an
3238
+ * owner.
3239
+ */
3240
+ output_retention_days?: number | null;
2868
3241
  }
2869
3242
  /**
2870
3243
  * One organization you belong to. Billing, members and credits belong to it.
@@ -2882,9 +3255,19 @@ export interface OrgView {
2882
3255
  * True for the organization a sign-in and the CLI use when none is named.
2883
3256
  */
2884
3257
  default: boolean;
3258
+ /**
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.
3261
+ */
3262
+ failure_captures?: boolean | null;
2885
3263
  members: number;
2886
3264
  name: string;
2887
3265
  org_id: string;
3266
+ /**
3267
+ * Days command output is kept after a sandbox ends; `null` = the default, 7. A project may
3268
+ * name its own.
3269
+ */
3270
+ output_retention_days?: number | null;
2888
3271
  projects: number;
2889
3272
  /**
2890
3273
  * Your role in it: `owner` or `member`.
@@ -2985,24 +3368,38 @@ export interface Payment {
2985
3368
  * The invoice's number, as the invoice shows it; `null` when not known.
2986
3369
  */
2987
3370
  invoice_number?: string | null;
3371
+ /**
3372
+ * The invoice, as a PDF.
3373
+ */
3374
+ invoice_pdf?: string | null;
2988
3375
  /**
2989
3376
  * The invoice's page: its receipt once it is paid, where to pay it while a payment has
2990
3377
  * failed; `null` when not known.
2991
3378
  */
2992
3379
  invoice_url?: string | null;
2993
3380
  /**
2994
- * `invoice_paid`, `payment_failed`, `refund`, or `method_check` (a charge, usually $1, that
2995
- * confirmed a payment method; it comes back as credit).
3381
+ * `invoice_paid`, `payment_failed`, `refund`, `method_check` (a charge, usually $1, that
3382
+ * confirmed a payment method; it comes back as credit), `credits_bought` (credits bought on a
3383
+ * payment page), `auto_reload` (credits added by auto-reload), `plan_invoice` (a plan's fee),
3384
+ * or `dispute_repaid` (a disputed payment, repaid).
2996
3385
  */
2997
3386
  kind: string;
2998
3387
  /**
2999
3388
  * `method_check`: the payment method it confirmed, by name (`Apple Pay`); `null` otherwise.
3000
3389
  */
3001
3390
  method?: string | null;
3391
+ /**
3392
+ * While it is unpaid, the page to pay it.
3393
+ */
3394
+ pay_url?: string | null;
3002
3395
  /**
3003
3396
  * The plan whose fee the invoice billed; `null` when it billed usage alone.
3004
3397
  */
3005
3398
  plan?: string | null;
3399
+ /**
3400
+ * The receipt.
3401
+ */
3402
+ receipt_url?: string | null;
3006
3403
  /**
3007
3404
  * `paid` (for a payment that failed: paid since), `retrying` (it failed and will be tried
3008
3405
  * again), `failed` (it failed and will not be tried again; for `method_check`, the method
@@ -3010,6 +3407,27 @@ export interface Payment {
3010
3407
  */
3011
3408
  status: string;
3012
3409
  }
3410
+ /**
3411
+ * A payment page to open (buying credits, or repaying a disputed payment).
3412
+ */
3413
+ export interface PaymentPage {
3414
+ /**
3415
+ * What it charges, USD.
3416
+ */
3417
+ amount_usd: number;
3418
+ /**
3419
+ * When the page stops working, RFC 3339.
3420
+ */
3421
+ expires_at: string;
3422
+ /**
3423
+ * The page's id: `POST /v1/billing/credits/{session_id}/settle` checks it.
3424
+ */
3425
+ session_id: string;
3426
+ /**
3427
+ * Open this to pay.
3428
+ */
3429
+ url: string;
3430
+ }
3013
3431
  export interface Percentiles {
3014
3432
  p50: number;
3015
3433
  p95: number;
@@ -3023,12 +3441,12 @@ export interface Percentiles {
3023
3441
  */
3024
3442
  export interface PeriodUsage {
3025
3443
  /**
3026
- * What is left for the card.
3444
+ * Usage billed after use, for an organization not yet on credits; 0 on credits.
3027
3445
  */
3028
3446
  billable: number;
3029
3447
  builds: BuildUsage;
3030
3448
  /**
3031
- * Of `total`, what trial credits paid.
3449
+ * Of `total`, what credits paid.
3032
3450
  */
3033
3451
  credits_applied: number;
3034
3452
  /**
@@ -3048,15 +3466,59 @@ export interface PeriodUsage {
3048
3466
  * Sandbox time by tier.
3049
3467
  */
3050
3468
  sandboxes: Record<string, SandboxUsage>;
3469
+ /**
3470
+ * Storage, USD; absent when it is $0.
3471
+ */
3472
+ storage?: number | null;
3051
3473
  /**
3052
3474
  * USD.
3053
3475
  */
3054
3476
  total: number;
3055
3477
  /**
3056
- * Charges not yet reported to the payment provider.
3478
+ * Charges not yet billed, for an organization not yet on credits; 0 on credits.
3057
3479
  */
3058
3480
  unreported_entries: number;
3059
3481
  }
3482
+ /**
3483
+ * A renewal payment in trouble. The plan stays in force while it is tried again.
3484
+ */
3485
+ export interface PlanRenewal {
3486
+ /**
3487
+ * When it is tried again, RFC 3339; `null` when no try is due.
3488
+ */
3489
+ next_try_at?: string | null;
3490
+ /**
3491
+ * The page to pay or confirm it.
3492
+ */
3493
+ pay_url?: string | null;
3494
+ /**
3495
+ * `past_due` (the payment did not go through and is tried again) or `action_required` (your
3496
+ * bank asks you to confirm it).
3497
+ */
3498
+ state: string;
3499
+ }
3500
+ /**
3501
+ * The plan in force.
3502
+ */
3503
+ export interface PlanStatus {
3504
+ /**
3505
+ * The plan's id, as `plan` names it.
3506
+ */
3507
+ id: string;
3508
+ /**
3509
+ * The plan's name.
3510
+ */
3511
+ name: string;
3512
+ /**
3513
+ * While a renewal payment is in trouble: what stands and the page that settles it; `null`
3514
+ * otherwise.
3515
+ */
3516
+ renewal?: PlanRenewal | null;
3517
+ /**
3518
+ * When it renews, RFC 3339; `null` for a plan that does not renew.
3519
+ */
3520
+ renews_at?: string | null;
3521
+ }
3060
3522
  /**
3061
3523
  * One preview URL. Anyone holding the URL can reach the port behind it — it is a bearer token in
3062
3524
  * a link.
@@ -3201,8 +3663,8 @@ export interface PricingLimits {
3201
3663
  export interface PricingPlan {
3202
3664
  display_name: string;
3203
3665
  /**
3204
- * Trial rules apply: work is paid from free credit, within the trial's limits, until a card is
3205
- * added.
3666
+ * The trial's limits apply until a card not already used by another organization is added, or
3667
+ * credits are bought.
3206
3668
  */
3207
3669
  on_trial: boolean;
3208
3670
  /**
@@ -3311,7 +3773,12 @@ export interface PricingView {
3311
3773
  */
3312
3774
  granularity_seconds: number;
3313
3775
  /**
3314
- * Usage the monthly fee includes each month, USD.
3776
+ * For how many paid months the plan adds `included_credits_usd`; `null` when it adds them every
3777
+ * paid month.
3778
+ */
3779
+ included_credits_promo_months?: number | null;
3780
+ /**
3781
+ * Credits the plan adds each paid month, USD.
3315
3782
  */
3316
3783
  included_credits_usd: number;
3317
3784
  limits: PricingLimits;
@@ -3386,11 +3853,22 @@ export interface ProjectMoved {
3386
3853
  * `PATCH /v1/orgs/{org}/projects/{project}`: at least one field.
3387
3854
  */
3388
3855
  export interface ProjectPatch {
3856
+ /**
3857
+ * 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).
3860
+ */
3861
+ failure_captures?: boolean | null;
3389
3862
  /**
3390
3863
  * A monthly spending cap in USD, 0–1000000; `null` removes the cap.
3391
3864
  */
3392
3865
  monthly_cap_usd?: number | null;
3393
3866
  name?: string | null;
3867
+ /**
3868
+ * Days this project's command output (what its commands ran and printed) is kept after its
3869
+ * sandbox ends, 1–30; `null` = the organization's setting. Set by an owner.
3870
+ */
3871
+ output_retention_days?: number | null;
3394
3872
  }
3395
3873
  /**
3396
3874
  * One project. API keys belong to a project; a project holds any number of repositories.
@@ -3404,6 +3882,11 @@ export interface ProjectView {
3404
3882
  * True for the project every organization starts with. It cannot be renamed or deleted.
3405
3883
  */
3406
3884
  default: boolean;
3885
+ /**
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.
3888
+ */
3889
+ failure_captures?: boolean | null;
3407
3890
  /**
3408
3891
  * Keys that still work.
3409
3892
  */
@@ -3425,6 +3908,11 @@ export interface ProjectView {
3425
3908
  monthly_cap_usd?: number | null;
3426
3909
  name: string;
3427
3910
  org_id: string;
3911
+ /**
3912
+ * Days this project's command output is kept after a sandbox ends; `null` = the
3913
+ * organization's setting. Set by an owner.
3914
+ */
3915
+ output_retention_days?: number | null;
3428
3916
  project_id: string;
3429
3917
  }
3430
3918
  export interface Provenance {
@@ -3522,12 +4010,13 @@ export interface ReferralApplied {
3522
4010
  */
3523
4011
  qualifying_plans: Array<string>;
3524
4012
  /**
3525
- * Compute credit this organization gets when it pays its first plan invoice, USD.
4013
+ * Compute credit this organization gets (or got) once it first pays at least this much, for
4014
+ * credits or a plan, USD.
3526
4015
  */
3527
4016
  reward_usd: number;
3528
4017
  /**
3529
- * `pending` (your credit comes with your first paid plan invoice), `under_review`, or — at
3530
- * sign-in only — `not_applied`.
4018
+ * `pending` (your credit comes with your first payment of at least the reward), `under_review`,
4019
+ * or — at sign-in only — `not_applied`.
3531
4020
  */
3532
4021
  status: string;
3533
4022
  }
@@ -3582,7 +4071,8 @@ export interface ReferralOffer {
3582
4071
  */
3583
4072
  get_usd: number;
3584
4073
  /**
3585
- * Compute credit the friend gets when they pay their first plan invoice, USD.
4074
+ * Compute credit the friend gets once they first pay at least this much, for credits or a plan,
4075
+ * USD.
3586
4076
  */
3587
4077
  give_usd: number;
3588
4078
  /**
@@ -3638,7 +4128,8 @@ export interface ReferralStatus {
3638
4128
  */
3639
4129
  export interface ReferredBy {
3640
4130
  /**
3641
- * Compute credit this organization gets (or got) when it pays its first plan invoice, USD.
4131
+ * Compute credit this organization gets (or got) once it first pays at least this much, for
4132
+ * credits or a plan, USD.
3642
4133
  */
3643
4134
  reward_usd: number;
3644
4135
  /**
@@ -4284,6 +4775,33 @@ export interface Sandbox {
4284
4775
  warm_measured?: WarmMeasured | null;
4285
4776
  warnings?: Array<string>;
4286
4777
  }
4778
+ /**
4779
+ * What one sandbox holds of the credits.
4780
+ */
4781
+ export interface SandboxCreditHold {
4782
+ /**
4783
+ * How long it has run, in milliseconds.
4784
+ */
4785
+ elapsed_ms: number;
4786
+ /**
4787
+ * When its timeout ends it, RFC 3339; `null` while it is paused.
4788
+ */
4789
+ ends_at?: string | null;
4790
+ /**
4791
+ * What it may still use, USD.
4792
+ */
4793
+ held_usd: number;
4794
+ sandbox_id: string;
4795
+ /**
4796
+ * `running` or `paused`.
4797
+ */
4798
+ state: string;
4799
+ /**
4800
+ * Its timeout, in milliseconds, counted from its hand-over: `PATCH /v1/sandboxes/{id}`
4801
+ * `timeout_ms` shortens it.
4802
+ */
4803
+ timeout_ms: number;
4804
+ }
4287
4805
  /**
4288
4806
  * The sandbox's new lifetime and what it costs.
4289
4807
  */
@@ -4406,7 +4924,8 @@ export interface SandboxPatch {
4406
4924
  */
4407
4925
  auto_pause_s?: number | null;
4408
4926
  /**
4409
- * The new lifetime in milliseconds, counted from now.
4927
+ * The sandbox's new lifetime in milliseconds, counted from its hand-over. A longer one extends
4928
+ * it; a shorter one is accepted down to the time it has run plus 60 seconds.
4410
4929
  */
4411
4930
  timeout_ms?: number | null;
4412
4931
  }
@@ -4777,6 +5296,29 @@ export interface SandboxView {
4777
5296
  verify_each_ms?: number | null;
4778
5297
  warnings: Array<string>;
4779
5298
  }
5299
+ /**
5300
+ * `POST /v1/sandboxes/resume`.
5301
+ */
5302
+ export interface SandboxesResume {
5303
+ /**
5304
+ * `credits`: every sandbox paused because credits ran out.
5305
+ */
5306
+ paused_for: string;
5307
+ }
5308
+ /**
5309
+ * `POST /v1/sandboxes/resume` — Resume every sandbox paused because credits ran out. Each resume
5310
+ * is checked like new work. The answer says how many resumed and how many still need credits.
5311
+ */
5312
+ export interface SandboxesResumed {
5313
+ /**
5314
+ * The sandboxes that resumed.
5315
+ */
5316
+ resumed: Array<string>;
5317
+ /**
5318
+ * The sandboxes still paused because credits do not cover them.
5319
+ */
5320
+ still_need_credits: Array<string>;
5321
+ }
4780
5322
  /**
4781
5323
  * How the grader's result is read.
4782
5324
  */
@@ -4842,7 +5384,7 @@ export interface SearchMatch {
4842
5384
  text?: string | null;
4843
5385
  }
4844
5386
  /**
4845
- * The reply to `GET /v1/sandboxes/:id/files/search`.
5387
+ * The reply to `POST /v1/sandboxes/:id/files/search`.
4846
5388
  */
4847
5389
  export interface SearchResult {
4848
5390
  matches: Array<SearchMatch>;
@@ -6002,8 +6544,8 @@ export interface TrialStatus {
6002
6544
  */
6003
6545
  credits_reserved: number;
6004
6546
  /**
6005
- * Data out included this month, in GiB: the plan's allowance. Above it, data out is billed,
6006
- * or stopped when the org cannot be billed (no card); `null` when the plan includes none.
6547
+ * Data out included this month, in GiB: the plan's allowance. Above it, data out is paid from
6548
+ * credits and is cut when they run out; `null` when the plan includes none.
6007
6549
  */
6008
6550
  egress_gb_cap?: number | null;
6009
6551
  /**
@@ -6021,6 +6563,27 @@ export interface TrialStatus {
6021
6563
  on_trial: boolean;
6022
6564
  policy: TrialPolicy;
6023
6565
  }
6566
+ /**
6567
+ * What this organization can buy now.
6568
+ */
6569
+ export interface TrustLimits {
6570
+ /**
6571
+ * The most purchases and reloads can add today, USD.
6572
+ */
6573
+ per_day_max_usd: number;
6574
+ /**
6575
+ * The most one purchase can be now, a plan's fee included, USD.
6576
+ */
6577
+ per_purchase_max_usd: number;
6578
+ /**
6579
+ * The most one auto-reload can add, USD.
6580
+ */
6581
+ reload_max_usd: number;
6582
+ /**
6583
+ * The most auto-reloads in a day.
6584
+ */
6585
+ reloads_per_day: number;
6586
+ }
6024
6587
  /**
6025
6588
  * The payment provider's estimate of the next invoice. Amounts are USD; each is `null` when
6026
6589
  * the provider did not state it.