@valiron/sdk 1.3.1 → 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.
package/docs/llms.txt CHANGED
@@ -1,332 +1,105 @@
1
1
  # Valiron
2
2
 
3
- > Protect your API endpoints from bad or malicious AI agents.
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
- 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.
6
-
7
- ## Identity Paths
8
-
9
- 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.
10
-
11
- 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.
12
-
13
- 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.
14
-
15
- ## API
16
-
17
- Base URL: https://valiron-edge-proxy.onrender.com
18
-
19
- ### Check agent trust profile
20
- GET /operator/agent/{agentId}?chain={chain}
21
-
22
- ### Lookup by wallet
23
- GET /operator/wallet/{wallet}?chain={chain}
24
-
25
- ### Wallet-history risk (Pro)
26
- GET /operator/wallet-risk/{wallet}?chain={chain}
27
- Requires: Authorization: Bearer val_op_...
28
- Returns: { available, wallet, network, provider, score, rawScore, risk, confidence, riskLevel, reasons, hardFlags, features, observedAt, expiresAt, error? }
29
-
30
- ### Resolve wallet to agent ID
31
- GET /operator/resolve-wallet/{wallet}?chain={chain}
32
- Returns: { wallet, agentId, source, chainId?, agentName?, timestamp }
33
- Resolution: Redis → in-memory cache → Agent0 subgraph → null
34
-
35
- ### Run sandbox test (on-chain agent)
36
- POST /operator/trigger-sandbox/{agentId}
37
-
38
- ### Run sandbox test (key-based agent)
39
- POST /operator/trigger-sandbox-key/{agentAddress}
40
-
41
- ### Key-based agent challenge
42
- POST /operator/key/{agentAddress}/challenge
43
-
44
- ### Verify key-based agent
45
- POST /operator/key/verify
46
-
47
- ### Key-based agent profile
48
- GET /operator/key/{agentAddress}
49
-
50
- ### Provider-backed identity proof
51
- POST /operator/identity/verify
52
- Body: { provider, agentId, signature, timestamp, nonce, requestDigest, keyId?, policy? }
53
- Returns: { agentId, provider, organization, identityStatus, humanIdentified, stableIdentityId, credentialId?, credentialVersion?, externalTrust?, verifiedAt, failureReason?, reputationScore, riskLevel, policyDecision }
54
-
55
- ### Trust gate (allow/deny)
56
- POST /operator/gate/{agentId}
57
- Body: { "ttlMs": 86400000 }
58
-
59
- ### Behavioral snapshot hash
60
- GET /operator/agent/{agentId}/snapshot
61
-
62
- ### Liveness check (Solana only)
63
- GET /operator/agent/{agentId}/liveness?chain=solana
64
-
65
- ### Register webhook
66
- POST /operator/webhooks/register
67
- Body: { "event": "evaluation_complete", "url": "https://your-endpoint.com/hooks", "agentIds": [42] }
68
-
69
- ### Health check
70
- GET /operator/health
71
-
72
- ## SDK
73
-
74
- Install: npm install @valiron/sdk
75
-
76
- ```typescript
77
- import { ValironSDK, createValironIdentityGate } from "@valiron/sdk";
78
- const valiron = new ValironSDK({ chain: "ethereum" });
79
-
80
- // Quick routing check
81
- const route = await valiron.checkAgent("AGENT_ID");
82
- // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
83
-
84
- // Full profile
85
- const profile = await valiron.getAgentProfile("AGENT_ID");
86
-
87
- // Pro wallet-history assessment
88
- const walletRisk = await valiron.getWalletRisk("0x...", { chain: "base" });
89
-
90
- // Resolve wallet → agentId (lightweight)
91
- const res = await valiron.resolveWallet("0x...");
92
- // Returns: { agentId, source: "redis"|"subgraph"|"cache"|"none" }
93
-
94
- // Trust gate (allow/deny for payments)
95
- const gate = await valiron.gate("AGENT_ID");
96
- if (gate.allow) { /* proceed */ }
97
-
98
- // Behavioral snapshot (for hash-chain commitments)
99
- const snapshot = await valiron.getAgentSnapshot("AGENT_ID");
100
- console.log(snapshot.snapshotHash); // "0xabc..."
101
- console.log(snapshot.previousHash); // "0x0" (genesis)
102
-
103
- // Sandbox evaluation for key-based agent
104
- const keyResult = await valiron.triggerKeyAgentSandbox("0x1234...abcd");
105
- console.log(keyResult.tier); // "A"
5
+ ## Documentation
106
6
 
107
- // Provider identity: low-level verification
108
- 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
109
22
 
110
- // Provider identity: route enforcement
111
- app.post("/api/quote", createValironIdentityGate({ sdk: valiron }), handler);
112
- ```
23
+ ## Account and API access
113
24
 
