@opennodes/registry 0.1.42 → 0.1.44

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.
@@ -121,13 +121,37 @@
121
121
  .chip.b-documented { color: var(--accent); border-color: var(--accent); }
122
122
  .chip.b-measured, .chip.b-attested { color: var(--good); border-color: var(--good); }
123
123
  .chip.s-planned { color: var(--warn); border-color: var(--warn); }
124
+ .chip.r-processing { color: var(--good); border-color: var(--good); }
125
+ .chip.r-storage { color: var(--accent); border-color: var(--accent); }
126
+ .chip.r-none { color: var(--warn); border-color: var(--warn); }
127
+ .chip.r-unstated { color: var(--faint); }
128
+ .rlist { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; }
124
129
  .wmodels { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; font-size: 0.8rem; }
125
130
  .wmodels .lin { font-family: "IBM Plex Mono", monospace; font-size: 0.6rem; color: var(--warn); }
126
131
  #w-map { height: 440px; margin-bottom: 0.4rem; overflow: hidden; }
127
132
  #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
133
  #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; }
134
+ .wstats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; align-items: baseline; }
135
+ .wstats .stat b { font-size: 1.15rem; margin-right: 0.3rem; }
136
+ .wstats .stat { font-size: 0.8rem; color: var(--muted); }
137
+ details.wfold { margin: 0 0 0.8rem; }
138
+ details.wfold > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 0.6rem; font-weight: 600; font-size: 0.86rem; padding: 0.6rem 1rem; }
139
+ details.wfold > summary::-webkit-details-marker { display: none; }
140
+ details.wfold > summary::before { content: "+"; font-family: "IBM Plex Mono", monospace; color: var(--muted); width: 0.8rem; }
141
+ details.wfold[open] > summary::before { content: "–"; }
142
+ details.wfold > summary .prov { font-weight: 400; }
143
+ .wlegend { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem 1.6rem; font-size: 0.78rem; color: var(--muted); padding: 0 1rem 0.9rem; }
144
+ .wlegend h4 { font-family: "IBM Plex Mono", monospace; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.08em; color: var(--faint); margin: 0 0 0.35rem; }
145
+ .wlegend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
146
+ .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.4rem; }
147
+ #w-countries table.grid td { padding: 0.5rem 0.8rem; vertical-align: top; }
148
+ #w-countries tr.cgroup td { background: var(--line-2); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); padding: 0.35rem 0.8rem; }
149
+ #w-countries tr.crow { cursor: pointer; }
150
+ #w-countries tr.crow:hover td { background: var(--line-2); }
151
+ #w-countries .cname b { display: block; }
152
+ #w-countries .provs { font-size: 0.78rem; color: var(--muted); }
153
+ .sitebar { display: flex; height: 0.4rem; width: 6rem; border-radius: 0.2rem; overflow: hidden; background: var(--line-2); margin-top: 0.25rem; }
154
+ .sitebar span { background: var(--accent); } .sitebar span + span { background: var(--warn); }
131
155
  .micro { font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; font-weight: 600; letter-spacing: 0.04em; }
132
156
  .m-measured { color: var(--good); } .m-claimed { color: var(--faint); font-weight: 400; } .m-warn { color: var(--warn); }
133
157
  .prov { font-family: "IBM Plex Mono", monospace; font-size: 0.64rem; color: var(--faint); }
@@ -395,25 +419,59 @@
395
419
  <!-- ================= WHERE MODELS RUN ================= -->
396
420
  <div id="view-where" hidden>
397
421
  <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>
422
+ <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. Each site also shows the provider's official <b>residency</b> commitment where it covers that site: <b>processing</b> (inference and stored data stay in the area), <b>storage</b> (data at rest only), or none; <a href="#w-res">every provider's commitments</a> are listed below the table.</p>
399
423
  <div class="toolbar">
400
424
  <select id="w-country"><option value="">every country</option></select>
