@valiron/sdk 0.9.2 → 0.11.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/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`
@@ -102,6 +112,25 @@ export interface WalletProfile {
102
112
  localReputation: LocalReputation | null;
103
113
  routing: RoutingExplanation;
104
114
  chain: ChainContext;
115
+ /** How the wallet was resolved to an agentId. */
116
+ resolutionSource?: "redis" | "subgraph" | "cache" | "none";
117
+ timestamp: string;
118
+ }
119
+ /**
120
+ * Response from `GET /operator/resolve-wallet/:wallet`
121
+ *
122
+ * Lightweight wallet → agentId resolution without the full trust profile.
123
+ */
124
+ export type ResolutionSource = "redis" | "subgraph" | "cache" | "none";
125
+ export interface WalletResolution {
126
+ wallet: string;
127
+ agentId: string | null;
128
+ /** How the wallet was resolved. */
129
+ source: ResolutionSource;
130
+ /** Chain ID of the resolved agent (from subgraph), if available */
131
+ chainId?: number | null;
132
+ /** Agent name (from subgraph), if available */
133
+ agentName?: string | null;
105
134
  timestamp: string;
106
135
  }
107
136
  /**
@@ -117,6 +146,26 @@ export interface SandboxResult {
117
146
  chain: ChainContext;
118
147
  message: string;
119
148
  }
149
+ /**
150
+ * Response from `GET /operator/agent/:agentId/snapshot`
151
+ *
152
+ * Opaque behavioral snapshot hash for hash-chain commitments.
153
+ * Contains no raw metrics — only the deterministic hash, the previous
154
+ * hash in the chain, and metadata.
155
+ */
156
+ export interface AgentSnapshotSummary {
157
+ agentId: string;
158
+ /** Deterministic SHA-256 hash of the behavioral evaluation. Opaque — cannot be reversed to raw metrics. */
159
+ snapshotHash: string;
160
+ /** Hash of the prior snapshot, or "0x0" for the first evaluation. */
161
+ previousHash: string;
162
+ /** IPFS CID of the encrypted full snapshot data, or null if unavailable. */
163
+ encryptedDataUri: string | null;
164
+ /** ISO 8601 timestamp of when the evaluation was performed. */
165
+ timestamp: string | null;
166
+ /** Total number of interactions in the evaluation window. */
167
+ interactionCount: number;
168
+ }
120
169
  /** Options for `gate()` call. */
121
170
  export interface GateOptions {
122
171
  /** Minimum Valiron score to allow (default: 65 = BA tier). */
@@ -144,6 +193,8 @@ export interface GateResult {
144
193
  sandboxRan: boolean;
145
194
  /** Whether cached results were used. */
146
195
  cached: boolean;
196
+ /** Whether the score is from a micro-sandbox (fast, limited coverage). When true, a full deep test is running in the background and will update the cached score. */
197
+ provisional?: boolean;
147
198
  }
148
199
  /** Options that can be passed to individual SDK method calls. */
149
200
  export interface CallOptions {
@@ -77,6 +77,34 @@ Same structure as `GET /operator/agent/:agentId`.
77
77
 
78
78
  ---
79
79
 
80
+ ## GET /operator/resolve-wallet/:wallet
81
+
82
+ Lightweight wallet → agentId resolution. Returns just the agent ID and how it was resolved, without the full trust profile.
83
+
84
+ Resolution chain: Redis → Agent0 subgraph → null.
85
+
86
+ ### Parameters
87
+
88
+ | Parameter | Location | Type | Required | Description |
89
+ |-----------|----------|------|----------|-------------|
90
+ | `wallet` | path | string | yes | Ethereum address (0x...) |
91
+ | `chain` | query | string | no | Network override (default: ethereum) |
92
+
93
+ ### Response — 200 OK
94
+
95
+ ```json
96
+ {
97
+ "wallet": "0x52ce...",
98
+ "agentId": "25459",
99
+ "source": "subgraph",
100
+ "chainId": 1,
101
+ "agentName": "MyAgent",
102
+ "timestamp": "2024-01-01T00:00:00.000Z"
103
+ }
104
+ ```
105
+
106
+ ---
107
+
80
108
  ## POST /operator/trigger-sandbox/:agentId
81
109
 
82
110
  Execute real-time sandbox tests against an agent and compute a trust evaluation.
@@ -166,6 +194,90 @@ Trust gate — combined on-chain reputation + sandbox check. Returns an allow/de
166
194
 
167
195
  ---
168
196
 
197
+ ## GET /operator/agent/:agentId/snapshot
198
+
199
+ Get the latest behavioral snapshot hash for an agent. Returns an opaque hash suitable for on-chain commitment systems.
200
+
201
+ ### Parameters
202
+
203
+ | Parameter | Location | Type | Required | Description |
204
+ |-----------|----------|------|----------|-------------|
205
+ | `agentId` | path | string | yes | ERC-8004 token ID |
206
+ | `chain` | query | string | no | Network override |
207
+
208
+ ### Response — 200 OK
209
+
210
+ ```json
211
+ {
212
+ "agentId": "25459",
213
+ "snapshotHash": "0x3a7f2b...",
214
+ "previousHash": "0x0",
215
+ "encryptedDataUri": null,
216
+ "timestamp": "2026-04-01T12:00:00.000Z",
217
+ "interactionCount": 15
218
+ }
219
+ ```
220
+
221
+ ### Error Responses
222
+
223
+ | Status | Meaning |
224
+ |--------|---------|
225
+ | 400 | Invalid agentId |
226
+ | 404 | Agent not found or no snapshot available (trigger a sandbox evaluation first) |
227
+ | 500 | Internal server error |
228
+
229
+ ---
230
+
231
+ ## POST /operator/webhooks/register
232
+
233
+ Register a webhook URL to receive `evaluation_complete` events whenever Valiron evaluates an agent.
234
+
235
+ ### Request Body
236
+
237
+ ```json
238
+ {
239
+ "event": "evaluation_complete",
240
+ "url": "https://your-endpoint.com/hooks/valiron",
241
+ "agentIds": [42, 43]
242
+ }
243
+ ```
244
+
245
+ | Field | Type | Required | Description |
246
+ |-------|------|----------|-------------|
247
+ | `event` | string | yes | Must be `"evaluation_complete"` |
248
+ | `url` | string | yes | HTTPS endpoint to receive webhook POST requests |
249
+ | `agentIds` | number[] | no | Filter to specific agent IDs. Omit for all agents. |
250
+
251
+ ### Response — 201 Created
252
+
253
+ ```json
254
+ {
255
+ "id": "a1b2c3d4-...",
256
+ "event": "evaluation_complete",
257
+ "url": "https://your-endpoint.com/hooks/valiron",
258
+ "agentIds": [42, 43],
259
+ "createdAt": "2026-04-01T12:00:00.000Z"
260
+ }
261
+ ```
262
+
263
+ ### Webhook Payload
264
+
265
+ When an evaluation completes, Valiron POSTs the following to your registered URL:
266
+
267
+ ```json
268
+ {
269
+ "event": "evaluation_complete",
270
+ "agentId": "25459",
271
+ "snapshotHash": "0x3a7f2b...",
272
+ "previousHash": "0x8b2c1a...",
273
+ "encryptedDataUri": null,
274
+ "timestamp": "2026-04-01T12:05:00.000Z",
275
+ "interactionCount": 16
276
+ }
277
+ ```
278
+
279
+ ---
280
+
169
281
  ## GET /operator/health
170
282
 
171
283
  Health check endpoint.
package/docs/CHAINS.md CHANGED
@@ -1,6 +1,6 @@
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 blockchain networks. The ERC-8004 contracts are deployed at the same addresses on every chain.
4
4
 
5
5
  ## Contract Addresses (all chains)
6
6
 
@@ -34,6 +34,26 @@ Valiron operates across 21 blockchain networks. The ERC-8004 contracts are deplo
34
34
  | — | Soneium | `soneium` |
35
35
  | — | Taiko | `taiko` |
36
36
  | — | X Layer | `xlayer` |
37
+ | — | Base Sepolia | `base_sepolia` |
38
+ | — | Ethereum Sepolia | `ethereum_sepolia` |
39
+ | — | Abstract Testnet | `abstract_testnet` |
40
+ | — | Arbitrum Sepolia | `arbitrum_sepolia` |
41
+ | — | Avalanche Testnet | `avalanche_testnet` |
42
+ | — | BSC Testnet | `bsc_testnet` |
43
+ | — | Celo Testnet | `celo_testnet` |
44
+ | — | Linea Sepolia | `linea_sepolia` |
45
+ | — | Mantle Testnet | `mantle_testnet` |
46
+ | — | MegaETH Testnet | `megaeth_testnet` |
47
+ | — | Metis Sepolia | `metis_sepolia` |
48
+ | — | Optimism Sepolia | `optimism_sepolia` |
49
+ | — | Polygon Amoy | `polygon_amoy` |
50
+ | — | Scroll Sepolia | `scroll_sepolia` |
51
+ | — | SKALE Base Sepolia | `skale_base_sepolia` |
52
+ | — | Soneium Minato | `soneium_minato` |
53
+ | — | Taiko Hoodi | `taiko_hoodi` |
54
+ | — | X Layer Testnet | `xlayer_testnet` |
55
+ | — | Hedera Testnet | `hedera_testnet` |
56
+ | — | Arc Testnet | `arc_testnet` |
37
57
 
38
58
  ## Specifying a Chain
39
59
 
@@ -57,6 +57,28 @@ console.log(result.meetsThreshold); // true
57
57
  - If your route is `sandbox` — your behavior is being evaluated. Follow the guidelines in [TRUST-MODEL.md](./TRUST-MODEL.md) to improve.
58
58
  - If your route is `sandbox_only` — you are blocked from production. Review your behavioral penalties.
59
59
 
60
+ ## Step 6 — Get a behavioral snapshot (optional)
61
+
62
+ If you're building on top of Valiron (e.g. hash-chain commitment systems), you can retrieve an opaque snapshot hash:
63
+
64
+ ```typescript
65
+ const snapshot = await valiron.getAgentSnapshot("YOUR_AGENT_ID");
66
+
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
70
+ ```
71
+
72
+ ## Step 7 — Register a webhook (optional)
73
+
74
+ Get notified whenever Valiron evaluates an agent:
75
+
76
+ ```bash
77
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
78
+ -H "Content-Type: application/json" \
79
+ -d '{"event": "evaluation_complete", "url": "https://your-endpoint.com/hooks/valiron"}'
80
+ ```
81
+
60
82
  ## Using the HTTP API directly (no SDK)
61
83
 
62
84
  ```bash
