Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/bun-microvm-code-executor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@systemfsoftware/agent-platform-bun": minor
---

Add `microVmCodeExecutorLayer` to a Bun platform package: each pass runs model-written JavaScript on Bun in a fresh hardware-isolated microVM whose network device is disabled before boot, so `NetworkDisabled` is enforced by the isolation boundary. Inside the guest the workload runs as an unprivileged user on a read-only root with one writable scratch directory, receives no host environment or credentials, and reads only host directories mounted read-only through `readOnlyMounts`. A host without hardware virtualization fails the pass with `CodeExecutorStartError`, while `NetworkAllowlist`, `cpuMillis`, and a namespace named `console` are refused with `CodeExecutorUnsupportedError`.

```ts
import { microVmCodeExecutorLayer } from '@systemfsoftware/agent-platform-bun/code-executor'
```
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# agent

Effect-native agents with durable Threads, published as eleven packages: `@systemfsoftware/agent`,
`@systemfsoftware/agent-ai-decision`, `@systemfsoftware/agent-platform-cloudflare`,
`@systemfsoftware/agent-platform-node`, `@systemfsoftware/agent-pr-review`,
Effect-native agents with durable Threads, published as twelve packages: `@systemfsoftware/agent`,
`@systemfsoftware/agent-ai-decision`, `@systemfsoftware/agent-platform-bun`,
`@systemfsoftware/agent-platform-cloudflare`, `@systemfsoftware/agent-platform-node`, `@systemfsoftware/agent-pr-review`,
`@systemfsoftware/agent-storage-cloudflare`, `@systemfsoftware/agent-storage-memory`,
`@systemfsoftware/agent-storage-postgres`, `@systemfsoftware/agent-storage-sql`,
`@systemfsoftware/agent-storage-sqlite` and `@systemfsoftware/agent-testing`, beside the private
Expand Down
10 changes: 9 additions & 1 deletion docs/src/content/docs/guide/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ JavaScript over allowlisted tools and [browser services](/guide/browser/) for we

`CodeExecutor` gives one generated program a narrow host-call capability; it does not grant
a shell. The Cloudflare adapter runs each pass in a fresh Dynamic Worker with ambient network
access disabled. Calls into application tools still require the host's current authorization.
access disabled. The Bun adapter (`@systemfsoftware/agent-platform-bun/code-executor`) runs each
pass in a fresh hardware-isolated microVM whose network device is disabled before boot; it
requires hardware virtualization (KVM on Linux, Hypervisor.framework on Apple Silicon, or
Windows Hypervisor Platform), pulls its guest image on first use, and fails the pass with
`CodeExecutorStartError` when the host cannot start a VM.
Inside the Bun guest the workload runs as an unprivileged user on a read-only root with one
writable scratch directory, receives no host environment or credentials, and can read only the
library directories the host mounts read-only. Calls into application tools still require the
host's current authorization.

Browser adapters own network access and page lifetimes separately. Their configuration controls
which destinations and browser capabilities a session can use. Keep credentials and resource
Expand Down
61 changes: 61 additions & 0 deletions packages/platform-bun/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@systemfsoftware/agent-platform-bun",
"version": "0.0.0",
"description": "Bun platform adapters for Effect Agent: an isolated microVM CodeExecutor for generated JavaScript.",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/systemfsoftware/agent.git",
"directory": "packages/platform-bun"
},
"files": [
"dist",
"src"
],
"type": "module",
"sideEffects": [],
"exports": {
".": "./src/index.ts",
"./code-executor": "./src/CodeExecutor.ts"
},
"publishConfig": {
"access": "public",
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./code-executor": {
"types": "./dist/CodeExecutor.d.mts",
"default": "./dist/CodeExecutor.mjs"
}
},
"provenance": true
},
"scripts": {
"build": "tsdown",
"typecheck": "tsc -b",
"test": "vitest run --passWithNoTests",
"test:conformance-bun": "bun run tests/__fixtures__/conformance-runner.ts",
"check:pack": "pnpm pack --pack-destination .pack && attw .pack/*.tgz --profile esm-only; s=$?; rm -rf .pack; exit $s"
},
"dependencies": {
"@systemfsoftware/agent": "workspace:*",
"microsandbox": "catalog:"
},
"devDependencies": {
"@arethetypeswrong/cli": "catalog:",
"@effect/platform-bun": "catalog:",
"@effect/platform-node": "catalog:",
"@systemfsoftware/agent-testing": "workspace:*",
"@systemfsoftware/effect-gherkin-spec": "catalog:",
"@systemfsoftware/vitest": "catalog:",
"effect": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},
"peerDependencies": {
"effect": "^4.1.0"
}
}
Loading
Loading