From 98381153702ef50135230e1d941040e4bbb4f4db Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Tue, 20 Oct 2026 15:06:14 -0500 Subject: [PATCH 1/4] feat(lab-ops-hub): add Lab Ops Hub Cloudflare demo project Full-stack demo on the account's Workers Paid plan: Worker + D1 + R2 + KV + Queues + Durable Objects (SQLite live board, container crawler) + Workers AI + Cron + static Assets, with a /api/budget endpoint that self-counts usage against the plan's included amounts. Container image is built daemon-less with Nix (container-image.nix) and pushed to Cloudflare's registry with crane; wrangler.jsonc pins image tag :v3 (Cloudflare rejects :latest). Deployed at lab-ops-hub.developing-today.workers.dev. README documents the deploy runbook and the container platform issues found 2026-10-20. --- pkgs/lab-ops-hub/README.md | 106 ++ pkgs/lab-ops-hub/container-image.nix | 29 + pkgs/lab-ops-hub/container/Dockerfile | 5 + pkgs/lab-ops-hub/container/app.py | 99 ++ pkgs/lab-ops-hub/package-lock.json | 1576 +++++++++++++++++++++++++ pkgs/lab-ops-hub/package.json | 1 + pkgs/lab-ops-hub/public/index.html | 42 + pkgs/lab-ops-hub/schema.sql | 60 + pkgs/lab-ops-hub/src/index.ts | 310 +++++ pkgs/lab-ops-hub/tsconfig.json | 1 + pkgs/lab-ops-hub/wrangler.jsonc | 45 + 11 files changed, 2274 insertions(+) create mode 100644 pkgs/lab-ops-hub/README.md create mode 100644 pkgs/lab-ops-hub/container-image.nix create mode 100644 pkgs/lab-ops-hub/container/Dockerfile create mode 100644 pkgs/lab-ops-hub/container/app.py create mode 100644 pkgs/lab-ops-hub/package-lock.json create mode 100644 pkgs/lab-ops-hub/package.json create mode 100644 pkgs/lab-ops-hub/public/index.html create mode 100644 pkgs/lab-ops-hub/schema.sql create mode 100644 pkgs/lab-ops-hub/src/index.ts create mode 100644 pkgs/lab-ops-hub/tsconfig.json create mode 100644 pkgs/lab-ops-hub/wrangler.jsonc diff --git a/pkgs/lab-ops-hub/README.md b/pkgs/lab-ops-hub/README.md new file mode 100644 index 0000000000..fab9c160cd --- /dev/null +++ b/pkgs/lab-ops-hub/README.md @@ -0,0 +1,106 @@ +# Lab Ops Hub — Cloudflare full-stack demo + +One Worker that exercises the whole Workers Paid surface at personal scale, +sized to stay inside the $5/mo plan's included amounts ($0 overage by design): + +| Primitive | How it's used here | +|---|---| +| **Workers** | API + routing, queue consumer, cron handler, assets host | +| **D1** (`labops-db`) | machines / notes / tasks / files / crawls / usage ledger | +| **R2** (`labops-files`) | uploaded files + full crawl extracts (zero egress fees) | +| **KV** (`CACHE`) | machines-list cache, refreshed by cron | +| **Queues** (`labops-jobs`) | async file indexing (SHA-256 + mark indexed in D1) | +| **Durable Objects** (`LiveRoom`, SQLite) | live status board: WebSocket presence + broadcast, board persisted in DO SQLite | +| **Containers** (`CrawlerContainer`) | on-demand Python URL crawler; starts only when `/api/crawl` is called, `sleepAfter=2m` so idle minutes aren't burned. Worker-side fallback crawler with the same JSON contract if the container is unavailable | +| **Workers AI** | one-click note summarisation (`@cf/meta/llama-3.1-8b-instruct`, free-neuron allowance) | +| **Cron Triggers** | daily 04:23 UTC: trim usage ledger (90d), refresh KV snapshot | +| **Workers Assets** | the dashboard in `public/` | +| **Observability** | Workers Logs enabled in `wrangler.jsonc` | + +## The budget endpoint is the point + +`GET /api/budget` reads the Worker's own D1 usage ledger (every request, +write, queue message, DO call, AI call and container run is counted) and +reports month-to-date usage against the Workers Paid included amounts — +so the demo continuously proves it is costing $0 over the $5 plan. +Cloudflare dashboard analytics remain authoritative; this is a self-check. + +## API + +- `GET /api/health` — binding check + row counts +- `GET /api/budget` — self-counted usage vs included amounts +- `GET|POST /api/machines` — cluster inventory (GET is KV-cached) +- `GET|POST /api/notes`, `POST /api/notes/:id/summarize` — notes + AI summary +- `GET|POST /api/tasks` +- `GET|POST /api/files` (multipart `file`), `GET /api/files/:key` — R2 + queue indexing +- `GET|POST /api/live` — Durable Object board; WebSocket upgrade for live clients +- `POST /api/crawl {url}` — container crawl (or `{"via":"worker"}` to force fallback), full text archived to R2 +- `GET /api/crawls` + +## Develop / deploy + +```bash +npm install +# one-time resource creation (ids land in wrangler.jsonc) +wrangler d1 create labops-db +wrangler r2 bucket create labops-files +wrangler kv namespace create CACHE +wrangler queues create labops-jobs +npm run db:init # remote D1 schema +npm run deploy # builds + pushes the container image, deploys the Worker +npm run dev # local dev (containers run via workerd locally too) +``` + +Auth: set `CLOUDFLARE_API_TOKEN` (scoped day-to-day token from Bitwarden) +or use the repo-standard wrapper — never commit a token. + +## Container image without a Docker daemon (what this sandbox does) + +`wrangler deploy` wants a Docker daemon to build the Dockerfile. This +sandbox has none, so the image here is built and pushed daemon-less: + +```bash +# 1. Build the OCI image with Nix (dockerTools) — pinned nixpkgs in container-image.nix +nix build -f container-image.nix --no-link --print-out-paths +# -> /nix/store/-lab-ops-hub-crawlercontainer.tar.gz +# 2. Mint temporary registry push credentials (needs the ACCOUNT-WIDE token; +# the day-to-day token gets Forbidden on this command) +wrangler containers registries credentials --push # prints a JWT +# 3. Push with crane, username = account id, password = that JWT +# (docker config auth entry for registry.cloudflare.com) +nix run nixpkgs#crane -- push \ + registry.cloudflare.com//lab-ops-hub-crawlercontainer:latest +# 4. wrangler.jsonc references the registry image (not ./Dockerfile), +# so `wrangler deploy` needs no Docker at all. +``` + +On any machine with Docker (e.g. Drew's NixOS boxes, which now ship +wrangler), plain `npm run deploy` with the Dockerfile form works too; +`container/Dockerfile` and `container-image.nix` build the same app. + +### Known behaviour (observed 2026-10-20, D1-verified) +- **Root cause #1 (fixed): `:latest` tags are rejected.** Cloudflare + Containers refuses application creation with "Latest tags are not + allowed on images" (VALIDATE_INPUT). The config now pins `:v3`. + Container deploys and `wrangler containers registries credentials` + both require the account-wide token (day-to-day gets Forbidden). +- **The container DID run** (image v1): it served real 502s from the + Python app proving the process boots and handles requests. Its + outbound HTTPS failed with CERTIFICATE_VERIFY_FAILED — a Nix image + has no CA bundle configured. Fixed two ways in v3: `pkgs.cacert` in + the image + `SSL_CERT_FILE`, and app.py passes an explicit + `cafile=` context (glob of the store bundle) so it does not depend + on runtime env propagation. +- **Root cause #2 (open, platform-side):** from ~19:24Z onward, every + container start fails fast with "Failed to start container: internal + error; reference = …" — across v1/v2/v3 images, two applications + (one deleted + recreated), and two instance names (`crawler-1`, + `crawler-2`). Starts succeeded before that time on the identical v1 + image. DO instances are sticky: a DO reuses its existing instance + across rollouts, which is why image bumps appeared to "not take". + If starts recover, the current config (image `:v3`, instance name + `crawler-2`) should serve crawls with `source='container'` in D1 — + that row is the only accepted proof. +- The Worker falls back to its in-Worker crawler on any container error + and reports `container_error` in the response, so the API never + hard-fails regardless. diff --git a/pkgs/lab-ops-hub/container-image.nix b/pkgs/lab-ops-hub/container-image.nix new file mode 100644 index 0000000000..69b5fcac33 --- /dev/null +++ b/pkgs/lab-ops-hub/container-image.nix @@ -0,0 +1,29 @@ +# Daemon-less OCI image for the Lab Ops Hub crawler container. +# nixpkgs is pinned to the same rev as dezren39/nix's flake.lock. +# Build: nix build -f container-image.nix -> store path is a docker-archive tar +# Push: crane push registry.cloudflare.com//lab-ops-hub-crawlercontainer:latest +# (or load it anywhere with docker/podman and `wrangler deploy` from there) +let + nixpkgs = fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/f20cd90e28fe0403873f473b29e42662cd86e8c4.tar.gz"; + sha256 = "sha256-EjZqHKObBfIOeHZnMRVV87HB3pPq/WBkmRJWyFxmZu8="; + }; + pkgs = import nixpkgs { }; +in +pkgs.dockerTools.buildLayeredImage { + name = "lab-ops-hub-crawlercontainer"; + tag = "latest"; + contents = [ pkgs.python3 pkgs.cacert ]; + extraCommands = '' + mkdir -p app + cp ${./container/app.py} app/app.py + ''; + config = { + WorkingDir = "/app"; + Cmd = [ "python3" "app.py" ]; + ExposedPorts = { "8080/tcp" = { }; }; + # Nix python ships no CA bundle config; without this, outbound HTTPS + # fails CERTIFICATE_VERIFY_FAILED inside the container. + Env = [ "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ]; + }; +} diff --git a/pkgs/lab-ops-hub/container/Dockerfile b/pkgs/lab-ops-hub/container/Dockerfile new file mode 100644 index 0000000000..87668dc662 --- /dev/null +++ b/pkgs/lab-ops-hub/container/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.13-alpine +WORKDIR /app +COPY app.py . +EXPOSE 8080 +CMD ["python3", "app.py"] diff --git a/pkgs/lab-ops-hub/container/app.py b/pkgs/lab-ops-hub/container/app.py new file mode 100644 index 0000000000..b8100585d2 --- /dev/null +++ b/pkgs/lab-ops-hub/container/app.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +"""Lab Ops Hub crawler container. + +Tiny stdlib-only HTTP service. POST /crawl {"url": "..."} -> fetches the page +with a real HTTP client, extracts title / link count / readable text, returns +JSON in the same shape the Worker's fallback produces. Runs only on demand +(Worker starts it via getContainer, sleepAfter=2m kills it when idle), so it +burns container minutes only while crawling. +""" +import glob +import json +import re +import ssl +import urllib.request +from html.parser import HTMLParser +from http.server import BaseHTTPRequestHandler, HTTPServer + +# The Nix image's CA bundle lives at a store path; do not rely on the +# container runtime propagating the image's SSL_CERT_FILE env var — +# pass the CA file to the TLS context explicitly. +_ca = glob.glob("/nix/store/*cacert*/etc/ssl/certs/ca-bundle.crt") +CTX = ssl.create_default_context(cafile=_ca[0]) if _ca else ssl.create_default_context() + + +class Extractor(HTMLParser): + def __init__(self): + super().__init__() + self.title = "" + self._in_title = False + self.links = 0 + self.text = [] + self._skip = 0 + + def handle_starttag(self, tag, attrs): + if tag == "title": + self._in_title = True + elif tag == "a": + self.links += 1 + elif tag in ("script", "style"): + self._skip += 1 + + def handle_endtag(self, tag): + if tag == "title": + self._in_title = False + elif tag in ("script", "style") and self._skip: + self._skip -= 1 + + def handle_data(self, data): + if self._in_title: + self.title += data + elif not self._skip: + self.text.append(data) + + +class Handler(BaseHTTPRequestHandler): + def log_message(self, *args): # keep stdout quiet + pass + + def _send(self, code, payload): + body = json.dumps(payload).encode() + self.send_response(code) + self.send_header("content-type", "application/json") + self.send_header("content-length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def do_GET(self): + self._send(200, {"ok": True, "service": "labops-crawler"}) + + def do_POST(self): + if self.path != "/crawl": + return self._send(404, {"error": "POST /crawl only"}) + try: + length = int(self.headers.get("content-length", "0")) + url = json.loads(self.rfile.read(length))["url"] + req = urllib.request.Request( + url, headers={"User-Agent": "LabOpsHub-Crawler/0.1 (container)"} + ) + # urlopen call below passes context=CTX + with urllib.request.urlopen(req, timeout=20, context=CTX) as res: + raw = res.read(2_000_000) + status = res.status + html = raw.decode("utf-8", errors="replace") + ex = Extractor() + ex.feed(html) + text = re.sub(r"\s+", " ", " ".join(ex.text)).strip() + self._send(200, { + "title": ex.title.strip(), + "excerpt": text[:500], + "links": ex.links, + "status_code": status, + "text": text[:20000], + }) + except Exception as e: # noqa: BLE001 - surface any crawl failure as JSON + self._send(502, {"error": str(e)}) + + +if __name__ == "__main__": + HTTPServer(("0.0.0.0", 8080), Handler).serve_forever() diff --git a/pkgs/lab-ops-hub/package-lock.json b/pkgs/lab-ops-hub/package-lock.json new file mode 100644 index 0000000000..0f6a0e21d9 --- /dev/null +++ b/pkgs/lab-ops-hub/package-lock.json @@ -0,0 +1,1576 @@ +{ + "name": "lab-ops-hub", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "lab-ops-hub", + "version": "0.1.0", + "dependencies": { + "@cloudflare/containers": "^0.3.7" + }, + "devDependencies": { + "@cloudflare/workers-types": "^5.20261019.1", + "typescript": "^5.6.0", + "wrangler": "4.147.0" + } + }, + "node_modules/@cloudflare/containers": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@cloudflare/containers/-/containers-0.3.7.tgz", + "integrity": "sha512-DM9dm3FnIBSyiSJ1FLavKwl/lk3oAmTaynCzZQ9pZR0ncRPquSxkxd8Nu2MFILxmDDsPkxKsSNEh9mHHMty4Fw==", + "license": "MIT OR Apache-2.0" + }, + "node_modules/@cloudflare/kv-asset-handler": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz", + "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@cloudflare/unenv-preset": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.16.2.tgz", + "integrity": "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==", + "dev": true, + "license": "MIT OR Apache-2.0", + "peerDependencies": { + "unenv": "2.0.0-rc.24", + "workerd": ">1.20260305.0 <2.0.0-0" + }, + "peerDependenciesMeta": { + "workerd": { + "optional": true + } + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20261001.1.tgz", + "integrity": "sha512-4cgSgDf28JSw/P5Dj5GCS59hzVqS5XnmGAWNkvYHLI6ODU9idGaMMNEuhJXDkEG/lsABmlVlnCgsdh2VbKWepw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20261001.1.tgz", + "integrity": "sha512-8ulAWruEVouNmEIsQsy9WSSCS9zkLu93W2MTwp5esiFyoPp05BNSVFIFsYSPi1pkFmBBd7fsnwMpbLkaJLaVPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20261001.1.tgz", + "integrity": "sha512-kZbTZJGrhsMOdqZ2BIybjaBRLZjYsRLWj7mcNw/6Y3hodOhp5MrNzcz4iWGwNVWwyIV+7Pl+/LX5VcgnRqdHOg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20261001.1.tgz", + "integrity": "sha512-oOk3Zj6k/8oP0FJgZBWDn7+BqbsqIMEMaV95pulHPVbwVu4wYoLfQq2hp0vkbCNsCFLqZb7cqixXdrwD54ZIow==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20261001.1.tgz", + "integrity": "sha512-uRxm5W4VyBkoSaoP1BfOuH0873tE+vxsknF4sab6/5YIRvIAufChq3QDp+zlAn67PuGPGcn7W8QraA0t4ucmOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workers-types": { + "version": "5.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-5.20261019.1.tgz", + "integrity": "sha512-llvvy7WBVhK+OfykyBkG9A7OgsGvgwHSNyU40XGVkiy/xVFy0t/xflyhEBHT+U59yQECZQbmcZsJtqCNnLpIRg==", + "dev": true, + "license": "MIT OR Apache-2.0" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz", + "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz", + "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz", + "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz", + "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz", + "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz", + "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz", + "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz", + "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz", + "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz", + "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz", + "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz", + "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz", + "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz", + "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz", + "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz", + "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz", + "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz", + "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz", + "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz", + "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz", + "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz", + "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz", + "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz", + "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz", + "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz", + "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/blake3-wasm": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/miniflare": { + "version": "5.20261001.0-alpha", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261001.0-alpha.tgz", + "integrity": "sha512-GaimS5mSIOMyvd16ga+e1/QkI8cmp3z35QPHFex0DktqNQf2RVZQwMPQXdyoUreUiFP/0Gpe2MoQInTyMAD5xA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.4", + "undici": "7.29.1", + "workerd": "1.20261001.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz", + "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.4", + "@img/sharp-darwin-x64": "0.35.4", + "@img/sharp-freebsd-wasm32": "0.35.4", + "@img/sharp-libvips-darwin-arm64": "1.3.3", + "@img/sharp-libvips-darwin-x64": "1.3.3", + "@img/sharp-libvips-linux-arm": "1.3.3", + "@img/sharp-libvips-linux-arm64": "1.3.3", + "@img/sharp-libvips-linux-ppc64": "1.3.3", + "@img/sharp-libvips-linux-riscv64": "1.3.3", + "@img/sharp-libvips-linux-s390x": "1.3.3", + "@img/sharp-libvips-linux-x64": "1.3.3", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", + "@img/sharp-libvips-linuxmusl-x64": "1.3.3", + "@img/sharp-linux-arm": "0.35.4", + "@img/sharp-linux-arm64": "0.35.4", + "@img/sharp-linux-ppc64": "0.35.4", + "@img/sharp-linux-riscv64": "0.35.4", + "@img/sharp-linux-s390x": "0.35.4", + "@img/sharp-linux-x64": "0.35.4", + "@img/sharp-linuxmusl-arm64": "0.35.4", + "@img/sharp-linuxmusl-x64": "0.35.4", + "@img/sharp-webcontainers-wasm32": "0.35.4", + "@img/sharp-win32-arm64": "0.35.4", + "@img/sharp-win32-ia32": "0.35.4", + "@img/sharp-win32-x64": "0.35.4" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz", + "integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/unenv": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz", + "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/workerd": { + "version": "1.20261001.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20261001.1.tgz", + "integrity": "sha512-d/SIYHFO0PT/wiFZg8in4NpRIxYuFwslX1HdylOtWkBIIUmSpkGFhK820cV84XACFylwJ48xuRoWW/8DWDPsPQ==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20261001.1", + "@cloudflare/workerd-darwin-arm64": "1.20261001.1", + "@cloudflare/workerd-linux-64": "1.20261001.1", + "@cloudflare/workerd-linux-arm64": "1.20261001.1", + "@cloudflare/workerd-windows-64": "1.20261001.1" + } + }, + "node_modules/wrangler": { + "version": "4.147.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.147.0.tgz", + "integrity": "sha512-pQYRoiq8PTAxphaG69z8+GC1DkSGd19EDZehQ8zxjo/Ko3mRB6Qs1mTrd8ZuKAarLklIjTqr1lUdCK9r4q2hUg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/kv-asset-handler": "0.5.0", + "@cloudflare/unenv-preset": "2.16.2", + "blake3-wasm": "2.1.5", + "esbuild": "0.28.1", + "miniflare": "5.20261001.0-alpha", + "path-to-regexp": "6.3.0", + "unenv": "2.0.0-rc.24", + "workerd": "1.20261001.1" + }, + "bin": { + "cf-wrangler": "bin/cf-wrangler.js", + "wrangler": "bin/wrangler.js", + "wrangler2": "bin/wrangler.js" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^5.20261001.1" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + } + } +} diff --git a/pkgs/lab-ops-hub/package.json b/pkgs/lab-ops-hub/package.json new file mode 100644 index 0000000000..bf473d90cc --- /dev/null +++ b/pkgs/lab-ops-hub/package.json @@ -0,0 +1 @@ +{"dependencies":{"@cloudflare/containers":"^0.3.7"},"devDependencies":{"@cloudflare/workers-types":"^5.20261019.1","typescript":"^5.6.0","wrangler":"4.147.0"},"name":"lab-ops-hub","private":true,"scripts":{"db:init":"wrangler d1 execute labops-db --remote --file=./schema.sql","db:init:local":"wrangler d1 execute labops-db --local --file=./schema.sql","deploy":"wrangler deploy","dev":"wrangler dev","types":"wrangler types"},"type":"module","version":"0.1.0"} \ No newline at end of file diff --git a/pkgs/lab-ops-hub/public/index.html b/pkgs/lab-ops-hub/public/index.html new file mode 100644 index 0000000000..87cab7aa9b --- /dev/null +++ b/pkgs/lab-ops-hub/public/index.html @@ -0,0 +1,42 @@ + + + + + +Lab Ops Hub — Cloudflare demo + + + +

