GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Kuiper, cosmos and drawing engines / cosmic / tools/explore/repokuiper

Repokuiper Speed and 1 more file

A JavaScript module in the explore folder of Cosmic that draws lookup. It indexes lookup (`indexLookup`), gets index API (`getIndexApi`) and saves taps (`saveTaps`).

417 lines of JavaScript and CSS from cosmic, in 2 files. Topic: Kuiper, cosmos and drawing engines. Section 1132 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. Repokuiper Speed render · cosmic / tools/explore/repokuiper/repokuiper-speed.js lines 1–345
  2. Repokuiper render · cosmic / tools/explore/repokuiper/repokuiper.css lines 1–72

Repokuiper Speed

A JavaScript module in the explore folder of Cosmic that draws lookup. It indexes lookup (`indexLookup`), gets index API (`getIndexApi`) and saves taps (`saveTaps`).

rendercosmic / tools/explore/repokuiper/repokuiper-speed.js · lines 1–345 of 345 · Not reached from any entry point (candidate for review) · pattern encPath (shared by 2 files)

What it does
It draws lookup. Defines 35 functions or classes, including encPath, score, indexLookup, search, handTaps. Side effects: changes the web page (DOM); reads or writes files; makes network requests; uses storage (browser storage, DuckDB or Parquet).
Inputs & outputs
In: JSON file lookup.json; JSON file index.json; browser storage (getItem); form fields (user input). Out: browser storage (setItem).
What it achieves
`repokuiper-speed.js` (K5, TACHYON-29): light speed for people, on window.KUIPER (CONTRACT v1) and the static agent API `kuiper/api/` (`kuiper_api.py`). It reads `api/lookup.json`. It responds to pointerdown, input and keydown events.
Why it matters
No other file in the estate was found to import it.
Application
cosmic · tools/explore/repokuiper · JavaScript module
Uses
none found
Used by
none found
Produces
encPath, score, indexLookup, search, handTaps, reduced, absURL, load, apiRow, get, getIndexApi, saveTaps
Defines here
encPath, score, indexLookup, search, handTaps, reduced, absURL, load, apiRow, get, getIndexApi, saveTaps, toast, navPresent, arrive, goFile, open, goRepo, render, openPalette, closePalette, pick, trailPush, refName, showUses, fill, showRepoUses, agentText, copy, done
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/repokuiper/repokuiper-speed.js:1-345 · blob 815675a25b36414e69481a81c0180b55b34f0a42 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: unknown · users: none · canonical: unreached_review
// repokuiper-speed.js (K5, TACHYON-29): light speed for people, on window.KUIPER (CONTRACT v1) and the static agent
// API kuiper/api/ (kuiper_api.py). The same lookup an agent fetches drives:
//  * a command palette (Ctrl/Cmd+K, k, or the "go" button on a phone) searching every file of every repository
//  * "where is X" jumps: on the estate page it flies across the galaxy into the repository's star, straight to the
//    file; on a repository page it flies to the file here, or opens the other repository's universe at that file
//  * "copy agent link" on each card: the exact human view (#file=), the key and the API row, for an agent or a person
//  * "what uses this": a one-tap trail through the files that load or use this one, across repositories
//  * a speed HUD: taps to reach this file with "go" versus by hand, and the taps you actually used
// Nothing is stored but the trail and the tap counter (sessionStorage). Vanilla, no dependencies, nothing fetched from elsewhere.
(() => {
'use strict';

// ------------------------------------------------------------------ pure helpers (also unit-tested from node)
const encPath = (p) => String(p).split('/').map(encodeURIComponent).join('/');
// score a lowercased name/path against a lowercased query: higher is better, -1 = no match
function score(name, path, q, noFuzzy, ws) {
  if (!q) return -1;
  let s;
  if (name === q) s = 1000;
  else if (name.startsWith(q)) s = 800;
  else if (name.includes(q)) s = 600 - Math.min(100, name.indexOf(q));
  else if (path.includes(q)) s = 400 - Math.min(100, path.indexOf(q));
  else {
    // every word of the query somewhere in the path ("cable visualiser"), else a compact subsequence
    if (ws === undefined) ws = q.split(/\s+/).filter(Boolean);
    if (ws.length > 1 && ws.every((w) => path.includes(w))) s = 300;
    else {
      if (noFuzzy) return -1;
      let j = 0, first = -1, last = -1;
      for (let i = 0; i < path.length && j < q.length; i++) if (path[i] === q[j]) { if (first < 0) first = i; last = i; j++; }
      if (j < q.length) return -1;
      s = Math.max(1, 200 - (last - first - q.length + 1) * 4);
    }
  }
  return s - Math.min(60, path.length / 4);
}
// flatten api/lookup.json into a search index: [slug, i, path, lowerName, lowerPath]
function indexLookup(L) {
  const ix = [], paths = {};
  for (const slug of Object.keys(L.paths || {})) {
    const m = L.paths[slug], arr = paths[slug] = [];
    for (const p of Object.keys(m)) {
      const i = m[p]; arr[i] = p;
      const lp = (slug + '/' + p).toLowerCase();
      ix.push([slug, i, p, lp.slice(lp.lastIndexOf('/') + 1), lp]);
    }
  }
  return { ix, paths };
}
function search(S, q, here, limit) {
  q = String(q || '').trim().toLowerCase();
  if (!q || !S) return [];
  const res = [];
  const W = S.L && S.L.vedic && S.L.vedic[q.toUpperCase()];
  if (W) for (const id of W.slice(0, 12)) { const [s, i] = id.split(':'); const p = S.paths[s] && S.paths[s][+i]; if (p != null) res.push([2000, [s, +i, p, '', ''], 'VEDIC ' + q.toUpperCase()]); }
  for (const slug of Object.keys(S.paths)) if (slug.includes(q)) res.push([slug === q ? 1100 : slug.startsWith(q) ? 850 : 450, [slug, -1, '', slug, slug], 'repository']);
  let n = 0;
  const ws = q.split(/\s+/).filter(Boolean);
  for (const e of S.ix) {
    const s = score(e[3], e[4], q, true, ws);
    if (s >= 0) {
      res.push([s + (e[0] === here ? 40 : 0), e, '']); n++;
      if (res.length > 400) { res.sort((a, b) => b[0] - a[0]); res.length = limit || 40; }   // keep a running top list
    }
  }
  if (n === 0 && q.length > 1) {   // fuzzy (subsequence) only when the plain match finds nothing
    const seen = new Set(res.map((r) => r[1]));
    for (const e of S.ix) { if (seen.has(e)) continue; const s = score(e[3], e[4], q, false, ws); if (s >= 0) res.push([s + (e[0] === here ? 40 : 0), e, '']); }
  }
  res.sort((a, b) => b[0] - a[0] || (a[1][4] < b[1][4] ? -1 : 1));
  return res.slice(0, limit || 40);
}
// taps by hand from the top of a universe: one tap into each folder on the way, one on the body
const handTaps = (depth) => depth + 1;
const api = { score, indexLookup, search, encPath, handTaps };
if (typeof window !== 'undefined') window.__rkSpeed = api;
if (typeof module !== 'undefined' && module.exports) module.exports = api;
if (typeof window === 'undefined' || !window.KUIPER || typeof document === 'undefined') return;

// ------------------------------------------------------------------ the module
window.KUIPER.use('speed', function speed(K) {
  const D = K.D, A = K.arr, IDX = !!K.isIndex, esc = K.esc, fmt = K.fmt;
  const here = IDX ? '' : String(D.repo || '').toLowerCase();
  const reduced = () => !!K.reducedMotion;
  const absURL = (u) => { try { return new URL(u, location.href).href; } catch (e) { return u; } };
  let S = null, loading = null;
  function load() {
    if (S) return Promise.resolve(S);
    return loading || (loading = fetch('api/lookup.json').then((r) => (r.ok ? r.json() : null)).catch(() => null).then((L) => {
      if (!L) return null;
      S = indexLookup(L); S.L = L; return S;
    }));
  }
  const rowCache = {};
  function apiRow(slug, i) {
    const k = slug + ':' + i;
    if (rowCache[k]) return rowCache[k];
    const get = (u) => fetch('api/' + u).then((r) => (r.ok ? r.json() : null)).catch(() => null);
    return (rowCache[k] = get(slug + '.json').then((d) => {
      if (!d) return null;
      if (d.rows) return { row: d.rows[i], file: slug + '.json', at: i };
      const sh = d.shards && d.shards[Math.floor(i / d.shard)];
      return sh ? get(sh.file).then((p) => (p ? { row: p.rows[i - sh.from], file: sh.file, at: i - sh.from } : null)) : null;
    }));
  }
  let indexApi = null;
  const getIndexApi = () => indexApi || (indexApi = fetch('api/index.json').then((r) => (r.ok ? r.json() : null)).catch(() => null));

  // ---------------------------------------------------------------- taps (the HUD's "you used")
  const TK = 'kuiper-speed-taps';
  let taps = +(sessionStorage.getItem(TK) || 0), lastUsed = null, inFlight = false;
  const saveTaps = () => { try { sessionStorage.setItem(TK, String(taps)); } catch (e) { /* private mode */ } };
  document.addEventListener('pointerdown', (e) => { if (e.isPrimary !== false) { taps++; saveTaps(); } }, true);

  // ---------------------------------------------------------------- toast
  let toastT = 0;
  function toast(msg) {
    const t = K.panel('speed-toast'); t.classList.add('sp-toast'); t.textContent = msg; t.hidden = false;
    clearTimeout(toastT); toastT = setTimeout(() => { t.hidden = true; }, 2600);
  }

  // ---------------------------------------------------------------- jumps
  const navPresent = () => !!document.getElementById('kb-nav-search');
  const slugToBody = new Map();
  if (IDX) for (let i = 0; i < K.NB; i++) slugToBody.set(String(D.files[i][0]).toLowerCase(), i);
  function arrive() { lastUsed = taps; taps = 0; saveTaps(); }
  function goFile(slug, i, path) {
    if (i < 0) return goRepo(slug);
    trailPush(slug, i, path);
    if (!IDX && slug === here) {
      const hit = K.findPath(path);
      if (!hit) { toast('Not in this universe: ' + path); return; }
      if (navPresent()) location.hash = '#file=' + encPath(path);     // K2 flies (pull out, dive in) and keeps history
      else { K.centreOn(hit.i); K.select(hit.i, -1); }
      return;
    }
    if (IDX && slugToBody.has(slug)) {
      const b = slugToBody.get(slug), gx = window.__gx;
      toast('flying to ' + D.files[b][0] + ' / ' + path);
      if (gx && gx.enterRepo && gx.goFile) {                           // K4: into the star, straight to the file
        inFlight = true;
        gx.enterRepo(b, 0).then((r) => { inFlight = false; if (r) { gx.goFile(b, i); arrive(); hud(); } else open(slug, path); });
        return;
      }
      K.select(b, -1); K.centreOn(b);
      setTimeout(() => open(slug, path), reduced() ? 0 : 650);
      return;
    }
    open(slug, path);
  }
  function open(slug, path) { location.href = slug + '.html' + (path ? '#file=' + encPath(path) : ''); }
  function goRepo(slug) {
    if (IDX && slugToBody.has(slug)) { const b = slugToBody.get(slug); K.select(b, -1); K.centreOn(b); return; }
    if (slug !== here) open(slug, '');
  }

  // ---------------------------------------------------------------- the palette
  const P = K.panel('speed'); P.classList.add('sp-pal'); P.setAttribute('role', 'dialog'); P.setAttribute('aria-label', 'go to any file');
  P.innerHTML = '<div class="sp-row"><input class="sp-q" type="search" autocomplete="off" spellcheck="false" enterkeyhint="go" '
    + 'placeholder="go to any file, repo or VEDIC word" aria-label="go to any file"><button class="sp-btn" data-sp="close" aria-label="close">&#215;</button></div>'
    + '<div class="sp-sub sp-status">all repositories &middot; Ctrl/Cmd+K</div><ol class="sp-list" role="listbox"></ol>';
  const Q = P.querySelector('.sp-q'), LIST = P.querySelector('.sp-list'), STATUS = P.querySelector('.sp-status');
  let hits = [], at = 0, btn = null;
  function render() {
    if (!S) { STATUS.textContent = loading ? 'loading the estate lookup…' : 'the agent API (api/lookup.json) is not available here'; LIST.innerHTML = ''; return; }
    const q = Q.value;
    const t0 = performance.now();
    hits = q.trim() ? search(S, q, here, 40) : [];
    const ms = performance.now() - t0;
    at = Math.min(at, Math.max(0, hits.length - 1));
    STATUS.textContent = q.trim() ? `${hits.length >= 40 ? '40+' : hits.length} matches across ${Object.keys(S.paths).length} repositories in ${ms.toFixed(1)} ms` + (hits.length ? ' · Enter or tap to fly' : '')
      : `${fmt(S.ix.length)} files in ${Object.keys(S.paths).length} repositories · type part of a name or path`;
    LIST.innerHTML = hits.map((h, k) => {
      const e = h[1], name = e[2] ? e[2].slice(e[2].lastIndexOf('/') + 1) : e[0];
      const dir = e[2] ? e[0] + ' / ' + e[2].slice(0, Math.max(0, e[2].lastIndexOf('/'))) : 'open its universe';
      return `<li role="option" class="${k === at ? 'on' : ''}" data-sp-go="${k}"><span class="sp-main">${esc(name)}${h[2] ? ` <em>${esc(h[2])}</em>` : ''}</span><span class="sp-sub">${esc(dir)}</span></li>`;
    }).join('');
    const on = LIST.children[at]; if (on && on.scrollIntoView) on.scrollIntoView({ block: 'nearest' });
  }
  function openPalette() {
    P.hidden = false; if (btn) K.setButtonOn('sp-go', true);
    Q.focus(); Q.select(); render();
    if (!S) load().then(render);
  }
  function closePalette() { P.hidden = true; if (btn) K.setButtonOn('sp-go', false); if (document.activeElement === Q) Q.blur(); }
  function pick(k) {
    const h = hits[k]; if (!h) return;
    closePalette(); goFile(h[1][0], h[1][1], h[1][2]);
  }
  Q.addEventListener('input', () => { at = 0; render(); });
  Q.addEventListener('keydown', (e) => {
    if (e.key === 'ArrowDown') { at = Math.min(hits.length - 1, at + 1); render(); e.preventDefault(); }
    else if (e.key === 'ArrowUp') { at = Math.max(0, at - 1); render(); e.preventDefault(); }
    else if (e.key === 'Enter') { pick(at); e.preventDefault(); }
    else if (e.key === 'Escape') { closePalette(); e.preventDefault(); e.stopPropagation(); }
  });
  btn = K.addButton({ id: 'sp-go', label: 'go', title: 'go to any file in any repository (Ctrl/Cmd+K or k)', toggle: true,
    onClick: (on) => (on ? openPalette() : closePalette()) });
  K.addKey('k', () => { openPalette(); return true; });
  window.addEventListener('keydown', (e) => {
    if ((e.ctrlKey || e.metaKey) && !e.altKey && String(e.key).toLowerCase() === 'k') { e.preventDefault(); P.hidden ? openPalette() : closePalette(); }
  }, true);
  // warm the lookup once the page is idle, so the first search is instant
  (window.requestIdleCallback || ((f) => setTimeout(f, 1200)))(() => load());

  // ---------------------------------------------------------------- "what uses this": a one-tap trail
  const TR = 'kuiper-speed-trail';
  let trail = [];
  try { trail = JSON.parse(sessionStorage.getItem(TR) || '[]').filter((x) => Array.isArray(x)).slice(-12); } catch (e) { trail = []; }
  function trailPush(slug, i, path) {
    const last = trail[trail.length - 1];
    if (last && last[0] === slug && last[1] === i) return;
    trail.push([slug, i, path]); trail = trail.slice(-12);
    try { sessionStorage.setItem(TR, JSON.stringify(trail)); } catch (e) { /* private mode */ }
  }
  const U = K.panel('speed-uses'); U.classList.add('sp-pal', 'sp-uses'); U.setAttribute('role', 'dialog'); U.setAttribute('aria-label', 'what uses this');
  let usesOf = null;
  function refName(ref, slug) {
    const s = typeof ref === 'string' ? ref.split(':')[0] : slug, i = typeof ref === 'string' ? +ref.split(':')[1] : ref;
    const p = S && S.paths[s] ? S.paths[s][i] : null;
    return [s, i, p == null ? (s === here && !IDX && i < K.NB ? K.bodyPath(i) : '') : p];
  }
  function showUses(slug, i, path) {
    usesOf = [slug, i, path]; U.hidden = false;
    U.innerHTML = `<div class="sp-row"><b class="sp-title">what uses ${esc(path.slice(path.lastIndexOf('/') + 1) || slug)}</b><button class="sp-btn" data-sp="uclose" aria-label="close">&#215;</button></div><div class="sp-sub">loading…</div>`;
    const crumbs = trail.slice(-6).map((t, k, a) => `<a href="#" data-sp-trail="${trail.length - a.length + k}">${esc(t[2].slice(t[2].lastIndexOf('/') + 1) || t[0])}</a>`).join(' &larr; ');
    const fill = (list, note) => {
      if (!usesOf || usesOf[0] !== slug || usesOf[1] !== i) return;
      const rows = list.map((r) => refName(r, slug)).filter((r) => r[2]);
      U.innerHTML = `<div class="sp-row"><b class="sp-title">what uses ${esc(path.slice(path.lastIndexOf('/') + 1))}</b><button class="sp-btn" data-sp="uclose" aria-label="close">&#215;</button></div>`
        + (crumbs ? `<div class="sp-sub sp-trail">trail: ${crumbs}</div>` : '')
        + `<div class="sp-sub">${rows.length ? rows.length + ' file' + (rows.length === 1 ? '' : 's') + ' load or import it' : 'nothing in the estate loads or imports it'}${note || ''} &middot; one tap to fly</div>`
        + `<ol class="sp-list">${rows.map((r) => `<li data-sp-use="${esc(r[0])}:${r[1]}"><span class="sp-main">${esc(r[2].slice(r[2].lastIndexOf('/') + 1))}</span><span class="sp-sub">${esc(r[0] + ' / ' + r[2])}</span></li>`).join('')}</ol>`;
    };
    if (slug === '' || i < 0) return;
    Promise.all([load(), apiRow(slug, i)]).then(([, r]) => {
      if (r && r.row) fill(r.row.used_by || []);
      else if (!IDX && slug === here) fill(Array.from(A.bin[i] || []), ' (inside this repository; the API is not available)');
      else fill([]);
    });
  }
  function showRepoUses(b) {
    const name = D.files[b][0], slug = String(name).toLowerCase();
    usesOf = [slug, -1, '']; U.hidden = false;
    U.innerHTML = `<div class="sp-row"><b class="sp-title">what uses ${esc(name)}</b><button class="sp-btn" data-sp="uclose" aria-label="close">&#215;</button></div><div class="sp-sub">loading…</div>`;
    getIndexApi().then((ix) => {
      const r = ix && ix.repos.find((x) => x.slug === slug), li = r ? r.links_in : [];
      U.innerHTML = `<div class="sp-row"><b class="sp-title">what uses ${esc(name)}</b><button class="sp-btn" data-sp="uclose" aria-label="close">&#215;</button></div>`
        + `<div class="sp-sub">${li.length ? li.length + ' repositories load or import its files' : 'no other repository loads or imports it'} &middot; one tap to fly</div>`
        + `<ol class="sp-list">${li.map((x) => `<li data-sp-repo="${esc(x[0])}"><span class="sp-main">${esc(x[0])}</span><span class="sp-sub">${fmt(x[1])} uses, mostly ${esc(x[2])}</span></li>`).join('')}</ol>`;
    });
  }

  // ---------------------------------------------------------------- copy agent link
  let lastCopied = '';
  function agentText(i) {
    if (IDX) {
      const name = D.files[i][0], slug = String(name).toLowerCase();
      return `${absURL(slug + '.html')}\nrepository ${name}@${D.files[i][15] || ''}\napi ${absURL('api/' + slug + '.json')} · estate ${absURL('api/index.json')} · guide ${absURL('llms-kuiper.txt')}`;
    }
    const p = K.bodyPath(i), f = D.files[i];
    return `${absURL(here + '.html#file=' + encPath(p))}\nkey ${D.repo}@${D.commit} ${p}:1-${f[3]}${f[9] ? ' blob ' + f[9] : ''}\nid ${here}:${i} · api ${absURL('api/' + here + '.json')} · guide ${absURL('llms-kuiper.txt')}`;
  }
  function copy(text) {
    lastCopied = text;
    const done = () => toast('agent link copied: view, key and API row');
    const fallback = () => {
      const ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.className = 'sp-clip';
      document.body.appendChild(ta); ta.select(); let ok = false; try { ok = document.execCommand('copy'); } catch (e) { ok = false; }
      ta.remove(); ok ? done() : toast('copy blocked by the browser; the link is ' + text.split('\n')[0]);
    };
    if (navigator.clipboard && window.isSecureContext) navigator.clipboard.writeText(text).then(done, fallback); else fallback();
  }

  // ---------------------------------------------------------------- the speed HUD
  const H = K.panel('speed-hud'); H.classList.add('sp-hud'); H.setAttribute('aria-live', 'polite');
  // by hand from the estate page: on a repository page add 2 (tap its star, tap "open its Kuiper")
  const depthOf = (i) => Math.max(0, A.fdepth[A.bfo[i]] - A.fdepth[K.homeFolder || 0]);
  const hand = (i) => handTaps(depthOf(i)) + (IDX ? 0 : 2);
  const tapsLine = (i) => ({ go: 2, hand: hand(i), used: lastUsed });
  let avgHand = 0;
  { let s = 0; for (let i = 0; i < K.NB; i++) s += hand(i); avgHand = K.NB ? s / K.NB : 0; }
  function hud() {
    const narrowCard = K.W < 760 && K.sel >= 0;
    if (K.sel >= 0) {
      const t = tapsLine(K.sel);
      H.innerHTML = `<b>${t.go}</b> taps with go &middot; <b>${t.hand}</b> by hand${t.used != null ? ` &middot; you: <b>${t.used}</b>` : ''}`;
    } else {
      H.innerHTML = `any file: <b>2</b> taps with <a href="#" data-sp="open">go</a> &middot; ${avgHand.toFixed(1)} by hand`;
    }
    H.hidden = narrowCard;   // on a phone the card carries the same line
  }
  K.on('select', () => { if (!inFlight) arrive(); hud(); if (!U.hidden && !IDX) { const p = K.bodyPath(K.sel); trailPush(here, K.sel, p); showUses(here, K.sel, p); } });
  K.on('deselect', hud);
  K.on('resize', hud);

  // ---------------------------------------------------------------- card section
  K.addCardSection('speed', (i) => {
    const t = tapsLine(i);
    const n = IDX ? '' : (A.bin[i] ? A.bin[i].length : 0);
    return `<div class="sp-card"><button class="sp-btn" data-sp="copy" data-i="${i}">copy agent link</button>`
      + `<button class="sp-btn" data-sp="uses" data-i="${i}">what uses this${n !== '' ? ` (${n}+)` : ''}</button></div>`
      + `<div class="sp-sub sp-cardhud">speed: <b>${t.go}</b> taps with go &middot; <b>${t.hand}</b> by hand${t.used != null ? ` &middot; you used <b>${t.used}</b>` : ''}</div>`;
  });

  // ---------------------------------------------------------------- clicks (our own elements only)
  document.addEventListener('click', (e) => {
    const el = e.target.closest('[data-sp],[data-sp-go],[data-sp-use],[data-sp-repo],[data-sp-trail]'); if (!el) return;
    e.preventDefault(); e.stopPropagation();
    const a = el.dataset;
    if (a.spGo != null) pick(+a.spGo);
    else if (a.spUse) { const [s, i] = a.spUse.split(':'); const r = refName(s + ':' + i, s); goFile(r[0], r[1], r[2]); if (r[0] !== here || IDX) U.hidden = true; }
    else if (a.spRepo) { U.hidden = true; goRepo(a.spRepo); }
    else if (a.spTrail != null) { const t = trail[+a.spTrail]; if (t) goFile(t[0], t[1], t[2]); }
    else if (a.sp === 'close') closePalette();
    else if (a.sp === 'uclose') { U.hidden = true; usesOf = null; }
    else if (a.sp === 'open') openPalette();
    else if (a.sp === 'copy') copy(agentText(+a.i));
    else if (a.sp === 'uses') {
      const i = +a.i;
      if (IDX) showRepoUses(i); else { const p = K.bodyPath(i); trailPush(here, i, p); showUses(here, i, p); }
    }
  });
  K.addKey('Escape', () => {
    if (!P.hidden) { closePalette(); return true; }
    if (!U.hidden) { U.hidden = true; return true; }
    return false;
  });

  // without K2, honour #file= ourselves (a jump from another repository's palette lands here)
  if (!navPresent() && !IDX && /^#file=/.test(location.hash)) {
    try { const hit = K.findPath(decodeURIComponent(location.hash.slice(6).split('&')[0])); if (hit && hit.kind === 'file') { K.centreOn(hit.i); K.select(hit.i, -1); } } catch (e) { /* malformed */ }
  }
  hud();

  // self-test surface (read by test_repokuiper_speed.py and bench_speed.py)
  const T = window.__rkSpeed;
  Object.assign(T, { ready: true, load, open: openPalette, close: closePalette, goFile, apiRow, agentText,
    find: (q) => search(S, q, here, 40).map((h) => [h[1][0], h[1][1], h[1][2]]), hand });
  Object.defineProperties(T, {
    lastCopied: { get: () => lastCopied, configurable: true }, taps: { get: () => taps, configurable: true },
    lastUsed: { get: () => lastUsed, configurable: true }, trail: { get: () => trail.slice(), configurable: true },
  });
});
})();

