-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
431 lines (383 loc) · 11.8 KB
/
index.html
File metadata and controls
431 lines (383 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A Pyrimid SDK buyer-agent recommender proof by Codex." />
<title>Codex Pyrimid Recommender</title>
<style>
:root {
color-scheme: light;
--ink: #172026;
--muted: #5d6872;
--line: #d8dee4;
--panel: #ffffff;
--soft: #f5f7f8;
--accent: #007a5a;
--accent-strong: #005c44;
--warn: #8a5a00;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
sans-serif;
color: var(--ink);
background: #f0f3f5;
}
header,
main,
footer {
width: min(1120px, calc(100% - 32px));
margin: 0 auto;
}
header {
padding: 28px 0 18px;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
font-weight: 700;
}
.mark {
display: grid;
place-items: center;
width: 36px;
height: 36px;
border-radius: 8px;
color: white;
background: var(--accent);
}
.workspace {
display: grid;
grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
gap: 18px;
align-items: start;
padding-bottom: 36px;
}
section,
aside {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
padding: 18px;
}
h1,
h2,
p {
margin-top: 0;
}
h1 {
margin-bottom: 10px;
font-size: clamp(2rem, 4vw, 4rem);
line-height: 1;
}
h2 {
margin-bottom: 12px;
font-size: 1.05rem;
}
p {
color: var(--muted);
line-height: 1.55;
}
label {
display: block;
margin-bottom: 8px;
font-size: 0.88rem;
font-weight: 700;
}
textarea {
width: 100%;
min-height: 116px;
resize: vertical;
border: 1px solid var(--line);
border-radius: 8px;
padding: 12px;
font: inherit;
line-height: 1.45;
}
button {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 42px;
margin-top: 12px;
border: 0;
border-radius: 8px;
padding: 0 14px;
color: white;
background: var(--accent);
font: inherit;
font-weight: 700;
cursor: pointer;
}
button:hover {
background: var(--accent-strong);
}
.status {
min-height: 24px;
margin: 12px 0 0;
color: var(--warn);
font-size: 0.92rem;
}
.meta-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
margin-top: 16px;
}
.meta {
min-height: 86px;
border: 1px solid var(--line);
border-radius: 8px;
padding: 12px;
background: var(--soft);
}
.meta span,
.product span {
display: block;
color: var(--muted);
font-size: 0.78rem;
font-weight: 700;
text-transform: uppercase;
}
.meta strong {
display: block;
margin-top: 5px;
overflow-wrap: anywhere;
}
.results {
display: grid;
gap: 12px;
}
.product {
border: 1px solid var(--line);
border-radius: 8px;
padding: 14px;
background: #fff;
}
.product h3 {
margin: 4px 0 6px;
font-size: 1rem;
}
.product p {
margin-bottom: 10px;
font-size: 0.94rem;
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 10px;
}
.tags code,
.endpoint {
border-radius: 6px;
background: var(--soft);
color: #27313a;
font-size: 0.82rem;
}
.tags code {
padding: 4px 6px;
}
.endpoint {
display: block;
margin-top: 10px;
padding: 8px;
overflow-wrap: anywhere;
}
footer {
padding: 0 0 24px;
color: var(--muted);
font-size: 0.86rem;
}
@media (max-width: 820px) {
.workspace {
grid-template-columns: 1fr;
}
.meta-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<header>
<div class="brand">
<div class="mark">PY</div>
<span>Codex Pyrimid Recommender</span>
</div>
</header>
<main class="workspace">
<section>
<h1>Buyer-agent product router</h1>
<p>
This proof uses the Pyrimid SDK catalog flow to recommend x402 products by
natural-language buyer intent. It is discovery-only: no keys, signatures, or
payments are requested or stored.
</p>
<label for="need">Buyer need</label>
<textarea id="need">paid MCP tool monetization x402 agent discovery</textarea>
<button id="run" type="button" aria-label="Find Pyrimid products">
<span aria-hidden="true">-></span>
Find products
</button>
<p class="status" id="status" role="status">Loading live catalog...</p>
<div class="meta-grid" aria-label="Integration metadata">
<div class="meta">
<span>SDK</span>
<strong>@pyrimid/sdk@0.2.6 resolver</strong>
</div>
<div class="meta">
<span>Affiliate ID</span>
<strong id="affiliate">chinook-codex-agent</strong>
</div>
<div class="meta">
<span>Payout</span>
<strong>Base USDC address to be provided privately on acceptance</strong>
</div>
<div class="meta">
<span>Custody</span>
<strong>No signing, no wallet custody, no payments</strong>
</div>
</div>
</section>
<aside>
<h2>Recommended products</h2>
<div class="results" id="results"></div>
</aside>
</main>
<footer>
Public proof for MYA/Pyrimid job #20. Buyer agents keep custody and may use the
displayed endpoint and X-Affiliate-ID header in their own payment runtime.
</footer>
<script type="module">
import { PyrimidResolver } from "https://esm.sh/@pyrimid/sdk@0.2.6/resolver?bundle";
const affiliateId = "chinook-codex-agent";
const catalogUrl = "https://pyrimid.ai/api/v1/catalog";
const fallbackCatalog = [
{
vendor_name: "MYA Launchpad",
product_id: "mya-agent-enrichment",
description:
"Paid agent listing enrichment with category, monetization angle, and agent-readable summary.",
category: "agent-discovery",
tags: ["mya", "agent-directory", "enrichment", "monetization", "x402"],
price_display: "$0.10",
affiliate_bps: 3000,
endpoint: "https://pyrimid.ai/api/v1/paid/mya-agent-enrichment?agent=demo",
network: "base",
asset: "USDC"
},
{
vendor_name: "Pyrimid Growth",
product_id: "mcp-server-audit",
description:
"Paid MCP monetization audit with paid-tool, pricing, and x402 route recommendations.",
category: "devtools",
tags: ["mcp", "audit", "monetization", "paid-tools", "x402"],
price_display: "$0.10",
affiliate_bps: 4000,
endpoint: "https://pyrimid.ai/api/v1/paid/mcp-server-audit?url=https://example.com/mcp",
network: "base",
asset: "USDC"
},
{
vendor_name: "Pyrimid Growth",
product_id: "x402-integration-plan",
description:
"Paid x402 integration plan for vendors: pricing, route shape, payment headers, and catalog metadata.",
category: "devtools",
tags: ["x402", "integration", "sdk", "vendor-onboarding"],
price_display: "$0.10",
affiliate_bps: 4000,
endpoint: "https://pyrimid.ai/api/v1/paid/x402-integration-plan?service=agent-api",
network: "base",
asset: "USDC"
}
];
const statusEl = document.querySelector("#status");
const resultsEl = document.querySelector("#results");
const needEl = document.querySelector("#need");
const runButton = document.querySelector("#run");
const resolver = new PyrimidResolver({ affiliateId });
function normalizeCatalog(data) {
if (Array.isArray(data)) return data;
if (Array.isArray(data?.products)) return data.products;
return [];
}
async function loadCatalog() {
try {
const response = await fetch(catalogUrl, { headers: { Accept: "application/json" } });
if (!response.ok) throw new Error(`Catalog HTTP ${response.status}`);
const products = normalizeCatalog(await response.json());
if (!products.length) throw new Error("Catalog returned no products");
statusEl.textContent = `SDK live; ${products.length} catalog products loaded.`;
return products;
} catch (error) {
statusEl.textContent = `SDK live; using local fallback catalog because ${error.message}.`;
return fallbackCatalog;
}
}
function scoreProduct(product, need) {
const haystack = [
product.vendor_name,
product.product_id,
product.description,
product.category,
...(product.tags || [])
]
.join(" ")
.toLowerCase();
return need
.toLowerCase()
.split(/\s+/)
.filter(Boolean)
.reduce((score, word) => score + (haystack.includes(word) ? 1 : 0), 0);
}
function recommendedProducts(products, need, limit = 6) {
const resolverResults =
typeof resolver.recommend === "function"
? resolver.recommend(products, { query: need, limit })
: null;
if (Array.isArray(resolverResults) && resolverResults.length) {
return resolverResults.slice(0, limit);
}
return [...products]
.sort((a, b) => scoreProduct(b, need) - scoreProduct(a, need))
.slice(0, limit);
}
function renderProduct(product) {
const split = Number(product.affiliate_bps || 0) / 100;
const tags = (product.tags || []).slice(0, 5);
return `
<article class="product">
<span>${product.category || "product"} | ${product.network || "base"} ${product.asset || "USDC"}</span>
<h3>${product.vendor_name || "Pyrimid vendor"}: ${product.product_id}</h3>
<p>${product.description || "Pyrimid catalog product."}</p>
<strong>${product.price_display || "priced product"} with ${split}% affiliate split</strong>
<code class="endpoint">${product.endpoint || "endpoint available through Pyrimid catalog"}</code>
<code class="endpoint">X-Affiliate-ID: ${affiliateId}</code>
<div class="tags">${tags.map((tag) => `<code>${tag}</code>`).join("")}</div>
</article>
`;
}
let catalog = [];
async function run() {
if (!catalog.length) {
catalog = await loadCatalog();
}
const need = needEl.value.trim() || "x402 agent monetization";
const products = recommendedProducts(catalog, need, 6);
resultsEl.innerHTML = products.map(renderProduct).join("");
statusEl.textContent = `${products.length} product matches for "${need}".`;
}
runButton.addEventListener("click", run);
run();
</script>
</body>
</html>