401
425
  <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
426
  <select id="w-status"><option value="">live and planned</option><option value="live">live only</option><option value="planned">planned only</option></select>
427
+ <select id="w-residency"><option value="">any residency</option><option value="storage">residency: storage or better</option><option value="processing">residency: processing</option></select>
403
428
  <input type="text" id="w-model" placeholder="Filter by model, e.g. gpt-oss or command">
404
429
  <input type="text" id="w-lineage" placeholder="exclude lineage, e.g. CN" style="max-width:12rem">
405
430
  </div>
406
431
  <div class="panel pad" id="w-summary" style="margin-bottom:0.8rem"></div>
407
432
  <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>
433
+ <details class="panel wfold" id="w-legend" data-fold="legend" open>
434
+ <summary>Legend <span class="prov">what the markers, chips and columns mean</span></summary>
435
+ <div class="wlegend">
436
+ <div><h4>MARKER COLOUR · EVIDENCE</h4><ul>
437
+ <li><span class="dot" style="color:var(--good); background:var(--good)"></span>measured or attested: registry probes or a signed, audited card</li>
438
+ <li><span class="dot" style="color:var(--accent); background:var(--accent)"></span>documented: the provider's own dated page</li>
439
+ <li><span class="dot" style="color:var(--faint); background:var(--faint)"></span>claimed: the provider or a news report says so</li>
440
+ </ul></div>
441
+ <div><h4>MARKER SHAPE</h4><ul>
442
+ <li><span class="dot" style="color:var(--muted)"></span>hollow: approximate point, only the region or country is known</li>
443
+ <li><span class="dot" style="color:var(--warn); border-style:dashed"></span>dashed: planned, not serving yet</li>
444
+ <li>Size grows with the models served. Several sites in one city share a marker; click it for each one.</li>
445
+ </ul></div>
446
+ <div><h4>RESIDENCY · WHAT THE PROVIDER PROMISES</h4><ul>
447
+ <li><span class="chip r-processing">PROCESSING</span> prompts, outputs and stored data stay in the area</li>
448
+ <li><span class="chip r-storage">STORAGE</span> data at rest stays; processing may not</li>
449
+ <li><span class="chip r-none">NO FIXED AREA</span> the provider says data may go anywhere</li>
450
+ <li><span class="chip r-unstated">NOT STATED</span> no public promise found</li>
451
+ <li><b>opt in</b>: a setting or regional endpoint you choose · <b>enterprise</b>: contract or paid plan only</li>
452
+ </ul></div>
453
+ <div><h4>COUNTS</h4><ul>
454
+ <li><b>Providers</b>: companies with at least one site in the country</li>
455
+ <li><b>Models listed</b>: distinct models a provider says it serves there. A dash means the provider names its sites but not which models run at each</li>
456
+ <li>Click a country to filter the map and the site table.</li>
457
+ </ul></div>
458
+ </div>
459
+ </details>
460
+ <details class="panel wfold" id="w-countries" data-fold="countries" open>
461
+ <summary>Countries <span class="prov" id="w-countries-count"></span></summary>
462
+ <div class="tablewrap" id="w-countries-table"></div>
463
+ </details>
416
464
  <div class="panel tablewrap" id="w-table"></div>
