@opennodes/registry 0.1.40 → 0.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,6 +118,16 @@
118
118
  .chip.inst { color: var(--accent); border-color: var(--accent); }
119
119
  .chip.imp { background: var(--panel-2); font-weight: 400; }
120
120
  .chip.loc { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
121
+ .chip.b-documented { color: var(--accent); border-color: var(--accent); }
122
+ .chip.b-measured, .chip.b-attested { color: var(--good); border-color: var(--good); }
123
+ .chip.s-planned { color: var(--warn); border-color: var(--warn); }
124
+ .wmodels { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; font-size: 0.8rem; }
125
+ .wmodels .lin { font-family: "IBM Plex Mono", monospace; font-size: 0.6rem; color: var(--warn); }
126
+ #w-map { height: 440px; margin-bottom: 0.4rem; overflow: hidden; }
127
+ #w-map .leaflet-popup-content { font-family: "Archivo", "Helvetica Neue", Arial, sans-serif; font-size: 0.8rem; line-height: 1.4; margin: 0.6rem 0.8rem; }
128
+ #w-map .leaflet-popup-content .site + .site { border-top: 1px solid #D6DEE3; margin-top: 0.45rem; padding-top: 0.45rem; }
129
+ .wlegend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.74rem; color: var(--muted); margin: 0 0 0.8rem; }
130
+ .wlegend .dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 2px solid currentColor; vertical-align: -0.1rem; margin-right: 0.3rem; }
121
131
  .micro { font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; font-weight: 600; letter-spacing: 0.04em; }
122
132
  .m-measured { color: var(--good); } .m-claimed { color: var(--faint); font-weight: 400; } .m-warn { color: var(--warn); }
123
133
  .prov { font-family: "IBM Plex Mono", monospace; font-size: 0.64rem; color: var(--faint); }
@@ -244,6 +254,7 @@
244
254
  <a class="tab" data-view="models" href="#/">Models</a>
245
255
  <a class="tab" data-view="rankings" href="#/rankings">Rankings</a>
246
256
  <a class="tab" data-view="nodes" href="#/nodes">Nodes</a>
257
+ <a class="tab" data-view="where" href="#/where">Where models run</a>
247
258
  <a class="tab" data-view="feed" href="#/new">New</a>
248
259
  <a class="tab" data-view="build" href="#/build">Build</a>
249
260
  <a class="tab" data-view="chat" href="#/chat">Chat</a>
@@ -381,6 +392,30 @@
381
392
  <div class="panel tablewrap" id="n-table"></div>
382
393
  </div>
383
394
 
