Skip to content

Commit 1c37bf4

Browse files
committed
docs: update backend references to worker-shell and worker-javascript
Rename WorkerBackend to WorkerShellBackend and IsolateJavaScriptBackend to WorkerJavaScriptBackend throughout the design docs, along with the backends/worker-shell and backends/worker-javascript import subpaths and the worker-shell and worker-javascript selector ids.
1 parent a725dc1 commit 1c37bf4

11 files changed

Lines changed: 47 additions & 47 deletions

docs/05_runtime_interface.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ interface WorkspaceRuntimeResult {
6262
}
6363
```
6464

65-
Command backends leave `value` unset. `isolate-javascript` uses `value` for the module's structured return value and reports a zero-entry completed sync. A command can complete while its post-command pull fails; in that case `sync.status` is `"pending"`, and a configured `SyncRetryScheduler` can durably retry the pull without rerunning the command.
65+
Command backends leave `value` unset. `worker-javascript` uses `value` for the module's structured return value and reports a zero-entry completed sync. A command can complete while its post-command pull fails; in that case `sync.status` is `"pending"`, and a configured `SyncRetryScheduler` can durably retry the pull without rerunning the command.
6666

6767
## Backend routing
6868

6969
```ts
7070
await workspace.runtime.exec("grep -R TODO .", {
71-
backend: "isolate-shell",
71+
backend: "worker-shell",
7272
});
7373

