utopia-ia/elffuss-code public
Changesets · Branches · Tags · Compare
| Changeset | 6fb41f3536ee7a104b8cb5d694049bd213a9fd04a5a71c1e3edde2fbb4450a15 |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2026-10-10 19:31 +02:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2026-10-11 14:15 +02:00 |
| Parents | a173c6d98b7c |
2 files changed
modified tests/landing.mjs +19 −1
| @@ -11,7 +11,8 @@ | ||
| 11 | 11 | // se dice en la landing. |
| 12 | 12 | // 5. Sin File System Access (Firefox, Safari): los botones que no pueden |
| 13 | 13 | // 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). | |
| 15 | 16 | // Nada sale a la red: el selector de carpetas va de mentira y nunca se llega a |
| 16 | 17 | // listar un repo. |
| 17 | 18 | // |
| @@ -95,6 +96,12 @@ | ||
| 95 | 96 | |
| 96 | 97 | // 5 · navegador sin File System Access |
| 97 | 98 | ({ 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 | +}); | |
| 98 | 105 | await p.goto(BASE + '/', { waitUntil: 'domcontentloaded' }); |
| 99 | 106 | await p.waitForTimeout(1200); |
| 100 | 107 | const sinFS = await p.evaluate(() => ({ |
| @@ -106,6 +113,17 @@ | ||
| 106 | 113 | await p.click('#try-browser'); |
| 107 | 114 | await p.waitForFunction(() => !document.getElementById('ide').hidden, null, { timeout: 30000 }).catch(() => {}); |
| 108 | 115 | 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 | +})); | |
| 109 | 127 | await ctx.close(); |
| 110 | 128 | |
| 111 | 129 | console.log('\n errores JS:', errs[0] || 'ninguno'); |
modified web/js/main.js +5 −1
| @@ -1400,8 +1400,12 @@ | ||
| 1400 | 1400 | if (navigator.storage?.getDirectory) { |
| 1401 | 1401 | const probar = $('try-browser'); |
| 1402 | 1402 | 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. | |
| 1403 | 1407 | 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 })); } | |
| 1405 | 1409 | catch (e) { avisaFalloApertura(e); } |
| 1406 | 1410 | }; |
| 1407 | 1411 | } |