Skip to content

Deploy Minimal Worker

Represent a Cloudflare Worker deployment with symbolic deploy facts.

A minimal deployment flow that stages a Worker bundle, records symbolic deploy refs, and keeps provider handles outside the ledger.

  1. Build a Worker bundle outside the ledger:

    Terminal window
    bun build src/worker.ts --target=browser --outdir dist --external cloudflare:workers
  2. Produce an artifact ref and digest:

    const artifactRef = "artifact:worker/tutorial";
    const digest = "sha256:...";
  3. Resolve the artifact through provider-side material composition. The resolver sees bytes, routes, credentials, and account ids; ledger facts see only symbolic refs.

  4. Record deploy facts through the deploy carrier:

    const deployRef = "deploy:cloudflare/tutorial/1";
    const productionRef = "production:cloudflare/tutorial";
    tx.insertEvent({
    kind: "deploy.promoted",
    payload: { artifactRef, digest, deployRef, productionRef },
    });
  5. Resolve productionRef to a URL only in the caller that needs to display or smoke-test the deployed app.

Allowed ledger payload:

{
"artifactRef": "artifact:worker/tutorial",
"digest": "sha256:...",
"deployRef": "deploy:cloudflare/tutorial/1",
"productionRef": "production:cloudflare/tutorial"
}

Forbidden ledger payload:

https://...
CF_API_TOKEN
account_id
route_id

Assemble the pieces with full small agent app.