@valiron/sdk 2.0.0 → 2.1.0

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.
@@ -0,0 +1,196 @@
1
+ # Valiron trust gate on Cloudflare Workers
2
+
3
+ Run the general Valiron trust gate - the same middleware semantics as the
4
+ Express, Fastify, Next.js and generic adapters in `@valiron/sdk` - as a
5
+ Cloudflare Worker in front of your API. Agents are identified, ownership is
6
+ proven per request, the live trust profile is evaluated, and only allowed
7
+ requests reach your origin.
8
+
9
+ This document describes the current source contract on this branch. Package
10
+ publication and production deployment are separate release steps; confirm the
11
+ installed `@valiron/sdk` exposes the `edge-gate` subpath and the
12
+ `examples/cloudflare-gate-worker` template before building on them.
13
+
14
+ ## Who this is for, and whether it is required
15
+
16
+ This is an optional integration for a business that sells or exposes an API and
17
+ wants agent ownership and trust checks before requests reach its backend. The
18
+ business runs the Worker in its Cloudflare account, chooses the routes, score
19
+ threshold and trust signals, and protects its origin from direct access. The
20
+ backend can use any language. Valiron still serves profile reads and sandbox
21
+ evaluation; the default verifier also reads the current owner from Valiron.
22
+
23
+ Cloudflare is not required to use Valiron. Businesses can keep Node middleware,
24
+ call the API from their own enforcement code, or use this Worker. Use one
25
+ trust-gate layer per protected route. Agents calling those routes must identify
26
+ themselves and sign fresh requests. The gate verifies agent ownership and
27
+ applies the business's trust policy. Customer permissions, benefits and payment
28
+ authorization remain application responsibilities.
29
+
30
+
31
+ ## Components
32
+
33
+ - **`@valiron/sdk/edge-gate`.** A WebCrypto-only SDK subpath that loads in
34
+ Workers and other edge runtimes without Node APIs: `runValironEdgeGate`,
35
+ `createEdgeIdentityVerifier`, `stripEdgeGateHeaders`,
36
+ `edgeSha256RequestDigest`, and an edge-safe `ValironClient` re-export. The
37
+ gate decision itself is computed by the exact same `valironGateCheck`
38
+ implementation the Node middleware uses, so statuses, error bodies, cache
39
+ behavior and allow/deny semantics are identical.
40
+ - **Worker template.** `packages/valiron-sdk/examples/cloudflare-gate-worker/`
41
+ is a deployable Worker: identity extraction, per-request proof
42
+ verification, live profile evaluation, trusted-header strip/set, and
43
+ path scoping. `packages/valiron-sdk/test/edge-gate-worker/` is a committed
44
+ miniflare (workerd) regression harness for the template.
45
+
46
+ ## Request flow
47
+
48
+ ```text
49
+ Agent request
50
+ -> Worker reads x-agent-id / x-agent-address
51
+ -> Worker verifies the request-bound proof (before any decision, cache hits included)
52
+ -> Worker evaluates the live profile through the Valiron operator API
53
+ -> allow: strip client x-valiron-gate-*, set trusted decision headers, forward to origin
54
+ -> deny: 401 / 403 / 503 response; the origin never runs
55
+ ```
56
+
57
+ Decision semantics are the Node gate's, unchanged:
58
+
59
+ | Condition | Status | Code |
60
+ | --- | --- | --- |
61
+ | No identity headers | 401 | `MISSING_AGENT_IDENTITY` |
62
+ | Missing or invalid request proof | 401 | `AGENT_OWNERSHIP_REQUIRED` |
63
+ | Route not production-eligible, or score below `minScore` | 403 | `TRUST_GATE_DENIED` |
64
+ | New agent (no reputation yet) | 403 | `AGENT_EVALUATION_PENDING` |
65
+ | Evaluation error / API unreachable (after a successful proof) | 503 | `TRUST_GATE_UNAVAILABLE` (fail closed) |
66
+ | API unreachable during hosted proof verification | 401 | `AGENT_OWNERSHIP_REQUIRED` (fail closed) |
67
+
68
+ Allow requires routing `prod` or `prod_throttled` AND the combined score at
69
+ or above `minScore` (default 65). A new agent's denial triggers a background
70
+ sandbox evaluation, exactly like the Node gate.
71
+
72
+ Outage behavior depends on where the failure lands. The default wallet
73
+ verifier checks signatures locally, but first reads the current owner from
74
+ Valiron; failure of that lookup returns 401 `AGENT_OWNERSHIP_REQUIRED`.
75
+ Hosted verification failures also return 401. If proof verification succeeds
76
+ and the later trust-profile evaluation fails, the gate returns 503
77
+ `TRUST_GATE_UNAVAILABLE`. The origin is never touched on failure.
78
+
79
+ ## Deploy the Worker template
80
+
81
+ Copy `packages/valiron-sdk/examples/cloudflare-gate-worker/`, configure
82
+ `wrangler.toml`, and `wrangler deploy`. Required: `VALIRON_ENDPOINT` (the
83
+ Valiron operator API), `VALIRON_API_KEY` (secret - profile routes are
84
+ operator-authenticated) and the `VALIRON_NONCE_STORE` Durable Object binding
85
+ (durable replay protection; the gate fails closed without it). Recommended:
86
+ `VALIRON_ORIGIN_SECRET` (secret forwarded to the origin as
87
+ `x-valiron-gate-secret`). Optional: `VALIRON_MIN_SCORE`,
88
+ `VALIRON_GATE_PATHS`, `VALIRON_TRUST_SIGNALS`, `VALIRON_CACHE_TTL_MS`,
89
+ `VALIRON_VERIFIER` (`hosted` selects hosted ANS verification - see below),
90
+ `VALIRON_PUBLIC_ORIGIN` (audience for the hosted variant only).
91
+
92
+ ## Required trust boundary
93
+
94
+ 1. **The origin must reject anything that did not pass the gate.** The
95
+ Worker strips client-supplied `x-valiron-gate-*` headers and sets its own
96
+ (`x-valiron-gate-decision`, `-agent-id`, `-score`, `-tier`,
97
+ `-risk-level`, `-route`), and forwards `x-valiron-gate-secret` when
98
+ `VALIRON_ORIGIN_SECRET` is set. The origin must reject requests missing
99
+ that secret, or use an exclusive authenticated origin path (private Tunnel or custom
100
+ per-zone mTLS). Cloudflare IP allowlisting or a shared origin-pull
101
+ certificate alone does not identify this Worker. If the origin is reachable
102
+ directly, the gate is bypassable.
103
+ 2. **Replay protection is durable.** The default verifier refuses to run
104
+ without the `VALIRON_NONCE_STORE` Durable Object binding (503,
105
+ fail-closed). Nonces are claimed atomically in one named Durable Object
106
+ with a 121-second TTL matching the proof validity window, so a proof
107
+ replayed against any isolate or after a restart is rejected. The SDK's
108
+ in-memory `MemoryNonceStore` is for local tests only.
109
+ 3. **Enforce the gate at one layer per route.** Do not run the origin's
110
+ `createValironGate` on the same routes the Worker gates; requests would be
111
+ evaluated twice.
112
+ 4. **Header claims alone never authorize.** Every identified request carries
113
+ a fresh proof or is denied `401 AGENT_OWNERSHIP_REQUIRED` before trust
114
+ evaluation. The default verifier first reads the current registry owner
115
+ from a live profile to determine which key must sign.
116
+ 5. **The profile cache is per isolate** (default 30000 ms, matching the Node
117
+ gate's per-process default). It is not shared across isolates or colos.
118
+ The ownership proof is verified on every request regardless of cache.
119
+
120
+ ## Request-bound proofs
121
+
122
+ The template's default `verifyRequest` is `createEdgeWalletProofVerifier`:
123
+ application-owned verification of the `valiron-wallet-request-v2` signed
124
+ request scheme (see `SECURITY-UPGRADE-2026-10-31.md`), the same scheme the
125
+ hosted API enforces server-side. Agents send `x-agent-timestamp`,
126
+ `x-agent-nonce` and `x-agent-request-signature`: the registry owner's EIP-191
127
+ (EVM) or Ed25519 (Solana) signature over the canonical payload binding the
128
+ agent id, chain, method, the exact public URL, a canonical JSON body digest,
129
+ a millisecond timestamp (60-second window) and a fresh nonce. The Worker
130
+ verifies the signature against the agent's current registry owner wallet
131
+ from the live profile, then consumes the nonce in the Durable Object; a
132
+ replayed proof is rejected for 121 seconds. Key-based web2 agents send
133
+ `x-agent-address` and sign with that address's key (chain `key`). The sign
134
+ side ships in the SDK's hosted clients (`signRequest`) and the recipe is in
135
+ the template README.
136
+
137
+ `VALIRON_VERIFIER=hosted` switches to `createEdgeIdentityVerifier`: Valiron's
138
+ hosted ANS provider-identity verification (`POST /operator/identity/verify`,
139
+ `x-valiron-identity-*` headers from `createAgentIdentityProof`, canonical
140
+ `valiron-agent-request-v2` payload). That variant requires Valiron backend
141
+ ANS configuration and a registered `ans://` identity, and was not exercised
142
+ in the template's isolated test deployment.
143
+
144
+ Operators with their own request-signing scheme replace `verifyRequest` in
145
+ `worker.ts` - the same application-owned verifier contract as the Node
146
+ middleware (`verifyAgentRequest` in the end-to-end guide). The verifier must
147
+ bind identity, method, full URL and body, enforce freshness, and reject
148
+ replayed nonces in durable shared storage.
149
+
150
+ ## What this is not
151
+
152
+ - It does not cache or replicate trust scores at the edge beyond the short
153
+ per-isolate profile cache the Node middleware already has; the operator API
154
+ remains the decision source.
155
+ - It grants no Cloudflare verified-agent status and changes no scoring or
156
+ privacy behavior.
157
+
158
+ ## Verification
159
+
160
+ - SDK suite: `pnpm --filter @valiron/sdk test` includes
161
+ `test/validate-edge-gate.mjs` (decision parity with the Node gate, digest
162
+ parity with Node `sha256RequestDigest`, header constants, verifier
163
+ binding rules).
164
+ - Workers-runtime harness: `packages/valiron-sdk/test/edge-gate-worker/`
165
+ (miniflare; allow/deny, both signing chains through the default
166
+ wallet-proof verifier with real signatures, Durable Object replay
167
+ rejection, tampered/stale/wrong-key rejection, fail-closed without the
168
+ nonce-store binding, origin-secret forwarding, hosted-variant coverage,
169
+ header stripping, path scoping, profile cache, digest recomputation). This
170
+ is hermetic coverage with a mocked API; it complements a live deployment
171
+ test and does not replace one.
172
+
173
+
174
+ ## Origin targeting and nonce expiry
175
+
176
+ For a standalone `workers.dev` deployment, set `VALIRON_ORIGIN` to the fixed
177
+ HTTPS origin, for example `https://origin.example.com`. It must have no
178
+ credentials, path, query, or fragment and must differ from the incoming
179
+ origin. Leave it unset only when Cloudflare zone-route origin resolution is
180
+ configured. The Worker verifies the original incoming URL and body before
181
+ rewriting the destination. Path and query are preserved; caller-provided
182
+ URLs and host-like paths cannot select another host. Redirects from an
183
+ explicit origin are returned without following them, so trusted headers and
184
+ the origin secret are never sent to a redirect destination. Out-of-scope
185
+ paths are forwarded without the gate secret and cannot access protected
186
+ origin routes.
187
+
188
+ Durable Object nonce claims use a storage transaction and an explicit expiry
189
+ timestamp, not KV-only `expirationTtl`. A scheduled alarm removes expired
190
+ entries. Concurrent claims have exactly one winner; a claimed nonce stays
191
+ blocked until its 121-second expiry, including across isolates. Expiry makes
192
+ the nonce reusable but does not make an old signature fresh.
193
+
194
+ The template registers sandbox-trigger promises with `ExecutionContext.waitUntil` so pending evaluations can continue after the denial response. All inbound `x-valiron-gate-*` headers, including a forged origin secret, are stripped before forwarding.
195
+
196
+ Wallet proof freshness can be tightened with `maxAgeMs`; values above 60,000 ms are rejected. Durable nonce retention is 121 seconds to cover the entire 60-second past/future validity horizon, including its boundary.
@@ -2,7 +2,7 @@
2
2
 
3
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.
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: Free, Pro and Enterprise.** SDK 0.3.0+ supports these plans with a server-side operator API key and hosted monthly quota admission. Free includes 10,000 protected requests per UTC calendar month; Pro includes 100,000. With usage billing enabled, additional crawler requests cost 0.001 each in the Pro subscription’s billing currency; the dashboard displays the currency before acceptance. Upgrade 0.2.x installations to use this contract; 0.1.0 has no account activation check.
6
6
 
7
7
  Install `@valiron/crawler-protection` from npm with Node.js 22 or later:
8
8
 
@@ -22,23 +22,27 @@ Choose **Crawler Protection** in the dashboard Product switcher (`/dashboard/cra
22
22
 
23
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.
24
24
 
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.
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. Initial Redis policy activation remains an explicit deployment operation. After connection, managed dashboard controls can publish crawler access and tighter request budgets within installed ceilings. A passing configuration check does not prove production capacity or genuine Meta acceptance.
26
+
27
+ ### Usage billing
28
+
29
+ **Dashboard → Account → Usage** (`/dashboard/usage`) shows account-wide monthly crawler and middleware request usage separately, including included/remaining allowance, additional calls, estimated request-overage charges and the next UTC reset. Counts refresh every 15 seconds while visible, with manual refresh and explicit unavailable/stale states. These are hosted admission counters; they do not include bypassed routes or CDN hits that never reach admission. Crawler traffic charts use separate optional runtime telemetry. Existing Pro subscribers choose **Enable additional calls** and accept the displayed currency and 0.001 rate; installing an SDK or upgrading the package does not enable charges. New Pro checkout has separate, unchecked opt-in controls for Crawler Protection and middleware. Each metered item is added only when its current displayed price is accepted. One product’s acceptance never enables the other. Additional usage is stored durably before admission completes and is sent to the billing provider in background batches; dashboard traffic telemetry is not the billing source. Calls admitted before a later work failure remain counted. An unresolved billing-delivery problem pauses paid overages for review.
26
30
 
27
31
  ## Start here
28
32
 
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.
33
+ 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.7.0`. Keep the key in the server environment as `VALIRON_API_KEY`; never put it in browser code or the site configuration JSON.
30
34
  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
35
  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
36
  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
37
  5. Test observation mode, hard workload caps, application authorization and recovery on your own environment before enabling broader crawler access.
34
38
 
35
- ### Pro API-key activation (SDK 0.3.0+)
39
+ ### Account API-key activation (SDK 0.3.0+)
36
40
 
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.
41
+ 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. Free, Pro and Enterprise accounts can activate it.
38
42
 
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.
43
+ 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. Free stops at 10,000 until the account upgrades. Pro stops at 100,000 unless its owner has accepted and enabled usage billing on an active paid subscription; requests above 100,000 then accrue at 0.001 per call. The included allowances reset by UTC calendar month, while overages appear on the subscription invoice. Canceled, unpaid, expired or unreconciled billing does not authorize paid overages. Exhaustion without overages returns 429; usage storage or network failure stops new protected requests with 503. Local access/rate denials occur before hosted quota admission and do not consume the allowance. Once hosted admission succeeds, the request is counted even if a later work-capacity check fails. 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.
40
44
 
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.
45
+ 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
46
 
43
47
 
44
48
  ## Website compatibility
@@ -108,7 +112,7 @@ The named configuration, Redis, trusted ingress, shopping-grant validation and q
108
112
 
109
113
  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
114
 
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.
115
+ `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
116
 
113
117
  `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
118
 
@@ -151,13 +155,16 @@ Seven provider integrations are available; Meta requires the separate trusted WA
151
155
  | Provider ID | Class IDs | Official verification source |
152
156
  | --- | --- | --- |
153
157
  | `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) |
158
+ | `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) |
159
+ | `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
160
  | `apple` | `applebot` | [Applebot CIDRs](https://search.developer.apple.com/applebot.json); [Apple’s guide](https://support.apple.com/en-us/119829) |
156
161
  | `duckduckgo` | `duckduckbot` | [DuckDuckBot CIDRs](https://duckduckgo.com/duckduckbot.json); [DuckDuckGo’s guide](https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot) |
157
162
  | `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
163
  | `bing` | `bingbot` | [Bing reverse/forward DNS verification](https://www.bing.com/webmasters/help/how-to-verify-bingbot-3905dc26) |
159
164
  | `meta` | `social-preview`, `advertising`, `search`, `training`, `fetcher` | Authenticated AWS WAF verified-bot evidence and matching supported UA, as described below |
160
165
 
166
+ `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.
167
+
161
168
  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
169
 
163
170
  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 +179,7 @@ const status = await refreshCrawlerFeeds(registry, { ttlMs: 60 * 60 * 1000, conc
172
179
  await refreshCrawlerFeed(registry, 'googlebot', { ttlMs: 60 * 60 * 1000 });
173
180
  ```
174
181
 
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.
182
+ `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
183
 
177
184
  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
185
 
@@ -185,7 +192,9 @@ To configure budgets, put the provider ID and its class IDs under `policy.provid
185
192
 
186
193
  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
194
 
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.
195
+ 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.
196
+
197
+ 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
198
 
190
199
  ## Broader crawler directory
191
200
 
@@ -200,13 +209,46 @@ To enable identity verification for additional crawlers:
200
209
  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
210
  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
211
 
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.
212
+ 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
213
 
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.
214
+ 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
215
 
207
216
  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
217
 
209
218
 
219
+ ## Allow selected AI services
220
+
221
+ 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.
222
+
223
+ 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.
224
+
225
+ 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:
226
+
227
+ ```json
228
+ {
229
+ "crawlerAccessDefault": "deny",
230
+ "unverifiedAccess": "budget",
231
+ "crawlerAccess": [
232
+ { "provider": "openai", "crawlerClass": "oai-searchbot", "groups": ["catalog"], "action": "budget" },
233
+ { "provider": "openai", "crawlerClass": "chatgpt-user", "groups": ["catalog"], "action": "budget" },
234
+ { "provider": "anthropic", "crawlerClass": "claude-searchbot", "groups": ["catalog"], "action": "budget" },
235
+ { "provider": "anthropic", "crawlerClass": "claude-user", "groups": ["catalog"], "action": "budget" },
236
+ { "provider": "google", "crawlerClass": "google-agent", "groups": ["catalog"], "action": "budget" },
237
+ { "provider": "google", "crawlerClass": "gemini-notebook", "groups": ["catalog"], "action": "budget" }
238
+ ]
239
+ }
240
+ ```
241
+
242
+ 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.
243
+
244
+ 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.
245
+
246
+ Defaults apply across the configuration’s protected groups; explicit class rules are group-specific. Inventory bypasses remain bypasses. In observation mode, 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.
247
+
248
+ 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.
249
+
250
+ 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.
251
+
210
252
  ## Shared policy
211
253
 
212
254
  `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 +321,38 @@ Contexts belong to the guard instance that created them. Managed mode supports `
279
321
 
280
322
  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
323
 
324
+ ## Returning-browser recognition (optional, observe-only)
325
+
326
+ 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.
327
+
328
+ 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.
329
+
330
+ Supported-runtime limits for this module:
331
+
332
+ - 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.
333
+ - The middleware endpoints (`GET .../collector.js`, `POST .../identify`) require a Node.js 22+ runtime. Do not mount them on an edge/Workers runtime.
334
+ - 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.
335
+ - The in-memory store is single-process; use `RedisIdentityStore` for multi-instance deployments.
336
+
337
+ 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.
338
+
339
+ 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.
340
+
341
+ ## Web Bot Auth verification (opt-in, draft protocol)
342
+
343
+ 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.
344
+
345
+ Trust boundaries, deliberately stricter than the draft minimum:
346
+
347
+ - 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.
348
+ - 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.
349
+ - 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.
350
+ - The protocol is a draft; expect wire-format changes before RFC publication.
351
+
352
+ This is a library integration through `CrawlerGuard.fallbackEvidence`; the standalone gateway and `createCrawlerRuntime()` do not automatically configure or enable it.
353
+
354
+ 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.
355
+
282
356
  ## Shopper isolation and catalog cache
283
357
 
284
358
  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 +371,7 @@ The Node adapter and `sendDenial()` use compact `{ code, requestId }` bodies:
297
371
  | --- | --- | --- |
298
372
  | 429 / `CRAWLER_LIMIT` | Rate budget exhausted | Honor `Retry-After`; do not rotate IP/identity to evade it. |
299
373
  | 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. |
374
+ | 403 / `CRAWLER_BLOCK` | An enforced class rule, default-deny access setting or application-defined block | Resolve policy; repetition does not grant access. |
301
375
 
302
376
  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
377
 
@@ -344,6 +418,8 @@ Use the account-scoped tenant from your validated configuration export (`operato
344
418
 
345
419
  For in-process integrations:
346
420
 
421
+ 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.
422
+
347
423
  ```typescript
348
424
  import { createCrawlerTelemetry } from '@valiron/crawler-protection';
349
425
  const telemetry = createCrawlerTelemetry({
@@ -359,18 +435,111 @@ await telemetry.flush(); // Initial counter baseline, outside the request path.
359
435
 
360
436
  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
437
 
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.
438
+ 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
439
 
364
440
  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
441
 
366
442
  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
443
 
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.
444
+ 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 Dashboard controls; Slack is not included. Keep existing infrastructure alarms for unattended incident paging.
369
445
 
370
446
  Hosted endpoints (separate from the private per-deployment work API):
371
447
 
372
448
  - `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.
373
449
  - `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.
450
+ - `GET /operator/crawlers/billing`: authenticated account usage, included allowance, additional-call count, accepted price and billing status.
374
451
  - `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
452
 
376
453
  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.
454
+
455
+
456
+ 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.
457
+
458
+ ## Dashboard controls
459
+
460
+ 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.
461
+
462
+ ### Connect a gateway
463
+
464
+ Keep the existing validated installation configuration, Redis and operator API key. Add these server-side variables and restart your gateway:
465
+
466
+ ```dotenv
467
+ VALIRON_API_KEY=<your-server-side-operator-key>
468
+ CRAWLER_SITE_ID=storefront
469
+ CRAWLER_MANAGED_CONTROLS=true
470
+ ```
471
+
472
+ 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 Crawler 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.
473
+
474
+ ### Connect Node middleware
475
+
476
+ ```ts
477
+ import { createCrawlerControlClient, createCrawlerRuntime } from '@valiron/crawler-protection';
478
+
479
+ const controls = createCrawlerControlClient({
480
+ configuration, // your validated deployment configuration
481
+ apiKey: process.env.VALIRON_API_KEY!,
482
+ site: process.env.CRAWLER_SITE_ID!,
483
+ });
484
+ await controls.refresh();
485
+ const stopControls = controls.start();
486
+ const runtime = createCrawlerRuntime({
487
+ configuration, redis, activation, clientIp, registry,
488
+ controlClient: controls,
489
+ });
490
+ // Mount runtime.nodeMiddleware/runtime.nuxtMiddleware before protected work.
491
+ // Keep your existing database/render admission wrappers and telemetry.
492
+ // On shutdown: stopControls(); telemetry.stop(); activation.stop();
493
+ ```
494
+
495
+ 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.
496
+
497
+ ### Choose access and budgets
498
+
499
+ Open **Crawler Protection → Crawler controls**, select a registered site, edit and **Publish changes**:
500
+
501
+ - 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.
502
+ - 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.
503
+ - 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.
504
+ - **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.
505
+
506
+ 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.
507
+
508
+ ### Know whether a revision is active
509
+
510
+ 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.
511
+
512
+ 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.
513
+
514
+ 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 observation mode, 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.
515
+
516
+ ### Inspect recent decisions
517
+
518
+ **Decision logs** is separately enabled in Crawler controls. It retains up to 1,000 decisions per site for 24 hours, with 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.
519
+
520
+ 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 Traffic & analytics remains the source of reported totals. Filter by source, route or decision and export the matching rows. Disabling logging clears retained events and buffers once runtimes receive the update. Runtime clocks can differ; server receipt time controls retention.
521
+
522
+ ### Configure notifications
523
+
524
+ **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.
525
+
526
+ 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.
527
+
528
+ 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.
529
+
530
+ ### Management endpoints
531
+
532
+ 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.
533
+
534
+ Owner dashboard sessions authenticate:
535
+
536
+ - `GET /operator/crawlers/control`: registered sites, installed ceilings, desired settings and runtime acknowledgments.
537
+ - `POST /operator/crawlers/control/publish?site=...`: `{ expectedRevision, settings }` or `{ expectedRevision, rollbackRevision }`.
538
+ - `POST /operator/crawlers/control/adopt?site=...`: `{ expectedRevision, configuration }` for a planned installation replacement.
539
+ - `GET /operator/crawlers/control/history?site=...`: last 20 revisions.
540
+ - `GET /operator/crawlers/control/logs?site=...`: bounded recent decisions.
541
+ - `POST /operator/crawlers/control/alerts?site=...`: `{ expectedVersion, settings }` to configure destinations/triggers.
542
+ - `GET /operator/crawlers/control/deliveries?site=...`: recent delivery statuses.
543
+
544
+ 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.
545
+