Elffuss BraidHub

utopia-ia/elffuss-code public

"Try in the browser" opens its own folder, away from the model weights

"Try in the browser (no folder)" opened the root of the browser's private
storage (OPFS) as the project. runtime/model-store.js keeps elffuss-models
(weights and .done markers) in that same root, so the explorer, the
palette, search and the agent's tools showed the model store and could
edit or delete it.

It now opens a dedicated "elffuss-code" folder inside that storage. This
button is new, so no existing browser project moves. The
?test-opfs hook still opens the root, as the tests expect.

landing.mjs seeds fake weights in elffuss-models and checks that the
browser project's tree, tree tool and file list do not see them and that
they are untouched. Fails on the previous tree.
Changeset6fb41f3536ee7a104b8cb5d694049bd213a9fd04a5a71c1e3edde2fbb4450a15
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-10 19:31 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 14:15 +02:00
Parentsa173c6d98b7c

Browse the files at this changeset

2 files changed

modified tests/landing.mjs +19 −1
@@ -11,7 +11,8 @@
1111 // se dice en la landing.
1212 // 5. Sin File System Access (Firefox, Safari): los botones que no pueden
1313 // funcionar se desactivan con el motivo, y se ofrece probar en la carpeta
14-// privada del navegador.
14+// privada del navegador: una carpeta propia, donde no se ven ni se tocan
15+// los pesos de los modelos (que viven en la raíz de ese almacenamiento).
1516 // Nada sale a la red: el selector de carpetas va de mentira y nunca se llega a
1617 // listar un repo.
1718 //
@@ -95,6 +96,12 @@
9596
9697 // 5 · navegador sin File System Access
9798 ({ ctx, p } = await nueva({ sinSelector: true }));
99+// pesos de modelo de mentira donde los guarda runtime/model-store.js: la raíz del OPFS
100+await p.goto(BASE + '/manifest.json');
101+await p.evaluate(async () => {
102+ const dir = await (await navigator.storage.getDirectory()).getDirectoryHandle('elffuss-models', { create: true });
103+ for (const n of ['abc123.bin', 'abc123.bin.done']) { const w = await (await dir.getFileHandle(n, { create: true })).createWritable(); await w.write('x'); await w.close(); }
104+});
98105 await p.goto(BASE + '/', { waitUntil: 'domcontentloaded' });
99106 await p.waitForTimeout(1200);
100107 const sinFS = await p.evaluate(() => ({
@@ -106,6 +113,17 @@
106113 await p.click('#try-browser');
107114 await p.waitForFunction(() => !document.getElementById('ide').hidden, null, { timeout: 30000 }).catch(() => {});
108115 ok('5 · «Probar en el navegador» abre el IDE', await p.evaluate(() => !document.getElementById('ide').hidden));
116+await p.waitForTimeout(800);
117+const visto = await p.evaluate(async () => ({
118+ arbol: [...document.querySelectorAll('#tree [data-path]')].map(e => e.dataset.path),
119+ lista: await (await import('/js/tools/code.js')).tree({ path: '' }).catch(e => 'error: ' + e.message),
120+ ficheros: await (await import('/js/tools/code.js')).fileList().catch(e => 'error: ' + e.message),
121+}));
122+ok('5 · …en su propia carpeta: ni el explorador ni las herramientas ven los pesos de los modelos',
123+ !visto.arbol.some(x => /elffuss-models/.test(x)) && !/elffuss-models/.test(JSON.stringify([visto.lista, visto.ficheros])), JSON.stringify(visto));
124+ok('5 · …y los pesos siguen intactos', await p.evaluate(async () => {
125+ try { await (await (await navigator.storage.getDirectory()).getDirectoryHandle('elffuss-models')).getFileHandle('abc123.bin'); return true; } catch { return false; }
126+}));
109127 await ctx.close();
110128
111129 console.log('\n errores JS:', errs[0] || 'ninguno');
modified web/js/main.js +5 −1
@@ -1400,8 +1400,12 @@
14001400 if (navigator.storage?.getDirectory) {
14011401 const probar = $('try-browser');
14021402 probar.hidden = false;
1403+ // Una carpeta PROPIA dentro del almacenamiento del navegador, no su raíz: en
1404+ // la raíz viven también los pesos de los modelos (elffuss-models), y abierta
1405+ // como proyecto el explorador, la paleta, la búsqueda y las herramientas del
1406+ // agente los enseñaban y podían editarlos o borrarlos.
14031407 probar.onclick = async () => {
1404- try { await enterIDE(await navigator.storage.getDirectory()); }
1408+ try { await enterIDE(await (await navigator.storage.getDirectory()).getDirectoryHandle('elffuss-code', { create: true })); }
14051409 catch (e) { avisaFalloApertura(e); }
14061410 };
14071411 }