@valiron/sdk 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +12 -0
  2. package/bin/valiron-card.mjs +211 -0
  3. package/dist/card.d.ts +565 -0
  4. package/dist/card.js +722 -0
  5. package/dist/clients.js +2 -2
  6. package/dist/edge.d.ts +87 -0
  7. package/dist/edge.js +164 -0
  8. package/dist/edgeGate.d.ts +146 -0
  9. package/dist/edgeGate.js +230 -0
  10. package/dist/edgeGateVerify.d.ts +146 -0
  11. package/dist/edgeGateVerify.js +243 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/middleware.d.ts +2 -0
  15. package/dist/middleware.js +6 -3
  16. package/dist/operatorSdk.d.ts +8 -0
  17. package/dist/operatorSdk.js +8 -0
  18. package/docs/API-REFERENCE.md +59 -80
  19. package/docs/CLOUDFLARE-GATE-MIDDLEWARE.md +196 -0
  20. package/docs/CRAWLER-PROTECTION.md +509 -25
  21. package/docs/DASHBOARD.md +72 -214
  22. package/docs/E2E-MIDDLEWARE-INTEGRATION.md +9 -46
  23. package/docs/ERRORS.md +3 -11
  24. package/docs/PROVIDER-IDENTITY.md +1 -1
  25. package/docs/QUICKSTART.md +7 -22
  26. package/docs/README.md +10 -9
  27. package/docs/SDK-REFERENCE.md +51 -7
  28. package/docs/SECURITY-UPGRADE-2026-10-31.md +3 -3
  29. package/docs/llms.txt +19 -14
  30. package/examples/cloudflare-gate-worker/README.md +198 -0
  31. package/examples/cloudflare-gate-worker/package.json +20 -0
  32. package/examples/cloudflare-gate-worker/worker.ts +309 -0
  33. package/examples/cloudflare-gate-worker/wrangler.toml +46 -0
  34. package/examples/cloudflare-worker/package.json +8 -0
  35. package/examples/cloudflare-worker/worker.ts +495 -0
  36. package/examples/cloudflare-worker/wrangler.toml +57 -0
  37. package/package.json +34 -4
  38. package/docs/AGENT-READY-APIS.md +0 -294
