# bookclerk_workerd

Library surface for the pinned Cloudflare `workerd` helper and egress policy.

## Audience

The `bookclerk-workerd` launcher binary and host packaging (`cargo ensure-workerd`).
Guest authors do not link this crate; they run inside the isolate it configures.

See `docs/plugins/README.md` for jail / workerd isolation requirements.

## Re-exports

- [`bridge_http::generate_bridge_token`](/docs/internals/crates/bookclerk_workerd/bridge_http/index.md#generate_bridge_token)
- [`config::adapter_binding_plan`](/docs/internals/crates/bookclerk_workerd/config/index.md#adapter_binding_plan)
- [`config::generated_backend_proxy_plan`](/docs/internals/crates/bookclerk_workerd/config/index.md#generated_backend_proxy_plan)
- [`config::materialize_native_backend`](/docs/internals/crates/bookclerk_workerd/config/index.md#materialize_native_backend)
- [`config::BindingSpec`](/docs/internals/crates/bookclerk_workerd/config/index.md#bindingspec)
- [`config::BindingTarget`](/docs/internals/crates/bookclerk_workerd/config/index.md#bindingtarget)
- [`config::EntrypointSource`](/docs/internals/crates/bookclerk_workerd/config/index.md#entrypointsource)
- [`config::GeneratedConfig`](/docs/internals/crates/bookclerk_workerd/config/index.md#generatedconfig)
- [`config::ListenSpec`](/docs/internals/crates/bookclerk_workerd/config/index.md#listenspec)
- [`config::WORKERD_SERVE_EXPERIMENTAL`](/docs/internals/crates/bookclerk_workerd/config/index.md#workerd_serve_experimental)
- [`egress::EgressProxy`](/docs/internals/crates/bookclerk_workerd/egress/index.md#egressproxy)
- [`ensure::ensure_pyodide_bundle`](/docs/internals/crates/bookclerk_workerd/ensure/index.md#ensure_pyodide_bundle)
- [`ensure::ensure_workerd`](/docs/internals/crates/bookclerk_workerd/ensure/index.md#ensure_workerd)
- [`ensure::pyodide_bundle_dir`](/docs/internals/crates/bookclerk_workerd/ensure/index.md#pyodide_bundle_dir)
- [`ensure::workerd_bin_path`](/docs/internals/crates/bookclerk_workerd/ensure/index.md#workerd_bin_path)
- [`grant::OperatorGrantEnv`](/docs/internals/crates/bookclerk_workerd/grant/index.md#operatorgrantenv)
- [`pin::binary_name`](/docs/internals/crates/bookclerk_workerd/pin/index.md#binary_name)
- [`pin::pyodide_bundle_url`](/docs/internals/crates/bookclerk_workerd/pin/index.md#pyodide_bundle_url)
- [`pin::BUNDLED_WORKERD_COMPAT_DATE`](/docs/internals/crates/bookclerk_workerd/pin/index.md#bundled_workerd_compat_date)
- [`pin::PYODIDE_BUNDLE_DIR`](/docs/internals/crates/bookclerk_workerd/pin/index.md#pyodide_bundle_dir)
- [`pin::PYODIDE_BUNDLE_FILE`](/docs/internals/crates/bookclerk_workerd/pin/index.md#pyodide_bundle_file)
- [`pin::PYODIDE_BUNDLE_SHA256_HEX`](/docs/internals/crates/bookclerk_workerd/pin/index.md#pyodide_bundle_sha256_hex)
- [`pin::WORKERD_RELEASE_TAG`](/docs/internals/crates/bookclerk_workerd/pin/index.md#workerd_release_tag)
- [`pin::WORKERD_VERSION_STAMP`](/docs/internals/crates/bookclerk_workerd/pin/index.md#workerd_version_stamp)

## Modules

- [`bridge_addr`](/docs/internals/crates/bookclerk_workerd/bridge_addr/index.md): Where the launcher reaches workerd's bridge RPC socket, and the stream it gets.
- [`bridge_http`](/docs/internals/crates/bookclerk_workerd/bridge_http/index.md): Minimal HTTP/1.1 client for the workerd bridge (JSON control plane, Cap'n Proto `/invoke` bodies, and streamed object bodies).
- [`bridge_stdio`](/docs/internals/crates/bookclerk_workerd/bridge_stdio/index.md): Bookclerk Cap'n Proto stdio adapter over the workerd HTTP bridge.
- [`config`](/docs/internals/crates/bookclerk_workerd/config/index.md): Generate a real workerd Cap'n Proto config for one plugin isolate.
- [`control`](/docs/internals/crates/bookclerk_workerd/control/index.md): Control messages workerd writes on `--control-fd`: the port each socket bound.
- [`egress`](/docs/internals/crates/bookclerk_workerd/egress/index.md): Host egress policy for workerd guests (wraps shared `EgressPolicy`).
- [`egress_relay`](/docs/internals/crates/bookclerk_workerd/egress_relay/index.md): The launcher's egress relay: a workerd isolate's only way out of its jail.
- [`ensure`](/docs/internals/crates/bookclerk_workerd/ensure/index.md): Download / refresh the pinned Cloudflare `workerd` binary.
- [`grant`](/docs/internals/crates/bookclerk_workerd/grant/index.md): Operator consent grant overrides delivered to `bookclerk-workerd` via env.
- [`granted`](/docs/internals/crates/bookclerk_workerd/granted/index.md): Host-granted HTTP reverse channel for workerd isolates: `JobRunner.job` streams (`Source` / `Destination` / `ProgressSink`), the job's `Cancellation` long poll (`/cancel`), named database sessions (`/db/execute`, `/db/execute-streamed`), and the `EVENTS` outbox binding (`/events/publish`, `/events/read`), the `NOTIFY` binding (`/notify/raise`), the `AI` binding (`/ai/run`), and the `SOCKETS` broker binding (`/sockets/*`, parsed in `crate::granted_sockets`).
- [`granted_http`](/docs/internals/crates/bookclerk_workerd/granted_http/index.md): Sans-IO HTTP/1.1 parsing for the granted reverse channel.
- [`granted_sockets`](/docs/internals/crates/bookclerk_workerd/granted_sockets/index.md): `POST /sockets/<op>` on the granted reverse channel: a workerd isolate's `env.SOCKETS` calls, parsed and answered over plain byte slices.
- [`granted_webhooks`](/docs/internals/crates/bookclerk_workerd/granted_webhooks/index.md): `POST /webhooks/<op>` on the granted reverse channel: a workerd isolate's `env.WEBHOOKS` calls, parsed and answered over plain byte slices.
- [`inherited_link`](/docs/internals/crates/bookclerk_workerd/inherited_link/index.md): Open a host-inherited sibling link (`fd:<n>` / `handle:<n>`) as a Tokio stream.
- [`invoke`](/docs/internals/crates/bookclerk_workerd/invoke/index.md): `POST /invoke`: the Cap'n Proto data plane between the launcher and the adapter isolate.
- [`pin`](/docs/internals/crates/bookclerk_workerd/pin/index.md): Pinned Cloudflare `workerd` release metadata shared with `bookclerk-dev`.
- [`python_snapshot`](/docs/internals/crates/bookclerk_workerd/python_snapshot/index.md): Python start-up snapshots for workerd isolates.
- [`socket_broker`](/docs/internals/crates/bookclerk_workerd/socket_broker/index.md): The socket broker: holds a plugin instance's WebSockets while its guest sleeps.
- [`socket_proxy`](/docs/internals/crates/bookclerk_workerd/socket_proxy/index.md): Host-mediated TCP proxy for native-behind-workerd guests.
- [`socket_table`](/docs/internals/crates/bookclerk_workerd/socket_table/index.md): The socket broker's bookkeeping, without I/O.
- [`state_sweep`](/docs/internals/crates/bookclerk_workerd/state_sweep/index.md): Removes isolate state directories that a killed launcher left behind.
- [`unix_bind`](/docs/internals/crates/bookclerk_workerd/unix_bind/index.md): Unix-domain listeners that stay under `sockaddr_un` limits.
- [`webhook_request`](/docs/internals/crates/bookclerk_workerd/webhook_request/index.md): Sans-IO checks for one request on the public webhook route (`POST /hooks/<token>/<name>`), in the order the route applies them.
