@valiron/sdk 1.4.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.
Files changed (49) hide show
  1. package/README.md +11 -148
  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.d.ts +6 -6
  6. package/dist/clients.js +33 -26
  7. package/dist/edge.d.ts +87 -0
  8. package/dist/edge.js +164 -0
  9. package/dist/edgeGate.d.ts +146 -0
  10. package/dist/edgeGate.js +230 -0
  11. package/dist/edgeGateVerify.d.ts +146 -0
  12. package/dist/edgeGateVerify.js +243 -0
  13. package/dist/identity.d.ts +6 -0
  14. package/dist/identity.js +6 -1
  15. package/dist/identityMiddleware.d.ts +8 -0
  16. package/dist/identityMiddleware.js +12 -4
  17. package/dist/index.d.ts +5 -10
  18. package/dist/index.js +4 -10
  19. package/dist/middleware.d.ts +20 -9
  20. package/dist/middleware.js +47 -19
  21. package/dist/operatorSdk.d.ts +11 -2
  22. package/dist/operatorSdk.js +13 -7
  23. package/dist/types.d.ts +14 -4
  24. package/docs/AGENT-READY-APIS.md +3 -181
  25. package/docs/API-REFERENCE.md +94 -546
  26. package/docs/CHAINS.md +3 -3
  27. package/docs/CLOUDFLARE-GATE-MIDDLEWARE.md +196 -0
  28. package/docs/CRAWLER-PROTECTION.md +545 -0
  29. package/docs/DASHBOARD.md +55 -23
  30. package/docs/E2E-MIDDLEWARE-INTEGRATION.md +19 -13
  31. package/docs/ERRORS.md +29 -19
  32. package/docs/IDENTITY.md +16 -14
  33. package/docs/PROVIDER-IDENTITY.md +15 -5
  34. package/docs/QUICKSTART.md +40 -24
  35. package/docs/README.md +21 -4
  36. package/docs/SANDBOX.md +7 -1
  37. package/docs/SDK-REFERENCE.md +115 -52
  38. package/docs/SECURITY-UPGRADE-2026-10-31.md +98 -0
  39. package/docs/TRUST-MODEL.md +14 -11
  40. package/docs/llms.txt +70 -302
  41. package/examples/cloudflare-gate-worker/README.md +198 -0
  42. package/examples/cloudflare-gate-worker/package.json +20 -0
  43. package/examples/cloudflare-gate-worker/worker.ts +309 -0
  44. package/examples/cloudflare-gate-worker/wrangler.toml +46 -0
  45. package/examples/cloudflare-worker/package.json +8 -0
  46. package/examples/cloudflare-worker/worker.ts +495 -0
  47. package/examples/cloudflare-worker/wrangler.toml +57 -0
  48. package/package.json +35 -5
  49. package/docs/MCP.md +0 -50
package/docs/DASHBOARD.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Operator Dashboard
2
2
 
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
+
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.
6
+
3
7
  > Manage your Valiron integration from a single web interface — register endpoints, monitor agent activity, test trust evaluations, and view analytics.
4
8
 
