Elffuss BraidHub

utopia-ia/elffuss-code public

Links: routes to a conversation, the Mind, Settings and the Lab; model cards, provider docs and bridge SHA-256

Only #/file routes existed, and nothing linked a model or a provider to where
it comes from, or let a download be checked.

- Routes: #/conv/<id> reopens that conversation (and says so if it is gone),
  #/mind opens the Mind, #/settings opens Settings, #/lab goes to lab.html. A
  conversation tab's menu has "Copy link". Telemetry already drops the hash
  (f4a384c), so these never leave the browser in a report.
- Settings links each local model to its card on Hugging Face, derived from the
  providers' own registries (the weights URL, the ONNX model id) rather than a
  separate list, and each external provider (OpenAI, Anthropic, Ollama) to its
  API documentation.
- web/bridge-dl/SHA256SUMS (shasum -a 256 format) lists the five bridge
  binaries, and Settings shows each download's SHA-256 with how to check it.

Not done: a build stamp. Code ships its files as they are, with no build step,
so the deployed revision can only be written at deploy time, in deploy.sh.

tests/links.mjs: copy-link and reopening by it, a missing conversation, the
#/mind, #/settings and #/lab routes, the model card and provider docs links,
and every download's hash matching SHA256SUMS. tests/bridge-sums.mjs (Node)
checks that SHA256SUMS matches the binaries, so a rebuild without regenerating
it fails.
Changeset71f77de4f55f82f2ef03e3a20ed237be653a3c20e4b5a6ae7eef740824b177a8
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00
Parents4b0609511c80

Browse the files at this changeset

7 files changed

