@valiron/sdk 0.12.0 → 1.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.
@@ -216,13 +216,7 @@ interface SandboxResult {
216
216
  tier: MoodysRating; // "AAA" | "AA" | "A" | "BAA" | "BA" | "B" | "CAA" | "CA" | "C"
217
217
  riskLevel: "GREEN" | "YELLOW" | "RED";
218
218
  meetsThreshold: boolean;
219
- testSummary: {
220
- totalRequests: number;
221
- successCount: number;
222
- rateLimitCount: number;
223
- errorCount: number;
224
- avgLatencyMs: number;
225
- };
219
+ testSummary: object; // Opaque test metrics (structure is proprietary)
226
220
  chain: ChainContext;
227
221
  message: string;
228
222
  }
@@ -379,235 +373,291 @@ Call this when shutting down long-running processes.
379
373
 
380
374
  ---
381
375
 
382
- ## Payment Channels (Solana)
383
-
384
- Trust-adaptive USDC payment channels on Solana. Agents deposit USDC to an escrow, receive a credit line based on their trust tier, consume credit per API call, and get refunded unused balance on settlement.
385
-
386
- > **Solana only.** These methods call `/channel/*` endpoints, not `/operator/*`.
376
+ ## Proxy Gateway (Pro)
387
377
 
388
- ### channelPreflight(agentId, walletAddress)
378
+ Forward requests through Valiron's edge proxy with automatic trust gating, logging, and SSRF protection.
389
379
 
390
- Pre-flight gate check. Returns the agent's trust tier, credit line, and the escrow address to deposit USDC to.
380
+ ### proxy(request)
391
381
 
392
382
  ```typescript
393
- const preflight = await valiron.channelPreflight(
394
- agentId: string,
395
- walletAddress: string,
396
- ): Promise<ChannelPreflightResponse>;
383
+ const result = await valiron.proxy(request: ProxyRequest): Promise<ProxyResponse>;
397
384
  ```
398
385
 
399
- **Returns**: `ChannelPreflightResponse`
386
+ #### ProxyRequest
400
387
 
401
- ```typescript
402
- interface ChannelPreflightResponse {
403
- agentId: string;
404
- tier: string; // "AAA" | "AA" | "A" | "BAA" | "BA" | "B"
405
- score: number;
406
- riskLevel: string; // "GREEN" | "YELLOW" | "RED"
407
- creditLine: string; // USDC in base units (6 decimals)
408
- creditLineReadable: string; // e.g. "$50.00"
409
- maxRequests: number | null;
410
- durationSeconds: number;
411
- escrowAddress: string; // deposit USDC here
412
- }
413
- ```
388
+ | Field | Type | Required | Description |
389
+ |-------|------|----------|-------------|
390
+ | `agentId` | string | yes | Agent to gate |
391
+ | `targetUrl` | string | yes | Your origin URL to forward to |
392
+ | `method` | string | no | HTTP method (default: `GET`) |
393
+ | `headers` | Record<string, string> | no | Headers to forward |
394
+ | `body` | string | no | Request body |
395
+
396
+ #### ProxyResponse
397
+
398
+ | Field | Type | Description |
399
+ |-------|------|-------------|
400
+ | `statusCode` | number | HTTP status from your origin |
401
+ | `responseHeaders` | Record<string, string> | Response headers |
402
+ | `responseBody` | string | Response body |
403
+ | `responseMs` | number | Round-trip latency |
404
+ | `costCharged` | string | USD cost charged |
405
+ | `route` | string | Route decision applied |
406
+ | `tierResolved` | string | Trust tier used |
414
407
 
415
408
  **Example**:
416
409
  ```typescript
417
- const preflight = await valiron.channelPreflight("1226", "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU");
418
- console.log(preflight.escrowAddress); // "EscrowPubkey..."
419
- console.log(preflight.creditLineReadable); // "$50.00"
420
- console.log(preflight.tier); // "AA"
421
- console.log(preflight.durationSeconds); // 2700 (45 min)
410
+ const result = await valiron.proxy({
411
+ agentId: "25459",
412
+ targetUrl: "https://your-api.com/data",
413
+ method: "POST",
414
+ headers: { "Content-Type": "application/json" },
415
+ body: JSON.stringify({ query: "example" }),
416
+ });
422
417
  ```
423
418
 
