GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Kuiper, cosmos and drawing engines / galaxies-wafers / iterations/32-spider-and-galaxy

Spider Pane and 4 more files

A JavaScript module in the iterations folder of Galaxies Wafers that draws on a canvas. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.

461 lines of JavaScript and HTML and CSS from galaxies-wafers, in 5 files. Topic: Kuiper, cosmos and drawing engines. Section 1207 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Iterations — 32 Spider and Galaxy Page render · galaxies-wafers / iterations/32-spider-and-galaxy/index.html lines 1–72
  2. Link ingest · galaxies-wafers / iterations/32-spider-and-galaxy/link.mjs lines 1–64
  3. Spider Pane render · galaxies-wafers / iterations/32-spider-and-galaxy/spider-pane.mjs lines 1–170
  4. Iterations — 32 Spider and Galaxy Style Sheet render · galaxies-wafers / iterations/32-spider-and-galaxy/style.css lines 1–71
  5. Unknown Paths transform · galaxies-wafers / iterations/32-spider-and-galaxy/unknown-paths.mjs lines 1–84

Iterations — 32 Spider and Galaxy Page

A web page in Galaxies Wafers that reads inputs for graph pick and find. Published at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.

rendergalaxies-wafers / iterations/32-spider-and-galaxy/index.html · lines 1–72 of 72 · Entry point