5
9
  **Dashboard URL:** [https://www.valiron.co/dashboard](https://www.valiron.co/dashboard)
@@ -25,7 +29,7 @@ key-based agents, and ANS or other provider-backed identities. ANS is an agent
25
29
  identity option; it is not required to create a Valiron operator account.
26
30
 
27
31
  After registration, sign in with your email and password, Google, or GitHub.
28
- Your session is stored as a JWT in the browser.
32
+ Sign in on the website to manage your account. Keep the operator API key in your backend environment.
29
33
 
30
34
  ---
31
35
 
@@ -33,15 +37,35 @@ Your session is stored as a JWT in the browser.
33
37
 
34
38
  **Route:** `/dashboard`
35
39
 
36
- Your landing page after signing in. Shows a summary of your integration at a glance:
40
+ The dashboard uses the same three product sections as the documentation. Choose a product from the **Product** switcher; its navigation appears underneath:
37
41
 
38
- - **Top stats** — Total Revenue, Total Calls, Unique Agents, Avg Latency
39
- - **Secondary stats** — Active API Keys, Registered Endpoints, Calls Today, Plan + fee rate
40
- - **Recent Activity** — Last 5 call logs with method, path, agent, cost, and timestamp
41
- - **Quick Start** — 3-step guide: get API key → make an API agent-ready → test with agents
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, Crawler controls, Decision logs, Alerts 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.
45
+
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.
42
47
 
43
48
  ---
44
49
 
50
+ **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.
51
+
52
+ The middleware overview and Crawler Protection each show their own monthly usage panel. Paid Pro owners can enable additional calls separately at the displayed rate of 0.001 per request after 100,000. Checkout offers separate unchecked opt-in controls; existing customers enroll from the relevant dashboard panel. Without opt-in, requests stop at the included allowance.
53
+
54
+ ## Valiron Crawler Protection (Free, Pro, Enterprise)
55
+
56
+ **Route:** `/dashboard/crawler-protection`
57
+
58
+ Free, Pro and Enterprise accounts can:
59
+
60
+ 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.
61
+ 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.
62
+ 3. Validate against the real configuration compiler and inspect rollout blockers.
63
+ 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.
64
+
65
+ 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+, Crawler 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.
66
+
67
+ 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 remain visible here. SDK/gateway 0.7.0+ managed integrations add separate Crawler controls, bounded Decision logs and opt-in email/webhook Alerts; see [Dashboard controls](./CRAWLER-PROTECTION.md#dashboard-controls). 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).
68
+
45
69
  ## Agents
46
70
 
47
71
  **Route:** `/dashboard/agents`
@@ -114,7 +138,7 @@ Each key shows its prefix, label, last used date, and creation date.
114
138
 
115
139
  ## Make API Agent-Ready
116
140
 
117
- **Route:** `/dashboard/endpoints`
141
+ **Route:** `/dashboard/wrappers` (legacy `/dashboard/endpoints` remains supported)
118
142
 
119
143
  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.
120
144
 
@@ -122,7 +146,7 @@ This product is appropriate when an API must be callable by autonomous agents wi
122
146
 
123
147
  ### Hosted wrapper flow
124
148
 
125
- 1. Open **Make API Agent-Ready**.
149
+ 1. Open **API Scaffolding → Endpoints & testing**.
126
150
  2. Click **Make API Agent-Ready**.
127
151
  3. Enter your upstream API details and payment settings.
128
152
  4. Configure upstream authentication to protect your origin.
@@ -277,18 +301,6 @@ Manage your operator profile.
277
301
 
278
302
  ---
279
303
 
280
- ## Admin Panel
281
-
282
- **Route:** `/dashboard/admin` (admin-only)
283
-
284
- Platform-wide administration. Only visible to operators with `role: "admin"`.
285
-
286
- - **Platform stats** — Total operators, total API calls, total revenue
287
- - **All operators table** — Name, email, role, plan, keys, endpoints, calls, revenue, agents, join date
288
- - **Operator drill-down** — Click any operator to see their full detail: stats, daily revenue chart, API keys, endpoints, agents, account info
289
-
290
- ---
291
-
292
304
  ## Middleware Integration
293
305
 
294
306
  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.
@@ -305,7 +317,7 @@ npm install @valiron/sdk
305
317
  import { ValironOperator } from "@valiron/sdk";
306
318
 
307
319
  const operator = new ValironOperator({ apiKey: "val_op_xxxx" });
308
- app.use("/api/weather", operator.paywall({ pricePerCall: 0.05 }));
320
+ app.use("/api/weather", operator.paywall({ verifyRequest: verifyAgentRequest, pricePerCall: 0.05 }));
309
321
  ```
310
322
 
311
323
  **Manual gating:**
@@ -313,10 +325,12 @@ app.use("/api/weather", operator.paywall({ pricePerCall: 0.05 }));
313
325
  ```typescript
314
326
  import { ValironSDK } from "@valiron/sdk";
315
327
 
316
- const valiron = new ValironSDK({ chain: "ethereum" });
328
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "ethereum" });
317
329
 
