neural-nebula-pulse-cgl6/exploration.html

73 lines
339 KiB
HTML
Raw Permalink Normal View History

2026-04-30 09:48:05 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neural Nebula Pulse — exploration</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0a0a0f; color: #3a3a4a; font-family: ui-monospace, monospace; overflow: hidden; }
#grid { padding: 20px; font-size: 12px; line-height: 1.4; white-space: pre; }
.c { display: inline-block; transition: all 0.3s; }
.c.active { color: #fde68a; text-shadow: 0 0 6px rgba(253,230,138,0.5); }
.c.strong { color: #34d399; text-shadow: 0 0 10px rgba(52,211,153,0.6); font-weight: bold; }
.c.dead { color: #1a1a2a; }
#info { position: fixed; bottom: 10px; left: 20px; color: #3a3a4a; font-size: 11px; }
#controls { position: fixed; top: 10px; right: 20px; color: #666; font-size: 11px; }
#controls span { cursor: pointer; margin-left: 12px; color: #fde68a; }
</style>
</head>
<body>
<div id="grid"></div>
<div id="info">neurameba · physarum exploration</div>
<div id="controls"><span id="play-btn">play</span><span id="reset-btn">reset</span></div>
<script>
const text = "# Plugin Development\n\nmotd is API-first. Every feature is an API endpoint. That means you can build anything on top of it — custom clients, bots, bridges, tools.\n\nPlugins run on your machine, not on the server. There's no plugin registry, no sandboxing, no approval process. You call the API. That's it.\n\n## Authentication\n\n1. Register or log in via the API\n2. Store the returned token\n3. Send it with every request as `Authorization: Bearer <token>`\n\n```bash\n# Get a token\nTOKEN=$(curl -s -X POST http://localhost:3006/api/auth/login \\\n -H \"Content-Type: application/json\" \\\n -d '{\"username\":\"alice\",\"password\":\"hunter2pwd\"}' | jq -r '.data.token')\n\necho $TOKEN\n```\n\nTokens expire after 7 days. Re-authenticate when needed.\n\n## Example: Fetch Your Feed\n\n```bash\n#!/bin/bash\nTOKEN=\"your-token-here\"\n\ncurl -s http://localhost:3006/api/posts/feed \\\n -H \"Authorization: Bearer $TOKEN\" | jq '.data.posts[] | {user: .username, text: .content, id: .id}'\n```\n\nOutput:\n```json\n{ \"user\": \"alice\", \"text\": \"just shipped the wasm compiler [rust] [wasm]\", \"id\": \"a3kf9x\" }\n{ \"user\": \"bob\", \"text\": \"working on a new side project [coding]\", \"id\": \"c9xk4m\" }\n```\n\n## Example: Post From the Command Line\n\n```bash\n#!/bin/bash\nTOKEN=\"your-token-here\"\n\ncurl -s -X POST http://localhost:3006/api/posts \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"content\\\":\\\"$1\\\"}\" | jq '.data.id'\n```\n\nUsage:\n```bash\n./motd-post.sh \"automated post from my build pipeline [ci]\"\n```\n\n## Example: Upload and Post an Image\n\n```bash\n#!/bin/bash\nTOKEN=\"your-token-here\"\nIMAGE=\"$1\"\nCAPTION=\"$2\"\n\n# Upload the image\nMEDIA_ID=$(curl -s -X POST http://localhost:3006/api/media/upload \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -F \"file=@$IMAGE\" | jq -r '.data.media_id')\n\n# Post with attachment\ncurl -s -X POST http://localhost:3006/api/posts \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"content\\\":\\\"$CAPTION /attach $MEDIA_ID\\\"}\" | jq '.'\n```\n\nUsage:\n```bash\n./motd-upload.sh screenshot.png \"new feature landed [showcase]\"\n```\n\n## Example: GitHub Bridge (Concept)\n\nSync your GitHub activity to motd. Watch for push events, post summaries.\n\n```bash\n#!/bin/bash\nTOKEN=\"your-token-here\"\n\n# Poll GitHub events (simplified)\nLATEST=$(curl -s https://api.github.com/users/alice/events?per_page=1 | jq -r '.[0]')\nTYPE=$(echo $LATEST | jq -r '.type')\nREPO=$(echo $LATEST | jq -r '.repo.name')\n\nif [ \"$TYPE\" = \"PushEvent\" ]; then\n curl -s -X POST http://localhost:3006/api/posts \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"content\\\":\\\"pushed to $REPO [coding] [github]\\\"}\"\nfi\n```\n\n## Example: Bookmark Monitor\n\nWatch your bookmarked tags for new posts.\n\n```bash\n#!/bin/bash\nTOKEN=\"your-token-here\"\n\n# Get bookmarked tags\nTAGS=$(curl -s \"http://localhost:3006/api/bookmarks?type=tag\" \\\n -H \"Authorization: Bearer $TOKEN\" | jq -r '.data.bookmarks[].id')\n\nfor TAG in $TAGS; do\n echo \"--- [$TAG] ---\"\n curl -s \"http://localhost:3006/api/posts/search?q=$TAG\" \\\n -H \"Authorization: Bearer $TOKEN\" | jq '.data.posts[:3][] | \"\\(.username): \\(.content)\"'\ndone\n```\n\n## Media Converters\n\nmotd accepts PNG, MP3, and MP4 only. Build converter plugins for other formats:\n\n```bash\n# JPG to PNG before upload\nconvert photo.jpg photo.png && ./motd-upload.sh photo.png \"converted from jpg\"\n\n# WAV to MP3 before upload\nffmpeg -i recording.wav -q:a 2 recording.mp3\n```\n\n## Ideas\n\nBuilding something? Post about it with the [ideas] tag. Found a bug? Use [bugs]. The community is on motd itself.\n\nSee `/read api` for the complete endpoint reference.\n";
const passes = [{"t":0,"r":99,"c":0,"a":"extend","s":0.32695870322846005,"ps":9,"e":70.88596873807937,"pr":1.1},{"t":0,"r":124,"c":0,"a":"died","s":0,"ps":8,"e":100,"pr":1},{"t":0,"r":64,"c":12,"a":"extend","s":0.48929364172381457,"ps":9,"e":71.79504439365336,"pr":1.1},{"t":0,"r":65,"c":10,"a":"extend","s":0.3621490656336644,"ps":9,"e":71.08303476754853,"pr":1.1},{"t":1,"r":99,"c":0,"a":"extend","s":0.37596959133994584,"ps":9,"e":50.780607828159255,"pr":1.1},{"t":1,"r":64,"c":12,"a":"extend","s":0.5521715470217112,"ps":9,"e":52.40369173887893,"pr":1.1},{"t":1,"r":65,"c":10,"a":"extend","s":0.37031389794504643,"ps":8,"e":50.99188216577623,"pr":1.05},{"t":1,"r":99,"c":1,"a":"extend","s":0.38473174957502754,"ps":5,"e":22.895288419043965,"pr":1.2000000000000002},{"t":1,"r":64,"c":13,"a":"extend","s":0.35242375383801633,"ps":5,"e":22.987086339588895,"pr":1.2000000000000002},{"t":1,"r":64,"c":11,"a":"extend","s":0.3799545991742827,"ps":5,"e":23.141259073471986,"pr":1.2000000000000002},{"t":1,"r":65,"c":9,"a":"hold","s":0.2197862340485399,"ps":5,"e":31.472447629909112,"pr":1.2000000000000002},{"t":1,"r":64,"c":10,"a":"hold","s":0.12590921847218717,"ps":5,"e":30.72143150529829,"pr":1.2000000000000002},{"t":2,"r":99,"c":0,"a":"extend","s":0.37596959133994584,"ps":8,"e":36.81185519121517,"pr":1.05},{"t":2,"r":64,"c":12,"a":"extend","s":0.5521715470217112,"ps":8,"e":38.93474488053683,"pr":1.05},{"t":2,"r":65,"c":10,"a":"extend","s":0.3621490656336644,"ps":7,"e":36.98735228359188,"pr":1},{"t":2,"r":99,"c":1,"a":"hold","s":0.3197947490812519,"ps":4,"e":24.85364641169398,"pr":1.1500000000000001},{"t":2,"r":64,"c":13,"a":"hold","s":0.35235543374925793,"ps":4,"e":25.20592980958296,"pr":1.1500000000000001},{"t":2,"r":64,"c":11,"a":"extend","s":0.38753662603432426,"ps":4,"e":39.454088510931406,"pr":1.1500000000000001},{"t":2,"r":65,"c":9,"a":"hold","s":0.2849149453503894,"ps":5,"e":33.00176719271223,"pr":1.2000000000000002},{"t":2,"r":65,"c":11,"a":"hold","s":0.12197587828805954,"ps":5,"e":22.079470811637147,"pr":1.1500000000000001},{"t":2,"r":100,"c":1,"a":"extend","s":0.36046262206121077,"ps":5,"e":8.36217720925597,"pr":1.3000000000000003},{"t":2,"r":65,"c":13,"a":"hold","s":0.23551954265557523,"ps":5,"e":10.985764772496985,"pr":1.3000000000000003},{"t":2,"r":65,"c":11,"a":"hold","s":0.22106316165821155,"ps":5,"e":10.936187753325115,"pr":1.3000000000000003},{"t":3,"r":99,"c":0,"a":"hold","s":0.32695870322846005,"ps":8,"e":38.227524817042855,"pr":1.05},{"t":3,"r":64,"c":12,"a":"extend","s":0.48929364172381457,"ps":8,"e":29.15436581002914,"pr":1.05},{"t":3,"r":65,"c":10,"a":"hold","s":0.3491402493997718,"ps":6,"e":49.81666203211517,"pr":0.95},{"t":3,"r":99,"c":1,"a":"extend","s":0.38473174957502754,"ps":4,"e":19.13205028580594,"pr":1.1},{"t":3,"r":64,"c":13,"a":"hold","s":0.35242375383801633,"ps":4,"e":27.425319840287088,"pr":1.1},{"t":3,"r":64,"c":11,"a":"hold","s":0.18347456662014344,"ps":6,"e":62.1013558555297,"pr":1.2500000000000002},{"t":3,"r":65,"c":9,"a":"retracted","s":0.2849149453503894,"ps":4,"e":34.681086755515345,"pr":1.1500000000000001},{"t":3,"r":100,"c":1,"a":"hold","s":0.28467174828637143,"ps":5,"e":9.889551195546941,"pr":1.3000000000000003},{"t":3,"r":65,"c":13,"a":"hold","s":0.227023364619338,"ps":5,"e":12.05195168945169,"pr":1.3000000000000003},{"t":3,"r":100,"c":0,"a":"extend","s":0.3983017968414541,"ps":5,"e":12.749046619676696,"pr":1.1500000000000001},{"t":3,"r":64,"c":10,"a":"hold","s":0.21307172553870923,"ps":5,"e":16.80629621156334,"pr":1.1},{"t":3,"r":64,"c":10,"a":"extend","s":0.4587221021887286,"ps":5,"e":13.8800703255363,"pr":1.2500000000000002},{"t":4,"r":99,"c":0,"a":"hold","s":0.32695870322846005,"ps":7,"e":39.793194442870536,"pr":1},{"t":4,"r":64,"c":12,"a":"extend","s":0.48929364172381457,"ps":7,"e":22.41310046067376,"pr":1},{"t":4,"r":65,"c":10,"a":"hold","s":0.2800952496032793,"ps":6,"e":65.0374943544777,"pr":0.95},{"t":4,"r":99,"c":1,"a":"hold","s":0.38473174957502754,"ps":4,"e":21.60990428240616,"pr":1.05},{"t":4,"r":64,"c":13,"a":"retracted","s":0.35242375383801633,"ps":4,"e":29.644709870991218,"pr"
const lines = text.split('\n');
const gridEl = document.getElementById('grid');
const charEls = [];
for (let r = 0; r < lines.length; r++) {
const row = [];
for (let c = 0; c < lines[r].length; c++) {
const s = document.createElement('span');
s.className = 'c';
s.textContent = lines[r][c];
row.push(s);
gridEl.appendChild(s);
}
charEls.push(row);
gridEl.appendChild(document.createTextNode('\n'));
}
let tick = -1, playing = false, iv;
function apply(t) {
for (const r of charEls) for (const e of r) e.className = 'c';
const active = new Map();
for (const p of passes) {
if (p.t > t) break;
const k = p.r+','+p.c;
if (p.a === 'died' || p.a === 'retracted') active.set(k, 'dead');
else if (p.ps > 16) active.set(k, 'strong');
else active.set(k, 'active');
}
for (const [k, cls] of active) {
const [r, c] = k.split(',').map(Number);
if (charEls[r]?.[c]) charEls[r][c].className = 'c ' + cls;
}
document.getElementById('info').textContent = 'tick ' + t + ' · ' + [...active.values()].filter(v=>v!=='dead').length + ' alive';
}
function play() {
if (playing) return;
playing = true;
document.getElementById('play-btn').textContent = 'pause';
const max = passes.length > 0 ? passes[passes.length-1].t : 0;
iv = setInterval(() => { tick++; if (tick > max) { pause(); return; } apply(tick); }, 900);
}
function pause() { playing = false; clearInterval(iv); document.getElementById('play-btn').textContent = 'play'; }
function reset() { pause(); tick = -1; for (const r of charEls) for (const e of r) e.className = 'c'; document.getElementById('info').textContent = 'neurameba'; }
document.getElementById('play-btn').addEventListener('click', () => playing ? pause() : play());
document.getElementById('reset-btn').addEventListener('click', reset);
setTimeout(play, 1000);
</script>
</body>
</html>