sincekit / site /index.html
pgg-engineering's picture
Release SinceKit 0.1.0 with native benchmarks and trace replay
ef8334d verified
Raw History Blame Contribute Delete
14.7 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="#193b33">
<meta name="description" content="Replay touches and erasures in a dense slot index. See how multiple agent readers catch up from independent revision cursors with one shared change vector.">
<meta property="og:title" content="SinceKit · Cursor workbench">
<meta property="og:description" content="An interactive replay of one shared change vector and independent reader cursors.">
<title>SinceKit · Cursor workbench</title>
<style>
:root { color-scheme: light; --paper: #f5f3ea; --card: #fffef9; --ink: #172d26; --sub: #495b50; --line: #c6cdc0; --deep: #193b33; --light: #dbea98; --rust: #90411e; --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; --sans: "Instrument Sans", Inter, system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.45 var(--sans); }
main, header, footer { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px,4vw,54px); }
header { height: 76px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); font-weight: 750; font-size: 20px; }
.mark { display: inline-grid; width: 32px; height: 32px; border-radius: 7px; background: var(--deep); align-content: center; gap: 3px; padding-left: 7px; }
.mark i { height: 3px; background: var(--light); }
.mark i:nth-child(1) { width: 17px; } .mark i:nth-child(2) { width: 12px; } .mark i:nth-child(3) { width: 7px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(40px,6vw,70px); letter-spacing: -.065em; line-height: 1.04; margin-bottom: 12px; }
h2 { font-size: 22px; line-height: 1.24; letter-spacing: -.04em; }
.intro { padding: clamp(28px,5vw,56px) 0 24px; }
.intro p { color: var(--sub); max-width: 630px; font-size: clamp(16px,2vw,19px); }
button, input { font: inherit; }
button { color: var(--ink); border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 7px 12px; cursor: pointer; min-height: 38px; font-weight: 600; }
button:hover:enabled { background: #e6eadd; border-color: var(--sub); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid #b65716; outline-offset: 3px; }
.primary { color: #fff; background: var(--deep); border-color: var(--deep); }
.primary:hover:enabled { color: #fff; background: #2b5345; }
.controls, .readers, .example { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.example { margin-bottom: 16px; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.example-title { font-size: 14px; color: var(--sub); font-weight: 700; margin-bottom: 2px; }
.example p { font-size: 15px; }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.workbench { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr); gap: 16px; align-items: start; }
.edit { display: grid; gap: 16px; }
.controls, .readers { padding: 21px; }
.controls form { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--sub); font-weight: 650; }
input { color: var(--ink); background: #fff; border: 1px solid #aab9a9; border-radius: 5px; height: 38px; padding: 5px 8px; font-family: var(--mono); font-size: 14px; }
.slot { width: 100px; }
.muted { font-size: 13px; color: var(--sub); margin-top: 9px; }
.reader-head { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.reader-row { border-top: 1px solid var(--line); margin-top: 12px; padding: 12px 0 0; display: grid; grid-template-columns: minmax(80px,1fr) 68px minmax(88px,auto); gap: 10px; align-items: end; }
.reader-name { align-self: center; font-weight: 700; display: block; }
.count { display: block; color: var(--sub); font: 12px/1.5 var(--mono); }
.reader-row button { font-size: 13px; } .reader-row input { min-width: 0; width: 100%; }
.out { color: #f3f5e7; background: var(--deep); border-radius: 12px; padding: 22px; }
.out-head { display:flex; align-items: center; justify-content:space-between; gap: 14px; }
.rev { color: var(--light); font: 13px var(--mono); white-space: nowrap; }
.out p { color: #c6d6c5; font-size: 14px; margin: 8px 0 18px; }
.scroll { overflow-x:auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { text-align:left; padding-bottom: 8px; font-weight: 700; }
th { font: 12px var(--mono); text-align: left; color: #d3dfcc; padding: 9px 5px; border-bottom: 1px solid #76917b; }
td { font: 14px var(--mono); padding: 10px 5px; border-bottom: 1px solid #466452; }
.op { font-size: 12px; font-weight: 700; }
.touch { color: #daeca4; } .erase { color: #ffba98; }
.empty { padding: 18px 4px; font-size: 14px; color: #c6d6c5; }
.json { display: block; margin: 22px 0 0; }
.json summary { font-size: 14px; cursor:pointer; color: #e1e9d8; }
pre { white-space: pre-wrap; overflow-wrap:anywhere; font: 12px/1.6 var(--mono); }
.status { min-height: 21px; font: 13px/1.5 var(--mono); color: var(--sub); margin-top: 12px; }
footer { padding-top: 24px; padding-bottom: 30px; font-size: 13px; color: var(--sub); }
footer code, .intro code { font-family: var(--mono); }
@media (max-width: 760px) { .workbench { grid-template-columns: 1fr; } .example { flex-direction: column; align-items: flex-start; } header { height: 60px; } }
@media (max-width: 400px) { .controls, .readers, .out, .example { padding: 14px; } .reader-row { grid-template-columns: minmax(64px,1fr) 60px auto; gap: 5px; } .reader-row button { padding: 6px; } }
.resources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 18px 0 0; }
.resources a { color: var(--deep); font-weight: 650; text-underline-offset: 3px; }
</style>
</head>
<body>
<header><span class="mark" aria-hidden="true"><i></i><i></i><i></i></span> SinceKit</header>
<main>
<section class="intro"><h1>Cursor workbench</h1><p>Publish a slot change and see what each reader needs to catch up. All readers take a prefix of the same newest-first vector.</p><nav class="resources" aria-label="Release resources"><a href="https://huggingface.co/spaces/pgg-engineering/sincekit/resolve/main/sincekit-0.1.0.zip?download=true">Download C++ and Python source</a><a href="https://huggingface.co/spaces/pgg-engineering/sincekit/blob/main/docs/performance.md">Benchmark results</a><a href="https://huggingface.co/spaces/pgg-engineering/sincekit/blob/main/trace/README.md">Replay the observed trace</a></nav></section>
<section class="example" aria-label="Guided example">
<div><div class="example-title" id="step-label"></div><p id="step-text"></p></div>
<div class="buttons"><button id="previous" type="button">Previous step</button><button id="next" type="button">Next step</button><button id="example" type="button">Restart example</button></div>
</section>
<div class="workbench">
<div class="edit">
<section class="controls" aria-labelledby="writer-title">
<h2 id="writer-title">Publish a change</h2>
<form id="write"><label>Slot ID<input class="slot" id="slot" type="number" min="0" max="65535" value="7" required></label><button class="primary" type="submit" value="touch">Touch</button><button type="submit" value="erase">Erase</button></form>
<p class="muted">Touch publishes the current slot state. Erase publishes a tombstone. Either advances the revision by one.</p>
</section>
<section class="readers" aria-labelledby="reader-title">
<div class="reader-head"><h2 id="reader-title">Reader cursors</h2><button id="add" type="button">Add reader</button></div>
<p class="muted">Set a cursor to the last delivered revision. Checkpoint moves it to the current revision.</p>
<div id="readers"></div>
</section>
</div>
<section class="out" aria-labelledby="out-title">
<div class="out-head"><h2 id="out-title">Shared vector</h2><span class="rev" id="rev"></span></div>
<p>Each slot appears once. A reader with prefix length <i>k</i> takes the first <i>k</i> rows. Rows at or before its cursor are excluded.</p>
<div class="scroll"><table><thead><tr><th scope="col">Row</th><th scope="col">Slot</th><th scope="col">Revision</th><th scope="col">Change</th></tr></thead><tbody id="vector"></tbody></table></div>
<details class="json"><summary>View CLI packet JSON</summary><pre id="packet"></pre></details>
</section>
</div>
<p id="status" role="status" class="status"></p>
</main>
<footer>JavaScript behavioral reference. The C++17 implementation and native benchmark run separately. All replay data stays in this tab.</footer>
<script>
"use strict";
const steps = [
{message:"Both readers begin at cursor 0. Publish the first change."},
{op:"touch", id:7, message:"Touch slot 7. Both readers can see the new state."},
{op:"touch", id:12, message:"Touch slot 12. The newest slot moves to the front."},
{checkpoint:0, message:"Reader A acknowledges revision 2. Reader B is still at cursor 0."},
{op:"touch", id:7, message:"Touch slot 7 again. Its new revision replaces its earlier row."},
{op:"erase", id:12, message:"Erase slot 12. Its tombstone replaces the previous touch."},
{checkpoint:1, message:"Reader B acknowledges revision 4. Reader A still needs the last two changes."},
{op:"touch", id:9, message:"Touch slot 9. Reader A takes three rows and reader B takes one."}
];
let model, currentStep;
const get = id => document.getElementById(id);
function nameOf(i) { return i < 26 ? String.fromCharCode(65+i) : String(i+1); }
function publish(op, id) {
model.revision++;
model.slots.set(id, {slot:id, revision:model.revision, erased:op==="erase"});
}
function loadStep(index) {
currentStep=index;
model={revision:0, slots:new Map(), cursors:[0,0]};
for (const step of steps.slice(0,index+1)) {
if (step.op) publish(step.op,step.id);
if (step.checkpoint!==undefined) model.cursors[step.checkpoint]=model.revision;
}
paint(true);
get("status").textContent="";
}
function packet() {
const oldest=model.cursors.reduce((least,cursor)=>Math.min(least,cursor),model.revision);
const changes=Array.from(model.slots.values()).filter(change=>change.revision>oldest)
.sort((a,b)=>b.revision-a.revision);
const readers=model.cursors.map((cursor,i)=>({
reader:nameOf(i), cursor,
prefix_length:changes.filter(change=>change.revision>cursor).length
}));
return {watermark:model.revision, changes, readers};
}
function elem(tag, text, classes) {
const node=document.createElement(tag);
if (text!==undefined) node.textContent=text;
if (classes) node.className=classes;
return node;
}
function custom(message) {
currentStep=null;
paint(false);
get("status").textContent=message;
}
function buildReaders() {
const panel=get("readers");
panel.replaceChildren();
model.cursors.forEach((_,i)=>{
const row=elem("div",undefined,"reader-row");
const title=elem("div");
const name=nameOf(i);
title.append(elem("span","Reader "+name,"reader-name"));
const count=elem("span","","count"); count.id="count-"+i;
title.append(count);
const label=elem("label","Cursor");
const input=elem("input");
input.type="number"; input.min="0"; input.step="1"; input.required=true; input.id="cursor-"+i;
input.setAttribute("aria-label","Cursor for reader "+name);
input.addEventListener("change",()=>{
if (!input.reportValidity()) { input.value=model.cursors[i]; return; }
model.cursors[i]=input.valueAsNumber;
custom("Reader "+name+" moved to revision "+model.cursors[i]+".");
});
label.append(input);
const button=elem("button","Checkpoint");
button.type="button"; button.id="checkpoint-"+i;
button.setAttribute("aria-label","Checkpoint reader "+name);
button.addEventListener("click",()=>{
model.cursors[i]=model.revision;
custom("Reader "+name+" acknowledged revision "+model.revision+".");
});
row.append(title,label,button); panel.append(row);
});
}
function paint(rebuild) {
const result=packet();
if (rebuild || get("readers").children.length!==model.cursors.length) buildReaders();
const manual=currentStep===null;
get("step-label").textContent=manual?"Custom replay":"Guided replay · Step "+(currentStep+1)+" of "+steps.length;
get("step-text").textContent=manual?"Publish more changes or restart the example.":steps[currentStep].message;
get("previous").disabled=manual || currentStep===0;
get("next").disabled=manual || currentStep===steps.length-1;
get("rev").textContent="Revision "+model.revision;
for (const [i,reader] of result.readers.entries()) {
const input=get("cursor-"+i);
input.max=model.revision; input.value=reader.cursor;
get("checkpoint-"+i).disabled=reader.cursor===model.revision;
get("count-"+i).textContent="Prefix length "+reader.prefix_length;
}
const rows=get("vector"); rows.replaceChildren();
for (const [i,change] of result.changes.entries()) {
const row=elem("tr");
for(const value of [i+1,change.slot,change.revision]) row.append(elem("td",value));
row.append(elem("td",change.erased?"erase":"touch","op "+(change.erased?"erase":"touch")));
rows.append(row);
}
if (!result.changes.length) {
const td=elem("td","All readers are caught up.","empty"); td.colSpan=4;
const row=elem("tr"); row.append(td); rows.append(row);
}
const wire={
revision:String(model.revision),
rows:result.changes.map(c=>[c.slot,String(c.revision),c.erased]),
prefix_lengths:result.readers.map(reader=>reader.prefix_length)
};
get("packet").textContent=JSON.stringify(wire,null,2);
}
get("previous").onclick=()=>loadStep(currentStep-1);
get("next").onclick=()=>loadStep(currentStep+1);
get("example").onclick=()=>loadStep(0);
get("add").onclick=()=>{
model.cursors.push(0);
custom("Reader "+nameOf(model.cursors.length-1)+" added at cursor 0.");
};
get("write").onsubmit=event=>{
event.preventDefault();
const op=event.submitter?.value || "touch";
const slot=get("slot").valueAsNumber;
if (!Number.isInteger(slot) || slot<0 || slot>65535) return;
publish(op,slot);
custom("Published "+op+" on slot "+slot+" at revision "+model.revision+".");
};
loadStep(steps.length-1);
</script>
</body>
</html>