7474
await workspace.runtime.exec("npm test", {
@@ -80,7 +80,7 @@ await workspace.runtime.exec(
8080
import fs from "node:fs/promises";
8181
export default async () => fs.readFile("/workspace/package.json", "utf8");
8282
`,
83-
{ backend: "isolate-javascript" },
83+
{ backend: "worker-javascript" },
8484
);
8585
```
8686

@@ -94,16 +94,16 @@ Command backends continue to use the existing synchronization bracket:
9494
push → spawn → events/result → pull
9595
```
9696

97-
A backend with `sync: "none"`, such as `isolate-shell`, shares the host store and reports zero push/pull counts. A Container has its own VFS and synchronizes changes before and after command execution. Fully draining either `result()` or the event stream completes the post-command pull before the stream closes.
97+
A backend with `sync: "none"`, such as `worker-shell`, shares the host store and reports zero push/pull counts. A Container has its own VFS and synchronizes changes before and after command execution. Fully draining either `result()` or the event stream completes the post-command pull before the stream closes.
9898

9999
Module backends use host capability calls against the authoritative Workspace and therefore require no push/pull round trip.
100100

101101
## Lifecycle differences
102102

103103
`container-shell` provides computerd's retained process log, replay, signals, and disposal.
104104

105-
`isolate-javascript` provides a Workspace-owned execution journal, retained result/events, host cancellation, and explicit disposal. Active Workers cannot be serialized across host restart; orphaned running records are reconciled to failed.
105+
`worker-javascript` provides a Workspace-owned execution journal, retained result/events, host cancellation, and explicit disposal. Active Workers cannot be serialized across host restart; orphaned running records are reconciled to failed.
106106

107-
`isolate-shell` intentionally preserves one-call, buffered-result behavior in this release. It does not retain executions for later reattachment or disposal. `timeoutMs` and a concurrent `killExec()` for a caller-supplied execution ID cooperatively abort just-bash at statement boundaries; by the time an ordinary `exec()` promise returns, the command has already settled. Use the Container or JavaScript isolate when detached execution and retained lifecycle are required.
107+
`worker-shell` intentionally preserves one-call, buffered-result behavior in this release. It does not retain executions for later reattachment or disposal. `timeoutMs` and a concurrent `killExec()` for a caller-supplied execution ID cooperatively abort just-bash at statement boundaries; by the time an ordinary `exec()` promise returns, the command has already settled. Use the Container or JavaScript isolate when detached execution and retained lifecycle are required.
108108

109109
See [16. Execution runtime architecture](./16_code_execution.md) and [17. Isolate JavaScript](./17_isolate_javascript.md).

docs/09_tool_interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ When assigning the same instance to `Think.workspace`, construct it with `useThi
5555
const workspace = new Workspace({
5656
storage: ctx.storage,
5757
backends: [
58-
new WorkerBackend({ id: "shell", /* ... */ }),
58+
new WorkerShellBackend({ id: "shell", /* ... */ }),
5959
new CloudflareContainerBackend({ id: "container", /* ... */ }),
6060
],
6161
});

docs/10_project_layout.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Runnable examples live at the repo root, not inside any package:
199199
```
200200
examples/
201201
├── container/ # Reference container image for computerd
202-
├── worker/ # WorkerBackend example
202+
├── worker-shell/ # WorkerShellBackend example
203203
├── code/ # workspace.runtime with Worker and Container shells
204204
└── think/ # @cloudflare/think integration
205205
```
@@ -210,7 +210,7 @@ so each example can declare its own dependencies and scripts.
210210
## Testing
211211

212212
- **Unit tests live next to source.** Packages follow the `foo.ts` + `foo.test.ts` convention.
213-
- **Workerd integration tests** for WorkerBackend, Workspace RPC, and `workspace.runtime` live in `packages/computer/tests/` with dedicated Vitest and Wrangler configuration.
213+
- **Workerd integration tests** for WorkerShellBackend, Workspace RPC, and `workspace.runtime` live in `packages/computer/tests/` with dedicated Vitest and Wrangler configuration.
214214
- **Container and load harness tests** live in `packages/computer/test-harness/`:
215215
- `end-to-end.test.ts` — DO ↔ container round-trip
216216
- `shell.test.ts` — shell surface against a real backend

docs/12_worker_backend.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> [!NOTE]
44
> This doc reflects shipped code in
5-
> `packages/computer/src/backends/worker/`. The example deployment
5+
> `packages/computer/src/backends/worker-shell/`. The example deployment
66
> lives at `examples/worker/`.
77
88
The worker backend is the second `WorkspaceBackend` shape the
@@ -17,7 +17,7 @@ Import via the sub-path so the bundled just-bash payload tree-shakes
1717
out of consumers that don't use it:
1818

1919
```ts
20-
import { WorkerBackend } from "@cloudflare/computer/backends/worker";
20+
import { WorkerShellBackend } from "@cloudflare/computer/backends/worker-shell";
2121
```
2222

2323
## When to reach for it
@@ -32,7 +32,7 @@ isolate that boots instantly, scales out cheaply, and has no
3232
container lifecycle. The shell is the just-bash interpreter; the
3333
supported command set is broad (`cat`, `grep`, `awk`, `sed`, `jq`,
3434
`sort`) but not the full Linux userland. JavaScript modules run through the
35-
[`isolate-javascript` backend](./17_isolate_javascript.md), not through just-bash's
35+
[`worker-javascript` backend](./17_isolate_javascript.md), not through just-bash's
3636
Node-only language commands. Filesystem operations forward into the same
3737
SQLite store as the container backend, so the storage shape, mount
3838
rules, and read-only enforcement are unchanged.
@@ -55,7 +55,7 @@ Reach for the container backend when the agent runs `npm`, a real language runti
5555
agent code
5656
│ Workers RPC
5757
58-
host DO ─── Workspace ─── WorkerBackend
58+
host DO ─── Workspace ─── WorkerShellBackend
5959
6060
│ env.LOADER.get(loaderId, codeCallback)
6161
│ .getEntrypoint("ShellWorker")
@@ -158,7 +158,7 @@ they already handle.
158158

159159
## Fetcher factory escape hatch
160160

161-
`WorkerBackend` is source-agnostic. The common case takes
161+
`WorkerShellBackend` is source-agnostic. The common case takes
162162
`{ loader, workspace, ctx }` and builds the loader callback
163163
itself. For deployments that need a different Fetcher source — a
164164
Workers service binding, a Workers-for-Platforms dispatch
@@ -219,7 +219,7 @@ export class MyAgent extends DurableObject<Env> {
219219
storage: ctx.storage,
220220
sessionId: ctx.id.toString(),
221221
artifacts: { binding: env.ARTIFACTS },
222-
backends: [new WorkerBackend(/* ... */)],
222+
backends: [new WorkerShellBackend(/* ... */)],
223223
});
224224
}
225225
}
@@ -250,15 +250,15 @@ network-bound `git` subcommands do. See
250250
`/c/<name>/file/...` and `/c/<name>/exec` routes the container
251251
example also exposes).
252252
- No Dockerfile, no build script. The shell bundle ships with
253-
`@cloudflare/computer/backends/worker` as `SHELL_MODULES`
253+
`@cloudflare/computer/backends/worker-shell` as `SHELL_MODULES`
254254
(a record of module name → source covering the entry plus
255255
every code-split chunk); the backend hands the whole record
256256
to the Loader callback itself.
257257

