@valiron/sdk 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +12 -0
  2. package/bin/valiron-card.mjs +211 -0
  3. package/dist/card.d.ts +565 -0
  4. package/dist/card.js +722 -0
  5. package/dist/clients.js +2 -2
  6. package/dist/edge.d.ts +87 -0
  7. package/dist/edge.js +164 -0
  8. package/dist/edgeGate.d.ts +146 -0
  9. package/dist/edgeGate.js +230 -0
  10. package/dist/edgeGateVerify.d.ts +146 -0
  11. package/dist/edgeGateVerify.js +243 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/middleware.d.ts +2 -0
  15. package/dist/middleware.js +6 -3
  16. package/dist/operatorSdk.d.ts +8 -0
  17. package/dist/operatorSdk.js +8 -0
  18. package/docs/API-REFERENCE.md +59 -80
  19. package/docs/CLOUDFLARE-GATE-MIDDLEWARE.md +196 -0
  20. package/docs/CRAWLER-PROTECTION.md +509 -25
  21. package/docs/DASHBOARD.md +72 -214
  22. package/docs/E2E-MIDDLEWARE-INTEGRATION.md +9 -46
  23. package/docs/ERRORS.md +3 -11
  24. package/docs/PROVIDER-IDENTITY.md +1 -1
  25. package/docs/QUICKSTART.md +7 -22
  26. package/docs/README.md +10 -9
  27. package/docs/SDK-REFERENCE.md +51 -7
  28. package/docs/SECURITY-UPGRADE-2026-10-31.md +3 -3
  29. package/docs/llms.txt +19 -14
  30. package/examples/cloudflare-gate-worker/README.md +198 -0
  31. package/examples/cloudflare-gate-worker/package.json +20 -0
  32. package/examples/cloudflare-gate-worker/worker.ts +309 -0
  33. package/examples/cloudflare-gate-worker/wrangler.toml +46 -0
  34. package/examples/cloudflare-worker/package.json +8 -0
  35. package/examples/cloudflare-worker/worker.ts +495 -0
  36. package/examples/cloudflare-worker/wrangler.toml +57 -0
  37. package/package.json +34 -4
  38. package/docs/AGENT-READY-APIS.md +0 -294
@@ -1,8 +1,8 @@
1
1
  # Valiron Crawler Protection
2
2
 