package/docs/DASHBOARD.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  > **Request verification:** Examples using `verifyAgentRequest` assume an application-owned verifier imported from your own module, not an SDK export. It must verify a fresh signature against the claimed identity, bind method, full URL and body, and atomically reject replayed nonces. See the [request-proof upgrade guide](https://www.valiron.co/docs/agents/SECURITY-UPGRADE-2026-10-31.md). Missing or invalid proofs return 401 before profile-cache lookup.
4
4
 
5
- Social Graph (Icebreaker) is a Pro feature. Bot protection is included with Free. All other capabilities are included with Free: 10,000 agent requests/month and 10,000 bot protection requests/month, 3 registered endpoints, and 5 sandbox runs/day. Pro includes 100,000 requests per product/month. Enterprise: email founders@valiron.co. Operator authentication and tenant isolation apply on every plan.
5
+ Each product includes 10,000 requests a month on Free and 100,000 on Pro ($149/month), then $0.001 per additional request once enabled. Social Graph (Icebreaker) is Pro only. Crawler Protection traffic insights and the edge rules simulator are included with Pro; Crawler Protection enforcement (Cloudflare, AWS WAF, and the SDK/gateway runtime) is a $29.99/month add-on to Pro. Everything else in Agent Access is included with Free, with 5 sandbox runs/day. Enterprise: email founders@valiron.co. Operator authentication and tenant isolation apply on every plan.
6
6
 
7
- > Manage your Valiron integration from a single web interface — register endpoints, monitor agent activity, test trust evaluations, and view analytics.
7
+ > Manage your Valiron integration from one place: set up trust checks, watch agent activity and crawler traffic, and manage keys, usage and billing.
8
8
 
9
9
  **Dashboard URL:** [https://www.valiron.co/dashboard](https://www.valiron.co/dashboard)
10
10
 
@@ -17,16 +17,9 @@ To create an account:
17
17
  1. Go to [valiron.co/dashboard](https://www.valiron.co/dashboard) and click **Create account**
18
18
  2. Enter your name, email, and password, or continue with Google or GitHub
19
19
  3. On success, you'll see a **one-time API key** — copy it immediately (it won't be shown again)
20
- 4. Complete the same guided setup for every sign-up method: Account, Signals, Policy, Endpoint, Install, Deploy, and Finish
20
+ 4. On **Agent Access → Overview**, choose how agents identify themselves and which trust checks your API needs, then use **Give this to your coding agent** to copy a complete setup prompt. The setup assistant above it (**How can I help you set this up?**) answers setup questions in plain language, or choose **Configure manually**.
21
21
 
22
- Onboarding completion is stored on the operator account, so an unfinished setup
23
- resumes after email, Google, or GitHub login and on another browser. If the
24
- original one-time key is no longer available, the wizard can generate a
25
- dedicated setup key. Existing operators are not forced back through onboarding.
26
-
27
- The Signals step supports registered ERC-8004/Solana agents, persistent
28
- key-based agents, and ANS or other provider-backed identities. ANS is an agent
29
- identity option; it is not required to create a Valiron operator account.
22
+ Setup supports registered ERC-8004/Solana agents, persistent key-based agents, and ANS or other provider-backed identities. ANS is an agent identity option; it is not required to create a Valiron operator account. Once agents call your API, the Overview shows their recent activity first, with setup one click away under **Change your setup**.
30
23
 
31
24
  After registration, sign in with your email and password, Google, or GitHub.
32
25
  Sign in on the website to manage your account. Keep the operator API key in your backend environment.
@@ -37,44 +30,76 @@ Sign in on the website to manage your account. Keep the operator API key in your
37
30
 
38
31
  **Route:** `/dashboard`
39
32
 
40
- The dashboard uses the same three product sections as the documentation. Choose a product from the **Product** switcher; its navigation appears underneath:
33
+ The dashboard uses the same two product sections as the documentation. Choose a product from the **Product** switcher; its navigation appears underneath:
34
+
35
+ - **Agent Access**: Overview, Agents, Analytics and Call logs.
36
+ - **Crawler Protection**:
37
+ - **Traffic**: one page with **Overview**, **Live**, **Bots & crawlers**, **Pages & routes** and **Log sources** tabs. These are read-only traffic insights from your request logs; see [How traffic insights work](./CRAWLER-PROTECTION.md#how-traffic-insights-work).
38
+ - **Edge rules**: **Simulator** and **Edge protection** at Cloudflare or AWS WAF.
39
+ - **Self-hosted**: **Setup** (`/dashboard/crawler-protection/setup`) for the gateway or SDK. **Controls**, **Decision logs** and **Alerts** appear once a runtime has reported.
41
40
 
42
- - **Agent Access**: Overview & setup, Agents, Analytics, Call logs and Playground. `/dashboard` retains the identity/trust integration setup and saved endpoint onboarding.
43
- - **Crawler Protection**: Traffic & analytics and Setup & configuration (`/dashboard/crawler-protection/setup`). Traffic & analytics stays open even when no runtime has reported. Its empty state links to setup; selecting a tab, refreshing or reloading analytics never redirects to configuration. Ordinary crawlers do not need to register as agents. This product is included on Free, Pro and Enterprise.
44
- - **API Scaffolding**: Overview (`/dashboard/api-scaffolding`) and Endpoints & testing (`/dashboard/wrappers`). Configure upstream routes, payments, optional trust checks and tests in the existing endpoint screen. `/dashboard/endpoints` remains supported and selects the same product.
41
+ Traffic insights, the simulator and Setup require Pro; enforcement requires the Crawler Protection add-on ($29.99/month on top of Pro) or Enterprise. Free accounts see an upgrade prompt. Ordinary crawlers do not need to register as agents.
45
42
 
46
- **API Keys**, **Settings & billing**, and role-restricted **Administration** remain shared account tools. On mobile, use the product switcher and horizontally scrollable product tabs; expand **Account tools** for shared pages. Opening a shared page retains the last selected product during navigation. Direct product URLs select their corresponding product, including after a reload. Existing Agent Access and shared-account URLs are unchanged. API analytics remains account-scoped; crawler analytics uses its separate origin telemetry.
43
+ **Usage**, **API Keys**, **Settings & billing**, and role-restricted **Administration** are shared account tools. The sidebar also shows a small meter of this month's requests for the selected product, linking to Usage. On mobile, use the product switcher and the scrollable tabs, and expand **Account tools** for shared pages. Opening a shared page keeps the last selected product, and direct product URLs select their product, including after a reload. Each page has its own browser tab title.
47
44
 
48
45
  ---
49
46
 
50
- ## Valiron Crawler Protection (Free, Pro, Enterprise)
47
+ **Account → Usage** (`/dashboard/usage`) shows both products together: admitted requests this UTC month, included and remaining allowance, additional calls, estimated request-overage charges grouped by currency, allowance reset date and enrollment/review status. Each product has its own opt-in. Counts refresh every 15 seconds while the page is visible; **Refresh** checks immediately. A failed refresh preserves the last successful counts and marks them out of date. An initial outage shows unavailable usage, never a fabricated zero. Request-overage estimates exclude the Pro subscription, taxes and billing adjustments; final invoice rounding can differ.
48
+
49
+ Paid Pro owners can enable additional calls for each product separately on the Usage page, at $0.001 per request after 100,000. Checkout offers separate unchecked opt-in controls. Without opt-in, requests stop at the included allowance.
50
+
51
+ ## Valiron Crawler Protection (Pro, Enterprise; Protection add-on)
51
52
 
52
53
  **Route:** `/dashboard/crawler-protection`
53
54
 
54
- Free accounts can review the feature and follow the upgrade link. Pro and Enterprise accounts can:
55
+ ### Traffic insights
56
+
57
+ Pro and Enterprise accounts can see automated traffic without installing anything. On **Traffic → Log sources** (`/dashboard/crawler-protection/sources`), add a website hostname and choose a source: Cloudflare Logpush, AWS WAF or CloudFront real-time logs through Firehose, Vercel Drains, file uploads (CloudFront, ALB, nginx/Apache/Caddy, Vercel, Cloudflare, WAF or Valiron NDJSON), any log shipper, or the passive SDK request log. Continuous connections show their `vcl_` token once; revoking a connection stops it immediately. **Recent deliveries** lists stored, duplicate, unreadable and over-allowance records for each delivery. Drag and drop log files or choose them; **Uploaded files** lists each upload, shows its requests, and can remove it from analytics (the data is retained). **Remove this website** hides a website and revokes its connections; its observed data is retained.
58
+
59
+ **Traffic → Overview** then shows observed requests split into Verified crawlers, Claimed but not verified, Other declared automation and Unclassified, a stacked request chart, top crawlers and routes, response status, edge cache results, edge actions and coverage. One status line shows whether logs are arriving, the number of sources, the last delivery and the provider-confirmed edge protection state, with **Enable protection** when it is off. The chart shows a per-class breakdown on hover, and **Verified crawlers by source** sits beside it. **Live** is a near-live feed of delivered requests with filter chips (traffic class, verification, status, edge action), a path filter and a request detail panel. **Bots & crawlers** shows requests by verification state per crawler. **Pages & routes** lists the top 200 normalized routes per traffic class with CSV export. Unclassified traffic is never labeled human. Traffic insights never block, challenge or rate-limit requests. If a self-hosted runtime has reported, its analytics appear below the overview as **Runtime telemetry**. Full details: [Connect traffic sources](./CRAWLER-PROTECTION.md#connect-traffic-sources) and [Traffic dashboard](./CRAWLER-PROTECTION.md#traffic-dashboard).
60
+
61
+ ### Data retention
62
+
63
+ Crawler Protection data is retained permanently: observed requests and summaries, policies and revisions, simulations, edge deployments, the protection audit trail, runtime decision logs, control revisions and admin change history. It is kept when a customer changes plans, removes the add-on, removes a website or closes the account. Raw uploaded payloads are deleted after parsing; only normalized metadata is kept (see [Data handling and retention](./CRAWLER-PROTECTION.md#data-handling-and-retention)).
64
+
65
+ ### Administrator view
55
66
 
56
- 1. Open **Setup & configuration**, use **Copy prompt** to hand setup to a coding agent, copy the install command, and create a server-side operator API key. An optional install checkbox is a self-reported acknowledgment, stored per account in this browser; it does not verify installation or subscription activation.
57
- 2. Paste schema-v1 route/limit configuration and an optional measured capacity baseline. **Load example** fills a compiler-valid observation-mode sample for `/products/**`, with illustrative limits and one-hour expiry. Replace all limits and inventory before deployment; it is not a capacity recommendation.
67
+ Valiron administrators see **Crawler Protection customers** on **Administration** (`/dashboard/admin`): every account with a website, its plan, active and removed websites, observed requests, last delivery, protected websites and add-on source. **Open** goes to the customer's workspace (`/dashboard/admin/<id>/crawler-protection`), which has its own tabs in the same groups as the customer's sidebar: read-only **Traffic** (Overview, Live, Bots & crawlers, Pages & routes, Log sources), **Edge rules** (Simulator, Edge protection), **Self-hosted** (Analytics, Controls, Decision logs, Alerts, Configuration) and **Account** (Usage, Admin activity). The administrator's own product menu is hidden there. Removed websites stay selectable and are marked as removed. Traffic insights and edge protection are read-only for administrators; runtime control changes still require a reason and are recorded.
68
+
69
+ ### Edge rules
70
+
71
+ **Simulator** (`/dashboard/crawler-protection/simulator`) edits edge rules (start from a template, or choose who, paths, methods, and block or rate limit), saves them as revisions and replays them against observed traffic for the last 24 hours, 7 or 30 days. Results show observed, evaluated, excluded and unknown requests, simulated rule matches, estimated rate-limited requests, per-rule enforceability at Cloudflare or AWS WAF, and **Your website traffic has not changed.**
72
+
73
+ **Edge protection** (`/dashboard/crawler-protection/protection`) has four steps: add the Crawler Protection add-on ($29.99/month, prorated on the Pro subscription); connect Cloudflare (zone ID and API token) or AWS WAF (IAM role with Valiron's external ID, and web ACL ARN) and pass the permission check; review the edge rules' enforceability; then use the **Protection** switch. The switch shows on only after the provider confirms the rules, and turning off asks for confirmation. The page also shows actual enforcement by Valiron rules, drift or failure alerts with **Re-apply**, and deployment history with rollback to earlier revisions. See [Edge protection](./CRAWLER-PROTECTION.md#edge-protection).
74
+
75
+ ### Self-hosted setup
76
+
77
+ Pro and Enterprise accounts can:
78
+
79
+ 1. Open **Self-hosted → Setup**, use **Copy prompt** to hand setup to a coding agent, copy the install command, and create a server-side operator API key. An optional install checkbox is a self-reported acknowledgment, stored per account in this browser; it does not verify installation or subscription activation.
80
+ 2. Paste schema-v1 route/limit configuration and an optional measured capacity baseline. **Load example** fills a compiler-valid dry-run sample for `/products/**`, with illustrative limits and one-hour expiry. Replace all limits and inventory before deployment; it is not a capacity recommendation.
58
81
  3. Validate against the real configuration compiler and inspect rollout blockers.
59
82
  4. Download account-scoped configuration for their own deployment, then follow the runtime environment and optional Node telemetry examples. Setup progress shows inputs validated during this visit and a runtime connection only while fresh telemetry is reporting. Editing either input clears the validation result. Select the intended reporting site in the analytics panel. If its configuration differs from the currently validated file, setup shows a mismatch and the runtime check stays incomplete. The three checks do not certify a production deployment. Setup uses a compact checklist progress bar. The optional measured baseline, deployment guidance and detailed explanations expand on demand; primary actions and validation blockers remain visible.
60
83
 
61
- The server rechecks the authenticated plan on every validation. Invalid configuration, expired sessions or unavailable account lookup never grant access. Configuration is not persisted or activated by this screen. No runtime credentials are entered and no direct Redis/DB connection is made. The default **Traffic & analytics** view uses optional server-side telemetry: site/provider/route/actual-decision filters, provider totals with verification counts, plain-language allowed/limited/blocked/unavailable reasons, actual versus proposed decisions, rolling 24-hour traffic, shared work capacity, instance/configuration status, monitoring alerts and JSON export. Provider rows can be clicked to filter; Clear filters resets the view. The hourly chart remains site-wide, and JSON export includes all sites and filters. Raw metric series and reporting instances are under Advanced diagnostics. Capacity meters show reserved slots per work pool, not database utilization. Metric definitions are available under **How to read these metrics**; stale/unavailable state and observation proposals remain visible. Telemetry refreshes every 30 seconds; empty, stale and unavailable states are explicit. Analytics export is disabled until a site has reported. Setup includes the same analytics panel below the steps; a connected account can open the separate analytics view. Monitoring alerts are displayed in the dashboard; outbound notifications and remote policy activation are not included. The website behind the gateway can use another backend language or frontend framework. For database-level limits, integrate the private work API around each operation; the gateway alone bounds origin HTTP work. The package includes a Python client. SQLite and MariaDB are tested; other drivers require settlement/cancellation validation. Deploy and test the customer-side gateway/runtime before enabling useful crawlers. See [Valiron Crawler Protection](./CRAWLER-PROTECTION.md).
84
+ SDK 0.6.0 configurations can include `crawlerAccessDefault` and `unverifiedAccess` plus route-specific crawler class allowances. The validator accepts these options; the developer must deploy and activate the base configuration in the customer runtime. Analytics filters change the view only: they do not create allow/block rules. With managed controls enabled in 0.7.0+, Self-hosted → Controls can publish access changes and tighter request budgets within installed ceilings. See [selected AI services](./CRAWLER-PROTECTION.md#allow-selected-ai-services) before applying strict defaults to public pages; unidentified traffic includes anonymous shoppers.
85
+
86
+ The server rechecks the authenticated plan on every validation. Invalid configuration, expired sessions or unavailable account lookup never grant access. Configuration is not persisted or activated by this screen. No runtime credentials are entered and no direct Redis/DB connection is made. The **Runtime telemetry** panel (on Setup, and on the Traffic overview once a runtime reports) uses optional server-side telemetry: site/provider/route/actual-decision filters, provider totals with verification counts, plain-language allowed/limited/blocked/unavailable reasons, actual versus proposed decisions, rolling 24-hour traffic, shared work capacity, instance/configuration status, monitoring alerts and JSON export. Provider rows can be clicked to filter; Clear filters resets the view. The hourly chart remains site-wide, and JSON export includes all sites and filters. Raw metric series and reporting instances are under Advanced diagnostics. Capacity meters show reserved slots per work pool, not database utilization. Metric definitions are available under **How to read these metrics**; stale/unavailable state and observation proposals remain visible. Telemetry refreshes every 30 seconds; empty, stale and unavailable states are explicit. Analytics export is disabled until a site has reported. Setup includes the same analytics panel below the steps; a connected account can open the separate analytics view. Monitoring alerts remain visible here. SDK/gateway 0.7.0+ managed integrations add **Controls**, bounded **Decision logs** and opt-in email/webhook **Alerts** under **Self-hosted**; see [Managed controls](./CRAWLER-PROTECTION.md#managed-controls). Controls also offers a read-only source-rule preview against the bounded recent log sample and expandable integration-health diagnostics for runtime freshness, policy acknowledgment and dropped logs. Preview compares rules and modes, not actual rate/work outcomes or savings; unverified records may include people. Expand log reasons for explanations and investigation guidance. Static integrations retain developer-deployed configuration until managed controls are explicitly connected. The website behind the gateway can use another backend language or frontend framework. For database-level limits, integrate the private work API around each operation; the gateway alone bounds origin HTTP work. The package includes a Python client. SQLite and MariaDB are tested; other drivers require settlement/cancellation validation. Deploy and test the customer-side gateway/runtime before enabling useful crawlers. See [Valiron Crawler Protection](./CRAWLER-PROTECTION.md).
62
87
 
63
88
  ## Agents
64
89
 
65
90
  **Route:** `/dashboard/agents`
66
91
 
67
- View every AI agent that has called your API, sorted by last seen, call volume, spend, or error count.
92
+ View every AI agent that has called your API, sorted by last seen, call volume or error count.
68
93
 
69
94
  Each agent card shows:
70
95
  - Agent ID (ERC-8004 token ID)
71
96
  - Chain badges (multi-chain support)
72
- - Last seen, total calls, total spent, avg latency, error count
97
+ - Last seen, total calls, avg latency and error count
73
98
 
74
99
  **Click an agent** to drill into:
75
100
  - Predictive risk — forecasted next score, pass probability, trend, confidence, recommended policy, suggested tests, and plain-English reasons
76
101
  - Summary stats and first/last seen dates
77
- - Endpoint breakdown table — which of your endpoints they called, how many times, spend, avg latency, errors
102
+ - Endpoint breakdown table — which of your endpoints they called, how many times, avg latency and errors
78
103
  - Recent call log for that agent
79
104
 
80
105
  Predictive risk is computed from recent sandbox evaluations, behavioral fingerprints, and your operator call logs. It does not replace the trust gate. Low-confidence forecasts mean Valiron has sparse evidence and should usually trigger another sandbox run before broadening production access.
@@ -85,12 +110,13 @@ Predictive risk is computed from recent sandbox evaluations, behavioral fingerpr
85
110
 
86
111
  **Route:** `/dashboard/analytics`
87
112
 
88
- Revenue and usage analytics with time-range filtering.
113
+ Agent calls, trust decisions and endpoint health, for the last 7, 30 or 90 days.
89
114
 
90
- - **Stats grid** — Total Revenue, Total Calls, Unique Agents, Avg Latency
91
- - **Today's stats** — Calls Today, Revenue Today, Error Rate (highlighted if > 5%)
92
- - **Daily Revenue chart** — Bar chart with tooltips (7 / 30 / 90 day range selector)
93
- - **Top Endpoints** — Ranked by call volume with revenue, avg latency, and unique agent count
115
+ - **Stats** — Total calls, unique agents, average latency, error rate (highlighted above 5%) and calls today
116
+ - **Trust decisions** — What Valiron decided at the protected action, by identity type
117
+ - **Endpoint health and failure codes** — Success rate and latency per endpoint, and the most common failure codes
118
+ - **Recent incidents** — Failed, blocked or degraded requests with request IDs
119
+ - **Top endpoints** — Ranked by call volume with average latency and unique agents
94
120
 
95
121
  ---
96
122
 
@@ -98,7 +124,7 @@ Revenue and usage analytics with time-range filtering.
98
124
 
99
125
  **Route:** `/dashboard/logs`
100
126
 
101
- Paginated log of every API call made through your Valiron-gated endpoints.
127
+ Paginated log of every API call that reached a route protected by Valiron.
102
128
 
103
129
  Each row shows:
104
130
  - Timestamp
@@ -106,8 +132,8 @@ Each row shows:
106
132
  - Chain badge
107
133
  - Endpoint (method + path)
108
134
  - Status code (color-coded: green for 2xx, yellow for 4xx, red for 5xx)
109
- - Cost charged
110
135
  - Latency
136
+ - Outcome (the recorded decision or error)
111
137
  - Session ID
112
138
 
113
139
  **Filters:**
@@ -130,158 +156,6 @@ Each key shows its prefix, label, last used date, and creation date.
130
156
 
131
157
  ---
132
158
 
133
- ## Make API Agent-Ready
134
-
135
- **Route:** `/dashboard/wrappers` (legacy `/dashboard/endpoints` remains supported)
136
-
137
- Create hosted Valiron wrappers for existing HTTP APIs. A wrapper provides a public agent-facing URL, handles optional x402/MPP payment challenges, optionally checks Valiron trust, applies rate limits, forwards to the upstream API, and records call logs.
138
-
139
- This product is appropriate when an API must be callable by autonomous agents without requiring immediate SDK integration in the provider backend.
140
-
141
- ### Hosted wrapper flow
142
-
143
- 1. Open **API Scaffolding → Endpoints & testing**.
144
- 2. Click **Make API Agent-Ready**.
145
- 3. Enter your upstream API details and payment settings.
146
- 4. Configure upstream authentication to protect your origin.
147
- 5. Save the wrapper.
148
- 6. Distribute only the generated wrapper URL to agent clients:
149
-
150
- ```text
151
- https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
152
- ```
153
-
154
- When an agent calls the wrapper:
155
-
156
- 1. Valiron matches `{operatorId}`, path, and method to your wrapper config.
157
- 2. If `pricePerCall` is greater than `0`, Valiron returns a `402 Payment Required` challenge unless valid payment is attached.
158
- 3. If trust checks are enabled, Valiron evaluates the agent identity headers.
159
- 4. Valiron appends the wrapper path to `targetUrl`, forwards the request, and adds Valiron metadata headers.
160
- 5. Valiron returns the upstream response and records analytics.
161
-
162
- > **Origin protection is required for a public upstream.** Valiron can enforce
163
- > payment, trust, rate limits, and logging only for calls made to the wrapper
164
- > URL. A call sent directly to your upstream does not pass through Valiron. Use
165
- > HMAC upstream auth and reject missing or invalid signatures at your origin;
166
- > do not rely on the presence of `x-valiron-*` metadata headers.
167
-
168
- ### Wrapper fields
169
-
170
- | Field | Required | Description |
171
- |-------|----------|-------------|
172
- | Public path | Yes | Agent-facing path (for example `/weather`). This becomes `/wrap/{operatorId}/weather`. |
173
- | Method | Yes | HTTP method: GET, POST, PUT, PATCH, DELETE |
174
- | Upstream API base URL | Yes | Existing API base URL, for example `https://api.example.com`. Must be HTTPS in production. Private/internal addresses are blocked. |
175
- | Price per call (USD) | Yes | `0` for free wrappers, or a positive USD amount for paid wrappers. |
176
- | Payment protocol | Yes | `x402` or `mpp`. `x402` is used by default and for free wrappers. |
177
- | Payment network | No | Network for paid wrappers. Common values: `eip155:8453` for Base x402 and `tempo:4217` for MPP. |
178
- | Payout wallet | No | Required for paid x402 wrappers unless a platform default receiving address is configured. |
179
- | Require Valiron trust | No | When enabled, callers must provide agent identity headers and pass the trust threshold. |
180
- | Rate limit (req/min) | No | Max requests per minute per agent (null = unlimited) |
181
- | Upstream auth | Required for a public origin | `hmac` recommended. Your origin verifies the signature and timestamp before serving the request. |
182
- | Description | No | What this endpoint does |
183
-
184
- **Removing a wrapper** performs a soft-delete. The wrapper stops matching new calls but historical logs remain available.
185
-
186
- ### Free wrapper example
187
-
188
- ```text
189
- Public path: /status
190
- Method: GET
191
- Upstream API base URL: https://api.example.com
192
- Price: 0
193
- ```
194
-
195
- Agents call:
196
-
197
- ```bash
198
- curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
199
- ```
200
-
201
- ### Paid x402 wrapper example
202
-
203
- ```text
204
- Public path: /weather
205
- Method: GET
206
- Upstream API base URL: https://api.example.com
207
- Price: 0.001
208
- Payment protocol: x402
209
- Payment network: eip155:8453
210
- Payout wallet: 0x...
211
- ```
212
-
213
- Agents call the wrapper once, receive a `402` with an x402 payment challenge, then retry with a valid `X-PAYMENT` header.
214
-
215
- ### Paid MPP wrapper example
216
-
217
- ```text
218
- Public path: /research
219
- Method: GET
220
- Upstream API base URL: https://api.example.com
221
- Price: 0.001
222
- Payment protocol: mpp
223
- Payment network: tempo:4217
224
- ```
225
-
226
- Agents call the wrapper once, receive `WWW-Authenticate: Payment`, then retry with `Authorization: Payment ...`. For command-line testing, use `mppx`:
227
-
228
- ```bash
229
- pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
230
- ```
231
-
232
- For the complete setup guide, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
233
-
234
- ---
235
-
236
- ## API Playground
237
-
238
- **Route:** `/dashboard/playground`
239
-
240
- Test how Valiron evaluates different AI agents against your endpoints — without writing any code or sending real traffic.
241
-
242
- ### How it works
243
-
244
- 1. **Pick a chain** — All supported chains are available (Ethereum, Monad, Arbitrum, Base, Avalanche, Polygon, Optimism, Solana, testnets, and more). Chains with pre-registered sample agents show agent cards; other chains require a custom agent ID.
245
- 2. **Select an agent** — Choose from pre-registered sample agents at different trust levels, or enter a custom agent ID:
246
- - **Good agents** (score 80–95, tier A/AA) — would be routed to production
247
- - **Bad agents** (score 30–45, tier CA/CAA) — would be routed to sandbox
248
- - **Zero agents** (score 0, tier C) — no reputation, requires behavioral testing
249
- 3. **Build the request** — Pick a method and enter a path. Headers (`Content-Type`, `X-Agent-Id`, `X-Valiron-Chain`, `X-Api-Key`) are added automatically. Expand **Advanced options** to add custom headers, query params, or a request body
250
- 4. **Send** — The playground evaluates the agent's on-chain trust profile and shows the result
251
-
252
- ### Dry-run mode
253
-
254
- Toggle **Dry Run** on to see the trust evaluation without logging the call:
255
- - Resolved tier (AAA–C)
256
- - Routing decision (prod / sandbox / blocked)
257
- - Price per call (from your registered endpoint)
258
- - On-chain reputation score and feedback count
259
-
260
- ### Standard mode
261
-
262
- With dry-run off, the playground performs the full trust evaluation and logs the call to your Analytics/Logs pages.
263
-
264
- - **If your endpoint has an upstream base URL** — the playground forwards the request to your backend with Valiron headers (`X-Agent-Id`, `X-Valiron-Chain`, `X-Valiron-Tier`, `X-Valiron-Route`). You'll see the real HTTP response from your server.
265
- - **If no upstream base URL is set** — the playground returns the trust evaluation only (tier, route, cost, on-chain score).
266
-
267
- > **Tip:** Add an upstream base URL to your wrapper to enable end-to-end testing in the playground.
268
-
269
- ### Response panel
270
-
271
- Every request shows:
272
- - **Status code** — Color-coded (green 2xx, yellow 3xx/4xx, red 5xx)
273
- - **Latency** — Round-trip time in ms
274
- - **Route** — Where the agent would be routed (prod, sandbox, blocked)
275
- - **Cost** — Per-call price from your endpoint registration
276
- - **Tier** — The agent's resolved trust tier
277
- - **Body** — Trust evaluation details
278
-
279
- ### History
280
-
281
- The sidebar shows up to 20 recent requests from the current page session. Each entry shows method, path, agent, status, latency, and timestamp. Click an entry to repopulate the request form; history is not persisted across sessions.
282
-
283
- ---
284
-
285
159
  ## Settings
286
160
 
287
161
  **Route:** `/dashboard/settings`
@@ -290,14 +164,14 @@ Manage your operator profile.
290
164
 
291
165
  - **Name** — Editable display name
292
166
  - **Email** — Read-only (set during registration)
293
- - **Plan** — Your current plan and fee rate
167
+ - **Plan** — Your current plan, with **Manage billing** (Pro) or **Upgrade**
294
168
  - **Account info** — Operator ID and account creation date
295
169
 
296
170
  ---
297
171
 
298
172
  ## Middleware Integration
299
173
 
300
- Valiron's core product is SDK middleware deployed within the API backend. Use this path when trust checks, route decisions, sandbox triggers, payment gating, and usage tracking must execute before the API handler.
174
+ Valiron's core product is SDK middleware deployed within the API backend. Use this path when trust checks, route decisions and sandbox triggers must run before the API handler.
301
175
 
302
176
  Install the SDK and add it to your backend:
303
177
 
@@ -308,10 +182,10 @@ npm install @valiron/sdk
308
182
  **Express middleware:**
309
183
 
310
184
  ```typescript
311
- import { ValironOperator } from "@valiron/sdk";
185
+ import { ValironSDK, createValironGate } from "@valiron/sdk";
312
186
 
313
- const operator = new ValironOperator({ apiKey: "val_op_xxxx" });
314
- app.use("/api/weather", operator.paywall({ verifyRequest: verifyAgentRequest, pricePerCall: 0.05 }));
187
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
188
+ app.use("/api/weather", createValironGate({ verifyRequest: verifyAgentRequest, sdk: valiron, minScore: 85 }));
315
189
  ```
316
190
 
317
191
  **Manual gating:**
@@ -334,40 +208,24 @@ app.use("/api/weather", async (req, res, next) => {
334
208
  });
335
209
  ```
336
210
 
337
- ### Test with the Playground
338
-
339
- Before going live, use the Playground to verify:
340
- - That your endpoint pricing and rate limits are configured correctly
341
- - That high-reputation agents get routed to production
342
- - That low/zero-reputation agents get sandboxed or blocked
343
- - What the full request/response cycle looks like with real latency numbers
344
-
345
211
  ### Monitor
346
212
 
347
- Use the dashboard to track agent activity, review call logs, and monitor revenue.
348
-
349
- ## Separate Product: API Scaffolding
213
+ Use the dashboard to track agent activity, review call logs and watch trust decisions.
350
214
 
351
- API Scaffolding is a separate product that provides a hosted, agent-facing wrapper URL for an existing HTTPS API. A hosted wrapper can collect x402/MPP payment, apply optional trust checks, enforce rate limits, forward upstream, and log usage.
215
+ Crawler SDK 0.3.0+ setup requires signup and an operator API key from Dashboard → API Keys. Store `VALIRON_API_KEY` server-side and use the tenant from your exported configuration. The SDK checks its account lease at startup and refreshes in the background; the dashboard does not deploy the runtime or activate Redis policy.
352
216
 
353
- 1. Create your account on the dashboard.
354
- 2. Copy your API key from the Keys page.
355
- 3. Create a wrapper from **API Scaffolding → Endpoints & testing**.
356
- 4. Test the generated `/wrap/{operatorId}/{path}` URL.
357
- 5. Monitor calls in Analytics and Logs.
217
+ ## Security behavior for account owners
358
218
 
359
- For hosted wrappers, also verify that a direct request to the upstream origin
360
- returns `401` or `403`, while a wrapper request is visible in call logs. See
361
- [API Scaffolding origin protection](./AGENT-READY-APIS.md#origin-lockdown-checklist).
219
+ Password reset links are rate-limited and single use. A successful reset revokes existing API keys and operator sessions; sign in again and replace affected integration keys. Billing checkout and portal access are bound to the authenticated operator account; checkout email and caller-supplied promo strings cannot select another account or grant a discount. Promotion eligibility is handled by Stripe checkout.
362
220
 
363
- For deployments requiring full backend control, protect the API directly with Valiron middleware using `createValironGate()` or `ValironOperator.paywall()`.
221
+ SDK diagnostic telemetry has its own `telemetry` configuration. Assessment PDF exports use saved server-side report results rather than client-submitted grades; older assessments without a stored report must be rerun.
364
222
 
365
- For full hosted wrapper docs, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
223
+ 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.
366
224
 
367
- SDK 0.2.0+ setup requires signup and an operator API key from Dashboard → API Keys. Store `VALIRON_API_KEY` server-side and use the tenant from your exported configuration. The SDK checks its account lease at startup and refreshes in the background; the dashboard does not deploy the runtime or activate Redis policy.
225
+ ## Admin customer Crawler Protection workspace
368
226
 
369
- ## Security behavior for account owners
227
+ Authorized platform admins can open **Administration → customer account → Manage customer Crawler Protection**. This customer-scoped workspace reuses the customer analytics, controls, decision logs, alerts and usage views. It also exposes the runtime-reported installed configuration and a paginated admin change history with export of loaded activity. Audit pages contain at most five complete records so installation snapshots stay within response limits. The customer name, plan and admin context remain visible. Switching customers clears local drafts and filters; requests use the admin's own session, without customer impersonation or customer API keys.
370
228
 
371
- Password reset links are rate-limited and single use. A successful reset revokes existing API keys and operator sessions; sign in again and replace affected integration keys. Billing checkout and portal access are bound to the authenticated operator account; checkout email and caller-supplied promo strings cannot select another account or grant a discount. Promotion eligibility is handled by Stripe checkout.
229
+ Admins can publish access/rate changes, restore revisions, adopt a validated replacement installation, toggle recent decision logging and update notification settings within the same installed safety ceilings as customers. Each write requires a 10–500 character reason. The server rechecks the current admin role, and the transaction checks it again before recording actor, customer, site, action, reason and before/after state. Audit failure rolls back the change. Customer revision history labels admin changes **Valiron support** without exposing the admin identity or reason. Admin audit history retains 90 days, with webhook paths/query credentials omitted; account deletion removes that account's audit records. Installation replacement records the before/after installed configuration.
372
230
 
373
- Operator SDK usage reporting is disabled by default. Enable `analytics: true` deliberately if dashboard call reports are needed; raw IP addresses, user agents and endpoint paths are not transmitted. SDK diagnostic telemetry has its own `telemetry` configuration. Assessment PDF exports use saved server-side report results rather than client-submitted grades; older assessments without a stored report must be rerun.
231
+ Admin reads/writes use the authenticated `/operator/admin/crawlers/:operatorId` routes, with separate analytics, control, configuration, usage and audit resources. Normal customers and operator API keys cannot use these routes. Stored installed configuration is visible; unsaved browser drafts, browser-only baseline measurements, raw API-key secrets and passwords are not recoverable from this view. Usage is inspectable for both products, but enabling paid overages still requires the customer's billing opt-in. These screens do not deploy customer infrastructure, initialize Redis or override workload safety ceilings.
@@ -14,7 +14,7 @@ Incoming request
14
14
  -> evaluate selected trust signals
15
15
  -> receive an allow/deny decision, score, tier, and route
16
16
  -> apply your API policy
17
- -> serve, limit, sandbox, price, or deny
17
+ -> serve, limit, sandbox, or deny
18
18
  ```
19
19
 
20
20
  ## Before you start
@@ -47,10 +47,6 @@ Do not send a local agent name to `x-agent-id`. Key-based agents must prove
47
47
  ownership of their persistent address before they can pass an identity-aware
48
48
  policy.
49
49
 
50
- > **Hosted wrapper note:** Valiron-hosted API Scaffolding currently requires
51
- > `x-agent-id` when its trust check is enabled. Use the SDK middleware in your
52
- > own backend for a policy that accepts either identity path.
53
-
54
50
  > **Provider-backed identity:** use the dedicated `createValironIdentityGate`,
55
51
  > `valironIdentityFastifyPlugin`, `createValironIdentityNextMiddleware`, or
56
52
  > `valironIdentityGateCheck` exports documented in
@@ -108,15 +104,13 @@ Choose the behavior that fits the endpoint:
108
104
  | --- | --- |
109
105
  | Trust gate | Allow trusted agents and return a denial before your handler runs |
110
106
  | Graduated access | Serve full access for `prod`, apply limits for `prod_throttled`, and use test data for sandbox routes |
111
- | Trust-aware pricing | Read the result in your handler and apply your own price or entitlement policy |
112
- | Monetized endpoint logging | Use `ValironOperator.paywall()` to gate access, attach a configured per-call price, and record usage |
107
+ | Entitlements | Read the result in your handler and choose what the agent may access |
113
108
  | Agent profile lookup | Retrieve a profile when your product needs to display or review trust evidence |
114
109
  | Predictive risk | Use dashboard forecasts as an additional operational signal; do not replace the runtime gate with a forecast |
115
110
  | Audit and operations | Capture the result in your logs or use authenticated dashboard call logs |
116
111
 
117
- Valiron does not itself settle a payment or choose a dynamic price table. It
118
- provides the verified trust context that your payment and application policy
119
- can use.
112
+ Valiron provides the verified trust context; your application decides what
113
+ each decision unlocks.
120
114
 
121
115
  ## 4. Put the gate in front of your handler
122
116
 
@@ -171,35 +165,7 @@ no supported identity, the agent is denied. If an agent is pending its first
171
165
  behavioral evaluation, it receives a retryable denial while sandbox evaluation
172
166
  runs.
173
167
 
174
- ## 5. Add a pricing or payment policy
175
-
176
- For a server-side endpoint with a fixed price and usage logging, use the
177
- operator SDK. It gates the route, makes the decision available as
178
- `req.valiron`, and records the configured price only for successful allowed
179
- calls.
180
-
181
- ```typescript
182
- import { ValironOperator } from "@valiron/sdk";
183
-
184
- const operator = new ValironOperator({
185
- apiKey: process.env.VALIRON_API_KEY!,
186
- chain: "base",
187
- });
188
-
189
- app.use("/api/premium", operator.paywall({
190
- verifyRequest: verifyAgentRequest,
191
- pricePerCall: 0.05,
192
- minTrustScore: 65,
193
- trustSignals: ["8004", "sandbox", "wallet"],
194
- }));
195
- ```
196
-
197
- If your payment provider supports multiple prices, select the price in your
198
- handler from `req.valiron.tier`, `score`, or `route`. Keep payment settlement
199
- in that provider; use Valiron first to decide whether the caller is eligible
200
- to reach it.
201
-
202
- ## 6. Test the complete request path
168
+ ## 5. Test the complete request path
203
169
 
204
170
  Test each case before production:
205
171
 
@@ -209,12 +175,11 @@ Test each case before production:
209
175
  4. An agent below your `minScore`.
210
176
  5. A new agent pending sandbox evaluation.
211
177
  6. A production-eligible agent on every protected route.
212
- 7. A paid or priced request, verifying that trust denial happens before your
213
- payment or application handler.
178
+ 7. A denied request, verifying that trust denial happens before your
179
+ application handler runs.
214
180
 
215
- Use the [Dashboard Playground](./DASHBOARD.md#api-playground) to inspect
216
- decisions and the Dashboard's call logs to review outcome, latency, price, and
217
- trust context after launch.
181
+ Use the Dashboard's call logs to review outcome, latency and trust context
182
+ after launch.
218
183
 
219
184
  ## Next steps
220
185
 
@@ -223,5 +188,3 @@ trust context after launch.
223
188
  and generic middleware APIs
224
189
  - [Identity](./IDENTITY.md) — registry and key-based identity details
225
190
  - [Trust Model](./TRUST-MODEL.md) — signals, tiers, and routes
226
- - [API Scaffolding](./AGENT-READY-APIS.md) — hosted x402/MPP wrappers for an
227
- existing API
package/docs/ERRORS.md CHANGED
@@ -4,6 +4,8 @@ Common error scenarios, status codes, and guidance on how to handle them.
4
4
 
5
5
  The separate Crawler Protection product uses `AdmissionError` and adapter codes `CRAWLER_LIMIT` (429), `CRAWLER_UNAVAILABLE` (503), and `CRAWLER_BLOCK` (403 for an enforced crawler deny rule or application-defined block). These are not `ValironError` failures from `@valiron/sdk`. See [crawler decisions and recovery](./CRAWLER-PROTECTION.md#decisions-and-recovery); rate/capacity rejections must not execute protected work. The standalone gateway adds proxy errors such as 413 for oversized requests, 503 for exhausted origin capacity and 504 for an origin timeout. The private work API uses 401/403 for service/capability failures and 503 for unavailable work. Do not automatically retry an ambiguous acquisition or release capacity because an HTTP timeout elapsed; query settlement must be confirmed.
6
6
 
7
+ With Crawler Protection 0.6.0, `crawlerAccessDefault: "deny"` rejects verified classes without an explicit route allowance. `unverifiedAccess: "deny"` rejects unverified, mismatched and unavailable identities too, including anonymous humans. Enforced access denials use reason `crawler_policy_denied` and map to 403 / `CRAWLER_BLOCK`; retries do not turn a claim into verification. In observation mode, policy denials remain proposed blocks and admitted requests can pass within safety/work limits. Expired source evidence never retains verified privilege; it is not itself proof of a storage outage.
8
+
7
9
  ## Read an error before retrying
8
10
 
9
11
  Every SDK failure is a `ValironError`. Its stable `code` is for program logic; its `message` is safe to show in developer logs; and `details` provides the recovery information that was available from the API.
@@ -274,16 +276,6 @@ store or other safe-verification failure returns HTTP 503 with
274
276
  | 403 | SSRF blocked | The `targetUrl` resolves to a private IP, localhost, or metadata endpoint |
275
277
  | 503 | Origin server unreachable | Your upstream API base URL is down or timed out |
276
278
 
277
- ## Hosted Wrapper Errors
278
-
279
- | Status | Code | When | Action |
280
- |--------|------|------|--------|
281
- | 400 | `MISSING_AGENT_IDENTITY` | A trust-enabled hosted wrapper did not receive `x-agent-id` | Hosted wrappers currently require `x-agent-id`; use SDK middleware for key/address identity support |
282
- | 404 | `WRAPPER_NOT_FOUND` | Operator ID, path, method, or endpoint activation does not match | Verify all four values in the dashboard |
283
- | 413 | `WRAPPER_BODY_TOO_LARGE` | Body exceeds the wrapper limit | Send a smaller request or use an external input reference |
284
- | 429 | `WRAPPER_RATE_LIMITED` | Endpoint rate limit reached | Honor `retryAfter` and use exponential backoff |
285
- | 502 / 504 | `WRAPPER_UPSTREAM_REQUEST_FAILED` / `WRAPPER_UPSTREAM_TIMEOUT` | The target API failed or was too slow | Check upstream URL/auth; include `requestId` and timestamp when escalating |
286
-
287
279
  ## Key-Based Agent Errors
288
280
 
289
281
  | Status | When | Action |
@@ -316,7 +308,7 @@ Session creation requires an operator key and fresh owner signature. Missing/inv
316
308
 
317
309
  `429 MONTHLY_REQUEST_LIMIT_EXCEEDED` means the account has used its monthly
318
310
  allowance (10,000 on Free or 100,000 on Pro) for the UTC calendar month.
319
- Agent and bot protection allowances are separate. Upgrade Free to Pro, email
311
+ Agent Access and Crawler Protection allowances are separate. Upgrade Free to Pro, email
320
312
  founders@valiron.co for Enterprise, or wait until `resetsAt`; use `Retry-After` rather than retrying continuously. This allowance
321
313
  is shared across API keys and hosted endpoints.
322
314
 
@@ -7,7 +7,7 @@ credentials and trusted CA bundle are configured. The SDK provides signing helpe
7
7
  a typed verification method, and dedicated identity gates for Express, Fastify,
8
8
  Next.js, and framework-independent runtimes.
9
9
 
10
- Verification calls require your operator API key and count toward your account’s monthly request allowance. Free includes 10,000 metered agent requests per UTC calendar month; Pro includes 100,000. Bot protection has a separate allowance at the same limits. Enterprise: email founders@valiron.co.
10
+ Verification calls require your operator API key and count toward your account’s monthly request allowance. Free includes 10,000 metered Agent Access requests per UTC calendar month; Pro includes 100,000. Bot protection has a separate allowance at the same limits. Enterprise: email founders@valiron.co.
11
11
 
12
12
  ## Responsibility boundary
13
13