sandcovery 0.1.0 → 0.2.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/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/Schema-C4ay0Aif.mjs +11473 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +1710 -0
- package/dist/handlers-BxhSLDGk.mjs +2217 -0
- package/dist/index.d.mts +76 -1
- package/dist/index.mjs +1 -5
- package/dist/origin-Dj-n4EQa.mjs +356 -0
- package/dist/posthog-project-B0jmQTwy.mjs +1 -0
- package/dist/posthog-project-Bb0IFKUv.mjs +20 -0
- package/dist/spec-ClAX0dAN.mjs +1910 -0
- package/dist/src-D3WZodpF.mjs +572 -0
- package/dist/telemetry-BYnuVdoZ.mjs +43 -0
- package/dist/telemetry-delivery-1a7C-8DK.mjs +8712 -0
- package/dist/types-Dxh7amZB.d.mts +345 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +51 -0
- package/package.json +46 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Starcovery LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://www.sandcovery.com/logo.svg" alt="Sandcovery" width="96" height="96">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Sandcovery
|
|
6
|
+
|
|
7
|
+
TypeScript client for the [Sandcovery API](https://www.sandcovery.com): one API and one key for ephemeral sandboxes across E2B, Daytona, Vercel Sandbox, and Depot, running on your own provider accounts.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install sandcovery
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Node.js 24 or later. The package has no runtime dependencies.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
Create an API key and add your provider credentials in the dashboard at https://www.sandcovery.com/app, then set `SANDCOVERY_API_KEY`.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Sandcovery } from 'sandcovery'
|
|
23
|
+
|
|
24
|
+
const sandcovery = new Sandcovery()
|
|
25
|
+
|
|
26
|
+
const sandbox = await sandcovery.sandboxes.create({
|
|
27
|
+
size: '2x4:cheapest',
|
|
28
|
+
ttl_seconds: 600,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const { exit_code, stdout } = await sandcovery.sandboxes.exec(sandbox.id, {
|
|
32
|
+
command: 'node --version',
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
for await (const event of sandcovery.sandboxes.execStream(sandbox.id, {
|
|
36
|
+
command: 'npm test',
|
|
37
|
+
})) {
|
|
38
|
+
if (event.type === 'stdout') {
|
|
39
|
+
process.stdout.write(event.data)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await sandcovery.sandboxes.destroy(sandbox.id)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Sandcovery destroys every sandbox at its `ttl_seconds`, even when your process exits first.
|
|
47
|
+
|
|
48
|
+
## Command line
|
|
49
|
+
|
|
50
|
+
The package also installs the `sandcovery` command, which calls the API through this client.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
npm install --global sandcovery
|
|
54
|
+
export SANDCOVERY_API_KEY=sand_...
|
|
55
|
+
|
|
56
|
+
id=$(sandcovery sandboxes create --size 2x4:cheapest --ttl 600)
|
|
57
|
+
sandcovery sandboxes exec "$id" -- npm test
|
|
58
|
+
sandcovery sandboxes destroy "$id" --yes
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `sandcovery sandboxes exec` streams the command's output and exits with the command's exit code.
|
|
62
|
+
- `--json` prints one JSON document on stdout, and every failure prints a JSON error with a stable `reason` on stderr.
|
|
63
|
+
- `sandboxes destroy`, `keys revoke`, and `credentials delete` ask first, and need `--yes` without a terminal.
|
|
64
|
+
- `sandcovery help search <words>` finds a command, and `--help` works on every command.
|
|
65
|
+
- 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
|
+
|
|
67
|
+
## Routing
|
|
68
|
+
|
|
69
|
+
A size name such as `2x4` (2 vCPU, 4 GiB) picks the provider by default routing. Add `:cheapest`, `:fastest`, or `:most-reliable` to sort candidates by list price, measured create latency, or uptime over the last 15 minutes. `provider` takes `order`, `only`, `ignore`, `sort`, and `allow_fallbacks`. Every create attempt is listed in `sandbox.attempts`.
|
|
70
|
+
|
|
71
|
+
Provider, region, and size 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`, `SIZE_NAMES`, and `EGRESS_MODES`.
|
|
72
|
+
|
|
73
|
+
## Keys and provider credentials
|
|
74
|
+
|
|
75
|
+
`keys`, `credentials`, and `usage` need a management key, which an organization owner or admin mints in the dashboard. An API key receives 403 there.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
|
|
79
|
+
|
|
80
|
+
await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY })
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The fields each provider takes are its `credential_fields` on `sandcovery.providers.get(provider)`.
|
|
84
|
+
|
|
85
|
+
## Errors
|
|
86
|
+
|
|
87
|
+
A failed call throws the API error it received, with its `error` code, such as `unsupported`, `no_provider_available` (with every attempt in `attempts`), `provider_error` (with the provider in `provider`), or `spend_limit_reached`. Types of every request and answer are exported from `sandcovery/types`.
|
|
88
|
+
|
|
89
|
+
## Reference
|
|
90
|
+
|
|
91
|
+
The API reference and the OpenAPI document are at https://www.sandcovery.com/docs.
|