What it does
It draws its content. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). README: "The page (`index.html`, `app.mjs`, `lib.mjs`) is inherited unchanged from testcode/202609151339."
Inputs & outputs
In: form fields (user input). Out: web page.
Downstream impact
Used directly by 8 files: Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage Versions — Before Refresh Page (globalgrid2050, https://globalgrid2050.com/homepage_versions/20260922-before-refresh/); Homepage V121 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v121.html); and 4 more. Reached from 81 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.
What it achieves
Spider and Galaxy — one universe, two views.
Why it matters
Loaded by the 47 Federation Honesty page at https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/ and 7 other pages.
Application
galaxies-wafers · iterations/32-spider-and-galaxy · page
Uses
Iterations — 32 Spider and Galaxy Style Sheet (stylesheet), Iterations — 32 Spider and Galaxy (script src)
Used by
linked from Iterations — 47 Federation Honesty Page (link), linked from GlobalGrid2050 Homepage Before Four Nests (link), linked from Homepage Versions — Before Refresh Page (link), linked from Homepage V121 (link), linked from Homepage V122 (link), linked from Homepage V123 (link), linked from Homepage V124 (link), linked from Homepage V125 (link)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/32-spider-and-galaxy/index.html:1-72 · blob f652b772b26de06e6a40cf09b5e3fb80e8139f1e · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=5">
<meta name="color-scheme" content="dark">
<title>Spider and Galaxy — one universe, two views</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="style.css">
</head>
<body>

<header id="bar">
  <span id="wordmark">SPIDER · GALAXY</span>
  <span id="bridgeLine" class="dim">measuring the bridge…</span>
</header>

<main id="split">
  <section id="spiderPane" class="pane" aria-label="The spider's graph, drawn from its own published JSON">
    <div class="ptitle">
      <label for="graphPick" class="dim">spider graph</label>
      <select id="graphPick" aria-label="spider graph to draw"></select>
      <input id="findNode" type="search" placeholder="find node" aria-label="find a node by its label" autocomplete="off">
    </div>
    <div id="spiderStage" class="stage"></div>
    <div id="spiderFoot" class="pfoot dim">loading the spider's manifest…</div>
  </section>
  <section id="waferPane" class="pane" aria-label="The dark wafer: every numbered line of code, placed by its own number">
    <div class="ptitle">
      <span class="dim">dark wafer</span>
      <button id="wakeBlocks" type="button">wake named functions <span id="wakeBlocksTag" class="tag">[WAIT]</span></button>
      <button id="clearWake" type="button">clear</button>
    </div>
    <div id="waferStage" class="stage"></div>
    <div id="waferFoot" class="pfoot dim">loading the numbered database…</div>
  </section>
</main>

<section id="say" aria-live="polite">
  <div id="linkBox" hidden></div>
  <div id="sayBody" class="dim">Tap a spider node to find it in the numbered universe. Tap a lit line on the wafer to find its spider node.</div>
</section>

<section id="drawers">
  <details id="questions">
    <summary>Questions</summary>
    <div id="qBody" class="dim">computing…</div>
  </details>
  <details id="testPanel">
    <summary>Spider test</summary>
    <div id="tBody" class="dim">measured as graphs load…</div>
  </details>
  <details id="atlasKeys">
    <summary>Shared keys with Grid Atlas</summary>
    <div id="aStatus" class="dim">WAIT · opening this reads every Grid Atlas cartridge, part, manifest and config file the spider links</div>
    <div id="aBody"></div>
  </details>
  <details id="unknownPaths">
    <summary>The unknown paths</summary>
    <div id="uStatus" class="dim">WAIT · opening this reads the code-index buckets of the numbered database pack and of the newer pack</div>
    <div id="uBody"></div>
  </details>
  <details id="rules">
    <summary>How this page loads</summary>
    <div id="rBody" class="dim"></div>
  </details>
</section>

<noscript><p class="dim" style="padding:1rem">Both views are drawn from published data at run time, so this page needs JavaScript.</p></noscript>
<script type="module" src="app.mjs"></script>
</body>
</html>

Link

A JavaScript module in the iterations folder of Galaxies Wafers. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/. It parses key (`parseKey`) and is built from the val step (`val`).

ingestgalaxies-wafers / iterations/32-spider-and-galaxy/link.mjs · lines 1–64 of 64 · pattern parseKey (shared by 3 files)

What it does
Defines parseKey, readLink, val.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Downstream impact
Used directly by 1 file: Iterations — 32 Spider and Galaxy (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/). Reached from 90 other entry points, including Iterations — 32 Spider and Galaxy Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html).
What it achieves
What a link into this page asks for, read strictly.
Why it matters
Imported by Iterations — 32 Spider and Galaxy.
Application
galaxies-wafers · iterations/32-spider-and-galaxy · JavaScript module
Uses
none found
Used by
imported by Iterations — 32 Spider and Galaxy (import)
Produces
PARAMS, parseKey, readLink
Defines here
parseKey, readLink, val
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/32-spider-and-galaxy/link.mjs:1-64 · blob 7caee84cd89cfb22d5d004c0d26fb2b3f6e91952 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
/* link.mjs — what a link into this page asks for, read strictly. No DOM, no
 * fetch, so the page and the tests import the same code.
 *
 * Parameters this page reads (iteration 36's SPIDER button sends graph, key,
 * repo and path; node is written back by this page on a manual tap):
 *   graph=<id>                 a graph id of the spider manifest
 *   node=<id>                  a node id of that graph (exact)
 *   key=block:<Symbol>         a register block
 *   key=family:<n>             a numbered function family
 *   key=line:<n>               a permanently numbered line
 *   repo=<owner>/<name>        a repository, optionally with
 *   path=<path>                a file or folder inside it
 * Anything else, or any of these in a shape the page cannot use, is returned
 * as a warning sentence naming the parameter, so it is shown, never dropped.
 */
export const PARAMS = Object.freeze(['graph', 'node', 'key', 'repo', 'path']);

export function parseKey(raw) {
  let m = /^block:([A-Za-z][A-Za-z0-9]{0,5})$/.exec(raw);
  if (m) return { kind: 'block', block: m[1], raw };
  m = /^family:(\d{1,9})$/.exec(raw);
  if (m) return { kind: 'family', family: Number(m[1]), raw };
  m = /^line:(\d{1,10})$/.exec(raw);
  if (m && Number(m[1]) <= 0xffffffff) return { kind: 'line', line: Number(m[1]), raw };
  return null;
}

