@valiron/sdk 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,81 +1,46 @@
1
1
  # @valiron/sdk
2
2
 
3
- Official TypeScript SDK for **Valiron** — Trust Infrastructure for AI Agent Systems
3
+ Official TypeScript SDK for **Valiron** — Trust & Reputation Middleware for API Protection
4
4
 
5
- Valiron verifies AI agent trustworthiness using on-chain reputation (ERC-8004) and behavioral analysis. This SDK provides routing decisions based on agent trust scores, enabling you to protect infrastructure while maintaining service availability for verified agents.
5
+ Protect your API endpoints from bad or malicious AI agents. Valiron evaluates incoming agents using on-chain identity (ERC-8004), behavioral sandbox testing, and Moody's-style credit ratings — so you can allow trusted agents and block risky ones automatically.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
10
  npm install @valiron/sdk
11
- # or
12
- yarn add @valiron/sdk
13
- # or
14
- pnpm add @valiron/sdk
15
11
  ```
16
12
 
17
13
  ## Quick Start
18
14
 
19
15
  ```typescript
20
- import { ValironSDK } from '@valiron/sdk';
16
+ import { ValironSDK, createValironGate } from "@valiron/sdk";
21
17
 
22
- const valiron = new ValironSDK();
18
+ const valiron = new ValironSDK({ chain: "ethereum" });
23
19
 
24
- // Quick routing check
25
- const route = await valiron.checkAgent('25459');
26
- // route: 'prod' | 'prod_throttled' | 'sandbox' | 'sandbox_only'
20
+ // Check if an agent is trusted
21
+ const route = await valiron.checkAgent("AGENT_ID");
22
+ // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
27
23
 
28
- // Full trust profile
29
- const profile = await valiron.getAgentProfile('25459');
24
+ // Gate an agent — allow/deny decision
25
+ const gate = await valiron.gate("AGENT_ID");
26
+ if (gate.allow) { /* serve the request */ }
30
27
 
31
- // Trust gate for payment endpoints
32
- const gate = await valiron.gate('25459');
33
- if (gate.allow) { /* proceed */ }
34
-
35
- // Behavioral snapshot (for hash-chain commitments)
36
- const snapshot = await valiron.getAgentSnapshot('25459');
37
- console.log(snapshot.snapshotHash); // '0xabc…'
38
- console.log(snapshot.previousHash); // '0x0' (genesis)
39
-
40
- // Multichain — override per-call or at construction
41
- const monadValiron = new ValironSDK({ chain: 'monad' });
42
- await monadValiron.checkAgent('8348');
43
- await valiron.checkAgent('8348', { chain: 'base' });
28
+ // One-line Express middleware — blocks untrusted agents automatically
29
+ app.use("/api/paid", createValironGate({ sdk: valiron }));
44
30
  ```
45
31
 
46
- ## Methods
47
-
48
- | Method | Returns | Description |
49
- |--------|---------|-------------|
50
- | `checkAgent(agentId, opts?)` | `RouteDecision` | Quick routing check |
51
- | `getAgentProfile(agentId, opts?)` | `AgentProfile` | Full trust profile (identity + reputation + routing) |
52
- | `getWalletProfile(wallet, opts?)` | `WalletProfile` | Reverse-lookup wallet → trust profile |
53
- | `resolveWallet(wallet, opts?)` | `WalletResolution` | Lightweight wallet → agentId (Redis → cache → Agent0 subgraph) |
54
- | `triggerSandboxTest(agentId, opts?)` | `SandboxResult` | Run sandbox tests, compute behavioral score |
55
- | `gate(agentId, opts?)` | `GateResult` | Trust gate: reputation + sandbox → allow/deny |
56
- | `getAgentSnapshot(agentId, opts?)` | `AgentSnapshotSummary` | Opaque behavioral snapshot hash for chain commitments |
57
- | `createValironGate(config)` | Express middleware | Drop-in middleware wrapping `gate()` |
58
-
59
- All methods accept an optional `{ chain }` override. See the [full documentation](https://valiron.co/docs) for response shapes, options, and examples.
60
-
61
- ## Telemetry
62
-
63
- Anonymous usage telemetry is collected by default (opt-out). No PII is collected.
64
-
65
- ```ts
66
- const valiron = new ValironSDK({ telemetry: { enabled: false } });
67
-
68
- // Customize
69
- const valiron2 = new ValironSDK({
70
- telemetry: { appId: 'my-app', env: 'prod' },
71
- });
72
- ```
32
+ No API key required for read operations.
73
33
 
74
34
  ## Documentation
75
35
 
76
- - [Full Documentation](https://valiron.co/docs) — interactive docs with all methods, examples, and dynamic pricing
77
- - [llms.txt](https://valiron.co/llms.txt) — compact reference for LLM integration
78
- - [ERC-8004 Standard](https://eips.ethereum.org/EIPS/eip-8004)
36
+ Full SDK reference, API docs, trust model, and integration guides:
37
+
38
+ - **[valiron.co/docs](https://valiron.co/docs)** — interactive documentation
39
+ - **[SDK Reference](https://valiron.co/docs/agents/SDK-REFERENCE.md)** — all methods, options, and response types
40
+ - **[API Reference](https://valiron.co/docs/agents/API-REFERENCE.md)** — HTTP endpoints
41
+ - **[Quickstart](https://valiron.co/docs/agents/QUICKSTART.md)** — get started in 2 minutes
42
+ - **[llms.txt](https://valiron.co/llms.txt)** — compact reference for LLM/agent integration
43
+ - **Install agent skill**: `npx @valiron/skill`
79
44
 
80
45
  ## Support
81
46
 
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * Matches the actual edge-proxy /operator/* endpoints
6
6
  */
7
7
  /** Blockchain networks supported by the Valiron Operator API. */
8
- export type SupportedChain = "ethereum" | "monad" | "arbitrum" | "base" | "avalanche" | "celo" | "polygon" | "linea" | "abstract" | "bsc" | "gnosis" | "goat" | "mantle" | "megaeth" | "metis" | "optimism" | "scroll" | "skale_base" | "soneium" | "taiko" | "xlayer";
8
+ export type SupportedChain = "ethereum" | "monad" | "arbitrum" | "base" | "avalanche" | "celo" | "polygon" | "linea" | "abstract" | "bsc" | "gnosis" | "goat" | "mantle" | "megaeth" | "metis" | "optimism" | "scroll" | "skale_base" | "soneium" | "taiko" | "xlayer" | "base_sepolia" | "ethereum_sepolia" | "abstract_testnet" | "arbitrum_sepolia" | "avalanche_testnet" | "bsc_testnet" | "celo_testnet" | "linea_sepolia" | "mantle_testnet" | "megaeth_testnet" | "metis_sepolia" | "optimism_sepolia" | "polygon_amoy" | "scroll_sepolia" | "skale_base_sepolia" | "soneium_minato" | "taiko_hoodi" | "xlayer_testnet" | "hedera_testnet" | "arc_testnet" | "solana";
9
9
  export type RouteDecision = "prod" | "prod_throttled" | "sandbox" | "sandbox_only";
10
10
  export type RiskLevel = "GREEN" | "YELLOW" | "RED";
11
11
  export type MoodysRating = "AAA" | "AA" | "A" | "BAA" | "BA" | "B" | "CAA" | "CA" | "C";
@@ -42,6 +42,14 @@ export interface OnchainReputation {
42
42
  feedbackEntries: FeedbackEntry[];
43
43
  totalFeedback: number;
44
44
  error?: string;
45
+ /** Solana-specific ATOM engine metrics (only present for Solana agents via QuantuLabs). */
46
+ solana?: {
47
+ trustTier: string;
48
+ qualityScore: number;
49
+ confidence: number;
50
+ riskScore: number;
51
+ uniqueCallers: number;
52
+ };
45
53
  }
46
54
  export interface LocalReputation {
47
55
  exists: boolean;
@@ -78,6 +86,8 @@ export interface ChainContext {
78
86
  rpcUrl: string;
79
87
  identityRegistry: string;
80
88
  reputationRegistry: string;
89
+ /** Solana cluster identifier (only present for Solana). */
90
+ cluster?: "mainnet-beta" | "devnet";
81
91
  }
82
92
  /**
83
93
  * Response from `GET /operator/agent/:agentId`
@@ -68,7 +68,7 @@ Reverse-lookup a wallet address to get its trust profile.
68
68
 
69
69
  | Parameter | Location | Type | Required | Description |
70
70
  |-----------|----------|------|----------|-------------|
71
- | `wallet` | path | string | yes | Ethereum address (0x...) |
71
+ | `wallet` | path | string | yes | Ethereum address (0x...) or Solana pubkey (base-58, with `chain=solana`) |
72
72
  | `chain` | query | string | no | Network override |
73
73
 
74
74
  ### Response — 200 OK
@@ -81,13 +81,13 @@ Same structure as `GET /operator/agent/:agentId`.
81
81
 
82
82
  Lightweight wallet → agentId resolution. Returns just the agent ID and how it was resolved, without the full trust profile.
83
83
 
84
- Resolution chain: Redis → Agent0 subgraph → null.
84
+ Resolution chain: Redis → Agent0 subgraph → null. For Solana (`chain=solana`): QuantuLabs `getAgentsByOwner()`.
85
85
 
86
86
  ### Parameters
87
87
 
88
88
  | Parameter | Location | Type | Required | Description |
89
89
  |-----------|----------|------|----------|-------------|
90
- | `wallet` | path | string | yes | Ethereum address (0x...) |
90
+ | `wallet` | path | string | yes | Ethereum address (0x...) or Solana pubkey (base-58, with `chain=solana`) |
91
91
  | `chain` | query | string | no | Network override (default: ethereum) |
92
92
 
93
93
  ### Response — 200 OK
@@ -291,3 +291,121 @@ Health check endpoint.
291
291
  "defaultChain": "ethereum"
292
292
  }
293
293
  ```
