Elffuss BraidHub

utopia-ia/elffuss-code public

Basic-mode help and notification clicks point where they should

rules.js told users to load a model with the "selector 🧠", which is
hidden and never shown; it now points to ⚙️ Settings → Brain (or the model
status dot).

sw.js sent a notification's action to the first window client, which
could be lab.html, so "Run" or "View in the Mind" could land on the Lab and
be lost. It now targets an IDE window, and when no window is open it opens
the IDE with ?notif=open|execute instead of a bare "/", which dropped the
action. (The IDE side, which opens the Mind for that parameter, comes in
the next commit.)
Changeset7aca986db5871ca6f7f09f510cc8c77ab1cd6f9ce2e242e5e965e15cea601c78
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-10 16:44 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 14:15 +02:00
Parents9397a186eb6c

Browse the files at this changeset

2 files changed

modified web/js/providers/rules.js +1 −1
@@ -9,7 +9,7 @@
99 • «lee <archivo>» · «abre <archivo>»
1010 • «busca <texto>»
1111 • «escribe <archivo>: <contenido>»
12-Para programar de verdad, carga el modelo local (selector 🧠) o configura uno en ⚙️.`;
12+Para programar de verdad, elige un modelo en ⚙️ Ajustes → Cerebro (o pulsa el punto de estado del modelo, arriba a la derecha).`;
1313
1414 export async function chat(history, systemPrompt) {
1515 const last = history[history.length - 1];
modified web/sw.js +8 −2
@@ -26,18 +26,24 @@
2626 // notificaciones normales (new Notification()) no soportan acciones, las que
2727 // pasan por el SW (registration.showNotification) sí. Al pulsar, avisamos a
2828 // la pestaña (postMessage) para que mande la propuesta a la cola real.
29+//
30+// A la ventana del IDE, no a la primera que haya: con el Lab abierto (lab.html)
31+// el aviso podía irse a él y perderse. Y si no hay ninguna ventana abierta, se
32+// abre el IDE con la acción en la URL (?notif=…) para que la Mente aparezca en
33+// cuanto el proyecto esté abierto; antes se abría «/» y la propuesta se perdía.
2934 self.addEventListener('notificationclick', event => {
3035 const action = event.action; // 'execute' | 'open' | '' (clic en el cuerpo)
3136 const data = event.notification.data || {};
3237 event.notification.close();
3338 event.waitUntil((async () => {
3439 const clientsList = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
35- const client = clientsList[0];
40+ const esIDE = c => { try { const u = new URL(c.url); return !/\/lab\.html$/.test(u.pathname); } catch { return false; } };
41+ const client = clientsList.find(esIDE);
3642 if (client) {
3743 client.postMessage({ type: 'notif-action', action, md: data.md });
3844 client.focus?.();
3945 } else if (self.clients.openWindow) {
40- await self.clients.openWindow('/');
46+ await self.clients.openWindow('./?notif=' + (action === 'execute' ? 'execute' : 'open'));
4147 }
4248 })());
4349 });