424
- **Tier Credit Line Table**:
425
-
426
- | Tier | Credit Line | Duration | Max Requests |
427
- |------|-------------|----------|--------------|
428
- | AAA | $100 | 60 min | unlimited |
429
- | AA | $50 | 45 min | unlimited |
430
- | A | $25 | 30 min | unlimited |
431
- | BAA | $10 | 20 min | 100 |
432
- | BA | $5 | 15 min | 50 |
433
- | B | $1 | 10 min | 10 |
419
+ > **SSRF Protection:** The proxy blocks requests to private IPs (10.x, 172.16-31.x, 192.168.x), localhost, link-local addresses, and cloud metadata endpoints (169.254.169.254).
434
420
 
435
421
  ---
436
422
 
437
- ### channelOpen(agentId, walletAddress, depositSignature)
423
+ ## Key-Based Agents
438
424
 
439
- Open a payment channel after depositing USDC to the escrow address.
425
+ For Web2 agents that don't have on-chain identities, Valiron supports key-based authentication using EIP-191 challenge-response.
440
426
 
441
- ```typescript
442
- const channel = await valiron.channelOpen(
443
- agentId: string,
444
- walletAddress: string,
445
- depositSignature: string,
446
- ): Promise<ChannelOpenResponse>;
447
- ```
427
+ **How it works:**
428
+ 1. Agent sends a request with `x-agent-address: 0x...` header
429
+ 2. Valiron returns a challenge nonce
430
+ 3. Agent signs the nonce with their private key
431
+ 4. Valiron verifies the signature and creates a `KeyAgentProfile`
448
432
 
449
- **Returns**: `ChannelOpenResponse`
433
+ The SDK auto-detects key-based agents from the `x-agent-address` header. No configuration needed.
450
434
 
451
- ```typescript
452
- interface ChannelOpenResponse {
453
- sessionId: string; // use this for consume/status/settle
454
- agentId: string;
455
- tier: string;
456
- score: number;
457
- riskLevel: string;
458
- creditLine: string;
459
- creditLineReadable: string;
460
- maxRequests: number | null;
461
- expiresAt: string; // ISO 8601
462
- durationSeconds: number;
463
- depositConfirmed: boolean;
464
- depositSignature: string;
465
- escrowAddress: string;
466
- }
467
- ```
435
+ ### KeyAgentProfile
468
436
 
469
- **Example**:
470
- ```typescript
471
- const channel = await valiron.channelOpen(
472
- "1226",
473
- "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
474
- "5eykt4UsFv8P8njDFTxgkW8oVTc4BM3dTCrssAtMJDVmqYS5",
475
- );
476
- console.log(channel.sessionId); // "ch_a1b2c3..."
477
- console.log(channel.creditLineReadable); // "$50.00"
478
- console.log(channel.expiresAt); // "2026-04-23T13:45:00.000Z"
479
- ```
437
+ | Field | Type | Description |
438
+ |-------|------|-------------|
439
+ | `address` | string | Ethereum address |
440
+ | `isKeyAgent` | boolean | Always `true` |
441
+ | `tier` | string | Trust tier (starts at C, can improve) |
442
+ | `riskLevel` | string | GREEN / YELLOW / RED |
443
+ | `route` | string | Route decision |
444
+ | `firstSeen` | string | ISO timestamp of first interaction |
445
+ | `totalRequests` | number | Lifetime request count |
480
446
 
481
447
  ---
482
448
 
483
- ### channelConsume(sessionId, cost, description?)
449
+ ## World ID Methods
484
450
 
485
- Charge against an open channel's credit line. Each call records a usage entry.
451
+ Verify agent-human linkage via Worldcoin's zero-knowledge proof system.
486
452
 
487
- ```typescript
488
- const usage = await valiron.channelConsume(
489
- sessionId: string,
490
- cost: number,
491
- description?: string,
492
- ): Promise<ChannelConsumeResponse>;
493
- ```
453
+ ### verifyWorldId(agentId, proof, options?)
494
454
 
495
- **Returns**: `ChannelConsumeResponse`
455
+ Submit a World ID proof for verification.
496
456
 
497
457
  ```typescript
498
- interface ChannelConsumeResponse {
499
- requestId: string;
500
- cost: string;
501
- costReadable: string;
502
- description?: string;
503
- session: {
504
- consumed: string;
505
- consumedReadable: string;
506
- remaining: string;
507
- remainingReadable: string;
508
- requestCount: number;
509
- maxRequests: number | null;
510
- secondsRemaining: number;
511
- };
512
- }
458
+ const result = await valiron.verifyWorldId(agentId: string, proof: WorldIdProof, options?: {
459
+ chain?: SupportedChain;
460
+ }): Promise<WorldIdVerificationResult>;
513
461
  ```