395
+ <!-- ================= WHERE MODELS RUN ================= -->
396
+ <div id="view-where" hidden>
397
+ <div style="display:flex; align-items:baseline; gap:0.9rem; flex-wrap:wrap"><h1>Where models run</h1><span class="counts" id="w-counts"></span></div>
398
+ <p class="sub">Every known serving site by country, with the models it serves and how far each location can be trusted: <b>claimed</b> (the provider or a news report says so), <b>documented</b> (the provider's own dated page), <b>measured</b> (registry probes), <b>attested</b> (a signed card backed by an audit). Built from node cards, imported catalogs and curated seeds; <a href="https://github.com/opennodes-io/opennodes/tree/main/impl/packages/registry/src/data" target="_blank" rel="noopener">corrections welcome</a>. Also as <a id="w-json" href="/v0/locations">JSON</a>, <a id="w-csv" href="/v0/locations?format=csv">CSV</a> and <a id="w-geojson" href="/v0/locations?format=geojson">GeoJSON</a> for QGIS, ArcGIS or any web map.</p>
399
+ <div class="toolbar">
400
+ <select id="w-country"><option value="">every country</option></select>
401
+ <select id="w-basis"><option value="">any evidence</option><option value="documented">documented or better</option><option value="measured">measured or better</option><option value="attested">attested</option></select>
402
+ <select id="w-status"><option value="">live and planned</option><option value="live">live only</option><option value="planned">planned only</option></select>
403
+ <input type="text" id="w-model" placeholder="Filter by model, e.g. gpt-oss or command">
404
+ <input type="text" id="w-lineage" placeholder="exclude lineage, e.g. CN" style="max-width:12rem">
405
+ </div>
406
+ <div class="panel pad" id="w-summary" style="margin-bottom:0.8rem"></div>
407
+ <div class="panel" id="w-map" hidden></div>
408
+ <div class="wlegend" id="w-legend" hidden>
409
+ <span><span class="dot" style="color:var(--good); background:var(--good)"></span>measured or attested</span>
410
+ <span><span class="dot" style="color:var(--accent); background:var(--accent)"></span>documented</span>
411
+ <span><span class="dot" style="color:var(--faint); background:var(--faint)"></span>claimed</span>
412
+ <span><span class="dot" style="color:var(--muted)"></span>hollow: approximate point, only the region or country is known</span>
413
+ <span><span class="dot" style="color:var(--warn); border-style:dashed"></span>dashed: planned</span>
414
+ <span>Size: models served. Several sites in one city share a marker.</span>
415
+ </div>
416
+ <div class="panel tablewrap" id="w-table"></div>
417
+ </div>
418
+
384
419
  <!-- ================= NEW (feed) ================= -->
385
420
  <div id="view-feed" hidden>
386
421
  <h1>New</h1>
@@ -595,15 +630,19 @@ const priceStr = (p, nodeId = '') => {
595
630
  const i = p.input_per_mtok ?? 0, o = p.output_per_mtok ?? 0;
596
631
  return (i === 0 && o === 0) ? 'free' : `$${fmt(i)} / $${fmt(o)} per MTok`;
597
632
  };
633
+ const basisChip = (b) => `<span class="chip b-${esc(b)}">${esc(String(b).toUpperCase())}</span>`;
634
+ /** "CA-QC Montréal (documented)" for each live serving site of an offering. */
635
+ const locStr = (locs) => (locs || []).map((l) => `${esc(l.region)}${l.site ? ' ' + esc(l.site) : ''} ${basisChip(l.basis)}`).join(' · ');
598
636
 
599
637
  /* ---------- routing ---------- */
600
- const views = ['models', 'model', 'rankings', 'nodes', 'feed', 'build', 'chat', 'node', 'register', 'qualification'];
638
+ const views = ['models', 'model', 'rankings', 'nodes', 'where', 'feed', 'build', 'chat', 'node', 'register', 'qualification'];
601
639
  function route() {
602
640
  const hash = location.hash || '#/';
603
641
  let view = 'models', arg = null;
604
642
  if (hash.startsWith('#/model/')) { view = 'model'; arg = decodeURIComponent(hash.slice(8)); }
605
643
  else if (hash.startsWith('#/rankings')) view = 'rankings';
606
644
  else if (hash.startsWith('#/nodes')) view = 'nodes';
645
+ else if (hash.startsWith('#/where')) view = 'where';
607
646
  else if (hash.startsWith('#/new')) view = 'feed';
608
647
  else if (hash.startsWith('#/build')) view = 'build';
609
648
  else if (hash.startsWith('#/chat')) view = 'chat';
@@ -618,6 +657,7 @@ function route() {
618
657
  if (view === 'chat') loadChatTargets();
619
658
  if (view === 'rankings') loadRankings();
620
659
  if (view === 'nodes') loadNodes();
660
+ if (view === 'where') loadWhere();
621
661
  if (view === 'feed') loadFeed();
622
662
  if (view === 'node' && arg) loadNode(arg);
623
663
  }
@@ -1005,6 +1045,8 @@ window.toggleRow = async function (el, idx) {
1005
1045
  ${o.serving?.max_output_tokens ? `<dt>max output</dt><dd class="num">${fmtInt(o.serving.max_output_tokens)}</dd>` : ''}
1006
1046
  ${hwStr(o) ? `<dt>hardware</dt><dd>${hwStr(o)}</dd>` : ''}
1007
1047
  <dt>schemes</dt><dd>${esc((o.pricing.schemes || []).join(', '))}</dd>
1048
+ ${o.local ? '' : `<dt>served from</dt><dd>${o.locations?.length ? locStr(o.locations) : '<span style="color:var(--faint)">location not declared</span>'}</dd>`}
1049
+ ${o.model.lineage_origins ? `<dt>lineage</dt><dd>${esc(o.model.lineage_origins.join(', '))} <span class="prov" style="display:inline">· declared</span></dd>` : ''}
1008
1050
  ${o.local ? `<dt>run locally</dt><dd><code style="background:var(--panel-2); padding:0.1em 0.4em; border-radius:3px" class="mono">${esc(o.local.run)}</code>${o.local.pulls ? ` <span class="prov" style="display:inline">· ${esc(o.local.pulls)} pulls</span>` : ''}${o.local.sizes ? `<br><span class="prov" style="display:inline" title="Memory to run it at Ollama's default 4-bit quantization: weights plus runtime and a default context; an estimate">memory needed: ${o.local.sizes.map((t) => `${esc(t)} ~${memGb(t) ?? '?'} GB`).join(' · ')}</span>` : ''}</dd>` : ''}
1009
1051
  </dl>
1010
1052
  </div>
@@ -2161,7 +2203,7 @@ async function loadNodes() {
2161
2203
  <td><a href="#/node/${encodeURIComponent(n.id)}" style="font-weight:600">${esc(n.id)}</a></td>
2162
2204
  <td><span style="display:inline-flex; gap:0.3rem">${tierChip(n.tier)}${n.institutional ? '<span class="chip inst">institutional</span>' : ''}${n.source === 'import' ? '<span class="chip imp">IMPORTED</span>' : ''}</span></td>
2163
2205
  <td>${esc(n.operator ?? '—')}${n.country ? ' <span style="color:var(--muted)">(' + esc(n.country) + ')</span>' : ''}</td>
2164
- <td style="color:var(--muted)">${esc((n.regions || []).join(', ') || '—')}</td>
2206
+ <td style="color:var(--muted)">${esc([...new Set([...(n.regions || []), ...(n.locations || []).map((l) => l.region)])].join(', ') || '—')}</td>
2165
2207
  <td>${n.offerings}</td>
2166
2208
  <td>${n.availability?.ratio != null ? Math.round(n.availability.ratio * 100) + '%' : '—'}</td>
2167
2209
  <td><span class="prov">${ago(n.updated_at)}</span></td>
@@ -2169,6 +2211,123 @@ async function loadNodes() {
2169
2211
  } catch (e) { $('#n-table').innerHTML = '<p class="err">' + esc(e.message) + '</p>'; }
2170
2212
  }
2171
2213
 
2214
+ /* ---------- where models run ---------- */
2215
+ let whereCountriesLoaded = false;
2216
+ async function loadWhere() {
2217
+ const qs = new URLSearchParams();
2218
+ const set = (k, id) => { const v = $(id).value.trim(); if (v) qs.set(k, v); };
2219
+ set('country', '#w-country'); set('basis', '#w-basis'); set('status', '#w-status');
2220
+ set('model', '#w-model'); set('exclude_lineage', '#w-lineage');
2221
+ const q = qs.toString() ? '?' + qs : '';
2222
+ $('#w-json').href = '/v0/locations' + q;
2223
+ $('#w-csv').href = '/v0/locations' + (q ? q + '&' : '?') + 'format=csv';
2224
+ $('#w-geojson').href = '/v0/locations' + (q ? q + '&' : '?') + 'format=geojson';
2225
+ try {
2226
+ const r = await api('/v0/locations' + q);
2227
+ renderWhereMap(r.sites).catch((e) => { $('#w-map').hidden = true; $('#w-legend').hidden = true; console.warn('map:', e.message); });
2228
+ if (!whereCountriesLoaded && !q) {
2229
+ whereCountriesLoaded = true;
2230
+ $('#w-country').innerHTML = '<option value="">every country</option>'
2231
+ + r.countries.map((c) => `<option value="${esc(c.country)}">${esc(c.country)} · ${c.sites} sites</option>`).join('');
2232
+ }
2233
+ const s = r.summary;
2234
+ $('#w-counts').textContent = `${s.sites} sites · ${s.countries} countries`;
2235
+ $('#w-summary').innerHTML = `<div style="display:flex; flex-wrap:wrap; gap:0.4rem 1.2rem; font-size:0.84rem">`
2236
+ + r.countries.map((c) => `<span><b>${esc(c.country)}</b> ${c.providers} providers · ${c.sites} sites (${c.live_sites} live) · ${c.models} models</span>`).join('')
2237
+ + `</div><p class="prov" style="margin:0.5rem 0 0">${fmtInt(s.located_offerings)} offerings in the registry declare where they run; ${fmtInt(s.unlocated_offerings)} do not. That gap is what this page exists to close.</p>`;
2238
+ const models = (x) => x.models.length
2239
+ ? `<div class="wmodels">${x.models.slice(0, 12).map((m) => `<span>${esc(m.name)}${m.lineage_origins ? ` <span class="lin">${esc(m.lineage_origins.join('/'))}</span>` : ''}</span>`).join('')}${x.models.length > 12 ? `<span class="prov">+${x.models.length - 12} more</span>` : ''}</div>`
2240
+ : `<span style="color:var(--muted); font-size:0.8rem">${esc(x.models_note ?? '—')}</span>`;
2241
+ const provider = (x) => (x.source === 'seed'
2242
+ ? `<b>${esc(x.provider)}</b>`
2243
+ : `<a href="#/node/${encodeURIComponent(x.node_id)}" style="font-weight:600">${esc(x.provider)}</a>`)
2244
+ + (x.operator_country ? ` <span style="color:var(--muted)">(${esc(x.operator_country)})</span>` : '')
2245
+ + (x.source !== 'registration' ? ' <span class="chip imp">' + (x.source === 'seed' ? 'SEED' : 'IMPORTED') + '</span>' : '');
2246
+ $('#w-table').innerHTML = r.sites.length ? `<table class="grid"><thead><tr>
2247
+ <th>REGION</th><th>SITE</th><th>PROVIDER</th><th>STATUS</th><th>EVIDENCE</th><th>MODELS SERVED</th>
2248
+ </tr></thead><tbody>` + r.sites.map((x) => `<tr>
2249
+ <td class="mono" style="font-size:0.78rem">${esc(x.region)}</td>
2250
+ <td>${esc(x.site ?? '—')}${x.facility_operator ? `<span class="prov">run by ${esc(x.facility_operator)}</span>` : ''}${x.note ? `<span class="prov">${esc(x.note)}</span>` : ''}</td>
2251
+ <td>${provider(x)}</td>
2252
+ <td><span class="chip s-${esc(x.status)}">${esc(String(x.status).toUpperCase())}</span></td>
2253
+ <td>${basisChip(x.basis)}${x.source_url ? `<span class="prov"><a href="${esc(x.source_url)}" target="_blank" rel="noopener">source</a>${x.checked ? ' · checked ' + esc(x.checked) : ''}</span>` : ''}</td>
2254
+ <td>${models(x)}</td>
2255
+ </tr>`).join('') + '</tbody></table>' : '<p class="sub" style="padding:0.9rem 1rem; margin:0">No sites match these filters.</p>';
2256
+ } catch (e) { $('#w-table').innerHTML = '<p class="err">' + esc(e.message) + '</p>'; }
2257
+ }
2258
+ /* Map: Leaflet is fetched only when this page opens (no CDN or tile requests elsewhere in the
2259
+ app), pinned by version and integrity. Tiles come from the registry's /v0/health `map`
2260
+ setting; when it is null the map stays hidden and the table carries everything. */
2261
+ const LEAFLET = {
2262
+ css: ['https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.css', 'sha512-h9FcoyWjHcOcmEVkxOfTLnmZFWIH0iZhZT1H2TbOq55xssQGEJHEaIm+PgoUaZbRvQTNTluNOEfb1ZRy6D3BOw=='],
2263
+ js: ['https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.js', 'sha512-puJW3E/qXDqYp9IfhAI54BJEaWIfloJ7JWs7OeD5i6ruC9JZL1gERT1wjtwXFlh7CjE7ZJ+/vcRZRkIYIb6p4g=='],
2264
+ };
2265
+ let leafletReady = null, whereMap = null, whereLayer = null, mapConfig;
2266
+ function loadLeaflet() {
2267
+ leafletReady ??= new Promise((resolve, reject) => {
2268
+ const css = Object.assign(document.createElement('link'), { rel: 'stylesheet', href: LEAFLET.css[0], integrity: LEAFLET.css[1], crossOrigin: 'anonymous', referrerPolicy: 'no-referrer' });
2269
+ const js = Object.assign(document.createElement('script'), { src: LEAFLET.js[0], integrity: LEAFLET.js[1], crossOrigin: 'anonymous', referrerPolicy: 'no-referrer' });
2270
+ js.onload = () => resolve(window.L);
2271
+ js.onerror = () => { leafletReady = null; reject(new Error('map library did not load')); };
2272
+ document.head.append(css, js);
2273
+ });
2274
+ return leafletReady;
2275
+ }
2276
+ const BASIS_ORDER = ['claimed', 'documented', 'measured', 'attested'];
2277
+ async function renderWhereMap(sites) {
2278
+ if (mapConfig === undefined) mapConfig = (await api('/v0/health')).map ?? null;
2279
+ if (!mapConfig) return;
2280
+ const L = await loadLeaflet();
2281
+ $('#w-map').hidden = false; $('#w-legend').hidden = false;
2282
+ const css = getComputedStyle(document.documentElement);
2283
+ const color = { claimed: css.getPropertyValue('--faint').trim(), documented: css.getPropertyValue('--accent').trim(),
2284
+ measured: css.getPropertyValue('--good').trim(), attested: css.getPropertyValue('--good').trim(), planned: css.getPropertyValue('--warn').trim() };
2285
+ if (!whereMap) {
2286
+ whereMap = L.map('w-map', { worldCopyJump: true, scrollWheelZoom: false }).setView([50, -95], 3);
2287
+ L.tileLayer(mapConfig.tiles, { attribution: mapConfig.attribution, maxZoom: mapConfig.max_zoom ?? 19 }).addTo(whereMap);
2288
+ whereLayer = L.layerGroup().addTo(whereMap);
2289
+ }
2290
+ // The container was hidden until now: let layout give it a size before fitting bounds.
2291
+ await new Promise((r) => requestAnimationFrame(() => r()));
2292
+ whereMap.invalidateSize();
2293
+ whereLayer.clearLayers();
2294
+ // One marker per point: sites in the same city (Montréal: AWS, Google, Oracle) share it.
2295
+ const groups = new Map();
2296
+ for (const s of sites.filter((x) => x.geo)) {
2297
+ const key = s.geo.lat.toFixed(3) + ',' + s.geo.lon.toFixed(3);
2298
+ if (!groups.has(key)) groups.set(key, []);
2299
+ groups.get(key).push(s);
2300
+ }
2301
+ const bounds = [];
2302
+ for (const group of groups.values()) {
2303
+ const { lat, lon } = group[0].geo;
2304
+ const best = group.map((s) => s.basis).sort((a, b) => BASIS_ORDER.indexOf(b) - BASIS_ORDER.indexOf(a))[0];
2305
+ const derived = group.every((s) => s.geo.derived);
2306
+ const planned = group.every((s) => s.status === 'planned');
2307
+ const models = group.reduce((n, s) => n + s.models.length, 0);
2308
+ const c = planned ? color.planned : (color[best] || color.claimed);
2309
+ const marker = L.circleMarker([lat, lon], {
2310
+ radius: Math.min(22, 6 + Math.sqrt(models) * 2.2), color: c, weight: 2,
2311
+ fillColor: c, fillOpacity: derived ? 0 : 0.55, dashArray: planned ? '4 3' : null,
2312
+ });
2313
+ marker.bindPopup(group.map((s) => `<div class="site">
2314
+ <b>${esc(s.provider)}</b>${s.operator_country ? ` (${esc(s.operator_country)})` : ''}<br>
2315
+ ${esc(s.site ?? 'site not named')} · <span class="mono">${esc(s.region)}</span> · ${esc(s.status)} · ${basisChip(s.basis)}
2316
+ ${s.geo.derived ? `<br><i style="color:#5C6E7E">Approximate: only the ${esc(s.geo.precision)} is known</i>` : ''}
2317
+ <br>${s.models.length ? esc(s.models.slice(0, 8).map((m) => m.name).join(', ')) + (s.models.length > 8 ? ` +${s.models.length - 8} more` : '') : `<span style="color:#5C6E7E">${esc(s.models_note ?? 'no models listed')}</span>`}
2318
+ ${s.source === 'seed' ? '' : `<br><a href="#/node/${encodeURIComponent(s.node_id)}">node card</a>`}${s.source_url ? ` · <a href="${esc(s.source_url)}" target="_blank" rel="noopener">source</a>` : ''}
2319
+ </div>`).join(''), { maxWidth: 320, maxHeight: 320 });
2320
+ marker.bindTooltip(`${group.length} site${group.length > 1 ? 's' : ''} · ${models} models`);
2321
+ marker.addTo(whereLayer);
2322
+ bounds.push([lat, lon]);
2323
+ }
2324
+ if (bounds.length) whereMap.fitBounds(bounds, { padding: [30, 30], maxZoom: 6 });
2325
+ }
2326
+
2327
+ for (const id of ['w-country', 'w-basis', 'w-status']) $('#' + id).addEventListener('change', loadWhere);
2328
+ let whereDebounce;
2329
+ for (const id of ['w-model', 'w-lineage']) $('#' + id).addEventListener('input', () => { clearTimeout(whereDebounce); whereDebounce = setTimeout(loadWhere, 250); });
2330
+
2172
2331
  /* ---------- feed ---------- */
2173
2332
  async function loadFeed() {
2174
2333
  try {