@valiron/sdk 1.4.0 → 2.0.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.
@@ -1,5 +1,9 @@
1
1
  # Trust Model
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
+ Crawler source verification is separate from this agent reputation model. The [Valiron Crawler Protection](./CRAWLER-PROTECTION.md) uses supported IP/DNS or authenticated verified-WAF evidence, explicit route costs, shared quotas and work concurrency controls. Its `verified` classification is not an AAA–C trust rating, human identification or a promise that a crawl is affordable.
6
+
3
7
  Valiron uses a hybrid trust model to evaluate AI agents hitting your API. This document explains what behaviors are evaluated and what each trust tier means for your routing decisions.
4
8
 
5
9
  ## Identity proof is not reputation
@@ -17,11 +21,13 @@ action of `allow`, `limit`, `challenge`, or `block`. An identity with no observe
17
21
  reputation returns an unknown risk level rather than being inferred as risky.
18
22
 
19
23
  ANS trust-index and lifecycle evidence remain external provider evidence; they
20
- are not relabeled as Valiron-observed reputation. SDK 1.3 exposes dedicated
24
+ are not relabeled as Valiron-observed reputation. The SDK exposes dedicated
21
25
  provider identity gates using `x-valiron-identity-*` proof headers. The ANS
22
26
  resolver and provider credentials remain inside Valiron's hosted service. See
23
27
  [Provider-Backed Agent Identity](./PROVIDER-IDENTITY.md).
24
28
 
29
+ Each caller must also prove control of the identity for the current request. Local trust gates require `verifyRequest`; hosted gates require owner-signed v2 proofs. Reputation, human linkage and payment do not independently grant authority to perform an application action. Pending or provisional sandbox results do not permit production access; only completed evaluations contribute a definitive decision.
30
+
25
31
  ## Trust Tiers
26
32
 
27
33
  Valiron assigns a Moody's-style credit tier from a normalized `0-100` trust score:
@@ -48,10 +54,10 @@ Supported signals:
48
54
  |--------|-------------|------|
49
55
  | `8004` | ERC-8004 / Solana on-chain reputation | Free |
50
56
  | `sandbox` | Valiron behavioral sandbox score | Free |
51
- | `world` | World ID human-agent link | Pro |
52
- | `self` | Self eligible-human proof and optional Self Agent ID link | Pro |
57
+ | `world` | World ID human-agent link | Free |
58
+ | `self` | Self eligible-human proof and optional Self Agent ID link | Free |
53
59
  | `icebreaker` | Icebreaker human/background attestation | Pro |
54
- | `wallet` | Explainable wallet-history activity and risk signal | Pro |
60
+ | `wallet` | Explainable wallet-history activity and risk signal | Free |
55
61
 
56
62
  Selected trust signals contribute to a combined trust assessment. Exact weighting and scoring internals are not part of the public API contract.
57
63
 
@@ -78,6 +84,7 @@ Or include it in an endpoint policy:
78
84
 
79
85
  ```typescript
80
86
  app.use("/api/high-trust", createValironGate({
87
+ verifyRequest: verifyAgentRequest,
81
88
  sdk: valiron,
82
89
  trustSignals: ["8004", "sandbox", "wallet"],
83
90
  minScore: 80,
@@ -105,19 +112,14 @@ The forecast combines:
105
112
 
106
113
  The output includes `predictedNextScore`, `passProbability`, `riskDirection`, `confidence`, `recommendedPolicy`, `recommendedTests`, and human-readable reasons. A low-confidence forecast means Valiron has sparse evidence; it should be treated as a prompt to run another sandbox evaluation rather than a final judgment.
107
114
 
108
- Fetch it with:
109
-
110
- ```bash
111
- curl -H "Authorization: Bearer YOUR_JWT" \
112
- https://valiron-edge-proxy.onrender.com/operator/analytics/agents/AGENT_ID/prediction
113
- ```
115
+ Review forecasts on the agent detail page in the Valiron dashboard. Use the SDK trust gate for runtime enforcement.
114
116
 
115
117
  ## Checking an Agent's Trust Status
116
118
 
117
119
  ```typescript
118
120
  import { ValironSDK } from "@valiron/sdk";
119
121
 
120
- const valiron = new ValironSDK();
122
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY });
121
123
  const result = await valiron.triggerSandboxTest("AGENT_ID");
122
124
 
123
125
  console.log(`Tier: ${result.tier}`);
@@ -135,6 +137,7 @@ Use selected signals in middleware:
135
137
 
