@veris-ai/daytona 0.3.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 +36 -151
- package/dist/gateway.d.ts +6 -0
- package/dist/index.cjs +54 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +49 -42
- package/dist/index.js.map +1 -1
- package/dist/trust.d.ts +38 -0
- package/package.json +1 -4
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -2099
- package/dist/cli.js.map +0 -1
- package/dist/exec.d.ts +0 -15
- package/dist/provision.d.ts +0 -100
- package/dist/push.d.ts +0 -11
- package/dist/run.d.ts +0 -87
- package/dist/teardown.d.ts +0 -52
package/README.md
CHANGED
|
@@ -45,148 +45,6 @@ await sbx.delete() // deletes the twin too
|
|
|
45
45
|
This package re-exports everything from `@daytona/sdk`, so it is the only import
|
|
46
46
|
you need to change. No particular sandbox image is required.
|
|
47
47
|
|
|
48
|
-
### Or skip the code: `veris-daytona run`
|
|
49
|
-
|
|
50
|
-
The same four steps as one command, for a test suite that already exists:
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
npx @veris-ai/daytona run --setup 'pip install -e .' -- pytest tests/integration
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
That uploads the current directory into a fresh sandbox (minus `node_modules`,
|
|
57
|
-
`.venv`, `.git` and the like), runs the setup command, runs the test command
|
|
58
|
-
streaming its output, prints the receipt, and deletes the sandbox and the twin.
|
|
59
|
-
The exit code is the test command's — except that a green suite whose twin
|
|
60
|
-
received nothing exits 1, because a pass without a receipt is not a pass.
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
Veris receipt — twin sbx_a1b2c3
|
|
64
|
-
interception: gateway integrity: verified
|
|
65
|
-
|
|
66
|
-
1 request(s) reached the twin:
|
|
67
|
-
stripe: 1 request(s)
|
|
68
|
-
POST /v1/customers -> 200
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
| flag | |
|
|
72
|
-
|---|---|
|
|
73
|
-
| `--repo <url> [--ref <branch>]` | clone instead of uploading; `GITHUB_TOKEN` is used for a private repo |
|
|
74
|
-
| `--environment <id>` | instead of `VERIS_ENVIRONMENT_ID` |
|
|
75
|
-
| `--require-service <name>` | the receipt must show this service, repeatable |
|
|
76
|
-
| `--image <name>` / `--snapshot <name>` | what to run in; default is Daytona's default snapshot |
|
|
77
|
-
| `--env KEY=VALUE` | exported to both commands, repeatable |
|
|
78
|
-
| `--timeout <seconds>` | for the test command; default 1800 |
|
|
79
|
-
| `--keep` | leave the sandbox up afterwards, and the twin if `run` made it |
|
|
80
|
-
|
|
81
|
-
`veris-daytona run --help` lists everything.
|
|
82
|
-
|
|
83
|
-
### Or hand the wired box to something else: `provision`, `push`, `exec`, `teardown`
|
|
84
|
-
|
|
85
|
-
`run` does the whole job in one command, and it stays. But when the thing that
|
|
86
|
-
installs the dependencies and runs the suite is another tool — the `veris` CLI,
|
|
87
|
-
a CI step, an agent — what you want from this package is the first half only:
|
|
88
|
-
|
|
89
|
-
```sh
|
|
90
|
-
box=$(npx @veris-ai/daytona provision --sandbox sbx_a1b2c3 --image python:3.12)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
That creates a sandbox attached to a twin you already have, does every
|
|
94
|
-
Veris-shaped thing — the egress credential, the gateway pin, the outbound
|
|
95
|
-
proxy, the CA bundle, the canary, the trust variables — and
|
|
96
|
-
stops. Nothing is uploaded, nothing is run, nothing is deleted. One JSON object
|
|
97
|
-
goes to stdout and every human line to stderr, so `$box` is parseable:
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"daytonaSandboxId": "e2a1…",
|
|
102
|
-
"verisSandboxId": "sbx_a1b2c3",
|
|
103
|
-
"verisEnvironmentId": "env_9f…",
|
|
104
|
-
"ownsTwin": false,
|
|
105
|
-
"workDir": "/home/daytona/veris-run",
|
|
106
|
-
"caBundlePath": "/tmp/veris-ca-bundle.crt",
|
|
107
|
-
"trustEnv": { "SSL_CERT_FILE": "/tmp/veris-ca-bundle.crt", "…": "…" },
|
|
108
|
-
"trustPrelude": "export SSL_CERT_FILE='/tmp/veris-ca-bundle.crt'; …",
|
|
109
|
-
"patchBundledCasCommand": "sh /tmp/veris-patch-bundled-cas.sh",
|
|
110
|
-
"pushCommand": "veris-daytona push e2a1…",
|
|
111
|
-
"execCommand": "veris-daytona exec e2a1… -- <command>",
|
|
112
|
-
"services": ["stripe", "github"],
|
|
113
|
-
"expiresAt": "2026-09-04T12:00:00.000Z",
|
|
114
|
-
"autoStopMinutes": 30,
|
|
115
|
-
"autoDeleteMinutes": 60
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
| flag | |
|
|
120
|
-
|---|---|
|
|
121
|
-
| `--sandbox <twin-id>` | the twin to attach to — **required**; `veris up` prints its id |
|
|
122
|
-
| `--image <name>` / `--snapshot <name>` | what to run in; default is Daytona's default snapshot |
|
|
123
|
-
| `--env KEY=VALUE` | set as a sandbox environment variable, repeatable |
|
|
124
|
-
|
|
125
|
-
From there the box is yours. Reading the receipt and deciding what it proved is
|
|
126
|
-
the caller's job; that is the whole point of the split.
|
|
127
|
-
|
|
128
|
-
### Getting code in and running it: `push` and `exec`
|
|
129
|
-
|
|
130
|
-
Daytona has no route into a box that already exists. Their CLI (v0.210.0) has no
|
|
131
|
-
upload, copy or sync command; `daytona ssh` takes exactly one argument, so there
|
|
132
|
-
is no `tar | ssh` and no scp or rsync behind it; `--context` is a Docker build
|
|
133
|
-
context that only exists on `create`, which `provision` owns; and `git clone`
|
|
134
|
-
inside the box is a clone, not an upload of what is on your disk. So two verbs
|
|
135
|
-
do it:
|
|
136
|
-
|
|
137
|
-
```sh
|
|
138
|
-
id=$(echo "$box" | jq -r .daytonaSandboxId)
|
|
139
|
-
|
|
140
|
-
npx @veris-ai/daytona push "$id" # tars the cwd into workDir
|
|
141
|
-
npx @veris-ai/daytona exec "$id" -- pip install -e .
|
|
142
|
-
npx @veris-ai/daytona exec "$id" -- sh /tmp/veris-patch-bundled-cas.sh
|
|
143
|
-
npx @veris-ai/daytona exec "$id" -- python -m pytest tests/integration
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
`push` uploads the current directory, minus what gets rebuilt inside
|
|
147
|
-
(`node_modules`, `.venv`, `dist`, `__pycache__`, …), and unpacks it in the same
|
|
148
|
-
`workDir` the JSON named — so the two chain without carrying the path between
|
|
149
|
-
them. `--repo <url> --ref <branch>` clones instead, using `GITHUB_TOKEN` for a
|
|
150
|
-
private one.
|
|
151
|
-
|
|
152
|
-
`exec` runs one command with `trustEnv` already exported, which is the part that
|
|
153
|
-
matters: `daytona exec` has no `--env` flag at all, so a command run through it
|
|
154
|
-
inherits Daytona's own CA file and fails on the gateway's certificate unless you
|
|
155
|
-
retype the trust prelude every single time. It streams output as it happens
|
|
156
|
-
rather than returning at the end, takes `--cwd`, repeatable `--env KEY=VALUE`
|
|
157
|
-
and `--timeout <seconds>`, and exits with the command's own status.
|
|
158
|
-
|
|
159
|
-
Neither reads a receipt or passes a verdict — take a watermark before and read
|
|
160
|
-
`veris sandbox trace --since` after. And once the dependencies are installed,
|
|
161
|
-
run `patchBundledCasCommand` **inside the box** to patch the CA bundles an SDK
|
|
162
|
-
ships with it; the script is already in there, so a shell caller needs nothing
|
|
163
|
-
from this package.
|
|
164
|
-
|
|
165
|
-
### Taking it back: `teardown`
|
|
166
|
-
|
|
167
|
-
However it went:
|
|
168
|
-
|
|
169
|
-
```sh
|
|
170
|
-
npx @veris-ai/daytona teardown "$(echo "$box" | jq -r .daytonaSandboxId)"
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
`teardown` deletes the sandbox and says what it did about the twin: one this
|
|
174
|
-
package created goes with it, one it attached to — always the case after
|
|
175
|
-
`provision` — is yours and is left running. It exits 1 when there is no such
|
|
176
|
-
sandbox, saying plainly that no twin was touched.
|
|
177
|
-
|
|
178
|
-
Nothing deletes a provisioned box for you, so it comes up with its own brakes:
|
|
179
|
-
it stops after 30 idle minutes, Daytona deletes it an hour after that, and it
|
|
180
|
-
is destroyed 4 hours after creation whatever state it is in. The twin's TTL is
|
|
181
|
-
untouched — it belongs to whoever created the twin.
|
|
182
|
-
|
|
183
|
-
Deleting needs a Daytona key with the `delete:sandboxes` permission, and a key
|
|
184
|
-
made with "write sandboxes" alone does not have it. `teardown` then exits 1
|
|
185
|
-
saying so: which key, which permissions it has, that the box is still there,
|
|
186
|
-
when its own brakes stop and delete it, what happened to the twin, and where a
|
|
187
|
-
key that can delete comes from. `provision` and `run` read the key's
|
|
188
|
-
permissions first and warn about the same thing *before* creating a box.
|
|
189
|
-
|
|
190
48
|
### Why `assertTouched` and not just a green suite
|
|
191
49
|
|
|
192
50
|
A test suite that skipped its integration and one that exercised it look
|
|
@@ -238,11 +96,38 @@ console.log(await sbx.veris.patchBundledCas()) // ['…/stripe/data/ca-certifi
|
|
|
238
96
|
```
|
|
239
97
|
|
|
240
98
|
Call it *after* installing dependencies — the bundles arrive with them. It is
|
|
241
|
-
idempotent and returns only the files it changed.
|
|
242
|
-
for you, between `--setup` and the command; a sandbox from `provision` carries
|
|
99
|
+
idempotent and returns only the files it changed. Every sandbox also carries
|
|
243
100
|
the same patcher as a script at `/tmp/veris-patch-bundled-cas.sh`, so whoever
|
|
244
101
|
installed the dependencies can run it with no SDK in hand.
|
|
245
102
|
|
|
103
|
+
### Node, and what `NODE_OPTIONS` carries
|
|
104
|
+
|
|
105
|
+
Three things make a Node process in the sandbox reach the twin, and the SDK
|
|
106
|
+
sets all of them at create time:
|
|
107
|
+
|
|
108
|
+
| variable | why |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `NODE_USE_ENV_PROXY=1` | Node ignores `HTTPS_PROXY` otherwise, and Daytona blocks a direct dial |
|
|
111
|
+
| `NODE_OPTIONS=--require /tmp/veris-node-proxy.cjs` | `NODE_USE_ENV_PROXY` reaches only the global agents; the preload gives every `http(s).Agent` the proxy environment, which is what an SDK with its own keep-alive agent (stripe-node, the AWS SDK, Twilio) needs |
|
|
112
|
+
| `NODE_OPTIONS=--use-openssl-ca` | Daytona overwrites `NODE_EXTRA_CA_CERTS`; this makes Node read the system store the Veris CA is installed into |
|
|
113
|
+
|
|
114
|
+
`NODE_OPTIONS` is one variable, so an application that sets its own value for
|
|
115
|
+
a command (`--experimental-vm-modules`, `--max-old-space-size`) would drop
|
|
116
|
+
both flags and every vendor call would fail on DNS or on the certificate. Build
|
|
117
|
+
the value with `verisNodeOptions(yourOptions)`, which appends the two flags
|
|
118
|
+
once:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { verisNodeOptions } from '@veris-ai/daytona'
|
|
122
|
+
await sbx.process.executeCommand('npx jest', cwd, {
|
|
123
|
+
...sbx.veris.getTrustEnv(),
|
|
124
|
+
NODE_OPTIONS: verisNodeOptions('--experimental-vm-modules'),
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Clients built on undici `Pool` or `Client` hold their own dispatcher and are
|
|
129
|
+
not covered by the preload.
|
|
130
|
+
|
|
246
131
|
## Options
|
|
247
132
|
|
|
248
133
|
```ts
|
|
@@ -309,9 +194,8 @@ four systems involved refused:
|
|
|
309
194
|
(services-sandbox#1044). Without it, `requests` fails with
|
|
310
195
|
`Missing Authority Key Identifier` while `curl` and Node succeed.
|
|
311
196
|
- **Daytona overwrites `REQUESTS_CA_BUNDLE`, `SSL_CERT_FILE` and
|
|
312
|
-
`CURL_CA_BUNDLE`** with its own CA file, which lacks the Veris CA.
|
|
313
|
-
|
|
314
|
-
`sandbox.process` yourself needs `sbx.veris.getTrustEnv()` as its env, or
|
|
197
|
+
`CURL_CA_BUNDLE`** with its own CA file, which lacks the Veris CA. A command
|
|
198
|
+
run through `sandbox.process` needs `sbx.veris.getTrustEnv()` as its env, or
|
|
315
199
|
`sbx.veris.trustPrelude()` in front of the command line.
|
|
316
200
|
- **An SDK that bundles its own CA reads no variable at all.**
|
|
317
201
|
`sbx.veris.patchBundledCas()` covers certifi, pip's vendored certifi,
|
|
@@ -322,11 +206,12 @@ four systems involved refused:
|
|
|
322
206
|
neither yields an IPv4 address, `create()` fails at `credential-mint` naming
|
|
323
207
|
`veris.egress: 'open'`, which sets no Daytona allowlist and still blocks a
|
|
324
208
|
process that bypasses the proxy.
|
|
325
|
-
- **`
|
|
326
|
-
key creates boxes it cannot delete;
|
|
327
|
-
|
|
209
|
+
- **`delete()` needs `delete:sandboxes` on the Daytona key.** A write-only
|
|
210
|
+
key creates boxes it cannot delete; `canDeleteSandboxes()` says so up front,
|
|
211
|
+
and a box it cannot delete lives until Daytona's own auto-stop and
|
|
212
|
+
auto-delete take it.
|
|
328
213
|
- **A very long run's receipt is a floor.** The twin's log is read in pages up
|
|
329
|
-
to a budget; past it, `entry.capped` is true and
|
|
214
|
+
to a budget; past it, `entry.capped` is true and the count is a minimum.
|
|
330
215
|
|
|
331
216
|
## License
|
|
332
217
|
|
package/dist/gateway.d.ts
CHANGED
|
@@ -69,6 +69,12 @@ export declare function gatewayIps(credential: {
|
|
|
69
69
|
* store directly rather than honouring the variables. It is best-effort.
|
|
70
70
|
*/
|
|
71
71
|
export declare function installCa(sandbox: Sandbox, caPem: string): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Put the Node proxy preload where NODE_OPTIONS names it. Separate from the
|
|
74
|
+
* CA install because it is about routing, not trust: a sandbox created with
|
|
75
|
+
* installCa: false still needs its Node SDKs to reach the gateway.
|
|
76
|
+
*/
|
|
77
|
+
export declare function installNodeProxyPreload(sandbox: Sandbox): Promise<void>;
|
|
72
78
|
/**
|
|
73
79
|
* Run the bundled-CA patcher installed above, and report what it changed.
|
|
74
80
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,8 @@ __export(index_exports, {
|
|
|
30
30
|
DELETE_SANDBOXES: () => DELETE_SANDBOXES,
|
|
31
31
|
Daytona: () => Daytona,
|
|
32
32
|
MissingCredentialsError: () => MissingCredentialsError,
|
|
33
|
+
NODE_PROXY_FLAG: () => NODE_PROXY_FLAG,
|
|
34
|
+
NODE_PROXY_PRELOAD: () => NODE_PROXY_PRELOAD,
|
|
33
35
|
NODE_TRUST_FLAG: () => NODE_TRUST_FLAG,
|
|
34
36
|
ReceiptIntegrityError: () => ReceiptIntegrityError,
|
|
35
37
|
SDK_VERSION: () => SDK_VERSION,
|
|
@@ -55,20 +57,20 @@ __export(index_exports, {
|
|
|
55
57
|
fetchManual: () => fetchManual,
|
|
56
58
|
gatewayIps: () => gatewayIps,
|
|
57
59
|
gatewayProxyUrl: () => gatewayProxyUrl,
|
|
58
|
-
isPermissionDenied: () => isPermissionDenied,
|
|
59
60
|
isVerisSandbox: () => isVerisSandbox,
|
|
60
61
|
missingKeyMessage: () => missingKeyMessage,
|
|
62
|
+
nodeOptionsWithProxy: () => nodeOptionsWithProxy,
|
|
61
63
|
nodeOptionsWithTrust: () => nodeOptionsWithTrust,
|
|
64
|
+
nodeProxyPreloadScript: () => nodeProxyPreloadScript,
|
|
62
65
|
patchBundledCas: () => patchBundledCas,
|
|
63
66
|
profilePath: () => profilePath,
|
|
64
67
|
requireVerisCredentials: () => requireVerisCredentials,
|
|
65
68
|
resolveVerisCredentials: () => resolveVerisCredentials,
|
|
66
|
-
sandboxBrakes: () => sandboxBrakes,
|
|
67
|
-
teardownRefusedMessage: () => teardownRefusedMessage,
|
|
68
69
|
trustPrelude: () => trustPrelude,
|
|
69
70
|
twinHosts: () => twinHosts,
|
|
70
71
|
vendorHosts: () => vendorHosts,
|
|
71
72
|
vendoredTrustEnv: () => vendoredTrustEnv,
|
|
73
|
+
verisNodeOptions: () => verisNodeOptions,
|
|
72
74
|
verisOwnsTwin: () => verisOwnsTwin,
|
|
73
75
|
verisTwinId: () => verisTwinId
|
|
74
76
|
});
|
|
@@ -598,9 +600,38 @@ function bundledCaPatchScript() {
|
|
|
598
600
|
}
|
|
599
601
|
var NODE_TRUST_FLAG = "--use-openssl-ca";
|
|
600
602
|
function nodeOptionsWithTrust(existing) {
|
|
603
|
+
return appendFlag(existing, NODE_TRUST_FLAG);
|
|
604
|
+
}
|
|
605
|
+
var NODE_PROXY_PRELOAD = "/tmp/veris-node-proxy.cjs";
|
|
606
|
+
var NODE_PROXY_FLAG = `--require ${NODE_PROXY_PRELOAD}`;
|
|
607
|
+
function nodeProxyPreloadScript() {
|
|
608
|
+
return [
|
|
609
|
+
`// Preloaded by @veris-ai/daytona through NODE_OPTIONS=--require.`,
|
|
610
|
+
`// Gives every http(s).Agent the proxy environment, which Node applies only`,
|
|
611
|
+
`// to its global agents under NODE_USE_ENV_PROXY=1. An SDK that builds its own`,
|
|
612
|
+
`// Agent would otherwise dial the vendor directly, which this sandbox cannot.`,
|
|
613
|
+
`for (const mod of [require("http"), require("https")]) {`,
|
|
614
|
+
` const Base = mod.Agent`,
|
|
615
|
+
` mod.Agent = class Agent extends Base {`,
|
|
616
|
+
` constructor(options) {`,
|
|
617
|
+
` super({ proxyEnv: process.env, ...(options || {}) })`,
|
|
618
|
+
` }`,
|
|
619
|
+
` }`,
|
|
620
|
+
`}`,
|
|
621
|
+
``
|
|
622
|
+
].join("\n");
|
|
623
|
+
}
|
|
624
|
+
function nodeOptionsWithProxy(existing) {
|
|
625
|
+
return appendFlag(existing, NODE_PROXY_FLAG);
|
|
626
|
+
}
|
|
627
|
+
function verisNodeOptions(existing, opts = {}) {
|
|
628
|
+
const withProxy = nodeOptionsWithProxy(existing);
|
|
629
|
+
return opts.trust === false ? withProxy : nodeOptionsWithTrust(withProxy);
|
|
630
|
+
}
|
|
631
|
+
function appendFlag(existing, flag) {
|
|
601
632
|
const base = (existing ?? "").trim();
|
|
602
|
-
if (base.
|
|
603
|
-
return base ? `${base} ${
|
|
633
|
+
if (base === flag || base.startsWith(`${flag} `) || base.endsWith(` ${flag}`) || base.includes(` ${flag} `)) return base;
|
|
634
|
+
return base ? `${base} ${flag}` : flag;
|
|
604
635
|
}
|
|
605
636
|
var CA_INSTALL_CMD = [
|
|
606
637
|
"update-ca-certificates",
|
|
@@ -673,6 +704,7 @@ function assertProxyUrl(raw) {
|
|
|
673
704
|
async function installCa(sandbox, caPem) {
|
|
674
705
|
await sandbox.fs.uploadFile(Buffer.from(caPem, "utf8"), VERIS_CA_FILE);
|
|
675
706
|
await sandbox.fs.uploadFile(Buffer.from(bundledCaPatchScript(), "utf8"), BUNDLED_CA_PATCH_SCRIPT);
|
|
707
|
+
await installNodeProxyPreload(sandbox);
|
|
676
708
|
const script = [
|
|
677
709
|
`chmod 0644 ${VERIS_CA_FILE}`,
|
|
678
710
|
// Public roots first so they keep working; ours appended. `cat` of a
|
|
@@ -698,6 +730,9 @@ async function installCa(sandbox, caPem) {
|
|
|
698
730
|
);
|
|
699
731
|
}
|
|
700
732
|
}
|
|
733
|
+
async function installNodeProxyPreload(sandbox) {
|
|
734
|
+
await sandbox.fs.uploadFile(Buffer.from(nodeProxyPreloadScript(), "utf8"), NODE_PROXY_PRELOAD);
|
|
735
|
+
}
|
|
701
736
|
async function patchBundledCas(sandbox) {
|
|
702
737
|
const r = await sh(sandbox, `sh ${BUNDLED_CA_PATCH_SCRIPT}`, 180).catch((e) => ({ exitCode: 1, result: String(e) }));
|
|
703
738
|
return (r.result ?? "").split("\n").filter((line) => line.startsWith(BUNDLED_CA_PATCHED_MARKER)).map((line) => line.slice(BUNDLED_CA_PATCHED_MARKER.length).trim()).filter(Boolean);
|
|
@@ -990,7 +1025,7 @@ function requireVerisCredentials(opts = {}) {
|
|
|
990
1025
|
}
|
|
991
1026
|
|
|
992
1027
|
// src/version.ts
|
|
993
|
-
var SDK_VERSION = true ? "0.
|
|
1028
|
+
var SDK_VERSION = true ? "0.4.0" : "0.0.0-dev";
|
|
994
1029
|
|
|
995
1030
|
// src/daytona.ts
|
|
996
1031
|
var LABEL = {
|
|
@@ -1068,9 +1103,12 @@ var Daytona = class extends import_sdk.Daytona {
|
|
|
1068
1103
|
const verisManaged = {
|
|
1069
1104
|
...v.installCa !== false ? sanitizeTrustEnv(void 0) : {},
|
|
1070
1105
|
// Node reads none of the variables above once Daytona has overwritten
|
|
1071
|
-
// them; the flag makes it read OpenSSL's store, which the CA
|
|
1072
|
-
// fills.
|
|
1073
|
-
|
|
1106
|
+
// them; the trust flag makes it read OpenSSL's store, which the CA
|
|
1107
|
+
// install fills. The preload gives every http(s).Agent the proxy
|
|
1108
|
+
// environment, which NODE_USE_ENV_PROXY below reaches only for the
|
|
1109
|
+
// global ones. Appended, not replaced: a caller's own NODE_OPTIONS keep
|
|
1110
|
+
// working.
|
|
1111
|
+
NODE_OPTIONS: verisNodeOptions(rest.envVars?.NODE_OPTIONS, { trust: v.installCa !== false }),
|
|
1074
1112
|
// Node ignores HTTPS_PROXY unless told to, and Daytona blocks anything
|
|
1075
1113
|
// that dials out directly — so without this every plain `https.get`
|
|
1076
1114
|
// and `fetch` in Node 24+ dies with ECONNRESET instead of reaching
|
|
@@ -1113,7 +1151,8 @@ var Daytona = class extends import_sdk.Daytona {
|
|
|
1113
1151
|
});
|
|
1114
1152
|
}
|
|
1115
1153
|
try {
|
|
1116
|
-
await installCa(sandbox, credential.ca_pem);
|
|
1154
|
+
if (v.installCa !== false) await installCa(sandbox, credential.ca_pem);
|
|
1155
|
+
else await installNodeProxyPreload(sandbox);
|
|
1117
1156
|
await probeCanary(sandbox, credential.canary_host, twin.id);
|
|
1118
1157
|
} catch (err) {
|
|
1119
1158
|
await sandbox.delete().catch(() => {
|
|
@@ -1332,38 +1371,6 @@ var DELETE_PERMISSION_FIX = 'create a key with the "delete sandboxes" permission
|
|
|
1332
1371
|
function cannotTeardownWarning(key, autoStopMinutes, autoDeleteMinutes) {
|
|
1333
1372
|
return `DAYTONA_API_KEY ${describeKey(key)} lacks \`${DELETE_SANDBOXES}\`, so \`veris-daytona teardown\` will be refused for the sandbox about to be created, and \`run\` cannot delete its own. The box still stops after ${autoStopMinutes} idle minutes and is deleted ${autoDeleteMinutes} minutes after it stops. For a teardown that works, ${DELETE_PERMISSION_FIX} and use it instead.`;
|
|
1334
1373
|
}
|
|
1335
|
-
|
|
1336
|
-
// src/teardown.ts
|
|
1337
|
-
var TEARDOWN_USAGE = `usage: veris-daytona teardown <daytona-sandbox-id>
|
|
1338
|
-
|
|
1339
|
-
Deletes the Daytona sandbox. The id is the one \`veris-daytona provision\`
|
|
1340
|
-
printed as daytonaSandboxId \u2014 not the Veris twin's id.
|
|
1341
|
-
|
|
1342
|
-
The twin follows the rule it was created under: one this package created is
|
|
1343
|
-
deleted with the sandbox, one it attached to (\`provision\`, or \`run --sandbox\`)
|
|
1344
|
-
is yours and is left running. Which of the two happened is printed.
|
|
1345
|
-
|
|
1346
|
-
needs: DAYTONA_API_KEY with the ${DELETE_SANDBOXES} permission \u2014 a key made with
|
|
1347
|
-
"write sandboxes" alone is refused, and the refusal says when Daytona will stop
|
|
1348
|
-
and delete the box on its own. To reach a twin that must be deleted, a Veris
|
|
1349
|
-
key too: VERIS_API_KEY, or the profile \`veris login\` saved.
|
|
1350
|
-
|
|
1351
|
-
exit code: 0 when the sandbox is deleted; 1 when there is no such sandbox, or
|
|
1352
|
-
the key may not delete one.`;
|
|
1353
|
-
function isPermissionDenied(e) {
|
|
1354
|
-
return typeof e === "object" && e !== null && e.statusCode === 403;
|
|
1355
|
-
}
|
|
1356
|
-
function sandboxBrakes(r) {
|
|
1357
|
-
const stop = r.autoStopMinutes && r.autoStopMinutes > 0 ? `stops after ${r.autoStopMinutes} idle minutes` : "never stops on its own";
|
|
1358
|
-
const del = r.autoDeleteMinutes === void 0 || r.autoDeleteMinutes < 0 ? "is never auto-deleted" : r.autoDeleteMinutes === 0 ? "is deleted as soon as it stops" : `is deleted ${r.autoDeleteMinutes} minutes after it stops`;
|
|
1359
|
-
const destroy = r.expiresAt ? `, and is destroyed at ${r.expiresAt} whatever state it is in` : "";
|
|
1360
|
-
return `${stop} and ${del}${destroy}`;
|
|
1361
|
-
}
|
|
1362
|
-
function teardownRefusedMessage(r) {
|
|
1363
|
-
const key = r.key ? `this DAYTONA_API_KEY ${describeKey(r.key)} lacks the \`${DELETE_SANDBOXES}\` permission` : `Daytona answered 403 (Access denied), which is what a DAYTONA_API_KEY without the \`${DELETE_SANDBOXES}\` permission gets \u2014 the key's own record could not be read to confirm it`;
|
|
1364
|
-
const twin = r.twinId === void 0 ? "" : r.ownsTwin ? ` Its twin ${r.twinId} was deleted before Daytona refused, so nothing is left on the Veris side.` : ` Twin ${r.twinId} is yours and was not touched.`;
|
|
1365
|
-
return `Daytona refused to delete sandbox ${r.sandboxId}: ${key}. The sandbox is still there: it ${sandboxBrakes(r)}.${twin} To delete it sooner, ${DELETE_PERMISSION_FIX}, then run \`veris-daytona teardown ${r.sandboxId}\` with it \u2014 or delete the sandbox in the Daytona dashboard.`;
|
|
1366
|
-
}
|
|
1367
1374
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1368
1375
|
0 && (module.exports = {
|
|
1369
1376
|
BUNDLED_CA_FILES,
|
|
@@ -1375,6 +1382,8 @@ function teardownRefusedMessage(r) {
|
|
|
1375
1382
|
DELETE_SANDBOXES,
|
|
1376
1383
|
Daytona,
|
|
1377
1384
|
MissingCredentialsError,
|
|
1385
|
+
NODE_PROXY_FLAG,
|
|
1386
|
+
NODE_PROXY_PRELOAD,
|
|
1378
1387
|
NODE_TRUST_FLAG,
|
|
1379
1388
|
ReceiptIntegrityError,
|
|
1380
1389
|
SDK_VERSION,
|
|
@@ -1399,20 +1408,20 @@ function teardownRefusedMessage(r) {
|
|
|
1399
1408
|
fetchManual,
|
|
1400
1409
|
gatewayIps,
|
|
1401
1410
|
gatewayProxyUrl,
|
|
1402
|
-
isPermissionDenied,
|
|
1403
1411
|
isVerisSandbox,
|
|
1404
1412
|
missingKeyMessage,
|
|
1413
|
+
nodeOptionsWithProxy,
|
|
1405
1414
|
nodeOptionsWithTrust,
|
|
1415
|
+
nodeProxyPreloadScript,
|
|
1406
1416
|
patchBundledCas,
|
|
1407
1417
|
profilePath,
|
|
1408
1418
|
requireVerisCredentials,
|
|
1409
1419
|
resolveVerisCredentials,
|
|
1410
|
-
sandboxBrakes,
|
|
1411
|
-
teardownRefusedMessage,
|
|
1412
1420
|
trustPrelude,
|
|
1413
1421
|
twinHosts,
|
|
1414
1422
|
vendorHosts,
|
|
1415
1423
|
vendoredTrustEnv,
|
|
1424
|
+
verisNodeOptions,
|
|
1416
1425
|
verisOwnsTwin,
|
|
1417
1426
|
verisTwinId,
|
|
1418
1427
|
...require("@daytona/sdk")
|