x402-trust-layer 5.1.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/CHANGELOG.md +55 -0
- package/DEPLOY.md +53 -0
- package/Dockerfile +30 -0
- package/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/agents/a2a-payment.d.ts +37 -0
- package/dist/agents/a2a-payment.js +105 -0
- package/dist/agents/agent-escrow.d.ts +30 -0
- package/dist/agents/agent-escrow.js +23 -0
- package/dist/agents/agent-verify.d.ts +15 -0
- package/dist/agents/agent-verify.js +112 -0
- package/dist/agents/api-router.d.ts +32 -0
- package/dist/agents/api-router.js +228 -0
- package/dist/agents/attestation-registry.d.ts +35 -0
- package/dist/agents/attestation-registry.js +76 -0
- package/dist/agents/audition-coach.d.ts +45 -0
- package/dist/agents/audition-coach.js +257 -0
- package/dist/agents/bedrock-bridge.d.ts +3 -0
- package/dist/agents/bedrock-bridge.js +60 -0
- package/dist/agents/budget-allocator.d.ts +24 -0
- package/dist/agents/budget-allocator.js +31 -0
- package/dist/agents/compliance-ledger.d.ts +66 -0
- package/dist/agents/compliance-ledger.js +80 -0
- package/dist/agents/dispute-resolver.d.ts +62 -0
- package/dist/agents/dispute-resolver.js +124 -0
- package/dist/agents/evidence-locker.d.ts +30 -0
- package/dist/agents/evidence-locker.js +47 -0
- package/dist/agents/facilitator-failover.d.ts +15 -0
- package/dist/agents/facilitator-failover.js +18 -0
- package/dist/agents/identity-gate.d.ts +20 -0
- package/dist/agents/identity-gate.js +79 -0
- package/dist/agents/mandate-compiler.d.ts +51 -0
- package/dist/agents/mandate-compiler.js +73 -0
- package/dist/agents/mandate-diff.d.ts +41 -0
- package/dist/agents/mandate-diff.js +170 -0
- package/dist/agents/market-buy-advisor.d.ts +65 -0
- package/dist/agents/market-buy-advisor.js +234 -0
- package/dist/agents/merchant-trust.d.ts +38 -0
- package/dist/agents/merchant-trust.js +171 -0
- package/dist/agents/mpp-session-broker.d.ts +27 -0
- package/dist/agents/mpp-session-broker.js +29 -0
- package/dist/agents/mpp-session-v2.d.ts +76 -0
- package/dist/agents/mpp-session-v2.js +269 -0
- package/dist/agents/payment-intent-compiler.d.ts +21 -0
- package/dist/agents/payment-intent-compiler.js +45 -0
- package/dist/agents/pipeline-execute.d.ts +40 -0
- package/dist/agents/pipeline-execute.js +100 -0
- package/dist/agents/pipeline-trust-v2.d.ts +31 -0
- package/dist/agents/pipeline-trust-v2.js +111 -0
- package/dist/agents/pre-x402-guard.d.ts +35 -0
- package/dist/agents/pre-x402-guard.js +84 -0
- package/dist/agents/quality-escrow-semantic.d.ts +88 -0
- package/dist/agents/quality-escrow-semantic.js +137 -0
- package/dist/agents/quality-escrow.d.ts +65 -0
- package/dist/agents/quality-escrow.js +104 -0
- package/dist/agents/quality-monitor.d.ts +32 -0
- package/dist/agents/quality-monitor.js +77 -0
- package/dist/agents/rail-optimizer.d.ts +33 -0
- package/dist/agents/rail-optimizer.js +133 -0
- package/dist/agents/receipt-auditor.d.ts +14 -0
- package/dist/agents/receipt-auditor.js +145 -0
- package/dist/agents/refund-arbiter.d.ts +24 -0
- package/dist/agents/refund-arbiter.js +70 -0
- package/dist/agents/research-brief.d.ts +14 -0
- package/dist/agents/research-brief.js +66 -0
- package/dist/agents/risk-gate.d.ts +11 -0
- package/dist/agents/risk-gate.js +78 -0
- package/dist/agents/settlement-graph.d.ts +16 -0
- package/dist/agents/settlement-graph.js +38 -0
- package/dist/agents/spend-governor.d.ts +2 -0
- package/dist/agents/spend-governor.js +70 -0
- package/dist/agents/trust-network.d.ts +138 -0
- package/dist/agents/trust-network.js +244 -0
- package/dist/agents/x402-proxy.d.ts +32 -0
- package/dist/agents/x402-proxy.js +90 -0
- package/dist/client/demo-alchemy-live.d.ts +1 -0
- package/dist/client/demo-alchemy-live.js +226 -0
- package/dist/client/demo-tail.d.ts +1 -0
- package/dist/client/demo-tail.js +100 -0
- package/dist/client/demo.d.ts +1 -0
- package/dist/client/demo.js +293 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.js +223 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +389 -0
- package/dist/lib/agent-response.d.ts +14 -0
- package/dist/lib/agent-response.js +13 -0
- package/dist/lib/agentic-gateways.d.ts +5 -0
- package/dist/lib/agentic-gateways.js +15 -0
- package/dist/lib/agentic-probes.d.ts +10 -0
- package/dist/lib/agentic-probes.js +49 -0
- package/dist/lib/alchemy-x402-fetch.d.ts +16 -0
- package/dist/lib/alchemy-x402-fetch.js +95 -0
- package/dist/lib/apply-verifier-body.d.ts +7 -0
- package/dist/lib/apply-verifier-body.js +179 -0
- package/dist/lib/attestation.d.ts +30 -0
- package/dist/lib/attestation.js +107 -0
- package/dist/lib/bazaar-extension.d.ts +15 -0
- package/dist/lib/bazaar-extension.js +265 -0
- package/dist/lib/bazaar.d.ts +100 -0
- package/dist/lib/bazaar.js +341 -0
- package/dist/lib/certified-sellers.d.ts +41 -0
- package/dist/lib/certified-sellers.js +129 -0
- package/dist/lib/chains.d.ts +20 -0
- package/dist/lib/chains.js +78 -0
- package/dist/lib/db-persistence.d.ts +7 -0
- package/dist/lib/db-persistence.js +65 -0
- package/dist/lib/db.d.ts +5 -0
- package/dist/lib/db.js +113 -0
- package/dist/lib/discovery-page.d.ts +2 -0
- package/dist/lib/discovery-page.js +71 -0
- package/dist/lib/ecosystem-telemetry.d.ts +20 -0
- package/dist/lib/ecosystem-telemetry.js +80 -0
- package/dist/lib/erc8004/agent-card.d.ts +34 -0
- package/dist/lib/erc8004/agent-card.js +151 -0
- package/dist/lib/erc8004/cache.d.ts +3 -0
- package/dist/lib/erc8004/cache.js +17 -0
- package/dist/lib/erc8004/constants.d.ts +22 -0
- package/dist/lib/erc8004/constants.js +35 -0
- package/dist/lib/erc8004/registry.d.ts +19 -0
- package/dist/lib/erc8004/registry.js +171 -0
- package/dist/lib/erc8004/resolve-agent.d.ts +7 -0
- package/dist/lib/erc8004/resolve-agent.js +70 -0
- package/dist/lib/erc8004/trust-score.d.ts +33 -0
- package/dist/lib/erc8004/trust-score.js +136 -0
- package/dist/lib/escrow-ledger.d.ts +14 -0
- package/dist/lib/escrow-ledger.js +54 -0
- package/dist/lib/escrow-unified.d.ts +15 -0
- package/dist/lib/escrow-unified.js +28 -0
- package/dist/lib/facilitator-extra.d.ts +13 -0
- package/dist/lib/facilitator-extra.js +52 -0
- package/dist/lib/facilitators.d.ts +20 -0
- package/dist/lib/facilitators.js +89 -0
- package/dist/lib/host-policy.d.ts +4 -0
- package/dist/lib/host-policy.js +20 -0
- package/dist/lib/idempotency.d.ts +4 -0
- package/dist/lib/idempotency.js +120 -0
- package/dist/lib/ledger.d.ts +2 -0
- package/dist/lib/ledger.js +17 -0
- package/dist/lib/logger.d.ts +6 -0
- package/dist/lib/logger.js +24 -0
- package/dist/lib/mandate-vc.d.ts +20 -0
- package/dist/lib/mandate-vc.js +25 -0
- package/dist/lib/mandate.d.ts +44 -0
- package/dist/lib/mandate.js +190 -0
- package/dist/lib/marketplace.d.ts +7 -0
- package/dist/lib/marketplace.js +127 -0
- package/dist/lib/migrations.d.ts +2 -0
- package/dist/lib/migrations.js +130 -0
- package/dist/lib/nonce-store.d.ts +6 -0
- package/dist/lib/nonce-store.js +109 -0
- package/dist/lib/openapi-agentcash.d.ts +5 -0
- package/dist/lib/openapi-agentcash.js +288 -0
- package/dist/lib/openapi-meta.d.ts +5 -0
- package/dist/lib/openapi-meta.js +235 -0
- package/dist/lib/otel.d.ts +2 -0
- package/dist/lib/otel.js +25 -0
- package/dist/lib/paid-resource-url.d.ts +6 -0
- package/dist/lib/paid-resource-url.js +47 -0
- package/dist/lib/parse-with-verifier-fallback.d.ts +3 -0
- package/dist/lib/parse-with-verifier-fallback.js +13 -0
- package/dist/lib/payment-request-context.d.ts +10 -0
- package/dist/lib/payment-request-context.js +5 -0
- package/dist/lib/payment-response.d.ts +13 -0
- package/dist/lib/payment-response.js +39 -0
- package/dist/lib/payto-guard.d.ts +10 -0
- package/dist/lib/payto-guard.js +20 -0
- package/dist/lib/probe.d.ts +29 -0
- package/dist/lib/probe.js +157 -0
- package/dist/lib/problem-detail.d.ts +10 -0
- package/dist/lib/problem-detail.js +14 -0
- package/dist/lib/rate-limit.d.ts +12 -0
- package/dist/lib/rate-limit.js +126 -0
- package/dist/lib/replay-middleware.d.ts +3 -0
- package/dist/lib/replay-middleware.js +27 -0
- package/dist/lib/response-guard.d.ts +5 -0
- package/dist/lib/response-guard.js +40 -0
- package/dist/lib/safe-fetch.d.ts +5 -0
- package/dist/lib/safe-fetch.js +19 -0
- package/dist/lib/security.d.ts +13 -0
- package/dist/lib/security.js +61 -0
- package/dist/lib/semantic-judge.d.ts +14 -0
- package/dist/lib/semantic-judge.js +107 -0
- package/dist/lib/semantic-judge.test.d.ts +1 -0
- package/dist/lib/semantic-judge.test.js +11 -0
- package/dist/lib/ssrf.d.ts +10 -0
- package/dist/lib/ssrf.js +130 -0
- package/dist/lib/ssrf.test.d.ts +1 -0
- package/dist/lib/ssrf.test.js +16 -0
- package/dist/lib/suite-catalog.d.ts +83 -0
- package/dist/lib/suite-catalog.js +131 -0
- package/dist/lib/telemetry.d.ts +5 -0
- package/dist/lib/telemetry.js +37 -0
- package/dist/lib/verifier-fast-path.d.ts +10 -0
- package/dist/lib/verifier-fast-path.js +44 -0
- package/dist/lib/verifier-probe-protocol.d.ts +7 -0
- package/dist/lib/verifier-probe-protocol.js +115 -0
- package/dist/lib/verify-examples.d.ts +2 -0
- package/dist/lib/verify-examples.js +438 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.js +2 -0
- package/dist/lib/webhook-auth.d.ts +3 -0
- package/dist/lib/webhook-auth.js +34 -0
- package/dist/lib/webhook-routes.d.ts +2 -0
- package/dist/lib/webhook-routes.js +112 -0
- package/dist/lib/webhooks.d.ts +23 -0
- package/dist/lib/webhooks.js +123 -0
- package/dist/lib/webhooks.test.d.ts +1 -0
- package/dist/lib/webhooks.test.js +16 -0
- package/dist/lib/x402-client-options.d.ts +28 -0
- package/dist/lib/x402-client-options.js +138 -0
- package/dist/lib/x402-headers.d.ts +10 -0
- package/dist/lib/x402-headers.js +27 -0
- package/dist/lib/x402-paid.d.ts +5 -0
- package/dist/lib/x402-paid.js +252 -0
- package/dist/lib/x402-payment-replay.d.ts +22 -0
- package/dist/lib/x402-payment-replay.js +57 -0
- package/dist/lib/x402gle-host-verify.d.ts +3 -0
- package/dist/lib/x402gle-host-verify.js +27 -0
- package/dist/protocol/agent-passport.d.ts +34 -0
- package/dist/protocol/agent-passport.js +44 -0
- package/dist/protocol/compliance-v2.d.ts +21 -0
- package/dist/protocol/compliance-v2.js +19 -0
- package/dist/protocol/credit-bureau.d.ts +18 -0
- package/dist/protocol/credit-bureau.js +44 -0
- package/dist/protocol/crypto.d.ts +6 -0
- package/dist/protocol/crypto.js +41 -0
- package/dist/protocol/escrow-fsm.d.ts +33 -0
- package/dist/protocol/escrow-fsm.js +99 -0
- package/dist/protocol/fraud-engine.d.ts +28 -0
- package/dist/protocol/fraud-engine.js +77 -0
- package/dist/protocol/observability.d.ts +14 -0
- package/dist/protocol/observability.js +21 -0
- package/dist/protocol/pipeline-full-trust.d.ts +40 -0
- package/dist/protocol/pipeline-full-trust.js +96 -0
- package/dist/protocol/proof-of-execution.d.ts +36 -0
- package/dist/protocol/proof-of-execution.js +48 -0
- package/dist/protocol/reasoning-audit.d.ts +27 -0
- package/dist/protocol/reasoning-audit.js +51 -0
- package/dist/protocol/replay-guard.d.ts +28 -0
- package/dist/protocol/replay-guard.js +76 -0
- package/dist/protocol/replay-guard.test.d.ts +1 -0
- package/dist/protocol/replay-guard.test.js +10 -0
- package/dist/protocol/security-audit.d.ts +18 -0
- package/dist/protocol/security-audit.js +45 -0
- package/dist/protocol/store.d.ts +5 -0
- package/dist/protocol/store.js +59 -0
- package/dist/protocol/threat-catalog.d.ts +13 -0
- package/dist/protocol/threat-catalog.js +75 -0
- package/dist/protocol/trust-oracle.d.ts +23 -0
- package/dist/protocol/trust-oracle.js +30 -0
- package/dist/protocol/trust-score-v2.d.ts +33 -0
- package/dist/protocol/trust-score-v2.js +78 -0
- package/dist/protocol/zk-proofs.d.ts +24 -0
- package/dist/protocol/zk-proofs.js +32 -0
- package/dist/routes/a2a-agent-card.d.ts +3 -0
- package/dist/routes/a2a-agent-card.js +28 -0
- package/dist/routes/catalog.d.ts +5 -0
- package/dist/routes/catalog.js +47 -0
- package/dist/routes/register-all.d.ts +3 -0
- package/dist/routes/register-all.js +1240 -0
- package/dist/routes/schemas.d.ts +83 -0
- package/dist/routes/schemas.js +38 -0
- package/dist/routes/shared.d.ts +16 -0
- package/dist/routes/shared.js +27 -0
- package/dist/routes-protocol.d.ts +10 -0
- package/dist/routes-protocol.js +322 -0
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +2 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +1 -0
- package/openapi.json +7940 -0
- package/package.json +124 -0
- package/public/.well-known/ai-plugin.json +12 -0
- package/public/assets/aegis-logo-blue.png +0 -0
- package/public/assets/aegis-logo-gold.png +0 -0
- package/public/assets/aegis-logo-green.png +0 -0
- package/public/assets/aegis-logo-purple.png +0 -0
- package/public/assets/aegis-logo-red.png +0 -0
- package/public/assets/aegis-logo-white.png +0 -0
- package/public/assets/aegis-logo.png +0 -0
- package/public/assets/x402-trustlayer-logo.png +0 -0
- package/public/assets/x402-trustlayer-logo.svg +5 -0
- package/public/data/agents.json +1528 -0
- package/public/index.html +198 -0
- package/public/landing.css +342 -0
- package/public/landing.js +405 -0
- package/public/llms-full.txt +582 -0
- package/public/llms.txt +132 -0
- package/public/skill.md +135 -0
- package/railway.toml +9 -0
- package/scripts/docker-entrypoint.sh +7 -0
- package/scripts/patch-facilitator-timeout.mjs +61 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
const BASE = window.location.origin;
|
|
3
|
+
const $ = (s, r = document) => r.querySelector(s);
|
|
4
|
+
const $$ = (s, r = document) => [...r.querySelectorAll(s)];
|
|
5
|
+
|
|
6
|
+
let catalog = null;
|
|
7
|
+
let activeTier = "all";
|
|
8
|
+
let searchQuery = "";
|
|
9
|
+
let activeView = "terminal";
|
|
10
|
+
let heroIdx = 0;
|
|
11
|
+
let heroTimer = null;
|
|
12
|
+
|
|
13
|
+
const TIER_COLORS = {
|
|
14
|
+
entry: "#16C7C0",
|
|
15
|
+
marketplace: "#3B82F6",
|
|
16
|
+
orchestration: "#8B5CF6",
|
|
17
|
+
core: "#34D399",
|
|
18
|
+
attestation: "#F5A623",
|
|
19
|
+
trust: "#F97316",
|
|
20
|
+
intelligence: "#A78BFA",
|
|
21
|
+
enterprise: "#E879F9",
|
|
22
|
+
tier1: "#FBBF24",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function esc(s) {
|
|
26
|
+
return String(s)
|
|
27
|
+
.replace(/&/g, "&")
|
|
28
|
+
.replace(/</g, "<")
|
|
29
|
+
.replace(/>/g, ">")
|
|
30
|
+
.replace(/"/g, """);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function chips(arr) {
|
|
34
|
+
return (arr || []).map((t) => `<span class="chip">${esc(t)}</span>`).join("");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function filteredAgents() {
|
|
38
|
+
if (!catalog) return [];
|
|
39
|
+
const q = searchQuery.toLowerCase();
|
|
40
|
+
return catalog.agents.filter((a) => {
|
|
41
|
+
if (activeTier !== "all" && a.tier !== activeTier) return false;
|
|
42
|
+
if (!q) return true;
|
|
43
|
+
const hay = (a.name + a.path + a.summary + a.tags.join(" ") + a.tierLabel).toLowerCase();
|
|
44
|
+
return hay.includes(q);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function priceFmt(n) {
|
|
49
|
+
return "$" + Number(n).toFixed(2);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function renderTerminalRow(a) {
|
|
53
|
+
return `
|
|
54
|
+
<div class="term-row" data-id="${esc(a.id)}" role="button" tabindex="0">
|
|
55
|
+
<div class="method">${esc(a.method)}</div>
|
|
56
|
+
<div>
|
|
57
|
+
<div class="path-main">${esc(a.path)}</div>
|
|
58
|
+
<div class="path-name">${esc(a.name)}</div>
|
|
59
|
+
<div class="tier-tag">${esc(a.tierLabel)} · ${esc(a.layer)}</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="price-tag">${priceFmt(a.price)}</div>
|
|
62
|
+
</div>`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function renderCard(a) {
|
|
66
|
+
const color = TIER_COLORS[a.tier] || "#16C7C0";
|
|
67
|
+
return `
|
|
68
|
+
<article class="api-card" data-id="${esc(a.id)}" role="button" tabindex="0">
|
|
69
|
+
<div class="api-card-head">
|
|
70
|
+
<div class="api-tier" style="border-color:${color};color:${color}">${esc(a.tierLabel)}</div>
|
|
71
|
+
<div class="api-price">${priceFmt(a.price)}</div>
|
|
72
|
+
</div>
|
|
73
|
+
<h3 class="api-name">${esc(a.name)}</h3>
|
|
74
|
+
<div class="api-route mono">${esc(a.method)} ${esc(a.path)}</div>
|
|
75
|
+
<p class="api-summary">${esc(a.summary)}</p>
|
|
76
|
+
</article>`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function renderDetail(a) {
|
|
80
|
+
const url = `${BASE}${a.path}`;
|
|
81
|
+
const color = TIER_COLORS[a.tier] || "#16C7C0";
|
|
82
|
+
const body =
|
|
83
|
+
a.method === "GET"
|
|
84
|
+
? `curl ${esc(url)}`
|
|
85
|
+
: `curl -X ${esc(a.method)} ${esc(url)} \\\n -H "content-type: application/json" \\\n -d '{}'`;
|
|
86
|
+
|
|
87
|
+
return `
|
|
88
|
+
<div class="detail-head">
|
|
89
|
+
<div>
|
|
90
|
+
<div class="api-tier" style="border-color:${color};color:${color};display:inline-block;margin-bottom:8px">${esc(a.tierLabel)}</div>
|
|
91
|
+
<h3>${esc(a.name)}</h3>
|
|
92
|
+
<div class="detail-route mono">${esc(a.method)} ${esc(a.path)} · layer: ${esc(a.layer)}</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="detail-price">${priceFmt(a.price)}</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="detail-block">
|
|
97
|
+
<h4>Summary</h4>
|
|
98
|
+
<p>${esc(a.summary)}</p>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="detail-block">
|
|
101
|
+
<h4>Why it matters</h4>
|
|
102
|
+
<p>${esc(a.why)}</p>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="detail-block">
|
|
105
|
+
<h4>Key inputs</h4>
|
|
106
|
+
<div class="chips">${chips(a.inputs)}</div>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="detail-block">
|
|
109
|
+
<h4>Response highlights</h4>
|
|
110
|
+
<div class="chips">${chips(a.outputs)}</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="detail-block">
|
|
113
|
+
<h4>Tags</h4>
|
|
114
|
+
<div class="chips">${chips(a.tags)}</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="detail-block">
|
|
117
|
+
<h4>Docs</h4>
|
|
118
|
+
<p style="font-size:13px;color:var(--muted)"><a href="/skill.md">skill.md</a> · <a href="/openapi.json">OpenAPI</a> · <a href="?agent=${esc(a.id)}">Permalink</a></p>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="detail-block">
|
|
121
|
+
<h4>Example call</h4>
|
|
122
|
+
<pre class="code-block">${body}</pre>
|
|
123
|
+
<p style="font-size:12px;color:var(--dim);margin-top:8px">Returns HTTP 402 first — pay with x402 USDC, then retry with X-Payment header.</p>
|
|
124
|
+
</div>`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function openDetail(id) {
|
|
128
|
+
const a = catalog.agents.find((x) => x.id === id);
|
|
129
|
+
if (!a) return;
|
|
130
|
+
const panel = $("#agent-detail");
|
|
131
|
+
const content = $("#detail-content");
|
|
132
|
+
if (!panel || !content) return;
|
|
133
|
+
content.innerHTML = renderDetail(a);
|
|
134
|
+
panel.classList.remove("hidden");
|
|
135
|
+
document.body.style.overflow = "hidden";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function closeDetail() {
|
|
139
|
+
const panel = $("#agent-detail");
|
|
140
|
+
if (!panel) return;
|
|
141
|
+
panel.classList.add("hidden");
|
|
142
|
+
document.body.style.overflow = "";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function bindAgentClicks(root) {
|
|
146
|
+
if (!root) return;
|
|
147
|
+
root.addEventListener("click", (e) => {
|
|
148
|
+
const row = e.target.closest("[data-id]");
|
|
149
|
+
if (!row) return;
|
|
150
|
+
openDetail(row.dataset.id);
|
|
151
|
+
});
|
|
152
|
+
root.addEventListener("keydown", (e) => {
|
|
153
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
154
|
+
const row = e.target.closest("[data-id]");
|
|
155
|
+
if (!row) return;
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
openDetail(row.dataset.id);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function renderViews() {
|
|
162
|
+
const agents = filteredAgents();
|
|
163
|
+
const termList = $("#terminal-list");
|
|
164
|
+
const cards = $("#view-cards");
|
|
165
|
+
const count = $("#api-count");
|
|
166
|
+
|
|
167
|
+
if (count) count.textContent = String(agents.length);
|
|
168
|
+
|
|
169
|
+
if (termList) {
|
|
170
|
+
termList.innerHTML =
|
|
171
|
+
agents.length === 0
|
|
172
|
+
? `<div class="term-row"><div></div><div>No agents match your filter.</div><div></div></div>`
|
|
173
|
+
: agents.map(renderTerminalRow).join("");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (cards) {
|
|
177
|
+
cards.innerHTML =
|
|
178
|
+
agents.length === 0
|
|
179
|
+
? `<p style="color:var(--muted);padding:24px">No agents match your filter.</p>`
|
|
180
|
+
: agents.map(renderCard).join("");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function setView(view) {
|
|
185
|
+
activeView = view;
|
|
186
|
+
const term = $("#view-terminal");
|
|
187
|
+
const cards = $("#view-cards");
|
|
188
|
+
$$(".vt").forEach((b) => b.classList.toggle("active", b.dataset.view === view));
|
|
189
|
+
if (term) term.classList.toggle("hidden", view !== "terminal");
|
|
190
|
+
if (cards) cards.classList.toggle("hidden", view !== "cards");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function renderTiers(agents) {
|
|
194
|
+
const nav = $("#tier-nav");
|
|
195
|
+
if (!nav) return;
|
|
196
|
+
const tiers = [...new Set(agents.map((a) => a.tier))];
|
|
197
|
+
const labels = {};
|
|
198
|
+
agents.forEach((a) => {
|
|
199
|
+
labels[a.tier] = a.tierLabel;
|
|
200
|
+
});
|
|
201
|
+
const order = [
|
|
202
|
+
"all",
|
|
203
|
+
"killer",
|
|
204
|
+
"entry",
|
|
205
|
+
"tier1",
|
|
206
|
+
"protocol",
|
|
207
|
+
"orchestration",
|
|
208
|
+
"bundle",
|
|
209
|
+
"core",
|
|
210
|
+
"identity",
|
|
211
|
+
"attestation",
|
|
212
|
+
"trust",
|
|
213
|
+
"intelligence",
|
|
214
|
+
"enterprise",
|
|
215
|
+
];
|
|
216
|
+
nav.innerHTML = order
|
|
217
|
+
.filter((t) => t === "all" || tiers.includes(t))
|
|
218
|
+
.map((t) => {
|
|
219
|
+
const label = t === "all" ? `All ${agents.length}` : labels[t] || t;
|
|
220
|
+
const active = t === activeTier ? " active" : "";
|
|
221
|
+
return `<button type="button" class="tier-pill${active}" data-tier="${t}">${esc(label)}</button>`;
|
|
222
|
+
})
|
|
223
|
+
.join("");
|
|
224
|
+
nav.onclick = (e) => {
|
|
225
|
+
const btn = e.target.closest("[data-tier]");
|
|
226
|
+
if (!btn) return;
|
|
227
|
+
activeTier = btn.dataset.tier;
|
|
228
|
+
$$(".tier-pill", nav).forEach((b) => b.classList.toggle("active", b === btn));
|
|
229
|
+
renderViews();
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function renderLayers(layers) {
|
|
234
|
+
const el = $("#layers-grid");
|
|
235
|
+
if (!el || !layers) return;
|
|
236
|
+
el.innerHTML = layers
|
|
237
|
+
.map(
|
|
238
|
+
(l) => `
|
|
239
|
+
<div class="layer-card">
|
|
240
|
+
<div class="layer-num">${esc(l.num)} · ${esc(l.title)}</div>
|
|
241
|
+
<h3>${esc(l.title)}</h3>
|
|
242
|
+
<p>${esc(l.desc)}</p>
|
|
243
|
+
</div>`,
|
|
244
|
+
)
|
|
245
|
+
.join("");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function setStatsImmediate(agents) {
|
|
249
|
+
const endpoints = agents?.length ?? 58;
|
|
250
|
+
const elEndpoints = $("#s-endpoints");
|
|
251
|
+
const elVerified = $("#s-verified");
|
|
252
|
+
const elChains = $("#s-chains");
|
|
253
|
+
if (elEndpoints) {
|
|
254
|
+
elEndpoints.textContent = String(endpoints);
|
|
255
|
+
elEndpoints.dataset.count = String(endpoints);
|
|
256
|
+
}
|
|
257
|
+
if (elVerified) {
|
|
258
|
+
elVerified.textContent = "100%";
|
|
259
|
+
elVerified.dataset.count = "100";
|
|
260
|
+
}
|
|
261
|
+
if (elChains) {
|
|
262
|
+
elChains.textContent = "3";
|
|
263
|
+
elChains.dataset.count = "3";
|
|
264
|
+
}
|
|
265
|
+
updateCheapest(agents ?? []);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function animateCounters() {
|
|
269
|
+
$$("[data-count]").forEach((el) => {
|
|
270
|
+
const target = parseInt(el.dataset.count, 10);
|
|
271
|
+
if (Number.isNaN(target)) return;
|
|
272
|
+
const isPct = el.id === "s-verified";
|
|
273
|
+
const duration = 1200;
|
|
274
|
+
const start = performance.now();
|
|
275
|
+
function tick(now) {
|
|
276
|
+
const p = Math.min(1, (now - start) / duration);
|
|
277
|
+
const eased = 1 - Math.pow(1 - p, 3);
|
|
278
|
+
const val = Math.round(target * eased);
|
|
279
|
+
el.textContent = isPct ? val + "%" : String(val);
|
|
280
|
+
if (p < 1) requestAnimationFrame(tick);
|
|
281
|
+
}
|
|
282
|
+
requestAnimationFrame(tick);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function observeStats() {
|
|
287
|
+
const stats = $("#stats");
|
|
288
|
+
if (!stats) {
|
|
289
|
+
animateCounters();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const obs = new IntersectionObserver(
|
|
293
|
+
(entries) => {
|
|
294
|
+
entries.forEach((e) => {
|
|
295
|
+
if (e.isIntersecting) {
|
|
296
|
+
animateCounters();
|
|
297
|
+
obs.disconnect();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
{ threshold: 0.3 },
|
|
302
|
+
);
|
|
303
|
+
obs.observe(stats);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function startHeroTerminal(agents) {
|
|
307
|
+
const el = $("#hero-terminal");
|
|
308
|
+
if (!el || !agents.length) return;
|
|
309
|
+
const sample = agents.slice().sort((a, b) => a.path.localeCompare(b.path));
|
|
310
|
+
|
|
311
|
+
function paint() {
|
|
312
|
+
const lines = [];
|
|
313
|
+
for (let i = 0; i < 5; i++) {
|
|
314
|
+
const a = sample[(heroIdx + i) % sample.length];
|
|
315
|
+
lines.push(
|
|
316
|
+
`<div class="term-line"><span class="path">${esc(a.method)} ${esc(a.path)}</span><span class="price">${priceFmt(a.price)}</span></div>`,
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
lines.push(`<div><span class="cursor-blink">▊</span></div>`);
|
|
320
|
+
el.innerHTML = lines.join("");
|
|
321
|
+
heroIdx = (heroIdx + 1) % sample.length;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
paint();
|
|
325
|
+
if (heroTimer) clearInterval(heroTimer);
|
|
326
|
+
heroTimer = setInterval(paint, 2800);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function updateCheapest(agents) {
|
|
330
|
+
const el = $("#s-cheapest");
|
|
331
|
+
if (!el || !agents.length) return;
|
|
332
|
+
const min = Math.min(...agents.map((a) => a.price));
|
|
333
|
+
el.textContent = priceFmt(min);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async function loadHealth() {
|
|
337
|
+
try {
|
|
338
|
+
const h = await fetch("/health").then((r) => r.json());
|
|
339
|
+
const badge = $("#hero-badge-text");
|
|
340
|
+
if (badge && h.endpointCount) {
|
|
341
|
+
const chainLabel = Array.isArray(h.chains) ? h.chains.join(" · ") : "Base · Solana · Polygon";
|
|
342
|
+
badge.textContent = `${h.endpointCount} Live Endpoints · ${chainLabel}`;
|
|
343
|
+
}
|
|
344
|
+
} catch (_) {}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
async function init() {
|
|
348
|
+
try {
|
|
349
|
+
catalog = await fetch("/data/agents.json").then((r) => r.json());
|
|
350
|
+
} catch {
|
|
351
|
+
const termList = $("#terminal-list");
|
|
352
|
+
if (termList) termList.innerHTML = `<div class="term-row"><div></div><div>Could not load agent catalog.</div><div></div></div>`;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
renderLayers(catalog.layers);
|
|
357
|
+
renderTiers(catalog.agents);
|
|
358
|
+
setStatsImmediate(catalog.agents);
|
|
359
|
+
renderViews();
|
|
360
|
+
updateCheapest(catalog.agents);
|
|
361
|
+
startHeroTerminal(catalog.agents);
|
|
362
|
+
observeStats();
|
|
363
|
+
loadHealth();
|
|
364
|
+
|
|
365
|
+
bindAgentClicks($("#terminal-list"));
|
|
366
|
+
bindAgentClicks($("#view-cards"));
|
|
367
|
+
|
|
368
|
+
const search = $("#api-search");
|
|
369
|
+
if (search) {
|
|
370
|
+
search.addEventListener("input", () => {
|
|
371
|
+
searchQuery = search.value.trim();
|
|
372
|
+
renderViews();
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
$$(".view-toggle .vt").forEach((btn) => {
|
|
377
|
+
btn.addEventListener("click", () => setView(btn.dataset.view));
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
const closeBtn = $("#detail-close");
|
|
381
|
+
const panel = $("#agent-detail");
|
|
382
|
+
if (closeBtn) closeBtn.addEventListener("click", closeDetail);
|
|
383
|
+
if (panel) {
|
|
384
|
+
panel.addEventListener("click", (e) => {
|
|
385
|
+
if (e.target === panel) closeDetail();
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
document.addEventListener("keydown", (e) => {
|
|
389
|
+
if (e.key === "Escape") closeDetail();
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
const params = new URLSearchParams(window.location.search);
|
|
393
|
+
const hashAgent = window.location.hash.replace(/^#/, "").replace(/^agent[=\/]?/, "");
|
|
394
|
+
const deepId = params.get("agent") || (hashAgent && !hashAgent.startsWith("agents") ? hashAgent : null);
|
|
395
|
+
if (deepId) {
|
|
396
|
+
openDetail(deepId);
|
|
397
|
+
if (params.get("agent")) {
|
|
398
|
+
history.replaceState(null, "", window.location.pathname + "#agents");
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init);
|
|
404
|
+
else init();
|
|
405
|
+
})();
|