Repokuiper

A style sheet in the explore folder of Cosmic.

rendercosmic / tools/explore/repokuiper/repokuiper.css · lines 1–72 of 72 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
What it achieves
Black sky, cyan accents, links #66ccff, text #fff, muted #a6adbb.
Why it matters
No other file in the estate was found to import it.
Application
cosmic · tools/explore/repokuiper · style sheet
Uses
none found
Used by
none found
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
cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/repokuiper/repokuiper.css:1-72 · blob 40830b223d523ed94ed260beef088f45e4a3909e · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unreached_review
/* repokuiper: black sky, cyan accents, links #66ccff, text #fff, muted #a6adbb. Phone first. */
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:#000;color:#fff;overflow:hidden;
  font:13px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;-webkit-text-size-adjust:100%}
a{color:#66ccff}
code{color:#00ffff}
#sky{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;display:block;touch-action:none;cursor:crosshair}
#hud{position:fixed;left:0;right:0;top:0;padding:6px 8px calc(4px) 8px;padding-top:max(6px,env(safe-area-inset-top));
  background:linear-gradient(#000e,#0008 75%,#0000);pointer-events:none}
#hud *{pointer-events:auto}
#line1{color:#a6adbb;font-size:11px}
#line1 b{color:#fff}
#line2{color:#00ffff;font-size:11px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#crumb a{color:#00ffff;text-decoration:none;cursor:pointer}
#tools{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
#tools button,#tools a,#card button,#help button{font:inherit;font-size:12px;color:#fff;background:#000a;border:1px solid #00ffff55;
  border-radius:3px;padding:5px 8px;min-height:30px;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center}
#tools button.on{border-color:#00ffff;color:#00ffff}
#tools a{color:#66ccff;border-color:#66ccff55}
#card{position:fixed;z-index:6;left:0;right:0;bottom:0;max-height:46vh;overflow:auto;background:#000e;border-top:1px solid #00ffff;
  padding:10px 12px calc(12px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
#card h2{margin:0 26px 4px 0;font-size:15px;color:#fff}
#card .syn{color:#fff;margin:4px 0}
#card .key{color:#00ffff;word-break:break-all;margin:6px 0;font-size:12px}
#card .m{color:#a6adbb;font-size:12px}
#card .chip{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:5px;vertical-align:middle}
#card .links{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
#card .links a{padding:5px 0}
#card .x{position:absolute;right:8px;top:6px;min-height:28px}
#card ul{margin:4px 0;padding-left:18px;color:#a6adbb;font-size:12px}
#find{position:fixed;left:8px;right:8px;top:118px;bottom:8px;max-width:520px;background:#000e;border:1px solid #00ffff55;
  padding:8px;display:flex;flex-direction:column}
#find[hidden]{display:none}
#q{font:inherit;font-size:16px;background:#000;color:#fff;border:1px solid #00ffff;padding:6px;width:100%}
#list{overflow:auto;margin:6px 0 0;padding-left:0;list-style:none;flex:1}
#list li{padding:6px 2px;border-bottom:1px solid #222;cursor:pointer;color:#fff}
#list li span{color:#a6adbb}
#help{position:fixed;left:8px;right:8px;top:118px;max-width:560px;background:#000e;border:1px solid #00ffff;padding:10px 12px;
  max-height:70vh;overflow:auto}
#help p{margin:6px 0}
#help .m,.ns p{color:#a6adbb;font-size:11px;word-break:break-word}
#err{position:fixed;left:8px;right:8px;top:45%;text-align:center;color:#ff6666}
.ns{position:fixed;inset:0;overflow:auto;padding:12px;background:#000}
.ns h2{font-size:13px;color:#00ffff;margin:12px 0 2px}
.ns li{color:#a6adbb}
/* plugin surfaces (window.KUIPER): panels under the HUD, the shared legend, card sections from modules */
.kp{position:fixed;left:8px;right:8px;top:118px;max-width:520px;max-height:70vh;overflow:auto;background:#0b0e14ee;
  border:1px solid #2f343d;border-radius:4px;padding:8px 10px;color:#fff;z-index:5;-webkit-overflow-scrolling:touch}
.kp[hidden]{display:none}
.kp-legend{top:auto!important;right:auto;bottom:calc(8px + env(safe-area-inset-bottom));max-width:min(320px,calc(100vw - 16px));
  max-height:30vh;font-size:11px;color:#a6adbb;z-index:4}
#card .kc{border-top:1px solid #2f343d;margin-top:8px;padding-top:6px}
#card .kc h3{margin:0 0 4px;font-size:12px;color:#00ffff;font-weight:normal}
/* phones: one scrolling row of 44px tap targets (the row scrolls, the page never does) */
@media (max-width:759px){
  #tools{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;padding-bottom:2px}
  #tools::-webkit-scrollbar{display:none}
  #tools button,#tools a{flex:0 0 auto;padding:0 10px;min-height:44px;min-width:44px;justify-content:center;font-size:12px}
  #card .x{min-height:44px;min-width:44px;top:2px;right:2px}
  #card h2{margin-right:48px}
  #line1{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  #card .links a{min-height:44px;display:inline-flex;align-items:center}
  #card ul a{display:inline-block;padding:6px 0}
  #list li{min-height:44px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
@media (min-width:760px){
  #line1,#line2{font-size:12px}
  #card{left:auto;top:110px;bottom:12px;right:12px;width:380px;max-height:none;border:1px solid #00ffff;border-radius:4px}
  #find,#help{top:110px}
}