114
- 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.
115
26
 
116
- ## 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.
117
28
 
118
- 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.
119
30
 
120
- GET/POST/etc /wrap/{operatorId}/{path}
31
+ ## Fresh request verification
121
32
 
122
- 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.
123
34
 
124
- 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.
125
36
 
126
- ## 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.
127
38
 
128
- 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.
129
40
 
130
41
  ```typescript
131
- import { ValironOperator } from '@valiron/sdk';
132
-
133
- const operator = new ValironOperator({ apiKey: 'val_op_xxxx' });
134
-
135
- // Express: one line to monetize an endpoint
136
- app.use('/api/inference', operator.paywall({
137
- pricePerCall: 0.05,
138
- minTrustScore: 45,
139
- }));
140
-
141
- // Fastify: register as plugin
142
- app.register(operator.fastifyPaywall({
143
- pricePerCall: 0.10,
144
- 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,
145
50
  }));
146
-
147
- // req.valiron is populated with gate result + pricing
148
- app.post('/api/inference', (req, res) => {
149
- console.log(req.valiron.tier); // 'AAA'
150
- console.log(req.valiron.pricePerCall); // 0.05
151
- res.json({ result: 'output' });
152
- });
153
51
  ```
154
52
 
155
- PaywallConfig options: pricePerCall (number, required), minTrustScore (number, default 45), ttlMs (number, default 86400000), onDeny (callback), onAllow (callback).
156
-
157
- ## Trust Model
158
-
159
- Valiron evaluates agents using six independent trust signals:
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.
160
54
 
161
- 1. **On-Chain Reputation (ERC-8004)** — Feedback from other agents/operators (0-100 per review).
162
- 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.
163
- 3. **World ID** — Proof-of-personhood via Worldcoin. Verification levels: orb (biometric, highest boost), device (passkey), phone (SMS).
164
- 4. **Self** — Self Enterprise eligible-human proof via signed session webhooks, with optional Self Agent ID binding.
165
- 5. **Icebreaker** — Human attestation via Ethereum Attestation Service (EAS) on Base. A human attests this is their "designated agent."
166
- 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.
55
+ ## SDK and API operations
167
56
 
168
- 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.
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.
169
58
 
170
- 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.
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.
171
68
 
172
- ## Trust Tiers
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.
173
70
 
174
- 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.
71
+ ## Human linkage
175
72
 
176
- | Tier | Meaning | Route |
177
- |------|---------|-------|
178
- | AAA | Prime | prod |
179
- | AA | High grade | prod |
180
- | A | Upper medium | prod |
181
- | BAA | Medium grade | prod_throttled |
182
- | BA | Speculative | prod_throttled |
183
- | B | Highly speculative | sandbox |
184
- | CAA | Substantial risk | sandbox_only |
185
- | CA | Extremely speculative | sandbox_only |
186
- | C | Default risk | sandbox_only |
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.
187
74
 
188
- ## Key Behaviors That Affect Trust
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.
189
76
 
190
- - Respect 429 rate limits
191
- - Honor Retry-After headers
192
- - Use exponential backoff
193
- - Don't retry 401/403 auth errors
194
- - Stay in scope — don't probe unauthorized paths
195
- - Don't forward injections or tainted payloads
196
- - Handle 402 payment required correctly
197
- - Maintain session isolation
77
+ ## Pricing, quotas and billing
198
78
 