514
462
 
515
463
  **Example**:
516
464
  ```typescript
517
- const usage = await valiron.channelConsume("ch_a1b2c3", 0.50, "GPT-4o inference");
518
- console.log(usage.session.remainingReadable); // "$49.50"
519
- console.log(usage.session.requestCount); // 1
520
- console.log(usage.session.secondsRemaining); // 2685
465
+ const result = await valiron.verifyWorldId("25459", {
466
+ merkle_root: "0x...",
467
+ nullifier_hash: "0x...",
468
+ proof: "0x...",
469
+ signal: "0x...",
470
+ });
521
471
  ```
522
472
 
523
- ---
524
-
525
- ### channelStatus(sessionId)
473
+ ### getWorldIdStatus(agentId, options?)
526
474
 
527
- Query current state of a payment channel.
475
+ Check if an agent has a verified World ID.
528
476
 
529
477
  ```typescript
530
- const status = await valiron.channelStatus(
531
- sessionId: string,
532
- ): Promise<ChannelStatusResponse>;
478
+ const status = await valiron.getWorldIdStatus(agentId: string, options?: {
479
+ chain?: SupportedChain;
480
+ }): Promise<WorldIdStatus>;
481
+ // { verified: true, verifiedAt: "2025-01-15T...", level: "orb" }
533
482
  ```
534
483
 
535
- **Returns**: `ChannelStatusResponse`
484
+ ### getWorldIdProfile(agentId, options?)
485
+
486
+ Get full World ID profile including verification details.
536
487
 
537
488
  ```typescript
538
- interface ChannelStatusResponse {
539
- sessionId: string;
540
- agentId: string;
541
- tier: string;
542
- creditLine: string;
543
- creditLineReadable: string;
544
- consumed: string;
545
- consumedReadable: string;
546
- remaining: string;
547
- remainingReadable: string;
548
- requestCount: number;
549
- maxRequests: number | null;
550
- expiresAt: string;
551
- secondsRemaining: number;
552
- active: boolean;
553
- settled: boolean;
554
- }
489
+ const profile = await valiron.getWorldIdProfile(agentId: string, options?: {
490
+ chain?: SupportedChain;
491
+ }): Promise<WorldIdAgentProfile>;
555
492
  ```
556
493
 
494
+ ---
495
+
496
+ ## Telemetry
497
+
498
+ The SDK optionally collects anonymous usage metrics (gate calls, latency, error rates). Telemetry is opt-in and can be fully disabled.
499
+
500
+ ### TelemetryConfig
501
+
502
+ | Field | Type | Default | Description |
503
+ |-------|------|---------|-------------|
504
+ | `enabled` | boolean | `true` | Enable/disable telemetry |
505
+ | `sampleRate` | number | `1.0` | Fraction of events to sample (0–1) |
506
+ | `handler` | function | — | Custom event handler |
507
+
557
508
  **Example**:
558
509
  ```typescript
559
- const status = await valiron.channelStatus("ch_a1b2c3");
560
- if (status.active && !status.settled) {
561
- console.log(`${status.remainingReadable} remaining, ${status.requestCount} requests served`);
562
- }
510
+ const valiron = new ValironSDK({
511
+ telemetry: {
512
+ enabled: false, // Disable entirely
513
+ },
514
+ });
515
+
516
+ // Or with custom sampling and handler
517
+ const valiron = new ValironSDK({
518
+ telemetry: {
519
+ sampleRate: 0.1, // Sample 10% of events
520
+ handler: (event) => { // Custom handler
521
+ myAnalytics.track(event);
522
+ },
523
+ },
524
+ });
563
525
  ```
564
526
 
565
527
  ---
566
528
 
567
- ### channelSettle(sessionId)
529
+ ## Middleware
530
+
531
+ ### createValironGate(config) — Express
568
532
 
569
- Close a payment channel and refund unused USDC to the agent's wallet.
533
+ See above for full documentation.
534
+
535
+ ### valironFastifyPlugin — Fastify
570
536
 