465
+ <h2 id="w-res" style="margin-top:1.6rem">Residency commitments</h2>
466
+ <p class="sub">What each provider officially promises about where prompts, outputs and stored data stay, with the page that says so, including routers and providers with no known sites. <b>default</b>: every customer; <b>opt in</b>: a setting, regional endpoint or region you choose; <b>enterprise</b>: contract or paid plan only. Curated from public pages; a promise is not proof (<a href="https://github.com/opennodes-io/opennodes/blob/main/spec/ONP-2-node-card.md#3b-residency--what-the-operator-promises-about-where-data-stays" target="_blank" rel="noopener">ONP-2 §3b</a>). Also as <a id="r-json" href="/v0/residency">JSON</a> and <a id="r-csv" href="/v0/residency?format=csv">CSV</a>.</p>
467
+ <div class="toolbar">
468
+ <input type="text" id="r-scope" placeholder="keeps data in, e.g. EU, DE, CA" style="max-width:14rem">
469
+ <select id="r-commitment"><option value="">any commitment</option><option value="storage">storage or better</option><option value="processing">processing</option></select>
470
+ <select id="r-availability"><option value="">any availability</option><option value="default">by default</option><option value="opt_in">default or opt in</option></select>
471
+ <select id="r-kind"><option value="">every kind</option><option value="cloud">clouds</option><option value="lab">model labs</option><option value="inference">inference hosts</option><option value="router">routers</option><option value="local">local apps</option><option value="unknown">unknown</option></select>
472
+ </div>
473
+ <div class="panel pad" id="r-summary" style="margin-bottom:0.8rem"></div>
474
+ <div class="panel tablewrap" id="r-table"></div>
417
475
  </div>
418
476
 
419
477
  <!-- ================= NEW (feed) ================= -->
@@ -657,7 +715,7 @@ function route() {
657
715
  if (view === 'chat') loadChatTargets();
658
716
  if (view === 'rankings') loadRankings();
659
717
  if (view === 'nodes') loadNodes();
660
- if (view === 'where') loadWhere();
718
+ if (view === 'where') { loadWhere(); loadResidency(); }
661
719
  if (view === 'feed') loadFeed();
662
720
  if (view === 'node' && arg) loadNode(arg);
663
721
  }
@@ -2217,44 +2275,148 @@ async function loadWhere() {
2217
2275
  const qs = new URLSearchParams();
2218
2276
  const set = (k, id) => { const v = $(id).value.trim(); if (v) qs.set(k, v); };
2219
2277
  set('country', '#w-country'); set('basis', '#w-basis'); set('status', '#w-status');
2220
- set('model', '#w-model'); set('exclude_lineage', '#w-lineage');
2278
+ set('model', '#w-model'); set('exclude_lineage', '#w-lineage'); set('residency', '#w-residency');
2221
2279
  const q = qs.toString() ? '?' + qs : '';
2222
2280
  $('#w-json').href = '/v0/locations' + q;
2223
2281
  $('#w-csv').href = '/v0/locations' + (q ? q + '&' : '?') + 'format=csv';
2224
2282
  $('#w-geojson').href = '/v0/locations' + (q ? q + '&' : '?') + 'format=geojson';
2225
2283
  try {
2226
2284
  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); });
