Development
Architecture
How the control plane, sandboxes, agent, and publishing fit together.
How the control plane, sandboxes, agent, and publishing fit together.
OneDrop is a Laravel 13 application (Inertia + React) that coordinates work happening elsewhere. It follows one rule: Laravel never holds a long-lived connection or supervises a process. Long-running work happens in the sandbox or in short, retried queue jobs.
| Piece | Where | What it does |
|---|---|---|
| Sandbox provider | app/Sandbox/SandboxProvider.php, Providers/ | Creates, execs in, and destroys sandboxes. DockerSandboxProvider locally, FakeSandboxProvider in tests. |
| Agent runner | app/Sandbox/Agents/HarnessRunner.php | Hands each run to OpenCodeRunner or ClaudeCodeRunner, which start the forwarder with the user’s key and a per-run secret. |
| Forwarder | docker/sandbox/forwarder.mjs | Runs OpenCode, Claude Code or Codex (APP_AGENT) and POSTs its JSON events to OneDrop in order. Each chat (the main one, or a task’s, named by APP_RUN) has its own run, so several can work at once; stop-agent <run> stops one. |
| File watcher | docker/sandbox/file-watcher.mjs, SandboxEventController::filesChanged | Watches /workspace with inotify and POSTs to a signed sandbox-events/{sandbox}/files address when files come or go, which bumps sandboxes.files_version. It also pushes ProjectFilesChanged to the project’s channel, so an open Files panel reloads its tree right away (without Reverb it checks the number every few seconds, a database read, not a call into the sandbox). |
| Task copies | app/Sandbox/TaskCopies.php, docker/sandbox/fork | Gives a task its own sandbox: Main’s kept paths copied at one instant (a live rsync, then a second pass with Main’s processes frozen for about a second), a task-<id> branch, and git bundles merged back on Apply or Update from Main. Nothing in it depends on the app’s stack. |
| Event translator | docker/sandbox/agent-stream.mjs, app/Sandbox/Agents/OpenCodeEvents.php, ClaudeCodeEvents.php, CodexEvents.php | In the sandbox, agent-stream.mjs reads Claude Code’s partial messages, OpenCode’s server events (opencode serve’s /event) and Codex’s app server (codex app-server), and sends them as the events opencode run --format json and codex exec --json print, plus onedrop.delta pieces of replies and thinking, with secrets replaced by [hidden]. On the server the *Events classes turn them into chat lines (“Creating src/App.tsx”, replies, errors), each step with its details (command, output, diff, thinking) in messages.detail, fetched when the step is expanded. AgentStream keeps the reply being written in the cache and sends each piece as AgentStreamed (AGT-017). |
| Host proxy | docker/sandbox/host-proxy.mjs | Rewrites Host, Origin, and Referer to localhost so any dev server accepts preview and published requests, and sends paths listed in /workspace/.onedrop/routes.json (e.g. {"/app": 8080} for Laravel Reverb) to other local servers, WebSockets included. Links to those servers’ localhost addresses are pointed at the visitor’s address too. |
| Publisher | app/Sandbox/Publishing/TailscalePublisher.php | Runs a Tailscale container per published project. |
| Live updates | app/Events/ProjectUpdated.php, app/Concerns/BroadcastsProjectChanges.php, resources/js/lib/realtime.ts | Saving a project, task, sandbox, message or share sends ProjectUpdated over Reverb on the private project.{id} channel (once per web request, after the response). The page reloads its live props; without a connection it polls. See Live updates. |
| Jobs | app/Jobs/ | CreateSandbox, RunAgentTask, PublishProject, ConfirmPublication (retries while Tailscale comes up). |
claude auth login (run out of sight by /opt/onedrop/claude-login for the chat’s sign-in panel, which types in the code the user pastes, or in the Shell), and its login lives in Claude Code’s config folder (shared per user on Docker via CLAUDE_CONFIG_DIR); the platform only asks claude auth status whether it’s signed in/workspace and run without a shell127.0.0.1See docs/plans/build-plan.md for the full plan. Notable gaps: managed sandbox providers (E2B, Daytona), pausing idle sandboxes and waking them on request, and production builds for publishing.