# bookclerk_workerd::pin

Pinned Cloudflare `workerd` release metadata shared with `bookclerk-dev`.

Source of truth: `../workerd-pin.json` (do not edit this file by hand).
Bumped by `scripts/bump-workerd-pin.py` (CI: `.github/workflows/workerd-pin-bump.yml`)
with a 7-day publish cooldown for supply-chain safety.
Regenerated by `scripts/sync-workerd-pin.py`.

| Item | Kind | Summary |
| --- | --- | --- |
| [`WorkerdAsset`](#workerdasset) | struct | GitHub release asset name + sha256 (hex) of the `.gz` payload. |
| [`asset_for_target`](#asset_for_target) | function | Look up the pinned download asset for a `std::env::consts` OS/arch pair. |
| [`host_asset`](#host_asset) | function | Resolve the release asset for the compiling host OS/arch. |
| [`download_url`](#download_url) | function | Build the GitHub release download URL for a pinned artifact name. |
| [`pyodide_bundle_url`](#pyodide_bundle_url) | function | Download URL of the pinned Pyodide bundle. |
| [`binary_name`](#binary_name) | function | On-disk binary name after extracting the gzipped release asset. |
| [`BUNDLED_WORKERD_COMPAT_DATE`](#bundled_workerd_compat_date) | constant | Newest compatibility date this Bookclerk build claims to understand. |
| [`WORKERD_RELEASE_TAG`](#workerd_release_tag) | constant | GitHub release tag (includes leading `v`). |
| [`WORKERD_VERSION_STAMP`](#workerd_version_stamp) | constant | Filename written beside the binary so ensure can skip re-downloads. |
| [`PYODIDE_BUNDLE_FILE`](#pyodide_bundle_file) | constant | Pyodide runtime bundle file the pinned workerd loads for Python isolates. |
| [`PYODIDE_BUNDLE_SHA256_HEX`](#pyodide_bundle_sha256_hex) | constant | Expected SHA-256 hex digest of `PYODIDE_BUNDLE_FILE`. |
| [`PYODIDE_BUNDLE_DIR`](#pyodide_bundle_dir) | constant | Directory beside the `workerd` binary that holds `PYODIDE_BUNDLE_FILE`; workerd reads it through `--pyodide-bundle-disk-cache-dir`. |

## Structs

### WorkerdAsset

```rust
pub struct WorkerdAsset {
    pub artifact: &'static str,
    pub sha256_hex: &'static str,
}
```

GitHub release asset name + sha256 (hex) of the `.gz` payload.

**Fields**

- `artifact`: Cloudflare release asset filename (for example `workerd-linux-64.gz`).
- `sha256_hex`: Expected SHA-256 hex digest of the gzipped download bytes.

Implements: `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`

## Functions

### asset_for_target

```rust
pub fn asset_for_target(os: &str, arch: &str) -> Option<WorkerdAsset>
```

Look up the pinned download asset for a `std::env::consts` OS/arch pair.

#### Arguments

* `os` - Host OS string (`linux`, `macos`, or `windows`).
* `arch` - Host CPU string (`x86_64` or `aarch64`).

#### Returns

[`WorkerdAsset`](#workerdasset) when the pin JSON lists that target; otherwise `None`.

### host_asset

```rust
pub fn host_asset() -> Option<WorkerdAsset>
```

Resolve the release asset for the compiling host OS/arch.

### download_url

```rust
pub fn download_url(artifact: &str) -> String
```

Build the GitHub release download URL for a pinned artifact name.

#### Arguments

* `artifact` - Release asset filename from [`WorkerdAsset::artifact`](#workerdasset).

#### Returns

Absolute `https://github.com/cloudflare/workerd/releases/download/...` URL.

### pyodide_bundle_url

```rust
pub fn pyodide_bundle_url() -> String
```

Download URL of the pinned Pyodide bundle.

### binary_name

```rust
pub fn binary_name() -> &'static str
```

On-disk binary name after extracting the gzipped release asset.

## Constants

### BUNDLED_WORKERD_COMPAT_DATE

```rust
pub const BUNDLED_WORKERD_COMPAT_DATE: &str = "2026-11-13";
```

Newest compatibility date this Bookclerk build claims to understand.

### WORKERD_RELEASE_TAG

```rust
pub const WORKERD_RELEASE_TAG: &str = "v1.20261113.1";
```

GitHub release tag (includes leading `v`).

### WORKERD_VERSION_STAMP

```rust
pub const WORKERD_VERSION_STAMP: &str = "workerd.version";
```

Filename written beside the binary so ensure can skip re-downloads.

### PYODIDE_BUNDLE_FILE

```rust
pub const PYODIDE_BUNDLE_FILE: &str = "pyodide_0.28.2_2025-01-16_20.capnp.bin";
```

Pyodide runtime bundle file the pinned workerd loads for Python isolates.

### PYODIDE_BUNDLE_SHA256_HEX

```rust
pub const PYODIDE_BUNDLE_SHA256_HEX: &str = "330d40e5bb3762cd54890d09122e173fca689ec420a98a1dd475215724e3df7d";
```

Expected SHA-256 hex digest of [`PYODIDE_BUNDLE_FILE`](#pyodide_bundle_file).

### PYODIDE_BUNDLE_DIR

```rust
pub const PYODIDE_BUNDLE_DIR: &str = "pyodide-bundles";
```

Directory beside the `workerd` binary that holds [`PYODIDE_BUNDLE_FILE`](#pyodide_bundle_file);
workerd reads it through `--pyodide-bundle-disk-cache-dir`.