added tests/bridge-sums.mjs +27 −0
@@ -0,0 +1,27 @@
1+// web/bridge-dl/SHA256SUMS dice la verdad sobre los binarios que se descargan.
2+//
3+// Ajustes enseña la huella SHA-256 de cada descarga del bridge (sale de este
4+// fichero) para que se pueda comprobar antes de ejecutarlo. Si alguien
5+// recompila los binarios y no regenera SHA256SUMS, la página enseñaría huellas
6+// que no casan: esta prueba lo impide. Para regenerarlo:
7+// cd web/bridge-dl && shasum -a 256 elffuss-bridge-* > SHA256SUMS
8+//
9+// node tests/bridge-sums.mjs
10+import { readFileSync, readdirSync } from 'node:fs';
11+import { createHash } from 'node:crypto';
12+import { join, dirname } from 'node:path';
13+import { fileURLToPath } from 'node:url';
14+const DIR = join(dirname(fileURLToPath(import.meta.url)), '..', 'web', 'bridge-dl');
15+let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; };
16+
17+const binarios = readdirSync(DIR).filter(f => f.startsWith('elffuss-bridge-')).sort();
18+const lineas = readFileSync(join(DIR, 'SHA256SUMS'), 'utf8').split('\n').filter(Boolean);
19+const sumas = new Map(lineas.map(l => { const m = l.match(/^([0-9a-f]{64})\s+\*?(\S+)$/); return m ? [m[2], m[1]] : [l, null]; }));
20+ok('cada línea de SHA256SUMS tiene el formato de shasum -a 256', [...sumas.values()].every(Boolean), JSON.stringify(lineas.filter(l => !/^[0-9a-f]{64}\s+\S+$/.test(l))));
21+ok('hay un binario para cada línea, y una línea para cada binario', JSON.stringify([...sumas.keys()].sort()) === JSON.stringify(binarios), JSON.stringify({ binarios, sumas: [...sumas.keys()] }));
22+for (const f of binarios) {
23+ const real = createHash('sha256').update(readFileSync(join(DIR, f))).digest('hex');
24+ ok(`la huella de ${f} es la del fichero`, sumas.get(f) === real, sumas.get(f) === real ? real.slice(0, 16) + '…' : `${sumas.get(f)} ≠ ${real}`);
25+}
26+console.log(fails ? `\n❌ ${fails} FALLO(S)` : '\n✅ SHA256SUMS casa con los binarios del bridge');
27+process.exit(fails ? 1 : 0);
added tests/links.mjs +99 −0
@@ -0,0 +1,99 @@
1+// Enlaces que llevan a un sitio concreto, y de dónde sale lo que se usa.
2+//
3+// 1. #/conv/<id> reabre esa conversación; su menú tiene «Copiar enlace».
4+// 2. #/mind abre la Mente, #/settings Ajustes y #/lab el banco de pruebas.
5+// (Antes solo existía #/file/<ruta>.)
6+// 3. Ajustes enlaza la ficha de cada modelo local (Hugging Face) y la
7+// documentación de la API de cada proveedor externo.
8+// 4. Cada descarga del bridge enseña su SHA-256, el de bridge-dl/SHA256SUMS.
9+//
10+// BASE=http://localhost:8799 node tests/links.mjs
11+import { chromium } from 'playwright';
12+import { readFileSync } from 'node:fs';
13+import { join, dirname } from 'node:path';
14+import { fileURLToPath } from 'node:url';
15+const BASE = process.env.BASE || 'http://localhost:8799';
16+const SUMAS = readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'web', 'bridge-dl', 'SHA256SUMS'), 'utf8');
17+let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; };
18+
19+const b = await chromium.launch();
20+const ctx = await b.newContext({ locale: 'es-ES', permissions: ['clipboard-read', 'clipboard-write'] });
21+await ctx.addInitScript(() => {
22+ try { localStorage.setItem('elffusscode.model', 'rules'); } catch {}
23+ try { Object.defineProperty(Navigator.prototype, 'gpu', { get() { return undefined; }, configurable: true }); } catch {}
24+});
25+const errs = [];
26+const abre = async (ruta = '') => {
27+ const p = await ctx.newPage({ viewport: { width: 1400, height: 900 } });
28+ p.on('pageerror', e => errs.push(e.message.slice(0, 160)));
29+ await p.goto(BASE + '/?test-opfs' + ruta, { waitUntil: 'domcontentloaded' });
30+ if (ruta !== '#/lab') await p.waitForFunction(() => window.elffussClaw?.conv?.getActive?.(), null, { timeout: 20000 });
31+ return p;
32+};
33+
34+// 1 · conversaciones
35+let p = await abre();
36+const ids = await p.evaluate(async () => {
37+ const conv = window.elffussClaw.conv;
38+ const primera = conv.getActive().id;
39+ conv.send(primera, 'hola');
40+ await new Promise(r => setTimeout(r, 600));
41+ const segunda = conv.create().id;
42+ return { primera, segunda };
43+});
44+// el menú de la pestaña de la primera: «Copiar enlace»
45+await p.locator(`#conv-tabs .tab[data-id="${ids.primera}"]`).click({ button: 'right' }).catch(async () => {
46+ await p.locator('#conv-tabs .tab').first().click({ button: 'right' });
47+});
48+await p.locator('#conv-menu [role="menuitem"]', { hasText: 'Copiar enlace' }).click();
49+await p.waitForTimeout(200);
50+const copiado = await p.evaluate(() => navigator.clipboard.readText()).catch(() => '');
51+ok('1 · «Copiar enlace» copia #/conv/<id> de esa conversación', copiado.endsWith('#/conv/' + ids.primera), copiado);
52+await p.close();
53+p = await abre('#/conv/' + ids.primera);
54+await p.waitForTimeout(500);
55+const activa = await p.evaluate(() => window.elffussClaw.conv.getActive().id);
56+ok('1 · abrir ese enlace reabre esa conversación', activa === ids.primera, JSON.stringify({ activa, esperada: ids.primera }));
57+await p.close();
58+p = await abre('#/conv/cnoexiste1234');
59+await p.waitForTimeout(500);
60+ok('1 · un enlace a una conversación que ya no está lo dice', /ya no está/.test(await p.locator('#statusbar').textContent()), await p.locator('#statusbar').textContent());
61+await p.close();
62+
63+// 2 · Mente, Ajustes y Lab
64+p = await abre('#/mind');
65+await p.waitForTimeout(800);
66+ok('2 · #/mind abre la Mente', await p.evaluate(() => { const o = document.getElementById('mind-overlay'); return !!o && getComputedStyle(o).display !== 'none'; }));
67+await p.close();
68+p = await abre('#/settings');
69+await p.waitForTimeout(500);
70+ok('2 · #/settings abre Ajustes', !(await p.locator('#settings-panel').isHidden()) && /Ajustes/.test(await p.locator('#settings-title').textContent()));
71+
72+// 3 · fichas de modelos y documentación de proveedores (con Ajustes abierto)
73+await p.waitForTimeout(500);
74+const enlaces = await p.evaluate(() => ({
75+ fichas: [...document.querySelectorAll('.model-cards-links a')].map(a => ({ t: a.textContent, href: a.href, nombre: a.getAttribute('aria-label') })),
76+ docs: [...document.querySelectorAll('#settings-panel .prov-docs')].map(a => ({ href: a.href, nombre: a.getAttribute('aria-label') })),
77+}));
78+ok('3 · Ajustes enlaza la ficha del modelo ligero en Hugging Face', enlaces.fichas.some(f => f.href === 'https://huggingface.co/onnx-community/Qwen3.5-0.8B-ONNX' && /Qwen3\.5-0\.8B/.test(f.nombre)), JSON.stringify(enlaces.fichas));
79+ok('3 · …y la documentación de la API de cada proveedor externo', enlaces.docs.some(d => /platform\.openai\.com/.test(d.href) && /OpenAI/.test(d.nombre)) && enlaces.docs.some(d => /docs\.anthropic\.com/.test(d.href)) && enlaces.docs.some(d => /ollama/.test(d.href)), JSON.stringify(enlaces.docs));
80+
81+// 4 · huella SHA-256 de las descargas del bridge
82+await p.waitForSelector('.br-sha', { timeout: 5000 }).catch(() => {});
83+const huellas = await p.evaluate(() => [...document.querySelectorAll('.br-sha')].map(d => ({ f: d.dataset.file, h: d.querySelector('code')?.textContent })));
84+const esperado = new Map(SUMAS.split('\n').filter(Boolean).map(l => { const [h, f] = l.split(/\s+/); return [f, h]; }));
85+ok('4 · cada descarga del bridge enseña su SHA-256', huellas.length === esperado.size && huellas.every(x => esperado.get(x.f) === x.h), JSON.stringify(huellas.map(x => x.f)));
86+ok('4 · …y cómo comprobarlo, con el enlace a SHA256SUMS', await p.locator('.br-sha-how a[href="bridge-dl/SHA256SUMS"]').count() === 1);
87+await p.close();
88+
89+p = await ctx.newPage();
90+await p.goto(BASE + '/#/lab', { waitUntil: 'domcontentloaded' });
91+await p.waitForURL(/lab\.html/, { timeout: 10000 }).catch(() => {});
92+ok('2 · #/lab lleva al banco de pruebas', /lab\.html$/.test(new URL(p.url()).pathname), p.url());
93+await p.close();
94+
95+console.log('\n errores JS:', errs[0] || 'ninguno');
96+ok('sin errores de página', errs.length === 0, errs.join(' | '));
97+console.log(fails ? `\n❌ ${fails} FALLO(S)` : '\n✅ ENLACES: conversación, Mente, Ajustes y Lab; fichas, docs y huellas');
98+await b.close();
99+process.exit(fails ? 1 : 0);
added web/bridge-dl/SHA256SUMS +5 −0
@@ -0,0 +1,5 @@
1+20178a970327248ddfc67b40f8f44f90f17be683ab85d33c2bc2cb5b1d2a949f elffuss-bridge-linux
2+88c8064b70b2738adbf39d7e208d2365167c4b64a701f318daff79b729e6ea14 elffuss-bridge-linux-arm64
3+967f0cb58ffb18a29f4a2879a1538d068220c2f2f2af251eabda1ee46883ed2a elffuss-bridge-mac-arm64
4+d04f453949fba9afe8936e12c09670c29ca60650465d318456115174a3428998 elffuss-bridge-mac-intel
5+d18243496ce6b10f91af9fcec4fe9900a611195cecbff92255e2374aae141d0e elffuss-bridge-windows.exe
modified web/css/code.css +2 −0
@@ -221,6 +221,8 @@
221221 .bridge-card #br-token, .bridge-card #br-folder { background: var(--bg); border: 1px solid var(--line); color: var(--fg); border-radius: 6px; padding: 6px 9px; font-size: .78rem; width: 100%; }
222222 .bridge-card details { color: var(--muted); }
223223 .bridge-card details summary::marker { color: var(--accent2); }
224+.bridge-card .br-sha { font-size: .64rem; color: var(--muted); margin: 0 0 6px; overflow-wrap: anywhere; }
225+.bridge-card .br-sha code { font-size: .64rem; color: var(--fg); }
224226 #fireworks-fx { position: fixed; inset: 0; z-index: 999; pointer-events: none; }
225227 .cfg-notif-btn { background: #3fb970; border: none; color: #06180d; border-radius: 6px; padding: 3px 10px; font-size: .68rem; font-weight: 700; cursor: pointer; }
226228 #mind-cfg label { font-size: .68rem; color: #b9a7ff; margin-top: 4px; }
modified web/js/i18n.js +8 −0
@@ -74,6 +74,7 @@
7474 wsDownload: "Descargar copia",
7575 wsWhat: "Qué hay guardado",
7676 setTitle: "Ajustes",
77+ setModelCards: 'Fichas de los modelos:', setModelCardFor: 'Ficha de {name} en Hugging Face',
7778 close: "cerrar",
7879 setBrainTitle: "Cerebro (modelo)",
7980 setModelE4bSub: "El mejor · WebGPU local · ~2.8 GB",
@@ -126,6 +127,7 @@
126127 termCapsNoBridge: "shell del proyecto · node/npm/python → Bridge local (⚙ Ajustes)",
127128 setBridgeFolderLabel: "Carpeta de trabajo (opcional — si no, la carpeta desde la que arrancaste el bridge; fuera de ella no ejecuta nada)",
128129 setBridgeDesc: "Un pequeño programa que TÚ ejecutas en tu ordenador — le da a la elfa ejecución real (node, npm, python…) sin salir de tu máquina. Nada se instala en el navegador.",
130+ setBridgeShaHow: 'Para comprobar la descarga: shasum -a 256 -c, con el fichero',
129131 setBridgeDownload: "⬇ Descargar para {os}",
130132 setBridgeOtherOS: "otro sistema operativo",
131133 setBridgeOld: "¿Ya tenías un bridge y ahora no conecta? Descárgalo otra vez (versión 1.1.2): los anteriores a la 1.1.1 no aceptan la dirección nueva de Elffuss Code.",
@@ -199,6 +201,7 @@
199201 setPermLabel: "Escribir y editar ficheros sin pedir confirmación",
200202 setPermNote: "Esto controla solo la escritura de ficheros (code.write / code.edit): desmárcalo si prefieres revisar cada cambio antes de aplicarlo. Los comandos del terminal (terminal.run) se ejecutan siempre sin preguntar.",
201203 provToggle: "Activar {name}", setModelLoadingCard: "cargando…",
204+ provDocs: 'documentación ↗', provDocsFor: 'Documentación de la API de {name}',
202205 modelDot: "Modelo: {name} · {state} — clic para cambiarlo", modelDotBasic: "Modo básico, sin modelo de IA — clic para elegir uno",
203206 modelState_off: "sin cargar", modelState_loading: "cargando…", modelState_on: "listo", modelState_error: "no se pudo cargar",
204207 // teclado, menús y pestañas
@@ -209,6 +212,7 @@
209212 goalPlaceholder: "🎯 Describe el objetivo: lo descompongo en tareas y las hago una a una…",
210213 convTabs: "Conversaciones abiertas", convBusy: "trabajando", tabCloseNamed: "Cerrar la pestaña «{title}» (no borra la conversación)",
211214 convRename: "Renombrar…", convRenamePrompt: "Nombre de la conversación (vacío = el automático):",
215+ convCopyLink: 'Copiar enlace', convLinkCopied: '🔗 Enlace a la conversación copiado', convLinkMissing: 'Esa conversación ya no está en este navegador.',
212216 histDelNamed: "Eliminar para siempre «{title}»",
213217 palSearchHint: "Escribe al menos 2 letras para buscar dentro del código",
214218 termResizeLabel: "Altura del terminal (↑/↓)",
@@ -309,6 +313,7 @@
309313 wsDownload: "Download copy",
310314 wsWhat: "What's stored",
311315 setTitle: "Settings",
316+ setModelCards: 'Model cards:', setModelCardFor: '{name} model card on Hugging Face',
312317 close: "close",
313318 setBrainTitle: "Brain (model)",
314319 setModelE4bSub: "The best · local WebGPU · ~2.8 GB",
@@ -361,6 +366,7 @@
361366 termCapsNoBridge: "project shell · node/npm/python → Local bridge (⚙ Settings)",
362367 setBridgeFolderLabel: "Working folder (optional — otherwise the folder you started the bridge from; it runs nothing outside it)",
363368 setBridgeDesc: "A small program that YOU run on your computer — it gives the elf real execution (node, npm, python…) without leaving your machine. Nothing is installed in the browser.",
369+ setBridgeShaHow: 'To check the download: shasum -a 256 -c, with the file',
364370 setBridgeDownload: "⬇ Download for {os}",
365371 setBridgeOtherOS: "another operating system",
366372 setBridgeOld: "Already had a bridge and now it won't connect? Download it again (version 1.1.2): versions before 1.1.1 don't accept Elffuss Code's new address.",
@@ -434,6 +440,7 @@
434440 setPermLabel: "Write and edit files without asking",
435441 setPermNote: "This only controls writing files (code.write / code.edit): untick it if you prefer to review each change before it is applied. Terminal commands (terminal.run) always run without asking.",
436442 provToggle: "Turn on {name}", setModelLoadingCard: "loading…",
443+ provDocs: 'docs ↗', provDocsFor: '{name} API documentation',
437444 modelDot: "Model: {name} · {state} — click to change it", modelDotBasic: "Basic mode, no AI model — click to pick one",
438445 modelState_off: "not loaded", modelState_loading: "loading…", modelState_on: "ready", modelState_error: "couldn't load",
439446 // keyboard, menus and tabs
@@ -444,6 +451,7 @@
444451 goalPlaceholder: "🎯 Describe the goal: I'll break it into tasks and do them one by one…",
445452 convTabs: "Open conversations", convBusy: "working", tabCloseNamed: "Close the “{title}” tab (doesn't delete the conversation)",
446453 convRename: "Rename…", convRenamePrompt: "Conversation name (empty = automatic):",
454+ convCopyLink: 'Copy link', convLinkCopied: '🔗 Link to the conversation copied', convLinkMissing: 'That conversation is no longer in this browser.',
447455 histDelNamed: "Delete “{title}” forever",
448456 palSearchHint: "Type at least 2 letters to search inside the code",
449457 termResizeLabel: "Terminal height (↑/↓)",
modified web/js/main.js +100 −9
@@ -121,15 +121,26 @@
121121 el.replaceChildren(enlaceFichero(m[1], m[2], txt));
122122 });
123123 }
124-// #/file/ruta[:línea] abre ese fichero: lo usan los enlaces de arriba (abrir
125-// en otra pestaña) y sirve para volver al mismo sitio tras recargar.
124+// Enlaces a un sitio del IDE, para volver a él o pasárselo a alguien:
125+// #/file/ruta[:línea] ese fichero (los enlaces del chat, abrir en otra pestaña)
126+// #/conv/<id> esa conversación (su menú tiene «Copiar enlace»)
127+// #/mind la Mente
128+// #/settings Ajustes
129+// #/lab el banco de pruebas (lab.html)
130+// Antes solo existía #/file; lo demás no tenía forma de enlazarse.
126131 function abreDesdeHash() {
127132 let h = location.hash;
128133 try { h = decodeURI(h); } catch { /* — */ }
134+ if (h === '#/lab') { location.replace('lab.html'); return; }
135+ if (!codeTools.handle()) return;
129136 const m = h.match(/^#\/file\/(.+?)(?::(\d+))?$/);
130- if (!m || !codeTools.handle()) return;
131- openFile(m[1]).then(() => { if (m[2]) gotoLine(+m[2]); });
132-}
137+ if (m) { openFile(m[1]).then(() => { if (m[2]) gotoLine(+m[2]); }); return; }
138+ const c = h.match(/^#\/conv\/([\w-]{4,40})$/);
139+ if (c) { conv.open(c[1]).then(r => { if (!r) $('statusbar').textContent = t('convLinkMissing'); }); return; }
140+ if (h === '#/mind') { mind.openMind(); return; }
141+ if (h === '#/settings') { renderSettings(); return; }
142+}
143+const enlaceA = ruta => location.origin + location.pathname + '#/' + ruta;
133144 addEventListener('hashchange', abreDesdeHash);
134145
135146 // Todo lo que pinta el chat entra por aquí. Lo que se escribió mientras la elfa
@@ -471,6 +482,12 @@
471482 }],
472483 [t('tmClose'), () => conv.closeTab(c.id)],
473484 [t('tmCloseOthers'), () => { for (const o of conv.getOpenTabs()) if (o.id !== c.id) conv.closeTab(o.id); conv.switchTo(c.id); }],
485+ // Un enlace que reabre ESTA conversación (#/conv/<id>), para volver a ella.
486+ [t('convCopyLink'), async () => {
487+ const url = enlaceA('conv/' + c.id);
488+ try { await navigator.clipboard.writeText(url); $('statusbar').textContent = t('convLinkCopied'); }
489+ catch { prompt(t('convCopyLink'), url); }
490+ }],
474491 ];
475492 for (const [label, fn] of opciones) {
476493 const b = document.createElement('button');
@@ -980,10 +997,33 @@
980997 if (/Linux/.test(ua)) return [arch === 'arm' || /aarch64|arm64/i.test(ua) ? 'elffuss-bridge-linux-arm64' : 'elffuss-bridge-linux'];
981998 return ['elffuss-bridge-mac-arm64', 'elffuss-bridge-mac-intel'];
982999 }
1000+// La huella SHA-256 de cada descarga, de bridge-dl/SHA256SUMS (el formato de
1001+// `shasum -a 256`): un programa que se ejecuta en tu máquina tiene que poder
1002+// comprobarse antes de abrirlo, y la página solo daba el tamaño.
1003+let sumasBridge = null;
1004+async function huellasBridge() {
1005+ if (sumasBridge) return sumasBridge;
1006+ const m = new Map();
1007+ try {
1008+ const r = await fetch('bridge-dl/SHA256SUMS', { cache: 'no-store' });
1009+ if (r.ok) for (const linea of (await r.text()).split('\n')) { const x = linea.match(/^([0-9a-f]{64})\s+\*?(\S+)$/); if (x) m.set(x[2], x[1]); }
1010+ } catch { /* sin huellas: se enseña lo demás */ }
1011+ return (sumasBridge = m);
1012+}
9831013 async function pintaDescargasBridge(card, NOMBRES) {
984- const principales = await bridgeParaEstaMaquina();
1014+ const [principales, sumas] = await Promise.all([bridgeParaEstaMaquina(), huellasBridge()]);
9851015 const host = card.querySelector('#br-dl'), otros = card.querySelector('#br-dl-other');
9861016 if (!host || !otros) return;
1017+ const huella = f => {
1018+ if (!sumas.has(f)) return null;
1019+ const d = document.createElement('div');
1020+ d.className = 'br-sha';
1021+ d.dataset.file = f;
1022+ d.append('SHA-256 ');
1023+ const c = document.createElement('code'); c.textContent = sumas.get(f);
1024+ d.appendChild(c);
1025+ return d;
1026+ };
9871027 const enlace = (f, principal) => {
9881028 const a = document.createElement('a');
9891029 a.href = 'bridge-dl/' + f; a.setAttribute('download', '');
@@ -997,8 +1037,19 @@
9971037 }).catch(() => {});
9981038 return a;
9991039 };
1000- host.replaceChildren(...principales.map(f => enlace(f, true)));
1001- otros.replaceChildren(...Object.keys(NOMBRES).filter(f => !principales.includes(f)).map(f => { const d = document.createElement('div'); d.appendChild(enlace(f, false)); return d; }));
1040+ host.replaceChildren(...principales.flatMap(f => [enlace(f, true), huella(f)].filter(Boolean)));
1041+ otros.replaceChildren(...Object.keys(NOMBRES).filter(f => !principales.includes(f)).map(f => { const d = document.createElement('div'); d.appendChild(enlace(f, false)); const h = huella(f); if (h) d.appendChild(h); return d; }));
1042+ card.querySelector('.br-sha-how')?.remove();
1043+ if (sumas.size) {
1044+ const como = document.createElement('p');
1045+ como.className = 'muted br-sha-how';
1046+ como.style.cssText = 'font-size:.68rem;margin:4px 0 0';
1047+ const a = document.createElement('a');
1048+ a.href = 'bridge-dl/SHA256SUMS'; a.target = '_blank'; a.rel = 'noopener'; a.textContent = 'SHA256SUMS';
1049+ a.style.color = 'var(--accent2)';
1050+ como.append(t('setBridgeShaHow') + ' ', a);
1051+ host.after(como); // fuera de la lista de descargas: es cómo comprobarlas
1052+ }
10021053 }
10031054
10041055 // pequeño estallido de fuegos artificiales (canvas, un par de segundos) para
@@ -1096,6 +1147,13 @@
10961147 }
10971148 repintaTarjetasModelo = () => { for (const [card, m] of tarjetas) if (card.isConnected) pintaTarjeta(card, m); };
10981149 box.appendChild(grid);
1150+ // De dónde sale cada modelo: su ficha en Hugging Face. Los enlaces salen de
1151+ // los registros de los proveedores (las URLs de los pesos), no de una lista
1152+ // aparte que se quedaría vieja.
1153+ const fichas = el('p', 'muted model-cards-links');
1154+ fichas.style.cssText = 'font-size:.7rem;margin:6px 0 0';
1155+ box.appendChild(fichas);
1156+ pintaFichasModelo(fichas, LOCAL);
10991157
11001158 // --- Espacio de trabajo: guardar conversaciones/skills en disco ---
11011159 box.append(el('div', 'sk-h', '💾 ' + t('wsTitle')));
@@ -1331,7 +1389,16 @@
13311389 const use = el('button', 'prov-use', t("setProvUse"));
13321390 use.hidden = !c.enabled || activeModel === 'ext:' + id;
13331391 use.onclick = () => { changeModel('ext:' + id); renderSettings(); };
1334- head.append(toggle, title, use);
1392+ head.append(toggle, title);
1393+ // La documentación de la API de ese proveedor (qué modelos hay, qué clave).
1394+ if (c.docs) {
1395+ const docs = el('a', 'prov-docs', t('provDocs'));
1396+ docs.href = c.docs; docs.target = '_blank'; docs.rel = 'noopener noreferrer';
1397+ docs.setAttribute('aria-label', t('provDocsFor', { name: c.label }));
1398+ docs.style.cssText = 'color:var(--accent2);font-size:.7rem;margin-left:8px';
1399+ head.appendChild(docs);
1400+ }
1401+ head.appendChild(use);
13351402 const fields = el('div', 'prov-fields' + (c.enabled ? '' : ' hide'));
13361403 const model = document.createElement('input'); model.value = c.model || ''; model.placeholder = t('setModelPh');
13371404 const key = document.createElement('input'); key.type = 'password'; key.value = c.apiKey || '';
@@ -1354,6 +1421,28 @@
13541421 skBtn.onclick = openSkillsPanel;
13551422 box.appendChild(skBtn);
13561423 }
1424+async function pintaFichasModelo(nodo, locales) {
1425+ let lt = null, mc = null;
1426+ try { [lt, mc] = await Promise.all([import('./providers/litert.js'), import('./model-config.js')]); } catch { return; }
1427+ const enlaces = [];
1428+ for (const m of locales) {
1429+ let url = null;
1430+ if (m.id.startsWith('litert:')) { const u = lt.MODELS?.[m.id.slice(7)]?.url; if (u) url = u.split('/resolve/')[0]; }
1431+ else if (m.id.startsWith('onnx:')) { const o = mc.ONNX_MODELS?.[m.id.slice(5)]; if (o?.id && !o.selfHosted) url = 'https://huggingface.co/' + o.id; }
1432+ if (url) enlaces.push([m.name, url]);
1433+ }
1434+ if (!enlaces.length || !nodo.isConnected) return;
1435+ nodo.append(t('setModelCards') + ' ');
1436+ enlaces.forEach(([nombre, url], i) => {
1437+ const a = document.createElement('a');
1438+ a.href = url; a.target = '_blank'; a.rel = 'noopener noreferrer';
1439+ a.textContent = nombre + ' ↗';
1440+ a.style.color = 'var(--accent2)';
1441+ a.setAttribute('aria-label', t('setModelCardFor', { name: nombre }));
1442+ if (i) nodo.append(' · ');
1443+ nodo.append(a);
1444+ });
1445+}
13571446 function labeled(label, input) {
13581447 const w = el('label', 'field'); w.append(el('span', 'muted', label), input); return w;
13591448 }
@@ -1420,6 +1509,8 @@
14201509 }
14211510
14221511 async function boot() {
1512+ // #/lab no necesita proyecto: es otra página.
1513+ if (location.hash === '#/lab') { location.replace('lab.html'); return; }
14231514 applyI18n(); // localiza el chrome estático (placeholder) antes de pintar nada
14241515 // Caché de modelos (persistente + service worker) ANTES de descargar nada,
14251516 // para que hasta la primera descarga de pesos quede cacheada y no se repita.
modified web/js/settings.js +3 −0
@@ -9,16 +9,19 @@
99 openai: {
1010 kind: 'openai', label: 'OpenAI', enabled: false,
1111 baseURL: 'https://api.openai.com/v1', model: 'gpt-4o-mini', apiKey: '',
12+ docs: 'https://platform.openai.com/docs/api-reference/chat',
1213 help: 'Tu clave sk-… Se queda en tu navegador. OpenAI permite llamadas directas (CORS).',
1314 },
1415 anthropic: {
1516 kind: 'anthropic', label: 'Anthropic (Claude)', enabled: false,
1617 baseURL: 'https://api.anthropic.com', model: 'claude-sonnet-5', apiKey: '',
18+ docs: 'https://docs.anthropic.com/en/api/messages',
1719 help: 'Tu clave sk-ant-… Se envía la cabecera de acceso directo desde navegador.',
1820 },
1921 ollama: {
2022 kind: 'openai', label: 'Ollama (local)', enabled: false,
2123 baseURL: 'http://localhost:11434/v1', model: 'llama3.2', apiKey: 'ollama',
24+ docs: 'https://github.com/ollama/ollama/blob/main/docs/openai.md',
2225 help: 'Ollama en tu máquina. Arráncalo con OLLAMA_ORIGINS=* para permitir el navegador.',
2326 },
2427 server: {