258258
The DO's backend wiring fits in three lines:
259259

260260
```ts
261-
new WorkerBackend({
261+
new WorkerShellBackend({
262262
loader: env.LOADER,
263263
workspace: { binding: "ContainerExample", id: ctx.id.toString() },
264264
ctx,

docs/13_git_interface.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [!NOTE]
44
> This doc describes shipped code in `packages/computer/src/git/`
55
> and the `git` custom command in
6-
> `packages/computer/src/backends/worker/`. Everything below
6+
> `packages/computer/src/backends/worker-shell/`. Everything below
77
> works today.
88
99
`workspace.git` is a major typed surface on `Workspace`, alongside `fs`, `runtime`, Assets, and Artifacts. It runs every operation against the
@@ -1065,7 +1065,7 @@ commands receive the live host stub the shell already reached,
10651065
so they share its lifetime without refetching.
10661066

10671067
```ts
1068-
import { ShellWorker, defineGitCommand } from "@cloudflare/computer/backends/worker";
1068+
import { ShellWorker, defineGitCommand } from "@cloudflare/computer/backends/worker-shell";
10691069
import { type CustomCommand } from "just-bash";
10701070

10711071
class MyShell extends ShellWorker {

docs/14_assets_interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ client when constructing the `Workspace`:
3434
```ts
3535
const ws = new Workspace({
3636
storage: ctx.storage,
37-
backends: [new WorkerBackend(/* ... */)],
37+
backends: [new WorkerShellBackend(/* ... */)],
3838
assets: (ws) => createAssets({ ws, bucket: env.ASSETS, s3: { bucket: "agent-assets" }, env }),
3939
});
4040
```

docs/15_artifacts_interface.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [!NOTE]
44
> This doc describes shipped code in
55
> `packages/computer/src/artifacts/` and the `artifacts` custom
6-
> command in `packages/computer/src/backends/worker/`.
6+
> command in `packages/computer/src/backends/worker-shell/`.
77
88
[Cloudflare Artifacts](https://developers.cloudflare.com/artifacts/)
99
is versioned, Git-speaking repository storage. A Worker reaches it
@@ -250,7 +250,7 @@ export class MyAgent extends DurableObject<Env> {
250250
storage: ctx.storage,
251251
sessionId: ctx.id.toString(),
252252
artifacts: { binding: env.ARTIFACTS },
253-
backends: [new WorkerBackend(/* ... */)],
253+
backends: [new WorkerShellBackend(/* ... */)],
254254
});
255255
}
256256
}

docs/16_code_execution.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The selected backend defines how it interprets `source`.
1616
| Backend | Source language | Intended use |
1717
| --- | --- | --- |
1818
| `container-shell` | shell command | Full Linux, native binaries, installed packages, processes |
19-
| `isolate-shell` | just-bash command | Fast text tools and Workspace Git without a Container |
20-
| `isolate-javascript` | ECMAScript module | Isolated structured JavaScript with trusted Workspace modules |
19+
| `worker-shell` | just-bash command | Fast text tools and Workspace Git without a Container |
20+
| `worker-javascript` | ECMAScript module | Isolated structured JavaScript with trusted Workspace modules |
2121