2285
+ renderWhereMap(r.sites).catch((e) => { $('#w-map').hidden = true; console.warn('map:', e.message); });
2228
2286
  if (!whereCountriesLoaded && !q) {
2229
2287
  whereCountriesLoaded = true;
2230
2288
  $('#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('');
2289
+ + r.countries.map((c) => `<option value="${esc(c.country)}">${esc(countryName(c.country))} · ${c.sites} sites</option>`).join('');
2232
2290
  }
2233
2291
  const s = r.summary;
2234
2292
  $('#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>`;
2293
+ const live = r.sites.filter((x) => x.status === 'live').length;
2294
+ const promised = r.sites.filter((x) => x.residency?.some((c) => c.commitment === 'processing')).length;
2295
+ const stat = (n, label) => `<span class="stat"><b>${fmtInt(n)}</b>${label}</span>`;
2296
+ $('#w-summary').innerHTML = `<div class="wstats">${stat(s.sites, 'sites')}${stat(live, 'live')}${stat(s.countries, 'countries')}`
2297
+ + `${stat(new Set(r.sites.map((x) => x.provider)).size, 'providers')}${stat(promised, 'sites with a processing promise')}</div>`
2298
+ + `<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>`;
2299
+ renderCountries(r.sites);
2238
2300
  const models = (x) => x.models.length
2239
2301
  ? `<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
2302
  : `<span style="color:var(--muted); font-size:0.8rem">${esc(x.models_note ?? '—')}</span>`;
2241
- const provider = (x) => (x.source === 'seed'
2303
+ const provider = (x) => (!hasNodeCard(x)
2242
2304
  ? `<b>${esc(x.provider)}</b>`
2243
2305
  : `<a href="#/node/${encodeURIComponent(x.node_id)}" style="font-weight:600">${esc(x.provider)}</a>`)
2244
2306
  + (x.operator_country ? ` <span style="color:var(--muted)">(${esc(x.operator_country)})</span>` : '')
2245
2307
  + (x.source !== 'registration' ? ' <span class="chip imp">' + (x.source === 'seed' ? 'SEED' : 'IMPORTED') + '</span>' : '');
2246
2308
  $('#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>
2309
+ <th>REGION</th><th>SITE</th><th>PROVIDER</th><th>STATUS</th><th>EVIDENCE</th><th>RESIDENCY</th><th>MODELS SERVED</th>
2248
2310
  </tr></thead><tbody>` + r.sites.map((x) => `<tr>
2249
2311
  <td class="mono" style="font-size:0.78rem">${esc(x.region)}</td>
2250
2312
  <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
2313
  <td>${provider(x)}</td>
2252
2314
  <td><span class="chip s-${esc(x.status)}">${esc(String(x.status).toUpperCase())}</span></td>
2253
2315
  <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>
2316
+ <td>${resList(x.residency, true)}</td>
2254
2317
  <td>${models(x)}</td>
2255
2318
  </tr>`).join('') + '</tbody></table>' : '<p class="sub" style="padding:0.9rem 1rem; margin:0">No sites match these filters.</p>';
2256
2319
  } catch (e) { $('#w-table').innerHTML = '<p class="err">' + esc(e.message) + '</p>'; }
2257
2320
  }
