utopia-ia/elffuss-code public
Changesets · Branches · Tags · Compare
| Changeset | e0342697fef523c98ff5dca160ab28dcae705ec7bc410691efc9b287101dcfb2 |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2026-10-10 18:30 +02:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2026-10-10 18:30 +02:00 |
| Parents | fe092393385c |
25 files changed
modified tests/alltools.mjs +2 −1
| @@ -3,11 +3,12 @@ | ||
| 3 | 3 | // ejecuta varias tool-calls de un mensaje. web.search/web.fetch usan internet |
| 4 | 4 | // real (proxy del servidor) → correr con BASE=https://code.elffuss.com. |
| 5 | 5 | import { chromium } from 'playwright'; |
| 6 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 6 | 7 | const BASE = process.env.BASE || 'https://code.elffuss.com'; |
| 7 | 8 | let fails = 0; |
| 8 | 9 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + String(e).replace(/\n/g, ' ').slice(0, 90) : '')); if (!c) fails++; }; |
| 9 | 10 | |
| 10 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 11 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 11 | 12 | const ctx = await b.newContext(); |
| 12 | 13 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 13 | 14 | const p = await ctx.newPage(); |
modified tests/appbuild_gif.mjs +2 −1
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | // apareciendo, para que se vea tanto el chat como el código real. Al final |
| 5 | 5 | // monta esas capturas en un GIF animado del proceso completo (ffmpeg). |
| 6 | 6 | import { chromium } from 'playwright'; |
| 7 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 7 | 8 | import { execFileSync } from 'node:child_process'; |
| 8 | 9 | import { mkdirSync, readdirSync } from 'node:fs'; |
| 9 | 10 | |
| @@ -27,7 +28,7 @@ | ||
| 27 | 28 | |
| 28 | 29 | const PROFILE = (process.env.SCRATCH || '/tmp/elffuss-test') + '/profile-code-gemma'; |
| 29 | 30 | const ctx = await chromium.launchPersistentContext(PROFILE, { |
| 30 | - args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', '--use-angle=metal'], | |
| 31 | + args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', ...CHROME_ARGS], | |
| 31 | 32 | viewport: { width: 1440, height: 900 }, |
| 32 | 33 | }); |
| 33 | 34 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'litert:gemma-e2b'); } catch {} }); |
modified tests/arch.mjs +2 −1
| @@ -1,9 +1,10 @@ | ||
| 1 | 1 | // Vista Arquitectura (grafo 3D fiel a CodeFlow, librería 3d-force-graph). |
| 2 | 2 | import { chromium } from 'playwright'; |
| 3 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 3 | 4 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 4 | 5 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 5 | 6 | let fails = 0; const ok = (n,c,e='')=>{console.log((c?'✅':'❌')+' '+n+(e?' — '+e:''));if(!c)fails++}; |
| 6 | -const b = await chromium.launch({ args:['--enable-unsafe-webgpu','--use-angle=metal'] }); | |
| 7 | +const b = await chromium.launch({ args:['--enable-unsafe-webgpu',...CHROME_ARGS] }); | |
| 7 | 8 | const ctx = await b.newContext(); await ctx.addInitScript(()=>{try{localStorage.setItem('elffusscode.model','rules')}catch{}}); |
| 8 | 9 | const p = await ctx.newPage({ viewport:{width:1500,height:900} }); |
| 9 | 10 | p.on('console', m=>{ if(m.type()==='error' && !/allow-same-origin/.test(m.text())) console.log(' console.error:', m.text().slice(0,140)); }); |
modified tests/bugs.mjs +2 −1
| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | // Bug A: al cerrar la última pestaña → estado vacío (no Monaco en blanco). |
| 2 | 2 | // Bug B: abrir/cerrar/alternar vistas (grafo/ciudad) → siempre cargan bien. |
| 3 | 3 | import { chromium } from 'playwright'; |
| 4 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 4 | 5 | const OUT=(process.env.SCRATCH || '/tmp/elffuss-test'); |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails=0; const ok=(n,c,e='')=>{console.log((c?'✅':'❌')+' '+n+(e?' — '+e:''));if(!c)fails++}; |
| 7 | -const b=await chromium.launch({args:['--enable-unsafe-webgpu','--use-angle=metal']}); | |
| 8 | +const b=await chromium.launch({args:['--enable-unsafe-webgpu',...CHROME_ARGS]}); | |
| 8 | 9 | const ctx=await b.newContext(); await ctx.addInitScript(()=>{try{localStorage.setItem('elffusscode.model','rules')}catch{}}); |
| 9 | 10 | const p=await ctx.newPage({viewport:{width:1500,height:900}}); |
| 10 | 11 | p.on('pageerror',e=>{if(!/allow-same-origin/.test(e.message))console.log(' pageerror:',e.message.slice(0,120))}); |
added tests/chrome-args.mjs +8 −0
| @@ -0,0 +1,8 @@ | ||
| 1 | +// Flags extra de Chromium para las pruebas con GPU. El backend gráfico que | |
| 2 | +// necesita cada máquina NO se fija en el código: se pasa por el entorno, | |
| 3 | +// separado por espacios, p. ej. | |
| 4 | +// | |
| 5 | +// ELFFUSS_CHROME_ARGS="--use-angle=<backend>" node tests/e4b_live.mjs | |
| 6 | +// | |
| 7 | +// Sin la variable, Chromium usa el suyo por defecto. | |
| 8 | +export const CHROME_ARGS = (process.env.ELFFUSS_CHROME_ARGS || '').split(/\s+/).filter(Boolean); |
modified tests/city.mjs +2 −1
| @@ -1,12 +1,13 @@ | ||
| 1 | 1 | // Verifica la Ciudad 3D (motor VibeCodeViewer vendorizado): siembra un proyecto |
| 2 | 2 | // anidado, abre la vista, comprueba que el WebGL pinta la metrópolis y captura. |
| 3 | 3 | import { chromium } from 'playwright'; |
| 4 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 4 | 5 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails = 0; |
| 7 | 8 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 8 | 9 | |
| 9 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 10 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 10 | 11 | const ctx = await b.newContext(); |
| 11 | 12 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 12 | 13 | const p = await ctx.newPage({ viewport: { width: 1500, height: 900 } }); |
modified tests/contrast.mjs +2 −1
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | // Verifica el contraste de las tarjetas de modelo (CEREBRO) tras el fix. |
| 2 | 2 | // Abre Ajustes, mide luminancia de título+subtítulo vs fondo y captura. |
| 3 | 3 | import { chromium } from 'playwright'; |
| 4 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 4 | 5 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | |
| @@ -8,7 +9,7 @@ | ||
| 8 | 9 | const ratio = (a, b) => { const [x, y] = [lum(a) + 0.05, lum(b) + 0.05]; return (Math.max(x, y) / Math.min(x, y)); }; |
| 9 | 10 | const parse = s => s.match(/\d+/g).slice(0, 3).map(Number); |
| 10 | 11 | |
| 11 | -const br = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 12 | +const br = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 12 | 13 | const ctx = await br.newContext(); |
| 13 | 14 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 14 | 15 | const p = await ctx.newPage({ viewport: { width: 1200, height: 820 } }); |
modified tests/demo_code_final.mjs +2 −1
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | // Doubles as an e2e smoke test: loads the real Gemma-4 model on WebGPU and |
| 5 | 5 | // exercises code.read / code.search / code.edit end to end. |
| 6 | 6 | import { chromium } from 'playwright'; |
| 7 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 7 | 8 | import { mkdirSync } from 'node:fs'; |
| 8 | 9 | const REC = process.env.REC || new URL('../../elffuss-assets/_recording', import.meta.url).pathname; |
| 9 | 10 | const OUT = process.env.OUT || REC + '/videos'; |
| @@ -23,7 +24,7 @@ | ||
| 23 | 24 | const PROFILE = process.env.PROFILE || REC + '/profile-code-gemma'; |
| 24 | 25 | mkdirSync(PROFILE, { recursive: true }); |
| 25 | 26 | const ctx = await chromium.launchPersistentContext(PROFILE, { |
| 26 | - args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', '--use-angle=metal', | |
| 27 | + args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', ...CHROME_ARGS, | |
| 27 | 28 | // WebGPU LLM inference issues long GPU dispatches; Chromium's GPU watchdog |
| 28 | 29 | // otherwise kills the GPU process mid-inference/-load → "Target page…closed". |
| 29 | 30 | '--disable-gpu-watchdog', '--disable-gpu-process-crash-limit'], |
modified tests/diag_sw.mjs +2 −1
| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | import { chromium } from 'playwright'; |
| 2 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 2 | 3 | const BASE = process.env.BASE || 'https://code.elffuss.com'; |
| 3 | 4 | const MODEL = process.env.M || 'litert:gemma-e2b'; |
| 4 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu','--use-angle=metal'] }); | |
| 5 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu',...CHROME_ARGS] }); | |
| 5 | 6 | const ctx = await b.newContext(); |
| 6 | 7 | await ctx.addInitScript(m => { try { localStorage.setItem('elffusscode.model', m) } catch {} }, MODEL); |
| 7 | 8 | const p = await ctx.newPage(); |
modified tests/e2e.mjs +2 −1
| @@ -4,12 +4,13 @@ | ||
| 4 | 4 | // |
| 5 | 5 | // BASE=https://code.elffuss.com node e2e.mjs |
| 6 | 6 | import { chromium } from 'playwright'; |
| 7 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 7 | 8 | |
| 8 | 9 | const BASE = process.env.BASE || 'https://code.elffuss.com'; |
| 9 | 10 | let fails = 0; |
| 10 | 11 | const ok = (name, cond, extra = '') => { console.log((cond ? '✅' : '❌') + ' ' + name + (extra ? ' — ' + extra : '')); if (!cond) fails++; }; |
| 11 | 12 | |
| 12 | -const browser = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 13 | +const browser = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 13 | 14 | |
| 14 | 15 | // siembra un proyecto en OPFS y entra al IDE |
| 15 | 16 | async function ide() { |
modified tests/e4b_live.mjs +7 −6
| @@ -6,11 +6,12 @@ | ||
| 6 | 6 | // Requisitos (por eso no está en run-tools.sh, que es determinista y rápido): |
| 7 | 7 | // · adaptador WebGPU real |
| 8 | 8 | // · perfil PERSISTENTE — en el contexto efímero de Playwright, Cache Storage |
| 9 | -// es de memoria y no traga GB (verificado: 1 GB ya falla ahí) | |
| 9 | +// vive en memoria y no aguanta un modelo entero (verificado) | |
| 10 | 10 | // · el .litertlm servido en local (E4B_URL) para no bajar 3 GB en cada corrida |
| 11 | 11 | // |
| 12 | 12 | // E4B_URL=http://localhost:8790/__e4b.litertlm PROFILE=/tmp/elf-e4b node e4b_live.mjs |
| 13 | 13 | import { chromium } from 'playwright'; |
| 14 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 14 | 15 | import { mkdirSync } from 'node:fs'; |
| 15 | 16 | import { tmpdir } from 'node:os'; |
| 16 | 17 | import { join } from 'node:path'; |
| @@ -24,12 +25,12 @@ | ||
| 24 | 25 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 25 | 26 | const log = (...a) => console.log('· ' + a.join(' ')); |
| 26 | 27 | |
| 27 | -// OJO: el Chromium que trae Playwright MUERE cargando E4B (2,97 GB) — medido: | |
| 28 | -// 3 intentos, 3 muertes del navegador, >18 min cada una. Con el Chrome REAL | |
| 29 | -// instalado, lo mismo tarda ~90 s y funciona. Por eso el canal es 'chrome'. | |
| 28 | +// OJO: el Chromium que trae Playwright MUERE cargando E4B: 3 intentos, 3 | |
| 29 | +// muertes del navegador. Con el Chrome REAL instalado funciona. Por eso el | |
| 30 | +// canal es 'chrome'. | |
| 30 | 31 | const ctx = await chromium.launchPersistentContext(PROFILE, { |
| 31 | 32 | channel: process.env.CHANNEL || 'chrome', |
| 32 | - args: ['--enable-unsafe-webgpu', '--use-angle=metal'], | |
| 33 | + args: ['--enable-unsafe-webgpu', ...CHROME_ARGS], | |
| 33 | 34 | timeout: 120000, |
| 34 | 35 | }); |
| 35 | 36 | const p = await ctx.newPage(); |
| @@ -39,7 +40,7 @@ | ||
| 39 | 40 | await p.waitForTimeout(1500); |
| 40 | 41 | |
| 41 | 42 | // ---------- 1 · carga real del modelo ---------- |
| 42 | -log('cargando E4B (~3 GB a la GPU), puede tardar varios minutos…'); | |
| 43 | +log('cargando E4B…'); | |
| 43 | 44 | const load = await p.evaluate(async (url) => { |
| 44 | 45 | const m = await import('/js/providers/litert.js'); |
| 45 | 46 | m.MODELS['gemma-e4b'].url = url; // apuntamos a la copia local |
modified tests/litert-stop-real.mjs +3 −2
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | // |
| 15 | 15 | // E4B_URL=http://localhost:8790/__e4b.litertlm PROFILE=/tmp/elf-e4b node litert-stop-real.mjs |
| 16 | 16 | import { chromium } from 'playwright'; |
| 17 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 17 | 18 | import { mkdirSync } from 'node:fs'; |
| 18 | 19 | import { tmpdir } from 'node:os'; |
| 19 | 20 | import { join } from 'node:path'; |
| @@ -29,7 +30,7 @@ | ||
| 29 | 30 | |
| 30 | 31 | const ctx = await chromium.launchPersistentContext(PROFILE, { |
| 31 | 32 | channel: process.env.CHANNEL || 'chrome', |
| 32 | - args: ['--enable-unsafe-webgpu', '--use-angle=metal'], | |
| 33 | + args: ['--enable-unsafe-webgpu', ...CHROME_ARGS], | |
| 33 | 34 | timeout: 120000, |
| 34 | 35 | }); |
| 35 | 36 | const p = await ctx.newPage(); |
| @@ -37,7 +38,7 @@ | ||
| 37 | 38 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 38 | 39 | await p.waitForTimeout(1500); |
| 39 | 40 | |
| 40 | -log('cargando E4B (~3 GB a la GPU), puede tardar varios minutos…'); | |
| 41 | +log('cargando E4B…'); | |
| 41 | 42 | const load = await p.evaluate(async (url) => { |
| 42 | 43 | const m = await import('/js/providers/litert.js'); |
| 43 | 44 | m.MODELS['gemma-e4b'].url = url; |
modified tests/litertcache.mjs +2 −1
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | // (persistente) y en la 2ª llamada devuelve el blob SIN red (offline). Usa un |
| 3 | 3 | // fixture .litertlm determinista (no baja los GB reales). |
| 4 | 4 | import { chromium } from 'playwright'; |
| 5 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 5 | 6 | import { writeFileSync, rmSync } from 'node:fs'; |
| 6 | 7 | import { fileURLToPath } from 'node:url'; |
| 7 | 8 | import { dirname, join } from 'node:path'; |
| @@ -14,7 +15,7 @@ | ||
| 14 | 15 | process.on('exit', ()=>{ try{rmSync(FIXP)}catch{} }); |
| 15 | 16 | const FIX = BASE + '/__litert_fixture.litertlm'; |
| 16 | 17 | |
| 17 | -const b = await chromium.launch({args:['--enable-unsafe-webgpu','--use-angle=metal']}); | |
| 18 | +const b = await chromium.launch({args:['--enable-unsafe-webgpu',...CHROME_ARGS]}); | |
| 18 | 19 | const ctx = await b.newContext(); |
| 19 | 20 | const p = await ctx.newPage(); |
| 20 | 21 | await p.goto(BASE+'/', {waitUntil:'domcontentloaded'}); |
modified tests/longsession.mjs +2 −1
| @@ -8,12 +8,13 @@ | ||
| 8 | 8 | // SEMANTIC=on node tests/longsession.mjs → BM25 + embeddings |
| 9 | 9 | // La segunda descarga el modelo de embeddings la primera vez que se corre. |
| 10 | 10 | import { chromium } from 'playwright'; |
| 11 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 11 | 12 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 12 | 13 | const SEM = process.env.SEMANTIC === 'on'; |
| 13 | 14 | let fails = 0; |
| 14 | 15 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 15 | 16 | |
| 16 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 17 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 17 | 18 | const ctx = await b.newContext(); |
| 18 | 19 | await ctx.addInitScript(sem => { |
| 19 | 20 | try { |
modified tests/mind.mjs +2 −1
| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | // Mente v2: mundo audio-reactivo + consolas flotantes + nodos clicables + |
| 2 | 2 | // config de cerebro + persistencia (música/animación) + reporte al chat. |
| 3 | 3 | import { chromium } from 'playwright'; |
| 4 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 4 | 5 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails = 0; const ok = (n,c,e='')=>{console.log((c?'✅':'❌')+' '+n+(e?' — '+e:''));if(!c)fails++}; |
| 7 | -const b = await chromium.launch({ args:['--enable-unsafe-webgpu','--use-angle=metal','--autoplay-policy=no-user-gesture-required'] }); | |
| 8 | +const b = await chromium.launch({ args:['--enable-unsafe-webgpu',...CHROME_ARGS,'--autoplay-policy=no-user-gesture-required'] }); | |
| 8 | 9 | const ctx = await b.newContext(); await ctx.addInitScript(()=>{try{localStorage.setItem('elffusscode.model','rules')}catch{}}); |
| 9 | 10 | const p = await ctx.newPage({ viewport:{width:1500,height:900} }); |
| 10 | 11 | p.on('console', m=>{ if(m.type()==='error' && !/allow-same-origin|soundcloud|widget|encrypted-media|permissions policy/i.test(m.text())) console.log(' err:', m.text().slice(0,140)); }); |
modified tests/mind_stars.mjs +2 −1
| @@ -1,11 +1,12 @@ | ||
| 1 | 1 | // Mente v3: estrellas por perfil (no consolas), historial completo, perfiles |
| 2 | 2 | // editables, ciudad de fondo + haces de actividad, y tool-calling REAL del CEO. |
| 3 | 3 | import { chromium } from 'playwright'; |
| 4 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 4 | 5 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 7 | 8 | |
| 8 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal', '--autoplay-policy=no-user-gesture-required'] }); | |
| 9 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS, '--autoplay-policy=no-user-gesture-required'] }); | |
| 9 | 10 | const ctx = await b.newContext(); |
| 10 | 11 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); localStorage.removeItem('elffusscode.ceoProfiles'); } catch {} }); |
| 11 | 12 | const p = await ctx.newPage({ viewport: { width: 1500, height: 900 } }); |
modified tests/mind_video.mjs +2 −1
| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | import { chromium } from 'playwright'; |
| 2 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 2 | 3 | const VDIR=(process.env.SCRATCH || '/tmp/elffuss-test') + '/vid'; |
| 3 | 4 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 4 | -const b=await chromium.launch({args:['--enable-unsafe-webgpu','--use-angle=metal','--autoplay-policy=no-user-gesture-required']}); | |
| 5 | +const b=await chromium.launch({args:['--enable-unsafe-webgpu',...CHROME_ARGS,'--autoplay-policy=no-user-gesture-required']}); | |
| 5 | 6 | const ctx=await b.newContext({viewport:{width:1280,height:720},recordVideo:{dir:VDIR,size:{width:1280,height:720}}}); |
| 6 | 7 | await ctx.addInitScript(()=>{try{localStorage.setItem('elffusscode.model','rules')}catch{}}); |
| 7 | 8 | const p=await ctx.newPage(); |
modified tests/mindpersist.mjs +2 −1
| @@ -2,10 +2,11 @@ | ||
| 2 | 2 | // memoria/DOM — al recargar la página (cerrar pestaña, refrescar) se perdía |
| 3 | 3 | // todo. Ahora se persiste en IndexedDB y sobrevive a una recarga REAL. |
| 4 | 4 | import { chromium } from 'playwright'; |
| 5 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 7 | 8 | |
| 8 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal', '--autoplay-policy=no-user-gesture-required'] }); | |
| 9 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS, '--autoplay-policy=no-user-gesture-required'] }); | |
| 9 | 10 | const ctx = await b.newContext(); await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 10 | 11 | const p = await ctx.newPage({ viewport: { width: 1300, height: 850 } }); |
| 11 | 12 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); await p.waitForTimeout(1500); |
modified tests/modelcache.mjs +2 −1
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | // desde Cache Storage (incluso OFFLINE) y soporta range requests. Usa un fixture |
| 3 | 3 | // .litertlm determinista (byte[i] = i%256) para no bajar los GB reales. |
| 4 | 4 | import { chromium } from 'playwright'; |
| 5 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 5 | 6 | import { writeFileSync, rmSync } from 'node:fs'; |
| 6 | 7 | import { fileURLToPath } from 'node:url'; |
| 7 | 8 | import { dirname, join } from 'node:path'; |
| @@ -18,7 +19,7 @@ | ||
| 18 | 19 | const cleanup = () => { try { rmSync(FIXPATH); } catch {} }; |
| 19 | 20 | process.on('exit', cleanup); |
| 20 | 21 | |
| 21 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 22 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 22 | 23 | const ctx = await b.newContext(); |
| 23 | 24 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 24 | 25 | const p = await ctx.newPage({ viewport: { width: 1200, height: 800 } }); |
modified tests/multiwrite.mjs +2 −1
| @@ -2,11 +2,12 @@ | ||
| 2 | 2 | // code.write debe escribir TODOS los ficheros con su contenido. Inyectamos un |
| 3 | 3 | // proveedor falso (sin modelo real) y comprobamos el contenido en OPFS. |
| 4 | 4 | import { chromium } from 'playwright'; |
| 5 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 5 | 6 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 6 | 7 | let fails = 0; |
| 7 | 8 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 8 | 9 | |
| 9 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 10 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 10 | 11 | const ctx = await b.newContext(); |
| 11 | 12 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 12 | 13 | const p = await ctx.newPage(); |
modified tests/prompthist.mjs +2 −1
| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | // Historial del prompt del chat: ↑/↓ recuperan lo enviado y ciclan. |
| 2 | 2 | import { chromium } from 'playwright'; |
| 3 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 3 | 4 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 4 | 5 | let fails = 0; |
| 5 | 6 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 6 | 7 | |
| 7 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 8 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 8 | 9 | const ctx = await b.newContext(); |
| 9 | 10 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 10 | 11 | const p = await ctx.newPage({ viewport: { width: 1400, height: 900 } }); |
modified tests/swe_bench.mjs +2 −1
| @@ -10,13 +10,14 @@ | ||
| 10 | 10 | // |
| 11 | 11 | // Salida estilo results.tsv de agentic-install + score final resolved/N. |
| 12 | 12 | import { chromium } from 'playwright'; |
| 13 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 13 | 14 | import { TASKS } from './swe/tasks.js'; |
| 14 | 15 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 15 | 16 | const SOLVER = process.env.SOLVER || 'scripted'; |
| 16 | 17 | const MODEL = process.env.M || 'rules'; |
| 17 | 18 | const TIMEOUT = +(process.env.TIMEOUT || (SOLVER === 'model' ? 180000 : 15000)); |
| 18 | 19 | |
| 19 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 20 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 20 | 21 | const ctx = await b.newContext(); |
| 21 | 22 | await ctx.addInitScript(m => { try { localStorage.setItem('elffusscode.model', m); } catch {} }, SOLVER === 'model' ? MODEL : 'rules'); |
| 22 | 23 | const p = await ctx.newPage(); |
modified tests/swe_style.mjs +2 −1
| @@ -8,11 +8,12 @@ | ||
| 8 | 8 | // harness sea determinista en CI. Cambiando `fake` por el provider real (Gemma/ |
| 9 | 9 | // heal) se mide al modelo de verdad: el arnés y la verificación son los mismos. |
| 10 | 10 | import { chromium } from 'playwright'; |
| 11 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 11 | 12 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 12 | 13 | let fails = 0; |
| 13 | 14 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 14 | 15 | |
| 15 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 16 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 16 | 17 | const ctx = await b.newContext(); |
| 17 | 18 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 18 | 19 | const p = await ctx.newPage(); |
modified tests/terminal.mjs +2 −1
| @@ -4,12 +4,13 @@ | ||
| 4 | 4 | // El shell importado en page.evaluate es el MISMO singleton que usa la app |
| 5 | 5 | // (los módulos ES se cachean por realm) → comparte el proyecto abierto. |
| 6 | 6 | import { chromium } from 'playwright'; |
| 7 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 7 | 8 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| 8 | 9 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 9 | 10 | let fails = 0; |
| 10 | 11 | const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 11 | 12 | |
| 12 | -const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', '--use-angle=metal'] }); | |
| 13 | +const b = await chromium.launch({ args: ['--enable-unsafe-webgpu', ...CHROME_ARGS] }); | |
| 13 | 14 | const ctx = await b.newContext(); |
| 14 | 15 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 15 | 16 | const p = await ctx.newPage({ viewport: { width: 1500, height: 900 } }); |
modified tests/warmup_code.mjs +2 −1
| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | import { chromium } from 'playwright'; |
| 2 | +import { CHROME_ARGS } from './chrome-args.mjs'; | |
| 2 | 3 | const BASE = process.env.BASE || 'https://code.elffuss.com'; |
| 3 | 4 | const PROFILE = (process.env.SCRATCH || '/tmp/elffuss-test') + '/profile-code-gemma'; |
| 4 | 5 | const ctx = await chromium.launchPersistentContext(PROFILE, { |
| 5 | - args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', '--use-angle=metal'], | |
| 6 | + args: ['--autoplay-policy=no-user-gesture-required', '--enable-unsafe-webgpu', ...CHROME_ARGS], | |
| 6 | 7 | viewport: { width: 1440, height: 900 }, |
| 7 | 8 | }); |
| 8 | 9 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'litert:gemma-e2b'); } catch {} }); |