@valiron/sdk 1.0.2 → 1.1.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 +11 -3
- package/dist/clients.d.ts +36 -1
- package/dist/clients.js +44 -0
- package/dist/index.d.ts +48 -1
- package/dist/index.js +47 -0
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.js +1 -0
- package/dist/operatorSdk.d.ts +1 -1
- package/dist/operatorSdk.js +1 -0
- package/dist/telemetry.js +1 -1
- package/dist/types.d.ts +94 -2
- package/docs/AGENT-READY-APIS.md +417 -0
- package/docs/API-REFERENCE.md +266 -32
- package/docs/DASHBOARD.md +110 -28
- package/docs/ERRORS.md +11 -1
- package/docs/IDENTITY.md +67 -14
- package/docs/QUICKSTART.md +68 -18
- package/docs/README.md +20 -4
- package/docs/SDK-REFERENCE.md +53 -9
- package/docs/TRUST-MODEL.md +22 -0
- package/docs/llms.txt +123 -8
- package/package.json +2 -2
package/docs/API-REFERENCE.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Base URL: `https://valiron-edge-proxy.onrender.com`
|
|
4
4
|
|
|
5
|
-
Endpoints are organized into
|
|
5
|
+
Endpoints are organized into three groups:
|
|
6
6
|
|
|
7
7
|
- **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — No authentication required. Used by the SDK to evaluate agents.
|
|
8
8
|
- **Dashboard** (`/operator/register`, `/operator/login`, `/operator/endpoints`, etc.) — JWT-authenticated. Used by the Operator Dashboard. See [DASHBOARD.md](./DASHBOARD.md) for the UI guide.
|
|
9
|
+
- **Agent-ready wrappers** (`/wrap/:operatorId/*`) — Public agent-facing URLs created from Dashboard endpoint configs. These can enforce x402/MPP payment, optional trust checks, rate limits, and upstream forwarding.
|
|
9
10
|
|
|
10
11
|
---
|
|
11
12
|
|
|
@@ -146,7 +147,7 @@ Execute real-time sandbox tests against an agent and compute a trust evaluation.
|
|
|
146
147
|
|
|
147
148
|
## POST /operator/gate/:agentId
|
|
148
149
|
|
|
149
|
-
Trust gate —
|
|
150
|
+
Trust gate — combined on-chain reputation + sandbox check. Returns an allow/deny decision. Designed for protecting payment endpoints (x402, etc.).
|
|
150
151
|
|
|
151
152
|
### Parameters
|
|
152
153
|
|
|
@@ -158,16 +159,12 @@ Trust gate — selected trust signals scored on a normalized `0-100` scale. Retu
|
|
|
158
159
|
|
|
159
160
|
```json
|
|
160
161
|
{
|
|
161
|
-
"minScore": 65,
|
|
162
|
-
"trustSignals": ["8004", "sandbox"],
|
|
163
162
|
"ttlMs": 86400000
|
|
164
163
|
}
|
|
165
164
|
```
|
|
166
165
|
|
|
167
166
|
| Field | Type | Default | Description |
|
|
168
167
|
|-------|------|---------|-------------|
|
|
169
|
-
| `minScore` | number | 65 | Minimum normalized trust score required to allow. Must be between 0 and 100. |
|
|
170
|
-
| `trustSignals` | string[] | auto | Optional selected signals: `8004`, `sandbox`, `world`, `icebreaker`. Free plans support `8004` + `sandbox`; Pro adds `world` + `icebreaker`. |
|
|
171
168
|
| `ttlMs` | number | 86400000 | Cache TTL in milliseconds (default 24 hours) |
|
|
172
169
|
|
|
173
170
|
### Response — 200 OK
|
|
@@ -361,7 +358,7 @@ Forward a request through Valiron's edge proxy with automatic trust gating, logg
|
|
|
361
358
|
|
|
362
359
|
For Web2 agents that don't have on-chain identities, Valiron supports key-based authentication using EIP-191 challenge-response.
|
|
363
360
|
|
|
364
|
-
###
|
|
361
|
+
### POST /operator/key/:agentAddress/challenge
|
|
365
362
|
|
|
366
363
|
Get a challenge nonce for key-based authentication.
|
|
367
364
|
|
|
@@ -374,7 +371,8 @@ Get a challenge nonce for key-based authentication.
|
|
|
374
371
|
```json
|
|
375
372
|
{
|
|
376
373
|
"challenge": "valiron-challenge-abc123...",
|
|
377
|
-
"expiresAt": "2026-04-01T12:05:00.000Z"
|
|
374
|
+
"expiresAt": "2026-04-01T12:05:00.000Z",
|
|
375
|
+
"agentAddress": "0x..."
|
|
378
376
|
}
|
|
379
377
|
```
|
|
380
378
|
|
|
@@ -386,7 +384,8 @@ Verify a signed challenge to authenticate a key-based agent.
|
|
|
386
384
|
|
|
387
385
|
```json
|
|
388
386
|
{
|
|
389
|
-
"
|
|
387
|
+
"agentAddress": "0x...",
|
|
388
|
+
"challenge": "valiron-challenge-abc123...",
|
|
390
389
|
"signature": "0x..."
|
|
391
390
|
}
|
|
392
391
|
```
|
|
@@ -396,11 +395,17 @@ Verify a signed challenge to authenticate a key-based agent.
|
|
|
396
395
|
```json
|
|
397
396
|
{
|
|
398
397
|
"verified": true,
|
|
399
|
-
"
|
|
400
|
-
"
|
|
401
|
-
"tier":
|
|
402
|
-
"riskLevel":
|
|
403
|
-
"route":
|
|
398
|
+
"agentAddress": "0x...",
|
|
399
|
+
"score": null,
|
|
400
|
+
"tier": null,
|
|
401
|
+
"riskLevel": null,
|
|
402
|
+
"route": null,
|
|
403
|
+
"icebreaker": null,
|
|
404
|
+
"reasons": [
|
|
405
|
+
"Identity verified via cryptographic challenge-response",
|
|
406
|
+
"No behavioral data yet — agent has not been scored"
|
|
407
|
+
],
|
|
408
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
404
409
|
}
|
|
405
410
|
```
|
|
406
411
|
|
|
@@ -412,13 +417,18 @@ Get the profile of a key-based agent.
|
|
|
412
417
|
|
|
413
418
|
```json
|
|
414
419
|
{
|
|
415
|
-
"
|
|
416
|
-
"
|
|
417
|
-
"
|
|
418
|
-
"
|
|
419
|
-
"
|
|
420
|
-
"
|
|
421
|
-
"
|
|
420
|
+
"agentAddress": "0x...",
|
|
421
|
+
"verified": true,
|
|
422
|
+
"score": 82,
|
|
423
|
+
"tier": "A",
|
|
424
|
+
"riskLevel": "GREEN",
|
|
425
|
+
"route": "prod",
|
|
426
|
+
"icebreaker": null,
|
|
427
|
+
"reasons": [
|
|
428
|
+
"Identity verified via cryptographic challenge-response",
|
|
429
|
+
"Valiron behavioral tier: A (GREEN)"
|
|
430
|
+
],
|
|
431
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
422
432
|
}
|
|
423
433
|
```
|
|
424
434
|
|
|
@@ -491,6 +501,84 @@ Get full World ID profile including verification details.
|
|
|
491
501
|
|
|
492
502
|
---
|
|
493
503
|
|
|
504
|
+
## Self Endpoints
|
|
505
|
+
|
|
506
|
+
Create Self Enterprise verification sessions, receive signed Self webhooks, and read Self eligible-human verification plus optional Self Agent ID binding. Use the `self` trust signal when an endpoint should consider Self proof during Valiron scoring.
|
|
507
|
+
|
|
508
|
+
### POST /operator/self/session/:agentId
|
|
509
|
+
|
|
510
|
+
Create a Self Enterprise verification session for an agent.
|
|
511
|
+
|
|
512
|
+
| Parameter | Location | Type | Required | Description |
|
|
513
|
+
|-----------|----------|------|----------|-------------|
|
|
514
|
+
| `agentId` | path | string | yes | ERC-8004 token ID |
|
|
515
|
+
|
|
516
|
+
#### Request Body
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
{
|
|
520
|
+
"selfAgentId": "self-agent-...",
|
|
521
|
+
"selfAgentRegistry": "0x...",
|
|
522
|
+
"successUrl": "https://example.com/verified",
|
|
523
|
+
"failureUrl": "https://example.com/failed",
|
|
524
|
+
"expiresInSeconds": 900,
|
|
525
|
+
"metadata": {}
|
|
526
|
+
}
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
#### Response — 200 OK
|
|
530
|
+
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"ok": true,
|
|
534
|
+
"agentId": "25459",
|
|
535
|
+
"self": {
|
|
536
|
+
"sessionId": "sess_...",
|
|
537
|
+
"externalUuid": "00000000-0000-0000-0000-000000000000",
|
|
538
|
+
"verificationUrl": "https://verify.self.xyz/s/...",
|
|
539
|
+
"status": "pending",
|
|
540
|
+
"expiresAt": "2026-04-01T12:15:00.000Z"
|
|
541
|
+
},
|
|
542
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### POST /operator/self/webhook
|
|
547
|
+
|
|
548
|
+
Receive signed Self Enterprise webhooks. This endpoint verifies the raw request body with `SelfWebhooks.verify(...)`, stores only valid `verification.completed` events, and optionally re-verifies proofs when `SELF_TEST_ORG_ID` or `SELF_LIVE_ORG_ID` is configured.
|
|
549
|
+
|
|
550
|
+
Configure this URL in the Self dashboard:
|
|
551
|
+
|
|
552
|
+
```text
|
|
553
|
+
https://<edge-proxy-host>/operator/self/webhook
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Self environment variables are split by deployment mode. `SELF_ENV=test` or `SELF_ENV=live` selects which credentials create new sessions; the webhook accepts both configured test and live signing secrets.
|
|
557
|
+
|
|
558
|
+
```text
|
|
559
|
+
SELF_ENV=test
|
|
560
|
+
SELF_TEST_API_KEY=sk_test_...
|
|
561
|
+
SELF_TEST_FLOW_ID=...
|
|
562
|
+
SELF_TEST_WEBHOOK_SECRET=whsec_...
|
|
563
|
+
SELF_LIVE_API_KEY=sk_live_...
|
|
564
|
+
SELF_LIVE_FLOW_ID=...
|
|
565
|
+
SELF_LIVE_WEBHOOK_SECRET=whsec_...
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### GET /operator/self/status/:agentId
|
|
569
|
+
|
|
570
|
+
Check if an agent has a verified Self eligible-human link.
|
|
571
|
+
|
|
572
|
+
### GET /operator/self/profile/:agentId
|
|
573
|
+
|
|
574
|
+
Get full Self eligible-human / Agent ID profile.
|
|
575
|
+
|
|
576
|
+
### POST /operator/self/verify/:agentId
|
|
577
|
+
|
|
578
|
+
Trusted-payload ingestion for local/internal tests only. Disabled unless `SELF_ALLOW_TRUSTED_PAYLOADS=true`; production should use `/operator/self/session/:agentId` and `/operator/self/webhook`.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
494
582
|
## GET /operator/health
|
|
495
583
|
|
|
496
584
|
Health check endpoint.
|
|
@@ -775,7 +863,7 @@ Revoke an API key. Requires JWT.
|
|
|
775
863
|
|
|
776
864
|
### GET /operator/endpoints
|
|
777
865
|
|
|
778
|
-
List all registered
|
|
866
|
+
List all registered agent-ready wrappers for the current operator. Requires JWT.
|
|
779
867
|
|
|
780
868
|
#### Response — 200 OK
|
|
781
869
|
|
|
@@ -783,11 +871,16 @@ List all registered endpoints for the current operator. Requires JWT.
|
|
|
783
871
|
[
|
|
784
872
|
{
|
|
785
873
|
"id": "uuid",
|
|
786
|
-
"path": "/
|
|
874
|
+
"path": "/weather",
|
|
787
875
|
"method": "GET",
|
|
788
|
-
"pricePerCall": "0.
|
|
876
|
+
"pricePerCall": "0.001000",
|
|
789
877
|
"description": "Returns weather data",
|
|
790
878
|
"rateLimit": 60,
|
|
879
|
+
"targetUrl": "https://api.example.com",
|
|
880
|
+
"paymentProtocol": "x402",
|
|
881
|
+
"paymentNetwork": "eip155:8453",
|
|
882
|
+
"trustEnabled": false,
|
|
883
|
+
"upstreamAuthType": "none",
|
|
791
884
|
"active": true,
|
|
792
885
|
"createdAt": "2026-01-01T00:00:00.000Z"
|
|
793
886
|
}
|
|
@@ -798,29 +891,43 @@ List all registered endpoints for the current operator. Requires JWT.
|
|
|
798
891
|
|
|
799
892
|
### POST /operator/endpoints
|
|
800
893
|
|
|
801
|
-
|
|
894
|
+
Create a hosted agent-ready API wrapper. Requires JWT.
|
|
802
895
|
|
|
803
896
|
#### Request Body
|
|
804
897
|
|
|
805
898
|
```json
|
|
806
899
|
{
|
|
807
|
-
"path": "/
|
|
900
|
+
"path": "/weather",
|
|
808
901
|
"method": "GET",
|
|
809
|
-
"pricePerCall": 0.
|
|
902
|
+
"pricePerCall": 0.001,
|
|
810
903
|
"description": "Returns weather data",
|
|
811
904
|
"rateLimit": 60,
|
|
812
|
-
"targetUrl": "https://
|
|
905
|
+
"targetUrl": "https://api.example.com",
|
|
906
|
+
"paymentProtocol": "x402",
|
|
907
|
+
"paymentNetwork": "eip155:8453",
|
|
908
|
+
"payoutAddress": "0xYourReceivingWallet",
|
|
909
|
+
"trustEnabled": false,
|
|
910
|
+
"upstreamAuthType": "header",
|
|
911
|
+
"upstreamAuthHeader": "Authorization",
|
|
912
|
+
"upstreamAuthSecret": "Bearer upstream-secret"
|
|
813
913
|
}
|
|
814
914
|
```
|
|
815
915
|
|
|
816
916
|
| Field | Type | Required | Description |
|
|
817
917
|
|-------|------|----------|-------------|
|
|
818
|
-
| `path` | string | yes |
|
|
918
|
+
| `path` | string | yes | Public wrapper path (e.g. `/weather`). Callers use `/wrap/{operatorId}/weather`. |
|
|
819
919
|
| `method` | string | no | HTTP method (default: `GET`) |
|
|
820
|
-
| `pricePerCall` | number | yes | Price in USD per call
|
|
920
|
+
| `pricePerCall` | number | yes | Price in USD per call. Use `0` for a free wrapper. |
|
|
821
921
|
| `description` | string | no | Endpoint description |
|
|
822
922
|
| `rateLimit` | number | no | Max requests/min per agent (null = unlimited) |
|
|
823
|
-
| `targetUrl` | string |
|
|
923
|
+
| `targetUrl` | string | yes | Existing upstream API base URL. Valiron appends `path` to this base URL when forwarding. Must be HTTPS in production. Private/internal addresses are blocked. |
|
|
924
|
+
| `paymentProtocol` | string | no | `x402` or `mpp`. Defaults to `x402`. |
|
|
925
|
+
| `paymentNetwork` | string | no | Payment network. Use `eip155:8453` or `eip155:84532` for x402, and `tempo:4217` or `tempo:42431` for MPP. |
|
|
926
|
+
| `payoutAddress` | string | no | Receiving wallet for paid x402 wrappers. Required if no platform default receiving address is configured. |
|
|
927
|
+
| `trustEnabled` | boolean | no | When true, the wrapper requires Valiron agent identity headers and checks trust before forwarding. |
|
|
928
|
+
| `upstreamAuthType` | string | no | `none` or `header`. Defaults to `none`. |
|
|
929
|
+
| `upstreamAuthHeader` | string | no | Header name to attach to the upstream request, such as `Authorization` or `X-API-Key`. |
|
|
930
|
+
| `upstreamAuthSecret` | string | no | Secret value for `upstreamAuthHeader`. Stored encrypted at rest. |
|
|
824
931
|
|
|
825
932
|
---
|
|
826
933
|
|
|
@@ -830,6 +937,77 @@ Deactivate an endpoint (soft delete). Requires JWT.
|
|
|
830
937
|
|
|
831
938
|
---
|
|
832
939
|
|
|
940
|
+
## Agent-Ready Wrapper Endpoint
|
|
941
|
+
|
|
942
|
+
### ALL /wrap/:operatorId/*
|
|
943
|
+
|
|
944
|
+
Public agent-facing wrapper URL. This endpoint is created by `POST /operator/endpoints` or the **Make API Agent-Ready** dashboard flow.
|
|
945
|
+
|
|
946
|
+
```text
|
|
947
|
+
https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
The wrapper matches the operator ID, path, and HTTP method to an active endpoint config. It can enforce payment, optional trust checks, rate limits, SSRF protection, upstream auth injection, and request forwarding.
|
|
951
|
+
|
|
952
|
+
#### Caller Headers
|
|
953
|
+
|
|
954
|
+
| Header | Required | Description |
|
|
955
|
+
|--------|----------|-------------|
|
|
956
|
+
| `X-PAYMENT` | paid x402 retry | x402 payment payload returned by an x402-capable client. |
|
|
957
|
+
| `Authorization: Payment ...` | paid MPP retry | MPP payment authorization header. |
|
|
958
|
+
| `x-agent-id` | if trust enabled | ERC-8004 agent ID. |
|
|
959
|
+
| `x-agent-address` | if trust enabled | Key-based agent wallet address. |
|
|
960
|
+
| `x-agent-session` | key agents | Session token from key-based challenge-response. |
|
|
961
|
+
|
|
962
|
+
#### Free Wrapper Response
|
|
963
|
+
|
|
964
|
+
If `pricePerCall` is `0`, the wrapper forwards directly to the upstream API:
|
|
965
|
+
|
|
966
|
+
```bash
|
|
967
|
+
curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
#### x402 Paid Wrapper Response
|
|
971
|
+
|
|
972
|
+
If `paymentProtocol` is `x402` and no valid payment is attached, the wrapper returns:
|
|
973
|
+
|
|
974
|
+
```http
|
|
975
|
+
HTTP/1.1 402 Payment Required
|
|
976
|
+
X-PAYMENT-RESPONSE: ...
|
|
977
|
+
Content-Type: application/json
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
The caller should retry with a valid `X-PAYMENT` header. See [AGENT-READY-APIS.md](./AGENT-READY-APIS.md#paid-x402-client) for a complete TypeScript client.
|
|
981
|
+
|
|
982
|
+
#### MPP Paid Wrapper Response
|
|
983
|
+
|
|
984
|
+
If `paymentProtocol` is `mpp` and no valid payment is attached, the wrapper returns:
|
|
985
|
+
|
|
986
|
+
```http
|
|
987
|
+
HTTP/1.1 402 Payment Required
|
|
988
|
+
WWW-Authenticate: Payment ...
|
|
989
|
+
Content-Type: application/json
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
The caller should retry with `Authorization: Payment ...`. For command-line testing:
|
|
993
|
+
|
|
994
|
+
```bash
|
|
995
|
+
pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
#### Error Responses
|
|
999
|
+
|
|
1000
|
+
| Status | Code | Meaning |
|
|
1001
|
+
|--------|------|---------|
|
|
1002
|
+
| 402 | `payment_required` | Paid wrapper needs valid x402 or MPP payment. |
|
|
1003
|
+
| 403 | `trust_denied` | Trust checks are enabled and the agent did not pass. |
|
|
1004
|
+
| 404 | `wrapper_not_found` | No active wrapper matched operator ID, path, and method. |
|
|
1005
|
+
| 413 | `payload_too_large` | Request body exceeds wrapper limit. |
|
|
1006
|
+
| 429 | `rate_limit_exceeded` | Caller exceeded wrapper rate limit. |
|
|
1007
|
+
| 502 | `wrapper_request_failed` | Upstream request failed or returned an invalid response. |
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
833
1011
|
### GET /operator/analytics/stats
|
|
834
1012
|
|
|
835
1013
|
Aggregate stats for the current operator. Requires JWT.
|
|
@@ -885,7 +1063,63 @@ Paginated agent summaries. Requires JWT.
|
|
|
885
1063
|
|
|
886
1064
|
### GET /operator/analytics/agents/:agentId
|
|
887
1065
|
|
|
888
|
-
Detailed view of a single agent. Requires JWT. Returns summary stats, endpoint breakdown,
|
|
1066
|
+
Detailed view of a single agent. Requires JWT. Returns summary stats, endpoint breakdown, recent call log, and the current predictive risk forecast.
|
|
1067
|
+
|
|
1068
|
+
The `prediction` object is an explainable forecast derived from recent sandbox evaluations, behavioral fingerprints, and operator call logs:
|
|
1069
|
+
|
|
1070
|
+
```json
|
|
1071
|
+
{
|
|
1072
|
+
"prediction": {
|
|
1073
|
+
"agentId": "25459",
|
|
1074
|
+
"modelVersion": "heuristic-v1",
|
|
1075
|
+
"predictedNextScore": 72,
|
|
1076
|
+
"passProbability": 0.68,
|
|
1077
|
+
"riskDirection": "worsening",
|
|
1078
|
+
"confidence": "medium",
|
|
1079
|
+
"recommendedPolicy": "sandbox",
|
|
1080
|
+
"recommendedTests": ["rate_limit", "concurrency"],
|
|
1081
|
+
"reasons": [
|
|
1082
|
+
{
|
|
1083
|
+
"severity": "warning",
|
|
1084
|
+
"signal": "score_trend",
|
|
1085
|
+
"message": "Recent evaluation scores are trending down.",
|
|
1086
|
+
"weight": -12
|
|
1087
|
+
}
|
|
1088
|
+
],
|
|
1089
|
+
"evidenceWindow": {
|
|
1090
|
+
"evaluationCount": 5,
|
|
1091
|
+
"callCount": 42,
|
|
1092
|
+
"fingerprintSampleCount": 5,
|
|
1093
|
+
"from": "2026-07-01T12:00:00.000Z",
|
|
1094
|
+
"to": "2026-07-13T12:00:00.000Z"
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
---
|
|
1101
|
+
|
|
1102
|
+
### GET /operator/analytics/agents/:agentId/prediction
|
|
1103
|
+
|
|
1104
|
+
Fetch only the predictive risk forecast for one agent. Requires JWT.
|
|
1105
|
+
|
|
1106
|
+
Use this when you want to show a pre-action warning, trigger a new sandbox test, or decide whether the next request should be allowed, throttled, stepped up, sandboxed, or denied.
|
|
1107
|
+
|
|
1108
|
+
Before using persisted prediction snapshots in a new edge-proxy deployment, apply database migrations:
|
|
1109
|
+
|
|
1110
|
+
```bash
|
|
1111
|
+
pnpm --filter edge-proxy db:migrate
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
| Field | Type | Description |
|
|
1115
|
+
|-------|------|-------------|
|
|
1116
|
+
| `predictedNextScore` | number | Forecasted next Valiron score on a 0-110 scale |
|
|
1117
|
+
| `passProbability` | number | Estimated probability that the next evaluation/action passes policy |
|
|
1118
|
+
| `riskDirection` | string | `improving`, `stable`, `worsening`, or `unknown` |
|
|
1119
|
+
| `confidence` | string | `low`, `medium`, or `high` based on evidence volume |
|
|
1120
|
+
| `recommendedPolicy` | string | `allow`, `throttle`, `sandbox`, `step_up`, or `deny` |
|
|
1121
|
+
| `recommendedTests` | string[] | Test families most relevant to run next |
|
|
1122
|
+
| `reasons` | object[] | Human-readable signals explaining the forecast |
|
|
889
1123
|
|
|
890
1124
|
---
|
|
891
1125
|
|
package/docs/DASHBOARD.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Manage your Valiron integration from a single web interface — register endpoints, monitor agent activity, test trust evaluations, and view analytics.
|
|
4
4
|
|
|
5
|
-
**Dashboard URL:** [https://valiron.co/dashboard](https://valiron.co/dashboard)
|
|
5
|
+
**Dashboard URL:** [https://www.valiron.co/dashboard](https://www.valiron.co/dashboard)
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
To create an account:
|
|
12
12
|
|
|
13
|
-
1. Go to [valiron.co/dashboard](https://valiron.co/dashboard) and click **Create account**
|
|
13
|
+
1. Go to [valiron.co/dashboard](https://www.valiron.co/dashboard) and click **Create account**
|
|
14
14
|
2. Enter your name, email, and password
|
|
15
15
|
3. On success, you'll see a **one-time API key** — copy it immediately (it won't be shown again)
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ Your landing page after signing in. Shows a summary of your integration at a gla
|
|
|
27
27
|
- **Top stats** — Total Revenue, Total Calls, Unique Agents, Avg Latency
|
|
28
28
|
- **Secondary stats** — Active API Keys, Registered Endpoints, Calls Today, Plan + fee rate
|
|
29
29
|
- **Recent Activity** — Last 5 call logs with method, path, agent, cost, and timestamp
|
|
30
|
-
- **Quick Start** — 3-step guide: get API key →
|
|
30
|
+
- **Quick Start** — 3-step guide: get API key → make an API agent-ready → test with agents
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
@@ -43,10 +43,13 @@ Each agent card shows:
|
|
|
43
43
|
- Last seen, total calls, total spent, avg latency, error count
|
|
44
44
|
|
|
45
45
|
**Click an agent** to drill into:
|
|
46
|
+
- Predictive risk — forecasted next score, pass probability, trend, confidence, recommended policy, suggested tests, and plain-English reasons
|
|
46
47
|
- Summary stats and first/last seen dates
|
|
47
48
|
- Endpoint breakdown table — which of your endpoints they called, how many times, spend, avg latency, errors
|
|
48
49
|
- Recent call log for that agent
|
|
49
50
|
|
|
51
|
+
Predictive risk is computed from recent sandbox evaluations, behavioral fingerprints, and your operator call logs. It does not replace the trust gate. Low-confidence forecasts mean Valiron has sparse evidence and should usually trigger another sandbox run before broadening production access.
|
|
52
|
+
|
|
50
53
|
---
|
|
51
54
|
|
|
52
55
|
## Analytics
|
|
@@ -98,26 +101,99 @@ Each key shows its prefix, label, last used date, and creation date.
|
|
|
98
101
|
|
|
99
102
|
---
|
|
100
103
|
|
|
101
|
-
##
|
|
104
|
+
## Make API Agent-Ready
|
|
102
105
|
|
|
103
106
|
**Route:** `/dashboard/endpoints`
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
Create hosted Valiron wrappers for existing HTTP APIs. A wrapper provides a public agent-facing URL, handles optional x402/MPP payment challenges, optionally checks Valiron trust, applies rate limits, forwards to the upstream API, and records call logs.
|
|
109
|
+
|
|
110
|
+
This product is appropriate when an API must be callable by autonomous agents without requiring immediate SDK integration in the provider backend.
|
|
111
|
+
|
|
112
|
+
### Hosted wrapper flow
|
|
106
113
|
|
|
107
|
-
**
|
|
114
|
+
1. Open **Make API Agent-Ready**.
|
|
115
|
+
2. Click **Make API Agent-Ready**.
|
|
116
|
+
3. Enter your upstream API details and payment settings.
|
|
117
|
+
4. Save the wrapper.
|
|
118
|
+
5. Distribute the generated wrapper URL to agent clients:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
When an agent calls the wrapper:
|
|
125
|
+
|
|
126
|
+
1. Valiron matches `{operatorId}`, path, and method to your wrapper config.
|
|
127
|
+
2. If `pricePerCall` is greater than `0`, Valiron returns a `402 Payment Required` challenge unless valid payment is attached.
|
|
128
|
+
3. If trust checks are enabled, Valiron evaluates the agent identity headers.
|
|
129
|
+
4. Valiron appends the wrapper path to `targetUrl`, forwards the request, and adds Valiron metadata headers.
|
|
130
|
+
5. Valiron returns the upstream response and records analytics.
|
|
131
|
+
|
|
132
|
+
### Wrapper fields
|
|
108
133
|
|
|
109
134
|
| Field | Required | Description |
|
|
110
135
|
|-------|----------|-------------|
|
|
111
|
-
|
|
|
136
|
+
| Public path | Yes | Agent-facing path (for example `/weather`). This becomes `/wrap/{operatorId}/weather`. |
|
|
112
137
|
| Method | Yes | HTTP method: GET, POST, PUT, PATCH, DELETE |
|
|
113
|
-
|
|
|
138
|
+
| Upstream API base URL | Yes | Existing API base URL, for example `https://api.example.com`. Must be HTTPS in production. Private/internal addresses are blocked. |
|
|
139
|
+
| Price per call (USD) | Yes | `0` for free wrappers, or a positive USD amount for paid wrappers. |
|
|
140
|
+
| Payment protocol | Yes | `x402` or `mpp`. `x402` is used by default and for free wrappers. |
|
|
141
|
+
| Payment network | No | Network for paid wrappers. Common values: `eip155:8453` for Base x402 and `tempo:4217` for MPP. |
|
|
142
|
+
| Payout wallet | No | Required for paid x402 wrappers unless a platform default receiving address is configured. |
|
|
143
|
+
| Require Valiron trust | No | When enabled, callers must provide agent identity headers and pass the trust threshold. |
|
|
114
144
|
| Rate limit (req/min) | No | Max requests per minute per agent (null = unlimited) |
|
|
115
|
-
|
|
|
145
|
+
| Upstream auth | No | Optional static header secret Valiron should attach to your upstream request. |
|
|
116
146
|
| Description | No | What this endpoint does |
|
|
117
147
|
|
|
118
|
-
**Removing
|
|
148
|
+
**Removing a wrapper** performs a soft-delete. The wrapper stops matching new calls but historical logs remain available.
|
|
149
|
+
|
|
150
|
+
### Free wrapper example
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
Public path: /status
|
|
154
|
+
Method: GET
|
|
155
|
+
Upstream API base URL: https://api.example.com
|
|
156
|
+
Price: 0
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Agents call:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Paid x402 wrapper example
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
Public path: /weather
|
|
169
|
+
Method: GET
|
|
170
|
+
Upstream API base URL: https://api.example.com
|
|
171
|
+
Price: 0.001
|
|
172
|
+
Payment protocol: x402
|
|
173
|
+
Payment network: eip155:8453
|
|
174
|
+
Payout wallet: 0x...
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Agents call the wrapper once, receive a `402` with an x402 payment challenge, then retry with a valid `X-PAYMENT` header.
|
|
178
|
+
|
|
179
|
+
### Paid MPP wrapper example
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
Public path: /research
|
|
183
|
+
Method: GET
|
|
184
|
+
Upstream API base URL: https://api.example.com
|
|
185
|
+
Price: 0.001
|
|
186
|
+
Payment protocol: mpp
|
|
187
|
+
Payment network: tempo:4217
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Agents call the wrapper once, receive `WWW-Authenticate: Payment`, then retry with `Authorization: Payment ...`. For command-line testing, use `mppx`:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
|
|
194
|
+
```
|
|
119
195
|
|
|
120
|
-
|
|
196
|
+
For the complete setup guide, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
|
|
121
197
|
|
|
122
198
|
---
|
|
123
199
|
|
|
@@ -149,10 +225,10 @@ Toggle **Dry Run** on to see the trust evaluation without logging the call:
|
|
|
149
225
|
|
|
150
226
|
With dry-run off, the playground performs the full trust evaluation and logs the call to your Analytics/Logs pages.
|
|
151
227
|
|
|
152
|
-
- **If your endpoint has
|
|
153
|
-
- **If no
|
|
228
|
+
- **If your endpoint has an upstream base URL** — the playground forwards the request to your backend with Valiron headers (`X-Agent-Id`, `X-Valiron-Chain`, `X-Valiron-Tier`, `X-Valiron-Route`). You'll see the real HTTP response from your server.
|
|
229
|
+
- **If no upstream base URL is set** — the playground returns the trust evaluation only (tier, route, cost, on-chain score).
|
|
154
230
|
|
|
155
|
-
> **Tip:** Add
|
|
231
|
+
> **Tip:** Add an upstream base URL to your wrapper to enable end-to-end testing in the playground.
|
|
156
232
|
|
|
157
233
|
### Response panel
|
|
158
234
|
|
|
@@ -195,17 +271,9 @@ Platform-wide administration. Only visible to operators with `role: "admin"`.
|
|
|
195
271
|
|
|
196
272
|
---
|
|
197
273
|
|
|
198
|
-
## Integration
|
|
274
|
+
## Middleware Integration
|
|
199
275
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
### Step 1 — Dashboard setup
|
|
203
|
-
|
|
204
|
-
1. Create your account on the dashboard
|
|
205
|
-
2. Copy your API key from the Keys page
|
|
206
|
-
3. Register your endpoints on the Endpoints page (path, method, pricing)
|
|
207
|
-
|
|
208
|
-
### Step 2 — SDK integration
|
|
276
|
+
Valiron's core product is SDK middleware deployed within the API backend. Use this path when trust checks, route decisions, sandbox triggers, payment gating, and usage tracking must execute before the API handler.
|
|
209
277
|
|
|
210
278
|
Install the SDK and add it to your backend:
|
|
211
279
|
|
|
@@ -213,7 +281,7 @@ Install the SDK and add it to your backend:
|
|
|
213
281
|
npm install @valiron/sdk
|
|
214
282
|
```
|
|
215
283
|
|
|
216
|
-
**
|
|
284
|
+
**Express middleware:**
|
|
217
285
|
|
|
218
286
|
```typescript
|
|
219
287
|
import { ValironOperator } from "@valiron/sdk";
|
|
@@ -222,7 +290,7 @@ const operator = new ValironOperator({ apiKey: "val_op_xxxx" });
|
|
|
222
290
|
app.use("/api/weather", operator.paywall({ pricePerCall: 0.05 }));
|
|
223
291
|
```
|
|
224
292
|
|
|
225
|
-
**
|
|
293
|
+
**Manual gating:**
|
|
226
294
|
|
|
227
295
|
```typescript
|
|
228
296
|
import { ValironSDK } from "@valiron/sdk";
|
|
@@ -240,7 +308,7 @@ app.use("/api/weather", async (req, res, next) => {
|
|
|
240
308
|
});
|
|
241
309
|
```
|
|
242
310
|
|
|
243
|
-
###
|
|
311
|
+
### Test with the Playground
|
|
244
312
|
|
|
245
313
|
Before going live, use the Playground to verify:
|
|
246
314
|
- That your endpoint pricing and rate limits are configured correctly
|
|
@@ -248,6 +316,20 @@ Before going live, use the Playground to verify:
|
|
|
248
316
|
- That low/zero-reputation agents get sandboxed or blocked
|
|
249
317
|
- What the full request/response cycle looks like with real latency numbers
|
|
250
318
|
|
|
251
|
-
###
|
|
319
|
+
### Monitor
|
|
252
320
|
|
|
253
321
|
Use the dashboard to track agent activity, review call logs, and monitor revenue.
|
|
322
|
+
|
|
323
|
+
## Separate Product: API Scaffolding
|
|
324
|
+
|
|
325
|
+
API Scaffolding is a separate product that provides a hosted, agent-facing wrapper URL for an existing HTTPS API. A hosted wrapper can collect x402/MPP payment, apply optional trust checks, enforce rate limits, forward upstream, and log usage.
|
|
326
|
+
|
|
327
|
+
1. Create your account on the dashboard.
|
|
328
|
+
2. Copy your API key from the Keys page.
|
|
329
|
+
3. Create a wrapper from **Make API Agent-Ready**.
|
|
330
|
+
4. Test the generated `/wrap/{operatorId}/{path}` URL.
|
|
331
|
+
5. Monitor calls in Analytics and Logs.
|
|
332
|
+
|
|
333
|
+
For deployments requiring full backend control, protect the API directly with Valiron middleware using `createValironGate()` or `ValironOperator.paywall()`.
|
|
334
|
+
|
|
335
|
+
For full hosted wrapper docs, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
|
package/docs/ERRORS.md
CHANGED
|
@@ -167,7 +167,7 @@ All Valiron middleware (Express, Fastify, Next.js, generic) returns consistent e
|
|
|
167
167
|
| 400 | Missing `targetUrl` or invalid request | Check your proxy request fields |
|
|
168
168
|
| 403 | Agent denied by trust gate | Agent does not meet the trust threshold |
|
|
169
169
|
| 403 | SSRF blocked | The `targetUrl` resolves to a private IP, localhost, or metadata endpoint |
|
|
170
|
-
| 503 | Origin server unreachable | Your
|
|
170
|
+
| 503 | Origin server unreachable | Your upstream API base URL is down or timed out |
|
|
171
171
|
|
|
172
172
|
## Key-Based Agent Errors
|
|
173
173
|
|
|
@@ -184,3 +184,13 @@ All Valiron middleware (Express, Fastify, Next.js, generic) returns consistent e
|
|
|
184
184
|
| 400 | Invalid or malformed proof | Verify your World ID proof payload fields |
|
|
185
185
|
| 404 | Agent has no World ID verification | The agent hasn't completed World ID verification yet |
|
|
186
186
|
| 409 | Nullifier hash already used | This World ID proof has already been submitted |
|
|
187
|
+
|
|
188
|
+
## Self Errors
|
|
189
|
+
|
|
190
|
+
| Status | When | Action |
|
|
191
|
+
|--------|------|--------|
|
|
192
|
+
| 400 | Raw webhook body unavailable or Self webhook signature invalid | Configure Self to call `/operator/self/webhook` and keep the endpoint's `whsec_...` value in `SELF_TEST_WEBHOOK_SECRET` or `SELF_LIVE_WEBHOOK_SECRET` |
|
|
193
|
+
| 400 | Self webhook cannot be mapped to a Valiron session | Create sessions through `createSelfSession()` or `POST /operator/self/session/:agentId` so `externalUuid` is stored before the webhook arrives |
|
|
194
|
+
| 403 | Trusted Self payload ingestion is disabled | Use the production session + signed webhook flow, or set `SELF_ALLOW_TRUSTED_PAYLOADS=true` only for local/internal tests |
|
|
195
|
+
| 404 | Agent not found on-chain | Use an existing ERC-8004 agent ID or a supported Solana agent ID before creating a Self session |
|
|
196
|
+
| 409 | Agent already has a verified Self link | Self links are immutable once verified |
|