2321
+ /* Countries table: grouped by continent, sites as live/planned, the providers by name. */
2322
+ const CONTINENT = Object.fromEntries([
2323
+ ['Americas', 'US CA MX BR AR CL CO PE UY CR PA'],
2324
+ ['Europe', 'AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MT NL NO PL PT RO RS SE SI SK UA TR'],
2325
+ ['Middle East and Africa', 'AE BH EG IL JO KE KW MA NG OM QA SA ZA'],
2326
+ ['Asia-Pacific', 'AU CN HK ID IN JP KR MY NZ PH PK SG TH TW VN KZ'],
2327
+ ].flatMap(([name, codes]) => codes.split(' ').map((c) => [c, name])));
2328
+ const CONTINENT_ORDER = ['Americas', 'Europe', 'Middle East and Africa', 'Asia-Pacific', 'Other'];
2329
+ let regionNames = null;
2330
+ try { regionNames = new Intl.DisplayNames(['en'], { type: 'region' }); } catch { /* old browser: codes only */ }
2331
+ const countryName = (code) => { try { return regionNames?.of(code) ?? code; } catch { return code; } };
2332
+ function renderCountries(sites) {
2333
+ const by = new Map();
2334
+ for (const s of sites) {
2335
+ const c = by.get(s.country) ?? { code: s.country, sites: 0, live: 0, planned: 0, providers: new Map(), models: new Set(), processing: 0 };
2336
+ c.sites++;
2337
+ if (s.status === 'live') c.live++; else if (s.status === 'planned') c.planned++;
2338
+ c.providers.set(s.provider, (c.providers.get(s.provider) ?? 0) + 1);
2339
+ for (const m of s.models) c.models.add(m.artifact ?? m.name);
2340
+ if (s.residency?.some((x) => x.commitment === 'processing')) c.processing++;
2341
+ by.set(s.country, c);
2342
+ }
2343
+ const rows = [...by.values()].sort((a, b) => b.sites - a.sites || a.code.localeCompare(b.code));
2344
+ const max = Math.max(1, ...rows.map((c) => c.sites));
2345
+ $('#w-countries-count').textContent = `${rows.length} ${rows.length === 1 ? 'country' : 'countries'}, most sites first`;
2346
+ const groups = CONTINENT_ORDER.map((g) => [g, rows.filter((c) => (CONTINENT[c.code] ?? 'Other') === g)]).filter(([, list]) => list.length);
2347
+ const providers = (c) => {
2348
+ const names = [...c.providers.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([n, k]) => esc(n) + (k > 1 ? ` <span class="prov">×${k}</span>` : ''));
2349
+ return names.slice(0, 8).join(', ') + (names.length > 8 ? ` <span class="prov">+${names.length - 8} more</span>` : '');
2350
+ };
2351
+ $('#w-countries-table').innerHTML = rows.length ? `<table class="grid"><thead><tr>
2352
+ <th>COUNTRY</th><th>SITES</th><th>PROVIDERS</th><th>MODELS LISTED</th><th>PROCESSING PROMISE</th>
2353
+ </tr></thead><tbody>` + groups.map(([g, list]) => `<tr class="cgroup"><td colspan="5">${esc(g.toUpperCase())} · ${list.reduce((n, c) => n + c.sites, 0)} SITES</td></tr>`
2354
+ + list.map((c) => `<tr class="crow" data-country="${esc(c.code)}" title="Show only ${esc(countryName(c.code))}">
2355
+ <td class="cname"><b>${esc(countryName(c.code))}</b><span class="prov">${esc(c.code)}</span></td>
2356
+ <td class="mono" style="font-size:0.78rem; white-space:nowrap">${c.sites}${c.planned ? ` <span class="prov">(${c.planned} planned)</span>` : ''}
2357
+ <div class="sitebar"><span style="width:${(c.live / max) * 100}%"></span><span style="width:${(c.planned / max) * 100}%"></span></div></td>
2358
+ <td class="provs"><b style="color:var(--ink)">${c.providers.size}</b> · ${providers(c)}</td>
2359
+ <td class="mono" style="font-size:0.78rem">${c.models.size || '—'}</td>
2360
+ <td class="mono" style="font-size:0.78rem">${c.processing ? `${c.processing} of ${c.sites} sites` : '—'}</td>
2361
+ </tr>`).join('')).join('') + '</tbody></table>' : '<p class="sub" style="padding:0.9rem 1rem; margin:0">No sites match these filters.</p>';
2362
+ }
2363
+ $('#w-countries-table').addEventListener('click', (e) => {
2364
+ const row = e.target.closest('tr.crow');
2365
+ if (!row) return;
2366
+ const sel = $('#w-country');
2367
+ if (![...sel.options].some((o) => o.value === row.dataset.country)) sel.add(new Option(row.dataset.country, row.dataset.country));
2368
+ sel.value = sel.value === row.dataset.country ? '' : row.dataset.country;
2369
+ loadWhere();
2370
+ $('#w-map').scrollIntoView({ behavior: 'smooth', block: 'start' });
2371
+ });
2372
+ // Legend and countries: open or closed as the viewer last left them.
2373
+ for (const d of document.querySelectorAll('details.wfold')) {
2374
+ try { const v = localStorage.getItem('onp-where-' + d.dataset.fold); if (v) d.open = v === 'open'; } catch { /* storage blocked */ }
2375
+ d.addEventListener('toggle', () => { try { localStorage.setItem('onp-where-' + d.dataset.fold, d.open ? 'open' : 'closed'); } catch { /* storage blocked */ } });
2376
+ }
2377
+ /* Residency (ONP-2 §3b): one chip per commitment, with who gets it and the source. */
2378
+ const RES_LABEL = { processing: 'PROCESSING', storage: 'STORAGE', none: 'NO FIXED AREA', unstated: 'NOT STATED' };
2379
+ const AVAIL_LABEL = { opt_in: 'opt in', enterprise: 'enterprise' };
2380
+ function resList(list, compact = false) {
2381
+ if (!list) return '<span style="color:var(--faint); font-size:0.78rem">—</span>';
2382
+ if (!list.length) return `<span class="chip r-unstated">${RES_LABEL.unstated}</span>`;
2383
+ return '<div class="rlist">' + list.map((r) => {
2384
+ const c = RES_LABEL[r.commitment] ? r.commitment : 'unstated';
2385
+ const where = !r.scope?.length ? '' : r.per_region && r.scope.length > 4
2386
+ ? ` · CHOSEN REGION, ${r.scope.length} AREAS` : ' ' + r.scope.join(r.per_region ? ' or ' : '+');
2387
+ return `<span><span class="chip r-${c}" title="${esc((r.scope ?? []).join(r.per_region ? ' or ' : ' + '))}">${RES_LABEL[c]}${esc(where)}</span>`
2388
+ + (AVAIL_LABEL[r.availability] ? ` <span style="color:var(--muted)">${AVAIL_LABEL[r.availability]}</span>` : '')
2389
+ + (r.programme ? ` <span style="color:var(--muted)">· ${esc(r.programme)}</span>` : '')
2390
+ + (!compact && r.statement ? `<span class="prov">${esc(r.statement)}</span>` : '')
2391
+ + (r.source ? ` <a href="${esc(r.source)}" target="_blank" rel="noopener" title="${esc(r.statement ?? '')}" style="font-size:0.72rem">source</a>` : '')
2392
+ + '</span>';
2393
+ }).join('') + '</div>';
2394
+ }
2395
+ /** Site-only seed entries have no node card; seed sites attached to a listed node do. */
2396
+ const hasNodeCard = (s) => !(s.source === 'seed' && String(s.node_id).startsWith('import.seed.'));
2397
+ async function loadResidency() {
2398
+ const qs = new URLSearchParams();
2399
+ const set = (k, id) => { const v = $(id).value.trim(); if (v) qs.set(k, v); };
2400
+ set('scope', '#r-scope'); set('commitment', '#r-commitment'); set('availability', '#r-availability'); set('kind', '#r-kind');
2401
+ const q = qs.toString() ? '?' + qs : '';
2402
+ $('#r-json').href = '/v0/residency' + q;
2403
+ $('#r-csv').href = '/v0/residency' + (q ? q + '&' : '?') + 'format=csv';
2404
+ try {
2405
+ const r = await api('/v0/residency' + q);
2406
+ const by = r.summary.by_strongest_commitment;
2407
+ $('#r-summary').innerHTML = `<div style="display:flex; flex-wrap:wrap; gap:0.4rem 1.2rem; font-size:0.84rem"><span><b>${fmtInt(r.summary.providers)}</b> providers, by their strongest commitment:</span>`
2408
+ + Object.entries(by).map(([c, n]) => `<span><span class="chip r-${c}">${RES_LABEL[c]}</span> ${fmtInt(n)}</span>`).join('') + '</div>';
2409
+ const link = (x) => x.node_ids.find((id) => !id.startsWith('import.seed.'));
2410
+ $('#r-table').innerHTML = r.providers.length ? `<table class="grid"><thead><tr>
2411
+ <th>PROVIDER</th><th>KIND</th><th>SITES</th><th>COMMITMENTS</th>
2412
+ </tr></thead><tbody>` + r.providers.map((x) => `<tr>
2413
+ <td>${link(x) ? `<a href="#/node/${encodeURIComponent(link(x))}" style="font-weight:600">${esc(x.provider)}</a>` : `<b>${esc(x.provider)}</b>`}${x.operator_country ? ` <span style="color:var(--muted)">(${esc(x.operator_country)})</span>` : ''}</td>
2414
+ <td style="font-size:0.8rem">${esc(x.kind ?? '—')}</td>
2415
+ <td class="mono" style="font-size:0.78rem">${x.sites || '—'}</td>
2416
+ <td>${resList(x.residency)}</td>
2417
+ </tr>`).join('') + '</tbody></table>' : '<p class="sub" style="padding:0.9rem 1rem; margin:0">No providers match these filters.</p>';
2418
+ } catch (e) { $('#r-table').innerHTML = '<p class="err">' + esc(e.message) + '</p>'; }
2419
+ }
2258
2420
  /* Map: Leaflet is fetched only when this page opens (no CDN or tile requests elsewhere in the
2259
2421
  app), pinned by version and integrity. Tiles come from the registry's /v0/health `map`
2260
2422
  setting; when it is null the map stays hidden and the table carries everything. */
