Skip to content

feat(eve-sandbox): add a Coder workspace backend for Vercel's eve framework#12

Open
ThomasK33 wants to merge 1 commit into
mainfrom
feat/eve-sandbox
Open

feat(eve-sandbox): add a Coder workspace backend for Vercel's eve framework#12
ThomasK33 wants to merge 1 commit into
mainfrom
feat/eve-sandbox

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

What

Adds @coder/ai-sdk-eve-sandbox, a fourth package implementing Vercel eve's SandboxBackend contract so an eve agent runs its sandbox (bash/read_file/write_file/glob/grep) inside a real, long-lived Coder workspace instead of an ephemeral microVM.

// agent/sandbox.ts
import { defineSandbox } from "eve/sandbox";
import { createCoderSandboxBackend } from "@coder/ai-sdk-eve-sandbox";

export default defineSandbox({
  backend: createCoderSandboxBackend({ create: { template: "docker", preset: "Large" } }),
});

How it works

  • Thin adapter over @coder/ai-sdk-sandbox: reuses createCoderWorkspace (get-or-create, wait-for-ready, $HOME resolution, preset validation) + CoderCliTransport + CoderWorkspaceSession, and adapts the result to eve's SandboxSession. Only resolvePath/removePath/setNetworkPolicy are net-new.
  • eve and @coder/ai-sdk-sandbox both build their I/O surface on the AI SDK's Experimental_SandboxSession, so the exec/file layer maps over directly.
  • eve is a type-only peer dependency — the package imports no eve runtime values, so the repo's pinned ai/@ai-sdk/* chain is untouched (pnpm added eve to minimumReleaseAgeExclude).

Coder-specific behavior (documented in the README)

  • prewarm is a no-op — Coder templates are server-side Terraform, so there's no build-time capture and seedFiles aren't baked.
  • dispose defaults to keep (leave the workspace running for fast reattach). stop/delete apply only to per-session workspaces this backend provisions; an explicitly-named (borrowed) workspace is never torn down.
  • setNetworkPolicy can't enforce egress, so it throws on anything but allow-all unless allowUnsafeNetworkPolicy is set (credential-brokering flows such as eve's GitHub channel are unsupported here).
  • removePath guards against empty / working-dir / root targets to avoid a stray rm -rf.

Testing

  • 17 mock-transport unit tests — no live Coder or eve runtime required.
  • pnpm check (oxfmt + oxlint + typecheck across all 5 packages), pnpm build, publint, and attw all pass.

Notes / follow-ups

  • eve is in public beta (eve@0.11.5) and its sandbox interfaces may change before GA — this is a v1 adapter against a moving target.
  • Not yet exercised end-to-end against a live Coder deployment + eve app (the unit tests mock the transport).
  • Possible deeper follow-up: re-base both createCoderWorkspace and this backend on a shared, harness-free transport core so the package wouldn't transitively need @ai-sdk/harness types.
  • Wires the package into release-please, the root publint/attw scripts, and the PR-title scope allowlist.

🤖 Generated with Claude Code

New package implementing Vercel eve's `SandboxBackend` contract so eve agents
run their sandbox (bash/read/write/glob/grep) inside a Coder workspace.

- Reuses @coder/ai-sdk-sandbox (createCoderWorkspace + transport + session)
  for workspace get-or-create, wait-for-ready, and $HOME resolution; only
  resolvePath/removePath/setNetworkPolicy are added on top.
- `eve` is a type-only peer dependency, so the repo's pinned ai/@ai-sdk
  version chain is untouched (pnpm added eve to minimumReleaseAgeExclude).
- Coder-specific behavior: prewarm is a no-op (Coder templates are
  server-side, no build-time capture), setNetworkPolicy throws on
  non-allow-all unless opted out, and dispose defaults to "keep" (leave the
  workspace running for fast reattach).
- dispose "stop"/"delete" only act on workspaces this backend provisions per
  session; an explicitly-named (borrowed) workspace is never torn down.
- removePath refuses empty / working-dir / root targets to avoid a stray rm -rf.
- CI now builds before typecheck/test: this is the first package that depends
  on a sibling workspace package, whose types/output resolve from its built
  dist (pnpm -r build is topological, so deps build first).
- 17 mock-transport tests; typecheck, build, oxlint, oxfmt, publint, and attw
  all pass. Wired into release-please, the PR-title scope check, and root
  publint/attw scripts.

Change-Id: I269d55246c0ea6cad806d54b88afafb21f579059
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant