Repository navigation
Expand file tree
/
Copy pathmodules.html
More file actions
288 lines (258 loc) · 13.7 KB
/
Copy pathmodules.html
File metadata and controls
288 lines (258 loc) · 13.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
---
layout: page
title: Modules
permalink: /modules
---
{% capture suit_tip %}<b>chatbot</b>: a conversational model.<br><b>agentic</b>: a tool-calling agent with domain-specific tools (e.g. an HR system).<br><b>assistant</b>: a general-purpose tool-calling agent with computer and execution access.{% endcapture %}
{% capture prov_tip %}<b>Author provided</b>: contributed by the original authors of the work.<br><b>Community port</b>: a re-implementation of published work, by us or the community.{% endcapture %}
{%- comment -%}
One flat catalogue rendered as tiles. Each list (optimizers / targets /
security_claims) becomes a `type`, and every tile carries data-* attributes so
the sidebar (search + type + suit + source) can filter it entirely client-side.
Clicking a tile opens a modal with the install command, then the module's own
guide (its README in superred-modules) as the dominant next step, then the
paper and, for benchmarks, the HuggingFace dataset as background links.
{%- endcomment -%}
{% assign attacker_n = site.data.modules.optimizers | size %}
{% assign target_n = site.data.modules.targets | size %}
{% assign claim_n = site.data.modules.security_claims | size %}
{% assign total_n = attacker_n | plus: target_n | plus: claim_n %}
<section class="section modules">
<div class="section-body mod-layout">
<!-- ---------------------------------------------------------------- -->
<!-- Sidebar: search + type + suit + source -->
<!-- ---------------------------------------------------------------- -->
<aside class="mod-sidebar" aria-label="Filter modules">
<div class="mod-search">
<svg class="mod-search-icon" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true">
<circle cx="9" cy="9" r="6"></circle><line x1="14" y1="14" x2="18" y2="18" stroke-linecap="round"></line>
</svg>
<input type="search" id="mod-q" placeholder="Search modules…" autocomplete="off" aria-label="Search modules by name or description">
</div>
<nav class="mod-facet" aria-label="Module type">
<p class="mod-facet-h">Type</p>
<button type="button" class="mod-type is-active" data-type=""><span>All</span><span class="mod-count">{{ total_n }}</span></button>
<button type="button" class="mod-type" data-type="attacker"><span>Attackers</span><span class="mod-count">{{ attacker_n }}</span></button>
<button type="button" class="mod-type" data-type="target"><span>Targets</span><span class="mod-count">{{ target_n }}</span></button>
<button type="button" class="mod-type" data-type="claim"><span>Benchmarks</span><span class="mod-count">{{ claim_n }}</span></button>
</nav>
<fieldset class="mod-facet">
<legend class="mod-facet-h">Suit</legend>
<label class="mod-check"><input type="checkbox" class="f-suit" value="chatbot"><span class="mod-suit mod-suit-chatbot">chatbot</span></label>
<label class="mod-check"><input type="checkbox" class="f-suit" value="agentic"><span class="mod-suit mod-suit-agentic">agentic</span></label>
<label class="mod-check"><input type="checkbox" class="f-suit" value="assistant"><span class="mod-suit mod-suit-assistant">assistant</span></label>
</fieldset>
<fieldset class="mod-facet">
<legend class="mod-facet-h">Source</legend>
<label class="mod-check"><input type="checkbox" class="f-prov" value="first"><span class="mod-tag mod-tag-first">Author provided</span></label>
<label class="mod-check"><input type="checkbox" class="f-prov" value="port"><span class="mod-tag mod-tag-port">Community port</span></label>
</fieldset>
<button type="button" id="mod-reset" class="mod-reset" hidden>Reset filters</button>
</aside>
<!-- ---------------------------------------------------------------- -->
<!-- Tile grid: all three lists flattened into one grid -->
<!-- ---------------------------------------------------------------- -->
<div class="mod-main">
<p class="mod-resultbar"><span id="mod-shown">{{ total_n }}</span> of {{ total_n }} modules</p>
<div class="mod-cards" id="mod-cards">
{%- assign groups = "attacker,target,claim" | split: "," -%}
{%- for g in groups -%}
{%- case g -%}
{%- when "attacker" -%}{% assign list = site.data.modules.optimizers %}{% assign kind = "optimizer" %}
{%- when "target" -%}{% assign list = site.data.modules.targets %}{% assign kind = "target" %}
{%- when "claim" -%}{% assign list = site.data.modules.security_claims %}{% assign kind = "security claim" %}
{%- endcase -%}
{%- for m in list -%}
{%- assign primary = m.suit | first -%}
<button type="button" class="mod-card"
data-type="{{ g }}"
data-kind="{{ kind }}"
data-name="{{ m.name | escape }}"
data-pip="{{ m.pip }}"
data-repo="{{ m.repo }}"
data-pending="{% if m.pending %}true{% endif %}"
data-suit="{{ m.suit | join: ' ' }}"
data-prov="{% if m.first_party %}first{% else %}port{% endif %}"
data-blurb="{{ m.blurb | escape }}"
data-paper="{{ m.paper }}"
data-hf="{{ m.hf }}"
data-search="{{ m.name | downcase }} {{ m.blurb | downcase }} {{ m.pip }}">
<div class="mod-card-name">{{ m.name }}</div>
<div class="mod-card-blurb">{{ m.blurb }}</div>
<div class="mod-card-tags">
{%- for s in m.suit -%}<span class="mod-suit mod-suit-{{ s }}">{{ s }}</span>{%- endfor -%}
{%- if m.first_party -%}<span class="mod-tag mod-tag-first">Author provided</span>
{%- else -%}<span class="mod-tag mod-tag-port">Community port</span>{%- endif -%}
</div>
</button>
{%- endfor -%}
{%- endfor -%}
</div>
<div class="mod-empty" id="mod-empty" hidden>
<p>No modules match these filters.</p>
<button type="button" class="mod-reset" data-clear>Clear filters</button>
</div>
</div>
</div>
</section>
<!-- ------------------------------------------------------------------ -->
<!-- Modal: how to install / import / use the selected module -->
<!-- ------------------------------------------------------------------ -->
<div class="mod-modal" id="mod-modal" hidden>
<div class="mod-modal-backdrop" data-close></div>
<div class="mod-modal-panel" role="dialog" aria-modal="true" aria-labelledby="mod-modal-title">
<button type="button" class="mod-modal-x" data-close aria-label="Close">
<svg viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="5" y1="5" x2="15" y2="15"/><line x1="15" y1="5" x2="5" y2="15"/></svg>
</button>
<div class="mod-modal-head">
<div>
<p class="mod-modal-kind" id="mod-modal-kind"></p>
<h3 class="mod-modal-title" id="mod-modal-title"></h3>
</div>
</div>
<p class="mod-modal-blurb" id="mod-modal-blurb"></p>
<div class="mod-modal-body" id="mod-modal-body"><!-- filled by JS --></div>
<div class="mod-modal-cta" id="mod-modal-cta"><!-- filled by JS --></div>
<div class="mod-modal-links" id="mod-modal-links"><!-- filled by JS --></div>
</div>
</div>
<script>
(function () {
var cards = Array.prototype.slice.call(document.querySelectorAll(".mod-card"));
var q = document.getElementById("mod-q");
var typeBtns = Array.prototype.slice.call(document.querySelectorAll(".mod-type"));
var suitBoxes = Array.prototype.slice.call(document.querySelectorAll(".f-suit"));
var provBoxes = Array.prototype.slice.call(document.querySelectorAll(".f-prov"));
var shown = document.getElementById("mod-shown");
var empty = document.getElementById("mod-empty");
var resetBtn = document.getElementById("mod-reset");
/* ---------------------------- filtering ---------------------------- */
var state = { type: "", suit: [], prov: [], q: "" };
function anyActive() { return state.type || state.suit.length || state.prov.length || state.q; }
function apply() {
var n = 0;
var needle = state.q.trim().toLowerCase();
cards.forEach(function (card) {
var suits = card.dataset.suit.split(" ");
var ok =
(!state.type || card.dataset.type === state.type) &&
(!state.suit.length || state.suit.some(function (s) { return suits.indexOf(s) >= 0; })) &&
(!state.prov.length || state.prov.indexOf(card.dataset.prov) >= 0) &&
(!needle || card.dataset.search.indexOf(needle) >= 0);
card.hidden = !ok;
if (ok) n++;
});
shown.textContent = n;
empty.hidden = n > 0;
resetBtn.hidden = !anyActive();
}
q.addEventListener("input", function () { state.q = q.value; apply(); });
typeBtns.forEach(function (btn) {
btn.addEventListener("click", function () {
state.type = btn.dataset.type;
typeBtns.forEach(function (b) { b.classList.toggle("is-active", b === btn); });
apply();
});
});
function bindGroup(boxes, key) {
boxes.forEach(function (box) {
box.addEventListener("change", function () {
state[key] = boxes.filter(function (b) { return b.checked; }).map(function (b) { return b.value; });
apply();
});
});
}
bindGroup(suitBoxes, "suit");
bindGroup(provBoxes, "prov");
function reset() {
state = { type: "", suit: [], prov: [], q: "" };
q.value = "";
suitBoxes.concat(provBoxes).forEach(function (b) { b.checked = false; });
typeBtns.forEach(function (b) { b.classList.toggle("is-active", b.dataset.type === ""); });
apply();
}
document.querySelectorAll("[data-clear], #mod-reset").forEach(function (b) { b.addEventListener("click", reset); });
apply();
/* ------------------------------ modal ------------------------------ */
var modal = document.getElementById("mod-modal");
var mKind = document.getElementById("mod-modal-kind");
var mTitle = document.getElementById("mod-modal-title");
var mBlurb = document.getElementById("mod-modal-blurb");
var mBody = document.getElementById("mod-modal-body");
var mCta = document.getElementById("mod-modal-cta");
var mLinks = document.getElementById("mod-modal-links");
var lastFocus = null;
var REPO = "https://github.com/RoldSI/superred-modules";
function esc(s) {
return String(s).replace(/[&<>]/g, function (c) {
return { "&": "&", "<": "<", ">": ">" }[c];
});
}
function codeBlock(label, code) {
return '<div class="mod-code">' +
'<div class="mod-code-head"><span>' + esc(label) + '</span>' +
'<button type="button" class="mod-copy" data-code="' + esc(code) + '">Copy</button></div>' +
'<pre><code>' + esc(code) + '</code></pre>' +
'</div>';
}
function open(card) {
var d = card.dataset;
mKind.textContent = d.kind;
mTitle.textContent = d.name;
mBlurb.textContent = d.blurb;
// Published modules show their install command; the rest say so plainly.
var pending = d.pending === "true";
mBody.innerHTML = d.pip
? codeBlock("Install", "pip install " + d.pip)
: '<p class="mod-note">Pending publishing.</p>';
// The module's own guide is the next step after installing, so it gets a
// block of its own. A module still pending publishing has no README yet, so
// the same button points at its folder until one lands. A module living in
// its own separate repository (not a superred-modules subfolder) carries a
// full URL in `repo` already, and is linked to directly.
var guide = /^https?:\/\//.test(d.repo)
? d.repo
: pending
? REPO + "/tree/main/" + d.repo
: REPO + "/blob/main/" + d.repo + "/README.md";
mCta.innerHTML =
'<a class="mod-guide" href="' + guide + '" target="_blank" rel="noopener noreferrer">' +
'<span class="mod-guide-text">' +
'<span class="mod-guide-label">Guide</span>' +
'<span class="mod-guide-sub">Get started with ' + esc(d.name) + '</span>' +
'</span>' +
'<span class="mod-guide-arrow" aria-hidden="true">↗</span>' +
'</a>';
// The paper and dataset are background reading, so they stay quiet.
var links = "";
if (d.paper) links += '<a class="mod-link" href="' + d.paper + '" target="_blank" rel="noopener noreferrer">Paper ↗</a>';
if (d.hf) links += '<a class="mod-link" href="' + d.hf + '" target="_blank" rel="noopener noreferrer">HuggingFace ↗</a>';
mLinks.innerHTML = links;
mLinks.hidden = !links; // no stray divider when there are none
lastFocus = document.activeElement;
modal.hidden = false;
document.body.classList.add("mod-modal-lock");
modal.querySelector(".mod-modal-x").focus();
}
function close() {
modal.hidden = true;
document.body.classList.remove("mod-modal-lock");
if (lastFocus) lastFocus.focus();
}
cards.forEach(function (card) { card.addEventListener("click", function () { open(card); }); });
modal.querySelectorAll("[data-close]").forEach(function (el) { el.addEventListener("click", close); });
document.addEventListener("keydown", function (e) { if (e.key === "Escape" && !modal.hidden) close(); });
// Copy buttons inside the modal (delegated).
mBody.addEventListener("click", function (e) {
var btn = e.target.closest(".mod-copy");
if (!btn) return;
var code = btn.dataset.code;
if (navigator.clipboard) {
navigator.clipboard.writeText(code).then(function () {
var t = btn.textContent; btn.textContent = "Copied"; btn.classList.add("is-copied");
setTimeout(function () { btn.textContent = t; btn.classList.remove("is-copied"); }, 1400);
});
}
});
})();
</script>