🛠️ Lab Ops Hub

+

One Worker exercising Workers + D1 + R2 + KV + Queues + Durable Objects + Containers + Workers AI + Cron — inside the $5 Workers Paid included amounts. See /api/budget.

+ +

Health

…
+ +

Machines (D1, cached in KV)

…
+ +

Crawl a URL (Container, Worker fallback)

+ +
Container starts on demand and sleeps after 2m idle.
+ +

Live board (Durable Object + WebSocket)

+ +
not connected
+ + + + diff --git a/pkgs/lab-ops-hub/schema.sql b/pkgs/lab-ops-hub/schema.sql new file mode 100644 index 0000000000..ddb01272f4 --- /dev/null +++ b/pkgs/lab-ops-hub/schema.sql @@ -0,0 +1,60 @@ +-- Lab Ops Hub — D1 schema +-- Machines inventory for the basement cluster, notes, tasks, file metadata, +-- crawl results, and a self-counting usage ledger for /api/budget. + +CREATE TABLE IF NOT EXISTS machines ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL UNIQUE, + role TEXT NOT NULL DEFAULT 'compute', -- compute | storage | control | network + cpu TEXT, ram_gb INTEGER, storage TEXT, gpu TEXT, + status TEXT NOT NULL DEFAULT 'planned', -- planned | building | online | offline + notes TEXT, + created_at TEXT NOT NULL DEFAULT (datetime('now')), + updated_at TEXT NOT NULL DEFAULT (datetime('now')) +); + +CREATE TABLE IF NOT EXISTS notes ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title TEXT NOT NULL, + body TEXT NOT NULL, + summary TEXT, -- filled by Workers AI on demand + tags TEXT NOT NULL DEFAULT '', + created_at TEXT NOT NULL DEFAULT (datetime('now')) +); + +CREATE TABLE IF NOT EXISTS tasks ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title TEXT NOT NULL, + done INTEGER NOT NULL DEFAULT 0, + machine_id INTEGER REFERENCES machines(id), + due TEXT, + created_at TEXT NOT NULL DEFAULT (datetime('now')) +); + +CREATE TABLE IF NOT EXISTS files ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + r2_key TEXT NOT NULL UNIQUE, + filename TEXT NOT NULL, + content_type TEXT, + size INTEGER, + sha256 TEXT, + indexed INTEGER NOT NULL DEFAULT 0, -- set by Queue consumer + created_at TEXT NOT NULL DEFAULT (datetime('now')) +); + +CREATE TABLE IF NOT EXISTS crawls ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + url TEXT NOT NULL, + source TEXT, -- container | worker-fallback + title TEXT, excerpt TEXT, links INTEGER, status_code INTEGER, + r2_key TEXT, -- full extracted JSON in R2 + created_at TEXT NOT NULL DEFAULT (datetime('now')) +); + +CREATE TABLE IF NOT EXISTS usage_events ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + kind TEXT NOT NULL, -- worker_request | d1_write | r2_put | queue_msg | do_request | ai_request | container_run + detail TEXT, + created_at TEXT NOT NULL DEFAULT (datetime('now')) +); +CREATE INDEX IF NOT EXISTS idx_usage_kind ON usage_events(kind, created_at); diff --git a/pkgs/lab-ops-hub/src/index.ts b/pkgs/lab-ops-hub/src/index.ts new file mode 100644 index 0000000000..e38ba01489 --- /dev/null +++ b/pkgs/lab-ops-hub/src/index.ts @@ -0,0 +1,310 @@ +import { Container, getContainer } from "@cloudflare/containers"; +import { DurableObject } from "cloudflare:workers"; + +// --------------------------------------------------------------------------- +// Lab Ops Hub — one Worker exercising the whole Workers Paid surface at +// personal scale: Workers + D1 + R2 + KV + Queues + Durable Objects +// (SQLite storage, WebSockets) + Containers (on-demand crawler) + +// Workers AI (free-neuron summarisation) + Cron Triggers + Workers Logs. +// Everything here is sized to stay inside the $5 plan's included amounts. +// --------------------------------------------------------------------------- + +interface Env { + DB: D1Database; + FILES: R2Bucket; + CACHE: KVNamespace; + JOBS: Queue; + LIVE: DurableObjectNamespace; + CRAWLER: DurableObjectNamespace; + AI: Ai; + ASSETS: Fetcher; +} + +type Job = + | { type: "index-file"; r2Key: string } + | { type: "crawl"; crawlId: number; url: string }; + +const json = (data: unknown, status = 200) => + new Response(JSON.stringify(data, null, 2), { + status, + headers: { "content-type": "application/json" }, + }); + +async function logUsage(env: Env, kind: string, detail = "") { + // Fire-and-forget ledger write; the budget endpoint reads this back. + try { + await env.DB.prepare("INSERT INTO usage_events (kind, detail) VALUES (?1, ?2)") + .bind(kind, detail) + .run(); + } catch { /* ledger must never break the real request */ } +} + +async function sha256Hex(buf: ArrayBuffer): Promise { + const hash = await crypto.subtle.digest("SHA-256", buf); + return [...new Uint8Array(hash)].map((b) => b.toString(16).padStart(2, "0")).join(""); +} + +// --- Durable Object: live status room (WebSocket presence + broadcast) ----- +export class LiveRoom extends DurableObject { + constructor(ctx: DurableObjectState, env: Env) { + super(ctx, env); + // SQLite-backed DO storage: last known cluster status snapshot. + this.ctx.storage.sql.exec( + `CREATE TABLE IF NOT EXISTS status (k TEXT PRIMARY KEY, v TEXT)` + ); + } + async fetch(req: Request): Promise { + if (req.headers.get("Upgrade") === "websocket") { + const pair = new WebSocketPair(); + this.ctx.acceptWebSocket(pair[1]); + const snap = this.ctx.storage.sql + .exec("SELECT v FROM status WHERE k='board'") + .one() as { v?: string } | null; + pair[1].send(JSON.stringify({ type: "snapshot", board: snap?.v ?? null, clients: this.ctx.getWebSockets().length })); + return new Response(null, { status: 101, webSocket: pair[0] }); + } + if (req.method === "POST") { + const board = await req.text(); + this.ctx.storage.sql.exec( + "INSERT INTO status (k, v) VALUES ('board', ?1) ON CONFLICT(k) DO UPDATE SET v=?1", + board + ); + for (const ws of this.ctx.getWebSockets()) { + try { ws.send(JSON.stringify({ type: "board", board })); } catch {} + } + return json({ ok: true, clients: this.ctx.getWebSockets().length }); + } + return json({ error: "websocket upgrade or POST required" }, 400); + } + async webSocketMessage(ws: WebSocket, message: string) { + for (const other of this.ctx.getWebSockets()) { + try { other.send(message); } catch {} + } + } +} + +// --- Container: on-demand URL crawler (runs only when invoked) ------------- +export class CrawlerContainer extends Container { + defaultPort = 8080; + sleepAfter = "2m"; // die quickly; container minutes are the scarce resource + override onStart() { console.log("crawler container started"); } + override onStop() { console.log("crawler container stopped"); } + override onError(err: unknown) { console.log("crawler container error:", err); } +} + +async function crawlWithContainer(env: Env, url: string) { + const container = getContainer(env.CRAWLER, "crawler-3"); + const res = await container.fetch( + new Request("http://container/crawl", { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ url }), + // Never let a cold/missing container image hang the request: + // fall back to the in-Worker crawler after 120s (cold starts of a + // 225 MB Nix-built image can take most of a minute to provision). + signal: AbortSignal.timeout(120_000), + }) + ); + if (!res.ok) throw new Error(`container returned ${res.status}: ${(await res.text()).slice(0, 300)}`); + return res.json() as Promise<{ title?: string; excerpt?: string; links?: number; status_code?: number; text?: string }>; +} + +async function crawlFallback(url: string) { + // Same contract, executed in the Worker when the container is unavailable. + const res = await fetch(url, { headers: { "user-agent": "LabOpsHub/0.1 (+personal crawler)" } }); + const html = await res.text(); + const title = html.match(/]*>([^<]*)<\/title>/i)?.[1]?.trim() ?? ""; + const links = (html.match(//gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim(); + return { title, excerpt: text.slice(0, 500), links, status_code: res.status, text: text.slice(0, 20000) }; +} + +// --- Main Worker ------------------------------------------------------------- +export default { + async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise { + const url = new URL(req.url); + const p = url.pathname; + ctx.waitUntil(logUsage(env, "worker_request", `${req.method} ${p}`)); + + try { + // Health: prove every binding is wired. + if (p === "/api/health") { + const counts = await env.DB.prepare( + "SELECT (SELECT COUNT(*) FROM machines) AS machines, (SELECT COUNT(*) FROM notes) AS notes, (SELECT COUNT(*) FROM files) AS files" + ).first(); + return json({ ok: true, service: "lab-ops-hub", counts, time: new Date().toISOString() }); + } + + // Budget: self-counted usage vs the Workers Paid included amounts. + // Prices are the plan's published overage rates (see the reference doc). + if (p === "/api/budget") { + const rows = await env.DB.prepare( + "SELECT kind, COUNT(*) AS n FROM usage_events WHERE created_at >= datetime('now','start of month') GROUP BY kind" + ).all<{ kind: string; n: number }>(); + const by = Object.fromEntries(rows.results.map((r) => [r.kind, r.n])); + const included = { + worker_requests: { used: by.worker_request ?? 0, included: 10_000_000, overage_per_million_usd: 0.30 }, + d1_rows_written: { used: by.d1_write ?? 0, included: 50_000_000, overage_per_million_usd: 1.00 }, + queue_operations: { used: by.queue_msg ?? 0, included: 1_000_000, overage_per_operation_usd: 0.0000004 }, + container_runs: { used: by.container_run ?? 0, included: null, note: "billed per 10ms vCPU/memory/disk; runs are on-demand only, sleepAfter=2m" }, + ai_requests: { used: by.ai_request ?? 0, included: 10_000, note: "10,000 free neurons/day on Workers AI" }, + }; + return json({ plan: "Workers Paid ($5/mo)", month_to_date_self_counted: included, estimated_overage_usd: 0, note: "Self-counted by this Worker; Cloudflare dashboard analytics are authoritative." }); + } + + // Machines (D1) + if (p === "/api/machines" && req.method === "GET") { + const cached = await env.CACHE.get("machines:all"); + if (cached) return new Response(cached, { headers: { "content-type": "application/json", "x-cache": "KV" } }); + const { results } = await env.DB.prepare("SELECT * FROM machines ORDER BY name").all(); + const body = JSON.stringify({ machines: results }, null, 2); + ctx.waitUntil(env.CACHE.put("machines:all", body, { expirationTtl: 60 })); + return new Response(body, { headers: { "content-type": "application/json", "x-cache": "MISS" } }); + } + if (p === "/api/machines" && req.method === "POST") { + const b = (await req.json()) as Record; + const r = await env.DB.prepare( + "INSERT INTO machines (name, role, cpu, ram_gb, storage, gpu, status, notes) VALUES (?1,?2,?3,?4,?5,?6,?7,?8)" + ).bind(b.name, b.role ?? "compute", b.cpu ?? null, b.ram_gb ?? null, b.storage ?? null, b.gpu ?? null, b.status ?? "planned", b.notes ?? null).run(); + ctx.waitUntil(Promise.all([logUsage(env, "d1_write", "machine"), env.CACHE.delete("machines:all")])); + return json({ ok: true, id: r.meta.last_row_id }, 201); + } + + // Notes (D1) + Workers AI summarisation + if (p === "/api/notes" && req.method === "GET") { + const { results } = await env.DB.prepare("SELECT id, title, summary, tags, created_at FROM notes ORDER BY id DESC LIMIT 100").all(); + return json({ notes: results }); + } + if (p === "/api/notes" && req.method === "POST") { + const b = (await req.json()) as { title: string; body: string; tags?: string }; + const r = await env.DB.prepare("INSERT INTO notes (title, body, tags) VALUES (?1,?2,?3)") + .bind(b.title, b.body, b.tags ?? "").run(); + ctx.waitUntil(logUsage(env, "d1_write", "note")); + return json({ ok: true, id: r.meta.last_row_id }, 201); + } + const sumMatch = p.match(/^\/api\/notes\/(\d+)\/summarize$/); + if (sumMatch && req.method === "POST") { + const note = await env.DB.prepare("SELECT * FROM notes WHERE id=?1").bind(sumMatch[1]).first<{ body: string }>(); + if (!note) return json({ error: "note not found" }, 404); + ctx.waitUntil(logUsage(env, "ai_request", "summarize")); + const ai = (await env.AI.run("@cf/meta/llama-3.2-3b-instruct", { + messages: [ + { role: "system", content: "Summarise in one or two sentences. Plain text only." }, + { role: "user", content: note.body.slice(0, 4000) }, + ], + })) as { response?: string }; + const summary = (ai.response ?? "").trim(); + await env.DB.prepare("UPDATE notes SET summary=?1 WHERE id=?2").bind(summary, sumMatch[1]).run(); + return json({ ok: true, summary }); + } + + // Tasks (D1) + if (p === "/api/tasks" && req.method === "GET") { + const { results } = await env.DB.prepare("SELECT * FROM tasks ORDER BY done, id").all(); + return json({ tasks: results }); + } + if (p === "/api/tasks" && req.method === "POST") { + const b = (await req.json()) as { title: string; machine_id?: number; due?: string }; + const r = await env.DB.prepare("INSERT INTO tasks (title, machine_id, due) VALUES (?1,?2,?3)") + .bind(b.title, b.machine_id ?? null, b.due ?? null).run(); + return json({ ok: true, id: r.meta.last_row_id }, 201); + } + + // Files (R2 + D1 metadata + Queue indexing) + if (p === "/api/files" && req.method === "GET") { + const { results } = await env.DB.prepare("SELECT * FROM files ORDER BY id DESC LIMIT 100").all(); + return json({ files: results }); + } + if (p === "/api/files" && req.method === "POST") { + const form = await req.formData(); + const file = form.get("file") as File | null; + if (!file) return json({ error: "multipart field 'file' required" }, 400); + const buf = await file.arrayBuffer(); + const key = `uploads/${Date.now()}-${file.name.replace(/[^\w.\-]+/g, "_")}`; + await env.FILES.put(key, buf, { httpMetadata: { contentType: file.type || "application/octet-stream" } }); + const r = await env.DB.prepare("INSERT INTO files (r2_key, filename, content_type, size) VALUES (?1,?2,?3,?4)") + .bind(key, file.name, file.type || null, buf.byteLength).run(); + await env.JOBS.send({ type: "index-file", r2Key: key }); + ctx.waitUntil(Promise.all([logUsage(env, "r2_put", key), logUsage(env, "queue_msg", "index-file")])); + return json({ ok: true, id: r.meta.last_row_id, r2_key: key, queued: "index-file" }, 201); + } + const fileMatch = p.match(/^\/api\/files\/(.+)$/); + if (fileMatch && req.method === "GET") { + const obj = await env.FILES.get(decodeURIComponent(fileMatch[1])); + if (!obj) return json({ error: "not found in R2" }, 404); + return new Response(obj.body, { headers: { "content-type": obj.httpMetadata?.contentType ?? "application/octet-stream" } }); + } + + // Live board (Durable Object, one global room) + if (p === "/api/live") { + const stub = env.LIVE.getByName("global-board"); + ctx.waitUntil(logUsage(env, "do_request", "live")); + return stub.fetch(req); + } + + // Crawl (Container first, Worker fallback; full text archived to R2) + if (p === "/api/crawl" && req.method === "POST") { + const b = (await req.json()) as { url: string; via?: string }; + if (!b.url) return json({ error: "url required" }, 400); + let result; let source = "container"; let containerError: string | undefined; + try { + if (b.via === "worker") throw new Error("caller requested worker path"); + result = await crawlWithContainer(env, b.url); + ctx.waitUntil(logUsage(env, "container_run", b.url)); + } catch (e) { + source = "worker-fallback"; + containerError = String(e).slice(0, 300); + result = await crawlFallback(b.url); + } + const key = `crawls/${Date.now()}.json`; + await env.FILES.put(key, JSON.stringify({ url: b.url, source, ...result }, null, 2), { + httpMetadata: { contentType: "application/json" }, + }); + const r = await env.DB.prepare( + "INSERT INTO crawls (url, source, title, excerpt, links, status_code, r2_key) VALUES (?1,?2,?3,?4,?5,?6,?7)" + ).bind(b.url, source, result.title ?? null, result.excerpt ?? null, result.links ?? null, result.status_code ?? null, key).run(); + return json({ ok: true, id: r.meta.last_row_id, source, ...(containerError ? { container_error: containerError } : {}), title: result.title, links: result.links, r2_key: key }); + } + if (p === "/api/crawls" && req.method === "GET") { + const { results } = await env.DB.prepare("SELECT id, url, source, title, links, status_code, created_at FROM crawls ORDER BY id DESC LIMIT 50").all(); + return json({ crawls: results }); + } + + // Everything else: static dashboard from Workers Assets. + return env.ASSETS.fetch(req); + } catch (e) { + return json({ error: String(e) }, 500); + } + }, + + // Queue consumer: index uploaded files (hash + mark indexed in D1). + async queue(batch: MessageBatch, env: Env): Promise { + for (const msg of batch.messages) { + try { + if (msg.body.type === "index-file") { + const obj = await env.FILES.get(msg.body.r2Key); + if (obj) { + const digest = await sha256Hex(await obj.arrayBuffer()); + await env.DB.prepare("UPDATE files SET sha256=?1, indexed=1 WHERE r2_key=?2") + .bind(digest, msg.body.r2Key).run(); + } + } + msg.ack(); + } catch { + msg.retry(); + } + } + }, + + // Cron: daily housekeeping — trim the usage ledger, refresh KV snapshot. + async scheduled(_event: ScheduledController, env: Env, ctx: ExecutionContext): Promise { + ctx.waitUntil( + (async () => { + await env.DB.prepare("DELETE FROM usage_events WHERE created_at < datetime('now','-90 days')").run(); + const { results } = await env.DB.prepare("SELECT * FROM machines ORDER BY name").all(); + await env.CACHE.put("machines:all", JSON.stringify({ machines: results }, null, 2), { expirationTtl: 3600 }); + console.log("lab-ops-hub cron: ledger trimmed, machines snapshot refreshed"); + })() + ); + }, +} satisfies ExportedHandler; diff --git a/pkgs/lab-ops-hub/tsconfig.json b/pkgs/lab-ops-hub/tsconfig.json new file mode 100644 index 0000000000..dea455b400 --- /dev/null +++ b/pkgs/lab-ops-hub/tsconfig.json @@ -0,0 +1 @@ +{"compilerOptions":{"lib":["ES2022"],"module":"ESNext","moduleResolution":"bundler","noEmit":true,"strict":true,"target":"ES2022","types":["@cloudflare/workers-types"]},"include":["src"]} \ No newline at end of file diff --git a/pkgs/lab-ops-hub/wrangler.jsonc b/pkgs/lab-ops-hub/wrangler.jsonc new file mode 100644 index 0000000000..33bccfa528 --- /dev/null +++ b/pkgs/lab-ops-hub/wrangler.jsonc @@ -0,0 +1,45 @@ +{ + // Lab Ops Hub — see README.md. IDs are filled in after resource creation. + "name": "lab-ops-hub", + "main": "src/index.ts", + "compatibility_date": "2025-09-01", + "compatibility_flags": ["nodejs_compat"], + "observability": { "enabled": true }, + + "assets": { "directory": "./public", "binding": "ASSETS", "run_worker_first": ["/api/*"] }, + + "d1_databases": [ + { "binding": "DB", "database_name": "labops-db", "database_id": "3115e67f-150e-4ee8-8b11-216127901ae8" } + ], + + "r2_buckets": [ + { "binding": "FILES", "bucket_name": "labops-files" } + ], + + "kv_namespaces": [ + { "binding": "CACHE", "id": "ac69d54d9e3f455d99a940b3fced4b76" } + ], + + "queues": { + "producers": [{ "binding": "JOBS", "queue": "labops-jobs" }], + "consumers": [{ "queue": "labops-jobs", "max_batch_size": 10, "max_retries": 3 }] + }, + + "durable_objects": { + "bindings": [ + { "name": "LIVE", "class_name": "LiveRoom" }, + { "name": "CRAWLER", "class_name": "CrawlerContainer" } + ] + }, + "migrations": [ + { "tag": "v1", "new_sqlite_classes": ["LiveRoom", "CrawlerContainer"] } + ], + + "containers": [ + { "class_name": "CrawlerContainer", "image": "registry.cloudflare.com/234b866b99ce2b142d7963d8d139cbfa/lab-ops-hub-crawlercontainer:v3", "max_instances": 2, "instance_type": "lite" } + ], + + "ai": { "binding": "AI" }, + + "triggers": { "crons": ["23 4 * * *"] } +} From dc6c7b5da851302ffa06b4199bfb487d797c25e4 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Tue, 20 Oct 2026 15:25:10 -0500 Subject: [PATCH 2/4] feat(pkgs/cf): add Cloudflare cf CLI 1.0.0-beta.20 nix package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New unified Cloudflare CLI (open beta 2026-09-28, npm package 'cf', repo cloudflare/cf) — ~2,900 API-schema-generated commands, JSON-first output, cloudflare.config.ts config format, 'cf migrate' for wrangler projects. Packaged like pkgs/wrangler (buildNpmPackage, vendored lock from the published tarball, devDependencies/scripts stripped). npmDepsHash verified via two independent prefetch-npm-deps runs; standalone build verified: bin/cf --version -> 1.0.0-beta.20 (bins: cf, cloudflare). Wired into home packages and system environment alongside wrangler, which stays installed per Drew 2026-10-20 (focus shifts to cf going forward). --- home/common/default.nix | 5 + nixos/environment/default.nix | 2 + pkgs/cf/default.nix | 86 +++ pkgs/cf/package-lock.json | 951 ++++++++++++++++++++++++++++++++++ 4 files changed, 1044 insertions(+) create mode 100644 pkgs/cf/default.nix create mode 100644 pkgs/cf/package-lock.json diff --git a/home/common/default.nix b/home/common/default.nix index 92e9285c4b..0584a33329 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -1851,6 +1851,11 @@ in # nixpkgs 4.94.0 vs npm 4.147.0 -- 53 minor versions behind, the # largest gap in this config. See pkgs/wrangler. (pkgs.callPackage ../../pkgs/wrangler { }) + # cf is Wrangler's successor (open beta 2026-09-28, not in + # nixpkgs). Standing direction 2026-10-20: prefer cf for + # Cloudflare work; wrangler stays for existing projects until + # migrated (`cf migrate`). See pkgs/cf. + (pkgs.callPackage ../../pkgs/cf { }) wtf wttrbar xclip diff --git a/nixos/environment/default.nix b/nixos/environment/default.nix index d536a05c69..deb1d697e2 100644 --- a/nixos/environment/default.nix +++ b/nixos/environment/default.nix @@ -448,6 +448,8 @@ in wpa_supplicant_gui # Cloudflare Workers CLI; available as a native nixpkgs package. wrangler + # cf, Wrangler's successor (open beta, not in nixpkgs). See pkgs/cf. + (pkgs.callPackage ../../pkgs/cf { }) bitwarden-cli # Bitwarden Vault CLI (bw) bws # Bitwarden Secrets Manager CLI (bws) ]) diff --git a/pkgs/cf/default.nix b/pkgs/cf/default.nix new file mode 100644 index 0000000000..869dff354b --- /dev/null +++ b/pkgs/cf/default.nix @@ -0,0 +1,86 @@ +{ + lib, + buildNpmPackage, + fetchurl, + nodejs, +}: + +# Cloudflare `cf` CLI -- Wrangler's successor. +# https://blog.cloudflare.com/cloudflare-cf-cli-launch/ +# Source: https://github.com/cloudflare/cf (packages/cli) +# +# Why this exists rather than using pkgs.cf / nixpkgs: +# `cf` entered open beta 2026-09-28 and is not in nixpkgs. It covers the +# whole Cloudflare API (2,900+ commands generated from the API's OpenAPI +# schema, vs Wrangler's ~280 hand-written ones), prints JSON by default, +# and uses a TypeScript config (cloudflare.config.ts); `cf migrate` +# converts existing wrangler.jsonc projects. Cloudflare's stated plan: +# when the beta ends, Wrangler gets one final major release pointing at +# `cf`, then 18 months of maintenance. +# +# Standing direction (Drew, 2026-10-20): prefer `cf` for Cloudflare work; +# Wrangler (../wrangler) stays installed for existing wrangler.jsonc +# projects until they are migrated. +# +# Packaging notes (mirrors ../wrangler): +# * npm is the only distribution channel (`npm i -g cf` upstream). +# * The npm tarball ships no package-lock.json, so one is vendored here, +# generated from the published package.json with devDependencies / +# scripts stripped and `npm install --package-lock-only`. The same +# strip is reapplied in postPatch so the lock matches package.json. +# * Runtime deps are small: miniflare (which pulls the workerd binary), +# @cloudflare/config, @cloudflare/runtime-types, +# @cloudflare/build-output-utils, blake3-wasm. +# * Upstream publishes two bin names -- cf and cloudflare -- both +# pointing at ./bin/cf. npmInstallHook creates both. +# * To update: bump version, update `hash`, regenerate package-lock.json +# as above, then set npmDepsHash from the build failure message. + +let + version = "1.0.0-beta.20"; +in +buildNpmPackage { + pname = "cf"; + inherit version nodejs; + + src = fetchurl { + url = "https://registry.npmjs.org/cf/-/cf-${version}.tgz"; + hash = "sha256-ITv9lUJXSut0qeOU2cfXkxq1dFxJQorMj18bqLUlMzE="; + }; + + postPatch = '' + cp ${./package-lock.json} package-lock.json + chmod +w package.json package-lock.json + + ${lib.getExe nodejs} -e ' + const fs = require("fs"); + const p = JSON.parse(fs.readFileSync("package.json", "utf8")); + delete p.devDependencies; + delete p.scripts; + delete p.workspaces; + fs.writeFileSync("package.json", JSON.stringify(p, null, 2)); + ' + ''; + + npmDepsHash = "sha256-PX7yp2bL1C+bqA5B2lKXe9b0NyCsJ9SicMLbefZQy00="; + + npmFlags = [ + "--ignore-scripts" + "--no-audit" + "--no-fund" + ]; + + dontNpmBuild = true; + + meta = { + description = "The Cloudflare CLI — manage your Cloudflare resources (Wrangler's successor, open beta)"; + homepage = "https://github.com/cloudflare/cf"; + downloadPage = "https://www.npmjs.com/package/cf"; + license = with lib.licenses; [ + mit + asl20 + ]; + mainProgram = "cf"; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/cf/package-lock.json b/pkgs/cf/package-lock.json new file mode 100644 index 0000000000..35dc8e2759 --- /dev/null +++ b/pkgs/cf/package-lock.json @@ -0,0 +1,951 @@ +{ + "name": "cf", + "version": "1.0.0-beta.20", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cf", + "version": "1.0.0-beta.20", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/build-output-utils": "0.9.3", + "@cloudflare/config": "0.27.0", + "@cloudflare/runtime-types": "0.1.14", + "blake3-wasm": "2.1.5", + "miniflare": "5.20261019.1-beta" + }, + "bin": { + "cf": "bin/cf", + "cloudflare": "bin/cf" + }, + "engines": { + "node": "^22.23.0 || ^24.22.0 || ^26.12.0" + } + }, + "node_modules/@cloudflare/build-output-utils": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@cloudflare/build-output-utils/-/build-output-utils-0.9.3.tgz", + "integrity": "sha512-0MgvIq6UxbRWLwB2QJU7qjLqpPkfygOebN3UiENhdp+z6zpRKrNnwkms2ynadmxCOh3sL2v+SI0/pNXxgXdteA==", + "license": "MIT", + "dependencies": { + "@cloudflare/config": "0.27.0" + } + }, + "node_modules/@cloudflare/config": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@cloudflare/config/-/config-0.27.0.tgz", + "integrity": "sha512-wNnL0z4lj5Gm2fze5qXTOvRPbUOi4jlMmwPk7ArCUakI5oVxgjfl3Rhnfd/Mmzo3g86x/ofH75yPIhsa5msqdQ==", + "license": "MIT", + "dependencies": { + "zod": "4.6.5" + } + }, + "node_modules/@cloudflare/runtime-types": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/@cloudflare/runtime-types/-/runtime-types-0.1.14.tgz", + "integrity": "sha512-Hx4/RGjTNKPTB0z6q9MRv6GzvnL496EBvvBaUpANilSLfQJFXVkmClrbiMkzTFjzVRTgMsOhO8exwwkZu3OM8w==", + "license": "MIT", + "dependencies": { + "miniflare": "5.20261019.1-beta", + "workerd": "1.20261019.1" + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20261019.1.tgz", + "integrity": "sha512-5ZILbAta/fBQvhmAYeCE7dKMMYIr7N9wJEX50fEGLKSIwGtvT0HzSfHNIK/O7cBQ4gHQ2WfIiPClvwcye6E0fA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20261019.1.tgz", + "integrity": "sha512-cww2Ab6lVMxpTiEEjKmPI58p5EMo0vYTZSH+3WkqXJdQgc3ES66GuL247+U2B2YWajhhu2tqj7jySrXneU749g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20261019.1.tgz", + "integrity": "sha512-4++VRi9vkQROYqrpZYOixIJuVDmujkwrT4kszsxNFlvcmsX6Mr2GumvxIN3gIixS3vJUh3Umdtkthqj5X0S3Xw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20261019.1.tgz", + "integrity": "sha512-75PVtJOwfjScQ53sbLtQXI7D8yP1c21t+WEUPaYbqkzaz4ZqfR5wAd+zuWs8G5Q7kOj2SQIvEfY5Sn8Y+UVrnA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20261019.1.tgz", + "integrity": "sha512-z49fvKTETMCnG6wnMcQwxx9CpryFceiKz04FRjq26EkhCyzRNJ6c3UXhyZz3r5f1CXnnBZc5DcU8ZouPkUJCqw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "license": "CC0-1.0" + }, + "node_modules/blake3-wasm": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/miniflare": { + "version": "5.20261019.1-beta", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261019.1-beta.tgz", + "integrity": "sha512-1n7MN2UqZnPniyYAqNuV1YEAaja66ozKGVCc5ZTmYQhTubnoAwGLccwb+ZWYLOajuw3pOaJ70u//bZMuURlRew==", + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.5", + "undici": "7.29.1", + "workerd": "1.20261019.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD", + "optional": true + }, + "node_modules/undici": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz", + "integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/workerd": { + "version": "1.20261019.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20261019.1.tgz", + "integrity": "sha512-UUYRUq/7DmeCl11YriNbcVbjUZVLtt8uuCXFu+nz77hGFf8d4DEVXoCYtnA+MlBatE4+wxoj47DVqzK3xGBAiw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20261019.1", + "@cloudflare/workerd-darwin-arm64": "1.20261019.1", + "@cloudflare/workerd-linux-64": "1.20261019.1", + "@cloudflare/workerd-linux-arm64": "1.20261019.1", + "@cloudflare/workerd-windows-64": "1.20261019.1" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + }, + "node_modules/zod": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz", + "integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} From a772fc2f391234cbdd4ed169d9174b13e8994801 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Tue, 20 Oct 2026 15:27:14 -0500 Subject: [PATCH 3/4] fix(lab-ops-hub): point crawler at fresh container instance name Container instances pin the image they were created with; after the v1->v3 image fix, existing instance names kept serving the old image. crawler-4 is a fresh instance name under the current v3 config (TLS CA fix verified inside the image: nss-cacert bundle + explicit cafile context in app.py). Note: Cloudflare container first-starts were intermittently failing with platform 'internal error' reference IDs on 2026-10-20 even for the known-good v1 image; the Worker falls back to its in-Worker crawler whenever the container is unavailable. --- pkgs/lab-ops-hub/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lab-ops-hub/src/index.ts b/pkgs/lab-ops-hub/src/index.ts index e38ba01489..7dfb2ad288 100644 --- a/pkgs/lab-ops-hub/src/index.ts +++ b/pkgs/lab-ops-hub/src/index.ts @@ -93,7 +93,7 @@ export class CrawlerContainer extends Container { } async function crawlWithContainer(env: Env, url: string) { - const container = getContainer(env.CRAWLER, "crawler-3"); + const container = getContainer(env.CRAWLER, "crawler-4"); const res = await container.fetch( new Request("http://container/crawl", { method: "POST", From f7760013a69d49c9b36ab785b2e5b97327a34baf Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Wed, 21 Oct 2026 01:06:41 -0500 Subject: [PATCH 4/4] fix(lab-ops-hub): require API token auth, validate crawl targets, compute budget overage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #441: every /api/* route except /api/health now requires the API_TOKEN Worker secret (Bearer / x-api-token / ?token= for WebSocket and downloads), compared in constant time. The gate fails closed (503) when the secret is unset, so a redeploy cannot silently re-open the mutating, upload, AI and crawl endpoints. Both crawlers (Worker fallback + container, independently) refuse non-http(s) schemes, localhost-style names and non-public IP literals; the container also validates redirect targets. The dashboard prompts for the token and keeps it in sessionStorage. Fixes #442: /api/budget's estimated_overage_usd is computed from the counted usage (sum of max(0, used - included) * rate per resource) instead of a hardcoded 0, and the d1_rows_written counter now covers every D1 write path (tasks, files, summary update, crawls, queue indexing, cron trim) plus the usage ledger's own rows, accounted for explicitly. Pure helpers live in src/lib.ts with Node tests (npm test, 6/6); the auth gate was verified end-to-end against the real fetch handler with stubbed bindings (401 unauthenticated, 201 with token, 503 unset secret, 400 private crawl). Also applies the repo formatter to the PR's lab-ops-hub files and container-image.nix — the branch's treefmt check was failing (7+ files unformatted); format-check now reports 0 changed. --- pkgs/lab-ops-hub/README.md | 60 +++++-- pkgs/lab-ops-hub/container-image.nix | 14 +- pkgs/lab-ops-hub/container/app.py | 65 ++++++-- pkgs/lab-ops-hub/package.json | 23 ++- pkgs/lab-ops-hub/public/index.html | 187 ++++++++++++++++++---- pkgs/lab-ops-hub/src/index.ts | 223 +++++++++++++++++++++------ pkgs/lab-ops-hub/src/lib.ts | 152 ++++++++++++++++++ pkgs/lab-ops-hub/test/lib.test.ts | 67 ++++++++ pkgs/lab-ops-hub/tsconfig.json | 13 +- 9 files changed, 691 insertions(+), 113 deletions(-) create mode 100644 pkgs/lab-ops-hub/src/lib.ts create mode 100644 pkgs/lab-ops-hub/test/lib.test.ts diff --git a/pkgs/lab-ops-hub/README.md b/pkgs/lab-ops-hub/README.md index fab9c160cd..fc4e6b9db8 100644 --- a/pkgs/lab-ops-hub/README.md +++ b/pkgs/lab-ops-hub/README.md @@ -3,19 +3,19 @@ One Worker that exercises the whole Workers Paid surface at personal scale, sized to stay inside the $5/mo plan's included amounts ($0 overage by design): -| Primitive | How it's used here | -|---|---| -| **Workers** | API + routing, queue consumer, cron handler, assets host | -| **D1** (`labops-db`) | machines / notes / tasks / files / crawls / usage ledger | -| **R2** (`labops-files`) | uploaded files + full crawl extracts (zero egress fees) | -| **KV** (`CACHE`) | machines-list cache, refreshed by cron | -| **Queues** (`labops-jobs`) | async file indexing (SHA-256 + mark indexed in D1) | -| **Durable Objects** (`LiveRoom`, SQLite) | live status board: WebSocket presence + broadcast, board persisted in DO SQLite | -| **Containers** (`CrawlerContainer`) | on-demand Python URL crawler; starts only when `/api/crawl` is called, `sleepAfter=2m` so idle minutes aren't burned. Worker-side fallback crawler with the same JSON contract if the container is unavailable | -| **Workers AI** | one-click note summarisation (`@cf/meta/llama-3.1-8b-instruct`, free-neuron allowance) | -| **Cron Triggers** | daily 04:23 UTC: trim usage ledger (90d), refresh KV snapshot | -| **Workers Assets** | the dashboard in `public/` | -| **Observability** | Workers Logs enabled in `wrangler.jsonc` | +| Primitive | How it's used here | +| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Workers** | API + routing, queue consumer, cron handler, assets host | +| **D1** (`labops-db`) | machines / notes / tasks / files / crawls / usage ledger | +| **R2** (`labops-files`) | uploaded files + full crawl extracts (zero egress fees) | +| **KV** (`CACHE`) | machines-list cache, refreshed by cron | +| **Queues** (`labops-jobs`) | async file indexing (SHA-256 + mark indexed in D1) | +| **Durable Objects** (`LiveRoom`, SQLite) | live status board: WebSocket presence + broadcast, board persisted in DO SQLite | +| **Containers** (`CrawlerContainer`) | on-demand Python URL crawler; starts only when `/api/crawl` is called, `sleepAfter=2m` so idle minutes aren't burned. Worker-side fallback crawler with the same JSON contract if the container is unavailable | +| **Workers AI** | one-click note summarisation (`@cf/meta/llama-3.1-8b-instruct`, free-neuron allowance) | +| **Cron Triggers** | daily 04:23 UTC: trim usage ledger (90d), refresh KV snapshot | +| **Workers Assets** | the dashboard in `public/` | +| **Observability** | Workers Logs enabled in `wrangler.jsonc` | ## The budget endpoint is the point @@ -23,11 +23,36 @@ sized to stay inside the $5/mo plan's included amounts ($0 overage by design): write, queue message, DO call, AI call and container run is counted) and reports month-to-date usage against the Workers Paid included amounts — so the demo continuously proves it is costing $0 over the $5 plan. +`estimated_overage_usd` is computed from the counted usage (for each +resource with an included amount and a rate, `max(0, used − included) × +rate`, summed — see `computeBudget` in `src/lib.ts`), and the D1 +rows-written count covers every application write path plus the usage +ledger's own rows (one D1 write per usage event, added explicitly). Cloudflare dashboard analytics remain authoritative; this is a self-check. ## API -- `GET /api/health` — binding check + row counts +**Auth (required):** every `/api/*` route except `GET /api/health` +requires the `API_TOKEN` Worker secret, sent as +`Authorization: Bearer ` (the dashboard prompts for it once and +keeps it in `sessionStorage`; WebSocket and file-download calls may pass +`?token=` instead). Unauthenticated calls get 401. If the secret is not +set on the deployment, the API fails closed with 503 — set it before +deploying: + +```bash +wrangler secret put API_TOKEN # one-time per deployment +``` + +**Crawl targets:** `POST /api/crawl` only fetches public `http:`/`https:` +URLs. Both crawlers (Worker fallback and container, independently) +refuse other schemes, localhost-style names, and private / loopback / +link-local / otherwise non-global IP literals, including redirect +targets in the container. Known residual: validation is on the literal +host — a public hostname that _resolves_ to a private address (DNS +rebinding) is not re-checked. + +- `GET /api/health` — binding check + row counts (the only public route) - `GET /api/budget` — self-counted usage vs included amounts - `GET|POST /api/machines` — cluster inventory (GET is KV-cached) - `GET|POST /api/notes`, `POST /api/notes/:id/summarize` — notes + AI summary @@ -51,8 +76,10 @@ npm run deploy # builds + pushes the container image, deploys the Worker npm run dev # local dev (containers run via workerd locally too) ``` -Auth: set `CLOUDFLARE_API_TOKEN` (scoped day-to-day token from Bitwarden) -or use the repo-standard wrapper — never commit a token. +Deploy auth: set `CLOUDFLARE_API_TOKEN` (scoped day-to-day token from +Bitwarden) or use the repo-standard wrapper — never commit a token. +Runtime API auth is separate: the `API_TOKEN` Worker secret above gates +the deployed API itself. ## Container image without a Docker daemon (what this sandbox does) @@ -79,6 +106,7 @@ wrangler), plain `npm run deploy` with the Dockerfile form works too; `container/Dockerfile` and `container-image.nix` build the same app. ### Known behaviour (observed 2026-10-20, D1-verified) + - **Root cause #1 (fixed): `:latest` tags are rejected.** Cloudflare Containers refuses application creation with "Latest tags are not allowed on images" (VALIDATE_INPUT). The config now pins `:v3`. diff --git a/pkgs/lab-ops-hub/container-image.nix b/pkgs/lab-ops-hub/container-image.nix index 69b5fcac33..448dc826c1 100644 --- a/pkgs/lab-ops-hub/container-image.nix +++ b/pkgs/lab-ops-hub/container-image.nix @@ -13,15 +13,23 @@ in pkgs.dockerTools.buildLayeredImage { name = "lab-ops-hub-crawlercontainer"; tag = "latest"; - contents = [ pkgs.python3 pkgs.cacert ]; + contents = [ + pkgs.python3 + pkgs.cacert + ]; extraCommands = '' mkdir -p app cp ${./container/app.py} app/app.py ''; config = { WorkingDir = "/app"; - Cmd = [ "python3" "app.py" ]; - ExposedPorts = { "8080/tcp" = { }; }; + Cmd = [ + "python3" + "app.py" + ]; + ExposedPorts = { + "8080/tcp" = { }; + }; # Nix python ships no CA bundle config; without this, outbound HTTPS # fails CERTIFICATE_VERIFY_FAILED inside the container. Env = [ "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ]; diff --git a/pkgs/lab-ops-hub/container/app.py b/pkgs/lab-ops-hub/container/app.py index b8100585d2..7137e76328 100644 --- a/pkgs/lab-ops-hub/container/app.py +++ b/pkgs/lab-ops-hub/container/app.py @@ -7,19 +7,59 @@ (Worker starts it via getContainer, sleepAfter=2m kills it when idle), so it burns container minutes only while crawling. """ + import glob +import ipaddress import json import re import ssl import urllib.request from html.parser import HTMLParser from http.server import BaseHTTPRequestHandler, HTTPServer +from urllib.parse import urlparse + +# Crawl-target policy (#441): the Worker validates before dispatching, +# and this service re-validates independently (defence in depth — it is +# the component that actually fetches). Only public http(s) targets: +# no other schemes, no localhost-style names, no non-global IP literals. +# Redirect targets are held to the same policy. +_BLOCKED_SUFFIXES = (".localhost", ".local", ".internal", ".lan", ".home.arpa") + + +def validate_crawl_url(raw): + u = urlparse(raw) + if u.scheme not in ("http", "https"): + raise ValueError("only http: and https: URLs may be crawled") + host = (u.hostname or "").lower() + if not host: + raise ValueError("url has no host") + if host == "localhost" or host.endswith(_BLOCKED_SUFFIXES): + raise ValueError(f"refusing to crawl local host {host}") + try: + ip = ipaddress.ip_address(host) + except ValueError: + return raw # a public DNS name; literal-IP policy does not apply + if not ip.is_global: + raise ValueError(f"refusing to crawl non-public address {host}") + return raw + + +class _ValidatingRedirectHandler(urllib.request.HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + validate_crawl_url(newurl) + return super().redirect_request(req, fp, code, msg, headers, newurl) + + +_OPENER = None # built after CTX below (the HTTPS handler carries it) # The Nix image's CA bundle lives at a store path; do not rely on the # container runtime propagating the image's SSL_CERT_FILE env var — # pass the CA file to the TLS context explicitly. _ca = glob.glob("/nix/store/*cacert*/etc/ssl/certs/ca-bundle.crt") CTX = ssl.create_default_context(cafile=_ca[0]) if _ca else ssl.create_default_context() +_OPENER = urllib.request.build_opener( + _ValidatingRedirectHandler, urllib.request.HTTPSHandler(context=CTX) +) class Extractor(HTMLParser): @@ -73,24 +113,31 @@ def do_POST(self): try: length = int(self.headers.get("content-length", "0")) url = json.loads(self.rfile.read(length))["url"] + try: + validate_crawl_url(url) + except ValueError as e: + return self._send(400, {"error": str(e)}) req = urllib.request.Request( url, headers={"User-Agent": "LabOpsHub-Crawler/0.1 (container)"} ) - # urlopen call below passes context=CTX - with urllib.request.urlopen(req, timeout=20, context=CTX) as res: + # TLS uses the pinned CA bundle via the opener's HTTPS handler. + with _OPENER.open(req, timeout=20) as res: raw = res.read(2_000_000) status = res.status html = raw.decode("utf-8", errors="replace") ex = Extractor() ex.feed(html) text = re.sub(r"\s+", " ", " ".join(ex.text)).strip() - self._send(200, { - "title": ex.title.strip(), - "excerpt": text[:500], - "links": ex.links, - "status_code": status, - "text": text[:20000], - }) + self._send( + 200, + { + "title": ex.title.strip(), + "excerpt": text[:500], + "links": ex.links, + "status_code": status, + "text": text[:20000], + }, + ) except Exception as e: # noqa: BLE001 - surface any crawl failure as JSON self._send(502, {"error": str(e)}) diff --git a/pkgs/lab-ops-hub/package.json b/pkgs/lab-ops-hub/package.json index bf473d90cc..cf66d701e1 100644 --- a/pkgs/lab-ops-hub/package.json +++ b/pkgs/lab-ops-hub/package.json @@ -1 +1,22 @@ -{"dependencies":{"@cloudflare/containers":"^0.3.7"},"devDependencies":{"@cloudflare/workers-types":"^5.20261019.1","typescript":"^5.6.0","wrangler":"4.147.0"},"name":"lab-ops-hub","private":true,"scripts":{"db:init":"wrangler d1 execute labops-db --remote --file=./schema.sql","db:init:local":"wrangler d1 execute labops-db --local --file=./schema.sql","deploy":"wrangler deploy","dev":"wrangler dev","types":"wrangler types"},"type":"module","version":"0.1.0"} \ No newline at end of file +{ + "dependencies": { + "@cloudflare/containers": "^0.3.7" + }, + "devDependencies": { + "@cloudflare/workers-types": "^5.20261019.1", + "typescript": "^5.6.0", + "wrangler": "4.147.0" + }, + "name": "lab-ops-hub", + "private": true, + "scripts": { + "db:init": "wrangler d1 execute labops-db --remote --file=./schema.sql", + "db:init:local": "wrangler d1 execute labops-db --local --file=./schema.sql", + "deploy": "wrangler deploy", + "dev": "wrangler dev", + "test": "node --test \"test/**/*.test.ts\"", + "types": "wrangler types" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/pkgs/lab-ops-hub/public/index.html b/pkgs/lab-ops-hub/public/index.html index 87cab7aa9b..38530b884f 100644 --- a/pkgs/lab-ops-hub/public/index.html +++ b/pkgs/lab-ops-hub/public/index.html @@ -1,42 +1,161 @@ - - - -Lab Ops Hub — Cloudflare demo - - - -

