|
| 1 | +# Execbox Architecture Overview |
| 2 | + |
| 3 | +Execbox is the code-execution part of the `execbox` workspace. It turns host tool catalogs into callable guest namespaces, lets those namespaces wrap MCP tools, and pairs with executor packages that decide where and how guest JavaScript runs. |
| 4 | + |
| 5 | +This doc set is for two audiences: |
| 6 | + |
| 7 | +- integrators choosing packages and deployment shapes |
| 8 | +- contributors reasoning about package boundaries, control flow, and trade-offs |
| 9 | + |
| 10 | +## Reading guide |
| 11 | + |
| 12 | +- Start here for the package map, trust model, and overall flow. |
| 13 | +- Read [Core](/architecture/execbox-core) for provider resolution, execution contracts, and error handling. |
| 14 | +- Read [Executors](/architecture/execbox-executors) for QuickJS, process, worker-thread, and `isolated-vm` trade-offs. |
| 15 | +- Read [MCP And Protocol](/architecture/execbox-mcp-and-protocol) for MCP wrapping and where `execbox-protocol` fits. |
| 16 | +- Read [Remote Workflow](/architecture/execbox-remote-workflow) for the end-to-end remote execution control flow. |
| 17 | +- Read [Protocol Reference](/architecture/execbox-protocol-reference) for the protocol message catalog and session rules. |
| 18 | +- Read [Runner Specification](/architecture/execbox-runner-specification) for the normative runner specification for non-TypeScript runners. |
| 19 | + |
| 20 | +## Package map |
| 21 | + |
| 22 | +```mermaid |
| 23 | +flowchart LR |
| 24 | + APP["Host application"] |
| 25 | + CORE["@execbox/core<br/>provider resolution + runner semantics + MCP adapters"] |
| 26 | + QJS["@execbox/quickjs<br/>in-process QuickJS executor + reusable runner"] |
| 27 | + REM["@execbox/remote<br/>transport-backed remote executor"] |
| 28 | + PROC["@execbox/process<br/>child-process QuickJS executor"] |
| 29 | + IVM["@execbox/isolated-vm<br/>in-process isolated-vm executor + reusable runner"] |
| 30 | + PROTO["@execbox/protocol<br/>transport messages + shared host session"] |
| 31 | + WORKER["@execbox/worker<br/>worker-thread QuickJS executor"] |
| 32 | + MCP["MCP sources and wrapped servers"] |
| 33 | +
|
| 34 | + APP --> CORE |
| 35 | + APP --> QJS |
| 36 | + APP --> REM |
| 37 | + APP --> PROC |
| 38 | + APP --> IVM |
| 39 | + APP --> WORKER |
| 40 | + CORE --> MCP |
| 41 | + REM --> PROTO |
| 42 | + PROC --> PROTO |
| 43 | + WORKER --> PROTO |
| 44 | + PROC --> QJS |
| 45 | + WORKER --> QJS |
| 46 | +``` |
| 47 | + |
| 48 | +## End-to-end execution model |
| 49 | + |
| 50 | +At a high level, execbox always follows the same model: |
| 51 | + |
| 52 | +1. Host code defines or discovers tools. |
| 53 | +2. `@execbox/core` resolves those tools into a deterministic guest namespace. |
| 54 | +3. An executor runs guest JavaScript against that resolved namespace. |
| 55 | +4. Guest tool calls cross a host-controlled boundary and return structured JSON-compatible results. |
| 56 | + |
| 57 | +## Trust model and security posture |
| 58 | + |
| 59 | +Execbox reduces accidental exposure, but it does not claim a hard security boundary for hostile code in its default deployment model. |
| 60 | + |
| 61 | +Key implications: |
| 62 | + |
| 63 | +- The real capability boundary is the provider/tool surface, not the JavaScript syntax itself. |
| 64 | +- Fresh runtimes, schema validation, JSON-only boundaries, timeouts, memory limits, and bounded logs are defense-in-depth features. |
| 65 | +- In-process execution still shares the host process. Use a separate process, container, VM, or similar boundary when the code source is hostile or multi-tenant. |
| 66 | +- Wrapping third-party MCP servers is a separate dependency-trust decision from letting end users author guest code. |
0 commit comments