136
138
  ```typescript
137
139
  app.use("/api/paid", createValironGate({
140
+ verifyRequest: verifyAgentRequest,
138
141
  sdk: valiron,
139
142
  trustSignals: ["8004", "sandbox"],
140
143
  minScore: 70,
package/docs/llms.txt CHANGED
@@ -1,347 +1,105 @@
1
1
  # Valiron
2
2
 
3
- ## Access and data boundaries
3
+ Valiron provides decision-time agent access control, crawler protection and a separate hosted API Scaffolding product. These documents describe the hardened source contract. Merging source, publishing npm packages and deploying production services are separate steps; confirm the installed version supports the verifier/signer and provider proof v2 contract before upgrading.
4
4
 
5
- Public profile endpoints return identity and trust summaries. They do not return raw behavioral metrics, stored-evidence links, RPC URLs, internal errors, or verification-provider records. Self and World ID responses return an allowlisted verification summary; nullifiers, credential subjects, and provider storage references are private.
6
-
7
- Sandbox runs require an operator API key. Enriched profiles, the trust-gated proxy, and webhook registration require a Pro operator API key. Webhook deliveries are scoped to the operator that initiated the evaluation and the selected chain. Legacy global evaluation history and platform statistics are restricted to Valiron administrators; use authenticated operator analytics for your own account.
8
-
9
- The gate also requires agent challenge-response headers (`x-agent-address` plus a valid `x-agent-session`, or a signed fresh challenge). Operator credentials do not replace agent identity. See [authentication](https://www.valiron.co/auth.md).
10
-
11
-
12
- ## Valiron Developer Resources
13
-
14
- - [Valiron developer portal](https://www.valiron.co/developers): REST API, SDK, authentication, webhooks, and MCP setup.
15
- - [Valiron OpenAPI specification](https://www.valiron.co/openapi.json): Machine-readable public API contract.
16
- - [Valiron public API discovery](https://www.valiron.co/api): API URLs and integration resources, no authentication required.
17
- - [Valiron API health](https://www.valiron.co/api/health): Live availability and supported chains, no authentication required.
18
- - [Valiron authentication](https://www.valiron.co/auth.md): Operator keys and agent identity proofs.
19
- - [Valiron API and webhook reference](https://www.valiron.co/docs/agents/API-REFERENCE.md): REST endpoints and evaluation-complete webhooks.
20
- - [Valiron MCP server](https://www.valiron.co/mcp): Streamable HTTP (POST), no API key; public health, agent profiles, and integration docs.
21
- - [Valiron MCP setup](https://www.valiron.co/docs/agents/MCP.md): Client configuration, tool scope, and transport details.
22
-
23
-
24
- > Protect your API endpoints from bad or malicious AI agents.
25
-
26
- Valiron is trust and reputation middleware for API sellers. It evaluates incoming AI agents using on-chain identity (ERC-8004/Solana), key-based identity for local/Web2/non-ERC-8004 agents, behavioral sandbox testing, optional wallet-history intelligence, predictive risk forecasts, and Moody's-style credit ratings (AAA to C). Trustworthy agents get production access. Risky agents are throttled, sandboxed, or blocked — automatically.
27
-
28
- ## Identity Paths
29
-
30
- On-chain agents use x-agent-id and GET /operator/agent/{agentId}. The agentId is an ERC-8004 token ID, Solana Metaplex Core asset pubkey, or supported indexed Solana ID.
31
-
32
- Local, Web2, and non-ERC-8004 agents use x-agent-address plus challenge-response auth. Do not send a local agent name to /operator/agent/{agentId}. Generate or reuse a persistent Ethereum-style keypair, request POST /operator/key/{agentAddress}/challenge, sign the challenge, verify with POST /operator/key/verify, then use x-agent-address and x-agent-session on gated requests. Agents can follow https://www.valiron.co/auth.md.
33
-
34
- Provider-backed identity uses SDK 1.3 signing helpers and x-valiron-identity-* proof headers. Agents call createAgentIdentityProof() and agentIdentityProofHeaders(); API owners use createValironIdentityGate(), valironIdentityFastifyPlugin, createValironIdentityNextMiddleware, or valironIdentityGateCheck. The headers are untrusted proof inputs until the gate hashes exact request bytes, calls verifyAgentIdentity(), prevents replay, and enforces allow|limit|challenge|block. Valiron hosts ANS credentials and CA trust; customers do not configure them. See https://www.valiron.co/docs/agents/PROVIDER-IDENTITY.md.
35
-
36
- ## API
37
-
38
- Base URL: https://valiron-edge-proxy.onrender.com
39
-
40
- ### Check agent trust profile
41
- GET /operator/agent/{agentId}?chain={chain}
42
-
43
- ### Lookup by wallet
44
- GET /operator/wallet/{wallet}?chain={chain}
45
-
46
- ### Wallet-history risk (Pro)
47
- GET /operator/wallet-risk/{wallet}?chain={chain}
48
- Requires: Authorization: Bearer val_op_...
49
- Returns: { available, wallet, network, provider, score, rawScore, risk, confidence, riskLevel, reasons, hardFlags, features, observedAt, expiresAt, error? }
50
-
51
- ### Resolve wallet to agent ID
52
- GET /operator/resolve-wallet/{wallet}?chain={chain}
53
- Returns: { wallet, agentId, source, chainId?, agentName?, timestamp }
54
- Resolution returns a registered agent ID when available, or null.
55
-
56
- ### Run sandbox test (on-chain agent)
57
- POST /operator/trigger-sandbox/{agentId}
58
-
59
- ### Run sandbox test (key-based agent)
60
- POST /operator/trigger-sandbox-key/{agentAddress}
61
-
62
- ### Key-based agent challenge
63
- POST /operator/key/{agentAddress}/challenge
64
-
65
- ### Verify key-based agent
66
- POST /operator/key/verify
67
-
68
- ### Key-based agent profile
69
- GET /operator/key/{agentAddress}
70
-
71
- ### Provider-backed identity proof
72
- POST /operator/identity/verify
73
- Body: { provider, agentId, signature, timestamp, nonce, requestDigest, keyId?, policy? }
74
- Returns: { agentId, provider, organization, identityStatus, humanIdentified, stableIdentityId, credentialId?, credentialVersion?, externalTrust?, verifiedAt, failureReason?, reputationScore, riskLevel, policyDecision }
75
-
76
- ### Trust gate (allow/deny)
77
- POST /operator/gate/{agentId}
78
- Body: { "ttlMs": 86400000 }
79
-
80
- ### Behavioral snapshot hash
81
- GET /operator/agent/{agentId}/snapshot
82
-
83
- ### Liveness check (Solana only)
84
- GET /operator/agent/{agentId}/liveness?chain=solana
85
-
86
- ### Register webhook
87
- POST /operator/webhooks/register
88
- Body: { "event": "evaluation_complete", "url": "https://your-endpoint.com/hooks", "agentIds": [42] }
89
-
90
- ### Health check
91
- GET /operator/health
92
-
93
- ## SDK
94
-
95
- Install: npm install @valiron/sdk
96
-
97
- ```typescript
98
- import { ValironSDK, createValironIdentityGate } from "@valiron/sdk";
99
- const valiron = new ValironSDK({ chain: "ethereum" });
100
-
101
- // Quick routing check
102
- const route = await valiron.checkAgent("AGENT_ID");
103
- // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
104
-
105
- // Full profile
106
- const profile = await valiron.getAgentProfile("AGENT_ID");
107
-
108
- // Pro wallet-history assessment
109
- const walletRisk = await valiron.getWalletRisk("0x...", { chain: "base" });
110
-
111
- // Resolve wallet → agentId (lightweight)
112
- const res = await valiron.resolveWallet("0x...");
113
- // Returns: { agentId, source: "redis"|"subgraph"|"cache"|"none" }
114
-
115
- // Trust gate (allow/deny for payments)
116
- const gate = await valiron.gate("AGENT_ID");
117
- if (gate.allow) { /* proceed */ }
118
-
119
- // Behavioral snapshot (for hash-chain commitments)
120
- const snapshot = await valiron.getAgentSnapshot("AGENT_ID");
121
- console.log(snapshot.snapshotHash); // "0xabc..."
122
- console.log(snapshot.previousHash); // "0x0" (genesis)
123
-
124
- // Sandbox evaluation for key-based agent
125
- const keyResult = await valiron.triggerKeyAgentSandbox("0x1234...abcd");
126
- console.log(keyResult.tier); // "A"
5
+ ## Documentation
127
6
 