199
- ## Contracts
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.
200
80
 
201
- ### EVM (ERC-8004, same address all chains)
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.
202
82
 
203
- - Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
204
- - Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
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.
205
84
 
206
- ### Solana (QuantuLabs 8004-solana)
85
+ ## Hosted API Scaffolding
207
86
 
208
- - Identity Registry: 8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ
209
- - Reputation Registry (ATOM): AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb
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.
210
88
 
211
- ## Supported Chains
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.
212
90
 
213
- ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc, gnosis, goat, mantle, megaeth, metis, optimism, scroll, skale_base, soneium, taiko, xlayer, solana
91
+ ## Crawler Protection
214
92
 
215
- ## Plans & Limits
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.
216
94
 
217
- Free: 3 gated endpoints, 5 sandbox tests/day. Pro: unlimited endpoints, unlimited sandbox, webhooks, proxy gateway, analytics, evaluation history, custom tier thresholds. Pro requires operator API key (val_op_ prefix).
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.
218
96
 
219
- ## Proxy Gateway (Pro)
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.
220
98
 
221
- 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? })`.
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.
222
100
 
223
- ## Key-Based Agents
101
+ ## Reporting and errors
224
102
 
225
- 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.
226
-
227
- 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.
228
-
229
- ## World ID Methods
230
-
231
- - verifyWorldId(agentId, proof) — Submit World ID proof
232
- - getWorldIdStatus(agentId) — Check verification status
233
- - getWorldIdProfile(agentId) — Full World ID profile
234
-
235
- ## Self Methods
236
-
237
- - createSelfSession(agentId, request?) — Create a Self Enterprise verification session and redirect the user to `verificationUrl`
238
- - getSelfStatus(agentId) — Check whether the agent has a verified Self eligible-human link
239
- - getSelfProfile(agentId) — Full Self eligible-human and optional Agent ID profile
240
- - verifySelf(agentId, proof) — Trusted-payload ingestion for local/internal tests only; production uses session creation plus signed Self webhooks
241
-
242
- ## Telemetry
243
-
244
- 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.
245
-
246
- ## Middleware Error Responses
247
-
248
- 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`.
249
-
250
- ## Solana Notes
251
-
252
- - Use chain: "solana" in SDK or ?chain=solana query parameter
253
- - Agent IDs are base-58 Metaplex Core asset pubkeys or sequential integers (1, 2, 42)
254
- - Wallet addresses are base-58 Solana public keys (not 0x-prefixed)
255
- - Identity and reputation provided by QuantuLabs (separate from EVM 8004 contracts)
256
- - Extra reputation fields: trustTier, qualityScore, confidence, riskScore, uniqueCallers
257
- - Liveness endpoint: GET /operator/agent/{agentId}/liveness?chain=solana
258
- - Feedback write-back: Valiron scores written on-chain via giveFeedback() (requires SOLANA_FEEDBACK_KEYPAIR env var)
259
-
260
- ## 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.
261
104
 