export function readLink(search, graphIds) {
  const q = new URLSearchParams(search);
  const out = { warnings: [], asked: [] };
  const seen = new Set(q.keys());
  for (const k of seen) {
    if (!PARAMS.includes(k)) out.warnings.push(`?${k}=${q.get(k)} is not a parameter this page reads (it reads ${PARAMS.join(', ')}); it was not used`);
    else if (q.getAll(k).length > 1) out.warnings.push(`?${k}= was given ${q.getAll(k).length} times; only the first, "${q.get(k)}", was used`);
  }
  const val = k => { const v = q.get(k); if (v === null) return null; if (v.trim() === '') { out.warnings.push(`?${k}= is empty; it was not used`); return null; } return v.trim(); };
  const graph = val('graph');
  if (graph !== null) {
    if (graphIds.includes(graph)) out.graph = graph;
    else out.warnings.push(`graph=${graph} is not a graph of the spider manifest (${graphIds.length} graphs listed); the default graph is drawn instead`);
  }
  const node = val('node');
  if (node !== null) { out.node = node; out.asked.push('node=' + node); }
  const key = val('key');
  if (key !== null) {
    const k = parseKey(key);
    if (k) { out.key = k; out.asked.push('key=' + key); }
    else out.warnings.push(`key=${key} is malformed: this page reads key=block:<Symbol>, key=family:<number> or key=line:<number>; it was not used`);
  }
  const repo = val('repo');
  if (repo !== null) {
    if (/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo) && !repo.split('/').includes('..')) out.repo = repo;
    else out.warnings.push(`repo=${repo} is malformed: this page reads repo=<owner>/<name>; it was not used`);
  }
  const path = val('path');
  if (path !== null) {
    const p = path.replace(/^\/+/, '');
    if (p.split('/').some(s => s === '..' || s === '.')) out.warnings.push(`path=${path} is malformed: a path may not contain "." or ".." segments; it was not used`);
    else if (!out.repo) out.warnings.push(`path=${path} needs a well-formed repo= beside it to name a file; it was not used`);
    else out.path = p;
  }
  if (out.repo) out.asked.push('repo=' + out.repo + (out.path ? ' path=' + out.path : ''));
  return out;
}

Spider Pane

A JavaScript module in the iterations folder of Galaxies Wafers that draws on a canvas. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.

rendergalaxies-wafers / iterations/32-spider-and-galaxy/spider-pane.mjs · lines 1–170 of 170 · pattern layout (shared by 42 files)

What it does
It draws its content. Defines 9 functions or classes, including createSpider, resize, layout, arc, clip. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
Out: canvas drawing.
Downstream impact
Used directly by 1 file: Iterations — 32 Spider and Galaxy (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/). Reached from 90 other entry points, including Iterations — 32 Spider and Galaxy Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html).
What it achieves
It creates spider (`createSpider`) and is built from the resize step (`resize`) and the layout step (`layout`). The spider's graph drawn on one canvas, radial as the spider draws it: the focus card in the centre, what it points to on the right, what points to it on the left. It responds to pointerdown and pointerup events.
Why it matters
Imported by Iterations — 32 Spider and Galaxy.
Application
galaxies-wafers · iterations/32-spider-and-galaxy · JavaScript module
Uses
none found
Used by
imported by Iterations — 32 Spider and Galaxy (import)
Produces
createSpider
Defines here
createSpider, resize, layout, arc, clip, draw, P, label, pick
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/32-spider-and-galaxy/spider-pane.mjs:1-170 · blob b98184117699e5abba492570736a0f102d48b45f · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
/* spider-pane.mjs — the spider's graph drawn on one canvas, radial as the
 * spider draws it: the focus card in the centre, what it points to on the
 * right, what points to it on the left, every other node of the graph on an
 * outer ring. No DOM node per spider node: one canvas, redrawn on change.
 *
 * Colours: edge colours are the spider's own edge-type palette (index.html
 * --e-data, --e-governance, --e-archive, --e-external, --e-repo, --e-workflow).
 * Node fill is one neutral colour; the spider's rag field is printed as its
 * own status label beside the name, never used as a fill.
 * The ring round a node is the bridge: solid beam blue when the numbered
 * universe holds a counterpart, dashed grey when the node names a repository,
 * path, block or family the universe does not hold, none when it names nothing.
 */
const ECSS = { data: '#00e5ff', governance: '#b47cff', archive: '#7da0c8', external: '#5f76a4', repo: '#b8ccff', workflow: '#00ffff', contains: '#7da0c8' };
const MAX_EDGES = 4000;     /* faint background edges drawn per frame */
const MAX_LABELS = 28;      /* neighbour labels drawn around the focus */