2222
Applications may register additional command or module backends under their own IDs. Backend IDs are part of the execution contract: changing the backend may change the source language.
2323

@@ -26,19 +26,19 @@ Applications may register additional command or module backends under their own
2626
```ts
2727
const handle = await workspace.runtime.exec(source, {
2828
id: "build-1",
29-
backend: "isolate-javascript",
29+
backend: "worker-javascript",
3030
});
3131

3232
handle.id;
3333
await handle.kill();
3434

3535
const resumed = await workspace.runtime.getExec("build-1", {
36-
backend: "isolate-javascript",
36+
backend: "worker-javascript",
3737
resume: "full",
3838
});
3939

4040
await workspace.runtime.disposeExec("build-1", {
41-
backend: "isolate-javascript",
41+
backend: "worker-javascript",
4242
});
4343
```
4444

@@ -59,9 +59,9 @@ interface WorkspaceRuntimeResult {
5959

6060
Command backends leave `value` unset. Module backends use it for their structured return value.
6161

62-
`container-shell` retains the existing computerd process lifecycle. `isolate-javascript` keeps an execution journal in the Workspace database and retains events/results until `disposeExec`. Active isolate cancellation is host-driven by disposing the child Worker. An execution left running across a Workspace host restart is reconciled to failed because a live Worker capability cannot be serialized into SQLite.
62+
`container-shell` retains the existing computerd process lifecycle. `worker-javascript` keeps an execution journal in the Workspace database and retains events/results until `disposeExec`. Active isolate cancellation is host-driven by disposing the child Worker. An execution left running across a Workspace host restart is reconciled to failed because a live Worker capability cannot be serialized into SQLite.
6363

64-
`isolate-shell` intentionally retains its existing behavior in this release: it buffers a just-bash call to completion, does not retain cross-request events, and cannot reattach by ID. Callers that require supervised process behavior should use `container-shell`; callers that require a managed isolate should use `isolate-javascript`.
64+
`worker-shell` intentionally retains its existing behavior in this release: it buffers a just-bash call to completion, does not retain cross-request events, and cannot reattach by ID. Callers that require supervised process behavior should use `container-shell`; callers that require a managed isolate should use `worker-javascript`.
6565

6666
## Backend authority
6767

@@ -70,14 +70,14 @@ There is no general `workspace.scope()` abstraction. Backend construction fixes
7070
For different authority levels, configure distinct backend instances:
7171

7272
```ts
73-
new IsolateJavaScriptBackend({
74-
id: "isolate-javascript-readonly",
73+
new WorkerJavaScriptBackend({
74+
id: "worker-javascript-readonly",
7575
loader: env.LOADER,
7676
access: "read",
7777
});
7878

79-
new IsolateJavaScriptBackend({
80-
id: "isolate-javascript",
79+
new WorkerJavaScriptBackend({
80+
id: "worker-javascript",
8181
loader: env.LOADER,
8282
access: "read-write",
8383
});

docs/17_isolate_javascript.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Isolate JavaScript runtime
22

3-
`IsolateJavaScriptBackend` runs an ECMAScript module in a fresh Cloudflare Dynamic Worker:
3+
`WorkerJavaScriptBackend` runs an ECMAScript module in a fresh Cloudflare Dynamic Worker:
44

55
```ts
66
import { Workspace } from "@cloudflare/computer";
7-
import { IsolateJavaScriptBackend } from "@cloudflare/computer/backends/javascript";
7+
import { WorkerJavaScriptBackend } from "@cloudflare/computer/backends/worker-javascript";
88

99
const workspace = new Workspace({
1010
storage: ctx.storage,
1111
waitUntil: ctx.waitUntil.bind(ctx),
1212
backends: [
13-
new IsolateJavaScriptBackend({
13+
new WorkerJavaScriptBackend({
1414
loader: env.LOADER,
1515
root: "/workspace",
1616
access: "read-write",
@@ -40,7 +40,7 @@ const handle = await workspace.runtime.exec(
4040
}
4141
`,
4242
{
43-
backend: "isolate-javascript",
43+
backend: "worker-javascript",
4444
input: { value: 21 },
4545
encoding: "utf8",
4646
},
@@ -70,7 +70,7 @@ await workspace.fs.writeFile(
7070
await workspace.runtime.exec(
7171
`import task from "./task.js"; export default task;`,
7272
{
73-
backend: "isolate-javascript",
73+
backend: "worker-javascript",
7474
cwd: "/workspace",
7575
input: { value: 42 },
7676
},
@@ -96,7 +96,7 @@ Host calls have a caller-visible deadline, controlled by `maxHostCallMs` and def
9696
Bare imports are installed at backend construction, not passed on individual executions:
9797

9898
```ts
99-
new IsolateJavaScriptBackend({
99+
new WorkerJavaScriptBackend({
100100
loader: env.LOADER,
101101
modules: {
102102
"tar-stream": TAR_STREAM_BUNDLE,
@@ -165,4 +165,4 @@ Console output is bounded but currently buffered in the Dynamic Worker and publi
165165

166166
## Trusted integrations
167167

168-
A host can configure additional reserved capability modules through `IsolateJavaScriptBackend.trustedModules`; these modules are fixed when the backend is constructed and cannot be supplied or replaced by caller source.
168+
A host can configure additional reserved capability modules through `WorkerJavaScriptBackend.trustedModules`; these modules are fixed when the backend is constructed and cannot be supplied or replaced by caller source.

docs/18_runtime_migration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ This change is a breaking preview-API migration. Public execution now uses one r
1010
| `workspace.shell.get(id, options)` | `workspace.runtime.getExec(id, options)` |
1111
| `workspace.shell.kill(id, options)` | `workspace.runtime.killExec(id, options)` |
1212
| `workspace.shell.dispose(id, options)` | `workspace.runtime.disposeExec(id, options)` |
13-
| `workspace.code` / script execution | `workspace.runtime.exec(source, { backend: "isolate-javascript", input })` |
13+
| `workspace.code` / script execution | `workspace.runtime.exec(source, { backend: "worker-javascript", input })` |
1414

1515
`WorkspaceShell` still exists internally to implement command backends. It is not a public Workspace property.
1616

1717
## Default backend IDs
1818

1919
- Cloudflare Container: `container-shell`
20-
- just-bash Dynamic Worker: `isolate-shell`
21-
- ECMAScript Dynamic Worker: `isolate-javascript`
20+
- just-bash Dynamic Worker: `worker-shell`
21+
- ECMAScript Dynamic Worker: `worker-javascript`
2222

2323
The first configured backend is the default for `runtime.exec()`. Pass `backend` explicitly at security boundaries. Routing is not authorization: trusted gateways must choose from a host-owned allowlist rather than accepting an arbitrary model-supplied backend ID.
2424

2525
## Source semantics
2626

27-
Command backends interpret the first argument as a shell command and reject structured `input`. `isolate-javascript` interprets it as an ECMAScript module and supports structured JSON-compatible input/results, durable relative modules, `node:fs/promises`, and host-owned trusted modules.
27+
Command backends interpret the first argument as a shell command and reject structured `input`. `worker-javascript` interprets it as an ECMAScript module and supports structured JSON-compatible input/results, durable relative modules, `node:fs/promises`, and host-owned trusted modules.
2828

2929
## Lifecycle differences
3030

31-
Container command executions use the remote process journal and push/pull synchronization bracket. `isolate-shell` uses the documented limited one-call Worker lifecycle. `isolate-javascript` stores execution status and events in the Workspace database and supports replay, cancellation, disposal, and restart recovery. Completed filesystem and provider side effects are not rolled back when execution fails or is cancelled.
31+
Container command executions use the remote process journal and push/pull synchronization bracket. `worker-shell` uses the documented limited one-call Worker lifecycle. `worker-javascript` stores execution status and events in the Workspace database and supports replay, cancellation, disposal, and restart recovery. Completed filesystem and provider side effects are not rolled back when execution fails or is cancelled.

0 commit comments

Comments
 (0)