@parcha/agentrun-computer 0.1.0-beta.43 → 0.1.0-beta.45
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 +98 -12
- package/box/Dockerfile +2 -1
- package/box/build-daytona.py +12 -2
- package/box/install.sh +19 -5
- package/box/recipe.mjs +1 -1
- package/dist/attach.d.ts +13 -3
- package/dist/attach.js +182 -15
- package/dist/cloudflare.d.ts +4 -2
- package/dist/cloudflare.js +7 -3
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/cases/files.js +7 -1
- package/dist/conformance/cases/isolation.js +4 -0
- package/dist/conformance/cases/mount.js +155 -2
- package/dist/conformance/cases/provider.js +3 -1
- package/dist/conformance/daytona.d.ts +15 -1
- package/dist/conformance/daytona.js +19 -4
- package/dist/conformance/types.d.ts +1 -1
- package/dist/daytona.d.ts +11 -2
- package/dist/daytona.js +47 -15
- package/dist/descriptor.d.ts +34 -4
- package/dist/descriptor.js +40 -6
- package/dist/descriptors/cloudflare.d.ts +14 -1
- package/dist/descriptors/cloudflare.js +7 -3
- package/dist/descriptors/daytona.d.ts +21 -3
- package/dist/descriptors/daytona.js +15 -8
- package/dist/descriptors/e2b.d.ts +1 -0
- package/dist/descriptors/e2b.js +2 -1
- package/dist/descriptors/fly.d.ts +14 -1
- package/dist/descriptors/fly.js +6 -3
- package/dist/descriptors/index.d.ts +64 -2
- package/dist/descriptors/modal.d.ts +16 -2
- package/dist/descriptors/modal.js +10 -6
- package/dist/descriptors/orgo.d.ts +3 -0
- package/dist/descriptors/orgo.js +3 -1
- package/dist/e2b.d.ts +9 -4
- package/dist/e2b.js +8 -8
- package/dist/env-proxy.d.ts +26 -0
- package/dist/env-proxy.js +97 -0
- package/dist/fly.d.ts +4 -3
- package/dist/fly.js +7 -4
- package/dist/hosted/provider.d.ts +2 -1
- package/dist/hosted/provider.js +133 -54
- package/dist/hosted/scripts.d.ts +3 -2
- package/dist/hosted/scripts.js +12 -7
- package/dist/hosted/values.d.ts +2 -5
- package/dist/hosted/values.js +2 -9
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/kinds.d.ts +4 -2
- package/dist/kinds.js +10 -1
- package/dist/modal.d.ts +5 -2
- package/dist/modal.js +8 -2
- package/dist/morph.js +15 -7
- package/dist/mount-archil.d.ts +33 -17
- package/dist/mount-archil.js +83 -36
- package/dist/mount.d.ts +16 -7
- package/dist/mount.js +13 -8
- package/dist/orgo.js +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/sync-folder.d.ts +82 -0
- package/dist/sync-folder.js +494 -0
- package/dist/tar.d.ts +34 -0
- package/dist/tar.js +203 -0
- package/package.json +1 -1
- package/dist/conformance/tar.d.ts +0 -13
- package/dist/conformance/tar.js +0 -105
|
@@ -30,6 +30,8 @@ export declare const DAYTONA_ENV: {
|
|
|
30
30
|
* provider takes an Archil mount; unset, it refuses one (Archil's client hangs on Daytona's hosted cloud).
|
|
31
31
|
*/
|
|
32
32
|
readonly archilEgress: "COMPUTER_DAYTONA_ARCHIL_EGRESS";
|
|
33
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
34
|
+
readonly connect: "COMPUTER_DAYTONA_CONNECT";
|
|
33
35
|
};
|
|
34
36
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
35
37
|
export declare const ENV: {
|
|
@@ -56,6 +58,8 @@ export declare const ENV: {
|
|
|
56
58
|
* provider takes an Archil mount; unset, it refuses one (Archil's client hangs on Daytona's hosted cloud).
|
|
57
59
|
*/
|
|
58
60
|
readonly archilEgress: "COMPUTER_DAYTONA_ARCHIL_EGRESS";
|
|
61
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
62
|
+
readonly connect: "COMPUTER_DAYTONA_CONNECT";
|
|
59
63
|
};
|
|
60
64
|
/**
|
|
61
65
|
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
@@ -77,9 +81,19 @@ export interface DaytonaModuleOptions {
|
|
|
77
81
|
timeouts?: DaytonaProviderOptions["timeouts"];
|
|
78
82
|
/** What the provider says that is no failure: the CLI gives it and puts it in the report. */
|
|
79
83
|
onNote?: DaytonaProviderOptions["onNote"];
|
|
84
|
+
/** The public server a dial machine dials (COMPUTER_DAYTONA_CONNECT=dial): its process alone gives it (dialKit). */
|
|
85
|
+
dial?: DaytonaProviderOptions["dial"];
|
|
86
|
+
/** The daemon binary, over COMPUTER_DAYTONA_DAEMON: dial-conformance.mjs gives drift.version's daemon here. */
|
|
87
|
+
daemonPath?: DaytonaProviderOptions["daemonPath"];
|
|
80
88
|
}
|
|
81
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The image every computer of the run starts from: COMPUTER_DAYTONA_SNAPSHOT; else on dial the box image's snapshot,
|
|
91
|
+
* agentrun-box-<recipe hash> (box/build-daytona.py), since only it holds agentrun-dial and runs it; else Daytona's default
|
|
92
|
+
* snapshot.
|
|
93
|
+
*/
|
|
82
94
|
export declare function conformanceImage({ env }?: Pick<DaytonaModuleOptions, "env">): string;
|
|
95
|
+
/** A dial machine (COMPUTER_DAYTONA_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
96
|
+
export declare const dialKit: () => import("./types.js").DialKit;
|
|
83
97
|
/**
|
|
84
98
|
* A fresh run folder for the mount cases: an Archil one on the disk the COMPUTER_ARCHIL_* settings name (the shared
|
|
85
99
|
* archilRunFolder; the run's snapshot is then one of box/Dockerfile, and COMPUTER_DAYTONA_USER is 2510:2510), only where
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// (sweep.ts, --provider daytona) reads the same names through createHost: it makes nothing. The mount cases run on a
|
|
7
7
|
// self-hosted Daytona target alone: COMPUTER_DAYTONA_ARCHIL_EGRESS names its Archil egress relay, and the
|
|
8
8
|
// COMPUTER_ARCHIL_* settings the disk (mountFor).
|
|
9
|
+
import { boxRecipeHash } from "../box-image.js";
|
|
9
10
|
import { create } from "../daytona.js";
|
|
10
11
|
import { DAYTONA_DEFAULT_SNAPSHOT } from "../descriptors/daytona.js";
|
|
11
12
|
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
13
|
+
import { dialOnlyFromServer } from "./dial-only.js";
|
|
12
14
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
13
15
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
14
16
|
export { ARCHIL_ENV } from "./archil.js";
|
|
@@ -37,6 +39,8 @@ export const DAYTONA_ENV = {
|
|
|
37
39
|
* provider takes an Archil mount; unset, it refuses one (Archil's client hangs on Daytona's hosted cloud).
|
|
38
40
|
*/
|
|
39
41
|
archilEgress: "COMPUTER_DAYTONA_ARCHIL_EGRESS",
|
|
42
|
+
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
43
|
+
connect: "COMPUTER_DAYTONA_CONNECT",
|
|
40
44
|
};
|
|
41
45
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
42
46
|
export const ENV = DAYTONA_ENV;
|
|
@@ -57,6 +61,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
57
61
|
const user = named(DAYTONA_ENV.user);
|
|
58
62
|
const gpuSnapshot = named(DAYTONA_ENV.gpuSnapshot);
|
|
59
63
|
const archilEgress = named(DAYTONA_ENV.archilEgress);
|
|
64
|
+
const connect = named(DAYTONA_ENV.connect);
|
|
60
65
|
return {
|
|
61
66
|
apiKey,
|
|
62
67
|
...(url ? { apiUrl: url.value } : {}),
|
|
@@ -71,6 +76,8 @@ export function settingsFromEnv(env = process.env) {
|
|
|
71
76
|
...(gpuSnapshot ? { gpuSnapshot: gpuSnapshot.value } : {}),
|
|
72
77
|
// create() refuses one of another shape in words.
|
|
73
78
|
...(archilEgress ? { archilEgress: archilEgress.value } : {}),
|
|
79
|
+
// create() refuses any other value in words.
|
|
80
|
+
...(connect ? { connect: connect.value } : {}),
|
|
74
81
|
};
|
|
75
82
|
}
|
|
76
83
|
/** Minutes without outside activity before Daytona stops a run's sandbox: at most 30, so none outlives a run for long. */
|
|
@@ -79,24 +86,32 @@ export const CONFORMANCE_AUTO_STOP_MINUTES = 30;
|
|
|
79
86
|
export const CONFORMANCE_AUTO_DELETE_MINUTES = 0;
|
|
80
87
|
/** For the run's report: what this configuration means for the suite, in words. */
|
|
81
88
|
export const conformanceNotes = [
|
|
82
|
-
`daytona: every sandbox runs with autoStopMinutes ${CONFORMANCE_AUTO_STOP_MINUTES} and autoDeleteMinutes ${CONFORMANCE_AUTO_DELETE_MINUTES}, besides its TTL: Daytona deletes a sandbox as soon as it stops, so this configuration keeps no stopped computer. A computer here is deleted, never stopped: release stop is refused. Full provider.janitor, which needs a stopped computer kept, is skipped (the lifetime being vendor).`,
|
|
89
|
+
`daytona: every sandbox runs with autoStopMinutes ${CONFORMANCE_AUTO_STOP_MINUTES} and autoDeleteMinutes ${CONFORMANCE_AUTO_DELETE_MINUTES}, besides its TTL: Daytona deletes a sandbox as soon as it stops, so this configuration keeps no stopped computer. A computer here is deleted, never stopped: release stop is refused. Full provider.janitor, which needs a stopped computer kept, is skipped (the lifetime being vendor). On dial (${DAYTONA_ENV.connect}=dial) no connection is a toolbox call, so nothing resets Daytona's idle timer: a computer stops, and is deleted, ${CONFORMANCE_AUTO_STOP_MINUTES} minutes after it starts, whatever runs on it.`,
|
|
83
90
|
];
|
|
84
91
|
/** The provider's options: what this module reads from the environment (settingsFromEnv), with the run's bounds. */
|
|
85
|
-
function optionsOf({ env = process.env, fetch, webSocket, timeouts, onNote }) {
|
|
92
|
+
function optionsOf({ env = process.env, fetch, webSocket, timeouts, onNote, dial, daemonPath }) {
|
|
86
93
|
return {
|
|
87
94
|
...settingsFromEnv(env),
|
|
95
|
+
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
88
96
|
autoStopMinutes: CONFORMANCE_AUTO_STOP_MINUTES,
|
|
89
97
|
autoDeleteMinutes: CONFORMANCE_AUTO_DELETE_MINUTES,
|
|
90
98
|
...(fetch ? { fetch } : {}),
|
|
91
99
|
...(webSocket ? { webSocket } : {}),
|
|
92
100
|
...(timeouts ? { timeouts } : {}),
|
|
93
101
|
...(onNote ? { onNote } : {}),
|
|
102
|
+
...(dial ? { dial } : {}),
|
|
94
103
|
};
|
|
95
104
|
}
|
|
96
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* The image every computer of the run starts from: COMPUTER_DAYTONA_SNAPSHOT; else on dial the box image's snapshot,
|
|
107
|
+
* agentrun-box-<recipe hash> (box/build-daytona.py), since only it holds agentrun-dial and runs it; else Daytona's default
|
|
108
|
+
* snapshot.
|
|
109
|
+
*/
|
|
97
110
|
export function conformanceImage({ env = process.env } = {}) {
|
|
98
|
-
return env[DAYTONA_ENV.snapshot] || DAYTONA_DEFAULT_SNAPSHOT;
|
|
111
|
+
return env[DAYTONA_ENV.snapshot] || (env[DAYTONA_ENV.connect] === "dial" ? `agentrun-box-${boxRecipeHash()}` : DAYTONA_DEFAULT_SNAPSHOT);
|
|
99
112
|
}
|
|
113
|
+
/** A dial machine (COMPUTER_DAYTONA_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
114
|
+
export const dialKit = dialOnlyFromServer("daytona", "Daytona", `${DAYTONA_ENV.connect}=dial`);
|
|
100
115
|
/**
|
|
101
116
|
* A fresh run folder for the mount cases: an Archil one on the disk the COMPUTER_ARCHIL_* settings name (the shared
|
|
102
117
|
* archilRunFolder; the run's snapshot is then one of box/Dockerfile, and COMPUTER_DAYTONA_USER is 2510:2510), only where
|
|
@@ -19,7 +19,7 @@ export type CaseGroup = "health" | "exec" | "files" | "process" | "provider" | "
|
|
|
19
19
|
* included), a secret the provider takes (secrets: declared by the run's planted provider, which its conformance
|
|
20
20
|
* module's ENV makes possible), or GPUs (gpu: declared by capabilities().gpu).
|
|
21
21
|
*/
|
|
22
|
-
export type Capability = Group | "network:none" | "network:open" | "network:allow" | "lifetime:janitor" | "user:root" | "user:uid" | "release:stop" | "persistence" | "mount:bind" | "mount:archil" | "extend" | "stream" | "vendor-agent" | "secrets" | "gpu";
|
|
22
|
+
export type Capability = Group | "network:none" | "network:open" | "network:allow" | "lifetime:janitor" | "user:root" | "user:uid" | "release:stop" | "persistence" | "mount:bind" | "mount:archil" | "mount:sync" | "extend" | "stream" | "vendor-agent" | "secrets" | "gpu";
|
|
23
23
|
/**
|
|
24
24
|
* A fresh run's folder for one mount kind, made by the provider's conformance module: the mount that reaches it, and its
|
|
25
25
|
* outside, where a computer does not run (the folder on the host for a bind, the disk's file API for Archil).
|
package/dist/daytona.d.ts
CHANGED
|
@@ -17,8 +17,11 @@ export type WebSocketFactory = (url: string, init: {
|
|
|
17
17
|
export type DaytonaTimeouts = HostedTimeouts & {
|
|
18
18
|
retryMs: number;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The Daytona provider's options: the key and Daytona's own settings, then the shared adapter's (HostedOptions), kind
|
|
22
|
+
* among them: a desktop on connect dial alone.
|
|
23
|
+
*/
|
|
24
|
+
export interface DaytonaProviderOptions extends Omit<HostedOptions, "desktop" | "maxLifetimeMs" | "timeouts"> {
|
|
22
25
|
/** The Daytona API key. The caller passes it; this provider never reads the environment and never puts it in a computer. */
|
|
23
26
|
apiKey: string;
|
|
24
27
|
/** Default https://app.daytona.io/api. */
|
|
@@ -53,6 +56,12 @@ export interface DaytonaProviderOptions extends Omit<HostedOptions, "kind" | "de
|
|
|
53
56
|
* (-1 is sent) and the TTL ends it.
|
|
54
57
|
*/
|
|
55
58
|
autoDeleteMinutes?: number;
|
|
59
|
+
/**
|
|
60
|
+
* exec (default): the daemon goes in through the toolbox's file API and each connection is a session command. dial:
|
|
61
|
+
* the sandbox gets the boot env as its env, and its snapshot's entrypoint, the box image's CMD, runs agentrun-dial; the
|
|
62
|
+
* machine dials the server (options.dial), which every connection goes over. No Archil mount and no GPU on dial.
|
|
63
|
+
*/
|
|
64
|
+
connect?: "exec" | "dial";
|
|
56
65
|
/** For tests: every request goes through it. Default the global fetch. */
|
|
57
66
|
fetch?: typeof fetch;
|
|
58
67
|
/** For tests: every log stream opens through it. Default Node's global WebSocket. */
|
package/dist/daytona.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// The Daytona host: Daytona sandboxes over Daytona's v0 REST API with fetch (no SDK). Daytona's toolbox daemon is the
|
|
2
2
|
// sandbox's first process, so computerd is a child: its upload goes through the toolbox's file API, and every command
|
|
3
3
|
// (install, init's start, the stdio bridge, an Archil computer's root steps) is a session command, its output read from
|
|
4
|
-
// the command's log stream and its stdin sent as the command's input.
|
|
5
|
-
//
|
|
4
|
+
// the command's log stream and its stdin sent as the command's input. With connect "dial", the sandbox is made with the
|
|
5
|
+
// boot env as its env, and the snapshot's entrypoint (box/build-daytona.py names the box image's CMD) runs agentrun-dial
|
|
6
|
+
// in the toolbox's entrypoint session: the machine dials the server, with no upload and no session command. The rest of
|
|
7
|
+
// the computer is the shared machine-host adapter's (./hosted/provider.ts). Every Daytona fact used here is cited in the
|
|
8
|
+
// README's Daytona section.
|
|
6
9
|
import { randomBytes } from "node:crypto";
|
|
7
|
-
import { mountsOf } from "./descriptor.js";
|
|
8
|
-
import { DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU, DAYTONA_GPU_REGION, daytonaGpuSnapshot } from "./descriptors/daytona.js";
|
|
10
|
+
import { connectOf, mountsOf } from "./descriptor.js";
|
|
11
|
+
import { DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU, DAYTONA_GPU_REGION, DAYTONA_GPU_SNAPSHOT, daytonaGpuSnapshot } from "./descriptors/daytona.js";
|
|
9
12
|
import { COMPUTER_LABEL } from "./drift.js";
|
|
10
13
|
import { HostError } from "./host.js";
|
|
11
14
|
import { framedExec } from "./hosted/framed-exec.js";
|
|
@@ -13,7 +16,7 @@ import { HostedProvider, timeoutsOf } from "./hosted/provider.js";
|
|
|
13
16
|
import { boundOf, orThrow, pause as sleep } from "./hosted/process.js";
|
|
14
17
|
import { allPages, jsonOf, rest } from "./hosted/rest.js";
|
|
15
18
|
import { shellLine } from "./hosted/scripts.js";
|
|
16
|
-
import { dateOf, isWhole, sizeRefusals } from "./hosted/values.js";
|
|
19
|
+
import { dateOf, execDesktopRefusal, isWhole, sizeRefusals } from "./hosted/values.js";
|
|
17
20
|
import { MAX_LINE_BYTES } from "./protocol.js";
|
|
18
21
|
import { checkGpu } from "./provider.js";
|
|
19
22
|
import { ok, vendorFail } from "./result.js";
|
|
@@ -48,6 +51,14 @@ const ERR = Buffer.from([2, 2, 2]);
|
|
|
48
51
|
/** A line the client wrote, echoed back: a request or a notification is never a daemon's reply. */
|
|
49
52
|
const ECHO = /^\{"jsonrpc":"2\.0",("id":\d+,)?"method":/;
|
|
50
53
|
const decoder = new TextDecoder();
|
|
54
|
+
/**
|
|
55
|
+
* Why a dial computer takes no GPU: check() refuses one in these words, and capabilities() declares none on dial.
|
|
56
|
+
* daytona-gpu is Daytona's own image, with no agentrun-dial; our GPU snapshot holds it, but Daytona runs a GPU sandbox
|
|
57
|
+
* unprivileged (apps/runner/pkg/docker/container_configs.go:205), and no dial has run there.
|
|
58
|
+
*/
|
|
59
|
+
const DIAL_NO_GPU = `a Daytona computer that dials this server takes no GPU: ${DAYTONA_GPU_SNAPSHOT} holds no agentrun-dial, and a box/Dockerfile GPU snapshot's dial on Daytona's GPU host, which runs it unprivileged, is not proven; a server whose Daytona connect is exec makes GPU computers`;
|
|
60
|
+
/** Why a dial computer is never made from Daytona's default snapshot: it holds no agentrun-dial, so it would never dial. */
|
|
61
|
+
const DIAL_NO_DEFAULT = `a Daytona computer that dials this server starts from a snapshot of box/Dockerfile, which holds agentrun-dial (box/build-daytona.py prints its name, agentrun-box-<recipe hash>); Daytona's default snapshot has none, so it would never dial`;
|
|
51
62
|
/**
|
|
52
63
|
* A sandbox's state as the adapter reads a machine's: failed, destroying and asked to destroy are gone (none of them
|
|
53
64
|
* starts again); stopping and pausing are stopped. A destroyed one get and list leave out, and the wait after a delete
|
|
@@ -93,6 +104,9 @@ class DaytonaHost {
|
|
|
93
104
|
*/
|
|
94
105
|
descriptor = DAYTONA;
|
|
95
106
|
facts;
|
|
107
|
+
/** connect exec alone: a dial host has neither (HostFacts.connect). */
|
|
108
|
+
exec;
|
|
109
|
+
upload;
|
|
96
110
|
/** Daytona's REST API: the control plane, and the toolbox of each sandbox. */
|
|
97
111
|
#rest;
|
|
98
112
|
#headers;
|
|
@@ -119,7 +133,8 @@ class DaytonaHost {
|
|
|
119
133
|
// maxLifetimeMs is the 30 days check() has always given; Daytona's TTL is in whole minutes and documents no cap of
|
|
120
134
|
// its own. The toolbox listens on 2280 on every interface and runs commands for whoever reaches it, so init starts
|
|
121
135
|
// with --own-network, and network none is all a computer takes. Its D-Bus session bus in /tmp (/tmp/dbus-*), which
|
|
122
|
-
// no network namespace cuts, is closed to the tool user before init starts, as on every child host.
|
|
136
|
+
// no network namespace cuts, is closed to the tool user before init starts, as on every child host. On dial init is
|
|
137
|
+
// agentrun-dial's child, and agentrun-dial the entrypoint the toolbox runs in a session of its own: still a child.
|
|
123
138
|
this.facts = {
|
|
124
139
|
daemon: "child",
|
|
125
140
|
isolation: options.sandboxClass === "linux-vm" ? "vm" : "container",
|
|
@@ -127,7 +142,14 @@ class DaytonaHost {
|
|
|
127
142
|
maxLifetimeMs: MAX_LIFETIME_MS,
|
|
128
143
|
arch: options.arch,
|
|
129
144
|
vendorAgentPorts: [TOOLBOX_PORT],
|
|
145
|
+
// A snapshot of box/Dockerfile has xfwm4 (box/install.sh's desktop step), for a desktop (connect dial alone).
|
|
146
|
+
windowManager: true,
|
|
147
|
+
...(options.connect === "dial" ? { connect: options.connect } : {}),
|
|
130
148
|
};
|
|
149
|
+
if (options.connect === "exec") {
|
|
150
|
+
this.exec = (id, argv, ctx) => this.#exec(id, argv, ctx);
|
|
151
|
+
this.upload = (id, path, bytes, ctx) => this.#upload(id, path, bytes, ctx);
|
|
152
|
+
}
|
|
131
153
|
}
|
|
132
154
|
/**
|
|
133
155
|
* A snapshot name has no control characters, and its size is the snapshot's; a GPU computer is made from the
|
|
@@ -140,6 +162,10 @@ class DaytonaHost {
|
|
|
140
162
|
refusals.push({ field: "image", message: `an image is the id or name of a Daytona snapshot, or "${DAYTONA_DEFAULT_SNAPSHOT}" for Daytona's default snapshot` });
|
|
141
163
|
else if (typeof image === "string" && /[\x01-\x1f]/.test(image))
|
|
142
164
|
refusals.push({ field: "image", message: "a snapshot name has no control characters" });
|
|
165
|
+
if (given.gpu !== undefined && this.facts.connect === "dial")
|
|
166
|
+
return [...refusals, { field: "gpu", message: DIAL_NO_GPU }];
|
|
167
|
+
if (image === DAYTONA_DEFAULT_SNAPSHOT && this.facts.connect === "dial")
|
|
168
|
+
refusals.push({ field: "image", message: DIAL_NO_DEFAULT });
|
|
143
169
|
const gpuSnapshot = this.#gpu.snapshot;
|
|
144
170
|
const offered = { gpu: { ...DAYTONA_GPU, types: [this.#gpu.type], max: this.#gpu.count } };
|
|
145
171
|
if (given.gpu !== undefined && checkGpu(given.gpu, offered, given.mount).length === 0 && typeof image === "string" && image !== DAYTONA_DEFAULT_SNAPSHOT && image !== gpuSnapshot) {
|
|
@@ -170,7 +196,8 @@ class DaytonaHost {
|
|
|
170
196
|
* computer's root, which reaches Archil through the operator's relay). A GPU computer is made from the GPU snapshot in region earth, ephemeral (its stop deletes it). Never cancelled: the adapter
|
|
171
197
|
* races it, and deletes by name one whose answer never comes. A name Daytona already holds (409) made nothing: exists,
|
|
172
198
|
* and the adapter adopts the sandbox the name lists, as a retry does. req.backstopAt is left: the TTL is Daytona's own
|
|
173
|
-
* timer at the deadline (lifetime "vendor"), and autoDeleteInterval counts from a stop, not from create.
|
|
199
|
+
* timer at the deadline (lifetime "vendor"), and autoDeleteInterval counts from a stop, not from create. A dial
|
|
200
|
+
* machine's boot env is the sandbox's env, which the toolbox's entrypoint session inherits (README, Daytona on dial).
|
|
174
201
|
*/
|
|
175
202
|
async create(req, ctx) {
|
|
176
203
|
const gpu = req.gpu !== undefined;
|
|
@@ -179,7 +206,7 @@ class DaytonaHost {
|
|
|
179
206
|
// "default" sends no snapshot, and Daytona makes the sandbox from its default snapshot.
|
|
180
207
|
...(gpu ? { snapshot: this.#gpu.snapshot } : req.image === DAYTONA_DEFAULT_SNAPSHOT ? {} : { snapshot: req.image }),
|
|
181
208
|
labels: { ...req.labels },
|
|
182
|
-
env: {},
|
|
209
|
+
env: { ...req.boot?.env },
|
|
183
210
|
public: false,
|
|
184
211
|
// A GPU sandbox runs in region earth alone, whatever the provider's target.
|
|
185
212
|
...(gpu ? { target: DAYTONA_GPU_REGION } : this.#target === undefined ? {} : { target: this.#target }),
|
|
@@ -284,9 +311,9 @@ class DaytonaHost {
|
|
|
284
311
|
* A file's bytes to `path` in the sandbox: files/upload-v2, else files/upload. An older toolbox, as a self-hosted
|
|
285
312
|
* Daytona's runners may run (the open daemon's routes, daytonaio/daytona@b5a5d9e7 apps/daemon/pkg/toolbox/server.go),
|
|
286
313
|
* has no files/upload-v2 and answers it 404; its files/upload takes the same form (a path query, the bytes as
|
|
287
|
-
* "file"). A 404 alone moves to the older route, so a refusal of any other kind is never sent twice.
|
|
314
|
+
* "file"). A 404 alone moves to the older route, so a refusal of any other kind is never sent twice. Connect exec alone.
|
|
288
315
|
*/
|
|
289
|
-
async upload(id, path, bytes, ctx) {
|
|
316
|
+
async #upload(id, path, bytes, ctx) {
|
|
290
317
|
const toolbox = await this.#toolbox(id, ctx.signal);
|
|
291
318
|
const query = new URLSearchParams({ path });
|
|
292
319
|
const send = (route, answerStatus) => {
|
|
@@ -304,9 +331,9 @@ class DaytonaHost {
|
|
|
304
331
|
}
|
|
305
332
|
/**
|
|
306
333
|
* A session command of its own (#commands), on framedExec: argv as one shell line, run async with no input echo, as
|
|
307
|
-
* the toolbox's user (root, or one with passwordless sudo, which the adapter's scripts use).
|
|
334
|
+
* the toolbox's user (root, or one with passwordless sudo, which the adapter's scripts use). Connect exec alone.
|
|
308
335
|
*/
|
|
309
|
-
async exec(id, argv, ctx) {
|
|
336
|
+
async #exec(id, argv, ctx) {
|
|
310
337
|
return framedExec(this.#commands(await this.#toolbox(id, ctx.signal)), argv, ctx);
|
|
311
338
|
}
|
|
312
339
|
/**
|
|
@@ -486,7 +513,10 @@ class DaytonaHost {
|
|
|
486
513
|
*/
|
|
487
514
|
export class DaytonaProvider extends HostedProvider {
|
|
488
515
|
constructor(options) {
|
|
489
|
-
const { apiKey, apiUrl = DEFAULT_API_URL, arch = "amd64", sandboxClass = "container", target, gpuSnapshot, autoStopMinutes = 0, autoDeleteMinutes, fetch: fetcher, webSocket, pause, timeouts = {}, ...hosted } = options ?? {};
|
|
516
|
+
const { apiKey, apiUrl = DEFAULT_API_URL, arch = "amd64", sandboxClass = "container", target, gpuSnapshot, autoStopMinutes = 0, autoDeleteMinutes, connect, fetch: fetcher, webSocket, pause, timeouts = {}, ...hosted } = options ?? {};
|
|
517
|
+
const via = connectOf(DAYTONA, { connect });
|
|
518
|
+
if (hosted.kind === "desktop" && via === "exec")
|
|
519
|
+
throw new Error(execDesktopRefusal("Daytona", "a snapshot of box/Dockerfile"));
|
|
490
520
|
if (typeof apiKey !== "string" || apiKey === "")
|
|
491
521
|
throw new Error("options.apiKey, the Daytona API key, is required: the provider reads no environment, so the caller passes it");
|
|
492
522
|
const base = new URL(apiUrl);
|
|
@@ -515,7 +545,8 @@ export class DaytonaProvider extends HostedProvider {
|
|
|
515
545
|
return typeof value === "string" && value !== "";
|
|
516
546
|
};
|
|
517
547
|
const host = new DaytonaHost({
|
|
518
|
-
|
|
548
|
+
// On dial its capabilities declare no GPU (DIAL_NO_GPU).
|
|
549
|
+
descriptor: { ...DAYTONA, ...mountsOf(DAYTONA, set), ...(via === "dial" ? { capabilities: DAYTONA.capabilities.map(({ gpu: _gpu, ...rest }) => rest) } : {}) },
|
|
519
550
|
rest: rest({ base: apiUrl, headers: () => headers, vendor: "daytona", fetch: fetcher ?? fetch, timeoutMs: requestMs, retry: { attempts: RETRY_ATTEMPTS, baseMs: retryMs, ...(pause ? { pause } : {}) }, explain }),
|
|
520
551
|
headers,
|
|
521
552
|
webSocket: webSocket ?? ((url, init) => new WebSocket(url, init)),
|
|
@@ -526,7 +557,8 @@ export class DaytonaProvider extends HostedProvider {
|
|
|
526
557
|
autoStop: autoStopMinutes,
|
|
527
558
|
autoDelete: autoDeleteMinutes ?? NO_AUTO_DELETE,
|
|
528
559
|
pollMs,
|
|
560
|
+
connect: via,
|
|
529
561
|
});
|
|
530
|
-
super(host, { ...hosted,
|
|
562
|
+
super(host, { ...hosted, timeouts: hostedTimeouts });
|
|
531
563
|
}
|
|
532
564
|
}
|
package/dist/descriptor.d.ts
CHANGED
|
@@ -58,7 +58,10 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
|
|
|
58
58
|
readonly settings?: readonly DescriptorSetting[];
|
|
59
59
|
/** The vendor bills by time; prices are the vendor's page, not ours. */
|
|
60
60
|
readonly metered: boolean;
|
|
61
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* The mount kinds its computers take beside the synced folder, bind or archil; [] for none. sync is never listed: it
|
|
63
|
+
* is derived (syncs, derivedMounts), and capabilities().mount declares both.
|
|
64
|
+
*/
|
|
62
65
|
readonly mounts: readonly MountKind[];
|
|
63
66
|
/**
|
|
64
67
|
* Mount kinds its computers don't take though a caller would ask for them, each with why in one sentence: check()
|
|
@@ -104,6 +107,14 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
|
|
|
104
107
|
* provider's own check() still judges the image. Absent: its images are its defaultImage alone.
|
|
105
108
|
*/
|
|
106
109
|
readonly imageEnv?: string;
|
|
110
|
+
/**
|
|
111
|
+
* How the server reaches its machines, where they may dial it (MachineHost facts.connect "dial": every connection goes
|
|
112
|
+
* over the socket the machine's computerd dials, which the server's attach hub takes). "dial": always (Fly Machines,
|
|
113
|
+
* Cloudflare). "either": its create() option `connect` says, "exec" (the default) or "dial", and a setting of its
|
|
114
|
+
* settings fills that option (E2B, Daytona, Modal). Absent: never. connectOf reads it; its built host's facts.connect
|
|
115
|
+
* is connectOf's answer.
|
|
116
|
+
*/
|
|
117
|
+
readonly connect?: "dial" | "either";
|
|
107
118
|
/** Its computers run on this machine's container engine: a server passes it its local host options (volume, host addresses). */
|
|
108
119
|
readonly local?: boolean;
|
|
109
120
|
/** create() takes a ledger the server keeps for it, as `options[ledger.option]` (the phone harness's sessions). */
|
|
@@ -138,12 +149,31 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
|
|
|
138
149
|
export declare function defineProvider<const Descriptor extends ProviderDescriptor>(descriptor: Descriptor): Descriptor;
|
|
139
150
|
/** What is wrong with a value offered as a descriptor, in words; none when it is one. */
|
|
140
151
|
export declare function descriptorProblems(value: unknown): string[];
|
|
152
|
+
/**
|
|
153
|
+
* How a provider made with create() `options` reaches its machines: "dial", they dial the server (its descriptor's
|
|
154
|
+
* connect "dial", or "either" with options.connect "dial"); else "exec". The one answer to whether a provider's machines
|
|
155
|
+
* dial: each provider's host takes its facts.connect from it (hosted/provider.ts reads that), and a server reads it
|
|
156
|
+
* before it builds one (serve's Settings → Computers, where a runner in a process of its own has no attach hub). A
|
|
157
|
+
* connect other than exec or dial is refused in words.
|
|
158
|
+
*/
|
|
159
|
+
export declare function connectOf(descriptor: Pick<ProviderDescriptor, "label" | "connect">, options?: {
|
|
160
|
+
readonly connect?: unknown;
|
|
161
|
+
}): "exec" | "dial";
|
|
162
|
+
/**
|
|
163
|
+
* Whether a configuration takes a synced folder: its groups have exec and files (all the runner reads and writes the
|
|
164
|
+
* folder through), and its descriptor binds no host folder (a bind is the folder itself) nor says why it takes none
|
|
165
|
+
* (unmounted.sync).
|
|
166
|
+
*/
|
|
167
|
+
export declare function syncs(descriptor: Pick<ProviderDescriptor, "mounts" | "unmounted">, configuration: Pick<KindCapabilities, "groups">): boolean;
|
|
168
|
+
/** A descriptor's mounts, with sync where one of its configurations takes it (syncs). */
|
|
169
|
+
export declare function derivedMounts(descriptor: Pick<ProviderDescriptor, "mounts" | "unmounted" | "capabilities">): MountKind[];
|
|
141
170
|
/**
|
|
142
171
|
* The mount kinds a provider's computers take, and why not the others, with the keys `set` says the operator has set: its
|
|
143
|
-
* mounts, and each kind of its mountsWith whose key is set, which leaves its unmounted. What a provider made with
|
|
144
|
-
* keys declares (capabilities().mount), and what a server reads to know whether that provider can mount a run's
|
|
172
|
+
* derived mounts, and each kind of its mountsWith whose key is set, which leaves its unmounted. What a provider made with
|
|
173
|
+
* those keys declares (capabilities().mount), and what a server reads to know whether that provider can mount a run's
|
|
174
|
+
* folder.
|
|
145
175
|
*/
|
|
146
|
-
export declare function mountsOf(descriptor: Pick<ProviderDescriptor, "mounts" | "unmounted" | "mountsWith">, set: (name: string) => boolean): {
|
|
176
|
+
export declare function mountsOf(descriptor: Pick<ProviderDescriptor, "mounts" | "unmounted" | "mountsWith" | "capabilities">, set: (name: string) => boolean): {
|
|
147
177
|
mounts: MountKind[];
|
|
148
178
|
unmounted: Unmounted;
|
|
149
179
|
};
|
package/dist/descriptor.js
CHANGED
|
@@ -25,11 +25,11 @@ export function descriptorProblems(value) {
|
|
|
25
25
|
if (typeof d.load !== "function")
|
|
26
26
|
problems.push("load is not a function that imports the provider module");
|
|
27
27
|
if (!Array.isArray(d.mounts) || d.mounts.some((kind) => kind !== "bind" && kind !== "archil"))
|
|
28
|
-
problems.push("mounts is not a list of mount kinds (bind, archil)");
|
|
28
|
+
problems.push("mounts is not a list of mount kinds (bind, archil): sync is derived, never listed");
|
|
29
29
|
if (d.unmounted !== undefined) {
|
|
30
30
|
const entries = typeof d.unmounted === "object" && d.unmounted !== null && !Array.isArray(d.unmounted) ? Object.entries(d.unmounted) : undefined;
|
|
31
|
-
if (entries === undefined || entries.some(([kind, why]) => (kind !== "bind" && kind !== "archil") || typeof why !== "string" || why.trim() === ""))
|
|
32
|
-
problems.push("unmounted maps mount kinds (bind, archil) to why, in words");
|
|
31
|
+
if (entries === undefined || entries.some(([kind, why]) => (kind !== "bind" && kind !== "archil" && kind !== "sync") || typeof why !== "string" || why.trim() === ""))
|
|
32
|
+
problems.push("unmounted maps mount kinds (bind, archil, sync) to why, in words");
|
|
33
33
|
else if (Array.isArray(d.mounts) && entries.some(([kind]) => d.mounts?.includes(kind)))
|
|
34
34
|
problems.push("unmounted names a mount kind that mounts declares");
|
|
35
35
|
}
|
|
@@ -84,6 +84,10 @@ export function descriptorProblems(value) {
|
|
|
84
84
|
problems.push("each key says whether it is required");
|
|
85
85
|
if (Array.isArray(d.keys) && d.keys.some((key) => key?.picked !== undefined && typeof key.picked !== "boolean"))
|
|
86
86
|
problems.push("a key's picked is true or false");
|
|
87
|
+
if (d.connect !== undefined && d.connect !== "dial" && d.connect !== "either")
|
|
88
|
+
problems.push("connect is dial or either");
|
|
89
|
+
else if ((d.connect === "either") !== (Array.isArray(d.settings) && d.settings.some((setting) => setting?.option === "connect")))
|
|
90
|
+
problems.push("connect is either exactly where a setting fills the connect option");
|
|
87
91
|
if (d.ledger !== undefined && (typeof d.ledger?.option !== "string" || d.ledger.option === ""))
|
|
88
92
|
problems.push("ledger names the option it fills");
|
|
89
93
|
if (d.imageEnv !== undefined && (typeof d.imageEnv !== "string" || !/^[A-Z][A-Z0-9_]*$/.test(d.imageEnv)))
|
|
@@ -107,13 +111,43 @@ export function descriptorProblems(value) {
|
|
|
107
111
|
}
|
|
108
112
|
return problems;
|
|
109
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* How a provider made with create() `options` reaches its machines: "dial", they dial the server (its descriptor's
|
|
116
|
+
* connect "dial", or "either" with options.connect "dial"); else "exec". The one answer to whether a provider's machines
|
|
117
|
+
* dial: each provider's host takes its facts.connect from it (hosted/provider.ts reads that), and a server reads it
|
|
118
|
+
* before it builds one (serve's Settings → Computers, where a runner in a process of its own has no attach hub). A
|
|
119
|
+
* connect other than exec or dial is refused in words.
|
|
120
|
+
*/
|
|
121
|
+
export function connectOf(descriptor, options = {}) {
|
|
122
|
+
if (descriptor.connect !== "either")
|
|
123
|
+
return descriptor.connect === "dial" ? "dial" : "exec";
|
|
124
|
+
const { connect } = options;
|
|
125
|
+
if (connect === undefined || connect === "exec" || connect === "dial")
|
|
126
|
+
return connect ?? "exec";
|
|
127
|
+
throw new Error(`connect is how ${descriptor.label} reaches its machines, "exec" (the default) or "dial", not ${JSON.stringify(connect)}`);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Whether a configuration takes a synced folder: its groups have exec and files (all the runner reads and writes the
|
|
131
|
+
* folder through), and its descriptor binds no host folder (a bind is the folder itself) nor says why it takes none
|
|
132
|
+
* (unmounted.sync).
|
|
133
|
+
*/
|
|
134
|
+
export function syncs(descriptor, configuration) {
|
|
135
|
+
return configuration.groups.includes("exec") && configuration.groups.includes("files") && !descriptor.mounts.includes("bind") && descriptor.unmounted?.sync === undefined;
|
|
136
|
+
}
|
|
137
|
+
/** A descriptor's mounts, with sync where one of its configurations takes it (syncs). */
|
|
138
|
+
export function derivedMounts(descriptor) {
|
|
139
|
+
const sync = !descriptor.mounts.includes("sync") && descriptor.capabilities.some((one) => syncs(descriptor, one));
|
|
140
|
+
return [...descriptor.mounts, ...(sync ? ["sync"] : [])];
|
|
141
|
+
}
|
|
110
142
|
/**
|
|
111
143
|
* The mount kinds a provider's computers take, and why not the others, with the keys `set` says the operator has set: its
|
|
112
|
-
* mounts, and each kind of its mountsWith whose key is set, which leaves its unmounted. What a provider made with
|
|
113
|
-
* keys declares (capabilities().mount), and what a server reads to know whether that provider can mount a run's
|
|
144
|
+
* derived mounts, and each kind of its mountsWith whose key is set, which leaves its unmounted. What a provider made with
|
|
145
|
+
* those keys declares (capabilities().mount), and what a server reads to know whether that provider can mount a run's
|
|
146
|
+
* folder.
|
|
114
147
|
*/
|
|
115
148
|
export function mountsOf(descriptor, set) {
|
|
116
149
|
const taken = Object.entries(descriptor.mountsWith ?? {}).flatMap(([kind, key]) => (typeof key === "string" && set(key) ? [kind] : []));
|
|
117
150
|
const unmounted = Object.fromEntries(Object.entries(descriptor.unmounted ?? {}).filter(([kind]) => !taken.includes(kind)));
|
|
118
|
-
|
|
151
|
+
const mounts = [...descriptor.mounts, ...taken.filter((kind) => !descriptor.mounts.includes(kind))];
|
|
152
|
+
return { mounts: derivedMounts({ ...descriptor, mounts }), unmounted };
|
|
119
153
|
}
|
|
@@ -13,9 +13,22 @@ export declare const CLOUDFLARE: {
|
|
|
13
13
|
readonly required: true;
|
|
14
14
|
}];
|
|
15
15
|
readonly metered: true;
|
|
16
|
+
readonly connect: "dial";
|
|
16
17
|
readonly mounts: readonly [];
|
|
17
18
|
readonly network: readonly ["none", "open", "allow"];
|
|
18
|
-
readonly capabilities: readonly [import("../kinds.js").KindCapabilities
|
|
19
|
+
readonly capabilities: readonly [import("../kinds.js").KindCapabilities, {
|
|
20
|
+
readonly options: {
|
|
21
|
+
readonly kind: "desktop";
|
|
22
|
+
};
|
|
23
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
24
|
+
readonly groups: import("../protocol.js").Group[];
|
|
25
|
+
readonly gpu?: import("../provider.js").GpuCapability;
|
|
26
|
+
readonly persistence?: {
|
|
27
|
+
keepsState: true;
|
|
28
|
+
resume: boolean;
|
|
29
|
+
};
|
|
30
|
+
readonly image?: string;
|
|
31
|
+
}];
|
|
19
32
|
readonly prepareImage: true;
|
|
20
33
|
readonly load: () => Promise<typeof import("../cloudflare.js")>;
|
|
21
34
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// call that starts or reaches into a container, so the relay creates, lists and deletes them, and computerd dials the
|
|
5
5
|
// server's attach route.
|
|
6
6
|
import { defineProvider } from "../descriptor.js";
|
|
7
|
-
import { SANDBOX } from "./shared.js";
|
|
7
|
+
import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
|
|
8
8
|
/** The relay's routes and rows this package speaks: the relay template's RELAY_VERSION; testConnection refuses another. */
|
|
9
9
|
export const CLOUDFLARE_RELAY_VERSION = 1;
|
|
10
10
|
export const CLOUDFLARE = defineProvider({
|
|
@@ -15,14 +15,18 @@ export const CLOUDFLARE = defineProvider({
|
|
|
15
15
|
{ name: "CLOUDFLARE_RELAY_TOKEN", option: "relayToken", required: true },
|
|
16
16
|
],
|
|
17
17
|
metered: true,
|
|
18
|
+
// Its containers dial the server: Cloudflare has no REST call that reaches into one.
|
|
19
|
+
connect: "dial",
|
|
18
20
|
// None: a machine that dials takes no Archil mount yet (its helper's root steps run through exec, which it has none of).
|
|
19
21
|
mounts: [],
|
|
20
22
|
// None: its programs run in init's network of their own, their loopback alone (isolation.ts). Open and a list: their
|
|
21
23
|
// one way out is init's egress proxy (hosted/network.ts). The container itself always reaches out (enableInternet): it
|
|
22
24
|
// fetches its daemon from the server and dials it.
|
|
23
25
|
network: ["none", "open", "allow"],
|
|
24
|
-
// A linux computer
|
|
25
|
-
|
|
26
|
+
// A linux computer, or a desktop: the box image's X server and xfwm4, started through computerd over the socket the
|
|
27
|
+
// container dialed. A desktop's size is the sandbox's, the adapter's default of 2 vCPUs and 4 GiB, which takes
|
|
28
|
+
// standard-3 (2 vCPUs, 8 GiB, 16 GB of disk; cloudflare.ts).
|
|
29
|
+
capabilities: [SANDBOX, { ...LINUX_DESKTOP, options: { kind: "desktop" } }],
|
|
26
30
|
// No default image: every computer starts from the box image the relay was deployed with, which prepareImage() reads.
|
|
27
31
|
prepareImage: true,
|
|
28
32
|
load: () => import("../cloudflare.js"),
|
|
@@ -29,8 +29,8 @@ export declare const DAYTONA_GPU_SNAPSHOT_GPU: Readonly<DaytonaSnapshotGpu>;
|
|
|
29
29
|
* daytona-gpu, alone (another type needs a snapshot of its own), with its limits on a GPU sandbox: its stop deletes it
|
|
30
30
|
* (no pause, no snapshot: nothing is kept), it runs in region earth, it has the snapshot's 16 vCPUs, 100 GiB of memory
|
|
31
31
|
* and 400 GiB of disk, it may be preempted (daytona.io/pricing lists its GPUs as "Preemptible GPU prices", 11-10), and
|
|
32
|
-
* it takes
|
|
33
|
-
* through FUSE, so an Archil mount is refused in words.
|
|
32
|
+
* it takes a synced folder alone: Daytona's GPU host gives no /dev/fuse, even to root (live 11-11), and the archil client
|
|
33
|
+
* mounts through FUSE, so an Archil mount is refused in words.
|
|
34
34
|
*/
|
|
35
35
|
export declare const DAYTONA_GPU: Readonly<GpuCapability>;
|
|
36
36
|
/** The snapshot a provider makes its GPU computers from, and its GPU. */
|
|
@@ -43,7 +43,7 @@ export interface DaytonaGpuSnapshot extends DaytonaSnapshotGpu {
|
|
|
43
43
|
* (box/build-daytona.py --gpu prints it).
|
|
44
44
|
*/
|
|
45
45
|
export declare function daytonaGpuSnapshot(gpuSnapshot?: string): DaytonaGpuSnapshot;
|
|
46
|
-
/** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and
|
|
46
|
+
/** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and synced folder, the snapshot's GPU): a copy. */
|
|
47
47
|
export declare function daytonaGpu(gpuSnapshot?: string): GpuCapability;
|
|
48
48
|
export declare const DAYTONA: {
|
|
49
49
|
readonly id: "daytona";
|
|
@@ -65,6 +65,11 @@ export declare const DAYTONA: {
|
|
|
65
65
|
readonly option: "archilEgress";
|
|
66
66
|
readonly required: false;
|
|
67
67
|
}];
|
|
68
|
+
readonly settings: readonly [{
|
|
69
|
+
readonly name: "daytonaConnect";
|
|
70
|
+
readonly option: "connect";
|
|
71
|
+
}];
|
|
72
|
+
readonly connect: "either";
|
|
68
73
|
readonly metered: true;
|
|
69
74
|
readonly mounts: readonly [];
|
|
70
75
|
readonly unmounted: {
|
|
@@ -84,6 +89,19 @@ export declare const DAYTONA: {
|
|
|
84
89
|
};
|
|
85
90
|
readonly image?: string;
|
|
86
91
|
readonly options?: Readonly<Record<string, unknown>>;
|
|
92
|
+
}, {
|
|
93
|
+
readonly options: {
|
|
94
|
+
readonly kind: "desktop";
|
|
95
|
+
readonly connect: "dial";
|
|
96
|
+
};
|
|
97
|
+
readonly kind: import("../protocol.js").ComputerKind;
|
|
98
|
+
readonly groups: import("../protocol.js").Group[];
|
|
99
|
+
readonly gpu?: GpuCapability;
|
|
100
|
+
readonly persistence?: {
|
|
101
|
+
keepsState: true;
|
|
102
|
+
resume: boolean;
|
|
103
|
+
};
|
|
104
|
+
readonly image?: string;
|
|
87
105
|
}];
|
|
88
106
|
readonly defaultImage: {
|
|
89
107
|
readonly sandbox: "default";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Daytona's descriptor: a sandbox on Daytona's cloud, with GPUs when asked; the run's folder on an Archil disk only where
|
|
2
2
|
// the operator gives an Archil egress relay (a self-hosted Daytona target), never on Daytona's hosted cloud.
|
|
3
3
|
import { defineProvider } from "../descriptor.js";
|
|
4
|
-
import { SANDBOX } from "./shared.js";
|
|
4
|
+
import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
|
|
5
5
|
/** The key that turns on a Daytona computer's Archil mount: the operator's Archil egress relay (archilEgress). */
|
|
6
6
|
export const DAYTONA_ARCHIL_EGRESS = "DAYTONA_ARCHIL_EGRESS";
|
|
7
7
|
/** Why a Daytona computer made with no Archil egress takes no Archil mount: check() refuses one in these words. */
|
|
@@ -23,8 +23,8 @@ export const DAYTONA_GPU_SNAPSHOT_GPU = Object.freeze({ type: "H100", count: 1 }
|
|
|
23
23
|
* daytona-gpu, alone (another type needs a snapshot of its own), with its limits on a GPU sandbox: its stop deletes it
|
|
24
24
|
* (no pause, no snapshot: nothing is kept), it runs in region earth, it has the snapshot's 16 vCPUs, 100 GiB of memory
|
|
25
25
|
* and 400 GiB of disk, it may be preempted (daytona.io/pricing lists its GPUs as "Preemptible GPU prices", 11-10), and
|
|
26
|
-
* it takes
|
|
27
|
-
* through FUSE, so an Archil mount is refused in words.
|
|
26
|
+
* it takes a synced folder alone: Daytona's GPU host gives no /dev/fuse, even to root (live 11-11), and the archil client
|
|
27
|
+
* mounts through FUSE, so an Archil mount is refused in words.
|
|
28
28
|
*/
|
|
29
29
|
export const DAYTONA_GPU = Object.freeze({
|
|
30
30
|
types: [DAYTONA_GPU_SNAPSHOT_GPU.type],
|
|
@@ -33,7 +33,7 @@ export const DAYTONA_GPU = Object.freeze({
|
|
|
33
33
|
stopDeletes: true,
|
|
34
34
|
region: DAYTONA_GPU_REGION,
|
|
35
35
|
perGpu: { cpus: 16, memoryMb: 100 * 1024, diskMb: 400 * 1024 },
|
|
36
|
-
mounts: [],
|
|
36
|
+
mounts: ["sync"],
|
|
37
37
|
unmounted: Object.freeze({ why: "Daytona's GPU runtime gives it no /dev/fuse", yet: false }),
|
|
38
38
|
});
|
|
39
39
|
/**
|
|
@@ -58,10 +58,10 @@ export function daytonaGpuSnapshot(gpuSnapshot) {
|
|
|
58
58
|
throw new Error(`gpuSnapshot ${JSON.stringify(gpuSnapshot)} is not a GPU snapshot of box/Dockerfile: box/build-daytona.py --gpu H100 prints its name, agentrun-archil-gpu-h100-<12 hex digits>`);
|
|
59
59
|
return { snapshot: gpuSnapshot, type, count: 1 };
|
|
60
60
|
}
|
|
61
|
-
/** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and
|
|
61
|
+
/** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and synced folder, the snapshot's GPU): a copy. */
|
|
62
62
|
export function daytonaGpu(gpuSnapshot) {
|
|
63
63
|
const { type, count } = daytonaGpuSnapshot(gpuSnapshot);
|
|
64
|
-
return { ...DAYTONA_GPU, types: [type], max: count, perGpu: { ...DAYTONA_GPU.perGpu }, mounts: [] };
|
|
64
|
+
return { ...DAYTONA_GPU, types: [type], max: count, perGpu: { ...DAYTONA_GPU.perGpu }, mounts: ["sync"] };
|
|
65
65
|
}
|
|
66
66
|
export const DAYTONA = defineProvider({
|
|
67
67
|
id: "daytona",
|
|
@@ -72,6 +72,10 @@ export const DAYTONA = defineProvider({
|
|
|
72
72
|
{ name: "DAYTONA_TARGET", option: "target", required: false },
|
|
73
73
|
{ name: DAYTONA_ARCHIL_EGRESS, option: "archilEgress", required: false },
|
|
74
74
|
],
|
|
75
|
+
// How the server reaches its machines: exec (the provider's default, when the server's settings name none), a session
|
|
76
|
+
// command through the toolbox per connection, or dial, the machine dials the server (a snapshot of box/Dockerfile).
|
|
77
|
+
settings: [{ name: "daytonaConnect", option: "connect" }],
|
|
78
|
+
connect: "either",
|
|
75
79
|
metered: true,
|
|
76
80
|
// No mount by default: on Daytona's hosted cloud, Archil's client (0.10.1) mounts on its container sandboxes, but
|
|
77
81
|
// nothing reads its /dev/fuse after, so the first statx of the folder hangs, on every kernel and mount shape tried
|
|
@@ -86,8 +90,11 @@ export const DAYTONA = defineProvider({
|
|
|
86
90
|
// its programs' one way out is init's egress proxy, which reaches the public internet alone, and with a list its hosts
|
|
87
91
|
// alone (hosted/network.ts).
|
|
88
92
|
network: ["none", "open", "allow"],
|
|
89
|
-
// A linux computer, with GPUs when asked
|
|
90
|
-
|
|
93
|
+
// A linux computer, with GPUs when asked; or, on connect dial alone, a desktop with none: a snapshot of box/Dockerfile's
|
|
94
|
+
// X server and xfwm4, started through computerd over the socket the sandbox dialed, at the snapshot's 2 CPUs and 4 GiB
|
|
95
|
+
// (box/build-daytona.py). The desktop's configuration selects dial itself, whatever daytonaConnect says: a provider on
|
|
96
|
+
// connect exec refuses kind desktop when it is made.
|
|
97
|
+
capabilities: [{ ...SANDBOX, gpu: DAYTONA_GPU }, { ...LINUX_DESKTOP, options: { kind: "desktop", connect: "dial" } }],
|
|
91
98
|
defaultImage: { sandbox: DAYTONA_DEFAULT_SNAPSHOT },
|
|
92
99
|
// The operator's own snapshot for every Daytona computer, named here; the default snapshot stands while unset. A
|
|
93
100
|
// computer with an Archil mount needs a snapshot of box/Dockerfile (box/build-daytona.py prints its name).
|