export function createSpider(pane, { onTap }) {
  const cv = document.createElement('canvas');
  cv.className = 'sgraph';
  pane.append(cv);
  const S = { nodes: [], edges: [], focus: 0, bridge: [], highlight: new Map(), pos: null, w: 0, h: 0, dpr: 1 };

  function resize() {
    S.dpr = Math.min(window.devicePixelRatio || 1, 2);
    S.w = pane.clientWidth; S.h = pane.clientHeight;
    cv.width = Math.max(1, Math.round(S.w * S.dpr)); cv.height = Math.max(1, Math.round(S.h * S.dpr));
    layout(); draw();
  }
  new ResizeObserver(resize).observe(pane);

  function layout() {
    const n = S.nodes.length;
    S.pos = new Float32Array(n * 2);
    if (!n) return;
    const cx = S.w / 2, cy = S.h / 2, m = Math.min(S.w, S.h);
    const R1 = m * 0.28, R2 = m * 0.46;
    const out = [], inc = [], seen = new Set([S.focus]);
    for (const [a, b] of S.edges) {
      if (a === S.focus && !seen.has(b)) { out.push(b); seen.add(b); }
    }
    for (const [a, b] of S.edges) {
      if (b === S.focus && !seen.has(a)) { inc.push(a); seen.add(a); }
    }
    S.out = out; S.inc = inc; S.near = new Set([...out, ...inc]);
    const arc = (list, a0, a1) => list.forEach((idx, k) => {
      const t = list.length === 1 ? (a0 + a1) / 2 : a0 + (a1 - a0) * k / (list.length - 1);
      S.pos[idx * 2] = cx + R1 * Math.cos(t); S.pos[idx * 2 + 1] = cy + R1 * Math.sin(t);
    });
    arc(out, -1.35, 1.35);                  /* right: what the focus points to */
    arc(inc, Math.PI + 1.35, Math.PI - 1.35); /* left: what points to the focus */
    S.pos[S.focus * 2] = cx; S.pos[S.focus * 2 + 1] = cy;
    const rest = [];
    for (let i = 0; i < n; i++) if (!seen.has(i)) rest.push(i);
    rest.forEach((idx, k) => {
      const t = -Math.PI / 2 + 2 * Math.PI * k / rest.length;
      S.pos[idx * 2] = cx + R2 * Math.cos(t); S.pos[idx * 2 + 1] = cy + R2 * Math.sin(t);
    });
  }

  const clip = (s, k) => (s.length > k ? s.slice(0, k - 1) + '…' : s);

  function draw() {
    const c = cv.getContext('2d');
    c.setTransform(S.dpr, 0, 0, S.dpr, 0, 0);
    c.clearRect(0, 0, S.w, S.h);
    const n = S.nodes.length;
    if (!n || !S.pos) return;
    const P = i => [S.pos[i * 2], S.pos[i * 2 + 1]];
    /* background edges, faint, capped */
    c.lineWidth = 0.6; c.globalAlpha = 0.09; c.strokeStyle = '#b8ccff';
    c.beginPath();
    let k = 0;
    for (const [a, b] of S.edges) {
      if (a === S.focus || b === S.focus) continue;
      if (++k > MAX_EDGES) break;
      const [x0, y0] = P(a), [x1, y1] = P(b); c.moveTo(x0, y0); c.lineTo(x1, y1);
    }
    c.stroke();
    /* the focus's own edges in the spider's edge colours */
    c.globalAlpha = 0.85; c.lineWidth = 1.2;
    for (const [a, b, t] of S.edges) {
      if (a !== S.focus && b !== S.focus) continue;
      const [x0, y0] = P(a), [x1, y1] = P(b);
      c.strokeStyle = ECSS[t] || ECSS.repo; c.beginPath(); c.moveTo(x0, y0); c.lineTo(x1, y1); c.stroke();
    }
    c.globalAlpha = 1;
    /* nodes */
    for (let i = 0; i < n; i++) {
      const [x, y] = P(i);
      const isF = i === S.focus, near = S.near.has(i);
      const r = isF ? 8 : near ? 5 : 2.4;
      const b = S.bridge[i];
      if (b && (isF || near || S.highlight.has(i))) {
        c.lineWidth = 1.4;
        if (b === 'known') { c.setLineDash([]); c.strokeStyle = '#5ec8f2'; }
        else if (b === 'unknown' || b === 'pending') { c.setLineDash([3, 3]); c.strokeStyle = '#8b93a7'; }
        if (b !== 'none') { c.beginPath(); c.arc(x, y, r + 3.5, 0, 6.2832); c.stroke(); }
        c.setLineDash([]);
      } else if (b === 'known') {
        c.fillStyle = '#5ec8f2'; c.globalAlpha = 0.55; c.beginPath(); c.arc(x, y, r + 1.4, 0, 6.2832); c.fill(); c.globalAlpha = 1;
      }
      c.fillStyle = isF ? '#eef2fb' : near ? '#b8ccff' : '#6d7890';
      c.beginPath(); c.arc(x, y, r, 0, 6.2832); c.fill();
      if (S.highlight.has(i)) { c.strokeStyle = '#ffd54a'; c.lineWidth = 2; c.beginPath(); c.arc(x, y, r + 7, 0, 6.2832); c.stroke(); }
    }
    /* labels: focus, neighbours up to the cap, highlighted nodes */
    c.font = '11px ui-monospace,Menlo,Consolas,monospace'; c.textBaseline = 'middle';
    const label = (i, bright) => {
      const nd = S.nodes[i], [x, y] = P(i);
      const right = x >= S.w / 2 - 1;
      const text = clip(nd.label, S.w < 520 ? 15 : 22), tag = ' · ' + nd.rag;
      c.textAlign = right ? 'left' : 'right';
      const dx = right ? 10 : -10;
      c.fillStyle = '#0b0d12'; c.globalAlpha = 0.75;
      const wT = c.measureText(text + tag).width;
      c.fillRect(right ? x + dx - 2 : x + dx - wT - 2, y - 7, wT + 4, 14); c.globalAlpha = 1;
      if (right) {
        c.fillStyle = bright ? '#eef2fb' : '#c6cedd'; c.fillText(text, x + dx, y);
        c.fillStyle = '#8b93a7'; c.fillText(tag, x + dx + c.measureText(text).width, y);
      } else {
        c.fillStyle = '#8b93a7'; c.fillText(tag, x + dx, y);
        c.fillStyle = bright ? '#eef2fb' : '#c6cedd'; c.fillText(text, x + dx - c.measureText(tag).width, y);
      }
    };
    let shown = 0;
    for (const i of S.near) { if (shown++ >= MAX_LABELS) break; label(i, false); }
    for (const i of S.highlight.keys()) label(i, true);
    /* the focus label sits under its node, centred */
    { const nd = S.nodes[S.focus], [x, y] = P(S.focus); c.textAlign = 'center'; c.fillStyle = '#eef2fb';
      c.font = '12px ui-monospace,Menlo,Consolas,monospace'; c.fillText(clip(nd.label, 34), x, y + 20);
      c.fillStyle = '#8b93a7'; c.font = '10.5px ui-monospace,Menlo,Consolas,monospace';
      c.fillText('status label: ' + nd.rag, x, y + 34); }
    if (S.near.size > MAX_LABELS) {
      c.textAlign = 'left'; c.fillStyle = '#8b93a7'; c.font = '10.5px ui-monospace,Menlo,Consolas,monospace';
      c.fillText(`${MAX_LABELS} of ${S.near.size} neighbour labels drawn`, 8, S.h - 10);
    }
  }

  function pick(cx, cy, reach = 22) {
    let best = -1, bestD = reach * reach;
    for (let i = 0; i < S.nodes.length; i++) {
      const dx = S.pos[i * 2] - cx, dy = S.pos[i * 2 + 1] - cy, d = dx * dx + dy * dy;
      /* the focus and its neighbours win ties against the dense outer ring */
      const bias = (i === S.focus || S.near.has(i)) ? 0.6 : 1;
      if (d * bias < bestD) { bestD = d * bias; best = i; }
    }
    return best;
  }

  let down = null;
  cv.addEventListener('pointerdown', e => { down = [e.clientX, e.clientY]; });
  cv.addEventListener('pointerup', e => {
    if (!down) return;
    const moved = Math.abs(e.clientX - down[0]) + Math.abs(e.clientY - down[1]); down = null;
    if (moved > 8) return;
    const b = cv.getBoundingClientRect();
    const i = pick(e.clientX - b.left, e.clientY - b.top);
    if (i >= 0) onTap?.(i);
  });

  return {
    setGraph(g, bridge) { S.nodes = g.nodes; S.edges = g.edges; S.focus = 0; S.bridge = bridge || []; S.highlight = new Map(); resize(); },
    setBridge(bridge) { S.bridge = bridge; draw(); },
    focus(i) { S.focus = i; S.highlight = new Map(); layout(); draw(); },
    highlight(list) { S.highlight = new Map(list); draw(); },
    screenOf(i) { const b = cv.getBoundingClientRect(); return [b.left + S.pos[i * 2], b.top + S.pos[i * 2 + 1]]; },
    get state() { return S; }
  };
}

