the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Load preset YAMLs at runtime instead of imports

Read preset files via fs using fileURLToPath to derive __dirname and
construct the presets map at runtime. Update tsconfig to use node
moduleResolution and remove the custom *.yaml type declaration.

+29 -44
+28 -38
apps/modal-sandbox/src/lib/prepare-sandbox.ts
··· 1 1 import { parse } from "@std/yaml"; 2 - import amp from "../presets/amp.yaml" with { type: "text" }; 3 - import claude from "../presets/claude.yaml" with { type: "text" }; 4 - import codex from "../presets/codex.yaml" with { type: "text" }; 5 - import copilot from "../presets/copilot.yaml" with { type: "text" }; 6 - import crush from "../presets/crush.yaml" with { type: "text" }; 7 - import cursor from "../presets/cursor.yaml" with { type: "text" }; 8 - import gemini from "../presets/gemini.yaml" with { type: "text" }; 9 - import kilo from "../presets/kilo.yaml" with { type: "text" }; 10 - import kiro from "../presets/kiro.yaml" with { type: "text" }; 11 - import mise from "../presets/mise.yaml" with { type: "text" }; 12 - import nix from "../presets/nix.yaml" with { type: "text" }; 13 - import nullclaw from "../presets/nullclaw.yaml" with { type: "text" }; 14 - import openclaw from "../presets/openclaw.yaml" with { type: "text" }; 15 - import opencode from "../presets/opencode.yaml" with { type: "text" }; 16 - import opencrust from "../presets/opencrust.yaml" with { type: "text" }; 17 - import picoclaw from "../presets/picoclaw.yaml" with { type: "text" }; 18 - import pkgx from "../presets/pkgx.yaml" with { type: "text" }; 19 - import wasmer from "../presets/wasmer.yaml" with { type: "text" }; 20 - import zeroclaw from "../presets/zeroclaw.yaml" with { type: "text" }; 2 + import { readFileSync } from "node:fs"; 3 + import { dirname, join } from "node:path"; 4 + import { fileURLToPath } from "node:url"; 21 5 import chalk from "chalk"; 22 6 import { BaseSandbox } from "../providers"; 23 7 import { type Preset, PresetSchema } from "../types/preset"; 24 8 import { consola } from "consola"; 25 9 10 + const __dirname = dirname(fileURLToPath(import.meta.url)); 11 + 12 + function readPreset(name: string): string { 13 + return readFileSync(join(__dirname, `../presets/${name}.yaml`), "utf-8"); 14 + } 15 + 26 16 const presets: Record<string, string> = { 27 - amp, 28 - claude, 29 - codex, 30 - copilot, 31 - crush, 32 - cursor, 33 - gemini, 34 - kilo, 35 - kiro, 36 - mise, 37 - nix, 38 - nullclaw, 39 - openclaw, 40 - opencode, 41 - opencrust, 42 - picoclaw, 43 - pkgx, 44 - wasmer, 45 - zeroclaw, 17 + amp: readPreset("amp"), 18 + claude: readPreset("claude"), 19 + codex: readPreset("codex"), 20 + copilot: readPreset("copilot"), 21 + crush: readPreset("crush"), 22 + cursor: readPreset("cursor"), 23 + gemini: readPreset("gemini"), 24 + kilo: readPreset("kilo"), 25 + kiro: readPreset("kiro"), 26 + mise: readPreset("mise"), 27 + nix: readPreset("nix"), 28 + nullclaw: readPreset("nullclaw"), 29 + openclaw: readPreset("openclaw"), 30 + opencode: readPreset("opencode"), 31 + opencrust: readPreset("opencrust"), 32 + picoclaw: readPreset("picoclaw"), 33 + pkgx: readPreset("pkgx"), 34 + wasmer: readPreset("wasmer"), 35 + zeroclaw: readPreset("zeroclaw"), 46 36 }; 47 37 48 38 async function prepareSandbox(sandbox: BaseSandbox, base: string) {
+1 -2
apps/modal-sandbox/tsconfig.json
··· 10 10 "allowSyntheticDefaultImports": true, 11 11 12 12 // Bundler mode 13 - "moduleResolution": "bundler", 13 + "moduleResolution": "node", 14 14 "allowImportingTsExtensions": true, 15 - "allowArbitraryExtensions": true, 16 15 "verbatimModuleSyntax": true, 17 16 "noEmit": true, 18 17
-4
apps/modal-sandbox/types/yaml.d.ts
··· 1 - declare module "*.yaml" { 2 - const content: string; 3 - export default content; 4 - }