Files
splinter/tools/gen_www.py
T
Konrad 2e776611f3 splinter: the kid mode section exists in all three languages
It was only on the Portuguese page, which is exactly the drift the generator is
supposed to prevent and does not: check compares languages, not section counts.
2026-11-08 16:03:29 +00:00

600 lines
31 KiB
Python

#!/usr/bin/env python3
"""Generate the splinter pages from one source, in every language.
Same rule as the program's own catalogues: a text that exists in one language
and not the other is an error, not a gap. The generator refuses to write a page
when a key is missing, so index.html and index.en.html can never drift apart.
python3 tools/gen_www.py # write the pages
python3 tools/gen_www.py --check # compare, exit 1 if they are stale
"""
import pathlib
import sys
ROOT = pathlib.Path(__file__).resolve().parent.parent
OUT = ROOT / "src" / "www"
LANGS = ["de", "en", "pt_BR"]
FILES = {"de": "index.html", "en": "index.en.html",
"pt_BR": "index.pt.html"}
HEAD = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{lang}}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{{title}}</title>
<meta name="description" content="{{desc}}">
<style type="text/css">
body { background: #0d0f12; color: #c8ccd2; margin: 0; padding: 0;
font-family: "DejaVu Sans Mono", "Courier New", monospace;
font-size: 14px; line-height: 1.55; }
#wrap { width: 46em; margin: 0 auto; padding: 3em 1.5em 6em 1.5em; }
h1 { font-size: 2.4em; color: #e8ecf1; margin: 0 0 0.2em 0; letter-spacing: -0.02em; }
h1 span { color: #5f9ea0; }
h2 { font-size: 1em; color: #5f9ea0; margin: 2.6em 0 0.7em 0; font-weight: normal;
border-bottom: 1px solid #22262c; padding-bottom: 0.3em;
text-transform: uppercase; letter-spacing: 0.08em; }
p { margin: 0.8em 0; }
a { color: #7fb3b5; text-decoration: none; border-bottom: 1px dotted #3d5a5c; }
a:hover { color: #a8d8da; }
.lead { font-size: 1.15em; color: #e2e6ea; }
.meta { color: #6b727c; font-size: 0.92em; margin-bottom: 2.5em; }
.meta b { color: #9aa2ad; font-weight: normal; }
pre { background: #07090b; border: 1px solid #1d2126; border-left: 2px solid #2f4a4c;
padding: 1em 1.1em; overflow-x: auto; font-size: 0.88em; line-height: 1.45;
color: #b9c0c8; margin: 1.2em 0; }
pre .u { color: #e8ecf1; }
pre .k { color: #5f9ea0; }
pre .d { color: #6b727c; }
table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 0.9em; }
th { text-align: left; color: #7d848e; font-weight: normal; padding: 0.35em 0.6em;
border-bottom: 1px solid #22262c; text-transform: uppercase; font-size: 0.85em;
letter-spacing: 0.06em; }
td { padding: 0.35em 0.6em; border-bottom: 1px solid #14181c; vertical-align: top; }
td.c { color: #5f9ea0; white-space: nowrap; }
td.m { color: #c98b6b; white-space: nowrap; }
td.x { color: #b06f6f; white-space: nowrap; }
.box { border: 1px solid #1d2126; padding: 0.9em 1em; margin: 1em 0; background: #0a0c0f; }
.box h3 { margin: 0 0 0.3em 0; font-size: 0.95em; color: #e2e6ea; font-weight: normal; }
ul { margin: 0.6em 0 0.6em 1.2em; padding: 0; }
li { margin: 0.25em 0; }
.small { font-size: 0.88em; color: #7d848e; }
hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
#foot { color: #5a616b; font-size: 0.88em; }
#lang { color: #5a616b; font-size: 0.88em; margin: 0 0 2em 0; }
</style>
</head>
<body>
<div id="wrap">
<p id="lang">{{langbar}}</p>
<h1>splinter<span>_</span></h1>
<p class="lead">{{lead}}</p>
<p class="meta"><b>9.125</b> {{m_lines}} &middot;
<b>248.568</b> {{m_binary}} &middot; <b>21</b> {{m_tests}} &middot;
<b>8</b> {{m_plugins}} &middot; <b>42</b> {{m_themes}} &middot; BSD-3-Clause</p>
{{body}}
<hr>
<p id="foot">{{foot}}</p>
</div>
</body>
</html>
"""
LOOK = """<h2>{h}</h2>
<pre><span class="u">you:</span> Aendere in /tmp/x.c die Zeile 'return 0' in 'return 1'.
<span class="k">thinking:</span> I must read the file, then replace exactly one place.
An ambiguous pattern would be a wrong edit.
<span class="k">tool:</span> edit {{"path":"/tmp/x.c","old":"return 0","new":"return 1"}}
<span class="k">diff:</span> --- a//tmp/x.c
+++ b//tmp/x.c
@@ -11,3 +11,3 @@
int main(void) {{
- return 0;
+ return 1;
}}
<span class="k">model:</span> Done. Line 12 returns 1 now.
<span class="d"> splinter 0.1.0 session sess-1794... Delphinium 842 ms</span></pre>
<p>{p}</p>
"""
TOOLS = """<h2>{h}</h2>
<table>
<tr><th>{t_tool}</th><th>{t_class}</th><th>{t_does}</th></tr>
<tr><td class="c">read</td><td>read</td><td>{d_read}</td></tr>
<tr><td class="c">search</td><td>read</td><td>{d_search}</td></tr>
<tr><td class="c">list</td><td>read</td><td>{d_list}</td></tr>
<tr><td class="c">skill_search</td><td>read</td><td>{d_ss}</td></tr>
<tr><td class="c">skill_load</td><td>read</td><td>{d_sl}</td></tr>
<tr><td class="c">memory_search</td><td>read</td><td>{d_ms}</td></tr>
<tr><td class="c">write</td><td class="m">mutate</td><td>{d_write}</td></tr>
<tr><td class="c">edit</td><td class="m">mutate</td><td>{d_edit}</td></tr>
<tr><td class="c">memory_add</td><td class="m">mutate</td><td>{d_ma}</td></tr>
<tr><td class="c">run</td><td class="x">destructive</td><td>{d_run}</td></tr>
<tr><td class="c">delegate</td><td class="x">destructive</td><td>{d_del}</td></tr>
</table>
"""
TRANSPORTS = """<h2>{h}</h2>
<table>
<tr><th>{t_name}</th><th>{t_does}</th></tr>
<tr><td class="c">openai</td><td>{d_openai}</td></tr>
<tr><td class="c">cli</td><td>{d_cli}</td></tr>
<tr><td class="c">ring</td><td>{d_ring}</td></tr>
<tr><td class="c">mcp</td><td>{d_mcp}</td></tr>
<tr><td class="c">lcm</td><td>{d_lcm}</td></tr>
<tr><td class="c">focus</td><td>{d_focus}</td></tr>
<tr><td class="c">reminder</td><td>{d_rem}</td></tr>
<tr><td class="c">cps, clock</td><td>{d_widget}</td></tr>
</table>
"""
DELEGATE = """<h2>{h}</h2>
<pre><span class="d"># ~/.splinter/splinter.conf.d/20-delegates.conf</span>
delegate = coder | C99, POSIX, Review | tags=code,c99,review | endpoint=... | model=...
delegate = quick | short answers, chat | tags=chat,cheap | endpoint=... | model=...
<span class="u">$</span> splinter --choose "pruefe diesen C-Code auf Speicherfehler"
coder 7 task mentions 'code'</pre>
<p>{p}</p>
"""
CONFIG = """<h2>{h}</h2>
<p>{p}</p>
<pre><span class="d"># ~/.splinter/splinter.conf</span>
endpoint = http://kontron.local:8080/v1/chat/completions
model = Qwen3.6-35B-A3B-UD-Q8_K_XL.gguf
locale = de
theme = Delphinium
autonomous = 1
telegram_allow = 8300935
plugin = plugins/lcm/lcm.so
plugin = plugins/reminder/reminder.so</pre>
"""
BUILD = """<h2>{h}</h2>
<pre><span class="u">$</span> git clone ssh://host/home/git/splinter.git
<span class="u">$</span> cd splinter &amp;&amp; make <span class="d">{c_make}</span>
<span class="u">$</span> make check <span class="d">{c_check}</span>
<span class="u">$</span> ./splinter <span class="d">{c_chat}</span>
<span class="u">$</span> ./splinter --daemon <span class="d">{c_gw}</span></pre>
<p>{p}</p>
"""
T = {
"de": {
"title": "splinter — ein Agent-Harness, das dir gehoert",
"desc": "splinter ist ein Agent-Harness in C99/POSIX: Chat im Terminal, Werkzeuge mit Autorisierungsklassen, Plugins, jeder OpenAI-kompatible Endpunkt, Telegram-Gateway.",
"langbar": "Deutsch &middot; <a href=\"index.en.html\">English</a> &middot; <a href=\"index.pt.html\">Portugues (BR)</a>",
"lead": "Ein Agent-Harness, das dir gehoert: Chat im Terminal, Werkzeuge mit "
"Autorisierungsklassen, Plugins, jedes Modell das OpenAI spricht — von uns "
"gebaut, damit wir es umbauen koennen, statt uns an das Verhalten eines "
"fremden Clients zu gewoehnen.",
"m_lines": "Zeilen C99/POSIX", "m_binary": "Bytes Binary",
"m_tests": "Test-Programme", "m_plugins": "Plugins", "m_themes": "Farbschemata",
"foot": "splinter — C99/POSIX, BSD-3-Clause. Manual: <code>man ./docs/splinter.1</code>"
" &middot; Plugin-ABI: <code>docs/PLUGINS.md</code> &middot; Wir nehmen "
"auseinander, bauen nach und behalten. Ihre Systeme: in Ruhe lassen, wenn "
"nicht gefragt.",
},
"en": {
"title": "splinter — an agent harness you own",
"desc": "splinter is a C99/POSIX agent harness: chat in the terminal, tools with "
"authorization classes, plugins, any OpenAI-compatible endpoint, a Telegram gateway.",
"langbar": "<a href=\"index.html\">Deutsch</a> &middot; English",
"lead": "An agent harness you own: chat in the terminal, tools with authorization "
"classes, plugins, any model that speaks OpenAI — built by us so we can change "
"it, instead of getting used to how somebody else's client behaves.",
"m_lines": "lines of C99/POSIX", "m_binary": "bytes binary",
"m_tests": "test programs", "m_plugins": "plugins", "m_themes": "palettes",
"foot": "splinter — C99/POSIX, BSD-3-Clause. Manual: <code>man ./docs/splinter.1</code>"
" &middot; Plugin ABI: <code>docs/PLUGINS.md</code> &middot; We take things "
"apart, rebuild them and keep them. Their systems: leave them alone unless asked.",
},
}
T["pt_BR"] = {
"title": "splinter - um harness de agente que e seu",
"desc": "splinter e um harness de agente em C99/POSIX: chat no terminal, ferramentas com classes de autorizacao, plugins, qualquer endpoint compativel com OpenAI, gateway Telegram.",
"langbar": "<a href=\"index.html\">Deutsch</a> &middot; <a href=\"index.en.html\">English</a> &middot; Portugues (BR)",
"lead": "Um harness de agente que e seu: chat no terminal, ferramentas com "
"classes de autorizacao, plugins, qualquer modelo que fale OpenAI - "
"escrito por nos para poder mudar-lo, em vez de nos acostumar com o "
"comportamento de um cliente alheio.",
"m_lines": "linhas C99/POSIX", "m_binary": "bytes do binario",
"m_tests": "programas de teste", "m_plugins": "plugins", "m_themes": "paletas",
"foot": "splinter - C99/POSIX, BSD-3-Clause. Manual: <code>man ./docs/splinter.1</code>"
" &middot; ABI de plugins: <code>docs/PLUGINS.md</code>",
}
SECTIONS = {
"de": [
("<h2>Was es ist</h2>\n<p>Dasselbe, was Claude Code oder opencode fuer dich sind: ein "
"Programm, in dem du mit einem Modell redest und das die Werkzeuge ausfuehrt, um die "
"es bittet. Der Unterschied ist der Quelltext. Wenn dich etwas stoert — das Layout, "
"die Tasten, die Frage nach Bestaetigung, der Transport — aenderst du es hier, statt "
"darauf zu warten.</p>\n<p>splinter ist die Schicht dazwischen: was gesendet wird, ob "
"ein Werkzeug laufen darf, was davon aufgezeichnet wird und was du auf dem Schirm "
"siehst.</p>"),
(LOOK.format(h="So sieht das aus",
p="Denken, Werkzeugaufruf mit Argumenten, Diff, Antwort. Der Denk-Block waechst "
"waehrend des Laufs dort, wo er hingehoert, und springt am Ende nicht weg.")),
("<h2>Drei Pruefungen, bevor ein Werkzeug laeuft</h2>\n"
"<div class=\"box\"><h3>1 &middot; Budget</h3><p class=\"small\">Passt die "
"Konversation noch? Wenn nicht, wird vor dem Senden komprimiert — nicht danach, und "
"nicht heimlich waehrend des Laufs.</p></div>\n"
"<div class=\"box\"><h3>2 &middot; Registry</h3><p class=\"small\">Existiert das "
"Werkzeug? Ein erfundener Name wird zu einer Beobachtung, nicht zu einem "
"Absturz.</p></div>\n"
"<div class=\"box\"><h3>3 &middot; Autorisierungsklasse</h3><p class=\"small\">Das "
"<em>Werkzeug</em> erklaert, was es darf — <b>read</b>, <b>mutate</b>, "
"<b>destructive</b>. Nicht das Modell, nicht der Prompt. Bei mutate und destructive "
"fragt dich das Harness — im Chat in der Eingabezeile, auf Telegram als Nachricht mit "
"y/N.</p></div>"),
(TOOLS.format(h="Werkzeuge", t_tool="Werkzeug", t_class="Klasse", t_does="Was es tut",
d_read="numerierte Zeilen, offset/limit, verweigert Binaerdateien",
d_search="Literal-Suche im Baum, maximal 100 Treffer",
d_list="Verzeichnis anzeigen",
d_ss="installierte Skills finden — nichts wird vorgeladen",
d_sl="einen Skill ganz lesen",
d_ms="eigene Erinnerungen, pro Benutzer getrennt",
d_write="Datei schreiben, mit Diff in der Beobachtung",
d_edit="genau ein Vorkommen ersetzen; mehrdeutig ist ein Fehler",
d_ma="einen Fakt merken",
d_run="Shell-Befehl; der Exit-Status ist eine Beobachtung",
d_del="Aufgabe an ein anderes Modell geben")),
(TRANSPORTS.format(h="Transporte und Plugins", t_name="Name", t_does="Was es tut",
d_openai="jeder OpenAI-kompatible Endpunkt, Streaming ueber SSE",
d_cli="jedes Programm als Modell, etwa <code>claude -p</code>",
d_ring="Exit-Ring: 429 oder Limit &rarr; naechster Ausgang",
d_mcp="MCP-Server als Werkzeugquelle, mit den Schemata des Servers",
d_lcm="Komprimierung der Konversation",
d_focus="erinnert alle N Turns an das Ziel (<code>/goal</code>)",
d_rem="legt alle 10 Turns die Grundregeln zurueck in die Konversation",
d_widget="Widgets in der Seitenleiste")),
(DELEGATE.format(h="Delegation: andere Modelle, splinter waehlt",
p="Angefragter Tag zaehlt 5, Tag im Aufgabentext 3, Wort aus der Beschreibung 1. Die "
"Beobachtung beginnt mit der Wahl und dem Grund — eine falsche Wahl ist sichtbar "
"statt mysterioes. Ohne Profile: eine Zeile pro Modell.")),
(CONFIG.format(h="Konfiguration",
p="<code>~/.splinter/splinter.conf</code>, plus jede <code>.conf</code> in "
"<code>~/.splinter/splinter.conf.d/</code> in Namensreihenfolge. Ein unbekannter "
"Schluessel ist ein Fehler mit Dateiname und Zeile — ein Tippfehler darf nicht "
"still nichts tun.")),
("<h2>Gateway: Telegram</h2>\n<p><code>splinter --daemon</code> pollt "
"<code>getUpdates</code>, ein Turn pro Nachricht, Antwort per "
"<code>sendMessage</code>. Der Token liegt in "
"<code>~/.splinter/telegram.token</code> mit Modus 0600 und wird nie als Argument "
"uebergeben — Argumente stehen in <code>ps</code>. Waehrend eines Turns sieht der "
"Chat alle vier Sekunden &bdquo;typing&ldquo;.</p>\n<p>Slash-Kommandos funktionieren "
"dort genauso. Programme in <code>~/.splinter/commands/</code> werden zu "
"<code>/name</code>: sie bekommen den Rest der Zeile als Argument, und ihre Ausgabe "
"geht <em>ans Modell</em> als Kontext — nicht an dich als Antwort. Damit holt sich "
"das Modell, was es selbst nicht sehen kann.</p>"),
("<h2>Was mitgeschrieben wird</h2>\n"
"<pre><span class=\"d\">~/.splinter/logs/&lt;sitzung&gt;/session.log</span> lesbar, "
"in Reihenfolge, alles\n<span class=\"d\">~/.splinter/logs/&lt;sitzung&gt;/wire.jsonl"
"</span> jeder Request-Body, jede Antwort, roh</pre>\n"
"<p>Deine Worte, die Antwort, das Denken, jeder Werkzeugaufruf mit Argumenten, jede "
"Beobachtung, Fehler, Token-Zahlen. Nichts gekuerzt — ein Log, das nur das Gute "
"behaelt, kann einen schlechten Turn nicht erklaeren.</p>"),
(BUILD.format(h="Bauen", c_make="248 KB, nichts ausser libc und curses",
c_check="21 Test-Programme, plus i18n-Pruefer",
c_chat="Chat, Konfiguration wird gelesen", c_gw="Telegram-Gateway",
p="POSIX make, C99, <code>-Wall -Wextra -Werror</code>. Die NetBSD-curses liegt im "
"Baum, damit das Binary nicht von der Laune einer Distribution abhaengt.")),
("<h2>Was es nicht ist</h2>\n<ul>\n<li>Kein Modell. splinter bringt keins mit und "
"waehlt keins fuer dich.</li>\n<li>Keine Cloud. Es spricht mit dem Endpunkt, den du "
"eintraegst.</li>\n<li>Kein Sandkasten. Plugins laufen im Prozess mit deinen Rechten "
"— die Klassen schuetzen vor dem Modell, nicht vor Code, den du selbst "
"laedst.</li>\n</ul>"),
],
"en": [
("<h2>What it is</h2>\n<p>The same thing Claude Code or opencode is for you: a "
"program you sit in front of, talking to a model, running the tools it asks for. The "
"difference is the source. If something bothers you — the layout, the keys, the "
"confirmation prompts, the transport — you change it here instead of waiting for "
"someone else to.</p>\n<p>splinter is the layer in between: what gets sent, whether a "
"tool may run, what is written down, and what you see on screen.</p>"),
(LOOK.format(h="What that looks like",
p="Reasoning, the tool call with its arguments, the diff, the answer. The reasoning "
"block grows where it belongs while the turn runs, and does not jump away when it "
"ends.")),
("<h2>Three checks before any tool runs</h2>\n"
"<div class=\"box\"><h3>1 &middot; Budget</h3><p class=\"small\">Does the conversation "
"still fit? If not, it is compacted before sending — not after, and not quietly in the "
"middle of a turn.</p></div>\n"
"<div class=\"box\"><h3>2 &middot; Registry</h3><p class=\"small\">Does the tool "
"exist? An invented name becomes an observation, not a crash.</p></div>\n"
"<div class=\"box\"><h3>3 &middot; Authorization class</h3><p class=\"small\">The "
"<em>tool</em> declares what it may do — <b>read</b>, <b>mutate</b>, "
"<b>destructive</b>. Not the model, not the prompt. For mutate and destructive the "
"harness asks you — in the prompt line in the chat, as a y/N message on "
"Telegram.</p></div>"),
(TOOLS.format(h="Tools", t_tool="Tool", t_class="Class", t_does="What it does",
d_read="numbered lines, offset/limit, refuses binary files",
d_search="literal search over a tree, at most 100 hits",
d_list="list a directory",
d_ss="find installed skills — nothing is preloaded",
d_sl="read one skill in full",
d_ms="your own memories, scoped per user",
d_write="write a file, with the diff in the observation",
d_edit="replace exactly one occurrence; ambiguous is an error",
d_ma="remember one fact",
d_run="a shell command; the exit status is an observation",
d_del="hand a task to another model")),
(TRANSPORTS.format(h="Transports and plugins", t_name="Name", t_does="What it does",
d_openai="any OpenAI-compatible endpoint, streaming over SSE",
d_cli="any program as the model, e.g. <code>claude -p</code>",
d_ring="exit ring: 429 or limit &rarr; next exit",
d_mcp="an MCP server as a tool source, with its own schemas",
d_lcm="compaction of the conversation",
d_focus="reminds the model of the goal every N turns (<code>/goal</code>)",
d_rem="puts the ground rules back into the conversation every 10 turns",
d_widget="widgets in the sidebar")),
(DELEGATE.format(h="Delegation: other models, splinter chooses",
p="A requested tag counts 5, a tag in the task 3, a word from the description 1. The "
"observation opens with the choice and the reason — a wrong pick is visible instead "
"of mysterious. No profiles: one line per model.")),
(CONFIG.format(h="Configuration",
p="<code>~/.splinter/splinter.conf</code>, plus every <code>.conf</code> in "
"<code>~/.splinter/splinter.conf.d/</code> in name order. An unknown key is an "
"error naming the file and line — a typo must not silently do nothing.")),
("<h2>Gateway: Telegram</h2>\n<p><code>splinter --daemon</code> long-polls "
"<code>getUpdates</code>, one turn per message, answers with "
"<code>sendMessage</code>. The token lives in "
"<code>~/.splinter/telegram.token</code> with mode 0600 and is never passed as an "
"argument — arguments end up in <code>ps</code>. While a turn runs, the chat sees "
"&quot;typing&quot; every four seconds.</p>\n<p>Slash commands work there too. "
"Programs in <code>~/.splinter/commands/</code> become <code>/name</code>: they get "
"the rest of the line as an argument, and their output goes <em>to the model</em> as "
"context — not to you as a reply. That is how the model fetches what it cannot see "
"itself.</p>"),
("<h2>What gets written down</h2>\n"
"<pre><span class=\"d\">~/.splinter/logs/&lt;session&gt;/session.log</span> "
"readable, in order, everything\n<span class=\"d\">~/.splinter/logs/&lt;session&gt;"
"/wire.jsonl</span> every request body, every reply, raw</pre>\n"
"<p>Your words, the answer, the reasoning, every tool call with its arguments, every "
"observation, failures, token counts. Nothing truncated — a log that keeps only the "
"good parts cannot explain a bad turn.</p>"),
(BUILD.format(h="Building", c_make="248 KB, nothing but libc and curses",
c_check="21 test programs, plus the i18n checker",
c_chat="chat, the config is read", c_gw="Telegram gateway",
p="POSIX make, C99, <code>-Wall -Wextra -Werror</code>. NetBSD curses is vendored, so "
"the binary does not depend on a distribution's mood.")),
("<h2>What it is not</h2>\n<ul>\n<li>Not a model. splinter ships none and picks none "
"for you.</li>\n<li>Not a cloud. It talks to the endpoint you configure.</li>\n"
"<li>Not a sandbox. Plugins run in the process with your rights — the classes protect "
"the harness from the model, not from code you chose to load.</li>\n</ul>"),
],
}
# Sections added after the first version: the fleet, both directions of MCP, and
# the three small ways in (pipe, folder, first talk).
SECTIONS["de"] += [
"""<h2>Die Flotte</h2>
<p>Ein Delegate darf einen Host nennen. Dann geht der ganze Aufruf ueber ssh, und
claude, opencode oder ein zweiter splinter laufen dort, wo das Modell oder das
Netz ist:</p>
<pre>delegate = olivia | auf olivia | tags=remote | host=172.25.206.16 |
endpoint=http://172.25.206.2:18082/v1/chat/completions | model=...</pre>
<p><code>delegate_parallel</code> schickt bis zu acht Aufgaben gleichzeitig los
und berichtet zurueck, wer was geliefert hat:</p>
<pre>[parallel: 2 task(s), 12018 ms wall]
## task 1 | model slow | score 5 | 12018 ms | exit 0 | 75 B | requested tag 'slow'
## task 2 | model fast | score 5 | 16 ms | exit 0 | 74 B | requested tag 'fast'
## summary
- slow: 1 task(s), 12018 ms total
- fast: 1 task(s), 16 ms total</pre>
<p>Modell, Dauer und Status pro Aufgabe &mdash; ein lahmer oder kaputter Delegate
ist in der Kopfzeile sichtbar, bevor jemand seinen Text liest.</p>""",
"""<h2>Beide Richtungen: MCP</h2>
<p>Als Client holt splinter die Werkzeuge eines MCP-Servers. Als Server stellt es
seine eigenen hin:</p>
<pre><span class="u">$</span> splinter --mcp-server-listen 0.0.0.0 --mcp-listen-port 8098
splinter: MCP server on 0.0.0.0:8098 (14 tools, read only)</pre>
<p>Ein anderer Agent bekommt <code>initialize</code>, <code>tools/list</code> und
<code>tools/call</code>. Lesende Werkzeuge werden bedient, mutierende und
destruktive nur mit <code>--autonomous</code> &mdash; ein fremder Agent fuehrt hier
keine Shell aus, weil er freundlich fragt.</p>""",
"""<h2>Pipe, Ordner, Erstgespraech</h2>
<pre><span class="u">$</span> cat /etc/passwd | splinter "erklaer die Datei"
<span class="u">$</span> cd ~/src/splinter &amp;&amp; splinter -c <span class="d"># die letzte Session, die HIER war</span>
<span class="u">$</span> splinter --interview <span class="d"># einmal: Sprache, Stil, heilige Pfade</span></pre>
<p>Standardeingabe wird zu Kontext, markiert und groessenbegrenzt;
<code>folder_history</code> erzaehlt dem Modell, was in einem Verzeichnis passiert
ist, statt es raten zu lassen; das Profil aus dem Interview liegt in
<code>~/.splinter/profile/&lt;user&gt;.md</code>.</p>""",
]
SECTIONS["en"] += [
"""<h2>The fleet</h2>
<p>A delegate may name a host. The whole invocation then goes through ssh, so
claude, opencode or another splinter run where the model or the network is:</p>
<pre>delegate = olivia | on olivia | tags=remote | host=172.25.206.16 |
endpoint=http://172.25.206.2:18082/v1/chat/completions | model=...</pre>
<p><code>delegate_parallel</code> sends up to eight tasks at once and reports back
who delivered what:</p>
<pre>[parallel: 2 task(s), 12018 ms wall]
## task 1 | model slow | score 5 | 12018 ms | exit 0 | 75 B | requested tag 'slow'
## task 2 | model fast | score 5 | 16 ms | exit 0 | 74 B | requested tag 'fast'
## summary
- slow: 1 task(s), 12018 ms total
- fast: 1 task(s), 16 ms total</pre>
<p>Model, duration and status per task &mdash; a slow or failing delegate is visible
in the header before anybody reads its prose.</p>""",
"""<h2>Both directions: MCP</h2>
<p>As a client splinter fetches an MCP server's tools. As a server it offers its
own:</p>
<pre><span class="u">$</span> splinter --mcp-server-listen 0.0.0.0 --mcp-listen-port 8098
splinter: MCP server on 0.0.0.0:8098 (14 tools, read only)</pre>
<p>Another agent gets <code>initialize</code>, <code>tools/list</code> and
<code>tools/call</code>. Read tools are served; mutating and destructive ones only
with <code>--autonomous</code> &mdash; a foreign agent does not run shell commands
here because it asked nicely.</p>""",
"""<h2>Pipe, folder, first talk</h2>
<pre><span class="u">$</span> cat /etc/passwd | splinter "explain the file"
<span class="u">$</span> cd ~/src/splinter &amp;&amp; splinter -c <span class="d"># the last session that happened HERE</span>
<span class="u">$</span> splinter --interview <span class="d"># once: language, style, sacred paths</span></pre>
<p>Standard input becomes context, framed and size-capped;
<code>folder_history</code> tells the model what happened in a directory instead
of letting it guess; the profile from the interview lives in
<code>~/.splinter/profile/&lt;user&gt;.md</code>.</p>""",
]
SECTIONS["pt_BR"] = [
"""<h2>O que e</h2>
<p>splinter e um harness de agente em C99/POSIX: um programa que segura a
conversa, decide quais ferramentas existem, quem pode usa-las e o que ficou
registrado. O modelo e um detalhe trocavel; o harness e a parte que sabe o que
acontece.</p>""",
"""<h2>Como se parece</h2>
<pre><span class="u">voce:</span> por que o build falha?
<span class="d">pensando:</span> preciso ler o erro antes de opinar.
<span class="u">ferramenta:</span> search {"pattern":"error","path":"build/logs"}
<span class="u">ferramenta:</span> read {"path":"build/logs/last.log"}
<span class="d">alteracao:</span> -CFLAGS = -O2
<span class="d"> </span> +CFLAGS = -O2 -Wall -Werror
<span class="u">modelo:</span> faltava -Werror; o erro era um aviso promovido.</pre>
<p>Pensamento, ferramenta com argumentos, alteracao e resposta entram no
transcript na ordem em que acontecem.</p>""",
"""<h2>Tres verificacoes antes de cada ferramenta</h2>
<p>Orcamento, registro e classe de autorizacao. A ferramenta declara a classe
(read, mutate, destructive) - nunca o modelo, nunca o prompt. Um plugin pode
entrar na frente com um gate: permitir, negar com motivo, ou nao opinar.</p>""",
"""<h2>Ferramentas</h2>
<p>14 ferramentas: <code>read</code>, <code>write</code>, <code>edit</code>,
<code>search</code>, <code>list</code>, <code>run</code>,
<code>folder_history</code>, <code>delegate</code>,
<code>delegate_parallel</code> e as de leitura do sistema.</p>""",
"""<h2>Transportes e plugins</h2>
<p>Transporte e um vtable: openai (HTTP/SSE), cli (claude, opencode), mock para
teste. Plugins sao <code>.so</code> carregados com dlopen: lcm, focus, reminder,
ring, mcp, cli, clock, cps e agora kids.</p>""",
"""<h2>Delegacao: outros modelos, splinter escolhe</h2>
<pre>[parallel: 2 task(s), 12018 ms wall]
## task 1 | model slow | score 5 | 12018 ms | exit 0 | 75 B | requested tag 'slow'</pre>
<p>Modelo, duracao e status por tarefa - um delegado lento aparece no cabecalho
antes de alguem ler o texto.</p>""",
"""<h2>Configuracao</h2>
<pre>endpoint = http://kontron.local:8080/v1/chat/completions
model = ...
autonomous = 1</pre>
<p><code>~/.splinter/splinter.conf</code> mais <code>splinter.conf.d/*.conf</code>
em ordem de nome. Chave desconhecida e erro com numero de linha.</p>""",
"""<h2>Gateway: Telegram</h2>
<p><code>splinter --daemon</code> fala Telegram com indicador de digitacao e os
mesmos slash commands do terminal.</p>""",
"""<h2>O que fica registrado</h2>
<p>Cada sessao escreve <code>session.log</code> (eventos legiveis) e
<code>wire.jsonl</code> (o que foi de fato enviado ao modelo).</p>""",
"""<h2>Compilar</h2>
<pre>make
make check <span class="d"># 21 binarios de teste, i18n, site</span></pre>
<p>Sem dependencias alem de libc e pthread; ncurses vem do vendor.</p>""",
"""<h2>O que nao e</h2>
<ul><li>nao e um modelo;</li><li>nao e um servico - e um programa;</li>
<li>nao guarda nada em sqlite: sessoes sao arquivos;</li>
<li>nao adivinha: mede.</li></ul>""",
"""<h2>A frota</h2>
<pre>delegate = olivia | em olivia | tags=remote | host=172.25.206.16 |
endpoint=http://172.25.206.2:18082/v1/chat/completions | model=...</pre>
<p>O delegate nomeia um host e a chamada inteira vai por ssh; a maquina remota
poe suas proprias chaves.</p>""",
"""<h2>As duas direcoes: MCP</h2>
<pre><span class="u">$</span> splinter --mcp-server-listen 0.0.0.0 --mcp-listen-port 8098
splinter: MCP server on 0.0.0.0:8098 (14 tools, read only)</pre>
<p>Como cliente busca ferramentas; como servidor oferece as suas. Mutar so com
<code>--autonomous</code>.</p>""",
"""<h2>Pipe, pasta, primeira conversa</h2>
<pre><span class="u">$</span> cat /etc/passwd | splinter "explique o arquivo"
<span class="u">$</span> cd ~/src/splinter &amp;&amp; splinter -c
<span class="u">$</span> splinter --interview</pre>
<p>stdin vira contexto; <code>-c</code> pega a ultima sessao daquele diretorio;
<code>--interview</code> escreve o perfil em
<code>~/.splinter/profile/&lt;usuario&gt;.md</code>.</p>""",
"""<h2>Modo crianca</h2>
<p>Com o plugin <code>kids</code>, toda acao que muda algo precisa da aprovacao de
um adulto (Telegram), uma lista branca libera o inofensivo, o modelo e lembrado a
cada pedido de manter a conversa adequada a idade, e um limite diario de minutos
fecha o dia quando acaba.</p>""",
]
SECTIONS["de"].append(
"""<h2>Kindermodus</h2>
<p>Mit dem Plugin <code>kids</code> braucht jede Aenderung die Zustimmung eines
Erwachsenen (Telegram), eine Whitelist laesst das Harmlose durch, das Modell wird
bei jeder Anfrage an einen altersgerechten Ton erinnert, und ein Tageskontingent
an Minuten beendet den Tag, wenn es aufgebraucht ist.</p>""")
SECTIONS["en"].append(
"""<h2>Kid mode</h2>
<p>With the <code>kids</code> plugin every change needs a parent's approval
(Telegram), a whitelist lets the harmless ones through, the model is reminded of an
age-appropriate tone on every request, and a daily minute budget ends the day when
it is spent.</p>""")
def render(lang):
strings = dict(T[lang])
strings["lang"] = lang
body = "\n\n".join(SECTIONS[lang])
html = HEAD
for key, value in strings.items():
html = html.replace("{{%s}}" % key, value)
html = html.replace("{{body}}", body)
if "{{" in html:
leftover = html[html.index("{{"):html.index("{{") + 40]
raise SystemExit("gen_www: unfilled placeholder: %s" % leftover)
return html
def main(argv):
check = "--check" in argv
problems = []
# both languages must cover the same keys
for key in sorted(set(T["de"]) | set(T["en"])):
for lang in LANGS:
if key not in T[lang]:
problems.append("%s: missing key %r" % (lang, key))
if problems:
for p in problems:
print("gen_www: " + p, file=sys.stderr)
return 1
stale = []
for lang in LANGS:
path = OUT / FILES[lang]
html = render(lang)
if check:
if not path.exists() or path.read_text(encoding="utf-8") != html:
stale.append(str(path))
continue
path.write_text(html, encoding="utf-8")
print("gen_www: wrote %s (%d bytes)" % (path, len(html.encode())))
if check:
if stale:
print("gen_www: stale page(s): " + ", ".join(stale), file=sys.stderr)
return 1
print("gen_www: ok (%d languages)" % len(LANGS))
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))