128
- // Provider identity: low-level verification
129
- const identity = await valiron.verifyAgentIdentity(proof, { claimed: "block" });
7
+ - Product guides: https://www.valiron.co/docs
8
+ - Complete guides: https://www.valiron.co/llms-full.txt
9
+ - Quickstart: https://www.valiron.co/docs/agents/QUICKSTART.md
10
+ - Security upgrade: https://www.valiron.co/docs/agents/SECURITY-UPGRADE-2026-10-31.md
11
+ - SDK: https://www.valiron.co/docs/agents/SDK-REFERENCE.md
12
+ - REST API: https://www.valiron.co/docs/agents/API-REFERENCE.md
13
+ - Provider identity: https://www.valiron.co/docs/agents/PROVIDER-IDENTITY.md
14
+ - Identity and enrollment: https://www.valiron.co/docs/agents/IDENTITY.md
15
+ - Key enrollment: https://www.valiron.co/auth.md
16
+ - Crawler protection: https://www.valiron.co/docs/agents/CRAWLER-PROTECTION.md
17
+ - Hosted wrappers: https://www.valiron.co/docs/agents/AGENT-READY-APIS.md
18
+ - Dashboard: https://www.valiron.co/docs/agents/DASHBOARD.md
19
+ - Trust model: https://www.valiron.co/docs/agents/TRUST-MODEL.md
20
+ - Errors: https://www.valiron.co/docs/agents/ERRORS.md
21
+ - OpenAPI: https://www.valiron.co/openapi.json
130
22
 
