@valiron/sdk 2.1.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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Valiron verifies AI agent identity and enforces access policies at your API.
9
9
 
10
10
  ## Hosted request billing
11
11
 
12
- Free includes 10,000 metered middleware requests per UTC month; Pro includes 100,000. Active paid Pro customers can separately opt in to additional middleware calls at 0.001 each in their subscription currency. Crawler Protection has its own allowance and opt-in. This counts hosted admission calls, not every local SDK method. View current counts and request-overage estimates in [Dashboard → Usage](https://www.valiron.co/dashboard/usage). See the [metered routes and billing contract](https://www.valiron.co/docs/agents/API-REFERENCE.md#monthly-request-allowance).
12
+ Free includes 10,000 Agent Access requests per UTC month; Pro includes 100,000. Active paid Pro customers can separately opt in to additional Agent Access calls at $0.001 each. Crawler Protection has its own allowance and opt-in. This counts hosted admission calls, not every local SDK method. View current counts and request-overage estimates in [Dashboard → Usage](https://www.valiron.co/dashboard/usage). See the [metered routes and billing contract](https://www.valiron.co/docs/agents/API-REFERENCE.md#monthly-request-allowance).
13
13
 
14
14
  ## Website crawler protection
15
15
 
package/dist/index.d.ts CHANGED
@@ -438,5 +438,6 @@ export { createValironIdentityGate, valironIdentityFastifyPlugin, createValironI
438
438
  export type { ValironIdentityGateConfig, ValironIdentityFastifyConfig, ValironIdentityNextConfig, ValironIdentityGateCheckResult, } from "./identityMiddleware";
439
439
  export { isValidAddress, generateChallenge, sha256RequestDigest, buildAgentIdentitySigningPayload, createAgentIdentityProof, agentIdentityProofHeaders, agentIdentityProofFromHeaders, AGENT_IDENTITY_HEADERS, } from "./identity";
440
440
  export type { ChallengeResponse, AgentIdentityBody, CreateAgentIdentityProofInput, } from "./identity";
441
+ /** @deprecated Per-call charging is no longer offered; see `createValironGate`. */
441
442
  export { ValironOperator } from "./operatorSdk";
442
443
  export type { ValironOperatorConfig, PaywallConfig } from "./operatorSdk";
package/dist/index.js CHANGED
@@ -497,5 +497,6 @@ Object.defineProperty(exports, "createAgentIdentityProof", { enumerable: true, g
497
497
  Object.defineProperty(exports, "agentIdentityProofHeaders", { enumerable: true, get: function () { return identity_1.agentIdentityProofHeaders; } });
498
498
  Object.defineProperty(exports, "agentIdentityProofFromHeaders", { enumerable: true, get: function () { return identity_1.agentIdentityProofFromHeaders; } });
499
499
  Object.defineProperty(exports, "AGENT_IDENTITY_HEADERS", { enumerable: true, get: function () { return identity_1.AGENT_IDENTITY_HEADERS; } });
500
+ /** @deprecated Per-call charging is no longer offered; see `createValironGate`. */
500
501
  var operatorSdk_1 = require("./operatorSdk");
501
502
  Object.defineProperty(exports, "ValironOperator", { enumerable: true, get: function () { return operatorSdk_1.ValironOperator; } });
@@ -51,6 +51,10 @@ export interface PaywallConfig {
51
51
  /**
52
52
  * Valiron Operator SDK — for API sellers who want to monetize their endpoints.
53
53
  *
54
+ * @deprecated Valiron no longer offers per-call charging of agents. Use `createValironGate`,
55
+ * `valironFastifyPlugin` or `createValironNextMiddleware` to gate routes; this export
56
+ * will be removed in a future major version.
57
+ *
54
58
  * @example
55
59
  * ```typescript
56
60
  * import { ValironOperator } from '@valiron/sdk';
@@ -87,6 +91,8 @@ export declare class ValironOperator {
87
91
  /**
88
92
  * Create Express/Connect middleware that gates access + tracks usage.
89
93
  *
94
+ * @deprecated Use `createValironGate` or `valironFastifyPlugin`. Per-call charging is no longer offered.
95
+ *
90
96
  * Extracts `X-Agent-Id` from request, runs trust gate, and attaches
91
97
  * `req.valiron` with the gate result + pricing info.
92
98
  *
@@ -109,6 +115,8 @@ export declare class ValironOperator {
109
115
  /**
110
116
  * Create a Fastify plugin that gates access + tracks usage.
111
117
  *
118
+ * @deprecated Use `createValironGate` or `valironFastifyPlugin`. Per-call charging is no longer offered.
119
+ *
112
120
  * @example
113
121
  * ```typescript
114
122
  * app.register(operator.fastifyPaywall({
@@ -6,6 +6,10 @@ const middleware_js_1 = require("./middleware.js");
6
6
  /**
7
7
  * Valiron Operator SDK — for API sellers who want to monetize their endpoints.
8
8
  *
9
+ * @deprecated Valiron no longer offers per-call charging of agents. Use `createValironGate`,
10
+ * `valironFastifyPlugin` or `createValironNextMiddleware` to gate routes; this export
11
+ * will be removed in a future major version.
12
+ *
9
13
  * @example
10
14
  * ```typescript
11
15
  * import { ValironOperator } from '@valiron/sdk';
@@ -113,6 +117,8 @@ class ValironOperator {
113
117
  /**
114
118
  * Create Express/Connect middleware that gates access + tracks usage.
115
119
  *
120
+ * @deprecated Use `createValironGate` or `valironFastifyPlugin`. Per-call charging is no longer offered.
121
+ *
116
122
  * Extracts `X-Agent-Id` from request, runs trust gate, and attaches
117
123
  * `req.valiron` with the gate result + pricing info.
118
124
  *
@@ -208,6 +214,8 @@ class ValironOperator {
208
214
  /**
209
215
  * Create a Fastify plugin that gates access + tracks usage.
210
216
  *
217
+ * @deprecated Use `createValironGate` or `valironFastifyPlugin`. Per-call charging is no longer offered.
218
+ *
211
219
  * @example
212
220
  * ```typescript
213
221
  * app.register(operator.fastifyPaywall({
@@ -4,7 +4,7 @@ See the [security upgrade guide](SECURITY-UPGRADE-2026-10-31.md) before upgradin
4
4
 
5
5
  [Valiron Crawler Protection](./CRAWLER-PROTECTION.md) runs as a standalone HTTP gateway or in-process middleware with shared admission state. Its private per-deployment work API lets other server languages acquire/release database capacity; it is not part of this hosted public REST API and must remain on private authenticated ingress. The package includes its protocol contract. The website dashboard validates/exports account-scoped configuration without deploying protection and displays optional runtime-reported crawler analytics. Its exports belong to the `@valiron/crawler-protection` package, not `@valiron/sdk`.
6
6
 
7
- Crawler SDK 0.3.0+ requires a Free/Pro/Enterprise operator API key and account-bound activation via `activateCrawlerProtection()` before constructing its runtime. Activation uses a short-lived local lease, refreshed in the background. Each protected HTTP request requires hosted monthly quota admission; database operations are not counted again. See the crawler guide for revocation, outage and recovery behavior.
7
+ Crawler SDK 0.3.0+ requires an operator API key for a Pro account with the Crawler Protection add-on (or Enterprise) and account-bound activation via `activateCrawlerProtection()` before constructing its runtime. Activation uses a short-lived local lease, refreshed in the background. Each protected HTTP request requires hosted monthly quota admission; database operations are not counted again. See the crawler guide for revocation, outage and recovery behavior.
8
8
 
9
9
  For the current crawler integration, install `@valiron/crawler-protection@^0.6.0`. It adds official Anthropic and Google agent/Notebook feeds alongside OpenAI support, and `crawlerAccessDefault` / `unverifiedAccess` configuration. These are customer-runtime controls, not hosted policy-deployment APIs. See [selected AI services and upgrade steps](./CRAWLER-PROTECTION.md#allow-selected-ai-services); source verification does not grant unlimited access or authorize account actions.
10
10
 
@@ -15,7 +15,6 @@ Base URL: `https://valiron-edge-proxy.onrender.com`
15
15
  Supported integration endpoints:
16
16
 
17
17
  - **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — Profile reads, runtime gate and identity-verification requests require an operator key; Only Social Graph (Icebreaker) requires Pro signal access; use `Authorization: Bearer val_op_...`.
18
- - **Agent-ready wrappers** (`/wrap/:operatorId/*`) — Public agent-facing URLs created from Dashboard endpoint configs. These can enforce x402/MPP payment, optional trust checks, rate limits, and upstream forwarding.
19
18
 
20
19
  ---
21
20
 
@@ -29,16 +28,16 @@ Health and key-identity enrollment remain accessible without an operator key. En
29
28
 
30
29
  Profile endpoints require operator authentication and return identity and trust summaries. They do not return raw behavioral metrics, stored-evidence links, RPC URLs, internal errors, or verification-provider records. Self and World ID responses return an allowlisted verification summary; nullifiers, credential subjects, and provider storage references are private.
31
30
 
32
- Sandbox runs require an operator API key. World ID/Self profiles, wallet intelligence, the trust-gated proxy, analytics, and webhook registration are included with Free and require an operator API key. Social Graph (Icebreaker) requires Pro. Crawler Protection is included on Free. Webhook deliveries are scoped to the operator that initiated the evaluation and the selected chain. Legacy global evaluation history and platform statistics are restricted to Valiron administrators; view your own account analytics in the dashboard.
31
+ Sandbox runs require an operator API key. World ID/Self profiles, wallet intelligence, the trust-gated proxy, analytics, and webhook registration are included with Free and require an operator API key. Social Graph (Icebreaker) requires Pro. Crawler Protection traffic insights and the edge rules simulator require Pro; enforcement at your edge or in the installed runtime requires the Crawler Protection add-on ($29.99/month on top of Pro) or Enterprise. Webhook deliveries are scoped to the operator that initiated the evaluation and the selected chain. Legacy global evaluation history and platform statistics are restricted to Valiron administrators; view your own account analytics in the dashboard.
33
32
 
34
- Hosted gates, proxy forwarding, World ID enrollment and Self session creation also require a fresh registry-owner signature over the agent ID, chain, HTTP method, full destination URL and JSON body. Send `x-agent-timestamp`, `x-agent-nonce` and `x-agent-request-signature`; see the [exact signing contract](./SECURITY-UPGRADE-2026-10-31.md#hosted-wrappers-gates-and-proxy). Legacy key-registration challenges and `x-agent-session` do not authorize these routes. Trust-enabled wrappers require the same owner proof in addition to `x-agent-id`.
33
+ Hosted gates, proxy forwarding, World ID enrollment and Self session creation also require a fresh registry-owner signature over the agent ID, chain, HTTP method, full destination URL and JSON body. Send `x-agent-timestamp`, `x-agent-nonce` and `x-agent-request-signature`; see the [exact signing contract](./SECURITY-UPGRADE-2026-10-31.md#hosted-gates-and-proxy). Legacy key-registration challenges and `x-agent-session` do not authorize these routes.
35
34
 
36
35
  ## Monthly request allowance
37
36
 
38
- Free includes **10,000 metered agent requests per account per UTC calendar month**. Pro includes **100,000**. Bot protection has its own allowance of 10,000 on Free and 100,000 on Pro. Enterprise: email founders@valiron.co.
39
- Request 10,000 on Free (100,000 on Pro) is included. Active paid Pro accounts can explicitly enable additional middleware calls at 0.001 each in their subscription currency. Crawler and middleware allowances, prices and opt-ins are separate. Without an enabled agreement, subsequent calls return HTTP 429 with `code: "MONTHLY_REQUEST_LIMIT_EXCEEDED"`, `error: "upgrade_required"`, `limit`, `used`, `resetsAt` and `upgradeUrl`. Free must upgrade; Pro can enable additional calls in the dashboard or wait for the next UTC month. Crossing a limit never subscribes or opts in an account automatically. Enterprise remains available for custom terms. Feature gates, per-endpoint limits and traffic protections still apply.
37
+ Free includes **10,000 metered Agent Access requests per account per UTC calendar month**. Pro includes **100,000**. Bot protection has its own allowance of 10,000 on Free and 100,000 on Pro. Enterprise: email founders@valiron.co.
38
+ Request 10,000 on Free (100,000 on Pro) is included. Active paid Pro accounts can explicitly enable additional Agent Access calls at $0.001 each. Crawler Protection and Agent Access allowances, prices and opt-ins are separate. Without an enabled agreement, subsequent calls return HTTP 429 with `code: "MONTHLY_REQUEST_LIMIT_EXCEEDED"`, `error: "upgrade_required"`, `limit`, `used`, `resetsAt` and `upgradeUrl`. Free must upgrade; Pro can enable additional calls in the dashboard or wait for the next UTC month. Crossing a limit never subscribes or opts in an account automatically. Enterprise remains available for custom terms. Feature gates, per-endpoint limits and traffic protections still apply.
40
39
 
41
- `GET /operator/usage/billing` returns account-scoped middleware usage, allowance, additional calls and enrollment status using the dashboard session. The website's authenticated `GET /api/middleware/billing` adds the current rate; `POST /api/middleware/billing` accepts `{ "acceptedPriceId": "price_..." }` to opt in to exactly that displayed price. The crawler equivalents remain `/operator/crawlers/billing` and `/api/crawler-protection/billing`. One product's acceptance never opts in the other.
40
+ `GET /operator/usage/billing` returns account-scoped Agent Access usage, allowance, additional calls and enrollment status using the dashboard session. The website's authenticated `GET /api/middleware/billing` adds the current rate; `POST /api/middleware/billing` accepts `{ "acceptedPriceId": "price_..." }` to opt in to exactly that displayed price. The crawler equivalents remain `/operator/crawlers/billing` and `/api/crawler-protection/billing`. One product's acceptance never opts in the other.
42
41
 
43
42
  Both hosted usage responses include `used`, `included` (`null` for custom Enterprise terms), `overageRequests`, `overagesEnabled`, `needsReview`, `monthStart`, `resetsAt` and `asOf`. `charges` contains accrued request-overage estimates grouped by currency as `{ currency, amount }` entries; `amount` is a decimal string in major currency units. Empty `charges` means no accrued request overages in the current UTC month, not a zero total subscription invoice. Historical accepted terms determine these amounts; optional traffic telemetry and the currently offered rate do not. The website preserves successfully fetched usage if a current-rate lookup fails, returning `price: null` and `priceUnavailable: true`.
44
43
 
@@ -48,11 +47,9 @@ The shared account allowance counts admitted calls to:
48
47
  - `POST /operator/identity/verify`
49
48
  - `POST /operator/trigger-sandbox/:agentId` and `/operator/trigger-sandbox-key/:agentAddress`
50
49
  - `POST /proxy/:agentId` (available on Free within usage limits)
51
- - Any configured `/wrap/:operatorId/*` request, charged to the endpoint owner.
52
50
 
53
51
  Direct metered calls require `Authorization: Bearer val_op_...`. Gate/proxy agent identity requirements still apply.
54
- Wrappers resolve the account from the stored endpoint; an internal trust check
55
- is included in the wrapper request, not counted again. For hosted wrappers, payment validation, local rate checks and trust admission precede the monthly counter. Rejected payment, rate or trust requests do not consume the owner's monthly allowance. Once admitted, a wrapper request can still count if its upstream subsequently fails. Authentication and monthly-limit rejections do not count.
52
+ Authentication and monthly-limit rejections do not count.
56
53
  Summary profile/discovery reads, identity challenges, health, account management,
57
54
  checkout, and analytics are outside this allowance.
58
55
 
@@ -372,7 +369,7 @@ Execute real-time sandbox tests against an agent and compute a trust evaluation.
372
369
 
373
370
  ## POST /operator/gate/:agentId
374
371
 
375
- Trust gate — combined on-chain reputation + sandbox check. Returns an allow/deny decision. Designed for protecting payment endpoints (x402, etc.).
372
+ Trust gate — combined on-chain reputation + sandbox check. Returns an allow/deny decision. Designed for protecting expensive or sensitive endpoints.
376
373
 
377
374
  ### Parameters
378
375
 
@@ -932,87 +929,63 @@ curl -H "Authorization: Bearer $VALIRON_API_KEY" -X POST "https://valiron-edge-p
932
929
  ```
933
930
 
934
931
 
935
- ## Agent-Ready Wrapper Endpoint
932
+ ## Crawler Protection telemetry (Pro with the Protection add-on / Enterprise)
936
933
 
937
- ### ALL /wrap/:operatorId/*
934
+ `POST /operator/crawlers/telemetry` accepts bounded cumulative reports using a server-side operator API key. `GET /operator/crawlers/analytics` uses the dashboard operator session and returns only that account's rolling origin metrics, instance status, shared capacity and monitoring alerts. Neither endpoint accepts a caller-selected account. Both require a Pro account with the Crawler Protection add-on, or Enterprise, and return private, non-cacheable responses. Invalid snapshots return 400, authentication failures 401, plan/tenant failures 403, counter/cardinality conflicts 409, excessive reporting frequency 429 and unavailable storage 503. Duplicate or older sequences return `{ "accepted": false }` without adding counts. The first accepted report establishes a baseline. See [reporting setup and limits](./CRAWLER-PROTECTION.md#runtime-telemetry). The private work-admission API remains on customer infrastructure.
938
935
 
939
- Public agent-facing wrapper URL. This endpoint is created by `POST /operator/endpoints` or the **API Scaffolding → Endpoints & testing** dashboard flow.
936
+ Usage billing: website signup and a server-side operator API key are required. Free includes 10,000 requests per product per UTC month; Pro includes 100,000 per product. An active paid Pro subscriber can separately enable additional Crawler Protection or Agent Access calls at $0.001 each. Each product has its own allowance, meter and opt-in. Without opt-in, that product stops at 100,000; Free must upgrade after 10,000. Billing uses durable hosted admission counters, not optional telemetry or every local SDK function call. SDK 0.5.0 also requires account activation for returning-browser recognition.
940
937
 
941
- ```text
942
- https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
943
- ```
944
-
945
- The wrapper matches the operator ID, path, and HTTP method to an active endpoint config. It can enforce payment, optional trust checks, rate limits, SSRF protection, upstream auth injection, and request forwarding. These controls apply only to traffic sent to this wrapper URL. Protect a public upstream with `hmac` auth and reject direct, unsigned origin traffic. See [API Scaffolding](./AGENT-READY-APIS.md#recommended-production-pattern-hmac-origin-verification).
946
-
947
- #### Caller Headers
938
+ ## Crawler Protection traffic insights (Pro / Enterprise)
948
939
 
949
- | Header | Required | Description |
950
- |--------|----------|-------------|
951
- | `X-PAYMENT` | paid x402 retry | x402 payment payload returned by an x402-capable client. |
952
- | `Authorization: Payment ...` | paid MPP retry | MPP payment authorization header. |
953
- | `x-agent-id` | if trust enabled | Registry agent ID; this header alone cannot authorize the caller. |
954
- | `x-agent-timestamp` | if trust enabled | Signed timestamp in milliseconds; accepted within 60 seconds. |
955
- | `x-agent-nonce` | if trust enabled | Fresh 24–128 character URL-safe nonce; single use. |
956
- | `x-agent-request-signature` | if trust enabled | Current registry-owner signature over the v2 wallet-request payload. |
957
- | `x-chain` | explicit chain recommended | Selects the wrapper registry network; the signed chain must match. |
958
- | `x-agent-address` | not supported by hosted trust wrappers | Use SDK middleware in your own backend when you need key/address identity support. |
940
+ Passive request-log ingestion and observed-traffic analytics. These endpoints never affect customer traffic. See [Connect traffic sources](./CRAWLER-PROTECTION.md#connect-traffic-sources) for setup and data handling.
959
941
 
960
- #### Free Wrapper Response
961
-
962
- If `pricePerCall` is `0`, the wrapper forwards directly to the upstream API:
963
-
964
- ```bash
965
- curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
966
- ```
967
-
968
- #### x402 Paid Wrapper Response
969
-
970
- If `paymentProtocol` is `x402` and no valid payment is attached, the wrapper returns:
971
-
972
- ```http
973
- HTTP/1.1 402 Payment Required
974
- X-PAYMENT-RESPONSE: ...
975
- Content-Type: application/json
976
- ```
942
+ `POST /ingest/crawler/logs/:connectionId` accepts request logs for one website. Authenticate with that connection's token as `Authorization: Bearer vcl_…`, or as `X-Amz-Firehose-Access-Key` for Amazon Data Firehose. Operator API keys and dashboard sessions are not accepted, and a connection token authorizes nothing else. The body is newline-delimited records in the connection's format (`cloudflare`, `aws_waf`, `cloudfront`, `cloudfront_realtime`, `aws_alb`, `combined`, `vercel`, `valiron` or `auto`), plain or gzip, up to 16 MB (64 MB decompressed, 500,000 records). Requests with `X-Amz-Firehose-Request-Id` are read as Firehose envelopes and answered with `{ requestId, timestamp }`. Success returns `{ accepted: true, duplicate, batch }`; processing is asynchronous, and an identical payload on the same connection is accepted once. Errors: `401 authentication_required`, `400 empty_payload | invalid_gzip | invalid_firehose_payload`, `413`, `415 unsupported_encoding`, `429 too_many_batches` (over 240 deliveries per minute), `503 ingestion_unavailable`.
977
943
 
978
- The caller should retry with a valid `X-PAYMENT` header. See [AGENT-READY-APIS.md](./AGENT-READY-APIS.md#paid-x402-client) for a complete TypeScript client.
944
+ Dashboard-session endpoints (operator API keys and `vcl_` tokens return 401; another account's website returns `404 site_not_found`; responses are `private, no-store`):
979
945
 
980
- #### MPP Paid Wrapper Response
946
+ | Method | Path | Purpose |
947
+ |---|---|---|
948
+ | `GET`, `POST` | `/operator/crawlers/sites` | List websites with connection count, last delivery and stored events; add `{ hostname }` (up to 25 per account) |
949
+ | `PATCH` | `/operator/crawlers/sites/:siteId` | Set `{ excludedPaths }` (up to 20 path prefixes counted without storing the full path) |
950
+ | `DELETE` | `/operator/crawlers/sites/:siteId?confirm=<hostname>` | Remove a website from the dashboard and revoke its connections. Observed data is retained. Returns `{ removed: true, retained: true }`; `409 disable_protection_first` while Valiron rules are deployed |
951
+ | `GET`, `POST` | `/operator/crawlers/sites/:siteId/connections` | List connections; create `{ kind: "push", format }`, `{ kind: "sdk" }`, or `cloudfront_realtime` with ordered `fields`. Returns the token once with `ingestPath` |
952
+ | `DELETE` | `/operator/crawlers/connections/:connectionId` | Revoke a connection immediately |
953
+ | `POST` | `/operator/crawlers/sites/:siteId/uploads?format=auto&name=<file name>` | Upload one log file as the raw request body |
954
+ | `DELETE` | `/operator/crawlers/sites/:siteId/uploads/:uploadId` | Remove a finished upload from the dashboard and analytics; its data is retained and uploading the same file again restores it. Returns `{ removed: true, retained: true, requests }`; `409 upload_processing` while it is processing |
955
+ | `GET` | `/operator/crawlers/sites/:siteId/batches` | `uploads=1` lists up to 200 file uploads with `fileName`; otherwise the last 50 deliveries with status and record counts (stored, duplicate, unreadable, over allowance; over-allowance records are stored and flagged) |
956
+ | `GET` | `/operator/crawlers/traffic/overview` | Totals by traffic class, categories, status classes, cache, edge actions, verification states, Valiron-attributed actions, coverage and sources |
957
+ | `GET` | `/operator/crawlers/traffic/timeseries` | Requests per hour or day (`bucket=hour|day`) by traffic class |
958
+ | `GET` | `/operator/crawlers/traffic/providers` | Crawlers by provider/class and verification state, top routes and daily trend |
959
+ | `GET` | `/operator/crawlers/traffic/pages` | Top 200 routes (`audience`, `provider`, `q` filters), daily granularity |
960
+ | `GET` | `/operator/crawlers/traffic/events` | Recent requests by delivery time (`limit` 1–200, `before` cursor, `provider`, `path` prefix; `audience`, `verification` (`verified`, `claim_mismatch`, `verification_unavailable`, `unverified`), `status` (`0`–`5`, `0` = not reported) and `edge` (`none`, `allow`, `block`, `challenge`, `count`, `log`, `skip`, `other`) accept comma-separated lists) |
981
961
 
982
- If `paymentProtocol` is `mpp` and no valid payment is attached, the wrapper returns:
983
-
984
- ```http
985
- HTTP/1.1 402 Payment Required
986
- WWW-Authenticate: Payment ...
987
- Content-Type: application/json
988
- ```
989
-
990
- The caller should retry with `Authorization: Payment ...`. For command-line testing:
991
-
992
- ```bash
993
- pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
994
- ```
995
-
996
- #### Error Responses
997
-
998
- | Status | Code | Meaning |
999
- |--------|------|---------|
1000
- | 402 | `payment_required` | Paid wrapper needs valid x402 or MPP payment. |
1001
- | 403 | `trust_denied` | Trust checks are enabled and the agent did not pass. |
1002
- | 404 | `wrapper_not_found` | No active wrapper matched operator ID, path, and method. |
1003
- | 413 | `payload_too_large` | Request body exceeds wrapper limit. |
1004
- | 429 | `rate_limit_exceeded` | Caller exceeded wrapper rate limit. |
1005
- | 502 | `wrapper_request_failed` | Upstream request failed or returned an invalid response. |
1006
-
1007
- ---
962
+ Traffic endpoints take `site=<siteId>` and optional `from`/`to` (Unix milliseconds or ISO 8601; default last 24 hours, maximum about five years). Traffic classes are `verified`, `claimed_unverified`, `declared` and `unclassified`; none means human. Invalid filters return `400` with an `invalid_*` code. Free accounts receive `403 upgrade_required` with `feature: "crawler_observe"`.
1008
963
 
964
+ ## Crawler Protection edge rules and edge protection
1009
965
 
1010
- ## Crawler Protection telemetry (Free / Pro / Enterprise)
966
+ Dashboard-session endpoints with the same authentication and isolation rules. The simulator, policies and integration endpoints require Pro. Deployment additionally requires the Crawler Protection add-on (`403 protection_upgrade_required`). Status, history, actual actions, disconnecting and `disable` remain available without a plan, so enforcement can always be turned off. See [Simulator](./CRAWLER-PROTECTION.md#simulator) and [Edge protection](./CRAWLER-PROTECTION.md#edge-protection).
1011
967
 
1012
- `POST /operator/crawlers/telemetry` accepts bounded cumulative reports using a server-side operator API key. `GET /operator/crawlers/analytics` uses the dashboard operator session and returns only that account's rolling origin metrics, instance status, shared capacity and monitoring alerts. Neither endpoint accepts a caller-selected account. Both require current Free/Pro/Enterprise access and return private, non-cacheable responses. Invalid snapshots return 400, authentication failures 401, plan/tenant failures 403, counter/cardinality conflicts 409, excessive reporting frequency 429 and unavailable storage 503. Duplicate or older sequences return `{ "accepted": false }` without adding counts. The first accepted report establishes a baseline. See [reporting setup and limits](./CRAWLER-PROTECTION.md#live-dashboard-analytics). The private work-admission API remains on customer infrastructure.
968
+ | Method | Path | Purpose |
969
+ |---|---|---|
970
+ | `GET` | `/operator/crawlers/catalog` | Agent IDs, categories, verifiability, evidence availability and target limits |
971
+ | `GET`, `POST` | `/operator/crawlers/policy?site=<id>` | Latest policy and revisions; save `{ rules, note? }` as a new immutable revision (`400 invalid_policy` with `details`) |
972
+ | `POST` | `/operator/crawlers/simulations` | `{ site, policy \| policyId, target: "cloudflare" \| "aws_waf", range: "24h" \| "7d" \| "30d" \| from/to }`; returns a queued or stored simulation |
973
+ | `GET` | `/operator/crawlers/simulations?site=<id>`, `/operator/crawlers/simulations/:id` | Recent runs; one run with `result` (totals, coverage, exclusions, per-rule matches and enforceability, rate-replay qualification) |
974
+ | `GET` | `/operator/crawlers/protection/entitlement` | `{ plan, entitled, source: plan \| stripe \| complimentary, status, periodEnd }` |
975
+ | `GET` | `/operator/crawlers/edge/status?site=<id>` | Display state, provider state, entitlement, integration and permission check, policy revisions, assessments, pending/last deployment, drift |
976
+ | `GET` | `/operator/crawlers/edge/capabilities?site=<id>` | Provider capabilities and plan limits |
977
+ | `GET` | `/operator/crawlers/edge/aws-setup?site=<id>` | External ID, trust policy and least-privilege permissions policy |
978
+ | `POST`, `DELETE` | `/operator/crawlers/edge/integration?site=<id>` | Connect `{ provider: "cloudflare", zoneId, apiToken }` or `{ provider: "aws_waf", roleArn, webAclArn }` (runs the permission check); disconnect. Both require Protection off (`409 disable_protection_first`) |
979
+ | `POST` | `/operator/crawlers/edge/preflight?site=<id>` | Re-run the permission check |
980
+ | `POST` | `/operator/crawlers/edge/enable?site=<id>` | Deploy `{ policyId? }` (default latest). `409 rules_not_enforceable` lists rules with their status and reason |
981
+ | `POST` | `/operator/crawlers/edge/rollback?site=<id>` | Deploy an earlier `{ policyId }` |
982
+ | `POST` | `/operator/crawlers/edge/reapply?site=<id>` | Re-deploy the deployed revision (after drift) |
983
+ | `POST` | `/operator/crawlers/edge/disable?site=<id>` | Remove Valiron-owned rules |
984
+ | `GET` | `/operator/crawlers/edge/history?site=<id>` | Deployments with outcomes and the audit trail |
985
+ | `GET` | `/operator/crawlers/edge/actions?site=<id>&from&to` | Actual blocks and rate limits by Valiron rules, by rule/revision, route and source |
1013
986
 
1014
- Usage billing: website signup and a server-side operator API key are required. Free includes 10,000 requests per product per UTC month; Pro includes 100,000 per product. An active paid Pro subscriber can separately enable additional crawler or middleware calls at 0.001 each in the subscription billing currency, displayed before acceptance. Each product has its own allowance, meter and opt-in. Without opt-in, that product stops at 100,000; Free must upgrade after 10,000. Billing uses durable hosted admission counters, not optional telemetry or every local SDK function call. SDK 0.5.0 also requires account activation for returning-browser recognition.
987
+ Deployments run asynchronously; poll `edge/status`. Only one deployment per website runs at a time (`409 deployment_in_progress`). Credentials are never returned.
1015
988
 
1016
989
  ## Crawler managed controls (0.7.0+)
1017
990
 
1018
- `createCrawlerControlClient({ configuration, apiKey, site })` adds background policy polling; pass it as `controlClient` to `createCrawlerRuntime`. The dashboard manages crawler access and tighter request budgets within installed ceilings, with publish/rollback, runtime revision acknowledgments, optional bounded recent decision logs and opt-in alerts. It does not deploy customer infrastructure or change work concurrency. Static runtimes are unchanged. See [Dashboard controls](./CRAWLER-PROTECTION.md#dashboard-controls) for the setup, API endpoints, leases and retention limits.
991
+ `createCrawlerControlClient({ configuration, apiKey, site })` adds background policy polling; pass it as `controlClient` to `createCrawlerRuntime`. The dashboard manages crawler access and tighter request budgets within installed ceilings, with publish/rollback, runtime revision acknowledgments, optional bounded recent decision logs and opt-in alerts. It does not deploy customer infrastructure or change work concurrency. Static runtimes are unchanged. See [Dashboard controls](./CRAWLER-PROTECTION.md#managed-controls) for the setup, API endpoints, leases and retention limits.