Iterations — 32 Spider and Galaxy Style Sheet

A style sheet in Galaxies Wafers. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.

rendergalaxies-wafers / iterations/32-spider-and-galaxy/style.css · lines 1–71 of 71 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Downstream impact
Used directly by 1 file: Iterations — 32 Spider and Galaxy Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/). Reached from 89 other entry points, including Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.
What it achieves
Phone first: the two views stacked, the answer strip and the drawers below them in one scrolling column.
Why it matters
Loaded by the 32 Spider and Galaxy page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.
Application
galaxies-wafers · iterations/32-spider-and-galaxy · style sheet
Uses
none found
Used by
loaded by Iterations — 32 Spider and Galaxy Page (stylesheet)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/32-spider-and-galaxy/style.css:1-71 · blob fbe8894b366eeb68052fcd24f5839fb939765952 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
/* Spider and Galaxy. Phone first: the two views stacked, the answer strip and
   the drawers below them in one scrolling column. Desktop: side by side. */
:root{
  --ink:#d8dee9; --dim:#8b93a7; --ground:#0b0d12; --edge:#1b2030;
  --lit:#ffd54a; --beam:#5ec8f2; --panel:#0e121b;
  --top:env(safe-area-inset-top,0px); --bot:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box}
html,body{margin:0; background:var(--ground); color:var(--ink)}
body{font:13px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; -webkit-text-size-adjust:100%;
  padding:var(--top) 0 var(--bot)}