318
330
  app.use("/api/weather", async (req, res, next) => {
319
331
  const agentId = req.headers["x-agent-id"];
332
+ if (typeof agentId !== "string" || !await verifyAgentRequest(req, agentId))
333
+ return res.status(401).json({ code: "AGENT_OWNERSHIP_REQUIRED" });
320
334
  const profile = await valiron.getAgentProfile(agentId);
321
335
 
322
336
  if (profile.routing.finalRoute === "prod") return next();
@@ -344,7 +358,7 @@ API Scaffolding is a separate product that provides a hosted, agent-facing wrapp
344
358
 
345
359
  1. Create your account on the dashboard.
346
360
  2. Copy your API key from the Keys page.
347
- 3. Create a wrapper from **Make API Agent-Ready**.
361
+ 3. Create a wrapper from **API Scaffolding → Endpoints & testing**.
348
362
  4. Test the generated `/wrap/{operatorId}/{path}` URL.
349
363
  5. Monitor calls in Analytics and Logs.
350
364
 
@@ -355,3 +369,21 @@ returns `401` or `403`, while a wrapper request is visible in call logs. See
355
369
  For deployments requiring full backend control, protect the API directly with Valiron middleware using `createValironGate()` or `ValironOperator.paywall()`.
356
370
 
357
371
  For full hosted wrapper docs, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
372
+
373
+ 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.
374
+
375
+ ## Security behavior for account owners
376
+
377
+ 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.
378
+
379
+ 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.
380
+
381
+ 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.
382
+
383
+ ## Admin customer Crawler Protection workspace
384
+
385
+ 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.
386
+
387
+ 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.
388
+
389
+ 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.
@@ -1,5 +1,7 @@
1
1
  # End-to-End Valiron Middleware Integration
2
2
 
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
+
3
5
  This guide helps API teams integrate Valiron middleware from the first incoming
4
6
  agent request through the downstream action they want to take. Start with the
5
7
  agent identity, choose the trust signals that match your policy, then use the
@@ -18,8 +20,8 @@ Incoming request
18
20
  ## Before you start
19
21
 
20
22
  1. Create an operator account in the [Dashboard](./DASHBOARD.md).
21
- 2. Copy an operator API key (`val_op_...`) if you will use Pro trust signals,
22
- operator usage logging, or hosted products.
23
+ 2. Copy an operator API key (`val_op_...`) for profile reads, gates, sandbox runs,
24
+ operator usage logging, or hosted products on Free or paid plans.
23
25
  3. Install the SDK:
24
26
 
25
27
  ```bash
@@ -65,10 +67,10 @@ protecting.
65
67
  | --- | --- | --- |
66
68
  | `8004` | Registry-backed on-chain identity and reputation | All plans |
67
69
  | `sandbox` | Behavioral evaluation and route readiness | All plans |
68
- | `world` | World ID proof-of-personhood linkage | Pro |
69
- | `self` | Self eligible-human verification | Pro |
70
+ | `world` | World ID proof-of-personhood linkage | Free |
71
+ | `self` | Self eligible-human verification | Free |
70
72
  | `icebreaker` | Human-to-agent attestation | Pro |
71
- | `wallet` | Explainable wallet-history risk, confidence, and hard flags | Pro |
73
+ | `wallet` | Explainable wallet-history risk, confidence, and hard flags | Free |
72
74
 
73
75
  For example, a high-value endpoint might require on-chain reputation,
74
76
  behavioral evidence, and wallet intelligence:
@@ -82,6 +84,7 @@ const valiron = new ValironSDK({
82
84
  });
83
85
 
84
86
  const trustGate = createValironGate({
87
+ verifyRequest: verifyAgentRequest,
85
88
  sdk: valiron,
86
89
  trustSignals: ["8004", "sandbox", "wallet"],
87
90
  minScore: 80,
@@ -108,7 +111,7 @@ Choose the behavior that fits the endpoint:
108
111
  | Trust-aware pricing | Read the result in your handler and apply your own price or entitlement policy |
109
112
  | Monetized endpoint logging | Use `ValironOperator.paywall()` to gate access, attach a configured per-call price, and record usage |
110
113
  | Agent profile lookup | Retrieve a profile when your product needs to display or review trust evidence |
111
- | Predictive risk | Use dashboard/API forecasts as an additional operational signal; do not replace the runtime gate with a forecast |
114
+ | Predictive risk | Use dashboard forecasts as an additional operational signal; do not replace the runtime gate with a forecast |
112
115
  | Audit and operations | Capture the result in your logs or use authenticated dashboard call logs |
113
116
 
114
117
  Valiron does not itself settle a payment or choose a dynamic price table. It
@@ -117,7 +120,9 @@ can use.
117
120
 
118
121
  ## 4. Put the gate in front of your handler
119
122
 
120
- Here is a complete Express example that supports both agent identity paths and
123
+ Import `verifyAgentRequest` from your application-owned signature verifier. It must bind the identity, method, full URL and body, enforce freshness, and atomically claim nonces before returning true; see the [upgrade guide](./SECURITY-UPGRADE-2026-10-31.md).
124
+
125
+ Here is an Express example that supports both agent identity paths and
121
126
  uses the route decision for graduated access:
122
127
 
123
128
  ```typescript
@@ -131,6 +136,7 @@ const valiron = new ValironSDK({
131
136
  });
132
137
 
133
138
  app.use("/api/research", createValironGate({
139
+ verifyRequest: verifyAgentRequest,
134
140
  sdk: valiron,
135
141
  trustSignals: ["8004", "sandbox", "wallet"],
136
142
  minScore: 65,
@@ -147,9 +153,8 @@ app.get("/api/research", (req, res) => {
147
153
  res.set("X-Rate-Limit-Policy", "reduced");
148
154
  }
149
155
 
150
- if (trust.route === "sandbox") {
151
- return res.json({ mode: "sandbox", results: [] });
152
- }
156
+ // Denied and pending agents never reach this handler. Use a separate,
157
+ // explicitly scoped route if your product offers sandbox data.
153
158
 
154
159
  return res.json({
155
160
  mode: "production",
@@ -182,6 +187,7 @@ const operator = new ValironOperator({
182
187
  });
183
188
 
184
189
  app.use("/api/premium", operator.paywall({
190
+ verifyRequest: verifyAgentRequest,
185
191
  pricePerCall: 0.05,
186
192
  minTrustScore: 65,
187
193
  trustSignals: ["8004", "sandbox", "wallet"],
@@ -197,9 +203,9 @@ to reach it.
197
203
 
198
204
  Test each case before production:
199
205
 
200
- 1. A registered agent using `x-agent-id`.
201
- 2. A verified key-based agent using `x-agent-address`.
202
- 3. A request without either identity header.
206
+ 1. A registered agent using `x-agent-id` plus a fresh valid request proof.
207
+ 2. An enrolled key-based agent using `x-agent-address` plus a fresh valid request proof.
208
+ 3. Missing headers, a forged identity claim, a replayed nonce and a signature for a different method/URL/body; all must deny access.
203
209
  4. An agent below your `minScore`.
204
210
  5. A new agent pending sandbox evaluation.
205
211
  6. A production-eligible agent on every protected route.
package/docs/ERRORS.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Common error scenarios, status codes, and guidance on how to handle them.
4
4
 
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
+
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
+
5
9
  ## Read an error before retrying
6
10
 
7
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.
@@ -61,7 +65,7 @@ The SDK throws typed errors that you can catch:
61
65
  ```typescript
62
66
  import { ValironSDK } from "@valiron/sdk";
63
67
 
64
- const valiron = new ValironSDK();
68
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
65
69
 
66
70
  try {
67
71
  const profile = await valiron.getAgentProfile("99999");
@@ -128,14 +132,14 @@ await valiron.triggerSandboxTest("YOUR_AGENT_ID");
128
132
 
129
133
  ### Provisional scores
130
134
 
131
- First-time agents that haven't been sandbox-tested yet receive provisional scores. Provisional evaluations use a higher trust threshold — meaning the agent must prove itself more thoroughly on its first interaction. After the first sandbox run completes, future gate() calls use the standard threshold.
135
+ New agents remain denied while their real sandbox evaluation is pending. Provisional or synthetic scores cannot authorize production access and cannot overwrite definitive evaluation results. Retry with the same identity and a fresh request proof after the indicated delay.
132
136
 
133
137
  ### Timeout errors
134
138
 
135
139
  The SDK uses method-aware default timeouts: 10 seconds generally, 15 seconds for `gate()`/`proxy()`, and 30 seconds for sandbox triggers. To force a single timeout for all calls, configure it explicitly:
136
140
 
137
141
  ```typescript
138
- const valiron = new ValironSDK({ timeout: 30000 }); // 30 seconds
142
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, timeout: 30000 }); // 30 seconds
139
143
  ```
140
144
 
141
145
  ### Chain mismatch
@@ -143,7 +147,7 @@ const valiron = new ValironSDK({ timeout: 30000 }); // 30 seconds
143
147
  If the agent is registered on Monad but you query Ethereum (the default), it will return 404. Always specify the correct chain:
144
148
 
145
149
  ```typescript
146
- const valiron = new ValironSDK({ chain: "monad" });
150
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "monad" });
147
151
  ```
148
152
 
149
153
  ### Wallet intelligence unavailable
@@ -157,15 +161,17 @@ const valiron = new ValironSDK({ chain: "monad" });
157
161
 
158
162
  Unavailable wallet intelligence is excluded from profile and gate composite scoring. Retry provider failures according to your policy; do not reinterpret an unavailable assessment as malicious activity.
159
163
 
160
- ### Wallet intelligence requires Pro
164
+ ### Social Graph requires Pro
161
165
 
162
- Direct wallet-risk requests and policies containing `trustSignals: ["wallet"]` require a valid Pro or Enterprise operator key. A Free or unauthenticated request returns:
166
+ Wallet intelligence is included with Free, but requires an authenticated operator key. Missing or invalid credentials return HTTP 401 before provider work.
167
+
168
+ Policies containing `trustSignals: ["icebreaker"]` require Pro or Enterprise. An authenticated Free request returns HTTP 403:
163
169
 
164
170
  ```json
165
171
  {
166
172
  "error": "upgrade_required",
167
- "feature": "enriched_profiles",
168
- "message": "World ID, Self, Icebreaker, and wallet intelligence signals require a Pro plan. Free plans can use ERC-8004 and sandbox signals."
173
+ "feature": "social_graph",
174
+ "message": "Social Graph (Icebreaker) requires a Pro plan. ERC-8004, sandbox, World ID, Self, and wallet intelligence are included with Free."
169
175
  }
170
176
  ```
171
177
 
@@ -218,11 +224,12 @@ All Valiron middleware (Express, Fastify, Next.js, generic) returns consistent e
218
224
  | Status | Code | When | What to do |
219
225
  |--------|------|------|
220
226
  | 401 | `MISSING_AGENT_IDENTITY` | No identity header | Send one supported identity header: `x-agent-id` or `x-agent-address` |
227
+ | 401 | `AGENT_OWNERSHIP_REQUIRED` | Missing verifier, invalid owner proof, stale timestamp, wrong request binding or replay | Configure the verifier/signer; generate a fresh nonce and sign the actual identity, chain, method, URL and body |
221
228
  | 403 | `TRUST_GATE_DENIED` | Agent did not meet the configured policy | Inspect `score`, `tier`, `route`, and `reasons`; do not blindly retry |
222
229
  | 403 | `AGENT_EVALUATION_PENDING` | New identity is sandbox-evaluating | Keep the same identity and retry after `retryAfterMs` |
223
230
  | 503 | `TRUST_GATE_UNAVAILABLE` | Trust evaluation could not complete | Fail closed; retry shortly and inspect the logged `cause` |
224
231
 
225
- Each response includes `message`, `action`, and `docsUrl`; denials retain the trust result fields so an application can make a deliberate fallback decision.
232
+ Standard missing-identity, trust-denial, pending and unavailable responses include recovery fields such as `message`, `action`, and `docsUrl`. Ownership-proof rejections may contain only `code` and `error`; handle the stable code without assuming those optional fields exist.
226
233
 
227
234
  > **Fail-closed:** When the Valiron service is unreachable, middleware returns 503 — it never fails open and never allows unverified agents through.
228
235
 
@@ -241,8 +248,8 @@ its exact bytes. `IDENTITY_GATE_UNAVAILABLE` is a fail-closed HTTP 503.
241
248
  | Failure reason | Meaning | Action |
242
249
  | --- | --- | --- |
243
250
  | `provider_missing` | An agent ID was supplied without a provider | Send the resolver provider name |
244
- | `resolver_unavailable` | No adapter is registered for the provider | For ANS, configure credentials and a trusted CA bundle; never treat the claim as verified |
245
- | `proof_incomplete` | Signature, timestamp, nonce, or digest is missing | Construct and sign the complete proof |
251
+ | `resolver_unavailable` | No adapter is registered for the provider | For hosted ANS, retry or contact support; never treat an unavailable resolver as verified |
252
+ | `proof_incomplete` | Signature, timestamp, nonce, digest, audience, method or URL is missing | Construct and sign the complete proof |
246
253
  | `request_digest_invalid` | Digest is not `sha256:` plus 64 hex characters | Recalculate and format the SHA-256 digest |
247
254
  | `nonce_invalid` | Nonce is shorter than 16 characters or contains unsupported characters | Generate a 16–256 character URL-safe nonce |
248
255
  | `timestamp_invalid` | Timestamp cannot be parsed | Send an ISO-8601 timestamp |
@@ -291,25 +298,28 @@ store or other safe-verification failure returns HTTP 503 with
291
298
 
292
299
  | Status | When | Action |
293
300
  |--------|------|--------|
294
- | 400 | Invalid or malformed proof | Verify your World ID proof payload fields |
295
- | 404 | Agent has no World ID verification | The agent hasn't completed World ID verification yet |
296
- | 409 | Nullifier hash already used | This World ID proof has already been submitted |
301
+ | 401 | Missing operator credentials or owner proof | Authenticate the operator and sign this exact enrollment request |
302
+ | 400 | Missing/unsupported IDKit result, failed server verification or proof bound to another agent | Submit the complete production result for the configured action; partial proofs and caller-selected strength are insufficient |
303
+ | 404 | Agent not found on-chain | Use an existing registry agent; an unverified status lookup normally returns `verified: false` |
297
304
 
298
305
  ## Self Errors
299
306
 
307
+ Session creation requires an operator key and fresh owner signature. Missing/invalid ownership returns 401; an unsupported return origin returns 400. Older sessions without owner-verification provenance cannot establish a new trusted link.
308
+
300
309
  | Status | When | Action |
301
310
  |--------|------|--------|
302
- | 400 | Raw webhook body unavailable or Self webhook signature invalid | Configure Self to call `/operator/self/webhook` and keep the endpoint's `whsec_...` value in `SELF_TEST_WEBHOOK_SECRET` or `SELF_LIVE_WEBHOOK_SECRET` |
311
+ | 400 | Raw webhook body unavailable or Self webhook signature invalid | Valiron manages the provider callback. Check session status and contact support if verification remains pending after completing the Self flow |
303
312
  | 400 | Self webhook cannot be mapped to a Valiron session | Create sessions through `createSelfSession()` or `POST /operator/self/session/:agentId` so `externalUuid` is stored before the webhook arrives |
304
- | 403 | Trusted Self payload ingestion is disabled | Use the production session + signed webhook flow, or set `SELF_ALLOW_TRUSTED_PAYLOADS=true` only for local/internal tests |
313
+ | 403 | Trusted Self payload ingestion is disabled | Use `createSelfSession()` and check `getSelfStatus()`; direct proof ingestion is not supported for hosted customer integrations |
305
314
  | 404 | Agent not found on-chain | Use an existing ERC-8004 agent ID or a supported Solana agent ID before creating a Self session |
306
315
  | 409 | Agent already has a verified Self link | Self links are immutable once verified |
307
316
 
308
317
  ## Monthly request allowance
309
318
 
310
- `429 MONTHLY_REQUEST_LIMIT_EXCEEDED` means the account has used its 100,000
311
- Free requests for the UTC calendar month. Upgrade to Pro or wait until
312
- `resetsAt`; use `Retry-After` rather than retrying continuously. This allowance
319
+ `429 MONTHLY_REQUEST_LIMIT_EXCEEDED` means the account has used its monthly
320
+ allowance (10,000 on Free or 100,000 on Pro) for the UTC calendar month.
321
+ Agent and bot protection allowances are separate. Upgrade Free to Pro, email
322
+ founders@valiron.co for Enterprise, or wait until `resetsAt`; use `Retry-After` rather than retrying continuously. This allowance
313
323
  is shared across API keys and hosted endpoints.
314
324
 
315
325
  `503 MONTHLY_USAGE_UNAVAILABLE` means request usage could not be checked.
package/docs/IDENTITY.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Agent Identity: On-Chain, Key-Based, and Provider-Backed Agents
2
2
 
3
+ Ordinary website crawlers use a separate [Valiron Crawler Protection source-verification path](./CRAWLER-PROTECTION.md). They need not register an agent key, wallet or on-chain identity. IP/DNS or authenticated verified-WAF evidence establishes network provenance, not signed agent possession or human identity; work budgets remain necessary even for a verified crawler.
4
+
3
5
  Valiron supports on-chain, key-based, and provider-backed middleware identity
4
6
  paths:
5
7
 
@@ -14,7 +16,7 @@ Use `/operator/agent/:agentId` only for registry-backed on-chain agents. Local a
14
16
 
15
17
  The provider-backed framework normalizes identity into `anonymous`, `claimed`,
16
18
  or `verified`, performs freshness and replay checks, and can return an
17
- `allow`, `limit`, `challenge`, or `block` policy action. SDK 1.3 includes
19
+ `allow`, `limit`, `challenge`, or `block` policy action. The SDK includes
18
20
  signing helpers and dedicated provider identity gates; Valiron hosts the ANS
19
21
  credentials and trusted CA bundle. See
20
22
  [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md) for the exact request,
@@ -22,7 +24,7 @@ signature payload, SDK integration, response, and current ANS boundary.
22
24
 
23
25
  ## Wallet as a Trust Input
24
26
 
25
- When a Pro policy selects `trustSignals: ["wallet"]`, Valiron evaluates the wallet associated with the chosen identity path. ERC-8004 and Solana agents use the wallet resolved from their registry identity; key-based agents use their verified persistent agent address. Wallet intelligence does not establish identity by itself—it is an additional economic-history signal applied after Valiron has a wallet address.
27
+ When a Free or paid policy selects `trustSignals: ["wallet"]`, Valiron evaluates the wallet associated with the chosen identity path. ERC-8004 and Solana agents use the wallet resolved from their registry identity; key-based agents use their verified persistent agent address. Wallet intelligence does not establish identity by itself—it is an additional economic-history signal applied after Valiron has a wallet address.
26
28
 
27
29
  Use `getWalletProfile()` to resolve a wallet to an agent profile. Use `getWalletRisk()` when you need only the explainable wallet-history assessment. See [TRUST-MODEL.md](./TRUST-MODEL.md#wallet-intelligence) for supported networks and limitations.
28
30
 
@@ -123,7 +125,7 @@ const tokenUri = await client.readContract({
123
125
  ```typescript
124
126
  import { ValironSDK } from "@valiron/sdk";
125
127
 
126
- const valiron = new ValironSDK();
128
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
127
129
  const profile = await valiron.getAgentProfile("25459");
128
130
 
129
131
  console.log(profile.identity.name);
@@ -186,7 +188,7 @@ Not every agent has an on-chain ERC-8004 identity. For local, Web2, and non-ERC-
186
188
  3. Agent signs the nonce with their private key (EIP-191 personal sign)
187
189
  4. Valiron verifies the signature and creates a `KeyAgentProfile`
188
190
 
189
- The SDK and middleware auto-detect key-based agents from the `x-agent-address` header. The standard trust gate reads a previously verified profile; the header alone is not a fresh proof of possession. API sellers should bind it to their authenticated caller before a sensitive action.
191
+ The middleware detects key-based claims from `x-agent-address`, then requires `verifyRequest` to verify a fresh request-bound signature and reject replay. The header or a previously enrolled profile is insufficient. See the [request-proof upgrade guide](./SECURITY-UPGRADE-2026-10-31.md).
190
192
 
191
193
  Agents can follow the hosted identity skill at [https://www.valiron.co/auth.md](https://www.valiron.co/auth.md) to generate an identifier, request a challenge, sign it, and cache the returned session token.
192
194
 
@@ -214,8 +216,8 @@ action-specific policy for Icebreaker context.
214
216
  | `tier` | string \| null | Moody's-style trust tier once scored |
215
217
  | `riskLevel` | string \| null | GREEN / YELLOW / RED once scored |
216
218
  | `route` | string \| null | Route decision once scored |
217
- | `icebreaker` | object \| null | Redacted to `null` on the public endpoint; use `getKeyAgentIcebreaker()` with a Pro key |
218
- | `reasons` | string[] | Redacted to `[]` on the public endpoint |
219
+ | `icebreaker` | object \| null | Redacted to `null` on the authenticated summary endpoint; use `getKeyAgentIcebreaker()` with a Pro key |
220
+ | `reasons` | string[] | Redacted to `[]` on the authenticated summary endpoint |
219
221
  | `timestamp` | string | ISO timestamp for the profile response |
220
222
 
221
223
  ### Key-Based vs On-Chain Agents
@@ -240,9 +242,9 @@ World ID verifies that an agent is linked to a real human via Worldcoin's zero-k
240
242
 
241
243
  ### How It Works
242
244
 
243
- 1. Agent owner completes World ID verification (orb or device level)
244
- 2. The proof is submitted to Valiron via `verifyWorldId()` or the API endpoint
245
- 3. Valiron stores the verification status and includes it in trust evaluation
245
+ 1. The current registry owner authorizes enrollment with a fresh signed request, and an authenticated operator submits it.
246
+ 2. The complete production IDKit result is submitted unchanged as `idkit_result`; current enrollment accepts proof-of-human credentials.
247
+ 3. Valiron verifies the configured RP/action server-side, derives credential strength from verified evidence, and stores the link. Legacy records without server-verification provenance require re-verification.
246
248
 
247
249
  ### SDK Methods
248
250
 
@@ -252,7 +254,7 @@ await valiron.verifyWorldId("25459", proof);
252
254
 
253
255
  // Check verification status
254
256
  const status = await valiron.getWorldIdStatus("25459");
255
- // { verified: true, verifiedAt: "...", level: "orb" }
257
+ // status.worldId: { verified: true, verificationLevel: "orb" }
256
258
 
257
259
  // Get full profile
258
260
  const profile = await valiron.getWorldIdProfile("25459");
@@ -272,7 +274,7 @@ Self Agent ID can be supplied when creating a session. When present and confirme
272
274
 
273
275
  ### How It Works
274
276
 
275
- 1. Valiron creates a Self Enterprise session with `createSelfSession()` or `POST /operator/self/session/:agentId`
277
+ 1. An authenticated operator submits a fresh registry-owner proof; Valiron creates an owner-authorized Self Enterprise session with `createSelfSession()` or `POST /operator/self/session/:agentId`
276
278
  2. The user opens the returned `verificationUrl` and completes the Self flow
277
279
  3. Self sends a signed `verification.completed` webhook to `/operator/self/webhook`
278
280
  4. Valiron verifies the raw webhook body with Self's webhook verifier and stores the Self status
@@ -348,10 +350,10 @@ Both work interchangeably in Valiron's API:
348
350
 
349
351
  ```bash
350
352
  # By asset pubkey
351
- curl "https://valiron-edge-proxy.onrender.com/operator/agent/DFknts...?chain=solana"
353
+ curl -H "Authorization: Bearer $VALIRON_API_KEY" "https://valiron-edge-proxy.onrender.com/operator/agent/DFknts...?chain=solana"
352
354
 
353
355
  # By sequential ID
354
- curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
356
+ curl -H "Authorization: Bearer $VALIRON_API_KEY" "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
355
357
  ```
356
358
 
357
359
  ### Reading Solana Identity
@@ -359,7 +361,7 @@ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
359
361
  ```typescript
360
362
  import { ValironSDK } from "@valiron/sdk";
361
363
 
362
- const valiron = new ValironSDK({ chain: "solana" });
364
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: "solana" });
363
365
  const profile = await valiron.getAgentProfile("1226"); // sequential ID
364
366
 
365
367
  console.log(profile.identity.name); // "NoahScout_Bot.noah"
@@ -3,11 +3,11 @@
3
3
  Valiron now has a provider-independent verification foundation for identities
4
4
  resolved through ANS, DNS, DIDs, API keys, and future standards. An ANS REST
5
5
  resolver adapter is implemented and is registered at service startup when its
6
- credentials and trusted CA bundle are configured. SDK 1.3 adds signing helpers,
6
+ credentials and trusted CA bundle are configured. The SDK provides signing helpers,
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 100,000 metered requests per UTC calendar month; Pro has no monthly request cap.
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.
11
11
 
12
12
  ## Responsibility boundary
13
13
 
@@ -63,6 +63,9 @@ const proof = await createAgentIdentityProof({
63
63
  provider: "ans",
64
64
  agentId: "ans://v1.0.0.sales-agent.acme.com",
65
65
  body,
66
+ audience: "https://api.example.com",
67
+ method: "POST",
68
+ url: "https://api.example.com/quote",
66
69
  sign: (payload) => agentKey.sign(payload),
67
70
  });
68
71
 
@@ -116,6 +119,8 @@ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
116
119
 
117
120
  app.post("/quote", createValironIdentityGate({
118
121
  sdk: valiron,
122
+ audience: "https://api.example.com",
123
+ origin: "https://api.example.com",
119
124
  policy: {
120
125
  anonymous: "challenge",
121
126
  claimed: "block",
@@ -165,7 +170,10 @@ Equivalent exports are `valironIdentityFastifyPlugin`,
165
170
  The signature covers the UTF-8 bytes of this exact payload:
166
171
 
167
172
  ```text
168
- valiron-agent-request-v1
173
+ valiron-agent-request-v2
174
+ audience:<API-owner-configured-audience>
175
+ method:<UPPERCASE-HTTP-method>
176
+ url:<absolute-request-URL>
169
177
  agent-id:<provider-canonical-agent-id>
170
178
  timestamp:<timestamp-as-submitted>
171
179
  nonce:<nonce-as-submitted>
@@ -176,6 +184,8 @@ The request digest must use `sha256:` followed by 64 hexadecimal characters.
176
184
  The nonce must contain 16–256 URL-safe characters. The default timestamp window
177
185
  is five minutes, and nonce claims are retained for ten minutes.
178
186
 
187
+ The receiving API must derive the audience, method, URL and `requestDigest` from its own trusted configuration and the actual protected request. It must not copy these fields from caller-supplied headers.
188
+
179
189
  The caller must calculate `requestDigest` from the protected request bytes and
180
190
  apply the returned decision to that same request. This standalone verification
181
191
  endpoint cannot infer the bytes of a separate downstream request.
@@ -211,7 +221,7 @@ machine-readable `failureReason`. See [Errors](./ERRORS.md#provider-backed-ident
211
221
 
212
222
  ## Replay and storage behavior
213
223
 
214
- Nonce claims use an atomic Redis write. Verification returns HTTP 503 when the
224
+ Each request nonce can be accepted only once. Verification returns HTTP 503 when the
215
225
  replay store is unavailable, so the flow cannot fail open. Only verified
216
226
  requests update the stable identity activity record. Failed claims cannot write
217
227
  activity or reputation against the identity they attempted to impersonate.
@@ -238,7 +248,7 @@ For an ANS claim, the adapter:
238
248
  6. loads the current Transparency Log record, requires `ACTIVE` or `WARNING`, and matches its identity-certificate fingerprint; and
239
249
  7. extracts the certificate public key for the Valiron request proof.
240
250
 
241
- The timestamp, nonce, request digest, and `valiron-agent-request-v1` payload are
251
+ The timestamp, nonce, request digest, and `valiron-agent-request-v2` payload are
242
252
  a Valiron transport-proof envelope. They are not presented as an ANS-native HTTP
243
253
  signature standard.
244
254