sandcovery 0.5.1 → 0.6.1

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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as CreateUsageShareRequest, At as ProviderBoardEntry, Ct as ProblemReportRequest, Dn as XPostRequest, En as XAccountStatus, F as CreditPurchaseRequest, G as ExecEvent, J as FileEntry, K as ExecRequest, L as DetachedExec, N as CredentialFields, Nt as ProviderCredential, O as CreateKeyRequest, Ot as Provider, P as CreditCheckout, Pt as ProviderCredentialList, R as DetachedExecRequest, S as CiJobList, Tn as XAccountLink, Tt as ProcessRequest, U as EstimateList, W as EstimateRequest, X as FileList, Xt as SandboxList, Zt as SandboxStatus, _n as UsageShare, b as CiJob, bt as Pricing, cn as Stats, en as SharedUsage, ft as MonthlyCostList, ht as Offer, i as ActivityList, it as Key, j as CreatedKey, jt as ProviderCatalog, k as CreateSandboxRequest, kt as ProviderBoard, mn as Usage, pn as UpdateKeyRequest, q as ExecResult, qt as Sandbox, rn as Snapshot, s as Billing, st as KeyList, ut as LiveUsage, wt as Process, xn as UsageTotals, y as CiInstallationList, yn as UsageShareList, yt as PortPreview } from "./types-BGjvzP6q.mjs";
1
+ import { $ as FileList, An as XAccountStatus, B as DetachedExec, C as CiJob, Cn as UsageShareList, Ct as PortPreview, Dt as ProblemReportRequest, Ft as ProviderCatalog, I as CredentialFields, J as ExecEvent, K as EstimateList, L as CreditCheckout, Lt as ProviderCredential, M as CreateSandboxRequest, Mt as Provider, N as CreateUsageShareRequest, Nt as ProviderBoard, Ot as Process, P as CreatedKey, Pt as ProviderBoardEntry, R as CreditPurchaseRequest, Rt as ProviderCredentialList, S as CiInstallationList, T as CiJobList, Tn as UsageTotals, V as DetachedExecRequest, X as ExecResult, Y as ExecRequest, Z as FileEntry, Zt as Sandbox, _n as UpdateKeyRequest, c as AutoTopUpRequest, en as SandboxList, fn as Stats, ht as MonthlyCostList, i as ActivityList, in as SharedUsage, j as CreateKeyRequest, jn as XPostRequest, kn as XAccountLink, kt as ProcessRequest, o as AutoTopUp, pt as LiveUsage, q as EstimateRequest, s as AutoTopUpChange, sn as Snapshot, st as Key, tn as SandboxStatus, u as Billing, ut as KeyList, vn as Usage, vt as Offer, wt as Pricing, xn as UsageShare } from "./types-C4amb2QE.mjs";
2
2
  interface ProcessExit {
3
3
  readonly code: number;
4
4
  readonly signal: string | null;
@@ -82,6 +82,8 @@ interface ActivityApi {
82
82
  interface BillingApi {
83
83
  readonly buyCredits: (request: CreditPurchaseRequest, options?: RequestOptions) => Promise<CreditCheckout>;
84
84
  readonly get: (options?: RequestOptions) => Promise<Billing>;
85
+ readonly setAutoTopUp: (request: AutoTopUpRequest, options?: RequestOptions) => Promise<AutoTopUpChange>;
86
+ readonly stopAutoTopUp: (options?: RequestOptions) => Promise<AutoTopUp>;
85
87
  }
86
88
  interface CiApi {
87
89
  readonly getJob: (jobId: string, options?: RequestOptions) => Promise<CiJob>;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { t as Sandcovery } from "./src-BoT9S6C3.mjs";
1
+ export { t as Sandcovery } from "./src-BqfeIyqj.mjs";
@@ -1,5 +1,5 @@
1
1
  import { Bn as TaggedError, Br as isString, Ct as fail, E as decodeUnknownSync, En as ClockRef, Hn as seconds, Ir as hasProperty, Jn as isSuccess, O as fromJsonString, Qt as tapError, Tt as flatMap, Un as toMillis, Ut as retry, Vn as millis, Xt as sync, Yn as try_, Yt as suspend, _ as String$1, an as void_, ar as getOrThrowWith, cr as isSome, g as Record, gt as catchDefect, h as Number$1, kn as currentTimeMillis$1, ln as spaced, lt as acquireUseRelease, m as NullOr, n as Boolean, rr as getOrElse, sr as isNone, t as ArraySchema, u as Literals, un as upTo, ur as map, v as Struct, vt as catchTag, w as decodeUnknownOption, xt as die } from "./Schema-CoX0a2_o.mjs";
2
- import { C as NotFound, D as Forbidden, E as SandboxStatus, F as CREDIT_PURCHASE_MIN_MICRO_USD, M as ProviderSort, N as CARD_FEE_TERMS, O as Conflict, P as CREDIT_PURCHASE_MAX_MICRO_USD, R as MICRO_USD_PER_DOLLAR, S as Unauthorized, _ as KeyKind, h as SANDCOVERY_X_HANDLE, j as DEFAULT_SLUG, l as MONTH_TEXT, t as Sandcovery, v as SpendLimit, x as Unsupported, z as NO_MARKUP_TERMS } from "./src-BoT9S6C3.mjs";
2
+ import { A as NO_MARKUP_TERMS, B as DEFAULT_SLUG, C as AUTO_TOP_UP_THRESHOLD_MIN_MICRO_USD, E as CREDIT_PURCHASE_MIN_MICRO_USD, F as Unauthorized, H as Forbidden, I as NotFound, P as Unsupported, S as AUTO_TOP_UP_THRESHOLD_MAX_MICRO_USD, T as CREDIT_PURCHASE_MAX_MICRO_USD, U as Conflict, V as ProviderSort, _ as KeyKind, h as SANDCOVERY_X_HANDLE, k as MICRO_USD_PER_DOLLAR, l as MONTH_TEXT, t as Sandcovery, v as SpendLimit, w as CARD_FEE_TERMS, z as SandboxStatus } from "./src-BqfeIyqj.mjs";
3
3
  import { WebSocket } from "node:http";
4
4
  import net from "node:net";
5
5
  import readline from "node:readline";
@@ -1123,7 +1123,7 @@ const withFileLock = ({ bin, file, work }) => {
1123
1123
  }), () => work, (own) => removeIf(lock, sameAs(own)));
1124
1124
  };
