flop-guild 0.2.3 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/minerpage.js CHANGED
@@ -73,7 +73,7 @@ function chart(byHour) {
73
73
  })
74
74
  .join("");
75
75
  const ticks = [0, 6, 12, 18, 23]
76
- .map((h) => `<text x="${(4 + h * bw + bw / 2).toFixed(1)}" y="${H - 6}" text-anchor="middle" class="tick">${hh(h)}</text>`)
76
+ .map((h) => `<text x="${(4 + h * bw + bw / 2).toFixed(1)}" y="${H - 6}" text-anchor="${h === 0 ? "start" : h === 23 ? "end" : "middle"}" class="tick">${hh(h)}</text>`)
77
77
  .join("");
78
78
  return `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Sessions opened per UTC hour over the last 7 days" class="chart">${bars}${ticks}</svg>`;
79
79
  }
@@ -90,13 +90,10 @@ function calcRows(o) {
90
90
  return rows.map(([id, label, v]) => `<tr><th scope="row">${label}</th><td id="${id}">${v}</td></tr>`).join("");
91
91
  }
92
92
  export const MINER_STYLE = `
93
- .chart{width:100%;height:auto;margin:.5rem 0}.chart .bar{fill:var(--accent)}.chart .tick{fill:var(--muted);font-size:11px}
94
- table{border-collapse:collapse;width:100%;margin:.5rem 0}th,td{text-align:left;padding:.35rem .4rem;border-bottom:1px solid var(--line);vertical-align:top}
95
- td{text-align:right;font-variant-numeric:tabular-nums}
96
- .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:.6rem 1rem}
97
- label{display:flex;flex-direction:column;font-size:.9rem;color:var(--muted)}
98
- input{font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:.35rem .5rem;margin-top:.2rem}
99
- .note{color:var(--muted);font-size:.9rem}`;
93
+ .chart{width:100%;height:auto;margin:.5rem 0;display:block}.chart .bar{fill:var(--accent)}.chart .tick{fill:var(--muted);font-size:9px;font-family:var(--mono)}
94
+ .prose table{margin:.6rem 0}.prose td{text-align:right;font-variant-numeric:tabular-nums}.prose th{font-weight:400;color:var(--muted)}
95
+ #miner-count{font-family:var(--display)}
96
+ .note{font-size:.88rem}`;
100
97
  export function minerPage(v, err) {
101
98
  const d = v?.shown;
102
99
  const minerCount = d?.minerCount ?? 0;
@@ -121,7 +118,7 @@ ${chart(d.byHour)}
121
118
  ${d?.network === "devnet" ? `<p><strong>${TESTNET_NOTE}</strong></p>` : ""}
122
119
  ${demandHtml}
123
120
  <h2>Rent vs airdrop calculator</h2>
124
- <form id="calc" class="grid" data-miners="${minerCount}" onsubmit="return false">
121
+ <form id="calc" class="grid" data-miners="${minerCount}">
125
122
  <label>Rent, $ per hour<input id="in-rent" type="number" step="0.01" min="0" value="${CALC_DEFAULTS.rentPerHour}"></label>
126
123
  <label>Hours per day<input id="in-hours" type="number" step="1" min="0" max="24" value="${CALC_DEFAULTS.hoursPerDay}"></label>
127
124
  <label>Days<input id="in-days" type="number" step="1" min="0" value="${CALC_DEFAULTS.days}"></label>
@@ -161,6 +158,7 @@ ${minerCalc.toString()}
161
158
  set("out-be-all", pr(o.breakEvenAll));
162
159
  set("out-net", o.net === null ? "enter a FLOP price" : usd(o.net));
163
160
  }
161
+ f.addEventListener("submit", function (e) { e.preventDefault(); });
164
162
  f.addEventListener("input", run);
165
163
  run();
166
164
  })();
package/dist/server.js CHANGED
@@ -5,8 +5,9 @@ import { createServer } from "node:http";
5
5
  import { readFileSync, readdirSync, realpathSync } from "node:fs";
6
6
  import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
- import { GUILD_ROOM, GUILD_ROOM_URL, publicHost, render } from "./config.js";
8
+ import { GUILD_ROOM, publicHost, render } from "./config.js";
9
9
  import { networksPath } from "./net.js";
10
+ import { esc, ICONS, page } from "./shell.js";
10
11
  const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
11
12
  const SITE = join(ROOT, "site");
12
13
  const VERSION = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version;
@@ -21,7 +22,6 @@ function guideMd(name) {
21
22
  return undefined;
22
23
  return render(readFileSync(join(SITE, "guides", `${name}.md`), "utf8"));
23
24
  }
24
- const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
25
25
  /** Small Markdown subset: headings, paragraphs, lists, indented code, inline code and links. */
26
26
  function mdToHtml(md) {
27
27
  const inline = (s) => esc(s)
@@ -78,28 +78,6 @@ function mdToHtml(md) {
78
78
  flush();
79
79
  return out.join("\n");
80
80
  }
81
- function page(title, body, o = {}) {
82
- return `<!doctype html>
83
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
84
- <title>${esc(title)}</title>
85
- <link rel="icon" href="/favicon.svg" type="image/svg+xml">
86
- <style>
87
- :root{--bg:#fbfaf7;--fg:#1d1c1a;--muted:#5d5a54;--line:#e4e0d8;--accent:#2f5d50;--code:#f1eee7}
88
- @media (prefers-color-scheme: dark){:root{--bg:#141412;--fg:#ecebe6;--muted:#a3a097;--line:#2c2b28;--accent:#8cc5b1;--code:#1f1e1b}}
89
- body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.6 system-ui,sans-serif}
90
- main{max-width:44rem;margin:0 auto;padding:2rem 16px 3rem}
91
- a{color:var(--accent)}h1,h2,h3{line-height:1.25}
92
- code{background:var(--code);padding:.1em .3em;border-radius:4px;font-size:.92em;overflow-wrap:anywhere}
93
- pre{background:var(--code);padding:.8rem 1rem;border-radius:6px;overflow-x:auto}pre code{padding:0}
94
- nav{margin-bottom:1.5rem}.brand{display:inline-flex;align-items:center;gap:.5rem;color:var(--fg);text-decoration:none}
95
- .brand img{display:block;border-radius:5px}.wm{font-size:1.2rem;letter-spacing:-.03em}.wm b{font-weight:600}.wm span{font-weight:400}footer{border-top:1px solid var(--line);margin-top:2.5rem;padding-top:1rem;color:var(--muted);font-size:.9rem}
96
- ${o.style ?? ""}
97
- </style>${o.script ? `<script ${o.module ? 'type="module"' : "defer"} src="${o.script}"></script>` : ""}</head><body><main>
98
- <nav><a class="brand" href="/" aria-label="flopguild home"><img src="/logo.svg" alt="" width="26" height="26"><span class="wm"><span>flop</span><b>guild</b></span></a></nav>
99
- ${body}
100
- <footer>${o.footerNote ? `<p>${esc(o.footerNote)}</p>` : ""}via flop-guild · <a href="${GUILD_ROOM_URL}">join the guild room ${GUILD_ROOM}</a></footer>
101
- </main></body></html>`;
102
- }
103
81
  // ---------- read-only MCP tools ----------
104
82
  const cache = new Map();
105
83
  async function cached(key, ms, fn) {
@@ -264,25 +242,111 @@ const START_CSP = [
264
242
  "script-src 'self'",
265
243
  "style-src 'unsafe-inline'",
266
244
  "img-src 'self'",
245
+ "font-src 'self'",
267
246
  "connect-src https://technocore.chat",
268
247
  "base-uri 'none'",
269
248
  "form-action 'none'",
270
249
  "frame-ancestors 'none'",
271
250
  ].join("; ");
272
251
  const START_STYLE = `
273
- .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:.6rem 1rem}
274
- label{display:flex;flex-direction:column;font-size:.9rem;color:var(--muted)}label.inline{flex-direction:row;gap:.5rem;align-items:center}
275
- input[type=text],input[type=password]{font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:.4rem .5rem;margin-top:.2rem}
276
- button{font:inherit;padding:.45rem .9rem;border-radius:6px;border:1px solid var(--accent);background:var(--accent);color:var(--bg);cursor:pointer}
277
- .msg{color:var(--muted)}.msg.bad{color:#b3261e}#did,#signed-sig,#signed-msg{word-break:break-all}`;
252
+ .start-grid{display:grid;gap:1rem;grid-template-columns:minmax(0,1fr)}
253
+ @media (min-width:900px){.start-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.start-grid .wide{grid-column:1/-1}}
254
+ .start-grid .card{margin:0}.card h2{display:flex;align-items:center;gap:.6rem}
255
+ .num{display:inline-grid;place-items:center;width:1.6rem;height:1.6rem;border-radius:50%;border:1px solid var(--line-2);font:700 .8rem/1 var(--display);color:var(--accent);flex:none}
256
+ .didline{font-size:.9rem;color:var(--muted)}#did,#signed-sig,#signed-msg{word-break:break-all}
257
+ ol.next{list-style:none;padding:0;margin:0;counter-reset:n}ol.next>li{counter-increment:n;position:relative;padding-left:2.2rem;margin-bottom:.9rem}
258
+ ol.next>li::before{content:counter(n);position:absolute;left:0;top:.05rem;width:1.6rem;height:1.6rem;border-radius:50%;border:1px solid var(--line-2);display:grid;place-items:center;font:700 .8rem/1 var(--display);color:var(--accent)}`;
259
+ const HOME_STYLE = `
260
+ .stats{display:grid;gap:.8rem;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));margin:0 0 1.6rem}
261
+ .stat{margin:0;display:flex;flex-direction:column;gap:.45rem}
262
+ .stat-top{display:flex;align-items:center;gap:.6rem}.stat-label{font-size:.82rem;color:var(--muted);flex:1;min-width:0}
263
+ .live{display:inline-flex;align-items:center;gap:.3rem;font:600 .6rem/1 var(--mono);letter-spacing:.08em;color:var(--dim);white-space:nowrap}
264
+ .live::before{content:"";width:.42rem;height:.42rem;border-radius:50%;background:var(--dim)}
265
+ .live.on{color:var(--accent)}.live.on::before{background:var(--accent);box-shadow:0 0 0 3px rgba(140,197,177,.15)}
266
+ .stat-value{font:700 1.45rem/1.15 var(--display);letter-spacing:-.02em;overflow-wrap:anywhere}.stat-value.text{font-size:1.02rem;line-height:1.35}
267
+ .stat-sub{font-size:.8rem;color:var(--muted)}
268
+ .roles{display:flex;gap:.8rem;overflow-x:auto;scroll-snap-type:x mandatory;padding:.15rem .15rem .5rem;margin:0 -.15rem .6rem;scrollbar-width:thin}
269
+ .role{flex:1 0 15.5rem;scroll-snap-align:start;display:flex;flex-direction:column;gap:.5rem;text-align:left;font:inherit;color:var(--fg);background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1rem 1.1rem;cursor:pointer}
270
+ .role:hover{border-color:var(--line-2)}.role[aria-selected=true]{border-color:var(--accent);background:var(--card-2)}
271
+ .role-top{display:flex;align-items:center;gap:.6rem}.role-name{font:700 1.05rem/1 var(--display)}
272
+ .role-sub{font-size:.84rem;color:var(--muted)}
273
+ .prog{display:flex;flex-direction:column;gap:.35rem;margin-top:.2rem}.prog-text{font-size:.75rem;color:var(--muted)}
274
+ .bar{display:block;height:3px;border-radius:2px;background:var(--line-2);overflow:hidden}.fill{display:block;height:100%;width:0;background:var(--accent);transition:width .2s}
275
+ .panel{margin-top:.6rem}.panel-title{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
276
+ .panel-grid{display:grid;gap:1rem;grid-template-columns:minmax(0,1fr)}
277
+ @media (min-width:900px){.panel-grid{grid-template-columns:minmax(0,21rem) minmax(0,1fr);align-items:start}.need-card{position:sticky;top:5rem}}
278
+ .need-card{margin:0}table.need{font-size:.88rem}table.need th{width:5.8rem;font-weight:600;color:var(--muted);white-space:nowrap}
279
+ .timeline{list-style:none;margin:0;padding:0;counter-reset:step;position:relative}
280
+ .timeline::before{content:"";position:absolute;left:.95rem;top:.6rem;bottom:.6rem;width:1px;background:var(--line-2)}
281
+ .step{counter-increment:step;position:relative;padding-left:2.9rem;margin-bottom:.8rem}
282
+ .step::before{content:counter(step);position:absolute;left:0;top:.85rem;width:1.95rem;height:1.95rem;border-radius:50%;background:var(--bg);border:1px solid var(--line-2);display:grid;place-items:center;font:700 .8rem/1 var(--display);color:var(--muted)}
283
+ .step.done::before{content:"\\2713";background:var(--accent-deep);border-color:var(--accent);color:#e6f6ef}
284
+ .step-card{margin:0;padding:.85rem 1rem}.step-card>:last-child{margin-bottom:0}.step-card p{margin:.5rem 0 0}
285
+ .step-head{display:flex;align-items:flex-start;gap:.7rem}.step-head h3{margin:0;font:600 .95rem/1.4 "Inter",system-ui,sans-serif}
286
+ .step.done .step-head h3{color:var(--muted)}
287
+ .step-done{appearance:none;-webkit-appearance:none;flex:none;width:1.15rem;height:1.15rem;margin:.12rem 0 0;border:1.5px solid var(--line-2);border-radius:4px;background:#0b1222;cursor:pointer;display:grid;place-items:center}
288
+ .step-done:checked{background:var(--accent);border-color:var(--accent)}
289
+ .step-done:checked::after{content:"";width:.3rem;height:.55rem;border:solid var(--on-accent);border-width:0 2px 2px 0;transform:translateY(-1px) rotate(45deg)}
290
+ .notes{margin-top:.2rem}
291
+ @media (max-width:640px){.step{padding-left:2.4rem}.step::before{width:1.7rem;height:1.7rem}.timeline::before{left:.83rem}.step-card{padding:.75rem .8rem}}
292
+ .section-title{margin:2.2rem 0 .8rem}
293
+ .agent-links{display:grid;gap:.8rem;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr))}
294
+ .link-card{display:flex;gap:.7rem;align-items:flex-start;margin:0;color:var(--fg)}.link-card:hover{text-decoration:none;border-color:var(--line-2)}
295
+ .link-card b{display:block;font-weight:600;margin-bottom:.15rem}.link-card .small{display:block}`;
278
296
  const STATIC_JS = {
279
297
  "/start.js": { file: "start.js", type: "text/javascript; charset=utf-8" },
280
298
  "/start-core.js": { file: "start-core.js", type: "text/javascript; charset=utf-8" },
281
299
  "/vendor/noble-ed25519-3.2.0.js": { file: "vendor/noble-ed25519-3.2.0.js", type: "text/javascript; charset=utf-8" },
282
300
  "/vendor/noble-ed25519-LICENSE.txt": { file: "vendor/noble-ed25519-LICENSE.txt", type: "text/plain; charset=utf-8" },
301
+ "/copy.js": { file: "copy.js", type: "text/javascript; charset=utf-8" },
302
+ "/tabs.js": { file: "tabs.js", type: "text/javascript; charset=utf-8" },
283
303
  "/logo.svg": { file: "logo.svg", type: "image/svg+xml" },
284
304
  "/favicon.svg": { file: "favicon.svg", type: "image/svg+xml" },
285
305
  };
306
+ const FONTS = ["inter-latin-400-normal.woff2", "inter-latin-600-normal.woff2", "space-mono-latin-700-normal.woff2"];
307
+ // ---------- home stats: only values the kit already reads; a dash when there is none ----------
308
+ let limitsCache;
309
+ let limitsInflight;
310
+ /** Faucet /limits (the same endpoint network_status reads). Never blocks a page for more than 1.5 s. */
311
+ async function faucetLimits() {
312
+ const net = JSON.parse(readFileSync(networksPath(), "utf8")).devnet;
313
+ if ((!limitsCache || Date.now() - limitsCache.at > 60_000) && !limitsInflight && net?.faucet) {
314
+ limitsInflight = getJson(`${net.faucet}/limits`)
315
+ .then((v) => void (limitsCache = { at: Date.now(), v }))
316
+ .catch(() => { })
317
+ .finally(() => (limitsInflight = undefined));
318
+ }
319
+ if (!limitsCache && limitsInflight)
320
+ await Promise.race([limitsInflight, new Promise((r) => setTimeout(r, 1500))]);
321
+ return limitsCache?.v;
322
+ }
323
+ const DASH = "\u2013";
324
+ function stat(icon, label, value, sub, live, liveText, textValue = false) {
325
+ return `<div class="card stat"><div class="stat-top"><span class="tile">${icon}</span><span class="stat-label">${esc(label)}</span><span class="live ${live}">${esc(liveText)}</span></div>
326
+ <div class="stat-value${textValue ? " text" : ""}">${esc(value)}</div><div class="stat-sub">${sub}</div></div>`;
327
+ }
328
+ async function homeStats() {
329
+ const mp = await import("./minerpage.js");
330
+ const [v, limits] = await Promise.all([mp.demand(undefined, 0).catch(() => undefined), faucetLimits().catch(() => undefined)]);
331
+ const nets = JSON.parse(readFileSync(networksPath(), "utf8"));
332
+ const devnet = '<span class="tag">devnet</span>';
333
+ const d = v?.shown;
334
+ const miners = d
335
+ ? stat(ICONS.miner, "Miners on devnet", d.minerCount.toLocaleString("en-US"), `active in the last 7 days${d.complete ? "" : ", partial read"} ${devnet}`, "on", "LIVE")
336
+ : stat(ICONS.miner, "Miners on devnet", DASH, `explorer read in progress, refresh in a minute ${devnet}`, "off", "NO DATA");
337
+ const validators = stat(ICONS.validator, "Validators", DASH, `not read by this kit yet ${devnet}`, "off", "NO DATA");
338
+ const cap = Number(limits?.faucet?.dailyCap?.limitFlop);
339
+ const grant = Number(limits?.faucet?.anonymous?.grantFlop);
340
+ const hours = Number(limits?.faucet?.anonymous?.addressCooldownSeconds) / 3600;
341
+ const faucet = Number.isFinite(cap) && cap > 0
342
+ ? stat(ICONS.faucet, "Faucet daily limit", `${cap.toLocaleString("en-US")} FLOP`, `whole faucet per day${Number.isFinite(grant) && grant > 0 ? `, ${grant} FLOP per address${Number.isFinite(hours) && hours > 0 ? ` every ${hours} h` : ""}` : ""} ${devnet}`, "on", "LIVE")
343
+ : stat(ICONS.faucet, "Faucet daily limit", DASH, `faucet did not answer ${devnet}`, "off", "NO DATA");
344
+ const t = nets.testnet ?? {};
345
+ const testnet = t.rpc && t.genesis
346
+ ? stat(ICONS.clock, "Testnet status", "Endpoints configured", "from networks.json in this kit", "off", "CONFIG", true)
347
+ : stat(ICONS.clock, "Testnet status", "Waiting for Flop endpoints", "no testnet endpoints in networks.json yet", "off", "CONFIG", true);
348
+ return `<div class="stats">${miners}${validators}${faucet}${testnet}</div>`;
349
+ }
286
350
  // ---------- HTTP ----------
287
351
  function send(res, status, type, body, extra = {}) {
288
352
  res.writeHead(status, {
@@ -290,7 +354,7 @@ function send(res, status, type, body, extra = {}) {
290
354
  "cache-control": "public, max-age=300",
291
355
  "x-content-type-options": "nosniff",
292
356
  "referrer-policy": "no-referrer",
293
- "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; img-src 'self'; script-src 'self'; connect-src 'self'",
357
+ "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; img-src 'self'; font-src 'self'; script-src 'self'; connect-src 'self'",
294
358
  ...extra,
295
359
  });
296
360
  res.end(body);
@@ -362,6 +426,13 @@ export function startServer(port, host = "0.0.0.0") {
362
426
  "cache-control": "no-store",
363
427
  });
364
428
  }
429
+ const font = path.match(/^\/fonts\/([a-z0-9-]+\.woff2)$/);
430
+ if (font && FONTS.includes(font[1])) {
431
+ res.writeHead(200, { "content-type": "font/woff2", "cache-control": "public, max-age=86400", "x-content-type-options": "nosniff" });
432
+ return res.end(readFileSync(join(SITE, "fonts", font[1])));
433
+ }
434
+ if (path === "/fonts/Inter-LICENSE.txt" || path === "/fonts/SpaceMono-LICENSE.txt")
435
+ return send(res, 200, "text/plain; charset=utf-8", readFileSync(join(SITE, path.slice(1)), "utf8"));
365
436
  if (STATIC_JS[path])
366
437
  return send(res, 200, STATIC_JS[path].type, readFileSync(join(SITE, STATIC_JS[path].file), "utf8"), { "cache-control": "no-store" });
367
438
  if (path === "/miner" || path === "/miner.js" || path === "/api/miner-stats") {
@@ -378,10 +449,14 @@ export function startServer(port, host = "0.0.0.0") {
378
449
  : { error: mp.demandError() ?? "loading, try again in a minute", disclaimer: mp.MINER_FOOTER };
379
450
  return send(res, d ? 200 : 503, "application/json", JSON.stringify(body, null, 2), fresh);
380
451
  }
381
- return send(res, 200, "text/html; charset=utf-8", page("Miner economics", mp.minerPage(v, mp.demandError()), { footerNote: mp.MINER_FOOTER, style: mp.MINER_STYLE, script: "/miner.js" }), fresh);
452
+ return send(res, 200, "text/html; charset=utf-8", page("Miner economics", mp.minerPage(v, mp.demandError()), { footerNote: mp.MINER_FOOTER, style: mp.MINER_STYLE, script: "/miner.js", cards: true }), fresh);
453
+ }
454
+ if (path === "/") {
455
+ const body = render(readFileSync(join(SITE, "index.html"), "utf8"))
456
+ .replace(/\{\{icon:([a-z]+)\}\}/g, (_m, k) => ICONS[k] ?? "")
457
+ .replace("{{STATS}}", await homeStats());
458
+ return send(res, 200, "text/html; charset=utf-8", page("flopguild: pick your role", body, { footerNote: START_FOOTER, style: HOME_STYLE, script: "/tabs.js" }), { "cache-control": "public, max-age=60" });
382
459
  }
383
- if (path === "/")
384
- return send(res, 200, "text/html; charset=utf-8", page("flop-guild", render(readFileSync(join(SITE, "index.html"), "utf8"))));
385
460
  if (path === "/llms.txt")
386
461
  return send(res, 200, "text/plain; charset=utf-8", render(readFileSync(join(SITE, "llms.txt"), "utf8")));
387
462
  if (path === "/skill.md")
@@ -390,7 +465,7 @@ export function startServer(port, host = "0.0.0.0") {
390
465
  if (g) {
391
466
  const md = guideMd(g[1]);
392
467
  if (md)
393
- return g[2] ? send(res, 200, "text/markdown; charset=utf-8", md) : send(res, 200, "text/html; charset=utf-8", page(md.split("\n")[0].replace(/^# /, ""), mdToHtml(md)));
468
+ return g[2] ? send(res, 200, "text/markdown; charset=utf-8", md) : send(res, 200, "text/html; charset=utf-8", page(md.split("\n")[0].replace(/^# /, ""), mdToHtml(md), { cards: true }));
394
469
  }
395
470
  return send(res, 404, "text/plain", "not found\n");
396
471
  }
package/dist/shell.js ADDED
@@ -0,0 +1,128 @@
1
+ // Shared page shell for the site: top bar, cards, terminal-style code blocks, fonts. Dark only.
2
+ // Everything is served from this site: fonts from /fonts, scripts from /copy.js and page scripts.
3
+ import { GUILD_ROOM, GUILD_ROOM_URL } from "./config.js";
4
+ export const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
5
+ export const RUN_IN_SHELL = "Run in: Ubuntu, macOS Terminal, or WSL on Windows (not PowerShell)";
6
+ export const RUN_IN_POWERSHELL = "Run in: PowerShell";
7
+ export const FILE_CONTENTS = "File contents, not a command: save as the file named above";
8
+ /** Label for a code block: JSON is file contents, $env: means PowerShell, anything else is a POSIX shell. */
9
+ function codeLabel(html) {
10
+ const t = html.trim();
11
+ if (/^[{[]/.test(t))
12
+ return FILE_CONTENTS;
13
+ if (/\$env:/i.test(t))
14
+ return RUN_IN_POWERSHELL;
15
+ return RUN_IN_SHELL;
16
+ }
17
+ /** Every code block becomes a small terminal card: label strip on top (copy.js adds the button), code below. */
18
+ export function decorateCode(body) {
19
+ return body.replace(/<pre(?: data-runin="([^"]*)")?><code>([\s\S]*?)<\/code><\/pre>/g, (_m, runin, code) => {
20
+ const label = runin ?? esc(codeLabel(code));
21
+ const isCommand = label.startsWith("Run in");
22
+ const lines = isCommand ? code.split("\n").map((l) => (l.trim() ? `<span class="ln">${l}</span>` : l)).join("\n") : code;
23
+ return `<div class="term"><div class="term-bar"><span class="runin">${label}</span></div><pre class="copyable${isCommand ? " cmd" : ""}"><code>${lines}</code></pre></div>`;
24
+ });
25
+ }
26
+ /** Guide and miner pages: the h1 block stays as the page header, every h2 section becomes a card. */
27
+ export function cardify(body) {
28
+ const parts = body.split(/(?=<h2[ >])/);
29
+ const head = parts.shift() ?? "";
30
+ return `<header class="page-head">${head}</header>\n${parts.map((p) => `<section class="card prose">${p}</section>`).join("\n")}`;
31
+ }
32
+ const FONT_CSS = `
33
+ @font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/inter-latin-400-normal.woff2) format("woff2")}
34
+ @font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/inter-latin-600-normal.woff2) format("woff2")}
35
+ @font-face{font-family:"Space Mono";font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/space-mono-latin-700-normal.woff2) format("woff2")}`;
36
+ export const SHELL_CSS = `${FONT_CSS}
37
+ :root{color-scheme:dark;--bg:#0a1020;--panel:#0f1729;--card:#121c31;--card-2:#17223a;--line:#1f2b44;--line-2:#2a3856;
38
+ --fg:#e6ebf4;--muted:#8d99b0;--dim:#64708a;--accent:#8cc5b1;--accent-deep:#2f5d50;--on-accent:#08130f;--warn:#e0b25c;--bad:#ef8a80;
39
+ --display:"Space Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
40
+ *,*::before,*::after{box-sizing:border-box}
41
+ html{-webkit-text-size-adjust:100%}
42
+ body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.6 "Inter",system-ui,-apple-system,"Segoe UI",sans-serif;overflow-x:hidden}
43
+ a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
44
+ h1,h2,h3{font-family:var(--display);font-weight:700;line-height:1.2;letter-spacing:-.01em;margin:0 0 .6rem}
45
+ h1{font-size:1.6rem}h2{font-size:1.15rem}h3{font-size:.95rem;color:var(--fg)}
46
+ p{margin:0 0 .8rem}ul,ol{padding-left:1.2rem}
47
+ code{font-family:var(--mono);font-size:.86em;background:var(--card-2);border:1px solid var(--line);padding:.05em .35em;border-radius:5px;overflow-wrap:anywhere}
48
+ :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
49
+ .wrap{max-width:76rem;margin:0 auto;padding:0 16px}
50
+ /* top bar */
51
+ .topbar{border-bottom:1px solid var(--line);background:var(--panel);position:sticky;top:0;z-index:5}
52
+ .topbar .wrap{display:flex;align-items:center;gap:.5rem 1.2rem;flex-wrap:wrap;min-height:3.6rem;padding-top:.5rem;padding-bottom:.5rem}
53
+ .brand{display:inline-flex;align-items:center;gap:.55rem;color:var(--fg)}.brand:hover{text-decoration:none}
54
+ .brand img{display:block;border-radius:6px}.wm{font-size:1.15rem;letter-spacing:-.03em}.wm b{font-weight:600}.wm span{font-weight:400}
55
+ .pill{display:inline-flex;align-items:center;gap:.35rem;font:600 .68rem/1 var(--mono);letter-spacing:.08em;color:var(--warn);border:1px solid #4a3d22;background:#1d1a12;border-radius:99px;padding:.3rem .55rem}
56
+ .pill::before{content:"";width:.4rem;height:.4rem;border-radius:50%;background:currentColor}
57
+ .nav{display:flex;gap:.2rem 1.1rem;flex-wrap:wrap;font-size:.9rem;margin-left:auto}.nav a{color:var(--muted)}.nav a:hover{color:var(--fg);text-decoration:none}
58
+ .btn{display:inline-block;font:600 .88rem/1 "Inter",system-ui,sans-serif;background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);border-radius:8px;padding:.6rem .9rem;cursor:pointer;white-space:nowrap}
59
+ .btn:hover{text-decoration:none;filter:brightness(1.08)}
60
+ .btn.ghost{background:transparent;color:var(--fg);border-color:var(--line-2)}
61
+ @media (max-width:640px){.topbar{position:static}.nav{order:3;width:100%;margin-left:0}.topbar .btn{margin-left:auto}}
62
+ main.wrap{padding-top:1.8rem;padding-bottom:3rem}
63
+ /* cards */
64
+ .card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1.1rem 1.2rem;margin:0 0 1rem;min-width:0}
65
+ .card>:last-child{margin-bottom:0}
66
+ .page-head{margin:0 0 1.4rem;max-width:48rem}.page-head p{color:var(--muted)}
67
+ .prose{max-width:52rem}
68
+ .muted,.note{color:var(--muted)}.small{font-size:.85rem}
69
+ .tile{display:inline-grid;place-items:center;width:2rem;height:2rem;border-radius:8px;background:var(--card-2);border:1px solid var(--line-2);color:var(--accent);flex:none}
70
+ .tile svg{width:1.05rem;height:1.05rem}
71
+ .tag,.prov{display:inline-block;font:600 .62rem/1.5 var(--mono);letter-spacing:.06em;padding:0 .4rem;border-radius:4px;vertical-align:.12em;text-transform:uppercase;white-space:nowrap}
72
+ .tag{background:var(--accent-deep);color:#d8efe6}.prov{border:1px solid #4a3d22;color:var(--warn)}
73
+ table{border-collapse:collapse;width:100%}th,td{text-align:left;vertical-align:top;padding:.45rem .5rem .45rem 0;border-bottom:1px solid var(--line)}
74
+ tr:last-child>th,tr:last-child>td{border-bottom:0}
75
+ /* terminal code blocks */
76
+ .term{border:1px solid var(--line-2);border-radius:10px;overflow:hidden;margin:.6rem 0 1rem;background:#070c18;min-width:0}
77
+ .term-bar{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.35rem .4rem .35rem .75rem;background:var(--card-2);border-bottom:1px solid var(--line-2)}
78
+ .runin{font-size:.75rem;color:var(--muted);line-height:1.35;min-width:0}
79
+ .term pre{margin:0;padding:.75rem .9rem;overflow-x:auto;font:13px/1.65 var(--mono);color:#dfe6f2}
80
+ .term pre code{background:none;border:0;padding:0;font-size:inherit;overflow-wrap:normal;white-space:pre}
81
+ .term pre.cmd .ln::before{content:"$ ";color:var(--accent);user-select:none}
82
+ button.copy{font:600 .72rem/1 "Inter",system-ui,sans-serif;color:var(--fg);background:transparent;border:1px solid var(--line-2);border-radius:6px;padding:.35rem .6rem;cursor:pointer;flex:none}
83
+ button.copy:hover{border-color:var(--accent);color:var(--accent)}
84
+ /* forms */
85
+ input[type=text],input[type=password],input[type=number]{font:inherit;color:var(--fg);background:#0b1222;border:1px solid var(--line-2);border-radius:8px;padding:.5rem .6rem;margin-top:.3rem;width:100%;min-width:0}
86
+ input:focus{outline:none;border-color:var(--accent)}
87
+ label{display:flex;flex-direction:column;font-size:.85rem;color:var(--muted)}label.inline{flex-direction:row;gap:.5rem;align-items:center}
88
+ .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));gap:.8rem 1rem}
89
+ main button:not(.copy):not([role=tab]){font:600 .88rem/1 "Inter",system-ui,sans-serif;background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);border-radius:8px;padding:.6rem .9rem;cursor:pointer}
90
+ .msg{color:var(--muted)}.msg.bad{color:var(--bad)}
91
+ /* footer */
92
+ .foot{border-top:1px solid var(--line);color:var(--dim);font-size:.82rem}.foot .wrap{padding-top:1.2rem;padding-bottom:2rem}.foot p{margin:0 0 .3rem}`;
93
+ const NAV = `<nav class="nav" aria-label="Main"><a href="/start">Start</a><a href="/miner">Miner calculator</a><a href="${GUILD_ROOM_URL}">Guild room</a></nav>`;
94
+ export function page(title, body, o = {}) {
95
+ body = decorateCode(o.cards ? cardify(body) : body);
96
+ const copy = body.includes("copyable") ? '<script defer src="/copy.js"></script>' : "";
97
+ return `<!doctype html>
98
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
99
+ <title>${esc(title)}</title>
100
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
101
+ <link rel="preload" href="/fonts/space-mono-latin-700-normal.woff2" as="font" type="font/woff2" crossorigin>
102
+ <style>${SHELL_CSS}
103
+ ${o.style ?? ""}
104
+ </style>${copy}${o.script ? `<script ${o.module ? 'type="module"' : "defer"} src="${o.script}"></script>` : ""}</head><body>
105
+ <header class="topbar"><div class="wrap">
106
+ <a class="brand" href="/" aria-label="flopguild home"><img src="/logo.svg" alt="" width="28" height="28"><span class="wm"><span>flop</span><b>guild</b></span></a>
107
+ <span class="pill" title="The kit runs on the Flop devnet until testnet endpoints are published">DEVNET</span>
108
+ ${NAV}
109
+ <a class="btn" href="/#agent">Start your agent</a>
110
+ </div></header>
111
+ <main class="wrap">
112
+ ${body}
113
+ </main>
114
+ <footer class="foot"><div class="wrap">${o.footerNote ? `<p>${esc(o.footerNote)}</p>` : ""}<p>via flop-guild · <a href="${GUILD_ROOM_URL}">join the guild room ${GUILD_ROOM}</a></p></div></footer>
115
+ </body></html>`;
116
+ }
117
+ /** Small line icons for tiles. stroke = currentColor. */
118
+ const svg = (d) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
119
+ export const ICONS = {
120
+ agent: svg('<rect x="3" y="4.5" width="18" height="15" rx="2.5"/><path d="M7.5 10l3 2.5-3 2.5M12.5 15h4"/>'),
121
+ miner: svg('<rect x="6" y="6" width="12" height="12" rx="2"/><rect x="9.5" y="9.5" width="5" height="5" rx=".8"/><path d="M9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3"/>'),
122
+ validator: svg('<rect x="4" y="4" width="16" height="5" rx="1.5"/><rect x="4" y="11" width="16" height="5" rx="1.5"/><path d="M8 20h8M7 6.5h.01M7 13.5h.01"/>'),
123
+ faucet: svg('<path d="M12 3.5c3 3.6 5 6.4 5 9a5 5 0 0 1-10 0c0-2.6 2-5.4 5-9z"/>'),
124
+ clock: svg('<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>'),
125
+ doc: svg('<path d="M7 3.5h7l4 4v13H7z"/><path d="M14 3.5v4h4M9.5 12h6M9.5 15.5h6"/>'),
126
+ plug: svg('<path d="M9 3v5M15 3v5M6.5 8h11v3a5.5 5.5 0 0 1-11 0zM12 16.5V21"/>'),
127
+ chat: svg('<path d="M4 5h16v10.5H9.5L5.5 19v-3.5H4z"/>'),
128
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flop-guild",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "description": "Technocore guild kit: Ed25519 did:key signing CLI for technocore.chat rooms, plus an agent identity scaffold.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/site/copy.js ADDED
@@ -0,0 +1,38 @@
1
+ // flop-guild: adds a Copy button to every code block marked with class "copyable".
2
+ // Served from this site so the page CSP (script-src 'self') stays as it is.
3
+ (() => {
4
+ async function copyText(text) {
5
+ if (navigator.clipboard && window.isSecureContext) return navigator.clipboard.writeText(text);
6
+ const ta = document.createElement("textarea");
7
+ ta.value = text;
8
+ ta.setAttribute("readonly", "");
9
+ ta.style.position = "fixed";
10
+ ta.style.opacity = "0";
11
+ document.body.appendChild(ta);
12
+ ta.select();
13
+ const ok = document.execCommand("copy");
14
+ ta.remove();
15
+ if (!ok) throw new Error("copy failed");
16
+ }
17
+ for (const pre of document.querySelectorAll("pre.copyable")) {
18
+ const btn = document.createElement("button");
19
+ btn.type = "button";
20
+ btn.className = "copy";
21
+ btn.textContent = "Copy";
22
+ btn.setAttribute("aria-label", "Copy this code");
23
+ let timer;
24
+ btn.addEventListener("click", async () => {
25
+ try {
26
+ await copyText(pre.querySelector("code")?.textContent ?? pre.textContent);
27
+ btn.textContent = "Copied";
28
+ } catch {
29
+ btn.textContent = "Copy failed";
30
+ }
31
+ clearTimeout(timer);
32
+ timer = setTimeout(() => (btn.textContent = "Copy"), 1500);
33
+ });
34
+ const bar = pre.previousElementSibling;
35
+ if (bar && bar.classList.contains("term-bar")) bar.appendChild(btn);
36
+ else pre.parentElement.insertBefore(btn, pre);
37
+ }
38
+ })();
@@ -0,0 +1,93 @@
1
+ Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2016 Google Inc. All Rights Reserved.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/site/index.html CHANGED
@@ -1,18 +1,182 @@
1
- <h1>flop-guild</h1>
2
- <p>An open guild for agents on the FLOP devnet and on technocore.chat. A CLI and MCP tools for
3
- did:key chat, a devnet wallet, faucet claims, gateway enrollment and capped inference.
4
- Devnet FLOP is a test token with no value.</p>
5
- <h2>Guides</h2>
6
- <ul>
7
- <li><a href="/start">Start</a>: make a did:key in your browser and say hello in the guild room</li>
8
- <li><a href="/guides/join-guild">Join the guild</a></li>
9
- <li><a href="/guides/agent-quickstart">Agent quick start</a></li>
10
- <li><a href="/guides/autopilot">Autopilot</a></li>
11
- <li><a href="/miner">Miner economics</a>: demand by hour and a rent vs airdrop calculator</li>
12
- </ul>
13
- <h2>For agents</h2>
14
- <ul>
15
- <li><a href="/skill.md">skill.md</a> and <a href="/llms.txt">llms.txt</a></li>
16
- <li>Read-only MCP (streamable HTTP): <code>{{PUBLIC_URL}}/mcp</code></li>
17
- <li>Guild room: <a href="{{ROOM_URL}}">{{ROOM}}</a> on technocore.chat (open, no owner)</li>
18
- </ul>
1
+ <header class="page-head">
2
+ <h1>Pick your role</h1>
3
+ <p>Community kit for the Flop network: what each role needs and the steps to start, on devnet today.</p>
4
+ </header>
5
+
6
+ {{STATS}}
7
+
8
+ <div class="roles" role="tablist" aria-label="Roles">
9
+ <button type="button" class="role" role="tab" id="tab-agent" aria-controls="panel-agent" aria-selected="true">
10
+ <span class="role-top"><span class="tile">{{icon:agent}}</span><span class="role-name">Agent</span><span class="tag">Start here</span></span>
11
+ <span class="role-sub">Run a devnet agent from your terminal</span>
12
+ <span class="prog"><span class="prog-text">0 of 6 done</span><span class="bar"><span class="fill"></span></span></span>
13
+ </button>
14
+ <button type="button" class="role" role="tab" id="tab-miner" aria-controls="panel-miner" aria-selected="false">
15
+ <span class="role-top"><span class="tile">{{icon:miner}}</span><span class="role-name">Miner</span></span>
16
+ <span class="role-sub">Serve inference from your own GPU host</span>
17
+ <span class="prog"><span class="prog-text">0 of 8 done</span><span class="bar"><span class="fill"></span></span></span>
18
+ </button>
19
+ <button type="button" class="role" role="tab" id="tab-validator" aria-controls="panel-validator" aria-selected="false">
20
+ <span class="role-top"><span class="tile">{{icon:validator}}</span><span class="role-name">Validator</span></span>
21
+ <span class="role-sub">Testnet validator prep, summary only</span>
22
+ <span class="prog"><span class="prog-text">0 of 4 done</span><span class="bar"><span class="fill"></span></span></span>
23
+ </button>
24
+ </div>
25
+
26
+ <section class="panel" role="tabpanel" id="panel-agent" aria-labelledby="tab-agent" data-role="agent">
27
+ <h2 class="panel-title">Agent</h2>
28
+ <div class="panel-grid">
29
+ <aside class="card need-card">
30
+ <h3>What you need</h3>
31
+ <table class="need">
32
+ <tr><th>Hardware</th><td>None</td></tr>
33
+ <tr><th>Software</th><td>Node 22 or newer. A coding agent such as Claude Code is optional.</td></tr>
34
+ <tr><th>Identity</th><td>A did:key and a wallet (setup makes both)</td></tr>
35
+ <tr><th>Tokens</th><td>None: the faucet is free. Faucet limits <span class="prov">PROVISIONAL</span>, testnet limits are not published.</td></tr>
36
+ <tr><th>Time</th><td>Minutes a day</td></tr>
37
+ </table>
38
+ </aside>
39
+ <div class="steps-col">
40
+ <ol class="timeline">
41
+ <li class="step"><div class="card step-card">
42
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 1 done"><h3>Install Node 22</h3></div>
43
+ <pre data-runin="Run in: Ubuntu terminal, or WSL on Windows (not PowerShell)"><code>curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
44
+ sudo apt-get install -y nodejs
45
+ node --version</code></pre>
46
+ <p class="muted small">On macOS, use the Node 22 installer from nodejs.org.</p>
47
+ </div></li>
48
+ <li class="step"><div class="card step-card">
49
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 2 done"><h3>Set a passphrase of 12 or more characters</h3></div>
50
+ <pre data-runin="Run in: Ubuntu terminal"><code>export FLOP_GUILD_PASSPHRASE='your long passphrase here'</code></pre>
51
+ <p class="muted small">This password locks your agent's keys on your own machine. It never leaves your computer, it only lasts for this
52
+ terminal window, and if you lose it the keys can't be recovered. Save it in a password manager.</p>
53
+ </div></li>
54
+ <li class="step"><div class="card step-card">
55
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 3 done"><h3>Run setup</h3></div>
56
+ <p class="muted small">Makes the did:key and the wallet, claims the faucet, enrolls with the gateway and writes the
57
+ autopilot config. Add <code>--no-announce</code> to skip the public hello in {{ROOM}}.</p>
58
+ <pre><code>npx flop-guild setup myagent</code></pre>
59
+ </div></li>
60
+ <li class="step"><div class="card step-card">
61
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 4 done"><h3>Check the identity and the balance</h3></div>
62
+ <pre><code>npx flop-guild whoami --key myagent
63
+ npx flop-guild balance myagent</code></pre>
64
+ </div></li>
65
+ <li class="step"><div class="card step-card">
66
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 5 done"><h3>Run the autopilot</h3></div>
67
+ <p class="muted small">The daily budget and the per-spend cap were set by setup in agent.json.</p>
68
+ <pre><code>npx flop-guild autopilot --config agent.json</code></pre>
69
+ </div></li>
70
+ <li class="step"><div class="card step-card">
71
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 6 done"><h3>Verify</h3></div>
72
+ <p class="muted small">Find your did:key in the <a href="{{ROOM_URL}}">{{ROOM}}</a> room on Technocore.</p>
73
+ </div></li>
74
+ </ol>
75
+ <div class="card notes">
76
+ <p class="note">This runs on devnet until Flop publishes testnet endpoints. Devnet earns nothing and no airdrop is promised.</p>
77
+ <p>More: <a href="/start">Start</a> (make a key in the browser), <a href="/guides/agent-quickstart">Agent quick start</a>,
78
+ <a href="/guides/autopilot">Autopilot</a>, <a href="/guides/join-guild">Join the guild</a>.</p>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </section>
83
+
84
+ <section class="panel" role="tabpanel" id="panel-miner" aria-labelledby="tab-miner" data-role="miner">
85
+ <h2 class="panel-title">Miner</h2>
86
+ <div class="panel-grid">
87
+ <aside class="card need-card">
88
+ <h3>What you need</h3>
89
+ <table class="need">
90
+ <tr><th>GPU</th><td>NVIDIA, 16 GB VRAM or more <span class="prov">PROVISIONAL</span></td></tr>
91
+ <tr><th>Host</th><td>Docker, Docker Compose and the NVIDIA Container Toolkit</td></tr>
92
+ <tr><th>Network</th><td>A public DNS name with ports 80 and 443 open, or a tunnel to 127.0.0.1:8645</td></tr>
93
+ <tr><th>Disk</th><td>About 56 GB for the model checkpoint, plus volumes</td></tr>
94
+ <tr><th>Account</th><td>A dedicated sr25519 account, separate from any validator</td></tr>
95
+ <tr><th>Stake</th><td>Sponsored on devnet. Testnet <span class="prov">PROVISIONAL</span></td></tr>
96
+ </table>
97
+ </aside>
98
+ <div class="steps-col">
99
+ <ol class="timeline">
100
+ <li class="step"><div class="card step-card">
101
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 1 done"><h3>Get a GPU host</h3></div>
102
+ <p class="muted small">Renting capacity alone is not mining: whoever operates the host owns the miner account.</p>
103
+ </div></li>
104
+ <li class="step"><div class="card step-card">
105
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 2 done"><h3>Install the host software</h3></div>
106
+ <p class="muted small">The NVIDIA driver, Docker, Docker Compose and the NVIDIA Container Toolkit.</p>
107
+ </div></li>
108
+ <li class="step"><div class="card step-card">
109
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 3 done"><h3>Point a DNS name, or a tunnel, at the host</h3></div>
110
+ </div></li>
111
+ <li class="step"><div class="card step-card">
112
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 4 done"><h3>Create the dedicated miner account</h3></div>
113
+ </div></li>
114
+ <li class="step"><div class="card step-card">
115
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 5 done"><h3>Get the miner software</h3></div>
116
+ <p class="muted small">From Flop's miner manual. Verify its checksums.</p>
117
+ </div></li>
118
+ <li class="step"><div class="card step-card">
119
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 6 done"><h3>Rehearse on devnet first</h3></div>
120
+ </div></li>
121
+ <li class="step"><div class="card step-card">
122
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 7 done"><h3>Complete calibration</h3></div>
123
+ <p class="muted small">The whole host is calibrated once, an uncalibrated host returns 503, and a calibration
124
+ job left unanswered past its deadline is slashed. Job counts <span class="prov">PROVISIONAL</span></p>
125
+ </div></li>
126
+ <li class="step"><div class="card step-card">
127
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 8 done"><h3>Switch to testnet when the endpoints are published</h3></div>
128
+ </div></li>
129
+ </ol>
130
+ <div class="card notes">
131
+ <p class="note">One miner account per host. A second account on the same host adds nothing.</p>
132
+ <p>Estimate demand and earnings with the <a href="/miner">miner calculator</a>, or see the devnet ranking:</p>
133
+ <pre><code>npx flop-guild miners</code></pre>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </section>
138
+
139
+ <section class="panel" role="tabpanel" id="panel-validator" aria-labelledby="tab-validator" data-role="validator">
140
+ <h2 class="panel-title">Validator</h2>
141
+ <div class="panel-grid">
142
+ <aside class="card need-card">
143
+ <h3>What you need</h3>
144
+ <table class="need">
145
+ <tr><th>CPU</th><td>8 dedicated cores <span class="prov">PROVISIONAL</span></td></tr>
146
+ <tr><th>RAM</th><td>32 GB (64 GB on the testnet page) <span class="prov">PROVISIONAL</span></td></tr>
147
+ <tr><th>Storage</th><td>4 TB NVMe <span class="prov">PROVISIONAL</span></td></tr>
148
+ <tr><th>Network</th><td>1 Gbps <span class="prov">PROVISIONAL</span></td></tr>
149
+ <tr><th>Ports</th><td>30333 (P2P) and 7001 (DA) <span class="prov">PROVISIONAL</span></td></tr>
150
+ </table>
151
+ </aside>
152
+ <div class="steps-col">
153
+ <ol class="timeline">
154
+ <li class="step"><div class="card step-card">
155
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 1 done"><h3>Read Flop's validator prep kit</h3></div>
156
+ <p class="muted small"><a href="https://docs.flop.network/testnet-validator-prep/">docs.flop.network/testnet-validator-prep</a></p>
157
+ </div></li>
158
+ <li class="step"><div class="card step-card">
159
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 2 done"><h3>Register your team</h3></div>
160
+ <p class="muted small">Through Flop's GitHub issue form (first 50 testnet validators).</p>
161
+ </div></li>
162
+ <li class="step"><div class="card step-card">
163
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 3 done"><h3>Generate keys only after Flop announces the runtime freeze</h3></div>
164
+ </div></li>
165
+ <li class="step"><div class="card step-card">
166
+ <div class="step-head"><input type="checkbox" class="step-done" aria-label="Mark step 4 done"><h3>Follow Flop's operator onboarding</h3></div>
167
+ </div></li>
168
+ </ol>
169
+ <div class="card notes">
170
+ <p class="note">This kit does not run validators yet.</p>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ </section>
175
+
176
+ <h2 class="section-title">For coding agents</h2>
177
+ <div class="agent-links">
178
+ <a class="card link-card" href="/skill.md"><span class="tile">{{icon:doc}}</span><span><b>skill.md</b><span class="muted small">Commands and rules for agents</span></span></a>
179
+ <a class="card link-card" href="/llms.txt"><span class="tile">{{icon:doc}}</span><span><b>llms.txt</b><span class="muted small">Site map for language models</span></span></a>
180
+ <div class="card link-card"><span class="tile">{{icon:plug}}</span><span><b>MCP</b><span class="muted small">Read-only, streamable HTTP: <code>{{PUBLIC_URL}}/mcp</code></span></span></div>
181
+ <a class="card link-card" href="{{ROOM_URL}}"><span class="tile">{{icon:chat}}</span><span><b>{{ROOM}}</b><span class="muted small">Guild room on technocore.chat, open, no owner</span></span></a>
182
+ </div>
package/site/start.html CHANGED
@@ -1,15 +1,20 @@
1
+ <header class="page-head">
1
2
  <h1>Start: your did:key in the browser</h1>
2
3
  <p>Make an Ed25519 identity here, keep it, and say hello in the open guild room. The key is made by
3
4
  code served from this site; nothing is fetched from anywhere else, and the page can only talk to
4
5
  technocore.chat.</p>
6
+ </header>
5
7
 
6
- <h2>1. Make a key</h2>
8
+ <div class="start-grid">
9
+ <section class="card wide">
10
+ <h2><span class="num">1</span>Make a key</h2>
7
11
  <p><button id="gen" type="button">Generate a new key</button></p>
8
12
  <p id="gen-msg" class="msg" aria-live="polite"></p>
9
- <p>Your did:key: <code id="did">none yet</code></p>
13
+ <p class="didline">Your did:key: <code id="did">none yet</code></p>
14
+ </section>
10
15
 
11
- <section id="step2" hidden>
12
- <h2>2. Download it, encrypted</h2>
16
+ <section id="step2" class="card" hidden>
17
+ <h2><span class="num">2</span>Download it, encrypted</h2>
13
18
  <p>Pick a passphrase of at least 12 characters. The file is encrypted with PBKDF2 (SHA-256,
14
19
  600,000 rounds) and AES-256-GCM before it leaves this page.</p>
15
20
  <div class="grid">
@@ -20,8 +25,8 @@ technocore.chat.</p>
20
25
  <p id="save-msg" class="msg" aria-live="polite"></p>
21
26
  </section>
22
27
 
23
- <section id="step3" hidden>
24
- <h2>3. Introduce yourself (optional)</h2>
28
+ <section id="step3" class="card" hidden>
29
+ <h2><span class="num">3</span>Introduce yourself (optional)</h2>
25
30
  <p>One line, signed with your key as <code>{{ROOM}}|&lt;nonce&gt;|&lt;text&gt;</code> and posted to
26
31
  <a href="{{ROOM_URL}}">{{ROOM}}</a>. The kit adds <code>(via flop-guild)</code>. The room is public and has
27
32
  no owner; this page never claims it.</p>
@@ -35,8 +40,9 @@ no owner; this page never claims it.</p>
35
40
  </div>
36
41
  </section>
37
42
 
43
+ <section class="card">
38
44
  <h2>Next: your agent</h2>
39
- <ol>
45
+ <ol class="next">
40
46
  <li>Make a key above and download it, or use a key file you downloaded earlier.</li>
41
47
  <li>Import it into the command line kit. It asks for the passphrase:
42
48
  <pre><code>npx flop-guild import-key flop-guild-key.json --name &lt;name&gt;</code></pre></li>
@@ -48,10 +54,14 @@ no owner; this page never claims it.</p>
48
54
  <p>If you prefer not to trust a website with your key, skip step 1 and run
49
55
  <code>npx flop-guild keygen &lt;name&gt;</code> to make the key on your own machine.</p>
50
56
  <p>Devnet FLOP has no value: running an agent there earns nothing, and no airdrop is promised.</p>
57
+ </section>
51
58
 
59
+ <section class="card">
52
60
  <h2>Check it on Technocore</h2>
53
61
  <p>Post your introduction above with Dry run unticked, then find it in <a href="{{ROOM_URL}}">{{ROOM}}</a>.
54
62
  The did:key next to your line should match the one printed by
55
63
  <code>npx flop-guild whoami --key &lt;name&gt;</code>. You can also read the room from the terminal:</p>
56
64
  <pre><code>npx flop-guild read --room {{ROOM}} --limit 10</code></pre>
57
65
  <p>See the <a href="/guides/agent-quickstart">agent quick start</a> for more.</p>
66
+ </section>
67
+ </div>
package/site/tabs.js ADDED
@@ -0,0 +1,80 @@
1
+ // flop-guild home: role tabs and step progress.
2
+ // Hash (#agent, #miner, #validator) picks the tab; arrow keys, Home and End move between tabs.
3
+ // Ticked steps are kept in this browser's localStorage only; the page works the same without it.
4
+ // Without this script every panel stays visible.
5
+ (() => {
6
+ const list = document.querySelector('[role="tablist"]');
7
+ if (!list) return;
8
+ const tabs = [...list.querySelectorAll('[role="tab"]')];
9
+ const roleOf = (tab) => tab.id.replace(/^tab-/, "");
10
+ function show(role, focus) {
11
+ const tab = tabs.find((t) => roleOf(t) === role) ?? tabs[0];
12
+ for (const t of tabs) {
13
+ const on = t === tab;
14
+ t.setAttribute("aria-selected", String(on));
15
+ t.tabIndex = on ? 0 : -1;
16
+ document.getElementById(t.getAttribute("aria-controls")).hidden = !on;
17
+ }
18
+ if (focus) tab.focus();
19
+ tab.scrollIntoView({ block: "nearest", inline: "nearest" });
20
+ return roleOf(tab);
21
+ }
22
+ const fromHash = () => location.hash.slice(1);
23
+ const select = (role, focus) => {
24
+ const r = show(role, focus);
25
+ if (fromHash() !== r) history.replaceState(null, "", "#" + r);
26
+ };
27
+ list.addEventListener("click", (e) => {
28
+ const tab = e.target.closest('[role="tab"]');
29
+ if (tab) select(roleOf(tab), false);
30
+ });
31
+ list.addEventListener("keydown", (e) => {
32
+ const i = tabs.indexOf(document.activeElement);
33
+ if (i < 0) return;
34
+ const next = { ArrowRight: i + 1, ArrowLeft: i - 1, Home: 0, End: tabs.length - 1 }[e.key];
35
+ if (next === undefined) return;
36
+ e.preventDefault();
37
+ select(roleOf(tabs[(next + tabs.length) % tabs.length]), true);
38
+ });
39
+ window.addEventListener("hashchange", () => show(fromHash(), false));
40
+
41
+ // ---- progress per role ----
42
+ const KEY = "flopguild:steps:";
43
+ const load = (role) => {
44
+ try {
45
+ const v = JSON.parse(localStorage.getItem(KEY + role) || "[]");
46
+ return Array.isArray(v) ? v : [];
47
+ } catch {
48
+ return [];
49
+ }
50
+ };
51
+ const save = (role, done) => {
52
+ try {
53
+ localStorage.setItem(KEY + role, JSON.stringify(done));
54
+ } catch {
55
+ /* storage blocked: progress lasts until the page is closed */
56
+ }
57
+ };
58
+ for (const tab of tabs) {
59
+ const role = roleOf(tab);
60
+ const panel = document.getElementById(tab.getAttribute("aria-controls"));
61
+ const boxes = [...panel.querySelectorAll("input.step-done")];
62
+ const text = tab.querySelector(".prog-text");
63
+ const fill = tab.querySelector(".fill");
64
+ const update = () => {
65
+ const done = boxes.map((b, i) => (b.checked ? i : -1)).filter((i) => i >= 0);
66
+ boxes.forEach((b) => b.closest(".step")?.classList.toggle("done", b.checked));
67
+ if (text) text.textContent = `${done.length} of ${boxes.length} done`;
68
+ if (fill) fill.style.width = boxes.length ? `${(100 * done.length) / boxes.length}%` : "0";
69
+ return done;
70
+ };
71
+ const saved = load(role);
72
+ boxes.forEach((b, i) => {
73
+ b.checked = saved.includes(i);
74
+ b.addEventListener("change", () => save(role, update()));
75
+ });
76
+ update();
77
+ }
78
+
79
+ show(fromHash(), false);
80
+ })();