@@ -2278,7 +2440,7 @@ async function renderWhereMap(sites) {
2278
2440
  if (mapConfig === undefined) mapConfig = (await api('/v0/health')).map ?? null;
2279
2441
  if (!mapConfig) return;
2280
2442
  const L = await loadLeaflet();
2281
- $('#w-map').hidden = false; $('#w-legend').hidden = false;
2443
+ $('#w-map').hidden = false;
2282
2444
  const css = getComputedStyle(document.documentElement);
2283
2445
  const color = { claimed: css.getPropertyValue('--faint').trim(), documented: css.getPropertyValue('--accent').trim(),
2284
2446
  measured: css.getPropertyValue('--good').trim(), attested: css.getPropertyValue('--good').trim(), planned: css.getPropertyValue('--warn').trim() };
@@ -2315,7 +2477,8 @@ async function renderWhereMap(sites) {
2315
2477
  ${esc(s.site ?? 'site not named')} · <span class="mono">${esc(s.region)}</span> · ${esc(s.status)} · ${basisChip(s.basis)}
2316
2478
  ${s.geo.derived ? `<br><i style="color:#5C6E7E">Approximate: only the ${esc(s.geo.precision)} is known</i>` : ''}
2317
2479
  <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>` : ''}
2480
+ ${s.residency?.length ? `<br>Residency: ${esc(s.residency.map((r) => (RES_LABEL[r.commitment] ?? RES_LABEL.unstated).toLowerCase() + (r.scope?.length ? ' in ' + r.scope.join(r.per_region ? ' or ' : '+') : '') + (AVAIL_LABEL[r.availability] ? ` (${AVAIL_LABEL[r.availability]})` : '')).join('; '))}` : ''}
2481
+ ${hasNodeCard(s) ? `<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
2482
  </div>`).join(''), { maxWidth: 320, maxHeight: 320 });
2320
2483
  marker.bindTooltip(`${group.length} site${group.length > 1 ? 's' : ''} · ${models} models`);
2321
2484
  marker.addTo(whereLayer);
@@ -2324,7 +2487,10 @@ async function renderWhereMap(sites) {
2324
2487
  if (bounds.length) whereMap.fitBounds(bounds, { padding: [30, 30], maxZoom: 6 });
2325
2488
  }
2326
2489
 
2327
- for (const id of ['w-country', 'w-basis', 'w-status']) $('#' + id).addEventListener('change', loadWhere);
2490
+ for (const id of ['w-country', 'w-basis', 'w-status', 'w-residency']) $('#' + id).addEventListener('change', loadWhere);
2491
+ for (const id of ['r-commitment', 'r-availability', 'r-kind']) $('#' + id).addEventListener('change', loadResidency);
2492
+ let resDebounce;
2493
+ $('#r-scope').addEventListener('input', () => { clearTimeout(resDebounce); resDebounce = setTimeout(loadResidency, 250); });
2328
2494
  let whereDebounce;
2329
2495
  for (const id of ['w-model', 'w-lineage']) $('#' + id).addEventListener('input', () => { clearTimeout(whereDebounce); whereDebounce = setTimeout(loadWhere, 250); });
2330
2496