.dim{color:var(--dim)}
a{color:var(--beam)}

#bar{display:flex; gap:.6rem; align-items:baseline; flex-wrap:wrap; padding:.5rem .75rem .35rem}
#wordmark{letter-spacing:.14em; font-size:11px}
#bridgeLine{font-size:11.5px}
#bridgeLine b{color:var(--beam); font-weight:600}

#split{display:grid; grid-template-columns:1fr; gap:.4rem; padding:0 .4rem}
.pane{position:relative; border:1px solid var(--edge); border-radius:8px; overflow:hidden; background:#07090d;
  display:flex; flex-direction:column; min-width:0}
.ptitle{display:flex; gap:.35rem; align-items:center; flex-wrap:wrap; padding:.35rem .45rem; border-bottom:1px solid var(--edge); font-size:11px}
.ptitle select,.ptitle input,.ptitle button{font:inherit; font-size:12px; background:#11151f; color:var(--ink);
  border:1px solid var(--edge); border-radius:6px; padding:.35rem .45rem; min-width:0}
.ptitle select{flex:1 1 9rem; max-width:100%}
.ptitle input{flex:1 1 6rem; font-size:16px; padding:.2rem .45rem}
.ptitle button{color:var(--beam); border-color:#2a4a5c; cursor:pointer}
.tag{color:var(--dim)}
.stage{position:relative; height:46vh; min-height:280px; touch-action:none}
.stage canvas{position:absolute; inset:0; width:100%; height:100%; display:block}
.stage .wover{touch-action:none}
.sgraph{touch-action:manipulation}
.pfoot{font-size:10.5px; padding:.25rem .45rem; border-top:1px solid var(--edge); min-height:1.9em; overflow-wrap:anywhere}

#say{margin:.4rem; padding:.55rem .7rem; border:1px solid var(--edge); border-radius:8px; background:var(--panel); min-height:3.2em}
#say h2{margin:0 0 .3rem; font-size:14px; font-weight:600}
#say h2 .n{color:var(--lit)}
#say dl{display:grid; grid-template-columns:auto 1fr; gap:.1rem .6rem; margin:.35rem 0}
#say dt{color:var(--dim)}
#say dd{margin:0; overflow-wrap:anywhere}
#say p{margin:.3rem 0 0}
#say ul{margin:.25rem 0 0; padding-left:1.1rem}
#linkBox{border-bottom:1px dashed var(--edge); padding-bottom:.35rem; margin-bottom:.35rem; overflow-wrap:anywhere}
#linkBox p{margin:0}
.refuse{color:var(--lit)}
.known{color:var(--beam)}

#drawers{margin:0 .4rem .8rem; display:flex; flex-direction:column; gap:.35rem}
details{border:1px solid var(--edge); border-radius:8px; background:var(--panel); padding:.45rem .7rem}
summary{cursor:pointer; letter-spacing:.08em; font-size:12px; color:var(--ink)}
details ol,details ul{padding-left:1.2rem; margin:.4rem 0}
details li{margin:.3rem 0}
details p{margin:.35rem 0}
.machine{border-top:1px dashed var(--edge); padding-top:.35rem; font-size:11.5px}
table.t{border-collapse:collapse; font-size:11px; width:100%}
table.t th,table.t td{border-bottom:1px solid var(--edge); padding:.15rem .3rem; text-align:left; vertical-align:top}
.twrap{overflow-x:auto}

.mapbtn{display:inline-block; font-weight:600; letter-spacing:.08em; color:#0b0d12; background:var(--beam); border-radius:5px; padding:.2rem .6rem; text-decoration:none}
.pagelist{list-style:none; padding-left:0}
.pagelist li{border-bottom:1px solid var(--edge); padding:.2rem 0; overflow-wrap:anywhere}
#aBody button,#uBody button{font:inherit; font-size:11.5px; background:#11151f; color:var(--beam); border:1px solid #2a4a5c; border-radius:5px; padding:.25rem .45rem; cursor:pointer; text-align:left; max-width:100%; overflow-wrap:anywhere}
#uBody .tabs button.on{color:var(--ink); border-color:var(--beam)}
.classes li{margin:.35rem 0}

@media (min-width:760px){
  #split{grid-template-columns:1fr 1fr; padding:0 .6rem}
  .stage{height:calc(100vh - 12.5rem); min-height:360px}
  #say,#drawers{margin-left:.6rem; margin-right:.6rem}
}

Unknown Paths

A JavaScript module in the iterations folder of Galaxies Wafers that adds bucket (`addBucket`). Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/.

transformgalaxies-wafers / iterations/32-spider-and-galaxy/unknown-paths.mjs · lines 1–84 of 84 · pattern holds (shared by 4 files)

What it does
It calculates its inputs. Defines 6 functions or classes, including extOf, shapeOf, newIndex, addBucket, holds.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Downstream impact
Used directly by 1 file: Iterations — 32 Spider and Galaxy (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/). Reached from 90 other entry points, including Iterations — 32 Spider and Galaxy Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/32-spider-and-galaxy/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html).
What it achieves
It adds bucket (`addBucket`) and is built from the ext of helper (`extOf`) and the shape of helper (`shapeOf`). Why a spider repository or path is unknown to the numbered universe, measured, never guessed.
Why it matters
Imported by Iterations — 32 Spider and Galaxy.
Application
galaxies-wafers · iterations/32-spider-and-galaxy · JavaScript module
Uses
none found
Used by
imported by Iterations — 32 Spider and Galaxy (import)
Produces
extOf, shapeOf, newIndex, addBucket, holds, CLASS_TEXT, classify
Defines here
extOf, shapeOf, newIndex, addBucket, holds, classify
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/32-spider-and-galaxy/unknown-paths.mjs:1-84 · blob c22d30cb77af620e52de69ca9a15d7f92493a163 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
/* unknown-paths.mjs — why a spider repository or path is unknown to the
 * numbered universe, measured, never guessed. No DOM and no fetch, so the page
 * and the tests import the same code.
 *
 * A path is "unknown" when the bridge (bridge.mjs counterpart) finds no file of
 * the live block register at or under it. Each unknown is put in the first
 * class that measures true, in this order:
 *   1 not code by file type: its extension is not one the numbered database
 *     reads. The extensions it reads are measured from the pack's own source
 *     (every place path of every family in the code-index buckets the pack's
 *     provenance.json lists), not typed here.
 *   2 in a repository the pack does not scan: no place of any family lies in
 *     that repository.
 *   3 in a scanned repository, absent from the pack: no place at that path
 *     (or, for a folder or a path with no extension, under it).
 *   4 held by the pack: a family has a place there; only the live register
 *     records no block file for it.
 */

export function extOf(path) {
  const m = /\.([A-Za-z0-9]{1,8})$/.exec(String(path || '').split('/').pop() || '');
  return m ? m[1].toLowerCase() : null;
}

/* The shape of what a node names: a whole repository, a folder, or a file. */
export function shapeOf(n, ref) {
  if (!ref.path) return 'repository';
  if (ref.path.endsWith('/') || /\/tree\//.test(n.gh || '')) return 'folder';
  return extOf(ref.path) ? 'file' : 'path with no extension';
}

/* An index of the places of a code-index generation. */
export function newIndex() { return { repos: new Map(), paths: new Set(), exts: new Map(), sorted: null, families: 0, places: 0, short: 0, maxPlaces: 0 }; }

/* Add one code-index bucket ({ "<n>": { places: [{repo, path}] } }). */
export function addBucket(ix, bucket) {
  for (const f of Object.values(bucket || {})) {
    ix.families++;
    const pl = Array.isArray(f?.places) ? f.places.length : 0;
    ix.maxPlaces = Math.max(ix.maxPlaces, pl);
    if (Number.isFinite(f?.files) && f.files > pl) ix.short++;   /* a family listing fewer places than files it is in */
    for (const p of f?.places || []) {
      if (!p?.repo || typeof p.path !== 'string') continue;
      const r = p.repo.toLowerCase();
      ix.places++;
      ix.repos.set(r, (ix.repos.get(r) || 0) + 1);
      ix.paths.add(r + '\t' + p.path);
      const e = extOf(p.path);
      if (e) ix.exts.set(e, (ix.exts.get(e) || 0) + 1);
    }
  }
  ix.sorted = null;
}

/* Is there a place at this path, or (folder) under it? */
export function holds(ix, repo, path, shape) {
  const r = repo.toLowerCase();
  if (!ix.repos.has(r)) return false;
  if (shape === 'repository') return true;
  const p = path.replace(/\/+$/, '');
  if (shape !== 'folder' && ix.paths.has(r + '\t' + p)) return true;
  if (shape === 'file') return false;
  if (!ix.sorted) ix.sorted = [...ix.paths].sort();
  const pre = r + '\t' + p + '/';
  let lo = 0, hi = ix.sorted.length;
  while (lo < hi) { const mid = (lo + hi) >> 1; if (ix.sorted[mid] < pre) lo = mid + 1; else hi = mid; }
  return lo < ix.sorted.length && ix.sorted[lo].startsWith(pre);
}

export const CLASS_TEXT = {
  1: 'The numbered database numbers the lines of source files it reads, and this extension is not one of them, so the path can never be numbered by design.',
  2: 'Code or a folder in a repository the numbered database does not scan: no function family in the pack has a place anywhere in that repository.',
  3: 'In a repository the pack scans, but no function family in the pack has a place at this path (or under it, for a folder).',
  4: 'Held by the pack: a function family has a place at this path, or the repository is scanned. Only the live block register records no block file here, which is what made the bridge call it unknown.'
};

/* Put one unknown in its class. item: {repo, path, shape}. */
export function classify(item, pack) {
  const e = item.shape === 'file' ? extOf(item.path) : null;
  if (e && !pack.exts.has(e)) return { cls: 1, why: `.${e} is not an extension the pack reads (it reads ${[...pack.exts.keys()].map(x => '.' + x).join(', ')})` };
  if (!pack.repos.has(item.repo.toLowerCase())) return { cls: 2, why: `no family in the pack has a place in ${item.repo}` };
  if (!holds(pack, item.repo, item.path, item.shape)) return { cls: 3, why: `${item.repo} is scanned (${pack.repos.get(item.repo.toLowerCase())} places), none ${item.shape === 'file' ? 'at' : 'at or under'} this ${item.shape}` };
  return { cls: 4, why: item.shape === 'repository' ? `the pack scans ${item.repo}` : `the pack has a place ${item.shape === 'file' ? 'at' : 'under'} this ${item.shape}` };
}