Elffuss BraidHub

utopia-ia/elffuss-claw public

Model storage: wait for the engine's list of broker origins

Elffuss Code's ead881c fixed this in its model-cache.js, and Claw's
model-storage.js (ux-fix) had the same line: origenesAlmacen() from the
engine registry may return the list or a promise of it, and a promise cannot
be iterated. The TypeError was caught and only the default broker was left,
so the 💾 chip and "Clear model cache" silently skipped the engine's own
hosts (m1, m2), where the big model lives. The default broker stays in the
list always, as before (Code's 825341e; Claw already had it).

ux-modelos.mjs's stand-in registry now returns a promise; on the previous
code three checks fail (Settings does not ask m1 and m2, the clear does not
reach them, and the freed total misses them).
Changesetbfc062d16e408372a333dd0df7af7172b16932bcfdb4287fb4d5665604136ed4
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 18:19 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 18:19 +02:00
Parents6479ddcbb775

Browse the files at this changeset

2 files changed

modified tests/ux-modelos.mjs +3 −1
@@ -107,8 +107,10 @@
107107 }`;
108108 const { ctx: c2 } = await contexto(b, { grants: ['apps'] });
109109 await servirBroker(c2, DOBLE);
110+ // origenesAlmacen() del registro puede devolver la lista o una promesa de
111+ // ella: el doble devuelve una promesa, que es el caso que se perdía.
110112 await c2.route('**/js/engine/registro.js', route => route.fulfill({ contentType: 'text/javascript',
111- body: "export const MODELS = {}; export async function disponible() { return false; } export function origenesAlmacen() { return ['https://m1.elffuss.com/', 'https://m2.elffuss.com/']; }" }));
113+ body: "export const MODELS = {}; export async function disponible() { return false; } export async function origenesAlmacen() { return ['https://m1.elffuss.com/', 'https://m2.elffuss.com/']; }" }));
112114 const { p: q, errores: errQ } = await pagina(c2);
113115 await q.evaluate(async () => {
114116 const c = await caches.open('transformers-cache');
modified web/js/model-storage.js +6 −2
@@ -20,12 +20,16 @@
2020 const DIR_MODELOS = 'elffuss-models'; // el de runtime/model-store.js
2121
2222 // Orígenes de broker con pesos: los que dice el registro del motor (si está
23-// desplegado: llega por rsync) y el broker por defecto.
23+// desplegado: llega por rsync) y el broker por defecto, que va siempre: guarda
24+// los modelos de otros hosts (Gemma de LiteRT, el Qwen del motor).
25+// origenesAlmacen() puede devolver la lista o una promesa de ella: se espera
26+// (como en el model-cache.js de Elffuss Code). Sin esperarla, una promesa no se
27+// podía recorrer y se quedaba solo el broker por defecto, sin avisar.
2428 export async function origenesDeBroker() {
2529 const o = new Set([broker.BROKER_URL]);
2630 try {
2731 const r = await import('./engine/registro.js');
28- for (const x of (r.origenesAlmacen?.() || [])) o.add(x);
32+ for (const x of ((await r.origenesAlmacen?.()) || [])) o.add(x);
2933 } catch { /* sin motor: solo el broker por defecto */ }
3034 return [...o];
3135 }