571
537
  ```typescript
572
- const settlement = await valiron.channelSettle(
573
- sessionId: string,
574
- ): Promise<ChannelSettlementResponse>;
538
+ import { ValironSDK, valironFastifyPlugin } from "@valiron/sdk";
539
+
540
+ const valiron = new ValironSDK({ chain: "monad" });
541
+
542
+ fastify.register(valironFastifyPlugin, {
543
+ sdk: valiron,
544
+ prefix: "/api/paid",
545
+ });
575
546
  ```
576
547
 
577
- **Returns**: `ChannelSettlementResponse`
548
+ ### createValironNextMiddleware — Next.js
578
549
 
579
550
  ```typescript
580
- interface ChannelSettlementResponse {
581
- sessionId: string;
582
- settled: boolean;
583
- totalConsumed: string;
584
- totalConsumedReadable: string;
585
- requestsServed: number;
586
- unusedCredit: string;
587
- unusedCreditReadable: string;
588
- refundAmount?: string;
589
- refundReadable?: string;
590
- refundSignature?: string; // Solana TX signature
591
- refundWarning?: string; // set if refund failed
592
- }
551
+ import { ValironSDK, createValironNextMiddleware } from "@valiron/sdk";
552
+
553
+ const valiron = new ValironSDK();
554
+ export default createValironNextMiddleware({
555
+ sdk: valiron,
556
+ pathPrefix: "/api/paid",
557
+ });
593
558
  ```
594
559
 
595
- **Example**:
560
+ ### valironGateCheck — Generic (Hono, Koa, etc.)
561
+
596
562
  ```typescript
597
- const settlement = await valiron.channelSettle("ch_a1b2c3");
598
- console.log(settlement.totalConsumedReadable); // "$0.50"
599
- console.log(settlement.refundReadable); // "$49.50"
600
- console.log(settlement.refundSignature); // "4sGjMW..." (Solana TX)
563
+ import { ValironSDK, valironGateCheck } from "@valiron/sdk";
564
+
565
+ const valiron = new ValironSDK();
566
+
567
+ app.use(async (c, next) => {
568
+ const agentId = c.req.header("x-agent-id");
569
+ const result = await valironGateCheck(valiron, agentId);
570
+ if (!result.allow) return c.json({ error: "Denied" }, 403);
571
+ await next();
572
+ });
601
573
  ```
602
574
 
575
+ ### Middleware Error Responses
576
+
577
+ All middleware variants return consistent error responses:
578
+
579
+ | Status | When | Body |
580
+ |--------|------|------|
581
+ | 401 | No agent ID found in request | `{ error: "No agent identity provided" }` |
582
+ | 403 | Agent denied by trust gate | `{ error: "Access denied", tier, riskLevel, route }` |
583
+ | 503 | Valiron service unavailable | `{ error: "Trust evaluation unavailable" }` |
584
+
585
+ > **Fail-closed:** When the Valiron service is unreachable, middleware returns 503 — it never fails open and never allows unverified agents through.
586
+
603
587
  ---
604
588
 
605
- ### channelHealth()
589
+ ## Response Types
590
+
591
+ ### GateResult
592
+
593
+ Returned by `gate()` and middleware.
594
+
595
+ | Field | Type | Description |
596
+ |-------|------|-------------|
597
+ | `allow` | boolean | Whether the agent is allowed access |
598
+ | `tier` | string | Trust tier (AAA–C) |
599
+ | `riskLevel` | string | GREEN / YELLOW / RED |
600
+ | `route` | string | `prod` / `prod_throttled` / `sandbox` / `sandbox_only` |
601
+ | `meetsThreshold` | boolean | Whether the agent meets the minimum trust threshold |
602
+ | `agentId` | string | The evaluated agent ID |
603
+ | `wallet` | string | Agent's wallet address |
604
+ | `chain` | object | Chain context |
605
+ | `sandboxRan` | boolean | Whether sandbox was executed |
606
+ | `cached` | boolean | Whether the result was served from cache |
606
607
 
607
- Check if the payment channel service is running and whether an escrow wallet is configured.
608
+ ### AgentProfile
609
+
610
+ Returned by `getAgentProfile()`.
611
+
612
+ | Field | Type | Description |
613
+ |-------|------|-------------|
614
+ | `agentId` | string | ERC-8004 token ID |
615
+ | `identity` | object | On-chain identity (name, wallet, endpoints, trustModels) |
616
+ | `onchainReputation` | object | Feedback count, average score, Solana ATOM metrics |
617
+ | `routing` | object | `{ finalRoute, meetsThreshold }` |
618
+ | `chain` | object | `{ name, chainId }` |
619
+ | `timestamp` | string | ISO timestamp |
620
+
621
+ ### Request Headers
622
+
623
+ Headers attached to proxied/gated requests:
624
+
625
+ | Header | Description |
626
+ |--------|-------------|
627
+ | `x-agent-id` | The agent's ERC-8004 token ID |
628
+ | `x-agent-address` | The agent's wallet address (key-based agents) |
629
+ | `x-valiron-tier` | Resolved trust tier |
630
+ | `x-valiron-route` | Route decision |
631
+ | `x-valiron-risk` | Risk level |
632
+
633
+ ### All Exports
608
634
 