3
- Website guide: [Valiron Crawler Protection documentation](https://www.valiron.co/docs/crawler-protection). Browse the [quickstart](https://www.valiron.co/docs/crawler-protection/quickstart), [integration](https://www.valiron.co/docs/crawler-protection/integration), [bot verification](https://www.valiron.co/docs/crawler-protection/bot-verification), [policies](https://www.valiron.co/docs/crawler-protection/policies), [analytics](https://www.valiron.co/docs/crawler-protection/analytics), and [recovery](https://www.valiron.co/docs/crawler-protection/operations) guides.
3
+ Website guide: [Valiron Crawler Protection documentation](https://www.valiron.co/docs/crawler-protection). Browse the [traffic insights](https://www.valiron.co/docs/crawler-protection/observability), [edge rules](https://www.valiron.co/docs/crawler-protection/edge-protection), [quickstart](https://www.valiron.co/docs/crawler-protection/quickstart), [integration](https://www.valiron.co/docs/crawler-protection/integration), [bot verification](https://www.valiron.co/docs/crawler-protection/bot-verification), [policies](https://www.valiron.co/docs/crawler-protection/policies), [analytics](https://www.valiron.co/docs/crawler-protection/analytics), [recovery](https://www.valiron.co/docs/crawler-protection/operations), and [plans and usage](https://www.valiron.co/docs/crawler-protection/plans-and-usage) guides.
4
4
 
5
- **Plan: Pro (also available to Enterprise accounts).** Starting with SDK 0.2.0, supported runtime use requires your account’s server-side operator API key. The earlier 0.1.0 package does not contain this activation check.
5
+ **Plans.** Traffic insights and the edge rules simulator are included with Pro. Blocking traffic, with edge rules at Cloudflare or AWS WAF or with the self-hosted gateway or SDK, needs the **Crawler Protection add-on ($29.99/month on top of Pro)**, or Enterprise. Allowances and usage billing are in [Plans & usage](#what-each-plan-includes).
6
6
 
7
7
  Install `@valiron/crawler-protection` from npm with Node.js 22 or later:
8
8
 
@@ -12,33 +12,344 @@ npm install @valiron/crawler-protection
12
12
 
13
13
  The package contains the standalone gateway, Node/Nuxt adapters, private work API contract and Python helper. It is separate from `@valiron/sdk`; installing the SDK does not install crawler verification or shared workload admission. Follow the deployment guide after installation.
14
14
 
15
+ **Traffic insights** (Pro) need no installation: connect existing request logs (Cloudflare, AWS WAF, CloudFront, load balancer or web server) or a passive request logger to see verified crawler traffic without changing how it is handled. See [How traffic insights work](#how-traffic-insights-work). The [simulator](#simulator) replays edge rules against that traffic, and [edge protection](#edge-protection) deploys them to Cloudflare or AWS WAF.
16
+
15
17
  The guard combines source verification, weighted route budgets and concurrency controls before protected server work. Crawlers do not need a Valiron account, agent key, wallet or blockchain identity.
16
18
 
17
19
  ## Website setup
18
20
 
19
- Choose **Crawler Protection** in the dashboard Product switcher (`/dashboard/crawler-protection`). Free, Pro and Enterprise accounts open **Setup & configuration** (`/dashboard/crawler-protection/setup`) to follow a three-step connection guide, copy developer handoff instructions, validate a schema-v1 site configuration with an optional measured baseline, review rollout blockers and download the validated configuration scoped to their account. The server checks the current authenticated plan; a client-supplied plan does not unlock validation.
21
+ Self-hosted setup lives in **Dashboard → Crawler Protection → Setup** (`/dashboard/crawler-protection/setup`, Pro and Enterprise). It has three steps:
22
+
23
+ 1. **Install the package and create a server-side API key.** **Give this to your coding agent** copies a complete setup prompt.
24
+ 2. **Validate your site configuration.** Paste your schema-v1 configuration, optionally with a measured baseline, then download the validated file. **Load example** fills in an illustrative configuration; replace every limit and route before you deploy it.
25
+ 3. **Connect your runtime.** Once the gateway or SDK reports, Setup shows it as connected. A report must be less than two minutes old to count.
26
+
27
+ Validating and exporting a configuration does not deploy it or turn protection on. Your team installs the runtime in its own infrastructure. After that, **Self-hosted → Controls** can publish crawler access and tighter budgets within the installed limits. A passing check is not proof of production capacity.
28
+
29
+ ## What each plan includes
30
+
31
+ | | Free | Pro | Pro + Crawler Protection add-on | Enterprise |
32
+ | --- | --- | --- | --- | --- |
33
+ | Traffic insights and the edge rules simulator | | ✓ | ✓ | ✓ |
34
+ | Edge protection at Cloudflare or AWS WAF | | | ✓ | ✓ |
35
+ | Self-hosted gateway or SDK | | | ✓ | ✓ |
36
+
37
+ The add-on is $29.99/month on top of Pro ($149/month). Free accounts can view the product but cannot connect traffic, simulate or enforce. Like Agent Access, Crawler Protection includes 10,000 requests a month on Free and 100,000 on Pro, then $0.001 per additional request once enabled. Traffic insights never count toward the allowance.
38
+
39
+ ### Allowance and additional requests
40
+
41
+ Each request the self-hosted runtime admits counts as one Crawler Protection request. Agent Access has its own, separate allowance. Allowances reset at the start of each UTC calendar month.
42
+
43
+ At 100,000 requests, Pro stops admitting new protected requests (`429`) unless the account owner has enabled additional calls on an active paid subscription. Each additional request then costs $0.001 and appears on the subscription invoice. Canceled, unpaid or expired billing never authorizes additional requests. Requests denied locally before hosted admission, bypassed routes and operations that are only settling do not count. Once a request is admitted it counts, even if a later capacity check fails. For Enterprise volumes, email founders@valiron.co.
44
+
45
+ ### Where to see usage
46
+
47
+ **Dashboard → Usage** (`/dashboard/usage`) shows Crawler Protection and Agent Access requests separately: used, included, remaining, additional calls, estimated charges and the next reset. Counts refresh every 15 seconds. They count hosted admissions only, so CDN cache hits and bypassed routes are not included.
48
+
49
+ To allow requests past the allowance, a Pro owner chooses **Enable additional calls** and accepts the displayed rate. Each product is enabled separately, and installing or upgrading a package never enables charges. Additional usage is recorded before the request is admitted and billed in batches; a billing delivery problem pauses additional calls for review.
50
+
51
+ ## How traffic insights work
52
+
53
+ Traffic insights show the automated traffic reaching your website before you change how that traffic is handled. They are included with Pro and Enterprise; Free accounts see an upgrade prompt. You either connect copies of the request logs your CDN, WAF, load balancer or web server already produces, or add a passive request logger to your application. Valiron verifies crawler identities and reports what reaches your pages.
54
+
55
+ Traffic insights are read-only:
56
+
57
+ - It never blocks, challenges, delays or rate-limits a request. It does not change your CDN, WAF, DNS, routing or origin configuration.
58
+ - It does not require the Crawler Protection runtime, Redis, an operator API key or account activation, and it does not consume Crawler Protection request allowances.
59
+ - Your website never depends on Valiron being available. Log sources deliver copies asynchronously; if Valiron's ingestion is unavailable, senders retry and your traffic is unaffected.
60
+
61
+ The self-hosted runtime's **dry run** mode (`observe` in configuration) is a different feature: it evaluates your installed runtime policy in the request path and logs what it would block. Traffic insights only read request records after the fact.
62
+
63
+ ### Traffic classes
64
+
65
+ Every observed request is placed in exactly one class. Valiron never labels traffic as human.
66
+
67
+ | Class | Meaning |
68
+ |---|---|
69
+ | Verified crawlers | The client address matched the provider's official published IP ranges, or forward-confirmed reverse DNS (Bing). The same reviewed feeds as the runtime are used; see [Identification and signals](#identification-and-signals). |
70
+ | Claimed, not verified | The User-Agent claims a verifiable crawler, but the address did not match (`claim_mismatch`, typically spoofing) or evidence was unavailable (`verification_unavailable`, for example when the source omits client IPs). |
71
+ | Other declared automation | The User-Agent declares automation that cannot be verified: AI crawlers without a published feed (such as CCBot, Bytespider, Amazonbot, meta-externalagent), other search engines, SEO tools, social previews, uptime monitors, HTTP libraries, headless browsers, and any other User-Agent that does not look like a browser. These are claims only. |
72
+ | Unclassified | Browser-like or missing User-Agents. This includes people and any bot that does not identify itself. |
73
+
74
+ Verification is evaluated against the provider evidence that is current when Valiron processes the record, and the evidence version is stored with each verified request. Edge signals reported by your provider, such as Cloudflare `VerifiedBotCategory` or AWS WAF Bot Control labels, are shown separately (for example `cf:ai-crawler` or `aws:verified:ai`). They are never mapped to a specific provider or treated as Valiron verification.
75
+
76
+ ### Data handling and retention
77
+
78
+ Valiron stores only normalized request metadata: request time, host, method, path, normalized route, status, response bytes and timing, cache result, edge action, edge bot signal, country, User-Agent (up to 512 characters), traffic class and verification evidence.
79
+
80
+ - Query strings, fragments, cookies, authorization headers, other headers and request bodies are discarded during parsing and never stored. Configure your source not to send them where possible.
81
+ - Client IP addresses are used during processing for verification only. Valiron stores a keyed, non-reversible hash (scoped to your account) and the /24 (IPv4) or /48 (IPv6) network, never the raw address.
82
+ - Paths are grouped into routes for analytics. Numeric IDs, UUIDs, email addresses, long hex values and token-like segments become `:id`, `:uuid`, `:email`, `:hash` and `:token`.
83
+ - An uploaded or pushed payload is held until it is processed, then deleted. A payload that fails processing five times is kept with a `failed` status for investigation.
84
+ - **Sensitive paths:** list up to 20 path prefixes per website (`PATCH /operator/crawlers/sites/:siteId` with `{ "excludedPaths": ["/account"] }`). Matching requests are still counted, but are stored under the prefix (for example `/account/*`); the requested path is never stored.
85
+ - Observed requests, their hourly and daily summaries, policies and their revisions, simulations, edge deployments and the protection audit trail are retained permanently. They are kept when you change plans, remove the Crawler Protection add-on or close your account.
86
+ - **Removing a website** in **Log sources** hides it from your dashboard and revokes its connections, so no new deliveries are accepted. Data already observed for it is kept. Turn Protection off first: a website with Valiron rules deployed at your edge cannot be removed (`409 disable_protection_first`). You can add the same hostname again later; it starts a new history.
87
+
88
+ ### Allowance and coverage
89
+
90
+ Each account has a monthly allowance of stored events: 50,000,000 on Pro. Enterprise has no default limit. Records beyond the allowance are still stored and shown, and are flagged as over allowance; the dashboard then says the month's allowance was exceeded. Delivery to Valiron is never refused because of the allowance, and your traffic is never affected.
91
+
92
+ Every delivery reports how many records were stored, ignored as duplicates, unreadable, or over the allowance. Duplicates are detected by provider request ID (Cloudflare `RayID`, CloudFront `x-edge-request-id`, AWS WAF `requestId`, Vercel request ID, or `request_id` in the Valiron format), so re-sent or overlapping files are not double counted. Formats without a request ID, such as nginx combined logs, are deduplicated by exact line; identical lines within the same second are counted once.
93
+
94
+ Your log provider may charge for log delivery. Cloudflare Logpush availability for HTTP request logs depends on your Cloudflare plan. AWS charges for WAF logging, CloudFront real-time logs, Kinesis and Firehose. Traffic insights are included with Pro.
95
+
96
+ ## Connect traffic sources
97
+
98
+ Open **Dashboard → Crawler Protection → Traffic → Log sources** (`/dashboard/crawler-protection/sources`) and add your website hostname. Then choose a source. Each continuous source receives its own connection: a push endpoint `https://valiron-edge-proxy.onrender.com/ingest/crawler/logs/<connection-id>` and a token beginning `vcl_`.
99
+
100
+ The token is shown once. Store it as a secret. It can only append request records to that website; it cannot read analytics, change settings or call any other Valiron API. Revoke a connection in **Log sources** to stop it immediately; data already collected is kept. Create a new connection to rotate a token.
101
+
102
+ | Source | Delivery | Format |
103
+ |---|---|---|
104
+ | Cloudflare | Logpush HTTP destination, or file upload | `cloudflare` (HTTP requests dataset, NDJSON) |
105
+ | AWS WAF | Amazon Data Firehose HTTP endpoint, or file upload | `aws_waf` |
106
+ | Amazon CloudFront real-time logs | Kinesis Data Streams → Firehose HTTP endpoint | `cloudfront_realtime` |
107
+ | Amazon CloudFront standard logs | File upload | `cloudfront` (W3C or JSON) |
108
+ | AWS Application Load Balancer | File upload | `aws_alb` |
109
+ | nginx, Apache, Caddy | File upload, or push with Vector or Fluent Bit | `combined` (optional leading virtual host and trailing request time) |
110
+ | Vercel | Vercel Drains (logs), or file upload of exported NDJSON | `vercel` |
111
+ | Fastly, Akamai, Netlify, Fly.io, custom | Push or upload after mapping to the Valiron format | `valiron` |
112
+ | Your application, when logs are unavailable | Valiron SDK request log | `valiron` |
113
+
114
+ ### Cloudflare Logpush
115
+
116
+ 1. In Cloudflare, open the zone → **Analytics & Logs → Logpush → Create a Logpush job** and choose **HTTP destination**.
117
+ 2. Use this destination. Cloudflare sends `header_` parameters as request headers.
118
+
119
+ ```text
120
+ https://valiron-edge-proxy.onrender.com/ingest/crawler/logs/<connection-id>?header_Authorization=Bearer%20<vcl_token>
121
+ ```
122
+
123
+ 3. Select the **HTTP requests** dataset with these fields, and keep the default RFC 3339 timestamp format:
124
+
125
+ ```text
126
+ RayID,EdgeStartTimestamp,ClientRequestHost,ClientRequestMethod,ClientRequestPath,ClientRequestUserAgent,ClientIP,EdgeResponseStatus,EdgeResponseBytes,CacheCacheStatus,EdgeTimeToFirstByteMs,ClientCountry,SecurityAction,VerifiedBotCategory
127
+ ```
128
+
129
+ Do not include request headers, cookies or query-string fields. `ClientRequestURI` is accepted, but its query string is discarded. Keep each Logpush upload at 16 MB or less (`max_upload_bytes`).
130
+
131
+ ### AWS WAF
132
+
133
+ 1. Create an Amazon Data Firehose stream with source **Direct PUT** and destination **HTTP endpoint**. AWS WAF requires the stream name to start with `aws-waf-logs-`.
134
+ 2. Set the endpoint URL to your connection endpoint, the access key to the `vcl_` token, and content encoding to **GZIP**. Keep the buffer size at 16 MiB or less (the default 5 MiB works); larger deliveries are rejected. Configure an S3 backup bucket for failed records.
135
+ 3. In AWS WAF, open the web ACL → **Logging and metrics** and send logs to the stream. Redact the `cookie` and `authorization` fields in WAF logging; Valiron discards them in any case.
136
+
137
+ Valiron answers Firehose with the required `requestId` and `timestamp` response. WAF records contain no response status, so status-based analytics are empty for this source. WAF actions (`allow`, `block`, `count`, `challenge`) appear as edge actions. They are actions of your own WAF rules, not Valiron.
138
+
139
+ ### CloudFront real-time logs
140
+
141
+ 1. Create a Kinesis data stream and a CloudFront real-time log configuration. Recommended fields, in this order: `timestamp, c-ip, sc-status, cs-method, cs-host, cs-uri-stem, cs-user-agent, x-edge-result-type, x-edge-request-id, time-taken, sc-bytes, x-host-header`.
142
+ 2. When creating the connection, enter the same field list in the same order. Real-time records have no header, so the order must match exactly.
143
+ 3. Create a Firehose stream from the Kinesis stream to the HTTP endpoint with the connection URL and token, and attach the real-time log configuration to your cache behaviors.
144
+
145
+ ### File uploads
146
+
147
+ Upload plain or gzip-compressed files in **Log sources**, up to 16 MB compressed (64 MB uncompressed) and 500,000 records per file, and up to 50 files at a time. Formats are detected automatically: CloudFront files from S3 (`.gz`, W3C with `#Fields`, or JSON), ALB logs, combined logs, Cloudflare, AWS WAF, Vercel and Valiron NDJSON, and JSON arrays of records. Split larger files.
148
+
149
+ Drag and drop files onto the upload area, or use **Choose files**. **Uploaded files** lists each upload with its file name, size, detected format, stored, duplicate and unreadable records, and the request time range. **View requests** shows the most recent requests stored from that file. **Remove** takes an upload and the requests it stored out of your dashboard and analytics (totals, charts, routes, live traffic and the simulator). Valiron keeps the data, and uploading the same file again restores it. An upload can be removed once it has finished processing. A request that appeared in two files belongs to the upload that stored it first.
150
+
151
+ ### Vercel Drains
152
+
153
+ Vercel Drains stream every request your Vercel project serves, including cached and static responses, with the final status code, cache result and client address. Drains require a Vercel Pro or Enterprise team; Vercel bills them per GB delivered.
154
+
155
+ 1. In **Log sources**, choose **Vercel Drains** and create a push endpoint. Copy the endpoint and token.
156
+ 2. In Vercel, open **Team Settings → Drains**, add a **Logs** drain for the project, and select the request sources (static, functions, middleware, external). JSON or NDJSON encoding both work.
157
+ 3. Set the endpoint and add the custom header `Authorization: Bearer <token>`.
158
+
159
+ Entries without request metadata, such as function output and build logs, are skipped and not counted as unreadable. Requests are deduplicated by Vercel request ID. The proxy logs Vercel delivers contain client IP addresses and paths with query strings; Valiron applies the same handling as for every source (query strings removed, IP addresses hashed).
160
+
161
+ ### Push from any log shipper
162
+
163
+ Any sender can `POST` newline-delimited records in a source's native format, or in the Valiron format, to the connection endpoint:
164
+
165
+ ```sh
166
+ gzip -c access.log | curl --fail -X POST "https://valiron-edge-proxy.onrender.com/ingest/crawler/logs/<connection-id>" \
167
+ -H "Authorization: Bearer <vcl_token>" -H "Content-Encoding: gzip" --data-binary @-
168
+ ```
169
+
170
+ The Valiron format is one JSON object per line. Only `timestamp` (RFC 3339 or Unix seconds/milliseconds) and `path` are required:
171
+
172
+ ```json
173
+ {"timestamp":"2026-11-20T10:00:00Z","host":"www.example.com","method":"GET","path":"/products/42","status":200,"user_agent":"Mozilla/5.0 …","client_ip":"203.0.113.7","duration_ms":38,"bytes":5120,"cache":"miss","request_id":"abc123"}
174
+ ```
175
+
176
+ Include `client_ip` to allow crawler verification; without it, crawler claims are reported as evidence unavailable. To ship nginx logs continuously with Vector:
177
+
178
+ ```toml
179
+ [sources.access]
180
+ type = "file"
181
+ include = ["/var/log/nginx/access.log"]
182
+
183
+ [sinks.valiron]
184
+ type = "http"
185
+ inputs = ["access"]
186
+ uri = "https://valiron-edge-proxy.onrender.com/ingest/crawler/logs/<connection-id>"
187
+ encoding.codec = "text"
188
+ framing.method = "newline_delimited"
189
+ compression = "gzip"
190
+ request.headers.Authorization = "Bearer ${VALIRON_LOG_TOKEN}"
191
+ ```
192
+
193
+ ### Ingestion endpoint reference
194
+
195
+ `POST /ingest/crawler/logs/:connectionId`
196
+
197
+ - Authentication: `Authorization: Bearer <vcl_token>`, or `X-Amz-Firehose-Access-Key` for Firehose. Dashboard sessions and operator API keys are not accepted. Upload-only connections cannot be used as push endpoints.
198
+ - Body: any content type, up to 16 MB per request (larger requests receive `413`, or the connection is closed before the upload completes; split them), plain or gzip (`Content-Encoding: gzip`, or detected from the gzip header). Decompressed content is limited to 64 MB and 500,000 records. Requests with `X-Amz-Firehose-Request-Id` are read as Firehose envelopes.
199
+ - Response: `200 {"accepted":true,"duplicate":false,"batch":"<id>"}`. An identical payload sent again on the same connection returns `duplicate: true` and is not reprocessed. Firehose requests receive `{"requestId","timestamp"}`, with `errorMessage` on failure.
200
+ - Processing is asynchronous. Records normally appear within seconds of acceptance; see **Recent deliveries** for results.
201
+ - Errors: `401 authentication_required` (missing, invalid or revoked token), `400 empty_payload | invalid_gzip | invalid_firehose_payload`, `413` (body over 16 MB, or `payload_too_large` after decompression), `415 unsupported_encoding`, `429 too_many_batches` (more than 240 deliveries per minute per connection), `503 ingestion_unavailable`. Retry 429 and 503 with backoff.
202
+ - Unreadable lines do not fail a delivery. They are counted as unreadable in that delivery's results.
203
+
204
+ ## Request log for sites without log access
205
+
206
+ If you cannot share CDN, WAF or server logs, add the passive request logger from `@valiron/crawler-protection` 0.8.0+ (Node.js 22+). Import it from `@valiron/crawler-protection/request-log` to load only the logger. It records each request after the response finishes and uploads in the background. It does not need Redis, an operator API key or activation, and it never blocks, delays or changes a request. Create an **SDK request log** connection in **Log sources** for the endpoint and token.
207
+
208
+ ```typescript
209
+ import express from 'express';
210
+ import { createCrawlerRequestLog } from '@valiron/crawler-protection';
211
+
212
+ const requestLog = createCrawlerRequestLog({
213
+ endpoint: process.env.VALIRON_REQUEST_LOG_URL!, // https://…/ingest/crawler/logs/<connection-id>
214
+ token: process.env.VALIRON_REQUEST_LOG_TOKEN!, // vcl_…
215
+ // Return the real client address for your proxy topology. Never trust raw X-Forwarded-For.
216
+ clientIp: (req) => req.socket.remoteAddress,
217
+ });
218
+
219
+ const app = express();
220
+ app.use(requestLog.middleware());
221
+ // On shutdown: await requestLog.stop();
222
+ ```
223
+
224
+ Options and methods:
225
+
226
+ - `endpoint` must be HTTPS (HTTP only for loopback) and exactly `/ingest/crawler/logs/<connection-id>`, without credentials, query or fragment. `token` must be a `vcl_` connection token. Invalid values throw at construction.
227
+ - `clientIp(request)` selects the trusted client address. Use `createCloudFrontClientIpResolver` or your proxy's equivalent. Without it, client IPs are not sent and crawler claims cannot be verified.
228
+ - `sampleRate` (0–1, default 1), `flushIntervalMs` (1,000–300,000, default 10,000), `maxBuffer` (100–200,000 records, default 20,000), `fetch` and `onError` are optional.
229
+ - `middleware()` returns Express/Connect/Node middleware that calls `next()` immediately and records method, path (query removed), host, status, User-Agent, client IP, duration and `Content-Length`.
230
+ - `recordFetch(request, response, { ip, startedAt })` records requests in fetch-style runtimes such as Next.js middleware and Hono. `record(entry)` records any request manually.
231
+ - `flush()` uploads up to 5,000 buffered records as gzip NDJSON. `stats()` returns `{ buffered, dropped }`. `stop()` stops the timer and attempts a final upload.
232
+
233
+ Records are kept in memory only. Failed uploads (network errors, `429` and `5xx`) are retried on the next flush within `maxBuffer`; records beyond the buffer are dropped and counted. Records still buffered when the process exits are lost. Other `4xx` responses are reported to `onError` and not retried. Query strings, cookies and headers other than User-Agent are never collected. Client IPs are sent over HTTPS so Valiron can verify crawlers; Valiron stores only a keyed hash. Sampled traffic is currently counted as received and is not scaled up.
234
+
235
+ ## Traffic dashboard
236
+
237
+ **Dashboard → Crawler Protection → Traffic** shows every connected website. The status line shows the website, whether logs are arriving, connected sources, last delivery and the provider-confirmed protection state, with **Enable protection** when it is off. Analytics views have a period control (24h, 7d, 30d, 90d, 12 months). Analytics are grouped by request time in UTC, not delivery time.
238
+
239
+ - **Overview** shows observed requests by traffic class; a stacked requests-per-hour (or day) chart with a per-class breakdown on hover or with the arrow keys; **Verified crawlers by source**, with spoofed claims counted separately; top identified crawlers and routes; declared automation by type; response status classes; edge cache results; and edge actions reported by your provider. Coverage shows stored, duplicate, unreadable and over-allowance records. **Export** downloads the current data as JSON. If a self-hosted runtime has reported, its analytics appear below as **Runtime telemetry**.
240
+ - **Live** lists the most recently delivered requests (request time in UTC, source, verification state and method, request, status, timing and cache) with a histogram of the loaded requests. Filter chips for traffic class, verification state, response status and edge action show 24-hour counts; select a chip to hide that kind of request. Filter by path prefix too. Select a request to open its detail: claimed and verified identity, verification state, method and evidence version, a plain-language explanation, and request metadata. It refreshes every 15 seconds. Because logs arrive in batches, this is a near-live feed.
241
+ - **Bots & crawlers** lists each crawler by provider and class, with request counts by verification state, errors, a daily trend and its most requested routes. A claim mismatch is shown separately from verified traffic.
242
+ - **Pages & routes** lists the top 200 normalized routes with requests per traffic class, errors and mean response time, at daily granularity. Search routes, filter by class, and export CSV.
243
+ - **Log sources** manages websites, connections, uploads, recent deliveries and website removal.
244
+
245
+ These views are tabs on the **Traffic** page. The sidebar adds **Edge rules** (Simulator, Edge protection) and **Self-hosted** (Setup, plus Controls, Decision logs and Alerts once a runtime has reported).
246
+
247
+ Status is **Waiting for the first logs** until data arrives. It becomes **Processing** while deliveries are queued, shows failures when processing fails, and becomes stale after six hours without a delivery from a continuous source. The status line also shows the website's provider-confirmed edge protection state. Edge actions in observed traffic are attributed to Valiron only when the provider rule ID belongs to a Valiron-managed rule; everything else belongs to your own CDN or WAF rules.
248
+
249
+ Dashboard APIs (operator dashboard session only; operator API keys and `vcl_` tokens are rejected; responses use `Cache-Control: private, no-store`):
250
+
251
+ - `GET|POST /operator/crawlers/sites`; `PATCH /operator/crawlers/sites/:siteId` (`excludedPaths`); `DELETE /operator/crawlers/sites/:siteId?confirm=<hostname>` removes the website from the dashboard and returns `{ "removed": true, "retained": true }`.
252
+ - `GET|POST /operator/crawlers/sites/:siteId/connections` (`{ "kind": "push", "format": "<format>|auto" }`, `{ "kind": "sdk" }`, or `cloudfront_realtime` with `"fields": [...]`); `DELETE /operator/crawlers/connections/:connectionId`.
253
+ - `POST /operator/crawlers/sites/:siteId/uploads?format=auto&name=<file name>` (raw file body); `GET /operator/crawlers/sites/:siteId/batches` (`uploads=1` lists file uploads only); `DELETE /operator/crawlers/sites/:siteId/uploads/:batchId` removes an upload from analytics and returns `{ "removed": true, "retained": true, "requests": <n> }`.
254
+ - `GET /operator/crawlers/traffic/overview|timeseries|providers|pages?site=<id>&from=<ms|ISO>&to=<ms|ISO>`, and `GET /operator/crawlers/traffic/events?site=<id>&limit=1-200&before=<cursor>&audience=&verification=&status=&edge=&provider=&path=` (`audience`, `verification`, `status` and `edge` accept comma-separated lists; `batch=<uploadId>` returns requests stored by one upload).
255
+
256
+ Another account's website returns `404 site_not_found`. Up to 25 websites per account and 20 active connections per website are supported.
257
+
258
+ ## Simulator
259
+
260
+ **Dashboard → Crawler Protection → Simulator** (`/dashboard/crawler-protection/simulator`, Pro) replays candidate edge rules against the requests Valiron has observed for a website. Simulation is read-only: it never deploys rules or changes traffic.
261
+
262
+ ### Edge rules
263
+
264
+ A set of edge rules is an ordered list of up to 20 rules. Each rule has an ID, name, enabled flag, action and match:
265
+
266
+ | Field | Values |
267
+ |---|---|
268
+ | `action` | `block`, or `rate_limit` with `rate: { requests: 1–1000000, periodSeconds: 10 \| 60 \| 120 \| 300 \| 600 }` counted per client IP |
269
+ | `who` | `{ "kind": "everyone" }`; `{ "kind": "declared", "agents": [...], "categories": [...] }` (self-declared User-Agent, case-insensitive); `{ "kind": "verified", "crawlers": [...] }` (claim plus the crawler's official IP ranges); `{ "kind": "claimed_unverified", "crawlers": [...] }` (spoofed claims) |
270
+ | `paths` | Up to 10 raw request paths, case-sensitive. `*` matches any characters including `/`. Empty means every path. |
271
+ | `methods` | `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`. Empty means every method. |
20
272
 
21
- **Setup & configuration** includes a compact **Give this to your coding agent** handoff with one **Copy prompt** button (manual text appears only if clipboard access fails), copyable install command, server-side key guidance, a local install acknowledgment, real configuration validation, and telemetry environment/examples. The acknowledgment is saved per account only in the current browser and is not verified installation. The validation check lasts for the current visit and clears when inputs change. A runtime check requires a reporting sample less than two minutes old; stale or unavailable telemetry cannot complete it. Select the intended site in the analytics panel. If a file has been validated during this visit, the runtime configuration must match its fingerprint to complete that check; a different deployment is shown as a mismatch. This progress is not production certification. Setup uses a compact checklist progress bar. The optional measured baseline, deployment guidance and detailed explanations expand on demand; primary actions and validation blockers remain visible.
273
+ Agent IDs come from `GET /operator/crawlers/catalog`. Verified and spoofed rules accept only crawlers with official evidence, and are never converted into User-Agent-only rules. A block rule that matches every path, method and client is refused. Saving a changed policy creates a new immutable revision (`POST /operator/crawlers/policy?site=<id>`); saving an unchanged policy returns the existing revision.
22
274
 
23
- **Load example** generates a schema-v1 observation policy with illustrative limits, a `/products/**` inventory and one-hour expiry. It can be validated but is not safe capacity guidance: replace every limit and inventory entry and provide real baseline evidence before deployment. The dashboard never invents baseline measurements.
275
+ ### Results
24
276
 
25
- Validation and export do not save or deploy policy, connect to your Redis/database, or turn protection on. Install the integration package with `npm install @valiron/crawler-protection`. Your team installs the runtime and follows the deployment/recovery procedure in its own infrastructure. Optional runtime telemetry powers hosted crawler analytics. Automatic policy activation remains unavailable. A passing configuration check does not prove production capacity or genuine Meta acceptance.
277
+ Choose a period (24 hours, 7 or 30 days; at most 31 days) and the target edge. Results show:
278
+
279
+ - **Observed requests** in the window; **Evaluated requests** and coverage; **Excluded requests** that lack a field a rule needs (User-Agent, method, or client identity for rate limits); and **Unknown outcomes** where crawler evidence was unavailable at processing time.
280
+ - **Simulated policy matches** for block rules. Rules apply in order and the first matching block rule takes the request. Block rules are evaluated over every stored event, so these counts are exact for the stored data.
281
+ - **Estimated rate-limited** requests. Rate rules replay events in time order per hashed client IP, using the target's counting: Cloudflare's sliding window with a one-period mitigation, or AWS WAF's trailing window evaluated in 10-second steps. Results are always labeled estimates, because Cloudflare counts per data center and AWS evaluates rates periodically. Without client identities (`CRAWLER_LOG_HASH_SECRET` unset when the events were stored) the result is **Insufficient evidence**. Replay stops after 2,000,000 events and is then marked partial.
282
+ - Per rule: matches, undetermined requests, top routes and agents, and its **enforceability** at the target: `enforceable`, `requires_upgrade` (Valiron add-on or your Cloudflare plan), `requires_integration`, `unsupported` or `insufficient_evidence`, with the reason.
283
+ - **Enforceable policy coverage**: the share of simulated matches that come from rules the target can enforce today.
284
+
285
+ Matches are counts of observed requests. They are not verified savings or prevented server work. Runs with the same policy, window, target and evidence return the stored result. APIs: `POST /operator/crawlers/simulations` (`{ site, policy | policyId, target, range | from/to }`), `GET /operator/crawlers/simulations?site=<id>`, `GET /operator/crawlers/simulations/:id`.
286
+
287
+ ## Edge protection
288
+
289
+ **Dashboard → Crawler Protection → Edge protection** (`/dashboard/crawler-protection/protection`) deploys a saved policy as Valiron-managed rules in your own Cloudflare zone or AWS WAF web ACL. It requires the **Crawler Protection add-on** ($29.99/month on top of an active Pro subscription; included with Enterprise). Adding the add-on and turning Protection on are separate steps: paying deploys nothing.
290
+
291
+ 1. **Add-on.** Pro owners add it from the page; the price is shown before purchase and prorated on the Pro subscription. Entitlement follows the Stripe subscription.
292
+ 2. **Connect your edge.**
293
+ - **Cloudflare:** an API token scoped to the zone with *Zone → Zone: Read* and *Zone → Zone WAF: Edit*. Add *Account → Account Filter Lists: Edit* to enforce verified-crawler and spoofed-crawler rules, which use IP lists of the official ranges. Provide the zone ID.
294
+ - **AWS WAF:** an IAM role in the account that owns the web ACL. Its trust policy allows Valiron's AWS principal with the per-site external ID shown on the page. Its permissions policy lets Valiron manage only `valiron-<site>` rule groups and IP sets, and update the web ACL. Provide the role ARN and web ACL ARN (CloudFront or regional). Web ACLs managed by AWS Firewall Manager are not supported.
295
+
296
+ Credentials are encrypted (AES-256-GCM) and never returned. Log-ingestion tokens cannot change rules, and WAF credentials cannot ingest logs. Connecting runs a permission check. It may create and immediately delete a disabled, non-matching Cloudflare rule, or an empty unattached AWS IP set; it never changes how traffic is handled.
297
+ 3. **Policy.** Every enabled rule must be enforceable at the connected edge. Unsupported rules are never deployed: disable or change them first.
298
+ 4. **Turn Protection on.** Valiron deploys the rules, reads them back from the provider, and shows **Protecting** only when the provider state matches the deployed revision.
299
+
300
+ ### What Valiron changes at the edge
301
+
302
+ All rules are scoped to the website's hostname (`http.host`, or the `host` header on AWS).
303
+
304
+ | Edge | Valiron-owned objects | Customer configuration |
305
+ |---|---|---|
306
+ | Cloudflare | Custom rules and rate limiting rules with `ref` `valiron_<site>_<rule>`, appended to the zone entry point rulesets; IP lists `valiron_<site>_<crawler>` | Other rules are never edited, reordered or removed |
307
+ | AWS WAF | One rule group (`valiron-<site>-…`) with block rules before rate-based rules, IPv4/IPv6 IP sets per verified crawler, and one rule `Valiron-Managed-<site>` appended after your rules in the web ACL | Every other web ACL rule and setting is preserved on update |
308
+
309
+ Plan limits are checked before deployment. Cloudflare custom rules: 5 (Free), 20 (Pro), 100 (Business), 1,000 (Enterprise). Rate limiting rules: 1, 2, 5 and 100. Rate periods: 10 s on Free, up to 60 s on Pro, up to 600 s on Business and Enterprise. Counting is per IP and per data center, and the mitigation lasts one period. Valiron counts your own rules against these limits. AWS WAF rate rules need a 60, 120, 300 or 600 second window and at least 10 requests. Verified Bing rules are not enforceable at either edge, because Bing is verified by reverse DNS.
310
+
311
+ ### States
312
+
313
+ | State | Meaning |
314
+ |---|---|
315
+ | `upgrade_required` | The account does not have the add-on (or Enterprise). |
316
+ | `permissions_required` | No edge is connected, or its permission check did not pass. |
317
+ | `observing` | Connected, but no saved policy whose enabled rules are all enforceable. |
318
+ | `enforcement_ready` | Ready to deploy. |
319
+ | `enabling` / `disabling` | A deployment is running. |
320
+ | `protecting` | Valiron rules are deployed and confirmed by provider read-back. |
321
+ | `deployment_failed` | A first activation failed and anything partial was removed. |
322
+ | `rollback_required` | The provider state does not match: an update or disable failed, or Valiron rules were changed outside Valiron (drift). Re-apply the deployed revision or turn Protection off. |
323
+
324
+ **Turning Protection off** removes only Valiron-owned rules, lists, groups and IP sets, keeps traffic insights and simulation running, and preserves the audit trail. The toggle shows off only after the provider confirms removal; a failed disable stays `rollback_required`. Turning off is always allowed, even after the add-on ends. Changing or disconnecting the integration requires Protection to be off.
325
+
326
+ **Revisions and rollback.** Each deployment records the policy revision, outcome and provider read-back. Deploy the latest revision or roll back to any previously deployed one from **Deployment history**.
327
+
328
+ **Drift and evidence refresh.** Every 10 minutes Valiron reads each protected site's Valiron-owned rules. A mismatch moves the site to `rollback_required` and is recorded. When a crawler's official IP ranges change, the same policy is re-applied with the new ranges.
329
+
330
+ **Add-on ends.** Rules stay deployed for a 7-day grace period, then Valiron turns Protection off.
331
+
332
+ ### Actual enforcement
333
+
334
+ **Actual enforcement** shows blocks and rate limits by Valiron-managed rules, by rule and policy revision, route and source, from your connected Cloudflare or AWS WAF logs. A request counts only when the provider rule ID in the log (Cloudflare `SecurityRuleIDs`, AWS WAF `terminatingRuleId` or rule-group rule) belongs to a Valiron-managed rule. A 403 or 429 response, or a block by one of your own rules, is never counted as a Valiron action. Keep log delivery connected to see enforcement.
335
+
336
+ APIs (dashboard session): `GET /operator/crawlers/protection/entitlement`; `GET /operator/crawlers/edge/status|capabilities|history|actions?site=<id>`; `GET /operator/crawlers/edge/aws-setup?site=<id>`; `POST|DELETE /operator/crawlers/edge/integration?site=<id>`; `POST /operator/crawlers/edge/preflight|enable|rollback|reapply|disable?site=<id>`. Enable and rollback accept `{ "policyId": "<revision id>" }`. Errors: `protection_upgrade_required` (403), `integration_required`, `permissions_required`, `rules_not_enforceable` (with `details`), `deployment_in_progress`, `disable_protection_first` (409).
26
337
 
27
338
  ## Start here
28
339
 
29
- 1. Sign up and create an operator API key in **Dashboard → API Keys**. Choose **Crawler Protection** in the dashboard Product switcher and install `@valiron/crawler-protection`. Keep the key in the server environment as `VALIRON_API_KEY`; never put it in browser code or the site configuration JSON.
340
+ 1. Sign up and create an operator API key in **Dashboard → API Keys**. Choose **Crawler Protection** in the dashboard Product switcher and install `@valiron/crawler-protection@^0.8.0`. Keep the key in the server environment as `VALIRON_API_KEY`; never put it in browser code or the site configuration JSON.
30
341
  2. Choose the standalone gateway for an HTTP website, or an in-process adapter for a Node application. Inventory the pages, APIs and expensive operations you need to protect.
31
342
  3. Validate and export your configuration, then deploy the gateway/runtime with shared Redis in your infrastructure. Route protected traffic through it and prevent direct-origin bypass.
32
343
  4. For query-level protection, wrap every protected database operation with the private work API or in-process admission. Start work only after admission succeeds; release capacity only after the operation actually stops.
33
- 5. Test observation mode, hard workload caps, application authorization and recovery on your own environment before enabling broader crawler access.
344
+ 5. Test dry run, hard workload caps, application authorization and recovery on your own environment before enabling broader crawler access.
34
345
 
35
- ### Pro API-key activation (SDK 0.3.0+)
346
+ ### Account API-key activation (SDK 0.3.0+)
36
347
 
37
- The standalone gateway requires `VALIRON_API_KEY`. In-process integrations call `await activateCrawlerProtection({ apiKey, tenant })`, then pass the returned `activation` to `createCrawlerRuntime()` or `CrawlerGuard`. Use the `operator_<account ID>` tenant from the dashboard export. Missing credentials, an invalid/revoked key, a Free account or a foreign tenant cannot activate the supported runtime.
348
+ The standalone gateway requires `VALIRON_API_KEY`. In-process integrations call `await activateCrawlerProtection({ apiKey, tenant })`, then pass the returned `activation` to `createCrawlerRuntime()` or `CrawlerGuard`. Use the `operator_<account ID>` tenant from the dashboard export. Missing credentials, an invalid/revoked key or a foreign tenant cannot activate the supported runtime. Pro accounts with the Crawler Protection add-on, and Enterprise accounts, can activate it; Pro alone and Free receive `403 upgrade_required`.
38
349
 
39
- Startup checks the current account through `POST /operator/crawlers/activation`. A valid lease lasts at most five minutes and refreshes every minute in the background. Lease checks use local memory. Each protected HTTP request also calls `POST /operator/crawlers/usage` with its server-side operator key and account tenant before origin work. Free includes 10,000 bot protection requests per UTC calendar month, Pro includes 100,000; agent access has a separate allowance at the same limits. Exhaustion returns 429; usage storage or network failure stops new protected requests with 503. Bypassed routes and settling existing operations do not consume quota. Enterprise: email founders@valiron.co. A 401/403 refresh response invalidates the lease immediately; temporary network/5xx/429 failures preserve only its remaining lifetime. After expiry, new protected requests and operations fail closed with 503/errors. Existing operations may settle and release capacity; private release/recovery tools and explicitly bypassed static routes remain usable. Call `activation.stop()` on shutdown. `--check` validates configuration/credential syntax offline; it does not verify live account access.
350
+ Startup checks the current account through `POST /operator/crawlers/activation`. A valid lease lasts at most five minutes and refreshes every minute in the background. Lease checks use local memory. Each protected HTTP request also calls `POST /operator/crawlers/usage` with its server-side operator key and account tenant before origin work. This counts it toward the [monthly allowance](#what-each-plan-includes). An exhausted allowance returns 429; usage storage or network failure stops new protected requests with 503. A 401/403 refresh response invalidates the lease immediately; temporary network/5xx/429 failures preserve only its remaining lifetime. After expiry, new protected requests and operations fail closed with 503/errors. Existing operations may settle and release capacity; private release/recovery tools and explicitly bypassed static routes remain usable. Call `activation.stop()` on shutdown. `--check` validates configuration/credential syntax offline; it does not verify live account access.
40
351
 
41
- The account API must be deployed before upgrading to the requiring SDK. Startup needs network connectivity; keys and leases are not written to disk. Activation is independent of optional analytics reporting. Public SDK checks can be bypassed in modified code, and 0.1.0 cannot be retroactively gated; hosted Pro endpoints enforce the account plan server-side.
352
+ The account API must be deployed before upgrading to the requiring SDK. Startup needs network connectivity; keys and leases are not written to disk. Activation is independent of optional analytics reporting. Public SDK checks can be bypassed in modified code, and 0.1.0 cannot be retroactively gated; hosted endpoints enforce account authentication, tenant scope and applicable quotas server-side.
42
353
 
43
354
 
44
355
  ## Website compatibility
@@ -108,7 +419,7 @@ The named configuration, Redis, trusted ingress, shopping-grant validation and q
108
419
 
109
420
  Optional crawler rules select `provider`, `crawlerClass`, route `groups` and `action: 'budget' | 'deny'`. Only verified catalog classifications qualify; validated customer grants keep their separate policy. These are origin-admission decisions: eligible public cache hits remain outside classification. Apply edge restrictions too if a class must be denied cached public content.
110
421
 
111
- `runtime.publicResponse(request, admittedLoader, background?)` authenticates ingress, resolves inventory and applies configured public cache groups. The loader must admit before SSR and wrap every expensive operation. `runtime.report.snapshot()` returns bounded **process-local origin** aggregates for actual/proposed request decisions, wrapped work outcomes and cache events. It excludes raw IPs, URLs, UA, sessions and request IDs. Proposed throttles are not blocked requests; rejected callbacks are not a measured count of SQL queries saved. Reports cover guard-evaluated requests and wrapped work/cache events; early adapter rejections and edge traffic require existing ingress logs. Optional authenticated reporting connects these aggregates to the dashboard, as described below. Hosted policy deployment controls remain unavailable; Pro API-key activation authorizes SDK use, not Redis policy activation.
422
+ `runtime.publicResponse(request, admittedLoader, background?)` authenticates ingress, resolves inventory and applies configured public cache groups. The loader must admit before SSR and wrap every expensive operation. `runtime.report.snapshot()` returns bounded **process-local origin** aggregates for actual/proposed request decisions, wrapped work outcomes and cache events. It excludes raw IPs, URLs, UA, sessions and request IDs. Proposed throttles are not blocked requests; rejected callbacks are not a measured count of SQL queries saved. Reports cover guard-evaluated requests and wrapped work/cache events; early adapter rejections and edge traffic require existing ingress logs. Optional authenticated reporting connects these aggregates to the dashboard, as described below. Hosted policy deployment controls remain unavailable; Account API-key activation authorizes SDK use, not Redis policy activation.
112
423
 
113
424
  `planCrawlerRollout()` validates supplied pool/headroom/checkout measurements and returns rollout blockers; missing measurements do not generate guessed production limits. `createEcommerceConfiguration()` builds the same schema from operator-supplied routes and policy. Budgets, verified ingress and actual grant integration remain deployment responsibilities. Your team installs and operates the runtime in its own infrastructure.
114
425
 
@@ -151,13 +462,16 @@ Seven provider integrations are available; Meta requires the separate trusted WA
151
462
  | Provider ID | Class IDs | Official verification source |
152
463
  | --- | --- | --- |
153
464
  | `openai` | `gptbot`, `oai-searchbot`, `chatgpt-user` | [GPTBot](https://openai.com/gptbot.json), [SearchBot](https://openai.com/searchbot.json), [ChatGPT-User](https://openai.com/chatgpt-user.json) |
154
- | `google` | `googlebot`, `adsbot-google` | [Common crawler CIDRs](https://developers.google.com/static/crawling/ipranges/common-crawlers.json), [special crawler CIDRs](https://developers.google.com/static/crawling/ipranges/special-crawlers.json); [verification guide](https://developers.google.com/crawling/docs/crawlers-fetchers/verify-google-requests) |
465
+ | `google` | `googlebot`, `adsbot-google`, `google-agent`, `gemini-notebook` | [Common crawler CIDRs](https://developers.google.com/static/crawling/ipranges/common-crawlers.json), [special crawler CIDRs](https://developers.google.com/static/crawling/ipranges/special-crawlers.json); [verification guide](https://developers.google.com/crawling/docs/crawlers-fetchers/verify-google-requests) |
466
+ | `anthropic` | `claudebot`, `claude-searchbot`, `claude-user` | [Official Anthropic crawler CIDRs](https://claude.com/crawling/bots.json); [identity guide](https://support.claude.com/en/articles/8896518) |
155
467
  | `apple` | `applebot` | [Applebot CIDRs](https://search.developer.apple.com/applebot.json); [Apple’s guide](https://support.apple.com/en-us/119829) |
156
468
  | `duckduckgo` | `duckduckbot` | [DuckDuckBot CIDRs](https://duckduckgo.com/duckduckbot.json); [DuckDuckGo’s guide](https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot) |
157
469
  | `perplexity` | `perplexitybot`, `perplexity-user` | [Bot CIDRs](https://www.perplexity.ai/perplexitybot.json), [user-fetch CIDRs](https://www.perplexity.ai/perplexity-user.json); [Perplexity’s guide](https://docs.perplexity.ai/docs/resources/perplexity-crawlers) |
158
470
  | `bing` | `bingbot` | [Bing reverse/forward DNS verification](https://www.bing.com/webmasters/help/how-to-verify-bingbot-3905dc26) |
159
471
  | `meta` | `social-preview`, `advertising`, `search`, `training`, `fetcher` | Authenticated AWS WAF verified-bot evidence and matching supported UA, as described below |
160
472
 
473
+ `google-agent` uses Google’s [user-triggered agent ranges](https://developers.google.com/static/crawling/ipranges/user-triggered-agents.json). `gemini-notebook` matches `Google-GeminiNotebook` (and legacy `Google-NotebookLM`) against the [Google-owned fetcher ranges](https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json). These identities do not prove every Gemini interaction: cached search answers may make no request to your site, and generic Google-hosted agents do not identify a particular model or end user.
474
+
161
475
  Googlebot covers its desktop/mobile `Googlebot/` identity. AdsBot desktop and mobile-web identities share `adsbot-google` and the special-crawler feed; retired mobile-app identifiers are not recognized. Google-Extended and Applebot-Extended are not treated as HTTP crawler identities. Other Google products and bots without an implemented proof mechanism are not implicitly verified.
162
476
 
163
477
  Perplexity’s documentation currently links `.com` feed URLs that redirect to the `.ai` endpoints above. The integration uses the inspected canonical `.ai` destinations and rejects redirects during refresh. A future URL/schema change must be reviewed before changing the built-in catalog.
@@ -172,7 +486,7 @@ const status = await refreshCrawlerFeeds(registry, { ttlMs: 60 * 60 * 1000, conc
172
486
  await refreshCrawlerFeed(registry, 'googlebot', { ttlMs: 60 * 60 * 1000 });
173
487
  ```
174
488
 
175
- `CRAWLER_FEEDS` is an immutable catalog of nine class-to-provider/URL entries. `refreshCrawlerFeed` accepts a catalog class ID, not a URL. `refreshCrawlerFeeds` bounds concurrency (default three, maximum eight), isolates failures and preserves an older validated snapshot only until its original expiry. `OPENAI_FEEDS` and `refreshOpenAiFeed` remain compatible OpenAI-only exports. The standalone gateway refreshes all nine feeds every five minutes with a one-hour TTL; feed network I/O is outside the admission path. In-process applications schedule the helper themselves.
489
+ `CRAWLER_FEEDS` is an immutable catalog of fourteen class-to-provider/URL entries. `refreshCrawlerFeed` accepts a catalog class ID, not a URL. `refreshCrawlerFeeds` bounds concurrency (default three, maximum eight), isolates failures and preserves an older validated snapshot only until its original expiry. `OPENAI_FEEDS` and `refreshOpenAiFeed` remain compatible OpenAI-only exports. The standalone gateway refreshes all built-in class feeds every five minutes with a one-hour TTL; feed network I/O is outside the admission path. In-process applications schedule the helper themselves.
176
490
 
177
491
  To configure budgets, put the provider ID and its class IDs under `policy.providers`. For Google, configure separate `googlebot` and `adsbot-google` class rates under the shared `google` provider rate. For Perplexity, configure `perplexitybot` and `perplexity-user` separately under `perplexity`. Optional `crawlerAccess` entries can deny a class on specific groups. Verified classes absent from the configured provider budgets still use the conservative unknown-traffic budget. Dashboard filters and aggregate reporting use these configured IDs and show the actual verification/action; identifying a provider does not grant it unrestricted access.
178
492
 
@@ -185,7 +499,9 @@ To configure budgets, put the provider ID and its class IDs under `policy.provid
185
499
 
186
500
  Only verified providers/classes with an explicit allowance receive their crawler budgets. Other requests use the conservative unknown-traffic budget and retain global/IP/route caps. A mismatch is not automatically a 403. Verification establishes network provenance, not human identity, software behavior, intent or unlimited permission.
187
501
 
188
- Meta classes can use verified AWS WAF evidence over an authenticated origin path. This requires WAF to reject viewer-supplied protected headers before it inserts a class only on matching verified-bot and bot-name labels. A Meta user-agent or broad ASN is insufficient. Real Meta fetch/ad diagnostics remain unverified. Cryptographic crawler signatures, learned behavioral reputation and a general bot/human detector are not implemented. Do not substitute a broad ASN/cloud range for crawler-specific evidence.
502
+ Meta classes can use verified AWS WAF evidence over an authenticated origin path. This requires WAF to reject viewer-supplied protected headers before it inserts a class only on matching verified-bot and bot-name labels. A Meta user-agent or broad ASN is insufficient. Real Meta fetch/ad diagnostics remain unverified. Opt-in pinned-key signature verification is described under Web Bot Auth below.
503
+
504
+ Cloudflare Bot Management is a second opt-in `trusted_waf` source: `createCloudflareWafEvidence` maps configured `cf.verified_bot_category` values to Valiron crawler classes across an attested, spoof-resistant edge-to-origin path. Constructing it attests that a Cloudflare rule (Transform Rule or WAF custom rule, earliest phase) rejects viewer-supplied `cf-verified-bot-category` headers before the trusted value is inserted, and that the header is inserted only when `cf.bot_management.verified_bot` is true and the category is configured. Verified-bot detection requires the Bot Management entitlement; without it the field is never populated and this source must not be configured. Cloudflare attests the category, not the operator identity, so verified evidence intentionally leaves `provider` unset. Learned behavioral reputation and a general bot/human detector are not implemented. Do not substitute a broad ASN/cloud range for crawler-specific evidence.
189
505
 
190
506
  ## Broader crawler directory
191
507
 
@@ -200,13 +516,46 @@ To enable identity verification for additional crawlers:
200
516
  3. Set `CRAWLER_DIRECTORY_APPROVALS_FILE` to that file's mounted, read-only path and restart the gateway. With Compose, explicitly mount it into the container and set the environment variable; it is not mounted by the default template.
201
517
  4. Add the returned `provider` and `crawlerClass` to the site's explicit rate/class policy and optional route access rules. For example, directory ID `ahrefsbot` uses provider `directory-ahrefsbot` and class `ahrefsbot`. Follow the existing policy-validation and explicit recovery/activation procedure after changing policy.
202
518
 
203
- Approval binds the bot ID, operator URL, documentation, category, UA patterns, verification recipes and tier. Changed identity metadata requires a new review/hash. CIDR ranges from an unchanged approved recipe can refresh automatically. Only reviewed entries with CIDR evidence qualify; DNS-only, ASN-only, signature-only and listed-only entries receive no new identity privilege. `directory_cidr` evidence still obeys customer route/rate/work limits. Even a verified directory crawler keeps unknown limits until its provider/class budget is configured. Directory keys identify individual bots, not an aggregate organization quota.
519
+ Approval binds the bot ID, operator URL, documentation, category, UA patterns, verification recipes and tier. Static-range recipes also bind their resolved ranges. Approval hashes changed with this release: rerun review and update existing approval files before deployment. Claude search/user/training and the supported Google agent/Notebook tokens now use the built-in provider/class IDs above; migrate any prior directory-based rules for those same tokens. Official verifiers take precedence and never fall back to directory privilege when their evidence expires. Changed identity metadata requires a new review/hash. CIDR ranges from an unchanged approved recipe can refresh automatically. Only reviewed entries with CIDR evidence qualify; DNS-only, ASN-only, signature-only and listed-only entries receive no new identity privilege. `directory_cidr` evidence still obeys customer route/rate/work limits. Even a verified directory crawler keeps unknown limits until its provider/class budget is configured. Directory keys identify individual bots, not an aggregate organization quota.
204
520
 
205
- Downloads use one fixed HTTPS URL, reject redirects, time out after ten seconds and cap the body at 4 MiB, with bounded entries/ranges. URLs and DNS/signature recipes from the directory are never fetched or executed. Approval validation rejects invalid or overly broad CIDRs. Replacements install atomically; failed refreshes retain the previous snapshot only to its original expiry. Evidence expires after one hour at most, and a directory generation older than 48 hours or older than the installed generation is rejected. A failed refresh logs `crawler_directory_unavailable`; unknown/expired evidence remains subject to conservative limits. Downloads run outside request admission.
521
+ Downloads use one fixed HTTPS URL, reject redirects, time out after ten seconds and cap the body at 4 MiB, with bounded entries/ranges. URLs and DNS/signature recipes from the directory are never fetched or executed. Bare IPv4/IPv6 addresses normalize to /32 and /128 host ranges. Invalid or overly broad ranges make that entire entry ineligible (`rangeError: invalid_or_overbroad_ranges`), without disabling unrelated entries. Structurally malformed catalogs still reject atomically; failed refreshes retain the previous snapshot only to its original expiry. Evidence expires after one hour at most, and a directory generation older than 48 hours or older than the installed generation is rejected. A failed refresh logs `crawler_directory_unavailable`; unknown/expired evidence remains subject to conservative limits. Downloads run outside request admission.
206
522
 
207
523
  For in-process integrations, construct `new CrawlerDirectory(reviewedApprovals)`, attach it with `registry.setDirectory(directory)`, and schedule `refreshCrawlerDirectory(directory)` independently of `refreshCrawlerFeeds(registry, ...)`. These exports are available from `@valiron/crawler-protection`; applications supply their own refresh scheduler and error reporting. `directory.review()` reports recognized candidates and approval status. SDK integrations do not fetch a directory merely by constructing a registry.
208
524
 
209
525
 
526
+ ## Allow selected AI services
527
+
528
+ Requires `@valiron/crawler-protection` 0.6.0 or later. Upgrade with `npm install @valiron/crawler-protection@^0.6.0`. Review and regenerate directory approval hashes, migrate overlapping directory class IDs to their built-in equivalents, then validate and activate the updated configuration before enforcing it.
529
+
530
+ Use explicit class rules together with `crawlerAccessDefault: "deny"` to block verified crawlers without an allowance on the requested route group. Existing configurations omit this field and retain the default `"budget"` behavior. All allowed classes still obey their configured provider/class, route, global and work ceilings.
531
+
532
+ The following is a configuration fragment, merged into a complete configuration with measured budgets and an inventory containing the `catalog` group. It permits search and user fetches, while leaving training crawlers such as `gptbot` and `claudebot` denied:
533
+
534
+ ```json
535
+ {
536
+ "crawlerAccessDefault": "deny",
537
+ "unverifiedAccess": "budget",
538
+ "crawlerAccess": [
539
+ { "provider": "openai", "crawlerClass": "oai-searchbot", "groups": ["catalog"], "action": "budget" },
540
+ { "provider": "openai", "crawlerClass": "chatgpt-user", "groups": ["catalog"], "action": "budget" },
541
+ { "provider": "anthropic", "crawlerClass": "claude-searchbot", "groups": ["catalog"], "action": "budget" },
542
+ { "provider": "anthropic", "crawlerClass": "claude-user", "groups": ["catalog"], "action": "budget" },
543
+ { "provider": "google", "crawlerClass": "google-agent", "groups": ["catalog"], "action": "budget" },
544
+ { "provider": "google", "crawlerClass": "gemini-notebook", "groups": ["catalog"], "action": "budget" }
545
+ ]
546
+ }
547
+ ```
548
+
549
+ Bing indexing, Googlebot and Meta previews/ad crawlers are separate classes: explicitly configure any that must retain access. An AI-only allowlist does not implicitly allow them.
550
+
551
+ Add matching provider/class rates under `policy.providers`; an access rule does not create a rate allowance. `unverifiedAccess: "budget"` preserves conservative access for anonymous shoppers and unverified traffic, including failed crawler claims. This is not a promise to block all other automation. For a strictly private machine-only route, use `unverifiedAccess: "deny"`: all unverified, mismatched or unavailable identities are blocked, including anonymous humans. Authenticated customer grants remain in their independently reserved lanes. Never infer a customer grant from a browser user agent.
552
+
553
+ Defaults apply across the configuration’s protected groups; explicit class rules are group-specific. Inventory bypasses remain bypasses. In dry run, access denials are reported as proposed blocks and requests can pass within safety/work limits; they become actual blocks only on enforced groups. Actual policy denials return 403 with `crawler_policy_denied`. A verified crawler without explicit access is not automatically malicious.
554
+
555
+ Anthropic’s hosted browser `Claude-Agent` is separate from its crawler/user-fetch identities. It can use the reviewed directory entry `claude-agent` with provider `directory-claude-agent`, class `claude-agent`, plus an explicit rate/access rule. Review the addresses against Anthropic’s [hosted browser guide](https://support.claude.com/en/articles/18234133) and its linked SAIL publication before approving. The current directory recipe uses pinned static addresses: address changes require review, and this release does not automatically fetch SAIL. Do not grant a broad cloud-network allowance.
556
+
557
+ Configure `robots.txt` separately for training preferences and discoverability. `Google-Extended` is a preference token, not a request identity; allowing `google-agent` does not automatically enable Gemini grounding. Access admission does not authorize purchases or account actions. Real-provider fetch acceptance must be tested on an owned test site before customer rollout.
558
+
210
559
  ## Shared policy
211
560
 
212
561
  `RedisAdmission` atomically checks/debits all related rate buckets using Redis server time. A failed compound check does not partially debit the other buckets. Verified IPs share provider/class budgets, and crawler classes share a parent provider ceiling. Unknown traffic has both aggregate and per-IP budgets.
@@ -279,6 +628,38 @@ Contexts belong to the guard instance that created them. Managed mode supports `
279
628
 
280
629
  Use `withRenderingAdmission(context, renderAndFetch)` to bound SSR separately from database operations, holding capacity until all actual work settles. Keep direct public API routes under ordinary request admission.
281
630
 
631
+ ## Returning-browser recognition (optional, observe-only)
632
+
633
+ The SDK (0.5.0+) requires account activation for returning-browser recognition. Sign up on the website, create a server-side operator API key and pass the result of `activateCrawlerProtection({ apiKey, tenant })` as the `activation` option to `new DeviceIdentity({ activation, ... })`. Each `recognize()` call obtains one hosted bot-quota admission before storing identity evidence. Missing, expired or revoked activation stops recognition; the HTTP middleware returns 429 for exhausted quota and 503 for unavailable admission. The collector itself remains a static asset.
634
+
635
+ Returning-browser recognition is folded in from the former standalone `@valiron/device-identity` package. Two signal classes stay strictly separate: a first-party, server-signed visitor cookie (`HttpOnly; Secure; SameSite=Lax`) is the only source of an `exact` match, while coarsened device signals compared with weighted scoring can produce a `similar` link - never an `exact` one. Recognition is **evidence, not a verdict**: no risk score, no block decision, no enforcement hook. A `similar` link means "this browser resembles one we have seen" and is never sufficient grounds to deny or limit service.
636
+
637
+ Supported-runtime limits for this module:
638
+
639
+ - The browser must run the collector JavaScript to submit signals. Exact continuity requires retaining the first-party `Secure` cookie over HTTPS. Without a retained cookie, signal similarity may still be reported, but it cannot establish an exact match. Handle collector errors without interrupting the website.
640
+ - The middleware endpoints (`GET .../collector.js`, `POST .../identify`) require a Node.js 22+ runtime. Do not mount them on an edge/Workers runtime.
641
+ - The collector script is embedded in the built package, so bundled frameworks (verified against Next.js 16 dev and production builds) serve it without `serverExternalPackages`, asset copying or working-directory assumptions.
642
+ - The in-memory store is single-process; use `RedisIdentityStore` for multi-instance deployments.
643
+
644
+ Mounting the recognition middleware exposes its endpoints; collection begins only when your browser integration calls the collector’s `ValironDevice.identify()` method. Recognition requires account activation and does not automatically feed the hosted crawler traffic dashboard. The browser only ever receives `{ state }` - visitor ids, matched ids and evidence stay server-side. Raw signal values, user agents and IP addresses are never stored; profiles hold per-component salted SHA-256 hashes with bounded retention (1 hour - 90 days, default 30). These hashes are pseudonymous, not anonymous: protect the deployment salt like a signing key and treat stored profiles as personal data. `identity.forget(visitorId)` is the data-subject deletion hook. Pass `respectPrivacySignals: true` to skip collection when the browser sends DNT/GPC.
645
+
646
+ Every default is a placeholder so the module runs, **not an approved production policy**. Before production rollout the deployment must explicitly decide: consent flow per jurisdiction (a first-party identification cookie is not strictly necessary for most sites), DNT/GPC behavior, retention, similarity-threshold tuning, what may consume `similar` links (recommend observe-only analytics first), and cookie lifetime/rotation.
647
+
648
+ ## Web Bot Auth verification (opt-in, draft protocol)
649
+
650
+ The SDK (0.4.0+) can verify Web Bot Auth signatures (draft-ietf-webbotauth-httpsig-protocol, an active IETF draft) as a third evidence path for crawlers and agents that cannot publish IP ranges, wired through the guard's `fallbackEvidence` hook. A valid signature from an operator-pinned signer produces evidence with `method: 'web_bot_auth'`; an existing trusted/IP/DNS-verified identity always stands.
651
+
652
+ Trust boundaries, deliberately stricter than the draft minimum:
653
+
654
+ - Pin-only key sources by default. The synchronous `classify()` performs no network fetch, so a request cannot steer verification into contacting an attacker-chosen directory URL. Dynamic directory resolution is a separate opt-in: construct the verifier with a `dynamicDirectory` resolver (for example `createCachingDirectoryResolver`) and call the async `classifyDynamic()`. Resolution is HTTPS-only with no redirects, validates every resolved IP against private and special ranges (any failure poisons the whole fetch; the validated set is pinned into the TLS connect so re-resolution cannot rebind), and is bounded (5-second timeout, 64 KB body, 16 keys, URL-keyed cache with in-flight dedupe). A hostile or broken directory degrades to unpinned and never throws. Dynamically resolved signers are registered with the neutral class `webbotauth-dynamic` and `promote: false`: a valid signature authenticates the signer URL but produces no verified evidence on first sight. Promotion remains an explicit operator decision.
655
+ - A valid signature proves key control, not good intent. Unpinned signer URLs stay unverified, and pinned-but-not-promoted signers keep unverified budgets while telemetry records the authenticated signer. Promotion is an explicit per-signer opt-in.
656
+ - Freshness is not replay protection; a captured signature can be replayed against this origin until `expires` (bounded to the draft's recommended 24-hour maximum, configurable down). Verified signers remain subject to every budget. `profile: 'strict'` additionally requires `@method` and `@path` coverage - a Valiron-specific strengthening, not a standard compliance claim.
657
+ - The protocol is a draft; expect wire-format changes before RFC publication.
658
+
659
+ This is a library integration through `CrawlerGuard.fallbackEvidence`; the standalone gateway and `createCrawlerRuntime()` do not automatically configure or enable it.
660
+
661
+ Real-world coverage depends on which signing providers exist and which signer keys you approve and pin; interoperability with external vendor signers has not been tested. Agent configuration is validated at construction - malformed signer config throws immediately rather than failing silently at request time - and error messages never include key material.
662
+
282
663
  ## Shopper isolation and catalog cache
283
664
 
284
665
  HEAD requests can reuse an existing cached GET representation, with body handling left to the HTTP adapter. A HEAD cache miss runs the admitted loader without storing its result; a stale HEAD never starts regeneration. This prevents an empty HEAD response from replacing the HTML served to GET requests.
@@ -297,7 +678,7 @@ The Node adapter and `sendDenial()` use compact `{ code, requestId }` bodies:
297
678
  | --- | --- | --- |
298
679
  | 429 / `CRAWLER_LIMIT` | Rate budget exhausted | Honor `Retry-After`; do not rotate IP/identity to evade it. |
299
680
  | 503 / `CRAWLER_UNAVAILABLE` | Admission cannot complete safely, ingress is untrusted or work capacity is exhausted | Honor retry guidance and investigate the decision reason. Protected work must not run. |
300
- | 403 / `CRAWLER_BLOCK` | An enforced crawler deny rule or an application-defined block | Resolve policy; repetition does not grant access. |
681
+ | 403 / `CRAWLER_BLOCK` | An enforced class rule, default-deny access setting or application-defined block | Resolve policy; repetition does not grant access. |
301
682
 
302
683
  Reasons include `rate_budget_exhausted`, `admission_unavailable`, `local_work_unavailable`, `work_store_unavailable` and `work_capacity_exhausted`. Work rejection throws `AdmissionError`, not the main SDK's `ValironError`. Rejections include `Cache-Control: no-store`; ensure the CDN does not cache caller-specific denials.
303
684
 
@@ -322,14 +703,16 @@ A real Python HTTP origin executing SQLite queries is tested behind gateway/brok
322
703
 
323
704
  Local tests cover spoof rejection, source parsing, middleware, shared Redis contention, operation bounds, dependency failure and retention of capacity after disconnect. An isolated Nuxt 4.1.3/Nitro Vue SSR → Node → MariaDB 10.11.8 fixture additionally covers physical checkout pools, actual SQL timeout/disconnect/process-death recovery, cache storms, replay/fanout and Redis outages. A controlled live website test exercised custom crawler requests, source-claim rejection, shared execution counters and refill around a real public-document read. The website test alone does not establish real crawler acceptance, search visibility or Meta previews. Local database results do not establish customer-scale capacity.
324
705
 
706
+ Valiron.co's first-party deployment uses managed controls on assessment requests and a separate bot-only QA endpoint. Each reports its own site and configuration identity. Marketing pages served by the CDN and account/billing routes are outside that admission path. Its telemetry reports request admission only, with work capacity marked not instrumented; dashboard acknowledgment is not proof of database protection.
707
+
325
708
  Validate every rendering/API/background path, cache behavior, actual query cancellation, store recovery and shopper latency under representative peak load before opening access broadly.
326
709
 
327
710
  Related: [Quickstart](./QUICKSTART.md), [SDK reference](./SDK-REFERENCE.md), [Agent identity](./IDENTITY.md), [Errors](./ERRORS.md).
328
711
 
329
712
 
330
- ## Live dashboard analytics
713
+ ## Runtime telemetry
331
714
 
332
- Free, Pro and Enterprise accounts can connect installed runtimes to **Dashboard → Crawler Protection**. It shows reported decisions by provider, verification state, route group and actual/proposed action; a 24-hour traffic timeline; gateway/work/cache metrics; shared database, render and gateway hold counts; reporting instances, configuration versions and modes; monitoring alerts; and a JSON export. The product entry route always opens analytics. An empty response shows connection guidance and an explicit setup button; empty, stale or unavailable telemetry never redirects the user away from analytics. Setup includes an analytics panel after the connection steps, with export disabled until a site has reported. The **Traffic & analytics** view shows actual Allowed, Limited, Blocked and Unavailable totals, a provider breakdown with verified-request counts, and plain-language decision reasons. Filters for site, provider, route group and actual decision narrow those summaries; clicking a provider also filters the view. Clear filters restores the selected site’s totals. Observe-mode proposed denials remain separate from actual denials. The hourly chart always covers all providers, route groups and decisions for the selected site; light bars show total requests and solid bars show denied requests. Advanced diagnostics contains raw metric series and reporting instances. Capacity meters show reserved slots per work pool, not database utilization. Metric definitions are available under **How to read these metrics**; stale/unavailable state and observation proposals remain visible. It refreshes every 30 seconds. JSON export includes the complete response across all sites and filters, rather than only the current view. Other / unidentified includes both people and unverified bots; this is aggregate source analytics, not individual visitor tracking. Empty, stale and unavailable telemetry states are explicit. Configuration export alone does not connect or activate a deployment.
715
+ Once a self-hosted runtime reports, **Dashboard → Crawler Protection** shows its analytics below the traffic overview, and **Self-hosted → Setup** always shows them. They include reported decisions by provider, verification state, route group and actual/proposed action; a 24-hour traffic timeline; gateway/work/cache metrics; shared database, render and gateway hold counts; reporting instances, configuration versions and modes; monitoring alerts; and a JSON export. Before any runtime reports, the overview shows traffic insights only, and Setup shows connection guidance with export disabled. Empty, stale or unavailable telemetry never redirects you. The **Runtime telemetry** panel on the Overview shows actual Allowed, Limited, Blocked and Unavailable totals, a provider breakdown with verified-request counts, and plain-language decision reasons. Filters for site, provider, route group and actual decision narrow those summaries; clicking a provider also filters the view. Clear filters restores the selected site’s totals. Dry-run proposed denials remain separate from actual denials. The hourly chart always covers all providers, route groups and decisions for the selected site; light bars show total requests and solid bars show denied requests. Advanced diagnostics contains raw metric series and reporting instances. Capacity meters show reserved slots per work pool, not database utilization. Metric definitions are available under **How to read these metrics**; stale/unavailable state and dry-run proposals remain visible. It refreshes every 30 seconds. JSON export includes the complete response across all sites and filters, rather than only the current view. Other / unidentified includes both people and unverified bots; this is aggregate source analytics, not individual visitor tracking. Empty, stale and unavailable telemetry states are explicit. Configuration export alone does not connect or activate a deployment.
333
716
 
334
717
  For a standalone gateway, set these **server-side** variables alongside your deployment configuration:
335
718
 
@@ -344,6 +727,8 @@ Use the account-scoped tenant from your validated configuration export (`operato
344
727
 
345
728
  For in-process integrations:
346
729
 
730
+ Traffic coverage depends on where admission runs. Standard origin integrations exclude CDN cache hits. Custom telemetry uploads can set `placement: "before-cache"` when admission runs before the CDN; the dashboard then states that those counts include cache-served requests. For request-only integrations without workload instrumentation, report `capacity: { available: false, instrumented: false }`. The dashboard labels workload capacity as not instrumented instead of treating this as a storage outage. Omitting these optional fields preserves existing origin reporting. Request admission alone does not measure or cap individual database operations; wrap those operations or use the Work API for workload limits.
731
+
347
732
  ```typescript
348
733
  import { createCrawlerTelemetry } from '@valiron/crawler-protection';
349
734
  const telemetry = createCrawlerTelemetry({
@@ -359,18 +744,117 @@ await telemetry.flush(); // Initial counter baseline, outside the request path.
359
744
 
360
745
  Reports run in the background every 30 seconds, with a five-second HTTP timeout, no redirect following and no overlapping uploads. Reporting failures cannot grant access or release work. Cumulative counters recover measurements after transient upload failure while the collector baseline survives. The first accepted sample establishes a baseline and adds no traffic counts. Missing baselines after prolonged outages likewise start a new baseline. There is no disk spool: unsent measurements can be lost when a process exits. Reports exclude raw IPs, request URLs, user agents, sessions, request IDs and credentials. Verified-provider labels reflect runtime source checks; operator-authenticated uploads are customer-reported measurements, not independent crawler attestation.
361
746
 
362
- The hosted collector retains rolling aggregates and last-seen instances for approximately 24 hours in Redis; it is not a permanent audit archive. It bounds each account to 16 sites, each site to 64 reporting instances per 24 hours and 512 aggregate metric series, and each upload to 256 series / 256 KiB. Exceeding a bound rejects the report; runtime reporting overflow is surfaced in the dashboard. Polling/ingestion require a current Pro or Enterprise account; revoked API keys or sessions fail authentication. Uploads are accepted no more frequently than every ten seconds per instance. Duplicate or older sequences are ignored atomically, and decreasing counters require a new instance ID.
747
+ The hosted collector retains rolling aggregates and last-seen instances for approximately 24 hours in Redis; it is not a permanent audit archive. It bounds each account to 16 sites, each site to 64 reporting instances per 24 hours and 512 aggregate metric series, and each upload to 256 series / 256 KiB. Exceeding a bound rejects the report; runtime reporting overflow is surfaced in the dashboard. Polling/ingestion require a current Free, Pro or Enterprise account; revoked API keys or sessions fail authentication. Uploads are accepted no more frequently than every ten seconds per instance. Duplicate or older sequences are ignored atomically, and decreasing counters require a new instance ID.
363
748
 
364
749
  The displayed window groups deltas by **server report receipt time**, not individual request time. Delayed uploads can appear as a later spike. Reports cover origin guard decisions and instrumented work; they exclude CDN hits and early ingress rejections. Unknown visitors are not classified as humans. Observe-mode proposals are not actual denials. Rejected callbacks are not measured SQL queries saved. Private work API metrics count permit admissions/rejections, not SQL completion or duration; use application/DB monitoring for those outcomes. Node callback wrappers report actual wrapper outcomes and duration.
365
750
 
366
751
  Capacity is the latest shared admission ledger reading, counted once rather than added across replicas. Database, render and gateway pools have separate limits. Retained holds include uncertain work awaiting confirmed recovery; a hold is not proof that a query is currently executing. A short spike between reports can be missed. After two minutes without a report, capacity is hidden and status becomes stale; after retention expires, the site no longer appears. A reporting instance proves telemetry connectivity, not correct ingress placement, complete DB integration or genuine crawler acceptance.
367
752
 
368
- Monitoring alerts are displayed in the dashboard for stale reports, unavailable admission storage, paused admission, policy/configuration mismatch, open/probe catalog circuits, full work pools, long-held work, reporting overflow, and reported admission/origin failures. They do not send email, Slack or webhook notifications and do not automatically change policy or reclaim holds. Use existing infrastructure alarms for unattended incident paging.
753
+ Monitoring alerts are displayed in the dashboard for stale reports, unavailable admission storage, paused admission, policy/configuration mismatch, open/probe catalog circuits, full work pools, long-held work, reporting overflow, and reported admission/origin failures. These in-dashboard alerts do not automatically change policy or reclaim holds. Optional outbound email/webhook notifications for stale runtime reports and denied-traffic thresholds are configured separately under Self-hosted controls; Slack is not included. Keep existing infrastructure alarms for unattended incident paging.
369
754
 
370
755
  Hosted endpoints (separate from the private per-deployment work API):
371
756
 
372
- - `POST /operator/crawlers/activation`: server-side operator API key and current Free/Pro/Enterprise plan; `{ tenant }` must match its owner. Returns a five-minute feature/tenant/plan lease, without issuing or deploying policy.
757
+ - `POST /operator/crawlers/activation`: server-side operator API key and a current Pro plan with the Crawler Protection add-on, or Enterprise; `{ tenant }` must match its owner. Returns a five-minute feature/tenant/plan lease, without issuing or deploying policy.
373
758
  - `POST /operator/crawlers/telemetry`: server-side operator API-key authentication; bounded cumulative snapshots with account-bound tenant, site/instance identity, increasing sequence, configuration/mode, metric series and capacity.
759
+ - `GET /operator/crawlers/billing`: authenticated account usage, included allowance, additional-call count, accepted price and billing status.
374
760
  - `GET /operator/crawlers/analytics`: operator dashboard session authentication; account-scoped rolling metrics and alerts. Responses use `Cache-Control: private, no-store`; unavailable storage returns 503 rather than fabricated zero traffic.
375
761
 
376
- Monthly bot quotas require Crawler SDK 0.3.0 or later. Upgrade existing 0.2.x deployments to use Free accounts and hosted per-request quota admission. Earlier public SDK versions are not retroactively metered.
762
+ Monthly bot quotas require Crawler SDK 0.3.0 or later. Upgrade existing 0.2.x deployments to use hosted per-request quota admission. Earlier public SDK versions are not retroactively metered.
763
+
764
+
765
+ SDK 0.5.0 adds activation to browser recognition. Upgrade 0.4.x recognition integrations and supply the activation handle. Older public packages cannot be retroactively restricted; public source can be modified, while hosted account admission is enforced on Valiron’s servers. Inventory the recognition endpoint as a bypass of outer request admission when its own `recognize()` call performs the account admission, so the same HTTP request is not admitted twice.
766
+
767
+ ## Managed controls
768
+
769
+ Managed controls require Crawler Protection SDK/gateway **0.7.0+**, the management backend and its database migration. Existing static runtimes and aggregate telemetry do not automatically enable this feature. The dashboard does not install software, deploy infrastructure or increase database capacity.
770
+
771
+ When no site has been selected, controls and analytics prefer a site with a current runtime report. Selecting an older site keeps that choice during refresh so its history remains inspectable.
772
+
773
+ ### Connect a gateway
774
+
775
+ Keep the existing validated installation configuration, Redis and operator API key. Add these server-side variables and restart your gateway:
776
+
777
+ ```dotenv
778
+ VALIRON_API_KEY=<your-server-side-operator-key>
779
+ CRAWLER_SITE_ID=storefront
780
+ CRAWLER_MANAGED_CONTROLS=true
781
+ ```
782
+
783
+ Use the same site ID for controls and telemetry. Continue `CRAWLER_TELEMETRY_URL` reporting for aggregate analytics and traffic alerts. On first successful control report, the installation registers with its current crawler access and mode, preserving a partial `enforceGroups` rollout. Selecting a new mode in Controls applies that mode to all configured route groups. Decision logging and outbound alerts start disabled. All instances sharing a site must use the same base configuration. Managed registration accepts at most 64 KiB of compact configuration JSON, 16 sites per account and 64 runtime instances per site in 24 hours.
784
+
785
+ ### Connect Node middleware
786
+
787
+ ```ts
788
+ import { createCrawlerControlClient, createCrawlerRuntime } from '@valiron/crawler-protection';
789
+
790
+ const controls = createCrawlerControlClient({
791
+ configuration, // your validated deployment configuration
792
+ apiKey: process.env.VALIRON_API_KEY!,
793
+ site: process.env.CRAWLER_SITE_ID!,
794
+ });
795
+ await controls.refresh();
796
+ const stopControls = controls.start();
797
+ const runtime = createCrawlerRuntime({
798
+ configuration, redis, activation, clientIp, registry,
799
+ controlClient: controls,
800
+ });
801
+ // Mount runtime.nodeMiddleware/runtime.nuxtMiddleware before protected work.
802
+ // Keep your existing database/render admission wrappers and telemetry.
803
+ // On shutdown: stopControls(); telemetry.stop(); activation.stop();
804
+ ```
805
+
806
+ The control client uses its fixed hosted endpoint by default. An optional `endpoint` must be trusted HTTPS (HTTP is accepted only for loopback tests), end in `/operator/crawlers/control/runtime`, and contain no credentials, query or fragment. Do not accept this value from website visitors. `status()` reports the locally held revision and lease availability. `refresh()` records failures in status; `current()` throws when no valid policy is available.
807
+
808
+ ### Choose access and budgets
809
+
810
+ Open **Crawler Protection → Self-hosted → Controls**, select a registered site, edit and **Publish changes**:
811
+
812
+ - Choose **Allow within limits** or **Block** for each installed crawler class and route group. Search, user fetches and training are separate identities. Allowing a class still requires its configured verifier and available budget; it does not grant every browser identifying itself as that service access.
813
+ - Set the fallback for other verified crawlers. Unverified traffic has a separate control: it includes ordinary anonymous visitors, so blocking it can block people. Independently authenticated shopper/checkout grants retain their own lanes.
814
+ - Reduce global, source, route or per-IP credits within the installed ceilings. Credits follow configured route costs; they are not necessarily one credit per request. Unknown traffic remains no more privileged than reduced provider budgets. Work-pool/concurrency ceilings, customer reservations, source verifiers and routing remain installation settings.
815
+ - **Observe** reports proposed access/rate denials while preserving hard safety and workload limits. **Enforce** applies access/rate decisions to catalog traffic. Review measured headroom before switching.
816
+
817
+ Customer publishing requires the owner's authenticated dashboard session. Authorized platform admins can also make customer-scoped changes through the admin workspace, with a required reason and atomic audit record; customer history labels those revisions Valiron support. Runtime operator API keys cannot publish, change alert destinations or read owner logs. Settings and the last 20 revisions are durable and account/site scoped. Concurrent edits use revision checks; refresh and review a conflicting revision rather than overwriting it. Rollback publishes the selected settings as a new increasing revision.
818
+
819
+ ### Know whether a revision is active
820
+
821
+ Runtimes poll every 30 seconds and report their previously applied revision before receiving an update. The dashboard distinguishes the desired revision from acknowledgment by instances with reports within the five-minute lease window. An acknowledgment is a runtime report, not independent deployment attestation. Instances may temporarily use different revisions during propagation; the installed safety ceilings remain the upper bound.
822
+
823
+ Control fetching runs in the background; it adds no hosted network call to the per-request control decision. It does not remove the existing hosted monthly quota admission call. Transient update failures retain the current policy only to its original expiry, at most five minutes. Authentication/configuration rejection invalidates the local policy immediately. Without a valid managed policy, new catalog admissions fail closed; authenticated customer grants remain independent. Already running work must still settle and release normally.
824
+
825
+ Changing routes, source candidates, work ceilings or the base configuration requires a planned installation update. Stop the old deployment, validate a replacement in Setup, use **Version history → Replace the installed configuration**, and deploy that exact file. Adoption resets access to the new installation defaults in dry run, disables decision logging, clears logs and replaces version history. Old configuration fingerprints are rejected. This can interrupt traffic; use a maintenance window. A runtime API key cannot silently overwrite the site's installed configuration.
826
+
827
+ ### Inspect recent decisions
828
+
829
+ **Source-rule preview** in Controls compares the published policy with your unsaved draft against up to 1,000 retained decision records from the last 24 hours. It shows source/class/route matches, the rule and mode before and after, and records matching a different rule or mode. Opening it is read-only; publishing remains a separate action. Logs are fetched only while preview is open and refresh with controls. Enable decision logging and generate traffic if the sample is empty. Unverified records can include people. Records for routes no longer installed are excluded. This is not a full backtest: logs omit customer-lane context, request-bucket state and work concurrency. Rate-only changes do not affect these matches, and a block-rule match does not prove the historical request would have been blocked. Safety and work limits remain active. The preview does not estimate infrastructure savings.
830
+
831
+ **Integration health** in Controls shows current runtime reports, exact revision/configuration acknowledgments and reported dropped-log counts. A report is current for less than five minutes; the runtime list covers the last 24 hours. Stale instances may have been intentionally stopped or replaced. Dropped counts are runtime-reported, not lifetime totals. Acknowledgment proves control connectivity only; validate route coverage, origin bypass prevention and work instrumentation separately. Use Analytics → Advanced diagnostics for telemetry and capacity diagnostics.
832
+
833
+ **Decision logs** is separately enabled in Controls. The dashboard shows up to 1,000 decisions per site from the last 24 hours; every received decision is stored by Valiron and kept. Each decision has source/class, route group, action, reason, verification state, runtime time, server receipt time and generated event ID. No raw IPs, URLs, user agents, credentials or caller-supplied request identifiers are collected by this log buffer. These coarse dimensions can still be business-sensitive; access is account scoped. Expand a reason in Decision logs for a plain-language explanation and a suggested investigation. Explanations distinguish admission from subsequent work limits; request-budget logs do not identify which bucket was exhausted. They describe the historical record, not the current policy.
834
+
835
+ Each process buffers up to 1,000 events, uploads at most 100 per control report, and drops new events when full. Retry event IDs are deduplicated in storage. This is a bounded recent sample, not a complete audit archive. The dashboard shows runtime drop indications; aggregate runtime telemetry remains the source of reported totals. Filter by source, route or decision and export the matching rows. Disabling logging stops collection and clears runtime buffers once runtimes receive the update; decisions already received are kept but no longer shown. Runtime clocks can differ; server receipt time controls the 24-hour view.
836
+
837
+ ### Configure notifications
838
+
839
+ **Alerts** can send email to the account email address and/or a public HTTPS webhook, only after the owner saves enabled destinations. Email requires server-side `RESEND_API_KEY` and optional `CRAWLER_ALERT_EMAIL_FROM`; the UI shows when email is unavailable. Webhooks must use public HTTPS on port 443 without URL credentials. DNS is resolved and checked again for each delivery, pinned to the checked public address; redirects are not followed.
840
+
841
+ Available triggers are runtime reporting absent for two minutes and a configured threshold of limited/blocked requests in the current fixed five-minute reporting window. The latter requires aggregate telemetry using the same site ID; it is not computed from sampled decision logs. Checks run about once a minute in bounded worker batches, so notifications can be delayed. A per-destination/type cooldown is configurable from 15 minutes to 24 hours. Delivery attempts and status are visible; failures retry up to three times. Deliveries are retained for seven days. These notifications supplement existing infrastructure alarms and do not change policy or reclaim workload holds.
842
+
843
+ Webhook bodies contain `id`, `type` (`crawler.stale` or `crawler.blocked`), `site`, `occurredAt` and a fixed message. Delivery is not signed; treat it as a notification and confirm incidents in the authenticated dashboard before taking privileged actions. Receivers should deduplicate by `id`: failures after delivery can produce retries. Turning destinations off or changing settings cancels queued deliveries on their next check; it cannot retract a delivery already in flight.
844
+
845
+ ### Management endpoints
846
+
847
+ All responses are private and noncacheable. API keys authenticate only `POST /operator/crawlers/control/runtime`, which registers/updates a site, receives a five-minute policy lease and uploads bounded decisions. A configuration fingerprint mismatch returns 409; excessively frequent reports or cardinality limits return 429.
848
+
849
+ Owner dashboard sessions authenticate:
850
+
851
+ - `GET /operator/crawlers/control`: registered sites, installed ceilings, desired settings and runtime acknowledgments.
852
+ - `POST /operator/crawlers/control/publish?site=...`: `{ expectedRevision, settings }` or `{ expectedRevision, rollbackRevision }`.
853
+ - `POST /operator/crawlers/control/adopt?site=...`: `{ expectedRevision, configuration }` for a planned installation replacement.
854
+ - `GET /operator/crawlers/control/history?site=...`: last 20 revisions.
855
+ - `GET /operator/crawlers/control/logs?site=...`: bounded recent decisions.
856
+ - `POST /operator/crawlers/control/alerts?site=...`: `{ expectedVersion, settings }` to configure destinations/triggers.
857
+ - `GET /operator/crawlers/control/deliveries?site=...`: recent delivery statuses.
858
+
859
+ These controls do not enable paid request overages or change plan allowances. Database utilization, SQL query counts and money saved are not inferred from blocked requests.
860
+