131
- // Provider identity: route enforcement
132
- app.post("/api/quote", createValironIdentityGate({ sdk: valiron }), handler);
133
- ```
23
+ ## Account and API access
134
24
 
135
- Auto-sandbox: Middleware automatically triggers sandbox evaluation for new agents (on-chain with totalFeedback=0, or key-based with no score). Returns 403 with { error: "Agent pending evaluation", retryAfterMs: 30000 }.
25
+ Create an operator account at https://www.valiron.co/dashboard. Password signup requires email verification; Google/GitHub signup enters the same resumable setup. Keep operator API keys server-side. Base API URL: https://valiron-edge-proxy.onrender.com.
136
26
 
137
- ## API Scaffolding
27
+ Profile/status reads and trust operations require Authorization: Bearer val_op_.... Missing, invalid or revoked credentials return 401. Health and key-registration challenge/verify are intentionally accessible without an operator key. Key enrollment establishes possession of that key, not authority for later requests. The private Icebreaker view accepts a Pro operator key or a verified agent session scoped to its own address. Legacy global evaluation histories and platform statistics are administrator-only; use account-scoped dashboard analytics.
138
28
 
139
- Valiron's core product is middleware deployed within the API seller's backend. API Scaffolding is a separate product for organizations that require a hosted, agent-facing wrapper URL for an existing HTTPS API. It can serve as an evaluation path before adopting a first-party backend integration protected by Valiron middleware. Operators create wrappers in the dashboard under Make API Agent-Ready or via POST /operator/endpoints. Agents call:
29
+ Profiles return allowlisted identity/trust summaries, not raw behavioral metrics, evidence-storage URLs, credential subjects or nullifiers. Social Graph (Icebreaker) is Pro; standard identity, World ID, Self, wallet signals and crawler protection are included with Free within limits.
140
30
 
141
- GET/POST/etc /wrap/{operatorId}/{path}
31
+ ## Fresh request verification
142
32
 
143
- Wrapper config fields: path, method, targetUrl (upstream API base URL), pricePerCall, paymentProtocol ("x402" or "mpp"), paymentNetwork ("eip155:8453", "eip155:84532", "tempo:4217", or "tempo:42431"), payoutAddress, trustEnabled, rateLimit, upstreamAuthType, upstreamAuthHeader, upstreamAuthSecret.
33
+ x-agent-id identifies an ERC-8004 token ID or Solana asset/indexed ID. x-agent-address identifies a persistent Ethereum-style key-based agent. Neither header proves the current caller controls that identity.
144
34
 
145
- Free wrappers (pricePerCall=0) forward directly to targetUrl. x402 paid wrappers return 402 with x402 payment challenge and require retry with X-PAYMENT. MPP paid wrappers return 402 with WWW-Authenticate: Payment and require retry with Authorization: Payment. Trust-enabled wrappers require x-agent-id and deny untrusted agents before forwarding. Use SDK middleware in your own backend when you need to support x-agent-address. Wrapper controls and analytics apply only to traffic sent to `/wrap/{operatorId}/{path}`: publish that URL to agents and protect any public origin with HMAC upstream auth, rejecting direct unsigned requests. Do not treat `x-valiron-*` metadata headers as credentials.
35
+ createValironGate, valironFastifyPlugin, createValironNextMiddleware and operator paywalls require verifyRequest(request, identifier). valironGateCheck requires verifyRequest(identifier); capture the current request in that callback. The verifier is application-owned, not a header-presence test or an SDK stub. Verify cryptographic control, identity, method, full URL, body, freshness and atomic nonce replay protection. It runs before cached reputation. Missing/invalid proof returns AGENT_OWNERSHIP_REQUIRED (401). Profile lookup, prior key enrollment, human linkage and payment do not replace action authorization.
146
36
 
147
- ## Operator SDK (ValironOperator)
37
+ Cached decisions include signal selection and score threshold. Pending or provisional sandbox results deny production access. A real completed evaluation is required. Preserve the same identity and retry with a new proof after retryAfterMs.
148
38
 
149
- For API sellers who want to monetize endpoints. Requires a `val_op_` API key from the dashboard.
39
+ Hosted gate, proxy, World ID enrollment and Self session POSTs require operator credentials plus a fresh registry-owner request proof. Configure ValironSDK signRequest({method,url,body,chain}) to return x-agent-timestamp (13-digit milliseconds), x-agent-nonce (24–128 URL-safe characters) and x-agent-request-signature. The owner signs valiron-wallet-request-v2 with agent, chain, method, full public URL, SHA-256 of the serialized parsed JSON body, timestamp and nonce. EVM uses EIP-191; Solana uses Ed25519/base64url. The timestamp window is 60 seconds. The nonce is consumed atomically. A previous x-agent-session is not accepted instead.
150
40
 
151
41
  ```typescript
