@evermore.work/plugin-modal 0.1.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 ADDED
@@ -0,0 +1,77 @@
1
+ # `@evermore.work/plugin-modal`
2
+
3
+ First-party Modal sandbox provider plugin for Evermore.
4
+
5
+ Like the other sandbox-provider packages in this repo, it lives inside the Evermore monorepo but is intentionally excluded from the root `pnpm` workspace and shaped to publish and install like a standalone npm package. That lets operators install it from the Plugins page by package name without introducing root lockfile churn for Modal's SDK dependencies.
6
+
7
+ ## Install
8
+
9
+ From an Evermore instance, install:
10
+
11
+ ```text
12
+ @evermore.work/plugin-modal
13
+ ```
14
+
15
+ The host plugin installer runs `npm install` into the managed plugin directory, so the `modal` SDK dependency is pulled in during installation.
16
+
17
+ ## Runtime support note
18
+
19
+ Modal's official JS SDK README pins support to **Node 22 or later**. Evermore's repo baseline is currently `node >= 20`; empirically `modal@0.7.4` imports and operates against the Modal API under Node 20, so the plugin runs there today, but the vendor support contract is Node 22+. The plugin logs a startup warning when it detects Node `< 22`. Operators who can pin their Evermore runtime to Node 22+ should do so; treat Node-20 usage as best-effort until the host bumps its baseline.
20
+
21
+ The empirical Node 20 compatibility check is recorded in [EVR-352](/EVR/issues/EVR-352).
22
+
23
+ ## Configuration
24
+
25
+ Configure Modal from `Company Settings -> Environments`, not from the plugin's instance settings page.
26
+
27
+ | Field | Required | Description |
28
+ | --- | --- | --- |
29
+ | `appName` | yes | Modal App name. The plugin calls `modal.apps.fromName(appName, { createIfMissing: true })`, so the App is created on first acquire if it does not already exist. |
30
+ | `image` | yes | Container image passed to `modal.images.fromRegistry()`, e.g. `python:3.13` or `node:20`. |
31
+ | `tokenId` / `tokenSecret` | yes | Modal auth tokens. Both must be provided together. Evermore stores pasted values as company secrets. The plugin worker runs in a child process that does not inherit host env vars, so `MODAL_TOKEN_ID` / `MODAL_TOKEN_SECRET` set on the Evermore server are **not** read by the plugin — provide the tokens in this form. |
32
+ | `environment` | no | Optional Modal environment name. Falls back to the SDK profile default. |
33
+ | `workdir` | no | Remote working directory inside the sandbox. Defaults to `/workspace/evermore`. |
34
+ | `sandboxTimeoutMs` | no | Maximum sandbox lifetime in milliseconds. Must be a positive multiple of `1000` between `1000` and `86_400_000` (24 hours). Defaults to `3_600_000` (1 hour). |
35
+ | `idleTimeoutMs` | no | Optional idle timeout in milliseconds. Modal terminates the sandbox if no exec is active for this duration. Must be a positive multiple of `1000`. |
36
+ | `execTimeoutMs` | no | Default per-exec timeout in milliseconds when the caller does not pass one. Must be a positive multiple of `1000`. Defaults to `300_000` (5 minutes). |
37
+ | `blockNetwork` | no | Block all egress network access. |
38
+ | `cidrAllowlist` | no | List of CIDRs the sandbox may reach. Cannot be combined with `blockNetwork`. |
39
+ | `reuseLease` | no | When `true`, the sandbox is detached (not terminated) on release and reattached by id later. Defaults to `false`. |
40
+
41
+ ### Reuse semantics
42
+
43
+ Modal does **not** expose a separate pause/resume primitive for sandboxes — there is no equivalent to e2b's `pause()`. The plugin implements `reuseLease` as follows:
44
+
45
+ - **`reuseLease: false` (default)**: On release the sandbox is `terminate()`d. Subsequent runs create a new sandbox.
46
+ - **`reuseLease: true`**: On release the plugin calls `sandbox.detach()`. The sandbox keeps running on Modal until its configured `sandboxTimeoutMs` or `idleTimeoutMs` elapses. The next acquire/resume reconnects via `modal.sandboxes.fromId(providerLeaseId)`. If the sandbox has expired, `fromId` raises `NotFoundError` and the plugin reports the lease as expired so Evermore reacquires.
47
+
48
+ Because there is no real pause, **`reuseLease: true` keeps billing running** until the sandbox or idle timeout cuts it off. Tune `idleTimeoutMs` to a value that matches your reuse window.
49
+
50
+ ## Local development
51
+
52
+ ```bash
53
+ cd packages/plugins/sandbox-providers/modal
54
+ pnpm install --ignore-workspace --no-lockfile
55
+ pnpm build
56
+ pnpm test
57
+ pnpm typecheck
58
+ ```
59
+
60
+ These commands assume the repo root has already been installed once so the local `@evermore.work/plugin-sdk` workspace package is available to the compiler during development.
61
+
62
+ ## Operator verification
63
+
64
+ 1. Provision Modal credentials in your Modal account (`modal token new`) or use a service account.
65
+ 2. Install the plugin from the Evermore Plugins page.
66
+ 3. In `Company Settings -> Environments`, add a new Modal sandbox environment with at least `appName`, `image`, `tokenId`, and `tokenSecret`.
67
+ 4. Run the environment **Probe** action. A success result confirms auth, app creation, image pull, and `exec` round-trip.
68
+ 5. Run at least one Evermore task with a remote-managed adapter (for example `claude_local`) bound to that environment. The adapter should provision the sandbox, run commands in it, and clean it up.
69
+
70
+ Full end-to-end manual QA is tracked separately in [EVR-354](/EVR/issues/EVR-354).
71
+
72
+ ## Package layout
73
+
74
+ - `src/manifest.ts` declares the sandbox-provider driver metadata
75
+ - `src/plugin.ts` implements the environment lifecycle hooks
76
+ - `src/worker.ts` boots the plugin under the host worker runtime
77
+ - `evermorePlugin.manifest` and `evermorePlugin.worker` point the host at the built plugin entrypoints in `dist/`
@@ -0,0 +1,3 @@
1
+ export { default as manifest } from "./manifest.js";
2
+ export { default as plugin } from "./plugin.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default as manifest } from "./manifest.js";
2
+ export { default as plugin } from "./plugin.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { EvermorePluginManifestV1 } from "@evermore.work/plugin-sdk";
2
+ declare const manifest: EvermorePluginManifestV1;
3
+ export default manifest;
4
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAK1E,QAAA,MAAM,QAAQ,EAAE,wBA6Ff,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,87 @@
1
+ const PLUGIN_ID = "evermore.modal-sandbox-provider";
2
+ const PLUGIN_VERSION = "0.1.0";
3
+ const manifest = {
4
+ id: PLUGIN_ID,
5
+ apiVersion: 1,
6
+ version: PLUGIN_VERSION,
7
+ displayName: "Modal Sandbox Provider",
8
+ description: "First-party sandbox provider plugin that provisions Modal sandboxes as Evermore execution environments.",
9
+ author: "Evermore",
10
+ categories: ["automation"],
11
+ capabilities: ["environment.drivers.register"],
12
+ entrypoints: {
13
+ worker: "./dist/worker.js",
14
+ },
15
+ environmentDrivers: [
16
+ {
17
+ driverKey: "modal",
18
+ kind: "sandbox_provider",
19
+ displayName: "Modal Sandbox",
20
+ description: "Provisions Modal sandboxes with configurable image, app, auth, timeouts, and network controls.",
21
+ configSchema: {
22
+ type: "object",
23
+ required: ["appName", "image"],
24
+ properties: {
25
+ appName: {
26
+ type: "string",
27
+ description: "Modal App name used as the parent for sandboxes. The plugin calls `modal.apps.fromName(appName, { createIfMissing: true })`, so the App is created on first acquire if it does not already exist.",
28
+ },
29
+ image: {
30
+ type: "string",
31
+ description: "Container image reference passed to `modal.images.fromRegistry()`, e.g. `python:3.13` or `node:20`.",
32
+ },
33
+ tokenId: {
34
+ type: "string",
35
+ format: "secret-ref",
36
+ description: "Modal token ID. Paste a token or an existing Evermore secret reference; saved environments store pasted values as company secrets. Required.",
37
+ },
38
+ tokenSecret: {
39
+ type: "string",
40
+ format: "secret-ref",
41
+ description: "Modal token secret paired with tokenId. Required.",
42
+ },
43
+ environment: {
44
+ type: "string",
45
+ description: "Optional Modal environment name. Falls back to the SDK profile default.",
46
+ },
47
+ workdir: {
48
+ type: "string",
49
+ description: "Remote working directory inside the sandbox.",
50
+ default: "/workspace/evermore",
51
+ },
52
+ sandboxTimeoutMs: {
53
+ type: "number",
54
+ description: "Maximum sandbox lifetime in milliseconds. Must be a positive multiple of 1000 between 1000 and 86400000 (24 hours).",
55
+ default: 3_600_000,
56
+ },
57
+ idleTimeoutMs: {
58
+ type: "number",
59
+ description: "Optional idle timeout in milliseconds. When set, Modal terminates the sandbox if no exec is active for this duration. Must be a positive multiple of 1000.",
60
+ },
61
+ execTimeoutMs: {
62
+ type: "number",
63
+ description: "Default per-exec timeout in milliseconds when the caller does not provide one. Must be a positive multiple of 1000.",
64
+ default: 300_000,
65
+ },
66
+ blockNetwork: {
67
+ type: "boolean",
68
+ description: "Whether to block all egress network access from the sandbox.",
69
+ default: false,
70
+ },
71
+ cidrAllowlist: {
72
+ type: "array",
73
+ items: { type: "string" },
74
+ description: "Optional list of CIDRs the sandbox is allowed to reach. Cannot be combined with blockNetwork.",
75
+ },
76
+ reuseLease: {
77
+ type: "boolean",
78
+ description: "When true, the sandbox is detached (not terminated) on release and resumed by id later. Reuse relies on Modal's sandbox lifetime and idle timeout because Modal has no separate pause primitive.",
79
+ default: false,
80
+ },
81
+ },
82
+ },
83
+ },
84
+ ],
85
+ };
86
+ export default manifest;
87
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,MAAM,QAAQ,GAA6B;IACzC,EAAE,EAAE,SAAS;IACb,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EACT,yGAAyG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E;wBACZ,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,8DAA8D;wBAC3E,OAAO,EAAE,KAAK;qBACf;oBACD,aAAa,EAAE;wBACb,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACzB,WAAW,EACT,+FAA+F;qBAClG;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,kMAAkM;wBACpM,OAAO,EAAE,KAAK;qBACf;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,18 @@
1
+ interface ModalDriverConfig {
2
+ appName: string;
3
+ image: string;
4
+ tokenId: string | null;
5
+ tokenSecret: string | null;
6
+ environment: string | null;
7
+ workdir: string;
8
+ sandboxTimeoutMs: number;
9
+ idleTimeoutMs: number | null;
10
+ execTimeoutMs: number;
11
+ blockNetwork: boolean;
12
+ cidrAllowlist: string[] | null;
13
+ reuseLease: boolean;
14
+ }
15
+ export declare function parseDriverConfig(raw: Record<string, unknown>): ModalDriverConfig;
16
+ declare const plugin: import("@evermore.work/plugin-sdk").EvermorePlugin;
17
+ export default plugin;
18
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAgCA,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB;AAqBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAoBjF;AAuPD,QAAA,MAAM,MAAM,oDAoUV,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,552 @@
1
+ import { ModalClient, NotFoundError, SandboxTimeoutError, TimeoutError, } from "modal";
2
+ import { definePlugin } from "@evermore.work/plugin-sdk";
3
+ const DEFAULT_WORKDIR = "/workspace/evermore";
4
+ const DEFAULT_SANDBOX_TIMEOUT_MS = 3_600_000;
5
+ const DEFAULT_EXEC_TIMEOUT_MS = 300_000;
6
+ const MAX_SANDBOX_TIMEOUT_MS = 86_400_000;
7
+ function parseOptionalString(value) {
8
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
9
+ }
10
+ function parseOptionalNumber(value) {
11
+ if (value == null || value === "")
12
+ return null;
13
+ const parsed = Number(value);
14
+ return Number.isFinite(parsed) ? parsed : null;
15
+ }
16
+ function parseStringArray(value) {
17
+ if (!Array.isArray(value))
18
+ return null;
19
+ const trimmed = value
20
+ .filter((entry) => typeof entry === "string")
21
+ .map((entry) => entry.trim())
22
+ .filter((entry) => entry.length > 0);
23
+ return trimmed.length > 0 ? trimmed : null;
24
+ }
25
+ export function parseDriverConfig(raw) {
26
+ const sandboxTimeoutMsRaw = parseOptionalNumber(raw.sandboxTimeoutMs);
27
+ const execTimeoutMsRaw = parseOptionalNumber(raw.execTimeoutMs);
28
+ const idleTimeoutMsRaw = parseOptionalNumber(raw.idleTimeoutMs);
29
+ return {
30
+ appName: parseOptionalString(raw.appName) ?? "",
31
+ image: parseOptionalString(raw.image) ?? "",
32
+ tokenId: parseOptionalString(raw.tokenId),
33
+ tokenSecret: parseOptionalString(raw.tokenSecret),
34
+ environment: parseOptionalString(raw.environment),
35
+ workdir: parseOptionalString(raw.workdir) ?? DEFAULT_WORKDIR,
36
+ sandboxTimeoutMs: sandboxTimeoutMsRaw != null ? Math.trunc(sandboxTimeoutMsRaw) : DEFAULT_SANDBOX_TIMEOUT_MS,
37
+ idleTimeoutMs: idleTimeoutMsRaw != null ? Math.trunc(idleTimeoutMsRaw) : null,
38
+ execTimeoutMs: execTimeoutMsRaw != null ? Math.trunc(execTimeoutMsRaw) : DEFAULT_EXEC_TIMEOUT_MS,
39
+ blockNetwork: raw.blockNetwork === true,
40
+ cidrAllowlist: parseStringArray(raw.cidrAllowlist),
41
+ reuseLease: raw.reuseLease === true,
42
+ };
43
+ }
44
+ function isMultipleOf1000(value) {
45
+ return value > 0 && value % 1000 === 0;
46
+ }
47
+ function resolveAuth(config) {
48
+ // The plugin worker runs in a child process that does not inherit host env
49
+ // vars (see PluginWorkerManager.spawnProcess), so MODAL_TOKEN_ID /
50
+ // MODAL_TOKEN_SECRET cannot be read here. Credentials must come from the
51
+ // environment config, which Evermore stores as company secrets.
52
+ const tokenId = config.tokenId ?? "";
53
+ const tokenSecret = config.tokenSecret ?? "";
54
+ if (!tokenId && !tokenSecret)
55
+ return null;
56
+ if (!tokenId || !tokenSecret) {
57
+ throw new Error("Modal sandbox environments require both tokenId and tokenSecret to be configured.");
58
+ }
59
+ return { tokenId, tokenSecret };
60
+ }
61
+ function createModalClient(config) {
62
+ const auth = resolveAuth(config);
63
+ const params = {};
64
+ if (auth) {
65
+ params.tokenId = auth.tokenId;
66
+ params.tokenSecret = auth.tokenSecret;
67
+ }
68
+ if (config.environment) {
69
+ params.environment = config.environment;
70
+ }
71
+ return new ModalClient(params);
72
+ }
73
+ async function resolveApp(client, config) {
74
+ return await client.apps.fromName(config.appName, {
75
+ createIfMissing: true,
76
+ environment: config.environment ?? undefined,
77
+ });
78
+ }
79
+ function buildSandboxCreateParams(input) {
80
+ const params = {
81
+ workdir: input.config.workdir,
82
+ timeoutMs: input.config.sandboxTimeoutMs,
83
+ blockNetwork: input.config.blockNetwork,
84
+ };
85
+ if (input.config.idleTimeoutMs != null) {
86
+ params.idleTimeoutMs = input.config.idleTimeoutMs;
87
+ }
88
+ if (input.config.cidrAllowlist && input.config.cidrAllowlist.length > 0) {
89
+ params.cidrAllowlist = input.config.cidrAllowlist;
90
+ }
91
+ // Modal sandboxes accept tag metadata via setTags after creation; the create
92
+ // RPC does not take tags directly. We pass them through input so the caller
93
+ // can apply them after `create` resolves.
94
+ void input.tags;
95
+ return params;
96
+ }
97
+ function buildSandboxTags(input) {
98
+ return {
99
+ "evermore-provider": "modal",
100
+ "evermore-company-id": input.companyId,
101
+ "evermore-environment-id": input.environmentId,
102
+ "evermore-reuse-lease": input.reuseLease ? "true" : "false",
103
+ ...(input.runId ? { "evermore-run-id": input.runId } : {}),
104
+ };
105
+ }
106
+ async function createSandboxFor(client, app, config, tags) {
107
+ const image = client.images.fromRegistry(config.image);
108
+ const params = buildSandboxCreateParams({ config, tags });
109
+ const sandbox = await client.sandboxes.create(app, image, params);
110
+ try {
111
+ await sandbox.setTags(tags);
112
+ }
113
+ catch (error) {
114
+ // setTags is best-effort metadata; surface but do not block lease creation.
115
+ console.warn(`Failed to set tags on Modal sandbox ${sandbox.sandboxId}: ${formatErrorMessage(error)}`);
116
+ }
117
+ return sandbox;
118
+ }
119
+ function leaseMetadata(input) {
120
+ return {
121
+ provider: "modal",
122
+ shellCommand: "sh",
123
+ sandboxId: input.sandbox.sandboxId,
124
+ appName: input.config.appName,
125
+ image: input.config.image,
126
+ sandboxTimeoutMs: input.config.sandboxTimeoutMs,
127
+ idleTimeoutMs: input.config.idleTimeoutMs,
128
+ reuseLease: input.config.reuseLease,
129
+ remoteCwd: input.remoteCwd,
130
+ resumedLease: input.resumedLease,
131
+ };
132
+ }
133
+ function formatErrorMessage(error) {
134
+ return error instanceof Error ? error.message : String(error);
135
+ }
136
+ function shellQuote(value) {
137
+ return `'${value.replace(/'/g, `'"'"'`)}'`;
138
+ }
139
+ function isValidShellEnvKey(value) {
140
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value);
141
+ }
142
+ // Modal's `sandbox.exec` takes an argv array and bypasses the shell entirely,
143
+ // so adapter probes that rely on PATH mutations from /etc/profile or ~/.bashrc
144
+ // do not work without an explicit login shell. Mirroring the Daytona / E2B
145
+ // providers, wrap the user command in a `sh -lc` script that sources common
146
+ // login profiles plus nvm before invoking it. Env is set after profile sourcing
147
+ // so caller env wins; stdin is staged to a temp file and shell-redirected so
148
+ // fast-failing commands do not race a streaming stdin writer.
149
+ function buildLoginShellScript(input) {
150
+ const env = input.env ?? {};
151
+ for (const key of Object.keys(env)) {
152
+ if (!isValidShellEnvKey(key)) {
153
+ throw new Error(`Invalid sandbox environment variable key: ${key}`);
154
+ }
155
+ }
156
+ const envArgs = Object.entries(env)
157
+ .filter((entry) => typeof entry[1] === "string")
158
+ .map(([key, value]) => `${key}=${shellQuote(value)}`);
159
+ const commandParts = [shellQuote(input.command), ...input.args.map(shellQuote)].join(" ");
160
+ const redirected = input.stdinPath
161
+ ? `${commandParts} < ${shellQuote(input.stdinPath)}`
162
+ : commandParts;
163
+ const finalLine = envArgs.length > 0 ? `exec env ${envArgs.join(" ")} ${redirected}` : `exec ${redirected}`;
164
+ const lines = [
165
+ 'if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1 || true; fi',
166
+ 'if [ -f "$HOME/.profile" ]; then . "$HOME/.profile" >/dev/null 2>&1 || true; fi',
167
+ 'if [ -f "$HOME/.bash_profile" ]; then . "$HOME/.bash_profile" >/dev/null 2>&1 || true; elif [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" >/dev/null 2>&1 || true; fi',
168
+ 'if [ -f "$HOME/.zprofile" ]; then . "$HOME/.zprofile" >/dev/null 2>&1 || true; fi',
169
+ 'export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"',
170
+ '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" >/dev/null 2>&1 || true',
171
+ ];
172
+ if (input.cwd) {
173
+ lines.push(`cd ${shellQuote(input.cwd)}`);
174
+ }
175
+ lines.push(finalLine);
176
+ return lines.join(" && ");
177
+ }
178
+ async function ensureRemoteWorkspace(sandbox, remoteCwd) {
179
+ // Use a one-shot exec to mkdir -p; Modal does not expose a direct
180
+ // filesystem mkdir helper and creating a file via `open()` does not create
181
+ // intermediate directories.
182
+ const proc = await sandbox.exec(["sh", "-lc", `mkdir -p ${shellQuote(remoteCwd)}`]);
183
+ const exitCode = await proc.wait();
184
+ if (exitCode !== 0) {
185
+ throw new Error(`Failed to create remote workspace directory '${remoteCwd}': mkdir exited with code ${exitCode}`);
186
+ }
187
+ }
188
+ async function stageStdin(sandbox, stdin, remotePath) {
189
+ const file = await sandbox.open(remotePath, "w");
190
+ try {
191
+ await file.write(new TextEncoder().encode(stdin));
192
+ await file.flush();
193
+ }
194
+ finally {
195
+ await file.close().catch(() => undefined);
196
+ }
197
+ }
198
+ async function deleteStdinPath(sandbox, remotePath) {
199
+ // Best-effort cleanup of the staged stdin file. We swallow errors because
200
+ // it is fine for the file to outlive the sandbox if it is going to be
201
+ // terminated, and a missing rm tool would otherwise mask the real result.
202
+ try {
203
+ const proc = await sandbox.exec(["sh", "-lc", `rm -f ${shellQuote(remotePath)}`]);
204
+ await proc.wait();
205
+ }
206
+ catch {
207
+ // ignore
208
+ }
209
+ }
210
+ async function readProcessStreams(proc) {
211
+ const [stdout, stderr, exitCode] = await Promise.all([
212
+ proc.stdout.readText(),
213
+ proc.stderr.readText(),
214
+ proc.wait(),
215
+ ]);
216
+ return { stdout, stderr, exitCode };
217
+ }
218
+ function isModalNotFound(error) {
219
+ return error instanceof NotFoundError;
220
+ }
221
+ async function getSandboxOrNull(client, providerLeaseId) {
222
+ try {
223
+ return await client.sandboxes.fromId(providerLeaseId);
224
+ }
225
+ catch (error) {
226
+ if (isModalNotFound(error))
227
+ return null;
228
+ throw error;
229
+ }
230
+ }
231
+ function warnIfUnsupportedNode(logger) {
232
+ const major = Number.parseInt(process.versions.node.split(".")[0] ?? "0", 10);
233
+ if (Number.isFinite(major) && major < 22) {
234
+ const message = `Modal sandbox provider is running on Node ${process.versions.node}; Modal officially supports Node 22+. The plugin will attempt to operate but vendor support is not guaranteed below Node 22.`;
235
+ logger?.warn(message);
236
+ }
237
+ }
238
+ function leaseRemoteCwd(metadata, fallback) {
239
+ if (metadata && typeof metadata.remoteCwd === "string" && metadata.remoteCwd.trim().length > 0) {
240
+ return metadata.remoteCwd.trim();
241
+ }
242
+ return fallback;
243
+ }
244
+ const plugin = definePlugin({
245
+ async setup(ctx) {
246
+ warnIfUnsupportedNode(ctx.logger);
247
+ ctx.logger.info("Modal sandbox provider plugin ready");
248
+ },
249
+ async onHealth() {
250
+ return { status: "ok", message: "Modal sandbox provider plugin healthy" };
251
+ },
252
+ async onEnvironmentValidateConfig(params) {
253
+ const config = parseDriverConfig(params.config);
254
+ const errors = [];
255
+ if (!config.appName) {
256
+ errors.push("Modal sandbox environments require an appName.");
257
+ }
258
+ if (!config.image) {
259
+ errors.push("Modal sandbox environments require an image reference.");
260
+ }
261
+ if (config.sandboxTimeoutMs < 1000 ||
262
+ config.sandboxTimeoutMs > MAX_SANDBOX_TIMEOUT_MS ||
263
+ !isMultipleOf1000(config.sandboxTimeoutMs)) {
264
+ errors.push("sandboxTimeoutMs must be a positive multiple of 1000 between 1000 and 86400000.");
265
+ }
266
+ if (config.idleTimeoutMs != null &&
267
+ (config.idleTimeoutMs < 1000 || !isMultipleOf1000(config.idleTimeoutMs))) {
268
+ errors.push("idleTimeoutMs must be a positive multiple of 1000 when provided.");
269
+ }
270
+ if (config.execTimeoutMs < 1000 || !isMultipleOf1000(config.execTimeoutMs)) {
271
+ errors.push("execTimeoutMs must be a positive multiple of 1000.");
272
+ }
273
+ if (config.blockNetwork && config.cidrAllowlist && config.cidrAllowlist.length > 0) {
274
+ errors.push("cidrAllowlist cannot be combined with blockNetwork.");
275
+ }
276
+ const hasTokenId = Boolean(config.tokenId);
277
+ const hasTokenSecret = Boolean(config.tokenSecret);
278
+ if (hasTokenId !== hasTokenSecret) {
279
+ errors.push("tokenId and tokenSecret must both be provided when either is set.");
280
+ }
281
+ else if (!hasTokenId) {
282
+ errors.push("Modal sandbox environments require tokenId and tokenSecret.");
283
+ }
284
+ if (errors.length > 0) {
285
+ return { ok: false, errors };
286
+ }
287
+ return { ok: true, normalizedConfig: { ...config } };
288
+ },
289
+ async onEnvironmentProbe(params) {
290
+ const config = parseDriverConfig(params.config);
291
+ const tags = buildSandboxTags({
292
+ companyId: params.companyId,
293
+ environmentId: params.environmentId,
294
+ reuseLease: false,
295
+ });
296
+ const client = createModalClient(config);
297
+ try {
298
+ const app = await resolveApp(client, config);
299
+ const sandbox = await createSandboxFor(client, app, config, tags);
300
+ try {
301
+ await ensureRemoteWorkspace(sandbox, config.workdir);
302
+ const proc = await sandbox.exec(["sh", "-lc", "printf evermore-probe"]);
303
+ const { stdout, exitCode } = await readProcessStreams(proc);
304
+ if (exitCode !== 0 || stdout.trim() !== "evermore-probe") {
305
+ return {
306
+ ok: false,
307
+ summary: `Modal sandbox probe failed: exit ${exitCode}, stdout=${JSON.stringify(stdout)}`,
308
+ metadata: {
309
+ provider: "modal",
310
+ sandboxId: sandbox.sandboxId,
311
+ appName: config.appName,
312
+ image: config.image,
313
+ },
314
+ };
315
+ }
316
+ return {
317
+ ok: true,
318
+ summary: `Connected to Modal sandbox in app ${config.appName}.`,
319
+ metadata: {
320
+ provider: "modal",
321
+ sandboxId: sandbox.sandboxId,
322
+ appName: config.appName,
323
+ image: config.image,
324
+ workdir: config.workdir,
325
+ sandboxTimeoutMs: config.sandboxTimeoutMs,
326
+ idleTimeoutMs: config.idleTimeoutMs,
327
+ reuseLease: config.reuseLease,
328
+ remoteCwd: config.workdir,
329
+ },
330
+ };
331
+ }
332
+ finally {
333
+ await sandbox.terminate().catch(() => undefined);
334
+ }
335
+ }
336
+ catch (error) {
337
+ return {
338
+ ok: false,
339
+ summary: "Modal sandbox probe failed.",
340
+ metadata: {
341
+ provider: "modal",
342
+ appName: config.appName,
343
+ image: config.image,
344
+ reuseLease: config.reuseLease,
345
+ error: formatErrorMessage(error),
346
+ },
347
+ };
348
+ }
349
+ finally {
350
+ client.close();
351
+ }
352
+ },
353
+ async onEnvironmentAcquireLease(params) {
354
+ const config = parseDriverConfig(params.config);
355
+ const client = createModalClient(config);
356
+ try {
357
+ const app = await resolveApp(client, config);
358
+ const tags = buildSandboxTags({
359
+ companyId: params.companyId,
360
+ environmentId: params.environmentId,
361
+ runId: params.runId,
362
+ reuseLease: config.reuseLease,
363
+ });
364
+ const sandbox = await createSandboxFor(client, app, config, tags);
365
+ try {
366
+ await ensureRemoteWorkspace(sandbox, config.workdir);
367
+ return {
368
+ providerLeaseId: sandbox.sandboxId,
369
+ metadata: leaseMetadata({
370
+ config,
371
+ sandbox,
372
+ remoteCwd: config.workdir,
373
+ resumedLease: false,
374
+ }),
375
+ };
376
+ }
377
+ catch (error) {
378
+ await sandbox.terminate().catch(() => undefined);
379
+ throw error;
380
+ }
381
+ }
382
+ finally {
383
+ // Keep the client open for the lease lifetime is unnecessary; subsequent
384
+ // calls construct their own client. Close the local handle to free
385
+ // grpc resources.
386
+ client.close();
387
+ }
388
+ },
389
+ async onEnvironmentResumeLease(params) {
390
+ const config = parseDriverConfig(params.config);
391
+ const client = createModalClient(config);
392
+ try {
393
+ const sandbox = await getSandboxOrNull(client, params.providerLeaseId);
394
+ if (!sandbox) {
395
+ return { providerLeaseId: null, metadata: { expired: true } };
396
+ }
397
+ try {
398
+ await ensureRemoteWorkspace(sandbox, config.workdir);
399
+ return {
400
+ providerLeaseId: sandbox.sandboxId,
401
+ metadata: leaseMetadata({ config, sandbox, remoteCwd: config.workdir, resumedLease: true }),
402
+ };
403
+ }
404
+ catch (error) {
405
+ // If we just resumed and workspace setup blew up, treat as a lease
406
+ // failure rather than silently terminating the user's reusable
407
+ // sandbox. Detach so the sandbox is not killed for a transient setup
408
+ // error.
409
+ void sandbox.detach();
410
+ throw error;
411
+ }
412
+ }
413
+ finally {
414
+ client.close();
415
+ }
416
+ },
417
+ async onEnvironmentReleaseLease(params) {
418
+ if (!params.providerLeaseId)
419
+ return;
420
+ const config = parseDriverConfig(params.config);
421
+ const client = createModalClient(config);
422
+ try {
423
+ const sandbox = await getSandboxOrNull(client, params.providerLeaseId);
424
+ if (!sandbox)
425
+ return;
426
+ if (config.reuseLease) {
427
+ // Modal has no separate pause primitive. Detaching releases the local
428
+ // grpc connection but leaves the sandbox running on Modal until its
429
+ // configured sandboxTimeoutMs or idleTimeoutMs expires. The next
430
+ // acquire/resume reconnects via sandboxes.fromId(providerLeaseId).
431
+ void sandbox.detach();
432
+ return;
433
+ }
434
+ await sandbox.terminate();
435
+ }
436
+ finally {
437
+ client.close();
438
+ }
439
+ },
440
+ async onEnvironmentDestroyLease(params) {
441
+ if (!params.providerLeaseId)
442
+ return;
443
+ const config = parseDriverConfig(params.config);
444
+ const client = createModalClient(config);
445
+ try {
446
+ const sandbox = await getSandboxOrNull(client, params.providerLeaseId);
447
+ if (!sandbox)
448
+ return;
449
+ await sandbox.terminate();
450
+ }
451
+ finally {
452
+ client.close();
453
+ }
454
+ },
455
+ async onEnvironmentRealizeWorkspace(params) {
456
+ const config = parseDriverConfig(params.config);
457
+ const fallback = params.workspace.remotePath ??
458
+ params.workspace.localPath ??
459
+ config.workdir;
460
+ const remoteCwd = leaseRemoteCwd(params.lease.metadata, fallback);
461
+ if (params.lease.providerLeaseId) {
462
+ const client = createModalClient(config);
463
+ try {
464
+ const sandbox = await getSandboxOrNull(client, params.lease.providerLeaseId);
465
+ if (sandbox) {
466
+ await ensureRemoteWorkspace(sandbox, remoteCwd);
467
+ }
468
+ }
469
+ finally {
470
+ client.close();
471
+ }
472
+ }
473
+ return {
474
+ cwd: remoteCwd,
475
+ metadata: { provider: "modal", remoteCwd },
476
+ };
477
+ },
478
+ async onEnvironmentExecute(params) {
479
+ if (!params.lease.providerLeaseId) {
480
+ return {
481
+ exitCode: 1,
482
+ timedOut: false,
483
+ stdout: "",
484
+ stderr: "No provider lease ID available for execution.",
485
+ };
486
+ }
487
+ const config = parseDriverConfig(params.config);
488
+ const client = createModalClient(config);
489
+ const callerTimeoutMs = params.timeoutMs != null && Number.isFinite(params.timeoutMs) && params.timeoutMs > 0
490
+ ? Math.max(1000, Math.trunc(params.timeoutMs / 1000) * 1000)
491
+ : config.execTimeoutMs;
492
+ try {
493
+ const sandbox = await getSandboxOrNull(client, params.lease.providerLeaseId);
494
+ if (!sandbox) {
495
+ return {
496
+ exitCode: 1,
497
+ timedOut: false,
498
+ stdout: "",
499
+ stderr: "Modal sandbox lease is no longer available.\n",
500
+ };
501
+ }
502
+ const stdinPath = params.stdin != null
503
+ ? `/tmp/evermore-stdin-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
504
+ : null;
505
+ try {
506
+ if (stdinPath && params.stdin != null) {
507
+ await stageStdin(sandbox, params.stdin, stdinPath);
508
+ }
509
+ const script = buildLoginShellScript({
510
+ command: params.command,
511
+ args: params.args ?? [],
512
+ cwd: params.cwd ?? config.workdir,
513
+ env: params.env,
514
+ stdinPath: stdinPath ?? undefined,
515
+ });
516
+ const proc = await sandbox.exec(["sh", "-lc", script], {
517
+ timeoutMs: callerTimeoutMs,
518
+ stdout: "pipe",
519
+ stderr: "pipe",
520
+ });
521
+ const { stdout, stderr, exitCode } = await readProcessStreams(proc);
522
+ return {
523
+ exitCode,
524
+ timedOut: false,
525
+ stdout,
526
+ stderr,
527
+ };
528
+ }
529
+ catch (error) {
530
+ if (error instanceof TimeoutError || error instanceof SandboxTimeoutError) {
531
+ return {
532
+ exitCode: null,
533
+ timedOut: true,
534
+ stdout: "",
535
+ stderr: `${formatErrorMessage(error)}\n`,
536
+ };
537
+ }
538
+ throw error;
539
+ }
540
+ finally {
541
+ if (stdinPath) {
542
+ await deleteStdinPath(sandbox, stdinPath);
543
+ }
544
+ }
545
+ }
546
+ finally {
547
+ client.close();
548
+ }
549
+ },
550
+ });
551
+ export default plugin;
552
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,YAAY,GAKb,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAiBzD,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAC9C,MAAM,0BAA0B,GAAG,SAAS,CAAC;AAC7C,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAiB1C,SAAS,mBAAmB,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,OAAO,GAAG,KAAK;SAClB,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SAC7D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAA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;oBACR,QAAQ,EAAE,KAAK;oBACf,MAAM;oBACN,MAAM;iBACP,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,YAAY,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;oBAC1E,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,QAAQ,EAAE,IAAI;wBACd,MAAM,EAAE,EAAE;wBACV,MAAM,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI;qBACzC,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;oBAAS,CAAC;gBACT,IAAI,SAAS,EAAE,CAAC;oBACd,MAAM,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ import plugin from "./plugin.js";
2
+ export default plugin;
3
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,eAAe,MAAM,CAAC"}
package/dist/worker.js ADDED
@@ -0,0 +1,5 @@
1
+ import { runWorker } from "@evermore.work/plugin-sdk";
2
+ import plugin from "./plugin.js";
3
+ export default plugin;
4
+ runWorker(plugin, import.meta.url);
5
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,eAAe,MAAM,CAAC;AACtB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@evermore.work/plugin-modal",
3
+ "version": "0.1.0",
4
+ "description": "Modal sandbox provider plugin for Evermore environments",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/phuctm97/evermore",
7
+ "bugs": {
8
+ "url": "https://github.com/phuctm97/evermore/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/phuctm97/evermore",
13
+ "directory": "packages/plugins/sandbox-providers/modal"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ }
31
+ },
32
+ "main": "./dist/index.js",
33
+ "types": "./dist/index.d.ts"
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "evermorePlugin": {
39
+ "manifest": "./dist/manifest.js",
40
+ "worker": "./dist/worker.js"
41
+ },
42
+ "keywords": [
43
+ "evermore",
44
+ "plugin",
45
+ "sandbox",
46
+ "modal"
47
+ ],
48
+ "dependencies": {
49
+ "modal": "^0.7.4",
50
+ "@evermore.work/plugin-sdk": "1.0.0"
51
+ }
52
+ }