@promigence/sdk 0.1.0-beta.6 → 0.1.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/cjs/client.d.ts +100 -24
- package/dist/cjs/client.js +44 -31
- package/dist/cjs/core.d.ts +10 -1
- package/dist/cjs/core.js +14 -4
- package/dist/cjs/credstore.d.ts +3 -2
- package/dist/cjs/credstore.js +17 -4
- package/dist/cjs/models.gen.d.ts +218 -22
- package/dist/cjs/proxy.js +2 -1
- package/dist/cjs/pty.d.ts +65 -3
- package/dist/cjs/pty.js +270 -34
- package/dist/cjs/sandbox.d.ts +34 -4
- package/dist/cjs/sandbox.js +3 -2
- package/dist/cjs/ssh.js +1 -0
- package/dist/client.d.ts +100 -24
- package/dist/client.js +46 -33
- package/dist/core.d.ts +10 -1
- package/dist/core.js +12 -3
- package/dist/credstore.d.ts +3 -2
- package/dist/credstore.js +17 -4
- package/dist/models.gen.d.ts +218 -22
- package/dist/proxy.js +2 -1
- package/dist/pty.d.ts +65 -3
- package/dist/pty.js +269 -33
- package/dist/sandbox.d.ts +34 -4
- package/dist/sandbox.js +3 -2
- package/dist/ssh.js +1 -0
- package/package.json +1 -1
package/dist/models.gen.d.ts
CHANGED
|
@@ -72,7 +72,9 @@ export interface AuthConfig {
|
|
|
72
72
|
*/
|
|
73
73
|
console_authorize_url?: string | null;
|
|
74
74
|
/**
|
|
75
|
-
* The sign-in
|
|
75
|
+
* The sign-in methods to offer, as name -> label (`email`, `google`, `github`). A client that
|
|
76
|
+
* asks the sign-in pages for one method passes the label as their `identity_provider`, except
|
|
77
|
+
* `email`, which is the pages' own form and needs none.
|
|
76
78
|
*/
|
|
77
79
|
identity_providers: Record<string, string>;
|
|
78
80
|
/**
|
|
@@ -81,7 +83,6 @@ export interface AuthConfig {
|
|
|
81
83
|
* account signs in as before either way.
|
|
82
84
|
*/
|
|
83
85
|
invite_mode?: boolean;
|
|
84
|
-
issuer: string;
|
|
85
86
|
/**
|
|
86
87
|
* The redirect URIs a command-line client may listen on.
|
|
87
88
|
*/
|
|
@@ -90,10 +91,6 @@ export interface AuthConfig {
|
|
|
90
91
|
* Where a headless sign-in lands instead, to show a code to paste back.
|
|
91
92
|
*/
|
|
92
93
|
paste_redirect_uri: string;
|
|
93
|
-
/**
|
|
94
|
-
* Which identity service is in front of the API.
|
|
95
|
-
*/
|
|
96
|
-
provider: string;
|
|
97
94
|
scopes: Array<string>;
|
|
98
95
|
token_url: string;
|
|
99
96
|
}
|
|
@@ -246,6 +243,36 @@ export interface BackgroundExecList {
|
|
|
246
243
|
execs: Array<BackgroundExec>;
|
|
247
244
|
sandbox_id: string;
|
|
248
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* `GET /v1/billing/history` — your billing history, newest first: every credit you received and
|
|
248
|
+
* every payment, one page at a time.
|
|
249
|
+
*/
|
|
250
|
+
export interface BillingHistory {
|
|
251
|
+
entries: Array<BillingHistoryEntry>;
|
|
252
|
+
/**
|
|
253
|
+
* Pass as `cursor` for the next, older page; `null` on the last page.
|
|
254
|
+
*/
|
|
255
|
+
next_cursor?: string | null;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* One entry of your billing history: a credit you received or a payment. Exactly one of
|
|
259
|
+
* `credit` and `payment` is set.
|
|
260
|
+
*/
|
|
261
|
+
export interface BillingHistoryEntry {
|
|
262
|
+
/**
|
|
263
|
+
* When it happened, RFC 3339: when a credit was added, when a payment was made, failed or
|
|
264
|
+
* was refunded.
|
|
265
|
+
*/
|
|
266
|
+
at: string;
|
|
267
|
+
/**
|
|
268
|
+
* A credit you received; `null` for a payment.
|
|
269
|
+
*/
|
|
270
|
+
credit?: CreditGrant | null;
|
|
271
|
+
/**
|
|
272
|
+
* A payment; `null` for a credit.
|
|
273
|
+
*/
|
|
274
|
+
payment?: Payment | null;
|
|
275
|
+
}
|
|
249
276
|
/**
|
|
250
277
|
* The billing period `usage` covers.
|
|
251
278
|
*/
|
|
@@ -264,9 +291,9 @@ export interface BillingPeriod {
|
|
|
264
291
|
start: string;
|
|
265
292
|
}
|
|
266
293
|
/**
|
|
267
|
-
* `GET /v1/billing` — plan, card on file, this month's usage, and the upcoming invoice
|
|
268
|
-
*
|
|
269
|
-
*
|
|
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.
|
|
270
297
|
*/
|
|
271
298
|
export interface BillingStatus {
|
|
272
299
|
/**
|
|
@@ -277,11 +304,22 @@ export interface BillingStatus {
|
|
|
277
304
|
* `null` while no card is on file.
|
|
278
305
|
*/
|
|
279
306
|
card?: CardOnFile | null;
|
|
307
|
+
/**
|
|
308
|
+
* A sentence to show beside the card when it does not unlock paid limits for this
|
|
309
|
+
* organization (it already pays for another one, or it is being confirmed with a $1 charge, or
|
|
310
|
+
* that charge did not go through); `null` otherwise.
|
|
311
|
+
*/
|
|
312
|
+
card_note?: string | null;
|
|
280
313
|
card_on_file: boolean;
|
|
281
314
|
/**
|
|
282
315
|
* True once a billing customer exists for the organisation.
|
|
283
316
|
*/
|
|
284
317
|
customer: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* The $1 that confirms the payment method on file when it has no stable payer (Apple Pay,
|
|
320
|
+
* Google Pay, Amazon Pay); `null` when it needed none.
|
|
321
|
+
*/
|
|
322
|
+
method_check?: MethodCheckView | null;
|
|
285
323
|
notice?: TrialNotice | null;
|
|
286
324
|
org_id: string;
|
|
287
325
|
period: BillingPeriod;
|
|
@@ -660,7 +698,15 @@ export interface CaptureView {
|
|
|
660
698
|
* The card on file, enough to recognise it.
|
|
661
699
|
*/
|
|
662
700
|
export interface CardOnFile {
|
|
701
|
+
/**
|
|
702
|
+
* The card's brand (`visa`, `mastercard`, ...); for a card held in a wallet, the wallet
|
|
703
|
+
* (`apple_pay`, `google_pay`); for another payment method, its kind (`link`, `cashapp`,
|
|
704
|
+
* `amazon_pay`).
|
|
705
|
+
*/
|
|
663
706
|
brand?: string | null;
|
|
707
|
+
/**
|
|
708
|
+
* The card's last four digits; `null` for a payment method without a card number.
|
|
709
|
+
*/
|
|
664
710
|
last4?: string | null;
|
|
665
711
|
}
|
|
666
712
|
/**
|
|
@@ -825,7 +871,7 @@ export interface CliTokenCreate {
|
|
|
825
871
|
/**
|
|
826
872
|
* Every error and failure code the API returns.
|
|
827
873
|
*/
|
|
828
|
-
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" | "forbidden" | "snapshot_incompatible" | "storage_limit_reached" | "dockerfile_build_failed" | "image_unresolvable" | "registry_unavailable" | "credit_unclaimed" | "billing_unavailable" | "project_cap_reached" | "spend_limit_reached" | "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";
|
|
874
|
+
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";
|
|
829
875
|
export interface Concurrency {
|
|
830
876
|
}
|
|
831
877
|
/**
|
|
@@ -911,6 +957,41 @@ export interface CreditClaim {
|
|
|
911
957
|
terms_version?: string | null;
|
|
912
958
|
token?: string | null;
|
|
913
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* A credit your organization received, and what is left of it.
|
|
962
|
+
*/
|
|
963
|
+
export interface CreditGrant {
|
|
964
|
+
/**
|
|
965
|
+
* When it expires, RFC 3339; `null` when it never expires.
|
|
966
|
+
*/
|
|
967
|
+
expires_at?: string | null;
|
|
968
|
+
/**
|
|
969
|
+
* When it was added, RFC 3339.
|
|
970
|
+
*/
|
|
971
|
+
granted_at: string;
|
|
972
|
+
/**
|
|
973
|
+
* USD.
|
|
974
|
+
*/
|
|
975
|
+
granted_usd: number;
|
|
976
|
+
/**
|
|
977
|
+
* What it is: `free_credit` (the free credit), `card_bonus` (credit for adding a card),
|
|
978
|
+
* `referral` (a referral reward), `plan` (usage included with a paid plan),
|
|
979
|
+
* `from_promigence` (credit Promigence added to your account), `service_restart` (credit
|
|
980
|
+
* for a command a service restart stopped), `confirmation_credit` (a $1 charge that
|
|
981
|
+
* confirmed a payment method, added back as credit), or `other`.
|
|
982
|
+
*/
|
|
983
|
+
kind: string;
|
|
984
|
+
/**
|
|
985
|
+
* What is left of it, USD: 0 once it is used, expired or taken back. Credit that expires
|
|
986
|
+
* soonest is used first, and credit that never expires last.
|
|
987
|
+
*/
|
|
988
|
+
remaining_usd: number;
|
|
989
|
+
/**
|
|
990
|
+
* `active` (some of it is left), `used` (all of it was used), `expired` (it expired before
|
|
991
|
+
* all of it was used), or `taken_back`.
|
|
992
|
+
*/
|
|
993
|
+
status: string;
|
|
994
|
+
}
|
|
914
995
|
/**
|
|
915
996
|
* The account's free credit (`GET /v1/credits/offer`, and the answer to a claim). The credit is
|
|
916
997
|
* claimed in the browser, where the terms are accepted: `POST /v1/credits/claim-link` makes the
|
|
@@ -937,6 +1018,11 @@ export interface CreditOffer {
|
|
|
937
1018
|
* One sentence for a person.
|
|
938
1019
|
*/
|
|
939
1020
|
message: string;
|
|
1021
|
+
/**
|
|
1022
|
+
* USD charged to confirm a payment method with no stable payer when it is added (Apple Pay,
|
|
1023
|
+
* Google Pay, Amazon Pay): it is added to your credit, and the card bonus comes with it.
|
|
1024
|
+
*/
|
|
1025
|
+
method_check_usd?: number;
|
|
940
1026
|
/**
|
|
941
1027
|
* `claimable`, `claimed`, `pending_review`, `needs_card`, `not_eligible`, `offer_ended`,
|
|
942
1028
|
* `denied` or `none`.
|
|
@@ -1070,7 +1156,7 @@ export interface ErrorBody {
|
|
|
1070
1156
|
/**
|
|
1071
1157
|
* 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.
|
|
1072
1158
|
*/
|
|
1073
|
-
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" | "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" | "card_required" | "billing_unavailable" | "concurrency_limit" | "egress_cap_reached" | "project_cap_reached" | "spend_limit_reached" | "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";
|
|
1159
|
+
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";
|
|
1074
1160
|
/**
|
|
1075
1161
|
* `POST /v1/sandboxes/{id}/execs`, and the `exec` of `POST /v1/runs`: one command. `argv` (a
|
|
1076
1162
|
* non-empty list) or `sh` (a shell line) is required.
|
|
@@ -1989,9 +2075,10 @@ export interface Guard {
|
|
|
1989
2075
|
*/
|
|
1990
2076
|
export interface Health {
|
|
1991
2077
|
/**
|
|
1992
|
-
* The commit this build came from; empty for a local build.
|
|
2078
|
+
* The commit this build came from; empty for a local build. Answered to a caller with a key;
|
|
2079
|
+
* absent for one without.
|
|
1993
2080
|
*/
|
|
1994
|
-
build_sha
|
|
2081
|
+
build_sha?: string;
|
|
1995
2082
|
/**
|
|
1996
2083
|
* Where sandboxes run, in plain words (for example "US East Coast"). Absent when the service
|
|
1997
2084
|
* does not say.
|
|
@@ -2541,6 +2628,29 @@ export interface MemberView {
|
|
|
2541
2628
|
*/
|
|
2542
2629
|
you: boolean;
|
|
2543
2630
|
}
|
|
2631
|
+
/**
|
|
2632
|
+
* The $1 charged to confirm a payment method with no stable payer (`GET /v1/billing`
|
|
2633
|
+
* `method_check`).
|
|
2634
|
+
*/
|
|
2635
|
+
export interface MethodCheckView {
|
|
2636
|
+
/**
|
|
2637
|
+
* USD charged; added to your credit once paid.
|
|
2638
|
+
*/
|
|
2639
|
+
amount_usd: number;
|
|
2640
|
+
/**
|
|
2641
|
+
* USD of credit that came with it (the card bonus), once paid; `null` otherwise.
|
|
2642
|
+
*/
|
|
2643
|
+
bonus_usd?: number | null;
|
|
2644
|
+
/**
|
|
2645
|
+
* The method as a person reads it: `Apple Pay`, `Google Pay`, `Amazon Pay`, ...
|
|
2646
|
+
*/
|
|
2647
|
+
method: string;
|
|
2648
|
+
/**
|
|
2649
|
+
* `confirming` (charged, its answer not in yet), `paid` (it counts as your payment method) or
|
|
2650
|
+
* `failed` (declined, or it needed you there to approve it: it does not count; add a card).
|
|
2651
|
+
*/
|
|
2652
|
+
status: string;
|
|
2653
|
+
}
|
|
2544
2654
|
/**
|
|
2545
2655
|
* `POST /v1/orgs` and `POST /v1/orgs/{org}/projects`.
|
|
2546
2656
|
*/
|
|
@@ -2737,7 +2847,7 @@ export interface OtherUsage {
|
|
|
2737
2847
|
amount: number;
|
|
2738
2848
|
entries: number;
|
|
2739
2849
|
}
|
|
2740
|
-
export type Outcome = "completed" | "task_failed" | "env_failed" | "snapshot_failed" | "aborted_by_client" | "expired" | "cap_killed" | "not_started" | "superseded" | "grader_failed" | "preempted";
|
|
2850
|
+
export type Outcome = "completed" | "task_failed" | "env_failed" | "snapshot_failed" | "aborted_by_client" | "expired" | "cap_killed" | "not_started" | "superseded" | "grader_failed" | "preempted" | "stopped_by_support";
|
|
2741
2851
|
/**
|
|
2742
2852
|
* `GET /v1/me/outcomes?period=month` — what the organization (with a project's key: that project)
|
|
2743
2853
|
* got this period, measured from its own runs and sandboxes. A figure with nothing behind it is
|
|
@@ -2808,6 +2918,44 @@ export interface ParkedBytes {
|
|
|
2808
2918
|
*/
|
|
2809
2919
|
allocated: number;
|
|
2810
2920
|
}
|
|
2921
|
+
/**
|
|
2922
|
+
* A payment: an invoice paid, a payment that failed, a refund, or the charge that confirmed a
|
|
2923
|
+
* payment method.
|
|
2924
|
+
*/
|
|
2925
|
+
export interface Payment {
|
|
2926
|
+
/**
|
|
2927
|
+
* USD: what was paid, what was due, what was refunded, or what confirmed the method.
|
|
2928
|
+
*/
|
|
2929
|
+
amount_usd: number;
|
|
2930
|
+
/**
|
|
2931
|
+
* The invoice's number, as the invoice shows it; `null` when not known.
|
|
2932
|
+
*/
|
|
2933
|
+
invoice_number?: string | null;
|
|
2934
|
+
/**
|
|
2935
|
+
* The invoice's page: its receipt once it is paid, where to pay it while a payment has
|
|
2936
|
+
* failed; `null` when not known.
|
|
2937
|
+
*/
|
|
2938
|
+
invoice_url?: string | null;
|
|
2939
|
+
/**
|
|
2940
|
+
* `invoice_paid`, `payment_failed`, `refund`, or `method_check` (a charge, usually $1, that
|
|
2941
|
+
* confirmed a payment method; it comes back as credit).
|
|
2942
|
+
*/
|
|
2943
|
+
kind: string;
|
|
2944
|
+
/**
|
|
2945
|
+
* `method_check`: the payment method it confirmed, by name (`Apple Pay`); `null` otherwise.
|
|
2946
|
+
*/
|
|
2947
|
+
method?: string | null;
|
|
2948
|
+
/**
|
|
2949
|
+
* The plan whose fee the invoice billed; `null` when it billed usage alone.
|
|
2950
|
+
*/
|
|
2951
|
+
plan?: string | null;
|
|
2952
|
+
/**
|
|
2953
|
+
* `paid` (for a payment that failed: paid since), `retrying` (it failed and will be tried
|
|
2954
|
+
* again), `failed` (it failed and will not be tried again; for `method_check`, the method
|
|
2955
|
+
* was not confirmed), `refunded`, or `confirmed` (`method_check`: the method is confirmed).
|
|
2956
|
+
*/
|
|
2957
|
+
status: string;
|
|
2958
|
+
}
|
|
2811
2959
|
export interface Percentiles {
|
|
2812
2960
|
p50: number;
|
|
2813
2961
|
p95: number;
|
|
@@ -3075,10 +3223,10 @@ export interface PricingTier {
|
|
|
3075
3223
|
vcpus: number;
|
|
3076
3224
|
}
|
|
3077
3225
|
/**
|
|
3078
|
-
* `GET /v1/pricing` — the prices, sandbox shapes, limits and free credit in force
|
|
3079
|
-
* call from the same place billing charges from.
|
|
3080
|
-
*
|
|
3081
|
-
*
|
|
3226
|
+
* `GET /v1/pricing` — the prices, sandbox shapes, limits and free credit in force for the key's
|
|
3227
|
+
* organisation, read on every call from the same place billing charges from. A key is required.
|
|
3228
|
+
* A run is billed at the rates in force when it was created, so a later change to these values
|
|
3229
|
+
* never reprices a run already started.
|
|
3082
3230
|
*/
|
|
3083
3231
|
export interface PricingView {
|
|
3084
3232
|
/**
|
|
@@ -3118,9 +3266,9 @@ export interface PricingView {
|
|
|
3118
3266
|
*/
|
|
3119
3267
|
monthly_minimum_usd: number;
|
|
3120
3268
|
/**
|
|
3121
|
-
* The organisation these values are for
|
|
3269
|
+
* The organisation these values are for.
|
|
3122
3270
|
*/
|
|
3123
|
-
org_id
|
|
3271
|
+
org_id: string;
|
|
3124
3272
|
plan: PricingPlan;
|
|
3125
3273
|
rates: PricingRates;
|
|
3126
3274
|
/**
|
|
@@ -3128,8 +3276,7 @@ export interface PricingView {
|
|
|
3128
3276
|
*/
|
|
3129
3277
|
schema: string;
|
|
3130
3278
|
/**
|
|
3131
|
-
* `
|
|
3132
|
-
* key): what that key's organisation pays.
|
|
3279
|
+
* `organization`: what the key's organisation pays.
|
|
3133
3280
|
*/
|
|
3134
3281
|
scope: string;
|
|
3135
3282
|
/**
|
|
@@ -4434,6 +4581,11 @@ export interface SandboxView {
|
|
|
4434
4581
|
* once it has started; absent from list rows.
|
|
4435
4582
|
*/
|
|
4436
4583
|
cost_usd?: number | null;
|
|
4584
|
+
/**
|
|
4585
|
+
* When the sandbox was created, RFC 3339: when its run was started, or when the retry or
|
|
4586
|
+
* replay that made it was asked for.
|
|
4587
|
+
*/
|
|
4588
|
+
created_at: string;
|
|
4437
4589
|
/**
|
|
4438
4590
|
* Milliseconds from the start request, after any time queued, to the sandbox being handed
|
|
4439
4591
|
* over: it does not include `queued_ms`. Add `queued_ms` for the whole wait.
|
|
@@ -4491,6 +4643,13 @@ export interface SandboxView {
|
|
|
4491
4643
|
* Why it ended; `null` while it is still alive.
|
|
4492
4644
|
*/
|
|
4493
4645
|
outcome?: string | null;
|
|
4646
|
+
/**
|
|
4647
|
+
* While it is paused: when it will be deleted, with its files and state, unless it is
|
|
4648
|
+
* resumed before then (RFC 3339). A paused sandbox is kept for 30 days, and resuming it
|
|
4649
|
+
* starts the 30 days again. Absent while it is not paused, and for a paused sandbox that is
|
|
4650
|
+
* not due to be deleted.
|
|
4651
|
+
*/
|
|
4652
|
+
pause_expires_at?: string | null;
|
|
4494
4653
|
/**
|
|
4495
4654
|
* Why it is paused, when a limit paused it rather than a request: `spend_cap` (its run
|
|
4496
4655
|
* reached its spend cap) or `credits_exhausted` (the organization's credits ran out). Its
|
|
@@ -4528,6 +4687,11 @@ export interface SandboxView {
|
|
|
4528
4687
|
*/
|
|
4529
4688
|
run_id: string;
|
|
4530
4689
|
sandbox_id: string;
|
|
4690
|
+
/**
|
|
4691
|
+
* The snapshot it was started from, as its run names it (`GET /v1/runs/{id}`): the
|
|
4692
|
+
* snapshot's id, or `promigence/base` for the built-in base.
|
|
4693
|
+
*/
|
|
4694
|
+
snapshot_id: string;
|
|
4531
4695
|
/**
|
|
4532
4696
|
* `queued` | `ready` | `running` | `paused` | `ended`.
|
|
4533
4697
|
*/
|
|
@@ -4729,6 +4893,11 @@ export interface SecretStored {
|
|
|
4729
4893
|
* otherwise. Present when `hosts` is.
|
|
4730
4894
|
*/
|
|
4731
4895
|
raw?: string | null;
|
|
4896
|
+
/**
|
|
4897
|
+
* Whether the value is masked out of responses from the bound hosts. Present when `hosts`
|
|
4898
|
+
* is.
|
|
4899
|
+
*/
|
|
4900
|
+
scan_responses?: boolean | null;
|
|
4732
4901
|
/**
|
|
4733
4902
|
* RFC 3339.
|
|
4734
4903
|
*/
|
|
@@ -4990,6 +5159,11 @@ export interface SnapshotCreate {
|
|
|
4990
5159
|
* Commands run once, in order, before `verify`.
|
|
4991
5160
|
*/
|
|
4992
5161
|
setup?: OneOrMany | null;
|
|
5162
|
+
/**
|
|
5163
|
+
* Image and Dockerfile forms: the user its `start`, `setup` and `verify` run as (for example
|
|
5164
|
+
* the snapshot's own `user`). Default: `root`.
|
|
5165
|
+
*/
|
|
5166
|
+
setup_user?: string | null;
|
|
4993
5167
|
/**
|
|
4994
5168
|
* Extra repositories cloned before `setup` (repository form only, at most 8).
|
|
4995
5169
|
*/
|
|
@@ -5008,6 +5182,13 @@ export interface SnapshotCreate {
|
|
|
5008
5182
|
* charged to the organization.
|
|
5009
5183
|
*/
|
|
5010
5184
|
track?: boolean;
|
|
5185
|
+
/**
|
|
5186
|
+
* Image and Dockerfile forms: the user commands, terminals and SSH sessions in its sandboxes
|
|
5187
|
+
* run as when they name none. A user name or uid, with an optional `:group` or `:gid`, as an
|
|
5188
|
+
* image's `USER` takes it; `root` for root. Default: the image's own `USER`, as `docker run`
|
|
5189
|
+
* does (root when it sets none).
|
|
5190
|
+
*/
|
|
5191
|
+
user?: string | null;
|
|
5011
5192
|
/**
|
|
5012
5193
|
* The command that must exit 0 for the snapshot to be stored. Required in the repository
|
|
5013
5194
|
* form.
|
|
@@ -5103,6 +5284,11 @@ export interface SnapshotDeduped {
|
|
|
5103
5284
|
* while it can be started.
|
|
5104
5285
|
*/
|
|
5105
5286
|
unavailable?: string | null;
|
|
5287
|
+
/**
|
|
5288
|
+
* The user commands, terminals and SSH sessions in its sandboxes run as when they name
|
|
5289
|
+
* none: its image's own `USER`, or the `user` it was created with. Absent: root.
|
|
5290
|
+
*/
|
|
5291
|
+
user?: string | null;
|
|
5106
5292
|
/**
|
|
5107
5293
|
* What the verification command did when it last ran.
|
|
5108
5294
|
*/
|
|
@@ -5314,6 +5500,11 @@ export interface SnapshotView {
|
|
|
5314
5500
|
* while it can be started.
|
|
5315
5501
|
*/
|
|
5316
5502
|
unavailable?: string | null;
|
|
5503
|
+
/**
|
|
5504
|
+
* The user commands, terminals and SSH sessions in its sandboxes run as when they name
|
|
5505
|
+
* none: its image's own `USER`, or the `user` it was created with. Absent: root.
|
|
5506
|
+
*/
|
|
5507
|
+
user?: string | null;
|
|
5317
5508
|
/**
|
|
5318
5509
|
* What the verification command did when it last ran.
|
|
5319
5510
|
*/
|
|
@@ -5650,6 +5841,11 @@ export interface Totals {
|
|
|
5650
5841
|
*/
|
|
5651
5842
|
preempted?: number;
|
|
5652
5843
|
snapshot_failed: number;
|
|
5844
|
+
/**
|
|
5845
|
+
* Sandboxes Promigence support stopped (`stopped_by_support`), each with its reason. Its own
|
|
5846
|
+
* counter: not the customer's own kills (`aborted_by_client`) and not a failure.
|
|
5847
|
+
*/
|
|
5848
|
+
stopped_by_support?: number;
|
|
5653
5849
|
task_failed: number;
|
|
5654
5850
|
}
|
|
5655
5851
|
/**
|
package/dist/proxy.js
CHANGED
|
@@ -199,8 +199,9 @@ export function requestVia(url, options, env = process.env) {
|
|
|
199
199
|
connect.end();
|
|
200
200
|
return undefined;
|
|
201
201
|
};
|
|
202
|
+
const { agent: _agent, ...direct } = options;
|
|
202
203
|
return httpsRequest(url, {
|
|
203
|
-
...
|
|
204
|
+
...direct,
|
|
204
205
|
createConnection: createConnection,
|
|
205
206
|
});
|
|
206
207
|
}
|
package/dist/pty.d.ts
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
/** Largest terminal input frame sent; the server's cap is 1 MiB per client frame. */
|
|
15
15
|
export declare const PTY_INPUT_CHUNK: number;
|
|
16
|
+
/** How much of what was typed a session keeps, to send again to a terminal picked up again. */
|
|
17
|
+
export declare const PTY_INPUT_KEEP: number;
|
|
18
|
+
/** The header a terminal is picked up again with (its resume token). */
|
|
19
|
+
export declare const PTY_RESUME_HEADER = "promigence-resume";
|
|
16
20
|
export interface PtySize {
|
|
17
21
|
cols: number;
|
|
18
22
|
rows: number;
|
|
@@ -53,6 +57,33 @@ export interface PtyConnectOpts {
|
|
|
53
57
|
caller?: string;
|
|
54
58
|
onData?: (data: Uint8Array) => void;
|
|
55
59
|
onExit?: (exit: PtyExit) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Reconnect in a new shell when the service is updated (a WebSocket `Close` 1012) and the
|
|
62
|
+
* terminal cannot be picked up again ([`resume`]). The session goes on over a new connection,
|
|
63
|
+
* with its callbacks, its size and what was typed meanwhile, in a NEW shell: what ran in the old
|
|
64
|
+
* one has ended. Tried for up to 30 s ([`PTY_RECONNECT_FOR_MS`]); past that the session ends with
|
|
65
|
+
* `error.code` `"service_restart"`.
|
|
66
|
+
*
|
|
67
|
+
* Default: on for a shell, off when `command` is set (reconnecting starts the command again,
|
|
68
|
+
* which may not be safe to run twice); `true` or `false` decides either way.
|
|
69
|
+
*/
|
|
70
|
+
reconnect?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Pick the same terminal up again when its connection drops or the service restarts (default
|
|
73
|
+
* on): the terminal keeps running for a short while, and the session picks up where it left off
|
|
74
|
+
* over a new connection, with what was typed meanwhile delivered once — the same shell, or the
|
|
75
|
+
* same command, still running. Where it cannot be picked up (it ended meanwhile, or too much time
|
|
76
|
+
* passed), a restart falls back to [`reconnect`]; a dropped connection ends the session, as
|
|
77
|
+
* before.
|
|
78
|
+
*/
|
|
79
|
+
resume?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Called after each reconnect: `resumed` is `true` when it is the same terminal picked up
|
|
82
|
+
* again, `false` when it is a new shell (what ran in the old one has ended).
|
|
83
|
+
*/
|
|
84
|
+
onReconnected?: (how: {
|
|
85
|
+
resumed: boolean;
|
|
86
|
+
}) => void;
|
|
56
87
|
/** Handshake bound (default 30 s). The session itself has none. */
|
|
57
88
|
timeoutMs?: number;
|
|
58
89
|
/** Maps a refused upgrade (`status`, body text, its `Retry-After`) onto the SDK's error classes. */
|
|
@@ -80,15 +111,28 @@ export declare class FrameReader {
|
|
|
80
111
|
*/
|
|
81
112
|
export declare class PtySession {
|
|
82
113
|
#private;
|
|
83
|
-
private
|
|
84
|
-
/**
|
|
114
|
+
private socket;
|
|
115
|
+
/**
|
|
116
|
+
* The id of the terminal's process inside the sandbox (`req_id`); what `pty.kill(pid)`
|
|
117
|
+
* addresses. It names this session: it stays the same after a reconnect.
|
|
118
|
+
*/
|
|
85
119
|
readonly pid: number;
|
|
86
120
|
cols: number;
|
|
87
121
|
rows: number;
|
|
88
122
|
private closed;
|
|
89
123
|
private readonly done;
|
|
124
|
+
/** Frames written while the session reconnects, sent once it has (at most 1 MiB). */
|
|
125
|
+
private pending;
|
|
126
|
+
/** Keystrokes written to a connection, in all, and the last of them, from `inputBase` on: what a
|
|
127
|
+
* terminal picked up again did not take is sent again. */
|
|
128
|
+
private inputSent;
|
|
129
|
+
private inputBase;
|
|
130
|
+
private inputLog;
|
|
90
131
|
/** `true` once the terminal has ended (its exit arrived, or the socket closed). */
|
|
91
132
|
get ended(): boolean;
|
|
133
|
+
private flush;
|
|
134
|
+
/** Write a frame to the connection now, counting keystrokes. */
|
|
135
|
+
private writeNow;
|
|
92
136
|
private send;
|
|
93
137
|
/** Keystrokes / a paste. A string is sent as UTF-8. */
|
|
94
138
|
write(data: string | Uint8Array): void;
|
|
@@ -105,5 +149,23 @@ export declare class PtySession {
|
|
|
105
149
|
*/
|
|
106
150
|
disconnect(): void;
|
|
107
151
|
}
|
|
108
|
-
/**
|
|
152
|
+
/** The `Close` code a terminal is asked to reconnect with: 1012, "service restart" (RFC 6455's registry). */
|
|
153
|
+
export declare const PTY_RECONNECT_CODE = 1012;
|
|
154
|
+
/** How long a terminal tries to reconnect before it ends (`error.code` `"service_restart"`). */
|
|
155
|
+
export declare const PTY_RECONNECT_FOR_MS = 30000;
|
|
156
|
+
/** The first wait before a reconnect, doubled each try up to [`PTY_RECONNECT_MAX_WAIT_MS`]; each wait is jittered (50-100 %). */
|
|
157
|
+
export declare const PTY_RECONNECT_FIRST_WAIT_MS = 250;
|
|
158
|
+
export declare const PTY_RECONNECT_MAX_WAIT_MS = 4000;
|
|
159
|
+
/** How a session that could not reconnect within [`PTY_RECONNECT_FOR_MS`] ends. */
|
|
160
|
+
export declare const PTY_RESTART_EXIT: PtyExit;
|
|
161
|
+
/** How a session that is not to reconnect (`reconnect` off, or a command's) ends at a 1012. */
|
|
162
|
+
export declare const PTY_RESTART_CLOSED_EXIT: PtyExit;
|
|
163
|
+
/**
|
|
164
|
+
* Open a terminal. Rejects with `opts.refuse(...)` if the server does not switch protocols.
|
|
165
|
+
*
|
|
166
|
+
* When its connection drops, or the service asks it to reconnect (`Close` 1012), the session goes
|
|
167
|
+
* on over a new connection: the same terminal picked up again where the service still holds it
|
|
168
|
+
* ([`PtyConnectOpts.resume`]), else, at a restart, a new shell ([`PtyConnectOpts.reconnect`]).
|
|
169
|
+
* `wait()` resolves only when the session really ends.
|
|
170
|
+
*/
|
|
109
171
|
export declare function connectPty(opts: PtyConnectOpts): Promise<PtySession>;
|