sandcovery 0.2.0 → 0.4.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 +17 -7
- package/dist/{Schema-C4ay0Aif.mjs → Schema-CFI3ZMu8.mjs} +216 -4
- package/dist/cli/index.mjs +10 -29
- package/dist/handlers-BS1KuMqq.mjs +6546 -0
- package/dist/index.d.mts +31 -1
- package/dist/index.mjs +1 -1
- package/dist/{origin-Dj-n4EQa.mjs → origin-BTx2gX8x.mjs} +162 -81
- package/dist/posthog-project-BpOd2VxW.mjs +1 -0
- package/dist/{posthog-project-Bb0IFKUv.mjs → posthog-project-CdWw_ofg.mjs} +3 -1
- package/dist/{spec-ClAX0dAN.mjs → spec-B4c-Ug3B.mjs} +765 -144
- package/dist/src-DPDVOBkr.mjs +1016 -0
- package/dist/{telemetry-delivery-1a7C-8DK.mjs → telemetry-delivery-Yd6CeynR.mjs} +3 -3
- package/dist/types-DvoIdTvQ.d.mts +684 -0
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs +35 -19
- package/package.json +6 -4
- package/dist/handlers-BxhSLDGk.mjs +0 -2217
- package/dist/posthog-project-B0jmQTwy.mjs +0 -1
- package/dist/src-D3WZodpF.mjs +0 -572
- package/dist/types-Dxh7amZB.d.mts +0 -345
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Sandcovery
|
|
6
6
|
|
|
7
|
-
TypeScript client for the [Sandcovery API](https://www.sandcovery.com): one API and one key for ephemeral sandboxes across
|
|
7
|
+
TypeScript client for the [Sandcovery API](https://www.sandcovery.com): one API and one key for ephemeral sandboxes across [every routed provider](https://www.sandcovery.com/providers), running on your own provider accounts.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ import { Sandcovery } from 'sandcovery'
|
|
|
24
24
|
const sandcovery = new Sandcovery()
|
|
25
25
|
|
|
26
26
|
const sandbox = await sandcovery.sandboxes.create({
|
|
27
|
-
|
|
27
|
+
slug: 'sandcovery/2x4:cheapest',
|
|
28
28
|
ttl_seconds: 600,
|
|
29
29
|
})
|
|
30
30
|
|
|
@@ -53,26 +53,30 @@ The package also installs the `sandcovery` command, which calls the API through
|
|
|
53
53
|
npm install --global sandcovery
|
|
54
54
|
export SANDCOVERY_API_KEY=sand_...
|
|
55
55
|
|
|
56
|
-
id=$(sandcovery sandboxes create --
|
|
56
|
+
id=$(sandcovery sandboxes create --slug sandcovery/2x4:cheapest --ttl 600)
|
|
57
57
|
sandcovery sandboxes exec "$id" -- npm test
|
|
58
58
|
sandcovery sandboxes destroy "$id" --yes
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
- `sandcovery sandboxes exec` streams the command's output and exits with the command's exit code.
|
|
62
|
+
- `sandcovery docker <args>` runs `docker <args>` in a sandbox on a provider that runs Docker, streams its output, and exits with its exit code, so a computer with no Docker can build and run containers. Later `sandcovery docker` commands reuse that sandbox until its TTL ends, and `build`, `buildx`, `builder`, `compose`, and `image build` first copy the working directory into it, up to 100 MiB packed. It reads no stdin and gets no terminal, so `docker run -it` does not work.
|
|
62
63
|
- `--json` prints one JSON document on stdout, and every failure prints a JSON error with a stable `reason` on stderr.
|
|
63
64
|
- `sandboxes destroy`, `keys revoke`, and `credentials delete` ask first, and need `--yes` without a terminal.
|
|
65
|
+
- `sandcovery providers list --routed` lists only the providers Sandcovery routes to, `sandcovery credentials offer` shows the free vCPU-hours your keys have earned, `sandcovery pricing inspect` shows the Pro price and the credit terms with no key, and `sandcovery billing inspect` and `sandcovery billing buy-credits --amount <USD>` show the plan and start a credit payment.
|
|
64
66
|
- `sandcovery help search <words>` finds a command, and `--help` works on every command.
|
|
65
67
|
- The CLI sends anonymous usage data: command paths, option names, failure reasons, and exit codes, never values or remote data. `sandcovery cli telemetry disable` or `SANDCOVERY_TELEMETRY_DISABLED=1` turns it off.
|
|
66
68
|
|
|
67
69
|
## Routing
|
|
68
70
|
|
|
69
|
-
A size
|
|
71
|
+
A slug names a provider and a size, written `<provider>/<vcpu>x<memory_gib>`, in the shape of OpenRouter model slugs. `boat/2x4` pins boat at 2 vCPU and 4 GiB, and `sandcovery/2x4` routes across every candidate provider. Either number may be `n` for any value, so `sandcovery/nx16` runs each provider's cheapest size with 16 GiB. A slug routes as `:cheapest`, sorting candidates by list price. Add `:fastest` or `:most-reliable` to sort them by measured create latency or uptime over the last 15 minutes instead. With no slug, a create runs `sandcovery/2x4`.
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
`slugs` takes up to 8 slugs to try in order, as OpenRouter takes `models`, and `slug` goes first when both are set. Within a `sandcovery/` slug, a failed create falls back across that slug's candidates first, then moves to the next slug. `provider` takes `order`, `only`, `ignore`, `sort`, and `allow_fallbacks` and applies them to every slug. Every create attempt is listed in `sandbox.attempts`, and `sandbox.slug` is the provider and size it runs on.
|
|
74
|
+
|
|
75
|
+
Provider, region, and slug names are open strings, so a name the API adds later works with this version. The names known at release are exported from `sandcovery/types` as `PROVIDERS`, `REGIONS`, `STANDARD_SIZES`, `SLUGS`, and `EGRESS_MODES`.
|
|
72
76
|
|
|
73
77
|
## Keys and provider credentials
|
|
74
78
|
|
|
75
|
-
`keys`, `credentials`, and `
|
|
79
|
+
`keys`, `credentials`, `usage`, and `billing` need a management key, which an organization owner mints in the dashboard. An API key receives 403 there.
|
|
76
80
|
|
|
77
81
|
```ts
|
|
78
82
|
const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
|
|
@@ -80,7 +84,13 @@ const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
|
|
|
80
84
|
await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY })
|
|
81
85
|
```
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
An organization on Pro can hold more than one credential for a provider: `credentials.add(provider, fields)` adds another, a create tries them in the order they were added, and `credentials.deleteOne(provider, id)` deletes one.
|
|
88
|
+
|
|
89
|
+
The fields each provider takes are its `credential_fields` on `sandcovery.providers.get(provider)`. `sandcovery.providers.catalog()` lists every provider on the [provider board](https://www.sandcovery.com/providers), where `routed` is `false` for a provider that is coming soon. `credentials.offer()` reads the free vCPU-hours your keys have earned, `billing.get()` reads the plan and the credit balance, and `billing.buyCredits({ amount_micro_usd })` answers the Stripe Checkout page that takes a credit payment.
|
|
90
|
+
|
|
91
|
+
## Interfaces
|
|
92
|
+
|
|
93
|
+
This client, the `sandcovery` command, and the Python client each reach every operation of the REST API, and a test of each fails when one of them leaves an operation out.
|
|
84
94
|
|
|
85
95
|
## Errors
|
|
86
96
|
|
|
@@ -2597,7 +2597,7 @@ const String$4 = /*#__PURE__*/ make$10((self, that) => self < that ? -1 : 1);
|
|
|
2597
2597
|
* @category instances
|
|
2598
2598
|
* @since 4.0.0
|
|
2599
2599
|
*/
|
|
2600
|
-
const Number$
|
|
2600
|
+
const Number$5 = /*#__PURE__*/ make$10((self, that) => {
|
|
2601
2601
|
if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
|
|
2602
2602
|
if (globalThis.Number.isNaN(self)) return -1;
|
|
2603
2603
|
if (globalThis.Number.isNaN(that)) return 1;
|
|
@@ -2879,6 +2879,42 @@ const getOrElse = /*#__PURE__*/ dual(2, (self, onNone) => isNone(self) ? onNone(
|
|
|
2879
2879
|
*/
|
|
2880
2880
|
const getOrUndefined = /*#__PURE__*/ getOrElse(constUndefined);
|
|
2881
2881
|
/**
|
|
2882
|
+
* Lifts a function that may throw into one that returns an `Option`.
|
|
2883
|
+
*
|
|
2884
|
+
* **When to use**
|
|
2885
|
+
*
|
|
2886
|
+
* Use to wrap exception-throwing APIs (e.g. `JSON.parse`) for safe usage
|
|
2887
|
+
*
|
|
2888
|
+
* **Details**
|
|
2889
|
+
*
|
|
2890
|
+
* - If the function returns normally → `Some` with the result
|
|
2891
|
+
* - If the function throws → `None` (exception is swallowed)
|
|
2892
|
+
*
|
|
2893
|
+
* **Example** (Lifting JSON.parse)
|
|
2894
|
+
*
|
|
2895
|
+
* ```ts import.meta.vitest
|
|
2896
|
+
* import { Option } from "effect"
|
|
2897
|
+
*
|
|
2898
|
+
* const parse = Option.liftThrowable(JSON.parse)
|
|
2899
|
+
*
|
|
2900
|
+
* parse("1") // => Option.some(1)
|
|
2901
|
+
* parse("") // => Option.none()
|
|
2902
|
+
* ```
|
|
2903
|
+
*
|
|
2904
|
+
* @see {@link liftNullishOr} for nullable-returning functions
|
|
2905
|
+
*
|
|
2906
|
+
* @stability stable
|
|
2907
|
+
* @category converting
|
|
2908
|
+
* @since 2.0.0
|
|
2909
|
+
*/
|
|
2910
|
+
const liftThrowable = (f) => (...a) => {
|
|
2911
|
+
try {
|
|
2912
|
+
return some(f(...a));
|
|
2913
|
+
} catch {
|
|
2914
|
+
return none();
|
|
2915
|
+
}
|
|
2916
|
+
};
|
|
2917
|
+
/**
|
|
2882
2918
|
* Transforms the value inside a `Some` using the provided function, leaving
|
|
2883
2919
|
* `None` unchanged.
|
|
2884
2920
|
*
|
|
@@ -2909,6 +2945,50 @@ const getOrUndefined = /*#__PURE__*/ getOrElse(constUndefined);
|
|
|
2909
2945
|
* @since 2.0.0
|
|
2910
2946
|
*/
|
|
2911
2947
|
const map$5 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
|
|
2948
|
+
/**
|
|
2949
|
+
* Applies a function that returns an `Option` to the value of a `Some`,
|
|
2950
|
+
* flattening the result. Returns `None` if the input is `None`.
|
|
2951
|
+
*
|
|
2952
|
+
* **When to use**
|
|
2953
|
+
*
|
|
2954
|
+
* Use when you need to chain dependent `Option` computations where each step
|
|
2955
|
+
* may return `None`.
|
|
2956
|
+
*
|
|
2957
|
+
* **Details**
|
|
2958
|
+
*
|
|
2959
|
+
* - `Some` → applies `f` to the value and returns its `Option` result
|
|
2960
|
+
* - `None` → returns `None` without calling `f`
|
|
2961
|
+
* - Equivalent to `map` followed by {@link flatten}
|
|
2962
|
+
*
|
|
2963
|
+
* **Example** (Chaining optional lookups)
|
|
2964
|
+
*
|
|
2965
|
+
* ```ts import.meta.vitest
|
|
2966
|
+
* import { Option } from "effect"
|
|
2967
|
+
*
|
|
2968
|
+
* interface User {
|
|
2969
|
+
* readonly name: string
|
|
2970
|
+
* readonly address: Option.Option<{ readonly street: Option.Option<string> }>
|
|
2971
|
+
* }
|
|
2972
|
+
*
|
|
2973
|
+
* const user: User = {
|
|
2974
|
+
* name: "John",
|
|
2975
|
+
* address: Option.some({ street: Option.some("123 Main St") })
|
|
2976
|
+
* }
|
|
2977
|
+
*
|
|
2978
|
+
* user.address.pipe(
|
|
2979
|
+
* Option.flatMap((addr) => addr.street)
|
|
2980
|
+
* ) // => Option.some("123 Main St")
|
|
2981
|
+
* ```
|
|
2982
|
+
*
|
|
2983
|
+
* @see {@link map} when `f` returns a plain value
|
|
2984
|
+
* @see {@link andThen} for a more flexible variant
|
|
2985
|
+
* @see {@link flatten} to unwrap a nested `Option<Option<A>>`
|
|
2986
|
+
*
|
|
2987
|
+
* @stability stable
|
|
2988
|
+
* @category sequencing
|
|
2989
|
+
* @since 2.0.0
|
|
2990
|
+
*/
|
|
2991
|
+
const flatMap$3 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(self.value));
|
|
2912
2992
|
// ../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Context.js
|
|
2913
2993
|
/**
|
|
2914
2994
|
* Runtime type identifier attached to `Context` service keys and used by
|
|
@@ -5719,6 +5799,49 @@ const formatIsoOffset = (self) => {
|
|
|
5719
5799
|
};
|
|
5720
5800
|
/** @internal */
|
|
5721
5801
|
const formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
|
|
5802
|
+
globalThis.Number;
|
|
5803
|
+
/**
|
|
5804
|
+
* Returns the remainder left over when one operand is divided by a second operand, always taking the sign of the dividend.
|
|
5805
|
+
*
|
|
5806
|
+
* **When to use**
|
|
5807
|
+
*
|
|
5808
|
+
* Use to compute a numeric remainder while preserving decimal precision better
|
|
5809
|
+
* than direct JavaScript `%` for decimal operands.
|
|
5810
|
+
*
|
|
5811
|
+
* **Example** (Calculating remainders)
|
|
5812
|
+
*
|
|
5813
|
+
* ```ts import.meta.vitest
|
|
5814
|
+
* import { Number } from "effect"
|
|
5815
|
+
*
|
|
5816
|
+
* Number.remainder(2, 2) // => 0
|
|
5817
|
+
* Number.remainder(3, 2) // => 1
|
|
5818
|
+
* Number.remainder(-4, 2) // => -0
|
|
5819
|
+
* ```
|
|
5820
|
+
*
|
|
5821
|
+
* @see {@link divide} for quotient calculation with division-by-zero represented as `Option.none`
|
|
5822
|
+
*
|
|
5823
|
+
* @stability stable
|
|
5824
|
+
* @category math
|
|
5825
|
+
* @since 2.0.0
|
|
5826
|
+
*/
|
|
5827
|
+
const remainder = /*#__PURE__*/ dual(2, (self, divisor) => {
|
|
5828
|
+
if (!globalThis.Number.isFinite(self) || !globalThis.Number.isFinite(divisor) || divisor === 0) return NaN;
|
|
5829
|
+
if (globalThis.Number.isInteger(self) && globalThis.Number.isInteger(divisor)) return self % divisor;
|
|
5830
|
+
const [selfCoefficient, selfExponent] = toScientificInteger(self);
|
|
5831
|
+
const [divisorCoefficient, divisorExponent] = toScientificInteger(divisor);
|
|
5832
|
+
const exponent = Math.min(selfExponent, divisorExponent);
|
|
5833
|
+
const out = selfCoefficient * BigInt(10) ** BigInt(selfExponent - exponent) % (divisorCoefficient * BigInt(10) ** BigInt(divisorExponent - exponent));
|
|
5834
|
+
if (out === BigInt(0)) return self < 0 || Object.is(self, -0) ? -0 : 0;
|
|
5835
|
+
const remainder = globalThis.Number(`${out}e${exponent}`);
|
|
5836
|
+
return remainder === 0 ? Math.sign(self) * globalThis.Number.MIN_VALUE : remainder;
|
|
5837
|
+
});
|
|
5838
|
+
function toScientificInteger(n) {
|
|
5839
|
+
if (globalThis.Number.isInteger(n)) return [BigInt(n), 0];
|
|
5840
|
+
const scientific = Math.abs(n).toExponential();
|
|
5841
|
+
const eIndex = scientific.indexOf("e");
|
|
5842
|
+
const digits = scientific.slice(0, eIndex).replace(".", "");
|
|
5843
|
+
return [BigInt(digits) * (n < 0 ? -BigInt(1) : BigInt(1)), globalThis.Number(scientific.slice(eIndex + 1)) - digits.length + 1];
|
|
5844
|
+
}
|
|
5722
5845
|
/**
|
|
5723
5846
|
* Creates an `Effect` that always succeeds with a given value.
|
|
5724
5847
|
*
|
|
@@ -11061,7 +11184,7 @@ function encodeNumberPayload(number) {
|
|
|
11061
11184
|
* @since 4.0.0
|
|
11062
11185
|
*/
|
|
11063
11186
|
const isGreaterThanOrEqualTo = /*#__PURE__*/ makeIsGreaterThanOrEqualTo({
|
|
11064
|
-
order: Number$
|
|
11187
|
+
order: Number$5,
|
|
11065
11188
|
annotate: (minimum) => ({
|
|
11066
11189
|
representation: {
|
|
11067
11190
|
id: "effect/schema/isGreaterThanOrEqualTo",
|
|
@@ -11094,7 +11217,7 @@ const isGreaterThanOrEqualTo = /*#__PURE__*/ makeIsGreaterThanOrEqualTo({
|
|
|
11094
11217
|
* @since 4.0.0
|
|
11095
11218
|
*/
|
|
11096
11219
|
const isBetween = /*#__PURE__*/ makeIsBetween({
|
|
11097
|
-
order: Number$
|
|
11220
|
+
order: Number$5,
|
|
11098
11221
|
annotate: (options) => {
|
|
11099
11222
|
const exclusiveMinimum = options.exclusiveMinimum ? true : void 0;
|
|
11100
11223
|
const exclusiveMaximum = options.exclusiveMaximum ? true : void 0;
|
|
@@ -11117,6 +11240,39 @@ const isBetween = /*#__PURE__*/ makeIsBetween({
|
|
|
11117
11240
|
}
|
|
11118
11241
|
});
|
|
11119
11242
|
/**
|
|
11243
|
+
* Validates that a number is a multiple of the specified divisor.
|
|
11244
|
+
*
|
|
11245
|
+
* **Details**
|
|
11246
|
+
*
|
|
11247
|
+
* JSON Schema:
|
|
11248
|
+
*
|
|
11249
|
+
* This check corresponds to the `multipleOf` constraint in JSON Schema.
|
|
11250
|
+
* Negative divisors are normalized to their absolute value because JSON
|
|
11251
|
+
* Schema requires `multipleOf` to be positive.
|
|
11252
|
+
*
|
|
11253
|
+
* **Gotchas**
|
|
11254
|
+
*
|
|
11255
|
+
* Throws a `RangeError` when `divisor` is zero or is not finite.
|
|
11256
|
+
*
|
|
11257
|
+
* @stability stable
|
|
11258
|
+
* @category validation
|
|
11259
|
+
* @since 4.0.0
|
|
11260
|
+
*/
|
|
11261
|
+
function isMultipleOf(divisor, annotations) {
|
|
11262
|
+
if (!globalThis.Number.isFinite(divisor) || divisor === 0) throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(divisor)}`);
|
|
11263
|
+
divisor = globalThis.Math.abs(divisor);
|
|
11264
|
+
return makeFilter((input) => remainder(input, divisor) === 0, {
|
|
11265
|
+
expected: `a value that is a multiple of ${divisor}`,
|
|
11266
|
+
representation: {
|
|
11267
|
+
id: "effect/schema/isMultipleOf",
|
|
11268
|
+
payload: { divisor }
|
|
11269
|
+
},
|
|
11270
|
+
toJsonSchema: () => ({ multipleOf: divisor }),
|
|
11271
|
+
toCode: () => ({ runtime: `Schema.isMultipleOf(${format$1(divisor)})` }),
|
|
11272
|
+
...annotations
|
|
11273
|
+
});
|
|
11274
|
+
}
|
|
11275
|
+
/**
|
|
11120
11276
|
* Validates that a number is a safe integer (within the safe integer range
|
|
11121
11277
|
* that can be exactly represented in JavaScript).
|
|
11122
11278
|
*
|
|
@@ -11174,6 +11330,45 @@ const Int = /*#__PURE__*/ Number$1.check(/*#__PURE__*/ isInt());
|
|
|
11174
11330
|
* @since 4.0.0
|
|
11175
11331
|
*/
|
|
11176
11332
|
const Natural = /*#__PURE__*/ Int.check(/*#__PURE__*/ isGreaterThanOrEqualTo(0));
|
|
11333
|
+
/**
|
|
11334
|
+
* Validates that a value has at least the specified length. Works with strings
|
|
11335
|
+
* and arrays.
|
|
11336
|
+
*
|
|
11337
|
+
* **Details**
|
|
11338
|
+
*
|
|
11339
|
+
* JSON Schema:
|
|
11340
|
+
*
|
|
11341
|
+
* The bound must be finite; it is rounded down and clamped to zero. For arrays,
|
|
11342
|
+
* this check corresponds to `minItems`. JavaScript counts UTF-16 code units
|
|
11343
|
+
* while JSON Schema counts Unicode code points, so strings use
|
|
11344
|
+
* `minLength: Math.ceil(minLength / 2)`, the tightest lower bound that cannot
|
|
11345
|
+
* reject a string accepted by this check.
|
|
11346
|
+
*
|
|
11347
|
+
* Arbitrary:
|
|
11348
|
+
*
|
|
11349
|
+
* During arbitrary generation, this applies a `minLength`
|
|
11350
|
+
* constraint to ensure generated strings or arrays have at least the required
|
|
11351
|
+
* length.
|
|
11352
|
+
*
|
|
11353
|
+
* **Example** (Checking minimum length)
|
|
11354
|
+
*
|
|
11355
|
+
* ```ts import.meta.vitest
|
|
11356
|
+
* import { Schema } from "effect"
|
|
11357
|
+
*
|
|
11358
|
+
* const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1))
|
|
11359
|
+
* const NonEmptyArraySchema = Schema.Array(Schema.Number).check(Schema.isMinLength(1))
|
|
11360
|
+
* Schema.is(NonEmptyStringSchema)("a") // => true
|
|
11361
|
+
* Schema.is(NonEmptyArraySchema)([1]) // => true
|
|
11362
|
+
* ```
|
|
11363
|
+
*
|
|
11364
|
+
* @stability stable
|
|
11365
|
+
* @category validation
|
|
11366
|
+
* @since 4.0.0
|
|
11367
|
+
*/
|
|
11368
|
+
function isMinLength(minLength, annotations) {
|
|
11369
|
+
minLength = normalizeCardinality(minLength);
|
|
11370
|
+
return makeIsMinLength(minLength, Math.ceil(minLength / 2), annotations);
|
|
11371
|
+
}
|
|
11177
11372
|
function makeIsMinLength(minLength, minCodePoints, annotations) {
|
|
11178
11373
|
return makeFilter((input) => input.length >= minLength, {
|
|
11179
11374
|
expected: `a value with a length of at least ${minLength}`,
|
|
@@ -11306,6 +11501,23 @@ function fromJsonString(schema, options) {
|
|
|
11306
11501
|
}
|
|
11307
11502
|
globalThis.File;
|
|
11308
11503
|
globalThis.URLSearchParams;
|
|
11504
|
+
/**
|
|
11505
|
+
* Schema that parses a string into a finite number.
|
|
11506
|
+
*
|
|
11507
|
+
* **Details**
|
|
11508
|
+
*
|
|
11509
|
+
* Decoding:
|
|
11510
|
+
* - A `string` is decoded as a finite number, rejecting `NaN`, `Infinity`, and
|
|
11511
|
+
* `-Infinity` values.
|
|
11512
|
+
*
|
|
11513
|
+
* Encoding:
|
|
11514
|
+
* - A finite number is encoded as a `string`.
|
|
11515
|
+
*
|
|
11516
|
+
* @stability stable
|
|
11517
|
+
* @category schemas
|
|
11518
|
+
* @since 4.0.0
|
|
11519
|
+
*/
|
|
11520
|
+
const FiniteFromString = /*#__PURE__*/ String$1.annotate({ expected: "a string that will be decoded as a finite number" }).pipe(/*#__PURE__*/ decodeTo(Finite, numberFromString));
|
|
11309
11521
|
globalThis.Uint8Array;
|
|
11310
11522
|
const immerable = /*#__PURE__*/ globalThis.Symbol.for("immer-draftable");
|
|
11311
11523
|
const payloadToken = {};
|
|
@@ -11470,4 +11682,4 @@ const Json = /*#__PURE__*/ make(/*#__PURE__*/ annotate(Json$1, { toCode: () => (
|
|
|
11470
11682
|
runtime: "Schema.Json",
|
|
11471
11683
|
Type: "Schema.Json"
|
|
11472
11684
|
}) }));
|
|
11473
|
-
export {
|
|
11685
|
+
export { isString$1 as $, isUUID as A, getSuccess as B, is as C, isMaxLength as D, isGreaterThanOrEqualTo as E, makeFormatterStandardSchemaV1 as F, getOrElse as G, isSuccess$1 as H, TaggedError as I, liftThrowable as J, getOrUndefined as K, millis as L, optional as M, optionalKey as N, isMinLength as O, tag as P, isPropertyKey as Q, seconds as R, fromJsonString as S, isBetween as T, try_$2 as U, isFailure as V, flatMap$3 as W, none as X, map$5 as Y, hasProperty as Z, Union as _, FiniteFromString as a, decodeUnknownResult as b, Literal as c, NonEmptyArray as d, NonEmptyString as f, Struct as g, String$1 as h, Finite as i, makeFilter as j, isMultipleOf as k, Literals as l, Record as m, Boolean$1 as n, Int as o, NullOr as p, isNone as q, Error$1 as r, Json as s, ArraySchema as t, Natural as u, decodeTo as v, isBase64Url as w, decodeUnknownSync as x, decodeUnknownOption as y, toMillis as z };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { n as SANDCOVERY_ORIGIN } from "../origin-
|
|
4
|
-
import { A as
|
|
2
|
+
import { $ as isString, H as isSuccess, K as getOrUndefined, M as optional, S as fromJsonString, U as try_, V as isFailure, Z as hasProperty, g as Struct, h as String$1, m as Record, n as Boolean, s as Json, x as decodeUnknownSync, y as decodeUnknownOption } from "../Schema-CFI3ZMu8.mjs";
|
|
3
|
+
import { n as SANDCOVERY_ORIGIN } from "../origin-BTx2gX8x.mjs";
|
|
4
|
+
import { A as isUpper, C as escapeUnprintable, D as consistsOf, E as remoteText, F as usageFailure, I as Canceled, M as CliFailure, N as exitCodeOf, O as isDigit, P as statusOf$1, S as theme, T as remoteLine, _ as clearLine, a as configDirectory, b as plainPrefix, c as flagOf, d as lastValue, f as parseFailure, h as rerunArgv, i as version, j as isWordCharacter, l as isOptionToken, m as readOptionToken, o as writePrivateFile, p as parseLeaf, r as CLI, s as closest, t as BIN, u as isOptionValue, v as ellipsis, w as remoteCell, x as spinnerFrame, y as glyph } from "../spec-B4c-Ug3B.mjs";
|
|
5
5
|
import { n as sendTelemetry$1, t as loopbackOrigin } from "../telemetry-BYnuVdoZ.mjs";
|
|
6
|
-
import "../posthog-project-
|
|
6
|
+
import "../posthog-project-CdWw_ofg.mjs";
|
|
7
7
|
import http from "node:http";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { buffer } from "node:stream/consumers";
|
|
11
11
|
import readline from "node:readline";
|
|
12
|
-
import crypto from "node:crypto";
|
|
13
|
-
import os from "node:os";
|
|
14
12
|
// ../cli-core/src/layout.ts
|
|
15
13
|
const combining = /\p{M}/u;
|
|
16
14
|
const pictographic = /\p{Extended_Pictographic}/u;
|
|
@@ -552,7 +550,7 @@ const takeOption = (walk, argv, token) => {
|
|
|
552
550
|
return;
|
|
553
551
|
}
|
|
554
552
|
const next = argv[walk.index];
|
|
555
|
-
if (read.option.kind === "value" && read.explicit === null && next !== void 0 &&
|
|
553
|
+
if (read.option.kind === "value" && read.explicit === null && next !== void 0 && isOptionValue(next)) {
|
|
556
554
|
walk.tokens.push(next);
|
|
557
555
|
walk.index += 1;
|
|
558
556
|
}
|
|
@@ -613,8 +611,9 @@ const route = ({ argv, cli, surface }) => {
|
|
|
613
611
|
};
|
|
614
612
|
while (walk.index < argv.length) {
|
|
615
613
|
const token = argv[walk.index] ?? "";
|
|
616
|
-
|
|
617
|
-
|
|
614
|
+
const passthrough = walk.node.kind === "leaf" && walk.node.passthrough === true;
|
|
615
|
+
if (passthrough || token === "--") {
|
|
616
|
+
walk.tokens.push(...passthrough ? ["--"] : [], ...argv.slice(walk.index));
|
|
618
617
|
break;
|
|
619
618
|
}
|
|
620
619
|
if (isOptionToken(token)) takeOption(walk, argv, token);
|
|
@@ -1106,24 +1105,6 @@ const terminalPrompter = {
|
|
|
1106
1105
|
},
|
|
1107
1106
|
text: async (question) => await ask(question)
|
|
1108
1107
|
};
|
|
1109
|
-
millis(50);
|
|
1110
|
-
toMillis(seconds(90));
|
|
1111
|
-
seconds(20);
|
|
1112
|
-
TaggedError("LockHeld");
|
|
1113
|
-
const configDirectory = ({ bin, cwd, override }) => override === void 0 ? path.join(os.homedir(), ".config", bin) : path.resolve(cwd ?? process.cwd(), override);
|
|
1114
|
-
const writePrivateFile = ({ file, text }) => {
|
|
1115
|
-
const directory = path.dirname(file);
|
|
1116
|
-
fs.mkdirSync(directory, {
|
|
1117
|
-
mode: 448,
|
|
1118
|
-
recursive: true
|
|
1119
|
-
});
|
|
1120
|
-
const pending = path.join(directory, `.${path.basename(file)}.${crypto.randomBytes(8).toString("hex")}.tmp`);
|
|
1121
|
-
fs.writeFileSync(pending, text, {
|
|
1122
|
-
flag: "wx",
|
|
1123
|
-
mode: 384
|
|
1124
|
-
});
|
|
1125
|
-
fs.renameSync(pending, file);
|
|
1126
|
-
};
|
|
1127
1108
|
// ../cli-core/src/telemetry-settings.ts
|
|
1128
1109
|
const telemetrySettingsSchema = Struct({
|
|
1129
1110
|
disclosed: optional(Boolean),
|
|
@@ -1456,7 +1437,7 @@ const runCommand = async ({ invocation, session }) => {
|
|
|
1456
1437
|
try {
|
|
1457
1438
|
const local = LOCAL_COMMANDS.get(key);
|
|
1458
1439
|
if (local !== void 0) return local(context);
|
|
1459
|
-
const { HANDLERS } = await import("../handlers-
|
|
1440
|
+
const { HANDLERS } = await import("../handlers-BS1KuMqq.mjs");
|
|
1460
1441
|
const handler = HANDLERS.get(key);
|
|
1461
1442
|
if (handler === void 0) throw internalFailure(invocation.path);
|
|
1462
1443
|
return await handler(context);
|
|
@@ -1699,7 +1680,7 @@ if (event === void 0) {
|
|
|
1699
1680
|
signal: controller.signal
|
|
1700
1681
|
});
|
|
1701
1682
|
} else {
|
|
1702
|
-
const [{ deliverTelemetry }, project] = await Promise.all([import("../telemetry-delivery-
|
|
1683
|
+
const [{ deliverTelemetry }, project] = await Promise.all([import("../telemetry-delivery-Yd6CeynR.mjs"), import("../posthog-project-BpOd2VxW.mjs")]);
|
|
1703
1684
|
await deliverTelemetry({
|
|
1704
1685
|
host: process.env.__SANDCOVERY_POSTHOG_HOST,
|
|
1705
1686
|
productionHost: project.POSTHOG_INGEST_HOST,
|