sandcovery 0.4.0 → 0.5.0
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 +6 -2
- package/dist/{Schema-CFI3ZMu8.mjs → Schema-fLas6rbA.mjs} +7960 -957
- package/dist/cli/index.mjs +2 -1688
- package/dist/cli/sandcovery-docker.d.mts +1 -0
- package/dist/cli/sandcovery-docker.mjs +8 -0
- package/dist/handlers-qYjkPftS.mjs +18077 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{origin-BTx2gX8x.mjs → origin-5maEGWRg.mjs} +9 -2
- package/dist/{spec-B4c-Ug3B.mjs → spec-cGDeWJ3v.mjs} +372 -17
- package/dist/{src-DPDVOBkr.mjs → src-zWk1RjrB.mjs} +4 -3
- package/dist/start-B8ruSPVb.mjs +1992 -0
- package/dist/{telemetry-delivery-Yd6CeynR.mjs → telemetry-delivery-8t5RXWli.mjs} +1 -1
- package/dist/{types-DvoIdTvQ.d.mts → types-ZqbGCXKy.d.mts} +2 -0
- package/dist/types.d.mts +1 -1
- package/package.json +16 -14
- package/dist/handlers-BS1KuMqq.mjs +0 -6546
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as CreatedKey, Ct as ProviderCatalog, Et as ProviderCredentialList, G as ExecRequest, H as EstimateList, Ht as SandboxStatus, I as DetachedExec, K as ExecResult, Kt as Snapshot, L as DetachedExecRequest, M as CredentialFields, N as CreditCheckout, O as CreateKeyRequest, P as CreditPurchaseRequest, Rt as Sandbox, S as CiJobList, St as ProviderBoardEntry, Tt as ProviderCredential, U as EstimateRequest, Vt as SandboxList, W as ExecEvent, Y as FileList, Zt as Stats, _t as Pricing, b as CiJob, bt as Provider, ft as Offer, gt as PortPreview, i as ActivityList, k as CreateSandboxRequest, lt as LiveUsage, nn as UpdateKeyRequest, ot as KeyList, q as FileEntry, rn as Usage, rt as Key, s as Billing, sn as UsageTotals, xt as ProviderBoard, y as CiInstallationList } from "./types-
|
|
1
|
+
import { A as CreatedKey, Ct as ProviderCatalog, Et as ProviderCredentialList, G as ExecRequest, H as EstimateList, Ht as SandboxStatus, I as DetachedExec, K as ExecResult, Kt as Snapshot, L as DetachedExecRequest, M as CredentialFields, N as CreditCheckout, O as CreateKeyRequest, P as CreditPurchaseRequest, Rt as Sandbox, S as CiJobList, St as ProviderBoardEntry, Tt as ProviderCredential, U as EstimateRequest, Vt as SandboxList, W as ExecEvent, Y as FileList, Zt as Stats, _t as Pricing, b as CiJob, bt as Provider, ft as Offer, gt as PortPreview, i as ActivityList, k as CreateSandboxRequest, lt as LiveUsage, nn as UpdateKeyRequest, ot as KeyList, q as FileEntry, rn as Usage, rt as Key, s as Billing, sn as UsageTotals, xt as ProviderBoard, y as CiInstallationList } from "./types-ZqbGCXKy.mjs";
|
|
2
2
|
interface RequestOptions {
|
|
3
3
|
readonly signal?: AbortSignal;
|
|
4
4
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Sandcovery } from "./src-
|
|
1
|
+
export { t as Sandcovery } from "./src-zWk1RjrB.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as is, I as isUUID, L as makeFilter, M as isMaxLength, N as isMinLength, O as isBase64Url$1, P as isMultipleOf, _ as Struct, d as Natural, f as NonEmptyArray, g as String$1, h as Record, j as isGreaterThanOrEqualTo, k as isBetween, l as Literal, m as NullOr, n as Boolean, p as NonEmptyString, s as Int, t as ArraySchema, u as Literals, v as Union, z as optionalKey } from "./Schema-fLas6rbA.mjs";
|
|
2
2
|
// ../sandcovery-contract/src/primitives.ts
|
|
3
3
|
const PROVIDERS = [
|
|
4
4
|
"daytona",
|
|
@@ -79,6 +79,12 @@ const MICRO_USD_PER_DOLLAR = 1e6;
|
|
|
79
79
|
const CREDIT_PURCHASE_MIN_MICRO_USD = 25 * MICRO_USD_PER_DOLLAR;
|
|
80
80
|
const CREDIT_PURCHASE_MAX_MICRO_USD = 1e3 * MICRO_USD_PER_DOLLAR;
|
|
81
81
|
const CARD_FEE_TERMS = "2.9% plus 30 cents";
|
|
82
|
+
const NO_MARKUP_TERMS = [
|
|
83
|
+
"Sandbox usage carries no markup.",
|
|
84
|
+
"On your own provider keys, each provider bills you at its own prices, and Sandcovery charges nothing for that usage.",
|
|
85
|
+
`Credits pay each provider's list price for a sandbox's size, from its start until it ends, and a card processing fee of ${CARD_FEE_TERMS} comes out of each credit purchase.`,
|
|
86
|
+
"Beyond list prices and that fee, Sandcovery charges only for Pro, a fixed fee for each organization."
|
|
87
|
+
].join(" ");
|
|
82
88
|
const Plan = Literals(["free", "pro"]).annotate({
|
|
83
89
|
description: "The organization plan: `pro` while its Pro subscription is active, trialing, or past due, otherwise `free`.",
|
|
84
90
|
identifier: "Plan"
|
|
@@ -101,6 +107,7 @@ const ProPrice = Struct({
|
|
|
101
107
|
});
|
|
102
108
|
const Billing = Struct({
|
|
103
109
|
credit_balance_micro_usd: Int.annotate({ description: "Credits bought, less refunds and open disputes. A refund after use can take it below zero." }),
|
|
110
|
+
credits_on_sale: Boolean.annotate({ description: "Whether a credit purchase is open. Credits go on sale from the moment the latest price notice states." }),
|
|
104
111
|
plan: Plan,
|
|
105
112
|
pro_price: NullOr(ProPrice).annotate({ description: "The Pro price, or null while Pro is not on sale." })
|
|
106
113
|
}).annotate({ identifier: "Billing" });
|
|
@@ -434,4 +441,4 @@ const CreatedKey = Struct({
|
|
|
434
441
|
// ../sandcovery-contract/src/origin.ts
|
|
435
442
|
const SANDCOVERY_ORIGIN = "https://www.sandcovery.com";
|
|
436
443
|
const API_PREFIX = "/api/v1";
|
|
437
|
-
export { CreditCheckout as A,
|
|
444
|
+
export { CreditCheckout as A, MicroUsd as B, RoutingFields as C, CARD_FEE_TERMS as D, Billing as E, CiJobId as F, Region as H, CredentialId as I, GpuType as L, NO_MARKUP_TERMS as M, Pricing as N, CREDIT_PURCHASE_MAX_MICRO_USD as O, ApiKeyId as P, KeyId as R, ROUTING_FIELDS_TEXT as S, StandardSize as T, SandboxId as U, Provider as V, Timestamp as W, SandboxStatus as _, Key as a, ProviderPreferences as b, SpendLimit as c, CreateSandboxRequest as d, Port as f, SandboxSpec as g, SandboxList as h, CreatedKey as i, MICRO_USD_PER_DOLLAR as j, CREDIT_PURCHASE_MIN_MICRO_USD as k, UpdateKeyRequest as l, Sandbox as m, SANDCOVERY_ORIGIN as n, KeyKind as o, PortPreview as p, CreateKeyRequest as r, KeyList as s, API_PREFIX as t, CreateAttempt as u, Snapshot as v, Slug as w, ProviderSort as x, DEFAULT_SLUG as y, KeySecret as z };
|
|
@@ -1,9 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as CARD_FEE_TERMS, O as CREDIT_PURCHASE_MAX_MICRO_USD, _ as SandboxStatus, c as SpendLimit, j as MICRO_USD_PER_DOLLAR, k as CREDIT_PURCHASE_MIN_MICRO_USD, o as KeyKind, x as ProviderSort, y as DEFAULT_SLUG } from "./origin-
|
|
1
|
+
import { Bn as toMillis, Bt as retry, Cn as ClockRef, En as currentTimeMillis$1, Kt as suspend, Ln as TaggedError, Mr as hasProperty, Rn as millis, St as flatMap, Yt as tapError, bt as fail, ht as catchTag, nn as void_, on as spaced, ot as acquireUseRelease, pt as catchDefect, qt as sync, sn as upTo, vt as die, zn as seconds } from "./Schema-fLas6rbA.mjs";
|
|
2
|
+
import { D as CARD_FEE_TERMS, M as NO_MARKUP_TERMS, O as CREDIT_PURCHASE_MAX_MICRO_USD, _ as SandboxStatus, c as SpendLimit, j as MICRO_USD_PER_DOLLAR, k as CREDIT_PURCHASE_MIN_MICRO_USD, o as KeyKind, x as ProviderSort, y as DEFAULT_SLUG } from "./origin-5maEGWRg.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import crypto from "node:crypto";
|
|
6
6
|
import os from "node:os";
|
|
7
|
+
// ../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Clock.js
|
|
8
|
+
/**
|
|
9
|
+
* Context reference for the active time service in the environment.
|
|
10
|
+
*
|
|
11
|
+
* **When to use**
|
|
12
|
+
*
|
|
13
|
+
* Use when you need to access or provide the full time service, including sleep
|
|
14
|
+
* operations, rather than a single timestamp accessor.
|
|
15
|
+
*
|
|
16
|
+
* **Example** (Accessing the Clock service)
|
|
17
|
+
*
|
|
18
|
+
* ```ts import.meta.vitest
|
|
19
|
+
* import { Clock, Effect } from "effect"
|
|
20
|
+
*
|
|
21
|
+
* const testClock: Clock.Clock = {
|
|
22
|
+
* currentTimeMillisUnsafe: () => 1_000,
|
|
23
|
+
* currentTimeMillis: Effect.succeed(1_000),
|
|
24
|
+
* monotonicTimeNanosUnsafe: () => 1_000_000_000n,
|
|
25
|
+
* monotonicTimeNanos: Effect.succeed(1_000_000_000n),
|
|
26
|
+
* currentTimeNanosUnsafe: () => 1_000_000_000n,
|
|
27
|
+
* currentTimeNanos: Effect.succeed(1_000_000_000n),
|
|
28
|
+
* sleep: () => Effect.void
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* const program = Effect.gen(function*() {
|
|
32
|
+
* const clock = yield* Clock.Clock
|
|
33
|
+
* return clock.currentTimeMillisUnsafe()
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* await Effect.runPromise(Effect.provideService(program, Clock.Clock, testClock)) // => 1_000
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @see {@link clockWith} for using the current Clock service inside an effect
|
|
40
|
+
* @see {@link currentTimeMillis} for reading the current time in milliseconds
|
|
41
|
+
* @see {@link currentTimeNanos} for reading the current time in nanoseconds
|
|
42
|
+
*
|
|
43
|
+
* @stability stable
|
|
44
|
+
* @category services
|
|
45
|
+
* @since 2.0.0
|
|
46
|
+
*/
|
|
47
|
+
const Clock = ClockRef;
|
|
48
|
+
/**
|
|
49
|
+
* Returns an Effect that succeeds with the current Unix time in milliseconds.
|
|
50
|
+
*
|
|
51
|
+
* **When to use**
|
|
52
|
+
*
|
|
53
|
+
* Use to create wall-clock timestamps from the active `Clock` service with
|
|
54
|
+
* millisecond precision.
|
|
55
|
+
*
|
|
56
|
+
* **Gotchas**
|
|
57
|
+
*
|
|
58
|
+
* The value can move backward or forward when the system wall clock is
|
|
59
|
+
* corrected, so it is not suitable for measuring elapsed time.
|
|
60
|
+
*
|
|
61
|
+
* **Example** (Reading milliseconds)
|
|
62
|
+
*
|
|
63
|
+
* ```ts import.meta.vitest
|
|
64
|
+
* import { Clock, Effect } from "effect"
|
|
65
|
+
*
|
|
66
|
+
* const testClock: Clock.Clock = {
|
|
67
|
+
* currentTimeMillisUnsafe: () => 1_000,
|
|
68
|
+
* currentTimeMillis: Effect.succeed(1_000),
|
|
69
|
+
* monotonicTimeNanosUnsafe: () => 1_000_000_000n,
|
|
70
|
+
* monotonicTimeNanos: Effect.succeed(1_000_000_000n),
|
|
71
|
+
* currentTimeNanosUnsafe: () => 1_000_000_000n,
|
|
72
|
+
* currentTimeNanos: Effect.succeed(1_000_000_000n),
|
|
73
|
+
* sleep: () => Effect.void
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* await Effect.runPromise(Effect.provideService(Clock.currentTimeMillis, Clock.Clock, testClock)) // => 1_000
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @see {@link currentTimeNanos} for nanosecond precision
|
|
80
|
+
* @see {@link monotonicTimeNanos} for measuring elapsed time
|
|
81
|
+
* @see {@link clockWith} for accessing the full Clock service
|
|
82
|
+
*
|
|
83
|
+
* @stability stable
|
|
84
|
+
* @category accessors
|
|
85
|
+
* @since 2.0.0
|
|
86
|
+
*/
|
|
87
|
+
const currentTimeMillis = currentTimeMillis$1;
|
|
7
88
|
// ../cli-core/src/canceled.ts
|
|
8
89
|
var Canceled = class extends TaggedError("Canceled") {};
|
|
9
90
|
// ../cli-core/src/failure.ts
|
|
@@ -109,6 +190,17 @@ const isWordCharacter = (character) => isDigit(character) || isUpper(character)
|
|
|
109
190
|
const consistsOf = (text, allowed) => text !== "" && text.split("").every(allowed);
|
|
110
191
|
const isDigits = (text) => consistsOf(text, isDigit);
|
|
111
192
|
const codePoints = (text) => Array.from(text, (point) => point);
|
|
193
|
+
// ../../node_modules/.pnpm/es-toolkit@1.53.1/node_modules/es-toolkit/dist/function/noop.mjs
|
|
194
|
+
/**
|
|
195
|
+
* A no-operation function that does nothing.
|
|
196
|
+
* This can be used as a placeholder or default function.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* noop(); // Does nothing
|
|
200
|
+
*
|
|
201
|
+
* @returns This function does not return anything.
|
|
202
|
+
*/
|
|
203
|
+
function noop() {}
|
|
112
204
|
// ../cli-core/src/sanitize.ts
|
|
113
205
|
const ESC = 27;
|
|
114
206
|
const BEL = 7;
|
|
@@ -555,10 +647,104 @@ const parseFailure = ({ bin, issues, path }) => {
|
|
|
555
647
|
reason: first?.reason ?? "invalid_arguments"
|
|
556
648
|
});
|
|
557
649
|
};
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
650
|
+
// ../cli-core/src/mode.ts
|
|
651
|
+
const DEFAULT_WIDTH = 80;
|
|
652
|
+
const terminalOf = (stream) => ({
|
|
653
|
+
columns: stream.columns,
|
|
654
|
+
tty: stream.isTTY === true
|
|
655
|
+
});
|
|
656
|
+
const falsy = /* @__PURE__ */ new Set([
|
|
657
|
+
"",
|
|
658
|
+
"0",
|
|
659
|
+
"false"
|
|
660
|
+
]);
|
|
661
|
+
const enabledVariable = (value) => value !== void 0 && !falsy.has(value.trim().toLowerCase());
|
|
662
|
+
const nonempty = (value) => value !== void 0 && value !== "";
|
|
663
|
+
const colorPreference = ({ env, noColor }) => {
|
|
664
|
+
if (noColor || nonempty(env.NO_COLOR)) return false;
|
|
665
|
+
const forced = env.FORCE_COLOR;
|
|
666
|
+
if (forced === void 0) return;
|
|
667
|
+
return forced !== "0" && forced.toLowerCase() !== "false";
|
|
668
|
+
};
|
|
669
|
+
const streamStyle = ({ accessible, color, env, terminal }) => {
|
|
670
|
+
const rich = terminal.tty && env.TERM !== "dumb" && !accessible;
|
|
671
|
+
return {
|
|
672
|
+
color: color ?? rich,
|
|
673
|
+
rich,
|
|
674
|
+
tty: terminal.tty,
|
|
675
|
+
width: terminal.columns !== void 0 && terminal.columns > 0 ? terminal.columns : DEFAULT_WIDTH
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
const interactionAllowed = (input, ci) => {
|
|
679
|
+
if (!(input.stdin.tty && input.stderr.tty && !input.payloadStdin) || input.json || ci || input.nonInteractive === true) return false;
|
|
680
|
+
return input.agent === void 0 || input.nonInteractive === false;
|
|
681
|
+
};
|
|
682
|
+
const resolveMode = (input) => {
|
|
683
|
+
const { accessible } = input;
|
|
684
|
+
const ci = enabledVariable(input.env.CI);
|
|
685
|
+
const color = colorPreference(input);
|
|
686
|
+
return {
|
|
687
|
+
accessible,
|
|
688
|
+
agent: input.agent,
|
|
689
|
+
ci,
|
|
690
|
+
format: input.json ? "json" : "human",
|
|
691
|
+
githubActions: input.env.GITHUB_ACTIONS === "true",
|
|
692
|
+
interactive: interactionAllowed(input, ci),
|
|
693
|
+
stderr: streamStyle({
|
|
694
|
+
accessible,
|
|
695
|
+
color,
|
|
696
|
+
env: input.env,
|
|
697
|
+
terminal: input.stderr
|
|
698
|
+
}),
|
|
699
|
+
stdin: { tty: input.stdin.tty },
|
|
700
|
+
stdout: streamStyle({
|
|
701
|
+
accessible,
|
|
702
|
+
color,
|
|
703
|
+
env: input.env,
|
|
704
|
+
terminal: input.stdout
|
|
705
|
+
})
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
const AGENT_VARIABLES = [
|
|
709
|
+
"AGENT",
|
|
710
|
+
"AI_AGENT",
|
|
711
|
+
"AUGMENT_AGENT",
|
|
712
|
+
"CLAUDECODE",
|
|
713
|
+
"CLAUDE_CODE",
|
|
714
|
+
"CODEX_SANDBOX",
|
|
715
|
+
"CURSOR_AGENT",
|
|
716
|
+
"GEMINI_CLI",
|
|
717
|
+
"OPENCODE"
|
|
718
|
+
];
|
|
719
|
+
const productVariable = ({ bin, name }) => `${bin.toUpperCase()}_${name}`;
|
|
720
|
+
const guidanceOn = ({ bin, env = process.env }) => !enabledVariable(env[productVariable({
|
|
721
|
+
bin,
|
|
722
|
+
name: "GUIDANCE_DISABLED"
|
|
723
|
+
})]);
|
|
724
|
+
const accessibleOn = ({ bin, env = process.env }) => enabledVariable(env[productVariable({
|
|
725
|
+
bin,
|
|
726
|
+
name: "ACCESSIBLE"
|
|
727
|
+
})]);
|
|
728
|
+
const modeOf = ({ bin, env = process.env, io, json, noColor, nonInteractive, payloadStdin }) => resolveMode({
|
|
729
|
+
accessible: accessibleOn({
|
|
730
|
+
bin,
|
|
731
|
+
env
|
|
732
|
+
}),
|
|
733
|
+
agent: AGENT_VARIABLES.find((name) => enabledVariable(env[name])),
|
|
734
|
+
env,
|
|
735
|
+
json,
|
|
736
|
+
noColor,
|
|
737
|
+
nonInteractive: nonInteractive ?? null,
|
|
738
|
+
payloadStdin,
|
|
739
|
+
stderr: terminalOf(io.stderr),
|
|
740
|
+
stdin: terminalOf(io.stdin),
|
|
741
|
+
stdout: terminalOf(io.stdout)
|
|
742
|
+
});
|
|
743
|
+
// ../cli-core/src/config.ts
|
|
744
|
+
const LOCK_POLL = millis(50);
|
|
745
|
+
const LOCK_STALE_MS = toMillis(seconds(90));
|
|
746
|
+
const LOCK_WAIT = seconds(20);
|
|
747
|
+
var LockHeld = class extends TaggedError("LockHeld") {};
|
|
562
748
|
const configDirectory = ({ bin, cwd, override }) => override === void 0 ? path.join(os.homedir(), ".config", bin) : path.resolve(cwd ?? process.cwd(), override);
|
|
563
749
|
const writePrivateFile = ({ file, text }) => {
|
|
564
750
|
const directory = path.dirname(file);
|
|
@@ -573,10 +759,55 @@ const writePrivateFile = ({ file, text }) => {
|
|
|
573
759
|
});
|
|
574
760
|
fs.renameSync(pending, file);
|
|
575
761
|
};
|
|
762
|
+
const createNew = (file) => sync(() => {
|
|
763
|
+
fs.mkdirSync(path.dirname(file), {
|
|
764
|
+
mode: 448,
|
|
765
|
+
recursive: true
|
|
766
|
+
});
|
|
767
|
+
const fd = fs.openSync(file, "wx", 384);
|
|
768
|
+
const created = fs.fstatSync(fd);
|
|
769
|
+
fs.closeSync(fd);
|
|
770
|
+
return created;
|
|
771
|
+
}).pipe(catchDefect((defect) => hasProperty(defect, "code") && defect.code === "EEXIST" ? fail(new LockHeld()) : die(defect)));
|
|
772
|
+
const fileMatches = (file, matches) => {
|
|
773
|
+
const held = fs.statSync(file, { throwIfNoEntry: false });
|
|
774
|
+
return held !== void 0 && matches(held);
|
|
775
|
+
};
|
|
776
|
+
const removeIf = (file, matches) => sync(() => {
|
|
777
|
+
if (fileMatches(file, matches)) fs.rmSync(file, { force: true });
|
|
778
|
+
});
|
|
779
|
+
const staleAt = (now) => (held) => now - held.mtimeMs > LOCK_STALE_MS;
|
|
780
|
+
const sameAs = (own) => (held) => held.ino === own.ino && held.mtimeMs === own.mtimeMs;
|
|
781
|
+
const removeStaleLock = ({ lock, now }) => {
|
|
782
|
+
const takeover = `${lock}.takeover`;
|
|
783
|
+
return acquireUseRelease(createNew(takeover), () => removeIf(lock, staleAt(now)), (own) => removeIf(takeover, sameAs(own))).pipe(catchTag("LockHeld", () => removeIf(takeover, staleAt(now))));
|
|
784
|
+
};
|
|
785
|
+
const takeLock = ({ bin, lock }) => suspend(() => createNew(lock)).pipe(tapError(() => currentTimeMillis.pipe(flatMap((now) => fileMatches(lock, staleAt(now)) ? removeStaleLock({
|
|
786
|
+
lock,
|
|
787
|
+
now
|
|
788
|
+
}) : void_))), retry(spaced(LOCK_POLL).pipe(upTo({ duration: LOCK_WAIT }))), catchTag("LockHeld", () => fail(new CliFailure({
|
|
789
|
+
blocked: true,
|
|
790
|
+
context: [{
|
|
791
|
+
label: "Lock",
|
|
792
|
+
value: lock
|
|
793
|
+
}],
|
|
794
|
+
message: `Can't update the saved login. Another ${bin} command is updating it.`,
|
|
795
|
+
notes: [`Run the command again once the other ${bin} command finishes.`],
|
|
796
|
+
reason: "login_locked",
|
|
797
|
+
retryable: true
|
|
798
|
+
}))));
|
|
799
|
+
const withFileLock = ({ bin, file, work }) => {
|
|
800
|
+
const lock = `${file}.lock`;
|
|
801
|
+
return acquireUseRelease(takeLock({
|
|
802
|
+
bin,
|
|
803
|
+
lock
|
|
804
|
+
}), () => work, (own) => removeIf(lock, sameAs(own)));
|
|
805
|
+
};
|
|
576
806
|
// package.json
|
|
577
|
-
var version = "0.
|
|
807
|
+
var version = "0.5.0";
|
|
578
808
|
// src/cli/spec.ts
|
|
579
809
|
const BIN = "sandcovery";
|
|
810
|
+
const SETUP_MARK = "# added by sandcovery setup";
|
|
580
811
|
const NULLABLE_TEXT = "string | null";
|
|
581
812
|
const NULLABLE_NUMBER = "number | null";
|
|
582
813
|
const SANDBOX = "<SANDBOX>";
|
|
@@ -1265,14 +1496,120 @@ const docker = {
|
|
|
1265
1496
|
notes: [
|
|
1266
1497
|
"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.",
|
|
1267
1498
|
"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.",
|
|
1268
|
-
"build, buildx, builder,
|
|
1269
|
-
"
|
|
1499
|
+
"build, buildx, builder, and image build first copy the working directory into the sandbox, up to 100 MiB packed, so their relative paths resolve as they do here. Every other path names a file in the sandbox, as with a remote Docker daemon.",
|
|
1500
|
+
"compose first copies the Compose project into the sandbox, up to 100 MiB packed: its Compose files and env files, each build context without what .dockerignore leaves out, and each bind-mounted file or directory, under the directory that holds them all. ps, logs, down, and other commands that only read the project copy only the Compose files and env files. The copy keeps what containers wrote there, and a file deleted here stays there. Variables in Compose files come only from .env and --env-file, and absolute and ~ paths name files in the sandbox.",
|
|
1501
|
+
"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 reads stdin to its end and hands it to docker.",
|
|
1502
|
+
"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.",
|
|
1503
|
+
"The command gets no terminal and stops after an hour, so docker run -it does not work.",
|
|
1504
|
+
"sandcovery-docker takes docker arguments alone, runs them in the same sandbox, and adds nothing to docker output, so alias docker=sandcovery-docker runs docker here."
|
|
1270
1505
|
],
|
|
1271
1506
|
options: [baseUrl],
|
|
1272
1507
|
passthrough: true,
|
|
1273
1508
|
result: [],
|
|
1274
1509
|
summary: "Run a docker command in a sandbox"
|
|
1275
1510
|
};
|
|
1511
|
+
const setup = {
|
|
1512
|
+
arguments: [],
|
|
1513
|
+
examples: [{
|
|
1514
|
+
argv: ["setup"],
|
|
1515
|
+
summary: "Run docker, kubectl, and the other drop-ins on sandboxes"
|
|
1516
|
+
}, {
|
|
1517
|
+
argv: ["setup", "--undo"],
|
|
1518
|
+
summary: "Remove every shim and every line setup added"
|
|
1519
|
+
}],
|
|
1520
|
+
kind: "leaf",
|
|
1521
|
+
name: "setup",
|
|
1522
|
+
notes: [
|
|
1523
|
+
"Writes a shim for each Sandcovery drop-in on PATH, such as docker for sandcovery-docker and kubectl for sandcovery-kubectl, into the bin folder beside the CLI settings, and adds a line that puts that folder first on PATH to the startup files of bash, zsh, and fish.",
|
|
1524
|
+
"Lists every change and asks first, and without a terminal it needs --yes. Run it again after installing a new drop-in; with nothing to change, it changes nothing.",
|
|
1525
|
+
`Each shim and line it adds is marked "${SETUP_MARK}", and --undo removes only those. Your own docker or kubectl stays where it is and runs by its full path.`
|
|
1526
|
+
],
|
|
1527
|
+
options: [
|
|
1528
|
+
json,
|
|
1529
|
+
flag({
|
|
1530
|
+
name: "undo",
|
|
1531
|
+
summary: "Remove every shim and every line setup added"
|
|
1532
|
+
}),
|
|
1533
|
+
yes
|
|
1534
|
+
],
|
|
1535
|
+
result: [
|
|
1536
|
+
{
|
|
1537
|
+
name: "changes[].action",
|
|
1538
|
+
type: "\"append\" | \"delete\" | \"remove\" | \"write\""
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
name: "changes[].file",
|
|
1542
|
+
type: "string"
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
name: "changes[].line",
|
|
1546
|
+
type: NULLABLE_NUMBER
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
name: "changes[].text",
|
|
1550
|
+
type: NULLABLE_TEXT
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
name: "drop_ins[].binary",
|
|
1554
|
+
type: "string"
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
name: "drop_ins[].installed",
|
|
1558
|
+
type: "boolean"
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
name: "drop_ins[].real_path",
|
|
1562
|
+
type: NULLABLE_TEXT
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
name: "drop_ins[].tool",
|
|
1566
|
+
type: "string"
|
|
1567
|
+
}
|
|
1568
|
+
],
|
|
1569
|
+
summary: "Run docker, kubectl, and other drop-ins on sandboxes"
|
|
1570
|
+
};
|
|
1571
|
+
const login = {
|
|
1572
|
+
arguments: [],
|
|
1573
|
+
examples: [{
|
|
1574
|
+
argv: ["login"],
|
|
1575
|
+
summary: "Log in with a browser"
|
|
1576
|
+
}, {
|
|
1577
|
+
argv: ["login", "--no-open"],
|
|
1578
|
+
summary: "Print the login URL instead of opening a browser"
|
|
1579
|
+
}],
|
|
1580
|
+
kind: "leaf",
|
|
1581
|
+
name: "login",
|
|
1582
|
+
notes: ["Shows a login URL and a code, then waits while a person signed in to Sandcovery approves that code in a browser. The login is saved, readable only by you, beside the CLI settings, and renews itself until you log out.", "Commands send --token or SANDCOVERY_API_KEY when either is set, and the saved login otherwise. Without a terminal, set SANDCOVERY_API_KEY instead."],
|
|
1583
|
+
options: [
|
|
1584
|
+
baseUrl,
|
|
1585
|
+
flag({
|
|
1586
|
+
name: "open",
|
|
1587
|
+
summary: "Open the login URL in a browser; the default where one can open, and --no-open only prints it"
|
|
1588
|
+
}),
|
|
1589
|
+
json
|
|
1590
|
+
],
|
|
1591
|
+
result: [],
|
|
1592
|
+
summary: "Log in with a browser, so commands need no key"
|
|
1593
|
+
};
|
|
1594
|
+
const logout = {
|
|
1595
|
+
arguments: [],
|
|
1596
|
+
examples: [{
|
|
1597
|
+
argv: ["logout"],
|
|
1598
|
+
summary: "Log out on this computer"
|
|
1599
|
+
}],
|
|
1600
|
+
kind: "leaf",
|
|
1601
|
+
name: "logout",
|
|
1602
|
+
notes: ["Revokes the saved login at Sandcovery and deletes it. Keys in --token or SANDCOVERY_API_KEY stay as they are."],
|
|
1603
|
+
options: [json],
|
|
1604
|
+
result: [{
|
|
1605
|
+
name: "logout.origin",
|
|
1606
|
+
type: NULLABLE_TEXT
|
|
1607
|
+
}, {
|
|
1608
|
+
name: "logout.revoked",
|
|
1609
|
+
type: "boolean"
|
|
1610
|
+
}],
|
|
1611
|
+
summary: "Log out and delete the saved login"
|
|
1612
|
+
};
|
|
1276
1613
|
const sandboxes = {
|
|
1277
1614
|
children: [
|
|
1278
1615
|
sandboxesList,
|
|
@@ -1558,6 +1895,10 @@ const storedCredential = [
|
|
|
1558
1895
|
{
|
|
1559
1896
|
name: "credential.hint",
|
|
1560
1897
|
type: "string"
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
name: "credential.paused",
|
|
1901
|
+
type: "boolean"
|
|
1561
1902
|
}
|
|
1562
1903
|
];
|
|
1563
1904
|
const credentials = {
|
|
@@ -1570,7 +1911,7 @@ const credentials = {
|
|
|
1570
1911
|
}],
|
|
1571
1912
|
kind: "leaf",
|
|
1572
1913
|
name: "list",
|
|
1573
|
-
notes: ["Shows a hint of each credential, never the credential. Needs a management key.", "A provider's credentials are listed in the order a create tries them.
|
|
1914
|
+
notes: ["Shows a hint of each credential, never the credential. Needs a management key.", "A provider's credentials are listed in the order a create tries them. A Free organization routes only its oldest credential, and Paused marks each other one."],
|
|
1574
1915
|
options: [baseUrl, json],
|
|
1575
1916
|
result: [
|
|
1576
1917
|
{
|
|
@@ -1588,6 +1929,10 @@ const credentials = {
|
|
|
1588
1929
|
{
|
|
1589
1930
|
name: "credentials[].hint",
|
|
1590
1931
|
type: "string"
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
name: "credentials[].paused",
|
|
1935
|
+
type: "boolean"
|
|
1591
1936
|
}
|
|
1592
1937
|
],
|
|
1593
1938
|
shortcuts: ["ls"],
|
|
@@ -1653,7 +1998,7 @@ const credentials = {
|
|
|
1653
1998
|
}],
|
|
1654
1999
|
kind: "leaf",
|
|
1655
2000
|
name: "add",
|
|
1656
|
-
notes: ["A create tries your credentials for a provider in the order you added them, and falls back to the next one on capacity, quota, a provider error, or a timeout.", "
|
|
2001
|
+
notes: ["A create tries your credentials for a provider in the order you added them, and falls back to the next one on capacity, quota, a provider error, or a timeout.", "A Free organization routes only its oldest credential, so another stays paused until it has Pro. Prefer --from -, since options show in process lists. Needs a management key."],
|
|
1657
2002
|
options: [
|
|
1658
2003
|
baseUrl,
|
|
1659
2004
|
credentialField,
|
|
@@ -1965,7 +2310,7 @@ const usage = {
|
|
|
1965
2310
|
}],
|
|
1966
2311
|
kind: "leaf",
|
|
1967
2312
|
name: "estimate",
|
|
1968
|
-
notes: ["Prices the spec on each provider that can run it, in routing order, at the size each slug runs there, without creating anything."],
|
|
2313
|
+
notes: ["Prices the spec on each provider that can run it, in routing order, at the size each slug runs there, without creating anything.", NO_MARKUP_TERMS],
|
|
1969
2314
|
options: [
|
|
1970
2315
|
baseUrl,
|
|
1971
2316
|
json,
|
|
@@ -2083,7 +2428,7 @@ const billing = {
|
|
|
2083
2428
|
}],
|
|
2084
2429
|
kind: "leaf",
|
|
2085
2430
|
name: "inspect",
|
|
2086
|
-
notes: [`Shows the plan, the credit balance, and the Pro price. It fails as not found while billing is not
|
|
2431
|
+
notes: [`Shows the plan, the credit balance, and the Pro price. It fails as not found while billing is not set up. ${NEEDS_MANAGEMENT}`],
|
|
2087
2432
|
options: [baseUrl, json],
|
|
2088
2433
|
result: [
|
|
2089
2434
|
{
|
|
@@ -2094,6 +2439,10 @@ const billing = {
|
|
|
2094
2439
|
name: "billing.credit_balance_micro_usd",
|
|
2095
2440
|
type: "number"
|
|
2096
2441
|
},
|
|
2442
|
+
{
|
|
2443
|
+
name: "billing.credits_on_sale",
|
|
2444
|
+
type: "boolean"
|
|
2445
|
+
},
|
|
2097
2446
|
{
|
|
2098
2447
|
name: "billing.pro_price",
|
|
2099
2448
|
type: "object | null"
|
|
@@ -2145,7 +2494,7 @@ const pricing = {
|
|
|
2145
2494
|
}],
|
|
2146
2495
|
kind: "leaf",
|
|
2147
2496
|
name: "inspect",
|
|
2148
|
-
notes: ["Shows the Pro price, the smallest and largest credit purchase, and the processing fee that comes out of each purchase. It needs no key, and the Pro price reads Not on sale while Pro is not on sale."],
|
|
2497
|
+
notes: ["Shows the Pro price, the smallest and largest credit purchase, and the processing fee that comes out of each purchase. It needs no key, and the Pro price reads Not on sale while Pro is not on sale.", NO_MARKUP_TERMS],
|
|
2149
2498
|
options: [baseUrl, json],
|
|
2150
2499
|
result: [{
|
|
2151
2500
|
name: "pricing.pro_price",
|
|
@@ -2441,6 +2790,7 @@ const CLI = {
|
|
|
2441
2790
|
children: [
|
|
2442
2791
|
sandboxes,
|
|
2443
2792
|
docker,
|
|
2793
|
+
setup,
|
|
2444
2794
|
keys,
|
|
2445
2795
|
credentials,
|
|
2446
2796
|
providers,
|
|
@@ -2450,6 +2800,8 @@ const CLI = {
|
|
|
2450
2800
|
billing,
|
|
2451
2801
|
pricing,
|
|
2452
2802
|
ci,
|
|
2803
|
+
login,
|
|
2804
|
+
logout,
|
|
2453
2805
|
help,
|
|
2454
2806
|
{
|
|
2455
2807
|
children: [{
|
|
@@ -2479,7 +2831,7 @@ const CLI = {
|
|
|
2479
2831
|
kind: "group",
|
|
2480
2832
|
name: BIN,
|
|
2481
2833
|
notes: [
|
|
2482
|
-
"SANDCOVERY_API_KEY holds an API key or management key from the dashboard; --token wins over it, an empty value counts as unset, and the CLI never saves it.",
|
|
2834
|
+
"SANDCOVERY_API_KEY holds an API key or management key from the dashboard; --token wins over it, an empty value counts as unset, and the CLI never saves it. With neither set, commands send the login that sandcovery login saved.",
|
|
2483
2835
|
"SANDCOVERY_BASE_URL sets the origin; --base-url wins over it. SANDCOVERY_TELEMETRY_DISABLED=1 turns telemetry off. SANDCOVERY_GUIDANCE_DISABLED=1 hides optional next steps. SANDCOVERY_ACCESSIBLE=1 prints words instead of status glyphs.",
|
|
2484
2836
|
"NO_COLOR or --no-color turns color off, FORCE_COLOR turns it on, and CI makes every command non-interactive."
|
|
2485
2837
|
],
|
|
@@ -2493,7 +2845,8 @@ const CLI = {
|
|
|
2493
2845
|
["sandboxes", "list"],
|
|
2494
2846
|
["sandboxes", "destroy"],
|
|
2495
2847
|
["sandboxes", "files"],
|
|
2496
|
-
["docker"]
|
|
2848
|
+
["docker"],
|
|
2849
|
+
["setup"]
|
|
2497
2850
|
],
|
|
2498
2851
|
title: "Sandboxes"
|
|
2499
2852
|
},
|
|
@@ -2511,6 +2864,8 @@ const CLI = {
|
|
|
2511
2864
|
},
|
|
2512
2865
|
{
|
|
2513
2866
|
paths: [
|
|
2867
|
+
["login"],
|
|
2868
|
+
["logout"],
|
|
2514
2869
|
["keys"],
|
|
2515
2870
|
["credentials"],
|
|
2516
2871
|
["activity", "list"],
|
|
@@ -2528,4 +2883,4 @@ const CLI = {
|
|
|
2528
2883
|
}
|
|
2529
2884
|
]
|
|
2530
2885
|
};
|
|
2531
|
-
export {
|
|
2886
|
+
export { remoteCell as A, exitCodeOf as B, clearLine as C, spinnerFrame as D, plainPrefix as E, isDigit as F, usageFailure as H, isDigits as I, isUpper as L, remoteText as M, noop as N, theme as O, consistsOf as P, isWordCharacter as R, valuesOf as S, glyph as T, Canceled as U, statusOf as V, Clock as W, lastValue as _, version as a, readOptionToken as b, writePrivateFile as c, modeOf as d, productVariable as f, isOptionValue as g, isOptionToken as h, SETUP_MARK as i, remoteLine as j, escapeUnprintable as k, enabledVariable as l, flagOf as m, CLEARABLE as n, configDirectory as o, closest as p, CLI as r, withFileLock as s, BIN as t, guidanceOn as u, parseFailure as v, ellipsis as w, rerunArgv as x, parseLeaf as y, CliFailure as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as CreditCheckout, B as
|
|
1
|
+
import { B as tag, E as fromJsonString, L as makeFilter, S as decodeUnknownOption, _ as Struct, a as Finite, d as Natural, er as getOrElse, g as String$1, h as Record, i as Error$1, j as isGreaterThanOrEqualTo, k as isBetween, l as Literal, m as NullOr, n as Boolean, p as NonEmptyString, s as Int, t as ArraySchema, u as Literals, v as Union, w as decodeUnknownSync, z as optionalKey } from "./Schema-fLas6rbA.mjs";
|
|
2
|
+
import { A as CreditCheckout, B as MicroUsd, C as RoutingFields, E as Billing, F as CiJobId, H as Region, I as CredentialId, L as GpuType, N as Pricing, P as ApiKeyId, R as KeyId, S as ROUTING_FIELDS_TEXT, T as StandardSize, U as SandboxId, V as Provider, W as Timestamp, a as Key, b as ProviderPreferences, f as Port, g as SandboxSpec, h as SandboxList, i as CreatedKey, m as Sandbox, p as PortPreview, s as KeyList, t as API_PREFIX, u as CreateAttempt, v as Snapshot, w as Slug } from "./origin-5maEGWRg.mjs";
|
|
3
3
|
// ../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/ErrorReporter.js
|
|
4
4
|
/**
|
|
5
5
|
* Defines the runtime property key used to mark an object error as ignored by error
|
|
@@ -416,13 +416,14 @@ const ProviderCredential = Struct({
|
|
|
416
416
|
created_at: Timestamp,
|
|
417
417
|
hint: String$1.annotate({ description: "The last four characters of the first secret field, for display." }),
|
|
418
418
|
id: CredentialId,
|
|
419
|
+
paused: Boolean.annotate({ description: "Whether routing skips this credential. A Free organization routes only its oldest credential, so each other one stays stored and paused until the organization has Pro." }),
|
|
419
420
|
provider: Provider,
|
|
420
421
|
updated_at: Timestamp
|
|
421
422
|
}).annotate({
|
|
422
423
|
description: "A stored provider credential. Sandcovery encrypts it at rest and never returns its fields.",
|
|
423
424
|
identifier: "ProviderCredential"
|
|
424
425
|
});
|
|
425
|
-
const ProviderCredentialList = Struct({ data: ArraySchema(ProviderCredential).annotate({ description: "Every stored credential, by provider and then in the order a create tries them: the order they were added.
|
|
426
|
+
const ProviderCredentialList = Struct({ data: ArraySchema(ProviderCredential).annotate({ description: "Every stored credential, by provider and then in the order a create tries them: the order they were added. A Free organization routes only its oldest credential, and `paused` marks each other one." }) }).annotate({ identifier: "ProviderCredentialList" });
|
|
426
427
|
// ../sandcovery-contract/src/errors/concurrency-limit-reached.ts
|
|
427
428
|
var ConcurrencyLimitReached = class extends Error$1("ConcurrencyLimitReached")({
|
|
428
429
|
concurrency_cap: Natural,
|