🛠️ Lab Ops Hub

-

One Worker exercising Workers + D1 + R2 + KV + Queues + Durable Objects + Containers + Workers AI + Cron — inside the $5 Workers Paid included amounts. See /api/budget.

+ + + + Lab Ops Hub — Cloudflare demo + + + +

🛠️ Lab Ops Hub

+

+ One Worker exercising Workers + D1 + R2 + KV + Queues + Durable Objects + + Containers + Workers AI + Cron — inside the $5 Workers Paid included + amounts. See /api/budget. +

-

Health

…
+
+

Health

+ + +
…
+
-

Machines (D1, cached in KV)

…
+
+

Machines (D1, cached in KV)

+ +
…
+
-

Crawl a URL (Container, Worker fallback)

- -
Container starts on demand and sleeps after 2m idle.
+
+

Crawl a URL (Container, Worker fallback)

+ + +
Container starts on demand and sleeps after 2m idle.
+
-

Live board (Durable Object + WebSocket)

- -
not connected
+
+

Live board (Durable Object + WebSocket)

+ + + +
not connected
+
- - + + diff --git a/pkgs/lab-ops-hub/src/index.ts b/pkgs/lab-ops-hub/src/index.ts index 7dfb2ad288..85df13e473 100644 --- a/pkgs/lab-ops-hub/src/index.ts +++ b/pkgs/lab-ops-hub/src/index.ts @@ -1,5 +1,6 @@ import { Container, getContainer } from "@cloudflare/containers"; import { DurableObject } from "cloudflare:workers"; +import { computeBudget, validateCrawlUrl } from "./lib"; // --------------------------------------------------------------------------- // Lab Ops Hub — one Worker exercising the whole Workers Paid surface at @@ -18,11 +19,14 @@ interface Env { CRAWLER: DurableObjectNamespace; AI: Ai; ASSETS: Fetcher; + // Worker secret (`wrangler secret put API_TOKEN`). Every /api/* route + // except /api/health requires it as a Bearer token (#441). Optional in + // the type only so a misconfigured deploy compiles — at runtime the + // gate fails CLOSED (503) when the secret is unset. + API_TOKEN?: string; } -type Job = - | { type: "index-file"; r2Key: string } - | { type: "crawl"; crawlId: number; url: string }; +type Job = { type: "index-file"; r2Key: string } | { type: "crawl"; crawlId: number; url: string }; const json = (data: unknown, status = 200) => new Response(JSON.stringify(data, null, 2), { @@ -33,10 +37,39 @@ const json = (data: unknown, status = 200) => async function logUsage(env: Env, kind: string, detail = "") { // Fire-and-forget ledger write; the budget endpoint reads this back. try { - await env.DB.prepare("INSERT INTO usage_events (kind, detail) VALUES (?1, ?2)") - .bind(kind, detail) - .run(); - } catch { /* ledger must never break the real request */ } + await env.DB.prepare("INSERT INTO usage_events (kind, detail) VALUES (?1, ?2)").bind(kind, detail).run(); + } catch { + /* ledger must never break the real request */ + } +} + +// --- API auth (#441) --------------------------------------------------------- +// The Worker is public on workers.dev; without a gate anyone could write +// D1/R2 rows, spend AI neurons and container minutes, and use the crawler +// as an open fetch proxy. All /api/* routes except /api/health require +// `Authorization: Bearer ` (or `x-api-token`, or `?token=` for +// the WebSocket / file-download cases that cannot set headers). + +async function timingSafeTokenEqual(given: string, expected: string): Promise { + const enc = new TextEncoder(); + const [a, b] = await Promise.all([ + crypto.subtle.digest("SHA-256", enc.encode(given)), + crypto.subtle.digest("SHA-256", enc.encode(expected)), + ]); + const av = new Uint8Array(a); + const bv = new Uint8Array(b); + let diff = 0; + for (let i = 0; i < av.length; i++) diff |= av[i] ^ bv[i]; + return diff === 0; +} + +async function isAuthorized(req: Request, env: Env, url: URL): Promise { + const expected = env.API_TOKEN; + if (!expected) return false; + const header = req.headers.get("authorization"); + const bearer = header?.toLowerCase().startsWith("bearer ") ? header.slice(7).trim() : null; + const given = bearer ?? req.headers.get("x-api-token") ?? url.searchParams.get("token"); + return given !== null && given.length > 0 && timingSafeTokenEqual(given, expected); } async function sha256Hex(buf: ArrayBuffer): Promise { @@ -49,28 +82,28 @@ export class LiveRoom extends DurableObject { constructor(ctx: DurableObjectState, env: Env) { super(ctx, env); // SQLite-backed DO storage: last known cluster status snapshot. - this.ctx.storage.sql.exec( - `CREATE TABLE IF NOT EXISTS status (k TEXT PRIMARY KEY, v TEXT)` - ); + this.ctx.storage.sql.exec(`CREATE TABLE IF NOT EXISTS status (k TEXT PRIMARY KEY, v TEXT)`); } async fetch(req: Request): Promise { if (req.headers.get("Upgrade") === "websocket") { const pair = new WebSocketPair(); this.ctx.acceptWebSocket(pair[1]); - const snap = this.ctx.storage.sql - .exec("SELECT v FROM status WHERE k='board'") - .one() as { v?: string } | null; - pair[1].send(JSON.stringify({ type: "snapshot", board: snap?.v ?? null, clients: this.ctx.getWebSockets().length })); + const snap = this.ctx.storage.sql.exec("SELECT v FROM status WHERE k='board'").one() as { v?: string } | null; + pair[1].send( + JSON.stringify({ type: "snapshot", board: snap?.v ?? null, clients: this.ctx.getWebSockets().length }), + ); return new Response(null, { status: 101, webSocket: pair[0] }); } if (req.method === "POST") { const board = await req.text(); this.ctx.storage.sql.exec( "INSERT INTO status (k, v) VALUES ('board', ?1) ON CONFLICT(k) DO UPDATE SET v=?1", - board + board, ); for (const ws of this.ctx.getWebSockets()) { - try { ws.send(JSON.stringify({ type: "board", board })); } catch {} + try { + ws.send(JSON.stringify({ type: "board", board })); + } catch {} } return json({ ok: true, clients: this.ctx.getWebSockets().length }); } @@ -78,7 +111,9 @@ export class LiveRoom extends DurableObject { } async webSocketMessage(ws: WebSocket, message: string) { for (const other of this.ctx.getWebSockets()) { - try { other.send(message); } catch {} + try { + other.send(message); + } catch {} } } } @@ -87,9 +122,15 @@ export class LiveRoom extends DurableObject { export class CrawlerContainer extends Container { defaultPort = 8080; sleepAfter = "2m"; // die quickly; container minutes are the scarce resource - override onStart() { console.log("crawler container started"); } - override onStop() { console.log("crawler container stopped"); } - override onError(err: unknown) { console.log("crawler container error:", err); } + override onStart() { + console.log("crawler container started"); + } + override onStop() { + console.log("crawler container stopped"); + } + override onError(err: unknown) { + console.log("crawler container error:", err); + } } async function crawlWithContainer(env: Env, url: string) { @@ -103,10 +144,16 @@ async function crawlWithContainer(env: Env, url: string) { // fall back to the in-Worker crawler after 120s (cold starts of a // 225 MB Nix-built image can take most of a minute to provision). signal: AbortSignal.timeout(120_000), - }) + }), ); if (!res.ok) throw new Error(`container returned ${res.status}: ${(await res.text()).slice(0, 300)}`); - return res.json() as Promise<{ title?: string; excerpt?: string; links?: number; status_code?: number; text?: string }>; + return res.json() as Promise<{ + title?: string; + excerpt?: string; + links?: number; + status_code?: number; + text?: string; + }>; } async function crawlFallback(url: string) { @@ -115,7 +162,11 @@ async function crawlFallback(url: string) { const html = await res.text(); const title = html.match(/]*>([^<]*)<\/title>/i)?.[1]?.trim() ?? ""; const links = (html.match(//gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim(); + const text = html + .replace(//gi, "") + .replace(/<[^>]+>/g, " ") + .replace(/\s+/g, " ") + .trim(); return { title, excerpt: text.slice(0, 500), links, status_code: res.status, text: text.slice(0, 20000) }; } @@ -124,13 +175,27 @@ export default { async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise { const url = new URL(req.url); const p = url.pathname; + + // Auth gate (#441): everything under /api/ except /api/health needs + // the API token. Fail closed when the secret is not configured, so a + // redeploy that forgets `wrangler secret put API_TOKEN` cannot + // silently re-open the mutating/AI/crawl endpoints. + if (p.startsWith("/api/") && p !== "/api/health") { + if (!env.API_TOKEN) { + return json({ error: "API auth is not configured: set the API_TOKEN Worker secret" }, 503); + } + if (!(await isAuthorized(req, env, url))) { + return json({ error: "unauthorized: send Authorization: Bearer " }, 401); + } + } + ctx.waitUntil(logUsage(env, "worker_request", `${req.method} ${p}`)); try { // Health: prove every binding is wired. if (p === "/api/health") { const counts = await env.DB.prepare( - "SELECT (SELECT COUNT(*) FROM machines) AS machines, (SELECT COUNT(*) FROM notes) AS notes, (SELECT COUNT(*) FROM files) AS files" + "SELECT (SELECT COUNT(*) FROM machines) AS machines, (SELECT COUNT(*) FROM notes) AS notes, (SELECT COUNT(*) FROM files) AS files", ).first(); return json({ ok: true, service: "lab-ops-hub", counts, time: new Date().toISOString() }); } @@ -139,17 +204,18 @@ export default { // Prices are the plan's published overage rates (see the reference doc). if (p === "/api/budget") { const rows = await env.DB.prepare( - "SELECT kind, COUNT(*) AS n FROM usage_events WHERE created_at >= datetime('now','start of month') GROUP BY kind" + "SELECT kind, COUNT(*) AS n FROM usage_events WHERE created_at >= datetime('now','start of month') GROUP BY kind", ).all<{ kind: string; n: number }>(); const by = Object.fromEntries(rows.results.map((r) => [r.kind, r.n])); - const included = { - worker_requests: { used: by.worker_request ?? 0, included: 10_000_000, overage_per_million_usd: 0.30 }, - d1_rows_written: { used: by.d1_write ?? 0, included: 50_000_000, overage_per_million_usd: 1.00 }, - queue_operations: { used: by.queue_msg ?? 0, included: 1_000_000, overage_per_operation_usd: 0.0000004 }, - container_runs: { used: by.container_run ?? 0, included: null, note: "billed per 10ms vCPU/memory/disk; runs are on-demand only, sleepAfter=2m" }, - ai_requests: { used: by.ai_request ?? 0, included: 10_000, note: "10,000 free neurons/day on Workers AI" }, - }; - return json({ plan: "Workers Paid ($5/mo)", month_to_date_self_counted: included, estimated_overage_usd: 0, note: "Self-counted by this Worker; Cloudflare dashboard analytics are authoritative." }); + // Overage is computed from the counted usage (#442), and the D1 + // write count covers every write path plus the ledger's own rows + // (see computeBudget in src/lib.ts). + const budget = computeBudget(by); + return json({ + plan: "Workers Paid ($5/mo)", + ...budget, + note: "Self-counted by this Worker; Cloudflare dashboard analytics are authoritative.", + }); } // Machines (D1) @@ -164,27 +230,43 @@ export default { if (p === "/api/machines" && req.method === "POST") { const b = (await req.json()) as Record; const r = await env.DB.prepare( - "INSERT INTO machines (name, role, cpu, ram_gb, storage, gpu, status, notes) VALUES (?1,?2,?3,?4,?5,?6,?7,?8)" - ).bind(b.name, b.role ?? "compute", b.cpu ?? null, b.ram_gb ?? null, b.storage ?? null, b.gpu ?? null, b.status ?? "planned", b.notes ?? null).run(); + "INSERT INTO machines (name, role, cpu, ram_gb, storage, gpu, status, notes) VALUES (?1,?2,?3,?4,?5,?6,?7,?8)", + ) + .bind( + b.name, + b.role ?? "compute", + b.cpu ?? null, + b.ram_gb ?? null, + b.storage ?? null, + b.gpu ?? null, + b.status ?? "planned", + b.notes ?? null, + ) + .run(); ctx.waitUntil(Promise.all([logUsage(env, "d1_write", "machine"), env.CACHE.delete("machines:all")])); return json({ ok: true, id: r.meta.last_row_id }, 201); } // Notes (D1) + Workers AI summarisation if (p === "/api/notes" && req.method === "GET") { - const { results } = await env.DB.prepare("SELECT id, title, summary, tags, created_at FROM notes ORDER BY id DESC LIMIT 100").all(); + const { results } = await env.DB.prepare( + "SELECT id, title, summary, tags, created_at FROM notes ORDER BY id DESC LIMIT 100", + ).all(); return json({ notes: results }); } if (p === "/api/notes" && req.method === "POST") { const b = (await req.json()) as { title: string; body: string; tags?: string }; const r = await env.DB.prepare("INSERT INTO notes (title, body, tags) VALUES (?1,?2,?3)") - .bind(b.title, b.body, b.tags ?? "").run(); + .bind(b.title, b.body, b.tags ?? "") + .run(); ctx.waitUntil(logUsage(env, "d1_write", "note")); return json({ ok: true, id: r.meta.last_row_id }, 201); } const sumMatch = p.match(/^\/api\/notes\/(\d+)\/summarize$/); if (sumMatch && req.method === "POST") { - const note = await env.DB.prepare("SELECT * FROM notes WHERE id=?1").bind(sumMatch[1]).first<{ body: string }>(); + const note = await env.DB.prepare("SELECT * FROM notes WHERE id=?1") + .bind(sumMatch[1]) + .first<{ body: string }>(); if (!note) return json({ error: "note not found" }, 404); ctx.waitUntil(logUsage(env, "ai_request", "summarize")); const ai = (await env.AI.run("@cf/meta/llama-3.2-3b-instruct", { @@ -195,6 +277,7 @@ export default { })) as { response?: string }; const summary = (ai.response ?? "").trim(); await env.DB.prepare("UPDATE notes SET summary=?1 WHERE id=?2").bind(summary, sumMatch[1]).run(); + ctx.waitUntil(logUsage(env, "d1_write", "note-summary")); return json({ ok: true, summary }); } @@ -206,7 +289,9 @@ export default { if (p === "/api/tasks" && req.method === "POST") { const b = (await req.json()) as { title: string; machine_id?: number; due?: string }; const r = await env.DB.prepare("INSERT INTO tasks (title, machine_id, due) VALUES (?1,?2,?3)") - .bind(b.title, b.machine_id ?? null, b.due ?? null).run(); + .bind(b.title, b.machine_id ?? null, b.due ?? null) + .run(); + ctx.waitUntil(logUsage(env, "d1_write", "task")); return json({ ok: true, id: r.meta.last_row_id }, 201); } @@ -223,16 +308,25 @@ export default { const key = `uploads/${Date.now()}-${file.name.replace(/[^\w.\-]+/g, "_")}`; await env.FILES.put(key, buf, { httpMetadata: { contentType: file.type || "application/octet-stream" } }); const r = await env.DB.prepare("INSERT INTO files (r2_key, filename, content_type, size) VALUES (?1,?2,?3,?4)") - .bind(key, file.name, file.type || null, buf.byteLength).run(); + .bind(key, file.name, file.type || null, buf.byteLength) + .run(); await env.JOBS.send({ type: "index-file", r2Key: key }); - ctx.waitUntil(Promise.all([logUsage(env, "r2_put", key), logUsage(env, "queue_msg", "index-file")])); + ctx.waitUntil( + Promise.all([ + logUsage(env, "d1_write", "file"), + logUsage(env, "r2_put", key), + logUsage(env, "queue_msg", "index-file"), + ]), + ); return json({ ok: true, id: r.meta.last_row_id, r2_key: key, queued: "index-file" }, 201); } const fileMatch = p.match(/^\/api\/files\/(.+)$/); if (fileMatch && req.method === "GET") { const obj = await env.FILES.get(decodeURIComponent(fileMatch[1])); if (!obj) return json({ error: "not found in R2" }, 404); - return new Response(obj.body, { headers: { "content-type": obj.httpMetadata?.contentType ?? "application/octet-stream" } }); + return new Response(obj.body, { + headers: { "content-type": obj.httpMetadata?.contentType ?? "application/octet-stream" }, + }); } // Live board (Durable Object, one global room) @@ -246,7 +340,14 @@ export default { if (p === "/api/crawl" && req.method === "POST") { const b = (await req.json()) as { url: string; via?: string }; if (!b.url) return json({ error: "url required" }, 400); - let result; let source = "container"; let containerError: string | undefined; + // SSRF guard (#441): both crawlers only fetch public http(s) + // targets; the container re-validates independently. + const target = validateCrawlUrl(b.url); + if (!target.ok) return json({ error: target.error }, 400); + b.url = target.url; + let result; + let source = "container"; + let containerError: string | undefined; try { if (b.via === "worker") throw new Error("caller requested worker path"); result = await crawlWithContainer(env, b.url); @@ -261,12 +362,33 @@ export default { httpMetadata: { contentType: "application/json" }, }); const r = await env.DB.prepare( - "INSERT INTO crawls (url, source, title, excerpt, links, status_code, r2_key) VALUES (?1,?2,?3,?4,?5,?6,?7)" - ).bind(b.url, source, result.title ?? null, result.excerpt ?? null, result.links ?? null, result.status_code ?? null, key).run(); - return json({ ok: true, id: r.meta.last_row_id, source, ...(containerError ? { container_error: containerError } : {}), title: result.title, links: result.links, r2_key: key }); + "INSERT INTO crawls (url, source, title, excerpt, links, status_code, r2_key) VALUES (?1,?2,?3,?4,?5,?6,?7)", + ) + .bind( + b.url, + source, + result.title ?? null, + result.excerpt ?? null, + result.links ?? null, + result.status_code ?? null, + key, + ) + .run(); + ctx.waitUntil(Promise.all([logUsage(env, "d1_write", "crawl"), logUsage(env, "r2_put", key)])); + return json({ + ok: true, + id: r.meta.last_row_id, + source, + ...(containerError ? { container_error: containerError } : {}), + title: result.title, + links: result.links, + r2_key: key, + }); } if (p === "/api/crawls" && req.method === "GET") { - const { results } = await env.DB.prepare("SELECT id, url, source, title, links, status_code, created_at FROM crawls ORDER BY id DESC LIMIT 50").all(); + const { results } = await env.DB.prepare( + "SELECT id, url, source, title, links, status_code, created_at FROM crawls ORDER BY id DESC LIMIT 50", + ).all(); return json({ crawls: results }); } @@ -286,7 +408,9 @@ export default { if (obj) { const digest = await sha256Hex(await obj.arrayBuffer()); await env.DB.prepare("UPDATE files SET sha256=?1, indexed=1 WHERE r2_key=?2") - .bind(digest, msg.body.r2Key).run(); + .bind(digest, msg.body.r2Key) + .run(); + await logUsage(env, "d1_write", "file-index"); } } msg.ack(); @@ -301,10 +425,11 @@ export default { ctx.waitUntil( (async () => { await env.DB.prepare("DELETE FROM usage_events WHERE created_at < datetime('now','-90 days')").run(); + await logUsage(env, "d1_write", "cron-ledger-trim"); const { results } = await env.DB.prepare("SELECT * FROM machines ORDER BY name").all(); await env.CACHE.put("machines:all", JSON.stringify({ machines: results }, null, 2), { expirationTtl: 3600 }); console.log("lab-ops-hub cron: ledger trimmed, machines snapshot refreshed"); - })() + })(), ); }, } satisfies ExportedHandler; diff --git a/pkgs/lab-ops-hub/src/lib.ts b/pkgs/lab-ops-hub/src/lib.ts new file mode 100644 index 0000000000..55e9cc3f98 --- /dev/null +++ b/pkgs/lab-ops-hub/src/lib.ts @@ -0,0 +1,152 @@ +// Pure helpers for Lab Ops Hub: crawl-target validation (#441) and the +// /api/budget computation (#442). Kept free of Worker bindings so they can +// be unit-tested with plain Node (test/lib.test.ts). + +// --- Crawl URL validation --------------------------------------------------- +// The crawler fetches a caller-supplied URL from inside the Worker's / +// container's network position, so it must refuse anything that is not a +// public http(s) target: non-http schemes, localhost-style names, and +// private / loopback / link-local / otherwise non-global IP literals. +// (This checks the literal host only; a public hostname that resolves to a +// private address — DNS rebinding — is a documented residual in README.md. +// The Python container crawler applies the same policy independently.) + +function ipv4ToInt(host: string): number | null { + const parts = host.split("."); + if (parts.length !== 4) return null; + let n = 0; + for (const part of parts) { + if (!/^\d{1,3}$/.test(part)) return null; + const v = Number(part); + if (v > 255) return null; + n = n * 256 + v; + } + return n; +} + +function ipv4IsGlobal(n: number): boolean { + const a = Math.floor(n / 2 ** 24); + const b = Math.floor(n / 2 ** 16) % 256; + if (a === 0 || a === 10 || a === 127) return false; // "this" net, private, loopback + if (a === 100 && b >= 64 && b <= 127) return false; // CGNAT 100.64.0.0/10 + if (a === 169 && b === 254) return false; // link-local (cloud metadata) + if (a === 172 && b >= 16 && b <= 31) return false; // private 172.16.0.0/12 + if (a === 192 && b === 0) return false; // 192.0.0.0/24 + TEST-NET-1 192.0.2.0/24 + if (a === 192 && b === 88) return false; // 6to4 relay anycast (deprecated) + if (a === 192 && b === 168) return false; // private + if (a === 198 && (b === 18 || b === 19)) return false; // benchmarking + if (a === 198 && b === 51) return false; // TEST-NET-2 + if (a === 203 && b === 0) return false; // TEST-NET-3 203.0.113.0/24 + if (a >= 224) return false; // multicast + reserved + return true; +} + +function ipv6IsGlobal(host: string): boolean { + const h = host.toLowerCase(); + // IPv4-mapped address: judge the embedded IPv4 address. + const mapped = h.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/); + if (mapped) { + const v4 = ipv4ToInt(mapped[1]); + return v4 !== null && ipv4IsGlobal(v4); + } + if (h === "::" || h === "::1") return false; // unspecified, loopback + if (/^fe[89ab]/.test(h)) return false; // link-local fe80::/10 + if (/^f[cd]/.test(h)) return false; // unique-local fc00::/7 + if (/^ff/.test(h)) return false; // multicast + if (h.startsWith("2001:db8:")) return false; // documentation 2001:db8::/32 + // Global unicast lives in 2000::/3 (first hextet 2xxx or 3xxx). + return /^[23]/.test(h); +} + +const BLOCKED_HOST_SUFFIXES = [".localhost", ".local", ".internal", ".lan", ".home.arpa"]; + +export function validateCrawlUrl(raw: string): { ok: true; url: string } | { ok: false; error: string } { + let u: URL; + try { + u = new URL(raw); + } catch { + return { ok: false, error: "url is not a valid URL" }; + } + if (u.protocol !== "http:" && u.protocol !== "https:") { + return { ok: false, error: "only http: and https: URLs may be crawled" }; + } + // WHATWG URL normalises integer/hex IPv4 forms (e.g. 2130706433, + // 0x7f.1) to dotted-quad, and keeps IPv6 literals bracketed. + const host = u.hostname.toLowerCase(); + if (!host) return { ok: false, error: "url has no host" }; + if (host === "localhost" || BLOCKED_HOST_SUFFIXES.some((s) => host.endsWith(s))) { + return { ok: false, error: `refusing to crawl local host ${host}` }; + } + if (host.startsWith("[") && host.endsWith("]")) { + if (!ipv6IsGlobal(host.slice(1, -1))) { + return { ok: false, error: `refusing to crawl non-public IPv6 address ${host}` }; + } + return { ok: true, url: u.toString() }; + } + const v4 = ipv4ToInt(host); + if (v4 !== null && !ipv4IsGlobal(v4)) { + return { ok: false, error: `refusing to crawl non-public IPv4 address ${host}` }; + } + return { ok: true, url: u.toString() }; +} + +// --- Budget computation ------------------------------------------------------- +// estimated_overage_usd is computed from the counted usage, never a +// literal: for each resource with an included amount and a rate, +// max(0, used - included) * rate, summed. Resources without a rate +// (container runs, AI neurons) are shown but excluded from the sum. +// +// D1 rows written: the counter covers every application write path +// (each emits a "d1_write" usage event), PLUS the usage ledger's own +// writes, accounted for explicitly: every usage_events row is itself +// one D1 row written, so the ledger total (the sum of every kind's +// count, d1_write events included) is added on top. + +export interface BudgetResource { + used: number; + included: number | null; + overage_per_million_usd?: number; + overage_per_operation_usd?: number; + estimated_overage_usd?: number; + note?: string; +} + +function ratePerUnit(r: BudgetResource): number | null { + if (r.overage_per_million_usd !== undefined) return r.overage_per_million_usd / 1_000_000; + if (r.overage_per_operation_usd !== undefined) return r.overage_per_operation_usd; + return null; +} + +export function computeBudget(by: Record): { + month_to_date_self_counted: Record; + estimated_overage_usd: number; +} { + const ledgerRows = Object.values(by).reduce((sum, n) => sum + n, 0); + const resources: Record = { + worker_requests: { used: by.worker_request ?? 0, included: 10_000_000, overage_per_million_usd: 0.3 }, + d1_rows_written: { + used: (by.d1_write ?? 0) + ledgerRows, + included: 50_000_000, + overage_per_million_usd: 1.0, + note: "application writes (d1_write events) + the usage ledger's own rows (one D1 write per usage event)", + }, + queue_operations: { used: by.queue_msg ?? 0, included: 1_000_000, overage_per_operation_usd: 0.0000004 }, + container_runs: { + used: by.container_run ?? 0, + included: null, + note: "billed per 10ms vCPU/memory/disk; runs are on-demand only, sleepAfter=2m", + }, + ai_requests: { used: by.ai_request ?? 0, included: 10_000, note: "10,000 free neurons/day on Workers AI" }, + }; + let total = 0; + for (const r of Object.values(resources)) { + const rate = ratePerUnit(r); + if (rate === null || r.included === null) continue; + r.estimated_overage_usd = Math.max(0, r.used - r.included) * rate; + total += r.estimated_overage_usd; + } + return { + month_to_date_self_counted: resources, + estimated_overage_usd: Math.round(total * 1_000_000) / 1_000_000, + }; +} diff --git a/pkgs/lab-ops-hub/test/lib.test.ts b/pkgs/lab-ops-hub/test/lib.test.ts new file mode 100644 index 0000000000..ebf18ee441 --- /dev/null +++ b/pkgs/lab-ops-hub/test/lib.test.ts @@ -0,0 +1,67 @@ +// Unit tests for the pure helpers in src/lib.ts — run with plain Node +// (type stripping): `npm test`. No Worker bindings are involved. +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { computeBudget, validateCrawlUrl } from "../src/lib.ts"; + +test("validateCrawlUrl accepts public http(s) targets", () => { + assert.equal(validateCrawlUrl("https://example.com/page").ok, true); + assert.equal(validateCrawlUrl("http://developers.cloudflare.com/containers/").ok, true); + assert.equal(validateCrawlUrl("https://[2606:4700:4700::1111]/").ok, true); + assert.equal(validateCrawlUrl("https://8.8.8.8/").ok, true); +}); + +test("validateCrawlUrl refuses non-http schemes and junk", () => { + assert.equal(validateCrawlUrl("ftp://example.com/").ok, false); + assert.equal(validateCrawlUrl("file:///etc/passwd").ok, false); + assert.equal(validateCrawlUrl("not a url").ok, false); +}); + +test("validateCrawlUrl refuses loopback / private / link-local targets (#441)", () => { + const blocked = [ + "http://127.0.0.1/", + "http://127.1/", + "http://2130706433/", // WHATWG-normalises to 127.0.0.1 + "http://0x7f.1/", // hex form, also normalises to 127.0.0.1 + "http://10.0.0.5/", + "http://172.16.0.9/", + "http://192.168.1.1/", + "http://169.254.169.254/latest/meta-data/", // cloud metadata + "http://100.64.0.1/", // CGNAT + "https://[::1]/", + "https://[::ffff:127.0.0.1]/", // IPv4-mapped loopback + "https://[fe80::1]/", + "https://[fd00::1]/", + "http://localhost:8787/", + "http://printer.local/", + "http://nas.internal/", + ]; + for (const u of blocked) { + assert.equal(validateCrawlUrl(u).ok, false, u); + } +}); + +test("computeBudget reports $0 while usage is inside the included amounts", () => { + const b = computeBudget({ worker_request: 120, d1_write: 40, queue_msg: 3 }); + assert.equal(b.estimated_overage_usd, 0); + // d1 count = application writes + the ledger's own rows (120+40+3). + assert.equal(b.month_to_date_self_counted.d1_rows_written.used, 40 + 163); +}); + +test("computeBudget computes a non-zero overage past an included amount (#442)", () => { + // 20M worker requests: (20M - 10M) * $0.30/M = $3.00. The 20M ledger + // rows also count as D1 writes but stay under the 50M D1 allowance. + const b = computeBudget({ worker_request: 20_000_000 }); + assert.equal(b.month_to_date_self_counted.worker_requests.estimated_overage_usd, 3); + assert.equal(b.month_to_date_self_counted.d1_rows_written.used, 20_000_000); + assert.equal(b.estimated_overage_usd, 3); +}); + +test("computeBudget counts ledger rows toward D1 writes (#442)", () => { + // 30M application writes + their 30M ledger rows = 60M D1 rows: + // (60M - 50M) * $1.00/M = $10.00. + const b = computeBudget({ d1_write: 30_000_000 }); + assert.equal(b.month_to_date_self_counted.d1_rows_written.used, 60_000_000); + assert.equal(b.month_to_date_self_counted.d1_rows_written.estimated_overage_usd, 10); + assert.equal(b.estimated_overage_usd, 10); +}); diff --git a/pkgs/lab-ops-hub/tsconfig.json b/pkgs/lab-ops-hub/tsconfig.json index dea455b400..7117fbb9f1 100644 --- a/pkgs/lab-ops-hub/tsconfig.json +++ b/pkgs/lab-ops-hub/tsconfig.json @@ -1 +1,12 @@ -{"compilerOptions":{"lib":["ES2022"],"module":"ESNext","moduleResolution":"bundler","noEmit":true,"strict":true,"target":"ES2022","types":["@cloudflare/workers-types"]},"include":["src"]} \ No newline at end of file +{ + "compilerOptions": { + "lib": ["ES2022"], + "module": "ESNext", + "moduleResolution": "bundler", + "noEmit": true, + "strict": true, + "target": "ES2022", + "types": ["@cloudflare/workers-types"] + }, + "include": ["src"] +}