609
635
  ```typescript
610
- const health = await valiron.channelHealth(): Promise<ChannelHealthResponse>;
636
+ import {
637
+ ValironSDK,
638
+ ValironOperator,
639
+ ValironClient,
640
+ createValironGate,
641
+ valironFastifyPlugin,
642
+ createValironNextMiddleware,
643
+ valironGateCheck,
644
+ isValidAddress,
645
+ generateChallenge,
646
+ } from "@valiron/sdk";
611
647
  ```
612
648
 
613
- **Returns**: `{ status: string; service: string; escrowAddress: string | null }`
649
+ ---
650
+
651
+ ## Plans & Limits
652
+
653
+ | Feature | Free | Pro |
654
+ |---------|------|-----|
655
+ | Gated endpoints | 3 | Unlimited |
656
+ | Sandbox tests / day | 5 | Unlimited |
657
+ | Webhooks | — | ✓ |
658
+ | Proxy gateway | — | ✓ |
659
+ | Analytics & logs | — | ✓ |
660
+ | Evaluation history | — | ✓ |
661
+ | Custom tier thresholds | — | ✓ |
662
+
663
+ Pro plan requires an operator API key (`val_op_` prefix) from the [Operator Dashboard](./DASHBOARD.md).
@@ -20,38 +20,13 @@ Valiron assigns a Moody's-style credit tier based on an agent's behavioral evalu
20
20
 
21
21
  ## Behavioral Factors
22
22
 
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
-
25
- Areas evaluated include:
26
-
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?
23
+ Valiron evaluates agents across multiple behavioral dimensions. The evaluation is holistic — no single factor determines the outcome. The specific factors evaluated and their weights are proprietary and not disclosed.
38
24
 
39
25
  On-chain reputation from the ERC-8004 Reputation Registry is also factored into the evaluation.
40
26
 
41
27
  ## What Makes an Agent Trustworthy
42
28
 
43
- Agents that follow these patterns will earn the highest trust tiers on your endpoints:
44
-
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.
29
+ Agents that demonstrate responsible API usage patterns will earn the highest trust tiers. The specific behaviors that contribute to trust scoring are proprietary. In general, agents that are well-behaved, respect API boundaries, and handle errors gracefully will score highly.
55
30
 
56
31
  ## Checking an Agent's Trust Status
57
32
 