@@ -68,4 +90,12 @@ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YO
68
90
 
69
91
  # Trust gate (allow/deny decision)
70
92
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/gate/YOUR_AGENT_ID
93
+
94
+ # Behavioral snapshot hash
95
+ curl https://valiron-edge-proxy.onrender.com/operator/agent/YOUR_AGENT_ID/snapshot
96
+
97
+ # Register webhook
98
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
99
+ -H "Content-Type: application/json" \
100
+ -d '{"event": "evaluation_complete", "url": "https://your-endpoint.com/hooks"}'
71
101
  ```
@@ -37,7 +37,13 @@ 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";
41
47
  ```
42
48
 
43
49
  ---
@@ -120,6 +126,37 @@ console.log(profile.routing.finalRoute);
120
126
 
121
127
  ---
122
128
 
129
+ ### resolveWallet(wallet, options?)
130
+
131
+ Lightweight wallet → agentId resolution without the full trust profile. Useful when you only need to know which agent owns a wallet (e.g. after extracting a wallet from an x402 payment header).
132
+
133
+ Resolution chain: Redis → in-memory cache → Agent0 subgraph → null.
134
+
135
+ Signature: `resolveWallet(wallet: string, options?: { chain?: SupportedChain }): Promise<WalletResolution>`
136
+
137
+ **Returns**: `WalletResolution`
138
+
139
+ ```typescript
140
+ interface WalletResolution {
141
+ wallet: string;
142
+ agentId: string | null;
143
+ source: "redis" | "subgraph" | "cache" | "none";
144
+ chainId?: number | null;
145
+ agentName?: string | null;
146
+ timestamp: string;
147
+ }
148
+ ```
149
+
150
+ **Example**:
151
+ ```typescript
152
+ const resolution = await valiron.resolveWallet("0x52ce...");
153
+ if (resolution.agentId) {
154
+ const profile = await valiron.getAgentProfile(resolution.agentId);
155
+ }
156
+ ```
157
+
158
+ ---
159
+
123
160
  ### triggerSandboxTest(agentId, options?)
