@veris-ai/daytona 0.3.0 → 0.3.1
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 +29 -0
- package/dist/cli.js +47 -8
- package/dist/cli.js.map +1 -1
- package/dist/gateway.d.ts +6 -0
- package/dist/index.cjs +54 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -7
- package/dist/index.js.map +1 -1
- package/dist/trust.d.ts +38 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { EgressMode, NetworkParams, NetworkPlan } from './network';
|
|
|
8
8
|
export { buildNetwork, vendorHosts, twinHosts, directTwinHosts, dataPlaneHosts } from './network';
|
|
9
9
|
export type { ServiceInfo as VerisServiceInfo, RouteEntry, TwinSandbox } from './control-plane';
|
|
10
10
|
export { ControlPlane } from './control-plane';
|
|
11
|
-
export { CA_CERT_PATH, SYSTEM_BUNDLE, VERIS_BUNDLE, VERIS_CA_FILE, NODE_TRUST_FLAG, BUNDLED_CA_FILES, BUNDLED_CA_PATCH_SCRIPT, nodeOptionsWithTrust, vendoredTrustEnv, trustPrelude, } from './trust';
|
|
11
|
+
export { CA_CERT_PATH, SYSTEM_BUNDLE, VERIS_BUNDLE, VERIS_CA_FILE, NODE_TRUST_FLAG, NODE_PROXY_PRELOAD, NODE_PROXY_FLAG, BUNDLED_CA_FILES, BUNDLED_CA_PATCH_SCRIPT, nodeOptionsWithTrust, nodeOptionsWithProxy, verisNodeOptions, nodeProxyPreloadScript, vendoredTrustEnv, trustPrelude, } from './trust';
|
|
12
12
|
export { gatewayIps, gatewayProxyUrl, patchBundledCas } from './gateway';
|
|
13
13
|
export { DEFAULT_API_BASE, profilePath, resolveVerisCredentials, requireVerisCredentials, missingKeyMessage, } from './profile';
|
|
14
14
|
export type { VerisCredentials, ResolveOpts, ProfileFile } from './profile';
|
package/dist/index.js
CHANGED
|
@@ -524,9 +524,38 @@ function bundledCaPatchScript() {
|
|
|
524
524
|
}
|
|
525
525
|
var NODE_TRUST_FLAG = "--use-openssl-ca";
|
|
526
526
|
function nodeOptionsWithTrust(existing) {
|
|
527
|
+
return appendFlag(existing, NODE_TRUST_FLAG);
|
|
528
|
+
}
|
|
529
|
+
var NODE_PROXY_PRELOAD = "/tmp/veris-node-proxy.cjs";
|
|
530
|
+
var NODE_PROXY_FLAG = `--require ${NODE_PROXY_PRELOAD}`;
|
|
531
|
+
function nodeProxyPreloadScript() {
|
|
532
|
+
return [
|
|
533
|
+
`// Preloaded by @veris-ai/daytona through NODE_OPTIONS=--require.`,
|
|
534
|
+
`// Gives every http(s).Agent the proxy environment, which Node applies only`,
|
|
535
|
+
`// to its global agents under NODE_USE_ENV_PROXY=1. An SDK that builds its own`,
|
|
536
|
+
`// Agent would otherwise dial the vendor directly, which this sandbox cannot.`,
|
|
537
|
+
`for (const mod of [require("http"), require("https")]) {`,
|
|
538
|
+
` const Base = mod.Agent`,
|
|
539
|
+
` mod.Agent = class Agent extends Base {`,
|
|
540
|
+
` constructor(options) {`,
|
|
541
|
+
` super({ proxyEnv: process.env, ...(options || {}) })`,
|
|
542
|
+
` }`,
|
|
543
|
+
` }`,
|
|
544
|
+
`}`,
|
|
545
|
+
``
|
|
546
|
+
].join("\n");
|
|
547
|
+
}
|
|
548
|
+
function nodeOptionsWithProxy(existing) {
|
|
549
|
+
return appendFlag(existing, NODE_PROXY_FLAG);
|
|
550
|
+
}
|
|
551
|
+
function verisNodeOptions(existing, opts = {}) {
|
|
552
|
+
const withProxy = nodeOptionsWithProxy(existing);
|
|
553
|
+
return opts.trust === false ? withProxy : nodeOptionsWithTrust(withProxy);
|
|
554
|
+
}
|
|
555
|
+
function appendFlag(existing, flag) {
|
|
527
556
|
const base = (existing ?? "").trim();
|
|
528
|
-
if (base.
|
|
529
|
-
return base ? `${base} ${
|
|
557
|
+
if (base === flag || base.startsWith(`${flag} `) || base.endsWith(` ${flag}`) || base.includes(` ${flag} `)) return base;
|
|
558
|
+
return base ? `${base} ${flag}` : flag;
|
|
530
559
|
}
|
|
531
560
|
var CA_INSTALL_CMD = [
|
|
532
561
|
"update-ca-certificates",
|
|
@@ -599,6 +628,7 @@ function assertProxyUrl(raw) {
|
|
|
599
628
|
async function installCa(sandbox, caPem) {
|
|
600
629
|
await sandbox.fs.uploadFile(Buffer.from(caPem, "utf8"), VERIS_CA_FILE);
|
|
601
630
|
await sandbox.fs.uploadFile(Buffer.from(bundledCaPatchScript(), "utf8"), BUNDLED_CA_PATCH_SCRIPT);
|
|
631
|
+
await installNodeProxyPreload(sandbox);
|
|
602
632
|
const script = [
|
|
603
633
|
`chmod 0644 ${VERIS_CA_FILE}`,
|
|
604
634
|
// Public roots first so they keep working; ours appended. `cat` of a
|
|
@@ -624,6 +654,9 @@ async function installCa(sandbox, caPem) {
|
|
|
624
654
|
);
|
|
625
655
|
}
|
|
626
656
|
}
|
|
657
|
+
async function installNodeProxyPreload(sandbox) {
|
|
658
|
+
await sandbox.fs.uploadFile(Buffer.from(nodeProxyPreloadScript(), "utf8"), NODE_PROXY_PRELOAD);
|
|
659
|
+
}
|
|
627
660
|
async function patchBundledCas(sandbox) {
|
|
628
661
|
const r = await sh(sandbox, `sh ${BUNDLED_CA_PATCH_SCRIPT}`, 180).catch((e) => ({ exitCode: 1, result: String(e) }));
|
|
629
662
|
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);
|
|
@@ -916,7 +949,7 @@ function requireVerisCredentials(opts = {}) {
|
|
|
916
949
|
}
|
|
917
950
|
|
|
918
951
|
// src/version.ts
|
|
919
|
-
var SDK_VERSION = true ? "0.3.
|
|
952
|
+
var SDK_VERSION = true ? "0.3.1" : "0.0.0-dev";
|
|
920
953
|
|
|
921
954
|
// src/daytona.ts
|
|
922
955
|
var LABEL = {
|
|
@@ -994,9 +1027,12 @@ var Daytona = class extends BaseDaytona {
|
|
|
994
1027
|
const verisManaged = {
|
|
995
1028
|
...v.installCa !== false ? sanitizeTrustEnv(void 0) : {},
|
|
996
1029
|
// Node reads none of the variables above once Daytona has overwritten
|
|
997
|
-
// them; the flag makes it read OpenSSL's store, which the CA
|
|
998
|
-
// fills.
|
|
999
|
-
|
|
1030
|
+
// them; the trust flag makes it read OpenSSL's store, which the CA
|
|
1031
|
+
// install fills. The preload gives every http(s).Agent the proxy
|
|
1032
|
+
// environment, which NODE_USE_ENV_PROXY below reaches only for the
|
|
1033
|
+
// global ones. Appended, not replaced: a caller's own NODE_OPTIONS keep
|
|
1034
|
+
// working.
|
|
1035
|
+
NODE_OPTIONS: verisNodeOptions(rest.envVars?.NODE_OPTIONS, { trust: v.installCa !== false }),
|
|
1000
1036
|
// Node ignores HTTPS_PROXY unless told to, and Daytona blocks anything
|
|
1001
1037
|
// that dials out directly — so without this every plain `https.get`
|
|
1002
1038
|
// and `fetch` in Node 24+ dies with ECONNRESET instead of reaching
|
|
@@ -1039,7 +1075,8 @@ var Daytona = class extends BaseDaytona {
|
|
|
1039
1075
|
});
|
|
1040
1076
|
}
|
|
1041
1077
|
try {
|
|
1042
|
-
await installCa(sandbox, credential.ca_pem);
|
|
1078
|
+
if (v.installCa !== false) await installCa(sandbox, credential.ca_pem);
|
|
1079
|
+
else await installNodeProxyPreload(sandbox);
|
|
1043
1080
|
await probeCanary(sandbox, credential.canary_host, twin.id);
|
|
1044
1081
|
} catch (err) {
|
|
1045
1082
|
await sandbox.delete().catch(() => {
|
|
@@ -1300,6 +1337,8 @@ export {
|
|
|
1300
1337
|
DELETE_SANDBOXES,
|
|
1301
1338
|
Daytona,
|
|
1302
1339
|
MissingCredentialsError,
|
|
1340
|
+
NODE_PROXY_FLAG,
|
|
1341
|
+
NODE_PROXY_PRELOAD,
|
|
1303
1342
|
NODE_TRUST_FLAG,
|
|
1304
1343
|
ReceiptIntegrityError,
|
|
1305
1344
|
SDK_VERSION,
|
|
@@ -1328,7 +1367,9 @@ export {
|
|
|
1328
1367
|
isPermissionDenied,
|
|
1329
1368
|
isVerisSandbox,
|
|
1330
1369
|
missingKeyMessage,
|
|
1370
|
+
nodeOptionsWithProxy,
|
|
1331
1371
|
nodeOptionsWithTrust,
|
|
1372
|
+
nodeProxyPreloadScript,
|
|
1332
1373
|
patchBundledCas,
|
|
1333
1374
|
profilePath,
|
|
1334
1375
|
requireVerisCredentials,
|
|
@@ -1339,6 +1380,7 @@ export {
|
|
|
1339
1380
|
twinHosts,
|
|
1340
1381
|
vendorHosts,
|
|
1341
1382
|
vendoredTrustEnv,
|
|
1383
|
+
verisNodeOptions,
|
|
1342
1384
|
verisOwnsTwin,
|
|
1343
1385
|
verisTwinId
|
|
1344
1386
|
};
|