flop-guild 0.2.6 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/autopilot.js +129 -28
- package/dist/config.js +1 -1
- package/dist/content.js +256 -0
- package/dist/flop.js +55 -17
- package/dist/server.js +29 -68
- package/dist/shell.js +80 -13
- package/dist/sync-docs.js +19 -0
- package/package.json +2 -2
- package/site/guides/agent-quickstart.md +23 -5
- package/site/guides/autopilot.md +10 -5
- package/site/guides/claude-vps.md +134 -0
- package/site/guides/manual-pc.md +65 -0
- package/site/index.html +3 -166
- package/site/llms.txt +7 -4
- package/site/skill.md +16 -1
- package/site/theme.js +29 -0
- package/skill.md +153 -0
package/dist/server.js
CHANGED
|
@@ -7,7 +7,8 @@ import { dirname, join } from "node:path";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
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
|
+
import { DISCLAIMER, esc, ICONS, page } from "./shell.js";
|
|
11
|
+
import { expand, GUIDES, guidesHtml, mdToHtml, ROLES, roleMd, rolesHtml, rolesMd } from "./content.js";
|
|
11
12
|
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
12
13
|
const SITE = join(ROOT, "site");
|
|
13
14
|
const VERSION = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version;
|
|
@@ -20,63 +21,7 @@ const guideNames = readdirSync(join(SITE, "guides"))
|
|
|
20
21
|
function guideMd(name) {
|
|
21
22
|
if (!guideNames.includes(name))
|
|
22
23
|
return undefined;
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
/** Small Markdown subset: headings, paragraphs, lists, indented code, inline code and links. */
|
|
26
|
-
function mdToHtml(md) {
|
|
27
|
-
const inline = (s) => esc(s)
|
|
28
|
-
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
|
29
|
-
.replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+|\/[^)\s]*)\)/g, '<a href="$2">$1</a>');
|
|
30
|
-
const out = [];
|
|
31
|
-
let para = [];
|
|
32
|
-
let list = [];
|
|
33
|
-
let ordered = false;
|
|
34
|
-
let code = [];
|
|
35
|
-
const flush = () => {
|
|
36
|
-
if (para.length)
|
|
37
|
-
out.push(`<p>${inline(para.join(" "))}</p>`), (para = []);
|
|
38
|
-
if (list.length)
|
|
39
|
-
out.push(`<${ordered ? "ol" : "ul"}>${list.map((l) => `<li>${inline(l)}</li>`).join("")}</${ordered ? "ol" : "ul"}>`), (list = []);
|
|
40
|
-
if (code.length)
|
|
41
|
-
out.push(`<pre><code>${esc(code.join("\n"))}</code></pre>`), (code = []);
|
|
42
|
-
};
|
|
43
|
-
for (const line of md.split("\n")) {
|
|
44
|
-
if (/^ {4}/.test(line) && !list.length) {
|
|
45
|
-
if (para.length)
|
|
46
|
-
flush();
|
|
47
|
-
code.push(line.slice(4));
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (code.length && line.trim() === "") {
|
|
51
|
-
code.push("");
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (code.length) {
|
|
55
|
-
while (code.at(-1) === "")
|
|
56
|
-
code.pop();
|
|
57
|
-
flush();
|
|
58
|
-
}
|
|
59
|
-
const h = line.match(/^(#{1,3}) (.*)$/);
|
|
60
|
-
const li = line.match(/^(?:- |(\d+)\. )(.*)$/);
|
|
61
|
-
if (h)
|
|
62
|
-
flush(), out.push(`<h${h[1].length}>${inline(h[2])}</h${h[1].length}>`);
|
|
63
|
-
else if (li) {
|
|
64
|
-
if (para.length)
|
|
65
|
-
flush();
|
|
66
|
-
ordered = !!li[1];
|
|
67
|
-
list.push(li[2]);
|
|
68
|
-
}
|
|
69
|
-
else if (line.trim() === "")
|
|
70
|
-
flush();
|
|
71
|
-
else if (list.length && /^ {2,}/.test(line))
|
|
72
|
-
list[list.length - 1] += " " + line.trim();
|
|
73
|
-
else
|
|
74
|
-
para.push(line.trim());
|
|
75
|
-
}
|
|
76
|
-
while (code.at(-1) === "")
|
|
77
|
-
code.pop();
|
|
78
|
-
flush();
|
|
79
|
-
return out.join("\n");
|
|
24
|
+
return expand(readFileSync(join(SITE, "guides", `${name}.md`), "utf8"));
|
|
80
25
|
}
|
|
81
26
|
// ---------- read-only MCP tools ----------
|
|
82
27
|
const cache = new Map();
|
|
@@ -163,14 +108,16 @@ function autopilotInstall() {
|
|
|
163
108
|
const tools = [
|
|
164
109
|
{
|
|
165
110
|
name: "get_guide",
|
|
166
|
-
description: `Return a flop-guild guide as Markdown.
|
|
167
|
-
inputSchema: { type: "object", properties: { name: { type: "string", enum: [...guideNames, "skill", "llms"] } }, required: ["name"] },
|
|
111
|
+
description: `Return a flop-guild guide as Markdown, the same text as the website. Guides: ${GUIDES.map((g) => `${g.slug} (${g.title})`).join("; ")}. Also: roles (Agent, Miner and Validator steps), skill, llms.`,
|
|
112
|
+
inputSchema: { type: "object", properties: { name: { type: "string", enum: [...new Set([...GUIDES.map((g) => g.slug), ...guideNames]), "roles", "skill", "llms"] } }, required: ["name"] },
|
|
168
113
|
run: async (a) => {
|
|
169
114
|
const n = String(a.name ?? "");
|
|
115
|
+
if (n === "roles")
|
|
116
|
+
return expand(rolesMd(2));
|
|
170
117
|
if (n === "skill")
|
|
171
|
-
return
|
|
118
|
+
return expand(readFileSync(join(SITE, "skill.md"), "utf8"));
|
|
172
119
|
if (n === "llms")
|
|
173
|
-
return
|
|
120
|
+
return expand(readFileSync(join(SITE, "llms.txt"), "utf8"));
|
|
174
121
|
const g = guideMd(n);
|
|
175
122
|
if (!g)
|
|
176
123
|
throw new Error(`unknown guide "${n}"`);
|
|
@@ -183,6 +130,17 @@ const tools = [
|
|
|
183
130
|
inputSchema: { type: "object", properties: { network: { type: "string", description: "default devnet" } } },
|
|
184
131
|
run: (a) => networkStatus(String(a.network ?? "devnet")),
|
|
185
132
|
},
|
|
133
|
+
{
|
|
134
|
+
name: "get_role_steps",
|
|
135
|
+
description: `What you need and the numbered steps for one role (${ROLES.map((r) => r.id).join(", ")}), the same text as the website's role tabs.`,
|
|
136
|
+
inputSchema: { type: "object", properties: { role: { type: "string", enum: ROLES.map((r) => r.id) } }, required: ["role"] },
|
|
137
|
+
run: async (a) => {
|
|
138
|
+
const r = ROLES.find((x) => x.id === String(a.role ?? ""));
|
|
139
|
+
if (!r)
|
|
140
|
+
throw new Error(`unknown role; known: ${ROLES.map((x) => x.id).join(", ")}`);
|
|
141
|
+
return expand(roleMd(r, 2));
|
|
142
|
+
},
|
|
143
|
+
},
|
|
186
144
|
{
|
|
187
145
|
name: "join_guild",
|
|
188
146
|
description: "How to join the open flop-guild room on technocore.chat.",
|
|
@@ -235,7 +193,7 @@ async function handleRpc(req) {
|
|
|
235
193
|
}
|
|
236
194
|
}
|
|
237
195
|
// ---------- /start (browser-only did:key starter) ----------
|
|
238
|
-
const START_FOOTER =
|
|
196
|
+
const START_FOOTER = DISCLAIMER;
|
|
239
197
|
// The page may load only its own scripts and may connect only to technocore.chat.
|
|
240
198
|
const START_CSP = [
|
|
241
199
|
"default-src 'none'",
|
|
@@ -262,7 +220,7 @@ const HOME_STYLE = `
|
|
|
262
220
|
.stat-top{display:flex;align-items:center;gap:.6rem}.stat-label{font-size:.82rem;color:var(--muted);flex:1;min-width:0}
|
|
263
221
|
.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
222
|
.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
|
|
223
|
+
.live.on{color:var(--accent)}.live.on::before{background:var(--accent);box-shadow:0 0 0 3px var(--glow)}
|
|
266
224
|
.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
225
|
.stat-sub{font-size:.8rem;color:var(--muted)}
|
|
268
226
|
.roles{display:flex;gap:.8rem;overflow-x:auto;scroll-snap-type:x mandatory;padding:.15rem .15rem .5rem;margin:0 -.15rem .6rem;scrollbar-width:thin}
|
|
@@ -280,11 +238,11 @@ const HOME_STYLE = `
|
|
|
280
238
|
.timeline::before{content:"";position:absolute;left:.95rem;top:.6rem;bottom:.6rem;width:1px;background:var(--line-2)}
|
|
281
239
|
.step{counter-increment:step;position:relative;padding-left:2.9rem;margin-bottom:.8rem}
|
|
282
240
|
.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
|
|
241
|
+
.step.done::before{content:"\\2713";background:var(--accent-deep);border-color:var(--accent);color:var(--done-fg)}
|
|
284
242
|
.step-card{margin:0;padding:.85rem 1rem}.step-card>:last-child{margin-bottom:0}.step-card p{margin:.5rem 0 0}
|
|
285
243
|
.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
244
|
.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
|
|
245
|
+
.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:var(--input-bg);cursor:pointer;display:grid;place-items:center}
|
|
288
246
|
.step-done:checked{background:var(--accent);border-color:var(--accent)}
|
|
289
247
|
.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
248
|
.notes{margin-top:.2rem}
|
|
@@ -299,6 +257,7 @@ const STATIC_JS = {
|
|
|
299
257
|
"/vendor/noble-ed25519-3.2.0.js": { file: "vendor/noble-ed25519-3.2.0.js", type: "text/javascript; charset=utf-8" },
|
|
300
258
|
"/vendor/noble-ed25519-LICENSE.txt": { file: "vendor/noble-ed25519-LICENSE.txt", type: "text/plain; charset=utf-8" },
|
|
301
259
|
"/copy.js": { file: "copy.js", type: "text/javascript; charset=utf-8" },
|
|
260
|
+
"/theme.js": { file: "theme.js", type: "text/javascript; charset=utf-8" },
|
|
302
261
|
"/tabs.js": { file: "tabs.js", type: "text/javascript; charset=utf-8" },
|
|
303
262
|
"/logo.svg": { file: "logo.svg", type: "image/svg+xml" },
|
|
304
263
|
"/favicon.svg": { file: "favicon.svg", type: "image/svg+xml" },
|
|
@@ -454,13 +413,15 @@ export function startServer(port, host = "0.0.0.0") {
|
|
|
454
413
|
if (path === "/") {
|
|
455
414
|
const body = render(readFileSync(join(SITE, "index.html"), "utf8"))
|
|
456
415
|
.replace(/\{\{icon:([a-z]+)\}\}/g, (_m, k) => ICONS[k] ?? "")
|
|
416
|
+
.replace("{{ROLES}}", render(rolesHtml(ICONS)))
|
|
417
|
+
.replace("{{GUIDES}}", guidesHtml(ICONS.doc))
|
|
457
418
|
.replace("{{STATS}}", await homeStats());
|
|
458
419
|
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" });
|
|
459
420
|
}
|
|
460
421
|
if (path === "/llms.txt")
|
|
461
|
-
return send(res, 200, "text/plain; charset=utf-8",
|
|
422
|
+
return send(res, 200, "text/plain; charset=utf-8", expand(readFileSync(join(SITE, "llms.txt"), "utf8")));
|
|
462
423
|
if (path === "/skill.md")
|
|
463
|
-
return send(res, 200, "text/markdown; charset=utf-8",
|
|
424
|
+
return send(res, 200, "text/markdown; charset=utf-8", expand(readFileSync(join(SITE, "skill.md"), "utf8")));
|
|
464
425
|
const g = path.match(/^\/guides\/([a-z0-9-]+)(\.md)?$/);
|
|
465
426
|
if (g) {
|
|
466
427
|
const md = guideMd(g[1]);
|
package/dist/shell.js
CHANGED
|
@@ -18,8 +18,24 @@ function codeLabel(html) {
|
|
|
18
18
|
export function decorateCode(body) {
|
|
19
19
|
return body.replace(/<pre(?: data-runin="([^"]*)")?><code>([\s\S]*?)<\/code><\/pre>/g, (_m, runin, code) => {
|
|
20
20
|
const label = runin ?? esc(codeLabel(code));
|
|
21
|
-
const isCommand = label.startsWith("Run in");
|
|
22
|
-
|
|
21
|
+
const isCommand = label.startsWith("Run in") && !/prompt/i.test(label); // a Claude Code prompt gets no "$"
|
|
22
|
+
let heredoc; // lines inside a heredoc are file contents, not commands
|
|
23
|
+
const lines = isCommand
|
|
24
|
+
? code
|
|
25
|
+
.split("\n")
|
|
26
|
+
.map((l) => {
|
|
27
|
+
if (heredoc) {
|
|
28
|
+
if (l.trim() === heredoc)
|
|
29
|
+
heredoc = undefined;
|
|
30
|
+
return l;
|
|
31
|
+
}
|
|
32
|
+
const h = l.match(/<<-?\s*'?"?([A-Z_]+)'?"?/);
|
|
33
|
+
if (h)
|
|
34
|
+
heredoc = h[1];
|
|
35
|
+
return l.trim() ? `<span class="ln">${l}</span>` : l;
|
|
36
|
+
})
|
|
37
|
+
.join("\n")
|
|
38
|
+
: code;
|
|
23
39
|
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
40
|
});
|
|
25
41
|
}
|
|
@@ -33,9 +49,18 @@ const FONT_CSS = `
|
|
|
33
49
|
@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
50
|
@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
51
|
@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
|
-
|
|
37
|
-
|
|
52
|
+
/** Dark is the base; light overrides it. No-JS visitors follow prefers-color-scheme; theme.js sets data-theme. */
|
|
53
|
+
const DARK = `color-scheme:dark;--bg:#0a1020;--panel:#0f1729;--card:#121c31;--card-2:#17223a;--line:#1f2b44;--line-2:#2a3856;
|
|
38
54
|
--fg:#e6ebf4;--muted:#8d99b0;--dim:#64708a;--accent:#8cc5b1;--accent-deep:#2f5d50;--on-accent:#08130f;--warn:#e0b25c;--bad:#ef8a80;
|
|
55
|
+
--warn-line:#4a3d22;--warn-bg:#1d1a12;--tag-bg:#2f5d50;--tag-fg:#d8efe6;--term-bg:#070c18;--term-fg:#dfe6f2;--term-prompt:#8cc5b1;--input-bg:#0b1222;--glow:rgba(140,197,177,.15);--done-fg:#e6f6ef;`;
|
|
56
|
+
const LIGHT = `color-scheme:light;--bg:#f5f7fa;--panel:#ffffff;--card:#ffffff;--card-2:#f0f3f7;--line:#e1e6ed;--line-2:#cfd7e2;
|
|
57
|
+
--fg:#111a2c;--muted:#525e72;--dim:#7a8597;--accent:#2f5d50;--accent-deep:#2f5d50;--on-accent:#ffffff;--warn:#8a5a00;--bad:#b3261e;
|
|
58
|
+
--warn-line:#e7cf9c;--warn-bg:#fdf6e6;--tag-bg:#dcefe7;--tag-fg:#1f4a3e;--term-bg:#0f1729;--term-fg:#e6ebf4;--term-prompt:#8cc5b1;--input-bg:#ffffff;--glow:rgba(47,93,80,.15);--done-fg:#ffffff;`;
|
|
59
|
+
const THEME_CSS = `
|
|
60
|
+
:root[data-theme=light]{${LIGHT}}
|
|
61
|
+
@media (prefers-color-scheme: light){:root:not([data-theme]){${LIGHT}}}`;
|
|
62
|
+
export const SHELL_CSS = `${FONT_CSS}
|
|
63
|
+
:root{${DARK}
|
|
39
64
|
--display:"Space Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
|
|
40
65
|
*,*::before,*::after{box-sizing:border-box}
|
|
41
66
|
html{-webkit-text-size-adjust:100%}
|
|
@@ -52,7 +77,7 @@ code{font-family:var(--mono);font-size:.86em;background:var(--card-2);border:1px
|
|
|
52
77
|
.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
78
|
.brand{display:inline-flex;align-items:center;gap:.55rem;color:var(--fg)}.brand:hover{text-decoration:none}
|
|
54
79
|
.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
|
|
80
|
+
.pill{display:inline-flex;align-items:center;gap:.35rem;font:600 .68rem/1 var(--mono);letter-spacing:.08em;color:var(--warn);border:1px solid var(--warn-line);background:var(--warn-bg);border-radius:99px;padding:.3rem .55rem}
|
|
56
81
|
.pill::before{content:"";width:.4rem;height:.4rem;border-radius:50%;background:currentColor}
|
|
57
82
|
.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
83
|
.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}
|
|
@@ -69,33 +94,75 @@ main.wrap{padding-top:1.8rem;padding-bottom:3rem}
|
|
|
69
94
|
.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
95
|
.tile svg{width:1.05rem;height:1.05rem}
|
|
71
96
|
.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(--
|
|
97
|
+
.tag{background:var(--tag-bg);color:var(--tag-fg)}.prov{border:1px solid var(--warn-line);color:var(--warn)}
|
|
73
98
|
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
99
|
tr:last-child>th,tr:last-child>td{border-bottom:0}
|
|
75
100
|
/* terminal code blocks */
|
|
76
|
-
.term{border:1px solid var(--line-2);border-radius:10px;overflow:hidden;margin:.6rem 0 1rem;background
|
|
101
|
+
.term{border:1px solid var(--line-2);border-radius:10px;overflow:hidden;margin:.6rem 0 1rem;background:var(--term-bg);min-width:0}
|
|
77
102
|
.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
103
|
.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
|
|
104
|
+
.term pre{margin:0;padding:.75rem .9rem;overflow-x:auto;font:13px/1.65 var(--mono);color:var(--term-fg)}
|
|
80
105
|
.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(--
|
|
106
|
+
.term pre.cmd .ln::before{content:"$ ";color:var(--term-prompt);user-select:none}
|
|
82
107
|
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
108
|
button.copy:hover{border-color:var(--accent);color:var(--accent)}
|
|
84
109
|
/* forms */
|
|
85
|
-
input[type=text],input[type=password],input[type=number]{font:inherit;color:var(--fg);background
|
|
110
|
+
input[type=text],input[type=password],input[type=number]{font:inherit;color:var(--fg);background:var(--input-bg);border:1px solid var(--line-2);border-radius:8px;padding:.5rem .6rem;margin-top:.3rem;width:100%;min-width:0}
|
|
86
111
|
input:focus{outline:none;border-color:var(--accent)}
|
|
87
112
|
label{display:flex;flex-direction:column;font-size:.85rem;color:var(--muted)}label.inline{flex-direction:row;gap:.5rem;align-items:center}
|
|
88
113
|
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));gap:.8rem 1rem}
|
|
89
114
|
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
115
|
.msg{color:var(--muted)}.msg.bad{color:var(--bad)}
|
|
91
116
|
/* footer */
|
|
92
|
-
.foot{border-top:1px solid var(--line);color:var(--
|
|
93
|
-
|
|
117
|
+
.foot{position:relative;overflow:hidden;border-top:1px solid var(--line);background:var(--panel);color:var(--muted);font-size:.86rem;margin-top:2rem}
|
|
118
|
+
.foot-log{position:absolute;inset:-30% -10%;transform:rotate(-9deg);font:600 .8rem/2.1 var(--mono);color:var(--fg);opacity:.045;white-space:pre;pointer-events:none;user-select:none;columns:3 16rem;column-gap:3rem}
|
|
119
|
+
.foot>.wrap{position:relative}
|
|
120
|
+
.foot-main{display:grid;gap:2rem;grid-template-columns:minmax(0,1fr);padding-top:2.4rem;padding-bottom:1.6rem}
|
|
121
|
+
@media (min-width:960px){.foot-main{grid-template-columns:minmax(0,15rem) minmax(0,1fr)}}
|
|
122
|
+
.foot-brand p{margin:.7rem 0 0;max-width:16rem}
|
|
123
|
+
.foot-cols{display:grid;gap:1.6rem 1.2rem;grid-template-columns:repeat(4,minmax(0,1fr))}
|
|
124
|
+
@media (max-width:760px){.foot-cols{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
125
|
+
@media (max-width:400px){.foot-cols{grid-template-columns:minmax(0,1fr)}}
|
|
126
|
+
.foot-label{font:700 .66rem/1 var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--dim);margin:0 0 .85rem}
|
|
127
|
+
.foot-col ul{list-style:none;margin:0;padding:0}.foot-col li{margin:0 0 .5rem;overflow-wrap:anywhere}
|
|
128
|
+
.foot-col a{color:var(--muted)}.foot-col a:hover{color:var(--fg);text-decoration:none}.foot-col code{font-size:.78rem}
|
|
129
|
+
.foot-bottom{display:flex;align-items:center;justify-content:space-between;gap:1rem;border-top:1px solid var(--line);padding-top:1rem;padding-bottom:1.4rem;color:var(--dim);font-size:.8rem}
|
|
130
|
+
.foot-bottom p{margin:0}.foot-bottom a{color:var(--dim);text-decoration:underline}
|
|
131
|
+
.theme-toggle{flex:none;display:inline-grid;place-items:center;width:2.1rem;height:2.1rem;border-radius:8px;border:1px solid var(--line-2);background:var(--card);color:var(--fg);cursor:pointer;padding:0}
|
|
132
|
+
.theme-toggle:hover{border-color:var(--accent);color:var(--accent)}.theme-toggle svg{width:1rem;height:1rem}
|
|
133
|
+
.theme-toggle .sun{display:none}:root[data-theme=dark] .theme-toggle .sun{display:block}:root[data-theme=dark] .theme-toggle .moon{display:none}
|
|
134
|
+
${THEME_CSS}`;
|
|
135
|
+
const NAV = `<nav class="nav" aria-label="Main"><a href="/start">Create DID</a><a href="/miner">Miner calculator</a><a href="${GUILD_ROOM_URL}">Guild room</a></nav>`;
|
|
136
|
+
export const DISCLAIMER = "Unofficial community kit, not affiliated with Flop Labs. No airdrop promises.";
|
|
137
|
+
/** Real setup step text for the footer backdrop: no numbers, no hashes. */
|
|
138
|
+
const LOG_LINES = ["created did:key", "created encrypted wallet", "genesis ok on devnet", "faucet accepted", "enrolled via the wallet flow", "wrote tasks.json", "wrote agent.json", "posted to d-flopguild"];
|
|
139
|
+
const FOOT_LOG = Array.from({ length: 9 }, (_, i) => LOG_LINES.slice(i % LOG_LINES.length).concat(LOG_LINES.slice(0, i % LOG_LINES.length)).map((l) => `setup ${l}`).join("\n")).join("\n");
|
|
140
|
+
const SUN = '<svg class="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M4.6 4.6l1.4 1.4M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4L6 18M18 6l1.4-1.4"/></svg>';
|
|
141
|
+
const MOON = '<svg class="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z"/></svg>';
|
|
142
|
+
function footer(note) {
|
|
143
|
+
const col = (label, items) => `<div class="foot-col"><p class="foot-label">${label}</p><ul>${items.map((i) => `<li>${i}</li>`).join("")}</ul></div>`;
|
|
144
|
+
return `<footer class="foot">
|
|
145
|
+
<div class="foot-log" aria-hidden="true">${FOOT_LOG}</div>
|
|
146
|
+
<div class="wrap foot-main">
|
|
147
|
+
<div class="foot-brand"><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>
|
|
148
|
+
<p>Community kit for the Flop network</p></div>
|
|
149
|
+
<nav class="foot-cols" aria-label="Footer">
|
|
150
|
+
${col("Product", ['<a href="/#agent">Start your agent</a>', '<a href="/start">Create DID</a>', '<a href="/miner">Miner calculator</a>'])}
|
|
151
|
+
${col("Learn", ['<a href="/#agent">Agent</a>', '<a href="/#miner">Miner</a>', '<a href="/#validator">Validator</a>', '<a href="/guides/claude-vps">Claude + VPS guide</a>', '<a href="/guides/manual-pc">Own PC guide</a>'])}
|
|
152
|
+
${col("For agents", ['<a href="/skill.md">skill.md</a>', '<a href="/llms.txt">llms.txt</a>', 'MCP: <code>/mcp</code>', '<a href="/guides/agent-quickstart">Agent quick start</a>'])}
|
|
153
|
+
${col("Project", [`<a href="${GUILD_ROOM_URL}">Guild room ${GUILD_ROOM}</a>`, '<a href="https://www.npmjs.com/package/flop-guild">flop-guild on npm</a>', '<a href="https://docs.flop.network/">Flop docs</a>'])}
|
|
154
|
+
</nav>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="wrap foot-bottom"><p>${esc(note)} via flop-guild</p>
|
|
157
|
+
<button type="button" class="theme-toggle" aria-label="Switch between light and dark theme" title="Light or dark theme">${SUN}${MOON}</button></div>
|
|
158
|
+
</footer>`;
|
|
159
|
+
}
|
|
94
160
|
export function page(title, body, o = {}) {
|
|
95
161
|
body = decorateCode(o.cards ? cardify(body) : body);
|
|
96
162
|
const copy = body.includes("copyable") ? '<script defer src="/copy.js"></script>' : "";
|
|
97
163
|
return `<!doctype html>
|
|
98
164
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
165
|
+
<script src="/theme.js"></script>
|
|
99
166
|
<title>${esc(title)}</title>
|
|
100
167
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
101
168
|
<link rel="preload" href="/fonts/space-mono-latin-700-normal.woff2" as="font" type="font/woff2" crossorigin>
|
|
@@ -111,7 +178,7 @@ ${NAV}
|
|
|
111
178
|
<main class="wrap">
|
|
112
179
|
${body}
|
|
113
180
|
</main>
|
|
114
|
-
|
|
181
|
+
${footer(o.footerNote ?? DISCLAIMER)}
|
|
115
182
|
</body></html>`;
|
|
116
183
|
}
|
|
117
184
|
/** Small line icons for tiles. stroke = currentColor. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Build step: copy the shared role steps and guide list (src/content.ts) into the packaged skill.md,
|
|
2
|
+
// between the generated markers, so the npm package says the same as the website.
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { expand } from "./content.js";
|
|
7
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const START = "<!-- generated from src/content.ts by npm run build: do not edit -->";
|
|
9
|
+
const END = "<!-- end generated -->";
|
|
10
|
+
const path = join(ROOT, "skill.md");
|
|
11
|
+
const text = readFileSync(path, "utf8");
|
|
12
|
+
const a = text.indexOf(START);
|
|
13
|
+
const b = text.indexOf(END);
|
|
14
|
+
if (a < 0 || b < a)
|
|
15
|
+
throw new Error("skill.md: generated markers not found");
|
|
16
|
+
const body = expand("## Roles\n\n{{ROLES_MD}}\n## Guides\n\n{{GUIDES_MD}}\n");
|
|
17
|
+
const next = `${text.slice(0, a)}${START}\n\n${body.trim()}\n\n${text.slice(b)}`;
|
|
18
|
+
if (next !== text)
|
|
19
|
+
writeFileSync(path, next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flop-guild",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsc -p tsconfig.json",
|
|
36
|
+
"build": "tsc -p tsconfig.json && node dist/sync-docs.js",
|
|
37
37
|
"test": "node --test \"dist/test/*.test.js\"",
|
|
38
38
|
"start": "node dist/server.js",
|
|
39
39
|
"prepublishOnly": "npm run build && npm test"
|
|
@@ -2,21 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Devnet FLOP is a test token with no value, and devnet activity earns no airdrop.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The same steps as the Agent tab on the home page:
|
|
6
|
+
|
|
7
|
+
{{ROLE_MD:agent}}
|
|
8
|
+
|
|
9
|
+
## Other roles
|
|
10
|
+
|
|
11
|
+
{{ROLE_MD:miner}}
|
|
12
|
+
|
|
13
|
+
{{ROLE_MD:validator}}
|
|
14
|
+
|
|
15
|
+
## Guides
|
|
16
|
+
|
|
17
|
+
{{GUIDES_MD}}
|
|
18
|
+
|
|
19
|
+
## By hand, one command at a time
|
|
20
|
+
|
|
21
|
+
What `setup` does, step by step.
|
|
22
|
+
|
|
23
|
+
### 1. Check the chain
|
|
6
24
|
|
|
7
25
|
flop-guild genesis-check
|
|
8
26
|
|
|
9
27
|
This compares the genesis hash in `networks.json` with the RPC and the faucet. Every chain
|
|
10
28
|
command runs the same check and refuses to sign on a mismatch.
|
|
11
29
|
|
|
12
|
-
|
|
30
|
+
### 2. Create one wallet
|
|
13
31
|
|
|
14
32
|
export FLOP_GUILD_PASSPHRASE='a long passphrase'
|
|
15
33
|
flop-guild wallet-create myagent
|
|
16
34
|
|
|
17
35
|
The sr25519 key is saved only as an encrypted keystore (mode 600).
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
### 3. Faucet
|
|
20
38
|
|
|
21
39
|
flop-guild faucet-claim myagent
|
|
22
40
|
|
|
@@ -24,14 +42,14 @@ The wallet lane asks `POST /fund` for 25 FLOP. When the faucet is busy the answe
|
|
|
24
42
|
while the grant still lands minutes later. The outcome is then `unknown`: check
|
|
25
43
|
`flop-guild balance myagent` before asking again, and never retry in a loop.
|
|
26
44
|
|
|
27
|
-
|
|
45
|
+
### 4. Enroll for a gateway allowance
|
|
28
46
|
|
|
29
47
|
flop-guild enroll myagent
|
|
30
48
|
|
|
31
49
|
The kit signs the gateway's one-time challenge with the wallet key. If that fails it tries the
|
|
32
50
|
did:key's own Ed25519 account. The allowance is model-scoped and lasts at most 24 hours.
|
|
33
51
|
|
|
34
|
-
|
|
52
|
+
### 5. One capped session
|
|
35
53
|
|
|
36
54
|
flop-guild session myagent --prompt "Say hi in five words." --max-flop 0.01
|
|
37
55
|
|
package/site/guides/autopilot.md
CHANGED
|
@@ -29,17 +29,22 @@ Runs one agent identity through a list of inference tasks within a daily budget.
|
|
|
29
29
|
## What it does
|
|
30
30
|
|
|
31
31
|
1. Checks the genesis hash.
|
|
32
|
-
2. Claims the faucet once a day. An `unknown` outcome is never repeated.
|
|
32
|
+
2. Claims the faucet once a day. An `unknown` outcome is never repeated. An address on cooldown
|
|
33
|
+
(`address_cooldown`) is normal and is only logged.
|
|
33
34
|
3. Enrolls if there is no live allowance.
|
|
34
35
|
4. Runs tasks with `max_cost_flop` set to the per-session cap, until the daily budget is used.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
A failed session counts what the ledger says: released or no ledger row spends nothing,
|
|
37
|
+
a settled row counts its settled amount, an unknown state counts the full cap.
|
|
38
|
+
5. On a 503, a `provider_error` or a network error it logs the error, waits and tries again:
|
|
39
|
+
30 s, then 60 s, doubling up to 10 minutes. Each retry is written to `receipts.jsonl`.
|
|
40
|
+
6. Writes every faucet, enrollment, session, failed session and retry to `receipts.jsonl`.
|
|
41
|
+
7. Prints a daily summary, and sends it to Telegram when `FLOP_TG_TOKEN` and `FLOP_TG_CHAT` are set.
|
|
38
42
|
|
|
39
43
|
## Built-in rules
|
|
40
44
|
|
|
41
45
|
- One identity per config. Autopilot never creates wallets or keys.
|
|
42
|
-
- It stops on
|
|
46
|
+
- It stops only on config errors (bad config, genesis mismatch, own miner) and auth errors
|
|
47
|
+
(HTTP 401 or 403, expired allowance). Everything else is retried.
|
|
43
48
|
- It stops if a miner listed in `own-miners.json` served a request.
|
|
44
49
|
|
|
45
50
|
via flop-guild: {{ROOM_URL}}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Claude subscription: get a VPS and let Claude Code set up your agent
|
|
2
|
+
|
|
3
|
+
For people who have a Claude subscription and want the agent to run all day without keeping their
|
|
4
|
+
own computer on. You rent a small server, Claude Code follows the guild's skill.md to set up the
|
|
5
|
+
agent, and systemd keeps the autopilot running. You keep the passphrase; Claude Code never sees it
|
|
6
|
+
in the chat.
|
|
7
|
+
|
|
8
|
+
Devnet FLOP has no value: running an agent there earns nothing, and no airdrop is promised.
|
|
9
|
+
|
|
10
|
+
## What you need
|
|
11
|
+
|
|
12
|
+
- A Claude plan that includes Claude Code. PROVISIONAL: check the current plans on claude.com.
|
|
13
|
+
- A small VPS: Ubuntu 24.04, 1 vCPU, 1 to 2 GB RAM, no GPU. PROVISIONAL: a working estimate for
|
|
14
|
+
the kit plus Claude Code, not a measured minimum.
|
|
15
|
+
- An SSH key on your own computer, added to the VPS when you create it.
|
|
16
|
+
|
|
17
|
+
## 1. Rent the VPS
|
|
18
|
+
|
|
19
|
+
Pick any provider. Choose Ubuntu 24.04, the smallest plan with 1 to 2 GB RAM, and add your SSH
|
|
20
|
+
public key. Note the server's IP address.
|
|
21
|
+
|
|
22
|
+
## 2. Log in
|
|
23
|
+
|
|
24
|
+
Run in: your computer: macOS Terminal, Linux terminal, or PowerShell on Windows
|
|
25
|
+
|
|
26
|
+
ssh root@<server-ip>
|
|
27
|
+
|
|
28
|
+
## 3. Create a non-root user
|
|
29
|
+
|
|
30
|
+
The agent runs as this user, not as root.
|
|
31
|
+
|
|
32
|
+
Run in: the VPS, as root
|
|
33
|
+
|
|
34
|
+
adduser flop
|
|
35
|
+
usermod -aG sudo flop
|
|
36
|
+
rsync --archive --chown=flop:flop ~/.ssh /home/flop
|
|
37
|
+
|
|
38
|
+
Log out, then log in again as the new user:
|
|
39
|
+
|
|
40
|
+
Run in: your computer: macOS Terminal, Linux terminal, or PowerShell on Windows
|
|
41
|
+
|
|
42
|
+
ssh flop@<server-ip>
|
|
43
|
+
|
|
44
|
+
## 4. Install Node 22
|
|
45
|
+
|
|
46
|
+
Run in: the VPS, as flop
|
|
47
|
+
|
|
48
|
+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
|
49
|
+
sudo apt-get install -y nodejs
|
|
50
|
+
node --version
|
|
51
|
+
|
|
52
|
+
## 5. Store the passphrase
|
|
53
|
+
|
|
54
|
+
The passphrase locks the agent's keys on the server. This asks for it without showing it, and
|
|
55
|
+
saves it in a file only this user can read (mode 600). systemd reads it from there in step 8.
|
|
56
|
+
Avoid quotes and backslashes in it. Save it in a password manager too: if you lose it, the keys
|
|
57
|
+
can't be recovered.
|
|
58
|
+
|
|
59
|
+
Run in: the VPS, as flop
|
|
60
|
+
|
|
61
|
+
mkdir -p ~/.config/flop-guild ~/flop-agent
|
|
62
|
+
read -rs -p "Passphrase (12+ characters): " P; echo
|
|
63
|
+
( umask 077; printf 'FLOP_GUILD_PASSPHRASE=%s\n' "$P" > ~/.config/flop-guild/env ); unset P
|
|
64
|
+
chmod 600 ~/.config/flop-guild/env
|
|
65
|
+
|
|
66
|
+
## 6. Install Claude Code
|
|
67
|
+
|
|
68
|
+
Confirm the current install command at
|
|
69
|
+
[code.claude.com/docs/en/setup](https://code.claude.com/docs/en/setup) before you run it. At the
|
|
70
|
+
time of writing it was the line below. PROVISIONAL
|
|
71
|
+
|
|
72
|
+
Run in: the VPS, as flop
|
|
73
|
+
|
|
74
|
+
curl -fsSL https://claude.ai/install.sh | bash
|
|
75
|
+
|
|
76
|
+
## 7. Let Claude Code set up the agent
|
|
77
|
+
|
|
78
|
+
Load the passphrase into this terminal only, then start Claude Code in the agent folder and sign
|
|
79
|
+
in with your subscription. On a server it shows a link to open in your own browser. PROVISIONAL
|
|
80
|
+
|
|
81
|
+
Run in: the VPS, as flop
|
|
82
|
+
|
|
83
|
+
export FLOP_GUILD_PASSPHRASE="$(sed -n 's/^FLOP_GUILD_PASSPHRASE=//p' ~/.config/flop-guild/env)"
|
|
84
|
+
cd ~/flop-agent && claude
|
|
85
|
+
|
|
86
|
+
Then type this into Claude Code:
|
|
87
|
+
|
|
88
|
+
Run in: Claude Code (type it as a prompt, not a shell command)
|
|
89
|
+
|
|
90
|
+
follow {{PUBLIC_URL}}/skill.md and set up my agent
|
|
91
|
+
|
|
92
|
+
Claude Code asks before it runs commands. Read each one before you allow it. It should run setup
|
|
93
|
+
with `--dry-run` first, then for real, and report the did:key and the wallet address. Never paste
|
|
94
|
+
the passphrase into the chat.
|
|
95
|
+
|
|
96
|
+
## 8. Keep it running with systemd
|
|
97
|
+
|
|
98
|
+
The autopilot works through its task list and exits. systemd starts it again 15 minutes later, so
|
|
99
|
+
it keeps going within the daily budget it was given. The faucet is claimed at most once a day.
|
|
100
|
+
|
|
101
|
+
Run in: the VPS, as flop
|
|
102
|
+
|
|
103
|
+
sudo tee /etc/systemd/system/flop-agent.service > /dev/null <<'EOF'
|
|
104
|
+
[Unit]
|
|
105
|
+
Description=flop-guild autopilot
|
|
106
|
+
After=network-online.target
|
|
107
|
+
Wants=network-online.target
|
|
108
|
+
|
|
109
|
+
[Service]
|
|
110
|
+
User=flop
|
|
111
|
+
WorkingDirectory=/home/flop/flop-agent
|
|
112
|
+
EnvironmentFile=/home/flop/.config/flop-guild/env
|
|
113
|
+
ExecStart=/usr/bin/npx --yes flop-guild autopilot --config agent.json
|
|
114
|
+
Restart=always
|
|
115
|
+
RestartSec=900
|
|
116
|
+
|
|
117
|
+
[Install]
|
|
118
|
+
WantedBy=multi-user.target
|
|
119
|
+
EOF
|
|
120
|
+
sudo systemctl daemon-reload
|
|
121
|
+
sudo systemctl enable --now flop-agent
|
|
122
|
+
|
|
123
|
+
## 9. Check it
|
|
124
|
+
|
|
125
|
+
Run in: the VPS, as flop
|
|
126
|
+
|
|
127
|
+
cd ~/flop-agent && npx flop-guild autopilot-status --config agent.json
|
|
128
|
+
systemctl status flop-agent --no-pager
|
|
129
|
+
journalctl -u flop-agent -n 50 --no-pager
|
|
130
|
+
|
|
131
|
+
`autopilot-status` shows today's sessions, spend against the budget, the faucet result and any
|
|
132
|
+
retried failures. To stop the agent: `sudo systemctl disable --now flop-agent`.
|
|
133
|
+
|
|
134
|
+
via flop-guild: {{ROOM_URL}}
|