262
- - [Full documentation (llms-full.txt)](https://www.valiron.co/llms-full.txt) — Complete AI-optimized documentation in a single file
263
- - [auth.md](https://www.valiron.co/auth.md) — Agent identity skill (create keypair, authenticate, manage sessions)
264
- - docs/agents/README.md — Index
265
- - docs/agents/QUICKSTART.md — Get started
266
- - docs/agents/AGENT-READY-APIS.md — Hosted x402/MPP wrappers for existing APIs
267
- - docs/agents/DASHBOARD.md — Operator Dashboard (manage endpoints, keys, analytics, playground)
268
- - docs/agents/API-REFERENCE.md — HTTP API reference
269
- - docs/agents/SDK-REFERENCE.md — TypeScript SDK reference
270
- - docs/agents/TRUST-MODEL.md — Trust evaluation and behavioral factors
271
- - docs/agents/IDENTITY.md — ERC-8004 identity and reputation
272
- - docs/agents/PROVIDER-IDENTITY.md — Provider-independent identity proof, replay protection, policy actions, and ANS adapter status
273
- - docs/agents/SANDBOX.md — Sandbox testing environment
274
- - docs/agents/CHAINS.md — Supported blockchains
275
- - docs/agents/ERRORS.md — Error handling and troubleshooting
276
-
277
- ## Operator Dashboard
278
-
279
- Dashboard URL: https://www.valiron.co/dashboard (JWT-authenticated)
280
-
281
- ### Dashboard Features
282
- - Overview: revenue, calls, agents, latency stats + quick start guide
283
- - Agents: view every agent that called your API, drill into per-agent detail with predictive risk
284
- - Analytics: revenue charts (7/30/90 days), top endpoints, today's stats
285
- - Call Logs: paginated log with time/agent/chain/endpoint/status/cost/latency filters
286
- - API Keys: generate, copy, and revoke operator API keys (val_op_ prefix)
287
- - Make API Agent-Ready: create hosted wrappers with upstream base URL, price, x402/MPP protocol, optional trust, rate limit, upstream auth
288
- - Playground: test how agents at different trust levels are evaluated (dry-run or live)
289
- - Settings: update name, view plan and fee rate
290
- - Admin (admin-only): platform stats, all operators
291
-
292
- ### Dashboard API Endpoints (JWT-authenticated)
293
-
294
- POST /operator/register
295
- Body: { "email": "...", "password": "...", "name": "..." }
296
-
297
- POST /operator/login
298
- Body: { "email": "...", "password": "..." }
299
-
300
- GET /operator/me
301
- PATCH /operator/me
302
- Body: { "name": "..." }
303
-
304
- GET /operator/keys
305
- POST /operator/keys/rotate
306
- Body: { "label": "..." }
307
- DELETE /operator/keys/{keyId}
308
-
309
- GET /operator/endpoints
310
- POST /operator/endpoints
311
- 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 }
312
- DELETE /operator/endpoints/{endpointId}
313
-
314
- Public wrapper call:
315
- ALL /wrap/{operatorId}/{path}
316
-
317
- GET /operator/analytics/stats
318
- GET /operator/analytics/revenue?days=30
319
- GET /operator/analytics/top-endpoints?limit=10
320
- GET /operator/analytics/agents?sortBy=lastSeen&limit=50&offset=0
321
- GET /operator/analytics/agents/{agentId}
322
- GET /operator/analytics/agents/{agentId}/prediction
323
- GET /operator/analytics/logs?limit=50&offset=0&days=7
324
-
325
- POST /operator/playground
326
- Body: { "method": "GET", "path": "/api/test", "agentId": "25459", "chain": "ethereum", "dryRun": false, "headers": {}, "body": null }
327
-
328
- ### Admin Endpoints (require role: "admin")
329
- GET /operator/admin/stats
330
- GET /operator/admin/operators
331
- GET /operator/admin/operators/{id}
332
- GET /operator/admin/operators/{id}/logs
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.3.1",
4
- "description": "Official TypeScript SDK for Valiron — 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": [
@@ -46,8 +46,24 @@
46
46
  }
47
47
  },
48
48
  "files": [
49
- "dist",
50
- "docs",
49
+ "dist/clients.js",
50
+ "dist/clients.d.ts",
51
+ "dist/identity.js",
52
+ "dist/identity.d.ts",
53
+ "dist/identityMiddleware.js",
54
+ "dist/identityMiddleware.d.ts",
55
+ "dist/index.js",
56
+ "dist/index.d.ts",
57
+ "dist/middleware.js",
58
+ "dist/middleware.d.ts",
59
+ "dist/operatorSdk.js",
60
+ "dist/operatorSdk.d.ts",
61
+ "dist/telemetry.js",
62
+ "dist/telemetry.d.ts",
63
+ "dist/types.js",
64
+ "dist/types.d.ts",
65
+ "docs/*.md",
66
+ "docs/llms.txt",
51
67
  "README.md"
52
68
  ]
53
69
  }