utopia-ia/elffuss-code public
Changesets · Branches · Tags · Compare
| Changeset | 144b741f2d623ac24c1dfc1dbf1a4bfe361255b5ed357ffb73a22a5afb9a736f |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2026-10-11 15:12 +02:00 |
| Parents | 8b50ce4fd39f |
4 files changed
modified tests/ceo_persist.mjs +3 −1
| @@ -12,7 +12,9 @@ | ||
| 12 | 12 | await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); |
| 13 | 13 | const p = await ctx.newPage(); |
| 14 | 14 | const errors = []; |
| 15 | -p.on('console', m => { if (m.type() === 'error') errors.push(m.text()); }); | |
| 15 | +// El motor propio (web/js/engine) no se publica con este repo: donde no está, sus | |
| 16 | +// sondas dan 404, y eso no es un error de este flujo. | |
| 17 | +p.on('console', m => { if (m.type() === 'error' && !/\/js\/engine\//.test(m.location()?.url || '')) errors.push(m.text()); }); | |
| 16 | 18 | p.on('pageerror', e => errors.push('PAGEERROR: ' + e.message)); |
| 17 | 19 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); await p.waitForTimeout(1500); |
| 18 | 20 |
modified tests/mind_stars.mjs +30 −15
| @@ -1,5 +1,11 @@ | ||
| 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 | +// | |
| 4 | +// Lo que depende del tiempo de la animación (estrellas, haces y vuelo viven | |
| 5 | +// unos segundos de reloj de fotogramas) se mide en el MISMO paso que lo | |
| 6 | +// provoca, no tras una espera fija: con el backend gráfico por defecto (sin | |
| 7 | +// ELFFUSS_CHROME_ARGS) un fotograma lento avanza ese reloj de golpe, y un haz de | |
| 8 | +// 1,4 s o un vuelo de 1,1 s ya habían terminado cuando se miraban. | |
| 3 | 9 | import { chromium } from 'playwright'; |
| 4 | 10 | import { CHROME_ARGS } from './chrome-args.mjs'; |
| 5 | 11 | const OUT = (process.env.SCRATCH || '/tmp/elffuss-test'); |
| @@ -36,15 +42,21 @@ | ||
| 36 | 42 | ok('ciudad de fondo construida bajo la Mente', dbg.hasCity, JSON.stringify(dbg)); |
| 37 | 43 | |
| 38 | 44 | // estrellas: una línea normal vs una tool-call deben crear estrellas (tamaño/estilo distinto por kind, verificado por código) |
| 39 | -const before = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).starCount; | |
| 40 | -await p.evaluate(async () => { const m = await import('/js/mind.js'); m.pushThought('arq', { type: 'open', name: 'Arquitectura' }); m.pushThought('arq', { type: 'token', text: 'Esta es una línea de pensamiento normal que se vuelve estrella.\n' }); }); | |
| 41 | -await p.waitForTimeout(200); | |
| 42 | -const afterLine = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).starCount; | |
| 43 | -ok('una línea de texto crea una estrella', afterLine > before, `${before}→${afterLine}`); | |
| 44 | -await p.evaluate(async (mark) => { const m = await import('/js/mind.js'); m.pushThought('arq', { type: 'tool', text: 'leyendo README.md…', path: 'README.md' }); }, MARK); | |
| 45 | -await p.waitForTimeout(200); | |
| 46 | -const afterTool = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).starCount; | |
| 47 | -ok('una tool-call crea otra estrella', afterTool > afterLine, `${afterLine}→${afterTool}`); | |
| 45 | +const linea = await p.evaluate(async () => { | |
| 46 | + const m = await import('/js/mind.js'); | |
| 47 | + const antes = m._debug().starCount; | |
| 48 | + m.pushThought('arq', { type: 'open', name: 'Arquitectura' }); | |
| 49 | + m.pushThought('arq', { type: 'token', text: 'Esta es una línea de pensamiento normal que se vuelve estrella.\n' }); | |
| 50 | + return { antes, despues: m._debug().starCount }; | |
| 51 | +}); | |
| 52 | +ok('una línea de texto crea una estrella', linea.despues > linea.antes, `${linea.antes}→${linea.despues}`); | |
| 53 | +const tool = await p.evaluate(async () => { | |
| 54 | + const m = await import('/js/mind.js'); | |
| 55 | + const antes = m._debug().starCount; | |
| 56 | + m.pushThought('arq', { type: 'tool', text: 'leyendo README.md…', path: 'README.md' }); | |
| 57 | + return { antes, dbg: m._debug() }; | |
| 58 | +}); | |
| 59 | +ok('una tool-call crea otra estrella', tool.dbg.starCount > tool.antes, `${tool.antes}→${tool.dbg.starCount}`); | |
| 48 | 60 | |
| 49 | 61 | // el historial completo muestra TODO (línea + tool) |
| 50 | 62 | const logText = await p.evaluate(() => document.getElementById('mind-log-body').innerText); |
| @@ -52,8 +64,7 @@ | ||
| 52 | 64 | ok('el historial recoge la tool-call', /leyendo README\.md/.test(logText)); |
| 53 | 65 | |
| 54 | 66 | // haz de actividad sobre la ciudad (README.md existe en el modelo → beam real) |
| 55 | -dbg = await p.evaluate(async () => (await import('/js/mind.js'))._debug()); | |
| 56 | -ok('la tool-call sobre un fichero real generó un haz + resaltado', dbg.beamCount > 0 && dbg.fileActivityCount > 0, JSON.stringify(dbg)); | |
| 67 | +ok('la tool-call sobre un fichero real generó un haz + resaltado', tool.dbg.beamCount > 0 && tool.dbg.fileActivityCount > 0, JSON.stringify(tool.dbg)); | |
| 57 | 68 | |
| 58 | 69 | // editor de perfiles: renombrar Arquitectura y cambiar color, guardar |
| 59 | 70 | await p.click('#mind-config'); await p.waitForTimeout(300); |
| @@ -99,11 +110,15 @@ | ||
| 99 | 110 | |
| 100 | 111 | // clic en la leyenda → la cámara VUELA a centrarse (posición cambia de verdad) |
| 101 | 112 | const posBefore = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).cameraPos; |
| 102 | -await p.click('.ml-item[data-id="rend"]'); // perfil lejos de la posición inicial de cámara | |
| 103 | -await p.waitForTimeout(150); | |
| 104 | -const midFly = await p.evaluate(async () => (await import('/js/mind.js'))._debug()); | |
| 113 | +// el clic, y en el mismo paso, ¿hay vuelo en marcha? | |
| 114 | +const midFly = await p.evaluate(async () => { | |
| 115 | + const m = await import('/js/mind.js'); | |
| 116 | + document.querySelector('.ml-item[data-id="rend"]').click(); // perfil lejos de la posición inicial de cámara | |
| 117 | + return m._debug(); | |
| 118 | +}); | |
| 105 | 119 | ok('el clic dispara el vuelo (flying=true a mitad de camino)', midFly.flying); |
| 106 | -await p.waitForTimeout(1300); // esperar a que termine (dur 1.1s) | |
| 120 | +// que termine (dura 1,1 s de reloj de fotogramas) | |
| 121 | +await p.waitForFunction(async () => !(await import('/js/mind.js'))._debug().flying, null, { timeout: 15000 }).catch(() => {}); | |
| 107 | 122 | const posAfter = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).cameraPos; |
| 108 | 123 | const moved = Math.hypot(posAfter[0] - posBefore[0], posAfter[1] - posBefore[1], posAfter[2] - posBefore[2]); |
| 109 | 124 | ok('la cámara realmente se movió al centrarse en el perfil', moved > 5, `desplazamiento ${moved.toFixed(1)}`); |
modified tests/stop.mjs +6 −2
| @@ -9,8 +9,12 @@ | ||
| 9 | 9 | const BASE = process.env.BASE || 'http://localhost:8799'; |
| 10 | 10 | let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; }; |
| 11 | 11 | |
| 12 | -const b = await chromium.launch({ channel: 'chrome', headless: true }); | |
| 13 | -const p = await (await b.newContext()).newPage(); | |
| 12 | +const b = await chromium.launch(); | |
| 13 | +const ctx = await b.newContext(); | |
| 14 | +// Modo Básico: sin esto, al abrir la página main.js se pone a cargar el modelo | |
| 15 | +// local por defecto (preloadModel) en mitad de la prueba, que no lo necesita. | |
| 16 | +await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} }); | |
| 17 | +const p = await ctx.newPage(); | |
| 14 | 18 | // Telemetría: se cuentan los informes en vez de dejarlos salir. |
| 15 | 19 | let informes = 0; |
| 16 | 20 | await p.route('**/proxy/report', route => { informes++; return route.fulfill({ status: 204, body: '' }); }); |
modified tests/stopqueue.mjs +10 −4
| @@ -50,7 +50,11 @@ | ||
| 50 | 50 | }; |
| 51 | 51 | }); |
| 52 | 52 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 53 | -await p.waitForTimeout(1500); | |
| 53 | +// Que el IDE haya abierto de verdad (Monaco y las conversaciones): con una | |
| 54 | +// espera fija, en una máquina cargada se mandaba antes de que existiera la | |
| 55 | +// conversación y el mensaje no iba a ninguna parte. | |
| 56 | +const listo = pg => pg.waitForFunction(() => window.elffussClaw?.conv?.getActive?.(), null, { timeout: 30000 }); | |
| 57 | +await listo(p); | |
| 54 | 58 | await ayudantes(); |
| 55 | 59 | |
| 56 | 60 | // 1. Parar mientras espera el cerrojo → el modelo ni se llama |
| @@ -169,7 +173,8 @@ | ||
| 169 | 173 | ok('3 · justo después de parar, IndexedDB ya tiene la cola vacía (el turno aún se está soltando)', |
| 170 | 174 | r3.sigueTrabajando && r3.colaGuardada === 0, `cola guardada ${r3.colaGuardada}`); |
| 171 | 175 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 172 | -await p.waitForTimeout(2500); | |
| 176 | +await listo(p); | |
| 177 | +await p.waitForTimeout(1000); | |
| 173 | 178 | await ayudantes(); |
| 174 | 179 | const r3b = await p.evaluate(async (id) => { |
| 175 | 180 | const db = await import('/js/db.js'); |
| @@ -336,7 +341,8 @@ | ||
| 336 | 341 | // acepta, como haría quien recarga a propósito. |
| 337 | 342 | p.once('dialog', d => d.accept().catch(() => {})); |
| 338 | 343 | await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 339 | -await p.waitForTimeout(2500); | |
| 344 | +await listo(p); | |
| 345 | +await p.waitForTimeout(1000); | |
| 340 | 346 | await ayudantes(); |
| 341 | 347 | const tarjeta6b = await p.evaluate(() => { |
| 342 | 348 | const c = [...document.querySelectorAll('.plan-card')].at(-1); |
| @@ -388,7 +394,7 @@ | ||
| 388 | 394 | const pe = await ctxEn.newPage({ viewport: { width: 1300, height: 900 } }); |
| 389 | 395 | pe.on('pageerror', e => errs.push(e.message.slice(0, 160))); |
| 390 | 396 | await pe.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' }); |
| 391 | - await pe.waitForTimeout(1500); | |
| 397 | + await listo(pe); | |
| 392 | 398 | const inicial = await boton(pe); |
| 393 | 399 | await pe.evaluate(async () => { |
| 394 | 400 | window.__dormir = ms => new Promise(r => setTimeout(r, ms)); |