Skip to content

Commit 1a11ede

Browse files
authored
docs: refresh current-state execbox docs (#10)
1 parent 1ed02c6 commit 1a11ede

10 files changed

Lines changed: 120 additions & 120 deletions

File tree

docs/architecture/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This doc set is for two audiences:
1414
- Read [execbox-executors.md](./execbox-executors.md) for QuickJS, process, worker-thread, and `isolated-vm` trade-offs.
1515
- Read [execbox-mcp-and-protocol.md](./execbox-mcp-and-protocol.md) for MCP wrapping and where `execbox-protocol` fits.
1616
- Read [execbox-remote-workflow.md](./execbox-remote-workflow.md) for the end-to-end remote execution control flow.
17-
- Read [execbox-protocol-reference.md](./execbox-protocol-reference.md) for the current protocol message catalog and session rules.
17+
- Read [execbox-protocol-reference.md](./execbox-protocol-reference.md) for the protocol message catalog and session rules.
1818
- Read [execbox-runner-specification.md](./execbox-runner-specification.md) for the normative runner specification for non-TypeScript runners.
1919

2020
## Package Map
@@ -45,17 +45,17 @@ flowchart LR
4545
WORKER --> QJS
4646
```
4747

48-
### Package Roles Today
48+
### Package Roles
4949

50-
| Package | Role |
51-
| ---------------------- | -------------------------------------------------------------------------------------------------- |
52-
| `@execbox/core` | Core types, provider resolution, shared runner semantics, and MCP adapters |
53-
| `@execbox/quickjs` | Default executor backend using a fresh QuickJS runtime per execution and a reusable QuickJS runner |
54-
| `@execbox/remote` | Transport-backed executor that reuses the QuickJS protocol endpoint across an app-defined boundary |
55-
| `@execbox/process` | Child-process executor that runs the QuickJS session behind Node IPC |
56-
| `@execbox/isolated-vm` | Alternate executor backend using a fresh `isolated-vm` context and a reusable isolated-vm runner |
57-
| `@execbox/protocol` | Transport-safe execution messages plus the shared host session used by worker/process executors |
58-
| `@execbox/worker` | Worker-thread executor that runs the QuickJS session behind a message boundary |
50+
| Package | Role |
51+
| ---------------------- | ------------------------------------------------------------------------------------------------------------ |
52+
| `@execbox/core` | Core types, provider resolution, shared runner semantics, and MCP adapters |
53+
| `@execbox/quickjs` | Default executor backend using a fresh QuickJS runtime per execution and a reusable QuickJS runner |
54+
| `@execbox/remote` | Transport-backed executor that reuses the QuickJS protocol endpoint across an app-defined boundary |
55+
| `@execbox/process` | Child-process executor that runs the QuickJS session behind Node IPC with pooled shells by default |
56+
| `@execbox/isolated-vm` | Alternate executor backend using a fresh `isolated-vm` context and a reusable isolated-vm runner |
57+
| `@execbox/protocol` | Transport-safe execution messages, shared host sessions, and reusable resource pools |
58+
| `@execbox/worker` | Worker-thread executor that runs the QuickJS session behind a message boundary with pooled shells by default |
5959

6060
## End-to-End Execution Model
6161

@@ -108,6 +108,6 @@ Key implications:
108108
- 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.
109109
- Wrapping third-party MCP servers is a separate dependency-trust decision from letting end users author guest code.
110110

111-
## Current Architecture in One Paragraph
111+
## Architecture In One Paragraph
112112

113-
Today, `@execbox/core` owns the stable execution contract, provider resolution, shared runner semantics, and MCP adapters. `@execbox/quickjs` and `@execbox/isolated-vm` each expose a runtime-specific reusable runner. `@execbox/process`, `@execbox/worker`, and `@execbox/remote` are transport adapters around the shared QuickJS protocol endpoint, while `@execbox/protocol` owns the transport boundary: message shapes plus the shared host session used to drive transport-backed execution without copying executor semantics.
113+
`@execbox/core` owns the stable execution contract, provider resolution, shared runner semantics, and MCP adapters. `@execbox/quickjs` and `@execbox/isolated-vm` each expose a runtime-specific reusable runner. `@execbox/process`, `@execbox/worker`, and `@execbox/remote` are transport adapters around the shared QuickJS protocol endpoint, while `@execbox/protocol` owns the transport boundary: message shapes, shared host sessions, and reusable resource pools for transport-backed execution.

docs/architecture/execbox-core.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The practical effect is that all executors can treat guest code as “an async f
7979

8080
## Shared Runner Semantics
8181

82-
The core package now also owns the small runner-level contract that sits between resolved providers and runtime-specific runners.
82+
The core package owns the small runner-level contract that sits between resolved providers and runtime-specific runners.
8383

8484
That contract is intentionally transport-neutral:
8585

@@ -106,7 +106,7 @@ This seam is what lets execbox share semantics across:
106106

107107
- the in-process QuickJS executor
108108
- the in-process `isolated-vm` executor
109-
- the worker-backed QuickJS executor
109+
- transport-backed executors that reuse the same manifest and dispatcher model through `@execbox/protocol`
110110

111111
without forcing every runtime through the same transport implementation.
112112

@@ -194,7 +194,7 @@ The core package does not own QuickJS, `isolated-vm`, worker threads, or transpo
194194
- direct in-process runtimes
195195
- worker-backed runtimes
196196
- MCP wrapper servers
197-
- future process or remote execution models
197+
- process or remote execution models
198198

199199
The consequence is deliberate separation between:
200200

docs/architecture/execbox-executors.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,31 @@ flowchart LR
4545
THREAD --> RUNNER
4646
```
4747

48-
## QuickJS Today
48+
## QuickJS
4949

5050
`QuickJsExecutor` is the default reference implementation for execbox. It uses the shared runner semantics from `@execbox/core`: providers are converted to manifests, host tool calls are dispatched through the shared dispatcher helper, and the reusable QuickJS runner turns them back into guest-visible async functions.
5151

5252
That design gives QuickJS two useful properties:
5353

5454
- the runtime semantics are centralized in one runner implementation
55-
- the same guest/tool-call model can be reused behind a worker or future transport boundary
55+
- the same guest/tool-call model can be reused behind worker, process, and remote transport boundaries
5656

57-
## isolated-vm Today
57+
## isolated-vm
5858

59-
`IsolatedVmExecutor` now follows the same high-level runner contract as QuickJS, but keeps its native bridge internally. The reusable `runIsolatedVmSession()` runner accepts manifests and an `onToolCall` callback, then implements the runtime-specific bridge with `setSync()` / `applySyncPromise()` inside the `isolated-vm` context.
59+
`IsolatedVmExecutor` follows the same high-level runner contract as QuickJS, but keeps its native bridge internally. The reusable `runIsolatedVmSession()` runner accepts manifests and an `onToolCall` callback, then implements the runtime-specific bridge with `setSync()` / `applySyncPromise()` inside the `isolated-vm` context.
6060

6161
That means:
6262

63-
- it does not currently depend on `execbox-protocol`
63+
- it does not depend on `execbox-protocol`
6464
- it avoids the extra message loop used by worker-backed execution
6565
- its runtime-specific bridge logic still lives in the executor package itself
66-
- it is now aligned with the same runner-level shape used by QuickJS and worker-backed execution
66+
- it aligns to the same runner-level shape used by QuickJS and transport-backed execution
6767

68-
This is a cleaner maintainability point than the previous design: the package still keeps the native bridge where it belongs, but the executor no longer owns a separate copy of the host-side manifest and tool-dispatch semantics.
68+
The package keeps its native bridge where it belongs while still sharing the same host-side manifest and tool-dispatch model as the other executors.
6969

7070
## Worker-Backed QuickJS
7171

72-
`WorkerExecutor` uses a worker thread for lifecycle isolation, but it does not invent a second scripting model. It loads the same QuickJS session runner used by the in-process QuickJS executor, reuses the shared QuickJS protocol endpoint inside the worker, and uses the shared `execbox-protocol` host session on the parent side. By default it keeps a worker shell warm between executions; `mode: "ephemeral"` restores the old fresh-worker-per-call lifecycle.
72+
`WorkerExecutor` uses a worker thread for lifecycle isolation, but it does not invent a second scripting model. It loads the same QuickJS session runner used by the in-process QuickJS executor, reuses the shared QuickJS protocol endpoint inside the worker, and uses the shared `execbox-protocol` host session on the parent side. By default it keeps a worker shell warm between executions; `mode: "ephemeral"` switches to a fresh worker per execution.
7373

7474
```mermaid
7575
sequenceDiagram
@@ -90,7 +90,7 @@ sequenceDiagram
9090

9191
## Process-Backed QuickJS
9292

93-
`ProcessExecutor` uses the same message-driven model as the worker executor, but runs it behind a child-process boundary. It loads the same QuickJS session runner used by the in-process QuickJS executor, reuses the same QuickJS protocol endpoint inside the child, and uses the shared `execbox-protocol` host session on the parent side. By default it keeps a child-process shell warm between executions; `mode: "ephemeral"` restores the old fresh-child-per-call lifecycle.
93+
`ProcessExecutor` uses the same message-driven model as the worker executor, but runs it behind a child-process boundary. It loads the same QuickJS session runner used by the in-process QuickJS executor, reuses the same QuickJS protocol endpoint inside the child, and uses the shared `execbox-protocol` host session on the parent side. By default it keeps a child-process shell warm between executions; `mode: "ephemeral"` switches to a fresh child process per execution.
9494

9595
```mermaid
9696
sequenceDiagram
@@ -123,12 +123,12 @@ The four executors expose the same public result shape, but they enforce limits
123123
## Security and Operational Trade-offs
124124

125125
- All four executors are documented as best-effort isolation, not hard hostile-code boundaries.
126-
- QuickJS is the easiest operational default and has the cleanest shared runtime story today.
126+
- QuickJS is the easiest operational default and has the cleanest shared runtime story.
127127
- Remote execution keeps the same executor API while moving the runtime behind an app-defined boundary, but execbox deliberately does not ship the network stack for you.
128128
- Process-backed QuickJS gives a stronger lifecycle split than worker threads, but it is still not equivalent to a container or VM boundary.
129129
- `isolated-vm` is the most specialized option and carries the most environment-specific operational requirements.
130130
- Worker-backed QuickJS improves lifecycle isolation and hard-stop behavior, but not process-level trust isolation.
131-
- Worker and process executors now share the same host-session and child-endpoint semantics, so most behavioral differences come from the transport boundary rather than from duplicated executor logic.
131+
- Worker and process executors share the same host-session and child-endpoint semantics, so most behavioral differences come from the transport boundary rather than from duplicated executor logic.
132132

133133
## Pooled QuickJS Shells
134134

@@ -170,7 +170,7 @@ If all shells are busy and the pool is already at `maxSize`, the next `acquire()
170170

171171
### Early Exit Handling
172172

173-
Pooling exposed a transport race that did not matter in the old one-shot model: a child or worker could exit before the host session subscribed to close events. The pooled transport wrappers now retain the first close reason and replay it to later `onClose(...)` subscribers, so an early shell death still resolves as `internal_error` instead of hanging the execution.
173+
In pooled mode, a child or worker can exit before the host session subscribes to close events. The pooled transport wrappers retain the first close reason and replay it to later `onClose(...)` subscribers, so an early shell death still resolves as `internal_error` instead of hanging the execution.
174174

175175
### What Is Not Pooled
176176

0 commit comments

Comments
 (0)