152
- import { ValironOperator } from '@valiron/sdk';
153
-
154
- const operator = new ValironOperator({ apiKey: 'val_op_xxxx' });
155
-
156
- // Express: one line to monetize an endpoint
157
- app.use('/api/inference', operator.paywall({
158
- pricePerCall: 0.05,
159
- minTrustScore: 45,
160
- }));
161
-
162
- // Fastify: register as plugin
163
- app.register(operator.fastifyPaywall({
164
- pricePerCall: 0.10,
165
- prefix: '/api',
42
+ import { ValironSDK, createValironGate } from '@valiron/sdk';
43
+ import { verifyAgentRequest } from './request-proof-verifier'; // application code
44
+ const valiron = new ValironSDK({ apiKey: process.env.VALIRON_API_KEY, chain: 'ethereum' });
45
+ app.use('/api/paid', createValironGate({
46
+ sdk: valiron,
47
+ verifyRequest: verifyAgentRequest,
48
+ trustSignals: ['8004', 'sandbox', 'wallet'],
49
+ minScore: 65,
166
50
  }));
167
-
168
- // req.valiron is populated with gate result + pricing
169
- app.post('/api/inference', (req, res) => {
170
- console.log(req.valiron.tier); // 'AAA'
171
- console.log(req.valiron.pricePerCall); // 0.05
172
- res.json({ result: 'output' });
173
- });
174
51
  ```
175
52
 
176
- PaywallConfig options: pricePerCall (number, required), minTrustScore (number, default 45), ttlMs (number, default 86400000), onDeny (callback), onAllow (callback).
53
+ For ANS/provider identity, use createAgentIdentityProof and agentIdentityProofHeaders in the agent, and createValironIdentityGate or the Fastify/Next/generic identity gates in the API. Proof v2 binds audience, uppercase method, exact full URL and SHA-256 of raw request bytes. Configure the receiver's audience and trusted origin; never derive authorization context from caller-supplied headers. Capture raw bytes before body parsing. v1 proofs cannot authorize a request. Valiron hosts the ANS resolver/CA credentials. anonymous/claimed/verified describe evidence, not a known human or guaranteed good behavior. Policy actions are allow, limit, challenge and block.
177
54
 
178
- ## Trust Model
55
+ ## SDK and API operations
179
56
 
180
- Valiron evaluates agents using six independent trust signals:
57
+ Install @valiron/sdk for agent identity/access. Authenticated profile methods include checkAgent, getAgentProfile, getKeyAgentProfile, getKeyAgentIcebreaker (Pro), getWalletRisk and resolveWallet. Profile reads are evidence lookups, not caller authentication. Do not supply local names such as my-agent to registry-agent endpoints.
181
58
 
182
- 1. **On-Chain Reputation (ERC-8004)** — Feedback from other agents/operators (0-100 per review).
183
- 2. **Behavioral Sandbox** — Simulated API interactions testing rate-limit compliance, auth behavior, payment handling, injection safety, PII handling, session isolation, and task completion. Exact weights are proprietary.
184
- 3. **World ID** — Proof-of-personhood via Worldcoin. Verification levels: orb (biometric, highest boost), device (passkey), phone (SMS).
185
- 4. **Self** — Self Enterprise eligible-human proof via signed session webhooks, with optional Self Agent ID binding.
186
- 5. **Icebreaker** — Human attestation via Ethereum Attestation Service (EAS) on Base. A human attests this is their "designated agent."
187
- 6. **Wallet Intelligence** (Pro) — Bounded Alchemy history on Ethereum/Base/Arbitrum/Optimism/Polygon or Helius signature history on Solana. Returns a trust score, inverse risk, confidence, reasons, hard flags, and normalized activity features.
59
+ - GET /operator/agent/{agentId}?chain={chain}: registry profile summary.
60
+ - GET /operator/key/{agentAddress}: key-agent summary; social fields are redacted.
61
+ - POST /operator/key/{agentAddress}/challenge and POST /operator/key/verify: key registration.
62
+ - POST /operator/identity/verify: provider proof with provider, agentId, signature, timestamp, nonce, requestDigest, audience, method, url and optional keyId/policy.
63
+ - POST /operator/gate/{agentId}: hosted owner-signed gate; inspect allow before serving an action.
64
+ - POST /operator/trigger-sandbox/{agentId} and /operator/trigger-sandbox-key/{agentAddress}: authenticated evaluation.
65
+ - POST /proxy/{agentId}: owner-signed forwarding to permitted public HTTPS only.
66
+ - GET /operator/agent/{agentId}/snapshot: opaque hashes and timestamp; no private evidence-storage URL.
67
+ - POST /operator/webhooks/register?chain={chain}: authenticated, operator/chain-scoped callbacks. Use chain=key for key-agent events; re-register older subscriptions.
188
68
 
189
- Wallet intelligence is confidence-damped toward neutral when history is sparse. Provider failures are excluded from composite scoring. Current adapters do not provide sanctions, mixer, scam, or criminal attribution and do not trace complete transaction history.
69
+ SDK identifiers are validated/encoded before network calls. Credentialed calls reject redirects. Public upstream requests pin validated DNS, reject private/link-local/mapped addresses and redirects, and enforce time/body limits.
190
70
 
191
- Predictive risk is available in the dashboard/API for observed agents. It forecasts the next score, pass probability, trend, confidence, recommended policy, suggested tests, and reasons from recent sandbox evaluations, behavioral fingerprints, and operator call logs. It does not replace the trust gate; low-confidence forecasts mean more evaluation data is needed.
71
+ ## Human linkage
192
72
 
193
- ## Trust Tiers
73
+ World ID enrollment requires an authenticated operator, a fresh registry-owner signature and the complete unmodified production IDKit result in idkit_result. The server verifies the configured RP/action. Current enrollment accepts proof-of-human credentials and derives strength from verified evidence; a caller-supplied device/phone/orb label is insufficient. Legacy links require re-verification.
194
74
 
195
- Valiron assigns Moody's-style credit tiers: AAA (highest trust) through C (lowest trust). Higher tiers route to production, lower tiers are sandboxed or blocked. Exact score ranges are not disclosed.
75
+ Self session creation also requires operator and owner approval. Only new owner-authorized sessions can establish trusted links through signed provider callbacks. Omit return URLs or use the allowed https://valiron.co origin. Direct verifySelf ingestion is not a hosted customer integration. Use createSelfSession, getSelfStatus and getSelfProfile. Human linkage does not grant consent for every purchase or action.
196
76
 
197
- | Tier | Meaning | Route |
198
- |------|---------|-------|
199
- | AAA | Prime | prod |
200
- | AA | High grade | prod |
201
- | A | Upper medium | prod |
202
- | BAA | Medium grade | prod_throttled |
203
- | BA | Speculative | prod_throttled |
204
- | B | Highly speculative | sandbox |
205
- | CAA | Substantial risk | sandbox_only |
206
- | CA | Extremely speculative | sandbox_only |
207
- | C | Default risk | sandbox_only |
77
+ ## Pricing, quotas and billing
208
78
 
209
- ## Key Behaviors That Affect Trust
79
+ Free: 10,000 agent requests and a separate 10,000 bot-protection requests per UTC calendar month, three endpoints and five sandbox runs/day. Pro: $149/month, 100,000 requests per product and Social Graph. Enterprise: founders@valiron.co. Limits do not auto-upgrade or charge accounts.
210
80
 
211
- - Respect 429 rate limits
212
- - Honor Retry-After headers
213
- - Use exponential backoff
214
- - Don't retry 401/403 auth errors
215
- - Stay in scope — don't probe unauthorized paths
216
- - Don't forward injections or tainted payloads
217
- - Handle 402 payment required correctly
218
- - Maintain session isolation
81
+ Hosted wrappers apply payment validation, local rate limits and trust admission before charging the owner's monthly allowance. Rejected calls do not consume that allowance; admitted calls can count even if the upstream later fails. Crawler local access/rate denials also precede monthly admission. Database operations are not counted as additional monthly crawler requests. Storage failures fail closed.
219
82
 
220
- ## Contracts
83
+ Checkout/subscriptions are bound to the authenticated operator's customer identity, not a supplied checkout email. Promotion eligibility is handled by Stripe checkout. Successful password resets revoke existing operator sessions and API keys; sign in again and replace affected integration keys.
221
84
 
222
- ### EVM (ERC-8004, same address all chains)
85
+ ## Hosted API Scaffolding
223
86
 
224
- - Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
225
- - Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
87
+ Configure an existing public HTTPS upstream in Dashboard → API Scaffolding. Agents call /wrap/{operatorId}/{path}. Wrappers apply configured payment (x402 or MPP), trust, rate and forwarding policies. Protect origins against direct bypass using HMAC upstream authentication; x-valiron-* metadata is not an origin credential.
226
88
 
227
- ### Solana (QuantuLabs 8004-solana)
89
+ Trust-enabled wrappers require x-agent-id, x-chain matching the signed network, and the fresh owner-proof headers above. A payment proof alone is insufficient. A signed payment retry must use a new identity nonce. Only supported on-chain identities are accepted here; use your own SDK middleware for key-based agents. Disabling wrapper trust skips identity/trust policy, not rate, monthly quota or safe-forwarding controls.
228
90
 
229
- - Identity Registry: 8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ
230
- - Reputation Registry (ATOM): AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb
91
+ ## Crawler Protection
231
92
 
232
- ## Supported Chains
93
+ Install @valiron/crawler-protection separately. The standalone Node.js 22+ HTTP gateway fronts origins regardless of backend language; in-process Node/Nuxt adapters and a private authenticated work API/Python client are available. Python/SQLite and Node/Nuxt/MariaDB are tested. Wrap every expensive operation and release capacity only after confirmed settlement/cancellation. Gateway-only limits do not instrument database drivers or protect a bypassed origin.
233
94
 
234
- ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc, gnosis, goat, mantle, megaeth, metis, optimism, scroll, skale_base, soneium, taiko, xlayer, solana
95
+ Supported source evidence uses reviewed official CIDRs, Bing DNS or authenticated verified WAF evidence. User-agent alone grants no verification; generic browser tokens cannot override failed official crawler evidence. Directory approvals include resolved CIDRs and must be reviewed when that evidence changes. Provenance is separate from human identity, reputation or intent.
235
96
 
236
- ## Plans & Limits
97
+ Use a server-side Free/Pro/Enterprise operator key and account-scoped tenant with activateCrawlerProtection(). Leases refresh in the background; protected requests require hosted monthly admission. Expiry/revocation stops new work while confirmed release/recovery remains available. Activation can target an explicitly configured trusted HTTPS service and rejects redirects. Existing public older versions are not retroactively gated.
237
98
 
238
- Free: 3 gated endpoints, 5 sandbox tests/day. Pro: unlimited endpoints, unlimited sandbox, webhooks, proxy gateway, analytics and custom tier thresholds. Pro requires operator API key (val_op_ prefix).
99
+ Uncertain acquisitions use deadlines/cancellation to avoid unstarted holds. Started operations retain conservative holds until confirmed stopped. Recovery pauses admission and reconciles exact IDs with drain evidence; timeout alone does not prove a query stopped. The dashboard validates/exports configuration and shows optional origin-reported telemetry; it does not deploy protection or certify rollout.
239
100
 
240
- ## Proxy Gateway (Pro)
101
+ ## Reporting and errors
241
102
 
242
- Forward requests through Valiron's edge proxy with automatic trust gating, logging, and SSRF protection (blocks private IPs, metadata endpoints). Use `valiron.proxy({ agentId, targetUrl, method?, headers?, body? })`.
243
-
244
- ## Key-Based Agents
245
-
246
- Web2 agents without on-chain identity use EIP-191 challenge-response via `x-agent-address` header. SDK auto-detects. Returns KeyAgentProfile with agentAddress, verified, score, tier, riskLevel, route, icebreaker, reasons, timestamp.
247
-
248
- New key agents are automatically sandbox-evaluated on first gated request. Middleware allows key agents when verified and score >= minScore. Use `triggerKeyAgentSandbox(address)` or `POST /operator/trigger-sandbox-key/{address}` to trigger manually.
249
-
250
- ## World ID Methods
251
-
252
- - verifyWorldId(agentId, proof) — Submit World ID proof
253
- - getWorldIdStatus(agentId) — Check verification status
254
- - getWorldIdProfile(agentId) — Full World ID profile
255
-
256
- ## Self Methods
257
-
258
- - createSelfSession(agentId, request?) — Create a Self Enterprise verification session and redirect the user to `verificationUrl`
259
- - getSelfStatus(agentId) — Check whether the agent has a verified Self eligible-human link
260
- - getSelfProfile(agentId) — Full Self eligible-human and optional Agent ID profile
261
- - verifySelf(agentId, proof) — Trusted-payload ingestion for local/internal tests only; production uses session creation plus signed Self webhooks
262
-
263
- ## Telemetry
264
-
265
- Opt-out anonymous client usage reports. Disable with `telemetry: { enabled: false }`. Supports custom sampleRate (0–1) and custom handler function. Environment defaults to recognized NODE_ENV values, otherwise unknown. Signal selections do not measure successful verifications.
266
-
267
- ## Middleware Error Responses
268
-
269
- All middleware returns actionable JSON. Use the stable `code` for program logic and read `message`, `action`, and `docsUrl` for recovery. Codes: `MISSING_AGENT_IDENTITY` (401), `TRUST_GATE_DENIED` (403), `AGENT_EVALUATION_PENDING` (403; honor `retryAfterMs`), and `TRUST_GATE_UNAVAILABLE` (503, fail-closed). SDK `ValironError` instances preserve the same server code plus `details.action`, `details.requestId`, `details.docsUrl`, and `details.retryAfterMs`.
270
-
271
- ## Solana Notes
272
-
273
- - Use chain: "solana" in SDK or ?chain=solana query parameter
274
- - Agent IDs are base-58 Metaplex Core asset pubkeys or sequential integers (1, 2, 42)
275
- - Wallet addresses are base-58 Solana public keys (not 0x-prefixed)
276
- - Identity and reputation provided by QuantuLabs (separate from EVM 8004 contracts)
277
- - Extra reputation fields: trustTier, qualityScore, confidence, riskScore, uniqueCallers
278
- - Liveness endpoint: GET /operator/agent/{agentId}/liveness?chain=solana
279
- - Feedback write-back: Valiron scores written on-chain via giveFeedback() when enabled by Valiron
280
-
281
- ## Documentation
103
+ SDK diagnostic telemetry remains separately configurable with telemetry.enabled (default true); disable with telemetry: {enabled:false}. Operator usage reporting is disabled by default: new ValironOperator({apiKey,analytics:true}) explicitly opts in. It sends authenticated decision/identity labels, method, status, price and latency while omitting/redacting raw IP addresses, user agents, paths/query strings and arbitrary error messages.
282
104
 
283
- - [Full documentation (llms-full.txt)](https://www.valiron.co/llms-full.txt) — Complete AI-optimized documentation in a single file
284
- - [auth.md](https://www.valiron.co/auth.md) — Agent identity skill (create keypair, authenticate, manage sessions)
285
- - docs/agents/README.md — Index
286
- - docs/agents/QUICKSTART.md — Get started
287
- - docs/agents/AGENT-READY-APIS.md — Hosted x402/MPP wrappers for existing APIs
288
- - docs/agents/DASHBOARD.md — Operator Dashboard (manage endpoints, keys, analytics, playground)
289
- - docs/agents/API-REFERENCE.md — HTTP API reference
290
- - docs/agents/SDK-REFERENCE.md — TypeScript SDK reference
291
- - docs/agents/TRUST-MODEL.md — Trust evaluation and behavioral factors
292
- - docs/agents/IDENTITY.md — ERC-8004 identity and reputation
293
- - docs/agents/PROVIDER-IDENTITY.md — Provider-independent identity proof, replay protection, policy actions, and ANS adapter status
294
- - docs/agents/SANDBOX.md — Sandbox testing environment
295
- - docs/agents/CHAINS.md — Supported blockchains
296
- - docs/agents/ERRORS.md — Error handling and troubleshooting
297
-
298
- ## Operator Dashboard
299
-
300
- Dashboard URL: https://www.valiron.co/dashboard (JWT-authenticated)
301
-
302
- ### Dashboard Features
303
- - Overview: revenue, calls, agents, latency stats + quick start guide
304
- - Agents: view every agent that called your API, drill into per-agent detail with predictive risk
305
- - Analytics: revenue charts (7/30/90 days), top endpoints, today's stats
306
- - Call Logs: paginated log with time/agent/chain/endpoint/status/cost/latency filters
307
- - API Keys: generate, copy, and revoke operator API keys (val_op_ prefix)
308
- - Make API Agent-Ready: create hosted wrappers with upstream base URL, price, x402/MPP protocol, optional trust, rate limit, upstream auth
309
- - Playground: test how agents at different trust levels are evaluated (dry-run or live)
310
- - Settings: update name, view plan and fee rate
311
- - Admin (admin-only): platform stats, all operators
312
-
313
- ### Dashboard API Endpoints (JWT-authenticated)
314
-
315
- POST /operator/register
316
- Body: { "email": "...", "password": "...", "name": "..." }
317
-
318
- POST /operator/login
319
- Body: { "email": "...", "password": "..." }
320
-
321
- GET /operator/me
322
- PATCH /operator/me
323
- Body: { "name": "..." }
324
-
325
- GET /operator/keys
326
- POST /operator/keys/rotate
327
- Body: { "label": "..." }
328
- DELETE /operator/keys/{keyId}
329
-
330
- GET /operator/endpoints
331
- POST /operator/endpoints
332
- Body: { "path": "/weather", "method": "GET", "pricePerCall": 0.001, "description": "...", "rateLimit": 60, "targetUrl": "https://api.example.com", "paymentProtocol": "x402", "paymentNetwork": "eip155:8453", "payoutAddress": "0x...", "trustEnabled": false }
333
- DELETE /operator/endpoints/{endpointId}
334
-
335
- Public wrapper call:
336
- ALL /wrap/{operatorId}/{path}
337
-
338
- GET /operator/analytics/stats
339
- GET /operator/analytics/revenue?days=30
340
- GET /operator/analytics/top-endpoints?limit=10
341
- GET /operator/analytics/agents?sortBy=lastSeen&limit=50&offset=0
342
- GET /operator/analytics/agents/{agentId}
343
- GET /operator/analytics/agents/{agentId}/prediction
344
- GET /operator/analytics/logs?limit=50&offset=0&days=7
345
-
346
- POST /operator/playground
347
- Body: { "method": "GET", "path": "/api/test", "agentId": "25459", "chain": "ethereum", "dryRun": false, "headers": {}, "body": null }
105
+ Handle codes: MISSING_AGENT_IDENTITY (401), AGENT_OWNERSHIP_REQUIRED (401), TRUST_GATE_DENIED (403), AGENT_EVALUATION_PENDING (403; honor retryAfterMs), TRUST_GATE_UNAVAILABLE (503). Ownership failures may contain only code/error; recovery fields are optional. Never fail open or bypass a proof check because a profile was cached.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "1.4.0",
4
- "description": "Official TypeScript SDK for Valiron \u2014 Trust & Reputation Middleware for API Protection",
3
+ "version": "2.0.0",
4
+ "description": "Official TypeScript SDK for Valiron agent identity and API protection",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/vatsashah45/Valiron.git",
@@ -20,7 +20,7 @@
20
20
  "clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true});\"",
21
21
  "build": "pnpm clean && tsc",
22
22
  "dev": "tsc --watch",
23
- "test": "node test/validate-telemetry.mjs && node test/validate.mjs && node test/validate-examples.mjs && node test/validate-middleware.mjs && node test/validate-provider-identity.mjs && node --import tsx test/test-identity.ts",
23
+ "test": "node test/validate-telemetry.mjs && node test/validate.mjs && node test/validate-examples.mjs && node test/validate-middleware.mjs && node test/validate-provider-identity.mjs && node --import tsx test/test-identity.ts && node test/validate-security.mjs",
24
24
  "prepublishOnly": "pnpm build"
25
25
  },
26
26
  "keywords": [
package/docs/MCP.md DELETED
@@ -1,50 +0,0 @@
1
- # Valiron MCP Server
2
-
3
- Connect your MCP client to **https://www.valiron.co/mcp** with **Streamable HTTP** transport. This public server requires no API key. Use the canonical `www` URL directly to avoid redirects during POST requests.
4
-
5
- For clients that accept a remote server configuration:
6
-
7
- ```json
8
- {
9
- "mcpServers": {
10
- "valiron": {
11
- "url": "https://www.valiron.co/mcp"
12
- }
13
- }
14
- }
15
- ```
16
-
17
- Client configuration formats vary; select Streamable HTTP when your client asks for the transport.
18
-
19
- ## Tools
20
-
21
- | Tool | Input | Result |
22
- | --- | --- | --- |
23
- | `get_api_health` | `{}` | Live Valiron API health, supported chains, and default chain |
24
- | `get_agent_profile` | `{"agentId":"42","chain":"ethereum"}` | Allowlisted identity and trust summary for a registered ERC-8004 or Solana agent |
25
- | `get_integration_docs` | `{"topic":"quickstart"}` | Valiron documentation; topics: `quickstart`, `api`, `identity`, `integration`, `errors` |
26
-
27
- The `https://www.valiron.co/api` MCP resource also lists developer links. Profile lookups do not grant access, verify the caller's identity, or run new sandbox tests. MCP exposes public reads only; operator keys, paid signals, account changes, sandbox execution, and access decisions use the [REST API](./API-REFERENCE.md) or SDK. Never put operator secrets in tool arguments.
28
-
29
- ## Transport
30
-
31
- The server uses stateless Streamable HTTP with JSON responses. POST MCP JSON-RPC messages with `Content-Type: application/json` and `Accept: application/json, text/event-stream`. It does not assign session IDs or offer a persistent GET event stream; GET and DELETE return 405. The SDK negotiates supported protocol versions during initialization.
32
-
33
- ```sh
34
- curl https://www.valiron.co/mcp \
35
- -H 'Content-Type: application/json' \
36
- -H 'Accept: application/json, text/event-stream' \
37
- -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"example","version":"1.0.0"}}}'
38
- ```
39
-
40
- Requests are limited to 16 KiB. Process-local admission limits allow 120 requests per minute and 8 concurrent requests per instance; a 429 includes `Retry-After`. Upstream calls time out after 10 seconds and responses are limited to 256 KiB. API failures are returned as MCP tool errors. Browser requests with an Origin header must originate from `https://www.valiron.co` or `https://valiron.co`; server-to-server clients can omit Origin.
41
-
42
- ## Other interfaces
43
-
44
- - [Valiron developer portal](https://www.valiron.co/developers)
45
- - [Valiron OpenAPI specification](https://www.valiron.co/openapi.json)
46
- - [Valiron authentication](https://www.valiron.co/auth.md)
47
- - [Valiron API discovery](https://www.valiron.co/api)
48
- - [Valiron MCP discovery metadata](https://www.valiron.co/.well-known/mcp.json)
49
-
50
- The profile tool strips behavioral metrics, evidence storage links, RPC URLs, and provider verification metadata even if an older upstream API returns them.