1125
1125
  // package.json
1126
- var version = "0.5.1";
1126
+ var version = "0.6.1";
1127
1127
  // ../format/src/display.ts
1128
1128
  const LOCALE = "en-US";
1129
1129
  const UTC = "UTC";
@@ -1155,6 +1155,11 @@ new Intl.DateTimeFormat(LOCALE, {
1155
1155
  month: "short",
1156
1156
  timeZone: UTC
1157
1157
  });
1158
+ new Intl.DateTimeFormat(LOCALE, {
1159
+ day: "numeric",
1160
+ month: "long",
1161
+ timeZone: UTC
1162
+ });
1158
1163
  const monthName = new Intl.DateTimeFormat(LOCALE, {
1159
1164
  month: "long",
1160
1165
  timeZone: UTC
@@ -1231,6 +1236,11 @@ const percentFormats = {
1231
1236
  minimumFractionDigits: 2,
1232
1237
  style: "percent"
1233
1238
  }),
1239
+ share: new Intl.NumberFormat(LOCALE, {
1240
+ maximumFractionDigits: 1,
1241
+ minimumFractionDigits: 1,
1242
+ style: "percent"
1243
+ }),
1234
1244
  whole: new Intl.NumberFormat(LOCALE, {
1235
1245
  maximumFractionDigits: 0,
1236
1246
  style: "percent"
@@ -2006,8 +2016,9 @@ const docker = {
2006
2016
  notes: [
2007
2017
  "Runs the Docker CLI in a sandbox with every word after docker, streams its stdout and stderr to this terminal's, and exits with its exit code.",
2008
2018
  "The first command starts a sandbox on a provider that runs Docker, as Sandcovery CI runners do, and later commands reuse it until it ends at its TTL, so images, containers, and volumes carry over between commands. sandcovery sandboxes destroy ends it sooner.",
2009
- "Before docker runs, the command copies the local files it reads into the sandbox at the same absolute paths, up to 100 MiB packed, and runs docker in the same working directory there, so relative and absolute paths resolve as they do here. Those files are the build context of build and bake without what .dockerignore leaves out, the files of a build's -f, --build-context, and --secret, the bind mount sources and env files of run and create, and the file that cp, load -i, or import reads.",
2010
- "compose copies its Compose files and env files and, for commands that build or start containers, each build context and each bind-mounted file or directory. ps, logs, down, and other commands that only read the project copy only the Compose files and env files. Variables in Compose files come only from .env and --env-file, and ~ in a Compose file names the home folder of the sandbox.",
2019
+ "Before docker runs, the command copies the local files it reads into the sandbox at the same absolute paths, up to 100 MiB packed, and runs docker in the same working directory there, so relative and absolute paths resolve as they do here. Those files are the build context of build and bake without what .dockerignore leaves out, the files of a build's -f, --build-context, and --secret, the bind mount sources and env files of run and create, the env files of exec, the files that BUILDX_BAKE_FILE and EXPERIMENTAL_BUILDKIT_SOURCE_POLICY name, and the file that cp, load -i, or import reads.",
2020
+ "The variables docker reads come from this computer's environment: a name given to -e or --env with no value on run, create, or exec, a name alone on a line of their --env-file, a name given to build --build-arg with no value, the variable an env --secret reads, and docker's own CLI, Build, and Compose variables, such as DOCKER_DEFAULT_PLATFORM. A name unset here stays unset in the container. The command sends the sandbox only those names and values, and never a variable that picks a daemon, context, builder, or proxy, or names a local config, credential, or certificate path, such as DOCKER_HOST, DOCKER_CONTEXT, DOCKER_CONFIG, or HTTP_PROXY, even one the command names, since the sandbox runs its own Docker daemon.",
2021
+ "compose copies its Compose files and env files and, for commands that build or start containers, each build context and each bind-mounted file or directory. ps, logs, down, and other commands that only read the project copy only the Compose files and env files. Variables in Compose files come from this shell first, then from .env, --env-file, or COMPOSE_ENV_FILES, as with docker compose, and the command sends the sandbox only the shell variables the Compose files and env files name. ~ in a Compose file names the home folder of the sandbox.",
2011
2022
  "Only paths under your home folder or the working directory are copied, a symlink arrives as the link itself, and a path through a symlinked folder fails. What containers wrote stays in the sandbox and never comes back here, and a file deleted here since the last copy is deleted there.",
2012
2023
  "When stdin is not a terminal and docker reads it, as with -i on run or exec without -d, start -i, login --password-stdin, load, import -, build -, or cp -, the command streams stdin to docker as it reads it.",
2013
2024
  "When stdout is not a terminal and docker writes an archive there, as with save or export without -o, cp to -, or build -o -, the archive arrives byte for byte. save and export without -o refuse a terminal, as docker does.",
@@ -2710,7 +2721,7 @@ const providers = {
2710
2721
  notes: [
2711
2722
  "Lists each provider with its status, 2x4 price per hour, and median create latency.",
2712
2723
  "A provider Sandcovery does not route to yet shows as Coming Soon.",
2713
- "Coming Soon also marks each figure or fact Sandcovery does not publish, and --json adds every fact with the page it was read from.",
2724
+ "Coming Soon also marks each figure no probe has measured and each fact Sandcovery has not read, and --json adds every fact with the page it was read from.",
2714
2725
  "With --routed, it lists only the providers on the provider board, and --json prints their board entries."
2715
2726
  ],
2716
2727
  options: [
@@ -3203,78 +3214,177 @@ const activity = {
3203
3214
  summary: "Read what happened to your sandboxes"
3204
3215
  };
3205
3216
  const billing = {
3206
- children: [{
3207
- arguments: [],
3208
- examples: [{
3209
- argv: ["billing", "inspect"],
3210
- summary: "Show the plan and the credit balance"
3211
- }],
3212
- kind: "leaf",
3213
- name: "inspect",
3214
- notes: [`Shows the plan, the credit balance, and the Pro and Enterprise prices. It fails as not found while billing is not set up. ${NEEDS_MANAGEMENT}`],
3215
- options: [baseUrl, json],
3216
- result: [
3217
- {
3218
- name: "billing.plan",
3219
- type: "\"free\" | \"pro\" | \"enterprise\""
3220
- },
3221
- {
3222
- name: "billing.credit_balance_micro_usd",
3223
- type: "number"
3224
- },
3225
- {
3226
- name: "billing.credits_on_sale",
3227
- type: "boolean"
3228
- },
3229
- {
3230
- name: "billing.pro_price",
3231
- type: NULLABLE_OBJECT
3232
- },
3233
- {
3234
- name: "billing.enterprise_price",
3235
- type: NULLABLE_OBJECT
3236
- },
3237
- {
3238
- name: "billing.github_enterprise",
3239
- type: "boolean"
3240
- }
3241
- ],
3242
- summary: "Show the plan and credits"
3243
- }, {
3244
- arguments: [],
3245
- examples: [{
3246
- argv: [
3247
- "billing",
3248
- "buy-credits",
3249
- "--amount",
3250
- "100"
3217
+ children: [
3218
+ {
3219
+ arguments: [],
3220
+ examples: [{
3221
+ argv: ["billing", "inspect"],
3222
+ summary: "Show the plan and the credit balance"
3223
+ }],
3224
+ kind: "leaf",
3225
+ name: "inspect",
3226
+ notes: [`Shows the plan, the credit balance, the Pro and Enterprise prices, and auto top-up with the reason a failed charge turned it off. It fails as not found while billing is not set up. ${NEEDS_MANAGEMENT}`],
3227
+ options: [baseUrl, json],
3228
+ result: [
3229
+ {
3230
+ name: "billing.auto_top_up",
3231
+ type: "object"
3232
+ },
3233
+ {
3234
+ name: "billing.plan",
3235
+ type: "\"free\" | \"pro\" | \"enterprise\""
3236
+ },
3237
+ {
3238
+ name: "billing.plan_billers",
3239
+ type: "array"
3240
+ },
3241
+ {
3242
+ name: "billing.credit_balance_micro_usd",
3243
+ type: "number"
3244
+ },
3245
+ {
3246
+ name: "billing.credits_on_sale",
3247
+ type: "boolean"
3248
+ },
3249
+ {
3250
+ name: "billing.pro_price",
3251
+ type: NULLABLE_OBJECT
3252
+ },
3253
+ {
3254
+ name: "billing.enterprise_price",
3255
+ type: NULLABLE_OBJECT
3256
+ },
3257
+ {
3258
+ name: "billing.github_enterprise",
3259
+ type: "boolean"
3260
+ }
3251
3261
  ],
3252
- summary: "Start a 100 USD credit purchase"
3253
- }],
3254
- kind: "leaf",
3255
- name: "buy-credits",
3256
- notes: [`Prints the Stripe Checkout page that takes the payment. The credits are the amount less the processing fee of ${CARD_FEE_TERMS}, and arrive once Stripe confirms the payment. ${NEEDS_MANAGEMENT}`],
3257
- options: [
3258
- {
3259
- hint: "<USD>",
3260
- kind: "value",
3261
- name: "amount",
3262
- required: true,
3263
- summary: `Whole US dollars to pay, from ${String(CREDIT_PURCHASE_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(CREDIT_PURCHASE_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}`
3264
- },
3265
- baseUrl,
3266
- json
3267
- ],
3268
- result: [{
3269
- name: "checkout.url",
3270
- type: "string"
3271
- }],
3272
- summary: "Buy credits through Stripe Checkout"
3273
- }],
3262
+ summary: "Show the plan and credits"
3263
+ },
3264
+ {
3265
+ arguments: [],
3266
+ examples: [{
3267
+ argv: [
3268
+ "billing",
3269
+ "buy-credits",
3270
+ "--amount",
3271
+ "100"
3272
+ ],
3273
+ summary: "Start a 100 USD credit purchase"
3274
+ }],
3275
+ kind: "leaf",
3276
+ name: "buy-credits",
3277
+ notes: [`Prints the Stripe Checkout page that takes the payment. The credits are the amount less the processing fee of ${CARD_FEE_TERMS}, and arrive once Stripe confirms the payment. ${NEEDS_MANAGEMENT}`],
3278
+ options: [
3279
+ {
3280
+ hint: "<USD>",
3281
+ kind: "value",
3282
+ name: "amount",
3283
+ required: true,
3284
+ summary: `Whole US dollars to pay, from ${String(CREDIT_PURCHASE_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(CREDIT_PURCHASE_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}`
3285
+ },
3286
+ baseUrl,
3287
+ json
3288
+ ],
3289
+ result: [{
3290
+ name: "checkout.url",
3291
+ type: "string"
3292
+ }],
3293
+ summary: "Buy credits through Stripe Checkout"
3294
+ },
3295
+ {
3296
+ arguments: [],
3297
+ examples: [{
3298
+ argv: [
3299
+ "billing",
3300
+ "set-auto-top-up",
3301
+ "--amount",
3302
+ "25",
3303
+ "--threshold",
3304
+ "10"
3305
+ ],
3306
+ summary: "Charge 25 USD each time the credit balance falls below 10 USD"
3307
+ }],
3308
+ kind: "leaf",
3309
+ name: "set-auto-top-up",
3310
+ notes: [`While auto top-up is off, prints the Stripe Checkout page that saves a card and then turns auto top-up on with this threshold and amount, starting a fresh run of charges. While it is on, the threshold and amount apply at once. Each time the credit balance falls below the threshold, or a create is refused for credits one top-up covers, the saved card is charged the amount once, and the credit, the amount less the processing fee of ${CARD_FEE_TERMS}, arrives once Stripe confirms the charge. A declined card, a card that asks its holder to authenticate, or any other failed charge turns auto top-up off, and \`billing inspect\` shows why. ${NEEDS_MANAGEMENT}`],
3311
+ options: [
3312
+ {
3313
+ hint: "<USD>",
3314
+ kind: "value",
3315
+ name: "amount",
3316
+ required: true,
3317
+ summary: `Whole US dollars each top-up charges, from ${String(CREDIT_PURCHASE_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(CREDIT_PURCHASE_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}`
3318
+ },
3319
+ {
3320
+ hint: "<USD>",
3321
+ kind: "value",
3322
+ name: "threshold",
3323
+ required: true,
3324
+ summary: `Whole US dollars of credit balance below which a top-up is charged, from ${String(AUTO_TOP_UP_THRESHOLD_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(AUTO_TOP_UP_THRESHOLD_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}, and below the credit one top-up adds`
3325
+ },
3326
+ baseUrl,
3327
+ json
3328
+ ],
3329
+ result: [
3330
+ {
3331
+ name: "auto_top_up.enabled",
3332
+ type: "boolean"
3333
+ },
3334
+ {
3335
+ name: "auto_top_up.amount_micro_usd",
3336
+ type: NULLABLE_NUMBER
3337
+ },
3338
+ {
3339
+ name: "auto_top_up.threshold_micro_usd",
3340
+ type: NULLABLE_NUMBER
3341
+ },
3342
+ {
3343
+ name: "auto_top_up.failure",
3344
+ type: NULLABLE_TEXT
3345
+ },
3346
+ {
3347
+ name: "auto_top_up.failed_at",
3348
+ type: NULLABLE_TEXT
3349
+ },
3350
+ {
3351
+ name: "url",
3352
+ type: NULLABLE_TEXT
3353
+ }
3354
+ ],
3355
+ summary: "Set the auto top-up threshold and amount"
3356
+ },
3357
+ {
3358
+ arguments: [],
3359
+ examples: [{
3360
+ argv: ["billing", "stop-auto-top-up"],
3361
+ summary: "Stop charging the saved card"
3362
+ }],
3363
+ kind: "leaf",
3364
+ name: "stop-auto-top-up",
3365
+ notes: [`Turns auto top-up off, so the saved card is charged no more. A charge Stripe is still processing adds its credit once it succeeds. ${NEEDS_MANAGEMENT}`],
3366
+ options: [baseUrl, json],
3367
+ result: [
3368
+ {
3369
+ name: "auto_top_up.enabled",
3370
+ type: "boolean"
3371
+ },
3372
+ {
3373
+ name: "auto_top_up.amount_micro_usd",
3374
+ type: NULLABLE_NUMBER
3375
+ },
3376
+ {
3377
+ name: "auto_top_up.threshold_micro_usd",
3378
+ type: NULLABLE_NUMBER
3379
+ }
3380
+ ],
3381
+ summary: "Turn auto top-up off"
3382
+ }
3383
+ ],
3274
3384
  defaultChild: "inspect",
3275
3385
  kind: "group",
3276
3386
  name: "billing",
3277
- summary: "Show the plan and buy credits"
3387
+ summary: "Show the plan, buy credits, and set auto top-up"
3278
3388
  };
3279
3389
  const pricing = {
3280
3390
  children: [{