sandcovery 0.6.2 → 0.9.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 +45 -29
- package/dist/cli/index.mjs +14826 -2
- package/dist/cli/sandcovery-docker.mjs +8552 -4
- package/dist/cli/sandcovery-kubectl.mjs +9 -4
- package/dist/cli/sandcovery-t3.d.mts +1 -0
- package/dist/cli/sandcovery-t3.mjs +223 -0
- package/dist/index.d.mts +8737 -142
- package/dist/index.mjs +1 -1
- package/dist/kubectl-Ck04daor.mjs +472 -0
- package/dist/saved-sandboxes-BMjkAVGx.mjs +389 -0
- package/dist/src-DjOLw-ft.mjs +36591 -0
- package/dist/sync-rEFjHNC4.mjs +4171 -0
- package/dist/third-party-licenses.md +630 -0
- package/dist/types-DotsDqXt.d.mts +1264 -0
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs +6 -1
- package/package.json +13 -10
- package/dist/Schema-CoX0a2_o.mjs +0 -18812
- package/dist/handlers-CpLa3dvg.mjs +0 -19715
- package/dist/port-forwarder-DvSPr-Tg.mjs +0 -5360
- package/dist/posthog-project-BpOd2VxW.mjs +0 -1
- package/dist/posthog-project-CdWw_ofg.mjs +0 -22
- package/dist/src-BqfeIyqj.mjs +0 -2047
- package/dist/start-D1LPu-aN.mjs +0 -1604
- package/dist/telemetry-DBPKT8Ap.mjs +0 -43
- package/dist/telemetry-delivery-BSGibWPJ.mjs +0 -8712
- package/dist/types-C4amb2QE.d.mts +0 -793
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ TypeScript client for the [Sandcovery API](https://www.sandcovery.com): one API
|
|
|
12
12
|
npm install sandcovery
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Node.js 24 or later. The package has no runtime dependencies.
|
|
15
|
+
Node.js 24.14 or later. The package has no runtime dependencies.
|
|
16
16
|
|
|
17
17
|
## Quick start
|
|
18
18
|
|
|
@@ -24,16 +24,35 @@ import { Sandcovery } from 'sandcovery'
|
|
|
24
24
|
const sandcovery = new Sandcovery()
|
|
25
25
|
|
|
26
26
|
const sandbox = await sandcovery.sandboxes.create({
|
|
27
|
+
api_key_id: null,
|
|
28
|
+
disk_mib: null,
|
|
29
|
+
egress: null,
|
|
30
|
+
env: null,
|
|
31
|
+
gpu: null,
|
|
32
|
+
idle_timeout_seconds: null,
|
|
33
|
+
image: null,
|
|
34
|
+
os: null,
|
|
35
|
+
ports: null,
|
|
36
|
+
provider: null,
|
|
37
|
+
region: null,
|
|
27
38
|
slug: 'sandcovery/2x4:cheapest',
|
|
39
|
+
slugs: null,
|
|
40
|
+
snapshot_id: null,
|
|
28
41
|
ttl_seconds: 600,
|
|
29
42
|
})
|
|
30
43
|
|
|
31
44
|
const { exit_code, stdout } = await sandcovery.sandboxes.exec(sandbox.id, {
|
|
32
45
|
command: 'node --version',
|
|
46
|
+
cwd: null,
|
|
47
|
+
env: null,
|
|
48
|
+
timeout_seconds: null,
|
|
33
49
|
})
|
|
34
50
|
|
|
35
51
|
for await (const event of sandcovery.sandboxes.execStream(sandbox.id, {
|
|
36
52
|
command: 'npm test',
|
|
53
|
+
cwd: null,
|
|
54
|
+
env: null,
|
|
55
|
+
timeout_seconds: null,
|
|
37
56
|
})) {
|
|
38
57
|
if (event.type === 'stdout') {
|
|
39
58
|
process.stdout.write(event.data)
|
|
@@ -47,36 +66,33 @@ Sandcovery destroys every sandbox at its `ttl_seconds`, even when your process e
|
|
|
47
66
|
|
|
48
67
|
## Command line
|
|
49
68
|
|
|
50
|
-
The package also installs the `sandcovery` command,
|
|
69
|
+
The package also installs the `sandcovery` command. Each operation in the [OpenAPI document](https://www.sandcovery.com/openapi.json) is one command, `sandcovery <group> <operation>`, named as the document names it, and each of its parameters and body fields is a flag of the same name.
|
|
51
70
|
|
|
52
71
|
```sh
|
|
53
72
|
npm install --global sandcovery
|
|
54
|
-
|
|
55
|
-
export SANDCOVERY_API_KEY=sand_...
|
|
73
|
+
export SANDCOVERY_API_KEY=ak_...
|
|
56
74
|
|
|
57
|
-
id=$(sandcovery sandboxes
|
|
58
|
-
sandcovery sandboxes
|
|
59
|
-
sandcovery sandboxes
|
|
75
|
+
id=$(sandcovery sandboxes createSandbox --slug sandcovery/2x4:cheapest --ttl_seconds 600 | jq -r .id)
|
|
76
|
+
sandcovery sandboxes execSandbox --sandbox_id "$id" --command 'npm test'
|
|
77
|
+
sandcovery sandboxes destroySandbox --sandbox_id "$id"
|
|
60
78
|
```
|
|
61
79
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
- `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- `sandcovery
|
|
72
|
-
- `sandcovery
|
|
73
|
-
- `sandcovery
|
|
74
|
-
- `sandcovery help search <words>` finds a command, and `--help` works on every command.
|
|
75
|
-
- 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.
|
|
80
|
+
- A command prints the API's answer body on stdout. An error answer goes to stderr as the API sent it, and the command exits 1.
|
|
81
|
+
- It sends `SANDCOVERY_API_KEY` as the key, and calls `SANDCOVERY_BASE_URL` when it is set, or https://www.sandcovery.com.
|
|
82
|
+
- A flag for a field that is not text, such as a number, a list, or an object, takes JSON. An operation whose body is a file, such as `sandboxes uploadFile`, reads that body from stdin.
|
|
83
|
+
- `--help` works on every command.
|
|
84
|
+
|
|
85
|
+
## Docker, kubectl, and T3 Code
|
|
86
|
+
|
|
87
|
+
The package installs three more commands that run your tools on sandboxes through this client. Each reads the key from `SANDCOVERY_API_KEY` and the API origin from `SANDCOVERY_BASE_URL`, keeps its state in `~/.config/sandcovery`, and passes an API error through unchanged.
|
|
88
|
+
|
|
89
|
+
- `sandcovery-docker <args>` runs `docker <args>` in a sandbox on a provider that runs Docker, streams its output, adds nothing to Docker's stdout or stderr, and exits with its exit code, so `alias docker=sandcovery-docker` lets a computer with no Docker build and run containers. Later commands reuse that sandbox until its TTL ends. Before Docker runs, it copies the local files the command reads into the sandbox at the same absolute paths, up to 100 MiB packed, and runs Docker in the same working directory there: build contexts without what `.dockerignore` leaves out, bind mount sources, env files, the files `cp`, `load -i`, and `import` read, and a Compose project's files, build contexts, and bind mounts. It copies only paths under your home folder or the working directory. When stdin is not a terminal and Docker reads it, as with `login --password-stdin` or `load`, it hands stdin to Docker, and when stdout is not a terminal and Docker writes an archive there, as with `save`, the archive arrives byte for byte. Docker gets a terminal wherever yours is one, so `docker run -it`, `docker exec -it`, and `docker attach` work, and a command runs until it exits. The variables Docker reads come from your computer's environment, such as a name given to `-e` with no value, `DOCKER_DEFAULT_PLATFORM`, and the shell variables a Compose file names, and the command sends the sandbox only those. A TCP port a container publishes answers on the same address and port of your computer.
|
|
90
|
+
- `sandcovery-kubectl <args>` runs your own `kubectl <args>` against a one-node Kubernetes cluster in a sandbox on Freestyle, or on boxd when Freestyle cannot create it, adds nothing to `kubectl`'s stdout or stderr, and exits with its exit code, so `alias kubectl=sandcovery-kubectl` runs `kubectl` on the sandbox's cluster. The first command that reaches the cluster starts it, which takes a few minutes, and later commands reuse it. It stops 15 minutes after the last command that reached it ends, or at its TTL, whichever comes first, and a command that keeps running, such as `port-forward` or `logs -f`, keeps it running. `kubectl` must be on `PATH` and runs on your computer, so local files, `port-forward`, `exec -it`, and `logs -f` work as they do with a local cluster. `completion`, `config`, `version --client`, and `--help` start no cluster.
|
|
91
|
+
- `sandcovery-t3` creates a sandbox with port 3773, installs the same version of T3 Code there as your local `t3`, and links it to your T3 Code as an environment with `t3 environment link`, so an agent in T3 Code can delegate work to that sandbox. `--access` sets what agents on your computer may do there, each `--env NAME=value` reaches only T3 Code and the agents it runs, `--provider` names a provider to use, and `--ttl` sets the sandbox's TTL in seconds. It prints the sandbox's ID, and destroys the sandbox when any step fails.
|
|
76
92
|
|
|
77
93
|
## Routing
|
|
78
94
|
|
|
79
|
-
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
|
|
95
|
+
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 hourly price, and a provider that charges by the month has no per-use price to compare, so `:cheapest` never picks one. 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`.
|
|
80
96
|
|
|
81
97
|
`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.
|
|
82
98
|
|
|
@@ -89,25 +105,25 @@ Provider, region, and slug names are open strings, so a name the API adds later
|
|
|
89
105
|
```ts
|
|
90
106
|
const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
|
|
91
107
|
|
|
92
|
-
await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY })
|
|
108
|
+
await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY ?? '' })
|
|
93
109
|
```
|
|
94
110
|
|
|
95
|
-
|
|
111
|
+
On Pro or the Enterprise plan, an organization holds as many credentials per provider as it needs: `credentials.add(provider, fields)` adds another, a create tries a provider's credentials in the order they were added, and `credentials.deleteOne(provider, id)` deletes one. A Free organization routes one of its own keys per provider, so adding a second key of the same provider receives 403. When an organization leaves Pro or the Enterprise plan, it keeps every key, routes the oldest key of each provider, and `paused` is `true` on the others until it is on Pro or the Enterprise plan again.
|
|
96
112
|
|
|
97
|
-
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
|
|
113
|
+
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 vCPUh your keys have earned, `credentials.countXPost()` finds your newest post on X of the last day that tags @Sandcovery and counts it as one key, reading X at most 10 times a UTC day and 30 seconds apart for an organization and otherwise answering `retry_later` with `retry_at`, `billing.get()` reads the plan, the credit balance, and auto top-up, `billing.buyCredits({ amount_micro_usd })` answers the Stripe Checkout page that takes a credit payment, `billing.setAutoTopUp({ amount_micro_usd, threshold_micro_usd })` sets the amount Sandcovery charges the saved card each time the credit balance falls below the threshold and answers the Stripe Checkout page that saves a card when none is saved, and `billing.stopAutoTopUp()` turns auto top-up off.
|
|
98
114
|
|
|
99
115
|
## X account
|
|
100
116
|
|
|
101
|
-
`xAccount.get()` reads the X account linked to you and whether Sandcovery links X accounts now, `xAccount.link()` answers the dashboard page where you link one, since X confirms the link in the browser, and `xAccount.unlink()` unlinks it and deletes its ID, handle, and X token. An X account belongs to a person, so these need a management key, which acts for the owner who minted it
|
|
117
|
+
`xAccount.get()` reads the X account linked to you and whether Sandcovery links X accounts now, `xAccount.link()` answers the dashboard page where you link one, since X confirms the link in the browser, and `xAccount.unlink()` unlinks it and deletes its ID, handle, and X token. An X account belongs to a person, so these need a management key, which acts for the owner who minted it. An API key receives 403 there.
|
|
102
118
|
|
|
103
119
|
## Interfaces
|
|
104
120
|
|
|
105
|
-
This client, the `sandcovery` command
|
|
121
|
+
This client, the Python client, and the `sandcovery` command cover the product operations they expose. Health, usable keys, credential field choices, CLI sign-in, and agents live on the HTTP API and the CLI.
|
|
106
122
|
|
|
107
123
|
## Errors
|
|
108
124
|
|
|
109
|
-
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`.
|
|
125
|
+
A failed call throws an `Error` with the API's `message` and, as its `cause`, 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`.
|
|
110
126
|
|
|
111
127
|
## Reference
|
|
112
128
|
|
|
113
|
-
The API reference and the OpenAPI document are at https://www.sandcovery.com/docs.
|
|
129
|
+
The API reference and the OpenAPI document are at https://www.sandcovery.com/docs/api.
|