sandcovery 0.3.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 +14 -5
- package/dist/{Schema-DiSfJzMf.mjs → Schema-fLas6rbA.mjs} +8069 -930
- package/dist/cli/index.mjs +2 -1707
- 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 +23 -1
- package/dist/index.mjs +1 -1
- package/dist/{origin-CIA-1Jia.mjs → origin-5maEGWRg.mjs} +105 -74
- package/dist/{spec-DfgmzDj-.mjs → spec-cGDeWJ3v.mjs} +951 -122
- package/dist/{src-YrynO3hz.mjs → src-zWk1RjrB.mjs} +241 -23
- package/dist/start-B8ruSPVb.mjs +1992 -0
- package/dist/{telemetry-delivery-zinKRHRc.mjs → telemetry-delivery-8t5RXWli.mjs} +3 -3
- package/dist/{types-DMB8KnA3.d.mts → types-ZqbGCXKy.d.mts} +153 -12
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs +18 -18
- package/package.json +17 -13
- package/dist/handlers-rkx0CsMY.mjs +0 -2459
package/README.md
CHANGED
|
@@ -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
|
|
|
@@ -51,25 +51,32 @@ The package also installs the `sandcovery` command, which calls the API through
|
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
npm install --global sandcovery
|
|
54
|
+
sandcovery setup
|
|
54
55
|
export SANDCOVERY_API_KEY=sand_...
|
|
55
56
|
|
|
56
|
-
id=$(sandcovery sandboxes create --
|
|
57
|
+
id=$(sandcovery sandboxes create --slug sandcovery/2x4:cheapest --ttl 600)
|
|
57
58
|
sandcovery sandboxes exec "$id" -- npm test
|
|
58
59
|
sandcovery sandboxes destroy "$id" --yes
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
- `sandcovery setup` writes a shim for each drop-in the package installs, such as `docker` for `sandcovery-docker` and `kubectl` for `sandcovery-kubectl`, into `~/.config/sandcovery/bin`, and adds one line that puts that folder first on `PATH` to the bash, zsh, and fish startup files, so those commands run on sandboxes in each new terminal. It lists every change and asks first, and needs `--yes` without a terminal. Each line it adds ends in `# added by sandcovery setup`, `sandcovery setup --undo` removes those lines and the shims and nothing else, and your own `docker` or `kubectl` still runs by its full path.
|
|
63
|
+
- `sandcovery login` shows a URL and a code to approve in a browser signed in to Sandcovery, then saves a login, readable only by you, that commands send when neither `--token` nor `SANDCOVERY_API_KEY` is set. `sandcovery logout` revokes it and deletes it.
|
|
61
64
|
- `sandcovery sandboxes exec` streams the command's output and exits with the command's exit code.
|
|
65
|
+
- `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`, and `image build` first copy the working directory into it, up to 100 MiB packed. `compose` first copies the Compose project instead: its Compose files and env files, each build context without what `.dockerignore` leaves out, and each bind-mounted file or directory, while `ps`, `logs`, `down`, and other commands that only read the project copy only the Compose files and env files. 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. It gets no terminal, so `docker run -it` does not work.
|
|
66
|
+
- `sandcovery-docker <args>` does the same in the same sandbox, takes Docker's arguments alone, and adds nothing to Docker's stdout or stderr, so `alias docker=sandcovery-docker` runs `docker` in the sandbox. It reads the key from `SANDCOVERY_API_KEY` or the saved login. Apart from the files `compose` copies, paths in its arguments and Docker's environment variables are read in the sandbox, and a port a container publishes is reachable only inside the sandbox.
|
|
62
67
|
- `--json` prints one JSON document on stdout, and every failure prints a JSON error with a stable `reason` on stderr.
|
|
63
68
|
- `sandboxes destroy`, `keys revoke`, and `credentials delete` ask first, and need `--yes` without a terminal.
|
|
64
|
-
- `sandcovery providers list --routed` lists only the providers Sandcovery routes to, `sandcovery credentials offer` shows the free vCPU-hours your keys have earned, and `sandcovery billing inspect` and `sandcovery billing buy-credits --amount <USD>` show the plan and start a credit payment.
|
|
69
|
+
- `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.
|
|
65
70
|
- `sandcovery help search <words>` finds a command, and `--help` works on every command.
|
|
66
71
|
- 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.
|
|
67
72
|
|
|
68
73
|
## Routing
|
|
69
74
|
|
|
70
|
-
A size
|
|
75
|
+
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`.
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
`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.
|
|
78
|
+
|
|
79
|
+
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`.
|
|
73
80
|
|
|
74
81
|
## Keys and provider credentials
|
|
75
82
|
|
|
@@ -81,6 +88,8 @@ const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
|
|
|
81
88
|
await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY })
|
|
82
89
|
```
|
|
83
90
|
|
|
91
|
+
An organization holds as many credentials 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 only its oldest credential, and `paused` is `true` on each other one until it has Pro.
|
|
92
|
+
|
|
84
93
|
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.
|
|
85
94
|
|
|
86
95
|
## Interfaces
|