package/docs/llms.txt CHANGED
@@ -37,24 +37,6 @@ Body: { "event": "evaluation_complete", "url": "https://your-endpoint.com/hooks"
37
37
  ### Health check
38
38
  GET /operator/health
39
39
 
40
- ### Payment Channels (Solana — USDC credit lines)
41
- POST /channel/preflight/{agentId}
42
- Body: { "walletAddress": "SolanaWalletPubkey" }
43
-
44
- POST /channel/open/{agentId}
45
- Body: { "walletAddress": "...", "depositSignature": "SolanaTxSig" }
46
-
47
- POST /channel/consume/{sessionId}
48
- Headers: Authorization: Bearer {sessionId}
49
- Body: { "cost": 0.50, "description": "API call" }
50
-
51
- GET /channel/status/{sessionId}
52
-
53
- POST /channel/settle/{sessionId}
54
- Body: {}
55
-
56
- GET /channel/health
57
-
58
40
  ## SDK
59
41
 
60
42
  Install: npm install @valiron/sdk
@@ -78,13 +60,6 @@ if (gate.allow) { /* proceed */ }
78
60
  const snapshot = await valiron.getAgentSnapshot("AGENT_ID");
79
61
  console.log(snapshot.snapshotHash); // "0xabc..."
80
62
  console.log(snapshot.previousHash); // "0x0" (genesis)
81
-
82
- // Payment channels (Solana) — trust-adaptive USDC credit lines
83
- const preflight = await valiron.channelPreflight("1226", "SolanaWallet...");
84
- const channel = await valiron.channelOpen("1226", "SolanaWallet...", "depositTxSig");
85
- const usage = await valiron.channelConsume(channel.sessionId, 0.50, "GPT-4o call");
86
- const status = await valiron.channelStatus(channel.sessionId);
87
- const settlement = await valiron.channelSettle(channel.sessionId);
88
63
  ```
89
64
 
90
65
  ## Trust Tiers
@@ -145,6 +120,7 @@ ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc,
145
120
  - [Full documentation (llms-full.txt)](https://valiron.co/llms-full.txt) — Complete AI-optimized documentation in a single file
146
121
  - docs/agents/README.md — Index
147
122
  - docs/agents/QUICKSTART.md — Get started
123
+ - docs/agents/DASHBOARD.md — Operator Dashboard (manage endpoints, keys, analytics, playground)
148
124
  - docs/agents/API-REFERENCE.md — HTTP API reference
149
125
  - docs/agents/SDK-REFERENCE.md — TypeScript SDK reference
150
126
  - docs/agents/TRUST-MODEL.md — Trust evaluation and behavioral factors
@@ -152,3 +128,56 @@ ethereum, monad, arbitrum, base, avalanche, celo, polygon, linea, abstract, bsc,
152
128
  - docs/agents/SANDBOX.md — Sandbox testing environment
153
129
  - docs/agents/CHAINS.md — Supported blockchains
154
130
  - docs/agents/ERRORS.md — Error handling and troubleshooting
131
+
132
+ ## Operator Dashboard
133
+
134
+ Dashboard URL: https://valiron.co/dashboard (JWT-authenticated)
135
+
136
+ ### Dashboard Features
137
+ - Overview: revenue, calls, agents, latency stats + quick start guide
138
+ - Agents: view every agent that called your API, drill into per-agent detail
139
+ - Analytics: revenue charts (7/30/90 days), top endpoints, today's stats
140
+ - Call Logs: paginated log with time/agent/chain/endpoint/status/cost/latency filters
141
+ - API Keys: generate, copy, and revoke operator API keys (val_op_ prefix)
142
+ - Endpoints: register API paths with method, price per call, rate limit, description
143
+ - Playground: test how agents at different trust levels are evaluated (dry-run or live)
144
+ - Settings: update name, view plan and fee rate
145
+ - Admin (admin-only): platform stats, all operators
146
+
147
+ ### Dashboard API Endpoints (JWT-authenticated)
148
+
149
+ POST /operator/register
150
+ Body: { "email": "...", "password": "...", "name": "..." }
151
+
152
+ POST /operator/login
153
+ Body: { "email": "...", "password": "..." }
154
+
155
+ GET /operator/me
156
+ PATCH /operator/me
157
+ Body: { "name": "..." }
158
+
159
+ GET /operator/keys
160
+ POST /operator/keys/rotate
161
+ Body: { "label": "..." }
162
+ DELETE /operator/keys/{keyId}
163
+
164
+ GET /operator/endpoints
165
+ POST /operator/endpoints
166
+ Body: { "path": "/api/v1/weather", "method": "GET", "pricePerCall": 0.05, "description": "...", "rateLimit": 60, "targetUrl": "https://myapi.com" }
167
+ DELETE /operator/endpoints/{endpointId}
168
+
169
+ GET /operator/analytics/stats
170
+ GET /operator/analytics/revenue?days=30
171
+ GET /operator/analytics/top-endpoints?limit=10
172
+ GET /operator/analytics/agents?sortBy=lastSeen&limit=50&offset=0
173
+ GET /operator/analytics/agents/{agentId}
174
+ GET /operator/analytics/logs?limit=50&offset=0&days=7
175
+
176
+ POST /operator/playground
177
+ Body: { "method": "GET", "path": "/api/test", "agentId": "25459", "chain": "ethereum", "dryRun": false, "headers": {}, "body": null }
178
+
179
+ ### Admin Endpoints (require role: "admin")
180
+ GET /operator/admin/stats
181
+ GET /operator/admin/operators
182
+ GET /operator/admin/operators/{id}
183
+ GET /operator/admin/operators/{id}/logs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiron/sdk",
3
- "version": "0.12.0",
3
+ "version": "1.0.0",
4
4
  "description": "Official TypeScript SDK for Valiron — Trust & Reputation Middleware for API Protection",
5
5
  "repository": {
6
6
  "type": "git",