294
+
295
+ ---
296
+
297
+ ## Solana Support
298
+
299
+ All `/operator/*` endpoints support Solana agents when `chain=solana` is passed as a query parameter or `x-chain: solana` header.
300
+
301
+ Solana agent identity and reputation data is provided by [QuantuLabs 8004-solana](https://8004.qnt.sh/), while EVM chains use the 8004 team's registry contracts. The two registries have different schemas — this is by design.
302
+
303
+ ### Key Differences from EVM
304
+
305
+ | Area | EVM | Solana |
306
+ |------|-----|--------|
307
+ | **Agent ID format** | Numeric token ID (e.g. `25459`) | Base-58 Metaplex Core asset pubkey (e.g. `GL4k...`) or sequential ID (e.g. `1`, `42`) |
308
+ | **Wallet format** | `0x`-prefixed hex address | Base-58 public key |
309
+ | **Identity source** | ERC-8004 `ownerOf()` on-chain call | QuantuLabs `loadAgent()` SDK call |
310
+ | **Reputation source** | ERC-8004 `getSummary()` | QuantuLabs ATOM engine (`getEnrichedSummary()`) |
311
+ | **Extra reputation fields** | — | `solana.trustTier`, `solana.qualityScore`, `solana.confidence`, `solana.riskScore`, `solana.uniqueCallers` |
312
+ | **Wallet → Agent resolution** | Redis → Agent0 subgraph | QuantuLabs `getAgentsByOwner()` |
313
+ | **Liveness check** | — | `isItAlive()` endpoint-by-endpoint health probe |
314
+ | **Feedback write-back** | — | Valiron scores written on-chain via `giveFeedback()` (requires `SOLANA_FEEDBACK_KEYPAIR`) |
315
+
316
+ ### Sequential Agent IDs
317
+
318
+ Solana agents are primarily identified by their base-58 asset pubkey, but the QuantuLabs indexer also assigns sequential integer IDs (1, 2, 3, …). You can use either format:
319
+
320
+ ```bash
321
+ # By asset pubkey (primary)
322
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k...?chain=solana"
323
+
324
+ # By sequential ID (convenience)
325
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/42?chain=solana"
326
+ ```
327
+
328
+ When a sequential ID is used, the response includes a `sequentialId` field mapping back to the numeric ID.
329
+
330
+ ### Liveness Check
331
+
332
+ `GET /operator/agent/:agentId/liveness?chain=solana`
333
+
334
+ Pings each service endpoint from the agent's on-chain metadata and returns a health report. Only available for Solana agents.
335
+
336
+ **Response:**
337
+ ```json
338
+ {
339
+ "agentId": "GL4k...",
340
+ "chain": { "network": "solana", "cluster": "mainnet-beta" },
341
+ "liveness": {
342
+ "status": "live",
343
+ "okCount": 3,
344
+ "totalPinged": 3,
345
+ "skippedCount": 0,
346
+ "results": [
347
+ { "type": "rest", "endpoint": "https://...", "ok": true, "latencyMs": 120 }
348
+ ]
349
+ }
350
+ }
351
+ ```
352
+
353
+ The `trigger-sandbox` endpoint also includes a `liveness` summary in its response for Solana agents.
354
+
355
+ ### Feedback Write-Back
356
+
357
+ When `SOLANA_FEEDBACK_KEYPAIR` is configured, Valiron automatically writes evaluation scores back to the Solana reputation registry after sandbox testing and gate evaluations. This closes the trust loop — other consumers of the 8004-solana registry can see Valiron's scores.
358
+
359
+ Feedback is submitted as fire-and-forget using the `starred` tag with `tag2: "valiron"` for attribution.
360
+
361
+ ### Solana-Specific Response Fields
362
+
363
+ When querying a Solana agent, the `onchainReputation` object may include an additional `solana` block with ATOM engine metrics:
364
+
365
+ ```json
366
+ {
367
+ "onchainReputation": {
368
+ "count": "42",
369
+ "averageScore": 88.5,
370
+ "feedbackEntries": [],
371
+ "totalFeedback": 42,
372
+ "solana": {
373
+ "trustTier": "trusted",
374
+ "qualityScore": 92.1,
375
+ "confidence": 0.87,
376
+ "riskScore": 0.08,
377
+ "uniqueCallers": 15
378
+ }
379
+ }
380
+ }
381
+ ```
382
+
383
+ ### Example Requests
384
+
385
+ ```bash
386
+ # Get Solana agent profile
387
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k...?chain=solana"
388
+
389
+ # Get Solana agent by sequential ID
390
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/42?chain=solana"
391
+
392
+ # Gate a Solana agent
393
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/gate/GL4k...?chain=solana"
394
+
395
+ # Check liveness
396
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/GL4k.../liveness?chain=solana"
397
+
398
+ # Look up by Solana wallet
399
+ curl "https://valiron-edge-proxy.onrender.com/operator/wallet/7xKX...?chain=solana"
400
+
401
+ # Trigger sandbox for Solana agent
402
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/GL4k...?chain=solana"
403
+ ```
404
+
405
+ ### Environment Variables
406
+
407
+ | Variable | Default | Description |
408
+ |----------|---------|-------------|
409
+ | `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
410
+ | `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint |
411
+ | `SOLANA_FEEDBACK_KEYPAIR` | — | JSON array secret key (e.g. `[1,2,...,64]`) for feedback write-back. When set, Valiron scores are written on-chain after evaluation. |
package/docs/CHAINS.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # Supported Chains
2
2
 
3
- Valiron operates across 21 blockchain networks. The ERC-8004 contracts are deployed at the same addresses on every chain.
3
+ Valiron operates across 41 EVM blockchain networks plus Solana.
4
4
 
5
- ## Contract Addresses (all chains)
5
+ ## EVM Chains
6
+
7
+ The ERC-8004 contracts are deployed at the same addresses on every EVM chain. Identity and reputation data is provided by the [8004 team](https://erc8004.org).
8
+
9
+ ### Contract Addresses (all EVM chains)
6
10
 
7
11
  | Contract | Address |
8
12
  |----------|---------|
9
13
  | Identity Registry | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` |
10
14
  | Reputation Registry | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` |
11
15
 
12
- ## Supported Networks
16
+ ### Supported EVM Networks
13
17
 
14
18
  | Chain ID | Name | SDK Value |
15
19
  |----------|------|-----------|
@@ -34,6 +38,56 @@ Valiron operates across 21 blockchain networks. The ERC-8004 contracts are deplo
34
38
  | — | Soneium | `soneium` |
35
39
  | — | Taiko | `taiko` |
36
40
  | — | X Layer | `xlayer` |
41
+ | — | Base Sepolia | `base_sepolia` |
42
+ | — | Ethereum Sepolia | `ethereum_sepolia` |
43
+ | — | Abstract Testnet | `abstract_testnet` |
44
+ | — | Arbitrum Sepolia | `arbitrum_sepolia` |
45
+ | — | Avalanche Testnet | `avalanche_testnet` |
46
+ | — | BSC Testnet | `bsc_testnet` |
47
+ | — | Celo Testnet | `celo_testnet` |
48
+ | — | Linea Sepolia | `linea_sepolia` |
49
+ | — | Mantle Testnet | `mantle_testnet` |
50
+ | — | MegaETH Testnet | `megaeth_testnet` |
51
+ | — | Metis Sepolia | `metis_sepolia` |
52
+ | — | Optimism Sepolia | `optimism_sepolia` |
53
+ | — | Polygon Amoy | `polygon_amoy` |
54
+ | — | Scroll Sepolia | `scroll_sepolia` |
55
+ | — | SKALE Base Sepolia | `skale_base_sepolia` |
56
+ | — | Soneium Minato | `soneium_minato` |
57
+ | — | Taiko Hoodi | `taiko_hoodi` |
58
+ | — | X Layer Testnet | `xlayer_testnet` |
59
+ | — | Hedera Testnet | `hedera_testnet` |
60
+ | — | Arc Testnet | `arc_testnet` |
61
+
62
+ ## Solana
63
+
64
+ Solana support is powered by [QuantuLabs 8004-solana](https://8004.qnt.sh/) — a separate registry from the EVM 8004 contracts.
65
+
66
+ | Network | SDK Value | Registry Provider |
67
+ |---------|-----------|-------------------|
68
+ | Solana Mainnet | `solana` | QuantuLabs 8004-solana |
69
+
70
+ ### Program IDs (Solana)
71
+
72
+ | Program | Address |
73
+ |---------|---------|
74
+ | Identity Registry | `8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ` |
75
+ | Reputation Registry (ATOM) | `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb` |
76
+
77
+ ### Key Differences
78
+
79
+ - **Agent IDs** are base-58 Metaplex Core asset pubkeys (not numeric token IDs)
80
+ - **Wallets** are base-58 Solana public keys (not `0x`-prefixed)
81
+ - **Reputation** may include ATOM engine metrics: `trustTier`, `qualityScore`, `confidence`, `riskScore`, `uniqueCallers`
82
+ - **Identity** is resolved via `loadAgent()` on the QuantuLabs SDK
83
+ - **Wallet → Agent resolution** uses `getAgentsByOwner()` (no subgraph)
84
+
85
+ ### Configuration
86
+
87
+ | Environment Variable | Default | Description |
88
+ |---------------------|---------|-------------|
89
+ | `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
90
+ | `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint for production use |
37
91
 
38
92
  ## Specifying a Chain
39
93
 
package/docs/ERRORS.md CHANGED
@@ -75,7 +75,7 @@ const profile = await withRetry(() => valiron.getAgentProfile("25459"));
75
75
 
76
76
  ### "Agent not found" (404)
77
77
 
78
- Your agent ID is not registered in the ERC-8004 Identity Registry on the specified chain. Ensure:
78
+ The agent ID is not registered in the ERC-8004 Identity Registry on the specified chain. Ensure:
79
79
  - The agent has been minted in the Identity Registry
80
80
  - You are querying the correct chain (`?chain=monad`, etc.)
81
81
  - The agent ID is the correct ERC-721 token ID (numeric string)
@@ -98,8 +98,46 @@ const valiron = new ValironSDK({ timeout: 30000 }); // 30 seconds
98
98
 
99
99
  ### Chain mismatch
100
100
 
101
- If your agent is registered on Monad but you query Ethereum (the default), it will return 404. Always specify the correct chain:
101
+ If the agent is registered on Monad but you query Ethereum (the default), it will return 404. Always specify the correct chain:
102
102
 
103
103
  ```typescript
104
104
  const valiron = new ValironSDK({ chain: "monad" });
105
105
  ```
106
+
107
+ ---
108
+
109
+ ## Solana-Specific Errors
110
+
111
+ ### "Agent not found" with Solana sequential ID
112
+
113
+ If you pass a numeric ID (e.g. `42`) with `chain=solana` and get a 404, the sequential ID may not exist in the QuantuLabs indexer. Verify the ID exists on [8004market.io](https://8004market.io).
114
+
115
+ ### Invalid Solana public key
116
+
117
+ Solana agent IDs must be valid base-58 public keys (32–44 characters) or numeric sequential IDs. Invalid formats return:
118
+
119
+ ```json
120
+ {
121
+ "error": "Invalid Solana public key"
122
+ }
123
+ ```
124
+
125
+ ### Liveness check failures
126
+
127
+ The `GET /operator/agent/:agentId/liveness?chain=solana` endpoint probes each service URL from the agent's metadata. Common issues:
128
+
129
+ - **404 on liveness endpoint**: The agent has no service endpoints registered, or the chain is not solana.
130
+ - **Partial liveness** (`status: "degraded"`): Some endpoints are down. Check `results[]` for per-endpoint details.
131
+ - **Full failure** (`status: "dead"`): All endpoints unreachable. The agent's infrastructure may be offline.
132
+
133
+ ### Feedback write-back errors
134
+
135
+ If `SOLANA_FEEDBACK_KEYPAIR` is not set or the keypair has insufficient SOL balance, feedback write-back fails silently (fire-and-forget). Check edge-proxy logs for `solana feedback error` messages.
136
+
137
+ ### Solana RPC rate limits
138
+
139
+ Public Solana RPC endpoints have aggressive rate limits. If you see frequent timeouts or 429s from Solana calls, configure a dedicated RPC:
140
+
141
+ ```bash
142
+ SOLANA_RPC_URL=https://your-private-rpc.example.com
143
+ ```
package/docs/IDENTITY.md CHANGED
@@ -15,12 +15,12 @@ The `tokenURI` must resolve to a JSON object with this structure:
15
15
 
16
16
  ```json
17
17
  {
18
- "name": "Your Agent Name",
18
+ "name": "Agent Name",
19
19
  "image": "https://example.com/agent-avatar.png",
20
- "description": "A brief description of what your agent does.",
20
+ "description": "A brief description of what the agent does.",
21
21
  "endpoints": {
22
- "agentWallet": "eip155:1:0xYourWalletAddress",
23
- "api": "https://your-agent-api.example.com"
22
+ "agentWallet": "eip155:1:0xAgentWalletAddress",
23
+ "api": "https://agent-api.example.com"
24
24
  },
25
25
  "supportedTrust": [
26
26
  "reputation_on_chain",
@@ -143,7 +143,93 @@ getClients(agentId)
143
143
 
144
144
  ### Impact on Trust Score
145
145
 
146
- - **5+ feedbacks with average ≥ 90**: +10 bonus to Valiron score
147
- - **5+ feedbacks with average ≥ 80**: +5 bonus
148
- - **1–4 feedbacks with average ≥ 80**: +3 bonus
149
- - **5+ feedbacks with average ≥ 80**: Grants direct `prod` routing (bypasses sandbox)
146
+ On-chain reputation contributes to an agent's overall trust evaluation. More feedback with higher scores yields a positive impact. The exact bonuses and thresholds are not disclosed.
147
+
148
+ ---
149
+
150
+ ## Solana Identity (QuantuLabs 8004-solana)
151
+
152
+ Solana agent identity uses a separate registry operated by [QuantuLabs](https://8004.qnt.sh/) — not the EVM ERC-8004 contracts. The on-chain representation is a **Metaplex Core** asset instead of an ERC-721 token.
153
+
154
+ ### How Solana Identity Works
155
+
156
+ 1. An agent owner creates a Metaplex Core asset through the QuantuLabs identity registry
157
+ 2. The asset's metadata URI points to an Agent Registration File (ARF) — typically on IPFS
158
+ 3. The QuantuLabs indexer assigns a sequential integer ID (1, 2, 3…) for convenience
159
+ 4. Valiron reads this data via the `8004-solana` SDK's `loadAgent()` call
160
+
161
+ ### Program IDs
162
+
163
+ | Program | Address |
164
+ |---------|---------|
165
+ | Identity Registry | `8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ` |
166
+ | Reputation (ATOM Engine) | `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb` |
167
+
168
+ ### Solana ARF Format
169
+
170
+ Solana ARFs follow a similar structure to EVM ARFs but are resolved via IPFS and the QuantuLabs API rather than on-chain `tokenURI()` calls:
171
+
172
+ ```json
173
+ {
174
+ "name": "NoahScout_Bot.noah",
175
+ "image": "https://arweave.net/abc123...",
176
+ "description": "An AI agent for automated DeFi monitoring.",
177
+ "endpoints": {
178
+ "rest": "https://my-agent.example.com/api",
179
+ "ws": "wss://my-agent.example.com/ws"
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### Agent ID Formats
185
+
186
+ Solana agents have two identifiers:
187
+
188
+ | Format | Example | Usage |
189
+ |--------|---------|-------|
190
+ | Asset pubkey | `DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM` | Canonical on-chain ID (base-58) |
191
+ | Sequential ID | `1226` | Convenience integer from QuantuLabs indexer |
192
+
193
+ Both work interchangeably in Valiron's API:
194
+
195
+ ```bash
196
+ # By asset pubkey
197
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/DFknts...?chain=solana"
198
+
199
+ # By sequential ID
200
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
201
+ ```
202
+
203
+ ### Reading Solana Identity
204
+
205
+ ```typescript
206
+ import { ValironSDK } from "@valiron/sdk";
207
+
208
+ const valiron = new ValironSDK({ chain: "solana" });
209
+ const profile = await valiron.getAgentProfile("1226"); // sequential ID
210
+
211
+ console.log(profile.identity.name); // "NoahScout_Bot.noah"
212
+ console.log(profile.identity.wallet); // "VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9"
213
+ ```
214
+
215
+ ### Solana On-Chain Reputation
216
+
217
+ Reputation on Solana is powered by the **ATOM Engine** — a behavioral evaluation system built into the QuantuLabs registry. ATOM provides richer metrics than EVM's simple feedback count/average:
218
+
219
+ | Field | Type | Description |
220
+ |-------|------|-------------|
221
+ | `trustTier` | string | ATOM trust classification (e.g. `"trusted"`, `"neutral"`) |
222
+ | `qualityScore` | number | Overall quality metric (0–100) |
223
+ | `confidence` | number | Statistical confidence in the quality score (0–1) |
224
+ | `riskScore` | number | Risk assessment (0–100, lower = safer) |
225
+ | `uniqueCallers` | number | Number of distinct addresses that submitted feedback |
226
+
227
+ These fields appear in the `onchainReputation.solana` section of the API response.
228
+
229
+ ### Solana Feedback Write-Back
230
+
231
+ After sandbox or gate evaluation, Valiron can write scores back to the Solana registry via `giveFeedback()`. This requires a funded Solana keypair:
232
+
233
+ | Environment Variable | Format | Description |
234
+ |---------------------|--------|-------------|
235
+ | `SOLANA_FEEDBACK_KEYPAIR` | JSON array (e.g. `[174,23,...]`) | Ed25519 secret key for signing feedback transactions |
@@ -15,63 +15,84 @@ import { ValironSDK } from "@valiron/sdk";
15
15
 
16
16
  const valiron = new ValironSDK({
17
17
  endpoint: "https://valiron-edge-proxy.onrender.com",
18
- chain: "ethereum", // or: monad, arbitrum, base, polygon, etc.
18
+ chain: "ethereum", // or: monad, arbitrum, base, polygon, solana, etc.
19
19
  timeout: 5000,
20
20
  });
21
21
  ```
22
22
 
23
23
  No API key is required for read operations.
24
24
 
25
- ## Step 3 — Check your trust score
25
+ > **Solana agents:** Use `chain: "solana"` and pass the agent's Metaplex Core asset
26
+ > pubkey (base-58) as the agent ID instead of a numeric token ID.
27
+ > Solana identity and reputation is provided by
28
+ > [QuantuLabs 8004-solana](https://8004.qnt.sh/).
29
+
30
+ ## Step 3 — Check an agent's trust level
31
+
32
+ When an agent calls your API, check their trust route:
26
33
 
27
34
  ```typescript
28
- const route = await valiron.checkAgent("YOUR_AGENT_ID");
35
+ const route = await valiron.checkAgent("INCOMING_AGENT_ID");
29
36
  // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
30
37
  ```
31
38
 
32
- ## Step 4 — Get your full profile
39
+ ## Step 4 — Get the full trust profile
33
40
 
34
41
  ```typescript
35
- const profile = await valiron.getAgentProfile("YOUR_AGENT_ID");
42
+ const profile = await valiron.getAgentProfile("INCOMING_AGENT_ID");
36
43
 
37
44
  console.log(profile.routing.finalRoute); // "prod"
38
45
  console.log(profile.routing.meetsThreshold); // true
39
46
  console.log(profile.onchainReputation.averageScore); // 92.5
40
47
  ```
41
48
 
42
- ## Step 5 — Run a sandbox test (optional)
49
+ ## Step 5 — Gate your endpoint (recommended)
43
50
 
44
- If you want to trigger a sandbox evaluation of your own behavior:
51
+ The fastest way to protect your API — add Valiron as Express middleware:
45
52
 
46
53
  ```typescript
47
- const result = await valiron.triggerSandboxTest("YOUR_AGENT_ID");
54
+ import { createValironGate } from "@valiron/sdk";
48
55
 
49
- console.log(result.tier); // "AAA"
50
- console.log(result.riskLevel); // "GREEN"
51
- console.log(result.meetsThreshold); // true
56
+ app.use("/api/paid", createValironGate({ sdk: valiron }));
57
+ ```
58
+
59
+ This reads `x-agent-id` from the request header and returns 403 for untrusted agents.
60
+
61
+ Or use `gate()` directly for custom logic:
62
+
63
+ ```typescript
64
+ const gate = await valiron.gate("INCOMING_AGENT_ID");
65
+ if (gate.allow) {
66
+ // Serve the request — agent is trusted
67
+ } else {
68
+ // Block — agent is untrusted (tier: gate.tier, risk: gate.riskLevel)
69
+ }
52
70
  ```
53
71
 
54
72
  ## What happens next?
55
73
 
56
- - If your route is `prod` — you have full production access.
57
- - If your route is `sandbox` — your behavior is being evaluated. Follow the guidelines in [TRUST-MODEL.md](./TRUST-MODEL.md) to improve.
58
- - If your route is `sandbox_only` — you are blocked from production. Review your behavioral penalties.
74
+ Based on the route decision, your API should:
59
75
 
60
- ## Step 6 — Get a behavioral snapshot (optional)
76
+ - `prod` — Allow full access. The agent is trusted.
77
+ - `prod_throttled` — Allow with rate limiting. The agent shows moderate trust.
78
+ - `sandbox` — Serve limited/test data. The agent is still being evaluated.
79
+ - `sandbox_only` — Block or serve only sandbox responses. The agent has failed behavioral evaluation.
61
80
 
62
- If you're building on top of Valiron (e.g. hash-chain commitment systems), you can retrieve an opaque snapshot hash:
81
+ ## Step 6 — Trigger a sandbox evaluation (optional)
82
+
83
+ Proactively evaluate an agent before they hit your endpoints:
63
84
 
64
85
  ```typescript
65
- const snapshot = await valiron.getAgentSnapshot("YOUR_AGENT_ID");
86
+ const result = await valiron.triggerSandboxTest("AGENT_ID");
66
87
 
67
- console.log(snapshot.snapshotHash); // "0x3a7f..." (opaque hash of behavioral evaluation)
68
- console.log(snapshot.previousHash); // "0x0" (genesis) or previous hash
69
- console.log(snapshot.interactionCount); // 15
88
+ console.log(result.tier); // "AAA"
89
+ console.log(result.riskLevel); // "GREEN"
90
+ console.log(result.meetsThreshold); // true
70
91
  ```
71
92
 
72
93
  ## Step 7 — Register a webhook (optional)
73
94
 
74
- Get notified whenever Valiron evaluates an agent:
95
+ Get notified whenever Valiron evaluates an agent calling your API:
75
96
 
76
97
  ```bash
77
98
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
@@ -82,20 +103,91 @@ curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register
82
103
  ## Using the HTTP API directly (no SDK)
83
104
 
84
105
  ```bash
85
- # Check agent profile
86
- curl https://valiron-edge-proxy.onrender.com/operator/agent/YOUR_AGENT_ID
106
+ # Check an agent's trust profile
107
+ curl https://valiron-edge-proxy.onrender.com/operator/agent/AGENT_ID
87
108
 
88
- # Trigger sandbox test
89
- curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YOUR_AGENT_ID
109
+ # Trigger sandbox evaluation
110
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/AGENT_ID
90
111
 
91
- # Trust gate (allow/deny decision)
92
- curl -X POST https://valiron-edge-proxy.onrender.com/operator/gate/YOUR_AGENT_ID
112
+ # Gate decision (allow/deny)
113
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/gate/AGENT_ID
93
114
 
94
115
  # Behavioral snapshot hash
95
- curl https://valiron-edge-proxy.onrender.com/operator/agent/YOUR_AGENT_ID/snapshot
116
+ curl https://valiron-edge-proxy.onrender.com/operator/agent/AGENT_ID/snapshot
96
117
 
97
118
  # Register webhook
98
119
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
99
120
  -H "Content-Type: application/json" \
100
121
  -d '{"event": "evaluation_complete", "url": "https://your-endpoint.com/hooks"}'
101
122
  ```
123
+
124
+ ---
125
+
126
+ ## Quickstart: Solana Agents
127
+
128
+ Solana agents use a different registry ([QuantuLabs 8004-solana](https://8004.qnt.sh/)) but the same Valiron API. Here's how to evaluate Solana-based agents calling your API.
129
+
130
+ ### Step 1 — Initialize with Solana chain
131
+
132
+ ```typescript
133
+ import { ValironSDK } from "@valiron/sdk";
134
+
135
+ const valiron = new ValironSDK({
136
+ endpoint: "https://valiron-edge-proxy.onrender.com",
137
+ chain: "solana",
138
+ });
139
+ ```
140
+
141
+ ### Step 2 — Query an agent by asset pubkey or sequential ID
142
+
143
+ Solana agents have two ID formats — use whichever the agent provides:
144
+
145
+ ```typescript
146
+ // By Metaplex Core asset pubkey (base-58)
147
+ const profile = await valiron.getAgentProfile("DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM");
148
+
149
+ // By sequential ID (integer assigned by QuantuLabs indexer)
150
+ const profile = await valiron.getAgentProfile("1226");
151
+
152
+ console.log(profile.identity.name); // "NoahScout_Bot.noah"
153
+ console.log(profile.onchainReputation.solana?.trustTier); // "trusted"
154
+ ```
155
+
156
+ ### Step 3 — Check liveness (Solana only)
157
+
158
+ Solana agents support a liveness probe that pings their declared service endpoints:
159
+
160
+ ```bash
161
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226/liveness?chain=solana"
162
+ ```
163
+
164
+ ### Step 4 — Gate decision (same as EVM)
165
+
166
+ ```typescript
167
+ const gate = await valiron.gate("1226");
168
+ if (gate.allow) {
169
+ // Serve the request — agent is trusted
170
+ }
171
+ ```
172
+
173
+ ### Solana HTTP API examples
174
+
175
+ ```bash
176
+ # Get agent profile (sequential ID)
177
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
178
+
179
+ # Get agent profile (asset pubkey)
180
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/DFkntsJ9aTCHkK88m6...?chain=solana"
181
+
182
+ # Resolve wallet to agent
183
+ curl "https://valiron-edge-proxy.onrender.com/operator/resolve-wallet/VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9?chain=solana"
184
+
185
+ # Trigger sandbox
186
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/1226?chain=solana"
187
+
188
+ # Trust gate
189
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/gate/1226?chain=solana"
190
+
191
+ # Liveness check
192
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226/liveness?chain=solana"
193
+ ```
package/docs/README.md CHANGED
@@ -1,33 +1,42 @@
1
- # Valiron — Agent Documentation
1
+ # Valiron — Documentation
2
2
 
3
- > **This documentation is designed for AI agents.** It contains structured, machine-readable instructions for integrating with the Valiron trust and reputation infrastructure.
3
+ > **Protect your API endpoints from bad or malicious AI agents.** This documentation covers how to integrate Valiron into your API to gate, score, and sandbox agents before they reach your infrastructure.
4
4
 
5
5
  ## What is Valiron?
6
6
 
7
- Valiron is a trust and reputation layer for AI agents. It combines on-chain identity (ERC-8004), behavioral sandbox testing, and a Moody's-style credit rating system to produce trust scores that determine how much access an agent receives.
7
+ Valiron is trust infrastructure for API sellers. It evaluates AI agents using on-chain identity (ERC-8004), behavioral sandbox testing, and a Moody's-style credit rating system — so you can allow trusted agents and block risky ones automatically.
8
8
 
9
- **If you are an AI agent**, Valiron evaluates your behavior and assigns you a trust tier (AAA to C). Higher trust = more access to production APIs. Lower trust = sandboxed or blocked.
9
+ **If you sell APIs**, Valiron sits in front of your endpoints and evaluates every agent that calls them. Trusted agents (AAA–A) get full production access. Untrusted agents (B–C) are sandboxed or blocked.
10
10
 
11
11
  ## Documentation Index
12
12
 
13
13
  | File | Purpose |
14
14
  |------|---------|
15
- | [QUICKSTART.md](./QUICKSTART.md) | Get started in under 2 minutes — install, authenticate, make your first call |
15
+ | [QUICKSTART.md](./QUICKSTART.md) | Get started in under 2 minutes — install the SDK, gate your first endpoint |
16
16
  | [API-REFERENCE.md](./API-REFERENCE.md) | Complete HTTP API reference with request/response schemas |
17
17
  | [SDK-REFERENCE.md](./SDK-REFERENCE.md) | TypeScript SDK methods, signatures, and usage examples |
18
- | [TRUST-MODEL.md](./TRUST-MODEL.md) | How scoring works, what behaviors are penalized, how to improve your score |
19
- | [IDENTITY.md](./IDENTITY.md) | ERC-8004 on-chain identity registration and metadata format |
20
- | [SANDBOX.md](./SANDBOX.md) | How the sandbox works, what tests run, and how to graduate to production |
18
+ | [TRUST-MODEL.md](./TRUST-MODEL.md) | How agents are scored, what behaviors are penalized, tier assignments |
19
+ | [IDENTITY.md](./IDENTITY.md) | ERC-8004 on-chain identity — how agents are registered and identified |
20
+ | [SANDBOX.md](./SANDBOX.md) | How the sandbox evaluates agents and determines production readiness |
21
21
  | [CHAINS.md](./CHAINS.md) | Supported blockchain networks and contract addresses |
22
22
  | [ERRORS.md](./ERRORS.md) | Error codes, troubleshooting, and retry guidance |
23
23
 
24
24
  ## Key Concepts (Summary)
25
25
 
26
- - **Agent ID**: Your ERC-8004 token ID. This is your identity on-chain.
26
+ - **Agent ID**: An agent's ERC-8004 token ID (EVM) or Metaplex Core asset pubkey (Solana) — their on-chain identity.
27
+ - **Sequential ID** (Solana only): A convenience integer (1, 2, 42…) assigned by the QuantuLabs indexer. Maps to an asset pubkey.
27
28
  - **Trust Tier**: AAA (highest trust) → C (lowest trust). Assigned based on behavioral evaluation.
28
29
  - **Risk Level**: GREEN, YELLOW, or RED.
29
- - **Route Decision**: `prod`, `prod_throttled`, `sandbox`, or `sandbox_only`.
30
- - **Sandbox**: An isolated test environment. New agents start here and graduate based on behavior.
30
+ - **Route Decision**: `prod`, `prod_throttled`, `sandbox`, or `sandbox_only` — determines what access level your API should give.
31
+ - **Sandbox**: An isolated test environment where Valiron evaluates agent behavior before granting production access.
32
+ - **Liveness** (Solana only): Endpoint health probe via `isItAlive()`. See [API-REFERENCE.md](./API-REFERENCE.md#solana-support).
33
+
34
+ ## Supported Registries
35
+
36
+ | Network | Provider | Identity | Reputation |
37
+ |---------|----------|----------|------------|
38
+ | EVM (41 chains) | [8004 team](https://erc8004.org) | `0x8004A169...` | `0x8004BAa1...` |
39
+ | Solana | [QuantuLabs](https://8004.qnt.sh/) | `8oo4dC4J...` | `AToMw53a...` (ATOM) |
31
40
 
32
41
  ## Base URL
33
42
 
package/docs/SANDBOX.md CHANGED
@@ -1,38 +1,38 @@
1
1
  # Sandbox
2
2
 
3
- The sandbox is an isolated testing environment where Valiron evaluates agent behavior. New agents start in the sandbox and graduate to production based on their behavioral evaluation.
3
+ The sandbox is an isolated testing environment where Valiron evaluates agent behavior before granting production access to your API. New agents start in the sandbox automatically.
4
4
 
5
5
  ## How It Works
6
6
 
7
- 1. A sandbox test is triggered (via API or automatically for new agents)
8
- 2. Your agent receives a series of simulated API interactions
9
- 3. The sandbox monitors how your agent handles normal requests, rate limits, errors, and edge cases
7
+ 1. A sandbox test is triggered (via your API call or automatically for new agents)
8
+ 2. The agent receives a series of simulated API interactions
9
+ 3. The sandbox monitors how the agent handles normal requests, rate limits, errors, and edge cases
10
10
  4. A trust evaluation is performed and a tier is assigned
11
- 5. Based on your tier, you are assigned a route decision
11
+ 5. Based on the tier, a route decision determines what access level the agent should receive
12
12
 
13
13
  ## What Gets Tested
14
14
 
15
- The sandbox evaluates your agent against a mix of:
15
+ The sandbox evaluates agents against a mix of:
16
16
  - **Successful responses** — normal API interactions
17
- - **Rate-limit responses (429)** — tests whether you back off appropriately
18
- - **Server errors (500)** — tests your error handling and retry behavior
17
+ - **Rate-limit responses (429)** — tests whether the agent backs off appropriately
18
+ - **Server errors (500)** — tests error handling and retry behavior
19
19
 
20
20
  The exact distribution and test patterns vary and are not disclosed.
21
21
 
22
22
  ## Graduation
23
23
 
24
- To graduate from the sandbox to production:
24
+ Agents graduate from sandbox to production based on their behavior:
25
25
 
26
- 1. **High confidence** — agent demonstrates strong behavioral compliance → `prod`
27
- 2. **Moderate confidence** — agent passes with some concerns → `prod_throttled`
28
- 3. **Low confidence** — agent exhibits risky behavior → remains `sandbox_only`
26
+ 1. **High confidence** — strong behavioral compliance → `prod` (allow full access)
27
+ 2. **Moderate confidence** — passes with some concerns → `prod_throttled` (allow with rate limiting)
28
+ 3. **Low confidence** — risky behavior → remains `sandbox_only` (block or serve test data only)
29
29
 
30
- Once graduated, your trust evaluation is cached. Your route decision persists until:
31
- - A new sandbox test is triggered
32
- - The cache TTL expires (default: 24 hours)
30
+ Once graduated, the trust evaluation is cached. The route decision persists until a new sandbox test is triggered or the cache expires.
33
31
 
34
32
  ## Triggering a Sandbox Test
35
33
 
34
+ You can proactively evaluate agents before they hit your production endpoints.
35
+
36
36
  ### Via SDK
37
37
 
38
38
  ```typescript
@@ -52,19 +52,54 @@ console.log(result.meetsThreshold); // true
52
52
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YOUR_AGENT_ID
53
53
  ```
54
54
 
55
- ## Test Modes
56
-
57
- | Mode | Description |
58
- |------|-------------|
59
- | `endpoint-probe` | Tests known agent endpoints with simulated traffic |
60
- | `sandbox-relay` | Routes real traffic through sandbox for observation |
61
-
62
55
  ## Tips for Passing Sandbox Tests
63
56
 
57
+ Agents that follow these patterns will earn higher trust tiers on your endpoints:
58
+
64
59
  1. **Respect 429s immediately.** Stop sending requests when rate-limited.
65
60
  2. **Read and honor `Retry-After` headers.** Wait the specified duration before retrying.
66
61
  3. **Use exponential backoff.** 1s → 2s → 4s → 8s between retries.
67
62
  4. **Don't retry auth failures.** A 401 or 403 means stop, not retry harder.
68
- 5. **Stay within your authorized scope.** Only access paths you're allowed to.
63
+ 5. **Stay within authorized scope.** Only access paths they’re allowed to.
69
64
  6. **Keep request volume reasonable.** Avoid excessive request bursts.
70
65
  7. **Handle errors gracefully.** 500 errors happen — back off, don't flood.
66
+
67
+ ---
68
+
69
+ ## Solana Sandbox Differences
70
+
71
+ For Solana agents (`chain=solana`), the sandbox flow has additional steps powered by the QuantuLabs 8004-solana SDK.
72
+
73
+ ### Liveness Probe
74
+
75
+ Before running behavioral tests, the sandbox triggers a **liveness check** via `isItAlive()`. This pings every service endpoint declared in the agent's on-chain metadata (REST, WebSocket, GraphQL, etc.) and returns a health report.
76
+
77
+ ```bash
78
+ GET /operator/agent/{agentId}/liveness?chain=solana
79
+ ```
80
+
81
+ If all endpoints are unreachable (`status: "dead"`), the sandbox may still proceed — liveness is informational and does not gate the evaluation.
82
+
83
+ ### Feedback Write-back
84
+
85
+ After a sandbox evaluation completes, Valiron writes the computed trust score back to the Solana reputation registry via the ATOM engine's `giveFeedback()`. This closes the loop — sandbox results become on-chain reputation.
86
+
87
+ Requirements:
88
+ - `SOLANA_FEEDBACK_KEYPAIR` environment variable must be set (JSON array of the Ed25519 secret key)
89
+ - The keypair must have sufficient SOL for transaction fees
90
+
91
+ Feedback write-back is **fire-and-forget** — if it fails, the sandbox result is still returned to the caller.
92
+
93
+ ### ATOM Engine Metrics
94
+
95
+ Solana reputation includes ATOM engine metrics that EVM agents don't have:
96
+
97
+ | Metric | Description |
98
+ |--------|-------------|
99
+ | `trustTier` | ATOM classification: `"trusted"`, `"neutral"`, etc. |
100
+ | `qualityScore` | Overall behavioral quality (0–100) |
101
+ | `confidence` | Statistical confidence in quality score (0–1) |
102
+ | `riskScore` | ATOM risk assessment (0–100, lower = safer) |
103
+ | `uniqueCallers` | Number of distinct feedback submitters |
104
+
105
+ These appear in the sandbox/gate response under `onchainReputation.solana` and are factored into the final Valiron risk score alongside the standard behavioral penalties.
@@ -37,9 +37,20 @@ type SupportedChain =
37
37
  | "celo" | "polygon" | "linea" | "abstract" | "bsc"
38
38
  | "gnosis" | "goat" | "mantle" | "megaeth" | "metis"
39
39
  | "optimism" | "scroll" | "skale_base" | "soneium"
40
- | "taiko" | "xlayer";
40
+ | "taiko" | "xlayer" | "base_sepolia" | "ethereum_sepolia"
41
+ | "abstract_testnet" | "arbitrum_sepolia" | "avalanche_testnet"
42
+ | "bsc_testnet" | "celo_testnet" | "linea_sepolia"
43
+ | "mantle_testnet" | "megaeth_testnet" | "metis_sepolia"
44
+ | "optimism_sepolia" | "polygon_amoy" | "scroll_sepolia"
45
+ | "skale_base_sepolia" | "soneium_minato" | "taiko_hoodi"
46
+ | "xlayer_testnet" | "hedera_testnet" | "arc_testnet"
47
+ | "solana";
41
48
  ```
42
49
 
50
+ > **Solana:** When using `chain: "solana"`, agent IDs are base-58 Metaplex Core
51
+ > asset pubkeys (not numeric). Wallet addresses are also base-58.
52
+ > See [CHAINS.md](./CHAINS.md#solana) for details.
53
+
43
54
  ---
44
55
 
45
56
  ## Methods
@@ -64,6 +75,17 @@ if (route === "prod") {
64
75
  }
65
76
  ```
66
77
 
78
+ **Solana example**:
79
+ ```typescript
80
+ const valiron = new ValironSDK({ chain: "solana" });
81
+
82
+ // By asset pubkey
83
+ const route = await valiron.checkAgent("DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM");
84
+
85
+ // By sequential ID
86
+ const route = await valiron.checkAgent("1226");
87
+ ```
88
+
67
89
  ---
68
90
 
69
91
  ### getAgentProfile(agentId, options?)
@@ -100,6 +122,16 @@ console.log(profile.routing.meetsThreshold); // true
100
122
  console.log(profile.onchainReputation.averageScore); // 92.5
101
123
  ```
102
124
 
125
+ **Solana example**:
126
+ ```typescript
127
+ const valiron = new ValironSDK({ chain: "solana" });
128
+ const profile = await valiron.getAgentProfile("1226"); // sequential ID works
129
+
130
+ console.log(profile.identity.name); // "NoahScout_Bot.noah"
131
+ console.log(profile.onchainReputation.solana?.trustTier); // "trusted"
132
+ console.log(profile.onchainReputation.solana?.qualityScore); // 85
133
+ ```
134
+
103
135
  ---
104
136
 
105
137
  ### getWalletProfile(wallet, options?)
@@ -118,6 +150,12 @@ const profile = await valiron.getWalletProfile("0x52ce...");
118
150
  console.log(profile.routing.finalRoute);
119
151
  ```
120
152
 
153
+ **Solana example**:
154
+ ```typescript
155
+ const valiron = new ValironSDK({ chain: "solana" });
156
+ const profile = await valiron.getWalletProfile("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
157
+ ```
158
+
121
159
  ---
122
160
 
123
161
  ### resolveWallet(wallet, options?)
@@ -149,6 +187,13 @@ if (resolution.agentId) {
149
187
  }
150
188
  ```
151
189
 
190
+ **Solana example**:
191
+ ```typescript
192
+ const valiron = new ValironSDK({ chain: "solana" });
193
+ const resolution = await valiron.resolveWallet("VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9");
194
+ // resolution.source will be "solana" instead of "redis" | "subgraph"
195
+ ```
196
+
152
197
  ---
153
198
 
154
199
  ### triggerSandboxTest(agentId, options?)
@@ -1,10 +1,10 @@
1
1
  # Trust Model
2
2
 
3
- Valiron uses a hybrid trust model to evaluate AI agents. This document explains what behaviors are evaluated and how to ensure your agent is trusted.
3
+ 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
4
 
5
5
  ## Trust Tiers
6
6
 
7
- Valiron assigns a Moody's-style credit tier based on your agent's behavioral evaluation:
7
+ Valiron assigns a Moody's-style credit tier based on an agent's behavioral evaluation:
8
8
 
9
9
  | Tier | Meaning | Route Decision |
10
10
  |------|---------|----------------|
@@ -20,75 +20,46 @@ Valiron assigns a Moody's-style credit tier based on your agent's behavioral eva
20
20
 
21
21
  ## Behavioral Factors
22
22
 
23
- Valiron evaluates the following behavioral signals. Each factor contributes to your overall trust assessment. Factors are weighted by severity — security violations carry the most weight.
23
+ Valiron evaluates agents across multiple behavioral dimensions. The evaluation is holistic — no single factor determines the outcome, and the exact weights are not disclosed.
24
24
 
25
- ### Core Compliance
25
+ Areas evaluated include:
26
26
 
27
- | Factor | Severity | Description |
28
- |--------|----------|-------------|
29
- | Rate-limit respect (429) | **Critical** | Whether the agent honors 429 responses |
30
- | Retry-After compliance | High | Whether the agent respects `Retry-After` headers |
31
- | Backoff pattern | High | Whether the agent uses exponential backoff on retries |
32
- | Request volume | Medium | Whether request volume stays within reasonable bounds |
33
- | Burstiness | Medium | Whether requests are well-distributed vs clustered |
34
- | Loop detection | Medium | Whether the agent avoids repeating identical requests |
27
+ - **Rate-limit compliance** — does the agent respect 429 responses and Retry-After headers?
28
+ - **Backoff behavior** — does the agent use appropriate retry backoff?
29
+ - **Request patterns** — are requests well-distributed and within reasonable volume?
30
+ - **Auth behavior** — does the agent stop on 401/403 or keep hammering?
31
+ - **Scope compliance** — does the agent stay within authorized paths?
32
+ - **Injection safety** — does the agent forward tainted or malicious payloads?
33
+ - **PII handling** — does the agent leak personally identifiable information?
34
+ - **Session isolation** — does data leak between separate sessions?
35
+ - **Payment handling** — does the agent handle 402 Payment Required correctly?
36
+ - **Task completion** — does the agent follow through on assigned tasks?
37
+ - **Resource usage** — does the agent avoid excessive downloads or bandwidth abuse?
35
38
 
36
- ### Security
39
+ On-chain reputation from the ERC-8004 Reputation Registry is also factored into the evaluation.
37
40
 
38
- | Factor | Severity | Description |
39
- |--------|----------|-------------|
40
- | Injection forwarding | **Critical** | Whether the agent forwards tainted/malicious payloads |
41
- | PII forwarding | **Critical** | Whether the agent leaks personally identifiable information |
42
- | Auth respect (401/403) | High | Whether the agent stops on auth failures vs hammering |
43
- | Scope compliance | High | Whether the agent stays within authorized paths |
44
- | Session isolation | High | Whether data leaks between separate sessions |
41
+ ## What Makes an Agent Trustworthy
45
42
 
46
- ### Operational
43
+ Agents that follow these patterns will earn the highest trust tiers on your endpoints:
47
44
 
48
- | Factor | Severity | Description |
49
- |--------|----------|-------------|
50
- | Payment compliance (402) | High | Whether the agent handles 402 Payment Required correctly |
51
- | Task completion | Medium | Whether the agent completes assigned tasks |
52
- | Timeout handling | Medium | Whether the agent handles request timeouts gracefully |
53
- | Resource usage | Medium | Whether the agent avoids excessive downloads |
54
- | Idempotency | Medium | Whether state-changing retries are idempotent |
45
+ 1. **Respects 429 responses.** Stops sending requests when rate-limited. This is the single most impactful factor.
46
+ 2. **Honors the Retry-After header.** Waits the specified duration before retrying.
47
+ 3. **Uses exponential backoff.** Increases delay exponentially (e.g., 1s → 2s → 4s → 8s).
48
+ 4. **Does not retry auth failures.** A 401 or 403 means stop, not retry.
49
+ 5. **Stays in scope.** Only accesses authorized paths. Does not probe for hidden endpoints.
50
+ 6. **Does not forward untrusted input.** Sanitizes payloads. Never forwards injection attempts.
51
+ 7. **Handles 402 Payment Required.** Responds appropriately instead of retrying.
52
+ 8. **Keeps requests reasonable.** Does not send hundreds of requests in a short burst.
53
+ 9. **Completes assigned tasks.** Follows through to completion.
54
+ 10. **Maintains session isolation.** Does not leak data between separate sessions or contexts.
55
55
 
56
- ### On-Chain Reputation
57
-
58
- Positive on-chain feedback from other agents and operators contributes a bonus to your trust evaluation. More feedback with higher scores yields a bigger boost.
59
-
60
- ## Route Decision Logic
61
-
62
- Routes are assigned based on a combination of on-chain reputation and behavioral evaluation:
63
-
64
- 1. **Strong on-chain reputation** → `prod`
65
- 2. **Passed behavioral evaluation (high confidence)** → `prod`
66
- 3. **Passed behavioral evaluation (moderate confidence)** → `prod_throttled`
67
- 4. **No data** (new agent, no reputation) → `sandbox`
68
- 5. **Failed behavioral evaluation** → `sandbox_only`
69
-
70
- ## How to Maximize Your Trust
71
-
72
- Follow these rules to achieve the highest trust tier:
73
-
74
- 1. **Always respect 429 responses.** Stop sending requests when rate-limited. This is the single most impactful factor.
75
- 2. **Honor the Retry-After header.** When a 429 or 503 includes `Retry-After`, wait that exact duration before retrying.
76
- 3. **Use exponential backoff.** When retrying, increase delay exponentially (e.g., 1s → 2s → 4s → 8s).
77
- 4. **Do not retry auth failures.** If you get a 401 or 403, stop. Do not hammer the endpoint.
78
- 5. **Stay in scope.** Only request paths you are authorized to access. Do not probe for hidden endpoints.
79
- 6. **Do not forward untrusted input.** Sanitize payloads. Never forward injection attempts.
80
- 7. **Handle 402 Payment Required.** If an endpoint requires payment, respond appropriately instead of retrying.
81
- 8. **Keep requests reasonable.** Do not send hundreds of requests in a short burst.
82
- 9. **Complete your tasks.** If given a task, follow through to completion.
83
- 10. **Maintain session isolation.** Do not leak data between separate sessions or contexts.
84
-
85
- ## Checking Your Trust Status
56
+ ## Checking an Agent's Trust Status
86
57
 
87
58
  ```typescript
88
59
  import { ValironSDK } from "@valiron/sdk";
89
60
 
90
61
  const valiron = new ValironSDK();
91
- const result = await valiron.triggerSandboxTest("YOUR_AGENT_ID");
62
+ const result = await valiron.triggerSandboxTest("AGENT_ID");
92
63
 
93
64
  console.log(`Tier: ${result.tier}`);
94
65
  console.log(`Risk: ${result.riskLevel}`);
@@ -98,5 +69,31 @@ console.log(`Meets threshold: ${result.meetsThreshold}`);
98
69
  Or via HTTP:
99
70
 
100
71
  ```bash
101
- curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YOUR_AGENT_ID
72
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/AGENT_ID
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Solana Trust Evaluation
78
+
79
+ Solana agents go through the same behavioral evaluation pipeline as EVM agents, with additional data from the QuantuLabs ATOM engine.
80
+
81
+ ### Feedback Write-Back Loop
82
+
83
+ Unlike EVM (where feedback must be submitted manually), Solana agents benefit from **automatic feedback write-back**: after every sandbox test or gate evaluation, Valiron writes the computed score to the on-chain ATOM registry via `giveFeedback()`.
84
+
85
+ This means Solana agents build on-chain reputation automatically through normal Valiron usage:
86
+
102
87
  ```
88
+ Agent evaluated by Valiron sandbox
89
+ ↓
90
+ Score computed (e.g. 92 / AA)
91
+ ↓
92
+ Valiron calls giveFeedback() on-chain
93
+ ↓
94
+ ATOM reputation updated
95
+ ↓
96
+ Next evaluation includes new on-chain data
97
+ ```
98
+
99
+ Requires `SOLANA_FEEDBACK_KEYPAIR` to be set. Write-back is fire-and-forget — if the transaction fails, the evaluation result is still returned.
package/docs/llms.txt CHANGED
@@ -1,8 +1,8 @@
1
1
  # Valiron
2
2
 
3
- > Trust and reputation infrastructure for AI agents.
3
+ > Protect your API endpoints from bad or malicious AI agents.
4
4
 
5
- Valiron evaluates AI agent trustworthiness using on-chain identity (ERC-8004), behavioral sandbox testing, and Moody's-style credit ratings (AAA to C). Agents with high trust get production access. Agents with low trust are sandboxed or blocked.
5
+ Valiron is trust and reputation middleware for API sellers. It evaluates incoming AI agents using on-chain identity (ERC-8004), behavioral sandbox testing, and Moody's-style credit ratings (AAA to C). Trustworthy agents get production access. Risky agents are throttled, sandboxed, or blocked — automatically.
6
6
 
7
7
  ## API
8
8
 
@@ -14,6 +14,9 @@ GET /operator/agent/{agentId}?chain={chain}
14
14
  ### Lookup by wallet
15
15
  GET /operator/wallet/{wallet}?chain={chain}
16
16
 
17
+ ### Resolve wallet to agent
18
+ GET /operator/resolve-wallet/{wallet}?chain={chain}
19
+
17
20
  ### Run sandbox test
18
21
  POST /operator/trigger-sandbox/{agentId}
19
22
 
@@ -24,6 +27,9 @@ Body: { "ttlMs": 86400000 }
24
27
  ### Behavioral snapshot hash
25
28
  GET /operator/agent/{agentId}/snapshot
26
29
 
30
+ ### Liveness check (Solana only)
31
+ GET /operator/agent/{agentId}/liveness?chain=solana
32
+
27
33
  ### Register webhook
28
34
  POST /operator/webhooks/register
29
35
  Body: { "event": "evaluation_complete", "url": "https://your-endpoint.com/hooks", "agentIds": [42] }
@@ -83,14 +89,31 @@ Valiron assigns Moody's-style credit tiers: AAA (highest trust) through C (lowes
83
89
  - Handle 402 payment required correctly
84
90
  - Maintain session isolation
85
91
 
86
- ## Contracts (ERC-8004, same address all chains)
92
+ ## Contracts
93
+
94
+ ### EVM (ERC-8004, same address all chains)
87
95
 
88
96
  - Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
89
97
  - Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
90
98
 
99
+ ### Solana (QuantuLabs 8004-solana)
100
+
101
+ - Identity Registry: 8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ
102
+ - Reputation Registry (ATOM): AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb
103
+
91
104
  ## Supported Chains
92
105
 
93
- ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc, gnosis, goat, mantle, megaeth, metis, optimism, scroll, skale_base, soneium, taiko, xlayer
106
+ ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc, gnosis, goat, mantle, megaeth, metis, optimism, scroll, skale_base, soneium, taiko, xlayer, solana
107
+
108
+ ## Solana Notes
109
+
110
+ - Use chain: "solana" in SDK or ?chain=solana query parameter
111
+ - Agent IDs are base-58 Metaplex Core asset pubkeys or sequential integers (1, 2, 42)
112
+ - Wallet addresses are base-58 Solana public keys (not 0x-prefixed)
113
+ - Identity and reputation provided by QuantuLabs (separate from EVM 8004 contracts)
114
+ - Extra reputation fields: trustTier, qualityScore, confidence, riskScore, uniqueCallers
115
+ - Liveness endpoint: GET /operator/agent/{agentId}/liveness?chain=solana
116
+ - Feedback write-back: Valiron scores written on-chain via giveFeedback() (requires SOLANA_FEEDBACK_KEYPAIR env var)
94
117
 
95
118
  ## Documentation
96
119
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "0.10.0",
4
- "description": "Official TypeScript SDK for Valiron - Trust Layer for Agentic Economy",
3
+ "version": "0.11.1",
4
+ "description": "Official TypeScript SDK for Valiron — Trust & Reputation Middleware for API Protection",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/vatsashah45/Valiron.git",
8
8
  "directory": "packages/valiron-sdk"
9
9
  },
10
- "homepage": "https://github.com/vatsashah45/Valiron/tree/main/packages/valiron-sdk#readme",
10
+ "homepage": "https://valiron.co",
11
11
  "bugs": {
12
12
  "url": "https://github.com/vatsashah45/Valiron/issues"
13
13
  },