{"_id":"@byggflow/sandbox","_rev":"5-5b34b8b1f761aaeb3aef08bd23730428","name":"@byggflow/sandbox","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@byggflow/sandbox","version":"0.0.1","_id":"@byggflow/sandbox@0.0.1","maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"dist":{"shasum":"c8c5a87c07b56a6713cd01cf1e5626c2c013f35e","tarball":"https://registry.npmjs.org/@byggflow/sandbox/-/sandbox-0.0.1.tgz","fileCount":7,"integrity":"sha512-cplsv/dsc9h0mYRBTGr9Hwg8bfjkEurp6Qo9bFQ9sTXg/NZvqTQzSXWIVOAWQ2T5kXeDeJYYoCN0BqAUqXNfAg==","signatures":[{"sig":"MEYCIQCay50Fu97ZKszYarrPaBLlczZBmOvoQxENUq+FTZSrggIhAMqwir97aG19L6FCmGIyGW+j3jzrCwHh0VE30KO8q6Xb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":176887},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"test":"bunx --bun vitest run","build":"tsup"},"_npmUser":{"name":"ch99q","email":"64793a1a@gmail.com"},"_npmVersion":"10.8.2","description":"TypeScript SDK for sandboxd","directories":{},"_nodeVersion":"22.6.0","dependencies":{"@noble/curves":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"latest","@types/node":"^22"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/sandbox_0.0.1_1775654762576_0.09030740486926314","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@byggflow/sandbox","version":"0.0.2","_id":"@byggflow/sandbox@0.0.2","maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"dist":{"shasum":"7eb0c08baae3b685fbe620d21f6eaed92e37a540","tarball":"https://registry.npmjs.org/@byggflow/sandbox/-/sandbox-0.0.2.tgz","fileCount":8,"integrity":"sha512-mDRE5hzf6IU/ORx41zYxRHTEE3S7jzjLNl1Vr4DtFSM8NMq/fXAQb/7As6EDFxp4oySJZc7sXfsvVNRn3xWSAg==","signatures":[{"sig":"MEUCIQC/VkL+GfV4V4uoGErU3xVZE6wBQGEwmgt/Lgx832032AIgTPpv2lZ/8z81NQrPvz+1mEDGbkO+S342B467B42hXD4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":184546},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"88942477cf221e9abac7180599cb219e9903523e","scripts":{"test":"bunx --bun vitest run","build":"tsup"},"_npmUser":{"name":"ch99q","email":"64793a1a@gmail.com"},"_npmVersion":"10.8.2","description":"TypeScript SDK for sandboxd","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@noble/curves":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"latest","@types/node":"^22"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/sandbox_0.0.2_1775656056035_0.2960368944015197","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@byggflow/sandbox","version":"0.0.3","_id":"@byggflow/sandbox@0.0.3","maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"dist":{"shasum":"79e40e2dee219332097316ebfcd04cd9d2dd833c","tarball":"https://registry.npmjs.org/@byggflow/sandbox/-/sandbox-0.0.3.tgz","fileCount":8,"integrity":"sha512-1FUhio3nCSqGqH23+F6t1exXY7HRF3+gnzGgzWuyd5oImjZRsz1KPSkHZYk8jvjDRXYpe63+9xFmUx9GR47opg==","signatures":[{"sig":"MEYCIQCLzLO82b/ckqkFj11x1UIPIWn7A/BZqo/7nv2xjob+lgIhAL3a2wTQaztPLkKA5ImIBJBmyZU8BITiNE26k1HdsoX7","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":184546},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"88942477cf221e9abac7180599cb219e9903523e","scripts":{"test":"bunx --bun vitest run","build":"tsup"},"_npmUser":{"name":"ch99q","email":"64793a1a@gmail.com"},"_npmVersion":"10.8.2","description":"TypeScript SDK for sandboxd","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@noble/curves":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"latest","@types/node":"^22"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/sandbox_0.0.3_1775819214257_0.5475815066139724","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@byggflow/sandbox","version":"0.0.4","_id":"@byggflow/sandbox@0.0.4","maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"dist":{"shasum":"f125083817a1ff7a0585e11120e83cb0da1dfb30","tarball":"https://registry.npmjs.org/@byggflow/sandbox/-/sandbox-0.0.4.tgz","fileCount":8,"integrity":"sha512-YlN8GxQPZj+DmJnB0db9j0yffRFjTxP+QNyfuzmOiZIgyWPesQs1FUmBJE7WuxqSg0QGnj9S6p6JLW2HQVReKg==","signatures":[{"sig":"MEUCICuP23KXcjCppS25QJBYXaZ+4PsLTZ0bLKOqxjUIDb44AiEArWAjNYIc9yRJXK0RkqP5BWMWD2QecOrT03e+wH3xcMI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":185739},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"925d8299064743f1ce45aa23b871ab1c075ee03f","scripts":{"test":"bunx --bun vitest run","build":"tsup"},"_npmUser":{"name":"ch99q","email":"64793a1a@gmail.com"},"_npmVersion":"10.8.2","description":"TypeScript SDK for sandboxd","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@noble/curves":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"latest","@types/node":"^22"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/sandbox_0.0.4_1775819366585_0.11565697952207876","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@byggflow/sandbox","version":"0.0.5","description":"TypeScript SDK for sandboxd","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsup","test":"bunx --bun vitest run","test:node":"npx vitest run","test:deno":"deno test --no-check -A src/compat/deno_test.ts","test:all":"bun run test && bun run test:node && bun run test:deno"},"devDependencies":{"@types/node":"^22","tsup":"^8","vitest":"latest"},"peerDependencies":{"typescript":"^5"},"dependencies":{"@noble/curves":"^2.0.1"},"_id":"@byggflow/sandbox@0.0.5","gitHead":"30c6545191e3f02c232f0c4f971934938ab52031","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-K77V/FjO8p8amoGWVBQ7oNjYjrqYBOr2tt5poHWmDRMPZ02I7bIDhitRrvwwoJw3FJz4TX0Uso5S6HjeM9txhw==","shasum":"fcbcd0726a026d57aa28f5644a9baefe021eba09","tarball":"https://registry.npmjs.org/@byggflow/sandbox/-/sandbox-0.0.5.tgz","fileCount":12,"unpackedSize":231807,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC2cs6r77EEbGAA11YJiiR4LEYE4y7PQUWi5jgcn2/JkgIgWykN45LCysvD6QS82u6YLH8pvodHW2KhnaBRXWRp15I="}]},"_npmUser":{"name":"ch99q","email":"64793a1a@gmail.com"},"directories":{},"maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sandbox_0.0.5_1776185636104_0.6477974594054872"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-08T13:26:02.430Z","modified":"2026-04-14T16:53:56.369Z","0.0.1":"2026-04-08T13:26:02.790Z","0.0.2":"2026-04-08T13:47:36.171Z","0.0.3":"2026-04-10T11:06:54.466Z","0.0.4":"2026-04-10T11:09:26.793Z","0.0.5":"2026-04-14T16:53:56.241Z"},"description":"TypeScript SDK for sandboxd","maintainers":[{"name":"ch99q","email":"64793a1a@gmail.com"}],"readme":"# @byggflow/sandbox\n\nTypeScript SDK for [sandboxd](https://github.com/byggflow/sandbox) -- create and manage isolated sandboxes with filesystem, process execution, environment variable, and network access. Works on Node, Bun, and Deno.\n\n## Install\n\n```sh\n# npm\nnpm install @byggflow/sandbox\n\n# JSR (Deno, Bun, or npm via npx)\nnpx jsr add @byggflow/sandbox\n```\n\n## Quick start\n\n```ts\nimport { createSandbox } from \"@byggflow/sandbox\";\n\n// Connects to /var/run/sandboxd/sandboxd.sock by default\nconst sbx = await createSandbox();\n\nawait sbx.fs.write(\"/root/main.py\", \"print('hello')\");\nconst result = await sbx.process.exec(\"python /root/main.py\");\nconsole.log(result.stdout); // \"hello\\n\"\n\nawait sbx.close();\n```\n\nFor remote deployments, pass an explicit endpoint:\n\n```ts\nconst sbx = await createSandbox({\n  endpoint: \"https://sandbox.example.com\",\n  auth: \"your-api-token\",\n});\n```\n\n## Streaming output\n\n```ts\nconst handle = sbx.process.streamExec(\"python /root/train.py\");\nfor await (const event of handle.output) {\n  process.stdout.write(event.data);\n}\nconst code = await handle.exitCode;\n```\n\n## Port tunneling\n\n```ts\n// Path-based proxy URL (no allocation, works immediately)\nconst url = sbx.net.url(3000);\n\n// Dedicated host port (waits for port readiness)\nconst tunnel = await sbx.net.expose(8080);\nconsole.log(tunnel.url); // \"http://host:assigned-port\"\n\nconst ports = await sbx.net.ports();\nawait sbx.net.close(8080);\n```\n\n## Connect to an existing sandbox\n\n```ts\nimport { connectSandbox } from \"@byggflow/sandbox\";\n\nconst sbx = await connectSandbox(\"sandbox-id\", {\n  endpoint: \"https://sandbox.example.com\",\n  auth: \"your-api-token\",\n});\n```\n\n## Templates\n\n```ts\nimport { templates } from \"@byggflow/sandbox\";\n\nconst mgr = templates({ endpoint: \"https://sandbox.example.com\", auth: \"your-api-token\" });\nconst list = await mgr.list();\n```\n\n## End-to-end encryption\n\n```ts\nconst sbx = await createSandbox({ encrypted: true });\n```\n\nThe SDK and guest agent perform a key exchange (X25519). JSON-RPC payloads are encrypted (AES-256-GCM) before leaving the client, covering command arguments, environment values, file paths, and RPC results. Binary file transfer frames (used by `fs.read`, `fs.write`, `fs.upload`, `fs.download`) are not yet encrypted and are forwarded in cleartext by the daemon.\n\n## Sandbox capabilities\n\n| Category | Operations |\n|---|---|\n| **fs** | `read`, `write`, `list`, `stat`, `remove`, `rename`, `mkdir`, `upload`, `download` |\n| **process** | `exec`, `streamExec`, `spawn`, `pty` |\n| **env** | `get`, `set`, `delete`, `list` |\n| **net** | `fetch`, `url`, `expose`, `close`, `ports` |\n| **template** | `save` |\n\n## License\n\n[MIT](https://github.com/byggflow/sandbox/blob/main/LICENSE)\n","readmeFilename":"README.md"}