124
161
 
125
162
  Run sandbox tests against an agent and compute a trust evaluation.
@@ -203,6 +240,44 @@ if (result.allow) {
203
240
 
204
241
  ---
205
242
 
243
+ ### getAgentSnapshot(agentId, options?)
244
+
245
+ Get the latest behavioral snapshot hash for an agent. Returns an opaque hash of the most recent behavioral evaluation — designed for hash-chain commitment systems that need to commit behavioral state on-chain without accessing raw metrics.
246
+
247
+ ```typescript
248
+ const snapshot = await valiron.getAgentSnapshot(agentId: string, options?: {
249
+ chain?: SupportedChain;
250
+ }): Promise<AgentSnapshotSummary>;
251
+ ```
252
+
253
+ **Returns**: `AgentSnapshotSummary`
254
+
255
+ ```typescript
256
+ interface AgentSnapshotSummary {
257
+ agentId: string;
258
+ snapshotHash: string; // deterministic SHA-256 hash of behavioral evaluation (opaque)
259
+ previousHash: string; // hash from prior evaluation, or "0x0" for first
260
+ encryptedDataUri: string | null; // IPFS CID of encrypted snapshot data, if available
261
+ timestamp: string | null; // ISO 8601 timestamp of evaluation
262
+ interactionCount: number; // total interactions in the evaluation window
263
+ }
264
+ ```
265
+
266
+ **Example**:
267
+ ```typescript
268
+ const snapshot = await valiron.getAgentSnapshot("25459");
269
+ console.log(snapshot.snapshotHash); // "0x3a7f..."
270
+ console.log(snapshot.previousHash); // "0x0" (genesis) or "0x8b2c..."
271
+ console.log(snapshot.interactionCount); // 15
272
+ ```
273
+
274
+ **Notes**:
275
+ - The `snapshotHash` is computed internally by Valiron from behavioral metrics. It is opaque — you cannot reverse it to raw metrics.
276
+ - Each hash references the `previousHash`, forming a chain. First evaluation gets `"0x0"`.
277
+ - Trigger a sandbox evaluation first if no snapshot exists (returns 404 otherwise).
278
+
279
+ ---
280
+
206
281
  ### createValironGate(config)
207
282
 
208
283
  Express-compatible middleware factory. Automatically gates requests based on agent trust.
package/docs/llms.txt CHANGED
@@ -21,6 +21,13 @@ POST /operator/trigger-sandbox/{agentId}
21
21
  POST /operator/gate/{agentId}
22
22
  Body: { "ttlMs": 86400000 }
23
23
 
24
+ ### Behavioral snapshot hash
25
+ GET /operator/agent/{agentId}/snapshot
26
+
27
+ ### Register webhook
28
+ POST /operator/webhooks/register
29
+ Body: { "event": "evaluation_complete", "url": "https://your-endpoint.com/hooks", "agentIds": [42] }
30
+
24
31
  ### Health check
25
32
  GET /operator/health
26
33
 
@@ -42,6 +49,11 @@ const profile = await valiron.getAgentProfile("AGENT_ID");
42
49
  // Trust gate (allow/deny for payments)
43
50
  const gate = await valiron.gate("AGENT_ID");
44
51
  if (gate.allow) { /* proceed */ }
52
+
53
+ // Behavioral snapshot (for hash-chain commitments)
54
+ const snapshot = await valiron.getAgentSnapshot("AGENT_ID");
55
+ console.log(snapshot.snapshotHash); // "0xabc..."
56
+ console.log(snapshot.previousHash); // "0x0" (genesis)
45
57
  ```
46
58
 
47
59
  ## Trust Tiers
@@ -82,6 +94,7 @@ ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc,
82
94
 
83
95
  ## Documentation
84
96
 
97
+ - [Full documentation (llms-full.txt)](https://valiron.co/llms-full.txt) — Complete AI-optimized documentation in a single file
85
98
  - docs/agents/README.md — Index
86
99
  - docs/agents/QUICKSTART.md — Get started
87
100
  - docs/agents/API-REFERENCE.md — HTTP API reference
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "Official TypeScript SDK for Valiron - Trust Layer for Agentic Economy",
5
5
  "repository": {
6
6
  "type": "git",